glue-viz / bqplot-image-gl

Jupyter widget for displaying images with a focus on astronomy
MIT License
19 stars 13 forks source link

Use instance instead of class for trait #97

Closed mwcraig closed 2 years ago

mwcraig commented 2 years ago

Pull Request Template

Description

I was getting a DeprecationWarning in the tests for astrowidgets because bqplot_image_gl was using an instance instead of a class.

This change fixes the warning.

Traceback before the fix

collected 0 items / 1 error

======================================================================= ERRORS ========================================================================
_______________________________________________ ERROR collecting astrowidgets/tests/test_bqplot_api.py ________________________________________________
astrowidgets/tests/test_bqplot_api.py:10: in <module>
    from astrowidgets.bqplot import ImageWidget, ALLOWED_CURSOR_LOCATIONS
astrowidgets/bqplot.py:16: in <module>
    from bqplot_image_gl.interacts import (MouseInteraction,
../../miniconda3/envs/awid/lib/python3.10/site-packages/bqplot_image_gl/interacts.py:61: in <module>
    class MouseInteraction(Interaction):
../../miniconda3/envs/awid/lib/python3.10/site-packages/bqplot_image_gl/interacts.py:102: in MouseInteraction
    events = List(Unicode, default_value=drag_events + mouse_events + keyboard_events,
../../miniconda3/envs/awid/lib/python3.10/site-packages/traitlets/traitlets.py:2825: in __init__
    super().__init__(trait=trait, default_value=default_value, **kwargs)
../../miniconda3/envs/awid/lib/python3.10/site-packages/traitlets/traitlets.py:2675: in __init__
    warn(
E   DeprecationWarning: Traits should be given as instances, not types (for example, `Int()`, not `Int`). Passing types is deprecated in traitlets 4.1.
codecov[bot] commented 2 years ago

Codecov Report

Merging #97 (362d49b) into master (eff96d7) will not change coverage. The diff coverage is 0.00%.

@@           Coverage Diff           @@
##           master      #97   +/-   ##
=======================================
  Coverage   54.68%   54.68%           
=======================================
  Files           7        7           
  Lines         128      128           
=======================================
  Hits           70       70           
  Misses         58       58           
Impacted Files Coverage Δ
bqplot_image_gl/interacts.py 0.00% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update eff96d7...362d49b. Read the comment docs.

maartenbreddels commented 2 years ago

Thanks Matt!