-
Notifications
You must be signed in to change notification settings - Fork 281
repr(TzInfo(0))
returns invalid python code
#1691
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
Comments
I think it makes sense to add quotes in the repr so I went and created #1701. However, I'm not sure |
From https://docs.python.org/3/library/functions.html#repr:
From https://docs.python.org/3/reference/datamodel.html#object.__repr__:
|
Ah then TIL. I think we can make it so that |
This would also be ok for me. But I think that an hour offset would then be a multiple of 60. |
Hi, I'm the author of inline-snapshot and have a problem with the way
TzInfo.__repr__
is implemented.TzInfo has currently the following repr:
The problem is that inline-snapshot uses by default
repr()
to generate the python code for the snapshots.inline-snapshot users then try to import UTC from somewhere which causes other problems.
Is it possible to change the repr() result of TzInfo to the following (add
""
).And to provide the possibility for TzInfo to be constructed from a string?
This should make
work for all TzInfo objects.
The text was updated successfully, but these errors were encountered: