encommon 0.7.2__tar.gz → 0.7.4__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 (70) hide show
  1. {encommon-0.7.2/encommon.egg-info → encommon-0.7.4}/PKG-INFO +1 -1
  2. {encommon-0.7.2 → encommon-0.7.4}/encommon/config/config.py +12 -16
  3. {encommon-0.7.2 → encommon-0.7.4}/encommon/config/logger.py +31 -20
  4. {encommon-0.7.2 → encommon-0.7.4}/encommon/config/params.py +2 -2
  5. {encommon-0.7.2 → encommon-0.7.4}/encommon/config/test/test_config.py +10 -2
  6. {encommon-0.7.2 → encommon-0.7.4}/encommon/config/test/test_files.py +4 -1
  7. {encommon-0.7.2 → encommon-0.7.4}/encommon/config/test/test_paths.py +4 -1
  8. {encommon-0.7.2 → encommon-0.7.4}/encommon/crypts/crypts.py +15 -3
  9. {encommon-0.7.2 → encommon-0.7.4}/encommon/crypts/hashes.py +14 -14
  10. {encommon-0.7.2 → encommon-0.7.4}/encommon/times/duration.py +6 -6
  11. {encommon-0.7.2 → encommon-0.7.4}/encommon/times/parse.py +1 -1
  12. {encommon-0.7.2 → encommon-0.7.4}/encommon/times/timers.py +11 -10
  13. {encommon-0.7.2 → encommon-0.7.4}/encommon/times/times.py +4 -4
  14. {encommon-0.7.2 → encommon-0.7.4}/encommon/times/window.py +16 -16
  15. {encommon-0.7.2 → encommon-0.7.4}/encommon/utils/sample.py +13 -9
  16. encommon-0.7.4/encommon/version.txt +1 -0
  17. {encommon-0.7.2 → encommon-0.7.4/encommon.egg-info}/PKG-INFO +1 -1
  18. {encommon-0.7.2 → encommon-0.7.4}/setup.cfg +2 -1
  19. encommon-0.7.2/encommon/version.txt +0 -1
  20. {encommon-0.7.2 → encommon-0.7.4}/LICENSE +0 -0
  21. {encommon-0.7.2 → encommon-0.7.4}/MANIFEST.in +0 -0
  22. {encommon-0.7.2 → encommon-0.7.4}/README.md +0 -0
  23. {encommon-0.7.2 → encommon-0.7.4}/encommon/__init__.py +0 -0
  24. {encommon-0.7.2 → encommon-0.7.4}/encommon/config/__init__.py +0 -0
  25. {encommon-0.7.2 → encommon-0.7.4}/encommon/config/common.py +0 -0
  26. {encommon-0.7.2 → encommon-0.7.4}/encommon/config/files.py +0 -0
  27. {encommon-0.7.2 → encommon-0.7.4}/encommon/config/paths.py +0 -0
  28. {encommon-0.7.2 → encommon-0.7.4}/encommon/config/test/__init__.py +0 -0
  29. {encommon-0.7.2 → encommon-0.7.4}/encommon/config/test/test_common.py +0 -0
  30. {encommon-0.7.2 → encommon-0.7.4}/encommon/config/test/test_logger.py +0 -0
  31. {encommon-0.7.2 → encommon-0.7.4}/encommon/conftest.py +0 -0
  32. {encommon-0.7.2 → encommon-0.7.4}/encommon/crypts/__init__.py +0 -0
  33. {encommon-0.7.2 → encommon-0.7.4}/encommon/crypts/params.py +0 -0
  34. {encommon-0.7.2 → encommon-0.7.4}/encommon/crypts/test/__init__.py +0 -0
  35. {encommon-0.7.2 → encommon-0.7.4}/encommon/crypts/test/test_crypts.py +0 -0
  36. {encommon-0.7.2 → encommon-0.7.4}/encommon/crypts/test/test_hashes.py +0 -0
  37. {encommon-0.7.2 → encommon-0.7.4}/encommon/py.typed +0 -0
  38. {encommon-0.7.2 → encommon-0.7.4}/encommon/times/__init__.py +0 -0
  39. {encommon-0.7.2 → encommon-0.7.4}/encommon/times/common.py +0 -0
  40. {encommon-0.7.2 → encommon-0.7.4}/encommon/times/test/__init__.py +0 -0
  41. {encommon-0.7.2 → encommon-0.7.4}/encommon/times/test/test_common.py +0 -0
  42. {encommon-0.7.2 → encommon-0.7.4}/encommon/times/test/test_duration.py +0 -0
  43. {encommon-0.7.2 → encommon-0.7.4}/encommon/times/test/test_parse.py +0 -0
  44. {encommon-0.7.2 → encommon-0.7.4}/encommon/times/test/test_timers.py +0 -0
  45. {encommon-0.7.2 → encommon-0.7.4}/encommon/times/test/test_times.py +0 -0
  46. {encommon-0.7.2 → encommon-0.7.4}/encommon/times/test/test_window.py +0 -0
  47. {encommon-0.7.2 → encommon-0.7.4}/encommon/types/__init__.py +0 -0
  48. {encommon-0.7.2 → encommon-0.7.4}/encommon/types/dicts.py +0 -0
  49. {encommon-0.7.2 → encommon-0.7.4}/encommon/types/empty.py +0 -0
  50. {encommon-0.7.2 → encommon-0.7.4}/encommon/types/strings.py +0 -0
  51. {encommon-0.7.2 → encommon-0.7.4}/encommon/types/test/__init__.py +0 -0
  52. {encommon-0.7.2 → encommon-0.7.4}/encommon/types/test/test_dicts.py +0 -0
  53. {encommon-0.7.2 → encommon-0.7.4}/encommon/types/test/test_empty.py +0 -0
  54. {encommon-0.7.2 → encommon-0.7.4}/encommon/types/test/test_strings.py +0 -0
  55. {encommon-0.7.2 → encommon-0.7.4}/encommon/utils/__init__.py +0 -0
  56. {encommon-0.7.2 → encommon-0.7.4}/encommon/utils/common.py +0 -0
  57. {encommon-0.7.2 → encommon-0.7.4}/encommon/utils/match.py +0 -0
  58. {encommon-0.7.2 → encommon-0.7.4}/encommon/utils/paths.py +0 -0
  59. {encommon-0.7.2 → encommon-0.7.4}/encommon/utils/stdout.py +0 -0
  60. {encommon-0.7.2 → encommon-0.7.4}/encommon/utils/test/__init__.py +0 -0
  61. {encommon-0.7.2 → encommon-0.7.4}/encommon/utils/test/test_match.py +0 -0
  62. {encommon-0.7.2 → encommon-0.7.4}/encommon/utils/test/test_paths.py +0 -0
  63. {encommon-0.7.2 → encommon-0.7.4}/encommon/utils/test/test_sample.py +0 -0
  64. {encommon-0.7.2 → encommon-0.7.4}/encommon/utils/test/test_stdout.py +0 -0
  65. {encommon-0.7.2 → encommon-0.7.4}/encommon.egg-info/SOURCES.txt +0 -0
  66. {encommon-0.7.2 → encommon-0.7.4}/encommon.egg-info/dependency_links.txt +0 -0
  67. {encommon-0.7.2 → encommon-0.7.4}/encommon.egg-info/requires.txt +0 -0
  68. {encommon-0.7.2 → encommon-0.7.4}/encommon.egg-info/top_level.txt +0 -0
  69. {encommon-0.7.2 → encommon-0.7.4}/pyproject.toml +0 -0
  70. {encommon-0.7.2 → encommon-0.7.4}/reqs-install.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: encommon
