• R/O
  • SSH

提交

标签
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

C preprocessor written in Python


Commit MetaInfo

修订版8ef443b978cf4b05abdd8c08c1fc6c85e74ffc7b (tree)
时间2022-02-01 14:45:47
作者Eric Hopper <hopper@omni...>
CommiterEric Hopper

Log Message

Fix syntax errors in type hints, remove commented out code.

更改概述

差异

diff -r 6be5692fce17 -r 8ef443b978cf src/pycpre/lazy_sequence.py
--- a/src/pycpre/lazy_sequence.py Mon Jan 31 19:25:30 2022 -0800
+++ b/src/pycpre/lazy_sequence.py Mon Jan 31 21:45:47 2022 -0800
@@ -17,30 +17,6 @@
1717 T = TypeVar("T")
1818
1919
20-# class _SequenceRef(ReferenceType["LazySequence"[T]]):
21-# def __init__(
22-# self,
23-# sequence: "LazySequence"[T],
24-# state: "_LazySequenceState"[T],
25-# **kwargs
26-# ):
27-# super().__init__(self, sequence, state._refdestroyed)
28-#
29-# def __cmp__(self, other_ref: "_SequenceRef"[T]) -> int:
30-# me = self()
31-# other = other_ref()
32-# if (me, other) is (None, None):
33-# return id(self) - id(other_ref)
34-# elif me is None:
35-# return -1
36-# elif other is None:
37-# return 1
38-# else: # me and other are both not None
39-# cmpval: int = me.index - other.index
40-# if cmpval == 0:
41-# cmpval = id(self) - id(other_ref)
42-# return cmpval
43-
4420 class _LazySequenceState(Generic[T]):
4521 def __init__(self, item_iterator: Iterator[T], **kwargs):
4622 super().__init__(**kwargs)
@@ -49,7 +25,7 @@
4925 self.heads: List[ReferenceType[T]]= []
5026 self.index_of_0: int = 0
5127
52- def new_sequence(self, sequence: "LazySequence"[T]) -> None:
28+ def new_sequence(self, sequence: "LazySequence[T]") -> None:
5329 assert sequence.state is self
5430 if sequence.index < self.index_of_0:
5531 raise RuntimeError("LazySequence created that's attempting to time "
@@ -89,7 +65,7 @@
8965
9066
9167 class LazySequence(Sequence[T]):
92- def __init__(self, item_iterator: Union["LazySequence", Iterable[T]], **kwargs):
68+ def __init__(self, item_iterator: Union["LazySequence[T]", Iterable[T]], **kwargs):
9369 if isinstance(item_iterator, LazySequence):
9470 self.state = item_iterator.state
9571 self.index = item_iterator.index
@@ -105,7 +81,7 @@
10581 raise NotImplemented("Lazy sequences may be infinitely long.")
10682
10783 def __getitem__(self, index: Union[int, slice]) \
108- -> Union[T, "LazySequence"[T], List[T]]:
84+ -> Union[T, "LazySequence[T]", List[T]]:
10985 if index < 0:
11086 raise ValueError("Lazy sequences may not have an end and don't "
11187 "support indexing from the end.")