Skip to content

Commit f0252e6

Browse files
committed
Add development dependencies for testing and formatting
Change inputs to work properly
1 parent 6d90789 commit f0252e6

File tree

18 files changed

+105
-177
lines changed

18 files changed

+105
-177
lines changed

.github/workflows/check-style.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
- name: Examine formatting with black
2929
run: |
3030
pip install black
31-
black . --check
31+
ruff . --check
3232
- name: Examine import ordering with isort
3333
run: |
3434
pip install isort

.github/workflows/run-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
mypy . --ignore-missing-imports --exclude /build/
3737
- name: Install package
3838
run: |
39-
pip install -e .
39+
pip install -e ".[dev]"
4040
- name: Test with pytest, ensuring 75% coverage
4141
run: |
4242
pip install pytest pytest-cov

Makefile

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
all:
2+
@echo "Running make format"
3+
$(MAKE) format
4+
@echo "Running make format-check"
5+
$(MAKE) format-check
6+
@echo "Running make test"
7+
$(MAKE) test
8+
@echo "Running make type-check"
9+
$(MAKE) type-check
10+
11+
format:
12+
ruff format .
13+
isort --profile black .
14+
15+
format-check:
16+
ruff check .
17+
isort --check-only --profile black .
18+
19+
test:
20+
pytest tests/ --cov --cov-fail-under=85
21+
22+
type-check:
23+
mypy src

leetcode_study_tool/cli.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import argparse
22

3-
from leetcode_study_tool.constants.presets import PRESET_MAP
43
from leetcode_study_tool.creator import ProblemsCreator
4+
from leetcode_study_tool.presets import PRESET_MAP
55

66

77
def generate_parser() -> argparse.ArgumentParser:
@@ -14,9 +14,7 @@ def generate_parser() -> argparse.ArgumentParser:
1414
The parsed command line arguments.
1515
"""
1616
parser = argparse.ArgumentParser(
17-
description=(
18-
"Generates problems from LeetCode questions in a desired format."
19-
),
17+
description=("Generates problems from LeetCode questions in a desired format."),
2018
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
2119
)
2220

leetcode_study_tool/creator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77

88
from p_tqdm import p_map
99

10-
from leetcode_study_tool.constants.presets import PRESET_MAP
1110
from leetcode_study_tool.formatters import FORMAT_MAP
1211
from leetcode_study_tool.outputs import SAVE_MAP
12+
from leetcode_study_tool.presets import PRESET_MAP
1313
from leetcode_study_tool.queries import generate_session, get_data, get_slug
1414

1515

leetcode_study_tool/formatters.py

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,11 @@
22
from textwrap import dedent
33
from typing import List, Union
44

5-
from leetcode_study_tool.constants.leetcode_to_neetcode import (
6-
LEETCODE_TO_NEETCODE, # fmt: skip
7-
)
5+
from leetcode_study_tool.leetcode_to_neetcode import LEETCODE_TO_NEETCODE # fmt: skip
86
from leetcode_study_tool.queries import get_url
97

108

11-
def format_list_element(
12-
title: str, elements: List[str], is_link: bool = False
13-
) -> str:
9+
def format_list_element(title: str, elements: List[str], is_link: bool = False) -> str:
1410
"""
1511
formats an HTML list element for the given title and elements
1612
@@ -92,9 +88,7 @@ def format_anki(url: str, slug: str, data: dict):
9288
)
9389

9490
if data["tags"]:
95-
problem += format_list_element(
96-
"Tags", [tag["name"] for tag in data["tags"]]
97-
)
91+
problem += format_list_element("Tags", [tag["name"] for tag in data["tags"]])
9892

9993
problem += ";"
10094

@@ -184,9 +178,7 @@ def format_excel(url: str, slug: str, data: dict) -> List[Union[str, date]]:
184178
)
185179
)
186180
if data.get("companies"):
187-
row.append(
188-
", ".join([company["name"] for company in data["companies"]])
189-
)
181+
row.append(", ".join([company["name"] for company in data["companies"]]))
190182
else:
191183
row.append("")
192184
return row

0 commit comments

Comments
 (0)