greenmining 0.1.8__tar.gz → 0.1.10__tar.gz
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-0.1.8/greenmining.egg-info → greenmining-0.1.10}/PKG-INFO +1 -1
- {greenmining-0.1.8 → greenmining-0.1.10}/greenmining/__init__.py +1 -1
- {greenmining-0.1.8 → greenmining-0.1.10}/greenmining/services/data_aggregator.py +29 -20
- {greenmining-0.1.8 → greenmining-0.1.10}/greenmining/services/data_analyzer.py +14 -9
- {greenmining-0.1.8 → greenmining-0.1.10/greenmining.egg-info}/PKG-INFO +1 -1
- {greenmining-0.1.8 → greenmining-0.1.10}/pyproject.toml +1 -1
- {greenmining-0.1.8 → greenmining-0.1.10}/CHANGELOG.md +0 -0
- {greenmining-0.1.8 → greenmining-0.1.10}/LICENSE +0 -0
- {greenmining-0.1.8 → greenmining-0.1.10}/MANIFEST.in +0 -0
- {greenmining-0.1.8 → greenmining-0.1.10}/README.md +0 -0
- {greenmining-0.1.8 → greenmining-0.1.10}/greenmining/__main__.py +0 -0
- {greenmining-0.1.8 → greenmining-0.1.10}/greenmining/__version__.py +0 -0
- {greenmining-0.1.8 → greenmining-0.1.10}/greenmining/cli.py +0 -0
- {greenmining-0.1.8 → greenmining-0.1.10}/greenmining/config.py +0 -0
- {greenmining-0.1.8 → greenmining-0.1.10}/greenmining/controllers/__init__.py +0 -0
- {greenmining-0.1.8 → greenmining-0.1.10}/greenmining/controllers/repository_controller.py +0 -0
- {greenmining-0.1.8 → greenmining-0.1.10}/greenmining/gsf_patterns.py +0 -0
- {greenmining-0.1.8 → greenmining-0.1.10}/greenmining/main.py +0 -0
- {greenmining-0.1.8 → greenmining-0.1.10}/greenmining/models/__init__.py +0 -0
- {greenmining-0.1.8 → greenmining-0.1.10}/greenmining/models/aggregated_stats.py +0 -0
- {greenmining-0.1.8 → greenmining-0.1.10}/greenmining/models/analysis_result.py +0 -0
- {greenmining-0.1.8 → greenmining-0.1.10}/greenmining/models/commit.py +0 -0
- {greenmining-0.1.8 → greenmining-0.1.10}/greenmining/models/repository.py +0 -0
- {greenmining-0.1.8 → greenmining-0.1.10}/greenmining/presenters/__init__.py +0 -0
- {greenmining-0.1.8 → greenmining-0.1.10}/greenmining/presenters/console_presenter.py +0 -0
- {greenmining-0.1.8 → greenmining-0.1.10}/greenmining/services/__init__.py +0 -0
- {greenmining-0.1.8 → greenmining-0.1.10}/greenmining/services/commit_extractor.py +0 -0
- {greenmining-0.1.8 → greenmining-0.1.10}/greenmining/services/github_fetcher.py +0 -0
- {greenmining-0.1.8 → greenmining-0.1.10}/greenmining/services/reports.py +0 -0
- {greenmining-0.1.8 → greenmining-0.1.10}/greenmining/utils.py +0 -0
- {greenmining-0.1.8 → greenmining-0.1.10}/greenmining.egg-info/SOURCES.txt +0 -0
- {greenmining-0.1.8 → greenmining-0.1.10}/greenmining.egg-info/dependency_links.txt +0 -0
- {greenmining-0.1.8 → greenmining-0.1.10}/greenmining.egg-info/entry_points.txt +0 -0
- {greenmining-0.1.8 → greenmining-0.1.10}/greenmining.egg-info/requires.txt +0 -0
- {greenmining-0.1.8 → greenmining-0.1.10}/greenmining.egg-info/top_level.txt +0 -0
- {greenmining-0.1.8 → greenmining-0.1.10}/pytest.ini +0 -0
- {greenmining-0.1.8 → greenmining-0.1.10}/setup.cfg +0 -0
- {greenmining-0.1.8 → greenmining-0.1.10}/setup.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: greenmining
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.10
|
|
4
4
|
Summary: Analyze GitHub repositories to identify green software engineering patterns and energy-efficient practices
|
|
5
5
|
Author-email: Your Name <your.email@example.com>
|
|
6
6
|
Maintainer-email: Your Name <your.email@example.com>
|
|
@@ -72,7 +72,7 @@ class DataAggregator:
|
|
|
72
72
|
green_aware_count = sum(1 for r in results if r.get("green_aware", False))
|
|
73
73
|
|
|
74
74
|
# Count repos with at least one green commit
|
|
75
|
-
repos_with_green = len({r["
|
|
75
|
+
repos_with_green = len({r["repository"] for r in results if r.get("green_aware", False)})
|
|
76
76
|
|
|
77
77
|
return {
|
|
78
78
|
"total_commits": total_commits,
|
|
@@ -91,17 +91,24 @@ class DataAggregator:
|
|
|
91
91
|
)
|
|
92
92
|
|
|
93
93
|
for result in results:
|
|
94
|
-
|
|
95
|
-
|
|
94
|
+
# Handle both gsf_patterns_matched (list) and known_pattern (string)
|
|
95
|
+
patterns = result.get("gsf_patterns_matched", [])
|
|
96
|
+
if not patterns: # Fallback to old format
|
|
97
|
+
pattern = result.get("known_pattern")
|
|
98
|
+
if pattern and pattern != "NONE DETECTED":
|
|
99
|
+
patterns = [pattern]
|
|
96
100
|
|
|
97
|
-
|
|
101
|
+
confidence = result.get("confidence", result.get("pattern_confidence", "low")).upper()
|
|
102
|
+
|
|
103
|
+
for pattern in patterns:
|
|
98
104
|
pattern_data[pattern]["count"] += 1
|
|
99
105
|
if confidence in ["HIGH", "MEDIUM", "LOW"]:
|
|
100
106
|
pattern_data[pattern][confidence] += 1
|
|
101
107
|
|
|
102
108
|
# Store example commits (max 3)
|
|
103
109
|
if len(pattern_data[pattern]["example_commits"]) < 3:
|
|
104
|
-
|
|
110
|
+
commit_id = result.get("commit_hash", result.get("commit_id", "unknown"))
|
|
111
|
+
pattern_data[pattern]["example_commits"].append(commit_id)
|
|
105
112
|
|
|
106
113
|
# Convert to list format
|
|
107
114
|
patterns_list = []
|
|
@@ -153,15 +160,21 @@ class DataAggregator:
|
|
|
153
160
|
|
|
154
161
|
# Group commits by repository
|
|
155
162
|
for result in results:
|
|
156
|
-
repo_commits[result["
|
|
163
|
+
repo_commits[result["repository"]].append(result)
|
|
157
164
|
|
|
158
165
|
# Calculate stats for each repo
|
|
159
166
|
repo_stats = []
|
|
160
167
|
for repo_name, commits in repo_commits.items():
|
|
161
168
|
green_commits = [c for c in commits if c.get("green_aware", False)]
|
|
162
|
-
patterns
|
|
163
|
-
|
|
164
|
-
|
|
169
|
+
# Get all patterns from commits (gsf_patterns_matched is a list)
|
|
170
|
+
patterns = []
|
|
171
|
+
for c in commits:
|
|
172
|
+
patterns_list = c.get("gsf_patterns_matched", [])
|
|
173
|
+
if not patterns_list: # Fallback
|
|
174
|
+
pattern = c.get("known_pattern")
|
|
175
|
+
if pattern and pattern != "NONE DETECTED":
|
|
176
|
+
patterns_list = [pattern]
|
|
177
|
+
patterns.extend(patterns_list)
|
|
165
178
|
unique_patterns = list(set(patterns))
|
|
166
179
|
|
|
167
180
|
repo_stats.append(
|
|
@@ -191,7 +204,7 @@ class DataAggregator:
|
|
|
191
204
|
# Group commits by language
|
|
192
205
|
language_commits = defaultdict(list)
|
|
193
206
|
for result in results:
|
|
194
|
-
language = repo_language_map.get(result["
|
|
207
|
+
language = repo_language_map.get(result["repository"], "Unknown")
|
|
195
208
|
language_commits[language].append(result)
|
|
196
209
|
|
|
197
210
|
# Calculate stats for each language
|
|
@@ -239,18 +252,14 @@ class DataAggregator:
|
|
|
239
252
|
for result in analysis_results:
|
|
240
253
|
csv_data.append(
|
|
241
254
|
{
|
|
242
|
-
"
|
|
243
|
-
"repo_name": result
|
|
255
|
+
"commit_hash": result.get("commit_hash", result.get("commit_id", "")),
|
|
256
|
+
"repo_name": result.get("repository", ""),
|
|
244
257
|
"date": result.get("date", ""),
|
|
245
|
-
"
|
|
258
|
+
"message": result.get("message", "")[:200], # Truncate
|
|
246
259
|
"green_aware": result.get("green_aware", False),
|
|
247
|
-
"
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
else ""
|
|
251
|
-
),
|
|
252
|
-
"known_pattern": result.get("known_pattern", ""),
|
|
253
|
-
"pattern_confidence": result.get("pattern_confidence", ""),
|
|
260
|
+
"gsf_patterns": ", ".join(result.get("gsf_patterns_matched", [])),
|
|
261
|
+
"pattern_count": result.get("pattern_count", 0),
|
|
262
|
+
"confidence": result.get("confidence", ""),
|
|
254
263
|
"lines_added": result.get("lines_added", 0),
|
|
255
264
|
"lines_deleted": result.get("lines_deleted", 0),
|
|
256
265
|
}
|
|
@@ -114,8 +114,8 @@ class DataAnalyzer:
|
|
|
114
114
|
return {
|
|
115
115
|
"commit_hash": commit.get("hash", commit.get("commit_id", "unknown")),
|
|
116
116
|
"repository": commit.get("repository", commit.get("repo_name", "unknown")),
|
|
117
|
-
"author": commit.get("author_name", "unknown"),
|
|
118
|
-
"date": commit.get("
|
|
117
|
+
"author": commit.get("author", commit.get("author_name", "unknown")),
|
|
118
|
+
"date": commit.get("date", commit.get("author_date", "unknown")),
|
|
119
119
|
"message": message,
|
|
120
120
|
# Research Question 1: Green awareness
|
|
121
121
|
"green_aware": green_aware,
|
|
@@ -125,10 +125,9 @@ class DataAnalyzer:
|
|
|
125
125
|
"pattern_details": pattern_details,
|
|
126
126
|
"confidence": confidence,
|
|
127
127
|
# Additional metadata
|
|
128
|
-
"files_modified": commit.get("
|
|
129
|
-
"insertions": commit.get("
|
|
130
|
-
"deletions": commit.get("
|
|
131
|
-
"lines_deleted": commit.get("lines_deleted", 0),
|
|
128
|
+
"files_modified": commit.get("files_changed", commit.get("modified_files", [])),
|
|
129
|
+
"insertions": commit.get("lines_added", commit.get("insertions", 0)),
|
|
130
|
+
"deletions": commit.get("lines_deleted", commit.get("deletions", 0)),
|
|
132
131
|
}
|
|
133
132
|
|
|
134
133
|
def _check_green_awareness(self, message: str, files: list[str]) -> tuple[bool, Optional[str]]:
|
|
@@ -205,9 +204,15 @@ class DataAnalyzer:
|
|
|
205
204
|
"""
|
|
206
205
|
# Calculate summary statistics
|
|
207
206
|
green_aware_count = sum(1 for r in results if r["green_aware"])
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
207
|
+
|
|
208
|
+
# Count all matched patterns (results have gsf_patterns_matched which is a list)
|
|
209
|
+
all_patterns = []
|
|
210
|
+
for r in results:
|
|
211
|
+
patterns = r.get("gsf_patterns_matched", [])
|
|
212
|
+
if patterns: # If there are matched patterns
|
|
213
|
+
all_patterns.extend(patterns)
|
|
214
|
+
|
|
215
|
+
pattern_counts = Counter(all_patterns)
|
|
211
216
|
|
|
212
217
|
data = {
|
|
213
218
|
"metadata": {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: greenmining
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.10
|
|
4
4
|
Summary: Analyze GitHub repositories to identify green software engineering patterns and energy-efficient practices
|
|
5
5
|
Author-email: Your Name <your.email@example.com>
|
|
6
6
|
Maintainer-email: Your Name <your.email@example.com>
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "greenmining"
|
|
7
|
-
version = "0.1.
|
|
7
|
+
version = "0.1.10"
|
|
8
8
|
description = "Analyze GitHub repositories to identify green software engineering patterns and energy-efficient practices"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.9"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|