-
-
Notifications
You must be signed in to change notification settings - Fork 66
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
Inconsistencies between documentation/annotations and behavior #28
Comments
...
Let's do option 1, possibly with some tests. Option 2 with deprecation could be sensible too, let's also check what the Django Feedback from others welcome!
...
Yep, let's update those.
...
Yeah, I do find it a little odd to catch things like Maybe we should also check what the Django ones do and consider deprecating and removing in a major bump. Feedback from others also welcome here! |
Released in 4.2.2: |
If I'm not mistaken, this looks like the issue that was fixed in 4.2.2. (And thank you for that!)
This issue, however, seems to still be open as of 4.2.2. If option 1 is still on the table, that would (in my opinion) be ideal! Here's an example of how I'm using Please let me know if I'm misunderstanding something, or if that sounds reasonable! I'm happy to try to put together a PR to add documentation/annotations for |
Ah, correct, it was indeed the
Yes, option 1 is still on the table, PR welcome! Please include a test case passing a |
And the |
The type for seconds should be |
@sodul In which function? And what version of Humanize are you using? |
Most if not all of these should be addressed, please open a new issue if there's something further. Thanks! |
naturaltime()
supportstimedelta
.It is not documented, but
humanize.naturaltime()
acceptstimedelta
. I used it for years until type annotations were added, and MyPy started to complain.timedelta
is still accepted at runtime.I expect one of two things:
humanize.naturaltime()
acceptstimedelta
, not onlydatetime | int
and update type annotation.humanize.naturaltime()
rejectingtimedelta
(of course, after some deprecation period).Option 1 is more compatible, but option 2 looks more logical.
naturaltime()
andnaturaldelta()
accept not onlyint
, butfloat
too.It is expected, since timestamp in Python is
float
, but it should be documented, and annotations should be updated.naturaltime()
,naturaldelta()
,naturaldate()
andnaturalday()
accept arbitrary object without error.It is unsafe, because allows programming errors to slip unnoticed.
humanize.naturalsize()
raises an error, as expected.Humanize 4.2.1
The text was updated successfully, but these errors were encountered: