From ad2ce114976c7d9e896a7538170bab8d112a5301 Mon Sep 17 00:00:00 2001 From: Michael Heyns Date: Thu, 30 Jan 2020 13:51:13 +1300 Subject: [PATCH] Support for PathLike objects in Jinja2 2.11.0 (#3683) --- third_party/2and3/jinja2/loaders.pyi | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/third_party/2and3/jinja2/loaders.pyi b/third_party/2and3/jinja2/loaders.pyi index 95a8e3e9f..4aa8993e8 100644 --- a/third_party/2and3/jinja2/loaders.pyi +++ b/third_party/2and3/jinja2/loaders.pyi @@ -1,8 +1,16 @@ +import sys + from typing import Any, Callable, Iterable, List, Optional, Text, Tuple, Union from types import ModuleType from .environment import Environment +if sys.version_info >= (3, 7): + from os import PathLike + _SearchPath = Union[Text, PathLike[str], Iterable[Union[Text, PathLike[str]]]] +else: + _SearchPath = Union[Text, Iterable[Text]] + def split_template_path(template: Text) -> List[Text]: ... class BaseLoader: @@ -15,7 +23,7 @@ class FileSystemLoader(BaseLoader): searchpath: Text encoding: Any followlinks: Any - def __init__(self, searchpath: Union[Text, Iterable[Text]], encoding: Text = ..., followlinks: bool = ...) -> None: ... + def __init__(self, searchpath: _SearchPath, encoding: Text = ..., followlinks: bool = ...) -> None: ... def get_source(self, environment: Environment, template: Text) -> Tuple[Text, Text, Callable[..., Any]]: ... def list_templates(self): ...