Skip to content

Commit 01caaf1

Browse files
committed
Clarify comments in contribution stat sorting funcs
1 parent f18c03c commit 01caaf1

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

git_py_stats/config.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,13 @@ def _parse_git_sort_by(raw: str) -> tuple[str, str]:
2020
Handles the following directions:
2121
- "asc" (default)
2222
- "desc"
23-
Returns (sort_by, sort_dir) normalized.
24-
Unknown metric -> 'name'; unknown dir -> 'asc'.
23+
24+
Args:
25+
Raw string
26+
27+
Returns:
28+
metric (str): The metric to sort by
29+
direction (str): Whether we want ascending or descending
2530
"""
2631
allowed_metrics = {"name", "commits", "insertions", "deletions", "lines"}
2732
metric = "name"
@@ -79,7 +84,7 @@ def get_config() -> Dict[str, Union[str, int]]:
7984
_GIT_LIMIT (int): Limits the git log output. Defaults to 10.
8085
_GIT_LOG_OPTIONS (str): Additional git log options. Default is empty.
8186
_GIT_DAYS (int): Defines number of days for the heatmap. Default is empty.
82-
_GIT_SORT_BY (str): Defines sorting direction for contribution stats.
87+
_GIT_SORT_BY (str): Defines sort metric and direction for contribution stats.
8388
Default is name-asc.
8489
_MENU_THEME (str): Toggles between the default theme and legacy theme.
8590
- 'legacy' to set the legacy theme

git_py_stats/generate_cmds.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ def _author_sort_key(item: Tuple[str, Dict[str, Any]], sort_by: str) -> Tuple:
1717
Helper function for detailed_git_stats to allow for easy sorting.
1818
1919
Args:
20-
item: (author_display_name, stats_dict)
21-
sort_by: one of 'name', 'commits', 'insertions', 'deletions', 'lines'
20+
item: Tuple[str, Dict[str, Any]]: author_display_name and stats_dict
21+
sort_by (str): 'name', 'commits', 'insertions', 'deletions', or 'lines'
2222
2323
Returns:
2424
A key suitable for sorting.

0 commit comments

Comments
 (0)