Skip to content
Snippets Groups Projects
Verified Commit bd9a2f41 authored by Georg Krause's avatar Georg Krause
Browse files

style: Format everything with black

parent 1b02ecb3
Branches
No related tags found
No related merge requests found
Pipeline #26301 passed
...@@ -26,7 +26,7 @@ domain_filters = { ...@@ -26,7 +26,7 @@ domain_filters = {
def validate_domain(raw): def validate_domain(raw):
raw = raw.split('://')[-1] raw = raw.split("://")[-1]
if not raw: if not raw:
raise ValueError() raise ValueError()
......
...@@ -9,20 +9,20 @@ from arq import cron ...@@ -9,20 +9,20 @@ from arq import cron
async def poll(ctx, domain): async def poll(ctx, domain):
session: ClientSession = ctx['session'] session: ClientSession = ctx["session"]
pool = await db.get_pool(settings.DB_DSN) pool = await db.get_pool(settings.DB_DSN)
async with pool as conn: async with pool as conn:
return await crawler.check(conn=conn, session=session, domain=domain) return await crawler.check(conn=conn, session=session, domain=domain)
async def update_all(ctx): async def update_all(ctx):
pool = await db.get_pool(settings.DB_DSN) pool = await db.get_pool(settings.DB_DSN)
for check in await db.get_latest_check_by_domain(pool): for check in await db.get_latest_check_by_domain(pool):
await poll(ctx, check["domain"]) await poll(ctx, check["domain"])
class WorkerSettings: class WorkerSettings:
cron_jobs = [ cron_jobs = [cron(update_all, minute=None)]
cron(update_all, minute=None)
]
max_concurrent_tasks = 20 max_concurrent_tasks = 20
shutdown_delay = 5 shutdown_delay = 5
timeout_seconds = 15 timeout_seconds = 15
...@@ -132,10 +132,13 @@ async def test_domains_rss(db_conn, factories, client, mocker): ...@@ -132,10 +132,13 @@ async def test_domains_rss(db_conn, factories, client, mocker):
assert resp.headers["content-type"] == "application/rss+xml" assert resp.headers["content-type"] == "application/rss+xml"
@pytest.mark.parametrize('input,expected', [ @pytest.mark.parametrize(
('example.com', 'example.com'), "input,expected",
('http://example.com', 'example.com'), [
('https://example.com', 'example.com'), ("example.com", "example.com"),
]) ("http://example.com", "example.com"),
("https://example.com", "example.com"),
],
)
def test_validate_domain(input, expected): def test_validate_domain(input, expected):
assert routes.validate_domain(input) == expected assert routes.validate_domain(input) == expected
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment