power-grid-model-io 1.2.60__py3-none-any.whl → 1.2.61__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.
Potentially problematic release.
This version of power-grid-model-io might be problematic. Click here for more details.
- power_grid_model_io/converters/base_converter.py +29 -2
- {power_grid_model_io-1.2.60.dist-info → power_grid_model_io-1.2.61.dist-info}/METADATA +1 -1
- {power_grid_model_io-1.2.60.dist-info → power_grid_model_io-1.2.61.dist-info}/RECORD +6 -6
- {power_grid_model_io-1.2.60.dist-info → power_grid_model_io-1.2.61.dist-info}/LICENSE +0 -0
- {power_grid_model_io-1.2.60.dist-info → power_grid_model_io-1.2.61.dist-info}/WHEEL +0 -0
- {power_grid_model_io-1.2.60.dist-info → power_grid_model_io-1.2.61.dist-info}/top_level.txt +0 -0
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
"""
|
|
5
5
|
Abstract converter class
|
|
6
6
|
"""
|
|
7
|
+
import logging
|
|
7
8
|
from abc import ABC, abstractmethod
|
|
8
9
|
from typing import Generic, Optional, Tuple, TypeVar
|
|
9
10
|
|
|
@@ -20,11 +21,18 @@ T = TypeVar("T")
|
|
|
20
21
|
class BaseConverter(Generic[T], ABC):
|
|
21
22
|
"""Abstract converter class"""
|
|
22
23
|
|
|
23
|
-
def __init__(
|
|
24
|
+
def __init__(
|
|
25
|
+
self,
|
|
26
|
+
source: Optional[BaseDataStore[T]] = None,
|
|
27
|
+
destination: Optional[BaseDataStore[T]] = None,
|
|
28
|
+
log_level: int = logging.DEBUG,
|
|
29
|
+
):
|
|
24
30
|
"""
|
|
25
31
|
Initialize a logger
|
|
26
32
|
"""
|
|
27
|
-
self.
|
|
33
|
+
self._logger = logging.getLogger(type(self).__name__)
|
|
34
|
+
self._logger.setLevel(log_level)
|
|
35
|
+
self._log = structlog.wrap_logger(self._logger, wrapper_class=structlog.make_filtering_bound_logger(log_level))
|
|
28
36
|
self._source = source
|
|
29
37
|
self._destination = destination
|
|
30
38
|
self._auto_id = AutoID()
|
|
@@ -146,6 +154,25 @@ class BaseConverter(Generic[T], ABC):
|
|
|
146
154
|
else:
|
|
147
155
|
raise ValueError("No destination supplied!")
|
|
148
156
|
|
|
157
|
+
def set_log_level(self, log_level: int) -> None:
|
|
158
|
+
"""
|
|
159
|
+
Set the log level
|
|
160
|
+
|
|
161
|
+
Args:
|
|
162
|
+
log_level: int:
|
|
163
|
+
"""
|
|
164
|
+
self._logger.setLevel(log_level)
|
|
165
|
+
self._log = structlog.wrap_logger(self._logger, wrapper_class=structlog.make_filtering_bound_logger(log_level))
|
|
166
|
+
|
|
167
|
+
def get_log_level(self) -> int:
|
|
168
|
+
"""
|
|
169
|
+
Get the log level
|
|
170
|
+
|
|
171
|
+
Returns:
|
|
172
|
+
int:
|
|
173
|
+
"""
|
|
174
|
+
return self._logger.getEffectiveLevel()
|
|
175
|
+
|
|
149
176
|
def _load_data(self, data: Optional[T]) -> T:
|
|
150
177
|
if data is not None:
|
|
151
178
|
return data
|
|
@@ -6,7 +6,7 @@ power_grid_model_io/config/excel/__init__.py,sha256=qwbj1j-Aa_yRB-E3j35pEVtF3mgH
|
|
|
6
6
|
power_grid_model_io/config/excel/vision_en.yaml,sha256=a6BtSeMzGumsUSoDqzZHyx2cpv0P0X32c9FrsD1Y_nE,19018
|
|
7
7
|
power_grid_model_io/config/excel/vision_nl.yaml,sha256=ps-vKUvYcIev7fxx5rIQqHe1ukP_WjHZvqF3AcLswd8,19226
|
|
8
8
|
power_grid_model_io/converters/__init__.py,sha256=kmbjFW6kVr30fmHb6mAoD7DQAqmbrsOuF1ewd8b0Q3M,408
|
|
9
|
-
power_grid_model_io/converters/base_converter.py,sha256=
|
|
9
|
+
power_grid_model_io/converters/base_converter.py,sha256=LNrDo1kUUuBkLMgZpGm0MW5rfr8nLoFcGCJGRR7ZuiY,6044
|
|
10
10
|
power_grid_model_io/converters/pandapower_converter.py,sha256=05iNHqqVFphXRNsNE7aumkZGybY_-FOj1S8S1UhQo64,113429
|
|
11
11
|
power_grid_model_io/converters/pgm_json_converter.py,sha256=KKZEBLVW1hsS2YjOsUO6EBrXhvwPVl9VhkUNEw-3gWk,13066
|
|
12
12
|
power_grid_model_io/converters/tabular_converter.py,sha256=hMb0pmnlq83GJEfOqr3K7XXsSiA_SYyQKHW1i6F5FSY,30577
|
|
@@ -37,8 +37,8 @@ power_grid_model_io/utils/json.py,sha256=dQDRd2Vb8pfqLU2hTuWYv2cpSIBBbFhd0LOBP21
|
|
|
37
37
|
power_grid_model_io/utils/modules.py,sha256=a4IdozSL-sOZcmIQON_aQS7-cpnCyt-3p7zs40wRFkU,928
|
|
38
38
|
power_grid_model_io/utils/parsing.py,sha256=XB1QSHnslIieFJBKFXZCtiydqpOqQBiX_CXDbItXgAQ,4522
|
|
39
39
|
power_grid_model_io/utils/zip.py,sha256=VXHX4xWPPZbhOlZUAbMDy3MgQFzK6_l7sRvGXihNUY4,3875
|
|
40
|
-
power_grid_model_io-1.2.
|
|
41
|
-
power_grid_model_io-1.2.
|
|
42
|
-
power_grid_model_io-1.2.
|
|
43
|
-
power_grid_model_io-1.2.
|
|
44
|
-
power_grid_model_io-1.2.
|
|
40
|
+
power_grid_model_io-1.2.61.dist-info/LICENSE,sha256=7Pm2fWFFHHUG5lDHed1vl5CjzxObIXQglnYsEdtjo_k,14907
|
|
41
|
+
power_grid_model_io-1.2.61.dist-info/METADATA,sha256=3fcWtMKfN3r8A6_XCKkywvGvkk2Q99bnWPoWtgpvgtc,8000
|
|
42
|
+
power_grid_model_io-1.2.61.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
|
|
43
|
+
power_grid_model_io-1.2.61.dist-info/top_level.txt,sha256=7sq9VveemMm2R0RgTBa4tH8y_xF4_1hxbufmX9OjCTo,20
|
|
44
|
+
power_grid_model_io-1.2.61.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|