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 type signature of Arrow.__getattr__ #1171

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions arrow/arrow.py
Expand Up @@ -802,15 +802,15 @@ def __hash__(self) -> int:

# attributes and properties

def __getattr__(self, name: str) -> int:
def __getattr__(self, name: str) -> Any:
if name == "week":
return self.isocalendar()[1]

if name == "quarter":
return int((self.month - 1) / self._MONTHS_PER_QUARTER) + 1

if not name.startswith("_"):
value: Optional[int] = getattr(self._datetime, name, None)
value: Optional[Any] = getattr(self._datetime, name, None)

if value is not None:
return value
Expand Down Expand Up @@ -1862,7 +1862,7 @@ def _get_iteration_params(cls, end: Any, limit: Optional[int]) -> Tuple[Any, int
@staticmethod
def _is_last_day_of_month(date: "Arrow") -> bool:
"""Returns a boolean indicating whether the datetime is the last day of the month."""
return date.day == calendar.monthrange(date.year, date.month)[1]
return cast(int, date.day) == calendar.monthrange(date.year, date.month)[1]


Arrow.min = Arrow.fromdatetime(dt_datetime.min)
Expand Down