MCPcopy Create free account
hub / github.com/clab/dynet / pythonize_arguments

Function pythonize_arguments

doc/source/doc_util.py:9–31  ·  view source on GitHub ↗

Remove types from function arguments in cython

(arg_str)

Source from the content-addressed store, hash-verified

7ARGUMENTS = 3
8PASS=' pass\n'
9def pythonize_arguments(arg_str):
10 """
11 Remove types from function arguments in cython
12 """
13 out_args = []
14 # If there aren't any arguments return the empty string
15 if arg_str is None:
16 return out_str
17 args = arg_str.split(',')
18 for arg in args:
19 components = arg.split('=')
20 name_and_type=components[0].split(' ')
21 # There is probably type info
22 if name_and_type[-1]=='' and len(name_and_type)>1:
23 name=name_and_type[-2]
24 else:
25 name=name_and_type[-1]
26 # if there are default parameters
27 if len(components)>1:
28 name+='='+components[1]
29
30 out_args.append(name)
31 return ','.join(out_args)
32
33
34def get_indent(indent_str):

Callers 1

create_doc_copyFunction · 0.85

Calls 1

appendMethod · 0.80

Tested by

no test coverage detected