Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bugfix: no __contains__ on StrEnum until 3.12 #4933

Merged
merged 1 commit into from
Jul 8, 2024
Merged
Show file tree
Hide file tree
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
7 changes: 6 additions & 1 deletion src/dispatch/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,12 @@ class Visibility(DispatchEnum):
RESTRICTED = "Restricted"

assert str(Visibility.OPEN) == "Open"
assert "Open" in Visibility

Note:
In `3.12` we will get `__contains__` functionality:

DeprecationWarning: in 3.12 __contains__ will no longer raise TypeError, but will return True or
False depending on whether the value is a member or the value of a member
"""

pass # No additional implementation needed
Expand Down
2 changes: 1 addition & 1 deletion src/dispatch/plugins/dispatch_slack/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def should_retry(exception: Exception) -> bool:
match exception:
case SlackApiError():
# Don't retry for exceptions we have defined.
return exception.response["error"] not in SlackAPIErrorCode
return exception.response["error"] not in SlackAPIErrorCode.__members__.values()
case TimeoutError() | Timeout():
# Always retry on timeout errors
return True
Expand Down
Loading