Skip to content
This repository was archived by the owner on Oct 30, 2018. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 0 additions & 16 deletions syncano_cli/custom_sockets/formatters.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
import json
import os
from collections import defaultdict

Expand Down Expand Up @@ -74,19 +73,6 @@ def _json_process_endpoints(cls, endpoints):

return api_endpoints

@classmethod
def _process_response_example(cls, metadata_key, inner_data):
if metadata_key not in cls.ENDPOINT_TYPES:
if metadata_key == 'response':
if 'example' in inner_data:
if isinstance(inner_data['example'], dict):
inner_data['example'] = inner_data['example']
elif isinstance(inner_data['example'], six.string_types):
try:
inner_data['example'] = json.loads(inner_data['example'])
except (TypeError, ValueError):
inner_data['example'] = inner_data['example']

@classmethod
def _get_metadata(cls, endpoint_data):
metadata = defaultdict(dict)
Expand All @@ -98,14 +84,12 @@ def _get_metadata(cls, endpoint_data):
if metadata_key == 'parameters':
metadata[metadata_key][data_key] = inner_data
else:
cls._process_response_example(metadata_key, inner_data)
metadata[metadata_key] = inner_data

elif data_key not in cls.ENDPOINT_TYPES:
if data_key == 'parameters':
metadata[data_key]['*'] = data
else:
cls._process_response_example(data_key, data)
metadata[data_key] = data
metadata[data_key] = data

Expand Down