Skip to content

STYLE fix pylint issues #48855

Closed
Closed
@MarcoGorelli

Description

@MarcoGorelli

In https://github.com/pandas-dev/pandas/pull/48759/files we're introduced pylint, but have turned off its warnings as there's a lot of them:

pandas/pyproject.toml

Lines 36 to 67 in d719840

disable = [
"C",
"R",
"W",
"abstract-class-instantiated",
"access-member-before-definition",
"bad-super-call",
"c-extension-no-member",
"function-redefined",
"import-error",
"inherit-non-class",
"invalid-repr-returned",
"invalid-unary-operand-type",
"misplaced-bare-raise",
"no-member",
"no-method-argument",
"no-name-in-module",
"no-self-argument",
"no-value-for-parameter",
"non-iterator-returned",
"not-an-iterable",
"not-callable",
"redundant-keyword-arg",
"too-many-function-args",
"undefined-variable",
"unexpected-keyword-arg",
"unpacking-non-sequence",
"unsubscriptable-object",
"unsupported-assignment-operation",
"unsupported-membership-test",
"used-before-assignment",
]

Task here is:

  1. pick one of the above warnings / errors, and remove it from pyproject.toml
  2. run pre-commit run pylint --hook-stage manual --all-files. If this already passes, skip to step 4.
  3. fixup any warnings that result
  4. if pre-commit run pylint --hook-stage manual --all-files passes, then stage and commit your changes and open a pull request

If you believe a warning is a false-positive, then it's OK to ignore it in-line, e.g.

df.rename(id, mapper=id)  # pylint: disable=redundant-keyword-arg

Please comment here which pylint warning you'll work on before starting so we don't duplicate work. No need to ask for permission to work on this, and no need to comment "take" as multiple people can work on this concurrently


NOTE: please do not write "closes #48855" in your PR


checks we probably can't turn off:

  • too-many-function-args
  • unsubscriptable-object
  • unsupported-assignment-operation
  • no-name-in-module
  • no-member
  • import-error
  • not-an-iterable
  • invalid-unary-operator-type
  • invalid-name
  • wrong-import-order (and anything else related with imports)
  • unexpected-keyword-argument
  • use-implicit-booleaness-not-len
  • use-implicit-booleaness-not-comparison
  • comparison-with-itself
  • no-else-*
  • line-too-long
  • overridden-final-method
  • singleton-comparison
  • unsupported-membership-test
  • pointless-statement
  • broad-except
  • undefined-variable

If you're not sure whether a check should fit into the above list, please do ask

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions