mirror of
https://github.com/langflow-ai/langflow.git
synced 2026-07-24 06:42:21 +08:00
🐛 fix(directory_reader.py): handle SyntaxError when checking if type hint is used but not imported
🔍 refactor(directory_reader.py): improve error handling when checking if type hint is used but not imported
This commit is contained in:
@ -176,9 +176,14 @@ class DirectoryReader:
|
||||
"""
|
||||
Check if a type hint is used but not imported in the given code.
|
||||
"""
|
||||
return self._is_type_hint_used_in_args(
|
||||
type_hint_name, code
|
||||
) and not self._is_type_hint_imported(type_hint_name, code)
|
||||
try:
|
||||
return self._is_type_hint_used_in_args(
|
||||
type_hint_name, code
|
||||
) and not self._is_type_hint_imported(type_hint_name, code)
|
||||
except SyntaxError:
|
||||
# Returns True if there's something wrong with the code
|
||||
# TODO : Find a better way to handle this
|
||||
return True
|
||||
|
||||
def process_file(self, file_path):
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user