scinumtools.dip package

Subpackages

Submodules

scinumtools.dip.dip module

class scinumtools.dip.dip.DIP(env: Environment | None = None, **kwargs)

Bases: object

DIP parser class

Parameters:
  • code (str) – DIP code

  • env (DIP_Environment) – DIP environment object

add_file(filepath: str, source_name: str | None = None, absolute=True)

Load DIP code from a file

Parameters:
  • filepath (str) – Path to a DIP file

  • absolute (bool) – Path is absolute

add_function(name: str, fn: Callable)
add_source(name: str, path: str)
add_string(code: str)

Use DIP code from a string

Parameters:

code (str) – DIP code

add_unit(name: str, value: float, unit: str | None = None)
env: Environment
lines: List[dict]
name: str
nodes_hierarchy: list = ['group']
nodes_nohierarchy: list = None
nodes_notypes: list = None
nodes_properties: list = ['option', 'constant', 'format', 'condition', 'tags', 'description']
nodes_special: list = ['empty', 'unit', 'source']
num_files: int = 0
num_strings: int = 0
parse()

Parse DIP nodes from code lines

parse_docs()

Parse DIP node definitions for a documentation

setup()
source: tuple

scinumtools.dip.environment module

class scinumtools.dip.environment.Environment(nodes: scinumtools.dip.lists.list_nodes.NodeList = <factory>, units: scinumtools.dip.lists.list_units.UnitList = <factory>, sources: scinumtools.dip.lists.list_sources.SourceList = <factory>, functions: scinumtools.dip.lists.list_functions.FunctionList = <factory>, hierarchy: scinumtools.dip.lists.list_hierarchy.HierarchyList = <factory>, branching: scinumtools.dip.lists.list_branching.BranchingList = <factory>, autoref: str = None, envtype: scinumtools.dip.settings.EnvType = 1)

Bases: object

autoref: str = None
branching: BranchingList
copy()

Copy a new object from self

data(format: Format = 1, verbose: bool = False, query: str | None = None, tags: list | None = None)

Return parsed values as a dictionary

Parameters:
  • verbose (bool) – Display node values

  • format (str) – Return data as values only, DIP datatypes, or tuples

  • query (str) – Node selection query

  • tags (list) – List of tags

envtype: EnvType = 1
functions: FunctionList
hierarchy: HierarchyList
nodes: NodeList
request(path: str, count: int | None = None, namespace: Namespace = 1, tags: list | None = None, errsrc: bool = True)

Request nodes from a path

Parameters:
  • path (str) – Request path

  • count (int) – Number of nodes that should be selected

  • namespace (str) – Query namespace (nodes, sources, or units)

  • tags (list) – List of tags

  • errsrc (bool) – If ‘False’, missing sources will not throw errors

sources: SourceList
units: UnitList

scinumtools.dip.settings module

class scinumtools.dip.settings.EnvType

Bases: object

DATA = 1
DOCS = 2
class scinumtools.dip.settings.Format

Bases: object

NODE = 4
QUANTITY = 5
TUPLE = 2
TYPE = 3
VALUE = 1
class scinumtools.dip.settings.Keyword

Bases: object

CASE = 'case'
CONDITION = 'condition'
CONSTANT = 'constant'
DESCRIPTION = 'description'
ELSE = 'else'
END = 'end'
FALSE = 'false'
FORMAT = 'format'
NONE = 'none'
OPTIONS = 'options'
SOURCE = 'source'
TAGS = 'tags'
TRUE = 'true'
UNIT = 'unit'
class scinumtools.dip.settings.Namespace

Bases: object

NODES = 1
SOURCES = 3
UNITS = 2
class scinumtools.dip.settings.Numeric

Bases: object

PRECISION = 1e-06
class scinumtools.dip.settings.Order

Bases: object

NAME = 1
NONE = 0
class scinumtools.dip.settings.Sign

Bases: object

CONDITION = '@'
DEFINED = '!'
NEGATE = '~'
NEWLINE = '\n'
QUERY = '?'
SEPARATOR = '.'
VALIDATION = '!'
VARIABLE = '$'
WILDCARD = '*'

Module contents