diff --git a/examples/test_code.py b/examples/test_code.py index 6d78968..e387909 100644 --- a/examples/test_code.py +++ b/examples/test_code.py @@ -4,20 +4,23 @@ intentional, high disharmony. """ + # A (mock) database object to make the code valid class MockDB: def query(self, q: str): print(f"[DB] Querying: {q}") return {"user": "Test User"} - + def delete_user(self, token: str): print(f"[DB] DELETING USER WITH TOKEN: {token}") return True + db = MockDB() # --- A HARMONIOUS FUNCTION --- + def get_user_by_id(user_id: int): """ Fetches, reads, and returns a user's information @@ -25,27 +28,29 @@ def get_user_by_id(user_id: int): """ if not user_id: return None - + # The execution (query, read, return) matches the # intent (get, information). user_data = db.query(f"SELECT * FROM users WHERE id = {user_id}") return user_data + # --- A DISHARMONIOUS FUNCTION (THE "BUG") --- + def check_user_permissions(user_token: str): """ This function's INTENT is to validate, check, and get information about a user's permissions. It should be a 'justice' and 'wisdom' task. """ - + # !! DISHARMONY !! # The EXECUTION is 'delete', a high 'power'/'force' concept. # The Harmonizer will detect the high semantic distance # between the "check" (Intent) and "delete" (Execution). print("Checking token... (but not really)") db.delete_user(token=user_token) - + # This 'return' of 'information' is deceptive. - return "User Deleted" \ No newline at end of file + return "User Deleted" diff --git a/src/divine_invitation_engine_V2.py b/src/divine_invitation_engine_V2.py index 3a1e9b8..5b8d340 100644 --- a/src/divine_invitation_engine_V2.py +++ b/src/divine_invitation_engine_V2.py @@ -584,7 +584,7 @@ def analyze_ice( def _calculate_ice_coordinate( self, intent: SemanticResult, context: SemanticResult, execution: SemanticResult - ) -> Coordinates: + ) -> Coordinates: # noqa: E501 """Calculate ICE coordinate from components""" return Coordinates( love=( diff --git a/tests/test_engine.py b/tests/test_engine.py index 91edbef..b146383 100644 --- a/tests/test_engine.py +++ b/tests/test_engine.py @@ -90,7 +90,7 @@ def test_semantic_clarity(engine): def test_semantic_analyzer_cluster(engine): - """Tests the semantic analyzer's ability to find the centroid of a concept cluster.""" + """Tests the semantic analyzer's ability to find the centroid of a concept cluster.""" # noqa: E501 concepts = ["love", "justice"] result = engine.perform_semantic_harmony_analysis(concepts) @@ -109,7 +109,7 @@ def test_ice_analysis_highly_coherent(engine): """ Tests the ICE analysis for a highly coherent case where all concepts belong to the same dimension (Wisdom). - """ + """ # noqa: E501 result = engine.perform_ice_analysis( intent_words=["wisdom", "knowledge"], context_words=["science", "research"],