Make IDE linter happier in some touched files

fix-images
Jason Robinson 2020-12-27 23:04:55 +02:00
rodzic 0bfadd059e
commit f512d8a9dc
3 zmienionych plików z 10 dodań i 2 usunięć

Wyświetl plik

@ -10,7 +10,7 @@ from federation.entities.activitypub.constants import (
CONTEXT_LD_SIGNATURES, CONTEXT_DIASPORA)
from federation.entities.activitypub.enums import ActorType, ObjectType, ActivityType
from federation.entities.base import Profile, Post, Follow, Accept, Comment, Retraction, Share, Image
from federation.entities.mixins import RawContentMixin, BaseEntity, PublicMixin
from federation.entities.mixins import RawContentMixin, BaseEntity, PublicMixin, CreatedAtMixin
from federation.entities.utils import get_base_attributes
from federation.outbound import handle_send
from federation.types import UserType
@ -61,6 +61,7 @@ class CleanContentMixin(RawContentMixin):
"""
super().post_receive()
# noinspection PyUnusedLocal
def remove_tag_links(attrs, new=False):
rel = (None, "rel")
if attrs.get(rel) == "tag":
@ -94,8 +95,9 @@ class ActivitypubAccept(ActivitypubEntityMixin, Accept):
return as2
class ActivitypubNoteMixin(AttachImagesMixin, CleanContentMixin, PublicMixin, ActivitypubEntityMixin):
class ActivitypubNoteMixin(AttachImagesMixin, CleanContentMixin, PublicMixin, CreatedAtMixin, ActivitypubEntityMixin):
_type = ObjectType.NOTE.value
url = ""
def add_object_tags(self) -> List[Dict]:
"""
@ -236,6 +238,7 @@ class ActivitypubFollow(ActivitypubEntityMixin, Follow):
target_id=self.activity_id,
object=self.to_as2(),
)
# noinspection PyBroadException
try:
profile = retrieve_and_parse_profile(self.actor_id)
except Exception:
@ -243,6 +246,7 @@ class ActivitypubFollow(ActivitypubEntityMixin, Follow):
if not profile:
logger.warning("ActivitypubFollow.post_receive - Failed to fetch remote profile for sending back Accept")
return
# noinspection PyBroadException
try:
handle_send(
accept,

Wyświetl plik

@ -1,5 +1,6 @@
from unittest.mock import patch
# noinspection PyPackageRequirements
from Crypto.PublicKey.RSA import RsaKey
from federation.entities.activitypub.constants import (
@ -350,6 +351,7 @@ class TestEntitiesConvertToAS2:
'published': '2019-04-27T00:00:00',
}
# noinspection PyUnusedLocal
@patch("federation.entities.base.fetch_content_type", return_value="image/jpeg")
def test_profile_to_as2(self, mock_fetch, activitypubprofile):
result = activitypubprofile.to_as2()
@ -385,6 +387,7 @@ class TestEntitiesConvertToAS2:
}
}
# noinspection PyUnusedLocal
@patch("federation.entities.base.fetch_content_type", return_value="image/jpeg")
def test_profile_to_as2__with_diaspora_guid(self, mock_fetch, activitypubprofile_diaspora_guid):
result = activitypubprofile_diaspora_guid.to_as2()

Wyświetl plik

@ -1,4 +1,5 @@
import pytest
# noinspection PyPackageRequirements
from freezegun import freeze_time
from federation.entities.activitypub.entities import (