Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into fix78-c+11std
Browse files Browse the repository at this point in the history
  • Loading branch information
jobovy committed Aug 22, 2023
2 parents 263c0e3 + a2ec608 commit 24fc12a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
12 changes: 8 additions & 4 deletions esutil/numpy_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -764,8 +764,10 @@ def remove_fields(arr, rmnames):
REVISION HISTORY:
Created 2007, Erin Sheldon, NYU.
"""
if type(rmnames) != list:

if not isinstance(rmnames, list):
rmnames = [rmnames]

descr = arr.dtype.descr
new_descr = []
for d in descr:
Expand Down Expand Up @@ -827,7 +829,7 @@ def add_fields(arr, add_dtype_or_descr, defaults=None):

# See if the user has indicated default values for the new fields
if defaults is not None:
if type(defaults) != list:
if not isinstance(defaults, list):
defaults = [defaults]
if len(defaults) != len(add_descr):
raise ValueError("defaults must be same length as new dtype")
Expand Down Expand Up @@ -923,10 +925,12 @@ def copy_fields_by_name(arr, names, vals):
Created 2007, Erin Sheldon, NYU.
"""
if type(names) != list and type(names) != np.ndarray:
if not isinstance(names, (list, np.ndarray)):
names = [names]
if type(vals) != list and type(vals) != np.ndarray:

if not isinstance(vals, (list, np.ndarray)):
vals = [vals]

if len(names) != len(vals):
raise ValueError("Length of names and values must be the same")

Expand Down
2 changes: 1 addition & 1 deletion esutil/wcsutil.py
Original file line number Diff line number Diff line change
Expand Up @@ -908,7 +908,7 @@ def ConvertWCS(self, wcs_in):
# Convert the wcs to a local dictionary

wcs = {}
if type(wcs_in) == np.ndarray or hasattr(wcs_in, "dtype"):
if isinstance(wcs_in, np.ndarray) or hasattr(wcs_in, "dtype"):
if wcs_in.dtype.fields is None:
raise ValueError("wcs array must have fields")

Expand Down
4 changes: 1 addition & 3 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import os
import time
from sys import stdout
from glob import glob
import platform
import tempfile
Expand Down Expand Up @@ -286,7 +284,7 @@ def build_extensions(self):
packages=packages,
cmdclass={"build_ext": MyBuilder},
ext_modules=ext_modules,
install_requires=['numpy','scipy'],
install_requires=['numpy', 'scipy'],
)

# If we get to here, then all was fine. Go ahead and delete the files in the
Expand Down

0 comments on commit 24fc12a

Please sign in to comment.