Skip to content

Commit

Permalink
Fix codestyle
Browse files Browse the repository at this point in the history
  • Loading branch information
astrofrog committed Aug 3, 2023
1 parent 47332b1 commit 375ef22
Show file tree
Hide file tree
Showing 10 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion glue/app/qt/tests/test_application.py
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ def check_clone_app(app):
for tab1, tab2 in zip(app.viewers, copy.viewers):
assert len(tab1) == len(tab2)
for v1, v2 in zip(tab1, tab2):
assert type(v1) == type(v2)
assert type(v1) is type(v2)
# same window properties
assert v1.viewer_size == v2.viewer_size
assert v1.position == v2.position
Expand Down
2 changes: 1 addition & 1 deletion glue/core/data_derived.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def indices(self, value):
changed = False
for idim in range(self._original_data.ndim):
before, after = self._indices[idim], value[idim]
if type(before) != type(after):
if type(before) is not type(after):
raise TypeError("Can't change where the ``None`` values are in indices")
elif before != after:
changed = True
Expand Down
2 changes: 1 addition & 1 deletion glue/core/data_factories/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ def reload(self):
mapping = dict((c, log.component(self.id(c)).data)
for c in dold._components.values()
if c in self.components and
type(c) == Component)
type(c) is Component)
dold.coords = dnew.coords
dold.update_components(mapping)

Expand Down
2 changes: 1 addition & 1 deletion glue/core/layer_artist.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ def on_changed(self, func):

def _duplicate(self, artist):
for a in self.artists:
if type(a) == type(artist) and a.layer is artist.layer:
if type(a) is type(artist) and a.layer is artist.layer:

Check warning on line 268 in glue/core/layer_artist.py

View check run for this annotation

Codecov / codecov/patch

glue/core/layer_artist.py#L268

Added line #L268 was not covered by tests
return True
return False

Expand Down
2 changes: 1 addition & 1 deletion glue/core/qt/data_collection_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ def label(self, value):

@property
def tooltip(self):
if type(self.subset_group.subset_state) == core.subset.SubsetState:
if type(self.subset_group.subset_state) is core.subset.SubsetState:

Check warning on line 182 in glue/core/qt/data_collection_model.py

View check run for this annotation

Codecov / codecov/patch

glue/core/qt/data_collection_model.py#L182

Added line #L182 was not covered by tests
return "Empty subset"

atts = self.subset_group.subset_state.attributes
Expand Down
10 changes: 5 additions & 5 deletions glue/core/tests/test_coordinates.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,31 +170,31 @@ class TestCoordinatesFromHeader(object):
def test_2d_nowcs(self):
hdr = {"NAXIS": 2}
coord = coordinates_from_header(hdr)
assert type(coord) == IdentityCoordinates
assert type(coord) is IdentityCoordinates
assert coord.pixel_n_dim == 2
assert coord.world_n_dim == 2

def test_2d(self):
hdr = header_from_string(HDR_2D_VALID)
coord = coordinates_from_header(hdr)
assert type(coord) == WCSCoordinates
assert type(coord) is WCSCoordinates

def test_3d_nowcs(self):
hdr = HDR_3D_VALID_NOWCS
coord = coordinates_from_header(header_from_string(hdr))
assert type(coord) == IdentityCoordinates
assert type(coord) is IdentityCoordinates
assert coord.pixel_n_dim == 3
assert coord.world_n_dim == 3

def test_3d(self):
hdr = header_from_string(HDR_3D_VALID_WCS)
coord = coordinates_from_header(hdr)
assert type(coord) == WCSCoordinates
assert type(coord) is WCSCoordinates

def test_nod(self):
hdr = 0
coord = coordinates_from_header(hdr)
assert type(coord) == IdentityCoordinates
assert type(coord) is IdentityCoordinates


HDR_2D_VALID = """
Expand Down
8 changes: 4 additions & 4 deletions glue/core/tests/test_link_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ def example_components(self, add_derived=True):

dummy_using = lambda x, y: (x, y)
self.cs = [c1, c2, c3, c4, c5, c6, c7, c8]
self.links = [ComponentLink([c1], c3, lambda x:x),
ComponentLink([c2], c4, lambda x:x),
ComponentLink([c3], c1, lambda x:x),
ComponentLink([c4], c2, lambda x:x),
self.links = [ComponentLink([c1], c3, lambda x: x),
ComponentLink([c2], c4, lambda x: x),
ComponentLink([c3], c1, lambda x: x),
ComponentLink([c4], c2, lambda x: x),
ComponentLink([c3, c4], c5, dummy_using),
ComponentLink([c3, c4], c6, dummy_using)]

Expand Down
2 changes: 1 addition & 1 deletion glue/core/tests/test_subset.py
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ def assert_composite_copy(self, cls):
s1 = cls(state1, state2)
s2 = s1.copy()

assert type(s1) == type(s2)
assert type(s1) is type(s2)
assert s1.state1.copy() is s2.state1
assert s1.state2.copy() is s2.state2

Expand Down
2 changes: 1 addition & 1 deletion glue/viewers/image/qt/slice_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def sync_sliders_from_state(self, *args):
# but we will need to generalize this in future. We deliberately
# check the type of data.coords here since we want to treat
# subclasses differently.
if getattr(self.data, 'coords') is not None and type(self.data.coords) != LegacyCoordinates:
if getattr(self.data, 'coords') is not None and type(self.data.coords) is not LegacyCoordinates:
world_axis_index = self.data.ndim - 1 - i
world = world_axis(self.data.coords, self.data,
pixel_axis=world_axis_index,
Expand Down
2 changes: 1 addition & 1 deletion glue/viewers/image/viewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ def _set_wcs(self, before=None, after=None, relim=True):
self.state.reset_limits()

# Determine whether changing slices requires changing the WCS
if ref_coords is None or type(ref_coords) == Coordinates:
if ref_coords is None or type(ref_coords) is Coordinates:
self._changing_slice_requires_wcs_update = False
else:
ix = self.state.x_att.axis
Expand Down

0 comments on commit 375ef22

Please sign in to comment.