Skip to content

CLN:Added annotations to functions #29821

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 1 commit into from
Nov 25, 2019
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion pandas/_libs/tslibs/period.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -2201,7 +2201,7 @@ cdef class _Period:
return self.days_in_month

@property
def is_leap_year(self):
def is_leap_year(self) -> bool:
return bool(is_leapyear(self.year))

@classmethod
Expand Down
36 changes: 18 additions & 18 deletions pandas/_libs/tslibs/timestamps.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -89,23 +89,23 @@ class RoundTo:
https://en.wikipedia.org/wiki/Rounding#Round_half_to_even
"""
@property
def MINUS_INFTY(self):
def MINUS_INFTY(self) -> int:
return 0

@property
def PLUS_INFTY(self):
def PLUS_INFTY(self) -> int:
return 1

@property
def NEAREST_HALF_EVEN(self):
def NEAREST_HALF_EVEN(self) -> int:
return 2

@property
def NEAREST_HALF_PLUS_INFTY(self):
def NEAREST_HALF_PLUS_INFTY(self) -> int:
return 3

@property
def NEAREST_HALF_MINUS_INFTY(self):
def NEAREST_HALF_MINUS_INFTY(self) -> int:
return 4


Expand Down Expand Up @@ -604,7 +604,7 @@ timedelta}, default 'raise'
"""
return self.weekday()

def day_name(self, locale=None):
def day_name(self, locale=None) -> str:
"""
Return the day name of the Timestamp with specified locale.

Expand All @@ -621,7 +621,7 @@ timedelta}, default 'raise'
"""
return self._get_date_name_field('day_name', locale)

def month_name(self, locale=None):
def month_name(self, locale=None) -> str:
"""
Return the month name of the Timestamp with specified locale.

Expand All @@ -639,7 +639,7 @@ timedelta}, default 'raise'
return self._get_date_name_field('month_name', locale)

@property
def weekday_name(self):
def weekday_name(self) -> str:
"""
.. deprecated:: 0.23.0
Use ``Timestamp.day_name()`` instead
Expand All @@ -657,7 +657,7 @@ timedelta}, default 'raise'
return ccalendar.get_day_of_year(self.year, self.month, self.day)

@property
def week(self):
def week(self) -> int:
"""
Return the week number of the year.
"""
Expand All @@ -666,7 +666,7 @@ timedelta}, default 'raise'
weekofyear = week

@property
def quarter(self):
def quarter(self) -> int:
"""
Return the quarter of the year.
"""
Expand All @@ -689,7 +689,7 @@ timedelta}, default 'raise'
return getattr(self.freq, 'freqstr', self.freq)

@property
def is_month_start(self):
def is_month_start(self) -> bool:
"""
Return True if date is first day of month.
"""
Expand All @@ -699,7 +699,7 @@ timedelta}, default 'raise'
return self._get_start_end_field('is_month_start')

@property
def is_month_end(self):
def is_month_end(self) -> bool:
"""
Return True if date is last day of month.
"""
Expand All @@ -709,7 +709,7 @@ timedelta}, default 'raise'
return self._get_start_end_field('is_month_end')

@property
def is_quarter_start(self):
def is_quarter_start(self) -> bool:
"""
Return True if date is first day of the quarter.
"""
Expand All @@ -719,7 +719,7 @@ timedelta}, default 'raise'
return self._get_start_end_field('is_quarter_start')

@property
def is_quarter_end(self):
def is_quarter_end(self) -> bool:
"""
Return True if date is last day of the quarter.
"""
Expand All @@ -729,7 +729,7 @@ timedelta}, default 'raise'
return self._get_start_end_field('is_quarter_end')

@property
def is_year_start(self):
def is_year_start(self) -> bool:
"""
Return True if date is first day of the year.
"""
Expand All @@ -739,7 +739,7 @@ timedelta}, default 'raise'
return self._get_start_end_field('is_year_start')

@property
def is_year_end(self):
def is_year_end(self) -> bool:
"""
Return True if date is last day of the year.
"""
Expand All @@ -749,7 +749,7 @@ timedelta}, default 'raise'
return self._get_start_end_field('is_year_end')

@property
def is_leap_year(self):
def is_leap_year(self) -> bool:
"""
Return True if year is a leap year.
"""
Expand Down Expand Up @@ -1009,7 +1009,7 @@ default 'raise'

return base1 + base2

def _has_time_component(self):
def _has_time_component(self) -> bool:
"""
Returns if the Timestamp has a time component
in addition to the date part
Expand Down