-
-
Notifications
You must be signed in to change notification settings - Fork 16
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
Add type hints to better understand source #91
Comments
I think, the README file describes which kinds of data structures you can pass to the between function.
I did not use type-hints, yet.
The motivation behind this is to be able to pass hard-coded arguments fast without needing to put them though a datetime.date or datetime.datetime on the user side.
|
Ah, now I see. I would not do that, but as long as date and datetime works, thats fine for me. |
I just want to note, that if you input an end date as if type(before) is date:
before = datetime.combine(before, datetime.max.time())
if type(after) is date:
after = datetime.combine(after, datetime.min.time()) |
yes, the end date is excluded. That should be documented this way if I remember correctly. |
It seems that combine is not present.
|
Thanks! I could have thought about that :,) |
I personally would:
|
And I have to correct myself: if type(start) is date:
start = datetime.combine(start, datetime.min.time())
if type(end) is date:
end = datetime.combine(end + timedelta(days=1), datetime.min.time()) Is better |
Hm. I just saw this example concerning py.typed: https://github-redirect.dependabot.com/certifi/python-certifi/issues/196 That reminded me of this issue. |
If someone likes to add type hints, this is welcome. I will support that but not do it myself at the moment. |
Why? It is so much easier to understand your own code. At least for newer code this should be done. You can also then do typechecks using pylance in vscode. |
I do it in my free time, I do not get paid and I do not see the value. Other people see value, have time. I am more in survival mode at the moment. When a basic income is secured I can gift my time. Yes, it might take me less time and it would be efficient if I did it and I would learn but under the circumstances, I choose to work on other issues.
|
I currently try to find out if the
between()
function can take adate
and/ordatetime
object. I think it can parse both (as that's what I remember I've tested), but I am not sure. Also I do not understand the source with that tuple and int instance checking, thats confusing to me.Could you please clarify what the accepted inputs of
between()
are and maybe add this as a typehint?We're using [Polar.sh](https://polar.sh/niccokunzmann) so you can upvote and help fund this issue. We receive the funding once the issue is completed & confirmed by you. Thank you in advance for helping prioritize & fund our work.
The text was updated successfully, but these errors were encountered: