fix: refactor code for codacy#446
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request refactors how configuration and module imports are handled throughout the BioThings CLI codebase. The main improvement is the introduction of a new
get_biothings_confighelper function, which standardizes and centralizes the way the configuration module is accessed. Additionally, dynamic imports are now used in several places to delay importing modules and attributes until they are needed, improving modularity and potentially reducing import-time errors. Minor code style and error handling improvements are also included.Configuration and Import Handling Improvements:
get_biothings_configfunction indecorators.pyto standardize access to thebiothings.configmodule, replacing direct imports in multiple files and functions. [1] [2] [3] [4] [5]operations.pywith calls toget_biothings_configand dynamic imports via a new_load_attrhelper, improving modularity and reducing upfront dependencies. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13]Code Style and Error Handling:
get_code_for_mod_nameby chaining exceptions for clearer tracebacks.Dependency and Import Cleanup:
mongo_build_cleanup.py, improving clarity and reducing redundancy. [1] [2] [3] [4]These changes collectively improve the maintainability and robustness of the CLI codebase by centralizing configuration access, reducing tight coupling between modules, and enhancing error reporting.