encommon 0.7.0__tar.gz → 0.7.2__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.0/encommon.egg-info → encommon-0.7.2}/PKG-INFO +1 -1
  2. {encommon-0.7.0 → encommon-0.7.2}/encommon/config/logger.py +10 -1
  3. {encommon-0.7.0 → encommon-0.7.2}/encommon/config/params.py +3 -3
  4. encommon-0.7.2/encommon/config/test/__init__.py +16 -0
  5. {encommon-0.7.0 → encommon-0.7.2}/encommon/config/test/test_config.py +1 -6
  6. {encommon-0.7.0 → encommon-0.7.2}/encommon/config/test/test_files.py +1 -6
  7. {encommon-0.7.0 → encommon-0.7.2}/encommon/config/test/test_logger.py +11 -7
  8. {encommon-0.7.0 → encommon-0.7.2}/encommon/config/test/test_paths.py +1 -6
  9. {encommon-0.7.0 → encommon-0.7.2}/encommon/crypts/params.py +2 -0
  10. {encommon-0.7.0 → encommon-0.7.2}/encommon/times/test/test_times.py +1 -0
  11. {encommon-0.7.0 → encommon-0.7.2}/encommon/times/times.py +13 -0
  12. {encommon-0.7.0 → encommon-0.7.2}/encommon/utils/stdout.py +11 -3
  13. {encommon-0.7.0 → encommon-0.7.2}/encommon/utils/test/test_stdout.py +2 -2
  14. encommon-0.7.2/encommon/version.txt +1 -0
  15. {encommon-0.7.0 → encommon-0.7.2/encommon.egg-info}/PKG-INFO +1 -1
  16. encommon-0.7.0/encommon/utils/test/__init__.py +0 -6
  17. encommon-0.7.0/encommon/version.txt +0 -1
  18. {encommon-0.7.0 → encommon-0.7.2}/LICENSE +0 -0
  19. {encommon-0.7.0 → encommon-0.7.2}/MANIFEST.in +0 -0
  20. {encommon-0.7.0 → encommon-0.7.2}/README.md +0 -0
  21. {encommon-0.7.0 → encommon-0.7.2}/encommon/__init__.py +0 -0
  22. {encommon-0.7.0 → encommon-0.7.2}/encommon/config/__init__.py +0 -0
  23. {encommon-0.7.0 → encommon-0.7.2}/encommon/config/common.py +0 -0
  24. {encommon-0.7.0 → encommon-0.7.2}/encommon/config/config.py +0 -0
  25. {encommon-0.7.0 → encommon-0.7.2}/encommon/config/files.py +0 -0
  26. {encommon-0.7.0 → encommon-0.7.2}/encommon/config/paths.py +0 -0
  27. {encommon-0.7.0 → encommon-0.7.2}/encommon/config/test/test_common.py +0 -0
  28. {encommon-0.7.0 → encommon-0.7.2}/encommon/conftest.py +0 -0
  29. {encommon-0.7.0 → encommon-0.7.2}/encommon/crypts/__init__.py +0 -0
  30. {encommon-0.7.0 → encommon-0.7.2}/encommon/crypts/crypts.py +0 -0
  31. {encommon-0.7.0 → encommon-0.7.2}/encommon/crypts/hashes.py +0 -0
  32. {encommon-0.7.0/encommon/config → encommon-0.7.2/encommon/crypts}/test/__init__.py +0 -0
  33. {encommon-0.7.0 → encommon-0.7.2}/encommon/crypts/test/test_crypts.py +0 -0
  34. {encommon-0.7.0 → encommon-0.7.2}/encommon/crypts/test/test_hashes.py +0 -0
  35. {encommon-0.7.0 → encommon-0.7.2}/encommon/py.typed +0 -0
  36. {encommon-0.7.0 → encommon-0.7.2}/encommon/times/__init__.py +0 -0
  37. {encommon-0.7.0 → encommon-0.7.2}/encommon/times/common.py +0 -0
  38. {encommon-0.7.0 → encommon-0.7.2}/encommon/times/duration.py +0 -0
  39. {encommon-0.7.0 → encommon-0.7.2}/encommon/times/parse.py +0 -0
  40. {encommon-0.7.0/encommon/crypts → encommon-0.7.2/encommon/times}/test/__init__.py +0 -0
  41. {encommon-0.7.0 → encommon-0.7.2}/encommon/times/test/test_common.py +0 -0
  42. {encommon-0.7.0 → encommon-0.7.2}/encommon/times/test/test_duration.py +0 -0
  43. {encommon-0.7.0 → encommon-0.7.2}/encommon/times/test/test_parse.py +0 -0
  44. {encommon-0.7.0 → encommon-0.7.2}/encommon/times/test/test_timers.py +0 -0
  45. {encommon-0.7.0 → encommon-0.7.2}/encommon/times/test/test_window.py +0 -0
  46. {encommon-0.7.0 → encommon-0.7.2}/encommon/times/timers.py +0 -0
  47. {encommon-0.7.0 → encommon-0.7.2}/encommon/times/window.py +0 -0
  48. {encommon-0.7.0 → encommon-0.7.2}/encommon/types/__init__.py +0 -0
  49. {encommon-0.7.0 → encommon-0.7.2}/encommon/types/dicts.py +0 -0
  50. {encommon-0.7.0 → encommon-0.7.2}/encommon/types/empty.py +0 -0
  51. {encommon-0.7.0 → encommon-0.7.2}/encommon/types/strings.py +0 -0
  52. {encommon-0.7.0/encommon/times → encommon-0.7.2/encommon/types}/test/__init__.py +0 -0
  53. {encommon-0.7.0 → encommon-0.7.2}/encommon/types/test/test_dicts.py +0 -0
  54. {encommon-0.7.0 → encommon-0.7.2}/encommon/types/test/test_empty.py +0 -0
  55. {encommon-0.7.0 → encommon-0.7.2}/encommon/types/test/test_strings.py +0 -0
  56. {encommon-0.7.0 → encommon-0.7.2}/encommon/utils/__init__.py +0 -0
  57. {encommon-0.7.0 → encommon-0.7.2}/encommon/utils/common.py +0 -0
  58. {encommon-0.7.0 → encommon-0.7.2}/encommon/utils/match.py +0 -0
  59. {encommon-0.7.0 → encommon-0.7.2}/encommon/utils/paths.py +0 -0
  60. {encommon-0.7.0 → encommon-0.7.2}/encommon/utils/sample.py +0 -0
  61. {encommon-0.7.0/encommon/types → encommon-0.7.2/encommon/utils}/test/__init__.py +0 -0
  62. {encommon-0.7.0 → encommon-0.7.2}/encommon/utils/test/test_match.py +0 -0
  63. {encommon-0.7.0 → encommon-0.7.2}/encommon/utils/test/test_paths.py +0 -0
  64. {encommon-0.7.0 → encommon-0.7.2}/encommon/utils/test/test_sample.py +0 -0
  65. {encommon-0.7.0 → encommon-0.7.2}/encommon.egg-info/SOURCES.txt +0 -0
  66. {encommon-0.7.0 → encommon-0.7.2}/encommon.egg-info/dependency_links.txt +0 -0
  67. {encommon-0.7.0 → encommon-0.7.2}/encommon.egg-info/requires.txt +0 -0
  68. {encommon-0.7.0 → encommon-0.7.2}/encommon.egg-info/top_level.txt +0 -0
  69. {encommon-0.7.0 → encommon-0.7.2}/pyproject.toml +0 -0
  70. {encommon-0.7.0 → encommon-0.7.2}/reqs-install.txt +0 -0
  71. {encommon-0.7.0 → encommon-0.7.2}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: encommon
