API

blark.apischema_compat

blark.apischema_compat.alternative_constructor(func)

Alternative constructor for a given type.

blark.apischema_compat.as_tagged_union(cls)

Tagged union decorator, to be used on base class.

blark.apischema_compat.get_all_subclasses(cls)

Recursive implementation of type.__subclasses__

blark.apischema_compat.token_deserializer(parts)

blark.apischema_compat.token_serializer(token)

blark.config

blark.dependency_store

blark.dependency_store.DependencyStore(root)

A storage container for dependency configuration and loading.

blark.dependency_store.DependencyStoreConfig(...)

Dependency store configuration, from config.json.

blark.dependency_store.DependencyStoreLibrary(...)

blark.dependency_store.PlcProjectMetadata(...)

This is a per-PLC project metadata container.

blark.dependency_store.get_dependency_store()

Get the global DependencyStore instance.

blark.dependency_store.load_projects(*projects)

Load the given projects by filename.

blark.format

blark.format.build_arg_parser([argparser])

blark.format.determine_output_filename(...)

Get an output filename based on the input filename and destination path.

blark.format.dump_source_to_console(source)

Output the given source to the console.

blark.format.get_reformatted_code_blocks(results)

For each parsed code block, generate an OutputBlock for writing to disk.

blark.format.main(filename[, verbose, ...])

blark.format.reformat_code(code)

Reformat the code with the provided settings.

blark.format.write_source_to_file(filename, ...)

Write source code to the given file.

blark.html

blark.html.HighlighterAnnotation(name, ...)

A single HTML tag annotation which applies to a position range of source code.

blark.html.HtmlWriter(user, source_filename, ...)

blark.html.apply_annotations_to_code(code, ...)

blark.html.get_annotations(tree)

Get annotations for syntax elements in the given parse tree.

blark.input

blark.input.BlarkCompositeSourceItem(...[, user])

blark.input.BlarkSourceItem(identifier, ...)

blark.input.BlarkSourceLine(filename, ...)

blark.input.UnsupportedFileFormatError

blark.input.load_file_by_name(filename[, ...])

Load a file using blark's file input handlers.

blark.input.register_input_handler(...)

blark.main

blark.main.main()

blark.output

blark.output.OutputBlock(code, metadata, origin)

blark.output.get_handler_by_name(name)

blark.output.register_output_handler(name, ...)

blark.parse

blark.parse.BlarkStartingRule(value)

An enumeration.

blark.parse.ParseResult(source_code, item, ...)

blark.parse.build_arg_parser([argparser])

blark.parse.dump_json(type_, obj[, ...])

Dump object obj as type type_ with apischema and serialize to a string.

blark.parse.get_parser()

Get a cached lark.Lark parser for TwinCAT flavor IEC61131-3 code.

blark.parse.main(filename[, verbose, debug, ...])

Parse the given source code/project.

blark.parse.new_parser([start])

Get a new parser for TwinCAT flavor IEC61131-3 code.

blark.parse.parse(path[, input_format])

Parse the given source code file (or all files from the given project).

blark.parse.parse_item(item, **kwargs)

blark.parse.parse_project(tsproj_project, ...)

Parse an entire tsproj project file.

blark.parse.parse_single_file(fn, **kwargs)

Parse a single source code file.

blark.parse.parse_source_code(source_code, *)

Parse source code into a ParseResult.

blark.parse.summarize(parsed[, squash])

Get a code summary instance from one or more ParseResult instances.

blark.plain

blark.plain.PlainFileLoader(filename, ...)

blark.solution

blark.solution.DependencyInformation(name[, ...])

blark.solution.DependencyVersion(name, ...)

blark.solution.LocatedString(filename[, ...])

blark.solution.Project(name, saved_path, ...)

A stub container for a TwinCAT project (.tsproj) file.

blark.solution.Solution(root, projects[, ...])

A container for a TwinCAT/Visual Studio solution (.sln).

blark.solution.SolutionLoaderError

Solution loader-related exception base class.

blark.solution.TcAction(name, guid, decl, ...)

blark.solution.TcDUT(name, guid, decl, ...)

blark.solution.TcDeclImpl(identifier, ...[, ...])

blark.solution.TcExtraInfo(metadata, xml, parent)

Extra information in the project XML such as Line IDs.

blark.solution.TcGVL(name, guid, decl, ...)

