@@ -217,7 +217,9 @@ def extract_code_string_context_from_files(
217217 continue
218218 try :
219219 qualified_helper_function_names = {func .qualified_name for func in helper_function_sources }
220- code_without_unused_defs = remove_unused_definitions_by_function_names (original_code , qualified_helper_function_names )
220+ code_without_unused_defs = remove_unused_definitions_by_function_names (
221+ original_code , qualified_helper_function_names
222+ )
221223 code_context = parse_code_and_prune_cst (
222224 code_without_unused_defs , code_context_type , set (), qualified_helper_function_names , remove_docstrings
223225 )
@@ -325,7 +327,9 @@ def extract_code_markdown_context_from_files(
325327 continue
326328 try :
327329 qualified_helper_function_names = {func .qualified_name for func in helper_function_sources }
328- code_without_unused_defs = remove_unused_definitions_by_function_names (original_code , qualified_helper_function_names )
330+ code_without_unused_defs = remove_unused_definitions_by_function_names (
331+ original_code , qualified_helper_function_names
332+ )
329333 code_context = parse_code_and_prune_cst (
330334 code_without_unused_defs , code_context_type , set (), qualified_helper_function_names , remove_docstrings
331335 )
@@ -403,12 +407,8 @@ def get_function_sources_from_jedi(
403407 for name in names :
404408 try :
405409 definitions : list [Name ] = name .goto (follow_imports = True , follow_builtin_imports = False )
406- except Exception as e :
407- try :
408- logger .exception (f"Error while getting definition for { name .full_name } : { e } " )
409- except Exception as e :
410- # name.full_name can also throw exceptions sometimes
411- logger .exception (f"Error while getting definition: { e } " )
410+ except Exception : # noqa: BLE001
411+ logger .debug (f"Error while getting definitions for { qualified_function_name } " )
412412 definitions = []
413413 if definitions :
414414 # TODO: there can be multiple definitions, see how to handle such cases
@@ -424,7 +424,12 @@ def get_function_sources_from_jedi(
424424 and not belongs_to_function_qualified (definition , qualified_function_name )
425425 and definition .full_name .startswith (definition .module_name )
426426 # Avoid nested functions or classes. Only class.function is allowed
427- and len ((qualified_name := get_qualified_name (definition .module_name , definition .full_name )).split ("." )) <= 2
427+ and len (
428+ (qualified_name := get_qualified_name (definition .module_name , definition .full_name )).split (
429+ "."
430+ )
431+ )
432+ <= 2
428433 ):
429434 function_source = FunctionSource (
430435 file_path = definition_path ,
0 commit comments