Skip to content

Commit 885580b

Browse files
authored
pyupgrade --py310-plus and run mypy in precommit, not build (TheAlgorithms#5996)
* pyupgrade --py310-plus and run mypy in precommit, not build * pyupgrade --py310-plus web_programming/fetch_well_rx_price.py * pyupgrade --py310-plus web_programming/fetch_well_rx_price.py * Fix arithmetic_analysis/in_static_equilibrium.py * Fix arithmetic_analysis/in_static_equilibrium.py
1 parent f707f6d commit 885580b

File tree

4 files changed

+6
-10
lines changed

4 files changed

+6
-10
lines changed

.github/workflows/build.yml

+1-4
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,7 @@ jobs:
2020
- name: Install dependencies
2121
run: |
2222
python -m pip install --upgrade pip setuptools six wheel
23-
python -m pip install mypy pytest-cov -r requirements.txt
24-
- run: |
25-
mkdir -p .mypy_cache
26-
mypy --ignore-missing-imports --install-types --non-interactive . || true
23+
python -m pip install pytest-cov -r requirements.txt
2724
- name: Run tests
2825
run: pytest --doctest-modules --ignore=project_euler/ --ignore=scripts/validate_solutions.py --cov-report=term-missing:skip-covered --cov=. .
2926
- if: ${{ success() }}

.pre-commit-config.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ repos:
3030
hooks:
3131
- id: pyupgrade
3232
args:
33-
- --py39-plus
33+
- --py310-plus
3434

3535
- repo: https://gitlab.com/pycqa/flake8
3636
rev: 3.9.2

arithmetic_analysis/in_static_equilibrium.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ def polar_force(
1313
Resolves force along rectangular components.
1414
(force, angle) => (force_x, force_y)
1515
>>> polar_force(10, 45)
16-
[7.0710678118654755, 7.071067811865475]
16+
[7.071067811865477, 7.0710678118654755]
1717
>>> polar_force(10, 3.14, radian_mode=True)
18-
[-9.999987317275394, 0.01592652916486828]
18+
[-9.999987317275396, 0.01592652916486828]
1919
"""
2020
if radian_mode:
2121
return [magnitude * cos(angle), magnitude * sin(angle)]

web_programming/fetch_well_rx_price.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
66
"""
77

8-
from typing import Union
98
from urllib.error import HTTPError
109

1110
from bs4 import BeautifulSoup
@@ -14,7 +13,7 @@
1413
BASE_URL = "https://www.wellrx.com/prescriptions/{0}/{1}/?freshSearch=true"
1514

1615

17-
def fetch_pharmacy_and_price_list(drug_name: str, zip_code: str) -> Union[list, None]:
16+
def fetch_pharmacy_and_price_list(drug_name: str, zip_code: str) -> list | None:
1817
"""[summary]
1918
2019
This function will take input of drug name and zipcode,
@@ -85,7 +84,7 @@ def fetch_pharmacy_and_price_list(drug_name: str, zip_code: str) -> Union[list,
8584
drug_name = input("Enter drug name: ").strip()
8685
zip_code = input("Enter zip code: ").strip()
8786

88-
pharmacy_price_list: Union[list, None] = fetch_pharmacy_and_price_list(
87+
pharmacy_price_list: list | None = fetch_pharmacy_and_price_list(
8988
drug_name, zip_code
9089
)
9190

0 commit comments

Comments
 (0)