Reformat the files with black

This commit is contained in:
Thomas Sileo
2019-04-13 10:00:56 +02:00
parent 3d74c5ff7e
commit 2655aa8fa5
8 changed files with 30 additions and 20 deletions

View File

@@ -10,7 +10,7 @@ from little_boxes.webfinger import get_actor_url
def lookup(url: str) -> ap.BaseActivity:
"""Try to find an AP object related to the given URL."""
try:
if url.startswith('@'):
if url.startswith("@"):
actor_url = get_actor_url(url)
if actor_url:
return ap.fetch_remote_activity(actor_url)

View File

@@ -15,7 +15,7 @@ def load(url, user_agent):
"""Initializes a `PIL.Image` from the URL."""
with requests.get(url, stream=True, headers={"User-Agent": user_agent}) as resp:
resp.raise_for_status()
if not resp.headers.get('content-type').startswith('image/'):
if not resp.headers.get("content-type").startswith("image/"):
raise ValueError(f"bad content-type {resp.headers.get('content-type')}")
resp.raw.decode_content = True

View File

@@ -48,7 +48,7 @@ def fetch_og_metadata(user_agent, links):
logger.debug(f"skipping {l}")
continue
r.encoding = 'UTF-8'
r.encoding = "UTF-8"
html = r.text
try:
data = dict(opengraph.OpenGraph(html=html))