gitstats 0.4.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
gitstats/__init__.py ADDED
@@ -0,0 +1,47 @@
1
+ # Copyright (c) 2024-present Xianpeng Shen <xianpeng.shen@gmail.com>.
2
+ # GPLv2 / GPLv3
3
+ import platform
4
+ import time
5
+ from importlib.metadata import version
6
+
7
+ exectime_internal = 0.0
8
+ exectime_external = 0.0
9
+ time_start = time.time()
10
+
11
+ GNUPLOT_COMMON = "set terminal png transparent size 640,240\nset size 1.0,1.0\n"
12
+ ON_LINUX = platform.system() == "Linux"
13
+ WEEKDAYS = ("Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun")
14
+
15
+ DEFAULT_CONFIG = {
16
+ "max_domains": 10, # Maximum number of domains to display in "Domains by Commits".
17
+ "max_ext_length": 10, # Maximum length of file extensions shown in statistics.
18
+ "style": "gitstats.css", # CSS stylesheet for the generated report.
19
+ "max_authors": 20, # Maximum number of authors to list in "Authors".
20
+ "authors_top": 5, # Number of top authors to highlight.
21
+ "commit_begin": "", # Start of commit range (empty = include all commits).
22
+ "commit_end": "HEAD", # End of commit range (default: HEAD).
23
+ "linear_linestats": 1, # Enable linear history for line statistics (1 = enabled, 0 = disabled).
24
+ "project_name": "", # Project name to display (default: repository directory name).
25
+ "processes": 8, # Number of parallel processes to use when gathering data.
26
+ "start_date": "", # Starting date for commits, passed as --since to Git (optional).
27
+ }
28
+
29
+
30
+ def load_config(file_path="gitstats.conf") -> dict:
31
+ """Load configuration from a file, or fall back to defaults."""
32
+ import configparser
33
+ import os
34
+
35
+ config = DEFAULT_CONFIG.copy() # Start with defaults
36
+ config_parser = configparser.ConfigParser()
37
+
38
+ if os.path.exists(file_path):
39
+ config_parser.read(file_path)
40
+ config = {
41
+ k: int(v) if v.isdigit() else v
42
+ for k, v in config_parser["gitstats"].items()
43
+ }
44
+ return config
45
+
46
+
47
+ __version__ = version("gitstats")
Binary file
Binary file
gitstats/arrow-up.gif ADDED
Binary file
gitstats/gitstats.css ADDED
@@ -0,0 +1,145 @@
1
+ /**
2
+ * GitStats - default style
3
+ */
4
+ body {
5
+ color: black;
6
+ background-color: #ffffff;
7
+ }
8
+
9
+ dt {
10
+ font-weight: bold;
11
+ float: left;
12
+ margin-right: 1em;
13
+ }
14
+
15
+ dt:after {
16
+ content: ': ';
17
+ }
18
+
19
+ dd {
20
+ display: block;
21
+ clear: left;
22
+ }
23
+
24
+ table {
25
+ border: 1px solid black;
26
+ border-collapse: collapse;
27
+ font-size: 80%;
28
+ margin-bottom: 1em;
29
+ }
30
+
31
+ table.noborders {
32
+ border: none;
33
+ }
34
+
35
+ table.noborders td {
36
+ border: none;
37
+ }
38
+
39
+ .vtable {
40
+ float: right;
41
+ clear: both;
42
+ }
43
+
44
+ table.tags td {
45
+ vertical-align: top;
46
+ }
47
+
48
+ td {
49
+ background-color: white;
50
+ }
51
+
52
+ th {
53
+ background-color: #ddf;
54
+ }
55
+
56
+ th a {
57
+ text-decoration: none;
58
+ }
59
+
60
+ tr:hover {
61
+ background-color: #ddf;
62
+ }
63
+
64
+ td {
65
+ border: 1px solid black;
66
+ padding: 0.2em;
67
+ padding-left: 0.3em;
68
+ padding-right: 0.2em;
69
+ }
70
+
71
+ /* Navigation bar; tabbed style */
72
+ .nav {
73
+ border-bottom: 1px solid black;
74
+ padding: 0.3em;
75
+ }
76
+
77
+ .nav ul {
78
+ list-style-type: none;
79
+ display: inline;
80
+ margin: 0;
81
+ padding: 0;
82
+ }
83
+
84
+ .nav li {
85
+ display: inline;
86
+ }
87
+
88
+ .nav li a {
89
+ padding: 0.3em;
90
+ text-decoration: none;
91
+ color: black;
92
+ border: 1px solid black;
93
+ margin: 0.5em;
94
+ background-color: #ddf;
95
+ }
96
+
97
+ .nav li a:hover {
98
+ background-color: #ddd;
99
+ border-bottom: 1px solid #ddf;
100
+ }
101
+
102
+ img {
103
+ border: 1px solid black;
104
+ padding: 0.5em;
105
+ background-color: white;
106
+ }
107
+
108
+ th img {
109
+ border: 0px;
110
+ padding: 0px;
111
+ background-color: #ddf;
112
+ }
113
+
114
+ h1 a, h2 a {
115
+ color: black;
116
+ text-decoration: none;
117
+ }
118
+
119
+ h1:hover a:after,
120
+ h2:hover a:after {
121
+ content: '¶';
122
+ color: #555;
123
+ }
124
+
125
+ h1 {
126
+ font-size: x-large;
127
+ }
128
+
129
+ h2 {
130
+ background-color: #564;
131
+ border: 1px solid black;
132
+ padding-left: 0.5em;
133
+ padding-right: 0.5em;
134
+ color: white;
135
+ font-size: large;
136
+ clear: both;
137
+ }
138
+
139
+ h2 a {
140
+ color: white;
141
+ }
142
+
143
+ .moreauthors {
144
+ font-size: 80%;
145
+ }