Skip to content

Commit

Permalink
Merge pull request #497 from ome/pre-commit-ci-update-config
Browse files Browse the repository at this point in the history
[pre-commit.ci] pre-commit autoupdate
  • Loading branch information
jburel authored Aug 21, 2023
2 parents 5457b2d + bc023f9 commit d5e4f84
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ repos:
- id: black
args: [--target-version=py35]
- repo: https://github.com/PyCQA/flake8
rev: 6.0.0
rev: 6.1.0
hooks:
- id: flake8
args: [
Expand Down
2 changes: 1 addition & 1 deletion omeroweb/webgateway/templatetags/common_tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def render(self, context):
if name.isdigit():
setting = setting[int(name)]
else:
if type(setting) == dict:
if isinstance(setting, dict):
setting = setting.get(name)
else:
setting = setting.__getattr__(name)
Expand Down
18 changes: 9 additions & 9 deletions omeroweb/webgateway/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -584,22 +584,22 @@ def get_shape_thumbnail(request, conn, image, s, compress_quality):
theT = theT if theT is not None else image.getDefaultT()
theZ = unwrap(s.getTheZ())
theZ = theZ if theZ is not None else image.getDefaultZ()
if type(s) == omero.model.RectangleI:
if isinstance(s, omero.model.RectangleI):
shape["type"] = "Rectangle"
shape["x"] = s.getX().getValue()
shape["y"] = s.getY().getValue()
shape["width"] = s.getWidth().getValue()
shape["height"] = s.getHeight().getValue()
bBox = (shape["x"], shape["y"], shape["width"], shape["height"])
elif type(s) == omero.model.MaskI:
elif isinstance(s, omero.model.MaskI):
shape["type"] = "Mask"
shape["x"] = s.getX().getValue()
shape["y"] = s.getY().getValue()
shape["width"] = s.getWidth().getValue()
shape["height"] = s.getHeight().getValue()
bBox = (shape["x"], shape["y"], shape["width"], shape["height"])
# TODO: support for mask
elif type(s) == omero.model.EllipseI:
elif isinstance(s, omero.model.EllipseI):
shape["type"] = "Ellipse"
shape["x"] = int(s.getX().getValue())
shape["y"] = int(s.getY().getValue())
Expand All @@ -611,11 +611,11 @@ def get_shape_thumbnail(request, conn, image, s, compress_quality):
2 * shape["radiusX"],
2 * shape["radiusY"],
)
elif type(s) == omero.model.PolylineI:
elif isinstance(s, omero.model.PolylineI):
shape["type"] = "PolyLine"
shape["xyList"] = points_string_to_XY_list(s.getPoints().getValue())
bBox = xy_list_to_bbox(shape["xyList"])
elif type(s) == omero.model.LineI:
elif isinstance(s, omero.model.LineI):
shape["type"] = "Line"
shape["x1"] = int(s.getX1().getValue())
shape["x2"] = int(s.getX2().getValue())
Expand All @@ -629,16 +629,16 @@ def get_shape_thumbnail(request, conn, image, s, compress_quality):
max(shape["x1"], shape["x2"]) - x,
max(shape["y1"], shape["y2"]) - y,
)
elif type(s) == omero.model.PointI:
elif isinstance(s, omero.model.PointI):
shape["type"] = "Point"
shape["x"] = s.getX().getValue()
shape["y"] = s.getY().getValue()
bBox = (shape["x"] - 50, shape["y"] - 50, 100, 100)
elif type(s) == omero.model.PolygonI:
elif isinstance(s, omero.model.PolygonI):
shape["type"] = "Polygon"
shape["xyList"] = points_string_to_XY_list(s.getPoints().getValue())
bBox = xy_list_to_bbox(shape["xyList"])
elif type(s) == omero.model.LabelI:
elif isinstance(s, omero.model.LabelI):
shape["type"] = "Label"
shape["x"] = s.getX().getValue()
shape["y"] = s.getY().getValue()
Expand Down Expand Up @@ -3274,7 +3274,7 @@ def obj_id_bitmask(request, fileid, conn=None, query=None, **kwargs):

def rowsToByteArray(rows):
maxval = 0
if len(rows) > 0 and type(rows[0][0]) == float:
if len(rows) > 0 and isinstance(rows[0][0], float):
raise ValueError("Cannot have ID of float")
for obj in rows:
obj_id = int(obj[0])
Expand Down

0 comments on commit d5e4f84

Please sign in to comment.