pyinfra.api.util module¶
-
pyinfra.api.util.format_exception(e)¶
-
pyinfra.api.util.get_args_kwargs_spec(func: Callable[[...], Any]) Tuple[List, Dict]¶
-
pyinfra.api.util.get_call_location(frame_offset: int = 1)¶
-
pyinfra.api.util.get_caller_frameinfo(frame_offset: int = 0)¶
-
class
pyinfra.api.util.get_file_io(filename_or_io, mode='rb')¶ Bases:
objectGiven either a filename or an existing IO object, this context processor will open and close filenames, and leave IO objects alone.
-
property
cache_key¶
-
close= False¶
-
property
-
pyinfra.api.util.get_file_sha1(filename_or_io)¶ Calculates the SHA1 of a file or file object using a buffer to handle larger files.
-
pyinfra.api.util.get_kwargs_str(kwargs: Dict[Any, Any])¶
-
pyinfra.api.util.get_path_permissions_mode(pathname: str)¶ Get the permissions (bits) of a path as an integer.
-
pyinfra.api.util.get_template(filename_or_io: str)¶ Gets a jinja2
Templateobject for the input filename or string, with caching based on the filename of the template, or the SHA1 of the input string.
-
pyinfra.api.util.log_error_or_warning(host: Host, ignore_errors: bool, description: str = '', continue_on_error: bool = False)¶
-
pyinfra.api.util.log_operation_start(op_meta: Dict, op_types: List | None = None, prefix: str = '--> ')¶
-
pyinfra.api.util.make_hash(obj)¶ Make a hash from an arbitrary nested dictionary, list, tuple or set, used to generate ID’s for operations based on their name & arguments.
-
pyinfra.api.util.memoize(func: Callable[[...], Any])¶
-
pyinfra.api.util.sha1_hash(string: str)¶ Return the SHA1 of the input string.
-
pyinfra.api.util.try_int(value)¶
pyinfra 2.x