blark.solution.TcIO(name, guid, decl, ...)

TcIO file - for INTERFACE definitions.

blark.solution.TcMethod(name, guid, decl, ...)

blark.solution.TcPOU(name, guid, decl, ...)

blark.solution.TcProperty(name, guid, decl, ...)

blark.solution.TcSource(name, guid, decl, ...)

blark.solution.TcSourceChild(name, guid, ...)

blark.solution.TcTTO(name, guid, decl, ...)

blark.solution.TcUnknownXml(xml, parent)

A currently unsupported block of XML in the project.

blark.solution.TwincatPlcProject(guid, ...)

A TwinCAT PLC project.

blark.solution.TwincatSourceCodeItem(...[, ...])

A wrapper for all TwinCAT project source code files.

blark.solution.TwincatTsProject(guid, netid, ...)

Container for a loaded TwinCAT tsproj project.

blark.solution.UnsupportedSourceFileError(msg)

Unsupported project file.

blark.solution.filename_from_xml(xml)

blark.solution.get_blark_input_from_solution(...)

Get all blark input from the given solution.

blark.solution.get_child_located_text(xml, tag)

blark.solution.get_child_text(xml, tag[, ...])

blark.solution.get_code_object_from_xml(xml)

blark.solution.get_project_guid(element)

Get a project target GUID from its xml.

blark.solution.get_project_target_netid(element)

Get a project target AMS Net ID from its xml.

blark.solution.get_tcplc_from_xml(xml)

blark.solution.make_solution_from_files(filename)

From a TwinCAT solution (.sln) or .tsproj, get a Solution instance.

blark.solution.parse_xml_contents(contents)

Parse the given XML contents with lxml.etree.

blark.solution.parse_xml_file(fn)

Parse a given XML file with lxml.etree.parse.

blark.solution.project_loader(filename)

Load a TwinCAT project (.tsproj) file.

blark.solution.projects_from_solution_source(...)

Find project filenames from the contents of a solution.

blark.solution.solution_loader(filename)

Load a TwinCAT solution (.sln) file.

blark.solution.split_property_and_base_decl(code)

blark.solution.strip_implicit_lines(code, ...)

Strip off (e.g.) END_FUNCTION_BLOCK the provided code.

blark.solution.strip_xml_namespace(tag)

Strip off {{namespace}} from: {{namespace}}tag.

blark.solution.twincat_file_loader(filename)

Load a single TwinCAT file based on its extension.

blark.solution.twincat_file_writer(user, ...)

Write source code

blark.sphinxdomain

blark.sphinxdomain.BlarkDirective(name, ...)

blark.sphinxdomain.BlarkDirectiveWithDeclarations(...)

blark.sphinxdomain.BlarkDomain(env)

Blark IEC61131-3 language domain.

blark.sphinxdomain.BlarkSphinxCache(cache)

blark.sphinxdomain.BlarkXRefRole([...])

blark.sphinxdomain.DeclarationDirective(...)

blark.sphinxdomain.FunctionBlockDirective(...)

blark.sphinxdomain.FunctionDirective(name, ...)

blark.sphinxdomain.GvlDirective(name, ...)

blark.sphinxdomain.MissingDeclaration(name)

blark.sphinxdomain.ProgramDirective(name, ...)

blark.sphinxdomain.TypeDirective(name, ...)

blark.sphinxdomain.VariableBlockDirective(...)

blark.sphinxdomain.declaration_to_content(obj)

blark.sphinxdomain.declaration_to_signature(...)

blark.sphinxdomain.declarations_to_block(...)

blark.sphinxdomain.setup(app)

blark.summary

blark.summary.ActionSummary(comments, ...[, ...])

Summary representation of a single action.

blark.summary.CodeSummary(functions, ...)

Summary representation of a set of code - functions, function blocks, etc.

blark.summary.DataTypeSummary(comments, ...)

Summary representation of a single data type.

blark.summary.DeclarationSummary(comments, ...)

Summary representation of a single declaration.

blark.summary.FunctionBlockSummary(comments, ...)

Summary representation of a single function block.

blark.summary.FunctionSummary(comments, ...)

Summary representation of a single function.

blark.summary.GlobalVariableSummary(...)

Summary representation of a VAR_GLOBAL block.

blark.summary.InterfaceSummary(comments, ...)

