Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added default factory to numpy color creation #106

Merged
merged 2 commits into from
Sep 24, 2023

Conversation

JoOkuma
Copy link
Contributor

@JoOkuma JoOkuma commented Aug 26, 2023

Hey @quantumjot ,

I was getting this error:

  File "C:\Users\jordao\Mamba\envs\tracking\Lib\site-packages\napari_arboretum\_hookimpls.py", line 1, in <module>
    from napari_arboretum.plugin import Arboretum
  File "C:\Users\jordao\Mamba\envs\tracking\Lib\site-packages\napari_arboretum\plugin.py", line 10, in <module>
    from napari_arboretum.io.svg import export_svg
  File "C:\Users\jordao\Mamba\envs\tracking\Lib\site-packages\napari_arboretum\io\svg.py", line 5, in <module>
    from napari_arboretum.tree import Annotation, Edge
  File "C:\Users\jordao\Mamba\envs\tracking\Lib\site-packages\napari_arboretum\tree.py", line 27, in <module>
    @dataclass
     ^^^^^^^^^
  File "C:\Users\jordao\Mamba\envs\tracking\Lib\dataclasses.py", line 1230, in dataclass
    return wrap(cls)
           ^^^^^^^^^
  File "C:\Users\jordao\Mamba\envs\tracking\Lib\dataclasses.py", line 1220, in wrap
    return _process_class(cls, init, repr, eq, order, unsafe_hash,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\jordao\Mamba\envs\tracking\Lib\dataclasses.py", line 958, in _process_class
    cls_fields.append(_get_field(cls, name, type, kw_only))
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\jordao\Mamba\envs\tracking\Lib\dataclasses.py", line 815, in _get_field
    raise ValueError(f'mutable default {type(f.default)} for field '
ValueError: mutable default <class 'numpy.ndarray'> for field color is not allowed: use default_factory

This PR fixes this issue.

@codecov-commenter
Copy link

codecov-commenter commented Aug 26, 2023

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (9b19b26) 87.00% compared to head (99aa19b) 87.00%.

❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #106   +/-   ##
=======================================
  Coverage   87.00%   87.00%           
=======================================
  Files          11       11           
  Lines         554      554           
  Branches       80       84    +4     
=======================================
  Hits          482      482           
  Misses         63       63           
  Partials        9        9           
Files Changed Coverage Δ
src/napari_arboretum/tree.py 86.48% <100.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@deprecated-napari-hub-preview-bot
Copy link

deprecated-napari-hub-preview-bot bot commented Aug 26, 2023

Preview page for your plugin is ready here:
https://preview.napari-hub.org/lowe-lab-ucl/arboretum/106
Updated: 2023-08-29T13:24:58.788107

@JoOkuma
Copy link
Contributor Author

JoOkuma commented Aug 28, 2023

@quantumjot, I fixed the linting error.

@quantumjot
Copy link
Collaborator

Thanks @JoOkuma !

@quantumjot quantumjot merged commit cfacb70 into lowe-lab-ucl:main Sep 24, 2023
7 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants