-
-
Notifications
You must be signed in to change notification settings - Fork 76
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: Add dummy __init__
to ParameterizedFunction
#1021
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1021 +/- ##
==========================================
- Coverage 87.25% 87.24% -0.02%
==========================================
Files 9 9
Lines 4928 4930 +2
==========================================
+ Hits 4300 4301 +1
- Misses 628 629 +1 ☔ View full report in Codecov by Sentry. |
I don't understand :) Is there some reproducible code I could run to validate the issue and that it's fixed with this change? I haven't seen the error reported on Panel. |
I created this environment: ❯ pyright example.py
/home/shh/Downloads/example.py
/home/shh/Downloads/example.py:3:14 - error: Expected 0 positional arguments (reportCallIssue)
1 error, 0 warnings, 0 informations
~/Downloads via 🅒 tmp_param
❯ cat example.py
import holoviews as hv
hv.extension("bokeh")
|
Ok so here's a reproducer, type checking it with class Base:
def __init__(self, **params):
pass
class FunctionBase(Base):
# def __init__(self, *args, **kwargs):
# super().__init__(*args, **kwargs)
def __new__(cls, *args, **kwargs) -> Any:
inst = Base.__new__(cls)
result = inst.__call__(*args, **kwargs)
return result
def __call__(self, *args, **kwargs):
raise NotImplementedError
class SomeFunction(FunctionBase):
def __call__(self, *args, **kwargs):
return 1
SomeFunction('test') Indeed, adding the dummy EDIT: Ah yeah to explain a little, in Python |
Is there any overhead? As far as I see init is never called because of new bypass it. |
Yes that's true, still weird no? Pyright's developer answered saying that annotating |
See holoviz/panel#7690