pyats.aereport.utils package¶
utils
– Utilities module¶
This module contains helper classes and functions.
-
pyats.aereport.utils.
format_time_portion
(time_portion)¶ Makes sure that a time portion (hours, minutes, seconds) is at least two digits. It doesn’t accept negative values.
-
pyats.aereport.utils.
format_timedelta
(tdelta)¶ Given a timedelta object, it returns a string in the form: hh:mm:ss
- Parameters
tdelta (timedelta) –
- Returns
A string in the form hh:mm:ss
- Return type
-
pyats.aereport.utils.
get_file_name
(filepath)¶ Gets the file name portion of path/to/a/file :param filepath: Path to the file :type filepath: str
- Returns
filename – Name of the file
- Return type
-
pyats.aereport.utils.
get_file_size
(filepath)¶ Gets the size of the provided file (in bytes)
-
pyats.aereport.utils.
get_ppid
(pid)¶ Gets the parent process ID of the given process
-
pyats.aereport.utils.
print_block
(block_title, block_content)¶ Prints a formatted block with a title and content
Submodules¶
argsvalidator
– ArgsValidator Class¶
This module contains a ArgsValidator which can be used to verify that args (or any dictionary-like members) satisfy a given criteria.
-
class
pyats.aereport.utils.argsvalidator.
ArgsValidator
¶ Bases:
object
ArgsValidator is a helper class that can be used from anywhere to verify that method arguments satisfy certain criteria such as mandatory/optional, datatype, etc.
-
classmethod
validate
(args_def, restrict=False, **kwargs)¶ - Parameters
args_def (list) – list of tuples containing criteria of anticipated arguments e.g. mandatory/optional, type, etc Each tuple will look like this: (variable_name, ‘m’/’o’, [possible types], [valid_keys/options], [dic_mand_keys]) e.g. [ (var1, ‘m’, [str]), (var2, ‘o’, [int, bool]), (var3, ‘m’, dict, [‘key1’, ‘key2’], [‘key1’]) ]
- Returns
- Return type
Nothing
- Raises
-
classmethod