typesystem Package

typesystem Package

class numba.typesystem.partial

Bases: object

partial(func, *args, **keywords) - new function with partial application of the given arguments and keywords.

args

tuple of arguments to future partial calls

func

function object to use in future partial calls

keywords

dictionary of keyword arguments to future partial calls

class numba.typesystem.NumbaType(*args, **kwds)

Bases: numba.typesystem.types._NumbaType

Base for numba types.

conser = <numba.typesystem.itypesystem.Conser object at 0x105012310>
classmethod default_args(args, kwargs)
defaults = {}
mutable = True
typename = None
class numba.typesystem.builtin_(*args, **kwds)

Bases: numba.typesystem.types.known_value

argnames = ['name', 'value']
conser = <numba.typesystem.itypesystem.Conser object at 0x105019bd0>
defaults = {}
flags = ['object']
func
is_builtin = True
is_object = True
mutable = False
typename = 'builtin'
numba.typesystem.datetime(units=None, numpy=True)
class numba.typesystem.pointer(*args, **kwds)

Bases: numba.typesystem.types.NumbaType

argnames = ['base_type']
conser = <numba.typesystem.itypesystem.Conser object at 0x105012650>
defaults = {}
is_pointer = True
is_string
mutable = False
typename = 'pointer'
class numba.typesystem.tuple_(*args, **kwds)

Bases: numba.typesystem.types.ContainerListType

tuple(base_type, size)

conser = <numba.typesystem.itypesystem.Conser object at 0x105015b50>
defaults = {}
is_container = True
is_object = True
is_tuple = True
mutable = False
typename = 'tuple'
class numba.typesystem.imap

Bases: object

imap(func, *iterables) –> imap object

Make an iterator that computes the function using arguments from each of the iterables. Like map() except that it returns an iterator instead of a list and that it stops when the shortest iterable is exhausted instead of filling in None for shorter iterables.

next

x.next() -> the next value, or raise StopIteration

class numba.typesystem.carray(*args, **kwds)

Bases: numba.typesystem.types.NumbaType

argnames = ['base_type', 'size']
conser = <numba.typesystem.itypesystem.Conser object at 0x105012910>
defaults = {}
is_carray = True
mutable = False
typename = 'carray'
numba.typesystem.Accessor
class numba.typesystem.Conser(constructor)

Bases: object

Conser: constructs new objects only when not already available. Objects are weakreffed to sanitize memory consumption.

This allows the objects to be compared by and hashed on identity.

constructor
get(*args)
class numba.typesystem.autojit_function(*args, **kwds)

Bases: numba.typesystem.types.NumbaType

Type for autojit functions

argnames = ['autojit_func']
conser = <numba.typesystem.itypesystem.Conser object at 0x105012fd0>
defaults = {}
flags = ['object']
is_autojit_function = True
is_object = True
mutable = False
typename = 'autojit_function'
numba.typesystem.notconsing(cls)
class numba.typesystem.complex_(*args, **kwds)

Bases: numba.typesystem.types.NumbaType

argnames = ['base_type']
conser = <numba.typesystem.itypesystem.Conser object at 0x1050153d0>
defaults = {}
flags = ['numeric']
is_complex = True
is_numeric = True
itemsize
mutable = False
typename = 'complex'
numba.typesystem.consing(cls)

Cons calls to the constructor.

class numba.typesystem.reference(*args, **kwds)

Bases: numba.typesystem.types.NumbaType

A reference to an (primitive or Python) object. This is passed as a pointer and dereferences automatically.

Currently only supported for structs.

argnames = ['referenced_type']
conser = <numba.typesystem.itypesystem.Conser object at 0x105019350>
defaults = {}
is_reference = True
mutable = False
typename = 'reference'
class numba.typesystem.numpy_dtype(*args, **kwds)

Bases: numba.typesystem.types.NumbaType

Type of numpy dtypes

argnames = ['dtype']
conser = <numba.typesystem.itypesystem.Conser object at 0x105015290>
defaults = {}
flags = ['object']
is_numpy_dtype = True
is_object = True
mutable = False
typename = 'numpy_dtype'
class numba.typesystem.meta(*args, **kwds)

Bases: numba.typesystem.types.NumbaType

A type instance in user code. e.g. double(value). The Name node will have a cast-type with dst_type ‘double’.

argnames = ['dst_type']
conser = <numba.typesystem.itypesystem.Conser object at 0x105015890>
defaults = {}
flags = ['object', 'cast']
is_cast = True
is_meta = True
is_object = True
mutable = False
typename = 'meta'
class numba.typesystem.numpy_attribute(*args, **kwds)

Bases: numba.typesystem.types.NumbaType

argnames = ['module', 'attr']
conser = <numba.typesystem.itypesystem.Conser object at 0x105019050>
defaults = {}
flags = ['object', 'known_value']
is_known_value = True
is_numpy_attribute = True
is_object = True
typename = 'numpy_attribute'
value
class numba.typesystem.Type(kind, *params, **kwds)

Bases: object

Base of all types.

classmethod default_args(args, kwargs)

Add defaults to a given args tuple for type construction

metadata = None
classmethod unit(kind, name, flags=(), **kwds)

Nullary type constructor creating the most elementary of types. Does not compose any other type.

numba.typesystem.obj_type(name)
numba.typesystem.timedelta(units=None, numpy=True)
class numba.typesystem.method(*args, **kwds)

Bases: numba.typesystem.types.NumbaType

Method of something.

base_type: the object type the attribute was accessed on
argnames = ['base_type', 'attr_name']
conser = <numba.typesystem.itypesystem.Conser object at 0x105019490>
defaults = {}
flags = ['object']
is_method = True
is_object = True
mutable = False
typename = 'method'
class numba.typesystem.dict_(*args, **kwds)

Bases: numba.typesystem.types.MapContainerType

dict(key, value, size)

conser = <numba.typesystem.itypesystem.Conser object at 0x105015f10>
defaults = {}
is_dict = True
is_object = True
mutable = False
typename = 'dict'
class numba.typesystem.known_value(*args, **kwds)

Bases: numba.typesystem.types.NumbaType

Type which is associated with a known value or well-defined symbolic expression:

np.add => np.add np.add.reduce => (np.add, “reduce”)
(Remember that unbound methods like np.add.reduce are transient, i.e.
np.add.reduce is not np.add.reduce).
argnames = ['value']
conser = <numba.typesystem.itypesystem.Conser object at 0x105019810>
defaults = {}
is_known_value = True
mutable = False
typename = 'known_value'
class numba.typesystem.ContainerListType(*args, **kwds)

Bases: numba.typesystem.types.NumbaType

Parameters:
  • base_type – the element type of the tuple
  • size – set to a value >= 0 is the size is known
Returns:

a tuple type representation

argnames = ['base_type', 'size']
conser = <numba.typesystem.itypesystem.Conser object at 0x1050159d0>
defaults = {}
flags = ['object', 'container']
is_container = True
is_object = True
is_sized()
mutable = False
numba.typesystem.rank(type)
class numba.typesystem.module_attribute(*args, **kwds)

Bases: numba.typesystem.types.NumbaType

argnames = ['module', 'attr']
conser = <numba.typesystem.itypesystem.Conser object at 0x1050191d0>
defaults = {}
flags = ['object', 'known_value']
is_known_value = True
is_module_attribute = True
is_object = True
typename = 'module_attribute'
value
numba.typesystem.array(dtype, ndim, is_c_contig=False, is_f_contig=False, inner_contig=False)
Parameters:
  • dtype – the Numba dtype type (e.g. double)
  • ndim – the array dimensionality (int)
Returns:

an array type representation

numba.typesystem.unit(*args, **kwargs)
class numba.typesystem.global_(*args, **kwds)

Bases: numba.typesystem.types.known_value

Global type

conser = <numba.typesystem.itypesystem.Conser object at 0x105019ad0>
defaults = {}
is_global = True
mutable = True
typename = 'global'
class numba.typesystem.function(*args, **kwds)

