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

@ -389,17 +389,12 @@ 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#", "pt": "https://joinpeertube.org/ns#",
"sc": "http://schema.org/", "sc": "http://schema.org/",
"playlists": { "playlists": {"@id": "pt:playlists", "@type": "@id"},
"@id": "pt:playlists", },
"@type": "@id"
}
}
], ],
"type": "Person", "type": "Person",
"id": "https://peertube.cpy.re/accounts/chocobozzz", "id": "https://peertube.cpy.re/accounts/chocobozzz",
@ -412,7 +407,7 @@ PEERTUBE_ACTOR_VALUE = {
"url": "https://peertube.cpy.re/accounts/chocobozzz", "url": "https://peertube.cpy.re/accounts/chocobozzz",
"name": "chocobozzz", "name": "chocobozzz",
"published": "2017-11-28T08:48:24.271Z", "published": "2017-11-28T08:48:24.271Z",
"summary": None "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"
@ -422,9 +417,7 @@ 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#", "pt": "https://joinpeertube.org/ns#",
"sc": "http://schema.org/", "sc": "http://schema.org/",
@ -439,92 +432,46 @@ PEERTUBE_VIDEO_VALUE = {
"isLiveBroadcast": "sc:isLiveBroadcast", "isLiveBroadcast": "sc:isLiveBroadcast",
"liveSaveReplay": { "liveSaveReplay": {
"@type": "sc:Boolean", "@type": "sc:Boolean",
"@id": "pt:liveSaveReplay" "@id": "pt:liveSaveReplay",
}, },
"permanentLive": { "permanentLive": {
"@type": "sc:Boolean", "@type": "sc:Boolean",
"@id": "pt:permanentLive" "@id": "pt:permanentLive",
},
"latencyMode": {
"@type": "sc:Number",
"@id": "pt:latencyMode"
}, },
"latencyMode": {"@type": "sc:Number", "@id": "pt:latencyMode"},
"Infohash": "pt:Infohash", "Infohash": "pt:Infohash",
"originallyPublishedAt": "sc:datePublished", "originallyPublishedAt": "sc:datePublished",
"views": { "views": {"@type": "sc:Number", "@id": "pt:views"},
"@type": "sc:Number", "state": {"@type": "sc:Number", "@id": "pt:state"},
"@id": "pt:views" "size": {"@type": "sc:Number", "@id": "pt:size"},
}, "fps": {"@type": "sc:Number", "@id": "pt:fps"},
"state": {
"@type": "sc:Number",
"@id": "pt:state"
},
"size": {
"@type": "sc:Number",
"@id": "pt:size"
},
"fps": {
"@type": "sc:Number",
"@id": "pt:fps"
},
"commentsEnabled": { "commentsEnabled": {
"@type": "sc:Boolean", "@type": "sc:Boolean",
"@id": "pt:commentsEnabled" "@id": "pt:commentsEnabled",
}, },
"downloadEnabled": { "downloadEnabled": {
"@type": "sc:Boolean", "@type": "sc:Boolean",
"@id": "pt:downloadEnabled" "@id": "pt:downloadEnabled",
}, },
"waitTranscoding": { "waitTranscoding": {
"@type": "sc:Boolean", "@type": "sc:Boolean",
"@id": "pt:waitTranscoding" "@id": "pt:waitTranscoding",
}, },
"support": { "support": {"@type": "sc:Text", "@id": "pt:support"},
"@type": "sc:Text", "likes": {"@id": "as:likes", "@type": "@id"},
"@id": "pt:support" "dislikes": {"@id": "as:dislikes", "@type": "@id"},
"shares": {"@id": "as:shares", "@type": "@id"},
"comments": {"@id": "as:comments", "@type": "@id"},
}, },
"likes": {
"@id": "as:likes",
"@type": "@id"
},
"dislikes": {
"@id": "as:dislikes",
"@type": "@id"
},
"shares": {
"@id": "as:shares",
"@type": "@id"
},
"comments": {
"@id": "as:comments",
"@type": "@id"
}
}
],
"to": [
"https://www.w3.org/ns/activitystreams#Public"
], ],
"to": ["https://www.w3.org/ns/activitystreams#Public"],
"type": "Video", "type": "Video",
"name": "name of video", "name": "name of video",
"duration": "PT5160S", "duration": "PT5160S",
"tag": [ "tag": [{"type": "Hashtag", "name": "vostfr"}],
{ "category": {"identifier": "2", "name": "Films"},
"type": "Hashtag", "licence": {"identifier": "4", "name": "Attribution - Non Commercial"},
"name": "vostfr" "language": {"identifier": "en", "name": "English"},
}
],
"category": {
"identifier": "2",
"name": "Films"
},
"licence": {
"identifier": "4",
"name": "Attribution - Non Commercial"
},
"language": {
"identifier": "en",
"name": "English"
},
"views": 13718, "views": 13718,
"sensitive": False, "sensitive": False,
"waitTranscoding": False, "waitTranscoding": False,
@ -545,14 +492,11 @@ PEERTUBE_VIDEO_VALUE = {
# redacted # redacted
], ],
"attributedTo": [ "attributedTo": [
{ {"type": "Person", "id": PEERTUBE_ACTOR_URL},
"type": "Person",
"id": PEERTUBE_ACTOR_URL
},
{ {
"type": "Group", "type": "Group",
"id": ACTOR_URL, "id": ACTOR_URL,
} },
], ],
"isLiveBroadcast": False, "isLiveBroadcast": False,
"liveSaveReplay": None, "liveSaveReplay": None,