Remove types from function arguments in cython
(arg_str)
| 7 | ARGUMENTS = 3 |
| 8 | PASS=' pass\n' |
| 9 | def 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 | |
| 34 | def get_indent(indent_str): |
no test coverage detected