Skip to content

Commit 8ea102a

Browse files
Fix-up black formatting: fix noqa comments + type annotations
1 parent bb61358 commit 8ea102a

File tree

10 files changed

+29
-35
lines changed

10 files changed

+29
-35
lines changed

Diff for: pandas/api/extensions/__init__.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,9 @@
55
)
66

77
from pandas.core.accessor import ( # noqa: F401
8+
register_dataframe_accessor,
89
register_index_accessor,
910
register_series_accessor,
1011
)
1112
from pandas.core.algorithms import take # noqa: F401
1213
from pandas.core.arrays import ExtensionArray, ExtensionScalarOpsMixin # noqa: F401
13-
14-
from pandas.core.accessor import register_dataframe_accessor # noqa: F401; noqa: F401

Diff for: pandas/compat/numpy/function.py

+4-8
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,7 @@ def validate_argmax_with_skipna(skipna, args, kwargs):
108108
return skipna
109109

110110

111-
ARGSORT_DEFAULTS = OrderedDict()
112-
# type: OrderedDict[str, Optional[Union[int, str]]]
111+
ARGSORT_DEFAULTS = OrderedDict() # type: OrderedDict[str, Optional[Union[int, str]]]
113112
ARGSORT_DEFAULTS["axis"] = -1
114113
ARGSORT_DEFAULTS["kind"] = "quicksort"
115114
ARGSORT_DEFAULTS["order"] = None
@@ -125,8 +124,7 @@ def validate_argmax_with_skipna(skipna, args, kwargs):
125124

126125
# two different signatures of argsort, this second validation
127126
# for when the `kind` param is supported
128-
ARGSORT_DEFAULTS_KIND = OrderedDict()
129-
# type: OrderedDict[str, Optional[int]]
127+
ARGSORT_DEFAULTS_KIND = OrderedDict() # type: OrderedDict[str, Optional[int]]
130128
ARGSORT_DEFAULTS_KIND["axis"] = -1
131129
ARGSORT_DEFAULTS_KIND["order"] = None
132130
validate_argsort_kind = CompatValidator(
@@ -243,8 +241,7 @@ def validate_cum_func_with_skipna(skipna, args, kwargs, name):
243241
ROUND_DEFAULTS, fname="round", method="both", max_fname_arg_count=1
244242
)
245243

246-
SORT_DEFAULTS = OrderedDict()
247-
# type: OrderedDict[str, Optional[Union[int, str]]]
244+
SORT_DEFAULTS = OrderedDict() # type: OrderedDict[str, Optional[Union[int, str]]]
248245
SORT_DEFAULTS["axis"] = -1
249246
SORT_DEFAULTS["kind"] = "quicksort"
250247
SORT_DEFAULTS["order"] = None
@@ -278,8 +275,7 @@ def validate_cum_func_with_skipna(skipna, args, kwargs, name):
278275
MEDIAN_DEFAULTS, fname="median", method="both", max_fname_arg_count=1
279276
)
280277

281-
STAT_DDOF_FUNC_DEFAULTS = OrderedDict()
282-
# type: OrderedDict[str, Optional[bool]]
278+
STAT_DDOF_FUNC_DEFAULTS = OrderedDict() # type: OrderedDict[str, Optional[bool]]
283279
STAT_DDOF_FUNC_DEFAULTS["dtype"] = None
284280
STAT_DDOF_FUNC_DEFAULTS["out"] = None
285281
STAT_DDOF_FUNC_DEFAULTS["keepdims"] = False

Diff for: pandas/core/indexes/datetimelike.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -73,14 +73,14 @@ class DatetimeIndexOpsMixin(ExtensionOpsMixin):
7373
# properties there. They can be made into cache_readonly for Index
7474
# subclasses bc they are immutable
7575
inferred_freq = cache_readonly(
76-
DatetimeLikeArrayMixin.inferred_freq.fget
77-
) # type: ignore
76+
DatetimeLikeArrayMixin.inferred_freq.fget # type: ignore
77+
)
7878
_isnan = cache_readonly(DatetimeLikeArrayMixin._isnan.fget) # type: ignore
7979
hasnans = cache_readonly(DatetimeLikeArrayMixin._hasnans.fget) # type: ignore
8080
_hasnans = hasnans # for index / array -agnostic code
8181
_resolution = cache_readonly(
82-
DatetimeLikeArrayMixin._resolution.fget
83-
) # type: ignore
82+
DatetimeLikeArrayMixin._resolution.fget # type: ignore
83+
)
8484
resolution = cache_readonly(DatetimeLikeArrayMixin.resolution.fget) # type: ignore
8585

8686
_maybe_mask_results = ea_passthrough(DatetimeLikeArrayMixin._maybe_mask_results)

Diff for: pandas/tests/arrays/categorical/test_constructors.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -224,8 +224,8 @@ def test_constructor(self):
224224

