syft package

Subpackages

Submodules

syft.experimental_flags module

class syft.experimental_flags.ExperimentalFlags[source]

Bases: object

property APACHE_ARROW_TENSOR_SERDE

syft.filterwarnings module

syft.jax_settings module

syft.logger module

syft.logger.remove()[source]
syft.logger.add(sink=None, level='ERROR')[source]
syft.logger.traceback_and_raise(e, verbose=False)[source]
syft.logger.create_log_and_print_function(level)[source]
syft.logger.traceback(*args, **kwargs)[source]
syft.logger.critical(*args, **kwargs)[source]
syft.logger.error(*args, **kwargs)[source]
syft.logger.warning(*args, **kwargs)[source]
syft.logger.info(*args, **kwargs)[source]
syft.logger.debug(*args, **kwargs)[source]
syft.logger.trace(*args, **kwargs)[source]

syft.registry module

syft.util module

syft.util.validate_type(_object, _type, optional=False)[source]
syft.util.validate_field(_object, _field)[source]
syft.util.get_subclasses(obj_type)[source]

Recursively generate the list of all classes within the sub-tree of an object

As a paradigm in Syft, we often allow for something to be known about by another part of the codebase merely because it has subclassed a particular object. While this can be a big “magicish” it also can simplify future extensions and reduce the likelihood of small mistakes (if done right).

This is a utility function which allows us to look for sub-classes and the sub-classes of those sub-classes etc. returning a full list of descendants of a class in the inheritance hierarchy.

Parameters

obj_type – the type we want to look for sub-classes of

Returns

the list of subclasses of obj_type

syft.util.index_modules(a_dict, keys)[source]

Recursively find a syft module from its path

This is the recursive inner function of index_syft_by_module_name. See that method for a full description.

Parameters
  • a_dict – a module we’re traversing

  • keys – the list of string attributes we’re using to traverse the module

Returns

a reference to the final object

syft.util.index_syft_by_module_name(fully_qualified_name)[source]

Look up a Syft class/module/function from full path and name

Sometimes we want to use the fully qualified name (such as one generated from the ‘get_fully_qualified_name’ method below) to fetch an actual reference. This is most commonly used in deserialization so that we can have generic protobuf objects which just have a string representation of the specific object it is meant to deserialize to.

Parameters

fully_qualified_name – the name in str of a module, class, or function

Returns

a reference to the actual object at that string path

syft.util.get_fully_qualified_name(obj)[source]

Return the full path and name of a class

Sometimes we want to return the entire path and name encoded using periods. For example syft.core.common.message.SyftMessage is the current fully qualified path and name for the SyftMessage object.

Parameters

obj – the object we want to get the name of

Returns

the full path and name of the object

syft.util.aggressive_set_attr(obj, name, attr)[source]

Different objects prefer different types of monkeypatching - try them all

Parameters
  • obj – object whose attribute has to be set

  • name – attribute name

  • attr – value given to the attribute

syft.util.obj2pointer_type(obj)[source]
syft.util.key_emoji(key)[source]
syft.util.char_emoji(hex_chars)[source]
syft.util.random_name()[source]
syft.util.inherit_tags(attr_path_and_name, result, self_obj, args, kwargs)[source]
syft.util.get_root_data_path()[source]