git_author_stats
Frequency
dataclass
A frequency of time.
Source code in src/git_author_stats/_stats.py
350 351 352 353 354 355 356 357 |
|
FrequencyUnit
Bases: enum.Enum
A unit of time.
Source code in src/git_author_stats/_stats.py
339 340 341 342 343 344 345 346 347 |
|
Stats
dataclass
This object represents metrics obtained from the output of
git log --numstat
. Each record is unique when grouped by
url + commit + author_name + file. The fields since
and before
are provided as a convenience for easy aggregation of stats, but do not
provide any additional information about the commit or file.
Properties:
- url (str): The URL of the repository
- since (date|None): The start date for a pre-defined time period by which these metrics will be analyzed
- before (date|None): The end date (non-inclusive) for a pre-defined time period by which these metrics will be analyzed
- author_date (datetime|None): The date and time of the author's commit
- author_name (str): The name of the author
- commit (str): The abbreviated commit hash
- file (str): The file path
- insertions (int): The number of lines inserted in this commit
- deletions (int): The number of lines deleted in this commit
Source code in src/git_author_stats/_stats.py
398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 |
|
iter_stats
iter_stats(
urls: str | collections.abc.Iterable[str],
user: str = "",
password: str = "",
since: datetime.date | None = None,
after: datetime.date | None = None,
before: datetime.date | None = None,
until: datetime.date | None = None,
frequency: (
str | git_author_stats._stats.Frequency | None
) = None,
*,
no_mailmap: bool = False
) -> collections.abc.Iterable[
git_author_stats._stats.Stats
]
Yield stats for all specified repositories, by author, for the specified time period and frequency (if provided).
Parameters:
- urls (str|[str]): One or more git URLs, as you would pass to
git clone
, or the URL of a Github organization - user (str) = "": A username with which to authenticate. Note: If neither user name nor password are provided, the default system configuration will be used.
- password (str) = "": A password/token with which to authenticate.
- since (date|None) = None: If provided, only yield stats after this date
- before (date|None) = None: If provided, only yield stats before this date
- frequency (str|Frequency|None) = None: If provided, yield stats
broken down by the specified frequency. For example, if
frequency
is "1 week", stats will be yielded for each week in the specified time, starting withsince
and ending withbefore
(if provided). - no_mailmap (bool) = False: If
True
, do not use the mailmap file
Source code in src/git_author_stats/_stats.py
702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 |
|
write_stats
write_stats(
stats: collections.abc.Iterable[
git_author_stats._stats.Stats
],
file: str | pathlib.Path | typing.TextIO,
*,
no_header: bool = False,
delimiter: str = "",
markdown: bool | None = None
) -> None
Write stats for all specified repositories, by author, for the specified time period and frequency (if provided), to a CSV file.
Parameters:
- stats (typing.Iterable[git_author_stats.Stats]): The stats to write
- file (str|pathlib.Path|typing.TextIO): A file path or file-like object
- delimiter (str) = "": The delimiter to use for CSV/TSV output. If not provided, the delimiter will be inferred based on the file extension if possible, otherwise it will default to ",".
- markdown (bool|None) = None: If
True
, a markdown table will be written. IfFalse
, a CSV/TSV file will be written. IfNone
, the output format will be inferred based on the file's extension. - no_header (bool) = False: Do not include a header in the output
Source code in src/git_author_stats/_stats.py
852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 |
|