Did I find the right examples for you? yes no

All Samples(30)  |  Call(25)  |  Derive(0)  |  Import(5)

src/c/y/CythonCTypesBackend-HEAD/Cython/CTypesBackend/ExternDefTransform.py   CythonCTypesBackend(Download)
from Cython.Compiler.Visitor import VisitorTransform
from Cython.Compiler.Nodes import CFuncDeclaratorNode, CVarDefNode, SingleAssignmentNode, CStructOrUnionDefNode, PyClassDefNode, StatListNode, PassStatNode, CPtrDeclaratorNode, DecoratorNode, FuncDefNode
from Cython.Compiler.ExprNodes import NameNode, AttributeNode, ListNode, NoneNode, TupleNode, StringNode, SimpleCallNode, ImportNode, CallNode
from Cython.Compiler.TreeFragment import TreeFragment
import ctypes
    def _ctype_to_node(self, type_name):
        return NameNode(0, name=type_name)
 
    def _cython_type_to_ctypes_node(self, cython_t):
        ctype_name = self._cythonTypeToCtypes(cython_t, getattr(cython_t, 'declarator', None))[2]
        rhs=SimpleCallNode(0,
                         child_attrs=[],
                         function=AttributeNode(0, obj=NameNode(0, name=u"cython"), attribute=u"ctypes_func"),
                         args=[NameNode(0, name="'%s'" % declarator.base.name), 
                               NameNode(0, name="'%s'" % libname), 

src/c/y/CythonCTypesBackend-HEAD/Cython/CTypesBackend/CDefVarTransform.py   CythonCTypesBackend(Download)
from Cython.Compiler.Visitor import VisitorTransform
from Cython.Compiler.TreeFragment import TreeFragment
from Cython.Compiler.Nodes import CPtrDeclaratorNode, CArrayDeclaratorNode
from Cython.Compiler.ExprNodes import NameNode, AttributeNode, SimpleCallNode
 
class CDefVarTransform(VisitorTransform):
    visit_Node = VisitorTransform.recurse_to_children
 
 
    __ctypes_declare_node = AttributeNode(0, obj=NameNode(0, name=u"cython"), attribute=u"ctypes_func")
            subType = SimpleCallNode(0,
                         child_attrs=[],
                         function=AttributeNode(0, obj=NameNode(0, name=u"ctypes"), attribute=u"POINTER"),
                         args=[self._get_type_node(decl.base, base_type, is_sub_call=True)])
 
            if not is_sub_call:
                subType = SimpleCallNode(0,
                         child_attrs=[],
                         function=AttributeNode(0, obj=NameNode(0, name=u"cython"), attribute=u"ctypes_declare"),

src/c/y/CythonCTypesBackend-HEAD/Cython/CTypesBackend/CDefVarManipulationTransform.py   CythonCTypesBackend(Download)
from Cython.Compiler.Visitor import VisitorTransform
from Cython.Compiler.Nodes import SingleAssignmentNode, CascadedAssignmentNode, InPlaceAssignmentNode, ParallelAssignmentNode
from Cython.Compiler.ExprNodes import AttributeNode, NameNode, SimpleCallNode
from Cython.Compiler.PyrexTypes import CStructOrUnionType
from Cython.Compiler.TreeFragment import TreeFragment

src/c/y/Cython-0.20.1/Cython/Compiler/Tests/TestSignatureMatching.py   Cython(Download)
import unittest
 
from Cython.Compiler import PyrexTypes as pt
from Cython.Compiler.ExprNodes import NameNode
from Cython.Compiler.PyrexTypes import CFuncTypeArg
    def assertMatches(self, expected_type, arg_types, functions):
        args = [ NameNode(None, type=arg_type) for arg_type in arg_types ]
        match = pt.best_match(args, functions)
        if expected_type is not None:
            self.assertNotEqual(None, match)
            ]
 
        functions = [ NameNode(None, type=t) for t in function_types ]
        self.assertMatches(function_types[0], [pt.c_int_type], functions)
        self.assertMatches(function_types[1], [pt.c_long_type], functions)
            ]
 
        functions = [ NameNode(None, type=t) for t in function_types ]
        self.assertMatches(function_types[0], [pt.c_int_type, pt.c_long_type], functions)
        self.assertMatches(function_types[1], [pt.c_long_type, pt.c_long_type], functions)
            ]
 
        functions = [ NameNode(None, type=t) for t in function_types ]
        self.assertMatches(function_types[0], [classes[0]], functions)
        self.assertMatches(function_types[1], [classes[1]], functions)

src/c/y/cython-HEAD/Cython/Compiler/Tests/TestSignatureMatching.py   cython(Download)
import unittest
 
from Cython.Compiler import PyrexTypes as pt
from Cython.Compiler.ExprNodes import NameNode
from Cython.Compiler.PyrexTypes import CFuncTypeArg
    def assertMatches(self, expected_type, arg_types, functions):
        args = [ NameNode(None, type=arg_type) for arg_type in arg_types ]
        match = pt.best_match(args, functions)
        if expected_type is not None:
            self.assertNotEqual(None, match)
            ]
 
        functions = [ NameNode(None, type=t) for t in function_types ]
        self.assertMatches(function_types[0], [pt.c_int_type], functions)
        self.assertMatches(function_types[1], [pt.c_long_type], functions)
            ]
 
        functions = [ NameNode(None, type=t) for t in function_types ]
        self.assertMatches(function_types[0], [pt.c_int_type, pt.c_long_type], functions)
        self.assertMatches(function_types[1], [pt.c_long_type, pt.c_long_type], functions)
            ]
 
        functions = [ NameNode(None, type=t) for t in function_types ]
        self.assertMatches(function_types[0], [classes[0]], functions)
        self.assertMatches(function_types[1], [classes[1]], functions)