encommon 1.1.1__tar.gz → 2.0.0__tar.gz

Sign up to get free protection for your applications and to get access to all the features.
Files changed (66) hide show
  1. {encommon-1.1.1/encommon.egg-info → encommon-2.0.0}/PKG-INFO +2 -1
  2. {encommon-1.1.1 → encommon-2.0.0}/encommon/config/common.py +10 -0
  3. {encommon-1.1.1 → encommon-2.0.0}/encommon/config/config.py +66 -7
  4. {encommon-1.1.1 → encommon-2.0.0}/encommon/config/logger.py +1 -7
  5. encommon-2.0.0/encommon/config/params.py +46 -0
  6. {encommon-1.1.1 → encommon-2.0.0}/encommon/config/test/test_config.py +33 -8
  7. {encommon-1.1.1/encommon/crypt → encommon-2.0.0/encommon/crypts}/__init__.py +2 -2
  8. encommon-1.1.1/encommon/crypt/crypt.py → encommon-2.0.0/encommon/crypts/crypts.py +14 -14
  9. encommon-2.0.0/encommon/crypts/params.py +19 -0
  10. encommon-1.1.1/encommon/crypt/test/test_crypt.py → encommon-2.0.0/encommon/crypts/test/test_crypts.py +21 -21
  11. {encommon-1.1.1/encommon/crypt → encommon-2.0.0/encommon/crypts}/test/test_hashes.py +2 -2
  12. encommon-2.0.0/encommon/version.txt +1 -0
  13. {encommon-1.1.1 → encommon-2.0.0/encommon.egg-info}/PKG-INFO +2 -1
  14. {encommon-1.1.1 → encommon-2.0.0}/encommon.egg-info/SOURCES.txt +8 -6
  15. {encommon-1.1.1 → encommon-2.0.0}/encommon.egg-info/requires.txt +1 -0
  16. {encommon-1.1.1 → encommon-2.0.0}/reqs-install.txt +1 -0
  17. {encommon-1.1.1 → encommon-2.0.0}/setup.cfg +1 -1
  18. encommon-1.1.1/encommon/version.txt +0 -1
  19. {encommon-1.1.1 → encommon-2.0.0}/LICENSE +0 -0
  20. {encommon-1.1.1 → encommon-2.0.0}/MANIFEST.in +0 -0
  21. {encommon-1.1.1 → encommon-2.0.0}/README.md +0 -0
  22. {encommon-1.1.1 → encommon-2.0.0}/encommon/__init__.py +0 -0
  23. {encommon-1.1.1 → encommon-2.0.0}/encommon/config/__init__.py +0 -0
  24. {encommon-1.1.1 → encommon-2.0.0}/encommon/config/files.py +0 -0
  25. {encommon-1.1.1 → encommon-2.0.0}/encommon/config/paths.py +0 -0
  26. {encommon-1.1.1 → encommon-2.0.0}/encommon/config/test/__init__.py +0 -0
  27. {encommon-1.1.1 → encommon-2.0.0}/encommon/config/test/test_common.py +0 -0
  28. {encommon-1.1.1 → encommon-2.0.0}/encommon/config/test/test_files.py +0 -0
  29. {encommon-1.1.1 → encommon-2.0.0}/encommon/config/test/test_logger.py +0 -0
  30. {encommon-1.1.1 → encommon-2.0.0}/encommon/config/test/test_paths.py +0 -0
  31. {encommon-1.1.1 → encommon-2.0.0}/encommon/conftest.py +0 -0
  32. {encommon-1.1.1/encommon/crypt → encommon-2.0.0/encommon/crypts}/hashes.py +0 -0
  33. {encommon-1.1.1/encommon/crypt → encommon-2.0.0/encommon/crypts}/test/__init__.py +0 -0
  34. {encommon-1.1.1 → encommon-2.0.0}/encommon/py.typed +0 -0
  35. {encommon-1.1.1 → encommon-2.0.0}/encommon/times/__init__.py +0 -0
  36. {encommon-1.1.1 → encommon-2.0.0}/encommon/times/common.py +0 -0
  37. {encommon-1.1.1 → encommon-2.0.0}/encommon/times/parse.py +0 -0
  38. {encommon-1.1.1 → encommon-2.0.0}/encommon/times/test/__init__.py +0 -0
  39. {encommon-1.1.1 → encommon-2.0.0}/encommon/times/test/test_common.py +0 -0
  40. {encommon-1.1.1 → encommon-2.0.0}/encommon/times/test/test_parse.py +0 -0
  41. {encommon-1.1.1 → encommon-2.0.0}/encommon/times/test/test_timer.py +0 -0
  42. {encommon-1.1.1 → encommon-2.0.0}/encommon/times/test/test_times.py +0 -0
  43. {encommon-1.1.1 → encommon-2.0.0}/encommon/times/test/test_window.py +0 -0
  44. {encommon-1.1.1 → encommon-2.0.0}/encommon/times/timer.py +0 -0
  45. {encommon-1.1.1 → encommon-2.0.0}/encommon/times/times.py +0 -0
  46. {encommon-1.1.1 → encommon-2.0.0}/encommon/times/window.py +0 -0
  47. {encommon-1.1.1 → encommon-2.0.0}/encommon/types/__init__.py +0 -0
  48. {encommon-1.1.1 → encommon-2.0.0}/encommon/types/dicts.py +0 -0
  49. {encommon-1.1.1 → encommon-2.0.0}/encommon/types/empty.py +0 -0
  50. {encommon-1.1.1 → encommon-2.0.0}/encommon/types/test/__init__.py +0 -0
  51. {encommon-1.1.1 → encommon-2.0.0}/encommon/types/test/test_dicts.py +0 -0
  52. {encommon-1.1.1 → encommon-2.0.0}/encommon/types/test/test_empty.py +0 -0
  53. {encommon-1.1.1 → encommon-2.0.0}/encommon/utils/__init__.py +0 -0
  54. {encommon-1.1.1 → encommon-2.0.0}/encommon/utils/common.py +0 -0
  55. {encommon-1.1.1 → encommon-2.0.0}/encommon/utils/paths.py +0 -0
  56. {encommon-1.1.1 → encommon-2.0.0}/encommon/utils/regexp.py +0 -0
  57. {encommon-1.1.1 → encommon-2.0.0}/encommon/utils/sample.py +0 -0
  58. {encommon-1.1.1 → encommon-2.0.0}/encommon/utils/stdout.py +0 -0
  59. {encommon-1.1.1 → encommon-2.0.0}/encommon/utils/test/__init__.py +0 -0
  60. {encommon-1.1.1 → encommon-2.0.0}/encommon/utils/test/test_paths.py +0 -0
  61. {encommon-1.1.1 → encommon-2.0.0}/encommon/utils/test/test_regexp.py +0 -0
  62. {encommon-1.1.1 → encommon-2.0.0}/encommon/utils/test/test_sample.py +0 -0
  63. {encommon-1.1.1 → encommon-2.0.0}/encommon/utils/test/test_stdout.py +0 -0
  64. {encommon-1.1.1 → encommon-2.0.0}/encommon.egg-info/dependency_links.txt +0 -0
  65. {encommon-1.1.1 → encommon-2.0.0}/encommon.egg-info/top_level.txt +0 -0
  66. {encommon-1.1.1 → encommon-2.0.0}/pyproject.toml +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: encommon
