本文整理汇总了Python中hyperframe.frame.DataFrame.flags方法的典型用法代码示例。如果您正苦于以下问题:Python DataFrame.flags方法的具体用法?Python DataFrame.flags怎么用?Python DataFrame.flags使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类hyperframe.frame.DataFrame
的用法示例。
在下文中一共展示了DataFrame.flags方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_data_frame_with_padding_calculates_flow_control_len
# 需要导入模块: from hyperframe.frame import DataFrame [as 别名]
# 或者: from hyperframe.frame.DataFrame import flags [as 别名]
def test_data_frame_with_padding_calculates_flow_control_len(self):
f = DataFrame(1)
f.flags = set(['PADDED'])
f.data = b'testdata'
f.pad_length = 10
assert f.flow_controlled_length == 19
示例2: test_data_frame_serializes_properly
# 需要导入模块: from hyperframe.frame import DataFrame [as 别名]
# 或者: from hyperframe.frame.DataFrame import flags [as 别名]
def test_data_frame_serializes_properly(self):
f = DataFrame(1)
f.flags = set(['END_STREAM'])
f.data = b'testdata'
s = f.serialize()
assert s == self.payload
示例3: test_connection_window_increments_appropriately
# 需要导入模块: from hyperframe.frame import DataFrame [as 别名]
# 或者: from hyperframe.frame.DataFrame import flags [as 别名]
def test_connection_window_increments_appropriately(self, frame_buffer):
e = Encoder()
h = HeadersFrame(1)
h.data = e.encode([(':status', 200), ('content-type', 'foo/bar')])
h.flags = set(['END_HEADERS'])
d = DataFrame(1)
d.data = b'hi there sir'
d2 = DataFrame(1)
d2.data = b'hi there sir again'
d2.flags = set(['END_STREAM'])
sock = DummySocket()
sock.buffer = BytesIO(h.serialize() + d.serialize() + d2.serialize())
c = HTTP20Connection('www.google.com')
c._sock = sock
c.window_manager.window_size = 1000
c.window_manager.initial_window_size = 1000
c.request('GET', '/')
resp = c.get_response()
resp.read()
frame_buffer.add_data(b''.join(sock.queue))
queue = list(frame_buffer)
assert len(queue) == 3 # one headers frame, two window update frames.
assert isinstance(queue[1], WindowUpdateFrame)
assert queue[1].window_increment == len(b'hi there sir')
assert isinstance(queue[2], WindowUpdateFrame)
assert queue[2].window_increment == len(b'hi there sir again')
示例4: test_data_frame_with_padding_serializes_properly
# 需要导入模块: from hyperframe.frame import DataFrame [as 别名]
# 或者: from hyperframe.frame.DataFrame import flags [as 别名]
def test_data_frame_with_padding_serializes_properly(self):
f = DataFrame(1)
f.flags = set(['END_STREAM', 'PADDED'])
f.data = b'testdata'
f.pad_length = 10
s = f.serialize()
assert s == self.payload_with_padding
示例5: build_data_frame
# 需要导入模块: from hyperframe.frame import DataFrame [as 别名]
# 或者: from hyperframe.frame.DataFrame import flags [as 别名]
def build_data_frame(self, data, flags=None, stream_id=1):
"""
Builds a single data frame out of a chunk of data.
"""
flags = set(flags) if flags is not None else set()
f = DataFrame(stream_id)
f.data = data
f.flags = flags
return f
示例6: build_data_frame
# 需要导入模块: from hyperframe.frame import DataFrame [as 别名]
# 或者: from hyperframe.frame.DataFrame import flags [as 别名]
def build_data_frame(self, data, flags=None, stream_id=1, padding_len=0):
"""
Builds a single data frame out of a chunk of data.
"""
flags = set(flags) if flags is not None else set()
f = DataFrame(stream_id)
f.data = data
f.flags = flags
if padding_len:
flags.add('PADDED')
f.pad_length = padding_len
return f