body
stringlengths
26
98.2k
body_hash
int64
-9,222,864,604,528,158,000
9,221,803,474B
docstring
stringlengths
1
16.8k
path
stringlengths
5
230
name
stringlengths
1
96
repository_name
stringlengths
7
89
lang
stringclasses
1 value
body_without_docstring
stringlengths
20
98.2k
def __init__(self, context, builder): '\n Note: Maybe called multiple times when lowering a function\n ' from numba.core import boxing self.context = context self.builder = builder self.module = builder.basic_block.function.module try: self.module.__serialized except At...
720,668,537,472,889,200
Note: Maybe called multiple times when lowering a function
numba/core/pythonapi.py
__init__
DrTodd13/numba
python
def __init__(self, context, builder): '\n \n ' from numba.core import boxing self.context = context self.builder = builder self.module = builder.basic_block.function.module try: self.module.__serialized except AttributeError: self.module.__serialized = {} se...
def emit_environment_sentry(self, envptr, return_pyobject=False, debug_msg=''): 'Emits LLVM code to ensure the `envptr` is not NULL\n ' is_null = cgutils.is_null(self.builder, envptr) with cgutils.if_unlikely(self.builder, is_null): if return_pyobject: fnty = self.builder.function...
-2,687,096,933,102,821,000
Emits LLVM code to ensure the `envptr` is not NULL
numba/core/pythonapi.py
emit_environment_sentry
DrTodd13/numba
python
def emit_environment_sentry(self, envptr, return_pyobject=False, debug_msg=): '\n ' is_null = cgutils.is_null(self.builder, envptr) with cgutils.if_unlikely(self.builder, is_null): if return_pyobject: fnty = self.builder.function.type.pointee assert (fnty.return_type =...
def raise_object(self, exc=None): '\n Raise an arbitrary exception (type or value or (type, args)\n or None - if reraising). A reference to the argument is consumed.\n ' fnty = Type.function(Type.void(), [self.pyobj]) fn = self._get_function(fnty, name='numba_do_raise') if (exc is ...
-6,708,990,820,519,976,000
Raise an arbitrary exception (type or value or (type, args) or None - if reraising). A reference to the argument is consumed.
numba/core/pythonapi.py
raise_object
DrTodd13/numba
python
def raise_object(self, exc=None): '\n Raise an arbitrary exception (type or value or (type, args)\n or None - if reraising). A reference to the argument is consumed.\n ' fnty = Type.function(Type.void(), [self.pyobj]) fn = self._get_function(fnty, name='numba_do_raise') if (exc is ...
@contextlib.contextmanager def err_push(self, keep_new=False): '\n Temporarily push the current error indicator while the code\n block is executed. If *keep_new* is True and the code block\n raises a new error, the new error is kept, otherwise the old\n error indicator is restored at th...
613,919,192,489,648,100
Temporarily push the current error indicator while the code block is executed. If *keep_new* is True and the code block raises a new error, the new error is kept, otherwise the old error indicator is restored at the end of the block.
numba/core/pythonapi.py
err_push
DrTodd13/numba
python
@contextlib.contextmanager def err_push(self, keep_new=False): '\n Temporarily push the current error indicator while the code\n block is executed. If *keep_new* is True and the code block\n raises a new error, the new error is kept, otherwise the old\n error indicator is restored at th...
def get_c_object(self, name): '\n Get a Python object through its C-accessible *name*\n (e.g. "PyExc_ValueError"). The underlying variable must be\n a `PyObject *`, and the value of that pointer is returned.\n ' return self.context.get_c_value(self.builder, self.pyobj.pointee, name,...
-877,358,383,236,135,400
Get a Python object through its C-accessible *name* (e.g. "PyExc_ValueError"). The underlying variable must be a `PyObject *`, and the value of that pointer is returned.
numba/core/pythonapi.py
get_c_object
DrTodd13/numba
python
def get_c_object(self, name): '\n Get a Python object through its C-accessible *name*\n (e.g. "PyExc_ValueError"). The underlying variable must be\n a `PyObject *`, and the value of that pointer is returned.\n ' return self.context.get_c_value(self.builder, self.pyobj.pointee, name,...
def dict_getitem_string(self, dic, name): 'Lookup name inside dict\n\n Returns a borrowed reference\n ' fnty = Type.function(self.pyobj, [self.pyobj, self.cstring]) fn = self._get_function(fnty, name='PyDict_GetItemString') cstr = self.context.insert_const_string(self.module, name) ret...
7,638,780,850,412,745,000
Lookup name inside dict Returns a borrowed reference
numba/core/pythonapi.py
dict_getitem_string
DrTodd13/numba
python
def dict_getitem_string(self, dic, name): 'Lookup name inside dict\n\n Returns a borrowed reference\n ' fnty = Type.function(self.pyobj, [self.pyobj, self.cstring]) fn = self._get_function(fnty, name='PyDict_GetItemString') cstr = self.context.insert_const_string(self.module, name) ret...
def dict_getitem(self, dic, name): 'Lookup name inside dict\n\n Returns a borrowed reference\n ' fnty = Type.function(self.pyobj, [self.pyobj, self.pyobj]) fn = self._get_function(fnty, name='PyDict_GetItem') return self.builder.call(fn, [dic, name])
8,226,964,351,746,974,000
Lookup name inside dict Returns a borrowed reference
numba/core/pythonapi.py
dict_getitem
DrTodd13/numba
python
def dict_getitem(self, dic, name): 'Lookup name inside dict\n\n Returns a borrowed reference\n ' fnty = Type.function(self.pyobj, [self.pyobj, self.pyobj]) fn = self._get_function(fnty, name='PyDict_GetItem') return self.builder.call(fn, [dic, name])
def dict_pack(self, keyvalues): '\n Args\n -----\n keyvalues: iterable of (str, llvm.Value of PyObject*)\n ' dictobj = self.dict_new() with self.if_object_ok(dictobj): for (k, v) in keyvalues: self.dict_setitem_string(dictobj, k, v) return dictobj
-6,079,025,890,302,506,000
Args ----- keyvalues: iterable of (str, llvm.Value of PyObject*)
numba/core/pythonapi.py
dict_pack
DrTodd13/numba
python
def dict_pack(self, keyvalues): '\n Args\n -----\n keyvalues: iterable of (str, llvm.Value of PyObject*)\n ' dictobj = self.dict_new() with self.if_object_ok(dictobj): for (k, v) in keyvalues: self.dict_setitem_string(dictobj, k, v) return dictobj
def long_as_voidptr(self, numobj): "\n Convert the given Python integer to a void*. This is recommended\n over number_as_ssize_t as it isn't affected by signedness.\n " fnty = Type.function(self.voidptr, [self.pyobj]) fn = self._get_function(fnty, name='PyLong_AsVoidPtr') return se...
3,385,580,637,444,274,700
Convert the given Python integer to a void*. This is recommended over number_as_ssize_t as it isn't affected by signedness.
numba/core/pythonapi.py
long_as_voidptr
DrTodd13/numba
python
def long_as_voidptr(self, numobj): "\n Convert the given Python integer to a void*. This is recommended\n over number_as_ssize_t as it isn't affected by signedness.\n " fnty = Type.function(self.voidptr, [self.pyobj]) fn = self._get_function(fnty, name='PyLong_AsVoidPtr') return se...
def long_from_signed_int(self, ival): '\n Return a Python integer from any native integer value.\n ' bits = ival.type.width if (bits <= self.long.width): return self.long_from_long(self.builder.sext(ival, self.long)) elif (bits <= self.longlong.width): return self.long_from...
-1,828,205,803,609,380,000
Return a Python integer from any native integer value.
numba/core/pythonapi.py
long_from_signed_int
DrTodd13/numba
python
def long_from_signed_int(self, ival): '\n \n ' bits = ival.type.width if (bits <= self.long.width): return self.long_from_long(self.builder.sext(ival, self.long)) elif (bits <= self.longlong.width): return self.long_from_longlong(self.builder.sext(ival, self.longlong)) ...
def long_from_unsigned_int(self, ival): '\n Same as long_from_signed_int, but for unsigned values.\n ' bits = ival.type.width if (bits <= self.ulong.width): return self.long_from_ulong(self.builder.zext(ival, self.ulong)) elif (bits <= self.ulonglong.width): return self.lon...
3,342,309,904,926,704,000
Same as long_from_signed_int, but for unsigned values.
numba/core/pythonapi.py
long_from_unsigned_int
DrTodd13/numba
python
def long_from_unsigned_int(self, ival): '\n \n ' bits = ival.type.width if (bits <= self.ulong.width): return self.long_from_ulong(self.builder.zext(ival, self.ulong)) elif (bits <= self.ulonglong.width): return self.long_from_ulonglong(self.builder.zext(ival, self.ulonglon...
def bool_from_bool(self, bval): '\n Get a Python bool from a LLVM boolean.\n ' longval = self.builder.zext(bval, self.long) return self.bool_from_long(longval)
-8,639,948,724,539,030,000
Get a Python bool from a LLVM boolean.
numba/core/pythonapi.py
bool_from_bool
DrTodd13/numba
python
def bool_from_bool(self, bval): '\n \n ' longval = self.builder.zext(bval, self.long) return self.bool_from_long(longval)
def slice_as_ints(self, obj): '\n Read the members of a slice of integers.\n\n Returns a (ok, start, stop, step) tuple where ok is a boolean and\n the following members are pointer-sized ints.\n ' pstart = cgutils.alloca_once(self.builder, self.py_ssize_t) pstop = cgutils.alloca_...
-8,755,883,046,290,695,000
Read the members of a slice of integers. Returns a (ok, start, stop, step) tuple where ok is a boolean and the following members are pointer-sized ints.
numba/core/pythonapi.py
slice_as_ints
DrTodd13/numba
python
def slice_as_ints(self, obj): '\n Read the members of a slice of integers.\n\n Returns a (ok, start, stop, step) tuple where ok is a boolean and\n the following members are pointer-sized ints.\n ' pstart = cgutils.alloca_once(self.builder, self.py_ssize_t) pstop = cgutils.alloca_...
def list_setitem(self, lst, idx, val): '\n Warning: Steals reference to ``val``\n ' fnty = Type.function(Type.int(), [self.pyobj, self.py_ssize_t, self.pyobj]) fn = self._get_function(fnty, name='PyList_SetItem') return self.builder.call(fn, [lst, idx, val])
118,342,623,335,487,140
Warning: Steals reference to ``val``
numba/core/pythonapi.py
list_setitem
DrTodd13/numba
python
def list_setitem(self, lst, idx, val): '\n \n ' fnty = Type.function(Type.int(), [self.pyobj, self.py_ssize_t, self.pyobj]) fn = self._get_function(fnty, name='PyList_SetItem') return self.builder.call(fn, [lst, idx, val])
def list_getitem(self, lst, idx): '\n Returns a borrowed reference.\n ' fnty = Type.function(self.pyobj, [self.pyobj, self.py_ssize_t]) fn = self._get_function(fnty, name='PyList_GetItem') if isinstance(idx, int): idx = self.context.get_constant(types.intp, idx) return self.bui...
-6,105,378,791,583,492,000
Returns a borrowed reference.
numba/core/pythonapi.py
list_getitem
DrTodd13/numba
python
def list_getitem(self, lst, idx): '\n \n ' fnty = Type.function(self.pyobj, [self.pyobj, self.py_ssize_t]) fn = self._get_function(fnty, name='PyList_GetItem') if isinstance(idx, int): idx = self.context.get_constant(types.intp, idx) return self.builder.call(fn, [lst, idx])
def tuple_getitem(self, tup, idx): '\n Borrow reference\n ' fnty = Type.function(self.pyobj, [self.pyobj, self.py_ssize_t]) fn = self._get_function(fnty, name='PyTuple_GetItem') idx = self.context.get_constant(types.intp, idx) return self.builder.call(fn, [tup, idx])
-2,896,934,399,041,985,000
Borrow reference
numba/core/pythonapi.py
tuple_getitem
DrTodd13/numba
python
def tuple_getitem(self, tup, idx): '\n \n ' fnty = Type.function(self.pyobj, [self.pyobj, self.py_ssize_t]) fn = self._get_function(fnty, name='PyTuple_GetItem') idx = self.context.get_constant(types.intp, idx) return self.builder.call(fn, [tup, idx])
def tuple_setitem(self, tuple_val, index, item): '\n Steals a reference to `item`.\n ' fnty = Type.function(Type.int(), [self.pyobj, Type.int(), self.pyobj]) setitem_fn = self._get_function(fnty, name='PyTuple_SetItem') index = self.context.get_constant(types.int32, index) self.builder...
7,715,622,929,549,538,000
Steals a reference to `item`.
numba/core/pythonapi.py
tuple_setitem
DrTodd13/numba
python
def tuple_setitem(self, tuple_val, index, item): '\n \n ' fnty = Type.function(Type.int(), [self.pyobj, Type.int(), self.pyobj]) setitem_fn = self._get_function(fnty, name='PyTuple_SetItem') index = self.context.get_constant(types.int32, index) self.builder.call(setitem_fn, [tuple_val,...
def gil_ensure(self): '\n Ensure the GIL is acquired.\n The returned value must be consumed by gil_release().\n ' gilptrty = Type.pointer(self.gil_state) fnty = Type.function(Type.void(), [gilptrty]) fn = self._get_function(fnty, 'numba_gil_ensure') gilptr = cgutils.alloca_once(...
8,383,073,972,365,726,000
Ensure the GIL is acquired. The returned value must be consumed by gil_release().
numba/core/pythonapi.py
gil_ensure
DrTodd13/numba
python
def gil_ensure(self): '\n Ensure the GIL is acquired.\n The returned value must be consumed by gil_release().\n ' gilptrty = Type.pointer(self.gil_state) fnty = Type.function(Type.void(), [gilptrty]) fn = self._get_function(fnty, 'numba_gil_ensure') gilptr = cgutils.alloca_once(...
def gil_release(self, gil): '\n Release the acquired GIL by gil_ensure().\n Must be paired with a gil_ensure().\n ' gilptrty = Type.pointer(self.gil_state) fnty = Type.function(Type.void(), [gilptrty]) fn = self._get_function(fnty, 'numba_gil_release') return self.builder.call(f...
-6,266,615,649,002,853,000
Release the acquired GIL by gil_ensure(). Must be paired with a gil_ensure().
numba/core/pythonapi.py
gil_release
DrTodd13/numba
python
def gil_release(self, gil): '\n Release the acquired GIL by gil_ensure().\n Must be paired with a gil_ensure().\n ' gilptrty = Type.pointer(self.gil_state) fnty = Type.function(Type.void(), [gilptrty]) fn = self._get_function(fnty, 'numba_gil_release') return self.builder.call(f...
def save_thread(self): '\n Release the GIL and return the former thread state\n (an opaque non-NULL pointer).\n ' fnty = Type.function(self.voidptr, []) fn = self._get_function(fnty, name='PyEval_SaveThread') return self.builder.call(fn, [])
8,673,354,977,569,480,000
Release the GIL and return the former thread state (an opaque non-NULL pointer).
numba/core/pythonapi.py
save_thread
DrTodd13/numba
python
def save_thread(self): '\n Release the GIL and return the former thread state\n (an opaque non-NULL pointer).\n ' fnty = Type.function(self.voidptr, []) fn = self._get_function(fnty, name='PyEval_SaveThread') return self.builder.call(fn, [])
def restore_thread(self, thread_state): '\n Restore the given thread state by reacquiring the GIL.\n ' fnty = Type.function(Type.void(), [self.voidptr]) fn = self._get_function(fnty, name='PyEval_RestoreThread') self.builder.call(fn, [thread_state])
-1,338,843,926,509,931,800
Restore the given thread state by reacquiring the GIL.
numba/core/pythonapi.py
restore_thread
DrTodd13/numba
python
def restore_thread(self, thread_state): '\n \n ' fnty = Type.function(Type.void(), [self.voidptr]) fn = self._get_function(fnty, name='PyEval_RestoreThread') self.builder.call(fn, [thread_state])
def object_richcompare(self, lhs, rhs, opstr): '\n Refer to Python source Include/object.h for macros definition\n of the opid.\n ' ops = ['<', '<=', '==', '!=', '>', '>='] if (opstr in ops): opid = ops.index(opstr) fnty = Type.function(self.pyobj, [self.pyobj, self.pyob...
-6,584,550,791,120,509,000
Refer to Python source Include/object.h for macros definition of the opid.
numba/core/pythonapi.py
object_richcompare
DrTodd13/numba
python
def object_richcompare(self, lhs, rhs, opstr): '\n Refer to Python source Include/object.h for macros definition\n of the opid.\n ' ops = ['<', '<=', '==', '!=', '>', '>='] if (opstr in ops): opid = ops.index(opstr) fnty = Type.function(self.pyobj, [self.pyobj, self.pyob...
def object_getitem(self, obj, key): '\n Return obj[key]\n ' fnty = Type.function(self.pyobj, [self.pyobj, self.pyobj]) fn = self._get_function(fnty, name='PyObject_GetItem') return self.builder.call(fn, (obj, key))
293,015,036,151,651,100
Return obj[key]
numba/core/pythonapi.py
object_getitem
DrTodd13/numba
python
def object_getitem(self, obj, key): '\n \n ' fnty = Type.function(self.pyobj, [self.pyobj, self.pyobj]) fn = self._get_function(fnty, name='PyObject_GetItem') return self.builder.call(fn, (obj, key))
def object_setitem(self, obj, key, val): '\n obj[key] = val\n ' fnty = Type.function(Type.int(), [self.pyobj, self.pyobj, self.pyobj]) fn = self._get_function(fnty, name='PyObject_SetItem') return self.builder.call(fn, (obj, key, val))
3,589,557,668,659,497,000
obj[key] = val
numba/core/pythonapi.py
object_setitem
DrTodd13/numba
python
def object_setitem(self, obj, key, val): '\n \n ' fnty = Type.function(Type.int(), [self.pyobj, self.pyobj, self.pyobj]) fn = self._get_function(fnty, name='PyObject_SetItem') return self.builder.call(fn, (obj, key, val))
def object_delitem(self, obj, key): '\n del obj[key]\n ' fnty = Type.function(Type.int(), [self.pyobj, self.pyobj]) fn = self._get_function(fnty, name='PyObject_DelItem') return self.builder.call(fn, (obj, key))
-3,989,628,594,239,658,000
del obj[key]
numba/core/pythonapi.py
object_delitem
DrTodd13/numba
python
def object_delitem(self, obj, key): '\n \n ' fnty = Type.function(Type.int(), [self.pyobj, self.pyobj]) fn = self._get_function(fnty, name='PyObject_DelItem') return self.builder.call(fn, (obj, key))
def string_as_string_and_size(self, strobj): '\n Returns a tuple of ``(ok, buffer, length)``.\n The ``ok`` is i1 value that is set if ok.\n The ``buffer`` is a i8* of the output buffer.\n The ``length`` is a i32/i64 (py_ssize_t) of the length of the buffer.\n ' p_length = cgut...
7,256,895,209,335,675,000
Returns a tuple of ``(ok, buffer, length)``. The ``ok`` is i1 value that is set if ok. The ``buffer`` is a i8* of the output buffer. The ``length`` is a i32/i64 (py_ssize_t) of the length of the buffer.
numba/core/pythonapi.py
string_as_string_and_size
DrTodd13/numba
python
def string_as_string_and_size(self, strobj): '\n Returns a tuple of ``(ok, buffer, length)``.\n The ``ok`` is i1 value that is set if ok.\n The ``buffer`` is a i8* of the output buffer.\n The ``length`` is a i32/i64 (py_ssize_t) of the length of the buffer.\n ' p_length = cgut...
def string_as_string_size_and_kind(self, strobj): '\n Returns a tuple of ``(ok, buffer, length, kind)``.\n The ``ok`` is i1 value that is set if ok.\n The ``buffer`` is a i8* of the output buffer.\n The ``length`` is a i32/i64 (py_ssize_t) of the length of the buffer.\n The ``kind...
-7,724,148,293,254,188,000
Returns a tuple of ``(ok, buffer, length, kind)``. The ``ok`` is i1 value that is set if ok. The ``buffer`` is a i8* of the output buffer. The ``length`` is a i32/i64 (py_ssize_t) of the length of the buffer. The ``kind`` is a i32 (int32) of the Unicode kind constant The ``hash`` is a long/uint64_t (py_hash_t) of the U...
numba/core/pythonapi.py
string_as_string_size_and_kind
DrTodd13/numba
python
def string_as_string_size_and_kind(self, strobj): '\n Returns a tuple of ``(ok, buffer, length, kind)``.\n The ``ok`` is i1 value that is set if ok.\n The ``buffer`` is a i8* of the output buffer.\n The ``length`` is a i32/i64 (py_ssize_t) of the length of the buffer.\n The ``kind...
def object_dump(self, obj): '\n Dump a Python object on C stderr. For debugging purposes.\n ' fnty = Type.function(Type.void(), [self.pyobj]) fn = self._get_function(fnty, name='_PyObject_Dump') return self.builder.call(fn, (obj,))
3,248,548,755,625,892,400
Dump a Python object on C stderr. For debugging purposes.
numba/core/pythonapi.py
object_dump
DrTodd13/numba
python
def object_dump(self, obj): '\n \n ' fnty = Type.function(Type.void(), [self.pyobj]) fn = self._get_function(fnty, name='_PyObject_Dump') return self.builder.call(fn, (obj,))
def nrt_meminfo_new_from_pyobject(self, data, pyobj): '\n Allocate a new MemInfo with data payload borrowed from a python\n object.\n ' mod = self.builder.module fnty = ir.FunctionType(cgutils.voidptr_t, [cgutils.voidptr_t, cgutils.voidptr_t]) fn = mod.get_or_insert_function(fnty, n...
-1,801,179,579,027,648,800
Allocate a new MemInfo with data payload borrowed from a python object.
numba/core/pythonapi.py
nrt_meminfo_new_from_pyobject
DrTodd13/numba
python
def nrt_meminfo_new_from_pyobject(self, data, pyobj): '\n Allocate a new MemInfo with data payload borrowed from a python\n object.\n ' mod = self.builder.module fnty = ir.FunctionType(cgutils.voidptr_t, [cgutils.voidptr_t, cgutils.voidptr_t]) fn = mod.get_or_insert_function(fnty, n...
def alloca_buffer(self): '\n Return a pointer to a stack-allocated, zero-initialized Py_buffer.\n ' ptr = cgutils.alloca_once_value(self.builder, lc.Constant.null(self.py_buffer_t)) return ptr
-67,644,426,667,876,630
Return a pointer to a stack-allocated, zero-initialized Py_buffer.
numba/core/pythonapi.py
alloca_buffer
DrTodd13/numba
python
def alloca_buffer(self): '\n \n ' ptr = cgutils.alloca_once_value(self.builder, lc.Constant.null(self.py_buffer_t)) return ptr
def unserialize(self, structptr): '\n Unserialize some data. *structptr* should be a pointer to\n a {i8* data, i32 length} structure.\n ' fnty = Type.function(self.pyobj, (self.voidptr, ir.IntType(32), self.voidptr)) fn = self._get_function(fnty, name='numba_unpickle') ptr = self.b...
-7,920,713,274,060,330,000
Unserialize some data. *structptr* should be a pointer to a {i8* data, i32 length} structure.
numba/core/pythonapi.py
unserialize
DrTodd13/numba
python
def unserialize(self, structptr): '\n Unserialize some data. *structptr* should be a pointer to\n a {i8* data, i32 length} structure.\n ' fnty = Type.function(self.pyobj, (self.voidptr, ir.IntType(32), self.voidptr)) fn = self._get_function(fnty, name='numba_unpickle') ptr = self.b...
def serialize_uncached(self, obj): "\n Same as serialize_object(), but don't create a global variable,\n simply return a literal {i8* data, i32 length, i8* hashbuf} structure.\n " data = serialize.dumps(obj) assert (len(data) < (2 ** 31)) name = ('.const.pickledata.%s' % (id(obj) if...
-5,732,072,445,353,545,000
Same as serialize_object(), but don't create a global variable, simply return a literal {i8* data, i32 length, i8* hashbuf} structure.
numba/core/pythonapi.py
serialize_uncached
DrTodd13/numba
python
def serialize_uncached(self, obj): "\n Same as serialize_object(), but don't create a global variable,\n simply return a literal {i8* data, i32 length, i8* hashbuf} structure.\n " data = serialize.dumps(obj) assert (len(data) < (2 ** 31)) name = ('.const.pickledata.%s' % (id(obj) if...
def serialize_object(self, obj): '\n Serialize the given object in the bitcode, and return it\n as a pointer to a {i8* data, i32 length}, structure constant\n (suitable for passing to unserialize()).\n ' try: gv = self.module.__serialized[obj] except KeyError: str...
-4,735,269,214,832,265,000
Serialize the given object in the bitcode, and return it as a pointer to a {i8* data, i32 length}, structure constant (suitable for passing to unserialize()).
numba/core/pythonapi.py
serialize_object
DrTodd13/numba
python
def serialize_object(self, obj): '\n Serialize the given object in the bitcode, and return it\n as a pointer to a {i8* data, i32 length}, structure constant\n (suitable for passing to unserialize()).\n ' try: gv = self.module.__serialized[obj] except KeyError: str...
def to_native_value(self, typ, obj): '\n Unbox the Python object as the given Numba type.\n A NativeValue instance is returned.\n ' from numba.core.boxing import unbox_unsupported impl = _unboxers.lookup(typ.__class__, unbox_unsupported) c = _UnboxContext(self.context, self.builder,...
3,374,574,107,451,236,400
Unbox the Python object as the given Numba type. A NativeValue instance is returned.
numba/core/pythonapi.py
to_native_value
DrTodd13/numba
python
def to_native_value(self, typ, obj): '\n Unbox the Python object as the given Numba type.\n A NativeValue instance is returned.\n ' from numba.core.boxing import unbox_unsupported impl = _unboxers.lookup(typ.__class__, unbox_unsupported) c = _UnboxContext(self.context, self.builder,...
def from_native_value(self, typ, val, env_manager=None): '\n Box the native value of the given Numba type. A Python object\n pointer is returned (NULL if an error occurred).\n This method steals any native (NRT) reference embedded in *val*.\n ' from numba.core.boxing import box_unsu...
1,871,072,068,320,334,800
Box the native value of the given Numba type. A Python object pointer is returned (NULL if an error occurred). This method steals any native (NRT) reference embedded in *val*.
numba/core/pythonapi.py
from_native_value
DrTodd13/numba
python
def from_native_value(self, typ, val, env_manager=None): '\n Box the native value of the given Numba type. A Python object\n pointer is returned (NULL if an error occurred).\n This method steals any native (NRT) reference embedded in *val*.\n ' from numba.core.boxing import box_unsu...
def reflect_native_value(self, typ, val, env_manager=None): '\n Reflect the native value onto its Python original, if any.\n An error bit (as an LLVM value) is returned.\n ' impl = _reflectors.lookup(typ.__class__) if (impl is None): return cgutils.false_bit is_error = cguti...
6,999,730,225,112,190,000
Reflect the native value onto its Python original, if any. An error bit (as an LLVM value) is returned.
numba/core/pythonapi.py
reflect_native_value
DrTodd13/numba
python
def reflect_native_value(self, typ, val, env_manager=None): '\n Reflect the native value onto its Python original, if any.\n An error bit (as an LLVM value) is returned.\n ' impl = _reflectors.lookup(typ.__class__) if (impl is None): return cgutils.false_bit is_error = cguti...
def to_native_generator(self, obj, typ): '\n Extract the generator structure pointer from a generator *obj*\n (a _dynfunc.Generator instance).\n ' gen_ptr_ty = Type.pointer(self.context.get_data_type(typ)) value = self.context.get_generator_state(self.builder, obj, gen_ptr_ty) retur...
6,247,722,867,210,801,000
Extract the generator structure pointer from a generator *obj* (a _dynfunc.Generator instance).
numba/core/pythonapi.py
to_native_generator
DrTodd13/numba
python
def to_native_generator(self, obj, typ): '\n Extract the generator structure pointer from a generator *obj*\n (a _dynfunc.Generator instance).\n ' gen_ptr_ty = Type.pointer(self.context.get_data_type(typ)) value = self.context.get_generator_state(self.builder, obj, gen_ptr_ty) retur...
def from_native_generator(self, val, typ, env=None): '\n Make a Numba generator (a _dynfunc.Generator instance) from a\n generator structure pointer *val*.\n *env* is an optional _dynfunc.Environment instance to be wrapped\n in the generator.\n ' llty = self.context.get_data_t...
-5,887,978,113,968,761,000
Make a Numba generator (a _dynfunc.Generator instance) from a generator structure pointer *val*. *env* is an optional _dynfunc.Environment instance to be wrapped in the generator.
numba/core/pythonapi.py
from_native_generator
DrTodd13/numba
python
def from_native_generator(self, val, typ, env=None): '\n Make a Numba generator (a _dynfunc.Generator instance) from a\n generator structure pointer *val*.\n *env* is an optional _dynfunc.Environment instance to be wrapped\n in the generator.\n ' llty = self.context.get_data_t...
def call_jit_code(self, func, sig, args): 'Calls into Numba jitted code and propagate error using the Python\n calling convention.\n\n Parameters\n ----------\n func : function\n The Python function to be compiled. This function is compiled\n in nopython-mode.\n ...
3,316,632,359,420,841,000
Calls into Numba jitted code and propagate error using the Python calling convention. Parameters ---------- func : function The Python function to be compiled. This function is compiled in nopython-mode. sig : numba.typing.Signature The function signature for *func*. args : Sequence[llvmlite.binding.Value]...
numba/core/pythonapi.py
call_jit_code
DrTodd13/numba
python
def call_jit_code(self, func, sig, args): 'Calls into Numba jitted code and propagate error using the Python\n calling convention.\n\n Parameters\n ----------\n func : function\n The Python function to be compiled. This function is compiled\n in nopython-mode.\n ...
def DescribeImageStat(self, request): '控制台识别统计\n\n :param request: Request instance for DescribeImageStat.\n :type request: :class:`tencentcloud.ims.v20200713.models.DescribeImageStatRequest`\n :rtype: :class:`tencentcloud.ims.v20200713.models.DescribeImageStatResponse`\n\n ' try: ...
-5,802,602,804,795,391,000
控制台识别统计 :param request: Request instance for DescribeImageStat. :type request: :class:`tencentcloud.ims.v20200713.models.DescribeImageStatRequest` :rtype: :class:`tencentcloud.ims.v20200713.models.DescribeImageStatResponse`
tencentcloud/ims/v20200713/ims_client.py
DescribeImageStat
HelloBarry/tencent_cloud_ops
python
def DescribeImageStat(self, request): '控制台识别统计\n\n :param request: Request instance for DescribeImageStat.\n :type request: :class:`tencentcloud.ims.v20200713.models.DescribeImageStatRequest`\n :rtype: :class:`tencentcloud.ims.v20200713.models.DescribeImageStatResponse`\n\n ' try: ...
def DescribeImsList(self, request): '图片机器审核明细\n\n :param request: Request instance for DescribeImsList.\n :type request: :class:`tencentcloud.ims.v20200713.models.DescribeImsListRequest`\n :rtype: :class:`tencentcloud.ims.v20200713.models.DescribeImsListResponse`\n\n ' try: p...
1,024,091,555,683,964,200
图片机器审核明细 :param request: Request instance for DescribeImsList. :type request: :class:`tencentcloud.ims.v20200713.models.DescribeImsListRequest` :rtype: :class:`tencentcloud.ims.v20200713.models.DescribeImsListResponse`
tencentcloud/ims/v20200713/ims_client.py
DescribeImsList
HelloBarry/tencent_cloud_ops
python
def DescribeImsList(self, request): '图片机器审核明细\n\n :param request: Request instance for DescribeImsList.\n :type request: :class:`tencentcloud.ims.v20200713.models.DescribeImsListRequest`\n :rtype: :class:`tencentcloud.ims.v20200713.models.DescribeImsListResponse`\n\n ' try: p...
def ImageModeration(self, request): '图片内容检测服务(Image Moderation, IM)能自动扫描图片,识别可能令人反感、不安全或不适宜的内容,同时支持用户配置图片黑名单,打击自定义识别类型的图片。\n\n <div class="rno-api-explorer" style="margin-bottom:20px">\n <div class="rno-api-explorer-inner">\n <div class="rno-api-explorer-hd">\n <d...
2,960,955,142,353,879,600
图片内容检测服务(Image Moderation, IM)能自动扫描图片,识别可能令人反感、不安全或不适宜的内容,同时支持用户配置图片黑名单,打击自定义识别类型的图片。 <div class="rno-api-explorer" style="margin-bottom:20px"> <div class="rno-api-explorer-inner"> <div class="rno-api-explorer-hd"> <div class="rno-api-explorer-title"> 关于版本迭代的描述 </div...
tencentcloud/ims/v20200713/ims_client.py
ImageModeration
HelloBarry/tencent_cloud_ops
python
def ImageModeration(self, request): '图片内容检测服务(Image Moderation, IM)能自动扫描图片,识别可能令人反感、不安全或不适宜的内容,同时支持用户配置图片黑名单,打击自定义识别类型的图片。\n\n <div class="rno-api-explorer" style="margin-bottom:20px">\n <div class="rno-api-explorer-inner">\n <div class="rno-api-explorer-hd">\n <d...
def perform_create(self, serializer): 'Sets the patient profile to the logged in user' serializer.save(user_profile=self.request.user)
-2,440,925,486,062,093,300
Sets the patient profile to the logged in user
backend/accounts/views.py
perform_create
eliefrancois/project2-diabetesapplication-api
python
def perform_create(self, serializer): serializer.save(user_profile=self.request.user)
def run_model(exe_name, namefile, model_ws='./', silent=False, pause=False, report=False, normal_msg='normal termination', use_async=False, cargs=None): "\n This function will run the model using subprocess.Popen. It\n communicates with the model's stdout asynchronously and reports\n progress to the scree...
-5,725,676,336,444,749,000
This function will run the model using subprocess.Popen. It communicates with the model's stdout asynchronously and reports progress to the screen with timestamps Parameters ---------- exe_name : str Executable name (with path, if necessary) to run. namefile : str Namefile of model to run. The namefile must b...
flopy/mbase.py
run_model
andrewcalderwood/flopy
python
def run_model(exe_name, namefile, model_ws='./', silent=False, pause=False, report=False, normal_msg='normal termination', use_async=False, cargs=None): "\n This function will run the model using subprocess.Popen. It\n communicates with the model's stdout asynchronously and reports\n progress to the scree...
def __init__(self, error, location=''): 'Initialize exception.' self.message = error super().__init__(f'{error} ({location})')
4,871,760,088,630,620,000
Initialize exception.
flopy/mbase.py
__init__
andrewcalderwood/flopy
python
def __init__(self, error, location=): self.message = error super().__init__(f'{error} ({location})')
def get_package_list(self, ftype=None): "\n Get a list of all the package names.\n\n Parameters\n ----------\n ftype : str\n Type of package, 'RIV', 'LPF', etc.\n\n Returns\n -------\n val : list of strings\n Can be used to see what packages are...
2,463,778,479,065,689,600
Get a list of all the package names. Parameters ---------- ftype : str Type of package, 'RIV', 'LPF', etc. Returns ------- val : list of strings Can be used to see what packages are in the model, and can then be used with get_package to pull out individual packages.
flopy/mbase.py
get_package_list
andrewcalderwood/flopy
python
def get_package_list(self, ftype=None): "\n Get a list of all the package names.\n\n Parameters\n ----------\n ftype : str\n Type of package, 'RIV', 'LPF', etc.\n\n Returns\n -------\n val : list of strings\n Can be used to see what packages are...
def _check(self, chk, level=1): "\n Check model data for common errors.\n\n Parameters\n ----------\n f : str or file handle\n String defining file name or file handle for summary file\n of check method output. If a string is passed a file handle\n is cre...
2,392,933,745,744,231,400
Check model data for common errors. Parameters ---------- f : str or file handle String defining file name or file handle for summary file of check method output. If a string is passed a file handle is created. If f is None, check method does not write results to a summary file. (default is None) verbo...
flopy/mbase.py
_check
andrewcalderwood/flopy
python
def _check(self, chk, level=1): "\n Check model data for common errors.\n\n Parameters\n ----------\n f : str or file handle\n String defining file name or file handle for summary file\n of check method output. If a string is passed a file handle\n is cre...
def __init__(self, modelname='modflowtest', namefile_ext='nam', exe_name='mf2k.exe', model_ws=None, structured=True, verbose=False, **kwargs): 'Initialize BaseModel.' super().__init__() self.__name = modelname self.namefile_ext = (namefile_ext or '') self._namefile = ((self.__name + '.') + self.name...
-2,770,028,243,060,520,400
Initialize BaseModel.
flopy/mbase.py
__init__
andrewcalderwood/flopy
python
def __init__(self, modelname='modflowtest', namefile_ext='nam', exe_name='mf2k.exe', model_ws=None, structured=True, verbose=False, **kwargs): super().__init__() self.__name = modelname self.namefile_ext = (namefile_ext or ) self._namefile = ((self.__name + '.') + self.namefile_ext) self._packa...
def next_ext_unit(self): '\n Function to encapsulate next_ext_unit attribute\n\n ' next_unit = (self._next_ext_unit + 1) self._next_ext_unit += 1 return next_unit
1,073,153,636,386,303,000
Function to encapsulate next_ext_unit attribute
flopy/mbase.py
next_ext_unit
andrewcalderwood/flopy
python
def next_ext_unit(self): '\n \n\n ' next_unit = (self._next_ext_unit + 1) self._next_ext_unit += 1 return next_unit
def export(self, f, **kwargs): '\n Method to export a model to netcdf or shapefile based on the\n extension of the file name (.shp for shapefile, .nc for netcdf)\n\n Parameters\n ----------\n f : str\n filename\n kwargs : keyword arguments\n modelgrid ...
-9,079,781,501,208,759,000
Method to export a model to netcdf or shapefile based on the extension of the file name (.shp for shapefile, .nc for netcdf) Parameters ---------- f : str filename kwargs : keyword arguments modelgrid : flopy.discretization.Grid instance user supplied modelgrid which can be used for exporting i...
flopy/mbase.py
export
andrewcalderwood/flopy
python
def export(self, f, **kwargs): '\n Method to export a model to netcdf or shapefile based on the\n extension of the file name (.shp for shapefile, .nc for netcdf)\n\n Parameters\n ----------\n f : str\n filename\n kwargs : keyword arguments\n modelgrid ...
def add_package(self, p): '\n Add a package.\n\n Parameters\n ----------\n p : Package object\n\n ' for (idx, u) in enumerate(p.unit_number): if (u != 0): if ((u in self.package_units) or (u in self.external_units)): try: ...
7,081,921,362,581,270,000
Add a package. Parameters ---------- p : Package object
flopy/mbase.py
add_package
andrewcalderwood/flopy
python
def add_package(self, p): '\n Add a package.\n\n Parameters\n ----------\n p : Package object\n\n ' for (idx, u) in enumerate(p.unit_number): if (u != 0): if ((u in self.package_units) or (u in self.external_units)): try: ...
def remove_package(self, pname): "\n Remove a package from this model\n\n Parameters\n ----------\n pname : string\n Name of the package, such as 'RIV', 'BAS6', etc.\n\n " for (i, pp) in enumerate(self.packagelist): if (pname.upper() in pp.name): ...
1,808,959,202,091,257,300
Remove a package from this model Parameters ---------- pname : string Name of the package, such as 'RIV', 'BAS6', etc.
flopy/mbase.py
remove_package
andrewcalderwood/flopy
python
def remove_package(self, pname): "\n Remove a package from this model\n\n Parameters\n ----------\n pname : string\n Name of the package, such as 'RIV', 'BAS6', etc.\n\n " for (i, pp) in enumerate(self.packagelist): if (pname.upper() in pp.name): ...
def __getattr__(self, item): '\n __getattr__ - syntactic sugar\n\n Parameters\n ----------\n item : str\n 3 character package name (case insensitive) or "sr" to access\n the SpatialReference instance of the ModflowDis object\n\n\n Returns\n -------\n ...
8,095,475,259,741,164,000
__getattr__ - syntactic sugar Parameters ---------- item : str 3 character package name (case insensitive) or "sr" to access the SpatialReference instance of the ModflowDis object Returns ------- sr : SpatialReference instance pp : Package object Package object of type :class:`flopy.pakbase.Package` Not...
flopy/mbase.py
__getattr__
andrewcalderwood/flopy
python
def __getattr__(self, item): '\n __getattr__ - syntactic sugar\n\n Parameters\n ----------\n item : str\n 3 character package name (case insensitive) or "sr" to access\n the SpatialReference instance of the ModflowDis object\n\n\n Returns\n -------\n ...
def add_output_file(self, unit, fname=None, extension='cbc', binflag=True, package=None): '\n Add an ascii or binary output file for a package\n\n Parameters\n ----------\n unit : int\n unit number of external array\n fname : str\n filename of external array....
-1,661,629,637,262,426,400
Add an ascii or binary output file for a package Parameters ---------- unit : int unit number of external array fname : str filename of external array. (default is None) extension : str extension to use for the cell-by-cell file. Only used if fname is None. (default is cbc) binflag : bool boolean f...
flopy/mbase.py
add_output_file
andrewcalderwood/flopy
python
def add_output_file(self, unit, fname=None, extension='cbc', binflag=True, package=None): '\n Add an ascii or binary output file for a package\n\n Parameters\n ----------\n unit : int\n unit number of external array\n fname : str\n filename of external array....
def add_output(self, fname, unit, binflag=False, package=None): '\n Assign an external array so that it will be listed as a DATA or\n DATA(BINARY) entry in the name file. This will allow an outside\n file package to refer to it.\n\n Parameters\n ----------\n fname : str\n ...
3,642,976,816,825,424,400
Assign an external array so that it will be listed as a DATA or DATA(BINARY) entry in the name file. This will allow an outside file package to refer to it. Parameters ---------- fname : str filename of external array unit : int unit number of external array binflag : boolean binary or not. (default is Fa...
flopy/mbase.py
add_output
andrewcalderwood/flopy
python
def add_output(self, fname, unit, binflag=False, package=None): '\n Assign an external array so that it will be listed as a DATA or\n DATA(BINARY) entry in the name file. This will allow an outside\n file package to refer to it.\n\n Parameters\n ----------\n fname : str\n ...
def remove_output(self, fname=None, unit=None): '\n Remove an output file from the model by specifying either the\n file name or the unit number.\n\n Parameters\n ----------\n fname : str\n filename of output array\n unit : int\n unit number of output ...
-5,755,566,078,614,364,000
Remove an output file from the model by specifying either the file name or the unit number. Parameters ---------- fname : str filename of output array unit : int unit number of output array
flopy/mbase.py
remove_output
andrewcalderwood/flopy
python
def remove_output(self, fname=None, unit=None): '\n Remove an output file from the model by specifying either the\n file name or the unit number.\n\n Parameters\n ----------\n fname : str\n filename of output array\n unit : int\n unit number of output ...
def get_output(self, fname=None, unit=None): '\n Get an output file from the model by specifying either the\n file name or the unit number.\n\n Parameters\n ----------\n fname : str\n filename of output array\n unit : int\n unit number of output array\...
7,864,843,972,654,850,000
Get an output file from the model by specifying either the file name or the unit number. Parameters ---------- fname : str filename of output array unit : int unit number of output array
flopy/mbase.py
get_output
andrewcalderwood/flopy
python
def get_output(self, fname=None, unit=None): '\n Get an output file from the model by specifying either the\n file name or the unit number.\n\n Parameters\n ----------\n fname : str\n filename of output array\n unit : int\n unit number of output array\...
def set_output_attribute(self, fname=None, unit=None, attr=None): '\n Set a variable in an output file from the model by specifying either\n the file name or the unit number and a dictionary with attributes\n to change.\n\n Parameters\n ----------\n fname : str\n ...
8,292,622,623,377,403,000
Set a variable in an output file from the model by specifying either the file name or the unit number and a dictionary with attributes to change. Parameters ---------- fname : str filename of output array unit : int unit number of output array
flopy/mbase.py
set_output_attribute
andrewcalderwood/flopy
python
def set_output_attribute(self, fname=None, unit=None, attr=None): '\n Set a variable in an output file from the model by specifying either\n the file name or the unit number and a dictionary with attributes\n to change.\n\n Parameters\n ----------\n fname : str\n ...
def get_output_attribute(self, fname=None, unit=None, attr=None): '\n Get a attribute for an output file from the model by specifying either\n the file name or the unit number.\n\n Parameters\n ----------\n fname : str\n filename of output array\n unit : int\n ...
-6,229,907,047,886,764,000
Get a attribute for an output file from the model by specifying either the file name or the unit number. Parameters ---------- fname : str filename of output array unit : int unit number of output array
flopy/mbase.py
get_output_attribute
andrewcalderwood/flopy
python
def get_output_attribute(self, fname=None, unit=None, attr=None): '\n Get a attribute for an output file from the model by specifying either\n the file name or the unit number.\n\n Parameters\n ----------\n fname : str\n filename of output array\n unit : int\n ...
def add_external(self, fname, unit, binflag=False, output=False): '\n Assign an external array so that it will be listed as a DATA or\n DATA(BINARY) entry in the name file. This will allow an outside\n file package to refer to it.\n\n Parameters\n ----------\n fname : str\...
8,922,479,497,916,789,000
Assign an external array so that it will be listed as a DATA or DATA(BINARY) entry in the name file. This will allow an outside file package to refer to it. Parameters ---------- fname : str filename of external array unit : int unit number of external array binflag : boolean binary or not. (default is Fa...
flopy/mbase.py
add_external
andrewcalderwood/flopy
python
def add_external(self, fname, unit, binflag=False, output=False): '\n Assign an external array so that it will be listed as a DATA or\n DATA(BINARY) entry in the name file. This will allow an outside\n file package to refer to it.\n\n Parameters\n ----------\n fname : str\...
def remove_external(self, fname=None, unit=None): '\n Remove an external file from the model by specifying either the\n file name or the unit number.\n\n Parameters\n ----------\n fname : str\n filename of external array\n unit : int\n unit number of e...
3,337,016,843,183,099,400
Remove an external file from the model by specifying either the file name or the unit number. Parameters ---------- fname : str filename of external array unit : int unit number of external array
flopy/mbase.py
remove_external
andrewcalderwood/flopy
python
def remove_external(self, fname=None, unit=None): '\n Remove an external file from the model by specifying either the\n file name or the unit number.\n\n Parameters\n ----------\n fname : str\n filename of external array\n unit : int\n unit number of e...
def add_existing_package(self, filename, ptype=None, copy_to_model_ws=True): '\n Add an existing package to a model instance.\n\n Parameters\n ----------\n\n filename : str\n the name of the file to add as a package\n ptype : optional\n the model package type...
3,980,745,397,456,637,400
Add an existing package to a model instance. Parameters ---------- filename : str the name of the file to add as a package ptype : optional the model package type (e.g. "lpf", "wel", etc). If None, then the file extension of the filename arg is used copy_to_model_ws : bool flag to copy the package fi...
flopy/mbase.py
add_existing_package
andrewcalderwood/flopy
python
def add_existing_package(self, filename, ptype=None, copy_to_model_ws=True): '\n Add an existing package to a model instance.\n\n Parameters\n ----------\n\n filename : str\n the name of the file to add as a package\n ptype : optional\n the model package type...
def get_name_file_entries(self): '\n Get a string representation of the name file.\n\n Parameters\n ----------\n\n ' lines = [] for p in self.packagelist: for i in range(len(p.name)): if (p.unit_number[i] == 0): continue s = f'{p.na...
163,448,600,108,196,480
Get a string representation of the name file. Parameters ----------
flopy/mbase.py
get_name_file_entries
andrewcalderwood/flopy
python
def get_name_file_entries(self): '\n Get a string representation of the name file.\n\n Parameters\n ----------\n\n ' lines = [] for p in self.packagelist: for i in range(len(p.name)): if (p.unit_number[i] == 0): continue s = f'{p.na...
def has_package(self, name): "\n Check if package name is in package list.\n\n Parameters\n ----------\n name : str\n Name of the package, 'DIS', 'BAS6', etc. (case-insensitive).\n\n Returns\n -------\n bool\n True if package name exists, otherw...
9,068,293,731,091,111,000
Check if package name is in package list. Parameters ---------- name : str Name of the package, 'DIS', 'BAS6', etc. (case-insensitive). Returns ------- bool True if package name exists, otherwise False if not found.
flopy/mbase.py
has_package
andrewcalderwood/flopy
python
def has_package(self, name): "\n Check if package name is in package list.\n\n Parameters\n ----------\n name : str\n Name of the package, 'DIS', 'BAS6', etc. (case-insensitive).\n\n Returns\n -------\n bool\n True if package name exists, otherw...
def get_package(self, name): "\n Get a package.\n\n Parameters\n ----------\n name : str\n Name of the package, 'RIV', 'LPF', etc. (case-insensitive).\n\n Returns\n -------\n pp : Package object\n Package object of type :class:`flopy.pakbase.Pac...
-3,867,293,366,743,963,000
Get a package. Parameters ---------- name : str Name of the package, 'RIV', 'LPF', etc. (case-insensitive). Returns ------- pp : Package object Package object of type :class:`flopy.pakbase.Package`
flopy/mbase.py
get_package
andrewcalderwood/flopy
python
def get_package(self, name): "\n Get a package.\n\n Parameters\n ----------\n name : str\n Name of the package, 'RIV', 'LPF', etc. (case-insensitive).\n\n Returns\n -------\n pp : Package object\n Package object of type :class:`flopy.pakbase.Pac...
def change_model_ws(self, new_pth=None, reset_external=False): '\n Change the model work space.\n\n Parameters\n ----------\n new_pth : str\n Location of new model workspace. If this path does not exist,\n it will be created. (default is None, which will be assigne...
3,764,117,741,947,156,000
Change the model work space. Parameters ---------- new_pth : str Location of new model workspace. If this path does not exist, it will be created. (default is None, which will be assigned to the present working directory). Returns ------- val : list of strings Can be used to see what packages are in ...
flopy/mbase.py
change_model_ws
andrewcalderwood/flopy
python
def change_model_ws(self, new_pth=None, reset_external=False): '\n Change the model work space.\n\n Parameters\n ----------\n new_pth : str\n Location of new model workspace. If this path does not exist,\n it will be created. (default is None, which will be assigne...
def _set_name(self, value): '\n Set model name\n\n Parameters\n ----------\n value : str\n Name to assign to model.\n\n ' self.__name = str(value) self.namefile = ((self.__name + '.') + self.namefile_ext) for p in self.packagelist: for i in range(len...
-533,643,582,773,746,240
Set model name Parameters ---------- value : str Name to assign to model.
flopy/mbase.py
_set_name
andrewcalderwood/flopy
python
def _set_name(self, value): '\n Set model name\n\n Parameters\n ----------\n value : str\n Name to assign to model.\n\n ' self.__name = str(value) self.namefile = ((self.__name + '.') + self.namefile_ext) for p in self.packagelist: for i in range(len...
def run_model(self, silent=False, pause=False, report=False, normal_msg='normal termination'): "\n This method will run the model using subprocess.Popen.\n\n Parameters\n ----------\n silent : boolean\n Echo run information to screen (default is True).\n pause : boolean...
741,409,845,867,963,900
This method will run the model using subprocess.Popen. Parameters ---------- silent : boolean Echo run information to screen (default is True). pause : boolean, optional Pause upon completion (default is False). report : boolean, optional Save stdout lines to a list (buff) which is returned by the meth...
flopy/mbase.py
run_model
andrewcalderwood/flopy
python
def run_model(self, silent=False, pause=False, report=False, normal_msg='normal termination'): "\n This method will run the model using subprocess.Popen.\n\n Parameters\n ----------\n silent : boolean\n Echo run information to screen (default is True).\n pause : boolean...
def write_input(self, SelPackList=False, check=False): '\n Write the input.\n\n Parameters\n ----------\n SelPackList : False or list of packages\n\n ' if check: self.check(f=f'{self.name}.chk', verbose=self.verbose, level=1) if (self.parameter_load and (not self.f...
-1,098,992,733,097,818,900
Write the input. Parameters ---------- SelPackList : False or list of packages
flopy/mbase.py
write_input
andrewcalderwood/flopy
python
def write_input(self, SelPackList=False, check=False): '\n Write the input.\n\n Parameters\n ----------\n SelPackList : False or list of packages\n\n ' if check: self.check(f=f'{self.name}.chk', verbose=self.verbose, level=1) if (self.parameter_load and (not self.f...
def write_name_file(self): '\n Every Package needs its own writenamefile function\n\n ' raise Exception('IMPLEMENTATION ERROR: writenamefile must be overloaded')
-2,690,977,166,812,218,000
Every Package needs its own writenamefile function
flopy/mbase.py
write_name_file
andrewcalderwood/flopy
python
def write_name_file(self): '\n \n\n ' raise Exception('IMPLEMENTATION ERROR: writenamefile must be overloaded')
def set_model_units(self): '\n Every model needs its own set_model_units method\n\n ' raise Exception('IMPLEMENTATION ERROR: set_model_units must be overloaded')
6,248,661,952,445,160,000
Every model needs its own set_model_units method
flopy/mbase.py
set_model_units
andrewcalderwood/flopy
python
def set_model_units(self): '\n \n\n ' raise Exception('IMPLEMENTATION ERROR: set_model_units must be overloaded')
@property def name(self): '\n Get model name\n\n Returns\n -------\n name : str\n name of model\n\n ' return copy.deepcopy(self.__name)
7,491,200,860,821,816,000
Get model name Returns ------- name : str name of model
flopy/mbase.py
name
andrewcalderwood/flopy
python
@property def name(self): '\n Get model name\n\n Returns\n -------\n name : str\n name of model\n\n ' return copy.deepcopy(self.__name)
def add_pop_key_list(self, key): '\n Add a external file unit number to a list that will be used to remove\n model output (typically binary) files from ext_unit_dict.\n\n Parameters\n ----------\n key : int\n file unit number\n\n Returns\n -------\n\n ...
2,541,391,672,276,510,700
Add a external file unit number to a list that will be used to remove model output (typically binary) files from ext_unit_dict. Parameters ---------- key : int file unit number Returns ------- Examples --------
flopy/mbase.py
add_pop_key_list
andrewcalderwood/flopy
python
def add_pop_key_list(self, key): '\n Add a external file unit number to a list that will be used to remove\n model output (typically binary) files from ext_unit_dict.\n\n Parameters\n ----------\n key : int\n file unit number\n\n Returns\n -------\n\n ...
def check(self, f=None, verbose=True, level=1): "\n Check model data for common errors.\n\n Parameters\n ----------\n f : str or file handle\n String defining file name or file handle for summary file\n of check method output. If a string is passed a file handle\n ...
-1,067,797,224,698,142,700
Check model data for common errors. Parameters ---------- f : str or file handle String defining file name or file handle for summary file of check method output. If a string is passed a file handle is created. If f is None, check method does not write results to a summary file. (default is None) verbo...
flopy/mbase.py
check
andrewcalderwood/flopy
python
def check(self, f=None, verbose=True, level=1): "\n Check model data for common errors.\n\n Parameters\n ----------\n f : str or file handle\n String defining file name or file handle for summary file\n of check method output. If a string is passed a file handle\n ...
def plot(self, SelPackList=None, **kwargs): "\n Plot 2-D, 3-D, transient 2-D, and stress period list (MfList)\n model input data\n\n Parameters\n ----------\n SelPackList : bool or list\n List of of packages to plot. If SelPackList=None all packages\n are plo...
-8,959,228,950,895,840,000
Plot 2-D, 3-D, transient 2-D, and stress period list (MfList) model input data Parameters ---------- SelPackList : bool or list List of of packages to plot. If SelPackList=None all packages are plotted. (default is None) **kwargs : dict filename_base : str Base file name that will be used to automa...
flopy/mbase.py
plot
andrewcalderwood/flopy
python
def plot(self, SelPackList=None, **kwargs): "\n Plot 2-D, 3-D, transient 2-D, and stress period list (MfList)\n model input data\n\n Parameters\n ----------\n SelPackList : bool or list\n List of of packages to plot. If SelPackList=None all packages\n are plo...
def to_shapefile(self, filename, package_names=None, **kwargs): '\n Wrapper function for writing a shapefile for the model grid. If\n package_names is not None, then search through the requested packages\n looking for arrays that can be added to the shapefile as attributes\n\n Parameter...
-2,578,493,498,774,151,700
Wrapper function for writing a shapefile for the model grid. If package_names is not None, then search through the requested packages looking for arrays that can be added to the shapefile as attributes Parameters ---------- filename : string name of the shapefile to write package_names : list of package names (e....
flopy/mbase.py
to_shapefile
andrewcalderwood/flopy
python
def to_shapefile(self, filename, package_names=None, **kwargs): '\n Wrapper function for writing a shapefile for the model grid. If\n package_names is not None, then search through the requested packages\n looking for arrays that can be added to the shapefile as attributes\n\n Parameter...
def make_docstring_obj(docstr, default='google', template_order=False): "Detect docstring style and create a Docstring object\n\n Parameters:\n docstr (str): source docstring\n default (str, class): 'google', 'numpy' or subclass\n of Docstring\n template_order (bool, optional): if...
-3,128,637,298,797,223,000
Detect docstring style and create a Docstring object Parameters: docstr (str): source docstring default (str, class): 'google', 'numpy' or subclass of Docstring template_order (bool, optional): iff True, reorder the sections to match the order they appear in the template Returns: subcl...
docstring_styles.py
make_docstring_obj
KristoforMaynard/SublimeAutoDocstring
python
def make_docstring_obj(docstr, default='google', template_order=False): "Detect docstring style and create a Docstring object\n\n Parameters:\n docstr (str): source docstring\n default (str, class): 'google', 'numpy' or subclass\n of Docstring\n template_order (bool, optional): if...
def detect_style(docstr): 'Detect docstr style from existing docstring\n\n Parameters:\n docstr (str): docstring whose style we want to know\n\n Returns:\n class: one of [GoogleDocstring, NumpyDocstring, None]; None\n means no match\n ' docstr = dedent_docstr(docstr) for c ...
4,776,598,432,322,184,000
Detect docstr style from existing docstring Parameters: docstr (str): docstring whose style we want to know Returns: class: one of [GoogleDocstring, NumpyDocstring, None]; None means no match
docstring_styles.py
detect_style
KristoforMaynard/SublimeAutoDocstring
python
def detect_style(docstr): 'Detect docstr style from existing docstring\n\n Parameters:\n docstr (str): docstring whose style we want to know\n\n Returns:\n class: one of [GoogleDocstring, NumpyDocstring, None]; None\n means no match\n ' docstr = dedent_docstr(docstr) for c ...
def dedent_docstr(s, n=1): 'Dedent all lines except first n lines\n\n Args:\n s (type): some text to dedent\n n (int): number of lines to skip, (n == 0 is a normal dedent,\n n == 1 is useful for whole docstrings)\n ' lines = s.splitlines(keepends=True) if lines: first_...
-1,250,882,212,853,893,400
Dedent all lines except first n lines Args: s (type): some text to dedent n (int): number of lines to skip, (n == 0 is a normal dedent, n == 1 is useful for whole docstrings)
docstring_styles.py
dedent_docstr
KristoforMaynard/SublimeAutoDocstring
python
def dedent_docstr(s, n=1): 'Dedent all lines except first n lines\n\n Args:\n s (type): some text to dedent\n n (int): number of lines to skip, (n == 0 is a normal dedent,\n n == 1 is useful for whole docstrings)\n ' lines = s.splitlines(keepends=True) if lines: first_...
def indent_docstr(s, indent, n=1, trim=True): "Add common indentation to all lines except first\n\n Args:\n s (str): docstring starting at indentation level 0\n indent (str): text used for indentation, in practice\n this will be the level of the declaration + 1\n n (int): don't in...
732,585,054,161,065,600
Add common indentation to all lines except first Args: s (str): docstring starting at indentation level 0 indent (str): text used for indentation, in practice this will be the level of the declaration + 1 n (int): don't indent first n lines trim (bool): trim whitespace (' ') out of blan...
docstring_styles.py
indent_docstr
KristoforMaynard/SublimeAutoDocstring
python
def indent_docstr(s, indent, n=1, trim=True): "Add common indentation to all lines except first\n\n Args:\n s (str): docstring starting at indentation level 0\n indent (str): text used for indentation, in practice\n this will be the level of the declaration + 1\n n (int): don't in...
def count_leading_newlines(s): 'count number of leading newlines\n\n this includes newlines that are separated by other whitespace\n ' return s[:(- len(s.lstrip()))].count('\n')
-4,997,131,412,159,201,000
count number of leading newlines this includes newlines that are separated by other whitespace
docstring_styles.py
count_leading_newlines
KristoforMaynard/SublimeAutoDocstring
python
def count_leading_newlines(s): 'count number of leading newlines\n\n this includes newlines that are separated by other whitespace\n ' return s[:(- len(s.lstrip()))].count('\n')
def count_trailing_newlines(s): 'count number of trailing newlines\n\n this includes newlines that are separated by other whitespace\n ' return s[len(s.rstrip()):].count('\n')
3,625,316,195,696,609,000
count number of trailing newlines this includes newlines that are separated by other whitespace
docstring_styles.py
count_trailing_newlines
KristoforMaynard/SublimeAutoDocstring
python
def count_trailing_newlines(s): 'count number of trailing newlines\n\n this includes newlines that are separated by other whitespace\n ' return s[len(s.rstrip()):].count('\n')
def with_bounding_newlines(s, nleading=0, ntrailing=0, nl='\n'): 'return s with at least # leading and # trailing newlines\n\n this includes newlines that are separated by other whitespace\n ' return '{0}{1}{2}'.format((nl * (nleading - count_leading_newlines(s))), s, (nl * (ntrailing - count_trailing_new...
-1,088,108,019,192,048,300
return s with at least # leading and # trailing newlines this includes newlines that are separated by other whitespace
docstring_styles.py
with_bounding_newlines
KristoforMaynard/SublimeAutoDocstring
python
def with_bounding_newlines(s, nleading=0, ntrailing=0, nl='\n'): 'return s with at least # leading and # trailing newlines\n\n this includes newlines that are separated by other whitespace\n ' return '{0}{1}{2}'.format((nl * (nleading - count_leading_newlines(s))), s, (nl * (ntrailing - count_trailing_new...
def strip_newlines(s, nleading=0, ntrailing=0): 'strip at most nleading and ntrailing newlines from s' for _ in range(nleading): if (s.lstrip(' \t')[0] == '\n'): s = s.lstrip(' \t')[1:] elif (s.lstrip(' \t')[0] == '\r\n'): s = s.lstrip(' \t')[2:] for _ in range(ntrail...
2,890,142,498,404,516,000
strip at most nleading and ntrailing newlines from s
docstring_styles.py
strip_newlines
KristoforMaynard/SublimeAutoDocstring
python
def strip_newlines(s, nleading=0, ntrailing=0): for _ in range(nleading): if (s.lstrip(' \t')[0] == '\n'): s = s.lstrip(' \t')[1:] elif (s.lstrip(' \t')[0] == '\r\n'): s = s.lstrip(' \t')[2:] for _ in range(ntrailing): if (s.rstrip(' \t')[(- 2):] == '\r\n'): ...
def __init__(self, names, types, description, tag=None, descr_only=False, annotated=False, **kwargs): '\n Args:\n names (list): list of names\n types (str): string describing data types\n description (str): description text\n tag (int): some meaningful index? not f...
-8,682,166,393,122,643,000
Args: names (list): list of names types (str): string describing data types description (str): description text tag (int): some meaningful index? not fleshed out yet descr_only (bool): only description is useful **kwargs: Description
docstring_styles.py
__init__
KristoforMaynard/SublimeAutoDocstring
python
def __init__(self, names, types, description, tag=None, descr_only=False, annotated=False, **kwargs): '\n Args:\n names (list): list of names\n types (str): string describing data types\n description (str): description text\n tag (int): some meaningful index? not f...
def __init__(self, heading, text='', indent=None, **kwargs): '\n Args:\n heading (str): heading of the section (should be title case)\n text (str, optional): section text\n indent (str, optional): used by some formatters\n ' self.heading = heading self.alias = ...
-7,361,021,358,198,873,000
Args: heading (str): heading of the section (should be title case) text (str, optional): section text indent (str, optional): used by some formatters
docstring_styles.py
__init__
KristoforMaynard/SublimeAutoDocstring
python
def __init__(self, heading, text=, indent=None, **kwargs): '\n Args:\n heading (str): heading of the section (should be title case)\n text (str, optional): section text\n indent (str, optional): used by some formatters\n ' self.heading = heading self.alias = se...
@staticmethod def finalize_param(s, tag): '\n Args:\n s (type): Description\n tag (int): index of param? not fleshed out yet\n ' meta = {} _r = '([^,\\s]+(?:\\s*,\\s*[^,\\s]+)*\\s*)(?:\\((.*)\\))?\\s*:\\s*(.*)' m = re.match(_r, s, (re.DOTALL | re.MULTILINE)) if m:...
-357,955,744,281,116,600
Args: s (type): Description tag (int): index of param? not fleshed out yet
docstring_styles.py
finalize_param
KristoforMaynard/SublimeAutoDocstring
python
@staticmethod def finalize_param(s, tag): '\n Args:\n s (type): Description\n tag (int): index of param? not fleshed out yet\n ' meta = {} _r = '([^,\\s]+(?:\\s*,\\s*[^,\\s]+)*\\s*)(?:\\((.*)\\))?\\s*:\\s*(.*)' m = re.match(_r, s, (re.DOTALL | re.MULTILINE)) if m:...
def __init__(self, docstr, template_order=False): '\n Parameters:\n docstr (Docstring or str): some existing docstring\n template_order (bool, optional): iff True, reorder the\n sections to match the order they appear in the template\n ' if isinstance(docstr, D...
3,052,008,837,252,113,000
Parameters: docstr (Docstring or str): some existing docstring template_order (bool, optional): iff True, reorder the sections to match the order they appear in the template
docstring_styles.py
__init__
KristoforMaynard/SublimeAutoDocstring
python
def __init__(self, docstr, template_order=False): '\n Parameters:\n docstr (Docstring or str): some existing docstring\n template_order (bool, optional): iff True, reorder the\n sections to match the order they appear in the template\n ' if isinstance(docstr, D...
def _parse(self, s): 'Parse docstring into meta data\n\n Parameters:\n s (str): docstring\n ' raise NotImplementedError('_parse is an abstract method')
-1,244,231,716,986,868,000
Parse docstring into meta data Parameters: s (str): docstring
docstring_styles.py
_parse
KristoforMaynard/SublimeAutoDocstring
python
def _parse(self, s): 'Parse docstring into meta data\n\n Parameters:\n s (str): docstring\n ' raise NotImplementedError('_parse is an abstract method')
def format(self, top_indent): 'Format docstring into a string\n\n Parameters:\n top_indent (str): indentation added to all but the first\n lines\n\n Returns:\n str: properly formatted\n ' raise NotImplementedError('format is an abstract method')
-4,791,040,278,329,210,000
Format docstring into a string Parameters: top_indent (str): indentation added to all but the first lines Returns: str: properly formatted
docstring_styles.py
format
KristoforMaynard/SublimeAutoDocstring
python
def format(self, top_indent): 'Format docstring into a string\n\n Parameters:\n top_indent (str): indentation added to all but the first\n lines\n\n Returns:\n str: properly formatted\n ' raise NotImplementedError('format is an abstract method')
def update_attributes(self, attribs, alpha_order=True): '\n Args:\n params (OrderedDict): params objects keyed by their names\n ' raise NotImplementedError('update_attributes is an abstract method')
8,362,530,383,108,397,000
Args: params (OrderedDict): params objects keyed by their names
docstring_styles.py
update_attributes
KristoforMaynard/SublimeAutoDocstring
python
def update_attributes(self, attribs, alpha_order=True): '\n Args:\n params (OrderedDict): params objects keyed by their names\n ' raise NotImplementedError('update_attributes is an abstract method')
def update_exceptions(self, attribs, alpha_order=True): '\n Args:\n params (OrderedDict): params objects keyed by their names\n ' raise NotImplementedError('update_exceptions is an abstract method')
4,752,826,982,414,909,000
Args: params (OrderedDict): params objects keyed by their names
docstring_styles.py
update_exceptions
KristoforMaynard/SublimeAutoDocstring
python
def update_exceptions(self, attribs, alpha_order=True): '\n Args:\n params (OrderedDict): params objects keyed by their names\n ' raise NotImplementedError('update_exceptions is an abstract method')
def finalize_section(self, heading, text): '\n Args:\n heading (type): Description\n text (type): Description\n ' section = self.SECTION_STYLE(heading, text) self.sections[section.alias] = section
7,268,294,569,221,583,000
Args: heading (type): Description text (type): Description
docstring_styles.py
finalize_section
KristoforMaynard/SublimeAutoDocstring
python
def finalize_section(self, heading, text): '\n Args:\n heading (type): Description\n text (type): Description\n ' section = self.SECTION_STYLE(heading, text) self.sections[section.alias] = section
def section_exists(self, section_name): 'returns True iff section exists, and was finalized' sec = None if (section_name in self.sections): sec = self.sections[section_name] elif (section_name in self.SECTION_STYLE.ALIASES): alias = self.SECTION_STYLE.resolve_alias(section_name) ...
508,379,813,229,340,800
returns True iff section exists, and was finalized
docstring_styles.py
section_exists
KristoforMaynard/SublimeAutoDocstring
python
def section_exists(self, section_name): sec = None if (section_name in self.sections): sec = self.sections[section_name] elif (section_name in self.SECTION_STYLE.ALIASES): alias = self.SECTION_STYLE.resolve_alias(section_name) if (alias in self.sections): sec = self....
def _parse(self, s): '\n Args:\n s (type): Description\n ' logger.info('[NapoleonDocstring] starts parsing text') self.trailing_newlines = count_trailing_newlines(s) s = dedent_docstr(s) sec_starts = [(m.start(), m.end(), m.string[m.start():m.end()]) for m in re.finditer(sel...
9,075,237,344,088,898,000
Args: s (type): Description
docstring_styles.py
_parse
KristoforMaynard/SublimeAutoDocstring
python
def _parse(self, s): '\n Args:\n s (type): Description\n ' logger.info('[NapoleonDocstring] starts parsing text') self.trailing_newlines = count_trailing_newlines(s) s = dedent_docstr(s) sec_starts = [(m.start(), m.end(), m.string[m.start():m.end()]) for m in re.finditer(sel...
def format(self, top_indent): '\n Args:\n top_indent (type): Description\n\n ' logger.info('[NapoleonDocstring] starts formatting') s = '' if self.section_exists('Summary'): sec_text = self.get_section('Summary').text if sec_text.strip(): s += with_bo...
-4,111,122,369,448,023,600
Args: top_indent (type): Description
docstring_styles.py
format
KristoforMaynard/SublimeAutoDocstring
python
def format(self, top_indent): '\n Args:\n top_indent (type): Description\n\n ' logger.info('[NapoleonDocstring] starts formatting') s = if self.section_exists('Summary'): sec_text = self.get_section('Summary').text if sec_text.strip(): s += with_boun...
def _update_section(self, params, sec_name, sec_alias=None, del_prefix='Deleted ', alpha_order=False, other_sections=()): 'Update section to add / remove params\n\n As a failsafe, params that are removed are placed in a\n "Deleted ..." section\n\n Args:\n params (OrderedDict): dict o...
8,557,606,910,817,434,000
Update section to add / remove params As a failsafe, params that are removed are placed in a "Deleted ..." section Args: params (OrderedDict): dict of Parameter objects sec_name (str): generic section name sec_alias (str): section name that appears in teh docstring del_prefix (str): prefix for section...
docstring_styles.py
_update_section
KristoforMaynard/SublimeAutoDocstring
python
def _update_section(self, params, sec_name, sec_alias=None, del_prefix='Deleted ', alpha_order=False, other_sections=()): 'Update section to add / remove params\n\n As a failsafe, params that are removed are placed in a\n "Deleted ..." section\n\n Args:\n params (OrderedDict): dict o...
def update_parameters(self, params): '\n Args:\n params (OrderedDict): params objects keyed by their names\n ' logger.info('[NapoleonDocstring] update parameters') other_sections = ['Other Parameters', 'Keyword Parameters'] self._update_section(params, 'Parameters', self.PREFERR...
-3,149,674,930,633,215,500
Args: params (OrderedDict): params objects keyed by their names
docstring_styles.py
update_parameters
KristoforMaynard/SublimeAutoDocstring
python
def update_parameters(self, params): '\n Args:\n params (OrderedDict): params objects keyed by their names\n ' logger.info('[NapoleonDocstring] update parameters') other_sections = ['Other Parameters', 'Keyword Parameters'] self._update_section(params, 'Parameters', self.PREFERR...
def update_attributes(self, attribs, alpha_order=True): '\n Args:\n params (OrderedDict): params objects keyed by their names\n ' logger.info('[NapoleonDocstring] update attributes') self._update_section(attribs, 'Attributes', alpha_order=alpha_order)
192,604,979,378,733,470
Args: params (OrderedDict): params objects keyed by their names
docstring_styles.py
update_attributes
KristoforMaynard/SublimeAutoDocstring
python
def update_attributes(self, attribs, alpha_order=True): '\n Args:\n params (OrderedDict): params objects keyed by their names\n ' logger.info('[NapoleonDocstring] update attributes') self._update_section(attribs, 'Attributes', alpha_order=alpha_order)
def update_exceptions(self, attribs, alpha_order=True): '\n Args:\n params (OrderedDict): params objects keyed by their names\n ' logger.info('[NapoleonDocstring] update exceptions') self._update_section(attribs, 'Raises', del_prefix='No Longer ', alpha_order=alpha_order)
-4,194,534,135,168,882,000
Args: params (OrderedDict): params objects keyed by their names
docstring_styles.py
update_exceptions
KristoforMaynard/SublimeAutoDocstring
python
def update_exceptions(self, attribs, alpha_order=True): '\n Args:\n params (OrderedDict): params objects keyed by their names\n ' logger.info('[NapoleonDocstring] update exceptions') self._update_section(attribs, 'Raises', del_prefix='No Longer ', alpha_order=alpha_order)