Bases: numba.typesystem.types.NumbaType

actual_signature

Passing structs by value is not properly supported for different calling conventions in LLVM, so we take an extra argument pointing to a caller-allocated struct value.

add_arg(i, arg)
argnames = ['return_type', 'args', 'name', 'is_vararg']
conser = <numba.typesystem.itypesystem.Conser object at 0x105012550>
defaults = {'is_vararg': False, 'name': None}
is_function = True
mutable = False
struct_by_reference
struct_return_type
typename = 'function'
class numba.typesystem.array_(*args, **kwds)

Bases: numba.typesystem.types.NumbaType

An array type. array_ may be sliced to obtain a subtype:

>>> double[:, :, ::1][1:]
double[:, ::1]
>>> double[:, :, ::1][:-1]
double[:, :]
>>> double[::1, :, :][:-1]
double[::1, :]
>>> double[::1, :, :][1:]
double[:, :]
argnames = ['dtype', 'ndim', 'is_c_contig', 'is_f_contig', 'inner_contig']
conser = <numba.typesystem.itypesystem.Conser object at 0x105012d90>
defaults = {'is_f_contig': False, 'is_c_contig': False, 'inner_contig': False}
flags = ['object']
is_array = True
is_object = True
mutable = False
pointer()
strided
typename = 'array'
numba.typesystem.sort_key(t)
class numba.typesystem.module(*args, **kwds)

Bases: numba.typesystem.types.known_value

Represents a type for modules.

Attributes:
is_numpy_module: whether the module is the numpy module module: in case of numpy, the numpy module or a submodule
conser = <numba.typesystem.itypesystem.Conser object at 0x105019d50>
defaults = {}
flags = ['object']
is_math_module
is_module = True
is_numba_module
is_numpy_module
is_object = True
module
mutable = False
typename = 'module'
class numba.typesystem.jit_function(*args, **kwds)

Bases: numba.typesystem.types.NumbaType

Type for jit functions

argnames = ['jit_func']
conser = <numba.typesystem.itypesystem.Conser object at 0x105015150>
defaults = {}
flags = ['object']
is_jit_function = True
is_object = True
mutable = False
typename = 'jit_function'
class numba.typesystem.pointer_to_function(*args, **kwds)

Bases: numba.typesystem.types.NumbaType

Pointer to a function at a known address represented by some Python
object (e.g. a ctypes or CFFI function).
argnames = ['obj', 'ptr', 'signature']
conser = <numba.typesystem.itypesystem.Conser object at 0x105019610>
defaults = {}
flags = ['object']
is_object = True
is_pointer_to_function = True
typename = 'pointer_to_function'
class numba.typesystem.list_(*args, **kwds)

Bases: numba.typesystem.types.ContainerListType

list(base_type, size)

conser = <numba.typesystem.itypesystem.Conser object at 0x105015c50>
defaults = {}
is_container = True
is_list = True
is_object = True
mutable = False
typename = 'list'
class numba.typesystem.TypeMetaClass(name, bases, dict)

Bases: type

Metaclass for numba types, conses immutable types.

numba.typesystem.struct_(fields=(), name=None, readonly=False, packed=False, **kwargs)

Create a mutable struct type

class numba.typesystem.timedelta_(*args, **kwds)

Bases: numba.typesystem.types.NumbaType

argnames = ['diff', 'units', 'units_char']
conser = <numba.typesystem.itypesystem.Conser object at 0x1050156d0>
defaults = {}
flags = ['numeric']
is_numeric = True
is_numpy_timedelta = True
is_timedelta = True
itemsize
mutable = False
typename = 'timedelta'
class numba.typesystem.known_pointer(*args, **kwds)

Bases: numba.typesystem.types.pointer

argnames = ['base_type', 'address']
conser = <numba.typesystem.itypesystem.Conser object at 0x105019950>
defaults = {}
is_known_pointer = True
mutable = False
typename = 'known_pointer'
class numba.typesystem.istruct(*args, **kwds)

Bases: numba.typesystem.types.NumbaType

argnames = ['fields', 'name', 'readonly', 'packed']
conser = <numba.typesystem.itypesystem.Conser object at 0x105012a90>
defaults = {'readonly': False, 'name': None, 'packed': False}
fielddict
is_istruct = True
is_prefix(other_struct)
mutable = False
offsetof(field_name)

Compute the offset of a field. Must be used only after mutation has finished.

subtypes
typename = 'istruct'
class numba.typesystem.datetime_(*args, **kwds)

Bases: numba.typesystem.types.NumbaType

argnames = ['timestamp', 'units', 'units_char']
conser = <numba.typesystem.itypesystem.Conser object at 0x105015510>
defaults = {}
flags = ['numeric']
is_datetime = True
is_numeric = True
is_numpy_datetime = True
itemsize
mutable = False
typename = 'datetime'
numba.typesystem.add_flags(obj, flags)
numba.typesystem.from_numpy_dtype(np_dtype)
Parameters:np_dtype – the NumPy dtype (e.g. np.dtype(np.double))
Returns:a dtype type representation
class numba.typesystem.Function(signature, py_func)

Bases: object

Function types may be called with Python functions to create a Function object. This may be used to minivect users for their own purposes. e.g.

@double(double, double) def myfunc(...):

...
numba.typesystem.pass_by_ref(type)
class numba.typesystem.MapContainerType(*args, **kwds)

Bases: numba.typesystem.types.NumbaType

argnames = ['key_type', 'value_type', 'size']
conser = <numba.typesystem.itypesystem.Conser object at 0x105015d50>
defaults = {}
flags = ['object']
is_object = True
mutable = False
numba.typesystem.tyname(name)
class numba.typesystem.sized_pointer(*args, **kwds)

Bases: numba.typesystem.types.NumbaType

A pointer with knowledge of its range.

E.g. an array’s ‘shape’ or ‘strides’ attribute. This also allow tuple unpacking.

argnames = ['base_type', 'size']
conser = <numba.typesystem.itypesystem.Conser object at 0x105012790>
defaults = {}
flags = ['pointer']
is_pointer = True
is_sized_pointer = True
mutable = False
typename = 'sized_pointer'

closuretypes Module

Types for closures and inner functions.

class numba.typesystem.closuretypes.ClosureScopeType(py_class, parent_scope)

Bases: numba.exttypes.types.extensiontype.ExtensionType

Type of the enclosing scope for closures. This is always passed in as first argument to the function.

conser = <numba.typesystem.itypesystem.Conser object at 0x105025190>
defaults = {}
is_closure_scope = True
is_final = True
is_object = True
typename = 'closure_scope'
class numba.typesystem.closuretypes.ClosureType(*args, **kwds)

Bases: numba.typesystem.types.NumbaType

Type of closures and inner functions.

add_scope_arg(scope_type)
argnames = ['signature', 'closure']
conser = <numba.typesystem.itypesystem.Conser object at 0x10501cc10>
defaults = {'closure': None}
flags = ['object']
is_closure = True
is_object = True
typename = 'closure'

constants Module

Default rules for the typing of constants.

numba.typesystem.constants.find_first(callables, value)
numba.typesystem.constants.find_match(matchtable, value)
numba.typesystem.constants.from_cffi(value, u)
numba.typesystem.constants.from_ctypes(value, u)
numba.typesystem.constants.from_typefunc(value, u)
numba.typesystem.constants.get_constant_typer(universe, typeof, promote)

Get a function mapping values to types, which returns None if unsuccessful.

numba.typesystem.constants.get_default_match_table(u)

Get a matcher table: { (type -> bool) : (value -> type) }

numba.typesystem.constants.get_default_typeof(universe, promote)
numba.typesystem.constants.get_default_typing_rules(u, typeof, promote)

Get a table mapping Python classes to handlers (value -> type)

