Skip to content

cleanup source code #512

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

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
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
11 changes: 2 additions & 9 deletions asgiref/current_thread_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,5 @@ def _submit(
# Return the future
return f

# Python 3.9+ has a new signature for submit with a "/" after `fn`, to enforce
# it to be a positional argument. If we ignore[override] mypy on 3.9+ will be
# happy but 3.8 will say that the ignore comment is unused, even when
# defining them differently based on sys.version_info.
# We should be able to remove this when we drop support for 3.8.
if not TYPE_CHECKING:

def submit(self, fn, *args, **kwargs):
return self._submit(fn, *args, **kwargs)
def submit(self, fn, *args, **kwargs):
return self._submit(fn, *args, **kwargs)
6 changes: 1 addition & 5 deletions asgiref/local.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,8 @@ def __init__(self) -> None:
def __getattr__(self, key: str) -> Any:
try:
var = self._data[key]
except KeyError:
raise AttributeError(f"{self!r} object has no attribute {key!r}")

try:
return var.get()
except LookupError:
except (KeyError, LookupError):
raise AttributeError(f"{self!r} object has no attribute {key!r}")

def __setattr__(self, key: str, value: Any) -> None:
Expand Down