partition
stringclasses
3 values
func_name
stringlengths
1
134
docstring
stringlengths
1
46.9k
path
stringlengths
4
223
original_string
stringlengths
75
104k
code
stringlengths
75
104k
docstring_tokens
listlengths
1
1.97k
repo
stringlengths
7
55
language
stringclasses
1 value
url
stringlengths
87
315
code_tokens
listlengths
19
28.4k
sha
stringlengths
40
40
train
pack_args_by_32
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...
vyper/parser/parser.py
def pack_args_by_32(holder, maxlen, arg, typ, context, placeholder, dynamic_offset_counter=None, datamem_start=None, zero_pad_i=None, pos=None): """ Copy necessary variables to pre-allocated memory section. :param holder: Complete holder for all args :param maxlen: Total length in b...
def pack_args_by_32(holder, maxlen, arg, typ, context, placeholder, dynamic_offset_counter=None, datamem_start=None, zero_pad_i=None, pos=None): """ Copy necessary variables to pre-allocated memory section. :param holder: Complete holder for all args :param maxlen: Total length in b...
[ "Copy", "necessary", "variables", "to", "pre", "-", "allocated", "memory", "section", "." ]
ethereum/vyper
python
https://github.com/ethereum/vyper/blob/c21a40a4f651ebd8426b29b8e2bb7d8b72b57cdd/vyper/parser/parser.py#L758-L891
[ "def", "pack_args_by_32", "(", "holder", ",", "maxlen", ",", "arg", ",", "typ", ",", "context", ",", "placeholder", ",", "dynamic_offset_counter", "=", "None", ",", "datamem_start", "=", "None", ",", "zero_pad_i", "=", "None", ",", "pos", "=", "None", ")",...
c21a40a4f651ebd8426b29b8e2bb7d8b72b57cdd
train
validate_version_pragma
Validates a version pragma directive against the current compiler version.
vyper/parser/pre_parser.py
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 = version_str.split('@version') file_version = version_arr[1].strip() ...
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 = version_str.split('@version') file_version = version_arr[1].strip() ...
[ "Validates", "a", "version", "pragma", "directive", "against", "the", "current", "compiler", "version", "." ]
ethereum/vyper
python
https://github.com/ethereum/vyper/blob/c21a40a4f651ebd8426b29b8e2bb7d8b72b57cdd/vyper/parser/pre_parser.py#L41-L60
[ "def", "validate_version_pragma", "(", "version_str", ":", "str", ",", "start", ":", "ParserPosition", ")", "->", "None", ":", "from", "vyper", "import", "(", "__version__", ",", ")", "version_arr", "=", "version_str", ".", "split", "(", "'@version'", ")", "...
c21a40a4f651ebd8426b29b8e2bb7d8b72b57cdd
train
pre_parse
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...
vyper/parser/pre_parser.py
def pre_parse(code: str) -> Tuple[ClassTypes, str]: """ 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 vers...
def pre_parse(code: str) -> Tuple[ClassTypes, str]: """ 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 vers...
[ "Re", "-", "formats", "a", "vyper", "source", "string", "into", "a", "python", "source", "string", "and", "performs", "some", "validation", ".", "More", "specifically" ]
ethereum/vyper
python
https://github.com/ethereum/vyper/blob/c21a40a4f651ebd8426b29b8e2bb7d8b72b57cdd/vyper/parser/pre_parser.py#L69-L131
[ "def", "pre_parse", "(", "code", ":", "str", ")", "->", "Tuple", "[", "ClassTypes", ",", "str", "]", ":", "result", "=", "[", "]", "previous_keyword", "=", "None", "class_types", ":", "ClassTypes", "=", "{", "}", "try", ":", "code_bytes", "=", "code", ...
c21a40a4f651ebd8426b29b8e2bb7d8b72b57cdd
train
GlobalContext.is_valid_varname
Valid variable name, checked against global context.
vyper/parser/global_context.py
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 VariableDeclarationException( 'Invalid name "%s", p...
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 VariableDeclarationException( 'Invalid name "%s", p...
[ "Valid", "variable", "name", "checked", "against", "global", "context", "." ]
ethereum/vyper
python
https://github.com/ethereum/vyper/blob/c21a40a4f651ebd8426b29b8e2bb7d8b72b57cdd/vyper/parser/global_context.py#L330-L337
[ "def", "is_valid_varname", "(", "self", ",", "name", ",", "item", ")", ":", "check_valid_varname", "(", "name", ",", "self", ".", "_custom_units", ",", "self", ".", "_structs", ",", "self", ".", "_constants", ",", "item", ")", "if", "name", "in", "self",...
c21a40a4f651ebd8426b29b8e2bb7d8b72b57cdd
train
GlobalContext.get_nonrentrant_counter
Nonrentrant locks use a prefix with a counter to minimise deployment cost of a contract.
vyper/parser/global_context.py
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._nonrentrant_keys: return self._nonrentrant_keys[key] else: ...
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._nonrentrant_keys: return self._nonrentrant_keys[key] else: ...
[ "Nonrentrant", "locks", "use", "a", "prefix", "with", "a", "counter", "to", "minimise", "deployment", "cost", "of", "a", "contract", "." ]
ethereum/vyper
python
https://github.com/ethereum/vyper/blob/c21a40a4f651ebd8426b29b8e2bb7d8b72b57cdd/vyper/parser/global_context.py#L507-L519
[ "def", "get_nonrentrant_counter", "(", "self", ",", "key", ")", ":", "prefix", "=", "NONRENTRANT_STORAGE_OFFSET", "if", "key", "in", "self", ".", "_nonrentrant_keys", ":", "return", "self", ".", "_nonrentrant_keys", "[", "key", "]", "else", ":", "counter", "="...
c21a40a4f651ebd8426b29b8e2bb7d8b72b57cdd
train
Stmt._is_list_iter
Test if the current statement is a type of list, used in for loops.
vyper/parser/stmt.py
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).typ if isinstance(self.stmt.iter, ast.Name) els...
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).typ if isinstance(self.stmt.iter, ast.Name) els...
[ "Test", "if", "the", "current", "statement", "is", "a", "type", "of", "list", "used", "in", "for", "loops", "." ]
ethereum/vyper
python
https://github.com/ethereum/vyper/blob/c21a40a4f651ebd8426b29b8e2bb7d8b72b57cdd/vyper/parser/stmt.py#L586-L606
[ "def", "_is_list_iter", "(", "self", ")", ":", "# Check for literal or memory list.", "iter_var_type", "=", "(", "self", ".", "context", ".", "vars", ".", "get", "(", "self", ".", "stmt", ".", "iter", ".", "id", ")", ".", "typ", "if", "isinstance", "(", ...
c21a40a4f651ebd8426b29b8e2bb7d8b72b57cdd
train
Constants.get_constant
Return unrolled const
vyper/parser/constants.py
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.value, context).lll_no...
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.value, context).lll_no...
[ "Return", "unrolled", "const" ]
ethereum/vyper
python
https://github.com/ethereum/vyper/blob/c21a40a4f651ebd8426b29b8e2bb7d8b72b57cdd/vyper/parser/constants.py#L124-L140
[ "def", "get_constant", "(", "self", ",", "const_name", ",", "context", ")", ":", "# check if value is compatible with", "const", "=", "self", ".", "_constants", "[", "const_name", "]", "if", "isinstance", "(", "const", ",", "ast", ".", "AnnAssign", ")", ":", ...
c21a40a4f651ebd8426b29b8e2bb7d8b72b57cdd
train
FunctionSignature.lookup_sig
Using a list of args, determine the most accurate signature to use from the given context
vyper/signatures/function_signature.py
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 synonymise(s): return s.replace('int128', 'num').replace('uint256', 'num') # for s...
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 synonymise(s): return s.replace('int128', 'num').replace('uint256', 'num') # for s...
[ "Using", "a", "list", "of", "args", "determine", "the", "most", "accurate", "signature", "to", "use", "from", "the", "given", "context" ]
ethereum/vyper
python
https://github.com/ethereum/vyper/blob/c21a40a4f651ebd8426b29b8e2bb7d8b72b57cdd/vyper/signatures/function_signature.py#L317-L366
[ "def", "lookup_sig", "(", "cls", ",", "sigs", ",", "method_name", ",", "expr_args", ",", "stmt_or_expr", ",", "context", ")", ":", "def", "synonymise", "(", "s", ")", ":", "return", "s", ".", "replace", "(", "'int128'", ",", "'num'", ")", ".", "replace...
c21a40a4f651ebd8426b29b8e2bb7d8b72b57cdd
train
annotate_and_optimize_ast
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...
vyper/parser/parser_utils.py
def annotate_and_optimize_ast( parsed_ast: ast.Module, source_code: str, class_types: Optional[ClassTypes] = None, ) -> None: """ 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 * ...
def annotate_and_optimize_ast( parsed_ast: ast.Module, source_code: str, class_types: Optional[ClassTypes] = None, ) -> None: """ 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 * ...
[ "Performs", "annotation", "and", "optimization", "on", "a", "parsed", "python", "AST", "by", "doing", "the", "following", ":" ]
ethereum/vyper
python
https://github.com/ethereum/vyper/blob/c21a40a4f651ebd8426b29b8e2bb7d8b72b57cdd/vyper/parser/parser_utils.py#L833-L854
[ "def", "annotate_and_optimize_ast", "(", "parsed_ast", ":", "ast", ".", "Module", ",", "source_code", ":", "str", ",", "class_types", ":", "Optional", "[", "ClassTypes", "]", "=", "None", ",", ")", "->", "None", ":", "AnnotatingVisitor", "(", "source_code", ...
c21a40a4f651ebd8426b29b8e2bb7d8b72b57cdd
train
check_valid_varname
Handle invalid variable names
vyper/utils.py
def check_valid_varname(varname, custom_units, custom_structs, constants, pos, error_prefix="Variable name invalid.", exc=None): """ Handle invalid variable names """ e...
def check_valid_varname(varname, custom_units, custom_structs, constants, pos, error_prefix="Variable name invalid.", exc=None): """ Handle invalid variable names """ e...
[ "Handle", "invalid", "variable", "names" ]
ethereum/vyper
python
https://github.com/ethereum/vyper/blob/c21a40a4f651ebd8426b29b8e2bb7d8b72b57cdd/vyper/utils.py#L242-L256
[ "def", "check_valid_varname", "(", "varname", ",", "custom_units", ",", "custom_structs", ",", "constants", ",", "pos", ",", "error_prefix", "=", "\"Variable name invalid.\"", ",", "exc", "=", "None", ")", ":", "exc", "=", "VariableDeclarationException", "if", "ex...
c21a40a4f651ebd8426b29b8e2bb7d8b72b57cdd
train
allocate_mid
Allocate a MID which has not been used yet.
aiortc/rtcpeerconnection.py
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
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
[ "Allocate", "a", "MID", "which", "has", "not", "been", "used", "yet", "." ]
aiortc/aiortc
python
https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/rtcpeerconnection.py#L128-L138
[ "def", "allocate_mid", "(", "mids", ")", ":", "i", "=", "0", "while", "True", ":", "mid", "=", "str", "(", "i", ")", "if", "mid", "not", "in", "mids", ":", "mids", ".", "add", "(", "mid", ")", "return", "mid", "i", "+=", "1" ]
60ed036abf4575bd63985724b4493d569e6da29b
train
RTCPeerConnection.addIceCandidate
Add a new :class:`RTCIceCandidate` received from the remote peer. The specified candidate must have a value for either `sdpMid` or `sdpMLineIndex`.
aiortc/rtcpeerconnection.py
def addIceCandidate(self, candidate): """ Add a new :class:`RTCIceCandidate` received from the remote peer. The specified candidate must have a value for either `sdpMid` or `sdpMLineIndex`. """ if candidate.sdpMid is None and candidate.sdpMLineIndex is None: raise Va...
def addIceCandidate(self, candidate): """ Add a new :class:`RTCIceCandidate` received from the remote peer. The specified candidate must have a value for either `sdpMid` or `sdpMLineIndex`. """ if candidate.sdpMid is None and candidate.sdpMLineIndex is None: raise Va...
[ "Add", "a", "new", ":", "class", ":", "RTCIceCandidate", "received", "from", "the", "remote", "peer", "." ]
aiortc/aiortc
python
https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/rtcpeerconnection.py#L300-L317
[ "def", "addIceCandidate", "(", "self", ",", "candidate", ")", ":", "if", "candidate", ".", "sdpMid", "is", "None", "and", "candidate", ".", "sdpMLineIndex", "is", "None", ":", "raise", "ValueError", "(", "'Candidate must have either sdpMid or sdpMLineIndex'", ")", ...
60ed036abf4575bd63985724b4493d569e6da29b
train
RTCPeerConnection.addTrack
Add a :class:`MediaStreamTrack` to the set of media tracks which will be transmitted to the remote peer.
aiortc/rtcpeerconnection.py
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 self.__assertNotClosed() if track.kind not in ['audio', 'video']: raise InternalError('In...
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 self.__assertNotClosed() if track.kind not in ['audio', 'video']: raise InternalError('In...
[ "Add", "a", ":", "class", ":", "MediaStreamTrack", "to", "the", "set", "of", "media", "tracks", "which", "will", "be", "transmitted", "to", "the", "remote", "peer", "." ]
aiortc/aiortc
python
https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/rtcpeerconnection.py#L319-L343
[ "def", "addTrack", "(", "self", ",", "track", ")", ":", "# check state is valid", "self", ".", "__assertNotClosed", "(", ")", "if", "track", ".", "kind", "not", "in", "[", "'audio'", ",", "'video'", "]", ":", "raise", "InternalError", "(", "'Invalid track ki...
60ed036abf4575bd63985724b4493d569e6da29b
train
RTCPeerConnection.addTransceiver
Add a new :class:`RTCRtpTransceiver`.
aiortc/rtcpeerconnection.py
def addTransceiver(self, trackOrKind, direction='sendrecv'): """ Add a new :class:`RTCRtpTransceiver`. """ self.__assertNotClosed() # determine track or kind if hasattr(trackOrKind, 'kind'): kind = trackOrKind.kind track = trackOrKind else...
def addTransceiver(self, trackOrKind, direction='sendrecv'): """ Add a new :class:`RTCRtpTransceiver`. """ self.__assertNotClosed() # determine track or kind if hasattr(trackOrKind, 'kind'): kind = trackOrKind.kind track = trackOrKind else...
[ "Add", "a", "new", ":", "class", ":", "RTCRtpTransceiver", "." ]
aiortc/aiortc
python
https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/rtcpeerconnection.py#L345-L372
[ "def", "addTransceiver", "(", "self", ",", "trackOrKind", ",", "direction", "=", "'sendrecv'", ")", ":", "self", ".", "__assertNotClosed", "(", ")", "# determine track or kind", "if", "hasattr", "(", "trackOrKind", ",", "'kind'", ")", ":", "kind", "=", "trackO...
60ed036abf4575bd63985724b4493d569e6da29b
train
RTCPeerConnection.close
Terminate the ICE agent, ending ICE processing and streams.
aiortc/rtcpeerconnection.py
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 / receivers for transceiver in self.__transceivers: ...
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 / receivers for transceiver in self.__transceivers: ...
[ "Terminate", "the", "ICE", "agent", "ending", "ICE", "processing", "and", "streams", "." ]
aiortc/aiortc
python
https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/rtcpeerconnection.py#L374-L400
[ "async", "def", "close", "(", "self", ")", ":", "if", "self", ".", "__isClosed", ":", "return", "self", ".", "__isClosed", "=", "True", "self", ".", "__setSignalingState", "(", "'closed'", ")", "# stop senders / receivers", "for", "transceiver", "in", "self", ...
60ed036abf4575bd63985724b4493d569e6da29b
train
RTCPeerConnection.createAnswer
Create an SDP answer to an offer received from a remote peer during the offer/answer negotiation of a WebRTC connection. :rtype: :class:`RTCSessionDescription`
aiortc/rtcpeerconnection.py
async def createAnswer(self): """ Create an SDP answer to an offer received from a remote peer during the offer/answer negotiation of a WebRTC connection. :rtype: :class:`RTCSessionDescription` """ # check state is valid self.__assertNotClosed() if self.s...
async def createAnswer(self): """ Create an SDP answer to an offer received from a remote peer during the offer/answer negotiation of a WebRTC connection. :rtype: :class:`RTCSessionDescription` """ # check state is valid self.__assertNotClosed() if self.s...
[ "Create", "an", "SDP", "answer", "to", "an", "offer", "received", "from", "a", "remote", "peer", "during", "the", "offer", "/", "answer", "negotiation", "of", "a", "WebRTC", "connection", "." ]
aiortc/aiortc
python
https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/rtcpeerconnection.py#L402-L441
[ "async", "def", "createAnswer", "(", "self", ")", ":", "# check state is valid", "self", ".", "__assertNotClosed", "(", ")", "if", "self", ".", "signalingState", "not", "in", "[", "'have-remote-offer'", ",", "'have-local-pranswer'", "]", ":", "raise", "InvalidStat...
60ed036abf4575bd63985724b4493d569e6da29b
train
RTCPeerConnection.createDataChannel
Create a data channel with the given label. :rtype: :class:`RTCDataChannel`
aiortc/rtcpeerconnection.py
def createDataChannel(self, label, maxPacketLifeTime=None, maxRetransmits=None, ordered=True, protocol='', negotiated=False, id=None): """ Create a data channel with the given label. :rtype: :class:`RTCDataChannel` """ if maxPacketLifeTime is not None a...
def createDataChannel(self, label, maxPacketLifeTime=None, maxRetransmits=None, ordered=True, protocol='', negotiated=False, id=None): """ Create a data channel with the given label. :rtype: :class:`RTCDataChannel` """ if maxPacketLifeTime is not None a...
[ "Create", "a", "data", "channel", "with", "the", "given", "label", "." ]
aiortc/aiortc
python
https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/rtcpeerconnection.py#L443-L464
[ "def", "createDataChannel", "(", "self", ",", "label", ",", "maxPacketLifeTime", "=", "None", ",", "maxRetransmits", "=", "None", ",", "ordered", "=", "True", ",", "protocol", "=", "''", ",", "negotiated", "=", "False", ",", "id", "=", "None", ")", ":", ...
60ed036abf4575bd63985724b4493d569e6da29b
train
RTCPeerConnection.createOffer
Create an SDP offer for the purpose of starting a new WebRTC connection to a remote peer. :rtype: :class:`RTCSessionDescription`
aiortc/rtcpeerconnection.py
async def createOffer(self): """ Create an SDP offer for the purpose of starting a new WebRTC connection to a remote peer. :rtype: :class:`RTCSessionDescription` """ # check state is valid self.__assertNotClosed() if not self.__sctp and not self.__transc...
async def createOffer(self): """ Create an SDP offer for the purpose of starting a new WebRTC connection to a remote peer. :rtype: :class:`RTCSessionDescription` """ # check state is valid self.__assertNotClosed() if not self.__sctp and not self.__transc...
[ "Create", "an", "SDP", "offer", "for", "the", "purpose", "of", "starting", "a", "new", "WebRTC", "connection", "to", "a", "remote", "peer", "." ]
aiortc/aiortc
python
https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/rtcpeerconnection.py#L466-L546
[ "async", "def", "createOffer", "(", "self", ")", ":", "# check state is valid", "self", ".", "__assertNotClosed", "(", ")", "if", "not", "self", ".", "__sctp", "and", "not", "self", ".", "__transceivers", ":", "raise", "InternalError", "(", "'Cannot create an of...
60ed036abf4575bd63985724b4493d569e6da29b
train
RTCPeerConnection.getStats
Returns statistics for the connection. :rtype: :class:`RTCStatsReport`
aiortc/rtcpeerconnection.py
async def getStats(self): """ Returns statistics for the connection. :rtype: :class:`RTCStatsReport` """ merged = RTCStatsReport() coros = [x.getStats() for x in (self.getSenders() + self.getReceivers())] for report in await asyncio.gather(*coros): me...
async def getStats(self): """ Returns statistics for the connection. :rtype: :class:`RTCStatsReport` """ merged = RTCStatsReport() coros = [x.getStats() for x in (self.getSenders() + self.getReceivers())] for report in await asyncio.gather(*coros): me...
[ "Returns", "statistics", "for", "the", "connection", "." ]
aiortc/aiortc
python
https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/rtcpeerconnection.py#L562-L572
[ "async", "def", "getStats", "(", "self", ")", ":", "merged", "=", "RTCStatsReport", "(", ")", "coros", "=", "[", "x", ".", "getStats", "(", ")", "for", "x", "in", "(", "self", ".", "getSenders", "(", ")", "+", "self", ".", "getReceivers", "(", ")",...
60ed036abf4575bd63985724b4493d569e6da29b
train
RTCPeerConnection.setLocalDescription
Change the local description associated with the connection. :param: sessionDescription: An :class:`RTCSessionDescription` generated by :meth:`createOffer` or :meth:`createAnswer()`.
aiortc/rtcpeerconnection.py
async def setLocalDescription(self, sessionDescription): """ 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 local description associated with the connection. :param: sessionDescription: An :class:`RTCSessionDescription` generated by :meth:`createOffer` or :meth:`createAnswer()`. """ ...
[ "Change", "the", "local", "description", "associated", "with", "the", "connection", "." ]
aiortc/aiortc
python
https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/rtcpeerconnection.py#L581-L637
[ "async", "def", "setLocalDescription", "(", "self", ",", "sessionDescription", ")", ":", "# parse and validate description", "description", "=", "sdp", ".", "SessionDescription", ".", "parse", "(", "sessionDescription", ".", "sdp", ")", "description", ".", "type", "...
60ed036abf4575bd63985724b4493d569e6da29b
train
RTCPeerConnection.setRemoteDescription
Changes the remote description associated with the connection. :param: sessionDescription: An :class:`RTCSessionDescription` created from information received over the signaling channel.
aiortc/rtcpeerconnection.py
async def setRemoteDescription(self, sessionDescription): """ 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 the remote description associated with the connection. :param: sessionDescription: An :class:`RTCSessionDescription` created from information received over the signaling channel. ""...
[ "Changes", "the", "remote", "description", "associated", "with", "the", "connection", "." ]
aiortc/aiortc
python
https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/rtcpeerconnection.py#L639-L774
[ "async", "def", "setRemoteDescription", "(", "self", ",", "sessionDescription", ")", ":", "# parse and validate description", "description", "=", "sdp", ".", "SessionDescription", ".", "parse", "(", "sessionDescription", ".", "sdp", ")", "description", ".", "type", ...
60ed036abf4575bd63985724b4493d569e6da29b
train
pack_remb_fci
Pack the FCI for a Receiver Estimated Maximum Bitrate report. https://tools.ietf.org/html/draft-alvestrand-rmcat-remb-03
aiortc/rtp.py
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'REMB' exponent = 0 mantissa = bitrate while mantissa > 0x3ffff: mantissa >>= 1 exponent += 1 d...
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'REMB' exponent = 0 mantissa = bitrate while mantissa > 0x3ffff: mantissa >>= 1 exponent += 1 d...
[ "Pack", "the", "FCI", "for", "a", "Receiver", "Estimated", "Maximum", "Bitrate", "report", "." ]
aiortc/aiortc
python
https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/rtp.py#L150-L168
[ "def", "pack_remb_fci", "(", "bitrate", ",", "ssrcs", ")", ":", "data", "=", "b'REMB'", "exponent", "=", "0", "mantissa", "=", "bitrate", "while", "mantissa", ">", "0x3ffff", ":", "mantissa", ">>=", "1", "exponent", "+=", "1", "data", "+=", "pack", "(", ...
60ed036abf4575bd63985724b4493d569e6da29b
train
unpack_remb_fci
Unpack the FCI for a Receiver Estimated Maximum Bitrate report. https://tools.ietf.org/html/draft-alvestrand-rmcat-remb-03
aiortc/rtp.py
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) < 8 or data[0:4] != b'REMB': raise ValueError('Invalid REMB prefix') exponent = (data[5] & 0xfc) >> 2 mantissa ...
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) < 8 or data[0:4] != b'REMB': raise ValueError('Invalid REMB prefix') exponent = (data[5] & 0xfc) >> 2 mantissa ...
[ "Unpack", "the", "FCI", "for", "a", "Receiver", "Estimated", "Maximum", "Bitrate", "report", "." ]
aiortc/aiortc
python
https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/rtp.py#L171-L190
[ "def", "unpack_remb_fci", "(", "data", ")", ":", "if", "len", "(", "data", ")", "<", "8", "or", "data", "[", "0", ":", "4", "]", "!=", "b'REMB'", ":", "raise", "ValueError", "(", "'Invalid REMB prefix'", ")", "exponent", "=", "(", "data", "[", "5", ...
60ed036abf4575bd63985724b4493d569e6da29b
train
unpack_header_extensions
Parse header extensions according to RFC 5285.
aiortc/rtp.py
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: # One-Byte Header while pos < len(...
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: # One-Byte Header while pos < len(...
[ "Parse", "header", "extensions", "according", "to", "RFC", "5285", "." ]
aiortc/aiortc
python
https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/rtp.py#L204-L248
[ "def", "unpack_header_extensions", "(", "extension_profile", ":", "int", ",", "extension_value", ":", "bytes", ")", "->", "List", "[", "Tuple", "[", "int", ",", "bytes", "]", "]", ":", "extensions", "=", "[", "]", "pos", "=", "0", "if", "extension_profile"...
60ed036abf4575bd63985724b4493d569e6da29b
train
pack_header_extensions
Serialize header extensions according to RFC 5285.
aiortc/rtp.py
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, extension_value one_byte = True for x_id, x_...
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, extension_value one_byte = True for x_id, x_...
[ "Serialize", "header", "extensions", "according", "to", "RFC", "5285", "." ]
aiortc/aiortc
python
https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/rtp.py#L251-L287
[ "def", "pack_header_extensions", "(", "extensions", ":", "List", "[", "Tuple", "[", "int", ",", "bytes", "]", "]", ")", "->", "Tuple", "[", "int", ",", "bytes", "]", ":", "extension_profile", "=", "0", "extension_value", "=", "b''", "if", "not", "extensi...
60ed036abf4575bd63985724b4493d569e6da29b
train
unwrap_rtx
Recover initial packet from a retransmission packet.
aiortc/rtp.py
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], timestamp=rtx.timestamp, ssrc=ssrc, p...
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], timestamp=rtx.timestamp, ssrc=ssrc, p...
[ "Recover", "initial", "packet", "from", "a", "retransmission", "packet", "." ]
aiortc/aiortc
python
https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/rtp.py#L290-L303
[ "def", "unwrap_rtx", "(", "rtx", ",", "payload_type", ",", "ssrc", ")", ":", "packet", "=", "RtpPacket", "(", "payload_type", "=", "payload_type", ",", "marker", "=", "rtx", ".", "marker", ",", "sequence_number", "=", "unpack", "(", "'!H'", ",", "rtx", "...
60ed036abf4575bd63985724b4493d569e6da29b
train
wrap_rtx
Create a retransmission packet from a lost packet.
aiortc/rtp.py
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, timestamp=packet.timestamp, ssrc=ssrc, ...
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, timestamp=packet.timestamp, ssrc=ssrc, ...
[ "Create", "a", "retransmission", "packet", "from", "a", "lost", "packet", "." ]
aiortc/aiortc
python
https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/rtp.py#L306-L319
[ "def", "wrap_rtx", "(", "packet", ",", "payload_type", ",", "sequence_number", ",", "ssrc", ")", ":", "rtx", "=", "RtpPacket", "(", "payload_type", "=", "payload_type", ",", "marker", "=", "packet", ".", "marker", ",", "sequence_number", "=", "sequence_number"...
60ed036abf4575bd63985724b4493d569e6da29b
train
RTCRtpSender.getStats
Returns statistics about the RTP sender. :rtype: :class:`RTCStatsReport`
aiortc/rtcrtpsender.py
async def getStats(self): """ Returns statistics about the RTP sender. :rtype: :class:`RTCStatsReport` """ self.__stats.add(RTCOutboundRtpStreamStats( # RTCStats timestamp=clock.current_datetime(), type='outbound-rtp', id='outbound...
async def getStats(self): """ Returns statistics about the RTP sender. :rtype: :class:`RTCStatsReport` """ self.__stats.add(RTCOutboundRtpStreamStats( # RTCStats timestamp=clock.current_datetime(), type='outbound-rtp', id='outbound...
[ "Returns", "statistics", "about", "the", "RTP", "sender", "." ]
aiortc/aiortc
python
https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/rtcrtpsender.py#L105-L128
[ "async", "def", "getStats", "(", "self", ")", ":", "self", ".", "__stats", ".", "add", "(", "RTCOutboundRtpStreamStats", "(", "# RTCStats", "timestamp", "=", "clock", ".", "current_datetime", "(", ")", ",", "type", "=", "'outbound-rtp'", ",", "id", "=", "'...
60ed036abf4575bd63985724b4493d569e6da29b
train
RTCRtpSender.send
Attempt to set the parameters controlling the sending of media. :param: parameters: The :class:`RTCRtpParameters` for the sender.
aiortc/rtcrtpsender.py
async def send(self, parameters: RTCRtpSendParameters): """ Attempt to set the parameters controlling the sending of media. :param: parameters: The :class:`RTCRtpParameters` for the sender. """ if not self.__started: self.__cname = parameters.rtcp.cname s...
async def send(self, parameters: RTCRtpSendParameters): """ Attempt to set the parameters controlling the sending of media. :param: parameters: The :class:`RTCRtpParameters` for the sender. """ if not self.__started: self.__cname = parameters.rtcp.cname s...
[ "Attempt", "to", "set", "the", "parameters", "controlling", "the", "sending", "of", "media", "." ]
aiortc/aiortc
python
https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/rtcrtpsender.py#L140-L162
[ "async", "def", "send", "(", "self", ",", "parameters", ":", "RTCRtpSendParameters", ")", ":", "if", "not", "self", ".", "__started", ":", "self", ".", "__cname", "=", "parameters", ".", "rtcp", ".", "cname", "self", ".", "__mid", "=", "parameters", ".",...
60ed036abf4575bd63985724b4493d569e6da29b
train
RTCRtpSender.stop
Irreversibly stop the sender.
aiortc/rtcrtpsender.py
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( self.__rtp_exited.wait(), ...
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( self.__rtp_exited.wait(), ...
[ "Irreversibly", "stop", "the", "sender", "." ]
aiortc/aiortc
python
https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/rtcrtpsender.py#L164-L174
[ "async", "def", "stop", "(", "self", ")", ":", "if", "self", ".", "__started", ":", "self", ".", "__transport", ".", "_unregister_rtp_sender", "(", "self", ")", "self", ".", "__rtp_task", ".", "cancel", "(", ")", "self", ".", "__rtcp_task", ".", "cancel"...
60ed036abf4575bd63985724b4493d569e6da29b
train
RTCRtpSender._retransmit
Retransmit an RTP packet which was reported as lost.
aiortc/rtcrtpsender.py
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_number: if self.__rtx_payload_type is not No...
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_number: if self.__rtx_payload_type is not No...
[ "Retransmit", "an", "RTP", "packet", "which", "was", "reported", "as", "lost", "." ]
aiortc/aiortc
python
https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/rtcrtpsender.py#L228-L243
[ "async", "def", "_retransmit", "(", "self", ",", "sequence_number", ")", ":", "packet", "=", "self", ".", "__rtp_history", ".", "get", "(", "sequence_number", "%", "RTP_HISTORY_SIZE", ")", "if", "packet", "and", "packet", ".", "sequence_number", "==", "sequenc...
60ed036abf4575bd63985724b4493d569e6da29b
train
uint16_gt
Return a > b.
aiortc/utils.py
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)))
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", "." ]
aiortc/aiortc
python
https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/utils.py#L20-L26
[ "def", "uint16_gt", "(", "a", ":", "int", ",", "b", ":", "int", ")", "->", "bool", ":", "half_mod", "=", "0x8000", "return", "(", "(", "(", "a", "<", "b", ")", "and", "(", "(", "b", "-", "a", ")", ">", "half_mod", ")", ")", "or", "(", "(", ...
60ed036abf4575bd63985724b4493d569e6da29b
train
uint16_gte
Return a >= b.
aiortc/utils.py
def uint16_gte(a: int, b: int) -> bool: """ Return a >= b. """ return (a == b) or uint16_gt(a, b)
def uint16_gte(a: int, b: int) -> bool: """ Return a >= b. """ return (a == b) or uint16_gt(a, b)
[ "Return", "a", ">", "=", "b", "." ]
aiortc/aiortc
python
https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/utils.py#L29-L33
[ "def", "uint16_gte", "(", "a", ":", "int", ",", "b", ":", "int", ")", "->", "bool", ":", "return", "(", "a", "==", "b", ")", "or", "uint16_gt", "(", "a", ",", "b", ")" ]
60ed036abf4575bd63985724b4493d569e6da29b
train
uint32_gt
Return a > b.
aiortc/utils.py
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)))
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", "." ]
aiortc/aiortc
python
https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/utils.py#L43-L49
[ "def", "uint32_gt", "(", "a", ":", "int", ",", "b", ":", "int", ")", "->", "bool", ":", "half_mod", "=", "0x80000000", "return", "(", "(", "(", "a", "<", "b", ")", "and", "(", "(", "b", "-", "a", ")", ">", "half_mod", ")", ")", "or", "(", "...
60ed036abf4575bd63985724b4493d569e6da29b
train
uint32_gte
Return a >= b.
aiortc/utils.py
def uint32_gte(a: int, b: int) -> bool: """ Return a >= b. """ return (a == b) or uint32_gt(a, b)
def uint32_gte(a: int, b: int) -> bool: """ Return a >= b. """ return (a == b) or uint32_gt(a, b)
[ "Return", "a", ">", "=", "b", "." ]
aiortc/aiortc
python
https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/utils.py#L52-L56
[ "def", "uint32_gte", "(", "a", ":", "int", ",", "b", ":", "int", ")", "->", "bool", ":", "return", "(", "a", "==", "b", ")", "or", "uint32_gt", "(", "a", ",", "b", ")" ]
60ed036abf4575bd63985724b4493d569e6da29b
train
Tun.up
Bring up interface. Equivalent to ifconfig [iface] up.
examples/datachannel-vpn/tuntap.py
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()
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()
[ "Bring", "up", "interface", ".", "Equivalent", "to", "ifconfig", "[", "iface", "]", "up", "." ]
aiortc/aiortc
python
https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/examples/datachannel-vpn/tuntap.py#L69-L74
[ "def", "up", "(", "self", ")", ":", "# Set new flags", "flags", "=", "self", ".", "ifflags", "|", "IFF_UP", "self", ".", "ifflags", "=", "flags", "self", ".", "get_mtu", "(", ")" ]
60ed036abf4575bd63985724b4493d569e6da29b
train
Tun.open
Open file corresponding to the TUN device.
examples/datachannel-vpn/tuntap.py
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, TUNSETIFF, ifr) fcntl.ioctl(self.fd, TU...
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, TUNSETIFF, ifr) fcntl.ioctl(self.fd, TU...
[ "Open", "file", "corresponding", "to", "the", "TUN", "device", "." ]
aiortc/aiortc
python
https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/examples/datachannel-vpn/tuntap.py#L90-L97
[ "def", "open", "(", "self", ")", ":", "self", ".", "fd", "=", "open", "(", "'/dev/net/tun'", ",", "'rb+'", ",", "buffering", "=", "0", ")", "tun_flags", "=", "IFF_TAP", "|", "IFF_NO_PI", "|", "IFF_PERSIST", "ifr", "=", "struct", ".", "pack", "(", "'1...
60ed036abf4575bd63985724b4493d569e6da29b
train
RTCIceGatherer.gather
Gather ICE candidates.
aiortc/rtcicetransport.py
async def gather(self): """ Gather ICE candidates. """ if self.__state == 'new': self.__setState('gathering') await self._connection.gather_candidates() self.__setState('completed')
async def gather(self): """ Gather ICE candidates. """ if self.__state == 'new': self.__setState('gathering') await self._connection.gather_candidates() self.__setState('completed')
[ "Gather", "ICE", "candidates", "." ]
aiortc/aiortc
python
https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/rtcicetransport.py#L158-L165
[ "async", "def", "gather", "(", "self", ")", ":", "if", "self", ".", "__state", "==", "'new'", ":", "self", ".", "__setState", "(", "'gathering'", ")", "await", "self", ".", "_connection", ".", "gather_candidates", "(", ")", "self", ".", "__setState", "("...
60ed036abf4575bd63985724b4493d569e6da29b
train
RTCIceGatherer.getLocalParameters
Retrieve the ICE parameters of the ICE gatherer. :rtype: RTCIceParameters
aiortc/rtcicetransport.py
def getLocalParameters(self): """ Retrieve the ICE parameters of the ICE gatherer. :rtype: RTCIceParameters """ return RTCIceParameters( usernameFragment=self._connection.local_username, password=self._connection.local_password)
def getLocalParameters(self): """ Retrieve the ICE parameters of the ICE gatherer. :rtype: RTCIceParameters """ return RTCIceParameters( usernameFragment=self._connection.local_username, password=self._connection.local_password)
[ "Retrieve", "the", "ICE", "parameters", "of", "the", "ICE", "gatherer", "." ]
aiortc/aiortc
python
https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/rtcicetransport.py#L181-L189
[ "def", "getLocalParameters", "(", "self", ")", ":", "return", "RTCIceParameters", "(", "usernameFragment", "=", "self", ".", "_connection", ".", "local_username", ",", "password", "=", "self", ".", "_connection", ".", "local_password", ")" ]
60ed036abf4575bd63985724b4493d569e6da29b
train
RTCIceTransport.addRemoteCandidate
Add a remote candidate.
aiortc/rtcicetransport.py
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) else: ...
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) else: ...
[ "Add", "a", "remote", "candidate", "." ]
aiortc/aiortc
python
https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/rtcicetransport.py#L252-L261
[ "def", "addRemoteCandidate", "(", "self", ",", "candidate", ")", ":", "# FIXME: don't use private member!", "if", "not", "self", ".", "_connection", ".", "_remote_candidates_end", ":", "if", "candidate", "is", "None", ":", "self", ".", "_connection", ".", "add_rem...
60ed036abf4575bd63985724b4493d569e6da29b
train
RTCIceTransport.start
Initiate connectivity checks. :param: remoteParameters: The :class:`RTCIceParameters` associated with the remote :class:`RTCIceTransport`.
aiortc/rtcicetransport.py
async def start(self, remoteParameters): """ Initiate connectivity checks. :param: remoteParameters: The :class:`RTCIceParameters` associated with the remote :class:`RTCIceTransport`. """ if self.state == 'closed': raise InvalidState...
async def start(self, remoteParameters): """ Initiate connectivity checks. :param: remoteParameters: The :class:`RTCIceParameters` associated with the remote :class:`RTCIceTransport`. """ if self.state == 'closed': raise InvalidState...
[ "Initiate", "connectivity", "checks", "." ]
aiortc/aiortc
python
https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/rtcicetransport.py#L270-L294
[ "async", "def", "start", "(", "self", ",", "remoteParameters", ")", ":", "if", "self", ".", "state", "==", "'closed'", ":", "raise", "InvalidStateError", "(", "'RTCIceTransport is closed'", ")", "# handle the case where start is already in progress", "if", "self", "."...
60ed036abf4575bd63985724b4493d569e6da29b
train
RTCDataChannel.send
Send `data` across the data channel to the remote peer.
aiortc/rtcdatachannel.py
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('Cannot send unsupported data type: %s' % type(data)) ...
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('Cannot send unsupported data type: %s' % type(data)) ...
[ "Send", "data", "across", "the", "data", "channel", "to", "the", "remote", "peer", "." ]
aiortc/aiortc
python
https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/rtcdatachannel.py#L134-L144
[ "def", "send", "(", "self", ",", "data", ")", ":", "if", "self", ".", "readyState", "!=", "'open'", ":", "raise", "InvalidStateError", "if", "not", "isinstance", "(", "data", ",", "(", "str", ",", "bytes", ")", ")", ":", "raise", "ValueError", "(", "...
60ed036abf4575bd63985724b4493d569e6da29b
train
RTCRtpTransceiver.setCodecPreferences
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...
aiortc/rtcrtptransceiver.py
def setCodecPreferences(self, codecs): """ 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 ...
def setCodecPreferences(self, codecs): """ 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 ...
[ "Override", "the", "default", "codec", "preferences", "." ]
aiortc/aiortc
python
https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/rtcrtptransceiver.py#L81-L101
[ "def", "setCodecPreferences", "(", "self", ",", "codecs", ")", ":", "if", "not", "codecs", ":", "self", ".", "_preferred_codecs", "=", "[", "]", "capabilities", "=", "get_capabilities", "(", "self", ".", "kind", ")", ".", "codecs", "unique", "=", "[", "]...
60ed036abf4575bd63985724b4493d569e6da29b
train
RTCRtpTransceiver.stop
Permanently stops the :class:`RTCRtpTransceiver`.
aiortc/rtcrtptransceiver.py
async def stop(self): """ Permanently stops the :class:`RTCRtpTransceiver`. """ await self.__receiver.stop() await self.__sender.stop() self.__stopped = True
async def stop(self): """ Permanently stops the :class:`RTCRtpTransceiver`. """ await self.__receiver.stop() await self.__sender.stop() self.__stopped = True
[ "Permanently", "stops", "the", ":", "class", ":", "RTCRtpTransceiver", "." ]
aiortc/aiortc
python
https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/rtcrtptransceiver.py#L103-L109
[ "async", "def", "stop", "(", "self", ")", ":", "await", "self", ".", "__receiver", ".", "stop", "(", ")", "await", "self", ".", "__sender", ".", "stop", "(", ")", "self", ".", "__stopped", "=", "True" ]
60ed036abf4575bd63985724b4493d569e6da29b
train
MediaBlackhole.start
Start discarding media.
aiortc/contrib/media.py
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))
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))
[ "Start", "discarding", "media", "." ]
aiortc/aiortc
python
https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/contrib/media.py#L62-L68
[ "async", "def", "start", "(", "self", ")", ":", "for", "track", ",", "task", "in", "self", ".", "__tracks", ".", "items", "(", ")", ":", "if", "task", "is", "None", ":", "self", ".", "__tracks", "[", "track", "]", "=", "asyncio", ".", "ensure_futur...
60ed036abf4575bd63985724b4493d569e6da29b
train
MediaBlackhole.stop
Stop discarding media.
aiortc/contrib/media.py
async def stop(self): """ Stop discarding media. """ for task in self.__tracks.values(): if task is not None: task.cancel() self.__tracks = {}
async def stop(self): """ Stop discarding media. """ for task in self.__tracks.values(): if task is not None: task.cancel() self.__tracks = {}
[ "Stop", "discarding", "media", "." ]
aiortc/aiortc
python
https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/contrib/media.py#L70-L77
[ "async", "def", "stop", "(", "self", ")", ":", "for", "task", "in", "self", ".", "__tracks", ".", "values", "(", ")", ":", "if", "task", "is", "not", "None", ":", "task", ".", "cancel", "(", ")", "self", ".", "__tracks", "=", "{", "}" ]
60ed036abf4575bd63985724b4493d569e6da29b
train
MediaRecorder.addTrack
Add a track to be recorded. :param: track: An :class:`aiortc.AudioStreamTrack` or :class:`aiortc.VideoStreamTrack`.
aiortc/contrib/media.py
def addTrack(self, track): """ Add a track to be recorded. :param: track: An :class:`aiortc.AudioStreamTrack` or :class:`aiortc.VideoStreamTrack`. """ if track.kind == 'audio': if self.__container.format.name == 'wav': codec_name = 'pcm_s16le' ...
def addTrack(self, track): """ Add a track to be recorded. :param: track: An :class:`aiortc.AudioStreamTrack` or :class:`aiortc.VideoStreamTrack`. """ if track.kind == 'audio': if self.__container.format.name == 'wav': codec_name = 'pcm_s16le' ...
[ "Add", "a", "track", "to", "be", "recorded", "." ]
aiortc/aiortc
python
https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/contrib/media.py#L306-L327
[ "def", "addTrack", "(", "self", ",", "track", ")", ":", "if", "track", ".", "kind", "==", "'audio'", ":", "if", "self", ".", "__container", ".", "format", ".", "name", "==", "'wav'", ":", "codec_name", "=", "'pcm_s16le'", "elif", "self", ".", "__contai...
60ed036abf4575bd63985724b4493d569e6da29b
train
MediaRecorder.start
Start recording.
aiortc/contrib/media.py
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))
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))
[ "Start", "recording", "." ]
aiortc/aiortc
python
https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/contrib/media.py#L329-L335
[ "async", "def", "start", "(", "self", ")", ":", "for", "track", ",", "context", "in", "self", ".", "__tracks", ".", "items", "(", ")", ":", "if", "context", ".", "task", "is", "None", ":", "context", ".", "task", "=", "asyncio", ".", "ensure_future",...
60ed036abf4575bd63985724b4493d569e6da29b
train
MediaRecorder.stop
Stop recording.
aiortc/contrib/media.py
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 for packet in con...
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 for packet in con...
[ "Stop", "recording", "." ]
aiortc/aiortc
python
https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/contrib/media.py#L337-L352
[ "async", "def", "stop", "(", "self", ")", ":", "if", "self", ".", "__container", ":", "for", "track", ",", "context", "in", "self", ".", "__tracks", ".", "items", "(", ")", ":", "if", "context", ".", "task", "is", "not", "None", ":", "context", "."...
60ed036abf4575bd63985724b4493d569e6da29b
train
RTCCertificate.expires
The date and time after which the certificate will be considered invalid.
aiortc/rtcdtlstransport.py
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%d%H%M%SZ').replace( tzinfo=datetime.timezone.utc)
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%d%H%M%SZ').replace( tzinfo=datetime.timezone.utc)
[ "The", "date", "and", "time", "after", "which", "the", "certificate", "will", "be", "considered", "invalid", "." ]
aiortc/aiortc
python
https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/rtcdtlstransport.py#L173-L179
[ "def", "expires", "(", "self", ")", ":", "not_after", "=", "self", ".", "_cert", ".", "get_notAfter", "(", ")", ".", "decode", "(", "'ascii'", ")", "return", "datetime", ".", "datetime", ".", "strptime", "(", "not_after", ",", "'%Y%m%d%H%M%SZ'", ")", "."...
60ed036abf4575bd63985724b4493d569e6da29b
train
RTCCertificate.generateCertificate
Create and return an X.509 certificate and corresponding private key. :rtype: RTCCertificate
aiortc/rtcdtlstransport.py
def generateCertificate(cls): """ Create and return an X.509 certificate and corresponding private key. :rtype: RTCCertificate """ key = generate_key() cert = generate_certificate(key) return cls(key=key, cert=cert)
def generateCertificate(cls): """ Create and return an X.509 certificate and corresponding private key. :rtype: RTCCertificate """ key = generate_key() cert = generate_certificate(key) return cls(key=key, cert=cert)
[ "Create", "and", "return", "an", "X", ".", "509", "certificate", "and", "corresponding", "private", "key", "." ]
aiortc/aiortc
python
https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/rtcdtlstransport.py#L191-L199
[ "def", "generateCertificate", "(", "cls", ")", ":", "key", "=", "generate_key", "(", ")", "cert", "=", "generate_certificate", "(", "key", ")", "return", "cls", "(", "key", "=", "key", ",", "cert", "=", "cert", ")" ]
60ed036abf4575bd63985724b4493d569e6da29b
train
RTCDtlsTransport.start
Start DTLS transport negotiation with the parameters of the remote DTLS transport. :param: remoteParameters: An :class:`RTCDtlsParameters`.
aiortc/rtcdtlstransport.py
async def start(self, remoteParameters): """ Start DTLS transport negotiation with the parameters of the remote DTLS transport. :param: remoteParameters: An :class:`RTCDtlsParameters`. """ assert self._state == State.NEW assert len(remoteParameters.fingerprints) ...
async def start(self, remoteParameters): """ Start DTLS transport negotiation with the parameters of the remote DTLS transport. :param: remoteParameters: An :class:`RTCDtlsParameters`. """ assert self._state == State.NEW assert len(remoteParameters.fingerprints) ...
[ "Start", "DTLS", "transport", "negotiation", "with", "the", "parameters", "of", "the", "remote", "DTLS", "transport", "." ]
aiortc/aiortc
python
https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/rtcdtlstransport.py#L378-L459
[ "async", "def", "start", "(", "self", ",", "remoteParameters", ")", ":", "assert", "self", ".", "_state", "==", "State", ".", "NEW", "assert", "len", "(", "remoteParameters", ".", "fingerprints", ")", "if", "self", ".", "transport", ".", "role", "==", "'...
60ed036abf4575bd63985724b4493d569e6da29b
train
RTCDtlsTransport.stop
Stop and close the DTLS transport.
aiortc/rtcdtlstransport.py
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.ssl) try: ...
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.ssl) try: ...
[ "Stop", "and", "close", "the", "DTLS", "transport", "." ]
aiortc/aiortc
python
https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/rtcdtlstransport.py#L461-L475
[ "async", "def", "stop", "(", "self", ")", ":", "if", "self", ".", "_task", "is", "not", "None", ":", "self", ".", "_task", ".", "cancel", "(", ")", "self", ".", "_task", "=", "None", "if", "self", ".", "_state", "in", "[", "State", ".", "CONNECTI...
60ed036abf4575bd63985724b4493d569e6da29b
train
RTCDtlsTransport._write_ssl
Flush outgoing data which OpenSSL put in our BIO to the transport.
aiortc/rtcdtlstransport.py
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_bio, self.write_cdata, len(self.write_cdata)) await self....
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_bio, self.write_cdata, len(self.write_cdata)) await self....
[ "Flush", "outgoing", "data", "which", "OpenSSL", "put", "in", "our", "BIO", "to", "the", "transport", "." ]
aiortc/aiortc
python
https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/rtcdtlstransport.py#L632-L641
[ "async", "def", "_write_ssl", "(", "self", ")", ":", "pending", "=", "lib", ".", "BIO_ctrl_pending", "(", "self", ".", "write_bio", ")", "if", "pending", ">", "0", ":", "result", "=", "lib", ".", "BIO_read", "(", "self", ".", "write_bio", ",", "self", ...
60ed036abf4575bd63985724b4493d569e6da29b
train
AimdRateControl.set_estimate
For testing purposes.
aiortc/rate.py
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
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
[ "For", "testing", "purposes", "." ]
aiortc/aiortc
python
https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/rate.py#L50-L56
[ "def", "set_estimate", "(", "self", ",", "bitrate", ":", "int", ",", "now_ms", ":", "int", ")", ":", "self", ".", "current_bitrate", "=", "self", ".", "_clamp_bitrate", "(", "bitrate", ",", "bitrate", ")", "self", ".", "current_bitrate_initialized", "=", "...
60ed036abf4575bd63985724b4493d569e6da29b
train
AudioStreamTrack.recv
Receive the next :class:`~av.audio.frame.AudioFrame`. The base implementation just reads silence, subclass :class:`AudioStreamTrack` to provide a useful implementation.
aiortc/mediastreams.py
async def recv(self): """ Receive the next :class:`~av.audio.frame.AudioFrame`. The base implementation just reads silence, subclass :class:`AudioStreamTrack` to provide a useful implementation. """ if self.readyState != 'live': raise MediaStreamError ...
async def recv(self): """ Receive the next :class:`~av.audio.frame.AudioFrame`. The base implementation just reads silence, subclass :class:`AudioStreamTrack` to provide a useful implementation. """ if self.readyState != 'live': raise MediaStreamError ...
[ "Receive", "the", "next", ":", "class", ":", "~av", ".", "audio", ".", "frame", ".", "AudioFrame", "." ]
aiortc/aiortc
python
https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/mediastreams.py#L63-L90
[ "async", "def", "recv", "(", "self", ")", ":", "if", "self", ".", "readyState", "!=", "'live'", ":", "raise", "MediaStreamError", "sample_rate", "=", "8000", "samples", "=", "int", "(", "AUDIO_PTIME", "*", "sample_rate", ")", "if", "hasattr", "(", "self", ...
60ed036abf4575bd63985724b4493d569e6da29b
train
VideoStreamTrack.recv
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.
aiortc/mediastreams.py
async def recv(self): """ 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. """ pts, time_base = await self.next_timestamp() ...
async def recv(self): """ 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. """ pts, time_base = await self.next_timestamp() ...
[ "Receive", "the", "next", ":", "class", ":", "~av", ".", "video", ".", "frame", ".", "VideoFrame", "." ]
aiortc/aiortc
python
https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/mediastreams.py#L112-L126
[ "async", "def", "recv", "(", "self", ")", ":", "pts", ",", "time_base", "=", "await", "self", ".", "next_timestamp", "(", ")", "frame", "=", "VideoFrame", "(", "width", "=", "640", ",", "height", "=", "480", ")", "for", "p", "in", "frame", ".", "pl...
60ed036abf4575bd63985724b4493d569e6da29b
train
InboundStream.prune_chunks
Prune chunks up to the given TSN.
aiortc/rtcsctptransport.py
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.user_data) else: ...
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.user_data) else: ...
[ "Prune", "chunks", "up", "to", "the", "given", "TSN", "." ]
aiortc/aiortc
python
https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/rtcsctptransport.py#L514-L528
[ "def", "prune_chunks", "(", "self", ",", "tsn", ")", ":", "pos", "=", "-", "1", "size", "=", "0", "for", "i", ",", "chunk", "in", "enumerate", "(", "self", ".", "reassembly", ")", ":", "if", "uint32_gte", "(", "tsn", ",", "chunk", ".", "tsn", ")"...
60ed036abf4575bd63985724b4493d569e6da29b
train
RTCSctpTransport.start
Start the transport.
aiortc/rtcsctptransport.py
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 logger.isEnabledFor(logg...
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 logger.isEnabledFor(logg...
[ "Start", "the", "transport", "." ]
aiortc/aiortc
python
https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/rtcsctptransport.py#L657-L680
[ "async", "def", "start", "(", "self", ",", "remoteCaps", ",", "remotePort", ")", ":", "if", "not", "self", ".", "__started", ":", "self", ".", "__started", "=", "True", "self", ".", "__state", "=", "'connecting'", "self", ".", "_remote_port", "=", "remot...
60ed036abf4575bd63985724b4493d569e6da29b
train
RTCSctpTransport.stop
Stop the transport.
aiortc/rtcsctptransport.py
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)
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)
[ "Stop", "the", "transport", "." ]
aiortc/aiortc
python
https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/rtcsctptransport.py#L682-L689
[ "async", "def", "stop", "(", "self", ")", ":", "if", "self", ".", "_association_state", "!=", "self", ".", "State", ".", "CLOSED", ":", "await", "self", ".", "_abort", "(", ")", "self", ".", "__transport", ".", "_unregister_data_receiver", "(", "self", "...
60ed036abf4575bd63985724b4493d569e6da29b
train
RTCSctpTransport._init
Initialize the association.
aiortc/rtcsctptransport.py
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 chunk.inbound_streams = sel...
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 chunk.inbound_streams = sel...
[ "Initialize", "the", "association", "." ]
aiortc/aiortc
python
https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/rtcsctptransport.py#L701-L716
[ "async", "def", "_init", "(", "self", ")", ":", "chunk", "=", "InitChunk", "(", ")", "chunk", ".", "initiate_tag", "=", "self", ".", "_local_verification_tag", "chunk", ".", "advertised_rwnd", "=", "self", ".", "_advertised_rwnd", "chunk", ".", "outbound_strea...
60ed036abf4575bd63985724b4493d569e6da29b
train
RTCSctpTransport._get_extensions
Gets what extensions are supported by the remote party.
aiortc/rtcsctptransport.py
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 elif k == SCTP_SUPPORTED_CHUNK_EXT: self._...
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 elif k == SCTP_SUPPORTED_CHUNK_EXT: self._...
[ "Gets", "what", "extensions", "are", "supported", "by", "the", "remote", "party", "." ]
aiortc/aiortc
python
https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/rtcsctptransport.py#L724-L732
[ "def", "_get_extensions", "(", "self", ",", "params", ")", ":", "for", "k", ",", "v", "in", "params", ":", "if", "k", "==", "SCTP_PRSCTP_SUPPORTED", ":", "self", ".", "_remote_partial_reliability", "=", "True", "elif", "k", "==", "SCTP_SUPPORTED_CHUNK_EXT", ...
60ed036abf4575bd63985724b4493d569e6da29b
train
RTCSctpTransport._set_extensions
Sets what extensions are supported by the local party.
aiortc/rtcsctptransport.py
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'')) extensions.append(ForwardTsnChunk.type) extensions.ap...
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'')) extensions.append(ForwardTsnChunk.type) extensions.ap...
[ "Sets", "what", "extensions", "are", "supported", "by", "the", "local", "party", "." ]
aiortc/aiortc
python
https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/rtcsctptransport.py#L734-L744
[ "def", "_set_extensions", "(", "self", ",", "params", ")", ":", "extensions", "=", "[", "]", "if", "self", ".", "_local_partial_reliability", ":", "params", ".", "append", "(", "(", "SCTP_PRSCTP_SUPPORTED", ",", "b''", ")", ")", "extensions", ".", "append", ...
60ed036abf4575bd63985724b4493d569e6da29b
train
RTCSctpTransport._get_inbound_stream
Get or create the inbound stream with the specified ID.
aiortc/rtcsctptransport.py
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._inbound_streams[stream_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._inbound_streams[stream_id]
[ "Get", "or", "create", "the", "inbound", "stream", "with", "the", "specified", "ID", "." ]
aiortc/aiortc
python
https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/rtcsctptransport.py#L746-L752
[ "def", "_get_inbound_stream", "(", "self", ",", "stream_id", ")", ":", "if", "stream_id", "not", "in", "self", ".", "_inbound_streams", ":", "self", ".", "_inbound_streams", "[", "stream_id", "]", "=", "InboundStream", "(", ")", "return", "self", ".", "_inbo...
60ed036abf4575bd63985724b4493d569e6da29b
train
RTCSctpTransport._handle_data
Handle data received from the network.
aiortc/rtcsctptransport.py
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 = len([x for x in chunks if isinstance(x, I...
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 = len([x for x in chunks if isinstance(x, I...
[ "Handle", "data", "received", "from", "the", "network", "." ]
aiortc/aiortc
python
https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/rtcsctptransport.py#L757-L786
[ "async", "def", "_handle_data", "(", "self", ",", "data", ")", ":", "try", ":", "_", ",", "_", ",", "verification_tag", ",", "chunks", "=", "parse_packet", "(", "data", ")", "except", "ValueError", ":", "return", "# is this an init?", "init_chunk", "=", "l...
60ed036abf4575bd63985724b4493d569e6da29b
train
RTCSctpTransport._maybe_abandon
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.
aiortc/rtcsctptransport.py
def _maybe_abandon(self, chunk): """ 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. """ if chunk._abandoned: return True abandon = ( (chunk...
def _maybe_abandon(self, chunk): """ 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. """ if chunk._abandoned: return True abandon = ( (chunk...
[ "Determine", "if", "a", "chunk", "needs", "to", "be", "marked", "as", "abandoned", "." ]
aiortc/aiortc
python
https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/rtcsctptransport.py#L788-L819
[ "def", "_maybe_abandon", "(", "self", ",", "chunk", ")", ":", "if", "chunk", ".", "_abandoned", ":", "return", "True", "abandon", "=", "(", "(", "chunk", ".", "_max_retransmits", "is", "not", "None", "and", "chunk", ".", "_sent_count", ">", "chunk", ".",...
60ed036abf4575bd63985724b4493d569e6da29b
train
RTCSctpTransport._mark_received
Mark an incoming data TSN as received.
aiortc/rtcsctptransport.py
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 True # consolidate misordered en...
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 True # consolidate misordered en...
[ "Mark", "an", "incoming", "data", "TSN", "as", "received", "." ]
aiortc/aiortc
python
https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/rtcsctptransport.py#L821-L842
[ "def", "_mark_received", "(", "self", ",", "tsn", ")", ":", "# it's a duplicate", "if", "uint32_gte", "(", "self", ".", "_last_received_tsn", ",", "tsn", ")", "or", "tsn", "in", "self", ".", "_sack_misordered", ":", "self", ".", "_sack_duplicates", ".", "app...
60ed036abf4575bd63985724b4493d569e6da29b
train
RTCSctpTransport._receive
Receive data stream -> ULP.
aiortc/rtcsctptransport.py
async def _receive(self, stream_id, pp_id, data): """ Receive data stream -> ULP. """ await self._data_channel_receive(stream_id, pp_id, data)
async def _receive(self, stream_id, pp_id, data): """ Receive data stream -> ULP. """ await self._data_channel_receive(stream_id, pp_id, data)
[ "Receive", "data", "stream", "-", ">", "ULP", "." ]
aiortc/aiortc
python
https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/rtcsctptransport.py#L844-L848
[ "async", "def", "_receive", "(", "self", ",", "stream_id", ",", "pp_id", ",", "data", ")", ":", "await", "self", ".", "_data_channel_receive", "(", "stream_id", ",", "pp_id", ",", "data", ")" ]
60ed036abf4575bd63985724b4493d569e6da29b
train
RTCSctpTransport._receive_chunk
Handle an incoming chunk.
aiortc/rtcsctptransport.py
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): await self._receive...
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): await self._receive...
[ "Handle", "an", "incoming", "chunk", "." ]
aiortc/aiortc
python
https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/rtcsctptransport.py#L850-L971
[ "async", "def", "_receive_chunk", "(", "self", ",", "chunk", ")", ":", "self", ".", "__log_debug", "(", "'< %s'", ",", "chunk", ")", "# common", "if", "isinstance", "(", "chunk", ",", "DataChunk", ")", ":", "await", "self", ".", "_receive_data_chunk", "(",...
60ed036abf4575bd63985724b4493d569e6da29b
train
RTCSctpTransport._receive_data_chunk
Handle a DATA chunk.
aiortc/rtcsctptransport.py
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.stream_id) #...
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.stream_id) #...
[ "Handle", "a", "DATA", "chunk", "." ]
aiortc/aiortc
python
https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/rtcsctptransport.py#L973-L991
[ "async", "def", "_receive_data_chunk", "(", "self", ",", "chunk", ")", ":", "self", ".", "_sack_needed", "=", "True", "# mark as received", "if", "self", ".", "_mark_received", "(", "chunk", ".", "tsn", ")", ":", "return", "# find stream", "inbound_stream", "=...
60ed036abf4575bd63985724b4493d569e6da29b
train
RTCSctpTransport._receive_forward_tsn_chunk
Handle a FORWARD TSN chunk.
aiortc/rtcsctptransport.py
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): return uint32_gt(x...
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): return uint32_gt(x...
[ "Handle", "a", "FORWARD", "TSN", "chunk", "." ]
aiortc/aiortc
python
https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/rtcsctptransport.py#L993-L1031
[ "async", "def", "_receive_forward_tsn_chunk", "(", "self", ",", "chunk", ")", ":", "self", ".", "_sack_needed", "=", "True", "# it's a duplicate", "if", "uint32_gte", "(", "self", ".", "_last_received_tsn", ",", "chunk", ".", "cumulative_tsn", ")", ":", "return"...
60ed036abf4575bd63985724b4493d569e6da29b
train
RTCSctpTransport._receive_sack_chunk
Handle a SACK chunk.
aiortc/rtcsctptransport.py
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_utilized = (self._flight_siz...
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_utilized = (self._flight_siz...
[ "Handle", "a", "SACK", "chunk", "." ]
aiortc/aiortc
python
https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/rtcsctptransport.py#L1033-L1124
[ "async", "def", "_receive_sack_chunk", "(", "self", ",", "chunk", ")", ":", "if", "uint32_gt", "(", "self", ".", "_last_sacked_tsn", ",", "chunk", ".", "cumulative_tsn", ")", ":", "return", "received_time", "=", "time", ".", "time", "(", ")", "self", ".", ...
60ed036abf4575bd63985724b4493d569e6da29b
train
RTCSctpTransport._receive_reconfig_param
Handle a RE-CONFIG parameter.
aiortc/rtcsctptransport.py
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.streams: self._inbo...
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.streams: self._inbo...
[ "Handle", "a", "RE", "-", "CONFIG", "parameter", "." ]
aiortc/aiortc
python
https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/rtcsctptransport.py#L1126-L1169
[ "async", "def", "_receive_reconfig_param", "(", "self", ",", "param", ")", ":", "self", ".", "__log_debug", "(", "'<< %s'", ",", "param", ")", "if", "isinstance", "(", "param", ",", "StreamResetOutgoingParam", ")", ":", "# mark closed inbound streams", "for", "s...
60ed036abf4575bd63985724b4493d569e6da29b
train
RTCSctpTransport._send
Send data ULP -> stream.
aiortc/rtcsctptransport.py
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: stream_seq = 0 fra...
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: stream_seq = 0 fra...
[ "Send", "data", "ULP", "-", ">", "stream", "." ]
aiortc/aiortc
python
https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/rtcsctptransport.py#L1171-L1218
[ "async", "def", "_send", "(", "self", ",", "stream_id", ",", "pp_id", ",", "user_data", ",", "expiry", "=", "None", ",", "max_retransmits", "=", "None", ",", "ordered", "=", "True", ")", ":", "if", "ordered", ":", "stream_seq", "=", "self", ".", "_outb...
60ed036abf4575bd63985724b4493d569e6da29b
train
RTCSctpTransport._send_chunk
Transmit a chunk (no bundling for now).
aiortc/rtcsctptransport.py
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, self._remote_verification_tag, ...
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, self._remote_verification_tag, ...
[ "Transmit", "a", "chunk", "(", "no", "bundling", "for", "now", ")", "." ]
aiortc/aiortc
python
https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/rtcsctptransport.py#L1220-L1229
[ "async", "def", "_send_chunk", "(", "self", ",", "chunk", ")", ":", "self", ".", "__log_debug", "(", "'> %s'", ",", "chunk", ")", "await", "self", ".", "__transport", ".", "_send_data", "(", "serialize_packet", "(", "self", ".", "_local_port", ",", "self",...
60ed036abf4575bd63985724b4493d569e6da29b
train
RTCSctpTransport._send_sack
Build and send a selective acknowledgement (SACK) chunk.
aiortc/rtcsctptransport.py
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) % SCTP_TSN_MODULO if tsn == gap_next: ...
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) % SCTP_TSN_MODULO if tsn == gap_next: ...
[ "Build", "and", "send", "a", "selective", "acknowledgement", "(", "SACK", ")", "chunk", "." ]
aiortc/aiortc
python
https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/rtcsctptransport.py#L1242-L1265
[ "async", "def", "_send_sack", "(", "self", ")", ":", "gaps", "=", "[", "]", "gap_next", "=", "None", "for", "tsn", "in", "sorted", "(", "self", ".", "_sack_misordered", ")", ":", "pos", "=", "(", "tsn", "-", "self", ".", "_last_received_tsn", ")", "%...
60ed036abf4575bd63985724b4493d569e6da29b
train
RTCSctpTransport._set_state
Transition the SCTP association to a new state.
aiortc/rtcsctptransport.py
def _set_state(self, state): """ Transition the SCTP association to a new state. """ if state != self._association_state: self.__log_debug('- %s -> %s', self._association_state, state) self._association_state = state if state == self.State.ESTABLISHED: ...
def _set_state(self, state): """ Transition the SCTP association to a new state. """ if state != self._association_state: self.__log_debug('- %s -> %s', self._association_state, state) self._association_state = state if state == self.State.ESTABLISHED: ...
[ "Transition", "the", "SCTP", "association", "to", "a", "new", "state", "." ]
aiortc/aiortc
python
https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/rtcsctptransport.py#L1267-L1293
[ "def", "_set_state", "(", "self", ",", "state", ")", ":", "if", "state", "!=", "self", ".", "_association_state", ":", "self", ".", "__log_debug", "(", "'- %s -> %s'", ",", "self", ".", "_association_state", ",", "state", ")", "self", ".", "_association_stat...
60ed036abf4575bd63985724b4493d569e6da29b
train
RTCSctpTransport._transmit
Transmit outbound data.
aiortc/rtcsctptransport.py
async def _transmit(self): """ Transmit outbound data. """ # send FORWARD TSN if self._forward_tsn_chunk is not None: await self._send_chunk(self._forward_tsn_chunk) self._forward_tsn_chunk = None # ensure T3 is running if not self...
async def _transmit(self): """ Transmit outbound data. """ # send FORWARD TSN if self._forward_tsn_chunk is not None: await self._send_chunk(self._forward_tsn_chunk) self._forward_tsn_chunk = None # ensure T3 is running if not self...
[ "Transmit", "outbound", "data", "." ]
aiortc/aiortc
python
https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/rtcsctptransport.py#L1383-L1434
[ "async", "def", "_transmit", "(", "self", ")", ":", "# send FORWARD TSN", "if", "self", ".", "_forward_tsn_chunk", "is", "not", "None", ":", "await", "self", ".", "_send_chunk", "(", "self", ".", "_forward_tsn_chunk", ")", "self", ".", "_forward_tsn_chunk", "=...
60ed036abf4575bd63985724b4493d569e6da29b
train
RTCSctpTransport._update_advanced_peer_ack_point
Try to advance "Advanced.Peer.Ack.Point" according to RFC 3758.
aiortc/rtcsctptransport.py
def _update_advanced_peer_ack_point(self): """ Try to advance "Advanced.Peer.Ack.Point" according to RFC 3758. """ if uint32_gt(self._last_sacked_tsn, self._advanced_peer_ack_tsn): self._advanced_peer_ack_tsn = self._last_sacked_tsn done = 0 streams = {} ...
def _update_advanced_peer_ack_point(self): """ Try to advance "Advanced.Peer.Ack.Point" according to RFC 3758. """ if uint32_gt(self._last_sacked_tsn, self._advanced_peer_ack_tsn): self._advanced_peer_ack_tsn = self._last_sacked_tsn done = 0 streams = {} ...
[ "Try", "to", "advance", "Advanced", ".", "Peer", ".", "Ack", ".", "Point", "according", "to", "RFC", "3758", "." ]
aiortc/aiortc
python
https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/rtcsctptransport.py#L1451-L1471
[ "def", "_update_advanced_peer_ack_point", "(", "self", ")", ":", "if", "uint32_gt", "(", "self", ".", "_last_sacked_tsn", ",", "self", ".", "_advanced_peer_ack_tsn", ")", ":", "self", ".", "_advanced_peer_ack_tsn", "=", "self", ".", "_last_sacked_tsn", "done", "="...
60ed036abf4575bd63985724b4493d569e6da29b
train
RTCSctpTransport._update_rto
Update RTO given a new roundtrip measurement R.
aiortc/rtcsctptransport.py
def _update_rto(self, R): """ Update RTO given a new roundtrip measurement R. """ if self._srtt is None: self._rttvar = R / 2 self._srtt = R else: self._rttvar = (1 - SCTP_RTO_BETA) * self._rttvar + SCTP_RTO_BETA * abs(self._srtt - R) ...
def _update_rto(self, R): """ Update RTO given a new roundtrip measurement R. """ if self._srtt is None: self._rttvar = R / 2 self._srtt = R else: self._rttvar = (1 - SCTP_RTO_BETA) * self._rttvar + SCTP_RTO_BETA * abs(self._srtt - R) ...
[ "Update", "RTO", "given", "a", "new", "roundtrip", "measurement", "R", "." ]
aiortc/aiortc
python
https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/rtcsctptransport.py#L1473-L1483
[ "def", "_update_rto", "(", "self", ",", "R", ")", ":", "if", "self", ".", "_srtt", "is", "None", ":", "self", ".", "_rttvar", "=", "R", "/", "2", "self", ".", "_srtt", "=", "R", "else", ":", "self", ".", "_rttvar", "=", "(", "1", "-", "SCTP_RTO...
60ed036abf4575bd63985724b4493d569e6da29b
train
RTCSctpTransport._data_channel_close
Request closing the datachannel by sending an Outgoing Stream Reset Request.
aiortc/rtcsctptransport.py
def _data_channel_close(self, channel, transmit=True): """ Request closing the datachannel by sending an Outgoing Stream Reset Request. """ if channel.readyState not in ['closing', 'closed']: channel._setReadyState('closing') self._reconfig_queue.append(channel.id...
def _data_channel_close(self, channel, transmit=True): """ Request closing the datachannel by sending an Outgoing Stream Reset Request. """ if channel.readyState not in ['closing', 'closed']: channel._setReadyState('closing') self._reconfig_queue.append(channel.id...
[ "Request", "closing", "the", "datachannel", "by", "sending", "an", "Outgoing", "Stream", "Reset", "Request", "." ]
aiortc/aiortc
python
https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/rtcsctptransport.py#L1485-L1493
[ "def", "_data_channel_close", "(", "self", ",", "channel", ",", "transmit", "=", "True", ")", ":", "if", "channel", ".", "readyState", "not", "in", "[", "'closing'", ",", "'closed'", "]", ":", "channel", ".", "_setReadyState", "(", "'closing'", ")", "self"...
60ed036abf4575bd63985724b4493d569e6da29b
train
RTCSctpTransport._data_channel_flush
Try to flush buffered data to the SCTP layer. We wait until the association is established, as we need to know whether we are a client or a server to correctly assign an odd/even ID to the data channels.
aiortc/rtcsctptransport.py
async def _data_channel_flush(self): """ Try to flush buffered data to the SCTP layer. We wait until the association is established, as we need to know whether we are a client or a server to correctly assign an odd/even ID to the data channels. """ if self._assoc...
async def _data_channel_flush(self): """ Try to flush buffered data to the SCTP layer. We wait until the association is established, as we need to know whether we are a client or a server to correctly assign an odd/even ID to the data channels. """ if self._assoc...
[ "Try", "to", "flush", "buffered", "data", "to", "the", "SCTP", "layer", "." ]
aiortc/aiortc
python
https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/rtcsctptransport.py#L1499-L1535
[ "async", "def", "_data_channel_flush", "(", "self", ")", ":", "if", "self", ".", "_association_state", "!=", "self", ".", "State", ".", "ESTABLISHED", ":", "return", "while", "self", ".", "_data_channel_queue", "and", "not", "self", ".", "_outbound_queue", ":"...
60ed036abf4575bd63985724b4493d569e6da29b
train
add_signaling_arguments
Add signaling method arguments to an argparse.ArgumentParser.
aiortc/contrib/signaling.py
def add_signaling_arguments(parser): """ Add signaling method arguments to an argparse.ArgumentParser. """ parser.add_argument('--signaling', '-s', choices=[ 'copy-and-paste', 'tcp-socket', 'unix-socket']) parser.add_argument('--signaling-host', default='127.0.0.1', h...
def add_signaling_arguments(parser): """ Add signaling method arguments to an argparse.ArgumentParser. """ parser.add_argument('--signaling', '-s', choices=[ 'copy-and-paste', 'tcp-socket', 'unix-socket']) parser.add_argument('--signaling-host', default='127.0.0.1', h...
[ "Add", "signaling", "method", "arguments", "to", "an", "argparse", ".", "ArgumentParser", "." ]
aiortc/aiortc
python
https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/contrib/signaling.py#L180-L191
[ "def", "add_signaling_arguments", "(", "parser", ")", ":", "parser", ".", "add_argument", "(", "'--signaling'", ",", "'-s'", ",", "choices", "=", "[", "'copy-and-paste'", ",", "'tcp-socket'", ",", "'unix-socket'", "]", ")", "parser", ".", "add_argument", "(", ...
60ed036abf4575bd63985724b4493d569e6da29b
train
create_signaling
Create a signaling method based on command-line arguments.
aiortc/contrib/signaling.py
def create_signaling(args): """ Create a signaling method based on command-line arguments. """ if args.signaling == 'tcp-socket': return TcpSocketSignaling(args.signaling_host, args.signaling_port) elif args.signaling == 'unix-socket': return UnixSocketSignaling(args.signaling_path) ...
def create_signaling(args): """ Create a signaling method based on command-line arguments. """ if args.signaling == 'tcp-socket': return TcpSocketSignaling(args.signaling_host, args.signaling_port) elif args.signaling == 'unix-socket': return UnixSocketSignaling(args.signaling_path) ...
[ "Create", "a", "signaling", "method", "based", "on", "command", "-", "line", "arguments", "." ]
aiortc/aiortc
python
https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/contrib/signaling.py#L194-L203
[ "def", "create_signaling", "(", "args", ")", ":", "if", "args", ".", "signaling", "==", "'tcp-socket'", ":", "return", "TcpSocketSignaling", "(", "args", ".", "signaling_host", ",", "args", ".", "signaling_port", ")", "elif", "args", ".", "signaling", "==", ...
60ed036abf4575bd63985724b4493d569e6da29b
train
RemoteStreamTrack.recv
Receive the next frame.
aiortc/rtcrtpreceiver.py
async def recv(self): """ Receive the next frame. """ if self.readyState != 'live': raise MediaStreamError frame = await self._queue.get() if frame is None: self.stop() raise MediaStreamError return frame
async def recv(self): """ Receive the next frame. """ if self.readyState != 'live': raise MediaStreamError frame = await self._queue.get() if frame is None: self.stop() raise MediaStreamError return frame
[ "Receive", "the", "next", "frame", "." ]
aiortc/aiortc
python
https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/rtcrtpreceiver.py#L149-L160
[ "async", "def", "recv", "(", "self", ")", ":", "if", "self", ".", "readyState", "!=", "'live'", ":", "raise", "MediaStreamError", "frame", "=", "await", "self", ".", "_queue", ".", "get", "(", ")", "if", "frame", "is", "None", ":", "self", ".", "stop...
60ed036abf4575bd63985724b4493d569e6da29b
train
RTCRtpReceiver.getStats
Returns statistics about the RTP receiver. :rtype: :class:`RTCStatsReport`
aiortc/rtcrtpreceiver.py
async def getStats(self): """ Returns statistics about the RTP receiver. :rtype: :class:`RTCStatsReport` """ for ssrc, stream in self.__remote_streams.items(): self.__stats.add(RTCInboundRtpStreamStats( # RTCStats timestamp=clock.curre...
async def getStats(self): """ Returns statistics about the RTP receiver. :rtype: :class:`RTCStatsReport` """ for ssrc, stream in self.__remote_streams.items(): self.__stats.add(RTCInboundRtpStreamStats( # RTCStats timestamp=clock.curre...
[ "Returns", "statistics", "about", "the", "RTP", "receiver", "." ]
aiortc/aiortc
python
https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/rtcrtpreceiver.py#L262-L286
[ "async", "def", "getStats", "(", "self", ")", ":", "for", "ssrc", ",", "stream", "in", "self", ".", "__remote_streams", ".", "items", "(", ")", ":", "self", ".", "__stats", ".", "add", "(", "RTCInboundRtpStreamStats", "(", "# RTCStats", "timestamp", "=", ...
60ed036abf4575bd63985724b4493d569e6da29b
train
RTCRtpReceiver.getSynchronizationSources
Returns a :class:`RTCRtpSynchronizationSource` for each unique SSRC identifier received in the last 10 seconds.
aiortc/rtcrtpreceiver.py
def getSynchronizationSources(self): """ Returns a :class:`RTCRtpSynchronizationSource` for each unique SSRC identifier received in the last 10 seconds. """ cutoff = clock.current_datetime() - datetime.timedelta(seconds=10) sources = [] for source, timestamp in se...
def getSynchronizationSources(self): """ Returns a :class:`RTCRtpSynchronizationSource` for each unique SSRC identifier received in the last 10 seconds. """ cutoff = clock.current_datetime() - datetime.timedelta(seconds=10) sources = [] for source, timestamp in se...
[ "Returns", "a", ":", "class", ":", "RTCRtpSynchronizationSource", "for", "each", "unique", "SSRC", "identifier", "received", "in", "the", "last", "10", "seconds", "." ]
aiortc/aiortc
python
https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/rtcrtpreceiver.py#L288-L298
[ "def", "getSynchronizationSources", "(", "self", ")", ":", "cutoff", "=", "clock", ".", "current_datetime", "(", ")", "-", "datetime", ".", "timedelta", "(", "seconds", "=", "10", ")", "sources", "=", "[", "]", "for", "source", ",", "timestamp", "in", "s...
60ed036abf4575bd63985724b4493d569e6da29b
train
RTCRtpReceiver.receive
Attempt to set the parameters controlling the receiving of media. :param: parameters: The :class:`RTCRtpParameters` for the receiver.
aiortc/rtcrtpreceiver.py
async def receive(self, parameters: RTCRtpReceiveParameters): """ Attempt to set the parameters controlling the receiving of media. :param: parameters: The :class:`RTCRtpParameters` for the receiver. """ if not self.__started: for codec in parameters.codecs: ...
async def receive(self, parameters: RTCRtpReceiveParameters): """ Attempt to set the parameters controlling the receiving of media. :param: parameters: The :class:`RTCRtpParameters` for the receiver. """ if not self.__started: for codec in parameters.codecs: ...
[ "Attempt", "to", "set", "the", "parameters", "controlling", "the", "receiving", "of", "media", "." ]
aiortc/aiortc
python
https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/rtcrtpreceiver.py#L300-L322
[ "async", "def", "receive", "(", "self", ",", "parameters", ":", "RTCRtpReceiveParameters", ")", ":", "if", "not", "self", ".", "__started", ":", "for", "codec", "in", "parameters", ".", "codecs", ":", "self", ".", "__codecs", "[", "codec", ".", "payloadTyp...
60ed036abf4575bd63985724b4493d569e6da29b
train
RTCRtpReceiver.stop
Irreversibly stop the receiver.
aiortc/rtcrtpreceiver.py
async def stop(self): """ Irreversibly stop the receiver. """ if self.__started: self.__transport._unregister_rtp_receiver(self) self.__stop_decoder() self.__rtcp_task.cancel() await self.__rtcp_exited.wait()
async def stop(self): """ Irreversibly stop the receiver. """ if self.__started: self.__transport._unregister_rtp_receiver(self) self.__stop_decoder() self.__rtcp_task.cancel() await self.__rtcp_exited.wait()
[ "Irreversibly", "stop", "the", "receiver", "." ]
aiortc/aiortc
python
https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/rtcrtpreceiver.py#L327-L335
[ "async", "def", "stop", "(", "self", ")", ":", "if", "self", ".", "__started", ":", "self", ".", "__transport", ".", "_unregister_rtp_receiver", "(", "self", ")", "self", ".", "__stop_decoder", "(", ")", "self", ".", "__rtcp_task", ".", "cancel", "(", ")...
60ed036abf4575bd63985724b4493d569e6da29b
train
RTCRtpReceiver._handle_rtp_packet
Handle an incoming RTP packet.
aiortc/rtcrtpreceiver.py
async def _handle_rtp_packet(self, packet: RtpPacket, arrival_time_ms: int): """ Handle an incoming RTP packet. """ self.__log_debug('< %s', packet) # feed bitrate estimator if self.__remote_bitrate_estimator is not None: if packet.extensions.abs_send_time is...
async def _handle_rtp_packet(self, packet: RtpPacket, arrival_time_ms: int): """ Handle an incoming RTP packet. """ self.__log_debug('< %s', packet) # feed bitrate estimator if self.__remote_bitrate_estimator is not None: if packet.extensions.abs_send_time is...
[ "Handle", "an", "incoming", "RTP", "packet", "." ]
aiortc/aiortc
python
https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/rtcrtpreceiver.py#L364-L435
[ "async", "def", "_handle_rtp_packet", "(", "self", ",", "packet", ":", "RtpPacket", ",", "arrival_time_ms", ":", "int", ")", ":", "self", ".", "__log_debug", "(", "'< %s'", ",", "packet", ")", "# feed bitrate estimator", "if", "self", ".", "__remote_bitrate_esti...
60ed036abf4575bd63985724b4493d569e6da29b
train
RTCRtpReceiver._send_rtcp_nack
Send an RTCP packet to report missing RTP packets.
aiortc/rtcrtpreceiver.py
async def _send_rtcp_nack(self, media_ssrc, lost): """ Send an RTCP packet to report missing RTP packets. """ if self.__rtcp_ssrc is not None: packet = RtcpRtpfbPacket( fmt=RTCP_RTPFB_NACK, ssrc=self.__rtcp_ssrc, media_ssrc=media_ssrc) packet.lost ...
async def _send_rtcp_nack(self, media_ssrc, lost): """ Send an RTCP packet to report missing RTP packets. """ if self.__rtcp_ssrc is not None: packet = RtcpRtpfbPacket( fmt=RTCP_RTPFB_NACK, ssrc=self.__rtcp_ssrc, media_ssrc=media_ssrc) packet.lost ...
[ "Send", "an", "RTCP", "packet", "to", "report", "missing", "RTP", "packets", "." ]
aiortc/aiortc
python
https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/rtcrtpreceiver.py#L483-L491
[ "async", "def", "_send_rtcp_nack", "(", "self", ",", "media_ssrc", ",", "lost", ")", ":", "if", "self", ".", "__rtcp_ssrc", "is", "not", "None", ":", "packet", "=", "RtcpRtpfbPacket", "(", "fmt", "=", "RTCP_RTPFB_NACK", ",", "ssrc", "=", "self", ".", "__...
60ed036abf4575bd63985724b4493d569e6da29b
train
RTCRtpReceiver._send_rtcp_pli
Send an RTCP packet to report picture loss.
aiortc/rtcrtpreceiver.py
async def _send_rtcp_pli(self, media_ssrc): """ Send an RTCP packet to report picture loss. """ if self.__rtcp_ssrc is not None: packet = RtcpPsfbPacket(fmt=RTCP_PSFB_PLI, ssrc=self.__rtcp_ssrc, media_ssrc=media_ssrc) await self._send_rtcp(packet)
async def _send_rtcp_pli(self, media_ssrc): """ Send an RTCP packet to report picture loss. """ if self.__rtcp_ssrc is not None: packet = RtcpPsfbPacket(fmt=RTCP_PSFB_PLI, ssrc=self.__rtcp_ssrc, media_ssrc=media_ssrc) await self._send_rtcp(packet)
[ "Send", "an", "RTCP", "packet", "to", "report", "picture", "loss", "." ]
aiortc/aiortc
python
https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/rtcrtpreceiver.py#L493-L499
[ "async", "def", "_send_rtcp_pli", "(", "self", ",", "media_ssrc", ")", ":", "if", "self", ".", "__rtcp_ssrc", "is", "not", "None", ":", "packet", "=", "RtcpPsfbPacket", "(", "fmt", "=", "RTCP_PSFB_PLI", ",", "ssrc", "=", "self", ".", "__rtcp_ssrc", ",", ...
60ed036abf4575bd63985724b4493d569e6da29b
train
RTCRtpReceiver.__stop_decoder
Stop the decoder thread, which will in turn stop the track.
aiortc/rtcrtpreceiver.py
def __stop_decoder(self): """ Stop the decoder thread, which will in turn stop the track. """ if self.__decoder_thread: self.__decoder_queue.put(None) self.__decoder_thread.join() self.__decoder_thread = None
def __stop_decoder(self): """ Stop the decoder thread, which will in turn stop the track. """ if self.__decoder_thread: self.__decoder_queue.put(None) self.__decoder_thread.join() self.__decoder_thread = None
[ "Stop", "the", "decoder", "thread", "which", "will", "in", "turn", "stop", "the", "track", "." ]
aiortc/aiortc
python
https://github.com/aiortc/aiortc/blob/60ed036abf4575bd63985724b4493d569e6da29b/aiortc/rtcrtpreceiver.py#L504-L511
[ "def", "__stop_decoder", "(", "self", ")", ":", "if", "self", ".", "__decoder_thread", ":", "self", ".", "__decoder_queue", ".", "put", "(", "None", ")", "self", ".", "__decoder_thread", ".", "join", "(", ")", "self", ".", "__decoder_thread", "=", "None" ]
60ed036abf4575bd63985724b4493d569e6da29b
train
Node.init_domain_ledger
This is usually an implementation of Ledger
indy_node/server/node.py
def init_domain_ledger(self): """ This is usually an implementation of Ledger """ if self.config.primaryStorage is None: genesis_txn_initiator = GenesisTxnInitiatorFromFile( self.genesis_dir, self.config.domainTransactionsFile) return Ledger( ...
def init_domain_ledger(self): """ This is usually an implementation of Ledger """ if self.config.primaryStorage is None: genesis_txn_initiator = GenesisTxnInitiatorFromFile( self.genesis_dir, self.config.domainTransactionsFile) return Ledger( ...
[ "This", "is", "usually", "an", "implementation", "of", "Ledger" ]
hyperledger/indy-node
python
https://github.com/hyperledger/indy-node/blob/8fabd364eaf7d940a56df2911d9215b1e512a2de/indy_node/server/node.py#L130-L148
[ "def", "init_domain_ledger", "(", "self", ")", ":", "if", "self", ".", "config", ".", "primaryStorage", "is", "None", ":", "genesis_txn_initiator", "=", "GenesisTxnInitiatorFromFile", "(", "self", ".", "genesis_dir", ",", "self", ".", "config", ".", "domainTrans...
8fabd364eaf7d940a56df2911d9215b1e512a2de
train
Node.update_txn_with_extra_data
All the data of the transaction might not be stored in ledger so the extra data that is omitted from ledger needs to be fetched from the appropriate data store :param txn: :return:
indy_node/server/node.py
def update_txn_with_extra_data(self, txn): """ All the data of the transaction might not be stored in ledger so the extra data that is omitted from ledger needs to be fetched from the appropriate data store :param txn: :return: """ # For RAW and ENC attrib...
def update_txn_with_extra_data(self, txn): """ All the data of the transaction might not be stored in ledger so the extra data that is omitted from ledger needs to be fetched from the appropriate data store :param txn: :return: """ # For RAW and ENC attrib...
[ "All", "the", "data", "of", "the", "transaction", "might", "not", "be", "stored", "in", "ledger", "so", "the", "extra", "data", "that", "is", "omitted", "from", "ledger", "needs", "to", "be", "fetched", "from", "the", "appropriate", "data", "store", ":", ...
hyperledger/indy-node
python
https://github.com/hyperledger/indy-node/blob/8fabd364eaf7d940a56df2911d9215b1e512a2de/indy_node/server/node.py#L355-L371
[ "def", "update_txn_with_extra_data", "(", "self", ",", "txn", ")", ":", "# For RAW and ENC attributes, only hash is stored in the ledger.", "if", "get_type", "(", "txn", ")", "==", "ATTRIB", ":", "txn_data", "=", "get_payload_data", "(", "txn", ")", "# The key needs to ...
8fabd364eaf7d940a56df2911d9215b1e512a2de
train
prepare_attr_for_state
Make key(path)-value pair for state from ATTRIB or GET_ATTR :return: state path, state value, value for attribute store
indy_common/state/domain.py
def prepare_attr_for_state(txn, path_only=False): """ Make key(path)-value pair for state from ATTRIB or GET_ATTR :return: state path, state value, value for attribute store """ assert get_type(txn) == ATTRIB txn_data = get_payload_data(txn) nym = txn_data[TARGET_NYM] attr_type, attr_key...
def prepare_attr_for_state(txn, path_only=False): """ Make key(path)-value pair for state from ATTRIB or GET_ATTR :return: state path, state value, value for attribute store """ assert get_type(txn) == ATTRIB txn_data = get_payload_data(txn) nym = txn_data[TARGET_NYM] attr_type, attr_key...
[ "Make", "key", "(", "path", ")", "-", "value", "pair", "for", "state", "from", "ATTRIB", "or", "GET_ATTR", ":", "return", ":", "state", "path", "state", "value", "value", "for", "attribute", "store" ]
hyperledger/indy-node
python
https://github.com/hyperledger/indy-node/blob/8fabd364eaf7d940a56df2911d9215b1e512a2de/indy_common/state/domain.py#L95-L111
[ "def", "prepare_attr_for_state", "(", "txn", ",", "path_only", "=", "False", ")", ":", "assert", "get_type", "(", "txn", ")", "==", "ATTRIB", "txn_data", "=", "get_payload_data", "(", "txn", ")", "nym", "=", "txn_data", "[", "TARGET_NYM", "]", "attr_type", ...
8fabd364eaf7d940a56df2911d9215b1e512a2de
train
_extract_attr_typed_value
ATTR and GET_ATTR can have one of 'raw', 'enc' and 'hash' fields. This method checks which of them presents and return it's name and value in it.
indy_common/state/domain.py
def _extract_attr_typed_value(txn_data): """ ATTR and GET_ATTR can have one of 'raw', 'enc' and 'hash' fields. This method checks which of them presents and return it's name and value in it. """ existing_keys = [key for key in ALL_ATR_KEYS if key in txn_data] if len(existing_keys) == 0: ...
def _extract_attr_typed_value(txn_data): """ ATTR and GET_ATTR can have one of 'raw', 'enc' and 'hash' fields. This method checks which of them presents and return it's name and value in it. """ existing_keys = [key for key in ALL_ATR_KEYS if key in txn_data] if len(existing_keys) == 0: ...
[ "ATTR", "and", "GET_ATTR", "can", "have", "one", "of", "raw", "enc", "and", "hash", "fields", ".", "This", "method", "checks", "which", "of", "them", "presents", "and", "return", "it", "s", "name", "and", "value", "in", "it", "." ]
hyperledger/indy-node
python
https://github.com/hyperledger/indy-node/blob/8fabd364eaf7d940a56df2911d9215b1e512a2de/indy_common/state/domain.py#L371-L385
[ "def", "_extract_attr_typed_value", "(", "txn_data", ")", ":", "existing_keys", "=", "[", "key", "for", "key", "in", "ALL_ATR_KEYS", "if", "key", "in", "txn_data", "]", "if", "len", "(", "existing_keys", ")", "==", "0", ":", "raise", "ValueError", "(", "\"...
8fabd364eaf7d940a56df2911d9215b1e512a2de
train
_migrate_ledger
Test for the directory, open old and new ledger, migrate data, rename directories
data/migrations/deb/helper_1_0_96_to_1_0_97.py
def _migrate_ledger(data_directory, old_ledger_file, new_ledger_file, serializer: MappingSerializer = None): """ Test for the directory, open old and new ledger, migrate data, rename directories """ # we should have ChunkedFileStorage implementation of the Ledger...
def _migrate_ledger(data_directory, old_ledger_file, new_ledger_file, serializer: MappingSerializer = None): """ Test for the directory, open old and new ledger, migrate data, rename directories """ # we should have ChunkedFileStorage implementation of the Ledger...
[ "Test", "for", "the", "directory", "open", "old", "and", "new", "ledger", "migrate", "data", "rename", "directories" ]
hyperledger/indy-node
python
https://github.com/hyperledger/indy-node/blob/8fabd364eaf7d940a56df2911d9215b1e512a2de/data/migrations/deb/helper_1_0_96_to_1_0_97.py#L26-L88
[ "def", "_migrate_ledger", "(", "data_directory", ",", "old_ledger_file", ",", "new_ledger_file", ",", "serializer", ":", "MappingSerializer", "=", "None", ")", ":", "# we should have ChunkedFileStorage implementation of the Ledger", "if", "not", "os", ".", "path", ".", ...
8fabd364eaf7d940a56df2911d9215b1e512a2de
train
IdrCache.getNym
Get a nym, if role is provided then get nym with that role :param nym: :param role: :param isCommitted: :return:
indy_node/persistence/idr_cache.py
def getNym(self, nym, role=None, isCommitted=True): """ Get a nym, if role is provided then get nym with that role :param nym: :param role: :param isCommitted: :return: """ try: seqNo, txnTime, ta, actual_role, verkey = self.get(nym, isCommitte...
def getNym(self, nym, role=None, isCommitted=True): """ Get a nym, if role is provided then get nym with that role :param nym: :param role: :param isCommitted: :return: """ try: seqNo, txnTime, ta, actual_role, verkey = self.get(nym, isCommitte...
[ "Get", "a", "nym", "if", "role", "is", "provided", "then", "get", "nym", "with", "that", "role", ":", "param", "nym", ":", ":", "param", "role", ":", ":", "param", "isCommitted", ":", ":", "return", ":" ]
hyperledger/indy-node
python
https://github.com/hyperledger/indy-node/blob/8fabd364eaf7d940a56df2911d9215b1e512a2de/indy_node/persistence/idr_cache.py#L123-L143
[ "def", "getNym", "(", "self", ",", "nym", ",", "role", "=", "None", ",", "isCommitted", "=", "True", ")", ":", "try", ":", "seqNo", ",", "txnTime", ",", "ta", ",", "actual_role", ",", "verkey", "=", "self", ".", "get", "(", "nym", ",", "isCommitted...
8fabd364eaf7d940a56df2911d9215b1e512a2de
train
NodeMaintainer._unscheduleAction
Unschedule current action Note that it does not add record to action log and does not do required steps to resume previous action. If you need this - use _cancelScheduledAction
indy_node/server/node_maintainer.py
def _unscheduleAction(self): """ Unschedule current action Note that it does not add record to action log and does not do required steps to resume previous action. If you need this - use _cancelScheduledAction """ logger.trace("{} unscheduling actions".format(se...
def _unscheduleAction(self): """ Unschedule current action Note that it does not add record to action log and does not do required steps to resume previous action. If you need this - use _cancelScheduledAction """ logger.trace("{} unscheduling actions".format(se...
[ "Unschedule", "current", "action" ]
hyperledger/indy-node
python
https://github.com/hyperledger/indy-node/blob/8fabd364eaf7d940a56df2911d9215b1e512a2de/indy_node/server/node_maintainer.py#L75-L86
[ "def", "_unscheduleAction", "(", "self", ")", ":", "logger", ".", "trace", "(", "\"{} unscheduling actions\"", ".", "format", "(", "self", ")", ")", "self", ".", "aqStash", "=", "deque", "(", ")", "self", ".", "scheduledAction", "=", "None" ]
8fabd364eaf7d940a56df2911d9215b1e512a2de