@@ -86,11 +86,11 @@ def remove_unused_imports(self, sanitized_code: str) -> str:
8686 + Finally, remove all the unused imports from the source code and prettify it.
8787 """
8888 pruned_source_code : str = deepcopy (sanitized_code )
89- import_declerations : Captures = self .__javasitter .frame_query_and_capture_output (query = "((import_declaration) @imports)" , code_to_process = self .source_code )
89+ import_declarations : Captures = self .__javasitter .frame_query_and_capture_output (query = "((import_declaration) @imports)" , code_to_process = self .source_code )
9090
9191 unused_imports : Set = set ()
9292 ids_and_typeids : Set = set ()
93- class_bodies : Captures = self .__javasitter .frame_query_and_capture_output (query = "((class_declaration) @class_decleration )" , code_to_process = self .source_code )
93+ class_bodies : Captures = self .__javasitter .frame_query_and_capture_output (query = "((class_declaration) @class_declaration )" , code_to_process = self .source_code )
9494 for class_body in class_bodies :
9595 all_type_identifiers_in_class : Captures = self .__javasitter .frame_query_and_capture_output (
9696 query = "((type_identifier) @type_id)" ,
@@ -103,17 +103,17 @@ def remove_unused_imports(self, sanitized_code: str) -> str:
103103 ids_and_typeids .update ({type_id .node .text .decode () for type_id in all_type_identifiers_in_class })
104104 ids_and_typeids .update ({other_id .node .text .decode () for other_id in all_other_identifiers_in_class })
105105
106- for import_decleration in import_declerations :
107- wildcard_import : Captures = self .__javasitter .frame_query_and_capture_output (query = "((asterisk) @wildcard)" , code_to_process = import_decleration .node .text .decode ())
106+ for import_declaration in import_declarations :
107+ wildcard_import : Captures = self .__javasitter .frame_query_and_capture_output (query = "((asterisk) @wildcard)" , code_to_process = import_declaration .node .text .decode ())
108108 if len (wildcard_import ) > 0 :
109109 continue
110110
111111 import_statement : Captures = self .__javasitter .frame_query_and_capture_output (
112- query = "((scoped_identifier) @scoped_identifier)" , code_to_process = import_decleration .node .text .decode ()
112+ query = "((scoped_identifier) @scoped_identifier)" , code_to_process = import_declaration .node .text .decode ()
113113 )
114114 import_str = import_statement .captures [0 ].node .text .decode ()
115115 if not import_str .split ("." )[- 1 ] in ids_and_typeids :
116- unused_imports .add (import_decleration .node .text .decode ())
116+ unused_imports .add (import_declaration .node .text .decode ())
117117
118118 for unused_import in unused_imports :
119119 pruned_source_code = pruned_source_code .replace (unused_import , "" )
0 commit comments