encommon 0.7.1__tar.gz → 0.7.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.
Files changed (71) hide show
  1. {encommon-0.7.1/encommon.egg-info → encommon-0.7.3}/PKG-INFO +1 -1
  2. {encommon-0.7.1 → encommon-0.7.3}/encommon/config/config.py +12 -16
  3. {encommon-0.7.1 → encommon-0.7.3}/encommon/config/logger.py +31 -20
  4. {encommon-0.7.1 → encommon-0.7.3}/encommon/config/params.py +5 -5
  5. encommon-0.7.3/encommon/config/test/__init__.py +16 -0
  6. {encommon-0.7.1 → encommon-0.7.3}/encommon/config/test/test_config.py +11 -8
  7. {encommon-0.7.1 → encommon-0.7.3}/encommon/config/test/test_files.py +5 -7
  8. {encommon-0.7.1 → encommon-0.7.3}/encommon/config/test/test_paths.py +5 -7
  9. {encommon-0.7.1 → encommon-0.7.3}/encommon/crypts/crypts.py +15 -3
  10. {encommon-0.7.1 → encommon-0.7.3}/encommon/crypts/hashes.py +14 -14
  11. {encommon-0.7.1 → encommon-0.7.3}/encommon/crypts/params.py +2 -0
  12. {encommon-0.7.1 → encommon-0.7.3}/encommon/times/duration.py +6 -6
  13. {encommon-0.7.1 → encommon-0.7.3}/encommon/times/parse.py +1 -1
  14. {encommon-0.7.1 → encommon-0.7.3}/encommon/times/test/test_times.py +1 -0
  15. {encommon-0.7.1 → encommon-0.7.3}/encommon/times/timers.py +11 -10
  16. {encommon-0.7.1 → encommon-0.7.3}/encommon/times/times.py +17 -4
  17. {encommon-0.7.1 → encommon-0.7.3}/encommon/times/window.py +16 -16
  18. {encommon-0.7.1 → encommon-0.7.3}/encommon/utils/stdout.py +6 -1
  19. encommon-0.7.3/encommon/version.txt +1 -0
  20. {encommon-0.7.1 → encommon-0.7.3/encommon.egg-info}/PKG-INFO +1 -1
  21. encommon-0.7.1/encommon/utils/test/__init__.py +0 -6
  22. encommon-0.7.1/encommon/version.txt +0 -1
  23. {encommon-0.7.1 → encommon-0.7.3}/LICENSE +0 -0
  24. {encommon-0.7.1 → encommon-0.7.3}/MANIFEST.in +0 -0
  25. {encommon-0.7.1 → encommon-0.7.3}/README.md +0 -0
  26. {encommon-0.7.1 → encommon-0.7.3}/encommon/__init__.py +0 -0
  27. {encommon-0.7.1 → encommon-0.7.3}/encommon/config/__init__.py +0 -0
  28. {encommon-0.7.1 → encommon-0.7.3}/encommon/config/common.py +0 -0
  29. {encommon-0.7.1 → encommon-0.7.3}/encommon/config/files.py +0 -0
  30. {encommon-0.7.1 → encommon-0.7.3}/encommon/config/paths.py +0 -0
  31. {encommon-0.7.1 → encommon-0.7.3}/encommon/config/test/test_common.py +0 -0
  32. {encommon-0.7.1 → encommon-0.7.3}/encommon/config/test/test_logger.py +0 -0
  33. {encommon-0.7.1 → encommon-0.7.3}/encommon/conftest.py +0 -0
  34. {encommon-0.7.1 → encommon-0.7.3}/encommon/crypts/__init__.py +0 -0
  35. {encommon-0.7.1/encommon/config → encommon-0.7.3/encommon/crypts}/test/__init__.py +0 -0
  36. {encommon-0.7.1 → encommon-0.7.3}/encommon/crypts/test/test_crypts.py +0 -0
  37. {encommon-0.7.1 → encommon-0.7.3}/encommon/crypts/test/test_hashes.py +0 -0
  38. {encommon-0.7.1 → encommon-0.7.3}/encommon/py.typed +0 -0
  39. {encommon-0.7.1 → encommon-0.7.3}/encommon/times/__init__.py +0 -0
  40. {encommon-0.7.1 → encommon-0.7.3}/encommon/times/common.py +0 -0
  41. {encommon-0.7.1/encommon/crypts → encommon-0.7.3/encommon/times}/test/__init__.py +0 -0
  42. {encommon-0.7.1 → encommon-0.7.3}/encommon/times/test/test_common.py +0 -0
  43. {encommon-0.7.1 → encommon-0.7.3}/encommon/times/test/test_duration.py +0 -0
  44. {encommon-0.7.1 → encommon-0.7.3}/encommon/times/test/test_parse.py +0 -0
  45. {encommon-0.7.1 → encommon-0.7.3}/encommon/times/test/test_timers.py +0 -0
  46. {encommon-0.7.1 → encommon-0.7.3}/encommon/times/test/test_window.py +0 -0
  47. {encommon-0.7.1 → encommon-0.7.3}/encommon/types/__init__.py +0 -0
  48. {encommon-0.7.1 → encommon-0.7.3}/encommon/types/dicts.py +0 -0
  49. {encommon-0.7.1 → encommon-0.7.3}/encommon/types/empty.py +0 -0
  50. {encommon-0.7.1 → encommon-0.7.3}/encommon/types/strings.py +0 -0
  51. {encommon-0.7.1/encommon/times → encommon-0.7.3/encommon/types}/test/__init__.py +0 -0
  52. {encommon-0.7.1 → encommon-0.7.3}/encommon/types/test/test_dicts.py +0 -0
  53. {encommon-0.7.1 → encommon-0.7.3}/encommon/types/test/test_empty.py +0 -0
  54. {encommon-0.7.1 → encommon-0.7.3}/encommon/types/test/test_strings.py +0 -0
  55. {encommon-0.7.1 → encommon-0.7.3}/encommon/utils/__init__.py +0 -0
  56. {encommon-0.7.1 → encommon-0.7.3}/encommon/utils/common.py +0 -0
  57. {encommon-0.7.1 → encommon-0.7.3}/encommon/utils/match.py +0 -0
  58. {encommon-0.7.1 → encommon-0.7.3}/encommon/utils/paths.py +0 -0
  59. {encommon-0.7.1 → encommon-0.7.3}/encommon/utils/sample.py +0 -0
  60. {encommon-0.7.1/encommon/types → encommon-0.7.3/encommon/utils}/test/__init__.py +0 -0
  61. {encommon-0.7.1 → encommon-0.7.3}/encommon/utils/test/test_match.py +0 -0
  62. {encommon-0.7.1 → encommon-0.7.3}/encommon/utils/test/test_paths.py +0 -0
  63. {encommon-0.7.1 → encommon-0.7.3}/encommon/utils/test/test_sample.py +0 -0
  64. {encommon-0.7.1 → encommon-0.7.3}/encommon/utils/test/test_stdout.py +0 -0
  65. {encommon-0.7.1 → encommon-0.7.3}/encommon.egg-info/SOURCES.txt +0 -0
  66. {encommon-0.7.1 → encommon-0.7.3}/encommon.egg-info/dependency_links.txt +0 -0
  67. {encommon-0.7.1 → encommon-0.7.3}/encommon.egg-info/requires.txt +0 -0
  68. {encommon-0.7.1 → encommon-0.7.3}/encommon.egg-info/top_level.txt +0 -0
  69. {encommon-0.7.1 → encommon-0.7.3}/pyproject.toml +0 -0
  70. {encommon-0.7.1 → encommon-0.7.3}/reqs-install.txt +0 -0
  71. {encommon-0.7.1 → encommon-0.7.3}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: encommon
