diff options
author | Paolo Melchiorre | 2022-12-05 18:38:37 +0100 |
---|---|---|
committer | GitHub | 2022-12-05 10:38:37 -0700 |
commit | a9bb4a7122df6d9d4a764de52244c6ec75789ead (patch) | |
tree | 14ba582f72ac5e3b133b3644ca03e0f027e7c2ef /users/models | |
parent | dd8e823d2f3ef22fcaa1e43e74f11f7e49eff9e7 (diff) | |
download | takahe-a9bb4a7122df6d9d4a764de52244c6ec75789ead.tar.gz takahe-a9bb4a7122df6d9d4a764de52244c6ec75789ead.tar.bz2 takahe-a9bb4a7122df6d9d4a764de52244c6ec75789ead.zip |
Add pyupgrade with --py310-plus in pre-commit (#103)
Diffstat (limited to 'users/models')
-rw-r--r-- | users/models/identity.py | 8 | ||||
-rw-r--r-- | users/models/system_actor.py | 4 | ||||
-rw-r--r-- | users/models/user.py | 4 |
3 files changed, 7 insertions, 9 deletions
diff --git a/users/models/identity.py b/users/models/identity.py index bbedceb..c674bf4 100644 --- a/users/models/identity.py +++ b/users/models/identity.py @@ -1,5 +1,5 @@ from functools import cached_property, partial -from typing import Dict, Literal, Optional, Tuple +from typing import Literal from urllib.parse import urlparse import httpx @@ -334,7 +334,7 @@ class Identity(StatorModel): ### Actor/Webfinger fetching ### @classmethod - async def fetch_webfinger(cls, handle: str) -> Tuple[Optional[str], Optional[str]]: + async def fetch_webfinger(cls, handle: str) -> tuple[str | None, str | None]: """ Given a username@domain handle, returns a tuple of (actor uri, canonical handle) or None, None if it does not resolve. @@ -458,7 +458,7 @@ class Identity(StatorModel): raise ValueError( f"Could not save Identity at end of actor fetch: {e}" ) - self.pk: Optional[int] = other_row.pk + self.pk: int | None = other_row.pk await sync_to_async(self.save)() return True @@ -468,7 +468,7 @@ class Identity(StatorModel): self, method: Literal["get", "post"], uri: str, - body: Optional[Dict] = None, + body: dict | None = None, ): """ Performs a signed request on behalf of the System Actor. diff --git a/users/models/system_actor.py b/users/models/system_actor.py index c337d78..c4319b9 100644 --- a/users/models/system_actor.py +++ b/users/models/system_actor.py @@ -1,4 +1,4 @@ -from typing import Dict, Literal, Optional +from typing import Literal from django.conf import settings @@ -57,7 +57,7 @@ class SystemActor: self, method: Literal["get", "post"], uri: str, - body: Optional[Dict] = None, + body: dict | None = None, ): """ Performs a signed request on behalf of the System Actor. diff --git a/users/models/user.py b/users/models/user.py index 08a703e..e0cac9d 100644 --- a/users/models/user.py +++ b/users/models/user.py @@ -1,5 +1,3 @@ -from typing import List - from django.contrib.auth.models import AbstractBaseUser, BaseUserManager from django.db import models @@ -42,7 +40,7 @@ class User(AbstractBaseUser): USERNAME_FIELD = "email" EMAIL_FIELD = "email" - REQUIRED_FIELDS: List[str] = [] + REQUIRED_FIELDS: list[str] = [] objects = UserManager() |