Skip to content

Tuple/List traits deprecation warning raised in "ImagePlot" #844

@rahulporuri

Description

@rahulporuri

Problem Description

The following traits deprecation warning is raised in our application that makes use of ImagePlot. This seems to be because a trait defined as a Union(Tuple, List) is being set a list, which traits seems to be coercing into a tuple instead of accepting the list as is.

C:\Users\rporuri\.edm\envs\<env-name>\lib\site-packages\traits\trait_types.py:4245: DeprecationWarning: In the future, lists will no longer be accepted by the Tuple trait type. Lists should be converted to tuples prior to validation.
  return trait_type_instance.validate(obj, name, value)

# Tuple-defined rectangle (x, y, dx, dy) in screen space in which the
# **_cached_image** is to be drawn.
_cached_dest_rect = Union(Tuple, List, transient=True)

self._cached_dest_rect = screen_rect

where screen_rect is a list, not a tuple.

def trim_screen_rect(screen_rect, view_rect, sub_array_size):

Reproduction Steps:

N/A

OS, Python version: Windows 11, Python 3.8.12+3

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions