Skip to content

Commit

Permalink
Remove pyright
Browse files Browse the repository at this point in the history
  • Loading branch information
alisaifee committed Feb 18, 2024
1 parent b2e8269 commit 6704797
Show file tree
Hide file tree
Showing 14 changed files with 15 additions and 53 deletions.
1 change: 0 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
lint:
black --check coredis tests
ruff coredis tests
pyright coredis
mypy coredis

lint-fix:
Expand Down
2 changes: 1 addition & 1 deletion coredis/client/basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -980,7 +980,7 @@ async def _execute_command(
if isinstance(callback, AsyncPreProcessingCallback):
await callback.pre_process(
self, reply, version=self.protocol_version, **options
) # pyright: reportGeneralTypeIssues=false
)
return callback(
reply,
version=self.protocol_version,
Expand Down
2 changes: 1 addition & 1 deletion coredis/client/cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -932,7 +932,7 @@ async def _execute_command_on_single_node(
if isinstance(callback, AsyncPreProcessingCallback):
await callback.pre_process(
self, reply, version=self.protocol_version, **kwargs
) # pyright: reportGeneralTypeIssues=false
)
response = callback(
reply,
version=self.protocol_version,
Expand Down
5 changes: 3 additions & 2 deletions coredis/commands/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -2818,13 +2818,14 @@ async def restore(
"""
Create a key using the provided serialized value, previously obtained using DUMP.
"""

params: CommandArgList = [
key,
(
normalized_milliseconds(ttl) # type: ignore
if not absttl
else normalized_time_milliseconds(ttl)
), # type: ignore
else normalized_time_milliseconds(ttl) # type: ignore
),
serialized_value,
]

Expand Down
6 changes: 2 additions & 4 deletions coredis/commands/function.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,9 +308,7 @@ def split_args(
bound_arguments.apply_defaults()
arguments: Dict[str, Any] = bound_arguments.arguments
instance: Library[AnyStr] = arguments.pop(first_arg)
if not isinstance(
instance, Library
): # pyright: reportUnnecessaryIsInstance=false
if not isinstance(instance, Library):
raise RuntimeError(
f"{instance.__class__.__name__} is not a subclass of"
" coredis.commands.function.Library therefore it's methods cannot be bound "
Expand Down Expand Up @@ -340,7 +338,7 @@ async def _inner(*args: P.args, **kwargs: P.kwargs) -> R:
f"Library {instance.name} has no registered function {function_name}"
)
# TODO: atleast lie with a cast.
# mypy doesn't like the cast. pyright is ok with it
# mypy doesn't like the cast
return await func(keys, arguments, readonly=readonly) # type: ignore

return _inner
Expand Down
2 changes: 1 addition & 1 deletion coredis/commands/script.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ async def __inner(
) -> R:
keys, arguments, client = split_args(sig.bind(*args, **kwargs))
# TODO: atleast lie with a cast.
# mypy doesn't like the cast. pyright is ok with it
# mypy doesn't like the cast
return await script_instance(keys, arguments, client, readonly) # type: ignore

return __inner
Expand Down
14 changes: 4 additions & 10 deletions coredis/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ async def read(self) -> None:
if isinstance(c.callback, AsyncPreProcessingCallback):
await c.callback.pre_process(
self.client, transaction_result[idx], **c.options
) # pyright: reportGeneralTypeIssues=false
)
c.result = c.callback(
transaction_result[idx],
version=connection.protocol_version,
Expand Down Expand Up @@ -565,9 +565,7 @@ async def _execute_transaction(
for r, cmd in zip(response, commands):
if not isinstance(r, Exception):
if isinstance(cmd.callback, AsyncPreProcessingCallback):
await cmd.callback.pre_process(
self.client, r, **cmd.options
) # pyright: reportGeneralTypeIssues=false
await cmd.callback.pre_process(self.client, r, **cmd.options)
r = cmd.callback(r, version=connection.protocol_version, **cmd.options)
data.append(r)
return tuple(data)
Expand Down Expand Up @@ -604,9 +602,7 @@ async def _execute_pipeline(
try:
res = await cmd.request if cmd.request else None
if isinstance(cmd.callback, AsyncPreProcessingCallback):
await cmd.callback.pre_process(
self.client, res, **cmd.options
) # pyright: reportGeneralTypeIssues=false
await cmd.callback.pre_process(self.client, res, **cmd.options)
response.append(
cmd.callback(
res,
Expand Down Expand Up @@ -1068,9 +1064,7 @@ async def send_cluster_commands(
r = c.result
if not isinstance(c.result, RedisError):
if isinstance(c.callback, AsyncPreProcessingCallback):
await c.callback.pre_process(
self.client, c.result, **c.options
) # pyright: reportGeneralTypeIssues=false
await c.callback.pre_process(self.client, c.result, **c.options)
r = c.callback(c.result, version=protocol_version, **c.options)
response.append(r)

Expand Down
1 change: 0 additions & 1 deletion coredis/response/_callbacks/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
--------------------------
"""

# pyright: reportUnnecessaryIsInstance=false
from __future__ import annotations

import datetime
Expand Down
2 changes: 1 addition & 1 deletion coredis/typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
_beartype_found = False

try:
import beartype # pyright: reportUnusedImport=false
import beartype

if not TYPE_CHECKING:
from beartype.typing import ( # noqa: F811
Expand Down
2 changes: 1 addition & 1 deletion docs/source/handbook/typing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Typing
Type Annotations
^^^^^^^^^^^^^^^^
**coredis** provides type annotations for the public API. These are tested using
both :pypi:`mypy` and :pypi:`pyright`.
:pypi:`mypy`.

The :class:`~coredis.Redis` and :class:`~coredis.RedisCluster` clients are Generic types constrained
by :class:`AnyStr`. The constructors and :meth:`~coredis.Redis.from_url` factory methods infer
Expand Down
5 changes: 0 additions & 5 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,6 @@ Feature Summary
* Miscellaneous

* "Pretty complete" :ref:`handbook/typing:type annotations` for public API

.. command-output:: PYTHONPATH=$(pwd) pyright --verifytypes=coredis 2>&1 | grep completeness
:shell:
:cwd: ../../

* :ref:`handbook/typing:runtime type checking`

Installation
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ ignore_missing_imports = true
[tool.ruff]
line-length=100
exclude = ["doc/**","_version.py","versioneer.py", "coredis/pipeline.pyi", "coredis/speedups.pyi"]
typing-modules = ["coredis.typing"]
lint.typing-modules = ["coredis.typing"]

[tool.versioneer]
VCS = "git"
Expand Down
23 changes: 0 additions & 23 deletions pyrightconfig.json

This file was deleted.

1 change: 0 additions & 1 deletion requirements/dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ ruff
isort==5.13.2;python_version>"3.7"
isort<5.12.0;python_version<="3.7"
mypy==1.8.0; implementation_name!='pypy'
pyright==1.1.304
redis>=4.2.0
twine
types-deprecated
Expand Down

0 comments on commit 6704797

Please sign in to comment.