syft package¶
Subpackages¶
Submodules¶
syft.experimental_flags module¶
syft.filterwarnings module¶
syft.jax_settings module¶
syft.logger module¶
syft.registry module¶
syft.util module¶
- 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