Parameters:u – The type universe
numba.typesystem.constants.get_typing_defaults(u)

Get a simple table mapping Python classes to types.

Parameters:u – The type universe
numba.typesystem.constants.is_NULL(value)
numba.typesystem.constants.is_autojit_func(value)
numba.typesystem.constants.is_dtype_constructor(value)
numba.typesystem.constants.is_numba_exttype(value)
numba.typesystem.constants.is_numpy_scalar(value)
numba.typesystem.constants.is_registered(value)
numba.typesystem.constants.object_typer(universe, value)

ctypestypes Module

ctypes type universe.

numba.typesystem.ctypestypes.cint(name)

defaults Module

Type defaults

numba.typesystem.defaults.compose(f, g)
numba.typesystem.defaults.lowerer(table)

itypesystem Module

Inferface for our typesystems.

Some requirements:

  • The typesystem must allow us to switch between low-level representations. For instance, we may want to represent an array as a NumPy ndarray, a Py_buffer, or some other representation.

  • The sizes of atom types (e.g. int) must be easily customizable. This allows an interpreter to switch sizes to simulate different platforms.

  • Type representations and sizes, must be overridable without reimplementing the type. E.g. an atom type can be sliced to create an array type, which should be separate from its low-level representation.

  • Types should map easily between type domains of the same level, e.g. between the low-level numba and llvm types. Ideally this forms an isomorphism, which is precluded by ctypes and numpy type systems:

    >>> ctypes.c_longlong
    <class 'ctypes.c_long'>
    
  • No type system but our own should be entrenched in any part of the codebase, including the code generator.

  • Sets of type constructors (type universes) must be composable. For instance, we may want to extend a low-level type systems of ints and pointers with objects to yield a type universe supporting both constructs.

  • Universes must be re-usable across type-systems. Types of universes represent abstract type concepts, and the type-systems give meaning and representation to values of those types.

  • Types must be immutable and consed, i.e. ts.pointer(base) is ts.pointer(base) must always be True

  • The use of a certain typesystem must suggest at which level the corresponding terms operate.

  • Conversion code should be written with minimal effort:

    • unit types should map immediately between domains of the same level
    • parametric types should naturally re-construct in domains of the same level
  • Converting a type to a lower-level domain constitutes a one-way conversion. This should, where possible, constitute a lowering in the same domain followed by a conversion. E.g.:

    def numba_complex_to_llvm(type):

    return to_llvm(lower_complex(type))

  • Type constructors must be substitutable. E.g. an external user may want to construct a universe where type construction is logged, or where special type checking is performed, disallowing certain compositions.

class numba.typesystem.itypesystem.TypeSystem(universe, promote=None, typeof=None, converters=None)

Bases: object

convert(codomain_name, type)
class numba.typesystem.itypesystem.Type(kind, *params, **kwds)

Bases: object

Base of all types.

classmethod default_args(args, kwargs)

Add defaults to a given args tuple for type construction

metadata = None
classmethod unit(kind, name, flags=(), **kwds)

Nullary type constructor creating the most elementary of types. Does not compose any other type.

class numba.typesystem.itypesystem.ConstantTyper(universe, typetable, handler_table)

Bases: object

typeof(value)

Get a concrete type given a python value. Return None f this ConstantTyper cannot type the constant

class numba.typesystem.itypesystem.Conser(constructor)

Bases: object

Conser: constructs new objects only when not already available. Objects are weakreffed to sanitize memory consumption.

This allows the objects to be compared by and hashed on identity.

constructor
get(*args)
class numba.typesystem.itypesystem.TypeConser(type)

Bases: object

get(*args, **kwargs)
numba.typesystem.itypesystem.get_conser(ctor)
numba.typesystem.itypesystem.consing(ctor)

kinds Module

Kinds for numba types.

llvmtypes Module

numba.typesystem.llvmtypes.array_(dtype, ndim, *args)
numba.typesystem.llvmtypes.function(rettype, argtypes, name=None, is_vararg=False)
numba.typesystem.llvmtypes.get_target_triple()
numba.typesystem.llvmtypes.lbool()
numba.typesystem.llvmtypes.lfloat(name, itemsize)
numba.typesystem.llvmtypes.lint(name, itemsize)
numba.typesystem.llvmtypes.pointer(base_type)
numba.typesystem.llvmtypes.size()

x.__getitem__(y) <==> x[y]

numba.typesystem.llvmtypes.sized_pointer(base_type, size)
numba.typesystem.llvmtypes.struct_(fields, name=None, readonly=False, packed=False)

lowering Module

Type lowering from a higher-level domain to a lower-level domain.

numba.typesystem.lowering.create_type_lowerer(table, domain, codomain)

Create a type lowerer from a domain to a codomain given a lowering table.

numba.typesystem.lowering.find_func(table, kind, flags, default=None)

Get a function form the table by resolving any indirections

numba.typesystem.lowering.find_matches(table, flags)

Find a lowering function from the flags of the type

numba.typesystem.lowering.lower_complex(domain, codomain, type, params)
numba.typesystem.lowering.lower_datetime(domain, codomain, type, params)
numba.typesystem.lowering.lower_extmethod(domain, codomain, type, params)
numba.typesystem.lowering.lower_function(domain, codomain, type, params)
numba.typesystem.lowering.lower_object(domain, codomain, type, params)
numba.typesystem.lowering.lower_string(domain, codomain, type, params)
numba.typesystem.lowering.lower_timedelta(domain, codomain, type, params)
numba.typesystem.lowering.lower_to_pointer(domain, codomain, type, params)

numbatypes Module

Shorthands for type constructing, promotions, etc.

class numba.typesystem.numbatypes.partial

Bases: object

partial(func, *args, **keywords) - new function with partial application of the given arguments and keywords.

args

tuple of arguments to future partial calls

func

function object to use in future partial calls

keywords

dictionary of keyword arguments to future partial calls

class numba.typesystem.numbatypes.NumbaType(*args, **kwds)

Bases: numba.typesystem.types._NumbaType

Base for numba types.

conser = <numba.typesystem.itypesystem.Conser object at 0x105012310>
classmethod default_args(args, kwargs)
defaults = {}
mutable = True
typename = None
class numba.typesystem.numbatypes.builtin_(*args, **kwds)

Bases: numba.typesystem.types.known_value

argnames = ['name', 'value']
conser = <numba.typesystem.itypesystem.Conser object at 0x105019bd0>
defaults = {}
flags = ['object']
func
is_builtin = True
is_object = True
mutable = False
typename = 'builtin'
numba.typesystem.numbatypes.datetime(units=None, numpy=True)
class numba.typesystem.numbatypes.pointer(*args, **kwds)

Bases: numba.typesystem.types.NumbaType

argnames = ['base_type']
conser = <numba.typesystem.itypesystem.Conser object at 0x105012650>
defaults = {}
is_pointer = True
is_string
mutable = False
typename = 'pointer'
class numba.typesystem.numbatypes.tuple_(*args, **kwds)

Bases: numba.typesystem.types.ContainerListType

tuple(base_type, size)

conser = <numba.typesystem.itypesystem.Conser object at 0x105015b50>
defaults = {}
is_container = True
is_object = True
is_tuple = True
mutable = False
typename = 'tuple'
class numba.typesystem.numbatypes.imap

Bases: object

imap(func, *iterables) –> imap object

Make an iterator that computes the function using arguments from each of the iterables. Like map() except that it returns an iterator instead of a list and that it stops when the shortest iterable is exhausted instead of filling in None for shorter iterables.

next

x.next() -> the next value, or raise StopIteration

class numba.typesystem.numbatypes.carray(*args, **kwds)

Bases: numba.typesystem.types.NumbaType

argnames = ['base_type', 'size']
conser = <numba.typesystem.itypesystem.Conser object at 0x105012910>
defaults = {}
is_carray = True
mutable = False
typename = 'carray'
numba.typesystem.numbatypes.Accessor
class numba.typesystem.numbatypes.Conser(constructor)

Bases: object

Conser: constructs new objects only when not already available. Objects are weakreffed to sanitize memory consumption.

This allows the objects to be compared by and hashed on identity.

constructor
get(*args)
class numba.typesystem.numbatypes.autojit_function(*args, **kwds)

Bases: numba.typesystem.types.NumbaType

Type for autojit functions

argnames = ['autojit_func']
conser = <numba.typesystem.itypesystem.Conser object at 0x105012fd0>
defaults = {}
flags = ['object']
is_autojit_function = True
is_object = True
mutable = False
typename = 'autojit_function'
numba.typesystem.numbatypes.notconsing(cls)
class numba.typesystem.numbatypes.complex_(*args, **kwds)

Bases: numba.typesystem.types.NumbaType

argnames = ['base_type']
conser = <numba.typesystem.itypesystem.Conser object at 0x1050153d0>
defaults = {}
flags = ['numeric']
is_complex = True
is_numeric = True
itemsize
mutable = False
typename = 'complex'
numba.typesystem.numbatypes.consing(cls)

Cons calls to the constructor.

class numba.typesystem.numbatypes.reference(*args, **kwds)

Bases: numba.typesystem.types.NumbaType

A reference to an (primitive or Python) object. This is passed as a pointer and dereferences automatically.

Currently only supported for structs.

argnames = ['referenced_type']
conser = <numba.typesystem.itypesystem.Conser object at 0x105019350>
defaults = {}
is_reference = True
mutable = False
typename = 'reference'
class numba.typesystem.numbatypes.numpy_dtype(*args, **kwds)

Bases: numba.typesystem.types.NumbaType

Type of numpy dtypes

argnames = ['dtype']
conser = <numba.typesystem.itypesystem.Conser object at 0x105015290>
defaults = {}
flags = ['object']
is_numpy_dtype = True
is_object = True
mutable = False
typename = 'numpy_dtype'
class numba.typesystem.numbatypes.meta(*args, **kwds)

Bases: numba.typesystem.types.NumbaType

A type instance in user code. e.g. double(value). The Name node will have a cast-type with dst_type ‘double’.

argnames = ['dst_type']
conser = <numba.typesystem.itypesystem.Conser object at 0x105015890>
defaults = {}
flags = ['object', 'cast']
is_cast = True
is_meta = True
is_object = True
mutable = False
typename = 'meta'
class numba.typesystem.numbatypes.numpy_attribute(*args, **kwds)

Bases: numba.typesystem.types.NumbaType

argnames = ['module', 'attr']
conser = <numba.typesystem.itypesystem.Conser object at 0x105019050>
defaults = {}
flags = ['object', 'known_value']
is_known_value = True
is_numpy_attribute = True
is_object = True
typename = 'numpy_attribute'
value
class numba.typesystem.numbatypes.Type(kind, *params, **kwds)

Bases: object

Base of all types.

classmethod default_args(args, kwargs)

Add defaults to a given args tuple for type construction

metadata = None
classmethod unit(kind, name, flags=(), **kwds)

Nullary type constructor creating the most elementary of types. Does not compose any other type.

numba.typesystem.numbatypes.obj_type(name)
numba.typesystem.numbatypes.timedelta(units=None, numpy=True)
class numba.typesystem.numbatypes.method(*args, **kwds)

Bases: numba.typesystem.types.NumbaType

Method of something.

base_type: the object type the attribute was accessed on
argnames = ['base_type', 'attr_name']
conser = <numba.typesystem.itypesystem.Conser object at 0x105019490>
defaults = {}
flags = ['object']
is_method = True
is_object = True
mutable = False
typename = 'method'
class numba.typesystem.numbatypes.dict_(*args, **kwds)

Bases: numba.typesystem.types.MapContainerType

dict(key, value, size)

conser = <numba.typesystem.itypesystem.Conser object at 0x105015f10>
defaults = {}
is_dict = True
is_object = True
mutable = False
typename = 'dict'
class numba.typesystem.numbatypes.known_value(*args, **kwds)

Bases: numba.typesystem.types.NumbaType

Type which is associated with a known value or well-defined symbolic expression:

np.add => np.add np.add.reduce => (np.add, “reduce”)
(Remember that unbound methods like np.add.reduce are transient, i.e.
np.add.reduce is not np.add.reduce).
argnames = ['value']
conser = <numba.typesystem.itypesystem.Conser object at 0x105019810>
defaults = {}
is_known_value = True
mutable = False
typename = 'known_value'
class numba.typesystem.numbatypes.ContainerListType(*args, **kwds)

Bases: numba.typesystem.types.NumbaType

Parameters:
  • base_type – the element type of the tuple
  • size – set to a value >= 0 is the size is known
Returns:

a tuple type representation

argnames = ['base_type', 'size']
conser = <numba.typesystem.itypesystem.Conser object at 0x1050159d0>
defaults = {}
flags = ['object', 'container']
is_container = True
is_object = True
is_sized()
mutable = False
numba.typesystem.numbatypes.rank(type)
class numba.typesystem.numbatypes.module_attribute(*args, **kwds)

Bases: numba.typesystem.types.NumbaType

argnames = ['module', 'attr']
conser = <numba.typesystem.itypesystem.Conser object at 0x1050191d0>
defaults = {}
flags = ['object', 'known_value']
is_known_value = True
is_module_attribute = True
is_object = True
typename = 'module_attribute'
value
numba.typesystem.numbatypes.array(dtype, ndim, is_c_contig=False, is_f_contig=False, inner_contig=False)
Parameters:
  • dtype – the Numba dtype type (e.g. double)
  • ndim – the array dimensionality (int)
Returns:

an array type representation

numba.typesystem.numbatypes.unit(*args, **kwargs)
class numba.typesystem.numbatypes.global_(*args, **kwds)

Bases: numba.typesystem.types.known_value

Global type

conser = <numba.typesystem.itypesystem.Conser object at 0x105019ad0>
defaults = {}
is_global = True
mutable = True
typename = 'global'
class numba.typesystem.numbatypes.function(*args, **kwds)

Bases: numba.typesystem.types.NumbaType

actual_signature

Passing structs by value is not properly supported for different calling conventions in LLVM, so we take an extra argument pointing to a caller-allocated struct value.

add_arg(i, arg)
argnames = ['return_type', 'args', 'name', 'is_vararg']
conser = <numba.typesystem.itypesystem.Conser object at 0x105012550>
defaults = {'is_vararg': False, 'name': None}
is_function = True
mutable = False
struct_by_reference
struct_return_type
typename = 'function'
class numba.typesystem.numbatypes.array_(*args, **kwds)

Bases: numba.typesystem.types.NumbaType

An array type. array_ may be sliced to obtain a subtype:

>>> double[:, :, ::1][1:]
double[:, ::1]
>>> double[:, :, ::1][:-1]
double[:, :]
>>> double[::1, :, :][:-1]
double[::1, :]
>>> double[::1, :, :][1:]
double[:, :]
argnames = ['dtype', 'ndim', 'is_c_contig', 'is_f_contig', 'inner_contig']
conser = <numba.typesystem.itypesystem.Conser object at 0x105012d90>
defaults = {'is_f_contig': False, 'is_c_contig': False, 'inner_contig': False}
flags = ['object']
is_array = True
is_object = True
mutable = False
pointer()
strided
typename = 'array'
numba.typesystem.numbatypes.sort_key(t)
class numba.typesystem.numbatypes.module(*args, **kwds)

Bases: numba.typesystem.types.known_value

Represents a type for modules.

Attributes:
is_numpy_module: whether the module is the numpy module module: in case of numpy, the numpy module or a submodule
conser = <numba.typesystem.itypesystem.Conser object at 0x105019d50>
defaults = {}
flags = ['object']
is_math_module
is_module = True
is_numba_module
is_numpy_module
is_object = True
module
mutable = False
typename = 'module'
class numba.typesystem.numbatypes.jit_function(*args, **kwds)

