repo
stringlengths
7
55
path
stringlengths
4
223
func_name
stringlengths
1
134
original_string
stringlengths
75
104k
language
stringclasses
1 value
code
stringlengths
75
104k
code_tokens
listlengths
19
28.4k
docstring
stringlengths
1
46.9k
docstring_tokens
listlengths
1
1.97k
sha
stringlengths
40
40
url
stringlengths
87
315
partition
stringclasses
1 value
willkg/socorro-siggen
siggen/utils.py
_is_exception
def _is_exception(exceptions, before_token, after_token, token): """Predicate for whether the open token is in an exception context :arg exceptions: list of strings or None :arg before_token: the text of the function up to the token delimiter :arg after_token: the text of the function after the token d...
python
def _is_exception(exceptions, before_token, after_token, token): """Predicate for whether the open token is in an exception context :arg exceptions: list of strings or None :arg before_token: the text of the function up to the token delimiter :arg after_token: the text of the function after the token d...
[ "def", "_is_exception", "(", "exceptions", ",", "before_token", ",", "after_token", ",", "token", ")", ":", "if", "not", "exceptions", ":", "return", "False", "for", "s", "in", "exceptions", ":", "if", "before_token", ".", "endswith", "(", "s", ")", ":", ...
Predicate for whether the open token is in an exception context :arg exceptions: list of strings or None :arg before_token: the text of the function up to the token delimiter :arg after_token: the text of the function after the token delimiter :arg token: the token (only if we're looking at a close del...
[ "Predicate", "for", "whether", "the", "open", "token", "is", "in", "an", "exception", "context" ]
db7e3233e665a458a961c48da22e93a69b1d08d6
https://github.com/willkg/socorro-siggen/blob/db7e3233e665a458a961c48da22e93a69b1d08d6/siggen/utils.py#L141-L159
train
willkg/socorro-siggen
siggen/utils.py
collapse
def collapse( function, open_string, close_string, replacement='', exceptions=None, ): """Collapses the text between two delimiters in a frame function value This collapses the text between two delimiters and either removes the text altogether or replaces it with a replacement string. ...
python
def collapse( function, open_string, close_string, replacement='', exceptions=None, ): """Collapses the text between two delimiters in a frame function value This collapses the text between two delimiters and either removes the text altogether or replaces it with a replacement string. ...
[ "def", "collapse", "(", "function", ",", "open_string", ",", "close_string", ",", "replacement", "=", "''", ",", "exceptions", "=", "None", ",", ")", ":", "collapsed", "=", "[", "]", "open_count", "=", "0", "open_token", "=", "[", "]", "for", "i", ",",...
Collapses the text between two delimiters in a frame function value This collapses the text between two delimiters and either removes the text altogether or replaces it with a replacement string. There are certain contexts in which we might not want to collapse the text between two delimiters. These a...
[ "Collapses", "the", "text", "between", "two", "delimiters", "in", "a", "frame", "function", "value" ]
db7e3233e665a458a961c48da22e93a69b1d08d6
https://github.com/willkg/socorro-siggen/blob/db7e3233e665a458a961c48da22e93a69b1d08d6/siggen/utils.py#L162-L239
train
willkg/socorro-siggen
siggen/utils.py
drop_prefix_and_return_type
def drop_prefix_and_return_type(function): """Takes the function value from a frame and drops prefix and return type For example:: static void * Allocator<MozJemallocBase>::malloc(unsigned __int64) ^ ^^^^^^ return type prefix This gets changes to this:: Allocator<Moz...
python
def drop_prefix_and_return_type(function): """Takes the function value from a frame and drops prefix and return type For example:: static void * Allocator<MozJemallocBase>::malloc(unsigned __int64) ^ ^^^^^^ return type prefix This gets changes to this:: Allocator<Moz...
[ "def", "drop_prefix_and_return_type", "(", "function", ")", ":", "DELIMITERS", "=", "{", "'('", ":", "')'", ",", "'{'", ":", "'}'", ",", "'['", ":", "']'", ",", "'<'", ":", "'>'", ",", "'`'", ":", "\"'\"", "}", "OPEN", "=", "DELIMITERS", ".", "keys",...
Takes the function value from a frame and drops prefix and return type For example:: static void * Allocator<MozJemallocBase>::malloc(unsigned __int64) ^ ^^^^^^ return type prefix This gets changes to this:: Allocator<MozJemallocBase>::malloc(unsigned __int64) This ...
[ "Takes", "the", "function", "value", "from", "a", "frame", "and", "drops", "prefix", "and", "return", "type" ]
db7e3233e665a458a961c48da22e93a69b1d08d6
https://github.com/willkg/socorro-siggen/blob/db7e3233e665a458a961c48da22e93a69b1d08d6/siggen/utils.py#L242-L324
train
teepark/junction
junction/hub.py
Hub.wait_connected
def wait_connected(self, conns=None, timeout=None): '''Wait for connections to be made and their handshakes to finish :param conns: a single or list of (host, port) tuples with the connections that must be finished before the method will return. defaults to all the p...
python
def wait_connected(self, conns=None, timeout=None): '''Wait for connections to be made and their handshakes to finish :param conns: a single or list of (host, port) tuples with the connections that must be finished before the method will return. defaults to all the p...
[ "def", "wait_connected", "(", "self", ",", "conns", "=", "None", ",", "timeout", "=", "None", ")", ":", "if", "timeout", ":", "deadline", "=", "time", ".", "time", "(", ")", "+", "timeout", "conns", "=", "conns", "or", "self", ".", "_started_peers", ...
Wait for connections to be made and their handshakes to finish :param conns: a single or list of (host, port) tuples with the connections that must be finished before the method will return. defaults to all the peers the :class:`Hub` was instantiated with. :param tim...
[ "Wait", "for", "connections", "to", "be", "made", "and", "their", "handshakes", "to", "finish" ]
481d135d9e53acb55c72686e2eb4483432f35fa6
https://github.com/teepark/junction/blob/481d135d9e53acb55c72686e2eb4483432f35fa6/junction/hub.py#L38-L66
train
teepark/junction
junction/hub.py
Hub.shutdown
def shutdown(self): 'Close all peer connections and stop listening for new ones' log.info("shutting down") for peer in self._dispatcher.peers.values(): peer.go_down(reconnect=False) if self._listener_coro: backend.schedule_exception( errors._...
python
def shutdown(self): 'Close all peer connections and stop listening for new ones' log.info("shutting down") for peer in self._dispatcher.peers.values(): peer.go_down(reconnect=False) if self._listener_coro: backend.schedule_exception( errors._...
[ "def", "shutdown", "(", "self", ")", ":", "log", ".", "info", "(", "\"shutting down\"", ")", "for", "peer", "in", "self", ".", "_dispatcher", ".", "peers", ".", "values", "(", ")", ":", "peer", ".", "go_down", "(", "reconnect", "=", "False", ")", "if...
Close all peer connections and stop listening for new ones
[ "Close", "all", "peer", "connections", "and", "stop", "listening", "for", "new", "ones" ]
481d135d9e53acb55c72686e2eb4483432f35fa6
https://github.com/teepark/junction/blob/481d135d9e53acb55c72686e2eb4483432f35fa6/junction/hub.py#L68-L80
train
teepark/junction
junction/hub.py
Hub.accept_publish
def accept_publish( self, service, mask, value, method, handler=None, schedule=False): '''Set a handler for incoming publish messages :param service: the incoming message must have this service :type service: anything hash-able :param mask: value to be bitwise-an...
python
def accept_publish( self, service, mask, value, method, handler=None, schedule=False): '''Set a handler for incoming publish messages :param service: the incoming message must have this service :type service: anything hash-able :param mask: value to be bitwise-an...
[ "def", "accept_publish", "(", "self", ",", "service", ",", "mask", ",", "value", ",", "method", ",", "handler", "=", "None", ",", "schedule", "=", "False", ")", ":", "# support @hub.accept_publish(serv, mask, val, meth) decorator usage", "if", "handler", "is", "No...
Set a handler for incoming publish messages :param service: the incoming message must have this service :type service: anything hash-able :param mask: value to be bitwise-and'ed against the incoming id, the result of which must mask the 'value' param :type mask: ...
[ "Set", "a", "handler", "for", "incoming", "publish", "messages" ]
481d135d9e53acb55c72686e2eb4483432f35fa6
https://github.com/teepark/junction/blob/481d135d9e53acb55c72686e2eb4483432f35fa6/junction/hub.py#L82-L128
train
teepark/junction
junction/hub.py
Hub.unsubscribe_publish
def unsubscribe_publish(self, service, mask, value): '''Remove a publish subscription :param service: the service of the subscription to remove :type service: anything hash-able :param mask: the mask of the subscription to remove :type mask: int :param value: the value i...
python
def unsubscribe_publish(self, service, mask, value): '''Remove a publish subscription :param service: the service of the subscription to remove :type service: anything hash-able :param mask: the mask of the subscription to remove :type mask: int :param value: the value i...
[ "def", "unsubscribe_publish", "(", "self", ",", "service", ",", "mask", ",", "value", ")", ":", "log", ".", "info", "(", "\"unsubscribing from publish %r\"", "%", "(", "(", "service", ",", "(", "mask", ",", "value", ")", ")", ",", ")", ")", "return", "...
Remove a publish subscription :param service: the service of the subscription to remove :type service: anything hash-able :param mask: the mask of the subscription to remove :type mask: int :param value: the value in the subscription to remove :type value: int :...
[ "Remove", "a", "publish", "subscription" ]
481d135d9e53acb55c72686e2eb4483432f35fa6
https://github.com/teepark/junction/blob/481d135d9e53acb55c72686e2eb4483432f35fa6/junction/hub.py#L130-L147
train
teepark/junction
junction/hub.py
Hub.publish
def publish(self, service, routing_id, method, args=None, kwargs=None, broadcast=False, udp=False): '''Send a 1-way message :param service: the service name (the routing top level) :type service: anything hash-able :param int routing_id: the id used for routing w...
python
def publish(self, service, routing_id, method, args=None, kwargs=None, broadcast=False, udp=False): '''Send a 1-way message :param service: the service name (the routing top level) :type service: anything hash-able :param int routing_id: the id used for routing w...
[ "def", "publish", "(", "self", ",", "service", ",", "routing_id", ",", "method", ",", "args", "=", "None", ",", "kwargs", "=", "None", ",", "broadcast", "=", "False", ",", "udp", "=", "False", ")", ":", "if", "udp", ":", "func", "=", "self", ".", ...
Send a 1-way message :param service: the service name (the routing top level) :type service: anything hash-able :param int routing_id: the id used for routing within the registered handlers of the service :param string method: the method name to call :par...
[ "Send", "a", "1", "-", "way", "message" ]
481d135d9e53acb55c72686e2eb4483432f35fa6
https://github.com/teepark/junction/blob/481d135d9e53acb55c72686e2eb4483432f35fa6/junction/hub.py#L149-L180
train
teepark/junction
junction/hub.py
Hub.publish_receiver_count
def publish_receiver_count(self, service, routing_id): '''Get the number of peers that would handle a particular publish :param service: the service name :type service: anything hash-able :param routing_id: the id used for limiting the service handlers :type routing_id: int ...
python
def publish_receiver_count(self, service, routing_id): '''Get the number of peers that would handle a particular publish :param service: the service name :type service: anything hash-able :param routing_id: the id used for limiting the service handlers :type routing_id: int ...
[ "def", "publish_receiver_count", "(", "self", ",", "service", ",", "routing_id", ")", ":", "peers", "=", "len", "(", "list", "(", "self", ".", "_dispatcher", ".", "find_peer_routes", "(", "const", ".", "MSG_TYPE_PUBLISH", ",", "service", ",", "routing_id", "...
Get the number of peers that would handle a particular publish :param service: the service name :type service: anything hash-able :param routing_id: the id used for limiting the service handlers :type routing_id: int
[ "Get", "the", "number", "of", "peers", "that", "would", "handle", "a", "particular", "publish" ]
481d135d9e53acb55c72686e2eb4483432f35fa6
https://github.com/teepark/junction/blob/481d135d9e53acb55c72686e2eb4483432f35fa6/junction/hub.py#L182-L195
train
teepark/junction
junction/hub.py
Hub.accept_rpc
def accept_rpc(self, service, mask, value, method, handler=None, schedule=True): '''Set a handler for incoming RPCs :param service: the incoming RPC must have this service :type service: anything hash-able :param mask: value to be bitwise-and'ed against the incom...
python
def accept_rpc(self, service, mask, value, method, handler=None, schedule=True): '''Set a handler for incoming RPCs :param service: the incoming RPC must have this service :type service: anything hash-able :param mask: value to be bitwise-and'ed against the incom...
[ "def", "accept_rpc", "(", "self", ",", "service", ",", "mask", ",", "value", ",", "method", ",", "handler", "=", "None", ",", "schedule", "=", "True", ")", ":", "# support @hub.accept_rpc(serv, mask, val, meth) decorator usage", "if", "handler", "is", "None", ":...
Set a handler for incoming RPCs :param service: the incoming RPC must have this service :type service: anything hash-able :param mask: value to be bitwise-and'ed against the incoming id, the result of which must mask the 'value' param :type mask: int :par...
[ "Set", "a", "handler", "for", "incoming", "RPCs" ]
481d135d9e53acb55c72686e2eb4483432f35fa6
https://github.com/teepark/junction/blob/481d135d9e53acb55c72686e2eb4483432f35fa6/junction/hub.py#L197-L243
train
teepark/junction
junction/hub.py
Hub.unsubscribe_rpc
def unsubscribe_rpc(self, service, mask, value): '''Remove a rpc subscription :param service: the service of the subscription to remove :type service: anything hash-able :param mask: the mask of the subscription to remove :type mask: int :param value: the value in the su...
python
def unsubscribe_rpc(self, service, mask, value): '''Remove a rpc subscription :param service: the service of the subscription to remove :type service: anything hash-able :param mask: the mask of the subscription to remove :type mask: int :param value: the value in the su...
[ "def", "unsubscribe_rpc", "(", "self", ",", "service", ",", "mask", ",", "value", ")", ":", "log", ".", "info", "(", "\"unsubscribing from RPC %r\"", "%", "(", "(", "service", ",", "(", "mask", ",", "value", ")", ")", ",", ")", ")", "return", "self", ...
Remove a rpc subscription :param service: the service of the subscription to remove :type service: anything hash-able :param mask: the mask of the subscription to remove :type mask: int :param value: the value in the subscription to remove :type value: int :param...
[ "Remove", "a", "rpc", "subscription" ]
481d135d9e53acb55c72686e2eb4483432f35fa6
https://github.com/teepark/junction/blob/481d135d9e53acb55c72686e2eb4483432f35fa6/junction/hub.py#L245-L263
train
teepark/junction
junction/hub.py
Hub.send_rpc
def send_rpc(self, service, routing_id, method, args=None, kwargs=None, broadcast=False): '''Send out an RPC request :param service: the service name (the routing top level) :type service: anything hash-able :param routing_id: The id used for routing within the r...
python
def send_rpc(self, service, routing_id, method, args=None, kwargs=None, broadcast=False): '''Send out an RPC request :param service: the service name (the routing top level) :type service: anything hash-able :param routing_id: The id used for routing within the r...
[ "def", "send_rpc", "(", "self", ",", "service", ",", "routing_id", ",", "method", ",", "args", "=", "None", ",", "kwargs", "=", "None", ",", "broadcast", "=", "False", ")", ":", "rpc", "=", "self", ".", "_dispatcher", ".", "send_rpc", "(", "service", ...
Send out an RPC request :param service: the service name (the routing top level) :type service: anything hash-able :param routing_id: The id used for routing within the registered handlers of the service. :type routing_id: int :param method: the method na...
[ "Send", "out", "an", "RPC", "request" ]
481d135d9e53acb55c72686e2eb4483432f35fa6
https://github.com/teepark/junction/blob/481d135d9e53acb55c72686e2eb4483432f35fa6/junction/hub.py#L265-L302
train
teepark/junction
junction/hub.py
Hub.rpc
def rpc(self, service, routing_id, method, args=None, kwargs=None, timeout=None, broadcast=False): '''Send an RPC request and return the corresponding response This will block waiting until the response has been received. :param service: the service name (the routing top level) ...
python
def rpc(self, service, routing_id, method, args=None, kwargs=None, timeout=None, broadcast=False): '''Send an RPC request and return the corresponding response This will block waiting until the response has been received. :param service: the service name (the routing top level) ...
[ "def", "rpc", "(", "self", ",", "service", ",", "routing_id", ",", "method", ",", "args", "=", "None", ",", "kwargs", "=", "None", ",", "timeout", "=", "None", ",", "broadcast", "=", "False", ")", ":", "rpc", "=", "self", ".", "send_rpc", "(", "ser...
Send an RPC request and return the corresponding response This will block waiting until the response has been received. :param service: the service name (the routing top level) :type service: anything hash-able :param routing_id: The id used for routing within the registere...
[ "Send", "an", "RPC", "request", "and", "return", "the", "corresponding", "response" ]
481d135d9e53acb55c72686e2eb4483432f35fa6
https://github.com/teepark/junction/blob/481d135d9e53acb55c72686e2eb4483432f35fa6/junction/hub.py#L304-L345
train
teepark/junction
junction/hub.py
Hub.rpc_receiver_count
def rpc_receiver_count(self, service, routing_id): '''Get the number of peers that would handle a particular RPC :param service: the service name :type service: anything hash-able :param routing_id: the id used for narrowing within the service handlers :type routing_...
python
def rpc_receiver_count(self, service, routing_id): '''Get the number of peers that would handle a particular RPC :param service: the service name :type service: anything hash-able :param routing_id: the id used for narrowing within the service handlers :type routing_...
[ "def", "rpc_receiver_count", "(", "self", ",", "service", ",", "routing_id", ")", ":", "peers", "=", "len", "(", "list", "(", "self", ".", "_dispatcher", ".", "find_peer_routes", "(", "const", ".", "MSG_TYPE_RPC_REQUEST", ",", "service", ",", "routing_id", "...
Get the number of peers that would handle a particular RPC :param service: the service name :type service: anything hash-able :param routing_id: the id used for narrowing within the service handlers :type routing_id: int :returns: the integer number of p...
[ "Get", "the", "number", "of", "peers", "that", "would", "handle", "a", "particular", "RPC" ]
481d135d9e53acb55c72686e2eb4483432f35fa6
https://github.com/teepark/junction/blob/481d135d9e53acb55c72686e2eb4483432f35fa6/junction/hub.py#L347-L364
train
teepark/junction
junction/hub.py
Hub.start
def start(self): "Start up the hub's server, and have it start initiating connections" log.info("starting") self._listener_coro = backend.greenlet(self._listener) self._udp_listener_coro = backend.greenlet(self._udp_listener) backend.schedule(self._listener_coro) backend...
python
def start(self): "Start up the hub's server, and have it start initiating connections" log.info("starting") self._listener_coro = backend.greenlet(self._listener) self._udp_listener_coro = backend.greenlet(self._udp_listener) backend.schedule(self._listener_coro) backend...
[ "def", "start", "(", "self", ")", ":", "log", ".", "info", "(", "\"starting\"", ")", "self", ".", "_listener_coro", "=", "backend", ".", "greenlet", "(", "self", ".", "_listener", ")", "self", ".", "_udp_listener_coro", "=", "backend", ".", "greenlet", "...
Start up the hub's server, and have it start initiating connections
[ "Start", "up", "the", "hub", "s", "server", "and", "have", "it", "start", "initiating", "connections" ]
481d135d9e53acb55c72686e2eb4483432f35fa6
https://github.com/teepark/junction/blob/481d135d9e53acb55c72686e2eb4483432f35fa6/junction/hub.py#L366-L376
train
teepark/junction
junction/hub.py
Hub.add_peer
def add_peer(self, peer_addr): "Build a connection to the Hub at a given ``(host, port)`` address" peer = connection.Peer( self._ident, self._dispatcher, peer_addr, backend.Socket()) peer.start() self._started_peers[peer_addr] = peer
python
def add_peer(self, peer_addr): "Build a connection to the Hub at a given ``(host, port)`` address" peer = connection.Peer( self._ident, self._dispatcher, peer_addr, backend.Socket()) peer.start() self._started_peers[peer_addr] = peer
[ "def", "add_peer", "(", "self", ",", "peer_addr", ")", ":", "peer", "=", "connection", ".", "Peer", "(", "self", ".", "_ident", ",", "self", ".", "_dispatcher", ",", "peer_addr", ",", "backend", ".", "Socket", "(", ")", ")", "peer", ".", "start", "("...
Build a connection to the Hub at a given ``(host, port)`` address
[ "Build", "a", "connection", "to", "the", "Hub", "at", "a", "given", "(", "host", "port", ")", "address" ]
481d135d9e53acb55c72686e2eb4483432f35fa6
https://github.com/teepark/junction/blob/481d135d9e53acb55c72686e2eb4483432f35fa6/junction/hub.py#L378-L383
train
teepark/junction
junction/hub.py
Hub.peers
def peers(self): "list of the (host, port) pairs of all connected peer Hubs" return [addr for (addr, peer) in self._dispatcher.peers.items() if peer.up]
python
def peers(self): "list of the (host, port) pairs of all connected peer Hubs" return [addr for (addr, peer) in self._dispatcher.peers.items() if peer.up]
[ "def", "peers", "(", "self", ")", ":", "return", "[", "addr", "for", "(", "addr", ",", "peer", ")", "in", "self", ".", "_dispatcher", ".", "peers", ".", "items", "(", ")", "if", "peer", ".", "up", "]" ]
list of the (host, port) pairs of all connected peer Hubs
[ "list", "of", "the", "(", "host", "port", ")", "pairs", "of", "all", "connected", "peer", "Hubs" ]
481d135d9e53acb55c72686e2eb4483432f35fa6
https://github.com/teepark/junction/blob/481d135d9e53acb55c72686e2eb4483432f35fa6/junction/hub.py#L386-L389
train
willkg/socorro-siggen
siggen/cmd_signature.py
main
def main(argv=None): """Takes crash data via args and generates a Socorro signature """ parser = argparse.ArgumentParser(description=DESCRIPTION, epilog=EPILOG) parser.add_argument( '-v', '--verbose', help='increase output verbosity', action='store_true' ) parser.add_argument( '...
python
def main(argv=None): """Takes crash data via args and generates a Socorro signature """ parser = argparse.ArgumentParser(description=DESCRIPTION, epilog=EPILOG) parser.add_argument( '-v', '--verbose', help='increase output verbosity', action='store_true' ) parser.add_argument( '...
[ "def", "main", "(", "argv", "=", "None", ")", ":", "parser", "=", "argparse", ".", "ArgumentParser", "(", "description", "=", "DESCRIPTION", ",", "epilog", "=", "EPILOG", ")", "parser", ".", "add_argument", "(", "'-v'", ",", "'--verbose'", ",", "help", "...
Takes crash data via args and generates a Socorro signature
[ "Takes", "crash", "data", "via", "args", "and", "generates", "a", "Socorro", "signature" ]
db7e3233e665a458a961c48da22e93a69b1d08d6
https://github.com/willkg/socorro-siggen/blob/db7e3233e665a458a961c48da22e93a69b1d08d6/siggen/cmd_signature.py#L111-L209
train
Eyepea/tanto
monitoring_agent/outputs/ws_shinken.py
WsShinken.send_result
def send_result(self, return_code, output, service_description='', time_stamp=0, specific_servers=None): ''' Send result to the Skinken WS ''' if time_stamp == 0: time_stamp = int(time.time()) if specific_servers == None: specific_servers = self.servers ...
python
def send_result(self, return_code, output, service_description='', time_stamp=0, specific_servers=None): ''' Send result to the Skinken WS ''' if time_stamp == 0: time_stamp = int(time.time()) if specific_servers == None: specific_servers = self.servers ...
[ "def", "send_result", "(", "self", ",", "return_code", ",", "output", ",", "service_description", "=", "''", ",", "time_stamp", "=", "0", ",", "specific_servers", "=", "None", ")", ":", "if", "time_stamp", "==", "0", ":", "time_stamp", "=", "int", "(", "...
Send result to the Skinken WS
[ "Send", "result", "to", "the", "Skinken", "WS" ]
ad8fd32e0fd3b7bc3dee5dabb984a2567ae46fe9
https://github.com/Eyepea/tanto/blob/ad8fd32e0fd3b7bc3dee5dabb984a2567ae46fe9/monitoring_agent/outputs/ws_shinken.py#L85-L143
train
Eyepea/tanto
monitoring_agent/outputs/ws_shinken.py
WsShinken.close_cache
def close_cache(self): ''' Close cache of WS Shinken ''' # Close all WS_Shinken cache files for server in self.servers: if self.servers[server]['cache'] == True: self.servers[server]['file'].close()
python
def close_cache(self): ''' Close cache of WS Shinken ''' # Close all WS_Shinken cache files for server in self.servers: if self.servers[server]['cache'] == True: self.servers[server]['file'].close()
[ "def", "close_cache", "(", "self", ")", ":", "# Close all WS_Shinken cache files", "for", "server", "in", "self", ".", "servers", ":", "if", "self", ".", "servers", "[", "server", "]", "[", "'cache'", "]", "==", "True", ":", "self", ".", "servers", "[", ...
Close cache of WS Shinken
[ "Close", "cache", "of", "WS", "Shinken" ]
ad8fd32e0fd3b7bc3dee5dabb984a2567ae46fe9
https://github.com/Eyepea/tanto/blob/ad8fd32e0fd3b7bc3dee5dabb984a2567ae46fe9/monitoring_agent/outputs/ws_shinken.py#L146-L153
train
storax/jinjaapidoc
src/jinjaapidoc/gendoc.py
prepare_dir
def prepare_dir(app, directory, delete=False): """Create apidoc dir, delete contents if delete is True. :param app: the sphinx app :type app: :class:`sphinx.application.Sphinx` :param directory: the apidoc directory. you can use relative paths here :type directory: str :param delete: if True, d...
python
def prepare_dir(app, directory, delete=False): """Create apidoc dir, delete contents if delete is True. :param app: the sphinx app :type app: :class:`sphinx.application.Sphinx` :param directory: the apidoc directory. you can use relative paths here :type directory: str :param delete: if True, d...
[ "def", "prepare_dir", "(", "app", ",", "directory", ",", "delete", "=", "False", ")", ":", "logger", ".", "info", "(", "\"Preparing output directories for jinjaapidoc.\"", ")", "if", "os", ".", "path", ".", "exists", "(", "directory", ")", ":", "if", "delete...
Create apidoc dir, delete contents if delete is True. :param app: the sphinx app :type app: :class:`sphinx.application.Sphinx` :param directory: the apidoc directory. you can use relative paths here :type directory: str :param delete: if True, deletes the contents of apidoc. This acts like an overr...
[ "Create", "apidoc", "dir", "delete", "contents", "if", "delete", "is", "True", "." ]
f1eeb6ab5bd1a96c4130306718c6423f37c76856
https://github.com/storax/jinjaapidoc/blob/f1eeb6ab5bd1a96c4130306718c6423f37c76856/src/jinjaapidoc/gendoc.py#L38-L60
train
storax/jinjaapidoc
src/jinjaapidoc/gendoc.py
makename
def makename(package, module): """Join package and module with a dot. Package or Module can be empty. :param package: the package name :type package: :class:`str` :param module: the module name :type module: :class:`str` :returns: the joined name :rtype: :class:`str` :raises: :clas...
python
def makename(package, module): """Join package and module with a dot. Package or Module can be empty. :param package: the package name :type package: :class:`str` :param module: the module name :type module: :class:`str` :returns: the joined name :rtype: :class:`str` :raises: :clas...
[ "def", "makename", "(", "package", ",", "module", ")", ":", "# Both package and module can be None/empty.", "assert", "package", "or", "module", ",", "\"Specify either package or module\"", "if", "package", ":", "name", "=", "package", "if", "module", ":", "name", "...
Join package and module with a dot. Package or Module can be empty. :param package: the package name :type package: :class:`str` :param module: the module name :type module: :class:`str` :returns: the joined name :rtype: :class:`str` :raises: :class:`AssertionError`, if both package an...
[ "Join", "package", "and", "module", "with", "a", "dot", "." ]
f1eeb6ab5bd1a96c4130306718c6423f37c76856
https://github.com/storax/jinjaapidoc/blob/f1eeb6ab5bd1a96c4130306718c6423f37c76856/src/jinjaapidoc/gendoc.py#L87-L108
train
storax/jinjaapidoc
src/jinjaapidoc/gendoc.py
write_file
def write_file(app, name, text, dest, suffix, dryrun, force): """Write the output file for module/package <name>. :param app: the sphinx app :type app: :class:`sphinx.application.Sphinx` :param name: the file name without file extension :type name: :class:`str` :param text: the content of the f...
python
def write_file(app, name, text, dest, suffix, dryrun, force): """Write the output file for module/package <name>. :param app: the sphinx app :type app: :class:`sphinx.application.Sphinx` :param name: the file name without file extension :type name: :class:`str` :param text: the content of the f...
[ "def", "write_file", "(", "app", ",", "name", ",", "text", ",", "dest", ",", "suffix", ",", "dryrun", ",", "force", ")", ":", "fname", "=", "os", ".", "path", ".", "join", "(", "dest", ",", "'%s.%s'", "%", "(", "name", ",", "suffix", ")", ")", ...
Write the output file for module/package <name>. :param app: the sphinx app :type app: :class:`sphinx.application.Sphinx` :param name: the file name without file extension :type name: :class:`str` :param text: the content of the file :type text: :class:`str` :param dest: the output director...
[ "Write", "the", "output", "file", "for", "module", "/", "package", "<name", ">", "." ]
f1eeb6ab5bd1a96c4130306718c6423f37c76856
https://github.com/storax/jinjaapidoc/blob/f1eeb6ab5bd1a96c4130306718c6423f37c76856/src/jinjaapidoc/gendoc.py#L111-L149
train
storax/jinjaapidoc
src/jinjaapidoc/gendoc.py
import_name
def import_name(app, name): """Import the given name and return name, obj, parent, mod_name :param name: name to import :type name: str :returns: the imported object or None :rtype: object | None :raises: None """ try: logger.debug('Importing %r', name) name, obj = autos...
python
def import_name(app, name): """Import the given name and return name, obj, parent, mod_name :param name: name to import :type name: str :returns: the imported object or None :rtype: object | None :raises: None """ try: logger.debug('Importing %r', name) name, obj = autos...
[ "def", "import_name", "(", "app", ",", "name", ")", ":", "try", ":", "logger", ".", "debug", "(", "'Importing %r'", ",", "name", ")", "name", ",", "obj", "=", "autosummary", ".", "import_by_name", "(", "name", ")", "[", ":", "2", "]", "logger", ".", ...
Import the given name and return name, obj, parent, mod_name :param name: name to import :type name: str :returns: the imported object or None :rtype: object | None :raises: None
[ "Import", "the", "given", "name", "and", "return", "name", "obj", "parent", "mod_name" ]
f1eeb6ab5bd1a96c4130306718c6423f37c76856
https://github.com/storax/jinjaapidoc/blob/f1eeb6ab5bd1a96c4130306718c6423f37c76856/src/jinjaapidoc/gendoc.py#L152-L167
train
storax/jinjaapidoc
src/jinjaapidoc/gendoc.py
get_members
def get_members(app, mod, typ, include_public=None): """Return the members of mod of the given type :param app: the sphinx app :type app: :class:`sphinx.application.Sphinx` :param mod: the module with members :type mod: module :param typ: the typ, ``'class'``, ``'function'``, ``'exception'``, `...
python
def get_members(app, mod, typ, include_public=None): """Return the members of mod of the given type :param app: the sphinx app :type app: :class:`sphinx.application.Sphinx` :param mod: the module with members :type mod: module :param typ: the typ, ``'class'``, ``'function'``, ``'exception'``, `...
[ "def", "get_members", "(", "app", ",", "mod", ",", "typ", ",", "include_public", "=", "None", ")", ":", "def", "include_here", "(", "x", ")", ":", "\"\"\"Return true if the member should be included in mod.\n\n A member will be included if it is declared in this module...
Return the members of mod of the given type :param app: the sphinx app :type app: :class:`sphinx.application.Sphinx` :param mod: the module with members :type mod: module :param typ: the typ, ``'class'``, ``'function'``, ``'exception'``, ``'data'``, ``'members'`` :type typ: str :param inclu...
[ "Return", "the", "members", "of", "mod", "of", "the", "given", "type" ]
f1eeb6ab5bd1a96c4130306718c6423f37c76856
https://github.com/storax/jinjaapidoc/blob/f1eeb6ab5bd1a96c4130306718c6423f37c76856/src/jinjaapidoc/gendoc.py#L170-L218
train
storax/jinjaapidoc
src/jinjaapidoc/gendoc.py
_get_submodules
def _get_submodules(app, module): """Get all submodules for the given module/package :param app: the sphinx app :type app: :class:`sphinx.application.Sphinx` :param module: the module to query or module path :type module: module | str :returns: list of module names and boolean whether its a pac...
python
def _get_submodules(app, module): """Get all submodules for the given module/package :param app: the sphinx app :type app: :class:`sphinx.application.Sphinx` :param module: the module to query or module path :type module: module | str :returns: list of module names and boolean whether its a pac...
[ "def", "_get_submodules", "(", "app", ",", "module", ")", ":", "if", "inspect", ".", "ismodule", "(", "module", ")", ":", "if", "hasattr", "(", "module", ",", "'__path__'", ")", ":", "p", "=", "module", ".", "__path__", "else", ":", "return", "[", "]...
Get all submodules for the given module/package :param app: the sphinx app :type app: :class:`sphinx.application.Sphinx` :param module: the module to query or module path :type module: module | str :returns: list of module names and boolean whether its a package :rtype: list :raises: TypeEr...
[ "Get", "all", "submodules", "for", "the", "given", "module", "/", "package" ]
f1eeb6ab5bd1a96c4130306718c6423f37c76856
https://github.com/storax/jinjaapidoc/blob/f1eeb6ab5bd1a96c4130306718c6423f37c76856/src/jinjaapidoc/gendoc.py#L221-L244
train
storax/jinjaapidoc
src/jinjaapidoc/gendoc.py
get_submodules
def get_submodules(app, module): """Get all submodules without packages for the given module/package :param app: the sphinx app :type app: :class:`sphinx.application.Sphinx` :param module: the module to query or module path :type module: module | str :returns: list of module names excluding pac...
python
def get_submodules(app, module): """Get all submodules without packages for the given module/package :param app: the sphinx app :type app: :class:`sphinx.application.Sphinx` :param module: the module to query or module path :type module: module | str :returns: list of module names excluding pac...
[ "def", "get_submodules", "(", "app", ",", "module", ")", ":", "submodules", "=", "_get_submodules", "(", "app", ",", "module", ")", "return", "[", "name", "for", "name", ",", "ispkg", "in", "submodules", "if", "not", "ispkg", "]" ]
Get all submodules without packages for the given module/package :param app: the sphinx app :type app: :class:`sphinx.application.Sphinx` :param module: the module to query or module path :type module: module | str :returns: list of module names excluding packages :rtype: list :raises: Type...
[ "Get", "all", "submodules", "without", "packages", "for", "the", "given", "module", "/", "package" ]
f1eeb6ab5bd1a96c4130306718c6423f37c76856
https://github.com/storax/jinjaapidoc/blob/f1eeb6ab5bd1a96c4130306718c6423f37c76856/src/jinjaapidoc/gendoc.py#L247-L259
train
storax/jinjaapidoc
src/jinjaapidoc/gendoc.py
get_subpackages
def get_subpackages(app, module): """Get all subpackages for the given module/package :param app: the sphinx app :type app: :class:`sphinx.application.Sphinx` :param module: the module to query or module path :type module: module | str :returns: list of packages names :rtype: list :rais...
python
def get_subpackages(app, module): """Get all subpackages for the given module/package :param app: the sphinx app :type app: :class:`sphinx.application.Sphinx` :param module: the module to query or module path :type module: module | str :returns: list of packages names :rtype: list :rais...
[ "def", "get_subpackages", "(", "app", ",", "module", ")", ":", "submodules", "=", "_get_submodules", "(", "app", ",", "module", ")", "return", "[", "name", "for", "name", ",", "ispkg", "in", "submodules", "if", "ispkg", "]" ]
Get all subpackages for the given module/package :param app: the sphinx app :type app: :class:`sphinx.application.Sphinx` :param module: the module to query or module path :type module: module | str :returns: list of packages names :rtype: list :raises: TypeError
[ "Get", "all", "subpackages", "for", "the", "given", "module", "/", "package" ]
f1eeb6ab5bd1a96c4130306718c6423f37c76856
https://github.com/storax/jinjaapidoc/blob/f1eeb6ab5bd1a96c4130306718c6423f37c76856/src/jinjaapidoc/gendoc.py#L262-L274
train
storax/jinjaapidoc
src/jinjaapidoc/gendoc.py
get_context
def get_context(app, package, module, fullname): """Return a dict for template rendering Variables: * :package: The top package * :module: the module * :fullname: package.module * :subpkgs: packages beneath module * :submods: modules beneath module * :classes: public classe...
python
def get_context(app, package, module, fullname): """Return a dict for template rendering Variables: * :package: The top package * :module: the module * :fullname: package.module * :subpkgs: packages beneath module * :submods: modules beneath module * :classes: public classe...
[ "def", "get_context", "(", "app", ",", "package", ",", "module", ",", "fullname", ")", ":", "var", "=", "{", "'package'", ":", "package", ",", "'module'", ":", "module", ",", "'fullname'", ":", "fullname", "}", "logger", ".", "debug", "(", "'Creating con...
Return a dict for template rendering Variables: * :package: The top package * :module: the module * :fullname: package.module * :subpkgs: packages beneath module * :submods: modules beneath module * :classes: public classes in module * :allclasses: public and private clas...
[ "Return", "a", "dict", "for", "template", "rendering" ]
f1eeb6ab5bd1a96c4130306718c6423f37c76856
https://github.com/storax/jinjaapidoc/blob/f1eeb6ab5bd1a96c4130306718c6423f37c76856/src/jinjaapidoc/gendoc.py#L277-L330
train
storax/jinjaapidoc
src/jinjaapidoc/gendoc.py
create_module_file
def create_module_file(app, env, package, module, dest, suffix, dryrun, force): """Build the text of the file and write the file. :param app: the sphinx app :type app: :class:`sphinx.application.Sphinx` :param env: the jinja environment for the templates :type env: :class:`jinja2.Environment` :...
python
def create_module_file(app, env, package, module, dest, suffix, dryrun, force): """Build the text of the file and write the file. :param app: the sphinx app :type app: :class:`sphinx.application.Sphinx` :param env: the jinja environment for the templates :type env: :class:`jinja2.Environment` :...
[ "def", "create_module_file", "(", "app", ",", "env", ",", "package", ",", "module", ",", "dest", ",", "suffix", ",", "dryrun", ",", "force", ")", ":", "logger", ".", "debug", "(", "'Create module file: package %s, module %s'", ",", "package", ",", "module", ...
Build the text of the file and write the file. :param app: the sphinx app :type app: :class:`sphinx.application.Sphinx` :param env: the jinja environment for the templates :type env: :class:`jinja2.Environment` :param package: the package name :type package: :class:`str` :param module: the ...
[ "Build", "the", "text", "of", "the", "file", "and", "write", "the", "file", "." ]
f1eeb6ab5bd1a96c4130306718c6423f37c76856
https://github.com/storax/jinjaapidoc/blob/f1eeb6ab5bd1a96c4130306718c6423f37c76856/src/jinjaapidoc/gendoc.py#L333-L362
train
storax/jinjaapidoc
src/jinjaapidoc/gendoc.py
create_package_file
def create_package_file(app, env, root_package, sub_package, private, dest, suffix, dryrun, force): """Build the text of the file and write the file. :param app: the sphinx app :type app: :class:`sphinx.application.Sphinx` :param env: the jinja environment for the templates ...
python
def create_package_file(app, env, root_package, sub_package, private, dest, suffix, dryrun, force): """Build the text of the file and write the file. :param app: the sphinx app :type app: :class:`sphinx.application.Sphinx` :param env: the jinja environment for the templates ...
[ "def", "create_package_file", "(", "app", ",", "env", ",", "root_package", ",", "sub_package", ",", "private", ",", "dest", ",", "suffix", ",", "dryrun", ",", "force", ")", ":", "logger", ".", "debug", "(", "'Create package file: rootpackage %s, sub_package %s'", ...
Build the text of the file and write the file. :param app: the sphinx app :type app: :class:`sphinx.application.Sphinx` :param env: the jinja environment for the templates :type env: :class:`jinja2.Environment` :param root_package: the parent package :type root_package: :class:`str` :param ...
[ "Build", "the", "text", "of", "the", "file", "and", "write", "the", "file", "." ]
f1eeb6ab5bd1a96c4130306718c6423f37c76856
https://github.com/storax/jinjaapidoc/blob/f1eeb6ab5bd1a96c4130306718c6423f37c76856/src/jinjaapidoc/gendoc.py#L365-L401
train
storax/jinjaapidoc
src/jinjaapidoc/gendoc.py
shall_skip
def shall_skip(app, module, private): """Check if we want to skip this module. :param app: the sphinx app :type app: :class:`sphinx.application.Sphinx` :param module: the module name :type module: :class:`str` :param private: True, if privates are allowed :type private: :class:`bool` ""...
python
def shall_skip(app, module, private): """Check if we want to skip this module. :param app: the sphinx app :type app: :class:`sphinx.application.Sphinx` :param module: the module name :type module: :class:`str` :param private: True, if privates are allowed :type private: :class:`bool` ""...
[ "def", "shall_skip", "(", "app", ",", "module", ",", "private", ")", ":", "logger", ".", "debug", "(", "'Testing if %s should be skipped.'", ",", "module", ")", "# skip if it has a \"private\" name and this is selected", "if", "module", "!=", "'__init__.py'", "and", "...
Check if we want to skip this module. :param app: the sphinx app :type app: :class:`sphinx.application.Sphinx` :param module: the module name :type module: :class:`str` :param private: True, if privates are allowed :type private: :class:`bool`
[ "Check", "if", "we", "want", "to", "skip", "this", "module", "." ]
f1eeb6ab5bd1a96c4130306718c6423f37c76856
https://github.com/storax/jinjaapidoc/blob/f1eeb6ab5bd1a96c4130306718c6423f37c76856/src/jinjaapidoc/gendoc.py#L404-L421
train
storax/jinjaapidoc
src/jinjaapidoc/gendoc.py
recurse_tree
def recurse_tree(app, env, src, dest, excludes, followlinks, force, dryrun, private, suffix): """Look for every file in the directory tree and create the corresponding ReST files. :param app: the sphinx app :type app: :class:`sphinx.application.Sphinx` :param env: the jinja environment :type en...
python
def recurse_tree(app, env, src, dest, excludes, followlinks, force, dryrun, private, suffix): """Look for every file in the directory tree and create the corresponding ReST files. :param app: the sphinx app :type app: :class:`sphinx.application.Sphinx` :param env: the jinja environment :type en...
[ "def", "recurse_tree", "(", "app", ",", "env", ",", "src", ",", "dest", ",", "excludes", ",", "followlinks", ",", "force", ",", "dryrun", ",", "private", ",", "suffix", ")", ":", "# check if the base directory is a package and get its name", "if", "INITPY", "in"...
Look for every file in the directory tree and create the corresponding ReST files. :param app: the sphinx app :type app: :class:`sphinx.application.Sphinx` :param env: the jinja environment :type env: :class:`jinja2.Environment` :param src: the path to the python source files :type src: :cl...
[ "Look", "for", "every", "file", "in", "the", "directory", "tree", "and", "create", "the", "corresponding", "ReST", "files", "." ]
f1eeb6ab5bd1a96c4130306718c6423f37c76856
https://github.com/storax/jinjaapidoc/blob/f1eeb6ab5bd1a96c4130306718c6423f37c76856/src/jinjaapidoc/gendoc.py#L424-L495
train
storax/jinjaapidoc
src/jinjaapidoc/gendoc.py
normalize_excludes
def normalize_excludes(excludes): """Normalize the excluded directory list.""" return [os.path.normpath(os.path.abspath(exclude)) for exclude in excludes]
python
def normalize_excludes(excludes): """Normalize the excluded directory list.""" return [os.path.normpath(os.path.abspath(exclude)) for exclude in excludes]
[ "def", "normalize_excludes", "(", "excludes", ")", ":", "return", "[", "os", ".", "path", ".", "normpath", "(", "os", ".", "path", ".", "abspath", "(", "exclude", ")", ")", "for", "exclude", "in", "excludes", "]" ]
Normalize the excluded directory list.
[ "Normalize", "the", "excluded", "directory", "list", "." ]
f1eeb6ab5bd1a96c4130306718c6423f37c76856
https://github.com/storax/jinjaapidoc/blob/f1eeb6ab5bd1a96c4130306718c6423f37c76856/src/jinjaapidoc/gendoc.py#L498-L500
train
storax/jinjaapidoc
src/jinjaapidoc/gendoc.py
is_excluded
def is_excluded(root, excludes): """Check if the directory is in the exclude list. Note: by having trailing slashes, we avoid common prefix issues, like e.g. an exlude "foo" also accidentally excluding "foobar". """ root = os.path.normpath(root) for exclude in excludes: if root ==...
python
def is_excluded(root, excludes): """Check if the directory is in the exclude list. Note: by having trailing slashes, we avoid common prefix issues, like e.g. an exlude "foo" also accidentally excluding "foobar". """ root = os.path.normpath(root) for exclude in excludes: if root ==...
[ "def", "is_excluded", "(", "root", ",", "excludes", ")", ":", "root", "=", "os", ".", "path", ".", "normpath", "(", "root", ")", "for", "exclude", "in", "excludes", ":", "if", "root", "==", "exclude", ":", "return", "True", "return", "False" ]
Check if the directory is in the exclude list. Note: by having trailing slashes, we avoid common prefix issues, like e.g. an exlude "foo" also accidentally excluding "foobar".
[ "Check", "if", "the", "directory", "is", "in", "the", "exclude", "list", "." ]
f1eeb6ab5bd1a96c4130306718c6423f37c76856
https://github.com/storax/jinjaapidoc/blob/f1eeb6ab5bd1a96c4130306718c6423f37c76856/src/jinjaapidoc/gendoc.py#L503-L513
train
storax/jinjaapidoc
src/jinjaapidoc/gendoc.py
generate
def generate(app, src, dest, exclude=[], followlinks=False, force=False, dryrun=False, private=False, suffix='rst', template_dirs=None): """Generage the rst files Raises an :class:`OSError` if the source path is not a directory. :param app: the sphinx app :type app: :class:`s...
python
def generate(app, src, dest, exclude=[], followlinks=False, force=False, dryrun=False, private=False, suffix='rst', template_dirs=None): """Generage the rst files Raises an :class:`OSError` if the source path is not a directory. :param app: the sphinx app :type app: :class:`s...
[ "def", "generate", "(", "app", ",", "src", ",", "dest", ",", "exclude", "=", "[", "]", ",", "followlinks", "=", "False", ",", "force", "=", "False", ",", "dryrun", "=", "False", ",", "private", "=", "False", ",", "suffix", "=", "'rst'", ",", "templ...
Generage the rst files Raises an :class:`OSError` if the source path is not a directory. :param app: the sphinx app :type app: :class:`sphinx.application.Sphinx` :param src: path to python source files :type src: :class:`str` :param dest: output directory :type dest: :class:`str` :para...
[ "Generage", "the", "rst", "files" ]
f1eeb6ab5bd1a96c4130306718c6423f37c76856
https://github.com/storax/jinjaapidoc/blob/f1eeb6ab5bd1a96c4130306718c6423f37c76856/src/jinjaapidoc/gendoc.py#L516-L556
train
storax/jinjaapidoc
src/jinjaapidoc/gendoc.py
main
def main(app): """Parse the config of the app and initiate the generation process :param app: the sphinx app :type app: :class:`sphinx.application.Sphinx` :returns: None :rtype: None :raises: None """ c = app.config src = c.jinjaapi_srcdir if not src: return suffix...
python
def main(app): """Parse the config of the app and initiate the generation process :param app: the sphinx app :type app: :class:`sphinx.application.Sphinx` :returns: None :rtype: None :raises: None """ c = app.config src = c.jinjaapi_srcdir if not src: return suffix...
[ "def", "main", "(", "app", ")", ":", "c", "=", "app", ".", "config", "src", "=", "c", ".", "jinjaapi_srcdir", "if", "not", "src", ":", "return", "suffix", "=", "\"rst\"", "out", "=", "c", ".", "jinjaapi_outputdir", "or", "app", ".", "env", ".", "sr...
Parse the config of the app and initiate the generation process :param app: the sphinx app :type app: :class:`sphinx.application.Sphinx` :returns: None :rtype: None :raises: None
[ "Parse", "the", "config", "of", "the", "app", "and", "initiate", "the", "generation", "process" ]
f1eeb6ab5bd1a96c4130306718c6423f37c76856
https://github.com/storax/jinjaapidoc/blob/f1eeb6ab5bd1a96c4130306718c6423f37c76856/src/jinjaapidoc/gendoc.py#L559-L593
train
pmacosta/pmisc
pmisc/number.py
_isclose
def _isclose(obja, objb, rtol=1e-05, atol=1e-08): """Return floating point equality.""" return abs(obja - objb) <= (atol + rtol * abs(objb))
python
def _isclose(obja, objb, rtol=1e-05, atol=1e-08): """Return floating point equality.""" return abs(obja - objb) <= (atol + rtol * abs(objb))
[ "def", "_isclose", "(", "obja", ",", "objb", ",", "rtol", "=", "1e-05", ",", "atol", "=", "1e-08", ")", ":", "return", "abs", "(", "obja", "-", "objb", ")", "<=", "(", "atol", "+", "rtol", "*", "abs", "(", "objb", ")", ")" ]
Return floating point equality.
[ "Return", "floating", "point", "equality", "." ]
dd2bb32e59eee872f1ef2db2d9921a396ab9f50b
https://github.com/pmacosta/pmisc/blob/dd2bb32e59eee872f1ef2db2d9921a396ab9f50b/pmisc/number.py#L19-L21
train
pmacosta/pmisc
pmisc/number.py
_isreal
def _isreal(obj): """ Determine if an object is a real number. Both Python standard data types and Numpy data types are supported. :param obj: Object :type obj: any :rtype: boolean """ # pylint: disable=W0702 if (obj is None) or isinstance(obj, bool): return False try...
python
def _isreal(obj): """ Determine if an object is a real number. Both Python standard data types and Numpy data types are supported. :param obj: Object :type obj: any :rtype: boolean """ # pylint: disable=W0702 if (obj is None) or isinstance(obj, bool): return False try...
[ "def", "_isreal", "(", "obj", ")", ":", "# pylint: disable=W0702", "if", "(", "obj", "is", "None", ")", "or", "isinstance", "(", "obj", ",", "bool", ")", ":", "return", "False", "try", ":", "cond", "=", "(", "int", "(", "obj", ")", "==", "obj", ")"...
Determine if an object is a real number. Both Python standard data types and Numpy data types are supported. :param obj: Object :type obj: any :rtype: boolean
[ "Determine", "if", "an", "object", "is", "a", "real", "number", "." ]
dd2bb32e59eee872f1ef2db2d9921a396ab9f50b
https://github.com/pmacosta/pmisc/blob/dd2bb32e59eee872f1ef2db2d9921a396ab9f50b/pmisc/number.py#L24-L42
train
pmacosta/pmisc
pmisc/number.py
_no_exp
def _no_exp(number): r""" Convert a number to a string without using scientific notation. :param number: Number to convert :type number: integer or float :rtype: string :raises: RuntimeError (Argument \`number\` is not valid) """ if isinstance(number, bool) or (not isinstance(number,...
python
def _no_exp(number): r""" Convert a number to a string without using scientific notation. :param number: Number to convert :type number: integer or float :rtype: string :raises: RuntimeError (Argument \`number\` is not valid) """ if isinstance(number, bool) or (not isinstance(number,...
[ "def", "_no_exp", "(", "number", ")", ":", "if", "isinstance", "(", "number", ",", "bool", ")", "or", "(", "not", "isinstance", "(", "number", ",", "(", "int", ",", "float", ")", ")", ")", ":", "raise", "RuntimeError", "(", "\"Argument `number` is not va...
r""" Convert a number to a string without using scientific notation. :param number: Number to convert :type number: integer or float :rtype: string :raises: RuntimeError (Argument \`number\` is not valid)
[ "r", "Convert", "a", "number", "to", "a", "string", "without", "using", "scientific", "notation", "." ]
dd2bb32e59eee872f1ef2db2d9921a396ab9f50b
https://github.com/pmacosta/pmisc/blob/dd2bb32e59eee872f1ef2db2d9921a396ab9f50b/pmisc/number.py#L45-L70
train
pmacosta/pmisc
pmisc/number.py
_to_scientific_tuple
def _to_scientific_tuple(number): r""" Return mantissa and exponent of a number expressed in scientific notation. Full precision is maintained if the number is represented as a string. :param number: Number :type number: integer, float or string :rtype: Tuple whose first item is the mantissa...
python
def _to_scientific_tuple(number): r""" Return mantissa and exponent of a number expressed in scientific notation. Full precision is maintained if the number is represented as a string. :param number: Number :type number: integer, float or string :rtype: Tuple whose first item is the mantissa...
[ "def", "_to_scientific_tuple", "(", "number", ")", ":", "# pylint: disable=W0632", "if", "isinstance", "(", "number", ",", "bool", ")", "or", "(", "not", "isinstance", "(", "number", ",", "(", "int", ",", "float", ",", "str", ")", ")", ")", ":", "raise",...
r""" Return mantissa and exponent of a number expressed in scientific notation. Full precision is maintained if the number is represented as a string. :param number: Number :type number: integer, float or string :rtype: Tuple whose first item is the mantissa (*string*) and the second ...
[ "r", "Return", "mantissa", "and", "exponent", "of", "a", "number", "expressed", "in", "scientific", "notation", "." ]
dd2bb32e59eee872f1ef2db2d9921a396ab9f50b
https://github.com/pmacosta/pmisc/blob/dd2bb32e59eee872f1ef2db2d9921a396ab9f50b/pmisc/number.py#L73-L113
train
pmacosta/pmisc
pmisc/number.py
gcd
def gcd(vector): """ Calculate the greatest common divisor (GCD) of a sequence of numbers. The sequence can be a list of numbers or a Numpy vector of numbers. The computations are carried out with a precision of 1E-12 if the objects are not `fractions <https://docs.python.org/3/library/fractions.ht...
python
def gcd(vector): """ Calculate the greatest common divisor (GCD) of a sequence of numbers. The sequence can be a list of numbers or a Numpy vector of numbers. The computations are carried out with a precision of 1E-12 if the objects are not `fractions <https://docs.python.org/3/library/fractions.ht...
[ "def", "gcd", "(", "vector", ")", ":", "# pylint: disable=C1801", "if", "not", "len", "(", "vector", ")", ":", "return", "None", "if", "len", "(", "vector", ")", "==", "1", ":", "return", "vector", "[", "0", "]", "if", "len", "(", "vector", ")", "=...
Calculate the greatest common divisor (GCD) of a sequence of numbers. The sequence can be a list of numbers or a Numpy vector of numbers. The computations are carried out with a precision of 1E-12 if the objects are not `fractions <https://docs.python.org/3/library/fractions.html>`_. When possible it i...
[ "Calculate", "the", "greatest", "common", "divisor", "(", "GCD", ")", "of", "a", "sequence", "of", "numbers", "." ]
dd2bb32e59eee872f1ef2db2d9921a396ab9f50b
https://github.com/pmacosta/pmisc/blob/dd2bb32e59eee872f1ef2db2d9921a396ab9f50b/pmisc/number.py#L116-L141
train
pmacosta/pmisc
pmisc/number.py
normalize
def normalize(value, series, offset=0): r""" Scale a value to the range defined by a series. :param value: Value to normalize :type value: number :param series: List of numbers that defines the normalization range :type series: list :param offset: Normalization offset, i.e. the returned...
python
def normalize(value, series, offset=0): r""" Scale a value to the range defined by a series. :param value: Value to normalize :type value: number :param series: List of numbers that defines the normalization range :type series: list :param offset: Normalization offset, i.e. the returned...
[ "def", "normalize", "(", "value", ",", "series", ",", "offset", "=", "0", ")", ":", "if", "not", "_isreal", "(", "value", ")", ":", "raise", "RuntimeError", "(", "\"Argument `value` is not valid\"", ")", "if", "not", "_isreal", "(", "offset", ")", ":", "...
r""" Scale a value to the range defined by a series. :param value: Value to normalize :type value: number :param series: List of numbers that defines the normalization range :type series: list :param offset: Normalization offset, i.e. the returned value will be in the ran...
[ "r", "Scale", "a", "value", "to", "the", "range", "defined", "by", "a", "series", "." ]
dd2bb32e59eee872f1ef2db2d9921a396ab9f50b
https://github.com/pmacosta/pmisc/blob/dd2bb32e59eee872f1ef2db2d9921a396ab9f50b/pmisc/number.py#L144-L197
train
pmacosta/pmisc
pmisc/number.py
per
def per(arga, argb, prec=10): r""" Calculate percentage difference between numbers. If only two numbers are given, the percentage difference between them is computed. If two sequences of numbers are given (either two lists of numbers or Numpy vectors), the element-wise percentage difference is ...
python
def per(arga, argb, prec=10): r""" Calculate percentage difference between numbers. If only two numbers are given, the percentage difference between them is computed. If two sequences of numbers are given (either two lists of numbers or Numpy vectors), the element-wise percentage difference is ...
[ "def", "per", "(", "arga", ",", "argb", ",", "prec", "=", "10", ")", ":", "# pylint: disable=C0103,C0200,E1101,R0204", "if", "not", "isinstance", "(", "prec", ",", "int", ")", ":", "raise", "RuntimeError", "(", "\"Argument `prec` is not valid\"", ")", "a_type", ...
r""" Calculate percentage difference between numbers. If only two numbers are given, the percentage difference between them is computed. If two sequences of numbers are given (either two lists of numbers or Numpy vectors), the element-wise percentage difference is computed. If any of the numbers in...
[ "r", "Calculate", "percentage", "difference", "between", "numbers", "." ]
dd2bb32e59eee872f1ef2db2d9921a396ab9f50b
https://github.com/pmacosta/pmisc/blob/dd2bb32e59eee872f1ef2db2d9921a396ab9f50b/pmisc/number.py#L200-L274
train
pmacosta/pmisc
pmisc/number.py
pgcd
def pgcd(numa, numb): """ Calculate the greatest common divisor (GCD) of two numbers. :param numa: First number :type numa: number :param numb: Second number :type numb: number :rtype: number For example: >>> import pmisc, fractions >>> pmisc.pgcd(10, 15) 5...
python
def pgcd(numa, numb): """ Calculate the greatest common divisor (GCD) of two numbers. :param numa: First number :type numa: number :param numb: Second number :type numb: number :rtype: number For example: >>> import pmisc, fractions >>> pmisc.pgcd(10, 15) 5...
[ "def", "pgcd", "(", "numa", ",", "numb", ")", ":", "# Test for integers this way to be valid also for Numpy data types without", "# actually importing (and package depending on) Numpy", "int_args", "=", "(", "int", "(", "numa", ")", "==", "numa", ")", "and", "(", "int", ...
Calculate the greatest common divisor (GCD) of two numbers. :param numa: First number :type numa: number :param numb: Second number :type numb: number :rtype: number For example: >>> import pmisc, fractions >>> pmisc.pgcd(10, 15) 5 >>> str(pmisc.pgcd(0.05, ...
[ "Calculate", "the", "greatest", "common", "divisor", "(", "GCD", ")", "of", "two", "numbers", "." ]
dd2bb32e59eee872f1ef2db2d9921a396ab9f50b
https://github.com/pmacosta/pmisc/blob/dd2bb32e59eee872f1ef2db2d9921a396ab9f50b/pmisc/number.py#L277-L329
train
RobotStudio/bors
bors/api/websock.py
SockMixin.connect_ws
def connect_ws(self, post_connect_callback, channels, reconnect=False): """ Connect to a websocket :channels: List of SockChannel instances """ self.post_conn_cb = post_connect_callback self.channels = channels self.wsendpoint = self.context["conf"]["endpoints"]....
python
def connect_ws(self, post_connect_callback, channels, reconnect=False): """ Connect to a websocket :channels: List of SockChannel instances """ self.post_conn_cb = post_connect_callback self.channels = channels self.wsendpoint = self.context["conf"]["endpoints"]....
[ "def", "connect_ws", "(", "self", ",", "post_connect_callback", ",", "channels", ",", "reconnect", "=", "False", ")", ":", "self", ".", "post_conn_cb", "=", "post_connect_callback", "self", ".", "channels", "=", "channels", "self", ".", "wsendpoint", "=", "sel...
Connect to a websocket :channels: List of SockChannel instances
[ "Connect", "to", "a", "websocket", ":", "channels", ":", "List", "of", "SockChannel", "instances" ]
38bf338fc6905d90819faa56bd832140116720f0
https://github.com/RobotStudio/bors/blob/38bf338fc6905d90819faa56bd832140116720f0/bors/api/websock.py#L10-L29
train
RobotStudio/bors
bors/api/websock.py
SockMixin.wscall
def wscall(self, method, query=None, callback=None): """Submit a request on the websocket""" if callback is None: self.sock.emit(method, query) else: self.sock.emitack(method, query, callback)
python
def wscall(self, method, query=None, callback=None): """Submit a request on the websocket""" if callback is None: self.sock.emit(method, query) else: self.sock.emitack(method, query, callback)
[ "def", "wscall", "(", "self", ",", "method", ",", "query", "=", "None", ",", "callback", "=", "None", ")", ":", "if", "callback", "is", "None", ":", "self", ".", "sock", ".", "emit", "(", "method", ",", "query", ")", "else", ":", "self", ".", "so...
Submit a request on the websocket
[ "Submit", "a", "request", "on", "the", "websocket" ]
38bf338fc6905d90819faa56bd832140116720f0
https://github.com/RobotStudio/bors/blob/38bf338fc6905d90819faa56bd832140116720f0/bors/api/websock.py#L38-L43
train
RobotStudio/bors
bors/api/websock.py
SockMixin.connect_channels
def connect_channels(self, channels): """Connect the provided channels""" self.log.info(f"Connecting to channels...") for chan in channels: chan.connect(self.sock) self.log.info(f"\t{chan.channel}")
python
def connect_channels(self, channels): """Connect the provided channels""" self.log.info(f"Connecting to channels...") for chan in channels: chan.connect(self.sock) self.log.info(f"\t{chan.channel}")
[ "def", "connect_channels", "(", "self", ",", "channels", ")", ":", "self", ".", "log", ".", "info", "(", "f\"Connecting to channels...\"", ")", "for", "chan", "in", "channels", ":", "chan", ".", "connect", "(", "self", ".", "sock", ")", "self", ".", "log...
Connect the provided channels
[ "Connect", "the", "provided", "channels" ]
38bf338fc6905d90819faa56bd832140116720f0
https://github.com/RobotStudio/bors/blob/38bf338fc6905d90819faa56bd832140116720f0/bors/api/websock.py#L45-L50
train
RobotStudio/bors
bors/api/websock.py
SockMixin._on_set_auth
def _on_set_auth(self, sock, token): """Set Auth request received from websocket""" self.log.info(f"Token received: {token}") sock.setAuthtoken(token)
python
def _on_set_auth(self, sock, token): """Set Auth request received from websocket""" self.log.info(f"Token received: {token}") sock.setAuthtoken(token)
[ "def", "_on_set_auth", "(", "self", ",", "sock", ",", "token", ")", ":", "self", ".", "log", ".", "info", "(", "f\"Token received: {token}\"", ")", "sock", ".", "setAuthtoken", "(", "token", ")" ]
Set Auth request received from websocket
[ "Set", "Auth", "request", "received", "from", "websocket" ]
38bf338fc6905d90819faa56bd832140116720f0
https://github.com/RobotStudio/bors/blob/38bf338fc6905d90819faa56bd832140116720f0/bors/api/websock.py#L54-L57
train
RobotStudio/bors
bors/api/websock.py
SockMixin._on_auth
def _on_auth(self, sock, authenticated): # pylint: disable=unused-argument """Message received from websocket""" def ack(eventname, error, data): # pylint: disable=unused-argument """Ack""" if error: self.log.error(f"""OnAuth: {error}""") else: ...
python
def _on_auth(self, sock, authenticated): # pylint: disable=unused-argument """Message received from websocket""" def ack(eventname, error, data): # pylint: disable=unused-argument """Ack""" if error: self.log.error(f"""OnAuth: {error}""") else: ...
[ "def", "_on_auth", "(", "self", ",", "sock", ",", "authenticated", ")", ":", "# pylint: disable=unused-argument", "def", "ack", "(", "eventname", ",", "error", ",", "data", ")", ":", "# pylint: disable=unused-argument", "\"\"\"Ack\"\"\"", "if", "error", ":", "self...
Message received from websocket
[ "Message", "received", "from", "websocket" ]
38bf338fc6905d90819faa56bd832140116720f0
https://github.com/RobotStudio/bors/blob/38bf338fc6905d90819faa56bd832140116720f0/bors/api/websock.py#L59-L69
train
RobotStudio/bors
bors/api/websock.py
SockMixin._on_connect_error
def _on_connect_error(self, sock, err): # pylint: disable=unused-argument """Error received from websocket""" if isinstance(err, SystemExit): self.log.error(f"Shutting down websocket connection") else: self.log.error(f"Websocket error: {err}")
python
def _on_connect_error(self, sock, err): # pylint: disable=unused-argument """Error received from websocket""" if isinstance(err, SystemExit): self.log.error(f"Shutting down websocket connection") else: self.log.error(f"Websocket error: {err}")
[ "def", "_on_connect_error", "(", "self", ",", "sock", ",", "err", ")", ":", "# pylint: disable=unused-argument", "if", "isinstance", "(", "err", ",", "SystemExit", ")", ":", "self", ".", "log", ".", "error", "(", "f\"Shutting down websocket connection\"", ")", "...
Error received from websocket
[ "Error", "received", "from", "websocket" ]
38bf338fc6905d90819faa56bd832140116720f0
https://github.com/RobotStudio/bors/blob/38bf338fc6905d90819faa56bd832140116720f0/bors/api/websock.py#L75-L80
train
RobotStudio/bors
bors/api/websock.py
SockChannel.connect
def connect(self, sock): """Attach a given socket to a channel""" def cbwrap(*args, **kwargs): """Callback wrapper; passes in response_type""" self.callback(self.response_type, *args, **kwargs) self.sock = sock self.sock.subscribe(self.channel) self.sock....
python
def connect(self, sock): """Attach a given socket to a channel""" def cbwrap(*args, **kwargs): """Callback wrapper; passes in response_type""" self.callback(self.response_type, *args, **kwargs) self.sock = sock self.sock.subscribe(self.channel) self.sock....
[ "def", "connect", "(", "self", ",", "sock", ")", ":", "def", "cbwrap", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "\"\"\"Callback wrapper; passes in response_type\"\"\"", "self", ".", "callback", "(", "self", ".", "response_type", ",", "*", "args",...
Attach a given socket to a channel
[ "Attach", "a", "given", "socket", "to", "a", "channel" ]
38bf338fc6905d90819faa56bd832140116720f0
https://github.com/RobotStudio/bors/blob/38bf338fc6905d90819faa56bd832140116720f0/bors/api/websock.py#L96-L104
train
theno/utlz
utlz/cmd.py
run_cmd
def run_cmd(cmd, input=None, timeout=30, max_try=3, num_try=1): '''Run command `cmd`. It's like that, and that's the way it is. ''' if type(cmd) == str: cmd = cmd.split() process = subprocess.Popen(cmd, stdin=open('/dev/null', 'r'), ...
python
def run_cmd(cmd, input=None, timeout=30, max_try=3, num_try=1): '''Run command `cmd`. It's like that, and that's the way it is. ''' if type(cmd) == str: cmd = cmd.split() process = subprocess.Popen(cmd, stdin=open('/dev/null', 'r'), ...
[ "def", "run_cmd", "(", "cmd", ",", "input", "=", "None", ",", "timeout", "=", "30", ",", "max_try", "=", "3", ",", "num_try", "=", "1", ")", ":", "if", "type", "(", "cmd", ")", "==", "str", ":", "cmd", "=", "cmd", ".", "split", "(", ")", "pro...
Run command `cmd`. It's like that, and that's the way it is.
[ "Run", "command", "cmd", "." ]
bf7d2b53f3e0d35c6f8ded81f3f774a74fcd3389
https://github.com/theno/utlz/blob/bf7d2b53f3e0d35c6f8ded81f3f774a74fcd3389/utlz/cmd.py#L22-L72
train
20c/facsimile
facsimile/cli.py
pop_first_arg
def pop_first_arg(argv): """ find first positional arg (does not start with -), take it out of array and return it separately returns (arg, array) """ for arg in argv: if not arg.startswith('-'): argv.remove(arg) return (arg, argv) return (None, argv)
python
def pop_first_arg(argv): """ find first positional arg (does not start with -), take it out of array and return it separately returns (arg, array) """ for arg in argv: if not arg.startswith('-'): argv.remove(arg) return (arg, argv) return (None, argv)
[ "def", "pop_first_arg", "(", "argv", ")", ":", "for", "arg", "in", "argv", ":", "if", "not", "arg", ".", "startswith", "(", "'-'", ")", ":", "argv", ".", "remove", "(", "arg", ")", "return", "(", "arg", ",", "argv", ")", "return", "(", "None", ",...
find first positional arg (does not start with -), take it out of array and return it separately returns (arg, array)
[ "find", "first", "positional", "arg", "(", "does", "not", "start", "with", "-", ")", "take", "it", "out", "of", "array", "and", "return", "it", "separately", "returns", "(", "arg", "array", ")" ]
570e28568475d5be1b1a2c95b8e941fbfbc167eb
https://github.com/20c/facsimile/blob/570e28568475d5be1b1a2c95b8e941fbfbc167eb/facsimile/cli.py#L110-L120
train
20c/facsimile
facsimile/cli.py
check_options
def check_options(options, parser): """ check options requirements, print and return exit value """ if not options.get('release_environment', None): print("release environment is required") parser.print_help() return os.EX_USAGE return 0
python
def check_options(options, parser): """ check options requirements, print and return exit value """ if not options.get('release_environment', None): print("release environment is required") parser.print_help() return os.EX_USAGE return 0
[ "def", "check_options", "(", "options", ",", "parser", ")", ":", "if", "not", "options", ".", "get", "(", "'release_environment'", ",", "None", ")", ":", "print", "(", "\"release environment is required\"", ")", "parser", ".", "print_help", "(", ")", "return",...
check options requirements, print and return exit value
[ "check", "options", "requirements", "print", "and", "return", "exit", "value" ]
570e28568475d5be1b1a2c95b8e941fbfbc167eb
https://github.com/20c/facsimile/blob/570e28568475d5be1b1a2c95b8e941fbfbc167eb/facsimile/cli.py#L122-L131
train
20c/facsimile
facsimile/state.py
State.write
def write(self): """ write all needed state info to filesystem """ dumped = self._fax.codec.dump(self.__state, open(self.state_file, 'w'))
python
def write(self): """ write all needed state info to filesystem """ dumped = self._fax.codec.dump(self.__state, open(self.state_file, 'w'))
[ "def", "write", "(", "self", ")", ":", "dumped", "=", "self", ".", "_fax", ".", "codec", ".", "dump", "(", "self", ".", "__state", ",", "open", "(", "self", ".", "state_file", ",", "'w'", ")", ")" ]
write all needed state info to filesystem
[ "write", "all", "needed", "state", "info", "to", "filesystem" ]
570e28568475d5be1b1a2c95b8e941fbfbc167eb
https://github.com/20c/facsimile/blob/570e28568475d5be1b1a2c95b8e941fbfbc167eb/facsimile/state.py#L200-L202
train
BlackEarth/bl
bl/config.py
package_config
def package_config(path, template='__config__.ini.TEMPLATE', config_name='__config__.ini', **params): """configure the module at the given path with a config template and file. path = the filesystem path to the given module template = the config template filename within that path ...
python
def package_config(path, template='__config__.ini.TEMPLATE', config_name='__config__.ini', **params): """configure the module at the given path with a config template and file. path = the filesystem path to the given module template = the config template filename within that path ...
[ "def", "package_config", "(", "path", ",", "template", "=", "'__config__.ini.TEMPLATE'", ",", "config_name", "=", "'__config__.ini'", ",", "*", "*", "params", ")", ":", "config_fns", "=", "[", "]", "template_fns", "=", "rglob", "(", "path", ",", "template", ...
configure the module at the given path with a config template and file. path = the filesystem path to the given module template = the config template filename within that path config_name = the config filename within that path params = a dict containing config params, ...
[ "configure", "the", "module", "at", "the", "given", "path", "with", "a", "config", "template", "and", "file", ".", "path", "=", "the", "filesystem", "path", "to", "the", "given", "module", "template", "=", "the", "config", "template", "filename", "within", ...
edf6f37dac718987260b90ad0e7f7fe084a7c1a3
https://github.com/BlackEarth/bl/blob/edf6f37dac718987260b90ad0e7f7fe084a7c1a3/bl/config.py#L154-L171
train
BlackEarth/bl
bl/config.py
Config.write
def write(self, fn=None, sorted=False, wait=0): """write the contents of this config to fn or its __filename__. """ config = ConfigParser(interpolation=None) if sorted==True: keys.sort() for key in self.__dict__.get('ordered_keys') or self.keys(): config[key] = ...
python
def write(self, fn=None, sorted=False, wait=0): """write the contents of this config to fn or its __filename__. """ config = ConfigParser(interpolation=None) if sorted==True: keys.sort() for key in self.__dict__.get('ordered_keys') or self.keys(): config[key] = ...
[ "def", "write", "(", "self", ",", "fn", "=", "None", ",", "sorted", "=", "False", ",", "wait", "=", "0", ")", ":", "config", "=", "ConfigParser", "(", "interpolation", "=", "None", ")", "if", "sorted", "==", "True", ":", "keys", ".", "sort", "(", ...
write the contents of this config to fn or its __filename__.
[ "write", "the", "contents", "of", "this", "config", "to", "fn", "or", "its", "__filename__", "." ]
edf6f37dac718987260b90ad0e7f7fe084a7c1a3
https://github.com/BlackEarth/bl/blob/edf6f37dac718987260b90ad0e7f7fe084a7c1a3/bl/config.py#L76-L103
train
BlackEarth/bl
bl/config.py
ConfigTemplate.expected_param_keys
def expected_param_keys(self): """returns a list of params that this ConfigTemplate expects to receive""" expected_keys = [] r = re.compile('%\(([^\)]+)\)s') for block in self.keys(): for key in self[block].keys(): s = self[block][key] i...
python
def expected_param_keys(self): """returns a list of params that this ConfigTemplate expects to receive""" expected_keys = [] r = re.compile('%\(([^\)]+)\)s') for block in self.keys(): for key in self[block].keys(): s = self[block][key] i...
[ "def", "expected_param_keys", "(", "self", ")", ":", "expected_keys", "=", "[", "]", "r", "=", "re", ".", "compile", "(", "'%\\(([^\\)]+)\\)s'", ")", "for", "block", "in", "self", ".", "keys", "(", ")", ":", "for", "key", "in", "self", "[", "block", ...
returns a list of params that this ConfigTemplate expects to receive
[ "returns", "a", "list", "of", "params", "that", "this", "ConfigTemplate", "expects", "to", "receive" ]
edf6f37dac718987260b90ad0e7f7fe084a7c1a3
https://github.com/BlackEarth/bl/blob/edf6f37dac718987260b90ad0e7f7fe084a7c1a3/bl/config.py#L109-L124
train
BlackEarth/bl
bl/config.py
ConfigTemplate.render
def render(self, fn=None, prompt=False, **params): """return a Config with the given params formatted via ``str.format(**params)``. fn=None : If given, will assign this filename to the rendered Config. prompt=False : If True, will prompt for any param that is None. """ ...
python
def render(self, fn=None, prompt=False, **params): """return a Config with the given params formatted via ``str.format(**params)``. fn=None : If given, will assign this filename to the rendered Config. prompt=False : If True, will prompt for any param that is None. """ ...
[ "def", "render", "(", "self", ",", "fn", "=", "None", ",", "prompt", "=", "False", ",", "*", "*", "params", ")", ":", "from", "getpass", "import", "getpass", "expected_keys", "=", "self", ".", "expected_param_keys", "(", ")", "compiled_params", "=", "Dic...
return a Config with the given params formatted via ``str.format(**params)``. fn=None : If given, will assign this filename to the rendered Config. prompt=False : If True, will prompt for any param that is None.
[ "return", "a", "Config", "with", "the", "given", "params", "formatted", "via", "str", ".", "format", "(", "**", "params", ")", ".", "fn", "=", "None", ":", "If", "given", "will", "assign", "this", "filename", "to", "the", "rendered", "Config", ".", "pr...
edf6f37dac718987260b90ad0e7f7fe084a7c1a3
https://github.com/BlackEarth/bl/blob/edf6f37dac718987260b90ad0e7f7fe084a7c1a3/bl/config.py#L126-L152
train
willkg/socorro-siggen
siggen/cmd_fetch_data.py
main
def main(): """Takes a crash id, pulls down data from Socorro, generates signature data""" parser = argparse.ArgumentParser( formatter_class=WrappedTextHelpFormatter, description=DESCRIPTION ) parser.add_argument( '-v', '--verbose', help='increase output verbosity', action='store...
python
def main(): """Takes a crash id, pulls down data from Socorro, generates signature data""" parser = argparse.ArgumentParser( formatter_class=WrappedTextHelpFormatter, description=DESCRIPTION ) parser.add_argument( '-v', '--verbose', help='increase output verbosity', action='store...
[ "def", "main", "(", ")", ":", "parser", "=", "argparse", ".", "ArgumentParser", "(", "formatter_class", "=", "WrappedTextHelpFormatter", ",", "description", "=", "DESCRIPTION", ")", "parser", ".", "add_argument", "(", "'-v'", ",", "'--verbose'", ",", "help", "...
Takes a crash id, pulls down data from Socorro, generates signature data
[ "Takes", "a", "crash", "id", "pulls", "down", "data", "from", "Socorro", "generates", "signature", "data" ]
db7e3233e665a458a961c48da22e93a69b1d08d6
https://github.com/willkg/socorro-siggen/blob/db7e3233e665a458a961c48da22e93a69b1d08d6/siggen/cmd_fetch_data.py#L73-L136
train
willkg/socorro-siggen
siggen/cmd_fetch_data.py
WrappedTextHelpFormatter._fill_text
def _fill_text(self, text, width, indent): """Wraps text like HelpFormatter, but doesn't squash lines This makes it easier to do lists and paragraphs. """ parts = text.split('\n\n') for i, part in enumerate(parts): # Check to see if it's a bulleted list--if so, then...
python
def _fill_text(self, text, width, indent): """Wraps text like HelpFormatter, but doesn't squash lines This makes it easier to do lists and paragraphs. """ parts = text.split('\n\n') for i, part in enumerate(parts): # Check to see if it's a bulleted list--if so, then...
[ "def", "_fill_text", "(", "self", ",", "text", ",", "width", ",", "indent", ")", ":", "parts", "=", "text", ".", "split", "(", "'\\n\\n'", ")", "for", "i", ",", "part", "in", "enumerate", "(", "parts", ")", ":", "# Check to see if it's a bulleted list--if ...
Wraps text like HelpFormatter, but doesn't squash lines This makes it easier to do lists and paragraphs.
[ "Wraps", "text", "like", "HelpFormatter", "but", "doesn", "t", "squash", "lines" ]
db7e3233e665a458a961c48da22e93a69b1d08d6
https://github.com/willkg/socorro-siggen/blob/db7e3233e665a458a961c48da22e93a69b1d08d6/siggen/cmd_fetch_data.py#L20-L39
train
RobotStudio/bors
bors/app/config.py
AppConf.get_api_services_by_name
def get_api_services_by_name(self): """Return a dict of services by name""" if not self.services_by_name: self.services_by_name = dict({s.get('name'): s for s in self.conf .get("api") .get("services")}) ...
python
def get_api_services_by_name(self): """Return a dict of services by name""" if not self.services_by_name: self.services_by_name = dict({s.get('name'): s for s in self.conf .get("api") .get("services")}) ...
[ "def", "get_api_services_by_name", "(", "self", ")", ":", "if", "not", "self", ".", "services_by_name", ":", "self", ".", "services_by_name", "=", "dict", "(", "{", "s", ".", "get", "(", "'name'", ")", ":", "s", "for", "s", "in", "self", ".", "conf", ...
Return a dict of services by name
[ "Return", "a", "dict", "of", "services", "by", "name" ]
38bf338fc6905d90819faa56bd832140116720f0
https://github.com/RobotStudio/bors/blob/38bf338fc6905d90819faa56bd832140116720f0/bors/app/config.py#L37-L43
train
RobotStudio/bors
bors/app/config.py
AppConf.get_api_endpoints
def get_api_endpoints(self, apiname): """Returns the API endpoints""" try: return self.services_by_name\ .get(apiname)\ .get("endpoints")\ .copy() except AttributeError: raise Exception(f"Couldn't find the API en...
python
def get_api_endpoints(self, apiname): """Returns the API endpoints""" try: return self.services_by_name\ .get(apiname)\ .get("endpoints")\ .copy() except AttributeError: raise Exception(f"Couldn't find the API en...
[ "def", "get_api_endpoints", "(", "self", ",", "apiname", ")", ":", "try", ":", "return", "self", ".", "services_by_name", ".", "get", "(", "apiname", ")", ".", "get", "(", "\"endpoints\"", ")", ".", "copy", "(", ")", "except", "AttributeError", ":", "rai...
Returns the API endpoints
[ "Returns", "the", "API", "endpoints" ]
38bf338fc6905d90819faa56bd832140116720f0
https://github.com/RobotStudio/bors/blob/38bf338fc6905d90819faa56bd832140116720f0/bors/app/config.py#L49-L57
train
RobotStudio/bors
bors/app/config.py
AppConf.get_ws_subscriptions
def get_ws_subscriptions(self, apiname): """Returns the websocket subscriptions""" try: return self.services_by_name\ .get(apiname)\ .get("subscriptions")\ .copy() except AttributeError: raise Exception(f"Couldn'...
python
def get_ws_subscriptions(self, apiname): """Returns the websocket subscriptions""" try: return self.services_by_name\ .get(apiname)\ .get("subscriptions")\ .copy() except AttributeError: raise Exception(f"Couldn'...
[ "def", "get_ws_subscriptions", "(", "self", ",", "apiname", ")", ":", "try", ":", "return", "self", ".", "services_by_name", ".", "get", "(", "apiname", ")", ".", "get", "(", "\"subscriptions\"", ")", ".", "copy", "(", ")", "except", "AttributeError", ":",...
Returns the websocket subscriptions
[ "Returns", "the", "websocket", "subscriptions" ]
38bf338fc6905d90819faa56bd832140116720f0
https://github.com/RobotStudio/bors/blob/38bf338fc6905d90819faa56bd832140116720f0/bors/app/config.py#L59-L67
train
RobotStudio/bors
bors/app/config.py
AppConf.get_api
def get_api(self, name=None): """Returns the API configuration""" if name is None: try: return self.conf.get("api").copy() except: # NOQA raise Exception(f"Couldn't find the API configuration")
python
def get_api(self, name=None): """Returns the API configuration""" if name is None: try: return self.conf.get("api").copy() except: # NOQA raise Exception(f"Couldn't find the API configuration")
[ "def", "get_api", "(", "self", ",", "name", "=", "None", ")", ":", "if", "name", "is", "None", ":", "try", ":", "return", "self", ".", "conf", ".", "get", "(", "\"api\"", ")", ".", "copy", "(", ")", "except", ":", "# NOQA", "raise", "Exception", ...
Returns the API configuration
[ "Returns", "the", "API", "configuration" ]
38bf338fc6905d90819faa56bd832140116720f0
https://github.com/RobotStudio/bors/blob/38bf338fc6905d90819faa56bd832140116720f0/bors/app/config.py#L76-L82
train
RobotStudio/bors
bors/app/config.py
AppConf.get_api_service
def get_api_service(self, name=None): """Returns the specific service config definition""" try: svc = self.services_by_name.get(name, None) if svc is None: raise ValueError(f"Couldn't find the API service configuration") return svc except: # N...
python
def get_api_service(self, name=None): """Returns the specific service config definition""" try: svc = self.services_by_name.get(name, None) if svc is None: raise ValueError(f"Couldn't find the API service configuration") return svc except: # N...
[ "def", "get_api_service", "(", "self", ",", "name", "=", "None", ")", ":", "try", ":", "svc", "=", "self", ".", "services_by_name", ".", "get", "(", "name", ",", "None", ")", "if", "svc", "is", "None", ":", "raise", "ValueError", "(", "f\"Couldn't find...
Returns the specific service config definition
[ "Returns", "the", "specific", "service", "config", "definition" ]
38bf338fc6905d90819faa56bd832140116720f0
https://github.com/RobotStudio/bors/blob/38bf338fc6905d90819faa56bd832140116720f0/bors/app/config.py#L84-L92
train
pmacosta/pmisc
pmisc/compat2.py
_ex_type_str
def _ex_type_str(exobj): """Return a string corresponding to the exception type.""" regexp = re.compile(r"<(?:\bclass\b|\btype\b)\s+'?([\w|\.]+)'?>") exc_type = str(exobj) if regexp.match(exc_type): exc_type = regexp.match(exc_type).groups()[0] exc_type = exc_type[11:] if exc_type.starts...
python
def _ex_type_str(exobj): """Return a string corresponding to the exception type.""" regexp = re.compile(r"<(?:\bclass\b|\btype\b)\s+'?([\w|\.]+)'?>") exc_type = str(exobj) if regexp.match(exc_type): exc_type = regexp.match(exc_type).groups()[0] exc_type = exc_type[11:] if exc_type.starts...
[ "def", "_ex_type_str", "(", "exobj", ")", ":", "regexp", "=", "re", ".", "compile", "(", "r\"<(?:\\bclass\\b|\\btype\\b)\\s+'?([\\w|\\.]+)'?>\"", ")", "exc_type", "=", "str", "(", "exobj", ")", "if", "regexp", ".", "match", "(", "exc_type", ")", ":", "exc_type...
Return a string corresponding to the exception type.
[ "Return", "a", "string", "corresponding", "to", "the", "exception", "type", "." ]
dd2bb32e59eee872f1ef2db2d9921a396ab9f50b
https://github.com/pmacosta/pmisc/blob/dd2bb32e59eee872f1ef2db2d9921a396ab9f50b/pmisc/compat2.py#L13-L22
train
pmacosta/pmisc
pmisc/compat2.py
_unicode_to_ascii
def _unicode_to_ascii(obj): # pragma: no cover """Convert to ASCII.""" # pylint: disable=E0602,R1717 if isinstance(obj, dict): return dict( [ (_unicode_to_ascii(key), _unicode_to_ascii(value)) for key, value in obj.items() ] ) if i...
python
def _unicode_to_ascii(obj): # pragma: no cover """Convert to ASCII.""" # pylint: disable=E0602,R1717 if isinstance(obj, dict): return dict( [ (_unicode_to_ascii(key), _unicode_to_ascii(value)) for key, value in obj.items() ] ) if i...
[ "def", "_unicode_to_ascii", "(", "obj", ")", ":", "# pragma: no cover", "# pylint: disable=E0602,R1717", "if", "isinstance", "(", "obj", ",", "dict", ")", ":", "return", "dict", "(", "[", "(", "_unicode_to_ascii", "(", "key", ")", ",", "_unicode_to_ascii", "(", ...
Convert to ASCII.
[ "Convert", "to", "ASCII", "." ]
dd2bb32e59eee872f1ef2db2d9921a396ab9f50b
https://github.com/pmacosta/pmisc/blob/dd2bb32e59eee872f1ef2db2d9921a396ab9f50b/pmisc/compat2.py#L39-L53
train
Eyepea/tanto
monitoring_agent/outputs/nsca.py
Nsca.send_result
def send_result(self, return_code, output, service_description='', specific_servers=None): ''' Send results ''' if specific_servers == None: specific_servers = self.servers else: specific_servers = set(self.servers).intersection(specific_servers) ...
python
def send_result(self, return_code, output, service_description='', specific_servers=None): ''' Send results ''' if specific_servers == None: specific_servers = self.servers else: specific_servers = set(self.servers).intersection(specific_servers) ...
[ "def", "send_result", "(", "self", ",", "return_code", ",", "output", ",", "service_description", "=", "''", ",", "specific_servers", "=", "None", ")", ":", "if", "specific_servers", "==", "None", ":", "specific_servers", "=", "self", ".", "servers", "else", ...
Send results
[ "Send", "results" ]
ad8fd32e0fd3b7bc3dee5dabb984a2567ae46fe9
https://github.com/Eyepea/tanto/blob/ad8fd32e0fd3b7bc3dee5dabb984a2567ae46fe9/monitoring_agent/outputs/nsca.py#L37-L58
train
RockFeng0/rtsf-web
webuidriver/remote/SeleniumHatch.py
SeleniumHatch.get_remote_executors
def get_remote_executors(hub_ip, port = 4444): ''' Get remote hosts from Selenium Grid Hub Console @param hub_ip: hub ip of selenium grid hub @param port: hub port of selenium grid hub ''' resp = requests.get("http://%s:%s/grid/console" %(hub_ip, port)) re...
python
def get_remote_executors(hub_ip, port = 4444): ''' Get remote hosts from Selenium Grid Hub Console @param hub_ip: hub ip of selenium grid hub @param port: hub port of selenium grid hub ''' resp = requests.get("http://%s:%s/grid/console" %(hub_ip, port)) re...
[ "def", "get_remote_executors", "(", "hub_ip", ",", "port", "=", "4444", ")", ":", "resp", "=", "requests", ".", "get", "(", "\"http://%s:%s/grid/console\"", "%", "(", "hub_ip", ",", "port", ")", ")", "remote_hosts", "=", "(", ")", "if", "resp", ".", "sta...
Get remote hosts from Selenium Grid Hub Console @param hub_ip: hub ip of selenium grid hub @param port: hub port of selenium grid hub
[ "Get", "remote", "hosts", "from", "Selenium", "Grid", "Hub", "Console" ]
ceabcf62ddf1c969a97b5c7a4a4c547198b6ea71
https://github.com/RockFeng0/rtsf-web/blob/ceabcf62ddf1c969a97b5c7a4a4c547198b6ea71/webuidriver/remote/SeleniumHatch.py#L30-L40
train
RockFeng0/rtsf-web
webuidriver/remote/SeleniumHatch.py
SeleniumHatch.gen_remote_driver
def gen_remote_driver(executor, capabilities): ''' Generate remote drivers with desired capabilities(self.__caps) and command_executor @param executor: command executor for selenium remote driver @param capabilities: A dictionary of capabilities to request when starting the browser session. ...
python
def gen_remote_driver(executor, capabilities): ''' Generate remote drivers with desired capabilities(self.__caps) and command_executor @param executor: command executor for selenium remote driver @param capabilities: A dictionary of capabilities to request when starting the browser session. ...
[ "def", "gen_remote_driver", "(", "executor", ",", "capabilities", ")", ":", "# selenium requires browser's driver and PATH env. Firefox's driver is required for selenium3.0 \r", "firefox_profile", "=", "capabilities", ".", "pop", "(", "\"firefox_profile\"", ",", "None", ...
Generate remote drivers with desired capabilities(self.__caps) and command_executor @param executor: command executor for selenium remote driver @param capabilities: A dictionary of capabilities to request when starting the browser session. @return: remote driver
[ "Generate", "remote", "drivers", "with", "desired", "capabilities", "(", "self", ".", "__caps", ")", "and", "command_executor" ]
ceabcf62ddf1c969a97b5c7a4a4c547198b6ea71
https://github.com/RockFeng0/rtsf-web/blob/ceabcf62ddf1c969a97b5c7a4a4c547198b6ea71/webuidriver/remote/SeleniumHatch.py#L74-L82
train
RockFeng0/rtsf-web
webuidriver/remote/SeleniumHatch.py
SeleniumHatch.gen_local_driver
def gen_local_driver(browser, capabilities): ''' Generate localhost drivers with desired capabilities(self.__caps) @param browser: firefox or chrome @param capabilities: A dictionary of capabilities to request when starting the browser session. @return: localhost driver '...
python
def gen_local_driver(browser, capabilities): ''' Generate localhost drivers with desired capabilities(self.__caps) @param browser: firefox or chrome @param capabilities: A dictionary of capabilities to request when starting the browser session. @return: localhost driver '...
[ "def", "gen_local_driver", "(", "browser", ",", "capabilities", ")", ":", "if", "browser", "==", "\"firefox\"", ":", "fp", "=", "capabilities", ".", "pop", "(", "\"firefox_profile\"", ",", "None", ")", "return", "webdriver", ".", "Firefox", "(", "desired_capab...
Generate localhost drivers with desired capabilities(self.__caps) @param browser: firefox or chrome @param capabilities: A dictionary of capabilities to request when starting the browser session. @return: localhost driver
[ "Generate", "localhost", "drivers", "with", "desired", "capabilities", "(", "self", ".", "__caps", ")" ]
ceabcf62ddf1c969a97b5c7a4a4c547198b6ea71
https://github.com/RockFeng0/rtsf-web/blob/ceabcf62ddf1c969a97b5c7a4a4c547198b6ea71/webuidriver/remote/SeleniumHatch.py#L85-L99
train
blackleg/ree
ree/response/response.py
Response._production
def _production(self): """Calculate total energy production. Not rounded""" return self._nuclear + self._diesel + self._gas + self._wind + self._combined + self._vapor + self._solar + self._hydraulic + self._carbon + self._waste + self._other
python
def _production(self): """Calculate total energy production. Not rounded""" return self._nuclear + self._diesel + self._gas + self._wind + self._combined + self._vapor + self._solar + self._hydraulic + self._carbon + self._waste + self._other
[ "def", "_production", "(", "self", ")", ":", "return", "self", ".", "_nuclear", "+", "self", ".", "_diesel", "+", "self", ".", "_gas", "+", "self", ".", "_wind", "+", "self", ".", "_combined", "+", "self", ".", "_vapor", "+", "self", ".", "_solar", ...
Calculate total energy production. Not rounded
[ "Calculate", "total", "energy", "production", ".", "Not", "rounded" ]
94142571db0b5a39affe974184ff266135423645
https://github.com/blackleg/ree/blob/94142571db0b5a39affe974184ff266135423645/ree/response/response.py#L137-L139
train
blackleg/ree
ree/response/response.py
Response._links
def _links(self): """Calculate total energy production. Not Rounded""" total = 0.0 for value in self.link.values(): total += value return total
python
def _links(self): """Calculate total energy production. Not Rounded""" total = 0.0 for value in self.link.values(): total += value return total
[ "def", "_links", "(", "self", ")", ":", "total", "=", "0.0", "for", "value", "in", "self", ".", "link", ".", "values", "(", ")", ":", "total", "+=", "value", "return", "total" ]
Calculate total energy production. Not Rounded
[ "Calculate", "total", "energy", "production", ".", "Not", "Rounded" ]
94142571db0b5a39affe974184ff266135423645
https://github.com/blackleg/ree/blob/94142571db0b5a39affe974184ff266135423645/ree/response/response.py#L145-L150
train
JohnDoee/thomas
thomas/__main__.py
query_yes_no
def query_yes_no(question, default="yes"): """Ask a yes/no question via raw_input() and return their answer. "question" is a string that is presented to the user. "default" is the presumed answer if the user just hits <Enter>. It must be "yes" (the default), "no" or None (meaning an answer i...
python
def query_yes_no(question, default="yes"): """Ask a yes/no question via raw_input() and return their answer. "question" is a string that is presented to the user. "default" is the presumed answer if the user just hits <Enter>. It must be "yes" (the default), "no" or None (meaning an answer i...
[ "def", "query_yes_no", "(", "question", ",", "default", "=", "\"yes\"", ")", ":", "valid", "=", "{", "\"yes\"", ":", "True", ",", "\"y\"", ":", "True", ",", "\"ye\"", ":", "True", ",", "\"no\"", ":", "False", ",", "\"n\"", ":", "False", "}", "if", ...
Ask a yes/no question via raw_input() and return their answer. "question" is a string that is presented to the user. "default" is the presumed answer if the user just hits <Enter>. It must be "yes" (the default), "no" or None (meaning an answer is required of the user). The "answer" return v...
[ "Ask", "a", "yes", "/", "no", "question", "via", "raw_input", "()", "and", "return", "their", "answer", ".", "question", "is", "a", "string", "that", "is", "presented", "to", "the", "user", ".", "default", "is", "the", "presumed", "answer", "if", "the", ...
51916dd110098b189a1c2fbcb71794fd9ec94832
https://github.com/JohnDoee/thomas/blob/51916dd110098b189a1c2fbcb71794fd9ec94832/thomas/__main__.py#L15-L42
train
greenelab/django-genes
genes/models.py
Gene.wall_of_name
def wall_of_name(self): ''' Appends identifiers for the different databases (such as Entrez id's) and returns them. Uses the CrossRef class below. ''' names = [] if self.standard_name: names.append(self.standard_name) if self.systematic_name: ...
python
def wall_of_name(self): ''' Appends identifiers for the different databases (such as Entrez id's) and returns them. Uses the CrossRef class below. ''' names = [] if self.standard_name: names.append(self.standard_name) if self.systematic_name: ...
[ "def", "wall_of_name", "(", "self", ")", ":", "names", "=", "[", "]", "if", "self", ".", "standard_name", ":", "names", ".", "append", "(", "self", ".", "standard_name", ")", "if", "self", ".", "systematic_name", ":", "names", ".", "append", "(", "self...
Appends identifiers for the different databases (such as Entrez id's) and returns them. Uses the CrossRef class below.
[ "Appends", "identifiers", "for", "the", "different", "databases", "(", "such", "as", "Entrez", "id", "s", ")", "and", "returns", "them", ".", "Uses", "the", "CrossRef", "class", "below", "." ]
298939adcb115031acfc11cfcef60ea0b596fae5
https://github.com/greenelab/django-genes/blob/298939adcb115031acfc11cfcef60ea0b596fae5/genes/models.py#L51-L68
train
greenelab/django-genes
genes/models.py
Gene.save
def save(self, *args, **kwargs): """ Override save() method to make sure that standard_name and systematic_name won't be null or empty, or consist of only space characters (such as space, tab, new line, etc). """ empty_std_name = False if not self.standard_name or...
python
def save(self, *args, **kwargs): """ Override save() method to make sure that standard_name and systematic_name won't be null or empty, or consist of only space characters (such as space, tab, new line, etc). """ empty_std_name = False if not self.standard_name or...
[ "def", "save", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "empty_std_name", "=", "False", "if", "not", "self", ".", "standard_name", "or", "self", ".", "standard_name", ".", "isspace", "(", ")", ":", "empty_std_name", "=", "True"...
Override save() method to make sure that standard_name and systematic_name won't be null or empty, or consist of only space characters (such as space, tab, new line, etc).
[ "Override", "save", "()", "method", "to", "make", "sure", "that", "standard_name", "and", "systematic_name", "won", "t", "be", "null", "or", "empty", "or", "consist", "of", "only", "space", "characters", "(", "such", "as", "space", "tab", "new", "line", "e...
298939adcb115031acfc11cfcef60ea0b596fae5
https://github.com/greenelab/django-genes/blob/298939adcb115031acfc11cfcef60ea0b596fae5/genes/models.py#L70-L88
train
greenelab/django-genes
genes/models.py
CrossRefDB.save
def save(self, *args, **kwargs): """ Extends save() method of Django models to check that the database name is not left blank. Note: 'blank=False' is only checked at a form-validation-stage. A test using Fixtureless that tries to randomly create a CrossRefDB with an empty...
python
def save(self, *args, **kwargs): """ Extends save() method of Django models to check that the database name is not left blank. Note: 'blank=False' is only checked at a form-validation-stage. A test using Fixtureless that tries to randomly create a CrossRefDB with an empty...
[ "def", "save", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "self", ".", "name", "==", "''", ":", "raise", "FieldError", "else", ":", "return", "super", "(", "CrossRefDB", ",", "self", ")", ".", "save", "(", "*", "args"...
Extends save() method of Django models to check that the database name is not left blank. Note: 'blank=False' is only checked at a form-validation-stage. A test using Fixtureless that tries to randomly create a CrossRefDB with an empty string name would unintentionally break the test.
[ "Extends", "save", "()", "method", "of", "Django", "models", "to", "check", "that", "the", "database", "name", "is", "not", "left", "blank", ".", "Note", ":", "blank", "=", "False", "is", "only", "checked", "at", "a", "form", "-", "validation", "-", "s...
298939adcb115031acfc11cfcef60ea0b596fae5
https://github.com/greenelab/django-genes/blob/298939adcb115031acfc11cfcef60ea0b596fae5/genes/models.py#L96-L107
train
JohnDoee/thomas
thomas/outputs/http.py
FilelikeObjectResource.makeProducer
def makeProducer(self, request, fileForReading): """ Make a L{StaticProducer} that will produce the body of this response. This method will also set the response code and Content-* headers. @param request: The L{Request} object. @param fileForReading: The file object containing...
python
def makeProducer(self, request, fileForReading): """ Make a L{StaticProducer} that will produce the body of this response. This method will also set the response code and Content-* headers. @param request: The L{Request} object. @param fileForReading: The file object containing...
[ "def", "makeProducer", "(", "self", ",", "request", ",", "fileForReading", ")", ":", "byteRange", "=", "request", ".", "getHeader", "(", "b'range'", ")", "if", "byteRange", "is", "None", "or", "not", "self", ".", "getFileSize", "(", ")", ":", "self", "."...
Make a L{StaticProducer} that will produce the body of this response. This method will also set the response code and Content-* headers. @param request: The L{Request} object. @param fileForReading: The file object containing the resource. @return: A L{StaticProducer}. Calling C{.star...
[ "Make", "a", "L", "{", "StaticProducer", "}", "that", "will", "produce", "the", "body", "of", "this", "response", "." ]
51916dd110098b189a1c2fbcb71794fd9ec94832
https://github.com/JohnDoee/thomas/blob/51916dd110098b189a1c2fbcb71794fd9ec94832/thomas/outputs/http.py#L278-L311
train
JohnDoee/thomas
thomas/outputs/http.py
FilelikeObjectResource.render_GET
def render_GET(self, request): """ Begin sending the contents of this L{File} (or a subset of the contents, based on the 'range' header) to the given request. """ request.setHeader(b'accept-ranges', b'bytes') producer = self.makeProducer(request, self.fileObject) ...
python
def render_GET(self, request): """ Begin sending the contents of this L{File} (or a subset of the contents, based on the 'range' header) to the given request. """ request.setHeader(b'accept-ranges', b'bytes') producer = self.makeProducer(request, self.fileObject) ...
[ "def", "render_GET", "(", "self", ",", "request", ")", ":", "request", ".", "setHeader", "(", "b'accept-ranges'", ",", "b'bytes'", ")", "producer", "=", "self", ".", "makeProducer", "(", "request", ",", "self", ".", "fileObject", ")", "if", "request", ".",...
Begin sending the contents of this L{File} (or a subset of the contents, based on the 'range' header) to the given request.
[ "Begin", "sending", "the", "contents", "of", "this", "L", "{", "File", "}", "(", "or", "a", "subset", "of", "the", "contents", "based", "on", "the", "range", "header", ")", "to", "the", "given", "request", "." ]
51916dd110098b189a1c2fbcb71794fd9ec94832
https://github.com/JohnDoee/thomas/blob/51916dd110098b189a1c2fbcb71794fd9ec94832/thomas/outputs/http.py#L316-L334
train
RobotStudio/bors
bors/api/product.py
ApiProduct.interface
def interface(self, context): """Implement the interface for the adapter object""" self.context = context self.callback = self.context.get("callback")
python
def interface(self, context): """Implement the interface for the adapter object""" self.context = context self.callback = self.context.get("callback")
[ "def", "interface", "(", "self", ",", "context", ")", ":", "self", ".", "context", "=", "context", "self", ".", "callback", "=", "self", ".", "context", ".", "get", "(", "\"callback\"", ")" ]
Implement the interface for the adapter object
[ "Implement", "the", "interface", "for", "the", "adapter", "object" ]
38bf338fc6905d90819faa56bd832140116720f0
https://github.com/RobotStudio/bors/blob/38bf338fc6905d90819faa56bd832140116720f0/bors/api/product.py#L18-L21
train
RobotStudio/bors
bors/api/product.py
ApiProduct.shutdown
def shutdown(self): """Executed on shutdown of application""" self.stopped.set() if hasattr(self.api, "shutdown"): self.api.shutdown() for thread in self.thread.values(): thread.join()
python
def shutdown(self): """Executed on shutdown of application""" self.stopped.set() if hasattr(self.api, "shutdown"): self.api.shutdown() for thread in self.thread.values(): thread.join()
[ "def", "shutdown", "(", "self", ")", ":", "self", ".", "stopped", ".", "set", "(", ")", "if", "hasattr", "(", "self", ".", "api", ",", "\"shutdown\"", ")", ":", "self", ".", "api", ".", "shutdown", "(", ")", "for", "thread", "in", "self", ".", "t...
Executed on shutdown of application
[ "Executed", "on", "shutdown", "of", "application" ]
38bf338fc6905d90819faa56bd832140116720f0
https://github.com/RobotStudio/bors/blob/38bf338fc6905d90819faa56bd832140116720f0/bors/api/product.py#L23-L31
train
RockFeng0/rtsf-web
webuidriver/actions.py
Web.SwitchToAlert
def SwitchToAlert(): ''' <input value="Test" type="button" onClick="alert('OK')" > ''' try: alert = WebDriverWait(Web.driver, 10).until(lambda driver: driver.switch_to_alert()) return alert except: print("Waring: Time...
python
def SwitchToAlert(): ''' <input value="Test" type="button" onClick="alert('OK')" > ''' try: alert = WebDriverWait(Web.driver, 10).until(lambda driver: driver.switch_to_alert()) return alert except: print("Waring: Time...
[ "def", "SwitchToAlert", "(", ")", ":", "try", ":", "alert", "=", "WebDriverWait", "(", "Web", ".", "driver", ",", "10", ")", ".", "until", "(", "lambda", "driver", ":", "driver", ".", "switch_to_alert", "(", ")", ")", "return", "alert", "except", ":", ...
<input value="Test" type="button" onClick="alert('OK')" >
[ "<input", "value", "=", "Test", "type", "=", "button", "onClick", "=", "alert", "(", "OK", ")", ">" ]
ceabcf62ddf1c969a97b5c7a4a4c547198b6ea71
https://github.com/RockFeng0/rtsf-web/blob/ceabcf62ddf1c969a97b5c7a4a4c547198b6ea71/webuidriver/actions.py#L118-L125
train
RockFeng0/rtsf-web
webuidriver/actions.py
WebElement._element
def _element(cls): ''' find the element with controls ''' if not cls.__is_selector(): raise Exception("Invalid selector[%s]." %cls.__control["by"]) driver = Web.driver try: elements = WebDriverWait(driver, cls.__control["timeout"]).un...
python
def _element(cls): ''' find the element with controls ''' if not cls.__is_selector(): raise Exception("Invalid selector[%s]." %cls.__control["by"]) driver = Web.driver try: elements = WebDriverWait(driver, cls.__control["timeout"]).un...
[ "def", "_element", "(", "cls", ")", ":", "if", "not", "cls", ".", "__is_selector", "(", ")", ":", "raise", "Exception", "(", "\"Invalid selector[%s].\"", "%", "cls", ".", "__control", "[", "\"by\"", "]", ")", "driver", "=", "Web", ".", "driver", "try", ...
find the element with controls
[ "find", "the", "element", "with", "controls" ]
ceabcf62ddf1c969a97b5c7a4a4c547198b6ea71
https://github.com/RockFeng0/rtsf-web/blob/ceabcf62ddf1c969a97b5c7a4a4c547198b6ea71/webuidriver/actions.py#L199-L218
train
RockFeng0/rtsf-web
webuidriver/actions.py
WebElement._elements
def _elements(cls): ''' find the elements with controls ''' if not cls.__is_selector(): raise Exception("Invalid selector[%s]." %cls.__control["by"]) driver = Web.driver try: elements = WebDriverWait(driver, cls.__control["timeout"])....
python
def _elements(cls): ''' find the elements with controls ''' if not cls.__is_selector(): raise Exception("Invalid selector[%s]." %cls.__control["by"]) driver = Web.driver try: elements = WebDriverWait(driver, cls.__control["timeout"])....
[ "def", "_elements", "(", "cls", ")", ":", "if", "not", "cls", ".", "__is_selector", "(", ")", ":", "raise", "Exception", "(", "\"Invalid selector[%s].\"", "%", "cls", ".", "__control", "[", "\"by\"", "]", ")", "driver", "=", "Web", ".", "driver", "try", ...
find the elements with controls
[ "find", "the", "elements", "with", "controls" ]
ceabcf62ddf1c969a97b5c7a4a4c547198b6ea71
https://github.com/RockFeng0/rtsf-web/blob/ceabcf62ddf1c969a97b5c7a4a4c547198b6ea71/webuidriver/actions.py#L221-L232
train
RockFeng0/rtsf-web
webuidriver/actions.py
WebContext.DyStrData
def DyStrData(cls, name, regx, index = 0): ''' set dynamic value from the string data of response @param name: glob parameter name @param regx: re._pattern_type e.g. DyStrData("a",re.compile('123')) ''' text = Web.PageSource() if not text...
python
def DyStrData(cls, name, regx, index = 0): ''' set dynamic value from the string data of response @param name: glob parameter name @param regx: re._pattern_type e.g. DyStrData("a",re.compile('123')) ''' text = Web.PageSource() if not text...
[ "def", "DyStrData", "(", "cls", ",", "name", ",", "regx", ",", "index", "=", "0", ")", ":", "text", "=", "Web", ".", "PageSource", "(", ")", "if", "not", "text", ":", "return", "if", "not", "isinstance", "(", "regx", ",", "re", ".", "_pattern_type"...
set dynamic value from the string data of response @param name: glob parameter name @param regx: re._pattern_type e.g. DyStrData("a",re.compile('123'))
[ "set", "dynamic", "value", "from", "the", "string", "data", "of", "response" ]
ceabcf62ddf1c969a97b5c7a4a4c547198b6ea71
https://github.com/RockFeng0/rtsf-web/blob/ceabcf62ddf1c969a97b5c7a4a4c547198b6ea71/webuidriver/actions.py#L262-L279
train
RockFeng0/rtsf-web
webuidriver/actions.py
WebContext.DyJsonData
def DyJsonData(cls,name, sequence): ''' set dynamic value from the json data of response @note: 获取innerHTML json的数据 如, <html><body>{ "code": 1,"desc": "成功"}</body></html> @param name: glob parameter name @param sequence: sequence for the json e.g. result=...
python
def DyJsonData(cls,name, sequence): ''' set dynamic value from the json data of response @note: 获取innerHTML json的数据 如, <html><body>{ "code": 1,"desc": "成功"}</body></html> @param name: glob parameter name @param sequence: sequence for the json e.g. result=...
[ "def", "DyJsonData", "(", "cls", ",", "name", ",", "sequence", ")", ":", "cls", ".", "SetControl", "(", "by", "=", "\"tag name\"", ",", "value", "=", "\"body\"", ")", "json_body", "=", "cls", ".", "_element", "(", ")", ".", "get_attribute", "(", "'inne...
set dynamic value from the json data of response @note: 获取innerHTML json的数据 如, <html><body>{ "code": 1,"desc": "成功"}</body></html> @param name: glob parameter name @param sequence: sequence for the json e.g. result={"a":1, "b":[1,2,3,4], ...
[ "set", "dynamic", "value", "from", "the", "json", "data", "of", "response" ]
ceabcf62ddf1c969a97b5c7a4a4c547198b6ea71
https://github.com/RockFeng0/rtsf-web/blob/ceabcf62ddf1c969a97b5c7a4a4c547198b6ea71/webuidriver/actions.py#L282-L318
train
RockFeng0/rtsf-web
webuidriver/actions.py
WebVerify.VerifyURL
def VerifyURL(cls, url): """ 获取当前页面的url """ if Web.driver.current_url == url: return True else: print("VerifyURL: %s" % Web.driver.current_url) return False
python
def VerifyURL(cls, url): """ 获取当前页面的url """ if Web.driver.current_url == url: return True else: print("VerifyURL: %s" % Web.driver.current_url) return False
[ "def", "VerifyURL", "(", "cls", ",", "url", ")", ":", "if", "Web", ".", "driver", ".", "current_url", "==", "url", ":", "return", "True", "else", ":", "print", "(", "\"VerifyURL: %s\"", "%", "Web", ".", "driver", ".", "current_url", ")", "return", "Fal...
获取当前页面的url
[ "获取当前页面的url" ]
ceabcf62ddf1c969a97b5c7a4a4c547198b6ea71
https://github.com/RockFeng0/rtsf-web/blob/ceabcf62ddf1c969a97b5c7a4a4c547198b6ea71/webuidriver/actions.py#L375-L382
train
RockFeng0/rtsf-web
webuidriver/actions.py
WebActions.SelectByIndex
def SelectByIndex(cls, index): ''' 通过索引,选择下拉框选项, @param index: 下拉框 索引 ''' try: Select(cls._element()).select_by_index(int(index)) except: return False
python
def SelectByIndex(cls, index): ''' 通过索引,选择下拉框选项, @param index: 下拉框 索引 ''' try: Select(cls._element()).select_by_index(int(index)) except: return False
[ "def", "SelectByIndex", "(", "cls", ",", "index", ")", ":", "try", ":", "Select", "(", "cls", ".", "_element", "(", ")", ")", ".", "select_by_index", "(", "int", "(", "index", ")", ")", "except", ":", "return", "False" ]
通过索引,选择下拉框选项, @param index: 下拉框 索引
[ "通过索引,选择下拉框选项," ]
ceabcf62ddf1c969a97b5c7a4a4c547198b6ea71
https://github.com/RockFeng0/rtsf-web/blob/ceabcf62ddf1c969a97b5c7a4a4c547198b6ea71/webuidriver/actions.py#L506-L513
train
RockFeng0/rtsf-web
webuidriver/actions.py
WebActions.DeSelectByIndex
def DeSelectByIndex(cls, index): ''' 通过索引,取消选择下拉框选项, @param index: 下拉框 索引 ''' try: Select(cls._element()).deselect_by_index(int(index)) except: return False
python
def DeSelectByIndex(cls, index): ''' 通过索引,取消选择下拉框选项, @param index: 下拉框 索引 ''' try: Select(cls._element()).deselect_by_index(int(index)) except: return False
[ "def", "DeSelectByIndex", "(", "cls", ",", "index", ")", ":", "try", ":", "Select", "(", "cls", ".", "_element", "(", ")", ")", ".", "deselect_by_index", "(", "int", "(", "index", ")", ")", "except", ":", "return", "False" ]
通过索引,取消选择下拉框选项, @param index: 下拉框 索引
[ "通过索引,取消选择下拉框选项," ]
ceabcf62ddf1c969a97b5c7a4a4c547198b6ea71
https://github.com/RockFeng0/rtsf-web/blob/ceabcf62ddf1c969a97b5c7a4a4c547198b6ea71/webuidriver/actions.py#L516-L523
train
RockFeng0/rtsf-web
webuidriver/actions.py
WebActions.MouseOver
def MouseOver(cls): ''' 鼠标悬浮 ''' element = cls._element() action = ActionChains(Web.driver) action.move_to_element(element) action.perform() time.sleep(1)
python
def MouseOver(cls): ''' 鼠标悬浮 ''' element = cls._element() action = ActionChains(Web.driver) action.move_to_element(element) action.perform() time.sleep(1)
[ "def", "MouseOver", "(", "cls", ")", ":", "element", "=", "cls", ".", "_element", "(", ")", "action", "=", "ActionChains", "(", "Web", ".", "driver", ")", "action", ".", "move_to_element", "(", "element", ")", "action", ".", "perform", "(", ")", "time"...
鼠标悬浮
[ "鼠标悬浮" ]
ceabcf62ddf1c969a97b5c7a4a4c547198b6ea71
https://github.com/RockFeng0/rtsf-web/blob/ceabcf62ddf1c969a97b5c7a4a4c547198b6ea71/webuidriver/actions.py#L546-L552
train
RockFeng0/rtsf-web
webuidriver/actions.py
WebActions.Click
def Click(cls): ''' 左键 点击 1次 ''' element= cls._element() action = ActionChains(Web.driver) action.click(element) action.perform()
python
def Click(cls): ''' 左键 点击 1次 ''' element= cls._element() action = ActionChains(Web.driver) action.click(element) action.perform()
[ "def", "Click", "(", "cls", ")", ":", "element", "=", "cls", ".", "_element", "(", ")", "action", "=", "ActionChains", "(", "Web", ".", "driver", ")", "action", ".", "click", "(", "element", ")", "action", ".", "perform", "(", ")" ]
左键 点击 1次
[ "左键", "点击", "1次" ]
ceabcf62ddf1c969a97b5c7a4a4c547198b6ea71
https://github.com/RockFeng0/rtsf-web/blob/ceabcf62ddf1c969a97b5c7a4a4c547198b6ea71/webuidriver/actions.py#L555-L561
train
RockFeng0/rtsf-web
webuidriver/actions.py
WebActions.DoubleClick
def DoubleClick(cls): ''' 左键点击2次 ''' element = cls._element() action = ActionChains(Web.driver) action.double_click(element) action.perform()
python
def DoubleClick(cls): ''' 左键点击2次 ''' element = cls._element() action = ActionChains(Web.driver) action.double_click(element) action.perform()
[ "def", "DoubleClick", "(", "cls", ")", ":", "element", "=", "cls", ".", "_element", "(", ")", "action", "=", "ActionChains", "(", "Web", ".", "driver", ")", "action", ".", "double_click", "(", "element", ")", "action", ".", "perform", "(", ")" ]
左键点击2次
[ "左键点击2次" ]
ceabcf62ddf1c969a97b5c7a4a4c547198b6ea71
https://github.com/RockFeng0/rtsf-web/blob/ceabcf62ddf1c969a97b5c7a4a4c547198b6ea71/webuidriver/actions.py#L564-L570
train
RockFeng0/rtsf-web
webuidriver/actions.py
WebActions.EnhancedClick
def EnhancedClick(cls): ''' Description: Sometimes, one click on the element doesn't work. So wait more time, then click again and again. Risk: It may operate more than one click operations. ''' element = cls._element() for _ in r...
python
def EnhancedClick(cls): ''' Description: Sometimes, one click on the element doesn't work. So wait more time, then click again and again. Risk: It may operate more than one click operations. ''' element = cls._element() for _ in r...
[ "def", "EnhancedClick", "(", "cls", ")", ":", "element", "=", "cls", ".", "_element", "(", ")", "for", "_", "in", "range", "(", "3", ")", ":", "action", "=", "ActionChains", "(", "Web", ".", "driver", ")", "action", ".", "move_to_element", "(", "elem...
Description: Sometimes, one click on the element doesn't work. So wait more time, then click again and again. Risk: It may operate more than one click operations.
[ "Description", ":", "Sometimes", "one", "click", "on", "the", "element", "doesn", "t", "work", ".", "So", "wait", "more", "time", "then", "click", "again", "and", "again", ".", "Risk", ":", "It", "may", "operate", "more", "than", "one", "click", "operati...
ceabcf62ddf1c969a97b5c7a4a4c547198b6ea71
https://github.com/RockFeng0/rtsf-web/blob/ceabcf62ddf1c969a97b5c7a4a4c547198b6ea71/webuidriver/actions.py#L573-L586
train
RockFeng0/rtsf-web
webuidriver/actions.py
WebActions.RightClick
def RightClick(cls): ''' 右键点击1次 ''' element = cls._element() action = ActionChains(Web.driver) action.context_click(element) action.perform()
python
def RightClick(cls): ''' 右键点击1次 ''' element = cls._element() action = ActionChains(Web.driver) action.context_click(element) action.perform()
[ "def", "RightClick", "(", "cls", ")", ":", "element", "=", "cls", ".", "_element", "(", ")", "action", "=", "ActionChains", "(", "Web", ".", "driver", ")", "action", ".", "context_click", "(", "element", ")", "action", ".", "perform", "(", ")" ]
右键点击1次
[ "右键点击1次" ]
ceabcf62ddf1c969a97b5c7a4a4c547198b6ea71
https://github.com/RockFeng0/rtsf-web/blob/ceabcf62ddf1c969a97b5c7a4a4c547198b6ea71/webuidriver/actions.py#L589-L595
train
RockFeng0/rtsf-web
webuidriver/actions.py
WebActions.ClickAndHold
def ClickAndHold(cls): ''' 相当于 按压,press ''' element = cls._element() action = ActionChains(Web.driver) action.click_and_hold(element) action.perform()
python
def ClickAndHold(cls): ''' 相当于 按压,press ''' element = cls._element() action = ActionChains(Web.driver) action.click_and_hold(element) action.perform()
[ "def", "ClickAndHold", "(", "cls", ")", ":", "element", "=", "cls", ".", "_element", "(", ")", "action", "=", "ActionChains", "(", "Web", ".", "driver", ")", "action", ".", "click_and_hold", "(", "element", ")", "action", ".", "perform", "(", ")" ]
相当于 按压,press
[ "相当于", "按压,press" ]
ceabcf62ddf1c969a97b5c7a4a4c547198b6ea71
https://github.com/RockFeng0/rtsf-web/blob/ceabcf62ddf1c969a97b5c7a4a4c547198b6ea71/webuidriver/actions.py#L599-L605
train
RockFeng0/rtsf-web
webuidriver/actions.py
WebActions.ReleaseClick
def ReleaseClick(cls): ''' 释放按压操作 ''' element = cls._element() action = ActionChains(Web.driver) action.release(element) action.perform()
python
def ReleaseClick(cls): ''' 释放按压操作 ''' element = cls._element() action = ActionChains(Web.driver) action.release(element) action.perform()
[ "def", "ReleaseClick", "(", "cls", ")", ":", "element", "=", "cls", ".", "_element", "(", ")", "action", "=", "ActionChains", "(", "Web", ".", "driver", ")", "action", ".", "release", "(", "element", ")", "action", ".", "perform", "(", ")" ]
释放按压操作
[ "释放按压操作" ]
ceabcf62ddf1c969a97b5c7a4a4c547198b6ea71
https://github.com/RockFeng0/rtsf-web/blob/ceabcf62ddf1c969a97b5c7a4a4c547198b6ea71/webuidriver/actions.py#L609-L615
train
RockFeng0/rtsf-web
webuidriver/actions.py
WebActions.Enter
def Enter(cls): ''' 在指定输入框发送回回车键 @note: key event -> enter ''' element = cls._element() action = ActionChains(Web.driver) action.send_keys_to_element(element, Keys.ENTER) action.perform()
python
def Enter(cls): ''' 在指定输入框发送回回车键 @note: key event -> enter ''' element = cls._element() action = ActionChains(Web.driver) action.send_keys_to_element(element, Keys.ENTER) action.perform()
[ "def", "Enter", "(", "cls", ")", ":", "element", "=", "cls", ".", "_element", "(", ")", "action", "=", "ActionChains", "(", "Web", ".", "driver", ")", "action", ".", "send_keys_to_element", "(", "element", ",", "Keys", ".", "ENTER", ")", "action", ".",...
在指定输入框发送回回车键 @note: key event -> enter
[ "在指定输入框发送回回车键" ]
ceabcf62ddf1c969a97b5c7a4a4c547198b6ea71
https://github.com/RockFeng0/rtsf-web/blob/ceabcf62ddf1c969a97b5c7a4a4c547198b6ea71/webuidriver/actions.py#L626-L634
train
RockFeng0/rtsf-web
webuidriver/actions.py
WebActions.Ctrl
def Ctrl(cls, key): """ 在指定元素上执行ctrl组合键事件 @note: key event -> control + key @param key: 如'X' """ element = cls._element() element.send_keys(Keys.CONTROL, key)
python
def Ctrl(cls, key): """ 在指定元素上执行ctrl组合键事件 @note: key event -> control + key @param key: 如'X' """ element = cls._element() element.send_keys(Keys.CONTROL, key)
[ "def", "Ctrl", "(", "cls", ",", "key", ")", ":", "element", "=", "cls", ".", "_element", "(", ")", "element", ".", "send_keys", "(", "Keys", ".", "CONTROL", ",", "key", ")" ]
在指定元素上执行ctrl组合键事件 @note: key event -> control + key @param key: 如'X'
[ "在指定元素上执行ctrl组合键事件" ]
ceabcf62ddf1c969a97b5c7a4a4c547198b6ea71
https://github.com/RockFeng0/rtsf-web/blob/ceabcf62ddf1c969a97b5c7a4a4c547198b6ea71/webuidriver/actions.py#L637-L643
train