def construct_stream_tower(stream, buffering, universal, reading, writing, binary): if buffering == 0: # no buffering pass elif buffering == 1: # line-buffering if writing: stream = LineBufferingOutputStream(stream) if reading: stream = BufferingInputStream(stream) else: # default or explicit buffer sizes if buffering is not None and buffering < 0: buffering = -1 if writing: stream = BufferingOutputStream(stream, buffering) if reading: stream = BufferingInputStream(stream, buffering) if universal: # Wants universal newlines if writing and os.linesep != '\n': stream = TextOutputFilter(stream) if reading: stream = TextInputFilter(stream) elif not binary and os.linesep == '\r\n': stream = TextCRLFFilter(stream) if nonconst.NonConstant(False): stream.flush_buffers() # annotation workaround for untranslated tests return stream
def f(): rsiphash.enable_siphash24() i = nonconst.NonConstant(1) assert d.get("key%d" % (i,)) is x1 assert d.get("key%d" % (i+1,)) is x2