3
- Version: 0.7.2
3
+ Version: 0.7.4
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
@@ -33,8 +33,8 @@ 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
40
  Parameter is picked up by autodoc, please ignore.
@@ -88,8 +88,12 @@ def test_Config( # noqa: CFQ001
88
88
 
89
89
  assert _config1 is not _config2
90
90
 
91
+
92
+ sample_path = Path(
93
+ f'{SAMPLES}/config.json')
94
+
91
95
  sample = load_sample(
92
- path=SAMPLES.joinpath('config.json'),
96
+ path=sample_path,
93
97
  update=ENPYRWS,
94
98
  content=_config1,
95
99
  replace={
@@ -108,8 +112,12 @@ def test_Config( # noqa: CFQ001
108
112
 
109
113
  assert _params1 is _params2
110
114
 
115
+
116
+ sample_path = Path(
117
+ f'{SAMPLES}/params.json')
118
+
111
119
  sample = load_sample(
112
- path=SAMPLES.joinpath('params.json'),
120
+ path=sample_path,
113
121
  update=ENPYRWS,
114
122
  content=_params1.model_dump(),
115
123
  replace={
@@ -87,8 +87,11 @@ def test_ConfigFiles(
87
87
 
88
88
  assert _merged1 is not _merged2
89
89
 
90
+ sample_path = Path(
91
+ f'{SAMPLES}/files.json')
92
+
90
93
  sample = load_sample(
91
- path=SAMPLES.joinpath('files.json'),
94
+ path=sample_path,
92
95
  update=ENPYRWS,
93
96
  content=_merged1,
94
97
  replace={
@@ -80,8 +80,11 @@ def test_ConfigPaths(
80
80
 
81
81
  assert _merged1 is not _merged2
82
82
 
83
+ sample_path = Path(
84
+ f'{SAMPLES}/paths.json')
85
+
83
86
  sample = load_sample(
84
- path=SAMPLES.joinpath('paths.json'),
87
+ path=sample_path,
85
88
  update=ENPYRWS,
86
89
  content=_merged1,
87
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()
@@ -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.
@@ -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
@@ -403,7 +403,7 @@ class Times:
403
403
  """
404
404
  Return the timestamp using provided format for instance.
405
405
 
406
- :param format: Optional format for the timestamp string.
406
+ :param format: Optional format when source is timestamp.
407
407
  :param tzname: Name of the timezone associated to source.
408
408
  This is not relevant in timezone included in source.
409
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
@@ -20,11 +20,11 @@ from .. import WORKSPACE
20
20
 
21
21
 
22
22
  def prep_sample(
23
- content: Any, # noqa: ANN401
23
+ content: Any,
24
24
  *,
25
25
  default: Callable[[Any], str] = str,
26
- replace: Optional[dict[str, str]] = None,
27
- ) -> Any: # noqa: ANN401
26
+ replace: Optional[dict[str, str | Path]] = None,
27
+ ) -> Any:
28
28
  """
29
29
  Return the content after processing using JSON functions.
30
30
 
@@ -55,10 +55,14 @@ def prep_sample(
55
55
  replace = replace or {}
56
56
 
57
57
  replace |= {
58
- 'PROJECT': str(PROJECT.resolve()),
59
- 'WORKSPACE': str(WORKSPACE.resolve())}
58
+ 'PROJECT': PROJECT,
59
+ 'WORKSPACE': WORKSPACE}
60
60
 
61
61
  for old, new in replace.items():
62
+
63
+ if isinstance(new, Path):
64
+ new = str(new)
65
+
62
66
  content = content.replace(
63
67
  new, f'_/{prefix}/{old}/_')
64
68
 
@@ -72,8 +76,8 @@ def load_sample(
72
76
  update: bool = False,
73
77
  *,
74
78
  default: Callable[[Any], str] = str,
75
- replace: Optional[dict[str, str]] = None,
76
- ) -> Any: # noqa: ANN401
79
+ replace: Optional[dict[str, str | Path]] = None,
80
+ ) -> Any:
77
81
  """
78
82
  Load the sample file and compare using provided content.
79
83
 
@@ -115,7 +119,7 @@ def load_sample(
115
119
  dumps(content, indent=2))
116
120
 
117
121
 
118
- def _load_sample() -> Any: # noqa: ANN401
122
+ def _load_sample() -> Any:
119
123
  return loads(
120
124
  path.read_text(
121
125
  encoding='utf-8'))
@@ -124,7 +128,7 @@ def load_sample(
124
128
  if path.exists():
125
129
  loaded = _load_sample()
126
130
 
127
- if not path.exists(): # noqa: SIM114
131
+ if not path.exists():
128
132
  _save_sample()
129
133
 
130
134
  elif (update is True
@@ -0,0 +1 @@
1
+ 0.7.4
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: encommon
3
- Version: 0.7.2
3
+ Version: 0.7.4
4
4
  Summary: Enasis Network Common Library
5
5
  License: MIT
6
6
  Classifier: Programming Language :: Python :: 3
@@ -12,6 +12,7 @@ ignore =
12
12
  per-file-ignores =
13
13
  encommon/crypts/hashes.py:S324,
14
14
  encommon/times/timers.py:S608,
15
+ encommon/utils/sample.py:ANN401,SIM114,
15
16
  encommon/utils/stdout.py:SIM114,
16
17
  encommon/utils/test/test_stdout.py:LIT015,
17
18
 
@@ -21,7 +22,7 @@ strict = True
21
22
 
22
23
  [coverage:report]
23
24
  exclude_lines =
24
- pragma: no cover
25
+ NOCVR
25
26
  if TYPE_CHECKING
26
27
 
27
28
  [egg_info]
@@ -1 +0,0 @@
1
- 0.7.2
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes