mirror of
https://github.com/TheAlgorithms/Python.git
synced 2024-11-27 15:01:08 +00:00
pyupgrade --py310-plus and run mypy in precommit, not build (#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
This commit is contained in:
parent
f707f6d689
commit
885580b3a1
5
.github/workflows/build.yml
vendored
5
.github/workflows/build.yml
vendored
|
@ -20,10 +20,7 @@ jobs:
|
|||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip setuptools six wheel
|
||||
python -m pip install mypy pytest-cov -r requirements.txt
|
||||
- run: |
|
||||
mkdir -p .mypy_cache
|
||||
mypy --ignore-missing-imports --install-types --non-interactive . || true
|
||||
python -m pip install pytest-cov -r requirements.txt
|
||||
- name: Run tests
|
||||
run: pytest --doctest-modules --ignore=project_euler/ --ignore=scripts/validate_solutions.py --cov-report=term-missing:skip-covered --cov=. .
|
||||
- if: ${{ success() }}
|
||||
|
|
|
@ -30,7 +30,7 @@ repos:
|
|||
hooks:
|
||||
- id: pyupgrade
|
||||
args:
|
||||
- --py39-plus
|
||||
- --py310-plus
|
||||
|
||||
- repo: https://gitlab.com/pycqa/flake8
|
||||
rev: 3.9.2
|
||||
|
|
|
@ -13,9 +13,9 @@ def polar_force(
|
|||
Resolves force along rectangular components.
|
||||
(force, angle) => (force_x, force_y)
|
||||
>>> polar_force(10, 45)
|
||||
[7.0710678118654755, 7.071067811865475]
|
||||
[7.071067811865477, 7.0710678118654755]
|
||||
>>> polar_force(10, 3.14, radian_mode=True)
|
||||
[-9.999987317275394, 0.01592652916486828]
|
||||
[-9.999987317275396, 0.01592652916486828]
|
||||
"""
|
||||
if radian_mode:
|
||||
return [magnitude * cos(angle), magnitude * sin(angle)]
|
||||
|
|
|
@ -5,7 +5,6 @@ after providing the drug name and zipcode.
|
|||
|
||||
"""
|
||||
|
||||
from typing import Union
|
||||
from urllib.error import HTTPError
|
||||
|
||||
from bs4 import BeautifulSoup
|
||||
|
@ -14,7 +13,7 @@ from requests import exceptions, get
|
|||
BASE_URL = "https://www.wellrx.com/prescriptions/{0}/{1}/?freshSearch=true"
|
||||
|
||||
|
||||
def fetch_pharmacy_and_price_list(drug_name: str, zip_code: str) -> Union[list, None]:
|
||||
def fetch_pharmacy_and_price_list(drug_name: str, zip_code: str) -> list | None:
|
||||
"""[summary]
|
||||
|
||||
This function will take input of drug name and zipcode,
|
||||
|
@ -85,7 +84,7 @@ if __name__ == "__main__":
|
|||
drug_name = input("Enter drug name: ").strip()
|
||||
zip_code = input("Enter zip code: ").strip()
|
||||
|
||||
pharmacy_price_list: Union[list, None] = fetch_pharmacy_and_price_list(
|
||||
pharmacy_price_list: list | None = fetch_pharmacy_and_price_list(
|
||||
drug_name, zip_code
|
||||
)
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user