Skip to content

Commit

Permalink
miscs
Browse files Browse the repository at this point in the history
  • Loading branch information
Nazar1ky committed Jul 24, 2024
1 parent f985a91 commit 39d37f1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
4 changes: 2 additions & 2 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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."""
Expand Down

0 comments on commit 39d37f1

Please sign in to comment.