DGN-U 0.1.0__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.
- dgn_u-0.1.0/PKG-INFO +9 -0
- dgn_u-0.1.0/pyproject.toml +18 -0
- dgn_u-0.1.0/setup.cfg +4 -0
- dgn_u-0.1.0/src/DGN_U.egg-info/PKG-INFO +9 -0
- dgn_u-0.1.0/src/DGN_U.egg-info/SOURCES.txt +8 -0
- dgn_u-0.1.0/src/DGN_U.egg-info/dependency_links.txt +1 -0
- dgn_u-0.1.0/src/DGN_U.egg-info/top_level.txt +1 -0
- dgn_u-0.1.0/src/dgn_u/__init__.py +5 -0
- dgn_u-0.1.0/src/dgn_u/io.py +48 -0
- dgn_u-0.1.0/src/dgn_u/path.py +15 -0
dgn_u-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: DGN-U
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Общие утилиты
|
|
5
|
+
Author: DevGroupNet
|
|
6
|
+
Classifier: Programming Language :: Python :: 3
|
|
7
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
8
|
+
Classifier: Operating System :: OS Independent
|
|
9
|
+
Requires-Python: >=3.10
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0.0"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "DGN-U"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Общие утилиты"
|
|
9
|
+
authors = [
|
|
10
|
+
{ name = "DevGroupNet" }
|
|
11
|
+
]
|
|
12
|
+
requires-python = ">=3.10"
|
|
13
|
+
classifiers = [
|
|
14
|
+
"Programming Language :: Python :: 3",
|
|
15
|
+
"License :: OSI Approved :: MIT License",
|
|
16
|
+
"Operating System :: OS Independent",
|
|
17
|
+
]
|
|
18
|
+
dependencies = []
|
dgn_u-0.1.0/setup.cfg
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: DGN-U
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Общие утилиты
|
|
5
|
+
Author: DevGroupNet
|
|
6
|
+
Classifier: Programming Language :: Python :: 3
|
|
7
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
8
|
+
Classifier: Operating System :: OS Independent
|
|
9
|
+
Requires-Python: >=3.10
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
dgn_u
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
from typing import TYPE_CHECKING
|
|
3
|
+
from typing import Literal
|
|
4
|
+
import sys
|
|
5
|
+
from datetime import datetime
|
|
6
|
+
from zoneinfo import ZoneInfo
|
|
7
|
+
|
|
8
|
+
if TYPE_CHECKING:
|
|
9
|
+
from _typeshed import SupportsWrite
|
|
10
|
+
|
|
11
|
+
__all__ = ("print_err", 'p_err', 'get_time', 'get_time_ms')
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def print_err(*values: object,
|
|
15
|
+
sep: str | None = " ",
|
|
16
|
+
end: str | None = "\n",
|
|
17
|
+
file: SupportsWrite[str] | None = None,
|
|
18
|
+
flush: Literal[False] = False):
|
|
19
|
+
if not file: file = sys.stderr
|
|
20
|
+
print(*values, sep=sep, end=end, flush=flush, file=file)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
p_err = print_err
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def get_time(tz: ZoneInfo | None = None):
|
|
27
|
+
return datetime.now(tz=tz).strftime('%d-%m-%y %H:%M:%S')
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def get_time_ms(tz: ZoneInfo | None = None):
|
|
31
|
+
dt = datetime.now(tz=tz)
|
|
32
|
+
return dt.strftime(f'%d-%m-%y %H:%M:%S.{(dt.microsecond // 1000):03d}')
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def log(text: str):
|
|
36
|
+
"""
|
|
37
|
+
[02-07-26 02:20:16] Text
|
|
38
|
+
:param text: Text
|
|
39
|
+
"""
|
|
40
|
+
print(f'[{get_time()}] {text}')
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def log_ms(text: str):
|
|
44
|
+
"""
|
|
45
|
+
[02-07-26 02:20:16.123] Text
|
|
46
|
+
:param text: Text
|
|
47
|
+
"""
|
|
48
|
+
print(f'[{get_time_ms()}] {text}')
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import inspect
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
__all__ = ('cd_to_caller_dir',)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def cd_to_caller_dir():
|
|
9
|
+
caller_frame = inspect.stack()[1]
|
|
10
|
+
caller_file = caller_frame.filename
|
|
11
|
+
|
|
12
|
+
caller_dir = os.path.dirname(os.path.abspath(caller_file))
|
|
13
|
+
|
|
14
|
+
os.chdir(caller_dir)
|
|
15
|
+
return caller_dir
|