code stringlengths 75 104k | code_sememe stringlengths 47 309k | token_type stringlengths 215 214k | code_dependency stringlengths 75 155k |
|---|---|---|---|
def add(self, rule_name, session, **kwargs):
'''taobao.crm.rule.add 分组规则添加
添加分组规则,规则可用于筛选一定条件的会员。过滤条件可以选择客户来源、会员级别 、交易笔数、交易额、上次交易时间、平均客单价、宝贝件数、省份、关闭交易数等,新建规则时必须至少选择一个以上筛选条件。如果输入的规则的筛选条件不正确则不会进行处理,可以将某些分组挂在这个规则下,对被挂在该规则下的分组,系统对现有满足规则的客户都划分到这个分组(异步任务),若某些会员分组数或规则数超最大限额,则该会员不被操作,同时不影响其余会员操作,接口调用依然... | def function[add, parameter[self, rule_name, session]]:
constant[taobao.crm.rule.add 分组规则添加
添加分组规则,规则可用于筛选一定条件的会员。过滤条件可以选择客户来源、会员级别 、交易笔数、交易额、上次交易时间、平均客单价、宝贝件数、省份、关闭交易数等,新建规则时必须至少选择一个以上筛选条件。如果输入的规则的筛选条件不正确则不会进行处理,可以将某些分组挂在这个规则下,对被挂在该规则下的分组,系统对现有满足规则的客户都划分到这个分组(异步任务),若某些会员分组数或规则数超最大限额,则该会员不被操作,同... | keyword[def] identifier[add] ( identifier[self] , identifier[rule_name] , identifier[session] ,** identifier[kwargs] ):
literal[string]
identifier[request] = identifier[TOPRequest] ( literal[string] )
identifier[request] [ literal[string] ]= identifier[rule_name]
keyword[for] id... | def add(self, rule_name, session, **kwargs):
"""taobao.crm.rule.add 分组规则添加
添加分组规则,规则可用于筛选一定条件的会员。过滤条件可以选择客户来源、会员级别 、交易笔数、交易额、上次交易时间、平均客单价、宝贝件数、省份、关闭交易数等,新建规则时必须至少选择一个以上筛选条件。如果输入的规则的筛选条件不正确则不会进行处理,可以将某些分组挂在这个规则下,对被挂在该规则下的分组,系统对现有满足规则的客户都划分到这个分组(异步任务),若某些会员分组数或规则数超最大限额,则该会员不被操作,同时不影响其余会员操作,接口调用依然返回成功... |
def _action_enabled(self, event, action):
"""Check if an action for a notification is enabled."""
event_actions = self._aconfig.get(event)
if event_actions is None:
return True
if event_actions is False:
return False
return action in event_actions | def function[_action_enabled, parameter[self, event, action]]:
constant[Check if an action for a notification is enabled.]
variable[event_actions] assign[=] call[name[self]._aconfig.get, parameter[name[event]]]
if compare[name[event_actions] is constant[None]] begin[:]
return[constant[Tr... | keyword[def] identifier[_action_enabled] ( identifier[self] , identifier[event] , identifier[action] ):
literal[string]
identifier[event_actions] = identifier[self] . identifier[_aconfig] . identifier[get] ( identifier[event] )
keyword[if] identifier[event_actions] keyword[is] keyword[N... | def _action_enabled(self, event, action):
"""Check if an action for a notification is enabled."""
event_actions = self._aconfig.get(event)
if event_actions is None:
return True # depends on [control=['if'], data=[]]
if event_actions is False:
return False # depends on [control=['if'], ... |
def detach(self):
"""
Detach the underlying LLVM resource without disposing of it.
"""
if not self._closed:
del self._as_parameter_
self._closed = True
self._ptr = None | def function[detach, parameter[self]]:
constant[
Detach the underlying LLVM resource without disposing of it.
]
if <ast.UnaryOp object at 0x7da1b1950820> begin[:]
<ast.Delete object at 0x7da1b1950f10>
name[self]._closed assign[=] constant[True]
nam... | keyword[def] identifier[detach] ( identifier[self] ):
literal[string]
keyword[if] keyword[not] identifier[self] . identifier[_closed] :
keyword[del] identifier[self] . identifier[_as_parameter_]
identifier[self] . identifier[_closed] = keyword[True]
ident... | def detach(self):
"""
Detach the underlying LLVM resource without disposing of it.
"""
if not self._closed:
del self._as_parameter_
self._closed = True
self._ptr = None # depends on [control=['if'], data=[]] |
def get_page_properties(self, page_id):
"""
Get the page (content) properties
:param page_id: content_id format
:return: get properties
"""
url = 'rest/api/content/{page_id}/property'.format(page_id=page_id)
return self.get(path=url) | def function[get_page_properties, parameter[self, page_id]]:
constant[
Get the page (content) properties
:param page_id: content_id format
:return: get properties
]
variable[url] assign[=] call[constant[rest/api/content/{page_id}/property].format, parameter[]]
return[... | keyword[def] identifier[get_page_properties] ( identifier[self] , identifier[page_id] ):
literal[string]
identifier[url] = literal[string] . identifier[format] ( identifier[page_id] = identifier[page_id] )
keyword[return] identifier[self] . identifier[get] ( identifier[path] = identifier[... | def get_page_properties(self, page_id):
"""
Get the page (content) properties
:param page_id: content_id format
:return: get properties
"""
url = 'rest/api/content/{page_id}/property'.format(page_id=page_id)
return self.get(path=url) |
def teardown(self):
"""
Stop and remove the container if it exists.
"""
while self._http_clients:
self._http_clients.pop().close()
if self.created:
self.halt() | def function[teardown, parameter[self]]:
constant[
Stop and remove the container if it exists.
]
while name[self]._http_clients begin[:]
call[call[name[self]._http_clients.pop, parameter[]].close, parameter[]]
if name[self].created begin[:]
call[na... | keyword[def] identifier[teardown] ( identifier[self] ):
literal[string]
keyword[while] identifier[self] . identifier[_http_clients] :
identifier[self] . identifier[_http_clients] . identifier[pop] (). identifier[close] ()
keyword[if] identifier[self] . identifier[created] :
... | def teardown(self):
"""
Stop and remove the container if it exists.
"""
while self._http_clients:
self._http_clients.pop().close() # depends on [control=['while'], data=[]]
if self.created:
self.halt() # depends on [control=['if'], data=[]] |
def show_status(self):
"""Show status of unregistered migrations"""
if not self.check_directory():
return
migrations = self.get_unregistered_migrations()
if migrations:
logger.info('Unregistered migrations:')
for migration in migrations:
... | def function[show_status, parameter[self]]:
constant[Show status of unregistered migrations]
if <ast.UnaryOp object at 0x7da18dc9b0a0> begin[:]
return[None]
variable[migrations] assign[=] call[name[self].get_unregistered_migrations, parameter[]]
if name[migrations] begin[:]
... | keyword[def] identifier[show_status] ( identifier[self] ):
literal[string]
keyword[if] keyword[not] identifier[self] . identifier[check_directory] ():
keyword[return]
identifier[migrations] = identifier[self] . identifier[get_unregistered_migrations] ()
keyword[if... | def show_status(self):
"""Show status of unregistered migrations"""
if not self.check_directory():
return # depends on [control=['if'], data=[]]
migrations = self.get_unregistered_migrations()
if migrations:
logger.info('Unregistered migrations:')
for migration in migrations:
... |
def stem(self, word, early_english=False):
"""Return the Porter2 (Snowball English) stem.
Parameters
----------
word : str
The word to stem
early_english : bool
Set to True in order to remove -eth & -est (2nd & 3rd person
singular verbal agree... | def function[stem, parameter[self, word, early_english]]:
constant[Return the Porter2 (Snowball English) stem.
Parameters
----------
word : str
The word to stem
early_english : bool
Set to True in order to remove -eth & -est (2nd & 3rd person
... | keyword[def] identifier[stem] ( identifier[self] , identifier[word] , identifier[early_english] = keyword[False] ):
literal[string]
identifier[word] = identifier[normalize] ( literal[string] , identifier[text_type] ( identifier[word] . identifier[lower] ()))
iden... | def stem(self, word, early_english=False):
"""Return the Porter2 (Snowball English) stem.
Parameters
----------
word : str
The word to stem
early_english : bool
Set to True in order to remove -eth & -est (2nd & 3rd person
singular verbal agreement... |
def build_container_vm(self, container, disk, zone="us-east1-b", tags=None, preemptible=True):
"""Build kwargs for a container VM.
:param container: Container declaration.
:type container: ``dict``
:param disk: Disk definition structure.
:type disk: ``dict``
... | def function[build_container_vm, parameter[self, container, disk, zone, tags, preemptible]]:
constant[Build kwargs for a container VM.
:param container: Container declaration.
:type container: ``dict``
:param disk: Disk definition structure.
:type disk: ``dict``
... | keyword[def] identifier[build_container_vm] ( identifier[self] , identifier[container] , identifier[disk] , identifier[zone] = literal[string] , identifier[tags] = keyword[None] , identifier[preemptible] = keyword[True] ):
literal[string]
keyword[if] identifier[tags] keyword[is] keyword[None] :
... | def build_container_vm(self, container, disk, zone='us-east1-b', tags=None, preemptible=True):
"""Build kwargs for a container VM.
:param container: Container declaration.
:type container: ``dict``
:param disk: Disk definition structure.
:type disk: ``dict``
:par... |
def sorted_query_paths(self):
"""
RETURN A LIST OF ALL SCHEMA'S IN DEPTH-FIRST TOPOLOGICAL ORDER
"""
return list(reversed(sorted(p[0] for p in self.namespace.alias_to_query_paths.get(self.name)))) | def function[sorted_query_paths, parameter[self]]:
constant[
RETURN A LIST OF ALL SCHEMA'S IN DEPTH-FIRST TOPOLOGICAL ORDER
]
return[call[name[list], parameter[call[name[reversed], parameter[call[name[sorted], parameter[<ast.GeneratorExp object at 0x7da1b0b70b80>]]]]]]] | keyword[def] identifier[sorted_query_paths] ( identifier[self] ):
literal[string]
keyword[return] identifier[list] ( identifier[reversed] ( identifier[sorted] ( identifier[p] [ literal[int] ] keyword[for] identifier[p] keyword[in] identifier[self] . identifier[namespace] . identifier[alias_to_q... | def sorted_query_paths(self):
"""
RETURN A LIST OF ALL SCHEMA'S IN DEPTH-FIRST TOPOLOGICAL ORDER
"""
return list(reversed(sorted((p[0] for p in self.namespace.alias_to_query_paths.get(self.name))))) |
def add_ephemeral_listener(self, callback, event_type=None):
"""Add a callback handler for ephemeral events going to this room.
Args:
callback (func(room, event)): Callback called when an ephemeral event arrives.
event_type (str): The event_type to filter for.
Returns:
... | def function[add_ephemeral_listener, parameter[self, callback, event_type]]:
constant[Add a callback handler for ephemeral events going to this room.
Args:
callback (func(room, event)): Callback called when an ephemeral event arrives.
event_type (str): The event_type to filter f... | keyword[def] identifier[add_ephemeral_listener] ( identifier[self] , identifier[callback] , identifier[event_type] = keyword[None] ):
literal[string]
identifier[listener_id] = identifier[uuid4] ()
identifier[self] . identifier[ephemeral_listeners] . identifier[append] (
{
... | def add_ephemeral_listener(self, callback, event_type=None):
"""Add a callback handler for ephemeral events going to this room.
Args:
callback (func(room, event)): Callback called when an ephemeral event arrives.
event_type (str): The event_type to filter for.
Returns:
... |
def encode_request(uuid, address, interrupt):
""" Encode request into client_message"""
client_message = ClientMessage(payload_size=calculate_size(uuid, address, interrupt))
client_message.set_message_type(REQUEST_TYPE)
client_message.set_retryable(RETRYABLE)
client_message.append_str(uuid)
Addr... | def function[encode_request, parameter[uuid, address, interrupt]]:
constant[ Encode request into client_message]
variable[client_message] assign[=] call[name[ClientMessage], parameter[]]
call[name[client_message].set_message_type, parameter[name[REQUEST_TYPE]]]
call[name[client_message].... | keyword[def] identifier[encode_request] ( identifier[uuid] , identifier[address] , identifier[interrupt] ):
literal[string]
identifier[client_message] = identifier[ClientMessage] ( identifier[payload_size] = identifier[calculate_size] ( identifier[uuid] , identifier[address] , identifier[interrupt] ))
... | def encode_request(uuid, address, interrupt):
""" Encode request into client_message"""
client_message = ClientMessage(payload_size=calculate_size(uuid, address, interrupt))
client_message.set_message_type(REQUEST_TYPE)
client_message.set_retryable(RETRYABLE)
client_message.append_str(uuid)
Addr... |
def delete(self, refobj):
"""Delete the content of the given refobj
:param refobj: the refobj that represents the content that should be deleted
:type refobj: refobj
:returns: None
:rtype: None
:raises: None
"""
refobjinter = self.get_refobjinter()
... | def function[delete, parameter[self, refobj]]:
constant[Delete the content of the given refobj
:param refobj: the refobj that represents the content that should be deleted
:type refobj: refobj
:returns: None
:rtype: None
:raises: None
]
variable[refobjint... | keyword[def] identifier[delete] ( identifier[self] , identifier[refobj] ):
literal[string]
identifier[refobjinter] = identifier[self] . identifier[get_refobjinter] ()
identifier[reference] = identifier[refobjinter] . identifier[get_reference] ( identifier[refobj] )
keyword[if] id... | def delete(self, refobj):
"""Delete the content of the given refobj
:param refobj: the refobj that represents the content that should be deleted
:type refobj: refobj
:returns: None
:rtype: None
:raises: None
"""
refobjinter = self.get_refobjinter()
reference ... |
def smartypants(text):
"""
Transforms sequences of characters into HTML entities.
=================================== ===================== =========
Markdown HTML Result
=================================== ===================== =========
``'s``... | def function[smartypants, parameter[text]]:
constant[
Transforms sequences of characters into HTML entities.
=================================== ===================== =========
Markdown HTML Result
=================================== ============... | keyword[def] identifier[smartypants] ( identifier[text] ):
literal[string]
identifier[byte_str] = identifier[text] . identifier[encode] ( literal[string] )
identifier[ob] = identifier[lib] . identifier[hoedown_buffer_new] ( identifier[OUNIT] )
identifier[lib] . identifier[hoedown_html_smartypants... | def smartypants(text):
"""
Transforms sequences of characters into HTML entities.
=================================== ===================== =========
Markdown HTML Result
=================================== ===================== =========
``'s``... |
def always_iterable(obj, base_type=(str, bytes)):
"""If *obj* is iterable, return an iterator over its items::
>>> obj = (1, 2, 3)
>>> list(always_iterable(obj))
[1, 2, 3]
If *obj* is not iterable, return a one-item iterable containing *obj*::
>>> obj = 1
>>> list(alwa... | def function[always_iterable, parameter[obj, base_type]]:
constant[If *obj* is iterable, return an iterator over its items::
>>> obj = (1, 2, 3)
>>> list(always_iterable(obj))
[1, 2, 3]
If *obj* is not iterable, return a one-item iterable containing *obj*::
>>> obj = 1
... | keyword[def] identifier[always_iterable] ( identifier[obj] , identifier[base_type] =( identifier[str] , identifier[bytes] )):
literal[string]
keyword[if] identifier[obj] keyword[is] keyword[None] :
keyword[return] identifier[iter] (())
keyword[if] ( identifier[base_type] keyword[is] ke... | def always_iterable(obj, base_type=(str, bytes)):
"""If *obj* is iterable, return an iterator over its items::
>>> obj = (1, 2, 3)
>>> list(always_iterable(obj))
[1, 2, 3]
If *obj* is not iterable, return a one-item iterable containing *obj*::
>>> obj = 1
>>> list(alwa... |
def make_order_and_cancel(api_svr_ip, api_svr_port, unlock_password, test_code, trade_env, acc_id):
"""
使用请先配置正确参数:
:param api_svr_ip: (string) ip
:param api_svr_port: (string) ip
:param unlock_password: (string) 交易解锁密码, 必需修改!
:param test_code: (string) 股票
:param trade_env: 参见 ft.TrdEnv的定义
... | def function[make_order_and_cancel, parameter[api_svr_ip, api_svr_port, unlock_password, test_code, trade_env, acc_id]]:
constant[
使用请先配置正确参数:
:param api_svr_ip: (string) ip
:param api_svr_port: (string) ip
:param unlock_password: (string) 交易解锁密码, 必需修改!
:param test_code: (string) 股票
:par... | keyword[def] identifier[make_order_and_cancel] ( identifier[api_svr_ip] , identifier[api_svr_port] , identifier[unlock_password] , identifier[test_code] , identifier[trade_env] , identifier[acc_id] ):
literal[string]
keyword[if] identifier[unlock_password] == literal[string] :
keyword[raise] ide... | def make_order_and_cancel(api_svr_ip, api_svr_port, unlock_password, test_code, trade_env, acc_id):
"""
使用请先配置正确参数:
:param api_svr_ip: (string) ip
:param api_svr_port: (string) ip
:param unlock_password: (string) 交易解锁密码, 必需修改!
:param test_code: (string) 股票
:param trade_env: 参见 ft.TrdEnv的定义
... |
def getPrivilegeForRole(self, rolename):
"""
Returns the privilege associated with a role.
Input:
rolename - name of the role
Output:
JSON Messages
"""
params = {
"f" : "json",
"rolename" : rolename
}
... | def function[getPrivilegeForRole, parameter[self, rolename]]:
constant[
Returns the privilege associated with a role.
Input:
rolename - name of the role
Output:
JSON Messages
]
variable[params] assign[=] dictionary[[<ast.Constant objec... | keyword[def] identifier[getPrivilegeForRole] ( identifier[self] , identifier[rolename] ):
literal[string]
identifier[params] ={
literal[string] : literal[string] ,
literal[string] : identifier[rolename]
}
identifier[pURL] = identifier[self] . identifier[_url] + l... | def getPrivilegeForRole(self, rolename):
"""
Returns the privilege associated with a role.
Input:
rolename - name of the role
Output:
JSON Messages
"""
params = {'f': 'json', 'rolename': rolename}
pURL = self._url + '/roles/getPrivilege'
... |
def deactivate(name):
"""Deactivate plugin.
Parameters
----------
name : str
Plugin name.
"""
if name in plugins:
plugins[name].deactivate()
else:
raise Exception("plugin {} not found".format(name)) | def function[deactivate, parameter[name]]:
constant[Deactivate plugin.
Parameters
----------
name : str
Plugin name.
]
if compare[name[name] in name[plugins]] begin[:]
call[call[name[plugins]][name[name]].deactivate, parameter[]] | keyword[def] identifier[deactivate] ( identifier[name] ):
literal[string]
keyword[if] identifier[name] keyword[in] identifier[plugins] :
identifier[plugins] [ identifier[name] ]. identifier[deactivate] ()
keyword[else] :
keyword[raise] identifier[Exception] ( literal[string] . id... | def deactivate(name):
"""Deactivate plugin.
Parameters
----------
name : str
Plugin name.
"""
if name in plugins:
plugins[name].deactivate() # depends on [control=['if'], data=['name', 'plugins']]
else:
raise Exception('plugin {} not found'.format(name)) |
def general_rotation_matrix(theta, phi, alpha):
"""
Rotation around vector
u = (sin(theta) cos(phi), sin(theta) sin(phi), cos(theta))
by an angle
alpha
Ref:
http://ksuweb.kennesaw.edu/~plaval//math4490/rotgen.pdf
:parameter float theta:
:parameter float phi:
:parameter float alpha: rotation a... | def function[general_rotation_matrix, parameter[theta, phi, alpha]]:
constant[
Rotation around vector
u = (sin(theta) cos(phi), sin(theta) sin(phi), cos(theta))
by an angle
alpha
Ref:
http://ksuweb.kennesaw.edu/~plaval//math4490/rotgen.pdf
:parameter float theta:
:parameter float phi:
:... | keyword[def] identifier[general_rotation_matrix] ( identifier[theta] , identifier[phi] , identifier[alpha] ):
literal[string]
identifier[C] = identifier[cos] ( identifier[alpha] )
identifier[S] = identifier[sin] ( identifier[alpha] )
identifier[t] = literal[int] - identifier[C]
identifier[ux] = ide... | def general_rotation_matrix(theta, phi, alpha):
"""
Rotation around vector
u = (sin(theta) cos(phi), sin(theta) sin(phi), cos(theta))
by an angle
alpha
Ref:
http://ksuweb.kennesaw.edu/~plaval//math4490/rotgen.pdf
:parameter float theta:
:parameter float phi:
:parameter float alpha: rotation... |
def get_unique_document_id(query_str):
# type: (str) -> str
"""Get a unique id given a query_string"""
assert isinstance(query_str, string_types), (
"Must receive a string as query_str. Received {}"
).format(repr(query_str))
if query_str not in _cached_queries:
_cached_queries[query... | def function[get_unique_document_id, parameter[query_str]]:
constant[Get a unique id given a query_string]
assert[call[name[isinstance], parameter[name[query_str], name[string_types]]]]
if compare[name[query_str] <ast.NotIn object at 0x7da2590d7190> name[_cached_queries]] begin[:]
ca... | keyword[def] identifier[get_unique_document_id] ( identifier[query_str] ):
literal[string]
keyword[assert] identifier[isinstance] ( identifier[query_str] , identifier[string_types] ),(
literal[string]
). identifier[format] ( identifier[repr] ( identifier[query_str] ))
keyword[if] identif... | def get_unique_document_id(query_str):
# type: (str) -> str
'Get a unique id given a query_string'
assert isinstance(query_str, string_types), 'Must receive a string as query_str. Received {}'.format(repr(query_str))
if query_str not in _cached_queries:
_cached_queries[query_str] = sha1(str(quer... |
def get_final_freq(approx, m1, m2, s1z, s2z):
"""
Returns the LALSimulation function which evaluates the final
(highest) frequency for a given approximant using given template
parameters.
NOTE: TaylorTx and TaylorFx are currently all given an ISCO cutoff !!
Parameters
----------
approx ... | def function[get_final_freq, parameter[approx, m1, m2, s1z, s2z]]:
constant[
Returns the LALSimulation function which evaluates the final
(highest) frequency for a given approximant using given template
parameters.
NOTE: TaylorTx and TaylorFx are currently all given an ISCO cutoff !!
Parame... | keyword[def] identifier[get_final_freq] ( identifier[approx] , identifier[m1] , identifier[m2] , identifier[s1z] , identifier[s2z] ):
literal[string]
identifier[lalsim_approx] = identifier[lalsimulation] . identifier[GetApproximantFromString] ( identifier[approx] )
keyword[return] identifier[_vec_get... | def get_final_freq(approx, m1, m2, s1z, s2z):
"""
Returns the LALSimulation function which evaluates the final
(highest) frequency for a given approximant using given template
parameters.
NOTE: TaylorTx and TaylorFx are currently all given an ISCO cutoff !!
Parameters
----------
approx ... |
def reasons_to_paths(reasons):
"""Calculate the dependency paths to the reasons of the blockers.
Paths will be in reverse-dependency order (i.e. parent projects are in
ascending order).
"""
blockers = set(reasons.keys()) - set(reasons.values())
paths = set()
for blocker in blockers:
... | def function[reasons_to_paths, parameter[reasons]]:
constant[Calculate the dependency paths to the reasons of the blockers.
Paths will be in reverse-dependency order (i.e. parent projects are in
ascending order).
]
variable[blockers] assign[=] binary_operation[call[name[set], parameter[cal... | keyword[def] identifier[reasons_to_paths] ( identifier[reasons] ):
literal[string]
identifier[blockers] = identifier[set] ( identifier[reasons] . identifier[keys] ())- identifier[set] ( identifier[reasons] . identifier[values] ())
identifier[paths] = identifier[set] ()
keyword[for] identifier[bl... | def reasons_to_paths(reasons):
"""Calculate the dependency paths to the reasons of the blockers.
Paths will be in reverse-dependency order (i.e. parent projects are in
ascending order).
"""
blockers = set(reasons.keys()) - set(reasons.values())
paths = set()
for blocker in blockers:
... |
def generate_parallel(samples, run_parallel):
"""Provide parallel preparation of summary information for alignment and variant calling.
"""
to_analyze, extras = _split_samples_by_qc(samples)
qced = run_parallel("pipeline_summary", to_analyze)
samples = _combine_qc_samples(qced) + extras
qsign_in... | def function[generate_parallel, parameter[samples, run_parallel]]:
constant[Provide parallel preparation of summary information for alignment and variant calling.
]
<ast.Tuple object at 0x7da1b1867c40> assign[=] call[name[_split_samples_by_qc], parameter[name[samples]]]
variable[qced] assign... | keyword[def] identifier[generate_parallel] ( identifier[samples] , identifier[run_parallel] ):
literal[string]
identifier[to_analyze] , identifier[extras] = identifier[_split_samples_by_qc] ( identifier[samples] )
identifier[qced] = identifier[run_parallel] ( literal[string] , identifier[to_analyze] )... | def generate_parallel(samples, run_parallel):
"""Provide parallel preparation of summary information for alignment and variant calling.
"""
(to_analyze, extras) = _split_samples_by_qc(samples)
qced = run_parallel('pipeline_summary', to_analyze)
samples = _combine_qc_samples(qced) + extras
qsign_... |
def clean_perms(self):
"""
FAB leaves faulty permissions that need to be cleaned up
"""
self.log.debug('Cleaning faulty perms')
sesh = self.get_session
pvms = (
sesh.query(sqla_models.PermissionView)
.filter(or_(
sqla_models.Permiss... | def function[clean_perms, parameter[self]]:
constant[
FAB leaves faulty permissions that need to be cleaned up
]
call[name[self].log.debug, parameter[constant[Cleaning faulty perms]]]
variable[sesh] assign[=] name[self].get_session
variable[pvms] assign[=] call[call[name[... | keyword[def] identifier[clean_perms] ( identifier[self] ):
literal[string]
identifier[self] . identifier[log] . identifier[debug] ( literal[string] )
identifier[sesh] = identifier[self] . identifier[get_session]
identifier[pvms] =(
identifier[sesh] . identifier[query] ( ... | def clean_perms(self):
"""
FAB leaves faulty permissions that need to be cleaned up
"""
self.log.debug('Cleaning faulty perms')
sesh = self.get_session # NOQA
# NOQA
pvms = sesh.query(sqla_models.PermissionView).filter(or_(sqla_models.PermissionView.permission == None, sqla_models.P... |
def update_experiment():
'''Update the experiment status in config file'''
experiment_config = Experiments()
experiment_dict = experiment_config.get_all_experiments()
if not experiment_dict:
return None
for key in experiment_dict.keys():
if isinstance(experiment_dict[key], dict):
... | def function[update_experiment, parameter[]]:
constant[Update the experiment status in config file]
variable[experiment_config] assign[=] call[name[Experiments], parameter[]]
variable[experiment_dict] assign[=] call[name[experiment_config].get_all_experiments, parameter[]]
if <ast.UnaryO... | keyword[def] identifier[update_experiment] ():
literal[string]
identifier[experiment_config] = identifier[Experiments] ()
identifier[experiment_dict] = identifier[experiment_config] . identifier[get_all_experiments] ()
keyword[if] keyword[not] identifier[experiment_dict] :
keyword[retu... | def update_experiment():
"""Update the experiment status in config file"""
experiment_config = Experiments()
experiment_dict = experiment_config.get_all_experiments()
if not experiment_dict:
return None # depends on [control=['if'], data=[]]
for key in experiment_dict.keys():
if isi... |
def ColorfullyWriteLine(log: str, consoleColor: int = -1, writeToFile: bool = True, printToStdout: bool = True, logFile: str = None) -> None:
"""
log: str.
consoleColor: int, a value in class `ConsoleColor`, such as `ConsoleColor.DarkGreen`.
writeToFile: bool.
printToStdout: bool... | def function[ColorfullyWriteLine, parameter[log, consoleColor, writeToFile, printToStdout, logFile]]:
constant[
log: str.
consoleColor: int, a value in class `ConsoleColor`, such as `ConsoleColor.DarkGreen`.
writeToFile: bool.
printToStdout: bool.
logFile: str, log file p... | keyword[def] identifier[ColorfullyWriteLine] ( identifier[log] : identifier[str] , identifier[consoleColor] : identifier[int] =- literal[int] , identifier[writeToFile] : identifier[bool] = keyword[True] , identifier[printToStdout] : identifier[bool] = keyword[True] , identifier[logFile] : identifier[str] = keyword[No... | def ColorfullyWriteLine(log: str, consoleColor: int=-1, writeToFile: bool=True, printToStdout: bool=True, logFile: str=None) -> None:
"""
log: str.
consoleColor: int, a value in class `ConsoleColor`, such as `ConsoleColor.DarkGreen`.
writeToFile: bool.
printToStdout: bool.
lo... |
def add_context(self, isc_name, isc_policy_id, isc_traffic_tag):
"""
Create the VSS Context within the VSSContainer
:param str isc_name: ISC name, possibly append policy name??
:param str isc_policy_id: Policy ID in SMC (the 'key' attribute)
:param str isc_traffic_tag: NSX group... | def function[add_context, parameter[self, isc_name, isc_policy_id, isc_traffic_tag]]:
constant[
Create the VSS Context within the VSSContainer
:param str isc_name: ISC name, possibly append policy name??
:param str isc_policy_id: Policy ID in SMC (the 'key' attribute)
:param str... | keyword[def] identifier[add_context] ( identifier[self] , identifier[isc_name] , identifier[isc_policy_id] , identifier[isc_traffic_tag] ):
literal[string]
keyword[if] literal[string] keyword[in] identifier[self] . identifier[data] . identifier[links] :
identifier[element] = identif... | def add_context(self, isc_name, isc_policy_id, isc_traffic_tag):
"""
Create the VSS Context within the VSSContainer
:param str isc_name: ISC name, possibly append policy name??
:param str isc_policy_id: Policy ID in SMC (the 'key' attribute)
:param str isc_traffic_tag: NSX groupId (... |
def where(cls, condition, istrue, isfalse, dtype=None):
"""
Selects elements from either istrue or isfalse depending on the value
of the condition SArray.
Parameters
----------
condition : SArray
An SArray of values such that for each value, if non-zero, yields a... | def function[where, parameter[cls, condition, istrue, isfalse, dtype]]:
constant[
Selects elements from either istrue or isfalse depending on the value
of the condition SArray.
Parameters
----------
condition : SArray
An SArray of values such that for each value,... | keyword[def] identifier[where] ( identifier[cls] , identifier[condition] , identifier[istrue] , identifier[isfalse] , identifier[dtype] = keyword[None] ):
literal[string]
identifier[true_is_sarray] = identifier[isinstance] ( identifier[istrue] , identifier[SArray] )
identifier[false_is_sar... | def where(cls, condition, istrue, isfalse, dtype=None):
"""
Selects elements from either istrue or isfalse depending on the value
of the condition SArray.
Parameters
----------
condition : SArray
An SArray of values such that for each value, if non-zero, yields a
... |
def _get_blocks_containing_index(self, axis, index):
"""Convert a global index to a block index and local index.
Note: This method is primarily used to convert a global index into a
partition index (along the axis provided) and local index (useful
for `iloc` or similar operation... | def function[_get_blocks_containing_index, parameter[self, axis, index]]:
constant[Convert a global index to a block index and local index.
Note: This method is primarily used to convert a global index into a
partition index (along the axis provided) and local index (useful
for ... | keyword[def] identifier[_get_blocks_containing_index] ( identifier[self] , identifier[axis] , identifier[index] ):
literal[string]
keyword[if] keyword[not] identifier[axis] :
identifier[ErrorMessage] . identifier[catch_bugs_and_request_email] ( identifier[index] > identifier[sum] ( i... | def _get_blocks_containing_index(self, axis, index):
"""Convert a global index to a block index and local index.
Note: This method is primarily used to convert a global index into a
partition index (along the axis provided) and local index (useful
for `iloc` or similar operations.
... |
def snyder_opt(self, structure):
"""
Calculates Snyder's optical sound velocity (in SI units)
Args:
structure: pymatgen structure object
Returns: Snyder's optical sound velocity (in SI units)
"""
nsites = structure.num_sites
volume = structure.volum... | def function[snyder_opt, parameter[self, structure]]:
constant[
Calculates Snyder's optical sound velocity (in SI units)
Args:
structure: pymatgen structure object
Returns: Snyder's optical sound velocity (in SI units)
]
variable[nsites] assign[=] name[stru... | keyword[def] identifier[snyder_opt] ( identifier[self] , identifier[structure] ):
literal[string]
identifier[nsites] = identifier[structure] . identifier[num_sites]
identifier[volume] = identifier[structure] . identifier[volume]
identifier[num_density] = literal[int] * identifie... | def snyder_opt(self, structure):
"""
Calculates Snyder's optical sound velocity (in SI units)
Args:
structure: pymatgen structure object
Returns: Snyder's optical sound velocity (in SI units)
"""
nsites = structure.num_sites
volume = structure.volume
num_de... |
def list_local_files(self):
"""Returns list of all stored local files.
Each element of this list is of :class:`DataStore.FileInfoEntry`
type.
"""
result = []
if self.local_store:
result.extend(self.local_store.list_files())
return result | def function[list_local_files, parameter[self]]:
constant[Returns list of all stored local files.
Each element of this list is of :class:`DataStore.FileInfoEntry`
type.
]
variable[result] assign[=] list[[]]
if name[self].local_store begin[:]
call[... | keyword[def] identifier[list_local_files] ( identifier[self] ):
literal[string]
identifier[result] =[]
keyword[if] identifier[self] . identifier[local_store] :
identifier[result] . identifier[extend] ( identifier[self] . identifier[local_store] . identifier[list_files] ())
... | def list_local_files(self):
"""Returns list of all stored local files.
Each element of this list is of :class:`DataStore.FileInfoEntry`
type.
"""
result = []
if self.local_store:
result.extend(self.local_store.list_files()) # depends on [control=['if'], data=[]]
... |
def normalize_dictionary_values(dictionary):
"""
Normalizes the values in a dictionary recursivly.
"""
for key, val in dictionary.iteritems():
if isinstance(val, dict):
dictionary[key] = normalize_dictionary_values(val)
elif isinstance(val, list):
dictionary[... | def function[normalize_dictionary_values, parameter[dictionary]]:
constant[
Normalizes the values in a dictionary recursivly.
]
for taget[tuple[[<ast.Name object at 0x7da1b2345ab0>, <ast.Name object at 0x7da1b2345f30>]]] in starred[call[name[dictionary].iteritems, parameter[]]] begin[:]
... | keyword[def] identifier[normalize_dictionary_values] ( identifier[dictionary] ):
literal[string]
keyword[for] identifier[key] , identifier[val] keyword[in] identifier[dictionary] . identifier[iteritems] ():
keyword[if] identifier[isinstance] ( identifier[val] , identifier[dict] ):
... | def normalize_dictionary_values(dictionary):
"""
Normalizes the values in a dictionary recursivly.
"""
for (key, val) in dictionary.iteritems():
if isinstance(val, dict):
dictionary[key] = normalize_dictionary_values(val) # depends on [control=['if'], data=[]]
elif isinstanc... |
def analyze_feature(raw_datasets, feature, basename="aspect_ratios"):
"""
Apply ``feature`` to all recordings in ``raw_datasets``. Store the results
in two files. One file stores the raw result, the other one groups the
results by symbols and stores the mean, standard deviation and the name of
the s... | def function[analyze_feature, parameter[raw_datasets, feature, basename]]:
constant[
Apply ``feature`` to all recordings in ``raw_datasets``. Store the results
in two files. One file stores the raw result, the other one groups the
results by symbols and stores the mean, standard deviation and the na... | keyword[def] identifier[analyze_feature] ( identifier[raw_datasets] , identifier[feature] , identifier[basename] = literal[string] ):
literal[string]
identifier[csv_file] = identifier[dam] . identifier[prepare_file] ( identifier[basename] + literal[string] )
identifier[raw_file] = identifier[dam... | def analyze_feature(raw_datasets, feature, basename='aspect_ratios'):
"""
Apply ``feature`` to all recordings in ``raw_datasets``. Store the results
in two files. One file stores the raw result, the other one groups the
results by symbols and stores the mean, standard deviation and the name of
the s... |
def add(self, items):
'''add a submenu'''
if not isinstance(items, list):
items = [items]
for m in items:
updated = False
for i in range(len(self.items)):
if self.items[i].name == m.name:
self.items[i] = m
... | def function[add, parameter[self, items]]:
constant[add a submenu]
if <ast.UnaryOp object at 0x7da1b17de1d0> begin[:]
variable[items] assign[=] list[[<ast.Name object at 0x7da1b17dd870>]]
for taget[name[m]] in starred[name[items]] begin[:]
variable[updated] assign... | keyword[def] identifier[add] ( identifier[self] , identifier[items] ):
literal[string]
keyword[if] keyword[not] identifier[isinstance] ( identifier[items] , identifier[list] ):
identifier[items] =[ identifier[items] ]
keyword[for] identifier[m] keyword[in] identifier[item... | def add(self, items):
"""add a submenu"""
if not isinstance(items, list):
items = [items] # depends on [control=['if'], data=[]]
for m in items:
updated = False
for i in range(len(self.items)):
if self.items[i].name == m.name:
self.items[i] = m
... |
def RIBVRFRouteLimitExceeded_originator_switch_info_switchIdentifier(self, **kwargs):
"""Auto Generated Code
"""
config = ET.Element("config")
RIBVRFRouteLimitExceeded = ET.SubElement(config, "RIBVRFRouteLimitExceeded", xmlns="http://brocade.com/ns/brocade-notification-stream")
o... | def function[RIBVRFRouteLimitExceeded_originator_switch_info_switchIdentifier, parameter[self]]:
constant[Auto Generated Code
]
variable[config] assign[=] call[name[ET].Element, parameter[constant[config]]]
variable[RIBVRFRouteLimitExceeded] assign[=] call[name[ET].SubElement, parameter[... | keyword[def] identifier[RIBVRFRouteLimitExceeded_originator_switch_info_switchIdentifier] ( identifier[self] ,** identifier[kwargs] ):
literal[string]
identifier[config] = identifier[ET] . identifier[Element] ( literal[string] )
identifier[RIBVRFRouteLimitExceeded] = identifier[ET] . ident... | def RIBVRFRouteLimitExceeded_originator_switch_info_switchIdentifier(self, **kwargs):
"""Auto Generated Code
"""
config = ET.Element('config')
RIBVRFRouteLimitExceeded = ET.SubElement(config, 'RIBVRFRouteLimitExceeded', xmlns='http://brocade.com/ns/brocade-notification-stream')
originator_switch... |
def update_soil_moisture(self):
""" Method will select the ADC module,
turn on the analog sensor, wait for voltage settle,
and then digitize the sensor voltage.
Voltage division/signal loss is accounted for by
scaling up the sensor output.
... | def function[update_soil_moisture, parameter[self]]:
constant[ Method will select the ADC module,
turn on the analog sensor, wait for voltage settle,
and then digitize the sensor voltage.
Voltage division/signal loss is accounted for by
scaling up t... | keyword[def] identifier[update_soil_moisture] ( identifier[self] ):
literal[string]
identifier[SensorCluster] . identifier[analog_sensor_power] ( identifier[SensorCluster] . identifier[bus] , literal[string] )
identifier[sleep] ( literal[int] )
identifier[TCA_select] ( identif... | def update_soil_moisture(self):
""" Method will select the ADC module,
turn on the analog sensor, wait for voltage settle,
and then digitize the sensor voltage.
Voltage division/signal loss is accounted for by
scaling up the sensor output.
... |
def rewrite_kwargs(conn_type, kwargs, module_name=None):
"""
Manipulate connection keywords.
Modifieds keywords based on connection type.
There is an assumption here that the client has
already been created and that these keywords are being
passed into methods for interacting with various ... | def function[rewrite_kwargs, parameter[conn_type, kwargs, module_name]]:
constant[
Manipulate connection keywords.
Modifieds keywords based on connection type.
There is an assumption here that the client has
already been created and that these keywords are being
passed into methods for... | keyword[def] identifier[rewrite_kwargs] ( identifier[conn_type] , identifier[kwargs] , identifier[module_name] = keyword[None] ):
literal[string]
keyword[if] identifier[conn_type] != literal[string] keyword[and] identifier[module_name] != literal[string] :
keyword[if] literal[string] keyword[... | def rewrite_kwargs(conn_type, kwargs, module_name=None):
"""
Manipulate connection keywords.
Modifieds keywords based on connection type.
There is an assumption here that the client has
already been created and that these keywords are being
passed into methods for interacting with various ... |
def delete(self, request, *args, **kwargs):
"""
Delete the user's avatar.
We set `user.avatar = None` instead of calling `user.avatar.delete()`
to avoid test errors with `django.inmemorystorage`.
"""
user = self.get_object()
user.avatar = None
user.save()... | def function[delete, parameter[self, request]]:
constant[
Delete the user's avatar.
We set `user.avatar = None` instead of calling `user.avatar.delete()`
to avoid test errors with `django.inmemorystorage`.
]
variable[user] assign[=] call[name[self].get_object, parameter[... | keyword[def] identifier[delete] ( identifier[self] , identifier[request] ,* identifier[args] ,** identifier[kwargs] ):
literal[string]
identifier[user] = identifier[self] . identifier[get_object] ()
identifier[user] . identifier[avatar] = keyword[None]
identifier[user] . identifi... | def delete(self, request, *args, **kwargs):
"""
Delete the user's avatar.
We set `user.avatar = None` instead of calling `user.avatar.delete()`
to avoid test errors with `django.inmemorystorage`.
"""
user = self.get_object()
user.avatar = None
user.save()
return resp... |
def get_zero_position(self):
"""
Returns programmed zero position in OTP memory.
"""
LSB = self.bus.read_byte_data(self.address, self.zero_position_MSB)
MSB = self.bus.read_byte_data(self.address, self.zero_position_LSB)
DATA = (MSB << 6) + LSB
return DATA | def function[get_zero_position, parameter[self]]:
constant[
Returns programmed zero position in OTP memory.
]
variable[LSB] assign[=] call[name[self].bus.read_byte_data, parameter[name[self].address, name[self].zero_position_MSB]]
variable[MSB] assign[=] call[name[self].bus.read_... | keyword[def] identifier[get_zero_position] ( identifier[self] ):
literal[string]
identifier[LSB] = identifier[self] . identifier[bus] . identifier[read_byte_data] ( identifier[self] . identifier[address] , identifier[self] . identifier[zero_position_MSB] )
identifier[MSB] = identifier[sel... | def get_zero_position(self):
"""
Returns programmed zero position in OTP memory.
"""
LSB = self.bus.read_byte_data(self.address, self.zero_position_MSB)
MSB = self.bus.read_byte_data(self.address, self.zero_position_LSB)
DATA = (MSB << 6) + LSB
return DATA |
def start_update(self, layer_id):
"""
A shortcut to create a new version and start importing it.
Effectively the same as :py:meth:`koordinates.layers.LayerManager.create_draft` followed by :py:meth:`koordinates.layers.LayerManager.start_import`.
"""
target_url = self.client.get_u... | def function[start_update, parameter[self, layer_id]]:
constant[
A shortcut to create a new version and start importing it.
Effectively the same as :py:meth:`koordinates.layers.LayerManager.create_draft` followed by :py:meth:`koordinates.layers.LayerManager.start_import`.
]
varia... | keyword[def] identifier[start_update] ( identifier[self] , identifier[layer_id] ):
literal[string]
identifier[target_url] = identifier[self] . identifier[client] . identifier[get_url] ( literal[string] , literal[string] , literal[string] ,{ literal[string] : identifier[layer_id] })
identif... | def start_update(self, layer_id):
"""
A shortcut to create a new version and start importing it.
Effectively the same as :py:meth:`koordinates.layers.LayerManager.create_draft` followed by :py:meth:`koordinates.layers.LayerManager.start_import`.
"""
target_url = self.client.get_url('LAYE... |
def ParseMetadataFile(
self, parser_mediator, file_entry, data_stream_name):
"""Parses a metadata file.
Args:
parser_mediator (ParserMediator): parser mediator.
file_entry (dfvfs.FileEntry): file entry.
data_stream_name (str): data stream name.
"""
parent_path_spec = getattr(fil... | def function[ParseMetadataFile, parameter[self, parser_mediator, file_entry, data_stream_name]]:
constant[Parses a metadata file.
Args:
parser_mediator (ParserMediator): parser mediator.
file_entry (dfvfs.FileEntry): file entry.
data_stream_name (str): data stream name.
]
vari... | keyword[def] identifier[ParseMetadataFile] (
identifier[self] , identifier[parser_mediator] , identifier[file_entry] , identifier[data_stream_name] ):
literal[string]
identifier[parent_path_spec] = identifier[getattr] ( identifier[file_entry] . identifier[path_spec] , literal[string] , keyword[None] )
... | def ParseMetadataFile(self, parser_mediator, file_entry, data_stream_name):
"""Parses a metadata file.
Args:
parser_mediator (ParserMediator): parser mediator.
file_entry (dfvfs.FileEntry): file entry.
data_stream_name (str): data stream name.
"""
parent_path_spec = getattr(file_entry... |
def extract_surface(self, pass_pointid=True, pass_cellid=True, inplace=False):
"""
Extract surface mesh of the grid
Parameters
----------
pass_pointid : bool, optional
Adds a point scalar "vtkOriginalPointIds" that idenfities which
original points these s... | def function[extract_surface, parameter[self, pass_pointid, pass_cellid, inplace]]:
constant[
Extract surface mesh of the grid
Parameters
----------
pass_pointid : bool, optional
Adds a point scalar "vtkOriginalPointIds" that idenfities which
original poi... | keyword[def] identifier[extract_surface] ( identifier[self] , identifier[pass_pointid] = keyword[True] , identifier[pass_cellid] = keyword[True] , identifier[inplace] = keyword[False] ):
literal[string]
identifier[surf_filter] = identifier[vtk] . identifier[vtkDataSetSurfaceFilter] ()
iden... | def extract_surface(self, pass_pointid=True, pass_cellid=True, inplace=False):
"""
Extract surface mesh of the grid
Parameters
----------
pass_pointid : bool, optional
Adds a point scalar "vtkOriginalPointIds" that idenfities which
original points these surfa... |
def decode_msg(msg, enc='utf-8'):
"""
Decodes a message fragment.
Args: msg - A Message object representing the fragment
enc - The encoding to use for decoding the message
"""
# We avoid the get_payload decoding machinery for raw
# content-transfer-encodings potentially containing non... | def function[decode_msg, parameter[msg, enc]]:
constant[
Decodes a message fragment.
Args: msg - A Message object representing the fragment
enc - The encoding to use for decoding the message
]
variable[cte] assign[=] call[call[name[str], parameter[call[name[msg].get, parameter[con... | keyword[def] identifier[decode_msg] ( identifier[msg] , identifier[enc] = literal[string] ):
literal[string]
identifier[cte] = identifier[str] ( identifier[msg] . identifier[get] ( literal[string] , literal[string] )). identifier[lower] ()
identifier[decode] = identifier[cte] keyw... | def decode_msg(msg, enc='utf-8'):
"""
Decodes a message fragment.
Args: msg - A Message object representing the fragment
enc - The encoding to use for decoding the message
"""
# We avoid the get_payload decoding machinery for raw
# content-transfer-encodings potentially containing non... |
def eventFilter( self, object, event ):
"""
Processes events for the menu tree.
:param event | <QEvent>
"""
if ( not event.type() in (QEvent.DragEnter,
QEvent.DragMove,
QEvent.Drop) ):
r... | def function[eventFilter, parameter[self, object, event]]:
constant[
Processes events for the menu tree.
:param event | <QEvent>
]
if <ast.UnaryOp object at 0x7da1b253b310> begin[:]
return[constant[False]]
if compare[call[name[event].type, parameter[... | keyword[def] identifier[eventFilter] ( identifier[self] , identifier[object] , identifier[event] ):
literal[string]
keyword[if] ( keyword[not] identifier[event] . identifier[type] () keyword[in] ( identifier[QEvent] . identifier[DragEnter] ,
identifier[QEvent] . identifier[DragMove] ,
... | def eventFilter(self, object, event):
"""
Processes events for the menu tree.
:param event | <QEvent>
"""
if not event.type() in (QEvent.DragEnter, QEvent.DragMove, QEvent.Drop):
return False # depends on [control=['if'], data=[]]
# support dragging and droppin... |
def color_range(startcolor, goalcolor, steps):
"""
wrapper for interpolate_tuple that accepts colors as html ("#CCCCC" and such)
"""
start_tuple = make_color_tuple(startcolor)
goal_tuple = make_color_tuple(goalcolor)
return interpolate_tuple(start_tuple, goal_tuple, steps) | def function[color_range, parameter[startcolor, goalcolor, steps]]:
constant[
wrapper for interpolate_tuple that accepts colors as html ("#CCCCC" and such)
]
variable[start_tuple] assign[=] call[name[make_color_tuple], parameter[name[startcolor]]]
variable[goal_tuple] assign[=] call[name... | keyword[def] identifier[color_range] ( identifier[startcolor] , identifier[goalcolor] , identifier[steps] ):
literal[string]
identifier[start_tuple] = identifier[make_color_tuple] ( identifier[startcolor] )
identifier[goal_tuple] = identifier[make_color_tuple] ( identifier[goalcolor] )
keyword[r... | def color_range(startcolor, goalcolor, steps):
"""
wrapper for interpolate_tuple that accepts colors as html ("#CCCCC" and such)
"""
start_tuple = make_color_tuple(startcolor)
goal_tuple = make_color_tuple(goalcolor)
return interpolate_tuple(start_tuple, goal_tuple, steps) |
def maf(genotypes):
"""Computes the MAF and returns a boolean indicating if the minor allele
is currently the coded allele.
"""
warnings.warn("deprecated: use 'Genotypes.maf'", DeprecationWarning)
g = genotypes.genotypes
maf = np.nansum(g) / (2 * np.sum(~np.isnan(g)))
if maf > 0.5:
... | def function[maf, parameter[genotypes]]:
constant[Computes the MAF and returns a boolean indicating if the minor allele
is currently the coded allele.
]
call[name[warnings].warn, parameter[constant[deprecated: use 'Genotypes.maf'], name[DeprecationWarning]]]
variable[g] assign[=] name[g... | keyword[def] identifier[maf] ( identifier[genotypes] ):
literal[string]
identifier[warnings] . identifier[warn] ( literal[string] , identifier[DeprecationWarning] )
identifier[g] = identifier[genotypes] . identifier[genotypes]
identifier[maf] = identifier[np] . identifier[nansum] ( identifier[g]... | def maf(genotypes):
"""Computes the MAF and returns a boolean indicating if the minor allele
is currently the coded allele.
"""
warnings.warn("deprecated: use 'Genotypes.maf'", DeprecationWarning)
g = genotypes.genotypes
maf = np.nansum(g) / (2 * np.sum(~np.isnan(g)))
if maf > 0.5:
... |
def get_labels(cls, path=None):
"""Get all server configuration labels.
:param path: A string. The configuration file to be manipulated.
Defaults to what is returned by
:func:`nailgun.config._get_config_file_path`.
:returns: Server configuration labels, where each label ... | def function[get_labels, parameter[cls, path]]:
constant[Get all server configuration labels.
:param path: A string. The configuration file to be manipulated.
Defaults to what is returned by
:func:`nailgun.config._get_config_file_path`.
:returns: Server configuration lab... | keyword[def] identifier[get_labels] ( identifier[cls] , identifier[path] = keyword[None] ):
literal[string]
keyword[if] identifier[path] keyword[is] keyword[None] :
identifier[path] = identifier[_get_config_file_path] (
identifier[cls] . identifier[_xdg_config_dir] ,
... | def get_labels(cls, path=None):
"""Get all server configuration labels.
:param path: A string. The configuration file to be manipulated.
Defaults to what is returned by
:func:`nailgun.config._get_config_file_path`.
:returns: Server configuration labels, where each label is a... |
def post(method, hmc, uri, uri_parms, body, logon_required,
wait_for_completion):
"""Operation: Create Hipersocket (requires DPM mode)."""
assert wait_for_completion is True
cpc_oid = uri_parms[0]
try:
cpc = hmc.cpcs.lookup_by_oid(cpc_oid)
except KeyError... | def function[post, parameter[method, hmc, uri, uri_parms, body, logon_required, wait_for_completion]]:
constant[Operation: Create Hipersocket (requires DPM mode).]
assert[compare[name[wait_for_completion] is constant[True]]]
variable[cpc_oid] assign[=] call[name[uri_parms]][constant[0]]
<ast.Try... | keyword[def] identifier[post] ( identifier[method] , identifier[hmc] , identifier[uri] , identifier[uri_parms] , identifier[body] , identifier[logon_required] ,
identifier[wait_for_completion] ):
literal[string]
keyword[assert] identifier[wait_for_completion] keyword[is] keyword[True]
... | def post(method, hmc, uri, uri_parms, body, logon_required, wait_for_completion):
"""Operation: Create Hipersocket (requires DPM mode)."""
assert wait_for_completion is True
cpc_oid = uri_parms[0]
try:
cpc = hmc.cpcs.lookup_by_oid(cpc_oid) # depends on [control=['try'], data=[]]
except KeyE... |
def delete(self):
"""Delete this table.
For example:
.. literalinclude:: snippets_table.py
:start-after: [START bigtable_delete_table]
:end-before: [END bigtable_delete_table]
"""
table_client = self._instance._client.table_admin_client
table_cl... | def function[delete, parameter[self]]:
constant[Delete this table.
For example:
.. literalinclude:: snippets_table.py
:start-after: [START bigtable_delete_table]
:end-before: [END bigtable_delete_table]
]
variable[table_client] assign[=] name[self]._ins... | keyword[def] identifier[delete] ( identifier[self] ):
literal[string]
identifier[table_client] = identifier[self] . identifier[_instance] . identifier[_client] . identifier[table_admin_client]
identifier[table_client] . identifier[delete_table] ( identifier[name] = identifier[self] . iden... | def delete(self):
"""Delete this table.
For example:
.. literalinclude:: snippets_table.py
:start-after: [START bigtable_delete_table]
:end-before: [END bigtable_delete_table]
"""
table_client = self._instance._client.table_admin_client
table_client.delete_... |
async def getLiftRows(self, lops):
'''
Yield row tuples from a series of lift operations.
Row tuples only requirement is that the first element
be the binary id of a node.
Args:
lops (list): A list of lift operations.
Yields:
(tuple): (layer_ind... | <ast.AsyncFunctionDef object at 0x7da1b2309f60> | keyword[async] keyword[def] identifier[getLiftRows] ( identifier[self] , identifier[lops] ):
literal[string]
keyword[for] identifier[layeridx] , identifier[layr] keyword[in] identifier[enumerate] ( identifier[self] . identifier[layers] ):
keyword[async] keyword[for] identifier[x]... | async def getLiftRows(self, lops):
"""
Yield row tuples from a series of lift operations.
Row tuples only requirement is that the first element
be the binary id of a node.
Args:
lops (list): A list of lift operations.
Yields:
(tuple): (layer_indx, (... |
def _naturalize_numbers(self, string):
"""
Makes any integers into very zero-padded numbers.
e.g. '1' becomes '00000001'.
"""
def naturalize_int_match(match):
return '%08d' % (int(match.group(0)),)
string = re.sub(r'\d+', naturalize_int_match, string)
... | def function[_naturalize_numbers, parameter[self, string]]:
constant[
Makes any integers into very zero-padded numbers.
e.g. '1' becomes '00000001'.
]
def function[naturalize_int_match, parameter[match]]:
return[binary_operation[constant[%08d] <ast.Mod object at 0x7da2590... | keyword[def] identifier[_naturalize_numbers] ( identifier[self] , identifier[string] ):
literal[string]
keyword[def] identifier[naturalize_int_match] ( identifier[match] ):
keyword[return] literal[string] %( identifier[int] ( identifier[match] . identifier[group] ( literal[int] )),)... | def _naturalize_numbers(self, string):
"""
Makes any integers into very zero-padded numbers.
e.g. '1' becomes '00000001'.
"""
def naturalize_int_match(match):
return '%08d' % (int(match.group(0)),)
string = re.sub('\\d+', naturalize_int_match, string)
return string |
def _is_valid_edition(self):
"""
Return True if the input value of attribute "edition" is valid,
and otherwise False.
:returns: True if value is valid, False otherwise
:rtype: boolean
"""
comp_str = self._standard_value[0]
packed = []
packed.app... | def function[_is_valid_edition, parameter[self]]:
constant[
Return True if the input value of attribute "edition" is valid,
and otherwise False.
:returns: True if value is valid, False otherwise
:rtype: boolean
]
variable[comp_str] assign[=] call[name[self]._stan... | keyword[def] identifier[_is_valid_edition] ( identifier[self] ):
literal[string]
identifier[comp_str] = identifier[self] . identifier[_standard_value] [ literal[int] ]
identifier[packed] =[]
identifier[packed] . identifier[append] ( literal[string] )
identifier[packed] ... | def _is_valid_edition(self):
"""
Return True if the input value of attribute "edition" is valid,
and otherwise False.
:returns: True if value is valid, False otherwise
:rtype: boolean
"""
comp_str = self._standard_value[0]
packed = []
packed.append('(')
packe... |
def set_position(x, y, stream=STD_OUTPUT_HANDLE):
''' Sets current position of the cursor. '''
stream = kernel32.GetStdHandle(stream)
value = x + (y << 16)
kernel32.SetConsoleCursorPosition(stream, c_long(value)) | def function[set_position, parameter[x, y, stream]]:
constant[ Sets current position of the cursor. ]
variable[stream] assign[=] call[name[kernel32].GetStdHandle, parameter[name[stream]]]
variable[value] assign[=] binary_operation[name[x] + binary_operation[name[y] <ast.LShift object at 0x7da259... | keyword[def] identifier[set_position] ( identifier[x] , identifier[y] , identifier[stream] = identifier[STD_OUTPUT_HANDLE] ):
literal[string]
identifier[stream] = identifier[kernel32] . identifier[GetStdHandle] ( identifier[stream] )
identifier[value] = identifier[x] +( identifier[y] << literal[int] )... | def set_position(x, y, stream=STD_OUTPUT_HANDLE):
""" Sets current position of the cursor. """
stream = kernel32.GetStdHandle(stream)
value = x + (y << 16)
kernel32.SetConsoleCursorPosition(stream, c_long(value)) |
def get_current_element(self, ):
"""Return the currently open Shot or Asset
:returns: the currently open element
:rtype: :class:`jukeboxcore.djadapter.models.Asset` | :class:`jukeboxcore.djadapter.models.Shot` | None
:raises: :class:`djadapter.models.TaskFile.DoesNotExist`
"""
... | def function[get_current_element, parameter[self]]:
constant[Return the currently open Shot or Asset
:returns: the currently open element
:rtype: :class:`jukeboxcore.djadapter.models.Asset` | :class:`jukeboxcore.djadapter.models.Shot` | None
:raises: :class:`djadapter.models.TaskFile.Do... | keyword[def] identifier[get_current_element] ( identifier[self] ,):
literal[string]
identifier[n] = identifier[jbscene] . identifier[get_current_scene_node] ()
keyword[if] keyword[not] identifier[n] :
keyword[return] keyword[None]
identifier[tfid] = identifier[cmd... | def get_current_element(self):
"""Return the currently open Shot or Asset
:returns: the currently open element
:rtype: :class:`jukeboxcore.djadapter.models.Asset` | :class:`jukeboxcore.djadapter.models.Shot` | None
:raises: :class:`djadapter.models.TaskFile.DoesNotExist`
"""
n =... |
def _Rphideriv(self,R,phi=0.,t=0.):
"""
NAME:
_Rphideriv
PURPOSE:
evaluate the mixed radial-azimuthal derivative
INPUT:
R
phi
t
OUTPUT:
d2phi/dRdphi
HISTORY:
2016-06-02 - Written - Bovy (UofT)
... | def function[_Rphideriv, parameter[self, R, phi, t]]:
constant[
NAME:
_Rphideriv
PURPOSE:
evaluate the mixed radial-azimuthal derivative
INPUT:
R
phi
t
OUTPUT:
d2phi/dRdphi
HISTORY:
2016-06-02 - ... | keyword[def] identifier[_Rphideriv] ( identifier[self] , identifier[R] , identifier[phi] = literal[int] , identifier[t] = literal[int] ):
literal[string]
keyword[return] identifier[self] . identifier[_Pot] . identifier[Rphideriv] ( identifier[R] , literal[int] , identifier[phi] = identifier[phi] ,... | def _Rphideriv(self, R, phi=0.0, t=0.0):
"""
NAME:
_Rphideriv
PURPOSE:
evaluate the mixed radial-azimuthal derivative
INPUT:
R
phi
t
OUTPUT:
d2phi/dRdphi
HISTORY:
2016-06-02 - Written - Bovy (UofT)
... |
def to_cfn_resource_name(name):
# type: (str) -> str
"""Transform a name to a valid cfn name.
This will convert the provided name to a CamelCase name.
It's possible that the conversion to a CFN resource name
can result in name collisions. It's up to the caller
to handle name collisions appropr... | def function[to_cfn_resource_name, parameter[name]]:
constant[Transform a name to a valid cfn name.
This will convert the provided name to a CamelCase name.
It's possible that the conversion to a CFN resource name
can result in name collisions. It's up to the caller
to handle name collisions a... | keyword[def] identifier[to_cfn_resource_name] ( identifier[name] ):
literal[string]
keyword[if] keyword[not] identifier[name] :
keyword[raise] identifier[ValueError] ( literal[string] % identifier[name] )
identifier[word_separators] =[ literal[string] , literal[string] ]
keyword[for]... | def to_cfn_resource_name(name):
# type: (str) -> str
"Transform a name to a valid cfn name.\n\n This will convert the provided name to a CamelCase name.\n It's possible that the conversion to a CFN resource name\n can result in name collisions. It's up to the caller\n to handle name collisions appr... |
def build_score_matrix(a, b, score_func, gap_penalty):
"""Calculate the score and traceback matrices for two input sequences and
scoring functions.
Returns: A tuple of (score-matrix, traceback-matrix). Each entry in the
score-matrix is a numeric score. Each entry in the traceback-matrix is a
lo... | def function[build_score_matrix, parameter[a, b, score_func, gap_penalty]]:
constant[Calculate the score and traceback matrices for two input sequences and
scoring functions.
Returns: A tuple of (score-matrix, traceback-matrix). Each entry in the
score-matrix is a numeric score. Each entry in the... | keyword[def] identifier[build_score_matrix] ( identifier[a] , identifier[b] , identifier[score_func] , identifier[gap_penalty] ):
literal[string]
identifier[score_matrix] = identifier[Matrix] ( identifier[rows] = identifier[len] ( identifier[a] )+ literal[int] , identifier[cols] = identifier[len] ( identif... | def build_score_matrix(a, b, score_func, gap_penalty):
"""Calculate the score and traceback matrices for two input sequences and
scoring functions.
Returns: A tuple of (score-matrix, traceback-matrix). Each entry in the
score-matrix is a numeric score. Each entry in the traceback-matrix is a
lo... |
def _cache_from_source(path: str) -> str:
"""Return the path to the cached file for the given path. The original path
does not have to exist."""
cache_path, cache_file = os.path.split(importlib.util.cache_from_source(path))
filename, _ = os.path.splitext(cache_file)
return os.path.join(cache_path, f... | def function[_cache_from_source, parameter[path]]:
constant[Return the path to the cached file for the given path. The original path
does not have to exist.]
<ast.Tuple object at 0x7da1b023eec0> assign[=] call[name[os].path.split, parameter[call[name[importlib].util.cache_from_source, parameter[name... | keyword[def] identifier[_cache_from_source] ( identifier[path] : identifier[str] )-> identifier[str] :
literal[string]
identifier[cache_path] , identifier[cache_file] = identifier[os] . identifier[path] . identifier[split] ( identifier[importlib] . identifier[util] . identifier[cache_from_source] ( identif... | def _cache_from_source(path: str) -> str:
"""Return the path to the cached file for the given path. The original path
does not have to exist."""
(cache_path, cache_file) = os.path.split(importlib.util.cache_from_source(path))
(filename, _) = os.path.splitext(cache_file)
return os.path.join(cache_pat... |
def get_checksum(self):
"""Return the md5 checksum of the delta file."""
with open(self.file, 'rb') as f:
cs = md5(f.read()).hexdigest()
return cs | def function[get_checksum, parameter[self]]:
constant[Return the md5 checksum of the delta file.]
with call[name[open], parameter[name[self].file, constant[rb]]] begin[:]
variable[cs] assign[=] call[call[name[md5], parameter[call[name[f].read, parameter[]]]].hexdigest, parameter[]]
r... | keyword[def] identifier[get_checksum] ( identifier[self] ):
literal[string]
keyword[with] identifier[open] ( identifier[self] . identifier[file] , literal[string] ) keyword[as] identifier[f] :
identifier[cs] = identifier[md5] ( identifier[f] . identifier[read] ()). identifier[hexdige... | def get_checksum(self):
"""Return the md5 checksum of the delta file."""
with open(self.file, 'rb') as f:
cs = md5(f.read()).hexdigest() # depends on [control=['with'], data=['f']]
return cs |
def expand_cmd_labels(self):
"""Expand make-style variables in cmd parameters.
Currently:
$(location <foo>) Location of one dependency or output file.
$(locations <foo>) Space-delimited list of foo's output files.
$(SRCS) Space-delimited list of this rule's ... | def function[expand_cmd_labels, parameter[self]]:
constant[Expand make-style variables in cmd parameters.
Currently:
$(location <foo>) Location of one dependency or output file.
$(locations <foo>) Space-delimited list of foo's output files.
$(SRCS) Space-del... | keyword[def] identifier[expand_cmd_labels] ( identifier[self] ):
literal[string]
identifier[cmd] = identifier[self] . identifier[cmd]
keyword[def] identifier[_expand_onesrc] ():
literal[string]
identifier[outs] = identifier[self] . identifier[rule] . identifie... | def expand_cmd_labels(self):
"""Expand make-style variables in cmd parameters.
Currently:
$(location <foo>) Location of one dependency or output file.
$(locations <foo>) Space-delimited list of foo's output files.
$(SRCS) Space-delimited list of this rule's sour... |
def main():
"""
NAME
eigs_s.py
DESCRIPTION
converts eigenparamters format data to s format
SYNTAX
eigs_s.py [-h][-i][command line options][<filename]
OPTIONS
-h prints help message and quits
-i allows interactive file name entry
-f FILE, specifies input file name
... | def function[main, parameter[]]:
constant[
NAME
eigs_s.py
DESCRIPTION
converts eigenparamters format data to s format
SYNTAX
eigs_s.py [-h][-i][command line options][<filename]
OPTIONS
-h prints help message and quits
-i allows interactive file name entry
-f FI... | keyword[def] identifier[main] ():
literal[string]
identifier[file] = literal[string]
keyword[if] literal[string] keyword[in] identifier[sys] . identifier[argv] :
identifier[print] ( identifier[main] . identifier[__doc__] )
identifier[sys] . identifier[exit] ()
keyword[elif] liter... | def main():
"""
NAME
eigs_s.py
DESCRIPTION
converts eigenparamters format data to s format
SYNTAX
eigs_s.py [-h][-i][command line options][<filename]
OPTIONS
-h prints help message and quits
-i allows interactive file name entry
-f FILE, specifies input file name
... |
def _split_iso9660_filename(fullname):
# type: (bytes) -> Tuple[bytes, bytes, bytes]
'''
A function to split an ISO 9660 filename into its constituent parts. This
is the name, the extension, and the version number.
Parameters:
fullname - The name to split.
Returns:
A tuple containing... | def function[_split_iso9660_filename, parameter[fullname]]:
constant[
A function to split an ISO 9660 filename into its constituent parts. This
is the name, the extension, and the version number.
Parameters:
fullname - The name to split.
Returns:
A tuple containing the name, extensio... | keyword[def] identifier[_split_iso9660_filename] ( identifier[fullname] ):
literal[string]
identifier[namesplit] = identifier[fullname] . identifier[split] ( literal[string] )
identifier[version] = literal[string]
keyword[if] identifier[len] ( identifier[namesplit] )> literal[int] :
i... | def _split_iso9660_filename(fullname):
# type: (bytes) -> Tuple[bytes, bytes, bytes]
'\n A function to split an ISO 9660 filename into its constituent parts. This\n is the name, the extension, and the version number.\n\n Parameters:\n fullname - The name to split.\n Returns:\n A tuple conta... |
def normalizeIdentifier(value):
"""
Normalizes identifier.
* **value** must be an :ref:`type-string` or `None`.
* **value** must not be longer than 100 characters.
* **value** must not contain a character out the range of 0x20 - 0x7E.
* Returned value is an unencoded ``unicode`` string.
"""... | def function[normalizeIdentifier, parameter[value]]:
constant[
Normalizes identifier.
* **value** must be an :ref:`type-string` or `None`.
* **value** must not be longer than 100 characters.
* **value** must not contain a character out the range of 0x20 - 0x7E.
* Returned value is an unenco... | keyword[def] identifier[normalizeIdentifier] ( identifier[value] ):
literal[string]
keyword[if] identifier[value] keyword[is] keyword[None] :
keyword[return] identifier[value]
keyword[if] keyword[not] identifier[isinstance] ( identifier[value] , identifier[basestring] ):
keywo... | def normalizeIdentifier(value):
"""
Normalizes identifier.
* **value** must be an :ref:`type-string` or `None`.
* **value** must not be longer than 100 characters.
* **value** must not contain a character out the range of 0x20 - 0x7E.
* Returned value is an unencoded ``unicode`` string.
"""... |
def resize(image, width, height, channels=None, decode=False,
resample='nearest'):
"""
Resizes the image or SArray of Images to a specific width, height, and
number of channels.
Parameters
----------
image : turicreate.Image | SArray
The image or SArray of images to be resiz... | def function[resize, parameter[image, width, height, channels, decode, resample]]:
constant[
Resizes the image or SArray of Images to a specific width, height, and
number of channels.
Parameters
----------
image : turicreate.Image | SArray
The image or SArray of images to be resize... | keyword[def] identifier[resize] ( identifier[image] , identifier[width] , identifier[height] , identifier[channels] = keyword[None] , identifier[decode] = keyword[False] ,
identifier[resample] = literal[string] ):
literal[string]
keyword[if] identifier[height] < literal[int] keyword[or] identifier[wid... | def resize(image, width, height, channels=None, decode=False, resample='nearest'):
"""
Resizes the image or SArray of Images to a specific width, height, and
number of channels.
Parameters
----------
image : turicreate.Image | SArray
The image or SArray of images to be resized.
wid... |
def generate_contentinfo_from_channeldir(self, args, options):
"""
Create rows in Content.csv for each folder and file in `self.channeldir`.
"""
LOGGER.info('Generating Content.csv rows folders and file in channeldir')
file_path = get_metadata_file_path(self.channeldir, self.cont... | def function[generate_contentinfo_from_channeldir, parameter[self, args, options]]:
constant[
Create rows in Content.csv for each folder and file in `self.channeldir`.
]
call[name[LOGGER].info, parameter[constant[Generating Content.csv rows folders and file in channeldir]]]
varia... | keyword[def] identifier[generate_contentinfo_from_channeldir] ( identifier[self] , identifier[args] , identifier[options] ):
literal[string]
identifier[LOGGER] . identifier[info] ( literal[string] )
identifier[file_path] = identifier[get_metadata_file_path] ( identifier[self] . identifier[... | def generate_contentinfo_from_channeldir(self, args, options):
"""
Create rows in Content.csv for each folder and file in `self.channeldir`.
"""
LOGGER.info('Generating Content.csv rows folders and file in channeldir')
file_path = get_metadata_file_path(self.channeldir, self.contentinfo)
... |
def name_to_system_object(self, name):
"""
Give SystemObject instance corresponding to the name
"""
if isinstance(name, str):
if self.allow_name_referencing:
name = name
else:
raise NameError('System.allow_name_referencing is se... | def function[name_to_system_object, parameter[self, name]]:
constant[
Give SystemObject instance corresponding to the name
]
if call[name[isinstance], parameter[name[name], name[str]]] begin[:]
if name[self].allow_name_referencing begin[:]
vari... | keyword[def] identifier[name_to_system_object] ( identifier[self] , identifier[name] ):
literal[string]
keyword[if] identifier[isinstance] ( identifier[name] , identifier[str] ):
keyword[if] identifier[self] . identifier[allow_name_referencing] :
identifier[name] = i... | def name_to_system_object(self, name):
"""
Give SystemObject instance corresponding to the name
"""
if isinstance(name, str):
if self.allow_name_referencing:
name = name # depends on [control=['if'], data=[]]
else:
raise NameError('System.allow_name_r... |
def libvlc_vlm_set_input(p_instance, psz_name, psz_input):
'''Set a media's input MRL. This will delete all existing inputs and
add the specified one.
@param p_instance: the instance.
@param psz_name: the media to work on.
@param psz_input: the input MRL.
@return: 0 on success, -1 on error.
... | def function[libvlc_vlm_set_input, parameter[p_instance, psz_name, psz_input]]:
constant[Set a media's input MRL. This will delete all existing inputs and
add the specified one.
@param p_instance: the instance.
@param psz_name: the media to work on.
@param psz_input: the input MRL.
@return: ... | keyword[def] identifier[libvlc_vlm_set_input] ( identifier[p_instance] , identifier[psz_name] , identifier[psz_input] ):
literal[string]
identifier[f] = identifier[_Cfunctions] . identifier[get] ( literal[string] , keyword[None] ) keyword[or] identifier[_Cfunction] ( literal[string] ,(( literal[int] ,),( ... | def libvlc_vlm_set_input(p_instance, psz_name, psz_input):
"""Set a media's input MRL. This will delete all existing inputs and
add the specified one.
@param p_instance: the instance.
@param psz_name: the media to work on.
@param psz_input: the input MRL.
@return: 0 on success, -1 on error.
... |
def parse_header(head):
"""
Parses the header part of packet
Returns a dict
"""
try:
(fromcall, path) = head.split('>', 1)
except:
raise ParseError("invalid packet header")
if (not 1 <= len(fromcall) <= 9 or
not re.findall(r"^[a-z0-9]{0,9}(\-[a-z0-9]{1,8})?$", fromcal... | def function[parse_header, parameter[head]]:
constant[
Parses the header part of packet
Returns a dict
]
<ast.Try object at 0x7da18ede6620>
if <ast.BoolOp object at 0x7da18ede4c70> begin[:]
<ast.Raise object at 0x7da18ede7460>
variable[path] assign[=] call[name[path].spli... | keyword[def] identifier[parse_header] ( identifier[head] ):
literal[string]
keyword[try] :
( identifier[fromcall] , identifier[path] )= identifier[head] . identifier[split] ( literal[string] , literal[int] )
keyword[except] :
keyword[raise] identifier[ParseError] ( literal[string] )
... | def parse_header(head):
"""
Parses the header part of packet
Returns a dict
"""
try:
(fromcall, path) = head.split('>', 1) # depends on [control=['try'], data=[]]
except:
raise ParseError('invalid packet header') # depends on [control=['except'], data=[]]
if not 1 <= len(fr... |
def whatIfOrder(self, contract: Contract, order: Order) -> OrderState:
"""
Retrieve commission and margin impact without actually
placing the order. The given order will not be modified in any way.
This method is blocking.
Args:
contract: Contract to test.
... | def function[whatIfOrder, parameter[self, contract, order]]:
constant[
Retrieve commission and margin impact without actually
placing the order. The given order will not be modified in any way.
This method is blocking.
Args:
contract: Contract to test.
o... | keyword[def] identifier[whatIfOrder] ( identifier[self] , identifier[contract] : identifier[Contract] , identifier[order] : identifier[Order] )-> identifier[OrderState] :
literal[string]
keyword[return] identifier[self] . identifier[_run] ( identifier[self] . identifier[whatIfOrderAsync] ( identif... | def whatIfOrder(self, contract: Contract, order: Order) -> OrderState:
"""
Retrieve commission and margin impact without actually
placing the order. The given order will not be modified in any way.
This method is blocking.
Args:
contract: Contract to test.
o... |
def repair(self, volume_id_or_uri, timeout=-1):
"""
Removes extra presentations from a specified volume on the storage system.
Args:
volume_id_or_uri:
Can be either the volume id or the volume uri.
timeout:
Timeout in seconds. Wait for tas... | def function[repair, parameter[self, volume_id_or_uri, timeout]]:
constant[
Removes extra presentations from a specified volume on the storage system.
Args:
volume_id_or_uri:
Can be either the volume id or the volume uri.
timeout:
Timeout ... | keyword[def] identifier[repair] ( identifier[self] , identifier[volume_id_or_uri] , identifier[timeout] =- literal[int] ):
literal[string]
identifier[data] ={
literal[string] : literal[string] ,
literal[string] : identifier[self] . identifier[_client] . identifier[build_uri] ( ide... | def repair(self, volume_id_or_uri, timeout=-1):
"""
Removes extra presentations from a specified volume on the storage system.
Args:
volume_id_or_uri:
Can be either the volume id or the volume uri.
timeout:
Timeout in seconds. Wait for task co... |
def _base_placeholder(self):
"""
Return the master placeholder this layout placeholder inherits from.
"""
base_ph_type = {
PP_PLACEHOLDER.BODY: PP_PLACEHOLDER.BODY,
PP_PLACEHOLDER.CHART: PP_PLACEHOLDER.BODY,
PP_PLACEHOLDER.BITMAP: ... | def function[_base_placeholder, parameter[self]]:
constant[
Return the master placeholder this layout placeholder inherits from.
]
variable[base_ph_type] assign[=] call[dictionary[[<ast.Attribute object at 0x7da20c6a87f0>, <ast.Attribute object at 0x7da20c6aa5c0>, <ast.Attribute object a... | keyword[def] identifier[_base_placeholder] ( identifier[self] ):
literal[string]
identifier[base_ph_type] ={
identifier[PP_PLACEHOLDER] . identifier[BODY] : identifier[PP_PLACEHOLDER] . identifier[BODY] ,
identifier[PP_PLACEHOLDER] . identifier[CHART] : identifier[PP_PLACEHOLDER] ... | def _base_placeholder(self):
"""
Return the master placeholder this layout placeholder inherits from.
"""
base_ph_type = {PP_PLACEHOLDER.BODY: PP_PLACEHOLDER.BODY, PP_PLACEHOLDER.CHART: PP_PLACEHOLDER.BODY, PP_PLACEHOLDER.BITMAP: PP_PLACEHOLDER.BODY, PP_PLACEHOLDER.CENTER_TITLE: PP_PLACEHOLDER.T... |
def retrieve(cls, *args, **kwargs):
"""Return parent method."""
return super(Subscription, cls).retrieve(*args, **kwargs) | def function[retrieve, parameter[cls]]:
constant[Return parent method.]
return[call[call[name[super], parameter[name[Subscription], name[cls]]].retrieve, parameter[<ast.Starred object at 0x7da1b16e1c30>]]] | keyword[def] identifier[retrieve] ( identifier[cls] ,* identifier[args] ,** identifier[kwargs] ):
literal[string]
keyword[return] identifier[super] ( identifier[Subscription] , identifier[cls] ). identifier[retrieve] (* identifier[args] ,** identifier[kwargs] ) | def retrieve(cls, *args, **kwargs):
"""Return parent method."""
return super(Subscription, cls).retrieve(*args, **kwargs) |
def chat_delete(self, *, channel: str, ts: str, **kwargs) -> SlackResponse:
"""Deletes a message.
Args:
channel (str): Channel containing the message to be deleted. e.g. 'C1234567890'
ts (str): Timestamp of the message to be deleted. e.g. '1234567890.123456'
"""
... | def function[chat_delete, parameter[self]]:
constant[Deletes a message.
Args:
channel (str): Channel containing the message to be deleted. e.g. 'C1234567890'
ts (str): Timestamp of the message to be deleted. e.g. '1234567890.123456'
]
call[name[kwargs].update, pa... | keyword[def] identifier[chat_delete] ( identifier[self] ,*, identifier[channel] : identifier[str] , identifier[ts] : identifier[str] ,** identifier[kwargs] )-> identifier[SlackResponse] :
literal[string]
identifier[kwargs] . identifier[update] ({ literal[string] : identifier[channel] , literal[stri... | def chat_delete(self, *, channel: str, ts: str, **kwargs) -> SlackResponse:
"""Deletes a message.
Args:
channel (str): Channel containing the message to be deleted. e.g. 'C1234567890'
ts (str): Timestamp of the message to be deleted. e.g. '1234567890.123456'
"""
kwargs.u... |
def reorder_levels(self, dim_order=None, inplace=None,
**dim_order_kwargs):
"""Rearrange index levels using input order.
Parameters
----------
dim_order : optional
Mapping from names matching dimensions and values given
by lists representin... | def function[reorder_levels, parameter[self, dim_order, inplace]]:
constant[Rearrange index levels using input order.
Parameters
----------
dim_order : optional
Mapping from names matching dimensions and values given
by lists representing new level orders. Every ... | keyword[def] identifier[reorder_levels] ( identifier[self] , identifier[dim_order] = keyword[None] , identifier[inplace] = keyword[None] ,
** identifier[dim_order_kwargs] ):
literal[string]
identifier[inplace] = identifier[_check_inplace] ( identifier[inplace] )
identifier[dim_order] = ide... | def reorder_levels(self, dim_order=None, inplace=None, **dim_order_kwargs):
"""Rearrange index levels using input order.
Parameters
----------
dim_order : optional
Mapping from names matching dimensions and values given
by lists representing new level orders. Every g... |
def close_connection(self, host):
"""close connection(s) to <host>
host is the host:port spec, as in 'www.cnn.com:8080' as passed in.
no error occurs if there is no connection to that host."""
for h in self._cm.get_all(host):
self._cm.remove(h)
h.close() | def function[close_connection, parameter[self, host]]:
constant[close connection(s) to <host>
host is the host:port spec, as in 'www.cnn.com:8080' as passed in.
no error occurs if there is no connection to that host.]
for taget[name[h]] in starred[call[name[self]._cm.get_all, parameter[n... | keyword[def] identifier[close_connection] ( identifier[self] , identifier[host] ):
literal[string]
keyword[for] identifier[h] keyword[in] identifier[self] . identifier[_cm] . identifier[get_all] ( identifier[host] ):
identifier[self] . identifier[_cm] . identifier[remove] ( identifi... | def close_connection(self, host):
"""close connection(s) to <host>
host is the host:port spec, as in 'www.cnn.com:8080' as passed in.
no error occurs if there is no connection to that host."""
for h in self._cm.get_all(host):
self._cm.remove(h)
h.close() # depends on [control=['... |
def add_element(self, element, override=False):
"""Add an element to the parser.
:param element: the element class.
:param override: whether to replace the default element based on.
.. note:: If one needs to call it inside ``__init__()``, please call it after
``super().__i... | def function[add_element, parameter[self, element, override]]:
constant[Add an element to the parser.
:param element: the element class.
:param override: whether to replace the default element based on.
.. note:: If one needs to call it inside ``__init__()``, please call it after
... | keyword[def] identifier[add_element] ( identifier[self] , identifier[element] , identifier[override] = keyword[False] ):
literal[string]
keyword[if] identifier[issubclass] ( identifier[element] , identifier[inline] . identifier[InlineElement] ):
identifier[dest] = identifier[self] . i... | def add_element(self, element, override=False):
"""Add an element to the parser.
:param element: the element class.
:param override: whether to replace the default element based on.
.. note:: If one needs to call it inside ``__init__()``, please call it after
``super().__init_... |
def stop_script(self, script_id):
"""
Stops a running script.
script_id:= id of stored script.
...
status = pi.stop_script(sid)
...
"""
res = yield from self._pigpio_aio_command(_PI_CMD_PROCS, script_id, 0)
return _u2i(res) | def function[stop_script, parameter[self, script_id]]:
constant[
Stops a running script.
script_id:= id of stored script.
...
status = pi.stop_script(sid)
...
]
variable[res] assign[=] <ast.YieldFrom object at 0x7da1b24aea40>
return[call[name[_u2i], ... | keyword[def] identifier[stop_script] ( identifier[self] , identifier[script_id] ):
literal[string]
identifier[res] = keyword[yield] keyword[from] identifier[self] . identifier[_pigpio_aio_command] ( identifier[_PI_CMD_PROCS] , identifier[script_id] , literal[int] )
keyword[return] ident... | def stop_script(self, script_id):
"""
Stops a running script.
script_id:= id of stored script.
...
status = pi.stop_script(sid)
...
"""
res = (yield from self._pigpio_aio_command(_PI_CMD_PROCS, script_id, 0))
return _u2i(res) |
def connect():
"""Connect controller to handle token exchange and query Uber API."""
# Exchange authorization code for acceess token and create session
session = auth_flow.get_session(request.url)
client = UberRidesClient(session)
# Fetch profile for driver
profile = client.get_driver_profile(... | def function[connect, parameter[]]:
constant[Connect controller to handle token exchange and query Uber API.]
variable[session] assign[=] call[name[auth_flow].get_session, parameter[name[request].url]]
variable[client] assign[=] call[name[UberRidesClient], parameter[name[session]]]
varia... | keyword[def] identifier[connect] ():
literal[string]
identifier[session] = identifier[auth_flow] . identifier[get_session] ( identifier[request] . identifier[url] )
identifier[client] = identifier[UberRidesClient] ( identifier[session] )
identifier[profile] = identifier[client] . iden... | def connect():
"""Connect controller to handle token exchange and query Uber API."""
# Exchange authorization code for acceess token and create session
session = auth_flow.get_session(request.url)
client = UberRidesClient(session)
# Fetch profile for driver
profile = client.get_driver_profile().... |
def p_field_optional2_2(self, p):
"""
field : name arguments selection_set
"""
p[0] = Field(name=p[1], arguments=p[2], selections=p[3]) | def function[p_field_optional2_2, parameter[self, p]]:
constant[
field : name arguments selection_set
]
call[name[p]][constant[0]] assign[=] call[name[Field], parameter[]] | keyword[def] identifier[p_field_optional2_2] ( identifier[self] , identifier[p] ):
literal[string]
identifier[p] [ literal[int] ]= identifier[Field] ( identifier[name] = identifier[p] [ literal[int] ], identifier[arguments] = identifier[p] [ literal[int] ], identifier[selections] = identifier[p] [ ... | def p_field_optional2_2(self, p):
"""
field : name arguments selection_set
"""
p[0] = Field(name=p[1], arguments=p[2], selections=p[3]) |
def insert_runner(fun, args=None, kwargs=None, queue=None, backend=None):
'''
Insert a reference to a runner into the queue so that it can be run later.
fun
The runner function that is going to be run
args
list or comma-seperated string of args to send to fun
kwargs
dictio... | def function[insert_runner, parameter[fun, args, kwargs, queue, backend]]:
constant[
Insert a reference to a runner into the queue so that it can be run later.
fun
The runner function that is going to be run
args
list or comma-seperated string of args to send to fun
kwargs
... | keyword[def] identifier[insert_runner] ( identifier[fun] , identifier[args] = keyword[None] , identifier[kwargs] = keyword[None] , identifier[queue] = keyword[None] , identifier[backend] = keyword[None] ):
literal[string]
keyword[if] identifier[args] keyword[is] keyword[None] :
identifier[args]... | def insert_runner(fun, args=None, kwargs=None, queue=None, backend=None):
"""
Insert a reference to a runner into the queue so that it can be run later.
fun
The runner function that is going to be run
args
list or comma-seperated string of args to send to fun
kwargs
dictio... |
def restart_kernel(self, kernel_id):
"""Restart a kernel while keeping clients connected."""
self._check_kernel_id(kernel_id)
km = self.get_kernel(kernel_id)
km.restart_kernel()
self.log.info("Kernel restarted: %s" % kernel_id)
return kernel_id
# the foll... | def function[restart_kernel, parameter[self, kernel_id]]:
constant[Restart a kernel while keeping clients connected.]
call[name[self]._check_kernel_id, parameter[name[kernel_id]]]
variable[km] assign[=] call[name[self].get_kernel, parameter[name[kernel_id]]]
call[name[km].restart_kernel,... | keyword[def] identifier[restart_kernel] ( identifier[self] , identifier[kernel_id] ):
literal[string]
identifier[self] . identifier[_check_kernel_id] ( identifier[kernel_id] )
identifier[km] = identifier[self] . identifier[get_kernel] ( identifier[kernel_id] )
identifier[km] . ide... | def restart_kernel(self, kernel_id):
"""Restart a kernel while keeping clients connected."""
self._check_kernel_id(kernel_id)
km = self.get_kernel(kernel_id)
km.restart_kernel()
self.log.info('Kernel restarted: %s' % kernel_id)
return kernel_id
# the following remains, in case the KM restart... |
def add_prefix(self, ncname: str) -> None:
""" Look up ncname and add it to the prefix map if necessary
@param ncname: name to add
"""
if ncname not in self.prefixmap:
uri = cu.expand_uri(ncname + ':', self.curi_maps)
if uri and '://' in uri:
self... | def function[add_prefix, parameter[self, ncname]]:
constant[ Look up ncname and add it to the prefix map if necessary
@param ncname: name to add
]
if compare[name[ncname] <ast.NotIn object at 0x7da2590d7190> name[self].prefixmap] begin[:]
variable[uri] assign[=] call[nam... | keyword[def] identifier[add_prefix] ( identifier[self] , identifier[ncname] : identifier[str] )-> keyword[None] :
literal[string]
keyword[if] identifier[ncname] keyword[not] keyword[in] identifier[self] . identifier[prefixmap] :
identifier[uri] = identifier[cu] . identifier[expand_... | def add_prefix(self, ncname: str) -> None:
""" Look up ncname and add it to the prefix map if necessary
@param ncname: name to add
"""
if ncname not in self.prefixmap:
uri = cu.expand_uri(ncname + ':', self.curi_maps)
if uri and '://' in uri:
self.prefixmap[ncname] =... |
def _references(self, i, sequence=False):
"""Handle references."""
value = ''
c = next(i)
if c == '\\':
# \\
if sequence and self.bslash_abort:
raise PathNameException
value = c
elif c == '/':
# \/
if s... | def function[_references, parameter[self, i, sequence]]:
constant[Handle references.]
variable[value] assign[=] constant[]
variable[c] assign[=] call[name[next], parameter[name[i]]]
if compare[name[c] equal[==] constant[\]] begin[:]
if <ast.BoolOp object at 0x7da1b0203340... | keyword[def] identifier[_references] ( identifier[self] , identifier[i] , identifier[sequence] = keyword[False] ):
literal[string]
identifier[value] = literal[string]
identifier[c] = identifier[next] ( identifier[i] )
keyword[if] identifier[c] == literal[string] :
... | def _references(self, i, sequence=False):
"""Handle references."""
value = ''
c = next(i)
if c == '\\':
# \\
if sequence and self.bslash_abort:
raise PathNameException # depends on [control=['if'], data=[]]
value = c # depends on [control=['if'], data=['c']]
eli... |
def store_meta_data(self, copy_path=None):
"""Save meta data of state model to the file system
This method generates a dictionary of the meta data of the state together with the meta data of all state
elements (data ports, outcomes, etc.) and stores it on the filesystem.
Secure that the... | def function[store_meta_data, parameter[self, copy_path]]:
constant[Save meta data of state model to the file system
This method generates a dictionary of the meta data of the state together with the meta data of all state
elements (data ports, outcomes, etc.) and stores it on the filesystem.
... | keyword[def] identifier[store_meta_data] ( identifier[self] , identifier[copy_path] = keyword[None] ):
literal[string]
keyword[if] identifier[copy_path] :
identifier[meta_file_path_json] = identifier[os] . identifier[path] . identifier[join] ( identifier[copy_path] , identifier[self] ... | def store_meta_data(self, copy_path=None):
"""Save meta data of state model to the file system
This method generates a dictionary of the meta data of the state together with the meta data of all state
elements (data ports, outcomes, etc.) and stores it on the filesystem.
Secure that the sto... |
def byteswap(self, fmt=None, start=None, end=None, repeat=True):
"""Change the endianness in-place. Return number of repeats of fmt done.
fmt -- A compact structure string, an integer number of bytes or
an iterable of integers. Defaults to 0, which byte reverses the
whole ... | def function[byteswap, parameter[self, fmt, start, end, repeat]]:
constant[Change the endianness in-place. Return number of repeats of fmt done.
fmt -- A compact structure string, an integer number of bytes or
an iterable of integers. Defaults to 0, which byte reverses the
... | keyword[def] identifier[byteswap] ( identifier[self] , identifier[fmt] = keyword[None] , identifier[start] = keyword[None] , identifier[end] = keyword[None] , identifier[repeat] = keyword[True] ):
literal[string]
identifier[start] , identifier[end] = identifier[self] . identifier[_validate_slice] (... | def byteswap(self, fmt=None, start=None, end=None, repeat=True):
"""Change the endianness in-place. Return number of repeats of fmt done.
fmt -- A compact structure string, an integer number of bytes or
an iterable of integers. Defaults to 0, which byte reverses the
whole bits... |
def find_return_with_argument(self, node):
"""Finds and returns a return statment that has an argument.
Note that we should use node.returns in Python 3, but this method is never called in Python 3 so we don't bother
checking.
"""
for item in node.body:
if isinstanc... | def function[find_return_with_argument, parameter[self, node]]:
constant[Finds and returns a return statment that has an argument.
Note that we should use node.returns in Python 3, but this method is never called in Python 3 so we don't bother
checking.
]
for taget[name[item]] ... | keyword[def] identifier[find_return_with_argument] ( identifier[self] , identifier[node] ):
literal[string]
keyword[for] identifier[item] keyword[in] identifier[node] . identifier[body] :
keyword[if] identifier[isinstance] ( identifier[item] , identifier[ast] . identifier[Return] )... | def find_return_with_argument(self, node):
"""Finds and returns a return statment that has an argument.
Note that we should use node.returns in Python 3, but this method is never called in Python 3 so we don't bother
checking.
"""
for item in node.body:
if isinstance(item, ast.... |
def _to_png(self, delay=3):
"""Export the HTML to byte representation of a PNG image.
Uses selenium to render the HTML and record a PNG. You may need to
adjust the `delay` time keyword argument if maps render without data or tiles.
Examples
--------
>>> m._to_png()
... | def function[_to_png, parameter[self, delay]]:
constant[Export the HTML to byte representation of a PNG image.
Uses selenium to render the HTML and record a PNG. You may need to
adjust the `delay` time keyword argument if maps render without data or tiles.
Examples
--------
... | keyword[def] identifier[_to_png] ( identifier[self] , identifier[delay] = literal[int] ):
literal[string]
keyword[if] identifier[self] . identifier[_png_image] keyword[is] keyword[None] :
keyword[from] identifier[selenium] keyword[import] identifier[webdriver]
iden... | def _to_png(self, delay=3):
"""Export the HTML to byte representation of a PNG image.
Uses selenium to render the HTML and record a PNG. You may need to
adjust the `delay` time keyword argument if maps render without data or tiles.
Examples
--------
>>> m._to_png()
... |
def render_tooltip(self, tooltip, obj):
"""Render the tooltip for this column for an object
"""
if self.tooltip_attr:
val = getattr(obj, self.tooltip_attr)
elif self.tooltip_value:
val = self.tooltip_value
else:
return False
setter = ge... | def function[render_tooltip, parameter[self, tooltip, obj]]:
constant[Render the tooltip for this column for an object
]
if name[self].tooltip_attr begin[:]
variable[val] assign[=] call[name[getattr], parameter[name[obj], name[self].tooltip_attr]]
variable[setter] assign[... | keyword[def] identifier[render_tooltip] ( identifier[self] , identifier[tooltip] , identifier[obj] ):
literal[string]
keyword[if] identifier[self] . identifier[tooltip_attr] :
identifier[val] = identifier[getattr] ( identifier[obj] , identifier[self] . identifier[tooltip_attr] )
... | def render_tooltip(self, tooltip, obj):
"""Render the tooltip for this column for an object
"""
if self.tooltip_attr:
val = getattr(obj, self.tooltip_attr) # depends on [control=['if'], data=[]]
elif self.tooltip_value:
val = self.tooltip_value # depends on [control=['if'], data=[]... |
def identify_hosting_service(repo_url, hosting_services=HOSTING_SERVICES):
"""
Determines the hosting service of `repo_url`.
:param repo_url: Repo URL of unknown type.
:returns: Hosting service or raises UnknownHostingService exception.
"""
repo_url = unicode(repo_url)
for service in hostin... | def function[identify_hosting_service, parameter[repo_url, hosting_services]]:
constant[
Determines the hosting service of `repo_url`.
:param repo_url: Repo URL of unknown type.
:returns: Hosting service or raises UnknownHostingService exception.
]
variable[repo_url] assign[=] call[name[... | keyword[def] identifier[identify_hosting_service] ( identifier[repo_url] , identifier[hosting_services] = identifier[HOSTING_SERVICES] ):
literal[string]
identifier[repo_url] = identifier[unicode] ( identifier[repo_url] )
keyword[for] identifier[service] keyword[in] identifier[hosting_services] :
... | def identify_hosting_service(repo_url, hosting_services=HOSTING_SERVICES):
"""
Determines the hosting service of `repo_url`.
:param repo_url: Repo URL of unknown type.
:returns: Hosting service or raises UnknownHostingService exception.
"""
repo_url = unicode(repo_url)
for service in hosting... |
def post(self, request, enterprise_customer_uuid):
"""
Handle POST request - handle form submissions.
Arguments:
request (django.http.request.HttpRequest): Request instance
enterprise_customer_uuid (str): Enterprise Customer UUID
"""
transmit_courses_meta... | def function[post, parameter[self, request, enterprise_customer_uuid]]:
constant[
Handle POST request - handle form submissions.
Arguments:
request (django.http.request.HttpRequest): Request instance
enterprise_customer_uuid (str): Enterprise Customer UUID
]
... | keyword[def] identifier[post] ( identifier[self] , identifier[request] , identifier[enterprise_customer_uuid] ):
literal[string]
identifier[transmit_courses_metadata_form] = identifier[TransmitEnterpriseCoursesForm] ( identifier[request] . identifier[POST] )
keyword[if] identifi... | def post(self, request, enterprise_customer_uuid):
"""
Handle POST request - handle form submissions.
Arguments:
request (django.http.request.HttpRequest): Request instance
enterprise_customer_uuid (str): Enterprise Customer UUID
"""
transmit_courses_metadata_for... |
def solve_sdp(sdp, solver=None, solverparameters=None):
"""Call a solver on the SDP relaxation. Upon successful solution, it
returns the primal and dual objective values along with the solution
matrices.
:param sdpRelaxation: The SDP relaxation to be solved.
:type sdpRelaxation: :class:`ncpol2sdpa.... | def function[solve_sdp, parameter[sdp, solver, solverparameters]]:
constant[Call a solver on the SDP relaxation. Upon successful solution, it
returns the primal and dual objective values along with the solution
matrices.
:param sdpRelaxation: The SDP relaxation to be solved.
:type sdpRelaxation... | keyword[def] identifier[solve_sdp] ( identifier[sdp] , identifier[solver] = keyword[None] , identifier[solverparameters] = keyword[None] ):
literal[string]
identifier[solvers] = identifier[autodetect_solvers] ( identifier[solverparameters] )
identifier[solver] = identifier[solver] . identifier[lower] ... | def solve_sdp(sdp, solver=None, solverparameters=None):
"""Call a solver on the SDP relaxation. Upon successful solution, it
returns the primal and dual objective values along with the solution
matrices.
:param sdpRelaxation: The SDP relaxation to be solved.
:type sdpRelaxation: :class:`ncpol2sdpa.... |
def set_element_text(parent_to_parse, element_path=None, element_text=u''):
"""
Assigns a string value to the parsed parent element and then returns it.
If element_path is provided and doesn't exist, it is inserted with element_text.
:see: get_element(parent_to_parse, element_path)
"""
return _... | def function[set_element_text, parameter[parent_to_parse, element_path, element_text]]:
constant[
Assigns a string value to the parsed parent element and then returns it.
If element_path is provided and doesn't exist, it is inserted with element_text.
:see: get_element(parent_to_parse, element_path)... | keyword[def] identifier[set_element_text] ( identifier[parent_to_parse] , identifier[element_path] = keyword[None] , identifier[element_text] = literal[string] ):
literal[string]
keyword[return] identifier[_set_element_property] ( identifier[parent_to_parse] , identifier[element_path] , identifier[_ELEM_... | def set_element_text(parent_to_parse, element_path=None, element_text=u''):
"""
Assigns a string value to the parsed parent element and then returns it.
If element_path is provided and doesn't exist, it is inserted with element_text.
:see: get_element(parent_to_parse, element_path)
"""
return _s... |
def pop_indexes(ol,indexes,**kwargs):
'''
from elist.jprint import pobj
from elist.elist import *
ol = [1,2,3,4,5,6]
id(ol)
rslt = pop_indexes(ol,{0,-3,5})
ol
id(ol)
id(rslt['list'])
####
ol = [1,2,3,4,5,6]
id(ol)
rslt =... | def function[pop_indexes, parameter[ol, indexes]]:
constant[
from elist.jprint import pobj
from elist.elist import *
ol = [1,2,3,4,5,6]
id(ol)
rslt = pop_indexes(ol,{0,-3,5})
ol
id(ol)
id(rslt['list'])
####
ol = [1,2,3,4,5,6]
... | keyword[def] identifier[pop_indexes] ( identifier[ol] , identifier[indexes] ,** identifier[kwargs] ):
literal[string]
identifier[length] = identifier[ol] . identifier[__len__] ()
identifier[indexes] = identifier[list] ( identifier[map] ( keyword[lambda] identifier[index] : identifier[uniform_index] (... | def pop_indexes(ol, indexes, **kwargs):
"""
from elist.jprint import pobj
from elist.elist import *
ol = [1,2,3,4,5,6]
id(ol)
rslt = pop_indexes(ol,{0,-3,5})
ol
id(ol)
id(rslt['list'])
####
ol = [1,2,3,4,5,6]
id(ol)
rslt... |
def create_edges(cells_nodes):
"""Setup edge-node and edge-cell relations. Adapted from voropy.
"""
# Create the idx_hierarchy (nodes->edges->cells), i.e., the value of
# `self.idx_hierarchy[0, 2, 27]` is the index of the node of cell 27, edge
# 2, node 0. The shape of `self.idx_hierarchy` is `(2, 3... | def function[create_edges, parameter[cells_nodes]]:
constant[Setup edge-node and edge-cell relations. Adapted from voropy.
]
variable[local_idx] assign[=] call[name[numpy].array, parameter[list[[<ast.List object at 0x7da2047eb4c0>, <ast.List object at 0x7da2047ea230>, <ast.List object at 0x7da2047e8... | keyword[def] identifier[create_edges] ( identifier[cells_nodes] ):
literal[string]
identifier[local_idx] = identifier[numpy] . identifier[array] ([[ literal[int] , literal[int] ],[ literal[int] , literal[int] ],[ literal[int] , literal[int] ]]). identifier[T]
identi... | def create_edges(cells_nodes):
"""Setup edge-node and edge-cell relations. Adapted from voropy.
"""
# Create the idx_hierarchy (nodes->edges->cells), i.e., the value of
# `self.idx_hierarchy[0, 2, 27]` is the index of the node of cell 27, edge
# 2, node 0. The shape of `self.idx_hierarchy` is `(2, 3... |
def to_df(self):
'''Conversion method to Pandas DataFrame. To be attached to ResultDict.
Returns
========
List : of Pandas DataFrames in order of Total, First, Second
'''
total, first, (idx, second) = Si_to_pandas_dict(self)
names = self.problem['names']
ret = [pd.DataFrame(tot... | def function[to_df, parameter[self]]:
constant[Conversion method to Pandas DataFrame. To be attached to ResultDict.
Returns
========
List : of Pandas DataFrames in order of Total, First, Second
]
<ast.Tuple object at 0x7da1b1653d60> assign[=] call[name[Si_to_pandas_dict], parameter[name... | keyword[def] identifier[to_df] ( identifier[self] ):
literal[string]
identifier[total] , identifier[first] ,( identifier[idx] , identifier[second] )= identifier[Si_to_pandas_dict] ( identifier[self] )
identifier[names] = identifier[self] . identifier[problem] [ literal[string] ]
identifier[re... | def to_df(self):
"""Conversion method to Pandas DataFrame. To be attached to ResultDict.
Returns
========
List : of Pandas DataFrames in order of Total, First, Second
"""
(total, first, (idx, second)) = Si_to_pandas_dict(self)
names = self.problem['names']
ret = [pd.DataFrame(total, ind... |
def sidpath(self, sid):
"""
Parameters
----------
sid : int
Asset identifier.
Returns
-------
out : string
Full path to the bcolz rootdir for the given sid.
"""
sid_subdir = _sid_subdir_path(sid)
return join(self._r... | def function[sidpath, parameter[self, sid]]:
constant[
Parameters
----------
sid : int
Asset identifier.
Returns
-------
out : string
Full path to the bcolz rootdir for the given sid.
]
variable[sid_subdir] assign[=] call[n... | keyword[def] identifier[sidpath] ( identifier[self] , identifier[sid] ):
literal[string]
identifier[sid_subdir] = identifier[_sid_subdir_path] ( identifier[sid] )
keyword[return] identifier[join] ( identifier[self] . identifier[_rootdir] , identifier[sid_subdir] ) | def sidpath(self, sid):
"""
Parameters
----------
sid : int
Asset identifier.
Returns
-------
out : string
Full path to the bcolz rootdir for the given sid.
"""
sid_subdir = _sid_subdir_path(sid)
return join(self._rootdir, sid_... |
def accumulation_distribution(close_data, high_data, low_data, volume):
"""
Accumulation/Distribution.
Formula:
A/D = (Ct - Lt) - (Ht - Ct) / (Ht - Lt) * Vt + A/Dt-1
"""
catch_errors.check_for_input_len_diff(
close_data, high_data, low_data, volume
)
ad = np.zeros(len(close... | def function[accumulation_distribution, parameter[close_data, high_data, low_data, volume]]:
constant[
Accumulation/Distribution.
Formula:
A/D = (Ct - Lt) - (Ht - Ct) / (Ht - Lt) * Vt + A/Dt-1
]
call[name[catch_errors].check_for_input_len_diff, parameter[name[close_data], name[high_data... | keyword[def] identifier[accumulation_distribution] ( identifier[close_data] , identifier[high_data] , identifier[low_data] , identifier[volume] ):
literal[string]
identifier[catch_errors] . identifier[check_for_input_len_diff] (
identifier[close_data] , identifier[high_data] , identifier[low_data] , i... | def accumulation_distribution(close_data, high_data, low_data, volume):
"""
Accumulation/Distribution.
Formula:
A/D = (Ct - Lt) - (Ht - Ct) / (Ht - Lt) * Vt + A/Dt-1
"""
catch_errors.check_for_input_len_diff(close_data, high_data, low_data, volume)
ad = np.zeros(len(close_data))
for idx... |
def print_tree(self, ast_obj=None):
"""Convert AST object to tree view of BEL AST
Returns:
prints tree of BEL AST to STDOUT
"""
if not ast_obj:
ast_obj = self
if hasattr(self, "bel_subject"):
print("Subject:")
self.bel_subject.pr... | def function[print_tree, parameter[self, ast_obj]]:
constant[Convert AST object to tree view of BEL AST
Returns:
prints tree of BEL AST to STDOUT
]
if <ast.UnaryOp object at 0x7da1b19cdc30> begin[:]
variable[ast_obj] assign[=] name[self]
if call[name[... | keyword[def] identifier[print_tree] ( identifier[self] , identifier[ast_obj] = keyword[None] ):
literal[string]
keyword[if] keyword[not] identifier[ast_obj] :
identifier[ast_obj] = identifier[self]
keyword[if] identifier[hasattr] ( identifier[self] , literal[string] ):
... | def print_tree(self, ast_obj=None):
"""Convert AST object to tree view of BEL AST
Returns:
prints tree of BEL AST to STDOUT
"""
if not ast_obj:
ast_obj = self # depends on [control=['if'], data=[]]
if hasattr(self, 'bel_subject'):
print('Subject:')
self.... |
def GET_savedmodifiedconditionitemvalues(self) -> None:
"""ToDo: extend functionality and add tests"""
dict_ = state.modifiedconditionitemvalues.get(self._id)
if dict_ is None:
self.GET_conditionitemvalues()
else:
for name, value in dict_.items():
... | def function[GET_savedmodifiedconditionitemvalues, parameter[self]]:
constant[ToDo: extend functionality and add tests]
variable[dict_] assign[=] call[name[state].modifiedconditionitemvalues.get, parameter[name[self]._id]]
if compare[name[dict_] is constant[None]] begin[:]
call[n... | keyword[def] identifier[GET_savedmodifiedconditionitemvalues] ( identifier[self] )-> keyword[None] :
literal[string]
identifier[dict_] = identifier[state] . identifier[modifiedconditionitemvalues] . identifier[get] ( identifier[self] . identifier[_id] )
keyword[if] identifier[dict_] keyw... | def GET_savedmodifiedconditionitemvalues(self) -> None:
"""ToDo: extend functionality and add tests"""
dict_ = state.modifiedconditionitemvalues.get(self._id)
if dict_ is None:
self.GET_conditionitemvalues() # depends on [control=['if'], data=[]]
else:
for (name, value) in dict_.items()... |
def _maybe_pack_examples(self, generator):
"""Wraps generator with packer if self.packed_length."""
if not self.packed_length:
return generator
return generator_utils.pack_examples(
generator,
self.has_inputs,
self.packed_length,
spacing=self.packed_spacing,
cho... | def function[_maybe_pack_examples, parameter[self, generator]]:
constant[Wraps generator with packer if self.packed_length.]
if <ast.UnaryOp object at 0x7da204567670> begin[:]
return[name[generator]]
return[call[name[generator_utils].pack_examples, parameter[name[generator], name[self].has_i... | keyword[def] identifier[_maybe_pack_examples] ( identifier[self] , identifier[generator] ):
literal[string]
keyword[if] keyword[not] identifier[self] . identifier[packed_length] :
keyword[return] identifier[generator]
keyword[return] identifier[generator_utils] . identifier[pack_examples] ... | def _maybe_pack_examples(self, generator):
"""Wraps generator with packer if self.packed_length."""
if not self.packed_length:
return generator # depends on [control=['if'], data=[]]
return generator_utils.pack_examples(generator, self.has_inputs, self.packed_length, spacing=self.packed_spacing, ch... |
def stream_log(self, callback, connection_id='monitor'):
"""
Stream Redis activity one line at a time to the given
callback.
:param callback: A function that accepts a single argument,
the Redis command.
"""
conn = self.connection_pool.get_connection(connecti... | def function[stream_log, parameter[self, callback, connection_id]]:
constant[
Stream Redis activity one line at a time to the given
callback.
:param callback: A function that accepts a single argument,
the Redis command.
]
variable[conn] assign[=] call[name[s... | keyword[def] identifier[stream_log] ( identifier[self] , identifier[callback] , identifier[connection_id] = literal[string] ):
literal[string]
identifier[conn] = identifier[self] . identifier[connection_pool] . identifier[get_connection] ( identifier[connection_id] , keyword[None] )
identi... | def stream_log(self, callback, connection_id='monitor'):
"""
Stream Redis activity one line at a time to the given
callback.
:param callback: A function that accepts a single argument,
the Redis command.
"""
conn = self.connection_pool.get_connection(connection_id, N... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.