educommon 3.19.0__py3-none-any.whl → 3.19.1__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.
- educommon/utils/enums.py +36 -0
- {educommon-3.19.0.dist-info → educommon-3.19.1.dist-info}/METADATA +1 -1
- {educommon-3.19.0.dist-info → educommon-3.19.1.dist-info}/RECORD +5 -4
- {educommon-3.19.0.dist-info → educommon-3.19.1.dist-info}/WHEEL +0 -0
- {educommon-3.19.0.dist-info → educommon-3.19.1.dist-info}/top_level.txt +0 -0
educommon/utils/enums.py
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
from enum import (
|
2
|
+
Enum,
|
3
|
+
)
|
4
|
+
from functools import (
|
5
|
+
lru_cache,
|
6
|
+
)
|
7
|
+
|
8
|
+
|
9
|
+
class NamedIntEnum(Enum):
|
10
|
+
|
11
|
+
"""Базовый класс для набора пар число + строка.
|
12
|
+
|
13
|
+
Пример использования:
|
14
|
+
.. code-block:: python
|
15
|
+
class Status(NamedIntEnum):
|
16
|
+
|
17
|
+
NEW = (1, 'Новый')
|
18
|
+
PROGRESS = (2, 'В процессе')
|
19
|
+
CLOSED = (3, 'Закрыт')
|
20
|
+
|
21
|
+
"""
|
22
|
+
|
23
|
+
def __init__(self, id_: int, verbose: str) -> None:
|
24
|
+
self.id = id_
|
25
|
+
self.verbose = verbose
|
26
|
+
|
27
|
+
@classmethod
|
28
|
+
@lru_cache(maxsize=1)
|
29
|
+
def get_choices(cls) -> tuple[tuple[int, str], ...]:
|
30
|
+
return tuple((value.id, value.verbose) for value in cls)
|
31
|
+
|
32
|
+
def as_dict(self, *, verbose_field: str = 'verbose'):
|
33
|
+
return {
|
34
|
+
'id': self.id,
|
35
|
+
verbose_field: self.verbose,
|
36
|
+
}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: educommon
|
3
|
-
Version: 3.19.
|
3
|
+
Version: 3.19.1
|
4
4
|
Summary: Общая кодовая база для проектов БЦ Образование
|
5
5
|
Author-email: BARS Group <education_dev@bars-open.ru>
|
6
6
|
Project-URL: Homepage, https://stash.bars-open.ru/projects/EDUBASE/repos/educommon/browse
|
@@ -290,6 +290,7 @@ educommon/utils/caching.py,sha256=eHf4xa6loSCCv9Is5XE8G4Fvi3_bzmwKIUHv9tyPDDw,40
|
|
290
290
|
educommon/utils/conversion.py,sha256=C7FHCQQG5eVbeFRulWv_WvBzIq10hsHjZB3VchlbDiY,1960
|
291
291
|
educommon/utils/crypto.py,sha256=kmoX1ntu8tYeobbSxLmyj5kKFabCRQriEfZIxCI7fuM,2139
|
292
292
|
educommon/utils/date.py,sha256=bnwEBMUDR3GYnGLEAYBZnnt-7M2toA1jZAba9Lk1J_A,16676
|
293
|
+
educommon/utils/enums.py,sha256=jc9JJ7FTbe0ynyLtQ6M7G7ESk5lF9tWu6aGlx4C7Jb0,864
|
293
294
|
educommon/utils/misc.py,sha256=6gMFsLoSTktuIv96-6-oouLLdMkSZQyKITz4sXlh-nM,4392
|
294
295
|
educommon/utils/object_grid.py,sha256=2ap8593I7Rs_-H3cTrQcIfEa57lrQ0AtcD119-xEwTU,8705
|
295
296
|
educommon/utils/plugins.py,sha256=F1A1JLSi-7aBxw2kEk5Gstvx4_rIpgY1D5M4bmbK2AA,9344
|
@@ -351,7 +352,7 @@ educommon/ws_log/smev/exceptions.py,sha256=VNfzNHlj5Pz8D4979d_msTkxC-RQVoMctsgoJ
|
|
351
352
|
educommon/ws_log/templates/report/smev_logs.xlsx,sha256=nnYgB0Z_ix8HoxsRICjsZfFRQBdra-5Gd8nWhCxTjYg,10439
|
352
353
|
educommon/ws_log/templates/ui-js/smev-logs-list-window.js,sha256=AGup3D8GTJSY9WdDPj0zBJeYQBFOmGgcbxPOJbKK-nY,513
|
353
354
|
educommon/ws_log/templates/ui-js/smev-logs-report-setting-window.js,sha256=nQ7QYK9frJcE7g7kIt6INg9TlEEJAPPayBJgRaoTePA,1103
|
354
|
-
educommon-3.19.
|
355
|
-
educommon-3.19.
|
356
|
-
educommon-3.19.
|
357
|
-
educommon-3.19.
|
355
|
+
educommon-3.19.1.dist-info/METADATA,sha256=bTmxkUclBTbBh8nVHUJdEpjKH3hzPyKp6WeSHzmOy_U,2380
|
356
|
+
educommon-3.19.1.dist-info/WHEEL,sha256=1tXe9gY0PYatrMPMDd6jXqjfpz_B-Wqm32CPfRC58XU,91
|
357
|
+
educommon-3.19.1.dist-info/top_level.txt,sha256=z5fbW7bz_0V1foUm_FGcZ9_MTpW3N1dBN7-kEmMowl4,10
|
358
|
+
educommon-3.19.1.dist-info/RECORD,,
|
File without changes
|
File without changes
|