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

Upgrade Mypy from 1.3.x to 1.8.x #1464

Merged
merged 8 commits into from
Feb 8, 2024
21 changes: 12 additions & 9 deletions .github/workflows/lint-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ concurrency:
permissions:
contents: read

env:
LINTING_PYTHON_VERSION: 3.8

jobs:
mypy:
runs-on: ubuntu-latest
Expand All @@ -26,7 +29,7 @@ jobs:
persist-credentials: false
- uses: actions/setup-python@v5
with:
python-version: 3.7
python-version: ${{ env.LINTING_PYTHON_VERSION }}
cache: 'pip'
cache-dependency-path: 'setup.py'
- name: Install with type-checking tools, stubs & minimal test libraries
Expand All @@ -43,7 +46,7 @@ jobs:
persist-credentials: false
- uses: actions/setup-python@v5
with:
python-version: 3.7
python-version: ${{ env.LINTING_PYTHON_VERSION }}
cache: 'pip'
cache-dependency-path: 'setup.py'
- name: Install with linting tools
Expand All @@ -60,7 +63,7 @@ jobs:
persist-credentials: false
- uses: actions/setup-python@v5
with:
python-version: 3.7
python-version: ${{ env.LINTING_PYTHON_VERSION }}
cache: 'pip'
cache-dependency-path: 'setup.py'
- name: Install with linting tools & minimal test libraries
Expand All @@ -78,7 +81,7 @@ jobs:
persist-credentials: false
- uses: actions/setup-python@v5
with:
python-version: 3.7
python-version: ${{ env.LINTING_PYTHON_VERSION }}
cache: 'pip'
cache-dependency-path: 'setup.py'
- name: Install with linting tools
Expand All @@ -95,7 +98,7 @@ jobs:
persist-credentials: false
- uses: actions/setup-python@v5
with:
python-version: 3.7
python-version: ${{ env.LINTING_PYTHON_VERSION }}
cache: 'pip'
cache-dependency-path: 'setup.py'
- name: Install with linting tools
Expand All @@ -112,7 +115,7 @@ jobs:
persist-credentials: false
- uses: actions/setup-python@v5
with:
python-version: 3.7
python-version: ${{ env.LINTING_PYTHON_VERSION }}
cache: 'pip'
cache-dependency-path: 'setup.py'
- name: Minimal install
Expand All @@ -129,7 +132,7 @@ jobs:
persist-credentials: false
- uses: actions/setup-python@v5
with:
python-version: 3.7
python-version: ${{ env.LINTING_PYTHON_VERSION }}
cache: 'pip'
cache-dependency-path: 'setup.py'
- name: Minimal install
Expand All @@ -154,7 +157,7 @@ jobs:
- uses: actions/setup-python@v5
if: github.event_name == 'pull_request'
with:
python-version: 3.7
python-version: ${{ env.LINTING_PYTHON_VERSION }}
cache: 'pip'
cache-dependency-path: 'setup.py'
- name: Install with gitlint
Expand Down Expand Up @@ -215,7 +218,7 @@ jobs:
- uses: actions/setup-python@v5
if: github.event_name == 'pull_request'
with:
python-version: 3.7
python-version: ${{ env.LINTING_PYTHON_VERSION }}
cache: 'pip'
cache-dependency-path: 'setup.py'
- name: Run check-branch
Expand Down
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@ warn_unused_ignores = true
warn_return_any = false
no_implicit_reexport = true # NOTE: Disabled explicitly for tests/ in run-mypy
strict_equality = true
strict_concatenate = true

extra_checks = true

enable_error_code = [
"redundant-expr",
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def long_description():

typing_deps = [
"lxml-stubs",
"mypy~=1.3.0",
"mypy~=1.8.0",
"types-beautifulsoup4",
"types-pygments",
"types-python-dateutil",
Expand Down Expand Up @@ -98,7 +98,7 @@ def long_description():
extras_require={
"dev": testing_deps + linting_deps + typing_deps + helper_deps + gitlint_deps,
"testing": testing_deps,
"testing_minimal": testing_minimal_deps,
"testing-minimal": testing_minimal_deps, # extra must be hyphenated
"linting": linting_deps,
"gitlint": gitlint_deps,
"typing": typing_deps,
Expand Down
2 changes: 1 addition & 1 deletion tools/convert-unicode-emoji-data
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ from pathlib import Path, PurePath

try:
# Ignored for type-checking, as it is a temporary file, deleted at the end of file
from zulipterminal.unicode_emoji_dict import ( # type: ignore [import]
from zulipterminal.unicode_emoji_dict import ( # type: ignore [import-not-found,import-untyped,unused-ignore]
EMOJI_NAME_MAPS,
)
except ModuleNotFoundError:
Expand Down
10 changes: 5 additions & 5 deletions zulipterminal/cli/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -513,11 +513,11 @@ def main(options: Optional[List[str]] = None) -> None:
)

# Validate remaining settings
for setting, valid_values in valid_remaining_settings.items():
if zterm[setting].value not in valid_values:
for setting, valid_remaining_values in valid_remaining_settings.items():
if zterm[setting].value not in valid_remaining_values:
helper_text = (
["Valid values are:"]
+ [f" {option}" for option in valid_values]
+ [f" {option}" for option in valid_remaining_values]
+ [f"Specify the {setting} option in zuliprc file."]
)
exit_with_error(
Expand Down Expand Up @@ -563,8 +563,8 @@ def print_setting(setting: str, data: SettingData, suffix: str = "") -> None:

# Translate valid strings for boolean values into True/False
boolean_settings: Dict[str, bool] = dict()
for setting, valid_values in VALID_BOOLEAN_SETTINGS.items():
boolean_settings[setting] = zterm[setting].value == valid_values[0]
for setting, valid_boolean_values in VALID_BOOLEAN_SETTINGS.items():
boolean_settings[setting] = zterm[setting].value == valid_boolean_values[0]

Controller(
config_file=zuliprc_path,
Expand Down
Loading