Skip to content

48855 pylint import error #49012

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

Closed
Closed
Show file tree
Hide file tree
Changes from all 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
9 changes: 5 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,6 @@ 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 Expand Up @@ -281,3 +277,8 @@ repos:
- autotyping==22.9.0
- black==22.6.0
- libcst==0.4.7
- id: pylint
name: Pylint
entry: python -m pylint.__main__
language: system
files: \.py$
1 change: 1 addition & 0 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ dependencies:
- sqlalchemy
- tabulate
- tzdata>=2022a
- vulture
- xarray
- xlrd
- xlsxwriter
Expand Down
2 changes: 2 additions & 0 deletions pandas/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,10 @@
zoneinfo = None
if pd.compat.PY39:
# Import "zoneinfo" could not be resolved (reportMissingImports)
# pylint: disable=import-error
import zoneinfo # type: ignore[no-redef]

# pylint: enable=import-error
# Although zoneinfo can be imported in Py39, it is effectively
# "not available" without tzdata/IANA tz data.
# We will set zoneinfo to not found in this case
Expand Down
7 changes: 3 additions & 4 deletions pandas/tests/indexes/datetimes/test_constructors.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
OutOfBoundsDatetime,
astype_overflowsafe,
)
from pandas.compat import PY39

import pandas as pd
from pandas import (
Expand All @@ -32,8 +31,8 @@
period_array,
)

if PY39:
import zoneinfo
if pd.compat.PY39:
import zoneinfo # pylint: disable=import-error


class TestDatetimeIndex:
Expand Down Expand Up @@ -1151,7 +1150,7 @@ def test_timestamp_constructor_retain_fold(tz, fold):


_tzs = ["dateutil/Europe/London"]
if PY39:
if pd.compat.PY39:
try:
_tzs = ["dateutil/Europe/London", zoneinfo.ZoneInfo("Europe/London")]
except zoneinfo.ZoneInfoNotFoundError:
Expand Down
2 changes: 1 addition & 1 deletion pandas/tests/io/excel/test_readers.py
Original file line number Diff line number Diff line change
Expand Up @@ -841,7 +841,7 @@ def test_read_from_pathlib_path(self, read_ext):
def test_read_from_py_localpath(self, read_ext):

# GH12655
from py.path import local as LocalPath
from py.path import local as LocalPath # pylint: disable=import-error

str_path = os.path.join("test1" + read_ext)
expected = pd.read_excel(str_path, sheet_name="Sheet1", index_col=0)
Expand Down
4 changes: 2 additions & 2 deletions pandas/tests/io/pytables/test_read.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

from pandas._libs.tslibs import Timestamp
from pandas.compat import is_platform_windows
import pandas.util._test_decorators as td

import pandas as pd
from pandas import (
Expand All @@ -21,7 +22,6 @@
ensure_clean_path,
ensure_clean_store,
)
from pandas.util import _test_decorators as td

from pandas.io.pytables import TableIterator

Expand Down Expand Up @@ -293,7 +293,7 @@ def test_read_from_pathlib_path(setup_path):
def test_read_from_py_localpath(setup_path):

# GH11773
from py.path import local as LocalPath
from py.path import local as LocalPath # pylint: disable=import-error

expected = DataFrame(
np.random.rand(4, 5), index=list("abcd"), columns=list("ABCDE")
Expand Down
2 changes: 1 addition & 1 deletion pandas/tests/io/sas/test_sas7bdat.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def test_path_pathlib(self, dirpath, data_test_ix):
@td.skip_if_no("py.path")
@pytest.mark.slow
def test_path_localpath(self, dirpath, data_test_ix):
from py.path import local as LocalPath
from py.path import local as LocalPath # pylint: disable=import-error

df0, test_ix = data_test_ix
for k in test_ix:
Expand Down
10 changes: 9 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@ exclude = '''
)
'''

[tool.pylint.main]
ignore-patterns = ["^\\.#"]
ignore = [
"versioneer.py",
"validate_min_versions_in_sync.py"
]

[tool.pylint.messages_control]
max-line-length = 88
disable = [
Expand All @@ -42,9 +49,10 @@ disable = [
"bad-super-call",
"c-extension-no-member",
"function-redefined",
"import-error",
# "import-error",
"inherit-non-class",
"invalid-repr-returned",
"invalid-sequence-index",
"invalid-unary-operand-type",
"misplaced-bare-raise",
"no-member",
Expand Down
1 change: 1 addition & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ scipy
sqlalchemy
tabulate
tzdata>=2022.1
vulture
xarray
xlrd
xlsxwriter
Expand Down