syft.lib.python package

class syft.lib.python.Bool(value=None, id=None)

Bases: int, syft.lib.python.PyPrimitive

as_integer_ratio()[source]

Return integer ratio.

Return a pair of integers, whose ratio is exactly equal to the original int and with a positive denominator.

>>> (10).as_integer_ratio()
(10, 1)
>>> (-10).as_integer_ratio()
(-10, 1)
>>> (0).as_integer_ratio()
(0, 1)
bit_length()[source]

Number of bits necessary to represent self in binary.

>>> bin(37)
'0b100101'
>>> (37).bit_length()
6
conjugate()[source]

Returns self, the complex conjugate of any int.

denominator()[source]

the denominator of a rational number in lowest terms

describe(description)

Add description to object.

Parameters
  • self – object to add description to.

  • description – Description to add.

Returns

object.

static get_protobuf_schema()[source]

Return the type of protobuf object which stores a class of this type

As a part of serialization and deserialization, we need the ability to lookup the protobuf object type directly from the object type. This static method allows us to do this.

Importantly, this method is also used to create the reverse lookup ability within the metaclass of Serializable. In the metaclass, it calls this method and then it takes whatever type is returned from this method and adds an attribute to it with the type of this class attached to it. See the MetaSerializable class for details.

Returns

the type of protobuf object which corresponds to this class.

Return type

GeneratedProtocolMessageType

property id

We reveal PyPrimitive.id as a property to discourage users and developers of Syft from modifying .id attributes after an object has been initialized. :return: returns the unique id of the object :rtype: UID

imag()[source]

the imaginary part of a complex number

numerator()[source]

the numerator of a rational number in lowest terms

real()[source]

the real part of a complex number

send(client, pointable=True, description='', tags=None, searchable=None)

Send obj to client and return pointer to the object.

Parameters
  • self – Object to be sent.

  • client – Client to send object to.

  • pointable

  • description – Description for the object to send.

  • tags – Tags for the object to send.

Returns

Pointer to sent object.

Note

searchable is deprecated please use pointable in the future.

tag(*tags)

Add tags to object.

Parameters
  • self – object to add tags to.

  • *tags – List of tags to add.

Returns

object.

upcast()[source]
class syft.lib.python.Complex(real=None, imag=None, id=None)

Bases: complex, syft.lib.python.PyPrimitive

describe(description)

Add description to object.

Parameters
  • self – object to add description to.

  • description – Description to add.

Returns

object.

static get_protobuf_schema()[source]

Return the type of protobuf object which stores a class of this type

As a part of serialization and deserialization, we need the ability to lookup the protobuf object type directly from the object type. This static method allows us to do this.

Importantly, this method is also used to create the reverse lookup ability within the metaclass of Serializable. In the metaclass, it calls this method and then it takes whatever type is returned from this method and adds an attribute to it with the type of this class attached to it. See the MetaSerializable class for details.

Returns

the type of protobuf object which corresponds to this class.

Return type

GeneratedProtocolMessageType

property id

We reveal PyPrimitive.id as a property to discourage users and developers of Syft from modifying .id attributes after an object has been initialized.

Returns

returns the unique id of the object

Return type

UID

send(client, pointable=True, description='', tags=None, searchable=None)

Send obj to client and return pointer to the object.

Parameters
  • self – Object to be sent.

  • client – Client to send object to.

  • pointable

  • description – Description for the object to send.

  • tags – Tags for the object to send.

Returns

Pointer to sent object.

Note

searchable is deprecated please use pointable in the future.

tag(*tags)

Add tags to object.

Parameters
  • self – object to add tags to.

  • *tags – List of tags to add.

Returns

object.

upcast()[source]
class syft.lib.python.Dict(**kwargs)

Bases: collections.UserDict, syft.lib.python.PyPrimitive

clear() None.  Remove all items from D.[source]
copy()[source]
describe(description)

Add description to object.