Summary representation of an Interfae.

blark.summary.LinkableItems(input, output, ...)

A summary of linkable (located) declarations.

blark.summary.MethodSummary(comments, ...)

Summary representation of a single method.

blark.summary.ProgramSummary(comments, ...)

Summary representation of a single program.

blark.summary.PropertyGetSetSummary(...)

blark.summary.PropertySummary(comments, ...)

Summary representation of a single property.

blark.summary.Summary(comments, pragmas, ...)

Base class for summary objects.

blark.summary.get_linkable_declarations(...)

Get all located/linkable declarations.

blark.summary.path_to_file_and_line(path)

Get the file/line number context for the summary items.

blark.summary.text_outline(item)

Get a generic multiline string representation of the given object.

blark.transform

blark.transform.AccessDeclaration(name, ...)

A single, named program access declaration.

blark.transform.AccessDeclarations(items[, meta])

A block of named, program access variable declarations (VAR_ACCESS).

blark.transform.AccessSpecifier(value)

An enumeration.

blark.transform.Action(name, body[, meta])

A full, named action declaration.

blark.transform.ArrayInitialElement(element)

Initial value for an array element (potentialy repeated).

blark.transform.ArrayInitialization(elements)

Array initialization (bare or bracketed).

blark.transform.ArraySpecification(...[, meta])

An array specification.

blark.transform.ArrayTypeDeclaration(name, init)

Full declaration of an array type.

blark.transform.ArrayTypeInitialization(...)

Array specification and optional default (initialization) value.

blark.transform.ArrayVariableInitDeclaration(...)

A declaration of one or more variables with array type initialization and optional default (initialization) value.

blark.transform.AssignmentStatement(...[, meta])

An assignment statement.

blark.transform.BinaryBitString(type_name, value)

Binary bit string literal value.

blark.transform.BinaryInteger(value[, ...])

blark.transform.BinaryOperation(left, op, right)

A binary (i.e., two operand) operation.

blark.transform.BitString(type_name, value)

Bit string literal value.

blark.transform.Boolean(value[, meta])

Boolean literal value.

blark.transform.BracketedExpression(expression)

An expression with square brackets around it.

blark.transform.CaseElement(matches, statements)

A single element of a CASE statement block.

blark.transform.CaseStatement(expression, ...)

A switch-like CASE statement block.

blark.transform.ChainedFunctionCall(invocations)

A set of chained function (function block, method, action, etc.) calls.

blark.transform.ChainedFunctionCallStatement(...)

A chained set of function calls as a statement, in a "fluent" style.

blark.transform.ContinueStatement([meta])

A statement used to jump to the top of a loop, CONTINUE.

blark.transform.DataType(indirection, type_name)

A non-generic type name, or a data type name.

blark.transform.DataTypeDeclaration(...[, meta])

A data type declaration, wrapping the other declaration types with TYPE/END_TYPE.

blark.transform.Date(year, month, day[, meta])

Date literal value.

blark.transform.DateTime(date, time[, meta])

Date and time literal value.

blark.transform.DeclaredVariable(variable, ...)

A single declared variable name and optional [direct or incomplete] location.

blark.transform.DirectVariable(...[, bits, meta])

Direct variables with I/O linkage.

blark.transform.Duration([days, hours, ...])

Duration literal value.

blark.transform.EdgeDeclaration(variables, edge)

An edge declaration of one or more variables.

blark.transform.ElseClause(statements[, meta])

The ELSE part of an IF/ELSIF/ELSE/END_IF block.

blark.transform.ElseIfClause(if_expression, ...)

The else-if ELSIF part of an IF/ELSIF/ELSE/END_IF block.

blark.transform.EnumeratedSpecification(...)

An enumerated specification.

blark.transform.EnumeratedTypeDeclaration(...)

An enumerated type declaration.

blark.transform.EnumeratedTypeInitialization(...)

Enumerated specification with initialization enumerated value.

blark.transform.EnumeratedValue(type_name, ...)

An enumerated value.

blark.transform.ExitStatement([meta])

A statement used to exit a loop, EXIT.

blark.transform.Expression()

Base class for all types of expressions.

blark.transform.ExtendedSourceCode(items[, ...])

Top-level source code item - extended to include the possibility of standalone implementation details (i.e., statement lists).

blark.transform.Extends(name[, meta])

