Skip to content

pylint pre-commit #48759

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Sep 29, 2022
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ repos:
- flake8==5.0.4
- flake8-bugbear==22.7.1
- pandas-dev-flaker==0.5.0
- repo: https://github.com/pycqa/pylint
rev: v2.15.3
hooks:
- id: pylint
- repo: https://github.com/PyCQA/isort
rev: 5.10.1
hooks:
Expand Down
4 changes: 3 additions & 1 deletion pandas/core/arrays/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,9 @@

if TYPE_CHECKING:

class ExtensionArraySupportsAnyAll("ExtensionArray"):
class ExtensionArraySupportsAnyAll(
"ExtensionArray"
): # pylint: disable=inherit-non-class
def any(self, *, skipna: bool = True) -> bool:
pass

Expand Down
2 changes: 1 addition & 1 deletion pandas/core/internals/blocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -1981,7 +1981,7 @@ def _catch_deprecated_value_error(err: Exception) -> None:
# IntervalDtype mismatched 'closed'
pass
elif "Timezones don't match" not in str(err):
raise
raise # pylint: disable=misplaced-bare-raise


class DatetimeLikeBlock(NDArrayBackedExtensionBlock):
Expand Down
4 changes: 3 additions & 1 deletion pandas/tests/extension/decimal/test_decimal.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,9 @@ def test_compare_array(self, data, comparison_op):
class DecimalArrayWithoutFromSequence(DecimalArray):
"""Helper class for testing error handling in _from_sequence."""

def _from_sequence(cls, scalars, dtype=None, copy=False):
def _from_sequence(
cls, scalars, dtype=None, copy=False
): # pylint: disable=no-self-argument
raise KeyError("For the test")


Expand Down
2 changes: 1 addition & 1 deletion pandas/tests/frame/methods/test_rename.py
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ def test_rename_axis_style_raises(self):

# Duplicates
with pytest.raises(TypeError, match="multiple values"):
df.rename(id, mapper=id)
df.rename(id, mapper=id) # pylint: disable=redundant-keyword-arg

def test_rename_positional_raises(self):
# GH 29136
Expand Down
2 changes: 1 addition & 1 deletion pandas/tests/io/test_gcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def gcs_buffer(monkeypatch):
gcs_buffer.close = lambda: True

class MockGCSFileSystem(AbstractFileSystem):
def open(*args, **kwargs):
def open(*args, **kwargs): # pylint: disable=no-method-argument
gcs_buffer.seek(0)
return gcs_buffer

Expand Down
6 changes: 4 additions & 2 deletions pandas/tests/io/test_html.py
Original file line number Diff line number Diff line change
Expand Up @@ -1140,7 +1140,9 @@ def test_works_on_valid_markup(self, datapath):
@pytest.mark.slow
def test_fallback_success(self, datapath):
banklist_data = datapath("io", "data", "html", "banklist.html")
self.read_html(banklist_data, match=".*Water.*", flavor=["lxml", "html5lib"])
self.read_html(
banklist_data, match=".*Water.*", flavor=["lxml", "html5lib"]
) # pylint: disable=redundant-keyword-arg

def test_to_html_timestamp(self):
rng = date_range("2000-01-01", periods=10)
Expand Down Expand Up @@ -1278,7 +1280,7 @@ def seek(self, offset):
def seekable(self):
return True

def __iter__(self) -> Iterator:
def __iter__(self) -> Iterator: # pylint: disable=non-iterator-returned
# to fool `is_file_like`, should never end up here
assert False

Expand Down
2 changes: 1 addition & 1 deletion pandas/tests/io/test_sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -1606,7 +1606,7 @@ class _TestSQLAlchemy(SQLAlchemyMixIn, PandasSQLTest):
flavor: str

@pytest.fixture(autouse=True, scope="class")
def setup_class(cls):
def setup_class(cls): # pylint: disable=no-self-argument
cls.setup_import()
cls.setup_driver()
conn = cls.conn = cls.connect()
Expand Down
2 changes: 1 addition & 1 deletion pandas/tests/scalar/period/test_period.py
Original file line number Diff line number Diff line change
Expand Up @@ -840,7 +840,7 @@ def test_period_deprecated_freq(self):
assert isinstance(p1, Period)
assert isinstance(p2, Period)

def _period_constructor(bound, offset):
def _period_constructor(bound, offset): # pylint: disable=no-self-argument
return Period(
year=bound.year,
month=bound.month,
Expand Down
31 changes: 31 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,37 @@ exclude = '''
)
'''

[tool.pylint.messages_control]
max-line-length = 88
disable = [
"C",
"R",
"W",
"import-error",
"no-member",
"no-name-in-module",
"unsubscriptable-object",
"invalid-unary-operand-type",
"unexpected-keyword-arg",
"not-an-iterable",
"unsupported-assignment-operation",
"unsupported-membership-test",
"no-value-for-parameter",
"unpacking-non-sequence",
"bad-super-call",
"access-member-before-definition",
"used-before-assignment",
"too-many-fucntion-args",
"abstract-class-instantiated",
"not-callable",
"too-many-function-args",
"invalid-repr-returned",
"undefined-variable",
"function-redefined",
"c-extension-no-member",
"redundant-keyword-arg",
]

[tool.pytest.ini_options]
# sync minversion with pyproject.toml & install.rst
minversion = "6.0"
Expand Down