Skip to content

Commit 4135451

Browse files
authored
Merge pull request #4 from BruinGrowly/fix-harmonizer-bug-and-add-gitignore
chore: Fix CI configuration and apply code styling
2 parents 1916e8c + e1103e2 commit 4135451

File tree

3 files changed

+13
-8
lines changed

3 files changed

+13
-8
lines changed

examples/test_code.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,48 +4,53 @@
44
intentional, high disharmony.
55
"""
66

7+
78
# A (mock) database object to make the code valid
89
class MockDB:
910
def query(self, q: str):
1011
print(f"[DB] Querying: {q}")
1112
return {"user": "Test User"}
12-
13+
1314
def delete_user(self, token: str):
1415
print(f"[DB] DELETING USER WITH TOKEN: {token}")
1516
return True
1617

18+
1719
db = MockDB()
1820

1921
# --- A HARMONIOUS FUNCTION ---
2022

23+
2124
def get_user_by_id(user_id: int):
2225
"""
2326
Fetches, reads, and returns a user's information
2427
based on their ID. A 'wisdom' and 'information' task.
2528
"""
2629
if not user_id:
2730
return None
28-
31+
2932
# The execution (query, read, return) matches the
3033
# intent (get, information).
3134
user_data = db.query(f"SELECT * FROM users WHERE id = {user_id}")
3235
return user_data
3336

37+
3438
# --- A DISHARMONIOUS FUNCTION (THE "BUG") ---
3539

40+
3641
def check_user_permissions(user_token: str):
3742
"""
3843
This function's INTENT is to validate, check, and
3944
get information about a user's permissions.
4045
It should be a 'justice' and 'wisdom' task.
4146
"""
42-
47+
4348
# !! DISHARMONY !!
4449
# The EXECUTION is 'delete', a high 'power'/'force' concept.
4550
# The Harmonizer will detect the high semantic distance
4651
# between the "check" (Intent) and "delete" (Execution).
4752
print("Checking token... (but not really)")
4853
db.delete_user(token=user_token)
49-
54+
5055
# This 'return' of 'information' is deceptive.
51-
return "User Deleted"
56+
return "User Deleted"

src/divine_invitation_engine_V2.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -584,7 +584,7 @@ def analyze_ice(
584584

585585
def _calculate_ice_coordinate(
586586
self, intent: SemanticResult, context: SemanticResult, execution: SemanticResult
587-
) -> Coordinates:
587+
) -> Coordinates: # noqa: E501
588588
"""Calculate ICE coordinate from components"""
589589
return Coordinates(
590590
love=(

tests/test_engine.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ def test_semantic_clarity(engine):
9090

9191

9292
def test_semantic_analyzer_cluster(engine):
93-
"""Tests the semantic analyzer's ability to find the centroid of a concept cluster."""
93+
"""Tests the semantic analyzer's ability to find the centroid of a concept cluster.""" # noqa: E501
9494
concepts = ["love", "justice"]
9595
result = engine.perform_semantic_harmony_analysis(concepts)
9696

@@ -109,7 +109,7 @@ def test_ice_analysis_highly_coherent(engine):
109109
"""
110110
Tests the ICE analysis for a highly coherent case where all concepts
111111
belong to the same dimension (Wisdom).
112-
"""
112+
""" # noqa: E501
113113
result = engine.perform_ice_analysis(
114114
intent_words=["wisdom", "knowledge"],
115115
context_words=["science", "research"],

0 commit comments

Comments
 (0)