Bases: numba.typesystem.types.NumbaType

Type for jit functions

argnames = ['jit_func']
conser = <numba.typesystem.itypesystem.Conser object at 0x105015150>
defaults = {}
flags = ['object']
is_jit_function = True
is_object = True
mutable = False
typename = 'jit_function'
class numba.typesystem.numbatypes.pointer_to_function(*args, **kwds)

Bases: numba.typesystem.types.NumbaType

Pointer to a function at a known address represented by some Python
object (e.g. a ctypes or CFFI function).
argnames = ['obj', 'ptr', 'signature']
conser = <numba.typesystem.itypesystem.Conser object at 0x105019610>
defaults = {}
flags = ['object']
is_object = True
is_pointer_to_function = True
typename = 'pointer_to_function'
class numba.typesystem.numbatypes.list_(*args, **kwds)

Bases: numba.typesystem.types.ContainerListType

list(base_type, size)

conser = <numba.typesystem.itypesystem.Conser object at 0x105015c50>
defaults = {}
is_container = True
is_list = True
is_object = True
mutable = False
typename = 'list'
class numba.typesystem.numbatypes.TypeMetaClass(name, bases, dict)

Bases: type

Metaclass for numba types, conses immutable types.

numba.typesystem.numbatypes.struct_(fields=(), name=None, readonly=False, packed=False, **kwargs)

Create a mutable struct type

class numba.typesystem.numbatypes.timedelta_(*args, **kwds)

Bases: numba.typesystem.types.NumbaType

argnames = ['diff', 'units', 'units_char']
conser = <numba.typesystem.itypesystem.Conser object at 0x1050156d0>
defaults = {}
flags = ['numeric']
is_numeric = True
is_numpy_timedelta = True
is_timedelta = True
itemsize
mutable = False
typename = 'timedelta'
class numba.typesystem.numbatypes.known_pointer(*args, **kwds)

Bases: numba.typesystem.types.pointer

argnames = ['base_type', 'address']
conser = <numba.typesystem.itypesystem.Conser object at 0x105019950>
defaults = {}
is_known_pointer = True
mutable = False
typename = 'known_pointer'
class numba.typesystem.numbatypes.istruct(*args, **kwds)

Bases: numba.typesystem.types.NumbaType

argnames = ['fields', 'name', 'readonly', 'packed']
conser = <numba.typesystem.itypesystem.Conser object at 0x105012a90>
defaults = {'readonly': False, 'name': None, 'packed': False}
fielddict
is_istruct = True
is_prefix(other_struct)
mutable = False
offsetof(field_name)

Compute the offset of a field. Must be used only after mutation has finished.

subtypes
typename = 'istruct'
class numba.typesystem.numbatypes.datetime_(*args, **kwds)

Bases: numba.typesystem.types.NumbaType

argnames = ['timestamp', 'units', 'units_char']
conser = <numba.typesystem.itypesystem.Conser object at 0x105015510>
defaults = {}
flags = ['numeric']
is_datetime = True
is_numeric = True
is_numpy_datetime = True
itemsize
mutable = False
typename = 'datetime'
numba.typesystem.numbatypes.add_flags(obj, flags)
numba.typesystem.numbatypes.from_numpy_dtype(np_dtype)
Parameters:np_dtype – the NumPy dtype (e.g. np.dtype(np.double))
Returns:a dtype type representation
class numba.typesystem.numbatypes.Function(signature, py_func)

Bases: object

Function types may be called with Python functions to create a Function object. This may be used to minivect users for their own purposes. e.g.

@double(double, double) def myfunc(...):

...
numba.typesystem.numbatypes.pass_by_ref(type)
class numba.typesystem.numbatypes.MapContainerType(*args, **kwds)

Bases: numba.typesystem.types.NumbaType

argnames = ['key_type', 'value_type', 'size']
conser = <numba.typesystem.itypesystem.Conser object at 0x105015d50>
defaults = {}
flags = ['object']
is_object = True
mutable = False
numba.typesystem.numbatypes.tyname(name)
class numba.typesystem.numbatypes.sized_pointer(*args, **kwds)

Bases: numba.typesystem.types.NumbaType

A pointer with knowledge of its range.

E.g. an array’s ‘shape’ or ‘strides’ attribute. This also allow tuple unpacking.

argnames = ['base_type', 'size']
conser = <numba.typesystem.itypesystem.Conser object at 0x105012790>
defaults = {}
flags = ['pointer']
is_pointer = True
is_sized_pointer = True
mutable = False
typename = 'sized_pointer'

numpy_support Module

numba.typesystem.numpy_support.is_native_int()

D.__contains__(k) -> True if D has a key k, else False

numba.typesystem.numpy_support.map_dtype(dtype)

Map a NumPy dtype to a minitype.

>>> map_dtype(np.dtype(np.int32))
int32
>>> map_dtype(np.dtype(np.int64))
int64
>>> map_dtype(np.dtype(np.object))
PyObject *
>>> map_dtype(np.dtype(np.float64))
float64
>>> map_dtype(np.dtype(np.complex128))
complex128
numba.typesystem.numpy_support.to_dtype(type)

promotion Module

class numba.typesystem.promotion.DefaultPromoter(universe, promotion_table)

Bases: object

promote(type1, type2)

Promote two arbitrary types

numba.typesystem.promotion.find_type_of_size(size, typelist)
numba.typesystem.promotion.get_default_promoter(universe)
numba.typesystem.promotion.have_properties(type1, type2, property1, property2)

Return whether the two types satisfy the two properties:

>>> have_properties(int32, int32.pointer(), "is_pointer", "is_int")
True
numba.typesystem.promotion.promote_array_and_other(u, promote, type1, type2)
numba.typesystem.promotion.promote_arrays(u, promote, type1, type2)

Promote two array types in an expression to a new array type

numba.typesystem.promotion.promote_from_table(table, u, promote, type1, type2)
numba.typesystem.promotion.promote_int(u, promote, type1, type2)

Promote two integer types. We have to remain portable at this point, e.g. promote_int(Py_ssize_t, int) should be Py_ssize_t, and not int64 or int32.

numba.typesystem.promotion.promote_numeric(u, promote, type1, type2)

Promote two numeric types

ssatypes Module

This module provides deferred types used for type dependences that haven’t been processed yet, or circular dependences.

  1. Types participating in statements that are deferred until later:

    x = 0 # x_0 for i in range(10):

    # x_1 = phi(x_0, x_2) print x x = i # x_2

    Here x_2 is not resolved yet when we encounter the print statement.

  2. Types participating in type graph cycles:

    x = 0 # x_0 for i in range(10):

    # x_1 = phi(x_0, x_2) print x x = x + i # x_2

    Here we have:

    type(x_1) = promote(type(x_0) = int, type(x_2)) type(x_2) = promote(type(x_1), type(i) = Py_ssize_t)

    This is a simple cycle that will constitute the following graph:

    x_0 (int)

    x_1 __

    X_2

    i_0 (Py_ssize_t)

class numba.typesystem.ssatypes.DeferredAttrType(variable, type_inferer, node, **kwds)

Bases: numba.typesystem.ssatypes.ReanalyzeCircularType

Used when we don’t know the type of the object of which we access an attribute.

conser = <numba.typesystem.itypesystem.Conser object at 0x10503b790>
defaults = {}
retry_infer()
class numba.typesystem.ssatypes.DeferredCallType(variable, type_inferer, call_node, **kwds)

Bases: numba.typesystem.ssatypes.ReanalyzeCircularType

Used when we don’t know the type of the expression being called, or when we have an autojitting function and don’t know all the argument types.

conser = <numba.typesystem.itypesystem.Conser object at 0x10503b890>
defaults = {}
retry_infer()
class numba.typesystem.ssatypes.DeferredIndexType(variable, type_inferer, index_node, **kwds)

