Skip to content

FileSystemLoader

Base classes

Name Children Inherits
LoaderMixin
jinjarope.loaders
Loader mixin which allows to OR loaders into a choice loader.
FileSystemLoader
jinja2.loaders
Load templates from a directory in the file system.

⋔ Inheritance diagram

graph TD
  94173637187040["loaders.FileSystemLoader"]
  94173637890544["loaders.LoaderMixin"]
  139866058043616["builtins.object"]
  94173636867136["loaders.FileSystemLoader"]
  94173636407456["loaders.BaseLoader"]
  94173637890544 --> 94173637187040
  139866058043616 --> 94173637890544
  94173636867136 --> 94173637187040
  94173636407456 --> 94173636867136
  139866058043616 --> 94173636407456

🛈 DocStrings

Bases: LoaderMixin, FileSystemLoader

A loader to load templates from the file system.

Source code in src/jinjarope/loaders.py
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
class FileSystemLoader(LoaderMixin, jinja2.FileSystemLoader):
    """A loader to load templates from the file system."""

    ID = "filesystem"

    def __repr__(self):
        return utils.get_repr(self, searchpath=self.searchpath)

    def __add__(self, other) -> FileSystemLoader:
        ls = [other] if isinstance(other, jinja2.FileSystemLoader) else other.serchpath
        return FileSystemLoader([*self.searchpath, *ls])  # pyright: ignore

    def __bool__(self):
        return len(self.searchpath) > 0

    def __eq__(self, other):
        return type(self) is type(other) and self.searchpath == other.searchpath

    def __hash__(self):
        return hash(tuple(self.searchpath))

Show source on GitHub