Skip to content

Commit

Permalink
Merge 3bd277a into 052b56b
Browse files Browse the repository at this point in the history
  • Loading branch information
fspv authored Jun 12, 2022
2 parents 052b56b + 3bd277a commit 0f9f537
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/style-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- name: Install pylint
run: pip install pylint
- name: Run pylint
run: pylint -E generate.py
run: find . -type f -name "*.py" | xargs pylint -E
black:
name: black
runs-on: ubuntu-latest
Expand Down Expand Up @@ -46,4 +46,4 @@ jobs:
- name: Install isort
run: pip install isort
- name: Run isort
run: isort --ensure-newline-before-comments --diff generate.py
run: isort --ensure-newline-before-comments --diff -v .
2 changes: 1 addition & 1 deletion generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def parse_args() -> argparse.Namespace:
"--start", type=int, help="Start generation from this problem", default=0
)
parser.add_argument(
"--stop", type=int, help="Stop generation on this problem", default=2 ** 64
"--stop", type=int, help="Stop generation on this problem", default=2**64
)
parser.add_argument(
"--page-size",
Expand Down
5 changes: 4 additions & 1 deletion leetcode_anki/helpers/leetcode.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# pylint: disable=missing-module-docstring
import functools
import json
import logging
Expand Down Expand Up @@ -230,7 +231,7 @@ def _get_problems_data(
leetcode.models.graphql_question_detail.GraphqlQuestionDetail
] = []

logging.info(f"Fetching {stop - start + 1} problems {page_size} per page")
logging.info("Fetching %s problems %s per page", stop - start + 1, page_size)

for page in tqdm(
range(math.ceil((stop - start + 1) / page_size)),
Expand Down Expand Up @@ -261,6 +262,8 @@ def _get_problem_data(
if problem_slug in cache:
return cache[problem_slug]

raise ValueError(f"Problem {problem_slug} is not in cache")

async def _get_description(self, problem_slug: str) -> str:
"""
Problem description
Expand Down
4 changes: 4 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,7 @@ asyncio_mode = "strict"
testpaths = [
"test",
]

[tool.pylint]
max-line-length = 88
disable = ["line-too-long"]

0 comments on commit 0f9f537

Please sign in to comment.