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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
6,100 | toomore/goristock | grs/all_portf.py | all_portf.ck_portf_004 | def ck_portf_004(self):
''' 價走平一個半月。(箱型整理、盤整) '''
return self.a.SD < 0.25 and self.a.stock_vol[-1] > 1000*1000 and self.a.raw_data[-1] > 10 | python | def ck_portf_004(self):
''' 價走平一個半月。(箱型整理、盤整) '''
return self.a.SD < 0.25 and self.a.stock_vol[-1] > 1000*1000 and self.a.raw_data[-1] > 10 | ['def', 'ck_portf_004', '(', 'self', ')', ':', 'return', 'self', '.', 'a', '.', 'SD', '<', '0.25', 'and', 'self', '.', 'a', '.', 'stock_vol', '[', '-', '1', ']', '>', '1000', '*', '1000', 'and', 'self', '.', 'a', '.', 'raw_data', '[', '-', '1', ']', '>', '10'] | 價走平一個半月。(箱型整理、盤整) | ['價走平一個半月。(箱型整理、盤整)'] | train | https://github.com/toomore/goristock/blob/e61f57f11a626cfbc4afbf66337fd9d1c51e3e71/grs/all_portf.py#L40-L42 |
6,101 | lehins/python-wepay | wepay/calls/subscription.py | Subscription.__modify | def __modify(self, subscription_id, **kwargs):
"""Call documentation: `/subscription/modify
<https://www.wepay.com/developer/reference/subscription#modify>`_, plus
extra keyword parameters:
:keyword str access_token: will be used instead of instance's
``access_token``... | python | def __modify(self, subscription_id, **kwargs):
"""Call documentation: `/subscription/modify
<https://www.wepay.com/developer/reference/subscription#modify>`_, plus
extra keyword parameters:
:keyword str access_token: will be used instead of instance's
``access_token``... | ['def', '__modify', '(', 'self', ',', 'subscription_id', ',', '*', '*', 'kwargs', ')', ':', 'params', '=', '{', "'subscription_id'", ':', 'subscription_id', '}', 'return', 'self', '.', 'make_call', '(', 'self', '.', '__modify', ',', 'params', ',', 'kwargs', ')'] | Call documentation: `/subscription/modify
<https://www.wepay.com/developer/reference/subscription#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', ':', '/', 'subscription', '/', 'modify', '<https', ':', '//', 'www', '.', 'wepay', '.', 'com', '/', 'developer', '/', 'reference', '/', 'subscription#modify', '>', '_', 'plus', 'extra', 'keyword', 'parameters', ':', ':', 'keyword', 'str', 'access_token', ':', 'will', 'be', 'used', 'instead', '... | train | https://github.com/lehins/python-wepay/blob/414d25a1a8d0ecb22a3ddd1f16c60b805bb52a1f/wepay/calls/subscription.py#L118-L140 |
6,102 | wrobstory/vincent | vincent/data.py | Data.from_mult_iters | def from_mult_iters(cls, name=None, idx=None, **kwargs):
"""Load values from multiple iters
Parameters
----------
name : string, default None
Name of the data set. If None (default), the name will be set to
``'table'``.
idx: string, default None
... | python | def from_mult_iters(cls, name=None, idx=None, **kwargs):
"""Load values from multiple iters
Parameters
----------
name : string, default None
Name of the data set. If None (default), the name will be set to
``'table'``.
idx: string, default None
... | ['def', 'from_mult_iters', '(', 'cls', ',', 'name', '=', 'None', ',', 'idx', '=', 'None', ',', '*', '*', 'kwargs', ')', ':', 'if', 'not', 'name', ':', 'name', '=', "'table'", 'lengths', '=', '[', 'len', '(', 'v', ')', 'for', 'v', 'in', 'kwargs', '.', 'values', '(', ')', ']', 'if', 'len', '(', 'set', '(', 'lengths', ')'... | Load values from multiple iters
Parameters
----------
name : string, default None
Name of the data set. If None (default), the name will be set to
``'table'``.
idx: string, default None
Iterable to use for the data index
**kwargs : dict of ite... | ['Load', 'values', 'from', 'multiple', 'iters'] | train | https://github.com/wrobstory/vincent/blob/c5a06e50179015fbb788a7a42e4570ff4467a9e9/vincent/data.py#L294-L339 |
6,103 | mrstephenneal/dirutility | dirutility/gui.py | BackupZipGUI.source | def source(self):
"""Parameters for saving zip backups"""
with gui.FlexForm(self.title, auto_size_text=True, default_element_size=(40, 1)) as form:
layout = [
[gui.Text('Zip Backup utility', size=(30, 1), font=("Helvetica", 30), text_color='blue')],
[gui.Text(... | python | def source(self):
"""Parameters for saving zip backups"""
with gui.FlexForm(self.title, auto_size_text=True, default_element_size=(40, 1)) as form:
layout = [
[gui.Text('Zip Backup utility', size=(30, 1), font=("Helvetica", 30), text_color='blue')],
[gui.Text(... | ['def', 'source', '(', 'self', ')', ':', 'with', 'gui', '.', 'FlexForm', '(', 'self', '.', 'title', ',', 'auto_size_text', '=', 'True', ',', 'default_element_size', '=', '(', '40', ',', '1', ')', ')', 'as', 'form', ':', 'layout', '=', '[', '[', 'gui', '.', 'Text', '(', "'Zip Backup utility'", ',', 'size', '=', '(', '30... | Parameters for saving zip backups | ['Parameters', 'for', 'saving', 'zip', 'backups'] | train | https://github.com/mrstephenneal/dirutility/blob/339378659e2d7e09c53acfc51c5df745bb0cd517/dirutility/gui.py#L123-L143 |
6,104 | bionikspoon/pureyaml | pureyaml/__init__.py | dumps | def dumps(obj, indent=None, default=None, sort_keys=False, **kw):
"""Dump string."""
return YAMLEncoder(indent=indent, default=default, sort_keys=sort_keys, **kw).encode(obj) | python | def dumps(obj, indent=None, default=None, sort_keys=False, **kw):
"""Dump string."""
return YAMLEncoder(indent=indent, default=default, sort_keys=sort_keys, **kw).encode(obj) | ['def', 'dumps', '(', 'obj', ',', 'indent', '=', 'None', ',', 'default', '=', 'None', ',', 'sort_keys', '=', 'False', ',', '*', '*', 'kw', ')', ':', 'return', 'YAMLEncoder', '(', 'indent', '=', 'indent', ',', 'default', '=', 'default', ',', 'sort_keys', '=', 'sort_keys', ',', '*', '*', 'kw', ')', '.', 'encode', '(', 'o... | Dump string. | ['Dump', 'string', '.'] | train | https://github.com/bionikspoon/pureyaml/blob/784830b907ca14525c4cecdb6ae35306f6f8a877/pureyaml/__init__.py#L47-L49 |
6,105 | Unidata/siphon | siphon/cdmr/ncstream.py | process_vlen | def process_vlen(data_header, array):
"""Process vlen coming back from NCStream v2.
This takes the array of values and slices into an object array, with entries containing
the appropriate pieces of the original array. Sizes are controlled by the passed in
`data_header`.
Parameters
----------
... | python | def process_vlen(data_header, array):
"""Process vlen coming back from NCStream v2.
This takes the array of values and slices into an object array, with entries containing
the appropriate pieces of the original array. Sizes are controlled by the passed in
`data_header`.
Parameters
----------
... | ['def', 'process_vlen', '(', 'data_header', ',', 'array', ')', ':', 'source', '=', 'iter', '(', 'array', ')', 'return', 'np', '.', 'array', '(', '[', 'np', '.', 'fromiter', '(', 'itertools', '.', 'islice', '(', 'source', ',', 'size', ')', ',', 'dtype', '=', 'array', '.', 'dtype', ')', 'for', 'size', 'in', 'data_header'... | Process vlen coming back from NCStream v2.
This takes the array of values and slices into an object array, with entries containing
the appropriate pieces of the original array. Sizes are controlled by the passed in
`data_header`.
Parameters
----------
data_header : Header
array : :class:`n... | ['Process', 'vlen', 'coming', 'back', 'from', 'NCStream', 'v2', '.'] | train | https://github.com/Unidata/siphon/blob/53fb0d84fbce1c18c8e81c9e68bc81620ee0a6ac/siphon/cdmr/ncstream.py#L201-L221 |
6,106 | Microsoft/azure-devops-python-api | azure-devops/azure/devops/v5_0/build/build_client.py | BuildClient.add_build_tags | def add_build_tags(self, tags, project, build_id):
"""AddBuildTags.
Adds tags to a build.
:param [str] tags: The tags to add.
:param str project: Project ID or project name
:param int build_id: The ID of the build.
:rtype: [str]
"""
route_values = {}
... | python | def add_build_tags(self, tags, project, build_id):
"""AddBuildTags.
Adds tags to a build.
:param [str] tags: The tags to add.
:param str project: Project ID or project name
:param int build_id: The ID of the build.
:rtype: [str]
"""
route_values = {}
... | ['def', 'add_build_tags', '(', 'self', ',', 'tags', ',', 'project', ',', 'build_id', ')', ':', 'route_values', '=', '{', '}', 'if', 'project', 'is', 'not', 'None', ':', 'route_values', '[', "'project'", ']', '=', 'self', '.', '_serialize', '.', 'url', '(', "'project'", ',', 'project', ',', "'str'", ')', 'if', 'build_id... | AddBuildTags.
Adds tags to a build.
:param [str] tags: The tags to add.
:param str project: Project ID or project name
:param int build_id: The ID of the build.
:rtype: [str] | ['AddBuildTags', '.', 'Adds', 'tags', 'to', 'a', 'build', '.', ':', 'param', '[', 'str', ']', 'tags', ':', 'The', 'tags', 'to', 'add', '.', ':', 'param', 'str', 'project', ':', 'Project', 'ID', 'or', 'project', 'name', ':', 'param', 'int', 'build_id', ':', 'The', 'ID', 'of', 'the', 'build', '.', ':', 'rtype', ':', '[',... | train | https://github.com/Microsoft/azure-devops-python-api/blob/4777ffda2f5052fabbaddb2abe9cb434e0cf1aa8/azure-devops/azure/devops/v5_0/build/build_client.py#L1549-L1568 |
6,107 | DataDog/integrations-core | datadog_checks_base/datadog_checks/base/checks/prometheus/mixins.py | PrometheusScraperMixin.process | def process(self, endpoint, **kwargs):
"""
Polls the data from prometheus and pushes them as gauges
`endpoint` is the metrics endpoint to use to poll metrics from Prometheus
Note that if the instance has a 'tags' attribute, it will be pushed
automatically as additional custom ta... | python | def process(self, endpoint, **kwargs):
"""
Polls the data from prometheus and pushes them as gauges
`endpoint` is the metrics endpoint to use to poll metrics from Prometheus
Note that if the instance has a 'tags' attribute, it will be pushed
automatically as additional custom ta... | ['def', 'process', '(', 'self', ',', 'endpoint', ',', '*', '*', 'kwargs', ')', ':', 'instance', '=', 'kwargs', '.', 'get', '(', "'instance'", ')', 'if', 'instance', ':', 'kwargs', '[', "'custom_tags'", ']', '=', 'instance', '.', 'get', '(', "'tags'", ',', '[', ']', ')', 'for', 'metric', 'in', 'self', '.', 'scrape_metri... | Polls the data from prometheus and pushes them as gauges
`endpoint` is the metrics endpoint to use to poll metrics from Prometheus
Note that if the instance has a 'tags' attribute, it will be pushed
automatically as additional custom tags and added to the metrics | ['Polls', 'the', 'data', 'from', 'prometheus', 'and', 'pushes', 'them', 'as', 'gauges', 'endpoint', 'is', 'the', 'metrics', 'endpoint', 'to', 'use', 'to', 'poll', 'metrics', 'from', 'Prometheus'] | train | https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/datadog_checks_base/datadog_checks/base/checks/prometheus/mixins.py#L386-L399 |
6,108 | horazont/aioxmpp | aioxmpp/bookmarks/service.py | BookmarkClient.get_bookmarks | def get_bookmarks(self):
"""
Get the stored bookmarks from the server. Causes signals to be
fired to reflect the changes.
:returns: a list of bookmarks
"""
with (yield from self._lock):
bookmarks = yield from self._get_bookmarks()
self._diff_emit_... | python | def get_bookmarks(self):
"""
Get the stored bookmarks from the server. Causes signals to be
fired to reflect the changes.
:returns: a list of bookmarks
"""
with (yield from self._lock):
bookmarks = yield from self._get_bookmarks()
self._diff_emit_... | ['def', 'get_bookmarks', '(', 'self', ')', ':', 'with', '(', 'yield', 'from', 'self', '.', '_lock', ')', ':', 'bookmarks', '=', 'yield', 'from', 'self', '.', '_get_bookmarks', '(', ')', 'self', '.', '_diff_emit_update', '(', 'bookmarks', ')', 'return', 'bookmarks'] | Get the stored bookmarks from the server. Causes signals to be
fired to reflect the changes.
:returns: a list of bookmarks | ['Get', 'the', 'stored', 'bookmarks', 'from', 'the', 'server', '.', 'Causes', 'signals', 'to', 'be', 'fired', 'to', 'reflect', 'the', 'changes', '.'] | train | https://github.com/horazont/aioxmpp/blob/22a68e5e1d23f2a4dee470092adbd4672f9ef061/aioxmpp/bookmarks/service.py#L268-L278 |
6,109 | influxdata/influxdb-python | influxdb/influxdb08/client.py | InfluxDBClient.alter_database_admin | def alter_database_admin(self, username, is_admin):
"""Alter the database admin."""
url = "db/{0}/users/{1}".format(self._database, username)
data = {'admin': is_admin}
self.request(
url=url,
method='POST',
data=data,
expected_response_co... | python | def alter_database_admin(self, username, is_admin):
"""Alter the database admin."""
url = "db/{0}/users/{1}".format(self._database, username)
data = {'admin': is_admin}
self.request(
url=url,
method='POST',
data=data,
expected_response_co... | ['def', 'alter_database_admin', '(', 'self', ',', 'username', ',', 'is_admin', ')', ':', 'url', '=', '"db/{0}/users/{1}"', '.', 'format', '(', 'self', '.', '_database', ',', 'username', ')', 'data', '=', '{', "'admin'", ':', 'is_admin', '}', 'self', '.', 'request', '(', 'url', '=', 'url', ',', 'method', '=', "'POST'", ... | Alter the database admin. | ['Alter', 'the', 'database', 'admin', '.'] | train | https://github.com/influxdata/influxdb-python/blob/d5d12499f3755199d5eedd8b363450f1cf4073bd/influxdb/influxdb08/client.py#L660-L673 |
6,110 | hotdoc/hotdoc | hotdoc/core/database.py | Database.add_comment | def add_comment(self, comment):
"""
Add a comment to the database.
Args:
comment (hotdoc.core.Comment): comment to add
"""
if not comment:
return
self.__comments[comment.name] = comment
self.comment_added_signal(self, comment) | python | def add_comment(self, comment):
"""
Add a comment to the database.
Args:
comment (hotdoc.core.Comment): comment to add
"""
if not comment:
return
self.__comments[comment.name] = comment
self.comment_added_signal(self, comment) | ['def', 'add_comment', '(', 'self', ',', 'comment', ')', ':', 'if', 'not', 'comment', ':', 'return', 'self', '.', '__comments', '[', 'comment', '.', 'name', ']', '=', 'comment', 'self', '.', 'comment_added_signal', '(', 'self', ',', 'comment', ')'] | Add a comment to the database.
Args:
comment (hotdoc.core.Comment): comment to add | ['Add', 'a', 'comment', 'to', 'the', 'database', '.'] | train | https://github.com/hotdoc/hotdoc/blob/1067cdc8482b585b364a38fb52ca5d904e486280/hotdoc/core/database.py#L77-L88 |
6,111 | zhexiao/ezhost | ezhost/ServerBase.py | ServerBase.init_host | def init_host(self):
"""
Initial host
"""
env.host_string = self.host_string
env.user = self.host_user
env.password = self.host_passwd
env.key_filename = self.host_keyfile | python | def init_host(self):
"""
Initial host
"""
env.host_string = self.host_string
env.user = self.host_user
env.password = self.host_passwd
env.key_filename = self.host_keyfile | ['def', 'init_host', '(', 'self', ')', ':', 'env', '.', 'host_string', '=', 'self', '.', 'host_string', 'env', '.', 'user', '=', 'self', '.', 'host_user', 'env', '.', 'password', '=', 'self', '.', 'host_passwd', 'env', '.', 'key_filename', '=', 'self', '.', 'host_keyfile'] | Initial host | ['Initial', 'host'] | train | https://github.com/zhexiao/ezhost/blob/4146bc0be14bb1bfe98ec19283d19fab420871b3/ezhost/ServerBase.py#L75-L82 |
6,112 | avinassh/haxor | hackernews/__init__.py | HackerNews.get_items_by_ids | def get_items_by_ids(self, item_ids, item_type=None):
"""Given a list of item ids, return all the Item objects
Args:
item_ids (obj): List of item IDs to query
item_type (str): (optional) Item type to filter results with
Returns:
List of `Item` objects for gi... | python | def get_items_by_ids(self, item_ids, item_type=None):
"""Given a list of item ids, return all the Item objects
Args:
item_ids (obj): List of item IDs to query
item_type (str): (optional) Item type to filter results with
Returns:
List of `Item` objects for gi... | ['def', 'get_items_by_ids', '(', 'self', ',', 'item_ids', ',', 'item_type', '=', 'None', ')', ':', 'urls', '=', '[', 'urljoin', '(', 'self', '.', 'item_url', ',', 'F"{i}.json"', ')', 'for', 'i', 'in', 'item_ids', ']', 'result', '=', 'self', '.', '_run_async', '(', 'urls', '=', 'urls', ')', 'items', '=', '[', 'Item', '(... | Given a list of item ids, return all the Item objects
Args:
item_ids (obj): List of item IDs to query
item_type (str): (optional) Item type to filter results with
Returns:
List of `Item` objects for given item IDs and given item type | ['Given', 'a', 'list', 'of', 'item', 'ids', 'return', 'all', 'the', 'Item', 'objects'] | train | https://github.com/avinassh/haxor/blob/71dbecf87531f7a24bb39c736d53127427aaca84/hackernews/__init__.py#L204-L221 |
6,113 | ContextLab/quail | quail/helpers.py | list2pd | def list2pd(all_data, subjindex=None, listindex=None):
"""
Makes multi-indexed dataframe of subject data
Parameters
----------
all_data : list of lists of strings
strings are either all presented or all recalled items, in the order of presentation or recall
*should also work for pre... | python | def list2pd(all_data, subjindex=None, listindex=None):
"""
Makes multi-indexed dataframe of subject data
Parameters
----------
all_data : list of lists of strings
strings are either all presented or all recalled items, in the order of presentation or recall
*should also work for pre... | ['def', 'list2pd', '(', 'all_data', ',', 'subjindex', '=', 'None', ',', 'listindex', '=', 'None', ')', ':', '# set default index if it is not defined', '# max_nlists = max(map(lambda x: len(x), all_data))', 'listindex', '=', '[', '[', 'idx', 'for', 'idx', 'in', 'range', '(', 'len', '(', 'sub', ')', ')', ']', 'for', 'su... | Makes multi-indexed dataframe of subject data
Parameters
----------
all_data : list of lists of strings
strings are either all presented or all recalled items, in the order of presentation or recall
*should also work for presented / recalled ints and floats, if desired
Returns
---... | ['Makes', 'multi', '-', 'indexed', 'dataframe', 'of', 'subject', 'data'] | train | https://github.com/ContextLab/quail/blob/71dd53c792dd915dc84879d8237e3582dd68b7a4/quail/helpers.py#L11-L43 |
6,114 | memphis-iis/GLUDB | gludb/backends/dynamodb.py | Backend.find_all | def find_all(self, cls):
"""Required functionality."""
final_results = []
table = self.get_class_table(cls)
for db_result in table.scan():
obj = cls.from_data(db_result['value'])
final_results.append(obj)
return final_results | python | def find_all(self, cls):
"""Required functionality."""
final_results = []
table = self.get_class_table(cls)
for db_result in table.scan():
obj = cls.from_data(db_result['value'])
final_results.append(obj)
return final_results | ['def', 'find_all', '(', 'self', ',', 'cls', ')', ':', 'final_results', '=', '[', ']', 'table', '=', 'self', '.', 'get_class_table', '(', 'cls', ')', 'for', 'db_result', 'in', 'table', '.', 'scan', '(', ')', ':', 'obj', '=', 'cls', '.', 'from_data', '(', 'db_result', '[', "'value'", ']', ')', 'final_results', '.', 'app... | Required functionality. | ['Required', 'functionality', '.'] | train | https://github.com/memphis-iis/GLUDB/blob/25692528ff6fe8184a3570f61f31f1a90088a388/gludb/backends/dynamodb.py#L153-L161 |
6,115 | signaturit/python-sdk | signaturit_sdk/signaturit_client.py | SignaturitClient.count_SMS | def count_SMS(self, conditions={}):
"""
Count all certified sms
"""
url = self.SMS_COUNT_URL + "?"
for key, value in conditions.items():
if key is 'ids':
value = ",".join(value)
url += '&%s=%s' % (key, value)
connection = Connect... | python | def count_SMS(self, conditions={}):
"""
Count all certified sms
"""
url = self.SMS_COUNT_URL + "?"
for key, value in conditions.items():
if key is 'ids':
value = ",".join(value)
url += '&%s=%s' % (key, value)
connection = Connect... | ['def', 'count_SMS', '(', 'self', ',', 'conditions', '=', '{', '}', ')', ':', 'url', '=', 'self', '.', 'SMS_COUNT_URL', '+', '"?"', 'for', 'key', ',', 'value', 'in', 'conditions', '.', 'items', '(', ')', ':', 'if', 'key', 'is', "'ids'", ':', 'value', '=', '","', '.', 'join', '(', 'value', ')', 'url', '+=', "'&%s=%s'", ... | Count all certified sms | ['Count', 'all', 'certified', 'sms'] | train | https://github.com/signaturit/python-sdk/blob/2419c6d9675d901244f807ae360dc58aa46109a9/signaturit_sdk/signaturit_client.py#L377-L393 |
6,116 | estnltk/estnltk | estnltk/syntax/syntax_preprocessing.py | tag_subcat_info | def tag_subcat_info( mrf_lines, subcat_rules ):
''' Adds subcategorization information (hashtags) to verbs and adpositions;
Argument subcat_rules must be a dict containing subcategorization information,
loaded via method load_subcat_info();
Performs word lemma lookups in subcat_rul... | python | def tag_subcat_info( mrf_lines, subcat_rules ):
''' Adds subcategorization information (hashtags) to verbs and adpositions;
Argument subcat_rules must be a dict containing subcategorization information,
loaded via method load_subcat_info();
Performs word lemma lookups in subcat_rul... | ['def', 'tag_subcat_info', '(', 'mrf_lines', ',', 'subcat_rules', ')', ':', 'i', '=', '0', 'while', '(', 'i', '<', 'len', '(', 'mrf_lines', ')', ')', ':', 'line', '=', 'mrf_lines', '[', 'i', ']', 'if', 'line', '.', 'startswith', '(', "' '", ')', ':', 'lemma_match', '=', 'analysisLemmaPat', '.', 'match', '(', 'line', '... | Adds subcategorization information (hashtags) to verbs and adpositions;
Argument subcat_rules must be a dict containing subcategorization information,
loaded via method load_subcat_info();
Performs word lemma lookups in subcat_rules, and in case of a match, checks
word part-of... | ['Adds', 'subcategorization', 'information', '(', 'hashtags', ')', 'to', 'verbs', 'and', 'adpositions', ';', 'Argument', 'subcat_rules', 'must', 'be', 'a', 'dict', 'containing', 'subcategorization', 'information', 'loaded', 'via', 'method', 'load_subcat_info', '()', ';'] | train | https://github.com/estnltk/estnltk/blob/28ae334a68a0673072febc318635f04da0dcc54a/estnltk/syntax/syntax_preprocessing.py#L721-L784 |
6,117 | DataBiosphere/toil | src/toil/wdl/wdl_analysis.py | AnalyzeWDL.parse_declaration_expressn_memberaccess | def parse_declaration_expressn_memberaccess(self, lhsAST, rhsAST, es):
"""
Instead of "Class.variablename", use "Class.rv('variablename')".
:param lhsAST:
:param rhsAST:
:param es:
:return:
"""
if isinstance(lhsAST, wdl_parser.Terminal):
es = ... | python | def parse_declaration_expressn_memberaccess(self, lhsAST, rhsAST, es):
"""
Instead of "Class.variablename", use "Class.rv('variablename')".
:param lhsAST:
:param rhsAST:
:param es:
:return:
"""
if isinstance(lhsAST, wdl_parser.Terminal):
es = ... | ['def', 'parse_declaration_expressn_memberaccess', '(', 'self', ',', 'lhsAST', ',', 'rhsAST', ',', 'es', ')', ':', 'if', 'isinstance', '(', 'lhsAST', ',', 'wdl_parser', '.', 'Terminal', ')', ':', 'es', '=', 'es', '+', 'lhsAST', '.', 'source_string', 'elif', 'isinstance', '(', 'lhsAST', ',', 'wdl_parser', '.', 'Ast', ')... | Instead of "Class.variablename", use "Class.rv('variablename')".
:param lhsAST:
:param rhsAST:
:param es:
:return: | ['Instead', 'of', 'Class', '.', 'variablename', 'use', 'Class', '.', 'rv', '(', 'variablename', ')', '.'] | train | https://github.com/DataBiosphere/toil/blob/a8252277ff814e7bee0971139c2344f88e44b644/src/toil/wdl/wdl_analysis.py#L772-L797 |
6,118 | daviddrysdale/python-phonenumbers | python/phonenumbers/phonenumberutil.py | supported_types_for_non_geo_entity | def supported_types_for_non_geo_entity(country_code):
"""Returns the types for a country-code belonging to a non-geographical entity
which the library has metadata for. Will not include FIXED_LINE_OR_MOBILE
(if numbers for this non-geographical entity could be classified as
FIXED_LINE_OR_MOBILE, both FI... | python | def supported_types_for_non_geo_entity(country_code):
"""Returns the types for a country-code belonging to a non-geographical entity
which the library has metadata for. Will not include FIXED_LINE_OR_MOBILE
(if numbers for this non-geographical entity could be classified as
FIXED_LINE_OR_MOBILE, both FI... | ['def', 'supported_types_for_non_geo_entity', '(', 'country_code', ')', ':', 'metadata', '=', 'PhoneMetadata', '.', 'metadata_for_nongeo_region', '(', 'country_code', ',', 'None', ')', 'if', 'metadata', 'is', 'None', ':', 'return', 'set', '(', ')', 'return', '_supported_types_for_metadata', '(', 'metadata', ')'] | Returns the types for a country-code belonging to a non-geographical entity
which the library has metadata for. Will not include FIXED_LINE_OR_MOBILE
(if numbers for this non-geographical entity could be classified as
FIXED_LINE_OR_MOBILE, both FIXED_LINE and MOBILE would be present) and
UNKNOWN.
N... | ['Returns', 'the', 'types', 'for', 'a', 'country', '-', 'code', 'belonging', 'to', 'a', 'non', '-', 'geographical', 'entity', 'which', 'the', 'library', 'has', 'metadata', 'for', '.', 'Will', 'not', 'include', 'FIXED_LINE_OR_MOBILE', '(', 'if', 'numbers', 'for', 'this', 'non', '-', 'geographical', 'entity', 'could', 'b... | train | https://github.com/daviddrysdale/python-phonenumbers/blob/9cc5bb4ab5e661e70789b4c64bf7a9383c7bdc20/python/phonenumbers/phonenumberutil.py#L877-L890 |
6,119 | christian-oudard/htmltreediff | htmltreediff/changes.py | merge_adjacent | def merge_adjacent(dom, tag_name):
"""
Merge all adjacent tags with the specified tag name.
Return the number of merges performed.
"""
for node in dom.getElementsByTagName(tag_name):
prev_sib = node.previousSibling
if prev_sib and prev_sib.nodeName == node.tagName:
for ch... | python | def merge_adjacent(dom, tag_name):
"""
Merge all adjacent tags with the specified tag name.
Return the number of merges performed.
"""
for node in dom.getElementsByTagName(tag_name):
prev_sib = node.previousSibling
if prev_sib and prev_sib.nodeName == node.tagName:
for ch... | ['def', 'merge_adjacent', '(', 'dom', ',', 'tag_name', ')', ':', 'for', 'node', 'in', 'dom', '.', 'getElementsByTagName', '(', 'tag_name', ')', ':', 'prev_sib', '=', 'node', '.', 'previousSibling', 'if', 'prev_sib', 'and', 'prev_sib', '.', 'nodeName', '==', 'node', '.', 'tagName', ':', 'for', 'child', 'in', 'list', '('... | Merge all adjacent tags with the specified tag name.
Return the number of merges performed. | ['Merge', 'all', 'adjacent', 'tags', 'with', 'the', 'specified', 'tag', 'name', '.', 'Return', 'the', 'number', 'of', 'merges', 'performed', '.'] | train | https://github.com/christian-oudard/htmltreediff/blob/0e28f56492ae7e69bb0f74f9a79a8909a5ad588d/htmltreediff/changes.py#L104-L114 |
6,120 | codelv/enaml-native | src/enamlnative/core/dev.py | DevServer.render_files | def render_files(self, root=None):
""" Render the file path as accordions
"""
if root is None:
tmp = os.environ.get('TMP')
root = sys.path[1 if tmp and tmp in sys.path else 0]
items = []
for filename in os.listdir(root):
# for subdirname in di... | python | def render_files(self, root=None):
""" Render the file path as accordions
"""
if root is None:
tmp = os.environ.get('TMP')
root = sys.path[1 if tmp and tmp in sys.path else 0]
items = []
for filename in os.listdir(root):
# for subdirname in di... | ['def', 'render_files', '(', 'self', ',', 'root', '=', 'None', ')', ':', 'if', 'root', 'is', 'None', ':', 'tmp', '=', 'os', '.', 'environ', '.', 'get', '(', "'TMP'", ')', 'root', '=', 'sys', '.', 'path', '[', '1', 'if', 'tmp', 'and', 'tmp', 'in', 'sys', '.', 'path', 'else', '0', ']', 'items', '=', '[', ']', 'for', 'fil... | Render the file path as accordions | ['Render', 'the', 'file', 'path', 'as', 'accordions'] | train | https://github.com/codelv/enaml-native/blob/c33986e9eda468c508806e0a3e73c771401e5718/src/enamlnative/core/dev.py#L491-L514 |
6,121 | aliyun/aliyun-log-python-sdk | aliyun/log/logclient.py | LogClient.get_machine_group_applied_configs | def get_machine_group_applied_configs(self, project_name, group_name):
""" get the logtail config names applied in a machine group
Unsuccessful opertaion will cause an LogException.
:type project_name: string
:param project_name: the Project name
:type group_name: strin... | python | def get_machine_group_applied_configs(self, project_name, group_name):
""" get the logtail config names applied in a machine group
Unsuccessful opertaion will cause an LogException.
:type project_name: string
:param project_name: the Project name
:type group_name: strin... | ['def', 'get_machine_group_applied_configs', '(', 'self', ',', 'project_name', ',', 'group_name', ')', ':', 'headers', '=', '{', '}', 'params', '=', '{', '}', 'resource', '=', '"/machinegroups/"', '+', 'group_name', '+', '"/configs"', '(', 'resp', ',', 'header', ')', '=', 'self', '.', '_send', '(', '"GET"', ',', 'proje... | get the logtail config names applied in a machine group
Unsuccessful opertaion will cause an LogException.
:type project_name: string
:param project_name: the Project name
:type group_name: string
:param group_name: the group name list
:return: GetMachineGrou... | ['get', 'the', 'logtail', 'config', 'names', 'applied', 'in', 'a', 'machine', 'group', 'Unsuccessful', 'opertaion', 'will', 'cause', 'an', 'LogException', '.', ':', 'type', 'project_name', ':', 'string', ':', 'param', 'project_name', ':', 'the', 'Project', 'name', ':', 'type', 'group_name', ':', 'string', ':', 'param',... | train | https://github.com/aliyun/aliyun-log-python-sdk/blob/ac383db0a16abf1e5ef7df36074374184b43516e/aliyun/log/logclient.py#L1821-L1840 |
6,122 | happyleavesaoc/python-firetv | firetv/__main__.py | device_connect | def device_connect(device_id):
""" Force a connection attempt via HTTP GET. """
success = False
if device_id in devices:
devices[device_id].connect()
success = True
return jsonify(success=success) | python | def device_connect(device_id):
""" Force a connection attempt via HTTP GET. """
success = False
if device_id in devices:
devices[device_id].connect()
success = True
return jsonify(success=success) | ['def', 'device_connect', '(', 'device_id', ')', ':', 'success', '=', 'False', 'if', 'device_id', 'in', 'devices', ':', 'devices', '[', 'device_id', ']', '.', 'connect', '(', ')', 'success', '=', 'True', 'return', 'jsonify', '(', 'success', '=', 'success', ')'] | Force a connection attempt via HTTP GET. | ['Force', 'a', 'connection', 'attempt', 'via', 'HTTP', 'GET', '.'] | train | https://github.com/happyleavesaoc/python-firetv/blob/3dd953376c0d5af502e775ae14ed0afe03224781/firetv/__main__.py#L220-L226 |
6,123 | tapilab/brandelion | brandelion/cli/analyze.py | proportion_merge | def proportion_merge(brands, exemplars):
""" Return the proportion of a brand's followers who also follower an
exemplar. We merge all exemplar followers into one big pseudo-account."""
scores = {}
exemplar_followers = set()
for followers in exemplars.values():
exemplar_followers |= followers... | python | def proportion_merge(brands, exemplars):
""" Return the proportion of a brand's followers who also follower an
exemplar. We merge all exemplar followers into one big pseudo-account."""
scores = {}
exemplar_followers = set()
for followers in exemplars.values():
exemplar_followers |= followers... | ['def', 'proportion_merge', '(', 'brands', ',', 'exemplars', ')', ':', 'scores', '=', '{', '}', 'exemplar_followers', '=', 'set', '(', ')', 'for', 'followers', 'in', 'exemplars', '.', 'values', '(', ')', ':', 'exemplar_followers', '|=', 'followers', 'for', 'brand', ',', 'followers', 'in', 'brands', ':', 'scores', '[', ... | Return the proportion of a brand's followers who also follower an
exemplar. We merge all exemplar followers into one big pseudo-account. | ['Return', 'the', 'proportion', 'of', 'a', 'brand', 's', 'followers', 'who', 'also', 'follower', 'an', 'exemplar', '.', 'We', 'merge', 'all', 'exemplar', 'followers', 'into', 'one', 'big', 'pseudo', '-', 'account', '.'] | train | https://github.com/tapilab/brandelion/blob/40a5a5333cf704182c8666d1fbbbdadc7ff88546/brandelion/cli/analyze.py#L298-L308 |
6,124 | inasafe/inasafe | safe/impact_function/provenance_utilities.py | get_analysis_question | def get_analysis_question(hazard, exposure):
"""Construct analysis question based on hazard and exposure.
:param hazard: A hazard definition.
:type hazard: dict
:param exposure: An exposure definition.
:type exposure: dict
:returns: Analysis question based on reporting standards.
:rtype: ... | python | def get_analysis_question(hazard, exposure):
"""Construct analysis question based on hazard and exposure.
:param hazard: A hazard definition.
:type hazard: dict
:param exposure: An exposure definition.
:type exposure: dict
:returns: Analysis question based on reporting standards.
:rtype: ... | ['def', 'get_analysis_question', '(', 'hazard', ',', 'exposure', ')', ':', '# First we look for a translated hardcoded question.', 'question', '=', 'specific_analysis_question', '(', 'hazard', ',', 'exposure', ')', 'if', 'question', ':', 'return', 'question', 'if', 'hazard', '==', 'hazard_generic', ':', "# Secondly, if... | Construct analysis question based on hazard and exposure.
:param hazard: A hazard definition.
:type hazard: dict
:param exposure: An exposure definition.
:type exposure: dict
:returns: Analysis question based on reporting standards.
:rtype: str | ['Construct', 'analysis', 'question', 'based', 'on', 'hazard', 'and', 'exposure', '.'] | train | https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/impact_function/provenance_utilities.py#L48-L81 |
6,125 | valohai/valohai-yaml | valohai_yaml/parsing.py | parse | def parse(yaml, validate=True):
"""
Parse the given YAML data into a `Config` object, optionally validating it first.
:param yaml: YAML data (either a string, a stream, or pre-parsed Python dict/list)
:type yaml: list|dict|str|file
:param validate: Whether to validate the data before attempting to ... | python | def parse(yaml, validate=True):
"""
Parse the given YAML data into a `Config` object, optionally validating it first.
:param yaml: YAML data (either a string, a stream, or pre-parsed Python dict/list)
:type yaml: list|dict|str|file
:param validate: Whether to validate the data before attempting to ... | ['def', 'parse', '(', 'yaml', ',', 'validate', '=', 'True', ')', ':', 'data', '=', 'read_yaml', '(', 'yaml', ')', 'if', 'validate', ':', '# pragma: no branch', 'from', '.', 'validation', 'import', 'validate', 'validate', '(', 'data', ',', 'raise_exc', '=', 'True', ')', 'return', 'Config', '.', 'parse', '(', 'data', ')'... | Parse the given YAML data into a `Config` object, optionally validating it first.
:param yaml: YAML data (either a string, a stream, or pre-parsed Python dict/list)
:type yaml: list|dict|str|file
:param validate: Whether to validate the data before attempting to parse it.
:type validate: bool
:retu... | ['Parse', 'the', 'given', 'YAML', 'data', 'into', 'a', 'Config', 'object', 'optionally', 'validating', 'it', 'first', '.'] | train | https://github.com/valohai/valohai-yaml/blob/3d2e92381633d84cdba039f6905df34c9633a2e1/valohai_yaml/parsing.py#L6-L21 |
6,126 | serhatbolsu/robotframework-appiumlibrary | AppiumLibrary/keywords/_element.py | _ElementKeywords.input_value | def input_value(self, locator, text):
"""Sets the given value into text field identified by `locator`. This is an IOS only keyword, input value makes use of set_value
See `introduction` for details about locating elements.
"""
self._info("Setting text '%s' into text field '%s'" % (... | python | def input_value(self, locator, text):
"""Sets the given value into text field identified by `locator`. This is an IOS only keyword, input value makes use of set_value
See `introduction` for details about locating elements.
"""
self._info("Setting text '%s' into text field '%s'" % (... | ['def', 'input_value', '(', 'self', ',', 'locator', ',', 'text', ')', ':', 'self', '.', '_info', '(', '"Setting text \'%s\' into text field \'%s\'"', '%', '(', 'text', ',', 'locator', ')', ')', 'self', '.', '_element_input_value_by_locator', '(', 'locator', ',', 'text', ')'] | Sets the given value into text field identified by `locator`. This is an IOS only keyword, input value makes use of set_value
See `introduction` for details about locating elements. | ['Sets', 'the', 'given', 'value', 'into', 'text', 'field', 'identified', 'by', 'locator', '.', 'This', 'is', 'an', 'IOS', 'only', 'keyword', 'input', 'value', 'makes', 'use', 'of', 'set_value', 'See', 'introduction', 'for', 'details', 'about', 'locating', 'elements', '.'] | train | https://github.com/serhatbolsu/robotframework-appiumlibrary/blob/91c808cf0602af6be8135ac529fa488fded04a85/AppiumLibrary/keywords/_element.py#L82-L88 |
6,127 | honzamach/pynspect | pynspect/traversers.py | BaseFilteringTreeTraverser.evaluate_binop_math | def evaluate_binop_math(self, operation, left, right, **kwargs):
"""
Evaluate given mathematical binary operation with given operands.
"""
if not operation in self.binops_math:
raise ValueError("Invalid math binary operation '{}'".format(operation))
if left is None or... | python | def evaluate_binop_math(self, operation, left, right, **kwargs):
"""
Evaluate given mathematical binary operation with given operands.
"""
if not operation in self.binops_math:
raise ValueError("Invalid math binary operation '{}'".format(operation))
if left is None or... | ['def', 'evaluate_binop_math', '(', 'self', ',', 'operation', ',', 'left', ',', 'right', ',', '*', '*', 'kwargs', ')', ':', 'if', 'not', 'operation', 'in', 'self', '.', 'binops_math', ':', 'raise', 'ValueError', '(', '"Invalid math binary operation \'{}\'"', '.', 'format', '(', 'operation', ')', ')', 'if', 'left', 'is'... | Evaluate given mathematical binary operation with given operands. | ['Evaluate', 'given', 'mathematical', 'binary', 'operation', 'with', 'given', 'operands', '.'] | train | https://github.com/honzamach/pynspect/blob/0582dcc1f7aafe50e25a21c792ea1b3367ea5881/pynspect/traversers.py#L710-L730 |
6,128 | Yubico/yubikey-manager | ykman/cli/oath.py | code | def code(ctx, show_hidden, query, single):
"""
Generate codes.
Generate codes from credentials stored on your YubiKey.
Provide a query string to match one or more specific credentials.
Touch and HOTP credentials require a single match to be triggered.
"""
ensure_validated(ctx)
control... | python | def code(ctx, show_hidden, query, single):
"""
Generate codes.
Generate codes from credentials stored on your YubiKey.
Provide a query string to match one or more specific credentials.
Touch and HOTP credentials require a single match to be triggered.
"""
ensure_validated(ctx)
control... | ['def', 'code', '(', 'ctx', ',', 'show_hidden', ',', 'query', ',', 'single', ')', ':', 'ensure_validated', '(', 'ctx', ')', 'controller', '=', 'ctx', '.', 'obj', '[', "'controller'", ']', 'creds', '=', '[', '(', 'cr', ',', 'c', ')', 'for', '(', 'cr', ',', 'c', ')', 'in', 'controller', '.', 'calculate_all', '(', ')', 'i... | Generate codes.
Generate codes from credentials stored on your YubiKey.
Provide a query string to match one or more specific credentials.
Touch and HOTP credentials require a single match to be triggered. | ['Generate', 'codes', '.'] | train | https://github.com/Yubico/yubikey-manager/blob/3ac27bc59ae76a59db9d09a530494add2edbbabf/ykman/cli/oath.py#L335-L395 |
6,129 | PGower/PyCanvas | pycanvas/apis/courses.py | CoursesAPI.update_course_settings | def update_course_settings(self, course_id, allow_student_discussion_editing=None, allow_student_discussion_topics=None, allow_student_forum_attachments=None, allow_student_organized_groups=None, hide_distribution_graphs=None, hide_final_grades=None, home_page_announcement_limit=None, lock_all_announcements=None, restr... | python | def update_course_settings(self, course_id, allow_student_discussion_editing=None, allow_student_discussion_topics=None, allow_student_forum_attachments=None, allow_student_organized_groups=None, hide_distribution_graphs=None, hide_final_grades=None, home_page_announcement_limit=None, lock_all_announcements=None, restr... | ['def', 'update_course_settings', '(', 'self', ',', 'course_id', ',', 'allow_student_discussion_editing', '=', 'None', ',', 'allow_student_discussion_topics', '=', 'None', ',', 'allow_student_forum_attachments', '=', 'None', ',', 'allow_student_organized_groups', '=', 'None', ',', 'hide_distribution_graphs', '=', 'None... | Update course settings.
Can update the following course settings: | ['Update', 'course', 'settings', '.', 'Can', 'update', 'the', 'following', 'course', 'settings', ':'] | train | https://github.com/PGower/PyCanvas/blob/68520005382b440a1e462f9df369f54d364e21e8/pycanvas/apis/courses.py#L798-L868 |
6,130 | danijar/sets | sets/core/step.py | Step.download | def download(cls, url, filename=None):
"""
Download a file into the correct cache directory.
"""
return utility.download(url, cls.directory(), filename) | python | def download(cls, url, filename=None):
"""
Download a file into the correct cache directory.
"""
return utility.download(url, cls.directory(), filename) | ['def', 'download', '(', 'cls', ',', 'url', ',', 'filename', '=', 'None', ')', ':', 'return', 'utility', '.', 'download', '(', 'url', ',', 'cls', '.', 'directory', '(', ')', ',', 'filename', ')'] | Download a file into the correct cache directory. | ['Download', 'a', 'file', 'into', 'the', 'correct', 'cache', 'directory', '.'] | train | https://github.com/danijar/sets/blob/2542c28f43d0af18932cb5b82f54ffb6ae557d12/sets/core/step.py#L24-L28 |
6,131 | saltstack/salt | salt/netapi/rest_cherrypy/event_processor.py | SaltInfo.process | def process(self, salt_data, token, opts):
'''
Process events and publish data
'''
parts = salt_data['tag'].split('/')
if len(parts) < 2:
return
# TBD: Simplify these conditional expressions
if parts[1] == 'job':
if parts[3] == 'new':
... | python | def process(self, salt_data, token, opts):
'''
Process events and publish data
'''
parts = salt_data['tag'].split('/')
if len(parts) < 2:
return
# TBD: Simplify these conditional expressions
if parts[1] == 'job':
if parts[3] == 'new':
... | ['def', 'process', '(', 'self', ',', 'salt_data', ',', 'token', ',', 'opts', ')', ':', 'parts', '=', 'salt_data', '[', "'tag'", ']', '.', 'split', '(', "'/'", ')', 'if', 'len', '(', 'parts', ')', '<', '2', ':', 'return', '# TBD: Simplify these conditional expressions', 'if', 'parts', '[', '1', ']', '==', "'job'", ':', ... | Process events and publish data | ['Process', 'events', 'and', 'publish', 'data'] | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/netapi/rest_cherrypy/event_processor.py#L190-L211 |
6,132 | quiltdata/quilt | compiler/quilt/tools/command.py | _check_team_exists | def _check_team_exists(team):
"""
Check that the team registry actually exists.
"""
if team is None:
return
hostname = urlparse(get_registry_url(team)).hostname
try:
socket.gethostbyname(hostname)
except IOError:
try:
# Do we have internet?
so... | python | def _check_team_exists(team):
"""
Check that the team registry actually exists.
"""
if team is None:
return
hostname = urlparse(get_registry_url(team)).hostname
try:
socket.gethostbyname(hostname)
except IOError:
try:
# Do we have internet?
so... | ['def', '_check_team_exists', '(', 'team', ')', ':', 'if', 'team', 'is', 'None', ':', 'return', 'hostname', '=', 'urlparse', '(', 'get_registry_url', '(', 'team', ')', ')', '.', 'hostname', 'try', ':', 'socket', '.', 'gethostbyname', '(', 'hostname', ')', 'except', 'IOError', ':', 'try', ':', '# Do we have internet?', ... | Check that the team registry actually exists. | ['Check', 'that', 'the', 'team', 'registry', 'actually', 'exists', '.'] | train | https://github.com/quiltdata/quilt/blob/651853e7e89a8af86e0ff26167e752efa5878c12/compiler/quilt/tools/command.py#L375-L393 |
6,133 | Erotemic/utool | _broken/_grave.py | roundrobin | def roundrobin(*iterables):
"""roundrobin('ABC', 'D', 'EF') --> A D E B F C"""
raise NotImplementedError('not sure if this implementation is correct')
# http://stackoverflow.com/questions/11125212/interleaving-lists-in-python
#sentinel = object()
#return (x for x in chain(*zip_longest(fillvalue=sent... | python | def roundrobin(*iterables):
"""roundrobin('ABC', 'D', 'EF') --> A D E B F C"""
raise NotImplementedError('not sure if this implementation is correct')
# http://stackoverflow.com/questions/11125212/interleaving-lists-in-python
#sentinel = object()
#return (x for x in chain(*zip_longest(fillvalue=sent... | ['def', 'roundrobin', '(', '*', 'iterables', ')', ':', 'raise', 'NotImplementedError', '(', "'not sure if this implementation is correct'", ')', '# http://stackoverflow.com/questions/11125212/interleaving-lists-in-python', '#sentinel = object()', '#return (x for x in chain(*zip_longest(fillvalue=sentinel, *iterables)) ... | roundrobin('ABC', 'D', 'EF') --> A D E B F C | ['roundrobin', '(', 'ABC', 'D', 'EF', ')', '--', '>', 'A', 'D', 'E', 'B', 'F', 'C'] | train | https://github.com/Erotemic/utool/blob/3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a/_broken/_grave.py#L47-L64 |
6,134 | ga4gh/ga4gh-server | ga4gh/server/sqlite_backend.py | limitsSql | def limitsSql(startIndex=0, maxResults=0):
"""
Construct a SQL LIMIT clause
"""
if startIndex and maxResults:
return " LIMIT {}, {}".format(startIndex, maxResults)
elif startIndex:
raise Exception("startIndex was provided, but maxResults was not")
elif maxResults:
return ... | python | def limitsSql(startIndex=0, maxResults=0):
"""
Construct a SQL LIMIT clause
"""
if startIndex and maxResults:
return " LIMIT {}, {}".format(startIndex, maxResults)
elif startIndex:
raise Exception("startIndex was provided, but maxResults was not")
elif maxResults:
return ... | ['def', 'limitsSql', '(', 'startIndex', '=', '0', ',', 'maxResults', '=', '0', ')', ':', 'if', 'startIndex', 'and', 'maxResults', ':', 'return', '" LIMIT {}, {}"', '.', 'format', '(', 'startIndex', ',', 'maxResults', ')', 'elif', 'startIndex', ':', 'raise', 'Exception', '(', '"startIndex was provided, but maxResults wa... | Construct a SQL LIMIT clause | ['Construct', 'a', 'SQL', 'LIMIT', 'clause'] | train | https://github.com/ga4gh/ga4gh-server/blob/1aa18922ef136db8604f6f098cb1732cba6f2a76/ga4gh/server/sqlite_backend.py#L35-L46 |
6,135 | maceoutliner/django-fiction-outlines | fiction_outlines/models.py | StoryElementNode.all_characters | def all_characters(self):
'''
Returns a queryset of all characters associated with this node and its descendants,
excluding any duplicates.
'''
qs = self.assoc_characters.all()
for node in self.get_descendants():
qs2 = node.assoc_characters.all()
q... | python | def all_characters(self):
'''
Returns a queryset of all characters associated with this node and its descendants,
excluding any duplicates.
'''
qs = self.assoc_characters.all()
for node in self.get_descendants():
qs2 = node.assoc_characters.all()
q... | ['def', 'all_characters', '(', 'self', ')', ':', 'qs', '=', 'self', '.', 'assoc_characters', '.', 'all', '(', ')', 'for', 'node', 'in', 'self', '.', 'get_descendants', '(', ')', ':', 'qs2', '=', 'node', '.', 'assoc_characters', '.', 'all', '(', ')', 'qs', '=', 'qs', '.', 'union', '(', 'qs2', ')', '.', 'distinct', '(', ... | Returns a queryset of all characters associated with this node and its descendants,
excluding any duplicates. | ['Returns', 'a', 'queryset', 'of', 'all', 'characters', 'associated', 'with', 'this', 'node', 'and', 'its', 'descendants', 'excluding', 'any', 'duplicates', '.'] | train | https://github.com/maceoutliner/django-fiction-outlines/blob/6c58e356af3fbe7b23557643ba27e46eaef9d4e3/fiction_outlines/models.py#L817-L826 |
6,136 | mbedmicro/pyOCD | pyocd/target/pack/cmsis_pack.py | CmsisPackDevice._build_memory_regions | def _build_memory_regions(self):
"""! @brief Creates memory region instances for the device.
For each `<memory>` element in the device info, a memory region object is created and
added to the `_regions` attribute. IROM or non-writable memories are created as RomRegions
by this m... | python | def _build_memory_regions(self):
"""! @brief Creates memory region instances for the device.
For each `<memory>` element in the device info, a memory region object is created and
added to the `_regions` attribute. IROM or non-writable memories are created as RomRegions
by this m... | ['def', '_build_memory_regions', '(', 'self', ')', ':', 'for', 'elem', 'in', 'self', '.', '_info', '.', 'memories', ':', 'try', ':', '# Get the region name, type, and access permissions.', 'if', "'name'", 'in', 'elem', '.', 'attrib', ':', 'name', '=', 'elem', '.', 'attrib', '[', "'name'", ']', 'access', '=', 'elem', '.... | ! @brief Creates memory region instances for the device.
For each `<memory>` element in the device info, a memory region object is created and
added to the `_regions` attribute. IROM or non-writable memories are created as RomRegions
by this method. They will be converted to FlashRegion... | ['!'] | train | https://github.com/mbedmicro/pyOCD/blob/41a174718a9739f3cbe785c2ba21cb7fd1310c6f/pyocd/target/pack/cmsis_pack.py#L279-L341 |
6,137 | hotzenklotz/pybeerxml | pybeerxml/parser.py | Parser.parse | def parse(self, xml_file):
"Get a list of parsed recipes from BeerXML input"
recipes = []
with open(xml_file, "rt") as f:
tree = ElementTree.parse(f)
for recipeNode in tree.iter():
if self.to_lower(recipeNode.tag) != "recipe":
continue
... | python | def parse(self, xml_file):
"Get a list of parsed recipes from BeerXML input"
recipes = []
with open(xml_file, "rt") as f:
tree = ElementTree.parse(f)
for recipeNode in tree.iter():
if self.to_lower(recipeNode.tag) != "recipe":
continue
... | ['def', 'parse', '(', 'self', ',', 'xml_file', ')', ':', 'recipes', '=', '[', ']', 'with', 'open', '(', 'xml_file', ',', '"rt"', ')', 'as', 'f', ':', 'tree', '=', 'ElementTree', '.', 'parse', '(', 'f', ')', 'for', 'recipeNode', 'in', 'tree', '.', 'iter', '(', ')', ':', 'if', 'self', '.', 'to_lower', '(', 'recipeNode', ... | Get a list of parsed recipes from BeerXML input | ['Get', 'a', 'list', 'of', 'parsed', 'recipes', 'from', 'BeerXML', 'input'] | train | https://github.com/hotzenklotz/pybeerxml/blob/e9cf8d6090b1e01e5bbb101e255792b134affbe0/pybeerxml/parser.py#L40-L104 |
6,138 | jslang/responsys | responsys/client.py | InteractClient.connect | def connect(self):
""" Connects to the Responsys soap service
Uses the credentials passed to the client init to login and setup the session id returned.
Returns True on successful connection, otherwise False.
"""
if self.session and self.session.is_expired:
# Close ... | python | def connect(self):
""" Connects to the Responsys soap service
Uses the credentials passed to the client init to login and setup the session id returned.
Returns True on successful connection, otherwise False.
"""
if self.session and self.session.is_expired:
# Close ... | ['def', 'connect', '(', 'self', ')', ':', 'if', 'self', '.', 'session', 'and', 'self', '.', 'session', '.', 'is_expired', ':', '# Close the session to avoid max concurrent session errors', 'self', '.', 'disconnect', '(', 'abandon_session', '=', 'True', ')', 'if', 'not', 'self', '.', 'session', ':', 'try', ':', 'login_r... | Connects to the Responsys soap service
Uses the credentials passed to the client init to login and setup the session id returned.
Returns True on successful connection, otherwise False. | ['Connects', 'to', 'the', 'Responsys', 'soap', 'service'] | train | https://github.com/jslang/responsys/blob/9b355a444c0c75dff41064502c1e2b76dfd5cb93/responsys/client.py#L133-L155 |
6,139 | QUANTAXIS/QUANTAXIS | QUANTAXIS/QASU/save_tdx_file.py | QA_save_tdx_to_mongo | def QA_save_tdx_to_mongo(file_dir, client=DATABASE):
"""save file
Arguments:
file_dir {str:direction} -- 文件的地址
Keyword Arguments:
client {Mongodb:Connection} -- Mongo Connection (default: {DATABASE})
"""
reader = TdxMinBarReader()
__coll = client.stock_min_five
for... | python | def QA_save_tdx_to_mongo(file_dir, client=DATABASE):
"""save file
Arguments:
file_dir {str:direction} -- 文件的地址
Keyword Arguments:
client {Mongodb:Connection} -- Mongo Connection (default: {DATABASE})
"""
reader = TdxMinBarReader()
__coll = client.stock_min_five
for... | ['def', 'QA_save_tdx_to_mongo', '(', 'file_dir', ',', 'client', '=', 'DATABASE', ')', ':', 'reader', '=', 'TdxMinBarReader', '(', ')', '__coll', '=', 'client', '.', 'stock_min_five', 'for', 'a', ',', 'v', ',', 'files', 'in', 'os', '.', 'walk', '(', 'file_dir', ')', ':', 'for', 'file', 'in', 'files', ':', 'if', '(', 'st... | save file
Arguments:
file_dir {str:direction} -- 文件的地址
Keyword Arguments:
client {Mongodb:Connection} -- Mongo Connection (default: {DATABASE}) | ['save', 'file', 'Arguments', ':', 'file_dir', '{', 'str', ':', 'direction', '}', '--', '文件的地址', 'Keyword', 'Arguments', ':', 'client', '{', 'Mongodb', ':', 'Connection', '}', '--', 'Mongo', 'Connection', '(', 'default', ':', '{', 'DATABASE', '}', ')'] | train | https://github.com/QUANTAXIS/QUANTAXIS/blob/bb1fe424e4108b62a1f712b81a05cf829297a5c0/QUANTAXIS/QASU/save_tdx_file.py#L35-L68 |
6,140 | crossbario/txaio | txaio/tx.py | _TxApi.make_batched_timer | def make_batched_timer(self, bucket_seconds, chunk_size=100):
"""
Creates and returns an object implementing
:class:`txaio.IBatchedTimer`.
:param bucket_seconds: the number of seconds in each bucket. That
is, a value of 5 means that any timeout within a 5 second
... | python | def make_batched_timer(self, bucket_seconds, chunk_size=100):
"""
Creates and returns an object implementing
:class:`txaio.IBatchedTimer`.
:param bucket_seconds: the number of seconds in each bucket. That
is, a value of 5 means that any timeout within a 5 second
... | ['def', 'make_batched_timer', '(', 'self', ',', 'bucket_seconds', ',', 'chunk_size', '=', '100', ')', ':', 'def', 'get_seconds', '(', ')', ':', 'return', 'self', '.', '_get_loop', '(', ')', '.', 'seconds', '(', ')', 'def', 'create_delayed_call', '(', 'delay', ',', 'fun', ',', '*', 'args', ',', '*', '*', 'kwargs', ')', ... | Creates and returns an object implementing
:class:`txaio.IBatchedTimer`.
:param bucket_seconds: the number of seconds in each bucket. That
is, a value of 5 means that any timeout within a 5 second
window will be in the same bucket, and get notified at the
same time. ... | ['Creates', 'and', 'returns', 'an', 'object', 'implementing', ':', 'class', ':', 'txaio', '.', 'IBatchedTimer', '.'] | train | https://github.com/crossbario/txaio/blob/29c77ff1210cabd4cc03f16f34672612e7eef704/txaio/tx.py#L437-L462 |
6,141 | TrafficSenseMSD/SumoTools | traci/_gui.py | GuiDomain.screenshot | def screenshot(self, viewID, filename):
"""screenshot(string, string) -> None
Save a screenshot for the given view to the given filename.
The fileformat is guessed from the extension, the available
formats differ from platform to platform but should at least
include ps, svg and ... | python | def screenshot(self, viewID, filename):
"""screenshot(string, string) -> None
Save a screenshot for the given view to the given filename.
The fileformat is guessed from the extension, the available
formats differ from platform to platform but should at least
include ps, svg and ... | ['def', 'screenshot', '(', 'self', ',', 'viewID', ',', 'filename', ')', ':', 'self', '.', '_connection', '.', '_sendStringCmd', '(', 'tc', '.', 'CMD_SET_GUI_VARIABLE', ',', 'tc', '.', 'VAR_SCREENSHOT', ',', 'viewID', ',', 'filename', ')'] | screenshot(string, string) -> None
Save a screenshot for the given view to the given filename.
The fileformat is guessed from the extension, the available
formats differ from platform to platform but should at least
include ps, svg and pdf, on linux probably gif, png and jpg as well. | ['screenshot', '(', 'string', 'string', ')', '-', '>', 'None'] | train | https://github.com/TrafficSenseMSD/SumoTools/blob/8607b4f885f1d1798e43240be643efe6dccccdaa/traci/_gui.py#L101-L110 |
6,142 | tswicegood/Dolt | dolt/__init__.py | Dolt.with_headers | def with_headers(self, headers=None, **params):
"""
Add headers to the request.
:param headers: A dict, or a list of key, value pairs
:param params: A dict of key value pairs
"""
if isinstance(headers, (tuple, list)):
headers = dict(head... | python | def with_headers(self, headers=None, **params):
"""
Add headers to the request.
:param headers: A dict, or a list of key, value pairs
:param params: A dict of key value pairs
"""
if isinstance(headers, (tuple, list)):
headers = dict(head... | ['def', 'with_headers', '(', 'self', ',', 'headers', '=', 'None', ',', '*', '*', 'params', ')', ':', 'if', 'isinstance', '(', 'headers', ',', '(', 'tuple', ',', 'list', ')', ')', ':', 'headers', '=', 'dict', '(', 'headers', ')', 'if', 'params', ':', 'if', 'isinstance', '(', 'headers', ',', 'dict', ')', ':', 'headers', ... | Add headers to the request.
:param headers: A dict, or a list of key, value pairs
:param params: A dict of key value pairs | ['Add', 'headers', 'to', 'the', 'request', '.', ':', 'param', 'headers', ':', 'A', 'dict', 'or', 'a', 'list', 'of', 'key', 'value', 'pairs', ':', 'param', 'params', ':', 'A', 'dict', 'of', 'key', 'value', 'pairs'] | train | https://github.com/tswicegood/Dolt/blob/e0da1918b7db18f885734a89f824b9e173cc30a5/dolt/__init__.py#L203-L220 |
6,143 | mitsei/dlkit | dlkit/records/assessment/orthographic_visualization/orthographic_records.py | FirstAngleProjectionFormRecord._init_metadata | def _init_metadata(self):
"""stub"""
self._first_angle_metadata = {
'element_id': Id(self.my_osid_object_form._authority,
self.my_osid_object_form._namespace,
'first_angle'),
'element_label': 'First Angle',
'in... | python | def _init_metadata(self):
"""stub"""
self._first_angle_metadata = {
'element_id': Id(self.my_osid_object_form._authority,
self.my_osid_object_form._namespace,
'first_angle'),
'element_label': 'First Angle',
'in... | ['def', '_init_metadata', '(', 'self', ')', ':', 'self', '.', '_first_angle_metadata', '=', '{', "'element_id'", ':', 'Id', '(', 'self', '.', 'my_osid_object_form', '.', '_authority', ',', 'self', '.', 'my_osid_object_form', '.', '_namespace', ',', "'first_angle'", ')', ',', "'element_label'", ':', "'First Angle'", ','... | stub | ['stub'] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/assessment/orthographic_visualization/orthographic_records.py#L60-L74 |
6,144 | bcbio/bcbio-nextgen | bcbio/variation/genotype.py | _run_variantcall_batch_multicore | def _run_variantcall_batch_multicore(items, regions, final_file):
"""Run variant calling on a batch of items using multiple cores.
"""
batch_name = _get_batch_name(items)
variantcaller = _get_batch_variantcaller(items)
work_bams = [dd.get_work_bam(d) or dd.get_align_bam(d) for d in items]
def sp... | python | def _run_variantcall_batch_multicore(items, regions, final_file):
"""Run variant calling on a batch of items using multiple cores.
"""
batch_name = _get_batch_name(items)
variantcaller = _get_batch_variantcaller(items)
work_bams = [dd.get_work_bam(d) or dd.get_align_bam(d) for d in items]
def sp... | ['def', '_run_variantcall_batch_multicore', '(', 'items', ',', 'regions', ',', 'final_file', ')', ':', 'batch_name', '=', '_get_batch_name', '(', 'items', ')', 'variantcaller', '=', '_get_batch_variantcaller', '(', 'items', ')', 'work_bams', '=', '[', 'dd', '.', 'get_work_bam', '(', 'd', ')', 'or', 'dd', '.', 'get_alig... | Run variant calling on a batch of items using multiple cores. | ['Run', 'variant', 'calling', 'on', 'a', 'batch', 'of', 'items', 'using', 'multiple', 'cores', '.'] | train | https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/variation/genotype.py#L462-L486 |
6,145 | offu/WeRoBot | werobot/client.py | Client.update_custom_service_account | def update_custom_service_account(self, account, nickname, password):
"""
修改客服帐号。
:param account: 客服账号的用户名
:param nickname: 客服账号的昵称
:param password: 客服账号的密码
:return: 返回的 JSON 数据包
"""
return self.post(
url="https://api.weixin.qq.com/customservi... | python | def update_custom_service_account(self, account, nickname, password):
"""
修改客服帐号。
:param account: 客服账号的用户名
:param nickname: 客服账号的昵称
:param password: 客服账号的密码
:return: 返回的 JSON 数据包
"""
return self.post(
url="https://api.weixin.qq.com/customservi... | ['def', 'update_custom_service_account', '(', 'self', ',', 'account', ',', 'nickname', ',', 'password', ')', ':', 'return', 'self', '.', 'post', '(', 'url', '=', '"https://api.weixin.qq.com/customservice/kfaccount/update"', ',', 'data', '=', '{', '"kf_account"', ':', 'account', ',', '"nickname"', ':', 'nickname', ',', ... | 修改客服帐号。
:param account: 客服账号的用户名
:param nickname: 客服账号的昵称
:param password: 客服账号的密码
:return: 返回的 JSON 数据包 | ['修改客服帐号。'] | train | https://github.com/offu/WeRoBot/blob/fd42109105b03f9acf45ebd9dcabb9d5cff98f3c/werobot/client.py#L292-L308 |
6,146 | mgoral/subconvert | src/subconvert/utils/SubFile.py | File._writeFile | def _writeFile(cls, filePath, content, encoding = None):
"""Safe file writing. Most common mistakes are checked against and reported before write
operation. After that, if anything unexpected happens, user won't be left without data or
with corrupted one as this method writes to a temporary file... | python | def _writeFile(cls, filePath, content, encoding = None):
"""Safe file writing. Most common mistakes are checked against and reported before write
operation. After that, if anything unexpected happens, user won't be left without data or
with corrupted one as this method writes to a temporary file... | ['def', '_writeFile', '(', 'cls', ',', 'filePath', ',', 'content', ',', 'encoding', '=', 'None', ')', ':', 'filePath', '=', 'os', '.', 'path', '.', 'realpath', '(', 'filePath', ')', 'log', '.', 'debug', '(', '_', '(', '"Real file path to write: %s"', '%', 'filePath', ')', ')', 'if', 'encoding', 'is', 'None', ':', 'enco... | Safe file writing. Most common mistakes are checked against and reported before write
operation. After that, if anything unexpected happens, user won't be left without data or
with corrupted one as this method writes to a temporary file and then simply renames it
(which should be atomic operatio... | ['Safe', 'file', 'writing', '.', 'Most', 'common', 'mistakes', 'are', 'checked', 'against', 'and', 'reported', 'before', 'write', 'operation', '.', 'After', 'that', 'if', 'anything', 'unexpected', 'happens', 'user', 'won', 't', 'be', 'left', 'without', 'data', 'or', 'with', 'corrupted', 'one', 'as', 'this', 'method', '... | train | https://github.com/mgoral/subconvert/blob/59701e5e69ef1ca26ce7d1d766c936664aa2cb32/src/subconvert/utils/SubFile.py#L117-L159 |
6,147 | indietyp/django-automated-logging | automated_logging/signals/__init__.py | get_current_user | def get_current_user():
"""Get current user object from middleware"""
thread_local = AutomatedLoggingMiddleware.thread_local
if hasattr(thread_local, 'current_user'):
user = thread_local.current_user
if isinstance(user, AnonymousUser):
user = None
else:
user = None
... | python | def get_current_user():
"""Get current user object from middleware"""
thread_local = AutomatedLoggingMiddleware.thread_local
if hasattr(thread_local, 'current_user'):
user = thread_local.current_user
if isinstance(user, AnonymousUser):
user = None
else:
user = None
... | ['def', 'get_current_user', '(', ')', ':', 'thread_local', '=', 'AutomatedLoggingMiddleware', '.', 'thread_local', 'if', 'hasattr', '(', 'thread_local', ',', "'current_user'", ')', ':', 'user', '=', 'thread_local', '.', 'current_user', 'if', 'isinstance', '(', 'user', ',', 'AnonymousUser', ')', ':', 'user', '=', 'None'... | Get current user object from middleware | ['Get', 'current', 'user', 'object', 'from', 'middleware'] | train | https://github.com/indietyp/django-automated-logging/blob/095dfc6df62dca45f7db4516bc35e52085d0a01c/automated_logging/signals/__init__.py#L36-L46 |
6,148 | ARMmbed/mbed-cloud-sdk-python | src/mbed_cloud/_backends/device_directory/apis/default_api.py | DefaultApi.group_members_add | def group_members_add(self, device_group_id, body, **kwargs): # noqa: E501
"""Add a device to a group # noqa: E501
Add one device to a group # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass asynchronous=True
... | python | def group_members_add(self, device_group_id, body, **kwargs): # noqa: E501
"""Add a device to a group # noqa: E501
Add one device to a group # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass asynchronous=True
... | ['def', 'group_members_add', '(', 'self', ',', 'device_group_id', ',', 'body', ',', '*', '*', 'kwargs', ')', ':', '# noqa: E501', 'kwargs', '[', "'_return_http_data_only'", ']', '=', 'True', 'if', 'kwargs', '.', 'get', '(', "'asynchronous'", ')', ':', 'return', 'self', '.', 'group_members_add_with_http_info', '(', 'dev... | Add a device to a group # noqa: E501
Add one device to a group # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass asynchronous=True
>>> thread = api.group_members_add(device_group_id, body, asynchronous=True)
... | ['Add', 'a', 'device', 'to', 'a', 'group', '#', 'noqa', ':', 'E501'] | train | https://github.com/ARMmbed/mbed-cloud-sdk-python/blob/c0af86fb2cdd4dc7ed26f236139241067d293509/src/mbed_cloud/_backends/device_directory/apis/default_api.py#L1727-L1748 |
6,149 | pypa/pipenv | pipenv/vendor/pexpect/popen_spawn.py | PopenSpawn.sendline | def sendline(self, s=''):
'''Wraps send(), sending string ``s`` to child process, with os.linesep
automatically appended. Returns number of bytes written. '''
n = self.send(s)
return n + self.send(self.linesep) | python | def sendline(self, s=''):
'''Wraps send(), sending string ``s`` to child process, with os.linesep
automatically appended. Returns number of bytes written. '''
n = self.send(s)
return n + self.send(self.linesep) | ['def', 'sendline', '(', 'self', ',', 's', '=', "''", ')', ':', 'n', '=', 'self', '.', 'send', '(', 's', ')', 'return', 'n', '+', 'self', '.', 'send', '(', 'self', '.', 'linesep', ')'] | Wraps send(), sending string ``s`` to child process, with os.linesep
automatically appended. Returns number of bytes written. | ['Wraps', 'send', '()', 'sending', 'string', 's', 'to', 'child', 'process', 'with', 'os', '.', 'linesep', 'automatically', 'appended', '.', 'Returns', 'number', 'of', 'bytes', 'written', '.'] | train | https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/pexpect/popen_spawn.py#L149-L154 |
6,150 | dropbox/stone | stone/frontend/lexer.py | Lexer.input | def input(self, file_data, **kwargs):
"""
Required by ply.yacc for this to quack (duck typing) like a ply lexer.
:param str file_data: Contents of the file to lex.
"""
self.lex = lex.lex(module=self, **kwargs)
self.tokens_queue = []
self.cur_indent = 0
# ... | python | def input(self, file_data, **kwargs):
"""
Required by ply.yacc for this to quack (duck typing) like a ply lexer.
:param str file_data: Contents of the file to lex.
"""
self.lex = lex.lex(module=self, **kwargs)
self.tokens_queue = []
self.cur_indent = 0
# ... | ['def', 'input', '(', 'self', ',', 'file_data', ',', '*', '*', 'kwargs', ')', ':', 'self', '.', 'lex', '=', 'lex', '.', 'lex', '(', 'module', '=', 'self', ',', '*', '*', 'kwargs', ')', 'self', '.', 'tokens_queue', '=', '[', ']', 'self', '.', 'cur_indent', '=', '0', '# Hack to avoid tokenization bugs caused by files tha... | Required by ply.yacc for this to quack (duck typing) like a ply lexer.
:param str file_data: Contents of the file to lex. | ['Required', 'by', 'ply', '.', 'yacc', 'for', 'this', 'to', 'quack', '(', 'duck', 'typing', ')', 'like', 'a', 'ply', 'lexer', '.'] | train | https://github.com/dropbox/stone/blob/2e95cbcd1c48e05cca68c919fd8d24adec6b0f58/stone/frontend/lexer.py#L44-L55 |
6,151 | aiogram/aiogram | aiogram/bot/bot.py | Bot.get_chat | async def get_chat(self, chat_id: typing.Union[base.Integer, base.String]) -> types.Chat:
"""
Use this method to get up to date information about the chat
(current name of the user for one-on-one conversations, current username of a user, group or channel, etc.).
Source: https://core.te... | python | async def get_chat(self, chat_id: typing.Union[base.Integer, base.String]) -> types.Chat:
"""
Use this method to get up to date information about the chat
(current name of the user for one-on-one conversations, current username of a user, group or channel, etc.).
Source: https://core.te... | ['async', 'def', 'get_chat', '(', 'self', ',', 'chat_id', ':', 'typing', '.', 'Union', '[', 'base', '.', 'Integer', ',', 'base', '.', 'String', ']', ')', '->', 'types', '.', 'Chat', ':', 'payload', '=', 'generate_payload', '(', '*', '*', 'locals', '(', ')', ')', 'result', '=', 'await', 'self', '.', 'request', '(', 'api... | Use this method to get up to date information about the chat
(current name of the user for one-on-one conversations, current username of a user, group or channel, etc.).
Source: https://core.telegram.org/bots/api#getchat
:param chat_id: Unique identifier for the target chat or username of the ... | ['Use', 'this', 'method', 'to', 'get', 'up', 'to', 'date', 'information', 'about', 'the', 'chat', '(', 'current', 'name', 'of', 'the', 'user', 'for', 'one', '-', 'on', '-', 'one', 'conversations', 'current', 'username', 'of', 'a', 'user', 'group', 'or', 'channel', 'etc', '.', ')', '.'] | train | https://github.com/aiogram/aiogram/blob/2af930149ce2482547721e2c8755c10307295e48/aiogram/bot/bot.py#L1253-L1268 |
6,152 | apache/incubator-mxnet | python/mxnet/gluon/parameter.py | ParameterDict.save | def save(self, filename, strip_prefix=''):
"""Save parameters to file.
Parameters
----------
filename : str
Path to parameter file.
strip_prefix : str, default ''
Strip prefix from parameter names before saving.
"""
arg_dict = {}
f... | python | def save(self, filename, strip_prefix=''):
"""Save parameters to file.
Parameters
----------
filename : str
Path to parameter file.
strip_prefix : str, default ''
Strip prefix from parameter names before saving.
"""
arg_dict = {}
f... | ['def', 'save', '(', 'self', ',', 'filename', ',', 'strip_prefix', '=', "''", ')', ':', 'arg_dict', '=', '{', '}', 'for', 'param', 'in', 'self', '.', 'values', '(', ')', ':', 'weight', '=', 'param', '.', '_reduce', '(', ')', 'if', 'not', 'param', '.', 'name', '.', 'startswith', '(', 'strip_prefix', ')', ':', 'raise', '... | Save parameters to file.
Parameters
----------
filename : str
Path to parameter file.
strip_prefix : str, default ''
Strip prefix from parameter names before saving. | ['Save', 'parameters', 'to', 'file', '.'] | train | https://github.com/apache/incubator-mxnet/blob/1af29e9c060a4c7d60eeaacba32afdb9a7775ba7/python/mxnet/gluon/parameter.py#L854-L877 |
6,153 | ssalentin/plip | plip/modules/report.py | StructureReport.construct_txt_file | def construct_txt_file(self):
"""Construct the header of the txt file"""
textlines = ['Prediction of noncovalent interactions for PDB structure %s' % self.mol.pymol_name.upper(), ]
textlines.append("=" * len(textlines[0]))
textlines.append('Created on %s using PLIP v%s\n' % (time.strftim... | python | def construct_txt_file(self):
"""Construct the header of the txt file"""
textlines = ['Prediction of noncovalent interactions for PDB structure %s' % self.mol.pymol_name.upper(), ]
textlines.append("=" * len(textlines[0]))
textlines.append('Created on %s using PLIP v%s\n' % (time.strftim... | ['def', 'construct_txt_file', '(', 'self', ')', ':', 'textlines', '=', '[', "'Prediction of noncovalent interactions for PDB structure %s'", '%', 'self', '.', 'mol', '.', 'pymol_name', '.', 'upper', '(', ')', ',', ']', 'textlines', '.', 'append', '(', '"="', '*', 'len', '(', 'textlines', '[', '0', ']', ')', ')', 'textl... | Construct the header of the txt file | ['Construct', 'the', 'header', 'of', 'the', 'txt', 'file'] | train | https://github.com/ssalentin/plip/blob/906c8d36463689779b403f6c2c9ed06174acaf9a/plip/modules/report.py#L75-L87 |
6,154 | MAVENSDC/cdflib | cdflib/cdfread.py | CDF._default_pad | def _default_pad(self, data_type, num_elms): # @NoSelf
'''
The default pad values by CDF data type
'''
order = self._convert_option()
if (data_type == 51 or data_type == 52):
return str(' '*num_elms)
if (data_type == 1) or (data_type == 41):
pad_... | python | def _default_pad(self, data_type, num_elms): # @NoSelf
'''
The default pad values by CDF data type
'''
order = self._convert_option()
if (data_type == 51 or data_type == 52):
return str(' '*num_elms)
if (data_type == 1) or (data_type == 41):
pad_... | ['def', '_default_pad', '(', 'self', ',', 'data_type', ',', 'num_elms', ')', ':', '# @NoSelf', 'order', '=', 'self', '.', '_convert_option', '(', ')', 'if', '(', 'data_type', '==', '51', 'or', 'data_type', '==', '52', ')', ':', 'return', 'str', '(', "' '", '*', 'num_elms', ')', 'if', '(', 'data_type', '==', '1', ')', '... | The default pad values by CDF data type | ['The', 'default', 'pad', 'values', 'by', 'CDF', 'data', 'type'] | train | https://github.com/MAVENSDC/cdflib/blob/d237c60e5db67db0f92d96054209c25c4042465c/cdflib/cdfread.py#L2100-L2142 |
6,155 | RI-imaging/qpformat | qpformat/file_formats/series_hdf5_qpimage.py | SeriesHdf5Qpimage.get_qpimage | def get_qpimage(self, idx):
"""Return background-corrected QPImage of data at index `idx`"""
if self._bgdata:
# The user has explicitly chosen different background data
# using `get_qpimage_raw`.
qpi = super(SeriesHdf5Qpimage, self).get_qpimage(idx)
else:
... | python | def get_qpimage(self, idx):
"""Return background-corrected QPImage of data at index `idx`"""
if self._bgdata:
# The user has explicitly chosen different background data
# using `get_qpimage_raw`.
qpi = super(SeriesHdf5Qpimage, self).get_qpimage(idx)
else:
... | ['def', 'get_qpimage', '(', 'self', ',', 'idx', ')', ':', 'if', 'self', '.', '_bgdata', ':', '# The user has explicitly chosen different background data', '# using `get_qpimage_raw`.', 'qpi', '=', 'super', '(', 'SeriesHdf5Qpimage', ',', 'self', ')', '.', 'get_qpimage', '(', 'idx', ')', 'else', ':', '# We can use the ba... | Return background-corrected QPImage of data at index `idx` | ['Return', 'background', '-', 'corrected', 'QPImage', 'of', 'data', 'at', 'index', 'idx'] | train | https://github.com/RI-imaging/qpformat/blob/364e29d7d9e8b9f1d7a4a25c753d1baf9d73d5eb/qpformat/file_formats/series_hdf5_qpimage.py#L32-L47 |
6,156 | empirical-org/Quill-NLP-Tools-and-Datasets | utils/qextract/qextract/utils.py | read_in_chunks | def read_in_chunks(file_object, chunk_size=CHUNK_SIZE):
"""Generator to read a file piece by piece."""
while True:
data = file_object.read(chunk_size)
if not data:
break
yield data | python | def read_in_chunks(file_object, chunk_size=CHUNK_SIZE):
"""Generator to read a file piece by piece."""
while True:
data = file_object.read(chunk_size)
if not data:
break
yield data | ['def', 'read_in_chunks', '(', 'file_object', ',', 'chunk_size', '=', 'CHUNK_SIZE', ')', ':', 'while', 'True', ':', 'data', '=', 'file_object', '.', 'read', '(', 'chunk_size', ')', 'if', 'not', 'data', ':', 'break', 'yield', 'data'] | Generator to read a file piece by piece. | ['Generator', 'to', 'read', 'a', 'file', 'piece', 'by', 'piece', '.'] | train | https://github.com/empirical-org/Quill-NLP-Tools-and-Datasets/blob/f2ff579ddf3a556d9cdc47c5f702422fa06863d9/utils/qextract/qextract/utils.py#L5-L11 |
6,157 | sirfoga/pyhal | hal/times/utils.py | Timing.parse_hh_mm_ss | def parse_hh_mm_ss(self):
"""Parses raw time
:return: Time parsed
"""
split_count = self.raw.count(":")
if split_count == 2: # hh:mm:ss
return datetime.strptime(str(self.raw).strip(), "%H:%M:%S").time()
elif split_count == 1: # mm:ss
return dat... | python | def parse_hh_mm_ss(self):
"""Parses raw time
:return: Time parsed
"""
split_count = self.raw.count(":")
if split_count == 2: # hh:mm:ss
return datetime.strptime(str(self.raw).strip(), "%H:%M:%S").time()
elif split_count == 1: # mm:ss
return dat... | ['def', 'parse_hh_mm_ss', '(', 'self', ')', ':', 'split_count', '=', 'self', '.', 'raw', '.', 'count', '(', '":"', ')', 'if', 'split_count', '==', '2', ':', '# hh:mm:ss', 'return', 'datetime', '.', 'strptime', '(', 'str', '(', 'self', '.', 'raw', ')', '.', 'strip', '(', ')', ',', '"%H:%M:%S"', ')', '.', 'time', '(', ')... | Parses raw time
:return: Time parsed | ['Parses', 'raw', 'time'] | train | https://github.com/sirfoga/pyhal/blob/4394d8a1f7e45bea28a255ec390f4962ee64d33a/hal/times/utils.py#L25-L37 |
6,158 | saltstack/salt | salt/fileclient.py | Client.is_cached | def is_cached(self, path, saltenv='base', cachedir=None):
'''
Returns the full path to a file if it is cached locally on the minion
otherwise returns a blank string
'''
if path.startswith('salt://'):
path, senv = salt.utils.url.parse(path)
if senv:
... | python | def is_cached(self, path, saltenv='base', cachedir=None):
'''
Returns the full path to a file if it is cached locally on the minion
otherwise returns a blank string
'''
if path.startswith('salt://'):
path, senv = salt.utils.url.parse(path)
if senv:
... | ['def', 'is_cached', '(', 'self', ',', 'path', ',', 'saltenv', '=', "'base'", ',', 'cachedir', '=', 'None', ')', ':', 'if', 'path', '.', 'startswith', '(', "'salt://'", ')', ':', 'path', ',', 'senv', '=', 'salt', '.', 'utils', '.', 'url', '.', 'parse', '(', 'path', ')', 'if', 'senv', ':', 'saltenv', '=', 'senv', 'escap... | Returns the full path to a file if it is cached locally on the minion
otherwise returns a blank string | ['Returns', 'the', 'full', 'path', 'to', 'a', 'file', 'if', 'it', 'is', 'cached', 'locally', 'on', 'the', 'minion', 'otherwise', 'returns', 'a', 'blank', 'string'] | train | https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/fileclient.py#L314-L342 |
6,159 | hardbyte/python-can | can/interfaces/virtual.py | VirtualBus._detect_available_configs | def _detect_available_configs():
"""
Returns all currently used channels as well as
one other currently unused channel.
.. note::
This method will run into problems if thousands of
autodetected busses are used at once.
"""
with channels_lock:
... | python | def _detect_available_configs():
"""
Returns all currently used channels as well as
one other currently unused channel.
.. note::
This method will run into problems if thousands of
autodetected busses are used at once.
"""
with channels_lock:
... | ['def', '_detect_available_configs', '(', ')', ':', 'with', 'channels_lock', ':', 'available_channels', '=', 'list', '(', 'channels', '.', 'keys', '(', ')', ')', '# find a currently unused channel', 'get_extra', '=', 'lambda', ':', '"channel-{}"', '.', 'format', '(', 'randint', '(', '0', ',', '9999', ')', ')', 'extra',... | Returns all currently used channels as well as
one other currently unused channel.
.. note::
This method will run into problems if thousands of
autodetected busses are used at once. | ['Returns', 'all', 'currently', 'used', 'channels', 'as', 'well', 'as', 'one', 'other', 'currently', 'unused', 'channel', '.'] | train | https://github.com/hardbyte/python-can/blob/cdc5254d96072df7739263623f3e920628a7d214/can/interfaces/virtual.py#L116-L141 |
6,160 | dsoprea/PySvn | svn/common.py | CommonClient.properties | def properties(self, rel_path=None):
""" Return a dictionary with all svn-properties associated with a
relative path.
:param rel_path: relative path in the svn repo to query the
properties from
:returns: a dictionary with the property name as key and the cont... | python | def properties(self, rel_path=None):
""" Return a dictionary with all svn-properties associated with a
relative path.
:param rel_path: relative path in the svn repo to query the
properties from
:returns: a dictionary with the property name as key and the cont... | ['def', 'properties', '(', 'self', ',', 'rel_path', '=', 'None', ')', ':', 'full_url_or_path', '=', 'self', '.', '__url_or_path', 'if', 'rel_path', 'is', 'not', 'None', ':', 'full_url_or_path', '+=', "'/'", '+', 'rel_path', 'result', '=', 'self', '.', 'run_command', '(', "'proplist'", ',', '[', "'--xml'", ',', 'full_ur... | Return a dictionary with all svn-properties associated with a
relative path.
:param rel_path: relative path in the svn repo to query the
properties from
:returns: a dictionary with the property name as key and the content
as value | ['Return', 'a', 'dictionary', 'with', 'all', 'svn', '-', 'properties', 'associated', 'with', 'a', 'relative', 'path', '.', ':', 'param', 'rel_path', ':', 'relative', 'path', 'in', 'the', 'svn', 'repo', 'to', 'query', 'the', 'properties', 'from', ':', 'returns', ':', 'a', 'dictionary', 'with', 'the', 'property', 'name',... | train | https://github.com/dsoprea/PySvn/blob/0c222a9a49b25d1fcfbc170ab9bc54288efe7f49/svn/common.py#L139-L176 |
6,161 | tjvr/kurt | kurt/__init__.py | Waveform.contents | def contents(self):
"""The raw file contents as a string."""
if not self._contents:
if self._path:
# Read file into memory so we don't run out of file descriptors
f = open(self._path, "rb")
self._contents = f.read()
f.close()
... | python | def contents(self):
"""The raw file contents as a string."""
if not self._contents:
if self._path:
# Read file into memory so we don't run out of file descriptors
f = open(self._path, "rb")
self._contents = f.read()
f.close()
... | ['def', 'contents', '(', 'self', ')', ':', 'if', 'not', 'self', '.', '_contents', ':', 'if', 'self', '.', '_path', ':', "# Read file into memory so we don't run out of file descriptors", 'f', '=', 'open', '(', 'self', '.', '_path', ',', '"rb"', ')', 'self', '.', '_contents', '=', 'f', '.', 'read', '(', ')', 'f', '.', '... | The raw file contents as a string. | ['The', 'raw', 'file', 'contents', 'as', 'a', 'string', '.'] | train | https://github.com/tjvr/kurt/blob/fcccd80cae11dc233f6dd02b40ec9a388c62f259/kurt/__init__.py#L2405-L2413 |
6,162 | sosreport/sos | sos/plugins/networking.py | Networking.collect_iptable | def collect_iptable(self, tablename):
""" When running the iptables command, it unfortunately auto-loads
the modules before trying to get output. Some people explicitly
don't want this, so check if the modules are loaded before running
the command. If they aren't loaded, there can't po... | python | def collect_iptable(self, tablename):
""" When running the iptables command, it unfortunately auto-loads
the modules before trying to get output. Some people explicitly
don't want this, so check if the modules are loaded before running
the command. If they aren't loaded, there can't po... | ['def', 'collect_iptable', '(', 'self', ',', 'tablename', ')', ':', 'modname', '=', '"iptable_"', '+', 'tablename', 'if', 'self', '.', 'check_ext_prog', '(', '"grep -q %s /proc/modules"', '%', 'modname', ')', ':', 'cmd', '=', '"iptables -t "', '+', 'tablename', '+', '" -nvL"', 'self', '.', 'add_cmd_output', '(', 'cmd',... | When running the iptables command, it unfortunately auto-loads
the modules before trying to get output. Some people explicitly
don't want this, so check if the modules are loaded before running
the command. If they aren't loaded, there can't possibly be any
relevant rules in that table | ['When', 'running', 'the', 'iptables', 'command', 'it', 'unfortunately', 'auto', '-', 'loads', 'the', 'modules', 'before', 'trying', 'to', 'get', 'output', '.', 'Some', 'people', 'explicitly', 'don', 't', 'want', 'this', 'so', 'check', 'if', 'the', 'modules', 'are', 'loaded', 'before', 'running', 'the', 'command', '.',... | train | https://github.com/sosreport/sos/blob/2ebc04da53dc871c8dd5243567afa4f8592dca29/sos/plugins/networking.py#L46-L56 |
6,163 | mosesschwartz/scrypture | scrypture/scrypture.py | run_script | def run_script(module_name):
'''Take script input (from script_input above), run the run() function, and
render the results in the appropriate template'''
filename = ''
file_stream = ''
if len(request.files) > 0:
# Get the name of the uploaded file
f = request.files['file_upload']
... | python | def run_script(module_name):
'''Take script input (from script_input above), run the run() function, and
render the results in the appropriate template'''
filename = ''
file_stream = ''
if len(request.files) > 0:
# Get the name of the uploaded file
f = request.files['file_upload']
... | ['def', 'run_script', '(', 'module_name', ')', ':', 'filename', '=', "''", 'file_stream', '=', "''", 'if', 'len', '(', 'request', '.', 'files', ')', '>', '0', ':', '# Get the name of the uploaded file', 'f', '=', 'request', '.', 'files', '[', "'file_upload'", ']', '# Make the filename safe, remove unsupported chars', '... | Take script input (from script_input above), run the run() function, and
render the results in the appropriate template | ['Take', 'script', 'input', '(', 'from', 'script_input', 'above', ')', 'run', 'the', 'run', '()', 'function', 'and', 'render', 'the', 'results', 'in', 'the', 'appropriate', 'template'] | train | https://github.com/mosesschwartz/scrypture/blob/d51eb0c9835a5122a655078268185ce8ab9ec86a/scrypture/scrypture.py#L186-L239 |
6,164 | python-diamond/Diamond | src/collectors/memcached_slab/memcached_slab.py | MemcachedSlabCollector.get_slab_stats | def get_slab_stats(self):
"""Retrieve slab stats from memcached."""
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((self.host, self.port))
s.send("stats slabs\n")
try:
data = ""
while True:
data += s.recv(4096)
... | python | def get_slab_stats(self):
"""Retrieve slab stats from memcached."""
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((self.host, self.port))
s.send("stats slabs\n")
try:
data = ""
while True:
data += s.recv(4096)
... | ['def', 'get_slab_stats', '(', 'self', ')', ':', 's', '=', 'socket', '.', 'socket', '(', 'socket', '.', 'AF_INET', ',', 'socket', '.', 'SOCK_STREAM', ')', 's', '.', 'connect', '(', '(', 'self', '.', 'host', ',', 'self', '.', 'port', ')', ')', 's', '.', 'send', '(', '"stats slabs\\n"', ')', 'try', ':', 'data', '=', '""'... | Retrieve slab stats from memcached. | ['Retrieve', 'slab', 'stats', 'from', 'memcached', '.'] | train | https://github.com/python-diamond/Diamond/blob/0f3eb04327d6d3ed5e53a9967d6c9d2c09714a47/src/collectors/memcached_slab/memcached_slab.py#L99-L112 |
6,165 | rameshg87/pyremotevbox | pyremotevbox/ZSI/parse.py | ParsedSoap.WhatMustIUnderstand | def WhatMustIUnderstand(self):
'''Return a list of (uri,localname) tuples for all elements in the
header that have mustUnderstand set.
'''
return [ ( E.namespaceURI, E.localName )
for E in self.header_elements if _find_mu(E) == "1" ] | python | def WhatMustIUnderstand(self):
'''Return a list of (uri,localname) tuples for all elements in the
header that have mustUnderstand set.
'''
return [ ( E.namespaceURI, E.localName )
for E in self.header_elements if _find_mu(E) == "1" ] | ['def', 'WhatMustIUnderstand', '(', 'self', ')', ':', 'return', '[', '(', 'E', '.', 'namespaceURI', ',', 'E', '.', 'localName', ')', 'for', 'E', 'in', 'self', '.', 'header_elements', 'if', '_find_mu', '(', 'E', ')', '==', '"1"', ']'] | Return a list of (uri,localname) tuples for all elements in the
header that have mustUnderstand set. | ['Return', 'a', 'list', 'of', '(', 'uri', 'localname', ')', 'tuples', 'for', 'all', 'elements', 'in', 'the', 'header', 'that', 'have', 'mustUnderstand', 'set', '.'] | train | https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/parse.py#L328-L333 |
6,166 | dropbox/stone | stone/frontend/ir_generator.py | IRGenerator._filter_namespaces_by_route_whitelist | def _filter_namespaces_by_route_whitelist(self):
"""
Given a parsed API in IR form, filter the user-defined datatypes
so that they include only the route datatypes and their direct dependencies.
"""
assert self._routes is not None, "Missing route whitelist"
assert 'route_... | python | def _filter_namespaces_by_route_whitelist(self):
"""
Given a parsed API in IR form, filter the user-defined datatypes
so that they include only the route datatypes and their direct dependencies.
"""
assert self._routes is not None, "Missing route whitelist"
assert 'route_... | ['def', '_filter_namespaces_by_route_whitelist', '(', 'self', ')', ':', 'assert', 'self', '.', '_routes', 'is', 'not', 'None', ',', '"Missing route whitelist"', 'assert', "'route_whitelist'", 'in', 'self', '.', '_routes', 'assert', "'datatype_whitelist'", 'in', 'self', '.', '_routes', '# Get route whitelist in canonica... | Given a parsed API in IR form, filter the user-defined datatypes
so that they include only the route datatypes and their direct dependencies. | ['Given', 'a', 'parsed', 'API', 'in', 'IR', 'form', 'filter', 'the', 'user', '-', 'defined', 'datatypes', 'so', 'that', 'they', 'include', 'only', 'the', 'route', 'datatypes', 'and', 'their', 'direct', 'dependencies', '.'] | train | https://github.com/dropbox/stone/blob/2e95cbcd1c48e05cca68c919fd8d24adec6b0f58/stone/frontend/ir_generator.py#L1537-L1637 |
6,167 | troeger/opensubmit | web/opensubmit/models/assignment.py | Assignment.has_perf_results | def has_perf_results(self):
'''
Figure out if any submission for this assignment has performance data being available.
'''
num_results = SubmissionTestResult.objects.filter(perf_data__isnull=False).filter(submission_file__submissions__assignment=self).count()
return num_resul... | python | def has_perf_results(self):
'''
Figure out if any submission for this assignment has performance data being available.
'''
num_results = SubmissionTestResult.objects.filter(perf_data__isnull=False).filter(submission_file__submissions__assignment=self).count()
return num_resul... | ['def', 'has_perf_results', '(', 'self', ')', ':', 'num_results', '=', 'SubmissionTestResult', '.', 'objects', '.', 'filter', '(', 'perf_data__isnull', '=', 'False', ')', '.', 'filter', '(', 'submission_file__submissions__assignment', '=', 'self', ')', '.', 'count', '(', ')', 'return', 'num_results', '!=', '0'] | Figure out if any submission for this assignment has performance data being available. | ['Figure', 'out', 'if', 'any', 'submission', 'for', 'this', 'assignment', 'has', 'performance', 'data', 'being', 'available', '.'] | train | https://github.com/troeger/opensubmit/blob/384a95b7c6fa41e3f949a129d25dafd9a1c54859/web/opensubmit/models/assignment.py#L87-L92 |
6,168 | krukas/Trionyx | trionyx/trionyx/views/core.py | UpdateDialog.display_dialog | def display_dialog(self, *args, **kwargs):
"""Display form and success message when set"""
form = kwargs.pop('form_instance', None)
success_message = kwargs.pop('success_message', None)
if not form:
form = self.get_form_class()(initial=kwargs, instance=self.object)
... | python | def display_dialog(self, *args, **kwargs):
"""Display form and success message when set"""
form = kwargs.pop('form_instance', None)
success_message = kwargs.pop('success_message', None)
if not form:
form = self.get_form_class()(initial=kwargs, instance=self.object)
... | ['def', 'display_dialog', '(', 'self', ',', '*', 'args', ',', '*', '*', 'kwargs', ')', ':', 'form', '=', 'kwargs', '.', 'pop', '(', "'form_instance'", ',', 'None', ')', 'success_message', '=', 'kwargs', '.', 'pop', '(', "'success_message'", ',', 'None', ')', 'if', 'not', 'form', ':', 'form', '=', 'self', '.', 'get_form... | Display form and success message when set | ['Display', 'form', 'and', 'success', 'message', 'when', 'set'] | train | https://github.com/krukas/Trionyx/blob/edac132cc0797190153f2e60bc7e88cb50e80da6/trionyx/trionyx/views/core.py#L802-L825 |
6,169 | Spinmob/spinmob | egg/_gui.py | GridLayout.set_row_stretch | def set_row_stretch(self, row=0, stretch=10):
"""
Sets the row stretch. Larger numbers mean it will expand more to fill
space.
"""
self._layout.setRowStretch(row, stretch)
return self | python | def set_row_stretch(self, row=0, stretch=10):
"""
Sets the row stretch. Larger numbers mean it will expand more to fill
space.
"""
self._layout.setRowStretch(row, stretch)
return self | ['def', 'set_row_stretch', '(', 'self', ',', 'row', '=', '0', ',', 'stretch', '=', '10', ')', ':', 'self', '.', '_layout', '.', 'setRowStretch', '(', 'row', ',', 'stretch', ')', 'return', 'self'] | Sets the row stretch. Larger numbers mean it will expand more to fill
space. | ['Sets', 'the', 'row', 'stretch', '.', 'Larger', 'numbers', 'mean', 'it', 'will', 'expand', 'more', 'to', 'fill', 'space', '.'] | train | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/egg/_gui.py#L447-L453 |
6,170 | PMBio/limix-backup | limix/mtSet/core/simulator.py | CSimulator.genHidden | def genHidden(self,nHidden=10,vTot=0.5,vCommon=0.1):
""" generate """
vSpecific = vTot-vCommon
# generate hidden
X = self.genWeights(self.N,nHidden)
# common effect
H = self.genWeights(nHidden,self.P)
Bc = SP.dot(H,self.genTraitEffect())
Yc = SP.dot(X... | python | def genHidden(self,nHidden=10,vTot=0.5,vCommon=0.1):
""" generate """
vSpecific = vTot-vCommon
# generate hidden
X = self.genWeights(self.N,nHidden)
# common effect
H = self.genWeights(nHidden,self.P)
Bc = SP.dot(H,self.genTraitEffect())
Yc = SP.dot(X... | ['def', 'genHidden', '(', 'self', ',', 'nHidden', '=', '10', ',', 'vTot', '=', '0.5', ',', 'vCommon', '=', '0.1', ')', ':', 'vSpecific', '=', 'vTot', '-', 'vCommon', '# generate hidden', 'X', '=', 'self', '.', 'genWeights', '(', 'self', '.', 'N', ',', 'nHidden', ')', '# common effect', 'H', '=', 'self', '.', 'genWeight... | generate | ['generate'] | train | https://github.com/PMBio/limix-backup/blob/1e201fdb5c694d0d5506f207f3de65d8ef66146c/limix/mtSet/core/simulator.py#L257-L276 |
6,171 | DAI-Lab/Copulas | copulas/multivariate/tree.py | Tree.get_likelihood | def get_likelihood(self, uni_matrix):
"""Compute likelihood of the tree given an U matrix.
Args:
uni_matrix(numpy.array): univariate matrix to evaluate likelihood on.
Returns:
tuple[float, numpy.array]:
likelihood of the current tree, next level conditio... | python | def get_likelihood(self, uni_matrix):
"""Compute likelihood of the tree given an U matrix.
Args:
uni_matrix(numpy.array): univariate matrix to evaluate likelihood on.
Returns:
tuple[float, numpy.array]:
likelihood of the current tree, next level conditio... | ['def', 'get_likelihood', '(', 'self', ',', 'uni_matrix', ')', ':', 'uni_dim', '=', 'uni_matrix', '.', 'shape', '[', '1', ']', 'num_edge', '=', 'len', '(', 'self', '.', 'edges', ')', 'values', '=', 'np', '.', 'zeros', '(', '[', '1', ',', 'num_edge', ']', ')', 'new_uni_matrix', '=', 'np', '.', 'empty', '(', '[', 'uni_di... | Compute likelihood of the tree given an U matrix.
Args:
uni_matrix(numpy.array): univariate matrix to evaluate likelihood on.
Returns:
tuple[float, numpy.array]:
likelihood of the current tree, next level conditional univariate matrix | ['Compute', 'likelihood', 'of', 'the', 'tree', 'given', 'an', 'U', 'matrix', '.'] | train | https://github.com/DAI-Lab/Copulas/blob/821df61c3d36a6b81ef2883935f935c2eaaa862c/copulas/multivariate/tree.py#L213-L235 |
6,172 | BerkeleyAutomation/visualization | visualization/visualizer3d.py | Visualizer3D.render | def render(n_frames=1, axis=np.array([0.,0.,1.]), clf=True, **kwargs):
"""Render frames from the viewer.
Parameters
----------
n_frames : int
Number of frames to render. If more than one, the scene will animate.
axis : (3,) float or None
If present, the a... | python | def render(n_frames=1, axis=np.array([0.,0.,1.]), clf=True, **kwargs):
"""Render frames from the viewer.
Parameters
----------
n_frames : int
Number of frames to render. If more than one, the scene will animate.
axis : (3,) float or None
If present, the a... | ['def', 'render', '(', 'n_frames', '=', '1', ',', 'axis', '=', 'np', '.', 'array', '(', '[', '0.', ',', '0.', ',', '1.', ']', ')', ',', 'clf', '=', 'True', ',', '*', '*', 'kwargs', ')', ':', 'v', '=', 'SceneViewer', '(', 'Visualizer3D', '.', '_scene', ',', 'size', '=', 'Visualizer3D', '.', '_init_size', ',', 'animate',... | Render frames from the viewer.
Parameters
----------
n_frames : int
Number of frames to render. If more than one, the scene will animate.
axis : (3,) float or None
If present, the animation will rotate about the given axis in world coordinates.
Otherw... | ['Render', 'frames', 'from', 'the', 'viewer', '.'] | train | https://github.com/BerkeleyAutomation/visualization/blob/f8d038cc65c78f841ef27f99fb2a638f44fa72b6/visualization/visualizer3d.py#L76-L106 |
6,173 | DoWhileGeek/authentise-services | authentise_services/config.py | Config.parse_config | def parse_config(path):
"""parse either the config file we found, or use some canned defaults"""
config = configparser.ConfigParser()
if path: # if user has config with user creds in it, this will grab it
config.read(path)
try:
return {k: v for k, v in config["... | python | def parse_config(path):
"""parse either the config file we found, or use some canned defaults"""
config = configparser.ConfigParser()
if path: # if user has config with user creds in it, this will grab it
config.read(path)
try:
return {k: v for k, v in config["... | ['def', 'parse_config', '(', 'path', ')', ':', 'config', '=', 'configparser', '.', 'ConfigParser', '(', ')', 'if', 'path', ':', '# if user has config with user creds in it, this will grab it', 'config', '.', 'read', '(', 'path', ')', 'try', ':', 'return', '{', 'k', ':', 'v', 'for', 'k', ',', 'v', 'in', 'config', '[', '... | parse either the config file we found, or use some canned defaults | ['parse', 'either', 'the', 'config', 'file', 'we', 'found', 'or', 'use', 'some', 'canned', 'defaults'] | train | https://github.com/DoWhileGeek/authentise-services/blob/ee32bd7f7de15d3fb24c0a6374640d3a1ec8096d/authentise_services/config.py#L25-L35 |
6,174 | couchbase/couchbase-python-client | couchbase/admin.py | Admin.user_remove | def user_remove(self, domain, userid):
"""
Remove a user
:param AuthDomain domain: The authentication domain for the user.
:param userid: The user ID to remove
:raise: :exc:`couchbase.exceptions.HTTPError` if the user does not exist.
:return: :class:`~.HttpResult`
... | python | def user_remove(self, domain, userid):
"""
Remove a user
:param AuthDomain domain: The authentication domain for the user.
:param userid: The user ID to remove
:raise: :exc:`couchbase.exceptions.HTTPError` if the user does not exist.
:return: :class:`~.HttpResult`
... | ['def', 'user_remove', '(', 'self', ',', 'domain', ',', 'userid', ')', ':', 'path', '=', 'self', '.', '_get_management_path', '(', 'domain', ',', 'userid', ')', 'return', 'self', '.', 'http_request', '(', 'path', '=', 'path', ',', 'method', '=', "'DELETE'", ')'] | Remove a user
:param AuthDomain domain: The authentication domain for the user.
:param userid: The user ID to remove
:raise: :exc:`couchbase.exceptions.HTTPError` if the user does not exist.
:return: :class:`~.HttpResult` | ['Remove', 'a', 'user', ':', 'param', 'AuthDomain', 'domain', ':', 'The', 'authentication', 'domain', 'for', 'the', 'user', '.', ':', 'param', 'userid', ':', 'The', 'user', 'ID', 'to', 'remove', ':', 'raise', ':', ':', 'exc', ':', 'couchbase', '.', 'exceptions', '.', 'HTTPError', 'if', 'the', 'user', 'does', 'not', 'ex... | train | https://github.com/couchbase/couchbase-python-client/blob/a7bada167785bf79a29c39f820d932a433a6a535/couchbase/admin.py#L431-L441 |
6,175 | gwastro/pycbc | pycbc/strain/gate.py | add_gate_option_group | def add_gate_option_group(parser):
"""Adds the options needed to apply gates to data.
Parameters
----------
parser : object
ArgumentParser instance.
"""
gate_group = parser.add_argument_group("Options for gating data.")
gate_group.add_argument("--gate", nargs="+", type=str,
... | python | def add_gate_option_group(parser):
"""Adds the options needed to apply gates to data.
Parameters
----------
parser : object
ArgumentParser instance.
"""
gate_group = parser.add_argument_group("Options for gating data.")
gate_group.add_argument("--gate", nargs="+", type=str,
... | ['def', 'add_gate_option_group', '(', 'parser', ')', ':', 'gate_group', '=', 'parser', '.', 'add_argument_group', '(', '"Options for gating data."', ')', 'gate_group', '.', 'add_argument', '(', '"--gate"', ',', 'nargs', '=', '"+"', ',', 'type', '=', 'str', ',', 'metavar', '=', '"IFO:CENTRALTIME:HALFDUR:TAPERDUR"', ',',... | Adds the options needed to apply gates to data.
Parameters
----------
parser : object
ArgumentParser instance. | ['Adds', 'the', 'options', 'needed', 'to', 'apply', 'gates', 'to', 'data', '.'] | train | https://github.com/gwastro/pycbc/blob/7a64cdd104d263f1b6ea0b01e6841837d05a4cb3/pycbc/strain/gate.py#L114-L139 |
6,176 | quantum5/2048 | _2048/game.py | Game2048._is_in_try_again | def _is_in_try_again(self, x, y):
"""Checks if the game is to be restarted."""
if self.won == 1:
# Checks if in try button on won screen.
x1, y1, x2, y2 = self._won_try_again
return x1 <= x < x2 and y1 <= y < y2
elif self.lost:
# Checks if in try b... | python | def _is_in_try_again(self, x, y):
"""Checks if the game is to be restarted."""
if self.won == 1:
# Checks if in try button on won screen.
x1, y1, x2, y2 = self._won_try_again
return x1 <= x < x2 and y1 <= y < y2
elif self.lost:
# Checks if in try b... | ['def', '_is_in_try_again', '(', 'self', ',', 'x', ',', 'y', ')', ':', 'if', 'self', '.', 'won', '==', '1', ':', '# Checks if in try button on won screen.', 'x1', ',', 'y1', ',', 'x2', ',', 'y2', '=', 'self', '.', '_won_try_again', 'return', 'x1', '<=', 'x', '<', 'x2', 'and', 'y1', '<=', 'y', '<', 'y2', 'elif', 'self',... | Checks if the game is to be restarted. | ['Checks', 'if', 'the', 'game', 'is', 'to', 'be', 'restarted', '.'] | train | https://github.com/quantum5/2048/blob/93ada2e3026eaf154e1bbee943d0500c9253e66f/_2048/game.py#L242-L253 |
6,177 | log2timeline/dfvfs | dfvfs/lib/data_format.py | DataFormat._ReadString | def _ReadString(
self, file_object, file_offset, data_type_map, description):
"""Reads a string.
Args:
file_object (FileIO): file-like object.
file_offset (int): offset of the data relative from the start of
the file-like object.
data_type_map (dtfabric.DataTypeMap): data type... | python | def _ReadString(
self, file_object, file_offset, data_type_map, description):
"""Reads a string.
Args:
file_object (FileIO): file-like object.
file_offset (int): offset of the data relative from the start of
the file-like object.
data_type_map (dtfabric.DataTypeMap): data type... | ['def', '_ReadString', '(', 'self', ',', 'file_object', ',', 'file_offset', ',', 'data_type_map', ',', 'description', ')', ':', '# pylint: disable=protected-access', 'element_data_size', '=', '(', 'data_type_map', '.', '_element_data_type_definition', '.', 'GetByteSize', '(', ')', ')', 'elements_terminator', '=', '(', ... | Reads a string.
Args:
file_object (FileIO): file-like object.
file_offset (int): offset of the data relative from the start of
the file-like object.
data_type_map (dtfabric.DataTypeMap): data type map of the string.
description (str): description of the string.
Returns:
... | ['Reads', 'a', 'string', '.'] | train | https://github.com/log2timeline/dfvfs/blob/2b3ccd115f9901d89f383397d4a1376a873c83c4/dfvfs/lib/data_format.py#L56-L91 |
6,178 | phaethon/kamene | kamene/contrib/gsm_um.py | routingAreaUpdateAccept | def routingAreaUpdateAccept(PTmsiSignature_presence=0,
MobileId_presence=0, MobileId_presence1=0,
ReceiveNpduNumbersList_presence=0,
GprsTimer_presence=0, GmmCause_presence=0):
"""ROUTING AREA UPDATE ACCEPT Section 9.4.15"""
a =... | python | def routingAreaUpdateAccept(PTmsiSignature_presence=0,
MobileId_presence=0, MobileId_presence1=0,
ReceiveNpduNumbersList_presence=0,
GprsTimer_presence=0, GmmCause_presence=0):
"""ROUTING AREA UPDATE ACCEPT Section 9.4.15"""
a =... | ['def', 'routingAreaUpdateAccept', '(', 'PTmsiSignature_presence', '=', '0', ',', 'MobileId_presence', '=', '0', ',', 'MobileId_presence1', '=', '0', ',', 'ReceiveNpduNumbersList_presence', '=', '0', ',', 'GprsTimer_presence', '=', '0', ',', 'GmmCause_presence', '=', '0', ')', ':', 'a', '=', 'TpPd', '(', 'pd', '=', '0x... | ROUTING AREA UPDATE ACCEPT Section 9.4.15 | ['ROUTING', 'AREA', 'UPDATE', 'ACCEPT', 'Section', '9', '.', '4', '.', '15'] | train | https://github.com/phaethon/kamene/blob/11d4064844f4f68ac5d7546f5633ac7d02082914/kamene/contrib/gsm_um.py#L2537-L2566 |
6,179 | datamachine/twx.botapi | twx/botapi/botapi.py | TelegramBot.set_chat_photo | def set_chat_photo(self, *args, **kwargs):
"""See :func:`set_chat_photo`"""
return set_chat_photo(*args, **self._merge_overrides(**kwargs)).run() | python | def set_chat_photo(self, *args, **kwargs):
"""See :func:`set_chat_photo`"""
return set_chat_photo(*args, **self._merge_overrides(**kwargs)).run() | ['def', 'set_chat_photo', '(', 'self', ',', '*', 'args', ',', '*', '*', 'kwargs', ')', ':', 'return', 'set_chat_photo', '(', '*', 'args', ',', '*', '*', 'self', '.', '_merge_overrides', '(', '*', '*', 'kwargs', ')', ')', '.', 'run', '(', ')'] | See :func:`set_chat_photo` | ['See', ':', 'func', ':', 'set_chat_photo'] | train | https://github.com/datamachine/twx.botapi/blob/c85184da738169e8f9d6d8e62970540f427c486e/twx/botapi/botapi.py#L4266-L4268 |
6,180 | mivade/tornadose | tornadose/handlers.py | WebSocketSubscriber.publish | async def publish(self, message):
"""Push a new message to the client. The data will be
available as a JSON object with the key ``data``.
"""
try:
self.write_message(dict(data=message))
except WebSocketClosedError:
self._close() | python | async def publish(self, message):
"""Push a new message to the client. The data will be
available as a JSON object with the key ``data``.
"""
try:
self.write_message(dict(data=message))
except WebSocketClosedError:
self._close() | ['async', 'def', 'publish', '(', 'self', ',', 'message', ')', ':', 'try', ':', 'self', '.', 'write_message', '(', 'dict', '(', 'data', '=', 'message', ')', ')', 'except', 'WebSocketClosedError', ':', 'self', '.', '_close', '(', ')'] | Push a new message to the client. The data will be
available as a JSON object with the key ``data``. | ['Push', 'a', 'new', 'message', 'to', 'the', 'client', '.', 'The', 'data', 'will', 'be', 'available', 'as', 'a', 'JSON', 'object', 'with', 'the', 'key', 'data', '.'] | train | https://github.com/mivade/tornadose/blob/d220e0e3040d24c98997eee7a8a236602b4c5159/tornadose/handlers.py#L116-L124 |
6,181 | jlmadurga/permabots | permabots/views/api/hook.py | HookDetail.get | def get(self, request, bot_id, id, format=None):
"""
Get hook by id
---
serializer: HookSerializer
responseMessages:
- code: 401
message: Not authenticated
"""
return super(HookDetail, self).get(request, bot_id, id, format) | python | def get(self, request, bot_id, id, format=None):
"""
Get hook by id
---
serializer: HookSerializer
responseMessages:
- code: 401
message: Not authenticated
"""
return super(HookDetail, self).get(request, bot_id, id, format) | ['def', 'get', '(', 'self', ',', 'request', ',', 'bot_id', ',', 'id', ',', 'format', '=', 'None', ')', ':', 'return', 'super', '(', 'HookDetail', ',', 'self', ')', '.', 'get', '(', 'request', ',', 'bot_id', ',', 'id', ',', 'format', ')'] | Get hook by id
---
serializer: HookSerializer
responseMessages:
- code: 401
message: Not authenticated | ['Get', 'hook', 'by', 'id', '---', 'serializer', ':', 'HookSerializer', 'responseMessages', ':', '-', 'code', ':', '401', 'message', ':', 'Not', 'authenticated'] | train | https://github.com/jlmadurga/permabots/blob/781a91702529a23fe7bc2aa84c5d88e961412466/permabots/views/api/hook.py#L60-L69 |
6,182 | fedora-infra/fmn.rules | fmn/rules/taskotron.py | taskotron_task_particular_or_changed_outcome | def taskotron_task_particular_or_changed_outcome(config, message,
outcome='FAILED,NEEDS_INSPECTION'):
""" Taskotron task any particular or changed outcome(s)
With this rule, you can limit messages to only those task results
with any particular outcome(s) (FA... | python | def taskotron_task_particular_or_changed_outcome(config, message,
outcome='FAILED,NEEDS_INSPECTION'):
""" Taskotron task any particular or changed outcome(s)
With this rule, you can limit messages to only those task results
with any particular outcome(s) (FA... | ['def', 'taskotron_task_particular_or_changed_outcome', '(', 'config', ',', 'message', ',', 'outcome', '=', "'FAILED,NEEDS_INSPECTION'", ')', ':', 'return', 'taskotron_task_outcome', '(', 'config', ',', 'message', ',', 'outcome', ')', 'or', 'taskotron_changed_outcome', '(', 'config', ',', 'message', ')'] | Taskotron task any particular or changed outcome(s)
With this rule, you can limit messages to only those task results
with any particular outcome(s) (FAILED and NEEDS_INSPECTION by default)
or those with changed outcomes. This rule is a handy way of filtering
a very useful use case - being notified whe... | ['Taskotron', 'task', 'any', 'particular', 'or', 'changed', 'outcome', '(', 's', ')'] | train | https://github.com/fedora-infra/fmn.rules/blob/f9ec790619fcc8b41803077c4dec094e5127fc24/fmn/rules/taskotron.py#L84-L104 |
6,183 | log2timeline/dfdatetime | dfdatetime/interface.py | DateTimeValues._GetDayOfYear | def _GetDayOfYear(self, year, month, day_of_month):
"""Retrieves the day of the year for a specific day of a month in a year.
Args:
year (int): year e.g. 1970.
month (int): month, where 1 represents January.
day_of_month (int): day of the month, where 1 represents the first day.
Returns:... | python | def _GetDayOfYear(self, year, month, day_of_month):
"""Retrieves the day of the year for a specific day of a month in a year.
Args:
year (int): year e.g. 1970.
month (int): month, where 1 represents January.
day_of_month (int): day of the month, where 1 represents the first day.
Returns:... | ['def', '_GetDayOfYear', '(', 'self', ',', 'year', ',', 'month', ',', 'day_of_month', ')', ':', 'if', 'month', 'not', 'in', 'range', '(', '1', ',', '13', ')', ':', 'raise', 'ValueError', '(', "'Month value out of bounds.'", ')', 'days_per_month', '=', 'self', '.', '_GetDaysPerMonth', '(', 'year', ',', 'month', ')', 'if... | Retrieves the day of the year for a specific day of a month in a year.
Args:
year (int): year e.g. 1970.
month (int): month, where 1 represents January.
day_of_month (int): day of the month, where 1 represents the first day.
Returns:
int: day of year.
Raises:
ValueError: if ... | ['Retrieves', 'the', 'day', 'of', 'the', 'year', 'for', 'a', 'specific', 'day', 'of', 'a', 'month', 'in', 'a', 'year', '.'] | train | https://github.com/log2timeline/dfdatetime/blob/141ca4ef1eff3d354b5deaac3d81cb08506f98d6/dfdatetime/interface.py#L644-L669 |
6,184 | raamana/pyradigm | pyradigm/pyradigm.py | check_compatibility | def check_compatibility(datasets, reqd_num_features=None):
"""
Checks whether the given MLdataset instances are compatible
i.e. with same set of subjects, each beloning to the same class in all instances.
Checks the first dataset in the list against the rest, and returns a boolean array.
Paramete... | python | def check_compatibility(datasets, reqd_num_features=None):
"""
Checks whether the given MLdataset instances are compatible
i.e. with same set of subjects, each beloning to the same class in all instances.
Checks the first dataset in the list against the rest, and returns a boolean array.
Paramete... | ['def', 'check_compatibility', '(', 'datasets', ',', 'reqd_num_features', '=', 'None', ')', ':', 'from', 'collections', 'import', 'Iterable', 'if', 'not', 'isinstance', '(', 'datasets', ',', 'Iterable', ')', ':', 'raise', 'TypeError', '(', "'Input must be an iterable '", "'i.e. (list/tuple) of MLdataset/similar instanc... | Checks whether the given MLdataset instances are compatible
i.e. with same set of subjects, each beloning to the same class in all instances.
Checks the first dataset in the list against the rest, and returns a boolean array.
Parameters
----------
datasets : Iterable
A list of n datasets
... | ['Checks', 'whether', 'the', 'given', 'MLdataset', 'instances', 'are', 'compatible'] | train | https://github.com/raamana/pyradigm/blob/8ffb7958329c88b09417087b86887a3c92f438c2/pyradigm/pyradigm.py#L1480-L1573 |
6,185 | atlassian-api/atlassian-python-api | atlassian/bitbucket.py | Bitbucket.disable_branching_model | def disable_branching_model(self, project, repository):
"""
Disable branching model
:param project:
:param repository:
:return:
"""
url = 'rest/branch-utils/1.0/projects/{project}/repos/{repository}/branchmodel/configuration'.format(
project=project,
... | python | def disable_branching_model(self, project, repository):
"""
Disable branching model
:param project:
:param repository:
:return:
"""
url = 'rest/branch-utils/1.0/projects/{project}/repos/{repository}/branchmodel/configuration'.format(
project=project,
... | ['def', 'disable_branching_model', '(', 'self', ',', 'project', ',', 'repository', ')', ':', 'url', '=', "'rest/branch-utils/1.0/projects/{project}/repos/{repository}/branchmodel/configuration'", '.', 'format', '(', 'project', '=', 'project', ',', 'repository', '=', 'repository', ')', 'return', 'self', '.', 'delete', '... | Disable branching model
:param project:
:param repository:
:return: | ['Disable', 'branching', 'model', ':', 'param', 'project', ':', ':', 'param', 'repository', ':', ':', 'return', ':'] | train | https://github.com/atlassian-api/atlassian-python-api/blob/540d269905c3e7547b666fe30c647b2d512cf358/atlassian/bitbucket.py#L866-L876 |
6,186 | django-cumulus/django-cumulus | cumulus/storage.py | sync_headers | def sync_headers(cloud_obj, headers=None, header_patterns=HEADER_PATTERNS):
"""
Overwrites the given cloud_obj's headers with the ones given as ``headers`
and adds additional headers as defined in the HEADERS setting depending on
the cloud_obj's file name.
"""
if headers is None:
headers... | python | def sync_headers(cloud_obj, headers=None, header_patterns=HEADER_PATTERNS):
"""
Overwrites the given cloud_obj's headers with the ones given as ``headers`
and adds additional headers as defined in the HEADERS setting depending on
the cloud_obj's file name.
"""
if headers is None:
headers... | ['def', 'sync_headers', '(', 'cloud_obj', ',', 'headers', '=', 'None', ',', 'header_patterns', '=', 'HEADER_PATTERNS', ')', ':', 'if', 'headers', 'is', 'None', ':', 'headers', '=', '{', '}', "# don't set headers on directories", 'content_type', '=', 'getattr', '(', 'cloud_obj', ',', '"content_type"', ',', 'None', ')', ... | Overwrites the given cloud_obj's headers with the ones given as ``headers`
and adds additional headers as defined in the HEADERS setting depending on
the cloud_obj's file name. | ['Overwrites', 'the', 'given', 'cloud_obj', 's', 'headers', 'with', 'the', 'ones', 'given', 'as', 'headers', 'and', 'adds', 'additional', 'headers', 'as', 'defined', 'in', 'the', 'HEADERS', 'setting', 'depending', 'on', 'the', 'cloud_obj', 's', 'file', 'name', '.'] | train | https://github.com/django-cumulus/django-cumulus/blob/64feb07b857af28f226be4899e875c29405e261d/cumulus/storage.py#L67-L90 |
6,187 | wonambi-python/wonambi | wonambi/widgets/utils.py | FormMenu.get_value | def get_value(self, default=None):
"""Get selection from widget.
Parameters
----------
default : str
str for use by widget
Returns
-------
str
selected item from the combobox
"""
if default is None:
default = ... | python | def get_value(self, default=None):
"""Get selection from widget.
Parameters
----------
default : str
str for use by widget
Returns
-------
str
selected item from the combobox
"""
if default is None:
default = ... | ['def', 'get_value', '(', 'self', ',', 'default', '=', 'None', ')', ':', 'if', 'default', 'is', 'None', ':', 'default', '=', "''", 'try', ':', 'text', '=', 'self', '.', 'currentText', '(', ')', 'except', 'ValueError', ':', 'lg', '.', 'debug', '(', '\'Cannot convert "\'', '+', 'str', '(', 'text', ')', '+', '\'" to list.... | Get selection from widget.
Parameters
----------
default : str
str for use by widget
Returns
-------
str
selected item from the combobox | ['Get', 'selection', 'from', 'widget', '.'] | train | https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/widgets/utils.py#L572-L598 |
6,188 | sacrud/sacrud | sacrud/action.py | CRUD.update | def update(self, pk, data, **kwargs):
"""
Updates the object by primary_key:
.. code-block:: python
DBSession.sacrud(Users).update(1, {'name': 'Petya'})
DBSession.sacrud(Users).update('1', {'name': 'Petya'})
DBSession.sacrud(User2Groups).update({'user_id': 4... | python | def update(self, pk, data, **kwargs):
"""
Updates the object by primary_key:
.. code-block:: python
DBSession.sacrud(Users).update(1, {'name': 'Petya'})
DBSession.sacrud(Users).update('1', {'name': 'Petya'})
DBSession.sacrud(User2Groups).update({'user_id': 4... | ['def', 'update', '(', 'self', ',', 'pk', ',', 'data', ',', '*', '*', 'kwargs', ')', ':', 'pk', '=', 'unjson', '(', 'pk', ')', 'data', '=', 'unjson', '(', 'data', ')', 'obj', '=', 'get_obj', '(', 'self', '.', 'session', ',', 'self', '.', 'table', ',', 'pk', ')', 'return', 'self', '.', '_add', '(', 'obj', ',', 'data', '... | Updates the object by primary_key:
.. code-block:: python
DBSession.sacrud(Users).update(1, {'name': 'Petya'})
DBSession.sacrud(Users).update('1', {'name': 'Petya'})
DBSession.sacrud(User2Groups).update({'user_id': 4, 'group_id': 2},
... | ['Updates', 'the', 'object', 'by', 'primary_key', ':'] | train | https://github.com/sacrud/sacrud/blob/40dcbb22083cb1ad4c1f626843397b89c2ce18f5/sacrud/action.py#L119-L146 |
6,189 | raiden-network/raiden | raiden/network/rpc/client.py | patched_web3_eth_estimate_gas | def patched_web3_eth_estimate_gas(self, transaction, block_identifier=None):
""" Temporary workaround until next web3.py release (5.X.X)
Current master of web3.py has this implementation already:
https://github.com/ethereum/web3.py/blob/2a67ea9f0ab40bb80af2b803dce742d6cad5943e/web3/eth.py#L311
"""
... | python | def patched_web3_eth_estimate_gas(self, transaction, block_identifier=None):
""" Temporary workaround until next web3.py release (5.X.X)
Current master of web3.py has this implementation already:
https://github.com/ethereum/web3.py/blob/2a67ea9f0ab40bb80af2b803dce742d6cad5943e/web3/eth.py#L311
"""
... | ['def', 'patched_web3_eth_estimate_gas', '(', 'self', ',', 'transaction', ',', 'block_identifier', '=', 'None', ')', ':', 'if', "'from'", 'not', 'in', 'transaction', 'and', 'is_checksum_address', '(', 'self', '.', 'defaultAccount', ')', ':', 'transaction', '=', 'assoc', '(', 'transaction', ',', "'from'", ',', 'self', '... | Temporary workaround until next web3.py release (5.X.X)
Current master of web3.py has this implementation already:
https://github.com/ethereum/web3.py/blob/2a67ea9f0ab40bb80af2b803dce742d6cad5943e/web3/eth.py#L311 | ['Temporary', 'workaround', 'until', 'next', 'web3', '.', 'py', 'release', '(', '5', '.', 'X', '.', 'X', ')'] | train | https://github.com/raiden-network/raiden/blob/407ba15c72074e9de88771d6b9661ff4dc36bef5/raiden/network/rpc/client.py#L298-L324 |
6,190 | vtkiorg/vtki | vtki/plotting.py | system_supports_plotting | def system_supports_plotting():
"""
Check if x server is running
Returns
-------
system_supports_plotting : bool
True when on Linux and running an xserver. Returns None when
on a non-linux platform.
"""
try:
if os.environ['ALLOW_PLOTTING'].lower() == 'true':
... | python | def system_supports_plotting():
"""
Check if x server is running
Returns
-------
system_supports_plotting : bool
True when on Linux and running an xserver. Returns None when
on a non-linux platform.
"""
try:
if os.environ['ALLOW_PLOTTING'].lower() == 'true':
... | ['def', 'system_supports_plotting', '(', ')', ':', 'try', ':', 'if', 'os', '.', 'environ', '[', "'ALLOW_PLOTTING'", ']', '.', 'lower', '(', ')', '==', "'true'", ':', 'return', 'True', 'except', 'KeyError', ':', 'pass', 'try', ':', 'p', '=', 'Popen', '(', '[', '"xset"', ',', '"-q"', ']', ',', 'stdout', '=', 'PIPE', ',',... | Check if x server is running
Returns
-------
system_supports_plotting : bool
True when on Linux and running an xserver. Returns None when
on a non-linux platform. | ['Check', 'if', 'x', 'server', 'is', 'running'] | train | https://github.com/vtkiorg/vtki/blob/5ccad7ae6d64a03e9594c9c7474c8aab3eb22dd1/vtki/plotting.py#L287-L308 |
6,191 | Microsoft/azure-devops-python-api | azure-devops/azure/devops/v5_1/cix/cix_client.py | CixClient.render_template | def render_template(self, template_parameters, template_id):
"""RenderTemplate.
[Preview API]
:param :class:`<TemplateParameters> <azure.devops.v5_1.cix.models.TemplateParameters>` template_parameters:
:param str template_id:
:rtype: :class:`<Template> <azure.devops.v5_1.cix.mode... | python | def render_template(self, template_parameters, template_id):
"""RenderTemplate.
[Preview API]
:param :class:`<TemplateParameters> <azure.devops.v5_1.cix.models.TemplateParameters>` template_parameters:
:param str template_id:
:rtype: :class:`<Template> <azure.devops.v5_1.cix.mode... | ['def', 'render_template', '(', 'self', ',', 'template_parameters', ',', 'template_id', ')', ':', 'route_values', '=', '{', '}', 'if', 'template_id', 'is', 'not', 'None', ':', 'route_values', '[', "'templateId'", ']', '=', 'self', '.', '_serialize', '.', 'url', '(', "'template_id'", ',', 'template_id', ',', "'str'", ')... | RenderTemplate.
[Preview API]
:param :class:`<TemplateParameters> <azure.devops.v5_1.cix.models.TemplateParameters>` template_parameters:
:param str template_id:
:rtype: :class:`<Template> <azure.devops.v5_1.cix.models.Template>` | ['RenderTemplate', '.', '[', 'Preview', 'API', ']', ':', 'param', ':', 'class', ':', '<TemplateParameters', '>', '<azure', '.', 'devops', '.', 'v5_1', '.', 'cix', '.', 'models', '.', 'TemplateParameters', '>', 'template_parameters', ':', ':', 'param', 'str', 'template_id', ':', ':', 'rtype', ':', ':', 'class', ':', '<T... | train | https://github.com/Microsoft/azure-devops-python-api/blob/4777ffda2f5052fabbaddb2abe9cb434e0cf1aa8/azure-devops/azure/devops/v5_1/cix/cix_client.py#L154-L170 |
6,192 | hannes-brt/hebel | hebel/pycuda_ops/cublas.py | cublasDsyr2 | def cublasDsyr2(handle, uplo, n, alpha, x, incx, y, incy, A, lda):
"""
Rank-2 operation on real symmetric matrix.
"""
status = _libcublas.cublasDsyr2_v2(handle,
_CUBLAS_FILL_MODE[uplo], n,
ctypes.byref(ctypes.c_double(alph... | python | def cublasDsyr2(handle, uplo, n, alpha, x, incx, y, incy, A, lda):
"""
Rank-2 operation on real symmetric matrix.
"""
status = _libcublas.cublasDsyr2_v2(handle,
_CUBLAS_FILL_MODE[uplo], n,
ctypes.byref(ctypes.c_double(alph... | ['def', 'cublasDsyr2', '(', 'handle', ',', 'uplo', ',', 'n', ',', 'alpha', ',', 'x', ',', 'incx', ',', 'y', ',', 'incy', ',', 'A', ',', 'lda', ')', ':', 'status', '=', '_libcublas', '.', 'cublasDsyr2_v2', '(', 'handle', ',', '_CUBLAS_FILL_MODE', '[', 'uplo', ']', ',', 'n', ',', 'ctypes', '.', 'byref', '(', 'ctypes', '.... | Rank-2 operation on real symmetric matrix. | ['Rank', '-', '2', 'operation', 'on', 'real', 'symmetric', 'matrix', '.'] | train | https://github.com/hannes-brt/hebel/blob/1e2c3a9309c2646103901b26a55be4e312dd5005/hebel/pycuda_ops/cublas.py#L2927-L2938 |
6,193 | wummel/linkchecker | linkcheck/fileutil.py | pathencode | def pathencode (path):
"""Encode a path string with the platform file system encoding."""
if isinstance(path, unicode) and not os.path.supports_unicode_filenames:
path = path.encode(FSCODING, "replace")
return path | python | def pathencode (path):
"""Encode a path string with the platform file system encoding."""
if isinstance(path, unicode) and not os.path.supports_unicode_filenames:
path = path.encode(FSCODING, "replace")
return path | ['def', 'pathencode', '(', 'path', ')', ':', 'if', 'isinstance', '(', 'path', ',', 'unicode', ')', 'and', 'not', 'os', '.', 'path', '.', 'supports_unicode_filenames', ':', 'path', '=', 'path', '.', 'encode', '(', 'FSCODING', ',', '"replace"', ')', 'return', 'path'] | Encode a path string with the platform file system encoding. | ['Encode', 'a', 'path', 'string', 'with', 'the', 'platform', 'file', 'system', 'encoding', '.'] | train | https://github.com/wummel/linkchecker/blob/c2ce810c3fb00b895a841a7be6b2e78c64e7b042/linkcheck/fileutil.py#L167-L171 |
6,194 | IdentityPython/pysaml2 | src/saml2/mcache.py | Cache.get_identity | def get_identity(self, subject_id, entities=None):
""" Get all the identity information that has been received and
are still valid about the subject.
:param subject_id: The identifier of the subject
:param entities: The identifiers of the entities whoes assertions are
intere... | python | def get_identity(self, subject_id, entities=None):
""" Get all the identity information that has been received and
are still valid about the subject.
:param subject_id: The identifier of the subject
:param entities: The identifiers of the entities whoes assertions are
intere... | ['def', 'get_identity', '(', 'self', ',', 'subject_id', ',', 'entities', '=', 'None', ')', ':', 'if', 'not', 'entities', ':', 'entities', '=', 'self', '.', 'entities', '(', 'subject_id', ')', 'if', 'not', 'entities', ':', 'return', '{', '}', ',', '[', ']', 'res', '=', '{', '}', 'oldees', '=', '[', ']', 'for', '(', 'ent... | Get all the identity information that has been received and
are still valid about the subject.
:param subject_id: The identifier of the subject
:param entities: The identifiers of the entities whoes assertions are
interesting. If the list is empty all entities are interesting.
... | ['Get', 'all', 'the', 'identity', 'information', 'that', 'has', 'been', 'received', 'and', 'are', 'still', 'valid', 'about', 'the', 'subject', '.'] | train | https://github.com/IdentityPython/pysaml2/blob/d3aa78eeb7d37c12688f783cb4db1c7263a14ad6/src/saml2/mcache.py#L37-L68 |
6,195 | nint8835/jigsaw | jigsaw/PluginLoader.py | PluginLoader.reload_all_manifests | def reload_all_manifests(self):
"""
Reloads all loaded manifests, and loads any new manifests
"""
self._logger.debug("Reloading all manifests.")
self._manifests = []
self.load_manifests()
self._logger.debug("All manifests reloaded.") | python | def reload_all_manifests(self):
"""
Reloads all loaded manifests, and loads any new manifests
"""
self._logger.debug("Reloading all manifests.")
self._manifests = []
self.load_manifests()
self._logger.debug("All manifests reloaded.") | ['def', 'reload_all_manifests', '(', 'self', ')', ':', 'self', '.', '_logger', '.', 'debug', '(', '"Reloading all manifests."', ')', 'self', '.', '_manifests', '=', '[', ']', 'self', '.', 'load_manifests', '(', ')', 'self', '.', '_logger', '.', 'debug', '(', '"All manifests reloaded."', ')'] | Reloads all loaded manifests, and loads any new manifests | ['Reloads', 'all', 'loaded', 'manifests', 'and', 'loads', 'any', 'new', 'manifests'] | train | https://github.com/nint8835/jigsaw/blob/109e62801a0334652e88ea972a95a341ccc96621/jigsaw/PluginLoader.py#L223-L230 |
6,196 | brocade/pynos | pynos/versions/ver_7/ver_7_1_0/yang/brocade_tunnels.py | brocade_tunnels.overlay_gateway_site_bfd_params_bfd_shutdown | def overlay_gateway_site_bfd_params_bfd_shutdown(self, **kwargs):
"""Auto Generated Code
"""
config = ET.Element("config")
overlay_gateway = ET.SubElement(config, "overlay-gateway", xmlns="urn:brocade.com:mgmt:brocade-tunnels")
name_key = ET.SubElement(overlay_gateway, "name")
... | python | def overlay_gateway_site_bfd_params_bfd_shutdown(self, **kwargs):
"""Auto Generated Code
"""
config = ET.Element("config")
overlay_gateway = ET.SubElement(config, "overlay-gateway", xmlns="urn:brocade.com:mgmt:brocade-tunnels")
name_key = ET.SubElement(overlay_gateway, "name")
... | ['def', 'overlay_gateway_site_bfd_params_bfd_shutdown', '(', 'self', ',', '*', '*', 'kwargs', ')', ':', 'config', '=', 'ET', '.', 'Element', '(', '"config"', ')', 'overlay_gateway', '=', 'ET', '.', 'SubElement', '(', 'config', ',', '"overlay-gateway"', ',', 'xmlns', '=', '"urn:brocade.com:mgmt:brocade-tunnels"', ')', '... | Auto Generated Code | ['Auto', 'Generated', 'Code'] | train | https://github.com/brocade/pynos/blob/bd8a34e98f322de3fc06750827d8bbc3a0c00380/pynos/versions/ver_7/ver_7_1_0/yang/brocade_tunnels.py#L429-L444 |
6,197 | dmwm/DBS | Server/Python/src/dbs/web/DBSReaderModel.py | DBSReaderModel.dumpBlock | def dumpBlock(self, block_name):
"""
API the list all information related with the block_name
:param block_name: Name of block to be dumped (Required)
:type block_name: str
"""
try:
return self.dbsBlock.dumpBlock(block_name)
except HTTPError as he:
... | python | def dumpBlock(self, block_name):
"""
API the list all information related with the block_name
:param block_name: Name of block to be dumped (Required)
:type block_name: str
"""
try:
return self.dbsBlock.dumpBlock(block_name)
except HTTPError as he:
... | ['def', 'dumpBlock', '(', 'self', ',', 'block_name', ')', ':', 'try', ':', 'return', 'self', '.', 'dbsBlock', '.', 'dumpBlock', '(', 'block_name', ')', 'except', 'HTTPError', 'as', 'he', ':', 'raise', 'he', 'except', 'dbsException', 'as', 'de', ':', 'dbsExceptionHandler', '(', 'de', '.', 'eCode', ',', 'de', '.', 'messa... | API the list all information related with the block_name
:param block_name: Name of block to be dumped (Required)
:type block_name: str | ['API', 'the', 'list', 'all', 'information', 'related', 'with', 'the', 'block_name'] | train | https://github.com/dmwm/DBS/blob/9619bafce3783b3e77f0415f8f9a258e33dd1e6f/Server/Python/src/dbs/web/DBSReaderModel.py#L1507-L1524 |
6,198 | phaethon/kamene | kamene/contrib/gsm_um.py | locationUpdatingAccept | def locationUpdatingAccept(MobileId_presence=0,
FollowOnProceed_presence=0,
CtsPermission_presence=0):
"""LOCATION UPDATING ACCEPT Section 9.2.13"""
a = TpPd(pd=0x5)
b = MessageType(mesType=0x02) # 00000010
c = LocalAreaId()
packet = a / b / c
... | python | def locationUpdatingAccept(MobileId_presence=0,
FollowOnProceed_presence=0,
CtsPermission_presence=0):
"""LOCATION UPDATING ACCEPT Section 9.2.13"""
a = TpPd(pd=0x5)
b = MessageType(mesType=0x02) # 00000010
c = LocalAreaId()
packet = a / b / c
... | ['def', 'locationUpdatingAccept', '(', 'MobileId_presence', '=', '0', ',', 'FollowOnProceed_presence', '=', '0', ',', 'CtsPermission_presence', '=', '0', ')', ':', 'a', '=', 'TpPd', '(', 'pd', '=', '0x5', ')', 'b', '=', 'MessageType', '(', 'mesType', '=', '0x02', ')', '# 00000010', 'c', '=', 'LocalAreaId', '(', ')', 'p... | LOCATION UPDATING ACCEPT Section 9.2.13 | ['LOCATION', 'UPDATING', 'ACCEPT', 'Section', '9', '.', '2', '.', '13'] | train | https://github.com/phaethon/kamene/blob/11d4064844f4f68ac5d7546f5633ac7d02082914/kamene/contrib/gsm_um.py#L1449-L1466 |
6,199 | datastore/datastore | datastore/core/basic.py | LoggingDatastore.contains | def contains(self, key):
'''Returns whether the object named by `key` exists.
LoggingDatastore logs the access.
'''
self.logger.info('%s: contains %s' % (self, key))
return super(LoggingDatastore, self).contains(key) | python | def contains(self, key):
'''Returns whether the object named by `key` exists.
LoggingDatastore logs the access.
'''
self.logger.info('%s: contains %s' % (self, key))
return super(LoggingDatastore, self).contains(key) | ['def', 'contains', '(', 'self', ',', 'key', ')', ':', 'self', '.', 'logger', '.', 'info', '(', "'%s: contains %s'", '%', '(', 'self', ',', 'key', ')', ')', 'return', 'super', '(', 'LoggingDatastore', ',', 'self', ')', '.', 'contains', '(', 'key', ')'] | Returns whether the object named by `key` exists.
LoggingDatastore logs the access. | ['Returns', 'whether', 'the', 'object', 'named', 'by', 'key', 'exists', '.', 'LoggingDatastore', 'logs', 'the', 'access', '.'] | train | https://github.com/datastore/datastore/blob/7ccf0cd4748001d3dbf5e6dda369b0f63e0269d3/datastore/core/basic.py#L444-L449 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.