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

Fix docstring timestamps#59458 #59533

Merged
merged 15 commits into from
Aug 19, 2024

Conversation

uditbaliyan
Copy link
Contributor

@uditbaliyan uditbaliyan commented Aug 17, 2024

Part of #59458

Addresses:
pandas.Timestamp

  • Added missing 'See Also' sections (SA01) for the following methods:

    • combine, ctime, date, fromordinal, fromtimestamp, month_name
    • normalize, quarter, replace, timestamp, timetuple, toordinal
    • today, to_period, to_julian_date
  • Documented missing parameters (PR01, PR07) for the following methods:

    • fromtimestamp: Added descriptions for ts and tz parameters.
    • to_period: Added description for freq parameter.
    • to_numpy: Added descriptions for dtype and copy parameters.
    • replace: Added descriptions for year, month, day, hour, minute, second, microsecond, nanosecond, tzinfo, fold parameters."

Removed

-i "pandas.Timestamp.combine PR01,SA01"
-i "pandas.Timestamp.ctime SA01"
-i "pandas.Timestamp.date SA01"
-i "pandas.Timestamp.fromordinal SA01"
-i "pandas.Timestamp.fromtimestamp PR01,SA01"
-i "pandas.Timestamp.month_name SA01"
-i "pandas.Timestamp.normalize SA01"
-i "pandas.Timestamp.quarter SA01"
-i "pandas.Timestamp.replace PR07,SA01"
-i "pandas.Timestamp.timestamp SA01"
-i "pandas.Timestamp.timetuple SA01"
-i "pandas.Timestamp.toordinal SA01"
-i "pandas.Timestamp.today SA01"
-i "pandas.Timestamp.to_period PR01,SA01"
-i "pandas.Timestamp.to_numpy PR01"
-i "pandas.Timestamp.to_julian_date SA01" \

from code_checks.sh

@uditbaliyan
Copy link
Contributor Author

uditbaliyan commented Aug 17, 2024

pandas/plotting/_matplotlib/core.py:549: error: Unused "type: ignore" comment [unused-ignore]

@final
   def _maybe_right_yaxis(self, ax: Axes, axes_num: int) -> Axes:
       if not self.on_right(axes_num):
           # secondary axes may be passed via ax kw
           return self._get_ax_layer(ax)

       if hasattr(ax, "right_ax"):
           # if it has right_ax property, ``ax`` must be left axes
           return ax.right_ax
       elif hasattr(ax, "left_ax"):
           # if it has left_ax property, ``ax`` must be right axes
           return ax
       else:
           # otherwise, create twin axes
           orig_ax, new_ax = ax, ax.twinx()
           # TODO: use Matplotlib public API when available
           new_ax._get_lines = orig_ax._get_lines  # type: ignore[attr-defined]
           # TODO #54485
           new_ax._get_patches_for_fill = (  # type: ignore[attr-defined]
               orig_ax._get_patches_for_fill  # type: ignore[attr-defined]
           )
           # TODO #54485
           orig_ax.right_ax, new_ax.left_ax = (  # type: ignore[attr-defined]
               new_ax,
               orig_ax,
           )

           if not self._has_plotted_object(orig_ax):  # no data on left y
               orig_ax.get_yaxis().set_visible(False)

           if self.logy is True or self.loglog is True:
               new_ax.set_yscale("log")
           elif self.logy == "sym" or self.loglog == "sym":
               new_ax.set_yscale("symlog")
           return new_ax  # type: ignore[return-value]  <- this Unused "type: ignore" comment  [unused-ignore]

Since mypy doesn't find any issues with the return type, the type: ignore[return-value] is redundant and can be removed.
Should i remove it or not ??

@mroeschke mroeschke added the Docs label Aug 19, 2024
@mroeschke mroeschke added this to the 3.0 milestone Aug 19, 2024
@mroeschke mroeschke merged commit c4467a9 into pandas-dev:main Aug 19, 2024
43 of 51 checks passed
@mroeschke
Copy link
Member

Thanks @uditbaliyan

@uditbaliyan uditbaliyan deleted the fix-docstring-timestamps#59458 branch August 28, 2024 17:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants