dcicutils 8.18.1.1b3__py3-none-any.whl → 8.18.2.1b1__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.
@@ -95,7 +95,8 @@ class CustomExcel(Excel):
95
95
  return CustomExcelSheetReader(self, sheet_name=sheet_name, workbook=self._workbook,
96
96
  custom_column_mappings=self._custom_column_mappings)
97
97
 
98
- def effective_sheet_name(self, sheet_name: str) -> str:
98
+ @staticmethod
99
+ def effective_sheet_name(sheet_name: str) -> str:
99
100
  if (underscore := sheet_name.find("_")) > 1:
100
101
  return sheet_name[underscore + 1:]
101
102
  return sheet_name
@@ -151,11 +152,21 @@ class CustomExcelSheetReader(ExcelSheetReader):
151
152
  ARGUMENT_NAME_CUSTOM_COLUMN_MAPPINGS = "custom_column_mappings"
152
153
  self._custom_column_mappings = None
153
154
  if ARGUMENT_NAME_CUSTOM_COLUMN_MAPPINGS in kwargs:
155
+ def lookup_custom_column_mappings(custom_column_mappings: dict, sheet_name: str) -> Optional[dict]:
156
+ if isinstance(custom_column_mappings, dict) and isinstance(sheet_name, str):
157
+ if isinstance(found_custom_column_mappings := custom_column_mappings.get(sheet_name), dict):
158
+ return found_custom_column_mappings
159
+ if (effective_sheet_name := CustomExcel.effective_sheet_name(sheet_name)) != sheet_name:
160
+ if isinstance(found_custom_column_mappings :=
161
+ custom_column_mappings.get(effective_sheet_name), dict):
162
+ return found_custom_column_mappings
163
+ return None
154
164
  custom_column_mappings = kwargs[ARGUMENT_NAME_CUSTOM_COLUMN_MAPPINGS]
155
165
  del kwargs[ARGUMENT_NAME_CUSTOM_COLUMN_MAPPINGS]
156
166
  if not (isinstance(custom_column_mappings, dict) and
157
167
  isinstance(sheet_name := kwargs.get(ARGUMENT_NAME_SHEET_NAME, None), str) and
158
- isinstance(custom_column_mappings := custom_column_mappings.get(sheet_name), dict)):
168
+ isinstance(custom_column_mappings :=
169
+ lookup_custom_column_mappings(custom_column_mappings, sheet_name), dict)):
159
170
  custom_column_mappings = None
160
171
  self._custom_column_mappings = custom_column_mappings
161
172
  super().__init__(*args, **kwargs)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: dcicutils
3
- Version: 8.18.1.1b3
3
+ Version: 8.18.2.1b1
4
4
  Summary: Utility package for interacting with the 4DN Data Portal and other 4DN resources
5
5
  Home-page: https://github.com/4dn-dcic/utils
6
6
  License: MIT
@@ -68,7 +68,7 @@ dcicutils/snapshot_utils.py,sha256=YDeI3vD-MhAtHwKDzfEm2q-n3l-da2yRpRR3xp0Ah1M,2
68
68
  dcicutils/ssl_certificate_utils.py,sha256=F0ifz_wnRRN9dfrfsz7aCp4UDLgHEY8LaK7PjnNvrAQ,9707
69
69
  dcicutils/structured_data.py,sha256=9Uleh8AhRWW6qj4fDCUnpRBsLgxWHZVh8nJdMDSHmD0,67510
70
70
  dcicutils/submitr/config/custom_column_mappings.json,sha256=GS6umTpNZszTao8zTbGiNbR8qFnL4kudMt3nBZXaom0,3881
71
- dcicutils/submitr/custom_excel.py,sha256=foT-fvGQti4RbTYIj6JSE4lh0gLhQ8thcidoUH-hv4w,16548
71
+ dcicutils/submitr/custom_excel.py,sha256=BHDIe8EPPeDTopPG8BIefELqhnxKm62nN3YGRsApkWw,17362
72
72
  dcicutils/submitr/progress_constants.py,sha256=5bxyX77ql8qEJearfHEvsvXl7D0GuUODW0T65mbRmnE,2895
73
73
  dcicutils/submitr/ref_lookup_strategy.py,sha256=VJN-Oo0LLna6Vo2cu47eC-eU-yUC9NFlQP29xajejVU,4741
74
74
  dcicutils/task_utils.py,sha256=MF8ujmTD6-O2AC2gRGPHyGdUrVKgtr8epT5XU8WtNjk,8082
@@ -77,8 +77,8 @@ dcicutils/trace_utils.py,sha256=g8kwV4ebEy5kXW6oOrEAUsurBcCROvwtZqz9fczsGRE,1769
77
77
  dcicutils/validation_utils.py,sha256=cMZIU2cY98FYtzK52z5WUYck7urH6JcqOuz9jkXpqzg,14797
78
78
  dcicutils/variant_utils.py,sha256=2H9azNx3xAj-MySg-uZ2SFqbWs4kZvf61JnK6b-h4Qw,4343
79
79
  dcicutils/zip_utils.py,sha256=_Y9EmL3D2dUZhxucxHvrtmmlbZmK4FpSsHEb7rGSJLU,3265
80
- dcicutils-8.18.1.1b3.dist-info/LICENSE.txt,sha256=IrWHOFtMb2inTgr2ZqwQriRC8H3uMQfQVO6lniaaoE0,1102
81
- dcicutils-8.18.1.1b3.dist-info/METADATA,sha256=kOxA6Ethw2l9wTg5IwPLbBJrTh8FOj8UocyqQ4SDDUs,3493
82
- dcicutils-8.18.1.1b3.dist-info/WHEEL,sha256=7Z8_27uaHI_UZAc4Uox4PpBhQ9Y5_modZXWMxtUi4NU,88
83
- dcicutils-8.18.1.1b3.dist-info/entry_points.txt,sha256=W6kEWdUJk9tQ4myAgpehPdebcwvCAZ7UgB-wyPgDUMg,335
84
- dcicutils-8.18.1.1b3.dist-info/RECORD,,
80
+ dcicutils-8.18.2.1b1.dist-info/LICENSE.txt,sha256=IrWHOFtMb2inTgr2ZqwQriRC8H3uMQfQVO6lniaaoE0,1102
81
+ dcicutils-8.18.2.1b1.dist-info/METADATA,sha256=0MvZD9XZdeDfvPclGpxVgZoIry83bPslrE45YgJA5oI,3493
82
+ dcicutils-8.18.2.1b1.dist-info/WHEEL,sha256=7Z8_27uaHI_UZAc4Uox4PpBhQ9Y5_modZXWMxtUi4NU,88
83
+ dcicutils-8.18.2.1b1.dist-info/entry_points.txt,sha256=W6kEWdUJk9tQ4myAgpehPdebcwvCAZ7UgB-wyPgDUMg,335
84
+ dcicutils-8.18.2.1b1.dist-info/RECORD,,