3
- Version: 1.1.1
3
+ Version: 2.0.0
4
4
  Summary: Enasis Network Common Library
5
5
  License: MIT
6
6
  Classifier: Programming Language :: Python :: 3
@@ -11,6 +11,7 @@ Description-Content-Type: text/markdown
11
11
  License-File: LICENSE
12
12
  Requires-Dist: croniter
13
13
  Requires-Dist: cryptography
14
+ Requires-Dist: pydantic
14
15
  Requires-Dist: python-dateutil
15
16
  Requires-Dist: pyyaml
16
17
  Requires-Dist: snaptime
@@ -9,6 +9,7 @@ is permitted, for more information consult the project license file.
9
9
 
10
10
  from pathlib import Path
11
11
  from typing import Any
12
+ from typing import Literal
12
13
  from typing import Optional
13
14
 
14
15
  from yaml import SafeLoader
@@ -22,6 +23,15 @@ from ..utils.paths import resolve_paths
22
23
 
23
24
 
24
25
 
26
+ LOGLEVELS = Literal[
27
+ 'critical',
28
+ 'debug',
29
+ 'error',
30
+ 'info',
31
+ 'warning']
32
+
33
+
34
+
25
35
  def config_load(
26
36
  path: str | Path,
27
37
  ) -> dict[str, Any]:
