encommon 0.14.0__py3-none-any.whl → 0.16.0__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. encommon/colors/__init__.py +2 -2
  2. encommon/colors/{colors.py → color.py} +24 -24
  3. encommon/colors/test/{test_colors.py → test_color.py} +16 -16
  4. encommon/config/config.py +27 -27
  5. encommon/config/files.py +14 -14
  6. encommon/config/logger.py +7 -7
  7. encommon/config/params.py +47 -30
  8. encommon/config/paths.py +13 -13
  9. encommon/config/test/__init__.py +1 -1
  10. encommon/config/test/test_config.py +45 -18
  11. encommon/config/test/test_files.py +8 -7
  12. encommon/config/test/test_logger.py +11 -10
  13. encommon/config/test/test_paths.py +11 -10
  14. encommon/config/utils.py +2 -2
  15. encommon/crypts/crypts.py +2 -2
  16. encommon/crypts/params.py +28 -12
  17. encommon/crypts/test/test_crypts.py +5 -5
  18. encommon/crypts/test/test_hashes.py +2 -1
  19. encommon/times/__init__.py +2 -2
  20. encommon/times/common.py +2 -2
  21. encommon/times/params.py +76 -48
  22. encommon/times/parse.py +3 -3
  23. encommon/times/test/test_duration.py +3 -2
  24. encommon/times/test/test_time.py +123 -0
  25. encommon/times/test/test_timer.py +5 -4
  26. encommon/times/test/test_timers.py +10 -9
  27. encommon/times/test/test_window.py +4 -3
  28. encommon/times/test/test_windows.py +7 -6
  29. encommon/times/{times.py → time.py} +62 -15
  30. encommon/times/timer.py +10 -10
  31. encommon/times/timers.py +5 -5
  32. encommon/times/unitime.py +9 -0
  33. encommon/times/window.py +31 -31
  34. encommon/times/windows.py +12 -12
  35. encommon/types/classes.py +2 -15
  36. encommon/types/lists.py +6 -0
  37. encommon/types/notate.py +2 -1
  38. encommon/types/strings.py +5 -0
  39. encommon/types/test/test_classes.py +2 -2
  40. encommon/types/test/test_empty.py +2 -1
  41. encommon/utils/sample.py +8 -7
  42. encommon/utils/stdout.py +4 -5
  43. encommon/utils/test/test_paths.py +3 -3
  44. encommon/utils/test/test_sample.py +2 -2
  45. encommon/utils/test/test_stdout.py +3 -3
  46. encommon/version.txt +1 -1
  47. {encommon-0.14.0.dist-info → encommon-0.16.0.dist-info}/METADATA +1 -1
  48. encommon-0.16.0.dist-info/RECORD +84 -0
  49. {encommon-0.14.0.dist-info → encommon-0.16.0.dist-info}/WHEEL +1 -1
  50. encommon/times/test/test_times.py +0 -122
  51. encommon-0.14.0.dist-info/RECORD +0 -84
  52. {encommon-0.14.0.dist-info → encommon-0.16.0.dist-info}/LICENSE +0 -0
  53. {encommon-0.14.0.dist-info → encommon-0.16.0.dist-info}/top_level.txt +0 -0
@@ -7,8 +7,8 @@ is permitted, for more information consult the project license file.
7
7
 
8
8
 
9
9
 
10
- from .colors import Colors
10
+ from .color import Color
11
11
 
12
12
 
13
13
 
14
- __all__ = ['Colors']
14
+ __all__ = ['Color']
@@ -14,13 +14,13 @@ from ..types import strplwr
14
14
 
15
15
 
16
16
 
