python-table-processor 0.3.1__py3-none-any.whl → 0.3.2__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.
- {python_table_processor-0.3.1.dist-info → python_table_processor-0.3.2.dist-info}/METADATA +1 -1
- {python_table_processor-0.3.1.dist-info → python_table_processor-0.3.2.dist-info}/RECORD +10 -10
- table_processor/__init__.py +2 -2
- table_processor/core/actions.py +18 -0
- table_processor/core/config.py +0 -1
- table_processor/core/convert.py +0 -13
- table_processor/core/types.py +5 -0
- {python_table_processor-0.3.1.dist-info → python_table_processor-0.3.2.dist-info}/LICENSE +0 -0
- {python_table_processor-0.3.1.dist-info → python_table_processor-0.3.2.dist-info}/WHEEL +0 -0
- {python_table_processor-0.3.1.dist-info → python_table_processor-0.3.2.dist-info}/entry_points.txt +0 -0
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
table_processor/__init__.py,sha256=
|
|
1
|
+
table_processor/__init__.py,sha256=TQqqDugVb2WjmgqPXyxUA42oi3QOxyPDqpr09kjKGlk,52
|
|
2
2
|
table_processor/cli.py,sha256=uluf_VsBzq3Ldxh3ePGseSrv8--lI7huu-6RjDaHPPg,2170
|
|
3
3
|
table_processor/commands/convert_tables.py,sha256=j25KL0zRl5ikrBk73jAkKn4rPmDq7SecChZxecDpILQ,2123
|
|
4
4
|
table_processor/commands/merge_tables.py,sha256=Uu-hjfPh69Of0_OZrY8sY0oscpLSdK4jwJ_t1qgfPMg,1485
|
|
5
|
-
table_processor/core/actions.py,sha256=
|
|
6
|
-
table_processor/core/config.py,sha256=
|
|
5
|
+
table_processor/core/actions.py,sha256=iCBm-tj_gTxeHxPaBSILdYAe8-75XaDtsCOTJp1jGfA,20264
|
|
6
|
+
table_processor/core/config.py,sha256=Z1s2r3y4oQXdbDCwIY_hYzoq6VRv7Sb3oUlfBCu13Lc,11646
|
|
7
7
|
table_processor/core/constants.py,sha256=w-1TxtpXywb6Qh8M4YWuzcCHUvCjy5zJYxaXC3RQS6A,158
|
|
8
|
-
table_processor/core/convert.py,sha256=
|
|
8
|
+
table_processor/core/convert.py,sha256=cibzqJ5hHsfX_7qUz4kE2Gi-WH4UMqecBl3kSb4IVsY,11140
|
|
9
9
|
table_processor/core/functions/assign_id.py,sha256=dA-wgZA7E01gbx8qGvo1PeMd3aq9PhMdyITzr3BKXIE,4204
|
|
10
10
|
table_processor/core/functions/flatten_row.py,sha256=2l-s4YXgBM58IthpfVzd7L4EGUCekSi7ss5CaM_3MUU,686
|
|
11
11
|
table_processor/core/functions/get_nested_field_value.py,sha256=vF4pH6nxR3-2bDfAvrMfHcPFNiS4MnGkXL8FdcScdIw,685
|
|
@@ -15,9 +15,9 @@ table_processor/core/functions/set_flat_field_value.py,sha256=7-BgD2yEUGyBaFaIJ1
|
|
|
15
15
|
table_processor/core/functions/set_nested_field_value.py,sha256=csO0v_nW94q-M9bNL91xR-TLHPXDDxnLK8gN-0LLd6k,595
|
|
16
16
|
table_processor/core/functions/set_row_value.py,sha256=wlF_nVGZY74XCzd6pBJJyti62m6y0s1kc5Q6uq9jn8o,641
|
|
17
17
|
table_processor/core/merge.py,sha256=Yc5OV9n1xV9QtgY4srl6Susd5cOKbuYseEtYuBampDw,4672
|
|
18
|
-
table_processor/core/types.py,sha256=
|
|
19
|
-
python_table_processor-0.3.
|
|
20
|
-
python_table_processor-0.3.
|
|
21
|
-
python_table_processor-0.3.
|
|
22
|
-
python_table_processor-0.3.
|
|
23
|
-
python_table_processor-0.3.
|
|
18
|
+
table_processor/core/types.py,sha256=rxmiWsUCEBkjveO84tbMJ1kVn_P13Ywl89wDHMWEej0,2580
|
|
19
|
+
python_table_processor-0.3.2.dist-info/LICENSE,sha256=1_Gn0I1neLPxDLfLiHEyxjDg-pbAra1p2iHEqutGS_c,1068
|
|
20
|
+
python_table_processor-0.3.2.dist-info/METADATA,sha256=PCCGEqAansu5aIrmLu4eaFl3HhD2DCbDuDt2ru0-nRs,1098
|
|
21
|
+
python_table_processor-0.3.2.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
|
22
|
+
python_table_processor-0.3.2.dist-info/entry_points.txt,sha256=lq97F6m51yZ93qmVIqkUHJfbILZuYLxrMWXSqrP4JpM,118
|
|
23
|
+
python_table_processor-0.3.2.dist-info/RECORD,,
|
table_processor/__init__.py
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
__version__ = "0.3.
|
|
2
|
-
__version_tuple__ = (0, 3,
|
|
1
|
+
__version__ = "0.3.2"
|
|
2
|
+
__version_tuple__ = (0, 3, 2)
|
table_processor/core/actions.py
CHANGED
|
@@ -28,6 +28,7 @@ from . types import (
|
|
|
28
28
|
AssignConstantConfig,
|
|
29
29
|
AssignFormatConfig,
|
|
30
30
|
AssignIdConfig,
|
|
31
|
+
AssignLengthConfig,
|
|
31
32
|
FilterConfig,
|
|
32
33
|
GlobalStatus,
|
|
33
34
|
JoinConfig,
|
|
@@ -140,6 +141,12 @@ def setup_actions_with_args(
|
|
|
140
141
|
reverse = reverse,
|
|
141
142
|
))
|
|
142
143
|
continue
|
|
144
|
+
if action_name == 'assign-length':
|
|
145
|
+
config.actions.append(AssignLengthConfig(
|
|
146
|
+
target = target,
|
|
147
|
+
source = source,
|
|
148
|
+
))
|
|
149
|
+
continue
|
|
143
150
|
if action_name == 'filter-empty':
|
|
144
151
|
config.actions.append(FilterConfig(
|
|
145
152
|
field = target,
|
|
@@ -303,6 +310,8 @@ def do_action(
|
|
|
303
310
|
return assign_format(row, action)
|
|
304
311
|
if isinstance(action, AssignIdConfig):
|
|
305
312
|
return assign_id(status.id_context_map, row, action)
|
|
313
|
+
if isinstance(action, AssignLengthConfig):
|
|
314
|
+
return assign_length(row, action)
|
|
306
315
|
if isinstance(action, FilterConfig):
|
|
307
316
|
if filter_row(row, action):
|
|
308
317
|
return row
|
|
@@ -635,3 +644,12 @@ def push_field(
|
|
|
635
644
|
set_row_staging_value(row, config.target, array)
|
|
636
645
|
array.append(source_value)
|
|
637
646
|
return row
|
|
647
|
+
|
|
648
|
+
def assign_length(
|
|
649
|
+
row: Row,
|
|
650
|
+
config: AssignLengthConfig,
|
|
651
|
+
):
|
|
652
|
+
value, found = search_column_value(row.nested, config.source)
|
|
653
|
+
if found:
|
|
654
|
+
set_row_staging_value(row, config.target, len(value))
|
|
655
|
+
return row
|
table_processor/core/config.py
CHANGED
|
@@ -34,7 +34,6 @@ class AssignArrayConfig:
|
|
|
34
34
|
@dataclasses.dataclass
|
|
35
35
|
class ProcessConfig:
|
|
36
36
|
assign_array: Mapping[str, list[AssignArrayConfig]] = dataclasses.field(default_factory=OrderedDict)
|
|
37
|
-
assign_length: FlatFieldMap = dataclasses.field(default_factory=OrderedDict)
|
|
38
37
|
|
|
39
38
|
def __setitem__(self, key, value):
|
|
40
39
|
setattr(self, key, value)
|
table_processor/core/convert.py
CHANGED
|
@@ -263,17 +263,6 @@ def search_column_value_from_nested(
|
|
|
263
263
|
return None, False
|
|
264
264
|
|
|
265
265
|
|
|
266
|
-
def assign_length(
|
|
267
|
-
row: OrderedDict,
|
|
268
|
-
dict_fields: OrderedDict,
|
|
269
|
-
):
|
|
270
|
-
new_row = OrderedDict(row)
|
|
271
|
-
for key, field in dict_fields.items():
|
|
272
|
-
value, found = search_column_value(row, field)
|
|
273
|
-
if found:
|
|
274
|
-
new_row[f'{STAGING_FIELD}.{key}'] = len(value)
|
|
275
|
-
return new_row
|
|
276
|
-
|
|
277
266
|
def convert(
|
|
278
267
|
input_files: list[str],
|
|
279
268
|
output_file: str | None = None,
|
|
@@ -348,8 +337,6 @@ def convert(
|
|
|
348
337
|
set_row_staging_value(row, INPUT_FIELD, orig_row.nested)
|
|
349
338
|
if config.process.assign_array:
|
|
350
339
|
row.flat= assign_array(row.flat, config.process.assign_array)
|
|
351
|
-
if config.process.assign_length:
|
|
352
|
-
row.flat = assign_length(row.flat, config.process.assign_length)
|
|
353
340
|
if config.actions:
|
|
354
341
|
try:
|
|
355
342
|
new_row = do_actions(global_status, row, config.actions)
|
table_processor/core/types.py
CHANGED
|
File without changes
|
|
File without changes
|
{python_table_processor-0.3.1.dist-info → python_table_processor-0.3.2.dist-info}/entry_points.txt
RENAMED
|
File without changes
|