Skip to content

pyupgrade --py310-plus and run mypy in precommit, not build #5996

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Feb 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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() }}
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ repos:
hooks:
- id: pyupgrade
args:
- --py39-plus
- --py310-plus

- repo: https://gitlab.com/pycqa/flake8
rev: 3.9.2
Expand Down
4 changes: 2 additions & 2 deletions arithmetic_analysis/in_static_equilibrium.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

weird

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably explain in the numpy changelog.

>>> 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)]
Expand Down
5 changes: 2 additions & 3 deletions web_programming/fetch_well_rx_price.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

"""

from typing import Union
from urllib.error import HTTPError

from bs4 import BeautifulSoup
Expand All @@ -14,7 +13,7 @@
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,
Expand Down Expand Up @@ -85,7 +84,7 @@ def fetch_pharmacy_and_price_list(drug_name: str, zip_code: str) -> Union[list,
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
)

Expand Down