The following issues were found
pandas/tests/arrays/integer/conftest.py
11 issues
Line: 2
Column: 1
import numpy as np
import pytest
import pandas as pd
from pandas.core.arrays.integer import (
Int8Dtype,
Int16Dtype,
Int32Dtype,
Int64Dtype,
Reported by Pylint.
Line: 34
Column: 10
@pytest.fixture
def data(dtype):
return pd.array(
list(range(8)) + [np.nan] + list(range(10, 98)) + [np.nan] + [99, 100],
dtype=dtype,
)
Reported by Pylint.
Line: 42
Column: 18
@pytest.fixture
def data_missing(dtype):
return pd.array([np.nan, 1], dtype=dtype)
@pytest.fixture(params=["data", "data_missing"])
def all_data(request, data, data_missing):
Reported by Pylint.
Line: 47
Column: 23
@pytest.fixture(params=["data", "data_missing"])
def all_data(request, data, data_missing):
"""Parametrized fixture giving 'data' and 'data_missing'"""
if request.param == "data":
return data
elif request.param == "data_missing":
return data_missing
Reported by Pylint.
Line: 47
Column: 29
@pytest.fixture(params=["data", "data_missing"])
def all_data(request, data, data_missing):
"""Parametrized fixture giving 'data' and 'data_missing'"""
if request.param == "data":
return data
elif request.param == "data_missing":
return data_missing
Reported by Pylint.
Line: 1
Column: 1
import numpy as np
import pytest
import pandas as pd
from pandas.core.arrays.integer import (
Int8Dtype,
Int16Dtype,
Int32Dtype,
Int64Dtype,
Reported by Pylint.
Line: 27
Column: 1
UInt16Dtype,
UInt32Dtype,
UInt64Dtype,
]
)
def dtype(request):
return request.param()
Reported by Pylint.
Line: 34
Column: 1
@pytest.fixture
def data(dtype):
return pd.array(
list(range(8)) + [np.nan] + list(range(10, 98)) + [np.nan] + [99, 100],
dtype=dtype,
)
Reported by Pylint.
Line: 42
Column: 1
@pytest.fixture
def data_missing(dtype):
return pd.array([np.nan, 1], dtype=dtype)
@pytest.fixture(params=["data", "data_missing"])
def all_data(request, data, data_missing):
Reported by Pylint.
Line: 47
Column: 1
@pytest.fixture(params=["data", "data_missing"])
def all_data(request, data, data_missing):
"""Parametrized fixture giving 'data' and 'data_missing'"""
if request.param == "data":
return data
elif request.param == "data_missing":
return data_missing
Reported by Pylint.
pandas/tests/arithmetic/conftest.py
11 issues
Line: 2
Column: 1
import numpy as np
import pytest
import pandas as pd
from pandas import (
Float64Index,
Int64Index,
RangeIndex,
UInt64Index,
Reported by Pylint.
Line: 19
Column: 21
autouse=True, scope="module", params=[0, 1000000], ids=["numexpr", "python"]
)
def switch_numexpr_min_elements(request):
_MIN_ELEMENTS = expr._MIN_ELEMENTS
expr._MIN_ELEMENTS = request.param
yield request.param
expr._MIN_ELEMENTS = _MIN_ELEMENTS
Reported by Pylint.
Line: 20
Column: 5
)
def switch_numexpr_min_elements(request):
_MIN_ELEMENTS = expr._MIN_ELEMENTS
expr._MIN_ELEMENTS = request.param
yield request.param
expr._MIN_ELEMENTS = _MIN_ELEMENTS
# ------------------------------------------------------------------
Reported by Pylint.
Line: 22
Column: 5
_MIN_ELEMENTS = expr._MIN_ELEMENTS
expr._MIN_ELEMENTS = request.param
yield request.param
expr._MIN_ELEMENTS = _MIN_ELEMENTS
# ------------------------------------------------------------------
# Helper Functions
Reported by Pylint.
Line: 1
Column: 1
import numpy as np
import pytest
import pandas as pd
from pandas import (
Float64Index,
Int64Index,
RangeIndex,
UInt64Index,
Reported by Pylint.
Line: 17
Column: 1
@pytest.fixture(
autouse=True, scope="module", params=[0, 1000000], ids=["numexpr", "python"]
)
def switch_numexpr_min_elements(request):
_MIN_ELEMENTS = expr._MIN_ELEMENTS
expr._MIN_ELEMENTS = request.param
yield request.param
expr._MIN_ELEMENTS = _MIN_ELEMENTS
Reported by Pylint.
Line: 19
Column: 5
autouse=True, scope="module", params=[0, 1000000], ids=["numexpr", "python"]
)
def switch_numexpr_min_elements(request):
_MIN_ELEMENTS = expr._MIN_ELEMENTS
expr._MIN_ELEMENTS = request.param
yield request.param
expr._MIN_ELEMENTS = _MIN_ELEMENTS
Reported by Pylint.
Line: 29
Column: 1
# Helper Functions
def id_func(x):
if isinstance(x, tuple):
assert len(x) == 2
return x[0].__name__ + "-" + str(x[1])
else:
return x.__name__
Reported by Pylint.
Line: 29
Column: 1
# Helper Functions
def id_func(x):
if isinstance(x, tuple):
assert len(x) == 2
return x[0].__name__ + "-" + str(x[1])
else:
return x.__name__
Reported by Pylint.
Line: 30
Column: 5
def id_func(x):
if isinstance(x, tuple):
assert len(x) == 2
return x[0].__name__ + "-" + str(x[1])
else:
return x.__name__
Reported by Pylint.
pandas/tests/extension/arrow/test_timestamp.py
11 issues
Line: 5
Column: 1
import datetime
import pytest
from pandas._typing import type_t
import pandas as pd
from pandas.api.extensions import (
Reported by Pylint.
Line: 17
Column: 1
pytest.importorskip("pyarrow", minversion="0.13.0")
import pyarrow as pa # isort:skip
from pandas.tests.extension.arrow.arrays import ArrowExtensionArray # isort:skip
@register_extension_dtype
Reported by Pylint.
Line: 42
Column: 1
return ArrowTimestampUSArray
class ArrowTimestampUSArray(ArrowExtensionArray):
def __init__(self, values):
if not isinstance(values, pa.ChunkedArray):
raise ValueError
assert values.type == pa.timestamp("us")
Reported by Pylint.
Line: 1
Column: 1
from __future__ import annotations
import datetime
import pytest
from pandas._typing import type_t
import pandas as pd
Reported by Pylint.
Line: 17
Column: 1
pytest.importorskip("pyarrow", minversion="0.13.0")
import pyarrow as pa # isort:skip
from pandas.tests.extension.arrow.arrays import ArrowExtensionArray # isort:skip
@register_extension_dtype
Reported by Pylint.
Line: 19
Column: 1
import pyarrow as pa # isort:skip
from pandas.tests.extension.arrow.arrays import ArrowExtensionArray # isort:skip
@register_extension_dtype
class ArrowTimestampUSDtype(ExtensionDtype):
Reported by Pylint.
Line: 19
Column: 1
import pyarrow as pa # isort:skip
from pandas.tests.extension.arrow.arrays import ArrowExtensionArray # isort:skip
@register_extension_dtype
class ArrowTimestampUSDtype(ExtensionDtype):
Reported by Pylint.
Line: 23
Column: 1
@register_extension_dtype
class ArrowTimestampUSDtype(ExtensionDtype):
type = datetime.datetime
kind = "M"
name = "arrow_timestamp_us"
na_value = pa.NULL
Reported by Pylint.
Line: 42
Column: 1
return ArrowTimestampUSArray
class ArrowTimestampUSArray(ArrowExtensionArray):
def __init__(self, values):
if not isinstance(values, pa.ChunkedArray):
raise ValueError
assert values.type == pa.timestamp("us")
Reported by Pylint.
Line: 47
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html
if not isinstance(values, pa.ChunkedArray):
raise ValueError
assert values.type == pa.timestamp("us")
self._data = values
self._dtype = ArrowTimestampUSDtype()
def test_constructor_extensionblock():
Reported by Bandit.
pandas/tests/frame/indexing/test_get_value.py
11 issues
Line: 1
Column: 1
import pytest
from pandas import (
DataFrame,
MultiIndex,
)
class TestGetValue:
Reported by Pylint.
Line: 15
Column: 13
index = MultiIndex.from_tuples([(0, 1), (0, 2), (1, 1), (1, 2)])
df = DataFrame(index=index, columns=range(4))
with pytest.raises(KeyError, match=r"^0$"):
df._get_value(0, 1)
def test_get_value(self, float_frame):
for idx in float_frame.index:
for col in float_frame.columns:
result = float_frame._get_value(idx, col)
Reported by Pylint.
Line: 20
Column: 26
def test_get_value(self, float_frame):
for idx in float_frame.index:
for col in float_frame.columns:
result = float_frame._get_value(idx, col)
expected = float_frame[col][idx]
assert result == expected
Reported by Pylint.
Line: 1
Column: 1
import pytest
from pandas import (
DataFrame,
MultiIndex,
)
class TestGetValue:
Reported by Pylint.
Line: 9
Column: 1
)
class TestGetValue:
def test_get_set_value_no_partial_indexing(self):
# partial w/ MultiIndex raise exception
index = MultiIndex.from_tuples([(0, 1), (0, 2), (1, 1), (1, 2)])
df = DataFrame(index=index, columns=range(4))
with pytest.raises(KeyError, match=r"^0$"):
Reported by Pylint.
Line: 10
Column: 5
class TestGetValue:
def test_get_set_value_no_partial_indexing(self):
# partial w/ MultiIndex raise exception
index = MultiIndex.from_tuples([(0, 1), (0, 2), (1, 1), (1, 2)])
df = DataFrame(index=index, columns=range(4))
with pytest.raises(KeyError, match=r"^0$"):
df._get_value(0, 1)
Reported by Pylint.
Line: 10
Column: 5
class TestGetValue:
def test_get_set_value_no_partial_indexing(self):
# partial w/ MultiIndex raise exception
index = MultiIndex.from_tuples([(0, 1), (0, 2), (1, 1), (1, 2)])
df = DataFrame(index=index, columns=range(4))
with pytest.raises(KeyError, match=r"^0$"):
df._get_value(0, 1)
Reported by Pylint.
Line: 13
Column: 9
def test_get_set_value_no_partial_indexing(self):
# partial w/ MultiIndex raise exception
index = MultiIndex.from_tuples([(0, 1), (0, 2), (1, 1), (1, 2)])
df = DataFrame(index=index, columns=range(4))
with pytest.raises(KeyError, match=r"^0$"):
df._get_value(0, 1)
def test_get_value(self, float_frame):
for idx in float_frame.index:
Reported by Pylint.
Line: 17
Column: 5
with pytest.raises(KeyError, match=r"^0$"):
df._get_value(0, 1)
def test_get_value(self, float_frame):
for idx in float_frame.index:
for col in float_frame.columns:
result = float_frame._get_value(idx, col)
expected = float_frame[col][idx]
assert result == expected
Reported by Pylint.
Line: 17
Column: 5
with pytest.raises(KeyError, match=r"^0$"):
df._get_value(0, 1)
def test_get_value(self, float_frame):
for idx in float_frame.index:
for col in float_frame.columns:
result = float_frame._get_value(idx, col)
expected = float_frame[col][idx]
assert result == expected
Reported by Pylint.
doc/sphinxext/announce.py
11 issues
Line: 122
Column: 18
def build_components(revision_range, heading="Contributors"):
lst_release, cur_release = (r.strip() for r in revision_range.split(".."))
authors = get_authors(revision_range)
return {
"heading": heading,
"author_message": author_msg % len(authors),
Reported by Pylint.
Line: 122
Column: 5
def build_components(revision_range, heading="Contributors"):
lst_release, cur_release = (r.strip() for r in revision_range.split(".."))
authors = get_authors(revision_range)
return {
"heading": heading,
"author_message": author_msg % len(authors),
Reported by Pylint.
Line: 45
Column: 1
UTF8Writer = codecs.getwriter("utf8")
this_repo = Repo(os.path.join(os.path.dirname(__file__), "..", ".."))
author_msg = """\
A total of %d people contributed patches to this release. People with a
"+" by their names contributed a patch for the first time.
"""
pull_request_msg = """\
Reported by Pylint.
Line: 50
Column: 1
"+" by their names contributed a patch for the first time.
"""
pull_request_msg = """\
A total of %d pull requests were merged for this release.
"""
def get_authors(revision_range):
Reported by Pylint.
Line: 55
Column: 1
"""
def get_authors(revision_range):
pat = "^.*\\t(.*)$"
lst_release, cur_release = (r.strip() for r in revision_range.split(".."))
if "|" in cur_release:
# e.g. v1.0.1|HEAD
Reported by Pylint.
Line: 62
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html
if "|" in cur_release:
# e.g. v1.0.1|HEAD
maybe_tag, head = cur_release.split("|")
assert head == "HEAD"
if maybe_tag in this_repo.tags:
cur_release = maybe_tag
else:
cur_release = head
revision_range = f"{lst_release}..{cur_release}"
Reported by Bandit.
Line: 91
Column: 1
pre.discard("Homu")
# Append '+' to new authors.
authors = [s + " +" for s in cur - pre] + [s for s in cur & pre]
authors.sort()
return authors
def get_pull_requests(repo, revision_range):
Reported by Pylint.
Line: 96
Column: 1
return authors
def get_pull_requests(repo, revision_range):
prnums = []
# From regular merges
merges = this_repo.git.log("--oneline", "--merges", revision_range)
issues = re.findall("Merge pull request \\#(\\d*)", merges)
Reported by Pylint.
Line: 121
Column: 1
return prs
def build_components(revision_range, heading="Contributors"):
lst_release, cur_release = (r.strip() for r in revision_range.split(".."))
authors = get_authors(revision_range)
return {
"heading": heading,
Reported by Pylint.
Line: 132
Column: 1
}
def build_string(revision_range, heading="Contributors"):
components = build_components(revision_range, heading=heading)
components["uline"] = "=" * len(components["heading"])
components["authors"] = "* " + "\n* ".join(components["authors"])
# Don't change this to an fstring. It breaks the formatting.
Reported by Pylint.
pandas/tests/frame/indexing/test_get.py
11 issues
Line: 1
Column: 1
import pytest
from pandas import DataFrame
import pandas._testing as tm
class TestGet:
def test_get(self, float_frame):
b = float_frame.get("B")
Reported by Pylint.
Line: 1
Column: 1
import pytest
from pandas import DataFrame
import pandas._testing as tm
class TestGet:
def test_get(self, float_frame):
b = float_frame.get("B")
Reported by Pylint.
Line: 7
Column: 1
import pandas._testing as tm
class TestGet:
def test_get(self, float_frame):
b = float_frame.get("B")
tm.assert_series_equal(b, float_frame["B"])
assert float_frame.get("foo") is None
Reported by Pylint.
Line: 8
Column: 5
class TestGet:
def test_get(self, float_frame):
b = float_frame.get("B")
tm.assert_series_equal(b, float_frame["B"])
assert float_frame.get("foo") is None
tm.assert_series_equal(
Reported by Pylint.
Line: 8
Column: 5
class TestGet:
def test_get(self, float_frame):
b = float_frame.get("B")
tm.assert_series_equal(b, float_frame["B"])
assert float_frame.get("foo") is None
tm.assert_series_equal(
Reported by Pylint.
Line: 9
Column: 9
class TestGet:
def test_get(self, float_frame):
b = float_frame.get("B")
tm.assert_series_equal(b, float_frame["B"])
assert float_frame.get("foo") is None
tm.assert_series_equal(
float_frame.get("foo", float_frame["B"]), float_frame["B"]
Reported by Pylint.
Line: 12
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html
b = float_frame.get("B")
tm.assert_series_equal(b, float_frame["B"])
assert float_frame.get("foo") is None
tm.assert_series_equal(
float_frame.get("foo", float_frame["B"]), float_frame["B"]
)
@pytest.mark.parametrize(
Reported by Bandit.
Line: 23
Column: 5
DataFrame(),
DataFrame(columns=list("AB")),
DataFrame(columns=list("AB"), index=range(3)),
],
)
def test_get_none(self, df):
# see gh-5652
assert df.get(None) is None
Reported by Pylint.
Line: 23
Column: 5
DataFrame(),
DataFrame(columns=list("AB")),
DataFrame(columns=list("AB"), index=range(3)),
],
)
def test_get_none(self, df):
# see gh-5652
assert df.get(None) is None
Reported by Pylint.
Line: 23
Column: 5
DataFrame(),
DataFrame(columns=list("AB")),
DataFrame(columns=list("AB"), index=range(3)),
],
)
def test_get_none(self, df):
# see gh-5652
assert df.get(None) is None
Reported by Pylint.
pandas/io/sas/sasreader.py
11 issues
Line: 24
Column: 3
from pandas import DataFrame
# TODO(PY38): replace with Protocol in Python 3.8
class ReaderBase(metaclass=ABCMeta):
"""
Protocol for XportReader and SAS7BDATReader classes.
"""
Reported by Pylint.
Line: 48
Column: 5
@overload
def read_sas(
filepath_or_buffer: FilePathOrBuffer,
format: str | None = ...,
index: Hashable | None = ...,
encoding: str | None = ...,
chunksize: int = ...,
iterator: bool = ...,
) -> ReaderBase:
Reported by Pylint.
Line: 60
Column: 5
@overload
def read_sas(
filepath_or_buffer: FilePathOrBuffer,
format: str | None = ...,
index: Hashable | None = ...,
encoding: str | None = ...,
chunksize: None = ...,
iterator: bool = ...,
) -> DataFrame | ReaderBase:
Reported by Pylint.
Line: 71
Column: 5
def read_sas(
filepath_or_buffer: FilePathOrBuffer,
format: str | None = None,
index: Hashable | None = None,
encoding: str | None = None,
chunksize: int | None = None,
iterator: bool = False,
) -> DataFrame | ReaderBase:
Reported by Pylint.
Line: 31
Column: 5
"""
@abstractmethod
def read(self, nrows=None):
pass
@abstractmethod
def close(self):
pass
Reported by Pylint.
Line: 35
Column: 5
pass
@abstractmethod
def close(self):
pass
def __enter__(self):
return self
Reported by Pylint.
Line: 46
Column: 1
@overload
def read_sas(
filepath_or_buffer: FilePathOrBuffer,
format: str | None = ...,
index: Hashable | None = ...,
encoding: str | None = ...,
chunksize: int = ...,
Reported by Pylint.
Line: 58
Column: 1
@overload
def read_sas(
filepath_or_buffer: FilePathOrBuffer,
format: str | None = ...,
index: Hashable | None = ...,
encoding: str | None = ...,
chunksize: None = ...,
Reported by Pylint.
Line: 69
Column: 1
...
def read_sas(
filepath_or_buffer: FilePathOrBuffer,
format: str | None = None,
index: Hashable | None = None,
encoding: str | None = None,
chunksize: int | None = None,
Reported by Pylint.
Line: 137
Column: 9
reader: ReaderBase
if format.lower() == "xport":
from pandas.io.sas.sas_xport import XportReader
reader = XportReader(
filepath_or_buffer,
index=index,
encoding=encoding,
Reported by Pylint.
pandas/core/tools/timedeltas.py
11 issues
Line: 7
Column: 1
import numpy as np
from pandas._libs import lib
from pandas._libs.tslibs import (
NaT,
NaTType,
)
from pandas._libs.tslibs.timedeltas import (
Reported by Pylint.
Line: 12
Column: 1
NaT,
NaTType,
)
from pandas._libs.tslibs.timedeltas import (
Timedelta,
parse_timedelta_unit,
)
from pandas.core.dtypes.common import is_list_like
Reported by Pylint.
Line: 12
Column: 1
NaT,
NaTType,
)
from pandas._libs.tslibs.timedeltas import (
Timedelta,
parse_timedelta_unit,
)
from pandas.core.dtypes.common import is_list_like
Reported by Pylint.
Line: 124
Column: 36
if arg is None:
return arg
elif isinstance(arg, ABCSeries):
values = _convert_listlike(arg._values, unit=unit, errors=errors)
return arg._constructor(values, index=arg.index, name=arg.name)
elif isinstance(arg, ABCIndex):
return _convert_listlike(arg, unit=unit, errors=errors, name=arg.name)
elif isinstance(arg, np.ndarray) and arg.ndim == 0:
# extract array scalar and process below
Reported by Pylint.
Line: 125
Column: 16
return arg
elif isinstance(arg, ABCSeries):
values = _convert_listlike(arg._values, unit=unit, errors=errors)
return arg._constructor(values, index=arg.index, name=arg.name)
elif isinstance(arg, ABCIndex):
return _convert_listlike(arg, unit=unit, errors=errors, name=arg.name)
elif isinstance(arg, np.ndarray) and arg.ndim == 0:
# extract array scalar and process below
arg = lib.item_from_zerodim(arg)
Reported by Pylint.
Line: 147
Column: 3
def _coerce_scalar_to_timedelta_type(r, unit="ns", errors="raise"):
"""Convert string 'r' to a timedelta object."""
result: Timedelta | NaTType # TODO: alias?
try:
result = Timedelta(r, unit)
except ValueError:
if errors == "raise":
Reported by Pylint.
Line: 121
Column: 5
"represent unambiguous timedelta values durations."
)
if arg is None:
return arg
elif isinstance(arg, ABCSeries):
values = _convert_listlike(arg._values, unit=unit, errors=errors)
return arg._constructor(values, index=arg.index, name=arg.name)
elif isinstance(arg, ABCIndex):
Reported by Pylint.
Line: 145
Column: 1
return _coerce_scalar_to_timedelta_type(arg, unit=unit, errors=errors)
def _coerce_scalar_to_timedelta_type(r, unit="ns", errors="raise"):
"""Convert string 'r' to a timedelta object."""
result: Timedelta | NaTType # TODO: alias?
try:
result = Timedelta(r, unit)
Reported by Pylint.
Line: 152
Column: 9
try:
result = Timedelta(r, unit)
except ValueError:
if errors == "raise":
raise
elif errors == "ignore":
return r
# coerce
Reported by Pylint.
Line: 175
Column: 9
try:
td64arr = sequence_to_td64ns(arg, unit=unit, errors=errors, copy=False)[0]
except ValueError:
if errors == "ignore":
return arg
else:
# This else-block accounts for the cases when errors='raise'
# and errors='coerce'. If errors == 'raise', these errors
# should be raised. If errors == 'coerce', we shouldn't
Reported by Pylint.
pandas/tests/io/test_s3.py
11 issues
Line: 4
Column: 1
from io import BytesIO
import os
import pytest
import pandas.util._test_decorators as td
from pandas import read_csv
import pandas._testing as tm
Reported by Pylint.
Line: 16
Column: 5
# GH17135
# botocore gained iteration support in 1.10.47, can now be used in read_*
pytest.importorskip("botocore", minversion="1.10.47")
from botocore.response import StreamingBody
data = [b"foo,bar,baz\n1,2,3\n4,5,6\n", b"just,the,header\n"]
for el in data:
body = StreamingBody(BytesIO(el), content_length=len(el))
read_csv(body)
Reported by Pylint.
Line: 1
Column: 1
from io import BytesIO
import os
import pytest
import pandas.util._test_decorators as td
from pandas import read_csv
import pandas._testing as tm
Reported by Pylint.
Line: 12
Column: 1
import pandas._testing as tm
def test_streaming_s3_objects():
# GH17135
# botocore gained iteration support in 1.10.47, can now be used in read_*
pytest.importorskip("botocore", minversion="1.10.47")
from botocore.response import StreamingBody
Reported by Pylint.
Line: 16
Column: 5
# GH17135
# botocore gained iteration support in 1.10.47, can now be used in read_*
pytest.importorskip("botocore", minversion="1.10.47")
from botocore.response import StreamingBody
data = [b"foo,bar,baz\n1,2,3\n4,5,6\n", b"just,the,header\n"]
for el in data:
body = StreamingBody(BytesIO(el), content_length=len(el))
read_csv(body)
Reported by Pylint.
Line: 19
Column: 9
from botocore.response import StreamingBody
data = [b"foo,bar,baz\n1,2,3\n4,5,6\n", b"just,the,header\n"]
for el in data:
body = StreamingBody(BytesIO(el), content_length=len(el))
read_csv(body)
@tm.network
Reported by Pylint.
Line: 26
Column: 1
@tm.network
@td.skip_if_no("s3fs")
def test_read_without_creds_from_pub_bucket():
# GH 34626
# Use Amazon Open Data Registry - https://registry.opendata.aws/gdelt
result = read_csv("s3://gdelt-open-data/events/1981.csv", nrows=3)
assert len(result) == 3
Reported by Pylint.
Line: 30
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html
# GH 34626
# Use Amazon Open Data Registry - https://registry.opendata.aws/gdelt
result = read_csv("s3://gdelt-open-data/events/1981.csv", nrows=3)
assert len(result) == 3
@tm.network
@td.skip_if_no("s3fs")
def test_read_with_creds_from_pub_bucket():
Reported by Bandit.
Line: 35
Column: 1
@tm.network
@td.skip_if_no("s3fs")
def test_read_with_creds_from_pub_bucket():
# Ensure we can read from a public bucket with credentials
# GH 34626
# Use Amazon Open Data Registry - https://registry.opendata.aws/gdelt
with tm.ensure_safe_environment_variables():
Reported by Pylint.
Line: 45
Column: 9
# see https://github.com/spulec/moto/issues/1924 & 1952
os.environ.setdefault("AWS_ACCESS_KEY_ID", "foobar_key")
os.environ.setdefault("AWS_SECRET_ACCESS_KEY", "foobar_secret")
df = read_csv(
"s3://gdelt-open-data/events/1981.csv", nrows=5, sep="\t", header=None
)
assert len(df) == 5
Reported by Pylint.
pandas/tests/resample/conftest.py
11 issues
Line: 4
Column: 1
from datetime import datetime
import numpy as np
import pytest
from pandas import (
DataFrame,
Series,
)
Reported by Pylint.
Line: 106
Column: 20
@pytest.fixture
def _static_values(index):
"""
Fixture for parametrization of values used in parametrization of
Series and DataFrames with date_range, period_range and
timedelta_range indexes
"""
Reported by Pylint.
Line: 125
Column: 12
@pytest.fixture
def series(index, _series_name, _static_values):
"""
Fixture for parametrization of Series with date_range, period_range and
timedelta_range indexes
"""
return Series(_static_values, index=index, name=_series_name)
Reported by Pylint.
Line: 134
Column: 22
@pytest.fixture
def empty_series_dti(series):
"""
Fixture for parametrization of empty Series with date_range,
period_range and timedelta_range indexes
"""
return series[:0]
Reported by Pylint.
Line: 143
Column: 11
@pytest.fixture
def frame(index, _series_name, _static_values):
"""
Fixture for parametrization of DataFrame with date_range, period_range
and timedelta_range indexes
"""
# _series_name is intentionally unused
Reported by Pylint.
Line: 153
Column: 21
@pytest.fixture
def empty_frame_dti(series):
"""
Fixture for parametrization of empty DataFrame with date_range,
period_range and timedelta_range indexes
"""
index = series.index[:0]
Reported by Pylint.
Line: 158
Column: 5
Fixture for parametrization of empty DataFrame with date_range,
period_range and timedelta_range indexes
"""
index = series.index[:0]
return DataFrame(index=index)
@pytest.fixture(params=[Series, DataFrame])
def series_and_frame(request, series, frame):
Reported by Pylint.
Line: 163
Column: 31
@pytest.fixture(params=[Series, DataFrame])
def series_and_frame(request, series, frame):
"""
Fixture for parametrization of Series and DataFrame with date_range,
period_range and timedelta_range indexes
"""
if request.param == Series:
Reported by Pylint.
Line: 163
Column: 39
@pytest.fixture(params=[Series, DataFrame])
def series_and_frame(request, series, frame):
"""
Fixture for parametrization of Series and DataFrame with date_range,
period_range and timedelta_range indexes
"""
if request.param == Series:
Reported by Pylint.
Line: 1
Column: 1
from datetime import datetime
import numpy as np
import pytest
from pandas import (
DataFrame,
Series,
)
Reported by Pylint.