python-table-converter 0.2.15__tar.gz → 0.2.17__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.15 → python_table_converter-0.2.17}/PKG-INFO +1 -1
- {python_table_converter-0.2.15 → python_table_converter-0.2.17}/pyproject.toml +1 -1
- python_table_converter-0.2.17/table_converter/__init__.py +2 -0
- {python_table_converter-0.2.15 → python_table_converter-0.2.17}/table_converter/core/actions.py +15 -0
- {python_table_converter-0.2.15 → python_table_converter-0.2.17}/table_converter/core/convert.py +12 -0
- python_table_converter-0.2.15/table_converter/__init__.py +0 -2
- {python_table_converter-0.2.15 → python_table_converter-0.2.17}/LICENSE +0 -0
- {python_table_converter-0.2.15 → python_table_converter-0.2.17}/README.md +0 -0
- {python_table_converter-0.2.15 → python_table_converter-0.2.17}/table_converter/cli.py +0 -0
- {python_table_converter-0.2.15 → python_table_converter-0.2.17}/table_converter/commands/convert_tables.py +0 -0
- {python_table_converter-0.2.15 → python_table_converter-0.2.17}/table_converter/core/config.py +0 -0
- {python_table_converter-0.2.15 → python_table_converter-0.2.17}/table_converter/core/constants.py +0 -0
- {python_table_converter-0.2.15 → python_table_converter-0.2.17}/table_converter/core/functions/assign_id.py +0 -0
- {python_table_converter-0.2.15 → python_table_converter-0.2.17}/table_converter/core/functions/flatten_row.py +0 -0
- {python_table_converter-0.2.15 → python_table_converter-0.2.17}/table_converter/core/functions/get_nested_field_value.py +0 -0
- {python_table_converter-0.2.15 → python_table_converter-0.2.17}/table_converter/core/functions/nest_row.py +0 -0
- {python_table_converter-0.2.15 → python_table_converter-0.2.17}/table_converter/core/functions/search_column_value.py +0 -0
- {python_table_converter-0.2.15 → python_table_converter-0.2.17}/table_converter/core/functions/set_flat_field_value.py +0 -0
- {python_table_converter-0.2.15 → python_table_converter-0.2.17}/table_converter/core/functions/set_nested_field_value.py +0 -0
- {python_table_converter-0.2.15 → python_table_converter-0.2.17}/table_converter/core/functions/set_row_value.py +0 -0
- {python_table_converter-0.2.15 → python_table_converter-0.2.17}/table_converter/core/types.py +0 -0
{python_table_converter-0.2.15 → python_table_converter-0.2.17}/table_converter/core/actions.py
RENAMED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
Actions are used to transform the data in the table.
|
|
3
3
|
'''
|
|
4
4
|
|
|
5
|
+
import re
|
|
6
|
+
|
|
5
7
|
from collections import OrderedDict
|
|
6
8
|
from dataclasses import dataclass
|
|
7
9
|
from typing import (
|
|
@@ -190,6 +192,14 @@ def setup_filter_action(
|
|
|
190
192
|
value = value.strip(),
|
|
191
193
|
))
|
|
192
194
|
return config
|
|
195
|
+
if '=~' in str_filter:
|
|
196
|
+
field, value = str_filter.split('=~')
|
|
197
|
+
config.actions.append(FilterConfig(
|
|
198
|
+
field = field.strip(),
|
|
199
|
+
operator = '=~',
|
|
200
|
+
value = value.strip(),
|
|
201
|
+
))
|
|
202
|
+
return config
|
|
193
203
|
raise ValueError(
|
|
194
204
|
f'Unsupported filter: {str_filter}'
|
|
195
205
|
)
|
|
@@ -383,6 +393,11 @@ def filter_row(
|
|
|
383
393
|
elif config.operator == '!=':
|
|
384
394
|
if str(value) == str(config.value) or value == config.value:
|
|
385
395
|
return False
|
|
396
|
+
elif config.operator == '=~':
|
|
397
|
+
if not found:
|
|
398
|
+
return False
|
|
399
|
+
if not re.search(config.value, value):
|
|
400
|
+
return False
|
|
386
401
|
elif config.operator == 'not-in':
|
|
387
402
|
if isinstance(config.value, list):
|
|
388
403
|
if value in config.value:
|
{python_table_converter-0.2.15 → python_table_converter-0.2.17}/table_converter/core/convert.py
RENAMED
|
@@ -119,6 +119,18 @@ def save_json(
|
|
|
119
119
|
ensure_ascii=False,
|
|
120
120
|
)
|
|
121
121
|
|
|
122
|
+
@register_loader('.jsonl')
|
|
123
|
+
def load_jsonl(
|
|
124
|
+
input_file: str,
|
|
125
|
+
):
|
|
126
|
+
rows = []
|
|
127
|
+
with open(input_file, 'r') as f:
|
|
128
|
+
for line in f:
|
|
129
|
+
row = json.loads(line)
|
|
130
|
+
rows.append(row)
|
|
131
|
+
df = pd.DataFrame(rows)
|
|
132
|
+
return df
|
|
133
|
+
|
|
122
134
|
@register_saver('.jsonl')
|
|
123
135
|
def save_jsonl(
|
|
124
136
|
df: pd.DataFrame,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{python_table_converter-0.2.15 → python_table_converter-0.2.17}/table_converter/core/config.py
RENAMED
|
File without changes
|
{python_table_converter-0.2.15 → python_table_converter-0.2.17}/table_converter/core/constants.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{python_table_converter-0.2.15 → python_table_converter-0.2.17}/table_converter/core/types.py
RENAMED
|
File without changes
|