Skip to content

STYLE: Specify target-version for black #29607

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 14, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ci/code_checks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ if [[ -z "$CHECK" || "$CHECK" == "lint" ]]; then
black --version

MSG='Checking black formatting' ; echo $MSG
black . --check --exclude '(asv_bench/env|\.egg|\.git|\.hg|\.mypy_cache|\.nox|\.tox|\.venv|_build|buck-out|build|dist|setup.py)'
black . --check
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved the --exclude option to pyproject.toml since I had to create an entry there for target-version. Also has the advantage that users running black (either explicitly or through pre-commit) will now pick this up as well, so local behavior will match CI.

RET=$(($RET + $?)) ; echo $MSG "DONE"

# `setup.cfg` contains the list of error codes that are being ignored in flake8
Expand Down
12 changes: 6 additions & 6 deletions pandas/core/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -2082,7 +2082,7 @@ def to_stata(
data_label=data_label,
write_index=write_index,
variable_labels=variable_labels,
**kwargs
**kwargs,
)
writer.write_file()

Expand All @@ -2106,7 +2106,7 @@ def to_parquet(
compression="snappy",
index=None,
partition_cols=None,
**kwargs
**kwargs,
):
"""
Write a DataFrame to the binary parquet format.
Expand Down Expand Up @@ -2186,7 +2186,7 @@ def to_parquet(
compression=compression,
index=index,
partition_cols=partition_cols,
**kwargs
**kwargs,
)

@Substitution(
Expand Down Expand Up @@ -4110,7 +4110,7 @@ def fillna(
inplace=False,
limit=None,
downcast=None,
**kwargs
**kwargs,
):
return super().fillna(
value=value,
Expand All @@ -4119,7 +4119,7 @@ def fillna(
inplace=inplace,
limit=limit,
downcast=downcast,
**kwargs
**kwargs,
)

@Appender(_shared_docs["replace"] % _shared_doc_kwargs)
Expand Down Expand Up @@ -6566,7 +6566,7 @@ def _gotitem(
see_also=_agg_summary_and_see_also_doc,
examples=_agg_examples_doc,
versionadded="\n.. versionadded:: 0.20.0\n",
**_shared_doc_kwargs
**_shared_doc_kwargs,
)
@Appender(_shared_docs["aggregate"])
def aggregate(self, func, axis=0, *args, **kwargs):
Expand Down
8 changes: 4 additions & 4 deletions pandas/core/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -2055,7 +2055,7 @@ def __getstate__(self):
_typ=self._typ,
_metadata=self._metadata,
attrs=self.attrs,
**meta
**meta,
)

def __setstate__(self, state):
Expand Down Expand Up @@ -7050,7 +7050,7 @@ def interpolate(
limit_direction="forward",
limit_area=None,
downcast=None,
**kwargs
**kwargs,
):
"""
Interpolate values according to different methods.
Expand Down Expand Up @@ -7124,7 +7124,7 @@ def interpolate(
limit_area=limit_area,
inplace=inplace,
downcast=downcast,
**kwargs
**kwargs,
)

if inplace:
Expand Down Expand Up @@ -11572,7 +11572,7 @@ def stat_func(
level=None,
numeric_only=None,
min_count=0,
**kwargs
**kwargs,
):
if name == "sum":
nv.validate_sum(tuple(), kwargs)
Expand Down
4 changes: 2 additions & 2 deletions pandas/core/groupby/groupby.py
Original file line number Diff line number Diff line change
Expand Up @@ -1214,7 +1214,7 @@ def median(self, **kwargs):
return self._cython_agg_general(
"median",
alt=lambda x, axis: Series(x).median(axis=axis, **kwargs),
**kwargs
**kwargs,
)

