Skip to content

Commit b366ce8

Browse files
ShaharNavehjbrockmendel
authored andcommitted
Added annotations to functions (#29821)
1 parent 7d7f885 commit b366ce8

File tree

2 files changed

+19
-19
lines changed

2 files changed

+19
-19
lines changed

pandas/_libs/tslibs/period.pyx

+1-1
Original file line numberDiff line numberDiff line change
@@ -2201,7 +2201,7 @@ cdef class _Period:
22012201
return self.days_in_month
22022202

22032203
@property
2204-
def is_leap_year(self):
2204+
def is_leap_year(self) -> bool:
22052205
return bool(is_leapyear(self.year))
22062206

22072207
@classmethod

pandas/_libs/tslibs/timestamps.pyx

+18-18
Original file line numberDiff line numberDiff line change
@@ -89,23 +89,23 @@ class RoundTo:
8989
https://en.wikipedia.org/wiki/Rounding#Round_half_to_even
9090
"""
9191
@property
92-
def MINUS_INFTY(self):
92+
def MINUS_INFTY(self) -> int:
9393
return 0
9494

9595
@property
96-
def PLUS_INFTY(self):
96+
def PLUS_INFTY(self) -> int:
9797
return 1
9898

9999
@property
100-
def NEAREST_HALF_EVEN(self):
100+
def NEAREST_HALF_EVEN(self) -> int:
101101
return 2
102102

103103
@property
104-
def NEAREST_HALF_PLUS_INFTY(self):
104+
def NEAREST_HALF_PLUS_INFTY(self) -> int:
105105
return 3
106106

107107
@property
108-
def NEAREST_HALF_MINUS_INFTY(self):
108+
def NEAREST_HALF_MINUS_INFTY(self) -> int:
109109
return 4
110110

111111

@@ -604,7 +604,7 @@ timedelta}, default 'raise'
604604
"""
605605
return self.weekday()
606606

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

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

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

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

641641
@property
642-
def weekday_name(self):
642+
def weekday_name(self) -> str:
643643
"""
644644
.. deprecated:: 0.23.0
645645
Use ``Timestamp.day_name()`` instead
@@ -657,7 +657,7 @@ timedelta}, default 'raise'
657657
return ccalendar.get_day_of_year(self.year, self.month, self.day)
658658

659659
@property
660-
def week(self):
660+
def week(self) -> int:
661661
"""
662662
Return the week number of the year.
663663
"""
@@ -666,7 +666,7 @@ timedelta}, default 'raise'
666666
weekofyear = week
667667

668668
@property
669-
def quarter(self):
669+
def quarter(self) -> int:
670670
"""
671671
Return the quarter of the year.
672672
"""
@@ -689,7 +689,7 @@ timedelta}, default 'raise'
689689
return getattr(self.freq, 'freqstr', self.freq)
690690

691691
@property
692-
def is_month_start(self):
692+
def is_month_start(self) -> bool:
693693
"""
694694
Return True if date is first day of month.
695695
"""
@@ -699,7 +699,7 @@ timedelta}, default 'raise'
699699
return self._get_start_end_field('is_month_start')
700700

701701
@property
702-
def is_month_end(self):
702+
def is_month_end(self) -> bool:
703703
"""
704704
Return True if date is last day of month.
705705
"""
@@ -709,7 +709,7 @@ timedelta}, default 'raise'
709709
return self._get_start_end_field('is_month_end')
710710

711711
@property
712-
def is_quarter_start(self):
712+
def is_quarter_start(self) -> bool:
713713
"""
714714
Return True if date is first day of the quarter.
715715
"""
@@ -719,7 +719,7 @@ timedelta}, default 'raise'
719719
return self._get_start_end_field('is_quarter_start')
720720

721721
@property
722-
def is_quarter_end(self):
722+
def is_quarter_end(self) -> bool:
723723
"""
724724
Return True if date is last day of the quarter.
725725
"""
@@ -729,7 +729,7 @@ timedelta}, default 'raise'
729729
return self._get_start_end_field('is_quarter_end')
730730

731731
@property
732-
def is_year_start(self):
732+
def is_year_start(self) -> bool:
733733
"""
734734
Return True if date is first day of the year.
735735
"""
@@ -739,7 +739,7 @@ timedelta}, default 'raise'
739739
return self._get_start_end_field('is_year_start')
740740

741741
@property
742-
def is_year_end(self):
742+
def is_year_end(self) -> bool:
743743
"""
744744
Return True if date is last day of the year.
745745
"""
@@ -749,7 +749,7 @@ timedelta}, default 'raise'
749749
return self._get_start_end_field('is_year_end')
750750

751751
@property
752-
def is_leap_year(self):
752+
def is_leap_year(self) -> bool:
753753
"""
754754
Return True if year is a leap year.
755755
"""
@@ -1009,7 +1009,7 @@ default 'raise'
10091009

10101010
return base1 + base2
10111011

1012-
def _has_time_component(self):
1012+
def _has_time_component(self) -> bool:
10131013
"""
10141014
Returns if the Timestamp has a time component
10151015
in addition to the date part

0 commit comments

Comments
 (0)