sbdl

def name():

Return the application name.

def version():

Return the current compiler version string.

def version_dev():

Return the development version marker string.

def version_dsl():

Return the DSL language specification version string.

def version_rest_api():

Return the REST API version string.

def author():

Return the author contact string.

def url():

Return the project URL.

def help_text():

Return the application help text string.

def get_config_value(key, raise_on_missing=True, default=None, number=None):

Retrieve a configuration value by key, with optional environment variable override and numeric coercion.

def lock_config_key(key):

Lock a configuration key so it cannot be modified by subsequent set_config_value calls.

def set_config_value(key, data, warn_on_new=True):

Set a configuration value by key, warning if the key is new and skipping if locked.

def use_config_data(new_config_data, skip_keys=None):

Merge new_config_data into the global config, skipping locked and explicitly excluded keys.

def load_config(config_path, skip_keys=None):

Load a JSON configuration file and merge its values into the global config.

def add_to_config_value(key, data):

Append or merge data into an existing list or dict config value, skipping locked keys.

def init():

Snapshot the current configuration as the default state for later reset.

def reset():

Reset custom type information and restore the configuration to the initial default snapshot.

class SBDL_Parser:

Container for SBDL language parser constants, token rules, directive handling, and parsing logic.

@classmethod
def set_formal_spec(self):

Switch the parser lexical spec to use the formal (Unicode symbol) grammar variant.

@classmethod
def parse_statements(self, parser_element):

Parse all SBDL statements within a parser element and return a list of statement objects.

@classmethod
def parse_elements(self, parser_element):

Alias for parse_statements; parse all SBDL elements in a parser element.

class SBDL_Parser.Parser_Element(SBDL_Parser.Parser_Hints):

Represents a single parsed text element with its source location and line index information.

def content(self):

Return the raw text content of this parser element.

def content_line_layout(self):

Return a formatted string showing content with line numbers derived from the index map.

def content_sanitized(self):

Return the content with leading and trailing whitespace stripped.

def source(self):

Return the source file path of this parser element.

def index(self):

Return the source line number at the start of this element's content.

def indexes(self):

Return the full list of (content_position, line_number) index pairs for this element.

def indexes_at(self, pos):

Return all index pairs whose content position is at or after the given pos.

def index_at(self, pos):

Return the source line number corresponding to the given content position.

def reference(self):

Return a shortened 'source:line' reference string for this element.

def context(self):

Return the context string associated with this parser element.

def copy(self):

Return a new Parser_Element with the same content, source, indexes, and context.

@classmethod
def shorten_reference(self, reference):

Strip configured prefix and apply maximum-length elision to a reference string.

@classmethod
def line_layout_content_indexes(self, content, indexes):

Build a numbered-line display string from content and its (position, line_number) index pairs.

class SBDL_Semantics:

Container for SBDL semantic rules: allowed type links, type properties, type/category/property descriptions, and custom type registration.

@classmethod
def get_language_information_struct(self):

Build and return a comprehensive dict describing all language types, properties, directives, and CLI help.

@classmethod
def type_color(self, type_name):

Return (and memoize) a consistent hex color string for the given element type name.

@classmethod
def calc_bsci(self, statement_text, language):

Calculate a Behavioural Specification Complexity Index (BSCI) score for the given statement text.

@classmethod
def get_identifier_from_string( self, input_string, aggressive_length=20, min_word_len=3, separator='', stop_words=None, stop_chars=None, abbreviations=None, right_to_left=True):

Derive a compact SBDL identifier from a natural-language string by applying stop-word removal, abbreviations, and vowel elision.

@classmethod
def get_identifier_from_string_eng_standard_v2( self, input_string, aggressive_length=20, min_word_len=3, separator='', right_to_left=True):

Derive a compact identifier using the v2 engineering standard stop-word/abbreviation set.

@classmethod
def get_identifier_from_string_eng_standard_v1( self, input_string, aggressive_length=20, min_word_len=3, separator='', right_to_left=True):

Derive a compact identifier using the v1 engineering standard stop-word/abbreviation set.

@classmethod
def get_identifier_from_string_eng_standard( self, input_string, aggressive_length=20, min_word_len=3, separator='', right_to_left=True):

