syncano.models.custom_sockets_utils

class CallType[source]

Bases: object

The type of the call object used in the custom socket;

SCRIPT = 'script'
class DependencyType[source]

Bases: object

The type of the dependency object used in the custom socket;

SCRIPT = 'script'
CLASS = 'class'
class BaseCall(name, methods)[source]

Bases: object

Base class for call object.

call_type = None
to_dict()[source]
class ScriptCall(name, methods)[source]

Bases: syncano.models.custom_sockets_utils.BaseCall

Script call object.

The JSON format is as follows (to_dict in the base class):

{
    'type': 'script',
    'name': '<script_label>,
    'methods': [<method_list>],
}
methods can be as follows:
  • [‘GET’]
  • [‘*’] - which will do a call on every request method;
call_type = 'script'
class Endpoint(name)[source]

Bases: object

The object which stores metadata about endpoints in custom socket;

The JSON format is as follows:

{
    '<endpoint_name>': {
        'calls': [
            <list of JSON format of Calls objects>
        ]
    }
}
add_call(call)[source]
to_endpoint_data()[source]
class BaseDependency[source]

Bases: object

Base dependency object;

On the base of the fields attribute - the JSON format of the dependency is returned. The fields are taken from the dependency object - which can be Script (supported now).

fields = []
dependency_type = None
name = None
to_dependency_data()[source]
get_name()[source]
get_dependency_data()[source]
create_from_raw_data(raw_data)[source]
class ScriptDependency(script_or_script_endpoint, name=None)[source]

Bases: syncano.models.custom_sockets_utils.BaseDependency

Script dependency object;

The JSON format is as follows::
{
‘type’: ‘script’, ‘runtime_name’: ‘<runtime name defined in RuntimeChoices>’, ‘source’: ‘<source>’, ‘name’: ‘<name>’

}

dependency_type = 'script'
fields = ['runtime_name', 'source']
get_dependency_data()[source]
classmethod create_from_raw_data(raw_data)[source]
class ClassDependency(class_instance)[source]

Bases: syncano.models.custom_sockets_utils.BaseDependency

Class dependency object;

The JSON format is as follows::
{

‘type’: ‘class’, ‘name’: ‘<class_name>’, ‘schema’: [

{“name”: “f1”, “type”: “string”}, {“name”: “f2”, “type”: “string”}, {“name”: “f3”, “type”: “integer”}

],

}

dependency_type = 'class'
fields = ['name', 'schema']
get_dependency_data()[source]
classmethod create_from_raw_data(raw_data)[source]
class EndpointMetadataMixin(*args, **kwargs)[source]

Bases: object

A mixin which allows to collect Endpoints objects and transform them to the appropriate JSON format.

update_endpoints()[source]
add_endpoint(endpoint)[source]
remove_endpoint(endpoint_name)[source]
endpoints_data[source]
class DependencyMetadataMixin(*args, **kwargs)[source]

Bases: object

A mixin which allows to collect Dependencies objects and transform them to the appropriate JSON format.

update_dependencies()[source]
add_dependency(depedency)[source]
remove_dependency(dependency_name)[source]
dependencies_data[source]