fix(checker): use dispatcher in frame method registry
This commit is contained in:
@@ -3,7 +3,9 @@ from __future__ import annotations
|
|||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from typing import TYPE_CHECKING, Any, Callable, Optional
|
from typing import TYPE_CHECKING, Any, Callable, Optional
|
||||||
|
|
||||||
|
import midas.ast.python as p
|
||||||
from midas.ast.location import Location
|
from midas.ast.location import Location
|
||||||
|
from midas.checker.dispatcher import CallDispatcher, CallResult
|
||||||
from midas.checker.registry import TypesRegistry
|
from midas.checker.registry import TypesRegistry
|
||||||
from midas.checker.reporter import FileReporter
|
from midas.checker.reporter import FileReporter
|
||||||
from midas.checker.types import (
|
from midas.checker.types import (
|
||||||
@@ -71,6 +73,10 @@ class MethodRegistry(metaclass=_MethodRegistryMeta):
|
|||||||
def types(self) -> TypesRegistry:
|
def types(self) -> TypesRegistry:
|
||||||
return self.typer.types
|
return self.typer.types
|
||||||
|
|
||||||
|
@property
|
||||||
|
def dispatcher(self) -> CallDispatcher[p.Expr]:
|
||||||
|
return self.typer.dispatcher
|
||||||
|
|
||||||
def call(
|
def call(
|
||||||
self,
|
self,
|
||||||
method: str,
|
method: str,
|
||||||
@@ -147,15 +153,13 @@ class MethodRegistry(metaclass=_MethodRegistryMeta):
|
|||||||
returns=DataFrameType(columns=new_columns),
|
returns=DataFrameType(columns=new_columns),
|
||||||
)
|
)
|
||||||
|
|
||||||
return (
|
result: CallResult = self.dispatcher.get_result(
|
||||||
self.typer._get_call_result(
|
|
||||||
location=call.location,
|
location=call.location,
|
||||||
callee=signature,
|
callee=signature,
|
||||||
positional=call.positional,
|
positional=call.positional,
|
||||||
keywords=call.keywords,
|
keywords=call.keywords,
|
||||||
)
|
)
|
||||||
or UnknownType()
|
return result.result
|
||||||
)
|
|
||||||
|
|
||||||
@frame_method()
|
@frame_method()
|
||||||
def mean(self, call: Call) -> Type:
|
def mean(self, call: Call) -> Type:
|
||||||
@@ -187,12 +191,11 @@ class MethodRegistry(metaclass=_MethodRegistryMeta):
|
|||||||
without_axis,
|
without_axis,
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
return (
|
|
||||||
self.typer._get_call_result(
|
result: CallResult = self.dispatcher.get_result(
|
||||||
location=call.location,
|
location=call.location,
|
||||||
callee=overload,
|
callee=overload,
|
||||||
positional=call.positional,
|
positional=call.positional,
|
||||||
keywords=call.keywords,
|
keywords=call.keywords,
|
||||||
)
|
)
|
||||||
or UnknownType()
|
return result.result
|
||||||
)
|
|
||||||
|
|||||||
Reference in New Issue
Block a user