syft.ast.module

This module contains Module attribute representing a module which contains other models or callables.

Functions

is_static_method(host_object, attr)

Check if attribute attr of an object is a static method.

Classes

Module(client[, parent, path_and_name, ...])

A module which contains other modules or callables.

syft.ast.module.is_static_method(host_object, attr)[source]

Check if attribute attr of an object is a static method.

Parameters
  • host_object – The object.

  • attr – The attribute of the object.

Returns

True if host_object[attr] is a static method.

Return type

bool

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

Bases: syft.ast.attribute.Attribute

A module which contains other modules or callables.

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

Base constructor for Module Attribute.

Parameters
  • client – The client for which all computation is being executed.

  • path_and_name – The path for the current node, e.g. syft.lib.python.List.

  • parent – The parent node of the module.

  • object_ref – The actual python object for which the computation is being made.

  • return_type_name – The given action’s return type name, with its full path, in string format.

add_attr(attr_name, attr, is_static=False)[source]

Add an attribute to the current module.

Parameters
  • attr_name – The name of the attribute, e.g. List of the path syft.lib.python.List.

  • attr – The attribute object.

  • is_static – The actual Python object for which the computation is being made.

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

The add_path method adds new nodes in AST based on type of current node and type of object to be added.

Parameters
  • path – The node path added in 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 same path to obtain Python object.

  • return_type_name – The return type name of the given action as a string with its full path.

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

fetch_live_object()[source]

Get the new object and its attributes from the client.

Returns

The updated object from the client.