waft.utilities.utilities module¶
- class waft.utilities.utilities.Utilities¶
Bases:
object
Generic utilities class
- static calculate_sha256(file_path: PathLike) str ¶
Calculate the sha256 of a local file.
- Parameters:
file_path (os.PathLike) – local file path
- Returns:
sha256 hash value
- Return type:
str
- static cwd(path: PathLike)¶
Context manager to set the current working directory. Restores the current working directory to its previous value on exit.
- Parameters:
path (os.PathLike) – path to set as the current working directory
- property free_port_on_test_runner: int¶
Returns free port on test runner
- static is_ip_address_ipv6(ip_string: str) bool ¶
Check to see that an IP address is a valid IPv6 address.
- Parameters:
ip_string – (str) string with IP address to check.
- Returns:
True if the IP address is IPv6, False if it’s not.
- Return type:
bool
- Raises:
ValueError – If raise_if_invalid is True and the IP address is invalid.
- static is_valid_ip(ip_string: str, raise_if_invalid: bool = False) bool ¶
Check to see that an IP address is a valid one and return true if it is.
- Parameters:
ip_string – (str) string with IP address to check.
raise_if_invalid – (bool) Set to true if intent is to raise an exception where an invalid IP address is passed into this method. Default is False.
- Returns:
True if the IP address is valid, False if it’s not and raise_if_invalid is False.
- Return type:
bool
- Raises:
ValueError – If raise_if_invalid is True and the IP address is invalid.