diff --git a/.ruff.toml b/.ruff.toml index 4b445b8ed4..1ffb22cece 100644 --- a/.ruff.toml +++ b/.ruff.toml @@ -18,7 +18,8 @@ extend-select = [ "UP", # pyupgrade "LOG", # flake8-logging "G", # flake8-logging-format - "I" # isort + "I", # isort + "RUF100" # unused-noqa ] ignore = [ "E402" # Module level import not at top of file [TODO(sammy): We want to fix this] diff --git a/daft/expressions/expressions.py b/daft/expressions/expressions.py index f01efc86a4..27fe91e23b 100644 --- a/daft/expressions/expressions.py +++ b/daft/expressions/expressions.py @@ -46,7 +46,7 @@ # an instance; @sphinx_accessor is a @property that allows this. NS = TypeVar("NS") - class sphinx_accessor(property): # noqa: D101 + class sphinx_accessor(property): def __get__( # type: ignore[override] self, instance: Any, diff --git a/daft/pickle/cloudpickle.py b/daft/pickle/cloudpickle.py index 768c897e0e..0c68c7f894 100644 --- a/daft/pickle/cloudpickle.py +++ b/daft/pickle/cloudpickle.py @@ -200,7 +200,7 @@ def _whichmodule(obj, name): - Errors arising during module introspection are ignored, as those errors are considered unwanted side effects. """ - if sys.version_info[:2] < (3, 7) and isinstance(obj, typing.TypeVar): # pragma: no branch # noqa + if sys.version_info[:2] < (3, 7) and isinstance(obj, typing.TypeVar): # pragma: no branch # Workaround bug in old Python versions: prior to Python 3.7, # T.__module__ would always be set to "typing" even when the TypeVar T # would be defined in a different module. diff --git a/daft/pickle/cloudpickle_fast.py b/daft/pickle/cloudpickle_fast.py index 00c66f3f97..fa5937b69f 100644 --- a/daft/pickle/cloudpickle_fast.py +++ b/daft/pickle/cloudpickle_fast.py @@ -494,7 +494,7 @@ def _dynamic_class_reduce(obj): def _class_reduce(obj): """Select the reducer depending on the dynamic nature of the class obj""" - if obj is type(None): # noqa + if obj is type(None): return type, (None,) elif obj is type(Ellipsis): return type, (Ellipsis,) @@ -777,7 +777,7 @@ def reducer_override(self, obj): reducers, such as Exceptions. See https://github.com/cloudpipe/cloudpickle/issues/248 """ - if sys.version_info[:2] < (3, 7) and _is_parametrized_type_hint(obj): # noqa # pragma: no branch + if sys.version_info[:2] < (3, 7) and _is_parametrized_type_hint(obj): # pragma: no branch return (_create_parametrized_type_hint, parametrized_type_hint_getinitargs(obj)) t = type(obj) try: @@ -827,7 +827,7 @@ def save_global(self, obj, name=None, pack=struct.pack): The name of this method is somewhat misleading: all types get dispatched here. """ - if obj is type(None): # noqa + if obj is type(None): return self.save_reduce(type, (None,), obj=obj) elif obj is type(Ellipsis): return self.save_reduce(type, (Ellipsis,), obj=obj) @@ -836,7 +836,7 @@ def save_global(self, obj, name=None, pack=struct.pack): elif obj in _BUILTIN_TYPE_NAMES: return self.save_reduce(_builtin_type, (_BUILTIN_TYPE_NAMES[obj],), obj=obj) - if sys.version_info[:2] < (3, 7) and _is_parametrized_type_hint(obj): # noqa # pragma: no branch + if sys.version_info[:2] < (3, 7) and _is_parametrized_type_hint(obj): # pragma: no branch # Parametrized typing constructs in Python < 3.7 are not # compatible with type checks and ``isinstance`` semantics. For # this reason, it is easier to detect them using a diff --git a/daft/pickle/compat.py b/daft/pickle/compat.py index a2a3c947d2..7f51f653b0 100644 --- a/daft/pickle/compat.py +++ b/daft/pickle/compat.py @@ -8,13 +8,13 @@ if sys.version_info < (3, 8): try: - import pickle5 as pickle # noqa: F401 - from pickle5 import Pickler # noqa: F401 + import pickle5 as pickle + from pickle5 import Pickler except ImportError: - import pickle # noqa: F401 + import pickle # Use the Python pickler for old CPython versions - from pickle import _Pickler as Pickler # noqa: F401 + from pickle import _Pickler as Pickler else: import pickle # noqa: F401 diff --git a/tests/conftest.py b/tests/conftest.py index 4b217007df..1efafe82cb 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -10,7 +10,7 @@ from daft.table import MicroPartition # import all conftest -from tests.integration.io.conftest import * # noqa: F403 +from tests.integration.io.conftest import * def pytest_addoption(parser):