improve type check
This commit is contained in:
parent
7855c14578
commit
e094e13132
5 changed files with 6 additions and 20 deletions
|
@ -369,7 +369,7 @@ class Item(SoftDeleteMixin, PolymorphicModel):
|
|||
return o
|
||||
|
||||
def log_action(self, changes):
|
||||
LogEntry.objects.log_create(
|
||||
LogEntry.objects.log_create( # type: ignore
|
||||
self, action=LogEntry.Action.UPDATE, changes=changes
|
||||
)
|
||||
|
||||
|
|
|
@ -21,8 +21,7 @@ from mastodon.api import (
|
|||
)
|
||||
from takahe.utils import Takahe
|
||||
|
||||
from ..forms import *
|
||||
from ..models import *
|
||||
from ..models import Comment, Mark, Piece, ShelfType, ShelfTypeNames, TagManager
|
||||
from .common import render_list, render_relogin, target_identity_required
|
||||
|
||||
_logger = logging.getLogger(__name__)
|
||||
|
|
|
@ -6,4 +6,4 @@ djlint~=1.32.1
|
|||
isort~=5.12.0
|
||||
lxml-stubs
|
||||
pre-commit
|
||||
pyright==1.1.322
|
||||
pyright==1.1.327
|
||||
|
|
|
@ -920,7 +920,7 @@ class Post(models.Model):
|
|||
|
||||
created = models.DateTimeField(auto_now_add=True)
|
||||
updated = models.DateTimeField(auto_now=True)
|
||||
objects = PostManager()
|
||||
objects: PostManager = PostManager()
|
||||
|
||||
class Meta:
|
||||
# managed = False
|
||||
|
@ -1103,19 +1103,6 @@ class Post(models.Model):
|
|||
mentions.add(identity)
|
||||
return mentions
|
||||
|
||||
def ensure_hashtags(self) -> None:
|
||||
"""
|
||||
Ensure any of the already parsed hashtags from this Post
|
||||
have a corresponding Hashtag record.
|
||||
"""
|
||||
# Ensure hashtags
|
||||
if self.hashtags:
|
||||
for hashtag in self.hashtags:
|
||||
tag, _ = Hashtag.objects.get_or_create(
|
||||
hashtag=hashtag[: Hashtag.MAXIMUM_LENGTH],
|
||||
)
|
||||
tag.transition_perform("outdated")
|
||||
|
||||
def calculate_stats(self, save=True):
|
||||
"""
|
||||
Recalculates our stats dict
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import hashlib
|
||||
import re
|
||||
from functools import cached_property
|
||||
from typing import TYPE_CHECKING
|
||||
from typing import TYPE_CHECKING, ClassVar
|
||||
|
||||
from django.contrib.auth.models import AbstractUser, BaseUserManager
|
||||
from django.contrib.auth.validators import UnicodeUsernameValidator
|
||||
|
@ -131,7 +131,7 @@ class User(AbstractUser):
|
|||
# store the latest read announcement id,
|
||||
# every time user read the announcement update this field
|
||||
read_announcement_index = models.PositiveIntegerField(default=0)
|
||||
objects = UserManager()
|
||||
objects: ClassVar[UserManager] = UserManager()
|
||||
|
||||
class Meta:
|
||||
constraints = [
|
||||
|
|
Loading…
Add table
Reference in a new issue