Modules

anonapi package

anonapi.batch module

Work with batches of jobs. Batches are modeled on git repos; state is maintained via hidden file in current folder.

class anonapi.batch.BatchFolder(path)[source]

Bases: object

A folder in which a batch might be defined

BATCH_FILE_NAME = '.anonbatch'
__init__(path)[source]
Parameters

path (Pathlike) – root_path to this folder

property batch_file_path
delete_batch()[source]

Delete the batch file in this folder

Raises

BatchFolderError: – if remove does not work for some reason

has_batch()[source]
load()[source]

Load batch from the current folder

Return type

JobBatch

save(batch)[source]

Save the given batch to this folder

Parameters

batch (JobBatch) – job batch to save in this folder

exception anonapi.batch.BatchFolderError[source]

Bases: anonapi.exceptions.AnonAPIError

class anonapi.batch.JobBatch(job_ids, server)[source]

Bases: anonapi.persistence.YAMLSerializable

A collection of anonymisation jobs

__init__(job_ids, server)[source]
Parameters
  • job_ids (List(str)) – All job ids in this batch

  • server (RemoteAnonServer) – Server these jobs were created in

classmethod from_dict(dict_in)[source]

Create object from dict. Basis for json serialization. Overwrite this in child classes to yield an instance of the child class

Raises

ValueError – If an object cannot be created from dict_in

to_dict()[source]
Return type

str

to_string()[source]

Batch as input

Returns

String with newlines representing this batch

Return type

str

exception anonapi.batch.NoBatchDefinedError[source]

Bases: anonapi.exceptions.AnonAPIError

anonapi.client module

anonapi.context module

anonapi.decorators module

anonapi.exceptions module

exception anonapi.exceptions.AnonAPIError[source]

Bases: Exception

Base exception for everything raised in anonapi

anonapi.mapper module

anonapi.objects module

classes and methods shared by anonapi modules

class anonapi.objects.RemoteAnonServer(name, url)[source]

Bases: object

An anonymization server that can be talked to via the API

__init__(name, url)[source]

Create a Remote anon server entry

Parameters
  • name (str) – short keyword to identify this server

  • url (str) – full url to a valid Anonymization server web API

classmethod from_dict(dict_in)[source]

Load instance from output of to_dict

Return type

RemoteAnonServer

to_dict()[source]

Dictionary representation of this server

Return type

Dict

anonapi.parameters module

anonapi.responses module

anonapi.selection module

anonapi.settings module

anonapi.testresources module

Module contents

Top-level package for AnonAPI.

Examples

To see the source code for these examples, press the [source] link to the right of each title