Skip to content

Commit

Permalink
chore: docs
Browse files Browse the repository at this point in the history
  • Loading branch information
phil65 committed Oct 21, 2023
1 parent d9d67ed commit e354103
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
4 changes: 2 additions & 2 deletions mknodes/jinja/jinjaloaderfilesystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@


class JinjaLoaderFileSystem(fsspec.AbstractFileSystem):
"""A FsSpec Filesystem implementation for jinja environment templates.
"""A **FsSpec** Filesystem implementation for jinja environment templates.
This virtual file system allows to browse and access all available templates of an
environment by utilizing loader.list_templates and loader.get_source.
environment by utilizing `BaseLoader.list_templates` and `BaseLoader.get_source`.
"""

protocol = "jinja"
Expand Down
10 changes: 10 additions & 0 deletions mknodes/jinja/loaders.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@


class LoaderMixin:
"""Loader mixin which allows to OR loaders into a choice loader."""

loader: jinja2.BaseLoader

def __or__(self, other: jinja2.BaseLoader):
Expand All @@ -26,6 +28,8 @@ def __or__(self, other: jinja2.BaseLoader):


class PackageLoader(LoaderMixin, jinja2.PackageLoader):
"""A loader for loading templates from a package."""

def __init__(
self,
package: str | types.ModuleType,
Expand All @@ -49,6 +53,8 @@ def __repr__(self):


class FileSystemLoader(LoaderMixin, jinja2.FileSystemLoader):
"""A loader to load templates from the file system."""

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

Expand All @@ -61,11 +67,15 @@ def __add__(self, other):


class ChoiceLoader(LoaderMixin, jinja2.ChoiceLoader):
"""A loader which combines multiple other loaders."""

def __repr__(self):
return reprhelpers.get_repr(self, loaders=self.loaders, _shorten=False)


class DictLoader(LoaderMixin, jinja2.DictLoader):
"""A loader to load static content from a path->template-str mapping."""

def __repr__(self):
return reprhelpers.get_repr(self, mapping=self.mapping)

Expand Down
2 changes: 2 additions & 0 deletions mknodes/templatenodes/mkargparsehelp/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ def __repr__(self):

@property
def items(self):
# ArgumentParser.format_usage()
# ArgumentParser.format_help()
items = [
mkheader.MkHeader(self.parser.prog),
mktext.MkText(self.parser.description),
Expand Down

0 comments on commit e354103

Please sign in to comment.