17
- class Colors:
17
+ class Color:
18
18
  """
19
19
  Covert colors to various forms using provided hex value.
20
20
 
21
21
  Example
22
22
  -------
23
- >>> color = Colors('#003333')
23
+ >>> color = Color('#003333')
24
24
  >>> color.rgb
25
25
  (0, 51, 51)
26
26
  >>> color.hsl
@@ -32,12 +32,12 @@ class Colors:
32
32
 
33
33
  Example
34
34
  -------
35
- >>> color1 = Colors('#003333')
36
- >>> color2 = Colors('#330000')
35
+ >>> color1 = Color('#003333')
36
+ >>> color2 = Color('#330000')
37
37
  >>> color1 - color2
38
- Colors('#32CCCD')
38
+ Color('#32CCCD')
39
39
  >>> color1 + color2
40
- Colors('#333333')
40
+ Color('#333333')
41
41
 
42
42
  :param source: Source color used when converting values.
43
43
  """
@@ -72,7 +72,7 @@ class Colors:
72
72
 
73
73
  color = self.__str__()
74
74
 
75
- return f"Colors('{color}')"
75
+ return f"Color('{color}')"
76
76
 
77
77
 
78
78
  def __hash__(
@@ -130,8 +130,8 @@ class Colors:
130
130
 
131
131
  def __add__(
132
132
  self,
133
- other: Union[int, str, 'Colors'],
134
- ) -> 'Colors':
133
+ other: Union[int, str, 'Color'],
134
+ ) -> 'Color':
135
135
  """
136
136
  Built-in method for mathematically processing the value.
137
137
 
@@ -140,7 +140,7 @@ class Colors:
140
140
  """
141
141
 
142
142
  if isinstance(other, str):
143
- other = Colors(other)
143
+ other = Color(other)
144
144
 
145
145
  source = self.__int__()
146
146
  _source = int(other)
@@ -149,13 +149,13 @@ class Colors:
149
149
 
150
150
  result = f'{outcome:06x}'
151
151
 
152
- return Colors(result)
152
+ return Color(result)
153
153
 
154
154
 
155
155
  def __sub__(
156
156
  self,
157
- other: Union[int, str, 'Colors'],
158
- ) -> 'Colors':
157
+ other: Union[int, str, 'Color'],
158
+ ) -> 'Color':
159
159
  """
160
160
  Built-in method for mathematically processing the value.
161
161
 
@@ -164,7 +164,7 @@ class Colors:
164
164
  """
165
165
 
166
166
  if isinstance(other, str):
167
- other = Colors(other)
167
+ other = Color(other)
168
168
 
169
169
  source = self.__int__()
170
170
  _source = int(other)
@@ -173,7 +173,7 @@ class Colors:
173
173
 
174
174
  result = f'{outcome:06x}'
175
175
 
176
- return Colors(result)
176
+ return Color(result)
177
177
 
178
178
 
