Skip to content
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

PR04 errors fix #25157

Merged
merged 17 commits into from
Feb 11, 2019
Merged
Show file tree
Hide file tree
Changes from 6 commits
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
4 changes: 2 additions & 2 deletions ci/code_checks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -240,8 +240,8 @@ fi
### DOCSTRINGS ###
if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then

MSG='Validate docstrings (GL06, GL07, GL09, SS04, PR03, PR05, EX04, RT04, SS05)' ; echo $MSG
$BASE_DIR/scripts/validate_docstrings.py --format=azure --errors=GL06,GL07,GL09,SS04,PR03,PR05,EX04,RT04,SS05
MSG='Validate docstrings (GL06, GL07, GL09, SS04, PR03, PR04, PR05, EX04, RT04, SS05)' ; echo $MSG
$BASE_DIR/scripts/validate_docstrings.py --format=azure --errors=GL06,GL07,GL09,SS04,PR03,PR04,PR05,EX04,RT04,SS05
RET=$(($RET + $?)) ; echo $MSG "DONE"

fi
Expand Down
3 changes: 1 addition & 2 deletions pandas/_libs/tslibs/timedeltas.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -1127,8 +1127,7 @@ class Timedelta(_Timedelta):
'ms', 'milliseconds', 'millisecond', 'milli', 'millis', 'L',
'us', 'microseconds', 'microsecond', 'micro', 'micros', 'U',
'ns', 'nanoseconds', 'nano', 'nanos', 'nanosecond', 'N'}
days, seconds, microseconds,
milliseconds, minutes, hours, weeks : numeric, optional
days,seconds,microseconds,milliseconds,minutes,hours,weeks : numeric, optional:
Copy link
Member

Choose a reason for hiding this comment

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

Does this pass LINTing? May or may not be an issue just not aware of combining parameters like this into one line anywhere else

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Checked, there is one (only line to long atm), but I have no idea how to properly refactor that doc so PR04 error won't appear again

Copy link
Member

Choose a reason for hiding this comment

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

Hmm OK. Technically the signature for this class only accepts **kwargs, so I would use that as the type and then move everything about days, seconds, etc... down into the descption

Values for construction in compat with datetime.timedelta.
np ints and floats will be coerced to python ints and floats.