Derive a compact identifier using the default (v1) engineering standard rules. Delegates to v1.

@classmethod
def shorten_string_on_word_boundary(self, input_string, shorten_length):

Return the last shorten_length characters of input_string, aligned to a word boundary.

@classmethod
def get_unique_id_from_string(self, input_string):

Generate a short, base-62-encoded unique identifier from a SHA-256 hash of the input string.

@classmethod
def create_custom_embedded_function(self, function_content, argument_list):

Compile an embedded Python function from a #!python-prefixed string and return the callable.

@classmethod
def create_customtype_from_prototype(self, prototype):

Register a new custom element type from a prototype declaration, building its class and semantic rules.

class SBDL_Parsed_Object(SBDL_Parser.Parser_Hints):

Abstract base for all parsed SBDL objects; raises on any unimplemented interface method.

def throw_error(self, err='Unknown'):

Raise an Exception indicating that an abstract method was called.

class SBDL_Statement(SBDL_Parsed_Object):

Concrete parsed statement holding its parser element, type, attribute data, and error state.

def parser_element(self):

Return a copy of the underlying Parser_Element for this statement.

def type(self):

Return the statement type string.

def data_type(self):

Return the declaration data type; None for generic statements.

def data(self):

Return the attribute data dict, injecting the syntactic parent as a parent attribute if present.

def error(self):

Return True if this statement encountered a parse error.

def error_position(self):

Return the character position within the content where the error occurred.

def error_message(self):

Return the error message string for this statement.

def extend_error_message(self, extension):

Append additional text to the existing error message.

def copy(self):

Return a shallow copy of this statement.

def inherit_data(self, parent_data):

Merge parent_data into this statement's data dict, with existing values taking precedence.

def apply_scope(self, scope_data):

Prepend scope prefixes to matching attribute values and return the resulting scope map.

def identifier(self):

Return a synthetic identifier composed of statement type and source reference.

def syntactic_parent(self):

Return the syntactic parent statement, or None if there is none.

class SBDL_Operator(SBDL_Statement):

Parsed operator statement (e.g. link or source-link operator between elements).

def data_type(self):

Return the declaration data type; None for generic statements.

def copy(self):

Return a shallow copy of this statement.

class SBDL_Using_Statement(SBDL_Statement):

Parsed 'using' statement that imports attributes from named element definitions into the current scope.

def data_type(self):

Return the declaration data type; None for generic statements.

def copy(self):

Return a shallow copy of this statement.

def identifier(self):

Return a synthetic identifier composed of statement type and source reference.

class SBDL_Depends_Statement(SBDL_Statement):

Parsed 'depends' statement that imports external files into the current scope.

def data_type(self):

Return the declaration data type; None for generic statements.

def copy(self):

Return a shallow copy of this statement.

def identifier(self):

Return a synthetic identifier composed of statement type and source reference.

class SBDL_Scope_Statement(SBDL_Statement):

Parsed 'scope' statement that applies a namespace prefix to identifiers in the current block.

def data_type(self):

Return the declaration data type; None for generic statements.

def copy(self):

Return a shallow copy of this statement.

def identifier(self):

Return a synthetic identifier composed of statement type and source reference.

class SBDL_Declaration_Statement(SBDL_Statement):

Parsed SBDL element declaration holding an identifier, declared type, and key-value attribute data.

def data_type(self):

Return the declaration data type; None for generic statements.

def identifier(self):

Return a synthetic identifier composed of statement type and source reference.

def apply_scope(self, scope_data):

Prepend scope prefixes to matching attribute values and return the resulting scope map.

def copy(self):

Return a shallow copy of this statement.

class SBDL_Customtype_Statement(SBDL_Declaration_Statement):

Parsed 'customtype' declaration statement that introduces a user-defined element type.

def copy(self):

Return a shallow copy of this statement.

class SBDL_Element(SBDL_Parser.Parser_Hints):

Base class for all SBDL model elements, providing type, links, properties, and validation infrastructure.

@classmethod
def class_type_name(self):

Return the type name string for this element class; None for the abstract base.

def is_a(self, target):

Return True if this element is an instance of, or has a type matching, the given target type/class/name.

def identifier(self, with_stereotype=False):

Return the element identifier, optionally including the stereotype suffix.

def stereotype(self):

Return the stereotype string for this element, or None if absent.

def description(self):

Return the description property of this element with escape characters resolved.

def replace_directives_from_dict(self, input_dict, throw_error=True, print_l=<function print_null>):

Expand all macro directives within this element's properties and links using the provided macro dict.

def get_as_dictionary(self, extra_links=None, flatten_references=True):

Return the element's full data as a plain dict, optionally including extra links.

def definition(self):

Return an SBDL_Declaration_Statement reconstructed from this element's current state.

def reference(self):

Return the source reference string for this element (file:line or overridden reference property).

def type(self):

Return the type name string of this element.

@classmethod
def types(self):

Return the list of type names for this element's class hierarchy (from most to least derived).

def relations(self):

Return the element's relations; alias for links().

def parents(self):

Return a copy of this element's parent link list.

def children(self):

Return a copy of this element's child link list.

def related(self):

Return a copy of this element's related link list.

def properties(self):

Return the dict_keys view of this element's property names.

def get_property(self, key):

Return the value of the named property.

def delete_property(self, key):

Delete the named property if it exists.

def set_property(self, key, value):

Set a property value, or delete it if value is None.

@classmethod
def declaration_type_to_class(self, type_name, raise_on_error=True):

Return the SBDL_Element subclass corresponding to the given type name string.

@classmethod
def declaration_to_element(self, declaration_statement):

Instantiate and return the appropriate SBDL_Element subclass for the given declaration statement.

@classmethod
def statement_to_element(self, statement):

Convert a parsed statement object into the corresponding SBDL_Element instance.

def validate_relation_extended(self, _, __):

Extended relation validation hook; returns (True, '') by default.

def validate_self(self, elements=None):

Validate all links on this element, checking stereotypes and hash integrity; return (is_valid, error).

@classmethod
def get_ids_string(self, link_list, elem_type=None):

Return a comma-separated string of link identifiers, optionally filtered by element type.

def prune_missing_references(self, element_set):

Remove any links (in all link lists) whose target identifier is not present in element_set.

def is_meta(self):

Return True if this element is marked as a meta element.

def pragma(self):

Return the pragma attribute value from the declaration data, or None if absent.

def hash(self):

Return a short SHA-256 hash of the element's canonical declaration content.

@classmethod
def apply_operator(self, operator_element, element_stack):

Apply the operator in operator_element to the top two elements on element_stack (RPN context).

class SBDL_Element_Rating(SBDL_Element):

Base class for SBDL elements that carry a numerical rating (detectability, severity, or occurrence).

def rating(self, post=False):

Return the element's rating value, returning the post-action value when post=True if available.

def rating_name(self, post=False):

Return the attribute name string for this element's rating (or post-action rating if post=True).

def replace_directives_from_dict(self, input_dict, throw_error=True, print_l=<function print_null>):

Expand macros in rating attributes in addition to the base element's directive expansion.

class SBDL_Element_Rating.Ratings:

Mapping of element type names to their respective rating attribute names.

class SBDL_Element_Synthetic(SBDL_Element_Rating):

Programmatically constructed SBDL element not backed by a parsed declaration statement.

@classmethod
def from_element(self, sbdl_element):

Create an SBDL_Element_Synthetic that is a copy of the given SBDL element.

def copy(self):

Return a copy of this synthetic element.

def class_type_name(self):

Return the type name of this synthetic element.

def types(self):

Return the type hierarchy list for this synthetic element.

def definition(self):

Construct and return an SBDL_Declaration_Statement representing this synthetic element.

def set_identifier(self, identifier):

Set the identifier of this synthetic element.

def set_type(self, type_name):

Set the type name of this synthetic element.

def set_rating(self, rating, post=False):

Set the (pre- or post-action) rating value for this synthetic element.

def add_relation(self, elem_link):

Alias for add_link.

def set_relations(self, links):

Alias for set_links.

def add_parent(self, parent_link):

Add a parent link to this element, removing duplicates.