179
179
  def __eq__(
@@ -193,7 +193,7 @@ class Colors:
193
193
  other = f'{other:06x}'
194
194
 
195
195
  if isinstance(other, str):
196
- other = Colors(other)
196
+ other = Color(other)
197
197
 
198
198
  assert hasattr(other, 'source')
199
199
 
@@ -223,7 +223,7 @@ class Colors:
223
223
 
224
224
  def __gt__(
225
225
  self,
226
- other: Union[int, str, 'Colors'],
226
+ other: Union[int, str, 'Color'],
227
227
  ) -> bool:
228
228
  """
229
229
  Built-in method for comparing this instance with another.
@@ -238,7 +238,7 @@ class Colors:
238
238
  other = f'{other:06x}'
239
239
 
240
240
  if isinstance(other, str):
241
- other = Colors(other)
241
+ other = Color(other)
242
242
 
243
243
  assert hasattr(other, 'source')
244
244
 
@@ -254,7 +254,7 @@ class Colors:
254
254
 
255
255
  def __ge__(
256
256
  self,
257
- other: Union[int, str, 'Colors'],
257
+ other: Union[int, str, 'Color'],
258
258
  ) -> bool:
259
259
  """
260
260
  Built-in method for comparing this instance with another.
@@ -269,7 +269,7 @@ class Colors:
269
269
  other = f'{other:06x}'
270
270
 
271
271
  if isinstance(other, str):
272
- other = Colors(other)
272
+ other = Color(other)
273
273
 
274
274
  assert hasattr(other, 'source')
275
275
 
@@ -285,7 +285,7 @@ class Colors:
285
285
 
286
286
  def __lt__(
287
287
  self,
288
- other: Union[int, str, 'Colors'],
288
+ other: Union[int, str, 'Color'],
289
289
  ) -> bool:
290
290
  """
291
291
  Built-in method for comparing this instance with another.
@@ -300,7 +300,7 @@ class Colors:
300
300
  other = f'{other:06x}'
301
301
 
302
302
  if isinstance(other, str):
303
- other = Colors(other)
303
+ other = Color(other)
304
304
 
305
305
  assert hasattr(other, 'source')
306
306
 
@@ -316,7 +316,7 @@ class Colors:
316
316
 
317
317
  def __le__(
318
318
  self,
319
- other: Union[int, str, 'Colors'],
319
+ other: Union[int, str, 'Color'],
320
320
  ) -> bool:
321
321
  """
322
322
  Built-in method for comparing this instance with another.
@@ -331,7 +331,7 @@ class Colors:
331
331
  other = f'{other:06x}'
332
332
 
333
333
  if isinstance(other, str):
334
- other = Colors(other)
334
+ other = Color(other)
335
335
 
336
336
  assert hasattr(other, 'source')
337
337
 
@@ -9,27 +9,27 @@ is permitted, for more information consult the project license file.
9
9
 
10
10
  from pytest import mark
11
11
 
12
- from ..colors import Colors
12
+ from ..color import Color
13
13
  from ...types import lattrs
14
14
 
15
15
 
16
16
 
17
- def test_Colors() -> None:
17
+ def test_Color() -> None:
18
18
  """
19
19
  Perform various tests associated with relevant routines.
20
20
  """
21
21
 
22
- color = Colors('000001')
22
+ color = Color('000001')
23
23
 
24
24
 
25
25
  attrs = lattrs(color)
26
26
 
27
27
  assert attrs == [
28
- '_Colors__source']
28
+ '_Color__source']
29
29
 
30
30
 
31
31
  assert repr(color) == (
32
- "Colors('#000001')")
32
+ "Color('#000001')")
33
33
 
34
34
  assert hash(color) > 0
35
35
 
@@ -71,7 +71,7 @@ def test_Colors() -> None:
71
71
  ('00ffff', (0, 255, 255)),
72
72
  ('ff00ff', (255, 0, 255)),
73
73
  ('800080', (128, 0, 128))])
