예제 #1
0
 def resolve_kind(self, ary):
     if isinstance(ary.key, types.scalars.Float):
         val = 'f'
     elif isinstance(ary.key, types.scalars.Integer):
         val = 'i'
     else:
         return None  # other types not supported yet
     return types.StringLiteral(val)
예제 #2
0
 def resolve_argsort(self, ary, args, kws):
     assert not args
     kwargs = dict(kws)
     kind = kwargs.pop('kind', types.StringLiteral('quicksort'))
     if kwargs:
         msg = "Unsupported keywords: {!r}"
         raise TypingError(msg.format([k for k in kwargs.keys()]))
     if ary.ndim == 1:
         def argsort_stub(kind='quicksort'):
             pass
         pysig = utils.pysignature(argsort_stub)
         sig = signature(types.Array(types.intp, 1, 'C'), kind).replace(pysig=pysig)
         return sig
예제 #3
0
    def resolve_argsort(self, ary, args, kws):
        assert not args
        kwargs = dict(kws)
        kind = kwargs.pop("kind", types.StringLiteral("quicksort"))
        if not isinstance(kind, types.StringLiteral):
            raise errors.TypingError('"kind" must be a string literal')
        if kwargs:
            msg = "Unsupported keywords: {!r}"
            raise TypingError(msg.format([k for k in kwargs.keys()]))
        if ary.ndim == 1:

            def argsort_stub(kind="quicksort"):
                pass

            pysig = utils.pysignature(argsort_stub)
            sig = signature(
                UsmSharedArrayType(types.intp, 1, "C"), kind
            ).replace(pysig=pysig)
            return sig