diff --git a/paperspace/commands/__init__.py b/paperspace/commands/__init__.py index 6d63b5e..e69de29 100644 --- a/paperspace/commands/__init__.py +++ b/paperspace/commands/__init__.py @@ -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)) diff --git a/paperspace/commands/common.py b/paperspace/commands/common.py index 28a236e..cfb5e65 100644 --- a/paperspace/commands/common.py +++ b/paperspace/commands/common.py @@ -1,4 +1,5 @@ import pydoc +from collections import OrderedDict import terminaltables @@ -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 diff --git a/tests/unit/test_base.py b/tests/unit/test_base.py index c1fdd3f..aeacda2 100644 --- a/tests/unit/test_base.py +++ b/tests/unit/test_base.py @@ -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 = ""