Parameters
  • self – object to add description to.

  • description – Description to add.

Returns

object.

dict_get(key, default=None)[source]
classmethod fromkeys(iterable, value=None)[source]
static get_protobuf_schema()[source]

Return the type of protobuf object which stores a class of this type

As a part of serialization and deserialization, we need the ability to lookup the protobuf object type directly from the object type. This static method allows us to do this.

Importantly, this method is also used to create the reverse lookup ability within the metaclass of Serializable. In the metaclass, it calls this method and then it takes whatever type is returned from this method and adds an attribute to it with the type of this class attached to it. See the MetaSerializable class for details.

Returns

the type of protobuf object which corresponds to this class.

Return type

GeneratedProtocolMessageType

property id

We reveal PyPrimitive.id as a property to discourage users and developers of Syft from modifying .id attributes after an object has been initialized.

Returns

returns the unique id of the object

Return type

UID

items() a set-like object providing a view on D's items[source]
keys() a set-like object providing a view on D's keys[source]
pop(k[, d]) v, remove specified key and return the corresponding value.[source]

If key is not found, d is returned if given, otherwise KeyError is raised.

popitem() (k, v), remove and return some (key, value) pair[source]

as a 2-tuple; but raise KeyError if D is empty.

send(client, pointable=True, description='', tags=None, searchable=None)

Send obj to client and return pointer to the object.

Parameters
  • self – Object to be sent.

  • client – Client to send object to.

  • pointable

  • description – Description for the object to send.

  • tags – Tags for the object to send.

Returns

Pointer to sent object.

Note

searchable is deprecated please use pointable in the future.

setdefault(k[, d]) D.get(k,d), also set D[k]=d if k not in D[source]
tag(*tags)

Add tags to object.

Parameters
  • self – object to add tags to.

  • *tags – List of tags to add.

Returns

object.

upcast()[source]
values() an object providing a view on D's values[source]
class syft.lib.python.Float(value=None, id=None)

Bases: float, syft.lib.python.PyPrimitive

as_integer_ratio()[source]

Return integer ratio.

Return a pair of integers, whose ratio is exactly equal to the original float and with a positive denominator.

Raise OverflowError on infinities and a ValueError on NaNs.

>>> (10.0).as_integer_ratio()
(10, 1)
>>> (0.0).as_integer_ratio()
(0, 1)
>>> (-.25).as_integer_ratio()
(-1, 4)
conjugate()[source]

Return self, the complex conjugate of any float.

describe(description)

Add description to object.

Parameters
  • self – object to add description to.

  • description – Description to add.

Returns

object.

static get_protobuf_schema()[source]

Return the type of protobuf object which stores a class of this type

As a part of serialization and deserialization, we need the ability to lookup the protobuf object type directly from the object type. This static method allows us to do this.

Importantly, this method is also used to create the reverse lookup ability within the metaclass of Serializable. In the metaclass, it calls this method and then it takes whatever type is returned from this method and adds an attribute to it with the type of this class attached to it. See the MetaSerializable class for details.

Returns

the type of protobuf object which corresponds to this class.

Return type

GeneratedProtocolMessageType

hex()[source]

Return a hexadecimal representation of a floating-point number.

>>> (-0.1).hex()
'-0x1.999999999999ap-4'
>>> 3.14159.hex()
'0x1.921f9f01b866ep+1'
property id

We reveal PyPrimitive.id as a property to discourage users and developers of Syft from modifying .id attributes after an object has been initialized.

Returns

returns the unique id of the object

Return type

UID

property imag

the imaginary part of a complex number

is_integer()[source]

Return True if the float is an integer.

property real

the real part of a complex number

send(client, pointable=True, description='', tags=None, searchable=None)

Send obj to client and return pointer to the object.

Parameters
  • self – Object to be sent.

  • client – Client to send object to.

  • pointable

  • description – Description for the object to send.

  • tags – Tags for the object to send.

