Base

Base class

Base class for all classes in the package. It provides rich printing and persistence of objects.

class edsl.Base.Base[source]

Bases: RepresentationMixin, PersistenceMixin, DiffMethodsMixin, HashingMixin, ABC

Base class for all classes in the package.

abstract code()[source]

This method should be implemented by subclasses.

abstract example()[source]

This method should be implemented by subclasses.

abstract from_dict()[source]

This method should be implemented by subclasses.

keys()[source]

Return the keys of the object.

show_methods(show_docstrings=True)[source]

Show the methods of the object.

store(d: dict, key_name: str | None = None)[source]
abstract to_dict()[source]

This method should be implemented by subclasses.

to_json()[source]
values()[source]

Return the values of the object.

class edsl.Base.DiffMethodsMixin[source]

Bases: object

class edsl.Base.HashingMixin[source]

Bases: object

class edsl.Base.PersistenceMixin[source]

Bases: object

Mixin for saving and loading objects to and from files.

classmethod delete(uuid: str | UUID | None = None, url: str | None = None)[source]

Delete the object from coop.

classmethod load(filename)[source]

Load the object from a file.

>>> obj = cls.load("obj.json.gz")
static open_compressed_file(filename)[source]
static open_regular_file(filename)[source]
classmethod patch(uuid: str | UUID | None = None, url: str | None = None, description: str | None = None, alias: str | None = None, value: Any | None = None, visibility: str | None = None)[source]

Patch an uploaded objects attributes. - description changes the description of the object on Coop - value changes the value of the object on Coop. has to be an EDSL object - visibility changes the visibility of the object on Coop

classmethod pull(uuid: str | UUID | None = None, url: str | None = None, expected_parrot_url: str | None = None)[source]

Pull the object from coop.

push(description: str | None = None, alias: str | None = None, visibility: str | None = 'unlisted', expected_parrot_url: str | None = None)[source]

Post the object to coop.

save(filename, compress=True)[source]

Save the object to a file as zippped JSON.

>>> obj.save("obj.json.gz")
classmethod search(query)[source]

Search for objects on coop.

store(d: dict, key_name: str | None = None)[source]
class edsl.Base.RegisterSubclassesMeta(name, bases, namespace, /, **kwargs)[source]

Bases: ABCMeta

Metaclass for registering subclasses.

static get_registry(exclude_classes: list | None = None)[source]

Return the registry of subclasses.

class edsl.Base.RepresentationMixin[source]

Bases: object

display_dict()[source]
help()[source]

Extract all public instance methods and their docstrings from a class instance.

Args:

obj: The instance to inspect

Returns:

dict: A dictionary where keys are method names and values are their docstrings

json()[source]
print(format='rich')[source]
to_dataset()[source]
view()[source]

Displays an interactive / perspective view of the object

edsl.Base.is_iterable(obj)[source]