excel-list-transform 0.7.1__tar.gz → 0.7.3__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 (38) hide show
  1. {excel_list_transform-0.7.1/excel_list_transform.egg-info → excel_list_transform-0.7.3}/PKG-INFO +2 -2
  2. {excel_list_transform-0.7.1 → excel_list_transform-0.7.3/excel_list_transform.egg-info}/PKG-INFO +2 -2
  3. {excel_list_transform-0.7.1 → excel_list_transform-0.7.3}/excel_list_transform.egg-info/requires.txt +1 -1
  4. {excel_list_transform-0.7.1 → excel_list_transform-0.7.3}/pyproject.toml +1 -1
  5. {excel_list_transform-0.7.1 → excel_list_transform-0.7.3}/setup.py +2 -2
  6. {excel_list_transform-0.7.1 → excel_list_transform-0.7.3}/src/excel_list_transform/generate_cfg.py +105 -10
  7. {excel_list_transform-0.7.1 → excel_list_transform-0.7.3}/src/excel_list_transform/transform_cmd.py +3 -2
  8. {excel_list_transform-0.7.1 → excel_list_transform-0.7.3}/LICENSE.txt +0 -0
  9. {excel_list_transform-0.7.1 → excel_list_transform-0.7.3}/README.md +0 -0
  10. {excel_list_transform-0.7.1 → excel_list_transform-0.7.3}/README_pypi.md +0 -0
  11. {excel_list_transform-0.7.1 → excel_list_transform-0.7.3}/excel_list_transform.egg-info/SOURCES.txt +0 -0
  12. {excel_list_transform-0.7.1 → excel_list_transform-0.7.3}/excel_list_transform.egg-info/dependency_links.txt +0 -0
  13. {excel_list_transform-0.7.1 → excel_list_transform-0.7.3}/excel_list_transform.egg-info/top_level.txt +0 -0
  14. {excel_list_transform-0.7.1 → excel_list_transform-0.7.3}/setup.cfg +0 -0
  15. {excel_list_transform-0.7.1 → excel_list_transform-0.7.3}/src/excel_list_transform/__init__.py +0 -0
  16. {excel_list_transform-0.7.1 → excel_list_transform-0.7.3}/src/excel_list_transform/__main__.py +0 -0
  17. {excel_list_transform-0.7.1 → excel_list_transform-0.7.3}/src/excel_list_transform/check_indata_common.py +0 -0
  18. {excel_list_transform-0.7.1 → excel_list_transform-0.7.3}/src/excel_list_transform/commontypes.py +0 -0
  19. {excel_list_transform-0.7.1 → excel_list_transform-0.7.3}/src/excel_list_transform/config.py +0 -0
  20. {excel_list_transform-0.7.1 → excel_list_transform-0.7.3}/src/excel_list_transform/config_enums.py +0 -0
  21. {excel_list_transform-0.7.1 → excel_list_transform-0.7.3}/src/excel_list_transform/config_excel_list_transform.py +0 -0
  22. {excel_list_transform-0.7.1 → excel_list_transform-0.7.3}/src/excel_list_transform/config_factory.py +0 -0
  23. {excel_list_transform-0.7.1 → excel_list_transform-0.7.3}/src/excel_list_transform/config_xls_list_refmt_name.py +0 -0
  24. {excel_list_transform-0.7.1 → excel_list_transform-0.7.3}/src/excel_list_transform/config_xls_list_refmt_num.py +0 -0
  25. {excel_list_transform-0.7.1 → excel_list_transform-0.7.3}/src/excel_list_transform/file_extension.py +0 -0
  26. {excel_list_transform-0.7.1 → excel_list_transform-0.7.3}/src/excel_list_transform/file_must_exist.py +0 -0
  27. {excel_list_transform-0.7.1 → excel_list_transform-0.7.3}/src/excel_list_transform/generate_txt.py +0 -0
  28. {excel_list_transform-0.7.1 → excel_list_transform-0.7.3}/src/excel_list_transform/handle_csv.py +0 -0
  29. {excel_list_transform-0.7.1 → excel_list_transform-0.7.3}/src/excel_list_transform/handle_empty_column.py +0 -0
  30. {excel_list_transform-0.7.1 → excel_list_transform-0.7.3}/src/excel_list_transform/handle_excel.py +0 -0
  31. {excel_list_transform-0.7.1 → excel_list_transform-0.7.3}/src/excel_list_transform/num_named_conversion.py +0 -0
  32. {excel_list_transform-0.7.1 → excel_list_transform-0.7.3}/src/excel_list_transform/py.typed +0 -0
  33. {excel_list_transform-0.7.1 → excel_list_transform-0.7.3}/src/excel_list_transform/rewrite_value.py +0 -0
  34. {excel_list_transform-0.7.1 → excel_list_transform-0.7.3}/src/excel_list_transform/str_to_enum.py +0 -0
  35. {excel_list_transform-0.7.1 → excel_list_transform-0.7.3}/src/excel_list_transform/transform_func.py +0 -0
  36. {excel_list_transform-0.7.1 → excel_list_transform-0.7.3}/src/excel_list_transform/transform_func_common.py +0 -0
  37. {excel_list_transform-0.7.1 → excel_list_transform-0.7.3}/src/excel_list_transform/transform_func_named.py +0 -0
  38. {excel_list_transform-0.7.1 → excel_list_transform-0.7.3}/src/excel_list_transform/transform_func_num.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: excel-list-transform
