file_path stringlengths 32 153 | content stringlengths 0 3.14M |
|---|---|
omniverse-code/kit/exts/omni.kit.pip_archive/pip_prebundle/numpy/typing/tests/data/pass/fromnumeric.py | """Tests for :mod:`numpy.core.fromnumeric`."""
import numpy as np
A = np.array(True, ndmin=2, dtype=bool)
B = np.array(1.0, ndmin=2, dtype=np.float32)
A.setflags(write=False)
B.setflags(write=False)
a = np.bool_(True)
b = np.float32(1.0)
c = 1.0
d = np.array(1.0, dtype=np.float32) # writeable
np.take(a, 0)
np.take... |
omniverse-code/kit/exts/omni.kit.pip_archive/pip_prebundle/numpy/typing/tests/data/pass/arrayprint.py | import numpy as np
AR = np.arange(10)
AR.setflags(write=False)
with np.printoptions():
np.set_printoptions(
precision=1,
threshold=2,
edgeitems=3,
linewidth=4,
suppress=False,
nanstr="Bob",
infstr="Bill",
formatter={},
sign="+",
float... |
omniverse-code/kit/exts/omni.kit.pip_archive/pip_prebundle/numpy/typing/tests/data/pass/numeric.py | """
Tests for :mod:`numpy.core.numeric`.
Does not include tests which fall under ``array_constructors``.
"""
from __future__ import annotations
import numpy as np
class SubClass(np.ndarray):
...
i8 = np.int64(1)
A = np.arange(27).reshape(3, 3, 3)
B: list[list[list[int]]] = A.tolist()
C = np.empty((27, 27)).v... |
omniverse-code/kit/exts/omni.kit.pip_archive/pip_prebundle/numpy/typing/tests/data/pass/modules.py | import numpy as np
from numpy import f2py
np.char
np.ctypeslib
np.emath
np.fft
np.lib
np.linalg
np.ma
np.matrixlib
np.polynomial
np.random
np.rec
np.testing
np.version
np.lib.format
np.lib.mixins
np.lib.scimath
np.lib.stride_tricks
np.ma.extras
np.polynomial.chebyshev
np.polynomial.hermite
np.polynomial.hermite_e
np.... |
omniverse-code/kit/exts/omni.kit.pip_archive/pip_prebundle/numpy/typing/tests/data/pass/einsumfunc.py | from __future__ import annotations
from typing import Any
import numpy as np
AR_LIKE_b = [True, True, True]
AR_LIKE_u = [np.uint32(1), np.uint32(2), np.uint32(3)]
AR_LIKE_i = [1, 2, 3]
AR_LIKE_f = [1.0, 2.0, 3.0]
AR_LIKE_c = [1j, 2j, 3j]
AR_LIKE_U = ["1", "2", "3"]
OUT_f: np.ndarray[Any, np.dtype[np.float64]] = np.... |
omniverse-code/kit/exts/omni.kit.pip_archive/pip_prebundle/numpy/typing/tests/data/pass/warnings_and_errors.py | import numpy as np
np.AxisError("test")
np.AxisError(1, ndim=2)
np.AxisError(1, ndim=2, msg_prefix="error")
np.AxisError(1, ndim=2, msg_prefix=None)
|
omniverse-code/kit/exts/omni.kit.pip_archive/pip_prebundle/numpy/typing/tests/data/pass/flatiter.py | import numpy as np
a = np.empty((2, 2)).flat
a.base
a.copy()
a.coords
a.index
iter(a)
next(a)
a[0]
a[[0, 1, 2]]
a[...]
a[:]
a.__array__()
a.__array__(np.dtype(np.float64))
|
omniverse-code/kit/exts/omni.kit.pip_archive/pip_prebundle/numpy/typing/tests/data/pass/arithmetic.py | from __future__ import annotations
from typing import Any
import numpy as np
c16 = np.complex128(1)
f8 = np.float64(1)
i8 = np.int64(1)
u8 = np.uint64(1)
c8 = np.complex64(1)
f4 = np.float32(1)
i4 = np.int32(1)
u4 = np.uint32(1)
dt = np.datetime64(1, "D")
td = np.timedelta64(1, "D")
b_ = np.bool_(1)
b = bool(1)
c... |
omniverse-code/kit/exts/omni.kit.pip_archive/pip_prebundle/numpy/typing/tests/data/pass/scalars.py | import sys
import datetime as dt
import pytest
import numpy as np
b = np.bool_()
u8 = np.uint64()
i8 = np.int64()
f8 = np.float64()
c16 = np.complex128()
U = np.str_()
S = np.bytes_()
# Construction
class D:
def __index__(self) -> int:
return 0
class C:
def __complex__(self) -> complex:
r... |
omniverse-code/kit/exts/omni.kit.pip_archive/pip_prebundle/numpy/typing/tests/data/pass/ufuncs.py | import numpy as np
np.sin(1)
np.sin([1, 2, 3])
np.sin(1, out=np.empty(1))
np.matmul(np.ones((2, 2, 2)), np.ones((2, 2, 2)), axes=[(0, 1), (0, 1), (0, 1)])
np.sin(1, signature="D->D")
np.sin(1, extobj=[16, 1, lambda: None])
# NOTE: `np.generic` subclasses are not guaranteed to support addition;
# re-enable this we can ... |
omniverse-code/kit/exts/omni.kit.pip_archive/pip_prebundle/numpy/typing/tests/data/pass/mod.py | import numpy as np
f8 = np.float64(1)
i8 = np.int64(1)
u8 = np.uint64(1)
f4 = np.float32(1)
i4 = np.int32(1)
u4 = np.uint32(1)
td = np.timedelta64(1, "D")
b_ = np.bool_(1)
b = bool(1)
f = float(1)
i = int(1)
AR = np.array([1], dtype=np.bool_)
AR.setflags(write=False)
AR2 = np.array([1], dtype=np.timedelta64)
AR2.... |
omniverse-code/kit/exts/omni.kit.pip_archive/pip_prebundle/numpy/typing/tests/data/pass/comparisons.py | from __future__ import annotations
from typing import Any
import numpy as np
c16 = np.complex128()
f8 = np.float64()
i8 = np.int64()
u8 = np.uint64()
c8 = np.complex64()
f4 = np.float32()
i4 = np.int32()
u4 = np.uint32()
dt = np.datetime64(0, "D")
td = np.timedelta64(0, "D")
b_ = np.bool_()
b = bool()
c = complex... |
omniverse-code/kit/exts/omni.kit.pip_archive/pip_prebundle/numpy/typing/tests/data/pass/ndarray_conversion.py | import os
import tempfile
import numpy as np
nd = np.array([[1, 2], [3, 4]])
scalar_array = np.array(1)
# item
scalar_array.item()
nd.item(1)
nd.item(0, 1)
nd.item((0, 1))
# tolist is pretty simple
# itemset
scalar_array.itemset(3)
nd.itemset(3, 0)
nd.itemset((0, 0), 3)
# tobytes
nd.tobytes()
nd.tobytes("C")
nd.t... |
omniverse-code/kit/exts/omni.kit.pip_archive/pip_prebundle/numpy/typing/tests/data/pass/arrayterator.py |
from __future__ import annotations
from typing import Any
import numpy as np
AR_i8: np.ndarray[Any, np.dtype[np.int_]] = np.arange(10)
ar_iter = np.lib.Arrayterator(AR_i8)
ar_iter.var
ar_iter.buf_size
ar_iter.start
ar_iter.stop
ar_iter.step
ar_iter.shape
ar_iter.flat
ar_iter.__array__()
for i in ar_iter:
pass... |
omniverse-code/kit/exts/omni.kit.pip_archive/pip_prebundle/numpy/typing/tests/data/pass/array_constructors.py | import sys
from typing import Any
import numpy as np
class Index:
def __index__(self) -> int:
return 0
class SubClass(np.ndarray):
pass
def func(i: int, j: int, **kwargs: Any) -> SubClass:
return B
i8 = np.int64(1)
A = np.array([1])
B = A.view(SubClass).copy()
B_stack = np.array([[1], [1]])... |
omniverse-code/kit/exts/omni.kit.pip_archive/pip_prebundle/numpy/typing/tests/data/pass/random.py | from __future__ import annotations
from typing import Any
import numpy as np
SEED_NONE = None
SEED_INT = 4579435749574957634658964293569
SEED_ARR: np.ndarray[Any, np.dtype[np.int64]] = np.array([1, 2, 3, 4], dtype=np.int64)
SEED_ARRLIKE: list[int] = [1, 2, 3, 4]
SEED_SEED_SEQ: np.random.SeedSequence = np.random.SeedS... |
omniverse-code/kit/exts/omni.kit.pip_archive/pip_prebundle/numpy/typing/tests/data/pass/simple.py | """Simple expression that should pass with mypy."""
import operator
import numpy as np
from collections.abc import Iterable
# Basic checks
array = np.array([1, 2])
def ndarray_func(x):
# type: (np.ndarray) -> np.ndarray
return x
ndarray_func(np.array([1, 2]))
array == 1
array.dtype == float
# Dtype const... |
omniverse-code/kit/exts/omni.kit.pip_archive/pip_prebundle/numpy/typing/tests/data/pass/bitwise_ops.py | import numpy as np
i8 = np.int64(1)
u8 = np.uint64(1)
i4 = np.int32(1)
u4 = np.uint32(1)
b_ = np.bool_(1)
b = bool(1)
i = int(1)
AR = np.array([0, 1, 2], dtype=np.int32)
AR.setflags(write=False)
i8 << i8
i8 >> i8
i8 | i8
i8 ^ i8
i8 & i8
i8 << AR
i8 >> AR
i8 | AR
i8 ^ AR
i8 & AR
i4 << i4
i4 >> i4
i4 | i4
i4 ^ i... |
omniverse-code/kit/exts/omni.kit.pip_archive/pip_prebundle/numpy/typing/tests/data/pass/lib_version.py | from numpy.lib import NumpyVersion
version = NumpyVersion("1.8.0")
version.vstring
version.version
version.major
version.minor
version.bugfix
version.pre_release
version.is_devversion
version == version
version != version
version < "1.8.0"
version <= version
version > version
version >= "1.8.0"
|
omniverse-code/kit/exts/omni.kit.pip_archive/pip_prebundle/numpy/typing/tests/data/pass/numerictypes.py | import numpy as np
np.maximum_sctype("S8")
np.maximum_sctype(object)
np.issctype(object)
np.issctype("S8")
np.obj2sctype(list)
np.obj2sctype(list, default=None)
np.obj2sctype(list, default=np.string_)
np.issubclass_(np.int32, int)
np.issubclass_(np.float64, float)
np.issubclass_(np.float64, (int, float))
np.issubs... |
omniverse-code/kit/exts/omni.kit.pip_archive/pip_prebundle/numpy/typing/tests/data/pass/ndarray_misc.py | """
Tests for miscellaneous (non-magic) ``np.ndarray``/``np.generic`` methods.
More extensive tests are performed for the methods'
function-based counterpart in `../from_numeric.py`.
"""
from __future__ import annotations
import operator
from typing import cast, Any
import numpy as np
class SubClass(np.ndarray): ... |
omniverse-code/kit/exts/omni.kit.pip_archive/pip_prebundle/numpy/typing/tests/data/pass/simple_py3.py | import numpy as np
array = np.array([1, 2])
# The @ operator is not in python 2
array @ array
|
omniverse-code/kit/exts/omni.kit.pip_archive/pip_prebundle/numpy/ma/core.pyi | from collections.abc import Callable
from typing import Any, TypeVar
from numpy import ndarray, dtype, float64
from numpy import (
amax as amax,
amin as amin,
bool_ as bool_,
expand_dims as expand_dims,
diff as diff,
clip as clip,
indices as indices,
ones_like as ones_like,
squeeze ... |
omniverse-code/kit/exts/omni.kit.pip_archive/pip_prebundle/numpy/ma/timer_comparison.py | import timeit
from functools import reduce
import numpy as np
from numpy import float_
import numpy.core.fromnumeric as fromnumeric
from numpy.testing import build_err_msg
pi = np.pi
class ModuleTester:
def __init__(self, module):
self.module = module
self.allequal = module.allequal
sel... |
omniverse-code/kit/exts/omni.kit.pip_archive/pip_prebundle/numpy/ma/__init__.py | """
=============
Masked Arrays
=============
Arrays sometimes contain invalid or missing data. When doing operations
on such arrays, we wish to suppress invalid values, which is the purpose masked
arrays fulfill (an example of typical use is given below).
For example, examine the following array:
>>> x = np.array(... |
omniverse-code/kit/exts/omni.kit.pip_archive/pip_prebundle/numpy/ma/bench.py | #!/usr/bin/env python3
import timeit
import numpy
###############################################################################
# Global variables #
###############################################################################
# Small arrays
xs = numpy... |
omniverse-code/kit/exts/omni.kit.pip_archive/pip_prebundle/numpy/ma/core.py | """
numpy.ma : a package to handle missing or invalid values.
This package was initially written for numarray by Paul F. Dubois
at Lawrence Livermore National Laboratory.
In 2006, the package was completely rewritten by Pierre Gerard-Marchant
(University of Georgia) to make the MaskedArray class a subclass of ndarray,... |
omniverse-code/kit/exts/omni.kit.pip_archive/pip_prebundle/numpy/ma/setup.py | #!/usr/bin/env python3
def configuration(parent_package='',top_path=None):
from numpy.distutils.misc_util import Configuration
config = Configuration('ma', parent_package, top_path)
config.add_subpackage('tests')
config.add_data_files('*.pyi')
return config
if __name__ == "__main__":
from numpy... |
omniverse-code/kit/exts/omni.kit.pip_archive/pip_prebundle/numpy/ma/mrecords.pyi | from typing import Any, TypeVar
from numpy import dtype
from numpy.ma import MaskedArray
__all__: list[str]
# TODO: Set the `bound` to something more suitable once we
# have proper shape support
_ShapeType = TypeVar("_ShapeType", bound=Any)
_DType_co = TypeVar("_DType_co", bound=dtype[Any], covariant=True)
class Ma... |
omniverse-code/kit/exts/omni.kit.pip_archive/pip_prebundle/numpy/ma/testutils.py | """Miscellaneous functions for testing masked arrays and subclasses
:author: Pierre Gerard-Marchant
:contact: pierregm_at_uga_dot_edu
:version: $Id: testutils.py 3529 2007-11-13 08:01:14Z jarrod.millman $
"""
import operator
import numpy as np
from numpy import ndarray, float_
import numpy.core.umath as umath
import... |
omniverse-code/kit/exts/omni.kit.pip_archive/pip_prebundle/numpy/ma/mrecords.py | """:mod:`numpy.ma..mrecords`
Defines the equivalent of :class:`numpy.recarrays` for masked arrays,
where fields can be accessed as attributes.
Note that :class:`numpy.ma.MaskedArray` already supports structured datatypes
and the masking of individual fields.
.. moduleauthor:: Pierre Gerard-Marchant
"""
# We should ... |
omniverse-code/kit/exts/omni.kit.pip_archive/pip_prebundle/numpy/ma/extras.py | """
Masked arrays add-ons.
A collection of utilities for `numpy.ma`.
:author: Pierre Gerard-Marchant
:contact: pierregm_at_uga_dot_edu
:version: $Id: extras.py 3473 2007-10-29 15:18:13Z jarrod.millman $
"""
__all__ = [
'apply_along_axis', 'apply_over_axes', 'atleast_1d', 'atleast_2d',
'atleast_3d', 'average'... |
omniverse-code/kit/exts/omni.kit.pip_archive/pip_prebundle/numpy/ma/extras.pyi | from typing import Any
from numpy.lib.index_tricks import AxisConcatenator
from numpy.ma.core import (
dot as dot,
mask_rowcols as mask_rowcols,
)
__all__: list[str]
def count_masked(arr, axis=...): ...
def masked_all(shape, dtype = ...): ...
def masked_all_like(arr): ...
class _fromnxfunction:
__name__... |
omniverse-code/kit/exts/omni.kit.pip_archive/pip_prebundle/numpy/ma/__init__.pyi | from numpy._pytesttester import PytestTester
from numpy.ma import extras as extras
from numpy.ma.core import (
MAError as MAError,
MaskError as MaskError,
MaskType as MaskType,
MaskedArray as MaskedArray,
abs as abs,
absolute as absolute,
add as add,
all as all,
allclose as allclos... |
omniverse-code/kit/exts/omni.kit.pip_archive/pip_prebundle/numpy/ma/tests/test_core.py | # pylint: disable-msg=W0400,W0511,W0611,W0612,W0614,R0201,E1102
"""Tests suite for MaskedArray & subclassing.
:author: Pierre Gerard-Marchant
:contact: pierregm_at_uga_dot_edu
"""
__author__ = "Pierre GF Gerard-Marchant"
import sys
import warnings
import operator
import itertools
import textwrap
import pytest
from f... |
omniverse-code/kit/exts/omni.kit.pip_archive/pip_prebundle/numpy/ma/tests/test_deprecations.py | """Test deprecation and future warnings.
"""
import pytest
import numpy as np
from numpy.testing import assert_warns
from numpy.ma.testutils import assert_equal
from numpy.ma.core import MaskedArrayFutureWarning
import io
import textwrap
class TestArgsort:
""" gh-8701 """
def _test_base(self, argsort, cls):
... |
omniverse-code/kit/exts/omni.kit.pip_archive/pip_prebundle/numpy/ma/tests/test_regression.py | import numpy as np
from numpy.testing import (
assert_, assert_array_equal, assert_allclose, suppress_warnings
)
class TestRegression:
def test_masked_array_create(self):
# Ticket #17
x = np.ma.masked_array([0, 1, 2, 3, 0, 4, 5, 6],
mask=[0, 0, 0, 1, 1, 1, 0,... |
omniverse-code/kit/exts/omni.kit.pip_archive/pip_prebundle/numpy/ma/tests/__init__.py | |
omniverse-code/kit/exts/omni.kit.pip_archive/pip_prebundle/numpy/ma/tests/test_extras.py | # pylint: disable-msg=W0611, W0612, W0511
"""Tests suite for MaskedArray.
Adapted from the original test_ma by Pierre Gerard-Marchant
:author: Pierre Gerard-Marchant
:contact: pierregm_at_uga_dot_edu
:version: $Id: test_extras.py 3473 2007-10-29 15:18:13Z jarrod.millman $
"""
import warnings
import itertools
import p... |
omniverse-code/kit/exts/omni.kit.pip_archive/pip_prebundle/numpy/ma/tests/test_mrecords.py | # pylint: disable-msg=W0611, W0612, W0511,R0201
"""Tests suite for mrecords.
:author: Pierre Gerard-Marchant
:contact: pierregm_at_uga_dot_edu
"""
import numpy as np
import numpy.ma as ma
from numpy import recarray
from numpy.ma import masked, nomask
from numpy.testing import temppath
from numpy.core.records import (... |
omniverse-code/kit/exts/omni.kit.pip_archive/pip_prebundle/numpy/ma/tests/test_old_ma.py | from functools import reduce
import pytest
import numpy as np
import numpy.core.umath as umath
import numpy.core.fromnumeric as fromnumeric
from numpy.testing import (
assert_, assert_raises, assert_equal,
)
from numpy.ma import (
MaskType, MaskedArray, absolute, add, all, allclose, allequal, alltrue,
... |
omniverse-code/kit/exts/omni.kit.pip_archive/pip_prebundle/numpy/ma/tests/test_subclassing.py | # pylint: disable-msg=W0611, W0612, W0511,R0201
"""Tests suite for MaskedArray & subclassing.
:author: Pierre Gerard-Marchant
:contact: pierregm_at_uga_dot_edu
:version: $Id: test_subclassing.py 3473 2007-10-29 15:18:13Z jarrod.millman $
"""
import numpy as np
from numpy.lib.mixins import NDArrayOperatorsMixin
from n... |
omniverse-code/kit/exts/omni.kit.pip_archive/pip_prebundle/numpy/testing/print_coercion_tables.py | #!/usr/bin/env python3
"""Prints type-coercion tables for the built-in NumPy types
"""
import numpy as np
from collections import namedtuple
# Generic object that can be added, but doesn't do anything else
class GenericObject:
def __init__(self, v):
self.v = v
def __add__(self, other):
return... |
omniverse-code/kit/exts/omni.kit.pip_archive/pip_prebundle/numpy/testing/__init__.py | """Common test support for all numpy test scripts.
This single module should provide all the common functionality for numpy tests
in a single location, so that test scripts can just import it and work right
away.
"""
from unittest import TestCase
from ._private.utils import *
from ._private.utils import (_assert_val... |
omniverse-code/kit/exts/omni.kit.pip_archive/pip_prebundle/numpy/testing/setup.py | #!/usr/bin/env python3
def configuration(parent_package='',top_path=None):
from numpy.distutils.misc_util import Configuration
config = Configuration('testing', parent_package, top_path)
config.add_subpackage('_private')
config.add_subpackage('tests')
config.add_data_files('*.pyi')
config.add_... |
omniverse-code/kit/exts/omni.kit.pip_archive/pip_prebundle/numpy/testing/utils.py | """
Back compatibility utils module. It will import the appropriate
set of tools
"""
import warnings
# 2018-04-04, numpy 1.15.0 ImportWarning
# 2019-09-18, numpy 1.18.0 DeprecatonWarning (changed)
warnings.warn("Importing from numpy.testing.utils is deprecated "
"since 1.15.0, import from numpy.testing ... |
omniverse-code/kit/exts/omni.kit.pip_archive/pip_prebundle/numpy/testing/__init__.pyi | from numpy._pytesttester import PytestTester
from unittest import (
TestCase as TestCase,
)
from numpy.testing._private.utils import (
assert_equal as assert_equal,
assert_almost_equal as assert_almost_equal,
assert_approx_equal as assert_approx_equal,
assert_array_equal as assert_array_equal,
... |
omniverse-code/kit/exts/omni.kit.pip_archive/pip_prebundle/numpy/testing/_private/noseclasses.py | # These classes implement a doctest runner plugin for nose, a "known failure"
# error class, and a customized TestProgram for NumPy.
# Because this module imports nose directly, it should not
# be used except by nosetester.py to avoid a general NumPy
# dependency on nose.
import os
import sys
import doctest
import ins... |
omniverse-code/kit/exts/omni.kit.pip_archive/pip_prebundle/numpy/testing/_private/parameterized.py | """
tl;dr: all code is licensed under simplified BSD, unless stated otherwise.
Unless stated otherwise in the source files, all code is copyright 2010 David
Wolever <david@wolever.net>. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that th... |
omniverse-code/kit/exts/omni.kit.pip_archive/pip_prebundle/numpy/testing/_private/utils.pyi | import os
import sys
import ast
import types
import warnings
import unittest
import contextlib
from re import Pattern
from collections.abc import Callable, Iterable, Sequence
from typing import (
Literal as L,
Any,
AnyStr,
ClassVar,
NoReturn,
overload,
type_check_only,
TypeVar,
Union... |
omniverse-code/kit/exts/omni.kit.pip_archive/pip_prebundle/numpy/testing/_private/__init__.py | |
omniverse-code/kit/exts/omni.kit.pip_archive/pip_prebundle/numpy/testing/_private/utils.py | """
Utility function to facilitate testing.
"""
import os
import sys
import platform
import re
import gc
import operator
import warnings
from functools import partial, wraps
import shutil
import contextlib
from tempfile import mkdtemp, mkstemp
from unittest.case import SkipTest
from warnings import WarningMessage
impo... |
omniverse-code/kit/exts/omni.kit.pip_archive/pip_prebundle/numpy/testing/_private/decorators.py | """
Decorators for labeling and modifying behavior of test objects.
Decorators that merely return a modified version of the original
function object are straightforward. Decorators that return a new
function object need to use
::
nose.tools.make_decorator(original_function)(decorator)
in returning the decorator, i... |
omniverse-code/kit/exts/omni.kit.pip_archive/pip_prebundle/numpy/testing/_private/extbuild.py | """
Build a c-extension module on-the-fly in tests.
See build_and_import_extensions for usage hints
"""
import os
import pathlib
import sys
import sysconfig
__all__ = ['build_and_import_extension', 'compile_extension_module']
def build_and_import_extension(
modname, functions, *, prologue="", build_dir=Non... |
omniverse-code/kit/exts/omni.kit.pip_archive/pip_prebundle/numpy/testing/_private/nosetester.py | """
Nose test running.
This module implements ``test()`` and ``bench()`` functions for NumPy modules.
"""
import os
import sys
import warnings
import numpy as np
from .utils import import_nose, suppress_warnings
__all__ = ['get_package_name', 'run_module_suite', 'NoseTester',
'_numpy_tester', 'get_packa... |
omniverse-code/kit/exts/omni.kit.pip_archive/pip_prebundle/numpy/testing/tests/__init__.py | |
omniverse-code/kit/exts/omni.kit.pip_archive/pip_prebundle/numpy/testing/tests/test_utils.py | import warnings
import sys
import os
import itertools
import pytest
import weakref
import numpy as np
from numpy.testing import (
assert_equal, assert_array_equal, assert_almost_equal,
assert_array_almost_equal, assert_array_less, build_err_msg, raises,
assert_raises, assert_warns, assert_no_warnings, asse... |
omniverse-code/kit/exts/omni.kit.pip_archive/pip_prebundle/numpy/testing/tests/test_doctesting.py | """ Doctests for NumPy-specific nose/doctest modifications
"""
#FIXME: None of these tests is run, because 'check' is not a recognized
# testing prefix.
# try the #random directive on the output line
def check_random_directive():
'''
>>> 2+2
<BadExample object at 0x084D05AC> #random: may vary on your sys... |
omniverse-code/kit/exts/omni.kit.pip_archive/pip_prebundle/numpy/_pyinstaller/test_pyinstaller.py | import subprocess
from pathlib import Path
import pytest
# PyInstaller has been very unproactive about replacing 'imp' with 'importlib'.
@pytest.mark.filterwarnings('ignore::DeprecationWarning')
# It also leaks io.BytesIO()s.
@pytest.mark.filterwarnings('ignore::ResourceWarning')
@pytest.mark.parametrize("mode", ["-... |
omniverse-code/kit/exts/omni.kit.pip_archive/pip_prebundle/numpy/_pyinstaller/pyinstaller-smoke.py | """A crude *bit of everything* smoke test to verify PyInstaller compatibility.
PyInstaller typically goes wrong by forgetting to package modules, extension
modules or shared libraries. This script should aim to touch as many of those
as possible in an attempt to trip a ModuleNotFoundError or a DLL load failure
due to ... |
omniverse-code/kit/exts/omni.kit.pip_archive/pip_prebundle/numpy/_pyinstaller/__init__.py | |
omniverse-code/kit/exts/omni.kit.pip_archive/pip_prebundle/numpy/_pyinstaller/hook-numpy.py | """This hook should collect all binary files and any hidden modules that numpy
needs.
Our (some-what inadequate) docs for writing PyInstaller hooks are kept here:
https://pyinstaller.readthedocs.io/en/stable/hooks.html
"""
from PyInstaller.compat import is_conda, is_pure_conda
from PyInstaller.utils.hooks import coll... |
omniverse-code/kit/exts/omni.kit.pip_archive/pip_prebundle/numpy/f2py/__version__.py | from numpy.version import version
|
omniverse-code/kit/exts/omni.kit.pip_archive/pip_prebundle/numpy/f2py/func2subr.py | #!/usr/bin/env python3
"""
Rules for building C/API module with f2py2e.
Copyright 1999,2000 Pearu Peterson all rights reserved,
Pearu Peterson <pearu@ioc.ee>
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 RI... |
omniverse-code/kit/exts/omni.kit.pip_archive/pip_prebundle/numpy/f2py/cfuncs.py | #!/usr/bin/env python3
"""
C declarations, CPP macros, and C functions for f2py2e.
Only required declarations/macros/functions will be used.
Copyright 1999,2000 Pearu Peterson all rights reserved,
Pearu Peterson <pearu@ioc.ee>
Permission to use, modify, and distribute this software is given under the
terms of the Num... |
omniverse-code/kit/exts/omni.kit.pip_archive/pip_prebundle/numpy/f2py/symbolic.py | """Fortran/C symbolic expressions
References:
- J3/21-007: Draft Fortran 202x. https://j3-fortran.org/doc/year/21/21-007.pdf
"""
# To analyze Fortran expressions to solve dimensions specifications,
# for instances, we implement a minimal symbolic engine for parsing
# expressions into a tree of expression instances. A... |
omniverse-code/kit/exts/omni.kit.pip_archive/pip_prebundle/numpy/f2py/__init__.py | #!/usr/bin/env python3
"""Fortran to Python Interface Generator.
"""
__all__ = ['run_main', 'compile', 'get_include']
import sys
import subprocess
import os
from . import f2py2e
from . import diagnose
run_main = f2py2e.run_main
main = f2py2e.main
def compile(source,
modulename='untitled',
... |
omniverse-code/kit/exts/omni.kit.pip_archive/pip_prebundle/numpy/f2py/capi_maps.py | #!/usr/bin/env python3
"""
Copyright 1999,2000 Pearu Peterson all rights reserved,
Pearu Peterson <pearu@ioc.ee>
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.
$Date: 2005/05/06 10:57:33 $
Pearu Peterso... |
omniverse-code/kit/exts/omni.kit.pip_archive/pip_prebundle/numpy/f2py/setup.py | #!/usr/bin/env python3
"""
setup.py for installing F2PY
Usage:
pip install .
Copyright 2001-2005 Pearu Peterson all rights reserved,
Pearu Peterson <pearu@cens.ioc.ee>
Permission to use, modify, and distribute this software is given under the
terms of the NumPy License.
NO WARRANTY IS EXPRESSED OR IMPLIED. USE A... |
omniverse-code/kit/exts/omni.kit.pip_archive/pip_prebundle/numpy/f2py/f90mod_rules.py | #!/usr/bin/env python3
"""
Build F90 module support for f2py2e.
Copyright 2000 Pearu Peterson all rights reserved,
Pearu Peterson <pearu@ioc.ee>
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.
$Date: 20... |
omniverse-code/kit/exts/omni.kit.pip_archive/pip_prebundle/numpy/f2py/common_rules.py | #!/usr/bin/env python3
"""
Build common block mechanism for f2py2e.
Copyright 2000 Pearu Peterson all rights reserved,
Pearu Peterson <pearu@ioc.ee>
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.
$Date:... |
omniverse-code/kit/exts/omni.kit.pip_archive/pip_prebundle/numpy/f2py/rules.py | #!/usr/bin/env python3
"""
Rules for building C/API module with f2py2e.
Here is a skeleton of a new wrapper function (13Dec2001):
wrapper_function(args)
declarations
get_python_arguments, say, `a' and `b'
get_a_from_python
if (successful) {
get_b_from_python
if (successful) {
callfortran
... |
omniverse-code/kit/exts/omni.kit.pip_archive/pip_prebundle/numpy/f2py/f2py2e.py | #!/usr/bin/env python3
"""
f2py2e - Fortran to Python C/API generator. 2nd Edition.
See __usage__ below.
Copyright 1999--2011 Pearu Peterson all rights reserved,
Pearu Peterson <pearu@cens.ioc.ee>
Permission to use, modify, and distribute this software is given under the
terms of the NumPy License.
NO WARRA... |
omniverse-code/kit/exts/omni.kit.pip_archive/pip_prebundle/numpy/f2py/diagnose.py | #!/usr/bin/env python3
import os
import sys
import tempfile
def run_command(cmd):
print('Running %r:' % (cmd))
os.system(cmd)
print('------')
def run():
_path = os.getcwd()
os.chdir(tempfile.gettempdir())
print('------')
print('os.name=%r' % (os.name))
print('------')
print('sys.... |
omniverse-code/kit/exts/omni.kit.pip_archive/pip_prebundle/numpy/f2py/cb_rules.py | #!/usr/bin/env python3
"""
Build call-back mechanism for f2py2e.
Copyright 2000 Pearu Peterson all rights reserved,
Pearu Peterson <pearu@ioc.ee>
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.
$Date: 2... |
omniverse-code/kit/exts/omni.kit.pip_archive/pip_prebundle/numpy/f2py/auxfuncs.py | #!/usr/bin/env python3
"""
Auxiliary functions for f2py2e.
Copyright 1999,2000 Pearu Peterson all rights reserved,
Pearu Peterson <pearu@ioc.ee>
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 RI... |
omniverse-code/kit/exts/omni.kit.pip_archive/pip_prebundle/numpy/f2py/__init__.pyi | 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[s... |
omniverse-code/kit/exts/omni.kit.pip_archive/pip_prebundle/numpy/f2py/__main__.py | # See:
# https://web.archive.org/web/20140822061353/http://cens.ioc.ee/projects/f2py2e
from numpy.f2py.f2py2e import main
main()
|
omniverse-code/kit/exts/omni.kit.pip_archive/pip_prebundle/numpy/f2py/crackfortran.py | #!/usr/bin/env python3
"""
crackfortran --- read fortran (77,90) code and extract declaration information.
Copyright 1999-2004 Pearu Peterson all rights reserved,
Pearu Peterson <pearu@ioc.ee>
Permission to use, modify, and distribute this software is given under the
terms of the NumPy License.
NO WARRANTY IS EXPRESS... |
omniverse-code/kit/exts/omni.kit.pip_archive/pip_prebundle/numpy/f2py/use_rules.py | #!/usr/bin/env python3
"""
Build 'use others module data' mechanism for f2py2e.
Unfinished.
Copyright 2000 Pearu Peterson all rights reserved,
Pearu Peterson <pearu@ioc.ee>
Permission to use, modify, and distribute this software is given under the
terms of the NumPy License.
NO WARRANTY IS EXPRESSED OR IMPLIED. US... |
omniverse-code/kit/exts/omni.kit.pip_archive/pip_prebundle/numpy/f2py/src/fortranobject.h | #ifndef Py_FORTRANOBJECT_H
#define Py_FORTRANOBJECT_H
#ifdef __cplusplus
extern "C" {
#endif
#include <Python.h>
#ifdef FORTRANOBJECT_C
#define NO_IMPORT_ARRAY
#endif
#define PY_ARRAY_UNIQUE_SYMBOL _npy_f2py_ARRAY_API
#include "numpy/arrayobject.h"
#include "numpy/npy_3kcompat.h"
#ifdef F2PY_REPORT_ATEXIT
#include <... |
omniverse-code/kit/exts/omni.kit.pip_archive/pip_prebundle/numpy/f2py/src/fortranobject.c | #define FORTRANOBJECT_C
#include "fortranobject.h"
#ifdef __cplusplus
extern "C" {
#endif
#include <stdlib.h>
#include <string.h>
/*
This file implements: FortranObject, array_from_pyobj, copy_ND_array
Author: Pearu Peterson <pearu@cens.ioc.ee>
$Revision: 1.52 $
$Date: 2005/07/11 07:44:20 $
*/
int
F2PyDict... |
omniverse-code/kit/exts/omni.kit.pip_archive/pip_prebundle/numpy/f2py/tests/test_common.py | import os
import sys
import pytest
import numpy as np
from . import util
class TestCommonBlock(util.F2PyTest):
sources = [util.getpath("tests", "src", "common", "block.f")]
@pytest.mark.skipif(sys.platform == "win32",
reason="Fails with MinGW64 Gfortran (Issue #9673)")
def test_c... |
omniverse-code/kit/exts/omni.kit.pip_archive/pip_prebundle/numpy/f2py/tests/test_string.py | import os
import pytest
import textwrap
import numpy as np
from . import util
class TestString(util.F2PyTest):
sources = [util.getpath("tests", "src", "string", "char.f90")]
@pytest.mark.slow
def test_char(self):
strings = np.array(["ab", "cd", "ef"], dtype="c").T
inp, out = self.module.c... |
omniverse-code/kit/exts/omni.kit.pip_archive/pip_prebundle/numpy/f2py/tests/util.py | """
Utility functions for
- building and importing modules on test time, using a temporary location
- detecting if compilers are present
- determining paths to tests
"""
import os
import sys
import subprocess
import tempfile
import shutil
import atexit
import textwrap
import re
import pytest
import contextlib
import ... |
omniverse-code/kit/exts/omni.kit.pip_archive/pip_prebundle/numpy/f2py/tests/test_f2cmap.py | from . import util
import numpy as np
class TestF2Cmap(util.F2PyTest):
sources = [
util.getpath("tests", "src", "f2cmap", "isoFortranEnvMap.f90"),
util.getpath("tests", "src", "f2cmap", ".f2py_f2cmap")
]
# gh-15095
def test_long_long_map(self):
inp = np.ones(3)
out = se... |
omniverse-code/kit/exts/omni.kit.pip_archive/pip_prebundle/numpy/f2py/tests/test_semicolon_split.py | import platform
import pytest
import numpy as np
from . import util
@pytest.mark.skipif(
platform.system() == "Darwin",
reason="Prone to error when run with numpy/f2py/tests on mac os, "
"but not when run in isolation",
)
@pytest.mark.skipif(
np.dtype(np.intp).itemsize < 8,
reason="32-bit builds ... |
omniverse-code/kit/exts/omni.kit.pip_archive/pip_prebundle/numpy/f2py/tests/test_abstract_interface.py | from pathlib import Path
import textwrap
from . import util
from numpy.f2py import crackfortran
class TestAbstractInterface(util.F2PyTest):
sources = [util.getpath("tests", "src", "abstract_interface", "foo.f90")]
skip = ["add1", "add2"]
def test_abstract_interface(self):
assert self.module.ops_... |
omniverse-code/kit/exts/omni.kit.pip_archive/pip_prebundle/numpy/f2py/tests/test_return_complex.py | import pytest
from numpy import array
from . import util
class TestReturnComplex(util.F2PyTest):
def check_function(self, t, tname):
if tname in ["t0", "t8", "s0", "s8"]:
err = 1e-5
else:
err = 0.0
assert abs(t(234j) - 234.0j) <= err
assert abs(t(234.6) - 2... |
omniverse-code/kit/exts/omni.kit.pip_archive/pip_prebundle/numpy/f2py/tests/test_return_integer.py | import pytest
from numpy import array
from . import util
class TestReturnInteger(util.F2PyTest):
def check_function(self, t, tname):
assert t(123) == 123
assert t(123.6) == 123
assert t("123") == 123
assert t(-123) == -123
assert t([123]) == 123
assert t((123, )) =... |
omniverse-code/kit/exts/omni.kit.pip_archive/pip_prebundle/numpy/f2py/tests/test_regression.py | import os
import pytest
import numpy as np
from . import util
class TestIntentInOut(util.F2PyTest):
# Check that intent(in out) translates as intent(inout)
sources = [util.getpath("tests", "src", "regression", "inout.f90")]
@pytest.mark.slow
def test_inout(self):
# non-contiguous should rai... |
omniverse-code/kit/exts/omni.kit.pip_archive/pip_prebundle/numpy/f2py/tests/__init__.py | |
omniverse-code/kit/exts/omni.kit.pip_archive/pip_prebundle/numpy/f2py/tests/test_parameter.py | import os
import pytest
import numpy as np
from . import util
class TestParameters(util.F2PyTest):
# Check that intent(in out) translates as intent(inout)
sources = [
util.getpath("tests", "src", "parameter", "constant_real.f90"),
util.getpath("tests", "src", "parameter", "constant_integer.f... |
omniverse-code/kit/exts/omni.kit.pip_archive/pip_prebundle/numpy/f2py/tests/test_kind.py | import os
import pytest
from numpy.f2py.crackfortran import (
_selected_int_kind_func as selected_int_kind,
_selected_real_kind_func as selected_real_kind,
)
from . import util
class TestKind(util.F2PyTest):
sources = [util.getpath("tests", "src", "kind", "foo.f90")]
def test_all(self):
sele... |
omniverse-code/kit/exts/omni.kit.pip_archive/pip_prebundle/numpy/f2py/tests/test_crackfortran.py | import pytest
import numpy as np
from numpy.f2py.crackfortran import markinnerspaces
from . import util
from numpy.f2py import crackfortran
import textwrap
class TestNoSpace(util.F2PyTest):
# issue gh-15035: add handling for endsubroutine, endfunction with no space
# between "end" and the block name
sourc... |
omniverse-code/kit/exts/omni.kit.pip_archive/pip_prebundle/numpy/f2py/tests/test_symbolic.py | import pytest
from numpy.f2py.symbolic import (
Expr,
Op,
ArithOp,
Language,
as_symbol,
as_number,
as_string,
as_array,
as_complex,
as_terms,
as_factors,
eliminate_quotes,
insert_quotes,
fromstring,
as_expr,
as_apply,
as_numer_denom,
as_ternary,
... |
omniverse-code/kit/exts/omni.kit.pip_archive/pip_prebundle/numpy/f2py/tests/test_quoted_character.py | """See https://github.com/numpy/numpy/pull/10676.
"""
import sys
import pytest
from . import util
class TestQuotedCharacter(util.F2PyTest):
sources = [util.getpath("tests", "src", "quoted_character", "foo.f")]
@pytest.mark.skipif(sys.platform == "win32",
reason="Fails with MinGW64 G... |
omniverse-code/kit/exts/omni.kit.pip_archive/pip_prebundle/numpy/f2py/tests/test_return_character.py | import pytest
from numpy import array
from . import util
import platform
IS_S390X = platform.machine() == "s390x"
class TestReturnCharacter(util.F2PyTest):
def check_function(self, t, tname):
if tname in ["t0", "t1", "s0", "s1"]:
assert t(23) == b"2"
r = t("ab")
asser... |
omniverse-code/kit/exts/omni.kit.pip_archive/pip_prebundle/numpy/f2py/tests/test_f2py2e.py | import textwrap, re, sys, subprocess, shlex
from pathlib import Path
from collections import namedtuple
import pytest
from . import util
from numpy.f2py.f2py2e import main as f2pycli
#########################
# CLI utils and classes #
#########################
PPaths = namedtuple("PPaths", "finp, f90inp, pyf, wrap7... |
omniverse-code/kit/exts/omni.kit.pip_archive/pip_prebundle/numpy/f2py/tests/test_return_logical.py | import pytest
from numpy import array
from . import util
class TestReturnLogical(util.F2PyTest):
def check_function(self, t):
assert t(True) == 1
assert t(False) == 0
assert t(0) == 0
assert t(None) == 0
assert t(0.0) == 0
assert t(0j) == 0
assert t(1j) == ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.