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

Replace some literal types in logging with int #7354

Merged
merged 1 commit into from
Feb 22, 2022

Conversation

JukkaL
Copy link
Contributor

@JukkaL JukkaL commented Feb 22, 2022

See #7258 for an extended discussion. In summary, for mypy these
would be better written as follows, but this would not work with
every type checker:

CRITICAL: Final = 50

See python#7258 for an extended discussion. In summary, for mypy these
would be better written as follows, but this would not work with
other type checkers:
```
CRITICAL: Final = 50
```
@github-actions
Copy link
Contributor

Diff from mypy_primer, showing the effect of this PR on open source code:

streamlit (https://github.com/streamlit/streamlit)
- lib/streamlit/logger.py: note: In function "set_log_level":
- lib/streamlit/logger.py:41:21: error: Incompatible types in assignment (expression has type "Literal[40]", variable has type "Literal[50]")  [assignment]
- lib/streamlit/logger.py:43:21: error: Incompatible types in assignment (expression has type "Literal[30]", variable has type "Literal[50]")  [assignment]
- lib/streamlit/logger.py:45:21: error: Incompatible types in assignment (expression has type "Literal[20]", variable has type "Literal[50]")  [assignment]
- lib/streamlit/logger.py:47:21: error: Incompatible types in assignment (expression has type "Literal[10]", variable has type "Literal[50]")  [assignment]
- lib/streamlit/logger.py:57:17: error: Incompatible types in assignment (expression has type "Literal[50]", variable has type "Literal[20]")  [assignment]

pip (https://github.com/pypa/pip)
- src/pip/_internal/locations/__init__.py:68: error: Incompatible types in assignment (expression has type "Literal[10]", variable has type "Literal[30]")
- src/pip/_internal/utils/logging.py:231: error: Incompatible types in assignment (expression has type "int", variable has type "Literal[10]")
- src/pip/_internal/utils/logging.py:233: error: Incompatible types in assignment (expression has type "Literal[30]", variable has type "Literal[10]")
- src/pip/_internal/utils/logging.py:235: error: Incompatible types in assignment (expression has type "Literal[40]", variable has type "Literal[10]")
- src/pip/_internal/utils/logging.py:237: error: Incompatible types in assignment (expression has type "Literal[50]", variable has type "Literal[10]")
- src/pip/_internal/utils/logging.py:239: error: Incompatible types in assignment (expression has type "Literal[20]", variable has type "Literal[10]")
- src/pip/_internal/utils/subprocess.py:125: error: Incompatible types in assignment (expression has type "int", variable has type "Literal[20]")

@srittau srittau merged commit 12f45c5 into python:master Feb 22, 2022
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