python-table-processor 0.3.6__py3-none-any.whl → 0.3.8__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.6.dist-info → python_table_processor-0.3.8.dist-info}/METADATA +1 -1
- {python_table_processor-0.3.6.dist-info → python_table_processor-0.3.8.dist-info}/RECORD +9 -9
- table_processor/__init__.py +2 -2
- table_processor/core/actions.py +5 -5
- table_processor/core/functions/set_nested_field_value.py +21 -4
- table_processor/core/merge.py +1 -3
- {python_table_processor-0.3.6.dist-info → python_table_processor-0.3.8.dist-info}/LICENSE +0 -0
- {python_table_processor-0.3.6.dist-info → python_table_processor-0.3.8.dist-info}/WHEEL +0 -0
- {python_table_processor-0.3.6.dist-info → python_table_processor-0.3.8.dist-info}/entry_points.txt +0 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
table_processor/__init__.py,sha256=
|
|
1
|
+
table_processor/__init__.py,sha256=2aCcYBh8v0QBhm77EG8Rb7HSYaY18N0gWeE08uXri3o,52
|
|
2
2
|
table_processor/cli.py,sha256=uluf_VsBzq3Ldxh3ePGseSrv8--lI7huu-6RjDaHPPg,2170
|
|
3
3
|
table_processor/commands/convert_tables.py,sha256=w4IZftSlrbt-BMPjldULT_616LSiNE3h7GmrFF7K5OM,2276
|
|
4
4
|
table_processor/commands/merge_tables.py,sha256=jryGU3gUx2TlGrI6FozGS_aJQvJQFco2LKwun6Uo9KY,1719
|
|
5
|
-
table_processor/core/actions.py,sha256=
|
|
5
|
+
table_processor/core/actions.py,sha256=BNXf9iptGl9xV2itNK4bVx1jjVHCiRgTIFlZyULe6Dc,23695
|
|
6
6
|
table_processor/core/config.py,sha256=Z1s2r3y4oQXdbDCwIY_hYzoq6VRv7Sb3oUlfBCu13Lc,11646
|
|
7
7
|
table_processor/core/constants.py,sha256=w-1TxtpXywb6Qh8M4YWuzcCHUvCjy5zJYxaXC3RQS6A,158
|
|
8
8
|
table_processor/core/convert.py,sha256=dzGcpBwJ5omiE8Pw-VmHnGoOqDyh1Rip6BiLdvdf3V8,11561
|
|
@@ -12,12 +12,12 @@ table_processor/core/functions/get_nested_field_value.py,sha256=ZEJi8XtDONoYmhPo
|
|
|
12
12
|
table_processor/core/functions/nest_row.py,sha256=b5AKfxE39g-NOLranQRy0dfTZq-27Or8ZlgCB8N5kFs,640
|
|
13
13
|
table_processor/core/functions/search_column_value.py,sha256=GscwLaMTORHFDhdCdjzdoy46UGyFHrGwDQA2b_tZhsQ,740
|
|
14
14
|
table_processor/core/functions/set_flat_field_value.py,sha256=7-BgD2yEUGyBaFaIJ18bYv82Qdy0CN8NiC5ZtsAdv44,531
|
|
15
|
-
table_processor/core/functions/set_nested_field_value.py,sha256=
|
|
15
|
+
table_processor/core/functions/set_nested_field_value.py,sha256=351AoyL8-dT9I4eBKYlxUME03ACiMjDukebzmhOBaks,1308
|
|
16
16
|
table_processor/core/functions/set_row_value.py,sha256=wlF_nVGZY74XCzd6pBJJyti62m6y0s1kc5Q6uq9jn8o,641
|
|
17
|
-
table_processor/core/merge.py,sha256=
|
|
17
|
+
table_processor/core/merge.py,sha256=5U6fvofaMq6yvllB24M6Pf3uG7Hz17aLKM47NmWHJBc,5027
|
|
18
18
|
table_processor/core/types.py,sha256=xNvy1vL1ei87kt-MgSfRJSllYrNKRo23pHtJA15DyLQ,2895
|
|
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.
|
|
19
|
+
python_table_processor-0.3.8.dist-info/LICENSE,sha256=1_Gn0I1neLPxDLfLiHEyxjDg-pbAra1p2iHEqutGS_c,1068
|
|
20
|
+
python_table_processor-0.3.8.dist-info/METADATA,sha256=JbejFTK1nVvFUQuI4XfO9ei02fdigXsBujLnQNAKges,1098
|
|
21
|
+
python_table_processor-0.3.8.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
|
22
|
+
python_table_processor-0.3.8.dist-info/entry_points.txt,sha256=lq97F6m51yZ93qmVIqkUHJfbILZuYLxrMWXSqrP4JpM,118
|
|
23
|
+
python_table_processor-0.3.8.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.8"
|
|
2
|
+
__version_tuple__ = (0, 3, 8)
|
table_processor/core/actions.py
CHANGED
|
@@ -486,9 +486,9 @@ def search_with_operator(
|
|
|
486
486
|
row: Row,
|
|
487
487
|
source: str,
|
|
488
488
|
):
|
|
489
|
-
or_operator = '
|
|
490
|
-
null_or_operator = '
|
|
491
|
-
operator_group = f'{or_operator}|{null_or_operator}'
|
|
489
|
+
or_operator = '||'
|
|
490
|
+
null_or_operator = '??'
|
|
491
|
+
operator_group = f'{re.escape(or_operator)}|{re.escape(null_or_operator)}'
|
|
492
492
|
matched = re.split(f'({operator_group})', source, 1)
|
|
493
493
|
#ic(source, matched)
|
|
494
494
|
if len(matched) == 1:
|
|
@@ -496,10 +496,10 @@ def search_with_operator(
|
|
|
496
496
|
matched = map(str.strip, matched)
|
|
497
497
|
left, operator, rest = matched
|
|
498
498
|
value, found = search_column_value(row.nested, left)
|
|
499
|
-
if operator ==
|
|
499
|
+
if operator == or_operator:
|
|
500
500
|
if bool(value):
|
|
501
501
|
return value, found
|
|
502
|
-
if operator ==
|
|
502
|
+
if operator == null_or_operator:
|
|
503
503
|
if found and value is not None:
|
|
504
504
|
return value, found
|
|
505
505
|
return search_with_operator(row, rest)
|
|
@@ -6,19 +6,36 @@ from collections import OrderedDict
|
|
|
6
6
|
from icecream import ic
|
|
7
7
|
|
|
8
8
|
def set_nested_field_value(
|
|
9
|
-
data: OrderedDict,
|
|
9
|
+
data: OrderedDict | list,
|
|
10
10
|
field: str,
|
|
11
11
|
value: any,
|
|
12
12
|
):
|
|
13
13
|
if isinstance(field, str) and '.' in field:
|
|
14
14
|
field, rest = field.split('.', 1)
|
|
15
|
-
|
|
15
|
+
if isinstance(data, dict):
|
|
16
|
+
sub_data = data.get(field)
|
|
17
|
+
elif isinstance(data, list):
|
|
18
|
+
field = int(field)
|
|
19
|
+
if field < len(data):
|
|
20
|
+
sub_data = data[field]
|
|
21
|
+
else:
|
|
22
|
+
sub_data = None
|
|
16
23
|
if not isinstance(sub_data, dict):
|
|
17
|
-
|
|
24
|
+
do_create_dict = True
|
|
25
|
+
if isinstance(sub_data, list):
|
|
26
|
+
# NOTE: 続くフィールド文字列が数字の場合は、リストの要素として扱う
|
|
27
|
+
field2 = rest.split('.', 1)[0]
|
|
28
|
+
if field2.isdigit():
|
|
29
|
+
do_create_dict = False
|
|
30
|
+
if do_create_dict:
|
|
31
|
+
data[field] = OrderedDict()
|
|
18
32
|
set_nested_field_value(data[field], rest, value)
|
|
19
33
|
else:
|
|
20
34
|
try:
|
|
21
|
-
data
|
|
35
|
+
if isinstance(data, dict):
|
|
36
|
+
data[field] = value
|
|
37
|
+
elif isinstance(data, list):
|
|
38
|
+
data[int(field)] = value
|
|
22
39
|
except:
|
|
23
40
|
ic(data, field, value)
|
|
24
41
|
raise
|
table_processor/core/merge.py
CHANGED
|
@@ -85,7 +85,7 @@ def merge(
|
|
|
85
85
|
if not allow_duplicate_keys:
|
|
86
86
|
if primary_key in dict_key_to_row:
|
|
87
87
|
ic(index)
|
|
88
|
-
raise ValueError(f'Duplicate key: {
|
|
88
|
+
raise ValueError(f'Duplicate key: {primary_key}')
|
|
89
89
|
dict_key_to_row[primary_key] = row
|
|
90
90
|
all_base_rows.append(row)
|
|
91
91
|
for modification_file in modification_files:
|
|
@@ -134,8 +134,6 @@ def merge(
|
|
|
134
134
|
#ic(key)
|
|
135
135
|
#ic(key, value)
|
|
136
136
|
set_row_value(previous_row, key, value)
|
|
137
|
-
#set_row_value(previous_row, '指示追従性?', 'test')
|
|
138
|
-
#set_row_value(previous_row, 'modified', True)
|
|
139
137
|
#ic(previous_row)
|
|
140
138
|
#ic(previous_row.flat)
|
|
141
139
|
#raise
|
|
File without changes
|
|
File without changes
|
{python_table_processor-0.3.6.dist-info → python_table_processor-0.3.8.dist-info}/entry_points.txt
RENAMED
|
File without changes
|