The "EXTENDS" portion of a function block, interface, structure, etc.

blark.transform.ExternalVariableDeclaration(...)

A named, external variable declaration inside a variable block.

blark.transform.ExternalVariableDeclarations(...)

A block of named, external variable declarations (VAR_EXTERNAL).

blark.transform.FieldSelector(field, ...[, meta])

Field - or attribute - selector as part of a multi-element variable.

blark.transform.ForStatement(control, from_, ...)

A loop with a control variable and a start, stop, and (optional) step value.

blark.transform.FormatSettings([indent])

blark.transform.FullSubrange([meta])

A full subrange (i.e., asterisk *).

blark.transform.Function(access, name, ...)

A full function block type declaration, with nested variable declaration blocks.

blark.transform.FunctionBlock(name, access, ...)

A full function block type declaration.

blark.transform.FunctionBlockDeclaration()

Base class for declarations of variables using function blocks.

blark.transform.FunctionBlockInvocationDeclaration(...)

Base class for declarations of variables using function blocks by invocation.

blark.transform.FunctionBlockNameDeclaration(...)

Base class for declarations of variables using function blocks by name.

blark.transform.FunctionCall(name, ...[, meta])

A function (function block, method, action, etc.) call.

blark.transform.FunctionCallStatement(name, ...)

A function (function block, method, action, etc.) call as a statement.

blark.transform.FunctionVariableDeclarations(...)

blark.transform.GlobalVariableAttributes(value)

An enumeration.

blark.transform.GlobalVariableDeclaration(...)

A declaration of one or more global variables: name and location specification and initialization type.

blark.transform.GlobalVariableDeclarations(...)

Global variable declarations block (VAR_GLOBAL).

blark.transform.GlobalVariableSpec(...[, meta])

Global variable specification; the part that comes before the initialization.

blark.transform.GrammarTransformer([...])

Grammar transformer which takes lark objects and makes a SourceCode.

blark.transform.HexBitString(type_name, value)

Hex bit string literal value.

blark.transform.HexInteger(value[, ...])

blark.transform.IfStatement(if_expression, ...)

The IF part of an IF/ELSIF/ELSE/END_IF block.

blark.transform.Implements(interfaces[, meta])

The "IMPLEMENTS" portion of a function block, indicating it implements one or more interfaces.

blark.transform.IncompleteLocatedVariableDeclaration(...)

A named, incomplete located variable declaration inside a variable block.

blark.transform.IncompleteLocatedVariableDeclarations(...)

Incomplete located variable declarations block (VAR).

blark.transform.IncompleteLocation(value)

Incomplete location information.

blark.transform.IndirectSimpleSpecification(...)

A simple specification with the possibility of indirection.

blark.transform.IndirectionType(...[, meta])

Indirect access through a pointer or reference.

blark.transform.InitDeclaration()

Base class for a declaration of one or more variables with a type initialization.

blark.transform.InitializedStructure(name, init)

A named initialized structure.

blark.transform.InputDeclarations(attrs, items)

A block of named, input variable declarations (VAR_INPUT).

blark.transform.InputOutputDeclarations(...)

A block of named, input/output variable declarations (VAR_IN_OUT).

blark.transform.InputParameterAssignment(...)

An input parameter in a function call.

blark.transform.Integer(value[, type_name, meta])

Integer literal value.

blark.transform.Interface(name, extends, ...)

A full interface declaration, with nested variable declaration blocks.

blark.transform.JumpStatement(label[, meta])

This is the "goto"-style JMP, which points at a label.

blark.transform.LabeledStatement(label[, ...])

A statement marked with a user-defined label.

blark.transform.Ldate(year, month, day[, meta])

Long date literal value.

blark.transform.LdateTime(ldate, ltime[, meta])

Long date and time literal value.

blark.transform.Lduration([days, hours, ...])

Long duration literal value.

blark.transform.Literal()

Base class for all literal values.

blark.transform.LocatedVariableDeclaration(...)

Declaration of a variable in a VAR block that is located.

blark.transform.LocatedVariableDeclarations(...)

Located variable declarations block (VAR).

blark.transform.Location(location_prefix, ...)

A located direct variable.

blark.transform.LtimeOfDay(hour, minute[, ...])

Long time of day literal value.

blark.transform.Meta(empty, column, ...)

Lark-derived meta information in the form of a dataclass.