3
- Version: 0.7.1
3
+ Version: 0.7.3
4
4
  Summary: Transform a list in excel or CSV
5
5
  Author: Tom Björkholm
6
6
  Author-email: Tom Björkholm <klausuler_linnet0q@icloud.com>
@@ -12,7 +12,7 @@ Requires-Python: >=3.12.6
12
12
  Description-Content-Type: text/markdown
13
13
  License-File: LICENSE.txt
14
14
  Requires-Dist: openpyxl>=3.1.5
15
- Requires-Dist: types-openpyxl>=3.1.5.20241126
15
+ Requires-Dist: types-openpyxl>=3.1.5.20241225
16
16
  Requires-Dist: pylightxl>=1.61
17
17
  Requires-Dist: XlsxWriter>=3.2.0
18
18
  Requires-Dist: pip>=24.2
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: excel-list-transform
3
- Version: 0.7.1
3
+ Version: 0.7.3
4
4
  Summary: Transform a list in excel or CSV
5
5
  Author: Tom Björkholm
6
6
  Author-email: Tom Björkholm <klausuler_linnet0q@icloud.com>
@@ -12,7 +12,7 @@ Requires-Python: >=3.12.6
12
12
  Description-Content-Type: text/markdown
13
13
  License-File: LICENSE.txt
14
14
  Requires-Dist: openpyxl>=3.1.5
15
- Requires-Dist: types-openpyxl>=3.1.5.20241126
15
+ Requires-Dist: types-openpyxl>=3.1.5.20241225
16
16
  Requires-Dist: pylightxl>=1.61
17
17
  Requires-Dist: XlsxWriter>=3.2.0
18
18
  Requires-Dist: pip>=24.2
@@ -1,5 +1,5 @@
1
1
  openpyxl>=3.1.5
2
- types-openpyxl>=3.1.5.20241126
2
+ types-openpyxl>=3.1.5.20241225
3
3
  pylightxl>=1.61
4
4
  XlsxWriter>=3.2.0
5
5
  pip>=24.2
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "excel-list-transform"
7
- version = "0.7.1"
7
+ version = "0.7.3"
8
8
  authors = [
9
9
  { name="Tom Björkholm", email="klausuler_linnet0q@icloud.com" },
10
10
  ]
@@ -5,7 +5,7 @@ from setuptools import setup
5
5
 
