python-table-converter 0.2.1__tar.gz → 0.2.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.
- {python_table_converter-0.2.1 → python_table_converter-0.2.2}/PKG-INFO +1 -1
- {python_table_converter-0.2.1 → python_table_converter-0.2.2}/pyproject.toml +1 -1
- python_table_converter-0.2.2/table_converter/__init__.py +2 -0
- {python_table_converter-0.2.1 → python_table_converter-0.2.2}/table_converter/core/config.py +14 -3
- {python_table_converter-0.2.1 → python_table_converter-0.2.2}/table_converter/core/convert.py +15 -9
- python_table_converter-0.2.1/table_converter/__init__.py +0 -2
- {python_table_converter-0.2.1 → python_table_converter-0.2.2}/LICENSE +0 -0
- {python_table_converter-0.2.1 → python_table_converter-0.2.2}/README.md +0 -0
- {python_table_converter-0.2.1 → python_table_converter-0.2.2}/table_converter/cli.py +0 -0
- {python_table_converter-0.2.1 → python_table_converter-0.2.2}/table_converter/commands/convert_tables.py +0 -0
{python_table_converter-0.2.1 → python_table_converter-0.2.2}/table_converter/core/config.py
RENAMED
|
@@ -12,8 +12,12 @@ type FieldMap = Mapping[str, str|FieldMap]
|
|
|
12
12
|
|
|
13
13
|
@dataclasses.dataclass
|
|
14
14
|
class ProcessConfig:
|
|
15
|
+
assign_constants: FlatFieldMap = dataclasses.field(default_factory=OrderedDict)
|
|
15
16
|
split_by_newline: FlatFieldMap = dataclasses.field(default_factory=OrderedDict)
|
|
16
17
|
|
|
18
|
+
def __setitem__(self, key, value):
|
|
19
|
+
setattr(self, key, value)
|
|
20
|
+
|
|
17
21
|
@dataclasses.dataclass
|
|
18
22
|
class Config:
|
|
19
23
|
map: FieldMap = dataclasses.field(default_factory=OrderedDict)
|
|
@@ -53,7 +57,14 @@ def setup_config(
|
|
|
53
57
|
ic(loaded)
|
|
54
58
|
if 'map' in loaded:
|
|
55
59
|
config.map = flatten(loaded['map'])
|
|
56
|
-
if 'process' in loaded:
|
|
57
|
-
|
|
58
|
-
|
|
60
|
+
#if 'process' in loaded:
|
|
61
|
+
dict_process = loaded.get('process')
|
|
62
|
+
if isinstance(dict_process, Mapping):
|
|
63
|
+
for process_key in [
|
|
64
|
+
'assign_constants',
|
|
65
|
+
'split_by_newline',
|
|
66
|
+
]:
|
|
67
|
+
dict_subprocess = dict_process.get(process_key)
|
|
68
|
+
if isinstance(dict_subprocess, Mapping):
|
|
69
|
+
config.process[process_key] = flatten(loaded['process'][process_key])
|
|
59
70
|
return config
|
{python_table_converter-0.2.1 → python_table_converter-0.2.2}/table_converter/core/convert.py
RENAMED
|
@@ -147,15 +147,21 @@ def map_formats(
|
|
|
147
147
|
new_row = OrderedDict(row)
|
|
148
148
|
for column in dict_formats.keys():
|
|
149
149
|
template = dict_formats[column]
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
150
|
+
params = {}
|
|
151
|
+
params.update(row['__debug__'])
|
|
152
|
+
params.update(row)
|
|
153
|
+
formatted = None
|
|
154
|
+
while formatted is None:
|
|
155
|
+
try:
|
|
156
|
+
formatted = template.format(**params)
|
|
157
|
+
except KeyError as e:
|
|
158
|
+
#ic(e)
|
|
159
|
+
#ic(e.args)
|
|
160
|
+
#ic(e.args[0])
|
|
161
|
+
key = e.args[0]
|
|
162
|
+
params[key] = '__undefined__'
|
|
163
|
+
except:
|
|
164
|
+
raise
|
|
159
165
|
set_field_value(new_row, f'__debug__.{column}', formatted)
|
|
160
166
|
return new_row
|
|
161
167
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|