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
8,100
bitshares/uptick
uptick/vesting.py
claim
def claim(ctx, vestingid, account, amount): """ Claim funds from the vesting balance """ vesting = Vesting(vestingid) if amount: amount = Amount(float(amount), "BTS") else: amount = vesting.claimable print_tx( ctx.bitshares.vesting_balance_withdraw( vesting["i...
python
def claim(ctx, vestingid, account, amount): """ Claim funds from the vesting balance """ vesting = Vesting(vestingid) if amount: amount = Amount(float(amount), "BTS") else: amount = vesting.claimable print_tx( ctx.bitshares.vesting_balance_withdraw( vesting["i...
['def', 'claim', '(', 'ctx', ',', 'vestingid', ',', 'account', ',', 'amount', ')', ':', 'vesting', '=', 'Vesting', '(', 'vestingid', ')', 'if', 'amount', ':', 'amount', '=', 'Amount', '(', 'float', '(', 'amount', ')', ',', '"BTS"', ')', 'else', ':', 'amount', '=', 'vesting', '.', 'claimable', 'print_tx', '(', 'ctx', '....
Claim funds from the vesting balance
['Claim', 'funds', 'from', 'the', 'vesting', 'balance']
train
https://github.com/bitshares/uptick/blob/66c102200fdbf96cef4fd55cc69d00e690f62001/uptick/vesting.py#L34-L46
8,101
python-openxml/python-docx
docx/oxml/text/font.py
CT_RPr._get_bool_val
def _get_bool_val(self, name): """ Return the value of the boolean child element having *name*, e.g. 'b', 'i', and 'smallCaps'. """ element = getattr(self, name) if element is None: return None return element.val
python
def _get_bool_val(self, name): """ Return the value of the boolean child element having *name*, e.g. 'b', 'i', and 'smallCaps'. """ element = getattr(self, name) if element is None: return None return element.val
['def', '_get_bool_val', '(', 'self', ',', 'name', ')', ':', 'element', '=', 'getattr', '(', 'self', ',', 'name', ')', 'if', 'element', 'is', 'None', ':', 'return', 'None', 'return', 'element', '.', 'val']
Return the value of the boolean child element having *name*, e.g. 'b', 'i', and 'smallCaps'.
['Return', 'the', 'value', 'of', 'the', 'boolean', 'child', 'element', 'having', '*', 'name', '*', 'e', '.', 'g', '.', 'b', 'i', 'and', 'smallCaps', '.']
train
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/oxml/text/font.py#L267-L275
8,102
wummel/patool
patoolib/programs/cpio.py
extract_cpio
def extract_cpio (archive, compression, cmd, verbosity, interactive, outdir): """Extract a CPIO archive.""" cmdlist = [util.shell_quote(cmd), '--extract', '--make-directories', '--preserve-modification-time'] if sys.platform.startswith('linux') and not cmd.endswith('bsdcpio'): cmdlist.extend...
python
def extract_cpio (archive, compression, cmd, verbosity, interactive, outdir): """Extract a CPIO archive.""" cmdlist = [util.shell_quote(cmd), '--extract', '--make-directories', '--preserve-modification-time'] if sys.platform.startswith('linux') and not cmd.endswith('bsdcpio'): cmdlist.extend...
['def', 'extract_cpio', '(', 'archive', ',', 'compression', ',', 'cmd', ',', 'verbosity', ',', 'interactive', ',', 'outdir', ')', ':', 'cmdlist', '=', '[', 'util', '.', 'shell_quote', '(', 'cmd', ')', ',', "'--extract'", ',', "'--make-directories'", ',', "'--preserve-modification-time'", ']', 'if', 'sys', '.', 'platfor...
Extract a CPIO archive.
['Extract', 'a', 'CPIO', 'archive', '.']
train
https://github.com/wummel/patool/blob/d7e64d9fd60faaa4b3f824bd97c43ce59b185c40/patoolib/programs/cpio.py#L21-L31
8,103
DataONEorg/d1_python
client_cli/src/d1_cli/impl/command_parser.py
CLI.do_clearrep
def do_clearrep(self, line): """clearrep Set the replication policy to default. The default replication policy has no preferred or blocked member nodes, allows replication and sets the preferred number of replicas to 3. """ self._split_args(line, 0, 0) self._command_pro...
python
def do_clearrep(self, line): """clearrep Set the replication policy to default. The default replication policy has no preferred or blocked member nodes, allows replication and sets the preferred number of replicas to 3. """ self._split_args(line, 0, 0) self._command_pro...
['def', 'do_clearrep', '(', 'self', ',', 'line', ')', ':', 'self', '.', '_split_args', '(', 'line', ',', '0', ',', '0', ')', 'self', '.', '_command_processor', '.', 'get_session', '(', ')', '.', 'get_replication_policy', '(', ')', '.', 'clear', '(', ')', 'self', '.', '_print_info_if_verbose', '(', '"Cleared the replica...
clearrep Set the replication policy to default. The default replication policy has no preferred or blocked member nodes, allows replication and sets the preferred number of replicas to 3.
['clearrep', 'Set', 'the', 'replication', 'policy', 'to', 'default', '.']
train
https://github.com/DataONEorg/d1_python/blob/3ac4d4f3ca052d3e8641a6a329cab526c8ddcb0d/client_cli/src/d1_cli/impl/command_parser.py#L304-L313
8,104
campaignmonitor/createsend-python
lib/createsend/client.py
Client.transfer_credits
def transfer_credits(self, credits, can_use_my_credits_when_they_run_out): """Transfer credits to or from this client. :param credits: An Integer representing the number of credits to transfer. This value may be either positive if you want to allocate credits from your account to th...
python
def transfer_credits(self, credits, can_use_my_credits_when_they_run_out): """Transfer credits to or from this client. :param credits: An Integer representing the number of credits to transfer. This value may be either positive if you want to allocate credits from your account to th...
['def', 'transfer_credits', '(', 'self', ',', 'credits', ',', 'can_use_my_credits_when_they_run_out', ')', ':', 'body', '=', '{', '"Credits"', ':', 'credits', ',', '"CanUseMyCreditsWhenTheyRunOut"', ':', 'can_use_my_credits_when_they_run_out', '}', 'response', '=', 'self', '.', '_post', '(', 'self', '.', 'uri_for', '('...
Transfer credits to or from this client. :param credits: An Integer representing the number of credits to transfer. This value may be either positive if you want to allocate credits from your account to the client, or negative if you want to deduct credits from the client back int...
['Transfer', 'credits', 'to', 'or', 'from', 'this', 'client', '.']
train
https://github.com/campaignmonitor/createsend-python/blob/4bfe2fd5cb2fc9d8f12280b23569eea0a6c66426/lib/createsend/client.py#L125-L148
8,105
remix/partridge
partridge/readers.py
_load_feed
def _load_feed(path: str, view: View, config: nx.DiGraph) -> Feed: """Multi-file feed filtering""" config_ = remove_node_attributes(config, ["converters", "transformations"]) feed_ = Feed(path, view={}, config=config_) for filename, column_filters in view.items(): config_ = reroot_graph(config_,...
python
def _load_feed(path: str, view: View, config: nx.DiGraph) -> Feed: """Multi-file feed filtering""" config_ = remove_node_attributes(config, ["converters", "transformations"]) feed_ = Feed(path, view={}, config=config_) for filename, column_filters in view.items(): config_ = reroot_graph(config_,...
['def', '_load_feed', '(', 'path', ':', 'str', ',', 'view', ':', 'View', ',', 'config', ':', 'nx', '.', 'DiGraph', ')', '->', 'Feed', ':', 'config_', '=', 'remove_node_attributes', '(', 'config', ',', '[', '"converters"', ',', '"transformations"', ']', ')', 'feed_', '=', 'Feed', '(', 'path', ',', 'view', '=', '{', '}',...
Multi-file feed filtering
['Multi', '-', 'file', 'feed', 'filtering']
train
https://github.com/remix/partridge/blob/0ba80fa30035e5e09fd8d7a7bdf1f28b93d53d03/partridge/readers.py#L106-L114
8,106
dpa-newslab/livebridge
livebridge/base/posts.py
BasePost.target_doc
def target_doc(self): """Returns resource doc as at the target, when the posting was already created \ at the target. This property normally contains the **target_doc** data from \ the livebrigde storage item, saved in a syndication earlier. :returns: dict""" if not hasatt...
python
def target_doc(self): """Returns resource doc as at the target, when the posting was already created \ at the target. This property normally contains the **target_doc** data from \ the livebrigde storage item, saved in a syndication earlier. :returns: dict""" if not hasatt...
['def', 'target_doc', '(', 'self', ')', ':', 'if', 'not', 'hasattr', '(', 'self', ',', '"_target_doc"', ')', 'or', 'not', 'self', '.', '_target_doc', ':', 'if', 'self', '.', '_existing', ':', 'self', '.', '_target_doc', '=', 'self', '.', '_existing', '.', 'get', '(', '"target_doc"', ',', '{', '}', ')', 'return', 'self'...
Returns resource doc as at the target, when the posting was already created \ at the target. This property normally contains the **target_doc** data from \ the livebrigde storage item, saved in a syndication earlier. :returns: dict
['Returns', 'resource', 'doc', 'as', 'at', 'the', 'target', 'when', 'the', 'posting', 'was', 'already', 'created', '\\', 'at', 'the', 'target', '.', 'This', 'property', 'normally', 'contains', 'the', '**', 'target_doc', '**', 'data', 'from', '\\', 'the', 'livebrigde', 'storage', 'item', 'saved', 'in', 'a', 'syndication...
train
https://github.com/dpa-newslab/livebridge/blob/d930e887faa2f882d15b574f0f1fe4a580d7c5fa/livebridge/base/posts.py#L98-L107
8,107
mikemaccana/python-docx
docx.py
wordrelationships
def wordrelationships(relationshiplist): '''Generate a Word relationships file''' # Default list of relationships # FIXME: using string hack instead of making element #relationships = makeelement('Relationships', nsprefix='pr') relationships = etree.fromstring( '<Relationships xmlns="http://...
python
def wordrelationships(relationshiplist): '''Generate a Word relationships file''' # Default list of relationships # FIXME: using string hack instead of making element #relationships = makeelement('Relationships', nsprefix='pr') relationships = etree.fromstring( '<Relationships xmlns="http://...
['def', 'wordrelationships', '(', 'relationshiplist', ')', ':', '# Default list of relationships', '# FIXME: using string hack instead of making element', "#relationships = makeelement('Relationships', nsprefix='pr')", 'relationships', '=', 'etree', '.', 'fromstring', '(', '\'<Relationships xmlns="http://schemas.openxm...
Generate a Word relationships file
['Generate', 'a', 'Word', 'relationships', 'file']
train
https://github.com/mikemaccana/python-docx/blob/4c9b46dbebe3d2a9b82dbcd35af36584a36fd9fe/docx.py#L1031-L1049
8,108
saltstack/salt
salt/state.py
State.reconcile_extend
def reconcile_extend(self, high): ''' Pull the extend data and add it to the respective high data ''' errors = [] if '__extend__' not in high: return high, errors ext = high.pop('__extend__') for ext_chunk in ext: for name, body in six.iter...
python
def reconcile_extend(self, high): ''' Pull the extend data and add it to the respective high data ''' errors = [] if '__extend__' not in high: return high, errors ext = high.pop('__extend__') for ext_chunk in ext: for name, body in six.iter...
['def', 'reconcile_extend', '(', 'self', ',', 'high', ')', ':', 'errors', '=', '[', ']', 'if', "'__extend__'", 'not', 'in', 'high', ':', 'return', 'high', ',', 'errors', 'ext', '=', 'high', '.', 'pop', '(', "'__extend__'", ')', 'for', 'ext_chunk', 'in', 'ext', ':', 'for', 'name', ',', 'body', 'in', 'six', '.', 'iterite...
Pull the extend data and add it to the respective high data
['Pull', 'the', 'extend', 'data', 'and', 'add', 'it', 'to', 'the', 'respective', 'high', 'data']
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/state.py#L1454-L1520
8,109
rwl/pylon
pylon/util.py
format_from_extension
def format_from_extension(fname): """ Tries to infer a protocol from the file extension.""" _base, ext = os.path.splitext(fname) if not ext: return None try: format = known_extensions[ext.replace('.', '')] except KeyError: format = None return format
python
def format_from_extension(fname): """ Tries to infer a protocol from the file extension.""" _base, ext = os.path.splitext(fname) if not ext: return None try: format = known_extensions[ext.replace('.', '')] except KeyError: format = None return format
['def', 'format_from_extension', '(', 'fname', ')', ':', '_base', ',', 'ext', '=', 'os', '.', 'path', '.', 'splitext', '(', 'fname', ')', 'if', 'not', 'ext', ':', 'return', 'None', 'try', ':', 'format', '=', 'known_extensions', '[', 'ext', '.', 'replace', '(', "'.'", ',', "''", ')', ']', 'except', 'KeyError', ':', 'for...
Tries to infer a protocol from the file extension.
['Tries', 'to', 'infer', 'a', 'protocol', 'from', 'the', 'file', 'extension', '.']
train
https://github.com/rwl/pylon/blob/916514255db1ae1661406f0283df756baf960d14/pylon/util.py#L159-L168
8,110
zhmcclient/python-zhmcclient
zhmcclient_mock/_urihandler.py
StorageGroupAddCandidatePortsHandler.post
def post(method, hmc, uri, uri_parms, body, logon_required, wait_for_completion): """Operation: Add Candidate Adapter Ports to an FCP Storage Group.""" assert wait_for_completion is True # async not supported yet # The URI is a POST operation, so we need to construct the SG URI ...
python
def post(method, hmc, uri, uri_parms, body, logon_required, wait_for_completion): """Operation: Add Candidate Adapter Ports to an FCP Storage Group.""" assert wait_for_completion is True # async not supported yet # The URI is a POST operation, so we need to construct the SG URI ...
['def', 'post', '(', 'method', ',', 'hmc', ',', 'uri', ',', 'uri_parms', ',', 'body', ',', 'logon_required', ',', 'wait_for_completion', ')', ':', 'assert', 'wait_for_completion', 'is', 'True', '# async not supported yet', '# The URI is a POST operation, so we need to construct the SG URI', 'storage_group_oid', '=', 'u...
Operation: Add Candidate Adapter Ports to an FCP Storage Group.
['Operation', ':', 'Add', 'Candidate', 'Adapter', 'Ports', 'to', 'an', 'FCP', 'Storage', 'Group', '.']
train
https://github.com/zhmcclient/python-zhmcclient/blob/9657563e5d9184c51d3c903442a58b9725fdf335/zhmcclient_mock/_urihandler.py#L2226-L2252
8,111
yougov/pmxbot
pmxbot/core.py
Handler.find_matching
def find_matching(cls, message, channel): """ Yield ``cls`` subclasses that match message and channel """ return ( handler for handler in cls._registry if isinstance(handler, cls) and handler.match(message, channel) )
python
def find_matching(cls, message, channel): """ Yield ``cls`` subclasses that match message and channel """ return ( handler for handler in cls._registry if isinstance(handler, cls) and handler.match(message, channel) )
['def', 'find_matching', '(', 'cls', ',', 'message', ',', 'channel', ')', ':', 'return', '(', 'handler', 'for', 'handler', 'in', 'cls', '.', '_registry', 'if', 'isinstance', '(', 'handler', ',', 'cls', ')', 'and', 'handler', '.', 'match', '(', 'message', ',', 'channel', ')', ')']
Yield ``cls`` subclasses that match message and channel
['Yield', 'cls', 'subclasses', 'that', 'match', 'message', 'and', 'channel']
train
https://github.com/yougov/pmxbot/blob/5da84a3258a0fd73cb35b60e39769a5d7bfb2ba7/pmxbot/core.py#L145-L154
8,112
estnltk/estnltk
estnltk/text.py
Text.spelling
def spelling(self): """Flag incorrectly spelled words. Returns a list of booleans, where element at each position denotes, if the word at the same position is spelled correctly. """ if not self.is_tagged(WORDS): self.tokenize_words() return [data[SPELLING] for...
python
def spelling(self): """Flag incorrectly spelled words. Returns a list of booleans, where element at each position denotes, if the word at the same position is spelled correctly. """ if not self.is_tagged(WORDS): self.tokenize_words() return [data[SPELLING] for...
['def', 'spelling', '(', 'self', ')', ':', 'if', 'not', 'self', '.', 'is_tagged', '(', 'WORDS', ')', ':', 'self', '.', 'tokenize_words', '(', ')', 'return', '[', 'data', '[', 'SPELLING', ']', 'for', 'data', 'in', 'vabamorf', '.', 'spellcheck', '(', 'self', '.', 'word_texts', ',', 'suggestions', '=', 'False', ')', ']']
Flag incorrectly spelled words. Returns a list of booleans, where element at each position denotes, if the word at the same position is spelled correctly.
['Flag', 'incorrectly', 'spelled', 'words', '.', 'Returns', 'a', 'list', 'of', 'booleans', 'where', 'element', 'at', 'each', 'position', 'denotes', 'if', 'the', 'word', 'at', 'the', 'same', 'position', 'is', 'spelled', 'correctly', '.']
train
https://github.com/estnltk/estnltk/blob/28ae334a68a0673072febc318635f04da0dcc54a/estnltk/text.py#L1163-L1170
8,113
silver-castle/mach9
mach9/response.py
redirect
def redirect(to, headers=None, status=302, content_type='text/html; charset=utf-8'): '''Abort execution and cause a 302 redirect (by default). :param to: path or fully qualified URL to redirect to :param headers: optional dict of headers to include in the new request :param status: status ...
python
def redirect(to, headers=None, status=302, content_type='text/html; charset=utf-8'): '''Abort execution and cause a 302 redirect (by default). :param to: path or fully qualified URL to redirect to :param headers: optional dict of headers to include in the new request :param status: status ...
['def', 'redirect', '(', 'to', ',', 'headers', '=', 'None', ',', 'status', '=', '302', ',', 'content_type', '=', "'text/html; charset=utf-8'", ')', ':', 'headers', '=', 'headers', 'or', '{', '}', '# According to RFC 7231, a relative URI is now permitted.', 'headers', '[', "'Location'", ']', '=', 'to', 'return', 'HTTPRe...
Abort execution and cause a 302 redirect (by default). :param to: path or fully qualified URL to redirect to :param headers: optional dict of headers to include in the new request :param status: status code (int) of the new request, defaults to 302 :param content_type: the content type (string) of the ...
['Abort', 'execution', 'and', 'cause', 'a', '302', 'redirect', '(', 'by', 'default', ')', '.']
train
https://github.com/silver-castle/mach9/blob/7a623aab3c70d89d36ade6901b6307e115400c5e/mach9/response.py#L376-L394
8,114
etingof/pysnmp
pysnmp/smi/builder.py
MibBuilder.loadModules
def loadModules(self, *modNames, **userCtx): """Load (optionally, compiling) pysnmp MIB modules""" # Build a list of available modules if not modNames: modNames = {} for mibSource in self._mibSources: for modName in mibSource.listdir(): ...
python
def loadModules(self, *modNames, **userCtx): """Load (optionally, compiling) pysnmp MIB modules""" # Build a list of available modules if not modNames: modNames = {} for mibSource in self._mibSources: for modName in mibSource.listdir(): ...
['def', 'loadModules', '(', 'self', ',', '*', 'modNames', ',', '*', '*', 'userCtx', ')', ':', '# Build a list of available modules', 'if', 'not', 'modNames', ':', 'modNames', '=', '{', '}', 'for', 'mibSource', 'in', 'self', '.', '_mibSources', ':', 'for', 'modName', 'in', 'mibSource', '.', 'listdir', '(', ')', ':', 'mo...
Load (optionally, compiling) pysnmp MIB modules
['Load', '(', 'optionally', 'compiling', ')', 'pysnmp', 'MIB', 'modules']
train
https://github.com/etingof/pysnmp/blob/cde062dd42f67dfd2d7686286a322d40e9c3a4b7/pysnmp/smi/builder.py#L409-L450
8,115
RudolfCardinal/pythonlib
cardinal_pythonlib/dicts.py
merge_two_dicts
def merge_two_dicts(x: Dict, y: Dict) -> Dict: """ Given two dicts, merge them into a new dict as a shallow copy, e.g. .. code-block:: python z = merge_two_dicts(x, y) If you can guarantee Python 3.5, then a simpler syntax is: .. code-block:: python z = {**x, **y} See http:...
python
def merge_two_dicts(x: Dict, y: Dict) -> Dict: """ Given two dicts, merge them into a new dict as a shallow copy, e.g. .. code-block:: python z = merge_two_dicts(x, y) If you can guarantee Python 3.5, then a simpler syntax is: .. code-block:: python z = {**x, **y} See http:...
['def', 'merge_two_dicts', '(', 'x', ':', 'Dict', ',', 'y', ':', 'Dict', ')', '->', 'Dict', ':', 'z', '=', 'x', '.', 'copy', '(', ')', 'z', '.', 'update', '(', 'y', ')', 'return', 'z']
Given two dicts, merge them into a new dict as a shallow copy, e.g. .. code-block:: python z = merge_two_dicts(x, y) If you can guarantee Python 3.5, then a simpler syntax is: .. code-block:: python z = {**x, **y} See http://stackoverflow.com/questions/38987.
['Given', 'two', 'dicts', 'merge', 'them', 'into', 'a', 'new', 'dict', 'as', 'a', 'shallow', 'copy', 'e', '.', 'g', '.']
train
https://github.com/RudolfCardinal/pythonlib/blob/0b84cb35f38bd7d8723958dae51b480a829b7227/cardinal_pythonlib/dicts.py#L60-L78
8,116
petl-developers/petl
petl/util/counting.py
parsecounter
def parsecounter(table, field, parsers=(('int', int), ('float', float))): """ Count the number of `str` or `unicode` values under the given fields that can be parsed as ints, floats or via custom parser functions. Return a pair of `Counter` objects, the first mapping parser names to the number of st...
python
def parsecounter(table, field, parsers=(('int', int), ('float', float))): """ Count the number of `str` or `unicode` values under the given fields that can be parsed as ints, floats or via custom parser functions. Return a pair of `Counter` objects, the first mapping parser names to the number of st...
['def', 'parsecounter', '(', 'table', ',', 'field', ',', 'parsers', '=', '(', '(', "'int'", ',', 'int', ')', ',', '(', "'float'", ',', 'float', ')', ')', ')', ':', 'if', 'isinstance', '(', 'parsers', ',', '(', 'list', ',', 'tuple', ')', ')', ':', 'parsers', '=', 'dict', '(', 'parsers', ')', 'counter', ',', 'errors', '=...
Count the number of `str` or `unicode` values under the given fields that can be parsed as ints, floats or via custom parser functions. Return a pair of `Counter` objects, the first mapping parser names to the number of strings successfully parsed, the second mapping parser names to the number of errors...
['Count', 'the', 'number', 'of', 'str', 'or', 'unicode', 'values', 'under', 'the', 'given', 'fields', 'that', 'can', 'be', 'parsed', 'as', 'ints', 'floats', 'or', 'via', 'custom', 'parser', 'functions', '.', 'Return', 'a', 'pair', 'of', 'Counter', 'objects', 'the', 'first', 'mapping', 'parser', 'names', 'to', 'the', 'n...
train
https://github.com/petl-developers/petl/blob/1d33ca055f7e04e0d28a772041c9fd30c8d415d6/petl/util/counting.py#L165-L206
8,117
quantopian/trading_calendars
trading_calendars/calendar_utils.py
TradingCalendarDispatcher.register_calendar_alias
def register_calendar_alias(self, alias, real_name, force=False): """ Register an alias for a calendar. This is useful when multiple exchanges should share a calendar, or when there are multiple ways to refer to the same exchange. After calling ``register_alias('alias', 'real_n...
python
def register_calendar_alias(self, alias, real_name, force=False): """ Register an alias for a calendar. This is useful when multiple exchanges should share a calendar, or when there are multiple ways to refer to the same exchange. After calling ``register_alias('alias', 'real_n...
['def', 'register_calendar_alias', '(', 'self', ',', 'alias', ',', 'real_name', ',', 'force', '=', 'False', ')', ':', 'if', 'force', ':', 'self', '.', 'deregister_calendar', '(', 'alias', ')', 'if', 'self', '.', 'has_calendar', '(', 'alias', ')', ':', 'raise', 'CalendarNameCollision', '(', 'calendar_name', '=', 'alias'...
Register an alias for a calendar. This is useful when multiple exchanges should share a calendar, or when there are multiple ways to refer to the same exchange. After calling ``register_alias('alias', 'real_name')``, subsequent calls to ``get_calendar('alias')`` will return the same re...
['Register', 'an', 'alias', 'for', 'a', 'calendar', '.']
train
https://github.com/quantopian/trading_calendars/blob/951711c82c8a2875c09e96e2979faaf8734fb4df/trading_calendars/calendar_utils.py#L219-L255
8,118
aquatix/ns-api
ns_api.py
list_same
def list_same(list_a, list_b): """ Return the items from list_b that are also on list_a """ result = [] for item in list_b: if item in list_a: result.append(item) return result
python
def list_same(list_a, list_b): """ Return the items from list_b that are also on list_a """ result = [] for item in list_b: if item in list_a: result.append(item) return result
['def', 'list_same', '(', 'list_a', ',', 'list_b', ')', ':', 'result', '=', '[', ']', 'for', 'item', 'in', 'list_b', ':', 'if', 'item', 'in', 'list_a', ':', 'result', '.', 'append', '(', 'item', ')', 'return', 'result']
Return the items from list_b that are also on list_a
['Return', 'the', 'items', 'from', 'list_b', 'that', 'are', 'also', 'on', 'list_a']
train
https://github.com/aquatix/ns-api/blob/9b3379f8df6217132f457c4363457c16321c2448/ns_api.py#L137-L145
8,119
lsbardel/python-stdnet
stdnet/odm/related.py
do_pending_lookups
def do_pending_lookups(event, sender, **kwargs): """Handle any pending relations to the sending model. Sent from class_prepared.""" key = (sender._meta.app_label, sender._meta.name) for callback in pending_lookups.pop(key, []): callback(sender)
python
def do_pending_lookups(event, sender, **kwargs): """Handle any pending relations to the sending model. Sent from class_prepared.""" key = (sender._meta.app_label, sender._meta.name) for callback in pending_lookups.pop(key, []): callback(sender)
['def', 'do_pending_lookups', '(', 'event', ',', 'sender', ',', '*', '*', 'kwargs', ')', ':', 'key', '=', '(', 'sender', '.', '_meta', '.', 'app_label', ',', 'sender', '.', '_meta', '.', 'name', ')', 'for', 'callback', 'in', 'pending_lookups', '.', 'pop', '(', 'key', ',', '[', ']', ')', ':', 'callback', '(', 'sender', ...
Handle any pending relations to the sending model. Sent from class_prepared.
['Handle', 'any', 'pending', 'relations', 'to', 'the', 'sending', 'model', '.', 'Sent', 'from', 'class_prepared', '.']
train
https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/odm/related.py#L66-L71
8,120
AnthonyBloomer/daftlistings
daftlistings/listing.py
Listing.dwelling_type
def dwelling_type(self): """ This method returns the dwelling type. :return: """ try: if self._data_from_search: info = self._data_from_search.find( 'ul', {"class": "info"}).text s = info.split('|') r...
python
def dwelling_type(self): """ This method returns the dwelling type. :return: """ try: if self._data_from_search: info = self._data_from_search.find( 'ul', {"class": "info"}).text s = info.split('|') r...
['def', 'dwelling_type', '(', 'self', ')', ':', 'try', ':', 'if', 'self', '.', '_data_from_search', ':', 'info', '=', 'self', '.', '_data_from_search', '.', 'find', '(', "'ul'", ',', '{', '"class"', ':', '"info"', '}', ')', '.', 'text', 's', '=', 'info', '.', 'split', '(', "'|'", ')', 'return', 's', '[', '0', ']', '.',...
This method returns the dwelling type. :return:
['This', 'method', 'returns', 'the', 'dwelling', 'type', '.', ':', 'return', ':']
train
https://github.com/AnthonyBloomer/daftlistings/blob/f6c1b52425bc740f443b5efe6632a4bf18ee997f/daftlistings/listing.py#L437-L457
8,121
odlgroup/odl
odl/contrib/mrc/uncompr_bin.py
FileReaderRawBinaryWithHeader.read_data
def read_data(self, dstart=None, dend=None): """Read data from `file` and return it as Numpy array. Parameters ---------- dstart : int, optional Offset in bytes of the data field. By default, it is taken to be the header size as determined from reading the header...
python
def read_data(self, dstart=None, dend=None): """Read data from `file` and return it as Numpy array. Parameters ---------- dstart : int, optional Offset in bytes of the data field. By default, it is taken to be the header size as determined from reading the header...
['def', 'read_data', '(', 'self', ',', 'dstart', '=', 'None', ',', 'dend', '=', 'None', ')', ':', 'self', '.', 'file', '.', 'seek', '(', '0', ',', '2', ')', '# 2 means "from the end"', 'filesize_bytes', '=', 'self', '.', 'file', '.', 'tell', '(', ')', 'if', 'dstart', 'is', 'None', ':', 'dstart_abs', '=', 'int', '(', 's...
Read data from `file` and return it as Numpy array. Parameters ---------- dstart : int, optional Offset in bytes of the data field. By default, it is taken to be the header size as determined from reading the header. Backwards indexing with negative values is...
['Read', 'data', 'from', 'file', 'and', 'return', 'it', 'as', 'Numpy', 'array', '.']
train
https://github.com/odlgroup/odl/blob/b8443f6aca90e191ba36c91d32253c5a36249a6c/odl/contrib/mrc/uncompr_bin.py#L463-L526
8,122
markchil/gptools
gptools/utils.py
fixed_poch
def fixed_poch(a, n): """Implementation of the Pochhammer symbol :math:`(a)_n` which handles negative integer arguments properly. Need conditional statement because scipy's impelementation of the Pochhammer symbol is wrong for negative integer arguments. This function uses the definition from h...
python
def fixed_poch(a, n): """Implementation of the Pochhammer symbol :math:`(a)_n` which handles negative integer arguments properly. Need conditional statement because scipy's impelementation of the Pochhammer symbol is wrong for negative integer arguments. This function uses the definition from h...
['def', 'fixed_poch', '(', 'a', ',', 'n', ')', ':', '# Old form, calls gamma function:', '# if a < 0.0 and a % 1 == 0 and n <= -a:', '# p = (-1.0)**n * scipy.misc.factorial(-a) / scipy.misc.factorial(-a - n)', '# else:', '# p = scipy.special.poch(a, n)', '# return p', 'if', '(', 'int', '(', 'n', ')', '!=', 'n',...
Implementation of the Pochhammer symbol :math:`(a)_n` which handles negative integer arguments properly. Need conditional statement because scipy's impelementation of the Pochhammer symbol is wrong for negative integer arguments. This function uses the definition from http://functions.wolfram.com/G...
['Implementation', 'of', 'the', 'Pochhammer', 'symbol', ':', 'math', ':', '(', 'a', ')', '_n', 'which', 'handles', 'negative', 'integer', 'arguments', 'properly', '.', 'Need', 'conditional', 'statement', 'because', 'scipy', 's', 'impelementation', 'of', 'the', 'Pochhammer', 'symbol', 'is', 'wrong', 'for', 'negative', '...
train
https://github.com/markchil/gptools/blob/225db52bfe6baef1516529ad22177aa2cf7b71e4/gptools/utils.py#L1369-L1395
8,123
apple/turicreate
src/external/xgboost/subtree/rabit/tracker/rabit_demo.py
mthread_submit
def mthread_submit(nslave, worker_args, worker_envs): """ customized submit script, that submit nslave jobs, each must contain args as parameter note this can be a lambda function containing additional parameters in input Parameters nslave number of slave process to start up args...
python
def mthread_submit(nslave, worker_args, worker_envs): """ customized submit script, that submit nslave jobs, each must contain args as parameter note this can be a lambda function containing additional parameters in input Parameters nslave number of slave process to start up args...
['def', 'mthread_submit', '(', 'nslave', ',', 'worker_args', ',', 'worker_envs', ')', ':', 'procs', '=', '{', '}', 'for', 'i', 'in', 'range', '(', 'nslave', ')', ':', 'procs', '[', 'i', ']', '=', 'Thread', '(', 'target', '=', 'exec_cmd', ',', 'args', '=', '(', 'args', '.', 'command', '+', 'worker_args', ',', 'i', ',', ...
customized submit script, that submit nslave jobs, each must contain args as parameter note this can be a lambda function containing additional parameters in input Parameters nslave number of slave process to start up args arguments to launch each job this usually includes th...
['customized', 'submit', 'script', 'that', 'submit', 'nslave', 'jobs', 'each', 'must', 'contain', 'args', 'as', 'parameter', 'note', 'this', 'can', 'be', 'a', 'lambda', 'function', 'containing', 'additional', 'parameters', 'in', 'input', 'Parameters', 'nslave', 'number', 'of', 'slave', 'process', 'to', 'start', 'up', '...
train
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/xgboost/subtree/rabit/tracker/rabit_demo.py#L78-L93
8,124
saltstack/salt
salt/client/ssh/shell.py
Shell._run_cmd
def _run_cmd(self, cmd, key_accept=False, passwd_retries=3): ''' Execute a shell command via VT. This is blocking and assumes that ssh is being run ''' if not cmd: return '', 'No command or passphrase', 245 term = salt.utils.vt.Terminal( cmd, ...
python
def _run_cmd(self, cmd, key_accept=False, passwd_retries=3): ''' Execute a shell command via VT. This is blocking and assumes that ssh is being run ''' if not cmd: return '', 'No command or passphrase', 245 term = salt.utils.vt.Terminal( cmd, ...
['def', '_run_cmd', '(', 'self', ',', 'cmd', ',', 'key_accept', '=', 'False', ',', 'passwd_retries', '=', '3', ')', ':', 'if', 'not', 'cmd', ':', 'return', "''", ',', "'No command or passphrase'", ',', '245', 'term', '=', 'salt', '.', 'utils', '.', 'vt', '.', 'Terminal', '(', 'cmd', ',', 'shell', '=', 'True', ',', 'log...
Execute a shell command via VT. This is blocking and assumes that ssh is being run
['Execute', 'a', 'shell', 'command', 'via', 'VT', '.', 'This', 'is', 'blocking', 'and', 'assumes', 'that', 'ssh', 'is', 'being', 'run']
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/client/ssh/shell.py#L372-L441
8,125
SmartTeleMax/iktomi
iktomi/templates/__init__.py
BoundTemplate.render
def render(self, template_name, __data=None, **kw): '''Given a template name and template data. Renders a template and returns as string''' return self.template.render(template_name, **self._vars(__data, **kw))
python
def render(self, template_name, __data=None, **kw): '''Given a template name and template data. Renders a template and returns as string''' return self.template.render(template_name, **self._vars(__data, **kw))
['def', 'render', '(', 'self', ',', 'template_name', ',', '__data', '=', 'None', ',', '*', '*', 'kw', ')', ':', 'return', 'self', '.', 'template', '.', 'render', '(', 'template_name', ',', '*', '*', 'self', '.', '_vars', '(', '__data', ',', '*', '*', 'kw', ')', ')']
Given a template name and template data. Renders a template and returns as string
['Given', 'a', 'template', 'name', 'and', 'template', 'data', '.', 'Renders', 'a', 'template', 'and', 'returns', 'as', 'string']
train
https://github.com/SmartTeleMax/iktomi/blob/80bc0f1408d63efe7f5844367d1f6efba44b35f2/iktomi/templates/__init__.py#L100-L104
8,126
bitesofcode/projexui
projexui/widgets/xscintillaedit/xscintillaedit.py
XScintillaEdit.removeComments
def removeComments( self, comment = None ): """ Inserts comments into the editor based on the current selection.\ If no comment string is supplied, then the comment from the language \ will be used. :param comment | <str> || None :return <bool> ...
python
def removeComments( self, comment = None ): """ Inserts comments into the editor based on the current selection.\ If no comment string is supplied, then the comment from the language \ will be used. :param comment | <str> || None :return <bool> ...
['def', 'removeComments', '(', 'self', ',', 'comment', '=', 'None', ')', ':', 'if', '(', 'not', 'comment', ')', ':', 'lang', '=', 'self', '.', 'language', '(', ')', 'if', '(', 'lang', ')', ':', 'comment', '=', 'lang', '.', 'lineComment', '(', ')', 'if', '(', 'not', 'comment', ')', ':', 'return', 'False', 'startline', '...
Inserts comments into the editor based on the current selection.\ If no comment string is supplied, then the comment from the language \ will be used. :param comment | <str> || None :return <bool> | success
['Inserts', 'comments', 'into', 'the', 'editor', 'based', 'on', 'the', 'current', 'selection', '.', '\\', 'If', 'no', 'comment', 'string', 'is', 'supplied', 'then', 'the', 'comment', 'from', 'the', 'language', '\\', 'will', 'be', 'used', '.', ':', 'param', 'comment', '|', '<str', '>', '||', 'None', ':', 'return', '<boo...
train
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xscintillaedit/xscintillaedit.py#L448-L478
8,127
globocom/GloboNetworkAPI-client-python
networkapiclient/Ip.py
Ip.find_ip6_by_network
def find_ip6_by_network(self, id_network): """List IPv6 from network. :param id_network: Network ipv6 identifier. Integer value and greater than zero. :return: Dictionary with the following structure: :: {'ip': {'id': < id >, 'id_vlan': < id_vlan >, ...
python
def find_ip6_by_network(self, id_network): """List IPv6 from network. :param id_network: Network ipv6 identifier. Integer value and greater than zero. :return: Dictionary with the following structure: :: {'ip': {'id': < id >, 'id_vlan': < id_vlan >, ...
['def', 'find_ip6_by_network', '(', 'self', ',', 'id_network', ')', ':', 'if', 'not', 'is_valid_int_param', '(', 'id_network', ')', ':', 'raise', 'InvalidParameterError', '(', "u'Network identifier is invalid or was not informed.'", ')', 'url', '=', "'ip/id_network_ipv6/'", '+', 'str', '(', 'id_network', ')', '+', '"/"...
List IPv6 from network. :param id_network: Network ipv6 identifier. Integer value and greater than zero. :return: Dictionary with the following structure: :: {'ip': {'id': < id >, 'id_vlan': < id_vlan >, 'block1': <block1>, 'block2': <block2>, ...
['List', 'IPv6', 'from', 'network', '.']
train
https://github.com/globocom/GloboNetworkAPI-client-python/blob/cf34f913da48d9abbf750114f5d2ac4b2dde137d/networkapiclient/Ip.py#L743-L779
8,128
explosion/thinc
thinc/api.py
split_backward
def split_backward(layers): # pragma: no cover """Separate a sequence of layers' `begin_update` methods into two lists of functions: one that computes the forward values, and the other that completes the backward pass. The backward sequence is only populated after the forward functions have been applie...
python
def split_backward(layers): # pragma: no cover """Separate a sequence of layers' `begin_update` methods into two lists of functions: one that computes the forward values, and the other that completes the backward pass. The backward sequence is only populated after the forward functions have been applie...
['def', 'split_backward', '(', 'layers', ')', ':', '# pragma: no cover', 'backward', '=', '[', ']', 'forward', '=', '[', 'sink_return', '(', 'op', '.', 'begin_update', ',', 'backward', '.', 'append', ')', 'for', 'op', 'in', 'layers', ']', 'return', 'forward', ',', 'backward']
Separate a sequence of layers' `begin_update` methods into two lists of functions: one that computes the forward values, and the other that completes the backward pass. The backward sequence is only populated after the forward functions have been applied.
['Separate', 'a', 'sequence', 'of', 'layers', 'begin_update', 'methods', 'into', 'two', 'lists', 'of', 'functions', ':', 'one', 'that', 'computes', 'the', 'forward', 'values', 'and', 'the', 'other', 'that', 'completes', 'the', 'backward', 'pass', '.', 'The', 'backward', 'sequence', 'is', 'only', 'populated', 'after', '...
train
https://github.com/explosion/thinc/blob/90129be5f0d6c665344245a7c37dbe1b8afceea2/thinc/api.py#L208-L216
8,129
RiotGames/cloud-inquisitor
backend/cloud_inquisitor/plugins/types/resources.py
EC2Instance.update
def update(self, data): """Updates the object information based on live data, if there were any changes made. Any changes will be automatically applied to the object, but will not be automatically persisted. You must manually call `db.session.add(instance)` on the object. Args: ...
python
def update(self, data): """Updates the object information based on live data, if there were any changes made. Any changes will be automatically applied to the object, but will not be automatically persisted. You must manually call `db.session.add(instance)` on the object. Args: ...
['def', 'update', '(', 'self', ',', 'data', ')', ':', '# If the instance was terminated, remove it', 'if', 'data', '.', 'state', '[', "'Name'", ']', '==', "'terminated'", ':', 'self', '.', 'delete', '(', 'auto_commit', '=', 'False', ')', 'return', 'True', 'updated', '=', 'self', '.', 'set_property', '(', "'launch_date'...
Updates the object information based on live data, if there were any changes made. Any changes will be automatically applied to the object, but will not be automatically persisted. You must manually call `db.session.add(instance)` on the object. Args: data (:obj:): AWS API Resource ...
['Updates', 'the', 'object', 'information', 'based', 'on', 'live', 'data', 'if', 'there', 'were', 'any', 'changes', 'made', '.', 'Any', 'changes', 'will', 'be', 'automatically', 'applied', 'to', 'the', 'object', 'but', 'will', 'not', 'be', 'automatically', 'persisted', '.', 'You', 'must', 'manually', 'call', 'db', '.',...
train
https://github.com/RiotGames/cloud-inquisitor/blob/181dc2566ca59fc855f695b7fcc2c3b934e6ee9f/backend/cloud_inquisitor/plugins/types/resources.py#L599-L633
8,130
ampl/amplpy
amplpy/dataframe.py
DataFrame.toDict
def toDict(self): """ Return a dictionary with the DataFrame data. """ d = {} nindices = self.getNumIndices() for i in range(self.getNumRows()): row = list(self.getRowByIndex(i)) if nindices > 1: key = tuple(row[:nindices]) ...
python
def toDict(self): """ Return a dictionary with the DataFrame data. """ d = {} nindices = self.getNumIndices() for i in range(self.getNumRows()): row = list(self.getRowByIndex(i)) if nindices > 1: key = tuple(row[:nindices]) ...
['def', 'toDict', '(', 'self', ')', ':', 'd', '=', '{', '}', 'nindices', '=', 'self', '.', 'getNumIndices', '(', ')', 'for', 'i', 'in', 'range', '(', 'self', '.', 'getNumRows', '(', ')', ')', ':', 'row', '=', 'list', '(', 'self', '.', 'getRowByIndex', '(', 'i', ')', ')', 'if', 'nindices', '>', '1', ':', 'key', '=', 'tu...
Return a dictionary with the DataFrame data.
['Return', 'a', 'dictionary', 'with', 'the', 'DataFrame', 'data', '.']
train
https://github.com/ampl/amplpy/blob/39df6954049a11a8f666aed26853259b4687099a/amplpy/dataframe.py#L276-L296
8,131
fermiPy/fermipy
fermipy/spectrum.py
SpectralFunction.ednde_deriv
def ednde_deriv(self, x, params=None): """Evaluate derivative of E times differential flux with respect to E.""" params = self.params if params is None else params return np.squeeze(self.eval_ednde_deriv(x, params, self.scale, self.extra_pa...
python
def ednde_deriv(self, x, params=None): """Evaluate derivative of E times differential flux with respect to E.""" params = self.params if params is None else params return np.squeeze(self.eval_ednde_deriv(x, params, self.scale, self.extra_pa...
['def', 'ednde_deriv', '(', 'self', ',', 'x', ',', 'params', '=', 'None', ')', ':', 'params', '=', 'self', '.', 'params', 'if', 'params', 'is', 'None', 'else', 'params', 'return', 'np', '.', 'squeeze', '(', 'self', '.', 'eval_ednde_deriv', '(', 'x', ',', 'params', ',', 'self', '.', 'scale', ',', 'self', '.', 'extra_par...
Evaluate derivative of E times differential flux with respect to E.
['Evaluate', 'derivative', 'of', 'E', 'times', 'differential', 'flux', 'with', 'respect', 'to', 'E', '.']
train
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/spectrum.py#L294-L299
8,132
openstack/horizon
openstack_dashboard/api/neutron.py
FloatingIpManager.allocate
def allocate(self, pool, tenant_id=None, **params): """Allocates a floating IP to the tenant. You must provide a pool name or id for which you would like to allocate a floating IP. :returns: FloatingIp object corresponding to an allocated floating IP """ if not tenant_i...
python
def allocate(self, pool, tenant_id=None, **params): """Allocates a floating IP to the tenant. You must provide a pool name or id for which you would like to allocate a floating IP. :returns: FloatingIp object corresponding to an allocated floating IP """ if not tenant_i...
['def', 'allocate', '(', 'self', ',', 'pool', ',', 'tenant_id', '=', 'None', ',', '*', '*', 'params', ')', ':', 'if', 'not', 'tenant_id', ':', 'tenant_id', '=', 'self', '.', 'request', '.', 'user', '.', 'project_id', 'create_dict', '=', '{', "'floating_network_id'", ':', 'pool', ',', "'tenant_id'", ':', 'tenant_id', '}...
Allocates a floating IP to the tenant. You must provide a pool name or id for which you would like to allocate a floating IP. :returns: FloatingIp object corresponding to an allocated floating IP
['Allocates', 'a', 'floating', 'IP', 'to', 'the', 'tenant', '.']
train
https://github.com/openstack/horizon/blob/5601ea9477323e599d9b766fcac1f8be742935b2/openstack_dashboard/api/neutron.py#L615-L640
8,133
horazont/aioopenssl
aioopenssl/__init__.py
STARTTLSTransport.starttls
def starttls(self, ssl_context=None, post_handshake_callback=None): """ Start a TLS stream on top of the socket. This is an invalid operation if the stream is not in RAW_OPEN state. If `ssl_context` is set, it overrides the `ssl_context` passed to the constructo...
python
def starttls(self, ssl_context=None, post_handshake_callback=None): """ Start a TLS stream on top of the socket. This is an invalid operation if the stream is not in RAW_OPEN state. If `ssl_context` is set, it overrides the `ssl_context` passed to the constructo...
['def', 'starttls', '(', 'self', ',', 'ssl_context', '=', 'None', ',', 'post_handshake_callback', '=', 'None', ')', ':', 'if', 'self', '.', '_state', '!=', '_State', '.', 'RAW_OPEN', 'or', 'self', '.', '_closing', ':', 'raise', 'self', '.', '_invalid_state', '(', '"starttls() called"', ')', 'if', 'ssl_context', 'is', '...
Start a TLS stream on top of the socket. This is an invalid operation if the stream is not in RAW_OPEN state. If `ssl_context` is set, it overrides the `ssl_context` passed to the constructor. If `post_handshake_callback` is set, it overrides the `post_handshake_callback` passed to the ...
['Start', 'a', 'TLS', 'stream', 'on', 'top', 'of', 'the', 'socket', '.', 'This', 'is', 'an', 'invalid', 'operation', 'if', 'the', 'stream', 'is', 'not', 'in', 'RAW_OPEN', 'state', '.']
train
https://github.com/horazont/aioopenssl/blob/95cb39b5904d6a9702afcef6704181c850371081/aioopenssl/__init__.py#L649-L685
8,134
inasafe/inasafe
safe/common/parameters/default_select_parameter_widget.py
DefaultSelectParameterWidget.enable_radio_button
def enable_radio_button(self): """Enable radio button and custom value input area then set selected radio button to 'Do not report'. """ for button in self.default_input_button_group.buttons(): button.setEnabled(True) self.set_selected_radio_button() self.cust...
python
def enable_radio_button(self): """Enable radio button and custom value input area then set selected radio button to 'Do not report'. """ for button in self.default_input_button_group.buttons(): button.setEnabled(True) self.set_selected_radio_button() self.cust...
['def', 'enable_radio_button', '(', 'self', ')', ':', 'for', 'button', 'in', 'self', '.', 'default_input_button_group', '.', 'buttons', '(', ')', ':', 'button', '.', 'setEnabled', '(', 'True', ')', 'self', '.', 'set_selected_radio_button', '(', ')', 'self', '.', 'custom_value', '.', 'setEnabled', '(', 'True', ')']
Enable radio button and custom value input area then set selected radio button to 'Do not report'.
['Enable', 'radio', 'button', 'and', 'custom', 'value', 'input', 'area', 'then', 'set', 'selected', 'radio', 'button', 'to', 'Do', 'not', 'report', '.']
train
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/common/parameters/default_select_parameter_widget.py#L207-L214
8,135
StackStorm/pybind
pybind/slxos/v17r_1_01a/routing_system/router/router_bgp/address_family/ipv4/ipv4_unicast/af_vrf/neighbor/af_ipv4_vrf_neighbor_address_holder/af_ipv4_neighbor_addr/__init__.py
af_ipv4_neighbor_addr._set_advertisement_interval
def _set_advertisement_interval(self, v, load=False): """ Setter method for advertisement_interval, mapped from YANG variable /routing_system/router/router_bgp/address_family/ipv4/ipv4_unicast/af_vrf/neighbor/af_ipv4_vrf_neighbor_address_holder/af_ipv4_neighbor_addr/advertisement_interval (container) If thi...
python
def _set_advertisement_interval(self, v, load=False): """ Setter method for advertisement_interval, mapped from YANG variable /routing_system/router/router_bgp/address_family/ipv4/ipv4_unicast/af_vrf/neighbor/af_ipv4_vrf_neighbor_address_holder/af_ipv4_neighbor_addr/advertisement_interval (container) If thi...
['def', '_set_advertisement_interval', '(', 'self', ',', 'v', ',', 'load', '=', 'False', ')', ':', 'if', 'hasattr', '(', 'v', ',', '"_utype"', ')', ':', 'v', '=', 'v', '.', '_utype', '(', 'v', ')', 'try', ':', 't', '=', 'YANGDynClass', '(', 'v', ',', 'base', '=', 'advertisement_interval', '.', 'advertisement_interval',...
Setter method for advertisement_interval, mapped from YANG variable /routing_system/router/router_bgp/address_family/ipv4/ipv4_unicast/af_vrf/neighbor/af_ipv4_vrf_neighbor_address_holder/af_ipv4_neighbor_addr/advertisement_interval (container) If this variable is read-only (config: false) in the source YANG fil...
['Setter', 'method', 'for', 'advertisement_interval', 'mapped', 'from', 'YANG', 'variable', '/', 'routing_system', '/', 'router', '/', 'router_bgp', '/', 'address_family', '/', 'ipv4', '/', 'ipv4_unicast', '/', 'af_vrf', '/', 'neighbor', '/', 'af_ipv4_vrf_neighbor_address_holder', '/', 'af_ipv4_neighbor_addr', '/', 'ad...
train
https://github.com/StackStorm/pybind/blob/44c467e71b2b425be63867aba6e6fa28b2cfe7fb/pybind/slxos/v17r_1_01a/routing_system/router/router_bgp/address_family/ipv4/ipv4_unicast/af_vrf/neighbor/af_ipv4_vrf_neighbor_address_holder/af_ipv4_neighbor_addr/__init__.py#L780-L801
8,136
senaite/senaite.jsonapi
src/senaite/jsonapi/v1/routes/registry.py
get
def get(context, request, key=None): """Return all registry items if key is None, otherwise try to fetch the registry key """ registry_records = api.get_registry_records_by_keyword(key) # Prepare batch size = req.get_batch_size() start = req.get_batch_start() batch = api.make_batch(registry...
python
def get(context, request, key=None): """Return all registry items if key is None, otherwise try to fetch the registry key """ registry_records = api.get_registry_records_by_keyword(key) # Prepare batch size = req.get_batch_size() start = req.get_batch_start() batch = api.make_batch(registry...
['def', 'get', '(', 'context', ',', 'request', ',', 'key', '=', 'None', ')', ':', 'registry_records', '=', 'api', '.', 'get_registry_records_by_keyword', '(', 'key', ')', '# Prepare batch', 'size', '=', 'req', '.', 'get_batch_size', '(', ')', 'start', '=', 'req', '.', 'get_batch_start', '(', ')', 'batch', '=', 'api', '...
Return all registry items if key is None, otherwise try to fetch the registry key
['Return', 'all', 'registry', 'items', 'if', 'key', 'is', 'None', 'otherwise', 'try', 'to', 'fetch', 'the', 'registry', 'key']
train
https://github.com/senaite/senaite.jsonapi/blob/871959f4b1c9edbb477e9456325527ca78e13ec6/src/senaite/jsonapi/v1/routes/registry.py#L10-L29
8,137
honzajavorek/redis-collections
redis_collections/lists.py
List.extend
def extend(self, other): """ Adds the values from the iterable *other* to the end of this collection. """ def extend_trans(pipe): values = list(other.__iter__(pipe)) if use_redis else other len_self = pipe.rpush(self.key, *(self._pickle(v) for v in values)...
python
def extend(self, other): """ Adds the values from the iterable *other* to the end of this collection. """ def extend_trans(pipe): values = list(other.__iter__(pipe)) if use_redis else other len_self = pipe.rpush(self.key, *(self._pickle(v) for v in values)...
['def', 'extend', '(', 'self', ',', 'other', ')', ':', 'def', 'extend_trans', '(', 'pipe', ')', ':', 'values', '=', 'list', '(', 'other', '.', '__iter__', '(', 'pipe', ')', ')', 'if', 'use_redis', 'else', 'other', 'len_self', '=', 'pipe', '.', 'rpush', '(', 'self', '.', 'key', ',', '*', '(', 'self', '.', '_pickle', '('...
Adds the values from the iterable *other* to the end of this collection.
['Adds', 'the', 'values', 'from', 'the', 'iterable', '*', 'other', '*', 'to', 'the', 'end', 'of', 'this', 'collection', '.']
train
https://github.com/honzajavorek/redis-collections/blob/07ca8efe88fb128f7dc7319dfa6a26cd39b3776b/redis_collections/lists.py#L374-L391
8,138
gccxml/pygccxml
pygccxml/parser/directory_cache.py
filename_repository_t.update_id_counter
def update_id_counter(self): """Update the `id_` counter so that it doesn't grow forever. """ if not self.__entries: self.__next_id = 1 else: self.__next_id = max(self.__entries.keys()) + 1
python
def update_id_counter(self): """Update the `id_` counter so that it doesn't grow forever. """ if not self.__entries: self.__next_id = 1 else: self.__next_id = max(self.__entries.keys()) + 1
['def', 'update_id_counter', '(', 'self', ')', ':', 'if', 'not', 'self', '.', '__entries', ':', 'self', '.', '__next_id', '=', '1', 'else', ':', 'self', '.', '__next_id', '=', 'max', '(', 'self', '.', '__entries', '.', 'keys', '(', ')', ')', '+', '1']
Update the `id_` counter so that it doesn't grow forever.
['Update', 'the', 'id_', 'counter', 'so', 'that', 'it', 'doesn', 't', 'grow', 'forever', '.']
train
https://github.com/gccxml/pygccxml/blob/2b1efbb9e37ceb2ae925c7f3ce1570f476db9e1e/pygccxml/parser/directory_cache.py#L519-L526
8,139
lanius/tinyik
tinyik/optimizer.py
NewtonOptimizer.prepare
def prepare(self, f): """Accept an objective function for optimization.""" self.g = autograd.grad(f) self.h = autograd.hessian(f)
python
def prepare(self, f): """Accept an objective function for optimization.""" self.g = autograd.grad(f) self.h = autograd.hessian(f)
['def', 'prepare', '(', 'self', ',', 'f', ')', ':', 'self', '.', 'g', '=', 'autograd', '.', 'grad', '(', 'f', ')', 'self', '.', 'h', '=', 'autograd', '.', 'hessian', '(', 'f', ')']
Accept an objective function for optimization.
['Accept', 'an', 'objective', 'function', 'for', 'optimization', '.']
train
https://github.com/lanius/tinyik/blob/dffe5031ee044caf43e51746c4b0a6d45922d50e/tinyik/optimizer.py#L16-L19
8,140
konstantinstadler/pymrio
pymrio/core/mriosystem.py
IOSystem.report_accounts
def report_accounts(self, path, per_region=True, per_capita=False, pic_size=1000, format='rst', **kwargs): """ Generates a report to the given path for all extension This method calls .report_accounts for all extensions Notes ----- ...
python
def report_accounts(self, path, per_region=True, per_capita=False, pic_size=1000, format='rst', **kwargs): """ Generates a report to the given path for all extension This method calls .report_accounts for all extensions Notes ----- ...
['def', 'report_accounts', '(', 'self', ',', 'path', ',', 'per_region', '=', 'True', ',', 'per_capita', '=', 'False', ',', 'pic_size', '=', '1000', ',', 'format', '=', "'rst'", ',', '*', '*', 'kwargs', ')', ':', 'for', 'ext', 'in', 'self', '.', 'get_extensions', '(', 'data', '=', 'True', ')', ':', 'ext', '.', 'report_a...
Generates a report to the given path for all extension This method calls .report_accounts for all extensions Notes ----- This looks prettier with the seaborn module (import seaborn before calling this method) Parameters ---------- path : string ...
['Generates', 'a', 'report', 'to', 'the', 'given', 'path', 'for', 'all', 'extension']
train
https://github.com/konstantinstadler/pymrio/blob/d764aa0dd2150200e867a9713a98ddae203e12d4/pymrio/core/mriosystem.py#L1529-L1574
8,141
pysathq/pysat
solvers/prepare.py
download_archive
def download_archive(sources): """ Downloads an archive and saves locally (taken from PySMT). """ # last element is expected to be the local archive name save_to = sources[-1] # not downloading the file again if it exists if os.path.exists(save_to): print('not downloading {0} s...
python
def download_archive(sources): """ Downloads an archive and saves locally (taken from PySMT). """ # last element is expected to be the local archive name save_to = sources[-1] # not downloading the file again if it exists if os.path.exists(save_to): print('not downloading {0} s...
['def', 'download_archive', '(', 'sources', ')', ':', '# last element is expected to be the local archive name', 'save_to', '=', 'sources', '[', '-', '1', ']', '# not downloading the file again if it exists', 'if', 'os', '.', 'path', '.', 'exists', '(', 'save_to', ')', ':', 'print', '(', "'not downloading {0} since it ...
Downloads an archive and saves locally (taken from PySMT).
['Downloads', 'an', 'archive', 'and', 'saves', 'locally', '(', 'taken', 'from', 'PySMT', ')', '.']
train
https://github.com/pysathq/pysat/blob/522742e8f2d4c6ac50ecd9087f7a346206774c67/solvers/prepare.py#L289-L335
8,142
kislyuk/aegea
aegea/packages/github3/github.py
GitHub.user
def user(self, login=None): """Returns a User object for the specified login name if provided. If no login name is provided, this will return a User object for the authenticated user. :param str login: (optional) :returns: :class:`User <github3.users.User>` """ i...
python
def user(self, login=None): """Returns a User object for the specified login name if provided. If no login name is provided, this will return a User object for the authenticated user. :param str login: (optional) :returns: :class:`User <github3.users.User>` """ i...
['def', 'user', '(', 'self', ',', 'login', '=', 'None', ')', ':', 'if', 'login', ':', 'url', '=', 'self', '.', '_build_url', '(', "'users'", ',', 'login', ')', 'else', ':', 'url', '=', 'self', '.', '_build_url', '(', "'user'", ')', 'json', '=', 'self', '.', '_json', '(', 'self', '.', '_get', '(', 'url', ')', ',', '200'...
Returns a User object for the specified login name if provided. If no login name is provided, this will return a User object for the authenticated user. :param str login: (optional) :returns: :class:`User <github3.users.User>`
['Returns', 'a', 'User', 'object', 'for', 'the', 'specified', 'login', 'name', 'if', 'provided', '.', 'If', 'no', 'login', 'name', 'is', 'provided', 'this', 'will', 'return', 'a', 'User', 'object', 'for', 'the', 'authenticated', 'user', '.']
train
https://github.com/kislyuk/aegea/blob/94957e9dba036eae3052e2662c208b259c08399a/aegea/packages/github3/github.py#L1452-L1466
8,143
fprimex/zdesk
zdesk/zdesk_api.py
ZendeskAPI.help_center_section_subscription_delete
def help_center_section_subscription_delete(self, section_id, id, **kwargs): "https://developer.zendesk.com/rest_api/docs/help_center/subscriptions#delete-section-subscription" api_path = "/api/v2/help_center/sections/{section_id}/subscriptions/{id}.json" api_path = api_path.format(section_id=se...
python
def help_center_section_subscription_delete(self, section_id, id, **kwargs): "https://developer.zendesk.com/rest_api/docs/help_center/subscriptions#delete-section-subscription" api_path = "/api/v2/help_center/sections/{section_id}/subscriptions/{id}.json" api_path = api_path.format(section_id=se...
['def', 'help_center_section_subscription_delete', '(', 'self', ',', 'section_id', ',', 'id', ',', '*', '*', 'kwargs', ')', ':', 'api_path', '=', '"/api/v2/help_center/sections/{section_id}/subscriptions/{id}.json"', 'api_path', '=', 'api_path', '.', 'format', '(', 'section_id', '=', 'section_id', ',', 'id', '=', 'id',...
https://developer.zendesk.com/rest_api/docs/help_center/subscriptions#delete-section-subscription
['https', ':', '//', 'developer', '.', 'zendesk', '.', 'com', '/', 'rest_api', '/', 'docs', '/', 'help_center', '/', 'subscriptions#delete', '-', 'section', '-', 'subscription']
train
https://github.com/fprimex/zdesk/blob/851611c13b4d530e9df31390b3ec709baf0a0188/zdesk/zdesk_api.py#L1871-L1875
8,144
dossier/dossier.fc
python/dossier/fc/exceptions.py
uni
def uni(key): '''as a crutch, we allow str-type keys, but they really should be unicode. ''' if isinstance(key, str): logger.warn('assuming utf8 on: %r', key) return unicode(key, 'utf-8') elif isinstance(key, unicode): return key else: raise NonUnicodeKeyError(ke...
python
def uni(key): '''as a crutch, we allow str-type keys, but they really should be unicode. ''' if isinstance(key, str): logger.warn('assuming utf8 on: %r', key) return unicode(key, 'utf-8') elif isinstance(key, unicode): return key else: raise NonUnicodeKeyError(ke...
['def', 'uni', '(', 'key', ')', ':', 'if', 'isinstance', '(', 'key', ',', 'str', ')', ':', 'logger', '.', 'warn', '(', "'assuming utf8 on: %r'", ',', 'key', ')', 'return', 'unicode', '(', 'key', ',', "'utf-8'", ')', 'elif', 'isinstance', '(', 'key', ',', 'unicode', ')', ':', 'return', 'key', 'else', ':', 'raise', 'NonU...
as a crutch, we allow str-type keys, but they really should be unicode.
['as', 'a', 'crutch', 'we', 'allow', 'str', '-', 'type', 'keys', 'but', 'they', 'really', 'should', 'be', 'unicode', '.']
train
https://github.com/dossier/dossier.fc/blob/3e969d0cb2592fc06afc1c849d2b22283450b5e2/python/dossier/fc/exceptions.py#L54-L65
8,145
buildbot/buildbot
master/buildbot/process/builder.py
Builder.getCollapseRequestsFn
def getCollapseRequestsFn(self): """Helper function to determine which collapseRequests function to use from L{_collapseRequests}, or None for no merging""" # first, seek through builder, global, and the default collapseRequests_fn = self.config.collapseRequests if collapseReques...
python
def getCollapseRequestsFn(self): """Helper function to determine which collapseRequests function to use from L{_collapseRequests}, or None for no merging""" # first, seek through builder, global, and the default collapseRequests_fn = self.config.collapseRequests if collapseReques...
['def', 'getCollapseRequestsFn', '(', 'self', ')', ':', '# first, seek through builder, global, and the default', 'collapseRequests_fn', '=', 'self', '.', 'config', '.', 'collapseRequests', 'if', 'collapseRequests_fn', 'is', 'None', ':', 'collapseRequests_fn', '=', 'self', '.', 'master', '.', 'config', '.', 'collapseRe...
Helper function to determine which collapseRequests function to use from L{_collapseRequests}, or None for no merging
['Helper', 'function', 'to', 'determine', 'which', 'collapseRequests', 'function', 'to', 'use', 'from', 'L', '{', '_collapseRequests', '}', 'or', 'None', 'for', 'no', 'merging']
train
https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/process/builder.py#L441-L457
8,146
johnnoone/aioconsul
aioconsul/client/kv_endpoint.py
ReadMixin.raw
async def raw(self, key, *, dc=None, watch=None, consistency=None): """Returns the specified key Parameters: key (str): Key to fetch dc (str): Specify datacenter that will be used. Defaults to the agent's local datacenter. watch (Blocking): Do a...
python
async def raw(self, key, *, dc=None, watch=None, consistency=None): """Returns the specified key Parameters: key (str): Key to fetch dc (str): Specify datacenter that will be used. Defaults to the agent's local datacenter. watch (Blocking): Do a...
['async', 'def', 'raw', '(', 'self', ',', 'key', ',', '*', ',', 'dc', '=', 'None', ',', 'watch', '=', 'None', ',', 'consistency', '=', 'None', ')', ':', 'response', '=', 'await', 'self', '.', '_read', '(', 'key', ',', 'dc', '=', 'dc', ',', 'raw', '=', 'True', ',', 'watch', '=', 'watch', ',', 'consistency', '=', 'consis...
Returns the specified key Parameters: key (str): Key to fetch dc (str): Specify datacenter that will be used. Defaults to the agent's local datacenter. watch (Blocking): Do a blocking query consistency (Consistency): Force consistency ...
['Returns', 'the', 'specified', 'key']
train
https://github.com/johnnoone/aioconsul/blob/02f7a529d7dc2e49bed942111067aa5faf320e90/aioconsul/client/kv_endpoint.py#L122-L139
8,147
MacHu-GWU/single_file_module-project
sfm/iterable.py
flatten_all
def flatten_all(nested_iterable): """Flatten arbitrary depth of nesting. Good for unknown nesting structure iterable object. Example:: >>> list(flatten_all([[1, 2], "abc", [3, ["x", "y", "z"]], 4])) [1, 2, "abc", 3, "x", "y", "z", 4] **中文文档** 将任意维度的列表压平成一维列表。 注: 使用hasattr(i,...
python
def flatten_all(nested_iterable): """Flatten arbitrary depth of nesting. Good for unknown nesting structure iterable object. Example:: >>> list(flatten_all([[1, 2], "abc", [3, ["x", "y", "z"]], 4])) [1, 2, "abc", 3, "x", "y", "z", 4] **中文文档** 将任意维度的列表压平成一维列表。 注: 使用hasattr(i,...
['def', 'flatten_all', '(', 'nested_iterable', ')', ':', 'for', 'item', 'in', 'nested_iterable', ':', 'if', 'hasattr', '(', 'item', ',', '"__iter__"', ')', 'and', 'not', 'isinstance', '(', 'item', ',', 'string_types', ')', ':', 'for', 'i', 'in', 'flatten_all', '(', 'item', ')', ':', 'yield', 'i', 'else', ':', 'yield', ...
Flatten arbitrary depth of nesting. Good for unknown nesting structure iterable object. Example:: >>> list(flatten_all([[1, 2], "abc", [3, ["x", "y", "z"]], 4])) [1, 2, "abc", 3, "x", "y", "z", 4] **中文文档** 将任意维度的列表压平成一维列表。 注: 使用hasattr(i, "__iter__")方法做是否是可循环对象的判断, 性能要高于其他 任...
['Flatten', 'arbitrary', 'depth', 'of', 'nesting', '.', 'Good', 'for', 'unknown', 'nesting', 'structure', 'iterable', 'object', '.']
train
https://github.com/MacHu-GWU/single_file_module-project/blob/01f7a6b250853bebfd73de275895bf274325cfc1/sfm/iterable.py#L41-L62
8,148
matllubos/django-is-core
is_core/utils/decorators.py
short_description
def short_description(description): """ Sets 'short_description' attribute (this attribute is in exports to generate header name). """ def decorator(func): if isinstance(func, property): func = func.fget func.short_description = description return func return deco...
python
def short_description(description): """ Sets 'short_description' attribute (this attribute is in exports to generate header name). """ def decorator(func): if isinstance(func, property): func = func.fget func.short_description = description return func return deco...
['def', 'short_description', '(', 'description', ')', ':', 'def', 'decorator', '(', 'func', ')', ':', 'if', 'isinstance', '(', 'func', ',', 'property', ')', ':', 'func', '=', 'func', '.', 'fget', 'func', '.', 'short_description', '=', 'description', 'return', 'func', 'return', 'decorator']
Sets 'short_description' attribute (this attribute is in exports to generate header name).
['Sets', 'short_description', 'attribute', '(', 'this', 'attribute', 'is', 'in', 'exports', 'to', 'generate', 'header', 'name', ')', '.']
train
https://github.com/matllubos/django-is-core/blob/3f87ec56a814738683c732dce5f07e0328c2300d/is_core/utils/decorators.py#L1-L10
8,149
libtcod/python-tcod
tcod/libtcodpy.py
random_get_int_mean
def random_get_int_mean( rnd: Optional[tcod.random.Random], mi: int, ma: int, mean: int ) -> int: """Return a random weighted integer in the range: ``mi`` <= n <= ``ma``. The result is affacted by calls to :any:`random_set_distribution`. Args: rnd (Optional[Random]): A Random instance, or None...
python
def random_get_int_mean( rnd: Optional[tcod.random.Random], mi: int, ma: int, mean: int ) -> int: """Return a random weighted integer in the range: ``mi`` <= n <= ``ma``. The result is affacted by calls to :any:`random_set_distribution`. Args: rnd (Optional[Random]): A Random instance, or None...
['def', 'random_get_int_mean', '(', 'rnd', ':', 'Optional', '[', 'tcod', '.', 'random', '.', 'Random', ']', ',', 'mi', ':', 'int', ',', 'ma', ':', 'int', ',', 'mean', ':', 'int', ')', '->', 'int', ':', 'return', 'int', '(', 'lib', '.', 'TCOD_random_get_int_mean', '(', 'rnd', '.', 'random_c', 'if', 'rnd', 'else', 'ffi',...
Return a random weighted integer in the range: ``mi`` <= n <= ``ma``. The result is affacted by calls to :any:`random_set_distribution`. Args: rnd (Optional[Random]): A Random instance, or None to use the default. low (int): The lower bound of the random range, inclusive. high (int): T...
['Return', 'a', 'random', 'weighted', 'integer', 'in', 'the', 'range', ':', 'mi', '<', '=', 'n', '<', '=', 'ma', '.']
train
https://github.com/libtcod/python-tcod/blob/8ba10c5cfb813eaf3e834de971ba2d6acb7838e4/tcod/libtcodpy.py#L3746-L3766
8,150
tjcsl/cslbot
cslbot/helpers/handler.py
BotHandler.do_part
def do_part(self, cmdargs, nick, target, msgtype, send, c): """Leaves a channel. Prevent user from leaving the primary channel. """ channel = self.config['core']['channel'] botnick = self.config['core']['nick'] if not cmdargs: # don't leave the primary chann...
python
def do_part(self, cmdargs, nick, target, msgtype, send, c): """Leaves a channel. Prevent user from leaving the primary channel. """ channel = self.config['core']['channel'] botnick = self.config['core']['nick'] if not cmdargs: # don't leave the primary chann...
['def', 'do_part', '(', 'self', ',', 'cmdargs', ',', 'nick', ',', 'target', ',', 'msgtype', ',', 'send', ',', 'c', ')', ':', 'channel', '=', 'self', '.', 'config', '[', "'core'", ']', '[', "'channel'", ']', 'botnick', '=', 'self', '.', 'config', '[', "'core'", ']', '[', "'nick'", ']', 'if', 'not', 'cmdargs', ':', "# do...
Leaves a channel. Prevent user from leaving the primary channel.
['Leaves', 'a', 'channel', '.']
train
https://github.com/tjcsl/cslbot/blob/aebe07be47141f61d7c180706bddfb707f19b2b5/cslbot/helpers/handler.py#L259-L285
8,151
olsoneric/pedemath
pedemath/matrix.py
Matrix44.rot_from_vectors
def rot_from_vectors(start_vec, end_vec): """Return the rotation matrix to rotate from one vector to another.""" dot = start_vec.dot(end_vec) # TODO: check if dot is a valid number angle = math.acos(dot) # TODO: check if angle is a valid number cross = start_vec.cross(en...
python
def rot_from_vectors(start_vec, end_vec): """Return the rotation matrix to rotate from one vector to another.""" dot = start_vec.dot(end_vec) # TODO: check if dot is a valid number angle = math.acos(dot) # TODO: check if angle is a valid number cross = start_vec.cross(en...
['def', 'rot_from_vectors', '(', 'start_vec', ',', 'end_vec', ')', ':', 'dot', '=', 'start_vec', '.', 'dot', '(', 'end_vec', ')', '# TODO: check if dot is a valid number', 'angle', '=', 'math', '.', 'acos', '(', 'dot', ')', '# TODO: check if angle is a valid number', 'cross', '=', 'start_vec', '.', 'cross', '(', 'end_v...
Return the rotation matrix to rotate from one vector to another.
['Return', 'the', 'rotation', 'matrix', 'to', 'rotate', 'from', 'one', 'vector', 'to', 'another', '.']
train
https://github.com/olsoneric/pedemath/blob/4bffcfe7089e421d603eb0a9708b84789c2d16be/pedemath/matrix.py#L299-L311
8,152
gwpy/gwpy
gwpy/timeseries/statevector.py
StateVector.to_dqflags
def to_dqflags(self, bits=None, minlen=1, dtype=float, round=False): """Convert this `StateVector` into a `~gwpy.segments.DataQualityDict` The `StateTimeSeries` for each bit is converted into a `~gwpy.segments.DataQualityFlag` with the bits combined into a dict. Parameters ----...
python
def to_dqflags(self, bits=None, minlen=1, dtype=float, round=False): """Convert this `StateVector` into a `~gwpy.segments.DataQualityDict` The `StateTimeSeries` for each bit is converted into a `~gwpy.segments.DataQualityFlag` with the bits combined into a dict. Parameters ----...
['def', 'to_dqflags', '(', 'self', ',', 'bits', '=', 'None', ',', 'minlen', '=', '1', ',', 'dtype', '=', 'float', ',', 'round', '=', 'False', ')', ':', 'from', '.', '.', 'segments', 'import', 'DataQualityDict', 'out', '=', 'DataQualityDict', '(', ')', 'bitseries', '=', 'self', '.', 'get_bit_series', '(', 'bits', '=', '...
Convert this `StateVector` into a `~gwpy.segments.DataQualityDict` The `StateTimeSeries` for each bit is converted into a `~gwpy.segments.DataQualityFlag` with the bits combined into a dict. Parameters ---------- minlen : `int`, optional, default: 1 minimum number of...
['Convert', 'this', 'StateVector', 'into', 'a', '~gwpy', '.', 'segments', '.', 'DataQualityDict']
train
https://github.com/gwpy/gwpy/blob/7a92b917e7dd2d99b15895293a1fa1d66cdb210a/gwpy/timeseries/statevector.py#L690-L726
8,153
zhebrak/raftos
raftos/state.py
Candidate.on_receive_append_entries
def on_receive_append_entries(self, data): """If we discover a Leader with the same term — step down""" if self.storage.term == data['term']: self.state.to_follower()
python
def on_receive_append_entries(self, data): """If we discover a Leader with the same term — step down""" if self.storage.term == data['term']: self.state.to_follower()
['def', 'on_receive_append_entries', '(', 'self', ',', 'data', ')', ':', 'if', 'self', '.', 'storage', '.', 'term', '==', 'data', '[', "'term'", ']', ':', 'self', '.', 'state', '.', 'to_follower', '(', ')']
If we discover a Leader with the same term — step down
['If', 'we', 'discover', 'a', 'Leader', 'with', 'the', 'same', 'term', '—', 'step', 'down']
train
https://github.com/zhebrak/raftos/blob/0d6f9e049b526279b1035f597291a96cf50c9b40/raftos/state.py#L338-L341
8,154
woocommerce/wc-api-python
woocommerce/oauth.py
OAuth.get_oauth_url
def get_oauth_url(self): """ Returns the URL with OAuth params """ params = OrderedDict() if "?" in self.url: url = self.url[:self.url.find("?")] for key, value in parse_qsl(urlparse(self.url).query): params[key] = value else: url = se...
python
def get_oauth_url(self): """ Returns the URL with OAuth params """ params = OrderedDict() if "?" in self.url: url = self.url[:self.url.find("?")] for key, value in parse_qsl(urlparse(self.url).query): params[key] = value else: url = se...
['def', 'get_oauth_url', '(', 'self', ')', ':', 'params', '=', 'OrderedDict', '(', ')', 'if', '"?"', 'in', 'self', '.', 'url', ':', 'url', '=', 'self', '.', 'url', '[', ':', 'self', '.', 'url', '.', 'find', '(', '"?"', ')', ']', 'for', 'key', ',', 'value', 'in', 'parse_qsl', '(', 'urlparse', '(', 'self', '.', 'url', ')...
Returns the URL with OAuth params
['Returns', 'the', 'URL', 'with', 'OAuth', 'params']
train
https://github.com/woocommerce/wc-api-python/blob/dee5065eaff2d200ef9883c25799ff605fe5e667/woocommerce/oauth.py#L41-L60
8,155
aalireza/SimpleAudioIndexer
SimpleAudioIndexer/__init__.py
SimpleAudioIndexer.search_regexp
def search_regexp(self, pattern, audio_basename=None): """ First joins the words of the word_blocks of timestamps with space, per audio_basename. Then matches `pattern` and calculates the index of the word_block where the first and last word of the matched result appears in. Then...
python
def search_regexp(self, pattern, audio_basename=None): """ First joins the words of the word_blocks of timestamps with space, per audio_basename. Then matches `pattern` and calculates the index of the word_block where the first and last word of the matched result appears in. Then...
['def', 'search_regexp', '(', 'self', ',', 'pattern', ',', 'audio_basename', '=', 'None', ')', ':', 'def', 'indexes_in_transcript_to_start_end_second', '(', 'index_tup', ',', 'audio_basename', ')', ':', '"""\n Calculates the word block index by having the beginning and ending\n index of the matche...
First joins the words of the word_blocks of timestamps with space, per audio_basename. Then matches `pattern` and calculates the index of the word_block where the first and last word of the matched result appears in. Then presents the output like `search_all` method. Note that the leadi...
['First', 'joins', 'the', 'words', 'of', 'the', 'word_blocks', 'of', 'timestamps', 'with', 'space', 'per', 'audio_basename', '.', 'Then', 'matches', 'pattern', 'and', 'calculates', 'the', 'index', 'of', 'the', 'word_block', 'where', 'the', 'first', 'and', 'last', 'word', 'of', 'the', 'matched', 'result', 'appears', 'in...
train
https://github.com/aalireza/SimpleAudioIndexer/blob/73f9d75897d785bdaea9d28dde5fa48104428164/SimpleAudioIndexer/__init__.py#L1603-L1693
8,156
inveniosoftware/invenio-files-rest
invenio_files_rest/serializer.py
MultipartObjectSchema.dump_links
def dump_links(self, o): """Dump links.""" links = { 'self': url_for( '.object_api', bucket_id=o.bucket_id, key=o.key, uploadId=o.upload_id, _external=True, ), 'object': url_for( ...
python
def dump_links(self, o): """Dump links.""" links = { 'self': url_for( '.object_api', bucket_id=o.bucket_id, key=o.key, uploadId=o.upload_id, _external=True, ), 'object': url_for( ...
['def', 'dump_links', '(', 'self', ',', 'o', ')', ':', 'links', '=', '{', "'self'", ':', 'url_for', '(', "'.object_api'", ',', 'bucket_id', '=', 'o', '.', 'bucket_id', ',', 'key', '=', 'o', '.', 'key', ',', 'uploadId', '=', 'o', '.', 'upload_id', ',', '_external', '=', 'True', ',', ')', ',', "'object'", ':', 'url_for',...
Dump links.
['Dump', 'links', '.']
train
https://github.com/inveniosoftware/invenio-files-rest/blob/59a950da61cc8d5882a03c6fde6db2e2ed10befd/invenio_files_rest/serializer.py#L126-L166
8,157
UDST/urbansim
urbansim/models/dcm.py
MNLDiscreteChoiceModel.to_dict
def to_dict(self): """ Return a dict respresentation of an MNLDiscreteChoiceModel instance. """ return { 'model_type': 'discretechoice', 'model_expression': self.model_expression, 'sample_size': self.sample_size, 'name': self.name,...
python
def to_dict(self): """ Return a dict respresentation of an MNLDiscreteChoiceModel instance. """ return { 'model_type': 'discretechoice', 'model_expression': self.model_expression, 'sample_size': self.sample_size, 'name': self.name,...
['def', 'to_dict', '(', 'self', ')', ':', 'return', '{', "'model_type'", ':', "'discretechoice'", ',', "'model_expression'", ':', 'self', '.', 'model_expression', ',', "'sample_size'", ':', 'self', '.', 'sample_size', ',', "'name'", ':', 'self', '.', 'name', ',', "'probability_mode'", ':', 'self', '.', 'probability_mod...
Return a dict respresentation of an MNLDiscreteChoiceModel instance.
['Return', 'a', 'dict', 'respresentation', 'of', 'an', 'MNLDiscreteChoiceModel', 'instance', '.']
train
https://github.com/UDST/urbansim/blob/79f815a6503e109f50be270cee92d0f4a34f49ef/urbansim/models/dcm.py#L659-L684
8,158
Alignak-monitoring/alignak
alignak/daemons/receiverdaemon.py
Receiver.do_loop_turn
def do_loop_turn(self): """Receiver daemon main loop :return: None """ # Begin to clean modules self.check_and_del_zombie_modules() # Maybe the arbiter pushed a new configuration... if self.watch_for_new_conf(timeout=0.05): logger.info("I got a new ...
python
def do_loop_turn(self): """Receiver daemon main loop :return: None """ # Begin to clean modules self.check_and_del_zombie_modules() # Maybe the arbiter pushed a new configuration... if self.watch_for_new_conf(timeout=0.05): logger.info("I got a new ...
['def', 'do_loop_turn', '(', 'self', ')', ':', '# Begin to clean modules', 'self', '.', 'check_and_del_zombie_modules', '(', ')', '# Maybe the arbiter pushed a new configuration...', 'if', 'self', '.', 'watch_for_new_conf', '(', 'timeout', '=', '0.05', ')', ':', 'logger', '.', 'info', '(', '"I got a new configuration.....
Receiver daemon main loop :return: None
['Receiver', 'daemon', 'main', 'loop']
train
https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/daemons/receiverdaemon.py#L307-L341
8,159
enricobacis/wos
wos/client.py
WosClient.connect
def connect(self): """Authenticate to WOS and set the SID cookie.""" if not self._SID: self._SID = self._auth.service.authenticate() print('Authenticated (SID: %s)' % self._SID) self._search.set_options(headers={'Cookie': 'SID="%s"' % self._SID}) self._auth.optio...
python
def connect(self): """Authenticate to WOS and set the SID cookie.""" if not self._SID: self._SID = self._auth.service.authenticate() print('Authenticated (SID: %s)' % self._SID) self._search.set_options(headers={'Cookie': 'SID="%s"' % self._SID}) self._auth.optio...
['def', 'connect', '(', 'self', ')', ':', 'if', 'not', 'self', '.', '_SID', ':', 'self', '.', '_SID', '=', 'self', '.', '_auth', '.', 'service', '.', 'authenticate', '(', ')', 'print', '(', "'Authenticated (SID: %s)'", '%', 'self', '.', '_SID', ')', 'self', '.', '_search', '.', 'set_options', '(', 'headers', '=', '{', ...
Authenticate to WOS and set the SID cookie.
['Authenticate', 'to', 'WOS', 'and', 'set', 'the', 'SID', 'cookie', '.']
train
https://github.com/enricobacis/wos/blob/a51f4d1a983c2c7529caac3e09606a432223630d/wos/client.py#L104-L112
8,160
schlamar/cov-core
cov_core.py
DistMaster.finish
def finish(self): """Combines coverage data and sets the list of coverage objects to report on.""" # Combine all the suffix files into the data file. self.cov.stop() self.cov.combine() self.cov.save()
python
def finish(self): """Combines coverage data and sets the list of coverage objects to report on.""" # Combine all the suffix files into the data file. self.cov.stop() self.cov.combine() self.cov.save()
['def', 'finish', '(', 'self', ')', ':', '# Combine all the suffix files into the data file.', 'self', '.', 'cov', '.', 'stop', '(', ')', 'self', '.', 'cov', '.', 'combine', '(', ')', 'self', '.', 'cov', '.', 'save', '(', ')']
Combines coverage data and sets the list of coverage objects to report on.
['Combines', 'coverage', 'data', 'and', 'sets', 'the', 'list', 'of', 'coverage', 'objects', 'to', 'report', 'on', '.']
train
https://github.com/schlamar/cov-core/blob/791b1f6890456ee9e3beec33c89a7c573a382b7b/cov_core.py#L203-L209
8,161
Unidata/MetPy
metpy/calc/tools.py
get_layer
def get_layer(pressure, *args, **kwargs): r"""Return an atmospheric layer from upper air data with the requested bottom and depth. This function will subset an upper air dataset to contain only the specified layer. The bottom of the layer can be specified with a pressure or height above the surface pre...
python
def get_layer(pressure, *args, **kwargs): r"""Return an atmospheric layer from upper air data with the requested bottom and depth. This function will subset an upper air dataset to contain only the specified layer. The bottom of the layer can be specified with a pressure or height above the surface pre...
['def', 'get_layer', '(', 'pressure', ',', '*', 'args', ',', '*', '*', 'kwargs', ')', ':', '# Pop off keyword arguments', 'heights', '=', 'kwargs', '.', 'pop', '(', "'heights'", ',', 'None', ')', 'bottom', '=', 'kwargs', '.', 'pop', '(', "'bottom'", ',', 'None', ')', 'depth', '=', 'kwargs', '.', 'pop', '(', "'depth'", ...
r"""Return an atmospheric layer from upper air data with the requested bottom and depth. This function will subset an upper air dataset to contain only the specified layer. The bottom of the layer can be specified with a pressure or height above the surface pressure. The bottom defaults to the surface pres...
['r', 'Return', 'an', 'atmospheric', 'layer', 'from', 'upper', 'air', 'data', 'with', 'the', 'requested', 'bottom', 'and', 'depth', '.']
train
https://github.com/Unidata/MetPy/blob/16f68a94919b9a82dcf9cada2169cf039129e67b/metpy/calc/tools.py#L509-L610
8,162
lotabout/pymustache
pymustache/mustache.py
delimiters_to_re
def delimiters_to_re(delimiters): """convert delimiters to corresponding regular expressions""" # caching delimiters = tuple(delimiters) if delimiters in re_delimiters: re_tag = re_delimiters[delimiters] else: open_tag, close_tag = delimiters # escape open_tag = ''....
python
def delimiters_to_re(delimiters): """convert delimiters to corresponding regular expressions""" # caching delimiters = tuple(delimiters) if delimiters in re_delimiters: re_tag = re_delimiters[delimiters] else: open_tag, close_tag = delimiters # escape open_tag = ''....
['def', 'delimiters_to_re', '(', 'delimiters', ')', ':', '# caching', 'delimiters', '=', 'tuple', '(', 'delimiters', ')', 'if', 'delimiters', 'in', 're_delimiters', ':', 're_tag', '=', 're_delimiters', '[', 'delimiters', ']', 'else', ':', 'open_tag', ',', 'close_tag', '=', 'delimiters', '# escape', 'open_tag', '=', "''...
convert delimiters to corresponding regular expressions
['convert', 'delimiters', 'to', 'corresponding', 'regular', 'expressions']
train
https://github.com/lotabout/pymustache/blob/d4089e49cda01fc11bab0c986d95e25150a60bac/pymustache/mustache.py#L69-L86
8,163
onelogin/python-saml
src/onelogin/saml2/metadata.py
OneLogin_Saml2_Metadata.builder
def builder(sp, authnsign=False, wsign=False, valid_until=None, cache_duration=None, contacts=None, organization=None): """ Builds the metadata of the SP :param sp: The SP data :type sp: string :param authnsign: authnRequestsSigned attribute :type authnsign: string ...
python
def builder(sp, authnsign=False, wsign=False, valid_until=None, cache_duration=None, contacts=None, organization=None): """ Builds the metadata of the SP :param sp: The SP data :type sp: string :param authnsign: authnRequestsSigned attribute :type authnsign: string ...
['def', 'builder', '(', 'sp', ',', 'authnsign', '=', 'False', ',', 'wsign', '=', 'False', ',', 'valid_until', '=', 'None', ',', 'cache_duration', '=', 'None', ',', 'contacts', '=', 'None', ',', 'organization', '=', 'None', ')', ':', 'if', 'valid_until', 'is', 'None', ':', 'valid_until', '=', 'int', '(', 'time', '(', ')...
Builds the metadata of the SP :param sp: The SP data :type sp: string :param authnsign: authnRequestsSigned attribute :type authnsign: string :param wsign: wantAssertionsSigned attribute :type wsign: string :param valid_until: Metadata's expiry date :t...
['Builds', 'the', 'metadata', 'of', 'the', 'SP']
train
https://github.com/onelogin/python-saml/blob/9fe7a72da5b4caa1529c1640b52d2649447ce49b/src/onelogin/saml2/metadata.py#L31-L202
8,164
juju-solutions/charms.reactive
charms/reactive/__init__.py
main
def main(relation_name=None): """ This is the main entry point for the reactive framework. It calls :func:`~bus.discover` to find and load all reactive handlers (e.g., :func:`@when <decorators.when>` decorated blocks), and then :func:`~bus.dispatch` to trigger handlers until the queue settles out. ...
python
def main(relation_name=None): """ This is the main entry point for the reactive framework. It calls :func:`~bus.discover` to find and load all reactive handlers (e.g., :func:`@when <decorators.when>` decorated blocks), and then :func:`~bus.dispatch` to trigger handlers until the queue settles out. ...
['def', 'main', '(', 'relation_name', '=', 'None', ')', ':', 'hook_name', '=', 'hookenv', '.', 'hook_name', '(', ')', 'restricted_mode', '=', 'hook_name', 'in', '[', "'meter-status-changed'", ',', "'collect-metrics'", ']', 'hookenv', '.', 'log', '(', "'Reactive main running for hook %s'", '%', 'hookenv', '.', 'hook_nam...
This is the main entry point for the reactive framework. It calls :func:`~bus.discover` to find and load all reactive handlers (e.g., :func:`@when <decorators.when>` decorated blocks), and then :func:`~bus.dispatch` to trigger handlers until the queue settles out. Finally, :meth:`unitdata.kv().flush <c...
['This', 'is', 'the', 'main', 'entry', 'point', 'for', 'the', 'reactive', 'framework', '.', 'It', 'calls', ':', 'func', ':', '~bus', '.', 'discover', 'to', 'find', 'and', 'load', 'all', 'reactive', 'handlers', '(', 'e', '.', 'g', '.', ':', 'func', ':', '@when', '<decorators', '.', 'when', '>', 'decorated', 'blocks', ')...
train
https://github.com/juju-solutions/charms.reactive/blob/e37e781432e77c12b63d2c739bd6cd70d3230c3a/charms/reactive/__init__.py#L46-L84
8,165
uw-it-aca/uw-restclients-sws
uw_sws/term.py
get_term_by_date
def get_term_by_date(date): """ Returns a term for the datetime.date object given. """ year = date.year term = None for quarter in ('autumn', 'summer', 'spring', 'winter'): term = get_term_by_year_and_quarter(year, quarter) if date >= term.first_day_quarter: break ...
python
def get_term_by_date(date): """ Returns a term for the datetime.date object given. """ year = date.year term = None for quarter in ('autumn', 'summer', 'spring', 'winter'): term = get_term_by_year_and_quarter(year, quarter) if date >= term.first_day_quarter: break ...
['def', 'get_term_by_date', '(', 'date', ')', ':', 'year', '=', 'date', '.', 'year', 'term', '=', 'None', 'for', 'quarter', 'in', '(', "'autumn'", ',', "'summer'", ',', "'spring'", ',', "'winter'", ')', ':', 'term', '=', 'get_term_by_year_and_quarter', '(', 'year', ',', 'quarter', ')', 'if', 'date', '>=', 'term', '.', ...
Returns a term for the datetime.date object given.
['Returns', 'a', 'term', 'for', 'the', 'datetime', '.', 'date', 'object', 'given', '.']
train
https://github.com/uw-it-aca/uw-restclients-sws/blob/4d36776dcca36855fc15c1b8fe7650ae045194cf/uw_sws/term.py#L91-L118
8,166
jgillick/LendingClub
lendingclub/session.py
Session.get
def get(self, path, query=None, redirects=True): """ GET request wrapper for :func:`request()` """ return self.request('GET', path, query, None, redirects)
python
def get(self, path, query=None, redirects=True): """ GET request wrapper for :func:`request()` """ return self.request('GET', path, query, None, redirects)
['def', 'get', '(', 'self', ',', 'path', ',', 'query', '=', 'None', ',', 'redirects', '=', 'True', ')', ':', 'return', 'self', '.', 'request', '(', "'GET'", ',', 'path', ',', 'query', ',', 'None', ',', 'redirects', ')']
GET request wrapper for :func:`request()`
['GET', 'request', 'wrapper', 'for', ':', 'func', ':', 'request', '()']
train
https://github.com/jgillick/LendingClub/blob/4495f99fd869810f39c00e02b0f4112c6b210384/lendingclub/session.py#L298-L302
8,167
ltworf/typedload
typedload/dataloader.py
_tupleload
def _tupleload(l: Loader, value, type_) -> Tuple: """ This loads into something like Tuple[int,str] """ if HAS_TUPLEARGS: args = type_.__args__ else: args = type_.__tuple_params__ if len(args) == 2 and args[1] == ...: # Tuple[something, ...] return tuple(l.load(i, args[0...
python
def _tupleload(l: Loader, value, type_) -> Tuple: """ This loads into something like Tuple[int,str] """ if HAS_TUPLEARGS: args = type_.__args__ else: args = type_.__tuple_params__ if len(args) == 2 and args[1] == ...: # Tuple[something, ...] return tuple(l.load(i, args[0...
['def', '_tupleload', '(', 'l', ':', 'Loader', ',', 'value', ',', 'type_', ')', '->', 'Tuple', ':', 'if', 'HAS_TUPLEARGS', ':', 'args', '=', 'type_', '.', '__args__', 'else', ':', 'args', '=', 'type_', '.', '__tuple_params__', 'if', 'len', '(', 'args', ')', '==', '2', 'and', 'args', '[', '1', ']', '==', '...', ':', '# ...
This loads into something like Tuple[int,str]
['This', 'loads', 'into', 'something', 'like', 'Tuple', '[', 'int', 'str', ']']
train
https://github.com/ltworf/typedload/blob/7fd130612963bfcec3242698463ef863ca4af927/typedload/dataloader.py#L312-L328
8,168
myint/unify
unify.py
detect_encoding
def detect_encoding(filename): """Return file encoding.""" try: with open(filename, 'rb') as input_file: from lib2to3.pgen2 import tokenize as lib2to3_tokenize encoding = lib2to3_tokenize.detect_encoding(input_file.readline)[0] # Check for correctness of encoding. ...
python
def detect_encoding(filename): """Return file encoding.""" try: with open(filename, 'rb') as input_file: from lib2to3.pgen2 import tokenize as lib2to3_tokenize encoding = lib2to3_tokenize.detect_encoding(input_file.readline)[0] # Check for correctness of encoding. ...
['def', 'detect_encoding', '(', 'filename', ')', ':', 'try', ':', 'with', 'open', '(', 'filename', ',', "'rb'", ')', 'as', 'input_file', ':', 'from', 'lib2to3', '.', 'pgen2', 'import', 'tokenize', 'as', 'lib2to3_tokenize', 'encoding', '=', 'lib2to3_tokenize', '.', 'detect_encoding', '(', 'input_file', '.', 'readline', ...
Return file encoding.
['Return', 'file', 'encoding', '.']
train
https://github.com/myint/unify/blob/ae699f5980a715cadc4a2f07bf16d11083c59401/unify.py#L119-L132
8,169
mongodb/mongo-python-driver
pymongo/collection.py
Collection.estimated_document_count
def estimated_document_count(self, **kwargs): """Get an estimate of the number of documents in this collection using collection metadata. The :meth:`estimated_document_count` method is **not** supported in a transaction. All optional parameters should be passed as keyword argum...
python
def estimated_document_count(self, **kwargs): """Get an estimate of the number of documents in this collection using collection metadata. The :meth:`estimated_document_count` method is **not** supported in a transaction. All optional parameters should be passed as keyword argum...
['def', 'estimated_document_count', '(', 'self', ',', '*', '*', 'kwargs', ')', ':', 'if', "'session'", 'in', 'kwargs', ':', 'raise', 'ConfigurationError', '(', "'estimated_document_count does not support sessions'", ')', 'cmd', '=', 'SON', '(', '[', '(', "'count'", ',', 'self', '.', '__name', ')', ']', ')', 'cmd', '.',...
Get an estimate of the number of documents in this collection using collection metadata. The :meth:`estimated_document_count` method is **not** supported in a transaction. All optional parameters should be passed as keyword arguments to this method. Valid options include: ...
['Get', 'an', 'estimate', 'of', 'the', 'number', 'of', 'documents', 'in', 'this', 'collection', 'using', 'collection', 'metadata', '.']
train
https://github.com/mongodb/mongo-python-driver/blob/c29c21449e3aae74154207058cf85fd94018d4cd/pymongo/collection.py#L1600-L1623
8,170
dmlc/xgboost
python-package/xgboost/rabit.py
broadcast
def broadcast(data, root): """Broadcast object from one node to all other nodes. Parameters ---------- data : any type that can be pickled Input data, if current rank does not equal root, this can be None root : int Rank of the node to broadcast data from. Returns ------- ...
python
def broadcast(data, root): """Broadcast object from one node to all other nodes. Parameters ---------- data : any type that can be pickled Input data, if current rank does not equal root, this can be None root : int Rank of the node to broadcast data from. Returns ------- ...
['def', 'broadcast', '(', 'data', ',', 'root', ')', ':', 'rank', '=', 'get_rank', '(', ')', 'length', '=', 'ctypes', '.', 'c_ulong', '(', ')', 'if', 'root', '==', 'rank', ':', 'assert', 'data', 'is', 'not', 'None', ',', "'need to pass in data when broadcasting'", 's', '=', 'pickle', '.', 'dumps', '(', 'data', ',', 'pro...
Broadcast object from one node to all other nodes. Parameters ---------- data : any type that can be pickled Input data, if current rank does not equal root, this can be None root : int Rank of the node to broadcast data from. Returns ------- object : int the result...
['Broadcast', 'object', 'from', 'one', 'node', 'to', 'all', 'other', 'nodes', '.']
train
https://github.com/dmlc/xgboost/blob/253fdd8a42d5ec6b819788199584d27bf9ea6253/python-package/xgboost/rabit.py#L97-L132
8,171
SiLab-Bonn/pyBAR
pybar/fei4/register.py
save_configuration_to_hdf5
def save_configuration_to_hdf5(register, configuration_file, name=''): '''Saving configuration to HDF5 file from register object Parameters ---------- register : pybar.fei4.register object configuration_file : string, file Filename of the HDF5 configuration file or file object. ...
python
def save_configuration_to_hdf5(register, configuration_file, name=''): '''Saving configuration to HDF5 file from register object Parameters ---------- register : pybar.fei4.register object configuration_file : string, file Filename of the HDF5 configuration file or file object. ...
['def', 'save_configuration_to_hdf5', '(', 'register', ',', 'configuration_file', ',', 'name', '=', "''", ')', ':', 'def', 'save_conf', '(', ')', ':', 'logging', '.', 'info', '(', '"Saving configuration: %s"', '%', 'h5_file', '.', 'filename', ')', 'register', '.', 'configuration_file', '=', 'h5_file', '.', 'filename', ...
Saving configuration to HDF5 file from register object Parameters ---------- register : pybar.fei4.register object configuration_file : string, file Filename of the HDF5 configuration file or file object. name : string Additional identifier (subgroup). Useful when storing mo...
['Saving', 'configuration', 'to', 'HDF5', 'file', 'from', 'register', 'object', 'Parameters', '----------', 'register', ':', 'pybar', '.', 'fei4', '.', 'register', 'object', 'configuration_file', ':', 'string', 'file', 'Filename', 'of', 'the', 'HDF5', 'configuration', 'file', 'or', 'file', 'object', '.', 'name', ':', '...
train
https://github.com/SiLab-Bonn/pyBAR/blob/5ad95bbcd41cd358825823fb78f396cfce23593e/pybar/fei4/register.py#L933-L1019
8,172
python-tap/tappy
tap/rules.py
Rules._process_plan_lines
def _process_plan_lines(self, final_line_count): """Process plan line rules.""" if not self._lines_seen["plan"]: self._add_error(_("Missing a plan.")) return if len(self._lines_seen["plan"]) > 1: self._add_error(_("Only one plan line is permitted per file."))...
python
def _process_plan_lines(self, final_line_count): """Process plan line rules.""" if not self._lines_seen["plan"]: self._add_error(_("Missing a plan.")) return if len(self._lines_seen["plan"]) > 1: self._add_error(_("Only one plan line is permitted per file."))...
['def', '_process_plan_lines', '(', 'self', ',', 'final_line_count', ')', ':', 'if', 'not', 'self', '.', '_lines_seen', '[', '"plan"', ']', ':', 'self', '.', '_add_error', '(', '_', '(', '"Missing a plan."', ')', ')', 'return', 'if', 'len', '(', 'self', '.', '_lines_seen', '[', '"plan"', ']', ')', '>', '1', ':', 'self'...
Process plan line rules.
['Process', 'plan', 'line', 'rules', '.']
train
https://github.com/python-tap/tappy/blob/79a749313c61ea94ee49d67ba6a1534974bc03aa/tap/rules.py#L28-L51
8,173
pazz/alot
alot/buffers/thread.py
ThreadBuffer.focus_next_sibling
def focus_next_sibling(self): """focus next sibling of currently focussed message in thread tree""" mid = self.get_selected_mid() newpos = self._tree.next_sibling_position(mid) if newpos is not None: newpos = self._sanitize_position((newpos,)) self.body.set_focus(...
python
def focus_next_sibling(self): """focus next sibling of currently focussed message in thread tree""" mid = self.get_selected_mid() newpos = self._tree.next_sibling_position(mid) if newpos is not None: newpos = self._sanitize_position((newpos,)) self.body.set_focus(...
['def', 'focus_next_sibling', '(', 'self', ')', ':', 'mid', '=', 'self', '.', 'get_selected_mid', '(', ')', 'newpos', '=', 'self', '.', '_tree', '.', 'next_sibling_position', '(', 'mid', ')', 'if', 'newpos', 'is', 'not', 'None', ':', 'newpos', '=', 'self', '.', '_sanitize_position', '(', '(', 'newpos', ',', ')', ')', '...
focus next sibling of currently focussed message in thread tree
['focus', 'next', 'sibling', 'of', 'currently', 'focussed', 'message', 'in', 'thread', 'tree']
train
https://github.com/pazz/alot/blob/d0297605c0ec1c6b65f541d0fd5b69ac5a0f4ded/alot/buffers/thread.py#L223-L229
8,174
yyuu/botornado
boto/dynamodb/item.py
Item.delete
def delete(self, expected_value=None, return_values=None): """ Delete the item from DynamoDB. :type expected_value: dict :param expected_value: A dictionary of name/value pairs that you expect. This dictionary should have name/value pairs where the name is the na...
python
def delete(self, expected_value=None, return_values=None): """ Delete the item from DynamoDB. :type expected_value: dict :param expected_value: A dictionary of name/value pairs that you expect. This dictionary should have name/value pairs where the name is the na...
['def', 'delete', '(', 'self', ',', 'expected_value', '=', 'None', ',', 'return_values', '=', 'None', ')', ':', 'return', 'self', '.', 'table', '.', 'layer2', '.', 'delete_item', '(', 'self', ',', 'expected_value', ',', 'return_values', ')']
Delete the item from DynamoDB. :type expected_value: dict :param expected_value: A dictionary of name/value pairs that you expect. This dictionary should have name/value pairs where the name is the name of the attribute and the value is either the value you are expec...
['Delete', 'the', 'item', 'from', 'DynamoDB', '.']
train
https://github.com/yyuu/botornado/blob/fffb056f5ff2324d1d5c1304014cfb1d899f602e/boto/dynamodb/item.py#L133-L152
8,175
pkgw/pwkit
pwkit/parallel.py
serial_ppmap
def serial_ppmap(func, fixed_arg, var_arg_iter): """A serial implementation of the "partially-pickling map" function returned by the :meth:`ParallelHelper.get_ppmap` interface. Its arguments are: *func* A callable taking three arguments and returning a Pickle-able value. *fixed_arg* Any val...
python
def serial_ppmap(func, fixed_arg, var_arg_iter): """A serial implementation of the "partially-pickling map" function returned by the :meth:`ParallelHelper.get_ppmap` interface. Its arguments are: *func* A callable taking three arguments and returning a Pickle-able value. *fixed_arg* Any val...
['def', 'serial_ppmap', '(', 'func', ',', 'fixed_arg', ',', 'var_arg_iter', ')', ':', 'return', '[', 'func', '(', 'i', ',', 'fixed_arg', ',', 'x', ')', 'for', 'i', ',', 'x', 'in', 'enumerate', '(', 'var_arg_iter', ')', ']']
A serial implementation of the "partially-pickling map" function returned by the :meth:`ParallelHelper.get_ppmap` interface. Its arguments are: *func* A callable taking three arguments and returning a Pickle-able value. *fixed_arg* Any value, even one that is not pickle-able. *var_arg_iter*...
['A', 'serial', 'implementation', 'of', 'the', 'partially', '-', 'pickling', 'map', 'function', 'returned', 'by', 'the', ':', 'meth', ':', 'ParallelHelper', '.', 'get_ppmap', 'interface', '.', 'Its', 'arguments', 'are', ':']
train
https://github.com/pkgw/pwkit/blob/d40957a1c3d2ea34e7ceac2267ee9635135f2793/pwkit/parallel.py#L231-L260
8,176
zsethna/OLGA
olga/load_model.py
GenerativeModelVDJ.load_and_process_igor_model
def load_and_process_igor_model(self, marginals_file_name): """Set attributes by reading a generative model from IGoR marginal file. Sets attributes PV, PdelV_given_V, PDJ, PdelJ_given_J, PdelDldelDr_given_D, PinsVD, PinsDJ, Rvd, and Rdj. Parameters ---------- ...
python
def load_and_process_igor_model(self, marginals_file_name): """Set attributes by reading a generative model from IGoR marginal file. Sets attributes PV, PdelV_given_V, PDJ, PdelJ_given_J, PdelDldelDr_given_D, PinsVD, PinsDJ, Rvd, and Rdj. Parameters ---------- ...
['def', 'load_and_process_igor_model', '(', 'self', ',', 'marginals_file_name', ')', ':', 'raw_model', '=', 'read_igor_marginals_txt', '(', 'marginals_file_name', ')', 'self', '.', 'PV', '=', 'raw_model', '[', '0', ']', '[', "'v_choice'", ']', 'self', '.', 'PinsVD', '=', 'raw_model', '[', '0', ']', '[', "'vd_ins'", ']'...
Set attributes by reading a generative model from IGoR marginal file. Sets attributes PV, PdelV_given_V, PDJ, PdelJ_given_J, PdelDldelDr_given_D, PinsVD, PinsDJ, Rvd, and Rdj. Parameters ---------- marginals_file_name : str File name for a IGoR mode...
['Set', 'attributes', 'by', 'reading', 'a', 'generative', 'model', 'from', 'IGoR', 'marginal', 'file', '.', 'Sets', 'attributes', 'PV', 'PdelV_given_V', 'PDJ', 'PdelJ_given_J', 'PdelDldelDr_given_D', 'PinsVD', 'PinsDJ', 'Rvd', 'and', 'Rdj', '.', 'Parameters', '----------', 'marginals_file_name', ':', 'str', 'File', 'na...
train
https://github.com/zsethna/OLGA/blob/e825c333f0f9a4eb02132e0bcf86f0dca9123114/olga/load_model.py#L681-L731
8,177
zhanglab/psamm
psamm/importer.py
main
def main(importer_class=None, args=None): """Entry point for import program. If the ``args`` are provided, these should be a list of strings that will be used instead of ``sys.argv[1:]``. This is mostly useful for testing. """ parser = argparse.ArgumentParser( description='Import from exter...
python
def main(importer_class=None, args=None): """Entry point for import program. If the ``args`` are provided, these should be a list of strings that will be used instead of ``sys.argv[1:]``. This is mostly useful for testing. """ parser = argparse.ArgumentParser( description='Import from exter...
['def', 'main', '(', 'importer_class', '=', 'None', ',', 'args', '=', 'None', ')', ':', 'parser', '=', 'argparse', '.', 'ArgumentParser', '(', 'description', '=', "'Import from external model formats'", ')', 'parser', '.', 'add_argument', '(', "'--source'", ',', 'metavar', '=', "'path'", ',', 'default', '=', "'.'", ','...
Entry point for import program. If the ``args`` are provided, these should be a list of strings that will be used instead of ``sys.argv[1:]``. This is mostly useful for testing.
['Entry', 'point', 'for', 'import', 'program', '.']
train
https://github.com/zhanglab/psamm/blob/dc427848c4f9d109ca590f0afa024c63b685b3f4/psamm/importer.py#L563-L700
8,178
tino/pyFirmata
pyfirmata/pyfirmata.py
Board.add_cmd_handler
def add_cmd_handler(self, cmd, func): """Adds a command handler for a command.""" len_args = len(inspect.getargspec(func)[0]) def add_meta(f): def decorator(*args, **kwargs): f(*args, **kwargs) decorator.bytes_needed = len_args - 1 # exclude self ...
python
def add_cmd_handler(self, cmd, func): """Adds a command handler for a command.""" len_args = len(inspect.getargspec(func)[0]) def add_meta(f): def decorator(*args, **kwargs): f(*args, **kwargs) decorator.bytes_needed = len_args - 1 # exclude self ...
['def', 'add_cmd_handler', '(', 'self', ',', 'cmd', ',', 'func', ')', ':', 'len_args', '=', 'len', '(', 'inspect', '.', 'getargspec', '(', 'func', ')', '[', '0', ']', ')', 'def', 'add_meta', '(', 'f', ')', ':', 'def', 'decorator', '(', '*', 'args', ',', '*', '*', 'kwargs', ')', ':', 'f', '(', '*', 'args', ',', '*', '*'...
Adds a command handler for a command.
['Adds', 'a', 'command', 'handler', 'for', 'a', 'command', '.']
train
https://github.com/tino/pyFirmata/blob/05881909c4d7c4e808e9ed457144670b2136706e/pyfirmata/pyfirmata.py#L183-L194
8,179
apache/spark
python/pyspark/rdd.py
RDD.mapValues
def mapValues(self, f): """ Pass each value in the key-value pair RDD through a map function without changing the keys; this also retains the original RDD's partitioning. >>> x = sc.parallelize([("a", ["apple", "banana", "lemon"]), ("b", ["grapes"])]) >>> def f(x): retur...
python
def mapValues(self, f): """ Pass each value in the key-value pair RDD through a map function without changing the keys; this also retains the original RDD's partitioning. >>> x = sc.parallelize([("a", ["apple", "banana", "lemon"]), ("b", ["grapes"])]) >>> def f(x): retur...
['def', 'mapValues', '(', 'self', ',', 'f', ')', ':', 'map_values_fn', '=', 'lambda', 'kv', ':', '(', 'kv', '[', '0', ']', ',', 'f', '(', 'kv', '[', '1', ']', ')', ')', 'return', 'self', '.', 'map', '(', 'map_values_fn', ',', 'preservesPartitioning', '=', 'True', ')']
Pass each value in the key-value pair RDD through a map function without changing the keys; this also retains the original RDD's partitioning. >>> x = sc.parallelize([("a", ["apple", "banana", "lemon"]), ("b", ["grapes"])]) >>> def f(x): return len(x) >>> x.mapValues(f).collect(...
['Pass', 'each', 'value', 'in', 'the', 'key', '-', 'value', 'pair', 'RDD', 'through', 'a', 'map', 'function', 'without', 'changing', 'the', 'keys', ';', 'this', 'also', 'retains', 'the', 'original', 'RDD', 's', 'partitioning', '.']
train
https://github.com/apache/spark/blob/618d6bff71073c8c93501ab7392c3cc579730f0b/python/pyspark/rdd.py#L1974-L1986
8,180
BernardFW/bernard
src/bernard/engine/fsm.py
FSM._make_register
def _make_register(self) -> BaseRegisterStore: """ Make the register storage. """ s = settings.REGISTER_STORE store_class = import_class(s['class']) return store_class(**s['params'])
python
def _make_register(self) -> BaseRegisterStore: """ Make the register storage. """ s = settings.REGISTER_STORE store_class = import_class(s['class']) return store_class(**s['params'])
['def', '_make_register', '(', 'self', ')', '->', 'BaseRegisterStore', ':', 's', '=', 'settings', '.', 'REGISTER_STORE', 'store_class', '=', 'import_class', '(', 's', '[', "'class'", ']', ')', 'return', 'store_class', '(', '*', '*', 's', '[', "'params'", ']', ')']
Make the register storage.
['Make', 'the', 'register', 'storage', '.']
train
https://github.com/BernardFW/bernard/blob/9c55703e5ffe5717c9fa39793df59dbfa5b4c5ab/src/bernard/engine/fsm.py#L141-L148
8,181
marshmallow-code/marshmallow
src/marshmallow/fields.py
Field.deserialize
def deserialize(self, value, attr=None, data=None, **kwargs): """Deserialize ``value``. :param value: The value to be deserialized. :param str attr: The attribute/key in `data` to be deserialized. :param dict data: The raw input data passed to the `Schema.load`. :param dict kwar...
python
def deserialize(self, value, attr=None, data=None, **kwargs): """Deserialize ``value``. :param value: The value to be deserialized. :param str attr: The attribute/key in `data` to be deserialized. :param dict data: The raw input data passed to the `Schema.load`. :param dict kwar...
['def', 'deserialize', '(', 'self', ',', 'value', ',', 'attr', '=', 'None', ',', 'data', '=', 'None', ',', '*', '*', 'kwargs', ')', ':', '# Validate required fields, deserialize, then validate', '# deserialized value', 'self', '.', '_validate_missing', '(', 'value', ')', 'if', 'value', 'is', 'missing_', ':', '_miss', '...
Deserialize ``value``. :param value: The value to be deserialized. :param str attr: The attribute/key in `data` to be deserialized. :param dict data: The raw input data passed to the `Schema.load`. :param dict kwargs': Field-specific keyword arguments. :raise ValidationError: If...
['Deserialize', 'value', '.']
train
https://github.com/marshmallow-code/marshmallow/blob/a6b6c4151f1fbf16f3774d4052ca2bddf6903750/src/marshmallow/fields.py#L285-L305
8,182
mlavin/argyle
argyle/postgres.py
create_db_user
def create_db_user(username, password=None, flags=None): """Create a databse user.""" flags = flags or u'-D -A -R' sudo(u'createuser %s %s' % (flags, username), user=u'postgres') if password: change_db_user_password(username, password)
python
def create_db_user(username, password=None, flags=None): """Create a databse user.""" flags = flags or u'-D -A -R' sudo(u'createuser %s %s' % (flags, username), user=u'postgres') if password: change_db_user_password(username, password)
['def', 'create_db_user', '(', 'username', ',', 'password', '=', 'None', ',', 'flags', '=', 'None', ')', ':', 'flags', '=', 'flags', 'or', "u'-D -A -R'", 'sudo', '(', "u'createuser %s %s'", '%', '(', 'flags', ',', 'username', ')', ',', 'user', '=', "u'postgres'", ')', 'if', 'password', ':', 'change_db_user_password', '...
Create a databse user.
['Create', 'a', 'databse', 'user', '.']
train
https://github.com/mlavin/argyle/blob/92cc6e1dd9b8e7cb41c5098a79d05e14b8243d72/argyle/postgres.py#L11-L17
8,183
almcc/cinder-data
cinder_data/store.py
Store.find_all
def find_all(self, model_class, params={}): """Return an list of models from the API and caches the result. Args: model_class (:class:`cinder_data.model.CinderModel`): A subclass of :class:`cinder_data.model.CinderModel` of your chosen model. params (dict, option...
python
def find_all(self, model_class, params={}): """Return an list of models from the API and caches the result. Args: model_class (:class:`cinder_data.model.CinderModel`): A subclass of :class:`cinder_data.model.CinderModel` of your chosen model. params (dict, option...
['def', 'find_all', '(', 'self', ',', 'model_class', ',', 'params', '=', '{', '}', ')', ':', 'url', '=', "'{host}/{namespace}/{model}{params}'", '.', 'format', '(', 'host', '=', 'self', '.', '_host', ',', 'namespace', '=', 'self', '.', '_namespace', ',', 'model', '=', 'self', '.', '_translate_name', '(', 'model_class',...
Return an list of models from the API and caches the result. Args: model_class (:class:`cinder_data.model.CinderModel`): A subclass of :class:`cinder_data.model.CinderModel` of your chosen model. params (dict, optional): Description Returns: list: A ...
['Return', 'an', 'list', 'of', 'models', 'from', 'the', 'API', 'and', 'caches', 'the', 'result', '.']
train
https://github.com/almcc/cinder-data/blob/4159a5186c4b4fc32354749892e86130530f6ec5/cinder_data/store.py#L57-L83
8,184
westonplatter/fast_arrow
fast_arrow/resources/option.py
Option.in_chain
def in_chain(cls, client, chain_id, expiration_dates=[]): """ fetch all option instruments in an options chain - expiration_dates = optionally scope """ request_url = "https://api.robinhood.com/options/instruments/" params = { "chain_id": chain_id, ...
python
def in_chain(cls, client, chain_id, expiration_dates=[]): """ fetch all option instruments in an options chain - expiration_dates = optionally scope """ request_url = "https://api.robinhood.com/options/instruments/" params = { "chain_id": chain_id, ...
['def', 'in_chain', '(', 'cls', ',', 'client', ',', 'chain_id', ',', 'expiration_dates', '=', '[', ']', ')', ':', 'request_url', '=', '"https://api.robinhood.com/options/instruments/"', 'params', '=', '{', '"chain_id"', ':', 'chain_id', ',', '"expiration_dates"', ':', '","', '.', 'join', '(', 'expiration_dates', ')', '...
fetch all option instruments in an options chain - expiration_dates = optionally scope
['fetch', 'all', 'option', 'instruments', 'in', 'an', 'options', 'chain', '-', 'expiration_dates', '=', 'optionally', 'scope']
train
https://github.com/westonplatter/fast_arrow/blob/514cbca4994f52a97222058167830a302e313d04/fast_arrow/resources/option.py#L65-L83
8,185
danidee10/Staticfy
staticfy/staticfy.py
get_elements
def get_elements(html_file, tags): """ Extract all the elements we're interested in. Returns a list of tuples with the attribute as first item and the list of elements as the second item. """ with open(html_file) as f: document = BeautifulSoup(f, 'html.parser') def condition(ta...
python
def get_elements(html_file, tags): """ Extract all the elements we're interested in. Returns a list of tuples with the attribute as first item and the list of elements as the second item. """ with open(html_file) as f: document = BeautifulSoup(f, 'html.parser') def condition(ta...
['def', 'get_elements', '(', 'html_file', ',', 'tags', ')', ':', 'with', 'open', '(', 'html_file', ')', 'as', 'f', ':', 'document', '=', 'BeautifulSoup', '(', 'f', ',', "'html.parser'", ')', 'def', 'condition', '(', 'tag', ',', 'attr', ')', ':', "# Don't include external links", 'return', 'lambda', 'x', ':', 'x', '.', ...
Extract all the elements we're interested in. Returns a list of tuples with the attribute as first item and the list of elements as the second item.
['Extract', 'all', 'the', 'elements', 'we', 're', 'interested', 'in', '.']
train
https://github.com/danidee10/Staticfy/blob/ebc555b00377394b0f714e4a173d37833fec90cb/staticfy/staticfy.py#L71-L89
8,186
zero-os/0-core
client/py-client/zeroos/core0/client/client.py
KvmManager.infops
def infops(self, uuid): """ Get info per second about a kvm domain by uuid :param uuid: uuid of the kvm container (same as the used in create) :return: """ args = { 'uuid': uuid, } self._domain_action_chk.check(args) return self._clien...
python
def infops(self, uuid): """ Get info per second about a kvm domain by uuid :param uuid: uuid of the kvm container (same as the used in create) :return: """ args = { 'uuid': uuid, } self._domain_action_chk.check(args) return self._clien...
['def', 'infops', '(', 'self', ',', 'uuid', ')', ':', 'args', '=', '{', "'uuid'", ':', 'uuid', ',', '}', 'self', '.', '_domain_action_chk', '.', 'check', '(', 'args', ')', 'return', 'self', '.', '_client', '.', 'json', '(', "'kvm.infops'", ',', 'args', ')']
Get info per second about a kvm domain by uuid :param uuid: uuid of the kvm container (same as the used in create) :return:
['Get', 'info', 'per', 'second', 'about', 'a', 'kvm', 'domain', 'by', 'uuid', ':', 'param', 'uuid', ':', 'uuid', 'of', 'the', 'kvm', 'container', '(', 'same', 'as', 'the', 'used', 'in', 'create', ')', ':', 'return', ':']
train
https://github.com/zero-os/0-core/blob/69f6ce845ab8b8ad805a79a415227e7ac566c218/client/py-client/zeroos/core0/client/client.py#L2404-L2415
8,187
JelteF/PyLaTeX
pylatex/figure.py
Figure.add_plot
def add_plot(self, *args, extension='pdf', **kwargs): """Add the current Matplotlib plot to the figure. The plot that gets added is the one that would normally be shown when using ``plt.show()``. Args ---- args: Arguments passed to plt.savefig for displaying...
python
def add_plot(self, *args, extension='pdf', **kwargs): """Add the current Matplotlib plot to the figure. The plot that gets added is the one that would normally be shown when using ``plt.show()``. Args ---- args: Arguments passed to plt.savefig for displaying...
['def', 'add_plot', '(', 'self', ',', '*', 'args', ',', 'extension', '=', "'pdf'", ',', '*', '*', 'kwargs', ')', ':', 'add_image_kwargs', '=', '{', '}', 'for', 'key', 'in', '(', "'width'", ',', "'placement'", ')', ':', 'if', 'key', 'in', 'kwargs', ':', 'add_image_kwargs', '[', 'key', ']', '=', 'kwargs', '.', 'pop', '('...
Add the current Matplotlib plot to the figure. The plot that gets added is the one that would normally be shown when using ``plt.show()``. Args ---- args: Arguments passed to plt.savefig for displaying the plot. extension : str extension of image...
['Add', 'the', 'current', 'Matplotlib', 'plot', 'to', 'the', 'figure', '.']
train
https://github.com/JelteF/PyLaTeX/blob/62d9d9912ce8445e6629cdbcb80ad86143a1ed23/pylatex/figure.py#L64-L91
8,188
erdewit/ib_insync
ib_insync/ib.py
IB.cancelMktDepth
def cancelMktDepth(self, contract: Contract, isSmartDepth=False): """ Unsubscribe from market depth data. Args: contract: The exact contract object that was used to subscribe with. """ ticker = self.ticker(contract) reqId = self.wrapper.endTic...
python
def cancelMktDepth(self, contract: Contract, isSmartDepth=False): """ Unsubscribe from market depth data. Args: contract: The exact contract object that was used to subscribe with. """ ticker = self.ticker(contract) reqId = self.wrapper.endTic...
['def', 'cancelMktDepth', '(', 'self', ',', 'contract', ':', 'Contract', ',', 'isSmartDepth', '=', 'False', ')', ':', 'ticker', '=', 'self', '.', 'ticker', '(', 'contract', ')', 'reqId', '=', 'self', '.', 'wrapper', '.', 'endTicker', '(', 'ticker', ',', "'mktDepth'", ')', 'if', 'reqId', ':', 'self', '.', 'client', '.',...
Unsubscribe from market depth data. Args: contract: The exact contract object that was used to subscribe with.
['Unsubscribe', 'from', 'market', 'depth', 'data', '.']
train
https://github.com/erdewit/ib_insync/blob/d0646a482590f5cb7bfddbd1f0870f8c4bc1df80/ib_insync/ib.py#L1242-L1256
8,189
JdeRobot/base
src/drivers/MAVLinkServer/MAVProxy/tools/MAVExplorer.py
flightmode_menu
def flightmode_menu(): '''construct flightmode menu''' modes = mestate.mlog.flightmode_list() ret = [] idx = 0 for (mode,t1,t2) in modes: modestr = "%s %us" % (mode, (t2-t1)) ret.append(MPMenuCheckbox(modestr, modestr, 'mode-%u' % idx)) idx += 1 mestate.flightmode_sel...
python
def flightmode_menu(): '''construct flightmode menu''' modes = mestate.mlog.flightmode_list() ret = [] idx = 0 for (mode,t1,t2) in modes: modestr = "%s %us" % (mode, (t2-t1)) ret.append(MPMenuCheckbox(modestr, modestr, 'mode-%u' % idx)) idx += 1 mestate.flightmode_sel...
['def', 'flightmode_menu', '(', ')', ':', 'modes', '=', 'mestate', '.', 'mlog', '.', 'flightmode_list', '(', ')', 'ret', '=', '[', ']', 'idx', '=', '0', 'for', '(', 'mode', ',', 't1', ',', 't2', ')', 'in', 'modes', ':', 'modestr', '=', '"%s %us"', '%', '(', 'mode', ',', '(', 't2', '-', 't1', ')', ')', 'ret', '.', 'appe...
construct flightmode menu
['construct', 'flightmode', 'menu']
train
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/tools/MAVExplorer.py#L92-L102
8,190
dpgaspar/Flask-AppBuilder
flask_appbuilder/forms.py
GeneralModelConverter._convert_many_to_one
def _convert_many_to_one(self, col_name, label, description, lst_validators, filter_rel_fields, form_props): """ Creates a WTForm field for many to one related fields, will use a Select box based on a query. Will only ...
python
def _convert_many_to_one(self, col_name, label, description, lst_validators, filter_rel_fields, form_props): """ Creates a WTForm field for many to one related fields, will use a Select box based on a query. Will only ...
['def', '_convert_many_to_one', '(', 'self', ',', 'col_name', ',', 'label', ',', 'description', ',', 'lst_validators', ',', 'filter_rel_fields', ',', 'form_props', ')', ':', 'query_func', '=', 'self', '.', '_get_related_query_func', '(', 'col_name', ',', 'filter_rel_fields', ')', 'get_pk_func', '=', 'self', '.', '_get_...
Creates a WTForm field for many to one related fields, will use a Select box based on a query. Will only work with SQLAlchemy interface.
['Creates', 'a', 'WTForm', 'field', 'for', 'many', 'to', 'one', 'related', 'fields', 'will', 'use', 'a', 'Select', 'box', 'based', 'on', 'a', 'query', '.', 'Will', 'only', 'work', 'with', 'SQLAlchemy', 'interface', '.']
train
https://github.com/dpgaspar/Flask-AppBuilder/blob/c293734c1b86e176a3ba57ee2deab6676d125576/flask_appbuilder/forms.py#L136-L161
8,191
Microsoft/azure-devops-python-api
azure-devops/azure/devops/v5_0/work/work_client.py
WorkClient.create_plan
def create_plan(self, posted_plan, project): """CreatePlan. Add a new plan for the team :param :class:`<CreatePlan> <azure.devops.v5_0.work.models.CreatePlan>` posted_plan: Plan definition :param str project: Project ID or project name :rtype: :class:`<Plan> <azure.devops.v5_0.wo...
python
def create_plan(self, posted_plan, project): """CreatePlan. Add a new plan for the team :param :class:`<CreatePlan> <azure.devops.v5_0.work.models.CreatePlan>` posted_plan: Plan definition :param str project: Project ID or project name :rtype: :class:`<Plan> <azure.devops.v5_0.wo...
['def', 'create_plan', '(', 'self', ',', 'posted_plan', ',', 'project', ')', ':', 'route_values', '=', '{', '}', 'if', 'project', 'is', 'not', 'None', ':', 'route_values', '[', "'project'", ']', '=', 'self', '.', '_serialize', '.', 'url', '(', "'project'", ',', 'project', ',', "'str'", ')', 'content', '=', 'self', '.',...
CreatePlan. Add a new plan for the team :param :class:`<CreatePlan> <azure.devops.v5_0.work.models.CreatePlan>` posted_plan: Plan definition :param str project: Project ID or project name :rtype: :class:`<Plan> <azure.devops.v5_0.work.models.Plan>`
['CreatePlan', '.', 'Add', 'a', 'new', 'plan', 'for', 'the', 'team', ':', 'param', ':', 'class', ':', '<CreatePlan', '>', '<azure', '.', 'devops', '.', 'v5_0', '.', 'work', '.', 'models', '.', 'CreatePlan', '>', 'posted_plan', ':', 'Plan', 'definition', ':', 'param', 'str', 'project', ':', 'Project', 'ID', 'or', 'proje...
train
https://github.com/Microsoft/azure-devops-python-api/blob/4777ffda2f5052fabbaddb2abe9cb434e0cf1aa8/azure-devops/azure/devops/v5_0/work/work_client.py#L984-L1000
8,192
yeasy/hyperledger-py
hyperledger/api/chaincode.py
ChainCodeApiMixin.chaincode_query
def chaincode_query(self, chaincode_name, type=CHAINCODE_LANG_GO, function="query", args=["a"], id=1, secure_context=None, confidentiality_level=CHAINCODE_CONFIDENTIAL_PUB, metadata=None): """...
python
def chaincode_query(self, chaincode_name, type=CHAINCODE_LANG_GO, function="query", args=["a"], id=1, secure_context=None, confidentiality_level=CHAINCODE_CONFIDENTIAL_PUB, metadata=None): """...
['def', 'chaincode_query', '(', 'self', ',', 'chaincode_name', ',', 'type', '=', 'CHAINCODE_LANG_GO', ',', 'function', '=', '"query"', ',', 'args', '=', '[', '"a"', ']', ',', 'id', '=', '1', ',', 'secure_context', '=', 'None', ',', 'confidentiality_level', '=', 'CHAINCODE_CONFIDENTIAL_PUB', ',', 'metadata', '=', 'None'...
{ "jsonrpc": "2.0", "method": "query", "params": { "type": 1, "chaincodeID":{ "name":"52b0d803fc395b5e34d8d4a7cd69fb6aa00099b8fabed83504ac1c5d61a425aca5b3ad3bf96643ea4fdaac132c417c37b00f88fa800de7ece387d008a76d3586" }, ...
['{', 'jsonrpc', ':', '2', '.', '0', 'method', ':', 'query', 'params', ':', '{', 'type', ':', '1', 'chaincodeID', ':', '{', 'name', ':', '52b0d803fc395b5e34d8d4a7cd69fb6aa00099b8fabed83504ac1c5d61a425aca5b3ad3bf96643ea4fdaac132c417c37b00f88fa800de7ece387d008a76d3586', '}', 'ctorMsg', ':', '{', 'function', ':', 'query',...
train
https://github.com/yeasy/hyperledger-py/blob/f24e9cc409b50628b911950466786be6fe74f09f/hyperledger/api/chaincode.py#L153-L182
8,193
brocade/pynos
pynos/versions/ver_6/ver_6_0_1/yang/brocade_ip_policy.py
brocade_ip_policy.hide_routemap_holder_route_map_content_set_ipv6_next_vrf_next_vrf_list_next_hop
def hide_routemap_holder_route_map_content_set_ipv6_next_vrf_next_vrf_list_next_hop(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") hide_routemap_holder = ET.SubElement(config, "hide-routemap-holder", xmlns="urn:brocade.com:mgmt:brocade-ip-policy") route...
python
def hide_routemap_holder_route_map_content_set_ipv6_next_vrf_next_vrf_list_next_hop(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") hide_routemap_holder = ET.SubElement(config, "hide-routemap-holder", xmlns="urn:brocade.com:mgmt:brocade-ip-policy") route...
['def', 'hide_routemap_holder_route_map_content_set_ipv6_next_vrf_next_vrf_list_next_hop', '(', 'self', ',', '*', '*', 'kwargs', ')', ':', 'config', '=', 'ET', '.', 'Element', '(', '"config"', ')', 'hide_routemap_holder', '=', 'ET', '.', 'SubElement', '(', 'config', ',', '"hide-routemap-holder"', ',', 'xmlns', '=', '"u...
Auto Generated Code
['Auto', 'Generated', 'Code']
train
https://github.com/brocade/pynos/blob/bd8a34e98f322de3fc06750827d8bbc3a0c00380/pynos/versions/ver_6/ver_6_0_1/yang/brocade_ip_policy.py#L698-L721
8,194
priestc/moneywagon
moneywagon/currency_support.py
CurrencySupport.supported_currencies
def supported_currencies(self, project='moneywagon', level="full"): """ Returns a list of all currencies that are supported by the passed in project. and support level. Support level can be: "block", "transaction", "address" or "full". """ ret = [] if project == '...
python
def supported_currencies(self, project='moneywagon', level="full"): """ Returns a list of all currencies that are supported by the passed in project. and support level. Support level can be: "block", "transaction", "address" or "full". """ ret = [] if project == '...
['def', 'supported_currencies', '(', 'self', ',', 'project', '=', "'moneywagon'", ',', 'level', '=', '"full"', ')', ':', 'ret', '=', '[', ']', 'if', 'project', '==', "'multiexplorer-wallet'", ':', 'for', 'currency', ',', 'data', 'in', 'self', '.', 'sorted_crypto_data', ':', 'if', 'not', 'data', '.', 'get', '(', '"bip44...
Returns a list of all currencies that are supported by the passed in project. and support level. Support level can be: "block", "transaction", "address" or "full".
['Returns', 'a', 'list', 'of', 'all', 'currencies', 'that', 'are', 'supported', 'by', 'the', 'passed', 'in', 'project', '.', 'and', 'support', 'level', '.', 'Support', 'level', 'can', 'be', ':', 'block', 'transaction', 'address', 'or', 'full', '.']
train
https://github.com/priestc/moneywagon/blob/00518f1f557dcca8b3031f46d3564c2baa0227a3/moneywagon/currency_support.py#L55-L84
8,195
bunq/sdk_python
bunq/sdk/model/core.py
SessionServer.get_referenced_user
def get_referenced_user(self): """ :rtype: BunqModel """ if self._user_person is not None: return self._user_person if self._user_company is not None: return self._user_company if self._user_api_key is not None: return self._user_api...
python
def get_referenced_user(self): """ :rtype: BunqModel """ if self._user_person is not None: return self._user_person if self._user_company is not None: return self._user_company if self._user_api_key is not None: return self._user_api...
['def', 'get_referenced_user', '(', 'self', ')', ':', 'if', 'self', '.', '_user_person', 'is', 'not', 'None', ':', 'return', 'self', '.', '_user_person', 'if', 'self', '.', '_user_company', 'is', 'not', 'None', ':', 'return', 'self', '.', '_user_company', 'if', 'self', '.', '_user_api_key', 'is', 'not', 'None', ':', 'r...
:rtype: BunqModel
[':', 'rtype', ':', 'BunqModel']
train
https://github.com/bunq/sdk_python/blob/da6c9b83e6d83ee8062617f53c6eb7293c0d863d/bunq/sdk/model/core.py#L507-L521
8,196
awslabs/serverless-application-model
samtranslator/translator/logical_id_generator.py
LogicalIdGenerator.get_hash
def get_hash(self, length=HASH_LENGTH): """ Generate and return a hash of data that can be used as suffix of logicalId :return: Hash of data if it was present :rtype string """ data_hash = "" if not self.data_str: return data_hash encoded_da...
python
def get_hash(self, length=HASH_LENGTH): """ Generate and return a hash of data that can be used as suffix of logicalId :return: Hash of data if it was present :rtype string """ data_hash = "" if not self.data_str: return data_hash encoded_da...
['def', 'get_hash', '(', 'self', ',', 'length', '=', 'HASH_LENGTH', ')', ':', 'data_hash', '=', '""', 'if', 'not', 'self', '.', 'data_str', ':', 'return', 'data_hash', 'encoded_data_str', '=', 'self', '.', 'data_str', 'if', 'sys', '.', 'version_info', '.', 'major', '==', '2', ':', '# In Py2, only unicode needs to be en...
Generate and return a hash of data that can be used as suffix of logicalId :return: Hash of data if it was present :rtype string
['Generate', 'and', 'return', 'a', 'hash', 'of', 'data', 'that', 'can', 'be', 'used', 'as', 'suffix', 'of', 'logicalId']
train
https://github.com/awslabs/serverless-application-model/blob/cccb0c96b5c91e53355ebc07e542467303a5eedd/samtranslator/translator/logical_id_generator.py#L49-L72
8,197
Gjum/agarnet
agarnet/client.py
Client.send_respawn
def send_respawn(self): """ Respawns the player. """ nick = self.player.nick self.send_struct('<B%iH' % len(nick), 0, *map(ord, nick))
python
def send_respawn(self): """ Respawns the player. """ nick = self.player.nick self.send_struct('<B%iH' % len(nick), 0, *map(ord, nick))
['def', 'send_respawn', '(', 'self', ')', ':', 'nick', '=', 'self', '.', 'player', '.', 'nick', 'self', '.', 'send_struct', '(', "'<B%iH'", '%', 'len', '(', 'nick', ')', ',', '0', ',', '*', 'map', '(', 'ord', ',', 'nick', ')', ')']
Respawns the player.
['Respawns', 'the', 'player', '.']
train
https://github.com/Gjum/agarnet/blob/63365ba32aa31c23a6d61438b556ceb8ed65631f/agarnet/client.py#L406-L411
8,198
sdispater/poetry
poetry/masonry/api.py
build_sdist
def build_sdist(sdist_directory, config_settings=None): """Builds an sdist, places it in sdist_directory""" poetry = Poetry.create(".") path = SdistBuilder(poetry, SystemEnv(Path(sys.prefix)), NullIO()).build( Path(sdist_directory) ) return unicode(path.name)
python
def build_sdist(sdist_directory, config_settings=None): """Builds an sdist, places it in sdist_directory""" poetry = Poetry.create(".") path = SdistBuilder(poetry, SystemEnv(Path(sys.prefix)), NullIO()).build( Path(sdist_directory) ) return unicode(path.name)
['def', 'build_sdist', '(', 'sdist_directory', ',', 'config_settings', '=', 'None', ')', ':', 'poetry', '=', 'Poetry', '.', 'create', '(', '"."', ')', 'path', '=', 'SdistBuilder', '(', 'poetry', ',', 'SystemEnv', '(', 'Path', '(', 'sys', '.', 'prefix', ')', ')', ',', 'NullIO', '(', ')', ')', '.', 'build', '(', 'Path', ...
Builds an sdist, places it in sdist_directory
['Builds', 'an', 'sdist', 'places', 'it', 'in', 'sdist_directory']
train
https://github.com/sdispater/poetry/blob/2d27acd76c165dd49f11934520a7973de7a3762a/poetry/masonry/api.py#L65-L73
8,199
jobovy/galpy
galpy/df/evolveddiskdf.py
evolveddiskdf.meanvR
def meanvR(self,R,t=0.,nsigma=None,deg=False,phi=0., epsrel=1.e-02,epsabs=1.e-05, grid=None,gridpoints=101,returnGrid=False, surfacemass=None, hierarchgrid=False,nlevels=2,integrate_method='dopr54_c'): """ NAME: meanvR PURP...
python
def meanvR(self,R,t=0.,nsigma=None,deg=False,phi=0., epsrel=1.e-02,epsabs=1.e-05, grid=None,gridpoints=101,returnGrid=False, surfacemass=None, hierarchgrid=False,nlevels=2,integrate_method='dopr54_c'): """ NAME: meanvR PURP...
['def', 'meanvR', '(', 'self', ',', 'R', ',', 't', '=', '0.', ',', 'nsigma', '=', 'None', ',', 'deg', '=', 'False', ',', 'phi', '=', '0.', ',', 'epsrel', '=', '1.e-02', ',', 'epsabs', '=', '1.e-05', ',', 'grid', '=', 'None', ',', 'gridpoints', '=', '101', ',', 'returnGrid', '=', 'False', ',', 'surfacemass', '=', 'None'...
NAME: meanvR PURPOSE: calculate the mean vR of the velocity distribution at (R,phi) INPUT: R - radius at which to calculate the moment(/ro) (can be Quantity) phi= azimuth (rad unless deg=True; can be Quantity) t= time at which to evaluate the...
['NAME', ':']
train
https://github.com/jobovy/galpy/blob/9c5b9fe65d58835624dffe432be282060918ee08/galpy/df/evolveddiskdf.py#L597-L695