done
This commit is contained in:
@ -0,0 +1 @@
|
||||
from pandas.core.computation.eval import eval as eval
|
@ -0,0 +1,17 @@
|
||||
import abc
|
||||
|
||||
class AbstractEngine(metaclass=abc.ABCMeta):
|
||||
has_neg_frac: bool = ...
|
||||
expr = ...
|
||||
aligned_axes = ...
|
||||
result_type = ...
|
||||
def __init__(self, expr) -> None: ...
|
||||
def convert(self) -> str: ...
|
||||
def evaluate(self) -> object: ...
|
||||
|
||||
class NumExprEngine(AbstractEngine):
|
||||
has_neg_frac: bool = ...
|
||||
|
||||
class PythonEngine(AbstractEngine):
|
||||
has_neg_frac: bool = ...
|
||||
def evaluate(self): ...
|
@ -0,0 +1,28 @@
|
||||
from collections.abc import Mapping
|
||||
from typing import (
|
||||
Any,
|
||||
Literal,
|
||||
)
|
||||
|
||||
from pandas import (
|
||||
DataFrame,
|
||||
Series,
|
||||
)
|
||||
from pandas.core.computation.ops import BinOp
|
||||
|
||||
from pandas._typing import (
|
||||
Scalar,
|
||||
npt,
|
||||
)
|
||||
|
||||
def eval(
|
||||
expr: str | BinOp,
|
||||
parser: Literal["pandas", "python"] = "pandas",
|
||||
engine: Literal["python", "numexpr"] | None = ...,
|
||||
local_dict: dict[str, Any] | None = None,
|
||||
global_dict: dict[str, Any] | None = None,
|
||||
resolvers: list[Mapping] | None = ...,
|
||||
level: int = 0,
|
||||
target: object | None = None,
|
||||
inplace: bool = False,
|
||||
) -> npt.NDArray | Scalar | DataFrame | Series | None: ...
|
@ -0,0 +1,64 @@
|
||||
import ast
|
||||
|
||||
from pandas.core.computation.ops import Term as Term
|
||||
from pandas.core.computation.scope import Scope as Scope
|
||||
|
||||
class BaseExprVisitor(ast.NodeVisitor):
|
||||
const_type = ...
|
||||
term_type = ...
|
||||
binary_ops = ...
|
||||
binary_op_nodes = ...
|
||||
binary_op_nodes_map = ...
|
||||
unary_ops = ...
|
||||
unary_op_nodes = ...
|
||||
unary_op_nodes_map = ...
|
||||
rewrite_map = ...
|
||||
env = ...
|
||||
engine = ...
|
||||
parser = ...
|
||||
preparser = ...
|
||||
assigner = ...
|
||||
def __init__(self, env, engine, parser, preparser=...) -> None: ...
|
||||
def visit(self, node, **kwargs): ...
|
||||
def visit_Module(self, node, **kwargs): ...
|
||||
def visit_Expr(self, node, **kwargs): ...
|
||||
def visit_BinOp(self, node, **kwargs): ...
|
||||
def visit_Div(self, node, **kwargs): ...
|
||||
def visit_UnaryOp(self, node, **kwargs): ...
|
||||
def visit_Name(self, node, **kwargs): ...
|
||||
def visit_NameConstant(self, node, **kwargs): ...
|
||||
def visit_Num(self, node, **kwargs): ...
|
||||
def visit_Constant(self, node, **kwargs): ...
|
||||
def visit_Str(self, node, **kwargs): ...
|
||||
def visit_List(self, node, **kwargs): ...
|
||||
def visit_Index(self, node, **kwargs): ...
|
||||
def visit_Subscript(self, node, **kwargs): ...
|
||||
def visit_Slice(self, node, **kwargs): ...
|
||||
def visit_Assign(self, node, **kwargs): ...
|
||||
def visit_Attribute(self, node, **kwargs): ...
|
||||
def visit_Call(self, node, side=..., **kwargs): ...
|
||||
def translate_In(self, op): ...
|
||||
def visit_Compare(self, node, **kwargs): ...
|
||||
def visit_BoolOp(self, node, **kwargs): ...
|
||||
|
||||
class Expr:
|
||||
env: Scope
|
||||
engine: str
|
||||
parser: str
|
||||
expr = ...
|
||||
terms = ...
|
||||
def __init__(
|
||||
self,
|
||||
expr,
|
||||
engine: str = ...,
|
||||
parser: str = ...,
|
||||
env: Scope | None = ...,
|
||||
level: int = ...,
|
||||
) -> None: ...
|
||||
@property
|
||||
def assigner(self): ...
|
||||
def __call__(self): ...
|
||||
def __len__(self) -> int: ...
|
||||
def parse(self): ...
|
||||
@property
|
||||
def names(self): ...
|
@ -0,0 +1,88 @@
|
||||
import numpy as np
|
||||
|
||||
class UndefinedVariableError(NameError):
|
||||
def __init__(self, name, is_local: bool = ...) -> None: ...
|
||||
|
||||
class Term:
|
||||
def __new__(cls, name, env, side=..., encoding=...): ...
|
||||
is_local: bool
|
||||
env = ...
|
||||
side = ...
|
||||
encoding = ...
|
||||
def __init__(self, name, env, side=..., encoding=...) -> None: ...
|
||||
@property
|
||||
def local_name(self) -> str: ...
|
||||
def __call__(self, *args, **kwargs): ...
|
||||
def evaluate(self, *args, **kwargs): ...
|
||||
def update(self, value) -> None: ...
|
||||
@property
|
||||
def is_scalar(self) -> bool: ...
|
||||
@property
|
||||
def type(self): ...
|
||||
return_type = ...
|
||||
@property
|
||||
def raw(self) -> str: ...
|
||||
@property
|
||||
def is_datetime(self) -> bool: ...
|
||||
@property
|
||||
def value(self): ...
|
||||
@value.setter
|
||||
def value(self, new_value) -> None: ...
|
||||
@property
|
||||
def name(self): ...
|
||||
@property
|
||||
def ndim(self) -> int: ...
|
||||
|
||||
class Constant(Term):
|
||||
@property
|
||||
def name(self): ...
|
||||
|
||||
class Op:
|
||||
op: str
|
||||
operands = ...
|
||||
encoding = ...
|
||||
def __init__(self, op: str, operands, *args, **kwargs) -> None: ...
|
||||
def __iter__(self): ...
|
||||
@property
|
||||
def return_type(self): ...
|
||||
@property
|
||||
def has_invalid_return_type(self) -> bool: ...
|
||||
@property
|
||||
def operand_types(self): ...
|
||||
@property
|
||||
def is_scalar(self) -> bool: ...
|
||||
@property
|
||||
def is_datetime(self) -> bool: ...
|
||||
|
||||
class BinOp(Op):
|
||||
lhs = ...
|
||||
rhs = ...
|
||||
func = ...
|
||||
def __init__(self, op: str, lhs, rhs, **kwargs) -> None: ...
|
||||
def __call__(self, env): ...
|
||||
def evaluate(self, env, engine: str, parser, term_type, eval_in_python): ...
|
||||
def convert_values(self): ...
|
||||
|
||||
def isnumeric(dtype) -> bool: ...
|
||||
|
||||
class Div(BinOp):
|
||||
def __init__(self, lhs, rhs, **kwargs) -> None: ...
|
||||
|
||||
class UnaryOp(Op):
|
||||
operand = ...
|
||||
func = ...
|
||||
def __init__(self, op: str, operand) -> None: ...
|
||||
def __call__(self, env): ...
|
||||
@property
|
||||
def return_type(self) -> np.dtype: ...
|
||||
|
||||
class MathCall(Op):
|
||||
func = ...
|
||||
def __init__(self, func, args) -> None: ...
|
||||
def __call__(self, env): ...
|
||||
|
||||
class FuncNode:
|
||||
name = ...
|
||||
func = ...
|
||||
def __init__(self, name: str) -> None: ...
|
||||
def __call__(self, *args): ...
|
@ -0,0 +1,108 @@
|
||||
from typing import Any
|
||||
|
||||
from pandas.core.computation import (
|
||||
expr as expr,
|
||||
ops as ops,
|
||||
scope as _scope,
|
||||
)
|
||||
from pandas.core.computation.expr import BaseExprVisitor as BaseExprVisitor
|
||||
from pandas.core.indexes.base import Index
|
||||
|
||||
class PyTablesScope(_scope.Scope):
|
||||
queryables: dict[str, Any]
|
||||
def __init__(
|
||||
self,
|
||||
level: int,
|
||||
global_dict=...,
|
||||
local_dict=...,
|
||||
queryables: dict[str, Any] | None = ...,
|
||||
) -> None: ...
|
||||
|
||||
class Term(ops.Term):
|
||||
env = ...
|
||||
def __new__(cls, name, env, side=..., encoding=...): ...
|
||||
def __init__(self, name, env: PyTablesScope, side=..., encoding=...) -> None: ...
|
||||
@property
|
||||
def value(self): ...
|
||||
@value.setter
|
||||
def value(self, new_value) -> None: ...
|
||||
|
||||
class Constant(Term):
|
||||
def __init__(self, name, env: PyTablesScope, side=..., encoding=...) -> None: ...
|
||||
|
||||
class BinOp(ops.BinOp):
|
||||
op: str
|
||||
queryables: dict[str, Any]
|
||||
encoding = ...
|
||||
condition = ...
|
||||
def __init__(
|
||||
self, op: str, lhs, rhs, queryables: dict[str, Any], encoding
|
||||
) -> None: ...
|
||||
def prune(self, klass): ...
|
||||
def conform(self, rhs): ...
|
||||
@property
|
||||
def is_valid(self) -> bool: ...
|
||||
@property
|
||||
def is_in_table(self) -> bool: ...
|
||||
@property
|
||||
def kind(self): ...
|
||||
@property
|
||||
def meta(self): ...
|
||||
@property
|
||||
def metadata(self): ...
|
||||
def generate(self, v) -> str: ...
|
||||
def convert_value(self, v) -> TermValue: ...
|
||||
def convert_values(self) -> None: ...
|
||||
|
||||
class FilterBinOp(BinOp):
|
||||
filter: tuple[Any, Any, Index] | None = ...
|
||||
def invert(self): ...
|
||||
def format(self): ...
|
||||
def generate_filter_op(self, invert: bool = ...): ...
|
||||
|
||||
class JointFilterBinOp(FilterBinOp):
|
||||
def format(self) -> None: ...
|
||||
|
||||
class ConditionBinOp(BinOp):
|
||||
def invert(self) -> None: ...
|
||||
def format(self): ...
|
||||
condition = ...
|
||||
|
||||
class JointConditionBinOp(ConditionBinOp):
|
||||
condition = ...
|
||||
|
||||
class UnaryOp(ops.UnaryOp):
|
||||
def prune(self, klass): ...
|
||||
|
||||
class PyTablesExprVisitor(BaseExprVisitor):
|
||||
const_type = ...
|
||||
term_type = ...
|
||||
def __init__(self, env, engine, parser, **kwargs) -> None: ...
|
||||
def visit_UnaryOp(self, node, **kwargs): ...
|
||||
def visit_Index(self, node, **kwargs): ...
|
||||
def visit_Assign(self, node, **kwargs): ...
|
||||
def visit_Subscript(self, node, **kwargs): ...
|
||||
def visit_Attribute(self, node, **kwargs): ...
|
||||
def translate_In(self, op): ...
|
||||
|
||||
class PyTablesExpr(expr.Expr):
|
||||
encoding = ...
|
||||
condition = ...
|
||||
filter = ...
|
||||
terms = ...
|
||||
expr = ...
|
||||
def __init__(
|
||||
self,
|
||||
where,
|
||||
queryables: dict[str, Any] | None = ...,
|
||||
encoding=...,
|
||||
scope_level: int = ...,
|
||||
) -> None: ...
|
||||
def evaluate(self): ...
|
||||
|
||||
class TermValue:
|
||||
value = ...
|
||||
converted = ...
|
||||
kind = ...
|
||||
def __init__(self, value, converted, kind: str) -> None: ...
|
||||
def tostring(self, encoding) -> str: ...
|
@ -0,0 +1,18 @@
|
||||
class Scope:
|
||||
level = ...
|
||||
scope = ...
|
||||
target = ...
|
||||
resolvers = ...
|
||||
temps = ...
|
||||
def __init__(
|
||||
self, level, global_dict=..., local_dict=..., resolvers=..., target=...
|
||||
) -> None: ...
|
||||
@property
|
||||
def has_resolvers(self) -> bool: ...
|
||||
def resolve(self, key: str, is_local: bool): ...
|
||||
def swapkey(self, old_key: str, new_key: str, new_value=...): ...
|
||||
def add_tmp(self, value) -> str: ...
|
||||
@property
|
||||
def ntemps(self) -> int: ...
|
||||
@property
|
||||
def full_scope(self): ...
|
Reference in New Issue
Block a user