44intentional, high disharmony.
55"""
66
7+
78# A (mock) database object to make the code valid
89class 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+
1719db = MockDB ()
1820
1921# --- A HARMONIOUS FUNCTION ---
2022
23+
2124def 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+
3641def 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"
0 commit comments