pidgy.util

Module Contents

class pidgy.util.ContextDepth[source]

Count the current depth of a context manager invocation.

depth = 0
__enter__(self)[source]
__exit__(self, *e)[source]
pidgy.util.html_comment(text)[source]
pidgy.util.istype(object, cls)[source]
pidgy.util.WHITESPACE
pidgy.util.indents(str: str) → int[source]
pidgy.util.num_first_indent(text: str) → int[source]

The number of indents for the first blank line.

pidgy.util.num_last_indent(text: str) → int[source]

The number of indents for the last blank line.

pidgy.util.base_indent(tokens: typing.List[dict]) → int[source]

Peek into mistune tokens and find the last code indent.

pidgy.util.quote(text: str) → str[source]

Wrap strings in triple quoted block strings.

pidgy.util.whiten(text: str) → str[source]

whiten strips empty lines because the markdown.BlockLexer doesn’t like that.

pidgy.util.strip_front_matter(text: str, sep=None) → str[source]

Remove yaml front matter froma string.

pidgy.util.ansify(str: str, format='md')[source]

High source to be printed in the terms.

pidgy.util.yield_files(files: typing.Sequence[str], recursive=False) → typing.Generator[source]

Return a list of files from a collection of files and globs.

pidgy.util.argv(*args: str)[source]
pidgy.util.strip_shebang(str)[source]
pidgy.util.strip_html_comment(str)[source]
pidgy.util.strip_front_matter(text: str, sep=None) → str[source]

Remove yaml front matter froma string.

pidgy.util.sys_path()[source]