python-table-processor 0.3.6__py3-none-any.whl → 0.3.7__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.7.dist-info}/METADATA +1 -1
- {python_table_processor-0.3.6.dist-info → python_table_processor-0.3.7.dist-info}/RECORD +8 -8
- table_processor/__init__.py +2 -2
- 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.7.dist-info}/LICENSE +0 -0
- {python_table_processor-0.3.6.dist-info → python_table_processor-0.3.7.dist-info}/WHEEL +0 -0
- {python_table_processor-0.3.6.dist-info → python_table_processor-0.3.7.dist-info}/entry_points.txt +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
table_processor/__init__.py,sha256=
|
|
1
|
+
table_processor/__init__.py,sha256=voNuwez5LsM9NyDZcQEcA5N7Cg-32xrD7xSIGlYyf6U,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
|
|
@@ -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.7.dist-info/LICENSE,sha256=1_Gn0I1neLPxDLfLiHEyxjDg-pbAra1p2iHEqutGS_c,1068
|
|
20
|
+
python_table_processor-0.3.7.dist-info/METADATA,sha256=GTh1Nm6ViWpYlbeO36ncPeJDe35Q8jrClH-xnhEPoRs,1098
|
|
21
|
+
python_table_processor-0.3.7.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
|
22
|
+
python_table_processor-0.3.7.dist-info/entry_points.txt,sha256=lq97F6m51yZ93qmVIqkUHJfbILZuYLxrMWXSqrP4JpM,118
|
|
23
|
+
python_table_processor-0.3.7.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.7"
|
|
2
|
+
__version_tuple__ = (0, 3, 7)
|
|
@@ -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.7.dist-info}/entry_points.txt
RENAMED
|
File without changes
|