Audit and Pin down return types of methods across chaco
Problem Description See comment: https://github.com/enthought/chaco/pull/636#issuecomment-816879211
There are many places in chaco where we aren't super consistent about the type being returned by specific methods and this has led to a variety of bugs / issues such as: #255, #272, #289, #550, (possibly) #542
Expected behavior:
The return types should be consistent as defined on the relevant interface or base class to prevent bugs in strange edge cases.
Also, the hittest method on BaseXYPlot returning tuples bothers me a bit
There exist map_data_array methods on all the Mapper classes, but they are not used anywhere in the code base. I imagine their original intention was precisely such a distinction, in that map_data takes float->float, and map_data_array array->array. But most map_data implementations are vectorized, aside from edge cases, so they can do array->array directly.
We should possibly remove the map_data_array methods? The majority of them currently just call self.map_data() anyway. If we keep them we should draw a line in the sand about what returns what. That I imagine could be a hard pill to try to force users to swallow...
As I am investigating this more I become more and more unsure of what the right way to go about this is.. 🤔
Running list of special handling because of discrepancies on input/return types:
- https://github.com/enthought/chaco/blob/8065abbcaeb274407385cf6fff400cc47081d29f/chaco/tools/lasso_selection.py#L323-L327
- https://github.com/enthought/chaco/blob/8065abbcaeb274407385cf6fff400cc47081d29f/chaco/base_xy_plot.py#L443-L446
- https://github.com/enthought/chaco/blob/8065abbcaeb274407385cf6fff400cc47081d29f/chaco/color_bar.py#L156-L157
- https://github.com/enthought/chaco/blob/3259e05a73be3e7ef51a0397ff629a9341907b07/chaco/scatterplot.py#L341-L343
- https://github.com/enthought/chaco/blob/048508394718e88da22c525caae9a3b3e5736a51/chaco/lasso_overlay.py#L69-L70
ref: https://github.com/enthought/chaco/blob/master/docs/source/user_manual/basic_elements/plot_renderers.rst#screen-and-data-mapping
ref: #486