arrow-py / arrow

๐Ÿน Better dates & times for Python
https://arrow.readthedocs.io
Apache License 2.0
8.73k stars 684 forks source link

Fix type signature of Arrow.__getattr__ #1171

Closed salty-horse closed 1 month ago

salty-horse commented 9 months ago

Pull Request Checklist

Description of Changes

Arrow's __getattr__ provides access to datetime attributes that aren't handled by Arrow. It has this signature:

def __getattr__(self, name: str) -> int

It should return Any, as not all attributes from datetime are ints.

For example, in arrow.now().tzname(), tzname is a function.

I noticed that __getattr__ implements two undocumented attributes: week and quarter. The should be split into their own methods, with a docstring.