MCPcopy Index your code
hub / github.com/SooLab/CGFormer / __str__

Method __str__

utils/config.py:35–54  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

33 self[name] = value
34
35 def __str__(self):
36 def _indent(s_, num_spaces):
37 s = s_.split("\n")
38 if len(s) == 1:
39 return s_
40 first = s.pop(0)
41 s = [(num_spaces * " ") + line for line in s]
42 s = "\n".join(s)
43 s = first + "\n" + s
44 return s
45
46 r = ""
47 s = []
48 for k, v in sorted(self.items()):
49 seperator = "\n" if isinstance(v, CfgNode) else " "
50 attr_str = "{}:{}{}".format(str(k), seperator, str(v))
51 attr_str = _indent(attr_str, 2)
52 s.append(attr_str)
53 r += "\n".join(s)
54 return r
55
56 def __repr__(self):
57 return "{}({})".format(self.__class__.__name__,

Callers

nothing calls this directly

Calls 1

itemsMethod · 0.80

Tested by

no test coverage detected