blark.transform.Method(access, name, ...[, meta])

A full, named method declaration.

blark.transform.MethodInstanceVariableDeclarations(...)

Declarations block for instance variables in methods (VAR_INST).

blark.transform.MultiElementVariable(name, ...)

A multi-element variable - with one or more subscripts and fields.

blark.transform.NoOpStatement(variable[, meta])

A no-operation statement referring to a variable and nothing else.

blark.transform.ObjectInitializerArray(name, ...)

Object initialization in array form.

blark.transform.OctalBitString(type_name, value)

Octal bit string literal value.

blark.transform.OctalInteger(value[, ...])

blark.transform.OutputDeclarations(attrs, items)

A block of named, output variable declarations (VAR_OUTPUT).

blark.transform.OutputParameterAssignment(...)

A named output parameter, which may be inverted.

blark.transform.ParameterAssignment()

Base class for assigned parameters in function calls.

blark.transform.ParenthesizedExpression(expr)

An expression with parentheses around it.

blark.transform.PartialSubrange(start, stop)

A partial subrange, including a start/stop element index.

blark.transform.Program(name, declarations, body)

A full program declaration, with nested variable declaration blocks.

blark.transform.Property(access, name, ...)

A named property declaration, which may pertain to a get or set.

blark.transform.Real(value[, type_name, meta])

Floating point (real) literal value.

blark.transform.ReferenceAssignmentStatement(...)

A reference assignment statement.

blark.transform.RepeatStatement(statements, ...)

An ending conditional loop statement, REPEAT.

blark.transform.ResetStatement(variable, op, ...)

A "reset" statement which conditionally clears a variable to FALSE.

blark.transform.ReturnStatement([meta])

A statement used to return from a function [block], RETURN.

blark.transform.SetStatement(variable, op, ...)

A "set" statement which conditionally sets a variable to TRUE.

blark.transform.SimpleSpecification(type[, meta])

A simple specification with just a type name (or a string type name).

blark.transform.SimpleTypeDeclaration(name, ...)

A declaration of a simple type.

blark.transform.SimpleVariable(name, ...[, meta])

A simple, single-element variable.

blark.transform.SourceCode(items[, ...])

Top-level source code item.

blark.transform.Statement()

Base class for all statements in a structured text implementation section.

blark.transform.StatementList(statements[, meta])

A list of statements, making up a structured text implementation.

blark.transform.StaticDeclarations(attrs, items)

Static variable declarations block (VAR_STAT).

blark.transform.String(value[, meta])

String literal value.

blark.transform.StringSpecLength(length)

The length of a defined string.

blark.transform.StringTypeDeclaration(name, ...)

A string type declaration.

blark.transform.StringTypeInitialization(...)

Single or double-byte string specification.

blark.transform.StringTypeSpecification(...)

Specification of a string type.

blark.transform.StringVariableInitDeclaration(...)

A declaration of one or more variables using single/double byte strings, with an optinoal initialization value.

blark.transform.StructureElementDeclaration(...)

Declaration of a single element of a structure.

blark.transform.StructureElementInitialization(...)

An initialization (default) value for a structure element.

blark.transform.StructureInitialization(elements)

A structure initialization (i.e., default values) of one or more elements.

blark.transform.StructureTypeDeclaration(...)

Full structure type declaration, as part of a TYPE.

blark.transform.StructuredVariableInitDeclaration(...)

A declaration of one or more variables using a named initialized structure.

blark.transform.Subrange()

Subrange base class.

blark.transform.SubrangeSpecification(type_name)

A subrange specification.

blark.transform.SubrangeTypeDeclaration(...)

A subrange type declaration.

blark.transform.SubrangeTypeInitialization(...)

A subrange type initialization.

blark.transform.SubscriptList(subscripts, ...)

A list of subscripts.

blark.transform.TemporaryVariableDeclarations(items)

Temporary variable declarations block (VAR_TEMP).

blark.transform.TimeOfDay(hour, minute[, ...])

Time of day literal value.

blark.transform.TypeInformation(...)

Type information derived from a specification or initialization.

blark.transform.TypeInitialization(spec, value)

A simple initialization specification of a type name.

blark.transform.TypeInitializationBase()

Base class for type initializations.

blark.transform.TypeSpecificationBase()

Base class for a specification of a type.

blark.transform.UnaryOperation(op, expr[, meta])

