Skip to content

Commit

Permalink
ignore variable exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
augustelalande committed May 20, 2024
1 parent 7a3c637 commit 0e89ea0
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
from somewhere import AnotherError


class FasterThanLightError(Exception):
...


_some_error = Exception


# DAR401
def calculate_speed(distance: float, time: float) -> float:
"""Calculate speed as distance divided by time.
Expand Down Expand Up @@ -90,6 +100,34 @@ def calculate_speed(distance: float, time: float) -> float:
raise exc


# DAR401
def calculate_speed(distance: float, time: float) -> float:
"""Calculate speed as distance divided by time.
Args:
distance: Distance traveled.
time: Time spent traveling.
Returns:
Speed as distance divided by time.
"""
raise AnotherError


# DAR401, but can't resolve the error
def calculate_speed(distance: float, time: float) -> float:
"""Calculate speed as distance divided by time.
Args:
distance: Distance traveled.
time: Time spent traveling.
Returns:
Speed as distance divided by time.
"""
raise _some_error


# OK
def calculate_speed(distance: float, time: float) -> float:
try:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
class FasterThanLightError(Exception):
...


def calculate_speed(distance: float, time: float) -> float:
"""
Calculate speed as distance divided by time.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
class FasterThanLightError(Exception):
...


def calculate_speed(distance: float, time: float) -> float:
"""Calculate speed as distance divided by time.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
class FasterThanLightError(Exception):
...


def calculate_speed(distance: float, time: float) -> float:
"""
Calculate speed as distance divided by time.
Expand Down

0 comments on commit 0e89ea0

Please sign in to comment.