225225
# this is a legitimate constructor
226226
with tm.assert_produces_warning(None):
227-
c = Categorical(
228-
np.array([], dtype="int64"), categories=[3, 2, 1], ordered=True # noqa
227+
c = Categorical( # noqa
228+
np.array([], dtype="int64"), categories=[3, 2, 1], ordered=True
229229
)
230230

231231
def test_constructor_with_existing_categories(self):

Diff for: pandas/tests/arrays/sparse/test_array.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -689,13 +689,13 @@ def test_getslice_tuple(self):
689689
dense = np.array([np.nan, 0, 3, 4, 0, 5, np.nan, np.nan, 0])
690690

691691
sparse = SparseArray(dense)
692-
res = sparse[4:,]
693-
exp = SparseArray(dense[4:,])
692+
res = sparse[4:,] # noqa: E231
693+
exp = SparseArray(dense[4:,]) # noqa: E231
694694
tm.assert_sp_array_equal(res, exp)
695695

696696
sparse = SparseArray(dense, fill_value=0)
697-
res = sparse[4:,]
698-
exp = SparseArray(dense[4:,], fill_value=0)
697+
res = sparse[4:,] # noqa: E231
698+
exp = SparseArray(dense[4:,], fill_value=0) # noqa: E231
699699
tm.assert_sp_array_equal(res, exp)
700700

701701
with pytest.raises(IndexError):

Diff for: pandas/tests/frame/test_alter_axes.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -238,9 +238,8 @@ def test_set_index_pass_arrays_duplicate(
238238
# cannot drop the same column twice;
239239
# use "is" because == would give ambiguous Boolean error for containers
240240
first_drop = (
241-
False if (keys[0] is "A" and keys[1] is "A") else drop
242-
) # noqa: F632
243-
241+
False if (keys[0] is "A" and keys[1] is "A") else drop # noqa: F632
242+
)
244243
# to test against already-tested behaviour, we add sequentially,
245244
# hence second append always True; must wrap keys in list, otherwise
246245
# box = list would be interpreted as keys

Diff for: pandas/tests/frame/test_analytics.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -2135,8 +2135,8 @@ def test_round(self):
21352135
nan_round_Series = Series({"col1": np.nan, "col2": 1})
21362136

21372137
# TODO(wesm): unused?
2138-
expected_nan_round = DataFrame(
2139-
{"col1": [1.123, 2.123, 3.123], "col2": [1.2, 2.2, 3.2]} # noqa
2138+
expected_nan_round = DataFrame( # noqa
2139+
{"col1": [1.123, 2.123, 3.123], "col2": [1.2, 2.2, 3.2]}
21402140
)
21412141

21422142
with pytest.raises(TypeError):

Diff for: pandas/tests/frame/test_query_eval.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,8 @@ def test_ops(self):
102102
("/", "__truediv__", "__rtruediv__"),
103103
]:
104104

105-
base = DataFrame(
106-
np.tile(m.values, n).reshape(n, -1), columns=list("abcd") # noqa
105+
base = DataFrame( # noqa
106+
np.tile(m.values, n).reshape(n, -1), columns=list("abcd")
107107
)
108108

109109
expected = eval("base{op}df".format(op=op_str))

Diff for: pandas/tests/indexing/test_callable.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ def test_frame_loc_callable(self):
1717
res = df.loc[lambda x: x.A > 2]
1818
tm.assert_frame_equal(res, df.loc[df.A > 2])
1919

20-
res = df.loc[lambda x: x.A > 2,]
21-
tm.assert_frame_equal(res, df.loc[df.A > 2,])
20+
res = df.loc[lambda x: x.A > 2,] # noqa: E231
21+
tm.assert_frame_equal(res, df.loc[df.A > 2,]) # noqa: E231
2222

23-
res = df.loc[lambda x: x.A > 2,]
24-
tm.assert_frame_equal(res, df.loc[df.A > 2,])
23+
res = df.loc[lambda x: x.A > 2,] # noqa: E231
24+
tm.assert_frame_equal(res, df.loc[df.A > 2,]) # noqa: E231
2525

2626
res = df.loc[lambda x: x.B == "b", :]
2727
tm.assert_frame_equal(res, df.loc[df.B == "b", :])
@@ -90,8 +90,8 @@ def test_frame_loc_callable_labels(self):
9090
res = df.loc[lambda x: ["A", "C"]]
9191
tm.assert_frame_equal(res, df.loc[["A", "C"]])
9292

93-
res = df.loc[lambda x: ["A", "C"],]
94-
tm.assert_frame_equal(res, df.loc[["A", "C"],])
93+
res = df.loc[lambda x: ["A", "C"],] # noqa: E231
94+
tm.assert_frame_equal(res, df.loc[["A", "C"],]) # noqa: E231
9595

9696
res = df.loc[lambda x: ["A", "C"], :]
9797
tm.assert_frame_equal(res, df.loc[["A", "C"], :])

Diff for: pandas/tests/test_strings.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1839,13 +1839,13 @@ def test_ismethods(self):
18391839
digit_e = [False, False, False, True, False, False, False, True, False, False]
18401840

18411841
# TODO: unused
1842-
num_e = [
1842+
num_e = [ # noqa
18431843
False,
18441844
False,
18451845
False,
18461846
True,
18471847
False,
1848-
False, # noqa
1848+
False,
18491849
False,
18501850
True,
18511851
False,

0 commit comments

Comments
 (0)