A unary - single operand - operation: NOT, -, or +.

blark.transform.UnionElementDeclaration(...)

Declaration of a single element of a union.

blark.transform.UnionTypeDeclaration(name, ...)

A full declaration of a UNION type, as part of a TYPE/END_TYPE block.

blark.transform.UnresolvedTypeInformation(...)

blark.transform.Variable()

Variable base class.

blark.transform.VariableAttributes(value)

An enumeration.

blark.transform.VariableDeclarationBlock()

Base class for variable declaration blocks.

blark.transform.VariableDeclarations(attrs, ...)

Variable declarations block (VAR).

blark.transform.VariableLocationPrefix(value)

An enumeration.

blark.transform.VariableOneInitDeclaration(...)

A declaration of one or more variables with a type, subrange, or enumerated type initialization.

blark.transform.VariableSizePrefix(value)

Size prefix, used in locations (e.g., %IX1.1 has a bit prefix).

blark.transform.WhileStatement(expression, ...)

A beginning conditional loop statement, WHILE.

blark.transform._ArrayInitialElementCount()

An internal handler for array initial elements with repeat count values.

blark.transform._BareArrayInitialization()

Internal handler for array initialization, without brackets

blark.transform._BracketedArrayInitialization()

Internal handler for array initialization with brackets.

blark.transform._FlagHelper()

A helper base class which translates tokens to enum.Flag instances.

blark.transform._GenericInit(base_type_name, ...)

API compat to give a valid init attribute.

blark.transform.configure_formatting(settings)

Override the default code formatting settings.

blark.transform.get_grammar_for_class(cls)

Given a class, get blark's iec.lark associated grammar definition(s).

blark.transform.indent(value[, prefix])

Stringified and indented {value}.

blark.transform.indent_if(value[, prefix])

Stringified and indented {value} if not None.

blark.transform.join_if(value1, delimiter, ...)

'{value1}{delimiter}{value2} if value1 and value2, otherwise just {value1} or {value2}.

blark.transform.merge_comments(source, comments)

Take the transformed tree and annotate comments back into meta information.

blark.transform.meta_field()

Create the Meta field for the dataclass magic.

blark.transform.multiline_code_block(block)

Multiline code block with lax beginning/end newlines.

blark.transform.transform(source_code, tree)

Transform a lark.Tree into dataclasses.

blark.typing

blark.typing.ContainsBlarkCode(*args, **kwargs)

Indicates that the given class can emit blark-compatible source items.

blark.typing.SupportsRewrite(*args, **kwargs)

blark.typing.SupportsSaveToPath(*args, **kwargs)

blark.typing.SupportsWrite(*args, **kwargs)

blark.util

blark.util.Identifier(parts[, decl_impl])

A blark convention for giving portions of code unique names.

blark.util.SourceType(value)

An enumeration.

blark.util.find_and_clean_comments(text, *)

Clean nested multiline comments from text.

blark.util.find_pou_type_and_identifier(code)

blark.util.fix_case_insensitive_path(path)

Match a path in a case-insensitive manner.

blark.util.get_file_sha256(filename)

Hash a file's contents with the SHA-256 algorithm.

blark.util.get_grammar_for_rule(rule)

Get the lark grammar source for the provided rule.

blark.util.get_grammar_source()

blark.util.get_source_code(fn, *[, encoding])

Get source code from the given file.

blark.util.indent_inner(text, prefix)

Indent the inner lines of text (not first and last) with prefix.

blark.util.maybe_add_brackets(text[, brackets])

Add brackets to text if there are no enclosing brackets.

blark.util.python_debug_session(namespace, ...)

Enter an interactive debug session with pdb or IPython, if available.

blark.util.rebuild_lark_tree_with_line_map(...)

Rebuild a given lark tree, adjusting line numbers to match up with the source.

blark.util.recursively_remove_keys(obj, keys)

Remove the provided keys from the JSON object.

blark.util.remove_all_comments(text, *[, ...])

Remove all comments and replace them with the provided character.

blark.util.remove_comment_characters(text)

Take only the inner contents of a given comment.

blark.util.simplify_brackets(text[, brackets])

Simplify repeated brackets/parentheses in text.

blark.util.tree_to_xml_source(tree[, ...])

Return the contents to write for the given XML tree.

blark.util.try_paths(paths)