diff options
author | Eric Wieser <wieser.eric@gmail.com> | 2017-03-22 16:24:28 +0000 |
---|---|---|
committer | Eric Wieser <wieser.eric@gmail.com> | 2017-03-23 11:29:48 +0000 |
commit | 06c7142f45a27d3e2e4e9ad4a01715e3da11f67b (patch) | |
tree | 23bfec2ddec259c2b6b4198f248cf7f2f6834568 /numpy/lib/npyio.py | |
parent | ebb3618c3911e5b3006c99c5f89df104a1b0d917 (diff) | |
download | numpy-06c7142f45a27d3e2e4e9ad4a01715e3da11f67b.tar.gz |
MAINT: Rename function to prevent name-shadowing
This file had two functions called flatten_dtype, which did similar but
different things.
Diffstat (limited to 'numpy/lib/npyio.py')
-rw-r--r-- | numpy/lib/npyio.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/numpy/lib/npyio.py b/numpy/lib/npyio.py index 0dee6b333..54a37fbad 100644 --- a/numpy/lib/npyio.py +++ b/numpy/lib/npyio.py @@ -902,7 +902,8 @@ def loadtxt(fname, dtype=float, comments='#', delimiter=None, raise ValueError('fname must be a string, file handle, or generator') X = [] - def flatten_dtype(dt): + # not to be confused with the flatten_dtype we import... + def flatten_dtype_internal(dt): """Unpack a structured data-type, and produce re-packing info.""" if dt.names is None: # If the dtype is flattened, return. @@ -922,7 +923,7 @@ def loadtxt(fname, dtype=float, comments='#', delimiter=None, packing = [] for field in dt.names: tp, bytes = dt.fields[field] - flat_dt, flat_packing = flatten_dtype(tp) + flat_dt, flat_packing = flatten_dtype_internal(tp) types.extend(flat_dt) # Avoid extra nesting for subarrays if tp.ndim > 0: @@ -986,7 +987,7 @@ def loadtxt(fname, dtype=float, comments='#', delimiter=None, warnings.warn('loadtxt: Empty input file: "%s"' % fname, stacklevel=2) N = len(usecols or first_vals) - dtype_types, packing = flatten_dtype(dtype) + dtype_types, packing = flatten_dtype_internal(dtype) if len(dtype_types) > 1: # We're dealing with a structured array, each field of # the dtype matches a column |