# Path: syncano_cli/custom_sockets/exceptions.py
# class BadYAMLDefinitionInEndpointsException(CLIBaseException):
#     default_message = u'Specify one general endpoint or specify endpoints for each method.'
# 
# Path: syncano_cli/sync/scripts.py
# ALLOWED_RUNTIMES = {
#     'golang': '.go',
#     'nodejs': '.js',
#     'nodejs_library_v0.4': '.js',
#     'nodejs_library_v1.0': '.js',
#     'php': '.php',
#     'python': '.py',
#     'python3': '.py',
#     'python_library_v4.2': '.py',
#     'python_library_v5.0': '.py',
#     'ruby': '.rb',
#     'swift': '.swift',
# }


import os
import six
import yaml
from collections import defaultdict
from syncano_cli.custom_sockets.exceptions import BadYAMLDefinitionInEndpointsException
from syncano_cli.sync.scripts import ALLOWED_RUNTIMES
        yml_endpoints = {}
        for endpoint_name, endpoint_data in six.iteritems(endpoints):
            yml_endpoints[endpoint_name] = cls._yml_process_calls(endpoint_data['calls'])
            yml_endpoints.update(cls._yml_process_metadata(endpoint_data))
        return yml_endpoints

    @classmethod
    def _yml_process_metadata(cls, endpoint_data):
        return endpoint_data.get('metadata', {})  # some old Sockets do not have this field;

    @classmethod
    def _yml_process_calls(cls, data_calls):
        calls = {}
        for call in data_calls:
            if call['methods'] == ['*']:
                calls = {call['type']: call['name']}
            else:
                for method in call['methods']:
                    calls.update({method: {call['type']: call['name']}})
        return calls

    @classmethod
    def _yml_process_dependencies(cls, dependencies):
        yml_dependencies = {}
        scripts = {}
        files = []

        for dependency in dependencies:
            if dependency['type'] == 'script':
                file_name = '{name}{ext}'.format(name=dependency['name'],

# Path: syncano_cli/custom_sockets/exceptions.py
# class BadYAMLDefinitionInEndpointsException(CLIBaseException):
#     default_message = u'Specify one general endpoint or specify endpoints for each method.'
# 
# Path: syncano_cli/sync/scripts.py
# ALLOWED_RUNTIMES = {
#     'golang': '.go',
#     'nodejs': '.js',
#     'nodejs_library_v0.4': '.js',
#     'nodejs_library_v1.0': '.js',
#     'php': '.php',
#     'python': '.py',
#     'python3': '.py',
#     'python_library_v4.2': '.py',
#     'python_library_v5.0': '.py',
#     'ruby': '.rb',
#     'swift': '.swift',
# }


# Path: syncano_cli/custom_sockets/jsonyaml.py
import os
import six
import yaml
from collections import defaultdict
from syncano_cli.custom_sockets.exceptions import BadYAMLDefinitionInEndpointsException
from syncano_cli.sync.scripts import ALLOWED_RUNTIMES

        yml_endpoints = {}
        for endpoint_name, endpoint_data in six.iteritems(endpoints):
            yml_endpoints[endpoint_name] = cls._yml_process_calls(endpoint_data['calls'])
            yml_endpoints.update(cls._yml_process_metadata(endpoint_data))
        return yml_endpoints

    @classmethod
    def _yml_process_metadata(cls, endpoint_data):
        return endpoint_data.get('metadata', {})  # some old Sockets do not have this field;

    @classmethod
    def _yml_process_calls(cls, data_calls):
        calls = {}
        for call in data_calls:
            if call['methods'] == ['*']:
                calls = {call['type']: call['name']}
            else:
                for method in call['methods']:
                    calls.update({method: {call['type']: call['name']}})
        return calls

    @classmethod
    def _yml_process_dependencies(cls, dependencies):
        yml_dependencies = {}
        scripts = {}
        files = []

        for dependency in dependencies:
            if dependency['type'] == 'script':
                file_name = '{name}{ext}'.format(name=dependency['name'],

                                                 ext=ALLOWED_RUNTIMES[dependency['runtime_name']])