diff options
| author | Eric Wieser <wieser.eric@gmail.com> | 2018-12-01 10:15:57 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-12-01 10:15:57 -0800 |
| commit | e0122a4fc3bf9453220c2802a50c253a381b59c9 (patch) | |
| tree | 24f7828dc7feeba92d6ca739b132818847952b18 /numpy/lib | |
| parent | 0ee245bc6df60b911fafe81a743ec2a68a063c20 (diff) | |
| parent | e4c14fb48851bc38d59c57dd2c2ed4993f7f8a42 (diff) | |
| download | numpy-e0122a4fc3bf9453220c2802a50c253a381b59c9.tar.gz | |
Merge pull request #12443 from rth/set-litteral
MAINT Use set litterals
Diffstat (limited to 'numpy/lib')
| -rw-r--r-- | numpy/lib/_iotools.py | 2 | ||||
| -rw-r--r-- | numpy/lib/npyio.py | 4 | ||||
| -rw-r--r-- | numpy/lib/tests/test__iotools.py | 2 | ||||
| -rw-r--r-- | numpy/lib/tests/test_shape_base.py | 4 |
4 files changed, 6 insertions, 6 deletions
diff --git a/numpy/lib/_iotools.py b/numpy/lib/_iotools.py index b604b8c52..d5d990a9a 100644 --- a/numpy/lib/_iotools.py +++ b/numpy/lib/_iotools.py @@ -693,7 +693,7 @@ class StringConverter(object): self.func = lambda x: int(float(x)) # Store the list of strings corresponding to missing values. if missing_values is None: - self.missing_values = set(['']) + self.missing_values = {''} else: if isinstance(missing_values, basestring): missing_values = missing_values.split(",") diff --git a/numpy/lib/npyio.py b/numpy/lib/npyio.py index f623c58e7..db6a8e5eb 100644 --- a/numpy/lib/npyio.py +++ b/numpy/lib/npyio.py @@ -2126,10 +2126,10 @@ def genfromtxt(fname, dtype=float, comments='#', delimiter=None, if names is None: # If the dtype is uniform (before sizing strings) - base = set([ + base = { c_type for c, c_type in zip(converters, column_types) - if c._checked]) + if c._checked} if len(base) == 1: uniform_type, = base (ddtype, mdtype) = (uniform_type, bool) diff --git a/numpy/lib/tests/test__iotools.py b/numpy/lib/tests/test__iotools.py index b4888f1bd..2d090709a 100644 --- a/numpy/lib/tests/test__iotools.py +++ b/numpy/lib/tests/test__iotools.py @@ -246,7 +246,7 @@ class TestStringConverter(object): converter = StringConverter(int, default=0, missing_values="N/A") assert_equal( - converter.missing_values, set(['', 'N/A'])) + converter.missing_values, {'', 'N/A'}) def test_int64_dtype(self): "Check that int64 integer types can be specified" diff --git a/numpy/lib/tests/test_shape_base.py b/numpy/lib/tests/test_shape_base.py index e338467f9..01ea028bb 100644 --- a/numpy/lib/tests/test_shape_base.py +++ b/numpy/lib/tests/test_shape_base.py @@ -260,8 +260,8 @@ class TestApplyAlongAxis(object): def test_with_iterable_object(self): # from issue 5248 d = np.array([ - [set([1, 11]), set([2, 22]), set([3, 33])], - [set([4, 44]), set([5, 55]), set([6, 66])] + [{1, 11}, {2, 22}, {3, 33}], + [{4, 44}, {5, 55}, {6, 66}] ]) actual = np.apply_along_axis(lambda a: set.union(*a), 0, d) expected = np.array([{1, 11, 4, 44}, {2, 22, 5, 55}, {3, 33, 6, 66}]) |
