From f8bda4b9ad04647b5879579c89d70fc1b8c064ab Mon Sep 17 00:00:00 2001 From: Matthew Martin Date: Fri, 26 May 2023 17:26:49 -0500 Subject: [PATCH 1/3] Fix implicit optional mypy lints --- arq/connections.py | 2 +- arq/jobs.py | 2 +- arq/worker.py | 4 ++-- pyproject.toml | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/arq/connections.py b/arq/connections.py index d4fc4434..3466069a 100644 --- a/arq/connections.py +++ b/arq/connections.py @@ -206,7 +206,7 @@ async def queued_jobs(self, *, queue_name: Optional[str] = None) -> List[JobDef] async def create_pool( - settings_: RedisSettings = None, + settings_: Optional[RedisSettings] = None, *, retry: int = 0, job_serializer: Optional[Serializer] = None, diff --git a/arq/jobs.py b/arq/jobs.py index 8028cbe7..ab42095f 100644 --- a/arq/jobs.py +++ b/arq/jobs.py @@ -83,7 +83,7 @@ def __init__( self._deserializer = _deserializer async def result( - self, timeout: Optional[float] = None, *, poll_delay: float = 0.5, pole_delay: float = None + self, timeout: Optional[float] = None, *, poll_delay: float = 0.5, pole_delay: Optional[float] = None ) -> Any: """ Get the result of the job or, if the job raised an exception, reraise it. diff --git a/arq/worker.py b/arq/worker.py index 81afd5b7..474c1ebf 100644 --- a/arq/worker.py +++ b/arq/worker.py @@ -188,8 +188,8 @@ def __init__( *, queue_name: Optional[str] = default_queue_name, cron_jobs: Optional[Sequence[CronJob]] = None, - redis_settings: RedisSettings = None, - redis_pool: ArqRedis = None, + redis_settings: Optional[RedisSettings] = None, + redis_pool: Optional[ArqRedis] = None, burst: bool = False, on_startup: Optional['StartupShutdown'] = None, on_shutdown: Optional['StartupShutdown'] = None, diff --git a/pyproject.toml b/pyproject.toml index 7d88ada4..b66a3c8d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -105,10 +105,10 @@ disallow_subclassing_any = true disallow_incomplete_defs = true disallow_untyped_decorators = true disallow_untyped_calls = true +no_implicit_optional = true # for strict mypy: (this is the tricky one :-)) disallow_untyped_defs = true # remaining arguments from `mypy --strict` which cause errors -#no_implicit_optional = true #warn_return_any = true From 7ff75e61659e97b244839fcd81a09be7994e7ff5 Mon Sep 17 00:00:00 2001 From: Matthew Martin Date: Fri, 26 May 2023 17:29:45 -0500 Subject: [PATCH 2/3] Simplify mypy configuration --- pyproject.toml | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index b66a3c8d..15c25160 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -92,23 +92,8 @@ combine_as_imports = true color_output = true [tool.mypy] +strict = true show_error_codes = true -follow_imports = 'silent' -strict_optional = true -warn_redundant_casts = true -warn_unused_ignores = true -disallow_any_generics = true -check_untyped_defs = true -no_implicit_reexport = true -warn_unused_configs = true -disallow_subclassing_any = true -disallow_incomplete_defs = true -disallow_untyped_decorators = true -disallow_untyped_calls = true -no_implicit_optional = true - -# for strict mypy: (this is the tricky one :-)) -disallow_untyped_defs = true # remaining arguments from `mypy --strict` which cause errors -#warn_return_any = true +warn_return_any = false From 9799c7c9d7867c0fd925d072d689ea8a18194d02 Mon Sep 17 00:00:00 2001 From: Matthew Martin Date: Fri, 26 May 2023 17:33:35 -0500 Subject: [PATCH 3/3] Bump mypy from 0.971 to 1.3.0 --- pyproject.toml | 1 - requirements/linting.in | 2 +- requirements/linting.txt | 12 +++++------- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 15c25160..4e2288fe 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -93,7 +93,6 @@ color_output = true [tool.mypy] strict = true -show_error_codes = true # remaining arguments from `mypy --strict` which cause errors warn_return_any = false diff --git a/requirements/linting.in b/requirements/linting.in index ae67c86a..88cefb5e 100644 --- a/requirements/linting.in +++ b/requirements/linting.in @@ -2,6 +2,6 @@ black>=22,<23 flake8>=5,<6 flake8-quotes>=3,<4 isort[colors]>=5,<6 -mypy<1 +mypy>=1,<2 types-pytz types_redis>=4.2,<4.3 diff --git a/requirements/linting.txt b/requirements/linting.txt index 57176e06..37bf0744 100644 --- a/requirements/linting.txt +++ b/requirements/linting.txt @@ -1,6 +1,6 @@ # -# This file is autogenerated by pip-compile with python 3.9 -# To update, run: +# This file is autogenerated by pip-compile with Python 3.10 +# by the following command: # # pip-compile --output-file=requirements/linting.txt requirements/linting.in # @@ -20,9 +20,9 @@ isort[colors]==5.10.1 # via -r requirements/linting.in mccabe==0.7.0 # via flake8 -mypy==0.971 +mypy==1.3.0 # via -r requirements/linting.in -mypy-extensions==0.4.3 +mypy-extensions==1.0.0 # via # black # mypy @@ -43,6 +43,4 @@ types-pytz==2022.2.1.0 types-redis==4.2.8 # via -r requirements/linting.in typing-extensions==4.3.0 - # via - # black - # mypy + # via mypy