greenmining 1.0.1__py3-none-any.whl → 1.0.2__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.
- greenmining/__version__.py +1 -1
- greenmining/services/commit_extractor.py +12 -8
- greenmining/services/data_aggregator.py +8 -2
- {greenmining-1.0.1.dist-info → greenmining-1.0.2.dist-info}/METADATA +1 -1
- {greenmining-1.0.1.dist-info → greenmining-1.0.2.dist-info}/RECORD +9 -9
- {greenmining-1.0.1.dist-info → greenmining-1.0.2.dist-info}/WHEEL +0 -0
- {greenmining-1.0.1.dist-info → greenmining-1.0.2.dist-info}/entry_points.txt +0 -0
- {greenmining-1.0.1.dist-info → greenmining-1.0.2.dist-info}/licenses/LICENSE +0 -0
- {greenmining-1.0.1.dist-info → greenmining-1.0.2.dist-info}/top_level.txt +0 -0
greenmining/__version__.py
CHANGED
|
@@ -12,6 +12,7 @@ from github import Github
|
|
|
12
12
|
from tqdm import tqdm
|
|
13
13
|
|
|
14
14
|
from greenmining.config import get_config
|
|
15
|
+
from greenmining.models.repository import Repository
|
|
15
16
|
from greenmining.utils import (
|
|
16
17
|
colored_print,
|
|
17
18
|
format_timestamp,
|
|
@@ -49,11 +50,11 @@ class CommitExtractor:
|
|
|
49
50
|
self.github = Github(github_token) if github_token else None
|
|
50
51
|
self.timeout = timeout
|
|
51
52
|
|
|
52
|
-
def extract_from_repositories(self, repositories: list[dict[str, Any]]) -> list[dict[str, Any]]:
|
|
53
|
+
def extract_from_repositories(self, repositories: list[dict[str, Any] | Repository]) -> list[dict[str, Any]]:
|
|
53
54
|
"""Extract commits from list of repositories.
|
|
54
55
|
|
|
55
56
|
Args:
|
|
56
|
-
repositories: List of repository metadata
|
|
57
|
+
repositories: List of repository metadata (dicts or Repository objects)
|
|
57
58
|
|
|
58
59
|
Returns:
|
|
59
60
|
List of commit data dictionaries
|
|
@@ -89,15 +90,17 @@ class CommitExtractor:
|
|
|
89
90
|
pbar.update(1)
|
|
90
91
|
except TimeoutError:
|
|
91
92
|
signal.alarm(0) # Cancel alarm
|
|
93
|
+
repo_name = repo.full_name if isinstance(repo, Repository) else repo["full_name"]
|
|
92
94
|
colored_print(
|
|
93
|
-
f"\nTimeout processing {
|
|
95
|
+
f"\nTimeout processing {repo_name} (>{self.timeout}s)", "yellow"
|
|
94
96
|
)
|
|
95
|
-
failed_repos.append(
|
|
97
|
+
failed_repos.append(repo_name)
|
|
96
98
|
pbar.update(1)
|
|
97
99
|
except Exception as e:
|
|
98
100
|
signal.alarm(0) # Cancel alarm
|
|
99
|
-
|
|
100
|
-
|
|
101
|
+
repo_name = repo.full_name if isinstance(repo, Repository) else repo["full_name"]
|
|
102
|
+
colored_print(f"\nError processing {repo_name}: {e}", "yellow")
|
|
103
|
+
failed_repos.append(repo_name)
|
|
101
104
|
pbar.update(1)
|
|
102
105
|
|
|
103
106
|
if failed_repos:
|
|
@@ -114,13 +117,14 @@ class CommitExtractor:
|
|
|
114
117
|
"""Extract commits from a single repository using GitHub API.
|
|
115
118
|
|
|
116
119
|
Args:
|
|
117
|
-
repo: Repository metadata
|
|
120
|
+
repo: Repository metadata (dict or Repository object)
|
|
118
121
|
|
|
119
122
|
Returns:
|
|
120
123
|
List of commit dictionaries
|
|
121
124
|
"""
|
|
122
125
|
commits = []
|
|
123
|
-
|
|
126
|
+
# Handle both Repository objects and dicts
|
|
127
|
+
repo_name = repo.full_name if isinstance(repo, Repository) else repo["full_name"]
|
|
124
128
|
|
|
125
129
|
try:
|
|
126
130
|
# Get repository from GitHub API
|
|
@@ -16,6 +16,7 @@ from greenmining.analyzers import (
|
|
|
16
16
|
QualitativeAnalyzer,
|
|
17
17
|
)
|
|
18
18
|
from greenmining.config import get_config
|
|
19
|
+
from greenmining.models.repository import Repository
|
|
19
20
|
from greenmining.utils import (
|
|
20
21
|
colored_print,
|
|
21
22
|
format_number,
|
|
@@ -270,8 +271,13 @@ class DataAggregator:
|
|
|
270
271
|
self, results: list[dict[str, Any]], repos: list[dict[str, Any]]
|
|
271
272
|
) -> list[dict[str, Any]]:
|
|
272
273
|
"""Generate per-language statistics."""
|
|
273
|
-
# Create repo name to language mapping
|
|
274
|
-
repo_language_map = {
|
|
274
|
+
# Create repo name to language mapping (handle both Repository objects and dicts)
|
|
275
|
+
repo_language_map = {}
|
|
276
|
+
for repo in repos:
|
|
277
|
+
if isinstance(repo, Repository):
|
|
278
|
+
repo_language_map[repo.full_name] = repo.language or "Unknown"
|
|
279
|
+
else:
|
|
280
|
+
repo_language_map[repo["full_name"]] = repo.get("language", "Unknown")
|
|
275
281
|
|
|
276
282
|
# Group commits by language
|
|
277
283
|
language_commits = defaultdict(list)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
greenmining/__init__.py,sha256=c_Vaq_WW6-SkI_es4cQKXpdEtXdfVEnGjIDxACF6bzk,1764
|
|
2
2
|
greenmining/__main__.py,sha256=1RwcSXcwdza6xJX5fRT8-HhZjlnKbkmGY_uxTm-NYZ4,138
|
|
3
|
-
greenmining/__version__.py,sha256=
|
|
3
|
+
greenmining/__version__.py,sha256=3OgUZ5K2OXa9_-2kjlgye1N6G_QeQDeex2uw33Ja6Cs,66
|
|
4
4
|
greenmining/cli.py,sha256=40eKDEZHNeDVb91xKBG70VfPk45mwb4YjuVCC2efVPA,17458
|
|
5
5
|
greenmining/config.py,sha256=1_puT52zNS589hTxEZ3UCqRC_Qw5Jw2UupUPNbNz_hs,5195
|
|
6
6
|
greenmining/gsf_patterns.py,sha256=Prsk_stnQrfOsk0x0zn-zdevbueAnPfGDM4XNA9PbdA,54664
|
|
@@ -23,14 +23,14 @@ greenmining/models/repository.py,sha256=k1X9UYZYLl0RznohOHx_Y5wur-ZBvLcNyc9vPVAr
|
|
|
23
23
|
greenmining/presenters/__init__.py,sha256=-ukAvhNuTvy1Xpknps0faDZ78HKdPHPySzFpQHABzKM,203
|
|
24
24
|
greenmining/presenters/console_presenter.py,sha256=ykJ9Hgors2dRTqQNaqCTxH4fd49F0AslQTgUOr_csI0,5347
|
|
25
25
|
greenmining/services/__init__.py,sha256=7CJDjHMTrY0bBoqzx22AUzIwEvby0FbAUUKYbjSlNPQ,460
|
|
26
|
-
greenmining/services/commit_extractor.py,sha256=
|
|
27
|
-
greenmining/services/data_aggregator.py,sha256=
|
|
26
|
+
greenmining/services/commit_extractor.py,sha256=FSgoHpMvoqjZ6b1UQYtwfUaLVX_GDfiR0BVd51y-gYk,13126
|
|
27
|
+
greenmining/services/data_aggregator.py,sha256=OqJvQZp9xaZaSmbwWoiHAHECAghd8agbhVmStDvebOU,24054
|
|
28
28
|
greenmining/services/data_analyzer.py,sha256=HZDQLFZDCwCUGIzRjypyXC09Fl_-zaxhly74n3siwQc,16325
|
|
29
29
|
greenmining/services/github_fetcher.py,sha256=J47-plM_NKXwHDSWNBuSUZMnZnGP6wXiJyrVfeWT9ug,11360
|
|
30
30
|
greenmining/services/reports.py,sha256=NCNI9SCTnSLeAO8WmkNIdkB0hr-XyVpuzV0sovOoUOM,27107
|
|
31
|
-
greenmining-1.0.
|
|
32
|
-
greenmining-1.0.
|
|
33
|
-
greenmining-1.0.
|
|
34
|
-
greenmining-1.0.
|
|
35
|
-
greenmining-1.0.
|
|
36
|
-
greenmining-1.0.
|
|
31
|
+
greenmining-1.0.2.dist-info/licenses/LICENSE,sha256=M7ma3JHGeiIZIs3ea0HTcFl_wLFPX2NZElUliYs4bCA,1083
|
|
32
|
+
greenmining-1.0.2.dist-info/METADATA,sha256=vTygz3S30HRdkpHdMIiD-jau6Lx60VcPsf3OSSBeL0w,25694
|
|
33
|
+
greenmining-1.0.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
34
|
+
greenmining-1.0.2.dist-info/entry_points.txt,sha256=oHvTWMzNFGf2W3CFEKVVPsG4exeMv0MaQu9YsUoQ9lw,53
|
|
35
|
+
greenmining-1.0.2.dist-info/top_level.txt,sha256=nreXgXxZIWI-42yQknQ0HXtUrFnzZ8N1ra4Mdy2KcsI,12
|
|
36
|
+
greenmining-1.0.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|