This pull request introduces several changes primarily focused on improving logging, enhancing error handling, and adding new functionality to the lp module. Key changes include the addition of new helper functions, the introduction of a rules engine, and the creation of a new enumeration class.
Enhancements and New Features:
New Enumeration Class:
Added LpEnum class to represent different types of logical operations (NONE, EMPTY, CELL_ONLY, SHEET_CELL, etc.) (oxt/pythonpath/libre_pythonista_lib/code/mod_helper/lp_enum.py).
Rules Engine:
Introduced LpRulesEngine class to manage rules for the lp function, including methods for adding, removing, and matching rules (oxt/pythonpath/libre_pythonista_lib/code/mod_helper/lp_rules/lp_rules_engine.py).
Added LpRuleT protocol to define the interface for rules (oxt/pythonpath/libre_pythonista_lib/code/mod_helper/lp_rules/lp_rule_t.py).
Logging and Error Handling Improvements:
Enhanced Logging:
Added debug logs in various methods to provide detailed information about the internal state and operations, such as in _has_array_ability, _ensure_sheet_index, and get_by_index methods (oxt/pythonpath/libre_pythonista_lib/cell/array/array_mgr.py) [1] (oxt/pythonpath/libre_pythonista_lib/code/cell_cache.py) [2][3].
Improved Error Handling:
Wrapped critical sections in try-except blocks to catch and log exceptions, ensuring the program can handle unexpected errors gracefully (oxt/pythonpath/libre_pythonista_lib/cell/array/array_mgr.py).
Code Refactoring:
Refactored lp Function:
Split the lp function into multiple helper functions (_handle_cell_only, _handle_sheet_cell, _handle_range_only, _handle_sheet_range_only, _handle_named_range_only, _handle_sheet_named_range_only) to handle different types of inputs more cleanly (oxt/pythonpath/libre_pythonista_lib/code/mod_helper/lp_mod.py) [1][2].
Miscellaneous:
Spelling Configuration:
Added new words to the cspell.json configuration file to improve spell-checking accuracy (cspell.json) [1][2].
This pull request introduces several changes primarily focused on improving logging, enhancing error handling, and adding new functionality to the
lp
module. Key changes include the addition of new helper functions, the introduction of a rules engine, and the creation of a new enumeration class.Enhancements and New Features:
New Enumeration Class:
LpEnum
class to represent different types of logical operations (NONE
,EMPTY
,CELL_ONLY
,SHEET_CELL
, etc.) (oxt/pythonpath/libre_pythonista_lib/code/mod_helper/lp_enum.py
).Rules Engine:
LpRulesEngine
class to manage rules for thelp
function, including methods for adding, removing, and matching rules (oxt/pythonpath/libre_pythonista_lib/code/mod_helper/lp_rules/lp_rules_engine.py
).LpRuleT
protocol to define the interface for rules (oxt/pythonpath/libre_pythonista_lib/code/mod_helper/lp_rules/lp_rule_t.py
).Logging and Error Handling Improvements:
Enhanced Logging:
_has_array_ability
,_ensure_sheet_index
, andget_by_index
methods (oxt/pythonpath/libre_pythonista_lib/cell/array/array_mgr.py
) [1] (oxt/pythonpath/libre_pythonista_lib/code/cell_cache.py
) [2] [3].Improved Error Handling:
oxt/pythonpath/libre_pythonista_lib/cell/array/array_mgr.py
).Code Refactoring:
lp
Function:lp
function into multiple helper functions (_handle_cell_only
,_handle_sheet_cell
,_handle_range_only
,_handle_sheet_range_only
,_handle_named_range_only
,_handle_sheet_named_range_only
) to handle different types of inputs more cleanly (oxt/pythonpath/libre_pythonista_lib/code/mod_helper/lp_mod.py
) [1] [2].Miscellaneous:
cspell.json
configuration file to improve spell-checking accuracy (cspell.json
) [1] [2].