@@ -149,8 +149,8 @@ def __init__(self, ndcube=None):
149149
150150 # Lookup tables is a list of (pixel_dim, LookupTableCoord) to allow for
151151 # one pixel dimension having more than one lookup coord.
152- self ._lookup_tables = list ()
153- self ._dropped_tables = list ()
152+ self ._lookup_tables = []
153+ self ._dropped_tables = []
154154
155155 # We need a reference to the parent NDCube
156156 self ._ndcube = ndcube
@@ -230,8 +230,8 @@ def add(self, name, array_dimension, lookup_table, physical_types=None, **kwargs
230230 self ._lookup_tables .append ((array_dimension , coord ))
231231
232232 # Sort the LUTs so that the mapping and the wcs are ordered in pixel dim order
233- self ._lookup_tables = list ( sorted (self ._lookup_tables ,
234- key = lambda x : x [0 ] if isinstance (x [0 ], Integral ) else x [0 ][0 ]))
233+ self ._lookup_tables = sorted (self ._lookup_tables ,
234+ key = lambda x : x [0 ] if isinstance (x [0 ], Integral ) else x [0 ][0 ])
235235
236236 @property
237237 def _name_lut_map (self ):
@@ -243,7 +243,7 @@ def _name_lut_map(self):
243243 def keys (self ):
244244 # docstring in ABC
245245 if not self .wcs :
246- return tuple ()
246+ return ()
247247
248248 return tuple (self .wcs .world_axis_names ) if self .wcs .world_axis_names else None
249249
@@ -256,7 +256,7 @@ def mapping(self):
256256 # If mapping is not set but lookup_tables is empty then the extra
257257 # coords is empty, so there is no mapping.
258258 if not self ._lookup_tables :
259- return tuple ()
259+ return ()
260260
261261 # The mapping is from the array index (position in the list) to the
262262 # pixel dimensions (numbers in the list)
@@ -292,7 +292,7 @@ def wcs(self):
292292 if not self ._lookup_tables :
293293 return None
294294
295- tcoords = set ( lt [1 ] for lt in self ._lookup_tables )
295+ tcoords = { lt [1 ] for lt in self ._lookup_tables }
296296 # created a sorted list of unique items
297297 _tmp = set () # a temporary set
298298 tcoords = [x [1 ] for x in self ._lookup_tables if x [1 ] not in _tmp and _tmp .add (x [1 ]) is None ]
@@ -323,8 +323,7 @@ def is_empty(self):
323323 # docstring in ABC
324324 if not self ._wcs and not self ._lookup_tables :
325325 return True
326- else :
327- return False
326+ return False
328327
329328 def _getitem_string (self , item ):
330329 """
@@ -402,7 +401,7 @@ def __getitem__(self, item):
402401 if self ._wcs :
403402 return self ._getitem_wcs (item )
404403
405- elif self ._lookup_tables :
404+ if self ._lookup_tables :
406405 return self ._getitem_lookup_tables (item )
407406
408407 # If we get here this object is empty, so just return an empty extra coords
@@ -425,7 +424,7 @@ def dropped_world_dimensions(self):
425424
426425 return mtc .dropped_world_dimensions
427426
428- return dict ()
427+ return {}
429428
430429 def resample (self , factor , offset = 0 , ndcube = None , ** kwargs ):
431430 """
0 commit comments