finesse.script package
Submodules
- finesse.script.adapter module
AnalysisDocumenterAnalysisDumpAnalysisDumperAnalysisFactoryAnalysisSetterArgumentArgumentDumpArgumentTypeBoundArgumentCommandDumpCommandMethodDocumenterCommandMethodSetterCommandPropertyDocumenterCommandPropertyDumperCommandPropertySetterEMPTY_VALUEElementDocumenterElementDumpElementDumperElementFactoryElementSetterElementSyntaxMixinFunctionalSyntaxMixinItemAdapterItemDocumenterItemDumperItemFactoryItemHandlerItemSetterNumpyStyleDocstringGetterMixinSignatureArgumentMixinSignatureAttributeParameterMixinSyntaxMixin
- finesse.script.compiler module
- finesse.script.containers module
AddressableArgumentContainerBaseCustomTokenExtraTokenContainerKatArrayKatBooleanTokenKatBoundsKatCoordinateKatElementKatExpressionKatFileKatFixMeTokenKatFunctionKatGroupedExpressionKatKwargKatMetaTokenKatNoneTokenKatNumberTokenKatNumericalArrayKatScriptKatScriptItemKatStringTokenKatTokenKatWhitespaceTokenTokenContainerTokenMixin
- finesse.script.exceptions module
- finesse.script.generator module
- finesse.script.graph module
- finesse.script.highlighter module
- finesse.script.legacy module
- finesse.script.memoize module
- finesse.script.parser module
- finesse.script.spec module
- finesse.script.tokenizer module
- finesse.script.tokens module
- finesse.script.util module
Module contents
Parsing and unparsing of Finesse kat files and models.
- finesse.script.help_(directive, spec=None)[source]
Get help for directive, which can be any of a KatScript instruction, a KatScript path (e.g. mirror.T), or a Finesse or Python object or type.
- Strings are interpreted as attempted KatScript and supports simple wildcard
characters, see
finesse.syntax()for details.
For other Python objects this shows the same as builtin
help()but adds a reference to the relevant KatScript where applicable.Like the Python builtin
help(), this opens a pager containing the help text in the current console.Parameters
Raises
- ValueError
If directive cannot be recognised as a valid Finesse or KatScript item.
- finesse.script.parse(text, model=None, spec=None)[source]
Parse KatScript into a model.
Parameters
Returns
ModelThe parsed model.
- finesse.script.parse_file(path, model=None, spec=None)[source]
Parse KatScript from a file into a model.
Parameters
- pathstr or
io.FileIO The path or file object to read KatScript from. If an open file object is passed, it will be read from and left open. If a path is passed, it will be opened, read from, then closed.
- model
Model, optional The Finesse model to add the parsed objects to. Defaults to a new, empty model.
- spec
KatSpec, optional The language specification to use. Defaults to the shared
KatSpecinstance.
Returns
ModelThe parsed model.
- pathstr or
- finesse.script.parse_legacy(text, model=None, ignored_blocks=None)[source]
Parse KatScript into a model.
Parameters
- textstr
The KatScript to parse.
- model
Model The Finesse model to add the parsed objects to.
- ignored_blockslist, optional
A list of names of
FTBLOCKsections in the kat code to leave out of the model; defaults to empty list.
Returns
ModelThe parsed model.
Raises
- NotImplementedError
If model contains any non-default elements. Parsing into existing models is unsupported.
- finesse.script.parse_legacy_file(path, model=None, ignored_blocks=None)[source]
Parse KatScript from a file into a model.
Parameters
- pathstr or
io.FileIO The path or file object to read KatScript from. If an open file object is passed, it will be read from and left open. If a path is passed, it will be opened, read from, then closed.
- model
Model The Finesse model to add the parsed objects to.
- ignored_blockslist, optional
A list of names of
FTBLOCKsections in the kat code to leave out of the model; defaults to empty list.
Returns
ModelThe parsed model.
Raises
- NotImplementedError
If model contains any non-default elements. Parsing into existing models is unsupported.
- pathstr or
- finesse.script.syntax(query='', spec=None, verbose=False, elements=True, commands=True, analyses=True, keyword_arguments=True, exact=False, suggestions=True, **kwargs)[source]
Query the KatScript syntax documentation for query.
Supports simple wildcard characters:
*matches 0 or more characters?matches any single character[abc]matches any characters in abc[!abc]matches any characters not in abc
If there is a
.in query, everything before that is assumed to be a directive and everything after to be a parameter.A
*is added to the end of each query term, set exact to False to prevent this.If no match is found some suggestions will be shown. Set suggestions to False to disable suggestions.
If query is an empty string all syntax documentation will be shown.
For more detailed help try
finesse.help().Parameters
- querystr
The directive to retrieve syntax for.
- spec
KatSpec, optional The language specification to use. Defaults to the shared
KatSpecinstance.- verbosebool, default False
Show documentation for the directive.
- elementsbool, default True
Whether to search for elements.
- commandsbool, default True
Whether to search for commands.
- analysesbool, default True
Whether to search for analyses.
- keyword_argumentsbool, default True
Show keyword arguments where supported.
- exactbool, default False
If True only documentation for an exact match will be shown.
- suggestionsbool, default True
Whether to show suggestions if no match is found.
Other Parameters
- kwargsdict, optional
Keyword arguments supported by
ItemDocumenter.syntax().
Returns
- str
The syntax for query.