Parent issue
#194 — function purification
Problem
The logs: pl.DataFrame and file_path: str parameters are accepted but never used in the function body across 14 functions in the extraction pipeline:
| Function |
File:Line |
spawn_locations |
statement_functions.py:77 |
strip |
statement_functions.py:111 |
build_pattern |
statement_functions.py:145 |
patmatch |
statement_functions.py:163 |
cast |
statement_functions.py:187 |
trim |
statement_functions.py:247 |
validate |
statement_functions.py:266 |
cleanup |
statement_functions.py:276 |
get_region |
pdf_functions.py:26 |
pdf_open |
pdf_functions.py:42 |
pdf_close |
pdf_functions.py:56 |
page_crop |
pdf_functions.py:67 |
region_search |
pdf_functions.py:85 |
page_text |
pdf_functions.py:99 |
These dead parameters clutter every call site and obscure which arguments actually matter.
Proposal
Remove the unused logs and file_path parameters from all affected functions. Update all call sites.
Code relationships
Target functions (dead params to remove):
- 8 functions in
statement_functions.py
- 6 functions in
pdf_functions.py
Callers (will need updating):
extract_fields() — statement_functions.py:314 (calls get_region, get_table_from_region)
get_results() — statement_functions.py:688 (calls spawn_locations, extract_fields)
Statement.get_results() — statements.py:631 (calls module-level get_results)
ImportConfigManager.identify_from_pdf() — import_config.py:385 (calls get_results)
ImportConfigManager.get_config_from_company() — import_config.py:454 (calls get_results)
ImportConfigManager.get_config_from_statement() — import_config.py:496 (calls get_results)
Siblings (also take unused logs/file_path):
get_table_from_region() — pdf_functions.py:109 (same pattern, 14 params)
Existing tests
None. None of these functions have direct test coverage. Removing unused parameters will not break any existing tests.
Siblings
Parent issue
#194 — function purification
Problem
The
logs: pl.DataFrameandfile_path: strparameters are accepted but never used in the function body across 14 functions in the extraction pipeline:spawn_locationsstatement_functions.py:77stripstatement_functions.py:111build_patternstatement_functions.py:145patmatchstatement_functions.py:163caststatement_functions.py:187trimstatement_functions.py:247validatestatement_functions.py:266cleanupstatement_functions.py:276get_regionpdf_functions.py:26pdf_openpdf_functions.py:42pdf_closepdf_functions.py:56page_croppdf_functions.py:67region_searchpdf_functions.py:85page_textpdf_functions.py:99These dead parameters clutter every call site and obscure which arguments actually matter.
Proposal
Remove the unused
logsandfile_pathparameters from all affected functions. Update all call sites.Code relationships
Target functions (dead params to remove):
statement_functions.pypdf_functions.pyCallers (will need updating):
extract_fields()—statement_functions.py:314(callsget_region,get_table_from_region)get_results()—statement_functions.py:688(callsspawn_locations,extract_fields)Statement.get_results()—statements.py:631(calls module-levelget_results)ImportConfigManager.identify_from_pdf()—import_config.py:385(callsget_results)ImportConfigManager.get_config_from_company()—import_config.py:454(callsget_results)ImportConfigManager.get_config_from_statement()—import_config.py:496(callsget_results)Siblings (also take unused logs/file_path):
get_table_from_region()—pdf_functions.py:109(same pattern, 14 params)Existing tests
None. None of these functions have direct test coverage. Removing unused parameters will not break any existing tests.
Siblings