@@ -9,11 +9,15 @@ is permitted, for more information consult the project license file.
9
9
 
10
10
  from copy import deepcopy
11
11
  from typing import Any
12
+ from typing import Callable
12
13
  from typing import Optional
13
14
 
15
+ from .common import config_paths
14
16
  from .files import ConfigFiles
15
17
  from .logger import Logger
18
+ from .params import ConfigFileParams
16
19
  from .paths import ConfigPaths
20
+ from ..crypts.crypts import Crypts
17
21
  from ..types.dicts import merge_dicts
18
22
  from ..utils.common import PATHABLE
19
23
 
@@ -23,19 +27,27 @@ class Config:
23
27
  """
24
28
  Contain the configurations from the arguments and files.
25
29
 
30
+ .. note::
31
+ Configuration loaded from files is validated with the
32
+ Pydantic model :class:`.ConfigFileParams`.
33
+
26
34
  :param files: Complete or relative path to config files.
27
35
  :param paths: Complete or relative path to config paths.
28
36
  :param cargs: Configuration arguments in dictionary form,
29
37
  which will override contents from the config files.
38
+ :param model: Override default config validation model.
30
39
  """
31
40
 
32
41
  __files: ConfigFiles
33
42
  __paths: ConfigPaths
34
43
  __cargs: dict[str, Any]
35
44
 
45
+ __model: Callable # type: ignore
46
+
36
47
  __config: Optional[dict[str, Any]]
37
48
  __merged: Optional[dict[str, Any]]
38
49
  __logger: Optional[Logger]
50
+ __crypts: Optional[Crypts]
39
51
 
40
52
 
41
53
  def __init__(
@@ -44,6 +56,7 @@ class Config:
44
56
  files: Optional[PATHABLE] = None,
45
57
  paths: Optional[PATHABLE] = None,
46
58
  cargs: Optional[dict[str, Any]] = None,
59
+ model: Optional[Callable] = None, # type: ignore
47
60
  ) -> None:
