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
2,100
commonsense/metanl
metanl/nltk_morphy.py
normalize_topic
def normalize_topic(topic): """ Get a canonical representation of a Wikipedia topic, which may include a disambiguation string in parentheses. Returns (name, disambig), where "name" is the normalized topic name, and "disambig" is a string corresponding to the disambiguation text or None. ""...
python
def normalize_topic(topic): """ Get a canonical representation of a Wikipedia topic, which may include a disambiguation string in parentheses. Returns (name, disambig), where "name" is the normalized topic name, and "disambig" is a string corresponding to the disambiguation text or None. ""...
['def', 'normalize_topic', '(', 'topic', ')', ':', '# find titles of the form Foo (bar)', 'topic', '=', 'topic', '.', 'replace', '(', "'_'", ',', "' '", ')', 'match', '=', 're', '.', 'match', '(', "r'([^(]+) \\(([^)]+)\\)'", ',', 'topic', ')', 'if', 'not', 'match', ':', 'return', 'normalize', '(', 'topic', ')', ',', 'N...
Get a canonical representation of a Wikipedia topic, which may include a disambiguation string in parentheses. Returns (name, disambig), where "name" is the normalized topic name, and "disambig" is a string corresponding to the disambiguation text or None.
['Get', 'a', 'canonical', 'representation', 'of', 'a', 'Wikipedia', 'topic', 'which', 'may', 'include', 'a', 'disambiguation', 'string', 'in', 'parentheses', '.']
train
https://github.com/commonsense/metanl/blob/4b9ae8353489cc409bebd7e1fe10ab5b527b078e/metanl/nltk_morphy.py#L205-L220
2,101
rshk/python-libxdo
xdo/xdo.py
_errcheck
def _errcheck(result, func, arguments): """ Error checker for functions returning an integer indicating success (0) / failure (1). Raises a XdoException in case of error, otherwise just returns ``None`` (returning the original code, 0, would be useless anyways..) """ if result != 0: ...
python
def _errcheck(result, func, arguments): """ Error checker for functions returning an integer indicating success (0) / failure (1). Raises a XdoException in case of error, otherwise just returns ``None`` (returning the original code, 0, would be useless anyways..) """ if result != 0: ...
['def', '_errcheck', '(', 'result', ',', 'func', ',', 'arguments', ')', ':', 'if', 'result', '!=', '0', ':', 'raise', 'XdoException', '(', "'Function {0} returned error code {1}'", '.', 'format', '(', 'func', '.', '__name__', ',', 'result', ')', ')', 'return', 'None']
Error checker for functions returning an integer indicating success (0) / failure (1). Raises a XdoException in case of error, otherwise just returns ``None`` (returning the original code, 0, would be useless anyways..)
['Error', 'checker', 'for', 'functions', 'returning', 'an', 'integer', 'indicating', 'success', '(', '0', ')', '/', 'failure', '(', '1', ')', '.']
train
https://github.com/rshk/python-libxdo/blob/84cafa5943b005bc423edd28203a5266b3579ac3/xdo/xdo.py#L37-L51
2,102
twilio/twilio-python
twilio/rest/sync/v1/service/__init__.py
ServiceInstance.update
def update(self, webhook_url=values.unset, friendly_name=values.unset, reachability_webhooks_enabled=values.unset, acl_enabled=values.unset): """ Update the ServiceInstance :param unicode webhook_url: A URL that will receive event updates when objects are manipulat...
python
def update(self, webhook_url=values.unset, friendly_name=values.unset, reachability_webhooks_enabled=values.unset, acl_enabled=values.unset): """ Update the ServiceInstance :param unicode webhook_url: A URL that will receive event updates when objects are manipulat...
['def', 'update', '(', 'self', ',', 'webhook_url', '=', 'values', '.', 'unset', ',', 'friendly_name', '=', 'values', '.', 'unset', ',', 'reachability_webhooks_enabled', '=', 'values', '.', 'unset', ',', 'acl_enabled', '=', 'values', '.', 'unset', ')', ':', 'return', 'self', '.', '_proxy', '.', 'update', '(', 'webhook_u...
Update the ServiceInstance :param unicode webhook_url: A URL that will receive event updates when objects are manipulated. :param unicode friendly_name: Human-readable name for this service instance :param bool reachability_webhooks_enabled: True or false - controls whether this instance fires ...
['Update', 'the', 'ServiceInstance']
train
https://github.com/twilio/twilio-python/blob/c867895f55dcc29f522e6e8b8868d0d18483132f/twilio/rest/sync/v1/service/__init__.py#L513-L532
2,103
greyli/flask-avatars
flask_avatars/__init__.py
_Avatars.init_jcrop
def init_jcrop(min_size=None): """Initialize jcrop. :param min_size: The minimal size of crop area. """ init_x = current_app.config['AVATARS_CROP_INIT_POS'][0] init_y = current_app.config['AVATARS_CROP_INIT_POS'][1] init_size = current_app.config['AVATARS_CROP_INIT_SIZE'...
python
def init_jcrop(min_size=None): """Initialize jcrop. :param min_size: The minimal size of crop area. """ init_x = current_app.config['AVATARS_CROP_INIT_POS'][0] init_y = current_app.config['AVATARS_CROP_INIT_POS'][1] init_size = current_app.config['AVATARS_CROP_INIT_SIZE'...
['def', 'init_jcrop', '(', 'min_size', '=', 'None', ')', ':', 'init_x', '=', 'current_app', '.', 'config', '[', "'AVATARS_CROP_INIT_POS'", ']', '[', '0', ']', 'init_y', '=', 'current_app', '.', 'config', '[', "'AVATARS_CROP_INIT_POS'", ']', '[', '1', ']', 'init_size', '=', 'current_app', '.', 'config', '[', "'AVATARS_C...
Initialize jcrop. :param min_size: The minimal size of crop area.
['Initialize', 'jcrop', '.']
train
https://github.com/greyli/flask-avatars/blob/13eca90342349c58962fef0ec541edcb1b009c70/flask_avatars/__init__.py#L157-L226
2,104
jobovy/galpy
galpy/util/bovy_coords.py
scalarDecorator
def scalarDecorator(func): """Decorator to return scalar outputs as a set""" @wraps(func) def scalar_wrapper(*args,**kwargs): if nu.array(args[0]).shape == (): scalarOut= True newargs= () for ii in range(len(args)): newargs= newargs+(nu.array([args...
python
def scalarDecorator(func): """Decorator to return scalar outputs as a set""" @wraps(func) def scalar_wrapper(*args,**kwargs): if nu.array(args[0]).shape == (): scalarOut= True newargs= () for ii in range(len(args)): newargs= newargs+(nu.array([args...
['def', 'scalarDecorator', '(', 'func', ')', ':', '@', 'wraps', '(', 'func', ')', 'def', 'scalar_wrapper', '(', '*', 'args', ',', '*', '*', 'kwargs', ')', ':', 'if', 'nu', '.', 'array', '(', 'args', '[', '0', ']', ')', '.', 'shape', '==', '(', ')', ':', 'scalarOut', '=', 'True', 'newargs', '=', '(', ')', 'for', 'ii', '...
Decorator to return scalar outputs as a set
['Decorator', 'to', 'return', 'scalar', 'outputs', 'as', 'a', 'set']
train
https://github.com/jobovy/galpy/blob/9c5b9fe65d58835624dffe432be282060918ee08/galpy/util/bovy_coords.py#L106-L126
2,105
stbraun/fuzzing
features/steps/ft_fuzzer.py
step_impl10
def step_impl10(context): """Create application list. :param context: test context. """ assert context.app_list and len( context.app_list) > 0, "ENSURE: app list is provided." assert context.file_list and len( context.file_list) > 0, "ENSURE: file list is provided." context.fuzz...
python
def step_impl10(context): """Create application list. :param context: test context. """ assert context.app_list and len( context.app_list) > 0, "ENSURE: app list is provided." assert context.file_list and len( context.file_list) > 0, "ENSURE: file list is provided." context.fuzz...
['def', 'step_impl10', '(', 'context', ')', ':', 'assert', 'context', '.', 'app_list', 'and', 'len', '(', 'context', '.', 'app_list', ')', '>', '0', ',', '"ENSURE: app list is provided."', 'assert', 'context', '.', 'file_list', 'and', 'len', '(', 'context', '.', 'file_list', ')', '>', '0', ',', '"ENSURE: file list is p...
Create application list. :param context: test context.
['Create', 'application', 'list', '.']
train
https://github.com/stbraun/fuzzing/blob/974a64472732d4e40db919d242149bf0856fe199/features/steps/ft_fuzzer.py#L120-L130
2,106
limix/limix-core
limix_core/mean/linear.py
Linear.removeFixedEffect
def removeFixedEffect(self, index=None): """ set sample and trait designs F: NxK sample design A: LxP sample design REML: REML for this term? index: index of which fixed effect to replace. If None, remove last term. """ if self._n_terms==0: ...
python
def removeFixedEffect(self, index=None): """ set sample and trait designs F: NxK sample design A: LxP sample design REML: REML for this term? index: index of which fixed effect to replace. If None, remove last term. """ if self._n_terms==0: ...
['def', 'removeFixedEffect', '(', 'self', ',', 'index', '=', 'None', ')', ':', 'if', 'self', '.', '_n_terms', '==', '0', ':', 'pass', 'if', 'index', 'is', 'None', 'or', 'index', '==', '(', 'self', '.', '_n_terms', '-', '1', ')', ':', 'self', '.', '_n_terms', '-=', '1', 'F', '=', 'self', '.', '_F', '.', 'pop', '(', ')',...
set sample and trait designs F: NxK sample design A: LxP sample design REML: REML for this term? index: index of which fixed effect to replace. If None, remove last term.
['set', 'sample', 'and', 'trait', 'designs', 'F', ':', 'NxK', 'sample', 'design', 'A', ':', 'LxP', 'sample', 'design', 'REML', ':', 'REML', 'for', 'this', 'term?', 'index', ':', 'index', 'of', 'which', 'fixed', 'effect', 'to', 'replace', '.', 'If', 'None', 'remove', 'last', 'term', '.']
train
https://github.com/limix/limix-core/blob/5c590b4d351409f83ca320844b4897ce92203814/limix_core/mean/linear.py#L219-L251
2,107
AnalogJ/lexicon
lexicon/config.py
ConfigResolver.with_config_dir
def with_config_dir(self, dir_path): """ Configure current resolver to use every valid YAML configuration files available in the given directory path. To be taken into account, a configuration file must conform to the following naming convention: * 'lexicon.yml' for a global ...
python
def with_config_dir(self, dir_path): """ Configure current resolver to use every valid YAML configuration files available in the given directory path. To be taken into account, a configuration file must conform to the following naming convention: * 'lexicon.yml' for a global ...
['def', 'with_config_dir', '(', 'self', ',', 'dir_path', ')', ':', 'lexicon_provider_config_files', '=', '[', ']', 'lexicon_config_files', '=', '[', ']', 'for', 'path', 'in', 'os', '.', 'listdir', '(', 'dir_path', ')', ':', 'path', '=', 'os', '.', 'path', '.', 'join', '(', 'dir_path', ',', 'path', ')', 'if', 'os', '.',...
Configure current resolver to use every valid YAML configuration files available in the given directory path. To be taken into account, a configuration file must conform to the following naming convention: * 'lexicon.yml' for a global Lexicon config file (see with_config_file doc) ...
['Configure', 'current', 'resolver', 'to', 'use', 'every', 'valid', 'YAML', 'configuration', 'files', 'available', 'in', 'the', 'given', 'directory', 'path', '.', 'To', 'be', 'taken', 'into', 'account', 'a', 'configuration', 'file', 'must', 'conform', 'to', 'the', 'following', 'naming', 'convention', ':', '*', 'lexicon...
train
https://github.com/AnalogJ/lexicon/blob/9330b871988753cad44fe2876a217b4c67b1fa0e/lexicon/config.py#L153-L189
2,108
dw/mitogen
mitogen/master.py
ThreadWatcher._reset
def _reset(cls): """If we have forked since the watch dictionaries were initialized, all that has is garbage, so clear it.""" if os.getpid() != cls._cls_pid: cls._cls_pid = os.getpid() cls._cls_instances_by_target.clear() cls._cls_thread_by_target.clear()
python
def _reset(cls): """If we have forked since the watch dictionaries were initialized, all that has is garbage, so clear it.""" if os.getpid() != cls._cls_pid: cls._cls_pid = os.getpid() cls._cls_instances_by_target.clear() cls._cls_thread_by_target.clear()
['def', '_reset', '(', 'cls', ')', ':', 'if', 'os', '.', 'getpid', '(', ')', '!=', 'cls', '.', '_cls_pid', ':', 'cls', '.', '_cls_pid', '=', 'os', '.', 'getpid', '(', ')', 'cls', '.', '_cls_instances_by_target', '.', 'clear', '(', ')', 'cls', '.', '_cls_thread_by_target', '.', 'clear', '(', ')']
If we have forked since the watch dictionaries were initialized, all that has is garbage, so clear it.
['If', 'we', 'have', 'forked', 'since', 'the', 'watch', 'dictionaries', 'were', 'initialized', 'all', 'that', 'has', 'is', 'garbage', 'so', 'clear', 'it', '.']
train
https://github.com/dw/mitogen/blob/a7fdb55e1300a7e0a5e404b09eb730cf9a525da7/mitogen/master.py#L256-L262
2,109
ctuning/ck
ck/kernel.py
select
def select(i): """ Input: { dict - dict with values being dicts with 'name' as string to display and 'sort' as int (for ordering) (title) - print title (error_if_empty) - if 'yes' and Enter, make error (skip_sort) - if 'yes', do ...
python
def select(i): """ Input: { dict - dict with values being dicts with 'name' as string to display and 'sort' as int (for ordering) (title) - print title (error_if_empty) - if 'yes' and Enter, make error (skip_sort) - if 'yes', do ...
['def', 'select', '(', 'i', ')', ':', 's', '=', "''", 'title', '=', 'i', '.', 'get', '(', "'title'", ',', "''", ')', 'if', 'title', '!=', "''", ':', 'out', '(', 'title', ')', 'out', '(', "''", ')', 'd', '=', 'i', '[', "'dict'", ']', 'if', 'i', '.', 'get', '(', "'skip_sort'", ',', "''", ')', '!=', "'yes'", ':', 'kd', '=...
Input: { dict - dict with values being dicts with 'name' as string to display and 'sort' as int (for ordering) (title) - print title (error_if_empty) - if 'yes' and Enter, make error (skip_sort) - if 'yes', do not sort array ...
['Input', ':', '{', 'dict', '-', 'dict', 'with', 'values', 'being', 'dicts', 'with', 'name', 'as', 'string', 'to', 'display', 'and', 'sort', 'as', 'int', '(', 'for', 'ordering', ')', '(', 'title', ')', '-', 'print', 'title', '(', 'error_if_empty', ')', '-', 'if', 'yes', 'and', 'Enter', 'make', 'error', '(', 'skip_sort'...
train
https://github.com/ctuning/ck/blob/7e009814e975f8742790d3106340088a46223714/ck/kernel.py#L837-L895
2,110
saltstack/salt
salt/states/lxd_container.py
present
def present(name, running=None, source=None, profiles=None, config=None, devices=None, architecture='x86_64', ephemeral=False, restart_on_change=False, remote_addr=None, cert=None, key=Non...
python
def present(name, running=None, source=None, profiles=None, config=None, devices=None, architecture='x86_64', ephemeral=False, restart_on_change=False, remote_addr=None, cert=None, key=Non...
['def', 'present', '(', 'name', ',', 'running', '=', 'None', ',', 'source', '=', 'None', ',', 'profiles', '=', 'None', ',', 'config', '=', 'None', ',', 'devices', '=', 'None', ',', 'architecture', '=', "'x86_64'", ',', 'ephemeral', '=', 'False', ',', 'restart_on_change', '=', 'False', ',', 'remote_addr', '=', 'None', '...
Create the named container if it does not exist name The name of the container to be created running : None * If ``True``, ensure that the container is running * If ``False``, ensure that the container is stopped * If ``None``, do nothing with regards to the running state of th...
['Create', 'the', 'named', 'container', 'if', 'it', 'does', 'not', 'exist']
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/lxd_container.py#L57-L360
2,111
MrYsLab/pymata-aio
pymata_aio/pymata_core.py
PymataCore.start
def start(self): """ This method must be called immediately after the class is instantiated. It instantiates the serial interface and then performs auto pin discovery. It is intended for use by pymata3 applications that do not use asyncio coroutines directly. :re...
python
def start(self): """ This method must be called immediately after the class is instantiated. It instantiates the serial interface and then performs auto pin discovery. It is intended for use by pymata3 applications that do not use asyncio coroutines directly. :re...
['def', 'start', '(', 'self', ')', ':', '# check if user specified a socket transport', 'if', 'self', '.', 'ip_address', ':', 'self', '.', 'socket', '=', 'PymataSocket', '(', 'self', '.', 'ip_address', ',', 'self', '.', 'ip_port', ',', 'self', '.', 'loop', ')', 'self', '.', 'loop', '.', 'run_until_complete', '(', '(', ...
This method must be called immediately after the class is instantiated. It instantiates the serial interface and then performs auto pin discovery. It is intended for use by pymata3 applications that do not use asyncio coroutines directly. :returns: No return value.
['This', 'method', 'must', 'be', 'called', 'immediately', 'after', 'the', 'class', 'is', 'instantiated', '.', 'It', 'instantiates', 'the', 'serial', 'interface', 'and', 'then', 'performs', 'auto', 'pin', 'discovery', '.', 'It', 'is', 'intended', 'for', 'use', 'by', 'pymata3', 'applications', 'that', 'do', 'not', 'use',...
train
https://github.com/MrYsLab/pymata-aio/blob/015081a4628b9d47dfe3f8d6c698ff903f107810/pymata_aio/pymata_core.py#L260-L369
2,112
Aula13/poloniex
poloniex/poloniex.py
PoloniexPublic.returnTradeHistory
def returnTradeHistory(self, currencyPair, start=None, end=None): """Returns the past 200 trades for a given market, or up to 50,000 trades between a range specified in UNIX timestamps by the "start" and "end" GET parameters.""" return self._public('returnTradeHistory', currencyPair=curr...
python
def returnTradeHistory(self, currencyPair, start=None, end=None): """Returns the past 200 trades for a given market, or up to 50,000 trades between a range specified in UNIX timestamps by the "start" and "end" GET parameters.""" return self._public('returnTradeHistory', currencyPair=curr...
['def', 'returnTradeHistory', '(', 'self', ',', 'currencyPair', ',', 'start', '=', 'None', ',', 'end', '=', 'None', ')', ':', 'return', 'self', '.', '_public', '(', "'returnTradeHistory'", ',', 'currencyPair', '=', 'currencyPair', ',', 'start', '=', 'start', ',', 'end', '=', 'end', ')']
Returns the past 200 trades for a given market, or up to 50,000 trades between a range specified in UNIX timestamps by the "start" and "end" GET parameters.
['Returns', 'the', 'past', '200', 'trades', 'for', 'a', 'given', 'market', 'or', 'up', 'to', '50', '000', 'trades', 'between', 'a', 'range', 'specified', 'in', 'UNIX', 'timestamps', 'by', 'the', 'start', 'and', 'end', 'GET', 'parameters', '.']
train
https://github.com/Aula13/poloniex/blob/a5bfc91e766e220bf77f5e3a1b131f095913e714/poloniex/poloniex.py#L103-L108
2,113
bokeh/bokeh
bokeh/embed/server.py
_get_app_path
def _get_app_path(url): ''' Extract the app path from a Bokeh server URL Args: url (str) : Returns: str ''' app_path = urlparse(url).path.rstrip("/") if not app_path.startswith("/"): app_path = "/" + app_path return app_path
python
def _get_app_path(url): ''' Extract the app path from a Bokeh server URL Args: url (str) : Returns: str ''' app_path = urlparse(url).path.rstrip("/") if not app_path.startswith("/"): app_path = "/" + app_path return app_path
['def', '_get_app_path', '(', 'url', ')', ':', 'app_path', '=', 'urlparse', '(', 'url', ')', '.', 'path', '.', 'rstrip', '(', '"/"', ')', 'if', 'not', 'app_path', '.', 'startswith', '(', '"/"', ')', ':', 'app_path', '=', '"/"', '+', 'app_path', 'return', 'app_path']
Extract the app path from a Bokeh server URL Args: url (str) : Returns: str
['Extract', 'the', 'app', 'path', 'from', 'a', 'Bokeh', 'server', 'URL']
train
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/embed/server.py#L256-L269
2,114
svenevs/exhale
exhale/graph.py
ExhaleRoot.fileRefDiscovery
def fileRefDiscovery(self): ''' Finds the missing components for file nodes by parsing the Doxygen xml (which is just the ``doxygen_output_dir/node.refid``). Additional items parsed include adding items whose ``refid`` tag are used in this file, the <programlisting> for the file...
python
def fileRefDiscovery(self): ''' Finds the missing components for file nodes by parsing the Doxygen xml (which is just the ``doxygen_output_dir/node.refid``). Additional items parsed include adding items whose ``refid`` tag are used in this file, the <programlisting> for the file...
['def', 'fileRefDiscovery', '(', 'self', ')', ':', 'if', 'not', 'os', '.', 'path', '.', 'isdir', '(', 'configs', '.', '_doxygen_xml_output_directory', ')', ':', 'utils', '.', 'fancyError', '(', '"The doxygen xml output directory [{0}] is not valid!"', '.', 'format', '(', 'configs', '.', '_doxygen_xml_output_directory',...
Finds the missing components for file nodes by parsing the Doxygen xml (which is just the ``doxygen_output_dir/node.refid``). Additional items parsed include adding items whose ``refid`` tag are used in this file, the <programlisting> for the file, what it includes and what includes it, as well...
['Finds', 'the', 'missing', 'components', 'for', 'file', 'nodes', 'by', 'parsing', 'the', 'Doxygen', 'xml', '(', 'which', 'is', 'just', 'the', 'doxygen_output_dir', '/', 'node', '.', 'refid', ')', '.', 'Additional', 'items', 'parsed', 'include', 'adding', 'items', 'whose', 'refid', 'tag', 'are', 'used', 'in', 'this', '...
train
https://github.com/svenevs/exhale/blob/fe7644829057af622e467bb529db6c03a830da99/exhale/graph.py#L1708-L1861
2,115
UCL-INGI/INGInious
inginious/frontend/template_helper.py
TemplateHelper._json_safe_dump
def _json_safe_dump(self, data): """ Make a json dump of `data`, that can be used directly in a `<script>` tag. Available as json() inside templates """ return json.dumps(data).replace(u'<', u'\\u003c') \ .replace(u'>', u'\\u003e') \ .replace(u'&', u'\\u0026') \ .repl...
python
def _json_safe_dump(self, data): """ Make a json dump of `data`, that can be used directly in a `<script>` tag. Available as json() inside templates """ return json.dumps(data).replace(u'<', u'\\u003c') \ .replace(u'>', u'\\u003e') \ .replace(u'&', u'\\u0026') \ .repl...
['def', '_json_safe_dump', '(', 'self', ',', 'data', ')', ':', 'return', 'json', '.', 'dumps', '(', 'data', ')', '.', 'replace', '(', "u'<'", ',', "u'\\\\u003c'", ')', '.', 'replace', '(', "u'>'", ',', "u'\\\\u003e'", ')', '.', 'replace', '(', "u'&'", ',', "u'\\\\u0026'", ')', '.', 'replace', '(', 'u"\'"', ',', "u'\\\\...
Make a json dump of `data`, that can be used directly in a `<script>` tag. Available as json() inside templates
['Make', 'a', 'json', 'dump', 'of', 'data', 'that', 'can', 'be', 'used', 'directly', 'in', 'a', '<script', '>', 'tag', '.', 'Available', 'as', 'json', '()', 'inside', 'templates']
train
https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/inginious/frontend/template_helper.py#L153-L158
2,116
72squared/redpipe
redpipe/keyspaces.py
Keyspace.delete
def delete(self, *names): """ Remove the key from redis :param names: tuple of strings - The keys to remove from redis. :return: Future() """ names = [self.redis_key(n) for n in names] with self.pipe as pipe: return pipe.delete(*names)
python
def delete(self, *names): """ Remove the key from redis :param names: tuple of strings - The keys to remove from redis. :return: Future() """ names = [self.redis_key(n) for n in names] with self.pipe as pipe: return pipe.delete(*names)
['def', 'delete', '(', 'self', ',', '*', 'names', ')', ':', 'names', '=', '[', 'self', '.', 'redis_key', '(', 'n', ')', 'for', 'n', 'in', 'names', ']', 'with', 'self', '.', 'pipe', 'as', 'pipe', ':', 'return', 'pipe', '.', 'delete', '(', '*', 'names', ')']
Remove the key from redis :param names: tuple of strings - The keys to remove from redis. :return: Future()
['Remove', 'the', 'key', 'from', 'redis']
train
https://github.com/72squared/redpipe/blob/e6ee518bc9f3e2fee323c8c53d08997799bd9b1b/redpipe/keyspaces.py#L176-L185
2,117
raphaelm/python-sepaxml
sepaxml/transfer.py
SepaTransfer._finalize_batch
def _finalize_batch(self): """ Method to finalize the batch, this will iterate over the _batches dict and create a PmtInf node for each batch. The correct information (from the batch_key and batch_totals) will be inserted and the batch transaction nodes will be folded. Finally, t...
python
def _finalize_batch(self): """ Method to finalize the batch, this will iterate over the _batches dict and create a PmtInf node for each batch. The correct information (from the batch_key and batch_totals) will be inserted and the batch transaction nodes will be folded. Finally, t...
['def', '_finalize_batch', '(', 'self', ')', ':', 'for', 'batch_meta', ',', 'batch_nodes', 'in', 'self', '.', '_batches', '.', 'items', '(', ')', ':', 'PmtInf_nodes', '=', 'self', '.', '_create_PmtInf_node', '(', ')', 'PmtInf_nodes', '[', "'PmtInfIdNode'", ']', '.', 'text', '=', 'make_id', '(', 'self', '.', '_config', ...
Method to finalize the batch, this will iterate over the _batches dict and create a PmtInf node for each batch. The correct information (from the batch_key and batch_totals) will be inserted and the batch transaction nodes will be folded. Finally, the batches will be added to the main XM...
['Method', 'to', 'finalize', 'the', 'batch', 'this', 'will', 'iterate', 'over', 'the', '_batches', 'dict', 'and', 'create', 'a', 'PmtInf', 'node', 'for', 'each', 'batch', '.', 'The', 'correct', 'information', '(', 'from', 'the', 'batch_key', 'and', 'batch_totals', ')', 'will', 'be', 'inserted', 'and', 'the', 'batch', '...
train
https://github.com/raphaelm/python-sepaxml/blob/187b699b1673c862002b2bae7e1bd62fe8623aec/sepaxml/transfer.py#L309-L369
2,118
JIC-CSB/jicimagelib
jicimagelib/io.py
BFConvertWrapper.manifest
def manifest(self, entry): """Returns manifest as a list. :param entry: :class:`jicimagelib.image.FileBackend.Entry` :returns: list """ entries = [] for fname in self._sorted_nicely(os.listdir(entry.directory)): if fname == 'manifest.json': ...
python
def manifest(self, entry): """Returns manifest as a list. :param entry: :class:`jicimagelib.image.FileBackend.Entry` :returns: list """ entries = [] for fname in self._sorted_nicely(os.listdir(entry.directory)): if fname == 'manifest.json': ...
['def', 'manifest', '(', 'self', ',', 'entry', ')', ':', 'entries', '=', '[', ']', 'for', 'fname', 'in', 'self', '.', '_sorted_nicely', '(', 'os', '.', 'listdir', '(', 'entry', '.', 'directory', ')', ')', ':', 'if', 'fname', '==', "'manifest.json'", ':', 'continue', 'fpath', '=', 'os', '.', 'path', '.', 'abspath', '(',...
Returns manifest as a list. :param entry: :class:`jicimagelib.image.FileBackend.Entry` :returns: list
['Returns', 'manifest', 'as', 'a', 'list', '.', ':', 'param', 'entry', ':', ':', 'class', ':', 'jicimagelib', '.', 'image', '.', 'FileBackend', '.', 'Entry', ':', 'returns', ':', 'list']
train
https://github.com/JIC-CSB/jicimagelib/blob/fbd67accb2e6d55969c6d4ed7e8b4bb4ab65cd44/jicimagelib/io.py#L129-L146
2,119
johnnoone/aioconsul
aioconsul/client/operator_endpoint.py
OperatorEndpoint.peer_delete
async def peer_delete(self, *, dc=None, address): """Remove the server with given address from the Raft configuration Parameters: dc (str): Specify datacenter that will be used. Defaults to the agent's local datacenter. address (str): "IP:port" of the serve...
python
async def peer_delete(self, *, dc=None, address): """Remove the server with given address from the Raft configuration Parameters: dc (str): Specify datacenter that will be used. Defaults to the agent's local datacenter. address (str): "IP:port" of the serve...
['async', 'def', 'peer_delete', '(', 'self', ',', '*', ',', 'dc', '=', 'None', ',', 'address', ')', ':', 'address', '=', 'extract_attr', '(', 'address', ',', 'keys', '=', '[', '"Address"', ']', ')', 'params', '=', '{', '"dc"', ':', 'dc', ',', '"address"', ':', 'address', '}', 'response', '=', 'await', 'self', '.', '_ap...
Remove the server with given address from the Raft configuration Parameters: dc (str): Specify datacenter that will be used. Defaults to the agent's local datacenter. address (str): "IP:port" of the server to remove. Returns: bool: ``True`` on s...
['Remove', 'the', 'server', 'with', 'given', 'address', 'from', 'the', 'Raft', 'configuration']
train
https://github.com/johnnoone/aioconsul/blob/02f7a529d7dc2e49bed942111067aa5faf320e90/aioconsul/client/operator_endpoint.py#L74-L93
2,120
tomduck/pandoc-xnos
pandocxnos/pandocattributes.py
PandocAttributes.to_dict
def to_dict(self): """Returns attributes formatted as a dictionary.""" d = {'id': self.id, 'classes': self.classes} d.update(self.kvs) return d
python
def to_dict(self): """Returns attributes formatted as a dictionary.""" d = {'id': self.id, 'classes': self.classes} d.update(self.kvs) return d
['def', 'to_dict', '(', 'self', ')', ':', 'd', '=', '{', "'id'", ':', 'self', '.', 'id', ',', "'classes'", ':', 'self', '.', 'classes', '}', 'd', '.', 'update', '(', 'self', '.', 'kvs', ')', 'return', 'd']
Returns attributes formatted as a dictionary.
['Returns', 'attributes', 'formatted', 'as', 'a', 'dictionary', '.']
train
https://github.com/tomduck/pandoc-xnos/blob/df8e162d257a548cea7eebf597efb2c21a1a4ba3/pandocxnos/pandocattributes.py#L182-L186
2,121
Spinmob/spinmob
_data.py
fitter.degrees_of_freedom
def degrees_of_freedom(self): """ Returns the number of degrees of freedom. """ if len(self._set_xdata)==0 or len(self._set_ydata)==0: return None # Temporary hack: get the studentized residuals, which uses the massaged data # This should later be changed to get_...
python
def degrees_of_freedom(self): """ Returns the number of degrees of freedom. """ if len(self._set_xdata)==0 or len(self._set_ydata)==0: return None # Temporary hack: get the studentized residuals, which uses the massaged data # This should later be changed to get_...
['def', 'degrees_of_freedom', '(', 'self', ')', ':', 'if', 'len', '(', 'self', '.', '_set_xdata', ')', '==', '0', 'or', 'len', '(', 'self', '.', '_set_ydata', ')', '==', '0', ':', 'return', 'None', '# Temporary hack: get the studentized residuals, which uses the massaged data', '# This should later be changed to get_ma...
Returns the number of degrees of freedom.
['Returns', 'the', 'number', 'of', 'degrees', 'of', 'freedom', '.']
train
https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_data.py#L2481-L2498
2,122
blockcypher/blockcypher-python
blockcypher/utils.py
to_satoshis
def to_satoshis(input_quantity, input_type): ''' convert to satoshis, no rounding ''' assert input_type in UNIT_CHOICES, input_type # convert to satoshis if input_type in ('btc', 'mbtc', 'bit'): satoshis = float(input_quantity) * float(UNIT_MAPPINGS[input_type]['satoshis_per']) elif input_t...
python
def to_satoshis(input_quantity, input_type): ''' convert to satoshis, no rounding ''' assert input_type in UNIT_CHOICES, input_type # convert to satoshis if input_type in ('btc', 'mbtc', 'bit'): satoshis = float(input_quantity) * float(UNIT_MAPPINGS[input_type]['satoshis_per']) elif input_t...
['def', 'to_satoshis', '(', 'input_quantity', ',', 'input_type', ')', ':', 'assert', 'input_type', 'in', 'UNIT_CHOICES', ',', 'input_type', '# convert to satoshis', 'if', 'input_type', 'in', '(', "'btc'", ',', "'mbtc'", ',', "'bit'", ')', ':', 'satoshis', '=', 'float', '(', 'input_quantity', ')', '*', 'float', '(', 'UN...
convert to satoshis, no rounding
['convert', 'to', 'satoshis', 'no', 'rounding']
train
https://github.com/blockcypher/blockcypher-python/blob/7601ea21916957ff279384fd699527ff9c28a56e/blockcypher/utils.py#L27-L39
2,123
jonhadfield/creds
lib/creds/ssh.py
PublicKey.raw
def raw(self): """Return raw key. returns: str: raw key """ if self._raw: return text_type(self._raw).strip("\r\n") else: return text_type(base64decode(self._b64encoded)).strip("\r\n")
python
def raw(self): """Return raw key. returns: str: raw key """ if self._raw: return text_type(self._raw).strip("\r\n") else: return text_type(base64decode(self._b64encoded)).strip("\r\n")
['def', 'raw', '(', 'self', ')', ':', 'if', 'self', '.', '_raw', ':', 'return', 'text_type', '(', 'self', '.', '_raw', ')', '.', 'strip', '(', '"\\r\\n"', ')', 'else', ':', 'return', 'text_type', '(', 'base64decode', '(', 'self', '.', '_b64encoded', ')', ')', '.', 'strip', '(', '"\\r\\n"', ')']
Return raw key. returns: str: raw key
['Return', 'raw', 'key', '.']
train
https://github.com/jonhadfield/creds/blob/b2053b43516cf742c6e4c2b79713bc625592f47c/lib/creds/ssh.py#L43-L52
2,124
joaopcanario/imports
imports/imports.py
check
def check(path_dir, requirements_name='requirements.txt'): '''Look for unused packages listed on project requirements''' requirements = _load_requirements(requirements_name, path_dir) imported_modules = _iter_modules(path_dir) installed_packages = _list_installed_packages() imported_modules.update(...
python
def check(path_dir, requirements_name='requirements.txt'): '''Look for unused packages listed on project requirements''' requirements = _load_requirements(requirements_name, path_dir) imported_modules = _iter_modules(path_dir) installed_packages = _list_installed_packages() imported_modules.update(...
['def', 'check', '(', 'path_dir', ',', 'requirements_name', '=', "'requirements.txt'", ')', ':', 'requirements', '=', '_load_requirements', '(', 'requirements_name', ',', 'path_dir', ')', 'imported_modules', '=', '_iter_modules', '(', 'path_dir', ')', 'installed_packages', '=', '_list_installed_packages', '(', ')', 'im...
Look for unused packages listed on project requirements
['Look', 'for', 'unused', 'packages', 'listed', 'on', 'project', 'requirements']
train
https://github.com/joaopcanario/imports/blob/46db0d3d2aa55427027bf0e91d61a24d52730337/imports/imports.py#L94-L112
2,125
openstack/networking-cisco
networking_cisco/plugins/cisco/db/l3/ha_db.py
HA_db_mixin._delete_redundancy_routers
def _delete_redundancy_routers(self, context, router_db): """To be called in delete_router() BEFORE router has been deleted in DB. The router should have not interfaces. """ e_context = context.elevated() for binding in router_db.redundancy_bindings: self.delete_route...
python
def _delete_redundancy_routers(self, context, router_db): """To be called in delete_router() BEFORE router has been deleted in DB. The router should have not interfaces. """ e_context = context.elevated() for binding in router_db.redundancy_bindings: self.delete_route...
['def', '_delete_redundancy_routers', '(', 'self', ',', 'context', ',', 'router_db', ')', ':', 'e_context', '=', 'context', '.', 'elevated', '(', ')', 'for', 'binding', 'in', 'router_db', '.', 'redundancy_bindings', ':', 'self', '.', 'delete_router', '(', 'e_context', ',', 'binding', '.', 'redundancy_router_id', ')', '...
To be called in delete_router() BEFORE router has been deleted in DB. The router should have not interfaces.
['To', 'be', 'called', 'in', 'delete_router', '()', 'BEFORE', 'router', 'has', 'been', 'deleted', 'in', 'DB', '.', 'The', 'router', 'should', 'have', 'not', 'interfaces', '.']
train
https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/plugins/cisco/db/l3/ha_db.py#L539-L550
2,126
f3at/feat
src/feat/extern/log/log.py
infoObject
def infoObject(object, cat, format, *args): """ Log an informational message in the given category. """ doLog(INFO, object, cat, format, args)
python
def infoObject(object, cat, format, *args): """ Log an informational message in the given category. """ doLog(INFO, object, cat, format, args)
['def', 'infoObject', '(', 'object', ',', 'cat', ',', 'format', ',', '*', 'args', ')', ':', 'doLog', '(', 'INFO', ',', 'object', ',', 'cat', ',', 'format', ',', 'args', ')']
Log an informational message in the given category.
['Log', 'an', 'informational', 'message', 'in', 'the', 'given', 'category', '.']
train
https://github.com/f3at/feat/blob/15da93fc9d6ec8154f52a9172824e25821195ef8/src/feat/extern/log/log.py#L385-L389
2,127
DataDog/integrations-core
spark/datadog_checks/spark/spark.py
SparkCheck._standalone_init
def _standalone_init(self, spark_master_address, pre_20_mode, requests_config, tags): """ Return a dictionary of {app_id: (app_name, tracking_url)} for the running Spark applications """ metrics_json = self._rest_request_to_json( spark_master_address, SPARK_MASTER_STATE_PATH,...
python
def _standalone_init(self, spark_master_address, pre_20_mode, requests_config, tags): """ Return a dictionary of {app_id: (app_name, tracking_url)} for the running Spark applications """ metrics_json = self._rest_request_to_json( spark_master_address, SPARK_MASTER_STATE_PATH,...
['def', '_standalone_init', '(', 'self', ',', 'spark_master_address', ',', 'pre_20_mode', ',', 'requests_config', ',', 'tags', ')', ':', 'metrics_json', '=', 'self', '.', '_rest_request_to_json', '(', 'spark_master_address', ',', 'SPARK_MASTER_STATE_PATH', ',', 'SPARK_STANDALONE_SERVICE_CHECK', ',', 'requests_config', ...
Return a dictionary of {app_id: (app_name, tracking_url)} for the running Spark applications
['Return', 'a', 'dictionary', 'of', '{', 'app_id', ':', '(', 'app_name', 'tracking_url', ')', '}', 'for', 'the', 'running', 'Spark', 'applications']
train
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/spark/datadog_checks/spark/spark.py#L304-L348
2,128
brocade/pynos
pynos/versions/ver_6/ver_6_0_1/yang/brocade_interface_ext.py
brocade_interface_ext.get_interface_detail_output_interface_configured_line_speed
def get_interface_detail_output_interface_configured_line_speed(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") get_interface_detail = ET.Element("get_interface_detail") config = get_interface_detail output = ET.SubElement(get_interface_detail, "...
python
def get_interface_detail_output_interface_configured_line_speed(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") get_interface_detail = ET.Element("get_interface_detail") config = get_interface_detail output = ET.SubElement(get_interface_detail, "...
['def', 'get_interface_detail_output_interface_configured_line_speed', '(', 'self', ',', '*', '*', 'kwargs', ')', ':', 'config', '=', 'ET', '.', 'Element', '(', '"config"', ')', 'get_interface_detail', '=', 'ET', '.', 'Element', '(', '"get_interface_detail"', ')', 'config', '=', 'get_interface_detail', 'output', '=', '...
Auto Generated Code
['Auto', 'Generated', 'Code']
train
https://github.com/brocade/pynos/blob/bd8a34e98f322de3fc06750827d8bbc3a0c00380/pynos/versions/ver_6/ver_6_0_1/yang/brocade_interface_ext.py#L1024-L1040
2,129
pandeylab/pythomics
pythomics/proteomics/parsers.py
MQIterator.parseFullScan
def parseFullScan(self, i, modifications=True): """ parses scan info for giving a Spectrum Obj for plotting. takes significantly longer since it has to unzip/parse xml """ scanObj = PeptideObject() peptide = str(i[1]) pid=i[2] if modifications: sql = '...
python
def parseFullScan(self, i, modifications=True): """ parses scan info for giving a Spectrum Obj for plotting. takes significantly longer since it has to unzip/parse xml """ scanObj = PeptideObject() peptide = str(i[1]) pid=i[2] if modifications: sql = '...
['def', 'parseFullScan', '(', 'self', ',', 'i', ',', 'modifications', '=', 'True', ')', ':', 'scanObj', '=', 'PeptideObject', '(', ')', 'peptide', '=', 'str', '(', 'i', '[', '1', ']', ')', 'pid', '=', 'i', '[', '2', ']', 'if', 'modifications', ':', 'sql', '=', "'select aam.ModificationName,pam.Position,aam.DeltaMass fr...
parses scan info for giving a Spectrum Obj for plotting. takes significantly longer since it has to unzip/parse xml
['parses', 'scan', 'info', 'for', 'giving', 'a', 'Spectrum', 'Obj', 'for', 'plotting', '.', 'takes', 'significantly', 'longer', 'since', 'it', 'has', 'to', 'unzip', '/', 'parse', 'xml']
train
https://github.com/pandeylab/pythomics/blob/ab0a5651a2e02a25def4d277b35fa09d1631bfcb/pythomics/proteomics/parsers.py#L1901-L1915
2,130
SethMMorton/natsort
natsort/utils.py
natsort_key
def natsort_key(val, key, string_func, bytes_func, num_func): """ Key to sort strings and numbers naturally. It works by splitting the string into components of strings and numbers, and then converting the numbers into actual ints or floats. Parameters ---------- val : str | unicode | byte...
python
def natsort_key(val, key, string_func, bytes_func, num_func): """ Key to sort strings and numbers naturally. It works by splitting the string into components of strings and numbers, and then converting the numbers into actual ints or floats. Parameters ---------- val : str | unicode | byte...
['def', 'natsort_key', '(', 'val', ',', 'key', ',', 'string_func', ',', 'bytes_func', ',', 'num_func', ')', ':', '# Apply key if needed', 'if', 'key', 'is', 'not', 'None', ':', 'val', '=', 'key', '(', 'val', ')', '# Assume the input are strings, which is the most common case', 'try', ':', 'return', 'string_func', '(', ...
Key to sort strings and numbers naturally. It works by splitting the string into components of strings and numbers, and then converting the numbers into actual ints or floats. Parameters ---------- val : str | unicode | bytes | int | float | iterable key : callable | None A key to appl...
['Key', 'to', 'sort', 'strings', 'and', 'numbers', 'naturally', '.']
train
https://github.com/SethMMorton/natsort/blob/ea0d37ef790b42c424a096e079edd9ea0d5717e3/natsort/utils.py#L186-L251
2,131
StackStorm/pybind
pybind/slxos/v17s_1_02/routing_system/interface/ve/ipv6/ipv6_vrrp_extended/__init__.py
ipv6_vrrp_extended._set_auth_type
def _set_auth_type(self, v, load=False): """ Setter method for auth_type, mapped from YANG variable /routing_system/interface/ve/ipv6/ipv6_vrrp_extended/auth_type (container) If this variable is read-only (config: false) in the source YANG file, then _set_auth_type is considered as a private method....
python
def _set_auth_type(self, v, load=False): """ Setter method for auth_type, mapped from YANG variable /routing_system/interface/ve/ipv6/ipv6_vrrp_extended/auth_type (container) If this variable is read-only (config: false) in the source YANG file, then _set_auth_type is considered as a private method....
['def', '_set_auth_type', '(', 'self', ',', 'v', ',', 'load', '=', 'False', ')', ':', 'if', 'hasattr', '(', 'v', ',', '"_utype"', ')', ':', 'v', '=', 'v', '.', '_utype', '(', 'v', ')', 'try', ':', 't', '=', 'YANGDynClass', '(', 'v', ',', 'base', '=', 'auth_type', '.', 'auth_type', ',', 'is_container', '=', "'container'...
Setter method for auth_type, mapped from YANG variable /routing_system/interface/ve/ipv6/ipv6_vrrp_extended/auth_type (container) If this variable is read-only (config: false) in the source YANG file, then _set_auth_type is considered as a private method. Backends looking to populate this variable should ...
['Setter', 'method', 'for', 'auth_type', 'mapped', 'from', 'YANG', 'variable', '/', 'routing_system', '/', 'interface', '/', 've', '/', 'ipv6', '/', 'ipv6_vrrp_extended', '/', 'auth_type', '(', 'container', ')', 'If', 'this', 'variable', 'is', 'read', '-', 'only', '(', 'config', ':', 'false', ')', 'in', 'the', 'source'...
train
https://github.com/StackStorm/pybind/blob/44c467e71b2b425be63867aba6e6fa28b2cfe7fb/pybind/slxos/v17s_1_02/routing_system/interface/ve/ipv6/ipv6_vrrp_extended/__init__.py#L96-L119
2,132
langloisjp/tstore
tstore/pgtablestorage.py
sqlwhere
def sqlwhere(criteria=None): """Generates SQL where clause. Returns (sql, values). Criteria is a dictionary of {field: value}. >>> sqlwhere() ('', []) >>> sqlwhere({'id': 5}) ('id=%s', [5]) >>> sqlwhere({'id': 3, 'name': 'toto'}) ('id=%s and name=%s', [3, 'toto']) >>> sqlwhere({'id'...
python
def sqlwhere(criteria=None): """Generates SQL where clause. Returns (sql, values). Criteria is a dictionary of {field: value}. >>> sqlwhere() ('', []) >>> sqlwhere({'id': 5}) ('id=%s', [5]) >>> sqlwhere({'id': 3, 'name': 'toto'}) ('id=%s and name=%s', [3, 'toto']) >>> sqlwhere({'id'...
['def', 'sqlwhere', '(', 'criteria', '=', 'None', ')', ':', 'if', 'not', 'criteria', ':', 'return', '(', "''", ',', '[', ']', ')', 'fields', '=', 'sorted', '(', 'criteria', '.', 'keys', '(', ')', ')', 'validate_names', '(', 'fields', ')', 'values', '=', '[', 'criteria', '[', 'field', ']', 'for', 'field', 'in', 'fields'...
Generates SQL where clause. Returns (sql, values). Criteria is a dictionary of {field: value}. >>> sqlwhere() ('', []) >>> sqlwhere({'id': 5}) ('id=%s', [5]) >>> sqlwhere({'id': 3, 'name': 'toto'}) ('id=%s and name=%s', [3, 'toto']) >>> sqlwhere({'id': 3, 'name': 'toto', 'createdon': '2...
['Generates', 'SQL', 'where', 'clause', '.', 'Returns', '(', 'sql', 'values', ')', '.', 'Criteria', 'is', 'a', 'dictionary', 'of', '{', 'field', ':', 'value', '}', '.']
train
https://github.com/langloisjp/tstore/blob/b438f8aaf09117bf6f922ba06ae5cf46b7b97a57/tstore/pgtablestorage.py#L412-L432
2,133
deschler/django-modeltranslation
modeltranslation/utils.py
auto_populate
def auto_populate(mode='all'): """ Overrides translation fields population mode (population mode decides which unprovided translations will be filled during model construction / loading). Example: with auto_populate('all'): s = Slugged.objects.create(title='foo') s.title_en...
python
def auto_populate(mode='all'): """ Overrides translation fields population mode (population mode decides which unprovided translations will be filled during model construction / loading). Example: with auto_populate('all'): s = Slugged.objects.create(title='foo') s.title_en...
['def', 'auto_populate', '(', 'mode', '=', "'all'", ')', ':', 'current_population_mode', '=', 'settings', '.', 'AUTO_POPULATE', 'settings', '.', 'AUTO_POPULATE', '=', 'mode', 'try', ':', 'yield', 'finally', ':', 'settings', '.', 'AUTO_POPULATE', '=', 'current_population_mode']
Overrides translation fields population mode (population mode decides which unprovided translations will be filled during model construction / loading). Example: with auto_populate('all'): s = Slugged.objects.create(title='foo') s.title_en == 'foo' // True s.title_de == 'fo...
['Overrides', 'translation', 'fields', 'population', 'mode', '(', 'population', 'mode', 'decides', 'which', 'unprovided', 'translations', 'will', 'be', 'filled', 'during', 'model', 'construction', '/', 'loading', ')', '.']
train
https://github.com/deschler/django-modeltranslation/blob/18fec04a5105cbd83fc3759f4fda20135b3a848c/modeltranslation/utils.py#L126-L149
2,134
bokeh/bokeh
bokeh/embed/util.py
submodel_has_python_callbacks
def submodel_has_python_callbacks(models): ''' Traverses submodels to check for Python (event) callbacks ''' has_python_callback = False for model in collect_models(models): if len(model._callbacks) > 0 or len(model._event_callbacks) > 0: has_python_callback = True break...
python
def submodel_has_python_callbacks(models): ''' Traverses submodels to check for Python (event) callbacks ''' has_python_callback = False for model in collect_models(models): if len(model._callbacks) > 0 or len(model._event_callbacks) > 0: has_python_callback = True break...
['def', 'submodel_has_python_callbacks', '(', 'models', ')', ':', 'has_python_callback', '=', 'False', 'for', 'model', 'in', 'collect_models', '(', 'models', ')', ':', 'if', 'len', '(', 'model', '.', '_callbacks', ')', '>', '0', 'or', 'len', '(', 'model', '.', '_event_callbacks', ')', '>', '0', ':', 'has_python_callbac...
Traverses submodels to check for Python (event) callbacks
['Traverses', 'submodels', 'to', 'check', 'for', 'Python', '(', 'event', ')', 'callbacks']
train
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/embed/util.py#L305-L315
2,135
twilio/twilio-python
twilio/base/version.py
Version.request
def request(self, method, uri, params=None, data=None, headers=None, auth=None, timeout=None, allow_redirects=False): """ Make an HTTP request. """ url = self.relative_uri(uri) return self.domain.request( method, url, params=par...
python
def request(self, method, uri, params=None, data=None, headers=None, auth=None, timeout=None, allow_redirects=False): """ Make an HTTP request. """ url = self.relative_uri(uri) return self.domain.request( method, url, params=par...
['def', 'request', '(', 'self', ',', 'method', ',', 'uri', ',', 'params', '=', 'None', ',', 'data', '=', 'None', ',', 'headers', '=', 'None', ',', 'auth', '=', 'None', ',', 'timeout', '=', 'None', ',', 'allow_redirects', '=', 'False', ')', ':', 'url', '=', 'self', '.', 'relative_uri', '(', 'uri', ')', 'return', 'self',...
Make an HTTP request.
['Make', 'an', 'HTTP', 'request', '.']
train
https://github.com/twilio/twilio-python/blob/c867895f55dcc29f522e6e8b8868d0d18483132f/twilio/base/version.py#L33-L48
2,136
mnkhouri/news_scraper
news_scraper/scrape.py
fetch_and_parse
def fetch_and_parse(url, bodyLines): """Takes a url, and returns a dictionary of data with 'bodyLines' lines""" pageHtml = fetch_page(url) return parse(url, pageHtml, bodyLines)
python
def fetch_and_parse(url, bodyLines): """Takes a url, and returns a dictionary of data with 'bodyLines' lines""" pageHtml = fetch_page(url) return parse(url, pageHtml, bodyLines)
['def', 'fetch_and_parse', '(', 'url', ',', 'bodyLines', ')', ':', 'pageHtml', '=', 'fetch_page', '(', 'url', ')', 'return', 'parse', '(', 'url', ',', 'pageHtml', ',', 'bodyLines', ')']
Takes a url, and returns a dictionary of data with 'bodyLines' lines
['Takes', 'a', 'url', 'and', 'returns', 'a', 'dictionary', 'of', 'data', 'with', 'bodyLines', 'lines']
train
https://github.com/mnkhouri/news_scraper/blob/7fd3487c587281a4816f0761f0c4d2196ae05702/news_scraper/scrape.py#L68-L72
2,137
PyCQA/pydocstyle
src/pydocstyle/parser.py
Function.is_public
def is_public(self): """Return True iff this function should be considered public.""" if self.dunder_all is not None: return self.name in self.dunder_all else: return not self.name.startswith('_')
python
def is_public(self): """Return True iff this function should be considered public.""" if self.dunder_all is not None: return self.name in self.dunder_all else: return not self.name.startswith('_')
['def', 'is_public', '(', 'self', ')', ':', 'if', 'self', '.', 'dunder_all', 'is', 'not', 'None', ':', 'return', 'self', '.', 'name', 'in', 'self', '.', 'dunder_all', 'else', ':', 'return', 'not', 'self', '.', 'name', '.', 'startswith', '(', "'_'", ')']
Return True iff this function should be considered public.
['Return', 'True', 'iff', 'this', 'function', 'should', 'be', 'considered', 'public', '.']
train
https://github.com/PyCQA/pydocstyle/blob/2549847f9efad225789f931e83dfe782418ca13e/src/pydocstyle/parser.py#L131-L136
2,138
ccubed/PyMoe
Pymoe/Mal/__init__.py
Mal._anime_add
def _anime_add(self, data): """ Adds an anime to a user's list. :param data: A :class:`Pymoe.Mal.Objects.Anime` object with the anime data :raises: SyntaxError on invalid data type :raises: ServerError on failure to add :rtype: Bool :return: True on success ...
python
def _anime_add(self, data): """ Adds an anime to a user's list. :param data: A :class:`Pymoe.Mal.Objects.Anime` object with the anime data :raises: SyntaxError on invalid data type :raises: ServerError on failure to add :rtype: Bool :return: True on success ...
['def', '_anime_add', '(', 'self', ',', 'data', ')', ':', 'if', 'isinstance', '(', 'data', ',', 'Anime', ')', ':', 'xmlstr', '=', 'data', '.', 'to_xml', '(', ')', 'r', '=', 'requests', '.', 'get', '(', 'self', '.', 'apiurl', '+', '"animelist/add/{}.xml"', '.', 'format', '(', 'data', '.', 'id', ')', ',', 'params', '=', ...
Adds an anime to a user's list. :param data: A :class:`Pymoe.Mal.Objects.Anime` object with the anime data :raises: SyntaxError on invalid data type :raises: ServerError on failure to add :rtype: Bool :return: True on success
['Adds', 'an', 'anime', 'to', 'a', 'user', 's', 'list', '.']
train
https://github.com/ccubed/PyMoe/blob/5b2a2591bb113bd80d838e65aaa06f3a97ff3670/Pymoe/Mal/__init__.py#L136-L157
2,139
AmesCornish/buttersink
buttersink/ButterStore.py
ButterStore._keepVol
def _keepVol(self, vol): """ Mark this volume to be kept in path. """ if vol is None: return if vol in self.extraVolumes: del self.extraVolumes[vol] return if vol not in self.paths: raise Exception("%s not in %s" % (vol, self)) p...
python
def _keepVol(self, vol): """ Mark this volume to be kept in path. """ if vol is None: return if vol in self.extraVolumes: del self.extraVolumes[vol] return if vol not in self.paths: raise Exception("%s not in %s" % (vol, self)) p...
['def', '_keepVol', '(', 'self', ',', 'vol', ')', ':', 'if', 'vol', 'is', 'None', ':', 'return', 'if', 'vol', 'in', 'self', '.', 'extraVolumes', ':', 'del', 'self', '.', 'extraVolumes', '[', 'vol', ']', 'return', 'if', 'vol', 'not', 'in', 'self', '.', 'paths', ':', 'raise', 'Exception', '(', '"%s not in %s"', '%', '(',...
Mark this volume to be kept in path.
['Mark', 'this', 'volume', 'to', 'be', 'kept', 'in', 'path', '.']
train
https://github.com/AmesCornish/buttersink/blob/5cc37e30d9f8071fcf3497dca8b8a91b910321ea/buttersink/ButterStore.py#L308-L326
2,140
StackStorm/pybind
pybind/slxos/v17s_1_02/qos/map_/dscp_cos/__init__.py
dscp_cos._set_dscp_to_cos_mapping
def _set_dscp_to_cos_mapping(self, v, load=False): """ Setter method for dscp_to_cos_mapping, mapped from YANG variable /qos/map/dscp_cos/dscp_to_cos_mapping (list) If this variable is read-only (config: false) in the source YANG file, then _set_dscp_to_cos_mapping is considered as a private method....
python
def _set_dscp_to_cos_mapping(self, v, load=False): """ Setter method for dscp_to_cos_mapping, mapped from YANG variable /qos/map/dscp_cos/dscp_to_cos_mapping (list) If this variable is read-only (config: false) in the source YANG file, then _set_dscp_to_cos_mapping is considered as a private method....
['def', '_set_dscp_to_cos_mapping', '(', 'self', ',', 'v', ',', 'load', '=', 'False', ')', ':', 'if', 'hasattr', '(', 'v', ',', '"_utype"', ')', ':', 'v', '=', 'v', '.', '_utype', '(', 'v', ')', 'try', ':', 't', '=', 'YANGDynClass', '(', 'v', ',', 'base', '=', 'YANGListType', '(', '"dscp_in_values"', ',', 'dscp_to_cos_...
Setter method for dscp_to_cos_mapping, mapped from YANG variable /qos/map/dscp_cos/dscp_to_cos_mapping (list) If this variable is read-only (config: false) in the source YANG file, then _set_dscp_to_cos_mapping is considered as a private method. Backends looking to populate this variable should do so vi...
['Setter', 'method', 'for', 'dscp_to_cos_mapping', 'mapped', 'from', 'YANG', 'variable', '/', 'qos', '/', 'map', '/', 'dscp_cos', '/', 'dscp_to_cos_mapping', '(', 'list', ')', 'If', 'this', 'variable', 'is', 'read', '-', 'only', '(', 'config', ':', 'false', ')', 'in', 'the', 'source', 'YANG', 'file', 'then', '_set_dscp...
train
https://github.com/StackStorm/pybind/blob/44c467e71b2b425be63867aba6e6fa28b2cfe7fb/pybind/slxos/v17s_1_02/qos/map_/dscp_cos/__init__.py#L131-L152
2,141
nerdvegas/rez
src/rez/vendor/amqp/serialization.py
AMQPWriter.write_shortstr
def write_shortstr(self, s): """Write a string up to 255 bytes long (after any encoding). If passed a unicode string, encode with UTF-8. """ self._flushbits() if isinstance(s, string): s = s.encode('utf-8') if len(s) > 255: raise FrameSyntaxError...
python
def write_shortstr(self, s): """Write a string up to 255 bytes long (after any encoding). If passed a unicode string, encode with UTF-8. """ self._flushbits() if isinstance(s, string): s = s.encode('utf-8') if len(s) > 255: raise FrameSyntaxError...
['def', 'write_shortstr', '(', 'self', ',', 's', ')', ':', 'self', '.', '_flushbits', '(', ')', 'if', 'isinstance', '(', 's', ',', 'string', ')', ':', 's', '=', 's', '.', 'encode', '(', "'utf-8'", ')', 'if', 'len', '(', 's', ')', '>', '255', ':', 'raise', 'FrameSyntaxError', '(', "'Shortstring overflow ({0} > 255)'", '...
Write a string up to 255 bytes long (after any encoding). If passed a unicode string, encode with UTF-8.
['Write', 'a', 'string', 'up', 'to', '255', 'bytes', 'long', '(', 'after', 'any', 'encoding', ')', '.']
train
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/vendor/amqp/serialization.py#L315-L328
2,142
Miserlou/Zappa
zappa/cli.py
ZappaCLI.colorize_invoke_command
def colorize_invoke_command(self, string): """ Apply various heuristics to return a colorized version the invoke command string. If these fail, simply return the string in plaintext. Inspired by colorize_log_entry(). """ final_string = string try: ...
python
def colorize_invoke_command(self, string): """ Apply various heuristics to return a colorized version the invoke command string. If these fail, simply return the string in plaintext. Inspired by colorize_log_entry(). """ final_string = string try: ...
['def', 'colorize_invoke_command', '(', 'self', ',', 'string', ')', ':', 'final_string', '=', 'string', 'try', ':', '# Line headers', 'try', ':', 'for', 'token', 'in', '[', "'START'", ',', "'END'", ',', "'REPORT'", ',', "'[DEBUG]'", ']', ':', 'if', 'token', 'in', 'final_string', ':', 'format_string', '=', "'[{}]'", '# ...
Apply various heuristics to return a colorized version the invoke command string. If these fail, simply return the string in plaintext. Inspired by colorize_log_entry().
['Apply', 'various', 'heuristics', 'to', 'return', 'a', 'colorized', 'version', 'the', 'invoke', 'command', 'string', '.', 'If', 'these', 'fail', 'simply', 'return', 'the', 'string', 'in', 'plaintext', '.']
train
https://github.com/Miserlou/Zappa/blob/3ccf7490a8d8b8fa74a61ee39bf44234f3567739/zappa/cli.py#L1321-L1387
2,143
SergeySatskiy/cdm-pythonparser
cdmpyparser.py
BriefModuleInfo._onFunction
def _onFunction(self, name, line, pos, absPosition, keywordLine, keywordPos, colonLine, colonPos, level, isAsync, returnAnnotation): """Memorizes a function""" self.__flushLevel(level) f = Function(name, line, pos, absPosition, keywordL...
python
def _onFunction(self, name, line, pos, absPosition, keywordLine, keywordPos, colonLine, colonPos, level, isAsync, returnAnnotation): """Memorizes a function""" self.__flushLevel(level) f = Function(name, line, pos, absPosition, keywordL...
['def', '_onFunction', '(', 'self', ',', 'name', ',', 'line', ',', 'pos', ',', 'absPosition', ',', 'keywordLine', ',', 'keywordPos', ',', 'colonLine', ',', 'colonPos', ',', 'level', ',', 'isAsync', ',', 'returnAnnotation', ')', ':', 'self', '.', '__flushLevel', '(', 'level', ')', 'f', '=', 'Function', '(', 'name', ',',...
Memorizes a function
['Memorizes', 'a', 'function']
train
https://github.com/SergeySatskiy/cdm-pythonparser/blob/7e933aca899b1853d744082313ffc3a8b1154505/cdmpyparser.py#L512-L523
2,144
gem/oq-engine
openquake/hazardlib/gsim/climent_1994.py
ClimentEtAl1994._compute_mean
def _compute_mean(self, C, rup, dists, sites, imt): """ Compute mean value for PGA and pseudo-velocity response spectrum, as given in equation 1. Converts also pseudo-velocity response spectrum values to SA, using: SA = (PSV * W)/ratio(SA_larger/SA_geo_mean) W = (2 ...
python
def _compute_mean(self, C, rup, dists, sites, imt): """ Compute mean value for PGA and pseudo-velocity response spectrum, as given in equation 1. Converts also pseudo-velocity response spectrum values to SA, using: SA = (PSV * W)/ratio(SA_larger/SA_geo_mean) W = (2 ...
['def', '_compute_mean', '(', 'self', ',', 'C', ',', 'rup', ',', 'dists', ',', 'sites', ',', 'imt', ')', ':', 'mean', '=', '(', 'self', '.', '_compute_term_1_2', '(', 'rup', ',', 'C', ')', '+', 'self', '.', '_compute_term_3_4', '(', 'dists', ',', 'C', ')', '+', 'self', '.', '_get_site_amplification', '(', 'sites', ',',...
Compute mean value for PGA and pseudo-velocity response spectrum, as given in equation 1. Converts also pseudo-velocity response spectrum values to SA, using: SA = (PSV * W)/ratio(SA_larger/SA_geo_mean) W = (2 * pi / T) T = period (sec)
['Compute', 'mean', 'value', 'for', 'PGA', 'and', 'pseudo', '-', 'velocity', 'response', 'spectrum', 'as', 'given', 'in', 'equation', '1', '.', 'Converts', 'also', 'pseudo', '-', 'velocity', 'response', 'spectrum', 'values', 'to', 'SA', 'using', ':']
train
https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/hazardlib/gsim/climent_1994.py#L150-L172
2,145
dcaune/perseus-lib-python-common
majormode/perseus/model/place.py
Place._eq__
def _eq__(self, other): """ Compare the current place object to another passed to the comparison method. The two place objects must have the same identification, even if some of their attributes might be different. @param other: a ``Place`` instance to compare with the current ...
python
def _eq__(self, other): """ Compare the current place object to another passed to the comparison method. The two place objects must have the same identification, even if some of their attributes might be different. @param other: a ``Place`` instance to compare with the current ...
['def', '_eq__', '(', 'self', ',', 'other', ')', ':', 'return', 'self', '.', 'place_id', 'and', 'other', '.', 'place_id', 'and', 'self', '.', 'place_id', '==', 'other', '.', 'place_id']
Compare the current place object to another passed to the comparison method. The two place objects must have the same identification, even if some of their attributes might be different. @param other: a ``Place`` instance to compare with the current place object. @return: ...
['Compare', 'the', 'current', 'place', 'object', 'to', 'another', 'passed', 'to', 'the', 'comparison', 'method', '.', 'The', 'two', 'place', 'objects', 'must', 'have', 'the', 'same', 'identification', 'even', 'if', 'some', 'of', 'their', 'attributes', 'might', 'be', 'different', '.']
train
https://github.com/dcaune/perseus-lib-python-common/blob/ba48fe0fd9bb4a75b53e7d10c41ada36a72d4496/majormode/perseus/model/place.py#L138-L151
2,146
vals/umis
umis/umis.py
guess_depth_cutoff
def guess_depth_cutoff(cb_histogram): ''' Guesses at an appropriate barcode cutoff ''' with read_cbhistogram(cb_histogram) as fh: cb_vals = [int(p.strip().split()[1]) for p in fh] histo = np.histogram(np.log10(cb_vals), bins=50) vals = histo[0] edges = histo[1] mids = np.array([(edge...
python
def guess_depth_cutoff(cb_histogram): ''' Guesses at an appropriate barcode cutoff ''' with read_cbhistogram(cb_histogram) as fh: cb_vals = [int(p.strip().split()[1]) for p in fh] histo = np.histogram(np.log10(cb_vals), bins=50) vals = histo[0] edges = histo[1] mids = np.array([(edge...
['def', 'guess_depth_cutoff', '(', 'cb_histogram', ')', ':', 'with', 'read_cbhistogram', '(', 'cb_histogram', ')', 'as', 'fh', ':', 'cb_vals', '=', '[', 'int', '(', 'p', '.', 'strip', '(', ')', '.', 'split', '(', ')', '[', '1', ']', ')', 'for', 'p', 'in', 'fh', ']', 'histo', '=', 'np', '.', 'histogram', '(', 'np', '.',...
Guesses at an appropriate barcode cutoff
['Guesses', 'at', 'an', 'appropriate', 'barcode', 'cutoff']
train
https://github.com/vals/umis/blob/e8adb8486d9e9134ab8a6cad9811a7e74dcc4a2c/umis/umis.py#L1020-L1044
2,147
google/grr
grr/server/grr_response_server/flows/general/collectors.py
ArtifactExpander._ExpandArtifactFilesSource
def _ExpandArtifactFilesSource(self, source, requested): """Recursively expands an artifact files source.""" expanded_source = rdf_artifacts.ExpandedSource(base_source=source) sub_sources = [] artifact_list = [] if "artifact_list" in source.attributes: artifact_list = source.attributes["artifa...
python
def _ExpandArtifactFilesSource(self, source, requested): """Recursively expands an artifact files source.""" expanded_source = rdf_artifacts.ExpandedSource(base_source=source) sub_sources = [] artifact_list = [] if "artifact_list" in source.attributes: artifact_list = source.attributes["artifa...
['def', '_ExpandArtifactFilesSource', '(', 'self', ',', 'source', ',', 'requested', ')', ':', 'expanded_source', '=', 'rdf_artifacts', '.', 'ExpandedSource', '(', 'base_source', '=', 'source', ')', 'sub_sources', '=', '[', ']', 'artifact_list', '=', '[', ']', 'if', '"artifact_list"', 'in', 'source', '.', 'attributes', ...
Recursively expands an artifact files source.
['Recursively', 'expands', 'an', 'artifact', 'files', 'source', '.']
train
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/flows/general/collectors.py#L1080-L1095
2,148
vertica/vertica-python
vertica_python/vertica/cursor.py
Cursor.copy
def copy(self, sql, data, **kwargs): """ EXAMPLE: >> with open("/tmp/file.csv", "rb") as fs: >> cursor.copy("COPY table(field1,field2) FROM STDIN DELIMITER ',' ENCLOSED BY ''''", >> fs, buffer_size=65536) """ sql = as_text(sql) ...
python
def copy(self, sql, data, **kwargs): """ EXAMPLE: >> with open("/tmp/file.csv", "rb") as fs: >> cursor.copy("COPY table(field1,field2) FROM STDIN DELIMITER ',' ENCLOSED BY ''''", >> fs, buffer_size=65536) """ sql = as_text(sql) ...
['def', 'copy', '(', 'self', ',', 'sql', ',', 'data', ',', '*', '*', 'kwargs', ')', ':', 'sql', '=', 'as_text', '(', 'sql', ')', 'if', 'self', '.', 'closed', '(', ')', ':', 'raise', 'errors', '.', 'InterfaceError', '(', "'Cursor is closed'", ')', 'self', '.', 'flush_to_query_ready', '(', ')', 'if', 'isinstance', '(', '...
EXAMPLE: >> with open("/tmp/file.csv", "rb") as fs: >> cursor.copy("COPY table(field1,field2) FROM STDIN DELIMITER ',' ENCLOSED BY ''''", >> fs, buffer_size=65536)
['EXAMPLE', ':', '>>', 'with', 'open', '(', '/', 'tmp', '/', 'file', '.', 'csv', 'rb', ')', 'as', 'fs', ':', '>>', 'cursor', '.', 'copy', '(', 'COPY', 'table', '(', 'field1', 'field2', ')', 'FROM', 'STDIN', 'DELIMITER', 'ENCLOSED', 'BY', '>>', 'fs', 'buffer_size', '=', '65536', ')']
train
https://github.com/vertica/vertica-python/blob/5619c1b2b2eb5ea751c684b28648fc376b5be29c/vertica_python/vertica/cursor.py#L337-L380
2,149
scikit-umfpack/scikit-umfpack
scikits/umfpack/umfpack.py
UmfpackContext.free_numeric
def free_numeric(self): """Free numeric data""" if self._numeric is not None: self.funs.free_numeric(self._numeric) self._numeric = None self.free_symbolic()
python
def free_numeric(self): """Free numeric data""" if self._numeric is not None: self.funs.free_numeric(self._numeric) self._numeric = None self.free_symbolic()
['def', 'free_numeric', '(', 'self', ')', ':', 'if', 'self', '.', '_numeric', 'is', 'not', 'None', ':', 'self', '.', 'funs', '.', 'free_numeric', '(', 'self', '.', '_numeric', ')', 'self', '.', '_numeric', '=', 'None', 'self', '.', 'free_symbolic', '(', ')']
Free numeric data
['Free', 'numeric', 'data']
train
https://github.com/scikit-umfpack/scikit-umfpack/blob/a2102ef92f4dd060138e72bb5d7c444f8ec49cbc/scikits/umfpack/umfpack.py#L625-L630
2,150
lehins/python-wepay
wepay/calls/withdrawal.py
Withdrawal.__modify
def __modify(self, withdrawal_id, **kwargs): """Call documentation: `/withdrawal/modify <https://www.wepay.com/developer/reference/withdrawal#modify>`_, plus extra keyword parameters: :keyword str access_token: will be used instead of instance's ``access_token``, with...
python
def __modify(self, withdrawal_id, **kwargs): """Call documentation: `/withdrawal/modify <https://www.wepay.com/developer/reference/withdrawal#modify>`_, plus extra keyword parameters: :keyword str access_token: will be used instead of instance's ``access_token``, with...
['def', '__modify', '(', 'self', ',', 'withdrawal_id', ',', '*', '*', 'kwargs', ')', ':', 'params', '=', '{', "'withdrawal_id'", ':', 'withdrawal_id', '}', 'return', 'self', '.', 'make_call', '(', 'self', '.', '__modify', ',', 'params', ',', 'kwargs', ')']
Call documentation: `/withdrawal/modify <https://www.wepay.com/developer/reference/withdrawal#modify>`_, plus extra keyword parameters: :keyword str access_token: will be used instead of instance's ``access_token``, with ``batch_mode=True`` will set `authorization` ...
['Call', 'documentation', ':', '/', 'withdrawal', '/', 'modify', '<https', ':', '//', 'www', '.', 'wepay', '.', 'com', '/', 'developer', '/', 'reference', '/', 'withdrawal#modify', '>', '_', 'plus', 'extra', 'keyword', 'parameters', ':', ':', 'keyword', 'str', 'access_token', ':', 'will', 'be', 'used', 'instead', 'of',...
train
https://github.com/lehins/python-wepay/blob/414d25a1a8d0ecb22a3ddd1f16c60b805bb52a1f/wepay/calls/withdrawal.py#L59-L81
2,151
steenzout/python-object
setup.py
requirements
def requirements(requirements_file): """Return packages mentioned in the given file. Args: requirements_file (str): path to the requirements file to be parsed. Returns: (list): 3rd-party package dependencies contained in the file. """ return [ str(pkg.req) for pkg in parse_...
python
def requirements(requirements_file): """Return packages mentioned in the given file. Args: requirements_file (str): path to the requirements file to be parsed. Returns: (list): 3rd-party package dependencies contained in the file. """ return [ str(pkg.req) for pkg in parse_...
['def', 'requirements', '(', 'requirements_file', ')', ':', 'return', '[', 'str', '(', 'pkg', '.', 'req', ')', 'for', 'pkg', 'in', 'parse_requirements', '(', 'requirements_file', ',', 'session', '=', 'pip_download', '.', 'PipSession', '(', ')', ')', 'if', 'pkg', '.', 'req', 'is', 'not', 'None', ']']
Return packages mentioned in the given file. Args: requirements_file (str): path to the requirements file to be parsed. Returns: (list): 3rd-party package dependencies contained in the file.
['Return', 'packages', 'mentioned', 'in', 'the', 'given', 'file', '.']
train
https://github.com/steenzout/python-object/blob/b865e3eeb4c2435923cf900d3ef2a89c1b35fe18/setup.py#L19-L30
2,152
SeleniumHQ/selenium
py/selenium/webdriver/support/select.py
Select.all_selected_options
def all_selected_options(self): """Returns a list of all selected options belonging to this select tag""" ret = [] for opt in self.options: if opt.is_selected(): ret.append(opt) return ret
python
def all_selected_options(self): """Returns a list of all selected options belonging to this select tag""" ret = [] for opt in self.options: if opt.is_selected(): ret.append(opt) return ret
['def', 'all_selected_options', '(', 'self', ')', ':', 'ret', '=', '[', ']', 'for', 'opt', 'in', 'self', '.', 'options', ':', 'if', 'opt', '.', 'is_selected', '(', ')', ':', 'ret', '.', 'append', '(', 'opt', ')', 'return', 'ret']
Returns a list of all selected options belonging to this select tag
['Returns', 'a', 'list', 'of', 'all', 'selected', 'options', 'belonging', 'to', 'this', 'select', 'tag']
train
https://github.com/SeleniumHQ/selenium/blob/df40c28b41d4b3953f90eaff84838a9ac052b84a/py/selenium/webdriver/support/select.py#L50-L56
2,153
benmack/eo-box
eobox/raster/cube.py
EOCubeChunk.from_eocube
def from_eocube(eocube, ji): """Create a EOCubeChunk object from an EOCube object.""" eocubewin = EOCubeChunk(ji, eocube.df_layers, eocube.chunksize, eocube.wdir) return eocubewin
python
def from_eocube(eocube, ji): """Create a EOCubeChunk object from an EOCube object.""" eocubewin = EOCubeChunk(ji, eocube.df_layers, eocube.chunksize, eocube.wdir) return eocubewin
['def', 'from_eocube', '(', 'eocube', ',', 'ji', ')', ':', 'eocubewin', '=', 'EOCubeChunk', '(', 'ji', ',', 'eocube', '.', 'df_layers', ',', 'eocube', '.', 'chunksize', ',', 'eocube', '.', 'wdir', ')', 'return', 'eocubewin']
Create a EOCubeChunk object from an EOCube object.
['Create', 'a', 'EOCubeChunk', 'object', 'from', 'an', 'EOCube', 'object', '.']
train
https://github.com/benmack/eo-box/blob/a291450c766bf50ea06adcdeb5729a4aad790ed5/eobox/raster/cube.py#L346-L349
2,154
xflr6/graphviz
graphviz/backend.py
render
def render(engine, format, filepath, renderer=None, formatter=None, quiet=False): """Render file with Graphviz ``engine`` into ``format``, return result filename. Args: engine: The layout commmand used for rendering (``'dot'``, ``'neato'``, ...). format: The output format used for rendering (`...
python
def render(engine, format, filepath, renderer=None, formatter=None, quiet=False): """Render file with Graphviz ``engine`` into ``format``, return result filename. Args: engine: The layout commmand used for rendering (``'dot'``, ``'neato'``, ...). format: The output format used for rendering (`...
['def', 'render', '(', 'engine', ',', 'format', ',', 'filepath', ',', 'renderer', '=', 'None', ',', 'formatter', '=', 'None', ',', 'quiet', '=', 'False', ')', ':', 'cmd', ',', 'rendered', '=', 'command', '(', 'engine', ',', 'format', ',', 'filepath', ',', 'renderer', ',', 'formatter', ')', 'run', '(', 'cmd', ',', 'capt...
Render file with Graphviz ``engine`` into ``format``, return result filename. Args: engine: The layout commmand used for rendering (``'dot'``, ``'neato'``, ...). format: The output format used for rendering (``'pdf'``, ``'png'``, ...). filepath: Path to the DOT source file to render. ...
['Render', 'file', 'with', 'Graphviz', 'engine', 'into', 'format', 'return', 'result', 'filename', '.']
train
https://github.com/xflr6/graphviz/blob/7376095ef1e47abad7e0b0361b6c9720b706e7a0/graphviz/backend.py#L164-L184
2,155
RedHatInsights/insights-core
examples/rules/sample_script.py
report
def report(rel): """Fires if the machine is running Fedora.""" if "Fedora" in rel.product: return make_pass("IS_FEDORA", product=rel.product) else: return make_fail("IS_NOT_FEDORA", product=rel.product)
python
def report(rel): """Fires if the machine is running Fedora.""" if "Fedora" in rel.product: return make_pass("IS_FEDORA", product=rel.product) else: return make_fail("IS_NOT_FEDORA", product=rel.product)
['def', 'report', '(', 'rel', ')', ':', 'if', '"Fedora"', 'in', 'rel', '.', 'product', ':', 'return', 'make_pass', '(', '"IS_FEDORA"', ',', 'product', '=', 'rel', '.', 'product', ')', 'else', ':', 'return', 'make_fail', '(', '"IS_NOT_FEDORA"', ',', 'product', '=', 'rel', '.', 'product', ')']
Fires if the machine is running Fedora.
['Fires', 'if', 'the', 'machine', 'is', 'running', 'Fedora', '.']
train
https://github.com/RedHatInsights/insights-core/blob/b57cbf8ed7c089672426ede0441e0a4f789ef4a1/examples/rules/sample_script.py#L24-L30
2,156
projectatomic/osbs-client
osbs/api.py
OSBS.get_compression_extension
def get_compression_extension(self): """ Find the filename extension for the 'docker save' output, which may or may not be compressed. Raises OsbsValidationException if the extension cannot be determined due to a configuration error. :returns: str including leading dot,...
python
def get_compression_extension(self): """ Find the filename extension for the 'docker save' output, which may or may not be compressed. Raises OsbsValidationException if the extension cannot be determined due to a configuration error. :returns: str including leading dot,...
['def', 'get_compression_extension', '(', 'self', ')', ':', 'build_request', '=', 'BuildRequest', '(', 'build_json_store', '=', 'self', '.', 'os_conf', '.', 'get_build_json_store', '(', ')', ')', 'inner', '=', 'build_request', '.', 'inner_template', 'postbuild_plugins', '=', 'inner', '.', 'get', '(', "'postbuild_plugin...
Find the filename extension for the 'docker save' output, which may or may not be compressed. Raises OsbsValidationException if the extension cannot be determined due to a configuration error. :returns: str including leading dot, or else None if no compression
['Find', 'the', 'filename', 'extension', 'for', 'the', 'docker', 'save', 'output', 'which', 'may', 'or', 'may', 'not', 'be', 'compressed', '.']
train
https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/api.py#L1267-L1292
2,157
oceanprotocol/oceandb-bigchaindb-driver
oceandb_bigchaindb_driver/instance.py
ed25519_generate_key_pair_from_secret
def ed25519_generate_key_pair_from_secret(secret): """ Generate a new key pair. Args: secret (:class:`string`): A secret that serves as a seed Returns: A tuple of (private_key, public_key) encoded in base58. """ # if you want to do this correctly, use a key derivation function! ...
python
def ed25519_generate_key_pair_from_secret(secret): """ Generate a new key pair. Args: secret (:class:`string`): A secret that serves as a seed Returns: A tuple of (private_key, public_key) encoded in base58. """ # if you want to do this correctly, use a key derivation function! ...
['def', 'ed25519_generate_key_pair_from_secret', '(', 'secret', ')', ':', '# if you want to do this correctly, use a key derivation function!', 'if', 'not', 'isinstance', '(', 'secret', ',', 'bytes', ')', ':', 'secret', '=', 'secret', '.', 'encode', '(', ')', 'hash_bytes', '=', 'sha3', '.', 'keccak_256', '(', 'secret',...
Generate a new key pair. Args: secret (:class:`string`): A secret that serves as a seed Returns: A tuple of (private_key, public_key) encoded in base58.
['Generate', 'a', 'new', 'key', 'pair', '.', 'Args', ':', 'secret', '(', ':', 'class', ':', 'string', ')', ':', 'A', 'secret', 'that', 'serves', 'as', 'a', 'seed', 'Returns', ':', 'A', 'tuple', 'of', '(', 'private_key', 'public_key', ')', 'encoded', 'in', 'base58', '.']
train
https://github.com/oceanprotocol/oceandb-bigchaindb-driver/blob/82315bcc9f7ba8b01beb08014bdeb541546c6671/oceandb_bigchaindb_driver/instance.py#L48-L69
2,158
djgagne/hagelslag
hagelslag/processing/TrackProcessing.py
TrackProcessor.find_mrms_tracks
def find_mrms_tracks(self): """ Identify objects from MRMS timesteps and link them together with object matching. Returns: List of STObjects containing MESH track information. """ obs_objects = [] tracked_obs_objects = [] if self.mrms_ew is not None: ...
python
def find_mrms_tracks(self): """ Identify objects from MRMS timesteps and link them together with object matching. Returns: List of STObjects containing MESH track information. """ obs_objects = [] tracked_obs_objects = [] if self.mrms_ew is not None: ...
['def', 'find_mrms_tracks', '(', 'self', ')', ':', 'obs_objects', '=', '[', ']', 'tracked_obs_objects', '=', '[', ']', 'if', 'self', '.', 'mrms_ew', 'is', 'not', 'None', ':', 'self', '.', 'mrms_grid', '.', 'load_data', '(', ')', 'if', 'len', '(', 'self', '.', 'mrms_grid', '.', 'data', ')', '!=', 'len', '(', 'self', '.'...
Identify objects from MRMS timesteps and link them together with object matching. Returns: List of STObjects containing MESH track information.
['Identify', 'objects', 'from', 'MRMS', 'timesteps', 'and', 'link', 'them', 'together', 'with', 'object', 'matching', '.']
train
https://github.com/djgagne/hagelslag/blob/6fb6c3df90bf4867e13a97d3460b14471d107df1/hagelslag/processing/TrackProcessing.py#L267-L328
2,159
foremast/foremast
src/foremast/awslambda/awslambda.py
LambdaFunction.update_function_configuration
def update_function_configuration(self, vpc_config): """Update existing Lambda function configuration. Args: vpc_config (dict): Dictionary of SubnetIds and SecurityGroupsIds for using a VPC in lambda """ LOG.info('Updating configuration for lam...
python
def update_function_configuration(self, vpc_config): """Update existing Lambda function configuration. Args: vpc_config (dict): Dictionary of SubnetIds and SecurityGroupsIds for using a VPC in lambda """ LOG.info('Updating configuration for lam...
['def', 'update_function_configuration', '(', 'self', ',', 'vpc_config', ')', ':', 'LOG', '.', 'info', '(', "'Updating configuration for lambda function: %s'", ',', 'self', '.', 'app_name', ')', 'try', ':', 'self', '.', 'lambda_client', '.', 'update_function_configuration', '(', 'Environment', '=', 'self', '.', 'lambda...
Update existing Lambda function configuration. Args: vpc_config (dict): Dictionary of SubnetIds and SecurityGroupsIds for using a VPC in lambda
['Update', 'existing', 'Lambda', 'function', 'configuration', '.']
train
https://github.com/foremast/foremast/blob/fb70f29b8ce532f061685a17d120486e47b215ba/src/foremast/awslambda/awslambda.py#L165-L206
2,160
tanghaibao/jcvi
jcvi/apps/phylo.py
run_gblocks
def run_gblocks(align_fasta_file, **kwargs): """ remove poorly aligned positions and divergent regions with Gblocks """ cl = GblocksCommandline(aln_file=align_fasta_file, **kwargs) r, e = cl.run() print("Gblocks:", cl, file=sys.stderr) if e: print("***Gblocks could not run", file=s...
python
def run_gblocks(align_fasta_file, **kwargs): """ remove poorly aligned positions and divergent regions with Gblocks """ cl = GblocksCommandline(aln_file=align_fasta_file, **kwargs) r, e = cl.run() print("Gblocks:", cl, file=sys.stderr) if e: print("***Gblocks could not run", file=s...
['def', 'run_gblocks', '(', 'align_fasta_file', ',', '*', '*', 'kwargs', ')', ':', 'cl', '=', 'GblocksCommandline', '(', 'aln_file', '=', 'align_fasta_file', ',', '*', '*', 'kwargs', ')', 'r', ',', 'e', '=', 'cl', '.', 'run', '(', ')', 'print', '(', '"Gblocks:"', ',', 'cl', ',', 'file', '=', 'sys', '.', 'stderr', ')', ...
remove poorly aligned positions and divergent regions with Gblocks
['remove', 'poorly', 'aligned', 'positions', 'and', 'divergent', 'regions', 'with', 'Gblocks']
train
https://github.com/tanghaibao/jcvi/blob/d2e31a77b6ade7f41f3b321febc2b4744d1cdeca/jcvi/apps/phylo.py#L152-L174
2,161
10gen/mongo-orchestration
mongo_orchestration/process.py
kill_mprocess
def kill_mprocess(process): """kill process Args: process - Popen object for process """ if process and proc_alive(process): process.terminate() process.communicate() return not proc_alive(process)
python
def kill_mprocess(process): """kill process Args: process - Popen object for process """ if process and proc_alive(process): process.terminate() process.communicate() return not proc_alive(process)
['def', 'kill_mprocess', '(', 'process', ')', ':', 'if', 'process', 'and', 'proc_alive', '(', 'process', ')', ':', 'process', '.', 'terminate', '(', ')', 'process', '.', 'communicate', '(', ')', 'return', 'not', 'proc_alive', '(', 'process', ')']
kill process Args: process - Popen object for process
['kill', 'process', 'Args', ':', 'process', '-', 'Popen', 'object', 'for', 'process']
train
https://github.com/10gen/mongo-orchestration/blob/81fd2224205922ea2178b08190b53a33aec47261/mongo_orchestration/process.py#L263-L271
2,162
Aula13/poloniex
poloniex/poloniex.py
Poloniex.createLoanOffer
def createLoanOffer(self, currency, amount, duration, autoRenew, lendingRate): """Creates a loan offer for a given currency. Required POST parameters are "currency", "amount", "duration", "autoRenew" (0 or 1), and "lendingRate". """ return self._private('createLoa...
python
def createLoanOffer(self, currency, amount, duration, autoRenew, lendingRate): """Creates a loan offer for a given currency. Required POST parameters are "currency", "amount", "duration", "autoRenew" (0 or 1), and "lendingRate". """ return self._private('createLoa...
['def', 'createLoanOffer', '(', 'self', ',', 'currency', ',', 'amount', ',', 'duration', ',', 'autoRenew', ',', 'lendingRate', ')', ':', 'return', 'self', '.', '_private', '(', "'createLoanOffer'", ',', 'currency', '=', 'currency', ',', 'amount', '=', 'amount', ',', 'duration', '=', 'duration', ',', 'autoRenew', '=', '...
Creates a loan offer for a given currency. Required POST parameters are "currency", "amount", "duration", "autoRenew" (0 or 1), and "lendingRate".
['Creates', 'a', 'loan', 'offer', 'for', 'a', 'given', 'currency', '.', 'Required', 'POST', 'parameters', 'are', 'currency', 'amount', 'duration', 'autoRenew', '(', '0', 'or', '1', ')', 'and', 'lendingRate', '.']
train
https://github.com/Aula13/poloniex/blob/a5bfc91e766e220bf77f5e3a1b131f095913e714/poloniex/poloniex.py#L369-L376
2,163
jmgilman/Neolib
neolib/pyamf/amf3.py
Context.addProxyObject
def addProxyObject(self, obj, proxied): """ Stores a reference to the unproxied and proxied versions of C{obj} for later retrieval. @since: 0.6 """ self.proxied_objects[id(obj)] = proxied self.proxied_objects[id(proxied)] = obj
python
def addProxyObject(self, obj, proxied): """ Stores a reference to the unproxied and proxied versions of C{obj} for later retrieval. @since: 0.6 """ self.proxied_objects[id(obj)] = proxied self.proxied_objects[id(proxied)] = obj
['def', 'addProxyObject', '(', 'self', ',', 'obj', ',', 'proxied', ')', ':', 'self', '.', 'proxied_objects', '[', 'id', '(', 'obj', ')', ']', '=', 'proxied', 'self', '.', 'proxied_objects', '[', 'id', '(', 'proxied', ')', ']', '=', 'obj']
Stores a reference to the unproxied and proxied versions of C{obj} for later retrieval. @since: 0.6
['Stores', 'a', 'reference', 'to', 'the', 'unproxied', 'and', 'proxied', 'versions', 'of', 'C', '{', 'obj', '}', 'for', 'later', 'retrieval', '.']
train
https://github.com/jmgilman/Neolib/blob/228fafeaed0f3195676137732384a14820ae285c/neolib/pyamf/amf3.py#L713-L721
2,164
rapidpro/expressions
python/temba_expressions/conversions.py
to_repr
def to_repr(value, ctx): """ Converts a value back to its representation form, e.g. x -> "x" """ as_string = to_string(value, ctx) if isinstance(value, str) or isinstance(value, datetime.date) or isinstance(value, datetime.time): as_string = as_string.replace('"', '""') # escape quotes by ...
python
def to_repr(value, ctx): """ Converts a value back to its representation form, e.g. x -> "x" """ as_string = to_string(value, ctx) if isinstance(value, str) or isinstance(value, datetime.date) or isinstance(value, datetime.time): as_string = as_string.replace('"', '""') # escape quotes by ...
['def', 'to_repr', '(', 'value', ',', 'ctx', ')', ':', 'as_string', '=', 'to_string', '(', 'value', ',', 'ctx', ')', 'if', 'isinstance', '(', 'value', ',', 'str', ')', 'or', 'isinstance', '(', 'value', ',', 'datetime', '.', 'date', ')', 'or', 'isinstance', '(', 'value', ',', 'datetime', '.', 'time', ')', ':', 'as_strin...
Converts a value back to its representation form, e.g. x -> "x"
['Converts', 'a', 'value', 'back', 'to', 'its', 'representation', 'form', 'e', '.', 'g', '.', 'x', '-', '>', 'x']
train
https://github.com/rapidpro/expressions/blob/b03d91ec58fc328960bce90ecb5fa49dcf467627/python/temba_expressions/conversions.py#L187-L197
2,165
koszullab/metaTOR
metator/scripts/hicstuff.py
bin_matrix
def bin_matrix(M, subsampling_factor=3): """Bin either sparse or dense matrices. """ try: from scipy.sparse import issparse if issparse(M): return bin_sparse(M, subsampling_factor=subsampling_factor) else: raise ImportError except ImportError: ret...
python
def bin_matrix(M, subsampling_factor=3): """Bin either sparse or dense matrices. """ try: from scipy.sparse import issparse if issparse(M): return bin_sparse(M, subsampling_factor=subsampling_factor) else: raise ImportError except ImportError: ret...
['def', 'bin_matrix', '(', 'M', ',', 'subsampling_factor', '=', '3', ')', ':', 'try', ':', 'from', 'scipy', '.', 'sparse', 'import', 'issparse', 'if', 'issparse', '(', 'M', ')', ':', 'return', 'bin_sparse', '(', 'M', ',', 'subsampling_factor', '=', 'subsampling_factor', ')', 'else', ':', 'raise', 'ImportError', 'except...
Bin either sparse or dense matrices.
['Bin', 'either', 'sparse', 'or', 'dense', 'matrices', '.']
train
https://github.com/koszullab/metaTOR/blob/0c1203d1dffedfa5ea380c0335b4baa9cfb7e89a/metator/scripts/hicstuff.py#L208-L219
2,166
google/budou
budou/chunk.py
ChunkList.get_overlaps
def get_overlaps(self, offset, length): """Returns chunks overlapped with the given range. Args: offset (int): Begin offset of the range. length (int): Length of the range. Returns: Overlapped chunks. (:obj:`budou.chunk.ChunkList`) """ # In case entity's offset points to a space ...
python
def get_overlaps(self, offset, length): """Returns chunks overlapped with the given range. Args: offset (int): Begin offset of the range. length (int): Length of the range. Returns: Overlapped chunks. (:obj:`budou.chunk.ChunkList`) """ # In case entity's offset points to a space ...
['def', 'get_overlaps', '(', 'self', ',', 'offset', ',', 'length', ')', ':', "# In case entity's offset points to a space just before the entity.", 'if', "''", '.', 'join', '(', '[', 'chunk', '.', 'word', 'for', 'chunk', 'in', 'self', ']', ')', '[', 'offset', ']', '==', "' '", ':', 'offset', '+=', '1', 'index', '=', '0...
Returns chunks overlapped with the given range. Args: offset (int): Begin offset of the range. length (int): Length of the range. Returns: Overlapped chunks. (:obj:`budou.chunk.ChunkList`)
['Returns', 'chunks', 'overlapped', 'with', 'the', 'given', 'range', '.']
train
https://github.com/google/budou/blob/101224e6523186851f38ee57a6b2e7bdbd826de2/budou/chunk.py#L189-L208
2,167
tango-controls/pytango
tango/tango_object.py
Server.get_devices
def get_devices(self): """ Helper that retuns a dict of devices for this server. :return: Returns a tuple of two elements: - dict<tango class name : list of device names> - dict<device names : tango class name> :rtype: tuple<dict, dict> ""...
python
def get_devices(self): """ Helper that retuns a dict of devices for this server. :return: Returns a tuple of two elements: - dict<tango class name : list of device names> - dict<device names : tango class name> :rtype: tuple<dict, dict> ""...
['def', 'get_devices', '(', 'self', ')', ':', 'if', 'self', '.', '__util', 'is', 'None', ':', 'import', 'tango', 'db', '=', 'tango', '.', 'Database', '(', ')', 'else', ':', 'db', '=', 'self', '.', '__util', '.', 'get_database', '(', ')', 'server', '=', 'self', '.', 'server_instance', 'dev_list', '=', 'db', '.', 'get_de...
Helper that retuns a dict of devices for this server. :return: Returns a tuple of two elements: - dict<tango class name : list of device names> - dict<device names : tango class name> :rtype: tuple<dict, dict>
['Helper', 'that', 'retuns', 'a', 'dict', 'of', 'devices', 'for', 'this', 'server', '.']
train
https://github.com/tango-controls/pytango/blob/9cf78c517c9cdc1081ff6d080a9646a740cc1d36/tango/tango_object.py#L476-L501
2,168
saltstack/salt
salt/proxy/cimc.py
init
def init(opts): ''' This function gets called when the proxy starts up. ''' if 'host' not in opts['proxy']: log.critical('No \'host\' key found in pillar for this proxy.') return False if 'username' not in opts['proxy']: log.critical('No \'username\' key found in pillar for t...
python
def init(opts): ''' This function gets called when the proxy starts up. ''' if 'host' not in opts['proxy']: log.critical('No \'host\' key found in pillar for this proxy.') return False if 'username' not in opts['proxy']: log.critical('No \'username\' key found in pillar for t...
['def', 'init', '(', 'opts', ')', ':', 'if', "'host'", 'not', 'in', 'opts', '[', "'proxy'", ']', ':', 'log', '.', 'critical', '(', "'No \\'host\\' key found in pillar for this proxy.'", ')', 'return', 'False', 'if', "'username'", 'not', 'in', 'opts', '[', "'proxy'", ']', ':', 'log', '.', 'critical', '(', "'No \\'userna...
This function gets called when the proxy starts up.
['This', 'function', 'gets', 'called', 'when', 'the', 'proxy', 'starts', 'up', '.']
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/proxy/cimc.py#L110-L139
2,169
apple/turicreate
deps/src/libxml2-2.9.1/python/libxml2.py
xmlDoc.nodeDumpOutput
def nodeDumpOutput(self, buf, cur, level, format, encoding): """Dump an XML node, recursive behaviour, children are printed too. Note that @format = 1 provide node indenting only if xmlIndentTreeOutput = 1 or xmlKeepBlanksDefault(0) was called """ if buf is None: buf__o = ...
python
def nodeDumpOutput(self, buf, cur, level, format, encoding): """Dump an XML node, recursive behaviour, children are printed too. Note that @format = 1 provide node indenting only if xmlIndentTreeOutput = 1 or xmlKeepBlanksDefault(0) was called """ if buf is None: buf__o = ...
['def', 'nodeDumpOutput', '(', 'self', ',', 'buf', ',', 'cur', ',', 'level', ',', 'format', ',', 'encoding', ')', ':', 'if', 'buf', 'is', 'None', ':', 'buf__o', '=', 'None', 'else', ':', 'buf__o', '=', 'buf', '.', '_o', 'if', 'cur', 'is', 'None', ':', 'cur__o', '=', 'None', 'else', ':', 'cur__o', '=', 'cur', '.', '_o',...
Dump an XML node, recursive behaviour, children are printed too. Note that @format = 1 provide node indenting only if xmlIndentTreeOutput = 1 or xmlKeepBlanksDefault(0) was called
['Dump', 'an', 'XML', 'node', 'recursive', 'behaviour', 'children', 'are', 'printed', 'too', '.', 'Note', 'that']
train
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/libxml2-2.9.1/python/libxml2.py#L4418-L4427
2,170
echinopsii/net.echinopsii.ariane.community.cli.python3
ariane_clip3/directory.py
OSInstance.add_application
def add_application(self, application, sync=True): """ add an application to this OS instance. :param application: the application to add on this OS instance :param sync: If sync=True(default) synchronize with Ariane server. If sync=False, add the application object on list to be...
python
def add_application(self, application, sync=True): """ add an application to this OS instance. :param application: the application to add on this OS instance :param sync: If sync=True(default) synchronize with Ariane server. If sync=False, add the application object on list to be...
['def', 'add_application', '(', 'self', ',', 'application', ',', 'sync', '=', 'True', ')', ':', 'LOGGER', '.', 'debug', '(', '"OSInstance.add_application"', ')', 'if', 'not', 'sync', ':', 'self', '.', 'application_2_add', '.', 'append', '(', 'application', ')', 'else', ':', 'if', 'application', '.', 'id', 'is', 'None',...
add an application to this OS instance. :param application: the application to add on this OS instance :param sync: If sync=True(default) synchronize with Ariane server. If sync=False, add the application object on list to be added on next save(). :return:
['add', 'an', 'application', 'to', 'this', 'OS', 'instance', '.', ':', 'param', 'application', ':', 'the', 'application', 'to', 'add', 'on', 'this', 'OS', 'instance', ':', 'param', 'sync', ':', 'If', 'sync', '=', 'True', '(', 'default', ')', 'synchronize', 'with', 'Ariane', 'server', '.', 'If', 'sync', '=', 'False', 'a...
train
https://github.com/echinopsii/net.echinopsii.ariane.community.cli.python3/blob/0a7feddebf66fee4bef38d64f456d93a7e9fcd68/ariane_clip3/directory.py#L2317-L2351
2,171
YosaiProject/yosai
yosai/core/subject/subject.py
Yosai.requires_user
def requires_user(fn): """ Requires that the calling Subject be *either* authenticated *or* remembered via RememberMe services before allowing access. This method essentially ensures that subject.identifiers IS NOT None :raises UnauthenticatedException: indicating that the deco...
python
def requires_user(fn): """ Requires that the calling Subject be *either* authenticated *or* remembered via RememberMe services before allowing access. This method essentially ensures that subject.identifiers IS NOT None :raises UnauthenticatedException: indicating that the deco...
['def', 'requires_user', '(', 'fn', ')', ':', '@', 'functools', '.', 'wraps', '(', 'fn', ')', 'def', 'wrap', '(', '*', 'args', ',', '*', '*', 'kwargs', ')', ':', 'subject', '=', 'Yosai', '.', 'get_current_subject', '(', ')', 'if', 'subject', '.', 'identifiers', 'is', 'None', ':', 'msg', '=', '(', '"Attempting to perfor...
Requires that the calling Subject be *either* authenticated *or* remembered via RememberMe services before allowing access. This method essentially ensures that subject.identifiers IS NOT None :raises UnauthenticatedException: indicating that the decorated method is ...
['Requires', 'that', 'the', 'calling', 'Subject', 'be', '*', 'either', '*', 'authenticated', '*', 'or', '*', 'remembered', 'via', 'RememberMe', 'services', 'before', 'allowing', 'access', '.']
train
https://github.com/YosaiProject/yosai/blob/7f96aa6b837ceae9bf3d7387cd7e35f5ab032575/yosai/core/subject/subject.py#L861-L886
2,172
neo4j-contrib/neomodel
neomodel/core.py
StructuredNode.create
def create(cls, *props, **kwargs): """ Call to CREATE with parameters map. A new instance will be created and saved. :param props: dict of properties to create the nodes. :type props: tuple :param lazy: False by default, specify True to get nodes with id only without the paramet...
python
def create(cls, *props, **kwargs): """ Call to CREATE with parameters map. A new instance will be created and saved. :param props: dict of properties to create the nodes. :type props: tuple :param lazy: False by default, specify True to get nodes with id only without the paramet...
['def', 'create', '(', 'cls', ',', '*', 'props', ',', '*', '*', 'kwargs', ')', ':', 'if', "'streaming'", 'in', 'kwargs', ':', 'warnings', '.', 'warn', '(', "'streaming is not supported by bolt, please remove the kwarg'", ',', 'category', '=', 'DeprecationWarning', ',', 'stacklevel', '=', '1', ')', 'lazy', '=', 'kwargs'...
Call to CREATE with parameters map. A new instance will be created and saved. :param props: dict of properties to create the nodes. :type props: tuple :param lazy: False by default, specify True to get nodes with id only without the parameters. :type: bool :rtype: list
['Call', 'to', 'CREATE', 'with', 'parameters', 'map', '.', 'A', 'new', 'instance', 'will', 'be', 'created', 'and', 'saved', '.']
train
https://github.com/neo4j-contrib/neomodel/blob/cca5de4c4e90998293558b871b1b529095c91a38/neomodel/core.py#L303-L339
2,173
GoogleCloudPlatform/cloud-debug-python
src/googleclouddebugger/module_utils2.py
IsPathSuffix
def IsPathSuffix(mod_path, path): """Checks whether path is a full path suffix of mod_path. Args: mod_path: Must be an absolute path to a source file. Must not have file extension. path: A relative path. Must not have file extension. Returns: True if path is a full path suffix of mod_p...
python
def IsPathSuffix(mod_path, path): """Checks whether path is a full path suffix of mod_path. Args: mod_path: Must be an absolute path to a source file. Must not have file extension. path: A relative path. Must not have file extension. Returns: True if path is a full path suffix of mod_p...
['def', 'IsPathSuffix', '(', 'mod_path', ',', 'path', ')', ':', 'return', '(', 'mod_path', '.', 'endswith', '(', 'path', ')', 'and', '(', 'len', '(', 'mod_path', ')', '==', 'len', '(', 'path', ')', 'or', 'mod_path', '[', ':', '-', 'len', '(', 'path', ')', ']', '.', 'endswith', '(', 'os', '.', 'sep', ')', ')', ')']
Checks whether path is a full path suffix of mod_path. Args: mod_path: Must be an absolute path to a source file. Must not have file extension. path: A relative path. Must not have file extension. Returns: True if path is a full path suffix of mod_path. False otherwise.
['Checks', 'whether', 'path', 'is', 'a', 'full', 'path', 'suffix', 'of', 'mod_path', '.']
train
https://github.com/GoogleCloudPlatform/cloud-debug-python/blob/89ce3782c98b814838a3ecb5479ed3882368cbee/src/googleclouddebugger/module_utils2.py#L21-L34
2,174
nerdvegas/rez
src/rez/status.py
Status.print_tools
def print_tools(self, pattern=None, buf=sys.stdout): """Print a list of visible tools. Args: pattern (str): Only list tools that match this glob pattern. """ seen = set() rows = [] context = self.context if context: data = context.get_too...
python
def print_tools(self, pattern=None, buf=sys.stdout): """Print a list of visible tools. Args: pattern (str): Only list tools that match this glob pattern. """ seen = set() rows = [] context = self.context if context: data = context.get_too...
['def', 'print_tools', '(', 'self', ',', 'pattern', '=', 'None', ',', 'buf', '=', 'sys', '.', 'stdout', ')', ':', 'seen', '=', 'set', '(', ')', 'rows', '=', '[', ']', 'context', '=', 'self', '.', 'context', 'if', 'context', ':', 'data', '=', 'context', '.', 'get_tools', '(', ')', 'conflicts', '=', 'set', '(', 'context'...
Print a list of visible tools. Args: pattern (str): Only list tools that match this glob pattern.
['Print', 'a', 'list', 'of', 'visible', 'tools', '.']
train
https://github.com/nerdvegas/rez/blob/1d3b846d53b5b5404edfe8ddb9083f9ceec8c5e7/src/rez/status.py#L120-L193
2,175
dmlc/gluon-nlp
scripts/word_embeddings/data.py
transform_data_fasttext
def transform_data_fasttext(data, vocab, idx_to_counts, cbow, ngram_buckets, ngrams, batch_size, window_size, frequent_token_subsampling=1E-4, dtype='float32', index_dtype='int64'): """Transform a DataStream of coded DataSets to a D...
python
def transform_data_fasttext(data, vocab, idx_to_counts, cbow, ngram_buckets, ngrams, batch_size, window_size, frequent_token_subsampling=1E-4, dtype='float32', index_dtype='int64'): """Transform a DataStream of coded DataSets to a D...
['def', 'transform_data_fasttext', '(', 'data', ',', 'vocab', ',', 'idx_to_counts', ',', 'cbow', ',', 'ngram_buckets', ',', 'ngrams', ',', 'batch_size', ',', 'window_size', ',', 'frequent_token_subsampling', '=', '1E-4', ',', 'dtype', '=', "'float32'", ',', 'index_dtype', '=', "'int64'", ')', ':', 'if', 'ngram_buckets'...
Transform a DataStream of coded DataSets to a DataStream of batches. Parameters ---------- data : gluonnlp.data.DataStream DataStream where each sample is a valid input to gluonnlp.data.EmbeddingCenterContextBatchify. vocab : gluonnlp.Vocab Vocabulary containing all tokens whose...
['Transform', 'a', 'DataStream', 'of', 'coded', 'DataSets', 'to', 'a', 'DataStream', 'of', 'batches', '.']
train
https://github.com/dmlc/gluon-nlp/blob/4b83eb6bcc8881e5f1081a3675adaa19fac5c0ba/scripts/word_embeddings/data.py#L134-L252
2,176
twilio/twilio-python
twilio/rest/messaging/v1/session/webhook.py
WebhookList.create
def create(self, target, configuration_url=values.unset, configuration_method=values.unset, configuration_filters=values.unset, configuration_triggers=values.unset, configuration_flow_sid=values.unset, configuration_retry_count=values.unset, ...
python
def create(self, target, configuration_url=values.unset, configuration_method=values.unset, configuration_filters=values.unset, configuration_triggers=values.unset, configuration_flow_sid=values.unset, configuration_retry_count=values.unset, ...
['def', 'create', '(', 'self', ',', 'target', ',', 'configuration_url', '=', 'values', '.', 'unset', ',', 'configuration_method', '=', 'values', '.', 'unset', ',', 'configuration_filters', '=', 'values', '.', 'unset', ',', 'configuration_triggers', '=', 'values', '.', 'unset', ',', 'configuration_flow_sid', '=', 'value...
Create a new WebhookInstance :param WebhookInstance.Target target: The target of this webhook. :param unicode configuration_url: The absolute url the webhook request should be sent to. :param WebhookInstance.Method configuration_method: The HTTP method to be used when sending a webhook request....
['Create', 'a', 'new', 'WebhookInstance']
train
https://github.com/twilio/twilio-python/blob/c867895f55dcc29f522e6e8b8868d0d18483132f/twilio/rest/messaging/v1/session/webhook.py#L120-L165
2,177
twilio/twilio-python
twilio/rest/__init__.py
Client.taskrouter
def taskrouter(self): """ Access the Taskrouter Twilio Domain :returns: Taskrouter Twilio Domain :rtype: twilio.rest.taskrouter.Taskrouter """ if self._taskrouter is None: from twilio.rest.taskrouter import Taskrouter self._taskrouter = Taskrouter...
python
def taskrouter(self): """ Access the Taskrouter Twilio Domain :returns: Taskrouter Twilio Domain :rtype: twilio.rest.taskrouter.Taskrouter """ if self._taskrouter is None: from twilio.rest.taskrouter import Taskrouter self._taskrouter = Taskrouter...
['def', 'taskrouter', '(', 'self', ')', ':', 'if', 'self', '.', '_taskrouter', 'is', 'None', ':', 'from', 'twilio', '.', 'rest', '.', 'taskrouter', 'import', 'Taskrouter', 'self', '.', '_taskrouter', '=', 'Taskrouter', '(', 'self', ')', 'return', 'self', '.', '_taskrouter']
Access the Taskrouter Twilio Domain :returns: Taskrouter Twilio Domain :rtype: twilio.rest.taskrouter.Taskrouter
['Access', 'the', 'Taskrouter', 'Twilio', 'Domain']
train
https://github.com/twilio/twilio-python/blob/c867895f55dcc29f522e6e8b8868d0d18483132f/twilio/rest/__init__.py#L380-L390
2,178
Microsoft/azure-devops-python-api
azure-devops/azure/devops/v5_0/wiki/wiki_client.py
WikiClient.create_page_move
def create_page_move(self, page_move_parameters, project, wiki_identifier, comment=None): """CreatePageMove. Creates a page move operation that updates the path and order of the page as provided in the parameters. :param :class:`<WikiPageMoveParameters> <azure.devops.v5_0.wiki.models.WikiPageMov...
python
def create_page_move(self, page_move_parameters, project, wiki_identifier, comment=None): """CreatePageMove. Creates a page move operation that updates the path and order of the page as provided in the parameters. :param :class:`<WikiPageMoveParameters> <azure.devops.v5_0.wiki.models.WikiPageMov...
['def', 'create_page_move', '(', 'self', ',', 'page_move_parameters', ',', 'project', ',', 'wiki_identifier', ',', 'comment', '=', 'None', ')', ':', 'route_values', '=', '{', '}', 'if', 'project', 'is', 'not', 'None', ':', 'route_values', '[', "'project'", ']', '=', 'self', '.', '_serialize', '.', 'url', '(', "'project...
CreatePageMove. Creates a page move operation that updates the path and order of the page as provided in the parameters. :param :class:`<WikiPageMoveParameters> <azure.devops.v5_0.wiki.models.WikiPageMoveParameters>` page_move_parameters: Page more operation parameters. :param str project: Proje...
['CreatePageMove', '.', 'Creates', 'a', 'page', 'move', 'operation', 'that', 'updates', 'the', 'path', 'and', 'order', 'of', 'the', 'page', 'as', 'provided', 'in', 'the', 'parameters', '.', ':', 'param', ':', 'class', ':', '<WikiPageMoveParameters', '>', '<azure', '.', 'devops', '.', 'v5_0', '.', 'wiki', '.', 'models',...
train
https://github.com/Microsoft/azure-devops-python-api/blob/4777ffda2f5052fabbaddb2abe9cb434e0cf1aa8/azure-devops/azure/devops/v5_0/wiki/wiki_client.py#L62-L89
2,179
spacetelescope/drizzlepac
drizzlepac/staticMask.py
staticMask.close
def close(self): """ Deletes all static mask objects. """ for key in self.masklist.keys(): self.masklist[key] = None self.masklist = {}
python
def close(self): """ Deletes all static mask objects. """ for key in self.masklist.keys(): self.masklist[key] = None self.masklist = {}
['def', 'close', '(', 'self', ')', ':', 'for', 'key', 'in', 'self', '.', 'masklist', '.', 'keys', '(', ')', ':', 'self', '.', 'masklist', '[', 'key', ']', '=', 'None', 'self', '.', 'masklist', '=', '{', '}']
Deletes all static mask objects.
['Deletes', 'all', 'static', 'mask', 'objects', '.']
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/staticMask.py#L241-L246
2,180
tonioo/sievelib
sievelib/commands.py
Command.check_next_arg
def check_next_arg(self, atype, avalue, add=True, check_extension=True): """Argument validity checking This method is usually used by the parser to check if detected argument is allowed for this command. We make a distinction between required and optional arguments. Optional (o...
python
def check_next_arg(self, atype, avalue, add=True, check_extension=True): """Argument validity checking This method is usually used by the parser to check if detected argument is allowed for this command. We make a distinction between required and optional arguments. Optional (o...
['def', 'check_next_arg', '(', 'self', ',', 'atype', ',', 'avalue', ',', 'add', '=', 'True', ',', 'check_extension', '=', 'True', ')', ':', 'if', 'not', 'self', '.', 'has_arguments', '(', ')', ':', 'return', 'False', 'if', 'self', '.', 'iscomplete', '(', 'atype', ',', 'avalue', ')', ':', 'return', 'False', 'if', 'self'...
Argument validity checking This method is usually used by the parser to check if detected argument is allowed for this command. We make a distinction between required and optional arguments. Optional (or tagged) arguments can be provided unordered but not the required ones. ...
['Argument', 'validity', 'checking']
train
https://github.com/tonioo/sievelib/blob/88822d1f1daf30ef3dd9ac74911301b0773ef3c8/sievelib/commands.py#L402-L499
2,181
zxylvlp/PingPHP
pingphp/grammar.py
p_ArrayLiteralContentList
def p_ArrayLiteralContentList(p): ''' ArrayLiteralContentList : ArrayLiteralContent | ArrayLiteralContentList COMMA ArrayLiteralContent ''' if len(p) < 3: p[0] = ArrayLiteralContentList(None, p[1]) else: p[0] = ArrayLiteralContentList(p[1], p[3])
python
def p_ArrayLiteralContentList(p): ''' ArrayLiteralContentList : ArrayLiteralContent | ArrayLiteralContentList COMMA ArrayLiteralContent ''' if len(p) < 3: p[0] = ArrayLiteralContentList(None, p[1]) else: p[0] = ArrayLiteralContentList(p[1], p[3])
['def', 'p_ArrayLiteralContentList', '(', 'p', ')', ':', 'if', 'len', '(', 'p', ')', '<', '3', ':', 'p', '[', '0', ']', '=', 'ArrayLiteralContentList', '(', 'None', ',', 'p', '[', '1', ']', ')', 'else', ':', 'p', '[', '0', ']', '=', 'ArrayLiteralContentList', '(', 'p', '[', '1', ']', ',', 'p', '[', '3', ']', ')']
ArrayLiteralContentList : ArrayLiteralContent | ArrayLiteralContentList COMMA ArrayLiteralContent
['ArrayLiteralContentList', ':', 'ArrayLiteralContent', '|', 'ArrayLiteralContentList', 'COMMA', 'ArrayLiteralContent']
train
https://github.com/zxylvlp/PingPHP/blob/2e9a5f1ef4b5b13310e3f8ff350fa91032357bc5/pingphp/grammar.py#L588-L596
2,182
smarie/python-parsyfiles
parsyfiles/parsing_core_api.py
ParsingPlan.execute
def execute(self, logger: Logger, options: Dict[str, Dict[str, Any]]) -> T: """ Called to parse the object as described in this parsing plan, using the provided arguments for the parser. * Exceptions are caught and wrapped into ParsingException * If result does not match expected type, a...
python
def execute(self, logger: Logger, options: Dict[str, Dict[str, Any]]) -> T: """ Called to parse the object as described in this parsing plan, using the provided arguments for the parser. * Exceptions are caught and wrapped into ParsingException * If result does not match expected type, a...
['def', 'execute', '(', 'self', ',', 'logger', ':', 'Logger', ',', 'options', ':', 'Dict', '[', 'str', ',', 'Dict', '[', 'str', ',', 'Any', ']', ']', ')', '->', 'T', ':', 'try', ':', 'res', '=', 'self', '.', '_execute', '(', 'logger', ',', 'options', ')', 'except', 'Exception', 'as', 'e', ':', 'raise', 'ParsingExceptio...
Called to parse the object as described in this parsing plan, using the provided arguments for the parser. * Exceptions are caught and wrapped into ParsingException * If result does not match expected type, an error is thrown :param logger: the logger to use during parsing (optional: None is su...
['Called', 'to', 'parse', 'the', 'object', 'as', 'described', 'in', 'this', 'parsing', 'plan', 'using', 'the', 'provided', 'arguments', 'for', 'the', 'parser', '.', '*', 'Exceptions', 'are', 'caught', 'and', 'wrapped', 'into', 'ParsingException', '*', 'If', 'result', 'does', 'not', 'match', 'expected', 'type', 'an', 'e...
train
https://github.com/smarie/python-parsyfiles/blob/344b37e1151e8d4e7c2ee49ae09d6568715ae64e/parsyfiles/parsing_core_api.py#L394-L417
2,183
scikit-hep/root_pandas
root_pandas/readwrite.py
filter_noexpand_columns
def filter_noexpand_columns(columns): """Return columns not containing and containing the noexpand prefix. Parameters ---------- columns: sequence of str A sequence of strings to be split Returns ------- Two lists, the first containing strings without the noexpand prefix, the ...
python
def filter_noexpand_columns(columns): """Return columns not containing and containing the noexpand prefix. Parameters ---------- columns: sequence of str A sequence of strings to be split Returns ------- Two lists, the first containing strings without the noexpand prefix, the ...
['def', 'filter_noexpand_columns', '(', 'columns', ')', ':', 'prefix_len', '=', 'len', '(', 'NOEXPAND_PREFIX', ')', 'noexpand', '=', '[', 'c', '[', 'prefix_len', ':', ']', 'for', 'c', 'in', 'columns', 'if', 'c', '.', 'startswith', '(', 'NOEXPAND_PREFIX', ')', ']', 'other', '=', '[', 'c', 'for', 'c', 'in', 'columns', 'i...
Return columns not containing and containing the noexpand prefix. Parameters ---------- columns: sequence of str A sequence of strings to be split Returns ------- Two lists, the first containing strings without the noexpand prefix, the second containing those that do with the pre...
['Return', 'columns', 'not', 'containing', 'and', 'containing', 'the', 'noexpand', 'prefix', '.']
train
https://github.com/scikit-hep/root_pandas/blob/57991a4feaeb9213575cfba7a369fc05cc0d846b/root_pandas/readwrite.py#L117-L133
2,184
pywbem/pywbem
pywbem/cim_obj.py
_qualifiers_tomof
def _qualifiers_tomof(qualifiers, indent, maxline=MAX_MOF_LINE): """ Return a MOF string with the qualifier values, including the surrounding square brackets. The qualifiers are ordered by their name. Return empty string if no qualifiers. Normally multiline output and may fold qualifiers into mult...
python
def _qualifiers_tomof(qualifiers, indent, maxline=MAX_MOF_LINE): """ Return a MOF string with the qualifier values, including the surrounding square brackets. The qualifiers are ordered by their name. Return empty string if no qualifiers. Normally multiline output and may fold qualifiers into mult...
['def', '_qualifiers_tomof', '(', 'qualifiers', ',', 'indent', ',', 'maxline', '=', 'MAX_MOF_LINE', ')', ':', 'if', 'not', 'qualifiers', ':', 'return', "u''", 'mof', '=', '[', ']', 'mof', '.', 'append', '(', '_indent_str', '(', 'indent', ')', ')', 'mof', '.', 'append', '(', "u'['", ')', 'line_pos', '=', 'indent', '+', ...
Return a MOF string with the qualifier values, including the surrounding square brackets. The qualifiers are ordered by their name. Return empty string if no qualifiers. Normally multiline output and may fold qualifiers into multiple lines. The order of qualifiers is preserved. Parameters: ...
['Return', 'a', 'MOF', 'string', 'with', 'the', 'qualifier', 'values', 'including', 'the', 'surrounding', 'square', 'brackets', '.', 'The', 'qualifiers', 'are', 'ordered', 'by', 'their', 'name', '.']
train
https://github.com/pywbem/pywbem/blob/e54ecb82c2211e289a268567443d60fdd489f1e4/pywbem/cim_obj.py#L415-L455
2,185
almarklein/pyelastix
pyelastix.py
_write_parameter_file
def _write_parameter_file(params): """ Write the parameter file in the format that elaxtix likes. """ # Get path path = os.path.join(get_tempdir(), 'params.txt') # Define helper function def valToStr(val): if val in [True, False]: return '"%s"' % str(val).lower() ...
python
def _write_parameter_file(params): """ Write the parameter file in the format that elaxtix likes. """ # Get path path = os.path.join(get_tempdir(), 'params.txt') # Define helper function def valToStr(val): if val in [True, False]: return '"%s"' % str(val).lower() ...
['def', '_write_parameter_file', '(', 'params', ')', ':', '# Get path', 'path', '=', 'os', '.', 'path', '.', 'join', '(', 'get_tempdir', '(', ')', ',', "'params.txt'", ')', '# Define helper function', 'def', 'valToStr', '(', 'val', ')', ':', 'if', 'val', 'in', '[', 'True', ',', 'False', ']', ':', 'return', '\'"%s"\'', ...
Write the parameter file in the format that elaxtix likes.
['Write', 'the', 'parameter', 'file', 'in', 'the', 'format', 'that', 'elaxtix', 'likes', '.']
train
https://github.com/almarklein/pyelastix/blob/971a677ce9a3ef8eb0b95ae393db8e2506d2f8a4/pyelastix.py#L970-L1013
2,186
saltstack/salt
salt/states/boto_secgroup.py
_get_rule_changes
def _get_rule_changes(rules, _rules): ''' given a list of desired rules (rules) and existing rules (_rules) return a list of rules to delete (to_delete) and to create (to_create) ''' to_delete = [] to_create = [] # for each rule in state file # 1. validate rule # 2. determine if rule...
python
def _get_rule_changes(rules, _rules): ''' given a list of desired rules (rules) and existing rules (_rules) return a list of rules to delete (to_delete) and to create (to_create) ''' to_delete = [] to_create = [] # for each rule in state file # 1. validate rule # 2. determine if rule...
['def', '_get_rule_changes', '(', 'rules', ',', '_rules', ')', ':', 'to_delete', '=', '[', ']', 'to_create', '=', '[', ']', '# for each rule in state file', '# 1. validate rule', '# 2. determine if rule exists in existing security group rules', 'for', 'rule', 'in', 'rules', ':', 'try', ':', 'ip_protocol', '=', 'six', '...
given a list of desired rules (rules) and existing rules (_rules) return a list of rules to delete (to_delete) and to create (to_create)
['given', 'a', 'list', 'of', 'desired', 'rules', '(', 'rules', ')', 'and', 'existing', 'rules', '(', '_rules', ')', 'return', 'a', 'list', 'of', 'rules', 'to', 'delete', '(', 'to_delete', ')', 'and', 'to', 'create', '(', 'to_create', ')']
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_secgroup.py#L341-L405
2,187
DarkEnergySurvey/ugali
ugali/utils/idl.py
bprecess
def bprecess(ra0, dec0, mu_radec=None, parallax=None, rad_vel=None, epoch=None): """ NAME: BPRECESS PURPOSE: Precess positions from J2000.0 (FK5) to B1950.0 (FK4) EXPLANATION: Calculates the mean place of a star at B1950.0 on the FK4 system from the mean place at J...
python
def bprecess(ra0, dec0, mu_radec=None, parallax=None, rad_vel=None, epoch=None): """ NAME: BPRECESS PURPOSE: Precess positions from J2000.0 (FK5) to B1950.0 (FK4) EXPLANATION: Calculates the mean place of a star at B1950.0 on the FK4 system from the mean place at J...
['def', 'bprecess', '(', 'ra0', ',', 'dec0', ',', 'mu_radec', '=', 'None', ',', 'parallax', '=', 'None', ',', 'rad_vel', '=', 'None', ',', 'epoch', '=', 'None', ')', ':', 'scal', '=', 'True', 'if', 'isinstance', '(', 'ra0', ',', 'ndarray', ')', ':', 'ra', '=', 'ra0', 'dec', '=', 'dec0', 'n', '=', 'ra', '.', 'size', 'sc...
NAME: BPRECESS PURPOSE: Precess positions from J2000.0 (FK5) to B1950.0 (FK4) EXPLANATION: Calculates the mean place of a star at B1950.0 on the FK4 system from the mean place at J2000.0 on the FK5 system. CALLING SEQUENCE: bprecess, ra, dec, ra_1950, de...
['NAME', ':', 'BPRECESS', 'PURPOSE', ':', 'Precess', 'positions', 'from', 'J2000', '.', '0', '(', 'FK5', ')', 'to', 'B1950', '.', '0', '(', 'FK4', ')', 'EXPLANATION', ':', 'Calculates', 'the', 'mean', 'place', 'of', 'a', 'star', 'at', 'B1950', '.', '0', 'on', 'the', 'FK4', 'system', 'from', 'the', 'mean', 'place', 'at'...
train
https://github.com/DarkEnergySurvey/ugali/blob/21e890b4117fc810afb6fb058e8055d564f03382/ugali/utils/idl.py#L214-L418
2,188
hazelcast/hazelcast-python-client
hazelcast/proxy/map.py
Map.remove
def remove(self, key): """ Removes the mapping for a key from this map if it is present. The map will not contain a mapping for the specified key once the call returns. **Warning: This method uses __hash__ and __eq__ methods of binary form of the key, not the actual implementations ...
python
def remove(self, key): """ Removes the mapping for a key from this map if it is present. The map will not contain a mapping for the specified key once the call returns. **Warning: This method uses __hash__ and __eq__ methods of binary form of the key, not the actual implementations ...
['def', 'remove', '(', 'self', ',', 'key', ')', ':', 'check_not_none', '(', 'key', ',', '"key can\'t be None"', ')', 'key_data', '=', 'self', '.', '_to_data', '(', 'key', ')', 'return', 'self', '.', '_remove_internal', '(', 'key_data', ')']
Removes the mapping for a key from this map if it is present. The map will not contain a mapping for the specified key once the call returns. **Warning: This method uses __hash__ and __eq__ methods of binary form of the key, not the actual implementations of __hash__ and __eq__ defined in key's...
['Removes', 'the', 'mapping', 'for', 'a', 'key', 'from', 'this', 'map', 'if', 'it', 'is', 'present', '.', 'The', 'map', 'will', 'not', 'contain', 'a', 'mapping', 'for', 'the', 'specified', 'key', 'once', 'the', 'call', 'returns', '.']
train
https://github.com/hazelcast/hazelcast-python-client/blob/3f6639443c23d6d036aa343f8e094f052250d2c1/hazelcast/proxy/map.py#L595-L608
2,189
JukeboxPipeline/jukebox-core
src/jukeboxcore/addons/guerilla/guerillamgmt.py
DepCreatorDialog.create_dep
def create_dep(self, ): """Create a dep and store it in the self.dep :returns: None :rtype: None :raises: None """ name = self.name_le.text() short = self.short_le.text() assetflag = self.asset_rb.isChecked() ordervalue = self.ordervalue_sb.value(...
python
def create_dep(self, ): """Create a dep and store it in the self.dep :returns: None :rtype: None :raises: None """ name = self.name_le.text() short = self.short_le.text() assetflag = self.asset_rb.isChecked() ordervalue = self.ordervalue_sb.value(...
['def', 'create_dep', '(', 'self', ',', ')', ':', 'name', '=', 'self', '.', 'name_le', '.', 'text', '(', ')', 'short', '=', 'self', '.', 'short_le', '.', 'text', '(', ')', 'assetflag', '=', 'self', '.', 'asset_rb', '.', 'isChecked', '(', ')', 'ordervalue', '=', 'self', '.', 'ordervalue_sb', '.', 'value', '(', ')', 'des...
Create a dep and store it in the self.dep :returns: None :rtype: None :raises: None
['Create', 'a', 'dep', 'and', 'store', 'it', 'in', 'the', 'self', '.', 'dep']
train
https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/addons/guerilla/guerillamgmt.py#L272-L292
2,190
OLC-Bioinformatics/ConFindr
confindr_src/wrappers/bbtools.py
bbduk_trim
def bbduk_trim(forward_in, forward_out, reverse_in='NA', reverse_out='NA', returncmd=False, **kwargs): """ Wrapper for using bbduk to quality trim reads. Contains arguments used in OLC Assembly Pipeline, but these can be overwritten by using keyword parameters. :param forward_in: Forward reads you want ...
python
def bbduk_trim(forward_in, forward_out, reverse_in='NA', reverse_out='NA', returncmd=False, **kwargs): """ Wrapper for using bbduk to quality trim reads. Contains arguments used in OLC Assembly Pipeline, but these can be overwritten by using keyword parameters. :param forward_in: Forward reads you want ...
['def', 'bbduk_trim', '(', 'forward_in', ',', 'forward_out', ',', 'reverse_in', '=', "'NA'", ',', 'reverse_out', '=', "'NA'", ',', 'returncmd', '=', 'False', ',', '*', '*', 'kwargs', ')', ':', 'options', '=', 'kwargs_to_string', '(', 'kwargs', ')', 'cmd', '=', "'which bbduk.sh'", 'try', ':', 'subprocess', '.', 'check_o...
Wrapper for using bbduk to quality trim reads. Contains arguments used in OLC Assembly Pipeline, but these can be overwritten by using keyword parameters. :param forward_in: Forward reads you want to quality trim. :param returncmd: If set to true, function will return the cmd string passed to subprocess as ...
['Wrapper', 'for', 'using', 'bbduk', 'to', 'quality', 'trim', 'reads', '.', 'Contains', 'arguments', 'used', 'in', 'OLC', 'Assembly', 'Pipeline', 'but', 'these', 'can', 'be', 'overwritten', 'by', 'using', 'keyword', 'parameters', '.', ':', 'param', 'forward_in', ':', 'Forward', 'reads', 'you', 'want', 'to', 'quality', ...
train
https://github.com/OLC-Bioinformatics/ConFindr/blob/4c292617c3f270ebd5ff138cbc5a107f6d01200d/confindr_src/wrappers/bbtools.py#L59-L112
2,191
dwavesystems/dwave_networkx
dwave_networkx/drawing/chimera_layout.py
draw_chimera_embedding
def draw_chimera_embedding(G, *args, **kwargs): """Draws an embedding onto the chimera graph G, according to layout. If interaction_edges is not None, then only display the couplers in that list. If embedded_graph is not None, the only display the couplers between chains with intended couplings accord...
python
def draw_chimera_embedding(G, *args, **kwargs): """Draws an embedding onto the chimera graph G, according to layout. If interaction_edges is not None, then only display the couplers in that list. If embedded_graph is not None, the only display the couplers between chains with intended couplings accord...
['def', 'draw_chimera_embedding', '(', 'G', ',', '*', 'args', ',', '*', '*', 'kwargs', ')', ':', 'draw_embedding', '(', 'G', ',', 'chimera_layout', '(', 'G', ')', ',', '*', 'args', ',', '*', '*', 'kwargs', ')']
Draws an embedding onto the chimera graph G, according to layout. If interaction_edges is not None, then only display the couplers in that list. If embedded_graph is not None, the only display the couplers between chains with intended couplings according to embedded_graph. Parameters ---------- ...
['Draws', 'an', 'embedding', 'onto', 'the', 'chimera', 'graph', 'G', 'according', 'to', 'layout', '.']
train
https://github.com/dwavesystems/dwave_networkx/blob/9ea1223ddbc7e86db2f90b8b23e250e6642c3d68/dwave_networkx/drawing/chimera_layout.py#L246-L292
2,192
arne-cl/discoursegraphs
src/discoursegraphs/readwrite/exmaralda.py
ExmaraldaDocumentGraph.__add_token_annotation_tier
def __add_token_annotation_tier(self, tier): """ adds a tier to the document graph, in which each event annotates exactly one token. """ for i, event in enumerate(tier.iter('event')): anno_key = '{0}:{1}'.format(self.ns, tier.attrib['category']) anno_val =...
python
def __add_token_annotation_tier(self, tier): """ adds a tier to the document graph, in which each event annotates exactly one token. """ for i, event in enumerate(tier.iter('event')): anno_key = '{0}:{1}'.format(self.ns, tier.attrib['category']) anno_val =...
['def', '__add_token_annotation_tier', '(', 'self', ',', 'tier', ')', ':', 'for', 'i', ',', 'event', 'in', 'enumerate', '(', 'tier', '.', 'iter', '(', "'event'", ')', ')', ':', 'anno_key', '=', "'{0}:{1}'", '.', 'format', '(', 'self', '.', 'ns', ',', 'tier', '.', 'attrib', '[', "'category'", ']', ')', 'anno_val', '=', ...
adds a tier to the document graph, in which each event annotates exactly one token.
['adds', 'a', 'tier', 'to', 'the', 'document', 'graph', 'in', 'which', 'each', 'event', 'annotates', 'exactly', 'one', 'token', '.']
train
https://github.com/arne-cl/discoursegraphs/blob/842f0068a3190be2c75905754521b176b25a54fb/src/discoursegraphs/readwrite/exmaralda.py#L366-L374
2,193
JukeboxPipeline/jukebox-core
src/jukeboxcore/gui/widgets/browser.py
CBLevel.current_changed
def current_changed(self, i): """Slot for when the current index changes. Emits the :data:`AbstractLevel.new_root` signal. :param index: the new current index :type index: int :returns: None :rtype: None :raises: None """ m = self.model() ...
python
def current_changed(self, i): """Slot for when the current index changes. Emits the :data:`AbstractLevel.new_root` signal. :param index: the new current index :type index: int :returns: None :rtype: None :raises: None """ m = self.model() ...
['def', 'current_changed', '(', 'self', ',', 'i', ')', ':', 'm', '=', 'self', '.', 'model', '(', ')', 'ri', '=', 'self', '.', 'rootModelIndex', '(', ')', 'index', '=', 'm', '.', 'index', '(', 'i', ',', '0', ',', 'ri', ')', 'self', '.', 'new_root', '.', 'emit', '(', 'index', ')']
Slot for when the current index changes. Emits the :data:`AbstractLevel.new_root` signal. :param index: the new current index :type index: int :returns: None :rtype: None :raises: None
['Slot', 'for', 'when', 'the', 'current', 'index', 'changes', '.', 'Emits', 'the', ':', 'data', ':', 'AbstractLevel', '.', 'new_root', 'signal', '.']
train
https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/gui/widgets/browser.py#L345-L358
2,194
apple/turicreate
deps/src/libxml2-2.9.1/python/libxml2.py
namePop
def namePop(ctxt): """Pops the top element name from the name stack """ if ctxt is None: ctxt__o = None else: ctxt__o = ctxt._o ret = libxml2mod.namePop(ctxt__o) return ret
python
def namePop(ctxt): """Pops the top element name from the name stack """ if ctxt is None: ctxt__o = None else: ctxt__o = ctxt._o ret = libxml2mod.namePop(ctxt__o) return ret
['def', 'namePop', '(', 'ctxt', ')', ':', 'if', 'ctxt', 'is', 'None', ':', 'ctxt__o', '=', 'None', 'else', ':', 'ctxt__o', '=', 'ctxt', '.', '_o', 'ret', '=', 'libxml2mod', '.', 'namePop', '(', 'ctxt__o', ')', 'return', 'ret']
Pops the top element name from the name stack
['Pops', 'the', 'top', 'element', 'name', 'from', 'the', 'name', 'stack']
train
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/libxml2-2.9.1/python/libxml2.py#L1517-L1522
2,195
polyaxon/rhea
rhea/manager.py
Rhea.get_string
def get_string(self, key, is_list=False, is_optional=False, is_secret=False, is_local=False, default=None, options=None): """ Get a the value corresponding to the key and ...
python
def get_string(self, key, is_list=False, is_optional=False, is_secret=False, is_local=False, default=None, options=None): """ Get a the value corresponding to the key and ...
['def', 'get_string', '(', 'self', ',', 'key', ',', 'is_list', '=', 'False', ',', 'is_optional', '=', 'False', ',', 'is_secret', '=', 'False', ',', 'is_local', '=', 'False', ',', 'default', '=', 'None', ',', 'options', '=', 'None', ')', ':', 'if', 'is_list', ':', 'return', 'self', '.', '_get_typed_list_value', '(', 'ke...
Get a the value corresponding to the key and converts it to `str`/`list(str)`. Args: key: the dict key. is_list: If this is one element or a list of elements. is_optional: To raise an error if key was not found. is_secret: If the key is a secret. is_l...
['Get', 'a', 'the', 'value', 'corresponding', 'to', 'the', 'key', 'and', 'converts', 'it', 'to', 'str', '/', 'list', '(', 'str', ')', '.']
train
https://github.com/polyaxon/rhea/blob/f47b59777cd996d834a0497a1ab442541aaa8a62/rhea/manager.py#L189-L229
2,196
tanghaibao/jcvi
jcvi/utils/brewer2mpl.py
get_map
def get_map(name, map_type, number, reverse=False): """ Return a `BrewerMap` representation of the specified color map. Parameters ---------- name : str Name of color map. Use `print_maps` to see available color maps. map_type : {'Sequential', 'Diverging', 'Qualitative'} Select ...
python
def get_map(name, map_type, number, reverse=False): """ Return a `BrewerMap` representation of the specified color map. Parameters ---------- name : str Name of color map. Use `print_maps` to see available color maps. map_type : {'Sequential', 'Diverging', 'Qualitative'} Select ...
['def', 'get_map', '(', 'name', ',', 'map_type', ',', 'number', ',', 'reverse', '=', 'False', ')', ':', 'number', '=', 'str', '(', 'number', ')', 'map_type', '=', 'map_type', '.', 'lower', '(', ')', '.', 'capitalize', '(', ')', '# check for valid type', 'if', 'map_type', 'not', 'in', 'MAP_TYPES', ':', 's', '=', "'Inval...
Return a `BrewerMap` representation of the specified color map. Parameters ---------- name : str Name of color map. Use `print_maps` to see available color maps. map_type : {'Sequential', 'Diverging', 'Qualitative'} Select color map type. number : int Number of defined color...
['Return', 'a', 'BrewerMap', 'representation', 'of', 'the', 'specified', 'color', 'map', '.']
train
https://github.com/tanghaibao/jcvi/blob/d2e31a77b6ade7f41f3b321febc2b4744d1cdeca/jcvi/utils/brewer2mpl.py#L240-L297
2,197
spotify/ulogger
ulogger/stackdriver.py
CloudLoggingHandlerBuilder.get_handler
def get_handler(self): """Create a fully configured CloudLoggingHandler. Returns: (obj): Instance of `google.cloud.logging.handlers. CloudLoggingHandler` """ gcl_client = gcl_logging.Client( project=self.project_id, credentials=se...
python
def get_handler(self): """Create a fully configured CloudLoggingHandler. Returns: (obj): Instance of `google.cloud.logging.handlers. CloudLoggingHandler` """ gcl_client = gcl_logging.Client( project=self.project_id, credentials=se...
['def', 'get_handler', '(', 'self', ')', ':', 'gcl_client', '=', 'gcl_logging', '.', 'Client', '(', 'project', '=', 'self', '.', 'project_id', ',', 'credentials', '=', 'self', '.', 'credentials', ')', 'handler', '=', 'gcl_handlers', '.', 'CloudLoggingHandler', '(', 'gcl_client', ',', 'resource', '=', 'self', '.', 'reso...
Create a fully configured CloudLoggingHandler. Returns: (obj): Instance of `google.cloud.logging.handlers. CloudLoggingHandler`
['Create', 'a', 'fully', 'configured', 'CloudLoggingHandler', '.']
train
https://github.com/spotify/ulogger/blob/c59ced69e55b400e9c7a3688145fe3e8cb89db13/ulogger/stackdriver.py#L173-L194
2,198
ralphhaygood/sklearn-gbmi
sklearn_gbmi/sklearn_gbmi.py
h_all_pairs
def h_all_pairs(gbm, array_or_frame, indices_or_columns = 'all'): """ PURPOSE Compute Friedman and Popescu's two-variable H statistic, in order to look for an interaction in the passed gradient- boosting model between each pair of variables represented by the elements of the passed array or frame and s...
python
def h_all_pairs(gbm, array_or_frame, indices_or_columns = 'all'): """ PURPOSE Compute Friedman and Popescu's two-variable H statistic, in order to look for an interaction in the passed gradient- boosting model between each pair of variables represented by the elements of the passed array or frame and s...
['def', 'h_all_pairs', '(', 'gbm', ',', 'array_or_frame', ',', 'indices_or_columns', '=', "'all'", ')', ':', 'if', 'gbm', '.', 'max_depth', '<', '2', ':', 'raise', 'Exception', '(', '"gbm.max_depth must be at least 2."', ')', 'check_args_contd', '(', 'array_or_frame', ',', 'indices_or_columns', ')', 'arr', ',', 'model_...
PURPOSE Compute Friedman and Popescu's two-variable H statistic, in order to look for an interaction in the passed gradient- boosting model between each pair of variables represented by the elements of the passed array or frame and specified by the passed indices or columns. See Jerome H. Friedman and...
['PURPOSE']
train
https://github.com/ralphhaygood/sklearn-gbmi/blob/23a1e7fd50e53d6261379f22a337d8fa4ee6aabe/sklearn_gbmi/sklearn_gbmi.py#L98-L169
2,199
jamieleshaw/lurklib
lurklib/optional.py
_Optional.away
def away(self, msg=''): """ Sets/unsets your away status. Optional arguments: * msg='' - Away reason. """ with self.lock: self.send('AWAY :%s' % msg) if self.readable(): msg = self._recv(expected_replies=('306', '305')) ...
python
def away(self, msg=''): """ Sets/unsets your away status. Optional arguments: * msg='' - Away reason. """ with self.lock: self.send('AWAY :%s' % msg) if self.readable(): msg = self._recv(expected_replies=('306', '305')) ...
['def', 'away', '(', 'self', ',', 'msg', '=', "''", ')', ':', 'with', 'self', '.', 'lock', ':', 'self', '.', 'send', '(', "'AWAY :%s'", '%', 'msg', ')', 'if', 'self', '.', 'readable', '(', ')', ':', 'msg', '=', 'self', '.', '_recv', '(', 'expected_replies', '=', '(', "'306'", ',', "'305'", ')', ')', 'if', 'msg', '[', '...
Sets/unsets your away status. Optional arguments: * msg='' - Away reason.
['Sets', '/', 'unsets', 'your', 'away', 'status', '.', 'Optional', 'arguments', ':', '*', 'msg', '=', '-', 'Away', 'reason', '.']
train
https://github.com/jamieleshaw/lurklib/blob/a861f35d880140422103dd78ec3239814e85fd7e/lurklib/optional.py#L24-L37