From 107fb9acfbd6e74247542c81e88920b51f96787f Mon Sep 17 00:00:00 2001 From: Kaathi Date: Thu, 24 Oct 2019 23:05:55 +0530 Subject: [PATCH 1/2] Clean up noqa E241 #29207 --- pandas/tests/dtypes/test_inference.py | 80 +++++++++++++-------------- pandas/tests/test_strings.py | 74 ++++++++++++------------- 2 files changed, 77 insertions(+), 77 deletions(-) diff --git a/pandas/tests/dtypes/test_inference.py b/pandas/tests/dtypes/test_inference.py index 60afd768195d9..aeec12b9ad14e 100644 --- a/pandas/tests/dtypes/test_inference.py +++ b/pandas/tests/dtypes/test_inference.py @@ -62,46 +62,46 @@ def coerce(request): # collect all objects to be tested for list-like-ness; use tuples of objects, # whether they are list-like or not (special casing for sets), and their ID ll_params = [ - ([1], True, "list"), # noqa: E241 - ([], True, "list-empty"), # noqa: E241 - ((1,), True, "tuple"), # noqa: E241 - (tuple(), True, "tuple-empty"), # noqa: E241 - ({"a": 1}, True, "dict"), # noqa: E241 - (dict(), True, "dict-empty"), # noqa: E241 - ({"a", 1}, "set", "set"), # noqa: E241 - (set(), "set", "set-empty"), # noqa: E241 - (frozenset({"a", 1}), "set", "frozenset"), # noqa: E241 - (frozenset(), "set", "frozenset-empty"), # noqa: E241 - (iter([1, 2]), True, "iterator"), # noqa: E241 - (iter([]), True, "iterator-empty"), # noqa: E241 - ((x for x in [1, 2]), True, "generator"), # noqa: E241 - ((_ for _ in []), True, "generator-empty"), # noqa: E241 - (Series([1]), True, "Series"), # noqa: E241 - (Series([]), True, "Series-empty"), # noqa: E241 - (Series(["a"]).str, True, "StringMethods"), # noqa: E241 - (Series([], dtype="O").str, True, "StringMethods-empty"), # noqa: E241 - (Index([1]), True, "Index"), # noqa: E241 - (Index([]), True, "Index-empty"), # noqa: E241 - (DataFrame([[1]]), True, "DataFrame"), # noqa: E241 - (DataFrame(), True, "DataFrame-empty"), # noqa: E241 - (np.ndarray((2,) * 1), True, "ndarray-1d"), # noqa: E241 - (np.array([]), True, "ndarray-1d-empty"), # noqa: E241 - (np.ndarray((2,) * 2), True, "ndarray-2d"), # noqa: E241 - (np.array([[]]), True, "ndarray-2d-empty"), # noqa: E241 - (np.ndarray((2,) * 3), True, "ndarray-3d"), # noqa: E241 - (np.array([[[]]]), True, "ndarray-3d-empty"), # noqa: E241 - (np.ndarray((2,) * 4), True, "ndarray-4d"), # noqa: E241 - (np.array([[[[]]]]), True, "ndarray-4d-empty"), # noqa: E241 - (np.array(2), False, "ndarray-0d"), # noqa: E241 - (1, False, "int"), # noqa: E241 - (b"123", False, "bytes"), # noqa: E241 - (b"", False, "bytes-empty"), # noqa: E241 - ("123", False, "string"), # noqa: E241 - ("", False, "string-empty"), # noqa: E241 - (str, False, "string-type"), # noqa: E241 - (object(), False, "object"), # noqa: E241 - (np.nan, False, "NaN"), # noqa: E241 - (None, False, "None"), # noqa: E241 + ([1], True, "list"), + ([], True, "list-empty"), + ((1,), True, "tuple"), + (tuple(), True, "tuple-empty"), + ({"a": 1}, True, "dict"), + (dict(), True, "dict-empty"), + ({"a", 1}, "set", "set"), + (set(), "set", "set-empty"), + (frozenset({"a", 1}), "set", "frozenset"), + (frozenset(), "set", "frozenset-empty"), + (iter([1, 2]), True, "iterator"), + (iter([]), True, "iterator-empty"), + ((x for x in [1, 2]), True, "generator"), + ((_ for _ in []), True, "generator-empty"), + (Series([1]), True, "Series"), + (Series([]), True, "Series-empty"), + (Series(["a"]).str, True, "StringMethods"), + (Series([], dtype="O").str, True, "StringMethods-empty"), + (Index([1]), True, "Index"), + (Index([]), True, "Index-empty"), + (DataFrame([[1]]), True, "DataFrame"), + (DataFrame(), True, "DataFrame-empty"), + (np.ndarray((2,) * 1), True, "ndarray-1d"), + (np.array([]), True, "ndarray-1d-empty"), + (np.ndarray((2,) * 2), True, "ndarray-2d"), + (np.array([[]]), True, "ndarray-2d-empty"), + (np.ndarray((2,) * 3), True, "ndarray-3d"), + (np.array([[[]]]), True, "ndarray-3d-empty"), + (np.ndarray((2,) * 4), True, "ndarray-4d"), + (np.array([[[[]]]]), True, "ndarray-4d-empty"), + (np.array(2), False, "ndarray-0d"), + (1, False, "int"), + (b"123", False, "bytes"), + (b"", False, "bytes-empty"), + ("123", False, "string"), + ("", False, "string-empty"), + (str, False, "string-type"), + (object(), False, "object"), + (np.nan, False, "NaN"), + (None, False, "None"), ] objs, expected, ids = zip(*ll_params) diff --git a/pandas/tests/test_strings.py b/pandas/tests/test_strings.py index 53d74f74dc439..cfaf123045b1f 100644 --- a/pandas/tests/test_strings.py +++ b/pandas/tests/test_strings.py @@ -21,46 +21,46 @@ def assert_series_or_index_equal(left, right): _any_string_method = [ - ("cat", (), {"sep": ","}), # noqa: E241 - ("cat", (Series(list("zyx")),), {"sep": ",", "join": "left"}), # noqa: E241 - ("center", (10,), {}), # noqa: E241 - ("contains", ("a",), {}), # noqa: E241 - ("count", ("a",), {}), # noqa: E241 - ("decode", ("UTF-8",), {}), # noqa: E241 - ("encode", ("UTF-8",), {}), # noqa: E241 - ("endswith", ("a",), {}), # noqa: E241 - ("extract", ("([a-z]*)",), {"expand": False}), # noqa: E241 - ("extract", ("([a-z]*)",), {"expand": True}), # noqa: E241 - ("extractall", ("([a-z]*)",), {}), # noqa: E241 - ("find", ("a",), {}), # noqa: E241 - ("findall", ("a",), {}), # noqa: E241 - ("get", (0,), {}), # noqa: E241 + ("cat", (), {"sep": ","}), + ("cat", (Series(list("zyx")),), {"sep": ",", "join": "left"}), + ("center", (10,), {}), + ("contains", ("a",), {}), + ("count", ("a",), {}), + ("decode", ("UTF-8",), {}), + ("encode", ("UTF-8",), {}), + ("endswith", ("a",), {}), + ("extract", ("([a-z]*)",), {"expand": False}), + ("extract", ("([a-z]*)",), {"expand": True}), + ("extractall", ("([a-z]*)",), {}), + ("find", ("a",), {}), + ("findall", ("a",), {}), + ("get", (0,), {}), # because "index" (and "rindex") fail intentionally # if the string is not found, search only for empty string - ("index", ("",), {}), # noqa: E241 - ("join", (",",), {}), # noqa: E241 - ("ljust", (10,), {}), # noqa: E241 - ("match", ("a",), {}), # noqa: E241 - ("normalize", ("NFC",), {}), # noqa: E241 - ("pad", (10,), {}), # noqa: E241 - ("partition", (" ",), {"expand": False}), # noqa: E241 - ("partition", (" ",), {"expand": True}), # noqa: E241 - ("repeat", (3,), {}), # noqa: E241 - ("replace", ("a", "z"), {}), # noqa: E241 - ("rfind", ("a",), {}), # noqa: E241 - ("rindex", ("",), {}), # noqa: E241 - ("rjust", (10,), {}), # noqa: E241 - ("rpartition", (" ",), {"expand": False}), # noqa: E241 - ("rpartition", (" ",), {"expand": True}), # noqa: E241 - ("slice", (0, 1), {}), # noqa: E241 - ("slice_replace", (0, 1, "z"), {}), # noqa: E241 - ("split", (" ",), {"expand": False}), # noqa: E241 - ("split", (" ",), {"expand": True}), # noqa: E241 - ("startswith", ("a",), {}), # noqa: E241 + ("index", ("",), {}), + ("join", (",",), {}), + ("ljust", (10,), {}), + ("match", ("a",), {}), + ("normalize", ("NFC",), {}), + ("pad", (10,), {}), + ("partition", (" ",), {"expand": False}), + ("partition", (" ",), {"expand": True}), + ("repeat", (3,), {}), + ("replace", ("a", "z"), {}), + ("rfind", ("a",), {}), + ("rindex", ("",), {}), + ("rjust", (10,), {}), + ("rpartition", (" ",), {"expand": False}), + ("rpartition", (" ",), {"expand": True}), + ("slice", (0, 1), {}), + ("slice_replace", (0, 1, "z"), {}), + ("split", (" ",), {"expand": False}), + ("split", (" ",), {"expand": True}), + ("startswith", ("a",), {}), # translating unicode points of "a" to "d" - ("translate", ({97: 100},), {}), # noqa: E241 - ("wrap", (2,), {}), # noqa: E241 - ("zfill", (10,), {}), # noqa: E241 + ("translate", ({97: 100},), {}), + ("wrap", (2,), {}), + ("zfill", (10,), {}), ] + list( zip( [ From 23956f1e8b81b052144c3c098dd6effa4354e36b Mon Sep 17 00:00:00 2001 From: Kaathi Date: Wed, 13 Nov 2019 00:02:18 +0530 Subject: [PATCH 2/2] NOQA removal from asv_bench folder --- asv_bench/benchmarks/gil.py | 2 +- asv_bench/benchmarks/offset.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/asv_bench/benchmarks/gil.py b/asv_bench/benchmarks/gil.py index d57492dd37268..43c8594b8c8df 100644 --- a/asv_bench/benchmarks/gil.py +++ b/asv_bench/benchmarks/gil.py @@ -37,7 +37,7 @@ def wrapper(fname): return wrapper -from .pandas_vb_common import BaseIO # noqa: E402 isort:skip +from .pandas_vb_common import BaseIO # isort:skip class ParallelGroupbyMethods: diff --git a/asv_bench/benchmarks/offset.py b/asv_bench/benchmarks/offset.py index d822646e712ae..129da744ab9ba 100644 --- a/asv_bench/benchmarks/offset.py +++ b/asv_bench/benchmarks/offset.py @@ -6,7 +6,7 @@ import pandas as pd try: - import pandas.tseries.holiday # noqa + import pandas.tseries.holiday except ImportError: pass