3232
3333# --- CONFIGURATION LOADING ---
3434
35+
3536def load_configuration () -> Dict :
3637 """
3738 Searches for and loads .harmonizer.yml from the current directory
@@ -65,6 +66,7 @@ def load_configuration() -> Dict:
6566
6667# --- THE HARMONIZER APPLICATION ---
6768
69+
6870class PythonCodeHarmonizer :
6971 """
7072 Analyzes Python code for "Intent Harmony" using the DIVE-V2
@@ -86,7 +88,9 @@ def __init__(
8688 ):
8789 self .config = config if config else {}
8890 self .engine = dive .DivineInvitationSemanticEngine (config = self .config )
89- self .parser = AST_Semantic_Parser (vocabulary = self .engine .vocabulary .all_keywords )
91+ self .parser = AST_Semantic_Parser (
92+ vocabulary = self .engine .vocabulary .all_keywords
93+ )
9094 self .map_generator = SemanticMapGenerator ()
9195 self .disharmony_threshold = disharmony_threshold
9296 self .quiet = quiet
@@ -297,14 +301,20 @@ def parse_cli_arguments() -> argparse.Namespace:
297301 formatter_class = argparse .RawDescriptionHelpFormatter ,
298302 )
299303 parser .add_argument ("files" , nargs = "+" , help = "Python file(s) to analyze" )
300- parser .add_argument ("--format" , choices = ["text" , "json" ], default = "text" , help = "Output format" )
301- parser .add_argument ("--threshold" , type = float , default = 0.5 , help = "Disharmony threshold" )
304+ parser .add_argument (
305+ "--format" , choices = ["text" , "json" ], default = "text" , help = "Output format"
306+ )
307+ parser .add_argument (
308+ "--threshold" , type = float , default = 0.5 , help = "Disharmony threshold"
309+ )
302310 parser .add_argument (
303311 "--suggest-refactor" ,
304312 action = "store_true" ,
305313 help = "Suggest a refactoring for disharmonious functions." ,
306314 )
307- parser .add_argument ("--version" , action = "version" , version = "Python Code Harmonizer v1.4" )
315+ parser .add_argument (
316+ "--version" , action = "version" , version = "Python Code Harmonizer v1.4"
317+ )
308318 return parser .parse_args ()
309319
310320
@@ -350,7 +360,9 @@ def execute_analysis(
350360 exit_code = harmonizer .get_highest_severity_code (report )
351361 highest_exit_code = max (highest_exit_code , exit_code )
352362 if output_format == "text" :
353- formatted = harmonizer .format_report (report , suggest_refactor = suggest_refactor )
363+ formatted = harmonizer .format_report (
364+ report , suggest_refactor = suggest_refactor
365+ )
354366 harmonizer .output_report (formatted )
355367 return all_reports , highest_exit_code
356368
@@ -377,5 +389,6 @@ def run_cli():
377389
378390 sys .exit (highest_exit_code )
379391
392+
380393if __name__ == "__main__" :
381394 run_cli ()
0 commit comments