class_docstr: Baseclass for all loaders.  Subclass this and override `get_source` to
  implement a custom loading mechanism.  The environment provides a
  `get_template` method that calls the loader's `load` method to get the
  :class:`Template` object.
  
  A very basic example for a loader that looks up templates on the file
  system could look like this::
  
      from jinja2 import BaseLoader, TemplateNotFound
      from os.path import join, exists, getmtime
  
      class MyLoader(BaseLoader):
  
          def __init__(self, path):
              self.path = path
  
          def get_source(self, environment, template):
              path = join(self.path, template)
              if not exists(path):
                  raise TemplateNotFound(template)
              mtime = getmtime(path)
              with open(path) as f:
                  source = f.read()
              return source, path, lambda: mtime == getmtime(path)
class_docstr_tok: ["Baseclass","for","all","loaders",".","Subclass","this","and","override","`","get_source","`","to","implement","a","custom","loading","mechanism",".","The","environment","provides","a","`","get_template","`","method","that","calls","the","loader","'s","`","load","`","method","to","get","the",":","class",":","`","Template","`","object",".","A","very","basic","example","for","a","loader","that","looks","up","templates","on","the","file","system","could","look","like","this",":",":","from","jinja2","import","BaseLoader",",","TemplateNotFound","from","os.path","import","join",",","exists",",","getmtime","class","MyLoader","(","BaseLoader",")",":","def","__init__","(","self",",","path",")",":","self.path","=","path","def","get_source","(","self",",","environment",",","template",")",":","path","=","join","(","self.path",",","template",")","if","not","exists","(","path",")",":","raise","TemplateNotFound","(","template",")","mtime","=","getmtime","(","path",")","with","open","(","path",")","as","f",":","source","=","f.read","(",")","return","source",",","path",",","lambda",":","mtime","==","getmtime","(","path",")"]
docstr: Iterates over all templates.  If the loader does not support that
  it should raise a :exc:`TypeError` which is the default behavior.
docstr_tok: ["Iterates","over","all","templates",".","If","the","loader","does","not","support","that","it","should","raise","a",":","exc",":","`","TypeError","`","which","is","the","default","behavior","."]
code: def list_templates(self) -> t.List[str]:
      """Iterates over all templates.  If the loader does not support that
      it should raise a :exc:`TypeError` which is the default behavior.
      """
      raise TypeError("this loader cannot iterate over all templates")
  
imports: import importlib.util
  import os
  import posixpath
  import sys
  import pkgutil
  import typing
  import weakref
  import zipimport
  from collections import abc
  from hashlib import sha1
  from importlib import import_module
  from types import ModuleType
  from .exceptions import TemplateNotFound
  from .utils import internalcode
  from .utils import open_if_exists
  import __res
label_desc: Use image node_id 2 for calling the BaseLoader obj's underlying member method code with example usage: obj.list_templates() without return types