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:
Christian Clauss 2022-02-13 11:01:58 +01:00 committed by GitHub
parent f707f6d689
commit 885580b3a1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 6 additions and 10 deletions

View File

@ -20,10 +20,7 @@ jobs:
- name: Install dependencies - name: Install dependencies
run: | run: |
python -m pip install --upgrade pip setuptools six wheel python -m pip install --upgrade pip setuptools six wheel
python -m pip install mypy pytest-cov -r requirements.txt python -m pip install pytest-cov -r requirements.txt
- run: |
mkdir -p .mypy_cache
mypy --ignore-missing-imports --install-types --non-interactive . || true
- name: Run tests - name: Run tests
run: pytest --doctest-modules --ignore=project_euler/ --ignore=scripts/validate_solutions.py --cov-report=term-missing:skip-covered --cov=. . run: pytest --doctest-modules --ignore=project_euler/ --ignore=scripts/validate_solutions.py --cov-report=term-missing:skip-covered --cov=. .
- if: ${{ success() }} - if: ${{ success() }}

View File

@ -30,7 +30,7 @@ repos:
hooks: hooks:
- id: pyupgrade - id: pyupgrade
args: args:
- --py39-plus - --py310-plus
- repo: https://gitlab.com/pycqa/flake8 - repo: https://gitlab.com/pycqa/flake8
rev: 3.9.2 rev: 3.9.2

View File

@ -13,9 +13,9 @@ def polar_force(
Resolves force along rectangular components. Resolves force along rectangular components.
(force, angle) => (force_x, force_y) (force, angle) => (force_x, force_y)
>>> polar_force(10, 45) >>> polar_force(10, 45)
[7.0710678118654755, 7.071067811865475] [7.071067811865477, 7.0710678118654755]
>>> polar_force(10, 3.14, radian_mode=True) >>> polar_force(10, 3.14, radian_mode=True)
[-9.999987317275394, 0.01592652916486828] [-9.999987317275396, 0.01592652916486828]
""" """
if radian_mode: if radian_mode:
return [magnitude * cos(angle), magnitude * sin(angle)] return [magnitude * cos(angle), magnitude * sin(angle)]

View File

@ -5,7 +5,6 @@ after providing the drug name and zipcode.
""" """
from typing import Union
from urllib.error import HTTPError from urllib.error import HTTPError
from bs4 import BeautifulSoup from bs4 import BeautifulSoup
@ -14,7 +13,7 @@ from requests import exceptions, get
BASE_URL = "https://www.wellrx.com/prescriptions/{0}/{1}/?freshSearch=true" 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] """[summary]
This function will take input of drug name and zipcode, This function will take input of drug name and zipcode,
@ -85,7 +84,7 @@ if __name__ == "__main__":
drug_name = input("Enter drug name: ").strip() drug_name = input("Enter drug name: ").strip()
zip_code = input("Enter zip code: ").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 drug_name, zip_code
) )