anb-python-components 1.4.1__tar.gz → 1.4.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.
- {anb_python_components-1.4.1 → anb_python_components-1.4.3}/PKG-INFO +1 -2
- {anb_python_components-1.4.1 → anb_python_components-1.4.3}/anb_python_components/classes/action_state.py +1 -0
- {anb_python_components-1.4.1 → anb_python_components-1.4.3}/anb_python_components/custom_types/guid.py +32 -32
- {anb_python_components-1.4.1 → anb_python_components-1.4.3}/anb_python_components/custom_types/object_array.py +320 -166
- {anb_python_components-1.4.1 → anb_python_components-1.4.3}/anb_python_components/extensions/dataclass_extension.py +4 -1
- {anb_python_components-1.4.1 → anb_python_components-1.4.3}/anb_python_components/extensions/string_extension.py +21 -14
- anb_python_components-1.4.3/anb_python_components/models/action_state_message.py +25 -0
- anb_python_components-1.4.3/anb_python_components/models/shortcode_model.py +23 -0
- {anb_python_components-1.4.1 → anb_python_components-1.4.3}/anb_python_components.egg-info/PKG-INFO +1 -2
- {anb_python_components-1.4.1 → anb_python_components-1.4.3}/setup.py +1 -2
- anb_python_components-1.4.3/tests/custom_types/guid_test.py +271 -0
- {anb_python_components-1.4.1 → anb_python_components-1.4.3}/tests/custom_types/object_array_test.py +43 -30
- {anb_python_components-1.4.1 → anb_python_components-1.4.3}/tests/extensions/string_extension_test.py +33 -25
- anb_python_components-1.4.1/anb_python_components/models/action_state_message.py +0 -27
- anb_python_components-1.4.1/anb_python_components/models/shortcode_model.py +0 -31
- anb_python_components-1.4.1/tests/custom_types/guid_test.py +0 -14
- {anb_python_components-1.4.1 → anb_python_components-1.4.3}/LICENSE +0 -0
- {anb_python_components-1.4.1 → anb_python_components-1.4.3}/README.md +0 -0
- {anb_python_components-1.4.1 → anb_python_components-1.4.3}/anb_python_components/__init__.py +0 -0
- {anb_python_components-1.4.1 → anb_python_components-1.4.3}/anb_python_components/classes/__init__.py +0 -0
- {anb_python_components-1.4.1 → anb_python_components-1.4.3}/anb_python_components/classes/dataclass_analyzer.py +0 -0
- {anb_python_components-1.4.1 → anb_python_components-1.4.3}/anb_python_components/classes/directory.py +0 -0
- {anb_python_components-1.4.1 → anb_python_components-1.4.3}/anb_python_components/classes/file.py +0 -0
- {anb_python_components-1.4.1 → anb_python_components-1.4.3}/anb_python_components/classes/interface.py +0 -0
- {anb_python_components-1.4.1 → anb_python_components-1.4.3}/anb_python_components/classes/shortcode_parser.py +0 -0
- {anb_python_components-1.4.1 → anb_python_components-1.4.3}/anb_python_components/custom_types/__init__.py +0 -0
- {anb_python_components-1.4.1 → anb_python_components-1.4.3}/anb_python_components/custom_types/shortcode_attributes.py +0 -0
- {anb_python_components-1.4.1 → anb_python_components-1.4.3}/anb_python_components/custom_types/two_dim_size.py +0 -0
- {anb_python_components-1.4.1 → anb_python_components-1.4.3}/anb_python_components/custom_types/version_info.py +0 -0
- {anb_python_components-1.4.1 → anb_python_components-1.4.3}/anb_python_components/decorators/__init__.py +0 -0
- {anb_python_components-1.4.1 → anb_python_components-1.4.3}/anb_python_components/decorators/interface_decorators.py +0 -0
- {anb_python_components-1.4.1 → anb_python_components-1.4.3}/anb_python_components/enums/__init__.py +0 -0
- {anb_python_components-1.4.1 → anb_python_components-1.4.3}/anb_python_components/enums/message_type.py +0 -0
- {anb_python_components-1.4.1 → anb_python_components-1.4.3}/anb_python_components/enums/not_bool_action.py +0 -0
- {anb_python_components-1.4.1 → anb_python_components-1.4.3}/anb_python_components/enums/type_copy_strategy.py +0 -0
- {anb_python_components-1.4.1 → anb_python_components-1.4.3}/anb_python_components/exceptions/__init__.py +0 -0
- {anb_python_components-1.4.1 → anb_python_components-1.4.3}/anb_python_components/exceptions/wrong_type_exception.py +0 -0
- {anb_python_components-1.4.1 → anb_python_components-1.4.3}/anb_python_components/extensions/__init__.py +0 -0
- {anb_python_components-1.4.1 → anb_python_components-1.4.3}/anb_python_components/extensions/array_extension.py +0 -0
- {anb_python_components-1.4.1 → anb_python_components-1.4.3}/anb_python_components/extensions/bool_extension.py +0 -0
- {anb_python_components-1.4.1 → anb_python_components-1.4.3}/anb_python_components/extensions/string_extension_constant.py +0 -0
- {anb_python_components-1.4.1 → anb_python_components-1.4.3}/anb_python_components/extensions/type_extension.py +0 -0
- {anb_python_components-1.4.1 → anb_python_components-1.4.3}/anb_python_components/models/__init__.py +0 -0
- {anb_python_components-1.4.1 → anb_python_components-1.4.3}/anb_python_components.egg-info/SOURCES.txt +0 -0
- {anb_python_components-1.4.1 → anb_python_components-1.4.3}/anb_python_components.egg-info/dependency_links.txt +0 -0
- {anb_python_components-1.4.1 → anb_python_components-1.4.3}/anb_python_components.egg-info/not-zip-safe +0 -0
- {anb_python_components-1.4.1 → anb_python_components-1.4.3}/anb_python_components.egg-info/requires.txt +0 -0
- {anb_python_components-1.4.1 → anb_python_components-1.4.3}/anb_python_components.egg-info/top_level.txt +0 -0
- {anb_python_components-1.4.1 → anb_python_components-1.4.3}/setup.cfg +0 -0
- {anb_python_components-1.4.1 → anb_python_components-1.4.3}/tests/__init__.py +0 -0
- {anb_python_components-1.4.1 → anb_python_components-1.4.3}/tests/classes/__init__.py +0 -0
- {anb_python_components-1.4.1 → anb_python_components-1.4.3}/tests/classes/action_state_test.py +0 -0
- {anb_python_components-1.4.1 → anb_python_components-1.4.3}/tests/classes/dataclass_analyzer_test.py +0 -0
- {anb_python_components-1.4.1 → anb_python_components-1.4.3}/tests/classes/directory_test.py +0 -0
- {anb_python_components-1.4.1 → anb_python_components-1.4.3}/tests/classes/file_test.py +0 -0
- {anb_python_components-1.4.1 → anb_python_components-1.4.3}/tests/classes/interface_test.py +0 -0
- {anb_python_components-1.4.1 → anb_python_components-1.4.3}/tests/classes/shortcode_parser_test.py +0 -0
- {anb_python_components-1.4.1 → anb_python_components-1.4.3}/tests/custom_types/__init__.py +0 -0
- {anb_python_components-1.4.1 → anb_python_components-1.4.3}/tests/custom_types/two_dim_size_test.py +0 -0
- {anb_python_components-1.4.1 → anb_python_components-1.4.3}/tests/custom_types/version_info_test.py +0 -0
- {anb_python_components-1.4.1 → anb_python_components-1.4.3}/tests/extensions/__init__.py +0 -0
- {anb_python_components-1.4.1 → anb_python_components-1.4.3}/tests/extensions/array_extension_test.py +0 -0
- {anb_python_components-1.4.1 → anb_python_components-1.4.3}/tests/extensions/bool_extension_test.py +0 -0
- {anb_python_components-1.4.1 → anb_python_components-1.4.3}/tests/extensions/type_extension_test.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: anb_python_components
|
|
3
|
-
Version: 1.4.
|
|
3
|
+
Version: 1.4.3
|
|
4
4
|
Summary: Набор компонентов Python, которые упрощают разработку / A set of Python components that simplify development
|
|
5
5
|
Home-page: https://gitflic.ru/project/babaev-an/anb-python-components
|
|
6
6
|
Author: Александр Бабаев
|
|
@@ -12,7 +12,6 @@ Keywords: python components development utils
|
|
|
12
12
|
Classifier: Development Status :: 5 - Production/Stable
|
|
13
13
|
Classifier: Intended Audience :: Developers
|
|
14
14
|
Classifier: License :: OSI Approved :: MIT License
|
|
15
|
-
Classifier: Programming Language :: Python :: 3
|
|
16
15
|
Classifier: Programming Language :: Python :: 3.14
|
|
17
16
|
Classifier: Operating System :: OS Independent
|
|
18
17
|
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
@@ -6,6 +6,7 @@ from anb_python_components.enums.message_type import MessageType
|
|
|
6
6
|
from anb_python_components.exceptions.wrong_type_exception import WrongTypeException
|
|
7
7
|
from anb_python_components.models.action_state_message import ActionStateMessage
|
|
8
8
|
|
|
9
|
+
# noinspection Annotator
|
|
9
10
|
class ActionState[T]:
|
|
10
11
|
"""
|
|
11
12
|
Класс для хранения состояния действия.
|
|
@@ -20,7 +20,7 @@ class GUID:
|
|
|
20
20
|
:param guid: str | GUID - Передаваемый GUID
|
|
21
21
|
"""
|
|
22
22
|
# Проверка типа аргумента guid
|
|
23
|
-
if not isinstance(guid, str)
|
|
23
|
+
if not isinstance(guid, str) and not isinstance(guid, GUID):
|
|
24
24
|
# - если аргумент не является строкой или экземпляром GUID, то генерируем исключение
|
|
25
25
|
raise WrongTypeException("Неверный тип аргумента!", "GUID", str(type(guid)), "guid")
|
|
26
26
|
|
|
@@ -61,47 +61,47 @@ class GUID:
|
|
|
61
61
|
def generate () -> GUID:
|
|
62
62
|
"""
|
|
63
63
|
Генерирует уникальный идентификатор GUID согласно стандарту RFC 4122.
|
|
64
|
+
:return: Уникальный GUID в виде экземпляра GUID.
|
|
64
65
|
"""
|
|
65
|
-
#
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
]
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
[
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
"%04x" % guid_parts[3],
|
|
88
|
-
("%04x%04x%04x" % tuple(guid_parts[4:])),
|
|
89
|
-
]
|
|
90
|
-
)
|
|
91
|
-
|
|
92
|
-
# Возвращаем экземпляр GUID
|
|
66
|
+
# Генерируем все биты сразу (128 бит)
|
|
67
|
+
full_guid = secrets.token_bytes(16) # 16 байт = 128 бит
|
|
68
|
+
|
|
69
|
+
# Преобразуем в массив байт для манипуляции
|
|
70
|
+
guid_bytes = bytearray(full_guid)
|
|
71
|
+
|
|
72
|
+
# Устанавливаем версию (4) в 7‑м байте (биты 4–7)
|
|
73
|
+
guid_bytes[7] = (guid_bytes[7] & 0x0F) | 0x40 # 0x40 = 01000000
|
|
74
|
+
# Устанавливаем вариант (1) в 8‑м байте (биты 6–7)
|
|
75
|
+
guid_bytes[8] = (guid_bytes[8] & 0x3F) | 0x80 # 0x80 = 10000000
|
|
76
|
+
|
|
77
|
+
# Формируем строку GUID
|
|
78
|
+
hex_str = guid_bytes.hex() # 32 hex-цифры
|
|
79
|
+
guid_str = (
|
|
80
|
+
f"{hex_str[0:8]}-"
|
|
81
|
+
f"{hex_str[8:12]}-"
|
|
82
|
+
f"{hex_str[12:16]}-"
|
|
83
|
+
f"{hex_str[16:20]}-"
|
|
84
|
+
f"{hex_str[20:32]}"
|
|
85
|
+
)
|
|
86
|
+
|
|
87
|
+
# Возвращаем GUID
|
|
93
88
|
return GUID(guid_str)
|
|
94
89
|
|
|
95
90
|
@staticmethod
|
|
96
91
|
def is_equal (guid1: str | GUID, guid2: str | GUID) -> bool:
|
|
97
|
-
|
|
92
|
+
"""
|
|
93
|
+
Сравнение двух GUID.
|
|
94
|
+
:param guid1: Первый GUID.
|
|
95
|
+
:param guid2: Второй GUID.
|
|
96
|
+
:return: True, если GUID равны, иначе False.
|
|
97
|
+
"""
|
|
98
98
|
# Если guid1 не является GUID или строкой
|
|
99
|
-
if not isinstance(guid1, GUID)
|
|
99
|
+
if not isinstance(guid1, GUID) and not isinstance(guid1, str):
|
|
100
100
|
# - генерируем исключение
|
|
101
101
|
raise WrongTypeException("Неверный тип аргумента!", "GUID|str", var_name = "guid1")
|
|
102
102
|
|
|
103
103
|
# Если guid2 не является GUID или строкой
|
|
104
|
-
if not isinstance(guid2, GUID)
|
|
104
|
+
if not isinstance(guid2, GUID) and not isinstance(guid2, str):
|
|
105
105
|
# - генерируем исключение
|
|
106
106
|
raise WrongTypeException("Неверный тип аргумента!", "GUID|str", var_name = "guid2")
|
|
107
107
|
|