MCPcopy Index your code
hub / github.com/RustPython/RustPython / gen_methods

Function gen_methods

scripts/whats_left.py:150–220  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

148
149
150def gen_methods():
151 types = [
152 bool,
153 bytearray,
154 bytes,
155 complex,
156 dict,
157 enumerate,
158 filter,
159 float,
160 frozenset,
161 int,
162 list,
163 map,
164 memoryview,
165 range,
166 set,
167 slice,
168 str,
169 super,
170 tuple,
171 object,
172 zip,
173 classmethod,
174 staticmethod,
175 property,
176 Exception,
177 BaseException,
178 ]
179 objects = [t.__name__ for t in types]
180 objects.append("type(None)")
181
182 iters = [
183 "type(bytearray().__iter__())",
184 "type(bytes().__iter__())",
185 "type(dict().__iter__())",
186 "type(dict().values().__iter__())",
187 "type(dict().items().__iter__())",
188 "type(dict().values())",
189 "type(dict().items())",
190 "type(set().__iter__())",
191 "type(list().__iter__())",
192 "type(range(0).__iter__())",
193 "type(str().__iter__())",
194 "type(tuple().__iter__())",
195 "type(memoryview(bytearray(b'0')).__iter__())",
196 ]
197
198 methods = {}
199 for typ_code in objects + iters:
200 typ = eval(typ_code)
201 attrs = []
202 for attr in dir(typ):
203 # Skip attributes in dir() but not actually accessible (e.g., descriptor that raises)
204 if not hasattr(typ, attr):
205 continue
206 if attr_is_not_inherited(typ, attr):
207 attrs.append((attr, extra_info(getattr(typ, attr))))

Callers 1

whats_left.pyFile · 0.85

Calls 9

dirFunction · 0.85
hasattrFunction · 0.85
attr_is_not_inheritedFunction · 0.85
extra_infoFunction · 0.85
getattrFunction · 0.85
sortedFunction · 0.85
evalFunction · 0.50
appendMethod · 0.45
keysMethod · 0.45

Tested by

no test coverage detected