From e35410389dfe37993c3d68902f85c53512e84187 Mon Sep 17 00:00:00 2001 From: phil65 Date: Sat, 21 Oct 2023 16:10:20 +0200 Subject: [PATCH] chore: docs --- mknodes/jinja/jinjaloaderfilesystem.py | 4 ++-- mknodes/jinja/loaders.py | 10 ++++++++++ mknodes/templatenodes/mkargparsehelp/__init__.py | 2 ++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/mknodes/jinja/jinjaloaderfilesystem.py b/mknodes/jinja/jinjaloaderfilesystem.py index 67e61417..aebdfd8d 100644 --- a/mknodes/jinja/jinjaloaderfilesystem.py +++ b/mknodes/jinja/jinjaloaderfilesystem.py @@ -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" diff --git a/mknodes/jinja/loaders.py b/mknodes/jinja/loaders.py index 461040ac..00502e55 100644 --- a/mknodes/jinja/loaders.py +++ b/mknodes/jinja/loaders.py @@ -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): @@ -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, @@ -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) @@ -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) diff --git a/mknodes/templatenodes/mkargparsehelp/__init__.py b/mknodes/templatenodes/mkargparsehelp/__init__.py index 385cf1fc..49c60c79 100644 --- a/mknodes/templatenodes/mkargparsehelp/__init__.py +++ b/mknodes/templatenodes/mkargparsehelp/__init__.py @@ -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),