From 39d37f185f4df083463230bb507ec5783a4d0317 Mon Sep 17 00:00:00 2001 From: Nazar Date: Wed, 24 Jul 2024 14:14:28 +0300 Subject: [PATCH] miscs --- .vscode/settings.json | 4 +++- main.py | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 184c4eb..59ee7d2 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -7,5 +7,7 @@ "test_*.py" ], "python.testing.pytestEnabled": false, - "python.testing.unittestEnabled": true + "python.testing.unittestEnabled": true, + "python.analysis.typeCheckingMode": "basic", + "python.analysis.autoImportCompletions": true } \ No newline at end of file diff --git a/main.py b/main.py index b6cc066..b259e0f 100644 --- a/main.py +++ b/main.py @@ -12,7 +12,7 @@ NUMBER_REGEX = re.compile(r"[+-]?([0-9]*[.])?[0-9]+") # Reference: https://stackoverflow.com/a/12643073 -def save_data(data: json, file_name: str) -> None: +def save_data(data: list[dict], file_name: str) -> None: """Create JSON file with json data.""" if not Path("data/").exists(): Path("data").mkdir() @@ -24,7 +24,7 @@ def check_price(price: str) -> bool: """Return True if all okay. Return False if prices in wrong format.""" match = re.search(NUMBER_REGEX, price) - return match + return bool(match) def check_discount(discount: str) -> bool: """Return true/false if discount is okay."""