Skip to content

Commit

Permalink
ignore noqa if unused
Browse files Browse the repository at this point in the history
  • Loading branch information
samster25 committed Apr 15, 2024
1 parent 13f532d commit 04915bb
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 12 deletions.
3 changes: 2 additions & 1 deletion .ruff.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion daft/expressions/expressions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):

Check warning on line 49 in daft/expressions/expressions.py

View check run for this annotation

Codecov / codecov/patch

daft/expressions/expressions.py#L49

Added line #L49 was not covered by tests
def __get__( # type: ignore[override]
self,
instance: Any,
Expand Down
2 changes: 1 addition & 1 deletion daft/pickle/cloudpickle.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
8 changes: 4 additions & 4 deletions daft/pickle/cloudpickle_fast.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,)
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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)
Expand All @@ -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
Expand Down
8 changes: 4 additions & 4 deletions daft/pickle/compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit 04915bb

Please sign in to comment.