We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a3e46c0 commit 70971c4Copy full SHA for 70971c4
gitstats/__init__.py
@@ -26,18 +26,26 @@
26
}
27
28
29
+_config = None
30
+
31
32
def load_config(file_path="gitstats.conf") -> dict:
33
"""Load configuration from a file, or fall back to defaults."""
34
import configparser
35
import os
36
- config = DEFAULT_CONFIG.copy() # Start with defaults
37
+ global _config
38
39
+ if _config is not None:
40
+ return _config
41
42
+ _config = DEFAULT_CONFIG.copy() # Start with defaults
43
config_parser = configparser.ConfigParser()
44
45
if os.path.exists(file_path):
46
config_parser.read(file_path)
- config = {
47
+ _config = {
48
k: int(v) if v.isdigit() else v
49
for k, v in config_parser["gitstats"].items()
50
- return config
51
0 commit comments