Returns

Pointer to sent object.

Note

searchable is deprecated please use pointable in the future.

tag(*tags)

Add tags to object.

Parameters
  • self – object to add tags to.

  • *tags – List of tags to add.

Returns

object.

upcast()[source]
class syft.lib.python.Int(value=None, base=10, id=None)

Bases: int, syft.lib.python.PyPrimitive

as_integer_ratio()[source]

Return integer ratio.

Return a pair of integers, whose ratio is exactly equal to the original int and with a positive denominator.

>>> (10).as_integer_ratio()
(10, 1)
>>> (-10).as_integer_ratio()
(-10, 1)
>>> (0).as_integer_ratio()
(0, 1)
bit_length()[source]

Number of bits necessary to represent self in binary.

>>> bin(37)
'0b100101'
>>> (37).bit_length()
6
conjugate()[source]

Returns self, the complex conjugate of any int.

denominator()[source]

the denominator of a rational number in lowest terms

describe(description)

Add description to object.

Parameters
  • self – object to add description to.

  • description – Description to add.

Returns

object.

static from_bytes(bytes, byteorder, *, signed=True)[source]

Return the integer represented by the given array of bytes.

bytes

Holds the array of bytes to convert. The argument must either support the buffer protocol or be an iterable object producing bytes. Bytes and bytearray are examples of built-in objects that support the buffer protocol.

byteorder

The byte order used to represent the integer. If byteorder is ‘big’, the most significant byte is at the beginning of the byte array. If byteorder is ‘little’, the most significant byte is at the end of the byte array. To request the native byte order of the host system, use `sys.byteorder’ as the byte order value.

signed

Indicates whether two’s complement is used to represent the integer.

static get_protobuf_schema()[source]

Return the type of protobuf object which stores a class of this type

As a part of serialization and deserialization, we need the ability to lookup the protobuf object type directly from the object type. This static method allows us to do this.

Importantly, this method is also used to create the reverse lookup ability within the metaclass of Serializable. In the metaclass, it calls this method and then it takes whatever type is returned from this method and adds an attribute to it with the type of this class attached to it. See the MetaSerializable class for details.

Returns

the type of protobuf object which corresponds to this class.

Return type

GeneratedProtocolMessageType

property id

We reveal PyPrimitive.id as a property to discourage users and developers of Syft from modifying .id attributes after an object has been initialized.

Returns

returns the unique id of the object

Return type

UID

imag()[source]

the imaginary part of a complex number

numerator()[source]

the numerator of a rational number in lowest terms

real()[source]

the real part of a complex number

send(client, pointable=True, description='', tags=None, searchable=None)

Send obj to client and return pointer to the object.

Parameters
  • self – Object to be sent.

  • client – Client to send object to.

  • pointable

  • description – Description for the object to send.

  • tags – Tags for the object to send.

Returns

Pointer to sent object.

Note

searchable is deprecated please use pointable in the future.

tag(*tags)

Add tags to object.

Parameters
  • self – object to add tags to.

  • *tags – List of tags to add.

Returns

object.

to_bytes(length, byteorder, signed=False)[source]

Return an array of bytes representing an integer.

length

Length of bytes object to use. An OverflowError is raised if the integer is not representable with the given number of bytes.

byteorder

The byte order used to represent the integer. If byteorder is ‘big’, the most significant byte is at the beginning of the byte array. If byteorder is ‘little’, the most significant byte is at the end of the byte array. To request the native byte order of the host system, use `sys.byteorder’ as the byte order value.

signed

Determines whether two’s complement is used to represent the integer. If signed is False and a negative integer is given, an OverflowError is raised.

upcast()[source]
class syft.lib.python.Any

Bases: object

describe(description)

Add description to object.

Parameters
  • self – object to add description to.

  • description – Description to add.

Returns

object.

send(client, pointable=True, description='', tags=None, searchable=None)

Send obj to client and return pointer to the object.

