python-utils 3.8.0__tar.gz → 3.8.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {python-utils-3.8.0/python_utils.egg-info → python-utils-3.8.2}/PKG-INFO +1 -1
- {python-utils-3.8.0 → python-utils-3.8.2}/_python_utils_tests/test_containers.py +4 -4
- {python-utils-3.8.0 → python-utils-3.8.2}/python_utils/__about__.py +1 -1
- {python-utils-3.8.0 → python-utils-3.8.2}/python_utils/containers.py +7 -7
- {python-utils-3.8.0 → python-utils-3.8.2}/python_utils/time.py +1 -1
- {python-utils-3.8.0 → python-utils-3.8.2/python_utils.egg-info}/PKG-INFO +1 -1
- {python-utils-3.8.0 → python-utils-3.8.2}/LICENSE +0 -0
- {python-utils-3.8.0 → python-utils-3.8.2}/MANIFEST.in +0 -0
- {python-utils-3.8.0 → python-utils-3.8.2}/README.rst +0 -0
- {python-utils-3.8.0 → python-utils-3.8.2}/_python_utils_tests/__init__.py +0 -0
- {python-utils-3.8.0 → python-utils-3.8.2}/_python_utils_tests/requirements.txt +0 -0
- {python-utils-3.8.0 → python-utils-3.8.2}/_python_utils_tests/test_aio.py +0 -0
- {python-utils-3.8.0 → python-utils-3.8.2}/_python_utils_tests/test_decorators.py +0 -0
- {python-utils-3.8.0 → python-utils-3.8.2}/_python_utils_tests/test_generators.py +0 -0
- {python-utils-3.8.0 → python-utils-3.8.2}/_python_utils_tests/test_import.py +0 -0
- {python-utils-3.8.0 → python-utils-3.8.2}/_python_utils_tests/test_logger.py +0 -0
- {python-utils-3.8.0 → python-utils-3.8.2}/_python_utils_tests/test_python_utils.py +0 -0
- {python-utils-3.8.0 → python-utils-3.8.2}/_python_utils_tests/test_time.py +0 -0
- {python-utils-3.8.0 → python-utils-3.8.2}/coverage.rc +0 -0
- {python-utils-3.8.0 → python-utils-3.8.2}/pyproject.toml +0 -0
- {python-utils-3.8.0 → python-utils-3.8.2}/pytest.ini +0 -0
- {python-utils-3.8.0 → python-utils-3.8.2}/python_utils/__init__.py +0 -0
- {python-utils-3.8.0 → python-utils-3.8.2}/python_utils/aio.py +0 -0
- {python-utils-3.8.0 → python-utils-3.8.2}/python_utils/compat.py +0 -0
- {python-utils-3.8.0 → python-utils-3.8.2}/python_utils/converters.py +0 -0
- {python-utils-3.8.0 → python-utils-3.8.2}/python_utils/decorators.py +0 -0
- {python-utils-3.8.0 → python-utils-3.8.2}/python_utils/exceptions.py +0 -0
- {python-utils-3.8.0 → python-utils-3.8.2}/python_utils/formatters.py +0 -0
- {python-utils-3.8.0 → python-utils-3.8.2}/python_utils/generators.py +0 -0
- {python-utils-3.8.0 → python-utils-3.8.2}/python_utils/import_.py +0 -0
- {python-utils-3.8.0 → python-utils-3.8.2}/python_utils/logger.py +0 -0
- {python-utils-3.8.0 → python-utils-3.8.2}/python_utils/loguru.py +0 -0
- {python-utils-3.8.0 → python-utils-3.8.2}/python_utils/py.typed +0 -0
- {python-utils-3.8.0 → python-utils-3.8.2}/python_utils/terminal.py +0 -0
- {python-utils-3.8.0 → python-utils-3.8.2}/python_utils/types.py +0 -0
- {python-utils-3.8.0 → python-utils-3.8.2}/python_utils.egg-info/SOURCES.txt +0 -0
- {python-utils-3.8.0 → python-utils-3.8.2}/python_utils.egg-info/dependency_links.txt +0 -0
- {python-utils-3.8.0 → python-utils-3.8.2}/python_utils.egg-info/requires.txt +0 -0
- {python-utils-3.8.0 → python-utils-3.8.2}/python_utils.egg-info/top_level.txt +0 -0
- {python-utils-3.8.0 → python-utils-3.8.2}/requirements.txt +0 -0
- {python-utils-3.8.0 → python-utils-3.8.2}/setup.cfg +0 -0
- {python-utils-3.8.0 → python-utils-3.8.2}/setup.py +0 -0
- {python-utils-3.8.0 → python-utils-3.8.2}/tox.ini +0 -0
|
@@ -32,7 +32,7 @@ def test_unique_list_raise() -> None:
|
|
|
32
32
|
|
|
33
33
|
|
|
34
34
|
def test_sliceable_deque() -> None:
|
|
35
|
-
d: containers.
|
|
35
|
+
d: containers.SliceableDeque[int] = containers.SliceableDeque(range(10))
|
|
36
36
|
assert d[0] == 0
|
|
37
37
|
assert d[-1] == 9
|
|
38
38
|
assert d[1:3] == [1, 2]
|
|
@@ -49,7 +49,7 @@ def test_sliceable_deque() -> None:
|
|
|
49
49
|
|
|
50
50
|
|
|
51
51
|
def test_sliceable_deque_pop() -> None:
|
|
52
|
-
d: containers.
|
|
52
|
+
d: containers.SliceableDeque[int] = containers.SliceableDeque(range(10))
|
|
53
53
|
|
|
54
54
|
assert d.pop() == 9 == 9
|
|
55
55
|
assert d.pop(0) == 0
|
|
@@ -65,9 +65,9 @@ def test_sliceable_deque_pop() -> None:
|
|
|
65
65
|
|
|
66
66
|
|
|
67
67
|
def test_sliceable_deque_eq() -> None:
|
|
68
|
-
d: containers.
|
|
68
|
+
d: containers.SliceableDeque[int] = containers.SliceableDeque([1, 2, 3])
|
|
69
69
|
assert d == [1, 2, 3]
|
|
70
70
|
assert d == (1, 2, 3)
|
|
71
71
|
assert d == {1, 2, 3}
|
|
72
72
|
assert d == d
|
|
73
|
-
assert d == containers.
|
|
73
|
+
assert d == containers.SliceableDeque([1, 2, 3])
|
|
@@ -312,28 +312,28 @@ class UniqueList(types.List[HT]):
|
|
|
312
312
|
|
|
313
313
|
# Type hinting `collections.deque` does not work consistently between Python
|
|
314
314
|
# runtime, mypy and pyright currently so we have to ignore the errors
|
|
315
|
-
class
|
|
315
|
+
class SliceableDeque(types.Generic[T], collections.deque): # type: ignore
|
|
316
316
|
@typing.overload
|
|
317
317
|
def __getitem__(self, index: types.SupportsIndex) -> T:
|
|
318
318
|
...
|
|
319
319
|
|
|
320
320
|
@typing.overload
|
|
321
|
-
def __getitem__(self, index: slice) -> '
|
|
321
|
+
def __getitem__(self, index: slice) -> 'SliceableDeque[T]':
|
|
322
322
|
...
|
|
323
323
|
|
|
324
324
|
def __getitem__(
|
|
325
325
|
self, index: types.Union[types.SupportsIndex, slice]
|
|
326
|
-
) -> types.Union[T, '
|
|
326
|
+
) -> types.Union[T, 'SliceableDeque[T]']:
|
|
327
327
|
'''
|
|
328
328
|
Return the item or slice at the given index.
|
|
329
329
|
|
|
330
|
-
>>> d =
|
|
330
|
+
>>> d = SliceableDeque[int]([1, 2, 3, 4, 5])
|
|
331
331
|
>>> d[1:4]
|
|
332
|
-
|
|
332
|
+
SliceableDeque([2, 3, 4])
|
|
333
333
|
|
|
334
|
-
>>> d =
|
|
334
|
+
>>> d = SliceableDeque[str](['a', 'b', 'c'])
|
|
335
335
|
>>> d[-2:]
|
|
336
|
-
|
|
336
|
+
SliceableDeque(['b', 'c'])
|
|
337
337
|
|
|
338
338
|
'''
|
|
339
339
|
if isinstance(index, slice):
|
|
@@ -130,7 +130,7 @@ def format_time(
|
|
|
130
130
|
|
|
131
131
|
try: # pragma: no cover
|
|
132
132
|
dt = datetime.datetime.fromtimestamp(seconds)
|
|
133
|
-
except ValueError: # pragma: no cover
|
|
133
|
+
except (ValueError, OSError): # pragma: no cover
|
|
134
134
|
dt = datetime.datetime.max
|
|
135
135
|
return str(dt)
|
|
136
136
|
elif isinstance(timestamp, datetime.date):
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|