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.
Files changed (21) hide show
  1. {python_table_converter-0.2.15 → python_table_converter-0.2.17}/PKG-INFO +1 -1
  2. {python_table_converter-0.2.15 → python_table_converter-0.2.17}/pyproject.toml +1 -1
  3. python_table_converter-0.2.17/table_converter/__init__.py +2 -0
  4. {python_table_converter-0.2.15 → python_table_converter-0.2.17}/table_converter/core/actions.py +15 -0
  5. {python_table_converter-0.2.15 → python_table_converter-0.2.17}/table_converter/core/convert.py +12 -0
  6. python_table_converter-0.2.15/table_converter/__init__.py +0 -2
  7. {python_table_converter-0.2.15 → python_table_converter-0.2.17}/LICENSE +0 -0
  8. {python_table_converter-0.2.15 → python_table_converter-0.2.17}/README.md +0 -0
  9. {python_table_converter-0.2.15 → python_table_converter-0.2.17}/table_converter/cli.py +0 -0
  10. {python_table_converter-0.2.15 → python_table_converter-0.2.17}/table_converter/commands/convert_tables.py +0 -0
  11. {python_table_converter-0.2.15 → python_table_converter-0.2.17}/table_converter/core/config.py +0 -0
  12. {python_table_converter-0.2.15 → python_table_converter-0.2.17}/table_converter/core/constants.py +0 -0
  13. {python_table_converter-0.2.15 → python_table_converter-0.2.17}/table_converter/core/functions/assign_id.py +0 -0
  14. {python_table_converter-0.2.15 → python_table_converter-0.2.17}/table_converter/core/functions/flatten_row.py +0 -0
  15. {python_table_converter-0.2.15 → python_table_converter-0.2.17}/table_converter/core/functions/get_nested_field_value.py +0 -0
  16. {python_table_converter-0.2.15 → python_table_converter-0.2.17}/table_converter/core/functions/nest_row.py +0 -0
  17. {python_table_converter-0.2.15 → python_table_converter-0.2.17}/table_converter/core/functions/search_column_value.py +0 -0
  18. {python_table_converter-0.2.15 → python_table_converter-0.2.17}/table_converter/core/functions/set_flat_field_value.py +0 -0
  19. {python_table_converter-0.2.15 → python_table_converter-0.2.17}/table_converter/core/functions/set_nested_field_value.py +0 -0
  20. {python_table_converter-0.2.15 → python_table_converter-0.2.17}/table_converter/core/functions/set_row_value.py +0 -0
  21. {python_table_converter-0.2.15 → python_table_converter-0.2.17}/table_converter/core/types.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: python-table-converter
3
- Version: 0.2.15
3
+ Version: 0.2.17
4
4
  Summary: A table data converter
5
5
  Home-page: https://github.com/akivajp/python-table-converter
6
6
  License: MIT
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "python-table-converter"
3
- version = "0.2.15"
3
+ version = "0.2.17"
4
4
  description = "A table data converter"
5
5
  authors = ["Akiva Miura <akiva.miura@gmail.com>"]
6
6
  license = "MIT"
@@ -0,0 +1,2 @@
1
+ __version__ = "0.2.17"
2
+ __version_tuple__ = (0, 2, 17)
@@ -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:
@@ -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,
@@ -1,2 +0,0 @@
1
- __version__ = "0.2.15"
2
- __version_tuple__ = (0, 2, 15)