id
int32
0
252k
repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
75
19.8k
code_tokens
list
docstring
stringlengths
3
17.3k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
87
242
43,900
barryp/py-amqplib
amqplib/client_0_8/channel.py
Channel.access_request
def access_request(self, realm, exclusive=False, passive=False, active=False, write=False, read=False): """ request an access ticket This method requests an access ticket for an access realm. The server responds by granting the access ticket. If the client does not have...
python
def access_request(self, realm, exclusive=False, passive=False, active=False, write=False, read=False): """ request an access ticket This method requests an access ticket for an access realm. The server responds by granting the access ticket. If the client does not have...
[ "def", "access_request", "(", "self", ",", "realm", ",", "exclusive", "=", "False", ",", "passive", "=", "False", ",", "active", "=", "False", ",", "write", "=", "False", ",", "read", "=", "False", ")", ":", "args", "=", "AMQPWriter", "(", ")", "args...
request an access ticket This method requests an access ticket for an access realm. The server responds by granting the access ticket. If the client does not have access rights to the requested realm this causes a connection exception. Access tickets are a per-channel resource...
[ "request", "an", "access", "ticket" ]
2b3a47de34b4712c111d0a55d7ff109dffc2a7b2
https://github.com/barryp/py-amqplib/blob/2b3a47de34b4712c111d0a55d7ff109dffc2a7b2/amqplib/client_0_8/channel.py#L505-L597
43,901
barryp/py-amqplib
amqplib/client_0_8/channel.py
Channel.exchange_declare
def exchange_declare(self, exchange, type, passive=False, durable=False, auto_delete=True, internal=False, nowait=False, arguments=None, ticket=None): """ declare exchange, create if needed This method creates an exchange if it does not already exist, and if the exchange...
python
def exchange_declare(self, exchange, type, passive=False, durable=False, auto_delete=True, internal=False, nowait=False, arguments=None, ticket=None): """ declare exchange, create if needed This method creates an exchange if it does not already exist, and if the exchange...
[ "def", "exchange_declare", "(", "self", ",", "exchange", ",", "type", ",", "passive", "=", "False", ",", "durable", "=", "False", ",", "auto_delete", "=", "True", ",", "internal", "=", "False", ",", "nowait", "=", "False", ",", "arguments", "=", "None", ...
declare exchange, create if needed This method creates an exchange if it does not already exist, and if the exchange exists, verifies that it is of the correct and expected class. RULE: The server SHOULD support a minimum of 16 exchanges per virtual host and id...
[ "declare", "exchange", "create", "if", "needed" ]
2b3a47de34b4712c111d0a55d7ff109dffc2a7b2
https://github.com/barryp/py-amqplib/blob/2b3a47de34b4712c111d0a55d7ff109dffc2a7b2/amqplib/client_0_8/channel.py#L675-L844
43,902
barryp/py-amqplib
amqplib/client_0_8/channel.py
Channel.exchange_delete
def exchange_delete(self, exchange, if_unused=False, nowait=False, ticket=None): """ delete an exchange This method deletes an exchange. When an exchange is deleted all queue bindings on the exchange are cancelled. PARAMETERS: exchange: shortstr ...
python
def exchange_delete(self, exchange, if_unused=False, nowait=False, ticket=None): """ delete an exchange This method deletes an exchange. When an exchange is deleted all queue bindings on the exchange are cancelled. PARAMETERS: exchange: shortstr ...
[ "def", "exchange_delete", "(", "self", ",", "exchange", ",", "if_unused", "=", "False", ",", "nowait", "=", "False", ",", "ticket", "=", "None", ")", ":", "args", "=", "AMQPWriter", "(", ")", "if", "ticket", "is", "not", "None", ":", "args", ".", "wr...
delete an exchange This method deletes an exchange. When an exchange is deleted all queue bindings on the exchange are cancelled. PARAMETERS: exchange: shortstr RULE: The exchange MUST exist. Attempting to delete a non-exis...
[ "delete", "an", "exchange" ]
2b3a47de34b4712c111d0a55d7ff109dffc2a7b2
https://github.com/barryp/py-amqplib/blob/2b3a47de34b4712c111d0a55d7ff109dffc2a7b2/amqplib/client_0_8/channel.py#L858-L924
43,903
barryp/py-amqplib
amqplib/client_0_8/channel.py
Channel.queue_bind
def queue_bind(self, queue, exchange, routing_key='', nowait=False, arguments=None, ticket=None): """ bind queue to an exchange This method binds a queue to an exchange. Until a queue is bound it will not receive any messages. In a classic messaging model, store-and-fo...
python
def queue_bind(self, queue, exchange, routing_key='', nowait=False, arguments=None, ticket=None): """ bind queue to an exchange This method binds a queue to an exchange. Until a queue is bound it will not receive any messages. In a classic messaging model, store-and-fo...
[ "def", "queue_bind", "(", "self", ",", "queue", ",", "exchange", ",", "routing_key", "=", "''", ",", "nowait", "=", "False", ",", "arguments", "=", "None", ",", "ticket", "=", "None", ")", ":", "if", "arguments", "is", "None", ":", "arguments", "=", ...
bind queue to an exchange This method binds a queue to an exchange. Until a queue is bound it will not receive any messages. In a classic messaging model, store-and-forward queues are bound to a dest exchange and subscription queues are bound to a dest_wild exchange. ...
[ "bind", "queue", "to", "an", "exchange" ]
2b3a47de34b4712c111d0a55d7ff109dffc2a7b2
https://github.com/barryp/py-amqplib/blob/2b3a47de34b4712c111d0a55d7ff109dffc2a7b2/amqplib/client_0_8/channel.py#L964-L1094
43,904
barryp/py-amqplib
amqplib/client_0_8/channel.py
Channel._queue_declare_ok
def _queue_declare_ok(self, args): """ confirms a queue definition This method confirms a Declare method and confirms the name of the queue, essential for automatically-named queues. PARAMETERS: queue: shortstr Reports the name of the queue. If the ...
python
def _queue_declare_ok(self, args): """ confirms a queue definition This method confirms a Declare method and confirms the name of the queue, essential for automatically-named queues. PARAMETERS: queue: shortstr Reports the name of the queue. If the ...
[ "def", "_queue_declare_ok", "(", "self", ",", "args", ")", ":", "queue", "=", "args", ".", "read_shortstr", "(", ")", "message_count", "=", "args", ".", "read_long", "(", ")", "consumer_count", "=", "args", ".", "read_long", "(", ")", "return", "queue", ...
confirms a queue definition This method confirms a Declare method and confirms the name of the queue, essential for automatically-named queues. PARAMETERS: queue: shortstr Reports the name of the queue. If the server generated a queue name, this fie...
[ "confirms", "a", "queue", "definition" ]
2b3a47de34b4712c111d0a55d7ff109dffc2a7b2
https://github.com/barryp/py-amqplib/blob/2b3a47de34b4712c111d0a55d7ff109dffc2a7b2/amqplib/client_0_8/channel.py#L1385-L1419
43,905
barryp/py-amqplib
amqplib/client_0_8/channel.py
Channel.basic_consume
def basic_consume(self, queue='', consumer_tag='', no_local=False, no_ack=False, exclusive=False, nowait=False, callback=None, ticket=None): """ start a queue consumer This method asks the server to start a "consumer", which is a transient request for messages from a spe...
python
def basic_consume(self, queue='', consumer_tag='', no_local=False, no_ack=False, exclusive=False, nowait=False, callback=None, ticket=None): """ start a queue consumer This method asks the server to start a "consumer", which is a transient request for messages from a spe...
[ "def", "basic_consume", "(", "self", ",", "queue", "=", "''", ",", "consumer_tag", "=", "''", ",", "no_local", "=", "False", ",", "no_ack", "=", "False", ",", "exclusive", "=", "False", ",", "nowait", "=", "False", ",", "callback", "=", "None", ",", ...
start a queue consumer This method asks the server to start a "consumer", which is a transient request for messages from a specific queue. Consumers last as long as the channel they were created on, or until the client cancels them. RULE: The server SHOULD support ...
[ "start", "a", "queue", "consumer" ]
2b3a47de34b4712c111d0a55d7ff109dffc2a7b2
https://github.com/barryp/py-amqplib/blob/2b3a47de34b4712c111d0a55d7ff109dffc2a7b2/amqplib/client_0_8/channel.py#L1821-L1948
43,906
barryp/py-amqplib
amqplib/client_0_8/channel.py
Channel._basic_deliver
def _basic_deliver(self, args, msg): """ notify the client of a consumer message This method delivers a message to the client, via a consumer. In the asynchronous message delivery model, the client starts a consumer using the Consume method, then the server responds with...
python
def _basic_deliver(self, args, msg): """ notify the client of a consumer message This method delivers a message to the client, via a consumer. In the asynchronous message delivery model, the client starts a consumer using the Consume method, then the server responds with...
[ "def", "_basic_deliver", "(", "self", ",", "args", ",", "msg", ")", ":", "consumer_tag", "=", "args", ".", "read_shortstr", "(", ")", "delivery_tag", "=", "args", ".", "read_longlong", "(", ")", "redelivered", "=", "args", ".", "read_bit", "(", ")", "exc...
notify the client of a consumer message This method delivers a message to the client, via a consumer. In the asynchronous message delivery model, the client starts a consumer using the Consume method, then the server responds with Deliver methods as and when messages arrive for that ...
[ "notify", "the", "client", "of", "a", "consumer", "message" ]
2b3a47de34b4712c111d0a55d7ff109dffc2a7b2
https://github.com/barryp/py-amqplib/blob/2b3a47de34b4712c111d0a55d7ff109dffc2a7b2/amqplib/client_0_8/channel.py#L1969-L2060
43,907
barryp/py-amqplib
amqplib/client_0_8/channel.py
Channel.basic_get
def basic_get(self, queue='', no_ack=False, ticket=None): """ direct access to a queue This method provides a direct access to the messages in a queue using a synchronous dialogue that is designed for specific types of application where synchronous functionality is more ...
python
def basic_get(self, queue='', no_ack=False, ticket=None): """ direct access to a queue This method provides a direct access to the messages in a queue using a synchronous dialogue that is designed for specific types of application where synchronous functionality is more ...
[ "def", "basic_get", "(", "self", ",", "queue", "=", "''", ",", "no_ack", "=", "False", ",", "ticket", "=", "None", ")", ":", "args", "=", "AMQPWriter", "(", ")", "if", "ticket", "is", "not", "None", ":", "args", ".", "write_short", "(", "ticket", "...
direct access to a queue This method provides a direct access to the messages in a queue using a synchronous dialogue that is designed for specific types of application where synchronous functionality is more important than performance. PARAMETERS: queue: shortstr ...
[ "direct", "access", "to", "a", "queue" ]
2b3a47de34b4712c111d0a55d7ff109dffc2a7b2
https://github.com/barryp/py-amqplib/blob/2b3a47de34b4712c111d0a55d7ff109dffc2a7b2/amqplib/client_0_8/channel.py#L2063-L2120
43,908
barryp/py-amqplib
amqplib/client_0_8/channel.py
Channel.basic_publish
def basic_publish(self, msg, exchange='', routing_key='', mandatory=False, immediate=False, ticket=None): """ publish a message This method publishes a message to a specific exchange. The message will be routed to queues as defined by the exchange configuration and distr...
python
def basic_publish(self, msg, exchange='', routing_key='', mandatory=False, immediate=False, ticket=None): """ publish a message This method publishes a message to a specific exchange. The message will be routed to queues as defined by the exchange configuration and distr...
[ "def", "basic_publish", "(", "self", ",", "msg", ",", "exchange", "=", "''", ",", "routing_key", "=", "''", ",", "mandatory", "=", "False", ",", "immediate", "=", "False", ",", "ticket", "=", "None", ")", ":", "args", "=", "AMQPWriter", "(", ")", "if...
publish a message This method publishes a message to a specific exchange. The message will be routed to queues as defined by the exchange configuration and distributed to any active consumers when the transaction, if any, is committed. PARAMETERS: exchange: shortstr...
[ "publish", "a", "message" ]
2b3a47de34b4712c111d0a55d7ff109dffc2a7b2
https://github.com/barryp/py-amqplib/blob/2b3a47de34b4712c111d0a55d7ff109dffc2a7b2/amqplib/client_0_8/channel.py#L2218-L2310
43,909
barryp/py-amqplib
amqplib/client_0_8/channel.py
Channel._basic_return
def _basic_return(self, args, msg): """ return a failed message This method returns an undeliverable message that was published with the "immediate" flag set, or an unroutable message published with the "mandatory" flag set. The reply code and text provide information ab...
python
def _basic_return(self, args, msg): """ return a failed message This method returns an undeliverable message that was published with the "immediate" flag set, or an unroutable message published with the "mandatory" flag set. The reply code and text provide information ab...
[ "def", "_basic_return", "(", "self", ",", "args", ",", "msg", ")", ":", "reply_code", "=", "args", ".", "read_short", "(", ")", "reply_text", "=", "args", ".", "read_shortstr", "(", ")", "exchange", "=", "args", ".", "read_shortstr", "(", ")", "routing_k...
return a failed message This method returns an undeliverable message that was published with the "immediate" flag set, or an unroutable message published with the "mandatory" flag set. The reply code and text provide information about the reason that the message was undeliverabl...
[ "return", "a", "failed", "message" ]
2b3a47de34b4712c111d0a55d7ff109dffc2a7b2
https://github.com/barryp/py-amqplib/blob/2b3a47de34b4712c111d0a55d7ff109dffc2a7b2/amqplib/client_0_8/channel.py#L2513-L2554
43,910
barryp/py-amqplib
amqplib/client_0_8/connection.py
Connection._wait_method
def _wait_method(self, channel_id, allowed_methods): """ Wait for a method from the server destined for a particular channel. """ # # Check the channel's deferred methods # method_queue = self.channels[channel_id].method_queue for queued_method i...
python
def _wait_method(self, channel_id, allowed_methods): """ Wait for a method from the server destined for a particular channel. """ # # Check the channel's deferred methods # method_queue = self.channels[channel_id].method_queue for queued_method i...
[ "def", "_wait_method", "(", "self", ",", "channel_id", ",", "allowed_methods", ")", ":", "#", "# Check the channel's deferred methods", "#", "method_queue", "=", "self", ".", "channels", "[", "channel_id", "]", ".", "method_queue", "for", "queued_method", "in", "m...
Wait for a method from the server destined for a particular channel.
[ "Wait", "for", "a", "method", "from", "the", "server", "destined", "for", "a", "particular", "channel", "." ]
2b3a47de34b4712c111d0a55d7ff109dffc2a7b2
https://github.com/barryp/py-amqplib/blob/2b3a47de34b4712c111d0a55d7ff109dffc2a7b2/amqplib/client_0_8/connection.py#L178-L231
43,911
barryp/py-amqplib
amqplib/client_0_8/connection.py
Connection.channel
def channel(self, channel_id=None): """ Fetch a Channel object identified by the numeric channel_id, or create that object if it doesn't already exist. """ if channel_id in self.channels: return self.channels[channel_id] return Channel(self, channel_id)
python
def channel(self, channel_id=None): """ Fetch a Channel object identified by the numeric channel_id, or create that object if it doesn't already exist. """ if channel_id in self.channels: return self.channels[channel_id] return Channel(self, channel_id)
[ "def", "channel", "(", "self", ",", "channel_id", "=", "None", ")", ":", "if", "channel_id", "in", "self", ".", "channels", ":", "return", "self", ".", "channels", "[", "channel_id", "]", "return", "Channel", "(", "self", ",", "channel_id", ")" ]
Fetch a Channel object identified by the numeric channel_id, or create that object if it doesn't already exist.
[ "Fetch", "a", "Channel", "object", "identified", "by", "the", "numeric", "channel_id", "or", "create", "that", "object", "if", "it", "doesn", "t", "already", "exist", "." ]
2b3a47de34b4712c111d0a55d7ff109dffc2a7b2
https://github.com/barryp/py-amqplib/blob/2b3a47de34b4712c111d0a55d7ff109dffc2a7b2/amqplib/client_0_8/connection.py#L234-L243
43,912
barryp/py-amqplib
amqplib/client_0_8/connection.py
Connection._close
def _close(self, args): """ request a connection close This method indicates that the sender wants to close the connection. This may be due to internal conditions (e.g. a forced shut-down) or due to an error handling a specific method, i.e. an exception. When a close is...
python
def _close(self, args): """ request a connection close This method indicates that the sender wants to close the connection. This may be due to internal conditions (e.g. a forced shut-down) or due to an error handling a specific method, i.e. an exception. When a close is...
[ "def", "_close", "(", "self", ",", "args", ")", ":", "reply_code", "=", "args", ".", "read_short", "(", ")", "reply_text", "=", "args", ".", "read_shortstr", "(", ")", "class_id", "=", "args", ".", "read_short", "(", ")", "method_id", "=", "args", ".",...
request a connection close This method indicates that the sender wants to close the connection. This may be due to internal conditions (e.g. a forced shut-down) or due to an error handling a specific method, i.e. an exception. When a close is due to an exception, the sender pro...
[ "request", "a", "connection", "close" ]
2b3a47de34b4712c111d0a55d7ff109dffc2a7b2
https://github.com/barryp/py-amqplib/blob/2b3a47de34b4712c111d0a55d7ff109dffc2a7b2/amqplib/client_0_8/connection.py#L318-L380
43,913
barryp/py-amqplib
amqplib/client_0_8/connection.py
Connection._x_open
def _x_open(self, virtual_host, capabilities='', insist=False): """ open connection to virtual host This method opens a connection to a virtual host, which is a collection of resources, and acts to separate multiple application domains within a server. RULE: ...
python
def _x_open(self, virtual_host, capabilities='', insist=False): """ open connection to virtual host This method opens a connection to a virtual host, which is a collection of resources, and acts to separate multiple application domains within a server. RULE: ...
[ "def", "_x_open", "(", "self", ",", "virtual_host", ",", "capabilities", "=", "''", ",", "insist", "=", "False", ")", ":", "args", "=", "AMQPWriter", "(", ")", "args", ".", "write_shortstr", "(", "virtual_host", ")", "args", ".", "write_shortstr", "(", "...
open connection to virtual host This method opens a connection to a virtual host, which is a collection of resources, and acts to separate multiple application domains within a server. RULE: The client MUST open the context before doing any work on the connecti...
[ "open", "connection", "to", "virtual", "host" ]
2b3a47de34b4712c111d0a55d7ff109dffc2a7b2
https://github.com/barryp/py-amqplib/blob/2b3a47de34b4712c111d0a55d7ff109dffc2a7b2/amqplib/client_0_8/connection.py#L418-L492
43,914
barryp/py-amqplib
amqplib/client_0_8/connection.py
Connection._open_ok
def _open_ok(self, args): """ signal that the connection is ready This method signals to the client that the connection is ready for use. PARAMETERS: known_hosts: shortstr """ self.known_hosts = args.read_shortstr() AMQP_LOGGER.debug('Open O...
python
def _open_ok(self, args): """ signal that the connection is ready This method signals to the client that the connection is ready for use. PARAMETERS: known_hosts: shortstr """ self.known_hosts = args.read_shortstr() AMQP_LOGGER.debug('Open O...
[ "def", "_open_ok", "(", "self", ",", "args", ")", ":", "self", ".", "known_hosts", "=", "args", ".", "read_shortstr", "(", ")", "AMQP_LOGGER", ".", "debug", "(", "'Open OK! known_hosts [%s]'", "%", "self", ".", "known_hosts", ")", "return", "None" ]
signal that the connection is ready This method signals to the client that the connection is ready for use. PARAMETERS: known_hosts: shortstr
[ "signal", "that", "the", "connection", "is", "ready" ]
2b3a47de34b4712c111d0a55d7ff109dffc2a7b2
https://github.com/barryp/py-amqplib/blob/2b3a47de34b4712c111d0a55d7ff109dffc2a7b2/amqplib/client_0_8/connection.py#L495-L508
43,915
barryp/py-amqplib
amqplib/client_0_8/connection.py
Connection._redirect
def _redirect(self, args): """ asks the client to use a different server This method redirects the client to another server, based on the requested virtual host and/or capabilities. RULE: When getting the Connection.Redirect method, the client SHOULD re...
python
def _redirect(self, args): """ asks the client to use a different server This method redirects the client to another server, based on the requested virtual host and/or capabilities. RULE: When getting the Connection.Redirect method, the client SHOULD re...
[ "def", "_redirect", "(", "self", ",", "args", ")", ":", "host", "=", "args", ".", "read_shortstr", "(", ")", "self", ".", "known_hosts", "=", "args", ".", "read_shortstr", "(", ")", "AMQP_LOGGER", ".", "debug", "(", "'Redirected to [%s], known_hosts [%s]'", ...
asks the client to use a different server This method redirects the client to another server, based on the requested virtual host and/or capabilities. RULE: When getting the Connection.Redirect method, the client SHOULD reconnect to the host specified, and if that host...
[ "asks", "the", "client", "to", "use", "a", "different", "server" ]
2b3a47de34b4712c111d0a55d7ff109dffc2a7b2
https://github.com/barryp/py-amqplib/blob/2b3a47de34b4712c111d0a55d7ff109dffc2a7b2/amqplib/client_0_8/connection.py#L511-L542
43,916
barryp/py-amqplib
amqplib/client_0_8/connection.py
Connection._start
def _start(self, args): """ start connection negotiation This method starts the connection negotiation process by telling the client the protocol version that the server proposes, along with a list of security mechanisms which the client can use for authentication. ...
python
def _start(self, args): """ start connection negotiation This method starts the connection negotiation process by telling the client the protocol version that the server proposes, along with a list of security mechanisms which the client can use for authentication. ...
[ "def", "_start", "(", "self", ",", "args", ")", ":", "self", ".", "version_major", "=", "args", ".", "read_octet", "(", ")", "self", ".", "version_minor", "=", "args", ".", "read_octet", "(", ")", "self", ".", "server_properties", "=", "args", ".", "re...
start connection negotiation This method starts the connection negotiation process by telling the client the protocol version that the server proposes, along with a list of security mechanisms which the client can use for authentication. RULE: If the client cannot ...
[ "start", "connection", "negotiation" ]
2b3a47de34b4712c111d0a55d7ff109dffc2a7b2
https://github.com/barryp/py-amqplib/blob/2b3a47de34b4712c111d0a55d7ff109dffc2a7b2/amqplib/client_0_8/connection.py#L588-L661
43,917
barryp/py-amqplib
amqplib/client_0_8/connection.py
Connection._x_start_ok
def _x_start_ok(self, client_properties, mechanism, response, locale): """ select security mechanism and locale This method selects a SASL security mechanism. ASL uses SASL (RFC2222) to negotiate authentication and encryption. PARAMETERS: client_properties: table ...
python
def _x_start_ok(self, client_properties, mechanism, response, locale): """ select security mechanism and locale This method selects a SASL security mechanism. ASL uses SASL (RFC2222) to negotiate authentication and encryption. PARAMETERS: client_properties: table ...
[ "def", "_x_start_ok", "(", "self", ",", "client_properties", ",", "mechanism", ",", "response", ",", "locale", ")", ":", "args", "=", "AMQPWriter", "(", ")", "args", ".", "write_table", "(", "client_properties", ")", "args", ".", "write_shortstr", "(", "mech...
select security mechanism and locale This method selects a SASL security mechanism. ASL uses SASL (RFC2222) to negotiate authentication and encryption. PARAMETERS: client_properties: table client properties mechanism: shortstr selected...
[ "select", "security", "mechanism", "and", "locale" ]
2b3a47de34b4712c111d0a55d7ff109dffc2a7b2
https://github.com/barryp/py-amqplib/blob/2b3a47de34b4712c111d0a55d7ff109dffc2a7b2/amqplib/client_0_8/connection.py#L664-L719
43,918
barryp/py-amqplib
amqplib/client_0_8/connection.py
Connection._tune
def _tune(self, args): """ propose connection tuning parameters This method proposes a set of connection configuration values to the client. The client can accept and/or adjust these. PARAMETERS: channel_max: short proposed maximum channels ...
python
def _tune(self, args): """ propose connection tuning parameters This method proposes a set of connection configuration values to the client. The client can accept and/or adjust these. PARAMETERS: channel_max: short proposed maximum channels ...
[ "def", "_tune", "(", "self", ",", "args", ")", ":", "self", ".", "channel_max", "=", "args", ".", "read_short", "(", ")", "or", "self", ".", "channel_max", "self", ".", "frame_max", "=", "args", ".", "read_long", "(", ")", "or", "self", ".", "frame_m...
propose connection tuning parameters This method proposes a set of connection configuration values to the client. The client can accept and/or adjust these. PARAMETERS: channel_max: short proposed maximum channels The maximum total number of chann...
[ "propose", "connection", "tuning", "parameters" ]
2b3a47de34b4712c111d0a55d7ff109dffc2a7b2
https://github.com/barryp/py-amqplib/blob/2b3a47de34b4712c111d0a55d7ff109dffc2a7b2/amqplib/client_0_8/connection.py#L722-L770
43,919
barryp/py-amqplib
amqplib/client_0_8/abstract_channel.py
AbstractChannel._send_method
def _send_method(self, method_sig, args=bytes(), content=None): """ Send a method for our channel. """ if isinstance(args, AMQPWriter): args = args.getvalue() self.connection.method_writer.write_method(self.channel_id, method_sig, args, content)
python
def _send_method(self, method_sig, args=bytes(), content=None): """ Send a method for our channel. """ if isinstance(args, AMQPWriter): args = args.getvalue() self.connection.method_writer.write_method(self.channel_id, method_sig, args, content)
[ "def", "_send_method", "(", "self", ",", "method_sig", ",", "args", "=", "bytes", "(", ")", ",", "content", "=", "None", ")", ":", "if", "isinstance", "(", "args", ",", "AMQPWriter", ")", ":", "args", "=", "args", ".", "getvalue", "(", ")", "self", ...
Send a method for our channel.
[ "Send", "a", "method", "for", "our", "channel", "." ]
2b3a47de34b4712c111d0a55d7ff109dffc2a7b2
https://github.com/barryp/py-amqplib/blob/2b3a47de34b4712c111d0a55d7ff109dffc2a7b2/amqplib/client_0_8/abstract_channel.py#L67-L76
43,920
barryp/py-amqplib
amqplib/client_0_8/transport.py
_AbstractTransport.read_frame
def read_frame(self): """ Read an AMQP frame. """ frame_type, channel, size = unpack('>BHI', self._read(7)) payload = self._read(size) ch = ord(self._read(1)) if ch == 206: # '\xce' return frame_type, channel, payload else: raise E...
python
def read_frame(self): """ Read an AMQP frame. """ frame_type, channel, size = unpack('>BHI', self._read(7)) payload = self._read(size) ch = ord(self._read(1)) if ch == 206: # '\xce' return frame_type, channel, payload else: raise E...
[ "def", "read_frame", "(", "self", ")", ":", "frame_type", ",", "channel", ",", "size", "=", "unpack", "(", "'>BHI'", ",", "self", ".", "_read", "(", "7", ")", ")", "payload", "=", "self", ".", "_read", "(", "size", ")", "ch", "=", "ord", "(", "se...
Read an AMQP frame.
[ "Read", "an", "AMQP", "frame", "." ]
2b3a47de34b4712c111d0a55d7ff109dffc2a7b2
https://github.com/barryp/py-amqplib/blob/2b3a47de34b4712c111d0a55d7ff109dffc2a7b2/amqplib/client_0_8/transport.py#L144-L155
43,921
barryp/py-amqplib
amqplib/client_0_8/transport.py
_AbstractTransport.write_frame
def write_frame(self, frame_type, channel, payload): """ Write out an AMQP frame. """ size = len(payload) self._write(pack('>BHI%dsB' % size, frame_type, channel, size, payload, 0xce))
python
def write_frame(self, frame_type, channel, payload): """ Write out an AMQP frame. """ size = len(payload) self._write(pack('>BHI%dsB' % size, frame_type, channel, size, payload, 0xce))
[ "def", "write_frame", "(", "self", ",", "frame_type", ",", "channel", ",", "payload", ")", ":", "size", "=", "len", "(", "payload", ")", "self", ".", "_write", "(", "pack", "(", "'>BHI%dsB'", "%", "size", ",", "frame_type", ",", "channel", ",", "size",...
Write out an AMQP frame.
[ "Write", "out", "an", "AMQP", "frame", "." ]
2b3a47de34b4712c111d0a55d7ff109dffc2a7b2
https://github.com/barryp/py-amqplib/blob/2b3a47de34b4712c111d0a55d7ff109dffc2a7b2/amqplib/client_0_8/transport.py#L158-L165
43,922
barryp/py-amqplib
amqplib/client_0_8/transport.py
SSLTransport._setup_transport
def _setup_transport(self): """ Wrap the socket in an SSL object, either the new Python 2.6 version, or the older Python 2.5 and lower version. """ if HAVE_PY26_SSL: if hasattr(self, 'sslopts'): self.sslobj = ssl.wrap_socket(self.sock, **self....
python
def _setup_transport(self): """ Wrap the socket in an SSL object, either the new Python 2.6 version, or the older Python 2.5 and lower version. """ if HAVE_PY26_SSL: if hasattr(self, 'sslopts'): self.sslobj = ssl.wrap_socket(self.sock, **self....
[ "def", "_setup_transport", "(", "self", ")", ":", "if", "HAVE_PY26_SSL", ":", "if", "hasattr", "(", "self", ",", "'sslopts'", ")", ":", "self", ".", "sslobj", "=", "ssl", ".", "wrap_socket", "(", "self", ".", "sock", ",", "*", "*", "self", ".", "sslo...
Wrap the socket in an SSL object, either the new Python 2.6 version, or the older Python 2.5 and lower version.
[ "Wrap", "the", "socket", "in", "an", "SSL", "object", "either", "the", "new", "Python", "2", ".", "6", "version", "or", "the", "older", "Python", "2", ".", "5", "and", "lower", "version", "." ]
2b3a47de34b4712c111d0a55d7ff109dffc2a7b2
https://github.com/barryp/py-amqplib/blob/2b3a47de34b4712c111d0a55d7ff109dffc2a7b2/amqplib/client_0_8/transport.py#L182-L196
43,923
barryp/py-amqplib
amqplib/client_0_8/serialization.py
AMQPWriter.write_bit
def write_bit(self, b): """ Write a boolean value. """ if b: b = 1 else: b = 0 shift = self.bitcount % 8 if shift == 0: self.bits.append(0) self.bits[-1] |= (b << shift) self.bitcount += 1
python
def write_bit(self, b): """ Write a boolean value. """ if b: b = 1 else: b = 0 shift = self.bitcount % 8 if shift == 0: self.bits.append(0) self.bits[-1] |= (b << shift) self.bitcount += 1
[ "def", "write_bit", "(", "self", ",", "b", ")", ":", "if", "b", ":", "b", "=", "1", "else", ":", "b", "=", "0", "shift", "=", "self", ".", "bitcount", "%", "8", "if", "shift", "==", "0", ":", "self", ".", "bits", ".", "append", "(", "0", ")...
Write a boolean value.
[ "Write", "a", "boolean", "value", "." ]
2b3a47de34b4712c111d0a55d7ff109dffc2a7b2
https://github.com/barryp/py-amqplib/blob/2b3a47de34b4712c111d0a55d7ff109dffc2a7b2/amqplib/client_0_8/serialization.py#L270-L283
43,924
miguelgrinberg/slam
slam/cli.py
on_unexpected_error
def on_unexpected_error(e): # pragma: no cover """Catch-all error handler Unexpected errors will be handled by this function. """ sys.stderr.write('Unexpected error: {} ({})\n'.format( str(e), e.__class__.__name__)) sys.stderr.write('See file slam_error.log for additional details.\n') ...
python
def on_unexpected_error(e): # pragma: no cover """Catch-all error handler Unexpected errors will be handled by this function. """ sys.stderr.write('Unexpected error: {} ({})\n'.format( str(e), e.__class__.__name__)) sys.stderr.write('See file slam_error.log for additional details.\n') ...
[ "def", "on_unexpected_error", "(", "e", ")", ":", "# pragma: no cover", "sys", ".", "stderr", ".", "write", "(", "'Unexpected error: {} ({})\\n'", ".", "format", "(", "str", "(", "e", ")", ",", "e", ".", "__class__", ".", "__name__", ")", ")", "sys", ".", ...
Catch-all error handler Unexpected errors will be handled by this function.
[ "Catch", "-", "all", "error", "handler" ]
cf68a4bbc16d909718f8a9e71072b822e0a3d94b
https://github.com/miguelgrinberg/slam/blob/cf68a4bbc16d909718f8a9e71072b822e0a3d94b/slam/cli.py#L60-L68
43,925
miguelgrinberg/slam
slam/cli.py
init
def init(name, description, bucket, timeout, memory, stages, requirements, function, runtime, config_file, **kwargs): """Generate a configuration file.""" if os.path.exists(config_file): raise RuntimeError('Please delete the old version {} if you want to ' 'reconfigur...
python
def init(name, description, bucket, timeout, memory, stages, requirements, function, runtime, config_file, **kwargs): """Generate a configuration file.""" if os.path.exists(config_file): raise RuntimeError('Please delete the old version {} if you want to ' 'reconfigur...
[ "def", "init", "(", "name", ",", "description", ",", "bucket", ",", "timeout", ",", "memory", ",", "stages", ",", "requirements", ",", "function", ",", "runtime", ",", "config_file", ",", "*", "*", "kwargs", ")", ":", "if", "os", ".", "path", ".", "e...
Generate a configuration file.
[ "Generate", "a", "configuration", "file", "." ]
cf68a4bbc16d909718f8a9e71072b822e0a3d94b
https://github.com/miguelgrinberg/slam/blob/cf68a4bbc16d909718f8a9e71072b822e0a3d94b/slam/cli.py#L103-L160
43,926
miguelgrinberg/slam
slam/cli.py
_generate_lambda_handler
def _generate_lambda_handler(config, output='.slam/handler.py'): """Generate a handler.py file for the lambda function start up.""" # Determine what the start up code is. The default is to just run the # function, but it can be overriden by a plugin such as wsgi for a more # elaborated way to run the fu...
python
def _generate_lambda_handler(config, output='.slam/handler.py'): """Generate a handler.py file for the lambda function start up.""" # Determine what the start up code is. The default is to just run the # function, but it can be overriden by a plugin such as wsgi for a more # elaborated way to run the fu...
[ "def", "_generate_lambda_handler", "(", "config", ",", "output", "=", "'.slam/handler.py'", ")", ":", "# Determine what the start up code is. The default is to just run the", "# function, but it can be overriden by a plugin such as wsgi for a more", "# elaborated way to run the function.", ...
Generate a handler.py file for the lambda function start up.
[ "Generate", "a", "handler", ".", "py", "file", "for", "the", "lambda", "function", "start", "up", "." ]
cf68a4bbc16d909718f8a9e71072b822e0a3d94b
https://github.com/miguelgrinberg/slam/blob/cf68a4bbc16d909718f8a9e71072b822e0a3d94b/slam/cli.py#L192-L213
43,927
miguelgrinberg/slam
slam/cli.py
build
def build(rebuild_deps, config_file): """Build lambda package.""" config = _load_config(config_file) print("Building lambda package...") package = _build(config, rebuild_deps=rebuild_deps) print("{} has been built successfully.".format(package))
python
def build(rebuild_deps, config_file): """Build lambda package.""" config = _load_config(config_file) print("Building lambda package...") package = _build(config, rebuild_deps=rebuild_deps) print("{} has been built successfully.".format(package))
[ "def", "build", "(", "rebuild_deps", ",", "config_file", ")", ":", "config", "=", "_load_config", "(", "config_file", ")", "print", "(", "\"Building lambda package...\"", ")", "package", "=", "_build", "(", "config", ",", "rebuild_deps", "=", "rebuild_deps", ")"...
Build lambda package.
[ "Build", "lambda", "package", "." ]
cf68a4bbc16d909718f8a9e71072b822e0a3d94b
https://github.com/miguelgrinberg/slam/blob/cf68a4bbc16d909718f8a9e71072b822e0a3d94b/slam/cli.py#L316-L322
43,928
miguelgrinberg/slam
slam/cli.py
deploy
def deploy(stage, lambda_package, no_lambda, rebuild_deps, config_file): """Deploy the project to the development stage.""" config = _load_config(config_file) if stage is None: stage = config['devstage'] s3 = boto3.client('s3') cfn = boto3.client('cloudformation') region = _get_aws_regi...
python
def deploy(stage, lambda_package, no_lambda, rebuild_deps, config_file): """Deploy the project to the development stage.""" config = _load_config(config_file) if stage is None: stage = config['devstage'] s3 = boto3.client('s3') cfn = boto3.client('cloudformation') region = _get_aws_regi...
[ "def", "deploy", "(", "stage", ",", "lambda_package", ",", "no_lambda", ",", "rebuild_deps", ",", "config_file", ")", ":", "config", "=", "_load_config", "(", "config_file", ")", "if", "stage", "is", "None", ":", "stage", "=", "config", "[", "'devstage'", ...
Deploy the project to the development stage.
[ "Deploy", "the", "project", "to", "the", "development", "stage", "." ]
cf68a4bbc16d909718f8a9e71072b822e0a3d94b
https://github.com/miguelgrinberg/slam/blob/cf68a4bbc16d909718f8a9e71072b822e0a3d94b/slam/cli.py#L335-L426
43,929
miguelgrinberg/slam
slam/cli.py
publish
def publish(version, stage, config_file): """Publish a version of the project to a stage.""" config = _load_config(config_file) cfn = boto3.client('cloudformation') if version is None: version = config['devstage'] elif version not in config['stage_environments'].keys() and \ not...
python
def publish(version, stage, config_file): """Publish a version of the project to a stage.""" config = _load_config(config_file) cfn = boto3.client('cloudformation') if version is None: version = config['devstage'] elif version not in config['stage_environments'].keys() and \ not...
[ "def", "publish", "(", "version", ",", "stage", ",", "config_file", ")", ":", "config", "=", "_load_config", "(", "config_file", ")", "cfn", "=", "boto3", ".", "client", "(", "'cloudformation'", ")", "if", "version", "is", "None", ":", "version", "=", "c...
Publish a version of the project to a stage.
[ "Publish", "a", "version", "of", "the", "project", "to", "a", "stage", "." ]
cf68a4bbc16d909718f8a9e71072b822e0a3d94b
https://github.com/miguelgrinberg/slam/blob/cf68a4bbc16d909718f8a9e71072b822e0a3d94b/slam/cli.py#L434-L505
43,930
miguelgrinberg/slam
slam/cli.py
invoke
def invoke(stage, async, dry_run, config_file, args): """Invoke the lambda function.""" config = _load_config(config_file) if stage is None: stage = config['devstage'] cfn = boto3.client('cloudformation') lmb = boto3.client('lambda') try: stack = cfn.describe_stacks(StackName=c...
python
def invoke(stage, async, dry_run, config_file, args): """Invoke the lambda function.""" config = _load_config(config_file) if stage is None: stage = config['devstage'] cfn = boto3.client('cloudformation') lmb = boto3.client('lambda') try: stack = cfn.describe_stacks(StackName=c...
[ "def", "invoke", "(", "stage", ",", "async", ",", "dry_run", ",", "config_file", ",", "args", ")", ":", "config", "=", "_load_config", "(", "config_file", ")", "if", "stage", "is", "None", ":", "stage", "=", "config", "[", "'devstage'", "]", "cfn", "="...
Invoke the lambda function.
[ "Invoke", "the", "lambda", "function", "." ]
cf68a4bbc16d909718f8a9e71072b822e0a3d94b
https://github.com/miguelgrinberg/slam/blob/cf68a4bbc16d909718f8a9e71072b822e0a3d94b/slam/cli.py#L519-L574
43,931
miguelgrinberg/slam
slam/cli.py
template
def template(config_file): """Print the default Cloudformation deployment template.""" config = _load_config(config_file) print(get_cfn_template(config, pretty=True))
python
def template(config_file): """Print the default Cloudformation deployment template.""" config = _load_config(config_file) print(get_cfn_template(config, pretty=True))
[ "def", "template", "(", "config_file", ")", ":", "config", "=", "_load_config", "(", "config_file", ")", "print", "(", "get_cfn_template", "(", "config", ",", "pretty", "=", "True", ")", ")" ]
Print the default Cloudformation deployment template.
[ "Print", "the", "default", "Cloudformation", "deployment", "template", "." ]
cf68a4bbc16d909718f8a9e71072b822e0a3d94b
https://github.com/miguelgrinberg/slam/blob/cf68a4bbc16d909718f8a9e71072b822e0a3d94b/slam/cli.py#L713-L716
43,932
miguelgrinberg/slam
slam/cli.py
register_plugins
def register_plugins(): """find any installed plugins and register them.""" if pkg_resources: # pragma: no cover for ep in pkg_resources.iter_entry_points('slam_plugins'): plugin = ep.load() # add any init options to the main init command if hasattr(plugin, 'init') ...
python
def register_plugins(): """find any installed plugins and register them.""" if pkg_resources: # pragma: no cover for ep in pkg_resources.iter_entry_points('slam_plugins'): plugin = ep.load() # add any init options to the main init command if hasattr(plugin, 'init') ...
[ "def", "register_plugins", "(", ")", ":", "if", "pkg_resources", ":", "# pragma: no cover", "for", "ep", "in", "pkg_resources", ".", "iter_entry_points", "(", "'slam_plugins'", ")", ":", "plugin", "=", "ep", ".", "load", "(", ")", "# add any init options to the ma...
find any installed plugins and register them.
[ "find", "any", "installed", "plugins", "and", "register", "them", "." ]
cf68a4bbc16d909718f8a9e71072b822e0a3d94b
https://github.com/miguelgrinberg/slam/blob/cf68a4bbc16d909718f8a9e71072b822e0a3d94b/slam/cli.py#L719-L732
43,933
richtier/alexa-voice-service-client
alexa_client/alexa_client/connection.py
ConnectionManager.synchronise_device_state
def synchronise_device_state(self, device_state, authentication_headers): """ Synchronizing the component states with AVS Components state must be synchronised with AVS after establishing the downchannel stream in order to create a persistent connection with AVS. Note that curr...
python
def synchronise_device_state(self, device_state, authentication_headers): """ Synchronizing the component states with AVS Components state must be synchronised with AVS after establishing the downchannel stream in order to create a persistent connection with AVS. Note that curr...
[ "def", "synchronise_device_state", "(", "self", ",", "device_state", ",", "authentication_headers", ")", ":", "payload", "=", "{", "'context'", ":", "device_state", ",", "'event'", ":", "{", "'header'", ":", "{", "'namespace'", ":", "'System'", ",", "'name'", ...
Synchronizing the component states with AVS Components state must be synchronised with AVS after establishing the downchannel stream in order to create a persistent connection with AVS. Note that currently this function is paying lip-service synchronising the device state: the device s...
[ "Synchronizing", "the", "component", "states", "with", "AVS" ]
b423d0da6f3008bfa38fd4aaeb970fbb56159789
https://github.com/richtier/alexa-voice-service-client/blob/b423d0da6f3008bfa38fd4aaeb970fbb56159789/alexa_client/alexa_client/connection.py#L27-L74
43,934
richtier/alexa-voice-service-client
alexa_client/alexa_client/connection.py
ConnectionManager.send_audio_file
def send_audio_file( self, audio_file, device_state, authentication_headers, dialog_request_id, distance_profile, audio_format ): """ Send audio to AVS The file-like object are steaming uploaded for improved latency. Returns: bytes -- wav audio bytes ret...
python
def send_audio_file( self, audio_file, device_state, authentication_headers, dialog_request_id, distance_profile, audio_format ): """ Send audio to AVS The file-like object are steaming uploaded for improved latency. Returns: bytes -- wav audio bytes ret...
[ "def", "send_audio_file", "(", "self", ",", "audio_file", ",", "device_state", ",", "authentication_headers", ",", "dialog_request_id", ",", "distance_profile", ",", "audio_format", ")", ":", "payload", "=", "{", "'context'", ":", "device_state", ",", "'event'", "...
Send audio to AVS The file-like object are steaming uploaded for improved latency. Returns: bytes -- wav audio bytes returned from AVS
[ "Send", "audio", "to", "AVS" ]
b423d0da6f3008bfa38fd4aaeb970fbb56159789
https://github.com/richtier/alexa-voice-service-client/blob/b423d0da6f3008bfa38fd4aaeb970fbb56159789/alexa_client/alexa_client/connection.py#L76-L137
43,935
richtier/alexa-voice-service-client
alexa_client/alexa_client/authentication.py
AlexaVoiceServiceTokenAuthenticator.retrieve_api_token
def retrieve_api_token(self): """ Retrieve the access token from AVS. This function is memoized, so the value returned by the function will be remembered and returned by subsequent calls until the memo expires. This is because the access token lasts for one hour, then a ...
python
def retrieve_api_token(self): """ Retrieve the access token from AVS. This function is memoized, so the value returned by the function will be remembered and returned by subsequent calls until the memo expires. This is because the access token lasts for one hour, then a ...
[ "def", "retrieve_api_token", "(", "self", ")", ":", "payload", "=", "self", ".", "oauth2_manager", ".", "get_access_token_params", "(", "refresh_token", "=", "self", ".", "refresh_token", ")", "response", "=", "requests", ".", "post", "(", "self", ".", "oauth2...
Retrieve the access token from AVS. This function is memoized, so the value returned by the function will be remembered and returned by subsequent calls until the memo expires. This is because the access token lasts for one hour, then a new token needs to be requested. Decorato...
[ "Retrieve", "the", "access", "token", "from", "AVS", "." ]
b423d0da6f3008bfa38fd4aaeb970fbb56159789
https://github.com/richtier/alexa-voice-service-client/blob/b423d0da6f3008bfa38fd4aaeb970fbb56159789/alexa_client/alexa_client/authentication.py#L20-L45
43,936
markfinger/python-webpack
webpack/templatetags/webpack.py
webpack_template_tag
def webpack_template_tag(path_to_config): """ A template tag that will output a webpack bundle. Usage: {% load webpack %} {% webpack 'path/to/webpack.config.js' as bundle %} {{ bundle.render_css|safe }} {{ bundle.render_js|safe }} """ # TODO: allow selec...
python
def webpack_template_tag(path_to_config): """ A template tag that will output a webpack bundle. Usage: {% load webpack %} {% webpack 'path/to/webpack.config.js' as bundle %} {{ bundle.render_css|safe }} {{ bundle.render_js|safe }} """ # TODO: allow selec...
[ "def", "webpack_template_tag", "(", "path_to_config", ")", ":", "# TODO: allow selection of entries", "# Django's template system silently fails on some exceptions", "try", ":", "return", "webpack", "(", "path_to_config", ")", "except", "(", "AttributeError", ",", "ValueError",...
A template tag that will output a webpack bundle. Usage: {% load webpack %} {% webpack 'path/to/webpack.config.js' as bundle %} {{ bundle.render_css|safe }} {{ bundle.render_js|safe }}
[ "A", "template", "tag", "that", "will", "output", "a", "webpack", "bundle", "." ]
41ed0a3afac0dc96cb22093bd2da1dcbd31cfc42
https://github.com/markfinger/python-webpack/blob/41ed0a3afac0dc96cb22093bd2da1dcbd31cfc42/webpack/templatetags/webpack.py#L11-L32
43,937
jneen/python-cache
src/cache/__init__.py
_prepare_key
def _prepare_key(key, *args, **kwargs): """ if arguments are given, adds a hash of the args to the key. """ if not args and not kwargs: return key items = sorted(kwargs.items()) hashable_args = (args, tuple(items)) args_key = hashlib.md5(pickle.dumps(hashable_args)).hexdigest() ...
python
def _prepare_key(key, *args, **kwargs): """ if arguments are given, adds a hash of the args to the key. """ if not args and not kwargs: return key items = sorted(kwargs.items()) hashable_args = (args, tuple(items)) args_key = hashlib.md5(pickle.dumps(hashable_args)).hexdigest() ...
[ "def", "_prepare_key", "(", "key", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "not", "args", "and", "not", "kwargs", ":", "return", "key", "items", "=", "sorted", "(", "kwargs", ".", "items", "(", ")", ")", "hashable_args", "=", "("...
if arguments are given, adds a hash of the args to the key.
[ "if", "arguments", "are", "given", "adds", "a", "hash", "of", "the", "args", "to", "the", "key", "." ]
4f0d4e299221d3ff612905ff632b7c6d3afd82db
https://github.com/jneen/python-cache/blob/4f0d4e299221d3ff612905ff632b7c6d3afd82db/src/cache/__init__.py#L164-L176
43,938
acschaefer/duallog
duallog/duallog.py
setup
def setup(logdir='log'): """ Set up dual logging to console and to logfile. When this function is called, it first creates the given directory. It then creates a logfile and passes all log messages to come to it. The logfile name encodes the date and time when it was created, for example "2018111...
python
def setup(logdir='log'): """ Set up dual logging to console and to logfile. When this function is called, it first creates the given directory. It then creates a logfile and passes all log messages to come to it. The logfile name encodes the date and time when it was created, for example "2018111...
[ "def", "setup", "(", "logdir", "=", "'log'", ")", ":", "# Create the root logger.", "logger", "=", "logging", ".", "getLogger", "(", ")", "logger", ".", "setLevel", "(", "logging", ".", "DEBUG", ")", "# Validate the given directory.", "logdir", "=", "os", ".",...
Set up dual logging to console and to logfile. When this function is called, it first creates the given directory. It then creates a logfile and passes all log messages to come to it. The logfile name encodes the date and time when it was created, for example "20181115-153559.txt". All messages with ...
[ "Set", "up", "dual", "logging", "to", "console", "and", "to", "logfile", "." ]
6e8dd367713d7954292320300bba2a0d75a4aac4
https://github.com/acschaefer/duallog/blob/6e8dd367713d7954292320300bba2a0d75a4aac4/duallog/duallog.py#L25-L77
43,939
urda/django-letsencrypt
scripts/version_manager.py
get_versions
def get_versions() -> FileVersionResult: """ Search specific project files and extract versions to check. :return: A FileVersionResult object for reporting. """ version_counter = Counter() versions_match = False version_str = None versions_discovered = OrderedDict() for version_ob...
python
def get_versions() -> FileVersionResult: """ Search specific project files and extract versions to check. :return: A FileVersionResult object for reporting. """ version_counter = Counter() versions_match = False version_str = None versions_discovered = OrderedDict() for version_ob...
[ "def", "get_versions", "(", ")", "->", "FileVersionResult", ":", "version_counter", "=", "Counter", "(", ")", "versions_match", "=", "False", "version_str", "=", "None", "versions_discovered", "=", "OrderedDict", "(", ")", "for", "version_obj", "in", "version_obje...
Search specific project files and extract versions to check. :return: A FileVersionResult object for reporting.
[ "Search", "specific", "project", "files", "and", "extract", "versions", "to", "check", "." ]
e0149163d3544cc0a8b4df64187237cdc75797ed
https://github.com/urda/django-letsencrypt/blob/e0149163d3544cc0a8b4df64187237cdc75797ed/scripts/version_manager.py#L159-L184
43,940
olls/graphics
graphics/console.py
supportedChars
def supportedChars(*tests): """ Takes any number of strings, and returns the first one the terminal encoding supports. If none are supported it returns '?' the length of the first string. """ for test in tests: try: test.encode(sys.stdout.encoding) ...
python
def supportedChars(*tests): """ Takes any number of strings, and returns the first one the terminal encoding supports. If none are supported it returns '?' the length of the first string. """ for test in tests: try: test.encode(sys.stdout.encoding) ...
[ "def", "supportedChars", "(", "*", "tests", ")", ":", "for", "test", "in", "tests", ":", "try", ":", "test", ".", "encode", "(", "sys", ".", "stdout", ".", "encoding", ")", "return", "test", "except", "UnicodeEncodeError", ":", "pass", "return", "'?'", ...
Takes any number of strings, and returns the first one the terminal encoding supports. If none are supported it returns '?' the length of the first string.
[ "Takes", "any", "number", "of", "strings", "and", "returns", "the", "first", "one", "the", "terminal", "encoding", "supports", ".", "If", "none", "are", "supported", "it", "returns", "?", "the", "length", "of", "the", "first", "string", "." ]
a302e9fe648d2d44603b52ac5bb80df4863b2a7d
https://github.com/olls/graphics/blob/a302e9fe648d2d44603b52ac5bb80df4863b2a7d/graphics/console.py#L78-L90
43,941
Fantomas42/django-app-namespace-template-loader
app_namespace/loader.py
Loader.app_templates_dirs
def app_templates_dirs(self): """ Build a cached dict with settings.INSTALLED_APPS as keys and the 'templates' directory of each application as values. """ app_templates_dirs = OrderedDict() for app_config in apps.get_app_configs(): templates_dir = os.path.joi...
python
def app_templates_dirs(self): """ Build a cached dict with settings.INSTALLED_APPS as keys and the 'templates' directory of each application as values. """ app_templates_dirs = OrderedDict() for app_config in apps.get_app_configs(): templates_dir = os.path.joi...
[ "def", "app_templates_dirs", "(", "self", ")", ":", "app_templates_dirs", "=", "OrderedDict", "(", ")", "for", "app_config", "in", "apps", ".", "get_app_configs", "(", ")", ":", "templates_dir", "=", "os", ".", "path", ".", "join", "(", "getattr", "(", "ap...
Build a cached dict with settings.INSTALLED_APPS as keys and the 'templates' directory of each application as values.
[ "Build", "a", "cached", "dict", "with", "settings", ".", "INSTALLED_APPS", "as", "keys", "and", "the", "templates", "directory", "of", "each", "application", "as", "values", "." ]
9d56e8eef25082e126549be97856582d28d1e84d
https://github.com/Fantomas42/django-app-namespace-template-loader/blob/9d56e8eef25082e126549be97856582d28d1e84d/app_namespace/loader.py#L57-L70
43,942
Fantomas42/django-app-namespace-template-loader
app_namespace/loader.py
Loader.get_contents
def get_contents(self, origin): """ Try to load the origin. """ try: path = self.get_app_template_path( origin.app_name, origin.template_name) with io.open(path, encoding=self.engine.file_charset) as fp: return fp.read() exc...
python
def get_contents(self, origin): """ Try to load the origin. """ try: path = self.get_app_template_path( origin.app_name, origin.template_name) with io.open(path, encoding=self.engine.file_charset) as fp: return fp.read() exc...
[ "def", "get_contents", "(", "self", ",", "origin", ")", ":", "try", ":", "path", "=", "self", ".", "get_app_template_path", "(", "origin", ".", "app_name", ",", "origin", ".", "template_name", ")", "with", "io", ".", "open", "(", "path", ",", "encoding",...
Try to load the origin.
[ "Try", "to", "load", "the", "origin", "." ]
9d56e8eef25082e126549be97856582d28d1e84d
https://github.com/Fantomas42/django-app-namespace-template-loader/blob/9d56e8eef25082e126549be97856582d28d1e84d/app_namespace/loader.py#L72-L86
43,943
Fantomas42/django-app-namespace-template-loader
app_namespace/loader.py
Loader.load_template_source
def load_template_source(self, *ka): """ Backward compatible method for Django < 2.0. """ template_name = ka[0] for origin in self.get_template_sources(template_name): try: return self.get_contents(origin), origin.name except TemplateDoesNo...
python
def load_template_source(self, *ka): """ Backward compatible method for Django < 2.0. """ template_name = ka[0] for origin in self.get_template_sources(template_name): try: return self.get_contents(origin), origin.name except TemplateDoesNo...
[ "def", "load_template_source", "(", "self", ",", "*", "ka", ")", ":", "template_name", "=", "ka", "[", "0", "]", "for", "origin", "in", "self", ".", "get_template_sources", "(", "template_name", ")", ":", "try", ":", "return", "self", ".", "get_contents", ...
Backward compatible method for Django < 2.0.
[ "Backward", "compatible", "method", "for", "Django", "<", "2", ".", "0", "." ]
9d56e8eef25082e126549be97856582d28d1e84d
https://github.com/Fantomas42/django-app-namespace-template-loader/blob/9d56e8eef25082e126549be97856582d28d1e84d/app_namespace/loader.py#L120-L130
43,944
olls/graphics
graphics/funcs.py
rotateImage
def rotateImage(image, angle): """ rotates a 2d array to a multiple of 90 deg. 0 = default 1 = 90 deg. cw 2 = 180 deg. 3 = 90 deg. ccw """ image = [list(row) for row in image] for n in range(angle % 4): image = list(zip(*image[::-1])) return image
python
def rotateImage(image, angle): """ rotates a 2d array to a multiple of 90 deg. 0 = default 1 = 90 deg. cw 2 = 180 deg. 3 = 90 deg. ccw """ image = [list(row) for row in image] for n in range(angle % 4): image = list(zip(*image[::-1])) return image
[ "def", "rotateImage", "(", "image", ",", "angle", ")", ":", "image", "=", "[", "list", "(", "row", ")", "for", "row", "in", "image", "]", "for", "n", "in", "range", "(", "angle", "%", "4", ")", ":", "image", "=", "list", "(", "zip", "(", "*", ...
rotates a 2d array to a multiple of 90 deg. 0 = default 1 = 90 deg. cw 2 = 180 deg. 3 = 90 deg. ccw
[ "rotates", "a", "2d", "array", "to", "a", "multiple", "of", "90", "deg", ".", "0", "=", "default", "1", "=", "90", "deg", ".", "cw", "2", "=", "180", "deg", ".", "3", "=", "90", "deg", ".", "ccw" ]
a302e9fe648d2d44603b52ac5bb80df4863b2a7d
https://github.com/olls/graphics/blob/a302e9fe648d2d44603b52ac5bb80df4863b2a7d/graphics/funcs.py#L7-L20
43,945
olls/graphics
graphics/sprite.py
Sprite.overlaps
def overlaps(self, canvas, exclude=[]): """ Returns True if sprite is touching any other sprite. """ try: exclude = list(exclude) except TypeError: exclude = [exclude] exclude.append(self) for selfY, row in enumerate(self.image.image()...
python
def overlaps(self, canvas, exclude=[]): """ Returns True if sprite is touching any other sprite. """ try: exclude = list(exclude) except TypeError: exclude = [exclude] exclude.append(self) for selfY, row in enumerate(self.image.image()...
[ "def", "overlaps", "(", "self", ",", "canvas", ",", "exclude", "=", "[", "]", ")", ":", "try", ":", "exclude", "=", "list", "(", "exclude", ")", "except", "TypeError", ":", "exclude", "=", "[", "exclude", "]", "exclude", ".", "append", "(", "self", ...
Returns True if sprite is touching any other sprite.
[ "Returns", "True", "if", "sprite", "is", "touching", "any", "other", "sprite", "." ]
a302e9fe648d2d44603b52ac5bb80df4863b2a7d
https://github.com/olls/graphics/blob/a302e9fe648d2d44603b52ac5bb80df4863b2a7d/graphics/sprite.py#L128-L146
43,946
olls/graphics
graphics/sprite.py
Sprite.onEdge
def onEdge(self, canvas): """ Returns a list of the sides of the sprite which are touching the edge of the canvas. 0 = Bottom 1 = Left 2 = Top 3 = Right """ sides = [] if int(self.position[0]) <= 0: ...
python
def onEdge(self, canvas): """ Returns a list of the sides of the sprite which are touching the edge of the canvas. 0 = Bottom 1 = Left 2 = Top 3 = Right """ sides = [] if int(self.position[0]) <= 0: ...
[ "def", "onEdge", "(", "self", ",", "canvas", ")", ":", "sides", "=", "[", "]", "if", "int", "(", "self", ".", "position", "[", "0", "]", ")", "<=", "0", ":", "sides", ".", "append", "(", "1", ")", "if", "(", "int", "(", "self", ".", "position...
Returns a list of the sides of the sprite which are touching the edge of the canvas. 0 = Bottom 1 = Left 2 = Top 3 = Right
[ "Returns", "a", "list", "of", "the", "sides", "of", "the", "sprite", "which", "are", "touching", "the", "edge", "of", "the", "canvas", "." ]
a302e9fe648d2d44603b52ac5bb80df4863b2a7d
https://github.com/olls/graphics/blob/a302e9fe648d2d44603b52ac5bb80df4863b2a7d/graphics/sprite.py#L148-L171
43,947
arachnidlabs/mcp2210
build/lib/mcp2210/device.py
remote_property
def remote_property(name, get_command, set_command, field_name, doc=None): """Property decorator that facilitates writing properties for values from a remote device. Arguments: name: The field name to use on the local object to store the cached property. get_command: A function that returns the rem...
python
def remote_property(name, get_command, set_command, field_name, doc=None): """Property decorator that facilitates writing properties for values from a remote device. Arguments: name: The field name to use on the local object to store the cached property. get_command: A function that returns the rem...
[ "def", "remote_property", "(", "name", ",", "get_command", ",", "set_command", ",", "field_name", ",", "doc", "=", "None", ")", ":", "def", "getter", "(", "self", ")", ":", "try", ":", "return", "getattr", "(", "self", ",", "name", ")", "except", "Attr...
Property decorator that facilitates writing properties for values from a remote device. Arguments: name: The field name to use on the local object to store the cached property. get_command: A function that returns the remote value of the property. set_command: A function that accepts a new value ...
[ "Property", "decorator", "that", "facilitates", "writing", "properties", "for", "values", "from", "a", "remote", "device", "." ]
ee15973d66697feb3b8a685ab59c774bee55d10b
https://github.com/arachnidlabs/mcp2210/blob/ee15973d66697feb3b8a685ab59c774bee55d10b/build/lib/mcp2210/device.py#L43-L65
43,948
arachnidlabs/mcp2210
build/lib/mcp2210/device.py
MCP2210.sendCommand
def sendCommand(self, command): """Sends a Command object to the MCP2210 and returns its response. Arguments: A commands.Command instance Returns: A commands.Response instance, or raises a CommandException on error. """ command_data = [ord(x) for x in bu...
python
def sendCommand(self, command): """Sends a Command object to the MCP2210 and returns its response. Arguments: A commands.Command instance Returns: A commands.Response instance, or raises a CommandException on error. """ command_data = [ord(x) for x in bu...
[ "def", "sendCommand", "(", "self", ",", "command", ")", ":", "command_data", "=", "[", "ord", "(", "x", ")", "for", "x", "in", "buffer", "(", "command", ")", "]", "self", ".", "hid", ".", "write", "(", "command_data", ")", "response_data", "=", "''",...
Sends a Command object to the MCP2210 and returns its response. Arguments: A commands.Command instance Returns: A commands.Response instance, or raises a CommandException on error.
[ "Sends", "a", "Command", "object", "to", "the", "MCP2210", "and", "returns", "its", "response", "." ]
ee15973d66697feb3b8a685ab59c774bee55d10b
https://github.com/arachnidlabs/mcp2210/blob/ee15973d66697feb3b8a685ab59c774bee55d10b/build/lib/mcp2210/device.py#L125-L140
43,949
arachnidlabs/mcp2210
build/lib/mcp2210/device.py
MCP2210.transfer
def transfer(self, data): """Transfers data over SPI. Arguments: data: The data to transfer. Returns: The data returned by the SPI device. """ settings = self.transfer_settings settings.spi_tx_size = len(data) self.transfer_settings = set...
python
def transfer(self, data): """Transfers data over SPI. Arguments: data: The data to transfer. Returns: The data returned by the SPI device. """ settings = self.transfer_settings settings.spi_tx_size = len(data) self.transfer_settings = set...
[ "def", "transfer", "(", "self", ",", "data", ")", ":", "settings", "=", "self", ".", "transfer_settings", "settings", ".", "spi_tx_size", "=", "len", "(", "data", ")", "self", ".", "transfer_settings", "=", "settings", "response", "=", "''", "for", "i", ...
Transfers data over SPI. Arguments: data: The data to transfer. Returns: The data returned by the SPI device.
[ "Transfers", "data", "over", "SPI", "." ]
ee15973d66697feb3b8a685ab59c774bee55d10b
https://github.com/arachnidlabs/mcp2210/blob/ee15973d66697feb3b8a685ab59c774bee55d10b/build/lib/mcp2210/device.py#L199-L220
43,950
django-fm/django-fm
fm/views.py
JSONResponseMixin.render_json_response
def render_json_response(self, context_dict, status=200): """ Limited serialization for shipping plain data. Do not use for models or other complex or custom objects. """ json_context = json.dumps( context_dict, cls=DjangoJSONEncoder, **self.ge...
python
def render_json_response(self, context_dict, status=200): """ Limited serialization for shipping plain data. Do not use for models or other complex or custom objects. """ json_context = json.dumps( context_dict, cls=DjangoJSONEncoder, **self.ge...
[ "def", "render_json_response", "(", "self", ",", "context_dict", ",", "status", "=", "200", ")", ":", "json_context", "=", "json", ".", "dumps", "(", "context_dict", ",", "cls", "=", "DjangoJSONEncoder", ",", "*", "*", "self", ".", "get_json_dumps_kwargs", "...
Limited serialization for shipping plain data. Do not use for models or other complex or custom objects.
[ "Limited", "serialization", "for", "shipping", "plain", "data", ".", "Do", "not", "use", "for", "models", "or", "other", "complex", "or", "custom", "objects", "." ]
da203f70d97200ff851ff47965d71751c917f9b1
https://github.com/django-fm/django-fm/blob/da203f70d97200ff851ff47965d71751c917f9b1/fm/views.py#L29-L43
43,951
django-fm/django-fm
fm/views.py
AjaxFormMixin.form_valid
def form_valid(self, form): """ If the request is ajax, save the form and return a json response. Otherwise return super as expected. """ self.object = form.save(commit=False) self.pre_save() self.object.save() if hasattr(form, 'save_m2m'): for...
python
def form_valid(self, form): """ If the request is ajax, save the form and return a json response. Otherwise return super as expected. """ self.object = form.save(commit=False) self.pre_save() self.object.save() if hasattr(form, 'save_m2m'): for...
[ "def", "form_valid", "(", "self", ",", "form", ")", ":", "self", ".", "object", "=", "form", ".", "save", "(", "commit", "=", "False", ")", "self", ".", "pre_save", "(", ")", "self", ".", "object", ".", "save", "(", ")", "if", "hasattr", "(", "fo...
If the request is ajax, save the form and return a json response. Otherwise return super as expected.
[ "If", "the", "request", "is", "ajax", "save", "the", "form", "and", "return", "a", "json", "response", ".", "Otherwise", "return", "super", "as", "expected", "." ]
da203f70d97200ff851ff47965d71751c917f9b1
https://github.com/django-fm/django-fm/blob/da203f70d97200ff851ff47965d71751c917f9b1/fm/views.py#L56-L70
43,952
django-fm/django-fm
fm/views.py
AjaxFormMixin.form_invalid
def form_invalid(self, form): """ We have errors in the form. If ajax, return them as json. Otherwise, proceed as normal. """ if self.request.is_ajax(): return self.render_json_response(self.get_error_result(form)) return super(AjaxFormMixin, self).form_invali...
python
def form_invalid(self, form): """ We have errors in the form. If ajax, return them as json. Otherwise, proceed as normal. """ if self.request.is_ajax(): return self.render_json_response(self.get_error_result(form)) return super(AjaxFormMixin, self).form_invali...
[ "def", "form_invalid", "(", "self", ",", "form", ")", ":", "if", "self", ".", "request", ".", "is_ajax", "(", ")", ":", "return", "self", ".", "render_json_response", "(", "self", ".", "get_error_result", "(", "form", ")", ")", "return", "super", "(", ...
We have errors in the form. If ajax, return them as json. Otherwise, proceed as normal.
[ "We", "have", "errors", "in", "the", "form", ".", "If", "ajax", "return", "them", "as", "json", ".", "Otherwise", "proceed", "as", "normal", "." ]
da203f70d97200ff851ff47965d71751c917f9b1
https://github.com/django-fm/django-fm/blob/da203f70d97200ff851ff47965d71751c917f9b1/fm/views.py#L72-L79
43,953
atmos-python/atmos
atmos/decorators.py
assumes
def assumes(*args): '''Stores a function's assumptions as an attribute.''' args = tuple(args) def decorator(func): func.assumptions = args return func return decorator
python
def assumes(*args): '''Stores a function's assumptions as an attribute.''' args = tuple(args) def decorator(func): func.assumptions = args return func return decorator
[ "def", "assumes", "(", "*", "args", ")", ":", "args", "=", "tuple", "(", "args", ")", "def", "decorator", "(", "func", ")", ":", "func", ".", "assumptions", "=", "args", "return", "func", "return", "decorator" ]
Stores a function's assumptions as an attribute.
[ "Stores", "a", "function", "s", "assumptions", "as", "an", "attribute", "." ]
f4af8eaca23cce881bde979599d15d322fc1935e
https://github.com/atmos-python/atmos/blob/f4af8eaca23cce881bde979599d15d322fc1935e/atmos/decorators.py#L12-L19
43,954
atmos-python/atmos
atmos/decorators.py
overridden_by_assumptions
def overridden_by_assumptions(*args): '''Stores what assumptions a function is overridden by as an attribute.''' args = tuple(args) def decorator(func): func.overridden_by_assumptions = args return func return decorator
python
def overridden_by_assumptions(*args): '''Stores what assumptions a function is overridden by as an attribute.''' args = tuple(args) def decorator(func): func.overridden_by_assumptions = args return func return decorator
[ "def", "overridden_by_assumptions", "(", "*", "args", ")", ":", "args", "=", "tuple", "(", "args", ")", "def", "decorator", "(", "func", ")", ":", "func", ".", "overridden_by_assumptions", "=", "args", "return", "func", "return", "decorator" ]
Stores what assumptions a function is overridden by as an attribute.
[ "Stores", "what", "assumptions", "a", "function", "is", "overridden", "by", "as", "an", "attribute", "." ]
f4af8eaca23cce881bde979599d15d322fc1935e
https://github.com/atmos-python/atmos/blob/f4af8eaca23cce881bde979599d15d322fc1935e/atmos/decorators.py#L22-L29
43,955
atmos-python/atmos
atmos/decorators.py
equation_docstring
def equation_docstring(quantity_dict, assumption_dict, equation=None, references=None, notes=None): ''' Creates a decorator that adds a docstring to an equation function. Parameters ---------- quantity_dict : dict A dictionary describing the quantities used in the equations. Its keys ...
python
def equation_docstring(quantity_dict, assumption_dict, equation=None, references=None, notes=None): ''' Creates a decorator that adds a docstring to an equation function. Parameters ---------- quantity_dict : dict A dictionary describing the quantities used in the equations. Its keys ...
[ "def", "equation_docstring", "(", "quantity_dict", ",", "assumption_dict", ",", "equation", "=", "None", ",", "references", "=", "None", ",", "notes", "=", "None", ")", ":", "# Now we have our utility functions, let's define the decorator itself", "def", "decorator", "(...
Creates a decorator that adds a docstring to an equation function. Parameters ---------- quantity_dict : dict A dictionary describing the quantities used in the equations. Its keys should be abbreviations for the quantities, and its values should be a dictionary of the form {'name': string, 'units': strin...
[ "Creates", "a", "decorator", "that", "adds", "a", "docstring", "to", "an", "equation", "function", "." ]
f4af8eaca23cce881bde979599d15d322fc1935e
https://github.com/atmos-python/atmos/blob/f4af8eaca23cce881bde979599d15d322fc1935e/atmos/decorators.py#L32-L115
43,956
atmos-python/atmos
atmos/util.py
sma
def sma(array, window_size, axis=-1, mode='reflect', **kwargs): """ Computes a 1D simple moving average along the given axis. Parameters ---------- array : ndarray Array on which to perform the convolution. window_size: int Width of the simple moving average window in indices. axis : int, optional Axis...
python
def sma(array, window_size, axis=-1, mode='reflect', **kwargs): """ Computes a 1D simple moving average along the given axis. Parameters ---------- array : ndarray Array on which to perform the convolution. window_size: int Width of the simple moving average window in indices. axis : int, optional Axis...
[ "def", "sma", "(", "array", ",", "window_size", ",", "axis", "=", "-", "1", ",", "mode", "=", "'reflect'", ",", "*", "*", "kwargs", ")", ":", "kwargs", "[", "'axis'", "]", "=", "axis", "kwargs", "[", "'mode'", "]", "=", "mode", "if", "not", "isin...
Computes a 1D simple moving average along the given axis. Parameters ---------- array : ndarray Array on which to perform the convolution. window_size: int Width of the simple moving average window in indices. axis : int, optional Axis along which to perform the moving average mode : {‘reflect’, ‘constant’...
[ "Computes", "a", "1D", "simple", "moving", "average", "along", "the", "given", "axis", "." ]
f4af8eaca23cce881bde979599d15d322fc1935e
https://github.com/atmos-python/atmos/blob/f4af8eaca23cce881bde979599d15d322fc1935e/atmos/util.py#L17-L52
43,957
atmos-python/atmos
atmos/util.py
assumption_list_string
def assumption_list_string(assumptions, assumption_dict): ''' Takes in a list of short forms of assumptions and an assumption dictionary, and returns a "list" form of the long form of the assumptions. Raises ------ ValueError if one of the assumptions is not in assumption_dict. ''' if isinstance(assump...
python
def assumption_list_string(assumptions, assumption_dict): ''' Takes in a list of short forms of assumptions and an assumption dictionary, and returns a "list" form of the long form of the assumptions. Raises ------ ValueError if one of the assumptions is not in assumption_dict. ''' if isinstance(assump...
[ "def", "assumption_list_string", "(", "assumptions", ",", "assumption_dict", ")", ":", "if", "isinstance", "(", "assumptions", ",", "six", ".", "string_types", ")", ":", "raise", "TypeError", "(", "'assumptions must be an iterable of strings, not a '", "'string itself'", ...
Takes in a list of short forms of assumptions and an assumption dictionary, and returns a "list" form of the long form of the assumptions. Raises ------ ValueError if one of the assumptions is not in assumption_dict.
[ "Takes", "in", "a", "list", "of", "short", "forms", "of", "assumptions", "and", "an", "assumption", "dictionary", "and", "returns", "a", "list", "form", "of", "the", "long", "form", "of", "the", "assumptions", "." ]
f4af8eaca23cce881bde979599d15d322fc1935e
https://github.com/atmos-python/atmos/blob/f4af8eaca23cce881bde979599d15d322fc1935e/atmos/util.py#L94-L112
43,958
atmos-python/atmos
atmos/util.py
quantity_spec_string
def quantity_spec_string(name, quantity_dict): ''' Returns a quantity specification for docstrings. Example ------- >>> quantity_spec_string('Tv') >>> 'Tv : float or ndarray\n Data for virtual temperature.' ''' if name not in quantity_dict.keys(): raise ValueError('{0} not present in quantity_d...
python
def quantity_spec_string(name, quantity_dict): ''' Returns a quantity specification for docstrings. Example ------- >>> quantity_spec_string('Tv') >>> 'Tv : float or ndarray\n Data for virtual temperature.' ''' if name not in quantity_dict.keys(): raise ValueError('{0} not present in quantity_d...
[ "def", "quantity_spec_string", "(", "name", ",", "quantity_dict", ")", ":", "if", "name", "not", "in", "quantity_dict", ".", "keys", "(", ")", ":", "raise", "ValueError", "(", "'{0} not present in quantity_dict'", ".", "format", "(", "name", ")", ")", "s", "...
Returns a quantity specification for docstrings. Example ------- >>> quantity_spec_string('Tv') >>> 'Tv : float or ndarray\n Data for virtual temperature.'
[ "Returns", "a", "quantity", "specification", "for", "docstrings", "." ]
f4af8eaca23cce881bde979599d15d322fc1935e
https://github.com/atmos-python/atmos/blob/f4af8eaca23cce881bde979599d15d322fc1935e/atmos/util.py#L115-L130
43,959
atmos-python/atmos
atmos/util.py
doc_paragraph
def doc_paragraph(s, indent=0): '''Takes in a string without wrapping corresponding to a paragraph, and returns a version of that string wrapped to be at most 80 characters in length on each line. If indent is given, ensures each line is indented to that number of spaces. ''' ret...
python
def doc_paragraph(s, indent=0): '''Takes in a string without wrapping corresponding to a paragraph, and returns a version of that string wrapped to be at most 80 characters in length on each line. If indent is given, ensures each line is indented to that number of spaces. ''' ret...
[ "def", "doc_paragraph", "(", "s", ",", "indent", "=", "0", ")", ":", "return", "'\\n'", ".", "join", "(", "[", "' '", "*", "indent", "+", "l", "for", "l", "in", "wrap", "(", "s", ",", "width", "=", "80", "-", "indent", ")", "]", ")" ]
Takes in a string without wrapping corresponding to a paragraph, and returns a version of that string wrapped to be at most 80 characters in length on each line. If indent is given, ensures each line is indented to that number of spaces.
[ "Takes", "in", "a", "string", "without", "wrapping", "corresponding", "to", "a", "paragraph", "and", "returns", "a", "version", "of", "that", "string", "wrapped", "to", "be", "at", "most", "80", "characters", "in", "length", "on", "each", "line", ".", "If"...
f4af8eaca23cce881bde979599d15d322fc1935e
https://github.com/atmos-python/atmos/blob/f4af8eaca23cce881bde979599d15d322fc1935e/atmos/util.py#L133-L140
43,960
atmos-python/atmos
atmos/util.py
closest_val
def closest_val(x, L): ''' Finds the index value in an iterable closest to a desired value. Parameters ---------- x : object The desired value. L : iterable The iterable in which to search for the desired value. Returns ------- index : int The index of the c...
python
def closest_val(x, L): ''' Finds the index value in an iterable closest to a desired value. Parameters ---------- x : object The desired value. L : iterable The iterable in which to search for the desired value. Returns ------- index : int The index of the c...
[ "def", "closest_val", "(", "x", ",", "L", ")", ":", "# Make sure the iterable is nonempty", "if", "len", "(", "L", ")", "==", "0", ":", "raise", "ValueError", "(", "'L must not be empty'", ")", "if", "isinstance", "(", "L", ",", "np", ".", "ndarray", ")", ...
Finds the index value in an iterable closest to a desired value. Parameters ---------- x : object The desired value. L : iterable The iterable in which to search for the desired value. Returns ------- index : int The index of the closest value to x in L. Notes ...
[ "Finds", "the", "index", "value", "in", "an", "iterable", "closest", "to", "a", "desired", "value", "." ]
f4af8eaca23cce881bde979599d15d322fc1935e
https://github.com/atmos-python/atmos/blob/f4af8eaca23cce881bde979599d15d322fc1935e/atmos/util.py#L161-L205
43,961
atmos-python/atmos
atmos/util.py
area_poly_sphere
def area_poly_sphere(lat, lon, r_sphere): ''' Calculates the area enclosed by an arbitrary polygon on the sphere. Parameters ---------- lat : iterable The latitudes, in degrees, of the vertex locations of the polygon, in clockwise order. lon : iterable The longitudes, in degrees, of the vertex locatio...
python
def area_poly_sphere(lat, lon, r_sphere): ''' Calculates the area enclosed by an arbitrary polygon on the sphere. Parameters ---------- lat : iterable The latitudes, in degrees, of the vertex locations of the polygon, in clockwise order. lon : iterable The longitudes, in degrees, of the vertex locatio...
[ "def", "area_poly_sphere", "(", "lat", ",", "lon", ",", "r_sphere", ")", ":", "dtr", "=", "np", ".", "pi", "/", "180.", "def", "_tranlon", "(", "plat", ",", "plon", ",", "qlat", ",", "qlon", ")", ":", "t", "=", "np", ".", "sin", "(", "(", "qlon...
Calculates the area enclosed by an arbitrary polygon on the sphere. Parameters ---------- lat : iterable The latitudes, in degrees, of the vertex locations of the polygon, in clockwise order. lon : iterable The longitudes, in degrees, of the vertex locations of the polygon, in clockwise order. Return...
[ "Calculates", "the", "area", "enclosed", "by", "an", "arbitrary", "polygon", "on", "the", "sphere", "." ]
f4af8eaca23cce881bde979599d15d322fc1935e
https://github.com/atmos-python/atmos/blob/f4af8eaca23cce881bde979599d15d322fc1935e/atmos/util.py#L208-L260
43,962
atmos-python/atmos
atmos/util.py
d_x
def d_x(data, axis, boundary='forward-backward'): ''' Calculates a second-order centered finite difference of data along the specified axis. Parameters ---------- data : ndarray Data on which we are taking a derivative. axis : int Index of the data array on which to take the difference. boundary : string,...
python
def d_x(data, axis, boundary='forward-backward'): ''' Calculates a second-order centered finite difference of data along the specified axis. Parameters ---------- data : ndarray Data on which we are taking a derivative. axis : int Index of the data array on which to take the difference. boundary : string,...
[ "def", "d_x", "(", "data", ",", "axis", ",", "boundary", "=", "'forward-backward'", ")", ":", "if", "abs", "(", "axis", ")", ">", "len", "(", "data", ".", "shape", ")", ":", "raise", "ValueError", "(", "'axis is out of bounds for the shape of data'", ")", ...
Calculates a second-order centered finite difference of data along the specified axis. Parameters ---------- data : ndarray Data on which we are taking a derivative. axis : int Index of the data array on which to take the difference. boundary : string, optional Boundary condition. If 'periodic', assume pe...
[ "Calculates", "a", "second", "-", "order", "centered", "finite", "difference", "of", "data", "along", "the", "specified", "axis", "." ]
f4af8eaca23cce881bde979599d15d322fc1935e
https://github.com/atmos-python/atmos/blob/f4af8eaca23cce881bde979599d15d322fc1935e/atmos/util.py#L352-L407
43,963
atmos-python/atmos
atmos/plot.py
SkewTAxes.semilogy
def semilogy(self, p, T, *args, **kwargs): r'''Plot data. Simple wrapper around plot so that pressure is the first (independent) input. This is essentially a wrapper around `semilogy`. Parameters ---------- p : array_like pressure values T : array_li...
python
def semilogy(self, p, T, *args, **kwargs): r'''Plot data. Simple wrapper around plot so that pressure is the first (independent) input. This is essentially a wrapper around `semilogy`. Parameters ---------- p : array_like pressure values T : array_li...
[ "def", "semilogy", "(", "self", ",", "p", ",", "T", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "# We need to replace the overridden plot with the original Axis plot", "# since it is called within Axes.semilogy", "no_plot", "=", "SkewTAxes", ".", "plot", "Ske...
r'''Plot data. Simple wrapper around plot so that pressure is the first (independent) input. This is essentially a wrapper around `semilogy`. Parameters ---------- p : array_like pressure values T : array_like temperature values, can also be used...
[ "r", "Plot", "data", "." ]
f4af8eaca23cce881bde979599d15d322fc1935e
https://github.com/atmos-python/atmos/blob/f4af8eaca23cce881bde979599d15d322fc1935e/atmos/plot.py#L176-L226
43,964
atmos-python/atmos
atmos/plot.py
SkewTAxes.plot_barbs
def plot_barbs(self, p, u, v, xloc=1.0, x_clip_radius=0.08, y_clip_radius=0.08, **kwargs): r'''Plot wind barbs. Adds wind barbs to the skew-T plot. This is a wrapper around the `barbs` command that adds to appropriate transform to place the barbs in a vertical line, l...
python
def plot_barbs(self, p, u, v, xloc=1.0, x_clip_radius=0.08, y_clip_radius=0.08, **kwargs): r'''Plot wind barbs. Adds wind barbs to the skew-T plot. This is a wrapper around the `barbs` command that adds to appropriate transform to place the barbs in a vertical line, l...
[ "def", "plot_barbs", "(", "self", ",", "p", ",", "u", ",", "v", ",", "xloc", "=", "1.0", ",", "x_clip_radius", "=", "0.08", ",", "y_clip_radius", "=", "0.08", ",", "*", "*", "kwargs", ")", ":", "#kwargs.setdefault('length', 7)", "# Assemble array of x-locati...
r'''Plot wind barbs. Adds wind barbs to the skew-T plot. This is a wrapper around the `barbs` command that adds to appropriate transform to place the barbs in a vertical line, located as a function of pressure. Parameters ---------- p : array_like pressure v...
[ "r", "Plot", "wind", "barbs", "." ]
f4af8eaca23cce881bde979599d15d322fc1935e
https://github.com/atmos-python/atmos/blob/f4af8eaca23cce881bde979599d15d322fc1935e/atmos/plot.py#L274-L321
43,965
atmos-python/atmos
atmos/plot.py
SkewTAxes.plot_dry_adiabats
def plot_dry_adiabats(self, p=None, theta=None, **kwargs): r'''Plot dry adiabats. Adds dry adiabats (lines of constant potential temperature) to the plot. The default style of these lines is dashed red lines with an alpha value of 0.5. These can be overridden using keyword arguments. ...
python
def plot_dry_adiabats(self, p=None, theta=None, **kwargs): r'''Plot dry adiabats. Adds dry adiabats (lines of constant potential temperature) to the plot. The default style of these lines is dashed red lines with an alpha value of 0.5. These can be overridden using keyword arguments. ...
[ "def", "plot_dry_adiabats", "(", "self", ",", "p", "=", "None", ",", "theta", "=", "None", ",", "*", "*", "kwargs", ")", ":", "for", "artist", "in", "self", ".", "_dry_adiabats", ":", "artist", ".", "remove", "(", ")", "self", ".", "_dry_adiabats", "...
r'''Plot dry adiabats. Adds dry adiabats (lines of constant potential temperature) to the plot. The default style of these lines is dashed red lines with an alpha value of 0.5. These can be overridden using keyword arguments. Parameters ---------- p : array_like, option...
[ "r", "Plot", "dry", "adiabats", "." ]
f4af8eaca23cce881bde979599d15d322fc1935e
https://github.com/atmos-python/atmos/blob/f4af8eaca23cce881bde979599d15d322fc1935e/atmos/plot.py#L323-L389
43,966
atmos-python/atmos
atmos/plot.py
SkewTAxes.plot_mixing_lines
def plot_mixing_lines(self, p=None, rv=None, **kwargs): r'''Plot lines of constant mixing ratio. Adds lines of constant mixing ratio (isohumes) to the plot. The default style of these lines is dashed green lines with an alpha value of 0.8. These can be overridden using keyword arguments...
python
def plot_mixing_lines(self, p=None, rv=None, **kwargs): r'''Plot lines of constant mixing ratio. Adds lines of constant mixing ratio (isohumes) to the plot. The default style of these lines is dashed green lines with an alpha value of 0.8. These can be overridden using keyword arguments...
[ "def", "plot_mixing_lines", "(", "self", ",", "p", "=", "None", ",", "rv", "=", "None", ",", "*", "*", "kwargs", ")", ":", "for", "artist", "in", "self", ".", "_mixing_lines", ":", "artist", ".", "remove", "(", ")", "self", ".", "_mixing_lines", "=",...
r'''Plot lines of constant mixing ratio. Adds lines of constant mixing ratio (isohumes) to the plot. The default style of these lines is dashed green lines with an alpha value of 0.8. These can be overridden using keyword arguments. Parameters ---------- rv : array_like...
[ "r", "Plot", "lines", "of", "constant", "mixing", "ratio", "." ]
f4af8eaca23cce881bde979599d15d322fc1935e
https://github.com/atmos-python/atmos/blob/f4af8eaca23cce881bde979599d15d322fc1935e/atmos/plot.py#L486-L559
43,967
atmos-python/atmos
atmos/solve.py
get_calculatable_quantities
def get_calculatable_quantities(inputs, methods): ''' Given an interable of input quantity names and a methods dictionary, returns a list of output quantities that can be calculated. ''' output_quantities = [] updated = True while updated: updated = False for output in method...
python
def get_calculatable_quantities(inputs, methods): ''' Given an interable of input quantity names and a methods dictionary, returns a list of output quantities that can be calculated. ''' output_quantities = [] updated = True while updated: updated = False for output in method...
[ "def", "get_calculatable_quantities", "(", "inputs", ",", "methods", ")", ":", "output_quantities", "=", "[", "]", "updated", "=", "True", "while", "updated", ":", "updated", "=", "False", "for", "output", "in", "methods", ".", "keys", "(", ")", ":", "if",...
Given an interable of input quantity names and a methods dictionary, returns a list of output quantities that can be calculated.
[ "Given", "an", "interable", "of", "input", "quantity", "names", "and", "a", "methods", "dictionary", "returns", "a", "list", "of", "output", "quantities", "that", "can", "be", "calculated", "." ]
f4af8eaca23cce881bde979599d15d322fc1935e
https://github.com/atmos-python/atmos/blob/f4af8eaca23cce881bde979599d15d322fc1935e/atmos/solve.py#L32-L51
43,968
atmos-python/atmos
atmos/solve.py
_get_methods_that_calculate_outputs
def _get_methods_that_calculate_outputs(inputs, outputs, methods): ''' Given iterables of input variable names, output variable names, and a methods dictionary, returns the subset of the methods dictionary that can be calculated, doesn't calculate something we already have, and only contains equatio...
python
def _get_methods_that_calculate_outputs(inputs, outputs, methods): ''' Given iterables of input variable names, output variable names, and a methods dictionary, returns the subset of the methods dictionary that can be calculated, doesn't calculate something we already have, and only contains equatio...
[ "def", "_get_methods_that_calculate_outputs", "(", "inputs", ",", "outputs", ",", "methods", ")", ":", "# Get a list of everything that we can possibly calculate", "# This is useful in figuring out whether we can calculate arguments", "intermediates", "=", "get_calculatable_quantities", ...
Given iterables of input variable names, output variable names, and a methods dictionary, returns the subset of the methods dictionary that can be calculated, doesn't calculate something we already have, and only contains equations that might help calculate the outputs from the inputs.
[ "Given", "iterables", "of", "input", "variable", "names", "output", "variable", "names", "and", "a", "methods", "dictionary", "returns", "the", "subset", "of", "the", "methods", "dictionary", "that", "can", "be", "calculated", "doesn", "t", "calculate", "somethi...
f4af8eaca23cce881bde979599d15d322fc1935e
https://github.com/atmos-python/atmos/blob/f4af8eaca23cce881bde979599d15d322fc1935e/atmos/solve.py#L54-L111
43,969
atmos-python/atmos
atmos/solve.py
_get_calculatable_methods_dict
def _get_calculatable_methods_dict(inputs, methods): ''' Given an iterable of input variable names and a methods dictionary, returns the subset of that methods dictionary that can be calculated and which doesn't calculate something we already have. Additionally it may only contain one method for any...
python
def _get_calculatable_methods_dict(inputs, methods): ''' Given an iterable of input variable names and a methods dictionary, returns the subset of that methods dictionary that can be calculated and which doesn't calculate something we already have. Additionally it may only contain one method for any...
[ "def", "_get_calculatable_methods_dict", "(", "inputs", ",", "methods", ")", ":", "# Initialize a return dictionary", "calculatable_methods", "=", "{", "}", "# Iterate through each potential method output", "for", "var", "in", "methods", ".", "keys", "(", ")", ":", "# S...
Given an iterable of input variable names and a methods dictionary, returns the subset of that methods dictionary that can be calculated and which doesn't calculate something we already have. Additionally it may only contain one method for any given output variable, which is the one with the fewest poss...
[ "Given", "an", "iterable", "of", "input", "variable", "names", "and", "a", "methods", "dictionary", "returns", "the", "subset", "of", "that", "methods", "dictionary", "that", "can", "be", "calculated", "and", "which", "doesn", "t", "calculate", "something", "w...
f4af8eaca23cce881bde979599d15d322fc1935e
https://github.com/atmos-python/atmos/blob/f4af8eaca23cce881bde979599d15d322fc1935e/atmos/solve.py#L114-L147
43,970
atmos-python/atmos
atmos/solve.py
_get_module_methods
def _get_module_methods(module): ''' Returns a methods list corresponding to the equations in the given module. Each entry is a dictionary with keys 'output', 'args', and 'func' corresponding to the output, arguments, and function of the method. The entries may optionally include 'assumptions' and ...
python
def _get_module_methods(module): ''' Returns a methods list corresponding to the equations in the given module. Each entry is a dictionary with keys 'output', 'args', and 'func' corresponding to the output, arguments, and function of the method. The entries may optionally include 'assumptions' and ...
[ "def", "_get_module_methods", "(", "module", ")", ":", "# Set up the methods dict we will eventually return", "methods", "=", "[", "]", "funcs", "=", "[", "]", "for", "item", "in", "inspect", ".", "getmembers", "(", "equations", ")", ":", "if", "(", "item", "[...
Returns a methods list corresponding to the equations in the given module. Each entry is a dictionary with keys 'output', 'args', and 'func' corresponding to the output, arguments, and function of the method. The entries may optionally include 'assumptions' and 'overridden_by_assumptions' as keys, stati...
[ "Returns", "a", "methods", "list", "corresponding", "to", "the", "equations", "in", "the", "given", "module", ".", "Each", "entry", "is", "a", "dictionary", "with", "keys", "output", "args", "and", "func", "corresponding", "to", "the", "output", "arguments", ...
f4af8eaca23cce881bde979599d15d322fc1935e
https://github.com/atmos-python/atmos/blob/f4af8eaca23cce881bde979599d15d322fc1935e/atmos/solve.py#L217-L257
43,971
atmos-python/atmos
atmos/solve.py
_check_scalar
def _check_scalar(value): '''If value is a 0-dimensional array, returns the contents of value. Otherwise, returns value. ''' if isinstance(value, np.ndarray): if value.ndim == 0: # We have a 0-dimensional array return value[None][0] return value
python
def _check_scalar(value): '''If value is a 0-dimensional array, returns the contents of value. Otherwise, returns value. ''' if isinstance(value, np.ndarray): if value.ndim == 0: # We have a 0-dimensional array return value[None][0] return value
[ "def", "_check_scalar", "(", "value", ")", ":", "if", "isinstance", "(", "value", ",", "np", ".", "ndarray", ")", ":", "if", "value", ".", "ndim", "==", "0", ":", "# We have a 0-dimensional array", "return", "value", "[", "None", "]", "[", "0", "]", "r...
If value is a 0-dimensional array, returns the contents of value. Otherwise, returns value.
[ "If", "value", "is", "a", "0", "-", "dimensional", "array", "returns", "the", "contents", "of", "value", ".", "Otherwise", "returns", "value", "." ]
f4af8eaca23cce881bde979599d15d322fc1935e
https://github.com/atmos-python/atmos/blob/f4af8eaca23cce881bde979599d15d322fc1935e/atmos/solve.py#L285-L293
43,972
atmos-python/atmos
atmos/solve.py
calculate
def calculate(*args, **kwargs): ''' Calculates and returns a requested quantity from quantities passed in as keyword arguments. Parameters ---------- \*args : string Names of quantities to be calculated. assumptions : tuple, optional Strings specifying which assumptions to enable. Overrides the default ...
python
def calculate(*args, **kwargs): ''' Calculates and returns a requested quantity from quantities passed in as keyword arguments. Parameters ---------- \*args : string Names of quantities to be calculated. assumptions : tuple, optional Strings specifying which assumptions to enable. Overrides the default ...
[ "def", "calculate", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "len", "(", "args", ")", "==", "0", ":", "raise", "ValueError", "(", "'must specify quantities to calculate'", ")", "# initialize a solver to do the work", "solver", "=", "FluidSolver...
Calculates and returns a requested quantity from quantities passed in as keyword arguments. Parameters ---------- \*args : string Names of quantities to be calculated. assumptions : tuple, optional Strings specifying which assumptions to enable. Overrides the default assumptions. See below for a list of d...
[ "Calculates", "and", "returns", "a", "requested", "quantity", "from", "quantities", "passed", "in", "as", "keyword", "arguments", "." ]
f4af8eaca23cce881bde979599d15d322fc1935e
https://github.com/atmos-python/atmos/blob/f4af8eaca23cce881bde979599d15d322fc1935e/atmos/solve.py#L736-L822
43,973
cls1991/ng
ng.py
ip
def ip(): """Show ip address.""" ok, err = _hack_ip() if not ok: click.secho(click.style(err, fg='red')) sys.exit(1) click.secho(click.style(err, fg='green'))
python
def ip(): """Show ip address.""" ok, err = _hack_ip() if not ok: click.secho(click.style(err, fg='red')) sys.exit(1) click.secho(click.style(err, fg='green'))
[ "def", "ip", "(", ")", ":", "ok", ",", "err", "=", "_hack_ip", "(", ")", "if", "not", "ok", ":", "click", ".", "secho", "(", "click", ".", "style", "(", "err", ",", "fg", "=", "'red'", ")", ")", "sys", ".", "exit", "(", "1", ")", "click", "...
Show ip address.
[ "Show", "ip", "address", "." ]
e975fa6c6e39067737ba4e54ee8eec605bb94b86
https://github.com/cls1991/ng/blob/e975fa6c6e39067737ba4e54ee8eec605bb94b86/ng.py#L153-L159
43,974
cls1991/ng
ng.py
wp
def wp(ssid): """Show wifi password.""" if not ssid: ok, err = _detect_wifi_ssid() if not ok: click.secho(click.style(err, fg='red')) sys.exit(1) ssid = err ok, err = _hack_wifi_password(ssid) if not ok: click.secho(click.style(err, fg='red')) ...
python
def wp(ssid): """Show wifi password.""" if not ssid: ok, err = _detect_wifi_ssid() if not ok: click.secho(click.style(err, fg='red')) sys.exit(1) ssid = err ok, err = _hack_wifi_password(ssid) if not ok: click.secho(click.style(err, fg='red')) ...
[ "def", "wp", "(", "ssid", ")", ":", "if", "not", "ssid", ":", "ok", ",", "err", "=", "_detect_wifi_ssid", "(", ")", "if", "not", "ok", ":", "click", ".", "secho", "(", "click", ".", "style", "(", "err", ",", "fg", "=", "'red'", ")", ")", "sys",...
Show wifi password.
[ "Show", "wifi", "password", "." ]
e975fa6c6e39067737ba4e54ee8eec605bb94b86
https://github.com/cls1991/ng/blob/e975fa6c6e39067737ba4e54ee8eec605bb94b86/ng.py#L164-L176
43,975
bharadwajyarlagadda/bingmaps
bingmaps/apiservices/elevations.py
ElevationsApi.build_url
def build_url(self): """Builds the URL for elevations API services based on the data given by the user. Returns: url (str): URL for the elevations API services """ url = '{protocol}/{url}/{rest}/{version}/{restapi}/{rscpath}/' \ '{query}'.format(protoco...
python
def build_url(self): """Builds the URL for elevations API services based on the data given by the user. Returns: url (str): URL for the elevations API services """ url = '{protocol}/{url}/{rest}/{version}/{restapi}/{rscpath}/' \ '{query}'.format(protoco...
[ "def", "build_url", "(", "self", ")", ":", "url", "=", "'{protocol}/{url}/{rest}/{version}/{restapi}/{rscpath}/'", "'{query}'", ".", "format", "(", "protocol", "=", "self", ".", "schema", ".", "protocol", ",", "url", "=", "self", ".", "schema", ".", "main_url", ...
Builds the URL for elevations API services based on the data given by the user. Returns: url (str): URL for the elevations API services
[ "Builds", "the", "URL", "for", "elevations", "API", "services", "based", "on", "the", "data", "given", "by", "the", "user", "." ]
6bb3cdadfb121aaff96704509cedff2710a62b6d
https://github.com/bharadwajyarlagadda/bingmaps/blob/6bb3cdadfb121aaff96704509cedff2710a62b6d/bingmaps/apiservices/elevations.py#L72-L87
43,976
bharadwajyarlagadda/bingmaps
bingmaps/apiservices/elevations.py
ElevationsApi.zoomlevel
def zoomlevel(self): """Retrieves zoomlevel from the output response Returns: zoomlevel (namedtuple): A namedtuple of zoomlevel from the output response """ resources = self.get_resource() zoomlevel = namedtuple('zoomlevel', 'zoomLevel') try: ...
python
def zoomlevel(self): """Retrieves zoomlevel from the output response Returns: zoomlevel (namedtuple): A namedtuple of zoomlevel from the output response """ resources = self.get_resource() zoomlevel = namedtuple('zoomlevel', 'zoomLevel') try: ...
[ "def", "zoomlevel", "(", "self", ")", ":", "resources", "=", "self", ".", "get_resource", "(", ")", "zoomlevel", "=", "namedtuple", "(", "'zoomlevel'", ",", "'zoomLevel'", ")", "try", ":", "return", "[", "zoomlevel", "(", "resource", "[", "'zoomLevel'", "]...
Retrieves zoomlevel from the output response Returns: zoomlevel (namedtuple): A namedtuple of zoomlevel from the output response
[ "Retrieves", "zoomlevel", "from", "the", "output", "response" ]
6bb3cdadfb121aaff96704509cedff2710a62b6d
https://github.com/bharadwajyarlagadda/bingmaps/blob/6bb3cdadfb121aaff96704509cedff2710a62b6d/bingmaps/apiservices/elevations.py#L165-L187
43,977
bharadwajyarlagadda/bingmaps
bingmaps/apiservices/elevations.py
ElevationsApi.to_json_file
def to_json_file(self, path, file_name=None): """Writes output to a JSON file with the given file name""" if bool(path) and os.path.isdir(path): self.write_to_json(path, file_name) else: self.write_to_json(os.getcwd(), file_name)
python
def to_json_file(self, path, file_name=None): """Writes output to a JSON file with the given file name""" if bool(path) and os.path.isdir(path): self.write_to_json(path, file_name) else: self.write_to_json(os.getcwd(), file_name)
[ "def", "to_json_file", "(", "self", ",", "path", ",", "file_name", "=", "None", ")", ":", "if", "bool", "(", "path", ")", "and", "os", ".", "path", ".", "isdir", "(", "path", ")", ":", "self", ".", "write_to_json", "(", "path", ",", "file_name", ")...
Writes output to a JSON file with the given file name
[ "Writes", "output", "to", "a", "JSON", "file", "with", "the", "given", "file", "name" ]
6bb3cdadfb121aaff96704509cedff2710a62b6d
https://github.com/bharadwajyarlagadda/bingmaps/blob/6bb3cdadfb121aaff96704509cedff2710a62b6d/bingmaps/apiservices/elevations.py#L189-L194
43,978
bharadwajyarlagadda/bingmaps
bingmaps/apiservices/locations.py
LocationByAddress.get_data
def get_data(self): """Gets data from the built url""" url = self.build_url() self.locationApiData = requests.get(url) if not self.locationApiData.status_code == 200: raise self.locationApiData.raise_for_status()
python
def get_data(self): """Gets data from the built url""" url = self.build_url() self.locationApiData = requests.get(url) if not self.locationApiData.status_code == 200: raise self.locationApiData.raise_for_status()
[ "def", "get_data", "(", "self", ")", ":", "url", "=", "self", ".", "build_url", "(", ")", "self", ".", "locationApiData", "=", "requests", ".", "get", "(", "url", ")", "if", "not", "self", ".", "locationApiData", ".", "status_code", "==", "200", ":", ...
Gets data from the built url
[ "Gets", "data", "from", "the", "built", "url" ]
6bb3cdadfb121aaff96704509cedff2710a62b6d
https://github.com/bharadwajyarlagadda/bingmaps/blob/6bb3cdadfb121aaff96704509cedff2710a62b6d/bingmaps/apiservices/locations.py#L201-L206
43,979
cqlengine/cqlengine
cqlengine/management.py
update_compaction
def update_compaction(model): """Updates the compaction options for the given model if necessary. :param model: The model to update. :return: `True`, if the compaction options were modified in Cassandra, `False` otherwise. :rtype: bool """ logger.debug("Checking %s for compaction diffe...
python
def update_compaction(model): """Updates the compaction options for the given model if necessary. :param model: The model to update. :return: `True`, if the compaction options were modified in Cassandra, `False` otherwise. :rtype: bool """ logger.debug("Checking %s for compaction diffe...
[ "def", "update_compaction", "(", "model", ")", ":", "logger", ".", "debug", "(", "\"Checking %s for compaction differences\"", ",", "model", ")", "table", "=", "get_table_settings", "(", "model", ")", "existing_options", "=", "table", ".", "options", ".", "copy", ...
Updates the compaction options for the given model if necessary. :param model: The model to update. :return: `True`, if the compaction options were modified in Cassandra, `False` otherwise. :rtype: bool
[ "Updates", "the", "compaction", "options", "for", "the", "given", "model", "if", "necessary", "." ]
7079eaf7071cbf5a045e1d1ab57f6d1b5ba3f9dc
https://github.com/cqlengine/cqlengine/blob/7079eaf7071cbf5a045e1d1ab57f6d1b5ba3f9dc/cqlengine/management.py#L254-L299
43,980
cqlengine/cqlengine
cqlengine/connection.py
setup
def setup( hosts, default_keyspace, consistency=ConsistencyLevel.ONE, lazy_connect=False, retry_connect=False, **kwargs): """ Records the hosts and connects to one of them :param hosts: list of hosts, see http://datastax.github.io/python-driver/api/cassandra/...
python
def setup( hosts, default_keyspace, consistency=ConsistencyLevel.ONE, lazy_connect=False, retry_connect=False, **kwargs): """ Records the hosts and connects to one of them :param hosts: list of hosts, see http://datastax.github.io/python-driver/api/cassandra/...
[ "def", "setup", "(", "hosts", ",", "default_keyspace", ",", "consistency", "=", "ConsistencyLevel", ".", "ONE", ",", "lazy_connect", "=", "False", ",", "retry_connect", "=", "False", ",", "*", "*", "kwargs", ")", ":", "global", "cluster", ",", "session", "...
Records the hosts and connects to one of them :param hosts: list of hosts, see http://datastax.github.io/python-driver/api/cassandra/cluster.html :type hosts: list :param default_keyspace: The default keyspace to use :type default_keyspace: str :param consistency: The global consistency level :...
[ "Records", "the", "hosts", "and", "connects", "to", "one", "of", "them" ]
7079eaf7071cbf5a045e1d1ab57f6d1b5ba3f9dc
https://github.com/cqlengine/cqlengine/blob/7079eaf7071cbf5a045e1d1ab57f6d1b5ba3f9dc/cqlengine/connection.py#L29-L81
43,981
cqlengine/cqlengine
cqlengine/columns.py
Column.validate
def validate(self, value): """ Returns a cleaned and validated value. Raises a ValidationError if there's a problem """ if value is None: if self.required: raise ValidationError('{} - None values are not allowed'.format(self.column_name or self.db_fiel...
python
def validate(self, value): """ Returns a cleaned and validated value. Raises a ValidationError if there's a problem """ if value is None: if self.required: raise ValidationError('{} - None values are not allowed'.format(self.column_name or self.db_fiel...
[ "def", "validate", "(", "self", ",", "value", ")", ":", "if", "value", "is", "None", ":", "if", "self", ".", "required", ":", "raise", "ValidationError", "(", "'{} - None values are not allowed'", ".", "format", "(", "self", ".", "column_name", "or", "self",...
Returns a cleaned and validated value. Raises a ValidationError if there's a problem
[ "Returns", "a", "cleaned", "and", "validated", "value", ".", "Raises", "a", "ValidationError", "if", "there", "s", "a", "problem" ]
7079eaf7071cbf5a045e1d1ab57f6d1b5ba3f9dc
https://github.com/cqlengine/cqlengine/blob/7079eaf7071cbf5a045e1d1ab57f6d1b5ba3f9dc/cqlengine/columns.py#L138-L146
43,982
cqlengine/cqlengine
cqlengine/columns.py
TimeUUID.from_datetime
def from_datetime(self, dt): """ generates a UUID for a given datetime :param dt: datetime :type dt: datetime :return: """ global _last_timestamp epoch = datetime(1970, 1, 1, tzinfo=dt.tzinfo) offset = epoch.tzinfo.utcoffset(epoch).total_seconds(...
python
def from_datetime(self, dt): """ generates a UUID for a given datetime :param dt: datetime :type dt: datetime :return: """ global _last_timestamp epoch = datetime(1970, 1, 1, tzinfo=dt.tzinfo) offset = epoch.tzinfo.utcoffset(epoch).total_seconds(...
[ "def", "from_datetime", "(", "self", ",", "dt", ")", ":", "global", "_last_timestamp", "epoch", "=", "datetime", "(", "1970", ",", "1", ",", "1", ",", "tzinfo", "=", "dt", ".", "tzinfo", ")", "offset", "=", "epoch", ".", "tzinfo", ".", "utcoffset", "...
generates a UUID for a given datetime :param dt: datetime :type dt: datetime :return:
[ "generates", "a", "UUID", "for", "a", "given", "datetime" ]
7079eaf7071cbf5a045e1d1ab57f6d1b5ba3f9dc
https://github.com/cqlengine/cqlengine/blob/7079eaf7071cbf5a045e1d1ab57f6d1b5ba3f9dc/cqlengine/columns.py#L419-L450
43,983
cqlengine/cqlengine
cqlengine/models.py
BaseModel._can_update
def _can_update(self): """ Called by the save function to check if this should be persisted with update or insert :return: """ if not self._is_persisted: return False pks = self._primary_keys.keys() return all([not self._values[k].changed for k in self._p...
python
def _can_update(self): """ Called by the save function to check if this should be persisted with update or insert :return: """ if not self._is_persisted: return False pks = self._primary_keys.keys() return all([not self._values[k].changed for k in self._p...
[ "def", "_can_update", "(", "self", ")", ":", "if", "not", "self", ".", "_is_persisted", ":", "return", "False", "pks", "=", "self", ".", "_primary_keys", ".", "keys", "(", ")", "return", "all", "(", "[", "not", "self", ".", "_values", "[", "k", "]", ...
Called by the save function to check if this should be persisted with update or insert :return:
[ "Called", "by", "the", "save", "function", "to", "check", "if", "this", "should", "be", "persisted", "with", "update", "or", "insert" ]
7079eaf7071cbf5a045e1d1ab57f6d1b5ba3f9dc
https://github.com/cqlengine/cqlengine/blob/7079eaf7071cbf5a045e1d1ab57f6d1b5ba3f9dc/cqlengine/models.py#L420-L429
43,984
cqlengine/cqlengine
cqlengine/models.py
BaseModel.delete
def delete(self): """ Deletes this instance """ self.__dmlquery__(self.__class__, self, batch=self._batch, timestamp=self._timestamp, consistency=self.__consistency__, timeout=self._timeout).delete()
python
def delete(self): """ Deletes this instance """ self.__dmlquery__(self.__class__, self, batch=self._batch, timestamp=self._timestamp, consistency=self.__consistency__, timeout=self._timeout).delete()
[ "def", "delete", "(", "self", ")", ":", "self", ".", "__dmlquery__", "(", "self", ".", "__class__", ",", "self", ",", "batch", "=", "self", ".", "_batch", ",", "timestamp", "=", "self", ".", "_timestamp", ",", "consistency", "=", "self", ".", "__consis...
Deletes this instance
[ "Deletes", "this", "instance" ]
7079eaf7071cbf5a045e1d1ab57f6d1b5ba3f9dc
https://github.com/cqlengine/cqlengine/blob/7079eaf7071cbf5a045e1d1ab57f6d1b5ba3f9dc/cqlengine/models.py#L647-L653
43,985
cqlengine/cqlengine
cqlengine/query.py
AbstractQuerySet.filter
def filter(self, *args, **kwargs): """ Adds WHERE arguments to the queryset, returning a new queryset #TODO: show examples :rtype: AbstractQuerySet """ #add arguments to the where clause filters if len([x for x in kwargs.values() if x is None]): rais...
python
def filter(self, *args, **kwargs): """ Adds WHERE arguments to the queryset, returning a new queryset #TODO: show examples :rtype: AbstractQuerySet """ #add arguments to the where clause filters if len([x for x in kwargs.values() if x is None]): rais...
[ "def", "filter", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "#add arguments to the where clause filters", "if", "len", "(", "[", "x", "for", "x", "in", "kwargs", ".", "values", "(", ")", "if", "x", "is", "None", "]", ")", ":", ...
Adds WHERE arguments to the queryset, returning a new queryset #TODO: show examples :rtype: AbstractQuerySet
[ "Adds", "WHERE", "arguments", "to", "the", "queryset", "returning", "a", "new", "queryset" ]
7079eaf7071cbf5a045e1d1ab57f6d1b5ba3f9dc
https://github.com/cqlengine/cqlengine/blob/7079eaf7071cbf5a045e1d1ab57f6d1b5ba3f9dc/cqlengine/query.py#L463-L521
43,986
cqlengine/cqlengine
cqlengine/query.py
AbstractQuerySet.order_by
def order_by(self, *colnames): """ orders the result set. ordering can only use clustering columns. Default order is ascending, prepend a '-' to the column name for descending """ if len(colnames) == 0: clone = copy.deepcopy(self) clone._order = [...
python
def order_by(self, *colnames): """ orders the result set. ordering can only use clustering columns. Default order is ascending, prepend a '-' to the column name for descending """ if len(colnames) == 0: clone = copy.deepcopy(self) clone._order = [...
[ "def", "order_by", "(", "self", ",", "*", "colnames", ")", ":", "if", "len", "(", "colnames", ")", "==", "0", ":", "clone", "=", "copy", ".", "deepcopy", "(", "self", ")", "clone", ".", "_order", "=", "[", "]", "return", "clone", "conditions", "=",...
orders the result set. ordering can only use clustering columns. Default order is ascending, prepend a '-' to the column name for descending
[ "orders", "the", "result", "set", ".", "ordering", "can", "only", "use", "clustering", "columns", "." ]
7079eaf7071cbf5a045e1d1ab57f6d1b5ba3f9dc
https://github.com/cqlengine/cqlengine/blob/7079eaf7071cbf5a045e1d1ab57f6d1b5ba3f9dc/cqlengine/query.py#L548-L566
43,987
cqlengine/cqlengine
cqlengine/query.py
AbstractQuerySet.count
def count(self): """ Returns the number of rows matched by this query """ if self._batch: raise CQLEngineException("Only inserts, updates, and deletes are available in batch mode") if self._result_cache is None: query = self._select_query() query.count = True...
python
def count(self): """ Returns the number of rows matched by this query """ if self._batch: raise CQLEngineException("Only inserts, updates, and deletes are available in batch mode") if self._result_cache is None: query = self._select_query() query.count = True...
[ "def", "count", "(", "self", ")", ":", "if", "self", ".", "_batch", ":", "raise", "CQLEngineException", "(", "\"Only inserts, updates, and deletes are available in batch mode\"", ")", "if", "self", ".", "_result_cache", "is", "None", ":", "query", "=", "self", "."...
Returns the number of rows matched by this query
[ "Returns", "the", "number", "of", "rows", "matched", "by", "this", "query" ]
7079eaf7071cbf5a045e1d1ab57f6d1b5ba3f9dc
https://github.com/cqlengine/cqlengine/blob/7079eaf7071cbf5a045e1d1ab57f6d1b5ba3f9dc/cqlengine/query.py#L568-L579
43,988
cqlengine/cqlengine
cqlengine/query.py
AbstractQuerySet.limit
def limit(self, v): """ Sets the limit on the number of results returned CQL has a default limit of 10,000 """ if not (v is None or isinstance(v, six.integer_types)): raise TypeError if v == self._limit: return self if v < 0: r...
python
def limit(self, v): """ Sets the limit on the number of results returned CQL has a default limit of 10,000 """ if not (v is None or isinstance(v, six.integer_types)): raise TypeError if v == self._limit: return self if v < 0: r...
[ "def", "limit", "(", "self", ",", "v", ")", ":", "if", "not", "(", "v", "is", "None", "or", "isinstance", "(", "v", ",", "six", ".", "integer_types", ")", ")", ":", "raise", "TypeError", "if", "v", "==", "self", ".", "_limit", ":", "return", "sel...
Sets the limit on the number of results returned CQL has a default limit of 10,000
[ "Sets", "the", "limit", "on", "the", "number", "of", "results", "returned", "CQL", "has", "a", "default", "limit", "of", "10", "000" ]
7079eaf7071cbf5a045e1d1ab57f6d1b5ba3f9dc
https://github.com/cqlengine/cqlengine/blob/7079eaf7071cbf5a045e1d1ab57f6d1b5ba3f9dc/cqlengine/query.py#L581-L596
43,989
cqlengine/cqlengine
cqlengine/query.py
ModelQuerySet.update
def update(self, **values): """ Updates the rows in this queryset """ if not values: return nulled_columns = set() us = UpdateStatement(self.column_family_name, where=self._where, ttl=self._ttl, timestamp=self._timestamp, transactions=self._trans...
python
def update(self, **values): """ Updates the rows in this queryset """ if not values: return nulled_columns = set() us = UpdateStatement(self.column_family_name, where=self._where, ttl=self._ttl, timestamp=self._timestamp, transactions=self._trans...
[ "def", "update", "(", "self", ",", "*", "*", "values", ")", ":", "if", "not", "values", ":", "return", "nulled_columns", "=", "set", "(", ")", "us", "=", "UpdateStatement", "(", "self", ".", "column_family_name", ",", "where", "=", "self", ".", "_where...
Updates the rows in this queryset
[ "Updates", "the", "rows", "in", "this", "queryset" ]
7079eaf7071cbf5a045e1d1ab57f6d1b5ba3f9dc
https://github.com/cqlengine/cqlengine/blob/7079eaf7071cbf5a045e1d1ab57f6d1b5ba3f9dc/cqlengine/query.py#L793-L841
43,990
guyskk/pybeautifier
pybeautifier.py
handle
def handle(client, request): """ Handle format request request struct: { 'data': 'data_need_format', 'formaters': [ { 'name': 'formater_name', 'config': {} # None or dict }, ... # forma...
python
def handle(client, request): """ Handle format request request struct: { 'data': 'data_need_format', 'formaters': [ { 'name': 'formater_name', 'config': {} # None or dict }, ... # forma...
[ "def", "handle", "(", "client", ",", "request", ")", ":", "formaters", "=", "request", ".", "get", "(", "'formaters'", ",", "None", ")", "if", "not", "formaters", ":", "formaters", "=", "[", "{", "'name'", ":", "'autopep8'", "}", "]", "logging", ".", ...
Handle format request request struct: { 'data': 'data_need_format', 'formaters': [ { 'name': 'formater_name', 'config': {} # None or dict }, ... # formaters ] } if no f...
[ "Handle", "format", "request" ]
bf9ce19d059c3364c690947d91077183b0adb4fc
https://github.com/guyskk/pybeautifier/blob/bf9ce19d059c3364c690947d91077183b0adb4fc/pybeautifier.py#L72-L116
43,991
asweigart/pytweening
pytweening/__init__.py
easeInOutQuad
def easeInOutQuad(n): """A quadratic tween function that accelerates, reaches the midpoint, and then decelerates. Args: n (float): The time progress, starting at 0.0 and ending at 1.0. Returns: (float) The line progress, starting at 0.0 and ending at 1.0. Suitable for passing to getPointOnLine...
python
def easeInOutQuad(n): """A quadratic tween function that accelerates, reaches the midpoint, and then decelerates. Args: n (float): The time progress, starting at 0.0 and ending at 1.0. Returns: (float) The line progress, starting at 0.0 and ending at 1.0. Suitable for passing to getPointOnLine...
[ "def", "easeInOutQuad", "(", "n", ")", ":", "_checkRange", "(", "n", ")", "if", "n", "<", "0.5", ":", "return", "2", "*", "n", "**", "2", "else", ":", "n", "=", "n", "*", "2", "-", "1", "return", "-", "0.5", "*", "(", "n", "*", "(", "n", ...
A quadratic tween function that accelerates, reaches the midpoint, and then decelerates. Args: n (float): The time progress, starting at 0.0 and ending at 1.0. Returns: (float) The line progress, starting at 0.0 and ending at 1.0. Suitable for passing to getPointOnLine().
[ "A", "quadratic", "tween", "function", "that", "accelerates", "reaches", "the", "midpoint", "and", "then", "decelerates", "." ]
20d74368e53dc7d0f77c810b624b2c90994f099d
https://github.com/asweigart/pytweening/blob/20d74368e53dc7d0f77c810b624b2c90994f099d/pytweening/__init__.py#L156-L170
43,992
asweigart/pytweening
pytweening/__init__.py
easeInOutCubic
def easeInOutCubic(n): """A cubic tween function that accelerates, reaches the midpoint, and then decelerates. Args: n (float): The time progress, starting at 0.0 and ending at 1.0. Returns: (float) The line progress, starting at 0.0 and ending at 1.0. Suitable for passing to getPointOnLine()....
python
def easeInOutCubic(n): """A cubic tween function that accelerates, reaches the midpoint, and then decelerates. Args: n (float): The time progress, starting at 0.0 and ending at 1.0. Returns: (float) The line progress, starting at 0.0 and ending at 1.0. Suitable for passing to getPointOnLine()....
[ "def", "easeInOutCubic", "(", "n", ")", ":", "_checkRange", "(", "n", ")", "n", "=", "2", "*", "n", "if", "n", "<", "1", ":", "return", "0.5", "*", "n", "**", "3", "else", ":", "n", "=", "n", "-", "2", "return", "0.5", "*", "(", "n", "**", ...
A cubic tween function that accelerates, reaches the midpoint, and then decelerates. Args: n (float): The time progress, starting at 0.0 and ending at 1.0. Returns: (float) The line progress, starting at 0.0 and ending at 1.0. Suitable for passing to getPointOnLine().
[ "A", "cubic", "tween", "function", "that", "accelerates", "reaches", "the", "midpoint", "and", "then", "decelerates", "." ]
20d74368e53dc7d0f77c810b624b2c90994f099d
https://github.com/asweigart/pytweening/blob/20d74368e53dc7d0f77c810b624b2c90994f099d/pytweening/__init__.py#L200-L215
43,993
asweigart/pytweening
pytweening/__init__.py
easeInOutQuart
def easeInOutQuart(n): """A quartic tween function that accelerates, reaches the midpoint, and then decelerates. Args: n (float): The time progress, starting at 0.0 and ending at 1.0. Returns: (float) The line progress, starting at 0.0 and ending at 1.0. Suitable for passing to getPointOnLine(...
python
def easeInOutQuart(n): """A quartic tween function that accelerates, reaches the midpoint, and then decelerates. Args: n (float): The time progress, starting at 0.0 and ending at 1.0. Returns: (float) The line progress, starting at 0.0 and ending at 1.0. Suitable for passing to getPointOnLine(...
[ "def", "easeInOutQuart", "(", "n", ")", ":", "_checkRange", "(", "n", ")", "n", "=", "2", "*", "n", "if", "n", "<", "1", ":", "return", "0.5", "*", "n", "**", "4", "else", ":", "n", "=", "n", "-", "2", "return", "-", "0.5", "*", "(", "n", ...
A quartic tween function that accelerates, reaches the midpoint, and then decelerates. Args: n (float): The time progress, starting at 0.0 and ending at 1.0. Returns: (float) The line progress, starting at 0.0 and ending at 1.0. Suitable for passing to getPointOnLine().
[ "A", "quartic", "tween", "function", "that", "accelerates", "reaches", "the", "midpoint", "and", "then", "decelerates", "." ]
20d74368e53dc7d0f77c810b624b2c90994f099d
https://github.com/asweigart/pytweening/blob/20d74368e53dc7d0f77c810b624b2c90994f099d/pytweening/__init__.py#L245-L260
43,994
asweigart/pytweening
pytweening/__init__.py
easeInOutQuint
def easeInOutQuint(n): """A quintic tween function that accelerates, reaches the midpoint, and then decelerates. Args: n (float): The time progress, starting at 0.0 and ending at 1.0. Returns: (float) The line progress, starting at 0.0 and ending at 1.0. Suitable for passing to getPointOnLine(...
python
def easeInOutQuint(n): """A quintic tween function that accelerates, reaches the midpoint, and then decelerates. Args: n (float): The time progress, starting at 0.0 and ending at 1.0. Returns: (float) The line progress, starting at 0.0 and ending at 1.0. Suitable for passing to getPointOnLine(...
[ "def", "easeInOutQuint", "(", "n", ")", ":", "_checkRange", "(", "n", ")", "n", "=", "2", "*", "n", "if", "n", "<", "1", ":", "return", "0.5", "*", "n", "**", "5", "else", ":", "n", "=", "n", "-", "2", "return", "0.5", "*", "(", "n", "**", ...
A quintic tween function that accelerates, reaches the midpoint, and then decelerates. Args: n (float): The time progress, starting at 0.0 and ending at 1.0. Returns: (float) The line progress, starting at 0.0 and ending at 1.0. Suitable for passing to getPointOnLine().
[ "A", "quintic", "tween", "function", "that", "accelerates", "reaches", "the", "midpoint", "and", "then", "decelerates", "." ]
20d74368e53dc7d0f77c810b624b2c90994f099d
https://github.com/asweigart/pytweening/blob/20d74368e53dc7d0f77c810b624b2c90994f099d/pytweening/__init__.py#L290-L305
43,995
asweigart/pytweening
pytweening/__init__.py
easeInOutExpo
def easeInOutExpo(n): """An exponential tween function that accelerates, reaches the midpoint, and then decelerates. Args: n (float): The time progress, starting at 0.0 and ending at 1.0. Returns: (float) The line progress, starting at 0.0 and ending at 1.0. Suitable for passing to getPointOnL...
python
def easeInOutExpo(n): """An exponential tween function that accelerates, reaches the midpoint, and then decelerates. Args: n (float): The time progress, starting at 0.0 and ending at 1.0. Returns: (float) The line progress, starting at 0.0 and ending at 1.0. Suitable for passing to getPointOnL...
[ "def", "easeInOutExpo", "(", "n", ")", ":", "_checkRange", "(", "n", ")", "if", "n", "==", "0", ":", "return", "0", "elif", "n", "==", "1", ":", "return", "1", "else", ":", "n", "=", "n", "*", "2", "if", "n", "<", "1", ":", "return", "0.5", ...
An exponential tween function that accelerates, reaches the midpoint, and then decelerates. Args: n (float): The time progress, starting at 0.0 and ending at 1.0. Returns: (float) The line progress, starting at 0.0 and ending at 1.0. Suitable for passing to getPointOnLine().
[ "An", "exponential", "tween", "function", "that", "accelerates", "reaches", "the", "midpoint", "and", "then", "decelerates", "." ]
20d74368e53dc7d0f77c810b624b2c90994f099d
https://github.com/asweigart/pytweening/blob/20d74368e53dc7d0f77c810b624b2c90994f099d/pytweening/__init__.py#L379-L400
43,996
asweigart/pytweening
pytweening/__init__.py
easeInOutCirc
def easeInOutCirc(n): """A circular tween function that accelerates, reaches the midpoint, and then decelerates. Args: n (float): The time progress, starting at 0.0 and ending at 1.0. Returns: (float) The line progress, starting at 0.0 and ending at 1.0. Suitable for passing to getPointOnLine(...
python
def easeInOutCirc(n): """A circular tween function that accelerates, reaches the midpoint, and then decelerates. Args: n (float): The time progress, starting at 0.0 and ending at 1.0. Returns: (float) The line progress, starting at 0.0 and ending at 1.0. Suitable for passing to getPointOnLine(...
[ "def", "easeInOutCirc", "(", "n", ")", ":", "_checkRange", "(", "n", ")", "n", "=", "n", "*", "2", "if", "n", "<", "1", ":", "return", "-", "0.5", "*", "(", "math", ".", "sqrt", "(", "1", "-", "n", "**", "2", ")", "-", "1", ")", "else", "...
A circular tween function that accelerates, reaches the midpoint, and then decelerates. Args: n (float): The time progress, starting at 0.0 and ending at 1.0. Returns: (float) The line progress, starting at 0.0 and ending at 1.0. Suitable for passing to getPointOnLine().
[ "A", "circular", "tween", "function", "that", "accelerates", "reaches", "the", "midpoint", "and", "then", "decelerates", "." ]
20d74368e53dc7d0f77c810b624b2c90994f099d
https://github.com/asweigart/pytweening/blob/20d74368e53dc7d0f77c810b624b2c90994f099d/pytweening/__init__.py#L430-L445
43,997
asweigart/pytweening
pytweening/__init__.py
easeInElastic
def easeInElastic(n, amplitude=1, period=0.3): """An elastic tween function that begins with an increasing wobble and then snaps into the destination. Args: n (float): The time progress, starting at 0.0 and ending at 1.0. Returns: (float) The line progress, starting at 0.0 and ending at 1.0. S...
python
def easeInElastic(n, amplitude=1, period=0.3): """An elastic tween function that begins with an increasing wobble and then snaps into the destination. Args: n (float): The time progress, starting at 0.0 and ending at 1.0. Returns: (float) The line progress, starting at 0.0 and ending at 1.0. S...
[ "def", "easeInElastic", "(", "n", ",", "amplitude", "=", "1", ",", "period", "=", "0.3", ")", ":", "_checkRange", "(", "n", ")", "return", "1", "-", "easeOutElastic", "(", "1", "-", "n", ",", "amplitude", "=", "amplitude", ",", "period", "=", "period...
An elastic tween function that begins with an increasing wobble and then snaps into the destination. Args: n (float): The time progress, starting at 0.0 and ending at 1.0. Returns: (float) The line progress, starting at 0.0 and ending at 1.0. Suitable for passing to getPointOnLine().
[ "An", "elastic", "tween", "function", "that", "begins", "with", "an", "increasing", "wobble", "and", "then", "snaps", "into", "the", "destination", "." ]
20d74368e53dc7d0f77c810b624b2c90994f099d
https://github.com/asweigart/pytweening/blob/20d74368e53dc7d0f77c810b624b2c90994f099d/pytweening/__init__.py#L448-L458
43,998
asweigart/pytweening
pytweening/__init__.py
easeOutElastic
def easeOutElastic(n, amplitude=1, period=0.3): """An elastic tween function that overshoots the destination and then "rubber bands" into the destination. Args: n (float): The time progress, starting at 0.0 and ending at 1.0. Returns: (float) The line progress, starting at 0.0 and ending at 1....
python
def easeOutElastic(n, amplitude=1, period=0.3): """An elastic tween function that overshoots the destination and then "rubber bands" into the destination. Args: n (float): The time progress, starting at 0.0 and ending at 1.0. Returns: (float) The line progress, starting at 0.0 and ending at 1....
[ "def", "easeOutElastic", "(", "n", ",", "amplitude", "=", "1", ",", "period", "=", "0.3", ")", ":", "_checkRange", "(", "n", ")", "if", "amplitude", "<", "1", ":", "amplitude", "=", "1", "s", "=", "period", "/", "4", "else", ":", "s", "=", "perio...
An elastic tween function that overshoots the destination and then "rubber bands" into the destination. Args: n (float): The time progress, starting at 0.0 and ending at 1.0. Returns: (float) The line progress, starting at 0.0 and ending at 1.0. Suitable for passing to getPointOnLine().
[ "An", "elastic", "tween", "function", "that", "overshoots", "the", "destination", "and", "then", "rubber", "bands", "into", "the", "destination", "." ]
20d74368e53dc7d0f77c810b624b2c90994f099d
https://github.com/asweigart/pytweening/blob/20d74368e53dc7d0f77c810b624b2c90994f099d/pytweening/__init__.py#L461-L478
43,999
asweigart/pytweening
pytweening/__init__.py
easeInOutElastic
def easeInOutElastic(n, amplitude=1, period=0.5): """An elastic tween function wobbles towards the midpoint. Args: n (float): The time progress, starting at 0.0 and ending at 1.0. Returns: (float) The line progress, starting at 0.0 and ending at 1.0. Suitable for passing to getPointOnLine(). ...
python
def easeInOutElastic(n, amplitude=1, period=0.5): """An elastic tween function wobbles towards the midpoint. Args: n (float): The time progress, starting at 0.0 and ending at 1.0. Returns: (float) The line progress, starting at 0.0 and ending at 1.0. Suitable for passing to getPointOnLine(). ...
[ "def", "easeInOutElastic", "(", "n", ",", "amplitude", "=", "1", ",", "period", "=", "0.5", ")", ":", "_checkRange", "(", "n", ")", "n", "*=", "2", "if", "n", "<", "1", ":", "return", "easeInElastic", "(", "n", ",", "amplitude", "=", "amplitude", "...
An elastic tween function wobbles towards the midpoint. Args: n (float): The time progress, starting at 0.0 and ending at 1.0. Returns: (float) The line progress, starting at 0.0 and ending at 1.0. Suitable for passing to getPointOnLine().
[ "An", "elastic", "tween", "function", "wobbles", "towards", "the", "midpoint", "." ]
20d74368e53dc7d0f77c810b624b2c90994f099d
https://github.com/asweigart/pytweening/blob/20d74368e53dc7d0f77c810b624b2c90994f099d/pytweening/__init__.py#L481-L495