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
- 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
- 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.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
- 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.Dict(**kwargs)¶
Bases:
collections.UserDict
,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
- 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.
- 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.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)
- 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
- property imag¶
the imaginary part of a complex number
- 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.
- 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
- 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
- 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.
- 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.
- 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
- 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.
- class syft.lib.python.String(value=None, id=None)¶
Bases:
collections.UserString
,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
- 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.
- 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.Tuple(*args)¶
Bases:
tuple
,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
- 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.
- syft.lib.python.syft_type¶
alias of
syft.lib.python.Tuple
Subpackages¶
Submodules¶
syft.lib.python.bool module¶
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
- 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.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
- 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_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
- property start¶
- property step¶
- property stop¶
- 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
- 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.)
- 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.)
- 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.)
- 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.