Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
ebonnal committed Dec 4, 2023
1 parent d76c790 commit 1feca1b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion kioss/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
from kioss import _pipe
from kioss._visit import _explanation, _iter_production

_pipe.ITERATOR_PRODUCING_VISITOR = _iter_production.IteratorProducingVisitor()
_pipe.ITERATOR_PRODUCING_VISITOR_CLASS = _iter_production.IteratorProducingVisitor
_pipe.EXPLAINING_VISITOR_CLASS = _explanation.ExplainingVisitor
12 changes: 7 additions & 5 deletions kioss/_pipe.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,23 @@
U = TypeVar("U")
R = TypeVar("R")

ITERATOR_PRODUCING_VISITOR: "Optional[_iter_production.IteratorProducingVisitor]" = None
ITERATOR_PRODUCING_VISITOR_CLASS: "Optional[Type[_iter_production.IteratorProducingVisitor]]" = (
None
)
EXPLAINING_VISITOR_CLASS: "Optional[Type[_explanation.ExplainingVisitor]]" = None


class APipe(Iterable[T], ABC):
upstream: "Optional[APipe]"

def __iter__(self) -> Iterator[T]:
if ITERATOR_PRODUCING_VISITOR is None:
raise ValueError("_plan.ITERATOR_PRODUCING_VISITOR is None")
return self._accept(ITERATOR_PRODUCING_VISITOR)
if ITERATOR_PRODUCING_VISITOR_CLASS is None:
raise ValueError("_pipe.ITERATOR_PRODUCING_VISITOR_CLASS is None")
return self._accept(ITERATOR_PRODUCING_VISITOR_CLASS())

def __repr__(self) -> str:
if EXPLAINING_VISITOR_CLASS is None:
raise ValueError("_plan.EXPLAINER_VISITOR is None")
raise ValueError("_pipe.EXPLAINING_VISITOR_CLASS is None")
return self._accept(EXPLAINING_VISITOR_CLASS())

@abstractmethod
Expand Down

0 comments on commit 1feca1b

Please sign in to comment.