Parameters
  • self – Object to be sent.

  • client – Client to send object to.

  • pointable

  • description – Description for the object to send.

  • tags – Tags for the object to send.

Returns

Pointer to sent object.

Note

searchable is deprecated please use pointable in the future.

tag(*tags)

Add tags to object.

Parameters
  • self – object to add tags to.

  • *tags – List of tags to add.

Returns

object.

class syft.lib.python.PyPrimitive

Bases: syft.core.common.serde.serializable.Serializable

describe(description)

Add description to object.

Parameters
  • self – object to add description to.

  • description – Description to add.

Returns

object.

send(client, pointable=True, description='', tags=None, searchable=None)

Send obj to client and return pointer to the object.

Parameters
  • self – Object to be sent.

  • client – Client to send object to.

  • pointable

  • description – Description for the object to send.

  • tags – Tags for the object to send.

Returns

Pointer to sent object.

Note

searchable is deprecated please use pointable in the future.

tag(*tags)

Add tags to object.

Parameters
  • self – object to add tags to.

  • *tags – List of tags to add.

Returns

object.

upcast()[source]
class syft.lib.python.Slice(start=None, stop=None, step=None, id=None)

Bases: syft.lib.python.PyPrimitive

describe(description)

Add description to object.

Parameters
  • self – object to add description to.

  • description – Description to add.

Returns

object.

static get_protobuf_schema()[source]

Return the type of protobuf object which stores a class of this type

As a part of serialization and deserialization, we need the ability to lookup the protobuf object type directly from the object type. This static method allows us to do this.

Importantly, this method is also used to create the reverse lookup ability within the metaclass of Serializable. In the metaclass, it calls this method and then it takes whatever type is returned from this method and adds an attribute to it with the type of this class attached to it. See the MetaSerializable class for details.

Returns

the type of protobuf object which corresponds to this class.

Return type

GeneratedProtocolMessageType

property id

We reveal PyPrimitive.id as a property to discourage users and developers of Syft from modifying .id attributes after an object has been initialized.

Returns

returns the unique id of the object

Return type

UID

indices(index)[source]
send(client, pointable=True, description='', tags=None, searchable=None)

Send obj to client and return pointer to the object.

Parameters
  • self – Object to be sent.

  • client – Client to send object to.

  • pointable

  • description – Description for the object to send.

  • tags – Tags for the object to send.

Returns

Pointer to sent object.

Note

searchable is deprecated please use pointable in the future.

property start
property step
property stop
tag(*tags)

Add tags to object.

Parameters
  • self – object to add tags to.

  • *tags – List of tags to add.

Returns

object.

upcast()[source]
class syft.lib.python.String(value=None, id=None)

Bases: collections.UserString, syft.lib.python.PyPrimitive

capitalize()[source]
casefold()[source]
center(width, *args)[source]
count(value) integer -- return number of occurrences of value[source]
describe(description)

Add description to object.

Parameters
  • self – object to add description to.

  • description – Description to add.

Returns

object.

encode(encoding=None, errors=None)[source]
endswith(suffix, start=None, end=None)[source]
expandtabs(tabsize=8)[source]
find(sub, start=0, end=None)[source]
format(*args, **kwargs)[source]
format_map(mapping)[source]
static get_protobuf_schema()[source]

Return the type of protobuf object which stores a class of this type

As a part of serialization and deserialization, we need the ability to lookup the protobuf object type directly from the object type. This static method allows us to do this.

Importantly, this method is also used to create the reverse lookup ability within the metaclass of Serializable. In the metaclass, it calls this method and then it takes whatever type is returned from this method and adds an attribute to it with the type of this class attached to it. See the MetaSerializable class for details.

Returns

the type of protobuf object which corresponds to this class.

Return type

GeneratedProtocolMessageType

property id

We reveal PyPrimitive.id as a property to discourage users and developers of Syft from modifying .id attributes after an object has been initialized.

