Skip to content

Commit c565b1c

Browse files
jpribylAlexKirko
authored andcommitted
Issue35925 remove more trailing commas (pandas-dev#35959)
* pandas/core/series.py * pandas/core/window/ewm.py * pandas/core/window/indexers.py * pandas/core/window/numba_.py * pandas/core/window/rolling.py * pandas/io/formats/css.py * pandas/io/formats/format.py * pandas/io/orc.py
1 parent 1507261 commit c565b1c

File tree

8 files changed

+15
-20
lines changed

8 files changed

+15
-20
lines changed

pandas/core/series.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -962,12 +962,12 @@ def _get_values_tuple(self, key):
962962
# If key is contained, would have returned by now
963963
indexer, new_index = self.index.get_loc_level(key)
964964
return self._constructor(self._values[indexer], index=new_index).__finalize__(
965-
self,
965+
self
966966
)
967967

968968
def _get_values(self, indexer):
969969
try:
970-
return self._constructor(self._mgr.get_slice(indexer)).__finalize__(self,)
970+
return self._constructor(self._mgr.get_slice(indexer)).__finalize__(self)
971971
except ValueError:
972972
# mpl compat if we look up e.g. ser[:, np.newaxis];
973973
# see tests.series.timeseries.test_mpl_compat_hack

pandas/core/window/ewm.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ def var(self, bias: bool = False, *args, **kwargs):
362362

363363
def f(arg):
364364
return window_aggregations.ewmcov(
365-
arg, arg, self.com, self.adjust, self.ignore_na, self.min_periods, bias,
365+
arg, arg, self.com, self.adjust, self.ignore_na, self.min_periods, bias
366366
)
367367

368368
return self._apply(f)
@@ -458,7 +458,7 @@ def _get_corr(X, Y):
458458

459459
def _cov(x, y):
460460
return window_aggregations.ewmcov(
461-
x, y, self.com, self.adjust, self.ignore_na, self.min_periods, 1,
461+
x, y, self.com, self.adjust, self.ignore_na, self.min_periods, 1
462462
)
463463

464464
x_values = X._prep_values()

pandas/core/window/indexers.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class BaseIndexer:
4040
"""Base class for window bounds calculations."""
4141

4242
def __init__(
43-
self, index_array: Optional[np.ndarray] = None, window_size: int = 0, **kwargs,
43+
self, index_array: Optional[np.ndarray] = None, window_size: int = 0, **kwargs
4444
):
4545
"""
4646
Parameters
@@ -105,7 +105,7 @@ def get_window_bounds(
105105
) -> Tuple[np.ndarray, np.ndarray]:
106106

107107
return calculate_variable_window_bounds(
108-
num_values, self.window_size, min_periods, center, closed, self.index_array,
108+
num_values, self.window_size, min_periods, center, closed, self.index_array
109109
)
110110

111111

@@ -316,7 +316,7 @@ def get_window_bounds(
316316
# Cannot use groupby_indicies as they might not be monotonic with the object
317317
# we're rolling over
318318
window_indicies = np.arange(
319-
window_indicies_start, window_indicies_start + len(indices),
319+
window_indicies_start, window_indicies_start + len(indices)
320320
)
321321
window_indicies_start += len(indices)
322322
# Extend as we'll be slicing window like [start, end)

pandas/core/window/numba_.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def generate_numba_apply_func(
5757

5858
@numba.jit(nopython=nopython, nogil=nogil, parallel=parallel)
5959
def roll_apply(
60-
values: np.ndarray, begin: np.ndarray, end: np.ndarray, minimum_periods: int,
60+
values: np.ndarray, begin: np.ndarray, end: np.ndarray, minimum_periods: int
6161
) -> np.ndarray:
6262
result = np.empty(len(begin))
6363
for i in loop_range(len(result)):

pandas/core/window/rolling.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2117,7 +2117,7 @@ def count(self):
21172117
@Substitution(name="rolling")
21182118
@Appender(_shared_docs["apply"])
21192119
def apply(
2120-
self, func, raw=False, engine=None, engine_kwargs=None, args=None, kwargs=None,
2120+
self, func, raw=False, engine=None, engine_kwargs=None, args=None, kwargs=None
21212121
):
21222122
return super().apply(
21232123
func,

pandas/io/formats/css.py

+2-7
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,7 @@ def expand(self, prop, value: str):
2020
try:
2121
mapping = self.SIDE_SHORTHANDS[len(tokens)]
2222
except KeyError:
23-
warnings.warn(
24-
f'Could not expand "{prop}: {value}"', CSSWarning,
25-
)
23+
warnings.warn(f'Could not expand "{prop}: {value}"', CSSWarning)
2624
return
2725
for key, idx in zip(self.SIDES, mapping):
2826
yield prop_fmt.format(key), tokens[idx]
@@ -117,10 +115,7 @@ def __call__(self, declarations_str, inherited=None):
117115
props[prop] = self.size_to_pt(
118116
props[prop], em_pt=font_size, conversions=self.BORDER_WIDTH_RATIOS
119117
)
120-
for prop in [
121-
f"margin-{side}",
122-
f"padding-{side}",
123-
]:
118+
for prop in [f"margin-{side}", f"padding-{side}"]:
124119
if prop in props:
125120
# TODO: support %
126121
props[prop] = self.size_to_pt(

pandas/io/formats/format.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
FloatFormatType = Union[str, Callable, "EngFormatter"]
8181
ColspaceType = Mapping[Label, Union[str, int]]
8282
ColspaceArgType = Union[
83-
str, int, Sequence[Union[str, int]], Mapping[Label, Union[str, int]],
83+
str, int, Sequence[Union[str, int]], Mapping[Label, Union[str, int]]
8484
]
8585

8686
common_docstring = """
@@ -741,7 +741,7 @@ def _to_str_columns(self) -> List[List[str]]:
741741
for i, c in enumerate(frame):
742742
fmt_values = self._format_col(i)
743743
fmt_values = _make_fixed_width(
744-
fmt_values, self.justify, minimum=col_space.get(c, 0), adj=self.adj,
744+
fmt_values, self.justify, minimum=col_space.get(c, 0), adj=self.adj
745745
)
746746
stringified.append(fmt_values)
747747
else:
@@ -1069,7 +1069,7 @@ def _get_formatted_index(self, frame: "DataFrame") -> List[str]:
10691069
fmt_index = [
10701070
tuple(
10711071
_make_fixed_width(
1072-
list(x), justify="left", minimum=col_space.get("", 0), adj=self.adj,
1072+
list(x), justify="left", minimum=col_space.get("", 0), adj=self.adj
10731073
)
10741074
)
10751075
for x in fmt_index

pandas/io/orc.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313

1414
def read_orc(
15-
path: FilePathOrBuffer, columns: Optional[List[str]] = None, **kwargs,
15+
path: FilePathOrBuffer, columns: Optional[List[str]] = None, **kwargs
1616
) -> "DataFrame":
1717
"""
1818
Load an ORC object from the file path, returning a DataFrame.

0 commit comments

Comments
 (0)