zospy.analyses.parsers.transformers.ZospyTransformer#

class zospy.analyses.parsers.transformers.ZospyTransformer#

Bases: Transformer

Parse tree transformations for common constructs in OpticStudio analysis output.

Methods

DATE

alias of str

FLOAT(f)

Floating point number with localized decimal separator.

INT(i)

Integer number.

UINT(i)

Unsigned integer number.

WORD

alias of str

dict(args)

Transform a key-value mapping.

field_group(args)

Transform a group of fields under a common key to a SimpleField.

field_name(name)

Transform a field name.

field_parameters(args)

Transform field parameters.

field_value(value)

Transform a field value.

list

Built-in mutable sequence.

multi_string(iterable, /)

Concatenate any number of strings.

parametric_field(args)

Transform a field with parameters.

parametric_unit_field(args)

Transform a field with parameters and a unit.

simple_field(args)

Transform a simple field with a name and a value.

start(args)

Transform the root of the parse tree.

string_list(args)

List of whitespace-separated strings.

table(args)

Transform a table with a header and one or more rows.

text(args)

Discard text that can be ignored.

transform(tree)

Transform the given tree, and return the final result

tuple(args)

Transform a tuple of values.

unit(args)

Transform a unit of measurement.

unit_field(args)

Transform a field with a unit.

DATE#

alias of str

FLOAT(f: str) float#

Floating point number with localized decimal separator.

INT(i: str) int#

Integer number.

UINT(i: str) int#

Unsigned integer number.

WORD#

alias of str

dict(args)#

Transform a key-value mapping.

field_group(args)#

Transform a group of fields under a common key to a SimpleField.

field_name(name) str#

Transform a field name.

field_parameters(args)#

Transform field parameters.

field_value(value)#

Transform a field value.

class list#

Bases: object

Built-in mutable sequence.

If no argument is given, the constructor creates a new empty list. The argument must be an iterable if specified.

Methods

append(object, /)

Append object to the end of the list.

clear(/)

Remove all items from list.

copy(/)

Return a shallow copy of the list.

count(value, /)

Return number of occurrences of value.

extend(iterable, /)

Extend list by appending elements from the iterable.

index(value[, start, stop])

Return first index of value.

insert(index, object, /)

Insert object before index.

pop([index])

Remove and return item at index (default last).

remove(value, /)

Remove first occurrence of value.

reverse(/)

Reverse IN PLACE.

sort(*[, key, reverse])

Sort the list in ascending order and return None.

__init__(*args, **kwargs)#
__new__(*args, **kwargs)#
append(object, /)#

Append object to the end of the list.

clear(/)#

Remove all items from list.

copy(/)#

Return a shallow copy of the list.

count(value, /)#

Return number of occurrences of value.

extend(iterable, /)#

Extend list by appending elements from the iterable.

index(value, start=0, stop=sys.maxsize, /)#

Return first index of value.

Raises ValueError if the value is not present.

insert(index, object, /)#

Insert object before index.

pop(index=-1, /)#

Remove and return item at index (default last).

Raises IndexError if list is empty or index is out of range.

remove(value, /)#

Remove first occurrence of value.

Raises ValueError if the value is not present.

reverse(/)#

Reverse IN PLACE.

sort(*, key=None, reverse=False)#

Sort the list in ascending order and return None.

The sort is in-place (i.e. the list itself is modified) and stable (i.e. the order of two equal elements is maintained).

If a key function is given, apply it once to each list item and sort them, ascending or descending, according to their function values.

The reverse flag can be set to sort in descending order.

multi_string(iterable, /)#

Concatenate any number of strings.

The string whose method is called is inserted in between each given string. The result is returned as a new string.

Example: ‘.’.join([‘ab’, ‘pq’, ‘rs’]) -> ‘ab.pq.rs’

parametric_field(args) SimpleField[ParametricField]#

Transform a field with parameters.

parametric_unit_field(args) SimpleField[ParametricField[UnitField]]#

Transform a field with parameters and a unit.

simple_field(args) SimpleField#

Transform a simple field with a name and a value.

start(args)#

Transform the root of the parse tree.

string_list(args) list[str]#

List of whitespace-separated strings.

table(args)#

Transform a table with a header and one or more rows.

text(args)#

Discard text that can be ignored.

tuple(args)#

Transform a tuple of values.

unit(args) str#

Transform a unit of measurement.

unit_field(args) SimpleField[UnitField]#

Transform a field with a unit.