3
- Version: 0.7.1
3
+ Version: 0.7.3
4
4
  Summary: Enasis Network Common Library
5
5
  License: MIT
6
6
  Classifier: Programming Language :: Python :: 3
@@ -90,9 +90,9 @@ class Config:
90
90
  self,
91
91
  ) -> ConfigFiles:
92
92
  """
93
- Return the property for attribute from the class instance.
93
+ Return the value for the attribute from class instance.
94
94
 
95
- :returns: Property for attribute from the class instance.
95
+ :returns: Value for the attribute from class instance.
96
96
  """
97
97
 
98
98
  return self.__files
@@ -103,9 +103,9 @@ class Config:
103
103
  self,
104
104
  ) -> ConfigPaths:
105
105
  """
106
- Return the property for attribute from the class instance.
106
+ Return the value for the attribute from class instance.
107
107
 
108
- :returns: Property for attribute from the class instance.
108
+ :returns: Value for the attribute from class instance.
109
109
  """
110
110
 
111
111
  return self.__paths
@@ -116,9 +116,9 @@ class Config:
116
116
  self,
117
117
  ) -> dict[str, Any]:
118
118
  """
119
- Return the property for attribute from the class instance.
119
+ Return the value for the attribute from class instance.
120
120
 
121
- :returns: Property for attribute from the class instance.
121
+ :returns: Value for the attribute from class instance.
122
122
  """
123
123
 
124
124
  return self.__cargs
@@ -142,9 +142,9 @@ class Config:
142
142
  self,
143
143
  ) -> Callable: # type: ignore
144
144
  """
145
- Return the property for attribute from the class instance.
145
+ Return the value for the attribute from class instance.
146
146
 
147
- :returns: Property for attribute from the class instance.
147
+ :returns: Value for the attribute from class instance.
148
148
  """
