syft.generic.id_provider

Module Contents

syft.generic.id_provider.create_random_id()
class syft.generic.id_provider.IdProvider(given_ids=None)

Provides Id to all syft objects.

Generate id and store the list of ids generated Can take a pre set list in input and will complete when it’s empty.

An instance of IdProvider is accessible via sy.ID_PROVIDER.

pop(self, *args)

Provides random ids and store them.

The syntax .pop() mimics the list syntax for convenience and not the generator syntax.

Returns

Random Id.

set_next_ids(self, given_ids: List, check_ids: bool = True)

Sets the next ids returned by the id provider

Note that the ids are returned in reverse order of the list, as a pop() operation is applied.

Parameters
  • given_ids – List, next ids returned by the id provider

  • check_ids – bool, check whether these ids conflict with already generated ids

start_recording_ids(self)

Starts the recording in form of a list of the generated ids.

get_recorded_ids(self, continue_recording=False)

Returns the generated ids since the last call to start_recording_ids.

Parameters

continue_recording – if False, the recording is stopped and the list of recorded ids is reset

Returns

list of recorded ids