48
61
  """
49
62
  Initialize instance for class using provided parameters.
@@ -53,13 +66,26 @@ class Config:
53
66
  paths = paths or []
54
67
  cargs = cargs or {}
55
68
 
69
+ paths = list(config_paths(paths))
70
+
71
+ self.__model = (
72
+ model or ConfigFileParams)
73
+
56
74
  self.__files = ConfigFiles(files)
57
75
  self.__cargs = deepcopy(cargs)
58
- self.__paths = ConfigPaths(paths)
59
76
 
60
77
  self.__config = None
78
+
79
+ enconfig = self.config['enconfig']
80
+
81
+ if enconfig['paths']:
82
+ paths.extend(enconfig['paths'])
83
+
84
+ self.__paths = ConfigPaths(paths)
85
+
61
86
  self.__merged = None
62
87
  self.__logger = None
88
+ self.__crypts = None
63
89
 
64
90
 
65
91
  @property
@@ -101,6 +127,19 @@ class Config:
101
127
  return self.__cargs
102
128
 
103
129
 
130
+ @property
131
+ def model(
132
+ self,
133
+ ) -> Callable: # type: ignore
134
+ """
135
+ Return the property for attribute from the class instance.
136
+
137
+ :returns: Property for attribute from the class instance.
138
+ """
139
+
140
+ return self.__model
141
+
142
+
104
143
  @property
105
144
  def config(
106
145
  self,
@@ -138,7 +177,10 @@ class Config:
138
177
  force=True)
139
178
 
140
179
 
141
- self.__config = merged
180
+ config = self.__model(**merged)
181
+
182
+
183
+ self.__config = config.model_dump()
142
184
 
143
185
  return deepcopy(self.__config)
144
186
 
@@ -187,11 +229,28 @@ class Config:
187
229
  if self.__logger is not None:
188
230
  return self.__logger
189
231
 
190
- enlogger = self.config.get('enlogger', {})
232
+ enlogger = (
233
+ self.config['enlogger'] or {})
191
234
 
192
- self.__logger = Logger(
193
- stdo_level=enlogger.get('stdo_level'),
194
- file_level=enlogger.get('file_level'),
195
- file_path=enlogger.get('file_path'))
235
+ self.__logger = Logger(**enlogger)
196
236
 
197
237
  return self.__logger
238
+
239
+
240
+ @property
241
+ def crypts(
242
+ self,
243
+ ) -> Crypts:
244
+ """
245
+ Initialize the encryption instance using the parameters.
246
+ """
247
+
248
+ if self.__crypts is not None:
249
+ return self.__crypts
250
+
251
+ encrypts = (
252
+ self.config['encrypts'] or {})
253
+
254
+ self.__crypts = Crypts(**encrypts)
255
+
256
+ return self.__crypts
@@ -25,6 +25,7 @@ from typing import Any
25
25
  from typing import Literal
26
26
  from typing import Optional
27
27
 
28
+ from .common import LOGLEVELS
28
29
  from .common import config_path
29
30
  from ..times.common import PARSABLE
30
31
  from ..times.times import Times
@@ -36,13 +37,6 @@ from ..utils.stdout import kvpair_ansi
36
37
  LOGGER_FILE = 'encommon.logger.file'
37
38
  LOGGER_STDO = 'encommon.logger.stdo'
38
39
 
39
- LOGLEVELS = Literal[
40
- 'critical',
41
- 'debug',
42
- 'error',
43
- 'info',
44
- 'warning']
45
-
46
40
  LOGSEVERS = {
47
41
  'critical': int(CRITICAL),
48
42
  'debug': int(DEBUG),
@@ -0,0 +1,46 @@
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 typing import Optional
11
+
12
+ from pydantic import BaseModel
13
+
14
+ from .common import LOGLEVELS
15
+ from ..crypts.params import CryptsParams
16
+
17
+
18
+
19
+ class ConfigParams(BaseModel):
20
+ """
21
+ Process and validate the common configuration parameters.
22
+ """
23
+
24
+ paths: Optional[list[str]] = None
25
+
26
+
27
+
28
+ class LoggerParams(BaseModel):
29
+ """
30
+ Process and validate the common configuration parameters.
31
+ """
32
+
33
+ stdo_level: Optional[LOGLEVELS] = None
34
+ file_level: Optional[LOGLEVELS] = None
35
+ file_path: Optional[str] = None
36
+
37
+
38
+
39
+ class ConfigFileParams(BaseModel):
40
+ """
41
+ Process and validate the common configuration parameters.
42
+ """
43
+
44
+ enconfig: Optional[ConfigParams] = None
45
+ enlogger: Optional[LoggerParams] = None
46
+ encrypts: Optional[CryptsParams] = None
@@ -12,6 +12,7 @@ from pathlib import Path
12
12
  from ..config import Config
13
13
  from ..logger import Logger
14
14
  from ... import ENPYRWS
15
+ from ...crypts.crypts import Crypts
15
16
  from ...utils.sample import load_sample
16
17
  from ...utils.sample import prep_sample
17
18
 
@@ -37,29 +38,40 @@ def test_Config( # noqa: CFQ001
37
38
  (config_path
38
39
  .joinpath('one.yml')
39
40
  .write_text(
40
- 'stdo_level: info\n'))
41
+ 'enconfig:\n'
42
+ f' paths: ["{config_path}"]\n'
43
+ 'enlogger:\n'
44
+ ' stdo_level: info\n'))
41
45
 
42
46
  (config_path
43
47
  .joinpath('two.yml')
44
48
  .write_text(
45
- 'stdo_level: debug\n'
46
- 'file_level: info\n'))
49
+ 'encrypts:\n'
50
+ ' phrases:\n'
51
+ ' default: fernetpassphrase\n'
52
+ 'enlogger:\n'
53
+ ' stdo_level: debug\n'
54
+ ' file_level: info\n'))
47
55
 
48
56
 
49
57
  config = Config(
50
58
  files=[
51
59
  f'{config_path}/one.yml',
52
60
  f'{config_path}/two.yml'],
53
- paths=[config_path, tmp_path],
54
- cargs={'file_level': 'warning'})
61
+ cargs={
62
+ 'enlogger': {
63
+ 'file_level': 'warning'}})
55
64
 
56
- assert len(config.__dict__) == 6
65
+ assert len(config.__dict__) == 8
57
66
 
58
67
  assert hasattr(config, '_Config__files')
59
68
  assert hasattr(config, '_Config__paths')
60
69
  assert hasattr(config, '_Config__cargs')
70
+ assert hasattr(config, '_Config__model')
61
71
  assert hasattr(config, '_Config__config')
62
72
  assert hasattr(config, '_Config__merged')
73
+ assert hasattr(config, '_Config__logger')
74
+ assert hasattr(config, '_Config__crypts')
63
75
 
64
76
 
65
77
  assert list(config.files.paths) == [
@@ -70,10 +82,13 @@ def test_Config( # noqa: CFQ001
70
82
  Path(f'{config_path}')]
71
83
 
72
84
  assert config.cargs == {
73
- 'file_level': 'warning'}
85
+ 'enlogger': {
86
+ 'file_level': 'warning'}}
74
87
 
88
+ assert hasattr(config.model, 'model_dump')
75
89
 
76
- assert len(config.config) == 2
90
+
91
+ assert len(config.config) == 3
77
92
 
78
93
  _config1 = config.config
79
94
  _config2 = config.config
@@ -135,3 +150,13 @@ def test_Config( # noqa: CFQ001
135
150
  _logger2 = config.logger
136
151
 
137
152
  assert _logger1 is _logger2
153
+
154
+
155
+ crypts = config.crypts
156
+
157
+ assert isinstance(crypts, Crypts)
158
+
159
+ _crypts1 = config.crypts
160
+ _crypts2 = config.crypts
161
+
162
+ assert _crypts1 is _crypts2
@@ -7,11 +7,11 @@ is permitted, for more information consult the project license file.
7
7
 
8
8
 
9
9
 
10
- from .crypt import Crypt
10
+ from .crypts import Crypts
11
11
  from .hashes import Hashes
12
12
 
13
13
 
14
14
 
15
15
  __all__ = [
16
- 'Crypt',
16
+ 'Crypts',
17
17
  'Hashes']
@@ -20,40 +20,40 @@ ENCRYPT = compile(
20
20
 
21
21
 
22
22
 
23
- class Crypt:
23
+ class Crypts:
24
24
  """
