def gen_list_name(): """Generate "keys" for encoded lists in the sequence b"0\x00", b"1\x00", b"2\x00", ... The first 1000 keys are returned from a pre-built cache. All subsequent keys are generated on the fly. """ for name in _LIST_NAMES: yield name counter = itertools.count(1000) while True: yield b(str(next(counter))) + b"\x00"
raise except Exception: # Change exception type to InvalidBSON but preserve traceback. _, exc_value, exc_tb = sys.exc_info() reraise(InvalidBSON, exc_value, exc_tb) if _USE_C: _bson_to_dict = _cbson._bson_to_dict _PACK_FLOAT = struct.Struct("<d").pack _PACK_INT = struct.Struct("<i").pack _PACK_LENGTH_SUBTYPE = struct.Struct("<iB").pack _PACK_LONG = struct.Struct("<q").pack _PACK_TIMESTAMP = struct.Struct("<II").pack _LIST_NAMES = tuple(b(str(i)) + b"\x00" for i in range(1000)) def gen_list_name(): """Generate "keys" for encoded lists in the sequence b"0\x00", b"1\x00", b"2\x00", ... The first 1000 keys are returned from a pre-built cache. All subsequent keys are generated on the fly. """ for name in _LIST_NAMES: yield name counter = itertools.count(1000) while True: yield b(str(next(counter))) + b"\x00"
except Exception: # Change exception type to InvalidBSON but preserve traceback. _, exc_value, exc_tb = sys.exc_info() reraise(InvalidBSON, exc_value, exc_tb) if _USE_C: _bson_to_dict = _cbson._bson_to_dict _PACK_FLOAT = struct.Struct("<d").pack _PACK_INT = struct.Struct("<i").pack _PACK_LENGTH_SUBTYPE = struct.Struct("<iB").pack _PACK_LONG = struct.Struct("<q").pack _PACK_TIMESTAMP = struct.Struct("<II").pack _LIST_NAMES = tuple(b(str(i)) + b"\x00" for i in range(1000)) def gen_list_name(): """Generate "keys" for encoded lists in the sequence b"0\x00", b"1\x00", b"2\x00", ... The first 1000 keys are returned from a pre-built cache. All subsequent keys are generated on the fly. """ for name in _LIST_NAMES: yield name counter = itertools.count(1000) while True: yield b(str(next(counter))) + b"\x00"