149
149
 
150
150
  return self.__model
@@ -191,10 +191,8 @@ class Config:
191
191
  enlogger = (
192
192
  self.params.enlogger)
193
193
 
194
- assert enlogger is not None
195
-
196
- self.__logger = Logger(
197
- **enlogger.model_dump())
194
+ self.__logger = (
195
+ Logger(params=enlogger))
198
196
 
199
197
  return self.__logger
200
198
 
@@ -213,9 +211,7 @@ class Config:
213
211
  encrypts = (
214
212
  self.params.encrypts)
215
213
 
216
- assert encrypts is not None
217
-
218
- self.__crypts = Crypts(
219
- **encrypts.model_dump())
214
+ self.__crypts = (
215
+ Crypts(params=encrypts))
220
216
 
221
217
  return self.__crypts
@@ -24,6 +24,7 @@ from pathlib import Path
24
24
  from typing import Any
25
25
  from typing import Literal
26
26
  from typing import Optional
27
+ from typing import TYPE_CHECKING
27
28
 
28
29
  from .common import LOGLEVELS
29
30
  from .common import config_path
@@ -32,6 +33,9 @@ from ..times.times import Times
32
33
  from ..types.empty import Empty
33
34
  from ..utils.stdout import kvpair_ansi
34
35
 
36
+ if TYPE_CHECKING:
37
+ from .params import LoggerParams
38
+
35
39
 
36
40
 
37
41
  LOGGER_FILE = 'encommon.logger.file'
@@ -143,9 +147,9 @@ class Message:
143
147
  self,
144
148
  ) -> LOGLEVELS:
145
149
  """
146
- Return the property for attribute from the class instance.
150
+ Return the value for the attribute from class instance.
147
151
 
148
- :returns: Property for attribute from the class instance.
152
+ :returns: Value for the attribute from class instance.
149
153
  """
150
154
 
151
155
  return self.__level
@@ -156,9 +160,9 @@ class Message:
156
160
  self,
157
161
  ) -> Times:
158
162
  """
159
- Return the property for attribute from the class instance.
163
+ Return the value for the attribute from class instance.
160
164
 
161
- :returns: Property for attribute from the class instance.
165
+ :returns: Value for the attribute from class instance.
162
166
  """
163
167
 
164
168
  return Times(self.__time)
@@ -169,9 +173,9 @@ class Message:
169
173
  self,
170
174
  ) -> dict[str, str]:
171
175
  """
172
- Return the property for attribute from the class instance.
176
+ Return the value for the attribute from class instance.
173
177
 
174
- :returns: Property for attribute from the class instance.
178
+ :returns: Value for the attribute from class instance.
175
179
  """
176
180
 
177
181
  return dict(self.__fields)
@@ -283,9 +287,10 @@ class Logger:
283
287
  >>> logger.start()
284
288
  >>> logger.log_i(message='testing')
285
289
 
286
- :param stdo_level: Minimum log message severity level.
287
- :param file_level: Minimum log message severity level.
290
+ :param stdo_level: Minimum level for the message to pass.
291
+ :param file_level: Minimum level for the message to pass.
288
292
  :param file_path: Enables writing to the filesystem path.
293
+ :param params: Parameters for instantiating the instance.
289
294
  """
290
295
 
291
296
  __stdo_level: Optional[LOGLEVELS]
@@ -304,11 +309,17 @@ class Logger:
304
309
  stdo_level: Optional[LOGLEVELS] = None,
305
310
  file_level: Optional[LOGLEVELS] = None,
306
311
  file_path: Optional[str | Path] = None,
312
+ params: Optional['LoggerParams'] = None,
307
313
  ) -> None:
308
314
  """
309
315
  Initialize instance for class using provided parameters.
310
316
  """
311
317
 
318
+ if params is not None:
319
+ stdo_level = params.stdo_level
320
+ file_level = params.file_level
321
+ file_path = params.file_path
322
+
312
323
  if file_path is not None:
313
324
  file_path = config_path(file_path)
314
325
 
@@ -327,9 +338,9 @@ class Logger:
327
338
  self,
328
339
  ) -> Optional[LOGLEVELS]:
329
340
  """
330
- Return the property for attribute from the class instance.
341
+ Return the value for the attribute from class instance.
331
342
 
332
- :returns: Property for attribute from the class instance.
343
+ :returns: Value for the attribute from class instance.
333
344
  """
334
345
 
335
346
  return self.__stdo_level
@@ -340,9 +351,9 @@ class Logger:
340
351
  self,
341
352
  ) -> Optional[LOGLEVELS]:
342
353
  """
343
- Return the property for attribute from the class instance.
354
+ Return the value for the attribute from class instance.
344
355
 
