File size: 1,795 Bytes
64772a4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
########## TestClass ##########
# These utilities are for testing purposes

# The "cythonscope" test calls METH_O functions with their (self, arg) signature.
# cython: always_allow_keywords=False

from __future__ import print_function

cdef extern from *:
    cdef object __pyx_test_dep(object)

@cname('__pyx_TestClass')
cdef class TestClass(object):
    cdef public int value

    def __init__(self, int value):
        self.value = value

    def __str__(self):
        return f'TestClass({self.value})'

    cdef cdef_method(self, int value):
        print('Hello from cdef_method', value)

    cpdef cpdef_method(self, int value):
        print('Hello from cpdef_method', value)

    def def_method(self, int value):
        print('Hello from def_method', value)

    @cname('cdef_cname')
    cdef cdef_cname_method(self, int value):
        print("Hello from cdef_cname_method", value)

    @cname('cpdef_cname')
    cpdef cpdef_cname_method(self, int value):
        print("Hello from cpdef_cname_method", value)

    @cname('def_cname')
    def def_cname_method(self, int value):
        print("Hello from def_cname_method", value)

@cname('__pyx_test_call_other_cy_util')
cdef test_call(obj):
    print('test_call')
    __pyx_test_dep(obj)

@cname('__pyx_TestClass_New')
cdef _testclass_new(int value):
    return TestClass(value)

########### TestDep ##########

from __future__ import print_function

@cname('__pyx_test_dep')
cdef test_dep(obj):
    print('test_dep', obj)

########## TestScope ##########

@cname('__pyx_testscope')
cdef object _testscope(int value):
    return f"hello from cython scope, value={value}"

########## View.TestScope ##########

@cname('__pyx_view_testscope')
cdef object _testscope(int value):
    return f"hello from cython.view scope, value={value}"