Skip to content

Commit

Permalink
partial fix dsl.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Jiaqi-Lv committed Apr 11, 2024
1 parent 30a5368 commit 3ae1adb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/mypy-type-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,5 @@ jobs:
tiatoolbox/typing.py \
tiatoolbox/tiatoolbox.py \
tiatoolbox/utils/*.py \
tiatoolbox/tools/*.py
tiatoolbox/tools/*.py \
tiatoolbox/data/*.py
16 changes: 8 additions & 8 deletions tiatoolbox/annotation/dsl.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,15 +160,15 @@ def __eq__(self: SQLExpression, other: SQLExpression) -> SQLTriplet:
"""Define how the object is compared for equality."""
return SQLTriplet(self, operator.eq, other)

def __ne__(self: SQLExpression, other: object) -> SQLTriplet:
def __ne__(self: SQLExpression, other: SQLExpression) -> SQLTriplet:
"""Define how the object is compared for equality (not equal to)."""
return SQLTriplet(self, operator.ne, other)

def __neg__(self: SQLExpression) -> SQLTriplet:
"""Define how the object is compared for negation (not equal to)."""
return SQLTriplet(self, operator.neg)

def __contains__(self: SQLExpression, other: object) -> bool:
def __contains__(self: SQLExpression, other: SQLExpression) -> bool:
"""Test whether the object contains the specified object or not."""
return SQLTriplet(self, "contains", other)

Expand All @@ -180,19 +180,19 @@ def __rpow__(self: SQLExpression, x: SQLTriplet | str) -> SQLTriplet:
"""Implements reverse exponentiation operation."""
return SQLTriplet(x, operator.pow, self)

def __and__(self: SQLExpression, other: object) -> SQLTriplet:
def __and__(self: SQLExpression, other: SQLExpression) -> SQLTriplet:
"""Implements logical AND operation."""
return SQLTriplet(self, operator.and_, other)

def __rand__(self: SQLExpression, other: object) -> SQLTriplet:
def __rand__(self: SQLExpression, other: SQLExpression) -> SQLTriplet:
"""Implements reverse logical AND operation."""
return SQLTriplet(other, operator.and_, self)

def __or__(self: SQLExpression, other: object) -> SQLTriplet:
def __or__(self: SQLExpression, other: SQLExpression) -> SQLTriplet:
"""Implements logical OR operation."""
return SQLTriplet(self, operator.or_, other)

def __ror__(self: SQLExpression, other: object) -> SQLTriplet:
def __ror__(self: SQLExpression, other: SQLExpression) -> SQLTriplet:
"""Implements reverse logical OR operation."""
return SQLTriplet(other, operator.or_, self)

Expand All @@ -209,9 +209,9 @@ class SQLTriplet(SQLExpression):

def __init__(
self: SQLExpression,
lhs: SQLTriplet | str,
lhs: SQLTriplet | str | SQLExpression |Number,
op: Callable | str | None = None,
rhs: SQLTriplet | str | None = None,
rhs: SQLTriplet | str | SQLExpression| Number | None = None,
) -> None:
"""Initialize :class:`SQLTriplet`."""
self.lhs = lhs
Expand Down

0 comments on commit 3ae1adb

Please sign in to comment.