hwt.pyUtils package¶
This package contains python utils used in this library.
Submodules¶
hwt.pyUtils.arrayQuery module¶
-
exception
hwt.pyUtils.arrayQuery.
DuplicitValueExc
[source]¶ Bases:
Exception
Exception which means that there are multiple items which this query selected but it should return only one
-
exception
hwt.pyUtils.arrayQuery.
NoValueExc
[source]¶ Bases:
Exception
Exception which means that query did not selected any item
-
hwt.pyUtils.arrayQuery.
areSetsIntersets
(setA, setB)[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, iterable, 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.testUtils module¶
-
class
hwt.pyUtils.testUtils.
TestMatrix
(*args, **kwargs)[source]¶ Bases:
object
Class which instance is a decorator which executes unittest.TestCase test method with every combination of argumets
hwt.pyUtils.uniqList module¶
-
class
hwt.pyUtils.uniqList.
UniqList
(initSeq: Optional[Sequence[T]] = None)[source]¶ Bases:
typing.Generic
,list
List of unique items
-
_UniqList__s
¶
-
__init__
(initSeq: Optional[Sequence[T]] = None)[source]¶ Initialize self. See help(type(self)) for accurate signature.
-