Add type annotations to core modules#223
Merged
Merged
Conversation
Adds type hints to public API methods across all core modules: - __init__.py: load_config(), global variables - main.py: DataCollector and GitDataCollector methods - report_creator.py: HTMLReportCreator methods and helpers - utils.py: All utility functions Also fixes parameter naming: - get_keys_sorted_by_values: dict -> d (no longer shadows builtin) - DataCollector.collect: dir -> repo_dir (no longer shadows builtin) Closes #215, #211
✅ Deploy Preview for shenxianpeng-gitstats ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
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.



Summary
Adds type hints to public API methods across all core modules.
Changes
__init__.pyload_config(): parameter and return typeexectime_internal,exectime_external,ON_LINUX,WEEKDAYS,_configmain.pyDataCollector:__init__,collect,load_cache,save_cache,get_stamp_created, and allget_*()methodsGitDataCollector:collect,refinedir→repo_dirparameter naming ("dir" parameter shadows builtin in DataCollector.collect() #215)report_creator.pyReportCreator:createHTMLReportCreator:create,create_*_html(),get_ai_summary_html(),_render_chartjs()html_header,html_linkify,get_keys_sorted_by_values,get_keys_sorted_by_value_keydict→dparameter naming inget_keys_sorted_by_valuesutils.pycount_lines_in_text,filter_lines_by_pattern,get_version,get_git_version,get_pipe_output,get_commit_range,get_excluded_extensions,should_exclude_file,get_num_of_lines_in_blob,get_num_of_files_from_rev,get_stat_summary_counts,get_log_range143 tests pass.
Closes #211, #215
📚 Documentation preview 📚: https://gitstats--223.org.readthedocs.build/