345
- :returns: Property for attribute from the class instance.
356
+ :returns: Value for the attribute from class instance.
346
357
  """
347
358
 
348
359
  return self.__file_level
@@ -353,9 +364,9 @@ class Logger:
353
364
  self,
354
365
  ) -> Optional[Path]:
355
366
  """
356
- Return the property for attribute from the class instance.
367
+ Return the value for the attribute from class instance.
357
368
 
358
- :returns: Property for attribute from the class instance.
369
+ :returns: Value for the attribute from class instance.
359
370
  """
360
371
 
361
372
  return self.__file_path
@@ -366,9 +377,9 @@ class Logger:
366
377
  self,
367
378
  ) -> bool:
368
379
  """
369
- Return the property for attribute from the class instance.
380
+ Return the value for the attribute from class instance.
370
381
 
371
- :returns: Property for attribute from the class instance.
382
+ :returns: Value for the attribute from class instance.
372
383
  """
373
384
 
374
385
  return self.__started
@@ -379,9 +390,9 @@ class Logger:
379
390
  self,
380
391
  ) -> _Logger:
381
392
  """
382
- Return the property for attribute from the class instance.
393
+ Return the value for the attribute from class instance.
383
394
 
384
- :returns: Property for attribute from the class instance.
395
+ :returns: Value for the attribute from class instance.
385
396
  """
386
397
 
387
398
  return self.__logger_stdo
@@ -392,9 +403,9 @@ class Logger:
392
403
  self,
393
404
  ) -> _Logger:
394
405
  """
395
- Return the property for attribute from the class instance.
406
+ Return the value for the attribute from class instance.
396
407
 
397
- :returns: Property for attribute from the class instance.
408
+ :returns: Value for the attribute from class instance.
398
409
  """
399
410
 
400
411
  return self.__logger_file
@@ -22,7 +22,7 @@ class ConfigParams(BaseModel, extra='forbid'):
22
22
 
23
23
  :param paths: Complete or relative path to config paths.
24
24
  :param data: Keyword arguments passed to Pydantic model.
25
- This parameter is picked up by autodoc, please ignore.
25
+ Parameter is picked up by autodoc, please ignore.
26
26
  """
27
27
 
28
28
  paths: Optional[list[str]] = None
@@ -33,11 +33,11 @@ class LoggerParams(BaseModel, extra='forbid'):
33
33
  """
34
34
  Process and validate the common configuration parameters.
35
35
 
36
- :param stdo_level: Minimum log message severity level.
37
- :param file_level: Minimum log message severity level.
36
+ :param stdo_level: Minimum level for the message to pass.
37
+ :param file_level: Minimum level for the message to pass.
38
38
  :param file_path: Enables writing to the filesystem path.
39
39
  :param data: Keyword arguments passed to Pydantic model.
40
- This parameter is picked up by autodoc, please ignore.
40
+ Parameter is picked up by autodoc, please ignore.
41
41
  """
42
42
 
43
43
  stdo_level: Optional[LOGLEVELS] = None
@@ -54,7 +54,7 @@ class Params(BaseModel, extra='forbid'):
54
54
  :param enlogger: Configuration for the `.Logger` object.
55
55
  :param encrypts: Configuration for the `.Crypts` object.
56
56
  :param data: Keyword arguments passed to Pydantic model.
