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

Fix typing error under mypy 0.990 #1156

Merged
merged 1 commit into from
Nov 12, 2022
Merged

Fix typing error under mypy 0.990 #1156

merged 1 commit into from
Nov 12, 2022

Conversation

jwodder
Copy link
Member

@jwodder jwodder commented Nov 11, 2022

The latest release of mypy now detects an error in our type annotations, which this PR fixes.

@jwodder jwodder added internal Changes only affect the internal API tests Add or improve existing tests and removed internal Changes only affect the internal API labels Nov 11, 2022
@yarikoptic
Copy link
Member

didn't check what failures are due to. is it the same as dandi/dandi-archive#1365 but even in the container we use?

@jwodder
Copy link
Member Author

jwodder commented Nov 11, 2022

@yarikoptic No, this is a type-checking error. It has absolutely nothing to do with the API server performance.

@yarikoptic
Copy link
Member

oh right , FTR looked into one of the errors and it is

dandi/upload.py:15: in <module>
    from .files import (
dandi/files/__init__.py:23: in <module>
    from ._private import BIDSFileFactory, DandiFileFactory
dandi/files/_private.py:74: in <module>
    class BIDSFileFactory(DandiFileFactory):
/opt/hostedtoolcache/Python/3.8.14/x64/lib/python3.8/dataclasses.py:1019: in dataclass
    return wrap(cls)
/opt/hostedtoolcache/Python/3.8.14/x64/lib/python3.8/dataclasses.py:1011: in wrap
    return _process_class(cls, init, repr, eq, order, unsafe_hash, frozen)
/opt/hostedtoolcache/Python/3.8.14/x64/lib/python3.8/dataclasses.py:861: in _process_class
    cls_fields = [_get_field(cls, name, type)
/opt/hostedtoolcache/Python/3.8.14/x64/lib/python3.8/dataclasses.py:861: in <listcomp>
    cls_fields = [_get_field(cls, name, type)
/opt/hostedtoolcache/Python/3.8.14/x64/lib/python3.8/dataclasses.py:745: in _get_field
    raise ValueError(f'mutable default {type(f.default)} for field '
E   ValueError: mutable default <class 'dict'> for field CLASSES is not allowed: use default_factory

@codecov
Copy link

codecov bot commented Nov 11, 2022

Codecov Report

Base: 88.29% // Head: 66.99% // Decreases project coverage by -21.29% ⚠️

Coverage data is based on head (46f7095) compared to base (c66fd18).
Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@             Coverage Diff             @@
##           master    #1156       +/-   ##
===========================================
- Coverage   88.29%   66.99%   -21.30%     
===========================================
  Files          73       73               
  Lines        8800     8651      -149     
===========================================
- Hits         7770     5796     -1974     
- Misses       1030     2855     +1825     
Flag Coverage Δ
unittests 66.99% <100.00%> (-21.30%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
dandi/files/_private.py 94.23% <100.00%> (-3.81%) ⬇️
dandi/support/tests/test_iterators.py 13.15% <0.00%> (-86.85%) ⬇️
dandi/support/tests/test_digests.py 15.38% <0.00%> (-84.62%) ⬇️
dandi/tests/test_pynwb_utils.py 20.00% <0.00%> (-77.78%) ⬇️
dandi/cli/tests/test_formatter.py 22.22% <0.00%> (-77.78%) ⬇️
dandi/cli/tests/test_ls.py 22.38% <0.00%> (-77.62%) ⬇️
dandi/tests/test_organize.py 18.40% <0.00%> (-76.75%) ⬇️
dandi/cli/tests/test_digest.py 25.00% <0.00%> (-75.00%) ⬇️
dandi/cli/tests/test_cmd_validate.py 31.03% <0.00%> (-68.97%) ⬇️
dandi/tests/test_validate.py 31.25% <0.00%> (-68.75%) ⬇️
... and 52 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@jwodder jwodder marked this pull request as ready for review November 11, 2022 19:47
@jwodder
Copy link
Member Author

jwodder commented Nov 11, 2022

@yarikoptic Now all the remaining test failures are ones that will be resolved by #1157.

@yarikoptic yarikoptic merged commit 15ea79f into master Nov 12, 2022
@yarikoptic yarikoptic deleted the fix-typing branch November 12, 2022 16:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tests Add or improve existing tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants