API Reference

Here you can find all sept interfaces.

Sept

Parser

class sept.parser.PathTemplateParser(additional_tokens=None, additional_operators=None)
__init__(additional_tokens=None, additional_operators=None)

Token

class sept.token.Token

The docstring of your Token will be used as the documentation help message.

name

alias of NotImplementedError

class sept.token.Token

The docstring of your Token will be used as the documentation help message.

name

alias of NotImplementedError

Operator

class sept.operator.Operator(args=None)
The docstring of your Operator is used as the documentation for your

Operator.

You should include any freeform text that you would like as well as some

examples of how your Operator works.

This docstring should be treated as html code.

If you wanted to bold your text, you could just do <b>this!</b>

name

alias of NotImplementedError

__init__(args=None)
execute(input_data)

execute does the actual work of your custom Operator. It will take in the data passed and return the transformed data as

output.

Parameters

input_data (Any) –

Returns

The transformed data according to whatever the Operator is supposed to do.

Return type

Any

is_invalid(token_value)

is_invalid will check the value the is about to be operated on. If the value will not work for some reason (wrong datatype, etc),

this method should return an error message as a string.

If it looks good to go, just return None

Parameters

token_value (Any) – Data that would be operated on

Returns

A Falsey value if everything is ok, or an error string if not.

Return type

None|str

class sept.operator.Operator(args=None)
The docstring of your Operator is used as the documentation for your

Operator.

You should include any freeform text that you would like as well as some

examples of how your Operator works.

This docstring should be treated as html code.

If you wanted to bold your text, you could just do <b>this!</b>

name

alias of NotImplementedError

__init__(args=None)
execute(input_data)

execute does the actual work of your custom Operator. It will take in the data passed and return the transformed data as

output.

Parameters

input_data (Any) –

Returns

The transformed data according to whatever the Operator is supposed to do.

Return type

Any

is_invalid(token_value)

is_invalid will check the value the is about to be operated on. If the value will not work for some reason (wrong datatype, etc),

this method should return an error message as a string.

If it looks good to go, just return None

Parameters

token_value (Any) – Data that would be operated on

Returns

A Falsey value if everything is ok, or an error string if not.

Return type

None|str

class sept.builtin.operators.lower.LowerOperator(args=None)

The <code>lower</code> Operator will convert your Token to lowercase. <br> <br>Examples: <br>&emsp;<code>”Alex” &nbsp;&nbsp;-> “alex”</code> <br>&emsp;<code>”alex” &nbsp;&nbsp;-> “alex”</code> <br>&emsp;<code>”ALEX11” -> “alex11”</code>

is_invalid(token_value)

is_invalid will check the value the is about to be operated on. If the value will not work for some reason (wrong datatype, etc),

this method should return an error message as a string.

If it looks good to go, just return None

Parameters

token_value (Any) – Data that would be operated on

Returns

A Falsey value if everything is ok, or an error string if not.

Return type

None|str

execute(input_data)

execute does the actual work of your custom Operator. It will take in the data passed and return the transformed data as

output.

Parameters

input_data (Any) –

Returns

The transformed data according to whatever the Operator is supposed to do.

Return type

Any

class sept.builtin.operators.lower.LowerOperator(args=None)

The <code>lower</code> Operator will convert your Token to lowercase. <br> <br>Examples: <br>&emsp;<code>”Alex” &nbsp;&nbsp;-> “alex”</code> <br>&emsp;<code>”alex” &nbsp;&nbsp;-> “alex”</code> <br>&emsp;<code>”ALEX11” -> “alex11”</code>

is_invalid(token_value)

is_invalid will check the value the is about to be operated on. If the value will not work for some reason (wrong datatype, etc),

this method should return an error message as a string.

If it looks good to go, just return None

Parameters

token_value (Any) – Data that would be operated on

Returns

A Falsey value if everything is ok, or an error string if not.

Return type

None|str

execute(input_data)

execute does the actual work of your custom Operator. It will take in the data passed and return the transformed data as

output.

Parameters

input_data (Any) –

Returns

The transformed data according to whatever the Operator is supposed to do.

Return type

Any

class sept.builtin.operators.null.NullOperator(args=None)

The <code>null</code> Operator will do nothing to you Token. <br> <br>Examples: <br>&emsp;<code>”Alex” &nbsp; &nbsp;-> “Alex”</code> <br>&emsp;<code>”alex” &nbsp; &nbsp;-> “alex”</code> <br>&emsp;<code>”ALEX11” -> “ALEX11”</code>

is_invalid(token_value)

is_invalid will check the value the is about to be operated on. If the value will not work for some reason (wrong datatype, etc),

this method should return an error message as a string.

If it looks good to go, just return None

Parameters

token_value (Any) – Data that would be operated on

Returns

A Falsey value if everything is ok, or an error string if not.

Return type

None|str

execute(input_data)

execute does the actual work of your custom Operator. It will take in the data passed and return the transformed data as

output.

Parameters

input_data (Any) –

Returns

The transformed data according to whatever the Operator is supposed to do.

Return type

Any

class sept.builtin.operators.null.NullOperator(args=None)

The <code>null</code> Operator will do nothing to you Token. <br> <br>Examples: <br>&emsp;<code>”Alex” &nbsp; &nbsp;-> “Alex”</code> <br>&emsp;<code>”alex” &nbsp; &nbsp;-> “alex”</code> <br>&emsp;<code>”ALEX11” -> “ALEX11”</code>

is_invalid(token_value)

is_invalid will check the value the is about to be operated on. If the value will not work for some reason (wrong datatype, etc),

this method should return an error message as a string.

If it looks good to go, just return None

Parameters

token_value (Any) – Data that would be operated on

Returns

A Falsey value if everything is ok, or an error string if not.

Return type

None|str

execute(input_data)

execute does the actual work of your custom Operator. It will take in the data passed and return the transformed data as

output.

Parameters

input_data (Any) –

Returns

The transformed data according to whatever the Operator is supposed to do.

Return type

Any

class sept.builtin.operators.replace.ReplaceOperator(args=None)

