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
valid
StreamBase.initiate
Initiate an XMPP connection over the `transport`. :Parameters: - `transport`: an XMPP transport instance - `to`: peer name
pyxmpp2/streambase.py
def initiate(self, transport, to = None): """Initiate an XMPP connection over the `transport`. :Parameters: - `transport`: an XMPP transport instance - `to`: peer name """ with self.lock: self.initiator = True self.transport = transport ...
def initiate(self, transport, to = None): """Initiate an XMPP connection over the `transport`. :Parameters: - `transport`: an XMPP transport instance - `to`: peer name """ with self.lock: self.initiator = True self.transport = transport ...
[ "Initiate", "an", "XMPP", "connection", "over", "the", "transport", "." ]
Jajcus/pyxmpp2
python
https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/streambase.py#L167-L183
[ "def", "initiate", "(", "self", ",", "transport", ",", "to", "=", "None", ")", ":", "with", "self", ".", "lock", ":", "self", ".", "initiator", "=", "True", "self", ".", "transport", "=", "transport", "transport", ".", "set_target", "(", "self", ")", ...
14a40a3950910a9cd008b55f0d8905aa0186ce18
valid
StreamBase.receive
Receive an XMPP connection over the `transport`. :Parameters: - `transport`: an XMPP transport instance - `myname`: local stream endpoint name.
pyxmpp2/streambase.py
def receive(self, transport, myname): """Receive an XMPP connection over the `transport`. :Parameters: - `transport`: an XMPP transport instance - `myname`: local stream endpoint name. """ with self.lock: self.transport = transport transpo...
def receive(self, transport, myname): """Receive an XMPP connection over the `transport`. :Parameters: - `transport`: an XMPP transport instance - `myname`: local stream endpoint name. """ with self.lock: self.transport = transport transpo...
[ "Receive", "an", "XMPP", "connection", "over", "the", "transport", "." ]
Jajcus/pyxmpp2
python
https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/streambase.py#L193-L205
[ "def", "receive", "(", "self", ",", "transport", ",", "myname", ")", ":", "with", "self", ".", "lock", ":", "self", ".", "transport", "=", "transport", "transport", ".", "set_target", "(", "self", ")", "self", ".", "me", "=", "JID", "(", "myname", ")...
14a40a3950910a9cd008b55f0d8905aa0186ce18
valid
StreamBase._setup_stream_element_handlers
Set up stream element handlers. Scans the `handlers` list for `StreamFeatureHandler` instances and updates `_element_handlers` mapping with their methods decorated with @`stream_element_handler`
pyxmpp2/streambase.py
def _setup_stream_element_handlers(self): """Set up stream element handlers. Scans the `handlers` list for `StreamFeatureHandler` instances and updates `_element_handlers` mapping with their methods decorated with @`stream_element_handler` """ # pylint: disable-msg=W0212...
def _setup_stream_element_handlers(self): """Set up stream element handlers. Scans the `handlers` list for `StreamFeatureHandler` instances and updates `_element_handlers` mapping with their methods decorated with @`stream_element_handler` """ # pylint: disable-msg=W0212...
[ "Set", "up", "stream", "element", "handlers", "." ]
Jajcus/pyxmpp2
python
https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/streambase.py#L207-L231
[ "def", "_setup_stream_element_handlers", "(", "self", ")", ":", "# pylint: disable-msg=W0212", "if", "self", ".", "initiator", ":", "mode", "=", "\"initiator\"", "else", ":", "mode", "=", "\"receiver\"", "self", ".", "_element_handlers", "=", "{", "}", "for", "h...
14a40a3950910a9cd008b55f0d8905aa0186ce18
valid
StreamBase.event
Handle a stream event. Called when connection state is changed. Should not be called with self.lock acquired!
pyxmpp2/streambase.py
def event(self, event): # pylint: disable-msg=R0201 """Handle a stream event. Called when connection state is changed. Should not be called with self.lock acquired! """ event.stream = self logger.debug(u"Stream event: {0}".format(event)) self.settings["event_que...
def event(self, event): # pylint: disable-msg=R0201 """Handle a stream event. Called when connection state is changed. Should not be called with self.lock acquired! """ event.stream = self logger.debug(u"Stream event: {0}".format(event)) self.settings["event_que...
[ "Handle", "a", "stream", "event", "." ]
Jajcus/pyxmpp2
python
https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/streambase.py#L239-L249
[ "def", "event", "(", "self", ",", "event", ")", ":", "# pylint: disable-msg=R0201", "event", ".", "stream", "=", "self", "logger", ".", "debug", "(", "u\"Stream event: {0}\"", ".", "format", "(", "event", ")", ")", "self", ".", "settings", "[", "\"event_queu...
14a40a3950910a9cd008b55f0d8905aa0186ce18
valid
StreamBase.transport_connected
Called when transport has been connected. Send the stream head if initiator.
pyxmpp2/streambase.py
def transport_connected(self): """Called when transport has been connected. Send the stream head if initiator. """ with self.lock: if self.initiator: if self._output_state is None: self._initiate()
def transport_connected(self): """Called when transport has been connected. Send the stream head if initiator. """ with self.lock: if self.initiator: if self._output_state is None: self._initiate()
[ "Called", "when", "transport", "has", "been", "connected", "." ]
Jajcus/pyxmpp2
python
https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/streambase.py#L251-L259
[ "def", "transport_connected", "(", "self", ")", ":", "with", "self", ".", "lock", ":", "if", "self", ".", "initiator", ":", "if", "self", ".", "_output_state", "is", "None", ":", "self", ".", "_initiate", "(", ")" ]
14a40a3950910a9cd008b55f0d8905aa0186ce18
valid
StreamBase.stream_start
Process <stream:stream> (stream start) tag received from peer. `lock` is acquired when this method is called. :Parameters: - `element`: root element (empty) created by the parser
pyxmpp2/streambase.py
def stream_start(self, element): """Process <stream:stream> (stream start) tag received from peer. `lock` is acquired when this method is called. :Parameters: - `element`: root element (empty) created by the parser""" with self.lock: logger.debug("input document...
def stream_start(self, element): """Process <stream:stream> (stream start) tag received from peer. `lock` is acquired when this method is called. :Parameters: - `element`: root element (empty) created by the parser""" with self.lock: logger.debug("input document...
[ "Process", "<stream", ":", "stream", ">", "(", "stream", "start", ")", "tag", "received", "from", "peer", "." ]
Jajcus/pyxmpp2
python
https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/streambase.py#L265-L341
[ "def", "stream_start", "(", "self", ",", "element", ")", ":", "with", "self", ".", "lock", ":", "logger", ".", "debug", "(", "\"input document: \"", "+", "element_to_unicode", "(", "element", ")", ")", "if", "not", "element", ".", "tag", ".", "startswith",...
14a40a3950910a9cd008b55f0d8905aa0186ce18
valid
StreamBase.stream_end
Process </stream:stream> (stream end) tag received from peer.
pyxmpp2/streambase.py
def stream_end(self): """Process </stream:stream> (stream end) tag received from peer. """ logger.debug("Stream ended") with self.lock: self._input_state = "closed" self.transport.disconnect() self._output_state = "closed"
def stream_end(self): """Process </stream:stream> (stream end) tag received from peer. """ logger.debug("Stream ended") with self.lock: self._input_state = "closed" self.transport.disconnect() self._output_state = "closed"
[ "Process", "<", "/", "stream", ":", "stream", ">", "(", "stream", "end", ")", "tag", "received", "from", "peer", "." ]
Jajcus/pyxmpp2
python
https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/streambase.py#L344-L351
[ "def", "stream_end", "(", "self", ")", ":", "logger", ".", "debug", "(", "\"Stream ended\"", ")", "with", "self", ".", "lock", ":", "self", ".", "_input_state", "=", "\"closed\"", "self", ".", "transport", ".", "disconnect", "(", ")", "self", ".", "_outp...
14a40a3950910a9cd008b55f0d8905aa0186ce18
valid
StreamBase._send_stream_start
Send stream start tag.
pyxmpp2/streambase.py
def _send_stream_start(self, stream_id = None, stream_to = None): """Send stream start tag.""" if self._output_state in ("open", "closed"): raise StreamError("Stream start already sent") if not self.language: self.language = self.settings["language"] if stream_to:...
def _send_stream_start(self, stream_id = None, stream_to = None): """Send stream start tag.""" if self._output_state in ("open", "closed"): raise StreamError("Stream start already sent") if not self.language: self.language = self.settings["language"] if stream_to:...
[ "Send", "stream", "start", "tag", "." ]
Jajcus/pyxmpp2
python
https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/streambase.py#L379-L399
[ "def", "_send_stream_start", "(", "self", ",", "stream_id", "=", "None", ",", "stream_to", "=", "None", ")", ":", "if", "self", ".", "_output_state", "in", "(", "\"open\"", ",", "\"closed\"", ")", ":", "raise", "StreamError", "(", "\"Stream start already sent\...
14a40a3950910a9cd008b55f0d8905aa0186ce18
valid
StreamBase._send_stream_error
Same as `send_stream_error`, but expects `lock` acquired.
pyxmpp2/streambase.py
def _send_stream_error(self, condition): """Same as `send_stream_error`, but expects `lock` acquired. """ if self._output_state is "closed": return if self._output_state in (None, "restart"): self._send_stream_start() element = StreamErrorElement(condition...
def _send_stream_error(self, condition): """Same as `send_stream_error`, but expects `lock` acquired. """ if self._output_state is "closed": return if self._output_state in (None, "restart"): self._send_stream_start() element = StreamErrorElement(condition...
[ "Same", "as", "send_stream_error", "but", "expects", "lock", "acquired", "." ]
Jajcus/pyxmpp2
python
https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/streambase.py#L411-L421
[ "def", "_send_stream_error", "(", "self", ",", "condition", ")", ":", "if", "self", ".", "_output_state", "is", "\"closed\"", ":", "return", "if", "self", ".", "_output_state", "in", "(", "None", ",", "\"restart\"", ")", ":", "self", ".", "_send_stream_start...
14a40a3950910a9cd008b55f0d8905aa0186ce18
valid
StreamBase._restart_stream
Restart the stream as needed after SASL and StartTLS negotiation.
pyxmpp2/streambase.py
def _restart_stream(self): """Restart the stream as needed after SASL and StartTLS negotiation.""" self._input_state = "restart" self._output_state = "restart" self.features = None self.transport.restart() if self.initiator: self._send_stream_start(self.stream...
def _restart_stream(self): """Restart the stream as needed after SASL and StartTLS negotiation.""" self._input_state = "restart" self._output_state = "restart" self.features = None self.transport.restart() if self.initiator: self._send_stream_start(self.stream...
[ "Restart", "the", "stream", "as", "needed", "after", "SASL", "and", "StartTLS", "negotiation", "." ]
Jajcus/pyxmpp2
python
https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/streambase.py#L423-L430
[ "def", "_restart_stream", "(", "self", ")", ":", "self", ".", "_input_state", "=", "\"restart\"", "self", ".", "_output_state", "=", "\"restart\"", "self", ".", "features", "=", "None", "self", ".", "transport", ".", "restart", "(", ")", "if", "self", ".",...
14a40a3950910a9cd008b55f0d8905aa0186ce18
valid
StreamBase._make_stream_features
Create the <features/> element for the stream. [receving entity only] :returns: new <features/> element :returntype: :etree:`ElementTree.Element`
pyxmpp2/streambase.py
def _make_stream_features(self): """Create the <features/> element for the stream. [receving entity only] :returns: new <features/> element :returntype: :etree:`ElementTree.Element`""" features = ElementTree.Element(FEATURES_TAG) for handler in self._stream_feature_hand...
def _make_stream_features(self): """Create the <features/> element for the stream. [receving entity only] :returns: new <features/> element :returntype: :etree:`ElementTree.Element`""" features = ElementTree.Element(FEATURES_TAG) for handler in self._stream_feature_hand...
[ "Create", "the", "<features", "/", ">", "element", "for", "the", "stream", "." ]
Jajcus/pyxmpp2
python
https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/streambase.py#L432-L442
[ "def", "_make_stream_features", "(", "self", ")", ":", "features", "=", "ElementTree", ".", "Element", "(", "FEATURES_TAG", ")", "for", "handler", "in", "self", ".", "_stream_feature_handlers", ":", "handler", ".", "make_stream_features", "(", "self", ",", "feat...
14a40a3950910a9cd008b55f0d8905aa0186ce18
valid
StreamBase._send_stream_features
Send stream <features/>. [receiving entity only]
pyxmpp2/streambase.py
def _send_stream_features(self): """Send stream <features/>. [receiving entity only]""" self.features = self._make_stream_features() self._write_element(self.features)
def _send_stream_features(self): """Send stream <features/>. [receiving entity only]""" self.features = self._make_stream_features() self._write_element(self.features)
[ "Send", "stream", "<features", "/", ">", "." ]
Jajcus/pyxmpp2
python
https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/streambase.py#L444-L449
[ "def", "_send_stream_features", "(", "self", ")", ":", "self", ".", "features", "=", "self", ".", "_make_stream_features", "(", ")", "self", ".", "_write_element", "(", "self", ".", "features", ")" ]
14a40a3950910a9cd008b55f0d8905aa0186ce18
valid
StreamBase._send
Same as `send` but assume `lock` is acquired.
pyxmpp2/streambase.py
def _send(self, stanza): """Same as `send` but assume `lock` is acquired.""" self.fix_out_stanza(stanza) element = stanza.as_xml() self._write_element(element)
def _send(self, stanza): """Same as `send` but assume `lock` is acquired.""" self.fix_out_stanza(stanza) element = stanza.as_xml() self._write_element(element)
[ "Same", "as", "send", "but", "assume", "lock", "is", "acquired", "." ]
Jajcus/pyxmpp2
python
https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/streambase.py#L478-L482
[ "def", "_send", "(", "self", ",", "stanza", ")", ":", "self", ".", "fix_out_stanza", "(", "stanza", ")", "element", "=", "stanza", ".", "as_xml", "(", ")", "self", ".", "_write_element", "(", "element", ")" ]
14a40a3950910a9cd008b55f0d8905aa0186ce18
valid
StreamBase._process_element
Process first level element of the stream. The element may be stream error or features, StartTLS request/response, SASL request/response or a stanza. :Parameters: - `element`: XML element :Types: - `element`: :etree:`ElementTree.Element`
pyxmpp2/streambase.py
def _process_element(self, element): """Process first level element of the stream. The element may be stream error or features, StartTLS request/response, SASL request/response or a stanza. :Parameters: - `element`: XML element :Types: - `element`: :etre...
def _process_element(self, element): """Process first level element of the stream. The element may be stream error or features, StartTLS request/response, SASL request/response or a stanza. :Parameters: - `element`: XML element :Types: - `element`: :etre...
[ "Process", "first", "level", "element", "of", "the", "stream", "." ]
Jajcus/pyxmpp2
python
https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/streambase.py#L484-L515
[ "def", "_process_element", "(", "self", ",", "element", ")", ":", "tag", "=", "element", ".", "tag", "if", "tag", "in", "self", ".", "_element_handlers", ":", "handler", "=", "self", ".", "_element_handlers", "[", "tag", "]", "logger", ".", "debug", "(",...
14a40a3950910a9cd008b55f0d8905aa0186ce18
valid
StreamBase.uplink_receive
Handle stanza received from the stream.
pyxmpp2/streambase.py
def uplink_receive(self, stanza): """Handle stanza received from the stream.""" with self.lock: if self.stanza_route: self.stanza_route.uplink_receive(stanza) else: logger.debug(u"Stanza dropped (no route): {0!r}".format(stanza))
def uplink_receive(self, stanza): """Handle stanza received from the stream.""" with self.lock: if self.stanza_route: self.stanza_route.uplink_receive(stanza) else: logger.debug(u"Stanza dropped (no route): {0!r}".format(stanza))
[ "Handle", "stanza", "received", "from", "the", "stream", "." ]
Jajcus/pyxmpp2
python
https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/streambase.py#L517-L523
[ "def", "uplink_receive", "(", "self", ",", "stanza", ")", ":", "with", "self", ".", "lock", ":", "if", "self", ".", "stanza_route", ":", "self", ".", "stanza_route", ".", "uplink_receive", "(", "stanza", ")", "else", ":", "logger", ".", "debug", "(", "...
14a40a3950910a9cd008b55f0d8905aa0186ce18
valid
StreamBase.process_stream_error
Process stream error element received. :Parameters: - `error`: error received :Types: - `error`: `StreamErrorElement`
pyxmpp2/streambase.py
def process_stream_error(self, error): """Process stream error element received. :Parameters: - `error`: error received :Types: - `error`: `StreamErrorElement` """ # pylint: disable-msg=R0201 logger.debug("Unhandled stream error: condition: {0} {...
def process_stream_error(self, error): """Process stream error element received. :Parameters: - `error`: error received :Types: - `error`: `StreamErrorElement` """ # pylint: disable-msg=R0201 logger.debug("Unhandled stream error: condition: {0} {...
[ "Process", "stream", "error", "element", "received", "." ]
Jajcus/pyxmpp2
python
https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/streambase.py#L525-L536
[ "def", "process_stream_error", "(", "self", ",", "error", ")", ":", "# pylint: disable-msg=R0201", "logger", ".", "debug", "(", "\"Unhandled stream error: condition: {0} {1!r}\"", ".", "format", "(", "error", ".", "condition_name", ",", "error", ".", "serialize", "(",...
14a40a3950910a9cd008b55f0d8905aa0186ce18
valid
StreamBase._got_features
Process incoming <stream:features/> element. [initiating entity only] The received features node is available in `features`.
pyxmpp2/streambase.py
def _got_features(self, features): """Process incoming <stream:features/> element. [initiating entity only] The received features node is available in `features`.""" self.features = features logger.debug("got features, passing to event handlers...") handled = self.event...
def _got_features(self, features): """Process incoming <stream:features/> element. [initiating entity only] The received features node is available in `features`.""" self.features = features logger.debug("got features, passing to event handlers...") handled = self.event...
[ "Process", "incoming", "<stream", ":", "features", "/", ">", "element", "." ]
Jajcus/pyxmpp2
python
https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/streambase.py#L556-L591
[ "def", "_got_features", "(", "self", ",", "features", ")", ":", "self", ".", "features", "=", "features", "logger", ".", "debug", "(", "\"got features, passing to event handlers...\"", ")", "handled", "=", "self", ".", "event", "(", "GotFeaturesEvent", "(", "sel...
14a40a3950910a9cd008b55f0d8905aa0186ce18
valid
StreamBase.set_peer_authenticated
Mark the other side of the stream authenticated as `peer` :Parameters: - `peer`: local JID just authenticated - `restart_stream`: `True` when stream should be restarted (needed after SASL authentication) :Types: - `peer`: `JID` - `restart_st...
pyxmpp2/streambase.py
def set_peer_authenticated(self, peer, restart_stream = False): """Mark the other side of the stream authenticated as `peer` :Parameters: - `peer`: local JID just authenticated - `restart_stream`: `True` when stream should be restarted (needed after SASL authentica...
def set_peer_authenticated(self, peer, restart_stream = False): """Mark the other side of the stream authenticated as `peer` :Parameters: - `peer`: local JID just authenticated - `restart_stream`: `True` when stream should be restarted (needed after SASL authentica...
[ "Mark", "the", "other", "side", "of", "the", "stream", "authenticated", "as", "peer" ]
Jajcus/pyxmpp2
python
https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/streambase.py#L599-L615
[ "def", "set_peer_authenticated", "(", "self", ",", "peer", ",", "restart_stream", "=", "False", ")", ":", "with", "self", ".", "lock", ":", "self", ".", "peer_authenticated", "=", "True", "self", ".", "peer", "=", "peer", "if", "restart_stream", ":", "self...
14a40a3950910a9cd008b55f0d8905aa0186ce18
valid
StreamBase.set_authenticated
Mark stream authenticated as `me`. :Parameters: - `me`: local JID just authenticated - `restart_stream`: `True` when stream should be restarted (needed after SASL authentication) :Types: - `me`: `JID` - `restart_stream`: `bool`
pyxmpp2/streambase.py
def set_authenticated(self, me, restart_stream = False): """Mark stream authenticated as `me`. :Parameters: - `me`: local JID just authenticated - `restart_stream`: `True` when stream should be restarted (needed after SASL authentication) :Types: ...
def set_authenticated(self, me, restart_stream = False): """Mark stream authenticated as `me`. :Parameters: - `me`: local JID just authenticated - `restart_stream`: `True` when stream should be restarted (needed after SASL authentication) :Types: ...
[ "Mark", "stream", "authenticated", "as", "me", "." ]
Jajcus/pyxmpp2
python
https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/streambase.py#L617-L633
[ "def", "set_authenticated", "(", "self", ",", "me", ",", "restart_stream", "=", "False", ")", ":", "with", "self", ".", "lock", ":", "self", ".", "authenticated", "=", "True", "self", ".", "me", "=", "me", "if", "restart_stream", ":", "self", ".", "_re...
14a40a3950910a9cd008b55f0d8905aa0186ce18
valid
StreamBase.auth_properties
Authentication properties of the stream. Derived from the transport with 'local-jid' and 'service-type' added.
pyxmpp2/streambase.py
def auth_properties(self): """Authentication properties of the stream. Derived from the transport with 'local-jid' and 'service-type' added. """ props = dict(self.settings["extra_auth_properties"]) if self.transport: props.update(self.transport.auth_properties) ...
def auth_properties(self): """Authentication properties of the stream. Derived from the transport with 'local-jid' and 'service-type' added. """ props = dict(self.settings["extra_auth_properties"]) if self.transport: props.update(self.transport.auth_properties) ...
[ "Authentication", "properties", "of", "the", "stream", "." ]
Jajcus/pyxmpp2
python
https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/streambase.py#L653-L663
[ "def", "auth_properties", "(", "self", ")", ":", "props", "=", "dict", "(", "self", ".", "settings", "[", "\"extra_auth_properties\"", "]", ")", "if", "self", ".", "transport", ":", "props", ".", "update", "(", "self", ".", "transport", ".", "auth_properti...
14a40a3950910a9cd008b55f0d8905aa0186ce18
valid
ClientStream.initiate
Initiate an XMPP connection over the `transport`. :Parameters: - `transport`: an XMPP transport instance - `to`: peer name (defaults to own jid domain part)
pyxmpp2/clientstream.py
def initiate(self, transport, to = None): """Initiate an XMPP connection over the `transport`. :Parameters: - `transport`: an XMPP transport instance - `to`: peer name (defaults to own jid domain part) """ if to is None: to = JID(self.me.domain) ...
def initiate(self, transport, to = None): """Initiate an XMPP connection over the `transport`. :Parameters: - `transport`: an XMPP transport instance - `to`: peer name (defaults to own jid domain part) """ if to is None: to = JID(self.me.domain) ...
[ "Initiate", "an", "XMPP", "connection", "over", "the", "transport", "." ]
Jajcus/pyxmpp2
python
https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/clientstream.py#L61-L70
[ "def", "initiate", "(", "self", ",", "transport", ",", "to", "=", "None", ")", ":", "if", "to", "is", "None", ":", "to", "=", "JID", "(", "self", ".", "me", ".", "domain", ")", "return", "StreamBase", ".", "initiate", "(", "self", ",", "transport",...
14a40a3950910a9cd008b55f0d8905aa0186ce18
valid
ClientStream.receive
Receive an XMPP connection over the `transport`. :Parameters: - `transport`: an XMPP transport instance - `myname`: local stream endpoint name (defaults to own jid domain part).
pyxmpp2/clientstream.py
def receive(self, transport, myname = None): """Receive an XMPP connection over the `transport`. :Parameters: - `transport`: an XMPP transport instance - `myname`: local stream endpoint name (defaults to own jid domain part). """ if myname is None: ...
def receive(self, transport, myname = None): """Receive an XMPP connection over the `transport`. :Parameters: - `transport`: an XMPP transport instance - `myname`: local stream endpoint name (defaults to own jid domain part). """ if myname is None: ...
[ "Receive", "an", "XMPP", "connection", "over", "the", "transport", "." ]
Jajcus/pyxmpp2
python
https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/clientstream.py#L72-L82
[ "def", "receive", "(", "self", ",", "transport", ",", "myname", "=", "None", ")", ":", "if", "myname", "is", "None", ":", "myname", "=", "JID", "(", "self", ".", "me", ".", "domain", ")", "return", "StreamBase", ".", "receive", "(", "self", ",", "t...
14a40a3950910a9cd008b55f0d8905aa0186ce18
valid
ClientStream.fix_out_stanza
Fix outgoing stanza. On a client clear the sender JID. On a server set the sender address to the own JID if the address is not set yet.
pyxmpp2/clientstream.py
def fix_out_stanza(self, stanza): """Fix outgoing stanza. On a client clear the sender JID. On a server set the sender address to the own JID if the address is not set yet.""" StreamBase.fix_out_stanza(self, stanza) if self.initiator: if stanza.from_jid: ...
def fix_out_stanza(self, stanza): """Fix outgoing stanza. On a client clear the sender JID. On a server set the sender address to the own JID if the address is not set yet.""" StreamBase.fix_out_stanza(self, stanza) if self.initiator: if stanza.from_jid: ...
[ "Fix", "outgoing", "stanza", "." ]
Jajcus/pyxmpp2
python
https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/clientstream.py#L84-L95
[ "def", "fix_out_stanza", "(", "self", ",", "stanza", ")", ":", "StreamBase", ".", "fix_out_stanza", "(", "self", ",", "stanza", ")", "if", "self", ".", "initiator", ":", "if", "stanza", ".", "from_jid", ":", "stanza", ".", "from_jid", "=", "None", "else"...
14a40a3950910a9cd008b55f0d8905aa0186ce18
valid
ClientStream.fix_in_stanza
Fix an incoming stanza. Ona server replace the sender address with authorized client JID.
pyxmpp2/clientstream.py
def fix_in_stanza(self, stanza): """Fix an incoming stanza. Ona server replace the sender address with authorized client JID.""" StreamBase.fix_in_stanza(self, stanza) if not self.initiator: if stanza.from_jid != self.peer: stanza.set_from(self.peer)
def fix_in_stanza(self, stanza): """Fix an incoming stanza. Ona server replace the sender address with authorized client JID.""" StreamBase.fix_in_stanza(self, stanza) if not self.initiator: if stanza.from_jid != self.peer: stanza.set_from(self.peer)
[ "Fix", "an", "incoming", "stanza", "." ]
Jajcus/pyxmpp2
python
https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/clientstream.py#L97-L104
[ "def", "fix_in_stanza", "(", "self", ",", "stanza", ")", ":", "StreamBase", ".", "fix_in_stanza", "(", "self", ",", "stanza", ")", "if", "not", "self", ".", "initiator", ":", "if", "stanza", ".", "from_jid", "!=", "self", ".", "peer", ":", "stanza", "....
14a40a3950910a9cd008b55f0d8905aa0186ce18
valid
SelectMainLoop.loop_iteration
A loop iteration - check any scheduled events and I/O available and run the handlers.
pyxmpp2/mainloop/select.py
def loop_iteration(self, timeout = 60): """A loop iteration - check any scheduled events and I/O available and run the handlers. """ if self.check_events(): return 0 next_timeout, sources_handled = self._call_timeout_handlers() if self._quit: retur...
def loop_iteration(self, timeout = 60): """A loop iteration - check any scheduled events and I/O available and run the handlers. """ if self.check_events(): return 0 next_timeout, sources_handled = self._call_timeout_handlers() if self._quit: retur...
[ "A", "loop", "iteration", "-", "check", "any", "scheduled", "events", "and", "I", "/", "O", "available", "and", "run", "the", "handlers", "." ]
Jajcus/pyxmpp2
python
https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/mainloop/select.py#L54-L82
[ "def", "loop_iteration", "(", "self", ",", "timeout", "=", "60", ")", ":", "if", "self", ".", "check_events", "(", ")", ":", "return", "0", "next_timeout", ",", "sources_handled", "=", "self", ".", "_call_timeout_handlers", "(", ")", "if", "self", ".", "...
14a40a3950910a9cd008b55f0d8905aa0186ce18
valid
SelectMainLoop._prepare_handlers
Prepare the I/O handlers. :Return: (readable, writable, timeout) tuple. 'readable' is the list of readable handlers, 'writable' - the list of writable handlers, 'timeout' the suggested maximum timeout for this loop iteration or `None`
pyxmpp2/mainloop/select.py
def _prepare_handlers(self): """Prepare the I/O handlers. :Return: (readable, writable, timeout) tuple. 'readable' is the list of readable handlers, 'writable' - the list of writable handlers, 'timeout' the suggested maximum timeout for this loop iteration or `None` ...
def _prepare_handlers(self): """Prepare the I/O handlers. :Return: (readable, writable, timeout) tuple. 'readable' is the list of readable handlers, 'writable' - the list of writable handlers, 'timeout' the suggested maximum timeout for this loop iteration or `None` ...
[ "Prepare", "the", "I", "/", "O", "handlers", "." ]
Jajcus/pyxmpp2
python
https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/mainloop/select.py#L84-L119
[ "def", "_prepare_handlers", "(", "self", ")", ":", "timeout", "=", "None", "readable", "=", "[", "]", "writable", "=", "[", "]", "for", "handler", "in", "self", ".", "_handlers", ":", "if", "handler", "not", "in", "self", ".", "_prepared", ":", "logger...
14a40a3950910a9cd008b55f0d8905aa0186ce18
valid
Register.__from_xml
Initialize `Register` from an XML node. :Parameters: - `xmlnode`: the jabber:x:register XML element. :Types: - `xmlnode`: `libxml2.xmlNode`
pyxmpp2/ext/register.py
def __from_xml(self, xmlnode): """Initialize `Register` from an XML node. :Parameters: - `xmlnode`: the jabber:x:register XML element. :Types: - `xmlnode`: `libxml2.xmlNode`""" self.__logger.debug("Converting jabber:iq:register element from XML") if xmln...
def __from_xml(self, xmlnode): """Initialize `Register` from an XML node. :Parameters: - `xmlnode`: the jabber:x:register XML element. :Types: - `xmlnode`: `libxml2.xmlNode`""" self.__logger.debug("Converting jabber:iq:register element from XML") if xmln...
[ "Initialize", "Register", "from", "an", "XML", "node", "." ]
Jajcus/pyxmpp2
python
https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/ext/register.py#L140-L173
[ "def", "__from_xml", "(", "self", ",", "xmlnode", ")", ":", "self", ".", "__logger", ".", "debug", "(", "\"Converting jabber:iq:register element from XML\"", ")", "if", "xmlnode", ".", "type", "!=", "\"element\"", ":", "raise", "ValueError", "(", "\"XML node is no...
14a40a3950910a9cd008b55f0d8905aa0186ce18
valid
Register.complete_xml_element
Complete the XML node with `self` content. :Parameters: - `xmlnode`: XML node with the element being built. It has already right name and namespace, but no attributes or content. - `doc`: document to which the element belongs. :Types: - `xmlnode`: `libx...
pyxmpp2/ext/register.py
def complete_xml_element(self, xmlnode, doc): """Complete the XML node with `self` content. :Parameters: - `xmlnode`: XML node with the element being built. It has already right name and namespace, but no attributes or content. - `doc`: document to which the elemen...
def complete_xml_element(self, xmlnode, doc): """Complete the XML node with `self` content. :Parameters: - `xmlnode`: XML node with the element being built. It has already right name and namespace, but no attributes or content. - `doc`: document to which the elemen...
[ "Complete", "the", "XML", "node", "with", "self", "content", "." ]
Jajcus/pyxmpp2
python
https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/ext/register.py#L175-L198
[ "def", "complete_xml_element", "(", "self", ",", "xmlnode", ",", "doc", ")", ":", "ns", "=", "xmlnode", ".", "ns", "(", ")", "if", "self", ".", "instructions", "is", "not", "None", ":", "xmlnode", ".", "newTextChild", "(", "ns", ",", "\"instructions\"", ...
14a40a3950910a9cd008b55f0d8905aa0186ce18
valid
Register.get_form
Return Data Form for the `Register` object. Convert legacy fields to a data form if `self.form` is `None`, return `self.form` otherwise. :Parameters: - `form_type`: If "form", then a form to fill-in should be returned. If "sumbit", then a form with submitted data. :Ty...
pyxmpp2/ext/register.py
def get_form(self, form_type = "form"): """Return Data Form for the `Register` object. Convert legacy fields to a data form if `self.form` is `None`, return `self.form` otherwise. :Parameters: - `form_type`: If "form", then a form to fill-in should be returned. If "su...
def get_form(self, form_type = "form"): """Return Data Form for the `Register` object. Convert legacy fields to a data form if `self.form` is `None`, return `self.form` otherwise. :Parameters: - `form_type`: If "form", then a form to fill-in should be returned. If "su...
[ "Return", "Data", "Form", "for", "the", "Register", "object", "." ]
Jajcus/pyxmpp2
python
https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/ext/register.py#L200-L233
[ "def", "get_form", "(", "self", ",", "form_type", "=", "\"form\"", ")", ":", "if", "self", ".", "form", ":", "if", "self", ".", "form", ".", "type", "!=", "form_type", ":", "raise", "ValueError", "(", "\"Bad form type in the jabber:iq:register element\"", ")",...
14a40a3950910a9cd008b55f0d8905aa0186ce18
valid
Register.submit_form
Make `Register` object for submitting the registration form. Convert form data to legacy fields if `self.form` is `None`. :Parameters: - `form`: The form to submit. Its type doesn't have to be "submit" (a "submit" form will be created here), so it could be the form ...
pyxmpp2/ext/register.py
def submit_form(self, form): """Make `Register` object for submitting the registration form. Convert form data to legacy fields if `self.form` is `None`. :Parameters: - `form`: The form to submit. Its type doesn't have to be "submit" (a "submit" form will be created h...
def submit_form(self, form): """Make `Register` object for submitting the registration form. Convert form data to legacy fields if `self.form` is `None`. :Parameters: - `form`: The form to submit. Its type doesn't have to be "submit" (a "submit" form will be created h...
[ "Make", "Register", "object", "for", "submitting", "the", "registration", "form", "." ]
Jajcus/pyxmpp2
python
https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/ext/register.py#L235-L267
[ "def", "submit_form", "(", "self", ",", "form", ")", ":", "result", "=", "Register", "(", ")", "if", "self", ".", "form", ":", "result", ".", "form", "=", "form", ".", "make_submit", "(", ")", "return", "result", "if", "\"FORM_TYPE\"", "not", "in", "...
14a40a3950910a9cd008b55f0d8905aa0186ce18
valid
get_delays
Get jabber:x:delay elements from the stanza. :Parameters: - `stanza`: a, probably delayed, stanza. :Types: - `stanza`: `pyxmpp.stanza.Stanza` :return: list of delay tags sorted by the timestamp. :returntype: `list` of `Delay`
pyxmpp2/ext/delay.py
def get_delays(stanza): """Get jabber:x:delay elements from the stanza. :Parameters: - `stanza`: a, probably delayed, stanza. :Types: - `stanza`: `pyxmpp.stanza.Stanza` :return: list of delay tags sorted by the timestamp. :returntype: `list` of `Delay`""" delays=[] n=stanza...
def get_delays(stanza): """Get jabber:x:delay elements from the stanza. :Parameters: - `stanza`: a, probably delayed, stanza. :Types: - `stanza`: `pyxmpp.stanza.Stanza` :return: list of delay tags sorted by the timestamp. :returntype: `list` of `Delay`""" delays=[] n=stanza...
[ "Get", "jabber", ":", "x", ":", "delay", "elements", "from", "the", "stanza", "." ]
Jajcus/pyxmpp2
python
https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/ext/delay.py#L163-L180
[ "def", "get_delays", "(", "stanza", ")", ":", "delays", "=", "[", "]", "n", "=", "stanza", ".", "xmlnode", ".", "children", "while", "n", ":", "if", "n", ".", "type", "==", "\"element\"", "and", "get_node_ns_uri", "(", "n", ")", "==", "DELAY_NS", "an...
14a40a3950910a9cd008b55f0d8905aa0186ce18
valid
Delay.from_xml
Initialize Delay object from an XML node. :Parameters: - `xmlnode`: the jabber:x:delay XML element. :Types: - `xmlnode`: `libxml2.xmlNode`
pyxmpp2/ext/delay.py
def from_xml(self,xmlnode): """Initialize Delay object from an XML node. :Parameters: - `xmlnode`: the jabber:x:delay XML element. :Types: - `xmlnode`: `libxml2.xmlNode`""" if xmlnode.type!="element": raise ValueError("XML node is not a jabber:x:delay...
def from_xml(self,xmlnode): """Initialize Delay object from an XML node. :Parameters: - `xmlnode`: the jabber:x:delay XML element. :Types: - `xmlnode`: `libxml2.xmlNode`""" if xmlnode.type!="element": raise ValueError("XML node is not a jabber:x:delay...
[ "Initialize", "Delay", "object", "from", "an", "XML", "node", "." ]
Jajcus/pyxmpp2
python
https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/ext/delay.py#L86-L117
[ "def", "from_xml", "(", "self", ",", "xmlnode", ")", ":", "if", "xmlnode", ".", "type", "!=", "\"element\"", ":", "raise", "ValueError", "(", "\"XML node is not a jabber:x:delay element (not an element)\"", ")", "ns", "=", "get_node_ns_uri", "(", "xmlnode", ")", "...
14a40a3950910a9cd008b55f0d8905aa0186ce18
valid
Delay.complete_xml_element
Complete the XML node with `self` content. Should be overriden in classes derived from `StanzaPayloadObject`. :Parameters: - `xmlnode`: XML node with the element being built. It has already right name and namespace, but no attributes or content. - `_unused`: docum...
pyxmpp2/ext/delay.py
def complete_xml_element(self, xmlnode, _unused): """Complete the XML node with `self` content. Should be overriden in classes derived from `StanzaPayloadObject`. :Parameters: - `xmlnode`: XML node with the element being built. It has already right name and namespace,...
def complete_xml_element(self, xmlnode, _unused): """Complete the XML node with `self` content. Should be overriden in classes derived from `StanzaPayloadObject`. :Parameters: - `xmlnode`: XML node with the element being built. It has already right name and namespace,...
[ "Complete", "the", "XML", "node", "with", "self", "content", "." ]
Jajcus/pyxmpp2
python
https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/ext/delay.py#L119-L136
[ "def", "complete_xml_element", "(", "self", ",", "xmlnode", ",", "_unused", ")", ":", "tm", "=", "self", ".", "timestamp", ".", "strftime", "(", "\"%Y%m%dT%H:%M:%S\"", ")", "xmlnode", ".", "setProp", "(", "\"stamp\"", ",", "tm", ")", "if", "self", ".", "...
14a40a3950910a9cd008b55f0d8905aa0186ce18
valid
main
Parse the command-line arguments and run the bot.
examples/echobot.py
def main(): """Parse the command-line arguments and run the bot.""" parser = argparse.ArgumentParser(description = 'XMPP echo bot', parents = [XMPPSettings.get_arg_parser()]) parser.add_argument('jid', metavar = 'JID', help = 'The ...
def main(): """Parse the command-line arguments and run the bot.""" parser = argparse.ArgumentParser(description = 'XMPP echo bot', parents = [XMPPSettings.get_arg_parser()]) parser.add_argument('jid', metavar = 'JID', help = 'The ...
[ "Parse", "the", "command", "-", "line", "arguments", "and", "run", "the", "bot", "." ]
Jajcus/pyxmpp2
python
https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/examples/echobot.py#L96-L142
[ "def", "main", "(", ")", ":", "parser", "=", "argparse", ".", "ArgumentParser", "(", "description", "=", "'XMPP echo bot'", ",", "parents", "=", "[", "XMPPSettings", ".", "get_arg_parser", "(", ")", "]", ")", "parser", ".", "add_argument", "(", "'jid'", ",...
14a40a3950910a9cd008b55f0d8905aa0186ce18
valid
EchoBot.handle_message
Echo every non-error ``<message/>`` stanza. Add "Re: " to subject, if any.
examples/echobot.py
def handle_message(self, stanza): """Echo every non-error ``<message/>`` stanza. Add "Re: " to subject, if any. """ if stanza.subject: subject = u"Re: " + stanza.subject else: subject = None msg = Message(stanza_type = stanza.stanza_type, ...
def handle_message(self, stanza): """Echo every non-error ``<message/>`` stanza. Add "Re: " to subject, if any. """ if stanza.subject: subject = u"Re: " + stanza.subject else: subject = None msg = Message(stanza_type = stanza.stanza_type, ...
[ "Echo", "every", "non", "-", "error", "<message", "/", ">", "stanza", ".", "Add", "Re", ":", "to", "subject", "if", "any", "." ]
Jajcus/pyxmpp2
python
https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/examples/echobot.py#L71-L84
[ "def", "handle_message", "(", "self", ",", "stanza", ")", ":", "if", "stanza", ".", "subject", ":", "subject", "=", "u\"Re: \"", "+", "stanza", ".", "subject", "else", ":", "subject", "=", "None", "msg", "=", "Message", "(", "stanza_type", "=", "stanza",...
14a40a3950910a9cd008b55f0d8905aa0186ce18
valid
TCPListener.prepare
When connecting start the next connection step and schedule next `prepare` call, when connected return `HandlerReady()`
pyxmpp2/server/listener.py
def prepare(self): """When connecting start the next connection step and schedule next `prepare` call, when connected return `HandlerReady()` """ with self._lock: if self._socket: self._socket.listen(SOMAXCONN) self._socket.setblocking(False) ...
def prepare(self): """When connecting start the next connection step and schedule next `prepare` call, when connected return `HandlerReady()` """ with self._lock: if self._socket: self._socket.listen(SOMAXCONN) self._socket.setblocking(False) ...
[ "When", "connecting", "start", "the", "next", "connection", "step", "and", "schedule", "next", "prepare", "call", "when", "connected", "return", "HandlerReady", "()" ]
Jajcus/pyxmpp2
python
https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/server/listener.py#L91-L99
[ "def", "prepare", "(", "self", ")", ":", "with", "self", ".", "_lock", ":", "if", "self", ".", "_socket", ":", "self", ".", "_socket", ".", "listen", "(", "SOMAXCONN", ")", "self", ".", "_socket", ".", "setblocking", "(", "False", ")", "return", "Han...
14a40a3950910a9cd008b55f0d8905aa0186ce18
valid
TCPListener.handle_read
Accept any incoming connections.
pyxmpp2/server/listener.py
def handle_read(self): """ Accept any incoming connections. """ with self._lock: logger.debug("handle_read()") if self._socket is None: return while True: try: sock, address = self._socket.accept() ...
def handle_read(self): """ Accept any incoming connections. """ with self._lock: logger.debug("handle_read()") if self._socket is None: return while True: try: sock, address = self._socket.accept() ...
[ "Accept", "any", "incoming", "connections", "." ]
Jajcus/pyxmpp2
python
https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/server/listener.py#L124-L141
[ "def", "handle_read", "(", "self", ")", ":", "with", "self", ".", "_lock", ":", "logger", ".", "debug", "(", "\"handle_read()\"", ")", "if", "self", ".", "_socket", "is", "None", ":", "return", "while", "True", ":", "try", ":", "sock", ",", "address", ...
14a40a3950910a9cd008b55f0d8905aa0186ce18
valid
Presence._decode_subelements
Decode the stanza subelements.
pyxmpp2/presence.py
def _decode_subelements(self): """Decode the stanza subelements.""" for child in self._element: if child.tag == self._show_tag: self._show = child.text elif child.tag == self._status_tag: self._status = child.text elif child.tag == self...
def _decode_subelements(self): """Decode the stanza subelements.""" for child in self._element: if child.tag == self._show_tag: self._show = child.text elif child.tag == self._status_tag: self._status = child.text elif child.tag == self...
[ "Decode", "the", "stanza", "subelements", "." ]
Jajcus/pyxmpp2
python
https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/presence.py#L128-L142
[ "def", "_decode_subelements", "(", "self", ")", ":", "for", "child", "in", "self", ".", "_element", ":", "if", "child", ".", "tag", "==", "self", ".", "_show_tag", ":", "self", ".", "_show", "=", "child", ".", "text", "elif", "child", ".", "tag", "==...
14a40a3950910a9cd008b55f0d8905aa0186ce18
valid
Presence.as_xml
Return the XML stanza representation. Always return an independent copy of the stanza XML representation, which can be freely modified without affecting the stanza. :returntype: :etree:`ElementTree.Element`
pyxmpp2/presence.py
def as_xml(self): """Return the XML stanza representation. Always return an independent copy of the stanza XML representation, which can be freely modified without affecting the stanza. :returntype: :etree:`ElementTree.Element`""" result = Stanza.as_xml(self) if self._s...
def as_xml(self): """Return the XML stanza representation. Always return an independent copy of the stanza XML representation, which can be freely modified without affecting the stanza. :returntype: :etree:`ElementTree.Element`""" result = Stanza.as_xml(self) if self._s...
[ "Return", "the", "XML", "stanza", "representation", "." ]
Jajcus/pyxmpp2
python
https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/presence.py#L144-L161
[ "def", "as_xml", "(", "self", ")", ":", "result", "=", "Stanza", ".", "as_xml", "(", "self", ")", "if", "self", ".", "_show", ":", "child", "=", "ElementTree", ".", "SubElement", "(", "result", ",", "self", ".", "_show_tag", ")", "child", ".", "text"...
14a40a3950910a9cd008b55f0d8905aa0186ce18
valid
Presence.copy
Create a deep copy of the stanza. :returntype: `Presence`
pyxmpp2/presence.py
def copy(self): """Create a deep copy of the stanza. :returntype: `Presence`""" result = Presence(None, self.from_jid, self.to_jid, self.stanza_type, self.stanza_id, self.error, self._return_path(), self._show, self._status...
def copy(self): """Create a deep copy of the stanza. :returntype: `Presence`""" result = Presence(None, self.from_jid, self.to_jid, self.stanza_type, self.stanza_id, self.error, self._return_path(), self._show, self._status...
[ "Create", "a", "deep", "copy", "of", "the", "stanza", "." ]
Jajcus/pyxmpp2
python
https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/presence.py#L163-L175
[ "def", "copy", "(", "self", ")", ":", "result", "=", "Presence", "(", "None", ",", "self", ".", "from_jid", ",", "self", ".", "to_jid", ",", "self", ".", "stanza_type", ",", "self", ".", "stanza_id", ",", "self", ".", "error", ",", "self", ".", "_r...
14a40a3950910a9cd008b55f0d8905aa0186ce18
valid
Presence.make_accept_response
Create "accept" response for the "subscribe" / "subscribed" / "unsubscribe" / "unsubscribed" presence stanza. :return: new stanza. :returntype: `Presence`
pyxmpp2/presence.py
def make_accept_response(self): """Create "accept" response for the "subscribe" / "subscribed" / "unsubscribe" / "unsubscribed" presence stanza. :return: new stanza. :returntype: `Presence` """ if self.stanza_type not in ("subscribe", "subscribed", ...
def make_accept_response(self): """Create "accept" response for the "subscribe" / "subscribed" / "unsubscribe" / "unsubscribed" presence stanza. :return: new stanza. :returntype: `Presence` """ if self.stanza_type not in ("subscribe", "subscribed", ...
[ "Create", "accept", "response", "for", "the", "subscribe", "/", "subscribed", "/", "unsubscribe", "/", "unsubscribed", "presence", "stanza", "." ]
Jajcus/pyxmpp2
python
https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/presence.py#L219-L233
[ "def", "make_accept_response", "(", "self", ")", ":", "if", "self", ".", "stanza_type", "not", "in", "(", "\"subscribe\"", ",", "\"subscribed\"", ",", "\"unsubscribe\"", ",", "\"unsubscribed\"", ")", ":", "raise", "ValueError", "(", "\"Results may only be generated ...
14a40a3950910a9cd008b55f0d8905aa0186ce18
valid
Presence.make_deny_response
Create "deny" response for the "subscribe" / "subscribed" / "unsubscribe" / "unsubscribed" presence stanza. :return: new presence stanza. :returntype: `Presence`
pyxmpp2/presence.py
def make_deny_response(self): """Create "deny" response for the "subscribe" / "subscribed" / "unsubscribe" / "unsubscribed" presence stanza. :return: new presence stanza. :returntype: `Presence` """ if self.stanza_type not in ("subscribe", "subscribed", ...
def make_deny_response(self): """Create "deny" response for the "subscribe" / "subscribed" / "unsubscribe" / "unsubscribed" presence stanza. :return: new presence stanza. :returntype: `Presence` """ if self.stanza_type not in ("subscribe", "subscribed", ...
[ "Create", "deny", "response", "for", "the", "subscribe", "/", "subscribed", "/", "unsubscribe", "/", "unsubscribed", "presence", "stanza", "." ]
Jajcus/pyxmpp2
python
https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/presence.py#L235-L249
[ "def", "make_deny_response", "(", "self", ")", ":", "if", "self", ".", "stanza_type", "not", "in", "(", "\"subscribe\"", ",", "\"subscribed\"", ",", "\"unsubscribe\"", ",", "\"unsubscribed\"", ")", ":", "raise", "ValueError", "(", "\"Results may only be generated fo...
14a40a3950910a9cd008b55f0d8905aa0186ce18
valid
Presence.make_error_response
Create error response for the any non-error presence stanza. :Parameters: - `cond`: error condition name, as defined in XMPP specification. :Types: - `cond`: `unicode` :return: new presence stanza. :returntype: `Presence`
pyxmpp2/presence.py
def make_error_response(self, cond): """Create error response for the any non-error presence stanza. :Parameters: - `cond`: error condition name, as defined in XMPP specification. :Types: - `cond`: `unicode` :return: new presence stanza. :returntype: `Pr...
def make_error_response(self, cond): """Create error response for the any non-error presence stanza. :Parameters: - `cond`: error condition name, as defined in XMPP specification. :Types: - `cond`: `unicode` :return: new presence stanza. :returntype: `Pr...
[ "Create", "error", "response", "for", "the", "any", "non", "-", "error", "presence", "stanza", "." ]
Jajcus/pyxmpp2
python
https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/presence.py#L251-L278
[ "def", "make_error_response", "(", "self", ",", "cond", ")", ":", "if", "self", ".", "stanza_type", "==", "\"error\"", ":", "raise", "ValueError", "(", "\"Errors may not be generated in response\"", "\" to errors\"", ")", "stanza", "=", "Presence", "(", "stanza_type...
14a40a3950910a9cd008b55f0d8905aa0186ce18
valid
BillingPlan.activate
Activate an plan in a CREATED state.
djpaypal/models/billing.py
def activate(self): """ Activate an plan in a CREATED state. """ obj = self.find_paypal_object() if obj.state == enums.BillingPlanState.CREATED: success = obj.activate() if not success: raise PaypalApiError("Failed to activate plan: %r" % (obj.error)) # Resync the updated data to the database se...
def activate(self): """ Activate an plan in a CREATED state. """ obj = self.find_paypal_object() if obj.state == enums.BillingPlanState.CREATED: success = obj.activate() if not success: raise PaypalApiError("Failed to activate plan: %r" % (obj.error)) # Resync the updated data to the database se...
[ "Activate", "an", "plan", "in", "a", "CREATED", "state", "." ]
HearthSim/dj-paypal
python
https://github.com/HearthSim/dj-paypal/blob/867368f6068c2539e22d486eb7a6d2ecfb9485e0/djpaypal/models/billing.py#L76-L87
[ "def", "activate", "(", "self", ")", ":", "obj", "=", "self", ".", "find_paypal_object", "(", ")", "if", "obj", ".", "state", "==", "enums", ".", "BillingPlanState", ".", "CREATED", ":", "success", "=", "obj", ".", "activate", "(", ")", "if", "not", ...
867368f6068c2539e22d486eb7a6d2ecfb9485e0
valid
PreparedBillingAgreement.execute
Execute the PreparedBillingAgreement by creating and executing a matching BillingAgreement.
djpaypal/models/billing.py
def execute(self): """ Execute the PreparedBillingAgreement by creating and executing a matching BillingAgreement. """ # Save the execution time first. # If execute() fails, executed_at will be set, with no executed_agreement set. self.executed_at = now() self.save() with transaction.atomic(): ret...
def execute(self): """ Execute the PreparedBillingAgreement by creating and executing a matching BillingAgreement. """ # Save the execution time first. # If execute() fails, executed_at will be set, with no executed_agreement set. self.executed_at = now() self.save() with transaction.atomic(): ret...
[ "Execute", "the", "PreparedBillingAgreement", "by", "creating", "and", "executing", "a", "matching", "BillingAgreement", "." ]
HearthSim/dj-paypal
python
https://github.com/HearthSim/dj-paypal/blob/867368f6068c2539e22d486eb7a6d2ecfb9485e0/djpaypal/models/billing.py#L167-L184
[ "def", "execute", "(", "self", ")", ":", "# Save the execution time first.", "# If execute() fails, executed_at will be set, with no executed_agreement set.", "self", ".", "executed_at", "=", "now", "(", ")", "self", ".", "save", "(", ")", "with", "transaction", ".", "a...
867368f6068c2539e22d486eb7a6d2ecfb9485e0
valid
webhook_handler
Decorator that registers a function as a webhook handler. Usage examples: >>> # Hook a single event >>> @webhook_handler("payment.sale.completed") >>> def on_payment_received(event): >>> payment = event.get_resource() >>> print("Received payment:", payment) >>> # Multiple events supported >>> @webhoo...
djpaypal/models/webhooks.py
def webhook_handler(*event_types): """ Decorator that registers a function as a webhook handler. Usage examples: >>> # Hook a single event >>> @webhook_handler("payment.sale.completed") >>> def on_payment_received(event): >>> payment = event.get_resource() >>> print("Received payment:", payment) >>>...
def webhook_handler(*event_types): """ Decorator that registers a function as a webhook handler. Usage examples: >>> # Hook a single event >>> @webhook_handler("payment.sale.completed") >>> def on_payment_received(event): >>> payment = event.get_resource() >>> print("Received payment:", payment) >>>...
[ "Decorator", "that", "registers", "a", "function", "as", "a", "webhook", "handler", "." ]
HearthSim/dj-paypal
python
https://github.com/HearthSim/dj-paypal/blob/867368f6068c2539e22d486eb7a6d2ecfb9485e0/djpaypal/models/webhooks.py#L252-L298
[ "def", "webhook_handler", "(", "*", "event_types", ")", ":", "# First expand all wildcards and verify the event types are valid", "event_types_to_register", "=", "set", "(", ")", "for", "event_type", "in", "event_types", ":", "# Always convert to lowercase", "event_type", "="...
867368f6068c2539e22d486eb7a6d2ecfb9485e0
valid
WebhookEventTrigger.from_request
Create, validate and process a WebhookEventTrigger given a Django request object. The webhook_id parameter expects the ID of the Webhook that was triggered (defaults to settings.PAYPAL_WEBHOOK_ID). This is required for Webhook verification. The process is three-fold: 1. Create a WebhookEventTrigger object...
djpaypal/models/webhooks.py
def from_request(cls, request, webhook_id=PAYPAL_WEBHOOK_ID): """ Create, validate and process a WebhookEventTrigger given a Django request object. The webhook_id parameter expects the ID of the Webhook that was triggered (defaults to settings.PAYPAL_WEBHOOK_ID). This is required for Webhook verification. ...
def from_request(cls, request, webhook_id=PAYPAL_WEBHOOK_ID): """ Create, validate and process a WebhookEventTrigger given a Django request object. The webhook_id parameter expects the ID of the Webhook that was triggered (defaults to settings.PAYPAL_WEBHOOK_ID). This is required for Webhook verification. ...
[ "Create", "validate", "and", "process", "a", "WebhookEventTrigger", "given", "a", "Django", "request", "object", "." ]
HearthSim/dj-paypal
python
https://github.com/HearthSim/dj-paypal/blob/867368f6068c2539e22d486eb7a6d2ecfb9485e0/djpaypal/models/webhooks.py#L164-L201
[ "def", "from_request", "(", "cls", ",", "request", ",", "webhook_id", "=", "PAYPAL_WEBHOOK_ID", ")", ":", "headers", "=", "fix_django_headers", "(", "request", ".", "META", ")", "assert", "headers", "try", ":", "body", "=", "request", ".", "body", ".", "de...
867368f6068c2539e22d486eb7a6d2ecfb9485e0
valid
run
Check and/or create Django migrations. If --check is present in the arguments then migrations are checked only.
makemigrations.py
def run(*args): """ Check and/or create Django migrations. If --check is present in the arguments then migrations are checked only. """ if not settings.configured: settings.configure(**DEFAULT_SETTINGS) django.setup() parent = os.path.dirname(os.path.abspath(__file__)) sys.path.insert(0, parent) if "--ch...
def run(*args): """ Check and/or create Django migrations. If --check is present in the arguments then migrations are checked only. """ if not settings.configured: settings.configure(**DEFAULT_SETTINGS) django.setup() parent = os.path.dirname(os.path.abspath(__file__)) sys.path.insert(0, parent) if "--ch...
[ "Check", "and", "/", "or", "create", "Django", "migrations", "." ]
HearthSim/dj-paypal
python
https://github.com/HearthSim/dj-paypal/blob/867368f6068c2539e22d486eb7a6d2ecfb9485e0/makemigrations.py#L67-L84
[ "def", "run", "(", "*", "args", ")", ":", "if", "not", "settings", ".", "configured", ":", "settings", ".", "configure", "(", "*", "*", "DEFAULT_SETTINGS", ")", "django", ".", "setup", "(", ")", "parent", "=", "os", ".", "path", ".", "dirname", "(", ...
867368f6068c2539e22d486eb7a6d2ecfb9485e0
valid
check_paypal_api_key
Check that the Paypal API keys are configured correctly
djpaypal/checks.py
def check_paypal_api_key(app_configs=None, **kwargs): """Check that the Paypal API keys are configured correctly""" messages = [] mode = getattr(djpaypal_settings, "PAYPAL_MODE", None) if mode not in VALID_MODES: msg = "Invalid PAYPAL_MODE specified: {}.".format(repr(mode)) hint = "PAYPAL_MODE must be one of {...
def check_paypal_api_key(app_configs=None, **kwargs): """Check that the Paypal API keys are configured correctly""" messages = [] mode = getattr(djpaypal_settings, "PAYPAL_MODE", None) if mode not in VALID_MODES: msg = "Invalid PAYPAL_MODE specified: {}.".format(repr(mode)) hint = "PAYPAL_MODE must be one of {...
[ "Check", "that", "the", "Paypal", "API", "keys", "are", "configured", "correctly" ]
HearthSim/dj-paypal
python
https://github.com/HearthSim/dj-paypal/blob/867368f6068c2539e22d486eb7a6d2ecfb9485e0/djpaypal/checks.py#L10-L26
[ "def", "check_paypal_api_key", "(", "app_configs", "=", "None", ",", "*", "*", "kwargs", ")", ":", "messages", "=", "[", "]", "mode", "=", "getattr", "(", "djpaypal_settings", ",", "\"PAYPAL_MODE\"", ",", "None", ")", "if", "mode", "not", "in", "VALID_MODE...
867368f6068c2539e22d486eb7a6d2ecfb9485e0
valid
AsyncJsonWebsocketDemultiplexer._create_upstream_applications
Create the upstream applications.
channelsmultiplexer/demultiplexer.py
async def _create_upstream_applications(self): """ Create the upstream applications. """ loop = asyncio.get_event_loop() for steam_name, ApplicationsCls in self.applications.items(): application = ApplicationsCls(self.scope) upstream_queue = asyncio.Queue(...
async def _create_upstream_applications(self): """ Create the upstream applications. """ loop = asyncio.get_event_loop() for steam_name, ApplicationsCls in self.applications.items(): application = ApplicationsCls(self.scope) upstream_queue = asyncio.Queue(...
[ "Create", "the", "upstream", "applications", "." ]
hishnash/channelsmultiplexer
python
https://github.com/hishnash/channelsmultiplexer/blob/3fa08bf56def990b3513d25e403f85357487b373/channelsmultiplexer/demultiplexer.py#L58-L72
[ "async", "def", "_create_upstream_applications", "(", "self", ")", ":", "loop", "=", "asyncio", ".", "get_event_loop", "(", ")", "for", "steam_name", ",", "ApplicationsCls", "in", "self", ".", "applications", ".", "items", "(", ")", ":", "application", "=", ...
3fa08bf56def990b3513d25e403f85357487b373
valid
AsyncJsonWebsocketDemultiplexer.send_upstream
Send a message upstream to a de-multiplexed application. If stream_name is includes will send just to that upstream steam, if not included will send ot all upstream steams.
channelsmultiplexer/demultiplexer.py
async def send_upstream(self, message, stream_name=None): """ Send a message upstream to a de-multiplexed application. If stream_name is includes will send just to that upstream steam, if not included will send ot all upstream steams. """ if stream_name is None: ...
async def send_upstream(self, message, stream_name=None): """ Send a message upstream to a de-multiplexed application. If stream_name is includes will send just to that upstream steam, if not included will send ot all upstream steams. """ if stream_name is None: ...
[ "Send", "a", "message", "upstream", "to", "a", "de", "-", "multiplexed", "application", "." ]
hishnash/channelsmultiplexer
python
https://github.com/hishnash/channelsmultiplexer/blob/3fa08bf56def990b3513d25e403f85357487b373/channelsmultiplexer/demultiplexer.py#L74-L88
[ "async", "def", "send_upstream", "(", "self", ",", "message", ",", "stream_name", "=", "None", ")", ":", "if", "stream_name", "is", "None", ":", "for", "steam_queue", "in", "self", ".", "application_streams", ".", "values", "(", ")", ":", "await", "steam_q...
3fa08bf56def990b3513d25e403f85357487b373
valid
AsyncJsonWebsocketDemultiplexer.dispatch_downstream
Handle a downstream message coming from an upstream steam. if there is not handling method set for this method type it will propagate the message further downstream. This is called as part of the co-routine of an upstream steam, not the same loop as used for upstream messages in the de-multipl...
channelsmultiplexer/demultiplexer.py
async def dispatch_downstream(self, message, steam_name): """ Handle a downstream message coming from an upstream steam. if there is not handling method set for this method type it will propagate the message further downstream. This is called as part of the co-routine of an upstream st...
async def dispatch_downstream(self, message, steam_name): """ Handle a downstream message coming from an upstream steam. if there is not handling method set for this method type it will propagate the message further downstream. This is called as part of the co-routine of an upstream st...
[ "Handle", "a", "downstream", "message", "coming", "from", "an", "upstream", "steam", "." ]
hishnash/channelsmultiplexer
python
https://github.com/hishnash/channelsmultiplexer/blob/3fa08bf56def990b3513d25e403f85357487b373/channelsmultiplexer/demultiplexer.py#L90-L104
[ "async", "def", "dispatch_downstream", "(", "self", ",", "message", ",", "steam_name", ")", ":", "handler", "=", "getattr", "(", "self", ",", "get_handler_name", "(", "message", ")", ",", "None", ")", "if", "handler", ":", "await", "handler", "(", "message...
3fa08bf56def990b3513d25e403f85357487b373
valid
AsyncJsonWebsocketDemultiplexer.receive_json
Rout the message down the correct stream.
channelsmultiplexer/demultiplexer.py
async def receive_json(self, content, **kwargs): """ Rout the message down the correct stream. """ # Check the frame looks good if isinstance(content, dict) and "stream" in content and "payload" in content: # Match it to a channel steam_name = content["str...
async def receive_json(self, content, **kwargs): """ Rout the message down the correct stream. """ # Check the frame looks good if isinstance(content, dict) and "stream" in content and "payload" in content: # Match it to a channel steam_name = content["str...
[ "Rout", "the", "message", "down", "the", "correct", "stream", "." ]
hishnash/channelsmultiplexer
python
https://github.com/hishnash/channelsmultiplexer/blob/3fa08bf56def990b3513d25e403f85357487b373/channelsmultiplexer/demultiplexer.py#L111-L133
[ "async", "def", "receive_json", "(", "self", ",", "content", ",", "*", "*", "kwargs", ")", ":", "# Check the frame looks good", "if", "isinstance", "(", "content", ",", "dict", ")", "and", "\"stream\"", "in", "content", "and", "\"payload\"", "in", "content", ...
3fa08bf56def990b3513d25e403f85357487b373
valid
AsyncJsonWebsocketDemultiplexer.websocket_disconnect
Handle the disconnect message. This is propagated to all upstream applications.
channelsmultiplexer/demultiplexer.py
async def websocket_disconnect(self, message): """ Handle the disconnect message. This is propagated to all upstream applications. """ # set this flag so as to ensure we don't send a downstream `websocket.close` message due to all # child applications closing. se...
async def websocket_disconnect(self, message): """ Handle the disconnect message. This is propagated to all upstream applications. """ # set this flag so as to ensure we don't send a downstream `websocket.close` message due to all # child applications closing. se...
[ "Handle", "the", "disconnect", "message", "." ]
hishnash/channelsmultiplexer
python
https://github.com/hishnash/channelsmultiplexer/blob/3fa08bf56def990b3513d25e403f85357487b373/channelsmultiplexer/demultiplexer.py#L135-L146
[ "async", "def", "websocket_disconnect", "(", "self", ",", "message", ")", ":", "# set this flag so as to ensure we don't send a downstream `websocket.close` message due to all", "# child applications closing.", "self", ".", "closing", "=", "True", "# inform all children", "await", ...
3fa08bf56def990b3513d25e403f85357487b373
valid
AsyncJsonWebsocketDemultiplexer.disconnect
default is to wait for the child applications to close.
channelsmultiplexer/demultiplexer.py
async def disconnect(self, code): """ default is to wait for the child applications to close. """ try: await asyncio.wait( self.application_futures.values(), return_when=asyncio.ALL_COMPLETED, timeout=self.application_close_time...
async def disconnect(self, code): """ default is to wait for the child applications to close. """ try: await asyncio.wait( self.application_futures.values(), return_when=asyncio.ALL_COMPLETED, timeout=self.application_close_time...
[ "default", "is", "to", "wait", "for", "the", "child", "applications", "to", "close", "." ]
hishnash/channelsmultiplexer
python
https://github.com/hishnash/channelsmultiplexer/blob/3fa08bf56def990b3513d25e403f85357487b373/channelsmultiplexer/demultiplexer.py#L148-L159
[ "async", "def", "disconnect", "(", "self", ",", "code", ")", ":", "try", ":", "await", "asyncio", ".", "wait", "(", "self", ".", "application_futures", ".", "values", "(", ")", ",", "return_when", "=", "asyncio", ".", "ALL_COMPLETED", ",", "timeout", "="...
3fa08bf56def990b3513d25e403f85357487b373
valid
AsyncJsonWebsocketDemultiplexer.websocket_send
Capture downstream websocket.send messages from the upstream applications.
channelsmultiplexer/demultiplexer.py
async def websocket_send(self, message, stream_name): """ Capture downstream websocket.send messages from the upstream applications. """ text = message.get("text") # todo what to do on binary! json = await self.decode_json(text) data = { "stream": stre...
async def websocket_send(self, message, stream_name): """ Capture downstream websocket.send messages from the upstream applications. """ text = message.get("text") # todo what to do on binary! json = await self.decode_json(text) data = { "stream": stre...
[ "Capture", "downstream", "websocket", ".", "send", "messages", "from", "the", "upstream", "applications", "." ]
hishnash/channelsmultiplexer
python
https://github.com/hishnash/channelsmultiplexer/blob/3fa08bf56def990b3513d25e403f85357487b373/channelsmultiplexer/demultiplexer.py#L163-L174
[ "async", "def", "websocket_send", "(", "self", ",", "message", ",", "stream_name", ")", ":", "text", "=", "message", ".", "get", "(", "\"text\"", ")", "# todo what to do on binary!", "json", "=", "await", "self", ".", "decode_json", "(", "text", ")", "data",...
3fa08bf56def990b3513d25e403f85357487b373
valid
AsyncJsonWebsocketDemultiplexer.websocket_accept
Intercept downstream `websocket.accept` message and thus allow this upsteam application to accept websocket frames.
channelsmultiplexer/demultiplexer.py
async def websocket_accept(self, message, stream_name): """ Intercept downstream `websocket.accept` message and thus allow this upsteam application to accept websocket frames. """ is_first = not self.applications_accepting_frames self.applications_accepting_frames.add(str...
async def websocket_accept(self, message, stream_name): """ Intercept downstream `websocket.accept` message and thus allow this upsteam application to accept websocket frames. """ is_first = not self.applications_accepting_frames self.applications_accepting_frames.add(str...
[ "Intercept", "downstream", "websocket", ".", "accept", "message", "and", "thus", "allow", "this", "upsteam", "application", "to", "accept", "websocket", "frames", "." ]
hishnash/channelsmultiplexer
python
https://github.com/hishnash/channelsmultiplexer/blob/3fa08bf56def990b3513d25e403f85357487b373/channelsmultiplexer/demultiplexer.py#L176-L185
[ "async", "def", "websocket_accept", "(", "self", ",", "message", ",", "stream_name", ")", ":", "is_first", "=", "not", "self", ".", "applications_accepting_frames", "self", ".", "applications_accepting_frames", ".", "add", "(", "stream_name", ")", "# accept the conn...
3fa08bf56def990b3513d25e403f85357487b373
valid
AsyncJsonWebsocketDemultiplexer.websocket_close
Handle downstream `websocket.close` message. Will disconnect this upstream application from receiving any new frames. If there are not more upstream applications accepting messages it will then call `close`.
channelsmultiplexer/demultiplexer.py
async def websocket_close(self, message, stream_name): """ Handle downstream `websocket.close` message. Will disconnect this upstream application from receiving any new frames. If there are not more upstream applications accepting messages it will then call `close`. """ ...
async def websocket_close(self, message, stream_name): """ Handle downstream `websocket.close` message. Will disconnect this upstream application from receiving any new frames. If there are not more upstream applications accepting messages it will then call `close`. """ ...
[ "Handle", "downstream", "websocket", ".", "close", "message", "." ]
hishnash/channelsmultiplexer
python
https://github.com/hishnash/channelsmultiplexer/blob/3fa08bf56def990b3513d25e403f85357487b373/channelsmultiplexer/demultiplexer.py#L187-L205
[ "async", "def", "websocket_close", "(", "self", ",", "message", ",", "stream_name", ")", ":", "if", "stream_name", "in", "self", ".", "applications_accepting_frames", ":", "# remove from set of upsteams steams than can receive new messages", "self", ".", "applications_accep...
3fa08bf56def990b3513d25e403f85357487b373
valid
base_interpolation.update
update interpolation data :param list(float) x_list: x values :param list(float) y_list: y values
dcf/interpolation.py
def update(self, x_list=list(), y_list=list()): """ update interpolation data :param list(float) x_list: x values :param list(float) y_list: y values """ if not y_list: for x in x_list: if x in self.x_list: i = self.x_list.i...
def update(self, x_list=list(), y_list=list()): """ update interpolation data :param list(float) x_list: x values :param list(float) y_list: y values """ if not y_list: for x in x_list: if x in self.x_list: i = self.x_list.i...
[ "update", "interpolation", "data", ":", "param", "list", "(", "float", ")", "x_list", ":", "x", "values", ":", "param", "list", "(", "float", ")", "y_list", ":", "y", "values" ]
pbrisk/dcf
python
https://github.com/pbrisk/dcf/blob/c6030f733742efb6894d9bced5f0a0efe8e84d9f/dcf/interpolation.py#L35-L54
[ "def", "update", "(", "self", ",", "x_list", "=", "list", "(", ")", ",", "y_list", "=", "list", "(", ")", ")", ":", "if", "not", "y_list", ":", "for", "x", "in", "x_list", ":", "if", "x", "in", "self", ".", "x_list", ":", "i", "=", "self", "....
c6030f733742efb6894d9bced5f0a0efe8e84d9f
valid
spline.get_interval
finds interval of the interpolation in which x lies. :param x: :param intervals: the interpolation intervals :return:
dcf/interpolation.py
def get_interval(x, intervals): """ finds interval of the interpolation in which x lies. :param x: :param intervals: the interpolation intervals :return: """ n = len(intervals) if n < 2: return intervals[0] n2 = n / 2 if x < int...
def get_interval(x, intervals): """ finds interval of the interpolation in which x lies. :param x: :param intervals: the interpolation intervals :return: """ n = len(intervals) if n < 2: return intervals[0] n2 = n / 2 if x < int...
[ "finds", "interval", "of", "the", "interpolation", "in", "which", "x", "lies", ".", ":", "param", "x", ":", ":", "param", "intervals", ":", "the", "interpolation", "intervals", ":", "return", ":" ]
pbrisk/dcf
python
https://github.com/pbrisk/dcf/blob/c6030f733742efb6894d9bced5f0a0efe8e84d9f/dcf/interpolation.py#L186-L200
[ "def", "get_interval", "(", "x", ",", "intervals", ")", ":", "n", "=", "len", "(", "intervals", ")", "if", "n", "<", "2", ":", "return", "intervals", "[", "0", "]", "n2", "=", "n", "/", "2", "if", "x", "<", "intervals", "[", "n2", "]", "[", "...
c6030f733742efb6894d9bced5f0a0efe8e84d9f
valid
spline.set_interpolation_coefficients
computes the coefficients for the single polynomials of the spline.
dcf/interpolation.py
def set_interpolation_coefficients(self): """ computes the coefficients for the single polynomials of the spline. """ left_boundary_slope = 0 right_boundary_slope = 0 if isinstance(self.boundary_condition, tuple): left_boundary_slope = self.boundary_conditio...
def set_interpolation_coefficients(self): """ computes the coefficients for the single polynomials of the spline. """ left_boundary_slope = 0 right_boundary_slope = 0 if isinstance(self.boundary_condition, tuple): left_boundary_slope = self.boundary_conditio...
[ "computes", "the", "coefficients", "for", "the", "single", "polynomials", "of", "the", "spline", "." ]
pbrisk/dcf
python
https://github.com/pbrisk/dcf/blob/c6030f733742efb6894d9bced5f0a0efe8e84d9f/dcf/interpolation.py#L202-L271
[ "def", "set_interpolation_coefficients", "(", "self", ")", ":", "left_boundary_slope", "=", "0", "right_boundary_slope", "=", "0", "if", "isinstance", "(", "self", ".", "boundary_condition", ",", "tuple", ")", ":", "left_boundary_slope", "=", "self", ".", "boundar...
c6030f733742efb6894d9bced5f0a0efe8e84d9f
valid
FxCurve.cast
creator method to build FxCurve :param float fx_spot: fx spot rate :param RateCurve domestic_curve: domestic discount curve :param RateCurve foreign_curve: foreign discount curve :return:
dcf/fx.py
def cast(cls, fx_spot, domestic_curve=None, foreign_curve=None): """ creator method to build FxCurve :param float fx_spot: fx spot rate :param RateCurve domestic_curve: domestic discount curve :param RateCurve foreign_curve: foreign discount curve :return: """ ...
def cast(cls, fx_spot, domestic_curve=None, foreign_curve=None): """ creator method to build FxCurve :param float fx_spot: fx spot rate :param RateCurve domestic_curve: domestic discount curve :param RateCurve foreign_curve: foreign discount curve :return: """ ...
[ "creator", "method", "to", "build", "FxCurve" ]
pbrisk/dcf
python
https://github.com/pbrisk/dcf/blob/c6030f733742efb6894d9bced5f0a0efe8e84d9f/dcf/fx.py#L22-L32
[ "def", "cast", "(", "cls", ",", "fx_spot", ",", "domestic_curve", "=", "None", ",", "foreign_curve", "=", "None", ")", ":", "assert", "domestic_curve", ".", "origin", "==", "foreign_curve", ".", "origin", "return", "cls", "(", "fx_spot", ",", "domestic_curve...
c6030f733742efb6894d9bced5f0a0efe8e84d9f
valid
FxContainer.add
adds contents to FxShelf. If curve is FxCurve or FxDict, spot should turn curve.currency into self.currency, else spot should turn currency into self.currency by N in EUR * spot = N in USD for currency = EUR and self.currency = USD
dcf/fx.py
def add(self, foreign_currency, foreign_curve=None, fx_spot=1.0): """ adds contents to FxShelf. If curve is FxCurve or FxDict, spot should turn curve.currency into self.currency, else spot should turn currency into self.currency by N in EUR * spot = N in USD for currency = EUR an...
def add(self, foreign_currency, foreign_curve=None, fx_spot=1.0): """ adds contents to FxShelf. If curve is FxCurve or FxDict, spot should turn curve.currency into self.currency, else spot should turn currency into self.currency by N in EUR * spot = N in USD for currency = EUR an...
[ "adds", "contents", "to", "FxShelf", ".", "If", "curve", "is", "FxCurve", "or", "FxDict", "spot", "should", "turn", "curve", ".", "currency", "into", "self", ".", "currency", "else", "spot", "should", "turn", "currency", "into", "self", ".", "currency", "b...
pbrisk/dcf
python
https://github.com/pbrisk/dcf/blob/c6030f733742efb6894d9bced5f0a0efe8e84d9f/dcf/fx.py#L120-L148
[ "def", "add", "(", "self", ",", "foreign_currency", ",", "foreign_curve", "=", "None", ",", "fx_spot", "=", "1.0", ")", ":", "assert", "isinstance", "(", "foreign_currency", ",", "type", "(", "self", ".", "currency", ")", ")", "assert", "isinstance", "(", ...
c6030f733742efb6894d9bced5f0a0efe8e84d9f
valid
_frange
_frange range like function for float inputs :param start: :type start: :param stop: :type stop: :param step: :type step: :return: :rtype:
dcf/cashflow.py
def _frange(start, stop=None, step=None): """ _frange range like function for float inputs :param start: :type start: :param stop: :type stop: :param step: :type step: :return: :rtype: """ if stop is None: stop = start start = 0.0 if step is None: ...
def _frange(start, stop=None, step=None): """ _frange range like function for float inputs :param start: :type start: :param stop: :type stop: :param step: :type step: :return: :rtype: """ if stop is None: stop = start start = 0.0 if step is None: ...
[ "_frange", "range", "like", "function", "for", "float", "inputs", ":", "param", "start", ":", ":", "type", "start", ":", ":", "param", "stop", ":", ":", "type", "stop", ":", ":", "param", "step", ":", ":", "type", "step", ":", ":", "return", ":", "...
pbrisk/dcf
python
https://github.com/pbrisk/dcf/blob/c6030f733742efb6894d9bced5f0a0efe8e84d9f/dcf/cashflow.py#L22-L42
[ "def", "_frange", "(", "start", ",", "stop", "=", "None", ",", "step", "=", "None", ")", ":", "if", "stop", "is", "None", ":", "stop", "=", "start", "start", "=", "0.0", "if", "step", "is", "None", ":", "step", "=", "1.0", "r", "=", "start", "w...
c6030f733742efb6894d9bced5f0a0efe8e84d9f
valid
MultiCashFlowList.interest_accrued
interest_accrued :param valuation_date: :type valuation_date: :return: :rtype:
dcf/cashflow.py
def interest_accrued(self, valuation_date): """ interest_accrued :param valuation_date: :type valuation_date: :return: :rtype: """ return sum([l.interest_accrued(valuation_date) for l in self.legs if hasattr(l, 'interest_accrued')])
def interest_accrued(self, valuation_date): """ interest_accrued :param valuation_date: :type valuation_date: :return: :rtype: """ return sum([l.interest_accrued(valuation_date) for l in self.legs if hasattr(l, 'interest_accrued')])
[ "interest_accrued", ":", "param", "valuation_date", ":", ":", "type", "valuation_date", ":", ":", "return", ":", ":", "rtype", ":" ]
pbrisk/dcf
python
https://github.com/pbrisk/dcf/blob/c6030f733742efb6894d9bced5f0a0efe8e84d9f/dcf/cashflow.py#L155-L163
[ "def", "interest_accrued", "(", "self", ",", "valuation_date", ")", ":", "return", "sum", "(", "[", "l", ".", "interest_accrued", "(", "valuation_date", ")", "for", "l", "in", "self", ".", "legs", "if", "hasattr", "(", "l", ",", "'interest_accrued'", ")", ...
c6030f733742efb6894d9bced5f0a0efe8e84d9f
valid
retry
Decorator to retry a function 'max_retries' amount of times :param tuple exceptions: Exceptions to be caught for retries :param int interval: Interval between retries in seconds :param int max_retries: Maximum number of retries to have, if set to -1 the decorator will loop forever :param functi...
retry.py
def retry( exceptions=(Exception,), interval=0, max_retries=10, success=None, timeout=-1): """Decorator to retry a function 'max_retries' amount of times :param tuple exceptions: Exceptions to be caught for retries :param int interval: Interval between retries in seconds :param int max_...
def retry( exceptions=(Exception,), interval=0, max_retries=10, success=None, timeout=-1): """Decorator to retry a function 'max_retries' amount of times :param tuple exceptions: Exceptions to be caught for retries :param int interval: Interval between retries in seconds :param int max_...
[ "Decorator", "to", "retry", "a", "function", "max_retries", "amount", "of", "times" ]
seemethere/retry.it
python
https://github.com/seemethere/retry.it/blob/0bb8e2f2e926d8b4f72815ca2ee6e3bf72980a77/retry.py#L29-L107
[ "def", "retry", "(", "exceptions", "=", "(", "Exception", ",", ")", ",", "interval", "=", "0", ",", "max_retries", "=", "10", ",", "success", "=", "None", ",", "timeout", "=", "-", "1", ")", ":", "if", "not", "exceptions", "and", "success", "is", "...
0bb8e2f2e926d8b4f72815ca2ee6e3bf72980a77
valid
get_secrets
Taken from https://github.com/tokland/youtube-upload/blob/master/youtube_upload/main.py Get the first existing filename of relative_path seeking on prefixes directories.
meleeuploader/youtube.py
def get_secrets(prefixes, relative_paths): """ Taken from https://github.com/tokland/youtube-upload/blob/master/youtube_upload/main.py Get the first existing filename of relative_path seeking on prefixes directories. """ try: return os.path.join(sys._MEIPASS, relative_paths[-1]) except E...
def get_secrets(prefixes, relative_paths): """ Taken from https://github.com/tokland/youtube-upload/blob/master/youtube_upload/main.py Get the first existing filename of relative_path seeking on prefixes directories. """ try: return os.path.join(sys._MEIPASS, relative_paths[-1]) except E...
[ "Taken", "from", "https", ":", "//", "github", ".", "com", "/", "tokland", "/", "youtube", "-", "upload", "/", "blob", "/", "master", "/", "youtube_upload", "/", "main", ".", "py", "Get", "the", "first", "existing", "filename", "of", "relative_path", "se...
NikhilNarayana/Melee-YouTube-Uploader
python
https://github.com/NikhilNarayana/Melee-YouTube-Uploader/blob/6325aa5594e90ce1bd4a26a42d51fd2be28eb7bc/meleeuploader/youtube.py#L152-L166
[ "def", "get_secrets", "(", "prefixes", ",", "relative_paths", ")", ":", "try", ":", "return", "os", ".", "path", ".", "join", "(", "sys", ".", "_MEIPASS", ",", "relative_paths", "[", "-", "1", "]", ")", "except", "Exception", ":", "for", "prefix", "in"...
6325aa5594e90ce1bd4a26a42d51fd2be28eb7bc
valid
MeleeUploader.__button_action
Button action event
meleeuploader/forms.py
def __button_action(self, data=None): """Button action event""" if any(not x for x in (self._ename.value, self._p1.value, self._p2.value, self._file.value)): print("Missing one of the required fields (event name, player names, file name)") return self.__p1chars = [] ...
def __button_action(self, data=None): """Button action event""" if any(not x for x in (self._ename.value, self._p1.value, self._p2.value, self._file.value)): print("Missing one of the required fields (event name, player names, file name)") return self.__p1chars = [] ...
[ "Button", "action", "event" ]
NikhilNarayana/Melee-YouTube-Uploader
python
https://github.com/NikhilNarayana/Melee-YouTube-Uploader/blob/6325aa5594e90ce1bd4a26a42d51fd2be28eb7bc/meleeuploader/forms.py#L219-L264
[ "def", "__button_action", "(", "self", ",", "data", "=", "None", ")", ":", "if", "any", "(", "not", "x", "for", "x", "in", "(", "self", ".", "_ename", ".", "value", ",", "self", ".", "_p1", ".", "value", ",", "self", ".", "_p2", ".", "value", "...
6325aa5594e90ce1bd4a26a42d51fd2be28eb7bc
valid
multiglob_compile
Generate a single "A or B or C" regex from a list of shell globs. :param globs: Patterns to be processed by :mod:`fnmatch`. :type globs: iterable of :class:`~__builtins__.str` :param prefix: If ``True``, then :meth:`~re.RegexObject.match` will perform prefix matching rather than exact string match...
fastdupes.py
def multiglob_compile(globs, prefix=False): """Generate a single "A or B or C" regex from a list of shell globs. :param globs: Patterns to be processed by :mod:`fnmatch`. :type globs: iterable of :class:`~__builtins__.str` :param prefix: If ``True``, then :meth:`~re.RegexObject.match` will per...
def multiglob_compile(globs, prefix=False): """Generate a single "A or B or C" regex from a list of shell globs. :param globs: Patterns to be processed by :mod:`fnmatch`. :type globs: iterable of :class:`~__builtins__.str` :param prefix: If ``True``, then :meth:`~re.RegexObject.match` will per...
[ "Generate", "a", "single", "A", "or", "B", "or", "C", "regex", "from", "a", "list", "of", "shell", "globs", "." ]
ssokolow/fastdupes
python
https://github.com/ssokolow/fastdupes/blob/0334545885445834307c075a445fba9fe6f0c9e7/fastdupes.py#L66-L83
[ "def", "multiglob_compile", "(", "globs", ",", "prefix", "=", "False", ")", ":", "if", "not", "globs", ":", "# An empty globs list should only match empty strings", "return", "re", ".", "compile", "(", "'^$'", ")", "elif", "prefix", ":", "globs", "=", "[", "x"...
0334545885445834307c075a445fba9fe6f0c9e7
valid
hashFile
Generate a hash from a potentially long file. Digesting will obey :const:`CHUNK_SIZE` to conserve memory. :param handle: A file-like object or path to hash from. :param want_hex: If ``True``, returned hash will be hex-encoded. :type want_hex: :class:`~__builtins__.bool` :param limit: Maximum numbe...
fastdupes.py
def hashFile(handle, want_hex=False, limit=None, chunk_size=CHUNK_SIZE): """Generate a hash from a potentially long file. Digesting will obey :const:`CHUNK_SIZE` to conserve memory. :param handle: A file-like object or path to hash from. :param want_hex: If ``True``, returned hash will be hex-encoded. ...
def hashFile(handle, want_hex=False, limit=None, chunk_size=CHUNK_SIZE): """Generate a hash from a potentially long file. Digesting will obey :const:`CHUNK_SIZE` to conserve memory. :param handle: A file-like object or path to hash from. :param want_hex: If ``True``, returned hash will be hex-encoded. ...
[ "Generate", "a", "hash", "from", "a", "potentially", "long", "file", ".", "Digesting", "will", "obey", ":", "const", ":", "CHUNK_SIZE", "to", "conserve", "memory", "." ]
ssokolow/fastdupes
python
https://github.com/ssokolow/fastdupes/blob/0334545885445834307c075a445fba9fe6f0c9e7/fastdupes.py#L85-L122
[ "def", "hashFile", "(", "handle", ",", "want_hex", "=", "False", ",", "limit", "=", "None", ",", "chunk_size", "=", "CHUNK_SIZE", ")", ":", "fhash", ",", "read", "=", "hashlib", ".", "sha1", "(", ")", ",", "0", "if", "isinstance", "(", "handle", ",",...
0334545885445834307c075a445fba9fe6f0c9e7
valid
getPaths
Recursively walk a set of paths and return a listing of contained files. :param roots: Relative or absolute paths to files or folders. :type roots: :class:`~__builtins__.list` of :class:`~__builtins__.str` :param ignores: A list of :py:mod:`fnmatch` globs to avoid walking and omit from results ...
fastdupes.py
def getPaths(roots, ignores=None): """ Recursively walk a set of paths and return a listing of contained files. :param roots: Relative or absolute paths to files or folders. :type roots: :class:`~__builtins__.list` of :class:`~__builtins__.str` :param ignores: A list of :py:mod:`fnmatch` globs to ...
def getPaths(roots, ignores=None): """ Recursively walk a set of paths and return a listing of contained files. :param roots: Relative or absolute paths to files or folders. :type roots: :class:`~__builtins__.list` of :class:`~__builtins__.str` :param ignores: A list of :py:mod:`fnmatch` globs to ...
[ "Recursively", "walk", "a", "set", "of", "paths", "and", "return", "a", "listing", "of", "contained", "files", "." ]
ssokolow/fastdupes
python
https://github.com/ssokolow/fastdupes/blob/0334545885445834307c075a445fba9fe6f0c9e7/fastdupes.py#L162-L215
[ "def", "getPaths", "(", "roots", ",", "ignores", "=", "None", ")", ":", "paths", ",", "count", ",", "ignores", "=", "[", "]", ",", "0", ",", "ignores", "or", "[", "]", "# Prepare the ignores list for most efficient use", "ignore_re", "=", "multiglob_compile", ...
0334545885445834307c075a445fba9fe6f0c9e7
valid
groupBy
Subdivide groups of paths according to a function. :param groups_in: Grouped sets of paths. :type groups_in: :class:`~__builtins__.dict` of iterables :param classifier: Function to group a list of paths by some attribute. :type classifier: ``function(list, *args, **kwargs) -> str`` :param fun_des...
fastdupes.py
def groupBy(groups_in, classifier, fun_desc='?', keep_uniques=False, *args, **kwargs): """Subdivide groups of paths according to a function. :param groups_in: Grouped sets of paths. :type groups_in: :class:`~__builtins__.dict` of iterables :param classifier: Function to group a list of pat...
def groupBy(groups_in, classifier, fun_desc='?', keep_uniques=False, *args, **kwargs): """Subdivide groups of paths according to a function. :param groups_in: Grouped sets of paths. :type groups_in: :class:`~__builtins__.dict` of iterables :param classifier: Function to group a list of pat...
[ "Subdivide", "groups", "of", "paths", "according", "to", "a", "function", "." ]
ssokolow/fastdupes
python
https://github.com/ssokolow/fastdupes/blob/0334545885445834307c075a445fba9fe6f0c9e7/fastdupes.py#L217-L263
[ "def", "groupBy", "(", "groups_in", ",", "classifier", ",", "fun_desc", "=", "'?'", ",", "keep_uniques", "=", "False", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "groups", ",", "count", ",", "group_count", "=", "{", "}", ",", "0", ",", "l...
0334545885445834307c075a445fba9fe6f0c9e7
valid
groupify
Decorator to convert a function which takes a single value and returns a key into one which takes a list of values and returns a dict of key-group mappings. :param function: A function which takes a value and returns a hash key. :type function: ``function(value) -> key`` :rtype: .. parsed-...
fastdupes.py
def groupify(function): """Decorator to convert a function which takes a single value and returns a key into one which takes a list of values and returns a dict of key-group mappings. :param function: A function which takes a value and returns a hash key. :type function: ``function(value) -> key`` ...
def groupify(function): """Decorator to convert a function which takes a single value and returns a key into one which takes a list of values and returns a dict of key-group mappings. :param function: A function which takes a value and returns a hash key. :type function: ``function(value) -> key`` ...
[ "Decorator", "to", "convert", "a", "function", "which", "takes", "a", "single", "value", "and", "returns", "a", "key", "into", "one", "which", "takes", "a", "list", "of", "values", "and", "returns", "a", "dict", "of", "key", "-", "group", "mappings", "."...
ssokolow/fastdupes
python
https://github.com/ssokolow/fastdupes/blob/0334545885445834307c075a445fba9fe6f0c9e7/fastdupes.py#L265-L289
[ "def", "groupify", "(", "function", ")", ":", "@", "wraps", "(", "function", ")", "def", "wrapper", "(", "paths", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "# pylint: disable=missing-docstring", "groups", "=", "{", "}", "for", "path", "in", ...
0334545885445834307c075a445fba9fe6f0c9e7
valid
sizeClassifier
Sort a file into a group based on on-disk size. :param paths: See :func:`fastdupes.groupify` :param min_size: Files smaller than this size (in bytes) will be ignored. :type min_size: :class:`__builtins__.int` :returns: See :func:`fastdupes.groupify` .. todo:: Rework the calling of :func:`~os.sta...
fastdupes.py
def sizeClassifier(path, min_size=DEFAULTS['min_size']): """Sort a file into a group based on on-disk size. :param paths: See :func:`fastdupes.groupify` :param min_size: Files smaller than this size (in bytes) will be ignored. :type min_size: :class:`__builtins__.int` :returns: See :func:`fastdup...
def sizeClassifier(path, min_size=DEFAULTS['min_size']): """Sort a file into a group based on on-disk size. :param paths: See :func:`fastdupes.groupify` :param min_size: Files smaller than this size (in bytes) will be ignored. :type min_size: :class:`__builtins__.int` :returns: See :func:`fastdup...
[ "Sort", "a", "file", "into", "a", "group", "based", "on", "on", "-", "disk", "size", "." ]
ssokolow/fastdupes
python
https://github.com/ssokolow/fastdupes/blob/0334545885445834307c075a445fba9fe6f0c9e7/fastdupes.py#L292-L313
[ "def", "sizeClassifier", "(", "path", ",", "min_size", "=", "DEFAULTS", "[", "'min_size'", "]", ")", ":", "filestat", "=", "_stat", "(", "path", ")", "if", "stat", ".", "S_ISLNK", "(", "filestat", ".", "st_mode", ")", ":", "return", "# Skip symlinks.", "...
0334545885445834307c075a445fba9fe6f0c9e7
valid
groupByContent
Byte-for-byte comparison on an arbitrary number of files in parallel. This operates by opening all files in parallel and comparing chunk-by-chunk. This has the following implications: - Reads the same total amount of data as hash comparison. - Performs a *lot* of disk seeks. (Best suited for S...
fastdupes.py
def groupByContent(paths): """Byte-for-byte comparison on an arbitrary number of files in parallel. This operates by opening all files in parallel and comparing chunk-by-chunk. This has the following implications: - Reads the same total amount of data as hash comparison. - Performs a *lot*...
def groupByContent(paths): """Byte-for-byte comparison on an arbitrary number of files in parallel. This operates by opening all files in parallel and comparing chunk-by-chunk. This has the following implications: - Reads the same total amount of data as hash comparison. - Performs a *lot*...
[ "Byte", "-", "for", "-", "byte", "comparison", "on", "an", "arbitrary", "number", "of", "files", "in", "parallel", "." ]
ssokolow/fastdupes
python
https://github.com/ssokolow/fastdupes/blob/0334545885445834307c075a445fba9fe6f0c9e7/fastdupes.py#L329-L374
[ "def", "groupByContent", "(", "paths", ")", ":", "handles", ",", "results", "=", "[", "]", ",", "[", "]", "# Silently ignore files we don't have permission to read.", "hList", "=", "[", "]", "for", "path", "in", "paths", ":", "try", ":", "hList", ".", "appen...
0334545885445834307c075a445fba9fe6f0c9e7
valid
compareChunks
Group a list of file handles based on equality of the next chunk of data read from them. :param handles: A list of open handles for file-like objects with otentially-identical contents. :param chunk_size: The amount of data to read from each handle every time this function is called. :...
fastdupes.py
def compareChunks(handles, chunk_size=CHUNK_SIZE): """Group a list of file handles based on equality of the next chunk of data read from them. :param handles: A list of open handles for file-like objects with otentially-identical contents. :param chunk_size: The amount of data to read from each...
def compareChunks(handles, chunk_size=CHUNK_SIZE): """Group a list of file handles based on equality of the next chunk of data read from them. :param handles: A list of open handles for file-like objects with otentially-identical contents. :param chunk_size: The amount of data to read from each...
[ "Group", "a", "list", "of", "file", "handles", "based", "on", "equality", "of", "the", "next", "chunk", "of", "data", "read", "from", "them", "." ]
ssokolow/fastdupes
python
https://github.com/ssokolow/fastdupes/blob/0334545885445834307c075a445fba9fe6f0c9e7/fastdupes.py#L376-L417
[ "def", "compareChunks", "(", "handles", ",", "chunk_size", "=", "CHUNK_SIZE", ")", ":", "chunks", "=", "[", "(", "path", ",", "fh", ",", "fh", ".", "read", "(", "chunk_size", ")", ")", "for", "path", ",", "fh", ",", "_", "in", "handles", "]", "more...
0334545885445834307c075a445fba9fe6f0c9e7
valid
pruneUI
Display a list of files and prompt for ones to be kept. The user may enter ``all`` or one or more numbers separated by spaces and/or commas. .. note:: It is impossible to accidentally choose to keep none of the displayed files. :param dupeList: A list duplicate file paths :param mainPos: ...
fastdupes.py
def pruneUI(dupeList, mainPos=1, mainLen=1): """Display a list of files and prompt for ones to be kept. The user may enter ``all`` or one or more numbers separated by spaces and/or commas. .. note:: It is impossible to accidentally choose to keep none of the displayed files. :param dupeLi...
def pruneUI(dupeList, mainPos=1, mainLen=1): """Display a list of files and prompt for ones to be kept. The user may enter ``all`` or one or more numbers separated by spaces and/or commas. .. note:: It is impossible to accidentally choose to keep none of the displayed files. :param dupeLi...
[ "Display", "a", "list", "of", "files", "and", "prompt", "for", "ones", "to", "be", "kept", "." ]
ssokolow/fastdupes
python
https://github.com/ssokolow/fastdupes/blob/0334545885445834307c075a445fba9fe6f0c9e7/fastdupes.py#L422-L458
[ "def", "pruneUI", "(", "dupeList", ",", "mainPos", "=", "1", ",", "mainLen", "=", "1", ")", ":", "dupeList", "=", "sorted", "(", "dupeList", ")", "print", "for", "pos", ",", "val", "in", "enumerate", "(", "dupeList", ")", ":", "print", "\"%d) %s\"", ...
0334545885445834307c075a445fba9fe6f0c9e7
valid
find_dupes
High-level code to walk a set of paths and find duplicate groups. :param exact: Whether to compare file contents by hash or by reading chunks in parallel. :type exact: :class:`~__builtins__.bool` :param paths: See :meth:`~fastdupes.getPaths` :param ignores: See :meth:`~fastdupes.getP...
fastdupes.py
def find_dupes(paths, exact=False, ignores=None, min_size=0): """High-level code to walk a set of paths and find duplicate groups. :param exact: Whether to compare file contents by hash or by reading chunks in parallel. :type exact: :class:`~__builtins__.bool` :param paths: See :meth...
def find_dupes(paths, exact=False, ignores=None, min_size=0): """High-level code to walk a set of paths and find duplicate groups. :param exact: Whether to compare file contents by hash or by reading chunks in parallel. :type exact: :class:`~__builtins__.bool` :param paths: See :meth...
[ "High", "-", "level", "code", "to", "walk", "a", "set", "of", "paths", "and", "find", "duplicate", "groups", "." ]
ssokolow/fastdupes
python
https://github.com/ssokolow/fastdupes/blob/0334545885445834307c075a445fba9fe6f0c9e7/fastdupes.py#L462-L489
[ "def", "find_dupes", "(", "paths", ",", "exact", "=", "False", ",", "ignores", "=", "None", ",", "min_size", "=", "0", ")", ":", "groups", "=", "{", "''", ":", "getPaths", "(", "paths", ",", "ignores", ")", "}", "groups", "=", "groupBy", "(", "grou...
0334545885445834307c075a445fba9fe6f0c9e7
valid
print_defaults
Pretty-print the contents of :data:`DEFAULTS`
fastdupes.py
def print_defaults(): """Pretty-print the contents of :data:`DEFAULTS`""" maxlen = max([len(x) for x in DEFAULTS]) for key in DEFAULTS: value = DEFAULTS[key] if isinstance(value, (list, set)): value = ', '.join(value) print "%*s: %s" % (maxlen, key, value)
def print_defaults(): """Pretty-print the contents of :data:`DEFAULTS`""" maxlen = max([len(x) for x in DEFAULTS]) for key in DEFAULTS: value = DEFAULTS[key] if isinstance(value, (list, set)): value = ', '.join(value) print "%*s: %s" % (maxlen, key, value)
[ "Pretty", "-", "print", "the", "contents", "of", ":", "data", ":", "DEFAULTS" ]
ssokolow/fastdupes
python
https://github.com/ssokolow/fastdupes/blob/0334545885445834307c075a445fba9fe6f0c9e7/fastdupes.py#L491-L498
[ "def", "print_defaults", "(", ")", ":", "maxlen", "=", "max", "(", "[", "len", "(", "x", ")", "for", "x", "in", "DEFAULTS", "]", ")", "for", "key", "in", "DEFAULTS", ":", "value", "=", "DEFAULTS", "[", "key", "]", "if", "isinstance", "(", "value", ...
0334545885445834307c075a445fba9fe6f0c9e7
valid
delete_dupes
Code to handle the :option:`--delete` command-line option. :param groups: A list of groups of paths. :type groups: iterable :param prefer_list: A whitelist to be compiled by :func:`~fastdupes.multiglob_compile` and used to skip some prompts. :param interactive: If ``False``, assume the user w...
fastdupes.py
def delete_dupes(groups, prefer_list=None, interactive=True, dry_run=False): """Code to handle the :option:`--delete` command-line option. :param groups: A list of groups of paths. :type groups: iterable :param prefer_list: A whitelist to be compiled by :func:`~fastdupes.multiglob_compile` and...
def delete_dupes(groups, prefer_list=None, interactive=True, dry_run=False): """Code to handle the :option:`--delete` command-line option. :param groups: A list of groups of paths. :type groups: iterable :param prefer_list: A whitelist to be compiled by :func:`~fastdupes.multiglob_compile` and...
[ "Code", "to", "handle", "the", ":", "option", ":", "--", "delete", "command", "-", "line", "option", "." ]
ssokolow/fastdupes
python
https://github.com/ssokolow/fastdupes/blob/0334545885445834307c075a445fba9fe6f0c9e7/fastdupes.py#L500-L535
[ "def", "delete_dupes", "(", "groups", ",", "prefer_list", "=", "None", ",", "interactive", "=", "True", ",", "dry_run", "=", "False", ")", ":", "prefer_list", "=", "prefer_list", "or", "[", "]", "prefer_re", "=", "multiglob_compile", "(", "prefer_list", ",",...
0334545885445834307c075a445fba9fe6f0c9e7
valid
main
The main entry point, compatible with setuptools.
fastdupes.py
def main(): """The main entry point, compatible with setuptools.""" # pylint: disable=bad-continuation from optparse import OptionParser, OptionGroup parser = OptionParser(usage="%prog [options] <folder path> ...", version="%s v%s" % (__appname__, __version__)) parser.add_option('-D', '-...
def main(): """The main entry point, compatible with setuptools.""" # pylint: disable=bad-continuation from optparse import OptionParser, OptionGroup parser = OptionParser(usage="%prog [options] <folder path> ...", version="%s v%s" % (__appname__, __version__)) parser.add_option('-D', '-...
[ "The", "main", "entry", "point", "compatible", "with", "setuptools", "." ]
ssokolow/fastdupes
python
https://github.com/ssokolow/fastdupes/blob/0334545885445834307c075a445fba9fe6f0c9e7/fastdupes.py#L537-L602
[ "def", "main", "(", ")", ":", "# pylint: disable=bad-continuation", "from", "optparse", "import", "OptionParser", ",", "OptionGroup", "parser", "=", "OptionParser", "(", "usage", "=", "\"%prog [options] <folder path> ...\"", ",", "version", "=", "\"%s v%s\"", "%", "("...
0334545885445834307c075a445fba9fe6f0c9e7
valid
OverWriter.write
Use ``\\r`` to overdraw the current line with the given text. This function transparently handles tracking how much overdrawing is necessary to erase the previous line when used consistently. :param text: The text to be outputted :param newline: Whether to start a new line and reset th...
fastdupes.py
def write(self, text, newline=False): """Use ``\\r`` to overdraw the current line with the given text. This function transparently handles tracking how much overdrawing is necessary to erase the previous line when used consistently. :param text: The text to be outputted :param ...
def write(self, text, newline=False): """Use ``\\r`` to overdraw the current line with the given text. This function transparently handles tracking how much overdrawing is necessary to erase the previous line when used consistently. :param text: The text to be outputted :param ...
[ "Use", "\\\\", "r", "to", "overdraw", "the", "current", "line", "with", "the", "given", "text", "." ]
ssokolow/fastdupes
python
https://github.com/ssokolow/fastdupes/blob/0334545885445834307c075a445fba9fe6f0c9e7/fastdupes.py#L134-L155
[ "def", "write", "(", "self", ",", "text", ",", "newline", "=", "False", ")", ":", "if", "not", "self", ".", "isatty", ":", "self", ".", "fobj", ".", "write", "(", "'%s\\n'", "%", "text", ")", "return", "msg_len", "=", "len", "(", "text", ")", "se...
0334545885445834307c075a445fba9fe6f0c9e7
valid
summarize
select sentences in terms of maximum coverage problem Args: text: text to be summarized (unicode string) char_limit: summary length (the number of characters) Returns: list of extracted sentences Reference: Hiroya Takamura, Manabu Okumura. Text summarization model based on m...
summpy/mcp_summ.py
def summarize(text, char_limit, sentence_filter=None, debug=False): ''' select sentences in terms of maximum coverage problem Args: text: text to be summarized (unicode string) char_limit: summary length (the number of characters) Returns: list of extracted sentences Reference: ...
def summarize(text, char_limit, sentence_filter=None, debug=False): ''' select sentences in terms of maximum coverage problem Args: text: text to be summarized (unicode string) char_limit: summary length (the number of characters) Returns: list of extracted sentences Reference: ...
[ "select", "sentences", "in", "terms", "of", "maximum", "coverage", "problem" ]
recruit-tech/summpy
python
https://github.com/recruit-tech/summpy/blob/b246bd111aa10a8ea11a0aff8c9fce891f52cc58/summpy/mcp_summ.py#L13-L87
[ "def", "summarize", "(", "text", ",", "char_limit", ",", "sentence_filter", "=", "None", ",", "debug", "=", "False", ")", ":", "debug_info", "=", "{", "}", "sents", "=", "list", "(", "tools", ".", "sent_splitter_ja", "(", "text", ")", ")", "words_list", ...
b246bd111aa10a8ea11a0aff8c9fce891f52cc58
valid
lexrank
compute centrality score of sentences. Args: sentences: [u'こんにちは.', u'私の名前は飯沼です.', ... ] continuous: if True, apply continuous LexRank. (see reference) sim_threshold: if continuous is False and smilarity is greater or equal to sim_threshold, link the sentences. alpha: the damping fa...
summpy/lexrank.py
def lexrank(sentences, continuous=False, sim_threshold=0.1, alpha=0.9, use_divrank=False, divrank_alpha=0.25): ''' compute centrality score of sentences. Args: sentences: [u'こんにちは.', u'私の名前は飯沼です.', ... ] continuous: if True, apply continuous LexRank. (see reference) sim_thresh...
def lexrank(sentences, continuous=False, sim_threshold=0.1, alpha=0.9, use_divrank=False, divrank_alpha=0.25): ''' compute centrality score of sentences. Args: sentences: [u'こんにちは.', u'私の名前は飯沼です.', ... ] continuous: if True, apply continuous LexRank. (see reference) sim_thresh...
[ "compute", "centrality", "score", "of", "sentences", "." ]
recruit-tech/summpy
python
https://github.com/recruit-tech/summpy/blob/b246bd111aa10a8ea11a0aff8c9fce891f52cc58/summpy/lexrank.py#L17-L88
[ "def", "lexrank", "(", "sentences", ",", "continuous", "=", "False", ",", "sim_threshold", "=", "0.1", ",", "alpha", "=", "0.9", ",", "use_divrank", "=", "False", ",", "divrank_alpha", "=", "0.25", ")", ":", "# configure ranker", "ranker_params", "=", "{", ...
b246bd111aa10a8ea11a0aff8c9fce891f52cc58
valid
summarize
Args: text: text to be summarized (unicode string) sent_limit: summary length (the number of sentences) char_limit: summary length (the number of characters) imp_require: cumulative LexRank score [0.0-1.0] Returns: list of extracted sentences
summpy/lexrank.py
def summarize(text, sent_limit=None, char_limit=None, imp_require=None, debug=False, **lexrank_params): ''' Args: text: text to be summarized (unicode string) sent_limit: summary length (the number of sentences) char_limit: summary length (the number of characters) imp_requ...
def summarize(text, sent_limit=None, char_limit=None, imp_require=None, debug=False, **lexrank_params): ''' Args: text: text to be summarized (unicode string) sent_limit: summary length (the number of sentences) char_limit: summary length (the number of characters) imp_requ...
[ "Args", ":", "text", ":", "text", "to", "be", "summarized", "(", "unicode", "string", ")", "sent_limit", ":", "summary", "length", "(", "the", "number", "of", "sentences", ")", "char_limit", ":", "summary", "length", "(", "the", "number", "of", "characters...
recruit-tech/summpy
python
https://github.com/recruit-tech/summpy/blob/b246bd111aa10a8ea11a0aff8c9fce891f52cc58/summpy/lexrank.py#L91-L132
[ "def", "summarize", "(", "text", ",", "sent_limit", "=", "None", ",", "char_limit", "=", "None", ",", "imp_require", "=", "None", ",", "debug", "=", "False", ",", "*", "*", "lexrank_params", ")", ":", "debug_info", "=", "{", "}", "sentences", "=", "lis...
b246bd111aa10a8ea11a0aff8c9fce891f52cc58
valid
Summarizer.get_summarizer
import summarizers on-demand
summpy/server.py
def get_summarizer(self, name): ''' import summarizers on-demand ''' if name in self.summarizers: pass elif name == 'lexrank': from . import lexrank self.summarizers[name] = lexrank.summarize elif name == 'mcp': from . impor...
def get_summarizer(self, name): ''' import summarizers on-demand ''' if name in self.summarizers: pass elif name == 'lexrank': from . import lexrank self.summarizers[name] = lexrank.summarize elif name == 'mcp': from . impor...
[ "import", "summarizers", "on", "-", "demand" ]
recruit-tech/summpy
python
https://github.com/recruit-tech/summpy/blob/b246bd111aa10a8ea11a0aff8c9fce891f52cc58/summpy/server.py#L19-L32
[ "def", "get_summarizer", "(", "self", ",", "name", ")", ":", "if", "name", "in", "self", ".", "summarizers", ":", "pass", "elif", "name", "==", "'lexrank'", ":", "from", ".", "import", "lexrank", "self", ".", "summarizers", "[", "name", "]", "=", "lexr...
b246bd111aa10a8ea11a0aff8c9fce891f52cc58
valid
Summarizer.summarize
Args: text: text to be summarized algo: summarizaion algorithm - 'lexrank' (default) graph-based - 'clexrank' Continuous LexRank - 'divrank' DivRank (Diverse Rank) - 'mcp' select sentences in terms of maximum coverage problem summari...
summpy/server.py
def summarize(self, text=None, algo=u'lexrank', **summarizer_params): ''' Args: text: text to be summarized algo: summarizaion algorithm - 'lexrank' (default) graph-based - 'clexrank' Continuous LexRank - 'divrank' DivRank (Diverse Rank) ...
def summarize(self, text=None, algo=u'lexrank', **summarizer_params): ''' Args: text: text to be summarized algo: summarizaion algorithm - 'lexrank' (default) graph-based - 'clexrank' Continuous LexRank - 'divrank' DivRank (Diverse Rank) ...
[ "Args", ":", "text", ":", "text", "to", "be", "summarized", "algo", ":", "summarizaion", "algorithm", "-", "lexrank", "(", "default", ")", "graph", "-", "based", "-", "clexrank", "Continuous", "LexRank", "-", "divrank", "DivRank", "(", "Diverse", "Rank", "...
recruit-tech/summpy
python
https://github.com/recruit-tech/summpy/blob/b246bd111aa10a8ea11a0aff8c9fce891f52cc58/summpy/server.py#L35-L88
[ "def", "summarize", "(", "self", ",", "text", "=", "None", ",", "algo", "=", "u'lexrank'", ",", "*", "*", "summarizer_params", ")", ":", "try", ":", "# TODO: generate more useful error message", "# fix parameter type", "for", "param", ",", "value", "in", "summar...
b246bd111aa10a8ea11a0aff8c9fce891f52cc58
valid
sent_splitter_ja
Args: text: unicode string that contains multiple Japanese sentences. delimiters: set() of sentence delimiter characters. parenthesis: to be checked its correspondence. Returns: generator that yields sentences.
summpy/tools.py
def sent_splitter_ja(text, delimiters=set(u'。.?!\n\r'), parenthesis=u'()「」『』“”'): ''' Args: text: unicode string that contains multiple Japanese sentences. delimiters: set() of sentence delimiter characters. parenthesis: to be checked its correspondence. Returns: ...
def sent_splitter_ja(text, delimiters=set(u'。.?!\n\r'), parenthesis=u'()「」『』“”'): ''' Args: text: unicode string that contains multiple Japanese sentences. delimiters: set() of sentence delimiter characters. parenthesis: to be checked its correspondence. Returns: ...
[ "Args", ":", "text", ":", "unicode", "string", "that", "contains", "multiple", "Japanese", "sentences", ".", "delimiters", ":", "set", "()", "of", "sentence", "delimiter", "characters", ".", "parenthesis", ":", "to", "be", "checked", "its", "correspondence", "...
recruit-tech/summpy
python
https://github.com/recruit-tech/summpy/blob/b246bd111aa10a8ea11a0aff8c9fce891f52cc58/summpy/tools.py#L25-L57
[ "def", "sent_splitter_ja", "(", "text", ",", "delimiters", "=", "set", "(", "u'。.?!\\n\\r'),", "", "", "parenthesis", "=", "u'()「」『』“”'):", "", "", "paren_chars", "=", "set", "(", "parenthesis", ")", "close2open", "=", "dict", "(", "zip", "(", "parenthesis",...
b246bd111aa10a8ea11a0aff8c9fce891f52cc58
valid
divrank
Returns the DivRank (Diverse Rank) of the nodes in the graph. This code is based on networkx.pagerank. Args: (diff from pagerank) alpha: controls strength of self-link [0.0-1.0] d: the damping factor Reference: Qiaozhu Mei and Jian Guo and Dragomir Radev, DivRank: the Interplay of ...
summpy/misc/divrank.py
def divrank(G, alpha=0.25, d=0.85, personalization=None, max_iter=100, tol=1.0e-6, nstart=None, weight='weight', dangling=None): ''' Returns the DivRank (Diverse Rank) of the nodes in the graph. This code is based on networkx.pagerank. Args: (diff from pagerank) alpha: con...
def divrank(G, alpha=0.25, d=0.85, personalization=None, max_iter=100, tol=1.0e-6, nstart=None, weight='weight', dangling=None): ''' Returns the DivRank (Diverse Rank) of the nodes in the graph. This code is based on networkx.pagerank. Args: (diff from pagerank) alpha: con...
[ "Returns", "the", "DivRank", "(", "Diverse", "Rank", ")", "of", "the", "nodes", "in", "the", "graph", ".", "This", "code", "is", "based", "on", "networkx", ".", "pagerank", "." ]
recruit-tech/summpy
python
https://github.com/recruit-tech/summpy/blob/b246bd111aa10a8ea11a0aff8c9fce891f52cc58/summpy/misc/divrank.py#L10-L102
[ "def", "divrank", "(", "G", ",", "alpha", "=", "0.25", ",", "d", "=", "0.85", ",", "personalization", "=", "None", ",", "max_iter", "=", "100", ",", "tol", "=", "1.0e-6", ",", "nstart", "=", "None", ",", "weight", "=", "'weight'", ",", "dangling", ...
b246bd111aa10a8ea11a0aff8c9fce891f52cc58
valid
divrank_scipy
Returns the DivRank (Diverse Rank) of the nodes in the graph. This code is based on networkx.pagerank_scipy
summpy/misc/divrank.py
def divrank_scipy(G, alpha=0.25, d=0.85, personalization=None, max_iter=100, tol=1.0e-6, nstart=None, weight='weight', dangling=None): ''' Returns the DivRank (Diverse Rank) of the nodes in the graph. This code is based on networkx.pagerank_scipy ''' import scipy....
def divrank_scipy(G, alpha=0.25, d=0.85, personalization=None, max_iter=100, tol=1.0e-6, nstart=None, weight='weight', dangling=None): ''' Returns the DivRank (Diverse Rank) of the nodes in the graph. This code is based on networkx.pagerank_scipy ''' import scipy....
[ "Returns", "the", "DivRank", "(", "Diverse", "Rank", ")", "of", "the", "nodes", "in", "the", "graph", ".", "This", "code", "is", "based", "on", "networkx", ".", "pagerank_scipy" ]
recruit-tech/summpy
python
https://github.com/recruit-tech/summpy/blob/b246bd111aa10a8ea11a0aff8c9fce891f52cc58/summpy/misc/divrank.py#L105-L180
[ "def", "divrank_scipy", "(", "G", ",", "alpha", "=", "0.25", ",", "d", "=", "0.85", ",", "personalization", "=", "None", ",", "max_iter", "=", "100", ",", "tol", "=", "1.0e-6", ",", "nstart", "=", "None", ",", "weight", "=", "'weight'", ",", "danglin...
b246bd111aa10a8ea11a0aff8c9fce891f52cc58
valid
code_mapping
Return an error code between 0 and 99.
flake8_rst_docstrings.py
def code_mapping(level, msg, default=99): """Return an error code between 0 and 99.""" try: return code_mappings_by_level[level][msg] except KeyError: pass # Following assumes any variable messages take the format # of 'Fixed text "variable text".' only: # e.g. 'Unknown directive...
def code_mapping(level, msg, default=99): """Return an error code between 0 and 99.""" try: return code_mappings_by_level[level][msg] except KeyError: pass # Following assumes any variable messages take the format # of 'Fixed text "variable text".' only: # e.g. 'Unknown directive...
[ "Return", "an", "error", "code", "between", "0", "and", "99", "." ]
peterjc/flake8-rst-docstrings
python
https://github.com/peterjc/flake8-rst-docstrings/blob/b8b17d0317fc6728d5586553ab29a7d97e6417fd/flake8_rst_docstrings.py#L201-L216
[ "def", "code_mapping", "(", "level", ",", "msg", ",", "default", "=", "99", ")", ":", "try", ":", "return", "code_mappings_by_level", "[", "level", "]", "[", "msg", "]", "except", "KeyError", ":", "pass", "# Following assumes any variable messages take the format"...
b8b17d0317fc6728d5586553ab29a7d97e6417fd
valid
dequote_docstring
Remove the quotes delimiting a docstring.
flake8_rst_docstrings.py
def dequote_docstring(text): """Remove the quotes delimiting a docstring.""" # TODO: Process escaped characters unless raw mode? text = text.strip() if len(text) > 6 and text[:3] == text[-3:] == '"""': # Standard case, """...""" return text[3:-3] if len(text) > 7 and text[:4] in ('u"...
def dequote_docstring(text): """Remove the quotes delimiting a docstring.""" # TODO: Process escaped characters unless raw mode? text = text.strip() if len(text) > 6 and text[:3] == text[-3:] == '"""': # Standard case, """...""" return text[3:-3] if len(text) > 7 and text[:4] in ('u"...
[ "Remove", "the", "quotes", "delimiting", "a", "docstring", "." ]
peterjc/flake8-rst-docstrings
python
https://github.com/peterjc/flake8-rst-docstrings/blob/b8b17d0317fc6728d5586553ab29a7d97e6417fd/flake8_rst_docstrings.py#L265-L288
[ "def", "dequote_docstring", "(", "text", ")", ":", "# TODO: Process escaped characters unless raw mode?", "text", "=", "text", ".", "strip", "(", ")", "if", "len", "(", "text", ")", ">", "6", "and", "text", "[", ":", "3", "]", "==", "text", "[", "-", "3"...
b8b17d0317fc6728d5586553ab29a7d97e6417fd
valid
Function.is_public
Return True iff this function should be considered public.
flake8_rst_docstrings.py
def is_public(self): """Return True iff this function should be considered public.""" if self.all is not None: return self.name in self.all else: return not self.name.startswith("_")
def is_public(self): """Return True iff this function should be considered public.""" if self.all is not None: return self.name in self.all else: return not self.name.startswith("_")
[ "Return", "True", "iff", "this", "function", "should", "be", "considered", "public", "." ]
peterjc/flake8-rst-docstrings
python
https://github.com/peterjc/flake8-rst-docstrings/blob/b8b17d0317fc6728d5586553ab29a7d97e6417fd/flake8_rst_docstrings.py#L419-L424
[ "def", "is_public", "(", "self", ")", ":", "if", "self", ".", "all", "is", "not", "None", ":", "return", "self", ".", "name", "in", "self", ".", "all", "else", ":", "return", "not", "self", ".", "name", ".", "startswith", "(", "\"_\"", ")" ]
b8b17d0317fc6728d5586553ab29a7d97e6417fd
valid
Method.is_public
Return True iff this method should be considered public.
flake8_rst_docstrings.py
def is_public(self): """Return True iff this method should be considered public.""" # Check if we are a setter/deleter method, and mark as private if so. for decorator in self.decorators: # Given 'foo', match 'foo.bar' but not 'foobar' or 'sfoo' if re.compile(r"^{}\.".for...
def is_public(self): """Return True iff this method should be considered public.""" # Check if we are a setter/deleter method, and mark as private if so. for decorator in self.decorators: # Given 'foo', match 'foo.bar' but not 'foobar' or 'sfoo' if re.compile(r"^{}\.".for...
[ "Return", "True", "iff", "this", "method", "should", "be", "considered", "public", "." ]
peterjc/flake8-rst-docstrings
python
https://github.com/peterjc/flake8-rst-docstrings/blob/b8b17d0317fc6728d5586553ab29a7d97e6417fd/flake8_rst_docstrings.py#L456-L468
[ "def", "is_public", "(", "self", ")", ":", "# Check if we are a setter/deleter method, and mark as private if so.", "for", "decorator", "in", "self", ".", "decorators", ":", "# Given 'foo', match 'foo.bar' but not 'foobar' or 'sfoo'", "if", "re", ".", "compile", "(", "r\"^{}\...
b8b17d0317fc6728d5586553ab29a7d97e6417fd
valid
NestedClass.is_public
Return True iff this class should be considered public.
flake8_rst_docstrings.py
def is_public(self): """Return True iff this class should be considered public.""" return ( not self.name.startswith("_") and self.parent.is_class and self.parent.is_public )
def is_public(self): """Return True iff this class should be considered public.""" return ( not self.name.startswith("_") and self.parent.is_class and self.parent.is_public )
[ "Return", "True", "iff", "this", "class", "should", "be", "considered", "public", "." ]
peterjc/flake8-rst-docstrings
python
https://github.com/peterjc/flake8-rst-docstrings/blob/b8b17d0317fc6728d5586553ab29a7d97e6417fd/flake8_rst_docstrings.py#L483-L489
[ "def", "is_public", "(", "self", ")", ":", "return", "(", "not", "self", ".", "name", ".", "startswith", "(", "\"_\"", ")", "and", "self", ".", "parent", ".", "is_class", "and", "self", ".", "parent", ".", "is_public", ")" ]
b8b17d0317fc6728d5586553ab29a7d97e6417fd
valid
TokenStream.move
Move.
flake8_rst_docstrings.py
def move(self): """Move.""" previous = self.current current = self._next_from_generator() self.current = None if current is None else Token(*current) self.line = self.current.start[0] if self.current else self.line self.got_logical_newline = previous.kind in self.LOGICAL_...
def move(self): """Move.""" previous = self.current current = self._next_from_generator() self.current = None if current is None else Token(*current) self.line = self.current.start[0] if self.current else self.line self.got_logical_newline = previous.kind in self.LOGICAL_...
[ "Move", "." ]
peterjc/flake8-rst-docstrings
python
https://github.com/peterjc/flake8-rst-docstrings/blob/b8b17d0317fc6728d5586553ab29a7d97e6417fd/flake8_rst_docstrings.py#L539-L546
[ "def", "move", "(", "self", ")", ":", "previous", "=", "self", ".", "current", "current", "=", "self", ".", "_next_from_generator", "(", ")", "self", ".", "current", "=", "None", "if", "current", "is", "None", "else", "Token", "(", "*", "current", ")",...
b8b17d0317fc6728d5586553ab29a7d97e6417fd
valid
Parser.parse
Parse the given file-like object and return its Module object.
flake8_rst_docstrings.py
def parse(self, filelike, filename): """Parse the given file-like object and return its Module object.""" self.log = log self.source = filelike.readlines() src = "".join(self.source) # This may raise a SyntaxError: compile(src, filename, "exec") self.stream = Toke...
def parse(self, filelike, filename): """Parse the given file-like object and return its Module object.""" self.log = log self.source = filelike.readlines() src = "".join(self.source) # This may raise a SyntaxError: compile(src, filename, "exec") self.stream = Toke...
[ "Parse", "the", "given", "file", "-", "like", "object", "and", "return", "its", "Module", "object", "." ]
peterjc/flake8-rst-docstrings
python
https://github.com/peterjc/flake8-rst-docstrings/blob/b8b17d0317fc6728d5586553ab29a7d97e6417fd/flake8_rst_docstrings.py#L587-L599
[ "def", "parse", "(", "self", ",", "filelike", ",", "filename", ")", ":", "self", ".", "log", "=", "log", "self", ".", "source", "=", "filelike", ".", "readlines", "(", ")", "src", "=", "\"\"", ".", "join", "(", "self", ".", "source", ")", "# This m...
b8b17d0317fc6728d5586553ab29a7d97e6417fd
valid
Parser.consume
Consume one token and verify it is of the expected kind.
flake8_rst_docstrings.py
def consume(self, kind): """Consume one token and verify it is of the expected kind.""" next_token = self.stream.move() assert next_token.kind == kind
def consume(self, kind): """Consume one token and verify it is of the expected kind.""" next_token = self.stream.move() assert next_token.kind == kind
[ "Consume", "one", "token", "and", "verify", "it", "is", "of", "the", "expected", "kind", "." ]
peterjc/flake8-rst-docstrings
python
https://github.com/peterjc/flake8-rst-docstrings/blob/b8b17d0317fc6728d5586553ab29a7d97e6417fd/flake8_rst_docstrings.py#L609-L612
[ "def", "consume", "(", "self", ",", "kind", ")", ":", "next_token", "=", "self", ".", "stream", ".", "move", "(", ")", "assert", "next_token", ".", "kind", "==", "kind" ]
b8b17d0317fc6728d5586553ab29a7d97e6417fd
valid
Parser.leapfrog
Skip tokens in the stream until a certain token kind is reached. If `value` is specified, tokens whose values are different will also be skipped.
flake8_rst_docstrings.py
def leapfrog(self, kind, value=None): """Skip tokens in the stream until a certain token kind is reached. If `value` is specified, tokens whose values are different will also be skipped. """ while self.current is not None: if self.current.kind == kind and ( ...
def leapfrog(self, kind, value=None): """Skip tokens in the stream until a certain token kind is reached. If `value` is specified, tokens whose values are different will also be skipped. """ while self.current is not None: if self.current.kind == kind and ( ...
[ "Skip", "tokens", "in", "the", "stream", "until", "a", "certain", "token", "kind", "is", "reached", "." ]
peterjc/flake8-rst-docstrings
python
https://github.com/peterjc/flake8-rst-docstrings/blob/b8b17d0317fc6728d5586553ab29a7d97e6417fd/flake8_rst_docstrings.py#L614-L626
[ "def", "leapfrog", "(", "self", ",", "kind", ",", "value", "=", "None", ")", ":", "while", "self", ".", "current", "is", "not", "None", ":", "if", "self", ".", "current", ".", "kind", "==", "kind", "and", "(", "value", "is", "None", "or", "self", ...
b8b17d0317fc6728d5586553ab29a7d97e6417fd
valid
Parser.parse_docstring
Parse a single docstring and return its value.
flake8_rst_docstrings.py
def parse_docstring(self): """Parse a single docstring and return its value.""" self.log.debug( "parsing docstring, token is %r (%s)", self.current.kind, self.current.value ) while self.current.kind in (tk.COMMENT, tk.NEWLINE, tk.NL): self.stream.move() ...
def parse_docstring(self): """Parse a single docstring and return its value.""" self.log.debug( "parsing docstring, token is %r (%s)", self.current.kind, self.current.value ) while self.current.kind in (tk.COMMENT, tk.NEWLINE, tk.NL): self.stream.move() ...
[ "Parse", "a", "single", "docstring", "and", "return", "its", "value", "." ]
peterjc/flake8-rst-docstrings
python
https://github.com/peterjc/flake8-rst-docstrings/blob/b8b17d0317fc6728d5586553ab29a7d97e6417fd/flake8_rst_docstrings.py#L628-L644
[ "def", "parse_docstring", "(", "self", ")", ":", "self", ".", "log", ".", "debug", "(", "\"parsing docstring, token is %r (%s)\"", ",", "self", ".", "current", ".", "kind", ",", "self", ".", "current", ".", "value", ")", "while", "self", ".", "current", "....
b8b17d0317fc6728d5586553ab29a7d97e6417fd