Returns

returns the unique id of the object

Return type

UID

index(value[, start[, stop]]) integer -- return first index of value.[source]

Raises ValueError if the value is not present.

Supporting start and stop arguments is optional, but recommended.

isalnum()[source]
isalpha()[source]
isascii()[source]
isdecimal()[source]
isdigit()[source]
isidentifier()[source]
islower()[source]
isnumeric()[source]
isprintable()[source]
isspace()[source]
istitle()[source]
isupper()[source]
join(seq)[source]
ljust(width, *args)[source]
lower()[source]
lstrip(chars=None)[source]
partition(sep=' ')[source]
replace(oldvalue, newvalue, count=- 1)[source]
rfind(sub, start=0, end=None)[source]
rindex(sub, start=0, end=None)[source]
rjust(width, *args)[source]
rpartition(sep=' ')[source]
rsplit(sep=None, maxsplit=- 1)[source]
rstrip(chars=None)[source]
send(client, pointable=True, description='', tags=None, searchable=None)

Send obj to client and return pointer to the object.

Parameters
  • self – Object to be sent.

  • client – Client to send object to.

  • pointable

  • description – Description for the object to send.

  • tags – Tags for the object to send.

Returns

Pointer to sent object.

Note

searchable is deprecated please use pointable in the future.

split(sep=None, maxsplit=- 1)[source]
splitlines(keepends=False)[source]
startswith(suffix, start=0, end=None)[source]
strip(chars=None)[source]
swapcase()[source]
tag(*tags)

Add tags to object.

Parameters
  • self – object to add tags to.

  • *tags – List of tags to add.

Returns

object.

title()[source]
translate(*args)[source]
upcast()[source]
upper()[source]
zfill(width)[source]
class syft.lib.python.Tuple(*args)

Bases: tuple, syft.lib.python.PyPrimitive

count(_Tuple__value)[source]

Return number of occurrences of value.

describe(description)

Add description to object.

Parameters
  • self – object to add description to.

  • description – Description to add.

Returns

object.

static get_protobuf_schema()[source]

Return the type of protobuf object which stores a class of this type

As a part of serialization and deserialization, we need the ability to lookup the protobuf object type directly from the object type. This static method allows us to do this.

Importantly, this method is also used to create the reverse lookup ability within the metaclass of Serializable. In the metaclass, it calls this method and then it takes whatever type is returned from this method and adds an attribute to it with the type of this class attached to it. See the MetaSerializable class for details.

Returns

the type of protobuf object which corresponds to this class.

Return type

GeneratedProtocolMessageType

property id

We reveal PyPrimitive.id as a property to discourage users and developers of Syft from modifying .id attributes after an object has been initialized.

Returns

returns the unique id of the object

Return type

UID

index(_Tuple__value, _Tuple__start=Ellipsis, _Tuple__stop=Ellipsis)[source]

Return first index of value.

Raises ValueError if the value is not present.

send(client, pointable=True, description='', tags=None, searchable=None)

Send obj to client and return pointer to the object.

Parameters
  • self – Object to be sent.

  • client – Client to send object to.

  • pointable

  • description – Description for the object to send.

  • tags – Tags for the object to send.

Returns

Pointer to sent object.

Note

searchable is deprecated please use pointable in the future.

tag(*tags)

Add tags to object.

Parameters
  • self – object to add tags to.

  • *tags – List of tags to add.

Returns

object.

upcast()[source]
syft.lib.python.create_python_ast(client=None)[source]
syft.lib.python.syft_type

alias of syft.lib.python.Tuple

Subpackages

Submodules

syft.lib.python.bool module

syft.lib.python.bool.dispatch_other(obj)[source]

syft.lib.python.bytes module

syft.lib.python.complex module

syft.lib.python.dict module

syft.lib.python.float module

syft.lib.python.int module

syft.lib.python.iterator module