74
- def test_Colors_rgb(
74
+ def test_Color_rgb(
75
75
  source: str,
76
76
  expect: tuple[int, ...],
77
77
  ) -> None:
@@ -82,7 +82,7 @@ def test_Colors_rgb(
82
82
  :param expect: Expected output from the testing routine.
83
83
  """
84
84
 
85
- assert Colors(source).rgb == expect
85
+ assert Color(source).rgb == expect
86
86
 
87
87
 
88
88
 
@@ -99,7 +99,7 @@ def test_Colors_rgb(
99
99
  ('00ffff', (53.8100, 78.7400, 106.9700)),
100
100
  ('ff00ff', (59.2900, 28.4800, 96.9800)),
101
101
  ('800080', (12.7984, 6.1477, 20.9342))])
102
- def test_Colors_xyz(
102
+ def test_Color_xyz(
103
103
  source: str,
104
104
  expect: tuple[int, ...],
105
105
  ) -> None:
@@ -110,7 +110,7 @@ def test_Colors_xyz(
110
110
  :param expect: Expected output from the testing routine.
111
111
  """
112
112
 
113
- assert Colors(source).xyz == expect
113
+ assert Color(source).xyz == expect
114
114
 
115
115
 
116
116
 
@@ -127,7 +127,7 @@ def test_Colors_xyz(
127
127
  ('00ffff', (0.2247, 0.3287)),
128
128
  ('ff00ff', (0.3209, 0.1542)),
129
129
  ('800080', (0.3209, 0.1542))])
130
- def test_Colors_xy(
130
+ def test_Color_xy(
131
131
  source: str,
132
132
  expect: tuple[int, ...],
133
133
  ) -> None:
@@ -138,7 +138,7 @@ def test_Colors_xy(
138
138
  :param expect: Expected output from the testing routine.
139
139
  """
140
140
 
141
- assert Colors(source).xy == expect
141
+ assert Color(source).xy == expect
142
142
 
143
143
 
144
144
 
@@ -155,7 +155,7 @@ def test_Colors_xy(
155
155
  ('00ffff', (180, 100, 50)),
156
156
  ('ff00ff', (300, 100, 50)),
157
157
  ('800080', (300, 100, 25))])
158
- def test_Colors_hsl(
158
+ def test_Color_hsl(
159
159
  source: str,
160
160
  expect: tuple[int, ...],
161
161
  ) -> None:
@@ -166,17 +166,17 @@ def test_Colors_hsl(
166
166
  :param expect: Expected output from the testing routine.
167
167
  """
168
168
 
169
- assert Colors(source).hsl == expect
169
+ assert Color(source).hsl == expect
170
170
 
171
171
 
172
172
 
173
- def test_Colors_cover() -> None:
173
+ def test_Color_cover() -> None:
174
174
  """
175
175
  Perform various tests associated with relevant routines.
176
176
  """
177
177
 
178
- color1 = Colors('000001')
179
- color2 = Colors('#000001')
178
+ color1 = Color('000001')
179
+ color2 = Color('#000001')
180
180
 
181
181
  assert not (color1 > None) # type: ignore
182
182
  assert not (color1 >= None) # type: ignore
encommon/config/config.py CHANGED
@@ -8,7 +8,6 @@ is permitted, for more information consult the project license file.
8
8
 
9
9
 
10
10
  from copy import deepcopy
11
- from typing import Any
12
11
  from typing import Callable
13
12
  from typing import Optional
14
13
  from typing import TYPE_CHECKING
@@ -19,6 +18,7 @@ from .params import Params
19
18
  from .paths import ConfigPaths
20
19
  from .utils import config_paths
21
20
  from ..crypts import Crypts
21
+ from ..types import DictStrAny
22
22
  from ..types import merge_dicts
23
23
  from ..types import setate
24
24
 
@@ -55,8 +55,8 @@ class Config:
55
55
 
56
56
  __files: ConfigFiles
57
57
  __paths: ConfigPaths
58
- __cargs: dict[str, Any]
59
- __sargs: dict[str, Any]
58
+ __cargs: DictStrAny
59
+ __sargs: DictStrAny
60
60
 
61
61
  __model: Callable # type: ignore
62
62
 
@@ -70,8 +70,8 @@ class Config:
70
70
  files: Optional['PATHABLE'] = None,
71
71
  *,
72
72
  paths: Optional['PATHABLE'] = None,
73
- cargs: Optional[dict[str, Any]] = None,
74
- sargs: Optional[dict[str, Any]] = None,
73
+ cargs: Optional[DictStrAny] = None,
74
+ sargs: Optional[DictStrAny] = None,
75
75
  model: Optional[Callable] = None, # type: ignore
76
76
  ) -> None:
77
77
  """
@@ -133,14 +133,14 @@ class Config:
133
133
  @property
134
134
  def cargs(
135
135
  self,
136
- ) -> dict[str, Any]:
136
+ ) -> DictStrAny:
137
137
  """
138
138
  Return the value for the attribute from class instance.
139
139
 
140
140
  :returns: Value for the attribute from class instance.
141
141
  """
142
142
 
143
- returned: dict[str, Any] = {}
143
+ returned: DictStrAny = {}
144
144
 
145
145
  cargs = deepcopy(self.__cargs)
146
146
 
@@ -155,14 +155,14 @@ class Config:
155
155
  @property
156
156
  def sargs(
157
157
  self,
158
- ) -> dict[str, Any]:
158
+ ) -> DictStrAny:
159
159
  """
160
160
  Return the value for the attribute from class instance.
161
161
 
162
162
  :returns: Value for the attribute from class instance.
163
163
  """
164
164
 
165
- returned: dict[str, Any] = {}
165
+ returned: DictStrAny = {}
166
166
 
167
167
  sargs = deepcopy(self.__sargs)
168
168
 
@@ -174,23 +174,10 @@ class Config:
174
174
  return deepcopy(returned)
175
175
 
176
176
 
177
- @property
178
- def config(
179
- self,
180
- ) -> dict[str, Any]:
181
- """
182
- Return the configuration dumped from the Pydantic model.
183
-
184
- :returns: Configuration dumped from the Pydantic model.
185
- """
186
-
187
- return self.params.model_dump()
188
-
189
-
190
177
  @property
191
178
  def basic(
192
179
  self,
193
- ) -> dict[str, Any]:
180
+ ) -> DictStrAny:
194
181
  """
195
182
  Return the configuration source loaded from the objects.
196
183
 
@@ -199,7 +186,7 @@ class Config:
199
186
 
200
187
  files = self.files
201
188
 
202
- ferged = files.merged
189
+ ferged = files.merge
203
190
 
204
191
  merge_dicts(
205
192
  dict1=ferged,
@@ -212,7 +199,7 @@ class Config:
212
199
  @property
213
200
  def merge(
214
201
  self,
215
- ) -> dict[str, Any]:
202
+ ) -> DictStrAny:
216
203
  """
217
204
  Return the configuration source loaded from the objects.
218
205
 
@@ -222,8 +209,8 @@ class Config:
222
209
  files = self.files
223
210
  paths = self.paths
224
211
 
225
- ferged = files.merged
226
- perged = paths.merged
212
+ ferged = files.merge
213
+ perged = paths.merge
227
214
 
228
215
  merge_dicts(
229
216
  dict1=ferged,
@@ -278,6 +265,19 @@ class Config:
278
265
  return self.__params
279
266
 
280
267
 
268
+ @property
269
+ def config(
270
+ self,
271
+ ) -> DictStrAny:
272
+ """
273
+ Return the configuration dumped from the Pydantic model.
274
+
275
+ :returns: Configuration dumped from the Pydantic model.
276
+ """
277
+
278
+ return self.params.endumped
279
+
280
+
281
281
  @property
282
282
  def logger(
283
283
  self,
encommon/config/files.py CHANGED
@@ -9,13 +9,13 @@ is permitted, for more information consult the project license file.
9
9
 
10
10
  from copy import deepcopy
11
11
  from pathlib import Path
12
- from typing import Any
13
12
  from typing import Optional
14
13
  from typing import TYPE_CHECKING
15
14
 
16
15
  from .utils import config_load
17
16
  from .utils import config_path
18
17
  from .utils import config_paths
18
+ from ..types import DictStrAny
19
19
  from ..types import merge_dicts
20
20
  from ..types import sort_dict
21
21
 
@@ -32,7 +32,7 @@ class ConfigFile:
32
32
  """
33
33
 
34
34
  path: Path
35
- config: dict[str, Any]
35
+ config: DictStrAny
36
36
 
37
37
 
38
38
  def __init__(
@@ -62,7 +62,7 @@ class ConfigFiles:
62
62
  paths: tuple[Path, ...]
63
63
  config: dict[str, ConfigFile]
64
64
 
65
- __merged: Optional[dict[str, Any]]
65
+ __merge: Optional[DictStrAny]
66
66
 
67
67
 
68
68
  def __init__(
@@ -80,13 +80,13 @@ class ConfigFiles:
80
80
  str(x): ConfigFile(x)
81
81
  for x in self.paths}
82
82
 
83
- self.__merged = None
83
+ self.__merge = None
84
84
 
85
85
 
86
86
  @property
87
- def merged(
87
+ def merge(
88
88
  self,
89
- ) -> dict[str, Any]:
89
+ ) -> DictStrAny:
90
90
  """
91
91
  Return the configuration in dictionary format for files.
92
92
 
@@ -94,12 +94,12 @@ class ConfigFiles:
94
94
  """
95
95
 
96
96
  config = self.config
97
- merged = self.__merged
97
+ merge = self.__merge
98
98
 
99
- if merged is not None:
100
- return deepcopy(merged)
99
+ if merge is not None:
100
+ return deepcopy(merge)
101
101
 
102
- merged = {}
102
+ merge = {}
103
103
 
104
104
 
105
105
  for file in config.values():
@@ -107,13 +107,13 @@ class ConfigFiles:
107
107
  source = file.config
108
108
 
109
109
  merge_dicts(
110
- dict1=merged,
110
+ dict1=merge,
111
111
  dict2=deepcopy(source),
112
112
  force=False)
113
113
 
114
114
 
115
- merged = sort_dict(merged)
115
+ merge = sort_dict(merge)
116
116
 
117
- self.__merged = merged
117
+ self.__merge = merge
118
118
 
119
- return deepcopy(merged)
119
+ return deepcopy(merge)
encommon/config/logger.py CHANGED
@@ -28,7 +28,7 @@ from typing import Optional
28
28
  from typing import TYPE_CHECKING
29
29
 
30
30
  from .utils import config_path
31
- from ..times import Times
31
+ from ..times import Time
32
32
  from ..types import Empty
33
33
  from ..types.strings import COMMAD
34
34
  from ..types.strings import COMMAS
@@ -83,7 +83,7 @@ class Message:
83
83
  """
84
84
 
85
85
  __level: LOGLEVELS
86
- __time: Times
86
+ __time: Time
87
87
  __fields: dict[str, str] = {}
88
88
 
89
89
 
@@ -98,7 +98,7 @@ class Message:
98
98
  """
99
99
 
100
100
  self.__level = level
101
- self.__time = Times(time)
101
+ self.__time = Time(time)
102
102
  self.__fields = {}
103
103
 
104
104
  items = kwargs.items()
@@ -122,7 +122,7 @@ class Message:
122
122
  value = COMMAD.join(values)
123
123
 
124
124
 
125
- if (isinstance(value, Times)
125
+ if (isinstance(value, Time)
126
126
  and key == 'elapsed'):
127
127
  value = value.since
128
128
 
@@ -188,14 +188,14 @@ class Message:
188
188
  @property
189
189
  def time(
190
190
  self,
191
- ) -> Times:
191
+ ) -> Time:
192
192
  """
193
193
  Return the value for the attribute from class instance.
194
194
 
195
195
  :returns: Value for the attribute from class instance.
196
196
  """
197
197
 
198
- return Times(self.__time)
198
+ return Time(self.__time)
199
199
 
200
200
 
201
201
  @property
@@ -329,7 +329,7 @@ class Logger:
329
329
  :param stdo_level: Minimum level for the message to pass.
330
330
  :param file_level: Minimum level for the message to pass.
331
331
  :param file_path: Enables writing to the filesystem path.
332
- :param params: Parameters for instantiating the instance.
332
+ :param params: Parameters used to instantiate the class.
333
333
  """
334
334
 
335
335
  __params: 'LoggerParams'
encommon/config/params.py CHANGED
@@ -8,8 +8,12 @@ is permitted, for more information consult the project license file.
8
8
 
9
9
 
10
10
  from pathlib import Path
11
+ from typing import Annotated
12
+ from typing import Any
11
13
  from typing import Optional
12
14
 
15
+ from pydantic import Field
16
+
13
17
  from .logger import LOGLEVELS
14
18
  from ..crypts import CryptsParams
15
19
  from ..types import BaseModel
@@ -19,61 +23,74 @@ from ..types import BaseModel
19
23
  class ConfigParams(BaseModel, extra='forbid'):
20
24
  """
21
25
  Process and validate the core configuration parameters.
22
-
23
- :param paths: Complete or relative path to config paths.
24
- :param data: Keyword arguments passed to Pydantic model.
25
- Parameter is picked up by autodoc, please ignore.
26
26
  """
27
27
 
28
- paths: Optional[list[str]] = None
28
+ paths: Annotated[
29
+ Optional[list[str]],
30
+ Field(None,
31
+ description='Location of configuration files',
32
+ min_length=1)]
29
33
 
30
34
 
31
35
 
32
36
  class LoggerParams(BaseModel, extra='forbid'):
33
37
  """
34
38
  Process and validate the core configuration parameters.
35
-
36
- :param stdo_level: Minimum level for the message to pass.
37
- :param file_level: Minimum level for the message to pass.
38
- :param file_path: Enables writing to the filesystem path.
39
39
  """
40
40
 
41
- stdo_level: Optional[LOGLEVELS] = None
42
- file_level: Optional[LOGLEVELS] = None
43
- file_path: Optional[str] = None
41
+ stdo_level: Annotated[
42
+ Optional[LOGLEVELS],
43
+ Field(None,
44
+ description='Minimum logging message level',
45
+ min_length=1)]
46
+
47
+ file_level: Annotated[
48
+ Optional[LOGLEVELS],
49
+ Field(None,
50
+ description='Minimum logging message level',
51
+ min_length=1)]
52
+
53
+ file_path: Annotated[
54
+ Optional[str],
55
+ Field(None,
56
+ description='Enable output to the log file',
57
+ min_length=1)]
44
58
 
45
59
 
46
60
  def __init__(
47
61
  self,
48
- stdo_level: Optional[LOGLEVELS] = None,
49
- file_level: Optional[LOGLEVELS] = None,
50
- file_path: Optional[str | Path] = None,
62
+ /,
63
+ **data: Any,
51
64
  ) -> None:
52
65
  """
53
66
  Initialize instance for class using provided parameters.
54
67
  """
55
68
 
56
- if file_path is not None:
57
- file_path = str(file_path)
69
+ file_path = data.get('file_path')
58
70
 
59
- super().__init__(
60
- stdo_level=stdo_level,
61
- file_level=file_level,
62
- file_path=file_path)
71
+ if isinstance(file_path, Path):
72
+ data['file_path'] = str(file_path)
73
+
74
+ super().__init__(**data)
63
75
 
64
76
 
65
77
 
66
78
  class Params(BaseModel, extra='forbid'):
67
79
  """
68
80
  Process and validate the core configuration parameters.
69
-
70
- :param enconfig: Configuration for the Config instance.
71
- :param enlogger: Configuration for the Logger instance.
72
- :param encrypts: Configuration for the Crypts instance.
73
- :param data: Keyword arguments passed to Pydantic model.
74
- Parameter is picked up by autodoc, please ignore.
75
81
  """
76
82
 
77
- enconfig: Optional[ConfigParams] = None
78
- enlogger: Optional[LoggerParams] = None
79
- encrypts: Optional[CryptsParams] = None
83
+ enconfig: Annotated[
84
+ Optional[ConfigParams],
85
+ Field(None,
86
+ description='Parameters for Config instance')]
87
+
88
+ enlogger: Annotated[
89
+ Optional[LoggerParams],
90
+ Field(None,
91
+ description='Parameters for Logger instance')]
92
+
93
+ encrypts: Annotated[
94
+ Optional[CryptsParams],
95
+ Field(None,
96
+ description='Parameters for Crypts instance')]