encommon 0.7.0__py3-none-any.whl → 0.7.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
encommon/config/logger.py CHANGED
@@ -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():
@@ -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
 
encommon/utils/stdout.py CHANGED
@@ -200,13 +200,16 @@ def array_ansi( # noqa: CFQ001, CFQ004
200
200
  return output.append(
201
201
  f'{prefix} {repeat}')
202
202
 
203
- refers.add(id(value))
203
+
204
+ if isinstance(value, list | tuple | dict):
205
+ refers.add(id(value))
204
206
 
205
207
 
206
208
  types = {
207
- 'dict': dict,
208
209
  'list': list,
209
210
  'tuple': tuple,
211
+ 'dict': dict,
212
+ 'frozenset': frozenset,
210
213
  'set': set}
211
214
 
212
215
  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}')
encommon/version.txt CHANGED
@@ -1 +1 @@
1
- 0.7.0
1
+ 0.7.1
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: encommon
3
- Version: 0.7.0
3
+ Version: 0.7.1
4
4
  Summary: Enasis Network Common Library
5
5
  License: MIT
6
6
  Classifier: Programming Language :: Python :: 3
@@ -1,19 +1,19 @@
1
1
  encommon/__init__.py,sha256=VoXUcphq-gcXCraaU47EtXBftF6UVuQPMGr0fuCTt9A,525
2
2
  encommon/conftest.py,sha256=z5BMi6KjNuactDRgbh8J8w81V08Ptf6QK2o_bJANRs4,880
3
3
  encommon/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
- encommon/version.txt,sha256=ln2a-xATRmZxZvLnboGRC8GQSI19QdUMoAcunZLwDjI,6
4
+ encommon/version.txt,sha256=kCMRx7s4-hZY_0A972FY7nN4_p1uLihPocOHNcMb0ws,6
5
5
  encommon/config/__init__.py,sha256=2ic7tK2lOQvqWmmQnMozqxCJcbyQ_sSEHmOUDUFan2U,710
6
6
  encommon/config/common.py,sha256=gaKBgkF7b7UIAhd0ESio0KpG8JfdRpz5BxNgKRptd6A,2041
7
7
  encommon/config/config.py,sha256=-wIkyA6YQGAly0WuXLaOYXENjZYRYgWk_VdUN8mMe8Q,4853
8
8
  encommon/config/files.py,sha256=2DHz7GKOjF8FC26tY0V-E9svNMrlkSUshb2gfxqGgSo,2313
9
- encommon/config/logger.py,sha256=2y-VFzgM2pZzEYq48XfvrDPrtUcxyP9QjbH5OG7fv5o,13449
9
+ encommon/config/logger.py,sha256=jtxqmpFLDFEfWyfpgiOmHEavEfuWUOdehAk32ce8slA,13662
10
10
  encommon/config/params.py,sha256=IWQ-UzR8x6VxkcUddC3qhI612IFMfLW44jEjRePXK0c,1825
11
11
  encommon/config/paths.py,sha256=0EpXWn6G9IO6tuZTrWuDq53RI5xMTgDQrAlOjRLILHs,2433
12
12
  encommon/config/test/__init__.py,sha256=PjrnBYT0efyvbaGeNx94dm3tP3EVHUHSVs-VGeLEv5g,218
13
13
  encommon/config/test/test_common.py,sha256=U6XWfCLxtLmArn8P6h4cmCALzdXxV7IMUxKNU-UhwPw,731
14
14
  encommon/config/test/test_config.py,sha256=SMe8ZrHRVS7jcyoFB-jBmlYTdUkBT1RrjZ9QlAW1EtE,3292
15
15
  encommon/config/test/test_files.py,sha256=OlGziUPV35yrdn2Ac8tuqmFfjHciWJADdQRvacoJNUc,2298
