text stringlengths 81 112k |
|---|
Extract a compressed file to ``directory``.
Args:
compressed_filename (str): Compressed file.
directory (str): Extract to directory.
extension (str, optional): Extension of the file; Otherwise, attempts to extract extension
from the filename.
def _maybe_extract(compressed_filen... |
Return a filename from a URL
Args:
url (str): URL to extract filename from
Returns:
(str): Filename in URL
def _get_filename_from_url(url):
""" Return a filename from a URL
Args:
url (str): URL to extract filename from
Returns:
(str): Filename in URL
"""
... |
Download the file at ``url`` to ``directory``. Extract to ``directory`` if tar or zip.
Args:
url (str): Url of file.
directory (str): Directory to download to.
filename (str, optional): Name of the file to download; Otherwise, a filename is extracted
from the url.
extens... |
Download the files at ``urls`` to ``directory``. Extract to ``directory`` if tar or zip.
Args:
urls (str): Url of files.
directory (str): Directory to download to.
check_files (list of str): Check if these files exist, ensuring the download succeeded.
If these files exist before... |
Get the accuracy top-k accuracy between two tensors.
Args:
targets (1 - 2D :class:`torch.Tensor`): Target or true vector against which to measure
saccuracy
outputs (1 - 3D :class:`torch.Tensor`): Prediction or output vector
ignore_index (int, optional): Specifies a target index that is ... |
Get the accuracy token accuracy between two tensors.
Args:
targets (1 - 2D :class:`torch.Tensor`): Target or true vector against which to measure
saccuracy
outputs (1 - 3D :class:`torch.Tensor`): Prediction or output vector
ignore_index (int, optional): Specifies a target index that is ... |
Get all tensors associated with ``object_``
Args:
object_ (any): Any object to look for tensors.
Returns:
(list of torch.tensor): List of tensors that are associated with ``object_``.
def get_tensors(object_):
""" Get all tensors associated with ``object_``
Args:
object_ (any... |
Given a batch sampler or sampler returns examples instead of indices
Args:
dataset (torch.utils.data.Dataset): Dataset to sample from.
sampler (torch.utils.data.sampler.Sampler): Sampler over the dataset.
Returns:
generator over dataset examples
def sampler_to_iterator(dataset, sample... |
Deterministic shuffle and split algorithm.
Given the same two datasets and the same ``random_seed``, the split happens the same exact way
every call.
Args:
dataset (lib.datasets.Dataset): First dataset.
other_dataset (lib.datasets.Dataset): Another dataset.
random_seed (int, option... |
Compute ``torch.equal`` with the optional mask parameter.
Args:
ignore_index (int, optional): Specifies a ``tensor`` index that is ignored.
Returns:
(bool) Returns ``True`` if target and prediction are equal.
def torch_equals_ignore_index(tensor, tensor_other, ignore_index=None):
"""
... |
Given a list of lengths, create a batch mask.
Example:
>>> lengths_to_mask([1, 2, 3])
tensor([[1, 0, 0],
[1, 1, 0],
[1, 1, 1]], dtype=torch.uint8)
>>> lengths_to_mask([1, 2, 2], [1, 2, 2])
tensor([[[1, 0],
[0, 0]],
<BLANKLINE>... |
Collate a list of type ``k`` (dict, namedtuple, list, etc.) with tensors.
Inspired by:
https://github.com/pytorch/pytorch/blob/master/torch/utils/data/_utils/collate.py#L31
Args:
batch (list of k): List of rows of type ``k``.
stack_tensors (callable): Function to stack tensors into a batch... |
Apply ``torch.Tensor.to`` to tensors in a generic data structure.
Inspired by:
https://github.com/pytorch/pytorch/blob/master/torch/utils/data/_utils/collate.py#L31
Args:
tensors (tensor, dict, list, namedtuple or tuple): Data structure with tensor values to
move.
*args: Argume... |
Load the Zero dataset.
The Zero dataset is a simple task of predicting zero from zero. This dataset is useful for
integration testing. The extreme simplicity of the dataset allows for models to learn the task
quickly allowing for quick end-to-end testing.
Args:
train (bool, optional): If to lo... |
Decodes a tensor into a sequence.
Args:
encoded (torch.Tensor): Encoded sequence.
Returns:
str: Sequence decoded from ``encoded``.
def decode(self, encoded):
""" Decodes a tensor into a sequence.
Args:
encoded (torch.Tensor): Encoded sequence.
... |
Encodes a ``label``.
Args:
label (object): Label to encode.
Returns:
torch.Tensor: Encoding of the label.
def encode(self, label):
""" Encodes a ``label``.
Args:
label (object): Label to encode.
Returns:
torch.Tensor: Encoding ... |
Args:
iterator (iterator): Batch of labels to encode.
*args: Arguments passed to ``Encoder.batch_encode``.
dim (int, optional): Dimension along which to concatenate tensors.
**kwargs: Keyword arguments passed to ``Encoder.batch_encode``.
Returns:
torc... |
Decodes ``encoded`` label.
Args:
encoded (torch.Tensor): Encoded label.
Returns:
object: Label decoded from ``encoded``.
def decode(self, encoded):
""" Decodes ``encoded`` label.
Args:
encoded (torch.Tensor): Encoded label.
Returns:
... |
Args:
tensor (torch.Tensor): Batch of tensors.
*args: Arguments passed to ``Encoder.batch_decode``.
dim (int, optional): Dimension along which to split tensors.
**kwargs: Keyword arguments passed to ``Encoder.batch_decode``.
Returns:
list: Batch of de... |
Load the Count dataset.
The Count dataset is a simple task of counting the number of integers in a sequence. This
dataset is useful for testing implementations of sequence to label models.
Args:
train (bool, optional): If to load the training split of the dataset.
dev (bool, optional): If ... |
Load the WMT 2016 machine translation dataset.
As a translation task, this task consists in translating English sentences that describe an
image into German, given the English sentence itself. As training and development data, we
provide 29,000 and 1,014 triples respectively, each containing an English sou... |
Load the Penn Treebank dataset.
This is the Penn Treebank Project: Release 2 CDROM, featuring a million words of 1989 Wall
Street Journal material.
**Reference:** https://catalog.ldc.upenn.edu/ldc99t42
**Citation:**
Marcus, Mitchell P., Marcinkiewicz, Mary Ann & Santorini, Beatrice (1993).
Bu... |
Wraps hidden states in new Tensors, to detach them from their history.
def repackage_hidden(h):
"""Wraps hidden states in new Tensors, to detach them from their history."""
if isinstance(h, torch.Tensor):
return h.detach()
else:
return tuple(repackage_hidden(v) for v in h) |
Parses the given vyper source code and returns a list of python AST objects
for all statements in the source. Performs pre-processing of source code
before parsing as well as post-processing of the resulting AST.
:param source_code: The vyper source code to be parsed.
:return: The post-processed list ... |
Copy necessary variables to pre-allocated memory section.
:param holder: Complete holder for all args
:param maxlen: Total length in bytes of the full arg section (static + dynamic).
:param arg: Current arg to pack
:param context: Context of arg
:param placeholder: Static placeholder for static arg... |
Validates a version pragma directive against the current compiler version.
def validate_version_pragma(version_str: str, start: ParserPosition) -> None:
"""
Validates a version pragma directive against the current compiler version.
"""
from vyper import (
__version__,
)
version_arr = v... |
Re-formats a vyper source string into a python source string and performs
some validation. More specifically,
* Translates "contract" and "struct" keyword into python "class" keyword
* Validates "@version" pragma against current compiler version
* Prevents direct use of python "class" keyword
* Pr... |
Valid variable name, checked against global context.
def is_valid_varname(self, name, item):
""" Valid variable name, checked against global context. """
check_valid_varname(name, self._custom_units, self._structs, self._constants, item)
if name in self._globals:
raise VariableDecla... |
Nonrentrant locks use a prefix with a counter to minimise deployment cost of a contract.
def get_nonrentrant_counter(self, key):
"""
Nonrentrant locks use a prefix with a counter to minimise deployment cost of a contract.
"""
prefix = NONRENTRANT_STORAGE_OFFSET
if key in self._... |
Test if the current statement is a type of list, used in for loops.
def _is_list_iter(self):
"""
Test if the current statement is a type of list, used in for loops.
"""
# Check for literal or memory list.
iter_var_type = (
self.context.vars.get(self.stmt.iter.id).ty... |
Return unrolled const
def get_constant(self, const_name, context):
""" Return unrolled const """
# check if value is compatible with
const = self._constants[const_name]
if isinstance(const, ast.AnnAssign): # Handle ByteArrays.
if context:
expr = Expr(const... |
Using a list of args, determine the most accurate signature to use from
the given context
def lookup_sig(cls, sigs, method_name, expr_args, stmt_or_expr, context):
"""
Using a list of args, determine the most accurate signature to use from
the given context
"""
def syno... |
Performs annotation and optimization on a parsed python AST by doing the
following:
* Annotating all AST nodes with the originating source code of the AST
* Annotating class definition nodes with their original class type
("contract" or "struct")
* Substituting negative values for unary subtracti... |
Handle invalid variable names
def check_valid_varname(varname,
custom_units,
custom_structs,
constants,
pos,
error_prefix="Variable name invalid.",
exc=None):
""" Handle i... |
Allocate a MID which has not been used yet.
def allocate_mid(mids):
"""
Allocate a MID which has not been used yet.
"""
i = 0
while True:
mid = str(i)
if mid not in mids:
mids.add(mid)
return mid
i += 1 |
Add a new :class:`RTCIceCandidate` received from the remote peer.
The specified candidate must have a value for either `sdpMid` or `sdpMLineIndex`.
def addIceCandidate(self, candidate):
"""
Add a new :class:`RTCIceCandidate` received from the remote peer.
The specified candidate must ... |
Add a :class:`MediaStreamTrack` to the set of media tracks which
will be transmitted to the remote peer.
def addTrack(self, track):
"""
Add a :class:`MediaStreamTrack` to the set of media tracks which
will be transmitted to the remote peer.
"""
# check state is valid
... |
Add a new :class:`RTCRtpTransceiver`.
def addTransceiver(self, trackOrKind, direction='sendrecv'):
"""
Add a new :class:`RTCRtpTransceiver`.
"""
self.__assertNotClosed()
# determine track or kind
if hasattr(trackOrKind, 'kind'):
kind = trackOrKind.kind
... |
Terminate the ICE agent, ending ICE processing and streams.
async def close(self):
"""
Terminate the ICE agent, ending ICE processing and streams.
"""
if self.__isClosed:
return
self.__isClosed = True
self.__setSignalingState('closed')
# stop senders... |
Create an SDP answer to an offer received from a remote peer during
the offer/answer negotiation of a WebRTC connection.
:rtype: :class:`RTCSessionDescription`
async def createAnswer(self):
"""
Create an SDP answer to an offer received from a remote peer during
the offer/answer... |
Create a data channel with the given label.
:rtype: :class:`RTCDataChannel`
def createDataChannel(self, label, maxPacketLifeTime=None, maxRetransmits=None,
ordered=True, protocol='', negotiated=False, id=None):
"""
Create a data channel with the given label.
... |
Create an SDP offer for the purpose of starting a new WebRTC
connection to a remote peer.
:rtype: :class:`RTCSessionDescription`
async def createOffer(self):
"""
Create an SDP offer for the purpose of starting a new WebRTC
connection to a remote peer.
:rtype: :class:`R... |
Returns statistics for the connection.
:rtype: :class:`RTCStatsReport`
async def getStats(self):
"""
Returns statistics for the connection.
:rtype: :class:`RTCStatsReport`
"""
merged = RTCStatsReport()
coros = [x.getStats() for x in (self.getSenders() + self.ge... |
Change the local description associated with the connection.
:param: sessionDescription: An :class:`RTCSessionDescription` generated
by :meth:`createOffer` or :meth:`createAnswer()`.
async def setLocalDescription(self, sessionDescription):
"""
Change the loc... |
Changes the remote description associated with the connection.
:param: sessionDescription: An :class:`RTCSessionDescription` created from
information received over the signaling channel.
async def setRemoteDescription(self, sessionDescription):
"""
Changes t... |
Pack the FCI for a Receiver Estimated Maximum Bitrate report.
https://tools.ietf.org/html/draft-alvestrand-rmcat-remb-03
def pack_remb_fci(bitrate, ssrcs):
"""
Pack the FCI for a Receiver Estimated Maximum Bitrate report.
https://tools.ietf.org/html/draft-alvestrand-rmcat-remb-03
"""
data = b... |
Unpack the FCI for a Receiver Estimated Maximum Bitrate report.
https://tools.ietf.org/html/draft-alvestrand-rmcat-remb-03
def unpack_remb_fci(data):
"""
Unpack the FCI for a Receiver Estimated Maximum Bitrate report.
https://tools.ietf.org/html/draft-alvestrand-rmcat-remb-03
"""
if len(data)... |
Parse header extensions according to RFC 5285.
def unpack_header_extensions(extension_profile: int,
extension_value: bytes) -> List[Tuple[int, bytes]]:
"""
Parse header extensions according to RFC 5285.
"""
extensions = []
pos = 0
if extension_profile == 0xBEDE:
... |
Serialize header extensions according to RFC 5285.
def pack_header_extensions(extensions: List[Tuple[int, bytes]]) -> Tuple[int, bytes]:
"""
Serialize header extensions according to RFC 5285.
"""
extension_profile = 0
extension_value = b''
if not extensions:
return extension_profile, e... |
Recover initial packet from a retransmission packet.
def unwrap_rtx(rtx, payload_type, ssrc):
"""
Recover initial packet from a retransmission packet.
"""
packet = RtpPacket(
payload_type=payload_type,
marker=rtx.marker,
sequence_number=unpack('!H', rtx.payload[0:2])[0],
... |
Create a retransmission packet from a lost packet.
def wrap_rtx(packet, payload_type, sequence_number, ssrc):
"""
Create a retransmission packet from a lost packet.
"""
rtx = RtpPacket(
payload_type=payload_type,
marker=packet.marker,
sequence_number=sequence_number,
tim... |
Returns statistics about the RTP sender.
:rtype: :class:`RTCStatsReport`
async def getStats(self):
"""
Returns statistics about the RTP sender.
:rtype: :class:`RTCStatsReport`
"""
self.__stats.add(RTCOutboundRtpStreamStats(
# RTCStats
timestamp=... |
Attempt to set the parameters controlling the sending of media.
:param: parameters: The :class:`RTCRtpParameters` for the sender.
async def send(self, parameters: RTCRtpSendParameters):
"""
Attempt to set the parameters controlling the sending of media.
:param: parameters: The :class:... |
Irreversibly stop the sender.
async def stop(self):
"""
Irreversibly stop the sender.
"""
if self.__started:
self.__transport._unregister_rtp_sender(self)
self.__rtp_task.cancel()
self.__rtcp_task.cancel()
await asyncio.gather(
... |
Retransmit an RTP packet which was reported as lost.
async def _retransmit(self, sequence_number):
"""
Retransmit an RTP packet which was reported as lost.
"""
packet = self.__rtp_history.get(sequence_number % RTP_HISTORY_SIZE)
if packet and packet.sequence_number == sequence_nu... |
Return a > b.
def uint16_gt(a: int, b: int) -> bool:
"""
Return a > b.
"""
half_mod = 0x8000
return (((a < b) and ((b - a) > half_mod)) or
((a > b) and ((a - b) < half_mod))) |
Return a >= b.
def uint16_gte(a: int, b: int) -> bool:
"""
Return a >= b.
"""
return (a == b) or uint16_gt(a, b) |
Return a > b.
def uint32_gt(a: int, b: int) -> bool:
"""
Return a > b.
"""
half_mod = 0x80000000
return (((a < b) and ((b - a) > half_mod)) or
((a > b) and ((a - b) < half_mod))) |
Return a >= b.
def uint32_gte(a: int, b: int) -> bool:
"""
Return a >= b.
"""
return (a == b) or uint32_gt(a, b) |
Bring up interface. Equivalent to ifconfig [iface] up.
def up(self):
''' Bring up interface. Equivalent to ifconfig [iface] up. '''
# Set new flags
flags = self.ifflags | IFF_UP
self.ifflags = flags
self.get_mtu() |
Open file corresponding to the TUN device.
def open(self):
''' Open file corresponding to the TUN device. '''
self.fd = open('/dev/net/tun', 'rb+', buffering=0)
tun_flags = IFF_TAP | IFF_NO_PI | IFF_PERSIST
ifr = struct.pack('16sH', self.name, tun_flags)
fcntl.ioctl(self.fd, TUN... |
Gather ICE candidates.
async def gather(self):
"""
Gather ICE candidates.
"""
if self.__state == 'new':
self.__setState('gathering')
await self._connection.gather_candidates()
self.__setState('completed') |
Retrieve the ICE parameters of the ICE gatherer.
:rtype: RTCIceParameters
def getLocalParameters(self):
"""
Retrieve the ICE parameters of the ICE gatherer.
:rtype: RTCIceParameters
"""
return RTCIceParameters(
usernameFragment=self._connection.local_userna... |
Add a remote candidate.
def addRemoteCandidate(self, candidate):
"""
Add a remote candidate.
"""
# FIXME: don't use private member!
if not self._connection._remote_candidates_end:
if candidate is None:
self._connection.add_remote_candidate(None)
... |
Initiate connectivity checks.
:param: remoteParameters: The :class:`RTCIceParameters` associated with
the remote :class:`RTCIceTransport`.
async def start(self, remoteParameters):
"""
Initiate connectivity checks.
:param: remoteParameters: The :class:... |
Send `data` across the data channel to the remote peer.
def send(self, data):
"""
Send `data` across the data channel to the remote peer.
"""
if self.readyState != 'open':
raise InvalidStateError
if not isinstance(data, (str, bytes)):
raise ValueError('C... |
Override the default codec preferences.
See :meth:`RTCRtpSender.getCapabilities` and :meth:`RTCRtpReceiver.getCapabilities`
for the supported codecs.
:param: codecs: A list of :class:`RTCRtpCodecCapability`, in decreasing order
of preference. If empty, restores the defa... |
Permanently stops the :class:`RTCRtpTransceiver`.
async def stop(self):
"""
Permanently stops the :class:`RTCRtpTransceiver`.
"""
await self.__receiver.stop()
await self.__sender.stop()
self.__stopped = True |
Start discarding media.
async def start(self):
"""
Start discarding media.
"""
for track, task in self.__tracks.items():
if task is None:
self.__tracks[track] = asyncio.ensure_future(blackhole_consume(track)) |
Stop discarding media.
async def stop(self):
"""
Stop discarding media.
"""
for task in self.__tracks.values():
if task is not None:
task.cancel()
self.__tracks = {} |
Add a track to be recorded.
:param: track: An :class:`aiortc.AudioStreamTrack` or :class:`aiortc.VideoStreamTrack`.
def addTrack(self, track):
"""
Add a track to be recorded.
:param: track: An :class:`aiortc.AudioStreamTrack` or :class:`aiortc.VideoStreamTrack`.
"""
if... |
Start recording.
async def start(self):
"""
Start recording.
"""
for track, context in self.__tracks.items():
if context.task is None:
context.task = asyncio.ensure_future(self.__run_track(track, context)) |
Stop recording.
async def stop(self):
"""
Stop recording.
"""
if self.__container:
for track, context in self.__tracks.items():
if context.task is not None:
context.task.cancel()
context.task = None
... |
The date and time after which the certificate will be considered invalid.
def expires(self):
"""
The date and time after which the certificate will be considered invalid.
"""
not_after = self._cert.get_notAfter().decode('ascii')
return datetime.datetime.strptime(not_after, '%Y%m... |
Create and return an X.509 certificate and corresponding private key.
:rtype: RTCCertificate
def generateCertificate(cls):
"""
Create and return an X.509 certificate and corresponding private key.
:rtype: RTCCertificate
"""
key = generate_key()
cert = generate_... |
Start DTLS transport negotiation with the parameters of the remote
DTLS transport.
:param: remoteParameters: An :class:`RTCDtlsParameters`.
async def start(self, remoteParameters):
"""
Start DTLS transport negotiation with the parameters of the remote
DTLS transport.
:... |
Stop and close the DTLS transport.
async def stop(self):
"""
Stop and close the DTLS transport.
"""
if self._task is not None:
self._task.cancel()
self._task = None
if self._state in [State.CONNECTING, State.CONNECTED]:
lib.SSL_shutdown(self.... |
Flush outgoing data which OpenSSL put in our BIO to the transport.
async def _write_ssl(self):
"""
Flush outgoing data which OpenSSL put in our BIO to the transport.
"""
pending = lib.BIO_ctrl_pending(self.write_bio)
if pending > 0:
result = lib.BIO_read(self.write_b... |
For testing purposes.
def set_estimate(self, bitrate: int, now_ms: int):
"""
For testing purposes.
"""
self.current_bitrate = self._clamp_bitrate(bitrate, bitrate)
self.current_bitrate_initialized = True
self.last_change_ms = now_ms |
Receive the next :class:`~av.audio.frame.AudioFrame`.
The base implementation just reads silence, subclass
:class:`AudioStreamTrack` to provide a useful implementation.
async def recv(self):
"""
Receive the next :class:`~av.audio.frame.AudioFrame`.
The base implementation just... |
Receive the next :class:`~av.video.frame.VideoFrame`.
The base implementation just reads a 640x480 green frame at 30fps,
subclass :class:`VideoStreamTrack` to provide a useful implementation.
async def recv(self):
"""
Receive the next :class:`~av.video.frame.VideoFrame`.
The b... |
Prune chunks up to the given TSN.
def prune_chunks(self, tsn):
"""
Prune chunks up to the given TSN.
"""
pos = -1
size = 0
for i, chunk in enumerate(self.reassembly):
if uint32_gte(tsn, chunk.tsn):
pos = i
size += len(chunk.use... |
Start the transport.
async def start(self, remoteCaps, remotePort):
"""
Start the transport.
"""
if not self.__started:
self.__started = True
self.__state = 'connecting'
self._remote_port = remotePort
# configure logging
if lo... |
Stop the transport.
async def stop(self):
"""
Stop the transport.
"""
if self._association_state != self.State.CLOSED:
await self._abort()
self.__transport._unregister_data_receiver(self)
self._set_state(self.State.CLOSED) |
Initialize the association.
async def _init(self):
"""
Initialize the association.
"""
chunk = InitChunk()
chunk.initiate_tag = self._local_verification_tag
chunk.advertised_rwnd = self._advertised_rwnd
chunk.outbound_streams = self._outbound_streams_count
... |
Gets what extensions are supported by the remote party.
def _get_extensions(self, params):
"""
Gets what extensions are supported by the remote party.
"""
for k, v in params:
if k == SCTP_PRSCTP_SUPPORTED:
self._remote_partial_reliability = True
e... |
Sets what extensions are supported by the local party.
def _set_extensions(self, params):
"""
Sets what extensions are supported by the local party.
"""
extensions = []
if self._local_partial_reliability:
params.append((SCTP_PRSCTP_SUPPORTED, b''))
extens... |
Get or create the inbound stream with the specified ID.
def _get_inbound_stream(self, stream_id):
"""
Get or create the inbound stream with the specified ID.
"""
if stream_id not in self._inbound_streams:
self._inbound_streams[stream_id] = InboundStream()
return self... |
Handle data received from the network.
async def _handle_data(self, data):
"""
Handle data received from the network.
"""
try:
_, _, verification_tag, chunks = parse_packet(data)
except ValueError:
return
# is this an init?
init_chunk = l... |
Determine if a chunk needs to be marked as abandoned.
If it does, it marks the chunk and any other chunk belong to the same
message as abandoned.
def _maybe_abandon(self, chunk):
"""
Determine if a chunk needs to be marked as abandoned.
If it does, it marks the chunk and any o... |
Mark an incoming data TSN as received.
def _mark_received(self, tsn):
"""
Mark an incoming data TSN as received.
"""
# it's a duplicate
if uint32_gte(self._last_received_tsn, tsn) or tsn in self._sack_misordered:
self._sack_duplicates.append(tsn)
return T... |
Receive data stream -> ULP.
async def _receive(self, stream_id, pp_id, data):
"""
Receive data stream -> ULP.
"""
await self._data_channel_receive(stream_id, pp_id, data) |
Handle an incoming chunk.
async def _receive_chunk(self, chunk):
"""
Handle an incoming chunk.
"""
self.__log_debug('< %s', chunk)
# common
if isinstance(chunk, DataChunk):
await self._receive_data_chunk(chunk)
elif isinstance(chunk, SackChunk):
... |
Handle a DATA chunk.
async def _receive_data_chunk(self, chunk):
"""
Handle a DATA chunk.
"""
self._sack_needed = True
# mark as received
if self._mark_received(chunk.tsn):
return
# find stream
inbound_stream = self._get_inbound_stream(chunk... |
Handle a FORWARD TSN chunk.
async def _receive_forward_tsn_chunk(self, chunk):
"""
Handle a FORWARD TSN chunk.
"""
self._sack_needed = True
# it's a duplicate
if uint32_gte(self._last_received_tsn, chunk.cumulative_tsn):
return
def is_obsolete(x):
... |
Handle a SACK chunk.
async def _receive_sack_chunk(self, chunk):
"""
Handle a SACK chunk.
"""
if uint32_gt(self._last_sacked_tsn, chunk.cumulative_tsn):
return
received_time = time.time()
self._last_sacked_tsn = chunk.cumulative_tsn
cwnd_fully_utiliz... |
Handle a RE-CONFIG parameter.
async def _receive_reconfig_param(self, param):
"""
Handle a RE-CONFIG parameter.
"""
self.__log_debug('<< %s', param)
if isinstance(param, StreamResetOutgoingParam):
# mark closed inbound streams
for stream_id in param.stre... |
Send data ULP -> stream.
async def _send(self, stream_id, pp_id, user_data,
expiry=None, max_retransmits=None, ordered=True):
"""
Send data ULP -> stream.
"""
if ordered:
stream_seq = self._outbound_stream_seq.get(stream_id, 0)
else:
s... |
Transmit a chunk (no bundling for now).
async def _send_chunk(self, chunk):
"""
Transmit a chunk (no bundling for now).
"""
self.__log_debug('> %s', chunk)
await self.__transport._send_data(serialize_packet(
self._local_port,
self._remote_port,
... |
Build and send a selective acknowledgement (SACK) chunk.
async def _send_sack(self):
"""
Build and send a selective acknowledgement (SACK) chunk.
"""
gaps = []
gap_next = None
for tsn in sorted(self._sack_misordered):
pos = (tsn - self._last_received_tsn) % S... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.