File: cythonapp.pyx

package info (click to toggle)
python-tornado 6.2.0-3%2Bdeb12u1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 3,396 kB
  • sloc: python: 27,837; javascript: 156; sh: 99; ansic: 58; xml: 49; makefile: 48; sql: 23
file content (29 lines) | stat: -rw-r--r-- 780 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import cython
from tornado import gen
import pythonmodule

async def native_coroutine():
    x = await pythonmodule.hello()
    if x != "hello":
        raise ValueError("expected hello, got %r" % x)
    return "goodbye"

@gen.coroutine
def decorated_coroutine():
    x = yield pythonmodule.hello()
    if x != "hello":
        raise ValueError("expected hello, got %r" % x)
    return "goodbye"

# The binding directive is necessary for compatibility with
# ArgReplacer (and therefore return_future), but only because
# this is a static function.
@cython.binding(True)
def function_with_args(one, two, three):
    return (one, two, three)


class AClass:
    # methods don't need the binding directive.
    def method_with_args(one, two, three):
        return (one, two, three)