MCPcopy Create free account
hub / github.com/AdaCompNUS/summit / gen_stub_method_def

Function gen_stub_method_def

PythonAPI/docs/doc_gen.py:211–221  ·  view source on GitHub ↗

Return python def as it should be written in stub files

(method)

Source from the content-addressed store, hash-verified

209
210
211def gen_stub_method_def(method):
212 """Return python def as it should be written in stub files"""
213 param = ''
214 method_name = method['def_name']
215 for p in method['params']:
216 p_type = join([': ', str(p['type'])]) if 'type' in p else ''
217 default = join([' = ', str(p['default'])]) if 'default' in p else ''
218 param = join([param, p['param_name'], p_type, default, ', '])
219 param = param[:-2] # delete the last ', '
220 return_type = join([' -> ', method['return']]) if 'return' in method else ''
221 return join([method_name, parentheses(param), return_type])
222
223
224def gen_doc_method_def(method, is_indx=False, with_self=True):

Callers

nothing calls this directly

Calls 2

joinFunction · 0.70
parenthesesFunction · 0.70

Tested by

no test coverage detected