class syft.lib.python.iterator.Iterator(_ref, max_len=None)[source]

Bases: syft.lib.python.PyPrimitive

upcast()[source]
describe(description)

Add description to object.

Parameters
  • self – object to add description to.

  • description – Description to add.

Returns

object.

send(client, pointable=True, description='', tags=None, searchable=None)

Send obj to client and return pointer to the object.

Parameters
  • self – Object to be sent.

  • client – Client to send object to.

  • pointable

  • description – Description for the object to send.

  • tags – Tags for the object to send.

Returns

Pointer to sent object.

Note

searchable is deprecated please use pointable in the future.

tag(*tags)

Add tags to object.

Parameters
  • self – object to add tags to.

  • *tags – List of tags to add.

Returns

object.

syft.lib.python.list module

class syft.lib.python.list.ListIterator(_ref, max_len=None)[source]

Bases: syft.lib.python.iterator.Iterator

class syft.lib.python.list.List(value=None, id=None)[source]

Bases: collections.UserList, syft.lib.python.PyPrimitive

property id

We reveal PyPrimitive.id as a property to discourage users and developers of Syft from modifying .id attributes after an object has been initialized.

Returns

returns the unique id of the object

Return type

UID

upcast()[source]
sort(*args, **kwargs)[source]
copy()[source]
append(item)[source]

S.append(value) – append value to the end of the sequence

count(value) integer -- return number of occurrences of value[source]
static get_protobuf_schema()[source]

Return the type of protobuf object which stores a class of this type

As a part of serialization and deserialization, we need the ability to lookup the protobuf object type directly from the object type. This static method allows us to do this.

Importantly, this method is also used to create the reverse lookup ability within the metaclass of Serializable. In the metaclass, it calls this method and then it takes whatever type is returned from this method and adds an attribute to it with the type of this class attached to it. See the MetaSerializable class for details.

Returns

the type of protobuf object which corresponds to this class.

Return type

GeneratedProtocolMessageType

describe(description)

Add description to object.

Parameters
  • self – object to add description to.

  • description – Description to add.

Returns

object.

send(client, pointable=True, description='', tags=None, searchable=None)

Send obj to client and return pointer to the object.

Parameters
  • self – Object to be sent.

  • client – Client to send object to.

  • pointable

  • description – Description for the object to send.

  • tags – Tags for the object to send.

Returns

Pointer to sent object.

Note

searchable is deprecated please use pointable in the future.

tag(*tags)

Add tags to object.

Parameters
  • self – object to add tags to.

  • *tags – List of tags to add.

Returns

object.

syft.lib.python.none module

syft.lib.python.primitive_container module

syft.lib.python.primitive_factory module

syft.lib.python.primitive_factory.isprimitive(value)[source]
class syft.lib.python.primitive_factory.PrimitiveFactory[source]

Bases: abc.ABC

upcast()[source]
static generate_primitive(value, id=None, recurse=False)[source]

syft.lib.python.primitive_interface module

syft.lib.python.range module

class syft.lib.python.range.Range(start=None, stop=None, step=1, id=None)[source]

Bases: syft.lib.python.PyPrimitive

property id

We reveal PyPrimitive.id as a property to discourage users and developers of Syft from modifying .id attributes after an object has been initialized.

Returns

returns the unique id of the object

Return type

UID

property start
property step
property stop
index(value)[source]
count(value)[source]
upcast()[source]
static get_protobuf_schema()[source]

Return the type of protobuf object which stores a class of this type

As a part of serialization and deserialization, we need the ability to lookup the protobuf object type directly from the object type. This static method allows us to do this.

Importantly, this method is also used to create the reverse lookup ability within the metaclass of Serializable. In the metaclass, it calls this method and then it takes whatever type is returned from this method and adds an attribute to it with the type of this class attached to it. See the MetaSerializable class for details.

Returns

the type of protobuf object which corresponds to this class.

Return type