Bases: numba.typesystem.ssatypes.ReanalyzeCircularType

Used when we don’t know the type of the variable being indexed.

conser = <numba.typesystem.itypesystem.Conser object at 0x10503b690>
defaults = {}
retry_infer()
class numba.typesystem.ssatypes.DeferredType(variable, **kwds)

Bases: numba.typesystem.ssatypes.UnresolvedType

We don’t know what the type is at the point we need a type, so we create a deferred type.

Depends on: self.variable.type

Example:

def func():
for i in range(10):

# type(x) = phi(undef, deferred(x_1)) = phi(deferred(x_1)) if i > 1:

print x # type is deferred(x_1)

x = ... # resolve deferred(x_1) to type(...)

conser = <numba.typesystem.itypesystem.Conser object at 0x10503b490>
defaults = {}
is_deferred = True
update()
updated = False
class numba.typesystem.ssatypes.PromotionType(variable, promote, types, assignment=False, **kwds)

Bases: numba.typesystem.ssatypes.UnresolvedType

add_type(seen, type, types)
conser = <numba.typesystem.itypesystem.Conser object at 0x10503b390>
count = 0
defaults = {}
dfs(types, seen)
find_simple(seen)
find_types(seen)
get_partial_types(unresolved_types)
is_promotion = True
classmethod promote(*types)
repr_count = 0
repr_seen = None
resolved_type = None
simplify(seen=None)
t
class numba.typesystem.ssatypes.ReanalyzeCircularType(variable, type_inferer, **kwds)

Bases: numba.typesystem.ssatypes.UnresolvedType

This is useful when there is a circular dependence on yourself. e.g.

s = “hello” for i in range(5):

s = s[1:]

The type of ‘s’ depends on the result of the slice, and on the input to the loop. But to determine the output, we need to assume the input, and unify the output with the input, and see the result for a subsequent slice. e.g.

a = np.empty((10, 10, 10)) for i in range(3):

a = a[0]

Here the type would change on each iteration. Arrays do not demote to object, but other types do. The same goes for a call:

error_circular(result_type.variable)
for i in range(n):
f = f(i)

but also

x = 0 for i in range(n):

x = f(x)

or linked-list traversal

current = ... while current:

current = current.next
conser = <numba.typesystem.itypesystem.Conser object at 0x10503b590>
converged = False
defaults = {}
is_reanalyze_circular = True
resolved_type = None
retry_infer()

Retry inferring the type with the new type set

simplify()

Resolve the reanalyzable statement by setting the already resolved dependences for the type inference code.

substitute_and_reinfer()

Try substituting resolved parts of promotions and reinfer the types.

substitute_variables(substitutions)

Try to set the new variables and retry type inference

substitution_candidate(variable)
update()

Update the graph after having updated the dependences

class numba.typesystem.ssatypes.StronglyConnectedCircularType(scc, **kwds)

Bases: numba.typesystem.ssatypes.UnresolvedType

Circular type dependence. This can be a strongly connected component of just promotions, or a mixture of promotions and re-inferable statements.

If we have only re-inferable statements, but no promotions, we have nothing to feed into the re-inference process, so we issue an error.

conser = <numba.typesystem.itypesystem.Conser object at 0x10503b990>
defaults = {}
err_no_input()
is_resolved = False
is_scc = True
resolve()
resolve_promotion_cycles()
retry_infer()
retry_infer_reanalyzable()
simplify()
class numba.typesystem.ssatypes.UnanalyzableType(variable, **kwds)

Bases: numba.typesystem.ssatypes.UnresolvedType

A type that indicates the statement cannot be analyzed without first analysing its dependencies.

conser = <numba.typesystem.itypesystem.Conser object at 0x10503ba90>
defaults = {}
is_unanalyzable = True
class numba.typesystem.ssatypes.UninitializedType(base_type, **kwds)

Bases: numba.typesystem.types.NumbaType

conser = <numba.typesystem.itypesystem.Conser object at 0x10503b0d0>
defaults = {}
is_uninitialized = True
subtypes = ['base_type']
to_llvm(context)
class numba.typesystem.ssatypes.UnresolvedType(variable, **kwds)

Bases: numba.typesystem.types.NumbaType

The directed type graph works as follows:

  1. if type x depends on type y, then y is a parent of x.

  2. we construct a condensation graph by contracting strongly connected components to single nodes

  3. we resolve types in topological order

    -> types in SCCs are handled specially

add_children(children)
add_parents(parents)
conser = <numba.typesystem.itypesystem.Conser object at 0x10503b1d0>
defaults = {}
is_unresolved = True
make_assertion(assertion_attr, node, msg)
process_assertions(result_type)
rank = 1
resolve()
simplify()
numba.typesystem.ssatypes.dfs(start_type, stack, seen, graph=None, parents=False)
numba.typesystem.ssatypes.error_circular(var)
numba.typesystem.ssatypes.kosaraju_strongly_connected(start_type, strongly_connected, seen)

Find the strongly connected components in the connected graph starting at start_type.

numba.typesystem.ssatypes.promote(typesystem, type1, type2, assignment=False)
numba.typesystem.ssatypes.promote_arrays(array_types, non_array_types, types, unresolved_types, var_name)

This promotes arrays for assignments. Arrays must have a single consistent type in an assignment (phi). Any promotion of delayed types are immediately resolved.

numba.typesystem.ssatypes.promote_for_arithmetic(promote, types, assignment=False)
numba.typesystem.ssatypes.promote_for_assignment(promote, types, unresolved_types, var_name)

Promote a list of types for assignment (e.g. in a phi node).

  • if there are any objects, the result will always be an object

  • if there is an array, all types must be of that array type

    (minus any contiguity constraints)

numba.typesystem.ssatypes.resolve_type_chain(type)
numba.typesystem.ssatypes.resolve_var(var)

tbaa Module

Some types to aid in type-based alias analysis. See numba/metadata.py.

class numba.typesystem.tbaa.TBAAType(*args, **kwds)

Bases: numba.typesystem.types.NumbaType

argnames = ['name', 'root']
conser = <numba.typesystem.itypesystem.Conser object at 0x105077ed0>
defaults = {}
is_tbaa = True
is_tbaa_type = True
typename = 'tbaa_type'

templatetypes Module

Autojit template types.

class numba.typesystem.templatetypes.TemplateAttributeType(template_type, attribute_name, **kwds)

Bases: numba.typesystem.templatetypes._TemplateType

argnames = ['template_type', 'attribute_name']
conser = <numba.typesystem.itypesystem.Conser object at 0x105025fd0>
defaults = {}
flags = ['object', 'template']
is_object = True
is_template = True
is_template_attribute = True
resolve_template(template_context)
typename = 'template_attribute'
class numba.typesystem.templatetypes.TemplateIndexType(*args, **kwds)

Bases: numba.typesystem.templatetypes._TemplateType

argnames = ['template_type', 'index']
conser = <numba.typesystem.itypesystem.Conser object at 0x105028190>
defaults = {}
flags = ['object', 'template']
is_object = True
is_template = True
is_template_index = True
resolve_template(template_context)
typename = 'template_index'
numba.typesystem.templatetypes.is_template(T)
numba.typesystem.templatetypes.is_template_list(types)
numba.typesystem.templatetypes.match_template(template_type, concrete_type, template_context)

This function matches up T in the example below with a concrete type like double when a double pointer is passed in as argument:

def f(T.pointer() pointer):
scalar = T(...)

We can go two ways with this, e.g.

def f(T.base_type scalar):
pointer = T(...)

Which could work for things like pointers, though not for things like arrays, since we can’t infer the dimensionality.

We mandate that each Template type be resolved through a concrete type, i.e.:

def f(T scalar):
pointer = T.pointer(...)

template_context:

Dict mapping template types to concrete types:

T1 -> double * T2 -> float[:]
numba.typesystem.templatetypes.resolve_template_type(ty, template_context)

