syft.ast.enum

This module contains EnumAttribute, an AST node representing the attributes of a Python Enum which are only gettable, not settable.

Classes

EnumAttribute(parent, path_and_name[, ...])

An EnumAttribute represents the attributes of a Python Enum which are only gettable, not settable.

class syft.ast.enum.EnumAttribute(parent, path_and_name, return_type_name=None, client=None)[source]

Bases: syft.ast.attribute.Attribute

An EnumAttribute represents the attributes of a Python Enum which are only gettable, not settable.

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

Base constructor for Enum Attribute.

Parameters
  • parent – The parent node is needed when solving EnumAttributes.

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

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

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

get_remote_enum_attribute()[source]

Remote getter on an Enum attribute in the AST.

Raises

ValueError – Cannot get Enum attribute.

Returns

A pointer to the remote enum attribute.

solve_get_enum_attribute()[source]

Local getter on an Enum attribute in the AST.

Raises

ValueError – Cannot get Enum attribute.

Returns

The Enum object from the parent object reference.

add_path(*args, **kwargs)[source]

An Enum can no longer have children nodes.

Parameters
  • *args – Variable length argument list.

  • *kwargs – keyword arguments..

Raises

ValueError – If the function is called.