schema_salad.sourceline

Attributes

lineno_re

Classes

SourceLine

Functions

relname(source)

add_lc_filename(r, source)

reflow_all(text[, maxline])

Reflow text respecting a common prefix with line & col info.

reflow(text, maxline[, shift])

Reflow a single line of text.

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

bullets(textlist, bul)

Indent using the specified number of bullets.

strip_duplicated_lineno(text)

Strip duplicated line numbers.

strip_dup_lineno(text[, maxline])

Strip duplicated line numbers.

cmap(d[, lc, fn])

Apply line+column & filename data through to the provided data.

Module Contents

schema_salad.sourceline.lineno_re: Final
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)

Reflow text respecting a common prefix with line & col info.

Parameters:
  • text (str)

  • maxline (int | None)

Return type:

str

schema_salad.sourceline.reflow(text, maxline, shift='')

Reflow a single line of text.

Parameters:
  • text (str)

  • maxline (int)

  • shift (str | None)

Return type:

str

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

str

schema_salad.sourceline.bullets(textlist, bul)

Indent using the specified number of bullets.

Parameters:
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)

Strip duplicated line numbers.

Parameters:
  • text (str)

  • maxline (int | None)

Return type:

str

schema_salad.sourceline.cmap(d, lc=None, fn=None)

Apply line+column & filename data through to the provided data.

Parameters:
Returns:

The (transformed) datastructure.

Return type:

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
key = None
raise_type
include_traceback = False
__enter__()
Return type:

SourceLine

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

  • exc_value (Any)

  • tb (Any)

Return type:

None

file()

Return the embedded filename.

Return type:

str | None

start()

Determine the starting location.

Return type:

tuple[int, int] | None

end()

Empty, for now.

Return type:

tuple[int, int] | None

makeLead()
Return type:

str

makeError(msg)
Parameters:

msg (str)

Return type:

Any