3
- Version: 0.7.0
3
+ Version: 0.7.2
4
4
  Summary: Enasis Network Common Library
5
5
  License: MIT
6
6
  Classifier: Programming Language :: Python :: 3
@@ -60,7 +60,7 @@ class Message:
60
60
  -------
61
61
  >>> message = Message('info', '1970-01-01', foo='bar')
62
62
  >>> strip_ansi(message.stdo_output)
63
- 'level="info" time="1970-01-01T00:00:00+0000" foo="bar"'
63
+ 'level="info" time="1970-01-01T00:00:00Z" foo="bar"'
64
64
 
65
65
  :param level: Severity which log message is classified.
66
66
  :param time: What time the log message actually occurred.
@@ -95,6 +95,10 @@ class Message:
95
95
  if value in [None, Empty]:
96
96
  continue
97
97
 
98
+ if (key == 'elapsed'
99
+ and isinstance(value, float)):
100
+ value = round(value, 2)
101
+
98
102
  value = str(value)
99
103
 
100
104
  self.__fields[key] = value
@@ -190,6 +194,11 @@ class Message:
190
194
  fields |= dict(self.__fields)
191
195
 
192
196
 
197
+ fields['time'] = (
198
+ fields['time']
199
+ .replace('+0000', 'Z'))
200
+
201
+
193
202
  output: list[str] = []