57
- This parameter is picked up by autodoc, please ignore.
57
+ Parameter is picked up by autodoc, please ignore.
58
58
  """
59
59
 
60
60
  enconfig: Optional[ConfigParams] = None
@@ -0,0 +1,16 @@
1
+ """
2
+ Functions and routines associated with Enasis Network Common Library.
3
+
4
+ This file is part of Enasis Network software eco-system. Distribution
5
+ is permitted, for more information consult the project license file.
6
+ """
7
+
8
+
9
+
10
+ from pathlib import Path
11
+
12
+
13
+
14
+ SAMPLES = (
15
+ Path(__file__).parent
16
+ .joinpath('samples'))
@@ -9,6 +9,7 @@ is permitted, for more information consult the project license file.
9
9
 
10
10
  from pathlib import Path
11
11
 
12
+ from . import SAMPLES
12
13
  from ..config import Config
13
14
  from ..logger import Logger
14
15
  from ..params import Params
@@ -19,12 +20,6 @@ from ...utils.sample import prep_sample
19
20
 
20
21
 
21
22
 
22
- SAMPLES = (
23
- Path(__file__).parent
24
- .joinpath('samples'))
25
-
26
-
27
-
28
23
  def test_Config( # noqa: CFQ001
29
24
  config_path: Path,
30
25
  ) -> None:
@@ -93,8 +88,12 @@ def test_Config( # noqa: CFQ001
93
88
 
94
89
  assert _config1 is not _config2
95
90
 
91
+
92
+ sample_path = Path(
93
+ f'{SAMPLES}/config.json')
94
+
96
95
  sample = load_sample(
97
- path=SAMPLES.joinpath('config.json'),
96
+ path=sample_path,
98
97
  update=ENPYRWS,
99
98
  content=_config1,
100
99
  replace={
@@ -113,8 +112,12 @@ def test_Config( # noqa: CFQ001
113
112
 
114
113
  assert _params1 is _params2
115
114
 
115
+
116
+ sample_path = Path(
117
+ f'{SAMPLES}/params.json')
118
+
116
119
  sample = load_sample(
117
- path=SAMPLES.joinpath('params.json'),
120
+ path=sample_path,
118
121
  update=ENPYRWS,
119
122
  content=_params1.model_dump(),
120
123
  replace={
@@ -9,6 +9,7 @@ is permitted, for more information consult the project license file.
9
9
 
10
10
  from pathlib import Path
11
11
 
12
+ from . import SAMPLES
12
13
  from ..files import ConfigFile
13
14
  from ..files import ConfigFiles
14
15
  from ... import ENPYRWS
@@ -17,12 +18,6 @@ from ...utils.sample import prep_sample
17
18
 
18
19
 
19
20
 
20
- SAMPLES = (
21
- Path(__file__).parent
22
- .joinpath('samples'))
23
-
24
-
25
-
26
21
  def test_ConfigFile(
27
22
  config_path: Path,
28
23
  ) -> None:
@@ -92,8 +87,11 @@ def test_ConfigFiles(
92
87
 
93
88
  assert _merged1 is not _merged2
94
89
 
90
+ sample_path = Path(
91
+ f'{SAMPLES}/files.json')
92
+
95
93
  sample = load_sample(
96
- path=SAMPLES.joinpath('files.json'),
94
+ path=sample_path,
97
95
  update=ENPYRWS,
98
96
  content=_merged1,
99
97
  replace={
@@ -9,6 +9,7 @@ is permitted, for more information consult the project license file.
9
9
 
10
10
  from pathlib import Path
11
11
 
12
+ from . import SAMPLES
12
13
  from ..paths import ConfigPath
13
14
  from ..paths import ConfigPaths
14
15
  from ... import ENPYRWS
@@ -17,12 +18,6 @@ from ...utils.sample import prep_sample
17
18
 
18
19
 
19
20
 
20
- SAMPLES = (
21
- Path(__file__).parent
22
- .joinpath('samples'))
23
-
24
-
25
-
26
21
  def test_ConfigPath(
27
22
  config_path: Path,
28
23
  ) -> None:
@@ -85,8 +80,11 @@ def test_ConfigPaths(
85
80
 
86
81
  assert _merged1 is not _merged2
87
82
 
83
+ sample_path = Path(
84
+ f'{SAMPLES}/paths.json')
85
+
88
86
  sample = load_sample(
89
- path=SAMPLES.joinpath('paths.json'),
87
+ path=sample_path,
90
88
  update=ENPYRWS,
91
89
  content=_merged1,
92
90
  replace={
@@ -10,9 +10,14 @@ is permitted, for more information consult the project license file.
10
10
  from re import compile
11
11
  from re import match as re_match
12
12
  from re import sub as re_sub
13
+ from typing import Optional
14
+ from typing import TYPE_CHECKING
13
15
 
14
16
  from cryptography.fernet import Fernet
15
17
 
18
+ if TYPE_CHECKING:
19
+ from .params import CryptsParams
20
+
16
21
 
17
22
 
18
23
  ENCRYPT = compile(
@@ -33,6 +38,7 @@ class Crypts:
33
38
  'example'
34
39
 
35
40
  :param phrases: Passphrases that are used in operations.
41
+ :param params: Parameters for instantiating the instance.
36
42
  """
37
43
 
38
44
  __phrases: dict[str, str]
@@ -40,12 +46,18 @@ class Crypts:
40
46
 
41
47
  def __init__(
42
48
  self,
43
- phrases: dict[str, str],
49
+ phrases: Optional[dict[str, str]] = None,
50
+ params: Optional['CryptsParams'] = None,
44
51
  ) -> None:
45
52
  """
46
53
  Initialize instance for class using provided parameters.
47
54
  """
48
55
 
56
+ phrases = phrases or {}
57
+
58
+ if params is not None:
59
+ phrases |= params.phrases
60
+
49
61
  if 'default' not in phrases:
50
62
  raise ValueError('default')
51
63
 
@@ -57,9 +69,9 @@ class Crypts:
57
69
  self,
58
70
  ) -> dict[str, str]:
59
71
  """
60
- Return the property for attribute from the class instance.
72
+ Return the value for the attribute from class instance.
61
73
 
62
- :returns: Property for attribute from the class instance.
74
+ :returns: Value for the attribute from class instance.
63
75
  """
