From 5bc3759ea2b86540a6cf37efdd3ad0a46be865c2 Mon Sep 17 00:00:00 2001 From: William Schwartz Date: Tue, 29 Sep 2020 17:21:38 -0500 Subject: [PATCH] Template Loader.get_template_sources yield Origins (#476) django.template.loaders.base.Loader.get_template_sources should yield Origins: https://docs.djangoproject.com/en/3.1/ref/templates/api/#django.template.loaders.base.Loader.get_template_sources Currently it's returning none. Objects that yield should be marked as iterables. https://mypy.readthedocs.io/en/stable/kinds_of_types.html#generators --- django-stubs/template/loaders/base.pyi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/django-stubs/template/loaders/base.pyi b/django-stubs/template/loaders/base.pyi index 817b456..034769a 100644 --- a/django-stubs/template/loaders/base.pyi +++ b/django-stubs/template/loaders/base.pyi @@ -1,4 +1,4 @@ -from typing import Any, List, Optional, Dict +from typing import Any, List, Iterable, Optional, Dict from django.template.base import Origin, Template from django.template.engine import Engine @@ -8,5 +8,5 @@ class Loader: get_template_cache: Dict[str, Any] = ... def __init__(self, engine: Engine) -> None: ... def get_template(self, template_name: str, skip: Optional[List[Origin]] = ...) -> Template: ... - def get_template_sources(self, template_name: str) -> None: ... + def get_template_sources(self, template_name: str) -> Iterable[Origin]: ... def reset(self) -> None: ...