E52C Change exception to not confuse static code checkers by Czaki · Pull Request #550 · pyapp-kit/magicgui · GitHub
[go: up one dir, main page]

Skip to content

Change exception to not confuse static code checkers#550

Merged
tlambert03 merged 2 commits intopyapp-kit:mainfrom
Czaki:fix_exception
Apr 3, 2023
Merged

Change exception to not confuse static code checkers#550
tlambert03 merged 2 commits intopyapp-kit:mainfrom
Czaki:fix_exception

Conversation

@Czaki
Copy link
Contributor
@Czaki Czaki commented Apr 3, 2023

When using NotImplementedError, the static code checkers like pylint marks a method as required to implement in a subclass. I suggest changing to RuntimeError (but I'm not glued to this selection of exception class).

obraz

@codecov
Copy link
codecov bot commented Apr 3, 2023

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (c09b98d) 89.75% compared to head (522d8aa) 89.76%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #550   +/-   ##
=======================================
  Coverage   89.75%   89.76%           
=======================================
  Files          37       37           
  Lines        4433     4434    +1     
=======================================
+ Hits         3979     3980    +1     
  Misses        454      454           
Impacted Files Coverage Δ
src/magicgui/widgets/bases/_container_widget.py 91.78% <100.00%> (+0.03%) ⬆️

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 in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@tlambert03
Copy link
Member

oh how interesting and vaguely annoying 😂

I'm fine with this in this case, RuntimeError actually seems like a better match here, but I'd also like to learn more about it. Can you give me whatever config you're using in pylint? (if that's what's raising the error?) I'm unable to trigger the error locally with:

# some_file.py

"""Module docstring."""
from magicgui.widgets import Container


class SearchLabel(Container):
    """Some Widget."""

    def __init__(self) -> None:
        super().__init__(layout='vertical')
pylint some_file.py

@tlambert03
Copy link
Member

going to merge, since I have no issues with this. But if you can give me a config to reproduce that'd be great

@tlambert03 tlambert03 merged commit 1973cf5 into pyapp-kit:main Apr 3, 2023
@Czaki
Copy link
Contributor Author
Czaki commented Apr 3, 2023

hm. The screenshot comes from deepsource https://deepsource.io/gh/4DNucleome/PartSeg/run/f3260ef2-a55e-44b4-9b58-5cca538e70c8/python/PYL-W0223?listindex=0

I just copied your file, updated pylint to the latest one, and call

$ pylint examples/some_file.py                                                                                                                                                                                                                                                                           
************* Module some_file
examples/some_file.py:7:0: W0223: Method '__setitem__' is abstract in class 'ContainerWidget' but is not overridden in child class 'SearchLabel' (abstract-method)

------------------------------------------------------------------
Your code has been rated at 7.50/10 (previous run: 5.00/10, +2.50)

Do you know how to dump configuration?

@Czaki Czaki deleted the fix_exception branch April 3, 2023 20:22
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.

2 participants

0