sysnet-pyutils 1.7.7__tar.gz → 1.7.9__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.
- {sysnet_pyutils-1.7.7 → sysnet_pyutils-1.7.9}/PKG-INFO +1 -1
- {sysnet_pyutils-1.7.7 → sysnet_pyutils-1.7.9}/pyproject.toml +1 -1
- {sysnet_pyutils-1.7.7 → sysnet_pyutils-1.7.9}/sysnet_pyutils/__init__.py +4 -0
- {sysnet_pyutils-1.7.7 → sysnet_pyutils-1.7.9}/sysnet_pyutils/models/general.py +23 -16
- {sysnet_pyutils-1.7.7 → sysnet_pyutils-1.7.9}/sysnet_pyutils.egg-info/PKG-INFO +1 -1
- {sysnet_pyutils-1.7.7 → sysnet_pyutils-1.7.9}/tests/test_models_general.py +12 -8
- {sysnet_pyutils-1.7.7 → sysnet_pyutils-1.7.9}/LICENSE +0 -0
- {sysnet_pyutils-1.7.7 → sysnet_pyutils-1.7.9}/README.md +0 -0
- {sysnet_pyutils-1.7.7 → sysnet_pyutils-1.7.9}/setup.cfg +0 -0
- {sysnet_pyutils-1.7.7 → sysnet_pyutils-1.7.9}/sysnet_pyutils/barcode.py +0 -0
- {sysnet_pyutils-1.7.7 → sysnet_pyutils-1.7.9}/sysnet_pyutils/constants.py +0 -0
- {sysnet_pyutils-1.7.7 → sysnet_pyutils-1.7.9}/sysnet_pyutils/cron_utils/__init__.py +0 -0
- {sysnet_pyutils-1.7.7 → sysnet_pyutils-1.7.9}/sysnet_pyutils/cron_utils/validation.py +0 -0
- {sysnet_pyutils-1.7.7 → sysnet_pyutils-1.7.9}/sysnet_pyutils/data_utils.py +0 -0
- {sysnet_pyutils-1.7.7 → sysnet_pyutils-1.7.9}/sysnet_pyutils/domino.py +0 -0
- {sysnet_pyutils-1.7.7 → sysnet_pyutils-1.7.9}/sysnet_pyutils/geo.py +0 -0
- {sysnet_pyutils-1.7.7 → sysnet_pyutils-1.7.9}/sysnet_pyutils/globalmodel/__init__.py +0 -0
- {sysnet_pyutils-1.7.7 → sysnet_pyutils-1.7.9}/sysnet_pyutils/globalmodel/global_model.py +0 -0
- {sysnet_pyutils-1.7.7 → sysnet_pyutils-1.7.9}/sysnet_pyutils/globalmodel/models.py +0 -0
- {sysnet_pyutils-1.7.7 → sysnet_pyutils-1.7.9}/sysnet_pyutils/globalmodel/timeutils.py +0 -0
- {sysnet_pyutils-1.7.7 → sysnet_pyutils-1.7.9}/sysnet_pyutils/ident.py +0 -0
- {sysnet_pyutils-1.7.7 → sysnet_pyutils-1.7.9}/sysnet_pyutils/log.py +0 -0
- {sysnet_pyutils-1.7.7 → sysnet_pyutils-1.7.9}/sysnet_pyutils/models/__init__.py +0 -0
- {sysnet_pyutils-1.7.7 → sysnet_pyutils-1.7.9}/sysnet_pyutils/ses.py +0 -0
- {sysnet_pyutils-1.7.7 → sysnet_pyutils-1.7.9}/sysnet_pyutils/syslog/__init__.py +0 -0
- {sysnet_pyutils-1.7.7 → sysnet_pyutils-1.7.9}/sysnet_pyutils/syslog/factory.py +0 -0
- {sysnet_pyutils-1.7.7 → sysnet_pyutils-1.7.9}/sysnet_pyutils/tools.py +0 -0
- {sysnet_pyutils-1.7.7 → sysnet_pyutils-1.7.9}/sysnet_pyutils/utils.py +0 -0
- {sysnet_pyutils-1.7.7 → sysnet_pyutils-1.7.9}/sysnet_pyutils.egg-info/SOURCES.txt +0 -0
- {sysnet_pyutils-1.7.7 → sysnet_pyutils-1.7.9}/sysnet_pyutils.egg-info/dependency_links.txt +0 -0
- {sysnet_pyutils-1.7.7 → sysnet_pyutils-1.7.9}/sysnet_pyutils.egg-info/not-zip-safe +0 -0
- {sysnet_pyutils-1.7.7 → sysnet_pyutils-1.7.9}/sysnet_pyutils.egg-info/requires.txt +0 -0
- {sysnet_pyutils-1.7.7 → sysnet_pyutils-1.7.9}/sysnet_pyutils.egg-info/top_level.txt +0 -0
- {sysnet_pyutils-1.7.7 → sysnet_pyutils-1.7.9}/tests/test_cron_utils.py +0 -0
- {sysnet_pyutils-1.7.7 → sysnet_pyutils-1.7.9}/tests/test_cron_validation_edge.py +0 -0
- {sysnet_pyutils-1.7.7 → sysnet_pyutils-1.7.9}/tests/test_data_utils.py +0 -0
- {sysnet_pyutils-1.7.7 → sysnet_pyutils-1.7.9}/tests/test_data_utils_datetime.py +0 -0
- {sysnet_pyutils-1.7.7 → sysnet_pyutils-1.7.9}/tests/test_data_utils_edge.py +0 -0
- {sysnet_pyutils-1.7.7 → sysnet_pyutils-1.7.9}/tests/test_data_utils_missing_branches.py +0 -0
- {sysnet_pyutils-1.7.7 → sysnet_pyutils-1.7.9}/tests/test_domino.py +0 -0
- {sysnet_pyutils-1.7.7 → sysnet_pyutils-1.7.9}/tests/test_domino_edge.py +0 -0
- {sysnet_pyutils-1.7.7 → sysnet_pyutils-1.7.9}/tests/test_geo.py +0 -0
- {sysnet_pyutils-1.7.7 → sysnet_pyutils-1.7.9}/tests/test_global_model_recursive.py +0 -0
- {sysnet_pyutils-1.7.7 → sysnet_pyutils-1.7.9}/tests/test_global_model_timezone.py +0 -0
- {sysnet_pyutils-1.7.7 → sysnet_pyutils-1.7.9}/tests/test_ident_barcode.py +0 -0
- {sysnet_pyutils-1.7.7 → sysnet_pyutils-1.7.9}/tests/test_log_importerror_branch.py +0 -0
- {sysnet_pyutils-1.7.7 → sysnet_pyutils-1.7.9}/tests/test_log_mongo.py +0 -0
- {sysnet_pyutils-1.7.7 → sysnet_pyutils-1.7.9}/tests/test_models_contact.py +0 -0
- {sysnet_pyutils-1.7.7 → sysnet_pyutils-1.7.9}/tests/test_models_general_edge.py +0 -0
- {sysnet_pyutils-1.7.7 → sysnet_pyutils-1.7.9}/tests/test_package_init_version.py +0 -0
- {sysnet_pyutils-1.7.7 → sysnet_pyutils-1.7.9}/tests/test_recursive_update.py +0 -0
- {sysnet_pyutils-1.7.7 → sysnet_pyutils-1.7.9}/tests/test_ses.py +0 -0
- {sysnet_pyutils-1.7.7 → sysnet_pyutils-1.7.9}/tests/test_ses_importerror_branch.py +0 -0
- {sysnet_pyutils-1.7.7 → sysnet_pyutils-1.7.9}/tests/test_syslog_factory.py +0 -0
- {sysnet_pyutils-1.7.7 → sysnet_pyutils-1.7.9}/tests/test_tools.py +0 -0
- {sysnet_pyutils-1.7.7 → sysnet_pyutils-1.7.9}/tests/test_utils.py +0 -0
- {sysnet_pyutils-1.7.7 → sysnet_pyutils-1.7.9}/tests/test_utils_edge.py +0 -0
- {sysnet_pyutils-1.7.7 → sysnet_pyutils-1.7.9}/tests/test_utils_log_base64.py +0 -0
- {sysnet_pyutils-1.7.7 → sysnet_pyutils-1.7.9}/tests/test_utils_missing_branches.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: sysnet-pyutils
|
|
3
|
-
Version: 1.7.
|
|
3
|
+
Version: 1.7.9
|
|
4
4
|
Summary: SYSNET Python Utilities - kompletní sada nástrojů pro Python aplikace
|
|
5
5
|
Author-email: Data Developer <info@sysnet.cz>
|
|
6
6
|
Maintainer-email: SYSNET Development Team <info@sysnet.cz>
|
|
@@ -93,6 +93,9 @@ from sysnet_pyutils.models.general import (
|
|
|
93
93
|
ErrorModel,
|
|
94
94
|
GeoPointJtskType,
|
|
95
95
|
GeoPointType,
|
|
96
|
+
InfoComponentType,
|
|
97
|
+
InfoStatusEnum,
|
|
98
|
+
InfoType,
|
|
96
99
|
LinkedType,
|
|
97
100
|
ListTypeBase,
|
|
98
101
|
LocationType,
|
|
@@ -111,6 +114,7 @@ from sysnet_pyutils.models.general import (
|
|
|
111
114
|
TimeLimitedType,
|
|
112
115
|
UserType,
|
|
113
116
|
WorkflowType,
|
|
117
|
+
calculate_status,
|
|
114
118
|
)
|
|
115
119
|
|
|
116
120
|
# Syslog
|
|
@@ -215,6 +215,14 @@ class MetadataTypeBase(BaseModel):
|
|
|
215
215
|
description="Tvůrce dokumentu - Subjekt primárně odpovědný za vytvoření dokument.",
|
|
216
216
|
examples=["CN=Jan Novák/O=CITES/C=CZ"],
|
|
217
217
|
)
|
|
218
|
+
creator_organization: LinkedType | None = Field(
|
|
219
|
+
default=None,
|
|
220
|
+
description=(
|
|
221
|
+
"Organizace, která dokument vytvořila — strojová vazba do registru osob. "
|
|
222
|
+
"Umožňuje proklik na úřad, export adresy/kontaktů/IČO a filtrování podle "
|
|
223
|
+
"vydávajícího úřadu. Pole creator (řetězec s člověkem) zůstává beze změny."
|
|
224
|
+
),
|
|
225
|
+
)
|
|
218
226
|
created_by_official: bool | None = Field(default=False, description="Vytvořeno úředníkem")
|
|
219
227
|
contributor: UserType | None = Field(default=None, description="Přispěvatel (podílí se na obsahu dokumentu)")
|
|
220
228
|
authorized: bool | None = Field(default=False, description="Dokument byl autorizován")
|
|
@@ -468,28 +476,27 @@ class InfoStatusEnum(BaseEnum):
|
|
|
468
476
|
RED = "RED"
|
|
469
477
|
|
|
470
478
|
|
|
479
|
+
def calculate_status(statuses: List[InfoStatusEnum]) -> InfoStatusEnum:
|
|
480
|
+
"""Vypočítá celkový stav na základě seznamu stavů (RED > YELLOW > GREEN)."""
|
|
481
|
+
if not statuses:
|
|
482
|
+
return InfoStatusEnum.GREEN
|
|
483
|
+
if InfoStatusEnum.RED in statuses:
|
|
484
|
+
return InfoStatusEnum.RED
|
|
485
|
+
if InfoStatusEnum.YELLOW in statuses:
|
|
486
|
+
return InfoStatusEnum.YELLOW
|
|
487
|
+
return InfoStatusEnum.GREEN
|
|
488
|
+
|
|
489
|
+
|
|
471
490
|
class InfoComponentType(BaseModel):
|
|
472
|
-
|
|
491
|
+
name: str = Field(..., description="Název komponenty (např. mongo-db, storage)")
|
|
473
492
|
status: InfoStatusEnum = Field(..., description="Stav komponenty")
|
|
474
|
-
|
|
493
|
+
message: Optional[str] = Field(default=None, description="Detailní zpráva o stavu")
|
|
475
494
|
|
|
476
495
|
|
|
477
496
|
class InfoType(BaseModel):
|
|
478
|
-
status: InfoStatusEnum = Field(default=InfoStatusEnum.GREEN, description="Celkový stav služby")
|
|
479
497
|
name: str = Field(..., description="Název služby")
|
|
480
498
|
version: str = Field(..., description="Verze služby")
|
|
499
|
+
status: InfoStatusEnum = Field(default=InfoStatusEnum.GREEN, description="Celkový stav služby")
|
|
500
|
+
timestamp: datetime = Field(default_factory=datetime.now, description="Čas vygenerování reportu")
|
|
481
501
|
components: List[InfoComponentType] = Field(default_factory=list, description="Seznam komponent")
|
|
482
502
|
|
|
483
|
-
def update_status(self):
|
|
484
|
-
"""Aktualizuje celkový status na základě nejhoršího stavu komponent."""
|
|
485
|
-
if not self.components:
|
|
486
|
-
self.status = InfoStatusEnum.GREEN
|
|
487
|
-
return self.status
|
|
488
|
-
statuses = [c.status for c in self.components]
|
|
489
|
-
if InfoStatusEnum.RED in statuses:
|
|
490
|
-
self.status = InfoStatusEnum.RED
|
|
491
|
-
elif InfoStatusEnum.YELLOW in statuses:
|
|
492
|
-
self.status = InfoStatusEnum.YELLOW
|
|
493
|
-
else:
|
|
494
|
-
self.status = InfoStatusEnum.GREEN
|
|
495
|
-
return self.status
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: sysnet-pyutils
|
|
3
|
-
Version: 1.7.
|
|
3
|
+
Version: 1.7.9
|
|
4
4
|
Summary: SYSNET Python Utilities - kompletní sada nástrojů pro Python aplikace
|
|
5
5
|
Author-email: Data Developer <info@sysnet.cz>
|
|
6
6
|
Maintainer-email: SYSNET Development Team <info@sysnet.cz>
|
|
@@ -208,20 +208,24 @@ class TestIntegration:
|
|
|
208
208
|
assert metadata.contributor.name == "Jan Novák"
|
|
209
209
|
|
|
210
210
|
def test_info_type_status_calculation():
|
|
211
|
-
from sysnet_pyutils.models.general import InfoType, InfoComponentType, InfoStatusEnum
|
|
211
|
+
from sysnet_pyutils.models.general import InfoType, InfoComponentType, InfoStatusEnum, calculate_status
|
|
212
212
|
|
|
213
213
|
info = InfoType(name="Test Service", version="1.0.0")
|
|
214
214
|
assert info.status == InfoStatusEnum.GREEN
|
|
215
215
|
|
|
216
|
-
info.components.append(InfoComponentType(
|
|
217
|
-
|
|
216
|
+
info.components.append(InfoComponentType(name="mongo", status=InfoStatusEnum.GREEN))
|
|
217
|
+
info.status = calculate_status([c.status for c in info.components])
|
|
218
|
+
assert info.status == InfoStatusEnum.GREEN
|
|
218
219
|
|
|
219
|
-
info.components.append(InfoComponentType(
|
|
220
|
-
|
|
220
|
+
info.components.append(InfoComponentType(name="redis", status=InfoStatusEnum.YELLOW))
|
|
221
|
+
info.status = calculate_status([c.status for c in info.components])
|
|
222
|
+
assert info.status == InfoStatusEnum.YELLOW
|
|
221
223
|
|
|
222
|
-
info.components.append(InfoComponentType(
|
|
223
|
-
|
|
224
|
+
info.components.append(InfoComponentType(name="storage", status=InfoStatusEnum.RED))
|
|
225
|
+
info.status = calculate_status([c.status for c in info.components])
|
|
226
|
+
assert info.status == InfoStatusEnum.RED
|
|
224
227
|
|
|
225
228
|
# Odebrání RED komponenty by mělo vrátit YELLOW
|
|
226
229
|
info.components = [c for c in info.components if c.status != InfoStatusEnum.RED]
|
|
227
|
-
|
|
230
|
+
info.status = calculate_status([c.status for c in info.components])
|
|
231
|
+
assert info.status == InfoStatusEnum.YELLOW
|
|
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
|
|
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
|