nimblebox logo
Docs
v2.1.0

nbox.nbxlib.astea

Functions

iconfunctionsha256
[source]

generic function to calculate SHA256 hash of a string

iconfunctionget_code_section
[source]

generic function to return the code section for a node

Classes

iconclassIndexTypes
[source]
iconfunctionall
[source]

returns all the valid index types

iconclassAstea
[source]
iconfunction__init__
[source]
(fname:str,code:str,name:str,type:IndexTypes,node:A.AST,code_lines:List[str],order_index:int)
Parameters
  • fname -

    the file name to parse. If this is not provided, then all other values must be provided.

  • code -

    the code text can be provided instead of the.

  • name -

    The name of the node. Defaults to "".

  • type -

    The type of the node. Defaults to None.

  • node -

    The AST node. Defaults to None.

  • code_lines -

    The code lines. Defaults to None.

  • order_index -

    The order index of the node. Defaults to -1.

This is an AST node, that can be called upon itself to traverse in a natural human way. Only fname is an important argument, others will be populated automatically.

Example:

Python
Loading...
iconfunction__repr__
[source]
iconfunction__hash__
[source]
iconfunctiondocstring
[source]

Get the docstring of the current node, is valid only for functions and classes. This will automatically perform relevant dedentation and return the docstring as a single string.

iconfunctionindex
[source]

Returns a list of all the AST nodes (same Astea) in the current node. This is a recursive function and user/bot is expected to go over this to traverse.

iconfunctionfind
[source]
(x:str,types:Union[IndexTypes, List[IndexTypes]])
Parameters
  • x -

    If provided, will find the name of the item to search for

  • types -

    The type of items to search for. Defaults to None.

Find all the instances of x in the current node, and return a list of IndexItems.

  • if there is a '.' (dot) in x, find will try to perform a recursive search, you can escape the dot with a backslash
  • This currently does not work correctly when the same name is used in different types
  • if both x and types is not provided, then this behaves just like .index

Example:

Python
Loading...

Returns:

  • List['Astea']: A list of IndexItems that match the search
nbox SDKnbox provides built in access to all the APIs and packages them in the most user friendly manner.Star 0