arrow-py / arrow

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

Fix type signature of Arrow.__getattr__ #1171

Open salty-horse opened 4 months ago

salty-horse commented 4 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.