accinv.utils module¶
- class accinv.utils.RegexContainer(pattern: Union[str, Pattern])¶
Bases:
Container
Instances of this class test membership via
re.fullmatch()
.- Parameters
pattern – Strings are converted to patterns via
re.compile
. Note that this uses the default flags.
- accinv.utils.chain_function_calls(funcs: Sequence[Callable], unpack: bool = False) Callable ¶
- Create a wrapper that chains the given functions from left (outermost)
to right (innermost).
- Parameters
funcs – The functions to be chained.
unpack – If true, then the return values of functions will be unpacked for the next function call (i.e.
f(*x)
as opposed tof(x)
).
- Returns
A wrapper function which will chain the various individual function calls.
- accinv.utils.ensuresuffix(string, suffix, /)¶
Append suffix if it is not already present in string.
- accinv.utils.is_iterator_exhausted(i: Iterator) bool ¶
Return
True
if the given iterator i contains no more elements, andFalse
otherwise.Note
This tries to consume an element from the given iterator via
next()
. If there was an element to consume, it will not be put back into the iterator (as this is not possible for general iterators).
- accinv.utils.lowercase(data: Collection[str]) list[str] ¶
Convert all elements of the given collection to lowercase and return the result as a list.