MCPcopy Create free account
hub / github.com/enthought/comtypes / getvalue

Method getvalue

comtypes/tools/codegenerator/namespaces.py:107–123  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

105 return code
106
107 def getvalue(self) -> str:
108 ns: dict[str, Optional[set[str]]] = {}
109 lines: list[str] = []
110 for key, val in self.data.items():
111 if val is None:
112 ns[key] = val
113 elif key == "*":
114 lines.append(f"from {val} import *")
115 else:
116 ns.setdefault(val, set()).add(key) # type: ignore
117 for key, val in ns.items():
118 if val is None:
119 lines.append(f"import {key}")
120 else:
121 names = sorted(val, key=lambda s: s.lower())
122 lines.append(self._make_line(key, names))
123 return "\n".join(lines)
124
125
126class DeclaredNamespaces:

Callers 2

generate_wrapper_codeMethod · 0.45

Calls 4

_make_lineMethod · 0.95
itemsMethod · 0.80
setdefaultMethod · 0.80
addMethod · 0.45

Tested by

no test coverage detected