Add files using upload-large-folder tool
Browse filesThis view is limited to 50 files because it contains too many changes.
See raw diff
- tuning-competition-baseline/.venv/lib/python3.11/site-packages/Cython/Includes/cpython/__init__.pxd +187 -0
- tuning-competition-baseline/.venv/lib/python3.11/site-packages/Cython/Includes/cpython/array.pxd +174 -0
- tuning-competition-baseline/.venv/lib/python3.11/site-packages/Cython/Includes/cpython/cellobject.pxd +35 -0
- tuning-competition-baseline/.venv/lib/python3.11/site-packages/Cython/Includes/cpython/complex.pxd +55 -0
- tuning-competition-baseline/.venv/lib/python3.11/site-packages/Cython/Includes/cpython/exc.pxd +263 -0
- tuning-competition-baseline/.venv/lib/python3.11/site-packages/Cython/Includes/cpython/float.pxd +46 -0
- tuning-competition-baseline/.venv/lib/python3.11/site-packages/Cython/Includes/cpython/function.pxd +65 -0
- tuning-competition-baseline/.venv/lib/python3.11/site-packages/Cython/Includes/cpython/int.pxd +89 -0
- tuning-competition-baseline/.venv/lib/python3.11/site-packages/Cython/Includes/cpython/iterobject.pxd +24 -0
- tuning-competition-baseline/.venv/lib/python3.11/site-packages/Cython/Includes/cpython/list.pxd +92 -0
- tuning-competition-baseline/.venv/lib/python3.11/site-packages/Cython/Includes/cpython/long.pxd +149 -0
- tuning-competition-baseline/.venv/lib/python3.11/site-packages/Cython/Includes/cpython/mem.pxd +120 -0
- tuning-competition-baseline/.venv/lib/python3.11/site-packages/Cython/Includes/cpython/memoryview.pxd +50 -0
- tuning-competition-baseline/.venv/lib/python3.11/site-packages/Cython/Includes/cpython/object.pxd +440 -0
- tuning-competition-baseline/.venv/lib/python3.11/site-packages/Cython/Includes/cpython/oldbuffer.pxd +63 -0
- tuning-competition-baseline/.venv/lib/python3.11/site-packages/Cython/Includes/cpython/pycapsule.pxd +143 -0
- tuning-competition-baseline/.venv/lib/python3.11/site-packages/Cython/Includes/cpython/pyport.pxd +8 -0
- tuning-competition-baseline/.venv/lib/python3.11/site-packages/Cython/Includes/cpython/pystate.pxd +95 -0
- tuning-competition-baseline/.venv/lib/python3.11/site-packages/Cython/Includes/cpython/sequence.pxd +134 -0
- tuning-competition-baseline/.venv/lib/python3.11/site-packages/Cython/Includes/cpython/type.pxd +53 -0
- tuning-competition-baseline/.venv/lib/python3.11/site-packages/Cython/Includes/cpython/version.pxd +32 -0
- tuning-competition-baseline/.venv/lib/python3.11/site-packages/Cython/Includes/libcpp/__init__.pxd +4 -0
- tuning-competition-baseline/.venv/lib/python3.11/site-packages/Cython/Includes/libcpp/algorithm.pxd +320 -0
- tuning-competition-baseline/.venv/lib/python3.11/site-packages/Cython/Includes/libcpp/any.pxd +16 -0
- tuning-competition-baseline/.venv/lib/python3.11/site-packages/Cython/Includes/libcpp/complex.pxd +106 -0
- tuning-competition-baseline/.venv/lib/python3.11/site-packages/Cython/Includes/libcpp/execution.pxd +15 -0
- tuning-competition-baseline/.venv/lib/python3.11/site-packages/Cython/Includes/libcpp/functional.pxd +26 -0
- tuning-competition-baseline/.venv/lib/python3.11/site-packages/Cython/Includes/libcpp/optional.pxd +34 -0
- tuning-competition-baseline/.venv/lib/python3.11/site-packages/Cython/Includes/libcpp/queue.pxd +25 -0
- tuning-competition-baseline/.venv/lib/python3.11/site-packages/Cython/Includes/libcpp/stack.pxd +11 -0
- tuning-competition-baseline/.venv/lib/python3.11/site-packages/Cython/Includes/libcpp/string.pxd +333 -0
- tuning-competition-baseline/.venv/lib/python3.11/site-packages/Cython/Includes/libcpp/unordered_set.pxd +152 -0
- tuning-competition-baseline/.venv/lib/python3.11/site-packages/Cython/Includes/numpy/__init__.pxd +1057 -0
- tuning-competition-baseline/.venv/lib/python3.11/site-packages/Cython/Includes/numpy/math.pxd +133 -0
- tuning-competition-baseline/.venv/lib/python3.11/site-packages/Cython/Includes/posix/dlfcn.pxd +14 -0
- tuning-competition-baseline/.venv/lib/python3.11/site-packages/Cython/Includes/posix/ioctl.pxd +4 -0
- tuning-competition-baseline/.venv/lib/python3.11/site-packages/Cython/Includes/posix/resource.pxd +57 -0
- tuning-competition-baseline/.venv/lib/python3.11/site-packages/Cython/Includes/posix/select.pxd +21 -0
- tuning-competition-baseline/.venv/lib/python3.11/site-packages/Cython/Includes/posix/stat.pxd +98 -0
- tuning-competition-baseline/.venv/lib/python3.11/site-packages/Cython/Includes/posix/strings.pxd +9 -0
- tuning-competition-baseline/.venv/lib/python3.11/site-packages/Cython/Includes/posix/uio.pxd +26 -0
- tuning-competition-baseline/.venv/lib/python3.11/site-packages/Cython/Includes/posix/unistd.pxd +271 -0
- tuning-competition-baseline/.venv/lib/python3.11/site-packages/Cython/Includes/posix/wait.pxd +38 -0
- tuning-competition-baseline/.venv/lib/python3.11/site-packages/networkx/algorithms/assortativity/neighbor_degree.py +160 -0
- tuning-competition-baseline/.venv/lib/python3.11/site-packages/networkx/algorithms/assortativity/tests/__pycache__/test_correlation.cpython-311.pyc +0 -0
- tuning-competition-baseline/.venv/lib/python3.11/site-packages/networkx/algorithms/coloring/__pycache__/__init__.cpython-311.pyc +0 -0
- tuning-competition-baseline/.venv/lib/python3.11/site-packages/networkx/algorithms/coloring/__pycache__/greedy_coloring.cpython-311.pyc +0 -0
- tuning-competition-baseline/.venv/lib/python3.11/site-packages/networkx/algorithms/coloring/equitable_coloring.py +505 -0
- tuning-competition-baseline/.venv/lib/python3.11/site-packages/networkx/algorithms/coloring/tests/__init__.py +0 -0
- tuning-competition-baseline/.venv/lib/python3.11/site-packages/networkx/algorithms/coloring/tests/__pycache__/__init__.cpython-311.pyc +0 -0
tuning-competition-baseline/.venv/lib/python3.11/site-packages/Cython/Includes/cpython/__init__.pxd
ADDED
|
@@ -0,0 +1,187 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#####################################################################
|
| 2 |
+
#
|
| 3 |
+
# These are the Cython pxd files for (most of) the Python/C API.
|
| 4 |
+
#
|
| 5 |
+
# REFERENCE COUNTING:
|
| 6 |
+
#
|
| 7 |
+
# JUST TO SCARE YOU:
|
| 8 |
+
# If you are going to use any of the Python/C API in your Cython
|
| 9 |
+
# program, you might be responsible for doing reference counting.
|
| 10 |
+
# Read http://docs.python.org/api/refcounts.html which is so
|
| 11 |
+
# important I've copied it below.
|
| 12 |
+
#
|
| 13 |
+
# For all the declaration below, whenever the Py_ function returns
|
| 14 |
+
# a *new reference* to a PyObject*, the return type is "object".
|
| 15 |
+
# When the function returns a borrowed reference, the return
|
| 16 |
+
# type is PyObject*. When Cython sees "object" as a return type
|
| 17 |
+
# it doesn't increment the reference count. When it sees PyObject*
|
| 18 |
+
# in order to use the result you must explicitly cast to <object>,
|
| 19 |
+
# and when you do that Cython increments the reference count whether
|
| 20 |
+
# you want it to or not, forcing you to an explicit DECREF (or leak memory).
|
| 21 |
+
# To avoid this we make the above convention. Note, you can
|
| 22 |
+
# always locally override this convention by putting something like
|
| 23 |
+
#
|
| 24 |
+
# cdef extern from "Python.h":
|
| 25 |
+
# PyObject* PyNumber_Add(PyObject *o1, PyObject *o2)
|
| 26 |
+
#
|
| 27 |
+
# in your .pyx file or into a cimported .pxd file. You just have to
|
| 28 |
+
# use the one from the right (pxd-)namespace then.
|
| 29 |
+
#
|
| 30 |
+
# Cython automatically takes care of reference counting for anything
|
| 31 |
+
# of type object.
|
| 32 |
+
#
|
| 33 |
+
## More precisely, I think the correct convention for
|
| 34 |
+
## using the Python/C API from Cython is as follows.
|
| 35 |
+
##
|
| 36 |
+
## (1) Declare all input arguments as type "object". This way no explicit
|
| 37 |
+
## <PyObject*> casting is needed, and moreover Cython doesn't generate
|
| 38 |
+
## any funny reference counting.
|
| 39 |
+
## (2) Declare output as object if a new reference is returned.
|
| 40 |
+
## (3) Declare output as PyObject* if a borrowed reference is returned.
|
| 41 |
+
##
|
| 42 |
+
## This way when you call objects, no cast is needed, and if the api
|
| 43 |
+
## calls returns a new reference (which is about 95% of them), then
|
| 44 |
+
## you can just assign to a variable of type object. With borrowed
|
| 45 |
+
## references if you do an explicit typecast to <object>, Cython generates an
|
| 46 |
+
## INCREF and DECREF so you have to be careful. However, you got a
|
| 47 |
+
## borrowed reference in this case, so there's got to be another reference
|
| 48 |
+
## to your object, so you're OK, as long as you relealize this
|
| 49 |
+
## and use the result of an explicit cast to <object> as a borrowed
|
| 50 |
+
## reference (and you can call Py_INCREF if you want to turn it
|
| 51 |
+
## into another reference for some reason).
|
| 52 |
+
#
|
| 53 |
+
# "The reference count is important because today's computers have
|
| 54 |
+
# a finite (and often severely limited) memory size; it counts how
|
| 55 |
+
# many different places there are that have a reference to an
|
| 56 |
+
# object. Such a place could be another object, or a global (or
|
| 57 |
+
# static) C variable, or a local variable in some C function. When
|
| 58 |
+
# an object's reference count becomes zero, the object is
|
| 59 |
+
# deallocated. If it contains references to other objects, their
|
| 60 |
+
# reference count is decremented. Those other objects may be
|
| 61 |
+
# deallocated in turn, if this decrement makes their reference
|
| 62 |
+
# count become zero, and so on. (There's an obvious problem with
|
| 63 |
+
# objects that reference each other here; for now, the solution is
|
| 64 |
+
# ``don't do that.'')
|
| 65 |
+
#
|
| 66 |
+
# Reference counts are always manipulated explicitly. The normal
|
| 67 |
+
# way is to use the macro Py_INCREF() to increment an object's
|
| 68 |
+
# reference count by one, and Py_DECREF() to decrement it by
|
| 69 |
+
# one. The Py_DECREF() macro is considerably more complex than the
|
| 70 |
+
# incref one, since it must check whether the reference count
|
| 71 |
+
# becomes zero and then cause the object's deallocator to be
|
| 72 |
+
# called. The deallocator is a function pointer contained in the
|
| 73 |
+
# object's type structure. The type-specific deallocator takes
|
| 74 |
+
# care of decrementing the reference counts for other objects
|
| 75 |
+
# contained in the object if this is a compound object type, such
|
| 76 |
+
# as a list, as well as performing any additional finalization
|
| 77 |
+
# that's needed. There's no chance that the reference count can
|
| 78 |
+
# overflow; at least as many bits are used to hold the reference
|
| 79 |
+
# count as there are distinct memory locations in virtual memory
|
| 80 |
+
# (assuming sizeof(long) >= sizeof(char*)). Thus, the reference
|
| 81 |
+
# count increment is a simple operation.
|
| 82 |
+
#
|
| 83 |
+
# It is not necessary to increment an object's reference count for
|
| 84 |
+
# every local variable that contains a pointer to an object. In
|
| 85 |
+
# theory, the object's reference count goes up by one when the
|
| 86 |
+
# variable is made to point to it and it goes down by one when the
|
| 87 |
+
# variable goes out of scope. However, these two cancel each other
|
| 88 |
+
# out, so at the end the reference count hasn't changed. The only
|
| 89 |
+
# real reason to use the reference count is to prevent the object
|
| 90 |
+
# from being deallocated as long as our variable is pointing to
|
| 91 |
+
# it. If we know that there is at least one other reference to the
|
| 92 |
+
# object that lives at least as long as our variable, there is no
|
| 93 |
+
# need to increment the reference count temporarily. An important
|
| 94 |
+
# situation where this arises is in objects that are passed as
|
| 95 |
+
# arguments to C functions in an extension module that are called
|
| 96 |
+
# from Python; the call mechanism guarantees to hold a reference
|
| 97 |
+
# to every argument for the duration of the call.
|
| 98 |
+
#
|
| 99 |
+
# However, a common pitfall is to extract an object from a list
|
| 100 |
+
# and hold on to it for a while without incrementing its reference
|
| 101 |
+
# count. Some other operation might conceivably remove the object
|
| 102 |
+
# from the list, decrementing its reference count and possible
|
| 103 |
+
# deallocating it. The real danger is that innocent-looking
|
| 104 |
+
# operations may invoke arbitrary Python code which could do this;
|
| 105 |
+
# there is a code path which allows control to flow back to the
|
| 106 |
+
# user from a Py_DECREF(), so almost any operation is potentially
|
| 107 |
+
# dangerous.
|
| 108 |
+
#
|
| 109 |
+
# A safe approach is to always use the generic operations
|
| 110 |
+
# (functions whose name begins with "PyObject_", "PyNumber_",
|
| 111 |
+
# "PySequence_" or "PyMapping_"). These operations always
|
| 112 |
+
# increment the reference count of the object they return. This
|
| 113 |
+
# leaves the caller with the responsibility to call Py_DECREF()
|
| 114 |
+
# when they are done with the result; this soon becomes second
|
| 115 |
+
# nature.
|
| 116 |
+
#
|
| 117 |
+
# Now you should read http://docs.python.org/api/refcountDetails.html
|
| 118 |
+
# just to be sure you understand what is going on.
|
| 119 |
+
#
|
| 120 |
+
#################################################################
|
| 121 |
+
|
| 122 |
+
|
| 123 |
+
|
| 124 |
+
#################################################################
|
| 125 |
+
# BIG FAT DEPRECATION WARNING
|
| 126 |
+
#################################################################
|
| 127 |
+
# Do NOT cimport any names directly from the cpython package,
|
| 128 |
+
# despite of the star-imports below. They will be removed at
|
| 129 |
+
# some point.
|
| 130 |
+
# Instead, use the correct sub-module to draw your cimports from.
|
| 131 |
+
#
|
| 132 |
+
# A direct cimport from the package will make your code depend on
|
| 133 |
+
# all of the existing declarations. This may have side-effects
|
| 134 |
+
# and reduces the portability of your code.
|
| 135 |
+
#################################################################
|
| 136 |
+
# START OF DEPRECATED SECTION
|
| 137 |
+
#################################################################
|
| 138 |
+
|
| 139 |
+
from cpython.version cimport *
|
| 140 |
+
from cpython.ref cimport *
|
| 141 |
+
from cpython.exc cimport *
|
| 142 |
+
from cpython.module cimport *
|
| 143 |
+
from cpython.mem cimport *
|
| 144 |
+
from cpython.tuple cimport *
|
| 145 |
+
from cpython.list cimport *
|
| 146 |
+
from cpython.object cimport *
|
| 147 |
+
from cpython.sequence cimport *
|
| 148 |
+
from cpython.mapping cimport *
|
| 149 |
+
from cpython.iterator cimport *
|
| 150 |
+
from cpython.type cimport *
|
| 151 |
+
from cpython.number cimport *
|
| 152 |
+
from cpython.int cimport *
|
| 153 |
+
from cpython.bool cimport *
|
| 154 |
+
from cpython.long cimport *
|
| 155 |
+
from cpython.float cimport *
|
| 156 |
+
from cpython.complex cimport *
|
| 157 |
+
from cpython.string cimport *
|
| 158 |
+
from cpython.unicode cimport *
|
| 159 |
+
from cpython.dict cimport *
|
| 160 |
+
from cpython.instance cimport *
|
| 161 |
+
from cpython.function cimport *
|
| 162 |
+
from cpython.method cimport *
|
| 163 |
+
from cpython.weakref cimport *
|
| 164 |
+
from cpython.getargs cimport *
|
| 165 |
+
from cpython.pythread cimport *
|
| 166 |
+
from cpython.pystate cimport *
|
| 167 |
+
|
| 168 |
+
# Python <= 2.x
|
| 169 |
+
from cpython.cobject cimport *
|
| 170 |
+
from cpython.oldbuffer cimport *
|
| 171 |
+
|
| 172 |
+
# Python >= 2.4
|
| 173 |
+
from cpython.set cimport *
|
| 174 |
+
|
| 175 |
+
# Python >= 2.6
|
| 176 |
+
from cpython.buffer cimport *
|
| 177 |
+
from cpython.bytes cimport *
|
| 178 |
+
|
| 179 |
+
# Python >= 3.0
|
| 180 |
+
from cpython.pycapsule cimport *
|
| 181 |
+
|
| 182 |
+
# Python >= 3.7
|
| 183 |
+
from cpython.contextvars cimport *
|
| 184 |
+
|
| 185 |
+
#################################################################
|
| 186 |
+
# END OF DEPRECATED SECTION
|
| 187 |
+
#################################################################
|
tuning-competition-baseline/.venv/lib/python3.11/site-packages/Cython/Includes/cpython/array.pxd
ADDED
|
@@ -0,0 +1,174 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
array.pxd
|
| 3 |
+
|
| 4 |
+
Cython interface to Python's array.array module.
|
| 5 |
+
|
| 6 |
+
* 1D contiguous data view
|
| 7 |
+
* tools for fast array creation, maximum C-speed and handiness
|
| 8 |
+
* suitable as allround light weight auto-array within Cython code too
|
| 9 |
+
|
| 10 |
+
Usage:
|
| 11 |
+
|
| 12 |
+
>>> cimport array
|
| 13 |
+
|
| 14 |
+
Usage through Cython buffer interface (Py2.3+):
|
| 15 |
+
|
| 16 |
+
>>> def f(arg1, unsigned i, double dx)
|
| 17 |
+
... array.array[double] a = arg1
|
| 18 |
+
... a[i] += dx
|
| 19 |
+
|
| 20 |
+
Fast C-level new_array(_zeros), resize_array, copy_array, Py_SIZE(obj),
|
| 21 |
+
zero_array
|
| 22 |
+
|
| 23 |
+
cdef array.array[double] k = array.copy(d)
|
| 24 |
+
cdef array.array[double] n = array.array(d, Py_SIZE(d) * 2 )
|
| 25 |
+
cdef array.array[double] m = array.zeros_like(FLOAT_TEMPLATE)
|
| 26 |
+
array.resize(f, 200000)
|
| 27 |
+
|
| 28 |
+
Zero overhead with naked data pointer views by union:
|
| 29 |
+
_f, _d, _i, _c, _u, ...
|
| 30 |
+
=> Original C array speed + Python dynamic memory management
|
| 31 |
+
|
| 32 |
+
cdef array.array a = inarray
|
| 33 |
+
if
|
| 34 |
+
a._d[2] += 0.66 # use as double array without extra casting
|
| 35 |
+
|
| 36 |
+
float *subview = vector._f + 10 # starting from 10th element
|
| 37 |
+
unsigned char *subview_buffer = vector._B + 4
|
| 38 |
+
|
| 39 |
+
Suitable as lightweight arrays intra Cython without speed penalty.
|
| 40 |
+
Replacement for C stack/malloc arrays; no trouble with refcounting,
|
| 41 |
+
mem.leaks; seamless Python compatibility, buffer() optional
|
| 42 |
+
|
| 43 |
+
|
| 44 |
+
last changes: 2009-05-15 rk
|
| 45 |
+
: 2009-12-06 bp
|
| 46 |
+
: 2012-05-02 andreasvc
|
| 47 |
+
: (see revision control)
|
| 48 |
+
"""
|
| 49 |
+
|
| 50 |
+
cdef extern from *:
|
| 51 |
+
"""
|
| 52 |
+
#if CYTHON_COMPILING_IN_PYPY
|
| 53 |
+
#ifdef _MSC_VER
|
| 54 |
+
#pragma message ("This module uses CPython specific internals of 'array.array', which are not available in PyPy.")
|
| 55 |
+
#else
|
| 56 |
+
#warning This module uses CPython specific internals of 'array.array', which are not available in PyPy.
|
| 57 |
+
#endif
|
| 58 |
+
#endif
|
| 59 |
+
"""
|
| 60 |
+
|
| 61 |
+
from libc.string cimport memset, memcpy
|
| 62 |
+
|
| 63 |
+
from cpython.object cimport Py_SIZE
|
| 64 |
+
from cpython.ref cimport PyTypeObject, Py_TYPE
|
| 65 |
+
from cpython.exc cimport PyErr_BadArgument
|
| 66 |
+
from cpython.mem cimport PyObject_Malloc, PyObject_Free
|
| 67 |
+
|
| 68 |
+
cdef extern from *: # Hard-coded utility code hack.
|
| 69 |
+
ctypedef class array.array [object arrayobject]
|
| 70 |
+
ctypedef object GETF(array a, Py_ssize_t ix)
|
| 71 |
+
ctypedef object SETF(array a, Py_ssize_t ix, object o)
|
| 72 |
+
ctypedef struct arraydescr: # [object arraydescr]:
|
| 73 |
+
char typecode
|
| 74 |
+
int itemsize
|
| 75 |
+
GETF getitem # PyObject * (*getitem)(struct arrayobject *, Py_ssize_t);
|
| 76 |
+
SETF setitem # int (*setitem)(struct arrayobject *, Py_ssize_t, PyObject *);
|
| 77 |
+
|
| 78 |
+
ctypedef union __data_union:
|
| 79 |
+
# views of ob_item:
|
| 80 |
+
float* as_floats # direct float pointer access to buffer
|
| 81 |
+
double* as_doubles # double ...
|
| 82 |
+
int* as_ints
|
| 83 |
+
unsigned int *as_uints
|
| 84 |
+
unsigned char *as_uchars
|
| 85 |
+
signed char *as_schars
|
| 86 |
+
char *as_chars
|
| 87 |
+
unsigned long *as_ulongs
|
| 88 |
+
long *as_longs
|
| 89 |
+
unsigned long long *as_ulonglongs
|
| 90 |
+
long long *as_longlongs
|
| 91 |
+
short *as_shorts
|
| 92 |
+
unsigned short *as_ushorts
|
| 93 |
+
Py_UNICODE *as_pyunicodes
|
| 94 |
+
void *as_voidptr
|
| 95 |
+
|
| 96 |
+
ctypedef class array.array [object arrayobject]:
|
| 97 |
+
cdef __cythonbufferdefaults__ = {'ndim' : 1, 'mode':'c'}
|
| 98 |
+
|
| 99 |
+
cdef:
|
| 100 |
+
Py_ssize_t ob_size
|
| 101 |
+
arraydescr* ob_descr # struct arraydescr *ob_descr;
|
| 102 |
+
__data_union data
|
| 103 |
+
|
| 104 |
+
def __getbuffer__(self, Py_buffer* info, int flags):
|
| 105 |
+
# This implementation of getbuffer is geared towards Cython
|
| 106 |
+
# requirements, and does not yet fulfill the PEP.
|
| 107 |
+
# In particular strided access is always provided regardless
|
| 108 |
+
# of flags
|
| 109 |
+
item_count = Py_SIZE(self)
|
| 110 |
+
|
| 111 |
+
info.suboffsets = NULL
|
| 112 |
+
info.buf = self.data.as_chars
|
| 113 |
+
info.readonly = 0
|
| 114 |
+
info.ndim = 1
|
| 115 |
+
info.itemsize = self.ob_descr.itemsize # e.g. sizeof(float)
|
| 116 |
+
info.len = info.itemsize * item_count
|
| 117 |
+
|
| 118 |
+
info.shape = <Py_ssize_t*> PyObject_Malloc(sizeof(Py_ssize_t) + 2)
|
| 119 |
+
if not info.shape:
|
| 120 |
+
raise MemoryError()
|
| 121 |
+
info.shape[0] = item_count # constant regardless of resizing
|
| 122 |
+
info.strides = &info.itemsize
|
| 123 |
+
|
| 124 |
+
info.format = <char*> (info.shape + 1)
|
| 125 |
+
info.format[0] = self.ob_descr.typecode
|
| 126 |
+
info.format[1] = 0
|
| 127 |
+
info.obj = self
|
| 128 |
+
|
| 129 |
+
def __releasebuffer__(self, Py_buffer* info):
|
| 130 |
+
PyObject_Free(info.shape)
|
| 131 |
+
|
| 132 |
+
array newarrayobject(PyTypeObject* type, Py_ssize_t size, arraydescr *descr)
|
| 133 |
+
|
| 134 |
+
# fast resize/realloc
|
| 135 |
+
# not suitable for small increments; reallocation 'to the point'
|
| 136 |
+
int resize(array self, Py_ssize_t n) except -1
|
| 137 |
+
# efficient for small increments (not in Py2.3-)
|
| 138 |
+
int resize_smart(array self, Py_ssize_t n) except -1
|
| 139 |
+
|
| 140 |
+
|
| 141 |
+
cdef inline array clone(array template, Py_ssize_t length, bint zero):
|
| 142 |
+
""" fast creation of a new array, given a template array.
|
| 143 |
+
type will be same as template.
|
| 144 |
+
if zero is true, new array will be initialized with zeroes."""
|
| 145 |
+
cdef array op = newarrayobject(Py_TYPE(template), length, template.ob_descr)
|
| 146 |
+
if zero and op is not None:
|
| 147 |
+
memset(op.data.as_chars, 0, length * op.ob_descr.itemsize)
|
| 148 |
+
return op
|
| 149 |
+
|
| 150 |
+
cdef inline array copy(array self):
|
| 151 |
+
""" make a copy of an array. """
|
| 152 |
+
cdef array op = newarrayobject(Py_TYPE(self), Py_SIZE(self), self.ob_descr)
|
| 153 |
+
memcpy(op.data.as_chars, self.data.as_chars, Py_SIZE(op) * op.ob_descr.itemsize)
|
| 154 |
+
return op
|
| 155 |
+
|
| 156 |
+
cdef inline int extend_buffer(array self, char* stuff, Py_ssize_t n) except -1:
|
| 157 |
+
""" efficient appending of new stuff of same type
|
| 158 |
+
(e.g. of same array type)
|
| 159 |
+
n: number of elements (not number of bytes!) """
|
| 160 |
+
cdef Py_ssize_t itemsize = self.ob_descr.itemsize
|
| 161 |
+
cdef Py_ssize_t origsize = Py_SIZE(self)
|
| 162 |
+
resize_smart(self, origsize + n)
|
| 163 |
+
memcpy(self.data.as_chars + origsize * itemsize, stuff, n * itemsize)
|
| 164 |
+
return 0
|
| 165 |
+
|
| 166 |
+
cdef inline int extend(array self, array other) except -1:
|
| 167 |
+
""" extend array with data from another array; types must match. """
|
| 168 |
+
if self.ob_descr.typecode != other.ob_descr.typecode:
|
| 169 |
+
PyErr_BadArgument()
|
| 170 |
+
return extend_buffer(self, other.data.as_chars, Py_SIZE(other))
|
| 171 |
+
|
| 172 |
+
cdef inline void zero(array self) noexcept:
|
| 173 |
+
""" set all elements of array to zero. """
|
| 174 |
+
memset(self.data.as_chars, 0, Py_SIZE(self) * self.ob_descr.itemsize)
|
tuning-competition-baseline/.venv/lib/python3.11/site-packages/Cython/Includes/cpython/cellobject.pxd
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from .object cimport PyObject
|
| 2 |
+
|
| 3 |
+
cdef extern from "Python.h":
|
| 4 |
+
|
| 5 |
+
############################################################################
|
| 6 |
+
# Cell Objects
|
| 7 |
+
############################################################################
|
| 8 |
+
|
| 9 |
+
bint PyCell_Check(object ob)
|
| 10 |
+
# Return true if ob is a cell object; ob must not be NULL.
|
| 11 |
+
|
| 12 |
+
object PyCell_New(PyObject* ob)
|
| 13 |
+
# Return value: New reference.
|
| 14 |
+
# Create and return a new cell object containing the value ob. The
|
| 15 |
+
# parameter may be NULL.
|
| 16 |
+
|
| 17 |
+
object PyCell_Get(object cell)
|
| 18 |
+
# Return value: New reference.
|
| 19 |
+
# Return the contents of the cell object cell.
|
| 20 |
+
|
| 21 |
+
object PyCell_GET(object cell)
|
| 22 |
+
# Return value: Borrowed reference.
|
| 23 |
+
# Return the contents of the cell object cell, but without checking that
|
| 24 |
+
# cell is non-NULL and is a cell object.
|
| 25 |
+
|
| 26 |
+
int PyCell_Set(object cell, PyObject* value) except? -1
|
| 27 |
+
# Set the contents of the cell object cell to value. This releases the
|
| 28 |
+
# reference to any current content of the cell. value may be NULL. cell
|
| 29 |
+
# must be non-NULL; if it is not a cell object, -1 will be returned. On
|
| 30 |
+
# success, 0 will be returned.
|
| 31 |
+
|
| 32 |
+
void PyCell_SET(object cell, PyObject* value)
|
| 33 |
+
# Sets the value of the cell object cell to value. No reference counts are
|
| 34 |
+
# adjusted, and no checks are made for safety; cell must be non-NULL and
|
| 35 |
+
# must be a cell object.
|
tuning-competition-baseline/.venv/lib/python3.11/site-packages/Cython/Includes/cpython/complex.pxd
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
cdef extern from "Python.h":
|
| 3 |
+
|
| 4 |
+
ctypedef struct Py_complex:
|
| 5 |
+
double imag
|
| 6 |
+
double real
|
| 7 |
+
|
| 8 |
+
############################################################################
|
| 9 |
+
# 7.2.5.2 Complex Numbers as Python Objects
|
| 10 |
+
############################################################################
|
| 11 |
+
|
| 12 |
+
# PyComplexObject
|
| 13 |
+
# This subtype of PyObject represents a Python complex number object.
|
| 14 |
+
|
| 15 |
+
ctypedef class __builtin__.complex [object PyComplexObject]:
|
| 16 |
+
cdef Py_complex cval
|
| 17 |
+
|
| 18 |
+
@property
|
| 19 |
+
cdef inline double real(self) noexcept:
|
| 20 |
+
return self.cval.real
|
| 21 |
+
|
| 22 |
+
@property
|
| 23 |
+
cdef inline double imag(self) noexcept:
|
| 24 |
+
return self.cval.imag
|
| 25 |
+
|
| 26 |
+
# PyTypeObject PyComplex_Type
|
| 27 |
+
# This instance of PyTypeObject represents the Python complex
|
| 28 |
+
# number type. It is the same object as complex and
|
| 29 |
+
# types.ComplexType.
|
| 30 |
+
|
| 31 |
+
bint PyComplex_Check(object p)
|
| 32 |
+
# Return true if its argument is a PyComplexObject or a subtype of
|
| 33 |
+
# PyComplexObject.
|
| 34 |
+
|
| 35 |
+
bint PyComplex_CheckExact(object p)
|
| 36 |
+
# Return true if its argument is a PyComplexObject, but not a subtype of PyComplexObject.
|
| 37 |
+
|
| 38 |
+
object PyComplex_FromCComplex(Py_complex v)
|
| 39 |
+
# Return value: New reference.
|
| 40 |
+
# Create a new Python complex number object from a C Py_complex value.
|
| 41 |
+
|
| 42 |
+
object PyComplex_FromDoubles(double real, double imag)
|
| 43 |
+
# Return value: New reference.
|
| 44 |
+
# Return a new PyComplexObject object from real and imag.
|
| 45 |
+
|
| 46 |
+
double PyComplex_RealAsDouble(object op) except? -1
|
| 47 |
+
# Return the real part of op as a C double.
|
| 48 |
+
|
| 49 |
+
double PyComplex_ImagAsDouble(object op) except? -1
|
| 50 |
+
# Return the imaginary part of op as a C double.
|
| 51 |
+
|
| 52 |
+
Py_complex PyComplex_AsCComplex(object op)
|
| 53 |
+
# Return the Py_complex value of the complex number op.
|
| 54 |
+
#
|
| 55 |
+
# Returns (-1+0i) in case of an error
|
tuning-competition-baseline/.venv/lib/python3.11/site-packages/Cython/Includes/cpython/exc.pxd
ADDED
|
@@ -0,0 +1,263 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from .object cimport PyObject
|
| 2 |
+
|
| 3 |
+
cdef extern from "Python.h":
|
| 4 |
+
|
| 5 |
+
#####################################################################
|
| 6 |
+
# 3. Exception Handling
|
| 7 |
+
#####################################################################
|
| 8 |
+
|
| 9 |
+
# The functions described in this chapter will let you handle and
|
| 10 |
+
# raise Python exceptions. It is important to understand some of
|
| 11 |
+
# the basics of Python exception handling. It works somewhat like
|
| 12 |
+
# the Unix errno variable: there is a global indicator (per
|
| 13 |
+
# thread) of the last error that occurred. Most functions don't
|
| 14 |
+
# clear this on success, but will set it to indicate the cause of
|
| 15 |
+
# the error on failure. Most functions also return an error
|
| 16 |
+
# indicator, usually NULL if they are supposed to return a
|
| 17 |
+
# pointer, or -1 if they return an integer (exception: the
|
| 18 |
+
# PyArg_*() functions return 1 for success and 0 for failure).
|
| 19 |
+
|
| 20 |
+
# When a function must fail because some function it called
|
| 21 |
+
# failed, it generally doesn't set the error indicator; the
|
| 22 |
+
# function it called already set it. It is responsible for either
|
| 23 |
+
# handling the error and clearing the exception or returning after
|
| 24 |
+
# cleaning up any resources it holds (such as object references or
|
| 25 |
+
# memory allocations); it should not continue normally if it is
|
| 26 |
+
# not prepared to handle the error. If returning due to an error,
|
| 27 |
+
# it is important to indicate to the caller that an error has been
|
| 28 |
+
# set. If the error is not handled or carefully propagated,
|
| 29 |
+
# additional calls into the Python/C API may not behave as
|
| 30 |
+
# intended and may fail in mysterious ways.
|
| 31 |
+
|
| 32 |
+
# The error indicator consists of three Python objects
|
| 33 |
+
# corresponding to the Python variables sys.exc_type,
|
| 34 |
+
# sys.exc_value and sys.exc_traceback. API functions exist to
|
| 35 |
+
# interact with the error indicator in various ways. There is a
|
| 36 |
+
# separate error indicator for each thread.
|
| 37 |
+
|
| 38 |
+
void PyErr_Print()
|
| 39 |
+
# Print a standard traceback to sys.stderr and clear the error
|
| 40 |
+
# indicator. Call this function only when the error indicator is
|
| 41 |
+
# set. (Otherwise it will cause a fatal error!)
|
| 42 |
+
|
| 43 |
+
PyObject* PyErr_Occurred()
|
| 44 |
+
# Return value: Borrowed reference.
|
| 45 |
+
# Test whether the error indicator is set. If set, return the
|
| 46 |
+
# exception type (the first argument to the last call to one of
|
| 47 |
+
# the PyErr_Set*() functions or to PyErr_Restore()). If not set,
|
| 48 |
+
# return NULL. You do not own a reference to the return value, so
|
| 49 |
+
# you do not need to Py_DECREF() it. Note: Do not compare the
|
| 50 |
+
# return value to a specific exception; use
|
| 51 |
+
# PyErr_ExceptionMatches() instead, shown below. (The comparison
|
| 52 |
+
# could easily fail since the exception may be an instance instead
|
| 53 |
+
# of a class, in the case of a class exception, or it may be a
|
| 54 |
+
# subclass of the expected exception.)
|
| 55 |
+
|
| 56 |
+
bint PyErr_ExceptionMatches(object exc)
|
| 57 |
+
# Equivalent to "PyErr_GivenExceptionMatches(PyErr_Occurred(),
|
| 58 |
+
# exc)". This should only be called when an exception is actually
|
| 59 |
+
# set; a memory access violation will occur if no exception has
|
| 60 |
+
# been raised.
|
| 61 |
+
|
| 62 |
+
bint PyErr_GivenExceptionMatches(object given, object exc)
|
| 63 |
+
# Return true if the given exception matches the exception in
|
| 64 |
+
# exc. If exc is a class object, this also returns true when given
|
| 65 |
+
# is an instance of a subclass. If exc is a tuple, all exceptions
|
| 66 |
+
# in the tuple (and recursively in subtuples) are searched for a
|
| 67 |
+
# match. If given is NULL, a memory access violation will occur.
|
| 68 |
+
|
| 69 |
+
void PyErr_NormalizeException(PyObject** exc, PyObject** val, PyObject** tb)
|
| 70 |
+
# Under certain circumstances, the values returned by
|
| 71 |
+
# PyErr_Fetch() below can be ``unnormalized'', meaning that *exc
|
| 72 |
+
# is a class object but *val is not an instance of the same
|
| 73 |
+
# class. This function can be used to instantiate the class in
|
| 74 |
+
# that case. If the values are already normalized, nothing
|
| 75 |
+
# happens. The delayed normalization is implemented to improve
|
| 76 |
+
# performance.
|
| 77 |
+
|
| 78 |
+
void PyErr_Clear()
|
| 79 |
+
# Clear the error indicator. If the error indicator is not set, there is no effect.
|
| 80 |
+
|
| 81 |
+
void PyErr_Fetch(PyObject** ptype, PyObject** pvalue, PyObject** ptraceback)
|
| 82 |
+
# Retrieve the error indicator into three variables whose
|
| 83 |
+
# addresses are passed. If the error indicator is not set, set all
|
| 84 |
+
# three variables to NULL. If it is set, it will be cleared and
|
| 85 |
+
# you own a reference to each object retrieved. The value and
|
| 86 |
+
# traceback object may be NULL even when the type object is
|
| 87 |
+
# not. Note: This function is normally only used by code that
|
| 88 |
+
# needs to handle exceptions or by code that needs to save and
|
| 89 |
+
# restore the error indicator temporarily.
|
| 90 |
+
|
| 91 |
+
PyObject* PyErr_GetHandledException()
|
| 92 |
+
void PyErr_SetHandledException(PyObject* exc)
|
| 93 |
+
PyObject* PyErr_GetRaisedException()
|
| 94 |
+
void PyErr_SetRaisedException(PyObject* exc)
|
| 95 |
+
|
| 96 |
+
void PyErr_Restore(PyObject* type, PyObject* value, PyObject* traceback)
|
| 97 |
+
# Set the error indicator from the three objects. If the error
|
| 98 |
+
# indicator is already set, it is cleared first. If the objects
|
| 99 |
+
# are NULL, the error indicator is cleared. Do not pass a NULL
|
| 100 |
+
# type and non-NULL value or traceback. The exception type should
|
| 101 |
+
# be a class. Do not pass an invalid exception type or
|
| 102 |
+
# value. (Violating these rules will cause subtle problems later.)
|
| 103 |
+
# This call takes away a reference to each object: you must own a
|
| 104 |
+
# reference to each object before the call and after the call you
|
| 105 |
+
# no longer own these references. (If you don't understand this,
|
| 106 |
+
# don't use this function. I warned you.) Note: This function is
|
| 107 |
+
# normally only used by code that needs to save and restore the
|
| 108 |
+
# error indicator temporarily; use PyErr_Fetch() to save the
|
| 109 |
+
# current exception state.
|
| 110 |
+
|
| 111 |
+
void PyErr_SetString(object type, char *message)
|
| 112 |
+
# This is the most common way to set the error indicator. The
|
| 113 |
+
# first argument specifies the exception type; it is normally one
|
| 114 |
+
# of the standard exceptions, e.g. PyExc_RuntimeError. You need
|
| 115 |
+
# not increment its reference count. The second argument is an
|
| 116 |
+
# error message; it is converted to a string object.
|
| 117 |
+
|
| 118 |
+
void PyErr_SetObject(object type, object value)
|
| 119 |
+
# This function is similar to PyErr_SetString() but lets you
|
| 120 |
+
# specify an arbitrary Python object for the ``value'' of the
|
| 121 |
+
# exception.
|
| 122 |
+
|
| 123 |
+
PyObject* PyErr_Format(object exception, char *format, ...) except NULL
|
| 124 |
+
# Return value: Always NULL.
|
| 125 |
+
# This function sets the error indicator and returns
|
| 126 |
+
# NULL. exception should be a Python exception (class, not an
|
| 127 |
+
# instance). format should be a string, containing format codes,
|
| 128 |
+
# similar to printf(). The width.precision before a format code is
|
| 129 |
+
# parsed, but the width part is ignored.
|
| 130 |
+
|
| 131 |
+
void PyErr_SetNone(object type)
|
| 132 |
+
# This is a shorthand for "PyErr_SetObject(type, Py_None)".
|
| 133 |
+
|
| 134 |
+
int PyErr_BadArgument() except 0
|
| 135 |
+
|
| 136 |
+
# This is a shorthand for "PyErr_SetString(PyExc_TypeError,
|
| 137 |
+
# message)", where message indicates that a built-in operation was
|
| 138 |
+
# invoked with an illegal argument. It is mostly for internal use.
|
| 139 |
+
|
| 140 |
+
PyObject* PyErr_NoMemory() except NULL
|
| 141 |
+
# Return value: Always NULL.
|
| 142 |
+
# This is a shorthand for "PyErr_SetNone(PyExc_MemoryError)"; it
|
| 143 |
+
# returns NULL so an object allocation function can write "return
|
| 144 |
+
# PyErr_NoMemory();" when it runs out of memory.
|
| 145 |
+
|
| 146 |
+
PyObject* PyErr_SetFromErrno(object type) except NULL
|
| 147 |
+
# Return value: Always NULL.
|
| 148 |
+
# This is a convenience function to raise an exception when a C
|
| 149 |
+
# library function has returned an error and set the C variable
|
| 150 |
+
# errno. It constructs a tuple object whose first item is the
|
| 151 |
+
# integer errno value and whose second item is the corresponding
|
| 152 |
+
# error message (gotten from strerror()), and then calls
|
| 153 |
+
# "PyErr_SetObject(type, object)". On Unix, when the errno value
|
| 154 |
+
# is EINTR, indicating an interrupted system call, this calls
|
| 155 |
+
# PyErr_CheckSignals(), and if that set the error indicator,
|
| 156 |
+
# leaves it set to that. The function always returns NULL, so a
|
| 157 |
+
# wrapper function around a system call can write "return
|
| 158 |
+
# PyErr_SetFromErrno(type);" when the system call returns an
|
| 159 |
+
# error.
|
| 160 |
+
|
| 161 |
+
PyObject* PyErr_SetFromErrnoWithFilenameObject(object type, object filenameObject) except NULL
|
| 162 |
+
# Similar to PyErr_SetFromErrno(), with the additional behavior
|
| 163 |
+
# that if filenameObject is not NULL, it is passed to the
|
| 164 |
+
# constructor of type as a third parameter.
|
| 165 |
+
# In the case of OSError exception, this is used to define
|
| 166 |
+
# the filename attribute of the exception instance.
|
| 167 |
+
|
| 168 |
+
PyObject* PyErr_SetFromErrnoWithFilename(object type, char *filename) except NULL
|
| 169 |
+
# Return value: Always NULL. Similar to PyErr_SetFromErrno(),
|
| 170 |
+
# with the additional behavior that if filename is not NULL, it is
|
| 171 |
+
# passed to the constructor of type as a third parameter. In the
|
| 172 |
+
# case of exceptions such as IOError and OSError, this is used to
|
| 173 |
+
# define the filename attribute of the exception instance.
|
| 174 |
+
|
| 175 |
+
PyObject* PyErr_SetFromWindowsErr(int ierr) except NULL
|
| 176 |
+
# Return value: Always NULL. This is a convenience function to
|
| 177 |
+
# raise WindowsError. If called with ierr of 0, the error code
|
| 178 |
+
# returned by a call to GetLastError() is used instead. It calls
|
| 179 |
+
# the Win32 function FormatMessage() to retrieve the Windows
|
| 180 |
+
# description of error code given by ierr or GetLastError(), then
|
| 181 |
+
# it constructs a tuple object whose first item is the ierr value
|
| 182 |
+
# and whose second item is the corresponding error message (gotten
|
| 183 |
+
# from FormatMessage()), and then calls
|
| 184 |
+
# "PyErr_SetObject(PyExc_WindowsError, object)". This function
|
| 185 |
+
# always returns NULL. Availability: Windows.
|
| 186 |
+
|
| 187 |
+
PyObject* PyErr_SetExcFromWindowsErr(object type, int ierr) except NULL
|
| 188 |
+
# Return value: Always NULL. Similar to
|
| 189 |
+
# PyErr_SetFromWindowsErr(), with an additional parameter
|
| 190 |
+
# specifying the exception type to be raised. Availability:
|
| 191 |
+
# Windows. New in version 2.3.
|
| 192 |
+
|
| 193 |
+
PyObject* PyErr_SetFromWindowsErrWithFilename(int ierr, char *filename) except NULL
|
| 194 |
+
# Return value: Always NULL. Similar to
|
| 195 |
+
# PyErr_SetFromWindowsErr(), with the additional behavior that if
|
| 196 |
+
# filename is not NULL, it is passed to the constructor of
|
| 197 |
+
# WindowsError as a third parameter. Availability: Windows.
|
| 198 |
+
|
| 199 |
+
PyObject* PyErr_SetExcFromWindowsErrWithFilename(object type, int ierr, char *filename) except NULL
|
| 200 |
+
# Return value: Always NULL.
|
| 201 |
+
# Similar to PyErr_SetFromWindowsErrWithFilename(), with an
|
| 202 |
+
# additional parameter specifying the exception type to be
|
| 203 |
+
# raised. Availability: Windows.
|
| 204 |
+
|
| 205 |
+
void PyErr_BadInternalCall()
|
| 206 |
+
# This is a shorthand for "PyErr_SetString(PyExc_TypeError,
|
| 207 |
+
# message)", where message indicates that an internal operation
|
| 208 |
+
# (e.g. a Python/C API function) was invoked with an illegal
|
| 209 |
+
# argument. It is mostly for internal use.
|
| 210 |
+
|
| 211 |
+
int PyErr_WarnEx(object category, char *message, int stacklevel) except -1
|
| 212 |
+
# Issue a warning message. The category argument is a warning
|
| 213 |
+
# category (see below) or NULL; the message argument is a message
|
| 214 |
+
# string. stacklevel is a positive number giving a number of stack
|
| 215 |
+
# frames; the warning will be issued from the currently executing
|
| 216 |
+
# line of code in that stack frame. A stacklevel of 1 is the
|
| 217 |
+
# function calling PyErr_WarnEx(), 2 is the function above that,
|
| 218 |
+
# and so forth.
|
| 219 |
+
|
| 220 |
+
int PyErr_WarnExplicit(object category, char *message, char *filename, int lineno, char *module, object registry) except -1
|
| 221 |
+
# Issue a warning message with explicit control over all warning
|
| 222 |
+
# attributes. This is a straightforward wrapper around the Python
|
| 223 |
+
# function warnings.warn_explicit(), see there for more
|
| 224 |
+
# information. The module and registry arguments may be set to
|
| 225 |
+
# NULL to get the default effect described there.
|
| 226 |
+
|
| 227 |
+
int PyErr_CheckSignals() except -1
|
| 228 |
+
# This function interacts with Python's signal handling. It checks
|
| 229 |
+
# whether a signal has been sent to the processes and if so,
|
| 230 |
+
# invokes the corresponding signal handler. If the signal module
|
| 231 |
+
# is supported, this can invoke a signal handler written in
|
| 232 |
+
# Python. In all cases, the default effect for SIGINT is to raise
|
| 233 |
+
# the KeyboardInterrupt exception. If an exception is raised the
|
| 234 |
+
# error indicator is set and the function returns 1; otherwise the
|
| 235 |
+
# function returns 0. The error indicator may or may not be
|
| 236 |
+
# cleared if it was previously set.
|
| 237 |
+
|
| 238 |
+
void PyErr_SetInterrupt() nogil
|
| 239 |
+
# This function simulates the effect of a SIGINT signal arriving
|
| 240 |
+
# -- the next time PyErr_CheckSignals() is called,
|
| 241 |
+
# KeyboardInterrupt will be raised. It may be called without
|
| 242 |
+
# holding the interpreter lock.
|
| 243 |
+
|
| 244 |
+
int PyErr_SetInterruptEx(int signum)
|
| 245 |
+
|
| 246 |
+
object PyErr_NewException(char *name, object base, object dict)
|
| 247 |
+
# Return value: New reference.
|
| 248 |
+
# This utility function creates and returns a new exception
|
| 249 |
+
# object. The name argument must be the name of the new exception,
|
| 250 |
+
# a C string of the form module.class. The base and dict arguments
|
| 251 |
+
# are normally NULL. This creates a class object derived from
|
| 252 |
+
# Exception (accessible in C as PyExc_Exception).
|
| 253 |
+
|
| 254 |
+
void PyErr_WriteUnraisable(object obj)
|
| 255 |
+
# This utility function prints a warning message to sys.stderr
|
| 256 |
+
# when an exception has been set but it is impossible for the
|
| 257 |
+
# interpreter to actually raise the exception. It is used, for
|
| 258 |
+
# example, when an exception occurs in an __del__() method.
|
| 259 |
+
#
|
| 260 |
+
# The function is called with a single argument obj that
|
| 261 |
+
# identifies the context in which the unraisable exception
|
| 262 |
+
# occurred. The repr of obj will be printed in the warning
|
| 263 |
+
# message.
|
tuning-competition-baseline/.venv/lib/python3.11/site-packages/Cython/Includes/cpython/float.pxd
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
cdef extern from "Python.h":
|
| 2 |
+
"""
|
| 3 |
+
#if PY_MAJOR_VERSION >= 3
|
| 4 |
+
#define __Pyx_PyFloat_FromString(obj) PyFloat_FromString(obj)
|
| 5 |
+
#else
|
| 6 |
+
#define __Pyx_PyFloat_FromString(obj) PyFloat_FromString(obj, NULL)
|
| 7 |
+
#endif
|
| 8 |
+
"""
|
| 9 |
+
|
| 10 |
+
############################################################################
|
| 11 |
+
# 7.2.3
|
| 12 |
+
############################################################################
|
| 13 |
+
# PyFloatObject
|
| 14 |
+
#
|
| 15 |
+
# This subtype of PyObject represents a Python floating point object.
|
| 16 |
+
|
| 17 |
+
# PyTypeObject PyFloat_Type
|
| 18 |
+
#
|
| 19 |
+
# This instance of PyTypeObject represents the Python floating
|
| 20 |
+
# point type. This is the same object as float and
|
| 21 |
+
# types.FloatType.
|
| 22 |
+
|
| 23 |
+
bint PyFloat_Check(object p)
|
| 24 |
+
# Return true if its argument is a PyFloatObject or a subtype of
|
| 25 |
+
# PyFloatObject.
|
| 26 |
+
|
| 27 |
+
bint PyFloat_CheckExact(object p)
|
| 28 |
+
# Return true if its argument is a PyFloatObject, but not a
|
| 29 |
+
# subtype of PyFloatObject.
|
| 30 |
+
|
| 31 |
+
object PyFloat_FromString "__Pyx_PyFloat_FromString" (object str)
|
| 32 |
+
# Return value: New reference.
|
| 33 |
+
# Create a PyFloatObject object based on the string value in str,
|
| 34 |
+
# or NULL on failure. The pend argument is ignored. It remains
|
| 35 |
+
# only for backward compatibility.
|
| 36 |
+
|
| 37 |
+
object PyFloat_FromDouble(double v)
|
| 38 |
+
# Return value: New reference.
|
| 39 |
+
# Create a PyFloatObject object from v, or NULL on failure.
|
| 40 |
+
|
| 41 |
+
double PyFloat_AsDouble(object pyfloat) except? -1
|
| 42 |
+
# Return a C double representation of the contents of pyfloat.
|
| 43 |
+
|
| 44 |
+
double PyFloat_AS_DOUBLE(object pyfloat)
|
| 45 |
+
# Return a C double representation of the contents of pyfloat, but
|
| 46 |
+
# without error checking.
|
tuning-competition-baseline/.venv/lib/python3.11/site-packages/Cython/Includes/cpython/function.pxd
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from .object cimport PyObject
|
| 2 |
+
|
| 3 |
+
cdef extern from "Python.h":
|
| 4 |
+
|
| 5 |
+
############################################################################
|
| 6 |
+
# 7.5.3 Function Objects
|
| 7 |
+
############################################################################
|
| 8 |
+
# There are a few functions specific to Python functions.
|
| 9 |
+
|
| 10 |
+
# PyFunctionObject
|
| 11 |
+
#
|
| 12 |
+
# The C structure used for functions.
|
| 13 |
+
|
| 14 |
+
# PyTypeObject PyFunction_Type
|
| 15 |
+
#
|
| 16 |
+
# This is an instance of PyTypeObject and represents the Python
|
| 17 |
+
# function type. It is exposed to Python programmers as
|
| 18 |
+
# types.FunctionType.
|
| 19 |
+
|
| 20 |
+
bint PyFunction_Check(object o)
|
| 21 |
+
# Return true if o is a function object (has type
|
| 22 |
+
# PyFunction_Type). The parameter must not be NULL.
|
| 23 |
+
|
| 24 |
+
object PyFunction_New(object code, object globals)
|
| 25 |
+
# Return value: New reference.
|
| 26 |
+
# Return a new function object associated with the code object
|
| 27 |
+
# code. globals must be a dictionary with the global variables
|
| 28 |
+
# accessible to the function.
|
| 29 |
+
# The function's docstring, name and __module__ are retrieved from
|
| 30 |
+
# the code object, the argument defaults and closure are set to
|
| 31 |
+
# NULL.
|
| 32 |
+
|
| 33 |
+
PyObject* PyFunction_GetCode(object op) except? NULL
|
| 34 |
+
# Return value: Borrowed reference.
|
| 35 |
+
# Return the code object associated with the function object op.
|
| 36 |
+
|
| 37 |
+
PyObject* PyFunction_GetGlobals(object op) except? NULL
|
| 38 |
+
# Return value: Borrowed reference.
|
| 39 |
+
# Return the globals dictionary associated with the function object op.
|
| 40 |
+
|
| 41 |
+
PyObject* PyFunction_GetModule(object op) except? NULL
|
| 42 |
+
# Return value: Borrowed reference.
|
| 43 |
+
# Return the __module__ attribute of the function object op. This
|
| 44 |
+
# is normally a string containing the module name, but can be set
|
| 45 |
+
# to any other object by Python code.
|
| 46 |
+
|
| 47 |
+
PyObject* PyFunction_GetDefaults(object op) except? NULL
|
| 48 |
+
# Return value: Borrowed reference.
|
| 49 |
+
# Return the argument default values of the function object
|
| 50 |
+
# op. This can be a tuple of arguments or NULL.
|
| 51 |
+
|
| 52 |
+
int PyFunction_SetDefaults(object op, object defaults) except -1
|
| 53 |
+
# Set the argument default values for the function object
|
| 54 |
+
# op. defaults must be Py_None or a tuple.
|
| 55 |
+
# Raises SystemError and returns -1 on failure.
|
| 56 |
+
|
| 57 |
+
PyObject* PyFunction_GetClosure(object op) except? NULL
|
| 58 |
+
# Return value: Borrowed reference.
|
| 59 |
+
# Return the closure associated with the function object op. This
|
| 60 |
+
# can be NULL or a tuple of cell objects.
|
| 61 |
+
|
| 62 |
+
int PyFunction_SetClosure(object op, object closure) except -1
|
| 63 |
+
# Set the closure associated with the function object op. closure
|
| 64 |
+
# must be Py_None or a tuple of cell objects.
|
| 65 |
+
# Raises SystemError and returns -1 on failure.
|
tuning-competition-baseline/.venv/lib/python3.11/site-packages/Cython/Includes/cpython/int.pxd
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
cdef extern from "Python.h":
|
| 2 |
+
ctypedef unsigned long long PY_LONG_LONG
|
| 3 |
+
|
| 4 |
+
############################################################################
|
| 5 |
+
# Integer Objects
|
| 6 |
+
############################################################################
|
| 7 |
+
# PyTypeObject PyInt_Type
|
| 8 |
+
# This instance of PyTypeObject represents the Python plain
|
| 9 |
+
# integer type. This is the same object as int and types.IntType.
|
| 10 |
+
|
| 11 |
+
bint PyInt_Check(object o)
|
| 12 |
+
# Return true if o is of type PyInt_Type or a subtype of
|
| 13 |
+
# PyInt_Type.
|
| 14 |
+
|
| 15 |
+
bint PyInt_CheckExact(object o)
|
| 16 |
+
# Return true if o is of type PyInt_Type, but not a subtype of
|
| 17 |
+
# PyInt_Type.
|
| 18 |
+
|
| 19 |
+
object PyInt_FromString(char *str, char **pend, int base)
|
| 20 |
+
# Return value: New reference.
|
| 21 |
+
# Return a new PyIntObject or PyLongObject based on the string
|
| 22 |
+
# value in str, which is interpreted according to the radix in
|
| 23 |
+
# base. If pend is non-NULL, *pend will point to the first
|
| 24 |
+
# character in str which follows the representation of the
|
| 25 |
+
# number. If base is 0, the radix will be determined based on the
|
| 26 |
+
# leading characters of str: if str starts with '0x' or '0X',
|
| 27 |
+
# radix 16 will be used; if str starts with '0', radix 8 will be
|
| 28 |
+
# used; otherwise radix 10 will be used. If base is not 0, it must
|
| 29 |
+
# be between 2 and 36, inclusive. Leading spaces are ignored. If
|
| 30 |
+
# there are no digits, ValueError will be raised. If the string
|
| 31 |
+
# represents a number too large to be contained within the
|
| 32 |
+
# machine's long int type and overflow warnings are being
|
| 33 |
+
# suppressed, a PyLongObject will be returned. If overflow
|
| 34 |
+
# warnings are not being suppressed, NULL will be returned in this
|
| 35 |
+
# case.
|
| 36 |
+
|
| 37 |
+
object PyInt_FromLong(long ival)
|
| 38 |
+
# Return value: New reference.
|
| 39 |
+
# Create a new integer object with a value of ival.
|
| 40 |
+
# The current implementation keeps an array of integer objects for
|
| 41 |
+
# all integers between -5 and 256, when you create an int in that
|
| 42 |
+
# range you actually just get back a reference to the existing
|
| 43 |
+
# object. So it should be possible to change the value of 1. I
|
| 44 |
+
# suspect the behaviour of Python in this case is undefined. :-)
|
| 45 |
+
|
| 46 |
+
object PyInt_FromSsize_t(Py_ssize_t ival)
|
| 47 |
+
# Return value: New reference.
|
| 48 |
+
# Create a new integer object with a value of ival. If the value
|
| 49 |
+
# is larger than LONG_MAX or smaller than LONG_MIN, a long integer
|
| 50 |
+
# object is returned.
|
| 51 |
+
|
| 52 |
+
object PyInt_FromSize_t(size_t ival)
|
| 53 |
+
# Return value: New reference.
|
| 54 |
+
# Create a new integer object with a value of ival. If the value
|
| 55 |
+
# exceeds LONG_MAX, a long integer object is returned.
|
| 56 |
+
|
| 57 |
+
long PyInt_AsLong(object io) except? -1
|
| 58 |
+
# Will first attempt to cast the object to a PyIntObject, if it is
|
| 59 |
+
# not already one, and then return its value. If there is an
|
| 60 |
+
# error, -1 is returned, and the caller should check
|
| 61 |
+
# PyErr_Occurred() to find out whether there was an error, or
|
| 62 |
+
# whether the value just happened to be -1.
|
| 63 |
+
|
| 64 |
+
long PyInt_AS_LONG(object io)
|
| 65 |
+
# Return the value of the object io. No error checking is performed.
|
| 66 |
+
|
| 67 |
+
unsigned long PyInt_AsUnsignedLongMask(object io) except? -1
|
| 68 |
+
# Will first attempt to cast the object to a PyIntObject or
|
| 69 |
+
# PyLongObject, if it is not already one, and then return its
|
| 70 |
+
# value as unsigned long. This function does not check for
|
| 71 |
+
# overflow.
|
| 72 |
+
|
| 73 |
+
PY_LONG_LONG PyInt_AsUnsignedLongLongMask(object io) except? -1
|
| 74 |
+
# Will first attempt to cast the object to a PyIntObject or
|
| 75 |
+
# PyLongObject, if it is not already one, and then return its
|
| 76 |
+
# value as unsigned long long, without checking for overflow.
|
| 77 |
+
|
| 78 |
+
Py_ssize_t PyInt_AsSsize_t(object io) except? -1
|
| 79 |
+
# Will first attempt to cast the object to a PyIntObject or
|
| 80 |
+
# PyLongObject, if it is not already one, and then return its
|
| 81 |
+
# value as Py_ssize_t.
|
| 82 |
+
|
| 83 |
+
long PyInt_GetMax()
|
| 84 |
+
# Return the system's idea of the largest integer it can handle
|
| 85 |
+
# (LONG_MAX, as defined in the system header files).
|
| 86 |
+
|
| 87 |
+
int PyInt_ClearFreeList()
|
| 88 |
+
# Clear the integer free list. Return the number of items that could not be freed.
|
| 89 |
+
# New in version 2.6.
|
tuning-competition-baseline/.venv/lib/python3.11/site-packages/Cython/Includes/cpython/iterobject.pxd
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
cdef extern from "Python.h":
|
| 2 |
+
|
| 3 |
+
###########################################################################
|
| 4 |
+
# Iterator Objects
|
| 5 |
+
###########################################################################
|
| 6 |
+
|
| 7 |
+
bint PySeqIter_Check(object op)
|
| 8 |
+
# Return true if the type of op is PySeqIter_Type.
|
| 9 |
+
|
| 10 |
+
object PySeqIter_New(object seq)
|
| 11 |
+
# Return value: New reference.
|
| 12 |
+
# Return an iterator that works with a general sequence object, seq. The
|
| 13 |
+
# iteration ends when the sequence raises IndexError for the subscripting
|
| 14 |
+
# operation.
|
| 15 |
+
|
| 16 |
+
bint PyCallIter_Check(object op)
|
| 17 |
+
# Return true if the type of op is PyCallIter_Type.
|
| 18 |
+
|
| 19 |
+
object PyCallIter_New(object callable, object sentinel)
|
| 20 |
+
# Return value: New reference.
|
| 21 |
+
# Return a new iterator. The first parameter, callable, can be any Python
|
| 22 |
+
# callable object that can be called with no parameters; each call to it
|
| 23 |
+
# should return the next item in the iteration. When callable returns a
|
| 24 |
+
# value equal to sentinel, the iteration will be terminated.
|
tuning-competition-baseline/.venv/lib/python3.11/site-packages/Cython/Includes/cpython/list.pxd
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from .object cimport PyObject
|
| 2 |
+
|
| 3 |
+
cdef extern from "Python.h":
|
| 4 |
+
|
| 5 |
+
############################################################################
|
| 6 |
+
# Lists
|
| 7 |
+
############################################################################
|
| 8 |
+
list PyList_New(Py_ssize_t len)
|
| 9 |
+
# Return a new list of length len on success, or NULL on failure.
|
| 10 |
+
#
|
| 11 |
+
# Note: If length is greater than zero, the returned list object's
|
| 12 |
+
# items are set to NULL. Thus you cannot use abstract API
|
| 13 |
+
# functions such as PySequence_SetItem() or expose the object to
|
| 14 |
+
# Python code before setting all items to a real object with
|
| 15 |
+
# PyList_SetItem().
|
| 16 |
+
|
| 17 |
+
bint PyList_Check(object p)
|
| 18 |
+
# Return true if p is a list object or an instance of a subtype of
|
| 19 |
+
# the list type.
|
| 20 |
+
|
| 21 |
+
bint PyList_CheckExact(object p)
|
| 22 |
+
# Return true if p is a list object, but not an instance of a
|
| 23 |
+
# subtype of the list type.
|
| 24 |
+
|
| 25 |
+
Py_ssize_t PyList_Size(object list) except -1
|
| 26 |
+
# Return the length of the list object in list; this is equivalent
|
| 27 |
+
# to "len(list)" on a list object.
|
| 28 |
+
|
| 29 |
+
Py_ssize_t PyList_GET_SIZE(object list)
|
| 30 |
+
# Macro form of PyList_Size() without error checking.
|
| 31 |
+
|
| 32 |
+
PyObject* PyList_GetItem(object list, Py_ssize_t index) except NULL
|
| 33 |
+
# Return value: Borrowed reference.
|
| 34 |
+
# Return the object at position pos in the list pointed to by
|
| 35 |
+
# p. The position must be positive, indexing from the end of the
|
| 36 |
+
# list is not supported. If pos is out of bounds, return NULL and
|
| 37 |
+
# set an IndexError exception.
|
| 38 |
+
|
| 39 |
+
PyObject* PyList_GET_ITEM(object list, Py_ssize_t i)
|
| 40 |
+
# Return value: Borrowed reference.
|
| 41 |
+
# Macro form of PyList_GetItem() without error checking.
|
| 42 |
+
|
| 43 |
+
int PyList_SetItem(object list, Py_ssize_t index, object item) except -1
|
| 44 |
+
# Set the item at index index in list to item. Return 0 on success
|
| 45 |
+
# or -1 on failure.
|
| 46 |
+
#
|
| 47 |
+
# WARNING: This function _steals_ a reference to item and discards a
|
| 48 |
+
# reference to an item already in the list at the affected position.
|
| 49 |
+
|
| 50 |
+
void PyList_SET_ITEM(object list, Py_ssize_t i, object o)
|
| 51 |
+
# Macro form of PyList_SetItem() without error checking. This is
|
| 52 |
+
# normally only used to fill in new lists where there is no
|
| 53 |
+
# previous content.
|
| 54 |
+
#
|
| 55 |
+
# WARNING: This function _steals_ a reference to item, and, unlike
|
| 56 |
+
# PyList_SetItem(), does not discard a reference to any item that
|
| 57 |
+
# it being replaced; any reference in list at position i will be *leaked*.
|
| 58 |
+
|
| 59 |
+
int PyList_Insert(object list, Py_ssize_t index, object item) except -1
|
| 60 |
+
# Insert the item item into list list in front of index
|
| 61 |
+
# index. Return 0 if successful; return -1 and set an exception if
|
| 62 |
+
# unsuccessful. Analogous to list.insert(index, item).
|
| 63 |
+
|
| 64 |
+
int PyList_Append(object list, object item) except -1
|
| 65 |
+
# Append the object item at the end of list list. Return 0 if
|
| 66 |
+
# successful; return -1 and set an exception if
|
| 67 |
+
# unsuccessful. Analogous to list.append(item).
|
| 68 |
+
|
| 69 |
+
list PyList_GetSlice(object list, Py_ssize_t low, Py_ssize_t high)
|
| 70 |
+
# Return value: New reference.
|
| 71 |
+
# Return a list of the objects in list containing the objects
|
| 72 |
+
# between low and high. Return NULL and set an exception if
|
| 73 |
+
# unsuccessful. Analogous to list[low:high].
|
| 74 |
+
|
| 75 |
+
int PyList_SetSlice(object list, Py_ssize_t low, Py_ssize_t high, object itemlist) except -1
|
| 76 |
+
# Set the slice of list between low and high to the contents of
|
| 77 |
+
# itemlist. Analogous to list[low:high] = itemlist. The itemlist
|
| 78 |
+
# may be NULL, indicating the assignment of an empty list (slice
|
| 79 |
+
# deletion). Return 0 on success, -1 on failure.
|
| 80 |
+
|
| 81 |
+
int PyList_Sort(object list) except -1
|
| 82 |
+
# Sort the items of list in place. Return 0 on success, -1 on
|
| 83 |
+
# failure. This is equivalent to "list.sort()".
|
| 84 |
+
|
| 85 |
+
int PyList_Reverse(object list) except -1
|
| 86 |
+
# Reverse the items of list in place. Return 0 on success, -1 on
|
| 87 |
+
# failure. This is the equivalent of "list.reverse()".
|
| 88 |
+
|
| 89 |
+
tuple PyList_AsTuple(object list)
|
| 90 |
+
# Return value: New reference.
|
| 91 |
+
# Return a new tuple object containing the contents of list;
|
| 92 |
+
# equivalent to "tuple(list)".
|
tuning-competition-baseline/.venv/lib/python3.11/site-packages/Cython/Includes/cpython/long.pxd
ADDED
|
@@ -0,0 +1,149 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
cdef extern from "Python.h":
|
| 3 |
+
ctypedef long long PY_LONG_LONG
|
| 4 |
+
ctypedef unsigned long long uPY_LONG_LONG "unsigned PY_LONG_LONG"
|
| 5 |
+
|
| 6 |
+
############################################################################
|
| 7 |
+
# 7.2.3 Long Integer Objects
|
| 8 |
+
############################################################################
|
| 9 |
+
|
| 10 |
+
# PyLongObject
|
| 11 |
+
#
|
| 12 |
+
# This subtype of PyObject represents a Python long integer object.
|
| 13 |
+
|
| 14 |
+
# PyTypeObject PyLong_Type
|
| 15 |
+
#
|
| 16 |
+
# This instance of PyTypeObject represents the Python long integer
|
| 17 |
+
# type. This is the same object as long and types.LongType.
|
| 18 |
+
|
| 19 |
+
bint PyLong_Check(object p)
|
| 20 |
+
# Return true if its argument is a PyLongObject or a subtype of PyLongObject.
|
| 21 |
+
|
| 22 |
+
bint PyLong_CheckExact(object p)
|
| 23 |
+
# Return true if its argument is a PyLongObject, but not a subtype of PyLongObject.
|
| 24 |
+
|
| 25 |
+
object PyLong_FromLong(long v)
|
| 26 |
+
# Return value: New reference.
|
| 27 |
+
# Return a new PyLongObject object from v, or NULL on failure.
|
| 28 |
+
|
| 29 |
+
object PyLong_FromUnsignedLong(unsigned long v)
|
| 30 |
+
# Return value: New reference.
|
| 31 |
+
# Return a new PyLongObject object from a C unsigned long, or NULL on failure.
|
| 32 |
+
|
| 33 |
+
object PyLong_FromSsize_t(Py_ssize_t v)
|
| 34 |
+
# Return value: New reference.
|
| 35 |
+
# Return a new PyLongObject object from a C Py_ssize_t, or NULL on failure.)
|
| 36 |
+
|
| 37 |
+
object PyLong_FromSize_t(size_t v)
|
| 38 |
+
# Return value: New reference.
|
| 39 |
+
# Return a new PyLongObject object from a C size_t, or NULL on failure.
|
| 40 |
+
|
| 41 |
+
object PyLong_FromLongLong(PY_LONG_LONG v)
|
| 42 |
+
# Return value: New reference.
|
| 43 |
+
# Return a new PyLongObject object from a C long long, or NULL on failure.
|
| 44 |
+
|
| 45 |
+
object PyLong_FromUnsignedLongLong(uPY_LONG_LONG v)
|
| 46 |
+
# Return value: New reference.
|
| 47 |
+
# Return a new PyLongObject object from a C unsigned long long, or NULL on failure.
|
| 48 |
+
|
| 49 |
+
object PyLong_FromDouble(double v)
|
| 50 |
+
# Return value: New reference.
|
| 51 |
+
# Return a new PyLongObject object from the integer part of v, or NULL on failure.
|
| 52 |
+
|
| 53 |
+
object PyLong_FromString(char *str, char **pend, int base)
|
| 54 |
+
# Return value: New reference.
|
| 55 |
+
# Return a new PyLongObject based on the string value in str,
|
| 56 |
+
# which is interpreted according to the radix in base. If pend is
|
| 57 |
+
# non-NULL, *pend will point to the first character in str which
|
| 58 |
+
# follows the representation of the number. If base is 0, the
|
| 59 |
+
# radix will be determined based on the leading characters of str:
|
| 60 |
+
# if str starts with '0x' or '0X', radix 16 will be used; if str
|
| 61 |
+
# starts with '0', radix 8 will be used; otherwise radix 10 will
|
| 62 |
+
# be used. If base is not 0, it must be between 2 and 36,
|
| 63 |
+
# inclusive. Leading spaces are ignored. If there are no digits,
|
| 64 |
+
# ValueError will be raised.
|
| 65 |
+
|
| 66 |
+
object PyLong_FromUnicode(Py_UNICODE *u, Py_ssize_t length, int base)
|
| 67 |
+
# Return value: New reference.
|
| 68 |
+
# Convert a sequence of Unicode digits to a Python long integer
|
| 69 |
+
# value. The first parameter, u, points to the first character of
|
| 70 |
+
# the Unicode string, length gives the number of characters, and
|
| 71 |
+
# base is the radix for the conversion. The radix must be in the
|
| 72 |
+
# range [2, 36]; if it is out of range, ValueError will be
|
| 73 |
+
# raised.
|
| 74 |
+
|
| 75 |
+
# object PyLong_FromUnicodeObject(object u, int base)
|
| 76 |
+
# Convert a sequence of Unicode digits in the string u to a Python integer
|
| 77 |
+
# value. The Unicode string is first encoded to a byte string using
|
| 78 |
+
# PyUnicode_EncodeDecimal() and then converted using PyLong_FromString().
|
| 79 |
+
# New in version 3.3.
|
| 80 |
+
|
| 81 |
+
object PyLong_FromVoidPtr(void *p)
|
| 82 |
+
# Return value: New reference.
|
| 83 |
+
# Create a Python integer or long integer from the pointer p. The
|
| 84 |
+
# pointer value can be retrieved from the resulting value using
|
| 85 |
+
# PyLong_AsVoidPtr(). If the integer is larger than LONG_MAX, a
|
| 86 |
+
# positive long integer is returned.
|
| 87 |
+
|
| 88 |
+
long PyLong_AsLong(object pylong) except? -1
|
| 89 |
+
# Return a C long representation of the contents of pylong. If
|
| 90 |
+
# pylong is greater than LONG_MAX, an OverflowError is raised.
|
| 91 |
+
|
| 92 |
+
long PyLong_AsLongAndOverflow(object pylong, int *overflow) except? -1
|
| 93 |
+
# Return a C long representation of the contents of pylong. If pylong is
|
| 94 |
+
# greater than LONG_MAX or less than LONG_MIN, set *overflow to 1 or -1,
|
| 95 |
+
# respectively, and return -1; otherwise, set *overflow to 0. If any other
|
| 96 |
+
# exception occurs (for example a TypeError or MemoryError), then -1 will
|
| 97 |
+
# be returned and *overflow will be 0.
|
| 98 |
+
# New in version 2.7.
|
| 99 |
+
|
| 100 |
+
PY_LONG_LONG PyLong_AsLongLongAndOverflow(object pylong, int *overflow) except? -1
|
| 101 |
+
# Return a C long long representation of the contents of pylong. If pylong
|
| 102 |
+
# is greater than PY_LLONG_MAX or less than PY_LLONG_MIN, set *overflow to
|
| 103 |
+
# 1 or -1, respectively, and return -1; otherwise, set *overflow to 0. If
|
| 104 |
+
# any other exception occurs (for example a TypeError or MemoryError), then
|
| 105 |
+
# -1 will be returned and *overflow will be 0.
|
| 106 |
+
# New in version 2.7.
|
| 107 |
+
|
| 108 |
+
Py_ssize_t PyLong_AsSsize_t(object pylong) except? -1
|
| 109 |
+
# Return a C Py_ssize_t representation of the contents of pylong. If pylong
|
| 110 |
+
# is greater than PY_SSIZE_T_MAX, an OverflowError is raised and -1 will be
|
| 111 |
+
# returned.
|
| 112 |
+
|
| 113 |
+
unsigned long PyLong_AsUnsignedLong(object pylong) except? -1
|
| 114 |
+
# Return a C unsigned long representation of the contents of
|
| 115 |
+
# pylong. If pylong is greater than ULONG_MAX, an OverflowError is
|
| 116 |
+
# raised.
|
| 117 |
+
|
| 118 |
+
PY_LONG_LONG PyLong_AsLongLong(object pylong) except? -1
|
| 119 |
+
# Return a C long long from a Python long integer. If pylong
|
| 120 |
+
# cannot be represented as a long long, an OverflowError will be
|
| 121 |
+
# raised.
|
| 122 |
+
|
| 123 |
+
uPY_LONG_LONG PyLong_AsUnsignedLongLong(object pylong) except? -1
|
| 124 |
+
#unsigned PY_LONG_LONG PyLong_AsUnsignedLongLong(object pylong)
|
| 125 |
+
# Return a C unsigned long long from a Python long integer. If
|
| 126 |
+
# pylong cannot be represented as an unsigned long long, an
|
| 127 |
+
# OverflowError will be raised if the value is positive, or a
|
| 128 |
+
# TypeError will be raised if the value is negative.
|
| 129 |
+
|
| 130 |
+
unsigned long PyLong_AsUnsignedLongMask(object io) except? -1
|
| 131 |
+
# Return a C unsigned long from a Python long integer, without
|
| 132 |
+
# checking for overflow.
|
| 133 |
+
|
| 134 |
+
uPY_LONG_LONG PyLong_AsUnsignedLongLongMask(object io) except? -1
|
| 135 |
+
#unsigned PY_LONG_LONG PyLong_AsUnsignedLongLongMask(object io)
|
| 136 |
+
# Return a C unsigned long long from a Python long integer,
|
| 137 |
+
# without checking for overflow.
|
| 138 |
+
|
| 139 |
+
double PyLong_AsDouble(object pylong) except? -1.0
|
| 140 |
+
# Return a C double representation of the contents of pylong. If
|
| 141 |
+
# pylong cannot be approximately represented as a double, an
|
| 142 |
+
# OverflowError exception is raised and -1.0 will be returned.
|
| 143 |
+
|
| 144 |
+
void* PyLong_AsVoidPtr(object pylong) except? NULL
|
| 145 |
+
# Convert a Python integer or long integer pylong to a C void
|
| 146 |
+
# pointer. If pylong cannot be converted, an OverflowError will be
|
| 147 |
+
# raised. This is only assured to produce a usable void pointer
|
| 148 |
+
# for values created with PyLong_FromVoidPtr(). For values outside
|
| 149 |
+
# 0..LONG_MAX, both signed and unsigned integers are accepted.
|
tuning-competition-baseline/.venv/lib/python3.11/site-packages/Cython/Includes/cpython/mem.pxd
ADDED
|
@@ -0,0 +1,120 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
cdef extern from "Python.h":
|
| 2 |
+
|
| 3 |
+
#####################################################################
|
| 4 |
+
# 9.2 Memory Interface
|
| 5 |
+
#####################################################################
|
| 6 |
+
# You are definitely *supposed* to use these: "In most situations,
|
| 7 |
+
# however, it is recommended to allocate memory from the Python
|
| 8 |
+
# heap specifically because the latter is under control of the
|
| 9 |
+
# Python memory manager. For example, this is required when the
|
| 10 |
+
# interpreter is extended with new object types written in
|
| 11 |
+
# C. Another reason for using the Python heap is the desire to
|
| 12 |
+
# inform the Python memory manager about the memory needs of the
|
| 13 |
+
# extension module. Even when the requested memory is used
|
| 14 |
+
# exclusively for internal, highly-specific purposes, delegating
|
| 15 |
+
# all memory requests to the Python memory manager causes the
|
| 16 |
+
# interpreter to have a more accurate image of its memory
|
| 17 |
+
# footprint as a whole. Consequently, under certain circumstances,
|
| 18 |
+
# the Python memory manager may or may not trigger appropriate
|
| 19 |
+
# actions, like garbage collection, memory compaction or other
|
| 20 |
+
# preventive procedures. Note that by using the C library
|
| 21 |
+
# allocator as shown in the previous example, the allocated memory
|
| 22 |
+
# for the I/O buffer escapes completely the Python memory
|
| 23 |
+
# manager."
|
| 24 |
+
|
| 25 |
+
# The following function sets, modeled after the ANSI C standard,
|
| 26 |
+
# but specifying behavior when requesting zero bytes, are
|
| 27 |
+
# available for allocating and releasing memory from the Python
|
| 28 |
+
# heap:
|
| 29 |
+
|
| 30 |
+
void* PyMem_RawMalloc(size_t n) nogil
|
| 31 |
+
void* PyMem_Malloc(size_t n)
|
| 32 |
+
# Allocates n bytes and returns a pointer of type void* to the
|
| 33 |
+
# allocated memory, or NULL if the request fails. Requesting zero
|
| 34 |
+
# bytes returns a distinct non-NULL pointer if possible, as if
|
| 35 |
+
# PyMem_Malloc(1) had been called instead. The memory will not
|
| 36 |
+
# have been initialized in any way.
|
| 37 |
+
|
| 38 |
+
void* PyMem_RawCalloc(size_t nelem, size_t elsize) nogil
|
| 39 |
+
void* PyMem_Calloc(size_t nelem, size_t elsize)
|
| 40 |
+
# Allocates nelem elements each whose size in bytes is elsize and
|
| 41 |
+
# returns a pointer of type void* to the allocated memory, or NULL if
|
| 42 |
+
# the request fails. The memory is initialized to zeros. Requesting
|
| 43 |
+
# zero elements or elements of size zero bytes returns a distinct
|
| 44 |
+
# non-NULL pointer if possible, as if PyMem_Calloc(1, 1) had been
|
| 45 |
+
# called instead.
|
| 46 |
+
|
| 47 |
+
void* PyMem_RawRealloc(void *p, size_t n) nogil
|
| 48 |
+
void* PyMem_Realloc(void *p, size_t n)
|
| 49 |
+
# Resizes the memory block pointed to by p to n bytes. The
|
| 50 |
+
# contents will be unchanged to the minimum of the old and the new
|
| 51 |
+
# sizes. If p is NULL, the call is equivalent to PyMem_Malloc(n);
|
| 52 |
+
# else if n is equal to zero, the memory block is resized but is
|
| 53 |
+
# not freed, and the returned pointer is non-NULL. Unless p is
|
| 54 |
+
# NULL, it must have been returned by a previous call to
|
| 55 |
+
# PyMem_Malloc(), PyMem_Realloc(), or PyMem_Calloc().
|
| 56 |
+
|
| 57 |
+
void PyMem_RawFree(void *p) nogil
|
| 58 |
+
void PyMem_Free(void *p)
|
| 59 |
+
# Frees the memory block pointed to by p, which must have been
|
| 60 |
+
# returned by a previous call to PyMem_Malloc(), PyMem_Realloc(), or
|
| 61 |
+
# PyMem_Calloc(). Otherwise, or if PyMem_Free(p) has been called
|
| 62 |
+
# before, undefined behavior occurs. If p is NULL, no operation is
|
| 63 |
+
# performed.
|
| 64 |
+
|
| 65 |
+
# The following type-oriented macros are provided for
|
| 66 |
+
# convenience. Note that TYPE refers to any C type.
|
| 67 |
+
|
| 68 |
+
# TYPE* PyMem_New(TYPE, size_t n)
|
| 69 |
+
# Same as PyMem_Malloc(), but allocates (n * sizeof(TYPE)) bytes
|
| 70 |
+
# of memory. Returns a pointer cast to TYPE*. The memory will not
|
| 71 |
+
# have been initialized in any way.
|
| 72 |
+
|
| 73 |
+
# TYPE* PyMem_Resize(void *p, TYPE, size_t n)
|
| 74 |
+
# Same as PyMem_Realloc(), but the memory block is resized to (n *
|
| 75 |
+
# sizeof(TYPE)) bytes. Returns a pointer cast to TYPE*.
|
| 76 |
+
|
| 77 |
+
void PyMem_Del(void *p)
|
| 78 |
+
# Same as PyMem_Free().
|
| 79 |
+
|
| 80 |
+
# In addition, the following macro sets are provided for calling
|
| 81 |
+
# the Python memory allocator directly, without involving the C
|
| 82 |
+
# API functions listed above. However, note that their use does
|
| 83 |
+
# not preserve binary compatibility across Python versions and is
|
| 84 |
+
# therefore deprecated in extension modules.
|
| 85 |
+
|
| 86 |
+
# PyMem_MALLOC(), PyMem_REALLOC(), PyMem_FREE().
|
| 87 |
+
# PyMem_NEW(), PyMem_RESIZE(), PyMem_DEL().
|
| 88 |
+
|
| 89 |
+
|
| 90 |
+
#####################################################################
|
| 91 |
+
# Raw object memory interface
|
| 92 |
+
#####################################################################
|
| 93 |
+
|
| 94 |
+
# Functions to call the same malloc/realloc/free as used by Python's
|
| 95 |
+
# object allocator. If WITH_PYMALLOC is enabled, these may differ from
|
| 96 |
+
# the platform malloc/realloc/free. The Python object allocator is
|
| 97 |
+
# designed for fast, cache-conscious allocation of many "small" objects,
|
| 98 |
+
# and with low hidden memory overhead.
|
| 99 |
+
#
|
| 100 |
+
# PyObject_Malloc(0) returns a unique non-NULL pointer if possible.
|
| 101 |
+
#
|
| 102 |
+
# PyObject_Realloc(NULL, n) acts like PyObject_Malloc(n).
|
| 103 |
+
# PyObject_Realloc(p != NULL, 0) does not return NULL, or free the memory
|
| 104 |
+
# at p.
|
| 105 |
+
#
|
| 106 |
+
# Returned pointers must be checked for NULL explicitly; no action is
|
| 107 |
+
# performed on failure other than to return NULL (no warning it printed, no
|
| 108 |
+
# exception is set, etc).
|
| 109 |
+
#
|
| 110 |
+
# For allocating objects, use PyObject_{New, NewVar} instead whenever
|
| 111 |
+
# possible. The PyObject_{Malloc, Realloc, Free} family is exposed
|
| 112 |
+
# so that you can exploit Python's small-block allocator for non-object
|
| 113 |
+
# uses. If you must use these routines to allocate object memory, make sure
|
| 114 |
+
# the object gets initialized via PyObject_{Init, InitVar} after obtaining
|
| 115 |
+
# the raw memory.
|
| 116 |
+
|
| 117 |
+
void* PyObject_Malloc(size_t size)
|
| 118 |
+
void* PyObject_Calloc(size_t nelem, size_t elsize)
|
| 119 |
+
void* PyObject_Realloc(void *ptr, size_t new_size)
|
| 120 |
+
void PyObject_Free(void *ptr)
|
tuning-competition-baseline/.venv/lib/python3.11/site-packages/Cython/Includes/cpython/memoryview.pxd
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
cdef extern from "Python.h":
|
| 2 |
+
|
| 3 |
+
###########################################################################
|
| 4 |
+
# MemoryView Objects
|
| 5 |
+
###########################################################################
|
| 6 |
+
# A memoryview object exposes the C level buffer interface as a Python
|
| 7 |
+
# object which can then be passed around like any other object
|
| 8 |
+
|
| 9 |
+
object PyMemoryView_FromObject(object obj)
|
| 10 |
+
# Return value: New reference.
|
| 11 |
+
# Create a memoryview object from an object that provides the buffer
|
| 12 |
+
# interface. If obj supports writable buffer exports, the memoryview object
|
| 13 |
+
# will be read/write, otherwise it may be either read-only or read/write at
|
| 14 |
+
# the discretion of the exporter.
|
| 15 |
+
|
| 16 |
+
object PyMemoryView_FromMemory(char *mem, Py_ssize_t size, int flags)
|
| 17 |
+
# Return value: New reference.
|
| 18 |
+
# Create a memoryview object using mem as the underlying buffer. flags can
|
| 19 |
+
# be one of PyBUF_READ or PyBUF_WRITE.
|
| 20 |
+
# New in version 3.3.
|
| 21 |
+
|
| 22 |
+
object PyMemoryView_FromBuffer(Py_buffer *view)
|
| 23 |
+
# Return value: New reference.
|
| 24 |
+
# Create a memoryview object wrapping the given buffer structure view. For
|
| 25 |
+
# simple byte buffers, PyMemoryView_FromMemory() is the preferred function.
|
| 26 |
+
|
| 27 |
+
object PyMemoryView_GetContiguous(object obj,
|
| 28 |
+
int buffertype,
|
| 29 |
+
char order)
|
| 30 |
+
# Return value: New reference.
|
| 31 |
+
# Create a memoryview object to a contiguous chunk of memory (in either ‘C’
|
| 32 |
+
# or ‘F’ortran order) from an object that defines the buffer interface. If
|
| 33 |
+
# memory is contiguous, the memoryview object points to the original
|
| 34 |
+
# memory. Otherwise, a copy is made and the memoryview points to a new
|
| 35 |
+
# bytes object.
|
| 36 |
+
|
| 37 |
+
bint PyMemoryView_Check(object obj)
|
| 38 |
+
# Return true if the object obj is a memoryview object. It is not currently
|
| 39 |
+
# allowed to create subclasses of memoryview.
|
| 40 |
+
|
| 41 |
+
Py_buffer *PyMemoryView_GET_BUFFER(object mview)
|
| 42 |
+
# Return a pointer to the memoryview’s private copy of the exporter’s
|
| 43 |
+
# buffer. mview must be a memoryview instance; this macro doesn’t check its
|
| 44 |
+
# type, you must do it yourself or you will risk crashes.
|
| 45 |
+
|
| 46 |
+
Py_buffer *PyMemoryView_GET_BASE(object mview)
|
| 47 |
+
# Return either a pointer to the exporting object that the memoryview is
|
| 48 |
+
# based on or NULL if the memoryview has been created by one of the
|
| 49 |
+
# functions PyMemoryView_FromMemory() or PyMemoryView_FromBuffer(). mview
|
| 50 |
+
# must be a memoryview instance.
|
tuning-competition-baseline/.venv/lib/python3.11/site-packages/Cython/Includes/cpython/object.pxd
ADDED
|
@@ -0,0 +1,440 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from libc.stdio cimport FILE
|
| 2 |
+
cimport cpython.type
|
| 3 |
+
|
| 4 |
+
cdef extern from "Python.h":
|
| 5 |
+
|
| 6 |
+
ctypedef struct PyObject # forward declaration
|
| 7 |
+
|
| 8 |
+
ctypedef object (*newfunc)(cpython.type.type, PyObject*, PyObject*) # (type, args|NULL, kwargs|NULL)
|
| 9 |
+
|
| 10 |
+
ctypedef object (*unaryfunc)(object)
|
| 11 |
+
ctypedef object (*binaryfunc)(object, object)
|
| 12 |
+
ctypedef object (*ternaryfunc)(object, object, object)
|
| 13 |
+
ctypedef int (*inquiry)(object) except -1
|
| 14 |
+
ctypedef Py_ssize_t (*lenfunc)(object) except -1
|
| 15 |
+
ctypedef object (*ssizeargfunc)(object, Py_ssize_t)
|
| 16 |
+
ctypedef object (*ssizessizeargfunc)(object, Py_ssize_t, Py_ssize_t)
|
| 17 |
+
ctypedef int (*ssizeobjargproc)(object, Py_ssize_t, object) except -1
|
| 18 |
+
ctypedef int (*ssizessizeobjargproc)(object, Py_ssize_t, Py_ssize_t, object) except -1
|
| 19 |
+
ctypedef int (*objobjargproc)(object, object, object) except -1
|
| 20 |
+
ctypedef int (*objobjproc)(object, object) except -1
|
| 21 |
+
|
| 22 |
+
ctypedef Py_hash_t (*hashfunc)(object) except -1
|
| 23 |
+
ctypedef object (*reprfunc)(object)
|
| 24 |
+
|
| 25 |
+
ctypedef int (*cmpfunc)(object, object) except -2
|
| 26 |
+
ctypedef object (*richcmpfunc)(object, object, int)
|
| 27 |
+
|
| 28 |
+
# The following functions use 'PyObject*' as first argument instead of 'object' to prevent
|
| 29 |
+
# accidental reference counting when calling them during a garbage collection run.
|
| 30 |
+
ctypedef void (*destructor)(PyObject*)
|
| 31 |
+
ctypedef int (*visitproc)(PyObject*, void *) except -1
|
| 32 |
+
ctypedef int (*traverseproc)(PyObject*, visitproc, void*) except -1
|
| 33 |
+
ctypedef void (*freefunc)(void*)
|
| 34 |
+
|
| 35 |
+
ctypedef object (*descrgetfunc)(object, object, object)
|
| 36 |
+
ctypedef int (*descrsetfunc)(object, object, object) except -1
|
| 37 |
+
|
| 38 |
+
ctypedef object (*PyCFunction)(object, object)
|
| 39 |
+
|
| 40 |
+
ctypedef struct PyMethodDef:
|
| 41 |
+
const char* ml_name
|
| 42 |
+
PyCFunction ml_meth
|
| 43 |
+
int ml_flags
|
| 44 |
+
const char* ml_doc
|
| 45 |
+
|
| 46 |
+
ctypedef struct PyTypeObject:
|
| 47 |
+
const char* tp_name
|
| 48 |
+
const char* tp_doc
|
| 49 |
+
Py_ssize_t tp_basicsize
|
| 50 |
+
Py_ssize_t tp_itemsize
|
| 51 |
+
Py_ssize_t tp_dictoffset
|
| 52 |
+
unsigned long tp_flags
|
| 53 |
+
|
| 54 |
+
newfunc tp_new
|
| 55 |
+
destructor tp_dealloc
|
| 56 |
+
destructor tp_del
|
| 57 |
+
destructor tp_finalize
|
| 58 |
+
traverseproc tp_traverse
|
| 59 |
+
inquiry tp_clear
|
| 60 |
+
freefunc tp_free
|
| 61 |
+
|
| 62 |
+
ternaryfunc tp_call
|
| 63 |
+
hashfunc tp_hash
|
| 64 |
+
reprfunc tp_str
|
| 65 |
+
reprfunc tp_repr
|
| 66 |
+
|
| 67 |
+
cmpfunc tp_compare
|
| 68 |
+
richcmpfunc tp_richcompare
|
| 69 |
+
|
| 70 |
+
PyMethodDef* tp_methods
|
| 71 |
+
|
| 72 |
+
PyTypeObject* tp_base
|
| 73 |
+
PyObject* tp_dict
|
| 74 |
+
|
| 75 |
+
descrgetfunc tp_descr_get
|
| 76 |
+
descrsetfunc tp_descr_set
|
| 77 |
+
|
| 78 |
+
unsigned int tp_version_tag
|
| 79 |
+
|
| 80 |
+
ctypedef struct PyObject:
|
| 81 |
+
Py_ssize_t ob_refcnt
|
| 82 |
+
PyTypeObject *ob_type
|
| 83 |
+
|
| 84 |
+
cdef PyTypeObject *Py_TYPE(object)
|
| 85 |
+
|
| 86 |
+
void* PyObject_Malloc(size_t)
|
| 87 |
+
void* PyObject_Realloc(void *, size_t)
|
| 88 |
+
void PyObject_Free(void *)
|
| 89 |
+
|
| 90 |
+
#####################################################################
|
| 91 |
+
# 6.1 Object Protocol
|
| 92 |
+
#####################################################################
|
| 93 |
+
int PyObject_Print(object o, FILE *fp, int flags) except -1
|
| 94 |
+
# Print an object o, on file fp. Returns -1 on error. The flags
|
| 95 |
+
# argument is used to enable certain printing options. The only
|
| 96 |
+
# option currently supported is Py_PRINT_RAW; if given, the str()
|
| 97 |
+
# of the object is written instead of the repr().
|
| 98 |
+
|
| 99 |
+
bint PyObject_HasAttrString(object o, const char *attr_name)
|
| 100 |
+
# Returns 1 if o has the attribute attr_name, and 0
|
| 101 |
+
# otherwise. This is equivalent to the Python expression
|
| 102 |
+
# "hasattr(o, attr_name)". This function always succeeds.
|
| 103 |
+
|
| 104 |
+
object PyObject_GetAttrString(object o, const char *attr_name)
|
| 105 |
+
# Return value: New reference. Retrieve an attribute named
|
| 106 |
+
# attr_name from object o. Returns the attribute value on success,
|
| 107 |
+
# or NULL on failure. This is the equivalent of the Python
|
| 108 |
+
# expression "o.attr_name".
|
| 109 |
+
|
| 110 |
+
bint PyObject_HasAttr(object o, object attr_name)
|
| 111 |
+
# Returns 1 if o has the attribute attr_name, and 0
|
| 112 |
+
# otherwise. This is equivalent to the Python expression
|
| 113 |
+
# "hasattr(o, attr_name)". This function always succeeds.
|
| 114 |
+
|
| 115 |
+
object PyObject_GetAttr(object o, object attr_name)
|
| 116 |
+
# Return value: New reference. Retrieve an attribute named
|
| 117 |
+
# attr_name from object o. Returns the attribute value on success,
|
| 118 |
+
# or NULL on failure. This is the equivalent of the Python
|
| 119 |
+
# expression "o.attr_name".
|
| 120 |
+
|
| 121 |
+
object PyObject_GenericGetAttr(object o, object attr_name)
|
| 122 |
+
|
| 123 |
+
int PyObject_SetAttrString(object o, const char *attr_name, object v) except -1
|
| 124 |
+
# Set the value of the attribute named attr_name, for object o, to
|
| 125 |
+
# the value v. Returns -1 on failure. This is the equivalent of
|
| 126 |
+
# the Python statement "o.attr_name = v".
|
| 127 |
+
|
| 128 |
+
int PyObject_SetAttr(object o, object attr_name, object v) except -1
|
| 129 |
+
# Set the value of the attribute named attr_name, for object o, to
|
| 130 |
+
# the value v. Returns -1 on failure. This is the equivalent of
|
| 131 |
+
# the Python statement "o.attr_name = v".
|
| 132 |
+
|
| 133 |
+
int PyObject_GenericSetAttr(object o, object attr_name, object v) except -1
|
| 134 |
+
|
| 135 |
+
int PyObject_DelAttrString(object o, const char *attr_name) except -1
|
| 136 |
+
# Delete attribute named attr_name, for object o. Returns -1 on
|
| 137 |
+
# failure. This is the equivalent of the Python statement: "del
|
| 138 |
+
# o.attr_name".
|
| 139 |
+
|
| 140 |
+
int PyObject_DelAttr(object o, object attr_name) except -1
|
| 141 |
+
# Delete attribute named attr_name, for object o. Returns -1 on
|
| 142 |
+
# failure. This is the equivalent of the Python statement "del
|
| 143 |
+
# o.attr_name".
|
| 144 |
+
|
| 145 |
+
object PyObject_GenericGetDict(object o, void *context)
|
| 146 |
+
# Return value: New reference.
|
| 147 |
+
# A generic implementation for the getter of a __dict__ descriptor. It
|
| 148 |
+
# creates the dictionary if necessary.
|
| 149 |
+
# New in version 3.3.
|
| 150 |
+
|
| 151 |
+
int PyObject_GenericSetDict(object o, object value, void *context) except -1
|
| 152 |
+
# A generic implementation for the setter of a __dict__ descriptor. This
|
| 153 |
+
# implementation does not allow the dictionary to be deleted.
|
| 154 |
+
# New in version 3.3.
|
| 155 |
+
|
| 156 |
+
int Py_LT, Py_LE, Py_EQ, Py_NE, Py_GT, Py_GE
|
| 157 |
+
|
| 158 |
+
object PyObject_RichCompare(object o1, object o2, int opid)
|
| 159 |
+
# Return value: New reference.
|
| 160 |
+
# Compare the values of o1 and o2 using the operation specified by
|
| 161 |
+
# opid, which must be one of Py_LT, Py_LE, Py_EQ, Py_NE, Py_GT, or
|
| 162 |
+
# Py_GE, corresponding to <, <=, ==, !=, >, or >=
|
| 163 |
+
# respectively. This is the equivalent of the Python expression
|
| 164 |
+
# "o1 op o2", where op is the operator corresponding to
|
| 165 |
+
# opid. Returns the value of the comparison on success, or NULL on
|
| 166 |
+
# failure.
|
| 167 |
+
|
| 168 |
+
bint PyObject_RichCompareBool(object o1, object o2, int opid) except -1
|
| 169 |
+
# Compare the values of o1 and o2 using the operation specified by
|
| 170 |
+
# opid, which must be one of Py_LT, Py_LE, Py_EQ, Py_NE, Py_GT, or
|
| 171 |
+
# Py_GE, corresponding to <, <=, ==, !=, >, or >=
|
| 172 |
+
# respectively. Returns -1 on error, 0 if the result is false, 1
|
| 173 |
+
# otherwise. This is the equivalent of the Python expression "o1
|
| 174 |
+
# op o2", where op is the operator corresponding to opid.
|
| 175 |
+
|
| 176 |
+
int PyObject_Cmp(object o1, object o2, int *result) except -1
|
| 177 |
+
# Compare the values of o1 and o2 using a routine provided by o1,
|
| 178 |
+
# if one exists, otherwise with a routine provided by o2. The
|
| 179 |
+
# result of the comparison is returned in result. Returns -1 on
|
| 180 |
+
# failure. This is the equivalent of the Python statement "result
|
| 181 |
+
# = cmp(o1, o2)".
|
| 182 |
+
|
| 183 |
+
int PyObject_Compare(object o1, object o2) except *
|
| 184 |
+
# Compare the values of o1 and o2 using a routine provided by o1,
|
| 185 |
+
# if one exists, otherwise with a routine provided by o2. Returns
|
| 186 |
+
# the result of the comparison on success. On error, the value
|
| 187 |
+
# returned is undefined; use PyErr_Occurred() to detect an
|
| 188 |
+
# error. This is equivalent to the Python expression "cmp(o1,
|
| 189 |
+
# o2)".
|
| 190 |
+
|
| 191 |
+
object PyObject_Repr(object o)
|
| 192 |
+
# Return value: New reference.
|
| 193 |
+
# Compute a string representation of object o. Returns the string
|
| 194 |
+
# representation on success, NULL on failure. This is the
|
| 195 |
+
# equivalent of the Python expression "repr(o)". Called by the
|
| 196 |
+
# repr() built-in function and by reverse quotes.
|
| 197 |
+
|
| 198 |
+
object PyObject_Str(object o)
|
| 199 |
+
# Return value: New reference.
|
| 200 |
+
# Compute a string representation of object o. Returns the string
|
| 201 |
+
# representation on success, NULL on failure. This is the
|
| 202 |
+
# equivalent of the Python expression "str(o)". Called by the
|
| 203 |
+
# str() built-in function and by the print statement.
|
| 204 |
+
|
| 205 |
+
object PyObject_Bytes(object o)
|
| 206 |
+
# Return value: New reference.
|
| 207 |
+
# Compute a bytes representation of object o. Return NULL on
|
| 208 |
+
# failure and a bytes object on success. This is equivalent to
|
| 209 |
+
# the Python expression bytes(o), when o is not an integer.
|
| 210 |
+
# Unlike bytes(o), a TypeError is raised when o is an integer
|
| 211 |
+
# instead of a zero-initialized bytes object.
|
| 212 |
+
|
| 213 |
+
object PyObject_Unicode(object o)
|
| 214 |
+
# Return value: New reference.
|
| 215 |
+
# Compute a Unicode string representation of object o. Returns the
|
| 216 |
+
# Unicode string representation on success, NULL on failure. This
|
| 217 |
+
# is the equivalent of the Python expression "unicode(o)". Called
|
| 218 |
+
# by the unicode() built-in function.
|
| 219 |
+
|
| 220 |
+
bint PyObject_IsInstance(object inst, object cls) except -1
|
| 221 |
+
# Returns 1 if inst is an instance of the class cls or a subclass
|
| 222 |
+
# of cls, or 0 if not. On error, returns -1 and sets an
|
| 223 |
+
# exception. If cls is a type object rather than a class object,
|
| 224 |
+
# PyObject_IsInstance() returns 1 if inst is of type cls. If cls
|
| 225 |
+
# is a tuple, the check will be done against every entry in
|
| 226 |
+
# cls. The result will be 1 when at least one of the checks
|
| 227 |
+
# returns 1, otherwise it will be 0. If inst is not a class
|
| 228 |
+
# instance and cls is neither a type object, nor a class object,
|
| 229 |
+
# nor a tuple, inst must have a __class__ attribute -- the class
|
| 230 |
+
# relationship of the value of that attribute with cls will be
|
| 231 |
+
# used to determine the result of this function.
|
| 232 |
+
|
| 233 |
+
# Subclass determination is done in a fairly straightforward way,
|
| 234 |
+
# but includes a wrinkle that implementors of extensions to the
|
| 235 |
+
# class system may want to be aware of. If A and B are class
|
| 236 |
+
# objects, B is a subclass of A if it inherits from A either
|
| 237 |
+
# directly or indirectly. If either is not a class object, a more
|
| 238 |
+
# general mechanism is used to determine the class relationship of
|
| 239 |
+
# the two objects. When testing if B is a subclass of A, if A is
|
| 240 |
+
# B, PyObject_IsSubclass() returns true. If A and B are different
|
| 241 |
+
# objects, B's __bases__ attribute is searched in a depth-first
|
| 242 |
+
# fashion for A -- the presence of the __bases__ attribute is
|
| 243 |
+
# considered sufficient for this determination.
|
| 244 |
+
|
| 245 |
+
bint PyObject_IsSubclass(object derived, object cls) except -1
|
| 246 |
+
# Returns 1 if the class derived is identical to or derived from
|
| 247 |
+
# the class cls, otherwise returns 0. In case of an error, returns
|
| 248 |
+
# -1. If cls is a tuple, the check will be done against every
|
| 249 |
+
# entry in cls. The result will be 1 when at least one of the
|
| 250 |
+
# checks returns 1, otherwise it will be 0. If either derived or
|
| 251 |
+
# cls is not an actual class object (or tuple), this function uses
|
| 252 |
+
# the generic algorithm described above. New in version
|
| 253 |
+
# 2.1. Changed in version 2.3: Older versions of Python did not
|
| 254 |
+
# support a tuple as the second argument.
|
| 255 |
+
|
| 256 |
+
bint PyCallable_Check(object o)
|
| 257 |
+
# Determine if the object o is callable. Return 1 if the object is
|
| 258 |
+
# callable and 0 otherwise. This function always succeeds.
|
| 259 |
+
|
| 260 |
+
object PyObject_Call(object callable_object, object args, object kw)
|
| 261 |
+
# Return value: New reference.
|
| 262 |
+
# Call a callable Python object callable_object, with arguments
|
| 263 |
+
# given by the tuple args, and named arguments given by the
|
| 264 |
+
# dictionary kw. If no named arguments are needed, kw may be
|
| 265 |
+
# NULL. args must not be NULL, use an empty tuple if no arguments
|
| 266 |
+
# are needed. Returns the result of the call on success, or NULL
|
| 267 |
+
# on failure. This is the equivalent of the Python expression
|
| 268 |
+
# "apply(callable_object, args, kw)" or "callable_object(*args,
|
| 269 |
+
# **kw)".
|
| 270 |
+
|
| 271 |
+
object PyObject_CallObject(object callable_object, object args)
|
| 272 |
+
# Return value: New reference.
|
| 273 |
+
# Call a callable Python object callable_object, with arguments
|
| 274 |
+
# given by the tuple args. If no arguments are needed, then args
|
| 275 |
+
# may be NULL. Returns the result of the call on success, or NULL
|
| 276 |
+
# on failure. This is the equivalent of the Python expression
|
| 277 |
+
# "apply(callable_object, args)" or "callable_object(*args)".
|
| 278 |
+
|
| 279 |
+
object PyObject_CallFunction(object callable, char *format, ...)
|
| 280 |
+
# Return value: New reference.
|
| 281 |
+
# Call a callable Python object callable, with a variable number
|
| 282 |
+
# of C arguments. The C arguments are described using a
|
| 283 |
+
# Py_BuildValue() style format string. The format may be NULL,
|
| 284 |
+
# indicating that no arguments are provided. Returns the result of
|
| 285 |
+
# the call on success, or NULL on failure. This is the equivalent
|
| 286 |
+
# of the Python expression "apply(callable, args)" or
|
| 287 |
+
# "callable(*args)". Note that if you only pass object args,
|
| 288 |
+
# PyObject_CallFunctionObjArgs is a faster alternative.
|
| 289 |
+
|
| 290 |
+
object PyObject_CallMethod(object o, char *method, char *format, ...)
|
| 291 |
+
# Return value: New reference.
|
| 292 |
+
# Call the method named method of object o with a variable number
|
| 293 |
+
# of C arguments. The C arguments are described by a
|
| 294 |
+
# Py_BuildValue() format string that should produce a tuple. The
|
| 295 |
+
# format may be NULL, indicating that no arguments are
|
| 296 |
+
# provided. Returns the result of the call on success, or NULL on
|
| 297 |
+
# failure. This is the equivalent of the Python expression
|
| 298 |
+
# "o.method(args)". Note that if you only pass object args,
|
| 299 |
+
# PyObject_CallMethodObjArgs is a faster alternative.
|
| 300 |
+
|
| 301 |
+
#object PyObject_CallFunctionObjArgs(object callable, ..., NULL)
|
| 302 |
+
object PyObject_CallFunctionObjArgs(object callable, ...)
|
| 303 |
+
# Return value: New reference.
|
| 304 |
+
# Call a callable Python object callable, with a variable number
|
| 305 |
+
# of PyObject* arguments. The arguments are provided as a variable
|
| 306 |
+
# number of parameters followed by NULL. Returns the result of the
|
| 307 |
+
# call on success, or NULL on failure.
|
| 308 |
+
|
| 309 |
+
#PyObject* PyObject_CallMethodObjArgs(object o, object name, ..., NULL)
|
| 310 |
+
object PyObject_CallMethodObjArgs(object o, object name, ...)
|
| 311 |
+
# Return value: New reference.
|
| 312 |
+
# Calls a method of the object o, where the name of the method is
|
| 313 |
+
# given as a Python string object in name. It is called with a
|
| 314 |
+
# variable number of PyObject* arguments. The arguments are
|
| 315 |
+
# provided as a variable number of parameters followed by
|
| 316 |
+
# NULL. Returns the result of the call on success, or NULL on
|
| 317 |
+
# failure.
|
| 318 |
+
|
| 319 |
+
long PyObject_Hash(object o) except? -1
|
| 320 |
+
# Compute and return the hash value of an object o. On failure,
|
| 321 |
+
# return -1. This is the equivalent of the Python expression
|
| 322 |
+
# "hash(o)".
|
| 323 |
+
|
| 324 |
+
bint PyObject_IsTrue(object o) except -1
|
| 325 |
+
# Returns 1 if the object o is considered to be true, and 0
|
| 326 |
+
# otherwise. This is equivalent to the Python expression "not not
|
| 327 |
+
# o". On failure, return -1.
|
| 328 |
+
|
| 329 |
+
bint PyObject_Not(object o) except -1
|
| 330 |
+
# Returns 0 if the object o is considered to be true, and 1
|
| 331 |
+
# otherwise. This is equivalent to the Python expression "not
|
| 332 |
+
# o". On failure, return -1.
|
| 333 |
+
|
| 334 |
+
object PyObject_Type(object o)
|
| 335 |
+
# Return value: New reference.
|
| 336 |
+
# When o is non-NULL, returns a type object corresponding to the
|
| 337 |
+
# object type of object o. On failure, raises SystemError and
|
| 338 |
+
# returns NULL. This is equivalent to the Python expression
|
| 339 |
+
# type(o). This function increments the reference count of the
|
| 340 |
+
# return value. There's really no reason to use this function
|
| 341 |
+
# instead of the common expression o->ob_type, which returns a
|
| 342 |
+
# pointer of type PyTypeObject*, except when the incremented
|
| 343 |
+
# reference count is needed.
|
| 344 |
+
|
| 345 |
+
bint PyObject_TypeCheck(object o, PyTypeObject *type)
|
| 346 |
+
# Return true if the object o is of type type or a subtype of
|
| 347 |
+
# type. Both parameters must be non-NULL.
|
| 348 |
+
|
| 349 |
+
Py_ssize_t PyObject_Length(object o) except -1
|
| 350 |
+
Py_ssize_t PyObject_Size(object o) except -1
|
| 351 |
+
# Return the length of object o. If the object o provides either
|
| 352 |
+
# the sequence and mapping protocols, the sequence length is
|
| 353 |
+
# returned. On error, -1 is returned. This is the equivalent to
|
| 354 |
+
# the Python expression "len(o)".
|
| 355 |
+
|
| 356 |
+
Py_ssize_t PyObject_LengthHint(object o, Py_ssize_t default) except -1
|
| 357 |
+
# Return an estimated length for the object o. First try to return its
|
| 358 |
+
# actual length, then an estimate using __length_hint__(), and finally
|
| 359 |
+
# return the default value. On error, return -1. This is the equivalent to
|
| 360 |
+
# the Python expression "operator.length_hint(o, default)".
|
| 361 |
+
# New in version 3.4.
|
| 362 |
+
|
| 363 |
+
object PyObject_GetItem(object o, object key)
|
| 364 |
+
# Return value: New reference.
|
| 365 |
+
# Return element of o corresponding to the object key or NULL on
|
| 366 |
+
# failure. This is the equivalent of the Python expression
|
| 367 |
+
# "o[key]".
|
| 368 |
+
|
| 369 |
+
int PyObject_SetItem(object o, object key, object v) except -1
|
| 370 |
+
# Map the object key to the value v. Returns -1 on failure. This
|
| 371 |
+
# is the equivalent of the Python statement "o[key] = v".
|
| 372 |
+
|
| 373 |
+
int PyObject_DelItem(object o, object key) except -1
|
| 374 |
+
# Delete the mapping for key from o. Returns -1 on failure. This
|
| 375 |
+
# is the equivalent of the Python statement "del o[key]".
|
| 376 |
+
|
| 377 |
+
int PyObject_AsFileDescriptor(object o) except -1
|
| 378 |
+
# Derives a file-descriptor from a Python object. If the object is
|
| 379 |
+
# an integer or long integer, its value is returned. If not, the
|
| 380 |
+
# object's fileno() method is called if it exists; the method must
|
| 381 |
+
# return an integer or long integer, which is returned as the file
|
| 382 |
+
# descriptor value. Returns -1 on failure.
|
| 383 |
+
|
| 384 |
+
object PyObject_Dir(object o)
|
| 385 |
+
# Return value: New reference.
|
| 386 |
+
# This is equivalent to the Python expression "dir(o)", returning
|
| 387 |
+
# a (possibly empty) list of strings appropriate for the object
|
| 388 |
+
# argument, or NULL if there was an error. If the argument is
|
| 389 |
+
# NULL, this is like the Python "dir()", returning the names of
|
| 390 |
+
# the current locals; in this case, if no execution frame is
|
| 391 |
+
# active then NULL is returned but PyErr_Occurred() will return
|
| 392 |
+
# false.
|
| 393 |
+
|
| 394 |
+
object PyObject_GetIter(object o)
|
| 395 |
+
# Return value: New reference.
|
| 396 |
+
# This is equivalent to the Python expression "iter(o)". It
|
| 397 |
+
# returns a new iterator for the object argument, or the object
|
| 398 |
+
# itself if the object is already an iterator. Raises TypeError
|
| 399 |
+
# and returns NULL if the object cannot be iterated.
|
| 400 |
+
|
| 401 |
+
Py_ssize_t Py_SIZE(object o)
|
| 402 |
+
|
| 403 |
+
object PyObject_Format(object obj, object format_spec)
|
| 404 |
+
# Takes an arbitrary object and returns the result of calling
|
| 405 |
+
# obj.__format__(format_spec).
|
| 406 |
+
# Added in Py2.6
|
| 407 |
+
|
| 408 |
+
# Type flags (tp_flags of PyTypeObject)
|
| 409 |
+
long Py_TPFLAGS_HAVE_GETCHARBUFFER
|
| 410 |
+
long Py_TPFLAGS_HAVE_SEQUENCE_IN
|
| 411 |
+
long Py_TPFLAGS_HAVE_INPLACEOPS
|
| 412 |
+
long Py_TPFLAGS_CHECKTYPES
|
| 413 |
+
long Py_TPFLAGS_HAVE_RICHCOMPARE
|
| 414 |
+
long Py_TPFLAGS_HAVE_WEAKREFS
|
| 415 |
+
long Py_TPFLAGS_HAVE_ITER
|
| 416 |
+
long Py_TPFLAGS_HAVE_CLASS
|
| 417 |
+
long Py_TPFLAGS_HEAPTYPE
|
| 418 |
+
long Py_TPFLAGS_BASETYPE
|
| 419 |
+
long Py_TPFLAGS_READY
|
| 420 |
+
long Py_TPFLAGS_READYING
|
| 421 |
+
long Py_TPFLAGS_HAVE_GC
|
| 422 |
+
long Py_TPFLAGS_HAVE_STACKLESS_EXTENSION
|
| 423 |
+
long Py_TPFLAGS_HAVE_INDEX
|
| 424 |
+
long Py_TPFLAGS_HAVE_VERSION_TAG
|
| 425 |
+
long Py_TPFLAGS_VALID_VERSION_TAG
|
| 426 |
+
long Py_TPFLAGS_IS_ABSTRACT
|
| 427 |
+
long Py_TPFLAGS_HAVE_NEWBUFFER
|
| 428 |
+
long Py_TPFLAGS_INT_SUBCLASS
|
| 429 |
+
long Py_TPFLAGS_LONG_SUBCLASS
|
| 430 |
+
long Py_TPFLAGS_LIST_SUBCLASS
|
| 431 |
+
long Py_TPFLAGS_TUPLE_SUBCLASS
|
| 432 |
+
long Py_TPFLAGS_STRING_SUBCLASS
|
| 433 |
+
long Py_TPFLAGS_UNICODE_SUBCLASS
|
| 434 |
+
long Py_TPFLAGS_DICT_SUBCLASS
|
| 435 |
+
long Py_TPFLAGS_BASE_EXC_SUBCLASS
|
| 436 |
+
long Py_TPFLAGS_TYPE_SUBCLASS
|
| 437 |
+
long Py_TPFLAGS_DEFAULT_EXTERNAL
|
| 438 |
+
long Py_TPFLAGS_DEFAULT_CORE
|
| 439 |
+
long Py_TPFLAGS_DEFAULT
|
| 440 |
+
long Py_TPFLAGS_HAVE_FINALIZE
|
tuning-competition-baseline/.venv/lib/python3.11/site-packages/Cython/Includes/cpython/oldbuffer.pxd
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Legacy Python 2 buffer interface.
|
| 2 |
+
#
|
| 3 |
+
# These functions are no longer available in Python 3, use the new
|
| 4 |
+
# buffer interface instead.
|
| 5 |
+
|
| 6 |
+
cdef extern from "Python.h":
|
| 7 |
+
cdef enum _:
|
| 8 |
+
Py_END_OF_BUFFER
|
| 9 |
+
# This constant may be passed as the size parameter to
|
| 10 |
+
# PyBuffer_FromObject() or PyBuffer_FromReadWriteObject(). It
|
| 11 |
+
# indicates that the new PyBufferObject should refer to base object
|
| 12 |
+
# from the specified offset to the end of its exported
|
| 13 |
+
# buffer. Using this enables the caller to avoid querying the base
|
| 14 |
+
# object for its length.
|
| 15 |
+
|
| 16 |
+
bint PyBuffer_Check(object p)
|
| 17 |
+
# Return true if the argument has type PyBuffer_Type.
|
| 18 |
+
|
| 19 |
+
object PyBuffer_FromObject(object base, Py_ssize_t offset, Py_ssize_t size)
|
| 20 |
+
# Return value: New reference.
|
| 21 |
+
#
|
| 22 |
+
# Return a new read-only buffer object. This raises TypeError if
|
| 23 |
+
# base doesn't support the read-only buffer protocol or doesn't
|
| 24 |
+
# provide exactly one buffer segment, or it raises ValueError if
|
| 25 |
+
# offset is less than zero. The buffer will hold a reference to the
|
| 26 |
+
# base object, and the buffer's contents will refer to the base
|
| 27 |
+
# object's buffer interface, starting as position offset and
|
| 28 |
+
# extending for size bytes. If size is Py_END_OF_BUFFER, then the
|
| 29 |
+
# new buffer's contents extend to the length of the base object's
|
| 30 |
+
# exported buffer data.
|
| 31 |
+
|
| 32 |
+
object PyBuffer_FromReadWriteObject(object base, Py_ssize_t offset, Py_ssize_t size)
|
| 33 |
+
# Return value: New reference.
|
| 34 |
+
#
|
| 35 |
+
# Return a new writable buffer object. Parameters and exceptions
|
| 36 |
+
# are similar to those for PyBuffer_FromObject(). If the base
|
| 37 |
+
# object does not export the writeable buffer protocol, then
|
| 38 |
+
# TypeError is raised.
|
| 39 |
+
|
| 40 |
+
object PyBuffer_FromMemory(void *ptr, Py_ssize_t size)
|
| 41 |
+
# Return value: New reference.
|
| 42 |
+
#
|
| 43 |
+
# Return a new read-only buffer object that reads from a specified
|
| 44 |
+
# location in memory, with a specified size. The caller is
|
| 45 |
+
# responsible for ensuring that the memory buffer, passed in as
|
| 46 |
+
# ptr, is not deallocated while the returned buffer object
|
| 47 |
+
# exists. Raises ValueError if size is less than zero. Note that
|
| 48 |
+
# Py_END_OF_BUFFER may not be passed for the size parameter;
|
| 49 |
+
# ValueError will be raised in that case.
|
| 50 |
+
|
| 51 |
+
object PyBuffer_FromReadWriteMemory(void *ptr, Py_ssize_t size)
|
| 52 |
+
# Return value: New reference.
|
| 53 |
+
#
|
| 54 |
+
# Similar to PyBuffer_FromMemory(), but the returned buffer is
|
| 55 |
+
# writable.
|
| 56 |
+
|
| 57 |
+
object PyBuffer_New(Py_ssize_t size)
|
| 58 |
+
# Return value: New reference.
|
| 59 |
+
#
|
| 60 |
+
# Return a new writable buffer object that maintains its own memory
|
| 61 |
+
# buffer of size bytes. ValueError is returned if size is not zero
|
| 62 |
+
# or positive. Note that the memory buffer (as returned by
|
| 63 |
+
# PyObject_AsWriteBuffer()) is not specifically aligned.
|
tuning-competition-baseline/.venv/lib/python3.11/site-packages/Cython/Includes/cpython/pycapsule.pxd
ADDED
|
@@ -0,0 +1,143 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
# available since Python 2.7!
|
| 3 |
+
|
| 4 |
+
|
| 5 |
+
cdef extern from "Python.h":
|
| 6 |
+
|
| 7 |
+
ctypedef struct PyCapsule_Type
|
| 8 |
+
# This subtype of PyObject represents an opaque value, useful for
|
| 9 |
+
# C extension modules who need to pass an opaque value (as a void*
|
| 10 |
+
# pointer) through Python code to other C code. It is often used
|
| 11 |
+
# to make a C function pointer defined in one module available to
|
| 12 |
+
# other modules, so the regular import mechanism can be used to
|
| 13 |
+
# access C APIs defined in dynamically loaded modules.
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
ctypedef void (*PyCapsule_Destructor)(object o) noexcept
|
| 17 |
+
# The type of a destructor callback for a capsule.
|
| 18 |
+
#
|
| 19 |
+
# See PyCapsule_New() for the semantics of PyCapsule_Destructor
|
| 20 |
+
# callbacks.
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
bint PyCapsule_CheckExact(object o)
|
| 24 |
+
# Return true if its argument is a PyCapsule.
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
object PyCapsule_New(void *pointer, const char *name,
|
| 28 |
+
PyCapsule_Destructor destructor)
|
| 29 |
+
# Return value: New reference.
|
| 30 |
+
#
|
| 31 |
+
# Create a PyCapsule encapsulating the pointer. The pointer
|
| 32 |
+
# argument may not be NULL.
|
| 33 |
+
#
|
| 34 |
+
# On failure, set an exception and return NULL.
|
| 35 |
+
#
|
| 36 |
+
# The name string may either be NULL or a pointer to a valid C
|
| 37 |
+
# string. If non-NULL, this string must outlive the
|
| 38 |
+
# capsule. (Though it is permitted to free it inside the
|
| 39 |
+
# destructor.)
|
| 40 |
+
#
|
| 41 |
+
# If the destructor argument is not NULL, it will be called with
|
| 42 |
+
# the capsule as its argument when it is destroyed.
|
| 43 |
+
#
|
| 44 |
+
# If this capsule will be stored as an attribute of a module, the
|
| 45 |
+
# name should be specified as modulename.attributename. This will
|
| 46 |
+
# enable other modules to import the capsule using
|
| 47 |
+
# PyCapsule_Import().
|
| 48 |
+
|
| 49 |
+
|
| 50 |
+
void* PyCapsule_GetPointer(object capsule, const char *name) except? NULL
|
| 51 |
+
# Retrieve the pointer stored in the capsule. On failure, set an
|
| 52 |
+
# exception and return NULL.
|
| 53 |
+
#
|
| 54 |
+
# The name parameter must compare exactly to the name stored in
|
| 55 |
+
# the capsule. If the name stored in the capsule is NULL, the name
|
| 56 |
+
# passed in must also be NULL. Python uses the C function strcmp()
|
| 57 |
+
# to compare capsule names.
|
| 58 |
+
|
| 59 |
+
|
| 60 |
+
PyCapsule_Destructor PyCapsule_GetDestructor(object capsule) except? NULL
|
| 61 |
+
# Return the current destructor stored in the capsule. On failure,
|
| 62 |
+
# set an exception and return NULL.
|
| 63 |
+
#
|
| 64 |
+
# It is legal for a capsule to have a NULL destructor. This makes
|
| 65 |
+
# a NULL return code somewhat ambiguous; use PyCapsule_IsValid()
|
| 66 |
+
# or PyErr_Occurred() to disambiguate.
|
| 67 |
+
|
| 68 |
+
|
| 69 |
+
const char* PyCapsule_GetName(object capsule) except? NULL
|
| 70 |
+
# Return the current name stored in the capsule. On failure, set
|
| 71 |
+
# an exception and return NULL.
|
| 72 |
+
#
|
| 73 |
+
# It is legal for a capsule to have a NULL name. This makes a NULL
|
| 74 |
+
# return code somewhat ambiguous; use PyCapsule_IsValid() or
|
| 75 |
+
# PyErr_Occurred() to disambiguate.
|
| 76 |
+
|
| 77 |
+
|
| 78 |
+
void* PyCapsule_GetContext(object capsule) except? NULL
|
| 79 |
+
# Return the current context stored in the capsule. On failure,
|
| 80 |
+
# set an exception and return NULL.
|
| 81 |
+
#
|
| 82 |
+
# It is legal for a capsule to have a NULL context. This makes a
|
| 83 |
+
# NULL return code somewhat ambiguous; use PyCapsule_IsValid() or
|
| 84 |
+
# PyErr_Occurred() to disambiguate.
|
| 85 |
+
|
| 86 |
+
|
| 87 |
+
bint PyCapsule_IsValid(object capsule, const char *name)
|
| 88 |
+
# Determines whether or not capsule is a valid capsule. A valid
|
| 89 |
+
# capsule is non-NULL, passes PyCapsule_CheckExact(), has a
|
| 90 |
+
# non-NULL pointer stored in it, and its internal name matches the
|
| 91 |
+
# name parameter. (See PyCapsule_GetPointer() for information on
|
| 92 |
+
# how capsule names are compared.)
|
| 93 |
+
#
|
| 94 |
+
# In other words, if PyCapsule_IsValid() returns a true value,
|
| 95 |
+
# calls to any of the accessors (any function starting with
|
| 96 |
+
# PyCapsule_Get()) are guaranteed to succeed.
|
| 97 |
+
#
|
| 98 |
+
# Return a nonzero value if the object is valid and matches the
|
| 99 |
+
# name passed in. Return 0 otherwise. This function will not fail.
|
| 100 |
+
|
| 101 |
+
|
| 102 |
+
int PyCapsule_SetPointer(object capsule, void *pointer) except -1
|
| 103 |
+
# Set the void pointer inside capsule to pointer. The pointer may
|
| 104 |
+
# not be NULL.
|
| 105 |
+
#
|
| 106 |
+
# Return 0 on success. Return nonzero and set an exception on
|
| 107 |
+
# failure.
|
| 108 |
+
|
| 109 |
+
|
| 110 |
+
int PyCapsule_SetDestructor(object capsule, PyCapsule_Destructor destructor) except -1
|
| 111 |
+
# Set the destructor inside capsule to destructor.
|
| 112 |
+
#
|
| 113 |
+
# Return 0 on success. Return nonzero and set an exception on
|
| 114 |
+
# failure.
|
| 115 |
+
|
| 116 |
+
|
| 117 |
+
int PyCapsule_SetName(object capsule, const char *name) except -1
|
| 118 |
+
# Set the name inside capsule to name. If non-NULL, the name must
|
| 119 |
+
# outlive the capsule. If the previous name stored in the capsule
|
| 120 |
+
# was not NULL, no attempt is made to free it.
|
| 121 |
+
#
|
| 122 |
+
# Return 0 on success. Return nonzero and set an exception on
|
| 123 |
+
# failure.
|
| 124 |
+
|
| 125 |
+
|
| 126 |
+
int PyCapsule_SetContext(object capsule, void *context) except -1
|
| 127 |
+
# Set the context pointer inside capsule to context. Return 0 on
|
| 128 |
+
# success. Return nonzero and set an exception on failure.
|
| 129 |
+
|
| 130 |
+
|
| 131 |
+
void* PyCapsule_Import(const char *name, int no_block) except? NULL
|
| 132 |
+
# Import a pointer to a C object from a capsule attribute in a
|
| 133 |
+
# module. The name parameter should specify the full name to the
|
| 134 |
+
# attribute, as in module.attribute. The name stored in the
|
| 135 |
+
# capsule must match this string exactly. If no_block is true,
|
| 136 |
+
# import the module without blocking (using
|
| 137 |
+
# PyImport_ImportModuleNoBlock()). If no_block is false, import
|
| 138 |
+
# the module conventionally (using PyImport_ImportModule()).
|
| 139 |
+
#
|
| 140 |
+
# Return the capsule’s internal pointer on success. On failure,
|
| 141 |
+
# set an exception and return NULL. However, if PyCapsule_Import()
|
| 142 |
+
# failed to import the module, and no_block was true, no exception
|
| 143 |
+
# is set.
|
tuning-competition-baseline/.venv/lib/python3.11/site-packages/Cython/Includes/cpython/pyport.pxd
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
cdef extern from "Python.h":
|
| 2 |
+
ctypedef int int32_t
|
| 3 |
+
ctypedef int int64_t
|
| 4 |
+
ctypedef unsigned int uint32_t
|
| 5 |
+
ctypedef unsigned int uint64_t
|
| 6 |
+
|
| 7 |
+
const Py_ssize_t PY_SSIZE_T_MIN
|
| 8 |
+
const Py_ssize_t PY_SSIZE_T_MAX
|
tuning-competition-baseline/.venv/lib/python3.11/site-packages/Cython/Includes/cpython/pystate.pxd
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Thread and interpreter state structures and their interfaces
|
| 2 |
+
|
| 3 |
+
from .object cimport PyObject
|
| 4 |
+
|
| 5 |
+
cdef extern from "Python.h":
|
| 6 |
+
|
| 7 |
+
# We make these an opaque types. If the user wants specific attributes,
|
| 8 |
+
# they can be declared manually.
|
| 9 |
+
|
| 10 |
+
ctypedef long PY_INT64_T # FIXME: Py2.7+, not defined here but used here
|
| 11 |
+
|
| 12 |
+
ctypedef struct PyInterpreterState:
|
| 13 |
+
pass
|
| 14 |
+
|
| 15 |
+
ctypedef struct PyThreadState:
|
| 16 |
+
pass
|
| 17 |
+
|
| 18 |
+
ctypedef struct PyFrameObject:
|
| 19 |
+
pass
|
| 20 |
+
|
| 21 |
+
# This is not actually a struct, but make sure it can never be coerced to
|
| 22 |
+
# an int or used in arithmetic expressions
|
| 23 |
+
ctypedef struct PyGILState_STATE:
|
| 24 |
+
pass
|
| 25 |
+
|
| 26 |
+
# The type of the trace function registered using PyEval_SetProfile() and
|
| 27 |
+
# PyEval_SetTrace().
|
| 28 |
+
# Py_tracefunc return -1 when raising an exception, or 0 for success.
|
| 29 |
+
ctypedef int (*Py_tracefunc)(PyObject *, PyFrameObject *, int, PyObject *)
|
| 30 |
+
|
| 31 |
+
# The following values are used for 'what' for tracefunc functions
|
| 32 |
+
enum:
|
| 33 |
+
PyTrace_CALL
|
| 34 |
+
PyTrace_EXCEPTION
|
| 35 |
+
PyTrace_LINE
|
| 36 |
+
PyTrace_RETURN
|
| 37 |
+
PyTrace_C_CALL
|
| 38 |
+
PyTrace_C_EXCEPTION
|
| 39 |
+
PyTrace_C_RETURN
|
| 40 |
+
|
| 41 |
+
|
| 42 |
+
PyInterpreterState * PyInterpreterState_New()
|
| 43 |
+
void PyInterpreterState_Clear(PyInterpreterState *)
|
| 44 |
+
void PyInterpreterState_Delete(PyInterpreterState *)
|
| 45 |
+
PY_INT64_T PyInterpreterState_GetID(PyInterpreterState *)
|
| 46 |
+
|
| 47 |
+
PyThreadState * PyThreadState_New(PyInterpreterState *)
|
| 48 |
+
void PyThreadState_Clear(PyThreadState *)
|
| 49 |
+
void PyThreadState_Delete(PyThreadState *)
|
| 50 |
+
|
| 51 |
+
PyThreadState * PyThreadState_Get()
|
| 52 |
+
PyThreadState * PyThreadState_Swap(PyThreadState *) # NOTE: DO NOT USE IN CYTHON CODE !
|
| 53 |
+
PyObject * PyThreadState_GetDict()
|
| 54 |
+
int PyThreadState_SetAsyncExc(long, PyObject *)
|
| 55 |
+
|
| 56 |
+
# Ensure that the current thread is ready to call the Python
|
| 57 |
+
# C API, regardless of the current state of Python, or of its
|
| 58 |
+
# thread lock. This may be called as many times as desired
|
| 59 |
+
# by a thread so long as each call is matched with a call to
|
| 60 |
+
# PyGILState_Release(). In general, other thread-state APIs may
|
| 61 |
+
# be used between _Ensure() and _Release() calls, so long as the
|
| 62 |
+
# thread-state is restored to its previous state before the Release().
|
| 63 |
+
# For example, normal use of the Py_BEGIN_ALLOW_THREADS/
|
| 64 |
+
# Py_END_ALLOW_THREADS macros are acceptable.
|
| 65 |
+
|
| 66 |
+
# The return value is an opaque "handle" to the thread state when
|
| 67 |
+
# PyGILState_Ensure() was called, and must be passed to
|
| 68 |
+
# PyGILState_Release() to ensure Python is left in the same state. Even
|
| 69 |
+
# though recursive calls are allowed, these handles can *not* be shared -
|
| 70 |
+
# each unique call to PyGILState_Ensure must save the handle for its
|
| 71 |
+
# call to PyGILState_Release.
|
| 72 |
+
|
| 73 |
+
# When the function returns, the current thread will hold the GIL.
|
| 74 |
+
|
| 75 |
+
# Failure is a fatal error.
|
| 76 |
+
PyGILState_STATE PyGILState_Ensure()
|
| 77 |
+
|
| 78 |
+
# Release any resources previously acquired. After this call, Python's
|
| 79 |
+
# state will be the same as it was prior to the corresponding
|
| 80 |
+
# PyGILState_Ensure() call (but generally this state will be unknown to
|
| 81 |
+
# the caller, hence the use of the GILState API.)
|
| 82 |
+
|
| 83 |
+
# Every call to PyGILState_Ensure must be matched by a call to
|
| 84 |
+
# PyGILState_Release on the same thread.
|
| 85 |
+
void PyGILState_Release(PyGILState_STATE)
|
| 86 |
+
|
| 87 |
+
# Return 1 if the current thread holds the GIL and 0 otherwise.
|
| 88 |
+
int PyGILState_Check()
|
| 89 |
+
|
| 90 |
+
# Routines for advanced debuggers, requested by David Beazley.
|
| 91 |
+
# Don't use unless you know what you are doing!
|
| 92 |
+
PyInterpreterState * PyInterpreterState_Head()
|
| 93 |
+
PyInterpreterState * PyInterpreterState_Next(PyInterpreterState *)
|
| 94 |
+
PyThreadState * PyInterpreterState_ThreadHead(PyInterpreterState *)
|
| 95 |
+
PyThreadState * PyThreadState_Next(PyThreadState *)
|
tuning-competition-baseline/.venv/lib/python3.11/site-packages/Cython/Includes/cpython/sequence.pxd
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from .object cimport PyObject
|
| 2 |
+
|
| 3 |
+
cdef extern from "Python.h":
|
| 4 |
+
|
| 5 |
+
############################################################################
|
| 6 |
+
# 6.3 Sequence Protocol
|
| 7 |
+
############################################################################
|
| 8 |
+
|
| 9 |
+
bint PySequence_Check(object o)
|
| 10 |
+
# Return 1 if the object provides sequence protocol, and 0
|
| 11 |
+
# otherwise. This function always succeeds.
|
| 12 |
+
|
| 13 |
+
Py_ssize_t PySequence_Size(object o) except -1
|
| 14 |
+
# Returns the number of objects in sequence o on success, and -1
|
| 15 |
+
# on failure. For objects that do not provide sequence protocol,
|
| 16 |
+
# this is equivalent to the Python expression "len(o)".
|
| 17 |
+
|
| 18 |
+
Py_ssize_t PySequence_Length(object o) except -1
|
| 19 |
+
# Alternate name for PySequence_Size().
|
| 20 |
+
|
| 21 |
+
object PySequence_Concat(object o1, object o2)
|
| 22 |
+
# Return value: New reference.
|
| 23 |
+
# Return the concatenation of o1 and o2 on success, and NULL on
|
| 24 |
+
# failure. This is the equivalent of the Python expression "o1 +
|
| 25 |
+
# o2".
|
| 26 |
+
|
| 27 |
+
object PySequence_Repeat(object o, Py_ssize_t count)
|
| 28 |
+
# Return value: New reference.
|
| 29 |
+
# Return the result of repeating sequence object o count times, or
|
| 30 |
+
# NULL on failure. This is the equivalent of the Python expression
|
| 31 |
+
# "o * count".
|
| 32 |
+
|
| 33 |
+
object PySequence_InPlaceConcat(object o1, object o2)
|
| 34 |
+
# Return value: New reference.
|
| 35 |
+
# Return the concatenation of o1 and o2 on success, and NULL on
|
| 36 |
+
# failure. The operation is done in-place when o1 supports
|
| 37 |
+
# it. This is the equivalent of the Python expression "o1 += o2".
|
| 38 |
+
|
| 39 |
+
object PySequence_InPlaceRepeat(object o, Py_ssize_t count)
|
| 40 |
+
# Return value: New reference.
|
| 41 |
+
# Return the result of repeating sequence object o count times, or
|
| 42 |
+
# NULL on failure. The operation is done in-place when o supports
|
| 43 |
+
# it. This is the equivalent of the Python expression "o *=
|
| 44 |
+
# count".
|
| 45 |
+
|
| 46 |
+
object PySequence_GetItem(object o, Py_ssize_t i)
|
| 47 |
+
# Return value: New reference.
|
| 48 |
+
# Return the ith element of o, or NULL on failure. This is the
|
| 49 |
+
# equivalent of the Python expression "o[i]".
|
| 50 |
+
|
| 51 |
+
object PySequence_GetSlice(object o, Py_ssize_t i1, Py_ssize_t i2)
|
| 52 |
+
# Return value: New reference.
|
| 53 |
+
# Return the slice of sequence object o between i1 and i2, or NULL
|
| 54 |
+
# on failure. This is the equivalent of the Python expression
|
| 55 |
+
# "o[i1:i2]".
|
| 56 |
+
|
| 57 |
+
int PySequence_SetItem(object o, Py_ssize_t i, object v) except -1
|
| 58 |
+
# Assign object v to the ith element of o. Returns -1 on
|
| 59 |
+
# failure. This is the equivalent of the Python statement "o[i] =
|
| 60 |
+
# v". This function does not steal a reference to v.
|
| 61 |
+
|
| 62 |
+
int PySequence_DelItem(object o, Py_ssize_t i) except -1
|
| 63 |
+
# Delete the ith element of object o. Returns -1 on failure. This
|
| 64 |
+
# is the equivalent of the Python statement "del o[i]".
|
| 65 |
+
|
| 66 |
+
int PySequence_SetSlice(object o, Py_ssize_t i1, Py_ssize_t i2, object v) except -1
|
| 67 |
+
# Assign the sequence object v to the slice in sequence object o
|
| 68 |
+
# from i1 to i2. This is the equivalent of the Python statement
|
| 69 |
+
# "o[i1:i2] = v".
|
| 70 |
+
|
| 71 |
+
int PySequence_DelSlice(object o, Py_ssize_t i1, Py_ssize_t i2) except -1
|
| 72 |
+
# Delete the slice in sequence object o from i1 to i2. Returns -1
|
| 73 |
+
# on failure. This is the equivalent of the Python statement "del
|
| 74 |
+
# o[i1:i2]".
|
| 75 |
+
|
| 76 |
+
int PySequence_Count(object o, object value) except -1
|
| 77 |
+
# Return the number of occurrences of value in o, that is, return
|
| 78 |
+
# the number of keys for which o[key] == value. On failure, return
|
| 79 |
+
# -1. This is equivalent to the Python expression
|
| 80 |
+
# "o.count(value)".
|
| 81 |
+
|
| 82 |
+
int PySequence_Contains(object o, object value) except -1
|
| 83 |
+
# Determine if o contains value. If an item in o is equal to
|
| 84 |
+
# value, return 1, otherwise return 0. On error, return -1. This
|
| 85 |
+
# is equivalent to the Python expression "value in o".
|
| 86 |
+
|
| 87 |
+
Py_ssize_t PySequence_Index(object o, object value) except -1
|
| 88 |
+
# Return the first index i for which o[i] == value. On error,
|
| 89 |
+
# return -1. This is equivalent to the Python expression
|
| 90 |
+
# "o.index(value)".
|
| 91 |
+
|
| 92 |
+
object PySequence_List(object o)
|
| 93 |
+
# Return value: New reference.
|
| 94 |
+
# Return a list object with the same contents as the arbitrary
|
| 95 |
+
# sequence o. The returned list is guaranteed to be new.
|
| 96 |
+
|
| 97 |
+
object PySequence_Tuple(object o)
|
| 98 |
+
# Return value: New reference.
|
| 99 |
+
# Return a tuple object with the same contents as the arbitrary
|
| 100 |
+
# sequence o or NULL on failure. If o is a tuple, a new reference
|
| 101 |
+
# will be returned, otherwise a tuple will be constructed with the
|
| 102 |
+
# appropriate contents. This is equivalent to the Python
|
| 103 |
+
# expression "tuple(o)".
|
| 104 |
+
|
| 105 |
+
object PySequence_Fast(object o, char *m)
|
| 106 |
+
# Return value: New reference.
|
| 107 |
+
# Returns the sequence o as a tuple, unless it is already a tuple
|
| 108 |
+
# or list, in which case o is returned. Use
|
| 109 |
+
# PySequence_Fast_GET_ITEM() to access the members of the
|
| 110 |
+
# result. Returns NULL on failure. If the object is not a
|
| 111 |
+
# sequence, raises TypeError with m as the message text.
|
| 112 |
+
|
| 113 |
+
PyObject* PySequence_Fast_GET_ITEM(object o, Py_ssize_t i)
|
| 114 |
+
# Return value: Borrowed reference.
|
| 115 |
+
# Return the ith element of o, assuming that o was returned by
|
| 116 |
+
# PySequence_Fast(), o is not NULL, and that i is within bounds.
|
| 117 |
+
|
| 118 |
+
PyObject** PySequence_Fast_ITEMS(object o)
|
| 119 |
+
# Return the underlying array of PyObject pointers. Assumes that o
|
| 120 |
+
# was returned by PySequence_Fast() and o is not NULL.
|
| 121 |
+
|
| 122 |
+
object PySequence_ITEM(object o, Py_ssize_t i)
|
| 123 |
+
# Return value: New reference.
|
| 124 |
+
# Return the ith element of o or NULL on failure. Macro form of
|
| 125 |
+
# PySequence_GetItem() but without checking that
|
| 126 |
+
# PySequence_Check(o) is true and without adjustment for negative
|
| 127 |
+
# indices.
|
| 128 |
+
|
| 129 |
+
Py_ssize_t PySequence_Fast_GET_SIZE(object o)
|
| 130 |
+
# Returns the length of o, assuming that o was returned by
|
| 131 |
+
# PySequence_Fast() and that o is not NULL. The size can also be
|
| 132 |
+
# gotten by calling PySequence_Size() on o, but
|
| 133 |
+
# PySequence_Fast_GET_SIZE() is faster because it can assume o is
|
| 134 |
+
# a list or tuple.
|
tuning-competition-baseline/.venv/lib/python3.11/site-packages/Cython/Includes/cpython/type.pxd
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
cdef extern from "Python.h":
|
| 3 |
+
# The C structure of the objects used to describe built-in types.
|
| 4 |
+
|
| 5 |
+
############################################################################
|
| 6 |
+
# 7.1.1 Type Objects
|
| 7 |
+
############################################################################
|
| 8 |
+
|
| 9 |
+
ctypedef class __builtin__.type [object PyTypeObject]:
|
| 10 |
+
pass
|
| 11 |
+
|
| 12 |
+
# PyObject* PyType_Type
|
| 13 |
+
# This is the type object for type objects; it is the same object
|
| 14 |
+
# as type and types.TypeType in the Python layer.
|
| 15 |
+
|
| 16 |
+
bint PyType_Check(object o)
|
| 17 |
+
# Return true if the object o is a type object, including
|
| 18 |
+
# instances of types derived from the standard type object. Return
|
| 19 |
+
# false in all other cases.
|
| 20 |
+
|
| 21 |
+
bint PyType_CheckExact(object o)
|
| 22 |
+
# Return true if the object o is a type object, but not a subtype
|
| 23 |
+
# of the standard type object. Return false in all other
|
| 24 |
+
# cases.
|
| 25 |
+
|
| 26 |
+
void PyType_Modified(type type)
|
| 27 |
+
# Invalidate the internal lookup cache for the type and all of its
|
| 28 |
+
# subtypes. This function must be called after any manual modification
|
| 29 |
+
# of the attributes or base classes of the type.
|
| 30 |
+
|
| 31 |
+
bint PyType_HasFeature(object o, int feature)
|
| 32 |
+
# Return true if the type object o sets the feature feature. Type
|
| 33 |
+
# features are denoted by single bit flags.
|
| 34 |
+
|
| 35 |
+
bint PyType_IS_GC(object o)
|
| 36 |
+
# Return true if the type object includes support for the cycle
|
| 37 |
+
# detector; this tests the type flag Py_TPFLAGS_HAVE_GC.
|
| 38 |
+
|
| 39 |
+
bint PyType_IsSubtype(type a, type b)
|
| 40 |
+
# Return true if a is a subtype of b.
|
| 41 |
+
|
| 42 |
+
object PyType_GenericAlloc(object type, Py_ssize_t nitems)
|
| 43 |
+
# Return value: New reference.
|
| 44 |
+
|
| 45 |
+
object PyType_GenericNew(type type, object args, object kwds)
|
| 46 |
+
# Return value: New reference.
|
| 47 |
+
|
| 48 |
+
bint PyType_Ready(type type) except -1
|
| 49 |
+
# Finalize a type object. This should be called on all type
|
| 50 |
+
# objects to finish their initialization. This function is
|
| 51 |
+
# responsible for adding inherited slots from a type's base
|
| 52 |
+
# class. Return 0 on success, or return -1 and sets an exception
|
| 53 |
+
# on error.
|
tuning-competition-baseline/.venv/lib/python3.11/site-packages/Cython/Includes/cpython/version.pxd
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Python version constants
|
| 2 |
+
#
|
| 3 |
+
# It's better to evaluate these at runtime (i.e. C compile time) using
|
| 4 |
+
#
|
| 5 |
+
# if PY_MAJOR_VERSION >= 3:
|
| 6 |
+
# do_stuff_in_Py3_0_and_later()
|
| 7 |
+
# if PY_VERSION_HEX >= 0x02070000:
|
| 8 |
+
# do_stuff_in_Py2_7_and_later()
|
| 9 |
+
#
|
| 10 |
+
# than using the IF/DEF statements, which are evaluated at Cython
|
| 11 |
+
# compile time. This will keep your C code portable.
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
cdef extern from *:
|
| 15 |
+
# the complete version, e.g. 0x010502B2 == 1.5.2b2
|
| 16 |
+
int PY_VERSION_HEX
|
| 17 |
+
|
| 18 |
+
# the individual sections as plain numbers
|
| 19 |
+
int PY_MAJOR_VERSION
|
| 20 |
+
int PY_MINOR_VERSION
|
| 21 |
+
int PY_MICRO_VERSION
|
| 22 |
+
int PY_RELEASE_LEVEL
|
| 23 |
+
int PY_RELEASE_SERIAL
|
| 24 |
+
|
| 25 |
+
# Note: PY_RELEASE_LEVEL is one of
|
| 26 |
+
# 0xA (alpha)
|
| 27 |
+
# 0xB (beta)
|
| 28 |
+
# 0xC (release candidate)
|
| 29 |
+
# 0xF (final)
|
| 30 |
+
|
| 31 |
+
char PY_VERSION[]
|
| 32 |
+
char PY_PATCHLEVEL_REVISION[]
|
tuning-competition-baseline/.venv/lib/python3.11/site-packages/Cython/Includes/libcpp/__init__.pxd
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
cdef extern from *:
|
| 2 |
+
ctypedef bint bool
|
| 3 |
+
ctypedef void* nullptr_t
|
| 4 |
+
nullptr_t nullptr
|
tuning-competition-baseline/.venv/lib/python3.11/site-packages/Cython/Includes/libcpp/algorithm.pxd
ADDED
|
@@ -0,0 +1,320 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from libcpp cimport bool
|
| 2 |
+
from libcpp.utility cimport pair
|
| 3 |
+
from libc.stddef import ptrdiff_t
|
| 4 |
+
|
| 5 |
+
|
| 6 |
+
cdef extern from "<algorithm>" namespace "std" nogil:
|
| 7 |
+
# Non-modifying sequence operations
|
| 8 |
+
bool all_of[Iter, Pred](Iter first, Iter last, Pred pred) except +
|
| 9 |
+
bool all_of[ExecutionPolicy, Iter, Pred](ExecutionPolicy&& policy, Iter first, Iter last, Pred pred) except +
|
| 10 |
+
bool any_of[Iter, Pred](Iter first, Iter last, Pred pred) except +
|
| 11 |
+
bool any_of[ExecutionPolicy, Iter, Pred](ExecutionPolicy&& policy, Iter first, Iter last, Pred pred) except +
|
| 12 |
+
bool none_of[Iter, Pred](Iter first, Iter last, Pred pred) except +
|
| 13 |
+
bool none_of[ExecutionPolicy, Iter, Pred](ExecutionPolicy&& policy, Iter first, Iter last, Pred pred) except +
|
| 14 |
+
|
| 15 |
+
void for_each[Iter, UnaryFunction](Iter first, Iter last, UnaryFunction f) except + # actually returns f
|
| 16 |
+
void for_each[ExecutionPolicy, Iter, UnaryFunction](ExecutionPolicy&& policy, Iter first, Iter last, UnaryFunction f) except + # actually returns f
|
| 17 |
+
|
| 18 |
+
ptrdiff_t count[Iter, T](Iter first, Iter last, const T& value) except +
|
| 19 |
+
ptrdiff_t count[ExecutionPolicy, Iter, T](ExecutionPolicy&& policy, Iter first, Iter last, const T& value) except +
|
| 20 |
+
ptrdiff_t count_if[Iter, Pred](Iter first, Iter last, Pred pred) except +
|
| 21 |
+
ptrdiff_t count_if[ExecutionPolicy, Iter, Pred](ExecutionPolicy&& policy, Iter first, Iter last, Pred pred) except +
|
| 22 |
+
|
| 23 |
+
pair[Iter1, Iter2] mismatch[Iter1, Iter2](
|
| 24 |
+
Iter1 first1, Iter1 last1, Iter2 first2) except + # other overloads are tricky
|
| 25 |
+
pair[Iter1, Iter2] mismatch[ExecutionPolicy, Iter1, Iter2](
|
| 26 |
+
ExecutionPolicy&& policy, Iter1 first1, Iter1 last1, Iter2 first2) except +
|
| 27 |
+
|
| 28 |
+
Iter find[Iter, T](Iter first, Iter last, const T& value) except +
|
| 29 |
+
Iter find[ExecutionPolicy, Iter, T](ExecutionPolicy&& policy, Iter first, Iter last, const T& value) except +
|
| 30 |
+
|
| 31 |
+
Iter find_if[Iter, Pred](Iter first, Iter last, Pred pred) except +
|
| 32 |
+
Iter find_if[ExecutionPolicy, Iter, Pred](ExecutionPolicy&& policy, Iter first, Iter last, Pred pred) except +
|
| 33 |
+
Iter find_if_not[Iter, Pred](Iter first, Iter last, Pred pred) except +
|
| 34 |
+
Iter find_if_not[ExecutionPolicy, Iter, Pred](ExecutionPolicy&& policy, Iter first, Iter last, Pred pred) except +
|
| 35 |
+
|
| 36 |
+
Iter1 find_end[Iter1, Iter2](Iter1 first1, Iter1 last1, Iter2 first2, Iter2 last2) except +
|
| 37 |
+
Iter1 find_end[ExecutionPolicy, Iter1, Iter2](ExecutionPolicy&& policy, Iter1 first1, Iter1 last1, Iter2 first2, Iter2 last2) except +
|
| 38 |
+
Iter1 find_end[Iter1, Iter2, BinaryPred](
|
| 39 |
+
Iter1 first1, Iter1 last1, Iter2 first2, Iter2 last2, BinaryPred pred) except +
|
| 40 |
+
Iter1 find_end[ExecutionPolicy, Iter1, Iter2, BinaryPred](
|
| 41 |
+
ExecutionPolicy&& policy, Iter1 first1, Iter1 last1, Iter2 first2, Iter2 last2, BinaryPred pred) except +
|
| 42 |
+
|
| 43 |
+
|
| 44 |
+
Iter1 find_first_of[Iter1, Iter2](Iter1 first1, Iter1 last1, Iter2 first2, Iter2 last2) except +
|
| 45 |
+
Iter1 find_first_of[Iter1, Iter2, BinaryPred](
|
| 46 |
+
Iter1 first1, Iter1 last1, Iter2 first2, Iter2 last2, BinaryPred pred) except +
|
| 47 |
+
Iter1 find_first_of[ExecutionPolicy, Iter1, Iter2](ExecutionPolicy&& policy, Iter1 first1, Iter1 last1, Iter2 first2, Iter2 last2) except +
|
| 48 |
+
Iter1 find_first_of[ExecutionPolicy, Iter1, Iter2, BinaryPred](
|
| 49 |
+
ExecutionPolicy&& policy, Iter1 first1, Iter1 last1, Iter2 first2, Iter2 last2, BinaryPred pred) except +
|
| 50 |
+
|
| 51 |
+
Iter adjacent_find[Iter](Iter first, Iter last) except +
|
| 52 |
+
Iter adjacent_find[ExecutionPolicy, Iter](ExecutionPolicy&& policy, Iter first, Iter last) except +
|
| 53 |
+
Iter adjacent_find[Iter, BinaryPred](Iter first, Iter last, BinaryPred pred) except +
|
| 54 |
+
Iter adjacent_find[ExecutionPolicy, Iter, BinaryPred](ExecutionPolicy&& policy, Iter first, Iter last, BinaryPred pred) except +
|
| 55 |
+
|
| 56 |
+
Iter1 search[Iter1, Iter2](Iter1 first1, Iter1 last1, Iter2 first2, Iter2 last2) except +
|
| 57 |
+
Iter1 search[ExecutionPolicy, Iter1, Iter2](ExecutionPolicy&& policy, Iter1 first1, Iter1 last1, Iter2 first2, Iter2 last2) except +
|
| 58 |
+
Iter1 search[Iter1, Iter2, BinaryPred](
|
| 59 |
+
Iter1 first1, Iter1 last1, Iter2 first2, Iter2 last2, BinaryPred pred) except +
|
| 60 |
+
Iter1 search[ExecutionPolicy, Iter1, Iter2, BinaryPred](
|
| 61 |
+
ExecutionPolicy&& policy, Iter1 first1, Iter1 last1, Iter2 first2, Iter2 last2, BinaryPred pred) except +
|
| 62 |
+
Iter search_n[Iter, Size, T](Iter first1, Iter last1, Size count, const T& value) except +
|
| 63 |
+
Iter search_n[ExecutionPolicy, Iter, Size, T](ExecutionPolicy&& policy, Iter first1, Iter last1, Size count, const T& value) except +
|
| 64 |
+
Iter search_n[Iter, Size, T, BinaryPred](
|
| 65 |
+
Iter first1, Iter last1, Size count, const T& value, BinaryPred pred) except +
|
| 66 |
+
Iter search_n[ExecutionPolicy, Iter, Size, T, BinaryPred](
|
| 67 |
+
ExecutionPolicy&& policy, Iter first1, Iter last1, Size count, const T& value, BinaryPred pred) except +
|
| 68 |
+
|
| 69 |
+
# Modifying sequence operations
|
| 70 |
+
OutputIt copy[InputIt, OutputIt](InputIt first, InputIt last, OutputIt d_first) except +
|
| 71 |
+
OutputIt copy[ExecutionPolicy, InputIt, OutputIt](ExecutionPolicy&& policy, InputIt first, InputIt last, OutputIt d_first) except +
|
| 72 |
+
OutputIt copy_if[InputIt, OutputIt, Pred](InputIt first, InputIt last, OutputIt d_first, Pred pred) except +
|
| 73 |
+
OutputIt copy_if[ExecutionPolicy, InputIt, OutputIt, Pred](ExecutionPolicy&& policy, InputIt first, InputIt last, OutputIt d_first, Pred pred) except +
|
| 74 |
+
OutputIt copy_n[InputIt, Size, OutputIt](InputIt first, Size count, OutputIt result) except +
|
| 75 |
+
OutputIt copy_n[ExecutionPolicy, InputIt, Size, OutputIt](ExecutionPolicy&& policy, InputIt first, Size count, OutputIt result) except +
|
| 76 |
+
Iter2 copy_backward[Iter1, Iter2](Iter1 first, Iter1 last, Iter2 d_last) except +
|
| 77 |
+
Iter2 copy_backward[ExecutionPolicy, Iter1, Iter2](ExecutionPolicy&& policy, Iter1 first, Iter1 last, Iter2 d_last) except +
|
| 78 |
+
|
| 79 |
+
OutputIt move[InputIt, OutputIt](InputIt first, InputIt last, OutputIt d_first) except +
|
| 80 |
+
OutputIt move[ExecutionPolicy, InputIt, OutputIt](ExecutionPolicy&& policy, InputIt first, InputIt last, OutputIt d_first) except +
|
| 81 |
+
Iter2 move_backward[Iter1, Iter2](Iter1 first, Iter1 last, Iter2 d_last) except +
|
| 82 |
+
Iter2 move_backward[ExecutionPolicy, Iter1, Iter2](ExecutionPolicy&& policy, Iter1 first, Iter1 last, Iter2 d_last) except +
|
| 83 |
+
|
| 84 |
+
void fill[Iter, T](Iter first, Iter last, const T& value) except +
|
| 85 |
+
void fill[ExecutionPolicy, Iter, T](ExecutionPolicy&& policy, Iter first, Iter last, const T& value) except +
|
| 86 |
+
Iter fill_n[Iter, Size, T](Iter first, Size count, const T& value) except +
|
| 87 |
+
Iter fill_n[ExecutionPolicy, Iter, Size, T](ExecutionPolicy&& policy, Iter first, Size count, const T& value) except +
|
| 88 |
+
|
| 89 |
+
OutputIt transform[InputIt, OutputIt, UnaryOp](
|
| 90 |
+
InputIt first1, InputIt last1, OutputIt d_first, UnaryOp unary_op) except +
|
| 91 |
+
|
| 92 |
+
# This overload is ambiguous with the next one. We just let C++ disambiguate from the arguments
|
| 93 |
+
# OutputIt transform[ExecutionPolicy, InputIt, OutputIt, UnaryOp](
|
| 94 |
+
# ExecutionPolicy&& policy, InputIt first1, InputIt last1, OutputIt d_first, UnaryOp unary_op) except +
|
| 95 |
+
|
| 96 |
+
OutputIt transform[InputIt1, InputIt2, OutputIt, BinaryOp](
|
| 97 |
+
InputIt1 first1, InputIt1 last1, InputIt2 first2, OutputIt d_first, BinaryOp binary_op) except +
|
| 98 |
+
|
| 99 |
+
OutputIt transform[ExecutionPolicy, InputIt1, InputIt2, OutputIt, BinaryOp](
|
| 100 |
+
ExecutionPolicy&& policy, InputIt1 first1, InputIt1 last1, InputIt2 first2, OutputIt d_first, BinaryOp binary_op) except +
|
| 101 |
+
|
| 102 |
+
void generate[Iter, Generator](Iter first, Iter last, Generator g) except +
|
| 103 |
+
void generate[ExecutionPolicy, Iter, Generator](ExecutionPolicy&& policy, Iter first, Iter last, Generator g) except +
|
| 104 |
+
void generate_n[Iter, Size, Generator](Iter first, Size count, Generator g) except +
|
| 105 |
+
void generate_n[ExecutionPolicy, Iter, Size, Generator](ExecutionPolicy&& policy, Iter first, Size count, Generator g) except +
|
| 106 |
+
|
| 107 |
+
Iter remove[Iter, T](Iter first, Iter last, const T& value) except +
|
| 108 |
+
Iter remove[ExecutionPolicy, Iter, T](ExecutionPolicy&& policy, Iter first, Iter last, const T& value) except +
|
| 109 |
+
Iter remove_if[Iter, UnaryPred](Iter first, Iter last, UnaryPred pred) except +
|
| 110 |
+
Iter remove_if[ExecutionPolicy, Iter, UnaryPred](ExecutionPolicy&& policy, Iter first, Iter last, UnaryPred pred) except +
|
| 111 |
+
OutputIt remove_copy[InputIt, OutputIt, T](InputIt first, InputIt last, OutputIt d_first, const T& value) except +
|
| 112 |
+
OutputIt remove_copy[ExecutionPolicy, InputIt, OutputIt, T](ExecutionPolicy&& policy, InputIt first, InputIt last, OutputIt d_first, const T& value) except +
|
| 113 |
+
OutputIt remove_copy_if[InputIt, OutputIt, UnaryPred](
|
| 114 |
+
InputIt first, InputIt last, OutputIt d_first, UnaryPred pred) except +
|
| 115 |
+
OutputIt remove_copy_if[ExecutionPolicy, InputIt, OutputIt, UnaryPred](
|
| 116 |
+
ExecutionPolicy&& policy, InputIt first, InputIt last, OutputIt d_first, UnaryPred pred) except +
|
| 117 |
+
|
| 118 |
+
void replace[Iter, T](Iter first, Iter last, const T& old_value, const T& new_value) except +
|
| 119 |
+
void replace[ExecutionPolicy, Iter, T](ExecutionPolicy&& policy, Iter first, Iter last, const T& old_value, const T& new_value) except +
|
| 120 |
+
void replace_if[Iter, UnaryPred, T](Iter first, Iter last, UnaryPred pred, const T& new_value) except +
|
| 121 |
+
OutputIt replace_copy[InputIt, OutputIt, T](
|
| 122 |
+
InputIt first, InputIt last, OutputIt d_first, const T& old_value, const T& new_value) except +
|
| 123 |
+
void replace_if[ExecutionPolicy, Iter, UnaryPred, T](ExecutionPolicy&& policy, Iter first, Iter last, UnaryPred pred, const T& new_value) except +
|
| 124 |
+
|
| 125 |
+
OutputIt replace_copy[ExecutionPolicy, InputIt, OutputIt, T](
|
| 126 |
+
ExecutionPolicy&& policy, InputIt first, InputIt last, OutputIt d_first, const T& old_value, const T& new_value) except +
|
| 127 |
+
OutputIt replace_copy_if[InputIt, OutputIt, UnaryPred, T](
|
| 128 |
+
InputIt first, InputIt last, OutputIt d_first, UnaryPred pred, const T& new_value) except +
|
| 129 |
+
OutputIt replace_copy_if[ExecutionPolicy, InputIt, OutputIt, UnaryPred, T](
|
| 130 |
+
ExecutionPolicy&& policy, InputIt first, InputIt last, OutputIt d_first, UnaryPred pred, const T& new_value) except +
|
| 131 |
+
|
| 132 |
+
void swap[T](T& a, T& b) except + # array overload also works
|
| 133 |
+
Iter2 swap_ranges[Iter1, Iter2](Iter1 first1, Iter1 last1, Iter2 first2) except +
|
| 134 |
+
void iter_swap[Iter](Iter a, Iter b) except +
|
| 135 |
+
|
| 136 |
+
void reverse[Iter](Iter first, Iter last) except +
|
| 137 |
+
void reverse[ExecutionPolicy, Iter](ExecutionPolicy&& policy, Iter first, Iter last) except +
|
| 138 |
+
OutputIt reverse_copy[InputIt, OutputIt](InputIt first, InputIt last, OutputIt d_first) except +
|
| 139 |
+
OutputIt reverse_copy[ExecutionPolicy, InputIt, OutputIt](ExecutionPolicy&& policy, InputIt first, InputIt last, OutputIt d_first) except +
|
| 140 |
+
|
| 141 |
+
Iter rotate[Iter](Iter first, Iter n_first, Iter last) except +
|
| 142 |
+
Iter rotate[ExecutionPolicy, Iter](ExecutionPolicy&& policy, Iter first, Iter n_first, Iter last) except +
|
| 143 |
+
OutputIt rotate_copy[InputIt, OutputIt](InputIt first, InputIt n_first, InputIt last, OutputIt d_first) except +
|
| 144 |
+
OutputIt rotate_copy[ExecutionPolicy, InputIt, OutputIt](ExecutionPolicy&& policy, InputIt first, InputIt n_first, InputIt last, OutputIt d_first) except +
|
| 145 |
+
|
| 146 |
+
Iter unique[Iter](Iter first, Iter last) except +
|
| 147 |
+
Iter unique[ExecutionPolicy, Iter](ExecutionPolicy&& policy, Iter first, Iter last) except +
|
| 148 |
+
Iter unique[Iter, BinaryPred](Iter first, Iter last, BinaryPred p) except +
|
| 149 |
+
Iter unique[ExecutionPolicy, Iter, BinaryPred](ExecutionPolicy&& policy, Iter first, Iter last, BinaryPred p) except +
|
| 150 |
+
OutputIt unique_copy[InputIt, OutputIt](InputIt first, InputIt last, OutputIt d_first) except +
|
| 151 |
+
OutputIt unique_copy[ExecutionPolicy, InputIt, OutputIt](ExecutionPolicy&& policy, InputIt first, InputIt last, OutputIt d_first) except +
|
| 152 |
+
OutputIt unique_copy[InputIt, OutputIt, BinaryPred](
|
| 153 |
+
InputIt first, InputIt last, OutputIt d_first, BinaryPred pred) except +
|
| 154 |
+
OutputIt unique_copy[ExecutionPolicy, InputIt, OutputIt, BinaryPred](
|
| 155 |
+
ExecutionPolicy&& policy, InputIt first, InputIt last, OutputIt d_first, BinaryPred pred) except +
|
| 156 |
+
|
| 157 |
+
SampleIt sample[PopulationIt, SampleIt, Distance, URBG](PopulationIt first, PopulationIt last, SampleIt out, Distance n, URBG&& g) except +
|
| 158 |
+
|
| 159 |
+
# Partitioning operations
|
| 160 |
+
bool is_partitioned[Iter, Pred](Iter first, Iter last, Pred p) except +
|
| 161 |
+
bool is_partitioned[ExecutionPolicy, Iter, Pred](ExecutionPolicy&& policy, Iter first, Iter last, Pred p) except +
|
| 162 |
+
Iter partition[Iter, Pred](Iter first, Iter last, Pred p) except +
|
| 163 |
+
Iter partition[ExecutionPolicy, Iter, Pred](ExecutionPolicy&& policy, Iter first, Iter last, Pred p) except +
|
| 164 |
+
pair[OutputIt1, OutputIt2] partition_copy[InputIt, OutputIt1, OutputIt2, Pred](
|
| 165 |
+
InputIt first, InputIt last, OutputIt1 d_first_true, OutputIt2 d_first_false, Pred p) except +
|
| 166 |
+
pair[OutputIt1, OutputIt2] partition_copy[ExecutionPolicy, InputIt, OutputIt1, OutputIt2, Pred](
|
| 167 |
+
ExecutionPolicy&& policy, InputIt first, InputIt last, OutputIt1 d_first_true, OutputIt2 d_first_false, Pred p) except +
|
| 168 |
+
|
| 169 |
+
Iter stable_partition[Iter, Pred](Iter first, Iter last, Pred p) except +
|
| 170 |
+
Iter stable_partition[ExecutionPolicy, Iter, Pred](ExecutionPolicy&& policy, Iter first, Iter last, Pred p) except +
|
| 171 |
+
Iter partition_point[Iter, Pred](Iter first, Iter last, Pred p) except +
|
| 172 |
+
Iter partition_point[ExecutionPolicy, Iter, Pred](ExecutionPolicy&& policy, Iter first, Iter last, Pred p) except +
|
| 173 |
+
|
| 174 |
+
# Sorting operations
|
| 175 |
+
bool is_sorted[Iter](Iter first, Iter last) except +
|
| 176 |
+
bool is_sorted[ExecutionPolicy, Iter](ExecutionPolicy&& policy, Iter first, Iter last) except +
|
| 177 |
+
bool is_sorted[Iter, Compare](Iter first, Iter last, Compare comp) except +
|
| 178 |
+
bool is_sorted[ExecutionPolicy, Iter, Compare](ExecutionPolicy&& policy, Iter first, Iter last, Compare comp) except +
|
| 179 |
+
|
| 180 |
+
Iter is_sorted_until[Iter](Iter first, Iter last) except +
|
| 181 |
+
Iter is_sorted_until[ExecutionPolicy, Iter](ExecutionPolicy&& policy, Iter first, Iter last) except +
|
| 182 |
+
Iter is_sorted_until[Iter, Compare](Iter first, Iter last, Compare comp) except +
|
| 183 |
+
Iter is_sorted_until[ExecutionPolicy, Iter, Compare](ExecutionPolicy&& policy, Iter first, Iter last, Compare comp) except +
|
| 184 |
+
|
| 185 |
+
void sort[Iter](Iter first, Iter last) except +
|
| 186 |
+
void sort[ExecutionPolicy, Iter](ExecutionPolicy&& policy, Iter first, Iter last) except +
|
| 187 |
+
void sort[Iter, Compare](Iter first, Iter last, Compare comp) except +
|
| 188 |
+
void sort[ExecutionPolicy, Iter, Compare](ExecutionPolicy&& policy, Iter first, Iter last, Compare comp) except +
|
| 189 |
+
|
| 190 |
+
void partial_sort[Iter](Iter first, Iter middle, Iter last) except +
|
| 191 |
+
void partial_sort[ExecutionPolicy, Iter](ExecutionPolicy&& policy, Iter first, Iter middle, Iter last) except +
|
| 192 |
+
void partial_sort[Iter, Compare](Iter first, Iter middle, Iter last, Compare comp) except +
|
| 193 |
+
void partial_sort[ExecutionPolicy, Iter, Compare](ExecutionPolicy&& policy, Iter first, Iter middle, Iter last, Compare comp) except +
|
| 194 |
+
|
| 195 |
+
OutputIt partial_sort_copy[InputIt, OutputIt](
|
| 196 |
+
InputIt first, InputIt last, OutputIt d_first, OutputIt d_last) except +
|
| 197 |
+
OutputIt partial_sort_copy[ExecutionPolicy, InputIt, OutputIt](
|
| 198 |
+
ExecutionPolicy&& policy, InputIt first, InputIt last, OutputIt d_first, OutputIt d_last) except +
|
| 199 |
+
OutputIt partial_sort_copy[InputIt, OutputIt, Compare](
|
| 200 |
+
InputIt first, InputIt last, OutputIt d_first, OutputIt d_last, Compare comp) except +
|
| 201 |
+
OutputIt partial_sort_copy[ExecutionPolicy, InputIt, OutputIt, Compare](
|
| 202 |
+
ExecutionPolicy&& policy, InputIt first, InputIt last, OutputIt d_first, OutputIt d_last, Compare comp) except +
|
| 203 |
+
|
| 204 |
+
void stable_sort[Iter](Iter first, Iter last) except +
|
| 205 |
+
void stable_sort[ExecutionPolicy, Iter](ExecutionPolicy&& policy, Iter first, Iter last) except +
|
| 206 |
+
void stable_sort[Iter, Compare](Iter first, Iter last, Compare comp) except +
|
| 207 |
+
void stable_sort[ExecutionPolicy, Iter, Compare](ExecutionPolicy&& policy, Iter first, Iter last, Compare comp) except +
|
| 208 |
+
|
| 209 |
+
void nth_element[Iter](Iter first, Iter nth, Iter last) except +
|
| 210 |
+
void nth_element[ExecutionPolicy, Iter](ExecutionPolicy&& policy, Iter first, Iter nth, Iter last) except +
|
| 211 |
+
void nth_element[Iter, Compare](Iter first, Iter nth, Iter last, Compare comp) except +
|
| 212 |
+
void nth_element[ExecutionPolicy, Iter, Compare](ExecutionPolicy&& policy, Iter first, Iter nth, Iter last, Compare comp) except +
|
| 213 |
+
|
| 214 |
+
# Binary search operations (on sorted ranges)
|
| 215 |
+
Iter lower_bound[Iter, T](Iter first, Iter last, const T& value) except +
|
| 216 |
+
Iter lower_bound[ExecutionPolicy, Iter, T](ExecutionPolicy&& policy, Iter first, Iter last, const T& value) except +
|
| 217 |
+
Iter lower_bound[Iter, T, Compare](Iter first, Iter last, const T& value, Compare comp) except +
|
| 218 |
+
Iter lower_bound[ExecutionPolicy, Iter, T, Compare](ExecutionPolicy&& policy, Iter first, Iter last, const T& value, Compare comp) except +
|
| 219 |
+
|
| 220 |
+
Iter upper_bound[Iter, T](Iter first, Iter last, const T& value) except +
|
| 221 |
+
Iter upper_bound[ExecutionPolicy, Iter, T](ExecutionPolicy&& policy, Iter first, Iter last, const T& value) except +
|
| 222 |
+
Iter upper_bound[Iter, T, Compare](Iter first, Iter last, const T& value, Compare comp) except +
|
| 223 |
+
Iter upper_bound[ExecutionPolicy, Iter, T, Compare](ExecutionPolicy&& policy, Iter first, Iter last, const T& value, Compare comp) except +
|
| 224 |
+
|
| 225 |
+
bool binary_search[Iter, T](Iter first, Iter last, const T& value) except +
|
| 226 |
+
bool binary_search[ExecutionPolicy, Iter, T](ExecutionPolicy&& policy, Iter first, Iter last, const T& value) except +
|
| 227 |
+
bool binary_search[Iter, T, Compare](Iter first, Iter last, const T& value, Compare comp) except +
|
| 228 |
+
bool binary_search[ExecutionPolicy, Iter, T, Compare](ExecutionPolicy&& policy, Iter first, Iter last, const T& value, Compare comp) except +
|
| 229 |
+
|
| 230 |
+
# Other operations on sorted ranges
|
| 231 |
+
OutputIt merge[InputIt1, InputIt2, OutputIt](
|
| 232 |
+
InputIt1 first1, InputIt1 last1, InputIt2 first2, InputIt2 last2, OutputIt out) except +
|
| 233 |
+
OutputIt merge[InputIt1, InputIt2, OutputIt, Compare](
|
| 234 |
+
InputIt1 first1, InputIt1 last1, InputIt2 first2, InputIt2 last2, OutputIt out, Compare comp) except +
|
| 235 |
+
|
| 236 |
+
void inplace_merge[BidirIt](BidirIt first, BidirIt middle, BidirIt last) except +
|
| 237 |
+
void inplace_merge[BidirIt, Compare](BidirIt first, BidirIt middle, BidirIt last, Compare comp) except +
|
| 238 |
+
|
| 239 |
+
# Set operations (on sorted ranges)
|
| 240 |
+
bool includes[InputIt1, InputIt2](
|
| 241 |
+
InputIt1 first1, InputIt1 last1, InputIt2 first2, InputIt2 last2) except +
|
| 242 |
+
|
| 243 |
+
bool includes[InputIt1, InputIt2, Compare](
|
| 244 |
+
InputIt1 first1, InputIt1 last1, InputIt2 first2, InputIt2 last2, Compare comp) except +
|
| 245 |
+
|
| 246 |
+
OutputIt set_difference[InputIt1, InputIt2, OutputIt](
|
| 247 |
+
InputIt1 first1, InputIt1 last1, InputIt2 first2, InputIt2 last2, OutputIt out) except +
|
| 248 |
+
|
| 249 |
+
OutputIt set_difference[InputIt1, InputIt2, OutputIt, Compare](
|
| 250 |
+
InputIt1 first1, InputIt1 last1, InputIt2 first2, InputIt2 last2,
|
| 251 |
+
OutputIt out, Compare comp) except +
|
| 252 |
+
|
| 253 |
+
OutputIt set_intersection[InputIt1, InputIt2, OutputIt](
|
| 254 |
+
InputIt1 first1, InputIt1 last1, InputIt2 first2, InputIt2 last2, OutputIt out) except +
|
| 255 |
+
|
| 256 |
+
OutputIt set_intersection[InputIt1, InputIt2, OutputIt, Compare](
|
| 257 |
+
InputIt1 first1, InputIt1 last1, InputIt2 first2, InputIt2 last2, OutputIt out, Compare comp) except +
|
| 258 |
+
|
| 259 |
+
OutputIt set_symmetric_difference[InputIt1, InputIt2, OutputIt](
|
| 260 |
+
InputIt1 first1, InputIt1 last1, InputIt2 first2, InputIt2 last2, OutputIt out) except +
|
| 261 |
+
|
| 262 |
+
OutputIt set_symmetric_difference[InputIt1, InputIt2, OutputIt, Compare](
|
| 263 |
+
InputIt1 first1, InputIt1 last1, InputIt2 first2, InputIt2 last2, OutputIt out, Compare comp) except +
|
| 264 |
+
|
| 265 |
+
OutputIt set_union[InputIt1, InputIt2, OutputIt](
|
| 266 |
+
InputIt1 first1, InputIt1 last1, InputIt2 first2, InputIt2 last2, OutputIt out) except +
|
| 267 |
+
|
| 268 |
+
OutputIt set_union[InputIt1, InputIt2, OutputIt, Compare](
|
| 269 |
+
InputIt1 first1, InputIt1 last1, InputIt2 first2, InputIt2 last2, OutputIt out, Compare comp) except +
|
| 270 |
+
|
| 271 |
+
# Heap operations
|
| 272 |
+
void make_heap[Iter](Iter first, Iter last) except +
|
| 273 |
+
void make_heap[Iter, Compare](Iter first, Iter last, Compare comp) except +
|
| 274 |
+
|
| 275 |
+
void push_heap[Iter](Iter first, Iter last) except +
|
| 276 |
+
void push_heap[Iter, Compare](Iter first, Iter last, Compare comp) except +
|
| 277 |
+
|
| 278 |
+
void pop_heap[Iter](Iter first, Iter last) except +
|
| 279 |
+
void pop_heap[Iter, Compare](Iter first, Iter last, Compare comp) except +
|
| 280 |
+
|
| 281 |
+
void sort_heap[Iter](Iter first, Iter last) except +
|
| 282 |
+
void sort_heap[Iter, Compare](Iter first, Iter last, Compare comp) except +
|
| 283 |
+
|
| 284 |
+
# Minimum/maximum operations
|
| 285 |
+
Iter min_element[Iter](Iter first, Iter last) except +
|
| 286 |
+
Iter min_element[Iter, Compare](Iter first, Iter last, Compare comp) except +
|
| 287 |
+
Iter min_element[ExecutionPolicy, Iter](ExecutionPolicy&& policy, Iter first, Iter last) except +
|
| 288 |
+
Iter max_element[Iter](Iter first, Iter last) except +
|
| 289 |
+
Iter max_element[Iter, Compare](Iter first, Iter last, Compare comp) except +
|
| 290 |
+
Iter max_element[ExecutionPolicy, Iter](ExecutionPolicy&& policy, Iter first, Iter last) except +
|
| 291 |
+
pair[T, T] minmax[T](const T& a, const T& b) except +
|
| 292 |
+
pair[T, T] minmax[T, Compare](const T& a, const T& b, Compare comp) except +
|
| 293 |
+
pair[Iter, Iter] minmax_element[Iter](Iter first, Iter last) except +
|
| 294 |
+
pair[Iter, Iter] minmax_element[Iter, Compare](Iter first, Iter last, Compare comp) except +
|
| 295 |
+
pair[Iter, Iter] minmax_element[ExecutionPolicy, Iter](ExecutionPolicy&& policy, Iter first, Iter last) except +
|
| 296 |
+
const T& clamp[T](const T& v, const T& lo, const T& hi) except +
|
| 297 |
+
const T& clamp[T, Compare](const T& v, const T& lo, const T& hi, Compare comp) except +
|
| 298 |
+
|
| 299 |
+
# Comparison operations
|
| 300 |
+
bool equal[InputIt1, InputIt2](InputIt1 first1, InputIt1 last1, InputIt2 first2) except +
|
| 301 |
+
bool equal[InputIt1, InputIt2, BinPred](InputIt1 first1, InputIt1 last1, InputIt2 first2, BinPred pred) except +
|
| 302 |
+
# ambiguous with previous overload
|
| 303 |
+
#bool equal[InputIt1, InputIt2](InputIt1 first1, InputIt1 last1, InputIt2 first2, InputIt2 last2) except +
|
| 304 |
+
bool equal[InputIt1, InputIt2, BinPred](InputIt1 first1, InputIt1 last1, InputIt2 first2, InputIt2 last2, BinPred pred) except +
|
| 305 |
+
|
| 306 |
+
bool lexicographical_compare[InputIt1, InputIt2](InputIt1 first1, InputIt1 last1, InputIt2 first2, InputIt2 last2) except +
|
| 307 |
+
# ambiguous with next overload
|
| 308 |
+
#bool lexicographical_compare[InputIt1, InputIt2, ExecutionPolicy](ExecutionPolicy&& policy, InputIt1 first1, InputIt1 last1, InputIt2 first2, InputIt2 last2) except +
|
| 309 |
+
bool lexicographical_compare[InputIt1, InputIt2, Compare](InputIt1 first1, InputIt1 last1, InputIt2 first2, InputIt2 last2, Compare comp) except +
|
| 310 |
+
|
| 311 |
+
# Permutation operations
|
| 312 |
+
bool is_permutation[ForwardIt1, ForwardIt2](ForwardIt1 first1, ForwardIt1 last1, ForwardIt2 first2) except +
|
| 313 |
+
bool is_permutation[ForwardIt1, ForwardIt2, BinaryPred](ForwardIt1 first1, ForwardIt1 last1, ForwardIt2 first2, BinaryPred p) except +
|
| 314 |
+
# ambiguous with previous overload
|
| 315 |
+
#bool is_permutation[ForwardIt1, ForwardIt2](ForwardIt1 first1, ForwardIt1 last1, ForwardIt2 first2, ForwardIt2 last2) except +
|
| 316 |
+
bool is_permutation[ForwardIt1, ForwardIt2, BinaryPred](ForwardIt1 first1, ForwardIt1 last1, ForwardIt2 first2, ForwardIt2 last2, BinaryPred p) except +
|
| 317 |
+
bool next_permutation[BidirIt](BidirIt first, BidirIt last) except +
|
| 318 |
+
bool next_permutation[BidirIt, Compare](BidirIt first, BidirIt last, Compare comp) except +
|
| 319 |
+
bool prev_permutation[BidirIt](BidirIt first, BidirIt last) except +
|
| 320 |
+
bool prev_permutation[BidirIt, Compare](BidirIt first, BidirIt last, Compare comp) except +
|
tuning-competition-baseline/.venv/lib/python3.11/site-packages/Cython/Includes/libcpp/any.pxd
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from libcpp cimport bool
|
| 2 |
+
from libcpp.typeinfo cimport type_info
|
| 3 |
+
|
| 4 |
+
cdef extern from "<any>" namespace "std" nogil:
|
| 5 |
+
cdef cppclass any:
|
| 6 |
+
any()
|
| 7 |
+
any(any&) except +
|
| 8 |
+
void reset()
|
| 9 |
+
bool has_value()
|
| 10 |
+
type_info& type()
|
| 11 |
+
T& emplace[T](...) except +
|
| 12 |
+
void swap(any&)
|
| 13 |
+
any& operator=(any&) except +
|
| 14 |
+
any& operator=[U](U&) except +
|
| 15 |
+
|
| 16 |
+
cdef T any_cast[T](any&) except +
|
tuning-competition-baseline/.venv/lib/python3.11/site-packages/Cython/Includes/libcpp/complex.pxd
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Note: add integer versions of the functions?
|
| 2 |
+
|
| 3 |
+
cdef extern from "<complex>" namespace "std" nogil:
|
| 4 |
+
cdef cppclass complex[T]:
|
| 5 |
+
complex() except +
|
| 6 |
+
complex(T, T) except +
|
| 7 |
+
complex(complex[T]&) except +
|
| 8 |
+
# How to make the converting constructor, i.e. convert complex[double]
|
| 9 |
+
# to complex[float]?
|
| 10 |
+
|
| 11 |
+
complex[T] operator+(complex[T]&, complex[T]&)
|
| 12 |
+
complex[T] operator+(complex[T]&, T&)
|
| 13 |
+
complex[T] operator+(T&, complex[T]&)
|
| 14 |
+
|
| 15 |
+
complex[T] operator-(complex[T]&, complex[T]&)
|
| 16 |
+
complex[T] operator-(complex[T]&, T&)
|
| 17 |
+
complex[T] operator-(T&, complex[T]&)
|
| 18 |
+
|
| 19 |
+
complex[T] operator*(complex[T]&, complex[T]&)
|
| 20 |
+
complex[T] operator*(complex[T]&, T&)
|
| 21 |
+
complex[T] operator*(T&, complex[T]&)
|
| 22 |
+
|
| 23 |
+
complex[T] operator/(complex[T]&, complex[T]&)
|
| 24 |
+
complex[T] operator/(complex[T]&, T&)
|
| 25 |
+
complex[T] operator/(T&, complex[T]&)
|
| 26 |
+
|
| 27 |
+
complex[T] operator+()
|
| 28 |
+
complex[T] operator-()
|
| 29 |
+
|
| 30 |
+
bint operator==(complex[T]&, complex[T]&)
|
| 31 |
+
bint operator==(complex[T]&, T&)
|
| 32 |
+
bint operator==(T&, complex[T]&)
|
| 33 |
+
bint operator!=(complex[T]&, complex[T]&)
|
| 34 |
+
bint operator!=(complex[T]&, T&)
|
| 35 |
+
bint operator!=(T&, complex[T]&)
|
| 36 |
+
|
| 37 |
+
# Access real part
|
| 38 |
+
T real()
|
| 39 |
+
void real(T)
|
| 40 |
+
|
| 41 |
+
# Access imaginary part
|
| 42 |
+
T imag()
|
| 43 |
+
void imag(T)
|
| 44 |
+
|
| 45 |
+
# Return real part
|
| 46 |
+
T real[T](complex[T]&)
|
| 47 |
+
long double real(long double)
|
| 48 |
+
double real(double)
|
| 49 |
+
float real(float)
|
| 50 |
+
|
| 51 |
+
# Return imaginary part
|
| 52 |
+
T imag[T](complex[T]&)
|
| 53 |
+
long double imag(long double)
|
| 54 |
+
double imag(double)
|
| 55 |
+
float imag(float)
|
| 56 |
+
|
| 57 |
+
T abs[T](complex[T]&)
|
| 58 |
+
|
| 59 |
+
T arg[T](complex[T]&)
|
| 60 |
+
long double arg(long double)
|
| 61 |
+
double arg(double)
|
| 62 |
+
float arg(float)
|
| 63 |
+
|
| 64 |
+
T norm[T](complex[T])
|
| 65 |
+
long double norm(long double)
|
| 66 |
+
double norm(double)
|
| 67 |
+
float norm(float)
|
| 68 |
+
|
| 69 |
+
complex[T] conj[T](complex[T]&)
|
| 70 |
+
complex[long double] conj(long double)
|
| 71 |
+
complex[double] conj(double)
|
| 72 |
+
complex[float] conj(float)
|
| 73 |
+
|
| 74 |
+
complex[T] proj[T](complex[T])
|
| 75 |
+
complex[long double] proj(long double)
|
| 76 |
+
complex[double] proj(double)
|
| 77 |
+
complex[float] proj(float)
|
| 78 |
+
|
| 79 |
+
complex[T] polar[T](T&, T&)
|
| 80 |
+
complex[T] polar[T](T&)
|
| 81 |
+
|
| 82 |
+
complex[T] exp[T](complex[T]&)
|
| 83 |
+
complex[T] log[T](complex[T]&)
|
| 84 |
+
complex[T] log10[T](complex[T]&)
|
| 85 |
+
|
| 86 |
+
complex[T] pow[T](complex[T]&, complex[T]&)
|
| 87 |
+
complex[T] pow[T](complex[T]&, T&)
|
| 88 |
+
complex[T] pow[T](T&, complex[T]&)
|
| 89 |
+
# There are some promotion versions too
|
| 90 |
+
|
| 91 |
+
complex[T] sqrt[T](complex[T]&)
|
| 92 |
+
|
| 93 |
+
complex[T] sin[T](complex[T]&)
|
| 94 |
+
complex[T] cos[T](complex[T]&)
|
| 95 |
+
complex[T] tan[T](complex[T]&)
|
| 96 |
+
complex[T] asin[T](complex[T]&)
|
| 97 |
+
complex[T] acos[T](complex[T]&)
|
| 98 |
+
complex[T] atan[T](complex[T]&)
|
| 99 |
+
|
| 100 |
+
complex[T] sinh[T](complex[T]&)
|
| 101 |
+
complex[T] cosh[T](complex[T]&)
|
| 102 |
+
complex[T] tanh[T](complex[T]&)
|
| 103 |
+
|
| 104 |
+
complex[T] asinh[T](complex[T]&)
|
| 105 |
+
complex[T] acosh[T](complex[T]&)
|
| 106 |
+
complex[T] atanh[T](complex[T]&)
|
tuning-competition-baseline/.venv/lib/python3.11/site-packages/Cython/Includes/libcpp/execution.pxd
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
cdef extern from "<execution>" namespace "std::execution" nogil:
|
| 3 |
+
cdef cppclass sequenced_policy:
|
| 4 |
+
pass
|
| 5 |
+
cdef cppclass parallel_policy:
|
| 6 |
+
pass
|
| 7 |
+
cdef cppclass parallel_unsequenced_policy:
|
| 8 |
+
pass
|
| 9 |
+
cdef cppclass unsequenced_policy:
|
| 10 |
+
pass
|
| 11 |
+
|
| 12 |
+
const sequenced_policy seq "std::execution::seq"
|
| 13 |
+
const parallel_policy par "std::execution::par"
|
| 14 |
+
const parallel_unsequenced_policy par_unseq "std::execution::par_unseq"
|
| 15 |
+
const unsequenced_policy unseq "std::execution::unseq"
|
tuning-competition-baseline/.venv/lib/python3.11/site-packages/Cython/Includes/libcpp/functional.pxd
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from libcpp cimport bool
|
| 2 |
+
|
| 3 |
+
cdef extern from "<functional>" namespace "std" nogil:
|
| 4 |
+
cdef cppclass function[T]:
|
| 5 |
+
function() except +
|
| 6 |
+
function(T*) except +
|
| 7 |
+
function(function&) except +
|
| 8 |
+
function(void*) except +
|
| 9 |
+
|
| 10 |
+
function operator=(T*)
|
| 11 |
+
function operator=(function&)
|
| 12 |
+
function operator=(void*)
|
| 13 |
+
function operator=[U](U)
|
| 14 |
+
|
| 15 |
+
bool operator bool()
|
| 16 |
+
|
| 17 |
+
# Comparisons
|
| 18 |
+
cdef cppclass greater[T=*]:
|
| 19 |
+
# https://github.com/cython/cython/issues/3193
|
| 20 |
+
greater() except +
|
| 21 |
+
bool operator()(const T& lhs, const T& rhs) except +
|
| 22 |
+
|
| 23 |
+
cdef cppclass reference_wrapper[T]:
|
| 24 |
+
reference_wrapper()
|
| 25 |
+
reference_wrapper(T)
|
| 26 |
+
T& get() const
|
tuning-competition-baseline/.venv/lib/python3.11/site-packages/Cython/Includes/libcpp/optional.pxd
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from libcpp cimport bool
|
| 2 |
+
|
| 3 |
+
cdef extern from "<optional>" namespace "std" nogil:
|
| 4 |
+
cdef cppclass nullopt_t:
|
| 5 |
+
nullopt_t()
|
| 6 |
+
|
| 7 |
+
cdef nullopt_t nullopt
|
| 8 |
+
|
| 9 |
+
cdef cppclass optional[T]:
|
| 10 |
+
ctypedef T value_type
|
| 11 |
+
optional()
|
| 12 |
+
optional(nullopt_t)
|
| 13 |
+
optional(optional&) except +
|
| 14 |
+
optional(T&) except +
|
| 15 |
+
bool has_value()
|
| 16 |
+
T& value() except +
|
| 17 |
+
T& value_or[U](U& default_value)
|
| 18 |
+
void swap(optional&)
|
| 19 |
+
void reset()
|
| 20 |
+
T& emplace(...)
|
| 21 |
+
T& operator*()
|
| 22 |
+
#T* operator->() # Not Supported
|
| 23 |
+
optional& operator=(optional&)
|
| 24 |
+
optional& operator=[U](U&)
|
| 25 |
+
bool operator bool()
|
| 26 |
+
bool operator!()
|
| 27 |
+
bool operator==[U](optional&, U&)
|
| 28 |
+
bool operator!=[U](optional&, U&)
|
| 29 |
+
bool operator<[U](optional&, U&)
|
| 30 |
+
bool operator>[U](optional&, U&)
|
| 31 |
+
bool operator<=[U](optional&, U&)
|
| 32 |
+
bool operator>=[U](optional&, U&)
|
| 33 |
+
|
| 34 |
+
optional[T] make_optional[T](...) except +
|
tuning-competition-baseline/.venv/lib/python3.11/site-packages/Cython/Includes/libcpp/queue.pxd
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
cdef extern from "<queue>" namespace "std" nogil:
|
| 2 |
+
cdef cppclass queue[T]:
|
| 3 |
+
queue() except +
|
| 4 |
+
queue(queue&) except +
|
| 5 |
+
#queue(Container&)
|
| 6 |
+
T& back()
|
| 7 |
+
bint empty()
|
| 8 |
+
T& front()
|
| 9 |
+
void pop()
|
| 10 |
+
void push(T&)
|
| 11 |
+
size_t size()
|
| 12 |
+
# C++11 methods
|
| 13 |
+
void swap(queue&)
|
| 14 |
+
|
| 15 |
+
cdef cppclass priority_queue[T]:
|
| 16 |
+
priority_queue() except +
|
| 17 |
+
priority_queue(priority_queue&) except +
|
| 18 |
+
#priority_queue(Container&)
|
| 19 |
+
bint empty()
|
| 20 |
+
void pop()
|
| 21 |
+
void push(T&)
|
| 22 |
+
size_t size()
|
| 23 |
+
T& top()
|
| 24 |
+
# C++11 methods
|
| 25 |
+
void swap(priority_queue&)
|
tuning-competition-baseline/.venv/lib/python3.11/site-packages/Cython/Includes/libcpp/stack.pxd
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
cdef extern from "<stack>" namespace "std" nogil:
|
| 2 |
+
cdef cppclass stack[T]:
|
| 3 |
+
ctypedef T value_type
|
| 4 |
+
stack() except +
|
| 5 |
+
stack(stack&) except +
|
| 6 |
+
#stack(Container&)
|
| 7 |
+
bint empty()
|
| 8 |
+
void pop()
|
| 9 |
+
void push(T&) except +
|
| 10 |
+
size_t size()
|
| 11 |
+
T& top()
|
tuning-competition-baseline/.venv/lib/python3.11/site-packages/Cython/Includes/libcpp/string.pxd
ADDED
|
@@ -0,0 +1,333 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
# deprecated cimport for backwards compatibility:
|
| 3 |
+
from libc.string cimport const_char
|
| 4 |
+
|
| 5 |
+
cdef extern from "<string>" namespace "std::string" nogil:
|
| 6 |
+
const size_t npos
|
| 7 |
+
|
| 8 |
+
cdef extern from "<string>" namespace "std" nogil:
|
| 9 |
+
cdef cppclass string:
|
| 10 |
+
ctypedef char value_type
|
| 11 |
+
|
| 12 |
+
# these should really be allocator_type.size_type and
|
| 13 |
+
# allocator_type.difference_type to be true to the C++ definition
|
| 14 |
+
# but cython doesn't support deferred access on template arguments
|
| 15 |
+
ctypedef size_t size_type
|
| 16 |
+
ctypedef ptrdiff_t difference_type
|
| 17 |
+
|
| 18 |
+
cppclass const_iterator
|
| 19 |
+
cppclass iterator:
|
| 20 |
+
iterator() except +
|
| 21 |
+
iterator(iterator&) except +
|
| 22 |
+
value_type& operator*()
|
| 23 |
+
iterator operator++()
|
| 24 |
+
iterator operator--()
|
| 25 |
+
iterator operator++(int)
|
| 26 |
+
iterator operator--(int)
|
| 27 |
+
iterator operator+(size_type)
|
| 28 |
+
iterator operator-(size_type)
|
| 29 |
+
difference_type operator-(iterator)
|
| 30 |
+
difference_type operator-(const_iterator)
|
| 31 |
+
bint operator==(iterator)
|
| 32 |
+
bint operator==(const_iterator)
|
| 33 |
+
bint operator!=(iterator)
|
| 34 |
+
bint operator!=(const_iterator)
|
| 35 |
+
bint operator<(iterator)
|
| 36 |
+
bint operator<(const_iterator)
|
| 37 |
+
bint operator>(iterator)
|
| 38 |
+
bint operator>(const_iterator)
|
| 39 |
+
bint operator<=(iterator)
|
| 40 |
+
bint operator<=(const_iterator)
|
| 41 |
+
bint operator>=(iterator)
|
| 42 |
+
bint operator>=(const_iterator)
|
| 43 |
+
cppclass const_iterator:
|
| 44 |
+
const_iterator() except +
|
| 45 |
+
const_iterator(iterator&) except +
|
| 46 |
+
const_iterator(const_iterator&) except +
|
| 47 |
+
operator=(iterator&) except +
|
| 48 |
+
const value_type& operator*()
|
| 49 |
+
const_iterator operator++()
|
| 50 |
+
const_iterator operator--()
|
| 51 |
+
const_iterator operator++(int)
|
| 52 |
+
const_iterator operator--(int)
|
| 53 |
+
const_iterator operator+(size_type)
|
| 54 |
+
const_iterator operator-(size_type)
|
| 55 |
+
difference_type operator-(iterator)
|
| 56 |
+
difference_type operator-(const_iterator)
|
| 57 |
+
bint operator==(iterator)
|
| 58 |
+
bint operator==(const_iterator)
|
| 59 |
+
bint operator!=(iterator)
|
| 60 |
+
bint operator!=(const_iterator)
|
| 61 |
+
bint operator<(iterator)
|
| 62 |
+
bint operator<(const_iterator)
|
| 63 |
+
bint operator>(iterator)
|
| 64 |
+
bint operator>(const_iterator)
|
| 65 |
+
bint operator<=(iterator)
|
| 66 |
+
bint operator<=(const_iterator)
|
| 67 |
+
bint operator>=(iterator)
|
| 68 |
+
bint operator>=(const_iterator)
|
| 69 |
+
|
| 70 |
+
cppclass const_reverse_iterator
|
| 71 |
+
cppclass reverse_iterator:
|
| 72 |
+
reverse_iterator() except +
|
| 73 |
+
reverse_iterator(reverse_iterator&) except +
|
| 74 |
+
value_type& operator*()
|
| 75 |
+
reverse_iterator operator++()
|
| 76 |
+
reverse_iterator operator--()
|
| 77 |
+
reverse_iterator operator++(int)
|
| 78 |
+
reverse_iterator operator--(int)
|
| 79 |
+
reverse_iterator operator+(size_type)
|
| 80 |
+
reverse_iterator operator-(size_type)
|
| 81 |
+
difference_type operator-(iterator)
|
| 82 |
+
difference_type operator-(const_iterator)
|
| 83 |
+
bint operator==(reverse_iterator)
|
| 84 |
+
bint operator==(const_reverse_iterator)
|
| 85 |
+
bint operator!=(reverse_iterator)
|
| 86 |
+
bint operator!=(const_reverse_iterator)
|
| 87 |
+
bint operator<(reverse_iterator)
|
| 88 |
+
bint operator<(const_reverse_iterator)
|
| 89 |
+
bint operator>(reverse_iterator)
|
| 90 |
+
bint operator>(const_reverse_iterator)
|
| 91 |
+
bint operator<=(reverse_iterator)
|
| 92 |
+
bint operator<=(const_reverse_iterator)
|
| 93 |
+
bint operator>=(reverse_iterator)
|
| 94 |
+
bint operator>=(const_reverse_iterator)
|
| 95 |
+
cppclass const_reverse_iterator:
|
| 96 |
+
const_reverse_iterator() except +
|
| 97 |
+
const_reverse_iterator(reverse_iterator&) except +
|
| 98 |
+
operator=(reverse_iterator&) except +
|
| 99 |
+
const value_type& operator*()
|
| 100 |
+
const_reverse_iterator operator++()
|
| 101 |
+
const_reverse_iterator operator--()
|
| 102 |
+
const_reverse_iterator operator++(int)
|
| 103 |
+
const_reverse_iterator operator--(int)
|
| 104 |
+
const_reverse_iterator operator+(size_type)
|
| 105 |
+
const_reverse_iterator operator-(size_type)
|
| 106 |
+
difference_type operator-(iterator)
|
| 107 |
+
difference_type operator-(const_iterator)
|
| 108 |
+
bint operator==(reverse_iterator)
|
| 109 |
+
bint operator==(const_reverse_iterator)
|
| 110 |
+
bint operator!=(reverse_iterator)
|
| 111 |
+
bint operator!=(const_reverse_iterator)
|
| 112 |
+
bint operator<(reverse_iterator)
|
| 113 |
+
bint operator<(const_reverse_iterator)
|
| 114 |
+
bint operator>(reverse_iterator)
|
| 115 |
+
bint operator>(const_reverse_iterator)
|
| 116 |
+
bint operator<=(reverse_iterator)
|
| 117 |
+
bint operator<=(const_reverse_iterator)
|
| 118 |
+
bint operator>=(reverse_iterator)
|
| 119 |
+
bint operator>=(const_reverse_iterator)
|
| 120 |
+
|
| 121 |
+
string() except +
|
| 122 |
+
string(const string& s) except +
|
| 123 |
+
string(const string& s, size_t pos) except +
|
| 124 |
+
string(const string& s, size_t pos, size_t len) except +
|
| 125 |
+
string(const char* s) except +
|
| 126 |
+
string(const char* s, size_t n) except +
|
| 127 |
+
string(size_t n, char c) except +
|
| 128 |
+
string(iterator first, iterator last) except +
|
| 129 |
+
|
| 130 |
+
iterator begin()
|
| 131 |
+
const_iterator const_begin "begin"()
|
| 132 |
+
const_iterator cbegin()
|
| 133 |
+
iterator end()
|
| 134 |
+
const_iterator const_end "end"()
|
| 135 |
+
const_iterator cend()
|
| 136 |
+
reverse_iterator rbegin()
|
| 137 |
+
const_reverse_iterator const_rbegin "rbegin"()
|
| 138 |
+
const_reverse_iterator crbegin()
|
| 139 |
+
reverse_iterator rend()
|
| 140 |
+
const_reverse_iterator const_rend "rend"()
|
| 141 |
+
const_reverse_iterator crend()
|
| 142 |
+
|
| 143 |
+
const char* c_str()
|
| 144 |
+
const char* data()
|
| 145 |
+
size_t size()
|
| 146 |
+
size_t max_size()
|
| 147 |
+
size_t length()
|
| 148 |
+
void resize(size_t) except +
|
| 149 |
+
void resize(size_t, char) except +
|
| 150 |
+
void shrink_to_fit() except +
|
| 151 |
+
void swap(string& other)
|
| 152 |
+
size_t capacity()
|
| 153 |
+
void reserve(size_t) except +
|
| 154 |
+
void clear()
|
| 155 |
+
bint empty()
|
| 156 |
+
|
| 157 |
+
iterator erase(iterator first, iterator last)
|
| 158 |
+
iterator erase(iterator p)
|
| 159 |
+
iterator erase(const_iterator first, const_iterator last)
|
| 160 |
+
iterator erase(const_iterator p)
|
| 161 |
+
string& erase(size_t pos, size_t len) except +
|
| 162 |
+
string& erase(size_t pos) except +
|
| 163 |
+
string& erase() except +
|
| 164 |
+
|
| 165 |
+
char& at(size_t pos) except +
|
| 166 |
+
char& operator[](size_t pos)
|
| 167 |
+
char& front()
|
| 168 |
+
char& back()
|
| 169 |
+
int compare(const string& s)
|
| 170 |
+
int compare(size_t pos, size_t len, const string& s) except +
|
| 171 |
+
int compare(size_t pos, size_t len, const string& s, size_t subpos, size_t sublen) except +
|
| 172 |
+
int compare(const char* s) except +
|
| 173 |
+
int compare(size_t pos, size_t len, const char* s) except +
|
| 174 |
+
int compare(size_t pos, size_t len, const char* s , size_t n) except +
|
| 175 |
+
|
| 176 |
+
string& append(const string& s) except +
|
| 177 |
+
string& append(const string& s, size_t subpos, size_t sublen) except +
|
| 178 |
+
string& append(const char* s) except +
|
| 179 |
+
string& append(const char* s, size_t n) except +
|
| 180 |
+
string& append(size_t n, char c) except +
|
| 181 |
+
|
| 182 |
+
void push_back(char c) except +
|
| 183 |
+
void pop_back()
|
| 184 |
+
|
| 185 |
+
string& assign(const string& s) except +
|
| 186 |
+
string& assign(const string& s, size_t subpos, size_t sublen) except +
|
| 187 |
+
string& assign(const char* s, size_t n) except +
|
| 188 |
+
string& assign(const char* s) except +
|
| 189 |
+
string& assign(size_t n, char c) except +
|
| 190 |
+
|
| 191 |
+
string& insert(size_t pos, const string& s, size_t subpos, size_t sublen) except +
|
| 192 |
+
string& insert(size_t pos, const string& s) except +
|
| 193 |
+
string& insert(size_t pos, const char* s, size_t n) except +
|
| 194 |
+
string& insert(size_t pos, const char* s) except +
|
| 195 |
+
string& insert(size_t pos, size_t n, char c) except +
|
| 196 |
+
void insert(iterator p, size_t n, char c) except +
|
| 197 |
+
iterator insert(iterator p, char c) except +
|
| 198 |
+
|
| 199 |
+
string& replace(size_t pos, size_t len, const string& str) except +
|
| 200 |
+
string& replace(iterator i1, iterator i2, const string& str) except +
|
| 201 |
+
string& replace(size_t pos, size_t len, const string& str, size_t subpos, size_t sublen) except +
|
| 202 |
+
string& replace(size_t pos, size_t len, const char* s) except +
|
| 203 |
+
string& replace(iterator i1, iterator i2, const char* s) except +
|
| 204 |
+
string& replace(size_t pos, size_t len, const char* s, size_t n) except +
|
| 205 |
+
string& replace(iterator i1, iterator i2, const char* s, size_t n) except +
|
| 206 |
+
string& replace(size_t pos, size_t len, size_t n, char c) except +
|
| 207 |
+
string& replace(iterator i1, iterator i2, size_t n, char c) except +
|
| 208 |
+
|
| 209 |
+
size_t copy(char* s, size_t len, size_t pos) except +
|
| 210 |
+
size_t copy(char* s, size_t len) except +
|
| 211 |
+
|
| 212 |
+
size_t find(const string& s, size_t pos)
|
| 213 |
+
size_t find(const string& s)
|
| 214 |
+
size_t find(const char* s, size_t pos, size_t n)
|
| 215 |
+
size_t find(const char* s, size_t pos)
|
| 216 |
+
size_t find(const char* s)
|
| 217 |
+
size_t find(char c, size_t pos)
|
| 218 |
+
size_t find(char c)
|
| 219 |
+
|
| 220 |
+
size_t rfind(const string&, size_t pos)
|
| 221 |
+
size_t rfind(const string&)
|
| 222 |
+
size_t rfind(const char* s, size_t pos, size_t n)
|
| 223 |
+
size_t rfind(const char* s, size_t pos)
|
| 224 |
+
size_t rfind(const char* s)
|
| 225 |
+
size_t rfind(char c, size_t pos)
|
| 226 |
+
size_t rfind(char c)
|
| 227 |
+
|
| 228 |
+
size_t find_first_of(const string&, size_t pos)
|
| 229 |
+
size_t find_first_of(const string&)
|
| 230 |
+
size_t find_first_of(const char* s, size_t pos, size_t n)
|
| 231 |
+
size_t find_first_of(const char* s, size_t pos)
|
| 232 |
+
size_t find_first_of(const char* s)
|
| 233 |
+
size_t find_first_of(char c, size_t pos)
|
| 234 |
+
size_t find_first_of(char c)
|
| 235 |
+
|
| 236 |
+
size_t find_first_not_of(const string& s, size_t pos)
|
| 237 |
+
size_t find_first_not_of(const string& s)
|
| 238 |
+
size_t find_first_not_of(const char* s, size_t pos, size_t n)
|
| 239 |
+
size_t find_first_not_of(const char* s, size_t pos)
|
| 240 |
+
size_t find_first_not_of(const char*)
|
| 241 |
+
size_t find_first_not_of(char c, size_t pos)
|
| 242 |
+
size_t find_first_not_of(char c)
|
| 243 |
+
|
| 244 |
+
size_t find_last_of(const string& s, size_t pos)
|
| 245 |
+
size_t find_last_of(const string& s)
|
| 246 |
+
size_t find_last_of(const char* s, size_t pos, size_t n)
|
| 247 |
+
size_t find_last_of(const char* s, size_t pos)
|
| 248 |
+
size_t find_last_of(const char* s)
|
| 249 |
+
size_t find_last_of(char c, size_t pos)
|
| 250 |
+
size_t find_last_of(char c)
|
| 251 |
+
|
| 252 |
+
size_t find_last_not_of(const string& s, size_t pos)
|
| 253 |
+
size_t find_last_not_of(const string& s)
|
| 254 |
+
size_t find_last_not_of(const char* s, size_t pos, size_t n)
|
| 255 |
+
size_t find_last_not_of(const char* s, size_t pos)
|
| 256 |
+
size_t find_last_not_of(const char* s)
|
| 257 |
+
size_t find_last_not_of(char c, size_t pos)
|
| 258 |
+
size_t find_last_not_of(char c)
|
| 259 |
+
|
| 260 |
+
string substr(size_t pos, size_t len) except +
|
| 261 |
+
string substr(size_t pos) except +
|
| 262 |
+
string substr()
|
| 263 |
+
|
| 264 |
+
# C++20
|
| 265 |
+
bint starts_with(char c) except +
|
| 266 |
+
bint starts_with(const char* s)
|
| 267 |
+
bint ends_with(char c) except +
|
| 268 |
+
bint ends_with(const char* s)
|
| 269 |
+
# C++23
|
| 270 |
+
bint contains(char c) except +
|
| 271 |
+
bint contains(const char* s)
|
| 272 |
+
|
| 273 |
+
#string& operator= (const string&)
|
| 274 |
+
#string& operator= (const char*)
|
| 275 |
+
#string& operator= (char)
|
| 276 |
+
|
| 277 |
+
string operator+ (const string&) except +
|
| 278 |
+
string operator+ (const char*) except +
|
| 279 |
+
|
| 280 |
+
bint operator==(const string&)
|
| 281 |
+
bint operator==(const char*)
|
| 282 |
+
|
| 283 |
+
bint operator!= (const string&)
|
| 284 |
+
bint operator!= (const char*)
|
| 285 |
+
|
| 286 |
+
bint operator< (const string&)
|
| 287 |
+
bint operator< (const char*)
|
| 288 |
+
|
| 289 |
+
bint operator> (const string&)
|
| 290 |
+
bint operator> (const char*)
|
| 291 |
+
|
| 292 |
+
bint operator<= (const string&)
|
| 293 |
+
bint operator<= (const char*)
|
| 294 |
+
|
| 295 |
+
bint operator>= (const string&)
|
| 296 |
+
bint operator>= (const char*)
|
| 297 |
+
|
| 298 |
+
|
| 299 |
+
string to_string(int val) except +
|
| 300 |
+
string to_string(long val) except +
|
| 301 |
+
string to_string(long long val) except +
|
| 302 |
+
string to_string(unsigned val) except +
|
| 303 |
+
string to_string(size_t val) except +
|
| 304 |
+
string to_string(ssize_t val) except +
|
| 305 |
+
string to_string(unsigned long val) except +
|
| 306 |
+
string to_string(unsigned long long val) except +
|
| 307 |
+
string to_string(float val) except +
|
| 308 |
+
string to_string(double val) except +
|
| 309 |
+
string to_string(long double val) except +
|
| 310 |
+
|
| 311 |
+
int stoi(const string& s, size_t* idx, int base) except +
|
| 312 |
+
int stoi(const string& s, size_t* idx) except +
|
| 313 |
+
int stoi(const string& s) except +
|
| 314 |
+
long stol(const string& s, size_t* idx, int base) except +
|
| 315 |
+
long stol(const string& s, size_t* idx) except +
|
| 316 |
+
long stol(const string& s) except +
|
| 317 |
+
long long stoll(const string& s, size_t* idx, int base) except +
|
| 318 |
+
long long stoll(const string& s, size_t* idx) except +
|
| 319 |
+
long long stoll(const string& s) except +
|
| 320 |
+
|
| 321 |
+
unsigned long stoul(const string& s, size_t* idx, int base) except +
|
| 322 |
+
unsigned long stoul(const string& s, size_t* idx) except +
|
| 323 |
+
unsigned long stoul(const string& s) except +
|
| 324 |
+
unsigned long long stoull(const string& s, size_t* idx, int base) except +
|
| 325 |
+
unsigned long long stoull(const string& s, size_t* idx) except +
|
| 326 |
+
unsigned long long stoull(const string& s) except +
|
| 327 |
+
|
| 328 |
+
float stof(const string& s, size_t* idx) except +
|
| 329 |
+
float stof(const string& s) except +
|
| 330 |
+
double stod(const string& s, size_t* idx) except +
|
| 331 |
+
double stod(const string& s) except +
|
| 332 |
+
long double stold(const string& s, size_t* idx) except +
|
| 333 |
+
long double stold(const string& s) except +
|
tuning-competition-baseline/.venv/lib/python3.11/site-packages/Cython/Includes/libcpp/unordered_set.pxd
ADDED
|
@@ -0,0 +1,152 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from .utility cimport pair
|
| 2 |
+
|
| 3 |
+
cdef extern from "<unordered_set>" namespace "std" nogil:
|
| 4 |
+
cdef cppclass unordered_set[T,HASH=*,PRED=*,ALLOCATOR=*]:
|
| 5 |
+
ctypedef T value_type
|
| 6 |
+
|
| 7 |
+
# these should really be allocator_type.size_type and
|
| 8 |
+
# allocator_type.difference_type to be true to the C++ definition
|
| 9 |
+
# but cython doesn't support deferred access on template arguments
|
| 10 |
+
ctypedef size_t size_type
|
| 11 |
+
ctypedef ptrdiff_t difference_type
|
| 12 |
+
|
| 13 |
+
cppclass const_iterator
|
| 14 |
+
cppclass iterator:
|
| 15 |
+
iterator() except +
|
| 16 |
+
iterator(iterator&) except +
|
| 17 |
+
value_type& operator*()
|
| 18 |
+
iterator operator++()
|
| 19 |
+
iterator operator--()
|
| 20 |
+
iterator operator++(int)
|
| 21 |
+
iterator operator--(int)
|
| 22 |
+
bint operator==(iterator)
|
| 23 |
+
bint operator==(const_iterator)
|
| 24 |
+
bint operator!=(iterator)
|
| 25 |
+
bint operator!=(const_iterator)
|
| 26 |
+
cppclass const_iterator:
|
| 27 |
+
const_iterator() except +
|
| 28 |
+
const_iterator(iterator&) except +
|
| 29 |
+
operator=(iterator&) except +
|
| 30 |
+
const value_type& operator*()
|
| 31 |
+
const_iterator operator++()
|
| 32 |
+
const_iterator operator--()
|
| 33 |
+
const_iterator operator++(int)
|
| 34 |
+
const_iterator operator--(int)
|
| 35 |
+
bint operator==(iterator)
|
| 36 |
+
bint operator==(const_iterator)
|
| 37 |
+
bint operator!=(iterator)
|
| 38 |
+
bint operator!=(const_iterator)
|
| 39 |
+
|
| 40 |
+
unordered_set() except +
|
| 41 |
+
unordered_set(unordered_set&) except +
|
| 42 |
+
#unordered_set& operator=(unordered_set&)
|
| 43 |
+
bint operator==(unordered_set&, unordered_set&)
|
| 44 |
+
bint operator!=(unordered_set&, unordered_set&)
|
| 45 |
+
iterator begin()
|
| 46 |
+
const_iterator const_begin "begin"()
|
| 47 |
+
const_iterator cbegin()
|
| 48 |
+
void clear()
|
| 49 |
+
size_t count(const T&)
|
| 50 |
+
bint empty()
|
| 51 |
+
iterator end()
|
| 52 |
+
const_iterator const_end "end"()
|
| 53 |
+
const_iterator cend()
|
| 54 |
+
pair[iterator, iterator] equal_range(const T&)
|
| 55 |
+
pair[const_iterator, const_iterator] const_equal_range "equal_range"(const T&)
|
| 56 |
+
iterator erase(iterator)
|
| 57 |
+
iterator const_erase "erase"(const_iterator)
|
| 58 |
+
iterator erase(const_iterator, const_iterator)
|
| 59 |
+
size_t erase(const T&)
|
| 60 |
+
iterator find(const T&)
|
| 61 |
+
const_iterator const_find "find"(const T&)
|
| 62 |
+
pair[iterator, bint] insert(const T&) except +
|
| 63 |
+
iterator insert(const_iterator, const T&) except +
|
| 64 |
+
void insert[InputIt](InputIt, InputIt) except +
|
| 65 |
+
size_t max_size()
|
| 66 |
+
size_t size()
|
| 67 |
+
void swap(unordered_set&)
|
| 68 |
+
#value_compare value_comp()
|
| 69 |
+
void max_load_factor(float)
|
| 70 |
+
float max_load_factor()
|
| 71 |
+
float load_factor()
|
| 72 |
+
void rehash(size_t)
|
| 73 |
+
void reserve(size_t)
|
| 74 |
+
size_t bucket_count()
|
| 75 |
+
size_t max_bucket_count()
|
| 76 |
+
size_t bucket_size(size_t)
|
| 77 |
+
size_t bucket(const T&)
|
| 78 |
+
# C++20
|
| 79 |
+
bint contains(const T&)
|
| 80 |
+
|
| 81 |
+
cdef cppclass unordered_multiset[T,HASH=*,PRED=*,ALLOCATOR=*]:
|
| 82 |
+
ctypedef T value_type
|
| 83 |
+
|
| 84 |
+
# these should really be allocator_type.size_type and
|
| 85 |
+
# allocator_type.difference_type to be true to the C++ definition
|
| 86 |
+
# but cython doesn't support deferred access on template arguments
|
| 87 |
+
ctypedef size_t size_type
|
| 88 |
+
ctypedef ptrdiff_t difference_type
|
| 89 |
+
|
| 90 |
+
cppclass const_iterator
|
| 91 |
+
cppclass iterator:
|
| 92 |
+
iterator() except +
|
| 93 |
+
iterator(iterator&) except +
|
| 94 |
+
value_type& operator*()
|
| 95 |
+
iterator operator++()
|
| 96 |
+
iterator operator++(int)
|
| 97 |
+
bint operator==(iterator)
|
| 98 |
+
bint operator==(const_iterator)
|
| 99 |
+
bint operator!=(iterator)
|
| 100 |
+
bint operator!=(const_iterator)
|
| 101 |
+
cppclass const_iterator:
|
| 102 |
+
const_iterator() except +
|
| 103 |
+
const_iterator(iterator&) except +
|
| 104 |
+
operator=(iterator&) except +
|
| 105 |
+
const value_type& operator*()
|
| 106 |
+
const_iterator operator++()
|
| 107 |
+
const_iterator operator++(int)
|
| 108 |
+
bint operator==(iterator)
|
| 109 |
+
bint operator==(const_iterator)
|
| 110 |
+
bint operator!=(iterator)
|
| 111 |
+
bint operator!=(const_iterator)
|
| 112 |
+
|
| 113 |
+
unordered_multiset() except +
|
| 114 |
+
unordered_multiset(unordered_multiset&) except +
|
| 115 |
+
#unordered_multiset& operator=(unordered_multiset&)
|
| 116 |
+
bint operator==(unordered_multiset&, unordered_multiset&)
|
| 117 |
+
bint operator!=(unordered_multiset&, unordered_multiset&)
|
| 118 |
+
iterator begin()
|
| 119 |
+
const_iterator const_begin "begin"()
|
| 120 |
+
const_iterator cbegin()
|
| 121 |
+
void clear()
|
| 122 |
+
size_t count(const T&)
|
| 123 |
+
bint empty()
|
| 124 |
+
iterator end()
|
| 125 |
+
const_iterator const_end "end"()
|
| 126 |
+
const_iterator cend()
|
| 127 |
+
pair[iterator, iterator] equal_range(const T&)
|
| 128 |
+
pair[const_iterator, const_iterator] const_equal_range "equal_range"(const T&)
|
| 129 |
+
iterator erase(iterator)
|
| 130 |
+
iterator const_erase "erase"(const_iterator)
|
| 131 |
+
iterator erase(const_iterator, const_iterator)
|
| 132 |
+
size_t erase(const T&)
|
| 133 |
+
iterator find(const T&)
|
| 134 |
+
const_iterator const_find "find"(const T&)
|
| 135 |
+
iterator insert(const T&) except +
|
| 136 |
+
iterator insert(const_iterator, const T&) except +
|
| 137 |
+
void insert[InputIt](InputIt, InputIt) except +
|
| 138 |
+
size_t max_size()
|
| 139 |
+
size_t size()
|
| 140 |
+
void swap(unordered_multiset&)
|
| 141 |
+
#value_compare value_comp()
|
| 142 |
+
void max_load_factor(float)
|
| 143 |
+
float max_load_factor()
|
| 144 |
+
float load_factor()
|
| 145 |
+
void rehash(size_t)
|
| 146 |
+
void reserve(size_t)
|
| 147 |
+
size_t bucket_count()
|
| 148 |
+
size_t max_bucket_count()
|
| 149 |
+
size_t bucket_size(size_t)
|
| 150 |
+
size_t bucket(const T&)
|
| 151 |
+
# C++20
|
| 152 |
+
bint contains(const T&)
|
tuning-competition-baseline/.venv/lib/python3.11/site-packages/Cython/Includes/numpy/__init__.pxd
ADDED
|
@@ -0,0 +1,1057 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# NumPy static imports for Cython
|
| 2 |
+
#
|
| 3 |
+
# NOTE: Do not make incompatible local changes to this file without contacting the NumPy project.
|
| 4 |
+
# This file is maintained by the NumPy project at
|
| 5 |
+
# https://github.com/numpy/numpy/tree/master/numpy
|
| 6 |
+
#
|
| 7 |
+
# If any of the PyArray_* functions are called, import_array must be
|
| 8 |
+
# called first. This is done automatically by Cython 3.0+ if a call
|
| 9 |
+
# is not detected inside of the module.
|
| 10 |
+
#
|
| 11 |
+
# Author: Dag Sverre Seljebotn
|
| 12 |
+
#
|
| 13 |
+
|
| 14 |
+
from cpython.ref cimport Py_INCREF
|
| 15 |
+
from cpython.object cimport PyObject, PyTypeObject, PyObject_TypeCheck
|
| 16 |
+
cimport libc.stdio as stdio
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
cdef extern from *:
|
| 20 |
+
# Leave a marker that the NumPy declarations came from Cython and not from NumPy itself.
|
| 21 |
+
# See https://github.com/cython/cython/issues/3573
|
| 22 |
+
"""
|
| 23 |
+
/* Using NumPy API declarations from "Cython/Includes/numpy/" */
|
| 24 |
+
"""
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
cdef extern from "Python.h":
|
| 28 |
+
ctypedef Py_ssize_t Py_intptr_t
|
| 29 |
+
|
| 30 |
+
cdef extern from "numpy/arrayobject.h":
|
| 31 |
+
ctypedef Py_intptr_t npy_intp
|
| 32 |
+
ctypedef size_t npy_uintp
|
| 33 |
+
|
| 34 |
+
cdef enum NPY_TYPES:
|
| 35 |
+
NPY_BOOL
|
| 36 |
+
NPY_BYTE
|
| 37 |
+
NPY_UBYTE
|
| 38 |
+
NPY_SHORT
|
| 39 |
+
NPY_USHORT
|
| 40 |
+
NPY_INT
|
| 41 |
+
NPY_UINT
|
| 42 |
+
NPY_LONG
|
| 43 |
+
NPY_ULONG
|
| 44 |
+
NPY_LONGLONG
|
| 45 |
+
NPY_ULONGLONG
|
| 46 |
+
NPY_FLOAT
|
| 47 |
+
NPY_DOUBLE
|
| 48 |
+
NPY_LONGDOUBLE
|
| 49 |
+
NPY_CFLOAT
|
| 50 |
+
NPY_CDOUBLE
|
| 51 |
+
NPY_CLONGDOUBLE
|
| 52 |
+
NPY_OBJECT
|
| 53 |
+
NPY_STRING
|
| 54 |
+
NPY_UNICODE
|
| 55 |
+
NPY_VOID
|
| 56 |
+
NPY_DATETIME
|
| 57 |
+
NPY_TIMEDELTA
|
| 58 |
+
NPY_NTYPES
|
| 59 |
+
NPY_NOTYPE
|
| 60 |
+
|
| 61 |
+
NPY_INT8
|
| 62 |
+
NPY_INT16
|
| 63 |
+
NPY_INT32
|
| 64 |
+
NPY_INT64
|
| 65 |
+
NPY_INT128
|
| 66 |
+
NPY_INT256
|
| 67 |
+
NPY_UINT8
|
| 68 |
+
NPY_UINT16
|
| 69 |
+
NPY_UINT32
|
| 70 |
+
NPY_UINT64
|
| 71 |
+
NPY_UINT128
|
| 72 |
+
NPY_UINT256
|
| 73 |
+
NPY_FLOAT16
|
| 74 |
+
NPY_FLOAT32
|
| 75 |
+
NPY_FLOAT64
|
| 76 |
+
NPY_FLOAT80
|
| 77 |
+
NPY_FLOAT96
|
| 78 |
+
NPY_FLOAT128
|
| 79 |
+
NPY_FLOAT256
|
| 80 |
+
NPY_COMPLEX32
|
| 81 |
+
NPY_COMPLEX64
|
| 82 |
+
NPY_COMPLEX128
|
| 83 |
+
NPY_COMPLEX160
|
| 84 |
+
NPY_COMPLEX192
|
| 85 |
+
NPY_COMPLEX256
|
| 86 |
+
NPY_COMPLEX512
|
| 87 |
+
|
| 88 |
+
NPY_INTP
|
| 89 |
+
|
| 90 |
+
ctypedef enum NPY_ORDER:
|
| 91 |
+
NPY_ANYORDER
|
| 92 |
+
NPY_CORDER
|
| 93 |
+
NPY_FORTRANORDER
|
| 94 |
+
NPY_KEEPORDER
|
| 95 |
+
|
| 96 |
+
ctypedef enum NPY_CASTING:
|
| 97 |
+
NPY_NO_CASTING
|
| 98 |
+
NPY_EQUIV_CASTING
|
| 99 |
+
NPY_SAFE_CASTING
|
| 100 |
+
NPY_SAME_KIND_CASTING
|
| 101 |
+
NPY_UNSAFE_CASTING
|
| 102 |
+
|
| 103 |
+
ctypedef enum NPY_CLIPMODE:
|
| 104 |
+
NPY_CLIP
|
| 105 |
+
NPY_WRAP
|
| 106 |
+
NPY_RAISE
|
| 107 |
+
|
| 108 |
+
ctypedef enum NPY_SCALARKIND:
|
| 109 |
+
NPY_NOSCALAR,
|
| 110 |
+
NPY_BOOL_SCALAR,
|
| 111 |
+
NPY_INTPOS_SCALAR,
|
| 112 |
+
NPY_INTNEG_SCALAR,
|
| 113 |
+
NPY_FLOAT_SCALAR,
|
| 114 |
+
NPY_COMPLEX_SCALAR,
|
| 115 |
+
NPY_OBJECT_SCALAR
|
| 116 |
+
|
| 117 |
+
ctypedef enum NPY_SORTKIND:
|
| 118 |
+
NPY_QUICKSORT
|
| 119 |
+
NPY_HEAPSORT
|
| 120 |
+
NPY_MERGESORT
|
| 121 |
+
|
| 122 |
+
ctypedef enum NPY_SEARCHSIDE:
|
| 123 |
+
NPY_SEARCHLEFT
|
| 124 |
+
NPY_SEARCHRIGHT
|
| 125 |
+
|
| 126 |
+
enum:
|
| 127 |
+
# DEPRECATED since NumPy 1.7 ! Do not use in new code!
|
| 128 |
+
NPY_C_CONTIGUOUS
|
| 129 |
+
NPY_F_CONTIGUOUS
|
| 130 |
+
NPY_CONTIGUOUS
|
| 131 |
+
NPY_FORTRAN
|
| 132 |
+
NPY_OWNDATA
|
| 133 |
+
NPY_FORCECAST
|
| 134 |
+
NPY_ENSURECOPY
|
| 135 |
+
NPY_ENSUREARRAY
|
| 136 |
+
NPY_ELEMENTSTRIDES
|
| 137 |
+
NPY_ALIGNED
|
| 138 |
+
NPY_NOTSWAPPED
|
| 139 |
+
NPY_WRITEABLE
|
| 140 |
+
NPY_UPDATEIFCOPY
|
| 141 |
+
NPY_ARR_HAS_DESCR
|
| 142 |
+
|
| 143 |
+
NPY_BEHAVED
|
| 144 |
+
NPY_BEHAVED_NS
|
| 145 |
+
NPY_CARRAY
|
| 146 |
+
NPY_CARRAY_RO
|
| 147 |
+
NPY_FARRAY
|
| 148 |
+
NPY_FARRAY_RO
|
| 149 |
+
NPY_DEFAULT
|
| 150 |
+
|
| 151 |
+
NPY_IN_ARRAY
|
| 152 |
+
NPY_OUT_ARRAY
|
| 153 |
+
NPY_INOUT_ARRAY
|
| 154 |
+
NPY_IN_FARRAY
|
| 155 |
+
NPY_OUT_FARRAY
|
| 156 |
+
NPY_INOUT_FARRAY
|
| 157 |
+
|
| 158 |
+
NPY_UPDATE_ALL
|
| 159 |
+
|
| 160 |
+
enum:
|
| 161 |
+
# Added in NumPy 1.7 to replace the deprecated enums above.
|
| 162 |
+
NPY_ARRAY_C_CONTIGUOUS
|
| 163 |
+
NPY_ARRAY_F_CONTIGUOUS
|
| 164 |
+
NPY_ARRAY_OWNDATA
|
| 165 |
+
NPY_ARRAY_FORCECAST
|
| 166 |
+
NPY_ARRAY_ENSURECOPY
|
| 167 |
+
NPY_ARRAY_ENSUREARRAY
|
| 168 |
+
NPY_ARRAY_ELEMENTSTRIDES
|
| 169 |
+
NPY_ARRAY_ALIGNED
|
| 170 |
+
NPY_ARRAY_NOTSWAPPED
|
| 171 |
+
NPY_ARRAY_WRITEABLE
|
| 172 |
+
NPY_ARRAY_UPDATEIFCOPY
|
| 173 |
+
|
| 174 |
+
NPY_ARRAY_BEHAVED
|
| 175 |
+
NPY_ARRAY_BEHAVED_NS
|
| 176 |
+
NPY_ARRAY_CARRAY
|
| 177 |
+
NPY_ARRAY_CARRAY_RO
|
| 178 |
+
NPY_ARRAY_FARRAY
|
| 179 |
+
NPY_ARRAY_FARRAY_RO
|
| 180 |
+
NPY_ARRAY_DEFAULT
|
| 181 |
+
|
| 182 |
+
NPY_ARRAY_IN_ARRAY
|
| 183 |
+
NPY_ARRAY_OUT_ARRAY
|
| 184 |
+
NPY_ARRAY_INOUT_ARRAY
|
| 185 |
+
NPY_ARRAY_IN_FARRAY
|
| 186 |
+
NPY_ARRAY_OUT_FARRAY
|
| 187 |
+
NPY_ARRAY_INOUT_FARRAY
|
| 188 |
+
|
| 189 |
+
NPY_ARRAY_UPDATE_ALL
|
| 190 |
+
|
| 191 |
+
cdef enum:
|
| 192 |
+
NPY_MAXDIMS
|
| 193 |
+
|
| 194 |
+
npy_intp NPY_MAX_ELSIZE
|
| 195 |
+
|
| 196 |
+
ctypedef void (*PyArray_VectorUnaryFunc)(void *, void *, npy_intp, void *, void *)
|
| 197 |
+
|
| 198 |
+
ctypedef struct PyArray_ArrayDescr:
|
| 199 |
+
# shape is a tuple, but Cython doesn't support "tuple shape"
|
| 200 |
+
# inside a non-PyObject declaration, so we have to declare it
|
| 201 |
+
# as just a PyObject*.
|
| 202 |
+
PyObject* shape
|
| 203 |
+
|
| 204 |
+
ctypedef struct PyArray_Descr:
|
| 205 |
+
pass
|
| 206 |
+
|
| 207 |
+
ctypedef class numpy.dtype [object PyArray_Descr, check_size ignore]:
|
| 208 |
+
# Use PyDataType_* macros when possible, however there are no macros
|
| 209 |
+
# for accessing some of the fields, so some are defined.
|
| 210 |
+
cdef PyTypeObject* typeobj
|
| 211 |
+
cdef char kind
|
| 212 |
+
cdef char type
|
| 213 |
+
# Numpy sometimes mutates this without warning (e.g. it'll
|
| 214 |
+
# sometimes change "|" to "<" in shared dtype objects on
|
| 215 |
+
# little-endian machines). If this matters to you, use
|
| 216 |
+
# PyArray_IsNativeByteOrder(dtype.byteorder) instead of
|
| 217 |
+
# directly accessing this field.
|
| 218 |
+
cdef char byteorder
|
| 219 |
+
cdef char flags
|
| 220 |
+
cdef int type_num
|
| 221 |
+
cdef int itemsize "elsize"
|
| 222 |
+
cdef int alignment
|
| 223 |
+
cdef object fields
|
| 224 |
+
cdef tuple names
|
| 225 |
+
# Use PyDataType_HASSUBARRAY to test whether this field is
|
| 226 |
+
# valid (the pointer can be NULL). Most users should access
|
| 227 |
+
# this field via the inline helper method PyDataType_SHAPE.
|
| 228 |
+
cdef PyArray_ArrayDescr* subarray
|
| 229 |
+
|
| 230 |
+
ctypedef class numpy.flatiter [object PyArrayIterObject, check_size ignore]:
|
| 231 |
+
# Use through macros
|
| 232 |
+
pass
|
| 233 |
+
|
| 234 |
+
ctypedef class numpy.broadcast [object PyArrayMultiIterObject, check_size ignore]:
|
| 235 |
+
# Use through macros
|
| 236 |
+
pass
|
| 237 |
+
|
| 238 |
+
ctypedef struct PyArrayObject:
|
| 239 |
+
# For use in situations where ndarray can't replace PyArrayObject*,
|
| 240 |
+
# like PyArrayObject**.
|
| 241 |
+
pass
|
| 242 |
+
|
| 243 |
+
ctypedef class numpy.ndarray [object PyArrayObject, check_size ignore]:
|
| 244 |
+
cdef __cythonbufferdefaults__ = {"mode": "strided"}
|
| 245 |
+
|
| 246 |
+
# NOTE: no field declarations since direct access is deprecated since NumPy 1.7
|
| 247 |
+
# Instead, we use properties that map to the corresponding C-API functions.
|
| 248 |
+
|
| 249 |
+
@property
|
| 250 |
+
cdef inline PyObject* base(self) nogil:
|
| 251 |
+
"""Returns a borrowed reference to the object owning the data/memory.
|
| 252 |
+
"""
|
| 253 |
+
return PyArray_BASE(self)
|
| 254 |
+
|
| 255 |
+
@property
|
| 256 |
+
cdef inline dtype descr(self):
|
| 257 |
+
"""Returns an owned reference to the dtype of the array.
|
| 258 |
+
"""
|
| 259 |
+
return <dtype>PyArray_DESCR(self)
|
| 260 |
+
|
| 261 |
+
@property
|
| 262 |
+
cdef inline int ndim(self) nogil:
|
| 263 |
+
"""Returns the number of dimensions in the array.
|
| 264 |
+
"""
|
| 265 |
+
return PyArray_NDIM(self)
|
| 266 |
+
|
| 267 |
+
@property
|
| 268 |
+
cdef inline npy_intp *shape(self) nogil:
|
| 269 |
+
"""Returns a pointer to the dimensions/shape of the array.
|
| 270 |
+
The number of elements matches the number of dimensions of the array (ndim).
|
| 271 |
+
Can return NULL for 0-dimensional arrays.
|
| 272 |
+
"""
|
| 273 |
+
return PyArray_DIMS(self)
|
| 274 |
+
|
| 275 |
+
@property
|
| 276 |
+
cdef inline npy_intp *strides(self) nogil:
|
| 277 |
+
"""Returns a pointer to the strides of the array.
|
| 278 |
+
The number of elements matches the number of dimensions of the array (ndim).
|
| 279 |
+
"""
|
| 280 |
+
return PyArray_STRIDES(self)
|
| 281 |
+
|
| 282 |
+
@property
|
| 283 |
+
cdef inline npy_intp size(self) nogil:
|
| 284 |
+
"""Returns the total size (in number of elements) of the array.
|
| 285 |
+
"""
|
| 286 |
+
return PyArray_SIZE(self)
|
| 287 |
+
|
| 288 |
+
@property
|
| 289 |
+
cdef inline char* data(self) nogil:
|
| 290 |
+
"""The pointer to the data buffer as a char*.
|
| 291 |
+
This is provided for legacy reasons to avoid direct struct field access.
|
| 292 |
+
For new code that needs this access, you probably want to cast the result
|
| 293 |
+
of `PyArray_DATA()` instead, which returns a 'void*'.
|
| 294 |
+
"""
|
| 295 |
+
return PyArray_BYTES(self)
|
| 296 |
+
|
| 297 |
+
ctypedef unsigned char npy_bool
|
| 298 |
+
|
| 299 |
+
ctypedef signed char npy_byte
|
| 300 |
+
ctypedef signed short npy_short
|
| 301 |
+
ctypedef signed int npy_int
|
| 302 |
+
ctypedef signed long npy_long
|
| 303 |
+
ctypedef signed long long npy_longlong
|
| 304 |
+
|
| 305 |
+
ctypedef unsigned char npy_ubyte
|
| 306 |
+
ctypedef unsigned short npy_ushort
|
| 307 |
+
ctypedef unsigned int npy_uint
|
| 308 |
+
ctypedef unsigned long npy_ulong
|
| 309 |
+
ctypedef unsigned long long npy_ulonglong
|
| 310 |
+
|
| 311 |
+
ctypedef float npy_float
|
| 312 |
+
ctypedef double npy_double
|
| 313 |
+
ctypedef long double npy_longdouble
|
| 314 |
+
|
| 315 |
+
ctypedef signed char npy_int8
|
| 316 |
+
ctypedef signed short npy_int16
|
| 317 |
+
ctypedef signed int npy_int32
|
| 318 |
+
ctypedef signed long long npy_int64
|
| 319 |
+
ctypedef signed long long npy_int96
|
| 320 |
+
ctypedef signed long long npy_int128
|
| 321 |
+
|
| 322 |
+
ctypedef unsigned char npy_uint8
|
| 323 |
+
ctypedef unsigned short npy_uint16
|
| 324 |
+
ctypedef unsigned int npy_uint32
|
| 325 |
+
ctypedef unsigned long long npy_uint64
|
| 326 |
+
ctypedef unsigned long long npy_uint96
|
| 327 |
+
ctypedef unsigned long long npy_uint128
|
| 328 |
+
|
| 329 |
+
ctypedef float npy_float32
|
| 330 |
+
ctypedef double npy_float64
|
| 331 |
+
ctypedef long double npy_float80
|
| 332 |
+
ctypedef long double npy_float96
|
| 333 |
+
ctypedef long double npy_float128
|
| 334 |
+
|
| 335 |
+
ctypedef struct npy_cfloat:
|
| 336 |
+
double real
|
| 337 |
+
double imag
|
| 338 |
+
|
| 339 |
+
ctypedef struct npy_cdouble:
|
| 340 |
+
double real
|
| 341 |
+
double imag
|
| 342 |
+
|
| 343 |
+
ctypedef struct npy_clongdouble:
|
| 344 |
+
long double real
|
| 345 |
+
long double imag
|
| 346 |
+
|
| 347 |
+
ctypedef struct npy_complex64:
|
| 348 |
+
float real
|
| 349 |
+
float imag
|
| 350 |
+
|
| 351 |
+
ctypedef struct npy_complex128:
|
| 352 |
+
double real
|
| 353 |
+
double imag
|
| 354 |
+
|
| 355 |
+
ctypedef struct npy_complex160:
|
| 356 |
+
long double real
|
| 357 |
+
long double imag
|
| 358 |
+
|
| 359 |
+
ctypedef struct npy_complex192:
|
| 360 |
+
long double real
|
| 361 |
+
long double imag
|
| 362 |
+
|
| 363 |
+
ctypedef struct npy_complex256:
|
| 364 |
+
long double real
|
| 365 |
+
long double imag
|
| 366 |
+
|
| 367 |
+
ctypedef struct PyArray_Dims:
|
| 368 |
+
npy_intp *ptr
|
| 369 |
+
int len
|
| 370 |
+
|
| 371 |
+
int _import_array() except -1
|
| 372 |
+
# A second definition so _import_array isn't marked as used when we use it here.
|
| 373 |
+
# Do not use - subject to change any time.
|
| 374 |
+
int __pyx_import_array "_import_array"() except -1
|
| 375 |
+
|
| 376 |
+
#
|
| 377 |
+
# Macros from ndarrayobject.h
|
| 378 |
+
#
|
| 379 |
+
bint PyArray_CHKFLAGS(ndarray m, int flags) nogil
|
| 380 |
+
bint PyArray_IS_C_CONTIGUOUS(ndarray arr) nogil
|
| 381 |
+
bint PyArray_IS_F_CONTIGUOUS(ndarray arr) nogil
|
| 382 |
+
bint PyArray_ISCONTIGUOUS(ndarray m) nogil
|
| 383 |
+
bint PyArray_ISWRITEABLE(ndarray m) nogil
|
| 384 |
+
bint PyArray_ISALIGNED(ndarray m) nogil
|
| 385 |
+
|
| 386 |
+
int PyArray_NDIM(ndarray) nogil
|
| 387 |
+
bint PyArray_ISONESEGMENT(ndarray) nogil
|
| 388 |
+
bint PyArray_ISFORTRAN(ndarray) nogil
|
| 389 |
+
int PyArray_FORTRANIF(ndarray) nogil
|
| 390 |
+
|
| 391 |
+
void* PyArray_DATA(ndarray) nogil
|
| 392 |
+
char* PyArray_BYTES(ndarray) nogil
|
| 393 |
+
|
| 394 |
+
npy_intp* PyArray_DIMS(ndarray) nogil
|
| 395 |
+
npy_intp* PyArray_STRIDES(ndarray) nogil
|
| 396 |
+
npy_intp PyArray_DIM(ndarray, size_t) nogil
|
| 397 |
+
npy_intp PyArray_STRIDE(ndarray, size_t) nogil
|
| 398 |
+
|
| 399 |
+
PyObject *PyArray_BASE(ndarray) nogil # returns borrowed reference!
|
| 400 |
+
PyArray_Descr *PyArray_DESCR(ndarray) nogil # returns borrowed reference to dtype!
|
| 401 |
+
PyArray_Descr *PyArray_DTYPE(ndarray) nogil # returns borrowed reference to dtype! NP 1.7+ alias for descr.
|
| 402 |
+
int PyArray_FLAGS(ndarray) nogil
|
| 403 |
+
void PyArray_CLEARFLAGS(ndarray, int flags) nogil # Added in NumPy 1.7
|
| 404 |
+
void PyArray_ENABLEFLAGS(ndarray, int flags) nogil # Added in NumPy 1.7
|
| 405 |
+
npy_intp PyArray_ITEMSIZE(ndarray) nogil
|
| 406 |
+
int PyArray_TYPE(ndarray arr) nogil
|
| 407 |
+
|
| 408 |
+
object PyArray_GETITEM(ndarray arr, void *itemptr)
|
| 409 |
+
int PyArray_SETITEM(ndarray arr, void *itemptr, object obj)
|
| 410 |
+
|
| 411 |
+
bint PyTypeNum_ISBOOL(int) nogil
|
| 412 |
+
bint PyTypeNum_ISUNSIGNED(int) nogil
|
| 413 |
+
bint PyTypeNum_ISSIGNED(int) nogil
|
| 414 |
+
bint PyTypeNum_ISINTEGER(int) nogil
|
| 415 |
+
bint PyTypeNum_ISFLOAT(int) nogil
|
| 416 |
+
bint PyTypeNum_ISNUMBER(int) nogil
|
| 417 |
+
bint PyTypeNum_ISSTRING(int) nogil
|
| 418 |
+
bint PyTypeNum_ISCOMPLEX(int) nogil
|
| 419 |
+
bint PyTypeNum_ISPYTHON(int) nogil
|
| 420 |
+
bint PyTypeNum_ISFLEXIBLE(int) nogil
|
| 421 |
+
bint PyTypeNum_ISUSERDEF(int) nogil
|
| 422 |
+
bint PyTypeNum_ISEXTENDED(int) nogil
|
| 423 |
+
bint PyTypeNum_ISOBJECT(int) nogil
|
| 424 |
+
|
| 425 |
+
bint PyDataType_ISBOOL(dtype) nogil
|
| 426 |
+
bint PyDataType_ISUNSIGNED(dtype) nogil
|
| 427 |
+
bint PyDataType_ISSIGNED(dtype) nogil
|
| 428 |
+
bint PyDataType_ISINTEGER(dtype) nogil
|
| 429 |
+
bint PyDataType_ISFLOAT(dtype) nogil
|
| 430 |
+
bint PyDataType_ISNUMBER(dtype) nogil
|
| 431 |
+
bint PyDataType_ISSTRING(dtype) nogil
|
| 432 |
+
bint PyDataType_ISCOMPLEX(dtype) nogil
|
| 433 |
+
bint PyDataType_ISPYTHON(dtype) nogil
|
| 434 |
+
bint PyDataType_ISFLEXIBLE(dtype) nogil
|
| 435 |
+
bint PyDataType_ISUSERDEF(dtype) nogil
|
| 436 |
+
bint PyDataType_ISEXTENDED(dtype) nogil
|
| 437 |
+
bint PyDataType_ISOBJECT(dtype) nogil
|
| 438 |
+
bint PyDataType_HASFIELDS(dtype) nogil
|
| 439 |
+
bint PyDataType_HASSUBARRAY(dtype) nogil
|
| 440 |
+
|
| 441 |
+
bint PyArray_ISBOOL(ndarray) nogil
|
| 442 |
+
bint PyArray_ISUNSIGNED(ndarray) nogil
|
| 443 |
+
bint PyArray_ISSIGNED(ndarray) nogil
|
| 444 |
+
bint PyArray_ISINTEGER(ndarray) nogil
|
| 445 |
+
bint PyArray_ISFLOAT(ndarray) nogil
|
| 446 |
+
bint PyArray_ISNUMBER(ndarray) nogil
|
| 447 |
+
bint PyArray_ISSTRING(ndarray) nogil
|
| 448 |
+
bint PyArray_ISCOMPLEX(ndarray) nogil
|
| 449 |
+
bint PyArray_ISPYTHON(ndarray) nogil
|
| 450 |
+
bint PyArray_ISFLEXIBLE(ndarray) nogil
|
| 451 |
+
bint PyArray_ISUSERDEF(ndarray) nogil
|
| 452 |
+
bint PyArray_ISEXTENDED(ndarray) nogil
|
| 453 |
+
bint PyArray_ISOBJECT(ndarray) nogil
|
| 454 |
+
bint PyArray_HASFIELDS(ndarray) nogil
|
| 455 |
+
|
| 456 |
+
bint PyArray_ISVARIABLE(ndarray) nogil
|
| 457 |
+
|
| 458 |
+
bint PyArray_SAFEALIGNEDCOPY(ndarray) nogil
|
| 459 |
+
bint PyArray_ISNBO(char) nogil # works on ndarray.byteorder
|
| 460 |
+
bint PyArray_IsNativeByteOrder(char) nogil # works on ndarray.byteorder
|
| 461 |
+
bint PyArray_ISNOTSWAPPED(ndarray) nogil
|
| 462 |
+
bint PyArray_ISBYTESWAPPED(ndarray) nogil
|
| 463 |
+
|
| 464 |
+
bint PyArray_FLAGSWAP(ndarray, int) nogil
|
| 465 |
+
|
| 466 |
+
bint PyArray_ISCARRAY(ndarray) nogil
|
| 467 |
+
bint PyArray_ISCARRAY_RO(ndarray) nogil
|
| 468 |
+
bint PyArray_ISFARRAY(ndarray) nogil
|
| 469 |
+
bint PyArray_ISFARRAY_RO(ndarray) nogil
|
| 470 |
+
bint PyArray_ISBEHAVED(ndarray) nogil
|
| 471 |
+
bint PyArray_ISBEHAVED_RO(ndarray) nogil
|
| 472 |
+
|
| 473 |
+
|
| 474 |
+
bint PyDataType_ISNOTSWAPPED(dtype) nogil
|
| 475 |
+
bint PyDataType_ISBYTESWAPPED(dtype) nogil
|
| 476 |
+
|
| 477 |
+
bint PyArray_DescrCheck(object)
|
| 478 |
+
|
| 479 |
+
bint PyArray_Check(object)
|
| 480 |
+
bint PyArray_CheckExact(object)
|
| 481 |
+
|
| 482 |
+
# Cannot be supported due to out arg:
|
| 483 |
+
# bint PyArray_HasArrayInterfaceType(object, dtype, object, object&)
|
| 484 |
+
# bint PyArray_HasArrayInterface(op, out)
|
| 485 |
+
|
| 486 |
+
|
| 487 |
+
bint PyArray_IsZeroDim(object)
|
| 488 |
+
# Cannot be supported due to ## ## in macro:
|
| 489 |
+
# bint PyArray_IsScalar(object, verbatim work)
|
| 490 |
+
bint PyArray_CheckScalar(object)
|
| 491 |
+
bint PyArray_IsPythonNumber(object)
|
| 492 |
+
bint PyArray_IsPythonScalar(object)
|
| 493 |
+
bint PyArray_IsAnyScalar(object)
|
| 494 |
+
bint PyArray_CheckAnyScalar(object)
|
| 495 |
+
|
| 496 |
+
ndarray PyArray_GETCONTIGUOUS(ndarray)
|
| 497 |
+
bint PyArray_SAMESHAPE(ndarray, ndarray) nogil
|
| 498 |
+
npy_intp PyArray_SIZE(ndarray) nogil
|
| 499 |
+
npy_intp PyArray_NBYTES(ndarray) nogil
|
| 500 |
+
|
| 501 |
+
object PyArray_FROM_O(object)
|
| 502 |
+
object PyArray_FROM_OF(object m, int flags)
|
| 503 |
+
object PyArray_FROM_OT(object m, int type)
|
| 504 |
+
object PyArray_FROM_OTF(object m, int type, int flags)
|
| 505 |
+
object PyArray_FROMANY(object m, int type, int min, int max, int flags)
|
| 506 |
+
object PyArray_ZEROS(int nd, npy_intp* dims, int type, int fortran)
|
| 507 |
+
object PyArray_EMPTY(int nd, npy_intp* dims, int type, int fortran)
|
| 508 |
+
void PyArray_FILLWBYTE(object, int val)
|
| 509 |
+
npy_intp PyArray_REFCOUNT(object)
|
| 510 |
+
object PyArray_ContiguousFromAny(op, int, int min_depth, int max_depth)
|
| 511 |
+
unsigned char PyArray_EquivArrTypes(ndarray a1, ndarray a2)
|
| 512 |
+
bint PyArray_EquivByteorders(int b1, int b2) nogil
|
| 513 |
+
object PyArray_SimpleNew(int nd, npy_intp* dims, int typenum)
|
| 514 |
+
object PyArray_SimpleNewFromData(int nd, npy_intp* dims, int typenum, void* data)
|
| 515 |
+
#object PyArray_SimpleNewFromDescr(int nd, npy_intp* dims, dtype descr)
|
| 516 |
+
object PyArray_ToScalar(void* data, ndarray arr)
|
| 517 |
+
|
| 518 |
+
void* PyArray_GETPTR1(ndarray m, npy_intp i) nogil
|
| 519 |
+
void* PyArray_GETPTR2(ndarray m, npy_intp i, npy_intp j) nogil
|
| 520 |
+
void* PyArray_GETPTR3(ndarray m, npy_intp i, npy_intp j, npy_intp k) nogil
|
| 521 |
+
void* PyArray_GETPTR4(ndarray m, npy_intp i, npy_intp j, npy_intp k, npy_intp l) nogil
|
| 522 |
+
|
| 523 |
+
void PyArray_XDECREF_ERR(ndarray)
|
| 524 |
+
# Cannot be supported due to out arg
|
| 525 |
+
# void PyArray_DESCR_REPLACE(descr)
|
| 526 |
+
|
| 527 |
+
|
| 528 |
+
object PyArray_Copy(ndarray)
|
| 529 |
+
object PyArray_FromObject(object op, int type, int min_depth, int max_depth)
|
| 530 |
+
object PyArray_ContiguousFromObject(object op, int type, int min_depth, int max_depth)
|
| 531 |
+
object PyArray_CopyFromObject(object op, int type, int min_depth, int max_depth)
|
| 532 |
+
|
| 533 |
+
object PyArray_Cast(ndarray mp, int type_num)
|
| 534 |
+
object PyArray_Take(ndarray ap, object items, int axis)
|
| 535 |
+
object PyArray_Put(ndarray ap, object items, object values)
|
| 536 |
+
|
| 537 |
+
void PyArray_ITER_RESET(flatiter it) nogil
|
| 538 |
+
void PyArray_ITER_NEXT(flatiter it) nogil
|
| 539 |
+
void PyArray_ITER_GOTO(flatiter it, npy_intp* destination) nogil
|
| 540 |
+
void PyArray_ITER_GOTO1D(flatiter it, npy_intp ind) nogil
|
| 541 |
+
void* PyArray_ITER_DATA(flatiter it) nogil
|
| 542 |
+
bint PyArray_ITER_NOTDONE(flatiter it) nogil
|
| 543 |
+
|
| 544 |
+
void PyArray_MultiIter_RESET(broadcast multi) nogil
|
| 545 |
+
void PyArray_MultiIter_NEXT(broadcast multi) nogil
|
| 546 |
+
void PyArray_MultiIter_GOTO(broadcast multi, npy_intp dest) nogil
|
| 547 |
+
void PyArray_MultiIter_GOTO1D(broadcast multi, npy_intp ind) nogil
|
| 548 |
+
void* PyArray_MultiIter_DATA(broadcast multi, npy_intp i) nogil
|
| 549 |
+
void PyArray_MultiIter_NEXTi(broadcast multi, npy_intp i) nogil
|
| 550 |
+
bint PyArray_MultiIter_NOTDONE(broadcast multi) nogil
|
| 551 |
+
|
| 552 |
+
# Functions from __multiarray_api.h
|
| 553 |
+
|
| 554 |
+
# Functions taking dtype and returning object/ndarray are disabled
|
| 555 |
+
# for now as they steal dtype references. I'm conservative and disable
|
| 556 |
+
# more than is probably needed until it can be checked further.
|
| 557 |
+
int PyArray_SetNumericOps (object)
|
| 558 |
+
object PyArray_GetNumericOps ()
|
| 559 |
+
int PyArray_INCREF (ndarray)
|
| 560 |
+
int PyArray_XDECREF (ndarray)
|
| 561 |
+
void PyArray_SetStringFunction (object, int)
|
| 562 |
+
dtype PyArray_DescrFromType (int)
|
| 563 |
+
object PyArray_TypeObjectFromType (int)
|
| 564 |
+
char * PyArray_Zero (ndarray)
|
| 565 |
+
char * PyArray_One (ndarray)
|
| 566 |
+
#object PyArray_CastToType (ndarray, dtype, int)
|
| 567 |
+
int PyArray_CastTo (ndarray, ndarray)
|
| 568 |
+
int PyArray_CastAnyTo (ndarray, ndarray)
|
| 569 |
+
int PyArray_CanCastSafely (int, int)
|
| 570 |
+
npy_bool PyArray_CanCastTo (dtype, dtype)
|
| 571 |
+
int PyArray_ObjectType (object, int)
|
| 572 |
+
dtype PyArray_DescrFromObject (object, dtype)
|
| 573 |
+
#ndarray* PyArray_ConvertToCommonType (object, int *)
|
| 574 |
+
dtype PyArray_DescrFromScalar (object)
|
| 575 |
+
dtype PyArray_DescrFromTypeObject (object)
|
| 576 |
+
npy_intp PyArray_Size (object)
|
| 577 |
+
#object PyArray_Scalar (void *, dtype, object)
|
| 578 |
+
#object PyArray_FromScalar (object, dtype)
|
| 579 |
+
void PyArray_ScalarAsCtype (object, void *)
|
| 580 |
+
#int PyArray_CastScalarToCtype (object, void *, dtype)
|
| 581 |
+
#int PyArray_CastScalarDirect (object, dtype, void *, int)
|
| 582 |
+
object PyArray_ScalarFromObject (object)
|
| 583 |
+
#PyArray_VectorUnaryFunc * PyArray_GetCastFunc (dtype, int)
|
| 584 |
+
object PyArray_FromDims (int, int *, int)
|
| 585 |
+
#object PyArray_FromDimsAndDataAndDescr (int, int *, dtype, char *)
|
| 586 |
+
#object PyArray_FromAny (object, dtype, int, int, int, object)
|
| 587 |
+
object PyArray_EnsureArray (object)
|
| 588 |
+
object PyArray_EnsureAnyArray (object)
|
| 589 |
+
#object PyArray_FromFile (stdio.FILE *, dtype, npy_intp, char *)
|
| 590 |
+
#object PyArray_FromString (char *, npy_intp, dtype, npy_intp, char *)
|
| 591 |
+
#object PyArray_FromBuffer (object, dtype, npy_intp, npy_intp)
|
| 592 |
+
#object PyArray_FromIter (object, dtype, npy_intp)
|
| 593 |
+
object PyArray_Return (ndarray)
|
| 594 |
+
#object PyArray_GetField (ndarray, dtype, int)
|
| 595 |
+
#int PyArray_SetField (ndarray, dtype, int, object)
|
| 596 |
+
object PyArray_Byteswap (ndarray, npy_bool)
|
| 597 |
+
object PyArray_Resize (ndarray, PyArray_Dims *, int, NPY_ORDER)
|
| 598 |
+
int PyArray_MoveInto (ndarray, ndarray)
|
| 599 |
+
int PyArray_CopyInto (ndarray, ndarray)
|
| 600 |
+
int PyArray_CopyAnyInto (ndarray, ndarray)
|
| 601 |
+
int PyArray_CopyObject (ndarray, object)
|
| 602 |
+
object PyArray_NewCopy (ndarray, NPY_ORDER)
|
| 603 |
+
object PyArray_ToList (ndarray)
|
| 604 |
+
object PyArray_ToString (ndarray, NPY_ORDER)
|
| 605 |
+
int PyArray_ToFile (ndarray, stdio.FILE *, char *, char *)
|
| 606 |
+
int PyArray_Dump (object, object, int)
|
| 607 |
+
object PyArray_Dumps (object, int)
|
| 608 |
+
int PyArray_ValidType (int)
|
| 609 |
+
void PyArray_UpdateFlags (ndarray, int)
|
| 610 |
+
object PyArray_New (type, int, npy_intp *, int, npy_intp *, void *, int, int, object)
|
| 611 |
+
#object PyArray_NewFromDescr (type, dtype, int, npy_intp *, npy_intp *, void *, int, object)
|
| 612 |
+
#dtype PyArray_DescrNew (dtype)
|
| 613 |
+
dtype PyArray_DescrNewFromType (int)
|
| 614 |
+
double PyArray_GetPriority (object, double)
|
| 615 |
+
object PyArray_IterNew (object)
|
| 616 |
+
object PyArray_MultiIterNew (int, ...)
|
| 617 |
+
|
| 618 |
+
int PyArray_PyIntAsInt (object)
|
| 619 |
+
npy_intp PyArray_PyIntAsIntp (object)
|
| 620 |
+
int PyArray_Broadcast (broadcast)
|
| 621 |
+
void PyArray_FillObjectArray (ndarray, object)
|
| 622 |
+
int PyArray_FillWithScalar (ndarray, object)
|
| 623 |
+
npy_bool PyArray_CheckStrides (int, int, npy_intp, npy_intp, npy_intp *, npy_intp *)
|
| 624 |
+
dtype PyArray_DescrNewByteorder (dtype, char)
|
| 625 |
+
object PyArray_IterAllButAxis (object, int *)
|
| 626 |
+
#object PyArray_CheckFromAny (object, dtype, int, int, int, object)
|
| 627 |
+
#object PyArray_FromArray (ndarray, dtype, int)
|
| 628 |
+
object PyArray_FromInterface (object)
|
| 629 |
+
object PyArray_FromStructInterface (object)
|
| 630 |
+
#object PyArray_FromArrayAttr (object, dtype, object)
|
| 631 |
+
#NPY_SCALARKIND PyArray_ScalarKind (int, ndarray*)
|
| 632 |
+
int PyArray_CanCoerceScalar (int, int, NPY_SCALARKIND)
|
| 633 |
+
object PyArray_NewFlagsObject (object)
|
| 634 |
+
npy_bool PyArray_CanCastScalar (type, type)
|
| 635 |
+
#int PyArray_CompareUCS4 (npy_ucs4 *, npy_ucs4 *, register size_t)
|
| 636 |
+
int PyArray_RemoveSmallest (broadcast)
|
| 637 |
+
int PyArray_ElementStrides (object)
|
| 638 |
+
void PyArray_Item_INCREF (char *, dtype)
|
| 639 |
+
void PyArray_Item_XDECREF (char *, dtype)
|
| 640 |
+
object PyArray_FieldNames (object)
|
| 641 |
+
object PyArray_Transpose (ndarray, PyArray_Dims *)
|
| 642 |
+
object PyArray_TakeFrom (ndarray, object, int, ndarray, NPY_CLIPMODE)
|
| 643 |
+
object PyArray_PutTo (ndarray, object, object, NPY_CLIPMODE)
|
| 644 |
+
object PyArray_PutMask (ndarray, object, object)
|
| 645 |
+
object PyArray_Repeat (ndarray, object, int)
|
| 646 |
+
object PyArray_Choose (ndarray, object, ndarray, NPY_CLIPMODE)
|
| 647 |
+
int PyArray_Sort (ndarray, int, NPY_SORTKIND)
|
| 648 |
+
object PyArray_ArgSort (ndarray, int, NPY_SORTKIND)
|
| 649 |
+
object PyArray_SearchSorted (ndarray, object, NPY_SEARCHSIDE, PyObject *)
|
| 650 |
+
object PyArray_ArgMax (ndarray, int, ndarray)
|
| 651 |
+
object PyArray_ArgMin (ndarray, int, ndarray)
|
| 652 |
+
object PyArray_Reshape (ndarray, object)
|
| 653 |
+
object PyArray_Newshape (ndarray, PyArray_Dims *, NPY_ORDER)
|
| 654 |
+
object PyArray_Squeeze (ndarray)
|
| 655 |
+
#object PyArray_View (ndarray, dtype, type)
|
| 656 |
+
object PyArray_SwapAxes (ndarray, int, int)
|
| 657 |
+
object PyArray_Max (ndarray, int, ndarray)
|
| 658 |
+
object PyArray_Min (ndarray, int, ndarray)
|
| 659 |
+
object PyArray_Ptp (ndarray, int, ndarray)
|
| 660 |
+
object PyArray_Mean (ndarray, int, int, ndarray)
|
| 661 |
+
object PyArray_Trace (ndarray, int, int, int, int, ndarray)
|
| 662 |
+
object PyArray_Diagonal (ndarray, int, int, int)
|
| 663 |
+
object PyArray_Clip (ndarray, object, object, ndarray)
|
| 664 |
+
object PyArray_Conjugate (ndarray, ndarray)
|
| 665 |
+
object PyArray_Nonzero (ndarray)
|
| 666 |
+
object PyArray_Std (ndarray, int, int, ndarray, int)
|
| 667 |
+
object PyArray_Sum (ndarray, int, int, ndarray)
|
| 668 |
+
object PyArray_CumSum (ndarray, int, int, ndarray)
|
| 669 |
+
object PyArray_Prod (ndarray, int, int, ndarray)
|
| 670 |
+
object PyArray_CumProd (ndarray, int, int, ndarray)
|
| 671 |
+
object PyArray_All (ndarray, int, ndarray)
|
| 672 |
+
object PyArray_Any (ndarray, int, ndarray)
|
| 673 |
+
object PyArray_Compress (ndarray, object, int, ndarray)
|
| 674 |
+
object PyArray_Flatten (ndarray, NPY_ORDER)
|
| 675 |
+
object PyArray_Ravel (ndarray, NPY_ORDER)
|
| 676 |
+
npy_intp PyArray_MultiplyList (npy_intp *, int)
|
| 677 |
+
int PyArray_MultiplyIntList (int *, int)
|
| 678 |
+
void * PyArray_GetPtr (ndarray, npy_intp*)
|
| 679 |
+
int PyArray_CompareLists (npy_intp *, npy_intp *, int)
|
| 680 |
+
#int PyArray_AsCArray (object*, void *, npy_intp *, int, dtype)
|
| 681 |
+
#int PyArray_As1D (object*, char **, int *, int)
|
| 682 |
+
#int PyArray_As2D (object*, char ***, int *, int *, int)
|
| 683 |
+
int PyArray_Free (object, void *)
|
| 684 |
+
#int PyArray_Converter (object, object*)
|
| 685 |
+
int PyArray_IntpFromSequence (object, npy_intp *, int)
|
| 686 |
+
object PyArray_Concatenate (object, int)
|
| 687 |
+
object PyArray_InnerProduct (object, object)
|
| 688 |
+
object PyArray_MatrixProduct (object, object)
|
| 689 |
+
object PyArray_CopyAndTranspose (object)
|
| 690 |
+
object PyArray_Correlate (object, object, int)
|
| 691 |
+
int PyArray_TypestrConvert (int, int)
|
| 692 |
+
#int PyArray_DescrConverter (object, dtype*)
|
| 693 |
+
#int PyArray_DescrConverter2 (object, dtype*)
|
| 694 |
+
int PyArray_IntpConverter (object, PyArray_Dims *)
|
| 695 |
+
#int PyArray_BufferConverter (object, chunk)
|
| 696 |
+
int PyArray_AxisConverter (object, int *)
|
| 697 |
+
int PyArray_BoolConverter (object, npy_bool *)
|
| 698 |
+
int PyArray_ByteorderConverter (object, char *)
|
| 699 |
+
int PyArray_OrderConverter (object, NPY_ORDER *)
|
| 700 |
+
unsigned char PyArray_EquivTypes (dtype, dtype)
|
| 701 |
+
#object PyArray_Zeros (int, npy_intp *, dtype, int)
|
| 702 |
+
#object PyArray_Empty (int, npy_intp *, dtype, int)
|
| 703 |
+
object PyArray_Where (object, object, object)
|
| 704 |
+
object PyArray_Arange (double, double, double, int)
|
| 705 |
+
#object PyArray_ArangeObj (object, object, object, dtype)
|
| 706 |
+
int PyArray_SortkindConverter (object, NPY_SORTKIND *)
|
| 707 |
+
object PyArray_LexSort (object, int)
|
| 708 |
+
object PyArray_Round (ndarray, int, ndarray)
|
| 709 |
+
unsigned char PyArray_EquivTypenums (int, int)
|
| 710 |
+
int PyArray_RegisterDataType (dtype)
|
| 711 |
+
int PyArray_RegisterCastFunc (dtype, int, PyArray_VectorUnaryFunc *)
|
| 712 |
+
int PyArray_RegisterCanCast (dtype, int, NPY_SCALARKIND)
|
| 713 |
+
#void PyArray_InitArrFuncs (PyArray_ArrFuncs *)
|
| 714 |
+
object PyArray_IntTupleFromIntp (int, npy_intp *)
|
| 715 |
+
int PyArray_TypeNumFromName (char *)
|
| 716 |
+
int PyArray_ClipmodeConverter (object, NPY_CLIPMODE *)
|
| 717 |
+
#int PyArray_OutputConverter (object, ndarray*)
|
| 718 |
+
object PyArray_BroadcastToShape (object, npy_intp *, int)
|
| 719 |
+
void _PyArray_SigintHandler (int)
|
| 720 |
+
void* _PyArray_GetSigintBuf ()
|
| 721 |
+
#int PyArray_DescrAlignConverter (object, dtype*)
|
| 722 |
+
#int PyArray_DescrAlignConverter2 (object, dtype*)
|
| 723 |
+
int PyArray_SearchsideConverter (object, void *)
|
| 724 |
+
object PyArray_CheckAxis (ndarray, int *, int)
|
| 725 |
+
npy_intp PyArray_OverflowMultiplyList (npy_intp *, int)
|
| 726 |
+
int PyArray_CompareString (char *, char *, size_t)
|
| 727 |
+
int PyArray_SetBaseObject(ndarray, base) # NOTE: steals a reference to base! Use "set_array_base()" instead.
|
| 728 |
+
|
| 729 |
+
|
| 730 |
+
# Typedefs that matches the runtime dtype objects in
|
| 731 |
+
# the numpy module.
|
| 732 |
+
|
| 733 |
+
# The ones that are commented out needs an IFDEF function
|
| 734 |
+
# in Cython to enable them only on the right systems.
|
| 735 |
+
|
| 736 |
+
ctypedef npy_int8 int8_t
|
| 737 |
+
ctypedef npy_int16 int16_t
|
| 738 |
+
ctypedef npy_int32 int32_t
|
| 739 |
+
ctypedef npy_int64 int64_t
|
| 740 |
+
#ctypedef npy_int96 int96_t
|
| 741 |
+
#ctypedef npy_int128 int128_t
|
| 742 |
+
|
| 743 |
+
ctypedef npy_uint8 uint8_t
|
| 744 |
+
ctypedef npy_uint16 uint16_t
|
| 745 |
+
ctypedef npy_uint32 uint32_t
|
| 746 |
+
ctypedef npy_uint64 uint64_t
|
| 747 |
+
#ctypedef npy_uint96 uint96_t
|
| 748 |
+
#ctypedef npy_uint128 uint128_t
|
| 749 |
+
|
| 750 |
+
ctypedef npy_float32 float32_t
|
| 751 |
+
ctypedef npy_float64 float64_t
|
| 752 |
+
#ctypedef npy_float80 float80_t
|
| 753 |
+
#ctypedef npy_float128 float128_t
|
| 754 |
+
|
| 755 |
+
ctypedef float complex complex64_t
|
| 756 |
+
ctypedef double complex complex128_t
|
| 757 |
+
|
| 758 |
+
# The int types are mapped a bit surprising --
|
| 759 |
+
# numpy.int corresponds to 'l' and numpy.long to 'q'
|
| 760 |
+
ctypedef npy_long int_t
|
| 761 |
+
ctypedef npy_longlong longlong_t
|
| 762 |
+
|
| 763 |
+
ctypedef npy_ulong uint_t
|
| 764 |
+
ctypedef npy_ulonglong ulonglong_t
|
| 765 |
+
|
| 766 |
+
ctypedef npy_intp intp_t
|
| 767 |
+
ctypedef npy_uintp uintp_t
|
| 768 |
+
|
| 769 |
+
ctypedef npy_double float_t
|
| 770 |
+
ctypedef npy_double double_t
|
| 771 |
+
ctypedef npy_longdouble longdouble_t
|
| 772 |
+
|
| 773 |
+
ctypedef npy_cfloat cfloat_t
|
| 774 |
+
ctypedef npy_cdouble cdouble_t
|
| 775 |
+
ctypedef npy_clongdouble clongdouble_t
|
| 776 |
+
|
| 777 |
+
ctypedef npy_cdouble complex_t
|
| 778 |
+
|
| 779 |
+
cdef inline object PyArray_MultiIterNew1(a):
|
| 780 |
+
return PyArray_MultiIterNew(1, <void*>a)
|
| 781 |
+
|
| 782 |
+
cdef inline object PyArray_MultiIterNew2(a, b):
|
| 783 |
+
return PyArray_MultiIterNew(2, <void*>a, <void*>b)
|
| 784 |
+
|
| 785 |
+
cdef inline object PyArray_MultiIterNew3(a, b, c):
|
| 786 |
+
return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
|
| 787 |
+
|
| 788 |
+
cdef inline object PyArray_MultiIterNew4(a, b, c, d):
|
| 789 |
+
return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
|
| 790 |
+
|
| 791 |
+
cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):
|
| 792 |
+
return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
|
| 793 |
+
|
| 794 |
+
cdef inline tuple PyDataType_SHAPE(dtype d):
|
| 795 |
+
if PyDataType_HASSUBARRAY(d):
|
| 796 |
+
return <tuple>d.subarray.shape
|
| 797 |
+
else:
|
| 798 |
+
return ()
|
| 799 |
+
|
| 800 |
+
|
| 801 |
+
cdef extern from "numpy/ndarrayobject.h":
|
| 802 |
+
PyTypeObject PyTimedeltaArrType_Type
|
| 803 |
+
PyTypeObject PyDatetimeArrType_Type
|
| 804 |
+
ctypedef int64_t npy_timedelta
|
| 805 |
+
ctypedef int64_t npy_datetime
|
| 806 |
+
|
| 807 |
+
cdef extern from "numpy/ndarraytypes.h":
|
| 808 |
+
ctypedef struct PyArray_DatetimeMetaData:
|
| 809 |
+
NPY_DATETIMEUNIT base
|
| 810 |
+
int64_t num
|
| 811 |
+
|
| 812 |
+
cdef extern from "numpy/arrayscalars.h":
|
| 813 |
+
|
| 814 |
+
# abstract types
|
| 815 |
+
ctypedef class numpy.generic [object PyObject]:
|
| 816 |
+
pass
|
| 817 |
+
ctypedef class numpy.number [object PyObject]:
|
| 818 |
+
pass
|
| 819 |
+
ctypedef class numpy.integer [object PyObject]:
|
| 820 |
+
pass
|
| 821 |
+
ctypedef class numpy.signedinteger [object PyObject]:
|
| 822 |
+
pass
|
| 823 |
+
ctypedef class numpy.unsignedinteger [object PyObject]:
|
| 824 |
+
pass
|
| 825 |
+
ctypedef class numpy.inexact [object PyObject]:
|
| 826 |
+
pass
|
| 827 |
+
ctypedef class numpy.floating [object PyObject]:
|
| 828 |
+
pass
|
| 829 |
+
ctypedef class numpy.complexfloating [object PyObject]:
|
| 830 |
+
pass
|
| 831 |
+
ctypedef class numpy.flexible [object PyObject]:
|
| 832 |
+
pass
|
| 833 |
+
ctypedef class numpy.character [object PyObject]:
|
| 834 |
+
pass
|
| 835 |
+
|
| 836 |
+
ctypedef struct PyDatetimeScalarObject:
|
| 837 |
+
# PyObject_HEAD
|
| 838 |
+
npy_datetime obval
|
| 839 |
+
PyArray_DatetimeMetaData obmeta
|
| 840 |
+
|
| 841 |
+
ctypedef struct PyTimedeltaScalarObject:
|
| 842 |
+
# PyObject_HEAD
|
| 843 |
+
npy_timedelta obval
|
| 844 |
+
PyArray_DatetimeMetaData obmeta
|
| 845 |
+
|
| 846 |
+
ctypedef enum NPY_DATETIMEUNIT:
|
| 847 |
+
NPY_FR_Y
|
| 848 |
+
NPY_FR_M
|
| 849 |
+
NPY_FR_W
|
| 850 |
+
NPY_FR_D
|
| 851 |
+
NPY_FR_B
|
| 852 |
+
NPY_FR_h
|
| 853 |
+
NPY_FR_m
|
| 854 |
+
NPY_FR_s
|
| 855 |
+
NPY_FR_ms
|
| 856 |
+
NPY_FR_us
|
| 857 |
+
NPY_FR_ns
|
| 858 |
+
NPY_FR_ps
|
| 859 |
+
NPY_FR_fs
|
| 860 |
+
NPY_FR_as
|
| 861 |
+
|
| 862 |
+
|
| 863 |
+
#
|
| 864 |
+
# ufunc API
|
| 865 |
+
#
|
| 866 |
+
|
| 867 |
+
cdef extern from "numpy/ufuncobject.h":
|
| 868 |
+
|
| 869 |
+
ctypedef void (*PyUFuncGenericFunction) (char **, npy_intp *, npy_intp *, void *)
|
| 870 |
+
|
| 871 |
+
ctypedef class numpy.ufunc [object PyUFuncObject, check_size ignore]:
|
| 872 |
+
cdef:
|
| 873 |
+
int nin, nout, nargs
|
| 874 |
+
int identity
|
| 875 |
+
PyUFuncGenericFunction *functions
|
| 876 |
+
void **data
|
| 877 |
+
int ntypes
|
| 878 |
+
int check_return
|
| 879 |
+
char *name
|
| 880 |
+
char *types
|
| 881 |
+
char *doc
|
| 882 |
+
void *ptr
|
| 883 |
+
PyObject *obj
|
| 884 |
+
PyObject *userloops
|
| 885 |
+
|
| 886 |
+
cdef enum:
|
| 887 |
+
PyUFunc_Zero
|
| 888 |
+
PyUFunc_One
|
| 889 |
+
PyUFunc_None
|
| 890 |
+
UFUNC_ERR_IGNORE
|
| 891 |
+
UFUNC_ERR_WARN
|
| 892 |
+
UFUNC_ERR_RAISE
|
| 893 |
+
UFUNC_ERR_CALL
|
| 894 |
+
UFUNC_ERR_PRINT
|
| 895 |
+
UFUNC_ERR_LOG
|
| 896 |
+
UFUNC_MASK_DIVIDEBYZERO
|
| 897 |
+
UFUNC_MASK_OVERFLOW
|
| 898 |
+
UFUNC_MASK_UNDERFLOW
|
| 899 |
+
UFUNC_MASK_INVALID
|
| 900 |
+
UFUNC_SHIFT_DIVIDEBYZERO
|
| 901 |
+
UFUNC_SHIFT_OVERFLOW
|
| 902 |
+
UFUNC_SHIFT_UNDERFLOW
|
| 903 |
+
UFUNC_SHIFT_INVALID
|
| 904 |
+
UFUNC_FPE_DIVIDEBYZERO
|
| 905 |
+
UFUNC_FPE_OVERFLOW
|
| 906 |
+
UFUNC_FPE_UNDERFLOW
|
| 907 |
+
UFUNC_FPE_INVALID
|
| 908 |
+
UFUNC_ERR_DEFAULT
|
| 909 |
+
UFUNC_ERR_DEFAULT2
|
| 910 |
+
|
| 911 |
+
object PyUFunc_FromFuncAndData(PyUFuncGenericFunction *,
|
| 912 |
+
void **, char *, int, int, int, int, char *, char *, int)
|
| 913 |
+
int PyUFunc_RegisterLoopForType(ufunc, int,
|
| 914 |
+
PyUFuncGenericFunction, int *, void *)
|
| 915 |
+
int PyUFunc_GenericFunction \
|
| 916 |
+
(ufunc, PyObject *, PyObject *, PyArrayObject **)
|
| 917 |
+
void PyUFunc_f_f_As_d_d \
|
| 918 |
+
(char **, npy_intp *, npy_intp *, void *)
|
| 919 |
+
void PyUFunc_d_d \
|
| 920 |
+
(char **, npy_intp *, npy_intp *, void *)
|
| 921 |
+
void PyUFunc_f_f \
|
| 922 |
+
(char **, npy_intp *, npy_intp *, void *)
|
| 923 |
+
void PyUFunc_g_g \
|
| 924 |
+
(char **, npy_intp *, npy_intp *, void *)
|
| 925 |
+
void PyUFunc_F_F_As_D_D \
|
| 926 |
+
(char **, npy_intp *, npy_intp *, void *)
|
| 927 |
+
void PyUFunc_F_F \
|
| 928 |
+
(char **, npy_intp *, npy_intp *, void *)
|
| 929 |
+
void PyUFunc_D_D \
|
| 930 |
+
(char **, npy_intp *, npy_intp *, void *)
|
| 931 |
+
void PyUFunc_G_G \
|
| 932 |
+
(char **, npy_intp *, npy_intp *, void *)
|
| 933 |
+
void PyUFunc_O_O \
|
| 934 |
+
(char **, npy_intp *, npy_intp *, void *)
|
| 935 |
+
void PyUFunc_ff_f_As_dd_d \
|
| 936 |
+
(char **, npy_intp *, npy_intp *, void *)
|
| 937 |
+
void PyUFunc_ff_f \
|
| 938 |
+
(char **, npy_intp *, npy_intp *, void *)
|
| 939 |
+
void PyUFunc_dd_d \
|
| 940 |
+
(char **, npy_intp *, npy_intp *, void *)
|
| 941 |
+
void PyUFunc_gg_g \
|
| 942 |
+
(char **, npy_intp *, npy_intp *, void *)
|
| 943 |
+
void PyUFunc_FF_F_As_DD_D \
|
| 944 |
+
(char **, npy_intp *, npy_intp *, void *)
|
| 945 |
+
void PyUFunc_DD_D \
|
| 946 |
+
(char **, npy_intp *, npy_intp *, void *)
|
| 947 |
+
void PyUFunc_FF_F \
|
| 948 |
+
(char **, npy_intp *, npy_intp *, void *)
|
| 949 |
+
void PyUFunc_GG_G \
|
| 950 |
+
(char **, npy_intp *, npy_intp *, void *)
|
| 951 |
+
void PyUFunc_OO_O \
|
| 952 |
+
(char **, npy_intp *, npy_intp *, void *)
|
| 953 |
+
void PyUFunc_O_O_method \
|
| 954 |
+
(char **, npy_intp *, npy_intp *, void *)
|
| 955 |
+
void PyUFunc_OO_O_method \
|
| 956 |
+
(char **, npy_intp *, npy_intp *, void *)
|
| 957 |
+
void PyUFunc_On_Om \
|
| 958 |
+
(char **, npy_intp *, npy_intp *, void *)
|
| 959 |
+
int PyUFunc_GetPyValues \
|
| 960 |
+
(char *, int *, int *, PyObject **)
|
| 961 |
+
int PyUFunc_checkfperr \
|
| 962 |
+
(int, PyObject *, int *)
|
| 963 |
+
void PyUFunc_clearfperr()
|
| 964 |
+
int PyUFunc_getfperr()
|
| 965 |
+
int PyUFunc_handlefperr \
|
| 966 |
+
(int, PyObject *, int, int *)
|
| 967 |
+
int PyUFunc_ReplaceLoopBySignature \
|
| 968 |
+
(ufunc, PyUFuncGenericFunction, int *, PyUFuncGenericFunction *)
|
| 969 |
+
object PyUFunc_FromFuncAndDataAndSignature \
|
| 970 |
+
(PyUFuncGenericFunction *, void **, char *, int, int, int,
|
| 971 |
+
int, char *, char *, int, char *)
|
| 972 |
+
|
| 973 |
+
int _import_umath() except -1
|
| 974 |
+
|
| 975 |
+
cdef inline void set_array_base(ndarray arr, object base):
|
| 976 |
+
Py_INCREF(base) # important to do this before stealing the reference below!
|
| 977 |
+
PyArray_SetBaseObject(arr, base)
|
| 978 |
+
|
| 979 |
+
cdef inline object get_array_base(ndarray arr):
|
| 980 |
+
base = PyArray_BASE(arr)
|
| 981 |
+
if base is NULL:
|
| 982 |
+
return None
|
| 983 |
+
return <object>base
|
| 984 |
+
|
| 985 |
+
# Versions of the import_* functions which are more suitable for
|
| 986 |
+
# Cython code.
|
| 987 |
+
cdef inline int import_array() except -1:
|
| 988 |
+
try:
|
| 989 |
+
__pyx_import_array()
|
| 990 |
+
except Exception:
|
| 991 |
+
raise ImportError("numpy.core.multiarray failed to import")
|
| 992 |
+
|
| 993 |
+
cdef inline int import_umath() except -1:
|
| 994 |
+
try:
|
| 995 |
+
_import_umath()
|
| 996 |
+
except Exception:
|
| 997 |
+
raise ImportError("numpy.core.umath failed to import")
|
| 998 |
+
|
| 999 |
+
cdef inline int import_ufunc() except -1:
|
| 1000 |
+
try:
|
| 1001 |
+
_import_umath()
|
| 1002 |
+
except Exception:
|
| 1003 |
+
raise ImportError("numpy.core.umath failed to import")
|
| 1004 |
+
|
| 1005 |
+
|
| 1006 |
+
cdef inline bint is_timedelta64_object(object obj):
|
| 1007 |
+
"""
|
| 1008 |
+
Cython equivalent of `isinstance(obj, np.timedelta64)`
|
| 1009 |
+
|
| 1010 |
+
Parameters
|
| 1011 |
+
----------
|
| 1012 |
+
obj : object
|
| 1013 |
+
|
| 1014 |
+
Returns
|
| 1015 |
+
-------
|
| 1016 |
+
bool
|
| 1017 |
+
"""
|
| 1018 |
+
return PyObject_TypeCheck(obj, &PyTimedeltaArrType_Type)
|
| 1019 |
+
|
| 1020 |
+
|
| 1021 |
+
cdef inline bint is_datetime64_object(object obj):
|
| 1022 |
+
"""
|
| 1023 |
+
Cython equivalent of `isinstance(obj, np.datetime64)`
|
| 1024 |
+
|
| 1025 |
+
Parameters
|
| 1026 |
+
----------
|
| 1027 |
+
obj : object
|
| 1028 |
+
|
| 1029 |
+
Returns
|
| 1030 |
+
-------
|
| 1031 |
+
bool
|
| 1032 |
+
"""
|
| 1033 |
+
return PyObject_TypeCheck(obj, &PyDatetimeArrType_Type)
|
| 1034 |
+
|
| 1035 |
+
|
| 1036 |
+
cdef inline npy_datetime get_datetime64_value(object obj) nogil:
|
| 1037 |
+
"""
|
| 1038 |
+
returns the int64 value underlying scalar numpy datetime64 object
|
| 1039 |
+
|
| 1040 |
+
Note that to interpret this as a datetime, the corresponding unit is
|
| 1041 |
+
also needed. That can be found using `get_datetime64_unit`.
|
| 1042 |
+
"""
|
| 1043 |
+
return (<PyDatetimeScalarObject*>obj).obval
|
| 1044 |
+
|
| 1045 |
+
|
| 1046 |
+
cdef inline npy_timedelta get_timedelta64_value(object obj) nogil:
|
| 1047 |
+
"""
|
| 1048 |
+
returns the int64 value underlying scalar numpy timedelta64 object
|
| 1049 |
+
"""
|
| 1050 |
+
return (<PyTimedeltaScalarObject*>obj).obval
|
| 1051 |
+
|
| 1052 |
+
|
| 1053 |
+
cdef inline NPY_DATETIMEUNIT get_datetime64_unit(object obj) nogil:
|
| 1054 |
+
"""
|
| 1055 |
+
returns the unit part of the dtype for a numpy datetime64 object.
|
| 1056 |
+
"""
|
| 1057 |
+
return <NPY_DATETIMEUNIT>(<PyDatetimeScalarObject*>obj).obmeta.base
|
tuning-competition-baseline/.venv/lib/python3.11/site-packages/Cython/Includes/numpy/math.pxd
ADDED
|
@@ -0,0 +1,133 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# NumPy math library
|
| 2 |
+
#
|
| 3 |
+
# This exports the functionality of the NumPy core math library, aka npymath,
|
| 4 |
+
# which provides implementations of C99 math functions and macros for system
|
| 5 |
+
# with a C89 library (such as MSVC). npymath is available with NumPy >=1.3,
|
| 6 |
+
# although some functions will require later versions. The spacing function is
|
| 7 |
+
# not in C99, but comes from Fortran.
|
| 8 |
+
#
|
| 9 |
+
# On the Cython side, the npymath functions are available without the "npy_"
|
| 10 |
+
# prefix that they have in C, to make this is a drop-in replacement for
|
| 11 |
+
# libc.math. The same is true for the constants, where possible.
|
| 12 |
+
#
|
| 13 |
+
# See the NumPy documentation for linking instructions.
|
| 14 |
+
#
|
| 15 |
+
# Complex number support and NumPy 2.0 half-precision functions are currently
|
| 16 |
+
# not exported.
|
| 17 |
+
#
|
| 18 |
+
# Author: Lars Buitinck
|
| 19 |
+
|
| 20 |
+
cdef extern from "numpy/npy_math.h" nogil:
|
| 21 |
+
# Floating-point classification
|
| 22 |
+
long double NAN "NPY_NAN"
|
| 23 |
+
long double INFINITY "NPY_INFINITY"
|
| 24 |
+
long double PZERO "NPY_PZERO" # positive zero
|
| 25 |
+
long double NZERO "NPY_NZERO" # negative zero
|
| 26 |
+
|
| 27 |
+
# These four are actually macros and work on any floating-point type.
|
| 28 |
+
int isinf "npy_isinf"(long double) # -1 / 0 / 1
|
| 29 |
+
bint isfinite "npy_isfinite"(long double)
|
| 30 |
+
bint isnan "npy_isnan"(long double)
|
| 31 |
+
bint signbit "npy_signbit"(long double)
|
| 32 |
+
|
| 33 |
+
# Math constants
|
| 34 |
+
long double E "NPY_E"
|
| 35 |
+
long double LOG2E "NPY_LOG2E" # ln(e) / ln(2)
|
| 36 |
+
long double LOG10E "NPY_LOG10E" # ln(e) / ln(10)
|
| 37 |
+
long double LOGE2 "NPY_LOGE2" # ln(2)
|
| 38 |
+
long double LOGE10 "NPY_LOGE10" # ln(10)
|
| 39 |
+
long double PI "NPY_PI"
|
| 40 |
+
long double PI_2 "NPY_PI_2" # pi / 2
|
| 41 |
+
long double PI_4 "NPY_PI_4" # pi / 4
|
| 42 |
+
long double NPY_1_PI # 1 / pi; NPY_ because of ident syntax
|
| 43 |
+
long double NPY_2_PI # 2 / pi
|
| 44 |
+
long double EULER "NPY_EULER" # Euler constant (gamma, 0.57721)
|
| 45 |
+
|
| 46 |
+
# Low-level floating point manipulation (NumPy >=1.4)
|
| 47 |
+
float copysignf "npy_copysignf"(float, float)
|
| 48 |
+
float nextafterf "npy_nextafterf"(float x, float y)
|
| 49 |
+
float spacingf "npy_spacingf"(float x)
|
| 50 |
+
double copysign "npy_copysign"(double, double)
|
| 51 |
+
double nextafter "npy_nextafter"(double x, double y)
|
| 52 |
+
double spacing "npy_spacing"(double x)
|
| 53 |
+
long double copysignl "npy_copysignl"(long double, long double)
|
| 54 |
+
long double nextafterl "npy_nextafterl"(long double x, long double y)
|
| 55 |
+
long double spacingl "npy_spacingl"(long double x)
|
| 56 |
+
|
| 57 |
+
# Float C99 functions
|
| 58 |
+
float sinf "npy_sinf"(float x)
|
| 59 |
+
float cosf "npy_cosf"(float x)
|
| 60 |
+
float tanf "npy_tanf"(float x)
|
| 61 |
+
float sinhf "npy_sinhf"(float x)
|
| 62 |
+
float coshf "npy_coshf"(float x)
|
| 63 |
+
float tanhf "npy_tanhf"(float x)
|
| 64 |
+
float fabsf "npy_fabsf"(float x)
|
| 65 |
+
float floorf "npy_floorf"(float x)
|
| 66 |
+
float ceilf "npy_ceilf"(float x)
|
| 67 |
+
float rintf "npy_rintf"(float x)
|
| 68 |
+
float sqrtf "npy_sqrtf"(float x)
|
| 69 |
+
float log10f "npy_log10f"(float x)
|
| 70 |
+
float logf "npy_logf"(float x)
|
| 71 |
+
float expf "npy_expf"(float x)
|
| 72 |
+
float expm1f "npy_expm1f"(float x)
|
| 73 |
+
float asinf "npy_asinf"(float x)
|
| 74 |
+
float acosf "npy_acosf"(float x)
|
| 75 |
+
float atanf "npy_atanf"(float x)
|
| 76 |
+
float asinhf "npy_asinhf"(float x)
|
| 77 |
+
float acoshf "npy_acoshf"(float x)
|
| 78 |
+
float atanhf "npy_atanhf"(float x)
|
| 79 |
+
float log1pf "npy_log1pf"(float x)
|
| 80 |
+
float exp2f "npy_exp2f"(float x)
|
| 81 |
+
float log2f "npy_log2f"(float x)
|
| 82 |
+
float atan2f "npy_atan2f"(float x, float y)
|
| 83 |
+
float hypotf "npy_hypotf"(float x, float y)
|
| 84 |
+
float powf "npy_powf"(float x, float y)
|
| 85 |
+
float fmodf "npy_fmodf"(float x, float y)
|
| 86 |
+
float modff "npy_modff"(float x, float* y)
|
| 87 |
+
|
| 88 |
+
# Long double C99 functions
|
| 89 |
+
long double sinl "npy_sinl"(long double x)
|
| 90 |
+
long double cosl "npy_cosl"(long double x)
|
| 91 |
+
long double tanl "npy_tanl"(long double x)
|
| 92 |
+
long double sinhl "npy_sinhl"(long double x)
|
| 93 |
+
long double coshl "npy_coshl"(long double x)
|
| 94 |
+
long double tanhl "npy_tanhl"(long double x)
|
| 95 |
+
long double fabsl "npy_fabsl"(long double x)
|
| 96 |
+
long double floorl "npy_floorl"(long double x)
|
| 97 |
+
long double ceill "npy_ceill"(long double x)
|
| 98 |
+
long double rintl "npy_rintl"(long double x)
|
| 99 |
+
long double sqrtl "npy_sqrtl"(long double x)
|
| 100 |
+
long double log10l "npy_log10l"(long double x)
|
| 101 |
+
long double logl "npy_logl"(long double x)
|
| 102 |
+
long double expl "npy_expl"(long double x)
|
| 103 |
+
long double expm1l "npy_expm1l"(long double x)
|
| 104 |
+
long double asinl "npy_asinl"(long double x)
|
| 105 |
+
long double acosl "npy_acosl"(long double x)
|
| 106 |
+
long double atanl "npy_atanl"(long double x)
|
| 107 |
+
long double asinhl "npy_asinhl"(long double x)
|
| 108 |
+
long double acoshl "npy_acoshl"(long double x)
|
| 109 |
+
long double atanhl "npy_atanhl"(long double x)
|
| 110 |
+
long double log1pl "npy_log1pl"(long double x)
|
| 111 |
+
long double exp2l "npy_exp2l"(long double x)
|
| 112 |
+
long double log2l "npy_log2l"(long double x)
|
| 113 |
+
long double atan2l "npy_atan2l"(long double x, long double y)
|
| 114 |
+
long double hypotl "npy_hypotl"(long double x, long double y)
|
| 115 |
+
long double powl "npy_powl"(long double x, long double y)
|
| 116 |
+
long double fmodl "npy_fmodl"(long double x, long double y)
|
| 117 |
+
long double modfl "npy_modfl"(long double x, long double* y)
|
| 118 |
+
|
| 119 |
+
# NumPy extensions
|
| 120 |
+
float deg2radf "npy_deg2radf"(float x)
|
| 121 |
+
float rad2degf "npy_rad2degf"(float x)
|
| 122 |
+
float logaddexpf "npy_logaddexpf"(float x, float y)
|
| 123 |
+
float logaddexp2f "npy_logaddexp2f"(float x, float y)
|
| 124 |
+
|
| 125 |
+
double deg2rad "npy_deg2rad"(double x)
|
| 126 |
+
double rad2deg "npy_rad2deg"(double x)
|
| 127 |
+
double logaddexp "npy_logaddexp"(double x, double y)
|
| 128 |
+
double logaddexp2 "npy_logaddexp2"(double x, double y)
|
| 129 |
+
|
| 130 |
+
long double deg2radl "npy_deg2radl"(long double x)
|
| 131 |
+
long double rad2degl "npy_rad2degl"(long double x)
|
| 132 |
+
long double logaddexpl "npy_logaddexpl"(long double x, long double y)
|
| 133 |
+
long double logaddexp2l "npy_logaddexp2l"(long double x, long double y)
|
tuning-competition-baseline/.venv/lib/python3.11/site-packages/Cython/Includes/posix/dlfcn.pxd
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# POSIX dynamic linking/loading interface.
|
| 2 |
+
# https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/dlfcn.h.html
|
| 3 |
+
|
| 4 |
+
cdef extern from "<dlfcn.h>" nogil:
|
| 5 |
+
void *dlopen(const char *, int)
|
| 6 |
+
char *dlerror()
|
| 7 |
+
void *dlsym(void *, const char *)
|
| 8 |
+
int dlclose(void *)
|
| 9 |
+
|
| 10 |
+
enum:
|
| 11 |
+
RTLD_LAZY
|
| 12 |
+
RTLD_NOW
|
| 13 |
+
RTLD_GLOBAL
|
| 14 |
+
RTLD_LOCAL
|
tuning-competition-baseline/.venv/lib/python3.11/site-packages/Cython/Includes/posix/ioctl.pxd
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
cdef extern from "<sys/ioctl.h>" nogil:
|
| 2 |
+
enum: FIONBIO
|
| 3 |
+
|
| 4 |
+
int ioctl(int fd, int request, ...)
|
tuning-competition-baseline/.venv/lib/python3.11/site-packages/Cython/Includes/posix/resource.pxd
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_resource.h.html
|
| 2 |
+
# https://man7.org/linux/man-pages/man2/getrusage.2.html
|
| 3 |
+
|
| 4 |
+
from posix.time cimport timeval
|
| 5 |
+
from posix.types cimport id_t
|
| 6 |
+
|
| 7 |
+
cdef extern from "<sys/resource.h>" nogil:
|
| 8 |
+
|
| 9 |
+
enum: PRIO_PROCESS
|
| 10 |
+
enum: PRIO_PGRP
|
| 11 |
+
enum: PRIO_USER
|
| 12 |
+
|
| 13 |
+
enum: RLIM_INFINITY
|
| 14 |
+
enum: RLIM_SAVED_MAX
|
| 15 |
+
enum: RLIM_SAVED_CUR
|
| 16 |
+
|
| 17 |
+
enum: RUSAGE_SELF
|
| 18 |
+
enum: RUSAGE_CHILDREN
|
| 19 |
+
|
| 20 |
+
enum: RLIMIT_CORE
|
| 21 |
+
enum: RLIMIT_CPU
|
| 22 |
+
enum: RLIMIT_DATA
|
| 23 |
+
enum: RLIMIT_FSIZE
|
| 24 |
+
enum: RLIMIT_NOFILE
|
| 25 |
+
enum: RLIMIT_STACK
|
| 26 |
+
enum: RLIMIT_AS
|
| 27 |
+
|
| 28 |
+
ctypedef unsigned long rlim_t
|
| 29 |
+
|
| 30 |
+
cdef struct rlimit:
|
| 31 |
+
rlim_t rlim_cur
|
| 32 |
+
rlim_t rlim_max
|
| 33 |
+
|
| 34 |
+
cdef struct rusage:
|
| 35 |
+
timeval ru_utime
|
| 36 |
+
timeval ru_stime
|
| 37 |
+
# Linux-specific
|
| 38 |
+
long ru_maxrss
|
| 39 |
+
long ru_ixrss
|
| 40 |
+
long ru_idrss
|
| 41 |
+
long ru_isrss
|
| 42 |
+
long ru_minflt
|
| 43 |
+
long ru_majflt
|
| 44 |
+
long ru_nswap
|
| 45 |
+
long ru_inblock
|
| 46 |
+
long ru_oublock
|
| 47 |
+
long ru_msgsnd
|
| 48 |
+
long ru_msgrcv
|
| 49 |
+
long ru_nsignals
|
| 50 |
+
long ru_nvcsw
|
| 51 |
+
long ru_nivcsw
|
| 52 |
+
|
| 53 |
+
int getpriority(int, id_t)
|
| 54 |
+
int getrlimit(int, rlimit *)
|
| 55 |
+
int getrusage(int, rusage *)
|
| 56 |
+
int setpriority(int, id_t, int)
|
| 57 |
+
int setrlimit(int, const rlimit *)
|
tuning-competition-baseline/.venv/lib/python3.11/site-packages/Cython/Includes/posix/select.pxd
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_select.h.html
|
| 2 |
+
|
| 3 |
+
from .types cimport sigset_t
|
| 4 |
+
from .time cimport timeval, timespec
|
| 5 |
+
|
| 6 |
+
cdef extern from "<sys/select.h>" nogil:
|
| 7 |
+
ctypedef struct fd_set:
|
| 8 |
+
pass
|
| 9 |
+
|
| 10 |
+
int FD_SETSIZE
|
| 11 |
+
void FD_SET(int, fd_set*)
|
| 12 |
+
void FD_CLR(int, fd_set*)
|
| 13 |
+
bint FD_ISSET(int, fd_set*)
|
| 14 |
+
void FD_ZERO(fd_set*)
|
| 15 |
+
|
| 16 |
+
int select(int nfds, fd_set *readfds, fd_set *writefds,
|
| 17 |
+
fd_set *exceptfds, timeval *timeout)
|
| 18 |
+
|
| 19 |
+
int pselect(int nfds, fd_set *readfds, fd_set *writefds,
|
| 20 |
+
fd_set *exceptfds, const timespec *timeout,
|
| 21 |
+
const sigset_t *sigmask)
|
tuning-competition-baseline/.venv/lib/python3.11/site-packages/Cython/Includes/posix/stat.pxd
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# https://pubs.opengroup.org/onlinepubs/009695399/basedefs/sys/stat.h.html
|
| 2 |
+
# https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_stat.h.html
|
| 3 |
+
|
| 4 |
+
from posix.types cimport (blkcnt_t, blksize_t, dev_t, gid_t, ino_t, mode_t,
|
| 5 |
+
nlink_t, off_t, time_t, uid_t)
|
| 6 |
+
from posix.time cimport timespec
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
cdef extern from "<sys/stat.h>" nogil:
|
| 10 |
+
cdef struct struct_stat "stat":
|
| 11 |
+
dev_t st_dev
|
| 12 |
+
ino_t st_ino
|
| 13 |
+
mode_t st_mode
|
| 14 |
+
nlink_t st_nlink
|
| 15 |
+
uid_t st_uid
|
| 16 |
+
gid_t st_gid
|
| 17 |
+
dev_t st_rdev
|
| 18 |
+
off_t st_size
|
| 19 |
+
blksize_t st_blksize
|
| 20 |
+
blkcnt_t st_blocks
|
| 21 |
+
# POSIX.1-2001
|
| 22 |
+
time_t st_atime
|
| 23 |
+
time_t st_mtime
|
| 24 |
+
time_t st_ctime
|
| 25 |
+
# POSIX.1-2008
|
| 26 |
+
timespec st_atim
|
| 27 |
+
timespec st_mtim
|
| 28 |
+
timespec st_ctim
|
| 29 |
+
|
| 30 |
+
# st_birthtime exists on *BSD and OS X.
|
| 31 |
+
# Under Linux, defining it here does not hurt. Compilation under Linux
|
| 32 |
+
# will only (and rightfully) fail when attempting to use the field.
|
| 33 |
+
time_t st_birthtime
|
| 34 |
+
|
| 35 |
+
# POSIX prescribes including both <sys/stat.h> and <unistd.h> for these
|
| 36 |
+
cdef extern from "<unistd.h>" nogil:
|
| 37 |
+
int chmod(const char *, mode_t)
|
| 38 |
+
int fchmod(int, mode_t)
|
| 39 |
+
int fchmodat(int, const char *, mode_t, int flags)
|
| 40 |
+
|
| 41 |
+
int stat(const char *, struct_stat *)
|
| 42 |
+
int lstat(const char *, struct_stat *)
|
| 43 |
+
int fstat(int, struct_stat *)
|
| 44 |
+
int fstatat(int, const char *, struct_stat *, int flags)
|
| 45 |
+
|
| 46 |
+
int mkdir(const char *, mode_t)
|
| 47 |
+
int mkdirat(int, const char *, mode_t)
|
| 48 |
+
int mkfifo(const char *, mode_t)
|
| 49 |
+
int mkfifoat(int, const char *, mode_t)
|
| 50 |
+
int mknod(const char *, mode_t, dev_t)
|
| 51 |
+
int mknodat(int, const char *, mode_t, dev_t)
|
| 52 |
+
|
| 53 |
+
int futimens(int, const timespec *)
|
| 54 |
+
int utimensat(int, const char *, const timespec *, int flags)
|
| 55 |
+
|
| 56 |
+
# Macros for st_mode
|
| 57 |
+
mode_t S_ISREG(mode_t)
|
| 58 |
+
mode_t S_ISDIR(mode_t)
|
| 59 |
+
mode_t S_ISCHR(mode_t)
|
| 60 |
+
mode_t S_ISBLK(mode_t)
|
| 61 |
+
mode_t S_ISFIFO(mode_t)
|
| 62 |
+
mode_t S_ISLNK(mode_t)
|
| 63 |
+
mode_t S_ISSOCK(mode_t)
|
| 64 |
+
|
| 65 |
+
mode_t S_IFMT
|
| 66 |
+
mode_t S_IFREG
|
| 67 |
+
mode_t S_IFDIR
|
| 68 |
+
mode_t S_IFCHR
|
| 69 |
+
mode_t S_IFBLK
|
| 70 |
+
mode_t S_IFIFO
|
| 71 |
+
mode_t S_IFLNK
|
| 72 |
+
mode_t S_IFSOCK
|
| 73 |
+
|
| 74 |
+
# Permissions
|
| 75 |
+
mode_t S_ISUID
|
| 76 |
+
mode_t S_ISGID
|
| 77 |
+
mode_t S_ISVTX
|
| 78 |
+
|
| 79 |
+
mode_t S_IRWXU
|
| 80 |
+
mode_t S_IRUSR
|
| 81 |
+
mode_t S_IWUSR
|
| 82 |
+
mode_t S_IXUSR
|
| 83 |
+
|
| 84 |
+
mode_t S_IRWXG
|
| 85 |
+
mode_t S_IRGRP
|
| 86 |
+
mode_t S_IWGRP
|
| 87 |
+
mode_t S_IXGRP
|
| 88 |
+
|
| 89 |
+
mode_t S_IRWXO
|
| 90 |
+
mode_t S_IROTH
|
| 91 |
+
mode_t S_IWOTH
|
| 92 |
+
mode_t S_IXOTH
|
| 93 |
+
|
| 94 |
+
# test file types
|
| 95 |
+
bint S_TYPEISMQ(struct_stat *buf)
|
| 96 |
+
bint S_TYPEISSEM(struct_stat *buf)
|
| 97 |
+
bint S_TYPEISSHM(struct_stat *buf)
|
| 98 |
+
bint S_TYPEISTMO(struct_stat *buf)
|
tuning-competition-baseline/.venv/lib/python3.11/site-packages/Cython/Includes/posix/strings.pxd
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
cdef extern from "<strings.h>" nogil:
|
| 2 |
+
int bcmp(const void *, const void *, size_t)
|
| 3 |
+
void bcopy(const void *, void *, size_t)
|
| 4 |
+
void bzero(void *, size_t)
|
| 5 |
+
int ffs(int)
|
| 6 |
+
char *index(const char *, int)
|
| 7 |
+
char *rindex(const char *, int)
|
| 8 |
+
int strcasecmp(const char *, const char *)
|
| 9 |
+
int strncasecmp(const char *, const char *, size_t)
|
tuning-competition-baseline/.venv/lib/python3.11/site-packages/Cython/Includes/posix/uio.pxd
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_uio.h.html
|
| 2 |
+
|
| 3 |
+
from posix.types cimport off_t
|
| 4 |
+
|
| 5 |
+
|
| 6 |
+
cdef extern from "<sys/uio.h>" nogil:
|
| 7 |
+
|
| 8 |
+
cdef struct iovec:
|
| 9 |
+
void *iov_base
|
| 10 |
+
size_t iov_len
|
| 11 |
+
|
| 12 |
+
ssize_t readv (int fd, const iovec *iov, int iovcnt)
|
| 13 |
+
ssize_t writev(int fd, const iovec *iov, int iovcnt)
|
| 14 |
+
|
| 15 |
+
# Linux-specific, https://man7.org/linux/man-pages/man2/readv.2.html
|
| 16 |
+
ssize_t preadv (int fd, const iovec *iov, int iovcnt, off_t offset)
|
| 17 |
+
ssize_t pwritev(int fd, const iovec *iov, int iovcnt, off_t offset)
|
| 18 |
+
|
| 19 |
+
enum: RWF_DSYNC
|
| 20 |
+
enum: RWF_HIPRI
|
| 21 |
+
enum: RWF_SYNC
|
| 22 |
+
enum: RWF_NOWAIT
|
| 23 |
+
enum: RWF_APPEND
|
| 24 |
+
|
| 25 |
+
ssize_t preadv2 (int fd, const iovec *iov, int iovcnt, off_t offset, int flags)
|
| 26 |
+
ssize_t pwritev2(int fd, const iovec *iov, int iovcnt, off_t offset, int flags)
|
tuning-competition-baseline/.venv/lib/python3.11/site-packages/Cython/Includes/posix/unistd.pxd
ADDED
|
@@ -0,0 +1,271 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# http://www.opengroup.org/onlinepubs/009695399/basedefs/unistd.h.html
|
| 2 |
+
|
| 3 |
+
from posix.types cimport gid_t, pid_t, off_t, uid_t
|
| 4 |
+
|
| 5 |
+
cdef extern from "<unistd.h>" nogil:
|
| 6 |
+
|
| 7 |
+
#:NULL
|
| 8 |
+
|
| 9 |
+
enum: R_OK
|
| 10 |
+
enum: W_OK
|
| 11 |
+
enum: X_OK
|
| 12 |
+
enum: F_OK
|
| 13 |
+
|
| 14 |
+
enum: _CS_PATH
|
| 15 |
+
enum: _CS_POSIX_V6_ILP32_OFF32_CFLAGS
|
| 16 |
+
enum: _CS_POSIX_V6_ILP32_OFF32_LDFLAGS
|
| 17 |
+
enum: _CS_POSIX_V6_ILP32_OFF32_LIBS
|
| 18 |
+
enum: _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS
|
| 19 |
+
enum: _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS
|
| 20 |
+
enum: _CS_POSIX_V6_ILP32_OFFBIG_LIBS
|
| 21 |
+
enum: _CS_POSIX_V6_LP64_OFF64_CFLAGS
|
| 22 |
+
enum: _CS_POSIX_V6_LP64_OFF64_LDFLAGS
|
| 23 |
+
enum: _CS_POSIX_V6_LP64_OFF64_LIBS
|
| 24 |
+
enum: _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS
|
| 25 |
+
enum: _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS
|
| 26 |
+
enum: _CS_POSIX_V6_LPBIG_OFFBIG_LIBS
|
| 27 |
+
enum: _CS_POSIX_V6_WIDTH_RESTRICTED_ENVS
|
| 28 |
+
|
| 29 |
+
enum: SEEK_SET
|
| 30 |
+
enum: SEEK_CUR
|
| 31 |
+
enum: SEEK_END
|
| 32 |
+
|
| 33 |
+
enum: F_LOCK
|
| 34 |
+
enum: F_TEST
|
| 35 |
+
enum: F_TLOCK
|
| 36 |
+
enum: F_ULOCK
|
| 37 |
+
|
| 38 |
+
enum: _PC_2_SYMLINKS
|
| 39 |
+
enum: _PC_ALLOC_SIZE_MIN
|
| 40 |
+
enum: _PC_ASYNC_IO
|
| 41 |
+
enum: _PC_CHOWN_RESTRICTED
|
| 42 |
+
enum: _PC_FILESIZEBITS
|
| 43 |
+
enum: _PC_LINK_MAX
|
| 44 |
+
enum: _PC_MAX_CANON
|
| 45 |
+
enum: _PC_MAX_INPUT
|
| 46 |
+
enum: _PC_NAME_MAX
|
| 47 |
+
enum: _PC_NO_TRUNC
|
| 48 |
+
enum: _PC_PATH_MAX
|
| 49 |
+
enum: _PC_PIPE_BUF
|
| 50 |
+
enum: _PC_PRIO_IO
|
| 51 |
+
enum: _PC_REC_INCR_XFER_SIZE
|
| 52 |
+
enum: _PC_REC_MIN_XFER_SIZE
|
| 53 |
+
enum: _PC_REC_XFER_ALIGN
|
| 54 |
+
enum: _PC_SYMLINK_MAX
|
| 55 |
+
enum: _PC_SYNC_IO
|
| 56 |
+
enum: _PC_VDISABLE
|
| 57 |
+
|
| 58 |
+
enum: _SC_2_C_BIND
|
| 59 |
+
enum: _SC_2_C_DEV
|
| 60 |
+
enum: _SC_2_CHAR_TERM
|
| 61 |
+
enum: _SC_2_FORT_DEV
|
| 62 |
+
enum: _SC_2_FORT_RUN
|
| 63 |
+
enum: _SC_2_LOCALEDEF
|
| 64 |
+
enum: _SC_2_PBS
|
| 65 |
+
enum: _SC_2_PBS_ACCOUNTING
|
| 66 |
+
enum: _SC_2_PBS_CHECKPOINT
|
| 67 |
+
enum: _SC_2_PBS_LOCATE
|
| 68 |
+
enum: _SC_2_PBS_MESSAGE
|
| 69 |
+
enum: _SC_2_PBS_TRACK
|
| 70 |
+
enum: _SC_2_SW_DEV
|
| 71 |
+
enum: _SC_2_UPE
|
| 72 |
+
enum: _SC_2_VERSION
|
| 73 |
+
enum: _SC_ADVISORY_INFO
|
| 74 |
+
enum: _SC_AIO_LISTIO_MAX
|
| 75 |
+
enum: _SC_AIO_MAX
|
| 76 |
+
enum: _SC_AIO_PRIO_DELTA_MAX
|
| 77 |
+
enum: _SC_ARG_MAX
|
| 78 |
+
enum: _SC_ASYNCHRONOUS_IO
|
| 79 |
+
enum: _SC_ATEXIT_MAX
|
| 80 |
+
enum: _SC_BARRIERS
|
| 81 |
+
enum: _SC_BC_BASE_MAX
|
| 82 |
+
enum: _SC_BC_DIM_MAX
|
| 83 |
+
enum: _SC_BC_SCALE_MAX
|
| 84 |
+
enum: _SC_BC_STRING_MAX
|
| 85 |
+
enum: _SC_CHILD_MAX
|
| 86 |
+
enum: _SC_CLK_TCK
|
| 87 |
+
enum: _SC_CLOCK_SELECTION
|
| 88 |
+
enum: _SC_COLL_WEIGHTS_MAX
|
| 89 |
+
enum: _SC_CPUTIME
|
| 90 |
+
enum: _SC_DELAYTIMER_MAX
|
| 91 |
+
enum: _SC_EXPR_NEST_MAX
|
| 92 |
+
enum: _SC_FSYNC
|
| 93 |
+
enum: _SC_GETGR_R_SIZE_MAX
|
| 94 |
+
enum: _SC_GETPW_R_SIZE_MAX
|
| 95 |
+
enum: _SC_HOST_NAME_MAX
|
| 96 |
+
enum: _SC_IOV_MAX
|
| 97 |
+
enum: _SC_IPV6
|
| 98 |
+
enum: _SC_JOB_CONTROL
|
| 99 |
+
enum: _SC_LINE_MAX
|
| 100 |
+
enum: _SC_LOGIN_NAME_MAX
|
| 101 |
+
enum: _SC_MAPPED_FILES
|
| 102 |
+
enum: _SC_MEMLOCK
|
| 103 |
+
enum: _SC_MEMLOCK_RANGE
|
| 104 |
+
enum: _SC_MEMORY_PROTECTION
|
| 105 |
+
enum: _SC_MESSAGE_PASSING
|
| 106 |
+
enum: _SC_MONOTONIC_CLOCK
|
| 107 |
+
enum: _SC_MQ_OPEN_MAX
|
| 108 |
+
enum: _SC_MQ_PRIO_MAX
|
| 109 |
+
enum: _SC_NGROUPS_MAX
|
| 110 |
+
enum: _SC_OPEN_MAX
|
| 111 |
+
enum: _SC_PAGE_SIZE
|
| 112 |
+
enum: _SC_PAGESIZE
|
| 113 |
+
enum: _SC_PRIORITIZED_IO
|
| 114 |
+
enum: _SC_PRIORITY_SCHEDULING
|
| 115 |
+
enum: _SC_RAW_SOCKETS
|
| 116 |
+
enum: _SC_RE_DUP_MAX
|
| 117 |
+
enum: _SC_READER_WRITER_LOCKS
|
| 118 |
+
enum: _SC_REALTIME_SIGNALS
|
| 119 |
+
enum: _SC_REGEXP
|
| 120 |
+
enum: _SC_RTSIG_MAX
|
| 121 |
+
enum: _SC_SAVED_IDS
|
| 122 |
+
enum: _SC_SEM_NSEMS_MAX
|
| 123 |
+
enum: _SC_SEM_VALUE_MAX
|
| 124 |
+
enum: _SC_SEMAPHORES
|
| 125 |
+
enum: _SC_SHARED_MEMORY_OBJECTS
|
| 126 |
+
enum: _SC_SHELL
|
| 127 |
+
enum: _SC_SIGQUEUE_MAX
|
| 128 |
+
enum: _SC_SPAWN
|
| 129 |
+
enum: _SC_SPIN_LOCKS
|
| 130 |
+
enum: _SC_SPORADIC_SERVER
|
| 131 |
+
enum: _SC_SS_REPL_MAX
|
| 132 |
+
enum: _SC_STREAM_MAX
|
| 133 |
+
enum: _SC_SYMLOOP_MAX
|
| 134 |
+
enum: _SC_SYNCHRONIZED_IO
|
| 135 |
+
enum: _SC_THREAD_ATTR_STACKADDR
|
| 136 |
+
enum: _SC_THREAD_ATTR_STACKSIZE
|
| 137 |
+
enum: _SC_THREAD_CPUTIME
|
| 138 |
+
enum: _SC_THREAD_DESTRUCTOR_ITERATIONS
|
| 139 |
+
enum: _SC_THREAD_KEYS_MAX
|
| 140 |
+
enum: _SC_THREAD_PRIO_INHERIT
|
| 141 |
+
enum: _SC_THREAD_PRIO_PROTECT
|
| 142 |
+
enum: _SC_THREAD_PRIORITY_SCHEDULING
|
| 143 |
+
enum: _SC_THREAD_PROCESS_SHARED
|
| 144 |
+
enum: _SC_THREAD_SAFE_FUNCTIONS
|
| 145 |
+
enum: _SC_THREAD_SPORADIC_SERVER
|
| 146 |
+
enum: _SC_THREAD_STACK_MIN
|
| 147 |
+
enum: _SC_THREAD_THREADS_MAX
|
| 148 |
+
enum: _SC_THREADS
|
| 149 |
+
enum: _SC_TIMEOUTS
|
| 150 |
+
enum: _SC_TIMER_MAX
|
| 151 |
+
enum: _SC_TIMERS
|
| 152 |
+
enum: _SC_TRACE
|
| 153 |
+
enum: _SC_TRACE_EVENT_FILTER
|
| 154 |
+
enum: _SC_TRACE_EVENT_NAME_MAX
|
| 155 |
+
enum: _SC_TRACE_INHERIT
|
| 156 |
+
enum: _SC_TRACE_LOG
|
| 157 |
+
enum: _SC_TRACE_NAME_MAX
|
| 158 |
+
enum: _SC_TRACE_SYS_MAX
|
| 159 |
+
enum: _SC_TRACE_USER_EVENT_MAX
|
| 160 |
+
enum: _SC_TTY_NAME_MAX
|
| 161 |
+
enum: _SC_TYPED_MEMORY_OBJECTS
|
| 162 |
+
enum: _SC_TZNAME_MAX
|
| 163 |
+
enum: _SC_V6_ILP32_OFF32
|
| 164 |
+
enum: _SC_V6_ILP32_OFFBIG
|
| 165 |
+
enum: _SC_V6_LP64_OFF64
|
| 166 |
+
enum: _SC_V6_LPBIG_OFFBIG
|
| 167 |
+
enum: _SC_VERSION
|
| 168 |
+
enum: _SC_XBS5_ILP32_OFF32
|
| 169 |
+
enum: _SC_XBS5_ILP32_OFFBIG
|
| 170 |
+
enum: _SC_XBS5_LP64_OFF64
|
| 171 |
+
enum: _SC_XBS5_LPBIG_OFFBIG
|
| 172 |
+
enum: _SC_XOPEN_CRYPT
|
| 173 |
+
enum: _SC_XOPEN_ENH_I18N
|
| 174 |
+
enum: _SC_XOPEN_LEGACY
|
| 175 |
+
enum: _SC_XOPEN_REALTIME
|
| 176 |
+
enum: _SC_XOPEN_REALTIME_THREADS
|
| 177 |
+
enum: _SC_XOPEN_SHM
|
| 178 |
+
enum: _SC_XOPEN_STREAMS
|
| 179 |
+
enum: _SC_XOPEN_UNIX
|
| 180 |
+
enum: _SC_XOPEN_VERSION
|
| 181 |
+
|
| 182 |
+
enum: STDIN_FILENO #0
|
| 183 |
+
enum: STDOUT_FILENO #1
|
| 184 |
+
enum: STDERR_FILENO #2
|
| 185 |
+
|
| 186 |
+
ctypedef unsigned useconds_t
|
| 187 |
+
|
| 188 |
+
int access(const char *, int)
|
| 189 |
+
unsigned alarm(unsigned)
|
| 190 |
+
int chdir(const char *)
|
| 191 |
+
int chown(const char *, uid_t, gid_t)
|
| 192 |
+
int close(int)
|
| 193 |
+
size_t confstr(int, char *, size_t)
|
| 194 |
+
char *crypt(const char *, const char *)
|
| 195 |
+
char *ctermid(char *)
|
| 196 |
+
int dup(int)
|
| 197 |
+
int dup2(int, int)
|
| 198 |
+
void encrypt(char[64], int)
|
| 199 |
+
int execl(const char *, const char *, ...)
|
| 200 |
+
int execle(const char *, const char *, ...)
|
| 201 |
+
int execlp(const char *, const char *, ...)
|
| 202 |
+
int execv(const char *, char *[])
|
| 203 |
+
int execve(const char *, char *[], char *[])
|
| 204 |
+
int execvp(const char *, char *[])
|
| 205 |
+
void _exit(int)
|
| 206 |
+
int fchown(int, uid_t, gid_t)
|
| 207 |
+
int fchdir(int)
|
| 208 |
+
int fdatasync(int)
|
| 209 |
+
pid_t fork()
|
| 210 |
+
long fpathconf(int, int)
|
| 211 |
+
int fsync(int)
|
| 212 |
+
int ftruncate(int, off_t)
|
| 213 |
+
char *getcwd(char *, size_t)
|
| 214 |
+
gid_t getegid()
|
| 215 |
+
uid_t geteuid()
|
| 216 |
+
gid_t getgid()
|
| 217 |
+
int getgroups(int, gid_t [])
|
| 218 |
+
long gethostid()
|
| 219 |
+
int gethostname(char *, size_t)
|
| 220 |
+
char *getlogin()
|
| 221 |
+
int getlogin_r(char *, size_t)
|
| 222 |
+
int getopt(int, char * [], const char *)
|
| 223 |
+
pid_t getpgid(pid_t)
|
| 224 |
+
pid_t getpgrp()
|
| 225 |
+
pid_t getpid()
|
| 226 |
+
pid_t getppid()
|
| 227 |
+
pid_t getsid(pid_t)
|
| 228 |
+
uid_t getuid()
|
| 229 |
+
char *getwd(char *)
|
| 230 |
+
int isatty(int)
|
| 231 |
+
int lchown(const char *, uid_t, gid_t)
|
| 232 |
+
int link(const char *, const char *)
|
| 233 |
+
int lockf(int, int, off_t)
|
| 234 |
+
off_t lseek(int, off_t, int)
|
| 235 |
+
int nice(int)
|
| 236 |
+
long pathconf(char *, int)
|
| 237 |
+
int pause()
|
| 238 |
+
int pipe(int [2])
|
| 239 |
+
ssize_t pread(int, void *, size_t, off_t)
|
| 240 |
+
ssize_t pwrite(int, const void *, size_t, off_t)
|
| 241 |
+
ssize_t read(int, void *, size_t)
|
| 242 |
+
ssize_t readlink(const char *, char *, size_t)
|
| 243 |
+
int rmdir(const char *)
|
| 244 |
+
int setegid(gid_t)
|
| 245 |
+
int seteuid(uid_t)
|
| 246 |
+
int setgid(gid_t)
|
| 247 |
+
int setpgid(pid_t, pid_t)
|
| 248 |
+
pid_t setpgrp()
|
| 249 |
+
int setregid(gid_t, gid_t)
|
| 250 |
+
int setreuid(uid_t, uid_t)
|
| 251 |
+
pid_t setsid()
|
| 252 |
+
int setuid(uid_t)
|
| 253 |
+
unsigned sleep(unsigned)
|
| 254 |
+
void swab(const void *, void *, ssize_t)
|
| 255 |
+
int symlink(const char *, const char *)
|
| 256 |
+
void sync()
|
| 257 |
+
long sysconf(int)
|
| 258 |
+
pid_t tcgetpgrp(int)
|
| 259 |
+
int tcsetpgrp(int, pid_t)
|
| 260 |
+
int truncate(const char *, off_t)
|
| 261 |
+
char *ttyname(int)
|
| 262 |
+
int ttyname_r(int, char *, size_t)
|
| 263 |
+
useconds_t ualarm(useconds_t, useconds_t)
|
| 264 |
+
int unlink(const char *)
|
| 265 |
+
int usleep(useconds_t)
|
| 266 |
+
pid_t vfork()
|
| 267 |
+
ssize_t write(int, const void *, size_t)
|
| 268 |
+
char *optarg
|
| 269 |
+
int optind
|
| 270 |
+
int opterr
|
| 271 |
+
int optopt
|
tuning-competition-baseline/.venv/lib/python3.11/site-packages/Cython/Includes/posix/wait.pxd
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_wait.h.html
|
| 2 |
+
|
| 3 |
+
from posix.types cimport pid_t, id_t
|
| 4 |
+
from posix.signal cimport siginfo_t
|
| 5 |
+
from posix.resource cimport rusage
|
| 6 |
+
|
| 7 |
+
cdef extern from "<sys/wait.h>" nogil:
|
| 8 |
+
enum: WNOHANG
|
| 9 |
+
enum: WUNTRACED
|
| 10 |
+
enum: WCONTINUED
|
| 11 |
+
enum: WEXITED
|
| 12 |
+
enum: WSTOPPED
|
| 13 |
+
enum: WNOWAIT
|
| 14 |
+
|
| 15 |
+
int WEXITSTATUS(int status)
|
| 16 |
+
int WIFCONTINUED(int status)
|
| 17 |
+
int WIFEXITED(int status)
|
| 18 |
+
int WIFSIGNALED(int status)
|
| 19 |
+
int WIFSTOPPED(int status)
|
| 20 |
+
int WSTOPSIG(int status)
|
| 21 |
+
int WTERMSIG(int status)
|
| 22 |
+
|
| 23 |
+
ctypedef int idtype_t
|
| 24 |
+
enum: P_ALL # idtype_t values
|
| 25 |
+
enum: P_PID
|
| 26 |
+
enum: P_PGID
|
| 27 |
+
|
| 28 |
+
pid_t wait(int *stat_loc)
|
| 29 |
+
pid_t waitpid(pid_t pid, int *status, int options)
|
| 30 |
+
int waitid(idtype_t idtype, id_t id, siginfo_t *infop, int options)
|
| 31 |
+
|
| 32 |
+
# wait3 was in POSIX until 2008 while wait4 was never standardized.
|
| 33 |
+
# Even so, these calls are in almost every Unix, always in sys/wait.h.
|
| 34 |
+
# Hence, posix.wait is the least surprising place to declare them for Cython.
|
| 35 |
+
# libc may require _XXX_SOURCE to be defined at C-compile time to provide them.
|
| 36 |
+
|
| 37 |
+
pid_t wait3(int *status, int options, rusage *rusage)
|
| 38 |
+
pid_t wait4(pid_t pid, int *status, int options, rusage *rusage)
|
tuning-competition-baseline/.venv/lib/python3.11/site-packages/networkx/algorithms/assortativity/neighbor_degree.py
ADDED
|
@@ -0,0 +1,160 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import networkx as nx
|
| 2 |
+
|
| 3 |
+
__all__ = ["average_neighbor_degree"]
|
| 4 |
+
|
| 5 |
+
|
| 6 |
+
@nx._dispatch(edge_attrs="weight")
|
| 7 |
+
def average_neighbor_degree(G, source="out", target="out", nodes=None, weight=None):
|
| 8 |
+
r"""Returns the average degree of the neighborhood of each node.
|
| 9 |
+
|
| 10 |
+
In an undirected graph, the neighborhood `N(i)` of node `i` contains the
|
| 11 |
+
nodes that are connected to `i` by an edge.
|
| 12 |
+
|
| 13 |
+
For directed graphs, `N(i)` is defined according to the parameter `source`:
|
| 14 |
+
|
| 15 |
+
- if source is 'in', then `N(i)` consists of predecessors of node `i`.
|
| 16 |
+
- if source is 'out', then `N(i)` consists of successors of node `i`.
|
| 17 |
+
- if source is 'in+out', then `N(i)` is both predecessors and successors.
|
| 18 |
+
|
| 19 |
+
The average neighborhood degree of a node `i` is
|
| 20 |
+
|
| 21 |
+
.. math::
|
| 22 |
+
|
| 23 |
+
k_{nn,i} = \frac{1}{|N(i)|} \sum_{j \in N(i)} k_j
|
| 24 |
+
|
| 25 |
+
where `N(i)` are the neighbors of node `i` and `k_j` is
|
| 26 |
+
the degree of node `j` which belongs to `N(i)`. For weighted
|
| 27 |
+
graphs, an analogous measure can be defined [1]_,
|
| 28 |
+
|
| 29 |
+
.. math::
|
| 30 |
+
|
| 31 |
+
k_{nn,i}^{w} = \frac{1}{s_i} \sum_{j \in N(i)} w_{ij} k_j
|
| 32 |
+
|
| 33 |
+
where `s_i` is the weighted degree of node `i`, `w_{ij}`
|
| 34 |
+
is the weight of the edge that links `i` and `j` and
|
| 35 |
+
`N(i)` are the neighbors of node `i`.
|
| 36 |
+
|
| 37 |
+
|
| 38 |
+
Parameters
|
| 39 |
+
----------
|
| 40 |
+
G : NetworkX graph
|
| 41 |
+
|
| 42 |
+
source : string ("in"|"out"|"in+out"), optional (default="out")
|
| 43 |
+
Directed graphs only.
|
| 44 |
+
Use "in"- or "out"-neighbors of source node.
|
| 45 |
+
|
| 46 |
+
target : string ("in"|"out"|"in+out"), optional (default="out")
|
| 47 |
+
Directed graphs only.
|
| 48 |
+
Use "in"- or "out"-degree for target node.
|
| 49 |
+
|
| 50 |
+
nodes : list or iterable, optional (default=G.nodes)
|
| 51 |
+
Compute neighbor degree only for specified nodes.
|
| 52 |
+
|
| 53 |
+
weight : string or None, optional (default=None)
|
| 54 |
+
The edge attribute that holds the numerical value used as a weight.
|
| 55 |
+
If None, then each edge has weight 1.
|
| 56 |
+
|
| 57 |
+
Returns
|
| 58 |
+
-------
|
| 59 |
+
d: dict
|
| 60 |
+
A dictionary keyed by node to the average degree of its neighbors.
|
| 61 |
+
|
| 62 |
+
Raises
|
| 63 |
+
------
|
| 64 |
+
NetworkXError
|
| 65 |
+
If either `source` or `target` are not one of 'in', 'out', or 'in+out'.
|
| 66 |
+
If either `source` or `target` is passed for an undirected graph.
|
| 67 |
+
|
| 68 |
+
Examples
|
| 69 |
+
--------
|
| 70 |
+
>>> G = nx.path_graph(4)
|
| 71 |
+
>>> G.edges[0, 1]["weight"] = 5
|
| 72 |
+
>>> G.edges[2, 3]["weight"] = 3
|
| 73 |
+
|
| 74 |
+
>>> nx.average_neighbor_degree(G)
|
| 75 |
+
{0: 2.0, 1: 1.5, 2: 1.5, 3: 2.0}
|
| 76 |
+
>>> nx.average_neighbor_degree(G, weight="weight")
|
| 77 |
+
{0: 2.0, 1: 1.1666666666666667, 2: 1.25, 3: 2.0}
|
| 78 |
+
|
| 79 |
+
>>> G = nx.DiGraph()
|
| 80 |
+
>>> nx.add_path(G, [0, 1, 2, 3])
|
| 81 |
+
>>> nx.average_neighbor_degree(G, source="in", target="in")
|
| 82 |
+
{0: 0.0, 1: 0.0, 2: 1.0, 3: 1.0}
|
| 83 |
+
|
| 84 |
+
>>> nx.average_neighbor_degree(G, source="out", target="out")
|
| 85 |
+
{0: 1.0, 1: 1.0, 2: 0.0, 3: 0.0}
|
| 86 |
+
|
| 87 |
+
See Also
|
| 88 |
+
--------
|
| 89 |
+
average_degree_connectivity
|
| 90 |
+
|
| 91 |
+
References
|
| 92 |
+
----------
|
| 93 |
+
.. [1] A. Barrat, M. Barthélemy, R. Pastor-Satorras, and A. Vespignani,
|
| 94 |
+
"The architecture of complex weighted networks".
|
| 95 |
+
PNAS 101 (11): 3747–3752 (2004).
|
| 96 |
+
"""
|
| 97 |
+
if G.is_directed():
|
| 98 |
+
if source == "in":
|
| 99 |
+
source_degree = G.in_degree
|
| 100 |
+
elif source == "out":
|
| 101 |
+
source_degree = G.out_degree
|
| 102 |
+
elif source == "in+out":
|
| 103 |
+
source_degree = G.degree
|
| 104 |
+
else:
|
| 105 |
+
raise nx.NetworkXError(
|
| 106 |
+
f"source argument {source} must be 'in', 'out' or 'in+out'"
|
| 107 |
+
)
|
| 108 |
+
|
| 109 |
+
if target == "in":
|
| 110 |
+
target_degree = G.in_degree
|
| 111 |
+
elif target == "out":
|
| 112 |
+
target_degree = G.out_degree
|
| 113 |
+
elif target == "in+out":
|
| 114 |
+
target_degree = G.degree
|
| 115 |
+
else:
|
| 116 |
+
raise nx.NetworkXError(
|
| 117 |
+
f"target argument {target} must be 'in', 'out' or 'in+out'"
|
| 118 |
+
)
|
| 119 |
+
else:
|
| 120 |
+
if source != "out" or target != "out":
|
| 121 |
+
raise nx.NetworkXError(
|
| 122 |
+
f"source and target arguments are only supported for directed graphs"
|
| 123 |
+
)
|
| 124 |
+
source_degree = target_degree = G.degree
|
| 125 |
+
|
| 126 |
+
# precompute target degrees -- should *not* be weighted degree
|
| 127 |
+
t_deg = dict(target_degree())
|
| 128 |
+
|
| 129 |
+
# Set up both predecessor and successor neighbor dicts leaving empty if not needed
|
| 130 |
+
G_P = G_S = {n: {} for n in G}
|
| 131 |
+
if G.is_directed():
|
| 132 |
+
# "in" or "in+out" cases: G_P contains predecessors
|
| 133 |
+
if "in" in source:
|
| 134 |
+
G_P = G.pred
|
| 135 |
+
# "out" or "in+out" cases: G_S contains successors
|
| 136 |
+
if "out" in source:
|
| 137 |
+
G_S = G.succ
|
| 138 |
+
else:
|
| 139 |
+
# undirected leave G_P empty but G_S is the adjacency
|
| 140 |
+
G_S = G.adj
|
| 141 |
+
|
| 142 |
+
# Main loop: Compute average degree of neighbors
|
| 143 |
+
avg = {}
|
| 144 |
+
for n, deg in source_degree(nodes, weight=weight):
|
| 145 |
+
# handle degree zero average
|
| 146 |
+
if deg == 0:
|
| 147 |
+
avg[n] = 0.0
|
| 148 |
+
continue
|
| 149 |
+
|
| 150 |
+
# we sum over both G_P and G_S, but one of the two is usually empty.
|
| 151 |
+
if weight is None:
|
| 152 |
+
avg[n] = (
|
| 153 |
+
sum(t_deg[nbr] for nbr in G_S[n]) + sum(t_deg[nbr] for nbr in G_P[n])
|
| 154 |
+
) / deg
|
| 155 |
+
else:
|
| 156 |
+
avg[n] = (
|
| 157 |
+
sum(dd.get(weight, 1) * t_deg[nbr] for nbr, dd in G_S[n].items())
|
| 158 |
+
+ sum(dd.get(weight, 1) * t_deg[nbr] for nbr, dd in G_P[n].items())
|
| 159 |
+
) / deg
|
| 160 |
+
return avg
|
tuning-competition-baseline/.venv/lib/python3.11/site-packages/networkx/algorithms/assortativity/tests/__pycache__/test_correlation.cpython-311.pyc
ADDED
|
Binary file (11.3 kB). View file
|
|
|
tuning-competition-baseline/.venv/lib/python3.11/site-packages/networkx/algorithms/coloring/__pycache__/__init__.cpython-311.pyc
ADDED
|
Binary file (446 Bytes). View file
|
|
|
tuning-competition-baseline/.venv/lib/python3.11/site-packages/networkx/algorithms/coloring/__pycache__/greedy_coloring.cpython-311.pyc
ADDED
|
Binary file (25 kB). View file
|
|
|
tuning-competition-baseline/.venv/lib/python3.11/site-packages/networkx/algorithms/coloring/equitable_coloring.py
ADDED
|
@@ -0,0 +1,505 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Equitable coloring of graphs with bounded degree.
|
| 3 |
+
"""
|
| 4 |
+
|
| 5 |
+
from collections import defaultdict
|
| 6 |
+
|
| 7 |
+
import networkx as nx
|
| 8 |
+
|
| 9 |
+
__all__ = ["equitable_color"]
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
@nx._dispatch
|
| 13 |
+
def is_coloring(G, coloring):
|
| 14 |
+
"""Determine if the coloring is a valid coloring for the graph G."""
|
| 15 |
+
# Verify that the coloring is valid.
|
| 16 |
+
return all(coloring[s] != coloring[d] for s, d in G.edges)
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
@nx._dispatch
|
| 20 |
+
def is_equitable(G, coloring, num_colors=None):
|
| 21 |
+
"""Determines if the coloring is valid and equitable for the graph G."""
|
| 22 |
+
|
| 23 |
+
if not is_coloring(G, coloring):
|
| 24 |
+
return False
|
| 25 |
+
|
| 26 |
+
# Verify whether it is equitable.
|
| 27 |
+
color_set_size = defaultdict(int)
|
| 28 |
+
for color in coloring.values():
|
| 29 |
+
color_set_size[color] += 1
|
| 30 |
+
|
| 31 |
+
if num_colors is not None:
|
| 32 |
+
for color in range(num_colors):
|
| 33 |
+
if color not in color_set_size:
|
| 34 |
+
# These colors do not have any vertices attached to them.
|
| 35 |
+
color_set_size[color] = 0
|
| 36 |
+
|
| 37 |
+
# If there are more than 2 distinct values, the coloring cannot be equitable
|
| 38 |
+
all_set_sizes = set(color_set_size.values())
|
| 39 |
+
if len(all_set_sizes) == 0 and num_colors is None: # Was an empty graph
|
| 40 |
+
return True
|
| 41 |
+
elif len(all_set_sizes) == 1:
|
| 42 |
+
return True
|
| 43 |
+
elif len(all_set_sizes) == 2:
|
| 44 |
+
a, b = list(all_set_sizes)
|
| 45 |
+
return abs(a - b) <= 1
|
| 46 |
+
else: # len(all_set_sizes) > 2:
|
| 47 |
+
return False
|
| 48 |
+
|
| 49 |
+
|
| 50 |
+
def make_C_from_F(F):
|
| 51 |
+
C = defaultdict(list)
|
| 52 |
+
for node, color in F.items():
|
| 53 |
+
C[color].append(node)
|
| 54 |
+
|
| 55 |
+
return C
|
| 56 |
+
|
| 57 |
+
|
| 58 |
+
def make_N_from_L_C(L, C):
|
| 59 |
+
nodes = L.keys()
|
| 60 |
+
colors = C.keys()
|
| 61 |
+
return {
|
| 62 |
+
(node, color): sum(1 for v in L[node] if v in C[color])
|
| 63 |
+
for node in nodes
|
| 64 |
+
for color in colors
|
| 65 |
+
}
|
| 66 |
+
|
| 67 |
+
|
| 68 |
+
def make_H_from_C_N(C, N):
|
| 69 |
+
return {
|
| 70 |
+
(c1, c2): sum(1 for node in C[c1] if N[(node, c2)] == 0) for c1 in C for c2 in C
|
| 71 |
+
}
|
| 72 |
+
|
| 73 |
+
|
| 74 |
+
def change_color(u, X, Y, N, H, F, C, L):
|
| 75 |
+
"""Change the color of 'u' from X to Y and update N, H, F, C."""
|
| 76 |
+
assert F[u] == X and X != Y
|
| 77 |
+
|
| 78 |
+
# Change the class of 'u' from X to Y
|
| 79 |
+
F[u] = Y
|
| 80 |
+
|
| 81 |
+
for k in C:
|
| 82 |
+
# 'u' witnesses an edge from k -> Y instead of from k -> X now.
|
| 83 |
+
if N[u, k] == 0:
|
| 84 |
+
H[(X, k)] -= 1
|
| 85 |
+
H[(Y, k)] += 1
|
| 86 |
+
|
| 87 |
+
for v in L[u]:
|
| 88 |
+
# 'v' has lost a neighbor in X and gained one in Y
|
| 89 |
+
N[(v, X)] -= 1
|
| 90 |
+
N[(v, Y)] += 1
|
| 91 |
+
|
| 92 |
+
if N[(v, X)] == 0:
|
| 93 |
+
# 'v' witnesses F[v] -> X
|
| 94 |
+
H[(F[v], X)] += 1
|
| 95 |
+
|
| 96 |
+
if N[(v, Y)] == 1:
|
| 97 |
+
# 'v' no longer witnesses F[v] -> Y
|
| 98 |
+
H[(F[v], Y)] -= 1
|
| 99 |
+
|
| 100 |
+
C[X].remove(u)
|
| 101 |
+
C[Y].append(u)
|
| 102 |
+
|
| 103 |
+
|
| 104 |
+
def move_witnesses(src_color, dst_color, N, H, F, C, T_cal, L):
|
| 105 |
+
"""Move witness along a path from src_color to dst_color."""
|
| 106 |
+
X = src_color
|
| 107 |
+
while X != dst_color:
|
| 108 |
+
Y = T_cal[X]
|
| 109 |
+
# Move _any_ witness from X to Y = T_cal[X]
|
| 110 |
+
w = next(x for x in C[X] if N[(x, Y)] == 0)
|
| 111 |
+
change_color(w, X, Y, N=N, H=H, F=F, C=C, L=L)
|
| 112 |
+
X = Y
|
| 113 |
+
|
| 114 |
+
|
| 115 |
+
@nx._dispatch
|
| 116 |
+
def pad_graph(G, num_colors):
|
| 117 |
+
"""Add a disconnected complete clique K_p such that the number of nodes in
|
| 118 |
+
the graph becomes a multiple of `num_colors`.
|
| 119 |
+
|
| 120 |
+
Assumes that the graph's nodes are labelled using integers.
|
| 121 |
+
|
| 122 |
+
Returns the number of nodes with each color.
|
| 123 |
+
"""
|
| 124 |
+
|
| 125 |
+
n_ = len(G)
|
| 126 |
+
r = num_colors - 1
|
| 127 |
+
|
| 128 |
+
# Ensure that the number of nodes in G is a multiple of (r + 1)
|
| 129 |
+
s = n_ // (r + 1)
|
| 130 |
+
if n_ != s * (r + 1):
|
| 131 |
+
p = (r + 1) - n_ % (r + 1)
|
| 132 |
+
s += 1
|
| 133 |
+
|
| 134 |
+
# Complete graph K_p between (imaginary) nodes [n_, ... , n_ + p]
|
| 135 |
+
K = nx.relabel_nodes(nx.complete_graph(p), {idx: idx + n_ for idx in range(p)})
|
| 136 |
+
G.add_edges_from(K.edges)
|
| 137 |
+
|
| 138 |
+
return s
|
| 139 |
+
|
| 140 |
+
|
| 141 |
+
def procedure_P(V_minus, V_plus, N, H, F, C, L, excluded_colors=None):
|
| 142 |
+
"""Procedure P as described in the paper."""
|
| 143 |
+
|
| 144 |
+
if excluded_colors is None:
|
| 145 |
+
excluded_colors = set()
|
| 146 |
+
|
| 147 |
+
A_cal = set()
|
| 148 |
+
T_cal = {}
|
| 149 |
+
R_cal = []
|
| 150 |
+
|
| 151 |
+
# BFS to determine A_cal, i.e. colors reachable from V-
|
| 152 |
+
reachable = [V_minus]
|
| 153 |
+
marked = set(reachable)
|
| 154 |
+
idx = 0
|
| 155 |
+
|
| 156 |
+
while idx < len(reachable):
|
| 157 |
+
pop = reachable[idx]
|
| 158 |
+
idx += 1
|
| 159 |
+
|
| 160 |
+
A_cal.add(pop)
|
| 161 |
+
R_cal.append(pop)
|
| 162 |
+
|
| 163 |
+
# TODO: Checking whether a color has been visited can be made faster by
|
| 164 |
+
# using a look-up table instead of testing for membership in a set by a
|
| 165 |
+
# logarithmic factor.
|
| 166 |
+
next_layer = []
|
| 167 |
+
for k in C:
|
| 168 |
+
if (
|
| 169 |
+
H[(k, pop)] > 0
|
| 170 |
+
and k not in A_cal
|
| 171 |
+
and k not in excluded_colors
|
| 172 |
+
and k not in marked
|
| 173 |
+
):
|
| 174 |
+
next_layer.append(k)
|
| 175 |
+
|
| 176 |
+
for dst in next_layer:
|
| 177 |
+
# Record that `dst` can reach `pop`
|
| 178 |
+
T_cal[dst] = pop
|
| 179 |
+
|
| 180 |
+
marked.update(next_layer)
|
| 181 |
+
reachable.extend(next_layer)
|
| 182 |
+
|
| 183 |
+
# Variables for the algorithm
|
| 184 |
+
b = len(C) - len(A_cal)
|
| 185 |
+
|
| 186 |
+
if V_plus in A_cal:
|
| 187 |
+
# Easy case: V+ is in A_cal
|
| 188 |
+
# Move one node from V+ to V- using T_cal to find the parents.
|
| 189 |
+
move_witnesses(V_plus, V_minus, N=N, H=H, F=F, C=C, T_cal=T_cal, L=L)
|
| 190 |
+
else:
|
| 191 |
+
# If there is a solo edge, we can resolve the situation by
|
| 192 |
+
# moving witnesses from B to A, making G[A] equitable and then
|
| 193 |
+
# recursively balancing G[B - w] with a different V_minus and
|
| 194 |
+
# but the same V_plus.
|
| 195 |
+
|
| 196 |
+
A_0 = set()
|
| 197 |
+
A_cal_0 = set()
|
| 198 |
+
num_terminal_sets_found = 0
|
| 199 |
+
made_equitable = False
|
| 200 |
+
|
| 201 |
+
for W_1 in R_cal[::-1]:
|
| 202 |
+
for v in C[W_1]:
|
| 203 |
+
X = None
|
| 204 |
+
|
| 205 |
+
for U in C:
|
| 206 |
+
if N[(v, U)] == 0 and U in A_cal and U != W_1:
|
| 207 |
+
X = U
|
| 208 |
+
|
| 209 |
+
# v does not witness an edge in H[A_cal]
|
| 210 |
+
if X is None:
|
| 211 |
+
continue
|
| 212 |
+
|
| 213 |
+
for U in C:
|
| 214 |
+
# Note: Departing from the paper here.
|
| 215 |
+
if N[(v, U)] >= 1 and U not in A_cal:
|
| 216 |
+
X_prime = U
|
| 217 |
+
w = v
|
| 218 |
+
|
| 219 |
+
try:
|
| 220 |
+
# Finding the solo neighbor of w in X_prime
|
| 221 |
+
y = next(
|
| 222 |
+
node
|
| 223 |
+
for node in L[w]
|
| 224 |
+
if F[node] == X_prime and N[(node, W_1)] == 1
|
| 225 |
+
)
|
| 226 |
+
except StopIteration:
|
| 227 |
+
pass
|
| 228 |
+
else:
|
| 229 |
+
W = W_1
|
| 230 |
+
|
| 231 |
+
# Move w from W to X, now X has one extra node.
|
| 232 |
+
change_color(w, W, X, N=N, H=H, F=F, C=C, L=L)
|
| 233 |
+
|
| 234 |
+
# Move witness from X to V_minus, making the coloring
|
| 235 |
+
# equitable.
|
| 236 |
+
move_witnesses(
|
| 237 |
+
src_color=X,
|
| 238 |
+
dst_color=V_minus,
|
| 239 |
+
N=N,
|
| 240 |
+
H=H,
|
| 241 |
+
F=F,
|
| 242 |
+
C=C,
|
| 243 |
+
T_cal=T_cal,
|
| 244 |
+
L=L,
|
| 245 |
+
)
|
| 246 |
+
|
| 247 |
+
# Move y from X_prime to W, making W the correct size.
|
| 248 |
+
change_color(y, X_prime, W, N=N, H=H, F=F, C=C, L=L)
|
| 249 |
+
|
| 250 |
+
# Then call the procedure on G[B - y]
|
| 251 |
+
procedure_P(
|
| 252 |
+
V_minus=X_prime,
|
| 253 |
+
V_plus=V_plus,
|
| 254 |
+
N=N,
|
| 255 |
+
H=H,
|
| 256 |
+
C=C,
|
| 257 |
+
F=F,
|
| 258 |
+
L=L,
|
| 259 |
+
excluded_colors=excluded_colors.union(A_cal),
|
| 260 |
+
)
|
| 261 |
+
made_equitable = True
|
| 262 |
+
break
|
| 263 |
+
|
| 264 |
+
if made_equitable:
|
| 265 |
+
break
|
| 266 |
+
else:
|
| 267 |
+
# No node in W_1 was found such that
|
| 268 |
+
# it had a solo-neighbor.
|
| 269 |
+
A_cal_0.add(W_1)
|
| 270 |
+
A_0.update(C[W_1])
|
| 271 |
+
num_terminal_sets_found += 1
|
| 272 |
+
|
| 273 |
+
if num_terminal_sets_found == b:
|
| 274 |
+
# Otherwise, construct the maximal independent set and find
|
| 275 |
+
# a pair of z_1, z_2 as in Case II.
|
| 276 |
+
|
| 277 |
+
# BFS to determine B_cal': the set of colors reachable from V+
|
| 278 |
+
B_cal_prime = set()
|
| 279 |
+
T_cal_prime = {}
|
| 280 |
+
|
| 281 |
+
reachable = [V_plus]
|
| 282 |
+
marked = set(reachable)
|
| 283 |
+
idx = 0
|
| 284 |
+
while idx < len(reachable):
|
| 285 |
+
pop = reachable[idx]
|
| 286 |
+
idx += 1
|
| 287 |
+
|
| 288 |
+
B_cal_prime.add(pop)
|
| 289 |
+
|
| 290 |
+
# No need to check for excluded_colors here because
|
| 291 |
+
# they only exclude colors from A_cal
|
| 292 |
+
next_layer = [
|
| 293 |
+
k
|
| 294 |
+
for k in C
|
| 295 |
+
if H[(pop, k)] > 0 and k not in B_cal_prime and k not in marked
|
| 296 |
+
]
|
| 297 |
+
|
| 298 |
+
for dst in next_layer:
|
| 299 |
+
T_cal_prime[pop] = dst
|
| 300 |
+
|
| 301 |
+
marked.update(next_layer)
|
| 302 |
+
reachable.extend(next_layer)
|
| 303 |
+
|
| 304 |
+
# Construct the independent set of G[B']
|
| 305 |
+
I_set = set()
|
| 306 |
+
I_covered = set()
|
| 307 |
+
W_covering = {}
|
| 308 |
+
|
| 309 |
+
B_prime = [node for k in B_cal_prime for node in C[k]]
|
| 310 |
+
|
| 311 |
+
# Add the nodes in V_plus to I first.
|
| 312 |
+
for z in C[V_plus] + B_prime:
|
| 313 |
+
if z in I_covered or F[z] not in B_cal_prime:
|
| 314 |
+
continue
|
| 315 |
+
|
| 316 |
+
I_set.add(z)
|
| 317 |
+
I_covered.add(z)
|
| 318 |
+
I_covered.update(list(L[z]))
|
| 319 |
+
|
| 320 |
+
for w in L[z]:
|
| 321 |
+
if F[w] in A_cal_0 and N[(z, F[w])] == 1:
|
| 322 |
+
if w not in W_covering:
|
| 323 |
+
W_covering[w] = z
|
| 324 |
+
else:
|
| 325 |
+
# Found z1, z2 which have the same solo
|
| 326 |
+
# neighbor in some W
|
| 327 |
+
z_1 = W_covering[w]
|
| 328 |
+
# z_2 = z
|
| 329 |
+
|
| 330 |
+
Z = F[z_1]
|
| 331 |
+
W = F[w]
|
| 332 |
+
|
| 333 |
+
# shift nodes along W, V-
|
| 334 |
+
move_witnesses(
|
| 335 |
+
W, V_minus, N=N, H=H, F=F, C=C, T_cal=T_cal, L=L
|
| 336 |
+
)
|
| 337 |
+
|
| 338 |
+
# shift nodes along V+ to Z
|
| 339 |
+
move_witnesses(
|
| 340 |
+
V_plus,
|
| 341 |
+
Z,
|
| 342 |
+
N=N,
|
| 343 |
+
H=H,
|
| 344 |
+
F=F,
|
| 345 |
+
C=C,
|
| 346 |
+
T_cal=T_cal_prime,
|
| 347 |
+
L=L,
|
| 348 |
+
)
|
| 349 |
+
|
| 350 |
+
# change color of z_1 to W
|
| 351 |
+
change_color(z_1, Z, W, N=N, H=H, F=F, C=C, L=L)
|
| 352 |
+
|
| 353 |
+
# change color of w to some color in B_cal
|
| 354 |
+
W_plus = next(
|
| 355 |
+
k for k in C if N[(w, k)] == 0 and k not in A_cal
|
| 356 |
+
)
|
| 357 |
+
change_color(w, W, W_plus, N=N, H=H, F=F, C=C, L=L)
|
| 358 |
+
|
| 359 |
+
# recurse with G[B \cup W*]
|
| 360 |
+
excluded_colors.update(
|
| 361 |
+
[k for k in C if k != W and k not in B_cal_prime]
|
| 362 |
+
)
|
| 363 |
+
procedure_P(
|
| 364 |
+
V_minus=W,
|
| 365 |
+
V_plus=W_plus,
|
| 366 |
+
N=N,
|
| 367 |
+
H=H,
|
| 368 |
+
C=C,
|
| 369 |
+
F=F,
|
| 370 |
+
L=L,
|
| 371 |
+
excluded_colors=excluded_colors,
|
| 372 |
+
)
|
| 373 |
+
|
| 374 |
+
made_equitable = True
|
| 375 |
+
break
|
| 376 |
+
|
| 377 |
+
if made_equitable:
|
| 378 |
+
break
|
| 379 |
+
else:
|
| 380 |
+
assert False, (
|
| 381 |
+
"Must find a w which is the solo neighbor "
|
| 382 |
+
"of two vertices in B_cal_prime."
|
| 383 |
+
)
|
| 384 |
+
|
| 385 |
+
if made_equitable:
|
| 386 |
+
break
|
| 387 |
+
|
| 388 |
+
|
| 389 |
+
@nx._dispatch
|
| 390 |
+
def equitable_color(G, num_colors):
|
| 391 |
+
"""Provides an equitable coloring for nodes of `G`.
|
| 392 |
+
|
| 393 |
+
Attempts to color a graph using `num_colors` colors, where no neighbors of
|
| 394 |
+
a node can have same color as the node itself and the number of nodes with
|
| 395 |
+
each color differ by at most 1. `num_colors` must be greater than the
|
| 396 |
+
maximum degree of `G`. The algorithm is described in [1]_ and has
|
| 397 |
+
complexity O(num_colors * n**2).
|
| 398 |
+
|
| 399 |
+
Parameters
|
| 400 |
+
----------
|
| 401 |
+
G : networkX graph
|
| 402 |
+
The nodes of this graph will be colored.
|
| 403 |
+
|
| 404 |
+
num_colors : number of colors to use
|
| 405 |
+
This number must be at least one more than the maximum degree of nodes
|
| 406 |
+
in the graph.
|
| 407 |
+
|
| 408 |
+
Returns
|
| 409 |
+
-------
|
| 410 |
+
A dictionary with keys representing nodes and values representing
|
| 411 |
+
corresponding coloring.
|
| 412 |
+
|
| 413 |
+
Examples
|
| 414 |
+
--------
|
| 415 |
+
>>> G = nx.cycle_graph(4)
|
| 416 |
+
>>> nx.coloring.equitable_color(G, num_colors=3) # doctest: +SKIP
|
| 417 |
+
{0: 2, 1: 1, 2: 2, 3: 0}
|
| 418 |
+
|
| 419 |
+
Raises
|
| 420 |
+
------
|
| 421 |
+
NetworkXAlgorithmError
|
| 422 |
+
If `num_colors` is not at least the maximum degree of the graph `G`
|
| 423 |
+
|
| 424 |
+
References
|
| 425 |
+
----------
|
| 426 |
+
.. [1] Kierstead, H. A., Kostochka, A. V., Mydlarz, M., & Szemerédi, E.
|
| 427 |
+
(2010). A fast algorithm for equitable coloring. Combinatorica, 30(2),
|
| 428 |
+
217-224.
|
| 429 |
+
"""
|
| 430 |
+
|
| 431 |
+
# Map nodes to integers for simplicity later.
|
| 432 |
+
nodes_to_int = {}
|
| 433 |
+
int_to_nodes = {}
|
| 434 |
+
|
| 435 |
+
for idx, node in enumerate(G.nodes):
|
| 436 |
+
nodes_to_int[node] = idx
|
| 437 |
+
int_to_nodes[idx] = node
|
| 438 |
+
|
| 439 |
+
G = nx.relabel_nodes(G, nodes_to_int, copy=True)
|
| 440 |
+
|
| 441 |
+
# Basic graph statistics and sanity check.
|
| 442 |
+
if len(G.nodes) > 0:
|
| 443 |
+
r_ = max(G.degree(node) for node in G.nodes)
|
| 444 |
+
else:
|
| 445 |
+
r_ = 0
|
| 446 |
+
|
| 447 |
+
if r_ >= num_colors:
|
| 448 |
+
raise nx.NetworkXAlgorithmError(
|
| 449 |
+
f"Graph has maximum degree {r_}, needs "
|
| 450 |
+
f"{r_ + 1} (> {num_colors}) colors for guaranteed coloring."
|
| 451 |
+
)
|
| 452 |
+
|
| 453 |
+
# Ensure that the number of nodes in G is a multiple of (r + 1)
|
| 454 |
+
pad_graph(G, num_colors)
|
| 455 |
+
|
| 456 |
+
# Starting the algorithm.
|
| 457 |
+
# L = {node: list(G.neighbors(node)) for node in G.nodes}
|
| 458 |
+
L_ = {node: [] for node in G.nodes}
|
| 459 |
+
|
| 460 |
+
# Arbitrary equitable allocation of colors to nodes.
|
| 461 |
+
F = {node: idx % num_colors for idx, node in enumerate(G.nodes)}
|
| 462 |
+
|
| 463 |
+
C = make_C_from_F(F)
|
| 464 |
+
|
| 465 |
+
# The neighborhood is empty initially.
|
| 466 |
+
N = make_N_from_L_C(L_, C)
|
| 467 |
+
|
| 468 |
+
# Currently all nodes witness all edges.
|
| 469 |
+
H = make_H_from_C_N(C, N)
|
| 470 |
+
|
| 471 |
+
# Start of algorithm.
|
| 472 |
+
edges_seen = set()
|
| 473 |
+
|
| 474 |
+
for u in sorted(G.nodes):
|
| 475 |
+
for v in sorted(G.neighbors(u)):
|
| 476 |
+
# Do not double count edges if (v, u) has already been seen.
|
| 477 |
+
if (v, u) in edges_seen:
|
| 478 |
+
continue
|
| 479 |
+
|
| 480 |
+
edges_seen.add((u, v))
|
| 481 |
+
|
| 482 |
+
L_[u].append(v)
|
| 483 |
+
L_[v].append(u)
|
| 484 |
+
|
| 485 |
+
N[(u, F[v])] += 1
|
| 486 |
+
N[(v, F[u])] += 1
|
| 487 |
+
|
| 488 |
+
if F[u] != F[v]:
|
| 489 |
+
# Were 'u' and 'v' witnesses for F[u] -> F[v] or F[v] -> F[u]?
|
| 490 |
+
if N[(u, F[v])] == 1:
|
| 491 |
+
H[F[u], F[v]] -= 1 # u cannot witness an edge between F[u], F[v]
|
| 492 |
+
|
| 493 |
+
if N[(v, F[u])] == 1:
|
| 494 |
+
H[F[v], F[u]] -= 1 # v cannot witness an edge between F[v], F[u]
|
| 495 |
+
|
| 496 |
+
if N[(u, F[u])] != 0:
|
| 497 |
+
# Find the first color where 'u' does not have any neighbors.
|
| 498 |
+
Y = next(k for k in C if N[(u, k)] == 0)
|
| 499 |
+
X = F[u]
|
| 500 |
+
change_color(u, X, Y, N=N, H=H, F=F, C=C, L=L_)
|
| 501 |
+
|
| 502 |
+
# Procedure P
|
| 503 |
+
procedure_P(V_minus=X, V_plus=Y, N=N, H=H, F=F, C=C, L=L_)
|
| 504 |
+
|
| 505 |
+
return {int_to_nodes[x]: F[x] for x in int_to_nodes}
|
tuning-competition-baseline/.venv/lib/python3.11/site-packages/networkx/algorithms/coloring/tests/__init__.py
ADDED
|
File without changes
|
tuning-competition-baseline/.venv/lib/python3.11/site-packages/networkx/algorithms/coloring/tests/__pycache__/__init__.cpython-311.pyc
ADDED
|
Binary file (235 Bytes). View file
|
|
|