64
76
 
65
77
  return dict(self.__phrases)
@@ -55,9 +55,9 @@ class Hashes:
55
55
  self,
56
56
  ) -> str:
57
57
  """
58
- Return the property for attribute from the class instance.
58
+ Return the value for the attribute from class instance.
59
59
 
60
- :returns: Property for attribute from the class instance.
60
+ :returns: Value for the attribute from class instance.
61
61
  """
62
62
 
63
63
  return self.__string
@@ -68,9 +68,9 @@ class Hashes:
68
68
  self,
69
69
  ) -> str:
70
70
  """
71
- Return the property for attribute from the class instance.
71
+ Return the value for the attribute from class instance.
72
72
 
73
- :returns: Property for attribute from the class instance.
73
+ :returns: Value for the attribute from class instance.
74
74
  """
75
75
 
76
76
  encode = self.__string.encode()
@@ -83,9 +83,9 @@ class Hashes:
83
83
  self,
84
84
  ) -> str:
85
85
  """
86
- Return the property for attribute from the class instance.
86
+ Return the value for the attribute from class instance.
87
87
 
88
- :returns: Property for attribute from the class instance.
88
+ :returns: Value for the attribute from class instance.
89
89
  """
90
90
 
91
91
  string = self.__string.encode()
@@ -98,9 +98,9 @@ class Hashes:
98
98
  self,
99
99
  ) -> str:
100
100
  """
101
- Return the property for attribute from the class instance.
101
+ Return the value for the attribute from class instance.
102
102
 
103
- :returns: Property for attribute from the class instance.
103
+ :returns: Value for the attribute from class instance.
104
104
  """
105
105
 
106
106
  string = self.__string.encode()
@@ -113,9 +113,9 @@ class Hashes:
113
113
  self,
114
114
  ) -> str:
115
115
  """
116
- Return the property for attribute from the class instance.
116
+ Return the value for the attribute from class instance.
117
117
 
118
- :returns: Property for attribute from the class instance.
118
+ :returns: Value for the attribute from class instance.
119
119
  """
120
120
 
121
121
  string = self.__string.encode()
@@ -128,9 +128,9 @@ class Hashes:
128
128
  self,
129
129
  ) -> str:
130
130
  """
131
- Return the property for attribute from the class instance.
131
+ Return the value for the attribute from class instance.
132
132
 
133
- :returns: Property for attribute from the class instance.
133
+ :returns: Value for the attribute from class instance.
134
134
  """
135
135
 
136
136
  string = self.__string
@@ -144,9 +144,9 @@ class Hashes:
144
144
  self,
145
145
  ) -> str:
146
146
  """
147
- Return the property for attribute from the class instance.
147
+ Return the value for the attribute from class instance.
148
148
 
149
- :returns: Property for attribute from the class instance.
149
+ :returns: Value for the attribute from class instance.
150
150
  """
151
151
 
152
152
  string = self.__string.encode()
@@ -15,7 +15,9 @@ class CryptsParams(BaseModel, extra='forbid'):
15
15
  """
16
16
  Process and validate the common configuration parameters.
17
17
 
18
+ :param phrases: Passphrases that are used in operations.
18
19
  :param data: Keyword arguments passed to Pydantic model.
20
+ Parameter is picked up by autodoc, please ignore.
19
21
  """
20
22
 
21
23
  phrases: dict[str, str]
@@ -278,9 +278,9 @@ class Duration:
278
278
  self,
279
279
  ) -> float:
280
280
  """
281
- Return the property for attribute from the class instance.
281
+ Return the value for the attribute from class instance.
282
282
 
283
- :returns: Property for attribute from the class instance.
283
+ :returns: Value for the attribute from class instance.
284
284
  """
285
285
 
286
286
  return self.__source
@@ -291,9 +291,9 @@ class Duration:
291
291
  self,
292
292
  ) -> bool:
293
293
  """
294
- Return the property for attribute from the class instance.
294
+ Return the value for the attribute from class instance.
295
295
 
296
- :returns: Property for attribute from the class instance.
296
+ :returns: Value for the attribute from class instance.
297
297
  """
298
298
 
299
299
  return self.__smart
@@ -304,9 +304,9 @@ class Duration:
304
304
  self,
305
305
  ) -> int:
306
306
  """
307
- Return the property for attribute from the class instance.
307
+ Return the value for the attribute from class instance.
308
308
 
309
- :returns: Property for attribute from the class instance.
309
+ :returns: Value for the attribute from class instance.
310
310
  """
311
311
 
312
312
  return self.__groups
