Skip to content
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

Fix mypy errors in people.py #193

Merged
merged 1 commit into from
Aug 25, 2024
Merged

Fix mypy errors in people.py #193

merged 1 commit into from
Aug 25, 2024

Conversation

tianyizheng02
Copy link
Contributor

@tianyizheng02 tianyizheng02 commented Aug 11, 2024

Run mypy with --strict flag to fix type hints in people.py

Contributes to #45 by fixing existing type hint errors prior to introducing mypy to the repo.

Before:

> mypy --strict pittapi/people.py                                    
pittapi/people.py:20: error: Skipping analyzing "requests_html": module is installed, but missing library stubs or py.typed marker  [import-untyped]
pittapi/people.py:20: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
pittapi/people.py:44: error: Missing type parameters for generic type "dict"  [type-arg]
pittapi/people.py:47: error: "str" has no attribute "attrs"  [attr-defined]
pittapi/people.py:48: error: "str" has no attribute "text"  [attr-defined]
pittapi/people.py:49: error: "str" has no attribute "text"  [attr-defined]
pittapi/people.py:50: error: "str" has no attribute "text"  [attr-defined]
pittapi/people.py:58: error: "str" has no attribute "text"  [attr-defined]
pittapi/people.py:60: error: "str" has no attribute "text"  [attr-defined]
Found 8 errors in 1 file (checked 1 source file)

After:

mypy --strict pittapi/people.py
pittapi/people.py:20: error: Skipping analyzing "requests_html": module is installed, but missing library stubs or py.typed marker  [import-untyped]
pittapi/people.py:20: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
Found 1 error in 1 file (checked 1 source file)

The sole remaining mypy error is due to requests_html not providing type hints (see https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-library-stubs-or-py-typed-marker). Once we introduce mypy to this repo, we'll need to manually suppress these warnings (e.g., with the --ignore-missing-imports flag).

@tianyizheng02 tianyizheng02 merged commit 8ba515b into dev Aug 25, 2024
4 checks passed
@tianyizheng02 tianyizheng02 deleted the mypy-people branch August 25, 2024 21:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants