Skip to content

TYP: check_untyped_defs core.computation.pytables #36920

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

Merged
Merged
Show file tree
Hide file tree
Changes from all 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
20 changes: 12 additions & 8 deletions pandas/core/computation/pytables.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,10 @@ class Term(ops.Term):
env: PyTablesScope

def __new__(cls, name, env, side=None, encoding=None):
klass = Constant if not isinstance(name, str) else cls
if isinstance(name, str):
klass = cls
else:
klass = Constant
return object.__new__(klass)

def __init__(self, name, env: PyTablesScope, side=None, encoding=None):
Expand Down Expand Up @@ -83,6 +86,7 @@ class BinOp(ops.BinOp):

op: str
queryables: Dict[str, Any]
condition: Optional[str]

def __init__(self, op: str, lhs, rhs, queryables: Dict[str, Any], encoding):
super().__init__(op, lhs, rhs)
Expand Down Expand Up @@ -184,10 +188,8 @@ def convert_value(self, v) -> "TermValue":

def stringify(value):
if self.encoding is not None:
encoder = partial(pprint_thing_encoded, encoding=self.encoding)
else:
encoder = pprint_thing
return encoder(value)
return pprint_thing_encoded(value, encoding=self.encoding)
return pprint_thing(value)

kind = ensure_decoded(self.kind)
meta = ensure_decoded(self.meta)
Expand Down Expand Up @@ -257,9 +259,11 @@ def __repr__(self) -> str:
def invert(self):
""" invert the filter """
if self.filter is not None:
f = list(self.filter)
f[1] = self.generate_filter_op(invert=True)
self.filter = tuple(f)
self.filter = (
self.filter[0],
self.generate_filter_op(invert=True),
self.filter[2],
)
return self

def format(self):
Expand Down
3 changes: 0 additions & 3 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,6 @@ check_untyped_defs=False
[mypy-pandas.core.computation.ops]
check_untyped_defs=False

[mypy-pandas.core.computation.pytables]
check_untyped_defs=False

[mypy-pandas.core.computation.scope]
check_untyped_defs=False

Expand Down