After the template context is known, resolve functions on template types E.g.

T[:] -> array_(dtype=T) void(T) -> function(args=[T]) Struct { T arg } -> struct(fields={‘arg’: T}) T * -> pointer(base_type=T)

Any other compound types?

numba.typesystem.templatetypes.resolve_templates(locals, template_signature, arg_names, arg_types)

Resolve template types given a signature with concrete types.

numba.typesystem.templatetypes.subtype_list(T)
class numba.typesystem.templatetypes.template(name)

Bases: numba.typesystem.templatetypes._TemplateType

argnames = ['name']
conser = <numba.typesystem.itypesystem.Conser object at 0x105025e90>
defaults = {'name': None}
flags = ['object']
is_object = True
is_template = True
template_count = 0
typename = 'template'
numba.typesystem.templatetypes.validate_template(concrete_type, template_type)

typematch Module

numba.typesystem.typematch.typematch(pattern, ty)

Match a type pattern to a type.

>>> type = list_(object_, 2)
>>> typematch("list(*, 2)", type)
True
>>> typematch("list(*)", type)
True
>>> typematch("list(*)", type)
True
>>> typematch("tuple(*)", type)
False
>>> typematch("object_", type)
True

types Module

User-facing numba types.

numba.typesystem.types.Accessor
class numba.typesystem.types.ContainerListType(*args, **kwds)

Bases: numba.typesystem.types.NumbaType

Parameters:
  • base_type – the element type of the tuple
  • size – set to a value >= 0 is the size is known
Returns:

a tuple type representation

argnames = ['base_type', 'size']
conser = <numba.typesystem.itypesystem.Conser object at 0x1050159d0>
defaults = {}
flags = ['object', 'container']
is_container = True
is_object = True
is_sized()
mutable = False
class numba.typesystem.types.Function(signature, py_func)

Bases: object

Function types may be called with Python functions to create a Function object. This may be used to minivect users for their own purposes. e.g.

@double(double, double) def myfunc(...):

...
class numba.typesystem.types.MapContainerType(*args, **kwds)

Bases: numba.typesystem.types.NumbaType

argnames = ['key_type', 'value_type', 'size']
conser = <numba.typesystem.itypesystem.Conser object at 0x105015d50>
defaults = {}
flags = ['object']
is_object = True
mutable = False
class numba.typesystem.types.NumbaType(*args, **kwds)

Bases: numba.typesystem.types._NumbaType

Base for numba types.

conser = <numba.typesystem.itypesystem.Conser object at 0x105012310>
classmethod default_args(args, kwargs)
defaults = {}
mutable = True
typename = None
class numba.typesystem.types.TypeMetaClass(name, bases, dict)

Bases: type

Metaclass for numba types, conses immutable types.

numba.typesystem.types.array(dtype, ndim, is_c_contig=False, is_f_contig=False, inner_contig=False)
Parameters:
  • dtype – the Numba dtype type (e.g. double)
  • ndim – the array dimensionality (int)
Returns:

an array type representation

class numba.typesystem.types.array_(*args, **kwds)

Bases: numba.typesystem.types.NumbaType

An array type. array_ may be sliced to obtain a subtype:

>>> double[:, :, ::1][1:]
double[:, ::1]
>>> double[:, :, ::1][:-1]
double[:, :]
>>> double[::1, :, :][:-1]
double[::1, :]
>>> double[::1, :, :][1:]
double[:, :]
argnames = ['dtype', 'ndim', 'is_c_contig', 'is_f_contig', 'inner_contig']
conser = <numba.typesystem.itypesystem.Conser object at 0x105012d90>
defaults = {'is_f_contig': False, 'is_c_contig': False, 'inner_contig': False}
flags = ['object']
is_array = True
is_object = True
mutable = False
pointer()
strided
typename = 'array'
class numba.typesystem.types.autojit_function(*args, **kwds)

Bases: numba.typesystem.types.NumbaType

Type for autojit functions

argnames = ['autojit_func']
conser = <numba.typesystem.itypesystem.Conser object at 0x105012fd0>
defaults = {}
flags = ['object']
is_autojit_function = True
is_object = True
mutable = False
typename = 'autojit_function'
class numba.typesystem.types.builtin_(*args, **kwds)

Bases: numba.typesystem.types.known_value

argnames = ['name', 'value']
conser = <numba.typesystem.itypesystem.Conser object at 0x105019bd0>
defaults = {}
flags = ['object']
func
is_builtin = True
is_object = True
mutable = False
typename = 'builtin'
class numba.typesystem.types.carray(*args, **kwds)

Bases: numba.typesystem.types.NumbaType

argnames = ['base_type', 'size']
conser = <numba.typesystem.itypesystem.Conser object at 0x105012910>
defaults = {}
is_carray = True
mutable = False
typename = 'carray'
class numba.typesystem.types.complex_(*args, **kwds)

Bases: numba.typesystem.types.NumbaType

argnames = ['base_type']
conser = <numba.typesystem.itypesystem.Conser object at 0x1050153d0>
defaults = {}
flags = ['numeric']
is_complex = True
is_numeric = True
itemsize
mutable = False
typename = 'complex'
numba.typesystem.types.consing(cls)

Cons calls to the constructor.

class numba.typesystem.types.datetime_(*args, **kwds)

Bases: numba.typesystem.types.NumbaType

argnames = ['timestamp', 'units', 'units_char']
conser = <numba.typesystem.itypesystem.Conser object at 0x105015510>
defaults = {}
flags = ['numeric']
is_datetime = True
is_numeric = True
is_numpy_datetime = True
itemsize
mutable = False
typename = 'datetime'
class numba.typesystem.types.dict_(*args, **kwds)

Bases: numba.typesystem.types.MapContainerType

dict(key, value, size)

conser = <numba.typesystem.itypesystem.Conser object at 0x105015f10>
defaults = {}
is_dict = True
is_object = True
mutable = False
typename = 'dict'
numba.typesystem.types.from_numpy_dtype(np_dtype)
Parameters:np_dtype – the NumPy dtype (e.g. np.dtype(np.double))
Returns:a dtype type representation
class numba.typesystem.types.function(*args, **kwds)

Bases: numba.typesystem.types.NumbaType

actual_signature

Passing structs by value is not properly supported for different calling conventions in LLVM, so we take an extra argument pointing to a caller-allocated struct value.

add_arg(i, arg)
argnames = ['return_type', 'args', 'name', 'is_vararg']
conser = <numba.typesystem.itypesystem.Conser object at 0x105012550>
defaults = {'is_vararg': False, 'name': None}
is_function = True
mutable = False
struct_by_reference
struct_return_type
typename = 'function'
class numba.typesystem.types.global_(*args, **kwds)

Bases: numba.typesystem.types.known_value

Global type

conser = <numba.typesystem.itypesystem.Conser object at 0x105019ad0>
defaults = {}
is_global = True
mutable = True
typename = 'global'
class numba.typesystem.types.istruct(*args, **kwds)

Bases: numba.typesystem.types.NumbaType

argnames = ['fields', 'name', 'readonly', 'packed']
conser = <numba.typesystem.itypesystem.Conser object at 0x105012a90>
defaults = {'readonly': False, 'name': None, 'packed': False}
fielddict
is_istruct = True
is_prefix(other_struct)
mutable = False
offsetof(field_name)

Compute the offset of a field. Must be used only after mutation has finished.

subtypes
typename = 'istruct'
class numba.typesystem.types.jit_function(*args, **kwds)

Bases: numba.typesystem.types.NumbaType

Type for jit functions

argnames = ['jit_func']
conser = <numba.typesystem.itypesystem.Conser object at 0x105015150>
defaults = {}
flags = ['object']
is_jit_function = True
is_object = True
mutable = False
typename = 'jit_function'
class numba.typesystem.types.known_pointer(*args, **kwds)

