repository_name
stringlengths
5
67
func_path_in_repository
stringlengths
4
234
func_name
stringlengths
0
314
whole_func_string
stringlengths
52
3.87M
language
stringclasses
6 values
func_code_string
stringlengths
52
3.87M
func_code_tokens
listlengths
15
672k
func_documentation_string
stringlengths
1
47.2k
func_documentation_tokens
listlengths
1
3.92k
split_name
stringclasses
1 value
func_code_url
stringlengths
85
339
eandersson/amqpstorm
amqpstorm/io.py
IO._get_socket_addresses
def _get_socket_addresses(self): """Get Socket address information. :rtype: list """ family = socket.AF_UNSPEC if not socket.has_ipv6: family = socket.AF_INET try: addresses = socket.getaddrinfo(self._parameters['hostname'], ...
python
def _get_socket_addresses(self): """Get Socket address information. :rtype: list """ family = socket.AF_UNSPEC if not socket.has_ipv6: family = socket.AF_INET try: addresses = socket.getaddrinfo(self._parameters['hostname'], ...
[ "def", "_get_socket_addresses", "(", "self", ")", ":", "family", "=", "socket", ".", "AF_UNSPEC", "if", "not", "socket", ".", "has_ipv6", ":", "family", "=", "socket", ".", "AF_INET", "try", ":", "addresses", "=", "socket", ".", "getaddrinfo", "(", "self",...
Get Socket address information. :rtype: list
[ "Get", "Socket", "address", "information", "." ]
train
https://github.com/eandersson/amqpstorm/blob/38330906c0af19eea482f43c5ce79bab98a1e064/amqpstorm/io.py#L152-L166
eandersson/amqpstorm
amqpstorm/io.py
IO._find_address_and_connect
def _find_address_and_connect(self, addresses): """Find and connect to the appropriate address. :param addresses: :raises AMQPConnectionError: Raises if the connection encountered an error. :rtype: socket.socket """ error_message = ...
python
def _find_address_and_connect(self, addresses): """Find and connect to the appropriate address. :param addresses: :raises AMQPConnectionError: Raises if the connection encountered an error. :rtype: socket.socket """ error_message = ...
[ "def", "_find_address_and_connect", "(", "self", ",", "addresses", ")", ":", "error_message", "=", "None", "for", "address", "in", "addresses", ":", "sock", "=", "self", ".", "_create_socket", "(", "socket_family", "=", "address", "[", "0", "]", ")", "try", ...
Find and connect to the appropriate address. :param addresses: :raises AMQPConnectionError: Raises if the connection encountered an error. :rtype: socket.socket
[ "Find", "and", "connect", "to", "the", "appropriate", "address", "." ]
train
https://github.com/eandersson/amqpstorm/blob/38330906c0af19eea482f43c5ce79bab98a1e064/amqpstorm/io.py#L168-L192
eandersson/amqpstorm
amqpstorm/io.py
IO._create_socket
def _create_socket(self, socket_family): """Create Socket. :param int socket_family: :rtype: socket.socket """ sock = socket.socket(socket_family, socket.SOCK_STREAM, 0) sock.settimeout(self._parameters['timeout'] or None) if self.use_ssl: if not comp...
python
def _create_socket(self, socket_family): """Create Socket. :param int socket_family: :rtype: socket.socket """ sock = socket.socket(socket_family, socket.SOCK_STREAM, 0) sock.settimeout(self._parameters['timeout'] or None) if self.use_ssl: if not comp...
[ "def", "_create_socket", "(", "self", ",", "socket_family", ")", ":", "sock", "=", "socket", ".", "socket", "(", "socket_family", ",", "socket", ".", "SOCK_STREAM", ",", "0", ")", "sock", ".", "settimeout", "(", "self", ".", "_parameters", "[", "'timeout'"...
Create Socket. :param int socket_family: :rtype: socket.socket
[ "Create", "Socket", "." ]
train
https://github.com/eandersson/amqpstorm/blob/38330906c0af19eea482f43c5ce79bab98a1e064/amqpstorm/io.py#L194-L208
eandersson/amqpstorm
amqpstorm/io.py
IO._ssl_wrap_socket
def _ssl_wrap_socket(self, sock): """Wrap SSLSocket around the Socket. :param socket.socket sock: :rtype: SSLSocket """ context = self._parameters['ssl_options'].get('context') if context is not None: hostname = self._parameters['ssl_options'].get('server_hos...
python
def _ssl_wrap_socket(self, sock): """Wrap SSLSocket around the Socket. :param socket.socket sock: :rtype: SSLSocket """ context = self._parameters['ssl_options'].get('context') if context is not None: hostname = self._parameters['ssl_options'].get('server_hos...
[ "def", "_ssl_wrap_socket", "(", "self", ",", "sock", ")", ":", "context", "=", "self", ".", "_parameters", "[", "'ssl_options'", "]", ".", "get", "(", "'context'", ")", "if", "context", "is", "not", "None", ":", "hostname", "=", "self", ".", "_parameters...
Wrap SSLSocket around the Socket. :param socket.socket sock: :rtype: SSLSocket
[ "Wrap", "SSLSocket", "around", "the", "Socket", "." ]
train
https://github.com/eandersson/amqpstorm/blob/38330906c0af19eea482f43c5ce79bab98a1e064/amqpstorm/io.py#L210-L230
eandersson/amqpstorm
amqpstorm/io.py
IO._create_inbound_thread
def _create_inbound_thread(self): """Internal Thread that handles all incoming traffic. :rtype: threading.Thread """ inbound_thread = threading.Thread(target=self._process_incoming_data, name=__name__) inbound_thread.daemon = True ...
python
def _create_inbound_thread(self): """Internal Thread that handles all incoming traffic. :rtype: threading.Thread """ inbound_thread = threading.Thread(target=self._process_incoming_data, name=__name__) inbound_thread.daemon = True ...
[ "def", "_create_inbound_thread", "(", "self", ")", ":", "inbound_thread", "=", "threading", ".", "Thread", "(", "target", "=", "self", ".", "_process_incoming_data", ",", "name", "=", "__name__", ")", "inbound_thread", ".", "daemon", "=", "True", "inbound_thread...
Internal Thread that handles all incoming traffic. :rtype: threading.Thread
[ "Internal", "Thread", "that", "handles", "all", "incoming", "traffic", "." ]
train
https://github.com/eandersson/amqpstorm/blob/38330906c0af19eea482f43c5ce79bab98a1e064/amqpstorm/io.py#L232-L241
eandersson/amqpstorm
amqpstorm/io.py
IO._process_incoming_data
def _process_incoming_data(self): """Retrieve and process any incoming data. :return: """ while self._running.is_set(): if self.poller.is_ready: self.data_in += self._receive() self.data_in = self._on_read_impl(self.data_in)
python
def _process_incoming_data(self): """Retrieve and process any incoming data. :return: """ while self._running.is_set(): if self.poller.is_ready: self.data_in += self._receive() self.data_in = self._on_read_impl(self.data_in)
[ "def", "_process_incoming_data", "(", "self", ")", ":", "while", "self", ".", "_running", ".", "is_set", "(", ")", ":", "if", "self", ".", "poller", ".", "is_ready", ":", "self", ".", "data_in", "+=", "self", ".", "_receive", "(", ")", "self", ".", "...
Retrieve and process any incoming data. :return:
[ "Retrieve", "and", "process", "any", "incoming", "data", "." ]
train
https://github.com/eandersson/amqpstorm/blob/38330906c0af19eea482f43c5ce79bab98a1e064/amqpstorm/io.py#L243-L251
eandersson/amqpstorm
amqpstorm/io.py
IO._receive
def _receive(self): """Receive any incoming socket data. If an error is thrown, handle it and return an empty string. :return: data_in :rtype: bytes """ data_in = EMPTY_BUFFER try: data_in = self._read_from_socket() except socket.timeout:...
python
def _receive(self): """Receive any incoming socket data. If an error is thrown, handle it and return an empty string. :return: data_in :rtype: bytes """ data_in = EMPTY_BUFFER try: data_in = self._read_from_socket() except socket.timeout:...
[ "def", "_receive", "(", "self", ")", ":", "data_in", "=", "EMPTY_BUFFER", "try", ":", "data_in", "=", "self", ".", "_read_from_socket", "(", ")", "except", "socket", ".", "timeout", ":", "pass", "except", "(", "IOError", ",", "OSError", ")", "as", "why",...
Receive any incoming socket data. If an error is thrown, handle it and return an empty string. :return: data_in :rtype: bytes
[ "Receive", "any", "incoming", "socket", "data", "." ]
train
https://github.com/eandersson/amqpstorm/blob/38330906c0af19eea482f43c5ce79bab98a1e064/amqpstorm/io.py#L253-L270
eandersson/amqpstorm
amqpstorm/io.py
IO._read_from_socket
def _read_from_socket(self): """Read data from the socket. :rtype: bytes """ if not self.use_ssl: if not self.socket: raise socket.error('connection/socket error') return self.socket.recv(MAX_FRAME_SIZE) with self._rd_lock: if...
python
def _read_from_socket(self): """Read data from the socket. :rtype: bytes """ if not self.use_ssl: if not self.socket: raise socket.error('connection/socket error') return self.socket.recv(MAX_FRAME_SIZE) with self._rd_lock: if...
[ "def", "_read_from_socket", "(", "self", ")", ":", "if", "not", "self", ".", "use_ssl", ":", "if", "not", "self", ".", "socket", ":", "raise", "socket", ".", "error", "(", "'connection/socket error'", ")", "return", "self", ".", "socket", ".", "recv", "(...
Read data from the socket. :rtype: bytes
[ "Read", "data", "from", "the", "socket", "." ]
train
https://github.com/eandersson/amqpstorm/blob/38330906c0af19eea482f43c5ce79bab98a1e064/amqpstorm/io.py#L272-L285
eandersson/amqpstorm
amqpstorm/heartbeat.py
Heartbeat.start
def start(self, exceptions): """Start the Heartbeat Checker. :param list exceptions: :return: """ if not self._interval: return False self._running.set() with self._lock: self._threshold = 0 self._reads_since_check = 0 ...
python
def start(self, exceptions): """Start the Heartbeat Checker. :param list exceptions: :return: """ if not self._interval: return False self._running.set() with self._lock: self._threshold = 0 self._reads_since_check = 0 ...
[ "def", "start", "(", "self", ",", "exceptions", ")", ":", "if", "not", "self", ".", "_interval", ":", "return", "False", "self", ".", "_running", ".", "set", "(", ")", "with", "self", ".", "_lock", ":", "self", ".", "_threshold", "=", "0", "self", ...
Start the Heartbeat Checker. :param list exceptions: :return:
[ "Start", "the", "Heartbeat", "Checker", "." ]
train
https://github.com/eandersson/amqpstorm/blob/38330906c0af19eea482f43c5ce79bab98a1e064/amqpstorm/heartbeat.py#L40-L55
eandersson/amqpstorm
amqpstorm/heartbeat.py
Heartbeat.stop
def stop(self): """Stop the Heartbeat Checker. :return: """ self._running.clear() with self._lock: if self._timer: self._timer.cancel() self._timer = None
python
def stop(self): """Stop the Heartbeat Checker. :return: """ self._running.clear() with self._lock: if self._timer: self._timer.cancel() self._timer = None
[ "def", "stop", "(", "self", ")", ":", "self", ".", "_running", ".", "clear", "(", ")", "with", "self", ".", "_lock", ":", "if", "self", ".", "_timer", ":", "self", ".", "_timer", ".", "cancel", "(", ")", "self", ".", "_timer", "=", "None" ]
Stop the Heartbeat Checker. :return:
[ "Stop", "the", "Heartbeat", "Checker", "." ]
train
https://github.com/eandersson/amqpstorm/blob/38330906c0af19eea482f43c5ce79bab98a1e064/amqpstorm/heartbeat.py#L57-L66
eandersson/amqpstorm
amqpstorm/heartbeat.py
Heartbeat._check_for_life_signs
def _check_for_life_signs(self): """Check Connection for life signs. First check if any data has been sent, if not send a heartbeat to the remote server. If we have not received any data what so ever within two intervals, we need to raise an exception so that we...
python
def _check_for_life_signs(self): """Check Connection for life signs. First check if any data has been sent, if not send a heartbeat to the remote server. If we have not received any data what so ever within two intervals, we need to raise an exception so that we...
[ "def", "_check_for_life_signs", "(", "self", ")", ":", "if", "not", "self", ".", "_running", ".", "is_set", "(", ")", ":", "return", "False", "if", "self", ".", "_writes_since_check", "==", "0", ":", "self", ".", "send_heartbeat_impl", "(", ")", "self", ...
Check Connection for life signs. First check if any data has been sent, if not send a heartbeat to the remote server. If we have not received any data what so ever within two intervals, we need to raise an exception so that we can close the connection. ...
[ "Check", "Connection", "for", "life", "signs", "." ]
train
https://github.com/eandersson/amqpstorm/blob/38330906c0af19eea482f43c5ce79bab98a1e064/amqpstorm/heartbeat.py#L68-L99
eandersson/amqpstorm
amqpstorm/heartbeat.py
Heartbeat._raise_or_append_exception
def _raise_or_append_exception(self): """The connection is presumably dead and we need to raise or append an exception. If we have a list for exceptions, append the exception and let the connection handle it, if not raise the exception here. :return: """ ...
python
def _raise_or_append_exception(self): """The connection is presumably dead and we need to raise or append an exception. If we have a list for exceptions, append the exception and let the connection handle it, if not raise the exception here. :return: """ ...
[ "def", "_raise_or_append_exception", "(", "self", ")", ":", "message", "=", "(", "'Connection dead, no heartbeat or data received in >= '", "'%ds'", "%", "(", "self", ".", "_interval", "*", "2", ")", ")", "why", "=", "AMQPConnectionError", "(", "message", ")", "if...
The connection is presumably dead and we need to raise or append an exception. If we have a list for exceptions, append the exception and let the connection handle it, if not raise the exception here. :return:
[ "The", "connection", "is", "presumably", "dead", "and", "we", "need", "to", "raise", "or", "append", "an", "exception", "." ]
train
https://github.com/eandersson/amqpstorm/blob/38330906c0af19eea482f43c5ce79bab98a1e064/amqpstorm/heartbeat.py#L101-L119
eandersson/amqpstorm
amqpstorm/heartbeat.py
Heartbeat._start_new_timer
def _start_new_timer(self): """Create a timer that will be used to periodically check the connection for heartbeats. :return: """ if not self._running.is_set(): return False self._timer = self.timer_impl( interval=self._interval, funct...
python
def _start_new_timer(self): """Create a timer that will be used to periodically check the connection for heartbeats. :return: """ if not self._running.is_set(): return False self._timer = self.timer_impl( interval=self._interval, funct...
[ "def", "_start_new_timer", "(", "self", ")", ":", "if", "not", "self", ".", "_running", ".", "is_set", "(", ")", ":", "return", "False", "self", ".", "_timer", "=", "self", ".", "timer_impl", "(", "interval", "=", "self", ".", "_interval", ",", "functi...
Create a timer that will be used to periodically check the connection for heartbeats. :return:
[ "Create", "a", "timer", "that", "will", "be", "used", "to", "periodically", "check", "the", "connection", "for", "heartbeats", "." ]
train
https://github.com/eandersson/amqpstorm/blob/38330906c0af19eea482f43c5ce79bab98a1e064/amqpstorm/heartbeat.py#L121-L135
eandersson/amqpstorm
amqpstorm/exchange.py
Exchange.declare
def declare(self, exchange='', exchange_type='direct', passive=False, durable=False, auto_delete=False, arguments=None): """Declare an Exchange. :param str exchange: Exchange name :param str exchange_type: Exchange type :param bool passive: Do not create :param b...
python
def declare(self, exchange='', exchange_type='direct', passive=False, durable=False, auto_delete=False, arguments=None): """Declare an Exchange. :param str exchange: Exchange name :param str exchange_type: Exchange type :param bool passive: Do not create :param b...
[ "def", "declare", "(", "self", ",", "exchange", "=", "''", ",", "exchange_type", "=", "'direct'", ",", "passive", "=", "False", ",", "durable", "=", "False", ",", "auto_delete", "=", "False", ",", "arguments", "=", "None", ")", ":", "if", "not", "compa...
Declare an Exchange. :param str exchange: Exchange name :param str exchange_type: Exchange type :param bool passive: Do not create :param bool durable: Durable exchange :param bool auto_delete: Automatically delete when not in use :param dict arguments: Exchange key/valu...
[ "Declare", "an", "Exchange", "." ]
train
https://github.com/eandersson/amqpstorm/blob/38330906c0af19eea482f43c5ce79bab98a1e064/amqpstorm/exchange.py#L18-L55
eandersson/amqpstorm
amqpstorm/exchange.py
Exchange.delete
def delete(self, exchange='', if_unused=False): """Delete an Exchange. :param str exchange: Exchange name :param bool if_unused: Delete only if unused :raises AMQPInvalidArgument: Invalid Parameters :raises AMQPChannelError: Raises if the channel encountered an error. :...
python
def delete(self, exchange='', if_unused=False): """Delete an Exchange. :param str exchange: Exchange name :param bool if_unused: Delete only if unused :raises AMQPInvalidArgument: Invalid Parameters :raises AMQPChannelError: Raises if the channel encountered an error. :...
[ "def", "delete", "(", "self", ",", "exchange", "=", "''", ",", "if_unused", "=", "False", ")", ":", "if", "not", "compatibility", ".", "is_string", "(", "exchange", ")", ":", "raise", "AMQPInvalidArgument", "(", "'exchange should be a string'", ")", "delete_fr...
Delete an Exchange. :param str exchange: Exchange name :param bool if_unused: Delete only if unused :raises AMQPInvalidArgument: Invalid Parameters :raises AMQPChannelError: Raises if the channel encountered an error. :raises AMQPConnectionError: Raises if the connection ...
[ "Delete", "an", "Exchange", "." ]
train
https://github.com/eandersson/amqpstorm/blob/38330906c0af19eea482f43c5ce79bab98a1e064/amqpstorm/exchange.py#L57-L75
eandersson/amqpstorm
amqpstorm/exchange.py
Exchange.bind
def bind(self, destination='', source='', routing_key='', arguments=None): """Bind an Exchange. :param str destination: Exchange name :param str source: Exchange to bind to :param str routing_key: The routing key to use :param dict arguments: Bind key/value argument...
python
def bind(self, destination='', source='', routing_key='', arguments=None): """Bind an Exchange. :param str destination: Exchange name :param str source: Exchange to bind to :param str routing_key: The routing key to use :param dict arguments: Bind key/value argument...
[ "def", "bind", "(", "self", ",", "destination", "=", "''", ",", "source", "=", "''", ",", "routing_key", "=", "''", ",", "arguments", "=", "None", ")", ":", "if", "not", "compatibility", ".", "is_string", "(", "destination", ")", ":", "raise", "AMQPInv...
Bind an Exchange. :param str destination: Exchange name :param str source: Exchange to bind to :param str routing_key: The routing key to use :param dict arguments: Bind key/value arguments :raises AMQPInvalidArgument: Invalid Parameters :raises AMQPChannelError: Raises...
[ "Bind", "an", "Exchange", "." ]
train
https://github.com/eandersson/amqpstorm/blob/38330906c0af19eea482f43c5ce79bab98a1e064/amqpstorm/exchange.py#L77-L106
eandersson/amqpstorm
amqpstorm/exchange.py
Exchange.unbind
def unbind(self, destination='', source='', routing_key='', arguments=None): """Unbind an Exchange. :param str destination: Exchange name :param str source: Exchange to unbind from :param str routing_key: The routing key used :param dict arguments: Unbind key/valu...
python
def unbind(self, destination='', source='', routing_key='', arguments=None): """Unbind an Exchange. :param str destination: Exchange name :param str source: Exchange to unbind from :param str routing_key: The routing key used :param dict arguments: Unbind key/valu...
[ "def", "unbind", "(", "self", ",", "destination", "=", "''", ",", "source", "=", "''", ",", "routing_key", "=", "''", ",", "arguments", "=", "None", ")", ":", "if", "not", "compatibility", ".", "is_string", "(", "destination", ")", ":", "raise", "AMQPI...
Unbind an Exchange. :param str destination: Exchange name :param str source: Exchange to unbind from :param str routing_key: The routing key used :param dict arguments: Unbind key/value arguments :raises AMQPInvalidArgument: Invalid Parameters :raises AMQPChannelError: ...
[ "Unbind", "an", "Exchange", "." ]
train
https://github.com/eandersson/amqpstorm/blob/38330906c0af19eea482f43c5ce79bab98a1e064/amqpstorm/exchange.py#L108-L137
eandersson/amqpstorm
amqpstorm/management/queue.py
Queue.get
def get(self, queue, virtual_host='/'): """Get Queue details. :param queue: Queue name :param str virtual_host: Virtual host name :raises ApiError: Raises if the remote server encountered an error. :raises ApiConnectionError: Raises if there was a connectivity issue. :...
python
def get(self, queue, virtual_host='/'): """Get Queue details. :param queue: Queue name :param str virtual_host: Virtual host name :raises ApiError: Raises if the remote server encountered an error. :raises ApiConnectionError: Raises if there was a connectivity issue. :...
[ "def", "get", "(", "self", ",", "queue", ",", "virtual_host", "=", "'/'", ")", ":", "virtual_host", "=", "quote", "(", "virtual_host", ",", "''", ")", "return", "self", ".", "http_client", ".", "get", "(", "API_QUEUE", "%", "(", "virtual_host", ",", "q...
Get Queue details. :param queue: Queue name :param str virtual_host: Virtual host name :raises ApiError: Raises if the remote server encountered an error. :raises ApiConnectionError: Raises if there was a connectivity issue. :rtype: dict
[ "Get", "Queue", "details", "." ]
train
https://github.com/eandersson/amqpstorm/blob/38330906c0af19eea482f43c5ce79bab98a1e064/amqpstorm/management/queue.py#L15-L32
eandersson/amqpstorm
amqpstorm/management/queue.py
Queue.list
def list(self, virtual_host='/', show_all=False): """List Queues. :param str virtual_host: Virtual host name :param bool show_all: List all Queues :raises ApiError: Raises if the remote server encountered an error. :raises ApiConnectionError: Raises if there was a connectivity ...
python
def list(self, virtual_host='/', show_all=False): """List Queues. :param str virtual_host: Virtual host name :param bool show_all: List all Queues :raises ApiError: Raises if the remote server encountered an error. :raises ApiConnectionError: Raises if there was a connectivity ...
[ "def", "list", "(", "self", ",", "virtual_host", "=", "'/'", ",", "show_all", "=", "False", ")", ":", "if", "show_all", ":", "return", "self", ".", "http_client", ".", "get", "(", "API_QUEUES", ")", "virtual_host", "=", "quote", "(", "virtual_host", ",",...
List Queues. :param str virtual_host: Virtual host name :param bool show_all: List all Queues :raises ApiError: Raises if the remote server encountered an error. :raises ApiConnectionError: Raises if there was a connectivity issue. :rtype: list
[ "List", "Queues", "." ]
train
https://github.com/eandersson/amqpstorm/blob/38330906c0af19eea482f43c5ce79bab98a1e064/amqpstorm/management/queue.py#L34-L50
eandersson/amqpstorm
amqpstorm/management/queue.py
Queue.declare
def declare(self, queue='', virtual_host='/', passive=False, durable=False, auto_delete=False, arguments=None): """Declare a Queue. :param str queue: Queue name :param str virtual_host: Virtual host name :param bool passive: Do not create :param bool durable: Dur...
python
def declare(self, queue='', virtual_host='/', passive=False, durable=False, auto_delete=False, arguments=None): """Declare a Queue. :param str queue: Queue name :param str virtual_host: Virtual host name :param bool passive: Do not create :param bool durable: Dur...
[ "def", "declare", "(", "self", ",", "queue", "=", "''", ",", "virtual_host", "=", "'/'", ",", "passive", "=", "False", ",", "durable", "=", "False", ",", "auto_delete", "=", "False", ",", "arguments", "=", "None", ")", ":", "if", "passive", ":", "ret...
Declare a Queue. :param str queue: Queue name :param str virtual_host: Virtual host name :param bool passive: Do not create :param bool durable: Durable queue :param bool auto_delete: Automatically delete when not in use :param dict|None arguments: Queue key/value argume...
[ "Declare", "a", "Queue", "." ]
train
https://github.com/eandersson/amqpstorm/blob/38330906c0af19eea482f43c5ce79bab98a1e064/amqpstorm/management/queue.py#L52-L84
eandersson/amqpstorm
amqpstorm/management/queue.py
Queue.delete
def delete(self, queue, virtual_host='/'): """Delete a Queue. :param str queue: Queue name :param str virtual_host: Virtual host name :raises ApiError: Raises if the remote server encountered an error. :raises ApiConnectionError: Raises if there was a connectivity issue. ...
python
def delete(self, queue, virtual_host='/'): """Delete a Queue. :param str queue: Queue name :param str virtual_host: Virtual host name :raises ApiError: Raises if the remote server encountered an error. :raises ApiConnectionError: Raises if there was a connectivity issue. ...
[ "def", "delete", "(", "self", ",", "queue", ",", "virtual_host", "=", "'/'", ")", ":", "virtual_host", "=", "quote", "(", "virtual_host", ",", "''", ")", "return", "self", ".", "http_client", ".", "delete", "(", "API_QUEUE", "%", "(", "virtual_host", ","...
Delete a Queue. :param str queue: Queue name :param str virtual_host: Virtual host name :raises ApiError: Raises if the remote server encountered an error. :raises ApiConnectionError: Raises if there was a connectivity issue. :rtype: dict
[ "Delete", "a", "Queue", "." ]
train
https://github.com/eandersson/amqpstorm/blob/38330906c0af19eea482f43c5ce79bab98a1e064/amqpstorm/management/queue.py#L86-L102
eandersson/amqpstorm
amqpstorm/management/queue.py
Queue.purge
def purge(self, queue, virtual_host='/'): """Purge a Queue. :param str queue: Queue name :param str virtual_host: Virtual host name :raises ApiError: Raises if the remote server encountered an error. :raises ApiConnectionError: Raises if there was a connectivity issue. ...
python
def purge(self, queue, virtual_host='/'): """Purge a Queue. :param str queue: Queue name :param str virtual_host: Virtual host name :raises ApiError: Raises if the remote server encountered an error. :raises ApiConnectionError: Raises if there was a connectivity issue. ...
[ "def", "purge", "(", "self", ",", "queue", ",", "virtual_host", "=", "'/'", ")", ":", "virtual_host", "=", "quote", "(", "virtual_host", ",", "''", ")", "return", "self", ".", "http_client", ".", "delete", "(", "API_QUEUE_PURGE", "%", "(", "virtual_host", ...
Purge a Queue. :param str queue: Queue name :param str virtual_host: Virtual host name :raises ApiError: Raises if the remote server encountered an error. :raises ApiConnectionError: Raises if there was a connectivity issue. :rtype: None
[ "Purge", "a", "Queue", "." ]
train
https://github.com/eandersson/amqpstorm/blob/38330906c0af19eea482f43c5ce79bab98a1e064/amqpstorm/management/queue.py#L104-L120
eandersson/amqpstorm
amqpstorm/management/queue.py
Queue.bindings
def bindings(self, queue, virtual_host='/'): """Get Queue bindings. :param str queue: Queue name :param str virtual_host: Virtual host name :raises ApiError: Raises if the remote server encountered an error. :raises ApiConnectionError: Raises if there was a connectivity issue. ...
python
def bindings(self, queue, virtual_host='/'): """Get Queue bindings. :param str queue: Queue name :param str virtual_host: Virtual host name :raises ApiError: Raises if the remote server encountered an error. :raises ApiConnectionError: Raises if there was a connectivity issue. ...
[ "def", "bindings", "(", "self", ",", "queue", ",", "virtual_host", "=", "'/'", ")", ":", "virtual_host", "=", "quote", "(", "virtual_host", ",", "''", ")", "return", "self", ".", "http_client", ".", "get", "(", "API_QUEUE_BINDINGS", "%", "(", "virtual_host...
Get Queue bindings. :param str queue: Queue name :param str virtual_host: Virtual host name :raises ApiError: Raises if the remote server encountered an error. :raises ApiConnectionError: Raises if there was a connectivity issue. :rtype: list
[ "Get", "Queue", "bindings", "." ]
train
https://github.com/eandersson/amqpstorm/blob/38330906c0af19eea482f43c5ce79bab98a1e064/amqpstorm/management/queue.py#L122-L138
eandersson/amqpstorm
amqpstorm/management/queue.py
Queue.bind
def bind(self, queue='', exchange='', routing_key='', virtual_host='/', arguments=None): """Bind a Queue. :param str queue: Queue name :param str exchange: Exchange name :param str routing_key: The routing key to use :param str virtual_host: Virtual host name ...
python
def bind(self, queue='', exchange='', routing_key='', virtual_host='/', arguments=None): """Bind a Queue. :param str queue: Queue name :param str exchange: Exchange name :param str routing_key: The routing key to use :param str virtual_host: Virtual host name ...
[ "def", "bind", "(", "self", ",", "queue", "=", "''", ",", "exchange", "=", "''", ",", "routing_key", "=", "''", ",", "virtual_host", "=", "'/'", ",", "arguments", "=", "None", ")", ":", "bind_payload", "=", "json", ".", "dumps", "(", "{", "'destinati...
Bind a Queue. :param str queue: Queue name :param str exchange: Exchange name :param str routing_key: The routing key to use :param str virtual_host: Virtual host name :param dict|None arguments: Bind key/value arguments :raises ApiError: Raises if the remote server enc...
[ "Bind", "a", "Queue", "." ]
train
https://github.com/eandersson/amqpstorm/blob/38330906c0af19eea482f43c5ce79bab98a1e064/amqpstorm/management/queue.py#L140-L170
eandersson/amqpstorm
amqpstorm/management/queue.py
Queue.unbind
def unbind(self, queue='', exchange='', routing_key='', virtual_host='/', properties_key=None): """Unbind a Queue. :param str queue: Queue name :param str exchange: Exchange name :param str routing_key: The routing key to use :param str virtual_host: Virtual host ...
python
def unbind(self, queue='', exchange='', routing_key='', virtual_host='/', properties_key=None): """Unbind a Queue. :param str queue: Queue name :param str exchange: Exchange name :param str routing_key: The routing key to use :param str virtual_host: Virtual host ...
[ "def", "unbind", "(", "self", ",", "queue", "=", "''", ",", "exchange", "=", "''", ",", "routing_key", "=", "''", ",", "virtual_host", "=", "'/'", ",", "properties_key", "=", "None", ")", ":", "unbind_payload", "=", "json", ".", "dumps", "(", "{", "'...
Unbind a Queue. :param str queue: Queue name :param str exchange: Exchange name :param str routing_key: The routing key to use :param str virtual_host: Virtual host name :param str properties_key: :raises ApiError: Raises if the remote server encountered an error. ...
[ "Unbind", "a", "Queue", "." ]
train
https://github.com/eandersson/amqpstorm/blob/38330906c0af19eea482f43c5ce79bab98a1e064/amqpstorm/management/queue.py#L172-L202
eandersson/amqpstorm
amqpstorm/management/exchange.py
Exchange.get
def get(self, exchange, virtual_host='/'): """Get Exchange details. :param str exchange: Exchange name :param str virtual_host: Virtual host name :raises ApiError: Raises if the remote server encountered an error. :raises ApiConnectionError: Raises if there was a connectivity i...
python
def get(self, exchange, virtual_host='/'): """Get Exchange details. :param str exchange: Exchange name :param str virtual_host: Virtual host name :raises ApiError: Raises if the remote server encountered an error. :raises ApiConnectionError: Raises if there was a connectivity i...
[ "def", "get", "(", "self", ",", "exchange", ",", "virtual_host", "=", "'/'", ")", ":", "virtual_host", "=", "quote", "(", "virtual_host", ",", "''", ")", "return", "self", ".", "http_client", ".", "get", "(", "API_EXCHANGE", "%", "(", "virtual_host", ","...
Get Exchange details. :param str exchange: Exchange name :param str virtual_host: Virtual host name :raises ApiError: Raises if the remote server encountered an error. :raises ApiConnectionError: Raises if there was a connectivity issue. :rtype: dict
[ "Get", "Exchange", "details", "." ]
train
https://github.com/eandersson/amqpstorm/blob/38330906c0af19eea482f43c5ce79bab98a1e064/amqpstorm/management/exchange.py#L14-L31
eandersson/amqpstorm
amqpstorm/management/exchange.py
Exchange.list
def list(self, virtual_host='/', show_all=False): """List Exchanges. :param str virtual_host: Virtual host name :param bool show_all: List all Exchanges :raises ApiError: Raises if the remote server encountered an error. :raises ApiConnectionError: Raises if there was a connect...
python
def list(self, virtual_host='/', show_all=False): """List Exchanges. :param str virtual_host: Virtual host name :param bool show_all: List all Exchanges :raises ApiError: Raises if the remote server encountered an error. :raises ApiConnectionError: Raises if there was a connect...
[ "def", "list", "(", "self", ",", "virtual_host", "=", "'/'", ",", "show_all", "=", "False", ")", ":", "if", "show_all", ":", "return", "self", ".", "http_client", ".", "get", "(", "API_EXCHANGES", ")", "virtual_host", "=", "quote", "(", "virtual_host", "...
List Exchanges. :param str virtual_host: Virtual host name :param bool show_all: List all Exchanges :raises ApiError: Raises if the remote server encountered an error. :raises ApiConnectionError: Raises if there was a connectivity issue. :rtype: list
[ "List", "Exchanges", "." ]
train
https://github.com/eandersson/amqpstorm/blob/38330906c0af19eea482f43c5ce79bab98a1e064/amqpstorm/management/exchange.py#L33-L49
eandersson/amqpstorm
amqpstorm/management/exchange.py
Exchange.declare
def declare(self, exchange='', exchange_type='direct', virtual_host='/', passive=False, durable=False, auto_delete=False, internal=False, arguments=None): """Declare an Exchange. :param str exchange: Exchange name :param str exchange_type: Exchange type :...
python
def declare(self, exchange='', exchange_type='direct', virtual_host='/', passive=False, durable=False, auto_delete=False, internal=False, arguments=None): """Declare an Exchange. :param str exchange: Exchange name :param str exchange_type: Exchange type :...
[ "def", "declare", "(", "self", ",", "exchange", "=", "''", ",", "exchange_type", "=", "'direct'", ",", "virtual_host", "=", "'/'", ",", "passive", "=", "False", ",", "durable", "=", "False", ",", "auto_delete", "=", "False", ",", "internal", "=", "False"...
Declare an Exchange. :param str exchange: Exchange name :param str exchange_type: Exchange type :param str virtual_host: Virtual host name :param bool passive: Do not create :param bool durable: Durable exchange :param bool auto_delete: Automatically delete when not in u...
[ "Declare", "an", "Exchange", "." ]
train
https://github.com/eandersson/amqpstorm/blob/38330906c0af19eea482f43c5ce79bab98a1e064/amqpstorm/management/exchange.py#L51-L87
eandersson/amqpstorm
amqpstorm/management/exchange.py
Exchange.delete
def delete(self, exchange, virtual_host='/'): """Delete an Exchange. :param str exchange: Exchange name :param str virtual_host: Virtual host name :raises ApiError: Raises if the remote server encountered an error. :raises ApiConnectionError: Raises if there was a connectivity ...
python
def delete(self, exchange, virtual_host='/'): """Delete an Exchange. :param str exchange: Exchange name :param str virtual_host: Virtual host name :raises ApiError: Raises if the remote server encountered an error. :raises ApiConnectionError: Raises if there was a connectivity ...
[ "def", "delete", "(", "self", ",", "exchange", ",", "virtual_host", "=", "'/'", ")", ":", "virtual_host", "=", "quote", "(", "virtual_host", ",", "''", ")", "return", "self", ".", "http_client", ".", "delete", "(", "API_EXCHANGE", "%", "(", "virtual_host",...
Delete an Exchange. :param str exchange: Exchange name :param str virtual_host: Virtual host name :raises ApiError: Raises if the remote server encountered an error. :raises ApiConnectionError: Raises if there was a connectivity issue. :rtype: dict
[ "Delete", "an", "Exchange", "." ]
train
https://github.com/eandersson/amqpstorm/blob/38330906c0af19eea482f43c5ce79bab98a1e064/amqpstorm/management/exchange.py#L89-L105
eandersson/amqpstorm
amqpstorm/management/exchange.py
Exchange.bindings
def bindings(self, exchange, virtual_host='/'): """Get Exchange bindings. :param str exchange: Exchange name :param str virtual_host: Virtual host name :raises ApiError: Raises if the remote server encountered an error. :raises ApiConnectionError: Raises if there was a connecti...
python
def bindings(self, exchange, virtual_host='/'): """Get Exchange bindings. :param str exchange: Exchange name :param str virtual_host: Virtual host name :raises ApiError: Raises if the remote server encountered an error. :raises ApiConnectionError: Raises if there was a connecti...
[ "def", "bindings", "(", "self", ",", "exchange", ",", "virtual_host", "=", "'/'", ")", ":", "virtual_host", "=", "quote", "(", "virtual_host", ",", "''", ")", "return", "self", ".", "http_client", ".", "get", "(", "API_EXCHANGE_BINDINGS", "%", "(", "virtua...
Get Exchange bindings. :param str exchange: Exchange name :param str virtual_host: Virtual host name :raises ApiError: Raises if the remote server encountered an error. :raises ApiConnectionError: Raises if there was a connectivity issue. :rtype: list
[ "Get", "Exchange", "bindings", "." ]
train
https://github.com/eandersson/amqpstorm/blob/38330906c0af19eea482f43c5ce79bab98a1e064/amqpstorm/management/exchange.py#L107-L123
eandersson/amqpstorm
amqpstorm/management/exchange.py
Exchange.bind
def bind(self, destination='', source='', routing_key='', virtual_host='/', arguments=None): """Bind an Exchange. :param str source: Source Exchange name :param str destination: Destination Exchange name :param str routing_key: The routing key to use :param str virt...
python
def bind(self, destination='', source='', routing_key='', virtual_host='/', arguments=None): """Bind an Exchange. :param str source: Source Exchange name :param str destination: Destination Exchange name :param str routing_key: The routing key to use :param str virt...
[ "def", "bind", "(", "self", ",", "destination", "=", "''", ",", "source", "=", "''", ",", "routing_key", "=", "''", ",", "virtual_host", "=", "'/'", ",", "arguments", "=", "None", ")", ":", "bind_payload", "=", "json", ".", "dumps", "(", "{", "'desti...
Bind an Exchange. :param str source: Source Exchange name :param str destination: Destination Exchange name :param str routing_key: The routing key to use :param str virtual_host: Virtual host name :param dict|None arguments: Bind key/value arguments :raises ApiError: R...
[ "Bind", "an", "Exchange", "." ]
train
https://github.com/eandersson/amqpstorm/blob/38330906c0af19eea482f43c5ce79bab98a1e064/amqpstorm/management/exchange.py#L125-L155
eandersson/amqpstorm
amqpstorm/management/exchange.py
Exchange.unbind
def unbind(self, destination='', source='', routing_key='', virtual_host='/', properties_key=None): """Unbind an Exchange. :param str source: Source Exchange name :param str destination: Destination Exchange name :param str routing_key: The routing key to use :par...
python
def unbind(self, destination='', source='', routing_key='', virtual_host='/', properties_key=None): """Unbind an Exchange. :param str source: Source Exchange name :param str destination: Destination Exchange name :param str routing_key: The routing key to use :par...
[ "def", "unbind", "(", "self", ",", "destination", "=", "''", ",", "source", "=", "''", ",", "routing_key", "=", "''", ",", "virtual_host", "=", "'/'", ",", "properties_key", "=", "None", ")", ":", "unbind_payload", "=", "json", ".", "dumps", "(", "{", ...
Unbind an Exchange. :param str source: Source Exchange name :param str destination: Destination Exchange name :param str routing_key: The routing key to use :param str virtual_host: Virtual host name :param str properties_key: :raises ApiError: Raises if the remote serv...
[ "Unbind", "an", "Exchange", "." ]
train
https://github.com/eandersson/amqpstorm/blob/38330906c0af19eea482f43c5ce79bab98a1e064/amqpstorm/management/exchange.py#L157-L187
eandersson/amqpstorm
amqpstorm/connection.py
Connection.channel
def channel(self, rpc_timeout=60, lazy=False): """Open Channel. :param int rpc_timeout: Timeout before we give up waiting for an RPC response from the server. :raises AMQPInvalidArgument: Invalid Parameters :raises AMQPChannelError: Raises if the channel...
python
def channel(self, rpc_timeout=60, lazy=False): """Open Channel. :param int rpc_timeout: Timeout before we give up waiting for an RPC response from the server. :raises AMQPInvalidArgument: Invalid Parameters :raises AMQPChannelError: Raises if the channel...
[ "def", "channel", "(", "self", ",", "rpc_timeout", "=", "60", ",", "lazy", "=", "False", ")", ":", "LOGGER", ".", "debug", "(", "'Opening a new Channel'", ")", "if", "not", "compatibility", ".", "is_integer", "(", "rpc_timeout", ")", ":", "raise", "AMQPInv...
Open Channel. :param int rpc_timeout: Timeout before we give up waiting for an RPC response from the server. :raises AMQPInvalidArgument: Invalid Parameters :raises AMQPChannelError: Raises if the channel encountered an error. :raises AMQPConnectionError...
[ "Open", "Channel", "." ]
train
https://github.com/eandersson/amqpstorm/blob/38330906c0af19eea482f43c5ce79bab98a1e064/amqpstorm/connection.py#L145-L170
eandersson/amqpstorm
amqpstorm/connection.py
Connection.check_for_errors
def check_for_errors(self): """Check Connection for errors. :raises AMQPConnectionError: Raises if the connection encountered an error. :return: """ if not self.exceptions: if not self.is_closed: return ...
python
def check_for_errors(self): """Check Connection for errors. :raises AMQPConnectionError: Raises if the connection encountered an error. :return: """ if not self.exceptions: if not self.is_closed: return ...
[ "def", "check_for_errors", "(", "self", ")", ":", "if", "not", "self", ".", "exceptions", ":", "if", "not", "self", ".", "is_closed", ":", "return", "why", "=", "AMQPConnectionError", "(", "'connection was closed'", ")", "self", ".", "exceptions", ".", "appe...
Check Connection for errors. :raises AMQPConnectionError: Raises if the connection encountered an error. :return:
[ "Check", "Connection", "for", "errors", "." ]
train
https://github.com/eandersson/amqpstorm/blob/38330906c0af19eea482f43c5ce79bab98a1e064/amqpstorm/connection.py#L172-L186
eandersson/amqpstorm
amqpstorm/connection.py
Connection.close
def close(self): """Close connection. :raises AMQPConnectionError: Raises if the connection encountered an error. :return: """ LOGGER.debug('Connection Closing') if not self.is_closed: self.set_state(self.CLOSING) ...
python
def close(self): """Close connection. :raises AMQPConnectionError: Raises if the connection encountered an error. :return: """ LOGGER.debug('Connection Closing') if not self.is_closed: self.set_state(self.CLOSING) ...
[ "def", "close", "(", "self", ")", ":", "LOGGER", ".", "debug", "(", "'Connection Closing'", ")", "if", "not", "self", ".", "is_closed", ":", "self", ".", "set_state", "(", "self", ".", "CLOSING", ")", "self", ".", "heartbeat", ".", "stop", "(", ")", ...
Close connection. :raises AMQPConnectionError: Raises if the connection encountered an error. :return:
[ "Close", "connection", "." ]
train
https://github.com/eandersson/amqpstorm/blob/38330906c0af19eea482f43c5ce79bab98a1e064/amqpstorm/connection.py#L188-L209
eandersson/amqpstorm
amqpstorm/connection.py
Connection.open
def open(self): """Open Connection. :raises AMQPConnectionError: Raises if the connection encountered an error. """ LOGGER.debug('Connection Opening') self.set_state(self.OPENING) self._exceptions = [] self._channels = {} ...
python
def open(self): """Open Connection. :raises AMQPConnectionError: Raises if the connection encountered an error. """ LOGGER.debug('Connection Opening') self.set_state(self.OPENING) self._exceptions = [] self._channels = {} ...
[ "def", "open", "(", "self", ")", ":", "LOGGER", ".", "debug", "(", "'Connection Opening'", ")", "self", ".", "set_state", "(", "self", ".", "OPENING", ")", "self", ".", "_exceptions", "=", "[", "]", "self", ".", "_channels", "=", "{", "}", "self", "....
Open Connection. :raises AMQPConnectionError: Raises if the connection encountered an error.
[ "Open", "Connection", "." ]
train
https://github.com/eandersson/amqpstorm/blob/38330906c0af19eea482f43c5ce79bab98a1e064/amqpstorm/connection.py#L211-L226
eandersson/amqpstorm
amqpstorm/connection.py
Connection.write_frame
def write_frame(self, channel_id, frame_out): """Marshal and write an outgoing pamqp frame to the Socket. :param int channel_id: Channel ID. :param specification.Frame frame_out: Amqp frame. :return: """ frame_data = pamqp_frame.marshal(frame_out, channel_id) se...
python
def write_frame(self, channel_id, frame_out): """Marshal and write an outgoing pamqp frame to the Socket. :param int channel_id: Channel ID. :param specification.Frame frame_out: Amqp frame. :return: """ frame_data = pamqp_frame.marshal(frame_out, channel_id) se...
[ "def", "write_frame", "(", "self", ",", "channel_id", ",", "frame_out", ")", ":", "frame_data", "=", "pamqp_frame", ".", "marshal", "(", "frame_out", ",", "channel_id", ")", "self", ".", "heartbeat", ".", "register_write", "(", ")", "self", ".", "_io", "."...
Marshal and write an outgoing pamqp frame to the Socket. :param int channel_id: Channel ID. :param specification.Frame frame_out: Amqp frame. :return:
[ "Marshal", "and", "write", "an", "outgoing", "pamqp", "frame", "to", "the", "Socket", "." ]
train
https://github.com/eandersson/amqpstorm/blob/38330906c0af19eea482f43c5ce79bab98a1e064/amqpstorm/connection.py#L228-L238
eandersson/amqpstorm
amqpstorm/connection.py
Connection.write_frames
def write_frames(self, channel_id, frames_out): """Marshal and write multiple outgoing pamqp frames to the Socket. :param int channel_id: Channel ID/ :param list frames_out: Amqp frames. :return: """ data_out = EMPTY_BUFFER for single_frame in frames_out: ...
python
def write_frames(self, channel_id, frames_out): """Marshal and write multiple outgoing pamqp frames to the Socket. :param int channel_id: Channel ID/ :param list frames_out: Amqp frames. :return: """ data_out = EMPTY_BUFFER for single_frame in frames_out: ...
[ "def", "write_frames", "(", "self", ",", "channel_id", ",", "frames_out", ")", ":", "data_out", "=", "EMPTY_BUFFER", "for", "single_frame", "in", "frames_out", ":", "data_out", "+=", "pamqp_frame", ".", "marshal", "(", "single_frame", ",", "channel_id", ")", "...
Marshal and write multiple outgoing pamqp frames to the Socket. :param int channel_id: Channel ID/ :param list frames_out: Amqp frames. :return:
[ "Marshal", "and", "write", "multiple", "outgoing", "pamqp", "frames", "to", "the", "Socket", "." ]
train
https://github.com/eandersson/amqpstorm/blob/38330906c0af19eea482f43c5ce79bab98a1e064/amqpstorm/connection.py#L240-L252
eandersson/amqpstorm
amqpstorm/connection.py
Connection._close_remaining_channels
def _close_remaining_channels(self): """Forcefully close all open channels. :return: """ for channel_id in list(self._channels): self._channels[channel_id].set_state(Channel.CLOSED) self._channels[channel_id].close() self._cleanup_channel(channel_id)
python
def _close_remaining_channels(self): """Forcefully close all open channels. :return: """ for channel_id in list(self._channels): self._channels[channel_id].set_state(Channel.CLOSED) self._channels[channel_id].close() self._cleanup_channel(channel_id)
[ "def", "_close_remaining_channels", "(", "self", ")", ":", "for", "channel_id", "in", "list", "(", "self", ".", "_channels", ")", ":", "self", ".", "_channels", "[", "channel_id", "]", ".", "set_state", "(", "Channel", ".", "CLOSED", ")", "self", ".", "_...
Forcefully close all open channels. :return:
[ "Forcefully", "close", "all", "open", "channels", "." ]
train
https://github.com/eandersson/amqpstorm/blob/38330906c0af19eea482f43c5ce79bab98a1e064/amqpstorm/connection.py#L254-L262
eandersson/amqpstorm
amqpstorm/connection.py
Connection._get_next_available_channel_id
def _get_next_available_channel_id(self): """Returns the next available available channel id. :raises AMQPConnectionError: Raises if there is no available channel. :rtype: int """ for index in compatibility.RANGE(self._last_channel_id or 1, ...
python
def _get_next_available_channel_id(self): """Returns the next available available channel id. :raises AMQPConnectionError: Raises if there is no available channel. :rtype: int """ for index in compatibility.RANGE(self._last_channel_id or 1, ...
[ "def", "_get_next_available_channel_id", "(", "self", ")", ":", "for", "index", "in", "compatibility", ".", "RANGE", "(", "self", ".", "_last_channel_id", "or", "1", ",", "self", ".", "max_allowed_channels", "+", "1", ")", ":", "if", "index", "in", "self", ...
Returns the next available available channel id. :raises AMQPConnectionError: Raises if there is no available channel. :rtype: int
[ "Returns", "the", "next", "available", "available", "channel", "id", ".", ":", "raises", "AMQPConnectionError", ":", "Raises", "if", "there", "is", "no", "available", "channel", ".", ":", "rtype", ":", "int" ]
train
https://github.com/eandersson/amqpstorm/blob/38330906c0af19eea482f43c5ce79bab98a1e064/amqpstorm/connection.py#L264-L282
eandersson/amqpstorm
amqpstorm/connection.py
Connection._handle_amqp_frame
def _handle_amqp_frame(self, data_in): """Unmarshal a single AMQP frame and return the result. :param data_in: socket data :return: data_in, channel_id, frame """ if not data_in: return data_in, None, None try: byte_count, channel_id, frame_in = ...
python
def _handle_amqp_frame(self, data_in): """Unmarshal a single AMQP frame and return the result. :param data_in: socket data :return: data_in, channel_id, frame """ if not data_in: return data_in, None, None try: byte_count, channel_id, frame_in = ...
[ "def", "_handle_amqp_frame", "(", "self", ",", "data_in", ")", ":", "if", "not", "data_in", ":", "return", "data_in", ",", "None", ",", "None", "try", ":", "byte_count", ",", "channel_id", ",", "frame_in", "=", "pamqp_frame", ".", "unmarshal", "(", "data_i...
Unmarshal a single AMQP frame and return the result. :param data_in: socket data :return: data_in, channel_id, frame
[ "Unmarshal", "a", "single", "AMQP", "frame", "and", "return", "the", "result", "." ]
train
https://github.com/eandersson/amqpstorm/blob/38330906c0af19eea482f43c5ce79bab98a1e064/amqpstorm/connection.py#L284-L303
eandersson/amqpstorm
amqpstorm/connection.py
Connection._read_buffer
def _read_buffer(self, data_in): """Process the socket buffer, and direct the data to the appropriate channel. :rtype: bytes """ while data_in: data_in, channel_id, frame_in = self._handle_amqp_frame(data_in) if frame_in is None: break ...
python
def _read_buffer(self, data_in): """Process the socket buffer, and direct the data to the appropriate channel. :rtype: bytes """ while data_in: data_in, channel_id, frame_in = self._handle_amqp_frame(data_in) if frame_in is None: break ...
[ "def", "_read_buffer", "(", "self", ",", "data_in", ")", ":", "while", "data_in", ":", "data_in", ",", "channel_id", ",", "frame_in", "=", "self", ".", "_handle_amqp_frame", "(", "data_in", ")", "if", "frame_in", "is", "None", ":", "break", "self", ".", ...
Process the socket buffer, and direct the data to the appropriate channel. :rtype: bytes
[ "Process", "the", "socket", "buffer", "and", "direct", "the", "data", "to", "the", "appropriate", "channel", "." ]
train
https://github.com/eandersson/amqpstorm/blob/38330906c0af19eea482f43c5ce79bab98a1e064/amqpstorm/connection.py#L305-L323
eandersson/amqpstorm
amqpstorm/connection.py
Connection._cleanup_channel
def _cleanup_channel(self, channel_id): """Remove the the channel from the list of available channels. :param int channel_id: Channel id :return: """ with self.lock: if channel_id not in self._channels: return del self._channels[channel_i...
python
def _cleanup_channel(self, channel_id): """Remove the the channel from the list of available channels. :param int channel_id: Channel id :return: """ with self.lock: if channel_id not in self._channels: return del self._channels[channel_i...
[ "def", "_cleanup_channel", "(", "self", ",", "channel_id", ")", ":", "with", "self", ".", "lock", ":", "if", "channel_id", "not", "in", "self", ".", "_channels", ":", "return", "del", "self", ".", "_channels", "[", "channel_id", "]" ]
Remove the the channel from the list of available channels. :param int channel_id: Channel id :return:
[ "Remove", "the", "the", "channel", "from", "the", "list", "of", "available", "channels", "." ]
train
https://github.com/eandersson/amqpstorm/blob/38330906c0af19eea482f43c5ce79bab98a1e064/amqpstorm/connection.py#L325-L335
eandersson/amqpstorm
amqpstorm/connection.py
Connection._validate_parameters
def _validate_parameters(self): """Validate Connection Parameters. :return: """ if not compatibility.is_string(self.parameters['hostname']): raise AMQPInvalidArgument('hostname should be a string') elif not compatibility.is_integer(self.parameters['port']): ...
python
def _validate_parameters(self): """Validate Connection Parameters. :return: """ if not compatibility.is_string(self.parameters['hostname']): raise AMQPInvalidArgument('hostname should be a string') elif not compatibility.is_integer(self.parameters['port']): ...
[ "def", "_validate_parameters", "(", "self", ")", ":", "if", "not", "compatibility", ".", "is_string", "(", "self", ".", "parameters", "[", "'hostname'", "]", ")", ":", "raise", "AMQPInvalidArgument", "(", "'hostname should be a string'", ")", "elif", "not", "com...
Validate Connection Parameters. :return:
[ "Validate", "Connection", "Parameters", "." ]
train
https://github.com/eandersson/amqpstorm/blob/38330906c0af19eea482f43c5ce79bab98a1e064/amqpstorm/connection.py#L344-L362
eandersson/amqpstorm
amqpstorm/connection.py
Connection._wait_for_connection_state
def _wait_for_connection_state(self, state=Stateful.OPEN, rpc_timeout=30): """Wait for a Connection state. :param int state: State that we expect :raises AMQPConnectionError: Raises if we are unable to establish a connection to RabbitMQ. :return: ...
python
def _wait_for_connection_state(self, state=Stateful.OPEN, rpc_timeout=30): """Wait for a Connection state. :param int state: State that we expect :raises AMQPConnectionError: Raises if we are unable to establish a connection to RabbitMQ. :return: ...
[ "def", "_wait_for_connection_state", "(", "self", ",", "state", "=", "Stateful", ".", "OPEN", ",", "rpc_timeout", "=", "30", ")", ":", "start_time", "=", "time", ".", "time", "(", ")", "while", "self", ".", "current_state", "!=", "state", ":", "self", "....
Wait for a Connection state. :param int state: State that we expect :raises AMQPConnectionError: Raises if we are unable to establish a connection to RabbitMQ. :return:
[ "Wait", "for", "a", "Connection", "state", "." ]
train
https://github.com/eandersson/amqpstorm/blob/38330906c0af19eea482f43c5ce79bab98a1e064/amqpstorm/connection.py#L364-L379
eandersson/amqpstorm
examples/robust_consumer.py
Consumer.create_connection
def create_connection(self): """Create a connection. :return: """ attempts = 0 while True: attempts += 1 try: self.connection = Connection('127.0.0.1', 'guest', 'guest') break except amqpstorm.AMQPError as why: ...
python
def create_connection(self): """Create a connection. :return: """ attempts = 0 while True: attempts += 1 try: self.connection = Connection('127.0.0.1', 'guest', 'guest') break except amqpstorm.AMQPError as why: ...
[ "def", "create_connection", "(", "self", ")", ":", "attempts", "=", "0", "while", "True", ":", "attempts", "+=", "1", "try", ":", "self", ".", "connection", "=", "Connection", "(", "'127.0.0.1'", ",", "'guest'", ",", "'guest'", ")", "break", "except", "a...
Create a connection. :return:
[ "Create", "a", "connection", "." ]
train
https://github.com/eandersson/amqpstorm/blob/38330906c0af19eea482f43c5ce79bab98a1e064/examples/robust_consumer.py#L20-L37
eandersson/amqpstorm
examples/robust_consumer.py
Consumer.start
def start(self): """Start the Consumers. :return: """ if not self.connection: self.create_connection() while True: try: channel = self.connection.channel() channel.queue.declare('simple_queue') channel.basic...
python
def start(self): """Start the Consumers. :return: """ if not self.connection: self.create_connection() while True: try: channel = self.connection.channel() channel.queue.declare('simple_queue') channel.basic...
[ "def", "start", "(", "self", ")", ":", "if", "not", "self", ".", "connection", ":", "self", ".", "create_connection", "(", ")", "while", "True", ":", "try", ":", "channel", "=", "self", ".", "connection", ".", "channel", "(", ")", "channel", ".", "qu...
Start the Consumers. :return:
[ "Start", "the", "Consumers", "." ]
train
https://github.com/eandersson/amqpstorm/blob/38330906c0af19eea482f43c5ce79bab98a1e064/examples/robust_consumer.py#L39-L59
eandersson/amqpstorm
examples/scalable_consumer.py
ScalableConsumer.stop
def stop(self): """Stop all consumers. :return: """ while self._consumers: consumer = self._consumers.pop() consumer.stop() self._stopped.set() self._connection.close()
python
def stop(self): """Stop all consumers. :return: """ while self._consumers: consumer = self._consumers.pop() consumer.stop() self._stopped.set() self._connection.close()
[ "def", "stop", "(", "self", ")", ":", "while", "self", ".", "_consumers", ":", "consumer", "=", "self", ".", "_consumers", ".", "pop", "(", ")", "consumer", ".", "stop", "(", ")", "self", ".", "_stopped", ".", "set", "(", ")", "self", ".", "_connec...
Stop all consumers. :return:
[ "Stop", "all", "consumers", "." ]
train
https://github.com/eandersson/amqpstorm/blob/38330906c0af19eea482f43c5ce79bab98a1e064/examples/scalable_consumer.py#L69-L78
eandersson/amqpstorm
examples/scalable_consumer.py
ScalableConsumer._create_connection
def _create_connection(self): """Create a connection. :return: """ attempts = 0 while True: attempts += 1 if self._stopped.is_set(): break try: self._connection = Connection(self.hostname, ...
python
def _create_connection(self): """Create a connection. :return: """ attempts = 0 while True: attempts += 1 if self._stopped.is_set(): break try: self._connection = Connection(self.hostname, ...
[ "def", "_create_connection", "(", "self", ")", ":", "attempts", "=", "0", "while", "True", ":", "attempts", "+=", "1", "if", "self", ".", "_stopped", ".", "is_set", "(", ")", ":", "break", "try", ":", "self", ".", "_connection", "=", "Connection", "(",...
Create a connection. :return:
[ "Create", "a", "connection", "." ]
train
https://github.com/eandersson/amqpstorm/blob/38330906c0af19eea482f43c5ce79bab98a1e064/examples/scalable_consumer.py#L80-L101
eandersson/amqpstorm
examples/scalable_consumer.py
ScalableConsumer._stop_consumers
def _stop_consumers(self, number_of_consumers=0): """Stop a specific number of consumers. :param number_of_consumers: :return: """ while len(self._consumers) > number_of_consumers: consumer = self._consumers.pop() consumer.stop()
python
def _stop_consumers(self, number_of_consumers=0): """Stop a specific number of consumers. :param number_of_consumers: :return: """ while len(self._consumers) > number_of_consumers: consumer = self._consumers.pop() consumer.stop()
[ "def", "_stop_consumers", "(", "self", ",", "number_of_consumers", "=", "0", ")", ":", "while", "len", "(", "self", ".", "_consumers", ")", ">", "number_of_consumers", ":", "consumer", "=", "self", ".", "_consumers", ".", "pop", "(", ")", "consumer", ".", ...
Stop a specific number of consumers. :param number_of_consumers: :return:
[ "Stop", "a", "specific", "number", "of", "consumers", "." ]
train
https://github.com/eandersson/amqpstorm/blob/38330906c0af19eea482f43c5ce79bab98a1e064/examples/scalable_consumer.py#L131-L139
eandersson/amqpstorm
examples/scalable_consumer.py
ScalableConsumer._start_consumer
def _start_consumer(self, consumer): """Start a consumer as a new Thread. :param Consumer consumer: :return: """ thread = threading.Thread(target=consumer.start, args=(self._connection,)) thread.daemon = True thread.start()
python
def _start_consumer(self, consumer): """Start a consumer as a new Thread. :param Consumer consumer: :return: """ thread = threading.Thread(target=consumer.start, args=(self._connection,)) thread.daemon = True thread.start()
[ "def", "_start_consumer", "(", "self", ",", "consumer", ")", ":", "thread", "=", "threading", ".", "Thread", "(", "target", "=", "consumer", ".", "start", ",", "args", "=", "(", "self", ".", "_connection", ",", ")", ")", "thread", ".", "daemon", "=", ...
Start a consumer as a new Thread. :param Consumer consumer: :return:
[ "Start", "a", "consumer", "as", "a", "new", "Thread", "." ]
train
https://github.com/eandersson/amqpstorm/blob/38330906c0af19eea482f43c5ce79bab98a1e064/examples/scalable_consumer.py#L141-L150
eandersson/amqpstorm
amqpstorm/tx.py
Tx.select
def select(self): """Enable standard transaction mode. This will enable transaction mode on the channel. Meaning that messages will be kept in the remote server buffer until such a time that either commit or rollback is called. :return: """ self._tx_...
python
def select(self): """Enable standard transaction mode. This will enable transaction mode on the channel. Meaning that messages will be kept in the remote server buffer until such a time that either commit or rollback is called. :return: """ self._tx_...
[ "def", "select", "(", "self", ")", ":", "self", ".", "_tx_active", "=", "True", "return", "self", ".", "_channel", ".", "rpc_request", "(", "specification", ".", "Tx", ".", "Select", "(", ")", ")" ]
Enable standard transaction mode. This will enable transaction mode on the channel. Meaning that messages will be kept in the remote server buffer until such a time that either commit or rollback is called. :return:
[ "Enable", "standard", "transaction", "mode", "." ]
train
https://github.com/eandersson/amqpstorm/blob/38330906c0af19eea482f43c5ce79bab98a1e064/amqpstorm/tx.py#L41-L51
eandersson/amqpstorm
amqpstorm/tx.py
Tx.commit
def commit(self): """Commit the current transaction. Commit all messages published during the current transaction session to the remote server. A new transaction session starts as soon as the command has been executed. :return: """ self....
python
def commit(self): """Commit the current transaction. Commit all messages published during the current transaction session to the remote server. A new transaction session starts as soon as the command has been executed. :return: """ self....
[ "def", "commit", "(", "self", ")", ":", "self", ".", "_tx_active", "=", "False", "return", "self", ".", "_channel", ".", "rpc_request", "(", "specification", ".", "Tx", ".", "Commit", "(", ")", ")" ]
Commit the current transaction. Commit all messages published during the current transaction session to the remote server. A new transaction session starts as soon as the command has been executed. :return:
[ "Commit", "the", "current", "transaction", "." ]
train
https://github.com/eandersson/amqpstorm/blob/38330906c0af19eea482f43c5ce79bab98a1e064/amqpstorm/tx.py#L53-L65
eandersson/amqpstorm
amqpstorm/tx.py
Tx.rollback
def rollback(self): """Abandon the current transaction. Rollback all messages published during the current transaction session to the remote server. Note that all messages published during this transaction session will be lost, and will have to be published agai...
python
def rollback(self): """Abandon the current transaction. Rollback all messages published during the current transaction session to the remote server. Note that all messages published during this transaction session will be lost, and will have to be published agai...
[ "def", "rollback", "(", "self", ")", ":", "self", ".", "_tx_active", "=", "False", "return", "self", ".", "_channel", ".", "rpc_request", "(", "specification", ".", "Tx", ".", "Rollback", "(", ")", ")" ]
Abandon the current transaction. Rollback all messages published during the current transaction session to the remote server. Note that all messages published during this transaction session will be lost, and will have to be published again. A new transacti...
[ "Abandon", "the", "current", "transaction", "." ]
train
https://github.com/eandersson/amqpstorm/blob/38330906c0af19eea482f43c5ce79bab98a1e064/amqpstorm/tx.py#L67-L82
eandersson/amqpstorm
examples/flask_threaded_rpc_client.py
rpc_call
def rpc_call(payload): """Simple Flask implementation for making asynchronous Rpc calls. """ # Send the request and store the requests Unique ID. corr_id = RPC_CLIENT.send_request(payload) # Wait until we have received a response. while RPC_CLIENT.queue[corr_id] is None: sleep(0.1) # ...
python
def rpc_call(payload): """Simple Flask implementation for making asynchronous Rpc calls. """ # Send the request and store the requests Unique ID. corr_id = RPC_CLIENT.send_request(payload) # Wait until we have received a response. while RPC_CLIENT.queue[corr_id] is None: sleep(0.1) # ...
[ "def", "rpc_call", "(", "payload", ")", ":", "# Send the request and store the requests Unique ID.", "corr_id", "=", "RPC_CLIENT", ".", "send_request", "(", "payload", ")", "# Wait until we have received a response.", "while", "RPC_CLIENT", ".", "queue", "[", "corr_id", "...
Simple Flask implementation for making asynchronous Rpc calls.
[ "Simple", "Flask", "implementation", "for", "making", "asynchronous", "Rpc", "calls", "." ]
train
https://github.com/eandersson/amqpstorm/blob/38330906c0af19eea482f43c5ce79bab98a1e064/examples/flask_threaded_rpc_client.py#L73-L84
eandersson/amqpstorm
examples/flask_threaded_rpc_client.py
RpcClient._create_process_thread
def _create_process_thread(self): """Create a thread responsible for consuming messages in response to RPC requests. """ thread = threading.Thread(target=self._process_data_events) thread.setDaemon(True) thread.start()
python
def _create_process_thread(self): """Create a thread responsible for consuming messages in response to RPC requests. """ thread = threading.Thread(target=self._process_data_events) thread.setDaemon(True) thread.start()
[ "def", "_create_process_thread", "(", "self", ")", ":", "thread", "=", "threading", ".", "Thread", "(", "target", "=", "self", ".", "_process_data_events", ")", "thread", ".", "setDaemon", "(", "True", ")", "thread", ".", "start", "(", ")" ]
Create a thread responsible for consuming messages in response to RPC requests.
[ "Create", "a", "thread", "responsible", "for", "consuming", "messages", "in", "response", "to", "RPC", "requests", "." ]
train
https://github.com/eandersson/amqpstorm/blob/38330906c0af19eea482f43c5ce79bab98a1e064/examples/flask_threaded_rpc_client.py#L38-L44
eandersson/amqpstorm
amqpstorm/message.py
Message.create
def create(channel, body, properties=None): """Create a new Message. :param Channel channel: AMQPStorm Channel :param bytes|str|unicode body: Message payload :param dict properties: Message properties :rtype: Message """ properties = properties or {} if ...
python
def create(channel, body, properties=None): """Create a new Message. :param Channel channel: AMQPStorm Channel :param bytes|str|unicode body: Message payload :param dict properties: Message properties :rtype: Message """ properties = properties or {} if ...
[ "def", "create", "(", "channel", ",", "body", ",", "properties", "=", "None", ")", ":", "properties", "=", "properties", "or", "{", "}", "if", "'correlation_id'", "not", "in", "properties", ":", "properties", "[", "'correlation_id'", "]", "=", "str", "(", ...
Create a new Message. :param Channel channel: AMQPStorm Channel :param bytes|str|unicode body: Message payload :param dict properties: Message properties :rtype: Message
[ "Create", "a", "new", "Message", "." ]
train
https://github.com/eandersson/amqpstorm/blob/38330906c0af19eea482f43c5ce79bab98a1e064/amqpstorm/message.py#L32-L50
eandersson/amqpstorm
amqpstorm/message.py
Message.body
def body(self): """Return the Message Body. If auto_decode is enabled, the body will automatically be decoded using decode('utf-8') if possible. :rtype: bytes|str|unicode """ if not self._auto_decode: return self._body if 'body' in self._deco...
python
def body(self): """Return the Message Body. If auto_decode is enabled, the body will automatically be decoded using decode('utf-8') if possible. :rtype: bytes|str|unicode """ if not self._auto_decode: return self._body if 'body' in self._deco...
[ "def", "body", "(", "self", ")", ":", "if", "not", "self", ".", "_auto_decode", ":", "return", "self", ".", "_body", "if", "'body'", "in", "self", ".", "_decode_cache", ":", "return", "self", ".", "_decode_cache", "[", "'body'", "]", "body", "=", "try_...
Return the Message Body. If auto_decode is enabled, the body will automatically be decoded using decode('utf-8') if possible. :rtype: bytes|str|unicode
[ "Return", "the", "Message", "Body", "." ]
train
https://github.com/eandersson/amqpstorm/blob/38330906c0af19eea482f43c5ce79bab98a1e064/amqpstorm/message.py#L53-L67
eandersson/amqpstorm
amqpstorm/message.py
Message.ack
def ack(self): """Acknowledge Message. :raises AMQPInvalidArgument: Invalid Parameters :raises AMQPChannelError: Raises if the channel encountered an error. :raises AMQPConnectionError: Raises if the connection encountered an error. :return:...
python
def ack(self): """Acknowledge Message. :raises AMQPInvalidArgument: Invalid Parameters :raises AMQPChannelError: Raises if the channel encountered an error. :raises AMQPConnectionError: Raises if the connection encountered an error. :return:...
[ "def", "ack", "(", "self", ")", ":", "if", "not", "self", ".", "_method", ":", "raise", "AMQPMessageError", "(", "'Message.ack only available on incoming messages'", ")", "self", ".", "_channel", ".", "basic", ".", "ack", "(", "delivery_tag", "=", "self", ".",...
Acknowledge Message. :raises AMQPInvalidArgument: Invalid Parameters :raises AMQPChannelError: Raises if the channel encountered an error. :raises AMQPConnectionError: Raises if the connection encountered an error. :return:
[ "Acknowledge", "Message", "." ]
train
https://github.com/eandersson/amqpstorm/blob/38330906c0af19eea482f43c5ce79bab98a1e064/amqpstorm/message.py#L99-L113
eandersson/amqpstorm
amqpstorm/message.py
Message.nack
def nack(self, requeue=True): """Negative Acknowledgement. :raises AMQPInvalidArgument: Invalid Parameters :raises AMQPChannelError: Raises if the channel encountered an error. :raises AMQPConnectionError: Raises if the connection encountered an erro...
python
def nack(self, requeue=True): """Negative Acknowledgement. :raises AMQPInvalidArgument: Invalid Parameters :raises AMQPChannelError: Raises if the channel encountered an error. :raises AMQPConnectionError: Raises if the connection encountered an erro...
[ "def", "nack", "(", "self", ",", "requeue", "=", "True", ")", ":", "if", "not", "self", ".", "_method", ":", "raise", "AMQPMessageError", "(", "'Message.nack only available on incoming messages'", ")", "self", ".", "_channel", ".", "basic", ".", "nack", "(", ...
Negative Acknowledgement. :raises AMQPInvalidArgument: Invalid Parameters :raises AMQPChannelError: Raises if the channel encountered an error. :raises AMQPConnectionError: Raises if the connection encountered an error. :param bool requeue: Re-queue...
[ "Negative", "Acknowledgement", "." ]
train
https://github.com/eandersson/amqpstorm/blob/38330906c0af19eea482f43c5ce79bab98a1e064/amqpstorm/message.py#L115-L130
eandersson/amqpstorm
amqpstorm/message.py
Message.publish
def publish(self, routing_key, exchange='', mandatory=False, immediate=False): """Publish Message. :param str routing_key: Message routing key :param str exchange: The exchange to publish the message to :param bool mandatory: Requires the message is published :pa...
python
def publish(self, routing_key, exchange='', mandatory=False, immediate=False): """Publish Message. :param str routing_key: Message routing key :param str exchange: The exchange to publish the message to :param bool mandatory: Requires the message is published :pa...
[ "def", "publish", "(", "self", ",", "routing_key", ",", "exchange", "=", "''", ",", "mandatory", "=", "False", ",", "immediate", "=", "False", ")", ":", "return", "self", ".", "_channel", ".", "basic", ".", "publish", "(", "body", "=", "self", ".", "...
Publish Message. :param str routing_key: Message routing key :param str exchange: The exchange to publish the message to :param bool mandatory: Requires the message is published :param bool immediate: Request immediate delivery :raises AMQPInvalidArgument: Invalid Parameters ...
[ "Publish", "Message", "." ]
train
https://github.com/eandersson/amqpstorm/blob/38330906c0af19eea482f43c5ce79bab98a1e064/amqpstorm/message.py#L149-L170
eandersson/amqpstorm
amqpstorm/message.py
Message._update_properties
def _update_properties(self, name, value): """Update properties, and keep cache up-to-date if auto decode is enabled. :param str name: Key :param obj value: Value :return: """ if self._auto_decode and 'properties' in self._decode_cache: self._decode_c...
python
def _update_properties(self, name, value): """Update properties, and keep cache up-to-date if auto decode is enabled. :param str name: Key :param obj value: Value :return: """ if self._auto_decode and 'properties' in self._decode_cache: self._decode_c...
[ "def", "_update_properties", "(", "self", ",", "name", ",", "value", ")", ":", "if", "self", ".", "_auto_decode", "and", "'properties'", "in", "self", ".", "_decode_cache", ":", "self", ".", "_decode_cache", "[", "'properties'", "]", "[", "name", "]", "=",...
Update properties, and keep cache up-to-date if auto decode is enabled. :param str name: Key :param obj value: Value :return:
[ "Update", "properties", "and", "keep", "cache", "up", "-", "to", "-", "date", "if", "auto", "decode", "is", "enabled", "." ]
train
https://github.com/eandersson/amqpstorm/blob/38330906c0af19eea482f43c5ce79bab98a1e064/amqpstorm/message.py#L344-L354
eandersson/amqpstorm
amqpstorm/message.py
Message._try_decode_utf8_content
def _try_decode_utf8_content(self, content, content_type): """Generic function to decode content. :param object content: :return: """ if not self._auto_decode or not content: return content if content_type in self._decode_cache: return self._decod...
python
def _try_decode_utf8_content(self, content, content_type): """Generic function to decode content. :param object content: :return: """ if not self._auto_decode or not content: return content if content_type in self._decode_cache: return self._decod...
[ "def", "_try_decode_utf8_content", "(", "self", ",", "content", ",", "content_type", ")", ":", "if", "not", "self", ".", "_auto_decode", "or", "not", "content", ":", "return", "content", "if", "content_type", "in", "self", ".", "_decode_cache", ":", "return", ...
Generic function to decode content. :param object content: :return:
[ "Generic", "function", "to", "decode", "content", "." ]
train
https://github.com/eandersson/amqpstorm/blob/38330906c0af19eea482f43c5ce79bab98a1e064/amqpstorm/message.py#L356-L371
eandersson/amqpstorm
amqpstorm/message.py
Message._try_decode_dict
def _try_decode_dict(self, content): """Decode content of a dictionary. :param dict content: :return: """ result = dict() for key, value in content.items(): key = try_utf8_decode(key) if isinstance(value, dict): result[key] = self....
python
def _try_decode_dict(self, content): """Decode content of a dictionary. :param dict content: :return: """ result = dict() for key, value in content.items(): key = try_utf8_decode(key) if isinstance(value, dict): result[key] = self....
[ "def", "_try_decode_dict", "(", "self", ",", "content", ")", ":", "result", "=", "dict", "(", ")", "for", "key", ",", "value", "in", "content", ".", "items", "(", ")", ":", "key", "=", "try_utf8_decode", "(", "key", ")", "if", "isinstance", "(", "val...
Decode content of a dictionary. :param dict content: :return:
[ "Decode", "content", "of", "a", "dictionary", "." ]
train
https://github.com/eandersson/amqpstorm/blob/38330906c0af19eea482f43c5ce79bab98a1e064/amqpstorm/message.py#L373-L390
eandersson/amqpstorm
amqpstorm/message.py
Message._try_decode_list
def _try_decode_list(content): """Decode content of a list. :param list|tuple content: :return: """ result = list() for value in content: result.append(try_utf8_decode(value)) return result
python
def _try_decode_list(content): """Decode content of a list. :param list|tuple content: :return: """ result = list() for value in content: result.append(try_utf8_decode(value)) return result
[ "def", "_try_decode_list", "(", "content", ")", ":", "result", "=", "list", "(", ")", "for", "value", "in", "content", ":", "result", ".", "append", "(", "try_utf8_decode", "(", "value", ")", ")", "return", "result" ]
Decode content of a list. :param list|tuple content: :return:
[ "Decode", "content", "of", "a", "list", "." ]
train
https://github.com/eandersson/amqpstorm/blob/38330906c0af19eea482f43c5ce79bab98a1e064/amqpstorm/message.py#L393-L402
eandersson/amqpstorm
amqpstorm/management/basic.py
Basic.publish
def publish(self, body, routing_key, exchange='amq.default', virtual_host='/', properties=None, payload_encoding='string'): """Publish a Message. :param bytes|str|unicode body: Message payload :param str routing_key: Message routing key :param str exchange: The exchange ...
python
def publish(self, body, routing_key, exchange='amq.default', virtual_host='/', properties=None, payload_encoding='string'): """Publish a Message. :param bytes|str|unicode body: Message payload :param str routing_key: Message routing key :param str exchange: The exchange ...
[ "def", "publish", "(", "self", ",", "body", ",", "routing_key", ",", "exchange", "=", "'amq.default'", ",", "virtual_host", "=", "'/'", ",", "properties", "=", "None", ",", "payload_encoding", "=", "'string'", ")", ":", "exchange", "=", "quote", "(", "exch...
Publish a Message. :param bytes|str|unicode body: Message payload :param str routing_key: Message routing key :param str exchange: The exchange to publish the message to :param str virtual_host: Virtual host name :param dict properties: Message properties :param str payl...
[ "Publish", "a", "Message", "." ]
train
https://github.com/eandersson/amqpstorm/blob/38330906c0af19eea482f43c5ce79bab98a1e064/amqpstorm/management/basic.py#L11-L43
eandersson/amqpstorm
amqpstorm/management/basic.py
Basic.get
def get(self, queue, virtual_host='/', requeue=False, to_dict=False, count=1, truncate=50000, encoding='auto'): """Get Messages. :param str queue: Queue name :param str virtual_host: Virtual host name :param bool requeue: Re-queue message :param bool to_dict: Should ...
python
def get(self, queue, virtual_host='/', requeue=False, to_dict=False, count=1, truncate=50000, encoding='auto'): """Get Messages. :param str queue: Queue name :param str virtual_host: Virtual host name :param bool requeue: Re-queue message :param bool to_dict: Should ...
[ "def", "get", "(", "self", ",", "queue", ",", "virtual_host", "=", "'/'", ",", "requeue", "=", "False", ",", "to_dict", "=", "False", ",", "count", "=", "1", ",", "truncate", "=", "50000", ",", "encoding", "=", "'auto'", ")", ":", "ackmode", "=", "...
Get Messages. :param str queue: Queue name :param str virtual_host: Virtual host name :param bool requeue: Re-queue message :param bool to_dict: Should incoming messages be converted to a dictionary before delivery. :param int count: How many message...
[ "Get", "Messages", "." ]
train
https://github.com/eandersson/amqpstorm/blob/38330906c0af19eea482f43c5ce79bab98a1e064/amqpstorm/management/basic.py#L45-L92
eandersson/amqpstorm
amqpstorm/management/virtual_host.py
VirtualHost.get
def get(self, virtual_host): """Get Virtual Host details. :param str virtual_host: Virtual host name :raises ApiError: Raises if the remote server encountered an error. :raises ApiConnectionError: Raises if there was a connectivity issue. :rtype: dict """ virtu...
python
def get(self, virtual_host): """Get Virtual Host details. :param str virtual_host: Virtual host name :raises ApiError: Raises if the remote server encountered an error. :raises ApiConnectionError: Raises if there was a connectivity issue. :rtype: dict """ virtu...
[ "def", "get", "(", "self", ",", "virtual_host", ")", ":", "virtual_host", "=", "quote", "(", "virtual_host", ",", "''", ")", "return", "self", ".", "http_client", ".", "get", "(", "API_VIRTUAL_HOST", "%", "virtual_host", ")" ]
Get Virtual Host details. :param str virtual_host: Virtual host name :raises ApiError: Raises if the remote server encountered an error. :raises ApiConnectionError: Raises if there was a connectivity issue. :rtype: dict
[ "Get", "Virtual", "Host", "details", "." ]
train
https://github.com/eandersson/amqpstorm/blob/38330906c0af19eea482f43c5ce79bab98a1e064/amqpstorm/management/virtual_host.py#L10-L21
eandersson/amqpstorm
amqpstorm/management/virtual_host.py
VirtualHost.create
def create(self, virtual_host): """Create a Virtual Host. :param str virtual_host: Virtual host name :raises ApiError: Raises if the remote server encountered an error. :raises ApiConnectionError: Raises if there was a connectivity issue. :rtype: dict """ virtu...
python
def create(self, virtual_host): """Create a Virtual Host. :param str virtual_host: Virtual host name :raises ApiError: Raises if the remote server encountered an error. :raises ApiConnectionError: Raises if there was a connectivity issue. :rtype: dict """ virtu...
[ "def", "create", "(", "self", ",", "virtual_host", ")", ":", "virtual_host", "=", "quote", "(", "virtual_host", ",", "''", ")", "return", "self", ".", "http_client", ".", "put", "(", "API_VIRTUAL_HOST", "%", "virtual_host", ")" ]
Create a Virtual Host. :param str virtual_host: Virtual host name :raises ApiError: Raises if the remote server encountered an error. :raises ApiConnectionError: Raises if there was a connectivity issue. :rtype: dict
[ "Create", "a", "Virtual", "Host", "." ]
train
https://github.com/eandersson/amqpstorm/blob/38330906c0af19eea482f43c5ce79bab98a1e064/amqpstorm/management/virtual_host.py#L33-L44
eandersson/amqpstorm
amqpstorm/management/virtual_host.py
VirtualHost.delete
def delete(self, virtual_host): """Delete a Virtual Host. :param str virtual_host: Virtual host name :raises ApiError: Raises if the remote server encountered an error. :raises ApiConnectionError: Raises if there was a connectivity issue. :rtype: dict """ virtu...
python
def delete(self, virtual_host): """Delete a Virtual Host. :param str virtual_host: Virtual host name :raises ApiError: Raises if the remote server encountered an error. :raises ApiConnectionError: Raises if there was a connectivity issue. :rtype: dict """ virtu...
[ "def", "delete", "(", "self", ",", "virtual_host", ")", ":", "virtual_host", "=", "quote", "(", "virtual_host", ",", "''", ")", "return", "self", ".", "http_client", ".", "delete", "(", "API_VIRTUAL_HOST", "%", "virtual_host", ")" ]
Delete a Virtual Host. :param str virtual_host: Virtual host name :raises ApiError: Raises if the remote server encountered an error. :raises ApiConnectionError: Raises if there was a connectivity issue. :rtype: dict
[ "Delete", "a", "Virtual", "Host", "." ]
train
https://github.com/eandersson/amqpstorm/blob/38330906c0af19eea482f43c5ce79bab98a1e064/amqpstorm/management/virtual_host.py#L46-L57
eandersson/amqpstorm
amqpstorm/management/virtual_host.py
VirtualHost.get_permissions
def get_permissions(self, virtual_host): """Get all Virtual hosts permissions. :raises ApiError: Raises if the remote server encountered an error. :raises ApiConnectionError: Raises if there was a connectivity issue. :rtype: dict """ virtual_host = quote(virtual_host, '...
python
def get_permissions(self, virtual_host): """Get all Virtual hosts permissions. :raises ApiError: Raises if the remote server encountered an error. :raises ApiConnectionError: Raises if there was a connectivity issue. :rtype: dict """ virtual_host = quote(virtual_host, '...
[ "def", "get_permissions", "(", "self", ",", "virtual_host", ")", ":", "virtual_host", "=", "quote", "(", "virtual_host", ",", "''", ")", "return", "self", ".", "http_client", ".", "get", "(", "API_VIRTUAL_HOSTS_PERMISSION", "%", "(", "virtual_host", ")", ")" ]
Get all Virtual hosts permissions. :raises ApiError: Raises if the remote server encountered an error. :raises ApiConnectionError: Raises if there was a connectivity issue. :rtype: dict
[ "Get", "all", "Virtual", "hosts", "permissions", "." ]
train
https://github.com/eandersson/amqpstorm/blob/38330906c0af19eea482f43c5ce79bab98a1e064/amqpstorm/management/virtual_host.py#L59-L71
eandersson/amqpstorm
amqpstorm/base.py
BaseChannel.add_consumer_tag
def add_consumer_tag(self, tag): """Add a Consumer tag. :param str tag: Consumer tag. :return: """ if not is_string(tag): raise AMQPChannelError('consumer tag needs to be a string') if tag not in self._consumer_tags: self._consumer_tags.append(tag...
python
def add_consumer_tag(self, tag): """Add a Consumer tag. :param str tag: Consumer tag. :return: """ if not is_string(tag): raise AMQPChannelError('consumer tag needs to be a string') if tag not in self._consumer_tags: self._consumer_tags.append(tag...
[ "def", "add_consumer_tag", "(", "self", ",", "tag", ")", ":", "if", "not", "is_string", "(", "tag", ")", ":", "raise", "AMQPChannelError", "(", "'consumer tag needs to be a string'", ")", "if", "tag", "not", "in", "self", ".", "_consumer_tags", ":", "self", ...
Add a Consumer tag. :param str tag: Consumer tag. :return:
[ "Add", "a", "Consumer", "tag", "." ]
train
https://github.com/eandersson/amqpstorm/blob/38330906c0af19eea482f43c5ce79bab98a1e064/amqpstorm/base.py#L123-L132
eandersson/amqpstorm
amqpstorm/base.py
BaseChannel.remove_consumer_tag
def remove_consumer_tag(self, tag=None): """Remove a Consumer tag. If no tag is specified, all all tags will be removed. :param str|None tag: Consumer tag. :return: """ if tag is not None: if tag in self._consumer_tags: self._consumer_tag...
python
def remove_consumer_tag(self, tag=None): """Remove a Consumer tag. If no tag is specified, all all tags will be removed. :param str|None tag: Consumer tag. :return: """ if tag is not None: if tag in self._consumer_tags: self._consumer_tag...
[ "def", "remove_consumer_tag", "(", "self", ",", "tag", "=", "None", ")", ":", "if", "tag", "is", "not", "None", ":", "if", "tag", "in", "self", ".", "_consumer_tags", ":", "self", ".", "_consumer_tags", ".", "remove", "(", "tag", ")", "else", ":", "s...
Remove a Consumer tag. If no tag is specified, all all tags will be removed. :param str|None tag: Consumer tag. :return:
[ "Remove", "a", "Consumer", "tag", "." ]
train
https://github.com/eandersson/amqpstorm/blob/38330906c0af19eea482f43c5ce79bab98a1e064/amqpstorm/base.py#L134-L146
eandersson/amqpstorm
amqpstorm/base.py
BaseMessage.to_dict
def to_dict(self): """Message to Dictionary. :rtype: dict """ return { 'body': self._body, 'method': self._method, 'properties': self._properties, 'channel': self._channel }
python
def to_dict(self): """Message to Dictionary. :rtype: dict """ return { 'body': self._body, 'method': self._method, 'properties': self._properties, 'channel': self._channel }
[ "def", "to_dict", "(", "self", ")", ":", "return", "{", "'body'", ":", "self", ".", "_body", ",", "'method'", ":", "self", ".", "_method", ",", "'properties'", ":", "self", ".", "_properties", ",", "'channel'", ":", "self", ".", "_channel", "}" ]
Message to Dictionary. :rtype: dict
[ "Message", "to", "Dictionary", "." ]
train
https://github.com/eandersson/amqpstorm/blob/38330906c0af19eea482f43c5ce79bab98a1e064/amqpstorm/base.py#L171-L181
eandersson/amqpstorm
amqpstorm/base.py
BaseMessage.to_tuple
def to_tuple(self): """Message to Tuple. :rtype: tuple """ return self._body, self._channel, self._method, self._properties
python
def to_tuple(self): """Message to Tuple. :rtype: tuple """ return self._body, self._channel, self._method, self._properties
[ "def", "to_tuple", "(", "self", ")", ":", "return", "self", ".", "_body", ",", "self", ".", "_channel", ",", "self", ".", "_method", ",", "self", ".", "_properties" ]
Message to Tuple. :rtype: tuple
[ "Message", "to", "Tuple", "." ]
train
https://github.com/eandersson/amqpstorm/blob/38330906c0af19eea482f43c5ce79bab98a1e064/amqpstorm/base.py#L183-L188
eandersson/amqpstorm
amqpstorm/management/connection.py
Connection.close
def close(self, connection, reason='Closed via management api'): """Close Connection. :param str connection: Connection name :param str reason: Reason for closing connection. :raises ApiError: Raises if the remote server encountered an error. :raises ApiConnectionError: Raises ...
python
def close(self, connection, reason='Closed via management api'): """Close Connection. :param str connection: Connection name :param str reason: Reason for closing connection. :raises ApiError: Raises if the remote server encountered an error. :raises ApiConnectionError: Raises ...
[ "def", "close", "(", "self", ",", "connection", ",", "reason", "=", "'Closed via management api'", ")", ":", "close_payload", "=", "json", ".", "dumps", "(", "{", "'name'", ":", "connection", ",", "'reason'", ":", "reason", "}", ")", "connection", "=", "qu...
Close Connection. :param str connection: Connection name :param str reason: Reason for closing connection. :raises ApiError: Raises if the remote server encountered an error. :raises ApiConnectionError: Raises if there was a connectivity issue. :rtype: None
[ "Close", "Connection", "." ]
train
https://github.com/eandersson/amqpstorm/blob/38330906c0af19eea482f43c5ce79bab98a1e064/amqpstorm/management/connection.py#L32-L52
eandersson/amqpstorm
amqpstorm/rpc.py
Rpc.on_frame
def on_frame(self, frame_in): """On RPC Frame. :param specification.Frame frame_in: Amqp frame. :return: """ if frame_in.name not in self._request: return False uuid = self._request[frame_in.name] if self._response[uuid]: self._response[u...
python
def on_frame(self, frame_in): """On RPC Frame. :param specification.Frame frame_in: Amqp frame. :return: """ if frame_in.name not in self._request: return False uuid = self._request[frame_in.name] if self._response[uuid]: self._response[u...
[ "def", "on_frame", "(", "self", ",", "frame_in", ")", ":", "if", "frame_in", ".", "name", "not", "in", "self", ".", "_request", ":", "return", "False", "uuid", "=", "self", ".", "_request", "[", "frame_in", ".", "name", "]", "if", "self", ".", "_resp...
On RPC Frame. :param specification.Frame frame_in: Amqp frame. :return:
[ "On", "RPC", "Frame", "." ]
train
https://github.com/eandersson/amqpstorm/blob/38330906c0af19eea482f43c5ce79bab98a1e064/amqpstorm/rpc.py#L29-L43
eandersson/amqpstorm
amqpstorm/rpc.py
Rpc.register_request
def register_request(self, valid_responses): """Register a RPC request. :param list valid_responses: List of possible Responses that we should be waiting for. :return: """ uuid = str(uuid4()) self._response[uuid] = [] for acti...
python
def register_request(self, valid_responses): """Register a RPC request. :param list valid_responses: List of possible Responses that we should be waiting for. :return: """ uuid = str(uuid4()) self._response[uuid] = [] for acti...
[ "def", "register_request", "(", "self", ",", "valid_responses", ")", ":", "uuid", "=", "str", "(", "uuid4", "(", ")", ")", "self", ".", "_response", "[", "uuid", "]", "=", "[", "]", "for", "action", "in", "valid_responses", ":", "self", ".", "_request"...
Register a RPC request. :param list valid_responses: List of possible Responses that we should be waiting for. :return:
[ "Register", "a", "RPC", "request", "." ]
train
https://github.com/eandersson/amqpstorm/blob/38330906c0af19eea482f43c5ce79bab98a1e064/amqpstorm/rpc.py#L45-L56
eandersson/amqpstorm
amqpstorm/rpc.py
Rpc.remove_request
def remove_request(self, uuid): """Remove any RPC request(s) using this uuid. :param str uuid: Rpc Identifier. :return: """ for key in list(self._request): if self._request[key] == uuid: del self._request[key]
python
def remove_request(self, uuid): """Remove any RPC request(s) using this uuid. :param str uuid: Rpc Identifier. :return: """ for key in list(self._request): if self._request[key] == uuid: del self._request[key]
[ "def", "remove_request", "(", "self", ",", "uuid", ")", ":", "for", "key", "in", "list", "(", "self", ".", "_request", ")", ":", "if", "self", ".", "_request", "[", "key", "]", "==", "uuid", ":", "del", "self", ".", "_request", "[", "key", "]" ]
Remove any RPC request(s) using this uuid. :param str uuid: Rpc Identifier. :return:
[ "Remove", "any", "RPC", "request", "(", "s", ")", "using", "this", "uuid", "." ]
train
https://github.com/eandersson/amqpstorm/blob/38330906c0af19eea482f43c5ce79bab98a1e064/amqpstorm/rpc.py#L67-L75
eandersson/amqpstorm
amqpstorm/rpc.py
Rpc.get_request
def get_request(self, uuid, raw=False, multiple=False, connection_adapter=None): """Get a RPC request. :param str uuid: Rpc Identifier :param bool raw: If enabled return the frame as is, else return result as a dictionary. :param bool multipl...
python
def get_request(self, uuid, raw=False, multiple=False, connection_adapter=None): """Get a RPC request. :param str uuid: Rpc Identifier :param bool raw: If enabled return the frame as is, else return result as a dictionary. :param bool multipl...
[ "def", "get_request", "(", "self", ",", "uuid", ",", "raw", "=", "False", ",", "multiple", "=", "False", ",", "connection_adapter", "=", "None", ")", ":", "if", "uuid", "not", "in", "self", ".", "_response", ":", "return", "self", ".", "_wait_for_request...
Get a RPC request. :param str uuid: Rpc Identifier :param bool raw: If enabled return the frame as is, else return result as a dictionary. :param bool multiple: Are we expecting multiple frames. :param obj connection_adapter: Provide custom connection adapter. ...
[ "Get", "a", "RPC", "request", "." ]
train
https://github.com/eandersson/amqpstorm/blob/38330906c0af19eea482f43c5ce79bab98a1e064/amqpstorm/rpc.py#L86-L110
eandersson/amqpstorm
amqpstorm/rpc.py
Rpc._get_response_frame
def _get_response_frame(self, uuid): """Get a response frame. :param str uuid: Rpc Identifier :return: """ frame = None frames = self._response.get(uuid, None) if frames: frame = frames.pop(0) return frame
python
def _get_response_frame(self, uuid): """Get a response frame. :param str uuid: Rpc Identifier :return: """ frame = None frames = self._response.get(uuid, None) if frames: frame = frames.pop(0) return frame
[ "def", "_get_response_frame", "(", "self", ",", "uuid", ")", ":", "frame", "=", "None", "frames", "=", "self", ".", "_response", ".", "get", "(", "uuid", ",", "None", ")", "if", "frames", ":", "frame", "=", "frames", ".", "pop", "(", "0", ")", "ret...
Get a response frame. :param str uuid: Rpc Identifier :return:
[ "Get", "a", "response", "frame", "." ]
train
https://github.com/eandersson/amqpstorm/blob/38330906c0af19eea482f43c5ce79bab98a1e064/amqpstorm/rpc.py#L112-L122
eandersson/amqpstorm
amqpstorm/rpc.py
Rpc._wait_for_request
def _wait_for_request(self, uuid, connection_adapter=None): """Wait for RPC request to arrive. :param str uuid: Rpc Identifier. :param obj connection_adapter: Provide custom connection adapter. :return: """ start_time = time.time() while not self._response[uuid]:...
python
def _wait_for_request(self, uuid, connection_adapter=None): """Wait for RPC request to arrive. :param str uuid: Rpc Identifier. :param obj connection_adapter: Provide custom connection adapter. :return: """ start_time = time.time() while not self._response[uuid]:...
[ "def", "_wait_for_request", "(", "self", ",", "uuid", ",", "connection_adapter", "=", "None", ")", ":", "start_time", "=", "time", ".", "time", "(", ")", "while", "not", "self", ".", "_response", "[", "uuid", "]", ":", "connection_adapter", ".", "check_for...
Wait for RPC request to arrive. :param str uuid: Rpc Identifier. :param obj connection_adapter: Provide custom connection adapter. :return:
[ "Wait", "for", "RPC", "request", "to", "arrive", "." ]
train
https://github.com/eandersson/amqpstorm/blob/38330906c0af19eea482f43c5ce79bab98a1e064/amqpstorm/rpc.py#L124-L136
eandersson/amqpstorm
amqpstorm/rpc.py
Rpc._raise_rpc_timeout_error
def _raise_rpc_timeout_error(self, uuid): """Gather information and raise an Rpc exception. :param str uuid: Rpc Identifier. :return: """ requests = [] for key, value in self._request.items(): if value == uuid: requests.append(key) sel...
python
def _raise_rpc_timeout_error(self, uuid): """Gather information and raise an Rpc exception. :param str uuid: Rpc Identifier. :return: """ requests = [] for key, value in self._request.items(): if value == uuid: requests.append(key) sel...
[ "def", "_raise_rpc_timeout_error", "(", "self", ",", "uuid", ")", ":", "requests", "=", "[", "]", "for", "key", ",", "value", "in", "self", ".", "_request", ".", "items", "(", ")", ":", "if", "value", "==", "uuid", ":", "requests", ".", "append", "("...
Gather information and raise an Rpc exception. :param str uuid: Rpc Identifier. :return:
[ "Gather", "information", "and", "raise", "an", "Rpc", "exception", "." ]
train
https://github.com/eandersson/amqpstorm/blob/38330906c0af19eea482f43c5ce79bab98a1e064/amqpstorm/rpc.py#L138-L156
eandersson/amqpstorm
amqpstorm/compatibility.py
get_default_ssl_version
def get_default_ssl_version(): """Get the highest support TLS version, if none is available, return None. :rtype: bool|None """ if hasattr(ssl, 'PROTOCOL_TLSv1_2'): return ssl.PROTOCOL_TLSv1_2 elif hasattr(ssl, 'PROTOCOL_TLSv1_1'): return ssl.PROTOCOL_TLSv1_1 elif hasattr(ssl, '...
python
def get_default_ssl_version(): """Get the highest support TLS version, if none is available, return None. :rtype: bool|None """ if hasattr(ssl, 'PROTOCOL_TLSv1_2'): return ssl.PROTOCOL_TLSv1_2 elif hasattr(ssl, 'PROTOCOL_TLSv1_1'): return ssl.PROTOCOL_TLSv1_1 elif hasattr(ssl, '...
[ "def", "get_default_ssl_version", "(", ")", ":", "if", "hasattr", "(", "ssl", ",", "'PROTOCOL_TLSv1_2'", ")", ":", "return", "ssl", ".", "PROTOCOL_TLSv1_2", "elif", "hasattr", "(", "ssl", ",", "'PROTOCOL_TLSv1_1'", ")", ":", "return", "ssl", ".", "PROTOCOL_TLS...
Get the highest support TLS version, if none is available, return None. :rtype: bool|None
[ "Get", "the", "highest", "support", "TLS", "version", "if", "none", "is", "available", "return", "None", "." ]
train
https://github.com/eandersson/amqpstorm/blob/38330906c0af19eea482f43c5ce79bab98a1e064/amqpstorm/compatibility.py#L44-L55
eandersson/amqpstorm
amqpstorm/compatibility.py
is_string
def is_string(obj): """Is this a string. :param object obj: :rtype: bool """ if PYTHON3: str_type = (bytes, str) else: str_type = (bytes, str, unicode) return isinstance(obj, str_type)
python
def is_string(obj): """Is this a string. :param object obj: :rtype: bool """ if PYTHON3: str_type = (bytes, str) else: str_type = (bytes, str, unicode) return isinstance(obj, str_type)
[ "def", "is_string", "(", "obj", ")", ":", "if", "PYTHON3", ":", "str_type", "=", "(", "bytes", ",", "str", ")", "else", ":", "str_type", "=", "(", "bytes", ",", "str", ",", "unicode", ")", "return", "isinstance", "(", "obj", ",", "str_type", ")" ]
Is this a string. :param object obj: :rtype: bool
[ "Is", "this", "a", "string", "." ]
train
https://github.com/eandersson/amqpstorm/blob/38330906c0af19eea482f43c5ce79bab98a1e064/amqpstorm/compatibility.py#L74-L84
eandersson/amqpstorm
amqpstorm/compatibility.py
is_integer
def is_integer(obj): """Is this an integer. :param object obj: :return: """ if PYTHON3: return isinstance(obj, int) return isinstance(obj, (int, long))
python
def is_integer(obj): """Is this an integer. :param object obj: :return: """ if PYTHON3: return isinstance(obj, int) return isinstance(obj, (int, long))
[ "def", "is_integer", "(", "obj", ")", ":", "if", "PYTHON3", ":", "return", "isinstance", "(", "obj", ",", "int", ")", "return", "isinstance", "(", "obj", ",", "(", "int", ",", "long", ")", ")" ]
Is this an integer. :param object obj: :return:
[ "Is", "this", "an", "integer", "." ]
train
https://github.com/eandersson/amqpstorm/blob/38330906c0af19eea482f43c5ce79bab98a1e064/amqpstorm/compatibility.py#L87-L95
eandersson/amqpstorm
amqpstorm/compatibility.py
try_utf8_decode
def try_utf8_decode(value): """Try to decode an object. :param value: :return: """ if not value or not is_string(value): return value elif PYTHON3 and not isinstance(value, bytes): return value elif not PYTHON3 and not isinstance(value, unicode): return value tr...
python
def try_utf8_decode(value): """Try to decode an object. :param value: :return: """ if not value or not is_string(value): return value elif PYTHON3 and not isinstance(value, bytes): return value elif not PYTHON3 and not isinstance(value, unicode): return value tr...
[ "def", "try_utf8_decode", "(", "value", ")", ":", "if", "not", "value", "or", "not", "is_string", "(", "value", ")", ":", "return", "value", "elif", "PYTHON3", "and", "not", "isinstance", "(", "value", ",", "bytes", ")", ":", "return", "value", "elif", ...
Try to decode an object. :param value: :return:
[ "Try", "to", "decode", "an", "object", "." ]
train
https://github.com/eandersson/amqpstorm/blob/38330906c0af19eea482f43c5ce79bab98a1e064/amqpstorm/compatibility.py#L111-L129
eandersson/amqpstorm
amqpstorm/compatibility.py
patch_uri
def patch_uri(uri): """If a custom uri schema is used with python 2.6 (e.g. amqps), it will ignore some of the parsing logic. As a work-around for this we change the amqp/amqps schema internally to use http/https. :param str uri: AMQP Connection string :rtype: str """ index = u...
python
def patch_uri(uri): """If a custom uri schema is used with python 2.6 (e.g. amqps), it will ignore some of the parsing logic. As a work-around for this we change the amqp/amqps schema internally to use http/https. :param str uri: AMQP Connection string :rtype: str """ index = u...
[ "def", "patch_uri", "(", "uri", ")", ":", "index", "=", "uri", ".", "find", "(", "':'", ")", "if", "uri", "[", ":", "index", "]", "==", "'amqps'", ":", "uri", "=", "uri", ".", "replace", "(", "'amqps'", ",", "'https'", ",", "1", ")", "elif", "u...
If a custom uri schema is used with python 2.6 (e.g. amqps), it will ignore some of the parsing logic. As a work-around for this we change the amqp/amqps schema internally to use http/https. :param str uri: AMQP Connection string :rtype: str
[ "If", "a", "custom", "uri", "schema", "is", "used", "with", "python", "2", ".", "6", "(", "e", ".", "g", ".", "amqps", ")", "it", "will", "ignore", "some", "of", "the", "parsing", "logic", "." ]
train
https://github.com/eandersson/amqpstorm/blob/38330906c0af19eea482f43c5ce79bab98a1e064/amqpstorm/compatibility.py#L132-L147
eandersson/amqpstorm
amqpstorm/uri_connection.py
UriConnection._parse_uri_options
def _parse_uri_options(self, parsed_uri, use_ssl=False, ssl_options=None): """Parse the uri options. :param parsed_uri: :param bool use_ssl: :return: """ ssl_options = ssl_options or {} kwargs = urlparse.parse_qs(parsed_uri.query) vhost = urlparse.unquote...
python
def _parse_uri_options(self, parsed_uri, use_ssl=False, ssl_options=None): """Parse the uri options. :param parsed_uri: :param bool use_ssl: :return: """ ssl_options = ssl_options or {} kwargs = urlparse.parse_qs(parsed_uri.query) vhost = urlparse.unquote...
[ "def", "_parse_uri_options", "(", "self", ",", "parsed_uri", ",", "use_ssl", "=", "False", ",", "ssl_options", "=", "None", ")", ":", "ssl_options", "=", "ssl_options", "or", "{", "}", "kwargs", "=", "urlparse", ".", "parse_qs", "(", "parsed_uri", ".", "qu...
Parse the uri options. :param parsed_uri: :param bool use_ssl: :return:
[ "Parse", "the", "uri", "options", "." ]
train
https://github.com/eandersson/amqpstorm/blob/38330906c0af19eea482f43c5ce79bab98a1e064/amqpstorm/uri_connection.py#L51-L77
eandersson/amqpstorm
amqpstorm/uri_connection.py
UriConnection._parse_ssl_options
def _parse_ssl_options(self, ssl_kwargs): """Parse TLS Options. :param ssl_kwargs: :rtype: dict """ ssl_options = {} for key in ssl_kwargs: if key not in compatibility.SSL_OPTIONS: LOGGER.warning('invalid option: %s', key) cont...
python
def _parse_ssl_options(self, ssl_kwargs): """Parse TLS Options. :param ssl_kwargs: :rtype: dict """ ssl_options = {} for key in ssl_kwargs: if key not in compatibility.SSL_OPTIONS: LOGGER.warning('invalid option: %s', key) cont...
[ "def", "_parse_ssl_options", "(", "self", ",", "ssl_kwargs", ")", ":", "ssl_options", "=", "{", "}", "for", "key", "in", "ssl_kwargs", ":", "if", "key", "not", "in", "compatibility", ".", "SSL_OPTIONS", ":", "LOGGER", ".", "warning", "(", "'invalid option: %...
Parse TLS Options. :param ssl_kwargs: :rtype: dict
[ "Parse", "TLS", "Options", "." ]
train
https://github.com/eandersson/amqpstorm/blob/38330906c0af19eea482f43c5ce79bab98a1e064/amqpstorm/uri_connection.py#L79-L97
eandersson/amqpstorm
amqpstorm/uri_connection.py
UriConnection._get_ssl_version
def _get_ssl_version(self, value): """Get the TLS Version. :param str value: :return: TLS Version """ return self._get_ssl_attribute(value, compatibility.SSL_VERSIONS, ssl.PROTOCOL_TLSv1, 'ssl_options:...
python
def _get_ssl_version(self, value): """Get the TLS Version. :param str value: :return: TLS Version """ return self._get_ssl_attribute(value, compatibility.SSL_VERSIONS, ssl.PROTOCOL_TLSv1, 'ssl_options:...
[ "def", "_get_ssl_version", "(", "self", ",", "value", ")", ":", "return", "self", ".", "_get_ssl_attribute", "(", "value", ",", "compatibility", ".", "SSL_VERSIONS", ",", "ssl", ".", "PROTOCOL_TLSv1", ",", "'ssl_options: ssl_version \\'%s\\' not '", "'found falling ba...
Get the TLS Version. :param str value: :return: TLS Version
[ "Get", "the", "TLS", "Version", "." ]
train
https://github.com/eandersson/amqpstorm/blob/38330906c0af19eea482f43c5ce79bab98a1e064/amqpstorm/uri_connection.py#L99-L108
eandersson/amqpstorm
amqpstorm/uri_connection.py
UriConnection._get_ssl_validation
def _get_ssl_validation(self, value): """Get the TLS Validation option. :param str value: :return: TLS Certificate Options """ return self._get_ssl_attribute(value, compatibility.SSL_CERT_MAP, ssl.CERT_NONE, ...
python
def _get_ssl_validation(self, value): """Get the TLS Validation option. :param str value: :return: TLS Certificate Options """ return self._get_ssl_attribute(value, compatibility.SSL_CERT_MAP, ssl.CERT_NONE, ...
[ "def", "_get_ssl_validation", "(", "self", ",", "value", ")", ":", "return", "self", ".", "_get_ssl_attribute", "(", "value", ",", "compatibility", ".", "SSL_CERT_MAP", ",", "ssl", ".", "CERT_NONE", ",", "'ssl_options: cert_reqs \\'%s\\' not '", "'found falling back t...
Get the TLS Validation option. :param str value: :return: TLS Certificate Options
[ "Get", "the", "TLS", "Validation", "option", "." ]
train
https://github.com/eandersson/amqpstorm/blob/38330906c0af19eea482f43c5ce79bab98a1e064/amqpstorm/uri_connection.py#L110-L119
eandersson/amqpstorm
amqpstorm/uri_connection.py
UriConnection._get_ssl_attribute
def _get_ssl_attribute(value, mapping, default_value, warning_message): """Get the TLS attribute based on the compatibility mapping. If no valid attribute can be found, fall-back on default and display a warning. :param str value: :param dict mapping: Dictionary based m...
python
def _get_ssl_attribute(value, mapping, default_value, warning_message): """Get the TLS attribute based on the compatibility mapping. If no valid attribute can be found, fall-back on default and display a warning. :param str value: :param dict mapping: Dictionary based m...
[ "def", "_get_ssl_attribute", "(", "value", ",", "mapping", ",", "default_value", ",", "warning_message", ")", ":", "for", "key", "in", "mapping", ":", "if", "not", "key", ".", "endswith", "(", "value", ".", "lower", "(", ")", ")", ":", "continue", "retur...
Get the TLS attribute based on the compatibility mapping. If no valid attribute can be found, fall-back on default and display a warning. :param str value: :param dict mapping: Dictionary based mapping :param default_value: Default fall-back value :param str war...
[ "Get", "the", "TLS", "attribute", "based", "on", "the", "compatibility", "mapping", "." ]
train
https://github.com/eandersson/amqpstorm/blob/38330906c0af19eea482f43c5ce79bab98a1e064/amqpstorm/uri_connection.py#L122-L139
eandersson/amqpstorm
amqpstorm/management/api.py
ManagementApi.top
def top(self): """Top Processes. :raises ApiError: Raises if the remote server encountered an error. :raises ApiConnectionError: Raises if there was a connectivity issue. :rtype: list """ nodes = [] for node in self.nodes(): nodes.append(self.http_cl...
python
def top(self): """Top Processes. :raises ApiError: Raises if the remote server encountered an error. :raises ApiConnectionError: Raises if there was a connectivity issue. :rtype: list """ nodes = [] for node in self.nodes(): nodes.append(self.http_cl...
[ "def", "top", "(", "self", ")", ":", "nodes", "=", "[", "]", "for", "node", "in", "self", ".", "nodes", "(", ")", ":", "nodes", ".", "append", "(", "self", ".", "http_client", ".", "get", "(", "API_TOP", "%", "node", "[", "'name'", "]", ")", ")...
Top Processes. :raises ApiError: Raises if the remote server encountered an error. :raises ApiConnectionError: Raises if there was a connectivity issue. :rtype: list
[ "Top", "Processes", "." ]
train
https://github.com/eandersson/amqpstorm/blob/38330906c0af19eea482f43c5ce79bab98a1e064/amqpstorm/management/api.py#L133-L144
eandersson/amqpstorm
amqpstorm/basic.py
Basic.qos
def qos(self, prefetch_count=0, prefetch_size=0, global_=False): """Specify quality of service. :param int prefetch_count: Prefetch window in messages :param int/long prefetch_size: Prefetch window in octets :param bool global_: Apply to entire connection :raises AMQPInvalidArg...
python
def qos(self, prefetch_count=0, prefetch_size=0, global_=False): """Specify quality of service. :param int prefetch_count: Prefetch window in messages :param int/long prefetch_size: Prefetch window in octets :param bool global_: Apply to entire connection :raises AMQPInvalidArg...
[ "def", "qos", "(", "self", ",", "prefetch_count", "=", "0", ",", "prefetch_size", "=", "0", ",", "global_", "=", "False", ")", ":", "if", "not", "compatibility", ".", "is_integer", "(", "prefetch_count", ")", ":", "raise", "AMQPInvalidArgument", "(", "'pre...
Specify quality of service. :param int prefetch_count: Prefetch window in messages :param int/long prefetch_size: Prefetch window in octets :param bool global_: Apply to entire connection :raises AMQPInvalidArgument: Invalid Parameters :raises AMQPChannelError: Raises if the ch...
[ "Specify", "quality", "of", "service", "." ]
train
https://github.com/eandersson/amqpstorm/blob/38330906c0af19eea482f43c5ce79bab98a1e064/amqpstorm/basic.py#L28-L51
eandersson/amqpstorm
amqpstorm/basic.py
Basic.get
def get(self, queue='', no_ack=False, to_dict=False, auto_decode=True): """Fetch a single message. :param str queue: Queue name :param bool no_ack: No acknowledgement needed :param bool to_dict: Should incoming messages be converted to a dictionary before delivery. ...
python
def get(self, queue='', no_ack=False, to_dict=False, auto_decode=True): """Fetch a single message. :param str queue: Queue name :param bool no_ack: No acknowledgement needed :param bool to_dict: Should incoming messages be converted to a dictionary before delivery. ...
[ "def", "get", "(", "self", ",", "queue", "=", "''", ",", "no_ack", "=", "False", ",", "to_dict", "=", "False", ",", "auto_decode", "=", "True", ")", ":", "if", "not", "compatibility", ".", "is_string", "(", "queue", ")", ":", "raise", "AMQPInvalidArgum...
Fetch a single message. :param str queue: Queue name :param bool no_ack: No acknowledgement needed :param bool to_dict: Should incoming messages be converted to a dictionary before delivery. :param bool auto_decode: Auto-decode strings when possible. :raises...
[ "Fetch", "a", "single", "message", "." ]
train
https://github.com/eandersson/amqpstorm/blob/38330906c0af19eea482f43c5ce79bab98a1e064/amqpstorm/basic.py#L53-L85
eandersson/amqpstorm
amqpstorm/basic.py
Basic.recover
def recover(self, requeue=False): """Redeliver unacknowledged messages. :param bool requeue: Re-queue the messages :raises AMQPInvalidArgument: Invalid Parameters :raises AMQPChannelError: Raises if the channel encountered an error. :raises AMQPConnectionError: Raises if the co...
python
def recover(self, requeue=False): """Redeliver unacknowledged messages. :param bool requeue: Re-queue the messages :raises AMQPInvalidArgument: Invalid Parameters :raises AMQPChannelError: Raises if the channel encountered an error. :raises AMQPConnectionError: Raises if the co...
[ "def", "recover", "(", "self", ",", "requeue", "=", "False", ")", ":", "if", "not", "isinstance", "(", "requeue", ",", "bool", ")", ":", "raise", "AMQPInvalidArgument", "(", "'requeue should be a boolean'", ")", "recover_frame", "=", "specification", ".", "Bas...
Redeliver unacknowledged messages. :param bool requeue: Re-queue the messages :raises AMQPInvalidArgument: Invalid Parameters :raises AMQPChannelError: Raises if the channel encountered an error. :raises AMQPConnectionError: Raises if the connection ...
[ "Redeliver", "unacknowledged", "messages", "." ]
train
https://github.com/eandersson/amqpstorm/blob/38330906c0af19eea482f43c5ce79bab98a1e064/amqpstorm/basic.py#L87-L102
eandersson/amqpstorm
amqpstorm/basic.py
Basic.consume
def consume(self, callback=None, queue='', consumer_tag='', exclusive=False, no_ack=False, no_local=False, arguments=None): """Start a queue consumer. :param function callback: Message callback :param str queue: Queue name :param str consumer_tag: Consumer tag :p...
python
def consume(self, callback=None, queue='', consumer_tag='', exclusive=False, no_ack=False, no_local=False, arguments=None): """Start a queue consumer. :param function callback: Message callback :param str queue: Queue name :param str consumer_tag: Consumer tag :p...
[ "def", "consume", "(", "self", ",", "callback", "=", "None", ",", "queue", "=", "''", ",", "consumer_tag", "=", "''", ",", "exclusive", "=", "False", ",", "no_ack", "=", "False", ",", "no_local", "=", "False", ",", "arguments", "=", "None", ")", ":",...
Start a queue consumer. :param function callback: Message callback :param str queue: Queue name :param str consumer_tag: Consumer tag :param bool no_local: Do not deliver own messages :param bool no_ack: No acknowledgement needed :param bool exclusive: Request exclusive ...
[ "Start", "a", "queue", "consumer", "." ]
train
https://github.com/eandersson/amqpstorm/blob/38330906c0af19eea482f43c5ce79bab98a1e064/amqpstorm/basic.py#L104-L141
eandersson/amqpstorm
amqpstorm/basic.py
Basic.cancel
def cancel(self, consumer_tag=''): """Cancel a queue consumer. :param str consumer_tag: Consumer tag :raises AMQPInvalidArgument: Invalid Parameters :raises AMQPChannelError: Raises if the channel encountered an error. :raises AMQPConnectionError: Raises if the connection ...
python
def cancel(self, consumer_tag=''): """Cancel a queue consumer. :param str consumer_tag: Consumer tag :raises AMQPInvalidArgument: Invalid Parameters :raises AMQPChannelError: Raises if the channel encountered an error. :raises AMQPConnectionError: Raises if the connection ...
[ "def", "cancel", "(", "self", ",", "consumer_tag", "=", "''", ")", ":", "if", "not", "compatibility", ".", "is_string", "(", "consumer_tag", ")", ":", "raise", "AMQPInvalidArgument", "(", "'consumer_tag should be a string'", ")", "cancel_frame", "=", "specificatio...
Cancel a queue consumer. :param str consumer_tag: Consumer tag :raises AMQPInvalidArgument: Invalid Parameters :raises AMQPChannelError: Raises if the channel encountered an error. :raises AMQPConnectionError: Raises if the connection encountered an...
[ "Cancel", "a", "queue", "consumer", "." ]
train
https://github.com/eandersson/amqpstorm/blob/38330906c0af19eea482f43c5ce79bab98a1e064/amqpstorm/basic.py#L143-L160
eandersson/amqpstorm
amqpstorm/basic.py
Basic.publish
def publish(self, body, routing_key, exchange='', properties=None, mandatory=False, immediate=False): """Publish a Message. :param bytes|str|unicode body: Message payload :param str routing_key: Message routing key :param str exchange: The exchange to publish the message...
python
def publish(self, body, routing_key, exchange='', properties=None, mandatory=False, immediate=False): """Publish a Message. :param bytes|str|unicode body: Message payload :param str routing_key: Message routing key :param str exchange: The exchange to publish the message...
[ "def", "publish", "(", "self", ",", "body", ",", "routing_key", ",", "exchange", "=", "''", ",", "properties", "=", "None", ",", "mandatory", "=", "False", ",", "immediate", "=", "False", ")", ":", "self", ".", "_validate_publish_parameters", "(", "body", ...
Publish a Message. :param bytes|str|unicode body: Message payload :param str routing_key: Message routing key :param str exchange: The exchange to publish the message to :param dict properties: Message properties :param bool mandatory: Requires the message is published :...
[ "Publish", "a", "Message", "." ]
train
https://github.com/eandersson/amqpstorm/blob/38330906c0af19eea482f43c5ce79bab98a1e064/amqpstorm/basic.py#L162-L199