repository_name
stringlengths
7
55
func_path_in_repository
stringlengths
4
223
func_name
stringlengths
1
134
whole_func_string
stringlengths
75
104k
language
stringclasses
1 value
func_code_string
stringlengths
75
104k
func_code_tokens
listlengths
19
28.4k
func_documentation_string
stringlengths
1
46.9k
func_documentation_tokens
listlengths
1
1.97k
split_name
stringclasses
1 value
func_code_url
stringlengths
87
315
jtpaasch/simplygithub
simplygithub/internals/refs.py
update_ref
def update_ref(profile, ref, sha): """Point a ref to a new SHA. Args: profile A profile generated from ``simplygithub.authentication.profile``. Such profiles tell this module (i) the ``repo`` to connect to, and (ii) the ``token`` to connect with. ref ...
python
def update_ref(profile, ref, sha): """Point a ref to a new SHA. Args: profile A profile generated from ``simplygithub.authentication.profile``. Such profiles tell this module (i) the ``repo`` to connect to, and (ii) the ``token`` to connect with. ref ...
[ "def", "update_ref", "(", "profile", ",", "ref", ",", "sha", ")", ":", "resource", "=", "\"/refs/\"", "+", "ref", "payload", "=", "{", "\"sha\"", ":", "sha", "}", "data", "=", "api", ".", "patch_request", "(", "profile", ",", "resource", ",", "payload"...
Point a ref to a new SHA. Args: profile A profile generated from ``simplygithub.authentication.profile``. Such profiles tell this module (i) the ``repo`` to connect to, and (ii) the ``token`` to connect with. ref The ref to update, e.g., ``heads/my-...
[ "Point", "a", "ref", "to", "a", "new", "SHA", "." ]
train
https://github.com/jtpaasch/simplygithub/blob/b77506275ec276ce90879bf1ea9299a79448b903/simplygithub/internals/refs.py#L91-L114
jamieleshaw/lurklib
lurklib/connection.py
_Connection._connect
def _connect(self, server, port, tls=True, tls_verify=True, proxy=False, proxy_type='SOCKS5', proxy_server=None, proxy_port=None, proxy_username=None, proxy_password=None): """ Connects the socket to an IRC server. Required arguments: * server - Server t...
python
def _connect(self, server, port, tls=True, tls_verify=True, proxy=False, proxy_type='SOCKS5', proxy_server=None, proxy_port=None, proxy_username=None, proxy_password=None): """ Connects the socket to an IRC server. Required arguments: * server - Server t...
[ "def", "_connect", "(", "self", ",", "server", ",", "port", ",", "tls", "=", "True", ",", "tls_verify", "=", "True", ",", "proxy", "=", "False", ",", "proxy_type", "=", "'SOCKS5'", ",", "proxy_server", "=", "None", ",", "proxy_port", "=", "None", ",", ...
Connects the socket to an IRC server. Required arguments: * server - Server to connect to. * port - Port to use. Optional arguments: * tls=True - Should we use TLS/SSL? * tls_verify=True - Verify the TLS certificate? Only works with Python 3. * pro...
[ "Connects", "the", "socket", "to", "an", "IRC", "server", ".", "Required", "arguments", ":", "*", "server", "-", "Server", "to", "connect", "to", ".", "*", "port", "-", "Port", "to", "use", ".", "Optional", "arguments", ":", "*", "tls", "=", "True", ...
train
https://github.com/jamieleshaw/lurklib/blob/a861f35d880140422103dd78ec3239814e85fd7e/lurklib/connection.py#L21-L73
jamieleshaw/lurklib
lurklib/connection.py
_Connection._register
def _register(self, nick, user, real_name, password=None): """ Register the connection with the IRC server. Required arguments: * nick - Nick to use. If a tuple/list is specified - it will try to use the first, and if the first is already used - it wi...
python
def _register(self, nick, user, real_name, password=None): """ Register the connection with the IRC server. Required arguments: * nick - Nick to use. If a tuple/list is specified - it will try to use the first, and if the first is already used - it wi...
[ "def", "_register", "(", "self", ",", "nick", ",", "user", ",", "real_name", ",", "password", "=", "None", ")", ":", "with", "self", ".", "lock", ":", "if", "password", ":", "self", ".", "_password", "(", "password", ")", "self", ".", "nick", "(", ...
Register the connection with the IRC server. Required arguments: * nick - Nick to use. If a tuple/list is specified - it will try to use the first, and if the first is already used - it will try to use the second and so on. * user - Username to use. *...
[ "Register", "the", "connection", "with", "the", "IRC", "server", ".", "Required", "arguments", ":", "*", "nick", "-", "Nick", "to", "use", ".", "If", "a", "tuple", "/", "list", "is", "specified", "-", "it", "will", "try", "to", "use", "the", "first", ...
train
https://github.com/jamieleshaw/lurklib/blob/a861f35d880140422103dd78ec3239814e85fd7e/lurklib/connection.py#L75-L93
jamieleshaw/lurklib
lurklib/connection.py
_Connection._init
def _init(self, server, nick, user, real_name, password, port=None, tls=True, tls_verify=True, proxy=False, proxy_type='SOCKS5', proxy_server=None, proxy_port=None, proxy_username=None, proxy_password=None): """ Connect and register with the IRC server and - ...
python
def _init(self, server, nick, user, real_name, password, port=None, tls=True, tls_verify=True, proxy=False, proxy_type='SOCKS5', proxy_server=None, proxy_port=None, proxy_username=None, proxy_password=None): """ Connect and register with the IRC server and - ...
[ "def", "_init", "(", "self", ",", "server", ",", "nick", ",", "user", ",", "real_name", ",", "password", ",", "port", "=", "None", ",", "tls", "=", "True", ",", "tls_verify", "=", "True", ",", "proxy", "=", "False", ",", "proxy_type", "=", "'SOCKS5'"...
Connect and register with the IRC server and - set server-related information variables. Required arguments: * server - Server to connect to. * nick - Nick to use. If a tuple/list is specified it will try to use the first, and if the first is already used - ...
[ "Connect", "and", "register", "with", "the", "IRC", "server", "and", "-", "set", "server", "-", "related", "information", "variables", ".", "Required", "arguments", ":", "*", "server", "-", "Server", "to", "connect", "to", ".", "*", "nick", "-", "Nick", ...
train
https://github.com/jamieleshaw/lurklib/blob/a861f35d880140422103dd78ec3239814e85fd7e/lurklib/connection.py#L95-L188
jamieleshaw/lurklib
lurklib/connection.py
_Connection._password
def _password(self, password): """ Authenticates with the IRC server. NOTE: Method will not raise an exception, if the password is wrong. It will just fail.. Required arguments: * password - Password to send. """ with self.lock: self.send('PASS...
python
def _password(self, password): """ Authenticates with the IRC server. NOTE: Method will not raise an exception, if the password is wrong. It will just fail.. Required arguments: * password - Password to send. """ with self.lock: self.send('PASS...
[ "def", "_password", "(", "self", ",", "password", ")", ":", "with", "self", ".", "lock", ":", "self", ".", "send", "(", "'PASS :%s'", "%", "password", ",", "error_check", "=", "True", ")" ]
Authenticates with the IRC server. NOTE: Method will not raise an exception, if the password is wrong. It will just fail.. Required arguments: * password - Password to send.
[ "Authenticates", "with", "the", "IRC", "server", ".", "NOTE", ":", "Method", "will", "not", "raise", "an", "exception", "if", "the", "password", "is", "wrong", ".", "It", "will", "just", "fail", "..", "Required", "arguments", ":", "*", "password", "-", "...
train
https://github.com/jamieleshaw/lurklib/blob/a861f35d880140422103dd78ec3239814e85fd7e/lurklib/connection.py#L190-L199
jamieleshaw/lurklib
lurklib/connection.py
_Connection._nick
def _nick(self, nick): """ Sets your nick. Required arguments: * nick - New nick. """ with self.lock: self.send('NICK :%s' % nick) if self.readable(): msg = self._recv(expected_replies='NICK') if msg[0] == 'NICK': ...
python
def _nick(self, nick): """ Sets your nick. Required arguments: * nick - New nick. """ with self.lock: self.send('NICK :%s' % nick) if self.readable(): msg = self._recv(expected_replies='NICK') if msg[0] == 'NICK': ...
[ "def", "_nick", "(", "self", ",", "nick", ")", ":", "with", "self", ".", "lock", ":", "self", ".", "send", "(", "'NICK :%s'", "%", "nick", ")", "if", "self", ".", "readable", "(", ")", ":", "msg", "=", "self", ".", "_recv", "(", "expected_replies",...
Sets your nick. Required arguments: * nick - New nick.
[ "Sets", "your", "nick", ".", "Required", "arguments", ":", "*", "nick", "-", "New", "nick", "." ]
train
https://github.com/jamieleshaw/lurklib/blob/a861f35d880140422103dd78ec3239814e85fd7e/lurklib/connection.py#L201-L222
jamieleshaw/lurklib
lurklib/connection.py
_Connection.nick
def nick(self, nick): """ Sets your nick. Required arguments: * nick - New nick or a tuple of possible new nicks. """ nick_set_successfully = False try: self._nick(nick) nick_set_successfully = True except TypeError: for...
python
def nick(self, nick): """ Sets your nick. Required arguments: * nick - New nick or a tuple of possible new nicks. """ nick_set_successfully = False try: self._nick(nick) nick_set_successfully = True except TypeError: for...
[ "def", "nick", "(", "self", ",", "nick", ")", ":", "nick_set_successfully", "=", "False", "try", ":", "self", ".", "_nick", "(", "nick", ")", "nick_set_successfully", "=", "True", "except", "TypeError", ":", "for", "nick_", "in", "nick", ":", "try", ":",...
Sets your nick. Required arguments: * nick - New nick or a tuple of possible new nicks.
[ "Sets", "your", "nick", ".", "Required", "arguments", ":", "*", "nick", "-", "New", "nick", "or", "a", "tuple", "of", "possible", "new", "nicks", "." ]
train
https://github.com/jamieleshaw/lurklib/blob/a861f35d880140422103dd78ec3239814e85fd7e/lurklib/connection.py#L224-L244
jamieleshaw/lurklib
lurklib/connection.py
_Connection._user
def _user(self, user, real_name): """ Sends the USER message. Required arguments: * user - Username to send. * real_name - Real name to send. """ with self.lock: self.send('USER %s 0 * :%s' % (user, real_name)) if self.readable(): ...
python
def _user(self, user, real_name): """ Sends the USER message. Required arguments: * user - Username to send. * real_name - Real name to send. """ with self.lock: self.send('USER %s 0 * :%s' % (user, real_name)) if self.readable(): ...
[ "def", "_user", "(", "self", ",", "user", ",", "real_name", ")", ":", "with", "self", ".", "lock", ":", "self", ".", "send", "(", "'USER %s 0 * :%s'", "%", "(", "user", ",", "real_name", ")", ")", "if", "self", ".", "readable", "(", ")", ":", "self...
Sends the USER message. Required arguments: * user - Username to send. * real_name - Real name to send.
[ "Sends", "the", "USER", "message", ".", "Required", "arguments", ":", "*", "user", "-", "Username", "to", "send", ".", "*", "real_name", "-", "Real", "name", "to", "send", "." ]
train
https://github.com/jamieleshaw/lurklib/blob/a861f35d880140422103dd78ec3239814e85fd7e/lurklib/connection.py#L246-L257
jamieleshaw/lurklib
lurklib/connection.py
_Connection.oper
def oper(self, name, password): """ Opers up. Required arguments: * name - Oper name. * password - Oper password. """ with self.lock: self.send('OPER %s %s' % (name, password)) snomasks = '' new_umodes = '' if self.r...
python
def oper(self, name, password): """ Opers up. Required arguments: * name - Oper name. * password - Oper password. """ with self.lock: self.send('OPER %s %s' % (name, password)) snomasks = '' new_umodes = '' if self.r...
[ "def", "oper", "(", "self", ",", "name", ",", "password", ")", ":", "with", "self", ".", "lock", ":", "self", ".", "send", "(", "'OPER %s %s'", "%", "(", "name", ",", "password", ")", ")", "snomasks", "=", "''", "new_umodes", "=", "''", "if", "self...
Opers up. Required arguments: * name - Oper name. * password - Oper password.
[ "Opers", "up", ".", "Required", "arguments", ":", "*", "name", "-", "Oper", "name", ".", "*", "password", "-", "Oper", "password", "." ]
train
https://github.com/jamieleshaw/lurklib/blob/a861f35d880140422103dd78ec3239814e85fd7e/lurklib/connection.py#L259-L278
jamieleshaw/lurklib
lurklib/connection.py
_Connection.umode
def umode(self, nick, modes=''): """ Sets/gets user modes. Required arguments: * nick - Nick to set/get user modes for. Optional arguments: * modes='' - Sets these user modes on a nick. """ with self.lock: if not modes: self.sen...
python
def umode(self, nick, modes=''): """ Sets/gets user modes. Required arguments: * nick - Nick to set/get user modes for. Optional arguments: * modes='' - Sets these user modes on a nick. """ with self.lock: if not modes: self.sen...
[ "def", "umode", "(", "self", ",", "nick", ",", "modes", "=", "''", ")", ":", "with", "self", ".", "lock", ":", "if", "not", "modes", ":", "self", ".", "send", "(", "'MODE %s'", "%", "nick", ")", "if", "self", ".", "readable", "(", ")", ":", "ms...
Sets/gets user modes. Required arguments: * nick - Nick to set/get user modes for. Optional arguments: * modes='' - Sets these user modes on a nick.
[ "Sets", "/", "gets", "user", "modes", ".", "Required", "arguments", ":", "*", "nick", "-", "Nick", "to", "set", "/", "get", "user", "modes", "for", ".", "Optional", "arguments", ":", "*", "modes", "=", "-", "Sets", "these", "user", "modes", "on", "a"...
train
https://github.com/jamieleshaw/lurklib/blob/a861f35d880140422103dd78ec3239814e85fd7e/lurklib/connection.py#L280-L304
jamieleshaw/lurklib
lurklib/connection.py
_Connection.quit
def quit(self, reason=''): """ Sends a QUIT message, closes the connection and - ends Lurklib's main loop. Optional arguments: * reason='' - Reason for quitting. """ with self.lock: self.keep_going = False self._quit(reason) ...
python
def quit(self, reason=''): """ Sends a QUIT message, closes the connection and - ends Lurklib's main loop. Optional arguments: * reason='' - Reason for quitting. """ with self.lock: self.keep_going = False self._quit(reason) ...
[ "def", "quit", "(", "self", ",", "reason", "=", "''", ")", ":", "with", "self", ".", "lock", ":", "self", ".", "keep_going", "=", "False", "self", ".", "_quit", "(", "reason", ")", "self", ".", "_socket", ".", "shutdown", "(", "self", ".", "_m_sock...
Sends a QUIT message, closes the connection and - ends Lurklib's main loop. Optional arguments: * reason='' - Reason for quitting.
[ "Sends", "a", "QUIT", "message", "closes", "the", "connection", "and", "-", "ends", "Lurklib", "s", "main", "loop", ".", "Optional", "arguments", ":", "*", "reason", "=", "-", "Reason", "for", "quitting", "." ]
train
https://github.com/jamieleshaw/lurklib/blob/a861f35d880140422103dd78ec3239814e85fd7e/lurklib/connection.py#L319-L330
jamieleshaw/lurklib
lurklib/connection.py
_Connection.squit
def squit(self, server, reason=''): """ Quits a server. Required arguments: * server - Server to quit. Optional arguments: * reason='' - Reason for the server quitting. """ with self.lock: self.send('SQUIT %s :%s' % (server, reason)) ...
python
def squit(self, server, reason=''): """ Quits a server. Required arguments: * server - Server to quit. Optional arguments: * reason='' - Reason for the server quitting. """ with self.lock: self.send('SQUIT %s :%s' % (server, reason)) ...
[ "def", "squit", "(", "self", ",", "server", ",", "reason", "=", "''", ")", ":", "with", "self", ".", "lock", ":", "self", ".", "send", "(", "'SQUIT %s :%s'", "%", "(", "server", ",", "reason", ")", ")", "while", "self", ".", "readable", "(", ")", ...
Quits a server. Required arguments: * server - Server to quit. Optional arguments: * reason='' - Reason for the server quitting.
[ "Quits", "a", "server", ".", "Required", "arguments", ":", "*", "server", "-", "Server", "to", "quit", ".", "Optional", "arguments", ":", "*", "reason", "=", "-", "Reason", "for", "the", "server", "quitting", "." ]
train
https://github.com/jamieleshaw/lurklib/blob/a861f35d880140422103dd78ec3239814e85fd7e/lurklib/connection.py#L340-L355
jamieleshaw/lurklib
lurklib/connection.py
_Connection.latency
def latency(self): """ Checks the connection latency. """ with self.lock: self.send('PING %s' % self.server) ctime = self._m_time.time() msg = self._recv(expected_replies=('PONG',)) if msg[0] == 'PONG': latency = self._m_time.time() - ctim...
python
def latency(self): """ Checks the connection latency. """ with self.lock: self.send('PING %s' % self.server) ctime = self._m_time.time() msg = self._recv(expected_replies=('PONG',)) if msg[0] == 'PONG': latency = self._m_time.time() - ctim...
[ "def", "latency", "(", "self", ")", ":", "with", "self", ".", "lock", ":", "self", ".", "send", "(", "'PING %s'", "%", "self", ".", "server", ")", "ctime", "=", "self", ".", "_m_time", ".", "time", "(", ")", "msg", "=", "self", ".", "_recv", "(",...
Checks the connection latency.
[ "Checks", "the", "connection", "latency", "." ]
train
https://github.com/jamieleshaw/lurklib/blob/a861f35d880140422103dd78ec3239814e85fd7e/lurklib/connection.py#L357-L366
SmartDeveloperHub/agora-client
agora/client/wrapper.py
FragmentCollector.__get_gp_plan
def __get_gp_plan(self, gp): """ Request the planner a search plan for a given gp and returns the plan as a graph. :param gp: :return: """ query = urlencode({'gp': gp}) response = requests.get('{}/plan?'.format(self.__planner) + query, headers={'Accept': 'text/tur...
python
def __get_gp_plan(self, gp): """ Request the planner a search plan for a given gp and returns the plan as a graph. :param gp: :return: """ query = urlencode({'gp': gp}) response = requests.get('{}/plan?'.format(self.__planner) + query, headers={'Accept': 'text/tur...
[ "def", "__get_gp_plan", "(", "self", ",", "gp", ")", ":", "query", "=", "urlencode", "(", "{", "'gp'", ":", "gp", "}", ")", "response", "=", "requests", ".", "get", "(", "'{}/plan?'", ".", "format", "(", "self", ".", "__planner", ")", "+", "query", ...
Request the planner a search plan for a given gp and returns the plan as a graph. :param gp: :return:
[ "Request", "the", "planner", "a", "search", "plan", "for", "a", "given", "gp", "and", "returns", "the", "plan", "as", "a", "graph", ".", ":", "param", "gp", ":", ":", "return", ":" ]
train
https://github.com/SmartDeveloperHub/agora-client/blob/53e126d12c2803ee71cf0822aaa0b0cf08cc3df4/agora/client/wrapper.py#L52-L65
SmartDeveloperHub/agora-client
agora/client/wrapper.py
Agora.get_fragment
def get_fragment(self, gp, **kwargs): """ Return a complete fragment for a given gp. :param gp: A graph pattern :return: """ collector = FragmentCollector(self.__host, gp) return collector.get_fragment(**kwargs)
python
def get_fragment(self, gp, **kwargs): """ Return a complete fragment for a given gp. :param gp: A graph pattern :return: """ collector = FragmentCollector(self.__host, gp) return collector.get_fragment(**kwargs)
[ "def", "get_fragment", "(", "self", ",", "gp", ",", "*", "*", "kwargs", ")", ":", "collector", "=", "FragmentCollector", "(", "self", ".", "__host", ",", "gp", ")", "return", "collector", ".", "get_fragment", "(", "*", "*", "kwargs", ")" ]
Return a complete fragment for a given gp. :param gp: A graph pattern :return:
[ "Return", "a", "complete", "fragment", "for", "a", "given", "gp", ".", ":", "param", "gp", ":", "A", "graph", "pattern", ":", "return", ":" ]
train
https://github.com/SmartDeveloperHub/agora-client/blob/53e126d12c2803ee71cf0822aaa0b0cf08cc3df4/agora/client/wrapper.py#L82-L89
SmartDeveloperHub/agora-client
agora/client/wrapper.py
Agora.get_fragment_generator
def get_fragment_generator(self, gp, **kwargs): """ Return a fragment generator for a given gp. :param gp: :param kwargs: :return: """ collector = FragmentCollector(self.__host, gp) return collector.get_fragment_generator(**kwargs)
python
def get_fragment_generator(self, gp, **kwargs): """ Return a fragment generator for a given gp. :param gp: :param kwargs: :return: """ collector = FragmentCollector(self.__host, gp) return collector.get_fragment_generator(**kwargs)
[ "def", "get_fragment_generator", "(", "self", ",", "gp", ",", "*", "*", "kwargs", ")", ":", "collector", "=", "FragmentCollector", "(", "self", ".", "__host", ",", "gp", ")", "return", "collector", ".", "get_fragment_generator", "(", "*", "*", "kwargs", ")...
Return a fragment generator for a given gp. :param gp: :param kwargs: :return:
[ "Return", "a", "fragment", "generator", "for", "a", "given", "gp", ".", ":", "param", "gp", ":", ":", "param", "kwargs", ":", ":", "return", ":" ]
train
https://github.com/SmartDeveloperHub/agora-client/blob/53e126d12c2803ee71cf0822aaa0b0cf08cc3df4/agora/client/wrapper.py#L91-L99
armstrong/armstrong.core.arm_sections
armstrong/core/arm_sections/utils.py
get_section_relations
def get_section_relations(Section): """Find every relationship between section and the item model.""" all_rels = (Section._meta.get_all_related_objects() + Section._meta.get_all_related_many_to_many_objects()) return filter_item_rels(all_rels)
python
def get_section_relations(Section): """Find every relationship between section and the item model.""" all_rels = (Section._meta.get_all_related_objects() + Section._meta.get_all_related_many_to_many_objects()) return filter_item_rels(all_rels)
[ "def", "get_section_relations", "(", "Section", ")", ":", "all_rels", "=", "(", "Section", ".", "_meta", ".", "get_all_related_objects", "(", ")", "+", "Section", ".", "_meta", ".", "get_all_related_many_to_many_objects", "(", ")", ")", "return", "filter_item_rels...
Find every relationship between section and the item model.
[ "Find", "every", "relationship", "between", "section", "and", "the", "item", "model", "." ]
train
https://github.com/armstrong/armstrong.core.arm_sections/blob/39c999c93771da909359e53b35afefe4846f77cb/armstrong/core/arm_sections/utils.py#L30-L34
edeposit/edeposit.amqp.harvester
src/edeposit/amqp/harvester/filters/__init__.py
filter_publication
def filter_publication(publication): """ Filter :class:`.Publication` objects using settings declared in :mod:`~harvester.settings` submodule. Args: publication (obj): :class:`.Publication` instance. Returns: obj/None: None if the publication was found in Aleph or `publication` \ ...
python
def filter_publication(publication): """ Filter :class:`.Publication` objects using settings declared in :mod:`~harvester.settings` submodule. Args: publication (obj): :class:`.Publication` instance. Returns: obj/None: None if the publication was found in Aleph or `publication` \ ...
[ "def", "filter_publication", "(", "publication", ")", ":", "if", "settings", ".", "USE_DUP_FILTER", ":", "publication", "=", "dup_filter", ".", "filter_publication", "(", "publication", ")", "if", "publication", "and", "settings", ".", "USE_ALEPH_FILTER", ":", "pu...
Filter :class:`.Publication` objects using settings declared in :mod:`~harvester.settings` submodule. Args: publication (obj): :class:`.Publication` instance. Returns: obj/None: None if the publication was found in Aleph or `publication` \ if not.
[ "Filter", ":", "class", ":", ".", "Publication", "objects", "using", "settings", "declared", "in", ":", "mod", ":", "~harvester", ".", "settings", "submodule", "." ]
train
https://github.com/edeposit/edeposit.amqp.harvester/blob/38cb87ccdf6bf2f550a98460d0a329c4b9dc8e2e/src/edeposit/amqp/harvester/filters/__init__.py#L18-L39
mattimck/python-exist
exist/auth.py
ExistAuth.authorize_url
def authorize_url(self): """ Build the authorization url and save the state. Return the authorization url """ url, self.state = self.oauth.authorization_url( '%sauthorize' % OAUTH_URL) return url
python
def authorize_url(self): """ Build the authorization url and save the state. Return the authorization url """ url, self.state = self.oauth.authorization_url( '%sauthorize' % OAUTH_URL) return url
[ "def", "authorize_url", "(", "self", ")", ":", "url", ",", "self", ".", "state", "=", "self", ".", "oauth", ".", "authorization_url", "(", "'%sauthorize'", "%", "OAUTH_URL", ")", "return", "url" ]
Build the authorization url and save the state. Return the authorization url
[ "Build", "the", "authorization", "url", "and", "save", "the", "state", ".", "Return", "the", "authorization", "url" ]
train
https://github.com/mattimck/python-exist/blob/2c4be9d176d8e8007c4e020ee7cd6263a2096abb/exist/auth.py#L75-L82
mattimck/python-exist
exist/auth.py
ExistAuth.fetch_token
def fetch_token(self, code, state): """ Fetch the token, using the verification code. Also, make sure the state received in the response matches the one in the request. Returns the access_token. """ if self.state != state: raise MismatchingStateError() ...
python
def fetch_token(self, code, state): """ Fetch the token, using the verification code. Also, make sure the state received in the response matches the one in the request. Returns the access_token. """ if self.state != state: raise MismatchingStateError() ...
[ "def", "fetch_token", "(", "self", ",", "code", ",", "state", ")", ":", "if", "self", ".", "state", "!=", "state", ":", "raise", "MismatchingStateError", "(", ")", "self", ".", "token", "=", "self", ".", "oauth", ".", "fetch_token", "(", "'%saccess_token...
Fetch the token, using the verification code. Also, make sure the state received in the response matches the one in the request. Returns the access_token.
[ "Fetch", "the", "token", "using", "the", "verification", "code", ".", "Also", "make", "sure", "the", "state", "received", "in", "the", "response", "matches", "the", "one", "in", "the", "request", ".", "Returns", "the", "access_token", "." ]
train
https://github.com/mattimck/python-exist/blob/2c4be9d176d8e8007c4e020ee7cd6263a2096abb/exist/auth.py#L84-L95
mattimck/python-exist
exist/auth.py
ExistAuth.refresh_token
def refresh_token(self, refresh_token): """ Get a new token, using the provided refresh token. Returns the new access_token. """ response = requests.post('%saccess_token' % OAUTH_URL, { 'refresh_token': refresh_token, ...
python
def refresh_token(self, refresh_token): """ Get a new token, using the provided refresh token. Returns the new access_token. """ response = requests.post('%saccess_token' % OAUTH_URL, { 'refresh_token': refresh_token, ...
[ "def", "refresh_token", "(", "self", ",", "refresh_token", ")", ":", "response", "=", "requests", ".", "post", "(", "'%saccess_token'", "%", "OAUTH_URL", ",", "{", "'refresh_token'", ":", "refresh_token", ",", "'grant_type'", ":", "'refresh_token'", ",", "'clien...
Get a new token, using the provided refresh token. Returns the new access_token.
[ "Get", "a", "new", "token", "using", "the", "provided", "refresh", "token", ".", "Returns", "the", "new", "access_token", "." ]
train
https://github.com/mattimck/python-exist/blob/2c4be9d176d8e8007c4e020ee7cd6263a2096abb/exist/auth.py#L97-L114
mattimck/python-exist
exist/auth.py
ExistAuth.browser_authorize
def browser_authorize(self): """ Open a browser to the authorization url and spool up a CherryPy server to accept the response """ url = self.authorize_url() # Open the web browser in a new thread for command-line browser support threading.Timer(1, webbrowser.open...
python
def browser_authorize(self): """ Open a browser to the authorization url and spool up a CherryPy server to accept the response """ url = self.authorize_url() # Open the web browser in a new thread for command-line browser support threading.Timer(1, webbrowser.open...
[ "def", "browser_authorize", "(", "self", ")", ":", "url", "=", "self", ".", "authorize_url", "(", ")", "# Open the web browser in a new thread for command-line browser support", "threading", ".", "Timer", "(", "1", ",", "webbrowser", ".", "open", ",", "args", "=", ...
Open a browser to the authorization url and spool up a CherryPy server to accept the response
[ "Open", "a", "browser", "to", "the", "authorization", "url", "and", "spool", "up", "a", "CherryPy", "server", "to", "accept", "the", "response" ]
train
https://github.com/mattimck/python-exist/blob/2c4be9d176d8e8007c4e020ee7cd6263a2096abb/exist/auth.py#L116-L135
mattimck/python-exist
exist/auth.py
ExistAuth.index
def index(self, state, code=None, error=None): """ Receive a Exist response containing a verification code. Use the code to fetch the access_token. """ error = None if code: try: auth_token = self.fetch_token(code, state) except Mis...
python
def index(self, state, code=None, error=None): """ Receive a Exist response containing a verification code. Use the code to fetch the access_token. """ error = None if code: try: auth_token = self.fetch_token(code, state) except Mis...
[ "def", "index", "(", "self", ",", "state", ",", "code", "=", "None", ",", "error", "=", "None", ")", ":", "error", "=", "None", "if", "code", ":", "try", ":", "auth_token", "=", "self", ".", "fetch_token", "(", "code", ",", "state", ")", "except", ...
Receive a Exist response containing a verification code. Use the code to fetch the access_token.
[ "Receive", "a", "Exist", "response", "containing", "a", "verification", "code", ".", "Use", "the", "code", "to", "fetch", "the", "access_token", "." ]
train
https://github.com/mattimck/python-exist/blob/2c4be9d176d8e8007c4e020ee7cd6263a2096abb/exist/auth.py#L138-L157
mattimck/python-exist
exist/auth.py
ExistAuth._shutdown_cherrypy
def _shutdown_cherrypy(self): """ Shutdown cherrypy in one second, if it's running """ if cherrypy.engine.state == cherrypy.engine.states.STARTED: threading.Timer(1, cherrypy.engine.exit).start()
python
def _shutdown_cherrypy(self): """ Shutdown cherrypy in one second, if it's running """ if cherrypy.engine.state == cherrypy.engine.states.STARTED: threading.Timer(1, cherrypy.engine.exit).start()
[ "def", "_shutdown_cherrypy", "(", "self", ")", ":", "if", "cherrypy", ".", "engine", ".", "state", "==", "cherrypy", ".", "engine", ".", "states", ".", "STARTED", ":", "threading", ".", "Timer", "(", "1", ",", "cherrypy", ".", "engine", ".", "exit", ")...
Shutdown cherrypy in one second, if it's running
[ "Shutdown", "cherrypy", "in", "one", "second", "if", "it", "s", "running" ]
train
https://github.com/mattimck/python-exist/blob/2c4be9d176d8e8007c4e020ee7cd6263a2096abb/exist/auth.py#L164-L167
scdoshi/django-bits
bits/templatetags/custom_utils.py
NamelessField.as_widget
def as_widget(self, widget=None, attrs=None, only_initial=False): """ Renders the field by rendering the passed widget, adding any HTML attributes passed as attrs. If no widget is specified, then the field's default widget will be used. """ if not widget: wid...
python
def as_widget(self, widget=None, attrs=None, only_initial=False): """ Renders the field by rendering the passed widget, adding any HTML attributes passed as attrs. If no widget is specified, then the field's default widget will be used. """ if not widget: wid...
[ "def", "as_widget", "(", "self", ",", "widget", "=", "None", ",", "attrs", "=", "None", ",", "only_initial", "=", "False", ")", ":", "if", "not", "widget", ":", "widget", "=", "self", ".", "field", ".", "widget", "attrs", "=", "attrs", "or", "{", "...
Renders the field by rendering the passed widget, adding any HTML attributes passed as attrs. If no widget is specified, then the field's default widget will be used.
[ "Renders", "the", "field", "by", "rendering", "the", "passed", "widget", "adding", "any", "HTML", "attributes", "passed", "as", "attrs", ".", "If", "no", "widget", "is", "specified", "then", "the", "field", "s", "default", "widget", "will", "be", "used", "...
train
https://github.com/scdoshi/django-bits/blob/0a2f4fd9374d2a8acb8df9a7b83eebcf2782256f/bits/templatetags/custom_utils.py#L19-L37
KnowledgeLinks/rdfframework
rdfframework/utilities/fileutilities.py
is_writable_dir
def is_writable_dir(directory, **kwargs): """ tests to see if the directory is writable. If the directory does it can attempt to create it. If unable returns False args: directory: filepath to the directory kwargs: mkdir[bool]: create the directory if it does not exist ...
python
def is_writable_dir(directory, **kwargs): """ tests to see if the directory is writable. If the directory does it can attempt to create it. If unable returns False args: directory: filepath to the directory kwargs: mkdir[bool]: create the directory if it does not exist ...
[ "def", "is_writable_dir", "(", "directory", ",", "*", "*", "kwargs", ")", ":", "try", ":", "testfile", "=", "tempfile", ".", "TemporaryFile", "(", "dir", "=", "directory", ")", "testfile", ".", "close", "(", ")", "except", "OSError", "as", "e", ":", "i...
tests to see if the directory is writable. If the directory does it can attempt to create it. If unable returns False args: directory: filepath to the directory kwargs: mkdir[bool]: create the directory if it does not exist returns
[ "tests", "to", "see", "if", "the", "directory", "is", "writable", ".", "If", "the", "directory", "does", "it", "can", "attempt", "to", "create", "it", ".", "If", "unable", "returns", "False", "args", ":", "directory", ":", "filepath", "to", "the", "direc...
train
https://github.com/KnowledgeLinks/rdfframework/blob/9ec32dcc4bed51650a4b392cc5c15100fef7923a/rdfframework/utilities/fileutilities.py#L15-L43
KnowledgeLinks/rdfframework
rdfframework/utilities/fileutilities.py
list_files
def list_files(file_directory, file_extensions=None, include_subfolders=True, include_root=True, root_dir=None): '''Returns a list of files args: file_directory: a sting path to the file directory file_extensions: a list of fi...
python
def list_files(file_directory, file_extensions=None, include_subfolders=True, include_root=True, root_dir=None): '''Returns a list of files args: file_directory: a sting path to the file directory file_extensions: a list of fi...
[ "def", "list_files", "(", "file_directory", ",", "file_extensions", "=", "None", ",", "include_subfolders", "=", "True", ",", "include_root", "=", "True", ",", "root_dir", "=", "None", ")", ":", "log", "=", "logging", ".", "getLogger", "(", "\"%s\"", "%", ...
Returns a list of files args: file_directory: a sting path to the file directory file_extensions: a list of file extensions to filter example ['xml', 'rdf']. If none include all files include_subfolders: as implied include_root: whether to include the root in ...
[ "Returns", "a", "list", "of", "files", "args", ":", "file_directory", ":", "a", "sting", "path", "to", "the", "file", "directory", "file_extensions", ":", "a", "list", "of", "file", "extensions", "to", "filter", "example", "[", "xml", "rdf", "]", ".", "I...
train
https://github.com/KnowledgeLinks/rdfframework/blob/9ec32dcc4bed51650a4b392cc5c15100fef7923a/rdfframework/utilities/fileutilities.py#L45-L98
alexhayes/django-toolkit
django_toolkit/templatetags/sliced_pagination.py
sliced_pagination
def sliced_pagination(parser, token): """ Slices a paginator. Syntax: {% sliced_pagination page 5 as sliced_paginator %} where - page is an instance of the Django `Page` class. - max_items are the number of items to be shown in total. Ie., 5 will yield << 1 2 3 4 5 ... >>...
python
def sliced_pagination(parser, token): """ Slices a paginator. Syntax: {% sliced_pagination page 5 as sliced_paginator %} where - page is an instance of the Django `Page` class. - max_items are the number of items to be shown in total. Ie., 5 will yield << 1 2 3 4 5 ... >>...
[ "def", "sliced_pagination", "(", "parser", ",", "token", ")", ":", "try", ":", "fnctn", ",", "paginatorname", ",", "max_items", ",", "trash", ",", "context_name", "=", "token", ".", "split_contents", "(", ")", "except", "ValueError", ":", "raise", "TemplateS...
Slices a paginator. Syntax: {% sliced_pagination page 5 as sliced_paginator %} where - page is an instance of the Django `Page` class. - max_items are the number of items to be shown in total. Ie., 5 will yield << 1 2 3 4 5 ... >> or << ... 4 5 6 7 8 ... >> ...
[ "Slices", "a", "paginator", ".", "Syntax", ":", "{", "%", "sliced_pagination", "page", "5", "as", "sliced_paginator", "%", "}", "where", "-", "page", "is", "an", "instance", "of", "the", "Django", "Page", "class", ".", "-", "max_items", "are", "the", "nu...
train
https://github.com/alexhayes/django-toolkit/blob/b64106392fad596defc915b8235fe6e1d0013b5b/django_toolkit/templatetags/sliced_pagination.py#L147-L196
alexhayes/django-toolkit
django_toolkit/templatetags/sliced_pagination.py
_SlicedPaginator._build_full_list
def _build_full_list(self): """Build a full list of pages. Examples: >>> _SlicedPaginator(1, 7, 5)._build_full_list() [1, 2, 3, 4, 5] >>> _SlicedPaginator(6, 7, 5)._build_full_list() [3, 4, 5, 6, 7] >>> _SlicedPaginator(6, 7, 5)._build_full_list() ...
python
def _build_full_list(self): """Build a full list of pages. Examples: >>> _SlicedPaginator(1, 7, 5)._build_full_list() [1, 2, 3, 4, 5] >>> _SlicedPaginator(6, 7, 5)._build_full_list() [3, 4, 5, 6, 7] >>> _SlicedPaginator(6, 7, 5)._build_full_list() ...
[ "def", "_build_full_list", "(", "self", ")", ":", "if", "self", ".", "npages", "<=", "self", ".", "maxpages_items", ":", "return", "range", "(", "1", ",", "self", ".", "npages", "+", "1", ")", "else", ":", "l", "=", "range", "(", "self", ".", "curp...
Build a full list of pages. Examples: >>> _SlicedPaginator(1, 7, 5)._build_full_list() [1, 2, 3, 4, 5] >>> _SlicedPaginator(6, 7, 5)._build_full_list() [3, 4, 5, 6, 7] >>> _SlicedPaginator(6, 7, 5)._build_full_list() [3, 4, 5, 6, 7] >>> import ite...
[ "Build", "a", "full", "list", "of", "pages", ".", "Examples", ":", ">>>", "_SlicedPaginator", "(", "1", "7", "5", ")", ".", "_build_full_list", "()", "[", "1", "2", "3", "4", "5", "]", ">>>", "_SlicedPaginator", "(", "6", "7", "5", ")", ".", "_buil...
train
https://github.com/alexhayes/django-toolkit/blob/b64106392fad596defc915b8235fe6e1d0013b5b/django_toolkit/templatetags/sliced_pagination.py#L29-L61
alexhayes/django-toolkit
django_toolkit/templatetags/sliced_pagination.py
_SlicedPaginator.hidden_next_pages
def hidden_next_pages(self): """Check if the next pages where sliced. Example: >>> map(lambda i: _SlicedPaginator(i, 6, 3).hidden_next_pages(), range(1, 7)) [True, True, True, True, False, False] >>> map(lambda i: _SlicedPaginator(i, 7, 3).hidden_next_pages(), range(1, 8...
python
def hidden_next_pages(self): """Check if the next pages where sliced. Example: >>> map(lambda i: _SlicedPaginator(i, 6, 3).hidden_next_pages(), range(1, 7)) [True, True, True, True, False, False] >>> map(lambda i: _SlicedPaginator(i, 7, 3).hidden_next_pages(), range(1, 8...
[ "def", "hidden_next_pages", "(", "self", ")", ":", "next_pages", "=", "self", ".", "next_pages", "(", ")", "return", "len", "(", "next_pages", ")", ">", "0", "and", "next_pages", "[", "-", "1", "]", "<", "self", ".", "npages" ]
Check if the next pages where sliced. Example: >>> map(lambda i: _SlicedPaginator(i, 6, 3).hidden_next_pages(), range(1, 7)) [True, True, True, True, False, False] >>> map(lambda i: _SlicedPaginator(i, 7, 3).hidden_next_pages(), range(1, 8)) [True, True, True, True, True...
[ "Check", "if", "the", "next", "pages", "where", "sliced", ".", "Example", ":", ">>>", "map", "(", "lambda", "i", ":", "_SlicedPaginator", "(", "i", "6", "3", ")", ".", "hidden_next_pages", "()", "range", "(", "1", "7", "))", "[", "True", "True", "Tru...
train
https://github.com/alexhayes/django-toolkit/blob/b64106392fad596defc915b8235fe6e1d0013b5b/django_toolkit/templatetags/sliced_pagination.py#L110-L124
ryanjdillon/pyotelem
pyotelem/plots/plotutils.py
roundup
def roundup(x, order): '''Round a number to the passed order Args ---- x: float Number to be rounded order: int Order to which `x` should be rounded Returns ------- x_round: float The passed value rounded to the passed order ''' return x if x % 10**order...
python
def roundup(x, order): '''Round a number to the passed order Args ---- x: float Number to be rounded order: int Order to which `x` should be rounded Returns ------- x_round: float The passed value rounded to the passed order ''' return x if x % 10**order...
[ "def", "roundup", "(", "x", ",", "order", ")", ":", "return", "x", "if", "x", "%", "10", "**", "order", "==", "0", "else", "x", "+", "10", "**", "order", "-", "x", "%", "10", "**", "order" ]
Round a number to the passed order Args ---- x: float Number to be rounded order: int Order to which `x` should be rounded Returns ------- x_round: float The passed value rounded to the passed order
[ "Round", "a", "number", "to", "the", "passed", "order" ]
train
https://github.com/ryanjdillon/pyotelem/blob/816563a9c3feb3fa416f1c2921c6b75db34111ad/pyotelem/plots/plotutils.py#L7-L22
ryanjdillon/pyotelem
pyotelem/plots/plotutils.py
hourminsec
def hourminsec(n_seconds): '''Generate a string of hours and minutes from total number of seconds Args ---- n_seconds: int Total number of seconds to calculate hours, minutes, and seconds from Returns ------- hours: int Number of hours in `n_seconds` minutes: int ...
python
def hourminsec(n_seconds): '''Generate a string of hours and minutes from total number of seconds Args ---- n_seconds: int Total number of seconds to calculate hours, minutes, and seconds from Returns ------- hours: int Number of hours in `n_seconds` minutes: int ...
[ "def", "hourminsec", "(", "n_seconds", ")", ":", "hours", ",", "remainder", "=", "divmod", "(", "n_seconds", ",", "3600", ")", "minutes", ",", "seconds", "=", "divmod", "(", "remainder", ",", "60", ")", "return", "abs", "(", "hours", ")", ",", "abs", ...
Generate a string of hours and minutes from total number of seconds Args ---- n_seconds: int Total number of seconds to calculate hours, minutes, and seconds from Returns ------- hours: int Number of hours in `n_seconds` minutes: int Remaining minutes in `n_seconds`...
[ "Generate", "a", "string", "of", "hours", "and", "minutes", "from", "total", "number", "of", "seconds" ]
train
https://github.com/ryanjdillon/pyotelem/blob/816563a9c3feb3fa416f1c2921c6b75db34111ad/pyotelem/plots/plotutils.py#L42-L63
ryanjdillon/pyotelem
pyotelem/plots/plotutils.py
nsamples_to_hourminsec
def nsamples_to_hourminsec(x, pos): '''Convert axes labels to experiment duration in hours/minutes/seconds Notes ----- Matplotlib FuncFormatter function https://matplotlib.org/examples/pylab_examples/custom_ticker1.html ''' h, m, s = hourminsec(x/16.0) return '{:.0f}h {:2.0f}′ {:2.1f}″...
python
def nsamples_to_hourminsec(x, pos): '''Convert axes labels to experiment duration in hours/minutes/seconds Notes ----- Matplotlib FuncFormatter function https://matplotlib.org/examples/pylab_examples/custom_ticker1.html ''' h, m, s = hourminsec(x/16.0) return '{:.0f}h {:2.0f}′ {:2.1f}″...
[ "def", "nsamples_to_hourminsec", "(", "x", ",", "pos", ")", ":", "h", ",", "m", ",", "s", "=", "hourminsec", "(", "x", "/", "16.0", ")", "return", "'{:.0f}h {:2.0f}′ {:2.1f}″'.for", "m", "at(h, ", "m", ",", " ", ")", "", "", "" ]
Convert axes labels to experiment duration in hours/minutes/seconds Notes ----- Matplotlib FuncFormatter function https://matplotlib.org/examples/pylab_examples/custom_ticker1.html
[ "Convert", "axes", "labels", "to", "experiment", "duration", "in", "hours", "/", "minutes", "/", "seconds" ]
train
https://github.com/ryanjdillon/pyotelem/blob/816563a9c3feb3fa416f1c2921c6b75db34111ad/pyotelem/plots/plotutils.py#L66-L76
ryanjdillon/pyotelem
pyotelem/plots/plotutils.py
nsamples_to_hourmin
def nsamples_to_hourmin(x, pos): '''Convert axes labels to experiment duration in hours/minutes Notes ----- Matplotlib FuncFormatter function https://matplotlib.org/examples/pylab_examples/custom_ticker1.html ''' h, m, s = hourminsec(x/16.0) return '{:.0f}h {:2.0f}′'.format(h, m+round(...
python
def nsamples_to_hourmin(x, pos): '''Convert axes labels to experiment duration in hours/minutes Notes ----- Matplotlib FuncFormatter function https://matplotlib.org/examples/pylab_examples/custom_ticker1.html ''' h, m, s = hourminsec(x/16.0) return '{:.0f}h {:2.0f}′'.format(h, m+round(...
[ "def", "nsamples_to_hourmin", "(", "x", ",", "pos", ")", ":", "h", ",", "m", ",", "s", "=", "hourminsec", "(", "x", "/", "16.0", ")", "return", "'{:.0f}h {:2.0f}′'.f", "o", "rmat(h", ",", " ", "m", "r", "o", "und(s", ")", ")", "", "" ]
Convert axes labels to experiment duration in hours/minutes Notes ----- Matplotlib FuncFormatter function https://matplotlib.org/examples/pylab_examples/custom_ticker1.html
[ "Convert", "axes", "labels", "to", "experiment", "duration", "in", "hours", "/", "minutes" ]
train
https://github.com/ryanjdillon/pyotelem/blob/816563a9c3feb3fa416f1c2921c6b75db34111ad/pyotelem/plots/plotutils.py#L79-L89
ryanjdillon/pyotelem
pyotelem/plots/plotutils.py
nsamples_to_minsec
def nsamples_to_minsec(x, pos): '''Convert axes labels to experiment duration in minutes/seconds Notes ----- Matplotlib FuncFormatter function https://matplotlib.org/examples/pylab_examples/custom_ticker1.html ''' h, m, s = hourminsec(x/16.0) return '{:2.0f}′ {:2.1f}″'.format(m+(h*60), ...
python
def nsamples_to_minsec(x, pos): '''Convert axes labels to experiment duration in minutes/seconds Notes ----- Matplotlib FuncFormatter function https://matplotlib.org/examples/pylab_examples/custom_ticker1.html ''' h, m, s = hourminsec(x/16.0) return '{:2.0f}′ {:2.1f}″'.format(m+(h*60), ...
[ "def", "nsamples_to_minsec", "(", "x", ",", "pos", ")", ":", "h", ",", "m", ",", "s", "=", "hourminsec", "(", "x", "/", "16.0", ")", "return", "'{:2.0f}′ {:2.1f}″'.for", "m", "at(m+(", "h", "*", "6", "0", ")", ",", " s", ")", "", "", "" ]
Convert axes labels to experiment duration in minutes/seconds Notes ----- Matplotlib FuncFormatter function https://matplotlib.org/examples/pylab_examples/custom_ticker1.html
[ "Convert", "axes", "labels", "to", "experiment", "duration", "in", "minutes", "/", "seconds" ]
train
https://github.com/ryanjdillon/pyotelem/blob/816563a9c3feb3fa416f1c2921c6b75db34111ad/pyotelem/plots/plotutils.py#L92-L101
ryanjdillon/pyotelem
pyotelem/plots/plotutils.py
add_alpha_labels
def add_alpha_labels(axes, xpos=0.03, ypos=0.95, suffix='', color=None, fontsize=14, fontweight='normal', boxstyle='square', facecolor='white', edgecolor='white', alpha=1.0): '''Add sequential alphbet labels to subplot axes Args ---- axes: list of pyplot.ax A list of matplotlib ...
python
def add_alpha_labels(axes, xpos=0.03, ypos=0.95, suffix='', color=None, fontsize=14, fontweight='normal', boxstyle='square', facecolor='white', edgecolor='white', alpha=1.0): '''Add sequential alphbet labels to subplot axes Args ---- axes: list of pyplot.ax A list of matplotlib ...
[ "def", "add_alpha_labels", "(", "axes", ",", "xpos", "=", "0.03", ",", "ypos", "=", "0.95", ",", "suffix", "=", "''", ",", "color", "=", "None", ",", "fontsize", "=", "14", ",", "fontweight", "=", "'normal'", ",", "boxstyle", "=", "'square'", ",", "f...
Add sequential alphbet labels to subplot axes Args ---- axes: list of pyplot.ax A list of matplotlib axes to add the label labels to xpos: float or array_like X position(s) of labels in figure coordinates ypos: float or array_like Y position(s) of labels in figure coordinate...
[ "Add", "sequential", "alphbet", "labels", "to", "subplot", "axes" ]
train
https://github.com/ryanjdillon/pyotelem/blob/816563a9c3feb3fa416f1c2921c6b75db34111ad/pyotelem/plots/plotutils.py#L104-L179
ryanjdillon/pyotelem
pyotelem/plots/plotutils.py
merge_limits
def merge_limits(axes, xlim=True, ylim=True): '''Set maximum and minimum limits from list of axis objects to each axis Args ---- axes: iterable list of `matplotlib.pyplot` axis objects whose limits should be modified xlim: bool Flag to set modification of x axis limits ylim: boo...
python
def merge_limits(axes, xlim=True, ylim=True): '''Set maximum and minimum limits from list of axis objects to each axis Args ---- axes: iterable list of `matplotlib.pyplot` axis objects whose limits should be modified xlim: bool Flag to set modification of x axis limits ylim: boo...
[ "def", "merge_limits", "(", "axes", ",", "xlim", "=", "True", ",", "ylim", "=", "True", ")", ":", "# Compile lists of all x/y limits", "xlims", "=", "list", "(", ")", "ylims", "=", "list", "(", ")", "for", "ax", "in", "axes", ":", "[", "xlims", ".", ...
Set maximum and minimum limits from list of axis objects to each axis Args ---- axes: iterable list of `matplotlib.pyplot` axis objects whose limits should be modified xlim: bool Flag to set modification of x axis limits ylim: bool Flag to set modification of y axis limits
[ "Set", "maximum", "and", "minimum", "limits", "from", "list", "of", "axis", "objects", "to", "each", "axis" ]
train
https://github.com/ryanjdillon/pyotelem/blob/816563a9c3feb3fa416f1c2921c6b75db34111ad/pyotelem/plots/plotutils.py#L182-L209
ryanjdillon/pyotelem
pyotelem/plots/plotutils.py
plot_noncontiguous
def plot_noncontiguous(ax, data, ind, color='black', label='', offset=0, linewidth=0.5, linestyle='-'): '''Plot non-contiguous slice of data Args ---- data: ndarray The data with non continguous regions to plot ind: ndarray indices of data to be plotted color: matplotlib...
python
def plot_noncontiguous(ax, data, ind, color='black', label='', offset=0, linewidth=0.5, linestyle='-'): '''Plot non-contiguous slice of data Args ---- data: ndarray The data with non continguous regions to plot ind: ndarray indices of data to be plotted color: matplotlib...
[ "def", "plot_noncontiguous", "(", "ax", ",", "data", ",", "ind", ",", "color", "=", "'black'", ",", "label", "=", "''", ",", "offset", "=", "0", ",", "linewidth", "=", "0.5", ",", "linestyle", "=", "'-'", ")", ":", "def", "slice_with_nans", "(", "ind...
Plot non-contiguous slice of data Args ---- data: ndarray The data with non continguous regions to plot ind: ndarray indices of data to be plotted color: matplotlib color Color of plotted line label: str Name to be shown in legend offset: int The numb...
[ "Plot", "non", "-", "contiguous", "slice", "of", "data" ]
train
https://github.com/ryanjdillon/pyotelem/blob/816563a9c3feb3fa416f1c2921c6b75db34111ad/pyotelem/plots/plotutils.py#L212-L261
ryanjdillon/pyotelem
pyotelem/plots/plotutils.py
plot_shade_mask
def plot_shade_mask(ax, ind, mask, facecolor='gray', alpha=0.5): '''Shade across x values where boolean mask is `True` Args ---- ax: pyplot.ax Axes object to plot with a shaded region ind: ndarray The indices to use for the x-axis values of the data mask: ndarray Boolean...
python
def plot_shade_mask(ax, ind, mask, facecolor='gray', alpha=0.5): '''Shade across x values where boolean mask is `True` Args ---- ax: pyplot.ax Axes object to plot with a shaded region ind: ndarray The indices to use for the x-axis values of the data mask: ndarray Boolean...
[ "def", "plot_shade_mask", "(", "ax", ",", "ind", ",", "mask", ",", "facecolor", "=", "'gray'", ",", "alpha", "=", "0.5", ")", ":", "ymin", ",", "ymax", "=", "ax", ".", "get_ylim", "(", ")", "ax", ".", "fill_between", "(", "ind", ",", "ymin", ",", ...
Shade across x values where boolean mask is `True` Args ---- ax: pyplot.ax Axes object to plot with a shaded region ind: ndarray The indices to use for the x-axis values of the data mask: ndarray Boolean mask array to determine which regions should be shaded facecolor: m...
[ "Shade", "across", "x", "values", "where", "boolean", "mask", "is", "True" ]
train
https://github.com/ryanjdillon/pyotelem/blob/816563a9c3feb3fa416f1c2921c6b75db34111ad/pyotelem/plots/plotutils.py#L264-L286
monkeython/scriba
scriba/schemes/scriba_http.py
write
def write(url, content, **args): """Put the object/collection into a file URL.""" with HTTPResource(url, **args) as resource: resource.write(content)
python
def write(url, content, **args): """Put the object/collection into a file URL.""" with HTTPResource(url, **args) as resource: resource.write(content)
[ "def", "write", "(", "url", ",", "content", ",", "*", "*", "args", ")", ":", "with", "HTTPResource", "(", "url", ",", "*", "*", "args", ")", "as", "resource", ":", "resource", ".", "write", "(", "content", ")" ]
Put the object/collection into a file URL.
[ "Put", "the", "object", "/", "collection", "into", "a", "file", "URL", "." ]
train
https://github.com/monkeython/scriba/blob/fb8e7636ed07c3d035433fdd153599ac8b24dfc4/scriba/schemes/scriba_http.py#L90-L93
emlazzarin/acrylic
acrylic/datatable.py
parse_column
def parse_column(column): """ Helper method for DataTable.fromcsvstring() Given a list, parse_column tries to see if it should cast everything in that list to a float, an int, or leave it as is. Always returns a list. """ try: float_attempt = [float(i) for i in column] except V...
python
def parse_column(column): """ Helper method for DataTable.fromcsvstring() Given a list, parse_column tries to see if it should cast everything in that list to a float, an int, or leave it as is. Always returns a list. """ try: float_attempt = [float(i) for i in column] except V...
[ "def", "parse_column", "(", "column", ")", ":", "try", ":", "float_attempt", "=", "[", "float", "(", "i", ")", "for", "i", "in", "column", "]", "except", "ValueError", ":", "return", "column", "else", ":", "try", ":", "int_attempt", "=", "[", "int", ...
Helper method for DataTable.fromcsvstring() Given a list, parse_column tries to see if it should cast everything in that list to a float, an int, or leave it as is. Always returns a list.
[ "Helper", "method", "for", "DataTable", ".", "fromcsvstring", "()" ]
train
https://github.com/emlazzarin/acrylic/blob/08c6702d73b9660ead1024653f4fa016f6340e46/acrylic/datatable.py#L881-L900
emlazzarin/acrylic
acrylic/datatable.py
DataTable.fields
def fields(self, new_fieldnames): """ Overwrite all field names with new field names. Mass renaming. """ if len(new_fieldnames) != len(self.fields): raise Exception("Cannot replace fieldnames (len: %s) with list of " "incorrect length (len: %s)" % ...
python
def fields(self, new_fieldnames): """ Overwrite all field names with new field names. Mass renaming. """ if len(new_fieldnames) != len(self.fields): raise Exception("Cannot replace fieldnames (len: %s) with list of " "incorrect length (len: %s)" % ...
[ "def", "fields", "(", "self", ",", "new_fieldnames", ")", ":", "if", "len", "(", "new_fieldnames", ")", "!=", "len", "(", "self", ".", "fields", ")", ":", "raise", "Exception", "(", "\"Cannot replace fieldnames (len: %s) with list of \"", "\"incorrect length (len: %...
Overwrite all field names with new field names. Mass renaming.
[ "Overwrite", "all", "field", "names", "with", "new", "field", "names", ".", "Mass", "renaming", "." ]
train
https://github.com/emlazzarin/acrylic/blob/08c6702d73b9660ead1024653f4fa016f6340e46/acrylic/datatable.py#L140-L150
emlazzarin/acrylic
acrylic/datatable.py
DataTable.fromcsvstring
def fromcsvstring(cls, csvstring, delimiter=",", quotechar="\""): """ Takes one string that represents the entire contents of the CSV file, or similar delimited file. If you have a list of lists, where the first list is the headers, then use the main constructor. If you...
python
def fromcsvstring(cls, csvstring, delimiter=",", quotechar="\""): """ Takes one string that represents the entire contents of the CSV file, or similar delimited file. If you have a list of lists, where the first list is the headers, then use the main constructor. If you...
[ "def", "fromcsvstring", "(", "cls", ",", "csvstring", ",", "delimiter", "=", "\",\"", ",", "quotechar", "=", "\"\\\"\"", ")", ":", "if", "not", "isinstance", "(", "csvstring", ",", "basestring", ")", ":", "raise", "Exception", "(", "\"If trying to construct a ...
Takes one string that represents the entire contents of the CSV file, or similar delimited file. If you have a list of lists, where the first list is the headers, then use the main constructor. If you see an excess of whitespace in the first column of your data, this is probabl...
[ "Takes", "one", "string", "that", "represents", "the", "entire", "contents", "of", "the", "CSV", "file", "or", "similar", "delimited", "file", "." ]
train
https://github.com/emlazzarin/acrylic/blob/08c6702d73b9660ead1024653f4fa016f6340e46/acrylic/datatable.py#L175-L228
emlazzarin/acrylic
acrylic/datatable.py
DataTable.fromdict
def fromdict(cls, datadict): """ Constructs a new DataTable using a dictionary of the format: {field1: [a,b,c], field2: [d,e,f], field3: [g,h,i]} ... which most closely matches the internal representation of the DataTable. If it is an OrderedDict, the key orde...
python
def fromdict(cls, datadict): """ Constructs a new DataTable using a dictionary of the format: {field1: [a,b,c], field2: [d,e,f], field3: [g,h,i]} ... which most closely matches the internal representation of the DataTable. If it is an OrderedDict, the key orde...
[ "def", "fromdict", "(", "cls", ",", "datadict", ")", ":", "new_datatable", "=", "cls", "(", ")", "for", "field", ",", "column", "in", "datadict", ".", "items", "(", ")", ":", "new_datatable", "[", "field", "]", "=", "column", "return", "new_datatable" ]
Constructs a new DataTable using a dictionary of the format: {field1: [a,b,c], field2: [d,e,f], field3: [g,h,i]} ... which most closely matches the internal representation of the DataTable. If it is an OrderedDict, the key order will be preserved.
[ "Constructs", "a", "new", "DataTable", "using", "a", "dictionary", "of", "the", "format", ":" ]
train
https://github.com/emlazzarin/acrylic/blob/08c6702d73b9660ead1024653f4fa016f6340e46/acrylic/datatable.py#L238-L253
emlazzarin/acrylic
acrylic/datatable.py
DataTable.fromexcel
def fromexcel(cls, path, sheet_name_or_num=0, headers=None): """ Constructs a new DataTable from an Excel file. Specify sheet_name_or_number to load that specific sheet. Headers will be inferred automatically, but if you'd prefer to load only a subset of all the headers, pass i...
python
def fromexcel(cls, path, sheet_name_or_num=0, headers=None): """ Constructs a new DataTable from an Excel file. Specify sheet_name_or_number to load that specific sheet. Headers will be inferred automatically, but if you'd prefer to load only a subset of all the headers, pass i...
[ "def", "fromexcel", "(", "cls", ",", "path", ",", "sheet_name_or_num", "=", "0", ",", "headers", "=", "None", ")", ":", "reader", "=", "ExcelRW", ".", "UnicodeDictReader", "(", "path", ",", "sheet_name_or_num", ")", "return", "cls", "(", "reader", ",", "...
Constructs a new DataTable from an Excel file. Specify sheet_name_or_number to load that specific sheet. Headers will be inferred automatically, but if you'd prefer to load only a subset of all the headers, pass in a list of the headers you'd like as `headers`. --- Al...
[ "Constructs", "a", "new", "DataTable", "from", "an", "Excel", "file", "." ]
train
https://github.com/emlazzarin/acrylic/blob/08c6702d73b9660ead1024653f4fa016f6340e46/acrylic/datatable.py#L256-L275
emlazzarin/acrylic
acrylic/datatable.py
DataTable.__print_table
def __print_table(self, row_delim, header_delim=None, header_pad=u"", pad=u""): """ row_delim default delimiter inserted between columns of every row in the table. header_delim delimiter inserted within the headers. by default ...
python
def __print_table(self, row_delim, header_delim=None, header_pad=u"", pad=u""): """ row_delim default delimiter inserted between columns of every row in the table. header_delim delimiter inserted within the headers. by default ...
[ "def", "__print_table", "(", "self", ",", "row_delim", ",", "header_delim", "=", "None", ",", "header_pad", "=", "u\"\"", ",", "pad", "=", "u\"\"", ")", ":", "if", "header_delim", "is", "None", ":", "header_delim", "=", "row_delim", "num_cols", "=", "len",...
row_delim default delimiter inserted between columns of every row in the table. header_delim delimiter inserted within the headers. by default takes the value of `row_delim` header_pad put on the sides of the row of headers. ...
[ "row_delim", "default", "delimiter", "inserted", "between", "columns", "of", "every", "row", "in", "the", "table", ".", "header_delim", "delimiter", "inserted", "within", "the", "headers", ".", "by", "default", "takes", "the", "value", "of", "row_delim", "header...
train
https://github.com/emlazzarin/acrylic/blob/08c6702d73b9660ead1024653f4fa016f6340e46/acrylic/datatable.py#L373-L393
emlazzarin/acrylic
acrylic/datatable.py
DataTable.append
def append(self, row): """ Takes a dict, a list/tuple/generator, or a DataRow/namedtuple, and appends it to the "bottom" or "end" of the DataTable. dicts must share the same keys as the DataTable's columns. lists/tuples/generators are simply trusted to be in the correct order ...
python
def append(self, row): """ Takes a dict, a list/tuple/generator, or a DataRow/namedtuple, and appends it to the "bottom" or "end" of the DataTable. dicts must share the same keys as the DataTable's columns. lists/tuples/generators are simply trusted to be in the correct order ...
[ "def", "append", "(", "self", ",", "row", ")", ":", "if", "isinstance", "(", "row", ",", "dict", ")", ":", "if", "self", ".", "fields", "and", "not", "set", "(", "row", ".", "keys", "(", ")", ")", "==", "set", "(", "self", ".", "fields", ")", ...
Takes a dict, a list/tuple/generator, or a DataRow/namedtuple, and appends it to the "bottom" or "end" of the DataTable. dicts must share the same keys as the DataTable's columns. lists/tuples/generators are simply trusted to be in the correct order and of the correct type (if relevant...
[ "Takes", "a", "dict", "a", "list", "/", "tuple", "/", "generator", "or", "a", "DataRow", "/", "namedtuple", "and", "appends", "it", "to", "the", "bottom", "or", "end", "of", "the", "DataTable", "." ]
train
https://github.com/emlazzarin/acrylic/blob/08c6702d73b9660ead1024653f4fa016f6340e46/acrylic/datatable.py#L422-L484
emlazzarin/acrylic
acrylic/datatable.py
DataTable.apply
def apply(self, func, *fields): """ Applies the function, `func`, to every row in the DataTable. If no fields are supplied, the entire row is passed to `func`. If fields are supplied, the values at all of those fields are passed into func in that order. --- data[...
python
def apply(self, func, *fields): """ Applies the function, `func`, to every row in the DataTable. If no fields are supplied, the entire row is passed to `func`. If fields are supplied, the values at all of those fields are passed into func in that order. --- data[...
[ "def", "apply", "(", "self", ",", "func", ",", "*", "fields", ")", ":", "results", "=", "[", "]", "for", "row", "in", "self", ":", "if", "not", "fields", ":", "results", ".", "append", "(", "func", "(", "row", ")", ")", "else", ":", "if", "any"...
Applies the function, `func`, to every row in the DataTable. If no fields are supplied, the entire row is passed to `func`. If fields are supplied, the values at all of those fields are passed into func in that order. --- data['diff'] = data.apply(short_diff, 'old_count', 'new_c...
[ "Applies", "the", "function", "func", "to", "every", "row", "in", "the", "DataTable", "." ]
train
https://github.com/emlazzarin/acrylic/blob/08c6702d73b9660ead1024653f4fa016f6340e46/acrylic/datatable.py#L486-L507
emlazzarin/acrylic
acrylic/datatable.py
DataTable.col
def col(self, col_name_or_num): """ Returns the col at index `colnum` or name `colnum`. """ if isinstance(col_name_or_num, basestring): return self[col_name_or_num] elif isinstance(col_name_or_num, (int, long)): if col_name_or_num > len(self.fields): ...
python
def col(self, col_name_or_num): """ Returns the col at index `colnum` or name `colnum`. """ if isinstance(col_name_or_num, basestring): return self[col_name_or_num] elif isinstance(col_name_or_num, (int, long)): if col_name_or_num > len(self.fields): ...
[ "def", "col", "(", "self", ",", "col_name_or_num", ")", ":", "if", "isinstance", "(", "col_name_or_num", ",", "basestring", ")", ":", "return", "self", "[", "col_name_or_num", "]", "elif", "isinstance", "(", "col_name_or_num", ",", "(", "int", ",", "long", ...
Returns the col at index `colnum` or name `colnum`.
[ "Returns", "the", "col", "at", "index", "colnum", "or", "name", "colnum", "." ]
train
https://github.com/emlazzarin/acrylic/blob/08c6702d73b9660ead1024653f4fa016f6340e46/acrylic/datatable.py#L509-L519
emlazzarin/acrylic
acrylic/datatable.py
DataTable.concat
def concat(self, other_datatable, inplace=False): """ Concatenates two DataTables together, as long as column names are identical (ignoring order). The resulting DataTable's columns are in the order of the table whose `concat` method was called. """ if not isinstance(othe...
python
def concat(self, other_datatable, inplace=False): """ Concatenates two DataTables together, as long as column names are identical (ignoring order). The resulting DataTable's columns are in the order of the table whose `concat` method was called. """ if not isinstance(othe...
[ "def", "concat", "(", "self", ",", "other_datatable", ",", "inplace", "=", "False", ")", ":", "if", "not", "isinstance", "(", "other_datatable", ",", "DataTable", ")", ":", "raise", "TypeError", "(", "\"`concat` requires a DataTable, not a %s\"", "%", "type", "(...
Concatenates two DataTables together, as long as column names are identical (ignoring order). The resulting DataTable's columns are in the order of the table whose `concat` method was called.
[ "Concatenates", "two", "DataTables", "together", "as", "long", "as", "column", "names", "are", "identical", "(", "ignoring", "order", ")", ".", "The", "resulting", "DataTable", "s", "columns", "are", "in", "the", "order", "of", "the", "table", "whose", "conc...
train
https://github.com/emlazzarin/acrylic/blob/08c6702d73b9660ead1024653f4fa016f6340e46/acrylic/datatable.py#L521-L561
emlazzarin/acrylic
acrylic/datatable.py
DataTable.distinct
def distinct(self, fieldname, key=None): """ Returns the unique values seen at `fieldname`. """ return tuple(unique_everseen(self[fieldname], key=key))
python
def distinct(self, fieldname, key=None): """ Returns the unique values seen at `fieldname`. """ return tuple(unique_everseen(self[fieldname], key=key))
[ "def", "distinct", "(", "self", ",", "fieldname", ",", "key", "=", "None", ")", ":", "return", "tuple", "(", "unique_everseen", "(", "self", "[", "fieldname", "]", ",", "key", "=", "key", ")", ")" ]
Returns the unique values seen at `fieldname`.
[ "Returns", "the", "unique", "values", "seen", "at", "fieldname", "." ]
train
https://github.com/emlazzarin/acrylic/blob/08c6702d73b9660ead1024653f4fa016f6340e46/acrylic/datatable.py#L566-L570
emlazzarin/acrylic
acrylic/datatable.py
DataTable.join
def join(self, right_table, on=None, right_prefix='R.', outer=False): """ Inner-joins another DataTable to this one using `on` (iterable of join keys). If two tables share columns other than the join keys, appends right_prefix to the right table's column name. If `on` is not prov...
python
def join(self, right_table, on=None, right_prefix='R.', outer=False): """ Inner-joins another DataTable to this one using `on` (iterable of join keys). If two tables share columns other than the join keys, appends right_prefix to the right table's column name. If `on` is not prov...
[ "def", "join", "(", "self", ",", "right_table", ",", "on", "=", "None", ",", "right_prefix", "=", "'R.'", ",", "outer", "=", "False", ")", ":", "if", "on", "is", "None", ":", "# if no 'on', perform natural join", "on", "=", "list", "(", "set", "(", "se...
Inner-joins another DataTable to this one using `on` (iterable of join keys). If two tables share columns other than the join keys, appends right_prefix to the right table's column name. If `on` is not provided, performs a 'natural join' using all columns of the same name.
[ "Inner", "-", "joins", "another", "DataTable", "to", "this", "one", "using", "on", "(", "iterable", "of", "join", "keys", ")", ".", "If", "two", "tables", "share", "columns", "other", "than", "the", "join", "keys", "appends", "right_prefix", "to", "the", ...
train
https://github.com/emlazzarin/acrylic/blob/08c6702d73b9660ead1024653f4fa016f6340e46/acrylic/datatable.py#L579-L623
emlazzarin/acrylic
acrylic/datatable.py
DataTable.mask
def mask(self, masklist): """ `masklist` is an array of Bools or equivalent. This returns a new DataTable using only the rows that were True (or equivalent) in the mask. """ if not hasattr(masklist, '__len__'): masklist = tuple(masklist) if len(maskl...
python
def mask(self, masklist): """ `masklist` is an array of Bools or equivalent. This returns a new DataTable using only the rows that were True (or equivalent) in the mask. """ if not hasattr(masklist, '__len__'): masklist = tuple(masklist) if len(maskl...
[ "def", "mask", "(", "self", ",", "masklist", ")", ":", "if", "not", "hasattr", "(", "masklist", ",", "'__len__'", ")", ":", "masklist", "=", "tuple", "(", "masklist", ")", "if", "len", "(", "masklist", ")", "!=", "len", "(", "self", ")", ":", "rais...
`masklist` is an array of Bools or equivalent. This returns a new DataTable using only the rows that were True (or equivalent) in the mask.
[ "masklist", "is", "an", "array", "of", "Bools", "or", "equivalent", "." ]
train
https://github.com/emlazzarin/acrylic/blob/08c6702d73b9660ead1024653f4fa016f6340e46/acrylic/datatable.py#L625-L642
emlazzarin/acrylic
acrylic/datatable.py
DataTable.mutapply
def mutapply(self, function, fieldname): """ Applies `function` in-place to the field name specified. In other words, `mutapply` overwrites column `fieldname` ith the results of applying `function` to each element of that column. """ self[fieldname] = self.apply(function...
python
def mutapply(self, function, fieldname): """ Applies `function` in-place to the field name specified. In other words, `mutapply` overwrites column `fieldname` ith the results of applying `function` to each element of that column. """ self[fieldname] = self.apply(function...
[ "def", "mutapply", "(", "self", ",", "function", ",", "fieldname", ")", ":", "self", "[", "fieldname", "]", "=", "self", ".", "apply", "(", "function", ",", "fieldname", ")" ]
Applies `function` in-place to the field name specified. In other words, `mutapply` overwrites column `fieldname` ith the results of applying `function` to each element of that column.
[ "Applies", "function", "in", "-", "place", "to", "the", "field", "name", "specified", "." ]
train
https://github.com/emlazzarin/acrylic/blob/08c6702d73b9660ead1024653f4fa016f6340e46/acrylic/datatable.py#L644-L651
emlazzarin/acrylic
acrylic/datatable.py
DataTable.rename
def rename(self, old_fieldname, new_fieldname): """ Renames a specific field, and preserves the underlying order. """ if old_fieldname not in self: raise Exception("DataTable does not have field `%s`" % old_fieldname) if not isinstance(new...
python
def rename(self, old_fieldname, new_fieldname): """ Renames a specific field, and preserves the underlying order. """ if old_fieldname not in self: raise Exception("DataTable does not have field `%s`" % old_fieldname) if not isinstance(new...
[ "def", "rename", "(", "self", ",", "old_fieldname", ",", "new_fieldname", ")", ":", "if", "old_fieldname", "not", "in", "self", ":", "raise", "Exception", "(", "\"DataTable does not have field `%s`\"", "%", "old_fieldname", ")", "if", "not", "isinstance", "(", "...
Renames a specific field, and preserves the underlying order.
[ "Renames", "a", "specific", "field", "and", "preserves", "the", "underlying", "order", "." ]
train
https://github.com/emlazzarin/acrylic/blob/08c6702d73b9660ead1024653f4fa016f6340e46/acrylic/datatable.py#L656-L675
emlazzarin/acrylic
acrylic/datatable.py
DataTable.reorder
def reorder(self, fields_in_new_order): """ Pass in field names in the order you wish them to be swapped. """ if not len(fields_in_new_order) == len(self.fields): raise Exception("Fields to reorder with are not the same length " "(%s) as the origin...
python
def reorder(self, fields_in_new_order): """ Pass in field names in the order you wish them to be swapped. """ if not len(fields_in_new_order) == len(self.fields): raise Exception("Fields to reorder with are not the same length " "(%s) as the origin...
[ "def", "reorder", "(", "self", ",", "fields_in_new_order", ")", ":", "if", "not", "len", "(", "fields_in_new_order", ")", "==", "len", "(", "self", ".", "fields", ")", ":", "raise", "Exception", "(", "\"Fields to reorder with are not the same length \"", "\"(%s) a...
Pass in field names in the order you wish them to be swapped.
[ "Pass", "in", "field", "names", "in", "the", "order", "you", "wish", "them", "to", "be", "swapped", "." ]
train
https://github.com/emlazzarin/acrylic/blob/08c6702d73b9660ead1024653f4fa016f6340e46/acrylic/datatable.py#L677-L691
emlazzarin/acrylic
acrylic/datatable.py
DataTable.row
def row(self, rownum): """ Returns the row at index `rownum`. --- Note that the DataRow object returned that represents the data row is constructed on the fly and is a just a shallow copy of the underlying data that does not update dynamically. """ if rown...
python
def row(self, rownum): """ Returns the row at index `rownum`. --- Note that the DataRow object returned that represents the data row is constructed on the fly and is a just a shallow copy of the underlying data that does not update dynamically. """ if rown...
[ "def", "row", "(", "self", ",", "rownum", ")", ":", "if", "rownum", ">", "len", "(", "self", ")", ":", "raise", "IndexError", "(", "\"Invalid row index `%s` for DataTable\"", "%", "rownum", ")", "return", "datarow_constructor", "(", "self", ".", "fields", ")...
Returns the row at index `rownum`. --- Note that the DataRow object returned that represents the data row is constructed on the fly and is a just a shallow copy of the underlying data that does not update dynamically.
[ "Returns", "the", "row", "at", "index", "rownum", ".", "---", "Note", "that", "the", "DataRow", "object", "returned", "that", "represents", "the", "data", "row", "is", "constructed", "on", "the", "fly", "and", "is", "a", "just", "a", "shallow", "copy", "...
train
https://github.com/emlazzarin/acrylic/blob/08c6702d73b9660ead1024653f4fa016f6340e46/acrylic/datatable.py#L693-L704
emlazzarin/acrylic
acrylic/datatable.py
DataTable.sample
def sample(self, num): """ Returns a new table with rows randomly sampled. We create a mask with `num` True bools, and fill it with False bools until it is the length of the table. We shuffle it, and apply that mask to the table. """ if num > len(self): ...
python
def sample(self, num): """ Returns a new table with rows randomly sampled. We create a mask with `num` True bools, and fill it with False bools until it is the length of the table. We shuffle it, and apply that mask to the table. """ if num > len(self): ...
[ "def", "sample", "(", "self", ",", "num", ")", ":", "if", "num", ">", "len", "(", "self", ")", ":", "return", "self", ".", "copy", "(", ")", "elif", "num", "<", "0", ":", "raise", "IndexError", "(", "\"Cannot sample a negative number of rows \"", "\"from...
Returns a new table with rows randomly sampled. We create a mask with `num` True bools, and fill it with False bools until it is the length of the table. We shuffle it, and apply that mask to the table.
[ "Returns", "a", "new", "table", "with", "rows", "randomly", "sampled", "." ]
train
https://github.com/emlazzarin/acrylic/blob/08c6702d73b9660ead1024653f4fa016f6340e46/acrylic/datatable.py#L706-L731
emlazzarin/acrylic
acrylic/datatable.py
DataTable.select
def select(self, *cols): """ Returns DataTable with a subset of columns in this table """ return DataTable([cols] + zip(*[self[col] for col in cols]))
python
def select(self, *cols): """ Returns DataTable with a subset of columns in this table """ return DataTable([cols] + zip(*[self[col] for col in cols]))
[ "def", "select", "(", "self", ",", "*", "cols", ")", ":", "return", "DataTable", "(", "[", "cols", "]", "+", "zip", "(", "*", "[", "self", "[", "col", "]", "for", "col", "in", "cols", "]", ")", ")" ]
Returns DataTable with a subset of columns in this table
[ "Returns", "DataTable", "with", "a", "subset", "of", "columns", "in", "this", "table" ]
train
https://github.com/emlazzarin/acrylic/blob/08c6702d73b9660ead1024653f4fa016f6340e46/acrylic/datatable.py#L733-L737
emlazzarin/acrylic
acrylic/datatable.py
DataTable.sort
def sort(self, fieldname, key=lambda x: x, desc=False, inplace=False): """ This matches Python's built-in sorting signature closely. By default, a new DataTable will be returned and the original will not be mutated. If preferred, specify `inplace=True` in order to mutate the ori...
python
def sort(self, fieldname, key=lambda x: x, desc=False, inplace=False): """ This matches Python's built-in sorting signature closely. By default, a new DataTable will be returned and the original will not be mutated. If preferred, specify `inplace=True` in order to mutate the ori...
[ "def", "sort", "(", "self", ",", "fieldname", ",", "key", "=", "lambda", "x", ":", "x", ",", "desc", "=", "False", ",", "inplace", "=", "False", ")", ":", "try", ":", "field_index", "=", "tuple", "(", "self", ".", "fields", ")", ".", "index", "("...
This matches Python's built-in sorting signature closely. By default, a new DataTable will be returned and the original will not be mutated. If preferred, specify `inplace=True` in order to mutate the original table. Either way, a reference to the relevant table will be returned.
[ "This", "matches", "Python", "s", "built", "-", "in", "sorting", "signature", "closely", "." ]
train
https://github.com/emlazzarin/acrylic/blob/08c6702d73b9660ead1024653f4fa016f6340e46/acrylic/datatable.py#L739-L766
emlazzarin/acrylic
acrylic/datatable.py
DataTable.where
def where(self, fieldname, value, negate=False): """ Returns a new DataTable with rows only where the value at `fieldname` == `value`. """ if negate: return self.mask([elem != value for elem in self[fieldname]]) else: ...
python
def where(self, fieldname, value, negate=False): """ Returns a new DataTable with rows only where the value at `fieldname` == `value`. """ if negate: return self.mask([elem != value for elem in self[fieldname]]) else: ...
[ "def", "where", "(", "self", ",", "fieldname", ",", "value", ",", "negate", "=", "False", ")", ":", "if", "negate", ":", "return", "self", ".", "mask", "(", "[", "elem", "!=", "value", "for", "elem", "in", "self", "[", "fieldname", "]", "]", ")", ...
Returns a new DataTable with rows only where the value at `fieldname` == `value`.
[ "Returns", "a", "new", "DataTable", "with", "rows", "only", "where", "the", "value", "at", "fieldname", "==", "value", "." ]
train
https://github.com/emlazzarin/acrylic/blob/08c6702d73b9660ead1024653f4fa016f6340e46/acrylic/datatable.py#L768-L778
emlazzarin/acrylic
acrylic/datatable.py
DataTable.wherefunc
def wherefunc(self, func, fieldname=None, negate=False): """ .wherefunc(func, fieldname=None, negate=False) Applies a function to an entire row and filters the rows based on the boolean output of that function. If you pass in the fieldname, optionally, the function will simply ...
python
def wherefunc(self, func, fieldname=None, negate=False): """ .wherefunc(func, fieldname=None, negate=False) Applies a function to an entire row and filters the rows based on the boolean output of that function. If you pass in the fieldname, optionally, the function will simply ...
[ "def", "wherefunc", "(", "self", ",", "func", ",", "fieldname", "=", "None", ",", "negate", "=", "False", ")", ":", "if", "fieldname", "is", "not", "None", ":", "if", "negate", ":", "return", "self", ".", "mask", "(", "[", "not", "func", "(", "valu...
.wherefunc(func, fieldname=None, negate=False) Applies a function to an entire row and filters the rows based on the boolean output of that function. If you pass in the fieldname, optionally, the function will simply take the value at that fieldname, rather than the whole row.
[ ".", "wherefunc", "(", "func", "fieldname", "=", "None", "negate", "=", "False", ")" ]
train
https://github.com/emlazzarin/acrylic/blob/08c6702d73b9660ead1024653f4fa016f6340e46/acrylic/datatable.py#L780-L799
emlazzarin/acrylic
acrylic/datatable.py
DataTable.wherein
def wherein(self, fieldname, collection, negate=False): """ .wherein(fieldname, collection, negate=False) Returns a new DataTable with rows only where the value at `fieldname` is contained within `collection`. """ if negate: return self.mask([elem not in coll...
python
def wherein(self, fieldname, collection, negate=False): """ .wherein(fieldname, collection, negate=False) Returns a new DataTable with rows only where the value at `fieldname` is contained within `collection`. """ if negate: return self.mask([elem not in coll...
[ "def", "wherein", "(", "self", ",", "fieldname", ",", "collection", ",", "negate", "=", "False", ")", ":", "if", "negate", ":", "return", "self", ".", "mask", "(", "[", "elem", "not", "in", "collection", "for", "elem", "in", "self", "[", "fieldname", ...
.wherein(fieldname, collection, negate=False) Returns a new DataTable with rows only where the value at `fieldname` is contained within `collection`.
[ ".", "wherein", "(", "fieldname", "collection", "negate", "=", "False", ")" ]
train
https://github.com/emlazzarin/acrylic/blob/08c6702d73b9660ead1024653f4fa016f6340e46/acrylic/datatable.py#L801-L813
emlazzarin/acrylic
acrylic/datatable.py
DataTable.wheregreater
def wheregreater(self, fieldname, value): """ Returns a new DataTable with rows only where the value at `fieldname` > `value`. """ return self.mask([elem > value for elem in self[fieldname]])
python
def wheregreater(self, fieldname, value): """ Returns a new DataTable with rows only where the value at `fieldname` > `value`. """ return self.mask([elem > value for elem in self[fieldname]])
[ "def", "wheregreater", "(", "self", ",", "fieldname", ",", "value", ")", ":", "return", "self", ".", "mask", "(", "[", "elem", ">", "value", "for", "elem", "in", "self", "[", "fieldname", "]", "]", ")" ]
Returns a new DataTable with rows only where the value at `fieldname` > `value`.
[ "Returns", "a", "new", "DataTable", "with", "rows", "only", "where", "the", "value", "at", "fieldname", ">", "value", "." ]
train
https://github.com/emlazzarin/acrylic/blob/08c6702d73b9660ead1024653f4fa016f6340e46/acrylic/datatable.py#L815-L820
emlazzarin/acrylic
acrylic/datatable.py
DataTable.whereless
def whereless(self, fieldname, value): """ Returns a new DataTable with rows only where the value at `fieldname` < `value`. """ return self.mask([elem < value for elem in self[fieldname]])
python
def whereless(self, fieldname, value): """ Returns a new DataTable with rows only where the value at `fieldname` < `value`. """ return self.mask([elem < value for elem in self[fieldname]])
[ "def", "whereless", "(", "self", ",", "fieldname", ",", "value", ")", ":", "return", "self", ".", "mask", "(", "[", "elem", "<", "value", "for", "elem", "in", "self", "[", "fieldname", "]", "]", ")" ]
Returns a new DataTable with rows only where the value at `fieldname` < `value`.
[ "Returns", "a", "new", "DataTable", "with", "rows", "only", "where", "the", "value", "at", "fieldname", "<", "value", "." ]
train
https://github.com/emlazzarin/acrylic/blob/08c6702d73b9660ead1024653f4fa016f6340e46/acrylic/datatable.py#L822-L827
emlazzarin/acrylic
acrylic/datatable.py
DataTable.wherenot
def wherenot(self, fieldname, value): """ Logical opposite of `where`. """ return self.where(fieldname, value, negate=True)
python
def wherenot(self, fieldname, value): """ Logical opposite of `where`. """ return self.where(fieldname, value, negate=True)
[ "def", "wherenot", "(", "self", ",", "fieldname", ",", "value", ")", ":", "return", "self", ".", "where", "(", "fieldname", ",", "value", ",", "negate", "=", "True", ")" ]
Logical opposite of `where`.
[ "Logical", "opposite", "of", "where", "." ]
train
https://github.com/emlazzarin/acrylic/blob/08c6702d73b9660ead1024653f4fa016f6340e46/acrylic/datatable.py#L829-L833
emlazzarin/acrylic
acrylic/datatable.py
DataTable.wherenotin
def wherenotin(self, fieldname, value): """ Logical opposite of `wherein`. """ return self.wherein(fieldname, value, negate=True)
python
def wherenotin(self, fieldname, value): """ Logical opposite of `wherein`. """ return self.wherein(fieldname, value, negate=True)
[ "def", "wherenotin", "(", "self", ",", "fieldname", ",", "value", ")", ":", "return", "self", ".", "wherein", "(", "fieldname", ",", "value", ",", "negate", "=", "True", ")" ]
Logical opposite of `wherein`.
[ "Logical", "opposite", "of", "wherein", "." ]
train
https://github.com/emlazzarin/acrylic/blob/08c6702d73b9660ead1024653f4fa016f6340e46/acrylic/datatable.py#L841-L845
emlazzarin/acrylic
acrylic/datatable.py
DataTable.writexlsx
def writexlsx(self, path, sheetname="default"): """ Writes this table to an .xlsx file at the specified path. If you'd like to specify a sheetname, you may do so. If you'd like to write one workbook with different DataTables for each sheet, import the `excel` function from acry...
python
def writexlsx(self, path, sheetname="default"): """ Writes this table to an .xlsx file at the specified path. If you'd like to specify a sheetname, you may do so. If you'd like to write one workbook with different DataTables for each sheet, import the `excel` function from acry...
[ "def", "writexlsx", "(", "self", ",", "path", ",", "sheetname", "=", "\"default\"", ")", ":", "writer", "=", "ExcelRW", ".", "UnicodeWriter", "(", "path", ")", "writer", ".", "set_active_sheet", "(", "sheetname", ")", "writer", ".", "writerow", "(", "self"...
Writes this table to an .xlsx file at the specified path. If you'd like to specify a sheetname, you may do so. If you'd like to write one workbook with different DataTables for each sheet, import the `excel` function from acrylic. You can see that code in `utils.py`. Note that...
[ "Writes", "this", "table", "to", "an", ".", "xlsx", "file", "at", "the", "specified", "path", "." ]
train
https://github.com/emlazzarin/acrylic/blob/08c6702d73b9660ead1024653f4fa016f6340e46/acrylic/datatable.py#L856-L873
KnowledgeLinks/rdfframework
rdfframework/datatypes/uriformatters.py
pyuri_formatter
def pyuri_formatter(namespace, value): """ Formats a namespace and ending value into a python friendly format args: namespace: RdfNamespace or tuple in the format of (prefix, uri,) value: end value to attach to the namespace """ if namespace[0]: return "%s_%s" %(namespace[0], va...
python
def pyuri_formatter(namespace, value): """ Formats a namespace and ending value into a python friendly format args: namespace: RdfNamespace or tuple in the format of (prefix, uri,) value: end value to attach to the namespace """ if namespace[0]: return "%s_%s" %(namespace[0], va...
[ "def", "pyuri_formatter", "(", "namespace", ",", "value", ")", ":", "if", "namespace", "[", "0", "]", ":", "return", "\"%s_%s\"", "%", "(", "namespace", "[", "0", "]", ",", "value", ")", "else", ":", "return", "\"pyuri_%s_%s\"", "%", "(", "base64", "."...
Formats a namespace and ending value into a python friendly format args: namespace: RdfNamespace or tuple in the format of (prefix, uri,) value: end value to attach to the namespace
[ "Formats", "a", "namespace", "and", "ending", "value", "into", "a", "python", "friendly", "format" ]
train
https://github.com/KnowledgeLinks/rdfframework/blob/9ec32dcc4bed51650a4b392cc5c15100fef7923a/rdfframework/datatypes/uriformatters.py#L38-L50
dlancer/django-pages-cms
pages/models/pagecontenttypes.py
PageMetaContent.robots
def robots(self): """Return values for robots html meta key""" r = 'noindex' if self.is_noindex else 'index' r += ',' r += 'nofollow' if self.is_nofollow else 'follow' return r
python
def robots(self): """Return values for robots html meta key""" r = 'noindex' if self.is_noindex else 'index' r += ',' r += 'nofollow' if self.is_nofollow else 'follow' return r
[ "def", "robots", "(", "self", ")", ":", "r", "=", "'noindex'", "if", "self", ".", "is_noindex", "else", "'index'", "r", "+=", "','", "r", "+=", "'nofollow'", "if", "self", ".", "is_nofollow", "else", "'follow'", "return", "r" ]
Return values for robots html meta key
[ "Return", "values", "for", "robots", "html", "meta", "key" ]
train
https://github.com/dlancer/django-pages-cms/blob/441fad674d5ad4f6e05c953508950525dc0fa789/pages/models/pagecontenttypes.py#L115-L120
rackerlabs/rackspace-python-neutronclient
neutronclient/neutron/v2_0/fw/firewallrule.py
_add_common_args
def _add_common_args(parser, is_create=True): """If is_create is True, protocol and action become mandatory arguments. CreateCommand = is_create : True UpdateCommand = is_create : False """ parser.add_argument( '--name', help=_('Name for the firewall rule.')) parser.add_argument...
python
def _add_common_args(parser, is_create=True): """If is_create is True, protocol and action become mandatory arguments. CreateCommand = is_create : True UpdateCommand = is_create : False """ parser.add_argument( '--name', help=_('Name for the firewall rule.')) parser.add_argument...
[ "def", "_add_common_args", "(", "parser", ",", "is_create", "=", "True", ")", ":", "parser", ".", "add_argument", "(", "'--name'", ",", "help", "=", "_", "(", "'Name for the firewall rule.'", ")", ")", "parser", ".", "add_argument", "(", "'--description'", ","...
If is_create is True, protocol and action become mandatory arguments. CreateCommand = is_create : True UpdateCommand = is_create : False
[ "If", "is_create", "is", "True", "protocol", "and", "action", "become", "mandatory", "arguments", "." ]
train
https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/neutron/v2_0/fw/firewallrule.py#L24-L62
EventTeam/beliefs
src/beliefs/cells/spatial.py
LatLonCell.haversine
def haversine(self, other): """ Calculate the great circle distance between two points on the earth (specified in decimal degrees) """ # convert decimal degrees to radians lon1, lat1, lon2, lat2 = map(radians,\ [self.lon.low, self['lat'].low, other.lon.low...
python
def haversine(self, other): """ Calculate the great circle distance between two points on the earth (specified in decimal degrees) """ # convert decimal degrees to radians lon1, lat1, lon2, lat2 = map(radians,\ [self.lon.low, self['lat'].low, other.lon.low...
[ "def", "haversine", "(", "self", ",", "other", ")", ":", "# convert decimal degrees to radians", "lon1", ",", "lat1", ",", "lon2", ",", "lat2", "=", "map", "(", "radians", ",", "[", "self", ".", "lon", ".", "low", ",", "self", "[", "'lat'", "]", ".", ...
Calculate the great circle distance between two points on the earth (specified in decimal degrees)
[ "Calculate", "the", "great", "circle", "distance", "between", "two", "points", "on", "the", "earth", "(", "specified", "in", "decimal", "degrees", ")" ]
train
https://github.com/EventTeam/beliefs/blob/c07d22b61bebeede74a72800030dde770bf64208/src/beliefs/cells/spatial.py#L38-L55
praekelt/jmbo-show
show/templatetags/show_tags.py
get_relation_by_type_list
def get_relation_by_type_list(parser, token): """Gets list of relations from object identified by a content type. Syntax:: {% get_relation_list [content_type_app_label.content_type_model] for [object] as [varname] [direction] %} """ tokens = token.contents.split() if len(tokens) not in (6,...
python
def get_relation_by_type_list(parser, token): """Gets list of relations from object identified by a content type. Syntax:: {% get_relation_list [content_type_app_label.content_type_model] for [object] as [varname] [direction] %} """ tokens = token.contents.split() if len(tokens) not in (6,...
[ "def", "get_relation_by_type_list", "(", "parser", ",", "token", ")", ":", "tokens", "=", "token", ".", "contents", ".", "split", "(", ")", "if", "len", "(", "tokens", ")", "not", "in", "(", "6", ",", "7", ")", ":", "raise", "template", ".", "Templat...
Gets list of relations from object identified by a content type. Syntax:: {% get_relation_list [content_type_app_label.content_type_model] for [object] as [varname] [direction] %}
[ "Gets", "list", "of", "relations", "from", "object", "identified", "by", "a", "content", "type", "." ]
train
https://github.com/praekelt/jmbo-show/blob/9e10b1722647945db70c4af6b6d8b0506a0dd683/show/templatetags/show_tags.py#L8-L37
unionbilling/union-python
union/models.py
BaseModel.filter
def filter(cls, **items): ''' Returns multiple Union objects with search params ''' client = cls._new_api_client(subpath='/search') items_dict = dict((k, v) for k, v in list(items.items())) json_data = json.dumps(items_dict, sort_keys=True, indent=4) return client...
python
def filter(cls, **items): ''' Returns multiple Union objects with search params ''' client = cls._new_api_client(subpath='/search') items_dict = dict((k, v) for k, v in list(items.items())) json_data = json.dumps(items_dict, sort_keys=True, indent=4) return client...
[ "def", "filter", "(", "cls", ",", "*", "*", "items", ")", ":", "client", "=", "cls", ".", "_new_api_client", "(", "subpath", "=", "'/search'", ")", "items_dict", "=", "dict", "(", "(", "k", ",", "v", ")", "for", "k", ",", "v", "in", "list", "(", ...
Returns multiple Union objects with search params
[ "Returns", "multiple", "Union", "objects", "with", "search", "params" ]
train
https://github.com/unionbilling/union-python/blob/551e4fc1a0b395b632781d80527a3660a7c67c0c/union/models.py#L44-L51
unionbilling/union-python
union/models.py
BaseModel.get
def get(cls, id): ''' Look up one Union object ''' client = cls._new_api_client() return client.make_request(cls, 'get', url_params={'id': id})
python
def get(cls, id): ''' Look up one Union object ''' client = cls._new_api_client() return client.make_request(cls, 'get', url_params={'id': id})
[ "def", "get", "(", "cls", ",", "id", ")", ":", "client", "=", "cls", ".", "_new_api_client", "(", ")", "return", "client", ".", "make_request", "(", "cls", ",", "'get'", ",", "url_params", "=", "{", "'id'", ":", "id", "}", ")" ]
Look up one Union object
[ "Look", "up", "one", "Union", "object" ]
train
https://github.com/unionbilling/union-python/blob/551e4fc1a0b395b632781d80527a3660a7c67c0c/union/models.py#L54-L59
unionbilling/union-python
union/models.py
BaseModel.save
def save(self): ''' Save an instance of a Union object ''' client = self._new_api_client() params = {'id': self.id} if hasattr(self, 'id') else {} action = 'patch' if hasattr(self, 'id') else 'post' saved_model = client.make_request(self, action, url_params=param...
python
def save(self): ''' Save an instance of a Union object ''' client = self._new_api_client() params = {'id': self.id} if hasattr(self, 'id') else {} action = 'patch' if hasattr(self, 'id') else 'post' saved_model = client.make_request(self, action, url_params=param...
[ "def", "save", "(", "self", ")", ":", "client", "=", "self", ".", "_new_api_client", "(", ")", "params", "=", "{", "'id'", ":", "self", ".", "id", "}", "if", "hasattr", "(", "self", ",", "'id'", ")", "else", "{", "}", "action", "=", "'patch'", "i...
Save an instance of a Union object
[ "Save", "an", "instance", "of", "a", "Union", "object" ]
train
https://github.com/unionbilling/union-python/blob/551e4fc1a0b395b632781d80527a3660a7c67c0c/union/models.py#L61-L69
unionbilling/union-python
union/models.py
BaseModel.delete
def delete(cls, id): ''' Destroy a Union object ''' client = cls._new_api_client() return client.make_request(cls, 'delete', url_params={'id': id})
python
def delete(cls, id): ''' Destroy a Union object ''' client = cls._new_api_client() return client.make_request(cls, 'delete', url_params={'id': id})
[ "def", "delete", "(", "cls", ",", "id", ")", ":", "client", "=", "cls", ".", "_new_api_client", "(", ")", "return", "client", ".", "make_request", "(", "cls", ",", "'delete'", ",", "url_params", "=", "{", "'id'", ":", "id", "}", ")" ]
Destroy a Union object
[ "Destroy", "a", "Union", "object" ]
train
https://github.com/unionbilling/union-python/blob/551e4fc1a0b395b632781d80527a3660a7c67c0c/union/models.py#L72-L77
rGunti/CarPi-RedisDataBus
redisdatabus/bus.py
BusWriter.publish
def publish(self, channel: str, value: Any): """ Sends a new value to the data bus :param channel: Defines the name of the value :param value: Defines the value itself """ self._r.publish(channel, str(value))
python
def publish(self, channel: str, value: Any): """ Sends a new value to the data bus :param channel: Defines the name of the value :param value: Defines the value itself """ self._r.publish(channel, str(value))
[ "def", "publish", "(", "self", ",", "channel", ":", "str", ",", "value", ":", "Any", ")", ":", "self", ".", "_r", ".", "publish", "(", "channel", ",", "str", "(", "value", ")", ")" ]
Sends a new value to the data bus :param channel: Defines the name of the value :param value: Defines the value itself
[ "Sends", "a", "new", "value", "to", "the", "data", "bus", ":", "param", "channel", ":", "Defines", "the", "name", "of", "the", "value", ":", "param", "value", ":", "Defines", "the", "value", "itself" ]
train
https://github.com/rGunti/CarPi-RedisDataBus/blob/dc210fc019b8cc60b3a424d155c8276dd4c345fd/redisdatabus/bus.py#L46-L52
b3j0f/conf
b3j0f/conf/configurable/core.py
applyconfiguration
def applyconfiguration(targets, conf=None, *args, **kwargs): """Apply configuration on input targets. If targets are not annotated by a Configurable, a new one is instanciated. :param Iterable targets: targets to configurate. :param tuple args: applyconfiguration var args. :param dict kwargs: appl...
python
def applyconfiguration(targets, conf=None, *args, **kwargs): """Apply configuration on input targets. If targets are not annotated by a Configurable, a new one is instanciated. :param Iterable targets: targets to configurate. :param tuple args: applyconfiguration var args. :param dict kwargs: appl...
[ "def", "applyconfiguration", "(", "targets", ",", "conf", "=", "None", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "result", "=", "[", "]", "for", "target", "in", "targets", ":", "configurables", "=", "Configurable", ".", "get_annotations", "(",...
Apply configuration on input targets. If targets are not annotated by a Configurable, a new one is instanciated. :param Iterable targets: targets to configurate. :param tuple args: applyconfiguration var args. :param dict kwargs: applyconfiguration keywords. :return: configured targets. :rtype...
[ "Apply", "configuration", "on", "input", "targets", "." ]
train
https://github.com/b3j0f/conf/blob/18dd6d5d6560f9b202793739e2330a2181163511/b3j0f/conf/configurable/core.py#L883-L911
b3j0f/conf
b3j0f/conf/configurable/core.py
Configurable.getcallparams
def getcallparams( self, target, conf=None, args=None, kwargs=None, exec_ctx=None ): """Get target call parameters. :param list args: target call arguments. :param dict kwargs: target call keywords. :return: args, kwargs :rtype: tuple""" if args is None:...
python
def getcallparams( self, target, conf=None, args=None, kwargs=None, exec_ctx=None ): """Get target call parameters. :param list args: target call arguments. :param dict kwargs: target call keywords. :return: args, kwargs :rtype: tuple""" if args is None:...
[ "def", "getcallparams", "(", "self", ",", "target", ",", "conf", "=", "None", ",", "args", "=", "None", ",", "kwargs", "=", "None", ",", "exec_ctx", "=", "None", ")", ":", "if", "args", "is", "None", ":", "args", "=", "[", "]", "if", "kwargs", "i...
Get target call parameters. :param list args: target call arguments. :param dict kwargs: target call keywords. :return: args, kwargs :rtype: tuple
[ "Get", "target", "call", "parameters", "." ]
train
https://github.com/b3j0f/conf/blob/18dd6d5d6560f9b202793739e2330a2181163511/b3j0f/conf/configurable/core.py#L304-L372
b3j0f/conf
b3j0f/conf/configurable/core.py
Configurable.loadmodules
def loadmodules(self, modules=None, rel=None): """ry to (re)load modules and return loaded modules. :param modules: list of module (name) to load. :param bool rel: flag for forcing reload of module. Default is this rel flag (false by default). :rtype: list :return: l...
python
def loadmodules(self, modules=None, rel=None): """ry to (re)load modules and return loaded modules. :param modules: list of module (name) to load. :param bool rel: flag for forcing reload of module. Default is this rel flag (false by default). :rtype: list :return: l...
[ "def", "loadmodules", "(", "self", ",", "modules", "=", "None", ",", "rel", "=", "None", ")", ":", "result", "=", "[", "]", "if", "rel", "is", "None", ":", "rel", "=", "self", ".", "rel", "if", "modules", "is", "None", ":", "modules", "=", "self"...
ry to (re)load modules and return loaded modules. :param modules: list of module (name) to load. :param bool rel: flag for forcing reload of module. Default is this rel flag (false by default). :rtype: list :return: loaded modules.
[ "ry", "to", "(", "re", ")", "load", "modules", "and", "return", "loaded", "modules", "." ]
train
https://github.com/b3j0f/conf/blob/18dd6d5d6560f9b202793739e2330a2181163511/b3j0f/conf/configurable/core.py#L374-L415
b3j0f/conf
b3j0f/conf/configurable/core.py
Configurable.modules
def modules(self, value): """Change required modules. Reload modules given in the value. :param list value: new modules to use.""" modules = [module.__name__ for module in self.loadmodules(value)] self._modules = [ module for module in self._modules + modules ...
python
def modules(self, value): """Change required modules. Reload modules given in the value. :param list value: new modules to use.""" modules = [module.__name__ for module in self.loadmodules(value)] self._modules = [ module for module in self._modules + modules ...
[ "def", "modules", "(", "self", ",", "value", ")", ":", "modules", "=", "[", "module", ".", "__name__", "for", "module", "in", "self", ".", "loadmodules", "(", "value", ")", "]", "self", ".", "_modules", "=", "[", "module", "for", "module", "in", "sel...
Change required modules. Reload modules given in the value. :param list value: new modules to use.
[ "Change", "required", "modules", "." ]
train
https://github.com/b3j0f/conf/blob/18dd6d5d6560f9b202793739e2330a2181163511/b3j0f/conf/configurable/core.py#L424-L436
b3j0f/conf
b3j0f/conf/configurable/core.py
Configurable.conf
def conf(self, value): """Change of configuration. :param value: new configuration to use. :type value: Category or Configuration """ self._conf = self._toconf(value) if self.autoconf: self.applyconfiguration()
python
def conf(self, value): """Change of configuration. :param value: new configuration to use. :type value: Category or Configuration """ self._conf = self._toconf(value) if self.autoconf: self.applyconfiguration()
[ "def", "conf", "(", "self", ",", "value", ")", ":", "self", ".", "_conf", "=", "self", ".", "_toconf", "(", "value", ")", "if", "self", ".", "autoconf", ":", "self", ".", "applyconfiguration", "(", ")" ]
Change of configuration. :param value: new configuration to use. :type value: Category or Configuration
[ "Change", "of", "configuration", "." ]
train
https://github.com/b3j0f/conf/blob/18dd6d5d6560f9b202793739e2330a2181163511/b3j0f/conf/configurable/core.py#L448-L458
b3j0f/conf
b3j0f/conf/configurable/core.py
Configurable._toconf
def _toconf(self, conf): """Convert input parameter to a Configuration. :param conf: configuration to convert to a Configuration object. :type conf: Configuration, Category or Parameter. :rtype: Configuration""" result = conf if result is None: result = Co...
python
def _toconf(self, conf): """Convert input parameter to a Configuration. :param conf: configuration to convert to a Configuration object. :type conf: Configuration, Category or Parameter. :rtype: Configuration""" result = conf if result is None: result = Co...
[ "def", "_toconf", "(", "self", ",", "conf", ")", ":", "result", "=", "conf", "if", "result", "is", "None", ":", "result", "=", "Configuration", "(", ")", "elif", "isinstance", "(", "result", ",", "Category", ")", ":", "result", "=", "configuration", "(...
Convert input parameter to a Configuration. :param conf: configuration to convert to a Configuration object. :type conf: Configuration, Category or Parameter. :rtype: Configuration
[ "Convert", "input", "parameter", "to", "a", "Configuration", "." ]
train
https://github.com/b3j0f/conf/blob/18dd6d5d6560f9b202793739e2330a2181163511/b3j0f/conf/configurable/core.py#L460-L482
b3j0f/conf
b3j0f/conf/configurable/core.py
Configurable.paths
def paths(self, value): """Change of paths in adding it in watching list.""" if value is None: value = () elif isinstance(value, string_types): value = (value, ) self._paths = tuple(value) if self.autoconf: self.applyconfiguration()
python
def paths(self, value): """Change of paths in adding it in watching list.""" if value is None: value = () elif isinstance(value, string_types): value = (value, ) self._paths = tuple(value) if self.autoconf: self.applyconfiguration()
[ "def", "paths", "(", "self", ",", "value", ")", ":", "if", "value", "is", "None", ":", "value", "=", "(", ")", "elif", "isinstance", "(", "value", ",", "string_types", ")", ":", "value", "=", "(", "value", ",", ")", "self", ".", "_paths", "=", "t...
Change of paths in adding it in watching list.
[ "Change", "of", "paths", "in", "adding", "it", "in", "watching", "list", "." ]
train
https://github.com/b3j0f/conf/blob/18dd6d5d6560f9b202793739e2330a2181163511/b3j0f/conf/configurable/core.py#L495-L507
b3j0f/conf
b3j0f/conf/configurable/core.py
Configurable.applyconfiguration
def applyconfiguration( self, conf=None, paths=None, drivers=None, logger=None, targets=None, scope=None, safe=None, besteffort=None, callconf=False, keepstate=None, modules=None ): """Apply conf on a destination in those phases: 1. identify the right driver to u...
python
def applyconfiguration( self, conf=None, paths=None, drivers=None, logger=None, targets=None, scope=None, safe=None, besteffort=None, callconf=False, keepstate=None, modules=None ): """Apply conf on a destination in those phases: 1. identify the right driver to u...
[ "def", "applyconfiguration", "(", "self", ",", "conf", "=", "None", ",", "paths", "=", "None", ",", "drivers", "=", "None", ",", "logger", "=", "None", ",", "targets", "=", "None", ",", "scope", "=", "None", ",", "safe", "=", "None", ",", "besteffort...
Apply conf on a destination in those phases: 1. identify the right driver to use with paths to parse. 2. for all paths, get conf which matches input conf. 3. apply parsing rules on path parameters. 4. fill input conf with resolved parameters. 5. apply filled conf on targets. ...
[ "Apply", "conf", "on", "a", "destination", "in", "those", "phases", ":" ]
train
https://github.com/b3j0f/conf/blob/18dd6d5d6560f9b202793739e2330a2181163511/b3j0f/conf/configurable/core.py#L509-L579
b3j0f/conf
b3j0f/conf/configurable/core.py
Configurable.getconf
def getconf( self, conf=None, paths=None, drivers=None, logger=None, modules=None ): """Get a configuration from paths. :param conf: conf to update. Default this conf. :type conf: Configuration, Category or Parameter :param str(s) paths: list of conf files. Default this ...
python
def getconf( self, conf=None, paths=None, drivers=None, logger=None, modules=None ): """Get a configuration from paths. :param conf: conf to update. Default this conf. :type conf: Configuration, Category or Parameter :param str(s) paths: list of conf files. Default this ...
[ "def", "getconf", "(", "self", ",", "conf", "=", "None", ",", "paths", "=", "None", ",", "drivers", "=", "None", ",", "logger", "=", "None", ",", "modules", "=", "None", ")", ":", "result", "=", "None", "self", ".", "loadmodules", "(", "modules", "...
Get a configuration from paths. :param conf: conf to update. Default this conf. :type conf: Configuration, Category or Parameter :param str(s) paths: list of conf files. Default this paths. :param Logger logger: logger to use for logging info/error messages. :param list drivers:...
[ "Get", "a", "configuration", "from", "paths", "." ]
train
https://github.com/b3j0f/conf/blob/18dd6d5d6560f9b202793739e2330a2181163511/b3j0f/conf/configurable/core.py#L581-L649
b3j0f/conf
b3j0f/conf/configurable/core.py
Configurable.configure
def configure( self, conf=None, targets=None, logger=None, callconf=False, keepstate=None, modules=None ): """Apply input conf on targets objects. Specialization of this method is done in the _configure method. :param conf: configuration model to configure. Default ...
python
def configure( self, conf=None, targets=None, logger=None, callconf=False, keepstate=None, modules=None ): """Apply input conf on targets objects. Specialization of this method is done in the _configure method. :param conf: configuration model to configure. Default ...
[ "def", "configure", "(", "self", ",", "conf", "=", "None", ",", "targets", "=", "None", ",", "logger", "=", "None", ",", "callconf", "=", "False", ",", "keepstate", "=", "None", ",", "modules", "=", "None", ")", ":", "result", "=", "[", "]", "self"...
Apply input conf on targets objects. Specialization of this method is done in the _configure method. :param conf: configuration model to configure. Default is this conf. :type conf: Configuration, Category or Parameter :param Iterable targets: objects to configure. self targets by defa...
[ "Apply", "input", "conf", "on", "targets", "objects", "." ]
train
https://github.com/b3j0f/conf/blob/18dd6d5d6560f9b202793739e2330a2181163511/b3j0f/conf/configurable/core.py#L651-L711
b3j0f/conf
b3j0f/conf/configurable/core.py
Configurable._configure
def _configure( self, target, conf=None, logger=None, callconf=None, keepstate=None, modules=None ): """Configure this class with input conf only if auto_conf or configure is true. This method should be overriden for specific conf :param target: object to co...
python
def _configure( self, target, conf=None, logger=None, callconf=None, keepstate=None, modules=None ): """Configure this class with input conf only if auto_conf or configure is true. This method should be overriden for specific conf :param target: object to co...
[ "def", "_configure", "(", "self", ",", "target", ",", "conf", "=", "None", ",", "logger", "=", "None", ",", "callconf", "=", "None", ",", "keepstate", "=", "None", ",", "modules", "=", "None", ")", ":", "result", "=", "target", "self", ".", "loadmodu...
Configure this class with input conf only if auto_conf or configure is true. This method should be overriden for specific conf :param target: object to configure. self targets by default. :param Configuration conf: configuration model to configure. Default is this conf. ...
[ "Configure", "this", "class", "with", "input", "conf", "only", "if", "auto_conf", "or", "configure", "is", "true", "." ]
train
https://github.com/b3j0f/conf/blob/18dd6d5d6560f9b202793739e2330a2181163511/b3j0f/conf/configurable/core.py#L713-L825
qzmfranklin/easyshell
easycompleter/python_default.py
Completer.complete
def complete(self, text, state): """Return the next possible completion for 'text'. This is called successively with state == 0, 1, 2, ... until it returns None. The completion should begin with 'text'. """ if self.use_main_ns: self.namespace = __main__.__dict__ ...
python
def complete(self, text, state): """Return the next possible completion for 'text'. This is called successively with state == 0, 1, 2, ... until it returns None. The completion should begin with 'text'. """ if self.use_main_ns: self.namespace = __main__.__dict__ ...
[ "def", "complete", "(", "self", ",", "text", ",", "state", ")", ":", "if", "self", ".", "use_main_ns", ":", "self", ".", "namespace", "=", "__main__", ".", "__dict__", "if", "not", "text", ".", "strip", "(", ")", ":", "if", "state", "==", "0", ":",...
Return the next possible completion for 'text'. This is called successively with state == 0, 1, 2, ... until it returns None. The completion should begin with 'text'.
[ "Return", "the", "next", "possible", "completion", "for", "text", "." ]
train
https://github.com/qzmfranklin/easyshell/blob/00c2e90e7767d32e7e127fc8c6875845aa308295/easycompleter/python_default.py#L33-L62
qzmfranklin/easyshell
easycompleter/python_default.py
Completer.find_matches
def find_matches(self, text): """Return candidates matching the text.""" if self.use_main_ns: self.namespace = __main__.__dict__ if "." in text: return self.attr_matches(text) else: return self.global_matches(text)
python
def find_matches(self, text): """Return candidates matching the text.""" if self.use_main_ns: self.namespace = __main__.__dict__ if "." in text: return self.attr_matches(text) else: return self.global_matches(text)
[ "def", "find_matches", "(", "self", ",", "text", ")", ":", "if", "self", ".", "use_main_ns", ":", "self", ".", "namespace", "=", "__main__", ".", "__dict__", "if", "\".\"", "in", "text", ":", "return", "self", ".", "attr_matches", "(", "text", ")", "el...
Return candidates matching the text.
[ "Return", "candidates", "matching", "the", "text", "." ]
train
https://github.com/qzmfranklin/easyshell/blob/00c2e90e7767d32e7e127fc8c6875845aa308295/easycompleter/python_default.py#L64-L72
qzmfranklin/easyshell
easycompleter/python_default.py
Completer.global_matches
def global_matches(self, text): """Compute matches when text is a simple name. Return a list of all keywords, built-in functions and names currently defined in self.namespace that match. """ import keyword matches = [] seen = {"__builtins__"} n = len(tex...
python
def global_matches(self, text): """Compute matches when text is a simple name. Return a list of all keywords, built-in functions and names currently defined in self.namespace that match. """ import keyword matches = [] seen = {"__builtins__"} n = len(tex...
[ "def", "global_matches", "(", "self", ",", "text", ")", ":", "import", "keyword", "matches", "=", "[", "]", "seen", "=", "{", "\"__builtins__\"", "}", "n", "=", "len", "(", "text", ")", "for", "word", "in", "keyword", ".", "kwlist", ":", "if", "word"...
Compute matches when text is a simple name. Return a list of all keywords, built-in functions and names currently defined in self.namespace that match.
[ "Compute", "matches", "when", "text", "is", "a", "simple", "name", "." ]
train
https://github.com/qzmfranklin/easyshell/blob/00c2e90e7767d32e7e127fc8c6875845aa308295/easycompleter/python_default.py#L79-L99
qzmfranklin/easyshell
easycompleter/python_default.py
Completer.attr_matches
def attr_matches(self, text): """Compute matches when text contains a dot. Assuming the text is of the form NAME.NAME....[NAME], and is evaluable in self.namespace, it will be evaluated and its attributes (as revealed by dir()) are used as possible completions. (For class insta...
python
def attr_matches(self, text): """Compute matches when text contains a dot. Assuming the text is of the form NAME.NAME....[NAME], and is evaluable in self.namespace, it will be evaluated and its attributes (as revealed by dir()) are used as possible completions. (For class insta...
[ "def", "attr_matches", "(", "self", ",", "text", ")", ":", "import", "re", "m", "=", "re", ".", "match", "(", "r\"(\\w+(\\.\\w+)*)\\.(\\w*)\"", ",", "text", ")", "if", "not", "m", ":", "return", "[", "]", "expr", ",", "attr", "=", "m", ".", "group", ...
Compute matches when text contains a dot. Assuming the text is of the form NAME.NAME....[NAME], and is evaluable in self.namespace, it will be evaluated and its attributes (as revealed by dir()) are used as possible completions. (For class instances, class members are also considered.)...
[ "Compute", "matches", "when", "text", "contains", "a", "dot", "." ]
train
https://github.com/qzmfranklin/easyshell/blob/00c2e90e7767d32e7e127fc8c6875845aa308295/easycompleter/python_default.py#L101-L141
elkan1788/ppytools
ppytools/lang/timerhelper.py
timemeter
def timemeter(msg=None): """Timer meter Use this annotation method can calculate the execute time. :param msg: custom message output :return: fn values """ def _time_meter(fn): @functools.wraps(fn) def _wrapper(*args, **kwargs): mark = timeit.default_timer() ...
python
def timemeter(msg=None): """Timer meter Use this annotation method can calculate the execute time. :param msg: custom message output :return: fn values """ def _time_meter(fn): @functools.wraps(fn) def _wrapper(*args, **kwargs): mark = timeit.default_timer() ...
[ "def", "timemeter", "(", "msg", "=", "None", ")", ":", "def", "_time_meter", "(", "fn", ")", ":", "@", "functools", ".", "wraps", "(", "fn", ")", "def", "_wrapper", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "mark", "=", "timeit", ".", ...
Timer meter Use this annotation method can calculate the execute time. :param msg: custom message output :return: fn values
[ "Timer", "meter" ]
train
https://github.com/elkan1788/ppytools/blob/117aeed9f669ae46e0dd6cb11c5687a5f797816c/ppytools/lang/timerhelper.py#L15-L34
amaas-fintech/amaas-utils-python
amaasutils/case.py
dict_camel_to_snake_case
def dict_camel_to_snake_case(camel_dict, convert_keys=True, convert_subkeys=False): """ Recursively convert camelCased keys for a camelCased dict into snake_cased keys :param camel_dict: Dictionary to convert :param convert_keys: Whether the key should be converted :param convert_subkeys: Whether t...
python
def dict_camel_to_snake_case(camel_dict, convert_keys=True, convert_subkeys=False): """ Recursively convert camelCased keys for a camelCased dict into snake_cased keys :param camel_dict: Dictionary to convert :param convert_keys: Whether the key should be converted :param convert_subkeys: Whether t...
[ "def", "dict_camel_to_snake_case", "(", "camel_dict", ",", "convert_keys", "=", "True", ",", "convert_subkeys", "=", "False", ")", ":", "converted", "=", "{", "}", "for", "key", ",", "value", "in", "camel_dict", ".", "items", "(", ")", ":", "if", "isinstan...
Recursively convert camelCased keys for a camelCased dict into snake_cased keys :param camel_dict: Dictionary to convert :param convert_keys: Whether the key should be converted :param convert_subkeys: Whether to also convert the subkeys, in case they are named properties of the dict :return:
[ "Recursively", "convert", "camelCased", "keys", "for", "a", "camelCased", "dict", "into", "snake_cased", "keys" ]
train
https://github.com/amaas-fintech/amaas-utils-python/blob/5aa64ca65ce0c77b513482d943345d94c9ae58e8/amaasutils/case.py#L7-L33
amaas-fintech/amaas-utils-python
amaasutils/case.py
dict_snake_to_camel_case
def dict_snake_to_camel_case(snake_dict, convert_keys=True, convert_subkeys=False): """ Recursively convert a snake_cased dict into a camelCased dict :param snake_dict: Dictionary to convert :param convert_keys: Whether the key should be converted :param convert_subkeys: Whether to also convert the...
python
def dict_snake_to_camel_case(snake_dict, convert_keys=True, convert_subkeys=False): """ Recursively convert a snake_cased dict into a camelCased dict :param snake_dict: Dictionary to convert :param convert_keys: Whether the key should be converted :param convert_subkeys: Whether to also convert the...
[ "def", "dict_snake_to_camel_case", "(", "snake_dict", ",", "convert_keys", "=", "True", ",", "convert_subkeys", "=", "False", ")", ":", "converted", "=", "{", "}", "for", "key", ",", "value", "in", "snake_dict", ".", "items", "(", ")", ":", "if", "isinstan...
Recursively convert a snake_cased dict into a camelCased dict :param snake_dict: Dictionary to convert :param convert_keys: Whether the key should be converted :param convert_subkeys: Whether to also convert the subkeys, in case they are named properties of the dict :return:
[ "Recursively", "convert", "a", "snake_cased", "dict", "into", "a", "camelCased", "dict" ]
train
https://github.com/amaas-fintech/amaas-utils-python/blob/5aa64ca65ce0c77b513482d943345d94c9ae58e8/amaasutils/case.py#L36-L62
chrisdrackett/django-support
support/forms/widgets.py
ProfilePictureFieldRenderer.render
def render(self): """Outputs a <ul> for this set of radio fields.""" t = template.loader.get_template('support/forms/profile_picture.html') return t.render(template.Context({'widget': self, 'MEDIA_URL': settings.MEDIA_URL }))
python
def render(self): """Outputs a <ul> for this set of radio fields.""" t = template.loader.get_template('support/forms/profile_picture.html') return t.render(template.Context({'widget': self, 'MEDIA_URL': settings.MEDIA_URL }))
[ "def", "render", "(", "self", ")", ":", "t", "=", "template", ".", "loader", ".", "get_template", "(", "'support/forms/profile_picture.html'", ")", "return", "t", ".", "render", "(", "template", ".", "Context", "(", "{", "'widget'", ":", "self", ",", "'MED...
Outputs a <ul> for this set of radio fields.
[ "Outputs", "a", "<ul", ">", "for", "this", "set", "of", "radio", "fields", "." ]
train
https://github.com/chrisdrackett/django-support/blob/a4f29421a31797e0b069637a0afec85328b4f0ca/support/forms/widgets.py#L17-L20
shaunduncan/helga-dubstep
helga_dubstep.py
dubstep
def dubstep(client, channel, nick, message, matches): """ Dubstep can be described as a rapid succession of wub wubs, wow wows, and yep yep yep yeps """ now = time.time() if dubstep._last and (now - dubstep._last) > WUB_TIMEOUT: dubstep._counts[channel] = 0 dubstep._last = now if d...
python
def dubstep(client, channel, nick, message, matches): """ Dubstep can be described as a rapid succession of wub wubs, wow wows, and yep yep yep yeps """ now = time.time() if dubstep._last and (now - dubstep._last) > WUB_TIMEOUT: dubstep._counts[channel] = 0 dubstep._last = now if d...
[ "def", "dubstep", "(", "client", ",", "channel", ",", "nick", ",", "message", ",", "matches", ")", ":", "now", "=", "time", ".", "time", "(", ")", "if", "dubstep", ".", "_last", "and", "(", "now", "-", "dubstep", ".", "_last", ")", ">", "WUB_TIMEOU...
Dubstep can be described as a rapid succession of wub wubs, wow wows, and yep yep yep yeps
[ "Dubstep", "can", "be", "described", "as", "a", "rapid", "succession", "of", "wub", "wubs", "wow", "wows", "and", "yep", "yep", "yep", "yeps" ]
train
https://github.com/shaunduncan/helga-dubstep/blob/32e5eb79c22c9c8f8a5a0496a7fdd9134881bed5/helga_dubstep.py#L14-L29
jtpaasch/simplygithub
simplygithub/internals/trees.py
prepare
def prepare(data): """Restructure/prepare data about trees for output.""" sha = data.get("sha") tree = data.get("tree") return {"sha": sha, "tree": tree}
python
def prepare(data): """Restructure/prepare data about trees for output.""" sha = data.get("sha") tree = data.get("tree") return {"sha": sha, "tree": tree}
[ "def", "prepare", "(", "data", ")", ":", "sha", "=", "data", ".", "get", "(", "\"sha\"", ")", "tree", "=", "data", ".", "get", "(", "\"tree\"", ")", "return", "{", "\"sha\"", ":", "sha", ",", "\"tree\"", ":", "tree", "}" ]
Restructure/prepare data about trees for output.
[ "Restructure", "/", "prepare", "data", "about", "trees", "for", "output", "." ]
train
https://github.com/jtpaasch/simplygithub/blob/b77506275ec276ce90879bf1ea9299a79448b903/simplygithub/internals/trees.py#L8-L12
jtpaasch/simplygithub
simplygithub/internals/trees.py
get_tree
def get_tree(profile, sha, recursive=True): """Fetch a tree. Args: profile A profile generated from ``simplygithub.authentication.profile``. Such profiles tell this module (i) the ``repo`` to connect to, and (ii) the ``token`` to connect with. sha ...
python
def get_tree(profile, sha, recursive=True): """Fetch a tree. Args: profile A profile generated from ``simplygithub.authentication.profile``. Such profiles tell this module (i) the ``repo`` to connect to, and (ii) the ``token`` to connect with. sha ...
[ "def", "get_tree", "(", "profile", ",", "sha", ",", "recursive", "=", "True", ")", ":", "resource", "=", "\"/trees/\"", "+", "sha", "if", "recursive", ":", "resource", "+=", "\"?recursive=1\"", "data", "=", "api", ".", "get_request", "(", "profile", ",", ...
Fetch a tree. Args: profile A profile generated from ``simplygithub.authentication.profile``. Such profiles tell this module (i) the ``repo`` to connect to, and (ii) the ``token`` to connect with. sha The SHA of the tree to fetch. recursive...
[ "Fetch", "a", "tree", "." ]
train
https://github.com/jtpaasch/simplygithub/blob/b77506275ec276ce90879bf1ea9299a79448b903/simplygithub/internals/trees.py#L15-L41