module documentation

License: Apache 2.0

VERSION INFO:

  $Repo: async_example_program
$Author: Anders Wiklund
  $Date: 2023-09-29 03:00:57
   $Rev: 10
Async Function calculate_md5 Calculate the MD5 checksum (see Internet RFC 1321) for the specified filename and return the result as a hex string.
Function check_for_command Return command file existence in the current program path.
Function is_file_available Return file availability status.
Constant FILE_ATTRIBUTE_NORMAL File attribute normal flag.
Constant FILE_SHARE_READ File share read flag.
Constant GENERIC_WRITE Generic write flag.
Constant OPEN_EXISTING Open existing flag.
async def calculate_md5(filename: Union[Path, str]) -> str: (source)

Calculate the MD5 checksum (see Internet RFC 1321) for the specified filename and return the result as a hex string.

Parameters
filename:Union[Path, str]Name of input file.
Returns
strMD5 checksum in hexadecimal format (containing only hexadecimal digits).
def check_for_command(command: str) -> bool: (source)

Return command file existence in the current program path.

If the command file is found it's deleted.

Parameters
command:strCommand to check for.
Returns
boolResult of command check.
def is_file_available(filename: str) -> bool: (source)

Return file availability status.

When the file does not exist, it is opened or used by another process, it's not available. The detection is handled using the local operating system primitives.

It is currently implemented for the following platforms:
  • Linux (using lsof) platforms.
  • Windows (using Kernel32 CreateFileW) platforms.
Parameters
filename:strCurrent file (with a path).
Returns
boolFile availability status.
FILE_ATTRIBUTE_NORMAL: int = (source)

File attribute normal flag.

Value
128
FILE_SHARE_READ: int = (source)

File share read flag.

Value
1
GENERIC_WRITE = (source)

Generic write flag.

Value
1<<30
OPEN_EXISTING: int = (source)

Open existing flag.

Value
3