Skip to main content

Library for working with structural nodes

Project description

Description

The library provides the ability to represent various data (in particular data structures) in the format of nodes, which can be further manipulated (in particular, adding properties, searching for child nodes by their full name).

Nodes of the object structure

The node structure is a tree (this also means that one node cannot have more than one parent node). Each node performs some type of:

  1. An integer is an Integer,
  2. Fractional number - Float,
  3. Boolean Boolean variable,
  4. String - String,
  5. null - Null,
  6. Object - ObjectNode,
  7. Array - Array. Only an object and an array can have child nodes. To quickly convert standard Python types to nodes, you can use the formats_to_structural_nodes library. You can set parameters for each node (in principle, they were created for this purpose). Parameters can be set for each individual node (set_parameters - overwrite all parameters, add_parameters - add new ones to existing parameters), or for all nodes from the top level to the lower ones (set_parameters_by_cascade).

Example Node structure with node names

ObjectNode (main)
|____Interger (int_node)
|____String (str_node)
|____ObjectNode (second)
    |____Float (sec_float, $ref = sec_float_ref)
    |____Boolean (sec_bool)
    |____String (sec_str)
|___Array (array)
    |____Integer ()
    |____Integer (arr_int)
    |____ObjectNode ()
        |____String (arr_obj_str)

The structure of the dictionary for the object

{
    "main": {

    },
    "int_node": {

    },
    "str_node": {
        
    },
    "second": {
        
    },
    "sec_float_ref": {
        
    },
    "second.sec_bool": {
        
    },
    "sec_str": {
        
    },
    "array": {
        
    },
    "array[]": {
        
    },
    "array[]arr_int": {
        
    },
    "array[].arr_obj_str": {
        
    }
}

The parameter is selected in the following sequence:

  1. if the parameter "$ref" is already set, then a search is performed for this value.;
  2. if this parameter is not present, then a search is performed along the full path (for example, a search will be performed for an element of the array arr_int: array[]arr_int - the name of the starting node is not taken into account);
  3. If no parameter is found in the full path, then the parameter is searched simply by name.

Freeing a node from an upstream node is the free() method.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

more_structural_nodes-0.1.0-py3-none-any.whl (14.1 kB view details)

Uploaded Python 3

File details

Details for the file more_structural_nodes-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for more_structural_nodes-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 523b6f9a17fbd49bede358dcf4ed136451e6079c36bfaa3812a4233a1f2739e2
MD5 5f3edc111a8cb415816124e4d5423dc6
BLAKE2b-256 4055cecdd6032e6b24cfcb5ed0fb96d85dfabf2c138644fe38657aae7dd4d6a9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page