194
203
 
195
204
  for key, value in fields.items():
@@ -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
@@ -37,7 +37,7 @@ class LoggerParams(BaseModel, extra='forbid'):
37
37
  :param file_level: Minimum log message severity level.
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:
@@ -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:
@@ -14,7 +14,6 @@ from _pytest.logging import LogCaptureFixture
14
14
 
15
15
  from ..logger import Logger
16
16
  from ..logger import Message
17
- from ...times.common import UNIXEPOCH
18
17
  from ...times.common import UNIXMPOCH
19
18
  from ...utils.stdout import strip_ansi
20
19
 
@@ -35,7 +34,8 @@ def test_Message() -> None:
35
34
  int=1,
36
35
  list=[1, '2', 3],
37
36
  none=None,
38
- string='foo')
37
+ string='foo',
38
+ elapsed=0.69420)
39
39
 
40
40
  attrs = list(message.__dict__)
41
41
 
@@ -60,7 +60,8 @@ def test_Message() -> None:
60
60
  'float="1.0", '
61
61
  'int="1", '
62
62
  'list="[1, \'2\', 3]", '
63
- 'string="foo")')
63
+ 'string="foo", '
64
+ 'elapsed="0.69")')
64
65
 
65
66
  assert str(message) == repr(message)
66
67
 
@@ -73,19 +74,21 @@ def test_Message() -> None:
73
74
  'float': '1.0',
74
75
  'int': '1',
75
76
  'list': "[1, '2', 3]",
76
- 'string': 'foo'}
77
+ 'string': 'foo',
78
+ 'elapsed': '0.69'}
77
79
 
78
80
 
79
81
  output = strip_ansi(message.stdo_output)
80
82
 
81
83
  assert output == (
82
84
  'level="info"'
83
- f' time="{UNIXEPOCH}"'
85
+ ' time="1970-01-01T00:00:00Z"'
84
86
  ' dict="{\'foo\': \'bar\'}"'
85
87
  ' float="1.0"'
86
88
  ' int="1"'
87
89
  ' list="[1, \'2\', 3]"'
88
- ' string="foo"')
90
+ ' string="foo"'
91
+ ' elapsed="0.69"')
89
92
 
90
93
 
91
94
  assert message.file_output == (
@@ -95,7 +98,8 @@ def test_Message() -> None:
95
98
  ' "float": "1.0",'
96
99
  ' "int": "1",'
97
100
  ' "list": "[1, \'2\', 3]",'
98
- ' "string": "foo"}')
101
+ ' "string": "foo",'
102
+ ' "elapsed": "0.69"}')
99
103
 
100
104
 
101
105
 
@@ -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:
@@ -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]
@@ -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')
@@ -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,
@@ -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
 
@@ -200,13 +205,16 @@ def array_ansi( # noqa: CFQ001, CFQ004
200
205
  return output.append(
201
206
  f'{prefix} {repeat}')
202
207
 
203
- refers.add(id(value))
208
+
209
+ if isinstance(value, list | tuple | dict):
210
+ refers.add(id(value))
204
211
 
205
212
 
206
213
  types = {
207
- 'dict': dict,
208
214
  'list': list,
209
215
  'tuple': tuple,
216
+ 'dict': dict,
217
+ 'frozenset': frozenset,
210
218
  'set': set}
211
219
 
212
220
  for name, _type in types.items():
@@ -223,9 +223,9 @@ def test_array_ansi() -> None: # noqa: CFQ001
223
223
  ' - 2\n'
224
224
  ' bool: False\n'
225
225
  ' dict: dict\n'
226
- ' str: REPEAT\n'
226
+ " str: 'value'\n"
227
227
  ' list: REPEAT\n'
228
- ' bool: REPEAT\n'
228
+ ' bool: False\n'
229
229
  'Empty: Empty\n'
230
230
  'Duration: 2d5h\n'
231
231
  f'Times: {UNIXMPOCH}')
@@ -0,0 +1 @@
1
+ 0.7.2
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: encommon
3
- Version: 0.7.0
3
+ Version: 0.7.2
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.0
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