syft.ast.globals

This module contains Global, an AST node representing the collection of frameworks held in the global namespace.

Classes

Globals(client[, object_ref, parent, ...])

The collection of frameworks held in the global namespace.

class syft.ast.globals.Globals(client, object_ref=None, parent=None, path_and_name=None, return_type_name=None)[source]

Bases: syft.ast.module.Module

The collection of frameworks held in the global namespace.

__init__(client, object_ref=None, parent=None, path_and_name=None, return_type_name=None)[source]

Base constructor for all frameworks in global namespace.

Parameters
  • client – The client who will use all frameworks for executing all the computations.

  • object_ref – The python object for which computation is being performed.

  • parent – The parent node is optional as importing frameworks don’t need any parent node.

  • path_and_name – The path for current frameworks in global namespace, e.g. syft.lib.python.List.

  • return_type_name – The return type name of given action as a string with it’s full path.

add_path(path=None, index=0, return_type_name=None, framework_reference=None, is_static=False)[source]

Adds new nodes in the AST based on the type of the current node and the type of the object to be added.

Parameters
  • path – The node path added in the AST, e.g. syft.lib.python.List or [“syft”, “lib”, “python”, “List”].

  • index – The associated position in the path for the current node.

  • framework_reference – The python framework in which we can resolve the same path to obtain the Python object.

  • return_type_name – The return type name of given action as a string with it’s full path.

  • is_static – If the queried object is static, it has to found on the ast itself, not on an existing pointer.

register_updates(client)[source]

Any previously loaded libs need to be applied.

Parameters

client – The client who will be executing all the computations.

apply_node_changes()[source]

Global is not expected to change.