@Substitution(name="groupby")
Expand Down Expand Up @@ -2181,7 +2181,7 @@ def _get_cythonized_result(
result_is_index: bool = False,
pre_processing=None,
post_processing=None,
**kwargs
**kwargs,
):
"""
Get result for Cythonized functions.
Expand Down
2 changes: 1 addition & 1 deletion pandas/core/indexes/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ def __new__(
name=None,
fastpath=None,
tupleize_cols=True,
**kwargs
**kwargs,
) -> "Index":

from .range import RangeIndex
Expand Down
8 changes: 4 additions & 4 deletions pandas/core/indexes/datetimes.py
Original file line number Diff line number Diff line change
Expand Up @@ -1422,7 +1422,7 @@ def date_range(
normalize=False,
name=None,
closed=None,
**kwargs
**kwargs,
):
"""
Return a fixed frequency DatetimeIndex.
Expand Down Expand Up @@ -1572,7 +1572,7 @@ def date_range(
tz=tz,
normalize=normalize,
closed=closed,
**kwargs
**kwargs,
)
return DatetimeIndex._simple_new(dtarr, tz=dtarr.tz, freq=dtarr.freq, name=name)

Expand All @@ -1588,7 +1588,7 @@ def bdate_range(
weekmask=None,
holidays=None,
closed=None,
**kwargs
**kwargs,
):
"""
Return a fixed frequency DatetimeIndex, with business day as the default
Expand Down Expand Up @@ -1681,7 +1681,7 @@ def bdate_range(
normalize=normalize,
name=name,
closed=closed,
**kwargs
**kwargs,
)


Expand Down
2 changes: 1 addition & 1 deletion pandas/core/indexes/interval.py
Original file line number Diff line number Diff line change
Expand Up @@ -935,7 +935,7 @@ def get_loc(
None is specified as these are not yet implemented.
"""
)
}
},
)
)
@Appender(_index_shared_docs["get_indexer"])
Expand Down
4 changes: 2 additions & 2 deletions pandas/core/indexes/multi.py
Original file line number Diff line number Diff line change
Expand Up @@ -956,7 +956,7 @@ def copy(
codes=None,
deep=False,
_set_identity=False,
**kwargs
**kwargs,
):
"""
Make a copy of this object. Names, dtype, levels and codes can be
Expand Down Expand Up @@ -1020,7 +1020,7 @@ def _shallow_copy_with_infer(self, values, **kwargs):
return MultiIndex(
levels=[[] for _ in range(self.nlevels)],
codes=[[] for _ in range(self.nlevels)],
**kwargs
**kwargs,
)
return self._shallow_copy(values, **kwargs)

Expand Down
2 changes: 1 addition & 1 deletion pandas/core/indexes/period.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ def __new__(
dtype=None,
copy=False,
name=None,
**fields
**fields,
):

valid_field_set = {
Expand Down
10 changes: 5 additions & 5 deletions pandas/core/internals/blocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -1088,7 +1088,7 @@ def interpolate(
fill_value=None,
coerce=False,
downcast=None,
**kwargs
**kwargs,
):

inplace = validate_bool_kwarg(inplace, "inplace")
Expand Down Expand Up @@ -1138,7 +1138,7 @@ def check_int_bool(self, inplace):
fill_value=fill_value,
inplace=inplace,
downcast=downcast,
**kwargs
**kwargs,
)

def _interpolate_with_fill(
Expand Down Expand Up @@ -1193,7 +1193,7 @@ def _interpolate(
limit_area=None,
inplace=False,
downcast=None,
**kwargs
**kwargs,
):
""" interpolate using scipy wrappers """

Expand Down Expand Up @@ -1231,7 +1231,7 @@ def func(x):
limit_area=limit_area,
fill_value=fill_value,
bounds_error=False,
**kwargs
**kwargs,
)

# interp each column independently
Expand Down Expand Up @@ -2016,7 +2016,7 @@ def to_native_types(
float_format=None,
decimal=".",
quoting=None,
**kwargs
**kwargs,
):
""" convert to our native types format, slicing if desired """

Expand Down
2 changes: 1 addition & 1 deletion pandas/core/internals/managers.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ def apply(
filter=None,
do_integrity_check=False,
consolidate=True,
**kwargs
**kwargs,
):
"""
iterate over the blocks, collect and create a new block manager
Expand Down
4 changes: 2 additions & 2 deletions pandas/core/missing.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ def interpolate_1d(
fill_value=None,
bounds_error=False,
order=None,
**kwargs
**kwargs,
):
"""
Logic for the 1-d interpolation. The result should be 1-d, inputs
Expand Down Expand Up @@ -300,7 +300,7 @@ def interpolate_1d(
fill_value=fill_value,
bounds_error=bounds_error,
order=order,
**kwargs
**kwargs,
)
result[preserve_nans] = np.nan
return result
Expand Down
6 changes: 3 additions & 3 deletions pandas/core/resample.py
Original file line number Diff line number Diff line change
Expand Up @@ -793,7 +793,7 @@ def interpolate(
limit_direction="forward",
limit_area=None,
downcast=None,
**kwargs
**kwargs,
):
"""
Interpolate values according to different methods.
Expand All @@ -807,7 +807,7 @@ def interpolate(
limit_direction=limit_direction,
limit_area=limit_area,
downcast=downcast,
**kwargs
**kwargs,
)

