Skip to content
This repository was archived by the owner on Aug 11, 2020. It is now read-only.
Merged
Show file tree
Hide file tree
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
17 changes: 0 additions & 17 deletions paperspace/commands/__init__.py
Original file line number Diff line number Diff line change
@@ -1,17 +0,0 @@
from collections import OrderedDict

from paperspace import logger


class CommandBase(object):
def __init__(self, api=None, logger_=logger):
self.api = api
self.logger = logger_

def _print_dict_recursive(self, input_dict, indent=0, tabulator=" "):
for key, val in input_dict.items():
self.logger.log("%s%s:" % (tabulator * indent, key))
if type(val) is dict:
self._print_dict_recursive(OrderedDict(val), indent + 1)
else:
self.logger.log("%s%s" % (tabulator * (indent + 1), val))
8 changes: 8 additions & 0 deletions paperspace/commands/common.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import pydoc
from collections import OrderedDict

import terminaltables

Expand All @@ -11,6 +12,13 @@ def __init__(self, api=None, logger_=logger):
self.api = api
self.logger = logger_

def _print_dict_recursive(self, input_dict, indent=0, tabulator=" "):
for key, val in input_dict.items():
self.logger.log("%s%s:" % (tabulator * indent, key))
if type(val) is dict:
self._print_dict_recursive(OrderedDict(val), indent + 1)
else:
self.logger.log("%s%s" % (tabulator * (indent + 1), val))

class ListCommand(CommandBase):
@property
Expand Down
3 changes: 1 addition & 2 deletions tests/unit/test_base.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
from collections import OrderedDict

import mock
import pytest

from paperspace.commands import CommandBase
from paperspace.commands.common import CommandBase

output_response = ""

Expand Down