Skip to content

Commit

Permalink
🎉 Fix formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
awtkns committed Feb 13, 2024
1 parent 74fc67e commit 828178c
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 14 deletions.
16 changes: 10 additions & 6 deletions harambe/meta.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ class DecoratedScraper(TypedDict):

def is_sdk_scraper_decorator(node: ast.expr) -> bool:
return (
isinstance(node, ast.Call)
and isinstance(node.func, ast.Attribute)
and node.func.attr == "scraper"
and isinstance(node.func.value, ast.Name)
and node.func.value.id == "SDK"
isinstance(node, ast.Call)
and isinstance(node.func, ast.Attribute)
and node.func.attr == "scraper"
and isinstance(node.func.value, ast.Name)
and node.func.value.id == "SDK"
)


Expand Down Expand Up @@ -51,7 +51,11 @@ def find_decorated_scrapers(file_path: Path) -> List[DecoratedScraper]:


def walk_package_for_decorators(path: Path) -> List[DecoratedScraper]:
files = [path] if path.is_file() else [p for p in path.rglob("*.py") if not p.name.startswith("_")]
files = (
[path]
if path.is_file()
else [p for p in path.rglob("*.py") if not p.name.startswith("_")]
)

decorated_methods_in_package = []
for file in files:
Expand Down
8 changes: 4 additions & 4 deletions tests/test_meta.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,12 @@ def test_url_to_netloc(url, expected):
[
(ast.Call(func=ast.Attribute(value=ast.Name(id="SDK"), attr="scraper")), True),
(
ast.Call(func=ast.Attribute(value=ast.Name(id="NotSDK"), attr="scraper")),
False,
ast.Call(func=ast.Attribute(value=ast.Name(id="NotSDK"), attr="scraper")),
False,
),
(
ast.Call(func=ast.Attribute(value=ast.Name(id="SDK"), attr="not_scraper")),
False,
ast.Call(func=ast.Attribute(value=ast.Name(id="SDK"), attr="not_scraper")),
False,
),
(ast.Call(func=ast.Attribute(value=ast.Num(n=123), attr="scraper")), False),
(ast.Num(n=123), False),
Expand Down
7 changes: 3 additions & 4 deletions tests/test_sdk.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,9 @@ async def test_sdk_enqueue_calls_on_enqueue_url_for_each_observer():
await sdk.enqueue(*urls, context=context)

assert observer.on_queue_url.call_count == len(urls)
observer.on_queue_url.assert_has_awaits([
call(urls[0], context),
call(urls[1], context)
], any_order=False)
observer.on_queue_url.assert_has_awaits(
[call(urls[0], context), call(urls[1], context)], any_order=False
)

assert observer.on_queue_url.call_count == len(urls)
observer.on_save_data.assert_not_awaited()
Expand Down

0 comments on commit 828178c

Please sign in to comment.