Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions pandas-stubs/core/base.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from collections.abc import (
Callable,
Hashable,
Iterator,
Sequence,
Expand Down Expand Up @@ -67,8 +68,8 @@ class SelectionMixin(Generic[NDFrameT]):
@final
@cache_readonly
def ndim(self) -> int: ...
def __getitem__(self, key): ...
def aggregate(self, func, *args: Any, **kwargs: Any): ...
def __getitem__(self, key: Any) -> Any: ...
def aggregate(self, func: Callable[..., Any], *args: Any, **kwargs: Any) -> Any: ...

class IndexOpsMixin(OpsMixin, Generic[S1, GenericT_co]):
__array_priority__: int = ...
Expand Down
17 changes: 0 additions & 17 deletions pandas-stubs/core/computation/engines.pyi

This file was deleted.

39 changes: 0 additions & 39 deletions pandas-stubs/core/computation/expr.pyi
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import ast
from typing import Any

from pandas.core.computation.ops import Term as Term
from pandas.core.computation.scope import Scope as Scope

class BaseExprVisitor(ast.NodeVisitor):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

delete this class. Only referenced in pytables to create other classes that are not documented

Expand All @@ -19,47 +17,10 @@ class BaseExprVisitor(ast.NodeVisitor):
parser = ...
preparser = ...
assigner = ...
def __init__(self, env, engine, parser, preparser=...) -> None: ...
def visit(self, node, **kwargs: Any): ...
def visit_Module(self, node, **kwargs: Any): ...
def visit_Expr(self, node, **kwargs: Any): ...
def visit_BinOp(self, node, **kwargs: Any): ...
def visit_Div(self, node, **kwargs: Any): ...
def visit_UnaryOp(self, node, **kwargs: Any): ...
def visit_Name(self, node, **kwargs: Any): ...
def visit_NameConstant(self, node, **kwargs: Any): ...
def visit_Num(self, node, **kwargs: Any): ...
def visit_Constant(self, node, **kwargs: Any): ...
def visit_Str(self, node, **kwargs: Any): ...
def visit_List(self, node, **kwargs: Any): ...
def visit_Index(self, node, **kwargs: Any): ...
def visit_Subscript(self, node, **kwargs: Any): ...
def visit_Slice(self, node, **kwargs: Any): ...
def visit_Assign(self, node, **kwargs: Any): ...
def visit_Attribute(self, node, **kwargs: Any): ...
def visit_Call(self, node, side=..., **kwargs: Any): ...
def translate_In(self, op): ...
def visit_Compare(self, node, **kwargs: Any): ...
def visit_BoolOp(self, node, **kwargs: Any): ...

class Expr:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need to keep this one because it is superclass of PyTablesExpr which is same as Term which is arguments for read_hdf()

Now we don't document what Term is, but safer to leave it in for now

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): ...
40 changes: 4 additions & 36 deletions pandas-stubs/core/computation/ops.pyi
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this file can be deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,56 +3,34 @@ from typing import Any

import numpy as np

class UndefinedVariableError(NameError):
def __init__(self, name, is_local: bool = ...) -> None: ...
class UndefinedVariableError(NameError): ...

class Term:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tihnk Term can be deleted

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: Any, **kwargs: Any): ...
def evaluate(self, *args: Any, **kwargs: Any): ...
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 Constant(Term): ...
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can be deleted

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, can be deleted


class Op:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that this and its subclasses can be deleted

op: str
operands = ...
encoding = ...
def __init__(self, op: str, operands, *args: Any, **kwargs: Any) -> 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: ...
Expand All @@ -61,21 +39,14 @@ class BinOp(Op):
lhs = ...
rhs = ...
func = ...
def __init__(self, op: str, lhs, rhs, **kwargs: Any) -> 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: ...
def isnumeric(dtype: type) -> bool: ...

class Div(BinOp):
def __init__(self, lhs, rhs, **kwargs: Any) -> None: ...
class Div(BinOp): ...

class UnaryOp(Op):
operand = ...
func = ...
def __init__(self, op: str, operand) -> None: ...
def __call__(self, env): ...
if sys.version_info >= (3, 11):
@property
def return_type(self) -> np.dtype: ...
Expand All @@ -85,11 +56,8 @@ class UnaryOp(Op):

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: Any): ...
57 changes: 3 additions & 54 deletions pandas-stubs/core/computation/pytables.pyi
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this can be deleted.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PyTables is used in pandas/io/pytables.pyi so could not delete the file in full but dropped most of it.

Original file line number Diff line number Diff line change
Expand Up @@ -3,87 +3,39 @@ 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):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one is referred to only in classes that are not referred to. Can also be removed, I believe.

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):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one isn't referred to anywhere else.

def format(self) -> None: ...

class ConditionBinOp(BinOp):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one isn't referred to anywhere else.

def invert(self) -> None: ...
def format(self): ...
condition = ...

class JointConditionBinOp(ConditionBinOp):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one isn't referred to anywhere else.

condition = ...

class UnaryOp(ops.UnaryOp):
def prune(self, klass): ...
class UnaryOp(ops.UnaryOp): ...
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one isn't referred to anywhere else.


class PyTablesExprVisitor(BaseExprVisitor):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one isn't referred to anywhere else.

const_type = ...
term_type = ...
def __init__(self, env, engine, parser, **kwargs: Any) -> None: ...
def visit_UnaryOp(self, node, **kwargs: Any): ...
def visit_Index(self, node, **kwargs: Any): ...
def visit_Assign(self, node, **kwargs: Any): ...
def visit_Subscript(self, node, **kwargs: Any): ...
def visit_Attribute(self, node, **kwargs: Any): ...
def translate_In(self, op): ...

class PyTablesExpr(expr.Expr):
encoding = ...
Expand All @@ -93,16 +45,13 @@ class PyTablesExpr(expr.Expr):
expr = ...
def __init__(
self,
where,
where: Any,
queryables: dict[str, Any] | None = ...,
encoding=...,
encoding: Any = ...,
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: ...
8 changes: 0 additions & 8 deletions pandas-stubs/core/computation/scope.pyi
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can delete this file as well

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually Scope is used in expr file (everything is so spread around this folder).

Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,7 @@ class 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): ...
8 changes: 0 additions & 8 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -205,10 +205,6 @@ ignore = [
"PYI042", # https://docs.astral.sh/ruff/rules/snake-case-type-alias/
"ERA001", "PLR0402", "PLC0105"
]
"*computation*" = [
# TODO: remove when computations are fully typed
"ANN001", "ANN201", "ANN204", "ANN206",
]
"*window*" = [
# TODO: remove when window is fully typed
"ANN001", "ANN201", "ANN204", "ANN206",
Expand All @@ -221,10 +217,6 @@ ignore = [
# TODO: remove when array is fully typed
"ANN001", "ANN201", "ANN204", "ANN206",
]
"*core/base.pyi" = [
# TODO: remove when core/base.pyi is fully typed
"ANN001", "ANN201", "ANN204", "ANN206",
]
"*excel/_base.pyi" = [
# TODO: remove when excel/_base.pyi is fully typed
"ANN001", "ANN201", "ANN204", "ANN206",
Expand Down