The <code>replace</code> Operator allows you to find and replace characters in your Token. <br> <br>Examples (name = “alex”): <br>&emsp;<code>{{replace[ex,an]:name}}&nbsp;&nbsp; -> “alan”</code> <br>&emsp;<code>{{replace[kite,dog:name}} -> “alex”</code>

is_invalid(token_value)

is_invalid will check the value the is about to be operated on. If the value will not work for some reason (wrong datatype, etc),

this method should return an error message as a string.

If it looks good to go, just return None

Parameters

token_value (Any) – Data that would be operated on

Returns

A Falsey value if everything is ok, or an error string if not.

Return type

None|str

execute(input_data)

execute does the actual work of your custom Operator. It will take in the data passed and return the transformed data as

output.

Parameters

input_data (Any) –

Returns

The transformed data according to whatever the Operator is supposed to do.

Return type

Any

class sept.builtin.operators.replace.ReplaceOperator(args=None)

The <code>replace</code> Operator allows you to find and replace characters in your Token. <br> <br>Examples (name = “alex”): <br>&emsp;<code>{{replace[ex,an]:name}}&nbsp;&nbsp; -> “alan”</code> <br>&emsp;<code>{{replace[kite,dog:name}} -> “alex”</code>

is_invalid(token_value)

is_invalid will check the value the is about to be operated on. If the value will not work for some reason (wrong datatype, etc),

this method should return an error message as a string.

If it looks good to go, just return None

Parameters

token_value (Any) – Data that would be operated on

Returns

A Falsey value if everything is ok, or an error string if not.

Return type

None|str

execute(input_data)

execute does the actual work of your custom Operator. It will take in the data passed and return the transformed data as

output.

Parameters

input_data (Any) –

Returns

The transformed data according to whatever the Operator is supposed to do.

Return type

Any

class sept.builtin.operators.substr.SubStringOperator(args=None)

The <code>substr</code> Operator allows you to return a subset of the Token. <br>This Operator supports the arguments “start” and “end” as well as numerical indexes from zero. <br> <br>Examples (name = “alex”): <br>&emsp;<code>{{substr[start,2]:name}} -> “al”</code> <br>&emsp;<code>{{substr[0,2]:name}} &nbsp; &nbsp;&nbsp;&nbsp;-> “al”</code> <br>&emsp;<code>{{substr[0,end]:name}} &nbsp;&nbsp;-> “alex”</code> <br>&emsp;<code>{{substr[1,3]:name}} &nbsp; &nbsp;&nbsp;&nbsp;-> “le”</code>

is_invalid(token_value)

is_invalid will check the value the is about to be operated on. If the value will not work for some reason (wrong datatype, etc),

this method should return an error message as a string.

If it looks good to go, just return None

Parameters

token_value (Any) – Data that would be operated on

Returns

A Falsey value if everything is ok, or an error string if not.

Return type

None|str

execute(input_data)

execute does the actual work of your custom Operator. It will take in the data passed and return the transformed data as

output.

Parameters

input_data (Any) –

Returns

The transformed data according to whatever the Operator is supposed to do.

Return type

Any

class sept.builtin.operators.substr.SubStringOperator(args=None)

The <code>substr</code> Operator allows you to return a subset of the Token. <br>This Operator supports the arguments “start” and “end” as well as numerical indexes from zero. <br> <br>Examples (name = “alex”): <br>&emsp;<code>{{substr[start,2]:name}} -> “al”</code> <br>&emsp;<code>{{substr[0,2]:name}} &nbsp; &nbsp;&nbsp;&nbsp;-> “al”</code> <br>&emsp;<code>{{substr[0,end]:name}} &nbsp;&nbsp;-> “alex”</code> <br>&emsp;<code>{{substr[1,3]:name}} &nbsp; &nbsp;&nbsp;&nbsp;-> “le”</code>

is_invalid(token_value)

is_invalid will check the value the is about to be operated on. If the value will not work for some reason (wrong datatype, etc),

this method should return an error message as a string.

If it looks good to go, just return None

Parameters

token_value (Any) – Data that would be operated on

Returns

A Falsey value if everything is ok, or an error string if not.

Return type

None|str

execute(input_data)

execute does the actual work of your custom Operator. It will take in the data passed and return the transformed data as

output.

Parameters

input_data (Any) –

Returns

The transformed data according to whatever the Operator is supposed to do.

Return type

Any

class sept.builtin.operators.upper.UpperOperator(args=None)

The <code>upper</code> Operator will convert your Token to uppercase. <br> <br>Examples: <br>&emsp;<code>”Alex” &nbsp;&nbsp;-> “ALEX”</code> <br>&emsp;<code>”alex” &nbsp;&nbsp;-> “ALEX”</code> <br>&emsp;<code>”alex11” -> “ALEX11”</code>

is_invalid(token_value)

is_invalid will check the value the is about to be operated on. If the value will not work for some reason (wrong datatype, etc),

this method should return an error message as a string.

If it looks good to go, just return None

Parameters

token_value (Any) – Data that would be operated on

Returns

A Falsey value if everything is ok, or an error string if not.

Return type

None|str

execute(input_data)

execute does the actual work of your custom Operator. It will take in the data passed and return the transformed data as

output.

Parameters

input_data (Any) –

Returns

The transformed data according to whatever the Operator is supposed to do.

Return type

Any

class sept.builtin.operators.upper.UpperOperator(args=None)

The <code>upper</code> Operator will convert your Token to uppercase. <br> <br>Examples: <br>&emsp;<code>”Alex” &nbsp;&nbsp;-> “ALEX”</code> <br>&emsp;<code>”alex” &nbsp;&nbsp;-> “ALEX”</code> <br>&emsp;<code>”alex11” -> “ALEX11”</code>

is_invalid(token_value)

is_invalid will check the value the is about to be operated on. If the value will not work for some reason (wrong datatype, etc),

this method should return an error message as a string.

If it looks good to go, just return None

Parameters

token_value (Any) – Data that would be operated on

Returns

A Falsey value if everything is ok, or an error string if not.

Return type

None|str

execute(input_data)

execute does the actual work of your custom Operator. It will take in the data passed and return the transformed data as

output.

Parameters

input_data (Any) –

Returns

The transformed data according to whatever the Operator is supposed to do.

Return type

Any

Template

class sept.template.Template
__init__()

Errors

exception sept.errors.SeptError
exception sept.errors.TokenNotFoundError
exception sept.errors.OperatorError
exception sept.errors.LocationAwareSeptError(location, message, length=0)
__init__(location, message, length=0)
exception sept.errors.ParsingError(location, message, length=0)
__init__(location, message, length=0)
exception sept.errors.MultipleParsingError(errors)
__init__(errors)
exception sept.errors.InvalidCharacterParsingError(expression, expected_char, actual_char, start_col, end_col)
__init__(expression, expected_char, actual_char, start_col, end_col)
exception sept.errors.BalancingParenthesisError(missing_token, substr, start_location, end_location)
__init__(missing_token, substr, start_location, end_location)
exception sept.errors.OpeningBalancingParenthesisError(missing_token, substr, start_location, end_location)
exception sept.errors.ClosingBalancingParenthesisError(missing_token, substr, start_location, end_location)
exception sept.errors.MultipleBalancingError(errors)
__init__(errors)
exception sept.errors.OperatorNotFoundError
exception sept.errors.TokenNameAlreadyExists
exception sept.errors.OperatorNameAlreadyExists
exception sept.errors.InvalidOperatorArgumentsError
exception sept.errors.InvalidOperatorInputDataError

Other

class sept.balancer.ParenthesisBalancer(template_str)

The ParenthesisBalancer class runs a stack based pairing lookup against the “{{” and “}}” pairs.

It will check for any unbalanced pairs and return a record of those in addition to any successfuly found pairs

Successfully matched pairs get returned as a list of [start_index, end_index] values which can be used to generate substrings of only the “Token Expression” chunks.

__init__(template_str)
execute()

execute the template parsing. This method runs the token balancing check and will store any errors as either sept.errors.OpeningBalancingParenthesisError or sept.errors.ClosingBalancingParenthesisError exceptions, unthrown.

It returns any successfully found “Token Expressions” at the root level. Any nested “Token Expressions” get validated but not returned as locations from this method.

Returns

Returns a list of “Token Expression” locations as index start:end values and a list of any errors that were encountered.

Return type

list[list,list]

classmethod parse_string(template_str)

Standard entrypoint into usage of the ParenthesisBalancer class

Parameters

template_str (str) – Template string that we want to validate.

Returns

Tuple of expression_locations and errors. See execute for definition.

Return type

list[list,list]

class sept.balancer.ParenthesisBalancer(template_str)

The ParenthesisBalancer class runs a stack based pairing lookup against the “{{” and “}}” pairs.

It will check for any unbalanced pairs and return a record of those in addition to any successfuly found pairs

Successfully matched pairs get returned as a list of [start_index, end_index] values which can be used to generate substrings of only the “Token Expression” chunks.

__init__(template_str)
execute()

execute the template parsing. This method runs the token balancing check and will store any errors as either sept.errors.OpeningBalancingParenthesisError or sept.errors.ClosingBalancingParenthesisError exceptions, unthrown.

It returns any successfully found “Token Expressions” at the root level. Any nested “Token Expressions” get validated but not returned as locations from this method.

Returns

Returns a list of “Token Expression” locations as index start:end values and a list of any errors that were encountered.

Return type

list[list,list]

classmethod parse_string(template_str)

Standard entrypoint into usage of the ParenthesisBalancer class

Parameters

template_str (str) – Template string that we want to validate.

Returns

Tuple of expression_locations and errors. See execute for definition.

Return type

list[list,list]

class sept.operator_manager.OperatorManager
__init__()
class sept.token_manager.TokenManager
__init__()
sept.template_tokenizer.Tokenizer

alias of Forward: {{{“{{” [{{W:(ABCD…) [{{“[” {W:(0123…, ABC…)}… [, {W:(0123…, ABC…)}…]…} “]”}]} “:”}]} {: … | W:(0123…)}} “}}”}