Include

barescriptModel.bare

barescript_type_model

bare_script.include.barescript_type_model()

Get the BareScript type model

Returns:

The BareScript type model

Return type:

dict

barescript_validate_expression

bare_script.include.barescript_validate_expression(expr)

Validate an expression model

Parameters:

expr (dict) – The expression model

Returns:

The validated expression model

Return type:

dict

Raises:

SchemaValidationError – A validation error occurred

barescript_validate_script

bare_script.include.barescript_validate_script(script)

Validate a BareScript model

Parameters:

script (dict) – The BareScript model

Returns:

The validated BareScript model

Return type:

dict

Raises:

SchemaValidationError – A validation error occurred

data.bare

data_aggregate

bare_script.include.data_aggregate(data, aggregation)

Aggregate a data array

Parameters:
  • data (list(dict)) – The data array

  • aggregation (dict) – The aggregation model

Returns:

The aggregated data array

Return type:

list(dict)

data_calculated_field

bare_script.include.data_calculated_field(data, field_name, expr, variables=None)

Add a calculated field to a data array

Parameters:
  • data (list(dict)) – The data array

  • field_name (str) – The calculated field name

  • expr (str) – The calculated field expression

  • variables (dict or None, optional) – The expression variables object

Returns:

The updated data array

Return type:

list(dict)

data_filter

bare_script.include.data_filter(data, expr, variables=None)

Filter a data array

Parameters:
  • data (list(dict)) – The data array

  • expr (str) – The filter expression

  • variables (dict or None, optional) – The expression variables object

Returns:

The filtered data array

Return type:

list(dict)

data_join

bare_script.include.data_join(left_data, right_data, join_expr, right_expr=None, is_left_join=None, variables=None)

Join two data arrays

Parameters:
  • left_data (list(dict)) – The left data array

  • right_data (list(dict)) – The right data array

  • join_expr (str) – The join expression

  • right_expr (str or None, optional) – The right join expression

  • is_left_join (bool or None, optional) – If True, perform a left join (always include left row)

  • variables (dict or None, optional) – The join expression variables object

Returns:

The joined data array

Return type:

list(dict)

data_parse_csv

bare_script.include.data_parse_csv(text)

Parse CSV text to a data array

Parameters:

text (str or list(str)) – The CSV text or array of CSV text

Returns:

The data array

Return type:

list(dict)

data_sort

bare_script.include.data_sort(data, sorts)

Sort a data array

Parameters:
  • data (list(dict)) – The data array

  • sorts (list(list)) – The array of sort tuples, [field] or [field, descending]

Returns:

The sorted data array

Return type:

list(dict)

data_top

bare_script.include.data_top(data, count=None, category_fields=None)

Keep the top rows for each category

Parameters:
  • data (list(dict)) – The data array

  • count (int or None, optional) – The number of rows to keep (default is 1)

  • category_fields (list(str) or None, optional) – The category fields

Returns:

The top data array

Return type:

list(dict)

data_validate

bare_script.include.data_validate(data, csv=None)

Validate a data array

Parameters:
  • data (list(dict)) – The data array

  • csv (bool or None, optional) – If True, parse value strings

Returns:

The map of field name to field type

Return type:

dict

Raises:

SchemaValidationError – A validation error occurred

dataLineChart.bare

data_line_chart_elements

bare_script.include.data_line_chart_elements(data, line_chart, options=None)

Render a line chart as an element model

Parameters:
  • data (list(dict)) – The data array

  • line_chart (dict) – The line chart model

  • options (dict or None, optional) – The line chart options object

Returns:

The line chart element model

Return type:

dict

data_line_chart_validate

bare_script.include.data_line_chart_validate(line_chart)

Validate a line chart model

Parameters:

line_chart (dict) – The line chart model

Returns:

The validated line chart model

Return type:

dict

Raises:

SchemaValidationError – A validation error occurred

dataTable.bare

data_table_elements

bare_script.include.data_table_elements(data, data_table=None)

Render a data table as an element model

Parameters:
  • data (list(dict)) – The data array

  • data_table (dict or None, optional) – The data table model

Returns:

The data table element model

Return type:

dict

data_table_markdown

bare_script.include.data_table_markdown(data, model=None)

Create the array of Markdown table line strings

Parameters:
  • data (list(dict)) – The array of row objects

  • model (dict or None, optional) – The data table model

Returns:

The array of Markdown table line strings

Return type:

list(str)

data_table_validate

bare_script.include.data_table_validate(data_table)

Validate a data table model

Parameters:

data_table (dict) – The data table model

Returns:

The validated data table model

Return type:

dict

Raises:

SchemaValidationError – A validation error occurred

elementModel.bare

element_model_to_string

bare_script.include.element_model_to_string(elements, indent=None)

Render an element model to an HTML or SVG string

Parameters:
  • elements (dict or list or None) – The element model

  • indent (str or int or None, optional) – The indentation string or number of spaces

Returns:

The HTML or SVG string

Return type:

str

element_model_validate

bare_script.include.element_model_validate(elements)

Validate an element model

Parameters:

elements (dict or list or None) – The element model

Returns:

The validated element model

Return type:

dict or list or None

Raises:

SchemaValidationError – A validation error occurred

markdown.bare

markdown_escape

bare_script.include.markdown_escape(text)

Escape a string for inclusion in Markdown text

Parameters:

text (str) – The text to escape

Returns:

The escaped text

Return type:

str

markdown_header_id

bare_script.include.markdown_header_id(text)

Generate a Markdown header ID from text

Parameters:

text (str) – The text

Returns:

The header element ID

Return type:

str

markdown_paragraph_text

bare_script.include.markdown_paragraph_text(paragraph)

Get a Markdown paragraph model’s text

Parameters:

paragraph (dict) – The Markdown paragraph model

Returns:

The paragraph text string

Return type:

str

markdown_title

bare_script.include.markdown_title(markdown)

Get a Markdown model’s title

Parameters:

markdown (dict) – The Markdown model

Returns:

The title string or None

Return type:

str or None

markdown_validate

bare_script.include.markdown_validate(markdown)

Validate a Markdown model

Parameters:

markdown (dict) – The Markdown model

Returns:

The validated Markdown model

Return type:

dict

Raises:

SchemaValidationError – A validation error occurred

markdownElements.bare

markdown_elements

bare_script.include.markdown_elements(markdown, options=None)

Generate an element model from a Markdown model

Parameters:
  • markdown (dict) – The Markdown model

  • options (dict or None, optional) – The Markdown elements options object

Returns:

The Markdown’s element model

Return type:

list

markdownParser.bare

markdown_parse

bare_script.include.markdown_parse(text)

Parse Markdown text into a Markdown model

Parameters:

text (str or list(str)) – The Markdown text

Returns:

The Markdown model

Return type:

dict

qrcode.bare

qrcode_elements

bare_script.include.qrcode_elements(message, size, level=None)

Generate the element model for a QR code

Parameters:
  • message (str or list(list)) – The QR code message or the QR code matrix

  • size (int) – The size of the QR code, in pixels

  • level (str or None, optional) – The error correction level: ‘low’, ‘medium’, ‘quartile’, or ‘high’

Returns:

The QR code SVG element model

Return type:

dict

qrcode_matrix

bare_script.include.qrcode_matrix(message, level=None)

Generate a QR code pixel matrix

Parameters:
  • message (str) – The QR code message

  • level (str or None, optional) – The error correction level: ‘low’, ‘medium’, ‘quartile’, or ‘high’

Returns:

The QR code pixel matrix

Return type:

list(list)

schema.bare

schema_get_enum_values

bare_script.include.schema_get_enum_values(types, enum_model)

Get an enum’s values (inherited values first)

Parameters:
Returns:

The array of enum value models

Return type:

list(dict)

schema_get_referenced_types

bare_script.include.schema_get_referenced_types(types, type_name, referenced_types=None)

Get a user type’s referenced type model

Parameters:
  • types (dict) – The schema’s type model

  • type_name (str) – The type name

  • referenced_types (dict or None, optional) – A map of referenced user type name to user type model to update

Returns:

The referenced type model

Return type:

dict

schema_get_struct_members

bare_script.include.schema_get_struct_members(types, struct)

Get a struct’s members (inherited members first)

Parameters:
Returns:

The array of struct member models

Return type:

list(dict)

schema_validate

bare_script.include.schema_validate(types, type_name, value, member_fqn=None)

Validate a value using a schema type model

Parameters:
  • types (dict) – The schema’s type model

  • type_name (str) – The type name

  • value – The value to validate

  • member_fqn (str or None, optional) – The fully-qualified member name (for error messages)

Returns:

The validated, transformed value

Raises:

SchemaValidationError – A validation error occurred

schemaDoc.bare

schema_doc_markdown

bare_script.include.schema_doc_markdown(types, type_name, options=None)

Generate the Schema Markdown user type documentation as an array of Markdown text lines

Parameters:
  • types (dict) – The schema’s type model

  • type_name (str) – The type name

  • options (dict or None, optional) – The schema documentation options object

Returns:

The array of Markdown text lines

Return type:

list(str)

schemaParser.bare

schema_parse

bare_script.include.schema_parse(text, types=None, filename=None, validate=None)

Parse Schema Markdown text

Parameters:
  • text (str or list(str)) – The Schema Markdown text

  • types (dict or None, optional) – The schema’s type model to update

  • filename (str or None, optional) – The file name (for error messages)

  • validate (bool or None, optional) – If True (the default), validate the type model after parsing

Returns:

The schema’s type model

Return type:

dict

Raises:

SchemaParserError – A parsing error occurred

schemaTypeModel.bare

schema_type_model

bare_script.include.schema_type_model()

Get the Schema Markdown type model

Returns:

The Schema Markdown type model

Return type:

dict

schema_type_model_validate

bare_script.include.schema_type_model_validate(types)

Validate a Schema Markdown type model

Parameters:

types (dict) – The schema’s type model to validate

Returns:

The validated type model

Return type:

dict

Raises:

SchemaValidationError – A validation error occurred

url.bare

url_decode_component

bare_script.include.url_decode_component(string)

Decode a percent-encoded string component

Parameters:

string (str) – The string component to decode

Returns:

The decoded string, or None on failure

Return type:

str or None

url_decode_query_string

bare_script.include.url_decode_query_string(query_string)

Decode a URL query string to an object

Parameters:

query_string (str) – The query string to decode

Returns:

The decoded query string object, or None on failure

Return type:

dict or None

url_encode

bare_script.include.url_encode(url)

Encode a URL

Parameters:

url (str) – The URL to encode

Returns:

The encoded URL

Return type:

str

url_encode_component

bare_script.include.url_encode_component(url)

Encode a URL component

Parameters:

url (str) – The URL component to encode

Returns:

The encoded URL component

Return type:

str

url_encode_query_string

bare_script.include.url_encode_query_string(obj)

Encode an object as a URL query string

Parameters:

obj (dict) – The object to encode

Returns:

The encoded query string

Return type:

str

Errors

SchemaParserError

exception bare_script.include.SchemaParserError(errors)

Bases: Exception

A Schema Markdown parser error

Parameters:

errors (list(str)) – The list of error strings

errors

The list of error strings

SchemaValidationError

exception bare_script.include.SchemaValidationError(msg, member_fqn=None)

Bases: Exception

A schema type model validation error

Parameters:
  • msg (str) – The validation error message

  • member_fqn (str or None) – The fully-qualified member name or None

member_fqn

The fully-qualified member name or None