Fediverse: run black

This commit is contained in:
Valentin Lorentz 2022-07-30 21:23:10 +02:00
parent ef081746b1
commit 2afa3c49a1
2 changed files with 114 additions and 167 deletions

View File

@ -245,7 +245,10 @@ class Fediverse(callbacks.PluginRegexp):
return self._format_author(irc, author["id"]) return self._format_author(irc, author["id"])
elif isinstance(author, list): elif isinstance(author, list):
return format( return format(
"%L", filter(bool, [self._format_author(irc, item) for item in author]) "%L",
filter(
bool, [self._format_author(irc, item) for item in author]
),
) )
else: else:
return "<unknown>" return "<unknown>"

View File

@ -386,178 +386,122 @@ BOOSTED_ACTOR_VALUE = {
BOOSTED_ACTOR_DATA = json.dumps(BOOSTED_ACTOR_VALUE).encode() BOOSTED_ACTOR_DATA = json.dumps(BOOSTED_ACTOR_VALUE).encode()
PEERTUBE_ACTOR_VALUE = { PEERTUBE_ACTOR_VALUE = {
"@context": [ "@context": [
"https://www.w3.org/ns/activitystreams", "https://www.w3.org/ns/activitystreams",
"https://w3id.org/security/v1", "https://w3id.org/security/v1",
{ {"RsaSignature2017": "https://w3id.org/security#RsaSignature2017"},
"RsaSignature2017": "https://w3id.org/security#RsaSignature2017" {
}, "pt": "https://joinpeertube.org/ns#",
{ "sc": "http://schema.org/",
"pt": "https://joinpeertube.org/ns#", "playlists": {"@id": "pt:playlists", "@type": "@id"},
"sc": "http://schema.org/", },
"playlists": { ],
"@id": "pt:playlists", "type": "Person",
"@type": "@id" "id": "https://peertube.cpy.re/accounts/chocobozzz",
} "following": "https://peertube.cpy.re/accounts/chocobozzz/following",
} "followers": "https://peertube.cpy.re/accounts/chocobozzz/followers",
], "playlists": "https://peertube.cpy.re/accounts/chocobozzz/playlists",
"type": "Person", "inbox": "https://peertube.cpy.re/accounts/chocobozzz/inbox",
"id": "https://peertube.cpy.re/accounts/chocobozzz", "outbox": "https://peertube.cpy.re/accounts/chocobozzz/outbox",
"following": "https://peertube.cpy.re/accounts/chocobozzz/following", "preferredUsername": "chocobozzz",
"followers": "https://peertube.cpy.re/accounts/chocobozzz/followers", "url": "https://peertube.cpy.re/accounts/chocobozzz",
"playlists": "https://peertube.cpy.re/accounts/chocobozzz/playlists", "name": "chocobozzz",
"inbox": "https://peertube.cpy.re/accounts/chocobozzz/inbox", "published": "2017-11-28T08:48:24.271Z",
"outbox": "https://peertube.cpy.re/accounts/chocobozzz/outbox", "summary": None,
"preferredUsername": "chocobozzz",
"url": "https://peertube.cpy.re/accounts/chocobozzz",
"name": "chocobozzz",
"published": "2017-11-28T08:48:24.271Z",
"summary": None
} }
PEERTUBE_ACTOR_DATA = json.dumps(PEERTUBE_ACTOR_VALUE).encode() PEERTUBE_ACTOR_DATA = json.dumps(PEERTUBE_ACTOR_VALUE).encode()
PEERTUBE_ACTOR_URL = "https://peertube.cpy.re/accounts/chocobozzz" PEERTUBE_ACTOR_URL = "https://peertube.cpy.re/accounts/chocobozzz"
PEERTUBE_VIDEO_VALUE = { PEERTUBE_VIDEO_VALUE = {
"@context": [ "@context": [
"https://www.w3.org/ns/activitystreams", "https://www.w3.org/ns/activitystreams",
"https://w3id.org/security/v1", "https://w3id.org/security/v1",
{ {"RsaSignature2017": "https://w3id.org/security#RsaSignature2017"},
"RsaSignature2017": "https://w3id.org/security#RsaSignature2017" {
}, "pt": "https://joinpeertube.org/ns#",
{ "sc": "http://schema.org/",
"pt": "https://joinpeertube.org/ns#", "Hashtag": "as:Hashtag",
"sc": "http://schema.org/", "uuid": "sc:identifier",
"Hashtag": "as:Hashtag", "category": "sc:category",
"uuid": "sc:identifier", "licence": "sc:license",
"category": "sc:category", "subtitleLanguage": "sc:subtitleLanguage",
"licence": "sc:license", "sensitive": "as:sensitive",
"subtitleLanguage": "sc:subtitleLanguage", "language": "sc:inLanguage",
"sensitive": "as:sensitive", "icons": "as:icon",
"language": "sc:inLanguage", "isLiveBroadcast": "sc:isLiveBroadcast",
"icons": "as:icon", "liveSaveReplay": {
"isLiveBroadcast": "sc:isLiveBroadcast", "@type": "sc:Boolean",
"liveSaveReplay": { "@id": "pt:liveSaveReplay",
"@type": "sc:Boolean", },
"@id": "pt:liveSaveReplay" "permanentLive": {
}, "@type": "sc:Boolean",
"permanentLive": { "@id": "pt:permanentLive",
"@type": "sc:Boolean", },
"@id": "pt:permanentLive" "latencyMode": {"@type": "sc:Number", "@id": "pt:latencyMode"},
}, "Infohash": "pt:Infohash",
"latencyMode": { "originallyPublishedAt": "sc:datePublished",
"@type": "sc:Number", "views": {"@type": "sc:Number", "@id": "pt:views"},
"@id": "pt:latencyMode" "state": {"@type": "sc:Number", "@id": "pt:state"},
}, "size": {"@type": "sc:Number", "@id": "pt:size"},
"Infohash": "pt:Infohash", "fps": {"@type": "sc:Number", "@id": "pt:fps"},
"originallyPublishedAt": "sc:datePublished", "commentsEnabled": {
"views": { "@type": "sc:Boolean",
"@type": "sc:Number", "@id": "pt:commentsEnabled",
"@id": "pt:views" },
}, "downloadEnabled": {
"state": { "@type": "sc:Boolean",
"@type": "sc:Number", "@id": "pt:downloadEnabled",
"@id": "pt:state" },
}, "waitTranscoding": {
"size": { "@type": "sc:Boolean",
"@type": "sc:Number", "@id": "pt:waitTranscoding",
"@id": "pt:size" },
}, "support": {"@type": "sc:Text", "@id": "pt:support"},
"fps": { "likes": {"@id": "as:likes", "@type": "@id"},
"@type": "sc:Number", "dislikes": {"@id": "as:dislikes", "@type": "@id"},
"@id": "pt:fps" "shares": {"@id": "as:shares", "@type": "@id"},
}, "comments": {"@id": "as:comments", "@type": "@id"},
"commentsEnabled": { },
"@type": "sc:Boolean", ],
"@id": "pt:commentsEnabled" "to": ["https://www.w3.org/ns/activitystreams#Public"],
}, "type": "Video",
"downloadEnabled": { "name": "name of video",
"@type": "sc:Boolean", "duration": "PT5160S",
"@id": "pt:downloadEnabled" "tag": [{"type": "Hashtag", "name": "vostfr"}],
}, "category": {"identifier": "2", "name": "Films"},
"waitTranscoding": { "licence": {"identifier": "4", "name": "Attribution - Non Commercial"},
"@type": "sc:Boolean", "language": {"identifier": "en", "name": "English"},
"@id": "pt:waitTranscoding" "views": 13718,
}, "sensitive": False,
"support": { "waitTranscoding": False,
"@type": "sc:Text", "state": 1,
"@id": "pt:support" "commentsEnabled": True,
}, "downloadEnabled": True,
"likes": { "published": "2017-10-23T07:54:38.155Z",
"@id": "as:likes", "originallyPublishedAt": None,
"@type": "@id" "updated": "2022-07-13T07:03:12.373Z",
}, "mediaType": "text/markdown",
"dislikes": { "content": "description of <strong>the</strong> video\r\nwith a second line",
"@id": "as:dislikes", "support": None,
"@type": "@id" "subtitleLanguage": [],
}, "icon": [
"shares": { # redacted
"@id": "as:shares", ],
"@type": "@id" "url": [
}, # redacted
"comments": { ],
"@id": "as:comments", "attributedTo": [
"@type": "@id" {"type": "Person", "id": PEERTUBE_ACTOR_URL},
} {
} "type": "Group",
], "id": ACTOR_URL,
"to": [ },
"https://www.w3.org/ns/activitystreams#Public" ],
], "isLiveBroadcast": False,
"type": "Video", "liveSaveReplay": None,
"name": "name of video", "permanentLive": None,
"duration": "PT5160S", "latencyMode": None,
"tag": [
{
"type": "Hashtag",
"name": "vostfr"
}
],
"category": {
"identifier": "2",
"name": "Films"
},
"licence": {
"identifier": "4",
"name": "Attribution - Non Commercial"
},
"language": {
"identifier": "en",
"name": "English"
},
"views": 13718,
"sensitive": False,
"waitTranscoding": False,
"state": 1,
"commentsEnabled": True,
"downloadEnabled": True,
"published": "2017-10-23T07:54:38.155Z",
"originallyPublishedAt": None,
"updated": "2022-07-13T07:03:12.373Z",
"mediaType": "text/markdown",
"content": "description of <strong>the</strong> video\r\nwith a second line",
"support": None,
"subtitleLanguage": [],
"icon": [
# redacted
],
"url": [
# redacted
],
"attributedTo": [
{
"type": "Person",
"id": PEERTUBE_ACTOR_URL
},
{
"type": "Group",
"id": ACTOR_URL,
}
],
"isLiveBroadcast": False,
"liveSaveReplay": None,
"permanentLive": None,
"latencyMode": None,
} }
PEERTUBE_VIDEO_DATA = json.dumps(PEERTUBE_VIDEO_VALUE).encode() PEERTUBE_VIDEO_DATA = json.dumps(PEERTUBE_VIDEO_VALUE).encode()
PEERTUBE_VIDEO_URL = "https://example.org/w/gABde9e210FGHre" PEERTUBE_VIDEO_URL = "https://example.org/w/gABde9e210FGHre"