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

Conversation

salty-horse
Copy link

Pull Request Checklist

  • 🧪 Added tests for changed code.
  • 🛠️ All tests pass when run locally (run tox or make test to find out!).
  • 🧹 All linting checks pass when run locally (run tox -e lint or make lint to find out!).
  • 📚 Updated documentation for changed code.
  • ⏩ Code is up-to-date with the master branch.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant