Unnamed: 0
int64
0
10k
repository_name
stringlengths
7
54
func_path_in_repository
stringlengths
5
223
func_name
stringlengths
1
134
whole_func_string
stringlengths
100
30.3k
language
stringclasses
1 value
func_code_string
stringlengths
100
30.3k
func_code_tokens
stringlengths
138
33.2k
func_documentation_string
stringlengths
1
15k
func_documentation_tokens
stringlengths
5
5.14k
split_name
stringclasses
1 value
func_code_url
stringlengths
91
315
9,600
ninuxorg/nodeshot
nodeshot/community/profiles/social_auth_extra/pipeline.py
create_user
def create_user(backend, details, response, uid, username, user=None, *args, **kwargs): """ Creates user. Depends on get_username pipeline. """ if user: return {'user': user} if not username: return None email = details.get('email') original_email = None # email is requir...
python
def create_user(backend, details, response, uid, username, user=None, *args, **kwargs): """ Creates user. Depends on get_username pipeline. """ if user: return {'user': user} if not username: return None email = details.get('email') original_email = None # email is requir...
['def', 'create_user', '(', 'backend', ',', 'details', ',', 'response', ',', 'uid', ',', 'username', ',', 'user', '=', 'None', ',', '*', 'args', ',', '*', '*', 'kwargs', ')', ':', 'if', 'user', ':', 'return', '{', "'user'", ':', 'user', '}', 'if', 'not', 'username', ':', 'return', 'None', 'email', '=', 'details', '.', ...
Creates user. Depends on get_username pipeline.
['Creates', 'user', '.', 'Depends', 'on', 'get_username', 'pipeline', '.']
train
https://github.com/ninuxorg/nodeshot/blob/2466f0a55f522b2696026f196436ce7ba3f1e5c6/nodeshot/community/profiles/social_auth_extra/pipeline.py#L13-L37
9,601
daviddrysdale/python-phonenumbers
python/phonenumbers/phonenumberutil.py
_region_code_for_number_from_list
def _region_code_for_number_from_list(numobj, regions): """Find the region in a list that matches a number""" national_number = national_significant_number(numobj) for region_code in regions: # If leading_digits is present, use this. Otherwise, do full # validation. # Metadata cannot...
python
def _region_code_for_number_from_list(numobj, regions): """Find the region in a list that matches a number""" national_number = national_significant_number(numobj) for region_code in regions: # If leading_digits is present, use this. Otherwise, do full # validation. # Metadata cannot...
['def', '_region_code_for_number_from_list', '(', 'numobj', ',', 'regions', ')', ':', 'national_number', '=', 'national_significant_number', '(', 'numobj', ')', 'for', 'region_code', 'in', 'regions', ':', '# If leading_digits is present, use this. Otherwise, do full', '# validation.', '# Metadata cannot be None because...
Find the region in a list that matches a number
['Find', 'the', 'region', 'in', 'a', 'list', 'that', 'matches', 'a', 'number']
train
https://github.com/daviddrysdale/python-phonenumbers/blob/9cc5bb4ab5e661e70789b4c64bf7a9383c7bdc20/python/phonenumbers/phonenumberutil.py#L2047-L2065
9,602
hannorein/rebound
rebound/simulation.py
Simulation.configure_ghostboxes
def configure_ghostboxes(self, nghostx=0, nghosty=0, nghostz=0): """ Initialize the ghost boxes. This function only needs to be called it boundary conditions other than "none" or "open" are used. In such a case the number of ghostboxes must be known and is set with this functio...
python
def configure_ghostboxes(self, nghostx=0, nghosty=0, nghostz=0): """ Initialize the ghost boxes. This function only needs to be called it boundary conditions other than "none" or "open" are used. In such a case the number of ghostboxes must be known and is set with this functio...
['def', 'configure_ghostboxes', '(', 'self', ',', 'nghostx', '=', '0', ',', 'nghosty', '=', '0', ',', 'nghostz', '=', '0', ')', ':', 'clibrebound', '.', 'nghostx', '=', 'c_int', '(', 'nghostx', ')', 'clibrebound', '.', 'nghosty', '=', 'c_int', '(', 'nghosty', ')', 'clibrebound', '.', 'nghostz', '=', 'c_int', '(', 'ngho...
Initialize the ghost boxes. This function only needs to be called it boundary conditions other than "none" or "open" are used. In such a case the number of ghostboxes must be known and is set with this function. Parameters ---------- nghostx, nghosty, nghostz ...
['Initialize', 'the', 'ghost', 'boxes', '.']
train
https://github.com/hannorein/rebound/blob/bb0f814c98e629401acaab657cae2304b0e003f7/rebound/simulation.py#L1474-L1490
9,603
rwl/pylon
contrib/public/services/jsonrpc/__init__.py
ResponseEvent.waitForResponse
def waitForResponse(self, timeOut=None): """blocks until the response arrived or timeout is reached.""" self.__evt.wait(timeOut) if self.waiting(): raise Timeout() else: if self.response["error"]: raise Exception(self.response["error"]) ...
python
def waitForResponse(self, timeOut=None): """blocks until the response arrived or timeout is reached.""" self.__evt.wait(timeOut) if self.waiting(): raise Timeout() else: if self.response["error"]: raise Exception(self.response["error"]) ...
['def', 'waitForResponse', '(', 'self', ',', 'timeOut', '=', 'None', ')', ':', 'self', '.', '__evt', '.', 'wait', '(', 'timeOut', ')', 'if', 'self', '.', 'waiting', '(', ')', ':', 'raise', 'Timeout', '(', ')', 'else', ':', 'if', 'self', '.', 'response', '[', '"error"', ']', ':', 'raise', 'Exception', '(', 'self', '.', ...
blocks until the response arrived or timeout is reached.
['blocks', 'until', 'the', 'response', 'arrived', 'or', 'timeout', 'is', 'reached', '.']
train
https://github.com/rwl/pylon/blob/916514255db1ae1661406f0283df756baf960d14/contrib/public/services/jsonrpc/__init__.py#L51-L60
9,604
7sDream/zhihu-py3
zhihu/answer.py
Answer.upvoters
def upvoters(self): """获取答案点赞用户,返回生成器. :return: 点赞用户 :rtype: Author.Iterable """ self._make_soup() next_req = '/answer/' + str(self.aid) + '/voters_profile' while next_req != '': data = self._session.get(Zhihu_URL + next_req).json() next_r...
python
def upvoters(self): """获取答案点赞用户,返回生成器. :return: 点赞用户 :rtype: Author.Iterable """ self._make_soup() next_req = '/answer/' + str(self.aid) + '/voters_profile' while next_req != '': data = self._session.get(Zhihu_URL + next_req).json() next_r...
['def', 'upvoters', '(', 'self', ')', ':', 'self', '.', '_make_soup', '(', ')', 'next_req', '=', "'/answer/'", '+', 'str', '(', 'self', '.', 'aid', ')', '+', "'/voters_profile'", 'while', 'next_req', '!=', "''", ':', 'data', '=', 'self', '.', '_session', '.', 'get', '(', 'Zhihu_URL', '+', 'next_req', ')', '.', 'json', ...
获取答案点赞用户,返回生成器. :return: 点赞用户 :rtype: Author.Iterable
['获取答案点赞用户,返回生成器', '.']
train
https://github.com/7sDream/zhihu-py3/blob/bcb4aa8325f8b54d3b44bd0bdc959edd9761fcfc/zhihu/answer.py#L128-L141
9,605
pazz/alot
alot/settings/utils.py
resolve_att
def resolve_att(a, fallback): """ replace '' and 'default' by fallback values """ if a is None: return fallback if a.background in ['default', '']: bg = fallback.background else: bg = a.background if a.foreground in ['default', '']: fg = fallback.foreground else: ...
python
def resolve_att(a, fallback): """ replace '' and 'default' by fallback values """ if a is None: return fallback if a.background in ['default', '']: bg = fallback.background else: bg = a.background if a.foreground in ['default', '']: fg = fallback.foreground else: ...
['def', 'resolve_att', '(', 'a', ',', 'fallback', ')', ':', 'if', 'a', 'is', 'None', ':', 'return', 'fallback', 'if', 'a', '.', 'background', 'in', '[', "'default'", ',', "''", ']', ':', 'bg', '=', 'fallback', '.', 'background', 'else', ':', 'bg', '=', 'a', '.', 'background', 'if', 'a', '.', 'foreground', 'in', '[', "'...
replace '' and 'default' by fallback values
['replace', 'and', 'default', 'by', 'fallback', 'values']
train
https://github.com/pazz/alot/blob/d0297605c0ec1c6b65f541d0fd5b69ac5a0f4ded/alot/settings/utils.py#L85-L97
9,606
hobson/pug-dj
pug/dj/db.py
Columns.pierson
def pierson(self, ddof=0): """Matrix of pierson linear correlation coefficients (rho values) for each pair of columns https://en.wikipedia.org/wiki/Pearson_product-moment_correlation_coefficient >>> Columns([[1, 2, 3], [4, 5, 6]]).pierson() [[1.0, 1.0], [1.0, 1.0]] >>> Columns([...
python
def pierson(self, ddof=0): """Matrix of pierson linear correlation coefficients (rho values) for each pair of columns https://en.wikipedia.org/wiki/Pearson_product-moment_correlation_coefficient >>> Columns([[1, 2, 3], [4, 5, 6]]).pierson() [[1.0, 1.0], [1.0, 1.0]] >>> Columns([...
['def', 'pierson', '(', 'self', ',', 'ddof', '=', '0', ')', ':', 'C', '=', 'self', '.', 'cov', '(', 'ddof', '=', 'ddof', ')', 'rho', '=', '[', ']', 'N', '=', 'len', '(', 'C', ')', 'for', 'i', 'in', 'range', '(', 'N', ')', ':', 'rho', '+=', '[', '[', '1.', ']', '*', 'N', ']', 'for', 'i', 'in', 'range', '(', 'N', ')', ':...
Matrix of pierson linear correlation coefficients (rho values) for each pair of columns https://en.wikipedia.org/wiki/Pearson_product-moment_correlation_coefficient >>> Columns([[1, 2, 3], [4, 5, 6]]).pierson() [[1.0, 1.0], [1.0, 1.0]] >>> Columns([[1, 2, 3], [2.5, 3.5, 4.5]], transpose...
['Matrix', 'of', 'pierson', 'linear', 'correlation', 'coefficients', '(', 'rho', 'values', ')', 'for', 'each', 'pair', 'of', 'columns']
train
https://github.com/hobson/pug-dj/blob/55678b08755a55366ce18e7d3b8ea8fa4491ab04/pug/dj/db.py#L1294-L1314
9,607
fermiPy/fermipy
fermipy/jobs/link.py
Link._latch_file_info
def _latch_file_info(self): """Internal function to update the dictionaries keeping track of input and output files """ self.files.file_dict.clear() self.files.latch_file_info(self.args)
python
def _latch_file_info(self): """Internal function to update the dictionaries keeping track of input and output files """ self.files.file_dict.clear() self.files.latch_file_info(self.args)
['def', '_latch_file_info', '(', 'self', ')', ':', 'self', '.', 'files', '.', 'file_dict', '.', 'clear', '(', ')', 'self', '.', 'files', '.', 'latch_file_info', '(', 'self', '.', 'args', ')']
Internal function to update the dictionaries keeping track of input and output files
['Internal', 'function', 'to', 'update', 'the', 'dictionaries', 'keeping', 'track', 'of', 'input', 'and', 'output', 'files']
train
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/jobs/link.py#L361-L366
9,608
sernst/cauldron
cauldron/cli/threads.py
abort_thread
def abort_thread(): """ This function checks to see if the user has indicated that they want the currently running execution to stop prematurely by marking the running thread as aborted. It only applies to operations that are run within CauldronThreads and not the main thread. """ thread = ...
python
def abort_thread(): """ This function checks to see if the user has indicated that they want the currently running execution to stop prematurely by marking the running thread as aborted. It only applies to operations that are run within CauldronThreads and not the main thread. """ thread = ...
['def', 'abort_thread', '(', ')', ':', 'thread', '=', 'threading', '.', 'current_thread', '(', ')', 'if', 'not', 'isinstance', '(', 'thread', ',', 'CauldronThread', ')', ':', 'return', 'if', 'thread', '.', 'is_executing', 'and', 'thread', '.', 'abort', ':', 'raise', 'ThreadAbortError', '(', "'User Aborted Execution'", ...
This function checks to see if the user has indicated that they want the currently running execution to stop prematurely by marking the running thread as aborted. It only applies to operations that are run within CauldronThreads and not the main thread.
['This', 'function', 'checks', 'to', 'see', 'if', 'the', 'user', 'has', 'indicated', 'that', 'they', 'want', 'the', 'currently', 'running', 'execution', 'to', 'stop', 'prematurely', 'by', 'marking', 'the', 'running', 'thread', 'as', 'aborted', '.', 'It', 'only', 'applies', 'to', 'operations', 'that', 'are', 'run', 'wit...
train
https://github.com/sernst/cauldron/blob/4086aec9c038c402ea212c79fe8bd0d27104f9cf/cauldron/cli/threads.py#L105-L119
9,609
jim-easterbrook/pywws
src/pywws/device_pyusb1.py
USBDevice.write_data
def write_data(self, buf): """Send data to the device. If the write fails for any reason, an :obj:`IOError` exception is raised. :param buf: the data to send. :type buf: list(int) :return: success status. :rtype: bool """ bmRequestType = usb....
python
def write_data(self, buf): """Send data to the device. If the write fails for any reason, an :obj:`IOError` exception is raised. :param buf: the data to send. :type buf: list(int) :return: success status. :rtype: bool """ bmRequestType = usb....
['def', 'write_data', '(', 'self', ',', 'buf', ')', ':', 'bmRequestType', '=', 'usb', '.', 'util', '.', 'build_request_type', '(', 'usb', '.', 'util', '.', 'ENDPOINT_OUT', ',', 'usb', '.', 'util', '.', 'CTRL_TYPE_CLASS', ',', 'usb', '.', 'util', '.', 'CTRL_RECIPIENT_INTERFACE', ')', 'result', '=', 'self', '.', 'dev', '...
Send data to the device. If the write fails for any reason, an :obj:`IOError` exception is raised. :param buf: the data to send. :type buf: list(int) :return: success status. :rtype: bool
['Send', 'data', 'to', 'the', 'device', '.']
train
https://github.com/jim-easterbrook/pywws/blob/4e4d74cee5a3ac5bf42286feaa251cd2ffcaf02c/src/pywws/device_pyusb1.py#L108-L136
9,610
clld/clldutils
src/clldutils/sfm.py
Entry.get
def get(self, key, default=None): """Retrieve the first value for a marker or None.""" for k, v in self: if k == key: return v return default
python
def get(self, key, default=None): """Retrieve the first value for a marker or None.""" for k, v in self: if k == key: return v return default
['def', 'get', '(', 'self', ',', 'key', ',', 'default', '=', 'None', ')', ':', 'for', 'k', ',', 'v', 'in', 'self', ':', 'if', 'k', '==', 'key', ':', 'return', 'v', 'return', 'default']
Retrieve the first value for a marker or None.
['Retrieve', 'the', 'first', 'value', 'for', 'a', 'marker', 'or', 'None', '.']
train
https://github.com/clld/clldutils/blob/7b8587ef5b56a2fc6cafaff90bc5004355c2b13f/src/clldutils/sfm.py#L71-L76
9,611
jssimporter/python-jss
jss/jssobjects.py
LDAPServer.is_user_in_group
def is_user_in_group(self, user, group): """Test for whether a user is in a group. There is also the ability in the API to test for whether multiple users are members of an LDAP group, but you should just call is_user_in_group over an enumerated list of users. Args: ...
python
def is_user_in_group(self, user, group): """Test for whether a user is in a group. There is also the ability in the API to test for whether multiple users are members of an LDAP group, but you should just call is_user_in_group over an enumerated list of users. Args: ...
['def', 'is_user_in_group', '(', 'self', ',', 'user', ',', 'group', ')', ':', 'search_url', '=', '"%s/%s/%s/%s/%s"', '%', '(', 'self', '.', 'url', ',', '"group"', ',', 'group', ',', '"user"', ',', 'user', ')', 'response', '=', 'self', '.', 'jss', '.', 'get', '(', 'search_url', ')', '# Sanity check', 'length', '=', 'len...
Test for whether a user is in a group. There is also the ability in the API to test for whether multiple users are members of an LDAP group, but you should just call is_user_in_group over an enumerated list of users. Args: user: String username. group: String gr...
['Test', 'for', 'whether', 'a', 'user', 'is', 'in', 'a', 'group', '.']
train
https://github.com/jssimporter/python-jss/blob/b95185d74e0c0531b0b563f280d4129e21d5fe5d/jss/jssobjects.py#L522-L550
9,612
swistakm/graceful
src/graceful/authentication.py
DummyUserStorage.get_user
def get_user( self, identified_with, identifier, req, resp, resource, uri_kwargs ): """Return default user object.""" return self.user
python
def get_user( self, identified_with, identifier, req, resp, resource, uri_kwargs ): """Return default user object.""" return self.user
['def', 'get_user', '(', 'self', ',', 'identified_with', ',', 'identifier', ',', 'req', ',', 'resp', ',', 'resource', ',', 'uri_kwargs', ')', ':', 'return', 'self', '.', 'user']
Return default user object.
['Return', 'default', 'user', 'object', '.']
train
https://github.com/swistakm/graceful/blob/d4678cb6349a5c843a5e58002fc80140821609e4/src/graceful/authentication.py#L77-L81
9,613
Murali-group/halp
halp/directed_hypergraph.py
DirectedHypergraph.get_symmetric_image
def get_symmetric_image(self): """Creates a new DirectedHypergraph object that is the symmetric image of this hypergraph (i.e., identical hypergraph with all edge directions reversed). Copies of each of the nodes' and hyperedges' attributes are stored and used in the new hypergra...
python
def get_symmetric_image(self): """Creates a new DirectedHypergraph object that is the symmetric image of this hypergraph (i.e., identical hypergraph with all edge directions reversed). Copies of each of the nodes' and hyperedges' attributes are stored and used in the new hypergra...
['def', 'get_symmetric_image', '(', 'self', ')', ':', 'new_H', '=', 'self', '.', 'copy', '(', ')', '# No change to _node_attributes necessary, as nodes remain the same', '# Reverse the tail and head (and __frozen_tail and __frozen_head) for', '# every hyperedge', 'for', 'hyperedge_id', 'in', 'self', '.', 'get_hyperedge...
Creates a new DirectedHypergraph object that is the symmetric image of this hypergraph (i.e., identical hypergraph with all edge directions reversed). Copies of each of the nodes' and hyperedges' attributes are stored and used in the new hypergraph. :returns: DirectedHypergraph ...
['Creates', 'a', 'new', 'DirectedHypergraph', 'object', 'that', 'is', 'the', 'symmetric', 'image', 'of', 'this', 'hypergraph', '(', 'i', '.', 'e', '.', 'identical', 'hypergraph', 'with', 'all', 'edge', 'directions', 'reversed', ')', '.', 'Copies', 'of', 'each', 'of', 'the', 'nodes', 'and', 'hyperedges', 'attributes', '...
train
https://github.com/Murali-group/halp/blob/6eb27466ba84e2281e18f93b62aae5efb21ef8b3/halp/directed_hypergraph.py#L1012-L1044
9,614
tanghaibao/jcvi
jcvi/formats/fastq.py
some
def some(args): """ %prog some idsfile afastq [bfastq] Select a subset of the reads with ids present in the idsfile. `bfastq` is optional (only if reads are paired) """ p = OptionParser(some.__doc__) opts, args = p.parse_args(args) if len(args) not in (2, 3): sys.exit(not p.pri...
python
def some(args): """ %prog some idsfile afastq [bfastq] Select a subset of the reads with ids present in the idsfile. `bfastq` is optional (only if reads are paired) """ p = OptionParser(some.__doc__) opts, args = p.parse_args(args) if len(args) not in (2, 3): sys.exit(not p.pri...
['def', 'some', '(', 'args', ')', ':', 'p', '=', 'OptionParser', '(', 'some', '.', '__doc__', ')', 'opts', ',', 'args', '=', 'p', '.', 'parse_args', '(', 'args', ')', 'if', 'len', '(', 'args', ')', 'not', 'in', '(', '2', ',', '3', ')', ':', 'sys', '.', 'exit', '(', 'not', 'p', '.', 'print_help', '(', ')', ')', 'idsfile...
%prog some idsfile afastq [bfastq] Select a subset of the reads with ids present in the idsfile. `bfastq` is optional (only if reads are paired)
['%prog', 'some', 'idsfile', 'afastq', '[', 'bfastq', ']']
train
https://github.com/tanghaibao/jcvi/blob/d2e31a77b6ade7f41f3b321febc2b4744d1cdeca/jcvi/formats/fastq.py#L686-L718
9,615
msoulier/tftpy
tftpy/TftpStates.py
TftpState.handleOACK
def handleOACK(self, pkt): """This method handles an OACK from the server, syncing any accepted options.""" if len(pkt.options.keys()) > 0: if pkt.match_options(self.context.options): log.info("Successful negotiation of options") # Set options to OACK ...
python
def handleOACK(self, pkt): """This method handles an OACK from the server, syncing any accepted options.""" if len(pkt.options.keys()) > 0: if pkt.match_options(self.context.options): log.info("Successful negotiation of options") # Set options to OACK ...
['def', 'handleOACK', '(', 'self', ',', 'pkt', ')', ':', 'if', 'len', '(', 'pkt', '.', 'options', '.', 'keys', '(', ')', ')', '>', '0', ':', 'if', 'pkt', '.', 'match_options', '(', 'self', '.', 'context', '.', 'options', ')', ':', 'log', '.', 'info', '(', '"Successful negotiation of options"', ')', '# Set options to OA...
This method handles an OACK from the server, syncing any accepted options.
['This', 'method', 'handles', 'an', 'OACK', 'from', 'the', 'server', 'syncing', 'any', 'accepted', 'options', '.']
train
https://github.com/msoulier/tftpy/blob/af2f2fe89a3bf45748b78703820efb0986a8207a/tftpy/TftpStates.py#L39-L53
9,616
bcbio/bcbio-nextgen
bcbio/broad/__init__.py
_clean_java_out
def _clean_java_out(version_str): """Remove extra environmental information reported in java when querying for versions. Java will report information like _JAVA_OPTIONS environmental variables in the output. """ out = [] for line in version_str.decode().split("\n"): if line.startswith("Pick...
python
def _clean_java_out(version_str): """Remove extra environmental information reported in java when querying for versions. Java will report information like _JAVA_OPTIONS environmental variables in the output. """ out = [] for line in version_str.decode().split("\n"): if line.startswith("Pick...
['def', '_clean_java_out', '(', 'version_str', ')', ':', 'out', '=', '[', ']', 'for', 'line', 'in', 'version_str', '.', 'decode', '(', ')', '.', 'split', '(', '"\\n"', ')', ':', 'if', 'line', '.', 'startswith', '(', '"Picked up"', ')', ':', 'pass', 'if', 'line', '.', 'find', '(', '"setlocale"', ')', '>', '0', ':', 'pas...
Remove extra environmental information reported in java when querying for versions. Java will report information like _JAVA_OPTIONS environmental variables in the output.
['Remove', 'extra', 'environmental', 'information', 'reported', 'in', 'java', 'when', 'querying', 'for', 'versions', '.']
train
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/broad/__init__.py#L69-L82
9,617
tgbugs/pyontutils
ilxutils/ilxutils/simple_scicrunch_client.py
Client.custom_update
def custom_update(self, data, pred, obj): ''' Updates existing entity proprty based on the predicate input ''' if isinstance(data[pred], str): # for all simple properties of str value data[pred] = str(obj) else: # synonyms, superclasses, and existing_ids have special requirements ...
python
def custom_update(self, data, pred, obj): ''' Updates existing entity proprty based on the predicate input ''' if isinstance(data[pred], str): # for all simple properties of str value data[pred] = str(obj) else: # synonyms, superclasses, and existing_ids have special requirements ...
['def', 'custom_update', '(', 'self', ',', 'data', ',', 'pred', ',', 'obj', ')', ':', 'if', 'isinstance', '(', 'data', '[', 'pred', ']', ',', 'str', ')', ':', '# for all simple properties of str value', 'data', '[', 'pred', ']', '=', 'str', '(', 'obj', ')', 'else', ':', '# synonyms, superclasses, and existing_ids have ...
Updates existing entity proprty based on the predicate input
['Updates', 'existing', 'entity', 'proprty', 'based', 'on', 'the', 'predicate', 'input']
train
https://github.com/tgbugs/pyontutils/blob/3d913db29c177db39151592909a4f56170ef8b35/ilxutils/ilxutils/simple_scicrunch_client.py#L237-L274
9,618
allenai/allennlp
allennlp/modules/conditional_random_field.py
ConditionalRandomField._input_likelihood
def _input_likelihood(self, logits: torch.Tensor, mask: torch.Tensor) -> torch.Tensor: """ Computes the (batch_size,) denominator term for the log-likelihood, which is the sum of the likelihoods across all possible state sequences. """ batch_size, sequence_length, num_tags = logi...
python
def _input_likelihood(self, logits: torch.Tensor, mask: torch.Tensor) -> torch.Tensor: """ Computes the (batch_size,) denominator term for the log-likelihood, which is the sum of the likelihoods across all possible state sequences. """ batch_size, sequence_length, num_tags = logi...
['def', '_input_likelihood', '(', 'self', ',', 'logits', ':', 'torch', '.', 'Tensor', ',', 'mask', ':', 'torch', '.', 'Tensor', ')', '->', 'torch', '.', 'Tensor', ':', 'batch_size', ',', 'sequence_length', ',', 'num_tags', '=', 'logits', '.', 'size', '(', ')', '# Transpose batch size and sequence dimensions', 'mask', '...
Computes the (batch_size,) denominator term for the log-likelihood, which is the sum of the likelihoods across all possible state sequences.
['Computes', 'the', '(', 'batch_size', ')', 'denominator', 'term', 'for', 'the', 'log', '-', 'likelihood', 'which', 'is', 'the', 'sum', 'of', 'the', 'likelihoods', 'across', 'all', 'possible', 'state', 'sequences', '.']
train
https://github.com/allenai/allennlp/blob/648a36f77db7e45784c047176074f98534c76636/allennlp/modules/conditional_random_field.py#L207-L251
9,619
honzamach/pynspect
pynspect/filters.py
DataObjectFilter.prepare
def prepare(self, rule): """ Parse and/or compile given rule into rule tree. :param rule: Filtering grammar rule. :return: Parsed and/or compiled rule. """ if self.parser: rule = self.parser.parse(rule) if self.compiler: rule = self.compil...
python
def prepare(self, rule): """ Parse and/or compile given rule into rule tree. :param rule: Filtering grammar rule. :return: Parsed and/or compiled rule. """ if self.parser: rule = self.parser.parse(rule) if self.compiler: rule = self.compil...
['def', 'prepare', '(', 'self', ',', 'rule', ')', ':', 'if', 'self', '.', 'parser', ':', 'rule', '=', 'self', '.', 'parser', '.', 'parse', '(', 'rule', ')', 'if', 'self', '.', 'compiler', ':', 'rule', '=', 'self', '.', 'compiler', '.', 'compile', '(', 'rule', ')', 'return', 'rule']
Parse and/or compile given rule into rule tree. :param rule: Filtering grammar rule. :return: Parsed and/or compiled rule.
['Parse', 'and', '/', 'or', 'compile', 'given', 'rule', 'into', 'rule', 'tree', '.']
train
https://github.com/honzamach/pynspect/blob/0582dcc1f7aafe50e25a21c792ea1b3367ea5881/pynspect/filters.py#L209-L220
9,620
sffjunkie/astral
src/astral.py
Astral.solar_zenith
def solar_zenith(self, dateandtime, latitude, longitude): """Calculates the solar zenith angle. :param dateandtime: The date and time for which to calculate the angle. :type dateandtime: :class:`~datetime.datetime` :param latitude: Latitude - Northern latit...
python
def solar_zenith(self, dateandtime, latitude, longitude): """Calculates the solar zenith angle. :param dateandtime: The date and time for which to calculate the angle. :type dateandtime: :class:`~datetime.datetime` :param latitude: Latitude - Northern latit...
['def', 'solar_zenith', '(', 'self', ',', 'dateandtime', ',', 'latitude', ',', 'longitude', ')', ':', 'return', '90.0', '-', 'self', '.', 'solar_elevation', '(', 'dateandtime', ',', 'latitude', ',', 'longitude', ')']
Calculates the solar zenith angle. :param dateandtime: The date and time for which to calculate the angle. :type dateandtime: :class:`~datetime.datetime` :param latitude: Latitude - Northern latitudes should be positive :type latitude: float :par...
['Calculates', 'the', 'solar', 'zenith', 'angle', '.']
train
https://github.com/sffjunkie/astral/blob/b0aa63fce692357cd33c2bf36c69ed5b6582440c/src/astral.py#L2482-L2500
9,621
santoshphilip/eppy
eppy/hvacbuilder.py
replacebranch
def replacebranch(idf, loop, branch, listofcomponents, fluid=None, debugsave=False, testing=None): """It will replace the components in the branch with components in listofcomponents""" if fluid is None: fluid = '' # -------- testing --------...
python
def replacebranch(idf, loop, branch, listofcomponents, fluid=None, debugsave=False, testing=None): """It will replace the components in the branch with components in listofcomponents""" if fluid is None: fluid = '' # -------- testing --------...
['def', 'replacebranch', '(', 'idf', ',', 'loop', ',', 'branch', ',', 'listofcomponents', ',', 'fluid', '=', 'None', ',', 'debugsave', '=', 'False', ',', 'testing', '=', 'None', ')', ':', 'if', 'fluid', 'is', 'None', ':', 'fluid', '=', "''", '# -------- testing ---------', 'testn', '=', '0', '# -------- testing -------...
It will replace the components in the branch with components in listofcomponents
['It', 'will', 'replace', 'the', 'components', 'in', 'the', 'branch', 'with', 'components', 'in', 'listofcomponents']
train
https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/hvacbuilder.py#L1005-L1178
9,622
aliyun/aliyun-log-python-sdk
aliyun/log/logclient.py
LogClient.get_logs
def get_logs(self, request): """ Get logs from log service. Unsuccessful opertaion will cause an LogException. Note: for larger volume of data (e.g. > 1 million logs), use get_log_all :type request: GetLogsRequest :param request: the GetLogs request parameters class. ...
python
def get_logs(self, request): """ Get logs from log service. Unsuccessful opertaion will cause an LogException. Note: for larger volume of data (e.g. > 1 million logs), use get_log_all :type request: GetLogsRequest :param request: the GetLogs request parameters class. ...
['def', 'get_logs', '(', 'self', ',', 'request', ')', ':', 'project', '=', 'request', '.', 'get_project', '(', ')', 'logstore', '=', 'request', '.', 'get_logstore', '(', ')', 'from_time', '=', 'request', '.', 'get_from', '(', ')', 'to_time', '=', 'request', '.', 'get_to', '(', ')', 'topic', '=', 'request', '.', 'get_to...
Get logs from log service. Unsuccessful opertaion will cause an LogException. Note: for larger volume of data (e.g. > 1 million logs), use get_log_all :type request: GetLogsRequest :param request: the GetLogs request parameters class. :return: GetLogsResponse ...
['Get', 'logs', 'from', 'log', 'service', '.', 'Unsuccessful', 'opertaion', 'will', 'cause', 'an', 'LogException', '.', 'Note', ':', 'for', 'larger', 'volume', 'of', 'data', '(', 'e', '.', 'g', '.', '>', '1', 'million', 'logs', ')', 'use', 'get_log_all', ':', 'type', 'request', ':', 'GetLogsRequest', ':', 'param', 'req...
train
https://github.com/aliyun/aliyun-log-python-sdk/blob/ac383db0a16abf1e5ef7df36074374184b43516e/aliyun/log/logclient.py#L547-L570
9,623
manahl/arctic
arctic/tickstore/toplevel.py
TopLevelTickStore.add
def add(self, date_range, library_name): """ Adds the library with the given date range to the underlying collection of libraries used by this store. The underlying libraries should not overlap as the date ranges are assumed to be CLOSED_CLOSED by this function and the rest of the class....
python
def add(self, date_range, library_name): """ Adds the library with the given date range to the underlying collection of libraries used by this store. The underlying libraries should not overlap as the date ranges are assumed to be CLOSED_CLOSED by this function and the rest of the class....
['def', 'add', '(', 'self', ',', 'date_range', ',', 'library_name', ')', ':', '# check that the library is valid', 'try', ':', 'self', '.', '_arctic_lib', '.', 'arctic', '[', 'library_name', ']', 'except', 'Exception', 'as', 'e', ':', 'logger', '.', 'error', '(', '"Could not load library"', ')', 'raise', 'e', 'assert',...
Adds the library with the given date range to the underlying collection of libraries used by this store. The underlying libraries should not overlap as the date ranges are assumed to be CLOSED_CLOSED by this function and the rest of the class. Arguments: date_range: A date range provid...
['Adds', 'the', 'library', 'with', 'the', 'given', 'date', 'range', 'to', 'the', 'underlying', 'collection', 'of', 'libraries', 'used', 'by', 'this', 'store', '.', 'The', 'underlying', 'libraries', 'should', 'not', 'overlap', 'as', 'the', 'date', 'ranges', 'are', 'assumed', 'to', 'be', 'CLOSED_CLOSED', 'by', 'this', 'f...
train
https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/tickstore/toplevel.py#L71-L103
9,624
user-cont/conu
conu/backend/k8s/backend.py
K8sBackend.cleanup_deployments
def cleanup_deployments(self): """ Delete all deployments created in namespaces associated with this backend :return: None """ deployments = self.list_deployments() for deployment in deployments: if deployment.namespace in self.managed_namespaces: ...
python
def cleanup_deployments(self): """ Delete all deployments created in namespaces associated with this backend :return: None """ deployments = self.list_deployments() for deployment in deployments: if deployment.namespace in self.managed_namespaces: ...
['def', 'cleanup_deployments', '(', 'self', ')', ':', 'deployments', '=', 'self', '.', 'list_deployments', '(', ')', 'for', 'deployment', 'in', 'deployments', ':', 'if', 'deployment', '.', 'namespace', 'in', 'self', '.', 'managed_namespaces', ':', 'deployment', '.', 'delete', '(', ')']
Delete all deployments created in namespaces associated with this backend :return: None
['Delete', 'all', 'deployments', 'created', 'in', 'namespaces', 'associated', 'with', 'this', 'backend', ':', 'return', ':', 'None']
train
https://github.com/user-cont/conu/blob/08caae7bb6bdd265b55bb106c3da6a7946a5a352/conu/backend/k8s/backend.py#L228-L237
9,625
mitsei/dlkit
dlkit/json_/assessment/sessions.py
BankHierarchySession.get_parent_bank_ids
def get_parent_bank_ids(self, bank_id): """Gets the parent ``Ids`` of the given bank. arg: bank_id (osid.id.Id): a bank ``Id`` return: (osid.id.IdList) - the parent ``Ids`` of the bank raise: NotFound - ``bank_id`` is not found raise: NullArgument - ``bank_id`` is ``null`` ...
python
def get_parent_bank_ids(self, bank_id): """Gets the parent ``Ids`` of the given bank. arg: bank_id (osid.id.Id): a bank ``Id`` return: (osid.id.IdList) - the parent ``Ids`` of the bank raise: NotFound - ``bank_id`` is not found raise: NullArgument - ``bank_id`` is ``null`` ...
['def', 'get_parent_bank_ids', '(', 'self', ',', 'bank_id', ')', ':', '# Implemented from template for', '# osid.resource.BinHierarchySession.get_parent_bin_ids', 'if', 'self', '.', '_catalog_session', 'is', 'not', 'None', ':', 'return', 'self', '.', '_catalog_session', '.', 'get_parent_catalog_ids', '(', 'catalog_id',...
Gets the parent ``Ids`` of the given bank. arg: bank_id (osid.id.Id): a bank ``Id`` return: (osid.id.IdList) - the parent ``Ids`` of the bank raise: NotFound - ``bank_id`` is not found raise: NullArgument - ``bank_id`` is ``null`` raise: OperationFailed - unable to complet...
['Gets', 'the', 'parent', 'Ids', 'of', 'the', 'given', 'bank', '.']
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/assessment/sessions.py#L9075-L9091
9,626
flowersteam/explauto
explauto/utils/utils.py
discrete_random_draw
def discrete_random_draw(data, nb=1): ''' Code from Steve Nguyen''' data = np.array(data) if not data.any(): data = np.ones_like(data) data = data/data.sum() xk = np.arange(len(data)) custm = stats.rv_discrete(name='custm', values=(xk, data)) return custm.rvs(size=nb)
python
def discrete_random_draw(data, nb=1): ''' Code from Steve Nguyen''' data = np.array(data) if not data.any(): data = np.ones_like(data) data = data/data.sum() xk = np.arange(len(data)) custm = stats.rv_discrete(name='custm', values=(xk, data)) return custm.rvs(size=nb)
['def', 'discrete_random_draw', '(', 'data', ',', 'nb', '=', '1', ')', ':', 'data', '=', 'np', '.', 'array', '(', 'data', ')', 'if', 'not', 'data', '.', 'any', '(', ')', ':', 'data', '=', 'np', '.', 'ones_like', '(', 'data', ')', 'data', '=', 'data', '/', 'data', '.', 'sum', '(', ')', 'xk', '=', 'np', '.', 'arange', '(...
Code from Steve Nguyen
['Code', 'from', 'Steve', 'Nguyen']
train
https://github.com/flowersteam/explauto/blob/cf0f81ecb9f6412f7276a95bd27359000e1e26b6/explauto/utils/utils.py#L46-L54
9,627
exa-analytics/exa
exa/core/editor.py
Editor.head
def head(self, n=10): """ Display the top of the file. Args: n (int): Number of lines to display """ r = self.__repr__().split('\n') print('\n'.join(r[:n]), end=' ')
python
def head(self, n=10): """ Display the top of the file. Args: n (int): Number of lines to display """ r = self.__repr__().split('\n') print('\n'.join(r[:n]), end=' ')
['def', 'head', '(', 'self', ',', 'n', '=', '10', ')', ':', 'r', '=', 'self', '.', '__repr__', '(', ')', '.', 'split', '(', "'\\n'", ')', 'print', '(', "'\\n'", '.', 'join', '(', 'r', '[', ':', 'n', ']', ')', ',', 'end', '=', "' '", ')']
Display the top of the file. Args: n (int): Number of lines to display
['Display', 'the', 'top', 'of', 'the', 'file', '.']
train
https://github.com/exa-analytics/exa/blob/40fb3c22b531d460dbc51e603de75b856cc28f0d/exa/core/editor.py#L88-L96
9,628
pywbem/pywbem
pywbem/_recorder.py
_represent_undefined
def _represent_undefined(self, data): """Raises flag for objects that cannot be represented""" raise RepresenterError( _format("Cannot represent an object: {0!A} of type: {1}; " "yaml_representers: {2!A}, " "yaml_multi_representers: {3!A}", data, type(data...
python
def _represent_undefined(self, data): """Raises flag for objects that cannot be represented""" raise RepresenterError( _format("Cannot represent an object: {0!A} of type: {1}; " "yaml_representers: {2!A}, " "yaml_multi_representers: {3!A}", data, type(data...
['def', '_represent_undefined', '(', 'self', ',', 'data', ')', ':', 'raise', 'RepresenterError', '(', '_format', '(', '"Cannot represent an object: {0!A} of type: {1}; "', '"yaml_representers: {2!A}, "', '"yaml_multi_representers: {3!A}"', ',', 'data', ',', 'type', '(', 'data', ')', ',', 'self', '.', 'yaml_representers...
Raises flag for objects that cannot be represented
['Raises', 'flag', 'for', 'objects', 'that', 'cannot', 'be', 'represented']
train
https://github.com/pywbem/pywbem/blob/e54ecb82c2211e289a268567443d60fdd489f1e4/pywbem/_recorder.py#L133-L140
9,629
insightindustry/validator-collection
validator_collection/checkers.py
is_uuid
def is_uuid(value, **kwargs): """Indicate whether ``value`` contains a :class:`UUID <python:uuid.UUID>` :param value: The value to evaluate. :returns: ``True`` if ``value`` is valid, ``False`` if it is not. :rtype: :class:`bool <python:bool>` :raises SyntaxError: if ``kwargs`` contains duplicate ...
python
def is_uuid(value, **kwargs): """Indicate whether ``value`` contains a :class:`UUID <python:uuid.UUID>` :param value: The value to evaluate. :returns: ``True`` if ``value`` is valid, ``False`` if it is not. :rtype: :class:`bool <python:bool>` :raises SyntaxError: if ``kwargs`` contains duplicate ...
['def', 'is_uuid', '(', 'value', ',', '*', '*', 'kwargs', ')', ':', 'try', ':', 'validators', '.', 'uuid', '(', 'value', ',', '*', '*', 'kwargs', ')', 'except', 'SyntaxError', 'as', 'error', ':', 'raise', 'error', 'except', 'Exception', ':', 'return', 'False', 'return', 'True']
Indicate whether ``value`` contains a :class:`UUID <python:uuid.UUID>` :param value: The value to evaluate. :returns: ``True`` if ``value`` is valid, ``False`` if it is not. :rtype: :class:`bool <python:bool>` :raises SyntaxError: if ``kwargs`` contains duplicate keyword parameters or duplicates ...
['Indicate', 'whether', 'value', 'contains', 'a', ':', 'class', ':', 'UUID', '<python', ':', 'uuid', '.', 'UUID', '>']
train
https://github.com/insightindustry/validator-collection/blob/8c8047a0fa36cc88a021771279898278c4cc98e3/validator_collection/checkers.py#L585-L604
9,630
bapakode/OmMongo
ommongo/query.py
Query.fields
def fields(self, *fields): ''' Only return the specified fields from the object. Accessing a \ field that was not specified in ``fields`` will result in a \ :class:``ommongo.document.FieldNotRetrieved`` exception being \ raised :param fields: Instances of :class...
python
def fields(self, *fields): ''' Only return the specified fields from the object. Accessing a \ field that was not specified in ``fields`` will result in a \ :class:``ommongo.document.FieldNotRetrieved`` exception being \ raised :param fields: Instances of :class...
['def', 'fields', '(', 'self', ',', '*', 'fields', ')', ':', 'if', 'self', '.', '_fields', 'is', 'None', ':', 'self', '.', '_fields', '=', 'set', '(', ')', 'for', 'f', 'in', 'fields', ':', 'f', '=', 'resolve_name', '(', 'self', '.', 'type', ',', 'f', ')', 'self', '.', '_fields', '.', 'add', '(', 'f', ')', 'self', '.', ...
Only return the specified fields from the object. Accessing a \ field that was not specified in ``fields`` will result in a \ :class:``ommongo.document.FieldNotRetrieved`` exception being \ raised :param fields: Instances of :class:``ommongo.query.QueryField`` specifyin...
['Only', 'return', 'the', 'specified', 'fields', 'from', 'the', 'object', '.', 'Accessing', 'a', '\\', 'field', 'that', 'was', 'not', 'specified', 'in', 'fields', 'will', 'result', 'in', 'a', '\\', ':', 'class', ':', 'ommongo', '.', 'document', '.', 'FieldNotRetrieved', 'exception', 'being', '\\', 'raised']
train
https://github.com/bapakode/OmMongo/blob/52b5a5420516dc709f2d2eb065818c7973991ce3/ommongo/query.py#L230-L245
9,631
genialis/resolwe
resolwe/process/runtime.py
Process.run_process
def run_process(self, slug, inputs): """Run a new process from a running process.""" def export_files(value): """Export input files of spawned process.""" if isinstance(value, str) and os.path.isfile(value): # TODO: Use the protocol to export files and get the ...
python
def run_process(self, slug, inputs): """Run a new process from a running process.""" def export_files(value): """Export input files of spawned process.""" if isinstance(value, str) and os.path.isfile(value): # TODO: Use the protocol to export files and get the ...
['def', 'run_process', '(', 'self', ',', 'slug', ',', 'inputs', ')', ':', 'def', 'export_files', '(', 'value', ')', ':', '"""Export input files of spawned process."""', 'if', 'isinstance', '(', 'value', ',', 'str', ')', 'and', 'os', '.', 'path', '.', 'isfile', '(', 'value', ')', ':', '# TODO: Use the protocol to export...
Run a new process from a running process.
['Run', 'a', 'new', 'process', 'from', 'a', 'running', 'process', '.']
train
https://github.com/genialis/resolwe/blob/f7bb54932c81ec0cfc5b5e80d238fceaeaa48d86/resolwe/process/runtime.py#L177-L193
9,632
LuqueDaniel/pybooru
pybooru/moebooru.py
Moebooru._build_hash_string
def _build_hash_string(self): """Function for build password hash string. Raises: PybooruError: When isn't provide hash string. PybooruError: When aren't provide username or password. PybooruError: When Pybooru can't add password to hash strring. """ ...
python
def _build_hash_string(self): """Function for build password hash string. Raises: PybooruError: When isn't provide hash string. PybooruError: When aren't provide username or password. PybooruError: When Pybooru can't add password to hash strring. """ ...
['def', '_build_hash_string', '(', 'self', ')', ':', '# Build AUTENTICATION hash_string', '# Check if hash_string exists', 'if', 'self', '.', 'site_name', 'in', 'SITE_LIST', 'or', 'self', '.', 'hash_string', ':', 'if', 'self', '.', 'username', 'and', 'self', '.', 'password', ':', 'try', ':', 'hash_string', '=', 'self',...
Function for build password hash string. Raises: PybooruError: When isn't provide hash string. PybooruError: When aren't provide username or password. PybooruError: When Pybooru can't add password to hash strring.
['Function', 'for', 'build', 'password', 'hash', 'string', '.']
train
https://github.com/LuqueDaniel/pybooru/blob/60cd5254684d293b308f0b11b8f4ac2dce101479/pybooru/moebooru.py#L104-L131
9,633
yyuu/botornado
boto/ec2/volume.py
Volume.snapshots
def snapshots(self, owner=None, restorable_by=None): """ Get all snapshots related to this volume. Note that this requires that all available snapshots for the account be retrieved from EC2 first and then the list is filtered client-side to contain only those for this volume. ...
python
def snapshots(self, owner=None, restorable_by=None): """ Get all snapshots related to this volume. Note that this requires that all available snapshots for the account be retrieved from EC2 first and then the list is filtered client-side to contain only those for this volume. ...
['def', 'snapshots', '(', 'self', ',', 'owner', '=', 'None', ',', 'restorable_by', '=', 'None', ')', ':', 'rs', '=', 'self', '.', 'connection', '.', 'get_all_snapshots', '(', 'owner', '=', 'owner', ',', 'restorable_by', '=', 'restorable_by', ')', 'mine', '=', '[', ']', 'for', 'snap', 'in', 'rs', ':', 'if', 'snap', '.',...
Get all snapshots related to this volume. Note that this requires that all available snapshots for the account be retrieved from EC2 first and then the list is filtered client-side to contain only those for this volume. :type owner: str :param owner: If present, only the snapsh...
['Get', 'all', 'snapshots', 'related', 'to', 'this', 'volume', '.', 'Note', 'that', 'this', 'requires', 'that', 'all', 'available', 'snapshots', 'for', 'the', 'account', 'be', 'retrieved', 'from', 'EC2', 'first', 'and', 'then', 'the', 'list', 'is', 'filtered', 'client', '-', 'side', 'to', 'contain', 'only', 'those', 'f...
train
https://github.com/yyuu/botornado/blob/fffb056f5ff2324d1d5c1304014cfb1d899f602e/boto/ec2/volume.py#L173-L199
9,634
polyaxon/polyaxon
polyaxon/scheduler/spawners/templates/experiment_jobs/manager.py
ResourceManager.get_init_container
def get_init_container(self, init_command, init_args, env_vars, context_mounts, persistence_outputs, persistence_data): """Pod init container for sett...
python
def get_init_container(self, init_command, init_args, env_vars, context_mounts, persistence_outputs, persistence_data): """Pod init container for sett...
['def', 'get_init_container', '(', 'self', ',', 'init_command', ',', 'init_args', ',', 'env_vars', ',', 'context_mounts', ',', 'persistence_outputs', ',', 'persistence_data', ')', ':', 'env_vars', '=', 'to_list', '(', 'env_vars', ',', 'check_none', '=', 'True', ')', 'if', 'self', '.', 'original_name', 'is', 'not', 'Non...
Pod init container for setting outputs path.
['Pod', 'init', 'container', 'for', 'setting', 'outputs', 'path', '.']
train
https://github.com/polyaxon/polyaxon/blob/e1724f0756b1a42f9e7aa08a976584a84ef7f016/polyaxon/scheduler/spawners/templates/experiment_jobs/manager.py#L169-L210
9,635
Kronuz/pyScss
scss/extension/compass/sprites.py
sprite
def sprite(map, sprite, offset_x=None, offset_y=None, cache_buster=True): """ Returns the image and background position for use in a single shorthand property """ map = map.render() sprite_maps = _get_cache('sprite_maps') sprite_map = sprite_maps.get(map) sprite_name = String.unquoted(sp...
python
def sprite(map, sprite, offset_x=None, offset_y=None, cache_buster=True): """ Returns the image and background position for use in a single shorthand property """ map = map.render() sprite_maps = _get_cache('sprite_maps') sprite_map = sprite_maps.get(map) sprite_name = String.unquoted(sp...
['def', 'sprite', '(', 'map', ',', 'sprite', ',', 'offset_x', '=', 'None', ',', 'offset_y', '=', 'None', ',', 'cache_buster', '=', 'True', ')', ':', 'map', '=', 'map', '.', 'render', '(', ')', 'sprite_maps', '=', '_get_cache', '(', "'sprite_maps'", ')', 'sprite_map', '=', 'sprite_maps', '.', 'get', '(', 'map', ')', 'sp...
Returns the image and background position for use in a single shorthand property
['Returns', 'the', 'image', 'and', 'background', 'position', 'for', 'use', 'in', 'a', 'single', 'shorthand', 'property']
train
https://github.com/Kronuz/pyScss/blob/fb32b317f6e2b4b4aad2b86a74844658ac4aa11e/scss/extension/compass/sprites.py#L479-L505
9,636
dslackw/slpkg
slpkg/sbo/dependency.py
Requires.sbo
def sbo(self, name): """Build all dependencies of a package """ if (self.meta.rsl_deps in ["on", "ON"] and "--resolve-off" not in self.flag): sys.setrecursionlimit(10000) dependencies = [] requires = SBoGrep(name).requires() if requ...
python
def sbo(self, name): """Build all dependencies of a package """ if (self.meta.rsl_deps in ["on", "ON"] and "--resolve-off" not in self.flag): sys.setrecursionlimit(10000) dependencies = [] requires = SBoGrep(name).requires() if requ...
['def', 'sbo', '(', 'self', ',', 'name', ')', ':', 'if', '(', 'self', '.', 'meta', '.', 'rsl_deps', 'in', '[', '"on"', ',', '"ON"', ']', 'and', '"--resolve-off"', 'not', 'in', 'self', '.', 'flag', ')', ':', 'sys', '.', 'setrecursionlimit', '(', '10000', ')', 'dependencies', '=', '[', ']', 'requires', '=', 'SBoGrep', '(...
Build all dependencies of a package
['Build', 'all', 'dependencies', 'of', 'a', 'package']
train
https://github.com/dslackw/slpkg/blob/dd2e08a80e944d337d157b992167ba631a4343de/slpkg/sbo/dependency.py#L45-L67
9,637
aiidateam/aiida-codtools
aiida_codtools/workflows/cif_clean.py
CifCleanWorkChain.results
def results(self): """If successfully created, add the cleaned `CifData` and `StructureData` as output nodes to the workchain. The filter and select calculations were successful, so we return the cleaned CifData node. If the `group_cif` was defined in the inputs, the node is added to it. If the...
python
def results(self): """If successfully created, add the cleaned `CifData` and `StructureData` as output nodes to the workchain. The filter and select calculations were successful, so we return the cleaned CifData node. If the `group_cif` was defined in the inputs, the node is added to it. If the...
['def', 'results', '(', 'self', ')', ':', 'self', '.', 'out', '(', "'cif'", ',', 'self', '.', 'ctx', '.', 'cif', ')', 'if', "'group_cif'", 'in', 'self', '.', 'inputs', ':', 'self', '.', 'inputs', '.', 'group_cif', '.', 'add_nodes', '(', '[', 'self', '.', 'ctx', '.', 'cif', ']', ')', 'if', "'group_structure'", 'in', 'se...
If successfully created, add the cleaned `CifData` and `StructureData` as output nodes to the workchain. The filter and select calculations were successful, so we return the cleaned CifData node. If the `group_cif` was defined in the inputs, the node is added to it. If the structure should have been pa...
['If', 'successfully', 'created', 'add', 'the', 'cleaned', 'CifData', 'and', 'StructureData', 'as', 'output', 'nodes', 'to', 'the', 'workchain', '.']
train
https://github.com/aiidateam/aiida-codtools/blob/da5e4259b7a2e86cf0cc3f997e11dd36d445fa94/aiida_codtools/workflows/cif_clean.py#L180-L202
9,638
acutesoftware/AIKIF
aikif/cls_log.py
Log.get_session_id
def get_session_id(self): """ get a unique id (shortish string) to allow simple aggregation of log records from multiple sources. This id is used for the life of the running program to allow extraction from all logs. WARING - this can give duplicate sessions when 2 apps hit it ...
python
def get_session_id(self): """ get a unique id (shortish string) to allow simple aggregation of log records from multiple sources. This id is used for the life of the running program to allow extraction from all logs. WARING - this can give duplicate sessions when 2 apps hit it ...
['def', 'get_session_id', '(', 'self', ')', ':', 'max_session', '=', "'0'", 'try', ':', 'with', 'open', '(', 'self', '.', 'log_folder', '+', 'os', '.', 'sep', '+', "'_sessions.txt'", ',', "'r'", ')', 'as', 'f', ':', 'for', '_', 'in', 'f', ':', 'txt', '=', 'f', '.', 'readline', '(', ')', 'if', 'txt', '.', 'strip', '(', ...
get a unique id (shortish string) to allow simple aggregation of log records from multiple sources. This id is used for the life of the running program to allow extraction from all logs. WARING - this can give duplicate sessions when 2 apps hit it at the same time.
['get', 'a', 'unique', 'id', '(', 'shortish', 'string', ')', 'to', 'allow', 'simple', 'aggregation', 'of', 'log', 'records', 'from', 'multiple', 'sources', '.', 'This', 'id', 'is', 'used', 'for', 'the', 'life', 'of', 'the', 'running', 'program', 'to', 'allow', 'extraction', 'from', 'all', 'logs', '.', 'WARING', '-', 't...
train
https://github.com/acutesoftware/AIKIF/blob/fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03/aikif/cls_log.py#L64-L85
9,639
buriburisuri/sugartensor
sugartensor/sg_layer.py
sg_aconv
def sg_aconv(tensor, opt): r"""Applies a 2-D atrous (or dilated) convolution. Args: tensor: A 4-D `Tensor` (automatically passed by decorator). opt: size: A tuple/list of positive integers of length 2 representing `[kernel height, kernel width]`. Can be an integer if both valu...
python
def sg_aconv(tensor, opt): r"""Applies a 2-D atrous (or dilated) convolution. Args: tensor: A 4-D `Tensor` (automatically passed by decorator). opt: size: A tuple/list of positive integers of length 2 representing `[kernel height, kernel width]`. Can be an integer if both valu...
['def', 'sg_aconv', '(', 'tensor', ',', 'opt', ')', ':', '# default options', 'opt', '+=', 'tf', '.', 'sg_opt', '(', 'size', '=', '(', '3', ',', '3', ')', ',', 'rate', '=', '2', ',', 'pad', '=', "'SAME'", ')', 'opt', '.', 'size', '=', 'opt', '.', 'size', 'if', 'isinstance', '(', 'opt', '.', 'size', ',', '(', 'tuple', '...
r"""Applies a 2-D atrous (or dilated) convolution. Args: tensor: A 4-D `Tensor` (automatically passed by decorator). opt: size: A tuple/list of positive integers of length 2 representing `[kernel height, kernel width]`. Can be an integer if both values are the same. If n...
['r', 'Applies', 'a', '2', '-', 'D', 'atrous', '(', 'or', 'dilated', ')', 'convolution', '.', 'Args', ':', 'tensor', ':', 'A', '4', '-', 'D', 'Tensor', '(', 'automatically', 'passed', 'by', 'decorator', ')', '.', 'opt', ':', 'size', ':', 'A', 'tuple', '/', 'list', 'of', 'positive', 'integers', 'of', 'length', '2', 'rep...
train
https://github.com/buriburisuri/sugartensor/blob/d2c039954777c7fbe3eb0c2ae40c45c9854deb40/sugartensor/sg_layer.py#L141-L175
9,640
bram85/topydo
topydo/lib/TodoListBase.py
TodoListBase.number
def number(self, p_todo): """ Returns the line number or text ID of a todo (depends on the configuration. """ if config().identifiers() == "text": return self.uid(p_todo) else: return self.linenumber(p_todo)
python
def number(self, p_todo): """ Returns the line number or text ID of a todo (depends on the configuration. """ if config().identifiers() == "text": return self.uid(p_todo) else: return self.linenumber(p_todo)
['def', 'number', '(', 'self', ',', 'p_todo', ')', ':', 'if', 'config', '(', ')', '.', 'identifiers', '(', ')', '==', '"text"', ':', 'return', 'self', '.', 'uid', '(', 'p_todo', ')', 'else', ':', 'return', 'self', '.', 'linenumber', '(', 'p_todo', ')']
Returns the line number or text ID of a todo (depends on the configuration.
['Returns', 'the', 'line', 'number', 'or', 'text', 'ID', 'of', 'a', 'todo', '(', 'depends', 'on', 'the', 'configuration', '.']
train
https://github.com/bram85/topydo/blob/b59fcfca5361869a6b78d4c9808c7c6cd0a18b58/topydo/lib/TodoListBase.py#L269-L277
9,641
pandas-dev/pandas
pandas/io/html.py
_LxmlFrameParser._build_doc
def _build_doc(self): """ Raises ------ ValueError * If a URL that lxml cannot parse is passed. Exception * Any other ``Exception`` thrown. For example, trying to parse a URL that is syntactically correct on a machine with no internet ...
python
def _build_doc(self): """ Raises ------ ValueError * If a URL that lxml cannot parse is passed. Exception * Any other ``Exception`` thrown. For example, trying to parse a URL that is syntactically correct on a machine with no internet ...
['def', '_build_doc', '(', 'self', ')', ':', 'from', 'lxml', '.', 'html', 'import', 'parse', ',', 'fromstring', ',', 'HTMLParser', 'from', 'lxml', '.', 'etree', 'import', 'XMLSyntaxError', 'parser', '=', 'HTMLParser', '(', 'recover', '=', 'True', ',', 'encoding', '=', 'self', '.', 'encoding', ')', 'try', ':', 'if', '_i...
Raises ------ ValueError * If a URL that lxml cannot parse is passed. Exception * Any other ``Exception`` thrown. For example, trying to parse a URL that is syntactically correct on a machine with no internet connection will fail. See...
['Raises', '------', 'ValueError', '*', 'If', 'a', 'URL', 'that', 'lxml', 'cannot', 'parse', 'is', 'passed', '.']
train
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/io/html.py#L690-L735
9,642
Hackerfleet/hfos
hfos/database.py
_build_model_factories
def _build_model_factories(store): """Generate factories to construct objects from schemata""" result = {} for schemaname in store: schema = None try: schema = store[schemaname]['schema'] except KeyError: schemata_log("No schema found for ", schemaname, lv...
python
def _build_model_factories(store): """Generate factories to construct objects from schemata""" result = {} for schemaname in store: schema = None try: schema = store[schemaname]['schema'] except KeyError: schemata_log("No schema found for ", schemaname, lv...
['def', '_build_model_factories', '(', 'store', ')', ':', 'result', '=', '{', '}', 'for', 'schemaname', 'in', 'store', ':', 'schema', '=', 'None', 'try', ':', 'schema', '=', 'store', '[', 'schemaname', ']', '[', "'schema'", ']', 'except', 'KeyError', ':', 'schemata_log', '(', '"No schema found for "', ',', 'schemaname'...
Generate factories to construct objects from schemata
['Generate', 'factories', 'to', 'construct', 'objects', 'from', 'schemata']
train
https://github.com/Hackerfleet/hfos/blob/b6df14eacaffb6be5c844108873ff8763ec7f0c9/hfos/database.py#L257-L276
9,643
chaoss/grimoirelab-elk
grimoire_elk/enriched/study_ceres_onion.py
ESOnionConnector.__list_uniques
def __list_uniques(self, date_range, field_name): """Retrieve a list of unique values in a given field within a date range. :param date_range: :param field_name: :return: list of unique values. """ # Get project list s = Search(using=self._es_conn, index=self._e...
python
def __list_uniques(self, date_range, field_name): """Retrieve a list of unique values in a given field within a date range. :param date_range: :param field_name: :return: list of unique values. """ # Get project list s = Search(using=self._es_conn, index=self._e...
['def', '__list_uniques', '(', 'self', ',', 'date_range', ',', 'field_name', ')', ':', '# Get project list', 's', '=', 'Search', '(', 'using', '=', 'self', '.', '_es_conn', ',', 'index', '=', 'self', '.', '_es_index', ')', 's', '=', 's', '.', 'filter', '(', "'range'", ',', '*', '*', 'date_range', ')', '# from:to parame...
Retrieve a list of unique values in a given field within a date range. :param date_range: :param field_name: :return: list of unique values.
['Retrieve', 'a', 'list', 'of', 'unique', 'values', 'in', 'a', 'given', 'field', 'within', 'a', 'date', 'range', '.']
train
https://github.com/chaoss/grimoirelab-elk/blob/64e08b324b36d9f6909bf705145d6451c8d34e65/grimoire_elk/enriched/study_ceres_onion.py#L241-L259
9,644
refnode/liquid
src/liquid/strscan.py
get_regex
def get_regex(regex): """ Ensure we have a compiled regular expression object. >>> import re >>> get_regex('string') # doctest: +ELLIPSIS <_sre.SRE_Pattern object at 0x...> >>> pattern = re.compile(r'string') >>> get_regex(pattern) is pattern True >>> get...
python
def get_regex(regex): """ Ensure we have a compiled regular expression object. >>> import re >>> get_regex('string') # doctest: +ELLIPSIS <_sre.SRE_Pattern object at 0x...> >>> pattern = re.compile(r'string') >>> get_regex(pattern) is pattern True >>> get...
['def', 'get_regex', '(', 'regex', ')', ':', 'if', 'isinstance', '(', 'regex', ',', 'basestring', ')', ':', 'return', 're', '.', 'compile', '(', 'regex', ')', 'elif', 'not', 'isinstance', '(', 'regex', ',', 're', '.', '_pattern_type', ')', ':', 'raise', 'TypeError', '(', '"Invalid regex type: %r"', '%', '(', 'regex', '...
Ensure we have a compiled regular expression object. >>> import re >>> get_regex('string') # doctest: +ELLIPSIS <_sre.SRE_Pattern object at 0x...> >>> pattern = re.compile(r'string') >>> get_regex(pattern) is pattern True >>> get_regex(3) # doctest: +ELLIPSIS ...
['Ensure', 'we', 'have', 'a', 'compiled', 'regular', 'expression', 'object', '.']
train
https://github.com/refnode/liquid/blob/8b2b5efc635b0dbfe610db9036fdb4ae3e3d5439/src/liquid/strscan.py#L516-L535
9,645
unt-libraries/edtf-validate
edtf_validate/valid_edtf.py
replace_u_end_month
def replace_u_end_month(month): """Find the latest legitimate month.""" month = month.lstrip('-') if month == 'uu' or month == '1u': return '12' if month == 'u0': return '10' if month == '0u': return '09' if month[1] in ['1', '2']: # 'u1' or 'u2' return mo...
python
def replace_u_end_month(month): """Find the latest legitimate month.""" month = month.lstrip('-') if month == 'uu' or month == '1u': return '12' if month == 'u0': return '10' if month == '0u': return '09' if month[1] in ['1', '2']: # 'u1' or 'u2' return mo...
['def', 'replace_u_end_month', '(', 'month', ')', ':', 'month', '=', 'month', '.', 'lstrip', '(', "'-'", ')', 'if', 'month', '==', "'uu'", 'or', 'month', '==', "'1u'", ':', 'return', "'12'", 'if', 'month', '==', "'u0'", ':', 'return', "'10'", 'if', 'month', '==', "'0u'", ':', 'return', "'09'", 'if', 'month', '[', '1', ...
Find the latest legitimate month.
['Find', 'the', 'latest', 'legitimate', 'month', '.']
train
https://github.com/unt-libraries/edtf-validate/blob/d6d63141919a66aea4ff1c31fa0cb8ff744ef9d9/edtf_validate/valid_edtf.py#L264-L277
9,646
tmr232/Sark
sark/data.py
get_string
def get_string(ea): """Read the string at the given ea. This function uses IDA's string APIs and does not implement any special logic. """ # We get the item-head because the `GetStringType` function only works on the head of an item. string_type = idc.GetStringType(idaapi.get_item_head(ea)) if...
python
def get_string(ea): """Read the string at the given ea. This function uses IDA's string APIs and does not implement any special logic. """ # We get the item-head because the `GetStringType` function only works on the head of an item. string_type = idc.GetStringType(idaapi.get_item_head(ea)) if...
['def', 'get_string', '(', 'ea', ')', ':', '# We get the item-head because the `GetStringType` function only works on the head of an item.', 'string_type', '=', 'idc', '.', 'GetStringType', '(', 'idaapi', '.', 'get_item_head', '(', 'ea', ')', ')', 'if', 'string_type', 'is', 'None', ':', 'raise', 'exceptions', '.', 'Sar...
Read the string at the given ea. This function uses IDA's string APIs and does not implement any special logic.
['Read', 'the', 'string', 'at', 'the', 'given', 'ea', '.']
train
https://github.com/tmr232/Sark/blob/bee62879c2aea553a3924d887e2b30f2a6008581/sark/data.py#L147-L163
9,647
jacebrowning/comparable
comparable/base.py
_Base._repr
def _repr(self, *args, **kwargs): """Return a __repr__ string from the arguments provided to __init__. @param args: list of arguments to __init__ @param kwargs: dictionary of keyword arguments to __init__ @return: __repr__ string """ # Remove unnecessary empty keywords ...
python
def _repr(self, *args, **kwargs): """Return a __repr__ string from the arguments provided to __init__. @param args: list of arguments to __init__ @param kwargs: dictionary of keyword arguments to __init__ @return: __repr__ string """ # Remove unnecessary empty keywords ...
['def', '_repr', '(', 'self', ',', '*', 'args', ',', '*', '*', 'kwargs', ')', ':', '# Remove unnecessary empty keywords arguments and sort the arguments', 'kwargs', '=', '{', 'k', ':', 'v', 'for', 'k', ',', 'v', 'in', 'kwargs', '.', 'items', '(', ')', 'if', 'v', 'is', 'not', 'None', '}', 'kwargs', '=', 'OrderedDict', '...
Return a __repr__ string from the arguments provided to __init__. @param args: list of arguments to __init__ @param kwargs: dictionary of keyword arguments to __init__ @return: __repr__ string
['Return', 'a', '__repr__', 'string', 'from', 'the', 'arguments', 'provided', 'to', '__init__', '.']
train
https://github.com/jacebrowning/comparable/blob/48455e613650e22412d31109681368fcc479298d/comparable/base.py#L12-L31
9,648
openid/python-openid
openid/server/server.py
Decoder.decode
def decode(self, query): """I transform query parameters into an L{OpenIDRequest}. If the query does not seem to be an OpenID request at all, I return C{None}. @param query: The query parameters as a dictionary with each key mapping to one value. @type query: dict ...
python
def decode(self, query): """I transform query parameters into an L{OpenIDRequest}. If the query does not seem to be an OpenID request at all, I return C{None}. @param query: The query parameters as a dictionary with each key mapping to one value. @type query: dict ...
['def', 'decode', '(', 'self', ',', 'query', ')', ':', 'if', 'not', 'query', ':', 'return', 'None', 'try', ':', 'message', '=', 'Message', '.', 'fromPostArgs', '(', 'query', ')', 'except', 'InvalidOpenIDNamespace', ',', 'err', ':', "# It's useful to have a Message attached to a ProtocolError, so we", '# override the ba...
I transform query parameters into an L{OpenIDRequest}. If the query does not seem to be an OpenID request at all, I return C{None}. @param query: The query parameters as a dictionary with each key mapping to one value. @type query: dict @raises ProtocolError: When ...
['I', 'transform', 'query', 'parameters', 'into', 'an', 'L', '{', 'OpenIDRequest', '}', '.']
train
https://github.com/openid/python-openid/blob/f7e13536f0d1828d3cef5ae7a7b55cabadff37fc/openid/server/server.py#L1409-L1445
9,649
JukeboxPipeline/jukebox-core
src/jukeboxcore/addons/guerilla/guerillamgmt.py
GuerillaMGMTWin.prj_create_user
def prj_create_user(self, *args, **kwargs): """Create a new project :returns: None :rtype: None :raises: None """ if not self.cur_prj: return user = self.create_user(projects=[self.cur_prj]) if user: userdata = djitemdata.UserItemD...
python
def prj_create_user(self, *args, **kwargs): """Create a new project :returns: None :rtype: None :raises: None """ if not self.cur_prj: return user = self.create_user(projects=[self.cur_prj]) if user: userdata = djitemdata.UserItemD...
['def', 'prj_create_user', '(', 'self', ',', '*', 'args', ',', '*', '*', 'kwargs', ')', ':', 'if', 'not', 'self', '.', 'cur_prj', ':', 'return', 'user', '=', 'self', '.', 'create_user', '(', 'projects', '=', '[', 'self', '.', 'cur_prj', ']', ')', 'if', 'user', ':', 'userdata', '=', 'djitemdata', '.', 'UserItemData', '(...
Create a new project :returns: None :rtype: None :raises: None
['Create', 'a', 'new', 'project']
train
https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/addons/guerilla/guerillamgmt.py#L1412-L1424
9,650
davidfokkema/artist
artist/multi_plot.py
MultiPlot.set_ytick_labels
def set_ytick_labels(self, row, column, labels): """Manually specify the y-axis tick labels. :param row,column: specify the subplot. :param labels: list of tick labels. """ subplot = self.get_subplot_at(row, column) subplot.set_ytick_labels(labels)
python
def set_ytick_labels(self, row, column, labels): """Manually specify the y-axis tick labels. :param row,column: specify the subplot. :param labels: list of tick labels. """ subplot = self.get_subplot_at(row, column) subplot.set_ytick_labels(labels)
['def', 'set_ytick_labels', '(', 'self', ',', 'row', ',', 'column', ',', 'labels', ')', ':', 'subplot', '=', 'self', '.', 'get_subplot_at', '(', 'row', ',', 'column', ')', 'subplot', '.', 'set_ytick_labels', '(', 'labels', ')']
Manually specify the y-axis tick labels. :param row,column: specify the subplot. :param labels: list of tick labels.
['Manually', 'specify', 'the', 'y', '-', 'axis', 'tick', 'labels', '.']
train
https://github.com/davidfokkema/artist/blob/26ae7987522622710f2910980770c50012fda47d/artist/multi_plot.py#L456-L464
9,651
jtwhite79/pyemu
pyemu/pst/pst_handler.py
Pst.add_transform_columns
def add_transform_columns(self): """ add transformed values to the Pst.parameter_data attribute """ for col in ["parval1","parlbnd","parubnd","increment"]: if col not in self.parameter_data.columns: continue self.parameter_data.loc[:,col+"_trans"] = (self...
python
def add_transform_columns(self): """ add transformed values to the Pst.parameter_data attribute """ for col in ["parval1","parlbnd","parubnd","increment"]: if col not in self.parameter_data.columns: continue self.parameter_data.loc[:,col+"_trans"] = (self...
['def', 'add_transform_columns', '(', 'self', ')', ':', 'for', 'col', 'in', '[', '"parval1"', ',', '"parlbnd"', ',', '"parubnd"', ',', '"increment"', ']', ':', 'if', 'col', 'not', 'in', 'self', '.', 'parameter_data', '.', 'columns', ':', 'continue', 'self', '.', 'parameter_data', '.', 'loc', '[', ':', ',', 'col', '+', ...
add transformed values to the Pst.parameter_data attribute
['add', 'transformed', 'values', 'to', 'the', 'Pst', '.', 'parameter_data', 'attribute']
train
https://github.com/jtwhite79/pyemu/blob/c504d8e7a4097cec07655a6318d275739bd8148a/pyemu/pst/pst_handler.py#L2035-L2049
9,652
praekeltfoundation/seaworthy
seaworthy/client.py
ContainerHttpClient.put
def put(self, path=None, url_kwargs=None, **kwargs): """ Sends a PUT request. :param path: The HTTP path (either absolute or relative). :param url_kwargs: Parameters to override in the generated URL. See `~hyperlink.URL`. :param **kwargs: Opti...
python
def put(self, path=None, url_kwargs=None, **kwargs): """ Sends a PUT request. :param path: The HTTP path (either absolute or relative). :param url_kwargs: Parameters to override in the generated URL. See `~hyperlink.URL`. :param **kwargs: Opti...
['def', 'put', '(', 'self', ',', 'path', '=', 'None', ',', 'url_kwargs', '=', 'None', ',', '*', '*', 'kwargs', ')', ':', 'return', 'self', '.', '_session', '.', 'put', '(', 'self', '.', '_url', '(', 'path', ',', 'url_kwargs', ')', ',', '*', '*', 'kwargs', ')']
Sends a PUT request. :param path: The HTTP path (either absolute or relative). :param url_kwargs: Parameters to override in the generated URL. See `~hyperlink.URL`. :param **kwargs: Optional arguments that ``request`` takes. :return: response object
['Sends', 'a', 'PUT', 'request', '.']
train
https://github.com/praekeltfoundation/seaworthy/blob/6f10a19b45d4ea1dc3bd0553cc4d0438696c079c/seaworthy/client.py#L162-L174
9,653
icgood/pymap
pymap/backend/dict/__init__.py
Session.login
async def login(cls, credentials: AuthenticationCredentials, config: Config) -> 'Session': """Checks the given credentials for a valid login and returns a new session. The mailbox data is shared between concurrent and future sessions, but only for the lifetime of the process....
python
async def login(cls, credentials: AuthenticationCredentials, config: Config) -> 'Session': """Checks the given credentials for a valid login and returns a new session. The mailbox data is shared between concurrent and future sessions, but only for the lifetime of the process....
['async', 'def', 'login', '(', 'cls', ',', 'credentials', ':', 'AuthenticationCredentials', ',', 'config', ':', 'Config', ')', '->', "'Session'", ':', 'user', '=', 'credentials', '.', 'authcid', 'password', '=', 'cls', '.', '_get_password', '(', 'config', ',', 'user', ')', 'if', 'user', '!=', 'credentials', '.', 'ident...
Checks the given credentials for a valid login and returns a new session. The mailbox data is shared between concurrent and future sessions, but only for the lifetime of the process.
['Checks', 'the', 'given', 'credentials', 'for', 'a', 'valid', 'login', 'and', 'returns', 'a', 'new', 'session', '.', 'The', 'mailbox', 'data', 'is', 'shared', 'between', 'concurrent', 'and', 'future', 'sessions', 'but', 'only', 'for', 'the', 'lifetime', 'of', 'the', 'process', '.']
train
https://github.com/icgood/pymap/blob/e77d9a54d760e3cbe044a548883bb4299ed61dc2/pymap/backend/dict/__init__.py#L125-L145
9,654
viniciuschiele/flask-io
flask_io/io.py
FlaskIO.permissions
def permissions(self, perms): """ A decorator that sets a list of permissions for a function. :param perms: The list of permission instances or classes. :return: A function """ if not isinstance(perms, (list, tuple)): perms = [perms] instances = [] ...
python
def permissions(self, perms): """ A decorator that sets a list of permissions for a function. :param perms: The list of permission instances or classes. :return: A function """ if not isinstance(perms, (list, tuple)): perms = [perms] instances = [] ...
['def', 'permissions', '(', 'self', ',', 'perms', ')', ':', 'if', 'not', 'isinstance', '(', 'perms', ',', '(', 'list', ',', 'tuple', ')', ')', ':', 'perms', '=', '[', 'perms', ']', 'instances', '=', '[', ']', 'for', 'perm', 'in', 'perms', ':', 'if', 'isclass', '(', 'perm', ')', ':', 'instances', '.', 'append', '(', 'pe...
A decorator that sets a list of permissions for a function. :param perms: The list of permission instances or classes. :return: A function
['A', 'decorator', 'that', 'sets', 'a', 'list', 'of', 'permissions', 'for', 'a', 'function', '.']
train
https://github.com/viniciuschiele/flask-io/blob/4e559419b3d8e6859f83fa16557b00542d5f3aa7/flask_io/io.py#L166-L188
9,655
Microsoft/azure-devops-python-api
azure-devops/azure/devops/v5_1/profile_regions/profile_regions_client.py
ProfileRegionsClient.get_regions
def get_regions(self): """GetRegions. [Preview API] :rtype: :class:`<ProfileRegions> <azure.devops.v5_1.profile-regions.models.ProfileRegions>` """ response = self._send(http_method='GET', location_id='b129ca90-999d-47bb-ab37-0dcf784ee633', ...
python
def get_regions(self): """GetRegions. [Preview API] :rtype: :class:`<ProfileRegions> <azure.devops.v5_1.profile-regions.models.ProfileRegions>` """ response = self._send(http_method='GET', location_id='b129ca90-999d-47bb-ab37-0dcf784ee633', ...
['def', 'get_regions', '(', 'self', ')', ':', 'response', '=', 'self', '.', '_send', '(', 'http_method', '=', "'GET'", ',', 'location_id', '=', "'b129ca90-999d-47bb-ab37-0dcf784ee633'", ',', 'version', '=', "'5.1-preview.1'", ')', 'return', 'self', '.', '_deserialize', '(', "'ProfileRegions'", ',', 'response', ')']
GetRegions. [Preview API] :rtype: :class:`<ProfileRegions> <azure.devops.v5_1.profile-regions.models.ProfileRegions>`
['GetRegions', '.', '[', 'Preview', 'API', ']', ':', 'rtype', ':', ':', 'class', ':', '<ProfileRegions', '>', '<azure', '.', 'devops', '.', 'v5_1', '.', 'profile', '-', 'regions', '.', 'models', '.', 'ProfileRegions', '>']
train
https://github.com/Microsoft/azure-devops-python-api/blob/4777ffda2f5052fabbaddb2abe9cb434e0cf1aa8/azure-devops/azure/devops/v5_1/profile_regions/profile_regions_client.py#L43-L51
9,656
gwastro/pycbc
pycbc/types/optparse.py
required_opts
def required_opts(opt, parser, opt_list, required_by=None): """Check that all the opts are defined Parameters ---------- opt : object Result of option parsing parser : object OptionParser instance. opt_list : list of strings required_by : string, optional the option ...
python
def required_opts(opt, parser, opt_list, required_by=None): """Check that all the opts are defined Parameters ---------- opt : object Result of option parsing parser : object OptionParser instance. opt_list : list of strings required_by : string, optional the option ...
['def', 'required_opts', '(', 'opt', ',', 'parser', ',', 'opt_list', ',', 'required_by', '=', 'None', ')', ':', 'for', 'name', 'in', 'opt_list', ':', 'attr', '=', 'name', '[', '2', ':', ']', '.', 'replace', '(', "'-'", ',', "'_'", ')', 'if', 'not', 'hasattr', '(', 'opt', ',', 'attr', ')', 'or', '(', 'getattr', '(', 'op...
Check that all the opts are defined Parameters ---------- opt : object Result of option parsing parser : object OptionParser instance. opt_list : list of strings required_by : string, optional the option that requires these options (if applicable)
['Check', 'that', 'all', 'the', 'opts', 'are', 'defined']
train
https://github.com/gwastro/pycbc/blob/7a64cdd104d263f1b6ea0b01e6841837d05a4cb3/pycbc/types/optparse.py#L190-L209
9,657
MartinThoma/hwrt
hwrt/handwritten_data.py
HandwrittenData.preprocessing
def preprocessing(self, algorithms): """Apply preprocessing algorithms. Parameters ---------- algorithms : a list objects Preprocessing allgorithms which get applied in order. Examples -------- >>> import preprocessing >>> a = HandwrittenData...
python
def preprocessing(self, algorithms): """Apply preprocessing algorithms. Parameters ---------- algorithms : a list objects Preprocessing allgorithms which get applied in order. Examples -------- >>> import preprocessing >>> a = HandwrittenData...
['def', 'preprocessing', '(', 'self', ',', 'algorithms', ')', ':', 'assert', 'type', '(', 'algorithms', ')', 'is', 'list', 'for', 'algorithm', 'in', 'algorithms', ':', 'algorithm', '(', 'self', ')']
Apply preprocessing algorithms. Parameters ---------- algorithms : a list objects Preprocessing allgorithms which get applied in order. Examples -------- >>> import preprocessing >>> a = HandwrittenData(...) >>> preprocessing_queue = [(prepro...
['Apply', 'preprocessing', 'algorithms', '.']
train
https://github.com/MartinThoma/hwrt/blob/725c21a3d0f5a30b8492cbc184b3688ceb364e1c/hwrt/handwritten_data.py#L196-L219
9,658
spyder-ide/spyder
spyder/preferences/languageserver.py
LSPServerTable.previous_row
def previous_row(self): """Move to previous row from currently selected row.""" row = self.currentIndex().row() rows = self.source_model.rowCount() if row == 0: row = rows self.selectRow(row - 1)
python
def previous_row(self): """Move to previous row from currently selected row.""" row = self.currentIndex().row() rows = self.source_model.rowCount() if row == 0: row = rows self.selectRow(row - 1)
['def', 'previous_row', '(', 'self', ')', ':', 'row', '=', 'self', '.', 'currentIndex', '(', ')', '.', 'row', '(', ')', 'rows', '=', 'self', '.', 'source_model', '.', 'rowCount', '(', ')', 'if', 'row', '==', '0', ':', 'row', '=', 'rows', 'self', '.', 'selectRow', '(', 'row', '-', '1', ')']
Move to previous row from currently selected row.
['Move', 'to', 'previous', 'row', 'from', 'currently', 'selected', 'row', '.']
train
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/preferences/languageserver.py#L581-L587
9,659
onicagroup/runway
runway/tfenv.py
get_available_tf_versions
def get_available_tf_versions(include_prerelease=False): """Return available Terraform versions.""" tf_releases = json.loads( requests.get('https://releases.hashicorp.com/index.json').text )['terraform'] tf_versions = sorted([k # descending for k, _v in tf_releases['ve...
python
def get_available_tf_versions(include_prerelease=False): """Return available Terraform versions.""" tf_releases = json.loads( requests.get('https://releases.hashicorp.com/index.json').text )['terraform'] tf_versions = sorted([k # descending for k, _v in tf_releases['ve...
['def', 'get_available_tf_versions', '(', 'include_prerelease', '=', 'False', ')', ':', 'tf_releases', '=', 'json', '.', 'loads', '(', 'requests', '.', 'get', '(', "'https://releases.hashicorp.com/index.json'", ')', '.', 'text', ')', '[', "'terraform'", ']', 'tf_versions', '=', 'sorted', '(', '[', 'k', '# descending', ...
Return available Terraform versions.
['Return', 'available', 'Terraform', 'versions', '.']
train
https://github.com/onicagroup/runway/blob/3f3549ec3bf6e39b9f27d9738a1847f3a4369e7f/runway/tfenv.py#L76-L87
9,660
svven/summary
summary/filters.py
AdblockURLFilterMeta.load_raw_rules
def load_raw_rules(cls, url): "Load raw rules from url or package file." raw_rules = [] filename = url.split('/')[-1] # e.g.: easylist.txt try: with closing(request.get(url, stream=True)) as file: file.raise_for_status() # lines = 0 # to...
python
def load_raw_rules(cls, url): "Load raw rules from url or package file." raw_rules = [] filename = url.split('/')[-1] # e.g.: easylist.txt try: with closing(request.get(url, stream=True)) as file: file.raise_for_status() # lines = 0 # to...
['def', 'load_raw_rules', '(', 'cls', ',', 'url', ')', ':', 'raw_rules', '=', '[', ']', 'filename', '=', 'url', '.', 'split', '(', "'/'", ')', '[', '-', '1', ']', '# e.g.: easylist.txt\r', 'try', ':', 'with', 'closing', '(', 'request', '.', 'get', '(', 'url', ',', 'stream', '=', 'True', ')', ')', 'as', 'file', ':', 'fi...
Load raw rules from url or package file.
['Load', 'raw', 'rules', 'from', 'url', 'or', 'package', 'file', '.']
train
https://github.com/svven/summary/blob/3a6c43d2da08a7452f6b76d1813aa70ba36b8a54/summary/filters.py#L38-L56
9,661
Mindwerks/worldengine
worldengine/generation.py
initialize_ocean_and_thresholds
def initialize_ocean_and_thresholds(world, ocean_level=1.0): """ Calculate the ocean, the sea depth and the elevation thresholds :param world: a world having elevation but not thresholds :param ocean_level: the elevation representing the ocean level :return: nothing, the world will be changed ""...
python
def initialize_ocean_and_thresholds(world, ocean_level=1.0): """ Calculate the ocean, the sea depth and the elevation thresholds :param world: a world having elevation but not thresholds :param ocean_level: the elevation representing the ocean level :return: nothing, the world will be changed ""...
['def', 'initialize_ocean_and_thresholds', '(', 'world', ',', 'ocean_level', '=', '1.0', ')', ':', 'e', '=', 'world', '.', 'layers', '[', "'elevation'", ']', '.', 'data', 'ocean', '=', 'fill_ocean', '(', 'e', ',', 'ocean_level', ')', 'hl', '=', 'find_threshold_f', '(', 'e', ',', '0.10', ')', '# the highest 10% of all (...
Calculate the ocean, the sea depth and the elevation thresholds :param world: a world having elevation but not thresholds :param ocean_level: the elevation representing the ocean level :return: nothing, the world will be changed
['Calculate', 'the', 'ocean', 'the', 'sea', 'depth', 'and', 'the', 'elevation', 'thresholds', ':', 'param', 'world', ':', 'a', 'world', 'having', 'elevation', 'but', 'not', 'thresholds', ':', 'param', 'ocean_level', ':', 'the', 'elevation', 'representing', 'the', 'ocean', 'level', ':', 'return', ':', 'nothing', 'the', ...
train
https://github.com/Mindwerks/worldengine/blob/64dff8eb7824ce46b5b6cb8006bcef21822ef144/worldengine/generation.py#L101-L119
9,662
boriel/zxbasic
zxb.py
output
def output(memory, ofile=None): """ Filters the output removing useless preprocessor #directives and writes it to the given file or to the screen if no file is passed """ for m in memory: m = m.rstrip('\r\n\t ') # Ensures no trailing newlines (might with upon includes) if m and m[0] == ...
python
def output(memory, ofile=None): """ Filters the output removing useless preprocessor #directives and writes it to the given file or to the screen if no file is passed """ for m in memory: m = m.rstrip('\r\n\t ') # Ensures no trailing newlines (might with upon includes) if m and m[0] == ...
['def', 'output', '(', 'memory', ',', 'ofile', '=', 'None', ')', ':', 'for', 'm', 'in', 'memory', ':', 'm', '=', 'm', '.', 'rstrip', '(', "'\\r\\n\\t '", ')', '# Ensures no trailing newlines (might with upon includes)', 'if', 'm', 'and', 'm', '[', '0', ']', '==', "'#'", ':', '# Preprocessor directive?', 'if', 'ofile', ...
Filters the output removing useless preprocessor #directives and writes it to the given file or to the screen if no file is passed
['Filters', 'the', 'output', 'removing', 'useless', 'preprocessor', '#directives', 'and', 'writes', 'it', 'to', 'the', 'given', 'file', 'or', 'to', 'the', 'screen', 'if', 'no', 'file', 'is', 'passed']
train
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/zxb.py#L48-L71
9,663
dmwm/DBS
Server/Python/src/dbs/business/DBSProcessingEra.py
DBSProcessingEra.listProcessingEras
def listProcessingEras(self, processing_version=''): """ Returns all processing eras in dbs """ conn = self.dbi.connection() try: result = self.pelst.execute(conn, processing_version) return result finally: if conn: conn...
python
def listProcessingEras(self, processing_version=''): """ Returns all processing eras in dbs """ conn = self.dbi.connection() try: result = self.pelst.execute(conn, processing_version) return result finally: if conn: conn...
['def', 'listProcessingEras', '(', 'self', ',', 'processing_version', '=', "''", ')', ':', 'conn', '=', 'self', '.', 'dbi', '.', 'connection', '(', ')', 'try', ':', 'result', '=', 'self', '.', 'pelst', '.', 'execute', '(', 'conn', ',', 'processing_version', ')', 'return', 'result', 'finally', ':', 'if', 'conn', ':', 'c...
Returns all processing eras in dbs
['Returns', 'all', 'processing', 'eras', 'in', 'dbs']
train
https://github.com/dmwm/DBS/blob/9619bafce3783b3e77f0415f8f9a258e33dd1e6f/Server/Python/src/dbs/business/DBSProcessingEra.py#L25-L35
9,664
DLR-RM/RAFCON
source/rafcon/gui/mygaphas/constraint.py
PortRectConstraint.limit_pos
def limit_pos(p, se_pos, nw_pos): """ Limits position p to stay inside containing state :param p: Position to limit :param se_pos: Bottom/Right boundary :param nw_pos: Top/Left boundary :return: """ if p > se_pos: _update(p, se_pos) eli...
python
def limit_pos(p, se_pos, nw_pos): """ Limits position p to stay inside containing state :param p: Position to limit :param se_pos: Bottom/Right boundary :param nw_pos: Top/Left boundary :return: """ if p > se_pos: _update(p, se_pos) eli...
['def', 'limit_pos', '(', 'p', ',', 'se_pos', ',', 'nw_pos', ')', ':', 'if', 'p', '>', 'se_pos', ':', '_update', '(', 'p', ',', 'se_pos', ')', 'elif', 'p', '<', 'nw_pos', ':', '_update', '(', 'p', ',', 'nw_pos', ')']
Limits position p to stay inside containing state :param p: Position to limit :param se_pos: Bottom/Right boundary :param nw_pos: Top/Left boundary :return:
['Limits', 'position', 'p', 'to', 'stay', 'inside', 'containing', 'state', ':', 'param', 'p', ':', 'Position', 'to', 'limit', ':', 'param', 'se_pos', ':', 'Bottom', '/', 'Right', 'boundary', ':', 'param', 'nw_pos', ':', 'Top', '/', 'Left', 'boundary', ':', 'return', ':']
train
https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/mygaphas/constraint.py#L302-L313
9,665
Erotemic/utool
utool/util_autogen.py
dump_autogen_code
def dump_autogen_code(fpath, autogen_text, codetype='python', fullprint=None, show_diff=None, dowrite=None): """ Helper that write a file if -w is given on command line, otherwise it just prints it out. It has the opption of comparing a diff to the file. """ import utool as ut ...
python
def dump_autogen_code(fpath, autogen_text, codetype='python', fullprint=None, show_diff=None, dowrite=None): """ Helper that write a file if -w is given on command line, otherwise it just prints it out. It has the opption of comparing a diff to the file. """ import utool as ut ...
['def', 'dump_autogen_code', '(', 'fpath', ',', 'autogen_text', ',', 'codetype', '=', "'python'", ',', 'fullprint', '=', 'None', ',', 'show_diff', '=', 'None', ',', 'dowrite', '=', 'None', ')', ':', 'import', 'utool', 'as', 'ut', 'if', 'dowrite', 'is', 'None', ':', 'dowrite', '=', 'ut', '.', 'get_argflag', '(', '(', "'...
Helper that write a file if -w is given on command line, otherwise it just prints it out. It has the opption of comparing a diff to the file.
['Helper', 'that', 'write', 'a', 'file', 'if', '-', 'w', 'is', 'given', 'on', 'command', 'line', 'otherwise', 'it', 'just', 'prints', 'it', 'out', '.', 'It', 'has', 'the', 'opption', 'of', 'comparing', 'a', 'diff', 'to', 'the', 'file', '.']
train
https://github.com/Erotemic/utool/blob/3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a/utool/util_autogen.py#L22-L69
9,666
hammerlab/cohorts
cohorts/utils.py
_strip_column_name
def _strip_column_name(col_name, keep_paren_contents=True): """ Utility script applying several regexs to a string. Intended to be used by `strip_column_names`. This function will: 1. replace informative punctuation components with text 2. (optionally) remove text within parentheses ...
python
def _strip_column_name(col_name, keep_paren_contents=True): """ Utility script applying several regexs to a string. Intended to be used by `strip_column_names`. This function will: 1. replace informative punctuation components with text 2. (optionally) remove text within parentheses ...
['def', '_strip_column_name', '(', 'col_name', ',', 'keep_paren_contents', '=', 'True', ')', ':', '# start with input', 'new_col_name', '=', 'col_name', '# replace meaningful punctuation with text equivalents', '# surround each with whitespace to enforce consistent use of _', 'punctuation_to_text', '=', '{', "'<='", ':...
Utility script applying several regexs to a string. Intended to be used by `strip_column_names`. This function will: 1. replace informative punctuation components with text 2. (optionally) remove text within parentheses 3. replace remaining punctuation/whitespace with _ 4. strip...
['Utility', 'script', 'applying', 'several', 'regexs', 'to', 'a', 'string', '.', 'Intended', 'to', 'be', 'used', 'by', 'strip_column_names', '.']
train
https://github.com/hammerlab/cohorts/blob/278b05e609e6c4d4a77c57d49446460be53ea33e/cohorts/utils.py#L84-L142
9,667
vtkiorg/vtki
vtki/utilities.py
numpy_to_texture
def numpy_to_texture(image): """Convert a NumPy image array to a vtk.vtkTexture""" if not isinstance(image, np.ndarray): raise TypeError('Unknown input type ({})'.format(type(image))) if image.ndim != 3 or image.shape[2] != 3: raise AssertionError('Input image must be nn by nm by RGB') g...
python
def numpy_to_texture(image): """Convert a NumPy image array to a vtk.vtkTexture""" if not isinstance(image, np.ndarray): raise TypeError('Unknown input type ({})'.format(type(image))) if image.ndim != 3 or image.shape[2] != 3: raise AssertionError('Input image must be nn by nm by RGB') g...
['def', 'numpy_to_texture', '(', 'image', ')', ':', 'if', 'not', 'isinstance', '(', 'image', ',', 'np', '.', 'ndarray', ')', ':', 'raise', 'TypeError', '(', "'Unknown input type ({})'", '.', 'format', '(', 'type', '(', 'image', ')', ')', ')', 'if', 'image', '.', 'ndim', '!=', '3', 'or', 'image', '.', 'shape', '[', '2',...
Convert a NumPy image array to a vtk.vtkTexture
['Convert', 'a', 'NumPy', 'image', 'array', 'to', 'a', 'vtk', '.', 'vtkTexture']
train
https://github.com/vtkiorg/vtki/blob/5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1/vtki/utilities.py#L251-L260
9,668
seleniumbase/SeleniumBase
seleniumbase/fixtures/base_case.py
BaseCase.click_chain
def click_chain(self, selectors_list, by=By.CSS_SELECTOR, timeout=settings.SMALL_TIMEOUT, spacing=0): """ This method clicks on a list of elements in succession. 'spacing' is the amount of time to wait between clicks. (sec) """ if self.timeout_multiplier and timeout == se...
python
def click_chain(self, selectors_list, by=By.CSS_SELECTOR, timeout=settings.SMALL_TIMEOUT, spacing=0): """ This method clicks on a list of elements in succession. 'spacing' is the amount of time to wait between clicks. (sec) """ if self.timeout_multiplier and timeout == se...
['def', 'click_chain', '(', 'self', ',', 'selectors_list', ',', 'by', '=', 'By', '.', 'CSS_SELECTOR', ',', 'timeout', '=', 'settings', '.', 'SMALL_TIMEOUT', ',', 'spacing', '=', '0', ')', ':', 'if', 'self', '.', 'timeout_multiplier', 'and', 'timeout', '==', 'settings', '.', 'SMALL_TIMEOUT', ':', 'timeout', '=', 'self',...
This method clicks on a list of elements in succession. 'spacing' is the amount of time to wait between clicks. (sec)
['This', 'method', 'clicks', 'on', 'a', 'list', 'of', 'elements', 'in', 'succession', '.', 'spacing', 'is', 'the', 'amount', 'of', 'time', 'to', 'wait', 'between', 'clicks', '.', '(', 'sec', ')']
train
https://github.com/seleniumbase/SeleniumBase/blob/62e5b43ee1f90a9ed923841bdd53b1b38358f43a/seleniumbase/fixtures/base_case.py#L181-L190
9,669
materialsproject/pymatgen
pymatgen/io/abinit/utils.py
abi_splitext
def abi_splitext(filename): """ Split the ABINIT extension from a filename. "Extension" are found by searching in an internal database. Returns "(root, ext)" where ext is the registered ABINIT extension The final ".nc" is included (if any) >>> assert abi_splitext("foo_WFK") == ('foo_', 'WFK') ...
python
def abi_splitext(filename): """ Split the ABINIT extension from a filename. "Extension" are found by searching in an internal database. Returns "(root, ext)" where ext is the registered ABINIT extension The final ".nc" is included (if any) >>> assert abi_splitext("foo_WFK") == ('foo_', 'WFK') ...
['def', 'abi_splitext', '(', 'filename', ')', ':', 'filename', '=', 'os', '.', 'path', '.', 'basename', '(', 'filename', ')', 'is_ncfile', '=', 'False', 'if', 'filename', '.', 'endswith', '(', '".nc"', ')', ':', 'is_ncfile', '=', 'True', 'filename', '=', 'filename', '[', ':', '-', '3', ']', 'known_extensions', '=', 'ab...
Split the ABINIT extension from a filename. "Extension" are found by searching in an internal database. Returns "(root, ext)" where ext is the registered ABINIT extension The final ".nc" is included (if any) >>> assert abi_splitext("foo_WFK") == ('foo_', 'WFK') >>> assert abi_splitext("/home/guido...
['Split', 'the', 'ABINIT', 'extension', 'from', 'a', 'filename', '.', 'Extension', 'are', 'found', 'by', 'searching', 'in', 'an', 'internal', 'database', '.']
train
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/io/abinit/utils.py#L495-L528
9,670
summanlp/textrank
summa/preprocessing/snowball.py
RussianStemmer.__cyrillic_to_roman
def __cyrillic_to_roman(self, word): """ Transliterate a Russian word into the Roman alphabet. A Russian word whose letters consist of the Cyrillic alphabet are transliterated into the Roman alphabet in order to ease the forthcoming stemming process. :param word: The wo...
python
def __cyrillic_to_roman(self, word): """ Transliterate a Russian word into the Roman alphabet. A Russian word whose letters consist of the Cyrillic alphabet are transliterated into the Roman alphabet in order to ease the forthcoming stemming process. :param word: The wo...
['def', '__cyrillic_to_roman', '(', 'self', ',', 'word', ')', ':', 'word', '=', '(', 'word', '.', 'replace', '(', '"\\u0410"', ',', '"a"', ')', '.', 'replace', '(', '"\\u0430"', ',', '"a"', ')', '.', 'replace', '(', '"\\u0411"', ',', '"b"', ')', '.', 'replace', '(', '"\\u0431"', ',', '"b"', ')', '.', 'replace', '(', '"...
Transliterate a Russian word into the Roman alphabet. A Russian word whose letters consist of the Cyrillic alphabet are transliterated into the Roman alphabet in order to ease the forthcoming stemming process. :param word: The word that is transliterated. :type word: unicode ...
['Transliterate', 'a', 'Russian', 'word', 'into', 'the', 'Roman', 'alphabet', '.']
train
https://github.com/summanlp/textrank/blob/6844bbe8c4b2b468020ae0dfd6574a743f9ad442/summa/preprocessing/snowball.py#L3183-L3234
9,671
matousc89/padasip
padasip/filters/rls.py
FilterRLS.adapt
def adapt(self, d, x): """ Adapt weights according one desired value and its input. **Args:** * `d` : desired value (float) * `x` : input array (1-dimensional array) """ y = np.dot(self.w, x) e = d - y R1 = np.dot(np.dot(np.dot(self.R,x),x.T),se...
python
def adapt(self, d, x): """ Adapt weights according one desired value and its input. **Args:** * `d` : desired value (float) * `x` : input array (1-dimensional array) """ y = np.dot(self.w, x) e = d - y R1 = np.dot(np.dot(np.dot(self.R,x),x.T),se...
['def', 'adapt', '(', 'self', ',', 'd', ',', 'x', ')', ':', 'y', '=', 'np', '.', 'dot', '(', 'self', '.', 'w', ',', 'x', ')', 'e', '=', 'd', '-', 'y', 'R1', '=', 'np', '.', 'dot', '(', 'np', '.', 'dot', '(', 'np', '.', 'dot', '(', 'self', '.', 'R', ',', 'x', ')', ',', 'x', '.', 'T', ')', ',', 'self', '.', 'R', ')', 'R2...
Adapt weights according one desired value and its input. **Args:** * `d` : desired value (float) * `x` : input array (1-dimensional array)
['Adapt', 'weights', 'according', 'one', 'desired', 'value', 'and', 'its', 'input', '.']
train
https://github.com/matousc89/padasip/blob/c969eadd7fa181a84da0554d737fc13c6450d16f/padasip/filters/rls.py#L208-L224
9,672
Nachtfeuer/pipeline
spline/tools/event.py
Event.delegate
def delegate(self, success, **kwargs): """Delegate success/failure to the right method.""" if success: self.succeeded(**kwargs) else: self.failed(**kwargs)
python
def delegate(self, success, **kwargs): """Delegate success/failure to the right method.""" if success: self.succeeded(**kwargs) else: self.failed(**kwargs)
['def', 'delegate', '(', 'self', ',', 'success', ',', '*', '*', 'kwargs', ')', ':', 'if', 'success', ':', 'self', '.', 'succeeded', '(', '*', '*', 'kwargs', ')', 'else', ':', 'self', '.', 'failed', '(', '*', '*', 'kwargs', ')']
Delegate success/failure to the right method.
['Delegate', 'success', '/', 'failure', 'to', 'the', 'right', 'method', '.']
train
https://github.com/Nachtfeuer/pipeline/blob/04ca18c4e95e4349532bb45b768206393e1f2c13/spline/tools/event.py#L62-L67
9,673
malramsay64/experi
src/experi/commands.py
Command.get_variables
def get_variables(self) -> Set[str]: """Find all the variables specified in a format string. This returns a list of all the different variables specified in a format string, that is the variables inside the braces. """ variables = set() for cmd in self._cmd: ...
python
def get_variables(self) -> Set[str]: """Find all the variables specified in a format string. This returns a list of all the different variables specified in a format string, that is the variables inside the braces. """ variables = set() for cmd in self._cmd: ...
['def', 'get_variables', '(', 'self', ')', '->', 'Set', '[', 'str', ']', ':', 'variables', '=', 'set', '(', ')', 'for', 'cmd', 'in', 'self', '.', '_cmd', ':', 'for', 'var', 'in', 'self', '.', '__formatter', '.', 'parse', '(', 'cmd', ')', ':', 'logger', '.', 'debug', '(', '"Checking variable: %s"', ',', 'var', ')', '# c...
Find all the variables specified in a format string. This returns a list of all the different variables specified in a format string, that is the variables inside the braces.
['Find', 'all', 'the', 'variables', 'specified', 'in', 'a', 'format', 'string', '.']
train
https://github.com/malramsay64/experi/blob/7159644df0420e4a395c87c0c08e11567f401443/src/experi/commands.py#L53-L67
9,674
ARMmbed/mbed-cloud-sdk-python
src/mbed_cloud/certificates/certificates.py
CertificatesAPI.list_certificates
def list_certificates(self, **kwargs): """List certificates registered to organisation. Currently returns partially populated certificates. To obtain the full certificate object: `[get_certificate(certificate_id=cert['id']) for cert in list_certificates]` :param int limit: The number o...
python
def list_certificates(self, **kwargs): """List certificates registered to organisation. Currently returns partially populated certificates. To obtain the full certificate object: `[get_certificate(certificate_id=cert['id']) for cert in list_certificates]` :param int limit: The number o...
['def', 'list_certificates', '(', 'self', ',', '*', '*', 'kwargs', ')', ':', 'kwargs', '=', 'self', '.', '_verify_sort_options', '(', 'kwargs', ')', 'kwargs', '=', 'self', '.', '_verify_filters', '(', 'kwargs', ',', 'Certificate', ')', 'if', '"service__eq"', 'in', 'kwargs', ':', 'if', 'kwargs', '[', '"service__eq"', ']...
List certificates registered to organisation. Currently returns partially populated certificates. To obtain the full certificate object: `[get_certificate(certificate_id=cert['id']) for cert in list_certificates]` :param int limit: The number of certificates to retrieve. :param str ord...
['List', 'certificates', 'registered', 'to', 'organisation', '.']
train
https://github.com/ARMmbed/mbed-cloud-sdk-python/blob/c0af86fb2cdd4dc7ed26f236139241067d293509/src/mbed_cloud/certificates/certificates.py#L52-L84
9,675
20c/xbahn
xbahn/connection/__init__.py
Connection.make_data
def make_data(self, message): """ make data string from message according to transport_content_type Returns: str: message data """ if not isinstance(message, Message): return message return message.export(self.transport_content_type)
python
def make_data(self, message): """ make data string from message according to transport_content_type Returns: str: message data """ if not isinstance(message, Message): return message return message.export(self.transport_content_type)
['def', 'make_data', '(', 'self', ',', 'message', ')', ':', 'if', 'not', 'isinstance', '(', 'message', ',', 'Message', ')', ':', 'return', 'message', 'return', 'message', '.', 'export', '(', 'self', '.', 'transport_content_type', ')']
make data string from message according to transport_content_type Returns: str: message data
['make', 'data', 'string', 'from', 'message', 'according', 'to', 'transport_content_type']
train
https://github.com/20c/xbahn/blob/afb27b0576841338a366d7cac0200a782bd84be6/xbahn/connection/__init__.py#L122-L134
9,676
genialis/resolwe
resolwe/flow/utils/stats.py
SimpleLoadAvg.add
def add(self, count, timestamp=None): """Add a value at the specified time to the series. :param count: The number of work items ready at the specified time. :param timestamp: The timestamp to add. Defaults to None, meaning current time. It should be strictly greater (ne...
python
def add(self, count, timestamp=None): """Add a value at the specified time to the series. :param count: The number of work items ready at the specified time. :param timestamp: The timestamp to add. Defaults to None, meaning current time. It should be strictly greater (ne...
['def', 'add', '(', 'self', ',', 'count', ',', 'timestamp', '=', 'None', ')', ':', 'if', 'timestamp', 'is', 'None', ':', 'timestamp', '=', 'time', '.', 'time', '(', ')', 'if', 'self', '.', 'last_data', '>=', 'timestamp', ':', 'raise', 'ValueError', '(', '"Time {} >= {} in load average calculation"', '.', 'format', '(',...
Add a value at the specified time to the series. :param count: The number of work items ready at the specified time. :param timestamp: The timestamp to add. Defaults to None, meaning current time. It should be strictly greater (newer) than the last added timestamp.
['Add', 'a', 'value', 'at', 'the', 'specified', 'time', 'to', 'the', 'series', '.']
train
https://github.com/genialis/resolwe/blob/f7bb54932c81ec0cfc5b5e80d238fceaeaa48d86/resolwe/flow/utils/stats.py#L146-L162
9,677
watson-developer-cloud/python-sdk
ibm_watson/discovery_v1.py
QueryEvidence._to_dict
def _to_dict(self): """Return a json dictionary representing this model.""" _dict = {} if hasattr(self, 'document_id') and self.document_id is not None: _dict['document_id'] = self.document_id if hasattr(self, 'field') and self.field is not None: _dict['field'] = ...
python
def _to_dict(self): """Return a json dictionary representing this model.""" _dict = {} if hasattr(self, 'document_id') and self.document_id is not None: _dict['document_id'] = self.document_id if hasattr(self, 'field') and self.field is not None: _dict['field'] = ...
['def', '_to_dict', '(', 'self', ')', ':', '_dict', '=', '{', '}', 'if', 'hasattr', '(', 'self', ',', "'document_id'", ')', 'and', 'self', '.', 'document_id', 'is', 'not', 'None', ':', '_dict', '[', "'document_id'", ']', '=', 'self', '.', 'document_id', 'if', 'hasattr', '(', 'self', ',', "'field'", ')', 'and', 'self', ...
Return a json dictionary representing this model.
['Return', 'a', 'json', 'dictionary', 'representing', 'this', 'model', '.']
train
https://github.com/watson-developer-cloud/python-sdk/blob/4c2c9df4466fcde88975da9ecd834e6ba95eb353/ibm_watson/discovery_v1.py#L9012-L9025
9,678
taborlab/FlowCal
setup.py
find_version
def find_version(file_path): """ Scrape version information from specified file path. """ with open(file_path, 'r') as f: file_contents = f.read() version_match = re.search(r"^__version__\s*=\s*['\"]([^'\"]*)['\"]", file_contents, re.M) if version_match: ...
python
def find_version(file_path): """ Scrape version information from specified file path. """ with open(file_path, 'r') as f: file_contents = f.read() version_match = re.search(r"^__version__\s*=\s*['\"]([^'\"]*)['\"]", file_contents, re.M) if version_match: ...
['def', 'find_version', '(', 'file_path', ')', ':', 'with', 'open', '(', 'file_path', ',', "'r'", ')', 'as', 'f', ':', 'file_contents', '=', 'f', '.', 'read', '(', ')', 'version_match', '=', 're', '.', 'search', '(', 'r"^__version__\\s*=\\s*[\'\\"]([^\'\\"]*)[\'\\"]"', ',', 'file_contents', ',', 're', '.', 'M', ')', 'i...
Scrape version information from specified file path.
['Scrape', 'version', 'information', 'from', 'specified', 'file', 'path', '.']
train
https://github.com/taborlab/FlowCal/blob/031a7af82acb1d46879a8e384a1a00f27f0bdc7a/setup.py#L14-L26
9,679
ArduPilot/MAVProxy
MAVProxy/modules/mavproxy_output.py
OutputModule.cmd_output
def cmd_output(self, args): '''handle output commands''' if len(args) < 1 or args[0] == "list": self.cmd_output_list() elif args[0] == "add": if len(args) != 2: print("Usage: output add OUTPUT") return self.cmd_output_add(args[1...
python
def cmd_output(self, args): '''handle output commands''' if len(args) < 1 or args[0] == "list": self.cmd_output_list() elif args[0] == "add": if len(args) != 2: print("Usage: output add OUTPUT") return self.cmd_output_add(args[1...
['def', 'cmd_output', '(', 'self', ',', 'args', ')', ':', 'if', 'len', '(', 'args', ')', '<', '1', 'or', 'args', '[', '0', ']', '==', '"list"', ':', 'self', '.', 'cmd_output_list', '(', ')', 'elif', 'args', '[', '0', ']', '==', '"add"', ':', 'if', 'len', '(', 'args', ')', '!=', '2', ':', 'print', '(', '"Usage: output a...
handle output commands
['handle', 'output', 'commands']
train
https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_output.py#L21-L41
9,680
srsudar/eg
eg/config.py
_inform_if_path_does_not_exist
def _inform_if_path_does_not_exist(path): """ If the path does not exist, print a message saying so. This is intended to be helpful to users if they specify a custom path that eg cannot find. """ expanded_path = get_expanded_path(path) if not os.path.exists(expanded_path): print('Could n...
python
def _inform_if_path_does_not_exist(path): """ If the path does not exist, print a message saying so. This is intended to be helpful to users if they specify a custom path that eg cannot find. """ expanded_path = get_expanded_path(path) if not os.path.exists(expanded_path): print('Could n...
['def', '_inform_if_path_does_not_exist', '(', 'path', ')', ':', 'expanded_path', '=', 'get_expanded_path', '(', 'path', ')', 'if', 'not', 'os', '.', 'path', '.', 'exists', '(', 'expanded_path', ')', ':', 'print', '(', "'Could not find custom path at: {}'", '.', 'format', '(', 'expanded_path', ')', ')']
If the path does not exist, print a message saying so. This is intended to be helpful to users if they specify a custom path that eg cannot find.
['If', 'the', 'path', 'does', 'not', 'exist', 'print', 'a', 'message', 'saying', 'so', '.', 'This', 'is', 'intended', 'to', 'be', 'helpful', 'to', 'users', 'if', 'they', 'specify', 'a', 'custom', 'path', 'that', 'eg', 'cannot', 'find', '.']
train
https://github.com/srsudar/eg/blob/96142a74f4416b4a7000c85032c070df713b849e/eg/config.py#L383-L390
9,681
torre76/gd_shortener
gdshortener/gdshortener.py
GDBaseShortener.lookup
def lookup(self, short_url): ''' Lookup an URL shortened with `is.gd - v.gd url service <http://is.gd/developers.php>`_ and return the real url :param short_url: the url shortened with .gd service :type short_url: str. :returns: str. -- T...
python
def lookup(self, short_url): ''' Lookup an URL shortened with `is.gd - v.gd url service <http://is.gd/developers.php>`_ and return the real url :param short_url: the url shortened with .gd service :type short_url: str. :returns: str. -- T...
['def', 'lookup', '(', 'self', ',', 'short_url', ')', ':', 'if', 'short_url', 'is', 'None', 'or', 'not', 'isinstance', '(', 'short_url', ',', 'basestring', ')', 'or', 'len', '(', 'short_url', '.', 'strip', '(', ')', ')', '==', '0', ':', 'raise', 'GDMalformedURLError', '(', "'The shortened URL must be a non empty string...
Lookup an URL shortened with `is.gd - v.gd url service <http://is.gd/developers.php>`_ and return the real url :param short_url: the url shortened with .gd service :type short_url: str. :returns: str. -- The original url that was shortened with .gd service ...
['Lookup', 'an', 'URL', 'shortened', 'with', 'is', '.', 'gd', '-', 'v', '.', 'gd', 'url', 'service', '<http', ':', '//', 'is', '.', 'gd', '/', 'developers', '.', 'php', '>', '_', 'and', 'return', 'the', 'real', 'url', ':', 'param', 'short_url', ':', 'the', 'url', 'shortened', 'with', '.', 'gd', 'service', ':', 'type', ...
train
https://github.com/torre76/gd_shortener/blob/a34becf15512e6193960c93edad6258928705bfa/gdshortener/gdshortener.py#L161-L208
9,682
log2timeline/plaso
plaso/cli/log2timeline_tool.py
Log2TimelineTool.ShowInfo
def ShowInfo(self): """Shows information about available hashers, parsers, plugins, etc.""" self._output_writer.Write( '{0:=^80s}\n'.format(' log2timeline/plaso information ')) plugin_list = self._GetPluginData() for header, data in plugin_list.items(): table_view = views.ViewsFactory.Get...
python
def ShowInfo(self): """Shows information about available hashers, parsers, plugins, etc.""" self._output_writer.Write( '{0:=^80s}\n'.format(' log2timeline/plaso information ')) plugin_list = self._GetPluginData() for header, data in plugin_list.items(): table_view = views.ViewsFactory.Get...
['def', 'ShowInfo', '(', 'self', ')', ':', 'self', '.', '_output_writer', '.', 'Write', '(', "'{0:=^80s}\\n'", '.', 'format', '(', "' log2timeline/plaso information '", ')', ')', 'plugin_list', '=', 'self', '.', '_GetPluginData', '(', ')', 'for', 'header', ',', 'data', 'in', 'plugin_list', '.', 'items', '(', ')', ':', ...
Shows information about available hashers, parsers, plugins, etc.
['Shows', 'information', 'about', 'available', 'hashers', 'parsers', 'plugins', 'etc', '.']
train
https://github.com/log2timeline/plaso/blob/9c564698d2da3ffbe23607a3c54c0582ea18a6cc/plaso/cli/log2timeline_tool.py#L454-L466
9,683
cmbruns/pyopenvr
src/openvr/__init__.py
IVRSystem.triggerHapticPulse
def triggerHapticPulse(self, unControllerDeviceIndex, unAxisId, usDurationMicroSec): """ Trigger a single haptic pulse on a controller. After this call the application may not trigger another haptic pulse on this controller and axis combination for 5ms. This function is deprecated in favor of th...
python
def triggerHapticPulse(self, unControllerDeviceIndex, unAxisId, usDurationMicroSec): """ Trigger a single haptic pulse on a controller. After this call the application may not trigger another haptic pulse on this controller and axis combination for 5ms. This function is deprecated in favor of th...
['def', 'triggerHapticPulse', '(', 'self', ',', 'unControllerDeviceIndex', ',', 'unAxisId', ',', 'usDurationMicroSec', ')', ':', 'fn', '=', 'self', '.', 'function_table', '.', 'triggerHapticPulse', 'fn', '(', 'unControllerDeviceIndex', ',', 'unAxisId', ',', 'usDurationMicroSec', ')']
Trigger a single haptic pulse on a controller. After this call the application may not trigger another haptic pulse on this controller and axis combination for 5ms. This function is deprecated in favor of the new IVRInput system.
['Trigger', 'a', 'single', 'haptic', 'pulse', 'on', 'a', 'controller', '.', 'After', 'this', 'call', 'the', 'application', 'may', 'not', 'trigger', 'another', 'haptic', 'pulse', 'on', 'this', 'controller', 'and', 'axis', 'combination', 'for', '5ms', '.', 'This', 'function', 'is', 'deprecated', 'in', 'favor', 'of', 'the...
train
https://github.com/cmbruns/pyopenvr/blob/68395d26bb3df6ab1f0f059c38d441f962938be6/src/openvr/__init__.py#L3042-L3049
9,684
saltstack/salt
salt/modules/boto_iam.py
delete_server_cert
def delete_server_cert(cert_name, region=None, key=None, keyid=None, profile=None): ''' Deletes a certificate from Amazon. .. versionadded:: 2015.8.0 CLI Example: .. code-block:: bash salt myminion boto_iam.delete_server_cert mycert_name ''' conn = _get_conn(region=region, key=ke...
python
def delete_server_cert(cert_name, region=None, key=None, keyid=None, profile=None): ''' Deletes a certificate from Amazon. .. versionadded:: 2015.8.0 CLI Example: .. code-block:: bash salt myminion boto_iam.delete_server_cert mycert_name ''' conn = _get_conn(region=region, key=ke...
['def', 'delete_server_cert', '(', 'cert_name', ',', 'region', '=', 'None', ',', 'key', '=', 'None', ',', 'keyid', '=', 'None', ',', 'profile', '=', 'None', ')', ':', 'conn', '=', '_get_conn', '(', 'region', '=', 'region', ',', 'key', '=', 'key', ',', 'keyid', '=', 'keyid', ',', 'profile', '=', 'profile', ')', 'try', '...
Deletes a certificate from Amazon. .. versionadded:: 2015.8.0 CLI Example: .. code-block:: bash salt myminion boto_iam.delete_server_cert mycert_name
['Deletes', 'a', 'certificate', 'from', 'Amazon', '.']
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/boto_iam.py#L1599-L1617
9,685
web-push-libs/pywebpush
pywebpush/__init__.py
WebPusher.send
def send(self, data=None, headers=None, ttl=0, gcm_key=None, reg_id=None, content_encoding="aes128gcm", curl=False, timeout=None): """Encode and send the data to the Push Service. :param data: A serialized block of data (see encode() ). :type data: str :param headers: A dic...
python
def send(self, data=None, headers=None, ttl=0, gcm_key=None, reg_id=None, content_encoding="aes128gcm", curl=False, timeout=None): """Encode and send the data to the Push Service. :param data: A serialized block of data (see encode() ). :type data: str :param headers: A dic...
['def', 'send', '(', 'self', ',', 'data', '=', 'None', ',', 'headers', '=', 'None', ',', 'ttl', '=', '0', ',', 'gcm_key', '=', 'None', ',', 'reg_id', '=', 'None', ',', 'content_encoding', '=', '"aes128gcm"', ',', 'curl', '=', 'False', ',', 'timeout', '=', 'None', ')', ':', '# Encode the data.', 'if', 'headers', 'is', '...
Encode and send the data to the Push Service. :param data: A serialized block of data (see encode() ). :type data: str :param headers: A dictionary containing any additional HTTP headers. :type headers: dict :param ttl: The Time To Live in seconds for this message if the ...
['Encode', 'and', 'send', 'the', 'data', 'to', 'the', 'Push', 'Service', '.']
train
https://github.com/web-push-libs/pywebpush/blob/2a23f45b7819e31bd030de9fe1357a1cf7dcfdc4/pywebpush/__init__.py#L256-L347
9,686
d0c-s4vage/pfp
pfp/bitwrap.py
BitwrappedStream.read
def read(self, num): """Read ``num`` number of bytes from the stream. Note that this will automatically resets/ends the current bit-reading if it does not end on an even byte AND ``self.padded`` is True. If ``self.padded`` is True, then the entire stream is treated as a bitstream. ...
python
def read(self, num): """Read ``num`` number of bytes from the stream. Note that this will automatically resets/ends the current bit-reading if it does not end on an even byte AND ``self.padded`` is True. If ``self.padded`` is True, then the entire stream is treated as a bitstream. ...
['def', 'read', '(', 'self', ',', 'num', ')', ':', 'start_pos', '=', 'self', '.', 'tell', '(', ')', 'if', 'self', '.', 'padded', ':', '# we toss out any uneven bytes', 'self', '.', '_bits', '.', 'clear', '(', ')', 'res', '=', 'utils', '.', 'binary', '(', 'self', '.', '_stream', '.', 'read', '(', 'num', ')', ')', 'else'...
Read ``num`` number of bytes from the stream. Note that this will automatically resets/ends the current bit-reading if it does not end on an even byte AND ``self.padded`` is True. If ``self.padded`` is True, then the entire stream is treated as a bitstream. :num: number of bytes to read...
['Read', 'num', 'number', 'of', 'bytes', 'from', 'the', 'stream', '.', 'Note', 'that', 'this', 'will', 'automatically', 'resets', '/', 'ends', 'the', 'current', 'bit', '-', 'reading', 'if', 'it', 'does', 'not', 'end', 'on', 'an', 'even', 'byte', 'AND', 'self', '.', 'padded', 'is', 'True', '.', 'If', 'self', '.', 'padde...
train
https://github.com/d0c-s4vage/pfp/blob/32f2d34fdec1c70019fa83c7006d5e3be0f92fcd/pfp/bitwrap.py#L100-L123
9,687
onnx/onnxmltools
onnxmltools/convert/coreml/shape_calculators/TensorToProbabilityMap.py
calculate_tensor_to_probability_map_output_shapes
def calculate_tensor_to_probability_map_output_shapes(operator): ''' Allowed input/output patterns are ONNX < 1.2 1. [1, C] ---> ---> A map 2. [1, C_1, ..., C_n] ---> A map ONNX >= 1.2 1. [N, C] ---> ---> A sequence of maps 2. [N, C_1, ..., C_n] ---> A sequence of maps ...
python
def calculate_tensor_to_probability_map_output_shapes(operator): ''' Allowed input/output patterns are ONNX < 1.2 1. [1, C] ---> ---> A map 2. [1, C_1, ..., C_n] ---> A map ONNX >= 1.2 1. [N, C] ---> ---> A sequence of maps 2. [N, C_1, ..., C_n] ---> A sequence of maps ...
['def', 'calculate_tensor_to_probability_map_output_shapes', '(', 'operator', ')', ':', 'check_input_and_output_numbers', '(', 'operator', ',', 'input_count_range', '=', '1', ',', 'output_count_range', '=', '1', ')', 'check_input_and_output_types', '(', 'operator', ',', 'good_input_types', '=', '[', 'FloatTensorType', ...
Allowed input/output patterns are ONNX < 1.2 1. [1, C] ---> ---> A map 2. [1, C_1, ..., C_n] ---> A map ONNX >= 1.2 1. [N, C] ---> ---> A sequence of maps 2. [N, C_1, ..., C_n] ---> A sequence of maps Note that N must be 1 currently if you're using ONNX<1.2 because old ZipMa...
['Allowed', 'input', '/', 'output', 'patterns', 'are', 'ONNX', '<', '1', '.', '2', '1', '.', '[', '1', 'C', ']', '---', '>', '---', '>', 'A', 'map', '2', '.', '[', '1', 'C_1', '...', 'C_n', ']', '---', '>', 'A', 'map', 'ONNX', '>', '=', '1', '.', '2', '1', '.', '[', 'N', 'C', ']', '---', '>', '---', '>', 'A', 'sequence...
train
https://github.com/onnx/onnxmltools/blob/d4e4c31990fc2d9fd1f92139f497d360914c9df2/onnxmltools/convert/coreml/shape_calculators/TensorToProbabilityMap.py#L12-L49
9,688
astropy/photutils
photutils/psf/matching/fourier.py
create_matching_kernel
def create_matching_kernel(source_psf, target_psf, window=None): """ Create a kernel to match 2D point spread functions (PSF) using the ratio of Fourier transforms. Parameters ---------- source_psf : 2D `~numpy.ndarray` The source PSF. The source PSF should have higher resolution ...
python
def create_matching_kernel(source_psf, target_psf, window=None): """ Create a kernel to match 2D point spread functions (PSF) using the ratio of Fourier transforms. Parameters ---------- source_psf : 2D `~numpy.ndarray` The source PSF. The source PSF should have higher resolution ...
['def', 'create_matching_kernel', '(', 'source_psf', ',', 'target_psf', ',', 'window', '=', 'None', ')', ':', '# inputs are copied so that they are not changed when normalizing', 'source_psf', '=', 'np', '.', 'copy', '(', 'np', '.', 'asanyarray', '(', 'source_psf', ')', ')', 'target_psf', '=', 'np', '.', 'copy', '(', '...
Create a kernel to match 2D point spread functions (PSF) using the ratio of Fourier transforms. Parameters ---------- source_psf : 2D `~numpy.ndarray` The source PSF. The source PSF should have higher resolution (i.e. narrower) than the target PSF. ``source_psf`` and ``target_...
['Create', 'a', 'kernel', 'to', 'match', '2D', 'point', 'spread', 'functions', '(', 'PSF', ')', 'using', 'the', 'ratio', 'of', 'Fourier', 'transforms', '.']
train
https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/psf/matching/fourier.py#L45-L104
9,689
PyCQA/astroid
astroid/node_classes.py
UnaryOp.type_errors
def type_errors(self, context=None): """Get a list of type errors which can occur during inference. Each TypeError is represented by a :class:`BadBinaryOperationMessage`, which holds the original exception. :returns: The list of possible type errors. :rtype: list(BadBinaryOpera...
python
def type_errors(self, context=None): """Get a list of type errors which can occur during inference. Each TypeError is represented by a :class:`BadBinaryOperationMessage`, which holds the original exception. :returns: The list of possible type errors. :rtype: list(BadBinaryOpera...
['def', 'type_errors', '(', 'self', ',', 'context', '=', 'None', ')', ':', 'try', ':', 'results', '=', 'self', '.', '_infer_unaryop', '(', 'context', '=', 'context', ')', 'return', '[', 'result', 'for', 'result', 'in', 'results', 'if', 'isinstance', '(', 'result', ',', 'util', '.', 'BadUnaryOperationMessage', ')', ']',...
Get a list of type errors which can occur during inference. Each TypeError is represented by a :class:`BadBinaryOperationMessage`, which holds the original exception. :returns: The list of possible type errors. :rtype: list(BadBinaryOperationMessage)
['Get', 'a', 'list', 'of', 'type', 'errors', 'which', 'can', 'occur', 'during', 'inference', '.']
train
https://github.com/PyCQA/astroid/blob/e0a298df55b15abcb77c2a93253f5ab7be52d0fb/astroid/node_classes.py#L4309-L4326
9,690
jtwhite79/pyemu
pyemu/plot/plot_utils.py
plot_summary_distributions
def plot_summary_distributions(df,ax=None,label_post=False,label_prior=False, subplots=False,figsize=(11,8.5),pt_color='b'): """ helper function to plot gaussian distrbutions from prior and posterior means and standard deviations Parameters ---------- df : pandas.Data...
python
def plot_summary_distributions(df,ax=None,label_post=False,label_prior=False, subplots=False,figsize=(11,8.5),pt_color='b'): """ helper function to plot gaussian distrbutions from prior and posterior means and standard deviations Parameters ---------- df : pandas.Data...
['def', 'plot_summary_distributions', '(', 'df', ',', 'ax', '=', 'None', ',', 'label_post', '=', 'False', ',', 'label_prior', '=', 'False', ',', 'subplots', '=', 'False', ',', 'figsize', '=', '(', '11', ',', '8.5', ')', ',', 'pt_color', '=', "'b'", ')', ':', 'import', 'matplotlib', '.', 'pyplot', 'as', 'plt', 'if', 'is...
helper function to plot gaussian distrbutions from prior and posterior means and standard deviations Parameters ---------- df : pandas.DataFrame a dataframe and csv file. Must have columns named: 'prior_mean','prior_stdev','post_mean','post_stdev'. If loaded from a csv file, c...
['helper', 'function', 'to', 'plot', 'gaussian', 'distrbutions', 'from', 'prior', 'and', 'posterior', 'means', 'and', 'standard', 'deviations']
train
https://github.com/jtwhite79/pyemu/blob/c504d8e7a4097cec07655a6318d275739bd8148a/pyemu/plot/plot_utils.py#L27-L139
9,691
jantman/awslimitchecker
awslimitchecker/services/vpc.py
_VpcService._update_limits_from_api
def _update_limits_from_api(self): """ Query EC2's DescribeAccountAttributes API action and update the network interface limit, as needed. Updates ``self.limits``. More info on the network interface limit, from the docs: 'This limit is the greater of either the default limit (35...
python
def _update_limits_from_api(self): """ Query EC2's DescribeAccountAttributes API action and update the network interface limit, as needed. Updates ``self.limits``. More info on the network interface limit, from the docs: 'This limit is the greater of either the default limit (35...
['def', '_update_limits_from_api', '(', 'self', ')', ':', 'self', '.', 'connect', '(', ')', 'self', '.', 'connect_resource', '(', ')', 'logger', '.', 'info', '(', '"Querying EC2 DescribeAccountAttributes for limits"', ')', 'attribs', '=', 'self', '.', 'conn', '.', 'describe_account_attributes', '(', ')', 'for', 'attrib...
Query EC2's DescribeAccountAttributes API action and update the network interface limit, as needed. Updates ``self.limits``. More info on the network interface limit, from the docs: 'This limit is the greater of either the default limit (350) or your On-Demand Instance limit multiplied ...
['Query', 'EC2', 's', 'DescribeAccountAttributes', 'API', 'action', 'and', 'update', 'the', 'network', 'interface', 'limit', 'as', 'needed', '.', 'Updates', 'self', '.', 'limits', '.']
train
https://github.com/jantman/awslimitchecker/blob/e50197f70f3d0abcc5cfc7fde6336f548b790e34/awslimitchecker/services/vpc.py#L339-L359
9,692
getsentry/sentry-python
sentry_sdk/scope.py
Scope.apply_to_event
def apply_to_event(self, event, hint=None): # type: (Dict[str, Any], Dict[str, Any]) -> Optional[Dict[str, Any]] """Applies the information contained on the scope to the given event.""" def _drop(event, cause, ty): # type: (Dict[str, Any], Callable, str) -> Optional[Any] ...
python
def apply_to_event(self, event, hint=None): # type: (Dict[str, Any], Dict[str, Any]) -> Optional[Dict[str, Any]] """Applies the information contained on the scope to the given event.""" def _drop(event, cause, ty): # type: (Dict[str, Any], Callable, str) -> Optional[Any] ...
['def', 'apply_to_event', '(', 'self', ',', 'event', ',', 'hint', '=', 'None', ')', ':', '# type: (Dict[str, Any], Dict[str, Any]) -> Optional[Dict[str, Any]]', 'def', '_drop', '(', 'event', ',', 'cause', ',', 'ty', ')', ':', '# type: (Dict[str, Any], Callable, str) -> Optional[Any]', 'logger', '.', 'info', '(', '"%s (...
Applies the information contained on the scope to the given event.
['Applies', 'the', 'information', 'contained', 'on', 'the', 'scope', 'to', 'the', 'given', 'event', '.']
train
https://github.com/getsentry/sentry-python/blob/a1d77722bdce0b94660ebf50b5c4a4645916d084/sentry_sdk/scope.py#L172-L225
9,693
MIT-LCP/wfdb-python
wfdb/io/_header.py
_parse_signal_lines
def _parse_signal_lines(signal_lines): """ Extract fields from a list of signal line strings into a dictionary. """ n_sig = len(signal_lines) # Dictionary for signal fields signal_fields = {} # Each dictionary field is a list for field in SIGNAL_SPECS.index: signal_fields[field...
python
def _parse_signal_lines(signal_lines): """ Extract fields from a list of signal line strings into a dictionary. """ n_sig = len(signal_lines) # Dictionary for signal fields signal_fields = {} # Each dictionary field is a list for field in SIGNAL_SPECS.index: signal_fields[field...
['def', '_parse_signal_lines', '(', 'signal_lines', ')', ':', 'n_sig', '=', 'len', '(', 'signal_lines', ')', '# Dictionary for signal fields', 'signal_fields', '=', '{', '}', '# Each dictionary field is a list', 'for', 'field', 'in', 'SIGNAL_SPECS', '.', 'index', ':', 'signal_fields', '[', 'field', ']', '=', 'n_sig', '...
Extract fields from a list of signal line strings into a dictionary.
['Extract', 'fields', 'from', 'a', 'list', 'of', 'signal', 'line', 'strings', 'into', 'a', 'dictionary', '.']
train
https://github.com/MIT-LCP/wfdb-python/blob/cc8c9e9e44f10af961b7a9d8ae03708b31ac8a8c/wfdb/io/_header.py#L780-L824
9,694
googledatalab/pydatalab
datalab/bigquery/_dataset.py
Dataset.create
def create(self, friendly_name=None, description=None): """Creates the Dataset with the specified friendly name and description. Args: friendly_name: (optional) the friendly name for the dataset if it is being created. description: (optional) a description for the dataset if it is being created. ...
python
def create(self, friendly_name=None, description=None): """Creates the Dataset with the specified friendly name and description. Args: friendly_name: (optional) the friendly name for the dataset if it is being created. description: (optional) a description for the dataset if it is being created. ...
['def', 'create', '(', 'self', ',', 'friendly_name', '=', 'None', ',', 'description', '=', 'None', ')', ':', 'if', 'not', 'self', '.', 'exists', '(', ')', ':', 'try', ':', 'response', '=', 'self', '.', '_api', '.', 'datasets_insert', '(', 'self', '.', '_name_parts', ',', 'friendly_name', '=', 'friendly_name', ',', 'des...
Creates the Dataset with the specified friendly name and description. Args: friendly_name: (optional) the friendly name for the dataset if it is being created. description: (optional) a description for the dataset if it is being created. Returns: The Dataset. Raises: Exception if th...
['Creates', 'the', 'Dataset', 'with', 'the', 'specified', 'friendly', 'name', 'and', 'description', '.']
train
https://github.com/googledatalab/pydatalab/blob/d9031901d5bca22fe0d5925d204e6698df9852e1/datalab/bigquery/_dataset.py#L121-L141
9,695
fermiPy/fermipy
fermipy/gtanalysis.py
GTAnalysis.clone
def clone(self, config, **kwargs): """Make a clone of this analysis instance.""" gta = GTAnalysis(config, **kwargs) gta._roi = copy.deepcopy(self.roi) return gta
python
def clone(self, config, **kwargs): """Make a clone of this analysis instance.""" gta = GTAnalysis(config, **kwargs) gta._roi = copy.deepcopy(self.roi) return gta
['def', 'clone', '(', 'self', ',', 'config', ',', '*', '*', 'kwargs', ')', ':', 'gta', '=', 'GTAnalysis', '(', 'config', ',', '*', '*', 'kwargs', ')', 'gta', '.', '_roi', '=', 'copy', '.', 'deepcopy', '(', 'self', '.', 'roi', ')', 'return', 'gta']
Make a clone of this analysis instance.
['Make', 'a', 'clone', 'of', 'this', 'analysis', 'instance', '.']
train
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/gtanalysis.py#L551-L555
9,696
SheffieldML/GPy
GPy/examples/classification.py
crescent_data
def crescent_data(model_type='Full', num_inducing=10, seed=default_seed, kernel=None, optimize=True, plot=True): """ Run a Gaussian process classification on the crescent data. The demonstration calls the basic GP classification model and uses EP to approximate the likelihood. :param model_type: type of mo...
python
def crescent_data(model_type='Full', num_inducing=10, seed=default_seed, kernel=None, optimize=True, plot=True): """ Run a Gaussian process classification on the crescent data. The demonstration calls the basic GP classification model and uses EP to approximate the likelihood. :param model_type: type of mo...
['def', 'crescent_data', '(', 'model_type', '=', "'Full'", ',', 'num_inducing', '=', '10', ',', 'seed', '=', 'default_seed', ',', 'kernel', '=', 'None', ',', 'optimize', '=', 'True', ',', 'plot', '=', 'True', ')', ':', 'try', ':', 'import', 'pods', 'except', 'ImportError', ':', 'print', '(', "'pods unavailable, see htt...
Run a Gaussian process classification on the crescent data. The demonstration calls the basic GP classification model and uses EP to approximate the likelihood. :param model_type: type of model to fit ['Full', 'FITC', 'DTC']. :param inducing: number of inducing variables (only used for 'FITC' or 'DTC'). :t...
['Run', 'a', 'Gaussian', 'process', 'classification', 'on', 'the', 'crescent', 'data', '.', 'The', 'demonstration', 'calls', 'the', 'basic', 'GP', 'classification', 'model', 'and', 'uses', 'EP', 'to', 'approximate', 'the', 'likelihood', '.']
train
https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/examples/classification.py#L225-L260
9,697
emc-openstack/storops
storops/lib/parser.py
ParserConfigFactory._get_converter
def _get_converter(self, converter_str): """find converter function reference by name find converter by name, converter name follows this convention: Class.method or: method The first type of converter class/function must be available in current modul...
python
def _get_converter(self, converter_str): """find converter function reference by name find converter by name, converter name follows this convention: Class.method or: method The first type of converter class/function must be available in current modul...
['def', '_get_converter', '(', 'self', ',', 'converter_str', ')', ':', 'ret', '=', 'None', 'if', 'converter_str', 'is', 'not', 'None', ':', 'converter_desc_list', '=', 'converter_str', '.', 'split', '(', "'.'", ')', 'if', 'len', '(', 'converter_desc_list', ')', '==', '1', ':', 'converter', '=', 'converter_desc_list', '...
find converter function reference by name find converter by name, converter name follows this convention: Class.method or: method The first type of converter class/function must be available in current module. The second type of converter must be avai...
['find', 'converter', 'function', 'reference', 'by', 'name']
train
https://github.com/emc-openstack/storops/blob/24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd/storops/lib/parser.py#L398-L443
9,698
sbg/sevenbridges-python
sevenbridges/models/storage_export.py
Export.query
def query(cls, volume=None, state=None, offset=None, limit=None, api=None): """ Query (List) exports. :param volume: Optional volume identifier. :param state: Optional import sate. :param api: Api instance. :return: Collection object. """ ap...
python
def query(cls, volume=None, state=None, offset=None, limit=None, api=None): """ Query (List) exports. :param volume: Optional volume identifier. :param state: Optional import sate. :param api: Api instance. :return: Collection object. """ ap...
['def', 'query', '(', 'cls', ',', 'volume', '=', 'None', ',', 'state', '=', 'None', ',', 'offset', '=', 'None', ',', 'limit', '=', 'None', ',', 'api', '=', 'None', ')', ':', 'api', '=', 'api', 'or', 'cls', '.', '_API', 'if', 'volume', ':', 'volume', '=', 'Transform', '.', 'to_volume', '(', 'volume', ')', 'return', 'sup...
Query (List) exports. :param volume: Optional volume identifier. :param state: Optional import sate. :param api: Api instance. :return: Collection object.
['Query', '(', 'List', ')', 'exports', '.', ':', 'param', 'volume', ':', 'Optional', 'volume', 'identifier', '.', ':', 'param', 'state', ':', 'Optional', 'import', 'sate', '.', ':', 'param', 'api', ':', 'Api', 'instance', '.', ':', 'return', ':', 'Collection', 'object', '.']
train
https://github.com/sbg/sevenbridges-python/blob/f62640d1018d959f0b686f2dbe5e183085336607/sevenbridges/models/storage_export.py#L125-L143
9,699
20c/vodka
vodka/config/validators.py
host
def host(value): """ Validates that the value is a valid network location """ if not value: return (True, "") try: host,port = value.split(":") except ValueError as _: return (False, "value needs to be <host>:<port>") try: int(port) except ValueError as _: ...
python
def host(value): """ Validates that the value is a valid network location """ if not value: return (True, "") try: host,port = value.split(":") except ValueError as _: return (False, "value needs to be <host>:<port>") try: int(port) except ValueError as _: ...
['def', 'host', '(', 'value', ')', ':', 'if', 'not', 'value', ':', 'return', '(', 'True', ',', '""', ')', 'try', ':', 'host', ',', 'port', '=', 'value', '.', 'split', '(', '":"', ')', 'except', 'ValueError', 'as', '_', ':', 'return', '(', 'False', ',', '"value needs to be <host>:<port>"', ')', 'try', ':', 'int', '(', '...
Validates that the value is a valid network location
['Validates', 'that', 'the', 'value', 'is', 'a', 'valid', 'network', 'location']
train
https://github.com/20c/vodka/blob/9615148ac6560298453704bb5246b35b66b3339c/vodka/config/validators.py#L19-L33