def asfreq(self, fill_value=None):
Expand Down Expand Up @@ -1369,7 +1369,7 @@ def __init__(
kind=None,
convention=None,
base=0,
**kwargs
**kwargs,
):
# Check for correctness of the keyword arguments which would
# otherwise silently use the default if misspelled
Expand Down
2 changes: 1 addition & 1 deletion pandas/core/reshape/pivot.py
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,7 @@ def crosstab(
margins=margins,
margins_name=margins_name,
dropna=dropna,
**kwargs
**kwargs,
)

# Post-process
Expand Down
8 changes: 4 additions & 4 deletions pandas/core/series.py
Original file line number Diff line number Diff line change
Expand Up @@ -3788,7 +3788,7 @@ def _gotitem(self, key, ndim, subset=None):
see_also=_agg_see_also_doc,
examples=_agg_examples_doc,
versionadded="\n.. versionadded:: 0.20.0\n",
**_shared_doc_kwargs
**_shared_doc_kwargs,
)
@Appender(generic._shared_docs["aggregate"])
def aggregate(self, func, axis=0, *args, **kwargs):
Expand Down Expand Up @@ -4012,7 +4012,7 @@ def _reduce(
skipna=skipna,
numeric_only=numeric_only,
filter_type=filter_type,
**kwds
**kwds,
)

def _reindex_indexer(self, new_index, indexer, copy):
Expand Down Expand Up @@ -4249,7 +4249,7 @@ def fillna(
inplace=False,
limit=None,
downcast=None,
**kwargs
**kwargs,
):
return super().fillna(
value=value,
Expand All @@ -4258,7 +4258,7 @@ def fillna(
inplace=inplace,
limit=limit,
downcast=downcast,
**kwargs
**kwargs,
)

@Appender(generic._shared_docs["replace"] % _shared_doc_kwargs)
Expand Down
4 changes: 2 additions & 2 deletions pandas/core/strings.py
Original file line number Diff line number Diff line change
Expand Up @@ -1875,7 +1875,7 @@ def _noarg_wrapper(
docstring=None,
forbidden_types=["bytes"],
returns_string=True,
**kargs
**kargs,
):
@forbid_nonstring_types(forbidden_types, name=name)
def wrapper(self):
Expand All @@ -1898,7 +1898,7 @@ def _pat_wrapper(
name=None,
forbidden_types=["bytes"],
returns_string=True,
**kwargs
**kwargs,
):
@forbid_nonstring_types(forbidden_types, name=name)
def wrapper1(self, pat):
Expand Down
4 changes: 2 additions & 2 deletions pandas/core/window/rolling.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def __init__(
axis: Axis = 0,
on: Optional[Union[str, Index]] = None,
closed: Optional[str] = None,
**kwargs
**kwargs,
):

self.__dict__.update(kwargs)
Expand Down Expand Up @@ -399,7 +399,7 @@ def _apply(
window: Optional[Union[int, str]] = None,
center: Optional[bool] = None,
check_minp: Optional[Callable] = None,
**kwargs
**kwargs,
):
"""
Rolling statistical measure using supplied function.
Expand Down
2 changes: 1 addition & 1 deletion pandas/io/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,7 @@ def __init__(
file: FilePathOrBuffer,
mode: str,
archive_name: Optional[str] = None,
**kwargs
**kwargs,
):
if mode in ["wb", "rb"]:
mode = mode.replace("b", "")
Expand Down
Loading