hwt.pyUtils package¶
This package contains python utils used in this library.
Submodules¶
hwt.pyUtils.arrayQuery module¶
- exception hwt.pyUtils.arrayQuery.DuplicitValueExc[source]¶
Bases:
ExceptionException which means that there are multiple items which this query selected but it should return only one
- exception hwt.pyUtils.arrayQuery.NoValueExc[source]¶
Bases:
ExceptionException which means that query did not selected any item
- hwt.pyUtils.arrayQuery.areSetsIntersets(setA: set, setB: set)[source]¶
Check if intersection of sets is not empty
- hwt.pyUtils.arrayQuery.arr_all(iterable, fn)[source]¶
- Returns:
True if fn(item) for all items in interable or iterable is empty else False
- hwt.pyUtils.arrayQuery.arr_any(iterable, fn)[source]¶
- Returns:
True if fn(item) for any item else False
- hwt.pyUtils.arrayQuery.flatten(iterables, level=inf)[source]¶
Flatten nested lists, tuples, generators and maps
- Parameters:
level – maximum depth of flattening
- hwt.pyUtils.arrayQuery.groupedby(collection, fn)[source]¶
same like itertools.groupby
- Note:
This function does not needs initial sorting like itertools.groupby
- Attention:
Order of pairs is not deterministic.
- hwt.pyUtils.arrayQuery.grouper(n: int, iterable: Sequence, padvalue=None)[source]¶
grouper(3, ‘abcdefg’, ‘x’) –> (‘a’,’b’,’c’), (‘d’,’e’,’f’), (‘g’,’x’,’x’)
- hwt.pyUtils.arrayQuery.single(iterable, fn)[source]¶
Get value from iterable where fn(item) and check if there is not fn(other item)
- Raises:
DuplicitValueExc – when there are multiple items satisfying fn()
NoValueExc – when no value satisfying fn(item) found
hwt.pyUtils.fileHelpers module¶
hwt.pyUtils.setDeque module¶
hwt.pyUtils.setList module¶
hwt.pyUtils.testUtils module¶
- class hwt.pyUtils.testUtils.TestMatrix(*args, **kwargs)[source]¶
Bases:
objectClass which instance is a decorator which executes unittest.TestCase test method with every combination of argumets
hwt.pyUtils.typingFuture module¶
- hwt.pyUtils.typingFuture.override(method)[source]¶
Check that the method overrides the parent method. A temporal supplement for typing.override from python3.12
Inspired by https://stackoverflow.com/questions/1167617/in-python-how-do-i-indicate-im-overriding-a-method