def set_parents(self, parents):

Replace this element's parent links list, removing duplicates.

def add_child(self, child_link):

Add a child link to this element, removing duplicates.

def set_children(self, children):

Replace this element's children links list, removing duplicates.

def set_meta(self, is_meta):

Set whether this element is a meta element.

def native_element(self):

Convert this synthetic element back to a native SBDL_Element via a declaration round-trip.

class SBDL_Depends(SBDL_Element):

Element representation of a 'depends' statement that imports external files.

@classmethod
def class_type_name(self):

Return the 'depends' statement type name.

def definition(self):

Return an SBDL_Declaration_Statement reconstructed from this element's current state.

class SBDL_Using(SBDL_Element):

Element representation of a 'using' statement that imports shared attributes.

@classmethod
def class_type_name(self):

Return the 'using' statement type name.

class SBDL_Scope(SBDL_Element):

Element representation of a 'scope' statement that applies namespace prefixes.

@classmethod
def class_type_name(self):

Return the 'scope' statement type name.

class SBDL_CustomType(SBDL_Element):

Element representation of a 'customtype' declaration that registers a new user-defined type.

@classmethod
def class_type_name(self):

Return the 'customtype' statement type name.

def definition(self):

Return an SBDL_Customtype_Statement for this custom type element.

class SBDL_Aspect(SBDL_Element):

SBDL element representing an architectural aspect (system decomposition unit).

@classmethod
def class_type_name(self):

Return the type name string for this element class; None for the abstract base.

class SBDL_Definition(SBDL_Element):

SBDL element representing a prescriptive design definition.

@classmethod
def class_type_name(self):

Return the type name string for this element class; None for the abstract base.

class SBDL_Realisation(SBDL_Element):

SBDL element representing a technical realisation of a design definition.

@classmethod
def class_type_name(self):

Return the type name string for this element class; None for the abstract base.

class SBDL_Requirement(SBDL_Element):

SBDL element representing a system requirement or acceptance criterion.

@classmethod
def class_type_name(self):

Return the type name string for this element class; None for the abstract base.

class SBDL_Failure_Mode(SBDL_Element_Rating):

SBDL element representing a FMEA failure mode with optional detectability rating.

@classmethod
def class_type_name(self):

Return the type name string for this element class; None for the abstract base.

@classmethod
def validate_fmea_relation_extended(self, source, link_obj, elements):

Check that hierarchical FMEA link targets share a common aspect ancestry; return (is_valid, error).

def validate_relation_extended(self, link_obj, elements):

Validate a failure-mode relation against FMEA aspect hierarchy rules.

class SBDL_Failure_Effect(SBDL_Element_Rating):

SBDL element representing a FMEA failure effect with optional severity rating.

@classmethod
def class_type_name(self):

Return the type name string for this element class; None for the abstract base.

def validate_relation_extended(self, link_obj, elements):

Extended relation validation hook; returns (True, '') by default.

class SBDL_Failure_Cause(SBDL_Element_Rating):

SBDL element representing a FMEA failure cause with optional occurrence rating.

@classmethod
def class_type_name(self):

Return the type name string for this element class; None for the abstract base.

def validate_relation_extended(self, link_obj, elements):

Extended relation validation hook; returns (True, '') by default.

class SBDL_Failure_Current_Control(SBDL_Element):

SBDL element representing an existing control that prevents a failure cause or mode.

@classmethod
def class_type_name(self):

Return the type name string for this element class; None for the abstract base.

class SBDL_Failure_Current_Detection(SBDL_Element):

SBDL element representing an existing detection (test) that measures failure mode occurrence.

@classmethod
def class_type_name(self):

Return the type name string for this element class; None for the abstract base.

class SBDL_Test_Definition(SBDL_Element):

SBDL element representing a test instance for a particular design element.

@classmethod
def class_type_name(self):

Return the type name string for this element class; None for the abstract base.

class SBDL_Failure_Action_Control(SBDL_Element):

SBDL element representing an improvement action to prevent a failure cause or mode.

@classmethod
def class_type_name(self):

Return the type name string for this element class; None for the abstract base.

class SBDL_Failure_Action_Detection(SBDL_Element):

SBDL element representing an improvement action to increase detection of a failure mode.

@classmethod
def class_type_name(self):

Return the type name string for this element class; None for the abstract base.

class SBDL_Event(SBDL_Element):

SBDL element representing a dynamic system event, optionally with conditions and alternative branches.

@classmethod
def class_type_name(self):

Return the type name string for this element class; None for the abstract base.

def condition_alternative(self):

Return a copy of this event's condition-alternative link list.

def validate_self(self, elements=None):

Validate this event, checking condition-alternative elements and stereotype-property consistency.

class SBDL_Function(SBDL_Element):

SBDL element representing a system function with optional parent/child hierarchy.

@classmethod
def class_type_name(self):

Return the type name string for this element class; None for the abstract base.

class SBDL_State(SBDL_Element):

SBDL element representing a system state with optional parent/child hierarchy.

@classmethod
def class_type_name(self):

Return the type name string for this element class; None for the abstract base.

class SBDL_Transition(SBDL_Element):

SBDL element representing a state transition; must reference exactly one ordered pair of states.

@classmethod
def class_type_name(self):

Return the type name string for this element class; None for the abstract base.

def validate_self(self, elements=None):

Validate that this transition references exactly two state links.

class SBDL_UseCase(SBDL_Element):

SBDL element representing a system use case with an optional actor property.

@classmethod
def class_type_name(self):

Return the type name string for this element class; None for the abstract base.

class SBDL_Interface(SBDL_Element):

SBDL element representing an external interface exposed by an aspect.

@classmethod
def class_type_name(self):

Return the type name string for this element class; None for the abstract base.

class SBDL_Trace(SBDL_Element):

SBDL element representing a dynamic trace instance embedded in a log or execution record.

@classmethod
def class_type_name(self):

Return the type name string for this element class; None for the abstract base.

class SBDL_Group(SBDL_Element):

SBDL element representing a structural grouping of other elements with no semantic implications.

@classmethod
def class_type_name(self):

Return the type name string for this element class; None for the abstract base.

class SBDL_AST:

Abstract Syntax Tree for an SBDL model: parses statements, builds elements, runs validation hooks.

def ast(self):

Return a copy of the list of parsed statement objects in this AST.

def force_parsed_objects(self, parsed_objects):

Replace the internal parsed object list (used for testing or pre-built ASTs).

def check_parsing(self, print_l=<function print_null>):

Report any parsing errors in the AST and return the error count.

def sbdl_elements( self, print_l=<function print_null>, prune_missing_references=False, base_elements=None):

Alias for elements(); build and return the SBDL element dict from the AST.

def elements( self, print_l=<function print_null>, prune_missing_references=False, base_elements=None):

Build SBDL elements from parsed statements, apply directives and hooks, return (elements, error_count).

@classmethod
def get_all_parent_children_for_element(self, element, elements, parents_children):

Return all parents (or children) for an element, including those declared on the other side of the link.

@classmethod
def get_all_parents_for_element(self, element, elements):

Return all parents for an element including those declared by child links in other elements.

@classmethod
def get_all_children_for_element(self, element, elements):

Return all children for an element including those declared by parent links in other elements.

@classmethod
def get_all_relations_for_element(self, element, elements):

Return all relation links for an element including those declared on the other side.

@classmethod
def get_top_level_element_set(self, elements, child_elements=None, depth=0):

Return the set of element identifiers that are not children of any other element.

@classmethod
def validate_sbdl_elements(self, sbdl_elements, print_l=<function print_null>):

Alias for validate_elements(); validate all elements in the given element set.

@classmethod
def validate_elements(self, sbdl_elements, print_l=<function print_null>):

Validate all elements and their links in sbdl_elements; report errors and return (result, error_count).

@classmethod
def get_full_ast_as_dict(self, elements, flatten_references=False):

Build a cross-reference dict (keyed by identifier) of all element data for macro expansion.

def fully_connected_cme_graph(self, _=<function print_null>):

Build a fully-connected cause-mode-effect graph, inserting placeholder nodes where links are absent.

@classmethod
def filter_element_set(self, element_set, filter_pred_f):

Return a filtered copy of element_set containing only elements for which filter_pred_f returns True.

def add_filter_element_set(self, filter_function):

Register a filter predicate f(element, element_set) -> bool to be applied when retrieving elements.

def clear_filter_element_set(self):

Remove all registered element filter predicates.

def filter_memo_function_elements_operation( self, element, elements, filter_id, search_set, memo_set, object_link_function, depth=0, depth_bound=None, filter_id_re=None):

Recursively traverse element links to determine whether any reachable element matches filter_id, with memoisation.

def add_filter_element_set_linked(self, filter_id, depth_bound):

Add a filter that retains elements reachable via links from elements matching filter_id, up to depth_bound.

def add_filter_element_set_connected(self, filter_id, depth_bound):

Add a filter that retains elements connected (parents, links, children) to elements matching filter_id, up to depth_bound.

def add_filter_element_set_parents(self, filter_id, depth_bound):

Add a filter that retains elements whose ancestors match filter_id, up to depth_bound.

def add_filter_element_set_children(self, filter_id, depth_bound):

Add a filter that retains elements whose descendants match filter_id, up to depth_bound.

def add_filter_element_set_type(self, filter_id):

Add a filter that retains only elements whose type matches the regex filter_id.

def add_filter_element_set_id(self, filter_id):

Add a filter that retains only elements whose identifier matches the regex filter_id.

def add_filter_element_set_property(self, property_name, property_value):

Add a filter that retains only elements whose named property value matches the regex property_value.

def process_trace_elements(self, parser_element_list, print_l=<function print_null>):

Simulate a trace over the model, counting how often each element and its linked targets are visited.

def get_parser_elements_from_filepath( filepath, elements_list, print_l=<function print_null>, file_opener=<function open_input_file>, read_input_set=None):

Read the file at filepath line-by-line, apply directives, and append SBDL_Parser.Parser_Element objects to elements_list.

def aggregate_all_parser_elements_from_files( input_list, do_recurse, do_hidden, print_l=<function print_null>, file_opener=<function open_input_file>, read_input_set=None):

Read all files/directories in input_list and return (parser_elements, error_count).

def aggregate_all_parser_elements_from_json( input_list, do_recurse, do_hidden, print_l=<function print_null>, file_opener=<function open_input_file>):

Read JSON files from input_list and return (parser_elements, error_count).

def aggregate_all_parser_elements_from_yaml( input_list, do_recurse, do_hidden, print_l=<function print_null>, file_opener=<function open_input_file>):

Read YAML files from input_list and return (parser_elements, error_count).

def aggregate_all_parser_elements_from_csv( input_list, do_recurse, do_hidden, print_l=<function print_null>, file_opener=<function open_input_file>):

Read CSV files from input_list and return (parser_elements, error_count).

def write_requirement_graph_output(sbdl_ast, output_file, file_opener, arguments, print_l):

Generate a PlantUML WBS requirements diagram from the AST and write it to output_file.

def write_decomposition_graph_output(sbdl_ast, output_file, file_opener, arguments, print_l):

Generate a PlantUML component/decomposition diagram from the AST and write it to output_file.

def write_element_graph_output(sbdl_ast, output_file, file_opener, arguments, print_l):

Generate a detailed PlantUML class/element diagram showing all element properties and relations.

def write_function_graph_output(sbdl_ast, output_file, file_opener, arguments, print_l):

Generate a PlantUML sequence diagram of function/event flows and write it to output_file.

def write_process_graph_output(sbdl_ast, output_file, file_opener, _, print_l):

Generate a PlantUML activity/process diagram from the AST and write it to output_file.

def write_state_graph_output(sbdl_ast, output_file, file_opener, arguments, print_l):

Generate a PlantUML state-machine diagram from the AST and write it to output_file.

def write_usecase_graph_output(sbdl_ast, output_file, file_opener, arguments, print_l):

Generate a PlantUML use-case diagram from the AST and write it to output_file.

def write_network_graph_output(sbdl_ast, output_file, _, arguments, print_l):

Generate a networkx/matplotlib network graph of all elements and write it to output_file.

def write_sigma_graph_output(sbdl_ast, output_file, _, arguments, print_l):