25
25
  Encrypt and decrypt values using passphrase dictionary.
26
26
 
27
27
  Example
28
28
  -------
29
- >>> phrase = Crypt.keygen()
30
- >>> crypt = Crypt({'default': phrase})
31
- >>> encrypt = crypt.encrypt('example')
32
- >>> crypt.decrypt(encrypt)
29
+ >>> phrase = Crypts.keygen()
30
+ >>> crypts = Crypts({'default': phrase})
31
+ >>> encrypt = crypts.encrypt('example')
32
+ >>> crypts.decrypt(encrypt)
33
33
  'example'
34
34
 
35
- :param mapping: Passphrases that are used in operations.
35
+ :param phrases: Passphrases that are used in operations.
36
36
  """
37
37
 
38
- __phrase: dict[str, str]
38
+ __phrases: dict[str, str]
39
39
 
40
40
 
41
41
  def __init__(
42
42
  self,
43
- mapping: dict[str, str],
43
+ phrases: dict[str, str],
44
44
  ) -> None:
45
45
  """
46
46
  Initialize instance for class using provided parameters.
47
47
  """
48
48
 
49
- if 'default' not in mapping:
49
+ if 'default' not in phrases:
50
50
  raise ValueError('default')
51
51
 
52
- self.__phrase = dict(mapping)
52
+ self.__phrases = dict(phrases)
53
53
 
54
54
 
55
55
  @property
56
- def mapping(
56
+ def phrases(
57
57
  self,
58
58
  ) -> dict[str, str]:
59
59
  """
@@ -62,7 +62,7 @@ class Crypt:
62
62
  :returns: Property for attribute from the class instance.
