Skip to content

Commit

Permalink
ruff lint
Browse files Browse the repository at this point in the history
  • Loading branch information
freddyheppell committed Jul 3, 2024
1 parent 3d74989 commit 844456b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 12 deletions.
4 changes: 2 additions & 2 deletions src/extractor/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ def main() -> None:
parser.add_argument("out_dir", help="Output directory", type=empty_directory)
parser.add_argument(
"--scrape-root",
'-S',
"-S",
help="Root directory of an HTML scrape",
type=directory,
required=False,
default=None
default=None,
)
parser.add_argument(
"--json-prefix",
Expand Down
4 changes: 3 additions & 1 deletion src/extractor/extractors/posts.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,9 @@ def load_posts(
lambda link: load_scrape(scrape_urls_files, link)
)
posts_df[["language", "translations"]] = posts_df.apply(
lambda r: extract_translations(r["scrape_bs"], r["link"], translation_pickers),
lambda r: extract_translations(
r["scrape_bs"], r["link"], translation_pickers
),
axis=1,
)
else:
Expand Down
12 changes: 3 additions & 9 deletions tests/extract/test_extract.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from pathlib import Path

import pandas as pd

from extractor.extract import WPExtractor


Expand All @@ -24,9 +23,7 @@ def _assert_output_valid(out_dir: Path):


def test_extract_no_scrape(datadir):
extractor = WPExtractor(
json_root=datadir / "json",
)
extractor = WPExtractor(json_root=datadir / "json")

extractor.extract()
_assert_extractor_valid(extractor)
Expand All @@ -38,15 +35,12 @@ def test_extract_no_scrape(datadir):


def test_extract_scrape(datadir):
extractor = WPExtractor(
json_root=datadir / "json",
scrape_root=datadir / "scrape"
)
extractor = WPExtractor(json_root=datadir / "json", scrape_root=datadir / "scrape")

extractor.extract()
_assert_extractor_valid(extractor)

assert 'translations' in extractor.posts.columns
assert "translations" in extractor.posts.columns

out_dir = datadir / "out_json"
out_dir.mkdir()
Expand Down

0 comments on commit 844456b

Please sign in to comment.