Bases: numba.typesystem.types.pointer

argnames = ['base_type', 'address']
conser = <numba.typesystem.itypesystem.Conser object at 0x105019950>
defaults = {}
is_known_pointer = True
mutable = False
typename = 'known_pointer'
class numba.typesystem.types.known_value(*args, **kwds)

Bases: numba.typesystem.types.NumbaType

Type which is associated with a known value or well-defined symbolic expression:

np.add => np.add np.add.reduce => (np.add, “reduce”)
(Remember that unbound methods like np.add.reduce are transient, i.e.
np.add.reduce is not np.add.reduce).
argnames = ['value']
conser = <numba.typesystem.itypesystem.Conser object at 0x105019810>
defaults = {}
is_known_value = True
mutable = False
typename = 'known_value'
class numba.typesystem.types.list_(*args, **kwds)

Bases: numba.typesystem.types.ContainerListType

list(base_type, size)

conser = <numba.typesystem.itypesystem.Conser object at 0x105015c50>
defaults = {}
is_container = True
is_list = True
is_object = True
mutable = False
typename = 'list'
class numba.typesystem.types.meta(*args, **kwds)

Bases: numba.typesystem.types.NumbaType

A type instance in user code. e.g. double(value). The Name node will have a cast-type with dst_type ‘double’.

argnames = ['dst_type']
conser = <numba.typesystem.itypesystem.Conser object at 0x105015890>
defaults = {}
flags = ['object', 'cast']
is_cast = True
is_meta = True
is_object = True
mutable = False
typename = 'meta'
class numba.typesystem.types.method(*args, **kwds)

Bases: numba.typesystem.types.NumbaType

Method of something.

base_type: the object type the attribute was accessed on
argnames = ['base_type', 'attr_name']
conser = <numba.typesystem.itypesystem.Conser object at 0x105019490>
defaults = {}
flags = ['object']
is_method = True
is_object = True
mutable = False
typename = 'method'
class numba.typesystem.types.module(*args, **kwds)

Bases: numba.typesystem.types.known_value

Represents a type for modules.

Attributes:
is_numpy_module: whether the module is the numpy module module: in case of numpy, the numpy module or a submodule
conser = <numba.typesystem.itypesystem.Conser object at 0x105019d50>
defaults = {}
flags = ['object']
is_math_module
is_module = True
is_numba_module
is_numpy_module
is_object = True
module
mutable = False
typename = 'module'
class numba.typesystem.types.module_attribute(*args, **kwds)

Bases: numba.typesystem.types.NumbaType

argnames = ['module', 'attr']
conser = <numba.typesystem.itypesystem.Conser object at 0x1050191d0>
defaults = {}
flags = ['object', 'known_value']
is_known_value = True
is_module_attribute = True
is_object = True
typename = 'module_attribute'
value
numba.typesystem.types.notconsing(cls)
class numba.typesystem.types.numpy_attribute(*args, **kwds)

Bases: numba.typesystem.types.NumbaType

argnames = ['module', 'attr']
conser = <numba.typesystem.itypesystem.Conser object at 0x105019050>
defaults = {}
flags = ['object', 'known_value']
is_known_value = True
is_numpy_attribute = True
is_object = True
typename = 'numpy_attribute'
value
class numba.typesystem.types.numpy_dtype(*args, **kwds)

Bases: numba.typesystem.types.NumbaType

Type of numpy dtypes

argnames = ['dtype']
conser = <numba.typesystem.itypesystem.Conser object at 0x105015290>
defaults = {}
flags = ['object']
is_numpy_dtype = True
is_object = True
mutable = False
typename = 'numpy_dtype'
numba.typesystem.types.pass_by_ref(type)
class numba.typesystem.types.pointer(*args, **kwds)

Bases: numba.typesystem.types.NumbaType

argnames = ['base_type']
conser = <numba.typesystem.itypesystem.Conser object at 0x105012650>
defaults = {}
is_pointer = True
is_string
mutable = False
typename = 'pointer'
class numba.typesystem.types.pointer_to_function(*args, **kwds)

Bases: numba.typesystem.types.NumbaType

Pointer to a function at a known address represented by some Python
object (e.g. a ctypes or CFFI function).
argnames = ['obj', 'ptr', 'signature']
conser = <numba.typesystem.itypesystem.Conser object at 0x105019610>
defaults = {}
flags = ['object']
is_object = True
is_pointer_to_function = True
typename = 'pointer_to_function'
class numba.typesystem.types.reference(*args, **kwds)

Bases: numba.typesystem.types.NumbaType

A reference to an (primitive or Python) object. This is passed as a pointer and dereferences automatically.

Currently only supported for structs.

argnames = ['referenced_type']
conser = <numba.typesystem.itypesystem.Conser object at 0x105019350>
defaults = {}
is_reference = True
mutable = False
typename = 'reference'
class numba.typesystem.types.sized_pointer(*args, **kwds)

Bases: numba.typesystem.types.NumbaType

A pointer with knowledge of its range.

E.g. an array’s ‘shape’ or ‘strides’ attribute. This also allow tuple unpacking.

argnames = ['base_type', 'size']
conser = <numba.typesystem.itypesystem.Conser object at 0x105012790>
defaults = {}
flags = ['pointer']
is_pointer = True
is_sized_pointer = True
mutable = False
typename = 'sized_pointer'
numba.typesystem.types.sort_key(t)
numba.typesystem.types.struct_(fields=(), name=None, readonly=False, packed=False, **kwargs)

Create a mutable struct type

class numba.typesystem.types.timedelta_(*args, **kwds)

Bases: numba.typesystem.types.NumbaType

argnames = ['diff', 'units', 'units_char']
conser = <numba.typesystem.itypesystem.Conser object at 0x1050156d0>
defaults = {}
flags = ['numeric']
is_numeric = True
is_numpy_timedelta = True
is_timedelta = True
itemsize
mutable = False
typename = 'timedelta'
class numba.typesystem.types.tuple_(*args, **kwds)

Bases: numba.typesystem.types.ContainerListType

tuple(base_type, size)

conser = <numba.typesystem.itypesystem.Conser object at 0x105015b50>
defaults = {}
is_container = True
is_object = True
is_tuple = True
mutable = False
typename = 'tuple'

typeset Module

Defines the typeset class and a number of builtin type sets.

class numba.typesystem.typeset.typeset(types, name)

Bases: numba.typesystem.types.NumbaType

Holds a set of types that can be used to specify signatures for type inference.

argnames = ['types', 'name']
conser = <numba.typesystem.itypesystem.Conser object at 0x10541ded0>
defaults = {'name': None}
find_match(promote, argtypes)
flags = ['object']
is_object = True
is_typeset = True
typename = 'typeset'

typeutils Module

numba.typesystem.typeutils.element_type(type)

Result type of iterating over something

numba.typesystem.typeutils.error_index(type)
numba.typesystem.typeutils.get_type(ast_node)
Parameters:ast_node – a Numba or Python AST expression node
Returns:the type of the expression node
numba.typesystem.typeutils.index_type(type)

Result of indexing a value of the given type with an integer index

numba.typesystem.typeutils.is_native_int()

D.__contains__(k) -> True if D has a key k, else False

numba.typesystem.typeutils.is_obj(type)
numba.typesystem.typeutils.promote_closest(Py_ssize_t[, int_, long_, longlong]) → longlong
numba.typesystem.typeutils.promote_to_native(int_type)
numba.typesystem.typeutils.pyfunc_signature(nargs)

Signature of a python function with N arguments

numba.typesystem.typeutils.require(ast_nodes, properties)

Assert that the types of the given nodes meets a certain requirement

universe Module

Universes of type constructors for numba.

numba.typesystem.universe.getsize(ctypes_name, default)
numba.typesystem.universe.is_native_int()

D.__contains__(k) -> True if D has a key k, else False

numba.typesystem.universe.names(*names)

Subpackages