h"]
+_IntCCodes = Literal["intc", "i", "=i", "i"]
+_IntPCodes = Literal["intp", "int0", "p", "=p", "p"]
+_IntCodes = Literal["long", "int", "int_", "l", "=l", "l"]
+_LongLongCodes = Literal["longlong", "q", "=q", "q"]
+
+_UByteCodes = Literal["ubyte", "B", "=B", "B"]
+_UShortCodes = Literal["ushort", "H", "=H", "H"]
+_UIntCCodes = Literal["uintc", "I", "=I", "I"]
+_UIntPCodes = Literal["uintp", "uint0", "P", "=P", "P"]
+_UIntCodes = Literal["ulong", "uint", "L", "=L", "L"]
+_ULongLongCodes = Literal["ulonglong", "Q", "=Q", "Q"]
+
+_HalfCodes = Literal["half", "e", "=e", "e"]
+_SingleCodes = Literal["single", "f", "=f", "f"]
+_DoubleCodes = Literal["double", "float", "float_", "d", "=d", "d"]
+_LongDoubleCodes = Literal["longdouble", "longfloat", "g", "=g", "g"]
+
+_CSingleCodes = Literal["csingle", "singlecomplex", "F", "=F", "F"]
+_CDoubleCodes = Literal["cdouble", "complex", "complex_", "cfloat", "D", "=D", "D"]
+_CLongDoubleCodes = Literal["clongdouble", "clongfloat", "longcomplex", "G", "=G", "G"]
+
+_StrCodes = Literal["str", "str_", "str0", "unicode", "unicode_", "U", "=U", "U"]
+_BytesCodes = Literal["bytes", "bytes_", "bytes0", "S", "=S", "S"]
+_VoidCodes = Literal["void", "void0", "V", "=V", "V"]
+_ObjectCodes = Literal["object", "object_", "O", "=O", "O"]
+
+_DT64Codes = Literal[
+ "datetime64", "=datetime64", "datetime64",
+ "datetime64[Y]", "=datetime64[Y]", "datetime64[Y]",
+ "datetime64[M]", "=datetime64[M]", "datetime64[M]",
+ "datetime64[W]", "=datetime64[W]", "datetime64[W]",
+ "datetime64[D]", "=datetime64[D]", "datetime64[D]",
+ "datetime64[h]", "=datetime64[h]", "datetime64[h]",
+ "datetime64[m]", "=datetime64[m]", "datetime64[m]",
+ "datetime64[s]", "=datetime64[s]", "datetime64[s]",
+ "datetime64[ms]", "=datetime64[ms]", "datetime64[ms]",
+ "datetime64[us]", "=datetime64[us]", "datetime64[us]",
+ "datetime64[ns]", "=datetime64[ns]", "datetime64[ns]",
+ "datetime64[ps]", "=datetime64[ps]", "datetime64[ps]",
+ "datetime64[fs]", "=datetime64[fs]", "datetime64[fs]",
+ "datetime64[as]", "=datetime64[as]", "datetime64[as]",
+ "M", "=M", "M",
+ "M8", "=M8", "M8",
+ "M8[Y]", "=M8[Y]", "M8[Y]",
+ "M8[M]", "=M8[M]", "M8[M]",
+ "M8[W]", "=M8[W]", "M8[W]",
+ "M8[D]", "=M8[D]", "M8[D]",
+ "M8[h]", "=M8[h]", "M8[h]",
+ "M8[m]", "=M8[m]", "M8[m]",
+ "M8[s]", "=M8[s]", "M8[s]",
+ "M8[ms]", "=M8[ms]", "M8[ms]",
+ "M8[us]", "=M8[us]", "M8[us]",
+ "M8[ns]", "=M8[ns]", "M8[ns]",
+ "M8[ps]", "=M8[ps]", "M8[ps]",
+ "M8[fs]", "=M8[fs]", "M8[fs]",
+ "M8[as]", "=M8[as]", "M8[as]",
+]
+_TD64Codes = Literal[
+ "timedelta64", "=timedelta64", "timedelta64",
+ "timedelta64[Y]", "=timedelta64[Y]", "timedelta64[Y]",
+ "timedelta64[M]", "=timedelta64[M]", "timedelta64[M]",
+ "timedelta64[W]", "=timedelta64[W]", "timedelta64[W]",
+ "timedelta64[D]", "=timedelta64[D]", "timedelta64[D]",
+ "timedelta64[h]", "=timedelta64[h]", "timedelta64[h]",
+ "timedelta64[m]", "=timedelta64[m]", "timedelta64[m]",
+ "timedelta64[s]", "=timedelta64[s]", "timedelta64[s]",
+ "timedelta64[ms]", "=timedelta64[ms]", "timedelta64[ms]",
+ "timedelta64[us]", "=timedelta64[us]", "timedelta64[us]",
+ "timedelta64[ns]", "=timedelta64[ns]", "timedelta64[ns]",
+ "timedelta64[ps]", "=timedelta64[ps]", "timedelta64[ps]",
+ "timedelta64[fs]", "=timedelta64[fs]", "timedelta64[fs]",
+ "timedelta64[as]", "=timedelta64[as]", "timedelta64[as]",
+ "m", "=m", "m",
+ "m8", "=m8", "m8",
+ "m8[Y]", "=m8[Y]", "m8[Y]",
+ "m8[M]", "=m8[M]", "m8[M]",
+ "m8[W]", "=m8[W]", "m8[W]",
+ "m8[D]", "=m8[D]", "m8[D]",
+ "m8[h]", "=m8[h]", "m8[h]",
+ "m8[m]", "=m8[m]", "m8[m]",
+ "m8[s]", "=m8[s]", "m8[s]",
+ "m8[ms]", "=m8[ms]", "m8[ms]",
+ "m8[us]", "=m8[us]", "m8[us]",
+ "m8[ns]", "=m8[ns]", "m8[ns]",
+ "m8[ps]", "=m8[ps]", "m8[ps]",
+ "m8[fs]", "=m8[fs]", "m8[fs]",
+ "m8[as]", "=m8[as]", "m8[as]",
+]
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/_typing/_dtype_like.py b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/_typing/_dtype_like.py
new file mode 100644
index 0000000000000000000000000000000000000000..207a99c56b3cde87365992eff97d2da28d46c1f5
--- /dev/null
+++ b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/_typing/_dtype_like.py
@@ -0,0 +1,246 @@
+from collections.abc import Sequence
+from typing import (
+ Any,
+ Sequence,
+ Union,
+ TypeVar,
+ Protocol,
+ TypedDict,
+ runtime_checkable,
+)
+
+import numpy as np
+
+from ._shape import _ShapeLike
+
+from ._char_codes import (
+ _BoolCodes,
+ _UInt8Codes,
+ _UInt16Codes,
+ _UInt32Codes,
+ _UInt64Codes,
+ _Int8Codes,
+ _Int16Codes,
+ _Int32Codes,
+ _Int64Codes,
+ _Float16Codes,
+ _Float32Codes,
+ _Float64Codes,
+ _Complex64Codes,
+ _Complex128Codes,
+ _ByteCodes,
+ _ShortCodes,
+ _IntCCodes,
+ _IntPCodes,
+ _IntCodes,
+ _LongLongCodes,
+ _UByteCodes,
+ _UShortCodes,
+ _UIntCCodes,
+ _UIntPCodes,
+ _UIntCodes,
+ _ULongLongCodes,
+ _HalfCodes,
+ _SingleCodes,
+ _DoubleCodes,
+ _LongDoubleCodes,
+ _CSingleCodes,
+ _CDoubleCodes,
+ _CLongDoubleCodes,
+ _DT64Codes,
+ _TD64Codes,
+ _StrCodes,
+ _BytesCodes,
+ _VoidCodes,
+ _ObjectCodes,
+)
+
+_SCT = TypeVar("_SCT", bound=np.generic)
+_DType_co = TypeVar("_DType_co", covariant=True, bound=np.dtype[Any])
+
+_DTypeLikeNested = Any # TODO: wait for support for recursive types
+
+
+# Mandatory keys
+class _DTypeDictBase(TypedDict):
+ names: Sequence[str]
+ formats: Sequence[_DTypeLikeNested]
+
+
+# Mandatory + optional keys
+class _DTypeDict(_DTypeDictBase, total=False):
+ # Only `str` elements are usable as indexing aliases,
+ # but `titles` can in principle accept any object
+ offsets: Sequence[int]
+ titles: Sequence[Any]
+ itemsize: int
+ aligned: bool
+
+
+# A protocol for anything with the dtype attribute
+@runtime_checkable
+class _SupportsDType(Protocol[_DType_co]):
+ @property
+ def dtype(self) -> _DType_co: ...
+
+
+# A subset of `npt.DTypeLike` that can be parametrized w.r.t. `np.generic`
+_DTypeLike = Union[
+ np.dtype[_SCT],
+ type[_SCT],
+ _SupportsDType[np.dtype[_SCT]],
+]
+
+
+# Would create a dtype[np.void]
+_VoidDTypeLike = Union[
+ # (flexible_dtype, itemsize)
+ tuple[_DTypeLikeNested, int],
+ # (fixed_dtype, shape)
+ tuple[_DTypeLikeNested, _ShapeLike],
+ # [(field_name, field_dtype, field_shape), ...]
+ #
+ # The type here is quite broad because NumPy accepts quite a wide
+ # range of inputs inside the list; see the tests for some
+ # examples.
+ list[Any],
+ # {'names': ..., 'formats': ..., 'offsets': ..., 'titles': ...,
+ # 'itemsize': ...}
+ _DTypeDict,
+ # (base_dtype, new_dtype)
+ tuple[_DTypeLikeNested, _DTypeLikeNested],
+]
+
+# Anything that can be coerced into numpy.dtype.
+# Reference: https://docs.scipy.org/doc/numpy/reference/arrays.dtypes.html
+DTypeLike = Union[
+ np.dtype[Any],
+ # default data type (float64)
+ None,
+ # array-scalar types and generic types
+ type[Any], # NOTE: We're stuck with `type[Any]` due to object dtypes
+ # anything with a dtype attribute
+ _SupportsDType[np.dtype[Any]],
+ # character codes, type strings or comma-separated fields, e.g., 'float64'
+ str,
+ _VoidDTypeLike,
+]
+
+# NOTE: while it is possible to provide the dtype as a dict of
+# dtype-like objects (e.g. `{'field1': ..., 'field2': ..., ...}`),
+# this syntax is officially discourged and
+# therefore not included in the Union defining `DTypeLike`.
+#
+# See https://github.com/numpy/numpy/issues/16891 for more details.
+
+# Aliases for commonly used dtype-like objects.
+# Note that the precision of `np.number` subclasses is ignored herein.
+_DTypeLikeBool = Union[
+ type[bool],
+ type[np.bool_],
+ np.dtype[np.bool_],
+ _SupportsDType[np.dtype[np.bool_]],
+ _BoolCodes,
+]
+_DTypeLikeUInt = Union[
+ type[np.unsignedinteger],
+ np.dtype[np.unsignedinteger],
+ _SupportsDType[np.dtype[np.unsignedinteger]],
+ _UInt8Codes,
+ _UInt16Codes,
+ _UInt32Codes,
+ _UInt64Codes,
+ _UByteCodes,
+ _UShortCodes,
+ _UIntCCodes,
+ _UIntPCodes,
+ _UIntCodes,
+ _ULongLongCodes,
+]
+_DTypeLikeInt = Union[
+ type[int],
+ type[np.signedinteger],
+ np.dtype[np.signedinteger],
+ _SupportsDType[np.dtype[np.signedinteger]],
+ _Int8Codes,
+ _Int16Codes,
+ _Int32Codes,
+ _Int64Codes,
+ _ByteCodes,
+ _ShortCodes,
+ _IntCCodes,
+ _IntPCodes,
+ _IntCodes,
+ _LongLongCodes,
+]
+_DTypeLikeFloat = Union[
+ type[float],
+ type[np.floating],
+ np.dtype[np.floating],
+ _SupportsDType[np.dtype[np.floating]],
+ _Float16Codes,
+ _Float32Codes,
+ _Float64Codes,
+ _HalfCodes,
+ _SingleCodes,
+ _DoubleCodes,
+ _LongDoubleCodes,
+]
+_DTypeLikeComplex = Union[
+ type[complex],
+ type[np.complexfloating],
+ np.dtype[np.complexfloating],
+ _SupportsDType[np.dtype[np.complexfloating]],
+ _Complex64Codes,
+ _Complex128Codes,
+ _CSingleCodes,
+ _CDoubleCodes,
+ _CLongDoubleCodes,
+]
+_DTypeLikeDT64 = Union[
+ type[np.timedelta64],
+ np.dtype[np.timedelta64],
+ _SupportsDType[np.dtype[np.timedelta64]],
+ _TD64Codes,
+]
+_DTypeLikeTD64 = Union[
+ type[np.datetime64],
+ np.dtype[np.datetime64],
+ _SupportsDType[np.dtype[np.datetime64]],
+ _DT64Codes,
+]
+_DTypeLikeStr = Union[
+ type[str],
+ type[np.str_],
+ np.dtype[np.str_],
+ _SupportsDType[np.dtype[np.str_]],
+ _StrCodes,
+]
+_DTypeLikeBytes = Union[
+ type[bytes],
+ type[np.bytes_],
+ np.dtype[np.bytes_],
+ _SupportsDType[np.dtype[np.bytes_]],
+ _BytesCodes,
+]
+_DTypeLikeVoid = Union[
+ type[np.void],
+ np.dtype[np.void],
+ _SupportsDType[np.dtype[np.void]],
+ _VoidCodes,
+ _VoidDTypeLike,
+]
+_DTypeLikeObject = Union[
+ type,
+ np.dtype[np.object_],
+ _SupportsDType[np.dtype[np.object_]],
+ _ObjectCodes,
+]
+
+_DTypeLikeComplex_co = Union[
+ _DTypeLikeBool,
+ _DTypeLikeUInt,
+ _DTypeLikeInt,
+ _DTypeLikeFloat,
+ _DTypeLikeComplex,
+]
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/_typing/_extended_precision.py b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/_typing/_extended_precision.py
new file mode 100644
index 0000000000000000000000000000000000000000..7246b47d0ee1724f5697ec3e80965f6f5ec48330
--- /dev/null
+++ b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/_typing/_extended_precision.py
@@ -0,0 +1,27 @@
+"""A module with platform-specific extended precision
+`numpy.number` subclasses.
+
+The subclasses are defined here (instead of ``__init__.pyi``) such
+that they can be imported conditionally via the numpy's mypy plugin.
+"""
+
+import numpy as np
+from . import (
+ _80Bit,
+ _96Bit,
+ _128Bit,
+ _256Bit,
+)
+
+uint128 = np.unsignedinteger[_128Bit]
+uint256 = np.unsignedinteger[_256Bit]
+int128 = np.signedinteger[_128Bit]
+int256 = np.signedinteger[_256Bit]
+float80 = np.floating[_80Bit]
+float96 = np.floating[_96Bit]
+float128 = np.floating[_128Bit]
+float256 = np.floating[_256Bit]
+complex160 = np.complexfloating[_80Bit, _80Bit]
+complex192 = np.complexfloating[_96Bit, _96Bit]
+complex256 = np.complexfloating[_128Bit, _128Bit]
+complex512 = np.complexfloating[_256Bit, _256Bit]
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/_typing/_nbit.py b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/_typing/_nbit.py
new file mode 100644
index 0000000000000000000000000000000000000000..b8d35db4f5947fc1fc7f4672c3510f4a4264da6f
--- /dev/null
+++ b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/_typing/_nbit.py
@@ -0,0 +1,16 @@
+"""A module with the precisions of platform-specific `~numpy.number`s."""
+
+from typing import Any
+
+# To-be replaced with a `npt.NBitBase` subclass by numpy's mypy plugin
+_NBitByte = Any
+_NBitShort = Any
+_NBitIntC = Any
+_NBitIntP = Any
+_NBitInt = Any
+_NBitLongLong = Any
+
+_NBitHalf = Any
+_NBitSingle = Any
+_NBitDouble = Any
+_NBitLongDouble = Any
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/_typing/_nested_sequence.py b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/_typing/_nested_sequence.py
new file mode 100644
index 0000000000000000000000000000000000000000..3d0d25ae5b48a7c4375364c110f05af4dd38a5eb
--- /dev/null
+++ b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/_typing/_nested_sequence.py
@@ -0,0 +1,86 @@
+"""A module containing the `_NestedSequence` protocol."""
+
+from __future__ import annotations
+
+from collections.abc import Iterator
+from typing import (
+ Any,
+ TypeVar,
+ Protocol,
+ runtime_checkable,
+)
+
+__all__ = ["_NestedSequence"]
+
+_T_co = TypeVar("_T_co", covariant=True)
+
+
+@runtime_checkable
+class _NestedSequence(Protocol[_T_co]):
+ """A protocol for representing nested sequences.
+
+ Warning
+ -------
+ `_NestedSequence` currently does not work in combination with typevars,
+ *e.g.* ``def func(a: _NestedSequnce[T]) -> T: ...``.
+
+ See Also
+ --------
+ collections.abc.Sequence
+ ABCs for read-only and mutable :term:`sequences`.
+
+ Examples
+ --------
+ .. code-block:: python
+
+ >>> from __future__ import annotations
+
+ >>> from typing import TYPE_CHECKING
+ >>> import numpy as np
+ >>> from numpy._typing import _NestedSequence
+
+ >>> def get_dtype(seq: _NestedSequence[float]) -> np.dtype[np.float64]:
+ ... return np.asarray(seq).dtype
+
+ >>> a = get_dtype([1.0])
+ >>> b = get_dtype([[1.0]])
+ >>> c = get_dtype([[[1.0]]])
+ >>> d = get_dtype([[[[1.0]]]])
+
+ >>> if TYPE_CHECKING:
+ ... reveal_locals()
+ ... # note: Revealed local types are:
+ ... # note: a: numpy.dtype[numpy.floating[numpy._typing._64Bit]]
+ ... # note: b: numpy.dtype[numpy.floating[numpy._typing._64Bit]]
+ ... # note: c: numpy.dtype[numpy.floating[numpy._typing._64Bit]]
+ ... # note: d: numpy.dtype[numpy.floating[numpy._typing._64Bit]]
+
+ """
+
+ def __len__(self, /) -> int:
+ """Implement ``len(self)``."""
+ raise NotImplementedError
+
+ def __getitem__(self, index: int, /) -> _T_co | _NestedSequence[_T_co]:
+ """Implement ``self[x]``."""
+ raise NotImplementedError
+
+ def __contains__(self, x: object, /) -> bool:
+ """Implement ``x in self``."""
+ raise NotImplementedError
+
+ def __iter__(self, /) -> Iterator[_T_co | _NestedSequence[_T_co]]:
+ """Implement ``iter(self)``."""
+ raise NotImplementedError
+
+ def __reversed__(self, /) -> Iterator[_T_co | _NestedSequence[_T_co]]:
+ """Implement ``reversed(self)``."""
+ raise NotImplementedError
+
+ def count(self, value: Any, /) -> int:
+ """Return the number of occurrences of `value`."""
+ raise NotImplementedError
+
+ def index(self, value: Any, /) -> int:
+ """Return the first index of `value`."""
+ raise NotImplementedError
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/_typing/_scalars.py b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/_typing/_scalars.py
new file mode 100644
index 0000000000000000000000000000000000000000..e46ff04a00d14dd96a8a7b8052f11484a8c85d0e
--- /dev/null
+++ b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/_typing/_scalars.py
@@ -0,0 +1,30 @@
+from typing import Union, Any
+
+import numpy as np
+
+# NOTE: `_StrLike_co` and `_BytesLike_co` are pointless, as `np.str_` and
+# `np.bytes_` are already subclasses of their builtin counterpart
+
+_CharLike_co = Union[str, bytes]
+
+# The 6 `Like_co` type-aliases below represent all scalars that can be
+# coerced into `` (with the casting rule `same_kind`)
+_BoolLike_co = Union[bool, np.bool_]
+_UIntLike_co = Union[_BoolLike_co, np.unsignedinteger[Any]]
+_IntLike_co = Union[_BoolLike_co, int, np.integer[Any]]
+_FloatLike_co = Union[_IntLike_co, float, np.floating[Any]]
+_ComplexLike_co = Union[_FloatLike_co, complex, np.complexfloating[Any, Any]]
+_TD64Like_co = Union[_IntLike_co, np.timedelta64]
+
+_NumberLike_co = Union[int, float, complex, np.number[Any], np.bool_]
+_ScalarLike_co = Union[
+ int,
+ float,
+ complex,
+ str,
+ bytes,
+ np.generic,
+]
+
+# `_VoidLike_co` is technically not a scalar, but it's close enough
+_VoidLike_co = Union[tuple[Any, ...], np.void]
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/_typing/_shape.py b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/_typing/_shape.py
new file mode 100644
index 0000000000000000000000000000000000000000..4f1204e47c6a20012e729514fdd78424126d45b8
--- /dev/null
+++ b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/_typing/_shape.py
@@ -0,0 +1,7 @@
+from collections.abc import Sequence
+from typing import Union, SupportsIndex
+
+_Shape = tuple[int, ...]
+
+# Anything that can be coerced to a shape tuple
+_ShapeLike = Union[SupportsIndex, Sequence[SupportsIndex]]
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/_typing/_ufunc.pyi b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/_typing/_ufunc.pyi
new file mode 100644
index 0000000000000000000000000000000000000000..9f8e0d4edbfba4b29fb9ac8743009f3073c63e40
--- /dev/null
+++ b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/_typing/_ufunc.pyi
@@ -0,0 +1,445 @@
+"""A module with private type-check-only `numpy.ufunc` subclasses.
+
+The signatures of the ufuncs are too varied to reasonably type
+with a single class. So instead, `ufunc` has been expanded into
+four private subclasses, one for each combination of
+`~ufunc.nin` and `~ufunc.nout`.
+
+"""
+
+from typing import (
+ Any,
+ Generic,
+ overload,
+ TypeVar,
+ Literal,
+ SupportsIndex,
+ Protocol,
+)
+
+from numpy import ufunc, _CastingKind, _OrderKACF
+from numpy.typing import NDArray
+
+from ._shape import _ShapeLike
+from ._scalars import _ScalarLike_co
+from ._array_like import ArrayLike, _ArrayLikeBool_co, _ArrayLikeInt_co
+from ._dtype_like import DTypeLike
+
+_T = TypeVar("_T")
+_2Tuple = tuple[_T, _T]
+_3Tuple = tuple[_T, _T, _T]
+_4Tuple = tuple[_T, _T, _T, _T]
+
+_NTypes = TypeVar("_NTypes", bound=int)
+_IDType = TypeVar("_IDType", bound=Any)
+_NameType = TypeVar("_NameType", bound=str)
+
+
+class _SupportsArrayUFunc(Protocol):
+ def __array_ufunc__(
+ self,
+ ufunc: ufunc,
+ method: Literal["__call__", "reduce", "reduceat", "accumulate", "outer", "inner"],
+ *inputs: Any,
+ **kwargs: Any,
+ ) -> Any: ...
+
+
+# NOTE: In reality `extobj` should be a length of list 3 containing an
+# int, an int, and a callable, but there's no way to properly express
+# non-homogenous lists.
+# Use `Any` over `Union` to avoid issues related to lists invariance.
+
+# NOTE: `reduce`, `accumulate`, `reduceat` and `outer` raise a ValueError for
+# ufuncs that don't accept two input arguments and return one output argument.
+# In such cases the respective methods are simply typed as `None`.
+
+# NOTE: Similarly, `at` won't be defined for ufuncs that return
+# multiple outputs; in such cases `at` is typed as `None`
+
+# NOTE: If 2 output types are returned then `out` must be a
+# 2-tuple of arrays. Otherwise `None` or a plain array are also acceptable
+
+class _UFunc_Nin1_Nout1(ufunc, Generic[_NameType, _NTypes, _IDType]): # type: ignore[misc]
+ @property
+ def __name__(self) -> _NameType: ...
+ @property
+ def ntypes(self) -> _NTypes: ...
+ @property
+ def identity(self) -> _IDType: ...
+ @property
+ def nin(self) -> Literal[1]: ...
+ @property
+ def nout(self) -> Literal[1]: ...
+ @property
+ def nargs(self) -> Literal[2]: ...
+ @property
+ def signature(self) -> None: ...
+ @property
+ def reduce(self) -> None: ...
+ @property
+ def accumulate(self) -> None: ...
+ @property
+ def reduceat(self) -> None: ...
+ @property
+ def outer(self) -> None: ...
+
+ @overload
+ def __call__(
+ self,
+ __x1: _ScalarLike_co,
+ out: None = ...,
+ *,
+ where: None | _ArrayLikeBool_co = ...,
+ casting: _CastingKind = ...,
+ order: _OrderKACF = ...,
+ dtype: DTypeLike = ...,
+ subok: bool = ...,
+ signature: str | _2Tuple[None | str] = ...,
+ extobj: list[Any] = ...,
+ ) -> Any: ...
+ @overload
+ def __call__(
+ self,
+ __x1: ArrayLike,
+ out: None | NDArray[Any] | tuple[NDArray[Any]] = ...,
+ *,
+ where: None | _ArrayLikeBool_co = ...,
+ casting: _CastingKind = ...,
+ order: _OrderKACF = ...,
+ dtype: DTypeLike = ...,
+ subok: bool = ...,
+ signature: str | _2Tuple[None | str] = ...,
+ extobj: list[Any] = ...,
+ ) -> NDArray[Any]: ...
+ @overload
+ def __call__(
+ self,
+ __x1: _SupportsArrayUFunc,
+ out: None | NDArray[Any] | tuple[NDArray[Any]] = ...,
+ *,
+ where: None | _ArrayLikeBool_co = ...,
+ casting: _CastingKind = ...,
+ order: _OrderKACF = ...,
+ dtype: DTypeLike = ...,
+ subok: bool = ...,
+ signature: str | _2Tuple[None | str] = ...,
+ extobj: list[Any] = ...,
+ ) -> Any: ...
+
+ def at(
+ self,
+ a: _SupportsArrayUFunc,
+ indices: _ArrayLikeInt_co,
+ /,
+ ) -> None: ...
+
+class _UFunc_Nin2_Nout1(ufunc, Generic[_NameType, _NTypes, _IDType]): # type: ignore[misc]
+ @property
+ def __name__(self) -> _NameType: ...
+ @property
+ def ntypes(self) -> _NTypes: ...
+ @property
+ def identity(self) -> _IDType: ...
+ @property
+ def nin(self) -> Literal[2]: ...
+ @property
+ def nout(self) -> Literal[1]: ...
+ @property
+ def nargs(self) -> Literal[3]: ...
+ @property
+ def signature(self) -> None: ...
+
+ @overload
+ def __call__(
+ self,
+ __x1: _ScalarLike_co,
+ __x2: _ScalarLike_co,
+ out: None = ...,
+ *,
+ where: None | _ArrayLikeBool_co = ...,
+ casting: _CastingKind = ...,
+ order: _OrderKACF = ...,
+ dtype: DTypeLike = ...,
+ subok: bool = ...,
+ signature: str | _3Tuple[None | str] = ...,
+ extobj: list[Any] = ...,
+ ) -> Any: ...
+ @overload
+ def __call__(
+ self,
+ __x1: ArrayLike,
+ __x2: ArrayLike,
+ out: None | NDArray[Any] | tuple[NDArray[Any]] = ...,
+ *,
+ where: None | _ArrayLikeBool_co = ...,
+ casting: _CastingKind = ...,
+ order: _OrderKACF = ...,
+ dtype: DTypeLike = ...,
+ subok: bool = ...,
+ signature: str | _3Tuple[None | str] = ...,
+ extobj: list[Any] = ...,
+ ) -> NDArray[Any]: ...
+
+ def at(
+ self,
+ a: NDArray[Any],
+ indices: _ArrayLikeInt_co,
+ b: ArrayLike,
+ /,
+ ) -> None: ...
+
+ def reduce(
+ self,
+ array: ArrayLike,
+ axis: None | _ShapeLike = ...,
+ dtype: DTypeLike = ...,
+ out: None | NDArray[Any] = ...,
+ keepdims: bool = ...,
+ initial: Any = ...,
+ where: _ArrayLikeBool_co = ...,
+ ) -> Any: ...
+
+ def accumulate(
+ self,
+ array: ArrayLike,
+ axis: SupportsIndex = ...,
+ dtype: DTypeLike = ...,
+ out: None | NDArray[Any] = ...,
+ ) -> NDArray[Any]: ...
+
+ def reduceat(
+ self,
+ array: ArrayLike,
+ indices: _ArrayLikeInt_co,
+ axis: SupportsIndex = ...,
+ dtype: DTypeLike = ...,
+ out: None | NDArray[Any] = ...,
+ ) -> NDArray[Any]: ...
+
+ # Expand `**kwargs` into explicit keyword-only arguments
+ @overload
+ def outer(
+ self,
+ A: _ScalarLike_co,
+ B: _ScalarLike_co,
+ /, *,
+ out: None = ...,
+ where: None | _ArrayLikeBool_co = ...,
+ casting: _CastingKind = ...,
+ order: _OrderKACF = ...,
+ dtype: DTypeLike = ...,
+ subok: bool = ...,
+ signature: str | _3Tuple[None | str] = ...,
+ extobj: list[Any] = ...,
+ ) -> Any: ...
+ @overload
+ def outer( # type: ignore[misc]
+ self,
+ A: ArrayLike,
+ B: ArrayLike,
+ /, *,
+ out: None | NDArray[Any] | tuple[NDArray[Any]] = ...,
+ where: None | _ArrayLikeBool_co = ...,
+ casting: _CastingKind = ...,
+ order: _OrderKACF = ...,
+ dtype: DTypeLike = ...,
+ subok: bool = ...,
+ signature: str | _3Tuple[None | str] = ...,
+ extobj: list[Any] = ...,
+ ) -> NDArray[Any]: ...
+
+class _UFunc_Nin1_Nout2(ufunc, Generic[_NameType, _NTypes, _IDType]): # type: ignore[misc]
+ @property
+ def __name__(self) -> _NameType: ...
+ @property
+ def ntypes(self) -> _NTypes: ...
+ @property
+ def identity(self) -> _IDType: ...
+ @property
+ def nin(self) -> Literal[1]: ...
+ @property
+ def nout(self) -> Literal[2]: ...
+ @property
+ def nargs(self) -> Literal[3]: ...
+ @property
+ def signature(self) -> None: ...
+ @property
+ def at(self) -> None: ...
+ @property
+ def reduce(self) -> None: ...
+ @property
+ def accumulate(self) -> None: ...
+ @property
+ def reduceat(self) -> None: ...
+ @property
+ def outer(self) -> None: ...
+
+ @overload
+ def __call__(
+ self,
+ __x1: _ScalarLike_co,
+ __out1: None = ...,
+ __out2: None = ...,
+ *,
+ where: None | _ArrayLikeBool_co = ...,
+ casting: _CastingKind = ...,
+ order: _OrderKACF = ...,
+ dtype: DTypeLike = ...,
+ subok: bool = ...,
+ signature: str | _3Tuple[None | str] = ...,
+ extobj: list[Any] = ...,
+ ) -> _2Tuple[Any]: ...
+ @overload
+ def __call__(
+ self,
+ __x1: ArrayLike,
+ __out1: None | NDArray[Any] = ...,
+ __out2: None | NDArray[Any] = ...,
+ *,
+ out: _2Tuple[NDArray[Any]] = ...,
+ where: None | _ArrayLikeBool_co = ...,
+ casting: _CastingKind = ...,
+ order: _OrderKACF = ...,
+ dtype: DTypeLike = ...,
+ subok: bool = ...,
+ signature: str | _3Tuple[None | str] = ...,
+ extobj: list[Any] = ...,
+ ) -> _2Tuple[NDArray[Any]]: ...
+ @overload
+ def __call__(
+ self,
+ __x1: _SupportsArrayUFunc,
+ __out1: None | NDArray[Any] = ...,
+ __out2: None | NDArray[Any] = ...,
+ *,
+ out: _2Tuple[NDArray[Any]] = ...,
+ where: None | _ArrayLikeBool_co = ...,
+ casting: _CastingKind = ...,
+ order: _OrderKACF = ...,
+ dtype: DTypeLike = ...,
+ subok: bool = ...,
+ signature: str | _3Tuple[None | str] = ...,
+ extobj: list[Any] = ...,
+ ) -> _2Tuple[Any]: ...
+
+class _UFunc_Nin2_Nout2(ufunc, Generic[_NameType, _NTypes, _IDType]): # type: ignore[misc]
+ @property
+ def __name__(self) -> _NameType: ...
+ @property
+ def ntypes(self) -> _NTypes: ...
+ @property
+ def identity(self) -> _IDType: ...
+ @property
+ def nin(self) -> Literal[2]: ...
+ @property
+ def nout(self) -> Literal[2]: ...
+ @property
+ def nargs(self) -> Literal[4]: ...
+ @property
+ def signature(self) -> None: ...
+ @property
+ def at(self) -> None: ...
+ @property
+ def reduce(self) -> None: ...
+ @property
+ def accumulate(self) -> None: ...
+ @property
+ def reduceat(self) -> None: ...
+ @property
+ def outer(self) -> None: ...
+
+ @overload
+ def __call__(
+ self,
+ __x1: _ScalarLike_co,
+ __x2: _ScalarLike_co,
+ __out1: None = ...,
+ __out2: None = ...,
+ *,
+ where: None | _ArrayLikeBool_co = ...,
+ casting: _CastingKind = ...,
+ order: _OrderKACF = ...,
+ dtype: DTypeLike = ...,
+ subok: bool = ...,
+ signature: str | _4Tuple[None | str] = ...,
+ extobj: list[Any] = ...,
+ ) -> _2Tuple[Any]: ...
+ @overload
+ def __call__(
+ self,
+ __x1: ArrayLike,
+ __x2: ArrayLike,
+ __out1: None | NDArray[Any] = ...,
+ __out2: None | NDArray[Any] = ...,
+ *,
+ out: _2Tuple[NDArray[Any]] = ...,
+ where: None | _ArrayLikeBool_co = ...,
+ casting: _CastingKind = ...,
+ order: _OrderKACF = ...,
+ dtype: DTypeLike = ...,
+ subok: bool = ...,
+ signature: str | _4Tuple[None | str] = ...,
+ extobj: list[Any] = ...,
+ ) -> _2Tuple[NDArray[Any]]: ...
+
+class _GUFunc_Nin2_Nout1(ufunc, Generic[_NameType, _NTypes, _IDType]): # type: ignore[misc]
+ @property
+ def __name__(self) -> _NameType: ...
+ @property
+ def ntypes(self) -> _NTypes: ...
+ @property
+ def identity(self) -> _IDType: ...
+ @property
+ def nin(self) -> Literal[2]: ...
+ @property
+ def nout(self) -> Literal[1]: ...
+ @property
+ def nargs(self) -> Literal[3]: ...
+
+ # NOTE: In practice the only gufunc in the main namespace is `matmul`,
+ # so we can use its signature here
+ @property
+ def signature(self) -> Literal["(n?,k),(k,m?)->(n?,m?)"]: ...
+ @property
+ def reduce(self) -> None: ...
+ @property
+ def accumulate(self) -> None: ...
+ @property
+ def reduceat(self) -> None: ...
+ @property
+ def outer(self) -> None: ...
+ @property
+ def at(self) -> None: ...
+
+ # Scalar for 1D array-likes; ndarray otherwise
+ @overload
+ def __call__(
+ self,
+ __x1: ArrayLike,
+ __x2: ArrayLike,
+ out: None = ...,
+ *,
+ casting: _CastingKind = ...,
+ order: _OrderKACF = ...,
+ dtype: DTypeLike = ...,
+ subok: bool = ...,
+ signature: str | _3Tuple[None | str] = ...,
+ extobj: list[Any] = ...,
+ axes: list[_2Tuple[SupportsIndex]] = ...,
+ ) -> Any: ...
+ @overload
+ def __call__(
+ self,
+ __x1: ArrayLike,
+ __x2: ArrayLike,
+ out: NDArray[Any] | tuple[NDArray[Any]],
+ *,
+ casting: _CastingKind = ...,
+ order: _OrderKACF = ...,
+ dtype: DTypeLike = ...,
+ subok: bool = ...,
+ signature: str | _3Tuple[None | str] = ...,
+ extobj: list[Any] = ...,
+ axes: list[_2Tuple[SupportsIndex]] = ...,
+ ) -> NDArray[Any]: ...
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/_typing/setup.py b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/_typing/setup.py
new file mode 100644
index 0000000000000000000000000000000000000000..24022fdaa32708150cd5d1dcfe586eb33fb7175e
--- /dev/null
+++ b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/_typing/setup.py
@@ -0,0 +1,10 @@
+def configuration(parent_package='', top_path=None):
+ from numpy.distutils.misc_util import Configuration
+ config = Configuration('_typing', parent_package, top_path)
+ config.add_data_files('*.pyi')
+ return config
+
+
+if __name__ == '__main__':
+ from numpy.distutils.core import setup
+ setup(configuration=configuration)
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/_utils/__init__.py b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/_utils/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..388dd9174f356c74d6cdd6ad9a8b1ad603234420
--- /dev/null
+++ b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/_utils/__init__.py
@@ -0,0 +1,29 @@
+"""
+This is a module for defining private helpers which do not depend on the
+rest of NumPy.
+
+Everything in here must be self-contained so that it can be
+imported anywhere else without creating circular imports.
+If a utility requires the import of NumPy, it probably belongs
+in ``numpy.core``.
+"""
+
+from ._convertions import asunicode, asbytes
+
+
+def set_module(module):
+ """Private decorator for overriding __module__ on a function or class.
+
+ Example usage::
+
+ @set_module('numpy')
+ def example():
+ pass
+
+ assert example.__module__ == 'numpy'
+ """
+ def decorator(func):
+ if module is not None:
+ func.__module__ = module
+ return func
+ return decorator
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/_utils/__pycache__/__init__.cpython-311.pyc b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/_utils/__pycache__/__init__.cpython-311.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..0f634380130266d5e2179a9b69474ec92e215812
Binary files /dev/null and b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/_utils/__pycache__/__init__.cpython-311.pyc differ
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/_utils/__pycache__/_convertions.cpython-311.pyc b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/_utils/__pycache__/_convertions.cpython-311.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..672043b319d6d088daa1ef1aba9d5f8ce099ec3d
Binary files /dev/null and b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/_utils/__pycache__/_convertions.cpython-311.pyc differ
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/_utils/__pycache__/_inspect.cpython-311.pyc b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/_utils/__pycache__/_inspect.cpython-311.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..e77ed4fd5d446ecc959eb7bc765d197b36d1964c
Binary files /dev/null and b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/_utils/__pycache__/_inspect.cpython-311.pyc differ
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/_utils/__pycache__/_pep440.cpython-311.pyc b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/_utils/__pycache__/_pep440.cpython-311.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..2dc4ac104bed6d2b1819840cd544cc9a1a23dd57
Binary files /dev/null and b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/_utils/__pycache__/_pep440.cpython-311.pyc differ
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/_utils/_convertions.py b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/_utils/_convertions.py
new file mode 100644
index 0000000000000000000000000000000000000000..ab15a8ba019f1b6a40ac3f562897fa4581323efc
--- /dev/null
+++ b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/_utils/_convertions.py
@@ -0,0 +1,18 @@
+"""
+A set of methods retained from np.compat module that
+are still used across codebase.
+"""
+
+__all__ = ["asunicode", "asbytes"]
+
+
+def asunicode(s):
+ if isinstance(s, bytes):
+ return s.decode('latin1')
+ return str(s)
+
+
+def asbytes(s):
+ if isinstance(s, bytes):
+ return s
+ return str(s).encode('latin1')
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/_utils/_inspect.py b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/_utils/_inspect.py
new file mode 100644
index 0000000000000000000000000000000000000000..9a874a71dd0a53e25a671c51bfdceec850702bfe
--- /dev/null
+++ b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/_utils/_inspect.py
@@ -0,0 +1,191 @@
+"""Subset of inspect module from upstream python
+
+We use this instead of upstream because upstream inspect is slow to import, and
+significantly contributes to numpy import times. Importing this copy has almost
+no overhead.
+
+"""
+import types
+
+__all__ = ['getargspec', 'formatargspec']
+
+# ----------------------------------------------------------- type-checking
+def ismethod(object):
+ """Return true if the object is an instance method.
+
+ Instance method objects provide these attributes:
+ __doc__ documentation string
+ __name__ name with which this method was defined
+ im_class class object in which this method belongs
+ im_func function object containing implementation of method
+ im_self instance to which this method is bound, or None
+
+ """
+ return isinstance(object, types.MethodType)
+
+def isfunction(object):
+ """Return true if the object is a user-defined function.
+
+ Function objects provide these attributes:
+ __doc__ documentation string
+ __name__ name with which this function was defined
+ func_code code object containing compiled function bytecode
+ func_defaults tuple of any default values for arguments
+ func_doc (same as __doc__)
+ func_globals global namespace in which this function was defined
+ func_name (same as __name__)
+
+ """
+ return isinstance(object, types.FunctionType)
+
+def iscode(object):
+ """Return true if the object is a code object.
+
+ Code objects provide these attributes:
+ co_argcount number of arguments (not including * or ** args)
+ co_code string of raw compiled bytecode
+ co_consts tuple of constants used in the bytecode
+ co_filename name of file in which this code object was created
+ co_firstlineno number of first line in Python source code
+ co_flags bitmap: 1=optimized | 2=newlocals | 4=*arg | 8=**arg
+ co_lnotab encoded mapping of line numbers to bytecode indices
+ co_name name with which this code object was defined
+ co_names tuple of names of local variables
+ co_nlocals number of local variables
+ co_stacksize virtual machine stack space required
+ co_varnames tuple of names of arguments and local variables
+
+ """
+ return isinstance(object, types.CodeType)
+
+# ------------------------------------------------ argument list extraction
+# These constants are from Python's compile.h.
+CO_OPTIMIZED, CO_NEWLOCALS, CO_VARARGS, CO_VARKEYWORDS = 1, 2, 4, 8
+
+def getargs(co):
+ """Get information about the arguments accepted by a code object.
+
+ Three things are returned: (args, varargs, varkw), where 'args' is
+ a list of argument names (possibly containing nested lists), and
+ 'varargs' and 'varkw' are the names of the * and ** arguments or None.
+
+ """
+
+ if not iscode(co):
+ raise TypeError('arg is not a code object')
+
+ nargs = co.co_argcount
+ names = co.co_varnames
+ args = list(names[:nargs])
+
+ # The following acrobatics are for anonymous (tuple) arguments.
+ # Which we do not need to support, so remove to avoid importing
+ # the dis module.
+ for i in range(nargs):
+ if args[i][:1] in ['', '.']:
+ raise TypeError("tuple function arguments are not supported")
+ varargs = None
+ if co.co_flags & CO_VARARGS:
+ varargs = co.co_varnames[nargs]
+ nargs = nargs + 1
+ varkw = None
+ if co.co_flags & CO_VARKEYWORDS:
+ varkw = co.co_varnames[nargs]
+ return args, varargs, varkw
+
+def getargspec(func):
+ """Get the names and default values of a function's arguments.
+
+ A tuple of four things is returned: (args, varargs, varkw, defaults).
+ 'args' is a list of the argument names (it may contain nested lists).
+ 'varargs' and 'varkw' are the names of the * and ** arguments or None.
+ 'defaults' is an n-tuple of the default values of the last n arguments.
+
+ """
+
+ if ismethod(func):
+ func = func.__func__
+ if not isfunction(func):
+ raise TypeError('arg is not a Python function')
+ args, varargs, varkw = getargs(func.__code__)
+ return args, varargs, varkw, func.__defaults__
+
+def getargvalues(frame):
+ """Get information about arguments passed into a particular frame.
+
+ A tuple of four things is returned: (args, varargs, varkw, locals).
+ 'args' is a list of the argument names (it may contain nested lists).
+ 'varargs' and 'varkw' are the names of the * and ** arguments or None.
+ 'locals' is the locals dictionary of the given frame.
+
+ """
+ args, varargs, varkw = getargs(frame.f_code)
+ return args, varargs, varkw, frame.f_locals
+
+def joinseq(seq):
+ if len(seq) == 1:
+ return '(' + seq[0] + ',)'
+ else:
+ return '(' + ', '.join(seq) + ')'
+
+def strseq(object, convert, join=joinseq):
+ """Recursively walk a sequence, stringifying each element.
+
+ """
+ if type(object) in [list, tuple]:
+ return join([strseq(_o, convert, join) for _o in object])
+ else:
+ return convert(object)
+
+def formatargspec(args, varargs=None, varkw=None, defaults=None,
+ formatarg=str,
+ formatvarargs=lambda name: '*' + name,
+ formatvarkw=lambda name: '**' + name,
+ formatvalue=lambda value: '=' + repr(value),
+ join=joinseq):
+ """Format an argument spec from the 4 values returned by getargspec.
+
+ The first four arguments are (args, varargs, varkw, defaults). The
+ other four arguments are the corresponding optional formatting functions
+ that are called to turn names and values into strings. The ninth
+ argument is an optional function to format the sequence of arguments.
+
+ """
+ specs = []
+ if defaults:
+ firstdefault = len(args) - len(defaults)
+ for i in range(len(args)):
+ spec = strseq(args[i], formatarg, join)
+ if defaults and i >= firstdefault:
+ spec = spec + formatvalue(defaults[i - firstdefault])
+ specs.append(spec)
+ if varargs is not None:
+ specs.append(formatvarargs(varargs))
+ if varkw is not None:
+ specs.append(formatvarkw(varkw))
+ return '(' + ', '.join(specs) + ')'
+
+def formatargvalues(args, varargs, varkw, locals,
+ formatarg=str,
+ formatvarargs=lambda name: '*' + name,
+ formatvarkw=lambda name: '**' + name,
+ formatvalue=lambda value: '=' + repr(value),
+ join=joinseq):
+ """Format an argument spec from the 4 values returned by getargvalues.
+
+ The first four arguments are (args, varargs, varkw, locals). The
+ next four arguments are the corresponding optional formatting functions
+ that are called to turn names and values into strings. The ninth
+ argument is an optional function to format the sequence of arguments.
+
+ """
+ def convert(name, locals=locals,
+ formatarg=formatarg, formatvalue=formatvalue):
+ return formatarg(name) + formatvalue(locals[name])
+ specs = [strseq(arg, convert, join) for arg in args]
+
+ if varargs:
+ specs.append(formatvarargs(varargs) + formatvalue(locals[varargs]))
+ if varkw:
+ specs.append(formatvarkw(varkw) + formatvalue(locals[varkw]))
+ return '(' + ', '.join(specs) + ')'
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/_utils/_pep440.py b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/_utils/_pep440.py
new file mode 100644
index 0000000000000000000000000000000000000000..73d0afb5e95f099f8b04253177e8a3ab3d80d0c4
--- /dev/null
+++ b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/_utils/_pep440.py
@@ -0,0 +1,487 @@
+"""Utility to compare pep440 compatible version strings.
+
+The LooseVersion and StrictVersion classes that distutils provides don't
+work; they don't recognize anything like alpha/beta/rc/dev versions.
+"""
+
+# Copyright (c) Donald Stufft and individual contributors.
+# All rights reserved.
+
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+
+# 1. Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer.
+
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+
+import collections
+import itertools
+import re
+
+
+__all__ = [
+ "parse", "Version", "LegacyVersion", "InvalidVersion", "VERSION_PATTERN",
+]
+
+
+# BEGIN packaging/_structures.py
+
+
+class Infinity:
+ def __repr__(self):
+ return "Infinity"
+
+ def __hash__(self):
+ return hash(repr(self))
+
+ def __lt__(self, other):
+ return False
+
+ def __le__(self, other):
+ return False
+
+ def __eq__(self, other):
+ return isinstance(other, self.__class__)
+
+ def __ne__(self, other):
+ return not isinstance(other, self.__class__)
+
+ def __gt__(self, other):
+ return True
+
+ def __ge__(self, other):
+ return True
+
+ def __neg__(self):
+ return NegativeInfinity
+
+
+Infinity = Infinity()
+
+
+class NegativeInfinity:
+ def __repr__(self):
+ return "-Infinity"
+
+ def __hash__(self):
+ return hash(repr(self))
+
+ def __lt__(self, other):
+ return True
+
+ def __le__(self, other):
+ return True
+
+ def __eq__(self, other):
+ return isinstance(other, self.__class__)
+
+ def __ne__(self, other):
+ return not isinstance(other, self.__class__)
+
+ def __gt__(self, other):
+ return False
+
+ def __ge__(self, other):
+ return False
+
+ def __neg__(self):
+ return Infinity
+
+
+# BEGIN packaging/version.py
+
+
+NegativeInfinity = NegativeInfinity()
+
+_Version = collections.namedtuple(
+ "_Version",
+ ["epoch", "release", "dev", "pre", "post", "local"],
+)
+
+
+def parse(version):
+ """
+ Parse the given version string and return either a :class:`Version` object
+ or a :class:`LegacyVersion` object depending on if the given version is
+ a valid PEP 440 version or a legacy version.
+ """
+ try:
+ return Version(version)
+ except InvalidVersion:
+ return LegacyVersion(version)
+
+
+class InvalidVersion(ValueError):
+ """
+ An invalid version was found, users should refer to PEP 440.
+ """
+
+
+class _BaseVersion:
+
+ def __hash__(self):
+ return hash(self._key)
+
+ def __lt__(self, other):
+ return self._compare(other, lambda s, o: s < o)
+
+ def __le__(self, other):
+ return self._compare(other, lambda s, o: s <= o)
+
+ def __eq__(self, other):
+ return self._compare(other, lambda s, o: s == o)
+
+ def __ge__(self, other):
+ return self._compare(other, lambda s, o: s >= o)
+
+ def __gt__(self, other):
+ return self._compare(other, lambda s, o: s > o)
+
+ def __ne__(self, other):
+ return self._compare(other, lambda s, o: s != o)
+
+ def _compare(self, other, method):
+ if not isinstance(other, _BaseVersion):
+ return NotImplemented
+
+ return method(self._key, other._key)
+
+
+class LegacyVersion(_BaseVersion):
+
+ def __init__(self, version):
+ self._version = str(version)
+ self._key = _legacy_cmpkey(self._version)
+
+ def __str__(self):
+ return self._version
+
+ def __repr__(self):
+ return "".format(repr(str(self)))
+
+ @property
+ def public(self):
+ return self._version
+
+ @property
+ def base_version(self):
+ return self._version
+
+ @property
+ def local(self):
+ return None
+
+ @property
+ def is_prerelease(self):
+ return False
+
+ @property
+ def is_postrelease(self):
+ return False
+
+
+_legacy_version_component_re = re.compile(
+ r"(\d+ | [a-z]+ | \.| -)", re.VERBOSE,
+)
+
+_legacy_version_replacement_map = {
+ "pre": "c", "preview": "c", "-": "final-", "rc": "c", "dev": "@",
+}
+
+
+def _parse_version_parts(s):
+ for part in _legacy_version_component_re.split(s):
+ part = _legacy_version_replacement_map.get(part, part)
+
+ if not part or part == ".":
+ continue
+
+ if part[:1] in "0123456789":
+ # pad for numeric comparison
+ yield part.zfill(8)
+ else:
+ yield "*" + part
+
+ # ensure that alpha/beta/candidate are before final
+ yield "*final"
+
+
+def _legacy_cmpkey(version):
+ # We hardcode an epoch of -1 here. A PEP 440 version can only have an epoch
+ # greater than or equal to 0. This will effectively put the LegacyVersion,
+ # which uses the defacto standard originally implemented by setuptools,
+ # as before all PEP 440 versions.
+ epoch = -1
+
+ # This scheme is taken from pkg_resources.parse_version setuptools prior to
+ # its adoption of the packaging library.
+ parts = []
+ for part in _parse_version_parts(version.lower()):
+ if part.startswith("*"):
+ # remove "-" before a prerelease tag
+ if part < "*final":
+ while parts and parts[-1] == "*final-":
+ parts.pop()
+
+ # remove trailing zeros from each series of numeric parts
+ while parts and parts[-1] == "00000000":
+ parts.pop()
+
+ parts.append(part)
+ parts = tuple(parts)
+
+ return epoch, parts
+
+
+# Deliberately not anchored to the start and end of the string, to make it
+# easier for 3rd party code to reuse
+VERSION_PATTERN = r"""
+ v?
+ (?:
+ (?:(?P[0-9]+)!)? # epoch
+ (?P[0-9]+(?:\.[0-9]+)*) # release segment
+ (?P # pre-release
+ [-_\.]?
+ (?P(a|b|c|rc|alpha|beta|pre|preview))
+ [-_\.]?
+ (?P[0-9]+)?
+ )?
+ (?P # post release
+ (?:-(?P[0-9]+))
+ |
+ (?:
+ [-_\.]?
+ (?Ppost|rev|r)
+ [-_\.]?
+ (?P[0-9]+)?
+ )
+ )?
+ (?P # dev release
+ [-_\.]?
+ (?Pdev)
+ [-_\.]?
+ (?P[0-9]+)?
+ )?
+ )
+ (?:\+(?P[a-z0-9]+(?:[-_\.][a-z0-9]+)*))? # local version
+"""
+
+
+class Version(_BaseVersion):
+
+ _regex = re.compile(
+ r"^\s*" + VERSION_PATTERN + r"\s*$",
+ re.VERBOSE | re.IGNORECASE,
+ )
+
+ def __init__(self, version):
+ # Validate the version and parse it into pieces
+ match = self._regex.search(version)
+ if not match:
+ raise InvalidVersion("Invalid version: '{0}'".format(version))
+
+ # Store the parsed out pieces of the version
+ self._version = _Version(
+ epoch=int(match.group("epoch")) if match.group("epoch") else 0,
+ release=tuple(int(i) for i in match.group("release").split(".")),
+ pre=_parse_letter_version(
+ match.group("pre_l"),
+ match.group("pre_n"),
+ ),
+ post=_parse_letter_version(
+ match.group("post_l"),
+ match.group("post_n1") or match.group("post_n2"),
+ ),
+ dev=_parse_letter_version(
+ match.group("dev_l"),
+ match.group("dev_n"),
+ ),
+ local=_parse_local_version(match.group("local")),
+ )
+
+ # Generate a key which will be used for sorting
+ self._key = _cmpkey(
+ self._version.epoch,
+ self._version.release,
+ self._version.pre,
+ self._version.post,
+ self._version.dev,
+ self._version.local,
+ )
+
+ def __repr__(self):
+ return "".format(repr(str(self)))
+
+ def __str__(self):
+ parts = []
+
+ # Epoch
+ if self._version.epoch != 0:
+ parts.append("{0}!".format(self._version.epoch))
+
+ # Release segment
+ parts.append(".".join(str(x) for x in self._version.release))
+
+ # Pre-release
+ if self._version.pre is not None:
+ parts.append("".join(str(x) for x in self._version.pre))
+
+ # Post-release
+ if self._version.post is not None:
+ parts.append(".post{0}".format(self._version.post[1]))
+
+ # Development release
+ if self._version.dev is not None:
+ parts.append(".dev{0}".format(self._version.dev[1]))
+
+ # Local version segment
+ if self._version.local is not None:
+ parts.append(
+ "+{0}".format(".".join(str(x) for x in self._version.local))
+ )
+
+ return "".join(parts)
+
+ @property
+ def public(self):
+ return str(self).split("+", 1)[0]
+
+ @property
+ def base_version(self):
+ parts = []
+
+ # Epoch
+ if self._version.epoch != 0:
+ parts.append("{0}!".format(self._version.epoch))
+
+ # Release segment
+ parts.append(".".join(str(x) for x in self._version.release))
+
+ return "".join(parts)
+
+ @property
+ def local(self):
+ version_string = str(self)
+ if "+" in version_string:
+ return version_string.split("+", 1)[1]
+
+ @property
+ def is_prerelease(self):
+ return bool(self._version.dev or self._version.pre)
+
+ @property
+ def is_postrelease(self):
+ return bool(self._version.post)
+
+
+def _parse_letter_version(letter, number):
+ if letter:
+ # We assume there is an implicit 0 in a pre-release if there is
+ # no numeral associated with it.
+ if number is None:
+ number = 0
+
+ # We normalize any letters to their lower-case form
+ letter = letter.lower()
+
+ # We consider some words to be alternate spellings of other words and
+ # in those cases we want to normalize the spellings to our preferred
+ # spelling.
+ if letter == "alpha":
+ letter = "a"
+ elif letter == "beta":
+ letter = "b"
+ elif letter in ["c", "pre", "preview"]:
+ letter = "rc"
+ elif letter in ["rev", "r"]:
+ letter = "post"
+
+ return letter, int(number)
+ if not letter and number:
+ # We assume that if we are given a number but not given a letter,
+ # then this is using the implicit post release syntax (e.g., 1.0-1)
+ letter = "post"
+
+ return letter, int(number)
+
+
+_local_version_seperators = re.compile(r"[\._-]")
+
+
+def _parse_local_version(local):
+ """
+ Takes a string like abc.1.twelve and turns it into ("abc", 1, "twelve").
+ """
+ if local is not None:
+ return tuple(
+ part.lower() if not part.isdigit() else int(part)
+ for part in _local_version_seperators.split(local)
+ )
+
+
+def _cmpkey(epoch, release, pre, post, dev, local):
+ # When we compare a release version, we want to compare it with all of the
+ # trailing zeros removed. So we'll use a reverse the list, drop all the now
+ # leading zeros until we come to something non-zero, then take the rest,
+ # re-reverse it back into the correct order, and make it a tuple and use
+ # that for our sorting key.
+ release = tuple(
+ reversed(list(
+ itertools.dropwhile(
+ lambda x: x == 0,
+ reversed(release),
+ )
+ ))
+ )
+
+ # We need to "trick" the sorting algorithm to put 1.0.dev0 before 1.0a0.
+ # We'll do this by abusing the pre-segment, but we _only_ want to do this
+ # if there is no pre- or a post-segment. If we have one of those, then
+ # the normal sorting rules will handle this case correctly.
+ if pre is None and post is None and dev is not None:
+ pre = -Infinity
+ # Versions without a pre-release (except as noted above) should sort after
+ # those with one.
+ elif pre is None:
+ pre = Infinity
+
+ # Versions without a post-segment should sort before those with one.
+ if post is None:
+ post = -Infinity
+
+ # Versions without a development segment should sort after those with one.
+ if dev is None:
+ dev = Infinity
+
+ if local is None:
+ # Versions without a local segment should sort before those with one.
+ local = -Infinity
+ else:
+ # Versions with a local segment need that segment parsed to implement
+ # the sorting rules in PEP440.
+ # - Alphanumeric segments sort before numeric segments
+ # - Alphanumeric segments sort lexicographically
+ # - Numeric segments sort numerically
+ # - Shorter versions sort before longer versions when the prefixes
+ # match exactly
+ local = tuple(
+ (i, "") if isinstance(i, int) else (-Infinity, i)
+ for i in local
+ )
+
+ return epoch, release, pre, post, dev, local
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/__init__.py b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..f74ed4d3f6dbed79dd9cd8284ebd596853204398
--- /dev/null
+++ b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/__init__.py
@@ -0,0 +1,64 @@
+"""
+An enhanced distutils, providing support for Fortran compilers, for BLAS,
+LAPACK and other common libraries for numerical computing, and more.
+
+Public submodules are::
+
+ misc_util
+ system_info
+ cpu_info
+ log
+ exec_command
+
+For details, please see the *Packaging* and *NumPy Distutils User Guide*
+sections of the NumPy Reference Guide.
+
+For configuring the preference for and location of libraries like BLAS and
+LAPACK, and for setting include paths and similar build options, please see
+``site.cfg.example`` in the root of the NumPy repository or sdist.
+
+"""
+
+import warnings
+
+# Must import local ccompiler ASAP in order to get
+# customized CCompiler.spawn effective.
+from . import ccompiler
+from . import unixccompiler
+
+from .npy_pkg_config import *
+
+warnings.warn("\n\n"
+ " `numpy.distutils` is deprecated since NumPy 1.23.0, as a result\n"
+ " of the deprecation of `distutils` itself. It will be removed for\n"
+ " Python >= 3.12. For older Python versions it will remain present.\n"
+ " It is recommended to use `setuptools < 60.0` for those Python versions.\n"
+ " For more details, see:\n"
+ " https://numpy.org/devdocs/reference/distutils_status_migration.html \n\n",
+ DeprecationWarning, stacklevel=2
+)
+del warnings
+
+# If numpy is installed, add distutils.test()
+try:
+ from . import __config__
+ # Normally numpy is installed if the above import works, but an interrupted
+ # in-place build could also have left a __config__.py. In that case the
+ # next import may still fail, so keep it inside the try block.
+ from numpy._pytesttester import PytestTester
+ test = PytestTester(__name__)
+ del PytestTester
+except ImportError:
+ pass
+
+
+def customized_fcompiler(plat=None, compiler=None):
+ from numpy.distutils.fcompiler import new_fcompiler
+ c = new_fcompiler(plat=plat, compiler=compiler)
+ c.customize()
+ return c
+
+def customized_ccompiler(plat=None, compiler=None, verbose=1):
+ c = ccompiler.new_compiler(plat=plat, compiler=compiler, verbose=verbose)
+ c.customize('')
+ return c
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/__init__.pyi b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/__init__.pyi
new file mode 100644
index 0000000000000000000000000000000000000000..3938d68de14c3f83f9278b5d6b6a151a28549a0d
--- /dev/null
+++ b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/__init__.pyi
@@ -0,0 +1,4 @@
+from typing import Any
+
+# TODO: remove when the full numpy namespace is defined
+def __getattr__(name: str) -> Any: ...
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/__pycache__/__init__.cpython-311.pyc b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/__pycache__/__init__.cpython-311.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..fa7f928ac832021903f27b642bae000d03a52e4c
Binary files /dev/null and b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/__pycache__/__init__.cpython-311.pyc differ
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/__pycache__/_shell_utils.cpython-311.pyc b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/__pycache__/_shell_utils.cpython-311.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..496c5b57129a934eb1f303f0e17ace72158185a9
Binary files /dev/null and b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/__pycache__/_shell_utils.cpython-311.pyc differ
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/__pycache__/armccompiler.cpython-311.pyc b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/__pycache__/armccompiler.cpython-311.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..088aabdcb67402e2dbdbad71250b27ee1fd9d0f7
Binary files /dev/null and b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/__pycache__/armccompiler.cpython-311.pyc differ
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/__pycache__/ccompiler.cpython-311.pyc b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/__pycache__/ccompiler.cpython-311.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..d282d294f00f37a948b835698c20997e4e78db0b
Binary files /dev/null and b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/__pycache__/ccompiler.cpython-311.pyc differ
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/__pycache__/conv_template.cpython-311.pyc b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/__pycache__/conv_template.cpython-311.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..3d1f19172b406d91baaea4a7bd5c22d700e1a625
Binary files /dev/null and b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/__pycache__/conv_template.cpython-311.pyc differ
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/__pycache__/core.cpython-311.pyc b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/__pycache__/core.cpython-311.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..4c3f4f28a424d13220e2f8aa74267bdd24e7a83d
Binary files /dev/null and b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/__pycache__/core.cpython-311.pyc differ
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/__pycache__/cpuinfo.cpython-311.pyc b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/__pycache__/cpuinfo.cpython-311.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..01f659802f4f1b6a2c900b7104664672ed36e76b
Binary files /dev/null and b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/__pycache__/cpuinfo.cpython-311.pyc differ
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/__pycache__/exec_command.cpython-311.pyc b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/__pycache__/exec_command.cpython-311.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..5c5eee728d963a9547d0bfc39844cdd614c5243a
Binary files /dev/null and b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/__pycache__/exec_command.cpython-311.pyc differ
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/__pycache__/extension.cpython-311.pyc b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/__pycache__/extension.cpython-311.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..4eb42b474069e60b0a7c49a272c4b9de5ff3468f
Binary files /dev/null and b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/__pycache__/extension.cpython-311.pyc differ
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/__pycache__/from_template.cpython-311.pyc b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/__pycache__/from_template.cpython-311.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..88eeecf82b3089aece3fb3dcf275808b091b9547
Binary files /dev/null and b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/__pycache__/from_template.cpython-311.pyc differ
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/__pycache__/fujitsuccompiler.cpython-311.pyc b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/__pycache__/fujitsuccompiler.cpython-311.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..ec2764515dc92a657e5dbc7d2b0cc162ac60d6de
Binary files /dev/null and b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/__pycache__/fujitsuccompiler.cpython-311.pyc differ
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/__pycache__/intelccompiler.cpython-311.pyc b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/__pycache__/intelccompiler.cpython-311.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..3e5a87c459036ffc91338a4a89aefc1593ac236a
Binary files /dev/null and b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/__pycache__/intelccompiler.cpython-311.pyc differ
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/__pycache__/lib2def.cpython-311.pyc b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/__pycache__/lib2def.cpython-311.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..929aa0c06306356064ee20dd50b63cf01b47a3e5
Binary files /dev/null and b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/__pycache__/lib2def.cpython-311.pyc differ
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/__pycache__/line_endings.cpython-311.pyc b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/__pycache__/line_endings.cpython-311.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..10c9d54193bc41afd41fa7da2375b2830c58f984
Binary files /dev/null and b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/__pycache__/line_endings.cpython-311.pyc differ
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/__pycache__/log.cpython-311.pyc b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/__pycache__/log.cpython-311.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..08f76282092fde6fedbd703602be20e048edd9bf
Binary files /dev/null and b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/__pycache__/log.cpython-311.pyc differ
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/__pycache__/mingw32ccompiler.cpython-311.pyc b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/__pycache__/mingw32ccompiler.cpython-311.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..b59e944754b3ae1e70344f02320fc9e2ee18d8f8
Binary files /dev/null and b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/__pycache__/mingw32ccompiler.cpython-311.pyc differ
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/__pycache__/msvc9compiler.cpython-311.pyc b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/__pycache__/msvc9compiler.cpython-311.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..fcbdb4626e695251f4fa4f8fa575b539d6fce5eb
Binary files /dev/null and b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/__pycache__/msvc9compiler.cpython-311.pyc differ
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/__pycache__/msvccompiler.cpython-311.pyc b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/__pycache__/msvccompiler.cpython-311.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..a199927a3498070ea3577a7ce4bacaa64c5b8775
Binary files /dev/null and b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/__pycache__/msvccompiler.cpython-311.pyc differ
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/__pycache__/npy_pkg_config.cpython-311.pyc b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/__pycache__/npy_pkg_config.cpython-311.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..61348f02abf8866095f81540986191dd40316994
Binary files /dev/null and b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/__pycache__/npy_pkg_config.cpython-311.pyc differ
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/__pycache__/numpy_distribution.cpython-311.pyc b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/__pycache__/numpy_distribution.cpython-311.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..e39404360de2857440cb53d4d580de31c6a90d89
Binary files /dev/null and b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/__pycache__/numpy_distribution.cpython-311.pyc differ
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/__pycache__/pathccompiler.cpython-311.pyc b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/__pycache__/pathccompiler.cpython-311.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..46cfaf0418d6c8522654ded148152d8629a89183
Binary files /dev/null and b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/__pycache__/pathccompiler.cpython-311.pyc differ
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/__pycache__/setup.cpython-311.pyc b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/__pycache__/setup.cpython-311.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..d3475f6994c8628a8d99675c4444f653f73ac67e
Binary files /dev/null and b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/__pycache__/setup.cpython-311.pyc differ
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/__pycache__/unixccompiler.cpython-311.pyc b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/__pycache__/unixccompiler.cpython-311.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..e7a688d0ba204b66166ff046067eb3732fafe759
Binary files /dev/null and b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/__pycache__/unixccompiler.cpython-311.pyc differ
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/_shell_utils.py b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/_shell_utils.py
new file mode 100644
index 0000000000000000000000000000000000000000..82abd5f4e0fee8e3241a90d587026b1f97ec2bfe
--- /dev/null
+++ b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/_shell_utils.py
@@ -0,0 +1,91 @@
+"""
+Helper functions for interacting with the shell, and consuming shell-style
+parameters provided in config files.
+"""
+import os
+import shlex
+import subprocess
+try:
+ from shlex import quote
+except ImportError:
+ from pipes import quote
+
+__all__ = ['WindowsParser', 'PosixParser', 'NativeParser']
+
+
+class CommandLineParser:
+ """
+ An object that knows how to split and join command-line arguments.
+
+ It must be true that ``argv == split(join(argv))`` for all ``argv``.
+ The reverse neednt be true - `join(split(cmd))` may result in the addition
+ or removal of unnecessary escaping.
+ """
+ @staticmethod
+ def join(argv):
+ """ Join a list of arguments into a command line string """
+ raise NotImplementedError
+
+ @staticmethod
+ def split(cmd):
+ """ Split a command line string into a list of arguments """
+ raise NotImplementedError
+
+
+class WindowsParser:
+ """
+ The parsing behavior used by `subprocess.call("string")` on Windows, which
+ matches the Microsoft C/C++ runtime.
+
+ Note that this is _not_ the behavior of cmd.
+ """
+ @staticmethod
+ def join(argv):
+ # note that list2cmdline is specific to the windows syntax
+ return subprocess.list2cmdline(argv)
+
+ @staticmethod
+ def split(cmd):
+ import ctypes # guarded import for systems without ctypes
+ try:
+ ctypes.windll
+ except AttributeError:
+ raise NotImplementedError
+
+ # Windows has special parsing rules for the executable (no quotes),
+ # that we do not care about - insert a dummy element
+ if not cmd:
+ return []
+ cmd = 'dummy ' + cmd
+
+ CommandLineToArgvW = ctypes.windll.shell32.CommandLineToArgvW
+ CommandLineToArgvW.restype = ctypes.POINTER(ctypes.c_wchar_p)
+ CommandLineToArgvW.argtypes = (ctypes.c_wchar_p, ctypes.POINTER(ctypes.c_int))
+
+ nargs = ctypes.c_int()
+ lpargs = CommandLineToArgvW(cmd, ctypes.byref(nargs))
+ args = [lpargs[i] for i in range(nargs.value)]
+ assert not ctypes.windll.kernel32.LocalFree(lpargs)
+
+ # strip the element we inserted
+ assert args[0] == "dummy"
+ return args[1:]
+
+
+class PosixParser:
+ """
+ The parsing behavior used by `subprocess.call("string", shell=True)` on Posix.
+ """
+ @staticmethod
+ def join(argv):
+ return ' '.join(quote(arg) for arg in argv)
+
+ @staticmethod
+ def split(cmd):
+ return shlex.split(cmd, posix=True)
+
+
+if os.name == 'nt':
+ NativeParser = WindowsParser
+elif os.name == 'posix':
+ NativeParser = PosixParser
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/checks/cpu_asimd.c b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/checks/cpu_asimd.c
new file mode 100644
index 0000000000000000000000000000000000000000..6bc9022a58d3cd087d167d354224ded89be91884
--- /dev/null
+++ b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/checks/cpu_asimd.c
@@ -0,0 +1,27 @@
+#ifdef _MSC_VER
+ #include
+#endif
+#include
+
+int main(int argc, char **argv)
+{
+ float *src = (float*)argv[argc-1];
+ float32x4_t v1 = vdupq_n_f32(src[0]), v2 = vdupq_n_f32(src[1]);
+ /* MAXMIN */
+ int ret = (int)vgetq_lane_f32(vmaxnmq_f32(v1, v2), 0);
+ ret += (int)vgetq_lane_f32(vminnmq_f32(v1, v2), 0);
+ /* ROUNDING */
+ ret += (int)vgetq_lane_f32(vrndq_f32(v1), 0);
+#ifdef __aarch64__
+ {
+ double *src2 = (double*)argv[argc-1];
+ float64x2_t vd1 = vdupq_n_f64(src2[0]), vd2 = vdupq_n_f64(src2[1]);
+ /* MAXMIN */
+ ret += (int)vgetq_lane_f64(vmaxnmq_f64(vd1, vd2), 0);
+ ret += (int)vgetq_lane_f64(vminnmq_f64(vd1, vd2), 0);
+ /* ROUNDING */
+ ret += (int)vgetq_lane_f64(vrndq_f64(vd1), 0);
+ }
+#endif
+ return ret;
+}
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/checks/cpu_asimddp.c b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/checks/cpu_asimddp.c
new file mode 100644
index 0000000000000000000000000000000000000000..e7068ce02e19856349873f40d03caff438efb6fe
--- /dev/null
+++ b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/checks/cpu_asimddp.c
@@ -0,0 +1,16 @@
+#ifdef _MSC_VER
+ #include
+#endif
+#include
+
+int main(int argc, char **argv)
+{
+ unsigned char *src = (unsigned char*)argv[argc-1];
+ uint8x16_t v1 = vdupq_n_u8(src[0]), v2 = vdupq_n_u8(src[1]);
+ uint32x4_t va = vdupq_n_u32(3);
+ int ret = (int)vgetq_lane_u32(vdotq_u32(va, v1, v2), 0);
+#ifdef __aarch64__
+ ret += (int)vgetq_lane_u32(vdotq_laneq_u32(va, v1, v2, 0), 0);
+#endif
+ return ret;
+}
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/checks/cpu_asimdfhm.c b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/checks/cpu_asimdfhm.c
new file mode 100644
index 0000000000000000000000000000000000000000..54e328098d17b57445024c9859cd4992492c348a
--- /dev/null
+++ b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/checks/cpu_asimdfhm.c
@@ -0,0 +1,19 @@
+#ifdef _MSC_VER
+ #include
+#endif
+#include
+
+int main(int argc, char **argv)
+{
+ float16_t *src = (float16_t*)argv[argc-1];
+ float *src2 = (float*)argv[argc-2];
+ float16x8_t vhp = vdupq_n_f16(src[0]);
+ float16x4_t vlhp = vdup_n_f16(src[1]);
+ float32x4_t vf = vdupq_n_f32(src2[0]);
+ float32x2_t vlf = vdup_n_f32(src2[1]);
+
+ int ret = (int)vget_lane_f32(vfmlal_low_f16(vlf, vlhp, vlhp), 0);
+ ret += (int)vgetq_lane_f32(vfmlslq_high_f16(vf, vhp, vhp), 0);
+
+ return ret;
+}
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/checks/cpu_asimdhp.c b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/checks/cpu_asimdhp.c
new file mode 100644
index 0000000000000000000000000000000000000000..e2de0306e0acaeda3b861756e598a132f8e1ca9f
--- /dev/null
+++ b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/checks/cpu_asimdhp.c
@@ -0,0 +1,15 @@
+#ifdef _MSC_VER
+ #include
+#endif
+#include
+
+int main(int argc, char **argv)
+{
+ float16_t *src = (float16_t*)argv[argc-1];
+ float16x8_t vhp = vdupq_n_f16(src[0]);
+ float16x4_t vlhp = vdup_n_f16(src[1]);
+
+ int ret = (int)vgetq_lane_f16(vabdq_f16(vhp, vhp), 0);
+ ret += (int)vget_lane_f16(vabd_f16(vlhp, vlhp), 0);
+ return ret;
+}
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/checks/cpu_avx.c b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/checks/cpu_avx.c
new file mode 100644
index 0000000000000000000000000000000000000000..26ae18466740b230f9b964ebb4c72c54f13c73ee
--- /dev/null
+++ b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/checks/cpu_avx.c
@@ -0,0 +1,20 @@
+#if defined(DETECT_FEATURES) && defined(__INTEL_COMPILER)
+ /*
+ * Unlike GCC and CLANG, Intel Compiler exposes all supported intrinsics,
+ * whether or not the build options for those features are specified.
+ * Therefore, we must test #definitions of CPU features when option native/host
+ * is enabled via `--cpu-baseline` or through env var `CFLAGS` otherwise
+ * the test will be broken and leads to enable all possible features.
+ */
+ #ifndef __AVX__
+ #error "HOST/ARCH doesn't support AVX"
+ #endif
+#endif
+
+#include
+
+int main(int argc, char **argv)
+{
+ __m256 a = _mm256_add_ps(_mm256_loadu_ps((const float*)argv[argc-1]), _mm256_loadu_ps((const float*)argv[1]));
+ return (int)_mm_cvtss_f32(_mm256_castps256_ps128(a));
+}
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/checks/cpu_avx2.c b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/checks/cpu_avx2.c
new file mode 100644
index 0000000000000000000000000000000000000000..ddde868f1b586c7b066c2284556b65ec5fef834e
--- /dev/null
+++ b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/checks/cpu_avx2.c
@@ -0,0 +1,20 @@
+#if defined(DETECT_FEATURES) && defined(__INTEL_COMPILER)
+ /*
+ * Unlike GCC and CLANG, Intel Compiler exposes all supported intrinsics,
+ * whether or not the build options for those features are specified.
+ * Therefore, we must test #definitions of CPU features when option native/host
+ * is enabled via `--cpu-baseline` or through env var `CFLAGS` otherwise
+ * the test will be broken and leads to enable all possible features.
+ */
+ #ifndef __AVX2__
+ #error "HOST/ARCH doesn't support AVX2"
+ #endif
+#endif
+
+#include
+
+int main(int argc, char **argv)
+{
+ __m256i a = _mm256_abs_epi16(_mm256_loadu_si256((const __m256i*)argv[argc-1]));
+ return _mm_cvtsi128_si32(_mm256_castsi256_si128(a));
+}
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/checks/cpu_avx512_clx.c b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/checks/cpu_avx512_clx.c
new file mode 100644
index 0000000000000000000000000000000000000000..81edcd06700518269420f0cf6192e552581c17d8
--- /dev/null
+++ b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/checks/cpu_avx512_clx.c
@@ -0,0 +1,22 @@
+#if defined(DETECT_FEATURES) && defined(__INTEL_COMPILER)
+ /*
+ * Unlike GCC and CLANG, Intel Compiler exposes all supported intrinsics,
+ * whether or not the build options for those features are specified.
+ * Therefore, we must test #definitions of CPU features when option native/host
+ * is enabled via `--cpu-baseline` or through env var `CFLAGS` otherwise
+ * the test will be broken and leads to enable all possible features.
+ */
+ #ifndef __AVX512VNNI__
+ #error "HOST/ARCH doesn't support CascadeLake AVX512 features"
+ #endif
+#endif
+
+#include
+
+int main(int argc, char **argv)
+{
+ /* VNNI */
+ __m512i a = _mm512_loadu_si512((const __m512i*)argv[argc-1]);
+ a = _mm512_dpbusd_epi32(a, _mm512_setzero_si512(), a);
+ return _mm_cvtsi128_si32(_mm512_castsi512_si128(a));
+}
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/checks/cpu_avx512_cnl.c b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/checks/cpu_avx512_cnl.c
new file mode 100644
index 0000000000000000000000000000000000000000..5799f122b511420eb16d066c31dc218bc4fae110
--- /dev/null
+++ b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/checks/cpu_avx512_cnl.c
@@ -0,0 +1,24 @@
+#if defined(DETECT_FEATURES) && defined(__INTEL_COMPILER)
+ /*
+ * Unlike GCC and CLANG, Intel Compiler exposes all supported intrinsics,
+ * whether or not the build options for those features are specified.
+ * Therefore, we must test #definitions of CPU features when option native/host
+ * is enabled via `--cpu-baseline` or through env var `CFLAGS` otherwise
+ * the test will be broken and leads to enable all possible features.
+ */
+ #if !defined(__AVX512VBMI__) || !defined(__AVX512IFMA__)
+ #error "HOST/ARCH doesn't support CannonLake AVX512 features"
+ #endif
+#endif
+
+#include
+
+int main(int argc, char **argv)
+{
+ __m512i a = _mm512_loadu_si512((const __m512i*)argv[argc-1]);
+ /* IFMA */
+ a = _mm512_madd52hi_epu64(a, a, _mm512_setzero_si512());
+ /* VMBI */
+ a = _mm512_permutex2var_epi8(a, _mm512_setzero_si512(), a);
+ return _mm_cvtsi128_si32(_mm512_castsi512_si128(a));
+}
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/checks/cpu_avx512_icl.c b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/checks/cpu_avx512_icl.c
new file mode 100644
index 0000000000000000000000000000000000000000..3cf44d73164b6a80eca5f23f699bd00dba1f623e
--- /dev/null
+++ b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/checks/cpu_avx512_icl.c
@@ -0,0 +1,26 @@
+#if defined(DETECT_FEATURES) && defined(__INTEL_COMPILER)
+ /*
+ * Unlike GCC and CLANG, Intel Compiler exposes all supported intrinsics,
+ * whether or not the build options for those features are specified.
+ * Therefore, we must test #definitions of CPU features when option native/host
+ * is enabled via `--cpu-baseline` or through env var `CFLAGS` otherwise
+ * the test will be broken and leads to enable all possible features.
+ */
+ #if !defined(__AVX512VPOPCNTDQ__) || !defined(__AVX512BITALG__) || !defined(__AVX512VPOPCNTDQ__)
+ #error "HOST/ARCH doesn't support IceLake AVX512 features"
+ #endif
+#endif
+
+#include
+
+int main(int argc, char **argv)
+{
+ __m512i a = _mm512_loadu_si512((const __m512i*)argv[argc-1]);
+ /* VBMI2 */
+ a = _mm512_shrdv_epi64(a, a, _mm512_setzero_si512());
+ /* BITLAG */
+ a = _mm512_popcnt_epi8(a);
+ /* VPOPCNTDQ */
+ a = _mm512_popcnt_epi64(a);
+ return _mm_cvtsi128_si32(_mm512_castsi512_si128(a));
+}
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/checks/cpu_avx512_knl.c b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/checks/cpu_avx512_knl.c
new file mode 100644
index 0000000000000000000000000000000000000000..cb55e57aa220ebc8e1b638f7bfb470cff6725ea2
--- /dev/null
+++ b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/checks/cpu_avx512_knl.c
@@ -0,0 +1,25 @@
+#if defined(DETECT_FEATURES) && defined(__INTEL_COMPILER)
+ /*
+ * Unlike GCC and CLANG, Intel Compiler exposes all supported intrinsics,
+ * whether or not the build options for those features are specified.
+ * Therefore, we must test #definitions of CPU features when option native/host
+ * is enabled via `--cpu-baseline` or through env var `CFLAGS` otherwise
+ * the test will be broken and leads to enable all possible features.
+ */
+ #if !defined(__AVX512ER__) || !defined(__AVX512PF__)
+ #error "HOST/ARCH doesn't support Knights Landing AVX512 features"
+ #endif
+#endif
+
+#include
+
+int main(int argc, char **argv)
+{
+ int base[128]={};
+ __m512d ad = _mm512_loadu_pd((const __m512d*)argv[argc-1]);
+ /* ER */
+ __m512i a = _mm512_castpd_si512(_mm512_exp2a23_pd(ad));
+ /* PF */
+ _mm512_mask_prefetch_i64scatter_pd(base, _mm512_cmpeq_epi64_mask(a, a), a, 1, _MM_HINT_T1);
+ return base[0];
+}
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/checks/cpu_avx512_knm.c b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/checks/cpu_avx512_knm.c
new file mode 100644
index 0000000000000000000000000000000000000000..2c426462bd34e00f9a0b04e01fb124784c2afb7b
--- /dev/null
+++ b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/checks/cpu_avx512_knm.c
@@ -0,0 +1,30 @@
+#if defined(DETECT_FEATURES) && defined(__INTEL_COMPILER)
+ /*
+ * Unlike GCC and CLANG, Intel Compiler exposes all supported intrinsics,
+ * whether or not the build options for those features are specified.
+ * Therefore, we must test #definitions of CPU features when option native/host
+ * is enabled via `--cpu-baseline` or through env var `CFLAGS` otherwise
+ * the test will be broken and leads to enable all possible features.
+ */
+ #if !defined(__AVX5124FMAPS__) || !defined(__AVX5124VNNIW__) || !defined(__AVX512VPOPCNTDQ__)
+ #error "HOST/ARCH doesn't support Knights Mill AVX512 features"
+ #endif
+#endif
+
+#include
+
+int main(int argc, char **argv)
+{
+ __m512i a = _mm512_loadu_si512((const __m512i*)argv[argc-1]);
+ __m512 b = _mm512_loadu_ps((const __m512*)argv[argc-2]);
+
+ /* 4FMAPS */
+ b = _mm512_4fmadd_ps(b, b, b, b, b, NULL);
+ /* 4VNNIW */
+ a = _mm512_4dpwssd_epi32(a, a, a, a, a, NULL);
+ /* VPOPCNTDQ */
+ a = _mm512_popcnt_epi64(a);
+
+ a = _mm512_add_epi32(a, _mm512_castps_si512(b));
+ return _mm_cvtsi128_si32(_mm512_castsi512_si128(a));
+}
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/checks/cpu_avx512_skx.c b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/checks/cpu_avx512_skx.c
new file mode 100644
index 0000000000000000000000000000000000000000..8840efb7e5eefcb762b69bf8d40b79406f6798a5
--- /dev/null
+++ b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/checks/cpu_avx512_skx.c
@@ -0,0 +1,26 @@
+#if defined(DETECT_FEATURES) && defined(__INTEL_COMPILER)
+ /*
+ * Unlike GCC and CLANG, Intel Compiler exposes all supported intrinsics,
+ * whether or not the build options for those features are specified.
+ * Therefore, we must test #definitions of CPU features when option native/host
+ * is enabled via `--cpu-baseline` or through env var `CFLAGS` otherwise
+ * the test will be broken and leads to enable all possible features.
+ */
+ #if !defined(__AVX512VL__) || !defined(__AVX512BW__) || !defined(__AVX512DQ__)
+ #error "HOST/ARCH doesn't support SkyLake AVX512 features"
+ #endif
+#endif
+
+#include
+
+int main(int argc, char **argv)
+{
+ __m512i aa = _mm512_abs_epi32(_mm512_loadu_si512((const __m512i*)argv[argc-1]));
+ /* VL */
+ __m256i a = _mm256_abs_epi64(_mm512_extracti64x4_epi64(aa, 1));
+ /* DQ */
+ __m512i b = _mm512_broadcast_i32x8(a);
+ /* BW */
+ b = _mm512_abs_epi16(b);
+ return _mm_cvtsi128_si32(_mm512_castsi512_si128(b));
+}
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/checks/cpu_avx512_spr.c b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/checks/cpu_avx512_spr.c
new file mode 100644
index 0000000000000000000000000000000000000000..9710d0b2fe2f2ac1fc9e19c1c9b4688807efd6d7
--- /dev/null
+++ b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/checks/cpu_avx512_spr.c
@@ -0,0 +1,26 @@
+#if defined(DETECT_FEATURES) && defined(__INTEL_COMPILER)
+ /*
+ * Unlike GCC and CLANG, Intel Compiler exposes all supported intrinsics,
+ * whether or not the build options for those features are specified.
+ * Therefore, we must test #definitions of CPU features when option native/host
+ * is enabled via `--cpu-baseline` or through env var `CFLAGS` otherwise
+ * the test will be broken and leads to enable all possible features.
+ */
+ #if !defined(__AVX512FP16__)
+ #error "HOST/ARCH doesn't support Sapphire Rapids AVX512FP16 features"
+ #endif
+#endif
+
+#include
+
+int main(int argc, char **argv)
+{
+/* clang has a bug regarding our spr coode, see gh-23730. */
+#if __clang__
+#error
+#endif
+ __m512h a = _mm512_loadu_ph((void*)argv[argc-1]);
+ __m512h temp = _mm512_fmadd_ph(a, a, a);
+ _mm512_storeu_ph((void*)(argv[argc-1]), temp);
+ return 0;
+}
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/checks/cpu_avx512cd.c b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/checks/cpu_avx512cd.c
new file mode 100644
index 0000000000000000000000000000000000000000..5e29c79e34a73bdfbbcc2571333bfdd28007e07f
--- /dev/null
+++ b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/checks/cpu_avx512cd.c
@@ -0,0 +1,20 @@
+#if defined(DETECT_FEATURES) && defined(__INTEL_COMPILER)
+ /*
+ * Unlike GCC and CLANG, Intel Compiler exposes all supported intrinsics,
+ * whether or not the build options for those features are specified.
+ * Therefore, we must test #definitions of CPU features when option native/host
+ * is enabled via `--cpu-baseline` or through env var `CFLAGS` otherwise
+ * the test will be broken and leads to enable all possible features.
+ */
+ #ifndef __AVX512CD__
+ #error "HOST/ARCH doesn't support AVX512CD"
+ #endif
+#endif
+
+#include
+
+int main(int argc, char **argv)
+{
+ __m512i a = _mm512_lzcnt_epi32(_mm512_loadu_si512((const __m512i*)argv[argc-1]));
+ return _mm_cvtsi128_si32(_mm512_castsi512_si128(a));
+}
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/checks/cpu_avx512f.c b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/checks/cpu_avx512f.c
new file mode 100644
index 0000000000000000000000000000000000000000..d0eb7b1ad5c63995a995c8fe80f59fd8131538d1
--- /dev/null
+++ b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/checks/cpu_avx512f.c
@@ -0,0 +1,20 @@
+#if defined(DETECT_FEATURES) && defined(__INTEL_COMPILER)
+ /*
+ * Unlike GCC and CLANG, Intel Compiler exposes all supported intrinsics,
+ * whether or not the build options for those features are specified.
+ * Therefore, we must test #definitions of CPU features when option native/host
+ * is enabled via `--cpu-baseline` or through env var `CFLAGS` otherwise
+ * the test will be broken and leads to enable all possible features.
+ */
+ #ifndef __AVX512F__
+ #error "HOST/ARCH doesn't support AVX512F"
+ #endif
+#endif
+
+#include
+
+int main(int argc, char **argv)
+{
+ __m512i a = _mm512_abs_epi32(_mm512_loadu_si512((const __m512i*)argv[argc-1]));
+ return _mm_cvtsi128_si32(_mm512_castsi512_si128(a));
+}
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/checks/cpu_f16c.c b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/checks/cpu_f16c.c
new file mode 100644
index 0000000000000000000000000000000000000000..fdf36cec580ce9c24fbb9d2a60fdfcaa824b3f11
--- /dev/null
+++ b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/checks/cpu_f16c.c
@@ -0,0 +1,22 @@
+#if defined(DETECT_FEATURES) && defined(__INTEL_COMPILER)
+ /*
+ * Unlike GCC and CLANG, Intel Compiler exposes all supported intrinsics,
+ * whether or not the build options for those features are specified.
+ * Therefore, we must test #definitions of CPU features when option native/host
+ * is enabled via `--cpu-baseline` or through env var `CFLAGS` otherwise
+ * the test will be broken and leads to enable all possible features.
+ */
+ #ifndef __F16C__
+ #error "HOST/ARCH doesn't support F16C"
+ #endif
+#endif
+
+#include
+#include
+
+int main(int argc, char **argv)
+{
+ __m128 a = _mm_cvtph_ps(_mm_loadu_si128((const __m128i*)argv[argc-1]));
+ __m256 a8 = _mm256_cvtph_ps(_mm_loadu_si128((const __m128i*)argv[argc-2]));
+ return (int)(_mm_cvtss_f32(a) + _mm_cvtss_f32(_mm256_castps256_ps128(a8)));
+}
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/checks/cpu_fma3.c b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/checks/cpu_fma3.c
new file mode 100644
index 0000000000000000000000000000000000000000..bfeef22b5f0e86becd6b9f7a8b5b0f4bdea73202
--- /dev/null
+++ b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/checks/cpu_fma3.c
@@ -0,0 +1,22 @@
+#if defined(DETECT_FEATURES) && defined(__INTEL_COMPILER)
+ /*
+ * Unlike GCC and CLANG, Intel Compiler exposes all supported intrinsics,
+ * whether or not the build options for those features are specified.
+ * Therefore, we must test #definitions of CPU features when option native/host
+ * is enabled via `--cpu-baseline` or through env var `CFLAGS` otherwise
+ * the test will be broken and leads to enable all possible features.
+ */
+ #if !defined(__FMA__) && !defined(__AVX2__)
+ #error "HOST/ARCH doesn't support FMA3"
+ #endif
+#endif
+
+#include
+#include
+
+int main(int argc, char **argv)
+{
+ __m256 a = _mm256_loadu_ps((const float*)argv[argc-1]);
+ a = _mm256_fmadd_ps(a, a, a);
+ return (int)_mm_cvtss_f32(_mm256_castps256_ps128(a));
+}
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/checks/cpu_fma4.c b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/checks/cpu_fma4.c
new file mode 100644
index 0000000000000000000000000000000000000000..0ff17a483385bec07f9aef023b16fc331e66fb6f
--- /dev/null
+++ b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/checks/cpu_fma4.c
@@ -0,0 +1,13 @@
+#include
+#ifdef _MSC_VER
+ #include
+#else
+ #include
+#endif
+
+int main(int argc, char **argv)
+{
+ __m256 a = _mm256_loadu_ps((const float*)argv[argc-1]);
+ a = _mm256_macc_ps(a, a, a);
+ return (int)_mm_cvtss_f32(_mm256_castps256_ps128(a));
+}
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/checks/cpu_neon.c b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/checks/cpu_neon.c
new file mode 100644
index 0000000000000000000000000000000000000000..8c64f864dea63cb9c4ee60249e52b1ad528751c7
--- /dev/null
+++ b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/checks/cpu_neon.c
@@ -0,0 +1,19 @@
+#ifdef _MSC_VER
+ #include
+#endif
+#include
+
+int main(int argc, char **argv)
+{
+ // passing from untraced pointers to avoid optimizing out any constants
+ // so we can test against the linker.
+ float *src = (float*)argv[argc-1];
+ float32x4_t v1 = vdupq_n_f32(src[0]), v2 = vdupq_n_f32(src[1]);
+ int ret = (int)vgetq_lane_f32(vmulq_f32(v1, v2), 0);
+#ifdef __aarch64__
+ double *src2 = (double*)argv[argc-2];
+ float64x2_t vd1 = vdupq_n_f64(src2[0]), vd2 = vdupq_n_f64(src2[1]);
+ ret += (int)vgetq_lane_f64(vmulq_f64(vd1, vd2), 0);
+#endif
+ return ret;
+}
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/checks/cpu_neon_fp16.c b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/checks/cpu_neon_fp16.c
new file mode 100644
index 0000000000000000000000000000000000000000..f3b949770db66a03a6221a230e75e87f67359759
--- /dev/null
+++ b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/checks/cpu_neon_fp16.c
@@ -0,0 +1,11 @@
+#ifdef _MSC_VER
+ #include
+#endif
+#include
+
+int main(int argc, char **argv)
+{
+ short *src = (short*)argv[argc-1];
+ float32x4_t v_z4 = vcvt_f32_f16((float16x4_t)vld1_s16(src));
+ return (int)vgetq_lane_f32(v_z4, 0);
+}
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/checks/cpu_neon_vfpv4.c b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/checks/cpu_neon_vfpv4.c
new file mode 100644
index 0000000000000000000000000000000000000000..a039159ddeed006d62f07250a3a1dbb5abfcb6ac
--- /dev/null
+++ b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/checks/cpu_neon_vfpv4.c
@@ -0,0 +1,21 @@
+#ifdef _MSC_VER
+ #include
+#endif
+#include
+
+int main(int argc, char **argv)
+{
+ float *src = (float*)argv[argc-1];
+ float32x4_t v1 = vdupq_n_f32(src[0]);
+ float32x4_t v2 = vdupq_n_f32(src[1]);
+ float32x4_t v3 = vdupq_n_f32(src[2]);
+ int ret = (int)vgetq_lane_f32(vfmaq_f32(v1, v2, v3), 0);
+#ifdef __aarch64__
+ double *src2 = (double*)argv[argc-2];
+ float64x2_t vd1 = vdupq_n_f64(src2[0]);
+ float64x2_t vd2 = vdupq_n_f64(src2[1]);
+ float64x2_t vd3 = vdupq_n_f64(src2[2]);
+ ret += (int)vgetq_lane_f64(vfmaq_f64(vd1, vd2, vd3), 0);
+#endif
+ return ret;
+}
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/checks/cpu_popcnt.c b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/checks/cpu_popcnt.c
new file mode 100644
index 0000000000000000000000000000000000000000..813c461f05b36b52c855f31d621a23ab7ee0c642
--- /dev/null
+++ b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/checks/cpu_popcnt.c
@@ -0,0 +1,32 @@
+#if defined(DETECT_FEATURES) && defined(__INTEL_COMPILER)
+ /*
+ * Unlike GCC and CLANG, Intel Compiler exposes all supported intrinsics,
+ * whether or not the build options for those features are specified.
+ * Therefore, we must test #definitions of CPU features when option native/host
+ * is enabled via `--cpu-baseline` or through env vr `CFLAGS` otherwise
+ * the test will be broken and leads to enable all possible features.
+ */
+ #if !defined(__SSE4_2__) && !defined(__POPCNT__)
+ #error "HOST/ARCH doesn't support POPCNT"
+ #endif
+#endif
+
+#ifdef _MSC_VER
+ #include
+#else
+ #include
+#endif
+
+int main(int argc, char **argv)
+{
+ // To make sure popcnt instructions are generated
+ // and been tested against the assembler
+ unsigned long long a = *((unsigned long long*)argv[argc-1]);
+ unsigned int b = *((unsigned int*)argv[argc-2]);
+
+#if defined(_M_X64) || defined(__x86_64__)
+ a = _mm_popcnt_u64(a);
+#endif
+ b = _mm_popcnt_u32(b);
+ return (int)a + b;
+}
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/checks/cpu_sse.c b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/checks/cpu_sse.c
new file mode 100644
index 0000000000000000000000000000000000000000..602b74e7bc437ee4fdfbc375280f423700caa49e
--- /dev/null
+++ b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/checks/cpu_sse.c
@@ -0,0 +1,20 @@
+#if defined(DETECT_FEATURES) && defined(__INTEL_COMPILER)
+ /*
+ * Unlike GCC and CLANG, Intel Compiler exposes all supported intrinsics,
+ * whether or not the build options for those features are specified.
+ * Therefore, we must test #definitions of CPU features when option native/host
+ * is enabled via `--cpu-baseline` or through env var `CFLAGS` otherwise
+ * the test will be broken and leads to enable all possible features.
+ */
+ #ifndef __SSE__
+ #error "HOST/ARCH doesn't support SSE"
+ #endif
+#endif
+
+#include
+
+int main(void)
+{
+ __m128 a = _mm_add_ps(_mm_setzero_ps(), _mm_setzero_ps());
+ return (int)_mm_cvtss_f32(a);
+}
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/checks/cpu_ssse3.c b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/checks/cpu_ssse3.c
new file mode 100644
index 0000000000000000000000000000000000000000..fde390d6a37d3e2c929b7a6841efa42e618742e5
--- /dev/null
+++ b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/checks/cpu_ssse3.c
@@ -0,0 +1,20 @@
+#if defined(DETECT_FEATURES) && defined(__INTEL_COMPILER)
+ /*
+ * Unlike GCC and CLANG, Intel Compiler exposes all supported intrinsics,
+ * whether or not the build options for those features are specified.
+ * Therefore, we must test #definitions of CPU features when option native/host
+ * is enabled via `--cpu-baseline` or through env var `CFLAGS` otherwise
+ * the test will be broken and leads to enable all possible features.
+ */
+ #ifndef __SSSE3__
+ #error "HOST/ARCH doesn't support SSSE3"
+ #endif
+#endif
+
+#include
+
+int main(void)
+{
+ __m128i a = _mm_hadd_epi16(_mm_setzero_si128(), _mm_setzero_si128());
+ return (int)_mm_cvtsi128_si32(a);
+}
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/mingw32ccompiler.py b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/mingw32ccompiler.py
new file mode 100644
index 0000000000000000000000000000000000000000..4763f41ad326d464355fd82ceccb019e1e55edf0
--- /dev/null
+++ b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/mingw32ccompiler.py
@@ -0,0 +1,591 @@
+"""
+Support code for building Python extensions on Windows.
+
+ # NT stuff
+ # 1. Make sure libpython.a exists for gcc. If not, build it.
+ # 2. Force windows to use gcc (we're struggling with MSVC and g77 support)
+ # 3. Force windows to use g77
+
+"""
+import os
+import sys
+import subprocess
+import re
+import textwrap
+
+# Overwrite certain distutils.ccompiler functions:
+import numpy.distutils.ccompiler # noqa: F401
+from numpy.distutils import log
+# NT stuff
+# 1. Make sure libpython.a exists for gcc. If not, build it.
+# 2. Force windows to use gcc (we're struggling with MSVC and g77 support)
+# --> this is done in numpy/distutils/ccompiler.py
+# 3. Force windows to use g77
+
+import distutils.cygwinccompiler
+from distutils.unixccompiler import UnixCCompiler
+from distutils.msvccompiler import get_build_version as get_build_msvc_version
+from distutils.errors import UnknownFileError
+from numpy.distutils.misc_util import (msvc_runtime_library,
+ msvc_runtime_version,
+ msvc_runtime_major,
+ get_build_architecture)
+
+def get_msvcr_replacement():
+ """Replacement for outdated version of get_msvcr from cygwinccompiler"""
+ msvcr = msvc_runtime_library()
+ return [] if msvcr is None else [msvcr]
+
+
+# Useful to generate table of symbols from a dll
+_START = re.compile(r'\[Ordinal/Name Pointer\] Table')
+_TABLE = re.compile(r'^\s+\[([\s*[0-9]*)\] ([a-zA-Z0-9_]*)')
+
+# the same as cygwin plus some additional parameters
+class Mingw32CCompiler(distutils.cygwinccompiler.CygwinCCompiler):
+ """ A modified MingW32 compiler compatible with an MSVC built Python.
+
+ """
+
+ compiler_type = 'mingw32'
+
+ def __init__ (self,
+ verbose=0,
+ dry_run=0,
+ force=0):
+
+ distutils.cygwinccompiler.CygwinCCompiler.__init__ (self, verbose,
+ dry_run, force)
+
+ # **changes: eric jones 4/11/01
+ # 1. Check for import library on Windows. Build if it doesn't exist.
+
+ build_import_library()
+
+ # Check for custom msvc runtime library on Windows. Build if it doesn't exist.
+ msvcr_success = build_msvcr_library()
+ msvcr_dbg_success = build_msvcr_library(debug=True)
+ if msvcr_success or msvcr_dbg_success:
+ # add preprocessor statement for using customized msvcr lib
+ self.define_macro('NPY_MINGW_USE_CUSTOM_MSVCR')
+
+ # Define the MSVC version as hint for MinGW
+ msvcr_version = msvc_runtime_version()
+ if msvcr_version:
+ self.define_macro('__MSVCRT_VERSION__', '0x%04i' % msvcr_version)
+
+ # MS_WIN64 should be defined when building for amd64 on windows,
+ # but python headers define it only for MS compilers, which has all
+ # kind of bad consequences, like using Py_ModuleInit4 instead of
+ # Py_ModuleInit4_64, etc... So we add it here
+ if get_build_architecture() == 'AMD64':
+ self.set_executables(
+ compiler='gcc -g -DDEBUG -DMS_WIN64 -O0 -Wall',
+ compiler_so='gcc -g -DDEBUG -DMS_WIN64 -O0 -Wall '
+ '-Wstrict-prototypes',
+ linker_exe='gcc -g',
+ linker_so='gcc -g -shared')
+ else:
+ self.set_executables(
+ compiler='gcc -O2 -Wall',
+ compiler_so='gcc -O2 -Wall -Wstrict-prototypes',
+ linker_exe='g++ ',
+ linker_so='g++ -shared')
+ # added for python2.3 support
+ # we can't pass it through set_executables because pre 2.2 would fail
+ self.compiler_cxx = ['g++']
+
+ # Maybe we should also append -mthreads, but then the finished dlls
+ # need another dll (mingwm10.dll see Mingw32 docs) (-mthreads: Support
+ # thread-safe exception handling on `Mingw32')
+
+ # no additional libraries needed
+ #self.dll_libraries=[]
+ return
+
+ # __init__ ()
+
+ def link(self,
+ target_desc,
+ objects,
+ output_filename,
+ output_dir,
+ libraries,
+ library_dirs,
+ runtime_library_dirs,
+ export_symbols = None,
+ debug=0,
+ extra_preargs=None,
+ extra_postargs=None,
+ build_temp=None,
+ target_lang=None):
+ # Include the appropriate MSVC runtime library if Python was built
+ # with MSVC >= 7.0 (MinGW standard is msvcrt)
+ runtime_library = msvc_runtime_library()
+ if runtime_library:
+ if not libraries:
+ libraries = []
+ libraries.append(runtime_library)
+ args = (self,
+ target_desc,
+ objects,
+ output_filename,
+ output_dir,
+ libraries,
+ library_dirs,
+ runtime_library_dirs,
+ None, #export_symbols, we do this in our def-file
+ debug,
+ extra_preargs,
+ extra_postargs,
+ build_temp,
+ target_lang)
+ func = UnixCCompiler.link
+ func(*args[:func.__code__.co_argcount])
+ return
+
+ def object_filenames (self,
+ source_filenames,
+ strip_dir=0,
+ output_dir=''):
+ if output_dir is None: output_dir = ''
+ obj_names = []
+ for src_name in source_filenames:
+ # use normcase to make sure '.rc' is really '.rc' and not '.RC'
+ (base, ext) = os.path.splitext (os.path.normcase(src_name))
+
+ # added these lines to strip off windows drive letters
+ # without it, .o files are placed next to .c files
+ # instead of the build directory
+ drv, base = os.path.splitdrive(base)
+ if drv:
+ base = base[1:]
+
+ if ext not in (self.src_extensions + ['.rc', '.res']):
+ raise UnknownFileError(
+ "unknown file type '%s' (from '%s')" % \
+ (ext, src_name))
+ if strip_dir:
+ base = os.path.basename (base)
+ if ext == '.res' or ext == '.rc':
+ # these need to be compiled to object files
+ obj_names.append (os.path.join (output_dir,
+ base + ext + self.obj_extension))
+ else:
+ obj_names.append (os.path.join (output_dir,
+ base + self.obj_extension))
+ return obj_names
+
+ # object_filenames ()
+
+
+def find_python_dll():
+ # We can't do much here:
+ # - find it in the virtualenv (sys.prefix)
+ # - find it in python main dir (sys.base_prefix, if in a virtualenv)
+ # - in system32,
+ # - ortherwise (Sxs), I don't know how to get it.
+ stems = [sys.prefix]
+ if sys.base_prefix != sys.prefix:
+ stems.append(sys.base_prefix)
+
+ sub_dirs = ['', 'lib', 'bin']
+ # generate possible combinations of directory trees and sub-directories
+ lib_dirs = []
+ for stem in stems:
+ for folder in sub_dirs:
+ lib_dirs.append(os.path.join(stem, folder))
+
+ # add system directory as well
+ if 'SYSTEMROOT' in os.environ:
+ lib_dirs.append(os.path.join(os.environ['SYSTEMROOT'], 'System32'))
+
+ # search in the file system for possible candidates
+ major_version, minor_version = tuple(sys.version_info[:2])
+ implementation = sys.implementation.name
+ if implementation == 'cpython':
+ dllname = f'python{major_version}{minor_version}.dll'
+ elif implementation == 'pypy':
+ dllname = f'libpypy{major_version}.{minor_version}-c.dll'
+ else:
+ dllname = f'Unknown platform {implementation}'
+ print("Looking for %s" % dllname)
+ for folder in lib_dirs:
+ dll = os.path.join(folder, dllname)
+ if os.path.exists(dll):
+ return dll
+
+ raise ValueError("%s not found in %s" % (dllname, lib_dirs))
+
+def dump_table(dll):
+ st = subprocess.check_output(["objdump.exe", "-p", dll])
+ return st.split(b'\n')
+
+def generate_def(dll, dfile):
+ """Given a dll file location, get all its exported symbols and dump them
+ into the given def file.
+
+ The .def file will be overwritten"""
+ dump = dump_table(dll)
+ for i in range(len(dump)):
+ if _START.match(dump[i].decode()):
+ break
+ else:
+ raise ValueError("Symbol table not found")
+
+ syms = []
+ for j in range(i+1, len(dump)):
+ m = _TABLE.match(dump[j].decode())
+ if m:
+ syms.append((int(m.group(1).strip()), m.group(2)))
+ else:
+ break
+
+ if len(syms) == 0:
+ log.warn('No symbols found in %s' % dll)
+
+ with open(dfile, 'w') as d:
+ d.write('LIBRARY %s\n' % os.path.basename(dll))
+ d.write(';CODE PRELOAD MOVEABLE DISCARDABLE\n')
+ d.write(';DATA PRELOAD SINGLE\n')
+ d.write('\nEXPORTS\n')
+ for s in syms:
+ #d.write('@%d %s\n' % (s[0], s[1]))
+ d.write('%s\n' % s[1])
+
+def find_dll(dll_name):
+
+ arch = {'AMD64' : 'amd64',
+ 'Intel' : 'x86'}[get_build_architecture()]
+
+ def _find_dll_in_winsxs(dll_name):
+ # Walk through the WinSxS directory to find the dll.
+ winsxs_path = os.path.join(os.environ.get('WINDIR', r'C:\WINDOWS'),
+ 'winsxs')
+ if not os.path.exists(winsxs_path):
+ return None
+ for root, dirs, files in os.walk(winsxs_path):
+ if dll_name in files and arch in root:
+ return os.path.join(root, dll_name)
+ return None
+
+ def _find_dll_in_path(dll_name):
+ # First, look in the Python directory, then scan PATH for
+ # the given dll name.
+ for path in [sys.prefix] + os.environ['PATH'].split(';'):
+ filepath = os.path.join(path, dll_name)
+ if os.path.exists(filepath):
+ return os.path.abspath(filepath)
+
+ return _find_dll_in_winsxs(dll_name) or _find_dll_in_path(dll_name)
+
+def build_msvcr_library(debug=False):
+ if os.name != 'nt':
+ return False
+
+ # If the version number is None, then we couldn't find the MSVC runtime at
+ # all, because we are running on a Python distribution which is customed
+ # compiled; trust that the compiler is the same as the one available to us
+ # now, and that it is capable of linking with the correct runtime without
+ # any extra options.
+ msvcr_ver = msvc_runtime_major()
+ if msvcr_ver is None:
+ log.debug('Skip building import library: '
+ 'Runtime is not compiled with MSVC')
+ return False
+
+ # Skip using a custom library for versions < MSVC 8.0
+ if msvcr_ver < 80:
+ log.debug('Skip building msvcr library:'
+ ' custom functionality not present')
+ return False
+
+ msvcr_name = msvc_runtime_library()
+ if debug:
+ msvcr_name += 'd'
+
+ # Skip if custom library already exists
+ out_name = "lib%s.a" % msvcr_name
+ out_file = os.path.join(sys.prefix, 'libs', out_name)
+ if os.path.isfile(out_file):
+ log.debug('Skip building msvcr library: "%s" exists' %
+ (out_file,))
+ return True
+
+ # Find the msvcr dll
+ msvcr_dll_name = msvcr_name + '.dll'
+ dll_file = find_dll(msvcr_dll_name)
+ if not dll_file:
+ log.warn('Cannot build msvcr library: "%s" not found' %
+ msvcr_dll_name)
+ return False
+
+ def_name = "lib%s.def" % msvcr_name
+ def_file = os.path.join(sys.prefix, 'libs', def_name)
+
+ log.info('Building msvcr library: "%s" (from %s)' \
+ % (out_file, dll_file))
+
+ # Generate a symbol definition file from the msvcr dll
+ generate_def(dll_file, def_file)
+
+ # Create a custom mingw library for the given symbol definitions
+ cmd = ['dlltool', '-d', def_file, '-l', out_file]
+ retcode = subprocess.call(cmd)
+
+ # Clean up symbol definitions
+ os.remove(def_file)
+
+ return (not retcode)
+
+def build_import_library():
+ if os.name != 'nt':
+ return
+
+ arch = get_build_architecture()
+ if arch == 'AMD64':
+ return _build_import_library_amd64()
+ elif arch == 'Intel':
+ return _build_import_library_x86()
+ else:
+ raise ValueError("Unhandled arch %s" % arch)
+
+def _check_for_import_lib():
+ """Check if an import library for the Python runtime already exists."""
+ major_version, minor_version = tuple(sys.version_info[:2])
+
+ # patterns for the file name of the library itself
+ patterns = ['libpython%d%d.a',
+ 'libpython%d%d.dll.a',
+ 'libpython%d.%d.dll.a']
+
+ # directory trees that may contain the library
+ stems = [sys.prefix]
+ if hasattr(sys, 'base_prefix') and sys.base_prefix != sys.prefix:
+ stems.append(sys.base_prefix)
+ elif hasattr(sys, 'real_prefix') and sys.real_prefix != sys.prefix:
+ stems.append(sys.real_prefix)
+
+ # possible subdirectories within those trees where it is placed
+ sub_dirs = ['libs', 'lib']
+
+ # generate a list of candidate locations
+ candidates = []
+ for pat in patterns:
+ filename = pat % (major_version, minor_version)
+ for stem_dir in stems:
+ for folder in sub_dirs:
+ candidates.append(os.path.join(stem_dir, folder, filename))
+
+ # test the filesystem to see if we can find any of these
+ for fullname in candidates:
+ if os.path.isfile(fullname):
+ # already exists, in location given
+ return (True, fullname)
+
+ # needs to be built, preferred location given first
+ return (False, candidates[0])
+
+def _build_import_library_amd64():
+ out_exists, out_file = _check_for_import_lib()
+ if out_exists:
+ log.debug('Skip building import library: "%s" exists', out_file)
+ return
+
+ # get the runtime dll for which we are building import library
+ dll_file = find_python_dll()
+ log.info('Building import library (arch=AMD64): "%s" (from %s)' %
+ (out_file, dll_file))
+
+ # generate symbol list from this library
+ def_name = "python%d%d.def" % tuple(sys.version_info[:2])
+ def_file = os.path.join(sys.prefix, 'libs', def_name)
+ generate_def(dll_file, def_file)
+
+ # generate import library from this symbol list
+ cmd = ['dlltool', '-d', def_file, '-l', out_file]
+ subprocess.check_call(cmd)
+
+def _build_import_library_x86():
+ """ Build the import libraries for Mingw32-gcc on Windows
+ """
+ out_exists, out_file = _check_for_import_lib()
+ if out_exists:
+ log.debug('Skip building import library: "%s" exists', out_file)
+ return
+
+ lib_name = "python%d%d.lib" % tuple(sys.version_info[:2])
+ lib_file = os.path.join(sys.prefix, 'libs', lib_name)
+ if not os.path.isfile(lib_file):
+ # didn't find library file in virtualenv, try base distribution, too,
+ # and use that instead if found there. for Python 2.7 venvs, the base
+ # directory is in attribute real_prefix instead of base_prefix.
+ if hasattr(sys, 'base_prefix'):
+ base_lib = os.path.join(sys.base_prefix, 'libs', lib_name)
+ elif hasattr(sys, 'real_prefix'):
+ base_lib = os.path.join(sys.real_prefix, 'libs', lib_name)
+ else:
+ base_lib = '' # os.path.isfile('') == False
+
+ if os.path.isfile(base_lib):
+ lib_file = base_lib
+ else:
+ log.warn('Cannot build import library: "%s" not found', lib_file)
+ return
+ log.info('Building import library (ARCH=x86): "%s"', out_file)
+
+ from numpy.distutils import lib2def
+
+ def_name = "python%d%d.def" % tuple(sys.version_info[:2])
+ def_file = os.path.join(sys.prefix, 'libs', def_name)
+ nm_output = lib2def.getnm(
+ lib2def.DEFAULT_NM + [lib_file], shell=False)
+ dlist, flist = lib2def.parse_nm(nm_output)
+ with open(def_file, 'w') as fid:
+ lib2def.output_def(dlist, flist, lib2def.DEF_HEADER, fid)
+
+ dll_name = find_python_dll ()
+
+ cmd = ["dlltool",
+ "--dllname", dll_name,
+ "--def", def_file,
+ "--output-lib", out_file]
+ status = subprocess.check_output(cmd)
+ if status:
+ log.warn('Failed to build import library for gcc. Linking will fail.')
+ return
+
+#=====================================
+# Dealing with Visual Studio MANIFESTS
+#=====================================
+
+# Functions to deal with visual studio manifests. Manifest are a mechanism to
+# enforce strong DLL versioning on windows, and has nothing to do with
+# distutils MANIFEST. manifests are XML files with version info, and used by
+# the OS loader; they are necessary when linking against a DLL not in the
+# system path; in particular, official python 2.6 binary is built against the
+# MS runtime 9 (the one from VS 2008), which is not available on most windows
+# systems; python 2.6 installer does install it in the Win SxS (Side by side)
+# directory, but this requires the manifest for this to work. This is a big
+# mess, thanks MS for a wonderful system.
+
+# XXX: ideally, we should use exactly the same version as used by python. I
+# submitted a patch to get this version, but it was only included for python
+# 2.6.1 and above. So for versions below, we use a "best guess".
+_MSVCRVER_TO_FULLVER = {}
+if sys.platform == 'win32':
+ try:
+ import msvcrt
+ # I took one version in my SxS directory: no idea if it is the good
+ # one, and we can't retrieve it from python
+ _MSVCRVER_TO_FULLVER['80'] = "8.0.50727.42"
+ _MSVCRVER_TO_FULLVER['90'] = "9.0.21022.8"
+ # Value from msvcrt.CRT_ASSEMBLY_VERSION under Python 3.3.0
+ # on Windows XP:
+ _MSVCRVER_TO_FULLVER['100'] = "10.0.30319.460"
+ crt_ver = getattr(msvcrt, 'CRT_ASSEMBLY_VERSION', None)
+ if crt_ver is not None: # Available at least back to Python 3.3
+ maj, min = re.match(r'(\d+)\.(\d)', crt_ver).groups()
+ _MSVCRVER_TO_FULLVER[maj + min] = crt_ver
+ del maj, min
+ del crt_ver
+ except ImportError:
+ # If we are here, means python was not built with MSVC. Not sure what
+ # to do in that case: manifest building will fail, but it should not be
+ # used in that case anyway
+ log.warn('Cannot import msvcrt: using manifest will not be possible')
+
+def msvc_manifest_xml(maj, min):
+ """Given a major and minor version of the MSVCR, returns the
+ corresponding XML file."""
+ try:
+ fullver = _MSVCRVER_TO_FULLVER[str(maj * 10 + min)]
+ except KeyError:
+ raise ValueError("Version %d,%d of MSVCRT not supported yet" %
+ (maj, min)) from None
+ # Don't be fooled, it looks like an XML, but it is not. In particular, it
+ # should not have any space before starting, and its size should be
+ # divisible by 4, most likely for alignment constraints when the xml is
+ # embedded in the binary...
+ # This template was copied directly from the python 2.6 binary (using
+ # strings.exe from mingw on python.exe).
+ template = textwrap.dedent("""\
+
+
+
+
+
+
+
+
+
+
+
+
+
+ """)
+
+ return template % {'fullver': fullver, 'maj': maj, 'min': min}
+
+def manifest_rc(name, type='dll'):
+ """Return the rc file used to generate the res file which will be embedded
+ as manifest for given manifest file name, of given type ('dll' or
+ 'exe').
+
+ Parameters
+ ----------
+ name : str
+ name of the manifest file to embed
+ type : str {'dll', 'exe'}
+ type of the binary which will embed the manifest
+
+ """
+ if type == 'dll':
+ rctype = 2
+ elif type == 'exe':
+ rctype = 1
+ else:
+ raise ValueError("Type %s not supported" % type)
+
+ return """\
+#include "winuser.h"
+%d RT_MANIFEST %s""" % (rctype, name)
+
+def check_embedded_msvcr_match_linked(msver):
+ """msver is the ms runtime version used for the MANIFEST."""
+ # check msvcr major version are the same for linking and
+ # embedding
+ maj = msvc_runtime_major()
+ if maj:
+ if not maj == int(msver):
+ raise ValueError(
+ "Discrepancy between linked msvcr " \
+ "(%d) and the one about to be embedded " \
+ "(%d)" % (int(msver), maj))
+
+def configtest_name(config):
+ base = os.path.basename(config._gen_temp_sourcefile("yo", [], "c"))
+ return os.path.splitext(base)[0]
+
+def manifest_name(config):
+ # Get configest name (including suffix)
+ root = configtest_name(config)
+ exext = config.compiler.exe_extension
+ return root + exext + ".manifest"
+
+def rc_name(config):
+ # Get configtest name (including suffix)
+ root = configtest_name(config)
+ return root + ".rc"
+
+def generate_manifest(config):
+ msver = get_build_msvc_version()
+ if msver is not None:
+ if msver >= 8:
+ check_embedded_msvcr_match_linked(msver)
+ ma_str, mi_str = str(msver).split('.')
+ # Write the manifest file
+ manxml = msvc_manifest_xml(int(ma_str), int(mi_str))
+ with open(manifest_name(config), "w") as man:
+ config.temp_files.append(manifest_name(config))
+ man.write(manxml)
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/misc_util.py b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/misc_util.py
new file mode 100644
index 0000000000000000000000000000000000000000..e226b47448153e34487def3176d5991319312363
--- /dev/null
+++ b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/misc_util.py
@@ -0,0 +1,2493 @@
+import os
+import re
+import sys
+import copy
+import glob
+import atexit
+import tempfile
+import subprocess
+import shutil
+import multiprocessing
+import textwrap
+import importlib.util
+from threading import local as tlocal
+from functools import reduce
+
+import distutils
+from distutils.errors import DistutilsError
+
+# stores temporary directory of each thread to only create one per thread
+_tdata = tlocal()
+
+# store all created temporary directories so they can be deleted on exit
+_tmpdirs = []
+def clean_up_temporary_directory():
+ if _tmpdirs is not None:
+ for d in _tmpdirs:
+ try:
+ shutil.rmtree(d)
+ except OSError:
+ pass
+
+atexit.register(clean_up_temporary_directory)
+
+__all__ = ['Configuration', 'get_numpy_include_dirs', 'default_config_dict',
+ 'dict_append', 'appendpath', 'generate_config_py',
+ 'get_cmd', 'allpath', 'get_mathlibs',
+ 'terminal_has_colors', 'red_text', 'green_text', 'yellow_text',
+ 'blue_text', 'cyan_text', 'cyg2win32', 'mingw32', 'all_strings',
+ 'has_f_sources', 'has_cxx_sources', 'filter_sources',
+ 'get_dependencies', 'is_local_src_dir', 'get_ext_source_files',
+ 'get_script_files', 'get_lib_source_files', 'get_data_files',
+ 'dot_join', 'get_frame', 'minrelpath', 'njoin',
+ 'is_sequence', 'is_string', 'as_list', 'gpaths', 'get_language',
+ 'get_build_architecture', 'get_info', 'get_pkg_info',
+ 'get_num_build_jobs', 'sanitize_cxx_flags',
+ 'exec_mod_from_location']
+
+class InstallableLib:
+ """
+ Container to hold information on an installable library.
+
+ Parameters
+ ----------
+ name : str
+ Name of the installed library.
+ build_info : dict
+ Dictionary holding build information.
+ target_dir : str
+ Absolute path specifying where to install the library.
+
+ See Also
+ --------
+ Configuration.add_installed_library
+
+ Notes
+ -----
+ The three parameters are stored as attributes with the same names.
+
+ """
+ def __init__(self, name, build_info, target_dir):
+ self.name = name
+ self.build_info = build_info
+ self.target_dir = target_dir
+
+
+def get_num_build_jobs():
+ """
+ Get number of parallel build jobs set by the --parallel command line
+ argument of setup.py
+ If the command did not receive a setting the environment variable
+ NPY_NUM_BUILD_JOBS is checked. If that is unset, return the number of
+ processors on the system, with a maximum of 8 (to prevent
+ overloading the system if there a lot of CPUs).
+
+ Returns
+ -------
+ out : int
+ number of parallel jobs that can be run
+
+ """
+ from numpy.distutils.core import get_distribution
+ try:
+ cpu_count = len(os.sched_getaffinity(0))
+ except AttributeError:
+ cpu_count = multiprocessing.cpu_count()
+ cpu_count = min(cpu_count, 8)
+ envjobs = int(os.environ.get("NPY_NUM_BUILD_JOBS", cpu_count))
+ dist = get_distribution()
+ # may be None during configuration
+ if dist is None:
+ return envjobs
+
+ # any of these three may have the job set, take the largest
+ cmdattr = (getattr(dist.get_command_obj('build'), 'parallel', None),
+ getattr(dist.get_command_obj('build_ext'), 'parallel', None),
+ getattr(dist.get_command_obj('build_clib'), 'parallel', None))
+ if all(x is None for x in cmdattr):
+ return envjobs
+ else:
+ return max(x for x in cmdattr if x is not None)
+
+def quote_args(args):
+ """Quote list of arguments.
+
+ .. deprecated:: 1.22.
+ """
+ import warnings
+ warnings.warn('"quote_args" is deprecated.',
+ DeprecationWarning, stacklevel=2)
+ # don't used _nt_quote_args as it does not check if
+ # args items already have quotes or not.
+ args = list(args)
+ for i in range(len(args)):
+ a = args[i]
+ if ' ' in a and a[0] not in '"\'':
+ args[i] = '"%s"' % (a)
+ return args
+
+def allpath(name):
+ "Convert a /-separated pathname to one using the OS's path separator."
+ split = name.split('/')
+ return os.path.join(*split)
+
+def rel_path(path, parent_path):
+ """Return path relative to parent_path."""
+ # Use realpath to avoid issues with symlinked dirs (see gh-7707)
+ pd = os.path.realpath(os.path.abspath(parent_path))
+ apath = os.path.realpath(os.path.abspath(path))
+ if len(apath) < len(pd):
+ return path
+ if apath == pd:
+ return ''
+ if pd == apath[:len(pd)]:
+ assert apath[len(pd)] in [os.sep], repr((path, apath[len(pd)]))
+ path = apath[len(pd)+1:]
+ return path
+
+def get_path_from_frame(frame, parent_path=None):
+ """Return path of the module given a frame object from the call stack.
+
+ Returned path is relative to parent_path when given,
+ otherwise it is absolute path.
+ """
+
+ # First, try to find if the file name is in the frame.
+ try:
+ caller_file = eval('__file__', frame.f_globals, frame.f_locals)
+ d = os.path.dirname(os.path.abspath(caller_file))
+ except NameError:
+ # __file__ is not defined, so let's try __name__. We try this second
+ # because setuptools spoofs __name__ to be '__main__' even though
+ # sys.modules['__main__'] might be something else, like easy_install(1).
+ caller_name = eval('__name__', frame.f_globals, frame.f_locals)
+ __import__(caller_name)
+ mod = sys.modules[caller_name]
+ if hasattr(mod, '__file__'):
+ d = os.path.dirname(os.path.abspath(mod.__file__))
+ else:
+ # we're probably running setup.py as execfile("setup.py")
+ # (likely we're building an egg)
+ d = os.path.abspath('.')
+
+ if parent_path is not None:
+ d = rel_path(d, parent_path)
+
+ return d or '.'
+
+def njoin(*path):
+ """Join two or more pathname components +
+ - convert a /-separated pathname to one using the OS's path separator.
+ - resolve `..` and `.` from path.
+
+ Either passing n arguments as in njoin('a','b'), or a sequence
+ of n names as in njoin(['a','b']) is handled, or a mixture of such arguments.
+ """
+ paths = []
+ for p in path:
+ if is_sequence(p):
+ # njoin(['a', 'b'], 'c')
+ paths.append(njoin(*p))
+ else:
+ assert is_string(p)
+ paths.append(p)
+ path = paths
+ if not path:
+ # njoin()
+ joined = ''
+ else:
+ # njoin('a', 'b')
+ joined = os.path.join(*path)
+ if os.path.sep != '/':
+ joined = joined.replace('/', os.path.sep)
+ return minrelpath(joined)
+
+def get_mathlibs(path=None):
+ """Return the MATHLIB line from numpyconfig.h
+ """
+ if path is not None:
+ config_file = os.path.join(path, '_numpyconfig.h')
+ else:
+ # Look for the file in each of the numpy include directories.
+ dirs = get_numpy_include_dirs()
+ for path in dirs:
+ fn = os.path.join(path, '_numpyconfig.h')
+ if os.path.exists(fn):
+ config_file = fn
+ break
+ else:
+ raise DistutilsError('_numpyconfig.h not found in numpy include '
+ 'dirs %r' % (dirs,))
+
+ with open(config_file) as fid:
+ mathlibs = []
+ s = '#define MATHLIB'
+ for line in fid:
+ if line.startswith(s):
+ value = line[len(s):].strip()
+ if value:
+ mathlibs.extend(value.split(','))
+ return mathlibs
+
+def minrelpath(path):
+ """Resolve `..` and '.' from path.
+ """
+ if not is_string(path):
+ return path
+ if '.' not in path:
+ return path
+ l = path.split(os.sep)
+ while l:
+ try:
+ i = l.index('.', 1)
+ except ValueError:
+ break
+ del l[i]
+ j = 1
+ while l:
+ try:
+ i = l.index('..', j)
+ except ValueError:
+ break
+ if l[i-1]=='..':
+ j += 1
+ else:
+ del l[i], l[i-1]
+ j = 1
+ if not l:
+ return ''
+ return os.sep.join(l)
+
+def sorted_glob(fileglob):
+ """sorts output of python glob for https://bugs.python.org/issue30461
+ to allow extensions to have reproducible build results"""
+ return sorted(glob.glob(fileglob))
+
+def _fix_paths(paths, local_path, include_non_existing):
+ assert is_sequence(paths), repr(type(paths))
+ new_paths = []
+ assert not is_string(paths), repr(paths)
+ for n in paths:
+ if is_string(n):
+ if '*' in n or '?' in n:
+ p = sorted_glob(n)
+ p2 = sorted_glob(njoin(local_path, n))
+ if p2:
+ new_paths.extend(p2)
+ elif p:
+ new_paths.extend(p)
+ else:
+ if include_non_existing:
+ new_paths.append(n)
+ print('could not resolve pattern in %r: %r' %
+ (local_path, n))
+ else:
+ n2 = njoin(local_path, n)
+ if os.path.exists(n2):
+ new_paths.append(n2)
+ else:
+ if os.path.exists(n):
+ new_paths.append(n)
+ elif include_non_existing:
+ new_paths.append(n)
+ if not os.path.exists(n):
+ print('non-existing path in %r: %r' %
+ (local_path, n))
+
+ elif is_sequence(n):
+ new_paths.extend(_fix_paths(n, local_path, include_non_existing))
+ else:
+ new_paths.append(n)
+ return [minrelpath(p) for p in new_paths]
+
+def gpaths(paths, local_path='', include_non_existing=True):
+ """Apply glob to paths and prepend local_path if needed.
+ """
+ if is_string(paths):
+ paths = (paths,)
+ return _fix_paths(paths, local_path, include_non_existing)
+
+def make_temp_file(suffix='', prefix='', text=True):
+ if not hasattr(_tdata, 'tempdir'):
+ _tdata.tempdir = tempfile.mkdtemp()
+ _tmpdirs.append(_tdata.tempdir)
+ fid, name = tempfile.mkstemp(suffix=suffix,
+ prefix=prefix,
+ dir=_tdata.tempdir,
+ text=text)
+ fo = os.fdopen(fid, 'w')
+ return fo, name
+
+# Hooks for colored terminal output.
+# See also https://web.archive.org/web/20100314204946/http://www.livinglogic.de/Python/ansistyle
+def terminal_has_colors():
+ if sys.platform=='cygwin' and 'USE_COLOR' not in os.environ:
+ # Avoid importing curses that causes illegal operation
+ # with a message:
+ # PYTHON2 caused an invalid page fault in
+ # module CYGNURSES7.DLL as 015f:18bbfc28
+ # Details: Python 2.3.3 [GCC 3.3.1 (cygming special)]
+ # ssh to Win32 machine from debian
+ # curses.version is 2.2
+ # CYGWIN_98-4.10, release 1.5.7(0.109/3/2))
+ return 0
+ if hasattr(sys.stdout, 'isatty') and sys.stdout.isatty():
+ try:
+ import curses
+ curses.setupterm()
+ if (curses.tigetnum("colors") >= 0
+ and curses.tigetnum("pairs") >= 0
+ and ((curses.tigetstr("setf") is not None
+ and curses.tigetstr("setb") is not None)
+ or (curses.tigetstr("setaf") is not None
+ and curses.tigetstr("setab") is not None)
+ or curses.tigetstr("scp") is not None)):
+ return 1
+ except Exception:
+ pass
+ return 0
+
+if terminal_has_colors():
+ _colour_codes = dict(black=0, red=1, green=2, yellow=3,
+ blue=4, magenta=5, cyan=6, white=7, default=9)
+ def colour_text(s, fg=None, bg=None, bold=False):
+ seq = []
+ if bold:
+ seq.append('1')
+ if fg:
+ fgcode = 30 + _colour_codes.get(fg.lower(), 0)
+ seq.append(str(fgcode))
+ if bg:
+ bgcode = 40 + _colour_codes.get(bg.lower(), 7)
+ seq.append(str(bgcode))
+ if seq:
+ return '\x1b[%sm%s\x1b[0m' % (';'.join(seq), s)
+ else:
+ return s
+else:
+ def colour_text(s, fg=None, bg=None):
+ return s
+
+def default_text(s):
+ return colour_text(s, 'default')
+def red_text(s):
+ return colour_text(s, 'red')
+def green_text(s):
+ return colour_text(s, 'green')
+def yellow_text(s):
+ return colour_text(s, 'yellow')
+def cyan_text(s):
+ return colour_text(s, 'cyan')
+def blue_text(s):
+ return colour_text(s, 'blue')
+
+#########################
+
+def cyg2win32(path: str) -> str:
+ """Convert a path from Cygwin-native to Windows-native.
+
+ Uses the cygpath utility (part of the Base install) to do the
+ actual conversion. Falls back to returning the original path if
+ this fails.
+
+ Handles the default ``/cygdrive`` mount prefix as well as the
+ ``/proc/cygdrive`` portable prefix, custom cygdrive prefixes such
+ as ``/`` or ``/mnt``, and absolute paths such as ``/usr/src/`` or
+ ``/home/username``
+
+ Parameters
+ ----------
+ path : str
+ The path to convert
+
+ Returns
+ -------
+ converted_path : str
+ The converted path
+
+ Notes
+ -----
+ Documentation for cygpath utility:
+ https://cygwin.com/cygwin-ug-net/cygpath.html
+ Documentation for the C function it wraps:
+ https://cygwin.com/cygwin-api/func-cygwin-conv-path.html
+
+ """
+ if sys.platform != "cygwin":
+ return path
+ return subprocess.check_output(
+ ["/usr/bin/cygpath", "--windows", path], text=True
+ )
+
+
+def mingw32():
+ """Return true when using mingw32 environment.
+ """
+ if sys.platform=='win32':
+ if os.environ.get('OSTYPE', '')=='msys':
+ return True
+ if os.environ.get('MSYSTEM', '')=='MINGW32':
+ return True
+ return False
+
+def msvc_runtime_version():
+ "Return version of MSVC runtime library, as defined by __MSC_VER__ macro"
+ msc_pos = sys.version.find('MSC v.')
+ if msc_pos != -1:
+ msc_ver = int(sys.version[msc_pos+6:msc_pos+10])
+ else:
+ msc_ver = None
+ return msc_ver
+
+def msvc_runtime_library():
+ "Return name of MSVC runtime library if Python was built with MSVC >= 7"
+ ver = msvc_runtime_major ()
+ if ver:
+ if ver < 140:
+ return "msvcr%i" % ver
+ else:
+ return "vcruntime%i" % ver
+ else:
+ return None
+
+def msvc_runtime_major():
+ "Return major version of MSVC runtime coded like get_build_msvc_version"
+ major = {1300: 70, # MSVC 7.0
+ 1310: 71, # MSVC 7.1
+ 1400: 80, # MSVC 8
+ 1500: 90, # MSVC 9 (aka 2008)
+ 1600: 100, # MSVC 10 (aka 2010)
+ 1900: 140, # MSVC 14 (aka 2015)
+ }.get(msvc_runtime_version(), None)
+ return major
+
+#########################
+
+#XXX need support for .C that is also C++
+cxx_ext_match = re.compile(r'.*\.(cpp|cxx|cc)\Z', re.I).match
+fortran_ext_match = re.compile(r'.*\.(f90|f95|f77|for|ftn|f)\Z', re.I).match
+f90_ext_match = re.compile(r'.*\.(f90|f95)\Z', re.I).match
+f90_module_name_match = re.compile(r'\s*module\s*(?P[\w_]+)', re.I).match
+def _get_f90_modules(source):
+ """Return a list of Fortran f90 module names that
+ given source file defines.
+ """
+ if not f90_ext_match(source):
+ return []
+ modules = []
+ with open(source) as f:
+ for line in f:
+ m = f90_module_name_match(line)
+ if m:
+ name = m.group('name')
+ modules.append(name)
+ # break # XXX can we assume that there is one module per file?
+ return modules
+
+def is_string(s):
+ return isinstance(s, str)
+
+def all_strings(lst):
+ """Return True if all items in lst are string objects. """
+ for item in lst:
+ if not is_string(item):
+ return False
+ return True
+
+def is_sequence(seq):
+ if is_string(seq):
+ return False
+ try:
+ len(seq)
+ except Exception:
+ return False
+ return True
+
+def is_glob_pattern(s):
+ return is_string(s) and ('*' in s or '?' in s)
+
+def as_list(seq):
+ if is_sequence(seq):
+ return list(seq)
+ else:
+ return [seq]
+
+def get_language(sources):
+ # not used in numpy/scipy packages, use build_ext.detect_language instead
+ """Determine language value (c,f77,f90) from sources """
+ language = None
+ for source in sources:
+ if isinstance(source, str):
+ if f90_ext_match(source):
+ language = 'f90'
+ break
+ elif fortran_ext_match(source):
+ language = 'f77'
+ return language
+
+def has_f_sources(sources):
+ """Return True if sources contains Fortran files """
+ for source in sources:
+ if fortran_ext_match(source):
+ return True
+ return False
+
+def has_cxx_sources(sources):
+ """Return True if sources contains C++ files """
+ for source in sources:
+ if cxx_ext_match(source):
+ return True
+ return False
+
+def filter_sources(sources):
+ """Return four lists of filenames containing
+ C, C++, Fortran, and Fortran 90 module sources,
+ respectively.
+ """
+ c_sources = []
+ cxx_sources = []
+ f_sources = []
+ fmodule_sources = []
+ for source in sources:
+ if fortran_ext_match(source):
+ modules = _get_f90_modules(source)
+ if modules:
+ fmodule_sources.append(source)
+ else:
+ f_sources.append(source)
+ elif cxx_ext_match(source):
+ cxx_sources.append(source)
+ else:
+ c_sources.append(source)
+ return c_sources, cxx_sources, f_sources, fmodule_sources
+
+
+def _get_headers(directory_list):
+ # get *.h files from list of directories
+ headers = []
+ for d in directory_list:
+ head = sorted_glob(os.path.join(d, "*.h")) #XXX: *.hpp files??
+ headers.extend(head)
+ return headers
+
+def _get_directories(list_of_sources):
+ # get unique directories from list of sources.
+ direcs = []
+ for f in list_of_sources:
+ d = os.path.split(f)
+ if d[0] != '' and not d[0] in direcs:
+ direcs.append(d[0])
+ return direcs
+
+def _commandline_dep_string(cc_args, extra_postargs, pp_opts):
+ """
+ Return commandline representation used to determine if a file needs
+ to be recompiled
+ """
+ cmdline = 'commandline: '
+ cmdline += ' '.join(cc_args)
+ cmdline += ' '.join(extra_postargs)
+ cmdline += ' '.join(pp_opts) + '\n'
+ return cmdline
+
+
+def get_dependencies(sources):
+ #XXX scan sources for include statements
+ return _get_headers(_get_directories(sources))
+
+def is_local_src_dir(directory):
+ """Return true if directory is local directory.
+ """
+ if not is_string(directory):
+ return False
+ abs_dir = os.path.abspath(directory)
+ c = os.path.commonprefix([os.getcwd(), abs_dir])
+ new_dir = abs_dir[len(c):].split(os.sep)
+ if new_dir and not new_dir[0]:
+ new_dir = new_dir[1:]
+ if new_dir and new_dir[0]=='build':
+ return False
+ new_dir = os.sep.join(new_dir)
+ return os.path.isdir(new_dir)
+
+def general_source_files(top_path):
+ pruned_directories = {'CVS':1, '.svn':1, 'build':1}
+ prune_file_pat = re.compile(r'(?:[~#]|\.py[co]|\.o)$')
+ for dirpath, dirnames, filenames in os.walk(top_path, topdown=True):
+ pruned = [ d for d in dirnames if d not in pruned_directories ]
+ dirnames[:] = pruned
+ for f in filenames:
+ if not prune_file_pat.search(f):
+ yield os.path.join(dirpath, f)
+
+def general_source_directories_files(top_path):
+ """Return a directory name relative to top_path and
+ files contained.
+ """
+ pruned_directories = ['CVS', '.svn', 'build']
+ prune_file_pat = re.compile(r'(?:[~#]|\.py[co]|\.o)$')
+ for dirpath, dirnames, filenames in os.walk(top_path, topdown=True):
+ pruned = [ d for d in dirnames if d not in pruned_directories ]
+ dirnames[:] = pruned
+ for d in dirnames:
+ dpath = os.path.join(dirpath, d)
+ rpath = rel_path(dpath, top_path)
+ files = []
+ for f in os.listdir(dpath):
+ fn = os.path.join(dpath, f)
+ if os.path.isfile(fn) and not prune_file_pat.search(fn):
+ files.append(fn)
+ yield rpath, files
+ dpath = top_path
+ rpath = rel_path(dpath, top_path)
+ filenames = [os.path.join(dpath, f) for f in os.listdir(dpath) \
+ if not prune_file_pat.search(f)]
+ files = [f for f in filenames if os.path.isfile(f)]
+ yield rpath, files
+
+
+def get_ext_source_files(ext):
+ # Get sources and any include files in the same directory.
+ filenames = []
+ sources = [_m for _m in ext.sources if is_string(_m)]
+ filenames.extend(sources)
+ filenames.extend(get_dependencies(sources))
+ for d in ext.depends:
+ if is_local_src_dir(d):
+ filenames.extend(list(general_source_files(d)))
+ elif os.path.isfile(d):
+ filenames.append(d)
+ return filenames
+
+def get_script_files(scripts):
+ scripts = [_m for _m in scripts if is_string(_m)]
+ return scripts
+
+def get_lib_source_files(lib):
+ filenames = []
+ sources = lib[1].get('sources', [])
+ sources = [_m for _m in sources if is_string(_m)]
+ filenames.extend(sources)
+ filenames.extend(get_dependencies(sources))
+ depends = lib[1].get('depends', [])
+ for d in depends:
+ if is_local_src_dir(d):
+ filenames.extend(list(general_source_files(d)))
+ elif os.path.isfile(d):
+ filenames.append(d)
+ return filenames
+
+def get_shared_lib_extension(is_python_ext=False):
+ """Return the correct file extension for shared libraries.
+
+ Parameters
+ ----------
+ is_python_ext : bool, optional
+ Whether the shared library is a Python extension. Default is False.
+
+ Returns
+ -------
+ so_ext : str
+ The shared library extension.
+
+ Notes
+ -----
+ For Python shared libs, `so_ext` will typically be '.so' on Linux and OS X,
+ and '.pyd' on Windows. For Python >= 3.2 `so_ext` has a tag prepended on
+ POSIX systems according to PEP 3149.
+
+ """
+ confvars = distutils.sysconfig.get_config_vars()
+ so_ext = confvars.get('EXT_SUFFIX', '')
+
+ if not is_python_ext:
+ # hardcode known values, config vars (including SHLIB_SUFFIX) are
+ # unreliable (see #3182)
+ # darwin, windows and debug linux are wrong in 3.3.1 and older
+ if (sys.platform.startswith('linux') or
+ sys.platform.startswith('gnukfreebsd')):
+ so_ext = '.so'
+ elif sys.platform.startswith('darwin'):
+ so_ext = '.dylib'
+ elif sys.platform.startswith('win'):
+ so_ext = '.dll'
+ else:
+ # fall back to config vars for unknown platforms
+ # fix long extension for Python >=3.2, see PEP 3149.
+ if 'SOABI' in confvars:
+ # Does nothing unless SOABI config var exists
+ so_ext = so_ext.replace('.' + confvars.get('SOABI'), '', 1)
+
+ return so_ext
+
+def get_data_files(data):
+ if is_string(data):
+ return [data]
+ sources = data[1]
+ filenames = []
+ for s in sources:
+ if hasattr(s, '__call__'):
+ continue
+ if is_local_src_dir(s):
+ filenames.extend(list(general_source_files(s)))
+ elif is_string(s):
+ if os.path.isfile(s):
+ filenames.append(s)
+ else:
+ print('Not existing data file:', s)
+ else:
+ raise TypeError(repr(s))
+ return filenames
+
+def dot_join(*args):
+ return '.'.join([a for a in args if a])
+
+def get_frame(level=0):
+ """Return frame object from call stack with given level.
+ """
+ try:
+ return sys._getframe(level+1)
+ except AttributeError:
+ frame = sys.exc_info()[2].tb_frame
+ for _ in range(level+1):
+ frame = frame.f_back
+ return frame
+
+
+######################
+
+class Configuration:
+
+ _list_keys = ['packages', 'ext_modules', 'data_files', 'include_dirs',
+ 'libraries', 'headers', 'scripts', 'py_modules',
+ 'installed_libraries', 'define_macros']
+ _dict_keys = ['package_dir', 'installed_pkg_config']
+ _extra_keys = ['name', 'version']
+
+ numpy_include_dirs = []
+
+ def __init__(self,
+ package_name=None,
+ parent_name=None,
+ top_path=None,
+ package_path=None,
+ caller_level=1,
+ setup_name='setup.py',
+ **attrs):
+ """Construct configuration instance of a package.
+
+ package_name -- name of the package
+ Ex.: 'distutils'
+ parent_name -- name of the parent package
+ Ex.: 'numpy'
+ top_path -- directory of the toplevel package
+ Ex.: the directory where the numpy package source sits
+ package_path -- directory of package. Will be computed by magic from the
+ directory of the caller module if not specified
+ Ex.: the directory where numpy.distutils is
+ caller_level -- frame level to caller namespace, internal parameter.
+ """
+ self.name = dot_join(parent_name, package_name)
+ self.version = None
+
+ caller_frame = get_frame(caller_level)
+ self.local_path = get_path_from_frame(caller_frame, top_path)
+ # local_path -- directory of a file (usually setup.py) that
+ # defines a configuration() function.
+ # local_path -- directory of a file (usually setup.py) that
+ # defines a configuration() function.
+ if top_path is None:
+ top_path = self.local_path
+ self.local_path = ''
+ if package_path is None:
+ package_path = self.local_path
+ elif os.path.isdir(njoin(self.local_path, package_path)):
+ package_path = njoin(self.local_path, package_path)
+ if not os.path.isdir(package_path or '.'):
+ raise ValueError("%r is not a directory" % (package_path,))
+ self.top_path = top_path
+ self.package_path = package_path
+ # this is the relative path in the installed package
+ self.path_in_package = os.path.join(*self.name.split('.'))
+
+ self.list_keys = self._list_keys[:]
+ self.dict_keys = self._dict_keys[:]
+
+ for n in self.list_keys:
+ v = copy.copy(attrs.get(n, []))
+ setattr(self, n, as_list(v))
+
+ for n in self.dict_keys:
+ v = copy.copy(attrs.get(n, {}))
+ setattr(self, n, v)
+
+ known_keys = self.list_keys + self.dict_keys
+ self.extra_keys = self._extra_keys[:]
+ for n in attrs.keys():
+ if n in known_keys:
+ continue
+ a = attrs[n]
+ setattr(self, n, a)
+ if isinstance(a, list):
+ self.list_keys.append(n)
+ elif isinstance(a, dict):
+ self.dict_keys.append(n)
+ else:
+ self.extra_keys.append(n)
+
+ if os.path.exists(njoin(package_path, '__init__.py')):
+ self.packages.append(self.name)
+ self.package_dir[self.name] = package_path
+
+ self.options = dict(
+ ignore_setup_xxx_py = False,
+ assume_default_configuration = False,
+ delegate_options_to_subpackages = False,
+ quiet = False,
+ )
+
+ caller_instance = None
+ for i in range(1, 3):
+ try:
+ f = get_frame(i)
+ except ValueError:
+ break
+ try:
+ caller_instance = eval('self', f.f_globals, f.f_locals)
+ break
+ except NameError:
+ pass
+ if isinstance(caller_instance, self.__class__):
+ if caller_instance.options['delegate_options_to_subpackages']:
+ self.set_options(**caller_instance.options)
+
+ self.setup_name = setup_name
+
+ def todict(self):
+ """
+ Return a dictionary compatible with the keyword arguments of distutils
+ setup function.
+
+ Examples
+ --------
+ >>> setup(**config.todict()) #doctest: +SKIP
+ """
+
+ self._optimize_data_files()
+ d = {}
+ known_keys = self.list_keys + self.dict_keys + self.extra_keys
+ for n in known_keys:
+ a = getattr(self, n)
+ if a:
+ d[n] = a
+ return d
+
+ def info(self, message):
+ if not self.options['quiet']:
+ print(message)
+
+ def warn(self, message):
+ sys.stderr.write('Warning: %s\n' % (message,))
+
+ def set_options(self, **options):
+ """
+ Configure Configuration instance.
+
+ The following options are available:
+ - ignore_setup_xxx_py
+ - assume_default_configuration
+ - delegate_options_to_subpackages
+ - quiet
+
+ """
+ for key, value in options.items():
+ if key in self.options:
+ self.options[key] = value
+ else:
+ raise ValueError('Unknown option: '+key)
+
+ def get_distribution(self):
+ """Return the distutils distribution object for self."""
+ from numpy.distutils.core import get_distribution
+ return get_distribution()
+
+ def _wildcard_get_subpackage(self, subpackage_name,
+ parent_name,
+ caller_level = 1):
+ l = subpackage_name.split('.')
+ subpackage_path = njoin([self.local_path]+l)
+ dirs = [_m for _m in sorted_glob(subpackage_path) if os.path.isdir(_m)]
+ config_list = []
+ for d in dirs:
+ if not os.path.isfile(njoin(d, '__init__.py')):
+ continue
+ if 'build' in d.split(os.sep):
+ continue
+ n = '.'.join(d.split(os.sep)[-len(l):])
+ c = self.get_subpackage(n,
+ parent_name = parent_name,
+ caller_level = caller_level+1)
+ config_list.extend(c)
+ return config_list
+
+ def _get_configuration_from_setup_py(self, setup_py,
+ subpackage_name,
+ subpackage_path,
+ parent_name,
+ caller_level = 1):
+ # In case setup_py imports local modules:
+ sys.path.insert(0, os.path.dirname(setup_py))
+ try:
+ setup_name = os.path.splitext(os.path.basename(setup_py))[0]
+ n = dot_join(self.name, subpackage_name, setup_name)
+ setup_module = exec_mod_from_location(
+ '_'.join(n.split('.')), setup_py)
+ if not hasattr(setup_module, 'configuration'):
+ if not self.options['assume_default_configuration']:
+ self.warn('Assuming default configuration '\
+ '(%s does not define configuration())'\
+ % (setup_module))
+ config = Configuration(subpackage_name, parent_name,
+ self.top_path, subpackage_path,
+ caller_level = caller_level + 1)
+ else:
+ pn = dot_join(*([parent_name] + subpackage_name.split('.')[:-1]))
+ args = (pn,)
+ if setup_module.configuration.__code__.co_argcount > 1:
+ args = args + (self.top_path,)
+ config = setup_module.configuration(*args)
+ if config.name!=dot_join(parent_name, subpackage_name):
+ self.warn('Subpackage %r configuration returned as %r' % \
+ (dot_join(parent_name, subpackage_name), config.name))
+ finally:
+ del sys.path[0]
+ return config
+
+ def get_subpackage(self,subpackage_name,
+ subpackage_path=None,
+ parent_name=None,
+ caller_level = 1):
+ """Return list of subpackage configurations.
+
+ Parameters
+ ----------
+ subpackage_name : str or None
+ Name of the subpackage to get the configuration. '*' in
+ subpackage_name is handled as a wildcard.
+ subpackage_path : str
+ If None, then the path is assumed to be the local path plus the
+ subpackage_name. If a setup.py file is not found in the
+ subpackage_path, then a default configuration is used.
+ parent_name : str
+ Parent name.
+ """
+ if subpackage_name is None:
+ if subpackage_path is None:
+ raise ValueError(
+ "either subpackage_name or subpackage_path must be specified")
+ subpackage_name = os.path.basename(subpackage_path)
+
+ # handle wildcards
+ l = subpackage_name.split('.')
+ if subpackage_path is None and '*' in subpackage_name:
+ return self._wildcard_get_subpackage(subpackage_name,
+ parent_name,
+ caller_level = caller_level+1)
+ assert '*' not in subpackage_name, repr((subpackage_name, subpackage_path, parent_name))
+ if subpackage_path is None:
+ subpackage_path = njoin([self.local_path] + l)
+ else:
+ subpackage_path = njoin([subpackage_path] + l[:-1])
+ subpackage_path = self.paths([subpackage_path])[0]
+ setup_py = njoin(subpackage_path, self.setup_name)
+ if not self.options['ignore_setup_xxx_py']:
+ if not os.path.isfile(setup_py):
+ setup_py = njoin(subpackage_path,
+ 'setup_%s.py' % (subpackage_name))
+ if not os.path.isfile(setup_py):
+ if not self.options['assume_default_configuration']:
+ self.warn('Assuming default configuration '\
+ '(%s/{setup_%s,setup}.py was not found)' \
+ % (os.path.dirname(setup_py), subpackage_name))
+ config = Configuration(subpackage_name, parent_name,
+ self.top_path, subpackage_path,
+ caller_level = caller_level+1)
+ else:
+ config = self._get_configuration_from_setup_py(
+ setup_py,
+ subpackage_name,
+ subpackage_path,
+ parent_name,
+ caller_level = caller_level + 1)
+ if config:
+ return [config]
+ else:
+ return []
+
+ def add_subpackage(self,subpackage_name,
+ subpackage_path=None,
+ standalone = False):
+ """Add a sub-package to the current Configuration instance.
+
+ This is useful in a setup.py script for adding sub-packages to a
+ package.
+
+ Parameters
+ ----------
+ subpackage_name : str
+ name of the subpackage
+ subpackage_path : str
+ if given, the subpackage path such as the subpackage is in
+ subpackage_path / subpackage_name. If None,the subpackage is
+ assumed to be located in the local path / subpackage_name.
+ standalone : bool
+ """
+
+ if standalone:
+ parent_name = None
+ else:
+ parent_name = self.name
+ config_list = self.get_subpackage(subpackage_name, subpackage_path,
+ parent_name = parent_name,
+ caller_level = 2)
+ if not config_list:
+ self.warn('No configuration returned, assuming unavailable.')
+ for config in config_list:
+ d = config
+ if isinstance(config, Configuration):
+ d = config.todict()
+ assert isinstance(d, dict), repr(type(d))
+
+ self.info('Appending %s configuration to %s' \
+ % (d.get('name'), self.name))
+ self.dict_append(**d)
+
+ dist = self.get_distribution()
+ if dist is not None:
+ self.warn('distutils distribution has been initialized,'\
+ ' it may be too late to add a subpackage '+ subpackage_name)
+
+ def add_data_dir(self, data_path):
+ """Recursively add files under data_path to data_files list.
+
+ Recursively add files under data_path to the list of data_files to be
+ installed (and distributed). The data_path can be either a relative
+ path-name, or an absolute path-name, or a 2-tuple where the first
+ argument shows where in the install directory the data directory
+ should be installed to.
+
+ Parameters
+ ----------
+ data_path : seq or str
+ Argument can be either
+
+ * 2-sequence (, )
+ * path to data directory where python datadir suffix defaults
+ to package dir.
+
+ Notes
+ -----
+ Rules for installation paths::
+
+ foo/bar -> (foo/bar, foo/bar) -> parent/foo/bar
+ (gun, foo/bar) -> parent/gun
+ foo/* -> (foo/a, foo/a), (foo/b, foo/b) -> parent/foo/a, parent/foo/b
+ (gun, foo/*) -> (gun, foo/a), (gun, foo/b) -> gun
+ (gun/*, foo/*) -> parent/gun/a, parent/gun/b
+ /foo/bar -> (bar, /foo/bar) -> parent/bar
+ (gun, /foo/bar) -> parent/gun
+ (fun/*/gun/*, sun/foo/bar) -> parent/fun/foo/gun/bar
+
+ Examples
+ --------
+ For example suppose the source directory contains fun/foo.dat and
+ fun/bar/car.dat:
+
+ >>> self.add_data_dir('fun') #doctest: +SKIP
+ >>> self.add_data_dir(('sun', 'fun')) #doctest: +SKIP
+ >>> self.add_data_dir(('gun', '/full/path/to/fun'))#doctest: +SKIP
+
+ Will install data-files to the locations::
+
+ /
+ fun/
+ foo.dat
+ bar/
+ car.dat
+ sun/
+ foo.dat
+ bar/
+ car.dat
+ gun/
+ foo.dat
+ car.dat
+
+ """
+ if is_sequence(data_path):
+ d, data_path = data_path
+ else:
+ d = None
+ if is_sequence(data_path):
+ [self.add_data_dir((d, p)) for p in data_path]
+ return
+ if not is_string(data_path):
+ raise TypeError("not a string: %r" % (data_path,))
+ if d is None:
+ if os.path.isabs(data_path):
+ return self.add_data_dir((os.path.basename(data_path), data_path))
+ return self.add_data_dir((data_path, data_path))
+ paths = self.paths(data_path, include_non_existing=False)
+ if is_glob_pattern(data_path):
+ if is_glob_pattern(d):
+ pattern_list = allpath(d).split(os.sep)
+ pattern_list.reverse()
+ # /a/*//b/ -> /a/*/b
+ rl = list(range(len(pattern_list)-1)); rl.reverse()
+ for i in rl:
+ if not pattern_list[i]:
+ del pattern_list[i]
+ #
+ for path in paths:
+ if not os.path.isdir(path):
+ print('Not a directory, skipping', path)
+ continue
+ rpath = rel_path(path, self.local_path)
+ path_list = rpath.split(os.sep)
+ path_list.reverse()
+ target_list = []
+ i = 0
+ for s in pattern_list:
+ if is_glob_pattern(s):
+ if i>=len(path_list):
+ raise ValueError('cannot fill pattern %r with %r' \
+ % (d, path))
+ target_list.append(path_list[i])
+ else:
+ assert s==path_list[i], repr((s, path_list[i], data_path, d, path, rpath))
+ target_list.append(s)
+ i += 1
+ if path_list[i:]:
+ self.warn('mismatch of pattern_list=%s and path_list=%s'\
+ % (pattern_list, path_list))
+ target_list.reverse()
+ self.add_data_dir((os.sep.join(target_list), path))
+ else:
+ for path in paths:
+ self.add_data_dir((d, path))
+ return
+ assert not is_glob_pattern(d), repr(d)
+
+ dist = self.get_distribution()
+ if dist is not None and dist.data_files is not None:
+ data_files = dist.data_files
+ else:
+ data_files = self.data_files
+
+ for path in paths:
+ for d1, f in list(general_source_directories_files(path)):
+ target_path = os.path.join(self.path_in_package, d, d1)
+ data_files.append((target_path, f))
+
+ def _optimize_data_files(self):
+ data_dict = {}
+ for p, files in self.data_files:
+ if p not in data_dict:
+ data_dict[p] = set()
+ for f in files:
+ data_dict[p].add(f)
+ self.data_files[:] = [(p, list(files)) for p, files in data_dict.items()]
+
+ def add_data_files(self,*files):
+ """Add data files to configuration data_files.
+
+ Parameters
+ ----------
+ files : sequence
+ Argument(s) can be either
+
+ * 2-sequence (,)
+ * paths to data files where python datadir prefix defaults
+ to package dir.
+
+ Notes
+ -----
+ The form of each element of the files sequence is very flexible
+ allowing many combinations of where to get the files from the package
+ and where they should ultimately be installed on the system. The most
+ basic usage is for an element of the files argument sequence to be a
+ simple filename. This will cause that file from the local path to be
+ installed to the installation path of the self.name package (package
+ path). The file argument can also be a relative path in which case the
+ entire relative path will be installed into the package directory.
+ Finally, the file can be an absolute path name in which case the file
+ will be found at the absolute path name but installed to the package
+ path.
+
+ This basic behavior can be augmented by passing a 2-tuple in as the
+ file argument. The first element of the tuple should specify the
+ relative path (under the package install directory) where the
+ remaining sequence of files should be installed to (it has nothing to
+ do with the file-names in the source distribution). The second element
+ of the tuple is the sequence of files that should be installed. The
+ files in this sequence can be filenames, relative paths, or absolute
+ paths. For absolute paths the file will be installed in the top-level
+ package installation directory (regardless of the first argument).
+ Filenames and relative path names will be installed in the package
+ install directory under the path name given as the first element of
+ the tuple.
+
+ Rules for installation paths:
+
+ #. file.txt -> (., file.txt)-> parent/file.txt
+ #. foo/file.txt -> (foo, foo/file.txt) -> parent/foo/file.txt
+ #. /foo/bar/file.txt -> (., /foo/bar/file.txt) -> parent/file.txt
+ #. ``*``.txt -> parent/a.txt, parent/b.txt
+ #. foo/``*``.txt`` -> parent/foo/a.txt, parent/foo/b.txt
+ #. ``*/*.txt`` -> (``*``, ``*``/``*``.txt) -> parent/c/a.txt, parent/d/b.txt
+ #. (sun, file.txt) -> parent/sun/file.txt
+ #. (sun, bar/file.txt) -> parent/sun/file.txt
+ #. (sun, /foo/bar/file.txt) -> parent/sun/file.txt
+ #. (sun, ``*``.txt) -> parent/sun/a.txt, parent/sun/b.txt
+ #. (sun, bar/``*``.txt) -> parent/sun/a.txt, parent/sun/b.txt
+ #. (sun/``*``, ``*``/``*``.txt) -> parent/sun/c/a.txt, parent/d/b.txt
+
+ An additional feature is that the path to a data-file can actually be
+ a function that takes no arguments and returns the actual path(s) to
+ the data-files. This is useful when the data files are generated while
+ building the package.
+
+ Examples
+ --------
+ Add files to the list of data_files to be included with the package.
+
+ >>> self.add_data_files('foo.dat',
+ ... ('fun', ['gun.dat', 'nun/pun.dat', '/tmp/sun.dat']),
+ ... 'bar/cat.dat',
+ ... '/full/path/to/can.dat') #doctest: +SKIP
+
+ will install these data files to::
+
+ /
+ foo.dat
+ fun/
+ gun.dat
+ nun/
+ pun.dat
+ sun.dat
+ bar/
+ car.dat
+ can.dat
+
+ where is the package (or sub-package)
+ directory such as '/usr/lib/python2.4/site-packages/mypackage' ('C:
+ \\Python2.4 \\Lib \\site-packages \\mypackage') or
+ '/usr/lib/python2.4/site- packages/mypackage/mysubpackage' ('C:
+ \\Python2.4 \\Lib \\site-packages \\mypackage \\mysubpackage').
+ """
+
+ if len(files)>1:
+ for f in files:
+ self.add_data_files(f)
+ return
+ assert len(files)==1
+ if is_sequence(files[0]):
+ d, files = files[0]
+ else:
+ d = None
+ if is_string(files):
+ filepat = files
+ elif is_sequence(files):
+ if len(files)==1:
+ filepat = files[0]
+ else:
+ for f in files:
+ self.add_data_files((d, f))
+ return
+ else:
+ raise TypeError(repr(type(files)))
+
+ if d is None:
+ if hasattr(filepat, '__call__'):
+ d = ''
+ elif os.path.isabs(filepat):
+ d = ''
+ else:
+ d = os.path.dirname(filepat)
+ self.add_data_files((d, files))
+ return
+
+ paths = self.paths(filepat, include_non_existing=False)
+ if is_glob_pattern(filepat):
+ if is_glob_pattern(d):
+ pattern_list = d.split(os.sep)
+ pattern_list.reverse()
+ for path in paths:
+ path_list = path.split(os.sep)
+ path_list.reverse()
+ path_list.pop() # filename
+ target_list = []
+ i = 0
+ for s in pattern_list:
+ if is_glob_pattern(s):
+ target_list.append(path_list[i])
+ i += 1
+ else:
+ target_list.append(s)
+ target_list.reverse()
+ self.add_data_files((os.sep.join(target_list), path))
+ else:
+ self.add_data_files((d, paths))
+ return
+ assert not is_glob_pattern(d), repr((d, filepat))
+
+ dist = self.get_distribution()
+ if dist is not None and dist.data_files is not None:
+ data_files = dist.data_files
+ else:
+ data_files = self.data_files
+
+ data_files.append((os.path.join(self.path_in_package, d), paths))
+
+ ### XXX Implement add_py_modules
+
+ def add_define_macros(self, macros):
+ """Add define macros to configuration
+
+ Add the given sequence of macro name and value duples to the beginning
+ of the define_macros list This list will be visible to all extension
+ modules of the current package.
+ """
+ dist = self.get_distribution()
+ if dist is not None:
+ if not hasattr(dist, 'define_macros'):
+ dist.define_macros = []
+ dist.define_macros.extend(macros)
+ else:
+ self.define_macros.extend(macros)
+
+
+ def add_include_dirs(self,*paths):
+ """Add paths to configuration include directories.
+
+ Add the given sequence of paths to the beginning of the include_dirs
+ list. This list will be visible to all extension modules of the
+ current package.
+ """
+ include_dirs = self.paths(paths)
+ dist = self.get_distribution()
+ if dist is not None:
+ if dist.include_dirs is None:
+ dist.include_dirs = []
+ dist.include_dirs.extend(include_dirs)
+ else:
+ self.include_dirs.extend(include_dirs)
+
+ def add_headers(self,*files):
+ """Add installable headers to configuration.
+
+ Add the given sequence of files to the beginning of the headers list.
+ By default, headers will be installed under // directory. If an item of files
+ is a tuple, then its first argument specifies the actual installation
+ location relative to the path.
+
+ Parameters
+ ----------
+ files : str or seq
+ Argument(s) can be either:
+
+ * 2-sequence (,)
+ * path(s) to header file(s) where python includedir suffix will
+ default to package name.
+ """
+ headers = []
+ for path in files:
+ if is_string(path):
+ [headers.append((self.name, p)) for p in self.paths(path)]
+ else:
+ if not isinstance(path, (tuple, list)) or len(path) != 2:
+ raise TypeError(repr(path))
+ [headers.append((path[0], p)) for p in self.paths(path[1])]
+ dist = self.get_distribution()
+ if dist is not None:
+ if dist.headers is None:
+ dist.headers = []
+ dist.headers.extend(headers)
+ else:
+ self.headers.extend(headers)
+
+ def paths(self,*paths,**kws):
+ """Apply glob to paths and prepend local_path if needed.
+
+ Applies glob.glob(...) to each path in the sequence (if needed) and
+ pre-pends the local_path if needed. Because this is called on all
+ source lists, this allows wildcard characters to be specified in lists
+ of sources for extension modules and libraries and scripts and allows
+ path-names be relative to the source directory.
+
+ """
+ include_non_existing = kws.get('include_non_existing', True)
+ return gpaths(paths,
+ local_path = self.local_path,
+ include_non_existing=include_non_existing)
+
+ def _fix_paths_dict(self, kw):
+ for k in kw.keys():
+ v = kw[k]
+ if k in ['sources', 'depends', 'include_dirs', 'library_dirs',
+ 'module_dirs', 'extra_objects']:
+ new_v = self.paths(v)
+ kw[k] = new_v
+
+ def add_extension(self,name,sources,**kw):
+ """Add extension to configuration.
+
+ Create and add an Extension instance to the ext_modules list. This
+ method also takes the following optional keyword arguments that are
+ passed on to the Extension constructor.
+
+ Parameters
+ ----------
+ name : str
+ name of the extension
+ sources : seq
+ list of the sources. The list of sources may contain functions
+ (called source generators) which must take an extension instance
+ and a build directory as inputs and return a source file or list of
+ source files or None. If None is returned then no sources are
+ generated. If the Extension instance has no sources after
+ processing all source generators, then no extension module is
+ built.
+ include_dirs :
+ define_macros :
+ undef_macros :
+ library_dirs :
+ libraries :
+ runtime_library_dirs :
+ extra_objects :
+ extra_compile_args :
+ extra_link_args :
+ extra_f77_compile_args :
+ extra_f90_compile_args :
+ export_symbols :
+ swig_opts :
+ depends :
+ The depends list contains paths to files or directories that the
+ sources of the extension module depend on. If any path in the
+ depends list is newer than the extension module, then the module
+ will be rebuilt.
+ language :
+ f2py_options :
+ module_dirs :
+ extra_info : dict or list
+ dict or list of dict of keywords to be appended to keywords.
+
+ Notes
+ -----
+ The self.paths(...) method is applied to all lists that may contain
+ paths.
+ """
+ ext_args = copy.copy(kw)
+ ext_args['name'] = dot_join(self.name, name)
+ ext_args['sources'] = sources
+
+ if 'extra_info' in ext_args:
+ extra_info = ext_args['extra_info']
+ del ext_args['extra_info']
+ if isinstance(extra_info, dict):
+ extra_info = [extra_info]
+ for info in extra_info:
+ assert isinstance(info, dict), repr(info)
+ dict_append(ext_args,**info)
+
+ self._fix_paths_dict(ext_args)
+
+ # Resolve out-of-tree dependencies
+ libraries = ext_args.get('libraries', [])
+ libnames = []
+ ext_args['libraries'] = []
+ for libname in libraries:
+ if isinstance(libname, tuple):
+ self._fix_paths_dict(libname[1])
+
+ # Handle library names of the form libname@relative/path/to/library
+ if '@' in libname:
+ lname, lpath = libname.split('@', 1)
+ lpath = os.path.abspath(njoin(self.local_path, lpath))
+ if os.path.isdir(lpath):
+ c = self.get_subpackage(None, lpath,
+ caller_level = 2)
+ if isinstance(c, Configuration):
+ c = c.todict()
+ for l in [l[0] for l in c.get('libraries', [])]:
+ llname = l.split('__OF__', 1)[0]
+ if llname == lname:
+ c.pop('name', None)
+ dict_append(ext_args,**c)
+ break
+ continue
+ libnames.append(libname)
+
+ ext_args['libraries'] = libnames + ext_args['libraries']
+ ext_args['define_macros'] = \
+ self.define_macros + ext_args.get('define_macros', [])
+
+ from numpy.distutils.core import Extension
+ ext = Extension(**ext_args)
+ self.ext_modules.append(ext)
+
+ dist = self.get_distribution()
+ if dist is not None:
+ self.warn('distutils distribution has been initialized,'\
+ ' it may be too late to add an extension '+name)
+ return ext
+
+ def add_library(self,name,sources,**build_info):
+ """
+ Add library to configuration.
+
+ Parameters
+ ----------
+ name : str
+ Name of the extension.
+ sources : sequence
+ List of the sources. The list of sources may contain functions
+ (called source generators) which must take an extension instance
+ and a build directory as inputs and return a source file or list of
+ source files or None. If None is returned then no sources are
+ generated. If the Extension instance has no sources after
+ processing all source generators, then no extension module is
+ built.
+ build_info : dict, optional
+ The following keys are allowed:
+
+ * depends
+ * macros
+ * include_dirs
+ * extra_compiler_args
+ * extra_f77_compile_args
+ * extra_f90_compile_args
+ * f2py_options
+ * language
+
+ """
+ self._add_library(name, sources, None, build_info)
+
+ dist = self.get_distribution()
+ if dist is not None:
+ self.warn('distutils distribution has been initialized,'\
+ ' it may be too late to add a library '+ name)
+
+ def _add_library(self, name, sources, install_dir, build_info):
+ """Common implementation for add_library and add_installed_library. Do
+ not use directly"""
+ build_info = copy.copy(build_info)
+ build_info['sources'] = sources
+
+ # Sometimes, depends is not set up to an empty list by default, and if
+ # depends is not given to add_library, distutils barfs (#1134)
+ if not 'depends' in build_info:
+ build_info['depends'] = []
+
+ self._fix_paths_dict(build_info)
+
+ # Add to libraries list so that it is build with build_clib
+ self.libraries.append((name, build_info))
+
+ def add_installed_library(self, name, sources, install_dir, build_info=None):
+ """
+ Similar to add_library, but the specified library is installed.
+
+ Most C libraries used with `distutils` are only used to build python
+ extensions, but libraries built through this method will be installed
+ so that they can be reused by third-party packages.
+
+ Parameters
+ ----------
+ name : str
+ Name of the installed library.
+ sources : sequence
+ List of the library's source files. See `add_library` for details.
+ install_dir : str
+ Path to install the library, relative to the current sub-package.
+ build_info : dict, optional
+ The following keys are allowed:
+
+ * depends
+ * macros
+ * include_dirs
+ * extra_compiler_args
+ * extra_f77_compile_args
+ * extra_f90_compile_args
+ * f2py_options
+ * language
+
+ Returns
+ -------
+ None
+
+ See Also
+ --------
+ add_library, add_npy_pkg_config, get_info
+
+ Notes
+ -----
+ The best way to encode the options required to link against the specified
+ C libraries is to use a "libname.ini" file, and use `get_info` to
+ retrieve the required options (see `add_npy_pkg_config` for more
+ information).
+
+ """
+ if not build_info:
+ build_info = {}
+
+ install_dir = os.path.join(self.package_path, install_dir)
+ self._add_library(name, sources, install_dir, build_info)
+ self.installed_libraries.append(InstallableLib(name, build_info, install_dir))
+
+ def add_npy_pkg_config(self, template, install_dir, subst_dict=None):
+ """
+ Generate and install a npy-pkg config file from a template.
+
+ The config file generated from `template` is installed in the
+ given install directory, using `subst_dict` for variable substitution.
+
+ Parameters
+ ----------
+ template : str
+ The path of the template, relatively to the current package path.
+ install_dir : str
+ Where to install the npy-pkg config file, relatively to the current
+ package path.
+ subst_dict : dict, optional
+ If given, any string of the form ``@key@`` will be replaced by
+ ``subst_dict[key]`` in the template file when installed. The install
+ prefix is always available through the variable ``@prefix@``, since the
+ install prefix is not easy to get reliably from setup.py.
+
+ See also
+ --------
+ add_installed_library, get_info
+
+ Notes
+ -----
+ This works for both standard installs and in-place builds, i.e. the
+ ``@prefix@`` refer to the source directory for in-place builds.
+
+ Examples
+ --------
+ ::
+
+ config.add_npy_pkg_config('foo.ini.in', 'lib', {'foo': bar})
+
+ Assuming the foo.ini.in file has the following content::
+
+ [meta]
+ Name=@foo@
+ Version=1.0
+ Description=dummy description
+
+ [default]
+ Cflags=-I@prefix@/include
+ Libs=
+
+ The generated file will have the following content::
+
+ [meta]
+ Name=bar
+ Version=1.0
+ Description=dummy description
+
+ [default]
+ Cflags=-Iprefix_dir/include
+ Libs=
+
+ and will be installed as foo.ini in the 'lib' subpath.
+
+ When cross-compiling with numpy distutils, it might be necessary to
+ use modified npy-pkg-config files. Using the default/generated files
+ will link with the host libraries (i.e. libnpymath.a). For
+ cross-compilation you of-course need to link with target libraries,
+ while using the host Python installation.
+
+ You can copy out the numpy/core/lib/npy-pkg-config directory, add a
+ pkgdir value to the .ini files and set NPY_PKG_CONFIG_PATH environment
+ variable to point to the directory with the modified npy-pkg-config
+ files.
+
+ Example npymath.ini modified for cross-compilation::
+
+ [meta]
+ Name=npymath
+ Description=Portable, core math library implementing C99 standard
+ Version=0.1
+
+ [variables]
+ pkgname=numpy.core
+ pkgdir=/build/arm-linux-gnueabi/sysroot/usr/lib/python3.7/site-packages/numpy/core
+ prefix=${pkgdir}
+ libdir=${prefix}/lib
+ includedir=${prefix}/include
+
+ [default]
+ Libs=-L${libdir} -lnpymath
+ Cflags=-I${includedir}
+ Requires=mlib
+
+ [msvc]
+ Libs=/LIBPATH:${libdir} npymath.lib
+ Cflags=/INCLUDE:${includedir}
+ Requires=mlib
+
+ """
+ if subst_dict is None:
+ subst_dict = {}
+ template = os.path.join(self.package_path, template)
+
+ if self.name in self.installed_pkg_config:
+ self.installed_pkg_config[self.name].append((template, install_dir,
+ subst_dict))
+ else:
+ self.installed_pkg_config[self.name] = [(template, install_dir,
+ subst_dict)]
+
+
+ def add_scripts(self,*files):
+ """Add scripts to configuration.
+
+ Add the sequence of files to the beginning of the scripts list.
+ Scripts will be installed under the /bin/ directory.
+
+ """
+ scripts = self.paths(files)
+ dist = self.get_distribution()
+ if dist is not None:
+ if dist.scripts is None:
+ dist.scripts = []
+ dist.scripts.extend(scripts)
+ else:
+ self.scripts.extend(scripts)
+
+ def dict_append(self,**dict):
+ for key in self.list_keys:
+ a = getattr(self, key)
+ a.extend(dict.get(key, []))
+ for key in self.dict_keys:
+ a = getattr(self, key)
+ a.update(dict.get(key, {}))
+ known_keys = self.list_keys + self.dict_keys + self.extra_keys
+ for key in dict.keys():
+ if key not in known_keys:
+ a = getattr(self, key, None)
+ if a and a==dict[key]: continue
+ self.warn('Inheriting attribute %r=%r from %r' \
+ % (key, dict[key], dict.get('name', '?')))
+ setattr(self, key, dict[key])
+ self.extra_keys.append(key)
+ elif key in self.extra_keys:
+ self.info('Ignoring attempt to set %r (from %r to %r)' \
+ % (key, getattr(self, key), dict[key]))
+ elif key in known_keys:
+ # key is already processed above
+ pass
+ else:
+ raise ValueError("Don't know about key=%r" % (key))
+
+ def __str__(self):
+ from pprint import pformat
+ known_keys = self.list_keys + self.dict_keys + self.extra_keys
+ s = '<'+5*'-' + '\n'
+ s += 'Configuration of '+self.name+':\n'
+ known_keys.sort()
+ for k in known_keys:
+ a = getattr(self, k, None)
+ if a:
+ s += '%s = %s\n' % (k, pformat(a))
+ s += 5*'-' + '>'
+ return s
+
+ def get_config_cmd(self):
+ """
+ Returns the numpy.distutils config command instance.
+ """
+ cmd = get_cmd('config')
+ cmd.ensure_finalized()
+ cmd.dump_source = 0
+ cmd.noisy = 0
+ old_path = os.environ.get('PATH')
+ if old_path:
+ path = os.pathsep.join(['.', old_path])
+ os.environ['PATH'] = path
+ return cmd
+
+ def get_build_temp_dir(self):
+ """
+ Return a path to a temporary directory where temporary files should be
+ placed.
+ """
+ cmd = get_cmd('build')
+ cmd.ensure_finalized()
+ return cmd.build_temp
+
+ def have_f77c(self):
+ """Check for availability of Fortran 77 compiler.
+
+ Use it inside source generating function to ensure that
+ setup distribution instance has been initialized.
+
+ Notes
+ -----
+ True if a Fortran 77 compiler is available (because a simple Fortran 77
+ code was able to be compiled successfully).
+ """
+ simple_fortran_subroutine = '''
+ subroutine simple
+ end
+ '''
+ config_cmd = self.get_config_cmd()
+ flag = config_cmd.try_compile(simple_fortran_subroutine, lang='f77')
+ return flag
+
+ def have_f90c(self):
+ """Check for availability of Fortran 90 compiler.
+
+ Use it inside source generating function to ensure that
+ setup distribution instance has been initialized.
+
+ Notes
+ -----
+ True if a Fortran 90 compiler is available (because a simple Fortran
+ 90 code was able to be compiled successfully)
+ """
+ simple_fortran_subroutine = '''
+ subroutine simple
+ end
+ '''
+ config_cmd = self.get_config_cmd()
+ flag = config_cmd.try_compile(simple_fortran_subroutine, lang='f90')
+ return flag
+
+ def append_to(self, extlib):
+ """Append libraries, include_dirs to extension or library item.
+ """
+ if is_sequence(extlib):
+ lib_name, build_info = extlib
+ dict_append(build_info,
+ libraries=self.libraries,
+ include_dirs=self.include_dirs)
+ else:
+ from numpy.distutils.core import Extension
+ assert isinstance(extlib, Extension), repr(extlib)
+ extlib.libraries.extend(self.libraries)
+ extlib.include_dirs.extend(self.include_dirs)
+
+ def _get_svn_revision(self, path):
+ """Return path's SVN revision number.
+ """
+ try:
+ output = subprocess.check_output(['svnversion'], cwd=path)
+ except (subprocess.CalledProcessError, OSError):
+ pass
+ else:
+ m = re.match(rb'(?P\d+)', output)
+ if m:
+ return int(m.group('revision'))
+
+ if sys.platform=='win32' and os.environ.get('SVN_ASP_DOT_NET_HACK', None):
+ entries = njoin(path, '_svn', 'entries')
+ else:
+ entries = njoin(path, '.svn', 'entries')
+ if os.path.isfile(entries):
+ with open(entries) as f:
+ fstr = f.read()
+ if fstr[:5] == '\d+)"', fstr)
+ if m:
+ return int(m.group('revision'))
+ else: # non-xml entries file --- check to be sure that
+ m = re.search(r'dir[\n\r]+(?P\d+)', fstr)
+ if m:
+ return int(m.group('revision'))
+ return None
+
+ def _get_hg_revision(self, path):
+ """Return path's Mercurial revision number.
+ """
+ try:
+ output = subprocess.check_output(
+ ['hg', 'identify', '--num'], cwd=path)
+ except (subprocess.CalledProcessError, OSError):
+ pass
+ else:
+ m = re.match(rb'(?P\d+)', output)
+ if m:
+ return int(m.group('revision'))
+
+ branch_fn = njoin(path, '.hg', 'branch')
+ branch_cache_fn = njoin(path, '.hg', 'branch.cache')
+
+ if os.path.isfile(branch_fn):
+ branch0 = None
+ with open(branch_fn) as f:
+ revision0 = f.read().strip()
+
+ branch_map = {}
+ with open(branch_cache_fn) as f:
+ for line in f:
+ branch1, revision1 = line.split()[:2]
+ if revision1==revision0:
+ branch0 = branch1
+ try:
+ revision1 = int(revision1)
+ except ValueError:
+ continue
+ branch_map[branch1] = revision1
+
+ return branch_map.get(branch0)
+
+ return None
+
+
+ def get_version(self, version_file=None, version_variable=None):
+ """Try to get version string of a package.
+
+ Return a version string of the current package or None if the version
+ information could not be detected.
+
+ Notes
+ -----
+ This method scans files named
+ __version__.py, _version.py, version.py, and
+ __svn_version__.py for string variables version, __version__, and
+ _version, until a version number is found.
+ """
+ version = getattr(self, 'version', None)
+ if version is not None:
+ return version
+
+ # Get version from version file.
+ if version_file is None:
+ files = ['__version__.py',
+ self.name.split('.')[-1]+'_version.py',
+ 'version.py',
+ '__svn_version__.py',
+ '__hg_version__.py']
+ else:
+ files = [version_file]
+ if version_variable is None:
+ version_vars = ['version',
+ '__version__',
+ self.name.split('.')[-1]+'_version']
+ else:
+ version_vars = [version_variable]
+ for f in files:
+ fn = njoin(self.local_path, f)
+ if os.path.isfile(fn):
+ info = ('.py', 'U', 1)
+ name = os.path.splitext(os.path.basename(fn))[0]
+ n = dot_join(self.name, name)
+ try:
+ version_module = exec_mod_from_location(
+ '_'.join(n.split('.')), fn)
+ except ImportError as e:
+ self.warn(str(e))
+ version_module = None
+ if version_module is None:
+ continue
+
+ for a in version_vars:
+ version = getattr(version_module, a, None)
+ if version is not None:
+ break
+
+ # Try if versioneer module
+ try:
+ version = version_module.get_versions()['version']
+ except AttributeError:
+ pass
+
+ if version is not None:
+ break
+
+ if version is not None:
+ self.version = version
+ return version
+
+ # Get version as SVN or Mercurial revision number
+ revision = self._get_svn_revision(self.local_path)
+ if revision is None:
+ revision = self._get_hg_revision(self.local_path)
+
+ if revision is not None:
+ version = str(revision)
+ self.version = version
+
+ return version
+
+ def make_svn_version_py(self, delete=True):
+ """Appends a data function to the data_files list that will generate
+ __svn_version__.py file to the current package directory.
+
+ Generate package __svn_version__.py file from SVN revision number,
+ it will be removed after python exits but will be available
+ when sdist, etc commands are executed.
+
+ Notes
+ -----
+ If __svn_version__.py existed before, nothing is done.
+
+ This is
+ intended for working with source directories that are in an SVN
+ repository.
+ """
+ target = njoin(self.local_path, '__svn_version__.py')
+ revision = self._get_svn_revision(self.local_path)
+ if os.path.isfile(target) or revision is None:
+ return
+ else:
+ def generate_svn_version_py():
+ if not os.path.isfile(target):
+ version = str(revision)
+ self.info('Creating %s (version=%r)' % (target, version))
+ with open(target, 'w') as f:
+ f.write('version = %r\n' % (version))
+
+ def rm_file(f=target,p=self.info):
+ if delete:
+ try: os.remove(f); p('removed '+f)
+ except OSError: pass
+ try: os.remove(f+'c'); p('removed '+f+'c')
+ except OSError: pass
+
+ atexit.register(rm_file)
+
+ return target
+
+ self.add_data_files(('', generate_svn_version_py()))
+
+ def make_hg_version_py(self, delete=True):
+ """Appends a data function to the data_files list that will generate
+ __hg_version__.py file to the current package directory.
+
+ Generate package __hg_version__.py file from Mercurial revision,
+ it will be removed after python exits but will be available
+ when sdist, etc commands are executed.
+
+ Notes
+ -----
+ If __hg_version__.py existed before, nothing is done.
+
+ This is intended for working with source directories that are
+ in an Mercurial repository.
+ """
+ target = njoin(self.local_path, '__hg_version__.py')
+ revision = self._get_hg_revision(self.local_path)
+ if os.path.isfile(target) or revision is None:
+ return
+ else:
+ def generate_hg_version_py():
+ if not os.path.isfile(target):
+ version = str(revision)
+ self.info('Creating %s (version=%r)' % (target, version))
+ with open(target, 'w') as f:
+ f.write('version = %r\n' % (version))
+
+ def rm_file(f=target,p=self.info):
+ if delete:
+ try: os.remove(f); p('removed '+f)
+ except OSError: pass
+ try: os.remove(f+'c'); p('removed '+f+'c')
+ except OSError: pass
+
+ atexit.register(rm_file)
+
+ return target
+
+ self.add_data_files(('', generate_hg_version_py()))
+
+ def make_config_py(self,name='__config__'):
+ """Generate package __config__.py file containing system_info
+ information used during building the package.
+
+ This file is installed to the
+ package installation directory.
+
+ """
+ self.py_modules.append((self.name, name, generate_config_py))
+
+ def get_info(self,*names):
+ """Get resources information.
+
+ Return information (from system_info.get_info) for all of the names in
+ the argument list in a single dictionary.
+ """
+ from .system_info import get_info, dict_append
+ info_dict = {}
+ for a in names:
+ dict_append(info_dict,**get_info(a))
+ return info_dict
+
+
+def get_cmd(cmdname, _cache={}):
+ if cmdname not in _cache:
+ import distutils.core
+ dist = distutils.core._setup_distribution
+ if dist is None:
+ from distutils.errors import DistutilsInternalError
+ raise DistutilsInternalError(
+ 'setup distribution instance not initialized')
+ cmd = dist.get_command_obj(cmdname)
+ _cache[cmdname] = cmd
+ return _cache[cmdname]
+
+def get_numpy_include_dirs():
+ # numpy_include_dirs are set by numpy/core/setup.py, otherwise []
+ include_dirs = Configuration.numpy_include_dirs[:]
+ if not include_dirs:
+ import numpy
+ include_dirs = [ numpy.get_include() ]
+ # else running numpy/core/setup.py
+ return include_dirs
+
+def get_npy_pkg_dir():
+ """Return the path where to find the npy-pkg-config directory.
+
+ If the NPY_PKG_CONFIG_PATH environment variable is set, the value of that
+ is returned. Otherwise, a path inside the location of the numpy module is
+ returned.
+
+ The NPY_PKG_CONFIG_PATH can be useful when cross-compiling, maintaining
+ customized npy-pkg-config .ini files for the cross-compilation
+ environment, and using them when cross-compiling.
+
+ """
+ d = os.environ.get('NPY_PKG_CONFIG_PATH')
+ if d is not None:
+ return d
+ spec = importlib.util.find_spec('numpy')
+ d = os.path.join(os.path.dirname(spec.origin),
+ 'core', 'lib', 'npy-pkg-config')
+ return d
+
+def get_pkg_info(pkgname, dirs=None):
+ """
+ Return library info for the given package.
+
+ Parameters
+ ----------
+ pkgname : str
+ Name of the package (should match the name of the .ini file, without
+ the extension, e.g. foo for the file foo.ini).
+ dirs : sequence, optional
+ If given, should be a sequence of additional directories where to look
+ for npy-pkg-config files. Those directories are searched prior to the
+ NumPy directory.
+
+ Returns
+ -------
+ pkginfo : class instance
+ The `LibraryInfo` instance containing the build information.
+
+ Raises
+ ------
+ PkgNotFound
+ If the package is not found.
+
+ See Also
+ --------
+ Configuration.add_npy_pkg_config, Configuration.add_installed_library,
+ get_info
+
+ """
+ from numpy.distutils.npy_pkg_config import read_config
+
+ if dirs:
+ dirs.append(get_npy_pkg_dir())
+ else:
+ dirs = [get_npy_pkg_dir()]
+ return read_config(pkgname, dirs)
+
+def get_info(pkgname, dirs=None):
+ """
+ Return an info dict for a given C library.
+
+ The info dict contains the necessary options to use the C library.
+
+ Parameters
+ ----------
+ pkgname : str
+ Name of the package (should match the name of the .ini file, without
+ the extension, e.g. foo for the file foo.ini).
+ dirs : sequence, optional
+ If given, should be a sequence of additional directories where to look
+ for npy-pkg-config files. Those directories are searched prior to the
+ NumPy directory.
+
+ Returns
+ -------
+ info : dict
+ The dictionary with build information.
+
+ Raises
+ ------
+ PkgNotFound
+ If the package is not found.
+
+ See Also
+ --------
+ Configuration.add_npy_pkg_config, Configuration.add_installed_library,
+ get_pkg_info
+
+ Examples
+ --------
+ To get the necessary information for the npymath library from NumPy:
+
+ >>> npymath_info = np.distutils.misc_util.get_info('npymath')
+ >>> npymath_info #doctest: +SKIP
+ {'define_macros': [], 'libraries': ['npymath'], 'library_dirs':
+ ['.../numpy/core/lib'], 'include_dirs': ['.../numpy/core/include']}
+
+ This info dict can then be used as input to a `Configuration` instance::
+
+ config.add_extension('foo', sources=['foo.c'], extra_info=npymath_info)
+
+ """
+ from numpy.distutils.npy_pkg_config import parse_flags
+ pkg_info = get_pkg_info(pkgname, dirs)
+
+ # Translate LibraryInfo instance into a build_info dict
+ info = parse_flags(pkg_info.cflags())
+ for k, v in parse_flags(pkg_info.libs()).items():
+ info[k].extend(v)
+
+ # add_extension extra_info argument is ANAL
+ info['define_macros'] = info['macros']
+ del info['macros']
+ del info['ignored']
+
+ return info
+
+def is_bootstrapping():
+ import builtins
+
+ try:
+ builtins.__NUMPY_SETUP__
+ return True
+ except AttributeError:
+ return False
+
+
+#########################
+
+def default_config_dict(name = None, parent_name = None, local_path=None):
+ """Return a configuration dictionary for usage in
+ configuration() function defined in file setup_.py.
+ """
+ import warnings
+ warnings.warn('Use Configuration(%r,%r,top_path=%r) instead of '\
+ 'deprecated default_config_dict(%r,%r,%r)'
+ % (name, parent_name, local_path,
+ name, parent_name, local_path,
+ ), stacklevel=2)
+ c = Configuration(name, parent_name, local_path)
+ return c.todict()
+
+
+def dict_append(d, **kws):
+ for k, v in kws.items():
+ if k in d:
+ ov = d[k]
+ if isinstance(ov, str):
+ d[k] = v
+ else:
+ d[k].extend(v)
+ else:
+ d[k] = v
+
+def appendpath(prefix, path):
+ if os.path.sep != '/':
+ prefix = prefix.replace('/', os.path.sep)
+ path = path.replace('/', os.path.sep)
+ drive = ''
+ if os.path.isabs(path):
+ drive = os.path.splitdrive(prefix)[0]
+ absprefix = os.path.splitdrive(os.path.abspath(prefix))[1]
+ pathdrive, path = os.path.splitdrive(path)
+ d = os.path.commonprefix([absprefix, path])
+ if os.path.join(absprefix[:len(d)], absprefix[len(d):]) != absprefix \
+ or os.path.join(path[:len(d)], path[len(d):]) != path:
+ # Handle invalid paths
+ d = os.path.dirname(d)
+ subpath = path[len(d):]
+ if os.path.isabs(subpath):
+ subpath = subpath[1:]
+ else:
+ subpath = path
+ return os.path.normpath(njoin(drive + prefix, subpath))
+
+def generate_config_py(target):
+ """Generate config.py file containing system_info information
+ used during building the package.
+
+ Usage:
+ config['py_modules'].append((packagename, '__config__',generate_config_py))
+ """
+ from numpy.distutils.system_info import system_info
+ from distutils.dir_util import mkpath
+ mkpath(os.path.dirname(target))
+ with open(target, 'w') as f:
+ f.write('# This file is generated by numpy\'s %s\n' % (os.path.basename(sys.argv[0])))
+ f.write('# It contains system_info results at the time of building this package.\n')
+ f.write('__all__ = ["get_info","show"]\n\n')
+
+ # For gfortran+msvc combination, extra shared libraries may exist
+ f.write(textwrap.dedent("""
+ import os
+ import sys
+
+ extra_dll_dir = os.path.join(os.path.dirname(__file__), '.libs')
+
+ if sys.platform == 'win32' and os.path.isdir(extra_dll_dir):
+ os.add_dll_directory(extra_dll_dir)
+
+ """))
+
+ for k, i in system_info.saved_results.items():
+ f.write('%s=%r\n' % (k, i))
+ f.write(textwrap.dedent(r'''
+ def get_info(name):
+ g = globals()
+ return g.get(name, g.get(name + "_info", {}))
+
+ def show():
+ """
+ Show libraries in the system on which NumPy was built.
+
+ Print information about various resources (libraries, library
+ directories, include directories, etc.) in the system on which
+ NumPy was built.
+
+ See Also
+ --------
+ get_include : Returns the directory containing NumPy C
+ header files.
+
+ Notes
+ -----
+ 1. Classes specifying the information to be printed are defined
+ in the `numpy.distutils.system_info` module.
+
+ Information may include:
+
+ * ``language``: language used to write the libraries (mostly
+ C or f77)
+ * ``libraries``: names of libraries found in the system
+ * ``library_dirs``: directories containing the libraries
+ * ``include_dirs``: directories containing library header files
+ * ``src_dirs``: directories containing library source files
+ * ``define_macros``: preprocessor macros used by
+ ``distutils.setup``
+ * ``baseline``: minimum CPU features required
+ * ``found``: dispatched features supported in the system
+ * ``not found``: dispatched features that are not supported
+ in the system
+
+ 2. NumPy BLAS/LAPACK Installation Notes
+
+ Installing a numpy wheel (``pip install numpy`` or force it
+ via ``pip install numpy --only-binary :numpy: numpy``) includes
+ an OpenBLAS implementation of the BLAS and LAPACK linear algebra
+ APIs. In this case, ``library_dirs`` reports the original build
+ time configuration as compiled with gcc/gfortran; at run time
+ the OpenBLAS library is in
+ ``site-packages/numpy.libs/`` (linux), or
+ ``site-packages/numpy/.dylibs/`` (macOS), or
+ ``site-packages/numpy/.libs/`` (windows).
+
+ Installing numpy from source
+ (``pip install numpy --no-binary numpy``) searches for BLAS and
+ LAPACK dynamic link libraries at build time as influenced by
+ environment variables NPY_BLAS_LIBS, NPY_CBLAS_LIBS, and
+ NPY_LAPACK_LIBS; or NPY_BLAS_ORDER and NPY_LAPACK_ORDER;
+ or the optional file ``~/.numpy-site.cfg``.
+ NumPy remembers those locations and expects to load the same
+ libraries at run-time.
+ In NumPy 1.21+ on macOS, 'accelerate' (Apple's Accelerate BLAS
+ library) is in the default build-time search order after
+ 'openblas'.
+
+ Examples
+ --------
+ >>> import numpy as np
+ >>> np.show_config()
+ blas_opt_info:
+ language = c
+ define_macros = [('HAVE_CBLAS', None)]
+ libraries = ['openblas', 'openblas']
+ library_dirs = ['/usr/local/lib']
+ """
+ from numpy.core._multiarray_umath import (
+ __cpu_features__, __cpu_baseline__, __cpu_dispatch__
+ )
+ for name,info_dict in globals().items():
+ if name[0] == "_" or type(info_dict) is not type({}): continue
+ print(name + ":")
+ if not info_dict:
+ print(" NOT AVAILABLE")
+ for k,v in info_dict.items():
+ v = str(v)
+ if k == "sources" and len(v) > 200:
+ v = v[:60] + " ...\n... " + v[-60:]
+ print(" %s = %s" % (k,v))
+
+ features_found, features_not_found = [], []
+ for feature in __cpu_dispatch__:
+ if __cpu_features__[feature]:
+ features_found.append(feature)
+ else:
+ features_not_found.append(feature)
+
+ print("Supported SIMD extensions in this NumPy install:")
+ print(" baseline = %s" % (','.join(__cpu_baseline__)))
+ print(" found = %s" % (','.join(features_found)))
+ print(" not found = %s" % (','.join(features_not_found)))
+
+ '''))
+
+ return target
+
+def msvc_version(compiler):
+ """Return version major and minor of compiler instance if it is
+ MSVC, raise an exception otherwise."""
+ if not compiler.compiler_type == "msvc":
+ raise ValueError("Compiler instance is not msvc (%s)"\
+ % compiler.compiler_type)
+ return compiler._MSVCCompiler__version
+
+def get_build_architecture():
+ # Importing distutils.msvccompiler triggers a warning on non-Windows
+ # systems, so delay the import to here.
+ from distutils.msvccompiler import get_build_architecture
+ return get_build_architecture()
+
+
+_cxx_ignore_flags = {'-Werror=implicit-function-declaration', '-std=c99'}
+
+
+def sanitize_cxx_flags(cxxflags):
+ '''
+ Some flags are valid for C but not C++. Prune them.
+ '''
+ return [flag for flag in cxxflags if flag not in _cxx_ignore_flags]
+
+
+def exec_mod_from_location(modname, modfile):
+ '''
+ Use importlib machinery to import a module `modname` from the file
+ `modfile`. Depending on the `spec.loader`, the module may not be
+ registered in sys.modules.
+ '''
+ spec = importlib.util.spec_from_file_location(modname, modfile)
+ foo = importlib.util.module_from_spec(spec)
+ spec.loader.exec_module(foo)
+ return foo
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/npy_pkg_config.py b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/npy_pkg_config.py
new file mode 100644
index 0000000000000000000000000000000000000000..f6e3ad3974ca63115e1f8124e743235bb300f1a1
--- /dev/null
+++ b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/npy_pkg_config.py
@@ -0,0 +1,437 @@
+import sys
+import re
+import os
+
+from configparser import RawConfigParser
+
+__all__ = ['FormatError', 'PkgNotFound', 'LibraryInfo', 'VariableSet',
+ 'read_config', 'parse_flags']
+
+_VAR = re.compile(r'\$\{([a-zA-Z0-9_-]+)\}')
+
+class FormatError(OSError):
+ """
+ Exception thrown when there is a problem parsing a configuration file.
+
+ """
+ def __init__(self, msg):
+ self.msg = msg
+
+ def __str__(self):
+ return self.msg
+
+class PkgNotFound(OSError):
+ """Exception raised when a package can not be located."""
+ def __init__(self, msg):
+ self.msg = msg
+
+ def __str__(self):
+ return self.msg
+
+def parse_flags(line):
+ """
+ Parse a line from a config file containing compile flags.
+
+ Parameters
+ ----------
+ line : str
+ A single line containing one or more compile flags.
+
+ Returns
+ -------
+ d : dict
+ Dictionary of parsed flags, split into relevant categories.
+ These categories are the keys of `d`:
+
+ * 'include_dirs'
+ * 'library_dirs'
+ * 'libraries'
+ * 'macros'
+ * 'ignored'
+
+ """
+ d = {'include_dirs': [], 'library_dirs': [], 'libraries': [],
+ 'macros': [], 'ignored': []}
+
+ flags = (' ' + line).split(' -')
+ for flag in flags:
+ flag = '-' + flag
+ if len(flag) > 0:
+ if flag.startswith('-I'):
+ d['include_dirs'].append(flag[2:].strip())
+ elif flag.startswith('-L'):
+ d['library_dirs'].append(flag[2:].strip())
+ elif flag.startswith('-l'):
+ d['libraries'].append(flag[2:].strip())
+ elif flag.startswith('-D'):
+ d['macros'].append(flag[2:].strip())
+ else:
+ d['ignored'].append(flag)
+
+ return d
+
+def _escape_backslash(val):
+ return val.replace('\\', '\\\\')
+
+class LibraryInfo:
+ """
+ Object containing build information about a library.
+
+ Parameters
+ ----------
+ name : str
+ The library name.
+ description : str
+ Description of the library.
+ version : str
+ Version string.
+ sections : dict
+ The sections of the configuration file for the library. The keys are
+ the section headers, the values the text under each header.
+ vars : class instance
+ A `VariableSet` instance, which contains ``(name, value)`` pairs for
+ variables defined in the configuration file for the library.
+ requires : sequence, optional
+ The required libraries for the library to be installed.
+
+ Notes
+ -----
+ All input parameters (except "sections" which is a method) are available as
+ attributes of the same name.
+
+ """
+ def __init__(self, name, description, version, sections, vars, requires=None):
+ self.name = name
+ self.description = description
+ if requires:
+ self.requires = requires
+ else:
+ self.requires = []
+ self.version = version
+ self._sections = sections
+ self.vars = vars
+
+ def sections(self):
+ """
+ Return the section headers of the config file.
+
+ Parameters
+ ----------
+ None
+
+ Returns
+ -------
+ keys : list of str
+ The list of section headers.
+
+ """
+ return list(self._sections.keys())
+
+ def cflags(self, section="default"):
+ val = self.vars.interpolate(self._sections[section]['cflags'])
+ return _escape_backslash(val)
+
+ def libs(self, section="default"):
+ val = self.vars.interpolate(self._sections[section]['libs'])
+ return _escape_backslash(val)
+
+ def __str__(self):
+ m = ['Name: %s' % self.name, 'Description: %s' % self.description]
+ if self.requires:
+ m.append('Requires:')
+ else:
+ m.append('Requires: %s' % ",".join(self.requires))
+ m.append('Version: %s' % self.version)
+
+ return "\n".join(m)
+
+class VariableSet:
+ """
+ Container object for the variables defined in a config file.
+
+ `VariableSet` can be used as a plain dictionary, with the variable names
+ as keys.
+
+ Parameters
+ ----------
+ d : dict
+ Dict of items in the "variables" section of the configuration file.
+
+ """
+ def __init__(self, d):
+ self._raw_data = dict([(k, v) for k, v in d.items()])
+
+ self._re = {}
+ self._re_sub = {}
+
+ self._init_parse()
+
+ def _init_parse(self):
+ for k, v in self._raw_data.items():
+ self._init_parse_var(k, v)
+
+ def _init_parse_var(self, name, value):
+ self._re[name] = re.compile(r'\$\{%s\}' % name)
+ self._re_sub[name] = value
+
+ def interpolate(self, value):
+ # Brute force: we keep interpolating until there is no '${var}' anymore
+ # or until interpolated string is equal to input string
+ def _interpolate(value):
+ for k in self._re.keys():
+ value = self._re[k].sub(self._re_sub[k], value)
+ return value
+ while _VAR.search(value):
+ nvalue = _interpolate(value)
+ if nvalue == value:
+ break
+ value = nvalue
+
+ return value
+
+ def variables(self):
+ """
+ Return the list of variable names.
+
+ Parameters
+ ----------
+ None
+
+ Returns
+ -------
+ names : list of str
+ The names of all variables in the `VariableSet` instance.
+
+ """
+ return list(self._raw_data.keys())
+
+ # Emulate a dict to set/get variables values
+ def __getitem__(self, name):
+ return self._raw_data[name]
+
+ def __setitem__(self, name, value):
+ self._raw_data[name] = value
+ self._init_parse_var(name, value)
+
+def parse_meta(config):
+ if not config.has_section('meta'):
+ raise FormatError("No meta section found !")
+
+ d = dict(config.items('meta'))
+
+ for k in ['name', 'description', 'version']:
+ if not k in d:
+ raise FormatError("Option %s (section [meta]) is mandatory, "
+ "but not found" % k)
+
+ if not 'requires' in d:
+ d['requires'] = []
+
+ return d
+
+def parse_variables(config):
+ if not config.has_section('variables'):
+ raise FormatError("No variables section found !")
+
+ d = {}
+
+ for name, value in config.items("variables"):
+ d[name] = value
+
+ return VariableSet(d)
+
+def parse_sections(config):
+ return meta_d, r
+
+def pkg_to_filename(pkg_name):
+ return "%s.ini" % pkg_name
+
+def parse_config(filename, dirs=None):
+ if dirs:
+ filenames = [os.path.join(d, filename) for d in dirs]
+ else:
+ filenames = [filename]
+
+ config = RawConfigParser()
+
+ n = config.read(filenames)
+ if not len(n) >= 1:
+ raise PkgNotFound("Could not find file(s) %s" % str(filenames))
+
+ # Parse meta and variables sections
+ meta = parse_meta(config)
+
+ vars = {}
+ if config.has_section('variables'):
+ for name, value in config.items("variables"):
+ vars[name] = _escape_backslash(value)
+
+ # Parse "normal" sections
+ secs = [s for s in config.sections() if not s in ['meta', 'variables']]
+ sections = {}
+
+ requires = {}
+ for s in secs:
+ d = {}
+ if config.has_option(s, "requires"):
+ requires[s] = config.get(s, 'requires')
+
+ for name, value in config.items(s):
+ d[name] = value
+ sections[s] = d
+
+ return meta, vars, sections, requires
+
+def _read_config_imp(filenames, dirs=None):
+ def _read_config(f):
+ meta, vars, sections, reqs = parse_config(f, dirs)
+ # recursively add sections and variables of required libraries
+ for rname, rvalue in reqs.items():
+ nmeta, nvars, nsections, nreqs = _read_config(pkg_to_filename(rvalue))
+
+ # Update var dict for variables not in 'top' config file
+ for k, v in nvars.items():
+ if not k in vars:
+ vars[k] = v
+
+ # Update sec dict
+ for oname, ovalue in nsections[rname].items():
+ if ovalue:
+ sections[rname][oname] += ' %s' % ovalue
+
+ return meta, vars, sections, reqs
+
+ meta, vars, sections, reqs = _read_config(filenames)
+
+ # FIXME: document this. If pkgname is defined in the variables section, and
+ # there is no pkgdir variable defined, pkgdir is automatically defined to
+ # the path of pkgname. This requires the package to be imported to work
+ if not 'pkgdir' in vars and "pkgname" in vars:
+ pkgname = vars["pkgname"]
+ if not pkgname in sys.modules:
+ raise ValueError("You should import %s to get information on %s" %
+ (pkgname, meta["name"]))
+
+ mod = sys.modules[pkgname]
+ vars["pkgdir"] = _escape_backslash(os.path.dirname(mod.__file__))
+
+ return LibraryInfo(name=meta["name"], description=meta["description"],
+ version=meta["version"], sections=sections, vars=VariableSet(vars))
+
+# Trivial cache to cache LibraryInfo instances creation. To be really
+# efficient, the cache should be handled in read_config, since a same file can
+# be parsed many time outside LibraryInfo creation, but I doubt this will be a
+# problem in practice
+_CACHE = {}
+def read_config(pkgname, dirs=None):
+ """
+ Return library info for a package from its configuration file.
+
+ Parameters
+ ----------
+ pkgname : str
+ Name of the package (should match the name of the .ini file, without
+ the extension, e.g. foo for the file foo.ini).
+ dirs : sequence, optional
+ If given, should be a sequence of directories - usually including
+ the NumPy base directory - where to look for npy-pkg-config files.
+
+ Returns
+ -------
+ pkginfo : class instance
+ The `LibraryInfo` instance containing the build information.
+
+ Raises
+ ------
+ PkgNotFound
+ If the package is not found.
+
+ See Also
+ --------
+ misc_util.get_info, misc_util.get_pkg_info
+
+ Examples
+ --------
+ >>> npymath_info = np.distutils.npy_pkg_config.read_config('npymath')
+ >>> type(npymath_info)
+
+ >>> print(npymath_info)
+ Name: npymath
+ Description: Portable, core math library implementing C99 standard
+ Requires:
+ Version: 0.1 #random
+
+ """
+ try:
+ return _CACHE[pkgname]
+ except KeyError:
+ v = _read_config_imp(pkg_to_filename(pkgname), dirs)
+ _CACHE[pkgname] = v
+ return v
+
+# TODO:
+# - implements version comparison (modversion + atleast)
+
+# pkg-config simple emulator - useful for debugging, and maybe later to query
+# the system
+if __name__ == '__main__':
+ from optparse import OptionParser
+ import glob
+
+ parser = OptionParser()
+ parser.add_option("--cflags", dest="cflags", action="store_true",
+ help="output all preprocessor and compiler flags")
+ parser.add_option("--libs", dest="libs", action="store_true",
+ help="output all linker flags")
+ parser.add_option("--use-section", dest="section",
+ help="use this section instead of default for options")
+ parser.add_option("--version", dest="version", action="store_true",
+ help="output version")
+ parser.add_option("--atleast-version", dest="min_version",
+ help="Minimal version")
+ parser.add_option("--list-all", dest="list_all", action="store_true",
+ help="Minimal version")
+ parser.add_option("--define-variable", dest="define_variable",
+ help="Replace variable with the given value")
+
+ (options, args) = parser.parse_args(sys.argv)
+
+ if len(args) < 2:
+ raise ValueError("Expect package name on the command line:")
+
+ if options.list_all:
+ files = glob.glob("*.ini")
+ for f in files:
+ info = read_config(f)
+ print("%s\t%s - %s" % (info.name, info.name, info.description))
+
+ pkg_name = args[1]
+ d = os.environ.get('NPY_PKG_CONFIG_PATH')
+ if d:
+ info = read_config(pkg_name, ['numpy/core/lib/npy-pkg-config', '.', d])
+ else:
+ info = read_config(pkg_name, ['numpy/core/lib/npy-pkg-config', '.'])
+
+ if options.section:
+ section = options.section
+ else:
+ section = "default"
+
+ if options.define_variable:
+ m = re.search(r'([\S]+)=([\S]+)', options.define_variable)
+ if not m:
+ raise ValueError("--define-variable option should be of "
+ "the form --define-variable=foo=bar")
+ else:
+ name = m.group(1)
+ value = m.group(2)
+ info.vars[name] = value
+
+ if options.cflags:
+ print(info.cflags(section))
+ if options.libs:
+ print(info.libs(section))
+ if options.version:
+ print(info.version)
+ if options.min_version:
+ print(info.version >= options.min_version)
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/numpy_distribution.py b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/numpy_distribution.py
new file mode 100644
index 0000000000000000000000000000000000000000..ea8182659cb1af718879de305798b62c23bf3346
--- /dev/null
+++ b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/numpy_distribution.py
@@ -0,0 +1,17 @@
+# XXX: Handle setuptools ?
+from distutils.core import Distribution
+
+# This class is used because we add new files (sconscripts, and so on) with the
+# scons command
+class NumpyDistribution(Distribution):
+ def __init__(self, attrs = None):
+ # A list of (sconscripts, pre_hook, post_hook, src, parent_names)
+ self.scons_data = []
+ # A list of installable libraries
+ self.installed_libraries = []
+ # A dict of pkg_config files to generate/install
+ self.installed_pkg_config = {}
+ Distribution.__init__(self, attrs)
+
+ def has_scons_scripts(self):
+ return bool(self.scons_data)
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/pathccompiler.py b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/pathccompiler.py
new file mode 100644
index 0000000000000000000000000000000000000000..48051810ee218fb037cc15ccec05293e5ae9bb6b
--- /dev/null
+++ b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/pathccompiler.py
@@ -0,0 +1,21 @@
+from distutils.unixccompiler import UnixCCompiler
+
+class PathScaleCCompiler(UnixCCompiler):
+
+ """
+ PathScale compiler compatible with an gcc built Python.
+ """
+
+ compiler_type = 'pathcc'
+ cc_exe = 'pathcc'
+ cxx_exe = 'pathCC'
+
+ def __init__ (self, verbose=0, dry_run=0, force=0):
+ UnixCCompiler.__init__ (self, verbose, dry_run, force)
+ cc_compiler = self.cc_exe
+ cxx_compiler = self.cxx_exe
+ self.set_executables(compiler=cc_compiler,
+ compiler_so=cc_compiler,
+ compiler_cxx=cxx_compiler,
+ linker_exe=cc_compiler,
+ linker_so=cc_compiler + ' -shared')
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/setup.py b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/setup.py
new file mode 100644
index 0000000000000000000000000000000000000000..522756fc9db359002c7208b75094b103323f13c6
--- /dev/null
+++ b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/setup.py
@@ -0,0 +1,17 @@
+#!/usr/bin/env python3
+def configuration(parent_package='',top_path=None):
+ from numpy.distutils.misc_util import Configuration
+ config = Configuration('distutils', parent_package, top_path)
+ config.add_subpackage('command')
+ config.add_subpackage('fcompiler')
+ config.add_subpackage('tests')
+ config.add_data_files('site.cfg')
+ config.add_data_files('mingw/gfortran_vs2003_hack.c')
+ config.add_data_dir('checks')
+ config.add_data_files('*.pyi')
+ config.make_config_py()
+ return config
+
+if __name__ == '__main__':
+ from numpy.distutils.core import setup
+ setup(configuration=configuration)
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/system_info.py b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/system_info.py
new file mode 100644
index 0000000000000000000000000000000000000000..feb28f61cf070c9dfc0b2fc6f205f477f6a66c8b
--- /dev/null
+++ b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/system_info.py
@@ -0,0 +1,3271 @@
+#!/usr/bin/env python3
+"""
+This file defines a set of system_info classes for getting
+information about various resources (libraries, library directories,
+include directories, etc.) in the system. Usage:
+ info_dict = get_info()
+ where is a string 'atlas','x11','fftw','lapack','blas',
+ 'lapack_src', 'blas_src', etc. For a complete list of allowed names,
+ see the definition of get_info() function below.
+
+ Returned info_dict is a dictionary which is compatible with
+ distutils.setup keyword arguments. If info_dict == {}, then the
+ asked resource is not available (system_info could not find it).
+
+ Several *_info classes specify an environment variable to specify
+ the locations of software. When setting the corresponding environment
+ variable to 'None' then the software will be ignored, even when it
+ is available in system.
+
+Global parameters:
+ system_info.search_static_first - search static libraries (.a)
+ in precedence to shared ones (.so, .sl) if enabled.
+ system_info.verbosity - output the results to stdout if enabled.
+
+The file 'site.cfg' is looked for in
+
+1) Directory of main setup.py file being run.
+2) Home directory of user running the setup.py file as ~/.numpy-site.cfg
+3) System wide directory (location of this file...)
+
+The first one found is used to get system configuration options The
+format is that used by ConfigParser (i.e., Windows .INI style). The
+section ALL is not intended for general use.
+
+Appropriate defaults are used if nothing is specified.
+
+The order of finding the locations of resources is the following:
+ 1. environment variable
+ 2. section in site.cfg
+ 3. DEFAULT section in site.cfg
+ 4. System default search paths (see ``default_*`` variables below).
+Only the first complete match is returned.
+
+Currently, the following classes are available, along with their section names:
+
+ Numeric_info:Numeric
+ _numpy_info:Numeric
+ _pkg_config_info:None
+ accelerate_info:accelerate
+ accelerate_lapack_info:accelerate
+ agg2_info:agg2
+ amd_info:amd
+ atlas_3_10_blas_info:atlas
+ atlas_3_10_blas_threads_info:atlas
+ atlas_3_10_info:atlas
+ atlas_3_10_threads_info:atlas
+ atlas_blas_info:atlas
+ atlas_blas_threads_info:atlas
+ atlas_info:atlas
+ atlas_threads_info:atlas
+ blas64__opt_info:ALL # usage recommended (general ILP64 BLAS, 64_ symbol suffix)
+ blas_ilp64_opt_info:ALL # usage recommended (general ILP64 BLAS)
+ blas_ilp64_plain_opt_info:ALL # usage recommended (general ILP64 BLAS, no symbol suffix)
+ blas_info:blas
+ blas_mkl_info:mkl
+ blas_ssl2_info:ssl2
+ blas_opt_info:ALL # usage recommended
+ blas_src_info:blas_src
+ blis_info:blis
+ boost_python_info:boost_python
+ dfftw_info:fftw
+ dfftw_threads_info:fftw
+ djbfft_info:djbfft
+ f2py_info:ALL
+ fft_opt_info:ALL
+ fftw2_info:fftw
+ fftw3_info:fftw3
+ fftw_info:fftw
+ fftw_threads_info:fftw
+ flame_info:flame
+ freetype2_info:freetype2
+ gdk_2_info:gdk_2
+ gdk_info:gdk
+ gdk_pixbuf_2_info:gdk_pixbuf_2
+ gdk_pixbuf_xlib_2_info:gdk_pixbuf_xlib_2
+ gdk_x11_2_info:gdk_x11_2
+ gtkp_2_info:gtkp_2
+ gtkp_x11_2_info:gtkp_x11_2
+ lapack64__opt_info:ALL # usage recommended (general ILP64 LAPACK, 64_ symbol suffix)
+ lapack_atlas_3_10_info:atlas
+ lapack_atlas_3_10_threads_info:atlas
+ lapack_atlas_info:atlas
+ lapack_atlas_threads_info:atlas
+ lapack_ilp64_opt_info:ALL # usage recommended (general ILP64 LAPACK)
+ lapack_ilp64_plain_opt_info:ALL # usage recommended (general ILP64 LAPACK, no symbol suffix)
+ lapack_info:lapack
+ lapack_mkl_info:mkl
+ lapack_ssl2_info:ssl2
+ lapack_opt_info:ALL # usage recommended
+ lapack_src_info:lapack_src
+ mkl_info:mkl
+ ssl2_info:ssl2
+ numarray_info:numarray
+ numerix_info:numerix
+ numpy_info:numpy
+ openblas64__info:openblas64_
+ openblas64__lapack_info:openblas64_
+ openblas_clapack_info:openblas
+ openblas_ilp64_info:openblas_ilp64
+ openblas_ilp64_lapack_info:openblas_ilp64
+ openblas_info:openblas
+ openblas_lapack_info:openblas
+ sfftw_info:fftw
+ sfftw_threads_info:fftw
+ system_info:ALL
+ umfpack_info:umfpack
+ wx_info:wx
+ x11_info:x11
+ xft_info:xft
+
+Note that blas_opt_info and lapack_opt_info honor the NPY_BLAS_ORDER
+and NPY_LAPACK_ORDER environment variables to determine the order in which
+specific BLAS and LAPACK libraries are searched for.
+
+This search (or autodetection) can be bypassed by defining the environment
+variables NPY_BLAS_LIBS and NPY_LAPACK_LIBS, which should then contain the
+exact linker flags to use (language will be set to F77). Building against
+Netlib BLAS/LAPACK or stub files, in order to be able to switch BLAS and LAPACK
+implementations at runtime. If using this to build NumPy itself, it is
+recommended to also define NPY_CBLAS_LIBS (assuming your BLAS library has a
+CBLAS interface) to enable CBLAS usage for matrix multiplication (unoptimized
+otherwise).
+
+Example:
+----------
+[DEFAULT]
+# default section
+library_dirs = /usr/lib:/usr/local/lib:/opt/lib
+include_dirs = /usr/include:/usr/local/include:/opt/include
+src_dirs = /usr/local/src:/opt/src
+# search static libraries (.a) in preference to shared ones (.so)
+search_static_first = 0
+
+[fftw]
+libraries = rfftw, fftw
+
+[atlas]
+library_dirs = /usr/lib/3dnow:/usr/lib/3dnow/atlas
+# for overriding the names of the atlas libraries
+libraries = lapack, f77blas, cblas, atlas
+
+[x11]
+library_dirs = /usr/X11R6/lib
+include_dirs = /usr/X11R6/include
+----------
+
+Note that the ``libraries`` key is the default setting for libraries.
+
+Authors:
+ Pearu Peterson , February 2002
+ David M. Cooke , April 2002
+
+Copyright 2002 Pearu Peterson all rights reserved,
+Pearu Peterson
+Permission to use, modify, and distribute this software is given under the
+terms of the NumPy (BSD style) license. See LICENSE.txt that came with
+this distribution for specifics.
+
+NO WARRANTY IS EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
+
+"""
+import sys
+import os
+import re
+import copy
+import warnings
+import subprocess
+import textwrap
+
+from glob import glob
+from functools import reduce
+from configparser import NoOptionError
+from configparser import RawConfigParser as ConfigParser
+# It seems that some people are importing ConfigParser from here so is
+# good to keep its class name. Use of RawConfigParser is needed in
+# order to be able to load path names with percent in them, like
+# `feature%2Fcool` which is common on git flow branch names.
+
+from distutils.errors import DistutilsError
+from distutils.dist import Distribution
+import sysconfig
+from numpy.distutils import log
+from distutils.util import get_platform
+
+from numpy.distutils.exec_command import (
+ find_executable, filepath_from_subprocess_output,
+ )
+from numpy.distutils.misc_util import (is_sequence, is_string,
+ get_shared_lib_extension)
+from numpy.distutils.command.config import config as cmd_config
+from numpy.distutils import customized_ccompiler as _customized_ccompiler
+from numpy.distutils import _shell_utils
+import distutils.ccompiler
+import tempfile
+import shutil
+
+__all__ = ['system_info']
+
+# Determine number of bits
+import platform
+_bits = {'32bit': 32, '64bit': 64}
+platform_bits = _bits[platform.architecture()[0]]
+
+
+global_compiler = None
+
+def customized_ccompiler():
+ global global_compiler
+ if not global_compiler:
+ global_compiler = _customized_ccompiler()
+ return global_compiler
+
+
+def _c_string_literal(s):
+ """
+ Convert a python string into a literal suitable for inclusion into C code
+ """
+ # only these three characters are forbidden in C strings
+ s = s.replace('\\', r'\\')
+ s = s.replace('"', r'\"')
+ s = s.replace('\n', r'\n')
+ return '"{}"'.format(s)
+
+
+def libpaths(paths, bits):
+ """Return a list of library paths valid on 32 or 64 bit systems.
+
+ Inputs:
+ paths : sequence
+ A sequence of strings (typically paths)
+ bits : int
+ An integer, the only valid values are 32 or 64. A ValueError exception
+ is raised otherwise.
+
+ Examples:
+
+ Consider a list of directories
+ >>> paths = ['/usr/X11R6/lib','/usr/X11/lib','/usr/lib']
+
+ For a 32-bit platform, this is already valid:
+ >>> np.distutils.system_info.libpaths(paths,32)
+ ['/usr/X11R6/lib', '/usr/X11/lib', '/usr/lib']
+
+ On 64 bits, we prepend the '64' postfix
+ >>> np.distutils.system_info.libpaths(paths,64)
+ ['/usr/X11R6/lib64', '/usr/X11R6/lib', '/usr/X11/lib64', '/usr/X11/lib',
+ '/usr/lib64', '/usr/lib']
+ """
+ if bits not in (32, 64):
+ raise ValueError("Invalid bit size in libpaths: 32 or 64 only")
+
+ # Handle 32bit case
+ if bits == 32:
+ return paths
+
+ # Handle 64bit case
+ out = []
+ for p in paths:
+ out.extend([p + '64', p])
+
+ return out
+
+
+if sys.platform == 'win32':
+ default_lib_dirs = ['C:\\',
+ os.path.join(sysconfig.get_config_var('exec_prefix'),
+ 'libs')]
+ default_runtime_dirs = []
+ default_include_dirs = []
+ default_src_dirs = ['.']
+ default_x11_lib_dirs = []
+ default_x11_include_dirs = []
+ _include_dirs = [
+ 'include',
+ 'include/suitesparse',
+ ]
+ _lib_dirs = [
+ 'lib',
+ ]
+
+ _include_dirs = [d.replace('/', os.sep) for d in _include_dirs]
+ _lib_dirs = [d.replace('/', os.sep) for d in _lib_dirs]
+ def add_system_root(library_root):
+ """Add a package manager root to the include directories"""
+ global default_lib_dirs
+ global default_include_dirs
+
+ library_root = os.path.normpath(library_root)
+
+ default_lib_dirs.extend(
+ os.path.join(library_root, d) for d in _lib_dirs)
+ default_include_dirs.extend(
+ os.path.join(library_root, d) for d in _include_dirs)
+
+ # VCpkg is the de-facto package manager on windows for C/C++
+ # libraries. If it is on the PATH, then we append its paths here.
+ vcpkg = shutil.which('vcpkg')
+ if vcpkg:
+ vcpkg_dir = os.path.dirname(vcpkg)
+ if platform.architecture()[0] == '32bit':
+ specifier = 'x86'
+ else:
+ specifier = 'x64'
+
+ vcpkg_installed = os.path.join(vcpkg_dir, 'installed')
+ for vcpkg_root in [
+ os.path.join(vcpkg_installed, specifier + '-windows'),
+ os.path.join(vcpkg_installed, specifier + '-windows-static'),
+ ]:
+ add_system_root(vcpkg_root)
+
+ # Conda is another popular package manager that provides libraries
+ conda = shutil.which('conda')
+ if conda:
+ conda_dir = os.path.dirname(conda)
+ add_system_root(os.path.join(conda_dir, '..', 'Library'))
+ add_system_root(os.path.join(conda_dir, 'Library'))
+
+else:
+ default_lib_dirs = libpaths(['/usr/local/lib', '/opt/lib', '/usr/lib',
+ '/opt/local/lib', '/sw/lib'], platform_bits)
+ default_runtime_dirs = []
+ default_include_dirs = ['/usr/local/include',
+ '/opt/include',
+ # path of umfpack under macports
+ '/opt/local/include/ufsparse',
+ '/opt/local/include', '/sw/include',
+ '/usr/include/suitesparse']
+ default_src_dirs = ['.', '/usr/local/src', '/opt/src', '/sw/src']
+
+ default_x11_lib_dirs = libpaths(['/usr/X11R6/lib', '/usr/X11/lib',
+ '/usr/lib'], platform_bits)
+ default_x11_include_dirs = ['/usr/X11R6/include', '/usr/X11/include']
+
+ if os.path.exists('/usr/lib/X11'):
+ globbed_x11_dir = glob('/usr/lib/*/libX11.so')
+ if globbed_x11_dir:
+ x11_so_dir = os.path.split(globbed_x11_dir[0])[0]
+ default_x11_lib_dirs.extend([x11_so_dir, '/usr/lib/X11'])
+ default_x11_include_dirs.extend(['/usr/lib/X11/include',
+ '/usr/include/X11'])
+
+ with open(os.devnull, 'w') as tmp:
+ try:
+ p = subprocess.Popen(["gcc", "-print-multiarch"], stdout=subprocess.PIPE,
+ stderr=tmp)
+ except (OSError, DistutilsError):
+ # OSError if gcc is not installed, or SandboxViolation (DistutilsError
+ # subclass) if an old setuptools bug is triggered (see gh-3160).
+ pass
+ else:
+ triplet = str(p.communicate()[0].decode().strip())
+ if p.returncode == 0:
+ # gcc supports the "-print-multiarch" option
+ default_x11_lib_dirs += [os.path.join("/usr/lib/", triplet)]
+ default_lib_dirs += [os.path.join("/usr/lib/", triplet)]
+
+
+if os.path.join(sys.prefix, 'lib') not in default_lib_dirs:
+ default_lib_dirs.insert(0, os.path.join(sys.prefix, 'lib'))
+ default_include_dirs.append(os.path.join(sys.prefix, 'include'))
+ default_src_dirs.append(os.path.join(sys.prefix, 'src'))
+
+default_lib_dirs = [_m for _m in default_lib_dirs if os.path.isdir(_m)]
+default_runtime_dirs = [_m for _m in default_runtime_dirs if os.path.isdir(_m)]
+default_include_dirs = [_m for _m in default_include_dirs if os.path.isdir(_m)]
+default_src_dirs = [_m for _m in default_src_dirs if os.path.isdir(_m)]
+
+so_ext = get_shared_lib_extension()
+
+
+def get_standard_file(fname):
+ """Returns a list of files named 'fname' from
+ 1) System-wide directory (directory-location of this module)
+ 2) Users HOME directory (os.environ['HOME'])
+ 3) Local directory
+ """
+ # System-wide file
+ filenames = []
+ try:
+ f = __file__
+ except NameError:
+ f = sys.argv[0]
+ sysfile = os.path.join(os.path.split(os.path.abspath(f))[0],
+ fname)
+ if os.path.isfile(sysfile):
+ filenames.append(sysfile)
+
+ # Home directory
+ # And look for the user config file
+ try:
+ f = os.path.expanduser('~')
+ except KeyError:
+ pass
+ else:
+ user_file = os.path.join(f, fname)
+ if os.path.isfile(user_file):
+ filenames.append(user_file)
+
+ # Local file
+ if os.path.isfile(fname):
+ filenames.append(os.path.abspath(fname))
+
+ return filenames
+
+
+def _parse_env_order(base_order, env):
+ """ Parse an environment variable `env` by splitting with "," and only returning elements from `base_order`
+
+ This method will sequence the environment variable and check for their
+ individual elements in `base_order`.
+
+ The items in the environment variable may be negated via '^item' or '!itema,itemb'.
+ It must start with ^/! to negate all options.
+
+ Raises
+ ------
+ ValueError: for mixed negated and non-negated orders or multiple negated orders
+
+ Parameters
+ ----------
+ base_order : list of str
+ the base list of orders
+ env : str
+ the environment variable to be parsed, if none is found, `base_order` is returned
+
+ Returns
+ -------
+ allow_order : list of str
+ allowed orders in lower-case
+ unknown_order : list of str
+ for values not overlapping with `base_order`
+ """
+ order_str = os.environ.get(env, None)
+
+ # ensure all base-orders are lower-case (for easier comparison)
+ base_order = [order.lower() for order in base_order]
+ if order_str is None:
+ return base_order, []
+
+ neg = order_str.startswith('^') or order_str.startswith('!')
+ # Check format
+ order_str_l = list(order_str)
+ sum_neg = order_str_l.count('^') + order_str_l.count('!')
+ if neg:
+ if sum_neg > 1:
+ raise ValueError(f"Environment variable '{env}' may only contain a single (prefixed) negation: {order_str}")
+ # remove prefix
+ order_str = order_str[1:]
+ elif sum_neg > 0:
+ raise ValueError(f"Environment variable '{env}' may not mix negated an non-negated items: {order_str}")
+
+ # Split and lower case
+ orders = order_str.lower().split(',')
+
+ # to inform callee about non-overlapping elements
+ unknown_order = []
+
+ # if negated, we have to remove from the order
+ if neg:
+ allow_order = base_order.copy()
+
+ for order in orders:
+ if not order:
+ continue
+
+ if order not in base_order:
+ unknown_order.append(order)
+ continue
+
+ if order in allow_order:
+ allow_order.remove(order)
+
+ else:
+ allow_order = []
+
+ for order in orders:
+ if not order:
+ continue
+
+ if order not in base_order:
+ unknown_order.append(order)
+ continue
+
+ if order not in allow_order:
+ allow_order.append(order)
+
+ return allow_order, unknown_order
+
+
+def get_info(name, notfound_action=0):
+ """
+ notfound_action:
+ 0 - do nothing
+ 1 - display warning message
+ 2 - raise error
+ """
+ cl = {'armpl': armpl_info,
+ 'blas_armpl': blas_armpl_info,
+ 'lapack_armpl': lapack_armpl_info,
+ 'fftw3_armpl': fftw3_armpl_info,
+ 'atlas': atlas_info, # use lapack_opt or blas_opt instead
+ 'atlas_threads': atlas_threads_info, # ditto
+ 'atlas_blas': atlas_blas_info,
+ 'atlas_blas_threads': atlas_blas_threads_info,
+ 'lapack_atlas': lapack_atlas_info, # use lapack_opt instead
+ 'lapack_atlas_threads': lapack_atlas_threads_info, # ditto
+ 'atlas_3_10': atlas_3_10_info, # use lapack_opt or blas_opt instead
+ 'atlas_3_10_threads': atlas_3_10_threads_info, # ditto
+ 'atlas_3_10_blas': atlas_3_10_blas_info,
+ 'atlas_3_10_blas_threads': atlas_3_10_blas_threads_info,
+ 'lapack_atlas_3_10': lapack_atlas_3_10_info, # use lapack_opt instead
+ 'lapack_atlas_3_10_threads': lapack_atlas_3_10_threads_info, # ditto
+ 'flame': flame_info, # use lapack_opt instead
+ 'mkl': mkl_info,
+ 'ssl2': ssl2_info,
+ # openblas which may or may not have embedded lapack
+ 'openblas': openblas_info, # use blas_opt instead
+ # openblas with embedded lapack
+ 'openblas_lapack': openblas_lapack_info, # use blas_opt instead
+ 'openblas_clapack': openblas_clapack_info, # use blas_opt instead
+ 'blis': blis_info, # use blas_opt instead
+ 'lapack_mkl': lapack_mkl_info, # use lapack_opt instead
+ 'blas_mkl': blas_mkl_info, # use blas_opt instead
+ 'lapack_ssl2': lapack_ssl2_info,
+ 'blas_ssl2': blas_ssl2_info,
+ 'accelerate': accelerate_info, # use blas_opt instead
+ 'accelerate_lapack': accelerate_lapack_info,
+ 'openblas64_': openblas64__info,
+ 'openblas64__lapack': openblas64__lapack_info,
+ 'openblas_ilp64': openblas_ilp64_info,
+ 'openblas_ilp64_lapack': openblas_ilp64_lapack_info,
+ 'x11': x11_info,
+ 'fft_opt': fft_opt_info,
+ 'fftw': fftw_info,
+ 'fftw2': fftw2_info,
+ 'fftw3': fftw3_info,
+ 'dfftw': dfftw_info,
+ 'sfftw': sfftw_info,
+ 'fftw_threads': fftw_threads_info,
+ 'dfftw_threads': dfftw_threads_info,
+ 'sfftw_threads': sfftw_threads_info,
+ 'djbfft': djbfft_info,
+ 'blas': blas_info, # use blas_opt instead
+ 'lapack': lapack_info, # use lapack_opt instead
+ 'lapack_src': lapack_src_info,
+ 'blas_src': blas_src_info,
+ 'numpy': numpy_info,
+ 'f2py': f2py_info,
+ 'Numeric': Numeric_info,
+ 'numeric': Numeric_info,
+ 'numarray': numarray_info,
+ 'numerix': numerix_info,
+ 'lapack_opt': lapack_opt_info,
+ 'lapack_ilp64_opt': lapack_ilp64_opt_info,
+ 'lapack_ilp64_plain_opt': lapack_ilp64_plain_opt_info,
+ 'lapack64__opt': lapack64__opt_info,
+ 'blas_opt': blas_opt_info,
+ 'blas_ilp64_opt': blas_ilp64_opt_info,
+ 'blas_ilp64_plain_opt': blas_ilp64_plain_opt_info,
+ 'blas64__opt': blas64__opt_info,
+ 'boost_python': boost_python_info,
+ 'agg2': agg2_info,
+ 'wx': wx_info,
+ 'gdk_pixbuf_xlib_2': gdk_pixbuf_xlib_2_info,
+ 'gdk-pixbuf-xlib-2.0': gdk_pixbuf_xlib_2_info,
+ 'gdk_pixbuf_2': gdk_pixbuf_2_info,
+ 'gdk-pixbuf-2.0': gdk_pixbuf_2_info,
+ 'gdk': gdk_info,
+ 'gdk_2': gdk_2_info,
+ 'gdk-2.0': gdk_2_info,
+ 'gdk_x11_2': gdk_x11_2_info,
+ 'gdk-x11-2.0': gdk_x11_2_info,
+ 'gtkp_x11_2': gtkp_x11_2_info,
+ 'gtk+-x11-2.0': gtkp_x11_2_info,
+ 'gtkp_2': gtkp_2_info,
+ 'gtk+-2.0': gtkp_2_info,
+ 'xft': xft_info,
+ 'freetype2': freetype2_info,
+ 'umfpack': umfpack_info,
+ 'amd': amd_info,
+ }.get(name.lower(), system_info)
+ return cl().get_info(notfound_action)
+
+
+class NotFoundError(DistutilsError):
+ """Some third-party program or library is not found."""
+
+
+class AliasedOptionError(DistutilsError):
+ """
+ Aliases entries in config files should not be existing.
+ In section '{section}' we found multiple appearances of options {options}."""
+
+
+class AtlasNotFoundError(NotFoundError):
+ """
+ Atlas (http://github.com/math-atlas/math-atlas) libraries not found.
+ Directories to search for the libraries can be specified in the
+ numpy/distutils/site.cfg file (section [atlas]) or by setting
+ the ATLAS environment variable."""
+
+
+class FlameNotFoundError(NotFoundError):
+ """
+ FLAME (http://www.cs.utexas.edu/~flame/web/) libraries not found.
+ Directories to search for the libraries can be specified in the
+ numpy/distutils/site.cfg file (section [flame])."""
+
+
+class LapackNotFoundError(NotFoundError):
+ """
+ Lapack (http://www.netlib.org/lapack/) libraries not found.
+ Directories to search for the libraries can be specified in the
+ numpy/distutils/site.cfg file (section [lapack]) or by setting
+ the LAPACK environment variable."""
+
+
+class LapackSrcNotFoundError(LapackNotFoundError):
+ """
+ Lapack (http://www.netlib.org/lapack/) sources not found.
+ Directories to search for the sources can be specified in the
+ numpy/distutils/site.cfg file (section [lapack_src]) or by setting
+ the LAPACK_SRC environment variable."""
+
+
+class LapackILP64NotFoundError(NotFoundError):
+ """
+ 64-bit Lapack libraries not found.
+ Known libraries in numpy/distutils/site.cfg file are:
+ openblas64_, openblas_ilp64
+ """
+
+class BlasOptNotFoundError(NotFoundError):
+ """
+ Optimized (vendor) Blas libraries are not found.
+ Falls back to netlib Blas library which has worse performance.
+ A better performance should be easily gained by switching
+ Blas library."""
+
+class BlasNotFoundError(NotFoundError):
+ """
+ Blas (http://www.netlib.org/blas/) libraries not found.
+ Directories to search for the libraries can be specified in the
+ numpy/distutils/site.cfg file (section [blas]) or by setting
+ the BLAS environment variable."""
+
+class BlasILP64NotFoundError(NotFoundError):
+ """
+ 64-bit Blas libraries not found.
+ Known libraries in numpy/distutils/site.cfg file are:
+ openblas64_, openblas_ilp64
+ """
+
+class BlasSrcNotFoundError(BlasNotFoundError):
+ """
+ Blas (http://www.netlib.org/blas/) sources not found.
+ Directories to search for the sources can be specified in the
+ numpy/distutils/site.cfg file (section [blas_src]) or by setting
+ the BLAS_SRC environment variable."""
+
+
+class FFTWNotFoundError(NotFoundError):
+ """
+ FFTW (http://www.fftw.org/) libraries not found.
+ Directories to search for the libraries can be specified in the
+ numpy/distutils/site.cfg file (section [fftw]) or by setting
+ the FFTW environment variable."""
+
+
+class DJBFFTNotFoundError(NotFoundError):
+ """
+ DJBFFT (https://cr.yp.to/djbfft.html) libraries not found.
+ Directories to search for the libraries can be specified in the
+ numpy/distutils/site.cfg file (section [djbfft]) or by setting
+ the DJBFFT environment variable."""
+
+
+class NumericNotFoundError(NotFoundError):
+ """
+ Numeric (https://www.numpy.org/) module not found.
+ Get it from above location, install it, and retry setup.py."""
+
+
+class X11NotFoundError(NotFoundError):
+ """X11 libraries not found."""
+
+
+class UmfpackNotFoundError(NotFoundError):
+ """
+ UMFPACK sparse solver (https://www.cise.ufl.edu/research/sparse/umfpack/)
+ not found. Directories to search for the libraries can be specified in the
+ numpy/distutils/site.cfg file (section [umfpack]) or by setting
+ the UMFPACK environment variable."""
+
+
+class system_info:
+
+ """ get_info() is the only public method. Don't use others.
+ """
+ dir_env_var = None
+ # XXX: search_static_first is disabled by default, may disappear in
+ # future unless it is proved to be useful.
+ search_static_first = 0
+ # The base-class section name is a random word "ALL" and is not really
+ # intended for general use. It cannot be None nor can it be DEFAULT as
+ # these break the ConfigParser. See gh-15338
+ section = 'ALL'
+ saved_results = {}
+
+ notfounderror = NotFoundError
+
+ def __init__(self,
+ default_lib_dirs=default_lib_dirs,
+ default_include_dirs=default_include_dirs,
+ ):
+ self.__class__.info = {}
+ self.local_prefixes = []
+ defaults = {'library_dirs': os.pathsep.join(default_lib_dirs),
+ 'include_dirs': os.pathsep.join(default_include_dirs),
+ 'runtime_library_dirs': os.pathsep.join(default_runtime_dirs),
+ 'rpath': '',
+ 'src_dirs': os.pathsep.join(default_src_dirs),
+ 'search_static_first': str(self.search_static_first),
+ 'extra_compile_args': '', 'extra_link_args': ''}
+ self.cp = ConfigParser(defaults)
+ self.files = []
+ self.files.extend(get_standard_file('.numpy-site.cfg'))
+ self.files.extend(get_standard_file('site.cfg'))
+ self.parse_config_files()
+
+ if self.section is not None:
+ self.search_static_first = self.cp.getboolean(
+ self.section, 'search_static_first')
+ assert isinstance(self.search_static_first, int)
+
+ def parse_config_files(self):
+ self.cp.read(self.files)
+ if not self.cp.has_section(self.section):
+ if self.section is not None:
+ self.cp.add_section(self.section)
+
+ def calc_libraries_info(self):
+ libs = self.get_libraries()
+ dirs = self.get_lib_dirs()
+ # The extensions use runtime_library_dirs
+ r_dirs = self.get_runtime_lib_dirs()
+ # Intrinsic distutils use rpath, we simply append both entries
+ # as though they were one entry
+ r_dirs.extend(self.get_runtime_lib_dirs(key='rpath'))
+ info = {}
+ for lib in libs:
+ i = self.check_libs(dirs, [lib])
+ if i is not None:
+ dict_append(info, **i)
+ else:
+ log.info('Library %s was not found. Ignoring' % (lib))
+
+ if r_dirs:
+ i = self.check_libs(r_dirs, [lib])
+ if i is not None:
+ # Swap library keywords found to runtime_library_dirs
+ # the libraries are insisting on the user having defined
+ # them using the library_dirs, and not necessarily by
+ # runtime_library_dirs
+ del i['libraries']
+ i['runtime_library_dirs'] = i.pop('library_dirs')
+ dict_append(info, **i)
+ else:
+ log.info('Runtime library %s was not found. Ignoring' % (lib))
+
+ return info
+
+ def set_info(self, **info):
+ if info:
+ lib_info = self.calc_libraries_info()
+ dict_append(info, **lib_info)
+ # Update extra information
+ extra_info = self.calc_extra_info()
+ dict_append(info, **extra_info)
+ self.saved_results[self.__class__.__name__] = info
+
+ def get_option_single(self, *options):
+ """ Ensure that only one of `options` are found in the section
+
+ Parameters
+ ----------
+ *options : list of str
+ a list of options to be found in the section (``self.section``)
+
+ Returns
+ -------
+ str :
+ the option that is uniquely found in the section
+
+ Raises
+ ------
+ AliasedOptionError :
+ in case more than one of the options are found
+ """
+ found = [self.cp.has_option(self.section, opt) for opt in options]
+ if sum(found) == 1:
+ return options[found.index(True)]
+ elif sum(found) == 0:
+ # nothing is found anyways
+ return options[0]
+
+ # Else we have more than 1 key found
+ if AliasedOptionError.__doc__ is None:
+ raise AliasedOptionError()
+ raise AliasedOptionError(AliasedOptionError.__doc__.format(
+ section=self.section, options='[{}]'.format(', '.join(options))))
+
+
+ def has_info(self):
+ return self.__class__.__name__ in self.saved_results
+
+ def calc_extra_info(self):
+ """ Updates the information in the current information with
+ respect to these flags:
+ extra_compile_args
+ extra_link_args
+ """
+ info = {}
+ for key in ['extra_compile_args', 'extra_link_args']:
+ # Get values
+ opt = self.cp.get(self.section, key)
+ opt = _shell_utils.NativeParser.split(opt)
+ if opt:
+ tmp = {key: opt}
+ dict_append(info, **tmp)
+ return info
+
+ def get_info(self, notfound_action=0):
+ """ Return a dictionary with items that are compatible
+ with numpy.distutils.setup keyword arguments.
+ """
+ flag = 0
+ if not self.has_info():
+ flag = 1
+ log.info(self.__class__.__name__ + ':')
+ if hasattr(self, 'calc_info'):
+ self.calc_info()
+ if notfound_action:
+ if not self.has_info():
+ if notfound_action == 1:
+ warnings.warn(self.notfounderror.__doc__, stacklevel=2)
+ elif notfound_action == 2:
+ raise self.notfounderror(self.notfounderror.__doc__)
+ else:
+ raise ValueError(repr(notfound_action))
+
+ if not self.has_info():
+ log.info(' NOT AVAILABLE')
+ self.set_info()
+ else:
+ log.info(' FOUND:')
+
+ res = self.saved_results.get(self.__class__.__name__)
+ if log.get_threshold() <= log.INFO and flag:
+ for k, v in res.items():
+ v = str(v)
+ if k in ['sources', 'libraries'] and len(v) > 270:
+ v = v[:120] + '...\n...\n...' + v[-120:]
+ log.info(' %s = %s', k, v)
+ log.info('')
+
+ return copy.deepcopy(res)
+
+ def get_paths(self, section, key):
+ dirs = self.cp.get(section, key).split(os.pathsep)
+ env_var = self.dir_env_var
+ if env_var:
+ if is_sequence(env_var):
+ e0 = env_var[-1]
+ for e in env_var:
+ if e in os.environ:
+ e0 = e
+ break
+ if not env_var[0] == e0:
+ log.info('Setting %s=%s' % (env_var[0], e0))
+ env_var = e0
+ if env_var and env_var in os.environ:
+ d = os.environ[env_var]
+ if d == 'None':
+ log.info('Disabled %s: %s',
+ self.__class__.__name__, '(%s is None)'
+ % (env_var,))
+ return []
+ if os.path.isfile(d):
+ dirs = [os.path.dirname(d)] + dirs
+ l = getattr(self, '_lib_names', [])
+ if len(l) == 1:
+ b = os.path.basename(d)
+ b = os.path.splitext(b)[0]
+ if b[:3] == 'lib':
+ log.info('Replacing _lib_names[0]==%r with %r' \
+ % (self._lib_names[0], b[3:]))
+ self._lib_names[0] = b[3:]
+ else:
+ ds = d.split(os.pathsep)
+ ds2 = []
+ for d in ds:
+ if os.path.isdir(d):
+ ds2.append(d)
+ for dd in ['include', 'lib']:
+ d1 = os.path.join(d, dd)
+ if os.path.isdir(d1):
+ ds2.append(d1)
+ dirs = ds2 + dirs
+ default_dirs = self.cp.get(self.section, key).split(os.pathsep)
+ dirs.extend(default_dirs)
+ ret = []
+ for d in dirs:
+ if len(d) > 0 and not os.path.isdir(d):
+ warnings.warn('Specified path %s is invalid.' % d, stacklevel=2)
+ continue
+
+ if d not in ret:
+ ret.append(d)
+
+ log.debug('( %s = %s )', key, ':'.join(ret))
+ return ret
+
+ def get_lib_dirs(self, key='library_dirs'):
+ return self.get_paths(self.section, key)
+
+ def get_runtime_lib_dirs(self, key='runtime_library_dirs'):
+ path = self.get_paths(self.section, key)
+ if path == ['']:
+ path = []
+ return path
+
+ def get_include_dirs(self, key='include_dirs'):
+ return self.get_paths(self.section, key)
+
+ def get_src_dirs(self, key='src_dirs'):
+ return self.get_paths(self.section, key)
+
+ def get_libs(self, key, default):
+ try:
+ libs = self.cp.get(self.section, key)
+ except NoOptionError:
+ if not default:
+ return []
+ if is_string(default):
+ return [default]
+ return default
+ return [b for b in [a.strip() for a in libs.split(',')] if b]
+
+ def get_libraries(self, key='libraries'):
+ if hasattr(self, '_lib_names'):
+ return self.get_libs(key, default=self._lib_names)
+ else:
+ return self.get_libs(key, '')
+
+ def library_extensions(self):
+ c = customized_ccompiler()
+ static_exts = []
+ if c.compiler_type != 'msvc':
+ # MSVC doesn't understand binutils
+ static_exts.append('.a')
+ if sys.platform == 'win32':
+ static_exts.append('.lib') # .lib is used by MSVC and others
+ if self.search_static_first:
+ exts = static_exts + [so_ext]
+ else:
+ exts = [so_ext] + static_exts
+ if sys.platform == 'cygwin':
+ exts.append('.dll.a')
+ if sys.platform == 'darwin':
+ exts.append('.dylib')
+ return exts
+
+ def check_libs(self, lib_dirs, libs, opt_libs=[]):
+ """If static or shared libraries are available then return
+ their info dictionary.
+
+ Checks for all libraries as shared libraries first, then
+ static (or vice versa if self.search_static_first is True).
+ """
+ exts = self.library_extensions()
+ info = None
+ for ext in exts:
+ info = self._check_libs(lib_dirs, libs, opt_libs, [ext])
+ if info is not None:
+ break
+ if not info:
+ log.info(' libraries %s not found in %s', ','.join(libs),
+ lib_dirs)
+ return info
+
+ def check_libs2(self, lib_dirs, libs, opt_libs=[]):
+ """If static or shared libraries are available then return
+ their info dictionary.
+
+ Checks each library for shared or static.
+ """
+ exts = self.library_extensions()
+ info = self._check_libs(lib_dirs, libs, opt_libs, exts)
+ if not info:
+ log.info(' libraries %s not found in %s', ','.join(libs),
+ lib_dirs)
+
+ return info
+
+ def _find_lib(self, lib_dir, lib, exts):
+ assert is_string(lib_dir)
+ # under windows first try without 'lib' prefix
+ if sys.platform == 'win32':
+ lib_prefixes = ['', 'lib']
+ else:
+ lib_prefixes = ['lib']
+ # for each library name, see if we can find a file for it.
+ for ext in exts:
+ for prefix in lib_prefixes:
+ p = self.combine_paths(lib_dir, prefix + lib + ext)
+ if p:
+ break
+ if p:
+ assert len(p) == 1
+ # ??? splitext on p[0] would do this for cygwin
+ # doesn't seem correct
+ if ext == '.dll.a':
+ lib += '.dll'
+ if ext == '.lib':
+ lib = prefix + lib
+ return lib
+
+ return False
+
+ def _find_libs(self, lib_dirs, libs, exts):
+ # make sure we preserve the order of libs, as it can be important
+ found_dirs, found_libs = [], []
+ for lib in libs:
+ for lib_dir in lib_dirs:
+ found_lib = self._find_lib(lib_dir, lib, exts)
+ if found_lib:
+ found_libs.append(found_lib)
+ if lib_dir not in found_dirs:
+ found_dirs.append(lib_dir)
+ break
+ return found_dirs, found_libs
+
+ def _check_libs(self, lib_dirs, libs, opt_libs, exts):
+ """Find mandatory and optional libs in expected paths.
+
+ Missing optional libraries are silently forgotten.
+ """
+ if not is_sequence(lib_dirs):
+ lib_dirs = [lib_dirs]
+ # First, try to find the mandatory libraries
+ found_dirs, found_libs = self._find_libs(lib_dirs, libs, exts)
+ if len(found_libs) > 0 and len(found_libs) == len(libs):
+ # Now, check for optional libraries
+ opt_found_dirs, opt_found_libs = self._find_libs(lib_dirs, opt_libs, exts)
+ found_libs.extend(opt_found_libs)
+ for lib_dir in opt_found_dirs:
+ if lib_dir not in found_dirs:
+ found_dirs.append(lib_dir)
+ info = {'libraries': found_libs, 'library_dirs': found_dirs}
+ return info
+ else:
+ return None
+
+ def combine_paths(self, *args):
+ """Return a list of existing paths composed by all combinations
+ of items from the arguments.
+ """
+ return combine_paths(*args)
+
+
+class fft_opt_info(system_info):
+
+ def calc_info(self):
+ info = {}
+ fftw_info = get_info('fftw3') or get_info('fftw2') or get_info('dfftw')
+ djbfft_info = get_info('djbfft')
+ if fftw_info:
+ dict_append(info, **fftw_info)
+ if djbfft_info:
+ dict_append(info, **djbfft_info)
+ self.set_info(**info)
+ return
+
+
+class fftw_info(system_info):
+ #variables to override
+ section = 'fftw'
+ dir_env_var = 'FFTW'
+ notfounderror = FFTWNotFoundError
+ ver_info = [{'name':'fftw3',
+ 'libs':['fftw3'],
+ 'includes':['fftw3.h'],
+ 'macros':[('SCIPY_FFTW3_H', None)]},
+ {'name':'fftw2',
+ 'libs':['rfftw', 'fftw'],
+ 'includes':['fftw.h', 'rfftw.h'],
+ 'macros':[('SCIPY_FFTW_H', None)]}]
+
+ def calc_ver_info(self, ver_param):
+ """Returns True on successful version detection, else False"""
+ lib_dirs = self.get_lib_dirs()
+ incl_dirs = self.get_include_dirs()
+
+ opt = self.get_option_single(self.section + '_libs', 'libraries')
+ libs = self.get_libs(opt, ver_param['libs'])
+ info = self.check_libs(lib_dirs, libs)
+ if info is not None:
+ flag = 0
+ for d in incl_dirs:
+ if len(self.combine_paths(d, ver_param['includes'])) \
+ == len(ver_param['includes']):
+ dict_append(info, include_dirs=[d])
+ flag = 1
+ break
+ if flag:
+ dict_append(info, define_macros=ver_param['macros'])
+ else:
+ info = None
+ if info is not None:
+ self.set_info(**info)
+ return True
+ else:
+ log.info(' %s not found' % (ver_param['name']))
+ return False
+
+ def calc_info(self):
+ for i in self.ver_info:
+ if self.calc_ver_info(i):
+ break
+
+
+class fftw2_info(fftw_info):
+ #variables to override
+ section = 'fftw'
+ dir_env_var = 'FFTW'
+ notfounderror = FFTWNotFoundError
+ ver_info = [{'name':'fftw2',
+ 'libs':['rfftw', 'fftw'],
+ 'includes':['fftw.h', 'rfftw.h'],
+ 'macros':[('SCIPY_FFTW_H', None)]}
+ ]
+
+
+class fftw3_info(fftw_info):
+ #variables to override
+ section = 'fftw3'
+ dir_env_var = 'FFTW3'
+ notfounderror = FFTWNotFoundError
+ ver_info = [{'name':'fftw3',
+ 'libs':['fftw3'],
+ 'includes':['fftw3.h'],
+ 'macros':[('SCIPY_FFTW3_H', None)]},
+ ]
+
+
+class fftw3_armpl_info(fftw_info):
+ section = 'fftw3'
+ dir_env_var = 'ARMPL_DIR'
+ notfounderror = FFTWNotFoundError
+ ver_info = [{'name': 'fftw3',
+ 'libs': ['armpl_lp64_mp'],
+ 'includes': ['fftw3.h'],
+ 'macros': [('SCIPY_FFTW3_H', None)]}]
+
+
+class dfftw_info(fftw_info):
+ section = 'fftw'
+ dir_env_var = 'FFTW'
+ ver_info = [{'name':'dfftw',
+ 'libs':['drfftw', 'dfftw'],
+ 'includes':['dfftw.h', 'drfftw.h'],
+ 'macros':[('SCIPY_DFFTW_H', None)]}]
+
+
+class sfftw_info(fftw_info):
+ section = 'fftw'
+ dir_env_var = 'FFTW'
+ ver_info = [{'name':'sfftw',
+ 'libs':['srfftw', 'sfftw'],
+ 'includes':['sfftw.h', 'srfftw.h'],
+ 'macros':[('SCIPY_SFFTW_H', None)]}]
+
+
+class fftw_threads_info(fftw_info):
+ section = 'fftw'
+ dir_env_var = 'FFTW'
+ ver_info = [{'name':'fftw threads',
+ 'libs':['rfftw_threads', 'fftw_threads'],
+ 'includes':['fftw_threads.h', 'rfftw_threads.h'],
+ 'macros':[('SCIPY_FFTW_THREADS_H', None)]}]
+
+
+class dfftw_threads_info(fftw_info):
+ section = 'fftw'
+ dir_env_var = 'FFTW'
+ ver_info = [{'name':'dfftw threads',
+ 'libs':['drfftw_threads', 'dfftw_threads'],
+ 'includes':['dfftw_threads.h', 'drfftw_threads.h'],
+ 'macros':[('SCIPY_DFFTW_THREADS_H', None)]}]
+
+
+class sfftw_threads_info(fftw_info):
+ section = 'fftw'
+ dir_env_var = 'FFTW'
+ ver_info = [{'name':'sfftw threads',
+ 'libs':['srfftw_threads', 'sfftw_threads'],
+ 'includes':['sfftw_threads.h', 'srfftw_threads.h'],
+ 'macros':[('SCIPY_SFFTW_THREADS_H', None)]}]
+
+
+class djbfft_info(system_info):
+ section = 'djbfft'
+ dir_env_var = 'DJBFFT'
+ notfounderror = DJBFFTNotFoundError
+
+ def get_paths(self, section, key):
+ pre_dirs = system_info.get_paths(self, section, key)
+ dirs = []
+ for d in pre_dirs:
+ dirs.extend(self.combine_paths(d, ['djbfft']) + [d])
+ return [d for d in dirs if os.path.isdir(d)]
+
+ def calc_info(self):
+ lib_dirs = self.get_lib_dirs()
+ incl_dirs = self.get_include_dirs()
+ info = None
+ for d in lib_dirs:
+ p = self.combine_paths(d, ['djbfft.a'])
+ if p:
+ info = {'extra_objects': p}
+ break
+ p = self.combine_paths(d, ['libdjbfft.a', 'libdjbfft' + so_ext])
+ if p:
+ info = {'libraries': ['djbfft'], 'library_dirs': [d]}
+ break
+ if info is None:
+ return
+ for d in incl_dirs:
+ if len(self.combine_paths(d, ['fftc8.h', 'fftfreq.h'])) == 2:
+ dict_append(info, include_dirs=[d],
+ define_macros=[('SCIPY_DJBFFT_H', None)])
+ self.set_info(**info)
+ return
+ return
+
+
+class mkl_info(system_info):
+ section = 'mkl'
+ dir_env_var = 'MKLROOT'
+ _lib_mkl = ['mkl_rt']
+
+ def get_mkl_rootdir(self):
+ mklroot = os.environ.get('MKLROOT', None)
+ if mklroot is not None:
+ return mklroot
+ paths = os.environ.get('LD_LIBRARY_PATH', '').split(os.pathsep)
+ ld_so_conf = '/etc/ld.so.conf'
+ if os.path.isfile(ld_so_conf):
+ with open(ld_so_conf) as f:
+ for d in f:
+ d = d.strip()
+ if d:
+ paths.append(d)
+ intel_mkl_dirs = []
+ for path in paths:
+ path_atoms = path.split(os.sep)
+ for m in path_atoms:
+ if m.startswith('mkl'):
+ d = os.sep.join(path_atoms[:path_atoms.index(m) + 2])
+ intel_mkl_dirs.append(d)
+ break
+ for d in paths:
+ dirs = glob(os.path.join(d, 'mkl', '*'))
+ dirs += glob(os.path.join(d, 'mkl*'))
+ for sub_dir in dirs:
+ if os.path.isdir(os.path.join(sub_dir, 'lib')):
+ return sub_dir
+ return None
+
+ def __init__(self):
+ mklroot = self.get_mkl_rootdir()
+ if mklroot is None:
+ system_info.__init__(self)
+ else:
+ from .cpuinfo import cpu
+ if cpu.is_Itanium():
+ plt = '64'
+ elif cpu.is_Intel() and cpu.is_64bit():
+ plt = 'intel64'
+ else:
+ plt = '32'
+ system_info.__init__(
+ self,
+ default_lib_dirs=[os.path.join(mklroot, 'lib', plt)],
+ default_include_dirs=[os.path.join(mklroot, 'include')])
+
+ def calc_info(self):
+ lib_dirs = self.get_lib_dirs()
+ incl_dirs = self.get_include_dirs()
+ opt = self.get_option_single('mkl_libs', 'libraries')
+ mkl_libs = self.get_libs(opt, self._lib_mkl)
+ info = self.check_libs2(lib_dirs, mkl_libs)
+ if info is None:
+ return
+ dict_append(info,
+ define_macros=[('SCIPY_MKL_H', None),
+ ('HAVE_CBLAS', None)],
+ include_dirs=incl_dirs)
+ if sys.platform == 'win32':
+ pass # win32 has no pthread library
+ else:
+ dict_append(info, libraries=['pthread'])
+ self.set_info(**info)
+
+
+class lapack_mkl_info(mkl_info):
+ pass
+
+
+class blas_mkl_info(mkl_info):
+ pass
+
+
+class ssl2_info(system_info):
+ section = 'ssl2'
+ dir_env_var = 'SSL2_DIR'
+ # Multi-threaded version. Python itself must be built by Fujitsu compiler.
+ _lib_ssl2 = ['fjlapackexsve']
+ # Single-threaded version
+ #_lib_ssl2 = ['fjlapacksve']
+
+ def get_tcsds_rootdir(self):
+ tcsdsroot = os.environ.get('TCSDS_PATH', None)
+ if tcsdsroot is not None:
+ return tcsdsroot
+ return None
+
+ def __init__(self):
+ tcsdsroot = self.get_tcsds_rootdir()
+ if tcsdsroot is None:
+ system_info.__init__(self)
+ else:
+ system_info.__init__(
+ self,
+ default_lib_dirs=[os.path.join(tcsdsroot, 'lib64')],
+ default_include_dirs=[os.path.join(tcsdsroot,
+ 'clang-comp/include')])
+
+ def calc_info(self):
+ tcsdsroot = self.get_tcsds_rootdir()
+
+ lib_dirs = self.get_lib_dirs()
+ if lib_dirs is None:
+ lib_dirs = os.path.join(tcsdsroot, 'lib64')
+
+ incl_dirs = self.get_include_dirs()
+ if incl_dirs is None:
+ incl_dirs = os.path.join(tcsdsroot, 'clang-comp/include')
+
+ ssl2_libs = self.get_libs('ssl2_libs', self._lib_ssl2)
+
+ info = self.check_libs2(lib_dirs, ssl2_libs)
+ if info is None:
+ return
+ dict_append(info,
+ define_macros=[('HAVE_CBLAS', None),
+ ('HAVE_SSL2', 1)],
+ include_dirs=incl_dirs,)
+ self.set_info(**info)
+
+
+class lapack_ssl2_info(ssl2_info):
+ pass
+
+
+class blas_ssl2_info(ssl2_info):
+ pass
+
+
+
+class armpl_info(system_info):
+ section = 'armpl'
+ dir_env_var = 'ARMPL_DIR'
+ _lib_armpl = ['armpl_lp64_mp']
+
+ def calc_info(self):
+ lib_dirs = self.get_lib_dirs()
+ incl_dirs = self.get_include_dirs()
+ armpl_libs = self.get_libs('armpl_libs', self._lib_armpl)
+ info = self.check_libs2(lib_dirs, armpl_libs)
+ if info is None:
+ return
+ dict_append(info,
+ define_macros=[('SCIPY_MKL_H', None),
+ ('HAVE_CBLAS', None)],
+ include_dirs=incl_dirs)
+ self.set_info(**info)
+
+class lapack_armpl_info(armpl_info):
+ pass
+
+class blas_armpl_info(armpl_info):
+ pass
+
+
+class atlas_info(system_info):
+ section = 'atlas'
+ dir_env_var = 'ATLAS'
+ _lib_names = ['f77blas', 'cblas']
+ if sys.platform[:7] == 'freebsd':
+ _lib_atlas = ['atlas_r']
+ _lib_lapack = ['alapack_r']
+ else:
+ _lib_atlas = ['atlas']
+ _lib_lapack = ['lapack']
+
+ notfounderror = AtlasNotFoundError
+
+ def get_paths(self, section, key):
+ pre_dirs = system_info.get_paths(self, section, key)
+ dirs = []
+ for d in pre_dirs:
+ dirs.extend(self.combine_paths(d, ['atlas*', 'ATLAS*',
+ 'sse', '3dnow', 'sse2']) + [d])
+ return [d for d in dirs if os.path.isdir(d)]
+
+ def calc_info(self):
+ lib_dirs = self.get_lib_dirs()
+ info = {}
+ opt = self.get_option_single('atlas_libs', 'libraries')
+ atlas_libs = self.get_libs(opt, self._lib_names + self._lib_atlas)
+ lapack_libs = self.get_libs('lapack_libs', self._lib_lapack)
+ atlas = None
+ lapack = None
+ atlas_1 = None
+ for d in lib_dirs:
+ atlas = self.check_libs2(d, atlas_libs, [])
+ if atlas is not None:
+ lib_dirs2 = [d] + self.combine_paths(d, ['atlas*', 'ATLAS*'])
+ lapack = self.check_libs2(lib_dirs2, lapack_libs, [])
+ if lapack is not None:
+ break
+ if atlas:
+ atlas_1 = atlas
+ log.info(self.__class__)
+ if atlas is None:
+ atlas = atlas_1
+ if atlas is None:
+ return
+ include_dirs = self.get_include_dirs()
+ h = (self.combine_paths(lib_dirs + include_dirs, 'cblas.h') or [None])
+ h = h[0]
+ if h:
+ h = os.path.dirname(h)
+ dict_append(info, include_dirs=[h])
+ info['language'] = 'c'
+ if lapack is not None:
+ dict_append(info, **lapack)
+ dict_append(info, **atlas)
+ elif 'lapack_atlas' in atlas['libraries']:
+ dict_append(info, **atlas)
+ dict_append(info,
+ define_macros=[('ATLAS_WITH_LAPACK_ATLAS', None)])
+ self.set_info(**info)
+ return
+ else:
+ dict_append(info, **atlas)
+ dict_append(info, define_macros=[('ATLAS_WITHOUT_LAPACK', None)])
+ message = textwrap.dedent("""
+ *********************************************************************
+ Could not find lapack library within the ATLAS installation.
+ *********************************************************************
+ """)
+ warnings.warn(message, stacklevel=2)
+ self.set_info(**info)
+ return
+
+ # Check if lapack library is complete, only warn if it is not.
+ lapack_dir = lapack['library_dirs'][0]
+ lapack_name = lapack['libraries'][0]
+ lapack_lib = None
+ lib_prefixes = ['lib']
+ if sys.platform == 'win32':
+ lib_prefixes.append('')
+ for e in self.library_extensions():
+ for prefix in lib_prefixes:
+ fn = os.path.join(lapack_dir, prefix + lapack_name + e)
+ if os.path.exists(fn):
+ lapack_lib = fn
+ break
+ if lapack_lib:
+ break
+ if lapack_lib is not None:
+ sz = os.stat(lapack_lib)[6]
+ if sz <= 4000 * 1024:
+ message = textwrap.dedent("""
+ *********************************************************************
+ Lapack library (from ATLAS) is probably incomplete:
+ size of %s is %sk (expected >4000k)
+
+ Follow the instructions in the KNOWN PROBLEMS section of the file
+ numpy/INSTALL.txt.
+ *********************************************************************
+ """) % (lapack_lib, sz / 1024)
+ warnings.warn(message, stacklevel=2)
+ else:
+ info['language'] = 'f77'
+
+ atlas_version, atlas_extra_info = get_atlas_version(**atlas)
+ dict_append(info, **atlas_extra_info)
+
+ self.set_info(**info)
+
+
+class atlas_blas_info(atlas_info):
+ _lib_names = ['f77blas', 'cblas']
+
+ def calc_info(self):
+ lib_dirs = self.get_lib_dirs()
+ info = {}
+ opt = self.get_option_single('atlas_libs', 'libraries')
+ atlas_libs = self.get_libs(opt, self._lib_names + self._lib_atlas)
+ atlas = self.check_libs2(lib_dirs, atlas_libs, [])
+ if atlas is None:
+ return
+ include_dirs = self.get_include_dirs()
+ h = (self.combine_paths(lib_dirs + include_dirs, 'cblas.h') or [None])
+ h = h[0]
+ if h:
+ h = os.path.dirname(h)
+ dict_append(info, include_dirs=[h])
+ info['language'] = 'c'
+ info['define_macros'] = [('HAVE_CBLAS', None)]
+
+ atlas_version, atlas_extra_info = get_atlas_version(**atlas)
+ dict_append(atlas, **atlas_extra_info)
+
+ dict_append(info, **atlas)
+
+ self.set_info(**info)
+ return
+
+
+class atlas_threads_info(atlas_info):
+ dir_env_var = ['PTATLAS', 'ATLAS']
+ _lib_names = ['ptf77blas', 'ptcblas']
+
+
+class atlas_blas_threads_info(atlas_blas_info):
+ dir_env_var = ['PTATLAS', 'ATLAS']
+ _lib_names = ['ptf77blas', 'ptcblas']
+
+
+class lapack_atlas_info(atlas_info):
+ _lib_names = ['lapack_atlas'] + atlas_info._lib_names
+
+
+class lapack_atlas_threads_info(atlas_threads_info):
+ _lib_names = ['lapack_atlas'] + atlas_threads_info._lib_names
+
+
+class atlas_3_10_info(atlas_info):
+ _lib_names = ['satlas']
+ _lib_atlas = _lib_names
+ _lib_lapack = _lib_names
+
+
+class atlas_3_10_blas_info(atlas_3_10_info):
+ _lib_names = ['satlas']
+
+ def calc_info(self):
+ lib_dirs = self.get_lib_dirs()
+ info = {}
+ opt = self.get_option_single('atlas_lib', 'libraries')
+ atlas_libs = self.get_libs(opt, self._lib_names)
+ atlas = self.check_libs2(lib_dirs, atlas_libs, [])
+ if atlas is None:
+ return
+ include_dirs = self.get_include_dirs()
+ h = (self.combine_paths(lib_dirs + include_dirs, 'cblas.h') or [None])
+ h = h[0]
+ if h:
+ h = os.path.dirname(h)
+ dict_append(info, include_dirs=[h])
+ info['language'] = 'c'
+ info['define_macros'] = [('HAVE_CBLAS', None)]
+
+ atlas_version, atlas_extra_info = get_atlas_version(**atlas)
+ dict_append(atlas, **atlas_extra_info)
+
+ dict_append(info, **atlas)
+
+ self.set_info(**info)
+ return
+
+
+class atlas_3_10_threads_info(atlas_3_10_info):
+ dir_env_var = ['PTATLAS', 'ATLAS']
+ _lib_names = ['tatlas']
+ _lib_atlas = _lib_names
+ _lib_lapack = _lib_names
+
+
+class atlas_3_10_blas_threads_info(atlas_3_10_blas_info):
+ dir_env_var = ['PTATLAS', 'ATLAS']
+ _lib_names = ['tatlas']
+
+
+class lapack_atlas_3_10_info(atlas_3_10_info):
+ pass
+
+
+class lapack_atlas_3_10_threads_info(atlas_3_10_threads_info):
+ pass
+
+
+class lapack_info(system_info):
+ section = 'lapack'
+ dir_env_var = 'LAPACK'
+ _lib_names = ['lapack']
+ notfounderror = LapackNotFoundError
+
+ def calc_info(self):
+ lib_dirs = self.get_lib_dirs()
+
+ opt = self.get_option_single('lapack_libs', 'libraries')
+ lapack_libs = self.get_libs(opt, self._lib_names)
+ info = self.check_libs(lib_dirs, lapack_libs, [])
+ if info is None:
+ return
+ info['language'] = 'f77'
+ self.set_info(**info)
+
+
+class lapack_src_info(system_info):
+ # LAPACK_SRC is deprecated, please do not use this!
+ # Build or install a BLAS library via your package manager or from
+ # source separately.
+ section = 'lapack_src'
+ dir_env_var = 'LAPACK_SRC'
+ notfounderror = LapackSrcNotFoundError
+
+ def get_paths(self, section, key):
+ pre_dirs = system_info.get_paths(self, section, key)
+ dirs = []
+ for d in pre_dirs:
+ dirs.extend([d] + self.combine_paths(d, ['LAPACK*/SRC', 'SRC']))
+ return [d for d in dirs if os.path.isdir(d)]
+
+ def calc_info(self):
+ src_dirs = self.get_src_dirs()
+ src_dir = ''
+ for d in src_dirs:
+ if os.path.isfile(os.path.join(d, 'dgesv.f')):
+ src_dir = d
+ break
+ if not src_dir:
+ #XXX: Get sources from netlib. May be ask first.
+ return
+ # The following is extracted from LAPACK-3.0/SRC/Makefile.
+ # Added missing names from lapack-lite-3.1.1/SRC/Makefile
+ # while keeping removed names for Lapack-3.0 compatibility.
+ allaux = '''
+ ilaenv ieeeck lsame lsamen xerbla
+ iparmq
+ ''' # *.f
+ laux = '''
+ bdsdc bdsqr disna labad lacpy ladiv lae2 laebz laed0 laed1
+ laed2 laed3 laed4 laed5 laed6 laed7 laed8 laed9 laeda laev2
+ lagtf lagts lamch lamrg lanst lapy2 lapy3 larnv larrb larre
+ larrf lartg laruv las2 lascl lasd0 lasd1 lasd2 lasd3 lasd4
+ lasd5 lasd6 lasd7 lasd8 lasd9 lasda lasdq lasdt laset lasq1
+ lasq2 lasq3 lasq4 lasq5 lasq6 lasr lasrt lassq lasv2 pttrf
+ stebz stedc steqr sterf
+
+ larra larrc larrd larr larrk larrj larrr laneg laisnan isnan
+ lazq3 lazq4
+ ''' # [s|d]*.f
+ lasrc = '''
+ gbbrd gbcon gbequ gbrfs gbsv gbsvx gbtf2 gbtrf gbtrs gebak
+ gebal gebd2 gebrd gecon geequ gees geesx geev geevx gegs gegv
+ gehd2 gehrd gelq2 gelqf gels gelsd gelss gelsx gelsy geql2
+ geqlf geqp3 geqpf geqr2 geqrf gerfs gerq2 gerqf gesc2 gesdd
+ gesv gesvd gesvx getc2 getf2 getrf getri getrs ggbak ggbal
+ gges ggesx ggev ggevx ggglm gghrd gglse ggqrf ggrqf ggsvd
+ ggsvp gtcon gtrfs gtsv gtsvx gttrf gttrs gtts2 hgeqz hsein
+ hseqr labrd lacon laein lags2 lagtm lahqr lahrd laic1 lals0
+ lalsa lalsd langb lange langt lanhs lansb lansp lansy lantb
+ lantp lantr lapll lapmt laqgb laqge laqp2 laqps laqsb laqsp
+ laqsy lar1v lar2v larf larfb larfg larft larfx largv larrv
+ lartv larz larzb larzt laswp lasyf latbs latdf latps latrd
+ latrs latrz latzm lauu2 lauum pbcon pbequ pbrfs pbstf pbsv
+ pbsvx pbtf2 pbtrf pbtrs pocon poequ porfs posv posvx potf2
+ potrf potri potrs ppcon ppequ pprfs ppsv ppsvx pptrf pptri
+ pptrs ptcon pteqr ptrfs ptsv ptsvx pttrs ptts2 spcon sprfs
+ spsv spsvx sptrf sptri sptrs stegr stein sycon syrfs sysv
+ sysvx sytf2 sytrf sytri sytrs tbcon tbrfs tbtrs tgevc tgex2
+ tgexc tgsen tgsja tgsna tgsy2 tgsyl tpcon tprfs tptri tptrs
+ trcon trevc trexc trrfs trsen trsna trsyl trti2 trtri trtrs
+ tzrqf tzrzf
+
+ lacn2 lahr2 stemr laqr0 laqr1 laqr2 laqr3 laqr4 laqr5
+ ''' # [s|c|d|z]*.f
+ sd_lasrc = '''
+ laexc lag2 lagv2 laln2 lanv2 laqtr lasy2 opgtr opmtr org2l
+ org2r orgbr orghr orgl2 orglq orgql orgqr orgr2 orgrq orgtr
+ orm2l orm2r ormbr ormhr orml2 ormlq ormql ormqr ormr2 ormr3
+ ormrq ormrz ormtr rscl sbev sbevd sbevx sbgst sbgv sbgvd sbgvx
+ sbtrd spev spevd spevx spgst spgv spgvd spgvx sptrd stev stevd
+ stevr stevx syev syevd syevr syevx sygs2 sygst sygv sygvd
+ sygvx sytd2 sytrd
+ ''' # [s|d]*.f
+ cz_lasrc = '''
+ bdsqr hbev hbevd hbevx hbgst hbgv hbgvd hbgvx hbtrd hecon heev
+ heevd heevr heevx hegs2 hegst hegv hegvd hegvx herfs hesv
+ hesvx hetd2 hetf2 hetrd hetrf hetri hetrs hpcon hpev hpevd
+ hpevx hpgst hpgv hpgvd hpgvx hprfs hpsv hpsvx hptrd hptrf
+ hptri hptrs lacgv lacp2 lacpy lacrm lacrt ladiv laed0 laed7
+ laed8 laesy laev2 lahef lanhb lanhe lanhp lanht laqhb laqhe
+ laqhp larcm larnv lartg lascl laset lasr lassq pttrf rot spmv
+ spr stedc steqr symv syr ung2l ung2r ungbr unghr ungl2 unglq
+ ungql ungqr ungr2 ungrq ungtr unm2l unm2r unmbr unmhr unml2
+ unmlq unmql unmqr unmr2 unmr3 unmrq unmrz unmtr upgtr upmtr
+ ''' # [c|z]*.f
+ #######
+ sclaux = laux + ' econd ' # s*.f
+ dzlaux = laux + ' secnd ' # d*.f
+ slasrc = lasrc + sd_lasrc # s*.f
+ dlasrc = lasrc + sd_lasrc # d*.f
+ clasrc = lasrc + cz_lasrc + ' srot srscl ' # c*.f
+ zlasrc = lasrc + cz_lasrc + ' drot drscl ' # z*.f
+ oclasrc = ' icmax1 scsum1 ' # *.f
+ ozlasrc = ' izmax1 dzsum1 ' # *.f
+ sources = ['s%s.f' % f for f in (sclaux + slasrc).split()] \
+ + ['d%s.f' % f for f in (dzlaux + dlasrc).split()] \
+ + ['c%s.f' % f for f in (clasrc).split()] \
+ + ['z%s.f' % f for f in (zlasrc).split()] \
+ + ['%s.f' % f for f in (allaux + oclasrc + ozlasrc).split()]
+ sources = [os.path.join(src_dir, f) for f in sources]
+ # Lapack 3.1:
+ src_dir2 = os.path.join(src_dir, '..', 'INSTALL')
+ sources += [os.path.join(src_dir2, p + 'lamch.f') for p in 'sdcz']
+ # Lapack 3.2.1:
+ sources += [os.path.join(src_dir, p + 'larfp.f') for p in 'sdcz']
+ sources += [os.path.join(src_dir, 'ila' + p + 'lr.f') for p in 'sdcz']
+ sources += [os.path.join(src_dir, 'ila' + p + 'lc.f') for p in 'sdcz']
+ # Should we check here actual existence of source files?
+ # Yes, the file listing is different between 3.0 and 3.1
+ # versions.
+ sources = [f for f in sources if os.path.isfile(f)]
+ info = {'sources': sources, 'language': 'f77'}
+ self.set_info(**info)
+
+atlas_version_c_text = r'''
+/* This file is generated from numpy/distutils/system_info.py */
+void ATL_buildinfo(void);
+int main(void) {
+ ATL_buildinfo();
+ return 0;
+}
+'''
+
+_cached_atlas_version = {}
+
+
+def get_atlas_version(**config):
+ libraries = config.get('libraries', [])
+ library_dirs = config.get('library_dirs', [])
+ key = (tuple(libraries), tuple(library_dirs))
+ if key in _cached_atlas_version:
+ return _cached_atlas_version[key]
+ c = cmd_config(Distribution())
+ atlas_version = None
+ info = {}
+ try:
+ s, o = c.get_output(atlas_version_c_text,
+ libraries=libraries, library_dirs=library_dirs,
+ )
+ if s and re.search(r'undefined reference to `_gfortran', o, re.M):
+ s, o = c.get_output(atlas_version_c_text,
+ libraries=libraries + ['gfortran'],
+ library_dirs=library_dirs,
+ )
+ if not s:
+ warnings.warn(textwrap.dedent("""
+ *****************************************************
+ Linkage with ATLAS requires gfortran. Use
+
+ python setup.py config_fc --fcompiler=gnu95 ...
+
+ when building extension libraries that use ATLAS.
+ Make sure that -lgfortran is used for C++ extensions.
+ *****************************************************
+ """), stacklevel=2)
+ dict_append(info, language='f90',
+ define_macros=[('ATLAS_REQUIRES_GFORTRAN', None)])
+ except Exception: # failed to get version from file -- maybe on Windows
+ # look at directory name
+ for o in library_dirs:
+ m = re.search(r'ATLAS_(?P\d+[.]\d+[.]\d+)_', o)
+ if m:
+ atlas_version = m.group('version')
+ if atlas_version is not None:
+ break
+
+ # final choice --- look at ATLAS_VERSION environment
+ # variable
+ if atlas_version is None:
+ atlas_version = os.environ.get('ATLAS_VERSION', None)
+ if atlas_version:
+ dict_append(info, define_macros=[(
+ 'ATLAS_INFO', _c_string_literal(atlas_version))
+ ])
+ else:
+ dict_append(info, define_macros=[('NO_ATLAS_INFO', -1)])
+ return atlas_version or '?.?.?', info
+
+ if not s:
+ m = re.search(r'ATLAS version (?P\d+[.]\d+[.]\d+)', o)
+ if m:
+ atlas_version = m.group('version')
+ if atlas_version is None:
+ if re.search(r'undefined symbol: ATL_buildinfo', o, re.M):
+ atlas_version = '3.2.1_pre3.3.6'
+ else:
+ log.info('Status: %d', s)
+ log.info('Output: %s', o)
+
+ elif atlas_version == '3.2.1_pre3.3.6':
+ dict_append(info, define_macros=[('NO_ATLAS_INFO', -2)])
+ else:
+ dict_append(info, define_macros=[(
+ 'ATLAS_INFO', _c_string_literal(atlas_version))
+ ])
+ result = _cached_atlas_version[key] = atlas_version, info
+ return result
+
+
+class lapack_opt_info(system_info):
+ notfounderror = LapackNotFoundError
+
+ # List of all known LAPACK libraries, in the default order
+ lapack_order = ['armpl', 'mkl', 'ssl2', 'openblas', 'flame',
+ 'accelerate', 'atlas', 'lapack']
+ order_env_var_name = 'NPY_LAPACK_ORDER'
+
+ def _calc_info_armpl(self):
+ info = get_info('lapack_armpl')
+ if info:
+ self.set_info(**info)
+ return True
+ return False
+
+ def _calc_info_mkl(self):
+ info = get_info('lapack_mkl')
+ if info:
+ self.set_info(**info)
+ return True
+ return False
+
+ def _calc_info_ssl2(self):
+ info = get_info('lapack_ssl2')
+ if info:
+ self.set_info(**info)
+ return True
+ return False
+
+ def _calc_info_openblas(self):
+ info = get_info('openblas_lapack')
+ if info:
+ self.set_info(**info)
+ return True
+ info = get_info('openblas_clapack')
+ if info:
+ self.set_info(**info)
+ return True
+ return False
+
+ def _calc_info_flame(self):
+ info = get_info('flame')
+ if info:
+ self.set_info(**info)
+ return True
+ return False
+
+ def _calc_info_atlas(self):
+ info = get_info('atlas_3_10_threads')
+ if not info:
+ info = get_info('atlas_3_10')
+ if not info:
+ info = get_info('atlas_threads')
+ if not info:
+ info = get_info('atlas')
+ if info:
+ # Figure out if ATLAS has lapack...
+ # If not we need the lapack library, but not BLAS!
+ l = info.get('define_macros', [])
+ if ('ATLAS_WITH_LAPACK_ATLAS', None) in l \
+ or ('ATLAS_WITHOUT_LAPACK', None) in l:
+ # Get LAPACK (with possible warnings)
+ # If not found we don't accept anything
+ # since we can't use ATLAS with LAPACK!
+ lapack_info = self._get_info_lapack()
+ if not lapack_info:
+ return False
+ dict_append(info, **lapack_info)
+ self.set_info(**info)
+ return True
+ return False
+
+ def _calc_info_accelerate(self):
+ info = get_info('accelerate')
+ if info:
+ self.set_info(**info)
+ return True
+ return False
+
+ def _get_info_blas(self):
+ # Default to get the optimized BLAS implementation
+ info = get_info('blas_opt')
+ if not info:
+ warnings.warn(BlasNotFoundError.__doc__ or '', stacklevel=3)
+ info_src = get_info('blas_src')
+ if not info_src:
+ warnings.warn(BlasSrcNotFoundError.__doc__ or '', stacklevel=3)
+ return {}
+ dict_append(info, libraries=[('fblas_src', info_src)])
+ return info
+
+ def _get_info_lapack(self):
+ info = get_info('lapack')
+ if not info:
+ warnings.warn(LapackNotFoundError.__doc__ or '', stacklevel=3)
+ info_src = get_info('lapack_src')
+ if not info_src:
+ warnings.warn(LapackSrcNotFoundError.__doc__ or '', stacklevel=3)
+ return {}
+ dict_append(info, libraries=[('flapack_src', info_src)])
+ return info
+
+ def _calc_info_lapack(self):
+ info = self._get_info_lapack()
+ if info:
+ info_blas = self._get_info_blas()
+ dict_append(info, **info_blas)
+ dict_append(info, define_macros=[('NO_ATLAS_INFO', 1)])
+ self.set_info(**info)
+ return True
+ return False
+
+ def _calc_info_from_envvar(self):
+ info = {}
+ info['language'] = 'f77'
+ info['libraries'] = []
+ info['include_dirs'] = []
+ info['define_macros'] = []
+ info['extra_link_args'] = os.environ['NPY_LAPACK_LIBS'].split()
+ self.set_info(**info)
+ return True
+
+ def _calc_info(self, name):
+ return getattr(self, '_calc_info_{}'.format(name))()
+
+ def calc_info(self):
+ lapack_order, unknown_order = _parse_env_order(self.lapack_order, self.order_env_var_name)
+ if len(unknown_order) > 0:
+ raise ValueError("lapack_opt_info user defined "
+ "LAPACK order has unacceptable "
+ "values: {}".format(unknown_order))
+
+ if 'NPY_LAPACK_LIBS' in os.environ:
+ # Bypass autodetection, set language to F77 and use env var linker
+ # flags directly
+ self._calc_info_from_envvar()
+ return
+
+ for lapack in lapack_order:
+ if self._calc_info(lapack):
+ return
+
+ if 'lapack' not in lapack_order:
+ # Since the user may request *not* to use any library, we still need
+ # to raise warnings to signal missing packages!
+ warnings.warn(LapackNotFoundError.__doc__ or '', stacklevel=2)
+ warnings.warn(LapackSrcNotFoundError.__doc__ or '', stacklevel=2)
+
+
+class _ilp64_opt_info_mixin:
+ symbol_suffix = None
+ symbol_prefix = None
+
+ def _check_info(self, info):
+ macros = dict(info.get('define_macros', []))
+ prefix = macros.get('BLAS_SYMBOL_PREFIX', '')
+ suffix = macros.get('BLAS_SYMBOL_SUFFIX', '')
+
+ if self.symbol_prefix not in (None, prefix):
+ return False
+
+ if self.symbol_suffix not in (None, suffix):
+ return False
+
+ return bool(info)
+
+
+class lapack_ilp64_opt_info(lapack_opt_info, _ilp64_opt_info_mixin):
+ notfounderror = LapackILP64NotFoundError
+ lapack_order = ['openblas64_', 'openblas_ilp64', 'accelerate']
+ order_env_var_name = 'NPY_LAPACK_ILP64_ORDER'
+
+ def _calc_info(self, name):
+ print('lapack_ilp64_opt_info._calc_info(name=%s)' % (name))
+ info = get_info(name + '_lapack')
+ if self._check_info(info):
+ self.set_info(**info)
+ return True
+ else:
+ print('%s_lapack does not exist' % (name))
+ return False
+
+
+class lapack_ilp64_plain_opt_info(lapack_ilp64_opt_info):
+ # Same as lapack_ilp64_opt_info, but fix symbol names
+ symbol_prefix = ''
+ symbol_suffix = ''
+
+
+class lapack64__opt_info(lapack_ilp64_opt_info):
+ symbol_prefix = ''
+ symbol_suffix = '64_'
+
+
+class blas_opt_info(system_info):
+ notfounderror = BlasNotFoundError
+ # List of all known BLAS libraries, in the default order
+
+ blas_order = ['armpl', 'mkl', 'ssl2', 'blis', 'openblas',
+ 'accelerate', 'atlas', 'blas']
+ order_env_var_name = 'NPY_BLAS_ORDER'
+
+ def _calc_info_armpl(self):
+ info = get_info('blas_armpl')
+ if info:
+ self.set_info(**info)
+ return True
+ return False
+
+ def _calc_info_mkl(self):
+ info = get_info('blas_mkl')
+ if info:
+ self.set_info(**info)
+ return True
+ return False
+
+ def _calc_info_ssl2(self):
+ info = get_info('blas_ssl2')
+ if info:
+ self.set_info(**info)
+ return True
+ return False
+
+ def _calc_info_blis(self):
+ info = get_info('blis')
+ if info:
+ self.set_info(**info)
+ return True
+ return False
+
+ def _calc_info_openblas(self):
+ info = get_info('openblas')
+ if info:
+ self.set_info(**info)
+ return True
+ return False
+
+ def _calc_info_atlas(self):
+ info = get_info('atlas_3_10_blas_threads')
+ if not info:
+ info = get_info('atlas_3_10_blas')
+ if not info:
+ info = get_info('atlas_blas_threads')
+ if not info:
+ info = get_info('atlas_blas')
+ if info:
+ self.set_info(**info)
+ return True
+ return False
+
+ def _calc_info_accelerate(self):
+ info = get_info('accelerate')
+ if info:
+ self.set_info(**info)
+ return True
+ return False
+
+ def _calc_info_blas(self):
+ # Warn about a non-optimized BLAS library
+ warnings.warn(BlasOptNotFoundError.__doc__ or '', stacklevel=3)
+ info = {}
+ dict_append(info, define_macros=[('NO_ATLAS_INFO', 1)])
+
+ blas = get_info('blas')
+ if blas:
+ dict_append(info, **blas)
+ else:
+ # Not even BLAS was found!
+ warnings.warn(BlasNotFoundError.__doc__ or '', stacklevel=3)
+
+ blas_src = get_info('blas_src')
+ if not blas_src:
+ warnings.warn(BlasSrcNotFoundError.__doc__ or '', stacklevel=3)
+ return False
+ dict_append(info, libraries=[('fblas_src', blas_src)])
+
+ self.set_info(**info)
+ return True
+
+ def _calc_info_from_envvar(self):
+ info = {}
+ info['language'] = 'f77'
+ info['libraries'] = []
+ info['include_dirs'] = []
+ info['define_macros'] = []
+ info['extra_link_args'] = os.environ['NPY_BLAS_LIBS'].split()
+ if 'NPY_CBLAS_LIBS' in os.environ:
+ info['define_macros'].append(('HAVE_CBLAS', None))
+ info['extra_link_args'].extend(
+ os.environ['NPY_CBLAS_LIBS'].split())
+ self.set_info(**info)
+ return True
+
+ def _calc_info(self, name):
+ return getattr(self, '_calc_info_{}'.format(name))()
+
+ def calc_info(self):
+ blas_order, unknown_order = _parse_env_order(self.blas_order, self.order_env_var_name)
+ if len(unknown_order) > 0:
+ raise ValueError("blas_opt_info user defined BLAS order has unacceptable values: {}".format(unknown_order))
+
+ if 'NPY_BLAS_LIBS' in os.environ:
+ # Bypass autodetection, set language to F77 and use env var linker
+ # flags directly
+ self._calc_info_from_envvar()
+ return
+
+ for blas in blas_order:
+ if self._calc_info(blas):
+ return
+
+ if 'blas' not in blas_order:
+ # Since the user may request *not* to use any library, we still need
+ # to raise warnings to signal missing packages!
+ warnings.warn(BlasNotFoundError.__doc__ or '', stacklevel=2)
+ warnings.warn(BlasSrcNotFoundError.__doc__ or '', stacklevel=2)
+
+
+class blas_ilp64_opt_info(blas_opt_info, _ilp64_opt_info_mixin):
+ notfounderror = BlasILP64NotFoundError
+ blas_order = ['openblas64_', 'openblas_ilp64', 'accelerate']
+ order_env_var_name = 'NPY_BLAS_ILP64_ORDER'
+
+ def _calc_info(self, name):
+ info = get_info(name)
+ if self._check_info(info):
+ self.set_info(**info)
+ return True
+ return False
+
+
+class blas_ilp64_plain_opt_info(blas_ilp64_opt_info):
+ symbol_prefix = ''
+ symbol_suffix = ''
+
+
+class blas64__opt_info(blas_ilp64_opt_info):
+ symbol_prefix = ''
+ symbol_suffix = '64_'
+
+
+class cblas_info(system_info):
+ section = 'cblas'
+ dir_env_var = 'CBLAS'
+ # No default as it's used only in blas_info
+ _lib_names = []
+ notfounderror = BlasNotFoundError
+
+
+class blas_info(system_info):
+ section = 'blas'
+ dir_env_var = 'BLAS'
+ _lib_names = ['blas']
+ notfounderror = BlasNotFoundError
+
+ def calc_info(self):
+ lib_dirs = self.get_lib_dirs()
+ opt = self.get_option_single('blas_libs', 'libraries')
+ blas_libs = self.get_libs(opt, self._lib_names)
+ info = self.check_libs(lib_dirs, blas_libs, [])
+ if info is None:
+ return
+ else:
+ info['include_dirs'] = self.get_include_dirs()
+ if platform.system() == 'Windows':
+ # The check for windows is needed because get_cblas_libs uses the
+ # same compiler that was used to compile Python and msvc is
+ # often not installed when mingw is being used. This rough
+ # treatment is not desirable, but windows is tricky.
+ info['language'] = 'f77' # XXX: is it generally true?
+ # If cblas is given as an option, use those
+ cblas_info_obj = cblas_info()
+ cblas_opt = cblas_info_obj.get_option_single('cblas_libs', 'libraries')
+ cblas_libs = cblas_info_obj.get_libs(cblas_opt, None)
+ if cblas_libs:
+ info['libraries'] = cblas_libs + blas_libs
+ info['define_macros'] = [('HAVE_CBLAS', None)]
+ else:
+ lib = self.get_cblas_libs(info)
+ if lib is not None:
+ info['language'] = 'c'
+ info['libraries'] = lib
+ info['define_macros'] = [('HAVE_CBLAS', None)]
+ self.set_info(**info)
+
+ def get_cblas_libs(self, info):
+ """ Check whether we can link with CBLAS interface
+
+ This method will search through several combinations of libraries
+ to check whether CBLAS is present:
+
+ 1. Libraries in ``info['libraries']``, as is
+ 2. As 1. but also explicitly adding ``'cblas'`` as a library
+ 3. As 1. but also explicitly adding ``'blas'`` as a library
+ 4. Check only library ``'cblas'``
+ 5. Check only library ``'blas'``
+
+ Parameters
+ ----------
+ info : dict
+ system information dictionary for compilation and linking
+
+ Returns
+ -------
+ libraries : list of str or None
+ a list of libraries that enables the use of CBLAS interface.
+ Returns None if not found or a compilation error occurs.
+
+ Since 1.17 returns a list.
+ """
+ # primitive cblas check by looking for the header and trying to link
+ # cblas or blas
+ c = customized_ccompiler()
+ tmpdir = tempfile.mkdtemp()
+ s = textwrap.dedent("""\
+ #include
+ int main(int argc, const char *argv[])
+ {
+ double a[4] = {1,2,3,4};
+ double b[4] = {5,6,7,8};
+ return cblas_ddot(4, a, 1, b, 1) > 10;
+ }""")
+ src = os.path.join(tmpdir, 'source.c')
+ try:
+ with open(src, 'w') as f:
+ f.write(s)
+
+ try:
+ # check we can compile (find headers)
+ obj = c.compile([src], output_dir=tmpdir,
+ include_dirs=self.get_include_dirs())
+ except (distutils.ccompiler.CompileError, distutils.ccompiler.LinkError):
+ return None
+
+ # check we can link (find library)
+ # some systems have separate cblas and blas libs.
+ for libs in [info['libraries'], ['cblas'] + info['libraries'],
+ ['blas'] + info['libraries'], ['cblas'], ['blas']]:
+ try:
+ c.link_executable(obj, os.path.join(tmpdir, "a.out"),
+ libraries=libs,
+ library_dirs=info['library_dirs'],
+ extra_postargs=info.get('extra_link_args', []))
+ return libs
+ except distutils.ccompiler.LinkError:
+ pass
+ finally:
+ shutil.rmtree(tmpdir)
+ return None
+
+
+class openblas_info(blas_info):
+ section = 'openblas'
+ dir_env_var = 'OPENBLAS'
+ _lib_names = ['openblas']
+ _require_symbols = []
+ notfounderror = BlasNotFoundError
+
+ @property
+ def symbol_prefix(self):
+ try:
+ return self.cp.get(self.section, 'symbol_prefix')
+ except NoOptionError:
+ return ''
+
+ @property
+ def symbol_suffix(self):
+ try:
+ return self.cp.get(self.section, 'symbol_suffix')
+ except NoOptionError:
+ return ''
+
+ def _calc_info(self):
+ c = customized_ccompiler()
+
+ lib_dirs = self.get_lib_dirs()
+
+ # Prefer to use libraries over openblas_libs
+ opt = self.get_option_single('openblas_libs', 'libraries')
+ openblas_libs = self.get_libs(opt, self._lib_names)
+
+ info = self.check_libs(lib_dirs, openblas_libs, [])
+
+ if c.compiler_type == "msvc" and info is None:
+ from numpy.distutils.fcompiler import new_fcompiler
+ f = new_fcompiler(c_compiler=c)
+ if f and f.compiler_type == 'gnu95':
+ # Try gfortran-compatible library files
+ info = self.check_msvc_gfortran_libs(lib_dirs, openblas_libs)
+ # Skip lapack check, we'd need build_ext to do it
+ skip_symbol_check = True
+ elif info:
+ skip_symbol_check = False
+ info['language'] = 'c'
+
+ if info is None:
+ return None
+
+ # Add extra info for OpenBLAS
+ extra_info = self.calc_extra_info()
+ dict_append(info, **extra_info)
+
+ if not (skip_symbol_check or self.check_symbols(info)):
+ return None
+
+ info['define_macros'] = [('HAVE_CBLAS', None)]
+ if self.symbol_prefix:
+ info['define_macros'] += [('BLAS_SYMBOL_PREFIX', self.symbol_prefix)]
+ if self.symbol_suffix:
+ info['define_macros'] += [
+ ('BLAS_SYMBOL_SUFFIX', self.symbol_suffix),
+ ('OPENBLAS_ILP64_NAMING_SCHEME', None),
+ ]
+
+ return info
+
+ def calc_info(self):
+ info = self._calc_info()
+ if info is not None:
+ self.set_info(**info)
+
+ def check_msvc_gfortran_libs(self, library_dirs, libraries):
+ # First, find the full path to each library directory
+ library_paths = []
+ for library in libraries:
+ for library_dir in library_dirs:
+ # MinGW static ext will be .a
+ fullpath = os.path.join(library_dir, library + '.a')
+ if os.path.isfile(fullpath):
+ library_paths.append(fullpath)
+ break
+ else:
+ return None
+
+ # Generate numpy.distutils virtual static library file
+ basename = self.__class__.__name__
+ tmpdir = os.path.join(os.getcwd(), 'build', basename)
+ if not os.path.isdir(tmpdir):
+ os.makedirs(tmpdir)
+
+ info = {'library_dirs': [tmpdir],
+ 'libraries': [basename],
+ 'language': 'f77'}
+
+ fake_lib_file = os.path.join(tmpdir, basename + '.fobjects')
+ fake_clib_file = os.path.join(tmpdir, basename + '.cobjects')
+ with open(fake_lib_file, 'w') as f:
+ f.write("\n".join(library_paths))
+ with open(fake_clib_file, 'w') as f:
+ pass
+
+ return info
+
+ def check_symbols(self, info):
+ res = False
+ c = customized_ccompiler()
+
+ tmpdir = tempfile.mkdtemp()
+
+ prototypes = "\n".join("void %s%s%s();" % (self.symbol_prefix,
+ symbol_name,
+ self.symbol_suffix)
+ for symbol_name in self._require_symbols)
+ calls = "\n".join("%s%s%s();" % (self.symbol_prefix,
+ symbol_name,
+ self.symbol_suffix)
+ for symbol_name in self._require_symbols)
+ s = textwrap.dedent("""\
+ %(prototypes)s
+ int main(int argc, const char *argv[])
+ {
+ %(calls)s
+ return 0;
+ }""") % dict(prototypes=prototypes, calls=calls)
+ src = os.path.join(tmpdir, 'source.c')
+ out = os.path.join(tmpdir, 'a.out')
+ # Add the additional "extra" arguments
+ try:
+ extra_args = info['extra_link_args']
+ except Exception:
+ extra_args = []
+ try:
+ with open(src, 'w') as f:
+ f.write(s)
+ obj = c.compile([src], output_dir=tmpdir)
+ try:
+ c.link_executable(obj, out, libraries=info['libraries'],
+ library_dirs=info['library_dirs'],
+ extra_postargs=extra_args)
+ res = True
+ except distutils.ccompiler.LinkError:
+ res = False
+ finally:
+ shutil.rmtree(tmpdir)
+ return res
+
+class openblas_lapack_info(openblas_info):
+ section = 'openblas'
+ dir_env_var = 'OPENBLAS'
+ _lib_names = ['openblas']
+ _require_symbols = ['zungqr_']
+ notfounderror = BlasNotFoundError
+
+class openblas_clapack_info(openblas_lapack_info):
+ _lib_names = ['openblas', 'lapack']
+
+class openblas_ilp64_info(openblas_info):
+ section = 'openblas_ilp64'
+ dir_env_var = 'OPENBLAS_ILP64'
+ _lib_names = ['openblas64']
+ _require_symbols = ['dgemm_', 'cblas_dgemm']
+ notfounderror = BlasILP64NotFoundError
+
+ def _calc_info(self):
+ info = super()._calc_info()
+ if info is not None:
+ info['define_macros'] += [('HAVE_BLAS_ILP64', None)]
+ return info
+
+class openblas_ilp64_lapack_info(openblas_ilp64_info):
+ _require_symbols = ['dgemm_', 'cblas_dgemm', 'zungqr_', 'LAPACKE_zungqr']
+
+ def _calc_info(self):
+ info = super()._calc_info()
+ if info:
+ info['define_macros'] += [('HAVE_LAPACKE', None)]
+ return info
+
+class openblas64__info(openblas_ilp64_info):
+ # ILP64 Openblas, with default symbol suffix
+ section = 'openblas64_'
+ dir_env_var = 'OPENBLAS64_'
+ _lib_names = ['openblas64_']
+ symbol_suffix = '64_'
+ symbol_prefix = ''
+
+class openblas64__lapack_info(openblas_ilp64_lapack_info, openblas64__info):
+ pass
+
+class blis_info(blas_info):
+ section = 'blis'
+ dir_env_var = 'BLIS'
+ _lib_names = ['blis']
+ notfounderror = BlasNotFoundError
+
+ def calc_info(self):
+ lib_dirs = self.get_lib_dirs()
+ opt = self.get_option_single('blis_libs', 'libraries')
+ blis_libs = self.get_libs(opt, self._lib_names)
+ info = self.check_libs2(lib_dirs, blis_libs, [])
+ if info is None:
+ return
+
+ # Add include dirs
+ incl_dirs = self.get_include_dirs()
+ dict_append(info,
+ language='c',
+ define_macros=[('HAVE_CBLAS', None)],
+ include_dirs=incl_dirs)
+ self.set_info(**info)
+
+
+class flame_info(system_info):
+ """ Usage of libflame for LAPACK operations
+
+ This requires libflame to be compiled with lapack wrappers:
+
+ ./configure --enable-lapack2flame ...
+
+ Be aware that libflame 5.1.0 has some missing names in the shared library, so
+ if you have problems, try the static flame library.
+ """
+ section = 'flame'
+ _lib_names = ['flame']
+ notfounderror = FlameNotFoundError
+
+ def check_embedded_lapack(self, info):
+ """ libflame does not necessarily have a wrapper for fortran LAPACK, we need to check """
+ c = customized_ccompiler()
+
+ tmpdir = tempfile.mkdtemp()
+ s = textwrap.dedent("""\
+ void zungqr_();
+ int main(int argc, const char *argv[])
+ {
+ zungqr_();
+ return 0;
+ }""")
+ src = os.path.join(tmpdir, 'source.c')
+ out = os.path.join(tmpdir, 'a.out')
+ # Add the additional "extra" arguments
+ extra_args = info.get('extra_link_args', [])
+ try:
+ with open(src, 'w') as f:
+ f.write(s)
+ obj = c.compile([src], output_dir=tmpdir)
+ try:
+ c.link_executable(obj, out, libraries=info['libraries'],
+ library_dirs=info['library_dirs'],
+ extra_postargs=extra_args)
+ return True
+ except distutils.ccompiler.LinkError:
+ return False
+ finally:
+ shutil.rmtree(tmpdir)
+
+ def calc_info(self):
+ lib_dirs = self.get_lib_dirs()
+ flame_libs = self.get_libs('libraries', self._lib_names)
+
+ info = self.check_libs2(lib_dirs, flame_libs, [])
+ if info is None:
+ return
+
+ # Add the extra flag args to info
+ extra_info = self.calc_extra_info()
+ dict_append(info, **extra_info)
+
+ if self.check_embedded_lapack(info):
+ # check if the user has supplied all information required
+ self.set_info(**info)
+ else:
+ # Try and get the BLAS lib to see if we can get it to work
+ blas_info = get_info('blas_opt')
+ if not blas_info:
+ # since we already failed once, this ain't going to work either
+ return
+
+ # Now we need to merge the two dictionaries
+ for key in blas_info:
+ if isinstance(blas_info[key], list):
+ info[key] = info.get(key, []) + blas_info[key]
+ elif isinstance(blas_info[key], tuple):
+ info[key] = info.get(key, ()) + blas_info[key]
+ else:
+ info[key] = info.get(key, '') + blas_info[key]
+
+ # Now check again
+ if self.check_embedded_lapack(info):
+ self.set_info(**info)
+
+
+class accelerate_info(system_info):
+ section = 'accelerate'
+ _lib_names = ['accelerate', 'veclib']
+ notfounderror = BlasNotFoundError
+
+ def calc_info(self):
+ # Make possible to enable/disable from config file/env var
+ libraries = os.environ.get('ACCELERATE')
+ if libraries:
+ libraries = [libraries]
+ else:
+ libraries = self.get_libs('libraries', self._lib_names)
+ libraries = [lib.strip().lower() for lib in libraries]
+
+ if (sys.platform == 'darwin' and
+ not os.getenv('_PYTHON_HOST_PLATFORM', None)):
+ # Use the system BLAS from Accelerate or vecLib under OSX
+ args = []
+ link_args = []
+ if get_platform()[-4:] == 'i386' or 'intel' in get_platform() or \
+ 'x86_64' in get_platform() or \
+ 'i386' in platform.platform():
+ intel = 1
+ else:
+ intel = 0
+ if (os.path.exists('/System/Library/Frameworks'
+ '/Accelerate.framework/') and
+ 'accelerate' in libraries):
+ if intel:
+ args.extend(['-msse3'])
+ args.extend([
+ '-I/System/Library/Frameworks/vecLib.framework/Headers'])
+ link_args.extend(['-Wl,-framework', '-Wl,Accelerate'])
+ elif (os.path.exists('/System/Library/Frameworks'
+ '/vecLib.framework/') and
+ 'veclib' in libraries):
+ if intel:
+ args.extend(['-msse3'])
+ args.extend([
+ '-I/System/Library/Frameworks/vecLib.framework/Headers'])
+ link_args.extend(['-Wl,-framework', '-Wl,vecLib'])
+
+ if args:
+ macros = [
+ ('NO_ATLAS_INFO', 3),
+ ('HAVE_CBLAS', None),
+ ('ACCELERATE_NEW_LAPACK', None),
+ ]
+ if(os.getenv('NPY_USE_BLAS_ILP64', None)):
+ print('Setting HAVE_BLAS_ILP64')
+ macros += [
+ ('HAVE_BLAS_ILP64', None),
+ ('ACCELERATE_LAPACK_ILP64', None),
+ ]
+ self.set_info(extra_compile_args=args,
+ extra_link_args=link_args,
+ define_macros=macros)
+
+ return
+
+class accelerate_lapack_info(accelerate_info):
+ def _calc_info(self):
+ return super()._calc_info()
+
+class blas_src_info(system_info):
+ # BLAS_SRC is deprecated, please do not use this!
+ # Build or install a BLAS library via your package manager or from
+ # source separately.
+ section = 'blas_src'
+ dir_env_var = 'BLAS_SRC'
+ notfounderror = BlasSrcNotFoundError
+
+ def get_paths(self, section, key):
+ pre_dirs = system_info.get_paths(self, section, key)
+ dirs = []
+ for d in pre_dirs:
+ dirs.extend([d] + self.combine_paths(d, ['blas']))
+ return [d for d in dirs if os.path.isdir(d)]
+
+ def calc_info(self):
+ src_dirs = self.get_src_dirs()
+ src_dir = ''
+ for d in src_dirs:
+ if os.path.isfile(os.path.join(d, 'daxpy.f')):
+ src_dir = d
+ break
+ if not src_dir:
+ #XXX: Get sources from netlib. May be ask first.
+ return
+ blas1 = '''
+ caxpy csscal dnrm2 dzasum saxpy srotg zdotc ccopy cswap drot
+ dznrm2 scasum srotm zdotu cdotc dasum drotg icamax scnrm2
+ srotmg zdrot cdotu daxpy drotm idamax scopy sscal zdscal crotg
+ dcabs1 drotmg isamax sdot sswap zrotg cscal dcopy dscal izamax
+ snrm2 zaxpy zscal csrot ddot dswap sasum srot zcopy zswap
+ scabs1
+ '''
+ blas2 = '''
+ cgbmv chpmv ctrsv dsymv dtrsv sspr2 strmv zhemv ztpmv cgemv
+ chpr dgbmv dsyr lsame ssymv strsv zher ztpsv cgerc chpr2 dgemv
+ dsyr2 sgbmv ssyr xerbla zher2 ztrmv cgeru ctbmv dger dtbmv
+ sgemv ssyr2 zgbmv zhpmv ztrsv chbmv ctbsv dsbmv dtbsv sger
+ stbmv zgemv zhpr chemv ctpmv dspmv dtpmv ssbmv stbsv zgerc
+ zhpr2 cher ctpsv dspr dtpsv sspmv stpmv zgeru ztbmv cher2
+ ctrmv dspr2 dtrmv sspr stpsv zhbmv ztbsv
+ '''
+ blas3 = '''
+ cgemm csymm ctrsm dsyrk sgemm strmm zhemm zsyr2k chemm csyr2k
+ dgemm dtrmm ssymm strsm zher2k zsyrk cher2k csyrk dsymm dtrsm
+ ssyr2k zherk ztrmm cherk ctrmm dsyr2k ssyrk zgemm zsymm ztrsm
+ '''
+ sources = [os.path.join(src_dir, f + '.f') \
+ for f in (blas1 + blas2 + blas3).split()]
+ #XXX: should we check here actual existence of source files?
+ sources = [f for f in sources if os.path.isfile(f)]
+ info = {'sources': sources, 'language': 'f77'}
+ self.set_info(**info)
+
+
+class x11_info(system_info):
+ section = 'x11'
+ notfounderror = X11NotFoundError
+ _lib_names = ['X11']
+
+ def __init__(self):
+ system_info.__init__(self,
+ default_lib_dirs=default_x11_lib_dirs,
+ default_include_dirs=default_x11_include_dirs)
+
+ def calc_info(self):
+ if sys.platform in ['win32']:
+ return
+ lib_dirs = self.get_lib_dirs()
+ include_dirs = self.get_include_dirs()
+ opt = self.get_option_single('x11_libs', 'libraries')
+ x11_libs = self.get_libs(opt, self._lib_names)
+ info = self.check_libs(lib_dirs, x11_libs, [])
+ if info is None:
+ return
+ inc_dir = None
+ for d in include_dirs:
+ if self.combine_paths(d, 'X11/X.h'):
+ inc_dir = d
+ break
+ if inc_dir is not None:
+ dict_append(info, include_dirs=[inc_dir])
+ self.set_info(**info)
+
+
+class _numpy_info(system_info):
+ section = 'Numeric'
+ modulename = 'Numeric'
+ notfounderror = NumericNotFoundError
+
+ def __init__(self):
+ include_dirs = []
+ try:
+ module = __import__(self.modulename)
+ prefix = []
+ for name in module.__file__.split(os.sep):
+ if name == 'lib':
+ break
+ prefix.append(name)
+
+ # Ask numpy for its own include path before attempting
+ # anything else
+ try:
+ include_dirs.append(getattr(module, 'get_include')())
+ except AttributeError:
+ pass
+
+ include_dirs.append(sysconfig.get_path('include'))
+ except ImportError:
+ pass
+ py_incl_dir = sysconfig.get_path('include')
+ include_dirs.append(py_incl_dir)
+ py_pincl_dir = sysconfig.get_path('platinclude')
+ if py_pincl_dir not in include_dirs:
+ include_dirs.append(py_pincl_dir)
+ for d in default_include_dirs:
+ d = os.path.join(d, os.path.basename(py_incl_dir))
+ if d not in include_dirs:
+ include_dirs.append(d)
+ system_info.__init__(self,
+ default_lib_dirs=[],
+ default_include_dirs=include_dirs)
+
+ def calc_info(self):
+ try:
+ module = __import__(self.modulename)
+ except ImportError:
+ return
+ info = {}
+ macros = []
+ for v in ['__version__', 'version']:
+ vrs = getattr(module, v, None)
+ if vrs is None:
+ continue
+ macros = [(self.modulename.upper() + '_VERSION',
+ _c_string_literal(vrs)),
+ (self.modulename.upper(), None)]
+ break
+ dict_append(info, define_macros=macros)
+ include_dirs = self.get_include_dirs()
+ inc_dir = None
+ for d in include_dirs:
+ if self.combine_paths(d,
+ os.path.join(self.modulename,
+ 'arrayobject.h')):
+ inc_dir = d
+ break
+ if inc_dir is not None:
+ dict_append(info, include_dirs=[inc_dir])
+ if info:
+ self.set_info(**info)
+ return
+
+
+class numarray_info(_numpy_info):
+ section = 'numarray'
+ modulename = 'numarray'
+
+
+class Numeric_info(_numpy_info):
+ section = 'Numeric'
+ modulename = 'Numeric'
+
+
+class numpy_info(_numpy_info):
+ section = 'numpy'
+ modulename = 'numpy'
+
+
+class numerix_info(system_info):
+ section = 'numerix'
+
+ def calc_info(self):
+ which = None, None
+ if os.getenv("NUMERIX"):
+ which = os.getenv("NUMERIX"), "environment var"
+ # If all the above fail, default to numpy.
+ if which[0] is None:
+ which = "numpy", "defaulted"
+ try:
+ import numpy # noqa: F401
+ which = "numpy", "defaulted"
+ except ImportError as e:
+ msg1 = str(e)
+ try:
+ import Numeric # noqa: F401
+ which = "numeric", "defaulted"
+ except ImportError as e:
+ msg2 = str(e)
+ try:
+ import numarray # noqa: F401
+ which = "numarray", "defaulted"
+ except ImportError as e:
+ msg3 = str(e)
+ log.info(msg1)
+ log.info(msg2)
+ log.info(msg3)
+ which = which[0].strip().lower(), which[1]
+ if which[0] not in ["numeric", "numarray", "numpy"]:
+ raise ValueError("numerix selector must be either 'Numeric' "
+ "or 'numarray' or 'numpy' but the value obtained"
+ " from the %s was '%s'." % (which[1], which[0]))
+ os.environ['NUMERIX'] = which[0]
+ self.set_info(**get_info(which[0]))
+
+
+class f2py_info(system_info):
+ def calc_info(self):
+ try:
+ import numpy.f2py as f2py
+ except ImportError:
+ return
+ f2py_dir = os.path.join(os.path.dirname(f2py.__file__), 'src')
+ self.set_info(sources=[os.path.join(f2py_dir, 'fortranobject.c')],
+ include_dirs=[f2py_dir])
+ return
+
+
+class boost_python_info(system_info):
+ section = 'boost_python'
+ dir_env_var = 'BOOST'
+
+ def get_paths(self, section, key):
+ pre_dirs = system_info.get_paths(self, section, key)
+ dirs = []
+ for d in pre_dirs:
+ dirs.extend([d] + self.combine_paths(d, ['boost*']))
+ return [d for d in dirs if os.path.isdir(d)]
+
+ def calc_info(self):
+ src_dirs = self.get_src_dirs()
+ src_dir = ''
+ for d in src_dirs:
+ if os.path.isfile(os.path.join(d, 'libs', 'python', 'src',
+ 'module.cpp')):
+ src_dir = d
+ break
+ if not src_dir:
+ return
+ py_incl_dirs = [sysconfig.get_path('include')]
+ py_pincl_dir = sysconfig.get_path('platinclude')
+ if py_pincl_dir not in py_incl_dirs:
+ py_incl_dirs.append(py_pincl_dir)
+ srcs_dir = os.path.join(src_dir, 'libs', 'python', 'src')
+ bpl_srcs = glob(os.path.join(srcs_dir, '*.cpp'))
+ bpl_srcs += glob(os.path.join(srcs_dir, '*', '*.cpp'))
+ info = {'libraries': [('boost_python_src',
+ {'include_dirs': [src_dir] + py_incl_dirs,
+ 'sources':bpl_srcs}
+ )],
+ 'include_dirs': [src_dir],
+ }
+ if info:
+ self.set_info(**info)
+ return
+
+
+class agg2_info(system_info):
+ section = 'agg2'
+ dir_env_var = 'AGG2'
+
+ def get_paths(self, section, key):
+ pre_dirs = system_info.get_paths(self, section, key)
+ dirs = []
+ for d in pre_dirs:
+ dirs.extend([d] + self.combine_paths(d, ['agg2*']))
+ return [d for d in dirs if os.path.isdir(d)]
+
+ def calc_info(self):
+ src_dirs = self.get_src_dirs()
+ src_dir = ''
+ for d in src_dirs:
+ if os.path.isfile(os.path.join(d, 'src', 'agg_affine_matrix.cpp')):
+ src_dir = d
+ break
+ if not src_dir:
+ return
+ if sys.platform == 'win32':
+ agg2_srcs = glob(os.path.join(src_dir, 'src', 'platform',
+ 'win32', 'agg_win32_bmp.cpp'))
+ else:
+ agg2_srcs = glob(os.path.join(src_dir, 'src', '*.cpp'))
+ agg2_srcs += [os.path.join(src_dir, 'src', 'platform',
+ 'X11',
+ 'agg_platform_support.cpp')]
+
+ info = {'libraries':
+ [('agg2_src',
+ {'sources': agg2_srcs,
+ 'include_dirs': [os.path.join(src_dir, 'include')],
+ }
+ )],
+ 'include_dirs': [os.path.join(src_dir, 'include')],
+ }
+ if info:
+ self.set_info(**info)
+ return
+
+
+class _pkg_config_info(system_info):
+ section = None
+ config_env_var = 'PKG_CONFIG'
+ default_config_exe = 'pkg-config'
+ append_config_exe = ''
+ version_macro_name = None
+ release_macro_name = None
+ version_flag = '--modversion'
+ cflags_flag = '--cflags'
+
+ def get_config_exe(self):
+ if self.config_env_var in os.environ:
+ return os.environ[self.config_env_var]
+ return self.default_config_exe
+
+ def get_config_output(self, config_exe, option):
+ cmd = config_exe + ' ' + self.append_config_exe + ' ' + option
+ try:
+ o = subprocess.check_output(cmd)
+ except (OSError, subprocess.CalledProcessError):
+ pass
+ else:
+ o = filepath_from_subprocess_output(o)
+ return o
+
+ def calc_info(self):
+ config_exe = find_executable(self.get_config_exe())
+ if not config_exe:
+ log.warn('File not found: %s. Cannot determine %s info.' \
+ % (config_exe, self.section))
+ return
+ info = {}
+ macros = []
+ libraries = []
+ library_dirs = []
+ include_dirs = []
+ extra_link_args = []
+ extra_compile_args = []
+ version = self.get_config_output(config_exe, self.version_flag)
+ if version:
+ macros.append((self.__class__.__name__.split('.')[-1].upper(),
+ _c_string_literal(version)))
+ if self.version_macro_name:
+ macros.append((self.version_macro_name + '_%s'
+ % (version.replace('.', '_')), None))
+ if self.release_macro_name:
+ release = self.get_config_output(config_exe, '--release')
+ if release:
+ macros.append((self.release_macro_name + '_%s'
+ % (release.replace('.', '_')), None))
+ opts = self.get_config_output(config_exe, '--libs')
+ if opts:
+ for opt in opts.split():
+ if opt[:2] == '-l':
+ libraries.append(opt[2:])
+ elif opt[:2] == '-L':
+ library_dirs.append(opt[2:])
+ else:
+ extra_link_args.append(opt)
+ opts = self.get_config_output(config_exe, self.cflags_flag)
+ if opts:
+ for opt in opts.split():
+ if opt[:2] == '-I':
+ include_dirs.append(opt[2:])
+ elif opt[:2] == '-D':
+ if '=' in opt:
+ n, v = opt[2:].split('=')
+ macros.append((n, v))
+ else:
+ macros.append((opt[2:], None))
+ else:
+ extra_compile_args.append(opt)
+ if macros:
+ dict_append(info, define_macros=macros)
+ if libraries:
+ dict_append(info, libraries=libraries)
+ if library_dirs:
+ dict_append(info, library_dirs=library_dirs)
+ if include_dirs:
+ dict_append(info, include_dirs=include_dirs)
+ if extra_link_args:
+ dict_append(info, extra_link_args=extra_link_args)
+ if extra_compile_args:
+ dict_append(info, extra_compile_args=extra_compile_args)
+ if info:
+ self.set_info(**info)
+ return
+
+
+class wx_info(_pkg_config_info):
+ section = 'wx'
+ config_env_var = 'WX_CONFIG'
+ default_config_exe = 'wx-config'
+ append_config_exe = ''
+ version_macro_name = 'WX_VERSION'
+ release_macro_name = 'WX_RELEASE'
+ version_flag = '--version'
+ cflags_flag = '--cxxflags'
+
+
+class gdk_pixbuf_xlib_2_info(_pkg_config_info):
+ section = 'gdk_pixbuf_xlib_2'
+ append_config_exe = 'gdk-pixbuf-xlib-2.0'
+ version_macro_name = 'GDK_PIXBUF_XLIB_VERSION'
+
+
+class gdk_pixbuf_2_info(_pkg_config_info):
+ section = 'gdk_pixbuf_2'
+ append_config_exe = 'gdk-pixbuf-2.0'
+ version_macro_name = 'GDK_PIXBUF_VERSION'
+
+
+class gdk_x11_2_info(_pkg_config_info):
+ section = 'gdk_x11_2'
+ append_config_exe = 'gdk-x11-2.0'
+ version_macro_name = 'GDK_X11_VERSION'
+
+
+class gdk_2_info(_pkg_config_info):
+ section = 'gdk_2'
+ append_config_exe = 'gdk-2.0'
+ version_macro_name = 'GDK_VERSION'
+
+
+class gdk_info(_pkg_config_info):
+ section = 'gdk'
+ append_config_exe = 'gdk'
+ version_macro_name = 'GDK_VERSION'
+
+
+class gtkp_x11_2_info(_pkg_config_info):
+ section = 'gtkp_x11_2'
+ append_config_exe = 'gtk+-x11-2.0'
+ version_macro_name = 'GTK_X11_VERSION'
+
+
+class gtkp_2_info(_pkg_config_info):
+ section = 'gtkp_2'
+ append_config_exe = 'gtk+-2.0'
+ version_macro_name = 'GTK_VERSION'
+
+
+class xft_info(_pkg_config_info):
+ section = 'xft'
+ append_config_exe = 'xft'
+ version_macro_name = 'XFT_VERSION'
+
+
+class freetype2_info(_pkg_config_info):
+ section = 'freetype2'
+ append_config_exe = 'freetype2'
+ version_macro_name = 'FREETYPE2_VERSION'
+
+
+class amd_info(system_info):
+ section = 'amd'
+ dir_env_var = 'AMD'
+ _lib_names = ['amd']
+
+ def calc_info(self):
+ lib_dirs = self.get_lib_dirs()
+
+ opt = self.get_option_single('amd_libs', 'libraries')
+ amd_libs = self.get_libs(opt, self._lib_names)
+ info = self.check_libs(lib_dirs, amd_libs, [])
+ if info is None:
+ return
+
+ include_dirs = self.get_include_dirs()
+
+ inc_dir = None
+ for d in include_dirs:
+ p = self.combine_paths(d, 'amd.h')
+ if p:
+ inc_dir = os.path.dirname(p[0])
+ break
+ if inc_dir is not None:
+ dict_append(info, include_dirs=[inc_dir],
+ define_macros=[('SCIPY_AMD_H', None)],
+ swig_opts=['-I' + inc_dir])
+
+ self.set_info(**info)
+ return
+
+
+class umfpack_info(system_info):
+ section = 'umfpack'
+ dir_env_var = 'UMFPACK'
+ notfounderror = UmfpackNotFoundError
+ _lib_names = ['umfpack']
+
+ def calc_info(self):
+ lib_dirs = self.get_lib_dirs()
+
+ opt = self.get_option_single('umfpack_libs', 'libraries')
+ umfpack_libs = self.get_libs(opt, self._lib_names)
+ info = self.check_libs(lib_dirs, umfpack_libs, [])
+ if info is None:
+ return
+
+ include_dirs = self.get_include_dirs()
+
+ inc_dir = None
+ for d in include_dirs:
+ p = self.combine_paths(d, ['', 'umfpack'], 'umfpack.h')
+ if p:
+ inc_dir = os.path.dirname(p[0])
+ break
+ if inc_dir is not None:
+ dict_append(info, include_dirs=[inc_dir],
+ define_macros=[('SCIPY_UMFPACK_H', None)],
+ swig_opts=['-I' + inc_dir])
+
+ dict_append(info, **get_info('amd'))
+
+ self.set_info(**info)
+ return
+
+
+def combine_paths(*args, **kws):
+ """ Return a list of existing paths composed by all combinations of
+ items from arguments.
+ """
+ r = []
+ for a in args:
+ if not a:
+ continue
+ if is_string(a):
+ a = [a]
+ r.append(a)
+ args = r
+ if not args:
+ return []
+ if len(args) == 1:
+ result = reduce(lambda a, b: a + b, map(glob, args[0]), [])
+ elif len(args) == 2:
+ result = []
+ for a0 in args[0]:
+ for a1 in args[1]:
+ result.extend(glob(os.path.join(a0, a1)))
+ else:
+ result = combine_paths(*(combine_paths(args[0], args[1]) + args[2:]))
+ log.debug('(paths: %s)', ','.join(result))
+ return result
+
+language_map = {'c': 0, 'c++': 1, 'f77': 2, 'f90': 3}
+inv_language_map = {0: 'c', 1: 'c++', 2: 'f77', 3: 'f90'}
+
+
+def dict_append(d, **kws):
+ languages = []
+ for k, v in kws.items():
+ if k == 'language':
+ languages.append(v)
+ continue
+ if k in d:
+ if k in ['library_dirs', 'include_dirs',
+ 'extra_compile_args', 'extra_link_args',
+ 'runtime_library_dirs', 'define_macros']:
+ [d[k].append(vv) for vv in v if vv not in d[k]]
+ else:
+ d[k].extend(v)
+ else:
+ d[k] = v
+ if languages:
+ l = inv_language_map[max([language_map.get(l, 0) for l in languages])]
+ d['language'] = l
+ return
+
+
+def parseCmdLine(argv=(None,)):
+ import optparse
+ parser = optparse.OptionParser("usage: %prog [-v] [info objs]")
+ parser.add_option('-v', '--verbose', action='store_true', dest='verbose',
+ default=False,
+ help='be verbose and print more messages')
+
+ opts, args = parser.parse_args(args=argv[1:])
+ return opts, args
+
+
+def show_all(argv=None):
+ import inspect
+ if argv is None:
+ argv = sys.argv
+ opts, args = parseCmdLine(argv)
+ if opts.verbose:
+ log.set_threshold(log.DEBUG)
+ else:
+ log.set_threshold(log.INFO)
+ show_only = []
+ for n in args:
+ if n[-5:] != '_info':
+ n = n + '_info'
+ show_only.append(n)
+ show_all = not show_only
+ _gdict_ = globals().copy()
+ for name, c in _gdict_.items():
+ if not inspect.isclass(c):
+ continue
+ if not issubclass(c, system_info) or c is system_info:
+ continue
+ if not show_all:
+ if name not in show_only:
+ continue
+ del show_only[show_only.index(name)]
+ conf = c()
+ conf.verbosity = 2
+ # we don't need the result, but we want
+ # the side effect of printing diagnostics
+ conf.get_info()
+ if show_only:
+ log.info('Info classes not defined: %s', ','.join(show_only))
+
+if __name__ == "__main__":
+ show_all()
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/tests/__init__.py b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/tests/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/tests/__pycache__/__init__.cpython-311.pyc b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/tests/__pycache__/__init__.cpython-311.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..356edb63c33dd1809fbe189cb6ed68107021b5ab
Binary files /dev/null and b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/tests/__pycache__/__init__.cpython-311.pyc differ
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/tests/__pycache__/test_build_ext.cpython-311.pyc b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/tests/__pycache__/test_build_ext.cpython-311.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..a1281a443d754ad7e5e983556dd19d43e1e9ac27
Binary files /dev/null and b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/tests/__pycache__/test_build_ext.cpython-311.pyc differ
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/tests/__pycache__/test_ccompiler_opt.cpython-311.pyc b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/tests/__pycache__/test_ccompiler_opt.cpython-311.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..812a7c68958284f5db941571ba19c08588fcceb7
Binary files /dev/null and b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/tests/__pycache__/test_ccompiler_opt.cpython-311.pyc differ
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/tests/__pycache__/test_ccompiler_opt_conf.cpython-311.pyc b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/tests/__pycache__/test_ccompiler_opt_conf.cpython-311.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..4a812b46463faae50ae6821a31fbe909d4b726c8
Binary files /dev/null and b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/tests/__pycache__/test_ccompiler_opt_conf.cpython-311.pyc differ
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/tests/__pycache__/test_exec_command.cpython-311.pyc b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/tests/__pycache__/test_exec_command.cpython-311.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..830a8b2c2da512cffe10542d48733b2b178ac5f9
Binary files /dev/null and b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/tests/__pycache__/test_exec_command.cpython-311.pyc differ
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/tests/__pycache__/test_fcompiler.cpython-311.pyc b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/tests/__pycache__/test_fcompiler.cpython-311.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..61135d969130b872c069312a83e81b33592a3ae6
Binary files /dev/null and b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/tests/__pycache__/test_fcompiler.cpython-311.pyc differ
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/tests/__pycache__/test_fcompiler_gnu.cpython-311.pyc b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/tests/__pycache__/test_fcompiler_gnu.cpython-311.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..49bfd9ed6858dcadd83e9ca806fd8c42612cc709
Binary files /dev/null and b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/tests/__pycache__/test_fcompiler_gnu.cpython-311.pyc differ
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/tests/__pycache__/test_fcompiler_intel.cpython-311.pyc b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/tests/__pycache__/test_fcompiler_intel.cpython-311.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..3dbaaebf4c8da6519f62fd8268d15ea83a0de3be
Binary files /dev/null and b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/tests/__pycache__/test_fcompiler_intel.cpython-311.pyc differ
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/tests/__pycache__/test_fcompiler_nagfor.cpython-311.pyc b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/tests/__pycache__/test_fcompiler_nagfor.cpython-311.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..96f7719e61d86a545c0f96f9988ce1a6da770036
Binary files /dev/null and b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/tests/__pycache__/test_fcompiler_nagfor.cpython-311.pyc differ
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/tests/__pycache__/test_from_template.cpython-311.pyc b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/tests/__pycache__/test_from_template.cpython-311.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..729bffec0d1ef97c616cc45322444842824b0fbe
Binary files /dev/null and b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/tests/__pycache__/test_from_template.cpython-311.pyc differ
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/tests/__pycache__/test_log.cpython-311.pyc b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/tests/__pycache__/test_log.cpython-311.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..75cedace5b7846fbc6c0d55a166663621395d227
Binary files /dev/null and b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/tests/__pycache__/test_log.cpython-311.pyc differ
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/tests/__pycache__/test_mingw32ccompiler.cpython-311.pyc b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/tests/__pycache__/test_mingw32ccompiler.cpython-311.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..f7301a39e6cb5a3b8158adcef3f1d10335507df1
Binary files /dev/null and b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/tests/__pycache__/test_mingw32ccompiler.cpython-311.pyc differ
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/tests/__pycache__/test_misc_util.cpython-311.pyc b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/tests/__pycache__/test_misc_util.cpython-311.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..0a19ea89162502914f53059d1fa0319cb281251d
Binary files /dev/null and b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/tests/__pycache__/test_misc_util.cpython-311.pyc differ
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/tests/__pycache__/test_npy_pkg_config.cpython-311.pyc b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/tests/__pycache__/test_npy_pkg_config.cpython-311.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..09a3590707b05fee24178d08ac6837c4106de3b8
Binary files /dev/null and b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/tests/__pycache__/test_npy_pkg_config.cpython-311.pyc differ
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/tests/__pycache__/test_shell_utils.cpython-311.pyc b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/tests/__pycache__/test_shell_utils.cpython-311.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..7de4127ade35bb43b6bcd8e18057ac6218f8f7dd
Binary files /dev/null and b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/tests/__pycache__/test_shell_utils.cpython-311.pyc differ
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/tests/__pycache__/test_system_info.cpython-311.pyc b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/tests/__pycache__/test_system_info.cpython-311.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..fdf4b0804da33dbe99a27db6b184fd23cc4af4d1
Binary files /dev/null and b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/tests/__pycache__/test_system_info.cpython-311.pyc differ
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/tests/test_exec_command.py b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/tests/test_exec_command.py
new file mode 100644
index 0000000000000000000000000000000000000000..d1a20056a5a2a78a76cf36d1bde31a0e82cbb873
--- /dev/null
+++ b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/tests/test_exec_command.py
@@ -0,0 +1,217 @@
+import os
+import pytest
+import sys
+from tempfile import TemporaryFile
+
+from numpy.distutils import exec_command
+from numpy.distutils.exec_command import get_pythonexe
+from numpy.testing import tempdir, assert_, assert_warns, IS_WASM
+
+
+# In python 3 stdout, stderr are text (unicode compliant) devices, so to
+# emulate them import StringIO from the io module.
+from io import StringIO
+
+class redirect_stdout:
+ """Context manager to redirect stdout for exec_command test."""
+ def __init__(self, stdout=None):
+ self._stdout = stdout or sys.stdout
+
+ def __enter__(self):
+ self.old_stdout = sys.stdout
+ sys.stdout = self._stdout
+
+ def __exit__(self, exc_type, exc_value, traceback):
+ self._stdout.flush()
+ sys.stdout = self.old_stdout
+ # note: closing sys.stdout won't close it.
+ self._stdout.close()
+
+class redirect_stderr:
+ """Context manager to redirect stderr for exec_command test."""
+ def __init__(self, stderr=None):
+ self._stderr = stderr or sys.stderr
+
+ def __enter__(self):
+ self.old_stderr = sys.stderr
+ sys.stderr = self._stderr
+
+ def __exit__(self, exc_type, exc_value, traceback):
+ self._stderr.flush()
+ sys.stderr = self.old_stderr
+ # note: closing sys.stderr won't close it.
+ self._stderr.close()
+
+class emulate_nonposix:
+ """Context manager to emulate os.name != 'posix' """
+ def __init__(self, osname='non-posix'):
+ self._new_name = osname
+
+ def __enter__(self):
+ self._old_name = os.name
+ os.name = self._new_name
+
+ def __exit__(self, exc_type, exc_value, traceback):
+ os.name = self._old_name
+
+
+def test_exec_command_stdout():
+ # Regression test for gh-2999 and gh-2915.
+ # There are several packages (nose, scipy.weave.inline, Sage inline
+ # Fortran) that replace stdout, in which case it doesn't have a fileno
+ # method. This is tested here, with a do-nothing command that fails if the
+ # presence of fileno() is assumed in exec_command.
+
+ # The code has a special case for posix systems, so if we are on posix test
+ # both that the special case works and that the generic code works.
+
+ # Test posix version:
+ with redirect_stdout(StringIO()):
+ with redirect_stderr(TemporaryFile()):
+ with assert_warns(DeprecationWarning):
+ exec_command.exec_command("cd '.'")
+
+ if os.name == 'posix':
+ # Test general (non-posix) version:
+ with emulate_nonposix():
+ with redirect_stdout(StringIO()):
+ with redirect_stderr(TemporaryFile()):
+ with assert_warns(DeprecationWarning):
+ exec_command.exec_command("cd '.'")
+
+def test_exec_command_stderr():
+ # Test posix version:
+ with redirect_stdout(TemporaryFile(mode='w+')):
+ with redirect_stderr(StringIO()):
+ with assert_warns(DeprecationWarning):
+ exec_command.exec_command("cd '.'")
+
+ if os.name == 'posix':
+ # Test general (non-posix) version:
+ with emulate_nonposix():
+ with redirect_stdout(TemporaryFile()):
+ with redirect_stderr(StringIO()):
+ with assert_warns(DeprecationWarning):
+ exec_command.exec_command("cd '.'")
+
+
+@pytest.mark.skipif(IS_WASM, reason="Cannot start subprocess")
+class TestExecCommand:
+ def setup_method(self):
+ self.pyexe = get_pythonexe()
+
+ def check_nt(self, **kws):
+ s, o = exec_command.exec_command('cmd /C echo path=%path%')
+ assert_(s == 0)
+ assert_(o != '')
+
+ s, o = exec_command.exec_command(
+ '"%s" -c "import sys;sys.stderr.write(sys.platform)"' % self.pyexe)
+ assert_(s == 0)
+ assert_(o == 'win32')
+
+ def check_posix(self, **kws):
+ s, o = exec_command.exec_command("echo Hello", **kws)
+ assert_(s == 0)
+ assert_(o == 'Hello')
+
+ s, o = exec_command.exec_command('echo $AAA', **kws)
+ assert_(s == 0)
+ assert_(o == '')
+
+ s, o = exec_command.exec_command('echo "$AAA"', AAA='Tere', **kws)
+ assert_(s == 0)
+ assert_(o == 'Tere')
+
+ s, o = exec_command.exec_command('echo "$AAA"', **kws)
+ assert_(s == 0)
+ assert_(o == '')
+
+ if 'BBB' not in os.environ:
+ os.environ['BBB'] = 'Hi'
+ s, o = exec_command.exec_command('echo "$BBB"', **kws)
+ assert_(s == 0)
+ assert_(o == 'Hi')
+
+ s, o = exec_command.exec_command('echo "$BBB"', BBB='Hey', **kws)
+ assert_(s == 0)
+ assert_(o == 'Hey')
+
+ s, o = exec_command.exec_command('echo "$BBB"', **kws)
+ assert_(s == 0)
+ assert_(o == 'Hi')
+
+ del os.environ['BBB']
+
+ s, o = exec_command.exec_command('echo "$BBB"', **kws)
+ assert_(s == 0)
+ assert_(o == '')
+
+
+ s, o = exec_command.exec_command('this_is_not_a_command', **kws)
+ assert_(s != 0)
+ assert_(o != '')
+
+ s, o = exec_command.exec_command('echo path=$PATH', **kws)
+ assert_(s == 0)
+ assert_(o != '')
+
+ s, o = exec_command.exec_command(
+ '"%s" -c "import sys,os;sys.stderr.write(os.name)"' %
+ self.pyexe, **kws)
+ assert_(s == 0)
+ assert_(o == 'posix')
+
+ def check_basic(self, *kws):
+ s, o = exec_command.exec_command(
+ '"%s" -c "raise \'Ignore me.\'"' % self.pyexe, **kws)
+ assert_(s != 0)
+ assert_(o != '')
+
+ s, o = exec_command.exec_command(
+ '"%s" -c "import sys;sys.stderr.write(\'0\');'
+ 'sys.stderr.write(\'1\');sys.stderr.write(\'2\')"' %
+ self.pyexe, **kws)
+ assert_(s == 0)
+ assert_(o == '012')
+
+ s, o = exec_command.exec_command(
+ '"%s" -c "import sys;sys.exit(15)"' % self.pyexe, **kws)
+ assert_(s == 15)
+ assert_(o == '')
+
+ s, o = exec_command.exec_command(
+ '"%s" -c "print(\'Heipa\'")' % self.pyexe, **kws)
+ assert_(s == 0)
+ assert_(o == 'Heipa')
+
+ def check_execute_in(self, **kws):
+ with tempdir() as tmpdir:
+ fn = "file"
+ tmpfile = os.path.join(tmpdir, fn)
+ with open(tmpfile, 'w') as f:
+ f.write('Hello')
+
+ s, o = exec_command.exec_command(
+ '"%s" -c "f = open(\'%s\', \'r\'); f.close()"' %
+ (self.pyexe, fn), **kws)
+ assert_(s != 0)
+ assert_(o != '')
+ s, o = exec_command.exec_command(
+ '"%s" -c "f = open(\'%s\', \'r\'); print(f.read()); '
+ 'f.close()"' % (self.pyexe, fn), execute_in=tmpdir, **kws)
+ assert_(s == 0)
+ assert_(o == 'Hello')
+
+ def test_basic(self):
+ with redirect_stdout(StringIO()):
+ with redirect_stderr(StringIO()):
+ with assert_warns(DeprecationWarning):
+ if os.name == "posix":
+ self.check_posix(use_tee=0)
+ self.check_posix(use_tee=1)
+ elif os.name == "nt":
+ self.check_nt(use_tee=0)
+ self.check_nt(use_tee=1)
+ self.check_execute_in(use_tee=0)
+ self.check_execute_in(use_tee=1)
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/tests/test_fcompiler_gnu.py b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/tests/test_fcompiler_gnu.py
new file mode 100644
index 0000000000000000000000000000000000000000..0817ae58c2140e912eaf3d61e040050016dede54
--- /dev/null
+++ b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/tests/test_fcompiler_gnu.py
@@ -0,0 +1,55 @@
+from numpy.testing import assert_
+
+import numpy.distutils.fcompiler
+
+g77_version_strings = [
+ ('GNU Fortran 0.5.25 20010319 (prerelease)', '0.5.25'),
+ ('GNU Fortran (GCC 3.2) 3.2 20020814 (release)', '3.2'),
+ ('GNU Fortran (GCC) 3.3.3 20040110 (prerelease) (Debian)', '3.3.3'),
+ ('GNU Fortran (GCC) 3.3.3 (Debian 20040401)', '3.3.3'),
+ ('GNU Fortran (GCC 3.2.2 20030222 (Red Hat Linux 3.2.2-5)) 3.2.2'
+ ' 20030222 (Red Hat Linux 3.2.2-5)', '3.2.2'),
+]
+
+gfortran_version_strings = [
+ ('GNU Fortran 95 (GCC 4.0.3 20051023 (prerelease) (Debian 4.0.2-3))',
+ '4.0.3'),
+ ('GNU Fortran 95 (GCC) 4.1.0', '4.1.0'),
+ ('GNU Fortran 95 (GCC) 4.2.0 20060218 (experimental)', '4.2.0'),
+ ('GNU Fortran (GCC) 4.3.0 20070316 (experimental)', '4.3.0'),
+ ('GNU Fortran (rubenvb-4.8.0) 4.8.0', '4.8.0'),
+ ('4.8.0', '4.8.0'),
+ ('4.0.3-7', '4.0.3'),
+ ("gfortran: warning: couldn't understand kern.osversion '14.1.0\n4.9.1",
+ '4.9.1'),
+ ("gfortran: warning: couldn't understand kern.osversion '14.1.0\n"
+ "gfortran: warning: yet another warning\n4.9.1",
+ '4.9.1'),
+ ('GNU Fortran (crosstool-NG 8a21ab48) 7.2.0', '7.2.0')
+]
+
+class TestG77Versions:
+ def test_g77_version(self):
+ fc = numpy.distutils.fcompiler.new_fcompiler(compiler='gnu')
+ for vs, version in g77_version_strings:
+ v = fc.version_match(vs)
+ assert_(v == version, (vs, v))
+
+ def test_not_g77(self):
+ fc = numpy.distutils.fcompiler.new_fcompiler(compiler='gnu')
+ for vs, _ in gfortran_version_strings:
+ v = fc.version_match(vs)
+ assert_(v is None, (vs, v))
+
+class TestGFortranVersions:
+ def test_gfortran_version(self):
+ fc = numpy.distutils.fcompiler.new_fcompiler(compiler='gnu95')
+ for vs, version in gfortran_version_strings:
+ v = fc.version_match(vs)
+ assert_(v == version, (vs, v))
+
+ def test_not_gfortran(self):
+ fc = numpy.distutils.fcompiler.new_fcompiler(compiler='gnu95')
+ for vs, _ in g77_version_strings:
+ v = fc.version_match(vs)
+ assert_(v is None, (vs, v))
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/tests/test_fcompiler_intel.py b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/tests/test_fcompiler_intel.py
new file mode 100644
index 0000000000000000000000000000000000000000..45c9cdac1910def6b5a50a60b4ab5c8e0092af18
--- /dev/null
+++ b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/tests/test_fcompiler_intel.py
@@ -0,0 +1,30 @@
+import numpy.distutils.fcompiler
+from numpy.testing import assert_
+
+
+intel_32bit_version_strings = [
+ ("Intel(R) Fortran Intel(R) 32-bit Compiler Professional for applications"
+ "running on Intel(R) 32, Version 11.1", '11.1'),
+]
+
+intel_64bit_version_strings = [
+ ("Intel(R) Fortran IA-64 Compiler Professional for applications"
+ "running on IA-64, Version 11.0", '11.0'),
+ ("Intel(R) Fortran Intel(R) 64 Compiler Professional for applications"
+ "running on Intel(R) 64, Version 11.1", '11.1')
+]
+
+class TestIntelFCompilerVersions:
+ def test_32bit_version(self):
+ fc = numpy.distutils.fcompiler.new_fcompiler(compiler='intel')
+ for vs, version in intel_32bit_version_strings:
+ v = fc.version_match(vs)
+ assert_(v == version)
+
+
+class TestIntelEM64TFCompilerVersions:
+ def test_64bit_version(self):
+ fc = numpy.distutils.fcompiler.new_fcompiler(compiler='intelem')
+ for vs, version in intel_64bit_version_strings:
+ v = fc.version_match(vs)
+ assert_(v == version)
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/tests/test_fcompiler_nagfor.py b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/tests/test_fcompiler_nagfor.py
new file mode 100644
index 0000000000000000000000000000000000000000..2e04f5266dc1e9c5a15f130af5f9c596f8bd7ef9
--- /dev/null
+++ b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/tests/test_fcompiler_nagfor.py
@@ -0,0 +1,22 @@
+from numpy.testing import assert_
+import numpy.distutils.fcompiler
+
+nag_version_strings = [('nagfor', 'NAG Fortran Compiler Release '
+ '6.2(Chiyoda) Build 6200', '6.2'),
+ ('nagfor', 'NAG Fortran Compiler Release '
+ '6.1(Tozai) Build 6136', '6.1'),
+ ('nagfor', 'NAG Fortran Compiler Release '
+ '6.0(Hibiya) Build 1021', '6.0'),
+ ('nagfor', 'NAG Fortran Compiler Release '
+ '5.3.2(971)', '5.3.2'),
+ ('nag', 'NAGWare Fortran 95 compiler Release 5.1'
+ '(347,355-367,375,380-383,389,394,399,401-402,407,'
+ '431,435,437,446,459-460,463,472,494,496,503,508,'
+ '511,517,529,555,557,565)', '5.1')]
+
+class TestNagFCompilerVersions:
+ def test_version_match(self):
+ for comp, vs, version in nag_version_strings:
+ fc = numpy.distutils.fcompiler.new_fcompiler(compiler=comp)
+ v = fc.version_match(vs)
+ assert_(v == version)
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/tests/test_from_template.py b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/tests/test_from_template.py
new file mode 100644
index 0000000000000000000000000000000000000000..5881754962996460a5900bb211d11411b554a48f
--- /dev/null
+++ b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/tests/test_from_template.py
@@ -0,0 +1,44 @@
+
+from numpy.distutils.from_template import process_str
+from numpy.testing import assert_equal
+
+
+pyf_src = """
+python module foo
+ <_rd=real,double precision>
+ interface
+ subroutine foosub(tol)
+ <_rd>, intent(in,out) :: tol
+ end subroutine foosub
+ end interface
+end python module foo
+"""
+
+expected_pyf = """
+python module foo
+ interface
+ subroutine sfoosub(tol)
+ real, intent(in,out) :: tol
+ end subroutine sfoosub
+ subroutine dfoosub(tol)
+ double precision, intent(in,out) :: tol
+ end subroutine dfoosub
+ end interface
+end python module foo
+"""
+
+
+def normalize_whitespace(s):
+ """
+ Remove leading and trailing whitespace, and convert internal
+ stretches of whitespace to a single space.
+ """
+ return ' '.join(s.split())
+
+
+def test_from_template():
+ """Regression test for gh-10712."""
+ pyf = process_str(pyf_src)
+ normalized_pyf = normalize_whitespace(pyf)
+ normalized_expected_pyf = normalize_whitespace(expected_pyf)
+ assert_equal(normalized_pyf, normalized_expected_pyf)
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/tests/test_log.py b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/tests/test_log.py
new file mode 100644
index 0000000000000000000000000000000000000000..72fddf37370f1b5c81473a24c823a236f9f299bc
--- /dev/null
+++ b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/tests/test_log.py
@@ -0,0 +1,34 @@
+import io
+import re
+from contextlib import redirect_stdout
+
+import pytest
+
+from numpy.distutils import log
+
+
+def setup_module():
+ f = io.StringIO() # changing verbosity also logs here, capture that
+ with redirect_stdout(f):
+ log.set_verbosity(2, force=True) # i.e. DEBUG
+
+
+def teardown_module():
+ log.set_verbosity(0, force=True) # the default
+
+
+r_ansi = re.compile(r"\x1B(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~])")
+
+
+@pytest.mark.parametrize("func_name", ["error", "warn", "info", "debug"])
+def test_log_prefix(func_name):
+ func = getattr(log, func_name)
+ msg = f"{func_name} message"
+ f = io.StringIO()
+ with redirect_stdout(f):
+ func(msg)
+ out = f.getvalue()
+ assert out # sanity check
+ clean_out = r_ansi.sub("", out)
+ line = next(line for line in clean_out.splitlines())
+ assert line == f"{func_name.upper()}: {msg}"
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/tests/test_mingw32ccompiler.py b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/tests/test_mingw32ccompiler.py
new file mode 100644
index 0000000000000000000000000000000000000000..ebedacb32448f4cab47b4931985a6417f18fd1f0
--- /dev/null
+++ b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/tests/test_mingw32ccompiler.py
@@ -0,0 +1,42 @@
+import shutil
+import subprocess
+import sys
+import pytest
+
+from numpy.distutils import mingw32ccompiler
+
+
+@pytest.mark.skipif(sys.platform != 'win32', reason='win32 only test')
+def test_build_import():
+ '''Test the mingw32ccompiler.build_import_library, which builds a
+ `python.a` from the MSVC `python.lib`
+ '''
+
+ # make sure `nm.exe` exists and supports the current python version. This
+ # can get mixed up when the PATH has a 64-bit nm but the python is 32-bit
+ try:
+ out = subprocess.check_output(['nm.exe', '--help'])
+ except FileNotFoundError:
+ pytest.skip("'nm.exe' not on path, is mingw installed?")
+ supported = out[out.find(b'supported targets:'):]
+ if sys.maxsize < 2**32:
+ if b'pe-i386' not in supported:
+ raise ValueError("'nm.exe' found but it does not support 32-bit "
+ "dlls when using 32-bit python. Supported "
+ "formats: '%s'" % supported)
+ elif b'pe-x86-64' not in supported:
+ raise ValueError("'nm.exe' found but it does not support 64-bit "
+ "dlls when using 64-bit python. Supported "
+ "formats: '%s'" % supported)
+ # Hide the import library to force a build
+ has_import_lib, fullpath = mingw32ccompiler._check_for_import_lib()
+ if has_import_lib:
+ shutil.move(fullpath, fullpath + '.bak')
+
+ try:
+ # Whew, now we can actually test the function
+ mingw32ccompiler.build_import_library()
+
+ finally:
+ if has_import_lib:
+ shutil.move(fullpath + '.bak', fullpath)
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/tests/test_misc_util.py b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/tests/test_misc_util.py
new file mode 100644
index 0000000000000000000000000000000000000000..605c80483b77fd4efa6f48ab8fd1bc6abd12e5a4
--- /dev/null
+++ b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/tests/test_misc_util.py
@@ -0,0 +1,82 @@
+from os.path import join, sep, dirname
+
+from numpy.distutils.misc_util import (
+ appendpath, minrelpath, gpaths, get_shared_lib_extension, get_info
+ )
+from numpy.testing import (
+ assert_, assert_equal
+ )
+
+ajoin = lambda *paths: join(*((sep,)+paths))
+
+class TestAppendpath:
+
+ def test_1(self):
+ assert_equal(appendpath('prefix', 'name'), join('prefix', 'name'))
+ assert_equal(appendpath('/prefix', 'name'), ajoin('prefix', 'name'))
+ assert_equal(appendpath('/prefix', '/name'), ajoin('prefix', 'name'))
+ assert_equal(appendpath('prefix', '/name'), join('prefix', 'name'))
+
+ def test_2(self):
+ assert_equal(appendpath('prefix/sub', 'name'),
+ join('prefix', 'sub', 'name'))
+ assert_equal(appendpath('prefix/sub', 'sup/name'),
+ join('prefix', 'sub', 'sup', 'name'))
+ assert_equal(appendpath('/prefix/sub', '/prefix/name'),
+ ajoin('prefix', 'sub', 'name'))
+
+ def test_3(self):
+ assert_equal(appendpath('/prefix/sub', '/prefix/sup/name'),
+ ajoin('prefix', 'sub', 'sup', 'name'))
+ assert_equal(appendpath('/prefix/sub/sub2', '/prefix/sup/sup2/name'),
+ ajoin('prefix', 'sub', 'sub2', 'sup', 'sup2', 'name'))
+ assert_equal(appendpath('/prefix/sub/sub2', '/prefix/sub/sup/name'),
+ ajoin('prefix', 'sub', 'sub2', 'sup', 'name'))
+
+class TestMinrelpath:
+
+ def test_1(self):
+ n = lambda path: path.replace('/', sep)
+ assert_equal(minrelpath(n('aa/bb')), n('aa/bb'))
+ assert_equal(minrelpath('..'), '..')
+ assert_equal(minrelpath(n('aa/..')), '')
+ assert_equal(minrelpath(n('aa/../bb')), 'bb')
+ assert_equal(minrelpath(n('aa/bb/..')), 'aa')
+ assert_equal(minrelpath(n('aa/bb/../..')), '')
+ assert_equal(minrelpath(n('aa/bb/../cc/../dd')), n('aa/dd'))
+ assert_equal(minrelpath(n('.././..')), n('../..'))
+ assert_equal(minrelpath(n('aa/bb/.././../dd')), n('dd'))
+
+class TestGpaths:
+
+ def test_gpaths(self):
+ local_path = minrelpath(join(dirname(__file__), '..'))
+ ls = gpaths('command/*.py', local_path)
+ assert_(join(local_path, 'command', 'build_src.py') in ls, repr(ls))
+ f = gpaths('system_info.py', local_path)
+ assert_(join(local_path, 'system_info.py') == f[0], repr(f))
+
+class TestSharedExtension:
+
+ def test_get_shared_lib_extension(self):
+ import sys
+ ext = get_shared_lib_extension(is_python_ext=False)
+ if sys.platform.startswith('linux'):
+ assert_equal(ext, '.so')
+ elif sys.platform.startswith('gnukfreebsd'):
+ assert_equal(ext, '.so')
+ elif sys.platform.startswith('darwin'):
+ assert_equal(ext, '.dylib')
+ elif sys.platform.startswith('win'):
+ assert_equal(ext, '.dll')
+ # just check for no crash
+ assert_(get_shared_lib_extension(is_python_ext=True))
+
+
+def test_installed_npymath_ini():
+ # Regression test for gh-7707. If npymath.ini wasn't installed, then this
+ # will give an error.
+ info = get_info('npymath')
+
+ assert isinstance(info, dict)
+ assert "define_macros" in info
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/tests/test_npy_pkg_config.py b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/tests/test_npy_pkg_config.py
new file mode 100644
index 0000000000000000000000000000000000000000..b287ebe2e83209fdcf5add161a7af8d988b9d086
--- /dev/null
+++ b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/tests/test_npy_pkg_config.py
@@ -0,0 +1,84 @@
+import os
+
+from numpy.distutils.npy_pkg_config import read_config, parse_flags
+from numpy.testing import temppath, assert_
+
+simple = """\
+[meta]
+Name = foo
+Description = foo lib
+Version = 0.1
+
+[default]
+cflags = -I/usr/include
+libs = -L/usr/lib
+"""
+simple_d = {'cflags': '-I/usr/include', 'libflags': '-L/usr/lib',
+ 'version': '0.1', 'name': 'foo'}
+
+simple_variable = """\
+[meta]
+Name = foo
+Description = foo lib
+Version = 0.1
+
+[variables]
+prefix = /foo/bar
+libdir = ${prefix}/lib
+includedir = ${prefix}/include
+
+[default]
+cflags = -I${includedir}
+libs = -L${libdir}
+"""
+simple_variable_d = {'cflags': '-I/foo/bar/include', 'libflags': '-L/foo/bar/lib',
+ 'version': '0.1', 'name': 'foo'}
+
+class TestLibraryInfo:
+ def test_simple(self):
+ with temppath('foo.ini') as path:
+ with open(path, 'w') as f:
+ f.write(simple)
+ pkg = os.path.splitext(path)[0]
+ out = read_config(pkg)
+
+ assert_(out.cflags() == simple_d['cflags'])
+ assert_(out.libs() == simple_d['libflags'])
+ assert_(out.name == simple_d['name'])
+ assert_(out.version == simple_d['version'])
+
+ def test_simple_variable(self):
+ with temppath('foo.ini') as path:
+ with open(path, 'w') as f:
+ f.write(simple_variable)
+ pkg = os.path.splitext(path)[0]
+ out = read_config(pkg)
+
+ assert_(out.cflags() == simple_variable_d['cflags'])
+ assert_(out.libs() == simple_variable_d['libflags'])
+ assert_(out.name == simple_variable_d['name'])
+ assert_(out.version == simple_variable_d['version'])
+ out.vars['prefix'] = '/Users/david'
+ assert_(out.cflags() == '-I/Users/david/include')
+
+class TestParseFlags:
+ def test_simple_cflags(self):
+ d = parse_flags("-I/usr/include")
+ assert_(d['include_dirs'] == ['/usr/include'])
+
+ d = parse_flags("-I/usr/include -DFOO")
+ assert_(d['include_dirs'] == ['/usr/include'])
+ assert_(d['macros'] == ['FOO'])
+
+ d = parse_flags("-I /usr/include -DFOO")
+ assert_(d['include_dirs'] == ['/usr/include'])
+ assert_(d['macros'] == ['FOO'])
+
+ def test_simple_lflags(self):
+ d = parse_flags("-L/usr/lib -lfoo -L/usr/lib -lbar")
+ assert_(d['library_dirs'] == ['/usr/lib', '/usr/lib'])
+ assert_(d['libraries'] == ['foo', 'bar'])
+
+ d = parse_flags("-L /usr/lib -lfoo -L/usr/lib -lbar")
+ assert_(d['library_dirs'] == ['/usr/lib', '/usr/lib'])
+ assert_(d['libraries'] == ['foo', 'bar'])
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/tests/test_shell_utils.py b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/tests/test_shell_utils.py
new file mode 100644
index 0000000000000000000000000000000000000000..696d38ddd66a41ec5f51f4c93d26d3f0df29b483
--- /dev/null
+++ b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/tests/test_shell_utils.py
@@ -0,0 +1,79 @@
+import pytest
+import subprocess
+import json
+import sys
+
+from numpy.distutils import _shell_utils
+from numpy.testing import IS_WASM
+
+argv_cases = [
+ [r'exe'],
+ [r'path/exe'],
+ [r'path\exe'],
+ [r'\\server\path\exe'],
+ [r'path to/exe'],
+ [r'path to\exe'],
+
+ [r'exe', '--flag'],
+ [r'path/exe', '--flag'],
+ [r'path\exe', '--flag'],
+ [r'path to/exe', '--flag'],
+ [r'path to\exe', '--flag'],
+
+ # flags containing literal quotes in their name
+ [r'path to/exe', '--flag-"quoted"'],
+ [r'path to\exe', '--flag-"quoted"'],
+ [r'path to/exe', '"--flag-quoted"'],
+ [r'path to\exe', '"--flag-quoted"'],
+]
+
+
+@pytest.fixture(params=[
+ _shell_utils.WindowsParser,
+ _shell_utils.PosixParser
+])
+def Parser(request):
+ return request.param
+
+
+@pytest.fixture
+def runner(Parser):
+ if Parser != _shell_utils.NativeParser:
+ pytest.skip('Unable to run with non-native parser')
+
+ if Parser == _shell_utils.WindowsParser:
+ return lambda cmd: subprocess.check_output(cmd)
+ elif Parser == _shell_utils.PosixParser:
+ # posix has no non-shell string parsing
+ return lambda cmd: subprocess.check_output(cmd, shell=True)
+ else:
+ raise NotImplementedError
+
+
+@pytest.mark.skipif(IS_WASM, reason="Cannot start subprocess")
+@pytest.mark.parametrize('argv', argv_cases)
+def test_join_matches_subprocess(Parser, runner, argv):
+ """
+ Test that join produces strings understood by subprocess
+ """
+ # invoke python to return its arguments as json
+ cmd = [
+ sys.executable, '-c',
+ 'import json, sys; print(json.dumps(sys.argv[1:]))'
+ ]
+ joined = Parser.join(cmd + argv)
+ json_out = runner(joined).decode()
+ assert json.loads(json_out) == argv
+
+
+@pytest.mark.skipif(IS_WASM, reason="Cannot start subprocess")
+@pytest.mark.parametrize('argv', argv_cases)
+def test_roundtrip(Parser, argv):
+ """
+ Test that split is the inverse operation of join
+ """
+ try:
+ joined = Parser.join(argv)
+ assert argv == Parser.split(joined)
+ except NotImplementedError:
+ pytest.skip("Not implemented")
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/tests/test_system_info.py b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/tests/test_system_info.py
new file mode 100644
index 0000000000000000000000000000000000000000..9bcc09050503e7f1bb3e94eecc902f512a9e42a1
--- /dev/null
+++ b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/tests/test_system_info.py
@@ -0,0 +1,334 @@
+import os
+import shutil
+import pytest
+from tempfile import mkstemp, mkdtemp
+from subprocess import Popen, PIPE
+import importlib.metadata
+from distutils.errors import DistutilsError
+
+from numpy.testing import assert_, assert_equal, assert_raises
+from numpy.distutils import ccompiler, customized_ccompiler
+from numpy.distutils.system_info import system_info, ConfigParser, mkl_info
+from numpy.distutils.system_info import AliasedOptionError
+from numpy.distutils.system_info import default_lib_dirs, default_include_dirs
+from numpy.distutils import _shell_utils
+
+
+try:
+ if importlib.metadata.version('setuptools') >= '60':
+ # pkg-resources gives deprecation warnings, and there may be more
+ # issues. We only support setuptools <60
+ pytest.skip("setuptools is too new", allow_module_level=True)
+except importlib.metadata.PackageNotFoundError:
+ # we don't require `setuptools`; if it is not found, continue
+ pass
+
+
+def get_class(name, notfound_action=1):
+ """
+ notfound_action:
+ 0 - do nothing
+ 1 - display warning message
+ 2 - raise error
+ """
+ cl = {'temp1': Temp1Info,
+ 'temp2': Temp2Info,
+ 'duplicate_options': DuplicateOptionInfo,
+ }.get(name.lower(), _system_info)
+ return cl()
+
+simple_site = """
+[ALL]
+library_dirs = {dir1:s}{pathsep:s}{dir2:s}
+libraries = {lib1:s},{lib2:s}
+extra_compile_args = -I/fake/directory -I"/path with/spaces" -Os
+runtime_library_dirs = {dir1:s}
+
+[temp1]
+library_dirs = {dir1:s}
+libraries = {lib1:s}
+runtime_library_dirs = {dir1:s}
+
+[temp2]
+library_dirs = {dir2:s}
+libraries = {lib2:s}
+extra_link_args = -Wl,-rpath={lib2_escaped:s}
+rpath = {dir2:s}
+
+[duplicate_options]
+mylib_libs = {lib1:s}
+libraries = {lib2:s}
+"""
+site_cfg = simple_site
+
+fakelib_c_text = """
+/* This file is generated from numpy/distutils/testing/test_system_info.py */
+#include
+void foo(void) {
+ printf("Hello foo");
+}
+void bar(void) {
+ printf("Hello bar");
+}
+"""
+
+def have_compiler():
+ """ Return True if there appears to be an executable compiler
+ """
+ compiler = customized_ccompiler()
+ try:
+ cmd = compiler.compiler # Unix compilers
+ except AttributeError:
+ try:
+ if not compiler.initialized:
+ compiler.initialize() # MSVC is different
+ except (DistutilsError, ValueError):
+ return False
+ cmd = [compiler.cc]
+ try:
+ p = Popen(cmd, stdout=PIPE, stderr=PIPE)
+ p.stdout.close()
+ p.stderr.close()
+ p.wait()
+ except OSError:
+ return False
+ return True
+
+
+HAVE_COMPILER = have_compiler()
+
+
+class _system_info(system_info):
+
+ def __init__(self,
+ default_lib_dirs=default_lib_dirs,
+ default_include_dirs=default_include_dirs,
+ verbosity=1,
+ ):
+ self.__class__.info = {}
+ self.local_prefixes = []
+ defaults = {'library_dirs': '',
+ 'include_dirs': '',
+ 'runtime_library_dirs': '',
+ 'rpath': '',
+ 'src_dirs': '',
+ 'search_static_first': "0",
+ 'extra_compile_args': '',
+ 'extra_link_args': ''}
+ self.cp = ConfigParser(defaults)
+ # We have to parse the config files afterwards
+ # to have a consistent temporary filepath
+
+ def _check_libs(self, lib_dirs, libs, opt_libs, exts):
+ """Override _check_libs to return with all dirs """
+ info = {'libraries': libs, 'library_dirs': lib_dirs}
+ return info
+
+
+class Temp1Info(_system_info):
+ """For testing purposes"""
+ section = 'temp1'
+
+
+class Temp2Info(_system_info):
+ """For testing purposes"""
+ section = 'temp2'
+
+class DuplicateOptionInfo(_system_info):
+ """For testing purposes"""
+ section = 'duplicate_options'
+
+
+class TestSystemInfoReading:
+
+ def setup_method(self):
+ """ Create the libraries """
+ # Create 2 sources and 2 libraries
+ self._dir1 = mkdtemp()
+ self._src1 = os.path.join(self._dir1, 'foo.c')
+ self._lib1 = os.path.join(self._dir1, 'libfoo.so')
+ self._dir2 = mkdtemp()
+ self._src2 = os.path.join(self._dir2, 'bar.c')
+ self._lib2 = os.path.join(self._dir2, 'libbar.so')
+ # Update local site.cfg
+ global simple_site, site_cfg
+ site_cfg = simple_site.format(**{
+ 'dir1': self._dir1,
+ 'lib1': self._lib1,
+ 'dir2': self._dir2,
+ 'lib2': self._lib2,
+ 'pathsep': os.pathsep,
+ 'lib2_escaped': _shell_utils.NativeParser.join([self._lib2])
+ })
+ # Write site.cfg
+ fd, self._sitecfg = mkstemp()
+ os.close(fd)
+ with open(self._sitecfg, 'w') as fd:
+ fd.write(site_cfg)
+ # Write the sources
+ with open(self._src1, 'w') as fd:
+ fd.write(fakelib_c_text)
+ with open(self._src2, 'w') as fd:
+ fd.write(fakelib_c_text)
+ # We create all class-instances
+
+ def site_and_parse(c, site_cfg):
+ c.files = [site_cfg]
+ c.parse_config_files()
+ return c
+ self.c_default = site_and_parse(get_class('default'), self._sitecfg)
+ self.c_temp1 = site_and_parse(get_class('temp1'), self._sitecfg)
+ self.c_temp2 = site_and_parse(get_class('temp2'), self._sitecfg)
+ self.c_dup_options = site_and_parse(get_class('duplicate_options'),
+ self._sitecfg)
+
+ def teardown_method(self):
+ # Do each removal separately
+ try:
+ shutil.rmtree(self._dir1)
+ except Exception:
+ pass
+ try:
+ shutil.rmtree(self._dir2)
+ except Exception:
+ pass
+ try:
+ os.remove(self._sitecfg)
+ except Exception:
+ pass
+
+ def test_all(self):
+ # Read in all information in the ALL block
+ tsi = self.c_default
+ assert_equal(tsi.get_lib_dirs(), [self._dir1, self._dir2])
+ assert_equal(tsi.get_libraries(), [self._lib1, self._lib2])
+ assert_equal(tsi.get_runtime_lib_dirs(), [self._dir1])
+ extra = tsi.calc_extra_info()
+ assert_equal(extra['extra_compile_args'], ['-I/fake/directory', '-I/path with/spaces', '-Os'])
+
+ def test_temp1(self):
+ # Read in all information in the temp1 block
+ tsi = self.c_temp1
+ assert_equal(tsi.get_lib_dirs(), [self._dir1])
+ assert_equal(tsi.get_libraries(), [self._lib1])
+ assert_equal(tsi.get_runtime_lib_dirs(), [self._dir1])
+
+ def test_temp2(self):
+ # Read in all information in the temp2 block
+ tsi = self.c_temp2
+ assert_equal(tsi.get_lib_dirs(), [self._dir2])
+ assert_equal(tsi.get_libraries(), [self._lib2])
+ # Now from rpath and not runtime_library_dirs
+ assert_equal(tsi.get_runtime_lib_dirs(key='rpath'), [self._dir2])
+ extra = tsi.calc_extra_info()
+ assert_equal(extra['extra_link_args'], ['-Wl,-rpath=' + self._lib2])
+
+ def test_duplicate_options(self):
+ # Ensure that duplicates are raising an AliasedOptionError
+ tsi = self.c_dup_options
+ assert_raises(AliasedOptionError, tsi.get_option_single, "mylib_libs", "libraries")
+ assert_equal(tsi.get_libs("mylib_libs", [self._lib1]), [self._lib1])
+ assert_equal(tsi.get_libs("libraries", [self._lib2]), [self._lib2])
+
+ @pytest.mark.skipif(not HAVE_COMPILER, reason="Missing compiler")
+ def test_compile1(self):
+ # Compile source and link the first source
+ c = customized_ccompiler()
+ previousDir = os.getcwd()
+ try:
+ # Change directory to not screw up directories
+ os.chdir(self._dir1)
+ c.compile([os.path.basename(self._src1)], output_dir=self._dir1)
+ # Ensure that the object exists
+ assert_(os.path.isfile(self._src1.replace('.c', '.o')) or
+ os.path.isfile(self._src1.replace('.c', '.obj')))
+ finally:
+ os.chdir(previousDir)
+
+ @pytest.mark.skipif(not HAVE_COMPILER, reason="Missing compiler")
+ @pytest.mark.skipif('msvc' in repr(ccompiler.new_compiler()),
+ reason="Fails with MSVC compiler ")
+ def test_compile2(self):
+ # Compile source and link the second source
+ tsi = self.c_temp2
+ c = customized_ccompiler()
+ extra_link_args = tsi.calc_extra_info()['extra_link_args']
+ previousDir = os.getcwd()
+ try:
+ # Change directory to not screw up directories
+ os.chdir(self._dir2)
+ c.compile([os.path.basename(self._src2)], output_dir=self._dir2,
+ extra_postargs=extra_link_args)
+ # Ensure that the object exists
+ assert_(os.path.isfile(self._src2.replace('.c', '.o')))
+ finally:
+ os.chdir(previousDir)
+
+ HAS_MKL = "mkl_rt" in mkl_info().calc_libraries_info().get("libraries", [])
+
+ @pytest.mark.xfail(HAS_MKL, reason=("`[DEFAULT]` override doesn't work if "
+ "numpy is built with MKL support"))
+ def test_overrides(self):
+ previousDir = os.getcwd()
+ cfg = os.path.join(self._dir1, 'site.cfg')
+ shutil.copy(self._sitecfg, cfg)
+ try:
+ os.chdir(self._dir1)
+ # Check that the '[ALL]' section does not override
+ # missing values from other sections
+ info = mkl_info()
+ lib_dirs = info.cp['ALL']['library_dirs'].split(os.pathsep)
+ assert info.get_lib_dirs() != lib_dirs
+
+ # But if we copy the values to a '[mkl]' section the value
+ # is correct
+ with open(cfg) as fid:
+ mkl = fid.read().replace('[ALL]', '[mkl]', 1)
+ with open(cfg, 'w') as fid:
+ fid.write(mkl)
+ info = mkl_info()
+ assert info.get_lib_dirs() == lib_dirs
+
+ # Also, the values will be taken from a section named '[DEFAULT]'
+ with open(cfg) as fid:
+ dflt = fid.read().replace('[mkl]', '[DEFAULT]', 1)
+ with open(cfg, 'w') as fid:
+ fid.write(dflt)
+ info = mkl_info()
+ assert info.get_lib_dirs() == lib_dirs
+ finally:
+ os.chdir(previousDir)
+
+
+def test_distutils_parse_env_order(monkeypatch):
+ from numpy.distutils.system_info import _parse_env_order
+ env = 'NPY_TESTS_DISTUTILS_PARSE_ENV_ORDER'
+
+ base_order = list('abcdef')
+
+ monkeypatch.setenv(env, 'b,i,e,f')
+ order, unknown = _parse_env_order(base_order, env)
+ assert len(order) == 3
+ assert order == list('bef')
+ assert len(unknown) == 1
+
+ # For when LAPACK/BLAS optimization is disabled
+ monkeypatch.setenv(env, '')
+ order, unknown = _parse_env_order(base_order, env)
+ assert len(order) == 0
+ assert len(unknown) == 0
+
+ for prefix in '^!':
+ monkeypatch.setenv(env, f'{prefix}b,i,e')
+ order, unknown = _parse_env_order(base_order, env)
+ assert len(order) == 4
+ assert order == list('acdf')
+ assert len(unknown) == 1
+
+ with pytest.raises(ValueError):
+ monkeypatch.setenv(env, 'b,^e,i')
+ _parse_env_order(base_order, env)
+
+ with pytest.raises(ValueError):
+ monkeypatch.setenv(env, '!b,^e,i')
+ _parse_env_order(base_order, env)
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/unixccompiler.py b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/unixccompiler.py
new file mode 100644
index 0000000000000000000000000000000000000000..4884960fdf227497df644b71b129ce561e3b49e0
--- /dev/null
+++ b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/distutils/unixccompiler.py
@@ -0,0 +1,141 @@
+"""
+unixccompiler - can handle very long argument lists for ar.
+
+"""
+import os
+import sys
+import subprocess
+import shlex
+
+from distutils.errors import CompileError, DistutilsExecError, LibError
+from distutils.unixccompiler import UnixCCompiler
+from numpy.distutils.ccompiler import replace_method
+from numpy.distutils.misc_util import _commandline_dep_string
+from numpy.distutils import log
+
+# Note that UnixCCompiler._compile appeared in Python 2.3
+def UnixCCompiler__compile(self, obj, src, ext, cc_args, extra_postargs, pp_opts):
+ """Compile a single source files with a Unix-style compiler."""
+ # HP ad-hoc fix, see ticket 1383
+ ccomp = self.compiler_so
+ if ccomp[0] == 'aCC':
+ # remove flags that will trigger ANSI-C mode for aCC
+ if '-Ae' in ccomp:
+ ccomp.remove('-Ae')
+ if '-Aa' in ccomp:
+ ccomp.remove('-Aa')
+ # add flags for (almost) sane C++ handling
+ ccomp += ['-AA']
+ self.compiler_so = ccomp
+ # ensure OPT environment variable is read
+ if 'OPT' in os.environ:
+ # XXX who uses this?
+ from sysconfig import get_config_vars
+ opt = shlex.join(shlex.split(os.environ['OPT']))
+ gcv_opt = shlex.join(shlex.split(get_config_vars('OPT')[0]))
+ ccomp_s = shlex.join(self.compiler_so)
+ if opt not in ccomp_s:
+ ccomp_s = ccomp_s.replace(gcv_opt, opt)
+ self.compiler_so = shlex.split(ccomp_s)
+ llink_s = shlex.join(self.linker_so)
+ if opt not in llink_s:
+ self.linker_so = self.linker_so + shlex.split(opt)
+
+ display = '%s: %s' % (os.path.basename(self.compiler_so[0]), src)
+
+ # gcc style automatic dependencies, outputs a makefile (-MF) that lists
+ # all headers needed by a c file as a side effect of compilation (-MMD)
+ if getattr(self, '_auto_depends', False):
+ deps = ['-MMD', '-MF', obj + '.d']
+ else:
+ deps = []
+
+ try:
+ self.spawn(self.compiler_so + cc_args + [src, '-o', obj] + deps +
+ extra_postargs, display = display)
+ except DistutilsExecError as e:
+ msg = str(e)
+ raise CompileError(msg) from None
+
+ # add commandline flags to dependency file
+ if deps:
+ # After running the compiler, the file created will be in EBCDIC
+ # but will not be tagged as such. This tags it so the file does not
+ # have multiple different encodings being written to it
+ if sys.platform == 'zos':
+ subprocess.check_output(['chtag', '-tc', 'IBM1047', obj + '.d'])
+ with open(obj + '.d', 'a') as f:
+ f.write(_commandline_dep_string(cc_args, extra_postargs, pp_opts))
+
+replace_method(UnixCCompiler, '_compile', UnixCCompiler__compile)
+
+
+def UnixCCompiler_create_static_lib(self, objects, output_libname,
+ output_dir=None, debug=0, target_lang=None):
+ """
+ Build a static library in a separate sub-process.
+
+ Parameters
+ ----------
+ objects : list or tuple of str
+ List of paths to object files used to build the static library.
+ output_libname : str
+ The library name as an absolute or relative (if `output_dir` is used)
+ path.
+ output_dir : str, optional
+ The path to the output directory. Default is None, in which case
+ the ``output_dir`` attribute of the UnixCCompiler instance.
+ debug : bool, optional
+ This parameter is not used.
+ target_lang : str, optional
+ This parameter is not used.
+
+ Returns
+ -------
+ None
+
+ """
+ objects, output_dir = self._fix_object_args(objects, output_dir)
+
+ output_filename = \
+ self.library_filename(output_libname, output_dir=output_dir)
+
+ if self._need_link(objects, output_filename):
+ try:
+ # previous .a may be screwed up; best to remove it first
+ # and recreate.
+ # Also, ar on OS X doesn't handle updating universal archives
+ os.unlink(output_filename)
+ except OSError:
+ pass
+ self.mkpath(os.path.dirname(output_filename))
+ tmp_objects = objects + self.objects
+ while tmp_objects:
+ objects = tmp_objects[:50]
+ tmp_objects = tmp_objects[50:]
+ display = '%s: adding %d object files to %s' % (
+ os.path.basename(self.archiver[0]),
+ len(objects), output_filename)
+ self.spawn(self.archiver + [output_filename] + objects,
+ display = display)
+
+ # Not many Unices required ranlib anymore -- SunOS 4.x is, I
+ # think the only major Unix that does. Maybe we need some
+ # platform intelligence here to skip ranlib if it's not
+ # needed -- or maybe Python's configure script took care of
+ # it for us, hence the check for leading colon.
+ if self.ranlib:
+ display = '%s:@ %s' % (os.path.basename(self.ranlib[0]),
+ output_filename)
+ try:
+ self.spawn(self.ranlib + [output_filename],
+ display = display)
+ except DistutilsExecError as e:
+ msg = str(e)
+ raise LibError(msg) from None
+ else:
+ log.debug("skipping %s (up-to-date)", output_filename)
+ return
+
+replace_method(UnixCCompiler, 'create_static_lib',
+ UnixCCompiler_create_static_lib)
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/doc/__init__.py b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/doc/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..8a944fecd865487e489ecefb90700f5eed38cd44
--- /dev/null
+++ b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/doc/__init__.py
@@ -0,0 +1,26 @@
+import os
+
+ref_dir = os.path.join(os.path.dirname(__file__))
+
+__all__ = sorted(f[:-3] for f in os.listdir(ref_dir) if f.endswith('.py') and
+ not f.startswith('__'))
+
+for f in __all__:
+ __import__(__name__ + '.' + f)
+
+del f, ref_dir
+
+__doc__ = """\
+Topical documentation
+=====================
+
+The following topics are available:
+%s
+
+You can view them by
+
+>>> help(np.doc.TOPIC) #doctest: +SKIP
+
+""" % '\n- '.join([''] + __all__)
+
+__all__.extend(['__doc__'])
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/doc/__pycache__/__init__.cpython-311.pyc b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/doc/__pycache__/__init__.cpython-311.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..2ec1d5a78e9fd950f728f4de23e722526d2b61d9
Binary files /dev/null and b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/doc/__pycache__/__init__.cpython-311.pyc differ
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/doc/__pycache__/constants.cpython-311.pyc b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/doc/__pycache__/constants.cpython-311.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..a5a4c4e6bfeb3e1386131c8384150169023d9803
Binary files /dev/null and b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/doc/__pycache__/constants.cpython-311.pyc differ
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/doc/__pycache__/ufuncs.cpython-311.pyc b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/doc/__pycache__/ufuncs.cpython-311.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..dd413ea70e1c16c41cbc6c0c9b95ee5715f3ad2c
Binary files /dev/null and b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/doc/__pycache__/ufuncs.cpython-311.pyc differ
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/doc/constants.py b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/doc/constants.py
new file mode 100644
index 0000000000000000000000000000000000000000..4db5c639047fc3de2c519b2ca1f6b8d525469900
--- /dev/null
+++ b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/doc/constants.py
@@ -0,0 +1,412 @@
+"""
+=========
+Constants
+=========
+
+.. currentmodule:: numpy
+
+NumPy includes several constants:
+
+%(constant_list)s
+"""
+#
+# Note: the docstring is autogenerated.
+#
+import re
+import textwrap
+
+# Maintain same format as in numpy.add_newdocs
+constants = []
+def add_newdoc(module, name, doc):
+ constants.append((name, doc))
+
+add_newdoc('numpy', 'pi',
+ """
+ ``pi = 3.1415926535897932384626433...``
+
+ References
+ ----------
+ https://en.wikipedia.org/wiki/Pi
+
+ """)
+
+add_newdoc('numpy', 'e',
+ """
+ Euler's constant, base of natural logarithms, Napier's constant.
+
+ ``e = 2.71828182845904523536028747135266249775724709369995...``
+
+ See Also
+ --------
+ exp : Exponential function
+ log : Natural logarithm
+
+ References
+ ----------
+ https://en.wikipedia.org/wiki/E_%28mathematical_constant%29
+
+ """)
+
+add_newdoc('numpy', 'euler_gamma',
+ """
+ ``γ = 0.5772156649015328606065120900824024310421...``
+
+ References
+ ----------
+ https://en.wikipedia.org/wiki/Euler-Mascheroni_constant
+
+ """)
+
+add_newdoc('numpy', 'inf',
+ """
+ IEEE 754 floating point representation of (positive) infinity.
+
+ Returns
+ -------
+ y : float
+ A floating point representation of positive infinity.
+
+ See Also
+ --------
+ isinf : Shows which elements are positive or negative infinity
+
+ isposinf : Shows which elements are positive infinity
+
+ isneginf : Shows which elements are negative infinity
+
+ isnan : Shows which elements are Not a Number
+
+ isfinite : Shows which elements are finite (not one of Not a Number,
+ positive infinity and negative infinity)
+
+ Notes
+ -----
+ NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic
+ (IEEE 754). This means that Not a Number is not equivalent to infinity.
+ Also that positive infinity is not equivalent to negative infinity. But
+ infinity is equivalent to positive infinity.
+
+ `Inf`, `Infinity`, `PINF` and `infty` are aliases for `inf`.
+
+ Examples
+ --------
+ >>> np.inf
+ inf
+ >>> np.array([1]) / 0.
+ array([ Inf])
+
+ """)
+
+add_newdoc('numpy', 'nan',
+ """
+ IEEE 754 floating point representation of Not a Number (NaN).
+
+ Returns
+ -------
+ y : A floating point representation of Not a Number.
+
+ See Also
+ --------
+ isnan : Shows which elements are Not a Number.
+
+ isfinite : Shows which elements are finite (not one of
+ Not a Number, positive infinity and negative infinity)
+
+ Notes
+ -----
+ NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic
+ (IEEE 754). This means that Not a Number is not equivalent to infinity.
+
+ `NaN` and `NAN` are aliases of `nan`.
+
+ Examples
+ --------
+ >>> np.nan
+ nan
+ >>> np.log(-1)
+ nan
+ >>> np.log([-1, 1, 2])
+ array([ NaN, 0. , 0.69314718])
+
+ """)
+
+add_newdoc('numpy', 'newaxis',
+ """
+ A convenient alias for None, useful for indexing arrays.
+
+ Examples
+ --------
+ >>> newaxis is None
+ True
+ >>> x = np.arange(3)
+ >>> x
+ array([0, 1, 2])
+ >>> x[:, newaxis]
+ array([[0],
+ [1],
+ [2]])
+ >>> x[:, newaxis, newaxis]
+ array([[[0]],
+ [[1]],
+ [[2]]])
+ >>> x[:, newaxis] * x
+ array([[0, 0, 0],
+ [0, 1, 2],
+ [0, 2, 4]])
+
+ Outer product, same as ``outer(x, y)``:
+
+ >>> y = np.arange(3, 6)
+ >>> x[:, newaxis] * y
+ array([[ 0, 0, 0],
+ [ 3, 4, 5],
+ [ 6, 8, 10]])
+
+ ``x[newaxis, :]`` is equivalent to ``x[newaxis]`` and ``x[None]``:
+
+ >>> x[newaxis, :].shape
+ (1, 3)
+ >>> x[newaxis].shape
+ (1, 3)
+ >>> x[None].shape
+ (1, 3)
+ >>> x[:, newaxis].shape
+ (3, 1)
+
+ """)
+
+add_newdoc('numpy', 'NZERO',
+ """
+ IEEE 754 floating point representation of negative zero.
+
+ Returns
+ -------
+ y : float
+ A floating point representation of negative zero.
+
+ See Also
+ --------
+ PZERO : Defines positive zero.
+
+ isinf : Shows which elements are positive or negative infinity.
+
+ isposinf : Shows which elements are positive infinity.
+
+ isneginf : Shows which elements are negative infinity.
+
+ isnan : Shows which elements are Not a Number.
+
+ isfinite : Shows which elements are finite - not one of
+ Not a Number, positive infinity and negative infinity.
+
+ Notes
+ -----
+ NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic
+ (IEEE 754). Negative zero is considered to be a finite number.
+
+ Examples
+ --------
+ >>> np.NZERO
+ -0.0
+ >>> np.PZERO
+ 0.0
+
+ >>> np.isfinite([np.NZERO])
+ array([ True])
+ >>> np.isnan([np.NZERO])
+ array([False])
+ >>> np.isinf([np.NZERO])
+ array([False])
+
+ """)
+
+add_newdoc('numpy', 'PZERO',
+ """
+ IEEE 754 floating point representation of positive zero.
+
+ Returns
+ -------
+ y : float
+ A floating point representation of positive zero.
+
+ See Also
+ --------
+ NZERO : Defines negative zero.
+
+ isinf : Shows which elements are positive or negative infinity.
+
+ isposinf : Shows which elements are positive infinity.
+
+ isneginf : Shows which elements are negative infinity.
+
+ isnan : Shows which elements are Not a Number.
+
+ isfinite : Shows which elements are finite - not one of
+ Not a Number, positive infinity and negative infinity.
+
+ Notes
+ -----
+ NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic
+ (IEEE 754). Positive zero is considered to be a finite number.
+
+ Examples
+ --------
+ >>> np.PZERO
+ 0.0
+ >>> np.NZERO
+ -0.0
+
+ >>> np.isfinite([np.PZERO])
+ array([ True])
+ >>> np.isnan([np.PZERO])
+ array([False])
+ >>> np.isinf([np.PZERO])
+ array([False])
+
+ """)
+
+add_newdoc('numpy', 'NAN',
+ """
+ IEEE 754 floating point representation of Not a Number (NaN).
+
+ `NaN` and `NAN` are equivalent definitions of `nan`. Please use
+ `nan` instead of `NAN`.
+
+ See Also
+ --------
+ nan
+
+ """)
+
+add_newdoc('numpy', 'NaN',
+ """
+ IEEE 754 floating point representation of Not a Number (NaN).
+
+ `NaN` and `NAN` are equivalent definitions of `nan`. Please use
+ `nan` instead of `NaN`.
+
+ See Also
+ --------
+ nan
+
+ """)
+
+add_newdoc('numpy', 'NINF',
+ """
+ IEEE 754 floating point representation of negative infinity.
+
+ Returns
+ -------
+ y : float
+ A floating point representation of negative infinity.
+
+ See Also
+ --------
+ isinf : Shows which elements are positive or negative infinity
+
+ isposinf : Shows which elements are positive infinity
+
+ isneginf : Shows which elements are negative infinity
+
+ isnan : Shows which elements are Not a Number
+
+ isfinite : Shows which elements are finite (not one of Not a Number,
+ positive infinity and negative infinity)
+
+ Notes
+ -----
+ NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic
+ (IEEE 754). This means that Not a Number is not equivalent to infinity.
+ Also that positive infinity is not equivalent to negative infinity. But
+ infinity is equivalent to positive infinity.
+
+ Examples
+ --------
+ >>> np.NINF
+ -inf
+ >>> np.log(0)
+ -inf
+
+ """)
+
+add_newdoc('numpy', 'PINF',
+ """
+ IEEE 754 floating point representation of (positive) infinity.
+
+ Use `inf` because `Inf`, `Infinity`, `PINF` and `infty` are aliases for
+ `inf`. For more details, see `inf`.
+
+ See Also
+ --------
+ inf
+
+ """)
+
+add_newdoc('numpy', 'infty',
+ """
+ IEEE 754 floating point representation of (positive) infinity.
+
+ Use `inf` because `Inf`, `Infinity`, `PINF` and `infty` are aliases for
+ `inf`. For more details, see `inf`.
+
+ See Also
+ --------
+ inf
+
+ """)
+
+add_newdoc('numpy', 'Inf',
+ """
+ IEEE 754 floating point representation of (positive) infinity.
+
+ Use `inf` because `Inf`, `Infinity`, `PINF` and `infty` are aliases for
+ `inf`. For more details, see `inf`.
+
+ See Also
+ --------
+ inf
+
+ """)
+
+add_newdoc('numpy', 'Infinity',
+ """
+ IEEE 754 floating point representation of (positive) infinity.
+
+ Use `inf` because `Inf`, `Infinity`, `PINF` and `infty` are aliases for
+ `inf`. For more details, see `inf`.
+
+ See Also
+ --------
+ inf
+
+ """)
+
+
+if __doc__:
+ constants_str = []
+ constants.sort()
+ for name, doc in constants:
+ s = textwrap.dedent(doc).replace("\n", "\n ")
+
+ # Replace sections by rubrics
+ lines = s.split("\n")
+ new_lines = []
+ for line in lines:
+ m = re.match(r'^(\s+)[-=]+\s*$', line)
+ if m and new_lines:
+ prev = textwrap.dedent(new_lines.pop())
+ new_lines.append('%s.. rubric:: %s' % (m.group(1), prev))
+ new_lines.append('')
+ else:
+ new_lines.append(line)
+ s = "\n".join(new_lines)
+
+ # Done.
+ constants_str.append(""".. data:: %s\n %s""" % (name, s))
+ constants_str = "\n".join(constants_str)
+
+ __doc__ = __doc__ % dict(constant_list=constants_str)
+ del constants_str, name, doc
+ del line, lines, new_lines, m, s, prev
+
+del constants, add_newdoc
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/doc/ufuncs.py b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/doc/ufuncs.py
new file mode 100644
index 0000000000000000000000000000000000000000..c99e9abc99a55a799899579fb0dec9ae4dccf54c
--- /dev/null
+++ b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/doc/ufuncs.py
@@ -0,0 +1,137 @@
+"""
+===================
+Universal Functions
+===================
+
+Ufuncs are, generally speaking, mathematical functions or operations that are
+applied element-by-element to the contents of an array. That is, the result
+in each output array element only depends on the value in the corresponding
+input array (or arrays) and on no other array elements. NumPy comes with a
+large suite of ufuncs, and scipy extends that suite substantially. The simplest
+example is the addition operator: ::
+
+ >>> np.array([0,2,3,4]) + np.array([1,1,-1,2])
+ array([1, 3, 2, 6])
+
+The ufunc module lists all the available ufuncs in numpy. Documentation on
+the specific ufuncs may be found in those modules. This documentation is
+intended to address the more general aspects of ufuncs common to most of
+them. All of the ufuncs that make use of Python operators (e.g., +, -, etc.)
+have equivalent functions defined (e.g. add() for +)
+
+Type coercion
+=============
+
+What happens when a binary operator (e.g., +,-,\\*,/, etc) deals with arrays of
+two different types? What is the type of the result? Typically, the result is
+the higher of the two types. For example: ::
+
+ float32 + float64 -> float64
+ int8 + int32 -> int32
+ int16 + float32 -> float32
+ float32 + complex64 -> complex64
+
+There are some less obvious cases generally involving mixes of types
+(e.g. uints, ints and floats) where equal bit sizes for each are not
+capable of saving all the information in a different type of equivalent
+bit size. Some examples are int32 vs float32 or uint32 vs int32.
+Generally, the result is the higher type of larger size than both
+(if available). So: ::
+
+ int32 + float32 -> float64
+ uint32 + int32 -> int64
+
+Finally, the type coercion behavior when expressions involve Python
+scalars is different than that seen for arrays. Since Python has a
+limited number of types, combining a Python int with a dtype=np.int8
+array does not coerce to the higher type but instead, the type of the
+array prevails. So the rules for Python scalars combined with arrays is
+that the result will be that of the array equivalent the Python scalar
+if the Python scalar is of a higher 'kind' than the array (e.g., float
+vs. int), otherwise the resultant type will be that of the array.
+For example: ::
+
+ Python int + int8 -> int8
+ Python float + int8 -> float64
+
+ufunc methods
+=============
+
+Binary ufuncs support 4 methods.
+
+**.reduce(arr)** applies the binary operator to elements of the array in
+ sequence. For example: ::
+
+ >>> np.add.reduce(np.arange(10)) # adds all elements of array
+ 45
+
+For multidimensional arrays, the first dimension is reduced by default: ::
+
+ >>> np.add.reduce(np.arange(10).reshape(2,5))
+ array([ 5, 7, 9, 11, 13])
+
+The axis keyword can be used to specify different axes to reduce: ::
+
+ >>> np.add.reduce(np.arange(10).reshape(2,5),axis=1)
+ array([10, 35])
+
+**.accumulate(arr)** applies the binary operator and generates an
+equivalently shaped array that includes the accumulated amount for each
+element of the array. A couple examples: ::
+
+ >>> np.add.accumulate(np.arange(10))
+ array([ 0, 1, 3, 6, 10, 15, 21, 28, 36, 45])
+ >>> np.multiply.accumulate(np.arange(1,9))
+ array([ 1, 2, 6, 24, 120, 720, 5040, 40320])
+
+The behavior for multidimensional arrays is the same as for .reduce(),
+as is the use of the axis keyword).
+
+**.reduceat(arr,indices)** allows one to apply reduce to selected parts
+ of an array. It is a difficult method to understand. See the documentation
+ at:
+
+**.outer(arr1,arr2)** generates an outer operation on the two arrays arr1 and
+ arr2. It will work on multidimensional arrays (the shape of the result is
+ the concatenation of the two input shapes.: ::
+
+ >>> np.multiply.outer(np.arange(3),np.arange(4))
+ array([[0, 0, 0, 0],
+ [0, 1, 2, 3],
+ [0, 2, 4, 6]])
+
+Output arguments
+================
+
+All ufuncs accept an optional output array. The array must be of the expected
+output shape. Beware that if the type of the output array is of a different
+(and lower) type than the output result, the results may be silently truncated
+or otherwise corrupted in the downcast to the lower type. This usage is useful
+when one wants to avoid creating large temporary arrays and instead allows one
+to reuse the same array memory repeatedly (at the expense of not being able to
+use more convenient operator notation in expressions). Note that when the
+output argument is used, the ufunc still returns a reference to the result.
+
+ >>> x = np.arange(2)
+ >>> np.add(np.arange(2),np.arange(2.),x)
+ array([0, 2])
+ >>> x
+ array([0, 2])
+
+and & or as ufuncs
+==================
+
+Invariably people try to use the python 'and' and 'or' as logical operators
+(and quite understandably). But these operators do not behave as normal
+operators since Python treats these quite differently. They cannot be
+overloaded with array equivalents. Thus using 'and' or 'or' with an array
+results in an error. There are two alternatives:
+
+ 1) use the ufunc functions logical_and() and logical_or().
+ 2) use the bitwise operators & and \\|. The drawback of these is that if
+ the arguments to these operators are not boolean arrays, the result is
+ likely incorrect. On the other hand, most usages of logical_and and
+ logical_or are with boolean arrays. As long as one is careful, this is
+ a convenient way to apply these operators.
+
+"""
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/f2py/__init__.py b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/f2py/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..e583250f7060aaa909d43b28dcb7c0021d0175d4
--- /dev/null
+++ b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/f2py/__init__.py
@@ -0,0 +1,194 @@
+#!/usr/bin/env python3
+"""Fortran to Python Interface Generator.
+
+Copyright 1999 -- 2011 Pearu Peterson all rights reserved.
+Copyright 2011 -- present NumPy Developers.
+Permission to use, modify, and distribute this software is given under the terms
+of the NumPy License.
+
+NO WARRANTY IS EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
+"""
+__all__ = ['run_main', 'compile', 'get_include']
+
+import sys
+import subprocess
+import os
+import warnings
+
+from numpy.exceptions import VisibleDeprecationWarning
+from . import f2py2e
+from . import diagnose
+
+run_main = f2py2e.run_main
+main = f2py2e.main
+
+
+def compile(source,
+ modulename='untitled',
+ extra_args='',
+ verbose=True,
+ source_fn=None,
+ extension='.f',
+ full_output=False
+ ):
+ """
+ Build extension module from a Fortran 77 source string with f2py.
+
+ Parameters
+ ----------
+ source : str or bytes
+ Fortran source of module / subroutine to compile
+
+ .. versionchanged:: 1.16.0
+ Accept str as well as bytes
+
+ modulename : str, optional
+ The name of the compiled python module
+ extra_args : str or list, optional
+ Additional parameters passed to f2py
+
+ .. versionchanged:: 1.16.0
+ A list of args may also be provided.
+
+ verbose : bool, optional
+ Print f2py output to screen
+ source_fn : str, optional
+ Name of the file where the fortran source is written.
+ The default is to use a temporary file with the extension
+ provided by the ``extension`` parameter
+ extension : ``{'.f', '.f90'}``, optional
+ Filename extension if `source_fn` is not provided.
+ The extension tells which fortran standard is used.
+ The default is ``.f``, which implies F77 standard.
+
+ .. versionadded:: 1.11.0
+
+ full_output : bool, optional
+ If True, return a `subprocess.CompletedProcess` containing
+ the stdout and stderr of the compile process, instead of just
+ the status code.
+
+ .. versionadded:: 1.20.0
+
+
+ Returns
+ -------
+ result : int or `subprocess.CompletedProcess`
+ 0 on success, or a `subprocess.CompletedProcess` if
+ ``full_output=True``
+
+ Examples
+ --------
+ .. literalinclude:: ../../source/f2py/code/results/compile_session.dat
+ :language: python
+
+ """
+ import tempfile
+ import shlex
+
+ if source_fn is None:
+ f, fname = tempfile.mkstemp(suffix=extension)
+ # f is a file descriptor so need to close it
+ # carefully -- not with .close() directly
+ os.close(f)
+ else:
+ fname = source_fn
+
+ if not isinstance(source, str):
+ source = str(source, 'utf-8')
+ try:
+ with open(fname, 'w') as f:
+ f.write(source)
+
+ args = ['-c', '-m', modulename, f.name]
+
+ if isinstance(extra_args, str):
+ is_posix = (os.name == 'posix')
+ extra_args = shlex.split(extra_args, posix=is_posix)
+
+ args.extend(extra_args)
+
+ c = [sys.executable,
+ '-c',
+ 'import numpy.f2py as f2py2e;f2py2e.main()'] + args
+ try:
+ cp = subprocess.run(c, capture_output=True)
+ except OSError:
+ # preserve historic status code used by exec_command()
+ cp = subprocess.CompletedProcess(c, 127, stdout=b'', stderr=b'')
+ else:
+ if verbose:
+ print(cp.stdout.decode())
+ finally:
+ if source_fn is None:
+ os.remove(fname)
+
+ if full_output:
+ return cp
+ else:
+ return cp.returncode
+
+
+def get_include():
+ """
+ Return the directory that contains the ``fortranobject.c`` and ``.h`` files.
+
+ .. note::
+
+ This function is not needed when building an extension with
+ `numpy.distutils` directly from ``.f`` and/or ``.pyf`` files
+ in one go.
+
+ Python extension modules built with f2py-generated code need to use
+ ``fortranobject.c`` as a source file, and include the ``fortranobject.h``
+ header. This function can be used to obtain the directory containing
+ both of these files.
+
+ Returns
+ -------
+ include_path : str
+ Absolute path to the directory containing ``fortranobject.c`` and
+ ``fortranobject.h``.
+
+ Notes
+ -----
+ .. versionadded:: 1.21.1
+
+ Unless the build system you are using has specific support for f2py,
+ building a Python extension using a ``.pyf`` signature file is a two-step
+ process. For a module ``mymod``:
+
+ * Step 1: run ``python -m numpy.f2py mymod.pyf --quiet``. This
+ generates ``_mymodmodule.c`` and (if needed)
+ ``_fblas-f2pywrappers.f`` files next to ``mymod.pyf``.
+ * Step 2: build your Python extension module. This requires the
+ following source files:
+
+ * ``_mymodmodule.c``
+ * ``_mymod-f2pywrappers.f`` (if it was generated in Step 1)
+ * ``fortranobject.c``
+
+ See Also
+ --------
+ numpy.get_include : function that returns the numpy include directory
+
+ """
+ return os.path.join(os.path.dirname(__file__), 'src')
+
+
+def __getattr__(attr):
+
+ # Avoid importing things that aren't needed for building
+ # which might import the main numpy module
+ if attr == "test":
+ from numpy._pytesttester import PytestTester
+ test = PytestTester(__name__)
+ return test
+
+ else:
+ raise AttributeError("module {!r} has no attribute "
+ "{!r}".format(__name__, attr))
+
+
+def __dir__():
+ return list(globals().keys() | {"test"})
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/f2py/__init__.pyi b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/f2py/__init__.pyi
new file mode 100644
index 0000000000000000000000000000000000000000..81b6a24f39ec37ba45055d8fefa819e816a61b8d
--- /dev/null
+++ b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/f2py/__init__.pyi
@@ -0,0 +1,42 @@
+import os
+import subprocess
+from collections.abc import Iterable
+from typing import Literal as L, Any, overload, TypedDict
+
+from numpy._pytesttester import PytestTester
+
+class _F2PyDictBase(TypedDict):
+ csrc: list[str]
+ h: list[str]
+
+class _F2PyDict(_F2PyDictBase, total=False):
+ fsrc: list[str]
+ ltx: list[str]
+
+__all__: list[str]
+test: PytestTester
+
+def run_main(comline_list: Iterable[str]) -> dict[str, _F2PyDict]: ...
+
+@overload
+def compile( # type: ignore[misc]
+ source: str | bytes,
+ modulename: str = ...,
+ extra_args: str | list[str] = ...,
+ verbose: bool = ...,
+ source_fn: None | str | bytes | os.PathLike[Any] = ...,
+ extension: L[".f", ".f90"] = ...,
+ full_output: L[False] = ...,
+) -> int: ...
+@overload
+def compile(
+ source: str | bytes,
+ modulename: str = ...,
+ extra_args: str | list[str] = ...,
+ verbose: bool = ...,
+ source_fn: None | str | bytes | os.PathLike[Any] = ...,
+ extension: L[".f", ".f90"] = ...,
+ full_output: L[True] = ...,
+) -> subprocess.CompletedProcess[bytes]: ...
+
+def get_include() -> str: ...
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/f2py/__main__.py b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/f2py/__main__.py
new file mode 100644
index 0000000000000000000000000000000000000000..936a753a2796896667aa782277be41b40af061d3
--- /dev/null
+++ b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/f2py/__main__.py
@@ -0,0 +1,5 @@
+# See:
+# https://web.archive.org/web/20140822061353/http://cens.ioc.ee/projects/f2py2e
+from numpy.f2py.f2py2e import main
+
+main()
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/f2py/__pycache__/__init__.cpython-311.pyc b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/f2py/__pycache__/__init__.cpython-311.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..8c7095bb3db0994097be6dfb4f2adfec4f822f34
Binary files /dev/null and b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/f2py/__pycache__/__init__.cpython-311.pyc differ
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/f2py/__pycache__/__main__.cpython-311.pyc b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/f2py/__pycache__/__main__.cpython-311.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..092d2259d4b5d5388d4cfc1d03e88d8a6c81ad8f
Binary files /dev/null and b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/f2py/__pycache__/__main__.cpython-311.pyc differ
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/f2py/__pycache__/__version__.cpython-311.pyc b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/f2py/__pycache__/__version__.cpython-311.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..2ad3d66ba4ffa6b81da426ded33f59627ed5f5e8
Binary files /dev/null and b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/f2py/__pycache__/__version__.cpython-311.pyc differ
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/f2py/__pycache__/_isocbind.cpython-311.pyc b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/f2py/__pycache__/_isocbind.cpython-311.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..4a1f08f5676014cded51f2e37d0cb0faf9fc4969
Binary files /dev/null and b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/f2py/__pycache__/_isocbind.cpython-311.pyc differ
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/f2py/__pycache__/_src_pyf.cpython-311.pyc b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/f2py/__pycache__/_src_pyf.cpython-311.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..423be2e4cfe1e9891e00646a57d72826d291cab7
Binary files /dev/null and b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/f2py/__pycache__/_src_pyf.cpython-311.pyc differ
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/f2py/__pycache__/auxfuncs.cpython-311.pyc b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/f2py/__pycache__/auxfuncs.cpython-311.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..ee7b5dae575592634ba0d23d91bd186a16b9ca86
Binary files /dev/null and b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/f2py/__pycache__/auxfuncs.cpython-311.pyc differ
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/f2py/__pycache__/capi_maps.cpython-311.pyc b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/f2py/__pycache__/capi_maps.cpython-311.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..6b6f7bf2d4d9c0f6efa2c5c6749fa7e5b0265006
Binary files /dev/null and b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/f2py/__pycache__/capi_maps.cpython-311.pyc differ
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/f2py/__pycache__/cb_rules.cpython-311.pyc b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/f2py/__pycache__/cb_rules.cpython-311.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..6c032949969b801444b11fd1a85190c5fa3d14e8
Binary files /dev/null and b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/f2py/__pycache__/cb_rules.cpython-311.pyc differ
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/f2py/__pycache__/cfuncs.cpython-311.pyc b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/f2py/__pycache__/cfuncs.cpython-311.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..45922779ec99f626e263ef6e84343e42880e4137
Binary files /dev/null and b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/f2py/__pycache__/cfuncs.cpython-311.pyc differ
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/f2py/__pycache__/common_rules.cpython-311.pyc b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/f2py/__pycache__/common_rules.cpython-311.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..22cdd64c9c94ef073e1af2b8a408536040ea1b93
Binary files /dev/null and b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/f2py/__pycache__/common_rules.cpython-311.pyc differ
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/f2py/__pycache__/diagnose.cpython-311.pyc b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/f2py/__pycache__/diagnose.cpython-311.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..69b5518c8c3a3239999570430d056272dda8b674
Binary files /dev/null and b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/f2py/__pycache__/diagnose.cpython-311.pyc differ
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/f2py/__pycache__/f2py2e.cpython-311.pyc b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/f2py/__pycache__/f2py2e.cpython-311.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..558bbf265ba4e5920aff9ea16a2a17e76c8efabc
Binary files /dev/null and b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/f2py/__pycache__/f2py2e.cpython-311.pyc differ
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/f2py/__pycache__/f90mod_rules.cpython-311.pyc b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/f2py/__pycache__/f90mod_rules.cpython-311.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..b0211cefc194945cd1cab68a66a727092b0ced33
Binary files /dev/null and b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/f2py/__pycache__/f90mod_rules.cpython-311.pyc differ
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/f2py/__pycache__/func2subr.cpython-311.pyc b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/f2py/__pycache__/func2subr.cpython-311.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..e6f1e1180aa040fee60a0103ac612f585936ce8a
Binary files /dev/null and b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/f2py/__pycache__/func2subr.cpython-311.pyc differ
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/f2py/__pycache__/rules.cpython-311.pyc b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/f2py/__pycache__/rules.cpython-311.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..848ae93bca3f9cbda7969573189c0488ba666d21
Binary files /dev/null and b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/f2py/__pycache__/rules.cpython-311.pyc differ
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/f2py/__pycache__/setup.cpython-311.pyc b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/f2py/__pycache__/setup.cpython-311.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..3a2cde2367d45174cab88038f88d4d7cd989b9bd
Binary files /dev/null and b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/f2py/__pycache__/setup.cpython-311.pyc differ
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/f2py/__pycache__/symbolic.cpython-311.pyc b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/f2py/__pycache__/symbolic.cpython-311.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..e051fc14d0897a5f0b3b35cad6c52c92e7c14865
Binary files /dev/null and b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/f2py/__pycache__/symbolic.cpython-311.pyc differ
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/f2py/__pycache__/use_rules.cpython-311.pyc b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/f2py/__pycache__/use_rules.cpython-311.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..b70d02ed4a7cb428f27f8128ba5adaa102c1bc59
Binary files /dev/null and b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/f2py/__pycache__/use_rules.cpython-311.pyc differ
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/f2py/__version__.py b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/f2py/__version__.py
new file mode 100644
index 0000000000000000000000000000000000000000..e20d7c1dbb38807d248ff886e30425e7ff597299
--- /dev/null
+++ b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/f2py/__version__.py
@@ -0,0 +1 @@
+from numpy.version import version
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/f2py/_backends/__init__.py b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/f2py/_backends/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..e91393c14be39b20d5e94e262e91a05052681318
--- /dev/null
+++ b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/f2py/_backends/__init__.py
@@ -0,0 +1,9 @@
+def f2py_build_generator(name):
+ if name == "meson":
+ from ._meson import MesonBackend
+ return MesonBackend
+ elif name == "distutils":
+ from ._distutils import DistutilsBackend
+ return DistutilsBackend
+ else:
+ raise ValueError(f"Unknown backend: {name}")
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/f2py/_backends/__pycache__/__init__.cpython-311.pyc b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/f2py/_backends/__pycache__/__init__.cpython-311.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..bea5f742210032fdad9e12bf0078f8d2090978b5
Binary files /dev/null and b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/f2py/_backends/__pycache__/__init__.cpython-311.pyc differ
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/f2py/_backends/__pycache__/_backend.cpython-311.pyc b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/f2py/_backends/__pycache__/_backend.cpython-311.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..8ae66822accc7350c4e00a21e0ad0c659a06e68d
Binary files /dev/null and b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/f2py/_backends/__pycache__/_backend.cpython-311.pyc differ
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/f2py/_backends/__pycache__/_distutils.cpython-311.pyc b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/f2py/_backends/__pycache__/_distutils.cpython-311.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..9c6511d224853f5ad8f76d7539bac725045be560
Binary files /dev/null and b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/f2py/_backends/__pycache__/_distutils.cpython-311.pyc differ
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/f2py/_backends/__pycache__/_meson.cpython-311.pyc b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/f2py/_backends/__pycache__/_meson.cpython-311.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..3f1f0540c7f9fd8d67ab729e2dfe2a72a675955a
Binary files /dev/null and b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/f2py/_backends/__pycache__/_meson.cpython-311.pyc differ
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/f2py/_backends/_backend.py b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/f2py/_backends/_backend.py
new file mode 100644
index 0000000000000000000000000000000000000000..a7d43d2587b2f4886372f44c9bac7f5b840d7612
--- /dev/null
+++ b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/f2py/_backends/_backend.py
@@ -0,0 +1,46 @@
+from __future__ import annotations
+
+from abc import ABC, abstractmethod
+
+
+class Backend(ABC):
+ def __init__(
+ self,
+ modulename,
+ sources,
+ extra_objects,
+ build_dir,
+ include_dirs,
+ library_dirs,
+ libraries,
+ define_macros,
+ undef_macros,
+ f2py_flags,
+ sysinfo_flags,
+ fc_flags,
+ flib_flags,
+ setup_flags,
+ remove_build_dir,
+ extra_dat,
+ ):
+ self.modulename = modulename
+ self.sources = sources
+ self.extra_objects = extra_objects
+ self.build_dir = build_dir
+ self.include_dirs = include_dirs
+ self.library_dirs = library_dirs
+ self.libraries = libraries
+ self.define_macros = define_macros
+ self.undef_macros = undef_macros
+ self.f2py_flags = f2py_flags
+ self.sysinfo_flags = sysinfo_flags
+ self.fc_flags = fc_flags
+ self.flib_flags = flib_flags
+ self.setup_flags = setup_flags
+ self.remove_build_dir = remove_build_dir
+ self.extra_dat = extra_dat
+
+ @abstractmethod
+ def compile(self) -> None:
+ """Compile the wrapper."""
+ pass
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/f2py/_backends/_distutils.py b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/f2py/_backends/_distutils.py
new file mode 100644
index 0000000000000000000000000000000000000000..e9b22a3921a578758c92de19e3b77cf874d4e4ca
--- /dev/null
+++ b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/f2py/_backends/_distutils.py
@@ -0,0 +1,75 @@
+from ._backend import Backend
+
+from numpy.distutils.core import setup, Extension
+from numpy.distutils.system_info import get_info
+from numpy.distutils.misc_util import dict_append
+from numpy.exceptions import VisibleDeprecationWarning
+import os
+import sys
+import shutil
+import warnings
+
+
+class DistutilsBackend(Backend):
+ def __init__(sef, *args, **kwargs):
+ warnings.warn(
+ "distutils has been deprecated since NumPy 1.26.x"
+ "Use the Meson backend instead, or generate wrappers"
+ "without -c and use a custom build script",
+ VisibleDeprecationWarning,
+ stacklevel=2,
+ )
+ super().__init__(*args, **kwargs)
+
+ def compile(self):
+ num_info = {}
+ if num_info:
+ self.include_dirs.extend(num_info.get("include_dirs", []))
+ ext_args = {
+ "name": self.modulename,
+ "sources": self.sources,
+ "include_dirs": self.include_dirs,
+ "library_dirs": self.library_dirs,
+ "libraries": self.libraries,
+ "define_macros": self.define_macros,
+ "undef_macros": self.undef_macros,
+ "extra_objects": self.extra_objects,
+ "f2py_options": self.f2py_flags,
+ }
+
+ if self.sysinfo_flags:
+ for n in self.sysinfo_flags:
+ i = get_info(n)
+ if not i:
+ print(
+ f"No {repr(n)} resources found"
+ "in system (try `f2py --help-link`)"
+ )
+ dict_append(ext_args, **i)
+
+ ext = Extension(**ext_args)
+
+ sys.argv = [sys.argv[0]] + self.setup_flags
+ sys.argv.extend(
+ [
+ "build",
+ "--build-temp",
+ self.build_dir,
+ "--build-base",
+ self.build_dir,
+ "--build-platlib",
+ ".",
+ "--disable-optimization",
+ ]
+ )
+
+ if self.fc_flags:
+ sys.argv.extend(["config_fc"] + self.fc_flags)
+ if self.flib_flags:
+ sys.argv.extend(["build_ext"] + self.flib_flags)
+
+ setup(ext_modules=[ext])
+
+ if self.remove_build_dir and os.path.exists(self.build_dir):
+ print(f"Removing build directory {self.build_dir}")
+ shutil.rmtree(self.build_dir)
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/f2py/_backends/_meson.py b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/f2py/_backends/_meson.py
new file mode 100644
index 0000000000000000000000000000000000000000..f324e0f595fbc6b5e2caa0959027f09495e4fecd
--- /dev/null
+++ b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/f2py/_backends/_meson.py
@@ -0,0 +1,205 @@
+from __future__ import annotations
+
+import os
+import errno
+import shutil
+import subprocess
+import sys
+from pathlib import Path
+
+from ._backend import Backend
+from string import Template
+from itertools import chain
+
+import warnings
+
+
+class MesonTemplate:
+ """Template meson build file generation class."""
+
+ def __init__(
+ self,
+ modulename: str,
+ sources: list[Path],
+ deps: list[str],
+ libraries: list[str],
+ library_dirs: list[Path],
+ include_dirs: list[Path],
+ object_files: list[Path],
+ linker_args: list[str],
+ c_args: list[str],
+ build_type: str,
+ python_exe: str,
+ ):
+ self.modulename = modulename
+ self.build_template_path = (
+ Path(__file__).parent.absolute() / "meson.build.template"
+ )
+ self.sources = sources
+ self.deps = deps
+ self.libraries = libraries
+ self.library_dirs = library_dirs
+ if include_dirs is not None:
+ self.include_dirs = include_dirs
+ else:
+ self.include_dirs = []
+ self.substitutions = {}
+ self.objects = object_files
+ self.pipeline = [
+ self.initialize_template,
+ self.sources_substitution,
+ self.deps_substitution,
+ self.include_substitution,
+ self.libraries_substitution,
+ ]
+ self.build_type = build_type
+ self.python_exe = python_exe
+
+ def meson_build_template(self) -> str:
+ if not self.build_template_path.is_file():
+ raise FileNotFoundError(
+ errno.ENOENT,
+ "Meson build template"
+ f" {self.build_template_path.absolute()}"
+ " does not exist.",
+ )
+ return self.build_template_path.read_text()
+
+ def initialize_template(self) -> None:
+ self.substitutions["modulename"] = self.modulename
+ self.substitutions["buildtype"] = self.build_type
+ self.substitutions["python"] = self.python_exe
+
+ def sources_substitution(self) -> None:
+ indent = " " * 21
+ self.substitutions["source_list"] = f",\n{indent}".join(
+ [f"{indent}'{source}'" for source in self.sources]
+ )
+
+ def deps_substitution(self) -> None:
+ indent = " " * 21
+ self.substitutions["dep_list"] = f",\n{indent}".join(
+ [f"{indent}dependency('{dep}')" for dep in self.deps]
+ )
+
+ def libraries_substitution(self) -> None:
+ self.substitutions["lib_dir_declarations"] = "\n".join(
+ [
+ f"lib_dir_{i} = declare_dependency(link_args : ['-L{lib_dir}'])"
+ for i, lib_dir in enumerate(self.library_dirs)
+ ]
+ )
+
+ self.substitutions["lib_declarations"] = "\n".join(
+ [
+ f"{lib} = declare_dependency(link_args : ['-l{lib}'])"
+ for lib in self.libraries
+ ]
+ )
+
+ indent = " " * 21
+ self.substitutions["lib_list"] = f"\n{indent}".join(
+ [f"{indent}{lib}," for lib in self.libraries]
+ )
+ self.substitutions["lib_dir_list"] = f"\n{indent}".join(
+ [f"{indent}lib_dir_{i}," for i in range(len(self.library_dirs))]
+ )
+
+ def include_substitution(self) -> None:
+ indent = " " * 21
+ self.substitutions["inc_list"] = f",\n{indent}".join(
+ [f"{indent}'{inc}'" for inc in self.include_dirs]
+ )
+
+ def generate_meson_build(self):
+ for node in self.pipeline:
+ node()
+ template = Template(self.meson_build_template())
+ return template.substitute(self.substitutions)
+
+
+class MesonBackend(Backend):
+ def __init__(self, *args, **kwargs):
+ super().__init__(*args, **kwargs)
+ self.dependencies = self.extra_dat.get("dependencies", [])
+ self.meson_build_dir = "bbdir"
+ self.build_type = (
+ "debug" if any("debug" in flag for flag in self.fc_flags) else "release"
+ )
+
+ def _move_exec_to_root(self, build_dir: Path):
+ walk_dir = Path(build_dir) / self.meson_build_dir
+ path_objects = chain(
+ walk_dir.glob(f"{self.modulename}*.so"),
+ walk_dir.glob(f"{self.modulename}*.pyd"),
+ )
+ # Same behavior as distutils
+ # https://github.com/numpy/numpy/issues/24874#issuecomment-1835632293
+ for path_object in path_objects:
+ dest_path = Path.cwd() / path_object.name
+ if dest_path.exists():
+ dest_path.unlink()
+ shutil.copy2(path_object, dest_path)
+ os.remove(path_object)
+
+ def write_meson_build(self, build_dir: Path) -> None:
+ """Writes the meson build file at specified location"""
+ meson_template = MesonTemplate(
+ self.modulename,
+ self.sources,
+ self.dependencies,
+ self.libraries,
+ self.library_dirs,
+ self.include_dirs,
+ self.extra_objects,
+ self.flib_flags,
+ self.fc_flags,
+ self.build_type,
+ sys.executable,
+ )
+ src = meson_template.generate_meson_build()
+ Path(build_dir).mkdir(parents=True, exist_ok=True)
+ meson_build_file = Path(build_dir) / "meson.build"
+ meson_build_file.write_text(src)
+ return meson_build_file
+
+ def _run_subprocess_command(self, command, cwd):
+ subprocess.run(command, cwd=cwd, check=True)
+
+ def run_meson(self, build_dir: Path):
+ setup_command = ["meson", "setup", self.meson_build_dir]
+ self._run_subprocess_command(setup_command, build_dir)
+ compile_command = ["meson", "compile", "-C", self.meson_build_dir]
+ self._run_subprocess_command(compile_command, build_dir)
+
+ def compile(self) -> None:
+ self.sources = _prepare_sources(self.modulename, self.sources, self.build_dir)
+ self.write_meson_build(self.build_dir)
+ self.run_meson(self.build_dir)
+ self._move_exec_to_root(self.build_dir)
+
+
+def _prepare_sources(mname, sources, bdir):
+ extended_sources = sources.copy()
+ Path(bdir).mkdir(parents=True, exist_ok=True)
+ # Copy sources
+ for source in sources:
+ if Path(source).exists() and Path(source).is_file():
+ shutil.copy(source, bdir)
+ generated_sources = [
+ Path(f"{mname}module.c"),
+ Path(f"{mname}-f2pywrappers2.f90"),
+ Path(f"{mname}-f2pywrappers.f"),
+ ]
+ bdir = Path(bdir)
+ for generated_source in generated_sources:
+ if generated_source.exists():
+ shutil.copy(generated_source, bdir / generated_source.name)
+ extended_sources.append(generated_source.name)
+ generated_source.unlink()
+ extended_sources = [
+ Path(source).name
+ for source in extended_sources
+ if not Path(source).suffix == ".pyf"
+ ]
+ return extended_sources
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/f2py/_backends/meson.build.template b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/f2py/_backends/meson.build.template
new file mode 100644
index 0000000000000000000000000000000000000000..8e34fdc8d4d6a29d62022e82ae92e787b73f941b
--- /dev/null
+++ b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/f2py/_backends/meson.build.template
@@ -0,0 +1,54 @@
+project('${modulename}',
+ ['c', 'fortran'],
+ version : '0.1',
+ meson_version: '>= 1.1.0',
+ default_options : [
+ 'warning_level=1',
+ 'buildtype=${buildtype}'
+ ])
+fc = meson.get_compiler('fortran')
+
+py = import('python').find_installation('${python}', pure: false)
+py_dep = py.dependency()
+
+incdir_numpy = run_command(py,
+ ['-c', 'import os; os.chdir(".."); import numpy; print(numpy.get_include())'],
+ check : true
+).stdout().strip()
+
+incdir_f2py = run_command(py,
+ ['-c', 'import os; os.chdir(".."); import numpy.f2py; print(numpy.f2py.get_include())'],
+ check : true
+).stdout().strip()
+
+inc_np = include_directories(incdir_numpy)
+np_dep = declare_dependency(include_directories: inc_np)
+
+incdir_f2py = incdir_numpy / '..' / '..' / 'f2py' / 'src'
+inc_f2py = include_directories(incdir_f2py)
+fortranobject_c = incdir_f2py / 'fortranobject.c'
+
+inc_np = include_directories(incdir_numpy, incdir_f2py)
+# gh-25000
+quadmath_dep = fc.find_library('quadmath', required: false)
+
+${lib_declarations}
+${lib_dir_declarations}
+
+py.extension_module('${modulename}',
+ [
+${source_list},
+ fortranobject_c
+ ],
+ include_directories: [
+ inc_np,
+${inc_list}
+ ],
+ dependencies : [
+ py_dep,
+ quadmath_dep,
+${dep_list}
+${lib_list}
+${lib_dir_list}
+ ],
+ install : true)
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/f2py/_isocbind.py b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/f2py/_isocbind.py
new file mode 100644
index 0000000000000000000000000000000000000000..3043c5d9163f7101d165ca08e33adf0970547612
--- /dev/null
+++ b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/f2py/_isocbind.py
@@ -0,0 +1,62 @@
+"""
+ISO_C_BINDING maps for f2py2e.
+Only required declarations/macros/functions will be used.
+
+Copyright 1999 -- 2011 Pearu Peterson all rights reserved.
+Copyright 2011 -- present NumPy Developers.
+Permission to use, modify, and distribute this software is given under the
+terms of the NumPy License.
+
+NO WARRANTY IS EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
+"""
+# These map to keys in c2py_map, via forced casting for now, see gh-25229
+iso_c_binding_map = {
+ 'integer': {
+ 'c_int': 'int',
+ 'c_short': 'short', # 'short' <=> 'int' for now
+ 'c_long': 'long', # 'long' <=> 'int' for now
+ 'c_long_long': 'long_long',
+ 'c_signed_char': 'signed_char',
+ 'c_size_t': 'unsigned', # size_t <=> 'unsigned' for now
+ 'c_int8_t': 'signed_char', # int8_t <=> 'signed_char' for now
+ 'c_int16_t': 'short', # int16_t <=> 'short' for now
+ 'c_int32_t': 'int', # int32_t <=> 'int' for now
+ 'c_int64_t': 'long_long',
+ 'c_int_least8_t': 'signed_char', # int_least8_t <=> 'signed_char' for now
+ 'c_int_least16_t': 'short', # int_least16_t <=> 'short' for now
+ 'c_int_least32_t': 'int', # int_least32_t <=> 'int' for now
+ 'c_int_least64_t': 'long_long',
+ 'c_int_fast8_t': 'signed_char', # int_fast8_t <=> 'signed_char' for now
+ 'c_int_fast16_t': 'short', # int_fast16_t <=> 'short' for now
+ 'c_int_fast32_t': 'int', # int_fast32_t <=> 'int' for now
+ 'c_int_fast64_t': 'long_long',
+ 'c_intmax_t': 'long_long', # intmax_t <=> 'long_long' for now
+ 'c_intptr_t': 'long', # intptr_t <=> 'long' for now
+ 'c_ptrdiff_t': 'long', # ptrdiff_t <=> 'long' for now
+ },
+ 'real': {
+ 'c_float': 'float',
+ 'c_double': 'double',
+ 'c_long_double': 'long_double'
+ },
+ 'complex': {
+ 'c_float_complex': 'complex_float',
+ 'c_double_complex': 'complex_double',
+ 'c_long_double_complex': 'complex_long_double'
+ },
+ 'logical': {
+ 'c_bool': 'unsigned_char' # _Bool <=> 'unsigned_char' for now
+ },
+ 'character': {
+ 'c_char': 'char'
+ }
+}
+
+# TODO: See gh-25229
+isoc_c2pycode_map = {}
+iso_c2py_map = {}
+
+isoc_kindmap = {}
+for fortran_type, c_type_dict in iso_c_binding_map.items():
+ for c_type in c_type_dict.keys():
+ isoc_kindmap[c_type] = fortran_type
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/f2py/_src_pyf.py b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/f2py/_src_pyf.py
new file mode 100644
index 0000000000000000000000000000000000000000..6247b95bfe4603e9b136ca0b8e0c2842d1c1d1cc
--- /dev/null
+++ b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/f2py/_src_pyf.py
@@ -0,0 +1,239 @@
+import re
+
+# START OF CODE VENDORED FROM `numpy.distutils.from_template`
+#############################################################
+"""
+process_file(filename)
+
+ takes templated file .xxx.src and produces .xxx file where .xxx
+ is .pyf .f90 or .f using the following template rules:
+
+ '<..>' denotes a template.
+
+ All function and subroutine blocks in a source file with names that
+ contain '<..>' will be replicated according to the rules in '<..>'.
+
+ The number of comma-separated words in '<..>' will determine the number of
+ replicates.
+
+ '<..>' may have two different forms, named and short. For example,
+
+ named:
+ where anywhere inside a block '
' will be replaced with
+ 'd', 's', 'z', and 'c' for each replicate of the block.
+
+ <_c> is already defined: <_c=s,d,c,z>
+ <_t> is already defined: <_t=real,double precision,complex,double complex>
+
+ short:
+ , a short form of the named, useful when no
appears inside
+ a block.
+
+ In general, '<..>' contains a comma separated list of arbitrary
+ expressions. If these expression must contain a comma|leftarrow|rightarrow,
+ then prepend the comma|leftarrow|rightarrow with a backslash.
+
+ If an expression matches '\\' then it will be replaced
+ by -th expression.
+
+ Note that all '<..>' forms in a block must have the same number of
+ comma-separated entries.
+
+ Predefined named template rules:
+
+
+
+
+
+"""
+
+routine_start_re = re.compile(r'(\n|\A)(( (\$|\*))|)\s*(subroutine|function)\b', re.I)
+routine_end_re = re.compile(r'\n\s*end\s*(subroutine|function)\b.*(\n|\Z)', re.I)
+function_start_re = re.compile(r'\n (\$|\*)\s*function\b', re.I)
+
+def parse_structure(astr):
+ """ Return a list of tuples for each function or subroutine each
+ tuple is the start and end of a subroutine or function to be
+ expanded.
+ """
+
+ spanlist = []
+ ind = 0
+ while True:
+ m = routine_start_re.search(astr, ind)
+ if m is None:
+ break
+ start = m.start()
+ if function_start_re.match(astr, start, m.end()):
+ while True:
+ i = astr.rfind('\n', ind, start)
+ if i==-1:
+ break
+ start = i
+ if astr[i:i+7]!='\n $':
+ break
+ start += 1
+ m = routine_end_re.search(astr, m.end())
+ ind = end = m and m.end()-1 or len(astr)
+ spanlist.append((start, end))
+ return spanlist
+
+template_re = re.compile(r"<\s*(\w[\w\d]*)\s*>")
+named_re = re.compile(r"<\s*(\w[\w\d]*)\s*=\s*(.*?)\s*>")
+list_re = re.compile(r"<\s*((.*?))\s*>")
+
+def find_repl_patterns(astr):
+ reps = named_re.findall(astr)
+ names = {}
+ for rep in reps:
+ name = rep[0].strip() or unique_key(names)
+ repl = rep[1].replace(r'\,', '@comma@')
+ thelist = conv(repl)
+ names[name] = thelist
+ return names
+
+def find_and_remove_repl_patterns(astr):
+ names = find_repl_patterns(astr)
+ astr = re.subn(named_re, '', astr)[0]
+ return astr, names
+
+item_re = re.compile(r"\A\\(?P\d+)\Z")
+def conv(astr):
+ b = astr.split(',')
+ l = [x.strip() for x in b]
+ for i in range(len(l)):
+ m = item_re.match(l[i])
+ if m:
+ j = int(m.group('index'))
+ l[i] = l[j]
+ return ','.join(l)
+
+def unique_key(adict):
+ """ Obtain a unique key given a dictionary."""
+ allkeys = list(adict.keys())
+ done = False
+ n = 1
+ while not done:
+ newkey = '__l%s' % (n)
+ if newkey in allkeys:
+ n += 1
+ else:
+ done = True
+ return newkey
+
+
+template_name_re = re.compile(r'\A\s*(\w[\w\d]*)\s*\Z')
+def expand_sub(substr, names):
+ substr = substr.replace(r'\>', '@rightarrow@')
+ substr = substr.replace(r'\<', '@leftarrow@')
+ lnames = find_repl_patterns(substr)
+ substr = named_re.sub(r"<\1>", substr) # get rid of definition templates
+
+ def listrepl(mobj):
+ thelist = conv(mobj.group(1).replace(r'\,', '@comma@'))
+ if template_name_re.match(thelist):
+ return "<%s>" % (thelist)
+ name = None
+ for key in lnames.keys(): # see if list is already in dictionary
+ if lnames[key] == thelist:
+ name = key
+ if name is None: # this list is not in the dictionary yet
+ name = unique_key(lnames)
+ lnames[name] = thelist
+ return "<%s>" % name
+
+ substr = list_re.sub(listrepl, substr) # convert all lists to named templates
+ # newnames are constructed as needed
+
+ numsubs = None
+ base_rule = None
+ rules = {}
+ for r in template_re.findall(substr):
+ if r not in rules:
+ thelist = lnames.get(r, names.get(r, None))
+ if thelist is None:
+ raise ValueError('No replicates found for <%s>' % (r))
+ if r not in names and not thelist.startswith('_'):
+ names[r] = thelist
+ rule = [i.replace('@comma@', ',') for i in thelist.split(',')]
+ num = len(rule)
+
+ if numsubs is None:
+ numsubs = num
+ rules[r] = rule
+ base_rule = r
+ elif num == numsubs:
+ rules[r] = rule
+ else:
+ print("Mismatch in number of replacements (base <{}={}>) "
+ "for <{}={}>. Ignoring.".format(base_rule, ','.join(rules[base_rule]), r, thelist))
+ if not rules:
+ return substr
+
+ def namerepl(mobj):
+ name = mobj.group(1)
+ return rules.get(name, (k+1)*[name])[k]
+
+ newstr = ''
+ for k in range(numsubs):
+ newstr += template_re.sub(namerepl, substr) + '\n\n'
+
+ newstr = newstr.replace('@rightarrow@', '>')
+ newstr = newstr.replace('@leftarrow@', '<')
+ return newstr
+
+def process_str(allstr):
+ newstr = allstr
+ writestr = ''
+
+ struct = parse_structure(newstr)
+
+ oldend = 0
+ names = {}
+ names.update(_special_names)
+ for sub in struct:
+ cleanedstr, defs = find_and_remove_repl_patterns(newstr[oldend:sub[0]])
+ writestr += cleanedstr
+ names.update(defs)
+ writestr += expand_sub(newstr[sub[0]:sub[1]], names)
+ oldend = sub[1]
+ writestr += newstr[oldend:]
+
+ return writestr
+
+include_src_re = re.compile(r"(\n|\A)\s*include\s*['\"](?P[\w\d./\\]+\.src)['\"]", re.I)
+
+def resolve_includes(source):
+ d = os.path.dirname(source)
+ with open(source) as fid:
+ lines = []
+ for line in fid:
+ m = include_src_re.match(line)
+ if m:
+ fn = m.group('name')
+ if not os.path.isabs(fn):
+ fn = os.path.join(d, fn)
+ if os.path.isfile(fn):
+ lines.extend(resolve_includes(fn))
+ else:
+ lines.append(line)
+ else:
+ lines.append(line)
+ return lines
+
+def process_file(source):
+ lines = resolve_includes(source)
+ return process_str(''.join(lines))
+
+_special_names = find_repl_patterns('''
+<_c=s,d,c,z>
+<_t=real,double precision,complex,double complex>
+
+
+
+
+
+''')
+
+# END OF CODE VENDORED FROM `numpy.distutils.from_template`
+###########################################################
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/f2py/auxfuncs.py b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/f2py/auxfuncs.py
new file mode 100644
index 0000000000000000000000000000000000000000..13a1074b447e2834c045df8757fc264cad077e03
--- /dev/null
+++ b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/f2py/auxfuncs.py
@@ -0,0 +1,988 @@
+"""
+Auxiliary functions for f2py2e.
+
+Copyright 1999 -- 2011 Pearu Peterson all rights reserved.
+Copyright 2011 -- present NumPy Developers.
+Permission to use, modify, and distribute this software is given under the
+terms of the NumPy (BSD style) LICENSE.
+
+NO WARRANTY IS EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
+"""
+import pprint
+import sys
+import re
+import types
+from functools import reduce
+from copy import deepcopy
+
+from . import __version__
+from . import cfuncs
+
+__all__ = [
+ 'applyrules', 'debugcapi', 'dictappend', 'errmess', 'gentitle',
+ 'getargs2', 'getcallprotoargument', 'getcallstatement',
+ 'getfortranname', 'getpymethoddef', 'getrestdoc', 'getusercode',
+ 'getusercode1', 'getdimension', 'hasbody', 'hascallstatement', 'hascommon',
+ 'hasexternals', 'hasinitvalue', 'hasnote', 'hasresultnote',
+ 'isallocatable', 'isarray', 'isarrayofstrings',
+ 'ischaracter', 'ischaracterarray', 'ischaracter_or_characterarray',
+ 'iscomplex',
+ 'iscomplexarray', 'iscomplexfunction', 'iscomplexfunction_warn',
+ 'isdouble', 'isdummyroutine', 'isexternal', 'isfunction',
+ 'isfunction_wrap', 'isint1', 'isint1array', 'isinteger', 'isintent_aux',
+ 'isintent_c', 'isintent_callback', 'isintent_copy', 'isintent_dict',
+ 'isintent_hide', 'isintent_in', 'isintent_inout', 'isintent_inplace',
+ 'isintent_nothide', 'isintent_out', 'isintent_overwrite', 'islogical',
+ 'islogicalfunction', 'islong_complex', 'islong_double',
+ 'islong_doublefunction', 'islong_long', 'islong_longfunction',
+ 'ismodule', 'ismoduleroutine', 'isoptional', 'isprivate', 'isrequired',
+ 'isroutine', 'isscalar', 'issigned_long_longarray', 'isstring',
+ 'isstringarray', 'isstring_or_stringarray', 'isstringfunction',
+ 'issubroutine', 'get_f2py_modulename',
+ 'issubroutine_wrap', 'isthreadsafe', 'isunsigned', 'isunsigned_char',
+ 'isunsigned_chararray', 'isunsigned_long_long',
+ 'isunsigned_long_longarray', 'isunsigned_short',
+ 'isunsigned_shortarray', 'l_and', 'l_not', 'l_or', 'outmess',
+ 'replace', 'show', 'stripcomma', 'throw_error', 'isattr_value',
+ 'getuseblocks', 'process_f2cmap_dict'
+]
+
+
+f2py_version = __version__.version
+
+
+errmess = sys.stderr.write
+show = pprint.pprint
+
+options = {}
+debugoptions = []
+wrapfuncs = 1
+
+
+def outmess(t):
+ if options.get('verbose', 1):
+ sys.stdout.write(t)
+
+
+def debugcapi(var):
+ return 'capi' in debugoptions
+
+
+def _ischaracter(var):
+ return 'typespec' in var and var['typespec'] == 'character' and \
+ not isexternal(var)
+
+
+def _isstring(var):
+ return 'typespec' in var and var['typespec'] == 'character' and \
+ not isexternal(var)
+
+
+def ischaracter_or_characterarray(var):
+ return _ischaracter(var) and 'charselector' not in var
+
+
+def ischaracter(var):
+ return ischaracter_or_characterarray(var) and not isarray(var)
+
+
+def ischaracterarray(var):
+ return ischaracter_or_characterarray(var) and isarray(var)
+
+
+def isstring_or_stringarray(var):
+ return _ischaracter(var) and 'charselector' in var
+
+
+def isstring(var):
+ return isstring_or_stringarray(var) and not isarray(var)
+
+
+def isstringarray(var):
+ return isstring_or_stringarray(var) and isarray(var)
+
+
+def isarrayofstrings(var): # obsolete?
+ # leaving out '*' for now so that `character*(*) a(m)` and `character
+ # a(m,*)` are treated differently. Luckily `character**` is illegal.
+ return isstringarray(var) and var['dimension'][-1] == '(*)'
+
+
+def isarray(var):
+ return 'dimension' in var and not isexternal(var)
+
+
+def isscalar(var):
+ return not (isarray(var) or isstring(var) or isexternal(var))
+
+
+def iscomplex(var):
+ return isscalar(var) and \
+ var.get('typespec') in ['complex', 'double complex']
+
+
+def islogical(var):
+ return isscalar(var) and var.get('typespec') == 'logical'
+
+
+def isinteger(var):
+ return isscalar(var) and var.get('typespec') == 'integer'
+
+
+def isreal(var):
+ return isscalar(var) and var.get('typespec') == 'real'
+
+
+def get_kind(var):
+ try:
+ return var['kindselector']['*']
+ except KeyError:
+ try:
+ return var['kindselector']['kind']
+ except KeyError:
+ pass
+
+
+def isint1(var):
+ return var.get('typespec') == 'integer' \
+ and get_kind(var) == '1' and not isarray(var)
+
+
+def islong_long(var):
+ if not isscalar(var):
+ return 0
+ if var.get('typespec') not in ['integer', 'logical']:
+ return 0
+ return get_kind(var) == '8'
+
+
+def isunsigned_char(var):
+ if not isscalar(var):
+ return 0
+ if var.get('typespec') != 'integer':
+ return 0
+ return get_kind(var) == '-1'
+
+
+def isunsigned_short(var):
+ if not isscalar(var):
+ return 0
+ if var.get('typespec') != 'integer':
+ return 0
+ return get_kind(var) == '-2'
+
+
+def isunsigned(var):
+ if not isscalar(var):
+ return 0
+ if var.get('typespec') != 'integer':
+ return 0
+ return get_kind(var) == '-4'
+
+
+def isunsigned_long_long(var):
+ if not isscalar(var):
+ return 0
+ if var.get('typespec') != 'integer':
+ return 0
+ return get_kind(var) == '-8'
+
+
+def isdouble(var):
+ if not isscalar(var):
+ return 0
+ if not var.get('typespec') == 'real':
+ return 0
+ return get_kind(var) == '8'
+
+
+def islong_double(var):
+ if not isscalar(var):
+ return 0
+ if not var.get('typespec') == 'real':
+ return 0
+ return get_kind(var) == '16'
+
+
+def islong_complex(var):
+ if not iscomplex(var):
+ return 0
+ return get_kind(var) == '32'
+
+
+def iscomplexarray(var):
+ return isarray(var) and \
+ var.get('typespec') in ['complex', 'double complex']
+
+
+def isint1array(var):
+ return isarray(var) and var.get('typespec') == 'integer' \
+ and get_kind(var) == '1'
+
+
+def isunsigned_chararray(var):
+ return isarray(var) and var.get('typespec') in ['integer', 'logical']\
+ and get_kind(var) == '-1'
+
+
+def isunsigned_shortarray(var):
+ return isarray(var) and var.get('typespec') in ['integer', 'logical']\
+ and get_kind(var) == '-2'
+
+
+def isunsignedarray(var):
+ return isarray(var) and var.get('typespec') in ['integer', 'logical']\
+ and get_kind(var) == '-4'
+
+
+def isunsigned_long_longarray(var):
+ return isarray(var) and var.get('typespec') in ['integer', 'logical']\
+ and get_kind(var) == '-8'
+
+
+def issigned_chararray(var):
+ return isarray(var) and var.get('typespec') in ['integer', 'logical']\
+ and get_kind(var) == '1'
+
+
+def issigned_shortarray(var):
+ return isarray(var) and var.get('typespec') in ['integer', 'logical']\
+ and get_kind(var) == '2'
+
+
+def issigned_array(var):
+ return isarray(var) and var.get('typespec') in ['integer', 'logical']\
+ and get_kind(var) == '4'
+
+
+def issigned_long_longarray(var):
+ return isarray(var) and var.get('typespec') in ['integer', 'logical']\
+ and get_kind(var) == '8'
+
+
+def isallocatable(var):
+ return 'attrspec' in var and 'allocatable' in var['attrspec']
+
+
+def ismutable(var):
+ return not ('dimension' not in var or isstring(var))
+
+
+def ismoduleroutine(rout):
+ return 'modulename' in rout
+
+
+def ismodule(rout):
+ return 'block' in rout and 'module' == rout['block']
+
+
+def isfunction(rout):
+ return 'block' in rout and 'function' == rout['block']
+
+
+def isfunction_wrap(rout):
+ if isintent_c(rout):
+ return 0
+ return wrapfuncs and isfunction(rout) and (not isexternal(rout))
+
+
+def issubroutine(rout):
+ return 'block' in rout and 'subroutine' == rout['block']
+
+
+def issubroutine_wrap(rout):
+ if isintent_c(rout):
+ return 0
+ return issubroutine(rout) and hasassumedshape(rout)
+
+def isattr_value(var):
+ return 'value' in var.get('attrspec', [])
+
+
+def hasassumedshape(rout):
+ if rout.get('hasassumedshape'):
+ return True
+ for a in rout['args']:
+ for d in rout['vars'].get(a, {}).get('dimension', []):
+ if d == ':':
+ rout['hasassumedshape'] = True
+ return True
+ return False
+
+
+def requiresf90wrapper(rout):
+ return ismoduleroutine(rout) or hasassumedshape(rout)
+
+
+def isroutine(rout):
+ return isfunction(rout) or issubroutine(rout)
+
+
+def islogicalfunction(rout):
+ if not isfunction(rout):
+ return 0
+ if 'result' in rout:
+ a = rout['result']
+ else:
+ a = rout['name']
+ if a in rout['vars']:
+ return islogical(rout['vars'][a])
+ return 0
+
+
+def islong_longfunction(rout):
+ if not isfunction(rout):
+ return 0
+ if 'result' in rout:
+ a = rout['result']
+ else:
+ a = rout['name']
+ if a in rout['vars']:
+ return islong_long(rout['vars'][a])
+ return 0
+
+
+def islong_doublefunction(rout):
+ if not isfunction(rout):
+ return 0
+ if 'result' in rout:
+ a = rout['result']
+ else:
+ a = rout['name']
+ if a in rout['vars']:
+ return islong_double(rout['vars'][a])
+ return 0
+
+
+def iscomplexfunction(rout):
+ if not isfunction(rout):
+ return 0
+ if 'result' in rout:
+ a = rout['result']
+ else:
+ a = rout['name']
+ if a in rout['vars']:
+ return iscomplex(rout['vars'][a])
+ return 0
+
+
+def iscomplexfunction_warn(rout):
+ if iscomplexfunction(rout):
+ outmess("""\
+ **************************************************************
+ Warning: code with a function returning complex value
+ may not work correctly with your Fortran compiler.
+ When using GNU gcc/g77 compilers, codes should work
+ correctly for callbacks with:
+ f2py -c -DF2PY_CB_RETURNCOMPLEX
+ **************************************************************\n""")
+ return 1
+ return 0
+
+
+def isstringfunction(rout):
+ if not isfunction(rout):
+ return 0
+ if 'result' in rout:
+ a = rout['result']
+ else:
+ a = rout['name']
+ if a in rout['vars']:
+ return isstring(rout['vars'][a])
+ return 0
+
+
+def hasexternals(rout):
+ return 'externals' in rout and rout['externals']
+
+
+def isthreadsafe(rout):
+ return 'f2pyenhancements' in rout and \
+ 'threadsafe' in rout['f2pyenhancements']
+
+
+def hasvariables(rout):
+ return 'vars' in rout and rout['vars']
+
+
+def isoptional(var):
+ return ('attrspec' in var and 'optional' in var['attrspec'] and
+ 'required' not in var['attrspec']) and isintent_nothide(var)
+
+
+def isexternal(var):
+ return 'attrspec' in var and 'external' in var['attrspec']
+
+
+def getdimension(var):
+ dimpattern = r"\((.*?)\)"
+ if 'attrspec' in var.keys():
+ if any('dimension' in s for s in var['attrspec']):
+ return [re.findall(dimpattern, v) for v in var['attrspec']][0]
+
+
+def isrequired(var):
+ return not isoptional(var) and isintent_nothide(var)
+
+
+def isintent_in(var):
+ if 'intent' not in var:
+ return 1
+ if 'hide' in var['intent']:
+ return 0
+ if 'inplace' in var['intent']:
+ return 0
+ if 'in' in var['intent']:
+ return 1
+ if 'out' in var['intent']:
+ return 0
+ if 'inout' in var['intent']:
+ return 0
+ if 'outin' in var['intent']:
+ return 0
+ return 1
+
+
+def isintent_inout(var):
+ return ('intent' in var and ('inout' in var['intent'] or
+ 'outin' in var['intent']) and 'in' not in var['intent'] and
+ 'hide' not in var['intent'] and 'inplace' not in var['intent'])
+
+
+def isintent_out(var):
+ return 'out' in var.get('intent', [])
+
+
+def isintent_hide(var):
+ return ('intent' in var and ('hide' in var['intent'] or
+ ('out' in var['intent'] and 'in' not in var['intent'] and
+ (not l_or(isintent_inout, isintent_inplace)(var)))))
+
+
+def isintent_nothide(var):
+ return not isintent_hide(var)
+
+
+def isintent_c(var):
+ return 'c' in var.get('intent', [])
+
+
+def isintent_cache(var):
+ return 'cache' in var.get('intent', [])
+
+
+def isintent_copy(var):
+ return 'copy' in var.get('intent', [])
+
+
+def isintent_overwrite(var):
+ return 'overwrite' in var.get('intent', [])
+
+
+def isintent_callback(var):
+ return 'callback' in var.get('intent', [])
+
+
+def isintent_inplace(var):
+ return 'inplace' in var.get('intent', [])
+
+
+def isintent_aux(var):
+ return 'aux' in var.get('intent', [])
+
+
+def isintent_aligned4(var):
+ return 'aligned4' in var.get('intent', [])
+
+
+def isintent_aligned8(var):
+ return 'aligned8' in var.get('intent', [])
+
+
+def isintent_aligned16(var):
+ return 'aligned16' in var.get('intent', [])
+
+
+isintent_dict = {isintent_in: 'INTENT_IN', isintent_inout: 'INTENT_INOUT',
+ isintent_out: 'INTENT_OUT', isintent_hide: 'INTENT_HIDE',
+ isintent_cache: 'INTENT_CACHE',
+ isintent_c: 'INTENT_C', isoptional: 'OPTIONAL',
+ isintent_inplace: 'INTENT_INPLACE',
+ isintent_aligned4: 'INTENT_ALIGNED4',
+ isintent_aligned8: 'INTENT_ALIGNED8',
+ isintent_aligned16: 'INTENT_ALIGNED16',
+ }
+
+
+def isprivate(var):
+ return 'attrspec' in var and 'private' in var['attrspec']
+
+
+def hasinitvalue(var):
+ return '=' in var
+
+
+def hasinitvalueasstring(var):
+ if not hasinitvalue(var):
+ return 0
+ return var['='][0] in ['"', "'"]
+
+
+def hasnote(var):
+ return 'note' in var
+
+
+def hasresultnote(rout):
+ if not isfunction(rout):
+ return 0
+ if 'result' in rout:
+ a = rout['result']
+ else:
+ a = rout['name']
+ if a in rout['vars']:
+ return hasnote(rout['vars'][a])
+ return 0
+
+
+def hascommon(rout):
+ return 'common' in rout
+
+
+def containscommon(rout):
+ if hascommon(rout):
+ return 1
+ if hasbody(rout):
+ for b in rout['body']:
+ if containscommon(b):
+ return 1
+ return 0
+
+
+def containsmodule(block):
+ if ismodule(block):
+ return 1
+ if not hasbody(block):
+ return 0
+ for b in block['body']:
+ if containsmodule(b):
+ return 1
+ return 0
+
+
+def hasbody(rout):
+ return 'body' in rout
+
+
+def hascallstatement(rout):
+ return getcallstatement(rout) is not None
+
+
+def istrue(var):
+ return 1
+
+
+def isfalse(var):
+ return 0
+
+
+class F2PYError(Exception):
+ pass
+
+
+class throw_error:
+
+ def __init__(self, mess):
+ self.mess = mess
+
+ def __call__(self, var):
+ mess = '\n\n var = %s\n Message: %s\n' % (var, self.mess)
+ raise F2PYError(mess)
+
+
+def l_and(*f):
+ l1, l2 = 'lambda v', []
+ for i in range(len(f)):
+ l1 = '%s,f%d=f[%d]' % (l1, i, i)
+ l2.append('f%d(v)' % (i))
+ return eval('%s:%s' % (l1, ' and '.join(l2)))
+
+
+def l_or(*f):
+ l1, l2 = 'lambda v', []
+ for i in range(len(f)):
+ l1 = '%s,f%d=f[%d]' % (l1, i, i)
+ l2.append('f%d(v)' % (i))
+ return eval('%s:%s' % (l1, ' or '.join(l2)))
+
+
+def l_not(f):
+ return eval('lambda v,f=f:not f(v)')
+
+
+def isdummyroutine(rout):
+ try:
+ return rout['f2pyenhancements']['fortranname'] == ''
+ except KeyError:
+ return 0
+
+
+def getfortranname(rout):
+ try:
+ name = rout['f2pyenhancements']['fortranname']
+ if name == '':
+ raise KeyError
+ if not name:
+ errmess('Failed to use fortranname from %s\n' %
+ (rout['f2pyenhancements']))
+ raise KeyError
+ except KeyError:
+ name = rout['name']
+ return name
+
+
+def getmultilineblock(rout, blockname, comment=1, counter=0):
+ try:
+ r = rout['f2pyenhancements'].get(blockname)
+ except KeyError:
+ return
+ if not r:
+ return
+ if counter > 0 and isinstance(r, str):
+ return
+ if isinstance(r, list):
+ if counter >= len(r):
+ return
+ r = r[counter]
+ if r[:3] == "'''":
+ if comment:
+ r = '\t/* start ' + blockname + \
+ ' multiline (' + repr(counter) + ') */\n' + r[3:]
+ else:
+ r = r[3:]
+ if r[-3:] == "'''":
+ if comment:
+ r = r[:-3] + '\n\t/* end multiline (' + repr(counter) + ')*/'
+ else:
+ r = r[:-3]
+ else:
+ errmess("%s multiline block should end with `'''`: %s\n"
+ % (blockname, repr(r)))
+ return r
+
+
+def getcallstatement(rout):
+ return getmultilineblock(rout, 'callstatement')
+
+
+def getcallprotoargument(rout, cb_map={}):
+ r = getmultilineblock(rout, 'callprotoargument', comment=0)
+ if r:
+ return r
+ if hascallstatement(rout):
+ outmess(
+ 'warning: callstatement is defined without callprotoargument\n')
+ return
+ from .capi_maps import getctype
+ arg_types, arg_types2 = [], []
+ if l_and(isstringfunction, l_not(isfunction_wrap))(rout):
+ arg_types.extend(['char*', 'size_t'])
+ for n in rout['args']:
+ var = rout['vars'][n]
+ if isintent_callback(var):
+ continue
+ if n in cb_map:
+ ctype = cb_map[n] + '_typedef'
+ else:
+ ctype = getctype(var)
+ if l_and(isintent_c, l_or(isscalar, iscomplex))(var):
+ pass
+ elif isstring(var):
+ pass
+ else:
+ if not isattr_value(var):
+ ctype = ctype + '*'
+ if ((isstring(var)
+ or isarrayofstrings(var) # obsolete?
+ or isstringarray(var))):
+ arg_types2.append('size_t')
+ arg_types.append(ctype)
+
+ proto_args = ','.join(arg_types + arg_types2)
+ if not proto_args:
+ proto_args = 'void'
+ return proto_args
+
+
+def getusercode(rout):
+ return getmultilineblock(rout, 'usercode')
+
+
+def getusercode1(rout):
+ return getmultilineblock(rout, 'usercode', counter=1)
+
+
+def getpymethoddef(rout):
+ return getmultilineblock(rout, 'pymethoddef')
+
+
+def getargs(rout):
+ sortargs, args = [], []
+ if 'args' in rout:
+ args = rout['args']
+ if 'sortvars' in rout:
+ for a in rout['sortvars']:
+ if a in args:
+ sortargs.append(a)
+ for a in args:
+ if a not in sortargs:
+ sortargs.append(a)
+ else:
+ sortargs = rout['args']
+ return args, sortargs
+
+
+def getargs2(rout):
+ sortargs, args = [], rout.get('args', [])
+ auxvars = [a for a in rout['vars'].keys() if isintent_aux(rout['vars'][a])
+ and a not in args]
+ args = auxvars + args
+ if 'sortvars' in rout:
+ for a in rout['sortvars']:
+ if a in args:
+ sortargs.append(a)
+ for a in args:
+ if a not in sortargs:
+ sortargs.append(a)
+ else:
+ sortargs = auxvars + rout['args']
+ return args, sortargs
+
+
+def getrestdoc(rout):
+ if 'f2pymultilines' not in rout:
+ return None
+ k = None
+ if rout['block'] == 'python module':
+ k = rout['block'], rout['name']
+ return rout['f2pymultilines'].get(k, None)
+
+
+def gentitle(name):
+ ln = (80 - len(name) - 6) // 2
+ return '/*%s %s %s*/' % (ln * '*', name, ln * '*')
+
+
+def flatlist(lst):
+ if isinstance(lst, list):
+ return reduce(lambda x, y, f=flatlist: x + f(y), lst, [])
+ return [lst]
+
+
+def stripcomma(s):
+ if s and s[-1] == ',':
+ return s[:-1]
+ return s
+
+
+def replace(str, d, defaultsep=''):
+ if isinstance(d, list):
+ return [replace(str, _m, defaultsep) for _m in d]
+ if isinstance(str, list):
+ return [replace(_m, d, defaultsep) for _m in str]
+ for k in 2 * list(d.keys()):
+ if k == 'separatorsfor':
+ continue
+ if 'separatorsfor' in d and k in d['separatorsfor']:
+ sep = d['separatorsfor'][k]
+ else:
+ sep = defaultsep
+ if isinstance(d[k], list):
+ str = str.replace('#%s#' % (k), sep.join(flatlist(d[k])))
+ else:
+ str = str.replace('#%s#' % (k), d[k])
+ return str
+
+
+def dictappend(rd, ar):
+ if isinstance(ar, list):
+ for a in ar:
+ rd = dictappend(rd, a)
+ return rd
+ for k in ar.keys():
+ if k[0] == '_':
+ continue
+ if k in rd:
+ if isinstance(rd[k], str):
+ rd[k] = [rd[k]]
+ if isinstance(rd[k], list):
+ if isinstance(ar[k], list):
+ rd[k] = rd[k] + ar[k]
+ else:
+ rd[k].append(ar[k])
+ elif isinstance(rd[k], dict):
+ if isinstance(ar[k], dict):
+ if k == 'separatorsfor':
+ for k1 in ar[k].keys():
+ if k1 not in rd[k]:
+ rd[k][k1] = ar[k][k1]
+ else:
+ rd[k] = dictappend(rd[k], ar[k])
+ else:
+ rd[k] = ar[k]
+ return rd
+
+
+def applyrules(rules, d, var={}):
+ ret = {}
+ if isinstance(rules, list):
+ for r in rules:
+ rr = applyrules(r, d, var)
+ ret = dictappend(ret, rr)
+ if '_break' in rr:
+ break
+ return ret
+ if '_check' in rules and (not rules['_check'](var)):
+ return ret
+ if 'need' in rules:
+ res = applyrules({'needs': rules['need']}, d, var)
+ if 'needs' in res:
+ cfuncs.append_needs(res['needs'])
+
+ for k in rules.keys():
+ if k == 'separatorsfor':
+ ret[k] = rules[k]
+ continue
+ if isinstance(rules[k], str):
+ ret[k] = replace(rules[k], d)
+ elif isinstance(rules[k], list):
+ ret[k] = []
+ for i in rules[k]:
+ ar = applyrules({k: i}, d, var)
+ if k in ar:
+ ret[k].append(ar[k])
+ elif k[0] == '_':
+ continue
+ elif isinstance(rules[k], dict):
+ ret[k] = []
+ for k1 in rules[k].keys():
+ if isinstance(k1, types.FunctionType) and k1(var):
+ if isinstance(rules[k][k1], list):
+ for i in rules[k][k1]:
+ if isinstance(i, dict):
+ res = applyrules({'supertext': i}, d, var)
+ if 'supertext' in res:
+ i = res['supertext']
+ else:
+ i = ''
+ ret[k].append(replace(i, d))
+ else:
+ i = rules[k][k1]
+ if isinstance(i, dict):
+ res = applyrules({'supertext': i}, d)
+ if 'supertext' in res:
+ i = res['supertext']
+ else:
+ i = ''
+ ret[k].append(replace(i, d))
+ else:
+ errmess('applyrules: ignoring rule %s.\n' % repr(rules[k]))
+ if isinstance(ret[k], list):
+ if len(ret[k]) == 1:
+ ret[k] = ret[k][0]
+ if ret[k] == []:
+ del ret[k]
+ return ret
+
+_f2py_module_name_match = re.compile(r'\s*python\s*module\s*(?P[\w_]+)',
+ re.I).match
+_f2py_user_module_name_match = re.compile(r'\s*python\s*module\s*(?P[\w_]*?'
+ r'__user__[\w_]*)', re.I).match
+
+def get_f2py_modulename(source):
+ name = None
+ with open(source) as f:
+ for line in f:
+ m = _f2py_module_name_match(line)
+ if m:
+ if _f2py_user_module_name_match(line): # skip *__user__* names
+ continue
+ name = m.group('name')
+ break
+ return name
+
+def getuseblocks(pymod):
+ all_uses = []
+ for inner in pymod['body']:
+ for modblock in inner['body']:
+ if modblock.get('use'):
+ all_uses.extend([x for x in modblock.get("use").keys() if "__" not in x])
+ return all_uses
+
+def process_f2cmap_dict(f2cmap_all, new_map, c2py_map, verbose = False):
+ """
+ Update the Fortran-to-C type mapping dictionary with new mappings and
+ return a list of successfully mapped C types.
+
+ This function integrates a new mapping dictionary into an existing
+ Fortran-to-C type mapping dictionary. It ensures that all keys are in
+ lowercase and validates new entries against a given C-to-Python mapping
+ dictionary. Redefinitions and invalid entries are reported with a warning.
+
+ Parameters
+ ----------
+ f2cmap_all : dict
+ The existing Fortran-to-C type mapping dictionary that will be updated.
+ It should be a dictionary of dictionaries where the main keys represent
+ Fortran types and the nested dictionaries map Fortran type specifiers
+ to corresponding C types.
+
+ new_map : dict
+ A dictionary containing new type mappings to be added to `f2cmap_all`.
+ The structure should be similar to `f2cmap_all`, with keys representing
+ Fortran types and values being dictionaries of type specifiers and their
+ C type equivalents.
+
+ c2py_map : dict
+ A dictionary used for validating the C types in `new_map`. It maps C
+ types to corresponding Python types and is used to ensure that the C
+ types specified in `new_map` are valid.
+
+ verbose : boolean
+ A flag used to provide information about the types mapped
+
+ Returns
+ -------
+ tuple of (dict, list)
+ The updated Fortran-to-C type mapping dictionary and a list of
+ successfully mapped C types.
+ """
+ f2cmap_mapped = []
+
+ new_map_lower = {}
+ for k, d1 in new_map.items():
+ d1_lower = {k1.lower(): v1 for k1, v1 in d1.items()}
+ new_map_lower[k.lower()] = d1_lower
+
+ for k, d1 in new_map_lower.items():
+ if k not in f2cmap_all:
+ f2cmap_all[k] = {}
+
+ for k1, v1 in d1.items():
+ if v1 in c2py_map:
+ if k1 in f2cmap_all[k]:
+ outmess(
+ "\tWarning: redefinition of {'%s':{'%s':'%s'->'%s'}}\n"
+ % (k, k1, f2cmap_all[k][k1], v1)
+ )
+ f2cmap_all[k][k1] = v1
+ if verbose:
+ outmess('\tMapping "%s(kind=%s)" to "%s"\n' % (k, k1, v1))
+ f2cmap_mapped.append(v1)
+ else:
+ if verbose:
+ errmess(
+ "\tIgnoring map {'%s':{'%s':'%s'}}: '%s' must be in %s\n"
+ % (k, k1, v1, v1, list(c2py_map.keys()))
+ )
+
+ return f2cmap_all, f2cmap_mapped
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/f2py/capi_maps.py b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/f2py/capi_maps.py
new file mode 100644
index 0000000000000000000000000000000000000000..fa477a5b9aca4873c269b7e628dc50f4d58251b0
--- /dev/null
+++ b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/f2py/capi_maps.py
@@ -0,0 +1,819 @@
+"""
+Copyright 1999 -- 2011 Pearu Peterson all rights reserved.
+Copyright 2011 -- present NumPy Developers.
+Permission to use, modify, and distribute this software is given under the
+terms of the NumPy License.
+
+NO WARRANTY IS EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
+"""
+from . import __version__
+f2py_version = __version__.version
+
+import copy
+import re
+import os
+from .crackfortran import markoutercomma
+from . import cb_rules
+from ._isocbind import iso_c_binding_map, isoc_c2pycode_map, iso_c2py_map
+
+# The environment provided by auxfuncs.py is needed for some calls to eval.
+# As the needed functions cannot be determined by static inspection of the
+# code, it is safest to use import * pending a major refactoring of f2py.
+from .auxfuncs import *
+
+__all__ = [
+ 'getctype', 'getstrlength', 'getarrdims', 'getpydocsign',
+ 'getarrdocsign', 'getinit', 'sign2map', 'routsign2map', 'modsign2map',
+ 'cb_sign2map', 'cb_routsign2map', 'common_sign2map', 'process_f2cmap_dict'
+]
+
+
+depargs = []
+lcb_map = {}
+lcb2_map = {}
+# forced casting: mainly caused by the fact that Python or Numeric
+# C/APIs do not support the corresponding C types.
+c2py_map = {'double': 'float',
+ 'float': 'float', # forced casting
+ 'long_double': 'float', # forced casting
+ 'char': 'int', # forced casting
+ 'signed_char': 'int', # forced casting
+ 'unsigned_char': 'int', # forced casting
+ 'short': 'int', # forced casting
+ 'unsigned_short': 'int', # forced casting
+ 'int': 'int', # forced casting
+ 'long': 'int',
+ 'long_long': 'long',
+ 'unsigned': 'int', # forced casting
+ 'complex_float': 'complex', # forced casting
+ 'complex_double': 'complex',
+ 'complex_long_double': 'complex', # forced casting
+ 'string': 'string',
+ 'character': 'bytes',
+ }
+
+c2capi_map = {'double': 'NPY_DOUBLE',
+ 'float': 'NPY_FLOAT',
+ 'long_double': 'NPY_LONGDOUBLE',
+ 'char': 'NPY_BYTE',
+ 'unsigned_char': 'NPY_UBYTE',
+ 'signed_char': 'NPY_BYTE',
+ 'short': 'NPY_SHORT',
+ 'unsigned_short': 'NPY_USHORT',
+ 'int': 'NPY_INT',
+ 'unsigned': 'NPY_UINT',
+ 'long': 'NPY_LONG',
+ 'unsigned_long': 'NPY_ULONG',
+ 'long_long': 'NPY_LONGLONG',
+ 'unsigned_long_long': 'NPY_ULONGLONG',
+ 'complex_float': 'NPY_CFLOAT',
+ 'complex_double': 'NPY_CDOUBLE',
+ 'complex_long_double': 'NPY_CDOUBLE',
+ 'string': 'NPY_STRING',
+ 'character': 'NPY_STRING'}
+
+c2pycode_map = {'double': 'd',
+ 'float': 'f',
+ 'long_double': 'g',
+ 'char': 'b',
+ 'unsigned_char': 'B',
+ 'signed_char': 'b',
+ 'short': 'h',
+ 'unsigned_short': 'H',
+ 'int': 'i',
+ 'unsigned': 'I',
+ 'long': 'l',
+ 'unsigned_long': 'L',
+ 'long_long': 'q',
+ 'unsigned_long_long': 'Q',
+ 'complex_float': 'F',
+ 'complex_double': 'D',
+ 'complex_long_double': 'G',
+ 'string': 'S',
+ 'character': 'c'}
+
+# https://docs.python.org/3/c-api/arg.html#building-values
+c2buildvalue_map = {'double': 'd',
+ 'float': 'f',
+ 'char': 'b',
+ 'signed_char': 'b',
+ 'short': 'h',
+ 'int': 'i',
+ 'long': 'l',
+ 'long_long': 'L',
+ 'complex_float': 'N',
+ 'complex_double': 'N',
+ 'complex_long_double': 'N',
+ 'string': 'y',
+ 'character': 'c'}
+
+f2cmap_all = {'real': {'': 'float', '4': 'float', '8': 'double',
+ '12': 'long_double', '16': 'long_double'},
+ 'integer': {'': 'int', '1': 'signed_char', '2': 'short',
+ '4': 'int', '8': 'long_long',
+ '-1': 'unsigned_char', '-2': 'unsigned_short',
+ '-4': 'unsigned', '-8': 'unsigned_long_long'},
+ 'complex': {'': 'complex_float', '8': 'complex_float',
+ '16': 'complex_double', '24': 'complex_long_double',
+ '32': 'complex_long_double'},
+ 'complexkind': {'': 'complex_float', '4': 'complex_float',
+ '8': 'complex_double', '12': 'complex_long_double',
+ '16': 'complex_long_double'},
+ 'logical': {'': 'int', '1': 'char', '2': 'short', '4': 'int',
+ '8': 'long_long'},
+ 'double complex': {'': 'complex_double'},
+ 'double precision': {'': 'double'},
+ 'byte': {'': 'char'},
+ }
+
+# Add ISO_C handling
+c2pycode_map.update(isoc_c2pycode_map)
+c2py_map.update(iso_c2py_map)
+f2cmap_all, _ = process_f2cmap_dict(f2cmap_all, iso_c_binding_map, c2py_map)
+# End ISO_C handling
+f2cmap_default = copy.deepcopy(f2cmap_all)
+
+f2cmap_mapped = []
+
+def load_f2cmap_file(f2cmap_file):
+ global f2cmap_all, f2cmap_mapped
+
+ f2cmap_all = copy.deepcopy(f2cmap_default)
+
+ if f2cmap_file is None:
+ # Default value
+ f2cmap_file = '.f2py_f2cmap'
+ if not os.path.isfile(f2cmap_file):
+ return
+
+ # User defined additions to f2cmap_all.
+ # f2cmap_file must contain a dictionary of dictionaries, only. For
+ # example, {'real':{'low':'float'}} means that Fortran 'real(low)' is
+ # interpreted as C 'float'. This feature is useful for F90/95 users if
+ # they use PARAMETERS in type specifications.
+ try:
+ outmess('Reading f2cmap from {!r} ...\n'.format(f2cmap_file))
+ with open(f2cmap_file) as f:
+ d = eval(f.read().lower(), {}, {})
+ f2cmap_all, f2cmap_mapped = process_f2cmap_dict(f2cmap_all, d, c2py_map, True)
+ outmess('Successfully applied user defined f2cmap changes\n')
+ except Exception as msg:
+ errmess('Failed to apply user defined f2cmap changes: %s. Skipping.\n' % (msg))
+
+
+cformat_map = {'double': '%g',
+ 'float': '%g',
+ 'long_double': '%Lg',
+ 'char': '%d',
+ 'signed_char': '%d',
+ 'unsigned_char': '%hhu',
+ 'short': '%hd',
+ 'unsigned_short': '%hu',
+ 'int': '%d',
+ 'unsigned': '%u',
+ 'long': '%ld',
+ 'unsigned_long': '%lu',
+ 'long_long': '%ld',
+ 'complex_float': '(%g,%g)',
+ 'complex_double': '(%g,%g)',
+ 'complex_long_double': '(%Lg,%Lg)',
+ 'string': '\\"%s\\"',
+ 'character': "'%c'",
+ }
+
+# Auxiliary functions
+
+
+def getctype(var):
+ """
+ Determines C type
+ """
+ ctype = 'void'
+ if isfunction(var):
+ if 'result' in var:
+ a = var['result']
+ else:
+ a = var['name']
+ if a in var['vars']:
+ return getctype(var['vars'][a])
+ else:
+ errmess('getctype: function %s has no return value?!\n' % a)
+ elif issubroutine(var):
+ return ctype
+ elif ischaracter_or_characterarray(var):
+ return 'character'
+ elif isstring_or_stringarray(var):
+ return 'string'
+ elif 'typespec' in var and var['typespec'].lower() in f2cmap_all:
+ typespec = var['typespec'].lower()
+ f2cmap = f2cmap_all[typespec]
+ ctype = f2cmap[''] # default type
+ if 'kindselector' in var:
+ if '*' in var['kindselector']:
+ try:
+ ctype = f2cmap[var['kindselector']['*']]
+ except KeyError:
+ errmess('getctype: "%s %s %s" not supported.\n' %
+ (var['typespec'], '*', var['kindselector']['*']))
+ elif 'kind' in var['kindselector']:
+ if typespec + 'kind' in f2cmap_all:
+ f2cmap = f2cmap_all[typespec + 'kind']
+ try:
+ ctype = f2cmap[var['kindselector']['kind']]
+ except KeyError:
+ if typespec in f2cmap_all:
+ f2cmap = f2cmap_all[typespec]
+ try:
+ ctype = f2cmap[str(var['kindselector']['kind'])]
+ except KeyError:
+ errmess('getctype: "%s(kind=%s)" is mapped to C "%s" (to override define dict(%s = dict(%s="")) in %s/.f2py_f2cmap file).\n'
+ % (typespec, var['kindselector']['kind'], ctype,
+ typespec, var['kindselector']['kind'], os.getcwd()))
+ else:
+ if not isexternal(var):
+ errmess('getctype: No C-type found in "%s", assuming void.\n' % var)
+ return ctype
+
+
+def f2cexpr(expr):
+ """Rewrite Fortran expression as f2py supported C expression.
+
+ Due to the lack of a proper expression parser in f2py, this
+ function uses a heuristic approach that assumes that Fortran
+ arithmetic expressions are valid C arithmetic expressions when
+ mapping Fortran function calls to the corresponding C function/CPP
+ macros calls.
+
+ """
+ # TODO: support Fortran `len` function with optional kind parameter
+ expr = re.sub(r'\blen\b', 'f2py_slen', expr)
+ return expr
+
+
+def getstrlength(var):
+ if isstringfunction(var):
+ if 'result' in var:
+ a = var['result']
+ else:
+ a = var['name']
+ if a in var['vars']:
+ return getstrlength(var['vars'][a])
+ else:
+ errmess('getstrlength: function %s has no return value?!\n' % a)
+ if not isstring(var):
+ errmess(
+ 'getstrlength: expected a signature of a string but got: %s\n' % (repr(var)))
+ len = '1'
+ if 'charselector' in var:
+ a = var['charselector']
+ if '*' in a:
+ len = a['*']
+ elif 'len' in a:
+ len = f2cexpr(a['len'])
+ if re.match(r'\(\s*(\*|:)\s*\)', len) or re.match(r'(\*|:)', len):
+ if isintent_hide(var):
+ errmess('getstrlength:intent(hide): expected a string with defined length but got: %s\n' % (
+ repr(var)))
+ len = '-1'
+ return len
+
+
+def getarrdims(a, var, verbose=0):
+ ret = {}
+ if isstring(var) and not isarray(var):
+ ret['size'] = getstrlength(var)
+ ret['rank'] = '0'
+ ret['dims'] = ''
+ elif isscalar(var):
+ ret['size'] = '1'
+ ret['rank'] = '0'
+ ret['dims'] = ''
+ elif isarray(var):
+ dim = copy.copy(var['dimension'])
+ ret['size'] = '*'.join(dim)
+ try:
+ ret['size'] = repr(eval(ret['size']))
+ except Exception:
+ pass
+ ret['dims'] = ','.join(dim)
+ ret['rank'] = repr(len(dim))
+ ret['rank*[-1]'] = repr(len(dim) * [-1])[1:-1]
+ for i in range(len(dim)): # solve dim for dependencies
+ v = []
+ if dim[i] in depargs:
+ v = [dim[i]]
+ else:
+ for va in depargs:
+ if re.match(r'.*?\b%s\b.*' % va, dim[i]):
+ v.append(va)
+ for va in v:
+ if depargs.index(va) > depargs.index(a):
+ dim[i] = '*'
+ break
+ ret['setdims'], i = '', -1
+ for d in dim:
+ i = i + 1
+ if d not in ['*', ':', '(*)', '(:)']:
+ ret['setdims'] = '%s#varname#_Dims[%d]=%s,' % (
+ ret['setdims'], i, d)
+ if ret['setdims']:
+ ret['setdims'] = ret['setdims'][:-1]
+ ret['cbsetdims'], i = '', -1
+ for d in var['dimension']:
+ i = i + 1
+ if d not in ['*', ':', '(*)', '(:)']:
+ ret['cbsetdims'] = '%s#varname#_Dims[%d]=%s,' % (
+ ret['cbsetdims'], i, d)
+ elif isintent_in(var):
+ outmess('getarrdims:warning: assumed shape array, using 0 instead of %r\n'
+ % (d))
+ ret['cbsetdims'] = '%s#varname#_Dims[%d]=%s,' % (
+ ret['cbsetdims'], i, 0)
+ elif verbose:
+ errmess(
+ 'getarrdims: If in call-back function: array argument %s must have bounded dimensions: got %s\n' % (repr(a), repr(d)))
+ if ret['cbsetdims']:
+ ret['cbsetdims'] = ret['cbsetdims'][:-1]
+# if not isintent_c(var):
+# var['dimension'].reverse()
+ return ret
+
+
+def getpydocsign(a, var):
+ global lcb_map
+ if isfunction(var):
+ if 'result' in var:
+ af = var['result']
+ else:
+ af = var['name']
+ if af in var['vars']:
+ return getpydocsign(af, var['vars'][af])
+ else:
+ errmess('getctype: function %s has no return value?!\n' % af)
+ return '', ''
+ sig, sigout = a, a
+ opt = ''
+ if isintent_in(var):
+ opt = 'input'
+ elif isintent_inout(var):
+ opt = 'in/output'
+ out_a = a
+ if isintent_out(var):
+ for k in var['intent']:
+ if k[:4] == 'out=':
+ out_a = k[4:]
+ break
+ init = ''
+ ctype = getctype(var)
+
+ if hasinitvalue(var):
+ init, showinit = getinit(a, var)
+ init = ', optional\\n Default: %s' % showinit
+ if isscalar(var):
+ if isintent_inout(var):
+ sig = '%s : %s rank-0 array(%s,\'%s\')%s' % (a, opt, c2py_map[ctype],
+ c2pycode_map[ctype], init)
+ else:
+ sig = '%s : %s %s%s' % (a, opt, c2py_map[ctype], init)
+ sigout = '%s : %s' % (out_a, c2py_map[ctype])
+ elif isstring(var):
+ if isintent_inout(var):
+ sig = '%s : %s rank-0 array(string(len=%s),\'c\')%s' % (
+ a, opt, getstrlength(var), init)
+ else:
+ sig = '%s : %s string(len=%s)%s' % (
+ a, opt, getstrlength(var), init)
+ sigout = '%s : string(len=%s)' % (out_a, getstrlength(var))
+ elif isarray(var):
+ dim = var['dimension']
+ rank = repr(len(dim))
+ sig = '%s : %s rank-%s array(\'%s\') with bounds (%s)%s' % (a, opt, rank,
+ c2pycode_map[
+ ctype],
+ ','.join(dim), init)
+ if a == out_a:
+ sigout = '%s : rank-%s array(\'%s\') with bounds (%s)'\
+ % (a, rank, c2pycode_map[ctype], ','.join(dim))
+ else:
+ sigout = '%s : rank-%s array(\'%s\') with bounds (%s) and %s storage'\
+ % (out_a, rank, c2pycode_map[ctype], ','.join(dim), a)
+ elif isexternal(var):
+ ua = ''
+ if a in lcb_map and lcb_map[a] in lcb2_map and 'argname' in lcb2_map[lcb_map[a]]:
+ ua = lcb2_map[lcb_map[a]]['argname']
+ if not ua == a:
+ ua = ' => %s' % ua
+ else:
+ ua = ''
+ sig = '%s : call-back function%s' % (a, ua)
+ sigout = sig
+ else:
+ errmess(
+ 'getpydocsign: Could not resolve docsignature for "%s".\n' % a)
+ return sig, sigout
+
+
+def getarrdocsign(a, var):
+ ctype = getctype(var)
+ if isstring(var) and (not isarray(var)):
+ sig = '%s : rank-0 array(string(len=%s),\'c\')' % (a,
+ getstrlength(var))
+ elif isscalar(var):
+ sig = '%s : rank-0 array(%s,\'%s\')' % (a, c2py_map[ctype],
+ c2pycode_map[ctype],)
+ elif isarray(var):
+ dim = var['dimension']
+ rank = repr(len(dim))
+ sig = '%s : rank-%s array(\'%s\') with bounds (%s)' % (a, rank,
+ c2pycode_map[
+ ctype],
+ ','.join(dim))
+ return sig
+
+
+def getinit(a, var):
+ if isstring(var):
+ init, showinit = '""', "''"
+ else:
+ init, showinit = '', ''
+ if hasinitvalue(var):
+ init = var['=']
+ showinit = init
+ if iscomplex(var) or iscomplexarray(var):
+ ret = {}
+
+ try:
+ v = var["="]
+ if ',' in v:
+ ret['init.r'], ret['init.i'] = markoutercomma(
+ v[1:-1]).split('@,@')
+ else:
+ v = eval(v, {}, {})
+ ret['init.r'], ret['init.i'] = str(v.real), str(v.imag)
+ except Exception:
+ raise ValueError(
+ 'getinit: expected complex number `(r,i)\' but got `%s\' as initial value of %r.' % (init, a))
+ if isarray(var):
+ init = '(capi_c.r=%s,capi_c.i=%s,capi_c)' % (
+ ret['init.r'], ret['init.i'])
+ elif isstring(var):
+ if not init:
+ init, showinit = '""', "''"
+ if init[0] == "'":
+ init = '"%s"' % (init[1:-1].replace('"', '\\"'))
+ if init[0] == '"':
+ showinit = "'%s'" % (init[1:-1])
+ return init, showinit
+
+
+def get_elsize(var):
+ if isstring(var) or isstringarray(var):
+ elsize = getstrlength(var)
+ # override with user-specified length when available:
+ elsize = var['charselector'].get('f2py_len', elsize)
+ return elsize
+ if ischaracter(var) or ischaracterarray(var):
+ return '1'
+ # for numerical types, PyArray_New* functions ignore specified
+ # elsize, so we just return 1 and let elsize be determined at
+ # runtime, see fortranobject.c
+ return '1'
+
+
+def sign2map(a, var):
+ """
+ varname,ctype,atype
+ init,init.r,init.i,pytype
+ vardebuginfo,vardebugshowvalue,varshowvalue
+ varrformat
+
+ intent
+ """
+ out_a = a
+ if isintent_out(var):
+ for k in var['intent']:
+ if k[:4] == 'out=':
+ out_a = k[4:]
+ break
+ ret = {'varname': a, 'outvarname': out_a, 'ctype': getctype(var)}
+ intent_flags = []
+ for f, s in isintent_dict.items():
+ if f(var):
+ intent_flags.append('F2PY_%s' % s)
+ if intent_flags:
+ # TODO: Evaluate intent_flags here.
+ ret['intent'] = '|'.join(intent_flags)
+ else:
+ ret['intent'] = 'F2PY_INTENT_IN'
+ if isarray(var):
+ ret['varrformat'] = 'N'
+ elif ret['ctype'] in c2buildvalue_map:
+ ret['varrformat'] = c2buildvalue_map[ret['ctype']]
+ else:
+ ret['varrformat'] = 'O'
+ ret['init'], ret['showinit'] = getinit(a, var)
+ if hasinitvalue(var) and iscomplex(var) and not isarray(var):
+ ret['init.r'], ret['init.i'] = markoutercomma(
+ ret['init'][1:-1]).split('@,@')
+ if isexternal(var):
+ ret['cbnamekey'] = a
+ if a in lcb_map:
+ ret['cbname'] = lcb_map[a]
+ ret['maxnofargs'] = lcb2_map[lcb_map[a]]['maxnofargs']
+ ret['nofoptargs'] = lcb2_map[lcb_map[a]]['nofoptargs']
+ ret['cbdocstr'] = lcb2_map[lcb_map[a]]['docstr']
+ ret['cblatexdocstr'] = lcb2_map[lcb_map[a]]['latexdocstr']
+ else:
+ ret['cbname'] = a
+ errmess('sign2map: Confused: external %s is not in lcb_map%s.\n' % (
+ a, list(lcb_map.keys())))
+ if isstring(var):
+ ret['length'] = getstrlength(var)
+ if isarray(var):
+ ret = dictappend(ret, getarrdims(a, var))
+ dim = copy.copy(var['dimension'])
+ if ret['ctype'] in c2capi_map:
+ ret['atype'] = c2capi_map[ret['ctype']]
+ ret['elsize'] = get_elsize(var)
+ # Debug info
+ if debugcapi(var):
+ il = [isintent_in, 'input', isintent_out, 'output',
+ isintent_inout, 'inoutput', isrequired, 'required',
+ isoptional, 'optional', isintent_hide, 'hidden',
+ iscomplex, 'complex scalar',
+ l_and(isscalar, l_not(iscomplex)), 'scalar',
+ isstring, 'string', isarray, 'array',
+ iscomplexarray, 'complex array', isstringarray, 'string array',
+ iscomplexfunction, 'complex function',
+ l_and(isfunction, l_not(iscomplexfunction)), 'function',
+ isexternal, 'callback',
+ isintent_callback, 'callback',
+ isintent_aux, 'auxiliary',
+ ]
+ rl = []
+ for i in range(0, len(il), 2):
+ if il[i](var):
+ rl.append(il[i + 1])
+ if isstring(var):
+ rl.append('slen(%s)=%s' % (a, ret['length']))
+ if isarray(var):
+ ddim = ','.join(
+ map(lambda x, y: '%s|%s' % (x, y), var['dimension'], dim))
+ rl.append('dims(%s)' % ddim)
+ if isexternal(var):
+ ret['vardebuginfo'] = 'debug-capi:%s=>%s:%s' % (
+ a, ret['cbname'], ','.join(rl))
+ else:
+ ret['vardebuginfo'] = 'debug-capi:%s %s=%s:%s' % (
+ ret['ctype'], a, ret['showinit'], ','.join(rl))
+ if isscalar(var):
+ if ret['ctype'] in cformat_map:
+ ret['vardebugshowvalue'] = 'debug-capi:%s=%s' % (
+ a, cformat_map[ret['ctype']])
+ if isstring(var):
+ ret['vardebugshowvalue'] = 'debug-capi:slen(%s)=%%d %s=\\"%%s\\"' % (
+ a, a)
+ if isexternal(var):
+ ret['vardebugshowvalue'] = 'debug-capi:%s=%%p' % (a)
+ if ret['ctype'] in cformat_map:
+ ret['varshowvalue'] = '#name#:%s=%s' % (a, cformat_map[ret['ctype']])
+ ret['showvalueformat'] = '%s' % (cformat_map[ret['ctype']])
+ if isstring(var):
+ ret['varshowvalue'] = '#name#:slen(%s)=%%d %s=\\"%%s\\"' % (a, a)
+ ret['pydocsign'], ret['pydocsignout'] = getpydocsign(a, var)
+ if hasnote(var):
+ ret['note'] = var['note']
+ return ret
+
+
+def routsign2map(rout):
+ """
+ name,NAME,begintitle,endtitle
+ rname,ctype,rformat
+ routdebugshowvalue
+ """
+ global lcb_map
+ name = rout['name']
+ fname = getfortranname(rout)
+ ret = {'name': name,
+ 'texname': name.replace('_', '\\_'),
+ 'name_lower': name.lower(),
+ 'NAME': name.upper(),
+ 'begintitle': gentitle(name),
+ 'endtitle': gentitle('end of %s' % name),
+ 'fortranname': fname,
+ 'FORTRANNAME': fname.upper(),
+ 'callstatement': getcallstatement(rout) or '',
+ 'usercode': getusercode(rout) or '',
+ 'usercode1': getusercode1(rout) or '',
+ }
+ if '_' in fname:
+ ret['F_FUNC'] = 'F_FUNC_US'
+ else:
+ ret['F_FUNC'] = 'F_FUNC'
+ if '_' in name:
+ ret['F_WRAPPEDFUNC'] = 'F_WRAPPEDFUNC_US'
+ else:
+ ret['F_WRAPPEDFUNC'] = 'F_WRAPPEDFUNC'
+ lcb_map = {}
+ if 'use' in rout:
+ for u in rout['use'].keys():
+ if u in cb_rules.cb_map:
+ for un in cb_rules.cb_map[u]:
+ ln = un[0]
+ if 'map' in rout['use'][u]:
+ for k in rout['use'][u]['map'].keys():
+ if rout['use'][u]['map'][k] == un[0]:
+ ln = k
+ break
+ lcb_map[ln] = un[1]
+ elif 'externals' in rout and rout['externals']:
+ errmess('routsign2map: Confused: function %s has externals %s but no "use" statement.\n' % (
+ ret['name'], repr(rout['externals'])))
+ ret['callprotoargument'] = getcallprotoargument(rout, lcb_map) or ''
+ if isfunction(rout):
+ if 'result' in rout:
+ a = rout['result']
+ else:
+ a = rout['name']
+ ret['rname'] = a
+ ret['pydocsign'], ret['pydocsignout'] = getpydocsign(a, rout)
+ ret['ctype'] = getctype(rout['vars'][a])
+ if hasresultnote(rout):
+ ret['resultnote'] = rout['vars'][a]['note']
+ rout['vars'][a]['note'] = ['See elsewhere.']
+ if ret['ctype'] in c2buildvalue_map:
+ ret['rformat'] = c2buildvalue_map[ret['ctype']]
+ else:
+ ret['rformat'] = 'O'
+ errmess('routsign2map: no c2buildvalue key for type %s\n' %
+ (repr(ret['ctype'])))
+ if debugcapi(rout):
+ if ret['ctype'] in cformat_map:
+ ret['routdebugshowvalue'] = 'debug-capi:%s=%s' % (
+ a, cformat_map[ret['ctype']])
+ if isstringfunction(rout):
+ ret['routdebugshowvalue'] = 'debug-capi:slen(%s)=%%d %s=\\"%%s\\"' % (
+ a, a)
+ if isstringfunction(rout):
+ ret['rlength'] = getstrlength(rout['vars'][a])
+ if ret['rlength'] == '-1':
+ errmess('routsign2map: expected explicit specification of the length of the string returned by the fortran function %s; taking 10.\n' % (
+ repr(rout['name'])))
+ ret['rlength'] = '10'
+ if hasnote(rout):
+ ret['note'] = rout['note']
+ rout['note'] = ['See elsewhere.']
+ return ret
+
+
+def modsign2map(m):
+ """
+ modulename
+ """
+ if ismodule(m):
+ ret = {'f90modulename': m['name'],
+ 'F90MODULENAME': m['name'].upper(),
+ 'texf90modulename': m['name'].replace('_', '\\_')}
+ else:
+ ret = {'modulename': m['name'],
+ 'MODULENAME': m['name'].upper(),
+ 'texmodulename': m['name'].replace('_', '\\_')}
+ ret['restdoc'] = getrestdoc(m) or []
+ if hasnote(m):
+ ret['note'] = m['note']
+ ret['usercode'] = getusercode(m) or ''
+ ret['usercode1'] = getusercode1(m) or ''
+ if m['body']:
+ ret['interface_usercode'] = getusercode(m['body'][0]) or ''
+ else:
+ ret['interface_usercode'] = ''
+ ret['pymethoddef'] = getpymethoddef(m) or ''
+ if 'coutput' in m:
+ ret['coutput'] = m['coutput']
+ if 'f2py_wrapper_output' in m:
+ ret['f2py_wrapper_output'] = m['f2py_wrapper_output']
+ return ret
+
+
+def cb_sign2map(a, var, index=None):
+ ret = {'varname': a}
+ ret['varname_i'] = ret['varname']
+ ret['ctype'] = getctype(var)
+ if ret['ctype'] in c2capi_map:
+ ret['atype'] = c2capi_map[ret['ctype']]
+ ret['elsize'] = get_elsize(var)
+ if ret['ctype'] in cformat_map:
+ ret['showvalueformat'] = '%s' % (cformat_map[ret['ctype']])
+ if isarray(var):
+ ret = dictappend(ret, getarrdims(a, var))
+ ret['pydocsign'], ret['pydocsignout'] = getpydocsign(a, var)
+ if hasnote(var):
+ ret['note'] = var['note']
+ var['note'] = ['See elsewhere.']
+ return ret
+
+
+def cb_routsign2map(rout, um):
+ """
+ name,begintitle,endtitle,argname
+ ctype,rctype,maxnofargs,nofoptargs,returncptr
+ """
+ ret = {'name': 'cb_%s_in_%s' % (rout['name'], um),
+ 'returncptr': ''}
+ if isintent_callback(rout):
+ if '_' in rout['name']:
+ F_FUNC = 'F_FUNC_US'
+ else:
+ F_FUNC = 'F_FUNC'
+ ret['callbackname'] = '%s(%s,%s)' \
+ % (F_FUNC,
+ rout['name'].lower(),
+ rout['name'].upper(),
+ )
+ ret['static'] = 'extern'
+ else:
+ ret['callbackname'] = ret['name']
+ ret['static'] = 'static'
+ ret['argname'] = rout['name']
+ ret['begintitle'] = gentitle(ret['name'])
+ ret['endtitle'] = gentitle('end of %s' % ret['name'])
+ ret['ctype'] = getctype(rout)
+ ret['rctype'] = 'void'
+ if ret['ctype'] == 'string':
+ ret['rctype'] = 'void'
+ else:
+ ret['rctype'] = ret['ctype']
+ if ret['rctype'] != 'void':
+ if iscomplexfunction(rout):
+ ret['returncptr'] = """
+#ifdef F2PY_CB_RETURNCOMPLEX
+return_value=
+#endif
+"""
+ else:
+ ret['returncptr'] = 'return_value='
+ if ret['ctype'] in cformat_map:
+ ret['showvalueformat'] = '%s' % (cformat_map[ret['ctype']])
+ if isstringfunction(rout):
+ ret['strlength'] = getstrlength(rout)
+ if isfunction(rout):
+ if 'result' in rout:
+ a = rout['result']
+ else:
+ a = rout['name']
+ if hasnote(rout['vars'][a]):
+ ret['note'] = rout['vars'][a]['note']
+ rout['vars'][a]['note'] = ['See elsewhere.']
+ ret['rname'] = a
+ ret['pydocsign'], ret['pydocsignout'] = getpydocsign(a, rout)
+ if iscomplexfunction(rout):
+ ret['rctype'] = """
+#ifdef F2PY_CB_RETURNCOMPLEX
+#ctype#
+#else
+void
+#endif
+"""
+ else:
+ if hasnote(rout):
+ ret['note'] = rout['note']
+ rout['note'] = ['See elsewhere.']
+ nofargs = 0
+ nofoptargs = 0
+ if 'args' in rout and 'vars' in rout:
+ for a in rout['args']:
+ var = rout['vars'][a]
+ if l_or(isintent_in, isintent_inout)(var):
+ nofargs = nofargs + 1
+ if isoptional(var):
+ nofoptargs = nofoptargs + 1
+ ret['maxnofargs'] = repr(nofargs)
+ ret['nofoptargs'] = repr(nofoptargs)
+ if hasnote(rout) and isfunction(rout) and 'result' in rout:
+ ret['routnote'] = rout['note']
+ rout['note'] = ['See elsewhere.']
+ return ret
+
+
+def common_sign2map(a, var): # obsolute
+ ret = {'varname': a, 'ctype': getctype(var)}
+ if isstringarray(var):
+ ret['ctype'] = 'char'
+ if ret['ctype'] in c2capi_map:
+ ret['atype'] = c2capi_map[ret['ctype']]
+ ret['elsize'] = get_elsize(var)
+ if ret['ctype'] in cformat_map:
+ ret['showvalueformat'] = '%s' % (cformat_map[ret['ctype']])
+ if isarray(var):
+ ret = dictappend(ret, getarrdims(a, var))
+ elif isstring(var):
+ ret['size'] = getstrlength(var)
+ ret['rank'] = '1'
+ ret['pydocsign'], ret['pydocsignout'] = getpydocsign(a, var)
+ if hasnote(var):
+ ret['note'] = var['note']
+ var['note'] = ['See elsewhere.']
+ # for strings this returns 0-rank but actually is 1-rank
+ ret['arrdocstr'] = getarrdocsign(a, var)
+ return ret
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/f2py/cb_rules.py b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/f2py/cb_rules.py
new file mode 100644
index 0000000000000000000000000000000000000000..721e075b6c73fd54c0f9f5b4802a5c94eb8d6a3f
--- /dev/null
+++ b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/f2py/cb_rules.py
@@ -0,0 +1,644 @@
+"""
+Build call-back mechanism for f2py2e.
+
+Copyright 1999 -- 2011 Pearu Peterson all rights reserved.
+Copyright 2011 -- present NumPy Developers.
+Permission to use, modify, and distribute this software is given under the
+terms of the NumPy License.
+
+NO WARRANTY IS EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
+"""
+from . import __version__
+from .auxfuncs import (
+ applyrules, debugcapi, dictappend, errmess, getargs, hasnote, isarray,
+ iscomplex, iscomplexarray, iscomplexfunction, isfunction, isintent_c,
+ isintent_hide, isintent_in, isintent_inout, isintent_nothide,
+ isintent_out, isoptional, isrequired, isscalar, isstring,
+ isstringfunction, issubroutine, l_and, l_not, l_or, outmess, replace,
+ stripcomma, throw_error
+)
+from . import cfuncs
+
+f2py_version = __version__.version
+
+
+################## Rules for callback function ##############
+
+cb_routine_rules = {
+ 'cbtypedefs': 'typedef #rctype#(*#name#_typedef)(#optargs_td##args_td##strarglens_td##noargs#);',
+ 'body': """
+#begintitle#
+typedef struct {
+ PyObject *capi;
+ PyTupleObject *args_capi;
+ int nofargs;
+ jmp_buf jmpbuf;
+} #name#_t;
+
+#if defined(F2PY_THREAD_LOCAL_DECL) && !defined(F2PY_USE_PYTHON_TLS)
+
+static F2PY_THREAD_LOCAL_DECL #name#_t *_active_#name# = NULL;
+
+static #name#_t *swap_active_#name#(#name#_t *ptr) {
+ #name#_t *prev = _active_#name#;
+ _active_#name# = ptr;
+ return prev;
+}
+
+static #name#_t *get_active_#name#(void) {
+ return _active_#name#;
+}
+
+#else
+
+static #name#_t *swap_active_#name#(#name#_t *ptr) {
+ char *key = "__f2py_cb_#name#";
+ return (#name#_t *)F2PySwapThreadLocalCallbackPtr(key, ptr);
+}
+
+static #name#_t *get_active_#name#(void) {
+ char *key = "__f2py_cb_#name#";
+ return (#name#_t *)F2PyGetThreadLocalCallbackPtr(key);
+}
+
+#endif
+
+/*typedef #rctype#(*#name#_typedef)(#optargs_td##args_td##strarglens_td##noargs#);*/
+#static# #rctype# #callbackname# (#optargs##args##strarglens##noargs#) {
+ #name#_t cb_local = { NULL, NULL, 0 };
+ #name#_t *cb = NULL;
+ PyTupleObject *capi_arglist = NULL;
+ PyObject *capi_return = NULL;
+ PyObject *capi_tmp = NULL;
+ PyObject *capi_arglist_list = NULL;
+ int capi_j,capi_i = 0;
+ int capi_longjmp_ok = 1;
+#decl#
+#ifdef F2PY_REPORT_ATEXIT
+f2py_cb_start_clock();
+#endif
+ cb = get_active_#name#();
+ if (cb == NULL) {
+ capi_longjmp_ok = 0;
+ cb = &cb_local;
+ }
+ capi_arglist = cb->args_capi;
+ CFUNCSMESS(\"cb:Call-back function #name# (maxnofargs=#maxnofargs#(-#nofoptargs#))\\n\");
+ CFUNCSMESSPY(\"cb:#name#_capi=\",cb->capi);
+ if (cb->capi==NULL) {
+ capi_longjmp_ok = 0;
+ cb->capi = PyObject_GetAttrString(#modulename#_module,\"#argname#\");
+ CFUNCSMESSPY(\"cb:#name#_capi=\",cb->capi);
+ }
+ if (cb->capi==NULL) {
+ PyErr_SetString(#modulename#_error,\"cb: Callback #argname# not defined (as an argument or module #modulename# attribute).\\n\");
+ goto capi_fail;
+ }
+ if (F2PyCapsule_Check(cb->capi)) {
+ #name#_typedef #name#_cptr;
+ #name#_cptr = F2PyCapsule_AsVoidPtr(cb->capi);
+ #returncptr#(*#name#_cptr)(#optargs_nm##args_nm##strarglens_nm#);
+ #return#
+ }
+ if (capi_arglist==NULL) {
+ capi_longjmp_ok = 0;
+ capi_tmp = PyObject_GetAttrString(#modulename#_module,\"#argname#_extra_args\");
+ if (capi_tmp) {
+ capi_arglist = (PyTupleObject *)PySequence_Tuple(capi_tmp);
+ Py_DECREF(capi_tmp);
+ if (capi_arglist==NULL) {
+ PyErr_SetString(#modulename#_error,\"Failed to convert #modulename#.#argname#_extra_args to tuple.\\n\");
+ goto capi_fail;
+ }
+ } else {
+ PyErr_Clear();
+ capi_arglist = (PyTupleObject *)Py_BuildValue(\"()\");
+ }
+ }
+ if (capi_arglist == NULL) {
+ PyErr_SetString(#modulename#_error,\"Callback #argname# argument list is not set.\\n\");
+ goto capi_fail;
+ }
+#setdims#
+#ifdef PYPY_VERSION
+#define CAPI_ARGLIST_SETITEM(idx, value) PyList_SetItem((PyObject *)capi_arglist_list, idx, value)
+ capi_arglist_list = PySequence_List(capi_arglist);
+ if (capi_arglist_list == NULL) goto capi_fail;
+#else
+#define CAPI_ARGLIST_SETITEM(idx, value) PyTuple_SetItem((PyObject *)capi_arglist, idx, value)
+#endif
+#pyobjfrom#
+#undef CAPI_ARGLIST_SETITEM
+#ifdef PYPY_VERSION
+ CFUNCSMESSPY(\"cb:capi_arglist=\",capi_arglist_list);
+#else
+ CFUNCSMESSPY(\"cb:capi_arglist=\",capi_arglist);
+#endif
+ CFUNCSMESS(\"cb:Call-back calling Python function #argname#.\\n\");
+#ifdef F2PY_REPORT_ATEXIT
+f2py_cb_start_call_clock();
+#endif
+#ifdef PYPY_VERSION
+ capi_return = PyObject_CallObject(cb->capi,(PyObject *)capi_arglist_list);
+ Py_DECREF(capi_arglist_list);
+ capi_arglist_list = NULL;
+#else
+ capi_return = PyObject_CallObject(cb->capi,(PyObject *)capi_arglist);
+#endif
+#ifdef F2PY_REPORT_ATEXIT
+f2py_cb_stop_call_clock();
+#endif
+ CFUNCSMESSPY(\"cb:capi_return=\",capi_return);
+ if (capi_return == NULL) {
+ fprintf(stderr,\"capi_return is NULL\\n\");
+ goto capi_fail;
+ }
+ if (capi_return == Py_None) {
+ Py_DECREF(capi_return);
+ capi_return = Py_BuildValue(\"()\");
+ }
+ else if (!PyTuple_Check(capi_return)) {
+ capi_return = Py_BuildValue(\"(N)\",capi_return);
+ }
+ capi_j = PyTuple_Size(capi_return);
+ capi_i = 0;
+#frompyobj#
+ CFUNCSMESS(\"cb:#name#:successful\\n\");
+ Py_DECREF(capi_return);
+#ifdef F2PY_REPORT_ATEXIT
+f2py_cb_stop_clock();
+#endif
+ goto capi_return_pt;
+capi_fail:
+ fprintf(stderr,\"Call-back #name# failed.\\n\");
+ Py_XDECREF(capi_return);
+ Py_XDECREF(capi_arglist_list);
+ if (capi_longjmp_ok) {
+ longjmp(cb->jmpbuf,-1);
+ }
+capi_return_pt:
+ ;
+#return#
+}
+#endtitle#
+""",
+ 'need': ['setjmp.h', 'CFUNCSMESS', 'F2PY_THREAD_LOCAL_DECL'],
+ 'maxnofargs': '#maxnofargs#',
+ 'nofoptargs': '#nofoptargs#',
+ 'docstr': """\
+ def #argname#(#docsignature#): return #docreturn#\\n\\
+#docstrsigns#""",
+ 'latexdocstr': """
+{{}\\verb@def #argname#(#latexdocsignature#): return #docreturn#@{}}
+#routnote#
+
+#latexdocstrsigns#""",
+ 'docstrshort': 'def #argname#(#docsignature#): return #docreturn#'
+}
+cb_rout_rules = [
+ { # Init
+ 'separatorsfor': {'decl': '\n',
+ 'args': ',', 'optargs': '', 'pyobjfrom': '\n', 'freemem': '\n',
+ 'args_td': ',', 'optargs_td': '',
+ 'args_nm': ',', 'optargs_nm': '',
+ 'frompyobj': '\n', 'setdims': '\n',
+ 'docstrsigns': '\\n"\n"',
+ 'latexdocstrsigns': '\n',
+ 'latexdocstrreq': '\n', 'latexdocstropt': '\n',
+ 'latexdocstrout': '\n', 'latexdocstrcbs': '\n',
+ },
+ 'decl': '/*decl*/', 'pyobjfrom': '/*pyobjfrom*/', 'frompyobj': '/*frompyobj*/',
+ 'args': [], 'optargs': '', 'return': '', 'strarglens': '', 'freemem': '/*freemem*/',
+ 'args_td': [], 'optargs_td': '', 'strarglens_td': '',
+ 'args_nm': [], 'optargs_nm': '', 'strarglens_nm': '',
+ 'noargs': '',
+ 'setdims': '/*setdims*/',
+ 'docstrsigns': '', 'latexdocstrsigns': '',
+ 'docstrreq': ' Required arguments:',
+ 'docstropt': ' Optional arguments:',
+ 'docstrout': ' Return objects:',
+ 'docstrcbs': ' Call-back functions:',
+ 'docreturn': '', 'docsign': '', 'docsignopt': '',
+ 'latexdocstrreq': '\\noindent Required arguments:',
+ 'latexdocstropt': '\\noindent Optional arguments:',
+ 'latexdocstrout': '\\noindent Return objects:',
+ 'latexdocstrcbs': '\\noindent Call-back functions:',
+ 'routnote': {hasnote: '--- #note#', l_not(hasnote): ''},
+ }, { # Function
+ 'decl': ' #ctype# return_value = 0;',
+ 'frompyobj': [
+ {debugcapi: ' CFUNCSMESS("cb:Getting return_value->");'},
+ '''\
+ if (capi_j>capi_i) {
+ GETSCALARFROMPYTUPLE(capi_return,capi_i++,&return_value,#ctype#,
+ "#ctype#_from_pyobj failed in converting return_value of"
+ " call-back function #name# to C #ctype#\\n");
+ } else {
+ fprintf(stderr,"Warning: call-back function #name# did not provide"
+ " return value (index=%d, type=#ctype#)\\n",capi_i);
+ }''',
+ {debugcapi:
+ ' fprintf(stderr,"#showvalueformat#.\\n",return_value);'}
+ ],
+ 'need': ['#ctype#_from_pyobj', {debugcapi: 'CFUNCSMESS'}, 'GETSCALARFROMPYTUPLE'],
+ 'return': ' return return_value;',
+ '_check': l_and(isfunction, l_not(isstringfunction), l_not(iscomplexfunction))
+ },
+ { # String function
+ 'pyobjfrom': {debugcapi: ' fprintf(stderr,"debug-capi:cb:#name#:%d:\\n",return_value_len);'},
+ 'args': '#ctype# return_value,int return_value_len',
+ 'args_nm': 'return_value,&return_value_len',
+ 'args_td': '#ctype# ,int',
+ 'frompyobj': [
+ {debugcapi: ' CFUNCSMESS("cb:Getting return_value->\\"");'},
+ """\
+ if (capi_j>capi_i) {
+ GETSTRFROMPYTUPLE(capi_return,capi_i++,return_value,return_value_len);
+ } else {
+ fprintf(stderr,"Warning: call-back function #name# did not provide"
+ " return value (index=%d, type=#ctype#)\\n",capi_i);
+ }""",
+ {debugcapi:
+ ' fprintf(stderr,"#showvalueformat#\\".\\n",return_value);'}
+ ],
+ 'need': ['#ctype#_from_pyobj', {debugcapi: 'CFUNCSMESS'},
+ 'string.h', 'GETSTRFROMPYTUPLE'],
+ 'return': 'return;',
+ '_check': isstringfunction
+ },
+ { # Complex function
+ 'optargs': """
+#ifndef F2PY_CB_RETURNCOMPLEX
+#ctype# *return_value
+#endif
+""",
+ 'optargs_nm': """
+#ifndef F2PY_CB_RETURNCOMPLEX
+return_value
+#endif
+""",
+ 'optargs_td': """
+#ifndef F2PY_CB_RETURNCOMPLEX
+#ctype# *
+#endif
+""",
+ 'decl': """
+#ifdef F2PY_CB_RETURNCOMPLEX
+ #ctype# return_value = {0, 0};
+#endif
+""",
+ 'frompyobj': [
+ {debugcapi: ' CFUNCSMESS("cb:Getting return_value->");'},
+ """\
+ if (capi_j>capi_i) {
+#ifdef F2PY_CB_RETURNCOMPLEX
+ GETSCALARFROMPYTUPLE(capi_return,capi_i++,&return_value,#ctype#,
+ \"#ctype#_from_pyobj failed in converting return_value of call-back\"
+ \" function #name# to C #ctype#\\n\");
+#else
+ GETSCALARFROMPYTUPLE(capi_return,capi_i++,return_value,#ctype#,
+ \"#ctype#_from_pyobj failed in converting return_value of call-back\"
+ \" function #name# to C #ctype#\\n\");
+#endif
+ } else {
+ fprintf(stderr,
+ \"Warning: call-back function #name# did not provide\"
+ \" return value (index=%d, type=#ctype#)\\n\",capi_i);
+ }""",
+ {debugcapi: """\
+#ifdef F2PY_CB_RETURNCOMPLEX
+ fprintf(stderr,\"#showvalueformat#.\\n\",(return_value).r,(return_value).i);
+#else
+ fprintf(stderr,\"#showvalueformat#.\\n\",(*return_value).r,(*return_value).i);
+#endif
+"""}
+ ],
+ 'return': """
+#ifdef F2PY_CB_RETURNCOMPLEX
+ return return_value;
+#else
+ return;
+#endif
+""",
+ 'need': ['#ctype#_from_pyobj', {debugcapi: 'CFUNCSMESS'},
+ 'string.h', 'GETSCALARFROMPYTUPLE', '#ctype#'],
+ '_check': iscomplexfunction
+ },
+ {'docstrout': ' #pydocsignout#',
+ 'latexdocstrout': ['\\item[]{{}\\verb@#pydocsignout#@{}}',
+ {hasnote: '--- #note#'}],
+ 'docreturn': '#rname#,',
+ '_check': isfunction},
+ {'_check': issubroutine, 'return': 'return;'}
+]
+
+cb_arg_rules = [
+ { # Doc
+ 'docstropt': {l_and(isoptional, isintent_nothide): ' #pydocsign#'},
+ 'docstrreq': {l_and(isrequired, isintent_nothide): ' #pydocsign#'},
+ 'docstrout': {isintent_out: ' #pydocsignout#'},
+ 'latexdocstropt': {l_and(isoptional, isintent_nothide): ['\\item[]{{}\\verb@#pydocsign#@{}}',
+ {hasnote: '--- #note#'}]},
+ 'latexdocstrreq': {l_and(isrequired, isintent_nothide): ['\\item[]{{}\\verb@#pydocsign#@{}}',
+ {hasnote: '--- #note#'}]},
+ 'latexdocstrout': {isintent_out: ['\\item[]{{}\\verb@#pydocsignout#@{}}',
+ {l_and(hasnote, isintent_hide): '--- #note#',
+ l_and(hasnote, isintent_nothide): '--- See above.'}]},
+ 'docsign': {l_and(isrequired, isintent_nothide): '#varname#,'},
+ 'docsignopt': {l_and(isoptional, isintent_nothide): '#varname#,'},
+ 'depend': ''
+ },
+ {
+ 'args': {
+ l_and(isscalar, isintent_c): '#ctype# #varname_i#',
+ l_and(isscalar, l_not(isintent_c)): '#ctype# *#varname_i#_cb_capi',
+ isarray: '#ctype# *#varname_i#',
+ isstring: '#ctype# #varname_i#'
+ },
+ 'args_nm': {
+ l_and(isscalar, isintent_c): '#varname_i#',
+ l_and(isscalar, l_not(isintent_c)): '#varname_i#_cb_capi',
+ isarray: '#varname_i#',
+ isstring: '#varname_i#'
+ },
+ 'args_td': {
+ l_and(isscalar, isintent_c): '#ctype#',
+ l_and(isscalar, l_not(isintent_c)): '#ctype# *',
+ isarray: '#ctype# *',
+ isstring: '#ctype#'
+ },
+ 'need': {l_or(isscalar, isarray, isstring): '#ctype#'},
+ # untested with multiple args
+ 'strarglens': {isstring: ',int #varname_i#_cb_len'},
+ 'strarglens_td': {isstring: ',int'}, # untested with multiple args
+ # untested with multiple args
+ 'strarglens_nm': {isstring: ',#varname_i#_cb_len'},
+ },
+ { # Scalars
+ 'decl': {l_not(isintent_c): ' #ctype# #varname_i#=(*#varname_i#_cb_capi);'},
+ 'error': {l_and(isintent_c, isintent_out,
+ throw_error('intent(c,out) is forbidden for callback scalar arguments')):
+ ''},
+ 'frompyobj': [{debugcapi: ' CFUNCSMESS("cb:Getting #varname#->");'},
+ {isintent_out:
+ ' if (capi_j>capi_i)\n GETSCALARFROMPYTUPLE(capi_return,capi_i++,#varname_i#_cb_capi,#ctype#,"#ctype#_from_pyobj failed in converting argument #varname# of call-back function #name# to C #ctype#\\n");'},
+ {l_and(debugcapi, l_and(l_not(iscomplex), isintent_c)):
+ ' fprintf(stderr,"#showvalueformat#.\\n",#varname_i#);'},
+ {l_and(debugcapi, l_and(l_not(iscomplex), l_not( isintent_c))):
+ ' fprintf(stderr,"#showvalueformat#.\\n",*#varname_i#_cb_capi);'},
+ {l_and(debugcapi, l_and(iscomplex, isintent_c)):
+ ' fprintf(stderr,"#showvalueformat#.\\n",(#varname_i#).r,(#varname_i#).i);'},
+ {l_and(debugcapi, l_and(iscomplex, l_not( isintent_c))):
+ ' fprintf(stderr,"#showvalueformat#.\\n",(*#varname_i#_cb_capi).r,(*#varname_i#_cb_capi).i);'},
+ ],
+ 'need': [{isintent_out: ['#ctype#_from_pyobj', 'GETSCALARFROMPYTUPLE']},
+ {debugcapi: 'CFUNCSMESS'}],
+ '_check': isscalar
+ }, {
+ 'pyobjfrom': [{isintent_in: """\
+ if (cb->nofargs>capi_i)
+ if (CAPI_ARGLIST_SETITEM(capi_i++,pyobj_from_#ctype#1(#varname_i#)))
+ goto capi_fail;"""},
+ {isintent_inout: """\
+ if (cb->nofargs>capi_i)
+ if (CAPI_ARGLIST_SETITEM(capi_i++,pyarr_from_p_#ctype#1(#varname_i#_cb_capi)))
+ goto capi_fail;"""}],
+ 'need': [{isintent_in: 'pyobj_from_#ctype#1'},
+ {isintent_inout: 'pyarr_from_p_#ctype#1'},
+ {iscomplex: '#ctype#'}],
+ '_check': l_and(isscalar, isintent_nothide),
+ '_optional': ''
+ }, { # String
+ 'frompyobj': [{debugcapi: ' CFUNCSMESS("cb:Getting #varname#->\\"");'},
+ """ if (capi_j>capi_i)
+ GETSTRFROMPYTUPLE(capi_return,capi_i++,#varname_i#,#varname_i#_cb_len);""",
+ {debugcapi:
+ ' fprintf(stderr,"#showvalueformat#\\":%d:.\\n",#varname_i#,#varname_i#_cb_len);'},
+ ],
+ 'need': ['#ctype#', 'GETSTRFROMPYTUPLE',
+ {debugcapi: 'CFUNCSMESS'}, 'string.h'],
+ '_check': l_and(isstring, isintent_out)
+ }, {
+ 'pyobjfrom': [
+ {debugcapi:
+ (' fprintf(stderr,"debug-capi:cb:#varname#=#showvalueformat#:'
+ '%d:\\n",#varname_i#,#varname_i#_cb_len);')},
+ {isintent_in: """\
+ if (cb->nofargs>capi_i)
+ if (CAPI_ARGLIST_SETITEM(capi_i++,pyobj_from_#ctype#1size(#varname_i#,#varname_i#_cb_len)))
+ goto capi_fail;"""},
+ {isintent_inout: """\
+ if (cb->nofargs>capi_i) {
+ int #varname_i#_cb_dims[] = {#varname_i#_cb_len};
+ if (CAPI_ARGLIST_SETITEM(capi_i++,pyarr_from_p_#ctype#1(#varname_i#,#varname_i#_cb_dims)))
+ goto capi_fail;
+ }"""}],
+ 'need': [{isintent_in: 'pyobj_from_#ctype#1size'},
+ {isintent_inout: 'pyarr_from_p_#ctype#1'}],
+ '_check': l_and(isstring, isintent_nothide),
+ '_optional': ''
+ },
+ # Array ...
+ {
+ 'decl': ' npy_intp #varname_i#_Dims[#rank#] = {#rank*[-1]#};',
+ 'setdims': ' #cbsetdims#;',
+ '_check': isarray,
+ '_depend': ''
+ },
+ {
+ 'pyobjfrom': [{debugcapi: ' fprintf(stderr,"debug-capi:cb:#varname#\\n");'},
+ {isintent_c: """\
+ if (cb->nofargs>capi_i) {
+ /* tmp_arr will be inserted to capi_arglist_list that will be
+ destroyed when leaving callback function wrapper together
+ with tmp_arr. */
+ PyArrayObject *tmp_arr = (PyArrayObject *)PyArray_New(&PyArray_Type,
+ #rank#,#varname_i#_Dims,#atype#,NULL,(char*)#varname_i#,#elsize#,
+ NPY_ARRAY_CARRAY,NULL);
+""",
+ l_not(isintent_c): """\
+ if (cb->nofargs>capi_i) {
+ /* tmp_arr will be inserted to capi_arglist_list that will be
+ destroyed when leaving callback function wrapper together
+ with tmp_arr. */
+ PyArrayObject *tmp_arr = (PyArrayObject *)PyArray_New(&PyArray_Type,
+ #rank#,#varname_i#_Dims,#atype#,NULL,(char*)#varname_i#,#elsize#,
+ NPY_ARRAY_FARRAY,NULL);
+""",
+ },
+ """
+ if (tmp_arr==NULL)
+ goto capi_fail;
+ if (CAPI_ARGLIST_SETITEM(capi_i++,(PyObject *)tmp_arr))
+ goto capi_fail;
+}"""],
+ '_check': l_and(isarray, isintent_nothide, l_or(isintent_in, isintent_inout)),
+ '_optional': '',
+ }, {
+ 'frompyobj': [{debugcapi: ' CFUNCSMESS("cb:Getting #varname#->");'},
+ """ if (capi_j>capi_i) {
+ PyArrayObject *rv_cb_arr = NULL;
+ if ((capi_tmp = PyTuple_GetItem(capi_return,capi_i++))==NULL) goto capi_fail;
+ rv_cb_arr = array_from_pyobj(#atype#,#varname_i#_Dims,#rank#,F2PY_INTENT_IN""",
+ {isintent_c: '|F2PY_INTENT_C'},
+ """,capi_tmp);
+ if (rv_cb_arr == NULL) {
+ fprintf(stderr,\"rv_cb_arr is NULL\\n\");
+ goto capi_fail;
+ }
+ MEMCOPY(#varname_i#,PyArray_DATA(rv_cb_arr),PyArray_NBYTES(rv_cb_arr));
+ if (capi_tmp != (PyObject *)rv_cb_arr) {
+ Py_DECREF(rv_cb_arr);
+ }
+ }""",
+ {debugcapi: ' fprintf(stderr,"<-.\\n");'},
+ ],
+ 'need': ['MEMCOPY', {iscomplexarray: '#ctype#'}],
+ '_check': l_and(isarray, isintent_out)
+ }, {
+ 'docreturn': '#varname#,',
+ '_check': isintent_out
+ }
+]
+
+################## Build call-back module #############
+cb_map = {}
+
+
+def buildcallbacks(m):
+ cb_map[m['name']] = []
+ for bi in m['body']:
+ if bi['block'] == 'interface':
+ for b in bi['body']:
+ if b:
+ buildcallback(b, m['name'])
+ else:
+ errmess('warning: empty body for %s\n' % (m['name']))
+
+
+def buildcallback(rout, um):
+ from . import capi_maps
+
+ outmess(' Constructing call-back function "cb_%s_in_%s"\n' %
+ (rout['name'], um))
+ args, depargs = getargs(rout)
+ capi_maps.depargs = depargs
+ var = rout['vars']
+ vrd = capi_maps.cb_routsign2map(rout, um)
+ rd = dictappend({}, vrd)
+ cb_map[um].append([rout['name'], rd['name']])
+ for r in cb_rout_rules:
+ if ('_check' in r and r['_check'](rout)) or ('_check' not in r):
+ ar = applyrules(r, vrd, rout)
+ rd = dictappend(rd, ar)
+ savevrd = {}
+ for i, a in enumerate(args):
+ vrd = capi_maps.cb_sign2map(a, var[a], index=i)
+ savevrd[a] = vrd
+ for r in cb_arg_rules:
+ if '_depend' in r:
+ continue
+ if '_optional' in r and isoptional(var[a]):
+ continue
+ if ('_check' in r and r['_check'](var[a])) or ('_check' not in r):
+ ar = applyrules(r, vrd, var[a])
+ rd = dictappend(rd, ar)
+ if '_break' in r:
+ break
+ for a in args:
+ vrd = savevrd[a]
+ for r in cb_arg_rules:
+ if '_depend' in r:
+ continue
+ if ('_optional' not in r) or ('_optional' in r and isrequired(var[a])):
+ continue
+ if ('_check' in r and r['_check'](var[a])) or ('_check' not in r):
+ ar = applyrules(r, vrd, var[a])
+ rd = dictappend(rd, ar)
+ if '_break' in r:
+ break
+ for a in depargs:
+ vrd = savevrd[a]
+ for r in cb_arg_rules:
+ if '_depend' not in r:
+ continue
+ if '_optional' in r:
+ continue
+ if ('_check' in r and r['_check'](var[a])) or ('_check' not in r):
+ ar = applyrules(r, vrd, var[a])
+ rd = dictappend(rd, ar)
+ if '_break' in r:
+ break
+ if 'args' in rd and 'optargs' in rd:
+ if isinstance(rd['optargs'], list):
+ rd['optargs'] = rd['optargs'] + ["""
+#ifndef F2PY_CB_RETURNCOMPLEX
+,
+#endif
+"""]
+ rd['optargs_nm'] = rd['optargs_nm'] + ["""
+#ifndef F2PY_CB_RETURNCOMPLEX
+,
+#endif
+"""]
+ rd['optargs_td'] = rd['optargs_td'] + ["""
+#ifndef F2PY_CB_RETURNCOMPLEX
+,
+#endif
+"""]
+ if isinstance(rd['docreturn'], list):
+ rd['docreturn'] = stripcomma(
+ replace('#docreturn#', {'docreturn': rd['docreturn']}))
+ optargs = stripcomma(replace('#docsignopt#',
+ {'docsignopt': rd['docsignopt']}
+ ))
+ if optargs == '':
+ rd['docsignature'] = stripcomma(
+ replace('#docsign#', {'docsign': rd['docsign']}))
+ else:
+ rd['docsignature'] = replace('#docsign#[#docsignopt#]',
+ {'docsign': rd['docsign'],
+ 'docsignopt': optargs,
+ })
+ rd['latexdocsignature'] = rd['docsignature'].replace('_', '\\_')
+ rd['latexdocsignature'] = rd['latexdocsignature'].replace(',', ', ')
+ rd['docstrsigns'] = []
+ rd['latexdocstrsigns'] = []
+ for k in ['docstrreq', 'docstropt', 'docstrout', 'docstrcbs']:
+ if k in rd and isinstance(rd[k], list):
+ rd['docstrsigns'] = rd['docstrsigns'] + rd[k]
+ k = 'latex' + k
+ if k in rd and isinstance(rd[k], list):
+ rd['latexdocstrsigns'] = rd['latexdocstrsigns'] + rd[k][0:1] +\
+ ['\\begin{description}'] + rd[k][1:] +\
+ ['\\end{description}']
+ if 'args' not in rd:
+ rd['args'] = ''
+ rd['args_td'] = ''
+ rd['args_nm'] = ''
+ if not (rd.get('args') or rd.get('optargs') or rd.get('strarglens')):
+ rd['noargs'] = 'void'
+
+ ar = applyrules(cb_routine_rules, rd)
+ cfuncs.callbacks[rd['name']] = ar['body']
+ if isinstance(ar['need'], str):
+ ar['need'] = [ar['need']]
+
+ if 'need' in rd:
+ for t in cfuncs.typedefs.keys():
+ if t in rd['need']:
+ ar['need'].append(t)
+
+ cfuncs.typedefs_generated[rd['name'] + '_typedef'] = ar['cbtypedefs']
+ ar['need'].append(rd['name'] + '_typedef')
+ cfuncs.needs[rd['name']] = ar['need']
+
+ capi_maps.lcb2_map[rd['name']] = {'maxnofargs': ar['maxnofargs'],
+ 'nofoptargs': ar['nofoptargs'],
+ 'docstr': ar['docstr'],
+ 'latexdocstr': ar['latexdocstr'],
+ 'argname': rd['argname']
+ }
+ outmess(' %s\n' % (ar['docstrshort']))
+ return
+################## Build call-back function #############
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/f2py/cfuncs.py b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/f2py/cfuncs.py
new file mode 100644
index 0000000000000000000000000000000000000000..4328a6e5004c2b73e693b72a1ab9db8d924567ff
--- /dev/null
+++ b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/f2py/cfuncs.py
@@ -0,0 +1,1536 @@
+#!/usr/bin/env python3
+"""
+C declarations, CPP macros, and C functions for f2py2e.
+Only required declarations/macros/functions will be used.
+
+Copyright 1999 -- 2011 Pearu Peterson all rights reserved.
+Copyright 2011 -- present NumPy Developers.
+Permission to use, modify, and distribute this software is given under the
+terms of the NumPy License.
+
+NO WARRANTY IS EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
+"""
+import sys
+import copy
+
+from . import __version__
+
+f2py_version = __version__.version
+errmess = sys.stderr.write
+
+##################### Definitions ##################
+
+outneeds = {'includes0': [], 'includes': [], 'typedefs': [], 'typedefs_generated': [],
+ 'userincludes': [],
+ 'cppmacros': [], 'cfuncs': [], 'callbacks': [], 'f90modhooks': [],
+ 'commonhooks': []}
+needs = {}
+includes0 = {'includes0': '/*need_includes0*/'}
+includes = {'includes': '/*need_includes*/'}
+userincludes = {'userincludes': '/*need_userincludes*/'}
+typedefs = {'typedefs': '/*need_typedefs*/'}
+typedefs_generated = {'typedefs_generated': '/*need_typedefs_generated*/'}
+cppmacros = {'cppmacros': '/*need_cppmacros*/'}
+cfuncs = {'cfuncs': '/*need_cfuncs*/'}
+callbacks = {'callbacks': '/*need_callbacks*/'}
+f90modhooks = {'f90modhooks': '/*need_f90modhooks*/',
+ 'initf90modhooksstatic': '/*initf90modhooksstatic*/',
+ 'initf90modhooksdynamic': '/*initf90modhooksdynamic*/',
+ }
+commonhooks = {'commonhooks': '/*need_commonhooks*/',
+ 'initcommonhooks': '/*need_initcommonhooks*/',
+ }
+
+############ Includes ###################
+
+includes0['math.h'] = '#include '
+includes0['string.h'] = '#include '
+includes0['setjmp.h'] = '#include '
+
+includes['arrayobject.h'] = '''#define PY_ARRAY_UNIQUE_SYMBOL PyArray_API
+#include "arrayobject.h"'''
+includes['npy_math.h'] = '#include "numpy/npy_math.h"'
+
+includes['arrayobject.h'] = '#include "fortranobject.h"'
+includes['stdarg.h'] = '#include '
+
+############# Type definitions ###############
+
+typedefs['unsigned_char'] = 'typedef unsigned char unsigned_char;'
+typedefs['unsigned_short'] = 'typedef unsigned short unsigned_short;'
+typedefs['unsigned_long'] = 'typedef unsigned long unsigned_long;'
+typedefs['signed_char'] = 'typedef signed char signed_char;'
+typedefs['long_long'] = """
+#if defined(NPY_OS_WIN32)
+typedef __int64 long_long;
+#else
+typedef long long long_long;
+typedef unsigned long long unsigned_long_long;
+#endif
+"""
+typedefs['unsigned_long_long'] = """
+#if defined(NPY_OS_WIN32)
+typedef __uint64 long_long;
+#else
+typedef unsigned long long unsigned_long_long;
+#endif
+"""
+typedefs['long_double'] = """
+#ifndef _LONG_DOUBLE
+typedef long double long_double;
+#endif
+"""
+typedefs[
+ 'complex_long_double'] = 'typedef struct {long double r,i;} complex_long_double;'
+typedefs['complex_float'] = 'typedef struct {float r,i;} complex_float;'
+typedefs['complex_double'] = 'typedef struct {double r,i;} complex_double;'
+typedefs['string'] = """typedef char * string;"""
+typedefs['character'] = """typedef char character;"""
+
+
+############### CPP macros ####################
+cppmacros['CFUNCSMESS'] = """
+#ifdef DEBUGCFUNCS
+#define CFUNCSMESS(mess) fprintf(stderr,\"debug-capi:\"mess);
+#define CFUNCSMESSPY(mess,obj) CFUNCSMESS(mess) \\
+ PyObject_Print((PyObject *)obj,stderr,Py_PRINT_RAW);\\
+ fprintf(stderr,\"\\n\");
+#else
+#define CFUNCSMESS(mess)
+#define CFUNCSMESSPY(mess,obj)
+#endif
+"""
+cppmacros['F_FUNC'] = """
+#if defined(PREPEND_FORTRAN)
+#if defined(NO_APPEND_FORTRAN)
+#if defined(UPPERCASE_FORTRAN)
+#define F_FUNC(f,F) _##F
+#else
+#define F_FUNC(f,F) _##f
+#endif
+#else
+#if defined(UPPERCASE_FORTRAN)
+#define F_FUNC(f,F) _##F##_
+#else
+#define F_FUNC(f,F) _##f##_
+#endif
+#endif
+#else
+#if defined(NO_APPEND_FORTRAN)
+#if defined(UPPERCASE_FORTRAN)
+#define F_FUNC(f,F) F
+#else
+#define F_FUNC(f,F) f
+#endif
+#else
+#if defined(UPPERCASE_FORTRAN)
+#define F_FUNC(f,F) F##_
+#else
+#define F_FUNC(f,F) f##_
+#endif
+#endif
+#endif
+#if defined(UNDERSCORE_G77)
+#define F_FUNC_US(f,F) F_FUNC(f##_,F##_)
+#else
+#define F_FUNC_US(f,F) F_FUNC(f,F)
+#endif
+"""
+cppmacros['F_WRAPPEDFUNC'] = """
+#if defined(PREPEND_FORTRAN)
+#if defined(NO_APPEND_FORTRAN)
+#if defined(UPPERCASE_FORTRAN)
+#define F_WRAPPEDFUNC(f,F) _F2PYWRAP##F
+#else
+#define F_WRAPPEDFUNC(f,F) _f2pywrap##f
+#endif
+#else
+#if defined(UPPERCASE_FORTRAN)
+#define F_WRAPPEDFUNC(f,F) _F2PYWRAP##F##_
+#else
+#define F_WRAPPEDFUNC(f,F) _f2pywrap##f##_
+#endif
+#endif
+#else
+#if defined(NO_APPEND_FORTRAN)
+#if defined(UPPERCASE_FORTRAN)
+#define F_WRAPPEDFUNC(f,F) F2PYWRAP##F
+#else
+#define F_WRAPPEDFUNC(f,F) f2pywrap##f
+#endif
+#else
+#if defined(UPPERCASE_FORTRAN)
+#define F_WRAPPEDFUNC(f,F) F2PYWRAP##F##_
+#else
+#define F_WRAPPEDFUNC(f,F) f2pywrap##f##_
+#endif
+#endif
+#endif
+#if defined(UNDERSCORE_G77)
+#define F_WRAPPEDFUNC_US(f,F) F_WRAPPEDFUNC(f##_,F##_)
+#else
+#define F_WRAPPEDFUNC_US(f,F) F_WRAPPEDFUNC(f,F)
+#endif
+"""
+cppmacros['F_MODFUNC'] = """
+#if defined(F90MOD2CCONV1) /*E.g. Compaq Fortran */
+#if defined(NO_APPEND_FORTRAN)
+#define F_MODFUNCNAME(m,f) $ ## m ## $ ## f
+#else
+#define F_MODFUNCNAME(m,f) $ ## m ## $ ## f ## _
+#endif
+#endif
+
+#if defined(F90MOD2CCONV2) /*E.g. IBM XL Fortran, not tested though */
+#if defined(NO_APPEND_FORTRAN)
+#define F_MODFUNCNAME(m,f) __ ## m ## _MOD_ ## f
+#else
+#define F_MODFUNCNAME(m,f) __ ## m ## _MOD_ ## f ## _
+#endif
+#endif
+
+#if defined(F90MOD2CCONV3) /*E.g. MIPSPro Compilers */
+#if defined(NO_APPEND_FORTRAN)
+#define F_MODFUNCNAME(m,f) f ## .in. ## m
+#else
+#define F_MODFUNCNAME(m,f) f ## .in. ## m ## _
+#endif
+#endif
+/*
+#if defined(UPPERCASE_FORTRAN)
+#define F_MODFUNC(m,M,f,F) F_MODFUNCNAME(M,F)
+#else
+#define F_MODFUNC(m,M,f,F) F_MODFUNCNAME(m,f)
+#endif
+*/
+
+#define F_MODFUNC(m,f) (*(f2pymodstruct##m##.##f))
+"""
+cppmacros['SWAPUNSAFE'] = """
+#define SWAP(a,b) (size_t)(a) = ((size_t)(a) ^ (size_t)(b));\\
+ (size_t)(b) = ((size_t)(a) ^ (size_t)(b));\\
+ (size_t)(a) = ((size_t)(a) ^ (size_t)(b))
+"""
+cppmacros['SWAP'] = """
+#define SWAP(a,b,t) {\\
+ t *c;\\
+ c = a;\\
+ a = b;\\
+ b = c;}
+"""
+# cppmacros['ISCONTIGUOUS']='#define ISCONTIGUOUS(m) (PyArray_FLAGS(m) &
+# NPY_ARRAY_C_CONTIGUOUS)'
+cppmacros['PRINTPYOBJERR'] = """
+#define PRINTPYOBJERR(obj)\\
+ fprintf(stderr,\"#modulename#.error is related to \");\\
+ PyObject_Print((PyObject *)obj,stderr,Py_PRINT_RAW);\\
+ fprintf(stderr,\"\\n\");
+"""
+cppmacros['MINMAX'] = """
+#ifndef max
+#define max(a,b) ((a > b) ? (a) : (b))
+#endif
+#ifndef min
+#define min(a,b) ((a < b) ? (a) : (b))
+#endif
+#ifndef MAX
+#define MAX(a,b) ((a > b) ? (a) : (b))
+#endif
+#ifndef MIN
+#define MIN(a,b) ((a < b) ? (a) : (b))
+#endif
+"""
+cppmacros['len..'] = """
+/* See fortranobject.h for definitions. The macros here are provided for BC. */
+#define rank f2py_rank
+#define shape f2py_shape
+#define fshape f2py_shape
+#define len f2py_len
+#define flen f2py_flen
+#define slen f2py_slen
+#define size f2py_size
+"""
+cppmacros['pyobj_from_char1'] = r"""
+#define pyobj_from_char1(v) (PyLong_FromLong(v))
+"""
+cppmacros['pyobj_from_short1'] = r"""
+#define pyobj_from_short1(v) (PyLong_FromLong(v))
+"""
+needs['pyobj_from_int1'] = ['signed_char']
+cppmacros['pyobj_from_int1'] = r"""
+#define pyobj_from_int1(v) (PyLong_FromLong(v))
+"""
+cppmacros['pyobj_from_long1'] = r"""
+#define pyobj_from_long1(v) (PyLong_FromLong(v))
+"""
+needs['pyobj_from_long_long1'] = ['long_long']
+cppmacros['pyobj_from_long_long1'] = """
+#ifdef HAVE_LONG_LONG
+#define pyobj_from_long_long1(v) (PyLong_FromLongLong(v))
+#else
+#warning HAVE_LONG_LONG is not available. Redefining pyobj_from_long_long.
+#define pyobj_from_long_long1(v) (PyLong_FromLong(v))
+#endif
+"""
+needs['pyobj_from_long_double1'] = ['long_double']
+cppmacros['pyobj_from_long_double1'] = """
+#define pyobj_from_long_double1(v) (PyFloat_FromDouble(v))"""
+cppmacros['pyobj_from_double1'] = """
+#define pyobj_from_double1(v) (PyFloat_FromDouble(v))"""
+cppmacros['pyobj_from_float1'] = """
+#define pyobj_from_float1(v) (PyFloat_FromDouble(v))"""
+needs['pyobj_from_complex_long_double1'] = ['complex_long_double']
+cppmacros['pyobj_from_complex_long_double1'] = """
+#define pyobj_from_complex_long_double1(v) (PyComplex_FromDoubles(v.r,v.i))"""
+needs['pyobj_from_complex_double1'] = ['complex_double']
+cppmacros['pyobj_from_complex_double1'] = """
+#define pyobj_from_complex_double1(v) (PyComplex_FromDoubles(v.r,v.i))"""
+needs['pyobj_from_complex_float1'] = ['complex_float']
+cppmacros['pyobj_from_complex_float1'] = """
+#define pyobj_from_complex_float1(v) (PyComplex_FromDoubles(v.r,v.i))"""
+needs['pyobj_from_string1'] = ['string']
+cppmacros['pyobj_from_string1'] = """
+#define pyobj_from_string1(v) (PyUnicode_FromString((char *)v))"""
+needs['pyobj_from_string1size'] = ['string']
+cppmacros['pyobj_from_string1size'] = """
+#define pyobj_from_string1size(v,len) (PyUnicode_FromStringAndSize((char *)v, len))"""
+needs['TRYPYARRAYTEMPLATE'] = ['PRINTPYOBJERR']
+cppmacros['TRYPYARRAYTEMPLATE'] = """
+/* New SciPy */
+#define TRYPYARRAYTEMPLATECHAR case NPY_STRING: *(char *)(PyArray_DATA(arr))=*v; break;
+#define TRYPYARRAYTEMPLATELONG case NPY_LONG: *(long *)(PyArray_DATA(arr))=*v; break;
+#define TRYPYARRAYTEMPLATEOBJECT case NPY_OBJECT: PyArray_SETITEM(arr,PyArray_DATA(arr),pyobj_from_ ## ctype ## 1(*v)); break;
+
+#define TRYPYARRAYTEMPLATE(ctype,typecode) \\
+ PyArrayObject *arr = NULL;\\
+ if (!obj) return -2;\\
+ if (!PyArray_Check(obj)) return -1;\\
+ if (!(arr=(PyArrayObject *)obj)) {fprintf(stderr,\"TRYPYARRAYTEMPLATE:\");PRINTPYOBJERR(obj);return 0;}\\
+ if (PyArray_DESCR(arr)->type==typecode) {*(ctype *)(PyArray_DATA(arr))=*v; return 1;}\\
+ switch (PyArray_TYPE(arr)) {\\
+ case NPY_DOUBLE: *(npy_double *)(PyArray_DATA(arr))=*v; break;\\
+ case NPY_INT: *(npy_int *)(PyArray_DATA(arr))=*v; break;\\
+ case NPY_LONG: *(npy_long *)(PyArray_DATA(arr))=*v; break;\\
+ case NPY_FLOAT: *(npy_float *)(PyArray_DATA(arr))=*v; break;\\
+ case NPY_CDOUBLE: *(npy_double *)(PyArray_DATA(arr))=*v; break;\\
+ case NPY_CFLOAT: *(npy_float *)(PyArray_DATA(arr))=*v; break;\\
+ case NPY_BOOL: *(npy_bool *)(PyArray_DATA(arr))=(*v!=0); break;\\
+ case NPY_UBYTE: *(npy_ubyte *)(PyArray_DATA(arr))=*v; break;\\
+ case NPY_BYTE: *(npy_byte *)(PyArray_DATA(arr))=*v; break;\\
+ case NPY_SHORT: *(npy_short *)(PyArray_DATA(arr))=*v; break;\\
+ case NPY_USHORT: *(npy_ushort *)(PyArray_DATA(arr))=*v; break;\\
+ case NPY_UINT: *(npy_uint *)(PyArray_DATA(arr))=*v; break;\\
+ case NPY_ULONG: *(npy_ulong *)(PyArray_DATA(arr))=*v; break;\\
+ case NPY_LONGLONG: *(npy_longlong *)(PyArray_DATA(arr))=*v; break;\\
+ case NPY_ULONGLONG: *(npy_ulonglong *)(PyArray_DATA(arr))=*v; break;\\
+ case NPY_LONGDOUBLE: *(npy_longdouble *)(PyArray_DATA(arr))=*v; break;\\
+ case NPY_CLONGDOUBLE: *(npy_longdouble *)(PyArray_DATA(arr))=*v; break;\\
+ case NPY_OBJECT: PyArray_SETITEM(arr, PyArray_DATA(arr), pyobj_from_ ## ctype ## 1(*v)); break;\\
+ default: return -2;\\
+ };\\
+ return 1
+"""
+
+needs['TRYCOMPLEXPYARRAYTEMPLATE'] = ['PRINTPYOBJERR']
+cppmacros['TRYCOMPLEXPYARRAYTEMPLATE'] = """
+#define TRYCOMPLEXPYARRAYTEMPLATEOBJECT case NPY_OBJECT: PyArray_SETITEM(arr, PyArray_DATA(arr), pyobj_from_complex_ ## ctype ## 1((*v))); break;
+#define TRYCOMPLEXPYARRAYTEMPLATE(ctype,typecode)\\
+ PyArrayObject *arr = NULL;\\
+ if (!obj) return -2;\\
+ if (!PyArray_Check(obj)) return -1;\\
+ if (!(arr=(PyArrayObject *)obj)) {fprintf(stderr,\"TRYCOMPLEXPYARRAYTEMPLATE:\");PRINTPYOBJERR(obj);return 0;}\\
+ if (PyArray_DESCR(arr)->type==typecode) {\\
+ *(ctype *)(PyArray_DATA(arr))=(*v).r;\\
+ *(ctype *)(PyArray_DATA(arr)+sizeof(ctype))=(*v).i;\\
+ return 1;\\
+ }\\
+ switch (PyArray_TYPE(arr)) {\\
+ case NPY_CDOUBLE: *(npy_double *)(PyArray_DATA(arr))=(*v).r;\\
+ *(npy_double *)(PyArray_DATA(arr)+sizeof(npy_double))=(*v).i;\\
+ break;\\
+ case NPY_CFLOAT: *(npy_float *)(PyArray_DATA(arr))=(*v).r;\\
+ *(npy_float *)(PyArray_DATA(arr)+sizeof(npy_float))=(*v).i;\\
+ break;\\
+ case NPY_DOUBLE: *(npy_double *)(PyArray_DATA(arr))=(*v).r; break;\\
+ case NPY_LONG: *(npy_long *)(PyArray_DATA(arr))=(*v).r; break;\\
+ case NPY_FLOAT: *(npy_float *)(PyArray_DATA(arr))=(*v).r; break;\\
+ case NPY_INT: *(npy_int *)(PyArray_DATA(arr))=(*v).r; break;\\
+ case NPY_SHORT: *(npy_short *)(PyArray_DATA(arr))=(*v).r; break;\\
+ case NPY_UBYTE: *(npy_ubyte *)(PyArray_DATA(arr))=(*v).r; break;\\
+ case NPY_BYTE: *(npy_byte *)(PyArray_DATA(arr))=(*v).r; break;\\
+ case NPY_BOOL: *(npy_bool *)(PyArray_DATA(arr))=((*v).r!=0 && (*v).i!=0); break;\\
+ case NPY_USHORT: *(npy_ushort *)(PyArray_DATA(arr))=(*v).r; break;\\
+ case NPY_UINT: *(npy_uint *)(PyArray_DATA(arr))=(*v).r; break;\\
+ case NPY_ULONG: *(npy_ulong *)(PyArray_DATA(arr))=(*v).r; break;\\
+ case NPY_LONGLONG: *(npy_longlong *)(PyArray_DATA(arr))=(*v).r; break;\\
+ case NPY_ULONGLONG: *(npy_ulonglong *)(PyArray_DATA(arr))=(*v).r; break;\\
+ case NPY_LONGDOUBLE: *(npy_longdouble *)(PyArray_DATA(arr))=(*v).r; break;\\
+ case NPY_CLONGDOUBLE: *(npy_longdouble *)(PyArray_DATA(arr))=(*v).r;\\
+ *(npy_longdouble *)(PyArray_DATA(arr)+sizeof(npy_longdouble))=(*v).i;\\
+ break;\\
+ case NPY_OBJECT: PyArray_SETITEM(arr, PyArray_DATA(arr), pyobj_from_complex_ ## ctype ## 1((*v))); break;\\
+ default: return -2;\\
+ };\\
+ return -1;
+"""
+# cppmacros['NUMFROMARROBJ']="""
+# define NUMFROMARROBJ(typenum,ctype) \\
+# if (PyArray_Check(obj)) arr = (PyArrayObject *)obj;\\
+# else arr = (PyArrayObject *)PyArray_ContiguousFromObject(obj,typenum,0,0);\\
+# if (arr) {\\
+# if (PyArray_TYPE(arr)==NPY_OBJECT) {\\
+# if (!ctype ## _from_pyobj(v,(PyArray_DESCR(arr)->getitem)(PyArray_DATA(arr)),\"\"))\\
+# goto capi_fail;\\
+# } else {\\
+# (PyArray_DESCR(arr)->cast[typenum])(PyArray_DATA(arr),1,(char*)v,1,1);\\
+# }\\
+# if ((PyObject *)arr != obj) { Py_DECREF(arr); }\\
+# return 1;\\
+# }
+# """
+# XXX: Note that CNUMFROMARROBJ is identical with NUMFROMARROBJ
+# cppmacros['CNUMFROMARROBJ']="""
+# define CNUMFROMARROBJ(typenum,ctype) \\
+# if (PyArray_Check(obj)) arr = (PyArrayObject *)obj;\\
+# else arr = (PyArrayObject *)PyArray_ContiguousFromObject(obj,typenum,0,0);\\
+# if (arr) {\\
+# if (PyArray_TYPE(arr)==NPY_OBJECT) {\\
+# if (!ctype ## _from_pyobj(v,(PyArray_DESCR(arr)->getitem)(PyArray_DATA(arr)),\"\"))\\
+# goto capi_fail;\\
+# } else {\\
+# (PyArray_DESCR(arr)->cast[typenum])((void *)(PyArray_DATA(arr)),1,(void *)(v),1,1);\\
+# }\\
+# if ((PyObject *)arr != obj) { Py_DECREF(arr); }\\
+# return 1;\\
+# }
+# """
+
+
+needs['GETSTRFROMPYTUPLE'] = ['STRINGCOPYN', 'PRINTPYOBJERR']
+cppmacros['GETSTRFROMPYTUPLE'] = """
+#define GETSTRFROMPYTUPLE(tuple,index,str,len) {\\
+ PyObject *rv_cb_str = PyTuple_GetItem((tuple),(index));\\
+ if (rv_cb_str == NULL)\\
+ goto capi_fail;\\
+ if (PyBytes_Check(rv_cb_str)) {\\
+ str[len-1]='\\0';\\
+ STRINGCOPYN((str),PyBytes_AS_STRING((PyBytesObject*)rv_cb_str),(len));\\
+ } else {\\
+ PRINTPYOBJERR(rv_cb_str);\\
+ PyErr_SetString(#modulename#_error,\"string object expected\");\\
+ goto capi_fail;\\
+ }\\
+ }
+"""
+cppmacros['GETSCALARFROMPYTUPLE'] = """
+#define GETSCALARFROMPYTUPLE(tuple,index,var,ctype,mess) {\\
+ if ((capi_tmp = PyTuple_GetItem((tuple),(index)))==NULL) goto capi_fail;\\
+ if (!(ctype ## _from_pyobj((var),capi_tmp,mess)))\\
+ goto capi_fail;\\
+ }
+"""
+
+cppmacros['FAILNULL'] = """\
+#define FAILNULL(p) do { \\
+ if ((p) == NULL) { \\
+ PyErr_SetString(PyExc_MemoryError, "NULL pointer found"); \\
+ goto capi_fail; \\
+ } \\
+} while (0)
+"""
+needs['MEMCOPY'] = ['string.h', 'FAILNULL']
+cppmacros['MEMCOPY'] = """
+#define MEMCOPY(to,from,n)\\
+ do { FAILNULL(to); FAILNULL(from); (void)memcpy(to,from,n); } while (0)
+"""
+cppmacros['STRINGMALLOC'] = """
+#define STRINGMALLOC(str,len)\\
+ if ((str = (string)malloc(len+1)) == NULL) {\\
+ PyErr_SetString(PyExc_MemoryError, \"out of memory\");\\
+ goto capi_fail;\\
+ } else {\\
+ (str)[len] = '\\0';\\
+ }
+"""
+cppmacros['STRINGFREE'] = """
+#define STRINGFREE(str) do {if (!(str == NULL)) free(str);} while (0)
+"""
+needs['STRINGPADN'] = ['string.h']
+cppmacros['STRINGPADN'] = """
+/*
+STRINGPADN replaces null values with padding values from the right.
+
+`to` must have size of at least N bytes.
+
+If the `to[N-1]` has null value, then replace it and all the
+preceding, nulls with the given padding.
+
+STRINGPADN(to, N, PADDING, NULLVALUE) is an inverse operation.
+*/
+#define STRINGPADN(to, N, NULLVALUE, PADDING) \\
+ do { \\
+ int _m = (N); \\
+ char *_to = (to); \\
+ for (_m -= 1; _m >= 0 && _to[_m] == NULLVALUE; _m--) { \\
+ _to[_m] = PADDING; \\
+ } \\
+ } while (0)
+"""
+needs['STRINGCOPYN'] = ['string.h', 'FAILNULL']
+cppmacros['STRINGCOPYN'] = """
+/*
+STRINGCOPYN copies N bytes.
+
+`to` and `from` buffers must have sizes of at least N bytes.
+*/
+#define STRINGCOPYN(to,from,N) \\
+ do { \\
+ int _m = (N); \\
+ char *_to = (to); \\
+ char *_from = (from); \\
+ FAILNULL(_to); FAILNULL(_from); \\
+ (void)strncpy(_to, _from, _m); \\
+ } while (0)
+"""
+needs['STRINGCOPY'] = ['string.h', 'FAILNULL']
+cppmacros['STRINGCOPY'] = """
+#define STRINGCOPY(to,from)\\
+ do { FAILNULL(to); FAILNULL(from); (void)strcpy(to,from); } while (0)
+"""
+cppmacros['CHECKGENERIC'] = """
+#define CHECKGENERIC(check,tcheck,name) \\
+ if (!(check)) {\\
+ PyErr_SetString(#modulename#_error,\"(\"tcheck\") failed for \"name);\\
+ /*goto capi_fail;*/\\
+ } else """
+cppmacros['CHECKARRAY'] = """
+#define CHECKARRAY(check,tcheck,name) \\
+ if (!(check)) {\\
+ PyErr_SetString(#modulename#_error,\"(\"tcheck\") failed for \"name);\\
+ /*goto capi_fail;*/\\
+ } else """
+cppmacros['CHECKSTRING'] = """
+#define CHECKSTRING(check,tcheck,name,show,var)\\
+ if (!(check)) {\\
+ char errstring[256];\\
+ sprintf(errstring, \"%s: \"show, \"(\"tcheck\") failed for \"name, slen(var), var);\\
+ PyErr_SetString(#modulename#_error, errstring);\\
+ /*goto capi_fail;*/\\
+ } else """
+cppmacros['CHECKSCALAR'] = """
+#define CHECKSCALAR(check,tcheck,name,show,var)\\
+ if (!(check)) {\\
+ char errstring[256];\\
+ sprintf(errstring, \"%s: \"show, \"(\"tcheck\") failed for \"name, var);\\
+ PyErr_SetString(#modulename#_error,errstring);\\
+ /*goto capi_fail;*/\\
+ } else """
+# cppmacros['CHECKDIMS']="""
+# define CHECKDIMS(dims,rank) \\
+# for (int i=0;i<(rank);i++)\\
+# if (dims[i]<0) {\\
+# fprintf(stderr,\"Unspecified array argument requires a complete dimension specification.\\n\");\\
+# goto capi_fail;\\
+# }
+# """
+cppmacros[
+ 'ARRSIZE'] = '#define ARRSIZE(dims,rank) (_PyArray_multiply_list(dims,rank))'
+cppmacros['OLDPYNUM'] = """
+#ifdef OLDPYNUM
+#error You need to install NumPy version 0.13 or higher. See https://scipy.org/install.html
+#endif
+"""
+cppmacros["F2PY_THREAD_LOCAL_DECL"] = """
+#ifndef F2PY_THREAD_LOCAL_DECL
+#if defined(_MSC_VER)
+#define F2PY_THREAD_LOCAL_DECL __declspec(thread)
+#elif defined(NPY_OS_MINGW)
+#define F2PY_THREAD_LOCAL_DECL __thread
+#elif defined(__STDC_VERSION__) \\
+ && (__STDC_VERSION__ >= 201112L) \\
+ && !defined(__STDC_NO_THREADS__) \\
+ && (!defined(__GLIBC__) || __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 12)) \\
+ && !defined(NPY_OS_OPENBSD) && !defined(NPY_OS_HAIKU)
+/* __STDC_NO_THREADS__ was first defined in a maintenance release of glibc 2.12,
+ see https://lists.gnu.org/archive/html/commit-hurd/2012-07/msg00180.html,
+ so `!defined(__STDC_NO_THREADS__)` may give false positive for the existence
+ of `threads.h` when using an older release of glibc 2.12
+ See gh-19437 for details on OpenBSD */
+#include
+#define F2PY_THREAD_LOCAL_DECL thread_local
+#elif defined(__GNUC__) \\
+ && (__GNUC__ > 4 || (__GNUC__ == 4 && (__GNUC_MINOR__ >= 4)))
+#define F2PY_THREAD_LOCAL_DECL __thread
+#endif
+#endif
+"""
+################# C functions ###############
+
+cfuncs['calcarrindex'] = """
+static int calcarrindex(int *i,PyArrayObject *arr) {
+ int k,ii = i[0];
+ for (k=1; k < PyArray_NDIM(arr); k++)
+ ii += (ii*(PyArray_DIM(arr,k) - 1)+i[k]); /* assuming contiguous arr */
+ return ii;
+}"""
+cfuncs['calcarrindextr'] = """
+static int calcarrindextr(int *i,PyArrayObject *arr) {
+ int k,ii = i[PyArray_NDIM(arr)-1];
+ for (k=1; k < PyArray_NDIM(arr); k++)
+ ii += (ii*(PyArray_DIM(arr,PyArray_NDIM(arr)-k-1) - 1)+i[PyArray_NDIM(arr)-k-1]); /* assuming contiguous arr */
+ return ii;
+}"""
+cfuncs['forcomb'] = """
+static struct { int nd;npy_intp *d;int *i,*i_tr,tr; } forcombcache;
+static int initforcomb(npy_intp *dims,int nd,int tr) {
+ int k;
+ if (dims==NULL) return 0;
+ if (nd<0) return 0;
+ forcombcache.nd = nd;
+ forcombcache.d = dims;
+ forcombcache.tr = tr;
+ if ((forcombcache.i = (int *)malloc(sizeof(int)*nd))==NULL) return 0;
+ if ((forcombcache.i_tr = (int *)malloc(sizeof(int)*nd))==NULL) return 0;
+ for (k=1;k PyArray_NBYTES(arr)) {
+ n = PyArray_NBYTES(arr);
+ }
+ STRINGCOPYN(buf, str, n);
+ return 1;
+ }
+capi_fail:
+ PRINTPYOBJERR(obj);
+ PyErr_SetString(#modulename#_error, \"try_pyarr_from_string failed\");
+ return 0;
+}
+"""
+needs['string_from_pyobj'] = ['string', 'STRINGMALLOC', 'STRINGCOPYN']
+cfuncs['string_from_pyobj'] = """
+/*
+ Create a new string buffer `str` of at most length `len` from a
+ Python string-like object `obj`.
+
+ The string buffer has given size (len) or the size of inistr when len==-1.
+
+ The string buffer is padded with blanks: in Fortran, trailing blanks
+ are insignificant contrary to C nulls.
+ */
+static int
+string_from_pyobj(string *str, int *len, const string inistr, PyObject *obj,
+ const char *errmess)
+{
+ PyObject *tmp = NULL;
+ string buf = NULL;
+ npy_intp n = -1;
+#ifdef DEBUGCFUNCS
+fprintf(stderr,\"string_from_pyobj(str='%s',len=%d,inistr='%s',obj=%p)\\n\",
+ (char*)str, *len, (char *)inistr, obj);
+#endif
+ if (obj == Py_None) {
+ n = strlen(inistr);
+ buf = inistr;
+ }
+ else if (PyArray_Check(obj)) {
+ PyArrayObject *arr = (PyArrayObject *)obj;
+ if (!ISCONTIGUOUS(arr)) {
+ PyErr_SetString(PyExc_ValueError,
+ \"array object is non-contiguous.\");
+ goto capi_fail;
+ }
+ n = PyArray_NBYTES(arr);
+ buf = PyArray_DATA(arr);
+ n = strnlen(buf, n);
+ }
+ else {
+ if (PyBytes_Check(obj)) {
+ tmp = obj;
+ Py_INCREF(tmp);
+ }
+ else if (PyUnicode_Check(obj)) {
+ tmp = PyUnicode_AsASCIIString(obj);
+ }
+ else {
+ PyObject *tmp2;
+ tmp2 = PyObject_Str(obj);
+ if (tmp2) {
+ tmp = PyUnicode_AsASCIIString(tmp2);
+ Py_DECREF(tmp2);
+ }
+ else {
+ tmp = NULL;
+ }
+ }
+ if (tmp == NULL) goto capi_fail;
+ n = PyBytes_GET_SIZE(tmp);
+ buf = PyBytes_AS_STRING(tmp);
+ }
+ if (*len == -1) {
+ /* TODO: change the type of `len` so that we can remove this */
+ if (n > NPY_MAX_INT) {
+ PyErr_SetString(PyExc_OverflowError,
+ "object too large for a 32-bit int");
+ goto capi_fail;
+ }
+ *len = n;
+ }
+ else if (*len < n) {
+ /* discard the last (len-n) bytes of input buf */
+ n = *len;
+ }
+ if (n < 0 || *len < 0 || buf == NULL) {
+ goto capi_fail;
+ }
+ STRINGMALLOC(*str, *len); // *str is allocated with size (*len + 1)
+ if (n < *len) {
+ /*
+ Pad fixed-width string with nulls. The caller will replace
+ nulls with blanks when the corresponding argument is not
+ intent(c).
+ */
+ memset(*str + n, '\\0', *len - n);
+ }
+ STRINGCOPYN(*str, buf, n);
+ Py_XDECREF(tmp);
+ return 1;
+capi_fail:
+ Py_XDECREF(tmp);
+ {
+ PyObject* err = PyErr_Occurred();
+ if (err == NULL) {
+ err = #modulename#_error;
+ }
+ PyErr_SetString(err, errmess);
+ }
+ return 0;
+}
+"""
+
+cfuncs['character_from_pyobj'] = """
+static int
+character_from_pyobj(character* v, PyObject *obj, const char *errmess) {
+ if (PyBytes_Check(obj)) {
+ /* empty bytes has trailing null, so dereferencing is always safe */
+ *v = PyBytes_AS_STRING(obj)[0];
+ return 1;
+ } else if (PyUnicode_Check(obj)) {
+ PyObject* tmp = PyUnicode_AsASCIIString(obj);
+ if (tmp != NULL) {
+ *v = PyBytes_AS_STRING(tmp)[0];
+ Py_DECREF(tmp);
+ return 1;
+ }
+ } else if (PyArray_Check(obj)) {
+ PyArrayObject* arr = (PyArrayObject*)obj;
+ if (F2PY_ARRAY_IS_CHARACTER_COMPATIBLE(arr)) {
+ *v = PyArray_BYTES(arr)[0];
+ return 1;
+ } else if (F2PY_IS_UNICODE_ARRAY(arr)) {
+ // TODO: update when numpy will support 1-byte and
+ // 2-byte unicode dtypes
+ PyObject* tmp = PyUnicode_FromKindAndData(
+ PyUnicode_4BYTE_KIND,
+ PyArray_BYTES(arr),
+ (PyArray_NBYTES(arr)>0?1:0));
+ if (tmp != NULL) {
+ if (character_from_pyobj(v, tmp, errmess)) {
+ Py_DECREF(tmp);
+ return 1;
+ }
+ Py_DECREF(tmp);
+ }
+ }
+ } else if (PySequence_Check(obj)) {
+ PyObject* tmp = PySequence_GetItem(obj,0);
+ if (tmp != NULL) {
+ if (character_from_pyobj(v, tmp, errmess)) {
+ Py_DECREF(tmp);
+ return 1;
+ }
+ Py_DECREF(tmp);
+ }
+ }
+ {
+ /* TODO: This error (and most other) error handling needs cleaning. */
+ char mess[F2PY_MESSAGE_BUFFER_SIZE];
+ strcpy(mess, errmess);
+ PyObject* err = PyErr_Occurred();
+ if (err == NULL) {
+ err = PyExc_TypeError;
+ Py_INCREF(err);
+ }
+ else {
+ Py_INCREF(err);
+ PyErr_Clear();
+ }
+ sprintf(mess + strlen(mess),
+ " -- expected str|bytes|sequence-of-str-or-bytes, got ");
+ f2py_describe(obj, mess + strlen(mess));
+ PyErr_SetString(err, mess);
+ Py_DECREF(err);
+ }
+ return 0;
+}
+"""
+
+# TODO: These should be dynamically generated, too many mapped to int things,
+# see note in _isocbind.py
+needs['char_from_pyobj'] = ['int_from_pyobj']
+cfuncs['char_from_pyobj'] = """
+static int
+char_from_pyobj(char* v, PyObject *obj, const char *errmess) {
+ int i = 0;
+ if (int_from_pyobj(&i, obj, errmess)) {
+ *v = (char)i;
+ return 1;
+ }
+ return 0;
+}
+"""
+
+
+needs['signed_char_from_pyobj'] = ['int_from_pyobj', 'signed_char']
+cfuncs['signed_char_from_pyobj'] = """
+static int
+signed_char_from_pyobj(signed_char* v, PyObject *obj, const char *errmess) {
+ int i = 0;
+ if (int_from_pyobj(&i, obj, errmess)) {
+ *v = (signed_char)i;
+ return 1;
+ }
+ return 0;
+}
+"""
+
+
+needs['short_from_pyobj'] = ['int_from_pyobj']
+cfuncs['short_from_pyobj'] = """
+static int
+short_from_pyobj(short* v, PyObject *obj, const char *errmess) {
+ int i = 0;
+ if (int_from_pyobj(&i, obj, errmess)) {
+ *v = (short)i;
+ return 1;
+ }
+ return 0;
+}
+"""
+
+
+cfuncs['int_from_pyobj'] = """
+static int
+int_from_pyobj(int* v, PyObject *obj, const char *errmess)
+{
+ PyObject* tmp = NULL;
+
+ if (PyLong_Check(obj)) {
+ *v = Npy__PyLong_AsInt(obj);
+ return !(*v == -1 && PyErr_Occurred());
+ }
+
+ tmp = PyNumber_Long(obj);
+ if (tmp) {
+ *v = Npy__PyLong_AsInt(tmp);
+ Py_DECREF(tmp);
+ return !(*v == -1 && PyErr_Occurred());
+ }
+
+ if (PyComplex_Check(obj)) {
+ PyErr_Clear();
+ tmp = PyObject_GetAttrString(obj,\"real\");
+ }
+ else if (PyBytes_Check(obj) || PyUnicode_Check(obj)) {
+ /*pass*/;
+ }
+ else if (PySequence_Check(obj)) {
+ PyErr_Clear();
+ tmp = PySequence_GetItem(obj, 0);
+ }
+
+ if (tmp) {
+ if (int_from_pyobj(v, tmp, errmess)) {
+ Py_DECREF(tmp);
+ return 1;
+ }
+ Py_DECREF(tmp);
+ }
+
+ {
+ PyObject* err = PyErr_Occurred();
+ if (err == NULL) {
+ err = #modulename#_error;
+ }
+ PyErr_SetString(err, errmess);
+ }
+ return 0;
+}
+"""
+
+
+cfuncs['long_from_pyobj'] = """
+static int
+long_from_pyobj(long* v, PyObject *obj, const char *errmess) {
+ PyObject* tmp = NULL;
+
+ if (PyLong_Check(obj)) {
+ *v = PyLong_AsLong(obj);
+ return !(*v == -1 && PyErr_Occurred());
+ }
+
+ tmp = PyNumber_Long(obj);
+ if (tmp) {
+ *v = PyLong_AsLong(tmp);
+ Py_DECREF(tmp);
+ return !(*v == -1 && PyErr_Occurred());
+ }
+
+ if (PyComplex_Check(obj)) {
+ PyErr_Clear();
+ tmp = PyObject_GetAttrString(obj,\"real\");
+ }
+ else if (PyBytes_Check(obj) || PyUnicode_Check(obj)) {
+ /*pass*/;
+ }
+ else if (PySequence_Check(obj)) {
+ PyErr_Clear();
+ tmp = PySequence_GetItem(obj, 0);
+ }
+
+ if (tmp) {
+ if (long_from_pyobj(v, tmp, errmess)) {
+ Py_DECREF(tmp);
+ return 1;
+ }
+ Py_DECREF(tmp);
+ }
+ {
+ PyObject* err = PyErr_Occurred();
+ if (err == NULL) {
+ err = #modulename#_error;
+ }
+ PyErr_SetString(err, errmess);
+ }
+ return 0;
+}
+"""
+
+
+needs['long_long_from_pyobj'] = ['long_long']
+cfuncs['long_long_from_pyobj'] = """
+static int
+long_long_from_pyobj(long_long* v, PyObject *obj, const char *errmess)
+{
+ PyObject* tmp = NULL;
+
+ if (PyLong_Check(obj)) {
+ *v = PyLong_AsLongLong(obj);
+ return !(*v == -1 && PyErr_Occurred());
+ }
+
+ tmp = PyNumber_Long(obj);
+ if (tmp) {
+ *v = PyLong_AsLongLong(tmp);
+ Py_DECREF(tmp);
+ return !(*v == -1 && PyErr_Occurred());
+ }
+
+ if (PyComplex_Check(obj)) {
+ PyErr_Clear();
+ tmp = PyObject_GetAttrString(obj,\"real\");
+ }
+ else if (PyBytes_Check(obj) || PyUnicode_Check(obj)) {
+ /*pass*/;
+ }
+ else if (PySequence_Check(obj)) {
+ PyErr_Clear();
+ tmp = PySequence_GetItem(obj, 0);
+ }
+
+ if (tmp) {
+ if (long_long_from_pyobj(v, tmp, errmess)) {
+ Py_DECREF(tmp);
+ return 1;
+ }
+ Py_DECREF(tmp);
+ }
+ {
+ PyObject* err = PyErr_Occurred();
+ if (err == NULL) {
+ err = #modulename#_error;
+ }
+ PyErr_SetString(err,errmess);
+ }
+ return 0;
+}
+"""
+
+
+needs['long_double_from_pyobj'] = ['double_from_pyobj', 'long_double']
+cfuncs['long_double_from_pyobj'] = """
+static int
+long_double_from_pyobj(long_double* v, PyObject *obj, const char *errmess)
+{
+ double d=0;
+ if (PyArray_CheckScalar(obj)){
+ if PyArray_IsScalar(obj, LongDouble) {
+ PyArray_ScalarAsCtype(obj, v);
+ return 1;
+ }
+ else if (PyArray_Check(obj) && PyArray_TYPE(obj) == NPY_LONGDOUBLE) {
+ (*v) = *((npy_longdouble *)PyArray_DATA(obj));
+ return 1;
+ }
+ }
+ if (double_from_pyobj(&d, obj, errmess)) {
+ *v = (long_double)d;
+ return 1;
+ }
+ return 0;
+}
+"""
+
+
+cfuncs['double_from_pyobj'] = """
+static int
+double_from_pyobj(double* v, PyObject *obj, const char *errmess)
+{
+ PyObject* tmp = NULL;
+ if (PyFloat_Check(obj)) {
+ *v = PyFloat_AsDouble(obj);
+ return !(*v == -1.0 && PyErr_Occurred());
+ }
+
+ tmp = PyNumber_Float(obj);
+ if (tmp) {
+ *v = PyFloat_AsDouble(tmp);
+ Py_DECREF(tmp);
+ return !(*v == -1.0 && PyErr_Occurred());
+ }
+
+ if (PyComplex_Check(obj)) {
+ PyErr_Clear();
+ tmp = PyObject_GetAttrString(obj,\"real\");
+ }
+ else if (PyBytes_Check(obj) || PyUnicode_Check(obj)) {
+ /*pass*/;
+ }
+ else if (PySequence_Check(obj)) {
+ PyErr_Clear();
+ tmp = PySequence_GetItem(obj, 0);
+ }
+
+ if (tmp) {
+ if (double_from_pyobj(v,tmp,errmess)) {Py_DECREF(tmp); return 1;}
+ Py_DECREF(tmp);
+ }
+ {
+ PyObject* err = PyErr_Occurred();
+ if (err==NULL) err = #modulename#_error;
+ PyErr_SetString(err,errmess);
+ }
+ return 0;
+}
+"""
+
+
+needs['float_from_pyobj'] = ['double_from_pyobj']
+cfuncs['float_from_pyobj'] = """
+static int
+float_from_pyobj(float* v, PyObject *obj, const char *errmess)
+{
+ double d=0.0;
+ if (double_from_pyobj(&d,obj,errmess)) {
+ *v = (float)d;
+ return 1;
+ }
+ return 0;
+}
+"""
+
+
+needs['complex_long_double_from_pyobj'] = ['complex_long_double', 'long_double',
+ 'complex_double_from_pyobj', 'npy_math.h']
+cfuncs['complex_long_double_from_pyobj'] = """
+static int
+complex_long_double_from_pyobj(complex_long_double* v, PyObject *obj, const char *errmess)
+{
+ complex_double cd = {0.0,0.0};
+ if (PyArray_CheckScalar(obj)){
+ if PyArray_IsScalar(obj, CLongDouble) {
+ PyArray_ScalarAsCtype(obj, v);
+ return 1;
+ }
+ else if (PyArray_Check(obj) && PyArray_TYPE(obj)==NPY_CLONGDOUBLE) {
+ (*v).r = npy_creall(*(((npy_clongdouble *)PyArray_DATA(obj))));
+ (*v).i = npy_cimagl(*(((npy_clongdouble *)PyArray_DATA(obj))));
+ return 1;
+ }
+ }
+ if (complex_double_from_pyobj(&cd,obj,errmess)) {
+ (*v).r = (long_double)cd.r;
+ (*v).i = (long_double)cd.i;
+ return 1;
+ }
+ return 0;
+}
+"""
+
+
+needs['complex_double_from_pyobj'] = ['complex_double', 'npy_math.h']
+cfuncs['complex_double_from_pyobj'] = """
+static int
+complex_double_from_pyobj(complex_double* v, PyObject *obj, const char *errmess) {
+ Py_complex c;
+ if (PyComplex_Check(obj)) {
+ c = PyComplex_AsCComplex(obj);
+ (*v).r = c.real;
+ (*v).i = c.imag;
+ return 1;
+ }
+ if (PyArray_IsScalar(obj, ComplexFloating)) {
+ if (PyArray_IsScalar(obj, CFloat)) {
+ npy_cfloat new;
+ PyArray_ScalarAsCtype(obj, &new);
+ (*v).r = (double)npy_crealf(new);
+ (*v).i = (double)npy_cimagf(new);
+ }
+ else if (PyArray_IsScalar(obj, CLongDouble)) {
+ npy_clongdouble new;
+ PyArray_ScalarAsCtype(obj, &new);
+ (*v).r = (double)npy_creall(new);
+ (*v).i = (double)npy_cimagl(new);
+ }
+ else { /* if (PyArray_IsScalar(obj, CDouble)) */
+ PyArray_ScalarAsCtype(obj, v);
+ }
+ return 1;
+ }
+ if (PyArray_CheckScalar(obj)) { /* 0-dim array or still array scalar */
+ PyArrayObject *arr;
+ if (PyArray_Check(obj)) {
+ arr = (PyArrayObject *)PyArray_Cast((PyArrayObject *)obj, NPY_CDOUBLE);
+ }
+ else {
+ arr = (PyArrayObject *)PyArray_FromScalar(obj, PyArray_DescrFromType(NPY_CDOUBLE));
+ }
+ if (arr == NULL) {
+ return 0;
+ }
+ (*v).r = npy_creal(*(((npy_cdouble *)PyArray_DATA(arr))));
+ (*v).i = npy_cimag(*(((npy_cdouble *)PyArray_DATA(arr))));
+ Py_DECREF(arr);
+ return 1;
+ }
+ /* Python does not provide PyNumber_Complex function :-( */
+ (*v).i = 0.0;
+ if (PyFloat_Check(obj)) {
+ (*v).r = PyFloat_AsDouble(obj);
+ return !((*v).r == -1.0 && PyErr_Occurred());
+ }
+ if (PyLong_Check(obj)) {
+ (*v).r = PyLong_AsDouble(obj);
+ return !((*v).r == -1.0 && PyErr_Occurred());
+ }
+ if (PySequence_Check(obj) && !(PyBytes_Check(obj) || PyUnicode_Check(obj))) {
+ PyObject *tmp = PySequence_GetItem(obj,0);
+ if (tmp) {
+ if (complex_double_from_pyobj(v,tmp,errmess)) {
+ Py_DECREF(tmp);
+ return 1;
+ }
+ Py_DECREF(tmp);
+ }
+ }
+ {
+ PyObject* err = PyErr_Occurred();
+ if (err==NULL)
+ err = PyExc_TypeError;
+ PyErr_SetString(err,errmess);
+ }
+ return 0;
+}
+"""
+
+
+needs['complex_float_from_pyobj'] = [
+ 'complex_float', 'complex_double_from_pyobj']
+cfuncs['complex_float_from_pyobj'] = """
+static int
+complex_float_from_pyobj(complex_float* v,PyObject *obj,const char *errmess)
+{
+ complex_double cd={0.0,0.0};
+ if (complex_double_from_pyobj(&cd,obj,errmess)) {
+ (*v).r = (float)cd.r;
+ (*v).i = (float)cd.i;
+ return 1;
+ }
+ return 0;
+}
+"""
+
+
+cfuncs['try_pyarr_from_character'] = """
+static int try_pyarr_from_character(PyObject* obj, character* v) {
+ PyArrayObject *arr = (PyArrayObject*)obj;
+ if (!obj) return -2;
+ if (PyArray_Check(obj)) {
+ if (F2PY_ARRAY_IS_CHARACTER_COMPATIBLE(arr)) {
+ *(character *)(PyArray_DATA(arr)) = *v;
+ return 1;
+ }
+ }
+ {
+ char mess[F2PY_MESSAGE_BUFFER_SIZE];
+ PyObject* err = PyErr_Occurred();
+ if (err == NULL) {
+ err = PyExc_ValueError;
+ strcpy(mess, "try_pyarr_from_character failed"
+ " -- expected bytes array-scalar|array, got ");
+ f2py_describe(obj, mess + strlen(mess));
+ PyErr_SetString(err, mess);
+ }
+ }
+ return 0;
+}
+"""
+
+needs['try_pyarr_from_char'] = ['pyobj_from_char1', 'TRYPYARRAYTEMPLATE']
+cfuncs[
+ 'try_pyarr_from_char'] = 'static int try_pyarr_from_char(PyObject* obj,char* v) {\n TRYPYARRAYTEMPLATE(char,\'c\');\n}\n'
+needs['try_pyarr_from_signed_char'] = ['TRYPYARRAYTEMPLATE', 'unsigned_char']
+cfuncs[
+ 'try_pyarr_from_unsigned_char'] = 'static int try_pyarr_from_unsigned_char(PyObject* obj,unsigned_char* v) {\n TRYPYARRAYTEMPLATE(unsigned_char,\'b\');\n}\n'
+needs['try_pyarr_from_signed_char'] = ['TRYPYARRAYTEMPLATE', 'signed_char']
+cfuncs[
+ 'try_pyarr_from_signed_char'] = 'static int try_pyarr_from_signed_char(PyObject* obj,signed_char* v) {\n TRYPYARRAYTEMPLATE(signed_char,\'1\');\n}\n'
+needs['try_pyarr_from_short'] = ['pyobj_from_short1', 'TRYPYARRAYTEMPLATE']
+cfuncs[
+ 'try_pyarr_from_short'] = 'static int try_pyarr_from_short(PyObject* obj,short* v) {\n TRYPYARRAYTEMPLATE(short,\'s\');\n}\n'
+needs['try_pyarr_from_int'] = ['pyobj_from_int1', 'TRYPYARRAYTEMPLATE']
+cfuncs[
+ 'try_pyarr_from_int'] = 'static int try_pyarr_from_int(PyObject* obj,int* v) {\n TRYPYARRAYTEMPLATE(int,\'i\');\n}\n'
+needs['try_pyarr_from_long'] = ['pyobj_from_long1', 'TRYPYARRAYTEMPLATE']
+cfuncs[
+ 'try_pyarr_from_long'] = 'static int try_pyarr_from_long(PyObject* obj,long* v) {\n TRYPYARRAYTEMPLATE(long,\'l\');\n}\n'
+needs['try_pyarr_from_long_long'] = [
+ 'pyobj_from_long_long1', 'TRYPYARRAYTEMPLATE', 'long_long']
+cfuncs[
+ 'try_pyarr_from_long_long'] = 'static int try_pyarr_from_long_long(PyObject* obj,long_long* v) {\n TRYPYARRAYTEMPLATE(long_long,\'L\');\n}\n'
+needs['try_pyarr_from_float'] = ['pyobj_from_float1', 'TRYPYARRAYTEMPLATE']
+cfuncs[
+ 'try_pyarr_from_float'] = 'static int try_pyarr_from_float(PyObject* obj,float* v) {\n TRYPYARRAYTEMPLATE(float,\'f\');\n}\n'
+needs['try_pyarr_from_double'] = ['pyobj_from_double1', 'TRYPYARRAYTEMPLATE']
+cfuncs[
+ 'try_pyarr_from_double'] = 'static int try_pyarr_from_double(PyObject* obj,double* v) {\n TRYPYARRAYTEMPLATE(double,\'d\');\n}\n'
+needs['try_pyarr_from_complex_float'] = [
+ 'pyobj_from_complex_float1', 'TRYCOMPLEXPYARRAYTEMPLATE', 'complex_float']
+cfuncs[
+ 'try_pyarr_from_complex_float'] = 'static int try_pyarr_from_complex_float(PyObject* obj,complex_float* v) {\n TRYCOMPLEXPYARRAYTEMPLATE(float,\'F\');\n}\n'
+needs['try_pyarr_from_complex_double'] = [
+ 'pyobj_from_complex_double1', 'TRYCOMPLEXPYARRAYTEMPLATE', 'complex_double']
+cfuncs[
+ 'try_pyarr_from_complex_double'] = 'static int try_pyarr_from_complex_double(PyObject* obj,complex_double* v) {\n TRYCOMPLEXPYARRAYTEMPLATE(double,\'D\');\n}\n'
+
+
+needs['create_cb_arglist'] = ['CFUNCSMESS', 'PRINTPYOBJERR', 'MINMAX']
+# create the list of arguments to be used when calling back to python
+cfuncs['create_cb_arglist'] = """
+static int
+create_cb_arglist(PyObject* fun, PyTupleObject* xa , const int maxnofargs,
+ const int nofoptargs, int *nofargs, PyTupleObject **args,
+ const char *errmess)
+{
+ PyObject *tmp = NULL;
+ PyObject *tmp_fun = NULL;
+ Py_ssize_t tot, opt, ext, siz, i, di = 0;
+ CFUNCSMESS(\"create_cb_arglist\\n\");
+ tot=opt=ext=siz=0;
+ /* Get the total number of arguments */
+ if (PyFunction_Check(fun)) {
+ tmp_fun = fun;
+ Py_INCREF(tmp_fun);
+ }
+ else {
+ di = 1;
+ if (PyObject_HasAttrString(fun,\"im_func\")) {
+ tmp_fun = PyObject_GetAttrString(fun,\"im_func\");
+ }
+ else if (PyObject_HasAttrString(fun,\"__call__\")) {
+ tmp = PyObject_GetAttrString(fun,\"__call__\");
+ if (PyObject_HasAttrString(tmp,\"im_func\"))
+ tmp_fun = PyObject_GetAttrString(tmp,\"im_func\");
+ else {
+ tmp_fun = fun; /* built-in function */
+ Py_INCREF(tmp_fun);
+ tot = maxnofargs;
+ if (PyCFunction_Check(fun)) {
+ /* In case the function has a co_argcount (like on PyPy) */
+ di = 0;
+ }
+ if (xa != NULL)
+ tot += PyTuple_Size((PyObject *)xa);
+ }
+ Py_XDECREF(tmp);
+ }
+ else if (PyFortran_Check(fun) || PyFortran_Check1(fun)) {
+ tot = maxnofargs;
+ if (xa != NULL)
+ tot += PyTuple_Size((PyObject *)xa);
+ tmp_fun = fun;
+ Py_INCREF(tmp_fun);
+ }
+ else if (F2PyCapsule_Check(fun)) {
+ tot = maxnofargs;
+ if (xa != NULL)
+ ext = PyTuple_Size((PyObject *)xa);
+ if(ext>0) {
+ fprintf(stderr,\"extra arguments tuple cannot be used with PyCapsule call-back\\n\");
+ goto capi_fail;
+ }
+ tmp_fun = fun;
+ Py_INCREF(tmp_fun);
+ }
+ }
+
+ if (tmp_fun == NULL) {
+ fprintf(stderr,
+ \"Call-back argument must be function|instance|instance.__call__|f2py-function \"
+ \"but got %s.\\n\",
+ ((fun == NULL) ? \"NULL\" : Py_TYPE(fun)->tp_name));
+ goto capi_fail;
+ }
+
+ if (PyObject_HasAttrString(tmp_fun,\"__code__\")) {
+ if (PyObject_HasAttrString(tmp = PyObject_GetAttrString(tmp_fun,\"__code__\"),\"co_argcount\")) {
+ PyObject *tmp_argcount = PyObject_GetAttrString(tmp,\"co_argcount\");
+ Py_DECREF(tmp);
+ if (tmp_argcount == NULL) {
+ goto capi_fail;
+ }
+ tot = PyLong_AsSsize_t(tmp_argcount) - di;
+ Py_DECREF(tmp_argcount);
+ }
+ }
+ /* Get the number of optional arguments */
+ if (PyObject_HasAttrString(tmp_fun,\"__defaults__\")) {
+ if (PyTuple_Check(tmp = PyObject_GetAttrString(tmp_fun,\"__defaults__\")))
+ opt = PyTuple_Size(tmp);
+ Py_XDECREF(tmp);
+ }
+ /* Get the number of extra arguments */
+ if (xa != NULL)
+ ext = PyTuple_Size((PyObject *)xa);
+ /* Calculate the size of call-backs argument list */
+ siz = MIN(maxnofargs+ext,tot);
+ *nofargs = MAX(0,siz-ext);
+
+#ifdef DEBUGCFUNCS
+ fprintf(stderr,
+ \"debug-capi:create_cb_arglist:maxnofargs(-nofoptargs),\"
+ \"tot,opt,ext,siz,nofargs = %d(-%d), %zd, %zd, %zd, %zd, %d\\n\",
+ maxnofargs, nofoptargs, tot, opt, ext, siz, *nofargs);
+#endif
+
+ if (siz < tot-opt) {
+ fprintf(stderr,
+ \"create_cb_arglist: Failed to build argument list \"
+ \"(siz) with enough arguments (tot-opt) required by \"
+ \"user-supplied function (siz,tot,opt=%zd, %zd, %zd).\\n\",
+ siz, tot, opt);
+ goto capi_fail;
+ }
+
+ /* Initialize argument list */
+ *args = (PyTupleObject *)PyTuple_New(siz);
+ for (i=0;i<*nofargs;i++) {
+ Py_INCREF(Py_None);
+ PyTuple_SET_ITEM((PyObject *)(*args),i,Py_None);
+ }
+ if (xa != NULL)
+ for (i=(*nofargs);i 0:
+ if outneeds[n][0] not in needs:
+ out.append(outneeds[n][0])
+ del outneeds[n][0]
+ else:
+ flag = 0
+ for k in outneeds[n][1:]:
+ if k in needs[outneeds[n][0]]:
+ flag = 1
+ break
+ if flag:
+ outneeds[n] = outneeds[n][1:] + [outneeds[n][0]]
+ else:
+ out.append(outneeds[n][0])
+ del outneeds[n][0]
+ if saveout and (0 not in map(lambda x, y: x == y, saveout, outneeds[n])) \
+ and outneeds[n] != []:
+ print(n, saveout)
+ errmess(
+ 'get_needs: no progress in sorting needs, probably circular dependence, skipping.\n')
+ out = out + saveout
+ break
+ saveout = copy.copy(outneeds[n])
+ if out == []:
+ out = [n]
+ res[n] = out
+ return res
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/f2py/common_rules.py b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/f2py/common_rules.py
new file mode 100644
index 0000000000000000000000000000000000000000..64347b737454fe1bae544b6630de2729157d7f71
--- /dev/null
+++ b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/f2py/common_rules.py
@@ -0,0 +1,146 @@
+"""
+Build common block mechanism for f2py2e.
+
+Copyright 1999 -- 2011 Pearu Peterson all rights reserved.
+Copyright 2011 -- present NumPy Developers.
+Permission to use, modify, and distribute this software is given under the
+terms of the NumPy License
+
+NO WARRANTY IS EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
+"""
+from . import __version__
+f2py_version = __version__.version
+
+from .auxfuncs import (
+ hasbody, hascommon, hasnote, isintent_hide, outmess, getuseblocks
+)
+from . import capi_maps
+from . import func2subr
+from .crackfortran import rmbadname
+
+
+def findcommonblocks(block, top=1):
+ ret = []
+ if hascommon(block):
+ for key, value in block['common'].items():
+ vars_ = {v: block['vars'][v] for v in value}
+ ret.append((key, value, vars_))
+ elif hasbody(block):
+ for b in block['body']:
+ ret = ret + findcommonblocks(b, 0)
+ if top:
+ tret = []
+ names = []
+ for t in ret:
+ if t[0] not in names:
+ names.append(t[0])
+ tret.append(t)
+ return tret
+ return ret
+
+
+def buildhooks(m):
+ ret = {'commonhooks': [], 'initcommonhooks': [],
+ 'docs': ['"COMMON blocks:\\n"']}
+ fwrap = ['']
+
+ def fadd(line, s=fwrap):
+ s[0] = '%s\n %s' % (s[0], line)
+ chooks = ['']
+
+ def cadd(line, s=chooks):
+ s[0] = '%s\n%s' % (s[0], line)
+ ihooks = ['']
+
+ def iadd(line, s=ihooks):
+ s[0] = '%s\n%s' % (s[0], line)
+ doc = ['']
+
+ def dadd(line, s=doc):
+ s[0] = '%s\n%s' % (s[0], line)
+ for (name, vnames, vars) in findcommonblocks(m):
+ lower_name = name.lower()
+ hnames, inames = [], []
+ for n in vnames:
+ if isintent_hide(vars[n]):
+ hnames.append(n)
+ else:
+ inames.append(n)
+ if hnames:
+ outmess('\t\tConstructing COMMON block support for "%s"...\n\t\t %s\n\t\t Hidden: %s\n' % (
+ name, ','.join(inames), ','.join(hnames)))
+ else:
+ outmess('\t\tConstructing COMMON block support for "%s"...\n\t\t %s\n' % (
+ name, ','.join(inames)))
+ fadd('subroutine f2pyinit%s(setupfunc)' % name)
+ for usename in getuseblocks(m):
+ fadd(f'use {usename}')
+ fadd('external setupfunc')
+ for n in vnames:
+ fadd(func2subr.var2fixfortran(vars, n))
+ if name == '_BLNK_':
+ fadd('common %s' % (','.join(vnames)))
+ else:
+ fadd('common /%s/ %s' % (name, ','.join(vnames)))
+ fadd('call setupfunc(%s)' % (','.join(inames)))
+ fadd('end\n')
+ cadd('static FortranDataDef f2py_%s_def[] = {' % (name))
+ idims = []
+ for n in inames:
+ ct = capi_maps.getctype(vars[n])
+ elsize = capi_maps.get_elsize(vars[n])
+ at = capi_maps.c2capi_map[ct]
+ dm = capi_maps.getarrdims(n, vars[n])
+ if dm['dims']:
+ idims.append('(%s)' % (dm['dims']))
+ else:
+ idims.append('')
+ dms = dm['dims'].strip()
+ if not dms:
+ dms = '-1'
+ cadd('\t{\"%s\",%s,{{%s}},%s, %s},'
+ % (n, dm['rank'], dms, at, elsize))
+ cadd('\t{NULL}\n};')
+ inames1 = rmbadname(inames)
+ inames1_tps = ','.join(['char *' + s for s in inames1])
+ cadd('static void f2py_setup_%s(%s) {' % (name, inames1_tps))
+ cadd('\tint i_f2py=0;')
+ for n in inames1:
+ cadd('\tf2py_%s_def[i_f2py++].data = %s;' % (name, n))
+ cadd('}')
+ if '_' in lower_name:
+ F_FUNC = 'F_FUNC_US'
+ else:
+ F_FUNC = 'F_FUNC'
+ cadd('extern void %s(f2pyinit%s,F2PYINIT%s)(void(*)(%s));'
+ % (F_FUNC, lower_name, name.upper(),
+ ','.join(['char*'] * len(inames1))))
+ cadd('static void f2py_init_%s(void) {' % name)
+ cadd('\t%s(f2pyinit%s,F2PYINIT%s)(f2py_setup_%s);'
+ % (F_FUNC, lower_name, name.upper(), name))
+ cadd('}\n')
+ iadd('\ttmp = PyFortranObject_New(f2py_%s_def,f2py_init_%s);' % (name, name))
+ iadd('\tif (tmp == NULL) return NULL;')
+ iadd('\tif (F2PyDict_SetItemString(d, \"%s\", tmp) == -1) return NULL;'
+ % name)
+ iadd('\tPy_DECREF(tmp);')
+ tname = name.replace('_', '\\_')
+ dadd('\\subsection{Common block \\texttt{%s}}\n' % (tname))
+ dadd('\\begin{description}')
+ for n in inames:
+ dadd('\\item[]{{}\\verb@%s@{}}' %
+ (capi_maps.getarrdocsign(n, vars[n])))
+ if hasnote(vars[n]):
+ note = vars[n]['note']
+ if isinstance(note, list):
+ note = '\n'.join(note)
+ dadd('--- %s' % (note))
+ dadd('\\end{description}')
+ ret['docs'].append(
+ '"\t/%s/ %s\\n"' % (name, ','.join(map(lambda v, d: v + d, inames, idims))))
+ ret['commonhooks'] = chooks
+ ret['initcommonhooks'] = ihooks
+ ret['latexdoc'] = doc[0]
+ if len(ret['docs']) <= 1:
+ ret['docs'] = ''
+ return ret, fwrap[0]
diff --git a/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/f2py/crackfortran.py b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/f2py/crackfortran.py
new file mode 100644
index 0000000000000000000000000000000000000000..8d3fc27608bd85f67867b66d39640a5167d7e5ee
--- /dev/null
+++ b/grounding-dino/.eval_venv/lib64/python3.11/site-packages/numpy/f2py/crackfortran.py
@@ -0,0 +1,3767 @@
+#!/usr/bin/env python3
+"""
+crackfortran --- read fortran (77,90) code and extract declaration information.
+
+Copyright 1999 -- 2011 Pearu Peterson all rights reserved.
+Copyright 2011 -- present NumPy Developers.
+Permission to use, modify, and distribute this software is given under the
+terms of the NumPy License.
+
+NO WARRANTY IS EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
+
+
+Usage of crackfortran:
+======================
+Command line keys: -quiet,-verbose,-fix,-f77,-f90,-show,-h
+ -m ,--ignore-contains
+Functions: crackfortran, crack2fortran
+The following Fortran statements/constructions are supported
+(or will be if needed):
+ block data,byte,call,character,common,complex,contains,data,
+ dimension,double complex,double precision,end,external,function,
+ implicit,integer,intent,interface,intrinsic,
+ logical,module,optional,parameter,private,public,
+ program,real,(sequence?),subroutine,type,use,virtual,
+ include,pythonmodule
+Note: 'virtual' is mapped to 'dimension'.
+Note: 'implicit integer (z) static (z)' is 'implicit static (z)' (this is minor bug).
+Note: code after 'contains' will be ignored until its scope ends.
+Note: 'common' statement is extended: dimensions are moved to variable definitions
+Note: f2py directive: f2py is read as
+Note: pythonmodule is introduced to represent Python module
+
+Usage:
+ `postlist=crackfortran(files)`
+ `postlist` contains declaration information read from the list of files `files`.
+ `crack2fortran(postlist)` returns a fortran code to be saved to pyf-file
+
+ `postlist` has the following structure:
+ *** it is a list of dictionaries containing `blocks':
+ B = {'block','body','vars','parent_block'[,'name','prefix','args','result',
+ 'implicit','externals','interfaced','common','sortvars',
+ 'commonvars','note']}
+ B['block'] = 'interface' | 'function' | 'subroutine' | 'module' |
+ 'program' | 'block data' | 'type' | 'pythonmodule' |
+ 'abstract interface'
+ B['body'] --- list containing `subblocks' with the same structure as `blocks'
+ B['parent_block'] --- dictionary of a parent block:
+ C['body'][]['parent_block'] is C
+ B['vars'] --- dictionary of variable definitions
+ B['sortvars'] --- dictionary of variable definitions sorted by dependence (independent first)
+ B['name'] --- name of the block (not if B['block']=='interface')
+ B['prefix'] --- prefix string (only if B['block']=='function')
+ B['args'] --- list of argument names if B['block']== 'function' | 'subroutine'
+ B['result'] --- name of the return value (only if B['block']=='function')
+ B['implicit'] --- dictionary {'a':,'b':...} | None
+ B['externals'] --- list of variables being external
+ B['interfaced'] --- list of variables being external and defined
+ B['common'] --- dictionary of common blocks (list of objects)
+ B['commonvars'] --- list of variables used in common blocks (dimensions are moved to variable definitions)
+ B['from'] --- string showing the 'parents' of the current block
+ B['use'] --- dictionary of modules used in current block:
+ {:{['only':<0|1>],['map':{:,...}]}}
+ B['note'] --- list of LaTeX comments on the block
+ B['f2pyenhancements'] --- optional dictionary
+ {'threadsafe':'','fortranname':,
+ 'callstatement':|,
+ 'callprotoargument':,
+ 'usercode':|,
+ 'pymethoddef:'
+ }
+ B['entry'] --- dictionary {entryname:argslist,..}
+ B['varnames'] --- list of variable names given in the order of reading the
+ Fortran code, useful for derived types.
+ B['saved_interface'] --- a string of scanned routine signature, defines explicit interface
+ *** Variable definition is a dictionary
+ D = B['vars'][] =
+ {'typespec'[,'attrspec','kindselector','charselector','=','typename']}
+ D['typespec'] = 'byte' | 'character' | 'complex' | 'double complex' |
+ 'double precision' | 'integer' | 'logical' | 'real' | 'type'
+ D['attrspec'] --- list of attributes (e.g. 'dimension()',
+ 'external','intent(in|out|inout|hide|c|callback|cache|aligned4|aligned8|aligned16)',
+ 'optional','required', etc)
+ K = D['kindselector'] = {['*','kind']} (only if D['typespec'] =
+ 'complex' | 'integer' | 'logical' | 'real' )
+ C = D['charselector'] = {['*','len','kind','f2py_len']}
+ (only if D['typespec']=='character')
+ D['='] --- initialization expression string
+ D['typename'] --- name of the type if D['typespec']=='type'
+ D['dimension'] --- list of dimension bounds
+ D['intent'] --- list of intent specifications
+ D['depend'] --- list of variable names on which current variable depends on
+ D['check'] --- list of C-expressions; if C-expr returns zero, exception is raised
+ D['note'] --- list of LaTeX comments on the variable
+ *** Meaning of kind/char selectors (few examples):
+ D['typespec>']*K['*']
+ D['typespec'](kind=K['kind'])
+ character*C['*']
+ character(len=C['len'],kind=C['kind'], f2py_len=C['f2py_len'])
+ (see also fortran type declaration statement formats below)
+
+Fortran 90 type declaration statement format (F77 is subset of F90)
+====================================================================
+(Main source: IBM XL Fortran 5.1 Language Reference Manual)
+type declaration = [[]::]
+ = byte |
+ character[] |
+ complex[] |
+ double complex |
+ double precision |
+ integer[] |
+ logical[] |
+ real[] |
+ type()
+