63
63
  """
64
64
 
65
- return dict(self.__phrase)
65
+ return dict(self.__phrases)
66
66
 
67
67
 
68
68
  def encrypt(
@@ -78,7 +78,7 @@ class Crypt:
78
78
  :returns: Encrypted value using the relevant passphrase.
79
79
  """
80
80
 
81
- phrase = self.__phrase[unique]
81
+ phrase = self.__phrases[unique]
82
82
 
83
83
  encrypt = (
84
84
  Fernet(phrase)
@@ -112,7 +112,7 @@ class Crypt:
112
112
  if version != '1.0':
113
113
  raise ValueError('version')
114
114
 
115
- phrase = self.__phrase[unique]
115
+ phrase = self.__phrases[unique]
116
116
 
117
117
  return (
118
118
  Fernet(phrase)
@@ -0,0 +1,19 @@
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 pydantic import BaseModel
11
+
12
+
13
+
14
+ class CryptsParams(BaseModel):
15
+ """
16
+ Process and validate the common configuration parameters.
17
+ """
18
+
19
+ phrases: dict[str, str]
@@ -10,37 +10,37 @@ is permitted, for more information consult the project license file.
10
10
  from pytest import mark
11
11
  from pytest import raises
12
12
 
13
- from ..crypt import Crypt
13
+ from ..crypts import Crypts
14
14
 
15
15
 
16
16
 
17
17
  _PHRASES = {
18
- 'default': Crypt.keygen(),
19
- 'secrets': Crypt.keygen()}
18
+ 'default': Crypts.keygen(),
19
+ 'secrets': Crypts.keygen()}
20
20
 
21
21
 
22
22
 
23
- def test_Crypt() -> None:
23
+ def test_Crypts() -> None:
24
24
  """
25
25
  Perform various tests associated with relevant routines.
26
26
  """
27
27
 
28
28
 
29
- crypt = Crypt(_PHRASES)
29
+ crypts = Crypts(_PHRASES)
30
30
 
31
- assert len(crypt.__dict__) == 1
31
+ assert len(crypts.__dict__) == 1
32
32
 
33
- assert hasattr(crypt, '_Crypt__phrase')
33
+ assert hasattr(crypts, '_Crypts__phrases')
34
34
 
35
35
 
36
- assert repr(crypt).startswith(
37
- '<encommon.crypt.crypt.Crypt')
36
+ assert repr(crypts).startswith(
37
+ '<encommon.crypts.crypts.Crypts')
38
38
 
39
- assert str(crypt).startswith(
40
- '<encommon.crypt.crypt.Crypt')
39
+ assert str(crypts).startswith(
40
+ '<encommon.crypts.crypts.Crypts')
41
41
 
42
42
 
43
- assert crypt.mapping == _PHRASES
43
+ assert crypts.phrases == _PHRASES
44
44
 
45
45
 
46
46
 
@@ -48,7 +48,7 @@ def test_Crypt() -> None:
48
48
  'value,unique',
49
49
  [('foo', 'default'),
50
50
  ('foo', 'secrets')])
