MCPcopy Create free account
hub / github.com/battlecode/battlecode-2018 / to_python

Method to_python

bindings/frankenswig/function.py:58–67  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

56 return result
57
58 def to_python(self):
59 # note: we assume that error + null checking, etc. will occur on the rust side.
60 # (it'll probably be much faster there in any case.)
61 pyargs = ', '.join(a.type.wrap_python_value(a.name) for a in self.args)
62
63 body = f'result = _lib.{self.name}({pyargs})\n'
64 body += '_check_errors()\n'
65 body += self.type.python_postfix()
66 body += 'return result\n'
67 return Function.pyentry(self.type, self.args, self.name, self.docs) + s(body, indent=4)
68
69class Method(Function):
70 '''A function contained within some type.'''

Callers

nothing calls this directly

Calls 4

sFunction · 0.85
pyentryMethod · 0.80
wrap_python_valueMethod · 0.45
python_postfixMethod · 0.45

Tested by

no test coverage detected