schema_salad.sourceline

Module Contents

Classes

SourceLine

Functions

relname(source)

add_lc_filename(r, source)

reflow_all(text[, maxline])

reflow(text, maxline[, shift])

indent(v[, nolead, shift, bullet])

bullets(textlist, bul)

strip_duplicated_lineno(text)

Strip duplicated line numbers.

strip_dup_lineno(text[, maxline])

cmap(d[, lc, fn])

Attributes

lineno_re

schema_salad.sourceline.lineno_re
schema_salad.sourceline.relname(source)
Parameters:

source (str) –

Return type:

str

schema_salad.sourceline.add_lc_filename(r, source)
Parameters:
  • r (ruamel.yaml.comments.CommentedBase) –

  • source (str) –

Return type:

None

schema_salad.sourceline.reflow_all(text, maxline=None)
Parameters:
  • text (str) –

  • maxline (Optional[int]) –

Return type:

str

schema_salad.sourceline.reflow(text, maxline, shift='')
Parameters:
  • text (str) –

  • maxline (int) –

  • shift (Optional[str]) –

Return type:

str

schema_salad.sourceline.indent(v, nolead=False, shift='  ', bullet='  ')
Parameters:
Return type:

str

schema_salad.sourceline.bullets(textlist, bul)
Parameters:
  • textlist (List[str]) –

  • bul (str) –

Return type:

str

schema_salad.sourceline.strip_duplicated_lineno(text)

Strip duplicated line numbers.

Same as strip_dup_lineno() but without reflow.

Parameters:

text (str) –

Return type:

str

schema_salad.sourceline.strip_dup_lineno(text, maxline=None)
Parameters:
  • text (str) –

  • maxline (Optional[int]) –

Return type:

str

schema_salad.sourceline.cmap(d, lc=None, fn=None)
Parameters:
  • d (Union[int, float, str, MutableMapping[str, Any], MutableSequence[Any], None]) –

  • lc (Optional[List[int]]) –

  • fn (Optional[str]) –

Return type:

Union[int, float, str, ruamel.yaml.comments.CommentedMap, ruamel.yaml.comments.CommentedSeq, None]

class schema_salad.sourceline.SourceLine(item, key=None, raise_type=str, include_traceback=False)
Parameters:
  • item (Any) –

  • key (Optional[Any]) –

  • raise_type (Callable[[str], Any]) –

  • include_traceback (bool) –

__enter__()
Return type:

SourceLine

__exit__(exc_type, exc_value, tb)
Parameters:
  • exc_type (Any) –

  • exc_value (Any) –

  • tb (Any) –

Return type:

None

file()
Return type:

Optional[str]

start()
Return type:

Optional[Tuple[int, int]]

end()
Return type:

Optional[Tuple[int, int]]

makeLead()
Return type:

str

makeError(msg)
Parameters:

msg (str) –

Return type:

Any