6
6
  setup(
7
7
  name='excel-list-transform',
8
- version='0.7.1',
8
+ version='0.7.3',
9
9
  description='Transform a list in excel or CSV.',
10
10
  author='Tom Björkholm',
11
11
  author_email='klausuler_linnet0q@icloud.com',
@@ -15,7 +15,7 @@ setup(
15
15
  package_data={'excel_list_transform': ['src/py.typed']},
16
16
  install_requires=[
17
17
  'openpyxl >= 3.1.5',
18
- 'types-openpyxl >= 3.1.5.20241126',
18
+ 'types-openpyxl >= 3.1.5.20241225',
19
19
  'pylightxl >= 1.61',
20
20
  'XlsxWriter >= 3.2.0',
21
21
  'pip >= 24.2',
@@ -7,7 +7,7 @@
7
7
 
8
8
  from excel_list_transform.file_extension import fix_file_extension
9
9
  from excel_list_transform.config_enums import ColumnRef, FileType, \
10
- RewriteKind, CaseSensitivity, ExcelLib
10
+ RewriteKind, CaseSensitivity, ExcelLib, SplitWhere
11
11
  from excel_list_transform.config_factory import config_factory_from_enum
12
12
  from excel_list_transform.generate_txt import generate_syntax_txt
13
13
  from excel_list_transform.config_xls_list_refmt_name import \
@@ -15,15 +15,7 @@ from excel_list_transform.config_xls_list_refmt_name import \
15
15
  from excel_list_transform.config_xls_list_refmt_num import \
16
16
  ConfigXlsListRefmtNum
17
17
 
18
- syntax_o2x_common: str = '''
19
-
20
- Column names are changed from another language (Swedish) and sometimes from
21
- a more instuctive naming to the names understood by RRS.
22
-
23
- The events does not use divisions, boat names and WhatsApp. Thus the
24
- form did not ask for these. They are inserted as empty columns to please
25
- RRS.
26
-
18
+ syntax_phone_fix: str = '''
27
19
  The phone number has to be in international format '+' followed by only
28
20
  digits for RRS, but the sailors filling in the form sometimes use
29
21
  national format (no + and no country code). Also the sailors filling
@@ -35,6 +27,17 @@ phone numbers. For other countries s7_rewrite_columns need to be
35
27
  adjusted.
36
28
  '''
37
29
 
30
+ syntax_o2x_common: str = '''
31
+
32
+ Column names are changed from another language (Swedish) and sometimes from
33
+ a more instuctive naming to the names understood by RRS.
34
+
35
+ The events does not use divisions, boat names and WhatsApp. Thus the
36
+ form did not ask for these. They are inserted as empty columns to please
37
+ RRS.
38
+
39
+ ''' + syntax_phone_fix
40
+
38
41
  syntax_only_o2r_common: str = '''
39
42
  This an example of taking a registration list from the excel file received
40
43
  from office forms or google forms and transforming it for importing into
@@ -60,6 +63,94 @@ is "BY_NAME".
60
63
 
61
64
  syntax_o2r_common: str = syntax_only_o2r_common + syntax_o2x_common
62
65
 
66
+ syntax_s2r_common: str = '''
67
+
68
+ In this example the input data is exported as JSON or XML from SailWave
69
+ https://www.sailwave.com . The data as a list in excel format is then
70
+ extracted using extract-list https://pypi.org/project/extract-list.
71
+ As SW only has a name field and not first name and last name fields,
72
+ and as SW has not field for WhatsApp, this processing of the data is needed
73
+ before it can be imported into RRS https://www.racingrulesofsailing.org/
74
+
75
+ The Name column is split into First Name and Last Name columns.
76
+ The column WhatsApp is added with no data.
77
+
78
+ ''' + syntax_phone_fix
79
+
80
+
81
+ def generate_syntax_s2r_name(filename: str, colref: ColumnRef) -> None:
82
+ """Generate config example for office_forms_to_rrs."""
83
+ assert colref == ColumnRef.BY_NAME
84
+ cfg = ConfigXlsListRefmtName()
85
+ cfg.out_excel_library = ExcelLib.OPENPYXL
86
+ cfg.in_type = FileType.EXCEL
87
+ cfg.out_type = FileType.EXCEL
88
+ cfg.s1_split_columns = [{'column': 'Name',
89
+ 'separator': ' ',
90
+ 'where': SplitWhere.RIGHTMOST,
91
+ 'right_name': 'Last Name'}]
92
+ cfg.s3_merge_columns = []
93
+ cfg.s5_rename_columns = [{'column': 'Name', 'name': 'First Name'}]
94
+ cfg.s6_insert_columns = [{'column': 'WhatsApp', 'value': None}]
95
+ cfg.s7_rewrite_columns = [
96
+ {'column': 'Phone', 'kind': RewriteKind.STRIP,
97
+ 'chars': '', 'case': CaseSensitivity.IGNORE_CASE},
98
+ {'column': 'Phone', 'kind': RewriteKind.REMOVECHARS,
99
+ 'chars': [' ', '-'], 'case': CaseSensitivity.MATCH_CASE},
100
+ {'column': 'Phone', 'kind': RewriteKind.REGEX_SUBSTITUTE,
101
+ 'from': '^07', 'to': '+467', 'case': CaseSensitivity.MATCH_CASE},
102
+ {'column': 'Phone', 'kind': RewriteKind.REGEX_SUBSTITUTE,
103
+ 'from': '^\\+4607', 'to': '+467', 'case': CaseSensitivity.MATCH_CASE},
104
+ {'column': 'Phone', 'kind': RewriteKind.REGEX_SUBSTITUTE,
105
+ 'from': '^467', 'to': '+467', 'case': CaseSensitivity.MATCH_CASE},
106
+ {'column': 'Phone', 'kind': RewriteKind.REGEX_SUBSTITUTE,
107
+ 'from': '^4607', 'to': '+467', 'case': CaseSensitivity.MATCH_CASE}]
108
+ cfg.s8_column_order = ['Class', 'Division', 'Nationality',
109
+ 'Sail Number', 'Boat Name', 'First Name',
110
+ 'Last Name', 'Club Name', 'Email', 'Phone',
111
+ 'WhatsApp']
112
+ cfg.write(to_json_filename=filename)
113
+
114
+
115
+ TXT_S2R_NAME = syntax_s2r_common + by_name_common
116
+
117
+
118
+ def generate_syntax_s2r_num(filename: str, colref: ColumnRef) -> None:
119
+ """Generate config example for office_forms_to_rrs."""
120
+ assert colref == ColumnRef.BY_NUMBER
121
+ cfg = ConfigXlsListRefmtNum()
122
+ cfg.out_excel_library = ExcelLib.OPENPYXL
123
+ cfg.in_type = FileType.EXCEL
124
+ cfg.out_type = FileType.EXCEL
125
+ cfg.s1_split_columns = [{'column': 5, 'separator': ' ',
126
+ 'where': SplitWhere.RIGHTMOST,
127
+ 'store_single': SplitWhere.RIGHTMOST}]
128
+ cfg.s2_remove_columns = []
129
+ cfg.s3_merge_columns = []
130
+ cfg.s4_place_columns_first = []
131
+ cfg.s5_rename_columns = \
132
+ [{'column': 5, 'name': 'First Name'},
133
+ {'column': 6, 'name': 'Last Name'}]
134
+ cfg.s6_insert_columns = [{'column': 10, 'name': 'WhatsApp',
135
+ 'value': None}]
136
+ cfg.s7_rewrite_columns = [
137
+ {'column': 9, 'kind': RewriteKind.STRIP,
138
+ 'chars': '', 'case': CaseSensitivity.IGNORE_CASE},
139
+ {'column': 9, 'kind': RewriteKind.REMOVECHARS,
140
+ 'chars': [' ', '-'], 'case': CaseSensitivity.MATCH_CASE},
141
+ {'column': 9, 'kind': RewriteKind.REGEX_SUBSTITUTE,
142
+ 'from': '^07', 'to': '+467', 'case': CaseSensitivity.MATCH_CASE},
143
+ {'column': 9, 'kind': RewriteKind.REGEX_SUBSTITUTE,
144
+ 'from': '^\\+4607', 'to': '+467', 'case': CaseSensitivity.MATCH_CASE},
145
+ {'column': 9, 'kind': RewriteKind.REGEX_SUBSTITUTE,
146
+ 'from': '^467', 'to': '+467', 'case': CaseSensitivity.MATCH_CASE},
147
+ {'column': 9, 'kind': RewriteKind.REGEX_SUBSTITUTE,
148
+ 'from': '^4607', 'to': '+467', 'case': CaseSensitivity.MATCH_CASE}]
149
+ cfg.write(to_json_filename=filename)
150
+
151
+
152
+ TXT_S2R_NUM = syntax_s2r_common + by_number_common
153
+
63
154
 
64
155
  def generate_syntax_o2r_name(filename: str, colref: ColumnRef) -> None:
65
156
  """Generate config example for office_forms_to_rrs."""
@@ -341,6 +432,8 @@ dispatch = {'forms_to_rrs': {ColumnRef.BY_NAME: generate_syntax_o2r_name,
341
432
  ColumnRef.BY_NUMBER: generate_syntax_o2s_num},
342
433
  'rrs_to_sw': {ColumnRef.BY_NAME: generate_syntax_r2s_name,
343
434
  ColumnRef.BY_NUMBER: generate_syntax_r2s_num},
435
+ 'sw_to_rrs': {ColumnRef.BY_NAME: generate_syntax_s2r_name,
436
+ ColumnRef.BY_NUMBER: generate_syntax_s2r_num},
344
437
  'example': {ColumnRef.BY_NAME: generate_syntax_example,
345
438
  ColumnRef.BY_NUMBER: generate_syntax_example}}
346
439
 
@@ -350,6 +443,8 @@ txts = {'forms_to_rrs': {ColumnRef.BY_NAME: TXT_O2R_NAME,
350
443
  ColumnRef.BY_NUMBER: TXT_O2S_NUM},
351
444
  'rrs_to_sw': {ColumnRef.BY_NAME: TXT_R2S_NAME,
352
445
  ColumnRef.BY_NUMBER: TXT_R2S_NUM},
446
+ 'sw_to_rrs': {ColumnRef.BY_NAME: TXT_S2R_NAME,
447
+ ColumnRef.BY_NUMBER: TXT_S2R_NUM},
353
448
  'example': {ColumnRef.BY_NAME: TXT_SYNTAX_WXAMPLE,
354
449
  ColumnRef.BY_NUMBER: TXT_SYNTAX_WXAMPLE}}
355
450
 
@@ -130,11 +130,12 @@ def transform_cmd(arguments: Optional[list[str]] = None) -> None:
130
130
  del fixed_args[0]
131
131
  if len(fixed_args) > 2 and '-m' == fixed_args[0]:
132
132
  del fixed_args[0]
133
- while len(fixed_args) > 1 and fixed_args[0][-3:] == '.py':
133
+ while len(fixed_args) >= 1 and fixed_args[0][-3:] == '.py':
134
134
  del fixed_args[0]
135
135
  desc = GENERAL_DESCRIPTION + \
136
136
  USAGE_ORDER
137
- parser = argparse.ArgumentParser(description=desc, epilog=epimain)
137
+ parser = argparse.ArgumentParser(prog='excel_list_transform',
138
+ description=desc, epilog=epimain)
138
139
  subparsers = parser.add_subparsers(dest='subparser_name', required=True)
139
140
  gen_cfg_args(subparsers)
140
141
  rfmt_args(subparsers)