BufGen¶
A generator class with a buffer. This allows multiple inspections of the stream issued by a generator. For example this is used by MaxMunchGen.
-
class
cpip.util.BufGen.
BufGen
(theGen)¶ A generator class with a buffer.
-
gen
()¶ Yield objects from the generator via the buffer.
-
lenBuf
¶ Returns the length of the existing buffer. NOTE: This may not be the final length as the generator might not be exhausted just yet.
-
replace
(theIdx, theLen, theValueS)¶ Replaces within the buffer starting at theIdx removing theLen objects and replacing them with theValueS.
-
slice
(sliceLen)¶ Returns a buffer slice of length sliceLen.
-
-
exception
cpip.util.BufGen.
ExceptionBufGen
¶ Exception specialisation for BufGen.