-
-
Notifications
You must be signed in to change notification settings - Fork 18.2k
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
DOC: Fixed PR06 docstrings errors in pandas.timedelta_range #28719
DOC: Fixed PR06 docstrings errors in pandas.timedelta_range #28719
Conversation
LGTM |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @LauraCollard for the PR.
pandas/core/indexes/timedeltas.py
Outdated
@@ -709,25 +711,30 @@ def _is_convertible_to_index(other): | |||
|
|||
|
|||
def timedelta_range( | |||
start=None, end=None, periods=None, freq=None, name=None, closed=None | |||
): | |||
start: Optional[str] = None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
from the docstring this str or timedelta-like.
I would only add types for the pure str, boolean or int types here and do the more complex typing in a separate PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The issue is that, when I use pure str and int types, mypy fails with this error:
pandas/core/indexes/timedeltas.py:711: error: Incompatible default for argument "start" (default has type "None", argument has type "str")
pandas/core/indexes/timedeltas.py:711: error: Incompatible default for argument "end" (default has type "None", argument has type "str")
pandas/core/indexes/timedeltas.py:711: error: Incompatible default for argument "periods" (default has type "None", argument has type "int")
pandas/core/indexes/timedeltas.py:711: error: Incompatible default for argument "freq" (default has type "None", argument has type "str")
pandas/core/indexes/timedeltas.py:711: error: Incompatible default for argument "name" (default has type "None", argument has type "str")
pandas/core/indexes/timedeltas.py:711: error: Incompatible default for argument "closed" (default has type "None", argument has type "str")
which is why I've removed typing in my last commit. Thus, this PR only deals with the PR06 docs errors.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thus, this PR only deals with the PR06 docs errors.
no problem. lets keep typing separate for now.
Thanks @LauraCollard ! |
* master: (22 commits) DOC: fix PR09,PR08 errors for pandas.Timestamp (pandas-dev#28739) WEB: Add diversity note to team.md (pandas-dev#28630) DOC: Minor fixes in pandas/testing.py docstring. (pandas-dev#28752) TST: port maybe_promote tests from pandas-dev#23982 (pandas-dev#28764) Bugfix/groupby datetime issue (pandas-dev#28569) reenable codecov (pandas-dev#28750) CLN: Centralised _check_percentile (pandas-dev#27584) DEPR: Deprecate Index.set_value (pandas-dev#28621) CLN: Fix typo in contributing.rst (pandas-dev#28761) Fixed docstring errors in pandas.period range and pandas.PeriodIndex (pandas-dev#28756) BUG: Fix TypeError raised in libreduction (pandas-dev#28643) DOC: Pandas.Series.drop docstring PR02 (pandas-dev#27976) (pandas-dev#28742) DOC: Fixed doctring errors PR08, PR09 in pandas.io (pandas-dev#28748) TST: Fix broken test cases where Timedelta/Timestamp raise (pandas-dev#28729) REF: Consolidate alignment calls in DataFrame ops (pandas-dev#28638) BUG: Fix dep generation (pandas-dev#28734) Added doctstring to fixture (pandas-dev#28727) DOC: Fixed PR06 docstrings errors in pandas.timedelta_range (pandas-dev#28719) replaced safe_import with a corresponding test decorator (pandas-dev#28731) BUG: Fix RangeIndex.get_indexer for decreasing RangeIndex (pandas-dev#28680) ...
black pandas
git diff upstream/master -u -- "*.py" | flake8 --diff