Generate an interactive Sigma.js HTML network graph from the AST and write it to output_file.

class OpenFMEA:

Utilities for generating FMEA table data from an SBDL AST.

@classmethod
def generate_sbdl_table_from_ast( self, sbdl_ast, id_in_body=False, source_in_body=False, print_l=<function print_null>, multi_field_separator=None):

Traverse the fully-connected CME graph and return a list of FMEA row dicts.

@classmethod
def struct_from_table(self, title, sbdl_table, open_fmea_type='FMEA'):

Wrap an FMEA table in an OpenFMEA metadata envelope dict.

@classmethod
def read_file(self, file_path):

Open an OpenFMEA JSON file and return its parsed dict content.

@classmethod
def write_struct_to_file(self, open_sbdl_struct, open_sbdl_file, pretty=True):

Serialise open_sbdl_struct as JSON to open_sbdl_file, with optional pretty-printing.

@classmethod
def read_struct_from_file(self, open_sbdl_file):

Parse and validate an OpenFMEA JSON file, raising if the format or type is incorrect.

@classmethod
def write_opensbdl_output(self, sbdl_ast, output_file, file_opener, arguments, print_l):

Generate an OpenFMEA JSON file from the AST and write it to output_file.

@classmethod
def write_opensbdl_portfolio_output(self, sbdl_ast, output_file, file_opener, arguments, print_l):

Generate an OpenFMEA Portfolio JSON file, organising FMEA rows by aspect hierarchy.

@classmethod
def elements_from_table(self, sbdl_table, _):

Convert an OpenFMEA table (list of row dicts) back into a list of SBDL_Element_Synthetic objects.

@classmethod
def elements_from_general(self, general_entries, fmea_elements, _):

Convert general (non-FMEA) OpenFMEA entries into SBDL_Element_Synthetic objects linked to fmea_elements.

@classmethod
def statements_from_openfmea(self, openfmea_data, source_name):

Extract Parser_Element objects from an OpenFMEA data dict, covering both FMEA and general elements.

@classmethod
def aggregate_all_parser_elements_from_files(self, source_files, recurse, hidden, print_l):

Read OpenFMEA JSON files and return (parser_elements, error_count).

def write_csv_output(sbdl_ast, output_file, file_opener, arguments, print_l):

Generate a CSV FMEA table from the AST and write it to output_file.

def write_aggregated_output(sbdl_ast, output_file, file_opener, __, print_l):

Write all AST elements as SBDL statements to output_file, optionally sorted and pretty-printed.

def write_rpc_output(sbdl_ast, output_file, file_opener, arguments, print_l):

Send AST elements to a remote REST endpoint for processing and write the response to output_file.

def query_output(sbdl_ast, _, __, ___, ____):

Print a human-readable summary of every element in the AST to stdout.

def write_matrixcsv_output(sbdl_ast, output_file, file_opener, __, ___):

Write a flat CSV matrix of all element attributes (from the full AST dict) to output_file.

def write_matrixjson_output(sbdl_ast, output_file, file_opener, __, ___):

Write the full AST as an indented JSON dict to output_file.

def write_yaml_tree_output(sbdl_ast, output_file, file_opener, __, ___):

Write the full AST as a YAML document to output_file.

def template_docx_file(template_dict, infile, outfile):

Render infile as a docxtpl Word template with template_dict context and save to outfile.

def write_template_fill(sbdl_ast, output_file, file_opener, arguments, print_l):

Render a Jinja2 or Office template (txt/docx/xlsx) with AST data and write the result to output_file.

def import_custom_directive_file(file_path, print_l):

Dynamically load a Python file and merge its DIRECTIVES dict into the global parser directives.

def import_custom_modes_file(file_path, print_l):

Dynamically load a Python file defining custom output modes and register them.

def f_print( *content, end=None, error=False, verbose=True, do_debug=False, debug=False, do_warning=True, warning=False, opts=None, prefix=None):

Print formatted output to stdout (or stderr for errors/warnings) with optional ANSI colour codes.

def main(arguments):

Entry point for a single compilation run: read inputs, build AST, apply filters, validate, and write output.