pantable.util module

exception pantable.util.EmptyTableError[source]

Bases: Exception

pantable.util.convert_texts(texts: Iterable, input_format: str = 'markdown', output_format: str = 'panflute', standalone: bool = False, extra_args: Optional[List[str]] = None) List[list][source]

run convert_text on list of text

pantable.util.convert_texts_fast(texts: Iterable, input_format: str = 'markdown', output_format: str = 'panflute', extra_args: Optional[List[str]] = None) List[list][source]

a faster, specialized convert_texts

should have identical result from convert_texts

pantable.util.eq_panflute_elem(elem1: Element, elem2: Element) bool[source]
pantable.util.eq_panflute_elems(elems1: List[Element], elems2: List[Element]) bool[source]
pantable.util.get_types(cls: Any) Dict[str, tuple][source]

returns all type hints in a Union

c.f. https://stackoverflow.com/a/50622643

pantable.util.get_yaml_dumper()[source]
pantable.util.iter_convert_texts_markdown_to_panflute(texts: Iterable[str], extra_args: Optional[List[str]] = None) Iterator[ListContainer][source]

a faster, specialized convert_texts

pantable.util.iter_convert_texts_panflute_to_markdown(elems: Iterable[ListContainer], extra_args: Optional[List[str]] = None, seperator: str = 'BYIAWKGSJNLVLSXMXSEAYGZVTAQQJDNJUBEHCCUEGHQGLFCWBTHZASHFKPPYOLGFXPGZGXGNOXATNCZBKXDPWFWXDOAUCZKPKIMABEPGNPDKFRGRSPWZLHZTWRYOZDVRBAINKPWYNCRJZKIFSGLSGMESZPYGQLLPYAVBZAFHIILNYSEFVLNEJUYMXYLAGBJDGPEVPNTDOXUYINOMATGGTXAKQHGWTQOIDCQBGCOGIOVOXFMSEJMJJDUSTPODQFHO') Iterator[str][source]

a faster, specialized convert_texts

Parameters
  • elems (list) – must be list of ListContainer of Block. This is more restrictive than convert_texts which can also accept list of Block

  • seperator (str) – a string for seperator in the temporary markdown output

pantable.util.parse_markdown_codeblock(text: str) dict[source]

parse markdown CodeBlock just as panflute.yaml_filter would

useful for development to obtain the objects that the filter would see after passed to panflute.yaml_filter

Parameters

text (str) – must be a single codeblock of class table in markdown