The following issues were found
pandas/tests/indexes/object/test_astype.py
2 issues
Line: 1
Column: 1
from pandas import Index
import pandas._testing as tm
def test_astype_str_from_bytes():
# https://github.com/pandas-dev/pandas/issues/38607
idx = Index(["あ", b"a"], dtype="object")
result = idx.astype(str)
expected = Index(["あ", "a"], dtype="object")
Reported by Pylint.
Line: 5
Column: 1
import pandas._testing as tm
def test_astype_str_from_bytes():
# https://github.com/pandas-dev/pandas/issues/38607
idx = Index(["あ", b"a"], dtype="object")
result = idx.astype(str)
expected = Index(["あ", "a"], dtype="object")
tm.assert_index_equal(result, expected)
Reported by Pylint.
pandas/tests/io/pytables/__init__.py
2 issues
Line: 1
Column: 1
import pytest
pytestmark = [
# pytables https://github.com/PyTables/PyTables/issues/822
pytest.mark.filterwarnings(
"ignore:a closed node found in the registry:UserWarning"
),
pytest.mark.filterwarnings(r"ignore:tostring\(\) is deprecated:DeprecationWarning"),
pytest.mark.filterwarnings(
Reported by Pylint.
Line: 1
Column: 1
import pytest
pytestmark = [
# pytables https://github.com/PyTables/PyTables/issues/822
pytest.mark.filterwarnings(
"ignore:a closed node found in the registry:UserWarning"
),
pytest.mark.filterwarnings(r"ignore:tostring\(\) is deprecated:DeprecationWarning"),
pytest.mark.filterwarnings(
Reported by Pylint.
scripts/validate_rst_title_capitalization.py
2 issues
Line: 157
Column: 1
CAP_EXCEPTIONS_DICT = {word.lower(): word for word in CAPITALIZATION_EXCEPTIONS}
err_msg = "Heading capitalization formatted incorrectly. Please correctly capitalize"
symbols = ("*", "=", "-", "^", "~", "#", '"')
def correct_title_capitalization(title: str) -> str:
Reported by Pylint.
Line: 224
Column: 28
The corresponding line number of the heading.
"""
with open(rst_file) as fd:
previous_line = ""
for i, line in enumerate(fd):
line = line[:-1]
line_chars = set(line)
if (
Reported by Pylint.
pandas/tests/io/json/conftest.py
2 issues
Line: 1
Column: 1
import pytest
@pytest.fixture(params=["split", "records", "index", "columns", "values"])
def orient(request):
"""
Fixture for orients excluding the table format.
"""
return request.param
Reported by Pylint.
Line: 1
Column: 1
import pytest
@pytest.fixture(params=["split", "records", "index", "columns", "values"])
def orient(request):
"""
Fixture for orients excluding the table format.
"""
return request.param
Reported by Pylint.
pandas/tests/series/methods/test_head_tail.py
2 issues
Line: 1
Column: 1
import pandas._testing as tm
def test_head_tail(string_series):
tm.assert_series_equal(string_series.head(), string_series[:5])
tm.assert_series_equal(string_series.head(0), string_series[0:0])
tm.assert_series_equal(string_series.tail(), string_series[-5:])
tm.assert_series_equal(string_series.tail(0), string_series[0:0])
Reported by Pylint.
Line: 4
Column: 1
import pandas._testing as tm
def test_head_tail(string_series):
tm.assert_series_equal(string_series.head(), string_series[:5])
tm.assert_series_equal(string_series.head(0), string_series[0:0])
tm.assert_series_equal(string_series.tail(), string_series[-5:])
tm.assert_series_equal(string_series.tail(0), string_series[0:0])
Reported by Pylint.
pandas/tests/tslibs/test_api.py
2 issues
Line: 6
Column: 1
from pandas._libs import tslibs
def test_namespace():
submodules = [
"base",
"ccalendar",
"conversion",
Reported by Pylint.
Line: 57
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html
expected = set(submodules + api)
names = [x for x in dir(tslibs) if not x.startswith("__")]
assert set(names) == expected
Reported by Bandit.
scripts/tests/conftest.py
2 issues
Line: 1
Column: 1
def pytest_addoption(parser):
parser.addoption(
"--strict-data-files",
action="store_true",
help="Unused. For compat with setup.cfg.",
)
Reported by Pylint.
Line: 1
Column: 1
def pytest_addoption(parser):
parser.addoption(
"--strict-data-files",
action="store_true",
help="Unused. For compat with setup.cfg.",
)
Reported by Pylint.
pandas/tests/base/common.py
2 issues
Line: 9
Column: 34
def allow_na_ops(obj: Any) -> bool:
"""Whether to skip test cases including NaN"""
is_bool_index = isinstance(obj, Index) and obj.is_boolean()
return not is_bool_index and obj._can_hold_na
Reported by Pylint.
Line: 1
Column: 1
from typing import Any
from pandas import Index
def allow_na_ops(obj: Any) -> bool:
"""Whether to skip test cases including NaN"""
is_bool_index = isinstance(obj, Index) and obj.is_boolean()
return not is_bool_index and obj._can_hold_na
Reported by Pylint.
pandas/_libs/src/ujson/python/date_conversions.c
2 issues
Line: 67
Column: 12
CWE codes:
126
// Note that get_datetime_iso_8601_strlen just gives a generic size
// for ISO string conversion, not the actual size used
*len = strlen(result);
return result;
}
npy_datetime NpyDateTimeToEpoch(npy_datetime dt, NPY_DATETIMEUNIT base) {
scaleNanosecToUnit(&dt, base);
Reported by FlawFinder.
Line: 104
Column: 12
CWE codes:
126
// Note that get_datetime_iso_8601_strlen just gives a generic size
// for ISO string conversion, not the actual size used
*len = strlen(result);
return result;
}
npy_datetime PyDateTimeToEpoch(PyObject *dt, NPY_DATETIMEUNIT base) {
npy_datetimestruct dts;
Reported by FlawFinder.
pandas/tests/arrays/categorical/conftest.py
2 issues
Line: 1
Column: 1
import pytest
@pytest.fixture(params=[True, False])
def allow_fill(request):
"""Boolean 'allow_fill' parameter for Categorical.take"""
return request.param
Reported by Pylint.
Line: 1
Column: 1
import pytest
@pytest.fixture(params=[True, False])
def allow_fill(request):
"""Boolean 'allow_fill' parameter for Categorical.take"""
return request.param
Reported by Pylint.