Skip to content

Commit

Permalink
use hasattr()
Browse files Browse the repository at this point in the history
  • Loading branch information
khsrali committed May 23, 2024
1 parent c7f7bd8 commit ddaf774
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/aiida/cmdline/commands/cmd_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,14 @@ def plugin_list(entry_point_group, entry_point):
echo.echo_critical(str(exception))
else:
try:
if (inspect.isclass(plugin) and issubclass(plugin, Process)) or plugin.is_process_function:
if (inspect.isclass(plugin) and issubclass(plugin, Process)) or (
False if not hasattr(plugin, 'is_process_function') else plugin.is_process_function
):
print_process_info(plugin)
else:
echo.echo(str(plugin.get_description()))
except AttributeError:
try:
echo.echo(str(plugin.get_description()))
except AttributeError:
echo.echo_error(f'No description available for {entry_point}')
echo.echo_error(f'No description available for {entry_point}')
else:
entry_points = get_entry_point_names(entry_point_group)
if entry_points:
Expand Down

0 comments on commit ddaf774

Please sign in to comment.