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

utils.timesince.timesince should accept an optional integer depth #895

Closed
andylolz opened this issue Mar 28, 2022 · 1 comment · Fixed by #909
Closed

utils.timesince.timesince should accept an optional integer depth #895

andylolz opened this issue Mar 28, 2022 · 1 comment · Fixed by #909
Labels
bug Something isn't working

Comments

@andylolz
Copy link

andylolz commented Mar 28, 2022

Bug report

What's wrong

My code looks like this:

from django.utils.timesince import timesince

timesince(d, now, depth=1)

When I run mypy, I see the following error:

error: Unexpected keyword argument "depth" for "timesince"
env/lib/python3.10/site-packages/django-stubs/utils/timesince.pyi:7: note: "timesince" defined here

It looks like the depth argument was added at django 3.2: django/django@8fa9a6d

The django-stubs definition doesn’t include the depth argument:

def timesince(
d: date, now: Optional[date] = ..., reversed: bool = ..., time_strings: Optional[Dict[str, str]] = ...
) -> str: ...

How it should be

I guess the timesince definition should look like this:

def timesince( 
     d: date, now: Optional[date] = ..., reversed: bool = ..., time_strings: Optional[Dict[str, str]] = ..., depth: Optional[int] = ...
 ) -> str: ...

The same issue applies to utils.timesince.timeuntil.

System information

  • python version: 3.10
  • django version: 3.2
  • mypy version: 0.941
  • django-stubs version: 1.10.0
@andylolz andylolz added the bug Something isn't working label Mar 28, 2022
@sterliakov sterliakov mentioned this issue Apr 3, 2022
@andylolz
Copy link
Author

andylolz commented Apr 3, 2022

🙏🏻 thanks both!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

Successfully merging a pull request may close this issue.

1 participant