encommon 0.11.1__tar.gz → 0.12.1__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.
- {encommon-0.11.1/encommon.egg-info → encommon-0.12.1}/PKG-INFO +32 -14
- {encommon-0.11.1 → encommon-0.12.1}/README.md +30 -13
- {encommon-0.11.1 → encommon-0.12.1}/encommon/config/logger.py +3 -0
- {encommon-0.11.1 → encommon-0.12.1}/encommon/config/params.py +0 -2
- {encommon-0.11.1 → encommon-0.12.1}/encommon/times/params.py +0 -4
- {encommon-0.11.1 → encommon-0.12.1}/encommon/times/test/test_timers.py +38 -32
- {encommon-0.11.1 → encommon-0.12.1}/encommon/times/test/test_windows.py +47 -45
- {encommon-0.11.1 → encommon-0.12.1}/encommon/times/timers.py +107 -83
- {encommon-0.11.1 → encommon-0.12.1}/encommon/times/windows.py +127 -100
- encommon-0.12.1/encommon/version.txt +1 -0
- {encommon-0.11.1 → encommon-0.12.1/encommon.egg-info}/PKG-INFO +32 -14
- {encommon-0.11.1 → encommon-0.12.1}/encommon.egg-info/requires.txt +1 -0
- {encommon-0.11.1 → encommon-0.12.1}/reqs-install.txt +1 -0
- encommon-0.11.1/encommon/version.txt +0 -1
- {encommon-0.11.1 → encommon-0.12.1}/LICENSE +0 -0
- {encommon-0.11.1 → encommon-0.12.1}/MANIFEST.in +0 -0
- {encommon-0.11.1 → encommon-0.12.1}/encommon/__init__.py +0 -0
- {encommon-0.11.1 → encommon-0.12.1}/encommon/config/__init__.py +0 -0
- {encommon-0.11.1 → encommon-0.12.1}/encommon/config/config.py +0 -0
- {encommon-0.11.1 → encommon-0.12.1}/encommon/config/files.py +0 -0
- {encommon-0.11.1 → encommon-0.12.1}/encommon/config/paths.py +0 -0
- {encommon-0.11.1 → encommon-0.12.1}/encommon/config/test/__init__.py +0 -0
- {encommon-0.11.1 → encommon-0.12.1}/encommon/config/test/test_config.py +0 -0
- {encommon-0.11.1 → encommon-0.12.1}/encommon/config/test/test_files.py +0 -0
- {encommon-0.11.1 → encommon-0.12.1}/encommon/config/test/test_logger.py +0 -0
- {encommon-0.11.1 → encommon-0.12.1}/encommon/config/test/test_paths.py +0 -0
- {encommon-0.11.1 → encommon-0.12.1}/encommon/config/test/test_utils.py +0 -0
- {encommon-0.11.1 → encommon-0.12.1}/encommon/config/utils.py +0 -0
- {encommon-0.11.1 → encommon-0.12.1}/encommon/conftest.py +0 -0
- {encommon-0.11.1 → encommon-0.12.1}/encommon/crypts/__init__.py +0 -0
- {encommon-0.11.1 → encommon-0.12.1}/encommon/crypts/crypts.py +0 -0
- {encommon-0.11.1 → encommon-0.12.1}/encommon/crypts/hashes.py +0 -0
- {encommon-0.11.1 → encommon-0.12.1}/encommon/crypts/params.py +0 -0
- {encommon-0.11.1 → encommon-0.12.1}/encommon/crypts/test/__init__.py +0 -0
- {encommon-0.11.1 → encommon-0.12.1}/encommon/crypts/test/test_crypts.py +0 -0
- {encommon-0.11.1 → encommon-0.12.1}/encommon/crypts/test/test_hashes.py +0 -0
- {encommon-0.11.1 → encommon-0.12.1}/encommon/py.typed +0 -0
- {encommon-0.11.1 → encommon-0.12.1}/encommon/times/__init__.py +0 -0
- {encommon-0.11.1 → encommon-0.12.1}/encommon/times/common.py +0 -0
- {encommon-0.11.1 → encommon-0.12.1}/encommon/times/duration.py +0 -0
- {encommon-0.11.1 → encommon-0.12.1}/encommon/times/parse.py +0 -0
- {encommon-0.11.1 → encommon-0.12.1}/encommon/times/test/__init__.py +0 -0
- {encommon-0.11.1 → encommon-0.12.1}/encommon/times/test/test_duration.py +0 -0
- {encommon-0.11.1 → encommon-0.12.1}/encommon/times/test/test_params.py +0 -0
- {encommon-0.11.1 → encommon-0.12.1}/encommon/times/test/test_parse.py +0 -0
- {encommon-0.11.1 → encommon-0.12.1}/encommon/times/test/test_timer.py +0 -0
- {encommon-0.11.1 → encommon-0.12.1}/encommon/times/test/test_times.py +0 -0
- {encommon-0.11.1 → encommon-0.12.1}/encommon/times/test/test_utils.py +0 -0
- {encommon-0.11.1 → encommon-0.12.1}/encommon/times/test/test_window.py +0 -0
- {encommon-0.11.1 → encommon-0.12.1}/encommon/times/timer.py +0 -0
- {encommon-0.11.1 → encommon-0.12.1}/encommon/times/times.py +0 -0
- {encommon-0.11.1 → encommon-0.12.1}/encommon/times/utils.py +0 -0
- {encommon-0.11.1 → encommon-0.12.1}/encommon/times/window.py +0 -0
- {encommon-0.11.1 → encommon-0.12.1}/encommon/types/__init__.py +0 -0
- {encommon-0.11.1 → encommon-0.12.1}/encommon/types/dicts.py +0 -0
- {encommon-0.11.1 → encommon-0.12.1}/encommon/types/empty.py +0 -0
- {encommon-0.11.1 → encommon-0.12.1}/encommon/types/notate.py +0 -0
- {encommon-0.11.1 → encommon-0.12.1}/encommon/types/strings.py +0 -0
- {encommon-0.11.1 → encommon-0.12.1}/encommon/types/test/__init__.py +0 -0
- {encommon-0.11.1 → encommon-0.12.1}/encommon/types/test/test_dicts.py +0 -0
- {encommon-0.11.1 → encommon-0.12.1}/encommon/types/test/test_empty.py +0 -0
- {encommon-0.11.1 → encommon-0.12.1}/encommon/types/test/test_notate.py +0 -0
- {encommon-0.11.1 → encommon-0.12.1}/encommon/types/test/test_strings.py +0 -0
- {encommon-0.11.1 → encommon-0.12.1}/encommon/utils/__init__.py +0 -0
- {encommon-0.11.1 → encommon-0.12.1}/encommon/utils/common.py +0 -0
- {encommon-0.11.1 → encommon-0.12.1}/encommon/utils/files.py +0 -0
- {encommon-0.11.1 → encommon-0.12.1}/encommon/utils/match.py +0 -0
- {encommon-0.11.1 → encommon-0.12.1}/encommon/utils/paths.py +0 -0
- {encommon-0.11.1 → encommon-0.12.1}/encommon/utils/sample.py +0 -0
- {encommon-0.11.1 → encommon-0.12.1}/encommon/utils/stdout.py +0 -0
- {encommon-0.11.1 → encommon-0.12.1}/encommon/utils/test/__init__.py +0 -0
- {encommon-0.11.1 → encommon-0.12.1}/encommon/utils/test/test_files.py +0 -0
- {encommon-0.11.1 → encommon-0.12.1}/encommon/utils/test/test_match.py +0 -0
- {encommon-0.11.1 → encommon-0.12.1}/encommon/utils/test/test_paths.py +0 -0
- {encommon-0.11.1 → encommon-0.12.1}/encommon/utils/test/test_sample.py +0 -0
- {encommon-0.11.1 → encommon-0.12.1}/encommon/utils/test/test_stdout.py +0 -0
- {encommon-0.11.1 → encommon-0.12.1}/encommon.egg-info/SOURCES.txt +0 -0
- {encommon-0.11.1 → encommon-0.12.1}/encommon.egg-info/dependency_links.txt +0 -0
- {encommon-0.11.1 → encommon-0.12.1}/encommon.egg-info/top_level.txt +0 -0
- {encommon-0.11.1 → encommon-0.12.1}/pyproject.toml +0 -0
- {encommon-0.11.1 → encommon-0.12.1}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: encommon
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.12.1
|
4
4
|
Summary: Enasis Network Common Library
|
5
5
|
License: MIT
|
6
6
|
Classifier: Programming Language :: Python :: 3
|
@@ -15,6 +15,7 @@ Requires-Dist: pydantic
|
|
15
15
|
Requires-Dist: python-dateutil
|
16
16
|
Requires-Dist: pyyaml
|
17
17
|
Requires-Dist: snaptime
|
18
|
+
Requires-Dist: sqlalchemy
|
18
19
|
|
19
20
|
# Enasis Network Common Library
|
20
21
|
|
@@ -73,16 +74,33 @@ information found in the `htmlcov` folder in the root of the project.
|
|
73
74
|
make -s pytest
|
74
75
|
```
|
75
76
|
|
76
|
-
##
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
```
|
81
|
-
|
82
|
-
```
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
77
|
+
## Version management
|
78
|
+
:warning: Ensure that no changes are pending.
|
79
|
+
|
80
|
+
1. Rebuild the environment.
|
81
|
+
```
|
82
|
+
make -s check-revenv
|
83
|
+
```
|
84
|
+
|
85
|
+
1. Update the [version.txt](encommon/version.txt) file.
|
86
|
+
|
87
|
+
1. Push to the `main` branch.
|
88
|
+
|
89
|
+
1. Create [repository](https://github.com/enasisnetwork/encommon) release.
|
90
|
+
|
91
|
+
1. Build the Python package.<br>
|
92
|
+
```
|
93
|
+
make -s pypackage
|
94
|
+
```
|
95
|
+
|
96
|
+
1. Upload Python package to PyPi test.
|
97
|
+
```
|
98
|
+
make -s pypi-upload-test
|
99
|
+
```
|
100
|
+
|
101
|
+
1. Upload Python package to PyPi prod.
|
102
|
+
```
|
103
|
+
make -s pypi-upload-prod
|
104
|
+
```
|
105
|
+
|
106
|
+
1. Update [Read the Docs](https://encommon.readthedocs.io) documentation.
|
@@ -55,16 +55,33 @@ information found in the `htmlcov` folder in the root of the project.
|
|
55
55
|
make -s pytest
|
56
56
|
```
|
57
57
|
|
58
|
-
##
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
```
|
63
|
-
|
64
|
-
```
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
58
|
+
## Version management
|
59
|
+
:warning: Ensure that no changes are pending.
|
60
|
+
|
61
|
+
1. Rebuild the environment.
|
62
|
+
```
|
63
|
+
make -s check-revenv
|
64
|
+
```
|
65
|
+
|
66
|
+
1. Update the [version.txt](encommon/version.txt) file.
|
67
|
+
|
68
|
+
1. Push to the `main` branch.
|
69
|
+
|
70
|
+
1. Create [repository](https://github.com/enasisnetwork/encommon) release.
|
71
|
+
|
72
|
+
1. Build the Python package.<br>
|
73
|
+
```
|
74
|
+
make -s pypackage
|
75
|
+
```
|
76
|
+
|
77
|
+
1. Upload Python package to PyPi test.
|
78
|
+
```
|
79
|
+
make -s pypi-upload-test
|
80
|
+
```
|
81
|
+
|
82
|
+
1. Upload Python package to PyPi prod.
|
83
|
+
```
|
84
|
+
make -s pypi-upload-prod
|
85
|
+
```
|
86
|
+
|
87
|
+
1. Update [Read the Docs](https://encommon.readthedocs.io) documentation.
|
@@ -37,8 +37,6 @@ class LoggerParams(BaseModel, extra='forbid'):
|
|
37
37
|
:param stdo_level: Minimum level for the message to pass.
|
38
38
|
:param file_level: Minimum level for the message to pass.
|
39
39
|
:param file_path: Enables writing to the filesystem path.
|
40
|
-
:param data: Keyword arguments passed to Pydantic model.
|
41
|
-
Parameter is picked up by autodoc, please ignore.
|
42
40
|
"""
|
43
41
|
|
44
42
|
stdo_level: Optional[LOGLEVELS] = None
|
@@ -24,8 +24,6 @@ class TimerParams(BaseModel, extra='forbid'):
|
|
24
24
|
|
25
25
|
:param timer: Seconds that are used for related timer.
|
26
26
|
:param start: Optional time for when the timer started.
|
27
|
-
:param data: Keyword arguments passed to Pydantic model.
|
28
|
-
Parameter is picked up by autodoc, please ignore.
|
29
27
|
"""
|
30
28
|
|
31
29
|
timer: float
|
@@ -81,8 +79,6 @@ class WindowParams(BaseModel, extra='forbid'):
|
|
81
79
|
:param stop: Determine the ending for scheduling window.
|
82
80
|
:param anchor: Optionally define time anchor for window.
|
83
81
|
:param delay: Period of time schedulng will be delayed.
|
84
|
-
:param data: Keyword arguments passed to Pydantic model.
|
85
|
-
Parameter is picked up by autodoc, please ignore.
|
86
82
|
"""
|
87
83
|
|
88
84
|
window: SCHEDULE
|
@@ -17,6 +17,7 @@ from pytest import raises
|
|
17
17
|
from ..params import TimerParams
|
18
18
|
from ..params import TimersParams
|
19
19
|
from ..timers import Timers
|
20
|
+
from ..timers import TimersTable
|
20
21
|
from ..times import Times
|
21
22
|
from ...types import inrepr
|
22
23
|
from ...types import instr
|
@@ -34,40 +35,45 @@ def timers(
|
|
34
35
|
:returns: Newly constructed instance of related class.
|
35
36
|
"""
|
36
37
|
|
38
|
+
|
37
39
|
source: dict[str, Any] = {
|
38
40
|
'one': {'timer': 1},
|
39
41
|
'two': {'timer': 1}}
|
40
42
|
|
43
|
+
|
41
44
|
params = TimersParams(
|
42
45
|
timers=source)
|
43
46
|
|
47
|
+
store = (
|
48
|
+
f'sqlite:///{tmp_path}'
|
49
|
+
'/cache.db')
|
50
|
+
|
44
51
|
timers = Timers(
|
45
52
|
params,
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
sqlite.commit()
|
53
|
+
store=store)
|
54
|
+
|
55
|
+
session = timers.store_session
|
56
|
+
|
57
|
+
|
58
|
+
timer = TimersTable(
|
59
|
+
group='default',
|
60
|
+
unique='two',
|
61
|
+
update='1970-01-01T00:00:00Z')
|
62
|
+
|
63
|
+
session.add(timer)
|
64
|
+
|
65
|
+
session.commit()
|
66
|
+
|
67
|
+
|
68
|
+
timer = TimersTable(
|
69
|
+
group='default',
|
70
|
+
unique='tre',
|
71
|
+
update='1970-01-01T00:00:00Z')
|
72
|
+
|
73
|
+
session.add(timer)
|
74
|
+
|
75
|
+
session.commit()
|
76
|
+
|
71
77
|
|
72
78
|
timers.load_children()
|
73
79
|
|
@@ -89,10 +95,10 @@ def test_Timers(
|
|
89
95
|
|
90
96
|
assert attrs == [
|
91
97
|
'_Timers__params',
|
92
|
-
'
|
93
|
-
'_Timers__file',
|
94
|
-
'_Timers__table',
|
98
|
+
'_Timers__store',
|
95
99
|
'_Timers__group',
|
100
|
+
'_Timers__store_engine',
|
101
|
+
'_Timers__store_session',
|
96
102
|
'_Timers__timers']
|
97
103
|
|
98
104
|
|
@@ -109,13 +115,13 @@ def test_Timers(
|
|
109
115
|
|
110
116
|
assert timers.params is not None
|
111
117
|
|
112
|
-
assert timers.
|
118
|
+
assert timers.store[:6] == 'sqlite'
|
113
119
|
|
114
|
-
assert timers.
|
120
|
+
assert timers.group == 'default'
|
115
121
|
|
116
|
-
assert timers.
|
122
|
+
assert timers.store_engine is not None
|
117
123
|
|
118
|
-
assert timers.
|
124
|
+
assert timers.store_session is not None
|
119
125
|
|
120
126
|
assert len(timers.children) == 2
|
121
127
|
|
@@ -17,6 +17,7 @@ from pytest import raises
|
|
17
17
|
from ..params import WindowParams
|
18
18
|
from ..params import WindowsParams
|
19
19
|
from ..windows import Windows
|
20
|
+
from ..windows import WindowsTable
|
20
21
|
from ...types import inrepr
|
21
22
|
from ...types import instr
|
22
23
|
|
@@ -33,6 +34,7 @@ def windows(
|
|
33
34
|
:returns: Newly constructed instance of related class.
|
34
35
|
"""
|
35
36
|
|
37
|
+
|
36
38
|
source: dict[str, Any] = {
|
37
39
|
'one': WindowParams(
|
38
40
|
window='* * * * *',
|
@@ -45,46 +47,46 @@ def windows(
|
|
45
47
|
stop=620,
|
46
48
|
delay=10)}
|
47
49
|
|
50
|
+
|
48
51
|
params = WindowsParams(
|
49
52
|
windows=source)
|
50
53
|
|
54
|
+
store = (
|
55
|
+
f'sqlite:///{tmp_path}'
|
56
|
+
'/cache.db')
|
57
|
+
|
51
58
|
windows = Windows(
|
52
59
|
params,
|
53
60
|
start=310,
|
54
61
|
stop=610,
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
"1970-01-01T00:07:00Z",
|
84
|
-
"1970-01-01T01:00:00Z")
|
85
|
-
""") # noqa: LIT003
|
86
|
-
|
87
|
-
sqlite.commit()
|
62
|
+
store=store)
|
63
|
+
|
64
|
+
session = windows.store_session
|
65
|
+
|
66
|
+
|
67
|
+
window = WindowsTable(
|
68
|
+
group='default',
|
69
|
+
unique='two',
|
70
|
+
last='1970-01-01T00:06:00Z',
|
71
|
+
next='1970-01-01T00:07:00Z',
|
72
|
+
update='1970-01-01T01:00:00Z')
|
73
|
+
|
74
|
+
session.add(window)
|
75
|
+
|
76
|
+
session.commit()
|
77
|
+
|
78
|
+
|
79
|
+
window = WindowsTable(
|
80
|
+
group='default',
|
81
|
+
unique='tre',
|
82
|
+
last='1970-01-01T00:06:00Z',
|
83
|
+
next='1970-01-01T00:07:00Z',
|
84
|
+
update='1970-01-01T01:00:00Z')
|
85
|
+
|
86
|
+
session.add(window)
|
87
|
+
|
88
|
+
session.commit()
|
89
|
+
|
88
90
|
|
89
91
|
windows.load_children()
|
90
92
|
|
@@ -106,12 +108,12 @@ def test_Windows(
|
|
106
108
|
|
107
109
|
assert attrs == [
|
108
110
|
'_Windows__params',
|
111
|
+
'_Windows__store',
|
112
|
+
'_Windows__group',
|
113
|
+
'_Windows__store_engine',
|
114
|
+
'_Windows__store_session',
|
109
115
|
'_Windows__start',
|
110
116
|
'_Windows__stop',
|
111
|
-
'_Windows__sqlite',
|
112
|
-
'_Windows__file',
|
113
|
-
'_Windows__table',
|
114
|
-
'_Windows__group',
|
115
117
|
'_Windows__windows']
|
116
118
|
|
117
119
|
|
@@ -128,19 +130,19 @@ def test_Windows(
|
|
128
130
|
|
129
131
|
assert windows.params is not None
|
130
132
|
|
131
|
-
assert windows.
|
132
|
-
'1970-01-01T00:05:10Z')
|
133
|
+
assert windows.store[:6] == 'sqlite'
|
133
134
|
|
134
|
-
assert windows.
|
135
|
-
'1970-01-01T00:10:10Z')
|
135
|
+
assert windows.group == 'default'
|
136
136
|
|
137
|
-
assert windows.
|
137
|
+
assert windows.store_engine is not None
|
138
138
|
|
139
|
-
assert windows.
|
139
|
+
assert windows.store_session is not None
|
140
140
|
|
141
|
-
assert windows.
|
141
|
+
assert windows.start == (
|
142
|
+
'1970-01-01T00:05:10Z')
|
142
143
|
|
143
|
-
assert windows.
|
144
|
+
assert windows.stop == (
|
145
|
+
'1970-01-01T00:10:10Z')
|
144
146
|
|
145
147
|
assert len(windows.children) == 2
|
146
148
|
|