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

Commit 5a815f9

Browse files
committed
CommandBase duplicate removed, pretty dict printing moved to the only one
1 parent 954e826 commit 5a815f9

File tree

2 files changed

+8
-17
lines changed

2 files changed

+8
-17
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

0 commit comments

Comments
 (0)