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
4,300
BoGoEngine/bogo-python
bogo/core.py
_transform
def _transform(comps, trans): """ Transform the given string with transform type trans """ logging.debug("== In _transform(%s, %s) ==", comps, trans) components = list(comps) action, parameter = _get_action(trans) if action == _Action.ADD_MARK and \ components[2] == "" and \ ...
python
def _transform(comps, trans): """ Transform the given string with transform type trans """ logging.debug("== In _transform(%s, %s) ==", comps, trans) components = list(comps) action, parameter = _get_action(trans) if action == _Action.ADD_MARK and \ components[2] == "" and \ ...
['def', '_transform', '(', 'comps', ',', 'trans', ')', ':', 'logging', '.', 'debug', '(', '"== In _transform(%s, %s) =="', ',', 'comps', ',', 'trans', ')', 'components', '=', 'list', '(', 'comps', ')', 'action', ',', 'parameter', '=', '_get_action', '(', 'trans', ')', 'if', 'action', '==', '_Action', '.', 'ADD_MARK', '...
Transform the given string with transform type trans
['Transform', 'the', 'given', 'string', 'with', 'transform', 'type', 'trans']
train
https://github.com/BoGoEngine/bogo-python/blob/9b85329a408ded4cead3539cecba12984d5d7650/bogo/core.py#L365-L434
4,301
inveniosoftware/invenio-access
invenio_access/alembic/2069a982633b_add_on_delete_cascade_constraint.py
upgrade
def upgrade(): """Upgrade database.""" op.create_index(op.f('ix_access_actionsroles_role_id'), 'access_actionsroles', ['role_id'], unique=False) op.drop_constraint(u'fk_access_actionsroles_role_id_accounts_role', 'access_actionsroles', type_='foreignkey') op.cr...
python
def upgrade(): """Upgrade database.""" op.create_index(op.f('ix_access_actionsroles_role_id'), 'access_actionsroles', ['role_id'], unique=False) op.drop_constraint(u'fk_access_actionsroles_role_id_accounts_role', 'access_actionsroles', type_='foreignkey') op.cr...
['def', 'upgrade', '(', ')', ':', 'op', '.', 'create_index', '(', 'op', '.', 'f', '(', "'ix_access_actionsroles_role_id'", ')', ',', "'access_actionsroles'", ',', '[', "'role_id'", ']', ',', 'unique', '=', 'False', ')', 'op', '.', 'drop_constraint', '(', "u'fk_access_actionsroles_role_id_accounts_role'", ',', "'access_...
Upgrade database.
['Upgrade', 'database', '.']
train
https://github.com/inveniosoftware/invenio-access/blob/3b033a4bdc110eb2f7e9f08f0744a780884bfc80/invenio_access/alembic/2069a982633b_add_on_delete_cascade_constraint.py#L20-L35
4,302
delph-in/pydelphin
delphin/tdl.py
Conjunction.features
def features(self, expand=False): """Return the list of feature-value pairs in the conjunction.""" featvals = [] for term in self._terms: if isinstance(term, AVM): featvals.extend(term.features(expand=expand)) return featvals
python
def features(self, expand=False): """Return the list of feature-value pairs in the conjunction.""" featvals = [] for term in self._terms: if isinstance(term, AVM): featvals.extend(term.features(expand=expand)) return featvals
['def', 'features', '(', 'self', ',', 'expand', '=', 'False', ')', ':', 'featvals', '=', '[', ']', 'for', 'term', 'in', 'self', '.', '_terms', ':', 'if', 'isinstance', '(', 'term', ',', 'AVM', ')', ':', 'featvals', '.', 'extend', '(', 'term', '.', 'features', '(', 'expand', '=', 'expand', ')', ')', 'return', 'featvals'...
Return the list of feature-value pairs in the conjunction.
['Return', 'the', 'list', 'of', 'feature', '-', 'value', 'pairs', 'in', 'the', 'conjunction', '.']
train
https://github.com/delph-in/pydelphin/blob/7bd2cd63ab7cf74803e1d6547b9ebc014b382abd/delphin/tdl.py#L599-L605
4,303
ziwenxie/netease-dl
netease/weapi.py
Crawler.search_user
def search_user(self, user_name, quiet=False, limit=9): """Search user by user name. :params user_name: user name. :params quiet: automatically select the best one. :params limit: user count returned by weapi. :return: a User object. """ result = self.search(use...
python
def search_user(self, user_name, quiet=False, limit=9): """Search user by user name. :params user_name: user name. :params quiet: automatically select the best one. :params limit: user count returned by weapi. :return: a User object. """ result = self.search(use...
['def', 'search_user', '(', 'self', ',', 'user_name', ',', 'quiet', '=', 'False', ',', 'limit', '=', '9', ')', ':', 'result', '=', 'self', '.', 'search', '(', 'user_name', ',', 'search_type', '=', '1002', ',', 'limit', '=', 'limit', ')', 'if', 'result', '[', "'result'", ']', '[', "'userprofileCount'", ']', '<=', '0', '...
Search user by user name. :params user_name: user name. :params quiet: automatically select the best one. :params limit: user count returned by weapi. :return: a User object.
['Search', 'user', 'by', 'user', 'name', '.']
train
https://github.com/ziwenxie/netease-dl/blob/84b226fc07b10f7f66580f0fc69f10356f66b5c3/netease/weapi.py#L210-L231
4,304
JdeRobot/base
src/drivers/MAVLinkServer/MAVProxy/modules/mavproxy_misc.py
MiscModule.cmd_alt
def cmd_alt(self, args): '''show altitude''' print("Altitude: %.1f" % self.status.altitude) qnh_pressure = self.get_mav_param('AFS_QNH_PRESSURE', None) if qnh_pressure is not None and qnh_pressure > 0: ground_temp = self.get_mav_param('GND_TEMP', 21) pressure = s...
python
def cmd_alt(self, args): '''show altitude''' print("Altitude: %.1f" % self.status.altitude) qnh_pressure = self.get_mav_param('AFS_QNH_PRESSURE', None) if qnh_pressure is not None and qnh_pressure > 0: ground_temp = self.get_mav_param('GND_TEMP', 21) pressure = s...
['def', 'cmd_alt', '(', 'self', ',', 'args', ')', ':', 'print', '(', '"Altitude: %.1f"', '%', 'self', '.', 'status', '.', 'altitude', ')', 'qnh_pressure', '=', 'self', '.', 'get_mav_param', '(', "'AFS_QNH_PRESSURE'", ',', 'None', ')', 'if', 'qnh_pressure', 'is', 'not', 'None', 'and', 'qnh_pressure', '>', '0', ':', 'gr...
show altitude
['show', 'altitude']
train
https://github.com/JdeRobot/base/blob/303b18992785b2fe802212f2d758a60873007f1f/src/drivers/MAVLinkServer/MAVProxy/modules/mavproxy_misc.py#L92-L101
4,305
litaotao/IPython-Dashboard
dashboard/server/resources/sql.py
SqlData.post
def post(self): '''return executed sql result to client. post data format: {"options": ['all', 'last', 'first', 'format'], "sql_raw": "raw sql ..."} Returns: sql result. ''' ## format sql data = request.get_json() options, sql_raw = dat...
python
def post(self): '''return executed sql result to client. post data format: {"options": ['all', 'last', 'first', 'format'], "sql_raw": "raw sql ..."} Returns: sql result. ''' ## format sql data = request.get_json() options, sql_raw = dat...
['def', 'post', '(', 'self', ')', ':', '## format sql', 'data', '=', 'request', '.', 'get_json', '(', ')', 'options', ',', 'sql_raw', '=', 'data', '.', 'get', '(', "'options'", ')', ',', 'data', '.', 'get', '(', "'sql_raw'", ')', 'if', 'options', '==', "'format'", ':', 'sql_formmated', '=', 'sqlparse', '.', 'format', '...
return executed sql result to client. post data format: {"options": ['all', 'last', 'first', 'format'], "sql_raw": "raw sql ..."} Returns: sql result.
['return', 'executed', 'sql', 'result', 'to', 'client', '.']
train
https://github.com/litaotao/IPython-Dashboard/blob/b28a6b447c86bcec562e554efe96c64660ddf7a2/dashboard/server/resources/sql.py#L40-L75
4,306
openstack/proliantutils
proliantutils/redfish/resources/system/iscsi.py
ISCSIResource.iscsi_settings
def iscsi_settings(self): """Property to provide reference to iSCSI settings instance It is calculated once when the first time it is queried. On refresh, this property gets reset. """ return ISCSISettings( self._conn, utils.get_subresource_path_by( s...
python
def iscsi_settings(self): """Property to provide reference to iSCSI settings instance It is calculated once when the first time it is queried. On refresh, this property gets reset. """ return ISCSISettings( self._conn, utils.get_subresource_path_by( s...
['def', 'iscsi_settings', '(', 'self', ')', ':', 'return', 'ISCSISettings', '(', 'self', '.', '_conn', ',', 'utils', '.', 'get_subresource_path_by', '(', 'self', ',', '[', '"@Redfish.Settings"', ',', '"SettingsObject"', ']', ')', ',', 'redfish_version', '=', 'self', '.', 'redfish_version', ')']
Property to provide reference to iSCSI settings instance It is calculated once when the first time it is queried. On refresh, this property gets reset.
['Property', 'to', 'provide', 'reference', 'to', 'iSCSI', 'settings', 'instance']
train
https://github.com/openstack/proliantutils/blob/86ef3b47b4eca97c221577e3570b0240d6a25f22/proliantutils/redfish/resources/system/iscsi.py#L42-L51
4,307
quora/qcore
qcore/asserts.py
assert_is_instance
def assert_is_instance(value, types, message=None, extra=None): """Raises an AssertionError if value is not an instance of type(s).""" assert isinstance(value, types), _assert_fail_message( message, value, types, "is not an instance of", extra )
python
def assert_is_instance(value, types, message=None, extra=None): """Raises an AssertionError if value is not an instance of type(s).""" assert isinstance(value, types), _assert_fail_message( message, value, types, "is not an instance of", extra )
['def', 'assert_is_instance', '(', 'value', ',', 'types', ',', 'message', '=', 'None', ',', 'extra', '=', 'None', ')', ':', 'assert', 'isinstance', '(', 'value', ',', 'types', ')', ',', '_assert_fail_message', '(', 'message', ',', 'value', ',', 'types', ',', '"is not an instance of"', ',', 'extra', ')']
Raises an AssertionError if value is not an instance of type(s).
['Raises', 'an', 'AssertionError', 'if', 'value', 'is', 'not', 'an', 'instance', 'of', 'type', '(', 's', ')', '.']
train
https://github.com/quora/qcore/blob/fa5cd438eea554db35fd29cbc8dfbde69f09961c/qcore/asserts.py#L97-L101
4,308
python-gitlab/python-gitlab
gitlab/__init__.py
Gitlab.auth
def auth(self): """Performs an authentication. Uses either the private token, or the email/password pair. The `user` attribute will hold a `gitlab.objects.CurrentUser` object on success. """ if self.private_token or self.oauth_token: self._token_auth() ...
python
def auth(self): """Performs an authentication. Uses either the private token, or the email/password pair. The `user` attribute will hold a `gitlab.objects.CurrentUser` object on success. """ if self.private_token or self.oauth_token: self._token_auth() ...
['def', 'auth', '(', 'self', ')', ':', 'if', 'self', '.', 'private_token', 'or', 'self', '.', 'oauth_token', ':', 'self', '.', '_token_auth', '(', ')', 'else', ':', 'self', '.', '_credentials_auth', '(', ')']
Performs an authentication. Uses either the private token, or the email/password pair. The `user` attribute will hold a `gitlab.objects.CurrentUser` object on success.
['Performs', 'an', 'authentication', '.']
train
https://github.com/python-gitlab/python-gitlab/blob/16de1b03fde3dbbe8f851614dd1d8c09de102fe5/gitlab/__init__.py#L192-L203
4,309
materialsproject/pymatgen
pymatgen/analysis/wulff.py
WulffShape.get_line_in_facet
def get_line_in_facet(self, facet): """ Returns the sorted pts in a facet used to draw a line """ lines = list(facet.outer_lines) pt = [] prev = None while len(lines) > 0: if prev is None: l = lines.pop(0) else: ...
python
def get_line_in_facet(self, facet): """ Returns the sorted pts in a facet used to draw a line """ lines = list(facet.outer_lines) pt = [] prev = None while len(lines) > 0: if prev is None: l = lines.pop(0) else: ...
['def', 'get_line_in_facet', '(', 'self', ',', 'facet', ')', ':', 'lines', '=', 'list', '(', 'facet', '.', 'outer_lines', ')', 'pt', '=', '[', ']', 'prev', '=', 'None', 'while', 'len', '(', 'lines', ')', '>', '0', ':', 'if', 'prev', 'is', 'None', ':', 'l', '=', 'lines', '.', 'pop', '(', '0', ')', 'else', ':', 'for', 'i...
Returns the sorted pts in a facet used to draw a line
['Returns', 'the', 'sorted', 'pts', 'in', 'a', 'facet', 'used', 'to', 'draw', 'a', 'line']
train
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/analysis/wulff.py#L353-L377
4,310
pjuren/pyokit
src/pyokit/io/genomeAlignment.py
__split_genomic_interval_filename
def __split_genomic_interval_filename(fn): """ Split a filename of the format chrom:start-end.ext or chrom.ext (full chrom). :return: tuple of (chrom, start, end) -- 'start' and 'end' are None if not present in the filename. """ if fn is None or fn == "": raise ValueError("invalid filename: " ...
python
def __split_genomic_interval_filename(fn): """ Split a filename of the format chrom:start-end.ext or chrom.ext (full chrom). :return: tuple of (chrom, start, end) -- 'start' and 'end' are None if not present in the filename. """ if fn is None or fn == "": raise ValueError("invalid filename: " ...
['def', '__split_genomic_interval_filename', '(', 'fn', ')', ':', 'if', 'fn', 'is', 'None', 'or', 'fn', '==', '""', ':', 'raise', 'ValueError', '(', '"invalid filename: "', '+', 'str', '(', 'fn', ')', ')', 'fn', '=', '"."', '.', 'join', '(', 'fn', '.', 'split', '(', '"."', ')', '[', ':', '-', '1', ']', ')', 'parts', '=...
Split a filename of the format chrom:start-end.ext or chrom.ext (full chrom). :return: tuple of (chrom, start, end) -- 'start' and 'end' are None if not present in the filename.
['Split', 'a', 'filename', 'of', 'the', 'format', 'chrom', ':', 'start', '-', 'end', '.', 'ext', 'or', 'chrom', '.', 'ext', '(', 'full', 'chrom', ')', '.']
train
https://github.com/pjuren/pyokit/blob/fddae123b5d817daa39496183f19c000d9c3791f/src/pyokit/io/genomeAlignment.py#L75-L92
4,311
NoneGG/aredis
aredis/commands/hash.py
HashCommandMixin.hincrbyfloat
async def hincrbyfloat(self, name, key, amount=1.0): """ Increment the value of ``key`` in hash ``name`` by floating ``amount`` """ return await self.execute_command('HINCRBYFLOAT', name, key, amount)
python
async def hincrbyfloat(self, name, key, amount=1.0): """ Increment the value of ``key`` in hash ``name`` by floating ``amount`` """ return await self.execute_command('HINCRBYFLOAT', name, key, amount)
['async', 'def', 'hincrbyfloat', '(', 'self', ',', 'name', ',', 'key', ',', 'amount', '=', '1.0', ')', ':', 'return', 'await', 'self', '.', 'execute_command', '(', "'HINCRBYFLOAT'", ',', 'name', ',', 'key', ',', 'amount', ')']
Increment the value of ``key`` in hash ``name`` by floating ``amount``
['Increment', 'the', 'value', 'of', 'key', 'in', 'hash', 'name', 'by', 'floating', 'amount']
train
https://github.com/NoneGG/aredis/blob/204caad740ac13e5760d46444a2ba7632982a046/aredis/commands/hash.py#L47-L51
4,312
tensorflow/tensor2tensor
tensor2tensor/models/transformer.py
transformer_wikitext103_l4k_v0
def transformer_wikitext103_l4k_v0(): """HParams for training languagemodel_wikitext103_l4k.""" hparams = transformer_big() # Adafactor uses less memory than Adam. # switch to Adafactor with its recommended learning rate scheme. hparams.optimizer = "Adafactor" hparams.learning_rate_schedule = "rsqrt_decay"...
python
def transformer_wikitext103_l4k_v0(): """HParams for training languagemodel_wikitext103_l4k.""" hparams = transformer_big() # Adafactor uses less memory than Adam. # switch to Adafactor with its recommended learning rate scheme. hparams.optimizer = "Adafactor" hparams.learning_rate_schedule = "rsqrt_decay"...
['def', 'transformer_wikitext103_l4k_v0', '(', ')', ':', 'hparams', '=', 'transformer_big', '(', ')', '# Adafactor uses less memory than Adam.', '# switch to Adafactor with its recommended learning rate scheme.', 'hparams', '.', 'optimizer', '=', '"Adafactor"', 'hparams', '.', 'learning_rate_schedule', '=', '"rsqrt_dec...
HParams for training languagemodel_wikitext103_l4k.
['HParams', 'for', 'training', 'languagemodel_wikitext103_l4k', '.']
train
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/models/transformer.py#L2615-L2645
4,313
programa-stic/barf-project
barf/analysis/symbolic/emulator.py
ReilSymbolicEmulator.__process_instr
def __process_instr(self, instr, avoid, next_addr, initial_state, execution_state, trace_current): """Process a REIL instruction. Args: instr (ReilInstruction): Instruction to process. avoid (list): List of addresses to avoid while executing the code. next_addr (int)...
python
def __process_instr(self, instr, avoid, next_addr, initial_state, execution_state, trace_current): """Process a REIL instruction. Args: instr (ReilInstruction): Instruction to process. avoid (list): List of addresses to avoid while executing the code. next_addr (int)...
['def', '__process_instr', '(', 'self', ',', 'instr', ',', 'avoid', ',', 'next_addr', ',', 'initial_state', ',', 'execution_state', ',', 'trace_current', ')', ':', '# Process branch (JCC oprnd0, empty, oprnd2).', 'if', 'instr', '.', 'mnemonic', '==', 'ReilMnemonic', '.', 'JCC', ':', 'not_taken_addr', '=', 'next_addr', ...
Process a REIL instruction. Args: instr (ReilInstruction): Instruction to process. avoid (list): List of addresses to avoid while executing the code. next_addr (int): Address of the following instruction. initial_state (State): Initial execution state. ...
['Process', 'a', 'REIL', 'instruction', '.']
train
https://github.com/programa-stic/barf-project/blob/18ed9e5eace55f7bf6015ec57f037c364099021c/barf/analysis/symbolic/emulator.py#L396-L433
4,314
openvax/pyensembl
pyensembl/genome.py
Genome.transcript_names
def transcript_names(self, contig=None, strand=None): """ What are all the transcript names in the database (optionally, restrict to a given chromosome and/or strand) """ return self._all_feature_values( column="transcript_name", feature="transcript", ...
python
def transcript_names(self, contig=None, strand=None): """ What are all the transcript names in the database (optionally, restrict to a given chromosome and/or strand) """ return self._all_feature_values( column="transcript_name", feature="transcript", ...
['def', 'transcript_names', '(', 'self', ',', 'contig', '=', 'None', ',', 'strand', '=', 'None', ')', ':', 'return', 'self', '.', '_all_feature_values', '(', 'column', '=', '"transcript_name"', ',', 'feature', '=', '"transcript"', ',', 'contig', '=', 'contig', ',', 'strand', '=', 'strand', ')']
What are all the transcript names in the database (optionally, restrict to a given chromosome and/or strand)
['What', 'are', 'all', 'the', 'transcript', 'names', 'in', 'the', 'database', '(', 'optionally', 'restrict', 'to', 'a', 'given', 'chromosome', 'and', '/', 'or', 'strand', ')']
train
https://github.com/openvax/pyensembl/blob/4b995fb72e848206d6fbf11950cf30964cd9b3aa/pyensembl/genome.py#L926-L935
4,315
jxtech/wechatpy
wechatpy/client/__init__.py
WeChatComponentClient.fetch_access_token
def fetch_access_token(self): """ 获取 access token 详情请参考 https://open.weixin.qq.com/cgi-bin/showdocument?action=dir_list\ &t=resource/res_list&verify=1&id=open1419318587&token=&lang=zh_CN 这是内部刷新机制。请不要完全依赖! 因为有可能在缓存期间没有对此公众号的操作,造成refresh_token失效。 :return: 返回的 JSON...
python
def fetch_access_token(self): """ 获取 access token 详情请参考 https://open.weixin.qq.com/cgi-bin/showdocument?action=dir_list\ &t=resource/res_list&verify=1&id=open1419318587&token=&lang=zh_CN 这是内部刷新机制。请不要完全依赖! 因为有可能在缓存期间没有对此公众号的操作,造成refresh_token失效。 :return: 返回的 JSON...
['def', 'fetch_access_token', '(', 'self', ')', ':', 'expires_in', '=', '7200', 'result', '=', 'self', '.', 'component', '.', 'refresh_authorizer_token', '(', 'self', '.', 'appid', ',', 'self', '.', 'refresh_token', ')', 'if', "'expires_in'", 'in', 'result', ':', 'expires_in', '=', 'result', '[', "'expires_in'", ']', '...
获取 access token 详情请参考 https://open.weixin.qq.com/cgi-bin/showdocument?action=dir_list\ &t=resource/res_list&verify=1&id=open1419318587&token=&lang=zh_CN 这是内部刷新机制。请不要完全依赖! 因为有可能在缓存期间没有对此公众号的操作,造成refresh_token失效。 :return: 返回的 JSON 数据包
['获取', 'access', 'token', '详情请参考', 'https', ':', '//', 'open', '.', 'weixin', '.', 'qq', '.', 'com', '/', 'cgi', '-', 'bin', '/', 'showdocument?action', '=', 'dir_list', '\\', '&t', '=', 'resource', '/', 'res_list&verify', '=', '1&id', '=', 'open1419318587&token', '=', '&lang', '=', 'zh_CN']
train
https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/client/__init__.py#L113-L135
4,316
hardbyte/python-can
can/interfaces/ixxat/canlib.py
__vciFormatError
def __vciFormatError(library_instance, function, HRESULT): """ Format a VCI error and attach failed function and decoded HRESULT :param CLibrary library_instance: Mapped instance of IXXAT vcinpl library :param callable function: Failed function :param HRESULT HRESULT:...
python
def __vciFormatError(library_instance, function, HRESULT): """ Format a VCI error and attach failed function and decoded HRESULT :param CLibrary library_instance: Mapped instance of IXXAT vcinpl library :param callable function: Failed function :param HRESULT HRESULT:...
['def', '__vciFormatError', '(', 'library_instance', ',', 'function', ',', 'HRESULT', ')', ':', 'buf', '=', 'ctypes', '.', 'create_string_buffer', '(', 'constants', '.', 'VCI_MAX_ERRSTRLEN', ')', 'ctypes', '.', 'memset', '(', 'buf', ',', '0', ',', 'constants', '.', 'VCI_MAX_ERRSTRLEN', ')', 'library_instance', '.', 'vc...
Format a VCI error and attach failed function and decoded HRESULT :param CLibrary library_instance: Mapped instance of IXXAT vcinpl library :param callable function: Failed function :param HRESULT HRESULT: HRESULT returned by vcinpl call :return: ...
['Format', 'a', 'VCI', 'error', 'and', 'attach', 'failed', 'function', 'and', 'decoded', 'HRESULT', ':', 'param', 'CLibrary', 'library_instance', ':', 'Mapped', 'instance', 'of', 'IXXAT', 'vcinpl', 'library', ':', 'param', 'callable', 'function', ':', 'Failed', 'function', ':', 'param', 'HRESULT', 'HRESULT', ':', 'HRES...
train
https://github.com/hardbyte/python-can/blob/cdc5254d96072df7739263623f3e920628a7d214/can/interfaces/ixxat/canlib.py#L82-L96
4,317
mulkieran/justbases
src/justbases/_division.py
NatDivision._division
def _division(divisor, dividend, remainder, base): """ Get the quotient and remainder :param int divisor: the divisor :param dividend: the divident :type dividend: sequence of int :param int remainder: initial remainder :param int base: the base :returns...
python
def _division(divisor, dividend, remainder, base): """ Get the quotient and remainder :param int divisor: the divisor :param dividend: the divident :type dividend: sequence of int :param int remainder: initial remainder :param int base: the base :returns...
['def', '_division', '(', 'divisor', ',', 'dividend', ',', 'remainder', ',', 'base', ')', ':', 'quotient', '=', '[', ']', 'for', 'value', 'in', 'dividend', ':', 'remainder', '=', 'remainder', '*', 'base', '+', 'value', '(', 'quot', ',', 'rem', ')', '=', 'divmod', '(', 'remainder', ',', 'divisor', ')', 'quotient', '.', ...
Get the quotient and remainder :param int divisor: the divisor :param dividend: the divident :type dividend: sequence of int :param int remainder: initial remainder :param int base: the base :returns: quotient and remainder :rtype: tuple of (list of int) * int ...
['Get', 'the', 'quotient', 'and', 'remainder']
train
https://github.com/mulkieran/justbases/blob/dd52ff4b3d11609f54b2673599ee4eeb20f9734f/src/justbases/_division.py#L192-L214
4,318
Fantomas42/django-blog-zinnia
zinnia/signals.py
disconnect_entry_signals
def disconnect_entry_signals(): """ Disconnect all the signals on Entry model. """ post_save.disconnect( sender=Entry, dispatch_uid=ENTRY_PS_PING_DIRECTORIES) post_save.disconnect( sender=Entry, dispatch_uid=ENTRY_PS_PING_EXTERNAL_URLS) post_save.disconnect( ...
python
def disconnect_entry_signals(): """ Disconnect all the signals on Entry model. """ post_save.disconnect( sender=Entry, dispatch_uid=ENTRY_PS_PING_DIRECTORIES) post_save.disconnect( sender=Entry, dispatch_uid=ENTRY_PS_PING_EXTERNAL_URLS) post_save.disconnect( ...
['def', 'disconnect_entry_signals', '(', ')', ':', 'post_save', '.', 'disconnect', '(', 'sender', '=', 'Entry', ',', 'dispatch_uid', '=', 'ENTRY_PS_PING_DIRECTORIES', ')', 'post_save', '.', 'disconnect', '(', 'sender', '=', 'Entry', ',', 'dispatch_uid', '=', 'ENTRY_PS_PING_EXTERNAL_URLS', ')', 'post_save', '.', 'discon...
Disconnect all the signals on Entry model.
['Disconnect', 'all', 'the', 'signals', 'on', 'Entry', 'model', '.']
train
https://github.com/Fantomas42/django-blog-zinnia/blob/b4949304b104a8e1a7a7a0773cbfd024313c3a15/zinnia/signals.py#L153-L168
4,319
rigetti/pyquil
pyquil/api/_compiler.py
_extract_program_from_pyquil_executable_response
def _extract_program_from_pyquil_executable_response(response: PyQuilExecutableResponse) -> Program: """ Unpacks a rpcq PyQuilExecutableResponse object into a pyQuil Program object. :param response: PyQuilExecutableResponse object to be unpacked. :return: Resulting pyQuil Program object. """ p ...
python
def _extract_program_from_pyquil_executable_response(response: PyQuilExecutableResponse) -> Program: """ Unpacks a rpcq PyQuilExecutableResponse object into a pyQuil Program object. :param response: PyQuilExecutableResponse object to be unpacked. :return: Resulting pyQuil Program object. """ p ...
['def', '_extract_program_from_pyquil_executable_response', '(', 'response', ':', 'PyQuilExecutableResponse', ')', '->', 'Program', ':', 'p', '=', 'Program', '(', 'response', '.', 'program', ')', 'for', 'attr', ',', 'val', 'in', 'response', '.', 'attributes', '.', 'items', '(', ')', ':', 'setattr', '(', 'p', ',', 'attr...
Unpacks a rpcq PyQuilExecutableResponse object into a pyQuil Program object. :param response: PyQuilExecutableResponse object to be unpacked. :return: Resulting pyQuil Program object.
['Unpacks', 'a', 'rpcq', 'PyQuilExecutableResponse', 'object', 'into', 'a', 'pyQuil', 'Program', 'object', '.']
train
https://github.com/rigetti/pyquil/blob/ec98e453084b0037d69d8c3245f6822a5422593d/pyquil/api/_compiler.py#L55-L65
4,320
atdt/afraid
afraid/__init__.py
parse_args
def parse_args(args=None): """Parse command-line arguments""" parser = argparse.ArgumentParser(description='afraid.org dyndns client') ## positional arguments parser.add_argument('user') parser.add_argument('password') parser.add_argument('hosts', nargs='*', help='(deaf...
python
def parse_args(args=None): """Parse command-line arguments""" parser = argparse.ArgumentParser(description='afraid.org dyndns client') ## positional arguments parser.add_argument('user') parser.add_argument('password') parser.add_argument('hosts', nargs='*', help='(deaf...
['def', 'parse_args', '(', 'args', '=', 'None', ')', ':', 'parser', '=', 'argparse', '.', 'ArgumentParser', '(', 'description', '=', "'afraid.org dyndns client'", ')', '## positional arguments', 'parser', '.', 'add_argument', '(', "'user'", ')', 'parser', '.', 'add_argument', '(', "'password'", ')', 'parser', '.', 'add...
Parse command-line arguments
['Parse', 'command', '-', 'line', 'arguments']
train
https://github.com/atdt/afraid/blob/d74b2d4e41ed14e420da2793a89bef5d9b26ea26/afraid/__init__.py#L117-L156
4,321
jssimporter/python-jss
jss/jssobject.py
JSSObject.set_bool
def set_bool(self, location, value): """Set a boolean value. Casper booleans in XML are string literals of "true" or "false". This method sets the text value of "location" to the correct string representation of a boolean. Args: location: Element or a string path ar...
python
def set_bool(self, location, value): """Set a boolean value. Casper booleans in XML are string literals of "true" or "false". This method sets the text value of "location" to the correct string representation of a boolean. Args: location: Element or a string path ar...
['def', 'set_bool', '(', 'self', ',', 'location', ',', 'value', ')', ':', 'element', '=', 'self', '.', '_handle_location', '(', 'location', ')', 'if', 'isinstance', '(', 'value', ',', 'basestring', ')', ':', 'value', '=', 'True', 'if', 'value', '.', 'upper', '(', ')', '==', '"TRUE"', 'else', 'False', 'elif', 'not', 'is...
Set a boolean value. Casper booleans in XML are string literals of "true" or "false". This method sets the text value of "location" to the correct string representation of a boolean. Args: location: Element or a string path argument to find() value: Boolean or s...
['Set', 'a', 'boolean', 'value', '.']
train
https://github.com/jssimporter/python-jss/blob/b95185d74e0c0531b0b563f280d4129e21d5fe5d/jss/jssobject.py#L391-L411
4,322
tych0/xcffib
module/__init__.py
Connection.hoist_event
def hoist_event(self, e): """ Hoist an xcb_generic_event_t to the right xcffib structure. """ if e.response_type == 0: return self._process_error(ffi.cast("xcb_generic_error_t *", e)) # We mask off the high bit here because events sent with SendEvent have # this bit set. We ...
python
def hoist_event(self, e): """ Hoist an xcb_generic_event_t to the right xcffib structure. """ if e.response_type == 0: return self._process_error(ffi.cast("xcb_generic_error_t *", e)) # We mask off the high bit here because events sent with SendEvent have # this bit set. We ...
['def', 'hoist_event', '(', 'self', ',', 'e', ')', ':', 'if', 'e', '.', 'response_type', '==', '0', ':', 'return', 'self', '.', '_process_error', '(', 'ffi', '.', 'cast', '(', '"xcb_generic_error_t *"', ',', 'e', ')', ')', '# We mask off the high bit here because events sent with SendEvent have', "# this bit set. We do...
Hoist an xcb_generic_event_t to the right xcffib structure.
['Hoist', 'an', 'xcb_generic_event_t', 'to', 'the', 'right', 'xcffib', 'structure', '.']
train
https://github.com/tych0/xcffib/blob/c9c50c3ce513b130821f430be78c4c733626c707/module/__init__.py#L681-L693
4,323
RJT1990/pyflux
pyflux/families/skewt.py
Skewt.approximating_model_reg
def approximating_model_reg(self, beta, T, Z, R, Q, h_approx, data, X, state_no): """ Creates approximating Gaussian state space model for Skewt measurement density Parameters ---------- beta : np.array Contains untransformed starting values for latent variables ...
python
def approximating_model_reg(self, beta, T, Z, R, Q, h_approx, data, X, state_no): """ Creates approximating Gaussian state space model for Skewt measurement density Parameters ---------- beta : np.array Contains untransformed starting values for latent variables ...
['def', 'approximating_model_reg', '(', 'self', ',', 'beta', ',', 'T', ',', 'Z', ',', 'R', ',', 'Q', ',', 'h_approx', ',', 'data', ',', 'X', ',', 'state_no', ')', ':', 'H', '=', 'np', '.', 'ones', '(', 'data', '.', 'shape', '[', '0', ']', ')', '*', 'h_approx', 'mu', '=', 'np', '.', 'zeros', '(', 'data', '.', 'shape', '...
Creates approximating Gaussian state space model for Skewt measurement density Parameters ---------- beta : np.array Contains untransformed starting values for latent variables T, Z, R, Q : np.array State space matrices used in KFS algorithm ...
['Creates', 'approximating', 'Gaussian', 'state', 'space', 'model', 'for', 'Skewt', 'measurement', 'density', 'Parameters', '----------', 'beta', ':', 'np', '.', 'array', 'Contains', 'untransformed', 'starting', 'values', 'for', 'latent', 'variables', 'T', 'Z', 'R', 'Q', ':', 'np', '.', 'array', 'State', 'space', 'matr...
train
https://github.com/RJT1990/pyflux/blob/297f2afc2095acd97c12e827dd500e8ea5da0c0f/pyflux/families/skewt.py#L86-L121
4,324
pinax/pinax-blog
pinax/blog/parsers/creole_parser.py
HtmlEmitter.emit_node
def emit_node(self, node): """Emit a single node.""" emit = getattr(self, "%s_emit" % node.kind, self.default_emit) return emit(node)
python
def emit_node(self, node): """Emit a single node.""" emit = getattr(self, "%s_emit" % node.kind, self.default_emit) return emit(node)
['def', 'emit_node', '(', 'self', ',', 'node', ')', ':', 'emit', '=', 'getattr', '(', 'self', ',', '"%s_emit"', '%', 'node', '.', 'kind', ',', 'self', '.', 'default_emit', ')', 'return', 'emit', '(', 'node', ')']
Emit a single node.
['Emit', 'a', 'single', 'node', '.']
train
https://github.com/pinax/pinax-blog/blob/be1d64946381b47d197b258a488d5de56aacccce/pinax/blog/parsers/creole_parser.py#L142-L145
4,325
KarchinLab/probabilistic2020
prob2020/python/scores.py
read_vest_pickle
def read_vest_pickle(gname, score_dir): """Read in VEST scores for given gene. Parameters ---------- gname : str name of gene score_dir : str directory containing vest scores Returns ------- gene_vest : dict or None dict containing vest scores for gene. Returns ...
python
def read_vest_pickle(gname, score_dir): """Read in VEST scores for given gene. Parameters ---------- gname : str name of gene score_dir : str directory containing vest scores Returns ------- gene_vest : dict or None dict containing vest scores for gene. Returns ...
['def', 'read_vest_pickle', '(', 'gname', ',', 'score_dir', ')', ':', 'vest_path', '=', 'os', '.', 'path', '.', 'join', '(', 'score_dir', ',', 'gname', '+', '".vest.pickle"', ')', 'if', 'os', '.', 'path', '.', 'exists', '(', 'vest_path', ')', ':', 'if', 'sys', '.', 'version_info', '<', '(', '3', ',', ')', ':', 'with', ...
Read in VEST scores for given gene. Parameters ---------- gname : str name of gene score_dir : str directory containing vest scores Returns ------- gene_vest : dict or None dict containing vest scores for gene. Returns None if not found.
['Read', 'in', 'VEST', 'scores', 'for', 'given', 'gene', '.']
train
https://github.com/KarchinLab/probabilistic2020/blob/5d70583b0a7c07cfe32e95f3a70e05df412acb84/prob2020/python/scores.py#L82-L107
4,326
apache/incubator-mxnet
python/mxnet/gluon/data/dataset.py
Dataset.transform
def transform(self, fn, lazy=True): """Returns a new dataset with each sample transformed by the transformer function `fn`. Parameters ---------- fn : callable A transformer function that takes a sample as input and returns the transformed sample. ...
python
def transform(self, fn, lazy=True): """Returns a new dataset with each sample transformed by the transformer function `fn`. Parameters ---------- fn : callable A transformer function that takes a sample as input and returns the transformed sample. ...
['def', 'transform', '(', 'self', ',', 'fn', ',', 'lazy', '=', 'True', ')', ':', 'trans', '=', '_LazyTransformDataset', '(', 'self', ',', 'fn', ')', 'if', 'lazy', ':', 'return', 'trans', 'return', 'SimpleDataset', '(', '[', 'i', 'for', 'i', 'in', 'trans', ']', ')']
Returns a new dataset with each sample transformed by the transformer function `fn`. Parameters ---------- fn : callable A transformer function that takes a sample as input and returns the transformed sample. lazy : bool, default True If False...
['Returns', 'a', 'new', 'dataset', 'with', 'each', 'sample', 'transformed', 'by', 'the', 'transformer', 'function', 'fn', '.']
train
https://github.com/apache/incubator-mxnet/blob/1af29e9c060a4c7d60eeaacba32afdb9a7775ba7/python/mxnet/gluon/data/dataset.py#L43-L66
4,327
IBM/ibm-cos-sdk-python-s3transfer
ibm_s3transfer/aspera/futures.py
AsperaTransferListener.stop
def stop(self, free_resource=False): ''' send a stop transfer request to the Aspera sdk, can be done for: cancel - stop an in progress transfer free_resource - request to the Aspera sdk free resouces related to trasnfer_id ''' if not self.is_stopped(): self._...
python
def stop(self, free_resource=False): ''' send a stop transfer request to the Aspera sdk, can be done for: cancel - stop an in progress transfer free_resource - request to the Aspera sdk free resouces related to trasnfer_id ''' if not self.is_stopped(): self._...
['def', 'stop', '(', 'self', ',', 'free_resource', '=', 'False', ')', ':', 'if', 'not', 'self', '.', 'is_stopped', '(', ')', ':', 'self', '.', '_is_stopping', '=', 'True', 'try', ':', 'if', 'free_resource', 'or', 'self', '.', 'is_running', '(', 'False', ')', ':', 'if', 'not', 'free_resource', ':', 'logger', '.', 'info'...
send a stop transfer request to the Aspera sdk, can be done for: cancel - stop an in progress transfer free_resource - request to the Aspera sdk free resouces related to trasnfer_id
['send', 'a', 'stop', 'transfer', 'request', 'to', 'the', 'Aspera', 'sdk', 'can', 'be', 'done', 'for', ':', 'cancel', '-', 'stop', 'an', 'in', 'progress', 'transfer', 'free_resource', '-', 'request', 'to', 'the', 'Aspera', 'sdk', 'free', 'resouces', 'related', 'to', 'trasnfer_id']
train
https://github.com/IBM/ibm-cos-sdk-python-s3transfer/blob/24ba53137213e26e6b8fc2c3ec1e8198d507d22b/ibm_s3transfer/aspera/futures.py#L254-L274
4,328
FutunnOpen/futuquant
futuquant/quote/open_quote_context.py
OpenQuoteContext.get_order_book
def get_order_book(self, code): """ 获取实时摆盘数据 :param code: 股票代码 :return: (ret, data) ret == RET_OK 返回字典,数据格式如下 ret != RET_OK 返回错误字符串 {‘code’: 股票代码 ‘Ask’:[ (ask_price1, ask_volume1,order_num), (ask_price2, ask_volume2, ord...
python
def get_order_book(self, code): """ 获取实时摆盘数据 :param code: 股票代码 :return: (ret, data) ret == RET_OK 返回字典,数据格式如下 ret != RET_OK 返回错误字符串 {‘code’: 股票代码 ‘Ask’:[ (ask_price1, ask_volume1,order_num), (ask_price2, ask_volume2, ord...
['def', 'get_order_book', '(', 'self', ',', 'code', ')', ':', 'if', 'code', 'is', 'None', 'or', 'is_str', '(', 'code', ')', 'is', 'False', ':', 'error_str', '=', 'ERROR_STR_PREFIX', '+', '"the type of code param is wrong"', 'return', 'RET_ERROR', ',', 'error_str', 'query_processor', '=', 'self', '.', '_get_sync_query_p...
获取实时摆盘数据 :param code: 股票代码 :return: (ret, data) ret == RET_OK 返回字典,数据格式如下 ret != RET_OK 返回错误字符串 {‘code’: 股票代码 ‘Ask’:[ (ask_price1, ask_volume1,order_num), (ask_price2, ask_volume2, order_num),…] ‘Bid’: [ (bid_price1, bid...
['获取实时摆盘数据']
train
https://github.com/FutunnOpen/futuquant/blob/1512b321845f92ec9c578ce2689aa4e8482669e4/futuquant/quote/open_quote_context.py#L1410-L1445
4,329
KenjiTakahashi/td
td/model.py
Model._modifyInternal
def _modifyInternal(self, *, sort=None, purge=False, done=None): """Creates a whole new database from existing one, based on given modifiers. :sort: pattern should look like this: ([(<index>, True|False)], {<level_index>: [(<index>, True|False)]}), where True|False indicate whet...
python
def _modifyInternal(self, *, sort=None, purge=False, done=None): """Creates a whole new database from existing one, based on given modifiers. :sort: pattern should look like this: ([(<index>, True|False)], {<level_index>: [(<index>, True|False)]}), where True|False indicate whet...
['def', '_modifyInternal', '(', 'self', ',', '*', ',', 'sort', '=', 'None', ',', 'purge', '=', 'False', ',', 'done', '=', 'None', ')', ':', 'sortAll', ',', 'sortLevels', '=', 'sort', 'is', 'not', 'None', 'and', 'sort', 'or', '(', '[', ']', ',', '{', '}', ')', 'doneAll', ',', 'doneLevels', '=', 'done', 'is', 'not', 'Non...
Creates a whole new database from existing one, based on given modifiers. :sort: pattern should look like this: ([(<index>, True|False)], {<level_index>: [(<index>, True|False)]}), where True|False indicate whether to reverse or not, <index> are one of Model.indexes and <level_i...
['Creates', 'a', 'whole', 'new', 'database', 'from', 'existing', 'one', 'based', 'on', 'given', 'modifiers', '.']
train
https://github.com/KenjiTakahashi/td/blob/7311eabc63efe6fe6600687c3026f0837454c2e4/td/model.py#L281-L346
4,330
wbond/vat_moss-python
vat_moss/geoip2.py
calculate_rate
def calculate_rate(country_code, subdivision, city, address_country_code=None, address_exception=None): """ Calculates the VAT rate from the data returned by a GeoLite2 database :param country_code: Two-character country code :param subdivision: The first subdivision name :param c...
python
def calculate_rate(country_code, subdivision, city, address_country_code=None, address_exception=None): """ Calculates the VAT rate from the data returned by a GeoLite2 database :param country_code: Two-character country code :param subdivision: The first subdivision name :param c...
['def', 'calculate_rate', '(', 'country_code', ',', 'subdivision', ',', 'city', ',', 'address_country_code', '=', 'None', ',', 'address_exception', '=', 'None', ')', ':', 'if', 'not', 'country_code', 'or', 'not', 'isinstance', '(', 'country_code', ',', 'str_cls', ')', 'or', 'len', '(', 'country_code', ')', '!=', '2', '...
Calculates the VAT rate from the data returned by a GeoLite2 database :param country_code: Two-character country code :param subdivision: The first subdivision name :param city: The city name :param address_country_code: The user's country_code, as detected from billi...
['Calculates', 'the', 'VAT', 'rate', 'from', 'the', 'data', 'returned', 'by', 'a', 'GeoLite2', 'database']
train
https://github.com/wbond/vat_moss-python/blob/5089dcf036eb2e9abc58e78186fd46b522a50620/vat_moss/geoip2.py#L17-L99
4,331
pylast/pylast
src/pylast/__init__.py
_Network.scrobble
def scrobble( self, artist, title, timestamp, album=None, album_artist=None, track_number=None, duration=None, stream_id=None, context=None, mbid=None, ): """Used to add a track-play to a user's profile. Parame...
python
def scrobble( self, artist, title, timestamp, album=None, album_artist=None, track_number=None, duration=None, stream_id=None, context=None, mbid=None, ): """Used to add a track-play to a user's profile. Parame...
['def', 'scrobble', '(', 'self', ',', 'artist', ',', 'title', ',', 'timestamp', ',', 'album', '=', 'None', ',', 'album_artist', '=', 'None', ',', 'track_number', '=', 'None', ',', 'duration', '=', 'None', ',', 'stream_id', '=', 'None', ',', 'context', '=', 'None', ',', 'mbid', '=', 'None', ',', ')', ':', 'return', 'sel...
Used to add a track-play to a user's profile. Parameters: artist (Required) : The artist name. title (Required) : The track name. timestamp (Required) : The time the track started playing, in UNIX timestamp format (integer number of seconds since 00:00:00, ...
['Used', 'to', 'add', 'a', 'track', '-', 'play', 'to', 'a', 'user', 's', 'profile', '.']
train
https://github.com/pylast/pylast/blob/a52f66d316797fc819b5f1d186d77f18ba97b4ff/src/pylast/__init__.py#L568-L618
4,332
RudolfCardinal/pythonlib
cardinal_pythonlib/rnc_web.py
get_png_data_url
def get_png_data_url(blob: Optional[bytes]) -> str: """ Converts a PNG blob into a local URL encapsulating the PNG. """ return BASE64_PNG_URL_PREFIX + base64.b64encode(blob).decode('ascii')
python
def get_png_data_url(blob: Optional[bytes]) -> str: """ Converts a PNG blob into a local URL encapsulating the PNG. """ return BASE64_PNG_URL_PREFIX + base64.b64encode(blob).decode('ascii')
['def', 'get_png_data_url', '(', 'blob', ':', 'Optional', '[', 'bytes', ']', ')', '->', 'str', ':', 'return', 'BASE64_PNG_URL_PREFIX', '+', 'base64', '.', 'b64encode', '(', 'blob', ')', '.', 'decode', '(', "'ascii'", ')']
Converts a PNG blob into a local URL encapsulating the PNG.
['Converts', 'a', 'PNG', 'blob', 'into', 'a', 'local', 'URL', 'encapsulating', 'the', 'PNG', '.']
train
https://github.com/RudolfCardinal/pythonlib/blob/0b84cb35f38bd7d8723958dae51b480a829b7227/cardinal_pythonlib/rnc_web.py#L401-L405
4,333
xypnox/email_purifier
epurifier/email_checker.py
EmailPurifier.CheckEmail
def CheckEmail(self, email, checkTypo=False): '''Checks a Single email if it is correct''' contents = email.split('@') if len(contents) == 2: if contents[1] in self.valid: return True return False
python
def CheckEmail(self, email, checkTypo=False): '''Checks a Single email if it is correct''' contents = email.split('@') if len(contents) == 2: if contents[1] in self.valid: return True return False
['def', 'CheckEmail', '(', 'self', ',', 'email', ',', 'checkTypo', '=', 'False', ')', ':', 'contents', '=', 'email', '.', 'split', '(', "'@'", ')', 'if', 'len', '(', 'contents', ')', '==', '2', ':', 'if', 'contents', '[', '1', ']', 'in', 'self', '.', 'valid', ':', 'return', 'True', 'return', 'False']
Checks a Single email if it is correct
['Checks', 'a', 'Single', 'email', 'if', 'it', 'is', 'correct']
train
https://github.com/xypnox/email_purifier/blob/a9ecde9c5293b5c283e0c5b4cf8744c76418fb6f/epurifier/email_checker.py#L38-L44
4,334
T-002/pycast
pycast/methods/exponentialsmoothing.py
HoltMethod._get_parameter_intervals
def _get_parameter_intervals(self): """Returns the intervals for the methods parameter. Only parameters with defined intervals can be used for optimization! :return: Returns a dictionary containing the parameter intervals, using the parameter name as key, while the value hast th...
python
def _get_parameter_intervals(self): """Returns the intervals for the methods parameter. Only parameters with defined intervals can be used for optimization! :return: Returns a dictionary containing the parameter intervals, using the parameter name as key, while the value hast th...
['def', '_get_parameter_intervals', '(', 'self', ')', ':', 'parameterIntervals', '=', '{', '}', 'parameterIntervals', '[', '"smoothingFactor"', ']', '=', '[', '0.0', ',', '1.0', ',', 'False', ',', 'False', ']', 'parameterIntervals', '[', '"trendSmoothingFactor"', ']', '=', '[', '0.0', ',', '1.0', ',', 'False', ',', 'Fa...
Returns the intervals for the methods parameter. Only parameters with defined intervals can be used for optimization! :return: Returns a dictionary containing the parameter intervals, using the parameter name as key, while the value hast the following format: [minValue, maxV...
['Returns', 'the', 'intervals', 'for', 'the', 'methods', 'parameter', '.']
train
https://github.com/T-002/pycast/blob/8a53505c6d8367e0ea572e8af768e80b29e1cc41/pycast/methods/exponentialsmoothing.py#L178-L204
4,335
senaite/senaite.core
bika/lims/catalog/catalog_utilities.py
setup_catalogs
def setup_catalogs( portal, catalogs_definition={}, force_reindex=False, catalogs_extension={}, force_no_reindex=False): """ Setup the given catalogs. Redefines the map between content types and catalogs and then checks the indexes and metacolumns, if one index/column doesn't exist in th...
python
def setup_catalogs( portal, catalogs_definition={}, force_reindex=False, catalogs_extension={}, force_no_reindex=False): """ Setup the given catalogs. Redefines the map between content types and catalogs and then checks the indexes and metacolumns, if one index/column doesn't exist in th...
['def', 'setup_catalogs', '(', 'portal', ',', 'catalogs_definition', '=', '{', '}', ',', 'force_reindex', '=', 'False', ',', 'catalogs_extension', '=', '{', '}', ',', 'force_no_reindex', '=', 'False', ')', ':', '# If not given catalogs_definition, use the LIMS one', 'if', 'not', 'catalogs_definition', ':', 'catalogs_de...
Setup the given catalogs. Redefines the map between content types and catalogs and then checks the indexes and metacolumns, if one index/column doesn't exist in the catalog_definition any more it will be removed, otherwise, if a new index/column is found, it will be created. :param portal: The Plone's ...
['Setup', 'the', 'given', 'catalogs', '.', 'Redefines', 'the', 'map', 'between', 'content', 'types', 'and', 'catalogs', 'and', 'then', 'checks', 'the', 'indexes', 'and', 'metacolumns', 'if', 'one', 'index', '/', 'column', 'doesn', 't', 'exist', 'in', 'the', 'catalog_definition', 'any', 'more', 'it', 'will', 'be', 'remo...
train
https://github.com/senaite/senaite.core/blob/7602ce2ea2f9e81eb34e20ce17b98a3e70713f85/bika/lims/catalog/catalog_utilities.py#L78-L137
4,336
Erotemic/utool
utool/util_time.py
get_timestats_str
def get_timestats_str(unixtime_list, newlines=1, full=True, isutc=True): r""" Args: unixtime_list (list): newlines (bool): Returns: str: timestat_str CommandLine: python -m utool.util_time --test-get_timestats_str Example: >>> # ENABLE_DOCTEST >>> f...
python
def get_timestats_str(unixtime_list, newlines=1, full=True, isutc=True): r""" Args: unixtime_list (list): newlines (bool): Returns: str: timestat_str CommandLine: python -m utool.util_time --test-get_timestats_str Example: >>> # ENABLE_DOCTEST >>> f...
['def', 'get_timestats_str', '(', 'unixtime_list', ',', 'newlines', '=', '1', ',', 'full', '=', 'True', ',', 'isutc', '=', 'True', ')', ':', 'import', 'utool', 'as', 'ut', 'datetime_stats', '=', 'get_timestats_dict', '(', 'unixtime_list', ',', 'full', '=', 'full', ',', 'isutc', '=', 'isutc', ')', 'timestat_str', '=', '...
r""" Args: unixtime_list (list): newlines (bool): Returns: str: timestat_str CommandLine: python -m utool.util_time --test-get_timestats_str Example: >>> # ENABLE_DOCTEST >>> from utool.util_time import * # NOQA >>> import utool as ut >...
['r', 'Args', ':', 'unixtime_list', '(', 'list', ')', ':', 'newlines', '(', 'bool', ')', ':']
train
https://github.com/Erotemic/utool/blob/3b27e1f4e6e6fb23cd8744af7b7195b57d99e03a/utool/util_time.py#L1015-L1070
4,337
federico123579/Trading212-API
tradingAPI/api.py
API.checkPos
def checkPos(self): """check all positions""" soup = BeautifulSoup(self.css1(path['movs-table']).html, 'html.parser') poss = [] for label in soup.find_all("tr"): pos_id = label['id'] # init an empty list # check if it already exist pos_list...
python
def checkPos(self): """check all positions""" soup = BeautifulSoup(self.css1(path['movs-table']).html, 'html.parser') poss = [] for label in soup.find_all("tr"): pos_id = label['id'] # init an empty list # check if it already exist pos_list...
['def', 'checkPos', '(', 'self', ')', ':', 'soup', '=', 'BeautifulSoup', '(', 'self', '.', 'css1', '(', 'path', '[', "'movs-table'", ']', ')', '.', 'html', ',', "'html.parser'", ')', 'poss', '=', '[', ']', 'for', 'label', 'in', 'soup', '.', 'find_all', '(', '"tr"', ')', ':', 'pos_id', '=', 'label', '[', "'id'", ']', '#...
check all positions
['check', 'all', 'positions']
train
https://github.com/federico123579/Trading212-API/blob/0fab20b71a2348e72bbe76071b81f3692128851f/tradingAPI/api.py#L76-L97
4,338
bububa/pyTOP
pyTOP/trade.py
Trade.receivetime_delay
def receivetime_delay(self, tid, days, session): '''taobao.trade.receivetime.delay 延长交易收货时间 延长交易收货时间''' request = TOPRequest('taobao.trade.receivetime.delay') request['tid'] = tid request['days'] = days self.create(self.execute(request, session)['trade']) ...
python
def receivetime_delay(self, tid, days, session): '''taobao.trade.receivetime.delay 延长交易收货时间 延长交易收货时间''' request = TOPRequest('taobao.trade.receivetime.delay') request['tid'] = tid request['days'] = days self.create(self.execute(request, session)['trade']) ...
['def', 'receivetime_delay', '(', 'self', ',', 'tid', ',', 'days', ',', 'session', ')', ':', 'request', '=', 'TOPRequest', '(', "'taobao.trade.receivetime.delay'", ')', 'request', '[', "'tid'", ']', '=', 'tid', 'request', '[', "'days'", ']', '=', 'days', 'self', '.', 'create', '(', 'self', '.', 'execute', '(', 'request...
taobao.trade.receivetime.delay 延长交易收货时间 延长交易收货时间
['taobao', '.', 'trade', '.', 'receivetime', '.', 'delay', '延长交易收货时间', '延长交易收货时间']
train
https://github.com/bububa/pyTOP/blob/1e48009bcfe886be392628244b370e6374e1f2b2/pyTOP/trade.py#L215-L223
4,339
gregoil/ipdbugger
ipdbugger/__init__.py
IPDBugger.do_raise
def do_raise(self, arg): """Raise the last exception caught.""" self.do_continue(arg) # Annotating the exception for a continual re-raise _, exc_value, _ = self.exc_info exc_value._ipdbugger_let_raise = True raise_(*self.exc_info)
python
def do_raise(self, arg): """Raise the last exception caught.""" self.do_continue(arg) # Annotating the exception for a continual re-raise _, exc_value, _ = self.exc_info exc_value._ipdbugger_let_raise = True raise_(*self.exc_info)
['def', 'do_raise', '(', 'self', ',', 'arg', ')', ':', 'self', '.', 'do_continue', '(', 'arg', ')', '# Annotating the exception for a continual re-raise', '_', ',', 'exc_value', ',', '_', '=', 'self', '.', 'exc_info', 'exc_value', '.', '_ipdbugger_let_raise', '=', 'True', 'raise_', '(', '*', 'self', '.', 'exc_info', ')...
Raise the last exception caught.
['Raise', 'the', 'last', 'exception', 'caught', '.']
train
https://github.com/gregoil/ipdbugger/blob/9575734ec26f6be86ae263496d50eb60bb988b21/ipdbugger/__init__.py#L48-L56
4,340
google/grr
api_client/python/grr_api_client/hunt.py
HuntBase.CreateApproval
def CreateApproval(self, reason=None, notified_users=None, email_cc_addresses=None): """Create a new approval for the current user to access this hunt.""" if not reason: raise ValueError("reason can't be empty") if not notified_users: ...
python
def CreateApproval(self, reason=None, notified_users=None, email_cc_addresses=None): """Create a new approval for the current user to access this hunt.""" if not reason: raise ValueError("reason can't be empty") if not notified_users: ...
['def', 'CreateApproval', '(', 'self', ',', 'reason', '=', 'None', ',', 'notified_users', '=', 'None', ',', 'email_cc_addresses', '=', 'None', ')', ':', 'if', 'not', 'reason', ':', 'raise', 'ValueError', '(', '"reason can\'t be empty"', ')', 'if', 'not', 'notified_users', ':', 'raise', 'ValueError', '(', '"notified_use...
Create a new approval for the current user to access this hunt.
['Create', 'a', 'new', 'approval', 'for', 'the', 'current', 'user', 'to', 'access', 'this', 'hunt', '.']
train
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/api_client/python/grr_api_client/hunt.py#L172-L193
4,341
ga4gh/ga4gh-server
ga4gh/server/repo/rnaseq2ga.py
RnaSqliteStore.addRNAQuantification
def addRNAQuantification(self, datafields): """ Adds an RNAQuantification to the db. Datafields is a tuple in the order: id, feature_set_ids, description, name, read_group_ids, programs, biosample_id """ self._rnaValueList.append(datafields) if len(self._...
python
def addRNAQuantification(self, datafields): """ Adds an RNAQuantification to the db. Datafields is a tuple in the order: id, feature_set_ids, description, name, read_group_ids, programs, biosample_id """ self._rnaValueList.append(datafields) if len(self._...
['def', 'addRNAQuantification', '(', 'self', ',', 'datafields', ')', ':', 'self', '.', '_rnaValueList', '.', 'append', '(', 'datafields', ')', 'if', 'len', '(', 'self', '.', '_rnaValueList', ')', '>=', 'self', '.', '_batchSize', ':', 'self', '.', 'batchaddRNAQuantification', '(', ')']
Adds an RNAQuantification to the db. Datafields is a tuple in the order: id, feature_set_ids, description, name, read_group_ids, programs, biosample_id
['Adds', 'an', 'RNAQuantification', 'to', 'the', 'db', '.', 'Datafields', 'is', 'a', 'tuple', 'in', 'the', 'order', ':', 'id', 'feature_set_ids', 'description', 'name', 'read_group_ids', 'programs', 'biosample_id']
train
https://github.com/ga4gh/ga4gh-server/blob/1aa18922ef136db8604f6f098cb1732cba6f2a76/ga4gh/server/repo/rnaseq2ga.py#L50-L59
4,342
intake/intake
intake/source/utils.py
reverse_format
def reverse_format(format_string, resolved_string): """ Reverse the string method format. Given format_string and resolved_string, find arguments that would give ``format_string.format(**arguments) == resolved_string`` Parameters ---------- format_string : str Format template strin...
python
def reverse_format(format_string, resolved_string): """ Reverse the string method format. Given format_string and resolved_string, find arguments that would give ``format_string.format(**arguments) == resolved_string`` Parameters ---------- format_string : str Format template strin...
['def', 'reverse_format', '(', 'format_string', ',', 'resolved_string', ')', ':', 'from', 'string', 'import', 'Formatter', 'from', 'datetime', 'import', 'datetime', 'fmt', '=', 'Formatter', '(', ')', 'args', '=', '{', '}', '# ensure that format_string is in posix format', 'format_string', '=', 'make_path_posix', '(', '...
Reverse the string method format. Given format_string and resolved_string, find arguments that would give ``format_string.format(**arguments) == resolved_string`` Parameters ---------- format_string : str Format template string as used with str.format method resolved_string : str ...
['Reverse', 'the', 'string', 'method', 'format', '.']
train
https://github.com/intake/intake/blob/277b96bfdee39d8a3048ea5408c6d6716d568336/intake/source/utils.py#L134-L213
4,343
AndrewAnnex/SpiceyPy
spiceypy/spiceypy.py
mxmt
def mxmt(m1, m2): """ Multiply a 3x3 matrix and the transpose of another 3x3 matrix. http://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/mxmt_c.html :param m1: 3x3 double precision matrix. :type m1: 3x3-Element Array of floats :param m2: 3x3 double precision matrix. :type m2: 3x3-Eleme...
python
def mxmt(m1, m2): """ Multiply a 3x3 matrix and the transpose of another 3x3 matrix. http://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/mxmt_c.html :param m1: 3x3 double precision matrix. :type m1: 3x3-Element Array of floats :param m2: 3x3 double precision matrix. :type m2: 3x3-Eleme...
['def', 'mxmt', '(', 'm1', ',', 'm2', ')', ':', 'm1', '=', 'stypes', '.', 'toDoubleMatrix', '(', 'm1', ')', 'm2', '=', 'stypes', '.', 'toDoubleMatrix', '(', 'm2', ')', 'mout', '=', 'stypes', '.', 'emptyDoubleMatrix', '(', ')', 'libspice', '.', 'mxmt_c', '(', 'm1', ',', 'm2', ',', 'mout', ')', 'return', 'stypes', '.', '...
Multiply a 3x3 matrix and the transpose of another 3x3 matrix. http://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/mxmt_c.html :param m1: 3x3 double precision matrix. :type m1: 3x3-Element Array of floats :param m2: 3x3 double precision matrix. :type m2: 3x3-Element Array of floats :return...
['Multiply', 'a', '3x3', 'matrix', 'and', 'the', 'transpose', 'of', 'another', '3x3', 'matrix', '.']
train
https://github.com/AndrewAnnex/SpiceyPy/blob/fc20a9b9de68b58eed5b332f0c051fb343a6e335/spiceypy/spiceypy.py#L8693-L8710
4,344
ramses-tech/ramses
ramses/utils.py
is_callable_tag
def is_callable_tag(tag): """ Determine whether :tag: is a valid callable string tag. String is assumed to be valid callable if it starts with '{{' and ends with '}}'. :param tag: String name of tag. """ return (isinstance(tag, six.string_types) and tag.strip().startswith('{{') and...
python
def is_callable_tag(tag): """ Determine whether :tag: is a valid callable string tag. String is assumed to be valid callable if it starts with '{{' and ends with '}}'. :param tag: String name of tag. """ return (isinstance(tag, six.string_types) and tag.strip().startswith('{{') and...
['def', 'is_callable_tag', '(', 'tag', ')', ':', 'return', '(', 'isinstance', '(', 'tag', ',', 'six', '.', 'string_types', ')', 'and', 'tag', '.', 'strip', '(', ')', '.', 'startswith', '(', "'{{'", ')', 'and', 'tag', '.', 'strip', '(', ')', '.', 'endswith', '(', "'}}'", ')', ')']
Determine whether :tag: is a valid callable string tag. String is assumed to be valid callable if it starts with '{{' and ends with '}}'. :param tag: String name of tag.
['Determine', 'whether', ':', 'tag', ':', 'is', 'a', 'valid', 'callable', 'string', 'tag', '.']
train
https://github.com/ramses-tech/ramses/blob/ea2e1e896325b7256cdf5902309e05fd98e0c14c/ramses/utils.py#L254-L264
4,345
backtrader/backtrader
contrib/utils/influxdb-import.py
InfluxDBTool.write_dataframe_to_idb
def write_dataframe_to_idb(self, ticker): """Write Pandas Dataframe to InfluxDB database""" cachepath = self._cache cachefile = ('%s/%s-1M.csv.gz' % (cachepath, ticker)) if not os.path.exists(cachefile): log.warn('Import file does not exist: %s' % (cache...
python
def write_dataframe_to_idb(self, ticker): """Write Pandas Dataframe to InfluxDB database""" cachepath = self._cache cachefile = ('%s/%s-1M.csv.gz' % (cachepath, ticker)) if not os.path.exists(cachefile): log.warn('Import file does not exist: %s' % (cache...
['def', 'write_dataframe_to_idb', '(', 'self', ',', 'ticker', ')', ':', 'cachepath', '=', 'self', '.', '_cache', 'cachefile', '=', '(', "'%s/%s-1M.csv.gz'", '%', '(', 'cachepath', ',', 'ticker', ')', ')', 'if', 'not', 'os', '.', 'path', '.', 'exists', '(', 'cachefile', ')', ':', 'log', '.', 'warn', '(', "'Import file d...
Write Pandas Dataframe to InfluxDB database
['Write', 'Pandas', 'Dataframe', 'to', 'InfluxDB', 'database']
train
https://github.com/backtrader/backtrader/blob/59ee9521f9887c2a1030c6f1db8c918a5816fd64/contrib/utils/influxdb-import.py#L29-L49
4,346
openstack/networking-cisco
networking_cisco/ml2_drivers/nexus/nexus_db_v2.py
get_nve_vni_switch_bindings
def get_nve_vni_switch_bindings(vni, switch_ip): """Return the nexus nve binding(s) per switch.""" LOG.debug("get_nve_vni_switch_bindings() called") session = bc.get_reader_session() try: return (session.query(nexus_models_v2.NexusNVEBinding). filter_by(vni=vni, switch_ip=switch_...
python
def get_nve_vni_switch_bindings(vni, switch_ip): """Return the nexus nve binding(s) per switch.""" LOG.debug("get_nve_vni_switch_bindings() called") session = bc.get_reader_session() try: return (session.query(nexus_models_v2.NexusNVEBinding). filter_by(vni=vni, switch_ip=switch_...
['def', 'get_nve_vni_switch_bindings', '(', 'vni', ',', 'switch_ip', ')', ':', 'LOG', '.', 'debug', '(', '"get_nve_vni_switch_bindings() called"', ')', 'session', '=', 'bc', '.', 'get_reader_session', '(', ')', 'try', ':', 'return', '(', 'session', '.', 'query', '(', 'nexus_models_v2', '.', 'NexusNVEBinding', ')', '.',...
Return the nexus nve binding(s) per switch.
['Return', 'the', 'nexus', 'nve', 'binding', '(', 's', ')', 'per', 'switch', '.']
train
https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/ml2_drivers/nexus/nexus_db_v2.py#L399-L407
4,347
dj-stripe/dj-stripe
djstripe/models/billing.py
Invoice.retry
def retry(self): """ Retry payment on this invoice if it isn't paid, closed, or forgiven.""" if not self.paid and not self.forgiven and not self.closed: stripe_invoice = self.api_retrieve() updated_stripe_invoice = ( stripe_invoice.pay() ) # pay() throws an exception if the charge is not successful. ...
python
def retry(self): """ Retry payment on this invoice if it isn't paid, closed, or forgiven.""" if not self.paid and not self.forgiven and not self.closed: stripe_invoice = self.api_retrieve() updated_stripe_invoice = ( stripe_invoice.pay() ) # pay() throws an exception if the charge is not successful. ...
['def', 'retry', '(', 'self', ')', ':', 'if', 'not', 'self', '.', 'paid', 'and', 'not', 'self', '.', 'forgiven', 'and', 'not', 'self', '.', 'closed', ':', 'stripe_invoice', '=', 'self', '.', 'api_retrieve', '(', ')', 'updated_stripe_invoice', '=', '(', 'stripe_invoice', '.', 'pay', '(', ')', ')', '# pay() throws an exc...
Retry payment on this invoice if it isn't paid, closed, or forgiven.
['Retry', 'payment', 'on', 'this', 'invoice', 'if', 'it', 'isn', 't', 'paid', 'closed', 'or', 'forgiven', '.']
train
https://github.com/dj-stripe/dj-stripe/blob/a5308a3808cd6e2baba49482f7a699f3a8992518/djstripe/models/billing.py#L437-L447
4,348
sdispater/cachy
cachy/tagged_cache.py
TaggedCache.add
def add(self, key, val, minutes): """ Store an item in the cache if it does not exist. :param key: The cache key :type key: str :param val: The cache value :type val: mixed :param minutes: The lifetime in minutes of the cached value :type minutes: int|d...
python
def add(self, key, val, minutes): """ Store an item in the cache if it does not exist. :param key: The cache key :type key: str :param val: The cache value :type val: mixed :param minutes: The lifetime in minutes of the cached value :type minutes: int|d...
['def', 'add', '(', 'self', ',', 'key', ',', 'val', ',', 'minutes', ')', ':', 'if', 'not', 'self', '.', 'has', '(', 'key', ')', ':', 'self', '.', 'put', '(', 'key', ',', 'val', ',', 'minutes', ')', 'return', 'True', 'return', 'False']
Store an item in the cache if it does not exist. :param key: The cache key :type key: str :param val: The cache value :type val: mixed :param minutes: The lifetime in minutes of the cached value :type minutes: int|datetime :rtype: bool
['Store', 'an', 'item', 'in', 'the', 'cache', 'if', 'it', 'does', 'not', 'exist', '.']
train
https://github.com/sdispater/cachy/blob/ee4b044d6aafa80125730a00b1f679a7bd852b8a/cachy/tagged_cache.py#L74-L94
4,349
calmjs/calmjs
src/calmjs/toolchain.py
Toolchain.compile_bundle_entry
def compile_bundle_entry(self, spec, entry): """ Handler for each entry for the bundle method of the compile process. This copies the source file or directory into the build directory. """ modname, source, target, modpath = entry bundled_modpath = {modname: modp...
python
def compile_bundle_entry(self, spec, entry): """ Handler for each entry for the bundle method of the compile process. This copies the source file or directory into the build directory. """ modname, source, target, modpath = entry bundled_modpath = {modname: modp...
['def', 'compile_bundle_entry', '(', 'self', ',', 'spec', ',', 'entry', ')', ':', 'modname', ',', 'source', ',', 'target', ',', 'modpath', '=', 'entry', 'bundled_modpath', '=', '{', 'modname', ':', 'modpath', '}', 'bundled_target', '=', '{', 'modname', ':', 'target', '}', 'export_module_name', '=', '[', ']', 'if', 'isf...
Handler for each entry for the bundle method of the compile process. This copies the source file or directory into the build directory.
['Handler', 'for', 'each', 'entry', 'for', 'the', 'bundle', 'method', 'of', 'the', 'compile', 'process', '.', 'This', 'copies', 'the', 'source', 'file', 'or', 'directory', 'into', 'the', 'build', 'directory', '.']
train
https://github.com/calmjs/calmjs/blob/b9b407c2b6a7662da64bccba93bb8d92e7a5fafd/src/calmjs/toolchain.py#L1202-L1223
4,350
openstack/horizon
openstack_dashboard/api/keystone.py
remove_group_roles
def remove_group_roles(request, group, domain=None, project=None): """Removes all roles from a group on a domain or project.""" client = keystoneclient(request, admin=True) roles = client.roles.list(group=group, domain=domain, project=project) for role in roles: remove_group_role(request, role=r...
python
def remove_group_roles(request, group, domain=None, project=None): """Removes all roles from a group on a domain or project.""" client = keystoneclient(request, admin=True) roles = client.roles.list(group=group, domain=domain, project=project) for role in roles: remove_group_role(request, role=r...
['def', 'remove_group_roles', '(', 'request', ',', 'group', ',', 'domain', '=', 'None', ',', 'project', '=', 'None', ')', ':', 'client', '=', 'keystoneclient', '(', 'request', ',', 'admin', '=', 'True', ')', 'roles', '=', 'client', '.', 'roles', '.', 'list', '(', 'group', '=', 'group', ',', 'domain', '=', 'domain', ','...
Removes all roles from a group on a domain or project.
['Removes', 'all', 'roles', 'from', 'a', 'group', 'on', 'a', 'domain', 'or', 'project', '.']
train
https://github.com/openstack/horizon/blob/5601ea9477323e599d9b766fcac1f8be742935b2/openstack_dashboard/api/keystone.py#L886-L892
4,351
wright-group/WrightTools
WrightTools/data/_channel.py
Channel.normalize
def normalize(self, mag=1.): """Normalize a Channel, set `null` to 0 and the mag to given value. Parameters ---------- mag : float (optional) New value of mag. Default is 1. """ def f(dataset, s, null, mag): dataset[s] -= null dataset...
python
def normalize(self, mag=1.): """Normalize a Channel, set `null` to 0 and the mag to given value. Parameters ---------- mag : float (optional) New value of mag. Default is 1. """ def f(dataset, s, null, mag): dataset[s] -= null dataset...
['def', 'normalize', '(', 'self', ',', 'mag', '=', '1.', ')', ':', 'def', 'f', '(', 'dataset', ',', 's', ',', 'null', ',', 'mag', ')', ':', 'dataset', '[', 's', ']', '-=', 'null', 'dataset', '[', 's', ']', '/=', 'mag', 'if', 'self', '.', 'signed', ':', 'mag', '=', 'self', '.', 'mag', '(', ')', '/', 'mag', 'else', ':', ...
Normalize a Channel, set `null` to 0 and the mag to given value. Parameters ---------- mag : float (optional) New value of mag. Default is 1.
['Normalize', 'a', 'Channel', 'set', 'null', 'to', '0', 'and', 'the', 'mag', 'to', 'given', 'value', '.']
train
https://github.com/wright-group/WrightTools/blob/80d3ddd5074d8d5c1bc03fd5a0e0f10d4b424aeb/WrightTools/data/_channel.py#L115-L133
4,352
syrusakbary/promise
promise/dataloader.py
DataLoader.load_many
def load_many(self, keys): # type: (Iterable[Hashable]) -> Promise """ Loads multiple keys, promising an array of values >>> a, b = await my_loader.load_many([ 'a', 'b' ]) This is equivalent to the more verbose: >>> a, b = await Promise.all([ >>> my_loader.l...
python
def load_many(self, keys): # type: (Iterable[Hashable]) -> Promise """ Loads multiple keys, promising an array of values >>> a, b = await my_loader.load_many([ 'a', 'b' ]) This is equivalent to the more verbose: >>> a, b = await Promise.all([ >>> my_loader.l...
['def', 'load_many', '(', 'self', ',', 'keys', ')', ':', '# type: (Iterable[Hashable]) -> Promise', 'if', 'not', 'isinstance', '(', 'keys', ',', 'Iterable', ')', ':', 'raise', 'TypeError', '(', '(', '"The loader.loadMany() function must be called with Array<key> "', '+', '"but got: {}."', ')', '.', 'format', '(', 'keys...
Loads multiple keys, promising an array of values >>> a, b = await my_loader.load_many([ 'a', 'b' ]) This is equivalent to the more verbose: >>> a, b = await Promise.all([ >>> my_loader.load('a'), >>> my_loader.load('b') >>> ])
['Loads', 'multiple', 'keys', 'promising', 'an', 'array', 'of', 'values']
train
https://github.com/syrusakbary/promise/blob/d80d791fcc86c89713dac57b55e56c0a9024f153/promise/dataloader.py#L126-L148
4,353
saltstack/salt
salt/modules/pcs.py
resource_show
def resource_show(resource_id, extra_args=None, cibfile=None): ''' Show a resource via pcs command resource_id name of the resource extra_args additional options for the pcs command cibfile use cibfile instead of the live CIB CLI Example: .. code-block:: bash ...
python
def resource_show(resource_id, extra_args=None, cibfile=None): ''' Show a resource via pcs command resource_id name of the resource extra_args additional options for the pcs command cibfile use cibfile instead of the live CIB CLI Example: .. code-block:: bash ...
['def', 'resource_show', '(', 'resource_id', ',', 'extra_args', '=', 'None', ',', 'cibfile', '=', 'None', ')', ':', 'return', 'item_show', '(', 'item', '=', "'resource'", ',', 'item_id', '=', 'resource_id', ',', 'extra_args', '=', 'extra_args', ',', 'cibfile', '=', 'cibfile', ')']
Show a resource via pcs command resource_id name of the resource extra_args additional options for the pcs command cibfile use cibfile instead of the live CIB CLI Example: .. code-block:: bash salt '*' pcs.resource_show resource_id='galera' cibfile='/tmp/cib_for_g...
['Show', 'a', 'resource', 'via', 'pcs', 'command']
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/pcs.py#L400-L417
4,354
dmlc/gluon-nlp
src/gluonnlp/data/transforms.py
BERTTokenizer._tokenize_wordpiece
def _tokenize_wordpiece(self, text): """Tokenizes a piece of text into its word pieces. This uses a greedy longest-match-first algorithm to perform tokenization using the given vocabulary. For example: input = "unaffable" output = ["un", "##aff", "##able"] ...
python
def _tokenize_wordpiece(self, text): """Tokenizes a piece of text into its word pieces. This uses a greedy longest-match-first algorithm to perform tokenization using the given vocabulary. For example: input = "unaffable" output = ["un", "##aff", "##able"] ...
['def', '_tokenize_wordpiece', '(', 'self', ',', 'text', ')', ':', 'output_tokens', '=', '[', ']', 'for', 'token', 'in', 'self', '.', 'basic_tokenizer', '.', '_whitespace_tokenize', '(', 'text', ')', ':', 'chars', '=', 'list', '(', 'token', ')', 'if', 'len', '(', 'chars', ')', '>', 'self', '.', 'max_input_chars_per_wor...
Tokenizes a piece of text into its word pieces. This uses a greedy longest-match-first algorithm to perform tokenization using the given vocabulary. For example: input = "unaffable" output = ["un", "##aff", "##able"] Args: text: A single token or whitespa...
['Tokenizes', 'a', 'piece', 'of', 'text', 'into', 'its', 'word', 'pieces', '.']
train
https://github.com/dmlc/gluon-nlp/blob/4b83eb6bcc8881e5f1081a3675adaa19fac5c0ba/src/gluonnlp/data/transforms.py#L960-L1007
4,355
pgmpy/pgmpy
pgmpy/readwrite/ProbModelXML.py
ProbModelXMLReader.get_model
def get_model(self): """ Returns the model instance of the ProbModel. Return --------------- model: an instance of BayesianModel. Examples ------- >>> reader = ProbModelXMLReader() >>> reader.get_model() """ if self.probnet.get('t...
python
def get_model(self): """ Returns the model instance of the ProbModel. Return --------------- model: an instance of BayesianModel. Examples ------- >>> reader = ProbModelXMLReader() >>> reader.get_model() """ if self.probnet.get('t...
['def', 'get_model', '(', 'self', ')', ':', 'if', 'self', '.', 'probnet', '.', 'get', '(', "'type'", ')', '==', '"BayesianNetwork"', ':', 'model', '=', 'BayesianModel', '(', ')', 'model', '.', 'add_nodes_from', '(', 'self', '.', 'probnet', '[', "'Variables'", ']', '.', 'keys', '(', ')', ')', 'model', '.', 'add_edges_fr...
Returns the model instance of the ProbModel. Return --------------- model: an instance of BayesianModel. Examples ------- >>> reader = ProbModelXMLReader() >>> reader.get_model()
['Returns', 'the', 'model', 'instance', 'of', 'the', 'ProbModel', '.']
train
https://github.com/pgmpy/pgmpy/blob/9381a66aba3c3871d3ccd00672b148d17d63239e/pgmpy/readwrite/ProbModelXML.py#L1019-L1068
4,356
manns/pyspread
pyspread/src/actions/_main_window_actions.py
PrintActions.print_preview
def print_preview(self, print_area, print_data): """Launch print preview""" if cairo is None: return print_info = \ self.main_window.interfaces.get_cairo_export_info("Print") if print_info is None: # Dialog has been canceled return ...
python
def print_preview(self, print_area, print_data): """Launch print preview""" if cairo is None: return print_info = \ self.main_window.interfaces.get_cairo_export_info("Print") if print_info is None: # Dialog has been canceled return ...
['def', 'print_preview', '(', 'self', ',', 'print_area', ',', 'print_data', ')', ':', 'if', 'cairo', 'is', 'None', ':', 'return', 'print_info', '=', 'self', '.', 'main_window', '.', 'interfaces', '.', 'get_cairo_export_info', '(', '"Print"', ')', 'if', 'print_info', 'is', 'None', ':', '# Dialog has been canceled', 'ret...
Launch print preview
['Launch', 'print', 'preview']
train
https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/actions/_main_window_actions.py#L325-L353
4,357
dslackw/slpkg
slpkg/main.py
ArgParse.bin_remove
def bin_remove(self): """Remove Slackware packages """ packages = self.args[1:] options = [ "-r", "--removepkg" ] additional_options = [ "--deps", "--check-deps", "--tag", "--checklist" ] ...
python
def bin_remove(self): """Remove Slackware packages """ packages = self.args[1:] options = [ "-r", "--removepkg" ] additional_options = [ "--deps", "--check-deps", "--tag", "--checklist" ] ...
['def', 'bin_remove', '(', 'self', ')', ':', 'packages', '=', 'self', '.', 'args', '[', '1', ':', ']', 'options', '=', '[', '"-r"', ',', '"--removepkg"', ']', 'additional_options', '=', '[', '"--deps"', ',', '"--check-deps"', ',', '"--tag"', ',', '"--checklist"', ']', 'flag', ',', 'extra', '=', '""', ',', '[', ']', 'fl...
Remove Slackware packages
['Remove', 'Slackware', 'packages']
train
https://github.com/dslackw/slpkg/blob/dd2e08a80e944d337d157b992167ba631a4343de/slpkg/main.py#L570-L607
4,358
pjuren/pyokit
src/pyokit/scripts/join.py
get_key_field
def get_key_field(ui, ui_option_name, default_val=0, default_is_number=True): """ parse an option from a UI object as the name of a key field. If the named option is not set, return the default values for the tuple. :return: a tuple of two items, first is the value of the option, second is ...
python
def get_key_field(ui, ui_option_name, default_val=0, default_is_number=True): """ parse an option from a UI object as the name of a key field. If the named option is not set, return the default values for the tuple. :return: a tuple of two items, first is the value of the option, second is ...
['def', 'get_key_field', '(', 'ui', ',', 'ui_option_name', ',', 'default_val', '=', '0', ',', 'default_is_number', '=', 'True', ')', ':', 'key', '=', 'default_val', 'key_is_field_number', '=', 'default_is_number', 'if', 'ui', '.', 'optionIsSet', '(', 'ui_option_name', ')', ':', 'key', '=', 'ui', '.', 'getValue', '(', '...
parse an option from a UI object as the name of a key field. If the named option is not set, return the default values for the tuple. :return: a tuple of two items, first is the value of the option, second is a boolean value that indicates whether the value is a column name or a colu...
['parse', 'an', 'option', 'from', 'a', 'UI', 'object', 'as', 'the', 'name', 'of', 'a', 'key', 'field', '.']
train
https://github.com/pjuren/pyokit/blob/fddae123b5d817daa39496183f19c000d9c3791f/src/pyokit/scripts/join.py#L511-L530
4,359
mosdef-hub/mbuild
mbuild/compound.py
Compound.to_trajectory
def to_trajectory(self, show_ports=False, chains=None, residues=None, box=None): """Convert to an md.Trajectory and flatten the compound. Parameters ---------- show_ports : bool, optional, default=False Include all port atoms when converting to trajecto...
python
def to_trajectory(self, show_ports=False, chains=None, residues=None, box=None): """Convert to an md.Trajectory and flatten the compound. Parameters ---------- show_ports : bool, optional, default=False Include all port atoms when converting to trajecto...
['def', 'to_trajectory', '(', 'self', ',', 'show_ports', '=', 'False', ',', 'chains', '=', 'None', ',', 'residues', '=', 'None', ',', 'box', '=', 'None', ')', ':', 'atom_list', '=', '[', 'particle', 'for', 'particle', 'in', 'self', '.', 'particles', '(', 'show_ports', ')', ']', 'top', '=', 'self', '.', '_to_topology', ...
Convert to an md.Trajectory and flatten the compound. Parameters ---------- show_ports : bool, optional, default=False Include all port atoms when converting to trajectory. chains : mb.Compound or list of mb.Compound Chain types to add to the topology res...
['Convert', 'to', 'an', 'md', '.', 'Trajectory', 'and', 'flatten', 'the', 'compound', '.']
train
https://github.com/mosdef-hub/mbuild/blob/dcb80a2becd5d0e6a7e3e7bcb1b59793c46a2dd3/mbuild/compound.py#L1879-L1931
4,360
SatelliteQE/nailgun
nailgun/entity_mixins.py
_get_entity_id
def _get_entity_id(field_name, attrs): """Find the ID for a one to one relationship. The server may return JSON data in the following forms for a :class:`nailgun.entity_fields.OneToOneField`:: 'user': None 'user': {'name': 'Alice Hayes', 'login': 'ahayes', 'id': 1} 'user_id': 1 ...
python
def _get_entity_id(field_name, attrs): """Find the ID for a one to one relationship. The server may return JSON data in the following forms for a :class:`nailgun.entity_fields.OneToOneField`:: 'user': None 'user': {'name': 'Alice Hayes', 'login': 'ahayes', 'id': 1} 'user_id': 1 ...
['def', '_get_entity_id', '(', 'field_name', ',', 'attrs', ')', ':', 'field_name_id', '=', 'field_name', '+', "'_id'", 'if', 'field_name', 'in', 'attrs', ':', 'if', 'attrs', '[', 'field_name', ']', 'is', 'None', ':', 'return', 'None', 'elif', "'id'", 'in', 'attrs', '[', 'field_name', ']', ':', 'return', 'attrs', '[', '...
Find the ID for a one to one relationship. The server may return JSON data in the following forms for a :class:`nailgun.entity_fields.OneToOneField`:: 'user': None 'user': {'name': 'Alice Hayes', 'login': 'ahayes', 'id': 1} 'user_id': 1 'user_id': None Search ``attrs`` for...
['Find', 'the', 'ID', 'for', 'a', 'one', 'to', 'one', 'relationship', '.']
train
https://github.com/SatelliteQE/nailgun/blob/c36d8c20862e87bf6975bd48ac1ca40a9e634eaa/nailgun/entity_mixins.py#L226-L257
4,361
LuqueDaniel/pybooru
pybooru/api_danbooru.py
DanbooruApi_Mixin.favorite_remove
def favorite_remove(self, post_id): """Remove a post from favorites (Requires login). Parameters: post_id (int): Where post_id is the post id. """ return self._get('favorites/{0}.json'.format(post_id), method='DELETE', auth=True)
python
def favorite_remove(self, post_id): """Remove a post from favorites (Requires login). Parameters: post_id (int): Where post_id is the post id. """ return self._get('favorites/{0}.json'.format(post_id), method='DELETE', auth=True)
['def', 'favorite_remove', '(', 'self', ',', 'post_id', ')', ':', 'return', 'self', '.', '_get', '(', "'favorites/{0}.json'", '.', 'format', '(', 'post_id', ')', ',', 'method', '=', "'DELETE'", ',', 'auth', '=', 'True', ')']
Remove a post from favorites (Requires login). Parameters: post_id (int): Where post_id is the post id.
['Remove', 'a', 'post', 'from', 'favorites', '(', 'Requires', 'login', ')', '.']
train
https://github.com/LuqueDaniel/pybooru/blob/60cd5254684d293b308f0b11b8f4ac2dce101479/pybooru/api_danbooru.py#L431-L438
4,362
spyder-ide/spyder
spyder/utils/syntaxhighlighters.py
PygmentsSH.highlightBlock
def highlightBlock(self, text): """ Actually highlight the block""" # Note that an undefined blockstate is equal to -1, so the first block # will have the correct behaviour of starting at 0. if self._allow_highlight: start = self.previousBlockState() + 1 end...
python
def highlightBlock(self, text): """ Actually highlight the block""" # Note that an undefined blockstate is equal to -1, so the first block # will have the correct behaviour of starting at 0. if self._allow_highlight: start = self.previousBlockState() + 1 end...
['def', 'highlightBlock', '(', 'self', ',', 'text', ')', ':', '# Note that an undefined blockstate is equal to -1, so the first block\r', '# will have the correct behaviour of starting at 0.\r', 'if', 'self', '.', '_allow_highlight', ':', 'start', '=', 'self', '.', 'previousBlockState', '(', ')', '+', '1', 'end', '=', ...
Actually highlight the block
['Actually', 'highlight', 'the', 'block']
train
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/syntaxhighlighters.py#L1220-L1230
4,363
incf-nidash/nidmresults
nidmresults/objects/modelfitting.py
Group.export
def export(self, nidm_version, export_dir): """ Create prov entities and activities. """ self.add_attributes(( (PROV['type'], self.type), (NIDM_GROUP_NAME, self.group_name), (NIDM_NUMBER_OF_SUBJECTS, self.num_subjects), (PROV['label'], self...
python
def export(self, nidm_version, export_dir): """ Create prov entities and activities. """ self.add_attributes(( (PROV['type'], self.type), (NIDM_GROUP_NAME, self.group_name), (NIDM_NUMBER_OF_SUBJECTS, self.num_subjects), (PROV['label'], self...
['def', 'export', '(', 'self', ',', 'nidm_version', ',', 'export_dir', ')', ':', 'self', '.', 'add_attributes', '(', '(', '(', 'PROV', '[', "'type'", ']', ',', 'self', '.', 'type', ')', ',', '(', 'NIDM_GROUP_NAME', ',', 'self', '.', 'group_name', ')', ',', '(', 'NIDM_NUMBER_OF_SUBJECTS', ',', 'self', '.', 'num_subjects...
Create prov entities and activities.
['Create', 'prov', 'entities', 'and', 'activities', '.']
train
https://github.com/incf-nidash/nidmresults/blob/438f7cce6abc4a4379b629bd76f4d427891e033f/nidmresults/objects/modelfitting.py#L160-L168
4,364
senaite/senaite.core
bika/lims/browser/worksheet/views/analyses.py
AnalysesView.folderitems
def folderitems(self): """Returns an array of dictionaries, each dictionary represents an analysis row to be rendered in the list. The array returned is sorted in accordance with the layout positions set for the analyses this worksheet contains when the analyses were added in the workshe...
python
def folderitems(self): """Returns an array of dictionaries, each dictionary represents an analysis row to be rendered in the list. The array returned is sorted in accordance with the layout positions set for the analyses this worksheet contains when the analyses were added in the workshe...
['def', 'folderitems', '(', 'self', ')', ':', 'items', '=', 'BaseView', '.', 'folderitems', '(', 'self', ')', '# Fill empty positions from the layout with fake rows. The worksheet', '# can be generated by making use of a WorksheetTemplate, so there is', '# the chance that some slots of this worksheet being empty. We ne...
Returns an array of dictionaries, each dictionary represents an analysis row to be rendered in the list. The array returned is sorted in accordance with the layout positions set for the analyses this worksheet contains when the analyses were added in the worksheet. :returns: list of dic...
['Returns', 'an', 'array', 'of', 'dictionaries', 'each', 'dictionary', 'represents', 'an', 'analysis', 'row', 'to', 'be', 'rendered', 'in', 'the', 'list', '.', 'The', 'array', 'returned', 'is', 'sorted', 'in', 'accordance', 'with', 'the', 'layout', 'positions', 'set', 'for', 'the', 'analyses', 'this', 'worksheet', 'con...
train
https://github.com/senaite/senaite.core/blob/7602ce2ea2f9e81eb34e20ce17b98a3e70713f85/bika/lims/browser/worksheet/views/analyses.py#L209-L234
4,365
materialsproject/pymatgen
pymatgen/core/spectrum.py
Spectrum.get_interpolated_value
def get_interpolated_value(self, x): """ Returns an interpolated y value for a particular x value. Args: x: x value to return the y value for Returns: Value of y at x """ if len(self.ydim) == 1: return get_linear_interpolated_value(s...
python
def get_interpolated_value(self, x): """ Returns an interpolated y value for a particular x value. Args: x: x value to return the y value for Returns: Value of y at x """ if len(self.ydim) == 1: return get_linear_interpolated_value(s...
['def', 'get_interpolated_value', '(', 'self', ',', 'x', ')', ':', 'if', 'len', '(', 'self', '.', 'ydim', ')', '==', '1', ':', 'return', 'get_linear_interpolated_value', '(', 'self', '.', 'x', ',', 'self', '.', 'y', ',', 'x', ')', 'else', ':', 'return', '[', 'get_linear_interpolated_value', '(', 'self', '.', 'x', ',', ...
Returns an interpolated y value for a particular x value. Args: x: x value to return the y value for Returns: Value of y at x
['Returns', 'an', 'interpolated', 'y', 'value', 'for', 'a', 'particular', 'x', 'value', '.']
train
https://github.com/materialsproject/pymatgen/blob/4ca558cf72f8d5f8a1f21dfdfc0181a971c186da/pymatgen/core/spectrum.py#L105-L119
4,366
playpauseandstop/rororo
rororo/settings.py
from_env
def from_env(key: str, default: T = None) -> Union[str, Optional[T]]: """Shortcut for safely reading environment variable. :param key: Environment var key. :param default: Return default value if environment var not found by given key. By default: ``None`` """ return os.getenv(key, ...
python
def from_env(key: str, default: T = None) -> Union[str, Optional[T]]: """Shortcut for safely reading environment variable. :param key: Environment var key. :param default: Return default value if environment var not found by given key. By default: ``None`` """ return os.getenv(key, ...
['def', 'from_env', '(', 'key', ':', 'str', ',', 'default', ':', 'T', '=', 'None', ')', '->', 'Union', '[', 'str', ',', 'Optional', '[', 'T', ']', ']', ':', 'return', 'os', '.', 'getenv', '(', 'key', ',', 'default', ')']
Shortcut for safely reading environment variable. :param key: Environment var key. :param default: Return default value if environment var not found by given key. By default: ``None``
['Shortcut', 'for', 'safely', 'reading', 'environment', 'variable', '.']
train
https://github.com/playpauseandstop/rororo/blob/28a04e8028c29647941e727116335e9d6fd64c27/rororo/settings.py#L26-L34
4,367
cherrypy/cheroot
cheroot/server.py
HTTPServer.stop
def stop(self): """Gracefully shutdown a server that is serving forever.""" self.ready = False if self._start_time is not None: self._run_time += (time.time() - self._start_time) self._start_time = None sock = getattr(self, 'socket', None) if sock: ...
python
def stop(self): """Gracefully shutdown a server that is serving forever.""" self.ready = False if self._start_time is not None: self._run_time += (time.time() - self._start_time) self._start_time = None sock = getattr(self, 'socket', None) if sock: ...
['def', 'stop', '(', 'self', ')', ':', 'self', '.', 'ready', '=', 'False', 'if', 'self', '.', '_start_time', 'is', 'not', 'None', ':', 'self', '.', '_run_time', '+=', '(', 'time', '.', 'time', '(', ')', '-', 'self', '.', '_start_time', ')', 'self', '.', '_start_time', '=', 'None', 'sock', '=', 'getattr', '(', 'self', '...
Gracefully shutdown a server that is serving forever.
['Gracefully', 'shutdown', 'a', 'server', 'that', 'is', 'serving', 'forever', '.']
train
https://github.com/cherrypy/cheroot/blob/2af3b1798d66da697957480d3a8b4831a405770b/cheroot/server.py#L2087-L2132
4,368
rueckstiess/mtools
mtools/mlaunch/mlaunch.py
MLaunchTool._load_parameters
def _load_parameters(self): """ Load the .mlaunch_startup file that exists in each datadir. Handles different protocol versions. """ datapath = self.dir startup_file = os.path.join(datapath, '.mlaunch_startup') if not os.path.exists(startup_file): re...
python
def _load_parameters(self): """ Load the .mlaunch_startup file that exists in each datadir. Handles different protocol versions. """ datapath = self.dir startup_file = os.path.join(datapath, '.mlaunch_startup') if not os.path.exists(startup_file): re...
['def', '_load_parameters', '(', 'self', ')', ':', 'datapath', '=', 'self', '.', 'dir', 'startup_file', '=', 'os', '.', 'path', '.', 'join', '(', 'datapath', ',', "'.mlaunch_startup'", ')', 'if', 'not', 'os', '.', 'path', '.', 'exists', '(', 'startup_file', ')', ':', 'return', 'False', 'in_dict', '=', 'json', '.', 'loa...
Load the .mlaunch_startup file that exists in each datadir. Handles different protocol versions.
['Load', 'the', '.', 'mlaunch_startup', 'file', 'that', 'exists', 'in', 'each', 'datadir', '.']
train
https://github.com/rueckstiess/mtools/blob/a6a22910c3569c0c8a3908660ca218a4557e4249/mtools/mlaunch/mlaunch.py#L1378-L1410
4,369
volafiled/python-volapi
volapi/handler.py
Handler._handle_files
def _handle_files(self, data): """Handle new files being uploaded""" initial = data.get("set", False) files = data["files"] for f in files: try: fobj = File( self.room, self.conn, f[0], ...
python
def _handle_files(self, data): """Handle new files being uploaded""" initial = data.get("set", False) files = data["files"] for f in files: try: fobj = File( self.room, self.conn, f[0], ...
['def', '_handle_files', '(', 'self', ',', 'data', ')', ':', 'initial', '=', 'data', '.', 'get', '(', '"set"', ',', 'False', ')', 'files', '=', 'data', '[', '"files"', ']', 'for', 'f', 'in', 'files', ':', 'try', ':', 'fobj', '=', 'File', '(', 'self', '.', 'room', ',', 'self', '.', 'conn', ',', 'f', '[', '0', ']', ',', ...
Handle new files being uploaded
['Handle', 'new', 'files', 'being', 'uploaded']
train
https://github.com/volafiled/python-volapi/blob/5f0bc03dbde703264ac6ed494e2050761f688a3e/volapi/handler.py#L151-L177
4,370
obriencj/python-javatools
javatools/distinfo.py
DistInfo.get_provides
def get_provides(self, ignored=tuple()): """ a map of provided classes and class members, and what provides them. ignored is an optional list of globbed patterns indicating packages, classes, etc that shouldn't be included in the provides map""" if self._provides is None: ...
python
def get_provides(self, ignored=tuple()): """ a map of provided classes and class members, and what provides them. ignored is an optional list of globbed patterns indicating packages, classes, etc that shouldn't be included in the provides map""" if self._provides is None: ...
['def', 'get_provides', '(', 'self', ',', 'ignored', '=', 'tuple', '(', ')', ')', ':', 'if', 'self', '.', '_provides', 'is', 'None', ':', 'self', '.', '_collect_requires_provides', '(', ')', 'd', '=', 'self', '.', '_provides', 'if', 'ignored', ':', 'd', '=', 'dict', '(', '(', 'k', ',', 'v', ')', 'for', 'k', ',', 'v', '...
a map of provided classes and class members, and what provides them. ignored is an optional list of globbed patterns indicating packages, classes, etc that shouldn't be included in the provides map
['a', 'map', 'of', 'provided', 'classes', 'and', 'class', 'members', 'and', 'what', 'provides', 'them', '.', 'ignored', 'is', 'an', 'optional', 'list', 'of', 'globbed', 'patterns', 'indicating', 'packages', 'classes', 'etc', 'that', 'shouldn', 't', 'be', 'included', 'in', 'the', 'provides', 'map']
train
https://github.com/obriencj/python-javatools/blob/9e2332b452ddc508bed0615937dddcb2cf051557/javatools/distinfo.py#L131-L144
4,371
ARMmbed/mbed-cloud-sdk-python
src/mbed_cloud/_backends/external_ca/apis/certificate_issuers_api.py
CertificateIssuersApi.get_certificate_issuer
def get_certificate_issuer(self, certificate_issuer_id, **kwargs): # noqa: E501 """Get certificate issuer by ID. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass asynchronous=True >>> thread = api.get_certificate_i...
python
def get_certificate_issuer(self, certificate_issuer_id, **kwargs): # noqa: E501 """Get certificate issuer by ID. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass asynchronous=True >>> thread = api.get_certificate_i...
['def', 'get_certificate_issuer', '(', 'self', ',', 'certificate_issuer_id', ',', '*', '*', 'kwargs', ')', ':', '# noqa: E501', 'kwargs', '[', "'_return_http_data_only'", ']', '=', 'True', 'if', 'kwargs', '.', 'get', '(', "'asynchronous'", ')', ':', 'return', 'self', '.', 'get_certificate_issuer_with_http_info', '(', '...
Get certificate issuer by ID. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass asynchronous=True >>> thread = api.get_certificate_issuer(certificate_issuer_id, asynchronous=True) >>> result = thread.get() :...
['Get', 'certificate', 'issuer', 'by', 'ID', '.', '#', 'noqa', ':', 'E501']
train
https://github.com/ARMmbed/mbed-cloud-sdk-python/blob/c0af86fb2cdd4dc7ed26f236139241067d293509/src/mbed_cloud/_backends/external_ca/apis/certificate_issuers_api.py#L234-L253
4,372
vicenteneto/python-cartolafc
cartolafc/api.py
Api.times
def times(self, query): """ Retorna o resultado da busca ao Cartola por um determinado termo de pesquisa. Args: query (str): Termo para utilizar na busca. Returns: Uma lista de instâncias de cartolafc.TimeInfo, uma para cada time contento o termo utilizado na busca. ...
python
def times(self, query): """ Retorna o resultado da busca ao Cartola por um determinado termo de pesquisa. Args: query (str): Termo para utilizar na busca. Returns: Uma lista de instâncias de cartolafc.TimeInfo, uma para cada time contento o termo utilizado na busca. ...
['def', 'times', '(', 'self', ',', 'query', ')', ':', 'url', '=', "'{api_url}/times'", '.', 'format', '(', 'api_url', '=', 'self', '.', '_api_url', ')', 'data', '=', 'self', '.', '_request', '(', 'url', ',', 'params', '=', 'dict', '(', 'q', '=', 'query', ')', ')', 'return', '[', 'TimeInfo', '.', 'from_dict', '(', 'time...
Retorna o resultado da busca ao Cartola por um determinado termo de pesquisa. Args: query (str): Termo para utilizar na busca. Returns: Uma lista de instâncias de cartolafc.TimeInfo, uma para cada time contento o termo utilizado na busca.
['Retorna', 'o', 'resultado', 'da', 'busca', 'ao', 'Cartola', 'por', 'um', 'determinado', 'termo', 'de', 'pesquisa', '.']
train
https://github.com/vicenteneto/python-cartolafc/blob/15b2a192d7745f454d69a55ac9b7ef7c7abb53b9/cartolafc/api.py#L293-L304
4,373
razorpay/razorpay-python
razorpay/resources/payment.py
Payment.transfer
def transfer(self, payment_id, data={}, **kwargs): """" Create Transfer for given Payment Id Args: payment_id : Id for which payment object has to be transfered Returns: Payment dict after getting transfered """ url = "{}/{}/transfers".format(sel...
python
def transfer(self, payment_id, data={}, **kwargs): """" Create Transfer for given Payment Id Args: payment_id : Id for which payment object has to be transfered Returns: Payment dict after getting transfered """ url = "{}/{}/transfers".format(sel...
['def', 'transfer', '(', 'self', ',', 'payment_id', ',', 'data', '=', '{', '}', ',', '*', '*', 'kwargs', ')', ':', 'url', '=', '"{}/{}/transfers"', '.', 'format', '(', 'self', '.', 'base_url', ',', 'payment_id', ')', 'return', 'self', '.', 'post_url', '(', 'url', ',', 'data', ',', '*', '*', 'kwargs', ')']
Create Transfer for given Payment Id Args: payment_id : Id for which payment object has to be transfered Returns: Payment dict after getting transfered
['Create', 'Transfer', 'for', 'given', 'Payment', 'Id']
train
https://github.com/razorpay/razorpay-python/blob/5bc63fd8452165a4b54556888492e555222c8afe/razorpay/resources/payment.py#L67-L78
4,374
spacetelescope/drizzlepac
drizzlepac/processInput.py
createImageObjectList
def createImageObjectList(files,instrpars,group=None, undistort=True, inmemory=False): """ Returns a list of imageObject instances, 1 for each input image in the list of input filenames. """ imageObjList = [] mtflag = False mt_refimg = None for img in files: i...
python
def createImageObjectList(files,instrpars,group=None, undistort=True, inmemory=False): """ Returns a list of imageObject instances, 1 for each input image in the list of input filenames. """ imageObjList = [] mtflag = False mt_refimg = None for img in files: i...
['def', 'createImageObjectList', '(', 'files', ',', 'instrpars', ',', 'group', '=', 'None', ',', 'undistort', '=', 'True', ',', 'inmemory', '=', 'False', ')', ':', 'imageObjList', '=', '[', ']', 'mtflag', '=', 'False', 'mt_refimg', '=', 'None', 'for', 'img', 'in', 'files', ':', 'image', '=', '_getInputImage', '(', 'img...
Returns a list of imageObject instances, 1 for each input image in the list of input filenames.
['Returns', 'a', 'list', 'of', 'imageObject', 'instances', '1', 'for', 'each', 'input', 'image', 'in', 'the', 'list', 'of', 'input', 'filenames', '.']
train
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/processInput.py#L328-L362
4,375
saltstack/salt
salt/modules/mount.py
set_filesystems
def set_filesystems( name, device, vfstype, opts='-', mount='true', config='/etc/filesystems', test=False, match_on='auto', **kwargs): ''' .. versionadded:: 2018.3.3 Verify that this mount is represented in the filesystems, change the ...
python
def set_filesystems( name, device, vfstype, opts='-', mount='true', config='/etc/filesystems', test=False, match_on='auto', **kwargs): ''' .. versionadded:: 2018.3.3 Verify that this mount is represented in the filesystems, change the ...
['def', 'set_filesystems', '(', 'name', ',', 'device', ',', 'vfstype', ',', 'opts', '=', "'-'", ',', 'mount', '=', "'true'", ',', 'config', '=', "'/etc/filesystems'", ',', 'test', '=', 'False', ',', 'match_on', '=', "'auto'", ',', '*', '*', 'kwargs', ')', ':', '# Fix the opts type if it is a list', 'if', 'isinstance', ...
.. versionadded:: 2018.3.3 Verify that this mount is represented in the filesystems, change the mount to match the data passed, or add the mount if it is not present on AIX Provide information if the path is mounted :param name: The name of the mount point where the device is mounted. ...
['..', 'versionadded', '::', '2018', '.', '3', '.', '3']
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/mount.py#L1666-L1810
4,376
twisted/axiom
axiom/store.py
Store.batchInsert
def batchInsert(self, itemType, itemAttributes, dataRows): """ Create multiple items in the store without loading corresponding Python objects into memory. the items' C{stored} callback will not be called. Example:: myData = [(37, u"Fred", u"Wichita"), ...
python
def batchInsert(self, itemType, itemAttributes, dataRows): """ Create multiple items in the store without loading corresponding Python objects into memory. the items' C{stored} callback will not be called. Example:: myData = [(37, u"Fred", u"Wichita"), ...
['def', 'batchInsert', '(', 'self', ',', 'itemType', ',', 'itemAttributes', ',', 'dataRows', ')', ':', 'class', 'FakeItem', ':', 'pass', '_NEEDS_DEFAULT', '=', 'object', '(', ')', '# token for lookup failure', 'fakeOSelf', '=', 'FakeItem', '(', ')', 'fakeOSelf', '.', 'store', '=', 'self', 'sql', '=', 'itemType', '.', '...
Create multiple items in the store without loading corresponding Python objects into memory. the items' C{stored} callback will not be called. Example:: myData = [(37, u"Fred", u"Wichita"), (28, u"Jim", u"Fresno"), (43, u"Betty", u"Du...
['Create', 'multiple', 'items', 'in', 'the', 'store', 'without', 'loading', 'corresponding', 'Python', 'objects', 'into', 'memory', '.']
train
https://github.com/twisted/axiom/blob/7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68/axiom/store.py#L1731-L1779
4,377
thespacedoctor/fundamentals
fundamentals/files/recursive_directory_listing.py
recursive_directory_listing
def recursive_directory_listing( log, baseFolderPath, whatToList="all" ): """*list directory contents recursively.* Options to list only files or only directories. **Key Arguments:** - ``log`` -- logger - ``baseFolderPath`` -- path to the base folder to list contained files and...
python
def recursive_directory_listing( log, baseFolderPath, whatToList="all" ): """*list directory contents recursively.* Options to list only files or only directories. **Key Arguments:** - ``log`` -- logger - ``baseFolderPath`` -- path to the base folder to list contained files and...
['def', 'recursive_directory_listing', '(', 'log', ',', 'baseFolderPath', ',', 'whatToList', '=', '"all"', ')', ':', 'log', '.', 'debug', '(', "'starting the ``recursive_directory_listing`` function'", ')', '## VARIABLES ##', 'matchedPathList', '=', '[', ']', 'parentDirectoryList', '=', '[', 'baseFolderPath', ',', ']',...
*list directory contents recursively.* Options to list only files or only directories. **Key Arguments:** - ``log`` -- logger - ``baseFolderPath`` -- path to the base folder to list contained files and folders recursively - ``whatToList`` -- list files only, durectories only or all [ "...
['*', 'list', 'directory', 'contents', 'recursively', '.', '*']
train
https://github.com/thespacedoctor/fundamentals/blob/1d2c007ac74442ec2eabde771cfcacdb9c1ab382/fundamentals/files/recursive_directory_listing.py#L19-L109
4,378
core/uricore
uricore/wkz_urls.py
url_decode
def url_decode(s, charset='utf-8', decode_keys=False, include_empty=True, errors='replace', separator='&', cls=None): """Parse a querystring and return it as :class:`MultiDict`. Per default only values are decoded into unicode strings. If `decode_keys` is set to `True` the same will happen ...
python
def url_decode(s, charset='utf-8', decode_keys=False, include_empty=True, errors='replace', separator='&', cls=None): """Parse a querystring and return it as :class:`MultiDict`. Per default only values are decoded into unicode strings. If `decode_keys` is set to `True` the same will happen ...
['def', 'url_decode', '(', 's', ',', 'charset', '=', "'utf-8'", ',', 'decode_keys', '=', 'False', ',', 'include_empty', '=', 'True', ',', 'errors', '=', "'replace'", ',', 'separator', '=', "'&'", ',', 'cls', '=', 'None', ')', ':', 'if', 'cls', 'is', 'None', ':', 'cls', '=', 'MultiDict', 'return', 'cls', '(', '_url_deco...
Parse a querystring and return it as :class:`MultiDict`. Per default only values are decoded into unicode strings. If `decode_keys` is set to `True` the same will happen for keys. Per default a missing value for a key will default to an empty key. If you don't want that behavior you can set `include...
['Parse', 'a', 'querystring', 'and', 'return', 'it', 'as', ':', 'class', ':', 'MultiDict', '.', 'Per', 'default', 'only', 'values', 'are', 'decoded', 'into', 'unicode', 'strings', '.', 'If', 'decode_keys', 'is', 'set', 'to', 'True', 'the', 'same', 'will', 'happen', 'for', 'keys', '.']
train
https://github.com/core/uricore/blob/dc5ef4be7bd93da4c39e5c1cbd1ae4f3ad3f1f2a/uricore/wkz_urls.py#L222-L256
4,379
lrq3000/pyFileFixity
pyFileFixity/header_ecc.py
ecc_correct_intra
def ecc_correct_intra(ecc_manager_intra, ecc_params_intra, field, ecc, enable_erasures=False, erasures_char="\x00", only_erasures=False): """ Correct an intra-field with its corresponding intra-ecc if necessary """ fentry_fields = {"ecc_field": ecc} field_correct = [] # will store each block of the correcte...
python
def ecc_correct_intra(ecc_manager_intra, ecc_params_intra, field, ecc, enable_erasures=False, erasures_char="\x00", only_erasures=False): """ Correct an intra-field with its corresponding intra-ecc if necessary """ fentry_fields = {"ecc_field": ecc} field_correct = [] # will store each block of the correcte...
['def', 'ecc_correct_intra', '(', 'ecc_manager_intra', ',', 'ecc_params_intra', ',', 'field', ',', 'ecc', ',', 'enable_erasures', '=', 'False', ',', 'erasures_char', '=', '"\\x00"', ',', 'only_erasures', '=', 'False', ')', ':', 'fentry_fields', '=', '{', '"ecc_field"', ':', 'ecc', '}', 'field_correct', '=', '[', ']', '...
Correct an intra-field with its corresponding intra-ecc if necessary
['Correct', 'an', 'intra', '-', 'field', 'with', 'its', 'corresponding', 'intra', '-', 'ecc', 'if', 'necessary']
train
https://github.com/lrq3000/pyFileFixity/blob/fd5ef23bb13835faf1e3baa773619b86a1cc9bdf/pyFileFixity/header_ecc.py#L174-L205
4,380
tensorflow/hub
tensorflow_hub/resolver.py
DownloadManager.download_and_uncompress
def download_and_uncompress(self, fileobj, dst_path): """Streams the content for the 'fileobj' and stores the result in dst_path. Args: fileobj: File handle pointing to .tar/.tar.gz content. dst_path: Absolute path where to store uncompressed data from 'fileobj'. Raises: ValueError: Unkn...
python
def download_and_uncompress(self, fileobj, dst_path): """Streams the content for the 'fileobj' and stores the result in dst_path. Args: fileobj: File handle pointing to .tar/.tar.gz content. dst_path: Absolute path where to store uncompressed data from 'fileobj'. Raises: ValueError: Unkn...
['def', 'download_and_uncompress', '(', 'self', ',', 'fileobj', ',', 'dst_path', ')', ':', 'try', ':', 'with', 'tarfile', '.', 'open', '(', 'mode', '=', '"r|*"', ',', 'fileobj', '=', 'fileobj', ')', 'as', 'tgz', ':', 'for', 'tarinfo', 'in', 'tgz', ':', 'abs_target_path', '=', '_merge_relative_path', '(', 'dst_path', ',...
Streams the content for the 'fileobj' and stores the result in dst_path. Args: fileobj: File handle pointing to .tar/.tar.gz content. dst_path: Absolute path where to store uncompressed data from 'fileobj'. Raises: ValueError: Unknown object encountered inside the TAR file.
['Streams', 'the', 'content', 'for', 'the', 'fileobj', 'and', 'stores', 'the', 'result', 'in', 'dst_path', '.']
train
https://github.com/tensorflow/hub/blob/09f45963f6787322967b6fec61459f3ac56fbb27/tensorflow_hub/resolver.py#L159-L189
4,381
ActiveState/simplealchemy
simplealchemy.py
_remove_unicode_keys
def _remove_unicode_keys(dictobj): """Convert keys from 'unicode' to 'str' type. workaround for <http://bugs.python.org/issue2646> """ if sys.version_info[:2] >= (3, 0): return dictobj assert isinstance(dictobj, dict) newdict = {} for key, value in dictobj.items(): if type(key) is...
python
def _remove_unicode_keys(dictobj): """Convert keys from 'unicode' to 'str' type. workaround for <http://bugs.python.org/issue2646> """ if sys.version_info[:2] >= (3, 0): return dictobj assert isinstance(dictobj, dict) newdict = {} for key, value in dictobj.items(): if type(key) is...
['def', '_remove_unicode_keys', '(', 'dictobj', ')', ':', 'if', 'sys', '.', 'version_info', '[', ':', '2', ']', '>=', '(', '3', ',', '0', ')', ':', 'return', 'dictobj', 'assert', 'isinstance', '(', 'dictobj', ',', 'dict', ')', 'newdict', '=', '{', '}', 'for', 'key', ',', 'value', 'in', 'dictobj', '.', 'items', '(', ')'...
Convert keys from 'unicode' to 'str' type. workaround for <http://bugs.python.org/issue2646>
['Convert', 'keys', 'from', 'unicode', 'to', 'str', 'type', '.']
train
https://github.com/ActiveState/simplealchemy/blob/f745847793f57701776a804ec74791a1f6a66947/simplealchemy.py#L239-L253
4,382
booktype/python-ooxml
ooxml/serialize.py
_get_numbering
def _get_numbering(document, numid, ilvl): """Returns type for the list. :Returns: Returns type for the list. Returns "bullet" by default or in case of an error. """ try: abs_num = document.numbering[numid] return document.abstruct_numbering[abs_num][ilvl]['numFmt'] except: ...
python
def _get_numbering(document, numid, ilvl): """Returns type for the list. :Returns: Returns type for the list. Returns "bullet" by default or in case of an error. """ try: abs_num = document.numbering[numid] return document.abstruct_numbering[abs_num][ilvl]['numFmt'] except: ...
['def', '_get_numbering', '(', 'document', ',', 'numid', ',', 'ilvl', ')', ':', 'try', ':', 'abs_num', '=', 'document', '.', 'numbering', '[', 'numid', ']', 'return', 'document', '.', 'abstruct_numbering', '[', 'abs_num', ']', '[', 'ilvl', ']', '[', "'numFmt'", ']', 'except', ':', 'return', "'bullet'"]
Returns type for the list. :Returns: Returns type for the list. Returns "bullet" by default or in case of an error.
['Returns', 'type', 'for', 'the', 'list', '.']
train
https://github.com/booktype/python-ooxml/blob/b56990a5bee2e1bc46839cec5161ff3726dc4d87/ooxml/serialize.py#L74-L85
4,383
llazzaro/analyzerdam
analyzerdam/excelDAM.py
ExcelDAM.writeTicks
def writeTicks(self, ticks): ''' read quotes ''' self.__writeData(self.targetPath(ExcelDAM.TICK), TICK_FIELDS, [[getattr(tick, field) for field in TICK_FIELDS] for tick in ticks])
python
def writeTicks(self, ticks): ''' read quotes ''' self.__writeData(self.targetPath(ExcelDAM.TICK), TICK_FIELDS, [[getattr(tick, field) for field in TICK_FIELDS] for tick in ticks])
['def', 'writeTicks', '(', 'self', ',', 'ticks', ')', ':', 'self', '.', '__writeData', '(', 'self', '.', 'targetPath', '(', 'ExcelDAM', '.', 'TICK', ')', ',', 'TICK_FIELDS', ',', '[', '[', 'getattr', '(', 'tick', ',', 'field', ')', 'for', 'field', 'in', 'TICK_FIELDS', ']', 'for', 'tick', 'in', 'ticks', ']', ')']
read quotes
['read', 'quotes']
train
https://github.com/llazzaro/analyzerdam/blob/c5bc7483dae23bd2e14bbf36147b7a43a0067bc0/analyzerdam/excelDAM.py#L91-L95
4,384
watson-developer-cloud/python-sdk
ibm_watson/tone_analyzer_v3.py
SentenceAnalysis._to_dict
def _to_dict(self): """Return a json dictionary representing this model.""" _dict = {} if hasattr(self, 'sentence_id') and self.sentence_id is not None: _dict['sentence_id'] = self.sentence_id if hasattr(self, 'text') and self.text is not None: _dict['text'] = sel...
python
def _to_dict(self): """Return a json dictionary representing this model.""" _dict = {} if hasattr(self, 'sentence_id') and self.sentence_id is not None: _dict['sentence_id'] = self.sentence_id if hasattr(self, 'text') and self.text is not None: _dict['text'] = sel...
['def', '_to_dict', '(', 'self', ')', ':', '_dict', '=', '{', '}', 'if', 'hasattr', '(', 'self', ',', "'sentence_id'", ')', 'and', 'self', '.', 'sentence_id', 'is', 'not', 'None', ':', '_dict', '[', "'sentence_id'", ']', '=', 'self', '.', 'sentence_id', 'if', 'hasattr', '(', 'self', ',', "'text'", ')', 'and', 'self', '...
Return a json dictionary representing this model.
['Return', 'a', 'json', 'dictionary', 'representing', 'this', 'model', '.']
train
https://github.com/watson-developer-cloud/python-sdk/blob/4c2c9df4466fcde88975da9ecd834e6ba95eb353/ibm_watson/tone_analyzer_v3.py#L460-L478
4,385
mitsei/dlkit
dlkit/json_/repository/objects.py
AssetForm.clear_copyright_registration
def clear_copyright_registration(self): """Removes the copyright registration. raise: NoAccess - ``Metadata.isRequired()`` is ``true`` or ``Metadata.isReadOnly()`` is ``true`` *compliance: mandatory -- This method must be implemented.* """ # Implemented from te...
python
def clear_copyright_registration(self): """Removes the copyright registration. raise: NoAccess - ``Metadata.isRequired()`` is ``true`` or ``Metadata.isReadOnly()`` is ``true`` *compliance: mandatory -- This method must be implemented.* """ # Implemented from te...
['def', 'clear_copyright_registration', '(', 'self', ')', ':', '# Implemented from template for osid.repository.AssetContentForm.clear_url_template', 'if', '(', 'self', '.', 'get_copyright_registration_metadata', '(', ')', '.', 'is_read_only', '(', ')', 'or', 'self', '.', 'get_copyright_registration_metadata', '(', ')'...
Removes the copyright registration. raise: NoAccess - ``Metadata.isRequired()`` is ``true`` or ``Metadata.isReadOnly()`` is ``true`` *compliance: mandatory -- This method must be implemented.*
['Removes', 'the', 'copyright', 'registration', '.']
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/repository/objects.py#L797-L809
4,386
BrewBlox/brewblox-service
brewblox_service/events.py
post_subscribe
async def post_subscribe(request): """ --- tags: - Events summary: Subscribe to events. operationId: events.subscribe produces: - text/plain parameters: - in: body name: body description: Event message required: true schema: typ...
python
async def post_subscribe(request): """ --- tags: - Events summary: Subscribe to events. operationId: events.subscribe produces: - text/plain parameters: - in: body name: body description: Event message required: true schema: typ...
['async', 'def', 'post_subscribe', '(', 'request', ')', ':', 'args', '=', 'await', 'request', '.', 'json', '(', ')', 'get_listener', '(', 'request', '.', 'app', ')', '.', 'subscribe', '(', 'args', '[', "'exchange'", ']', ',', 'args', '[', "'routing'", ']', ')', 'return', 'web', '.', 'Response', '(', ')']
--- tags: - Events summary: Subscribe to events. operationId: events.subscribe produces: - text/plain parameters: - in: body name: body description: Event message required: true schema: type: object properties: ...
['---', 'tags', ':', '-', 'Events', 'summary', ':', 'Subscribe', 'to', 'events', '.', 'operationId', ':', 'events', '.', 'subscribe', 'produces', ':', '-', 'text', '/', 'plain', 'parameters', ':', '-', 'in', ':', 'body', 'name', ':', 'body', 'description', ':', 'Event', 'message', 'required', ':', 'true', 'schema', ':'...
train
https://github.com/BrewBlox/brewblox-service/blob/f2572fcb5ea337c24aa5a28c2b0b19ebcfc076eb/brewblox_service/events.py#L503-L531
4,387
delfick/harpoon
harpoon/option_spec/task_objs.py
Task.run
def run(self, collector, image, available_actions, tasks, **extras): """Run this task""" task_func = available_actions[self.action] configuration = collector.configuration.wrapped() if self.options: if image: configuration.update({"images": {image: self.optio...
python
def run(self, collector, image, available_actions, tasks, **extras): """Run this task""" task_func = available_actions[self.action] configuration = collector.configuration.wrapped() if self.options: if image: configuration.update({"images": {image: self.optio...
['def', 'run', '(', 'self', ',', 'collector', ',', 'image', ',', 'available_actions', ',', 'tasks', ',', '*', '*', 'extras', ')', ':', 'task_func', '=', 'available_actions', '[', 'self', '.', 'action', ']', 'configuration', '=', 'collector', '.', 'configuration', '.', 'wrapped', '(', ')', 'if', 'self', '.', 'options', ...
Run this task
['Run', 'this', 'task']
train
https://github.com/delfick/harpoon/blob/a2d39311d6127b7da2e15f40468bf320d598e461/harpoon/option_spec/task_objs.py#L42-L75
4,388
DLR-RM/RAFCON
source/rafcon/gui/controllers/utils/extended_controller.py
ExtendedController.destroy
def destroy(self): """Recursively destroy all Controllers The method remove all controllers, which calls the destroy method of the child controllers. Then, all registered models are relieved and and the widget hand by the initial view argument is destroyed. """ self.disconnect_a...
python
def destroy(self): """Recursively destroy all Controllers The method remove all controllers, which calls the destroy method of the child controllers. Then, all registered models are relieved and and the widget hand by the initial view argument is destroyed. """ self.disconnect_a...
['def', 'destroy', '(', 'self', ')', ':', 'self', '.', 'disconnect_all_signals', '(', ')', 'controller_names', '=', '[', 'key', 'for', 'key', 'in', 'self', '.', '__child_controllers', ']', 'for', 'controller_name', 'in', 'controller_names', ':', 'self', '.', 'remove_controller', '(', 'controller_name', ')', 'self', '.'...
Recursively destroy all Controllers The method remove all controllers, which calls the destroy method of the child controllers. Then, all registered models are relieved and and the widget hand by the initial view argument is destroyed.
['Recursively', 'destroy', 'all', 'Controllers']
train
https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/controllers/utils/extended_controller.py#L186-L212
4,389
sethmlarson/virtualbox-python
virtualbox/library.py
IGuestSession.symlink_exists
def symlink_exists(self, symlink): """Checks whether a symbolic link exists in the guest. in symlink of type str Path to the alleged symbolic link. Guest path style. return exists of type bool Returns @c true if the symbolic link exists. Returns @c false if it ...
python
def symlink_exists(self, symlink): """Checks whether a symbolic link exists in the guest. in symlink of type str Path to the alleged symbolic link. Guest path style. return exists of type bool Returns @c true if the symbolic link exists. Returns @c false if it ...
['def', 'symlink_exists', '(', 'self', ',', 'symlink', ')', ':', 'if', 'not', 'isinstance', '(', 'symlink', ',', 'basestring', ')', ':', 'raise', 'TypeError', '(', '"symlink can only be an instance of type basestring"', ')', 'exists', '=', 'self', '.', '_call', '(', '"symlinkExists"', ',', 'in_p', '=', '[', 'symlink', ...
Checks whether a symbolic link exists in the guest. in symlink of type str Path to the alleged symbolic link. Guest path style. return exists of type bool Returns @c true if the symbolic link exists. Returns @c false if it does not exist, if the file system object...
['Checks', 'whether', 'a', 'symbolic', 'link', 'exists', 'in', 'the', 'guest', '.']
train
https://github.com/sethmlarson/virtualbox-python/blob/706c8e3f6e3aee17eb06458e73cbb4bc2d37878b/virtualbox/library.py#L20325-L20345
4,390
sernst/cauldron
cauldron/environ/logger.py
add_to_message
def add_to_message(data, indent_level=0) -> list: """Adds data to the message object""" message = [] if isinstance(data, str): message.append(indent( dedent(data.strip('\n')).strip(), indent_level * ' ' )) return message for line in data: offset...
python
def add_to_message(data, indent_level=0) -> list: """Adds data to the message object""" message = [] if isinstance(data, str): message.append(indent( dedent(data.strip('\n')).strip(), indent_level * ' ' )) return message for line in data: offset...
['def', 'add_to_message', '(', 'data', ',', 'indent_level', '=', '0', ')', '->', 'list', ':', 'message', '=', '[', ']', 'if', 'isinstance', '(', 'data', ',', 'str', ')', ':', 'message', '.', 'append', '(', 'indent', '(', 'dedent', '(', 'data', '.', 'strip', '(', "'\\n'", ')', ')', '.', 'strip', '(', ')', ',', 'indent_l...
Adds data to the message object
['Adds', 'data', 'to', 'the', 'message', 'object']
train
https://github.com/sernst/cauldron/blob/4086aec9c038c402ea212c79fe8bd0d27104f9cf/cauldron/environ/logger.py#L226-L240
4,391
AtteqCom/zsl
src/zsl/utils/rss.py
rss_create
def rss_create(channel, articles): """Create RSS xml feed. :param channel: channel info [title, link, description, language] :type channel: dict(str, str) :param articles: list of articles, an article is a dictionary with some \ required fields [title, description, link] and any optional, which wil...
python
def rss_create(channel, articles): """Create RSS xml feed. :param channel: channel info [title, link, description, language] :type channel: dict(str, str) :param articles: list of articles, an article is a dictionary with some \ required fields [title, description, link] and any optional, which wil...
['def', 'rss_create', '(', 'channel', ',', 'articles', ')', ':', 'channel', '=', 'channel', '.', 'copy', '(', ')', '# TODO use deepcopy', '# list will not clone the dictionaries in the list and `elemen_from_dict`', '# pops items from them', 'articles', '=', 'list', '(', 'articles', ')', 'rss', '=', 'ET', '.', 'Element'...
Create RSS xml feed. :param channel: channel info [title, link, description, language] :type channel: dict(str, str) :param articles: list of articles, an article is a dictionary with some \ required fields [title, description, link] and any optional, which will \ result to `<dict_key>dict_value</d...
['Create', 'RSS', 'xml', 'feed', '.']
train
https://github.com/AtteqCom/zsl/blob/ab51a96da1780ff642912396d4b85bdcb72560c1/src/zsl/utils/rss.py#L62-L101
4,392
bububa/pyTOP
pyTOP/logistics.py
LogisticsOnline.confirm
def confirm(self, tid, out_sid, session): '''taobao.logistics.online.confirm 确认发货通知接口 确认发货的目的是让交易流程继承走下去,确认发货后交易状态会由【买家已付款】变为【卖家已发货】,然后买家才可以确认收货,货款打入卖家账号。货到付款的订单除外''' request = TOPRequest('taobao.logistics.online.confirm') request['tid'] = tid request['out_sid'] = out_si...
python
def confirm(self, tid, out_sid, session): '''taobao.logistics.online.confirm 确认发货通知接口 确认发货的目的是让交易流程继承走下去,确认发货后交易状态会由【买家已付款】变为【卖家已发货】,然后买家才可以确认收货,货款打入卖家账号。货到付款的订单除外''' request = TOPRequest('taobao.logistics.online.confirm') request['tid'] = tid request['out_sid'] = out_si...
['def', 'confirm', '(', 'self', ',', 'tid', ',', 'out_sid', ',', 'session', ')', ':', 'request', '=', 'TOPRequest', '(', "'taobao.logistics.online.confirm'", ')', 'request', '[', "'tid'", ']', '=', 'tid', 'request', '[', "'out_sid'", ']', '=', 'out_sid', 'self', '.', 'create', '(', 'self', '.', 'execute', '(', 'request...
taobao.logistics.online.confirm 确认发货通知接口 确认发货的目的是让交易流程继承走下去,确认发货后交易状态会由【买家已付款】变为【卖家已发货】,然后买家才可以确认收货,货款打入卖家账号。货到付款的订单除外
['taobao', '.', 'logistics', '.', 'online', '.', 'confirm', '确认发货通知接口', '确认发货的目的是让交易流程继承走下去,确认发货后交易状态会由【买家已付款】变为【卖家已发货】,然后买家才可以确认收货,货款打入卖家账号。货到付款的订单除外']
train
https://github.com/bububa/pyTOP/blob/1e48009bcfe886be392628244b370e6374e1f2b2/pyTOP/logistics.py#L412-L420
4,393
Gandi/gandi.cli
gandi/cli/commands/vm.py
datacenters
def datacenters(gandi, id): """List available datacenters.""" output_keys = ['iso', 'name', 'country', 'dc_code', 'status'] if id: output_keys.append('id') result = gandi.datacenter.list() for num, dc in enumerate(result): if num: gandi.separator_line() output_da...
python
def datacenters(gandi, id): """List available datacenters.""" output_keys = ['iso', 'name', 'country', 'dc_code', 'status'] if id: output_keys.append('id') result = gandi.datacenter.list() for num, dc in enumerate(result): if num: gandi.separator_line() output_da...
['def', 'datacenters', '(', 'gandi', ',', 'id', ')', ':', 'output_keys', '=', '[', "'iso'", ',', "'name'", ',', "'country'", ',', "'dc_code'", ',', "'status'", ']', 'if', 'id', ':', 'output_keys', '.', 'append', '(', "'id'", ')', 'result', '=', 'gandi', '.', 'datacenter', '.', 'list', '(', ')', 'for', 'num', ',', 'dc',...
List available datacenters.
['List', 'available', 'datacenters', '.']
train
https://github.com/Gandi/gandi.cli/blob/6ee5b8fc8ec44b0a6c232043ca610606ad8f693d/gandi/cli/commands/vm.py#L500-L512
4,394
pyQode/pyqode.core
pyqode/core/cache.py
Cache.set_file_encoding
def set_file_encoding(self, path, encoding): """ Cache encoding for the specified file path. :param path: path of the file to cache :param encoding: encoding to cache """ try: map = json.loads(self._settings.value('cachedFileEncodings')) except TypeEr...
python
def set_file_encoding(self, path, encoding): """ Cache encoding for the specified file path. :param path: path of the file to cache :param encoding: encoding to cache """ try: map = json.loads(self._settings.value('cachedFileEncodings')) except TypeEr...
['def', 'set_file_encoding', '(', 'self', ',', 'path', ',', 'encoding', ')', ':', 'try', ':', 'map', '=', 'json', '.', 'loads', '(', 'self', '.', '_settings', '.', 'value', '(', "'cachedFileEncodings'", ')', ')', 'except', 'TypeError', ':', 'map', '=', '{', '}', 'map', '[', 'path', ']', '=', 'encoding', 'self', '.', '_...
Cache encoding for the specified file path. :param path: path of the file to cache :param encoding: encoding to cache
['Cache', 'encoding', 'for', 'the', 'specified', 'file', 'path', '.']
train
https://github.com/pyQode/pyqode.core/blob/a99ec6cd22d519394f613309412f8329dc4e90cb/pyqode/core/cache.py#L104-L116
4,395
atztogo/phonopy
phonopy/harmonic/force_constants.py
set_permutation_symmetry
def set_permutation_symmetry(force_constants): """Enforce permutation symmetry to force cosntants by Phi_ij_ab = Phi_ji_ba i, j: atom index a, b: Cartesian axis index This is not necessary for harmonic phonon calculation because this condition is imposed when making dynamical matrix Hermite i...
python
def set_permutation_symmetry(force_constants): """Enforce permutation symmetry to force cosntants by Phi_ij_ab = Phi_ji_ba i, j: atom index a, b: Cartesian axis index This is not necessary for harmonic phonon calculation because this condition is imposed when making dynamical matrix Hermite i...
['def', 'set_permutation_symmetry', '(', 'force_constants', ')', ':', 'fc_copy', '=', 'force_constants', '.', 'copy', '(', ')', 'for', 'i', 'in', 'range', '(', 'force_constants', '.', 'shape', '[', '0', ']', ')', ':', 'for', 'j', 'in', 'range', '(', 'force_constants', '.', 'shape', '[', '1', ']', ')', ':', 'force_const...
Enforce permutation symmetry to force cosntants by Phi_ij_ab = Phi_ji_ba i, j: atom index a, b: Cartesian axis index This is not necessary for harmonic phonon calculation because this condition is imposed when making dynamical matrix Hermite in dynamical_matrix.py.
['Enforce', 'permutation', 'symmetry', 'to', 'force', 'cosntants', 'by']
train
https://github.com/atztogo/phonopy/blob/869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f/phonopy/harmonic/force_constants.py#L462-L480
4,396
saltstack/salt
salt/states/pcs.py
_file_read
def _file_read(path): ''' Read a file and return content ''' content = False if os.path.exists(path): with salt.utils.files.fopen(path, 'r+') as fp_: content = salt.utils.stringutils.to_unicode(fp_.read()) fp_.close() return content
python
def _file_read(path): ''' Read a file and return content ''' content = False if os.path.exists(path): with salt.utils.files.fopen(path, 'r+') as fp_: content = salt.utils.stringutils.to_unicode(fp_.read()) fp_.close() return content
['def', '_file_read', '(', 'path', ')', ':', 'content', '=', 'False', 'if', 'os', '.', 'path', '.', 'exists', '(', 'path', ')', ':', 'with', 'salt', '.', 'utils', '.', 'files', '.', 'fopen', '(', 'path', ',', "'r+'", ')', 'as', 'fp_', ':', 'content', '=', 'salt', '.', 'utils', '.', 'stringutils', '.', 'to_unicode', '('...
Read a file and return content
['Read', 'a', 'file', 'and', 'return', 'content']
train
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/pcs.py#L191-L200
4,397
Kane610/axis
axis/port_cgi.py
Ports.process_raw
def process_raw(self, raw: dict) -> None: """Pre-process raw dict. Prepare parameters to work with APIItems. """ raw_ports = {} for param in raw: port_index = REGEX_PORT_INDEX.search(param).group(0) if port_index not in raw_ports: raw_po...
python
def process_raw(self, raw: dict) -> None: """Pre-process raw dict. Prepare parameters to work with APIItems. """ raw_ports = {} for param in raw: port_index = REGEX_PORT_INDEX.search(param).group(0) if port_index not in raw_ports: raw_po...
['def', 'process_raw', '(', 'self', ',', 'raw', ':', 'dict', ')', '->', 'None', ':', 'raw_ports', '=', '{', '}', 'for', 'param', 'in', 'raw', ':', 'port_index', '=', 'REGEX_PORT_INDEX', '.', 'search', '(', 'param', ')', '.', 'group', '(', '0', ')', 'if', 'port_index', 'not', 'in', 'raw_ports', ':', 'raw_ports', '[', 'p...
Pre-process raw dict. Prepare parameters to work with APIItems.
['Pre', '-', 'process', 'raw', 'dict', '.']
train
https://github.com/Kane610/axis/blob/b2b44ce595c7b722b5e13eabcab7b91f048e1808/axis/port_cgi.py#L42-L58
4,398
Trax-air/swagger-parser
swagger_parser/swagger_parser.py
SwaggerParser._definition_from_example
def _definition_from_example(example): """Generates a swagger definition json from a given example Works only for simple types in the dict Args: example: The example for which we want a definition Type is DICT Returns: A dict that is the ...
python
def _definition_from_example(example): """Generates a swagger definition json from a given example Works only for simple types in the dict Args: example: The example for which we want a definition Type is DICT Returns: A dict that is the ...
['def', '_definition_from_example', '(', 'example', ')', ':', 'assert', 'isinstance', '(', 'example', ',', 'dict', ')', 'def', '_has_simple_type', '(', 'value', ')', ':', 'accepted', '=', '(', 'str', ',', 'int', ',', 'float', ',', 'bool', ')', 'return', 'isinstance', '(', 'value', ',', 'accepted', ')', 'definition', '=...
Generates a swagger definition json from a given example Works only for simple types in the dict Args: example: The example for which we want a definition Type is DICT Returns: A dict that is the swagger definition json
['Generates', 'a', 'swagger', 'definition', 'json', 'from', 'a', 'given', 'example', 'Works', 'only', 'for', 'simple', 'types', 'in', 'the', 'dict']
train
https://github.com/Trax-air/swagger-parser/blob/d97f962a417e76320c59c33dcb223e4373e516d5/swagger_parser/swagger_parser.py#L278-L315
4,399
Opentrons/opentrons
api/src/opentrons/drivers/smoothie_drivers/driver_3_0.py
SmoothieDriver_3_0_0._save_current
def _save_current(self, settings, axes_active=True): ''' Sets the current in Amperes (A) by axis. Currents are limited to be between 0.0-2.0 amps per axis motor. Note: this method does not send gcode commands, but instead stores the desired current setting. A seperate call to _g...
python
def _save_current(self, settings, axes_active=True): ''' Sets the current in Amperes (A) by axis. Currents are limited to be between 0.0-2.0 amps per axis motor. Note: this method does not send gcode commands, but instead stores the desired current setting. A seperate call to _g...
['def', '_save_current', '(', 'self', ',', 'settings', ',', 'axes_active', '=', 'True', ')', ':', 'self', '.', '_active_axes', '.', 'update', '(', '{', 'ax', ':', 'axes_active', 'for', 'ax', 'in', 'settings', '.', 'keys', '(', ')', '}', ')', 'self', '.', '_current_settings', '[', "'now'", ']', '.', 'update', '(', 'sett...
Sets the current in Amperes (A) by axis. Currents are limited to be between 0.0-2.0 amps per axis motor. Note: this method does not send gcode commands, but instead stores the desired current setting. A seperate call to _generate_current_command() will return a gcode command that can be...
['Sets', 'the', 'current', 'in', 'Amperes', '(', 'A', ')', 'by', 'axis', '.', 'Currents', 'are', 'limited', 'to', 'be', 'between', '0', '.', '0', '-', '2', '.', '0', 'amps', 'per', 'axis', 'motor', '.']
train
https://github.com/Opentrons/opentrons/blob/a7c15cc2636ecb64ab56c7edc1d8a57163aaeadf/api/src/opentrons/drivers/smoothie_drivers/driver_3_0.py#L696-L714