Skip to content

Commit

Permalink
mypy strict, ruff improvement
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelcolvin committed Apr 1, 2024
1 parent 2282590 commit c6f673b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 46 deletions.
5 changes: 3 additions & 2 deletions arq/connections.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from dataclasses import dataclass
from datetime import datetime, timedelta
from operator import attrgetter
from typing import TYPE_CHECKING, Any, Callable, List, Optional, Tuple, Union
from typing import TYPE_CHECKING, Any, Callable, List, Optional, Tuple, Union, cast
from urllib.parse import parse_qs, urlparse
from uuid import uuid4

Expand Down Expand Up @@ -237,7 +237,8 @@ def pool_factory(*args: Any, **kwargs: Any) -> ArqRedis:
ssl=settings.ssl,
**kwargs,
)
return client.master_for(settings.sentinel_master, redis_class=ArqRedis)
redis = client.master_for(settings.sentinel_master, redis_class=ArqRedis)
return cast(ArqRedis, redis)

else:
pool_factory = functools.partial(
Expand Down
32 changes: 3 additions & 29 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,7 @@ Changelog = 'https://github.com/samuelcolvin/arq/releases'

[tool.pytest.ini_options]
testpaths = 'tests'
filterwarnings = [
'error',
# 'ignore:pkg_resources is deprecated as an API.*:DeprecationWarning',
# 'ignore:Deprecated call to.*:DeprecationWarning',
]
filterwarnings = ['error']
asyncio_mode = 'auto'
timeout = 10

Expand All @@ -84,34 +80,12 @@ exclude_lines = [
line-length = 120

[tool.ruff.lint]
extend-select = ['Q', 'RUF100', 'C90', 'I']
extend-ignore = [
'E721', # using type() instead of isinstance() - we use this in tests
]
extend-select = ['Q', 'RUF100', 'C90', 'UP', 'I']
flake8-quotes = {inline-quotes = 'single', multiline-quotes = 'double'}
mccabe = { max-complexity = 13 }

[tool.ruff.format]
quote-style = 'single'

[tool.mypy]
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

# 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
strict = true
15 changes: 0 additions & 15 deletions tests/check_tag.py

This file was deleted.

0 comments on commit c6f673b

Please sign in to comment.