@@ -73,7 +73,7 @@ def parse_time( # noqa: CFQ004
73
73
 
74
74
  :param source: Time in various forms that will be parsed.
75
75
  :param anchor: Optional relative time; for snap notation.
76
- :param format: Optional format for the timestamp string.
76
+ :param format: Optional format when source is timestamp.
77
77
  :param tzname: Name of the timezone associated to source.
78
78
  This is not relevant in timezone included in source.
79
79
  :returns: Python datetime object containing related time.
@@ -63,6 +63,7 @@ def test_Times() -> None:
63
63
  assert times.subsec == UNIXMPOCH
64
64
  assert times.human == UNIXHPOCH
65
65
  assert times.elapsed >= 1672531200
66
+ assert times.since >= 1672531200
66
67
 
67
68
  assert times.before == (
68
69
  '1969-12-31T23:59:59.999999Z')
@@ -19,6 +19,7 @@ if TYPE_CHECKING:
19
19
  from sqlite3 import Connection
20
20
 
21
21
 
22
+
22
23
  TABLE = (
23
24
  """
24
25
  create table
@@ -159,9 +160,9 @@ class Timers:
159
160
  self,
160
161
  ) -> dict[str, float]:
161
162
  """
162
- Return the property for attribute from the class instance.
163
+ Return the value for the attribute from class instance.
163
164
 
164
- :returns: Property for attribute from the class instance.
165
+ :returns: Value for the attribute from class instance.
165
166
  """
166
167
 
167
168
  return dict(self.__timers)
@@ -172,9 +173,9 @@ class Timers:
172
173
  self,
173
174
  ) -> 'Connection':
174
175
  """
175
- Return the property for attribute from the class instance.
176
+ Return the value for the attribute from class instance.
176
177
 
177
- :returns: Property for attribute from the class instance.
178
+ :returns: Value for the attribute from class instance.
178
179
  """
179
180
 
180
181
  return self.__cache_file
@@ -185,9 +186,9 @@ class Timers:
185
186
  self,
186
187
  ) -> dict[str, Times]:
187
188
  """
188
- Return the property for attribute from the class instance.
189
+ Return the value for the attribute from class instance.
189
190
 
190
- :returns: Property for attribute from the class instance.
191
+ :returns: Value for the attribute from class instance.
191
192
  """
192
193
 
193
194
  return dict(self.__cache_dict)
@@ -198,9 +199,9 @@ class Timers:
198
199
  self,
199
200
  ) -> str:
200
201
  """
201
- Return the property for attribute from the class instance.
202
+ Return the value for the attribute from class instance.
202
203
 
203
- :returns: Property for attribute from the class instance.
204
+ :returns: Value for the attribute from class instance.
204
205
  """
205
206
 
206
207
  return self.__cache_name
@@ -231,7 +232,7 @@ class Timers:
231
232
  cache = caches[unique]
232
233
  timer = timers[unique]
233
234
 
234
- ready = cache.elapsed >= timer
235
+ ready = cache.since >= timer
235
236
 
236
237
  if ready and update:
237
238
  self.update(unique)
@@ -278,7 +279,7 @@ class Timers:
278
279
  timers = self.__timers
279
280
  caches = self.__cache_dict
280
281
 
281
- if unique in caches:
282
+ if unique in timers:
282
283
  raise ValueError('unique')
283
284
 
284
285
  timers[unique] = float(minimum)
@@ -34,7 +34,7 @@ class Times:
34
34
 
35
35
  :param source: Time in various forms that will be parsed.
36
36
  :param anchor: Optional relative time; for snap notation.
37
- :param format: Optional format for the timestamp string.
37
+ :param format: Optional format when source is timestamp.
38
38
  :param tzname: Name of the timezone associated to source.
39
39
  This is not relevant in timezone included in source.
40
40
  """
@@ -260,9 +260,9 @@ class Times:
260
260
  self,
261
261
  ) -> datetime:
262
262
  """
263
- Return the property for attribute from the class instance.
263
+ Return the value for the attribute from class instance.
264
264
 
265
- :returns: Property for attribute from the class instance.
265
+ :returns: Value for the attribute from class instance.
266
266
  """
267
267
 
268
268
  return self.__source
@@ -346,6 +346,19 @@ class Times:
346
346
  return since_time(self.__source)
347
347
 
348
348
 
349
+ @property
350
+ def since(
351
+ self,
352
+ ) -> float:
353
+ """
354
+ Determine the time in seconds that occured since instance.
355
+
356
+ :returns: Time in seconds that occured between the values.
357
+ """
358
+
359
+ return since_time(self.__source)
360
+
361
+
349
362
  @property
350
363
  def before(
351
364
  self,
@@ -390,7 +403,7 @@ class Times:
390
403
  """
391
404
  Return the timestamp using provided format for instance.
392
405
 
393
- :param format: Optional format for the timestamp string.
406
+ :param format: Optional format when source is timestamp.
394
407
  :param tzname: Name of the timezone associated to source.
395
408
  This is not relevant in timezone included in source.
396
409
  :returns: Timestamp using provided format for instance.
@@ -109,9 +109,9 @@ class Window:
109
109
  self,
110
110
  ) -> SCHEDULE:
111
111
  """
112
- Return the property for attribute from the class instance.
112
+ Return the value for the attribute from class instance.
113
113
 
114
- :returns: Property for attribute from the class instance.
114
+ :returns: Value for the attribute from class instance.
115
115
  """
116
116
 
117
117
  return copy(self.__schedule)
@@ -122,9 +122,9 @@ class Window:
122
122
  self,
123
123
  ) -> Times:
124
124
  """
125
- Return the property for attribute from the class instance.
125
+ Return the value for the attribute from class instance.
126
126
 
127
- :returns: Property for attribute from the class instance.
127
+ :returns: Value for the attribute from class instance.
128
128
  """
129
129
 
130
130
  return Times(self.__start)
@@ -135,9 +135,9 @@ class Window:
135
135
  self,
136
136
  ) -> Times:
137
137
  """
138
- Return the property for attribute from the class instance.
138
+ Return the value for the attribute from class instance.
139
139
 
140
- :returns: Property for attribute from the class instance.
140
+ :returns: Value for the attribute from class instance.
141
141
  """
142
142
 
143
143
  return Times(self.__stop)
@@ -148,9 +148,9 @@ class Window:
148
148
  self,
149
149
  ) -> Times:
150
150
  """
151
- Return the property for attribute from the class instance.
151
+ Return the value for the attribute from class instance.
152
152
 
153
- :returns: Property for attribute from the class instance.
153
+ :returns: Value for the attribute from class instance.
154
154
  """
155
155
 
156
156
  return Times(self.__anchor)
@@ -161,9 +161,9 @@ class Window:
161
161
  self,
162
162
  ) -> float:
163
163
  """
164
- Return the property for attribute from the class instance.
164
+ Return the value for the attribute from class instance.
165
165
 
166
- :returns: Property for attribute from the class instance.
166
+ :returns: Value for the attribute from class instance.
167
167
  """
168
168
 
169
169
  return self.__delay
@@ -174,9 +174,9 @@ class Window:
174
174
  self,
175
175
  ) -> Times:
176
176
  """
177
- Return the property for attribute from the class instance.
177
+ Return the value for the attribute from class instance.
178
178
 
179
- :returns: Property for attribute from the class instance.
179
+ :returns: Value for the attribute from class instance.
180
180
  """
181
181
 
182
182
  return Times(self.__winext)
@@ -187,9 +187,9 @@ class Window:
187
187
  self,
188
188
  ) -> Times:
189
189
  """
190
- Return the property for attribute from the class instance.
190
+ Return the value for the attribute from class instance.
191
191
 
192
- :returns: Property for attribute from the class instance.
192
+ :returns: Value for the attribute from class instance.
193
193
  """
194
194
 
195
195
  return Times(self.__wilast)
@@ -200,9 +200,9 @@ class Window:
200
200
  self,
201
201
  ) -> bool:
202
202
  """
203
- Return the property for attribute from the class instance.
203
+ Return the value for the attribute from class instance.
204
204
 
205
- :returns: Property for attribute from the class instance.
205
+ :returns: Value for the attribute from class instance.
206
206
  """
207
207
 
208
208
  return self.__walked
@@ -178,11 +178,16 @@ def array_ansi( # noqa: CFQ001, CFQ004
178
178
  This massive function should be refactored, possibly
179
179
  into a class with methods where there are functions.
180
180
 
181
+ Example
182
+ -------
183
+ >>> array_ansi({'foo': 'bar'})
184
+ "\\x1b[0;97mfoo\\x1b[0;37m:\\x1b[0;0m...
185
+
181
186
  :param source: Value in supported and iterable formats.
182
187
  :param indent: How many levels for initial indentation.
183
188
  :param colors: Determine colors used with different types.
184
189
  :returns: ANSI colorized string using inline directives.
185
- """
190
+ """ # noqa: D301 LIT102
186
191
 
187
192
  output: list[str] = []
188
193
 
@@ -0,0 +1 @@
1
+ 0.7.3
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: encommon
3
- Version: 0.7.1
3
+ Version: 0.7.3
4
4
  Summary: Enasis Network Common Library
5
5
  License: MIT
6
6
  Classifier: Programming Language :: Python :: 3
@@ -1,6 +0,0 @@
1
- """
2
- Functions and routines associated with Enasis Network Common Library.
3
-
4
- This file is part of Enasis Network software eco-system. Distribution
5
- is permitted, for more information consult the project license file.
6
- """
@@ -1 +0,0 @@
1
- 0.7.1
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