From d86609b40211347a61e0403810e9b62aceb19dac Mon Sep 17 00:00:00 2001 From: mhostetter Date: Thu, 24 Mar 2022 12:26:19 -0400 Subject: [PATCH] Fix NumPy capitalization in comments --- galois/_fields/_linalg.py | 4 ++-- galois/_fields/_main.py | 8 ++++---- tests/fields/test_numpy_functions.py | 2 +- tests/helper.py | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/galois/_fields/_linalg.py b/galois/_fields/_linalg.py index f4bdc7fb2..4762a8654 100644 --- a/galois/_fields/_linalg.py +++ b/galois/_fields/_linalg.py @@ -33,7 +33,7 @@ def _lapack_linalg(a, b, function, out=None, n_sum=None): a = a.astype(dtype) b = b.astype(dtype) - # Compute result using native numpy LAPACK/BLAS implementation + # Compute result using native NumPy LAPACK/BLAS implementation if function in [np.inner, np.vdot]: # These functions don't have and `out` keyword argument c = function(a, b) @@ -88,7 +88,7 @@ def vdot(a, b): return _lapack_linalg(a, b, np.vdot) a = a.flatten() - b = b.flatten().reshape(a.shape) # This is done to mimic numpy's error scenarios + b = b.flatten().reshape(a.shape) # This is done to mimic NumPy's error scenarios return np.sum(a * b) diff --git a/galois/_fields/_main.py b/galois/_fields/_main.py index d13c28e0b..0c3d46868 100644 --- a/galois/_fields/_main.py +++ b/galois/_fields/_main.py @@ -1144,7 +1144,7 @@ def _get_dtype(cls, dtype): if dtype is None: return cls.dtypes[0] - # Convert "dtype" to a numpy dtype. This does platform specific conversion, if necessary. + # Convert "dtype" to a NumPy dtype. This does platform specific conversion, if necessary. # For example, np.dtype(int) == np.int64 (on some systems). dtype = np.dtype(dtype) if dtype not in cls.dtypes: @@ -1217,14 +1217,14 @@ def _check_array_types_dtype_object(cls, array): return array if array.ndim == 0: if not isinstance(array[()], (int, np.integer, FieldArray)): - raise TypeError(f"When {cls.name} arrays are created/assigned with a numpy array with `dtype=object`, each element must be an integer. Found type {type(array[()])}.") + raise TypeError(f"When {cls.name} arrays are created/assigned with a NumPy array with `dtype=object`, each element must be an integer. Found type {type(array[()])}.") return int(array) iterator = np.nditer(array, flags=["multi_index", "refs_ok"]) for _ in iterator: a = array[iterator.multi_index] if not isinstance(a, (int, np.integer, FieldArray)): - raise TypeError(f"When {cls.name} arrays are created/assigned with a numpy array with `dtype=object`, each element must be an integer. Found type {type(a)}.") + raise TypeError(f"When {cls.name} arrays are created/assigned with a NumPy array with `dtype=object`, each element must be an integer. Found type {type(a)}.") # Ensure the type is int so dtype=object classes don't get all mixed up array[iterator.multi_index] = int(a) @@ -2430,7 +2430,7 @@ def __array_ufunc__(self, ufunc, method, *inputs, **kwargs): return getattr(field, field._OVERRIDDEN_UFUNCS[ufunc])(ufunc, method, inputs, kwargs, meta) elif ufunc in field._UNSUPPORTED_UFUNCS: - raise NotImplementedError(f"The numpy ufunc {ufunc.__name__!r} is not supported on {field.name} arrays. If you believe this ufunc should be supported, please submit a GitHub issue at https://github.com/mhostetter/galois/issues.") + raise NotImplementedError(f"The NumPy ufunc {ufunc.__name__!r} is not supported on {field.name} arrays. If you believe this ufunc should be supported, please submit a GitHub issue at https://github.com/mhostetter/galois/issues.") else: if ufunc in [np.bitwise_and, np.bitwise_or, np.bitwise_xor] and method not in ["reduce", "accumulate", "at", "reduceat"]: diff --git a/tests/fields/test_numpy_functions.py b/tests/fields/test_numpy_functions.py index 6f6f6f3ae..33b0f7aca 100644 --- a/tests/fields/test_numpy_functions.py +++ b/tests/fields/test_numpy_functions.py @@ -1,5 +1,5 @@ """ -A pytest module to test numpy methods, both supported and unsupported. +A pytest module to test NumPy methods, both supported and unsupported. Numpy methods are selected from this API reference: https://numpy.org/doc/stable/reference/routines.array-manipulation.html """ diff --git a/tests/helper.py b/tests/helper.py index 3c5bcbf5e..1c5fe22f0 100644 --- a/tests/helper.py +++ b/tests/helper.py @@ -4,7 +4,7 @@ def array_equal(a, b): - # Weird numpy comparison bug, see https://github.com/mhostetter/galois/issues/37 + # Weird NumPy comparison bug, see https://github.com/mhostetter/galois/issues/37 if a.dtype == np.object_: return np.array_equal(a, np.array(b, dtype=np.object_)) else: