Skip to content

Commit 25ee21e

Browse files
committed
Fix mypy and black issues
1 parent d44403b commit 25ee21e

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

openapi_python_client/__init__.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,13 @@ def main(*, url: Optional[str], path: Optional[str]) -> None:
1818

1919
def _get_json(*, url: Optional[str], path: Optional[str]) -> Dict[str, Any]:
2020
json_bytes: bytes
21-
if url:
21+
if url is not None:
2222
response = requests.get(url)
2323
json_bytes = response.content
24-
else:
24+
elif path is not None:
2525
json_bytes = Path(path).read_bytes()
26+
else:
27+
raise ValueError("No URL or Path provided")
2628
return orjson.loads(json_bytes)
2729

2830

openapi_python_client/cli.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@
66

77

88
@click.group()
9-
def cli():
9+
def cli() -> None:
1010
""" Entrypoint into CLI """
1111
pass
1212

1313

1414
@cli.command()
1515
@click.option("--url", help="The URL to the openapi.json file")
1616
@click.option("--path", help="The path to the openapi.json file")
17-
def generate(url: Optional[str], path: Optional[str]):
17+
def generate(url: Optional[str], path: Optional[str]) -> None:
1818
""" Generate a new OpenAPI Client library """
1919
if not url and not path:
2020
print("You must either provide --url or --path")

tests/test___init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ def test_main(mocker):
88
path = mocker.MagicMock()
99

1010
from openapi_python_client import main
11+
1112
main(url=url, path=path)
1213

1314
_get_json.assert_called_once_with(url=url, path=path)

0 commit comments

Comments
 (0)