Expand Down
2 changes: 1 addition & 1 deletion pandas/core/algorithms.py
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,7 @@ def _factorize_array(values, na_sentinel=-1, size_hint=None,
coerced to ndarrays before factorization.
"""),
order=dedent("""\
order
order : None
.. deprecated:: 0.23.0

This parameter has no effect and is deprecated.
Expand Down
5 changes: 3 additions & 2 deletions pandas/core/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -648,13 +648,14 @@ def transpose(self, *args, **kwargs):
copy : boolean, default False
Make a copy of the underlying data. Mixed-dtype data will
always result in a copy
kwargs : Additional keyword arguments will be passed to the function
Copy link
Member

Choose a reason for hiding this comment

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

There is a standard for args and kwargs so here you just want **kwargs on this line (no type require) and move the description down one line


Returns
-------
----------
Copy link
Member

Choose a reason for hiding this comment

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

Why was this changed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It wasn't nacessary change, but I thought matching separator in every section will looks good.

Copy link
Member

Choose a reason for hiding this comment

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

Please revert this - the length needs to match the title name for proper sphinx rendering

y : same as input

Examples
--------
----------
>>> p.transpose(2, 0, 1)
>>> p.transpose(2, 0, 1, copy=True)
"""
Expand Down
2 changes: 1 addition & 1 deletion pandas/core/groupby/groupby.py
Original file line number Diff line number Diff line change
Expand Up @@ -1835,7 +1835,7 @@ def rank(self, method='average', ascending=True, na_option='keep',
The axis of the object over which to compute the rank.

Returns
-----
----------
DataFrame with ranking of values within each group
"""
if na_option not in {'keep', 'top', 'bottom'}:
Expand Down
11 changes: 8 additions & 3 deletions pandas/core/groupby/grouper.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,18 +55,23 @@ class Grouper(object):
sort : boolean, default to False
whether to sort the resulting labels

additional kwargs to control time-like groupers (when `freq` is passed)

closed : closed end of interval; 'left' or 'right'
label : interval boundary to use for labeling; 'left' or 'right'
convention : {'start', 'end', 'e', 's'}
If grouper is PeriodIndex
base, loffset
base : int, default 0
loffset : string / DateOffset / timedelta object
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
loffset : string / DateOffset / timedelta object
loffset : string, DateOffset, or timedelta


Returns
-------
A specification for a groupby instruction

Note
Copy link
Member

Choose a reason for hiding this comment

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

What does this have to do with the PR04 error? Changes should really be limited to one thing at a time

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Line

additional kwargs to control time-like groupers (when freq is passed)

was treated as parameter, so I had to move it somewhere else.

Copy link
Member

Choose a reason for hiding this comment

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

Kwargs is a parameter so it belongs there

Copy link
Member

Choose a reason for hiding this comment

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

Get rid of this section and just document kwargs as a parameter like everywhere else

-------
Kwargs to control time-like groupers:
closed, label, convetion, base and loffset
are taken into account when `freq` parameter is passed

Examples
--------

Expand Down
4 changes: 2 additions & 2 deletions pandas/core/panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
axes_single_arg="{0, 1, 2, 'items', 'major_axis', 'minor_axis'}",
optional_mapper='', optional_axis='', optional_labels='')
_shared_doc_kwargs['args_transpose'] = (
"three positional arguments: each one of\n{ax_single}".format(
"{ax_single}\n\tthree positional arguments from given options".format(
Copy link
Member

Choose a reason for hiding this comment

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

How does this actually render? This doesn't appear to have a type so does this actually fix PR04?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, it does fix PR04 error.

Copy link
Member

Choose a reason for hiding this comment

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

Hmm OK - somewhat surprised by that since I don't know what the type is. Keep in mind that Panel is deprecated so any changes to this module will probably be stripped out in next release anyway. So don't put too much more effort into these if you don't have to

ax_single=_shared_doc_kwargs['axes_single_arg']))


Expand Down Expand Up @@ -1008,7 +1008,7 @@ def apply(self, func, axis='major', **kwargs):
DataFrames of items & major axis will be passed
axis : {'items', 'minor', 'major'}, or {0, 1, 2}, or a tuple with two
axes
Additional keyword arguments will be passed as keywords to the function
kwargs : Additional keyword arguments will be passed to the function
Copy link
Member

Choose a reason for hiding this comment

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

See above comment on kwargs


Returns
-------
Expand Down
2 changes: 1 addition & 1 deletion pandas/core/resample.py
Original file line number Diff line number Diff line change
Expand Up @@ -795,7 +795,7 @@ def std(self, ddof=1, *args, **kwargs):
Parameters
----------
ddof : integer, default 1
degrees of freedom
degrees of freedom
Copy link
Member

Choose a reason for hiding this comment

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

Make sure the start of the description is always capitalized and ends with a period; otherwise you would be creating a new issue

"""
nv.validate_resampler_func('std', args, kwargs)
return self._downsample('std', ddof=ddof)
Expand Down
7 changes: 4 additions & 3 deletions pandas/io/formats/style.py
Original file line number Diff line number Diff line change
Expand Up @@ -424,9 +424,10 @@ def render(self, **kwargs):

Parameters
----------
`**kwargs` : Any additional keyword arguments are passed through
to ``self.template.render``. This is useful when you need to provide
additional variables for a custom template.
kwargs : Any additional keyword arguments
Copy link
Member

Choose a reason for hiding this comment

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

Same on kwargs

keywords are passed throught o ``self.template.render``.
This is useful when you need to provide
additional variables for a custom template.

.. versionadded:: 0.20

Expand Down
2 changes: 1 addition & 1 deletion pandas/io/parquet.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ def read_parquet(path, engine='auto', columns=None, **kwargs):
``io.parquet.engine`` is used. The default ``io.parquet.engine``
behavior is to try 'pyarrow', falling back to 'fastparquet' if
'pyarrow' is unavailable.
kwargs are passed to the engine
kwargs : Any additional kwargs are passed to the engine
Copy link
Member

Choose a reason for hiding this comment

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

Same on kwargs


Returns
-------
Expand Down
2 changes: 1 addition & 1 deletion scripts/validate_docstrings.py
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,7 @@ def validate_pep8(self):
application = flake8.main.application.Application()
application.initialize(["--quiet"])

with tempfile.NamedTemporaryFile(mode='w') as file:
with tempfile.NamedTemporaryFile(mode='w', encoding="utf-8") as file:
Copy link
Member

Choose a reason for hiding this comment

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

Why are you changing this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Without strict encoding I had a problem with creating validation_errors json.

Copy link
Member

Choose a reason for hiding this comment

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

This shouldn't be required here so please remove. If you are having some sort of issue without this please open as a separate issue

file.write(content)
file.flush()
application.run_checks([file.name])
Expand Down