Skip to content

Commit 5ffd590

Browse files
committed
fix: Resolve CI linting and formatting issues
Fixed all flake8 and black formatting issues to ensure clean CI runs. Changes: - Applied black formatting to 4 files - Removed unused sys import in test_mixing_formula.py - Removed duplicate imports in test files - Fixed f-strings without placeholders (F541) - All 63 tests passing - All flake8 checks passing - All black formatting checks passing CI Status: ✅ Critical errors: 0 ✅ Flake8 warnings: 0 ✅ Black formatting: PASSED ✅ Tests: 63 passed, 0 failed
1 parent cf53b31 commit 5ffd590

File tree

6 files changed

+452
-398
lines changed

6 files changed

+452
-398
lines changed

demo_semantic_naming.py

Lines changed: 31 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@
44
Shows practical application of the validated mixing formula
55
"""
66

7-
from harmonizer.divine_invitation_engine_V2 import DivineInvitationSemanticEngine, Coordinates
7+
from harmonizer.divine_invitation_engine_V2 import (
8+
DivineInvitationSemanticEngine,
9+
Coordinates,
10+
)
811
from harmonizer.semantic_naming import SemanticNamingEngine
912

1013

@@ -31,12 +34,16 @@ def demo_1_detect_and_suggest():
3134
print(f"\nIntent (function name): {intent_result.coordinates}")
3235
print(f"Execution (body): {execution_result.coordinates}")
3336

34-
distance = engine.get_distance(intent_result.coordinates, execution_result.coordinates)
37+
distance = engine.get_distance(
38+
intent_result.coordinates, execution_result.coordinates
39+
)
3540
print(f"Disharmony distance: {distance:.3f} ⚠️ HIGH!")
3641

3742
# Suggest better names based on actual execution
3843
print("\n✅ SUGGESTED FIXES based on execution semantics:")
39-
suggestions = namer.suggest_names(execution_result.coordinates, context="user", top_n=5)
44+
suggestions = namer.suggest_names(
45+
execution_result.coordinates, context="user", top_n=5
46+
)
4047

4148
for name, score in suggestions:
4249
print(f" • {name:25s} (match: {score:.1%})")
@@ -68,7 +75,8 @@ def demo_2_generate_from_intent():
6875

6976
# Show what the function should do
7077
print("\n📋 Generated function skeleton:")
71-
print(f"""
78+
print(
79+
f"""
7280
def {suggestions[0][0]}(user_input):
7381
'''
7482
{namer.explain_coordinates(result.coordinates)}
@@ -87,7 +95,8 @@ def {suggestions[0][0]}(user_input):
8795
)
8896
8997
return ValidationResult(valid=True)
90-
""")
98+
"""
99+
)
91100

92101

93102
def demo_3_refactoring_suggestion():
@@ -101,7 +110,8 @@ def demo_3_refactoring_suggestion():
101110

102111
# Analyze a multi-purpose function
103112
print("\n⚠️ PROBLEMATIC CODE (does too much):")
104-
print("""
113+
print(
114+
"""
105115
def process_user(user_data):
106116
# Validation (Justice)
107117
if not user_data.is_valid:
@@ -118,15 +128,16 @@ def process_user(user_data):
118128
119129
# Analytics (Wisdom)
120130
log_user_metrics(user_data)
121-
""")
131+
"""
132+
)
122133

123134
# Analyze each operation
124135
operations = {
125-
'validation': 'validate user data',
126-
'transformation': 'transform data',
127-
'storage': 'save database',
128-
'notification': 'send email',
129-
'analytics': 'log metrics'
136+
"validation": "validate user data",
137+
"transformation": "transform data",
138+
"storage": "save database",
139+
"notification": "send email",
140+
"analytics": "log metrics",
130141
}
131142

132143
print("\n🔍 SEMANTIC ANALYSIS OF OPERATIONS:")
@@ -143,9 +154,9 @@ def process_user(user_data):
143154

144155
# Group by semantic similarity
145156
groups = {
146-
'validation': ['validation'],
147-
'processing': ['transformation', 'storage'],
148-
'notification': ['notification', 'analytics']
157+
"validation": ["validation"],
158+
"processing": ["transformation", "storage"],
159+
"notification": ["notification", "analytics"],
149160
}
150161

151162
for group_name, ops in groups.items():
@@ -155,11 +166,11 @@ def process_user(user_data):
155166
love=sum(coords_map[op].love for op in ops) / len(ops),
156167
justice=sum(coords_map[op].justice for op in ops) / len(ops),
157168
power=sum(coords_map[op].power for op in ops) / len(ops),
158-
wisdom=sum(coords_map[op].wisdom for op in ops) / len(ops)
169+
wisdom=sum(coords_map[op].wisdom for op in ops) / len(ops),
159170
)
160171

161172
suggestions = namer.suggest_names(group_coords, context="user", top_n=3)
162-
print(f" Suggested names:")
173+
print(" Suggested names:")
163174
for name, score in suggestions:
164175
print(f" • {name} (match: {score:.1%})")
165176

@@ -205,7 +216,9 @@ def demo_4_code_review():
205216
# Suggest better name
206217
suggestions = namer.suggest_names(actual.coordinates, top_n=1)
207218
if suggestions:
208-
print(f" 💡 Suggest: {suggestions[0][0]} (match: {suggestions[0][1]:.1%})")
219+
print(
220+
f" 💡 Suggest: {suggestions[0][0]} (match: {suggestions[0][1]:.1%})"
221+
)
209222
print()
210223

211224

0 commit comments

Comments
 (0)