python-table-converter 0.2.14__tar.gz → 0.2.15__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.14 → python_table_converter-0.2.15}/PKG-INFO +1 -1
  2. {python_table_converter-0.2.14 → python_table_converter-0.2.15}/pyproject.toml +1 -1
  3. python_table_converter-0.2.15/table_converter/__init__.py +2 -0
  4. {python_table_converter-0.2.14 → python_table_converter-0.2.15}/table_converter/commands/convert_tables.py +7 -0
  5. {python_table_converter-0.2.14 → python_table_converter-0.2.15}/table_converter/core/convert.py +10 -1
  6. {python_table_converter-0.2.14 → python_table_converter-0.2.15}/table_converter/core/types.py +1 -1
  7. python_table_converter-0.2.14/table_converter/__init__.py +0 -2
  8. {python_table_converter-0.2.14 → python_table_converter-0.2.15}/LICENSE +0 -0
  9. {python_table_converter-0.2.14 → python_table_converter-0.2.15}/README.md +0 -0
  10. {python_table_converter-0.2.14 → python_table_converter-0.2.15}/table_converter/cli.py +0 -0
  11. {python_table_converter-0.2.14 → python_table_converter-0.2.15}/table_converter/core/actions.py +0 -0
  12. {python_table_converter-0.2.14 → python_table_converter-0.2.15}/table_converter/core/config.py +0 -0
  13. {python_table_converter-0.2.14 → python_table_converter-0.2.15}/table_converter/core/constants.py +0 -0
  14. {python_table_converter-0.2.14 → python_table_converter-0.2.15}/table_converter/core/functions/assign_id.py +0 -0
  15. {python_table_converter-0.2.14 → python_table_converter-0.2.15}/table_converter/core/functions/flatten_row.py +0 -0
  16. {python_table_converter-0.2.14 → python_table_converter-0.2.15}/table_converter/core/functions/get_nested_field_value.py +0 -0
  17. {python_table_converter-0.2.14 → python_table_converter-0.2.15}/table_converter/core/functions/nest_row.py +0 -0
  18. {python_table_converter-0.2.14 → python_table_converter-0.2.15}/table_converter/core/functions/search_column_value.py +0 -0
  19. {python_table_converter-0.2.14 → python_table_converter-0.2.15}/table_converter/core/functions/set_flat_field_value.py +0 -0
  20. {python_table_converter-0.2.14 → python_table_converter-0.2.15}/table_converter/core/functions/set_nested_field_value.py +0 -0
  21. {python_table_converter-0.2.14 → python_table_converter-0.2.15}/table_converter/core/functions/set_row_value.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: python-table-converter
3
- Version: 0.2.14
3
+ Version: 0.2.15
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.14"
3
+ version = "0.2.15"
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.15"
2
+ __version_tuple__ = (0, 2, 15)
@@ -12,6 +12,7 @@ def run(
12
12
  convert(
13
13
  input_files = args.input_files,
14
14
  output_file = args.output_file,
15
+ output_file_filtered_out = args.output_file_filtered_out,
15
16
  config_path = args.config,
16
17
  list_actions = args.do_actions,
17
18
  list_pick_columns = args.pick_columns,
@@ -34,6 +35,12 @@ def setup_parser(
34
35
  required=True,
35
36
  help='Path to the output file.'
36
37
  )
38
+ parser.add_argument(
39
+ '--output-file-filtered-out', '--output-filtered-out', '-f',
40
+ metavar='OUTPUT_FILE_FILTERED_OUT',
41
+ required=False,
42
+ help='Path to the output file for filtered out rows.',
43
+ )
37
44
  parser.add_argument(
38
45
  '--config', '-c',
39
46
  type=str,
@@ -244,6 +244,7 @@ def assign_length(
244
244
  def convert(
245
245
  input_files: list[str],
246
246
  output_file: str | None = None,
247
+ output_file_filtered_out: str | None = None,
247
248
  config_path: str | None = None,
248
249
  output_debug: bool = False,
249
250
  list_actions: list[str] | None = None,
@@ -254,6 +255,7 @@ def convert(
254
255
  ic()
255
256
  ic(input_files)
256
257
  df_list = []
258
+ row_list_filtered_out = []
257
259
  global_status = GlobalStatus()
258
260
  config = setup_config(config_path)
259
261
  ic(config)
@@ -300,9 +302,12 @@ def convert(
300
302
  if config.actions:
301
303
  new_row = do_actions(global_status, row, config.actions)
302
304
  if new_row is None:
303
- if verbose:
305
+ if not output_debug:
304
306
  pop_row_staging(row)
307
+ if verbose:
305
308
  ic('Filtered out: ', row.flat)
309
+ if output_file_filtered_out:
310
+ row_list_filtered_out.append(row.flat)
306
311
  continue
307
312
  row = new_row
308
313
  if config.pick:
@@ -320,3 +325,7 @@ def convert(
320
325
  if output_file:
321
326
  ic('Saing to: ', output_file)
322
327
  saver(all_df, output_file)
328
+ if row_list_filtered_out:
329
+ df_filtered_out = pd.DataFrame(row_list_filtered_out)
330
+ ic('Saving filtered out to: ', output_file_filtered_out)
331
+ saver(df_filtered_out, output_file_filtered_out)
@@ -40,7 +40,7 @@ class AssignIdConfig:
40
40
  @dataclasses.dataclass
41
41
  class FilterConfig:
42
42
  field: str
43
- operator: Literal['==', '!=', '>', '>=', '<', '<=', 'not-in']
43
+ operator: Literal['==', '!=', '>', '>=', '<', '<=', '=~', 'not-in']
44
44
  value: str | list[str]
45
45
 
46
46
  @dataclasses.dataclass
@@ -1,2 +0,0 @@
1
- __version__ = "0.2.14"
2
- __version_tuple__ = (0, 2, 14)