16
- encommon/config/test/test_logger.py,sha256=oLMosbxHq313oSNkdsrJe_kp0YrlcLCErIccg66zXcI,4635
16
+ encommon/config/test/test_logger.py,sha256=6SO_iCTGDHZYnITVEyN4Q15bho2TYVxmNxDr-t3-_Ak,4740
17
17
  encommon/config/test/test_paths.py,sha256=vNWYqiN_wNuFCu1HHEekoJdGGJyRlucDBZTAspwxWhc,2107
18
18
  encommon/crypts/__init__.py,sha256=7tNT1KqdYaVTLMKJazQGBULe8RpxD4MJoJi8nGMZixw,318
19
19
  encommon/crypts/crypts.py,sha256=Av6kb9xSvj8mVMxZW8J_PuzBWV24Rw-fOFR9OKW-oH4,3158
@@ -49,14 +49,14 @@ encommon/utils/common.py,sha256=UrowELh3PtDzpSS48nGhsAxTS_QUk96-KEJa4MlxiMA,466
49
49
  encommon/utils/match.py,sha256=4L2d2Cvr7vp3odkRCdNQ10OIW8DkEP55_NbQ6bdsReo,2462
50
50
  encommon/utils/paths.py,sha256=4EeaPsVwpv3pzoHeWmiSSGYZEud6hkD27kvbvgSpOPs,3236
51
51
  encommon/utils/sample.py,sha256=hOhS6A2aB9a5kXfrst7gUSQkxuqEo2J1AFyBsJZQhHE,3169
52
- encommon/utils/stdout.py,sha256=pPL68iE2oGk-hE3KGZjWE1vnOF6hflaarYPVZQnefHQ,7142
52
+ encommon/utils/stdout.py,sha256=coGmpw9Wljxy-m3jI6AAUwhuGJPnxJXykz3uVWlwak0,7234
53
53
  encommon/utils/test/__init__.py,sha256=PjrnBYT0efyvbaGeNx94dm3tP3EVHUHSVs-VGeLEv5g,218
54
54
  encommon/utils/test/test_match.py,sha256=QagKpTFdRo23-Y55fSaJrSMpt5jIebScKbz0h8tivrI,1124
55
55
  encommon/utils/test/test_paths.py,sha256=0ls9gWJ2B487Dr1fHDDFCZPA7gxtv56nFEYHrTkNX-U,1892
56
56
  encommon/utils/test/test_sample.py,sha256=iNV9IxXmA5KJat3jKRiZH3iutHrT6bsibwti60AhICk,1464
57
- encommon/utils/test/test_stdout.py,sha256=U3YD8XIfVjjh_vNxN1UJqOWyp7_OFtJVl2K5oMziPu8,4878
58
- encommon-0.7.0.dist-info/LICENSE,sha256=otnXKCtMjPlbHs0wgZ_BWULrp3g_2dWQJ6icRk9nkgg,1071
59
- encommon-0.7.0.dist-info/METADATA,sha256=as7cVGwmjhknmAnTKkAOi6hrVIXU07tWU0t83L4Fn_4,2671
60
- encommon-0.7.0.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
61
- encommon-0.7.0.dist-info/top_level.txt,sha256=bP8q7-5tLDNm-3XPlqn_bDENfYNug5801H_xfz3BEAM,9
62
- encommon-0.7.0.dist-info/RECORD,,
57
+ encommon/utils/test/test_stdout.py,sha256=TA7xQuFoPZUYW2l00e04MGp4P9gHkkVxVflvPlhpQXg,4878
58
+ encommon-0.7.1.dist-info/LICENSE,sha256=otnXKCtMjPlbHs0wgZ_BWULrp3g_2dWQJ6icRk9nkgg,1071
59
+ encommon-0.7.1.dist-info/METADATA,sha256=NW58CHjQymcfLpmbdHWOMJVbIbxX2T_5wD4qDPs9Ctk,2671
60
+ encommon-0.7.1.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
61
+ encommon-0.7.1.dist-info/top_level.txt,sha256=bP8q7-5tLDNm-3XPlqn_bDENfYNug5801H_xfz3BEAM,9
62
+ encommon-0.7.1.dist-info/RECORD,,