Skip to content
This repository was archived by the owner on Aug 11, 2020. It is now read-only.

Commit fd2160d

Browse files
Merge pull request #114 from Paperspace/remove-duplicated-base-command
bugfix: CommandBase duplicate removed
2 parents 954e826 + 532cbf9 commit fd2160d

File tree

3 files changed

+9
-19
lines changed

3 files changed

+9
-19
lines changed

paperspace/commands/__init__.py

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +0,0 @@
1-
from collections import OrderedDict
2-
3-
from paperspace import logger
4-
5-
6-
class CommandBase(object):
7-
def __init__(self, api=None, logger_=logger):
8-
self.api = api
9-
self.logger = logger_
10-
11-
def _print_dict_recursive(self, input_dict, indent=0, tabulator=" "):
12-
for key, val in input_dict.items():
13-
self.logger.log("%s%s:" % (tabulator * indent, key))
14-
if type(val) is dict:
15-
self._print_dict_recursive(OrderedDict(val), indent + 1)
16-
else:
17-
self.logger.log("%s%s" % (tabulator * (indent + 1), val))

paperspace/commands/common.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import pydoc
2+
from collections import OrderedDict
23

34
import terminaltables
45

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

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

1523
class ListCommand(CommandBase):
1624
@property

tests/unit/test_base.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
from collections import OrderedDict
22

33
import mock
4-
import pytest
54

6-
from paperspace.commands import CommandBase
5+
from paperspace.commands.common import CommandBase
76

87
output_response = ""
98

0 commit comments

Comments
 (0)