Skip to content

Commit

Permalink
B904
Browse files Browse the repository at this point in the history
Signed-off-by: Jinzhe Zeng <[email protected]>
  • Loading branch information
njzjz committed Jul 14, 2024
1 parent 914aa04 commit 71e1a3f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions dargs/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,10 @@ def check_cli(
module_name, attr_name = func.rsplit(".", 1)
try:
mod = __import__(module_name, globals(), locals(), [attr_name])
except ImportError:
except ImportError as e:
raise RuntimeError(

Check warning on line 94 in dargs/cli.py

View check run for this annotation

Codecov / codecov/patch

dargs/cli.py#L90-L94

Added lines #L90 - L94 were not covered by tests
f'Failed to import "{attr_name}" from "{module_name}".\n{sys.exc_info()[1]}'
)
) from e

if not hasattr(mod, attr_name):
raise RuntimeError(f'Module "{module_name}" has no attribute "{attr_name}"')
Expand Down
4 changes: 2 additions & 2 deletions dargs/sphinx.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ def run(self):

try:
mod = __import__(module_name, globals(), locals(), [attr_name])
except ImportError:
except ImportError as e:

Check warning on line 60 in dargs/sphinx.py

View check run for this annotation

Codecov / codecov/patch

dargs/sphinx.py#L60

Added line #L60 was not covered by tests
raise self.error(
f'Failed to import "{attr_name}" from "{module_name}".\n{sys.exc_info()[1]}'
)
) from e

if not hasattr(mod, attr_name):
raise self.error(
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ select = [
"RUF", # ruff
"I", # isort
"TCH", # flake8-type-checking
"B904", # raise-without-from-inside-except
]

ignore = [
Expand Down

0 comments on commit 71e1a3f

Please sign in to comment.