Skip to content

Commit c4b5a33

Browse files
committed
delete: legacy code
1 parent d213146 commit c4b5a33

File tree

1 file changed

+5
-34
lines changed

1 file changed

+5
-34
lines changed

importify/interface.py

Lines changed: 5 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -100,41 +100,7 @@ def import_json(cls, path: str, ignore_error: bool = True) \
100100
def parse(self):
101101
self.parser.parse()
102102

103-
def parse_(self):
104-
"""Implement argument parsing functionality based on object elements
105-
"""
106-
parser = argparse.ArgumentParser()
107-
for key, value in self.strip_dict().items():
108-
parser.add_argument('--{}'.format(key), type=type(value))
109-
args = parser.parse_args()
110-
print(vars(args))
111-
self.unstrip_dict(vars(args))
112-
113103
# Utility
114-
def strip_dict(self, prefix: str = "") -> Dict[str, Any]:
115-
"""Strips dictionary recursively.
116-
117-
Args:
118-
prefix: prefix string.
119-
120-
Returns:
121-
dictionary with stripped keys.
122-
"""
123-
stripped_dict = {}
124-
for key, value in self.__dict__.items():
125-
if isinstance(value, Serializable):
126-
for k, v in value.strip_dict(prefix=prefix + key + DELIM).items():
127-
stripped_dict[k] = v
128-
else:
129-
stripped_dict[prefix + key] = value
130-
return stripped_dict
131-
132-
# Utility
133-
@staticmethod
134-
def is_base(key):
135-
BASE = ['parser']
136-
return key in BASE
137-
138104
def strip(self, prefix: str = "") -> Dict[str, Any]:
139105
""" Strip arguments.
140106
@@ -187,6 +153,11 @@ def get_attribute(self, key_path: List[str]) -> Tuple[Any, str]:
187153
else:
188154
return self, key_path[0]
189155

156+
@staticmethod
157+
def is_base(key):
158+
BASE = ['parser']
159+
return key in BASE
160+
190161

191162
class SerializableParser:
192163
def __init__(self, instance):

0 commit comments

Comments
 (0)