GeneratedProtocolMessageType

describe(description)

Add description to object.

Parameters
  • self – object to add description to.

  • description – Description to add.

Returns

object.

send(client, pointable=True, description='', tags=None, searchable=None)

Send obj to client and return pointer to the object.

Parameters
  • self – Object to be sent.

  • client – Client to send object to.

  • pointable

  • description – Description for the object to send.

  • tags – Tags for the object to send.

Returns

Pointer to sent object.

Note

searchable is deprecated please use pointable in the future.

tag(*tags)

Add tags to object.

Parameters
  • self – object to add tags to.

  • *tags – List of tags to add.

Returns

object.

syft.lib.python.set module

class syft.lib.python.set.Set(iterable, _id=None)[source]

Bases: set, syft.lib.python.PyPrimitive

property id

We reveal PyPrimitive.id as a property to discourage users and developers of Syft from modifying .id attributes after an object has been initialized.

Returns

returns the unique id of the object

Return type

UID

upcast()[source]
add(other)[source]

Add an element to a set.

This has no effect if the element is already present.

clear()[source]

Remove all elements from this set.

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

Return the difference of two or more sets as a new set.

(i.e. all elements that are in this set but not the others.)

difference_update(*args)[source]

Remove all elements of another set from this set.

discard(element)[source]

Remove an element from a set if it is a member.

If the element is not a member, do nothing.

intersection(*args)[source]

Return the intersection of two sets as a new set.

(i.e. all elements that are in both sets.)

intersection_update(*args)[source]

Update a set with the intersection of itself and another.

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

Return True if two sets have a null intersection.

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

Report whether another set contains this set.

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

Report whether this set contains another set.

pop()[source]

Remove and return an arbitrary set element. Raises KeyError if the set is empty.

remove(element)[source]

Remove an element from a set; it must be a member.

If the element is not a member, raise a KeyError.

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

Return the symmetric difference of two sets as a new set.

(i.e. all elements that are in exactly one of the sets.)

symmetric_difference_update(s)[source]

Update a set with the symmetric difference of itself and another.

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

Return the union of sets as a new set.

(i.e. all elements that are in either set.)

update(*args)[source]

Update a set with the union of itself and others.

static get_protobuf_schema()[source]

Return the type of protobuf object which stores a class of this type

As a part of serialization and deserialization, we need the ability to lookup the protobuf object type directly from the object type. This static method allows us to do this.

Importantly, this method is also used to create the reverse lookup ability within the metaclass of Serializable. In the metaclass, it calls this method and then it takes whatever type is returned from this method and adds an attribute to it with the type of this class attached to it. See the MetaSerializable class for details.

Returns

the type of protobuf object which corresponds to this class.

Return type

GeneratedProtocolMessageType

describe(description)

Add description to object.

Parameters
  • self – object to add description to.

  • description – Description to add.

Returns

object.

send(client, pointable=True, description='', tags=None, searchable=None)

Send obj to client and return pointer to the object.

Parameters
  • self – Object to be sent.

  • client – Client to send object to.

  • pointable

  • description – Description for the object to send.

  • tags – Tags for the object to send.

Returns

Pointer to sent object.

Note

searchable is deprecated please use pointable in the future.

tag(*tags)

Add tags to object.

Parameters
  • self – object to add tags to.

  • *tags – List of tags to add.

Returns

object.

syft.lib.python.slice module

syft.lib.python.string module

syft.lib.python.tuple module

class syft.lib.python.tuple.TupleIterator(_ref, max_len=None)[source]

Bases: syft.lib.python.iterator.Iterator

syft.lib.python.types module

syft.lib.python.util module

syft.lib.python.util.downcast(value, recurse=True)[source]
syft.lib.python.util.downcast_args_and_kwargs(args, kwargs)[source]
syft.lib.python.util.upcast(value)[source]
syft.lib.python.util.upcast_args_and_kwargs(args, kwargs)[source]