From 08a662ecb10714310722bdd5382fff88066a71ef Mon Sep 17 00:00:00 2001 From: Richard Xia Date: Thu, 29 Jul 2021 02:35:28 -0700 Subject: [PATCH] Change PasswordResetForm.get_users() to return Iterable, not Iterator. (#678) This matches the actual implementation in Django, where it only attempts to use the result of get_users() in a for loop, which allows for any Iterable, and it provides a more flexible and idiomatic API for users who subclass PasswordResetForm. --- django-stubs/contrib/auth/forms.pyi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/django-stubs/contrib/auth/forms.pyi b/django-stubs/contrib/auth/forms.pyi index 96b4dac..36d43af 100644 --- a/django-stubs/contrib/auth/forms.pyi +++ b/django-stubs/contrib/auth/forms.pyi @@ -1,4 +1,4 @@ -from typing import Any, Dict, Iterator, Optional +from typing import Any, Dict, Iterable, Optional from django import forms from django.contrib.auth.base_user import AbstractBaseUser @@ -53,7 +53,7 @@ class PasswordResetForm(forms.Form): to_email: str, html_email_template_name: Optional[str] = ..., ) -> None: ... - def get_users(self, email: str) -> Iterator[Any]: ... + def get_users(self, email: str) -> Iterable[Any]: ... def save( self, domain_override: Optional[str] = ...,