python-base-toolkit 0.0.1__tar.gz → 0.0.3__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_base_toolkit-0.0.1/python_base_toolkit.egg-info → python_base_toolkit-0.0.3}/PKG-INFO +25 -27
- {python_base_toolkit-0.0.1 → python_base_toolkit-0.0.3}/README.md +3 -3
- python_base_toolkit-0.0.3/pyproject.toml +46 -0
- python_base_toolkit-0.0.3/python_base_toolkit/consts/operating_system.py +4 -0
- {python_base_toolkit-0.0.1 → python_base_toolkit-0.0.3}/python_base_toolkit/consts/units/__init__.py +2 -2
- python_base_toolkit-0.0.3/python_base_toolkit/consts/units/binary_units.py +13 -0
- {python_base_toolkit-0.0.1 → python_base_toolkit-0.0.3}/python_base_toolkit/decorators/telemetry.py +7 -9
- {python_base_toolkit-0.0.1 → python_base_toolkit-0.0.3}/python_base_toolkit/decorators/timer.py +10 -3
- {python_base_toolkit-0.0.1 → python_base_toolkit-0.0.3}/python_base_toolkit/instances/instance_manager.py +17 -16
- {python_base_toolkit-0.0.1 → python_base_toolkit-0.0.3}/python_base_toolkit/utils/data_serialization.py +3 -3
- {python_base_toolkit-0.0.1 → python_base_toolkit-0.0.3}/python_base_toolkit/utils/date_time.py +2 -2
- {python_base_toolkit-0.0.1 → python_base_toolkit-0.0.3}/python_base_toolkit/utils/execute.py +1 -1
- {python_base_toolkit-0.0.1 → python_base_toolkit-0.0.3}/python_base_toolkit/utils/file_utils.py +167 -160
- python_base_toolkit-0.0.3/python_base_toolkit/utils/generate_id.py +35 -0
- {python_base_toolkit-0.0.1 → python_base_toolkit-0.0.3}/python_base_toolkit/utils/logo.py +1 -1
- python_base_toolkit-0.0.3/python_base_toolkit/utils/network.py +146 -0
- {python_base_toolkit-0.0.1 → python_base_toolkit-0.0.3}/python_base_toolkit/utils/path_utils.py +4 -5
- {python_base_toolkit-0.0.1 → python_base_toolkit-0.0.3}/python_base_toolkit/utils/pretty_print.py +3 -6
- {python_base_toolkit-0.0.1 → python_base_toolkit-0.0.3}/python_base_toolkit/utils/pycache.py +3 -3
- {python_base_toolkit-0.0.1 → python_base_toolkit-0.0.3}/python_base_toolkit/utils/random_utils.py +7 -7
- python_base_toolkit-0.0.3/python_base_toolkit/utils/venv_details.py +10 -0
- {python_base_toolkit-0.0.1 → python_base_toolkit-0.0.3/python_base_toolkit.egg-info}/PKG-INFO +25 -27
- {python_base_toolkit-0.0.1 → python_base_toolkit-0.0.3}/python_base_toolkit.egg-info/SOURCES.txt +2 -2
- python_base_toolkit-0.0.3/python_base_toolkit.egg-info/requires.txt +12 -0
- python_base_toolkit-0.0.1/pyproject.toml +0 -3
- python_base_toolkit-0.0.1/python_base_toolkit/consts/units/binary_units.py +0 -13
- python_base_toolkit-0.0.1/python_base_toolkit/utils/network.py +0 -102
- python_base_toolkit-0.0.1/python_base_toolkit/utils/venv_details.py +0 -10
- python_base_toolkit-0.0.1/python_base_toolkit.egg-info/requires.txt +0 -10
- python_base_toolkit-0.0.1/requirements.txt +0 -11
- python_base_toolkit-0.0.1/setup.py +0 -42
- {python_base_toolkit-0.0.1 → python_base_toolkit-0.0.3}/LICENSE +0 -0
- {python_base_toolkit-0.0.1 → python_base_toolkit-0.0.3}/MANIFEST.in +0 -0
- {python_base_toolkit-0.0.1 → python_base_toolkit-0.0.3}/python_base_toolkit/__init__.py +0 -0
- {python_base_toolkit-0.0.1 → python_base_toolkit-0.0.3}/python_base_toolkit/consts/__init__.py +0 -0
- {python_base_toolkit-0.0.1 → python_base_toolkit-0.0.3}/python_base_toolkit/consts/units/time_units.py +0 -0
- {python_base_toolkit-0.0.1 → python_base_toolkit-0.0.3}/python_base_toolkit/decorators/__init__.py +0 -0
- {python_base_toolkit-0.0.1 → python_base_toolkit-0.0.3}/python_base_toolkit/instances/__init__.py +0 -0
- {python_base_toolkit-0.0.1 → python_base_toolkit-0.0.3}/python_base_toolkit/utils/__init__.py +0 -0
- {python_base_toolkit-0.0.1 → python_base_toolkit-0.0.3}/python_base_toolkit/utils/shorten_url.py +0 -0
- {python_base_toolkit-0.0.1 → python_base_toolkit-0.0.3}/python_base_toolkit.egg-info/dependency_links.txt +0 -0
- {python_base_toolkit-0.0.1 → python_base_toolkit-0.0.3}/python_base_toolkit.egg-info/top_level.txt +0 -0
- {python_base_toolkit-0.0.1 → python_base_toolkit-0.0.3}/setup.cfg +0 -0
{python_base_toolkit-0.0.1/python_base_toolkit.egg-info → python_base_toolkit-0.0.3}/PKG-INFO
RENAMED
|
@@ -1,36 +1,34 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: python-base-toolkit
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.3
|
|
4
4
|
Summary: A Python package for managing pytest plugins.
|
|
5
|
-
Home-page: https://github.com/aviz92/python-base-toolkit
|
|
6
5
|
Author: Avi Zaguri
|
|
7
|
-
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/aviz92/python-base-toolkit
|
|
8
8
|
Project-URL: Repository, https://github.com/aviz92/python-base-toolkit
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
Project-URL: Issues, https://github.com/aviz92/python-base-toolkit/issues
|
|
10
|
+
Keywords: development,python,toolkit,utilities
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
14
|
+
Classifier: Operating System :: OS Independent
|
|
15
|
+
Classifier: Topic :: System :: Logging
|
|
11
16
|
Requires-Python: >=3.11
|
|
12
17
|
Description-Content-Type: text/markdown
|
|
13
18
|
License-File: LICENSE
|
|
14
|
-
Requires-Dist:
|
|
15
|
-
Requires-Dist:
|
|
16
|
-
Requires-Dist:
|
|
17
|
-
Requires-Dist: pathlib
|
|
18
|
-
Requires-Dist:
|
|
19
|
-
Requires-Dist:
|
|
20
|
-
Requires-Dist:
|
|
21
|
-
Requires-Dist:
|
|
22
|
-
Requires-Dist:
|
|
23
|
-
Requires-Dist:
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
Dynamic: description
|
|
27
|
-
Dynamic: description-content-type
|
|
28
|
-
Dynamic: home-page
|
|
19
|
+
Requires-Dist: colorlog>=6.10.1
|
|
20
|
+
Requires-Dist: custom-python-logger>=2.0.10
|
|
21
|
+
Requires-Dist: pandas>=2.3.3
|
|
22
|
+
Requires-Dist: pathlib>=1.0.1
|
|
23
|
+
Requires-Dist: pre-commit>=4.5.0
|
|
24
|
+
Requires-Dist: pyfiglet>=1.0.4
|
|
25
|
+
Requires-Dist: python-dotenv>=1.2.1
|
|
26
|
+
Requires-Dist: pyyaml>=6.0.3
|
|
27
|
+
Requires-Dist: requests>=2.32.5
|
|
28
|
+
Requires-Dist: setuptools>=80.9.0
|
|
29
|
+
Requires-Dist: tqdm>=4.67.1
|
|
30
|
+
Requires-Dist: wheel>=0.45.1
|
|
29
31
|
Dynamic: license-file
|
|
30
|
-
Dynamic: project-url
|
|
31
|
-
Dynamic: requires-dist
|
|
32
|
-
Dynamic: requires-python
|
|
33
|
-
Dynamic: summary
|
|
34
32
|
|
|
35
33
|
# Python Toolkit
|
|
36
34
|
A powerful, production-ready Python toolkit designed to accelerate development by providing essential utilities and common functionality across multiple domains. <br>
|
|
@@ -47,15 +45,15 @@ pip install python-toolkit
|
|
|
47
45
|
---
|
|
48
46
|
|
|
49
47
|
## 🚀 Features
|
|
50
|
-
- Constants Pack
|
|
51
|
-
- binary
|
|
48
|
+
- Constants Pack
|
|
49
|
+
- binary
|
|
52
50
|
- time
|
|
53
51
|
|
|
54
52
|
- Decorators Pack
|
|
55
53
|
- telemetry
|
|
56
54
|
- timer
|
|
57
55
|
|
|
58
|
-
- Instances Pack
|
|
56
|
+
- Instances Pack
|
|
59
57
|
- instance_manager
|
|
60
58
|
|
|
61
59
|
- Utilities Pack
|
|
@@ -13,15 +13,15 @@ pip install python-toolkit
|
|
|
13
13
|
---
|
|
14
14
|
|
|
15
15
|
## 🚀 Features
|
|
16
|
-
- Constants Pack
|
|
17
|
-
- binary
|
|
16
|
+
- Constants Pack
|
|
17
|
+
- binary
|
|
18
18
|
- time
|
|
19
19
|
|
|
20
20
|
- Decorators Pack
|
|
21
21
|
- telemetry
|
|
22
22
|
- timer
|
|
23
23
|
|
|
24
|
-
- Instances Pack
|
|
24
|
+
- Instances Pack
|
|
25
25
|
- instance_manager
|
|
26
26
|
|
|
27
27
|
- Utilities Pack
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "python-base-toolkit"
|
|
7
|
+
version = "0.0.3"
|
|
8
|
+
description = "A Python package for managing pytest plugins."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.11"
|
|
11
|
+
license = { text = "MIT" }
|
|
12
|
+
authors = [{ name = "Avi Zaguri" },]
|
|
13
|
+
keywords = ["development", "python", "toolkit", "utilities"]
|
|
14
|
+
|
|
15
|
+
classifiers = [
|
|
16
|
+
"Development Status :: 4 - Beta",
|
|
17
|
+
"Intended Audience :: Developers",
|
|
18
|
+
"Programming Language :: Python :: 3.11",
|
|
19
|
+
"Operating System :: OS Independent",
|
|
20
|
+
"Topic :: System :: Logging",
|
|
21
|
+
]
|
|
22
|
+
|
|
23
|
+
dependencies = [
|
|
24
|
+
"colorlog>=6.10.1",
|
|
25
|
+
"custom-python-logger>=2.0.10",
|
|
26
|
+
"pandas>=2.3.3",
|
|
27
|
+
"pathlib>=1.0.1",
|
|
28
|
+
"pre-commit>=4.5.0",
|
|
29
|
+
"pyfiglet>=1.0.4",
|
|
30
|
+
"python-dotenv>=1.2.1",
|
|
31
|
+
"pyyaml>=6.0.3",
|
|
32
|
+
"requests>=2.32.5",
|
|
33
|
+
"setuptools>=80.9.0",
|
|
34
|
+
"tqdm>=4.67.1",
|
|
35
|
+
"wheel>=0.45.1",
|
|
36
|
+
]
|
|
37
|
+
|
|
38
|
+
[project.urls]
|
|
39
|
+
Homepage = "https://github.com/aviz92/python-base-toolkit"
|
|
40
|
+
Repository = "https://github.com/aviz92/python-base-toolkit"
|
|
41
|
+
Issues = "https://github.com/aviz92/python-base-toolkit/issues"
|
|
42
|
+
|
|
43
|
+
[tool.setuptools.packages.find]
|
|
44
|
+
where = ["."]
|
|
45
|
+
include = ["python_base_toolkit*"]
|
|
46
|
+
namespaces = false
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
B = 8
|
|
2
|
+
KiB = 1024
|
|
3
|
+
MiB = KiB * 1024
|
|
4
|
+
GiB = MiB * 1024
|
|
5
|
+
TiB = GiB * 1024
|
|
6
|
+
PiB = TiB * 1024
|
|
7
|
+
EiB = PiB * 1024
|
|
8
|
+
|
|
9
|
+
KB = 1000 # 1 kilobyte (KB) = 1000 bytes in decimal (SI)
|
|
10
|
+
GB = 1000**3 # 1 gigabyte (GB) = 1000^3 bytes in decimal (SI)
|
|
11
|
+
TB = 1000**4 # 1 terabyte (TB) = 1000^4 bytes in decimal (SI)
|
|
12
|
+
PB = 1000**5 # 1 petabyte (PB) = 1000^5 bytes in decimal (SI)
|
|
13
|
+
EB = 1000**6 # 1 exabyte (EB) = 1000^6 bytes in decimal (SI)
|
{python_base_toolkit-0.0.1 → python_base_toolkit-0.0.3}/python_base_toolkit/decorators/telemetry.py
RENAMED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import datetime
|
|
1
2
|
import json
|
|
2
3
|
import time
|
|
4
|
+
from collections.abc import Callable
|
|
3
5
|
from functools import wraps
|
|
4
|
-
import
|
|
5
|
-
from typing import Callable, Any
|
|
6
|
+
from typing import Any
|
|
6
7
|
|
|
7
8
|
from custom_python_logger import get_logger
|
|
8
9
|
|
|
@@ -10,11 +11,7 @@ logger = get_logger(__name__)
|
|
|
10
11
|
|
|
11
12
|
|
|
12
13
|
def report_telemetry(
|
|
13
|
-
func: Callable[..., Any],
|
|
14
|
-
start_time: datetime.datetime,
|
|
15
|
-
end_time: datetime.datetime,
|
|
16
|
-
*args: Any,
|
|
17
|
-
**kwargs: Any
|
|
14
|
+
func: Callable[..., Any], start_time: datetime.datetime, end_time: datetime.datetime, *args: Any, **kwargs: Any
|
|
18
15
|
) -> None:
|
|
19
16
|
data = {
|
|
20
17
|
"function_name": func.__name__,
|
|
@@ -25,7 +22,8 @@ def report_telemetry(
|
|
|
25
22
|
"timestamp": time.time(),
|
|
26
23
|
}
|
|
27
24
|
logger.info(
|
|
28
|
-
f"Sending telemetry data with the following data: {json.dumps(data, indent=4, sort_keys=False, default=str)}"
|
|
25
|
+
f"Sending telemetry data with the following data: {json.dumps(data, indent=4, sort_keys=False, default=str)}"
|
|
26
|
+
)
|
|
29
27
|
|
|
30
28
|
|
|
31
29
|
def report_func_telemetry(func: Callable[..., Any]) -> Callable[..., Any]:
|
|
@@ -37,7 +35,7 @@ def report_func_telemetry(func: Callable[..., Any]) -> Callable[..., Any]:
|
|
|
37
35
|
start_time = datetime.datetime.now(datetime.UTC)
|
|
38
36
|
result = func(*args, **kwargs)
|
|
39
37
|
end_time = datetime.datetime.now(datetime.UTC)
|
|
40
|
-
report_telemetry(func=func, start_time=start_time, end_time=end_time,
|
|
38
|
+
report_telemetry(*args, func=func, start_time=start_time, end_time=end_time, **kwargs)
|
|
41
39
|
return result
|
|
42
40
|
|
|
43
41
|
return wrapper
|
{python_base_toolkit-0.0.1 → python_base_toolkit-0.0.3}/python_base_toolkit/decorators/timer.py
RENAMED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import time
|
|
2
|
+
from collections.abc import Callable
|
|
2
3
|
from functools import wraps
|
|
3
|
-
from typing import
|
|
4
|
+
from typing import Any
|
|
4
5
|
|
|
5
6
|
from custom_python_logger import get_logger
|
|
6
7
|
|
|
@@ -8,12 +9,17 @@ logger = get_logger(__name__)
|
|
|
8
9
|
|
|
9
10
|
|
|
10
11
|
class Timer:
|
|
11
|
-
def
|
|
12
|
+
def __init__(self) -> None:
|
|
13
|
+
self.start_time = None
|
|
14
|
+
self.end_time = None
|
|
15
|
+
self.elapsed_time = None
|
|
16
|
+
|
|
17
|
+
def __enter__(self) -> "Timer":
|
|
12
18
|
self.start_time = time.perf_counter()
|
|
13
19
|
logger.info("Timer started.")
|
|
14
20
|
return self
|
|
15
21
|
|
|
16
|
-
def __exit__(self, exc_type, exc_value, exc_traceback):
|
|
22
|
+
def __exit__(self, exc_type: type, exc_value: Exception, exc_traceback: object) -> None:
|
|
17
23
|
# logger.info(exc_type, exc_value, exc_traceback)
|
|
18
24
|
self.end_time = time.perf_counter()
|
|
19
25
|
self.elapsed_time = self.end_time - self.start_time
|
|
@@ -25,4 +31,5 @@ def timer(func: Callable[..., Any]) -> Callable[..., Any]:
|
|
|
25
31
|
def wrapper(*args: Any, **kwargs: Any) -> Any:
|
|
26
32
|
with Timer():
|
|
27
33
|
return func(*args, **kwargs)
|
|
34
|
+
|
|
28
35
|
return wrapper
|
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
from custom_python_logger.logger import get_logger
|
|
2
2
|
|
|
3
|
+
|
|
3
4
|
class InstanceManager:
|
|
4
|
-
def __init__(self):
|
|
5
|
+
def __init__(self) -> None:
|
|
5
6
|
self.logger = get_logger(__class__.__name__)
|
|
6
7
|
self._instances = []
|
|
7
8
|
|
|
8
|
-
def add(self, instance):
|
|
9
|
+
def add(self, instance: object) -> None:
|
|
9
10
|
self._instances.append(instance)
|
|
10
11
|
|
|
11
|
-
def close_all(self):
|
|
12
|
+
def close_all(self) -> None:
|
|
12
13
|
for instance in reversed(self._instances):
|
|
13
14
|
_instance_name = instance.__class__.__name__
|
|
14
15
|
try:
|
|
15
|
-
if hasattr(instance,
|
|
16
|
+
if hasattr(instance, "close"):
|
|
16
17
|
instance.close()
|
|
17
18
|
else: # hasattr(instance, '__exit__'):
|
|
18
19
|
instance.__exit__(None, None, None)
|
|
@@ -20,31 +21,31 @@ class InstanceManager:
|
|
|
20
21
|
except Exception as e:
|
|
21
22
|
self.logger.info(f"Failed to close instance {instance}: {e}")
|
|
22
23
|
|
|
23
|
-
def __enter__(self):
|
|
24
|
+
def __enter__(self) -> "InstanceManager":
|
|
24
25
|
return self
|
|
25
26
|
|
|
26
|
-
def __exit__(self, exc_type, exc_value, traceback):
|
|
27
|
+
def __exit__(self, exc_type: type, exc_value: Exception, traceback: object) -> None:
|
|
27
28
|
self.close_all()
|
|
28
29
|
|
|
29
30
|
|
|
30
|
-
def main():
|
|
31
|
+
def main() -> None:
|
|
31
32
|
class SomeInstance:
|
|
32
|
-
def __init__(self, add_to_instance_manager: bool = False):
|
|
33
|
+
def __init__(self, add_to_instance_manager: bool = False) -> None:
|
|
33
34
|
self.logger = get_logger(__class__.__name__)
|
|
34
35
|
|
|
35
36
|
if add_to_instance_manager:
|
|
36
|
-
instance_manager.add(self)
|
|
37
|
+
instance_manager.add(self) # pylint: disable=E0601
|
|
37
38
|
|
|
38
39
|
@property
|
|
39
|
-
def
|
|
40
|
+
def class_name(self) -> str:
|
|
40
41
|
return self.__class__.__name__
|
|
41
42
|
|
|
42
|
-
def __enter__(self):
|
|
43
|
-
self.logger.info(f"Entering {self.
|
|
43
|
+
def __enter__(self) -> "SomeInstance":
|
|
44
|
+
self.logger.info(f"Entering {self.class_name}")
|
|
44
45
|
return self
|
|
45
46
|
|
|
46
|
-
def __exit__(self, exc_type, exc_value,
|
|
47
|
-
self.logger.info(f"Exiting {self.
|
|
47
|
+
def __exit__(self, exc_type: type, exc_value: Exception, traceback: object) -> bool:
|
|
48
|
+
self.logger.info(f"Exiting {self.class_name}")
|
|
48
49
|
# Handle any cleanup here
|
|
49
50
|
if exc_type:
|
|
50
51
|
self.logger.info(f"Exception: {exc_value}")
|
|
@@ -52,8 +53,8 @@ def main():
|
|
|
52
53
|
|
|
53
54
|
SomeInstance(add_to_instance_manager=True)
|
|
54
55
|
|
|
55
|
-
resource1 = open(
|
|
56
|
-
resource2 = open(
|
|
56
|
+
resource1 = open("file1.txt", "w") # pylint: disable=R1732
|
|
57
|
+
resource2 = open("file2.txt", "w") # pylint: disable=R1732
|
|
57
58
|
|
|
58
59
|
instance_manager.add(resource1)
|
|
59
60
|
instance_manager.add(resource2)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import json
|
|
2
2
|
from dataclasses import is_dataclass
|
|
3
|
-
from datetime import
|
|
3
|
+
from datetime import date, datetime, time
|
|
4
4
|
from decimal import Decimal
|
|
5
5
|
from enum import Enum
|
|
6
6
|
from pathlib import Path
|
|
@@ -23,7 +23,7 @@ def default_serialize(obj: object) -> object:
|
|
|
23
23
|
return list(obj)
|
|
24
24
|
if isinstance(obj, tuple):
|
|
25
25
|
return list(obj)
|
|
26
|
-
if isinstance(obj,
|
|
26
|
+
if isinstance(obj, datetime | date | time):
|
|
27
27
|
return obj.isoformat()
|
|
28
28
|
if isinstance(obj, Decimal):
|
|
29
29
|
return float(obj)
|
|
@@ -31,7 +31,7 @@ def default_serialize(obj: object) -> object:
|
|
|
31
31
|
return str(obj)
|
|
32
32
|
if obj is pd.NA:
|
|
33
33
|
return None
|
|
34
|
-
logger.error(f
|
|
34
|
+
logger.error(f"Object is not serializable: {obj}")
|
|
35
35
|
raise TypeError(f"Type {type(obj)} not serializable")
|
|
36
36
|
|
|
37
37
|
|
{python_base_toolkit-0.0.1 → python_base_toolkit-0.0.3}/python_base_toolkit/utils/date_time.py
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
from datetime import datetime
|
|
2
2
|
from zoneinfo import ZoneInfo
|
|
3
3
|
|
|
4
|
-
utc_timezone = ZoneInfo(
|
|
4
|
+
utc_timezone = ZoneInfo("UTC")
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
def datetime_now_with_timezone(timezone: ZoneInfo = utc_timezone) -> datetime:
|
|
@@ -9,6 +9,6 @@ def datetime_now_with_timezone(timezone: ZoneInfo = utc_timezone) -> datetime:
|
|
|
9
9
|
raise TypeError(f"Expected pytz timezone, got {type(timezone).__name__}")
|
|
10
10
|
|
|
11
11
|
now_utc = datetime.now(timezone)
|
|
12
|
-
if timezone.key ==
|
|
12
|
+
if timezone.key == "UTC":
|
|
13
13
|
return now_utc
|
|
14
14
|
return now_utc.astimezone(timezone)
|
{python_base_toolkit-0.0.1 → python_base_toolkit-0.0.3}/python_base_toolkit/utils/execute.py
RENAMED
|
@@ -16,7 +16,7 @@ def _timed_execution(
|
|
|
16
16
|
pbar = tqdm(total=timeout, desc=pb_description, unit="s", ncols=100)
|
|
17
17
|
start_time = time()
|
|
18
18
|
|
|
19
|
-
while time() - start_time < timeout:
|
|
19
|
+
while time() - start_time < timeout: # pylint: disable=W0149
|
|
20
20
|
res = func()
|
|
21
21
|
if (expect_true and res) or (not expect_true and not res):
|
|
22
22
|
pbar.close()
|