forked from TeamCohen/TensorLog
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig.py
More file actions
30 lines (22 loc) · 871 Bytes
/
Copy pathconfig.py
File metadata and controls
30 lines (22 loc) · 871 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# (C) William W. Cohen and Carnegie Mellon University, 2016
# A class to contain configuration information
class Config(object):
def __init__(self):
self.help = ConfigHelp()
"""A container for configuration options"""
def pprint(self,depth=0):
if not depth: print '===='
for key,val in self.__dict__.items():
if key!='help':
self._explain(depth,key,val)
if type(val)==type(Config()):
val.pprint(depth+1)
def _explain(self,depth,key,val):
tmp = '| '*depth + key + ':'
if type(val)!=type(Config()):
tmp += ' '+repr(val)
if key in self.help.__dict__:
print '%-40s %s' % (tmp,self.help.__dict__[key])
class ConfigHelp(object):
"""A parallel object that stores help about configurations."""
pass