tracktolib 0.32.0__py3-none-any.whl → 0.34.0__py3-none-any.whl
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.
- tracktolib/tests.py +5 -3
- tracktolib/utils.py +20 -0
- {tracktolib-0.32.0.dist-info → tracktolib-0.34.0.dist-info}/METADATA +1 -1
- {tracktolib-0.32.0.dist-info → tracktolib-0.34.0.dist-info}/RECORD +6 -6
- {tracktolib-0.32.0.dist-info → tracktolib-0.34.0.dist-info}/LICENSE +0 -0
- {tracktolib-0.32.0.dist-info → tracktolib-0.34.0.dist-info}/WHEEL +0 -0
tracktolib/tests.py
CHANGED
|
@@ -2,7 +2,6 @@ import pprint
|
|
|
2
2
|
from typing import Iterable
|
|
3
3
|
import warnings
|
|
4
4
|
|
|
5
|
-
|
|
6
5
|
try:
|
|
7
6
|
import deepdiff
|
|
8
7
|
except ImportError:
|
|
@@ -14,5 +13,8 @@ def get_uuid(i: int = 0):
|
|
|
14
13
|
return f'00000000-0000-0000-0000-000000{i:06}'
|
|
15
14
|
|
|
16
15
|
|
|
17
|
-
def assert_equals(d1: dict | Iterable, d2: dict | Iterable
|
|
18
|
-
|
|
16
|
+
def assert_equals(d1: dict | Iterable, d2: dict | Iterable,
|
|
17
|
+
*,
|
|
18
|
+
ignore_order: bool = False):
|
|
19
|
+
diff = deepdiff.DeepDiff(d1, d2, ignore_order=ignore_order)
|
|
20
|
+
assert not diff, pprint.pprint(diff)
|
tracktolib/utils.py
CHANGED
|
@@ -8,6 +8,7 @@ from ipaddress import IPv4Address, IPv6Address
|
|
|
8
8
|
from pathlib import Path
|
|
9
9
|
from typing import Iterable, TypeVar, Iterator, Literal, overload, Any
|
|
10
10
|
import importlib.util
|
|
11
|
+
import asyncio
|
|
11
12
|
|
|
12
13
|
T = TypeVar('T')
|
|
13
14
|
|
|
@@ -29,6 +30,25 @@ def exec_cmd(cmd: str | list[str],
|
|
|
29
30
|
return stdout.decode(encoding)
|
|
30
31
|
|
|
31
32
|
|
|
33
|
+
async def aexec_cmd(cmd: str | list[str],
|
|
34
|
+
*,
|
|
35
|
+
encoding: str = 'utf-8',
|
|
36
|
+
env: dict | None = None) -> str:
|
|
37
|
+
_cmd = cmd if isinstance(cmd, str) else ' '.join(cmd)
|
|
38
|
+
default_shell = os.getenv('SHELL', '/bin/bash')
|
|
39
|
+
|
|
40
|
+
proc = await asyncio.create_subprocess_shell(_cmd,
|
|
41
|
+
shell=True,
|
|
42
|
+
stdout=subprocess.PIPE,
|
|
43
|
+
stderr=subprocess.PIPE,
|
|
44
|
+
executable=default_shell,
|
|
45
|
+
env=env)
|
|
46
|
+
stdout, stderr = await proc.communicate()
|
|
47
|
+
if proc.returncode != 0:
|
|
48
|
+
raise Exception(stderr.decode(encoding))
|
|
49
|
+
return stdout.decode(encoding)
|
|
50
|
+
|
|
51
|
+
|
|
32
52
|
def import_module(path: Path):
|
|
33
53
|
"""
|
|
34
54
|
Import a module from a path.
|
|
@@ -11,9 +11,9 @@ tracktolib/pg_utils.py,sha256=rWYCkuOk_Qq2ShNvbudEvcgFNKTu2vJd6PsUmElVu9Q,545
|
|
|
11
11
|
tracktolib/s3/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
12
12
|
tracktolib/s3/minio.py,sha256=gkpI2bvVwfXaAFY7M9e0Mlv82x0PjuriS8LdRmEJtMo,1258
|
|
13
13
|
tracktolib/s3/s3.py,sha256=kvxXYLjI2pT0yMWFpCzEljmHZH-G4CvVRRZuoPpZ1zQ,3725
|
|
14
|
-
tracktolib/tests.py,sha256=
|
|
15
|
-
tracktolib/utils.py,sha256=
|
|
16
|
-
tracktolib-0.
|
|
17
|
-
tracktolib-0.
|
|
18
|
-
tracktolib-0.
|
|
19
|
-
tracktolib-0.
|
|
14
|
+
tracktolib/tests.py,sha256=GycCVRUOdzazxqBXKBWWzhrlkV8yyD7NaActz_A2WXU,590
|
|
15
|
+
tracktolib/utils.py,sha256=kU35LCJaFDNg0IR9ekAi4uEJ3unZCC3VPzqgkctt06Q,5437
|
|
16
|
+
tracktolib-0.34.0.dist-info/LICENSE,sha256=uUanH0X7SeZEPdsRTHegMSMTiIHMurt9H0jSwEwKE1Y,1081
|
|
17
|
+
tracktolib-0.34.0.dist-info/WHEEL,sha256=vxFmldFsRN_Hx10GDvsdv1wroKq8r5Lzvjp6GZ4OO8c,88
|
|
18
|
+
tracktolib-0.34.0.dist-info/METADATA,sha256=fSmbCpCBnXEUJPyohPIFJKxEiuNZRF9FdjhGz1RLjzc,3630
|
|
19
|
+
tracktolib-0.34.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|