Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ def execute(self, tool_lib_id, input_field_list, **kwargs) -> NodeResult:
else:
all_params = init_params_default_value | params
if self.node.properties.get('kind') == 'data-source':
exist = function_executor.exec_code(f'{tool_lib.code}\\ndef function_exist(function_name): return callable(globals().get(function_name))', {'function_name': 'get_download_file_list'})
exist = function_executor.exec_code(f'{tool_lib.code}\ndef function_exist(function_name): return callable(globals().get(function_name))', {'function_name': 'get_download_file_list'})
if exist:
download_file_list = []
download_list = function_executor.exec_code(tool_lib.code,
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no obvious issue with the provided Python code snippet. However, here are some minor suggestions for improvement:

  1. The line if exist: could be condensed to if exist.is_callable(), assuming exist is an instance of a class that has a method is_callable() checking whether it's callable.

  2. If there are any potential typos or unused variables (init_params_default_value and its usage), they should be addressed.

  3. Consider adding comments explaining what each part of this block does, especially considering it might not be immediately clear from just reading the code.

  4. Ensure that the context in which this function is called (such as where function_executor.exec_code comes into play) handles exceptions properly, such as when trying to import modules.

These points would make the code more maintainable and easier to understand without changing its logic significantly.

Expand Down
Loading