51
- def test_Crypt_iterate(
51
+ def test_Crypts_iterate(
52
52
  value: str,
53
53
  unique: str,
54
54
  ) -> None:
@@ -59,43 +59,43 @@ def test_Crypt_iterate(
59
59
  :param unique: Unique identifier of mapping passphrase.
60
60
  """
61
61
 
62
- crypt = Crypt(_PHRASES)
62
+ crypts = Crypts(_PHRASES)
63
63
 
64
- encrypt = crypt.encrypt(value, unique)
64
+ encrypt = crypts.encrypt(value, unique)
65
65
 
66
66
  split = encrypt.split(';')
67
67
 
68
68
  assert split[1] == '1.0'
69
69
  assert split[2] == unique
70
70
 
71
- decrypt = crypt.decrypt(encrypt)
71
+ decrypt = crypts.decrypt(encrypt)
72
72
 
73
73
  assert decrypt == value
74
74
 
75
75
 
76
76
 
77
- def test_Crypt_raises() -> None:
77
+ def test_Crypts_raises() -> None:
78
78
  """
79
79
  Perform various tests associated with relevant routines.
80
80
  """
81
81
 
82
82
 
83
83
  with raises(ValueError) as reason:
84
- Crypt({'foo': 'bar'})
84
+ Crypts({'foo': 'bar'})
85
85
 
86
86
  assert str(reason.value) == 'default'
87
87
 
88
88
 
89
- crypt = Crypt(_PHRASES)
89
+ crypts = Crypts(_PHRASES)
90
90
 
91
91
 
92
92
  with raises(ValueError) as reason:
93
- crypt.decrypt('foo')
93
+ crypts.decrypt('foo')
94
94
 
95
95
  assert str(reason.value) == 'string'
96
96
 
97
97
 
98
98
  with raises(ValueError) as reason:
99
- crypt.decrypt('$ENCRYPT;1.1;f;oo')
99
+ crypts.decrypt('$ENCRYPT;1.1;f;oo')
100
100
 
101
101
  assert str(reason.value) == 'version'
@@ -25,10 +25,10 @@ def test_Hashes() -> None:
25
25
 
26
26
 
27
27
  assert repr(hashes).startswith(
28
- '<encommon.crypt.hashes.Hashes')
28
+ '<encommon.crypts.hashes.Hashes')
29
29
 
30
30
  assert str(hashes).startswith(
31
- '<encommon.crypt.hashes.Hashes')
31
+ '<encommon.crypts.hashes.Hashes')
32
32
 
33
33
 
34
34
  assert hashes.string == 'string'
@@ -0,0 +1 @@
1
+ 2.0.0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: encommon
3
- Version: 1.1.1
3
+ Version: 2.0.0
4
4
  Summary: Enasis Network Common Library
5
5
  License: MIT
6
6
  Classifier: Programming Language :: Python :: 3
@@ -11,6 +11,7 @@ Description-Content-Type: text/markdown
11
11
  License-File: LICENSE
12
12
  Requires-Dist: croniter
13
13
  Requires-Dist: cryptography
14
+ Requires-Dist: pydantic
14
15
  Requires-Dist: python-dateutil
15
16
  Requires-Dist: pyyaml
16
17
  Requires-Dist: snaptime
@@ -18,6 +18,7 @@ encommon/config/common.py
18
18
  encommon/config/config.py
19
19
  encommon/config/files.py
20
20
  encommon/config/logger.py
21
+ encommon/config/params.py
21
22
  encommon/config/paths.py
22
23
  encommon/config/test/__init__.py
23
24
  encommon/config/test/test_common.py
@@ -25,12 +26,13 @@ encommon/config/test/test_config.py
25
26
  encommon/config/test/test_files.py
26
27
  encommon/config/test/test_logger.py
27
28
  encommon/config/test/test_paths.py
28
- encommon/crypt/__init__.py
29
- encommon/crypt/crypt.py
30
- encommon/crypt/hashes.py
31
- encommon/crypt/test/__init__.py
32
- encommon/crypt/test/test_crypt.py
33
- encommon/crypt/test/test_hashes.py
29
+ encommon/crypts/__init__.py
30
+ encommon/crypts/crypts.py
31
+ encommon/crypts/hashes.py
32
+ encommon/crypts/params.py
33
+ encommon/crypts/test/__init__.py
34
+ encommon/crypts/test/test_crypts.py
35
+ encommon/crypts/test/test_hashes.py
34
36
  encommon/times/__init__.py
35
37
  encommon/times/common.py
36
38
  encommon/times/parse.py
@@ -1,5 +1,6 @@
1
1
  croniter
2
2
  cryptography
3
+ pydantic
3
4
  python-dateutil
4
5
  pyyaml
5
6
  snaptime
@@ -1,5 +1,6 @@
1
1
  croniter
2
2
  cryptography
3
+ pydantic
3
4
  python-dateutil
4
5
  pyyaml
5
6
  snaptime
@@ -10,7 +10,7 @@ ignore =
10
10
  SFS301,
11
11
  W503,
12
12
  per-file-ignores =
13
- encommon/crypt/hashes.py:S324,
13
+ encommon/crypts/hashes.py:S324,
14
14
  encommon/utils/sample.py:ANN401,SIM114,
15
15
 
16
16
  [mypy]
@@ -1 +0,0 @@
1
- 1.1.1
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes