code stringlengths 75 104k | code_sememe stringlengths 47 309k | token_type stringlengths 215 214k | code_dependency stringlengths 75 155k |
|---|---|---|---|
def _GenerateAssertion(self):
"""Generates the signed assertion that will be used in the request.
Returns:
string, signed Json Web Token (JWT) assertion.
"""
now = int(time.time())
payload = {
'aud': RpcHelper.TOKEN_ENDPOINT,
'scope': 'https://www.googleapis.com/auth/identityt... | def function[_GenerateAssertion, parameter[self]]:
constant[Generates the signed assertion that will be used in the request.
Returns:
string, signed Json Web Token (JWT) assertion.
]
variable[now] assign[=] call[name[int], parameter[call[name[time].time, parameter[]]]]
variable[pa... | keyword[def] identifier[_GenerateAssertion] ( identifier[self] ):
literal[string]
identifier[now] = identifier[int] ( identifier[time] . identifier[time] ())
identifier[payload] ={
literal[string] : identifier[RpcHelper] . identifier[TOKEN_ENDPOINT] ,
literal[string] : literal[string] ,
... | def _GenerateAssertion(self):
"""Generates the signed assertion that will be used in the request.
Returns:
string, signed Json Web Token (JWT) assertion.
"""
now = int(time.time())
payload = {'aud': RpcHelper.TOKEN_ENDPOINT, 'scope': 'https://www.googleapis.com/auth/identitytoolkit', 'iat': n... |
def get_class(kls):
"""
:param kls - string of fully identified starter function or starter method path
for instance:
- workers.abstract_worker.AbstractWorker.start
- workers.example_script_worker.main
:return tuple (type, object, starter)
for instance:
- (FunctionType, <function_ma... | def function[get_class, parameter[kls]]:
constant[
:param kls - string of fully identified starter function or starter method path
for instance:
- workers.abstract_worker.AbstractWorker.start
- workers.example_script_worker.main
:return tuple (type, object, starter)
for instance:
... | keyword[def] identifier[get_class] ( identifier[kls] ):
literal[string]
identifier[parts] = identifier[kls] . identifier[split] ( literal[string] )
keyword[try] :
identifier[module] = literal[string] . identifier[join] ( identifier[parts] [:- literal[int] ])
identifier[m] = iden... | def get_class(kls):
"""
:param kls - string of fully identified starter function or starter method path
for instance:
- workers.abstract_worker.AbstractWorker.start
- workers.example_script_worker.main
:return tuple (type, object, starter)
for instance:
- (FunctionType, <function_ma... |
def delete_stack(self, stack):
"""删除服务组
删除服务组内所有服务并销毁服务组。
Args:
- stack: 服务所属的服务组名称
Returns:
返回一个tuple对象,其格式为(<result>, <ResponseInfo>)
- result 成功返回空dict{},失败返回{"error": "<errMsg string>"}
- ResponseInfo 请求的Response信息
... | def function[delete_stack, parameter[self, stack]]:
constant[删除服务组
删除服务组内所有服务并销毁服务组。
Args:
- stack: 服务所属的服务组名称
Returns:
返回一个tuple对象,其格式为(<result>, <ResponseInfo>)
- result 成功返回空dict{},失败返回{"error": "<errMsg string>"}
- Response... | keyword[def] identifier[delete_stack] ( identifier[self] , identifier[stack] ):
literal[string]
identifier[url] = literal[string] . identifier[format] ( identifier[self] . identifier[host] , identifier[stack] )
keyword[return] identifier[self] . identifier[__delete] ( identifier[url] ) | def delete_stack(self, stack):
"""删除服务组
删除服务组内所有服务并销毁服务组。
Args:
- stack: 服务所属的服务组名称
Returns:
返回一个tuple对象,其格式为(<result>, <ResponseInfo>)
- result 成功返回空dict{},失败返回{"error": "<errMsg string>"}
- ResponseInfo 请求的Response信息
"... |
def addReader(self, reader):
"""
Add a FileDescriptor for notification of data available to read.
"""
self._add(reader, self._reads, QtCore.QSocketNotifier.Read) | def function[addReader, parameter[self, reader]]:
constant[
Add a FileDescriptor for notification of data available to read.
]
call[name[self]._add, parameter[name[reader], name[self]._reads, name[QtCore].QSocketNotifier.Read]] | keyword[def] identifier[addReader] ( identifier[self] , identifier[reader] ):
literal[string]
identifier[self] . identifier[_add] ( identifier[reader] , identifier[self] . identifier[_reads] , identifier[QtCore] . identifier[QSocketNotifier] . identifier[Read] ) | def addReader(self, reader):
"""
Add a FileDescriptor for notification of data available to read.
"""
self._add(reader, self._reads, QtCore.QSocketNotifier.Read) |
def relieve_model(self, model):
"""Do no longer observe the model
The model is also removed from the internal set of tracked models.
:param gtkmvc3.Model model: The model to be relieved
"""
self.__registered_models.remove(model)
return super(ExtendedController, self).re... | def function[relieve_model, parameter[self, model]]:
constant[Do no longer observe the model
The model is also removed from the internal set of tracked models.
:param gtkmvc3.Model model: The model to be relieved
]
call[name[self].__registered_models.remove, parameter[name[mode... | keyword[def] identifier[relieve_model] ( identifier[self] , identifier[model] ):
literal[string]
identifier[self] . identifier[__registered_models] . identifier[remove] ( identifier[model] )
keyword[return] identifier[super] ( identifier[ExtendedController] , identifier[self] ). identifie... | def relieve_model(self, model):
"""Do no longer observe the model
The model is also removed from the internal set of tracked models.
:param gtkmvc3.Model model: The model to be relieved
"""
self.__registered_models.remove(model)
return super(ExtendedController, self).relieve_model(... |
def align_generation(self, file_nm, padding=75):
"""
Description : Align to lip position
"""
align = Align(self._align_root + '/' + file_nm + '.align')
return nd.array(align.sentence(padding)) | def function[align_generation, parameter[self, file_nm, padding]]:
constant[
Description : Align to lip position
]
variable[align] assign[=] call[name[Align], parameter[binary_operation[binary_operation[binary_operation[name[self]._align_root + constant[/]] + name[file_nm]] + constant[.a... | keyword[def] identifier[align_generation] ( identifier[self] , identifier[file_nm] , identifier[padding] = literal[int] ):
literal[string]
identifier[align] = identifier[Align] ( identifier[self] . identifier[_align_root] + literal[string] + identifier[file_nm] + literal[string] )
keyword[... | def align_generation(self, file_nm, padding=75):
"""
Description : Align to lip position
"""
align = Align(self._align_root + '/' + file_nm + '.align')
return nd.array(align.sentence(padding)) |
def add_children_to_node(self, node):
"""
Add children to etree.Element `node`.
"""
if self.has_children:
for child_id in self.children:
child = self.runtime.get_block(child_id)
self.runtime.add_block_as_child_node(child, node) | def function[add_children_to_node, parameter[self, node]]:
constant[
Add children to etree.Element `node`.
]
if name[self].has_children begin[:]
for taget[name[child_id]] in starred[name[self].children] begin[:]
variable[child] assign[=] call[name[... | keyword[def] identifier[add_children_to_node] ( identifier[self] , identifier[node] ):
literal[string]
keyword[if] identifier[self] . identifier[has_children] :
keyword[for] identifier[child_id] keyword[in] identifier[self] . identifier[children] :
identifier[child... | def add_children_to_node(self, node):
"""
Add children to etree.Element `node`.
"""
if self.has_children:
for child_id in self.children:
child = self.runtime.get_block(child_id)
self.runtime.add_block_as_child_node(child, node) # depends on [control=['for'], data... |
def from_dict(cls, dictionary, root=False):
"""Convert dictionary (and ordered dictionary) into a ConfigTree
:param dictionary: dictionary to convert
:type dictionary: dict
:return: Config object
:type return: Config
"""
def create_tree(value):
if isi... | def function[from_dict, parameter[cls, dictionary, root]]:
constant[Convert dictionary (and ordered dictionary) into a ConfigTree
:param dictionary: dictionary to convert
:type dictionary: dict
:return: Config object
:type return: Config
]
def function[create_tree... | keyword[def] identifier[from_dict] ( identifier[cls] , identifier[dictionary] , identifier[root] = keyword[False] ):
literal[string]
keyword[def] identifier[create_tree] ( identifier[value] ):
keyword[if] identifier[isinstance] ( identifier[value] , identifier[dict] ):
... | def from_dict(cls, dictionary, root=False):
"""Convert dictionary (and ordered dictionary) into a ConfigTree
:param dictionary: dictionary to convert
:type dictionary: dict
:return: Config object
:type return: Config
"""
def create_tree(value):
if isinstance(valu... |
def list_eids(self):
"""
Returns a list of all known eids
"""
entities = self.list()
return sorted([int(eid) for eid in entities]) | def function[list_eids, parameter[self]]:
constant[
Returns a list of all known eids
]
variable[entities] assign[=] call[name[self].list, parameter[]]
return[call[name[sorted], parameter[<ast.ListComp object at 0x7da1b14718a0>]]] | keyword[def] identifier[list_eids] ( identifier[self] ):
literal[string]
identifier[entities] = identifier[self] . identifier[list] ()
keyword[return] identifier[sorted] ([ identifier[int] ( identifier[eid] ) keyword[for] identifier[eid] keyword[in] identifier[entities] ]) | def list_eids(self):
"""
Returns a list of all known eids
"""
entities = self.list()
return sorted([int(eid) for eid in entities]) |
def infer_paths(output_dir, **subdirs):
"""Infers standard paths to policy and model directories.
Example:
>>> infer_paths("/some/output/dir/", policy="", model="custom/path")
{"policy": "/some/output/dir/policy", "model": "custom/path",
"output_dir":"/some/output/dir/"}
Args:
output_dir: output... | def function[infer_paths, parameter[output_dir]]:
constant[Infers standard paths to policy and model directories.
Example:
>>> infer_paths("/some/output/dir/", policy="", model="custom/path")
{"policy": "/some/output/dir/policy", "model": "custom/path",
"output_dir":"/some/output/dir/"}
Args:
... | keyword[def] identifier[infer_paths] ( identifier[output_dir] ,** identifier[subdirs] ):
literal[string]
identifier[directories] ={}
keyword[for] identifier[name] , identifier[path] keyword[in] identifier[six] . identifier[iteritems] ( identifier[subdirs] ):
identifier[directories] [ identifier[name... | def infer_paths(output_dir, **subdirs):
"""Infers standard paths to policy and model directories.
Example:
>>> infer_paths("/some/output/dir/", policy="", model="custom/path")
{"policy": "/some/output/dir/policy", "model": "custom/path",
"output_dir":"/some/output/dir/"}
Args:
output_dir: outp... |
def _generate_transformations(self, structure):
"""
The central problem with trying to enumerate magnetic orderings is
that we have to enumerate orderings that might plausibly be magnetic
ground states, while not enumerating orderings that are physically
implausible. The problem ... | def function[_generate_transformations, parameter[self, structure]]:
constant[
The central problem with trying to enumerate magnetic orderings is
that we have to enumerate orderings that might plausibly be magnetic
ground states, while not enumerating orderings that are physically
... | keyword[def] identifier[_generate_transformations] ( identifier[self] , identifier[structure] ):
literal[string]
identifier[formula] = identifier[structure] . identifier[composition] . identifier[reduced_formula]
identifier[transformations] ={}
identifier[analyzer] = i... | def _generate_transformations(self, structure):
"""
The central problem with trying to enumerate magnetic orderings is
that we have to enumerate orderings that might plausibly be magnetic
ground states, while not enumerating orderings that are physically
implausible. The problem is t... |
def split_hosts(hosts, default_port=DEFAULT_PORT):
"""Takes a string of the form host1[:port],host2[:port]... and
splits it into (host, port) tuples. If [:port] isn't present the
default_port is used.
Returns a set of 2-tuples containing the host name (or IP) followed by
port number.
:Paramete... | def function[split_hosts, parameter[hosts, default_port]]:
constant[Takes a string of the form host1[:port],host2[:port]... and
splits it into (host, port) tuples. If [:port] isn't present the
default_port is used.
Returns a set of 2-tuples containing the host name (or IP) followed by
port numb... | keyword[def] identifier[split_hosts] ( identifier[hosts] , identifier[default_port] = identifier[DEFAULT_PORT] ):
literal[string]
identifier[nodes] =[]
keyword[for] identifier[entity] keyword[in] identifier[hosts] . identifier[split] ( literal[string] ):
keyword[if] keyword[not] identifi... | def split_hosts(hosts, default_port=DEFAULT_PORT):
"""Takes a string of the form host1[:port],host2[:port]... and
splits it into (host, port) tuples. If [:port] isn't present the
default_port is used.
Returns a set of 2-tuples containing the host name (or IP) followed by
port number.
:Paramete... |
def _containerSetPath(container, folderpath, specfiles):
"""Helper function for :class:`MsrunContainer`, :class:`SiiContainer` and
:class:`FiContainer`. Changes the folderpath of the specified specfiles in
container.info: ``container.info[specfile]['path'] = folderpath``.
:param container: a container ... | def function[_containerSetPath, parameter[container, folderpath, specfiles]]:
constant[Helper function for :class:`MsrunContainer`, :class:`SiiContainer` and
:class:`FiContainer`. Changes the folderpath of the specified specfiles in
container.info: ``container.info[specfile]['path'] = folderpath``.
... | keyword[def] identifier[_containerSetPath] ( identifier[container] , identifier[folderpath] , identifier[specfiles] ):
literal[string]
keyword[if] keyword[not] identifier[os] . identifier[path] . identifier[exists] ( identifier[folderpath] ):
identifier[warntext] = literal[string] literal[strin... | def _containerSetPath(container, folderpath, specfiles):
"""Helper function for :class:`MsrunContainer`, :class:`SiiContainer` and
:class:`FiContainer`. Changes the folderpath of the specified specfiles in
container.info: ``container.info[specfile]['path'] = folderpath``.
:param container: a container ... |
def indim(self):
""" The number of action values that the environment accepts.
"""
indim = self.numOffbids * len(self.generators)
if self.maxWithhold is not None:
return indim * 2
else:
return indim | def function[indim, parameter[self]]:
constant[ The number of action values that the environment accepts.
]
variable[indim] assign[=] binary_operation[name[self].numOffbids * call[name[len], parameter[name[self].generators]]]
if compare[name[self].maxWithhold is_not constant[None]] begin... | keyword[def] identifier[indim] ( identifier[self] ):
literal[string]
identifier[indim] = identifier[self] . identifier[numOffbids] * identifier[len] ( identifier[self] . identifier[generators] )
keyword[if] identifier[self] . identifier[maxWithhold] keyword[is] keyword[not] keyword[No... | def indim(self):
""" The number of action values that the environment accepts.
"""
indim = self.numOffbids * len(self.generators)
if self.maxWithhold is not None:
return indim * 2 # depends on [control=['if'], data=[]]
else:
return indim |
def record(self, action, props=None, path=KISSmetrics.RECORD_PATH,
resp=False):
"""Record event for identity with any properties.
:param action: event performed
:param props: any additional data to include
:type props: dict
:param resp: indicate whether to return ... | def function[record, parameter[self, action, props, path, resp]]:
constant[Record event for identity with any properties.
:param action: event performed
:param props: any additional data to include
:type props: dict
:param resp: indicate whether to return response
:type ... | keyword[def] identifier[record] ( identifier[self] , identifier[action] , identifier[props] = keyword[None] , identifier[path] = identifier[KISSmetrics] . identifier[RECORD_PATH] ,
identifier[resp] = keyword[False] ):
literal[string]
identifier[self] . identifier[check_id_key] ()
identifi... | def record(self, action, props=None, path=KISSmetrics.RECORD_PATH, resp=False):
"""Record event for identity with any properties.
:param action: event performed
:param props: any additional data to include
:type props: dict
:param resp: indicate whether to return response
:t... |
def from_json(cls, json_string):
"""
Creates and return a DataFrame from a JSON of the type created by to_json
:param json_string: JSON
:return: DataFrame
"""
input_dict = json.loads(json_string)
# convert index to tuple if required
if input_dict['index']... | def function[from_json, parameter[cls, json_string]]:
constant[
Creates and return a DataFrame from a JSON of the type created by to_json
:param json_string: JSON
:return: DataFrame
]
variable[input_dict] assign[=] call[name[json].loads, parameter[name[json_string]]]
... | keyword[def] identifier[from_json] ( identifier[cls] , identifier[json_string] ):
literal[string]
identifier[input_dict] = identifier[json] . identifier[loads] ( identifier[json_string] )
keyword[if] identifier[input_dict] [ literal[string] ] keyword[and] identifier[isinstance] ... | def from_json(cls, json_string):
"""
Creates and return a DataFrame from a JSON of the type created by to_json
:param json_string: JSON
:return: DataFrame
"""
input_dict = json.loads(json_string)
# convert index to tuple if required
if input_dict['index'] and isinstance(... |
def kill_current_session(ctx: Context_T) -> None:
"""
Force kill current session of the given context,
despite whether it is running or not.
:param ctx: message context
"""
ctx_id = context_id(ctx)
if ctx_id in _sessions:
del _sessions[ctx_id] | def function[kill_current_session, parameter[ctx]]:
constant[
Force kill current session of the given context,
despite whether it is running or not.
:param ctx: message context
]
variable[ctx_id] assign[=] call[name[context_id], parameter[name[ctx]]]
if compare[name[ctx_id] in n... | keyword[def] identifier[kill_current_session] ( identifier[ctx] : identifier[Context_T] )-> keyword[None] :
literal[string]
identifier[ctx_id] = identifier[context_id] ( identifier[ctx] )
keyword[if] identifier[ctx_id] keyword[in] identifier[_sessions] :
keyword[del] identifier[_sessions]... | def kill_current_session(ctx: Context_T) -> None:
"""
Force kill current session of the given context,
despite whether it is running or not.
:param ctx: message context
"""
ctx_id = context_id(ctx)
if ctx_id in _sessions:
del _sessions[ctx_id] # depends on [control=['if'], data=['c... |
def path(self, which=None):
"""Extend ``nailgun.entity_mixins.Entity.path``.
The format of the returned path depends on the value of ``which``:
refresh
/api/smart_proxies/:id/refresh
Otherwise, call ``super``.
"""
if which in ('refresh',):
retur... | def function[path, parameter[self, which]]:
constant[Extend ``nailgun.entity_mixins.Entity.path``.
The format of the returned path depends on the value of ``which``:
refresh
/api/smart_proxies/:id/refresh
Otherwise, call ``super``.
]
if compare[name[which] ... | keyword[def] identifier[path] ( identifier[self] , identifier[which] = keyword[None] ):
literal[string]
keyword[if] identifier[which] keyword[in] ( literal[string] ,):
keyword[return] literal[string] . identifier[format] (
identifier[super] ( identifier[SmartProxy] , id... | def path(self, which=None):
"""Extend ``nailgun.entity_mixins.Entity.path``.
The format of the returned path depends on the value of ``which``:
refresh
/api/smart_proxies/:id/refresh
Otherwise, call ``super``.
"""
if which in ('refresh',):
return '{0}/{1}'.... |
def get_random_password():
"""Get a random password that complies with most of the requirements.
Note:
This random password is not strong and not "really" random, and should only be
used for testing purposes.
Returns:
str: The random password.
"""
... | def function[get_random_password, parameter[]]:
constant[Get a random password that complies with most of the requirements.
Note:
This random password is not strong and not "really" random, and should only be
used for testing purposes.
Returns:
str: The rand... | keyword[def] identifier[get_random_password] ():
literal[string]
identifier[password] =[]
identifier[password] . identifier[append] ( identifier[RandomInputHelper] . identifier[get_random_value] ( literal[int] ,[ identifier[string] . identifier[ascii_lowercase] ]))
identifier[pa... | def get_random_password():
"""Get a random password that complies with most of the requirements.
Note:
This random password is not strong and not "really" random, and should only be
used for testing purposes.
Returns:
str: The random password.
"""
p... |
def add_publication(cursor, epub, epub_file, is_pre_publication=False):
"""Adds a publication entry and makes each item
a pending document.
"""
publisher = epub[0].metadata['publisher']
publish_message = epub[0].metadata['publication_message']
epub_binary = psycopg2.Binary(epub_file.read())
... | def function[add_publication, parameter[cursor, epub, epub_file, is_pre_publication]]:
constant[Adds a publication entry and makes each item
a pending document.
]
variable[publisher] assign[=] call[call[name[epub]][constant[0]].metadata][constant[publisher]]
variable[publish_message] ass... | keyword[def] identifier[add_publication] ( identifier[cursor] , identifier[epub] , identifier[epub_file] , identifier[is_pre_publication] = keyword[False] ):
literal[string]
identifier[publisher] = identifier[epub] [ literal[int] ]. identifier[metadata] [ literal[string] ]
identifier[publish_message] ... | def add_publication(cursor, epub, epub_file, is_pre_publication=False):
"""Adds a publication entry and makes each item
a pending document.
"""
publisher = epub[0].metadata['publisher']
publish_message = epub[0].metadata['publication_message']
epub_binary = psycopg2.Binary(epub_file.read())
... |
def get_all_items_of_invoice(self, invoice_id):
"""
Get all items of invoice
This will iterate over all pages until it gets all elements.
So if the rate limit exceeded it will throw an Exception and you will get nothing
:param invoice_id: the invoice id
:return: list
... | def function[get_all_items_of_invoice, parameter[self, invoice_id]]:
constant[
Get all items of invoice
This will iterate over all pages until it gets all elements.
So if the rate limit exceeded it will throw an Exception and you will get nothing
:param invoice_id: the invoice i... | keyword[def] identifier[get_all_items_of_invoice] ( identifier[self] , identifier[invoice_id] ):
literal[string]
keyword[return] identifier[self] . identifier[_iterate_through_pages] (
identifier[get_function] = identifier[self] . identifier[get_items_of_invoice_per_page] ,
ident... | def get_all_items_of_invoice(self, invoice_id):
"""
Get all items of invoice
This will iterate over all pages until it gets all elements.
So if the rate limit exceeded it will throw an Exception and you will get nothing
:param invoice_id: the invoice id
:return: list
... |
def distributedConnectionMap(names: List[str]) -> OrderedDict:
"""
Create a map where every node is connected every other node.
Assume each key in the returned dictionary to be connected to each item in
its value(list).
:param names: a list of node names
:return: a dictionary of name -> list(na... | def function[distributedConnectionMap, parameter[names]]:
constant[
Create a map where every node is connected every other node.
Assume each key in the returned dictionary to be connected to each item in
its value(list).
:param names: a list of node names
:return: a dictionary of name -> li... | keyword[def] identifier[distributedConnectionMap] ( identifier[names] : identifier[List] [ identifier[str] ])-> identifier[OrderedDict] :
literal[string]
identifier[names] . identifier[sort] ()
identifier[combos] = identifier[list] ( identifier[itertools] . identifier[combinations] ( identifier[names]... | def distributedConnectionMap(names: List[str]) -> OrderedDict:
"""
Create a map where every node is connected every other node.
Assume each key in the returned dictionary to be connected to each item in
its value(list).
:param names: a list of node names
:return: a dictionary of name -> list(na... |
def write(self, fh):
"""
Write set to a GFF3 format file.
:param file fh: file handle for file to write to
"""
fh.write(GFF3_HEADER+"\n")
for root in sorted(self.roots, key=self._recSortKey):
self._writeRec(fh, root) | def function[write, parameter[self, fh]]:
constant[
Write set to a GFF3 format file.
:param file fh: file handle for file to write to
]
call[name[fh].write, parameter[binary_operation[name[GFF3_HEADER] + constant[
]]]]
for taget[name[root]] in starred[call[name[sorted], ... | keyword[def] identifier[write] ( identifier[self] , identifier[fh] ):
literal[string]
identifier[fh] . identifier[write] ( identifier[GFF3_HEADER] + literal[string] )
keyword[for] identifier[root] keyword[in] identifier[sorted] ( identifier[self] . identifier[roots] , identifier[key] = ... | def write(self, fh):
"""
Write set to a GFF3 format file.
:param file fh: file handle for file to write to
"""
fh.write(GFF3_HEADER + '\n')
for root in sorted(self.roots, key=self._recSortKey):
self._writeRec(fh, root) # depends on [control=['for'], data=['root']] |
def query_google(point, max_distance, key):
""" Queries google maps API for a location
Args:
point (:obj:`Point`): Point location to query
max_distance (float): Search radius, in meters
key (str): Valid google maps api key
Returns:
:obj:`list` of :obj:`dict`: List of locatio... | def function[query_google, parameter[point, max_distance, key]]:
constant[ Queries google maps API for a location
Args:
point (:obj:`Point`): Point location to query
max_distance (float): Search radius, in meters
key (str): Valid google maps api key
Returns:
:obj:`list` ... | keyword[def] identifier[query_google] ( identifier[point] , identifier[max_distance] , identifier[key] ):
literal[string]
keyword[if] keyword[not] identifier[key] :
keyword[return] []
keyword[if] identifier[from_cache] ( identifier[GG_CACHE] , identifier[point] , identifier[max_distance] ... | def query_google(point, max_distance, key):
""" Queries google maps API for a location
Args:
point (:obj:`Point`): Point location to query
max_distance (float): Search radius, in meters
key (str): Valid google maps api key
Returns:
:obj:`list` of :obj:`dict`: List of locatio... |
def DualDBSystemCronJob(legacy_name=None, stateful=False):
"""Decorator that creates AFF4 and RELDB cronjobs from a given mixin."""
def Decorator(cls):
"""Decorator producing 2 classes: legacy style one and a new style one."""
if not legacy_name:
raise ValueError("legacy_name has to be provided")
... | def function[DualDBSystemCronJob, parameter[legacy_name, stateful]]:
constant[Decorator that creates AFF4 and RELDB cronjobs from a given mixin.]
def function[Decorator, parameter[cls]]:
constant[Decorator producing 2 classes: legacy style one and a new style one.]
if <as... | keyword[def] identifier[DualDBSystemCronJob] ( identifier[legacy_name] = keyword[None] , identifier[stateful] = keyword[False] ):
literal[string]
keyword[def] identifier[Decorator] ( identifier[cls] ):
literal[string]
keyword[if] keyword[not] identifier[legacy_name] :
keyword[raise] iden... | def DualDBSystemCronJob(legacy_name=None, stateful=False):
"""Decorator that creates AFF4 and RELDB cronjobs from a given mixin."""
def Decorator(cls):
"""Decorator producing 2 classes: legacy style one and a new style one."""
if not legacy_name:
raise ValueError('legacy_name has to... |
def process_paper(model_name, pmid):
"""Process a paper with the given pubmed identifier
Parameters
----------
model_name : str
The directory for the INDRA machine
pmid : str
The PMID to process.
Returns
-------
rp : ReachProcessor
A ReachProcessor containing th... | def function[process_paper, parameter[model_name, pmid]]:
constant[Process a paper with the given pubmed identifier
Parameters
----------
model_name : str
The directory for the INDRA machine
pmid : str
The PMID to process.
Returns
-------
rp : ReachProcessor
... | keyword[def] identifier[process_paper] ( identifier[model_name] , identifier[pmid] ):
literal[string]
identifier[json_directory] = identifier[os] . identifier[path] . identifier[join] ( identifier[model_name] , literal[string] )
identifier[json_path] = identifier[os] . identifier[path] . identifier[jo... | def process_paper(model_name, pmid):
"""Process a paper with the given pubmed identifier
Parameters
----------
model_name : str
The directory for the INDRA machine
pmid : str
The PMID to process.
Returns
-------
rp : ReachProcessor
A ReachProcessor containing th... |
def _convert(self, payload):
"""
Converts payload to a string. Complex objects are dumped to json
"""
if not isinstance(payload, six.string_types):
payload = json.dumps(payload, cls=DefaultJSONEncoder, sort_keys=True)
return str(payload) | def function[_convert, parameter[self, payload]]:
constant[
Converts payload to a string. Complex objects are dumped to json
]
if <ast.UnaryOp object at 0x7da1b15e72e0> begin[:]
variable[payload] assign[=] call[name[json].dumps, parameter[name[payload]]]
return[call[n... | keyword[def] identifier[_convert] ( identifier[self] , identifier[payload] ):
literal[string]
keyword[if] keyword[not] identifier[isinstance] ( identifier[payload] , identifier[six] . identifier[string_types] ):
identifier[payload] = identifier[json] . identifier[dumps] ( identifier[... | def _convert(self, payload):
"""
Converts payload to a string. Complex objects are dumped to json
"""
if not isinstance(payload, six.string_types):
payload = json.dumps(payload, cls=DefaultJSONEncoder, sort_keys=True) # depends on [control=['if'], data=[]]
return str(payload) |
def OSLibpath(self):
"""
Microsoft Windows SDK Libraries Paths
"""
ref = os.path.join(self.si.WindowsSdkDir, 'References')
libpath = []
if self.vc_ver <= 9.0:
libpath += self.OSLibraries
if self.vc_ver >= 11.0:
libpath += [os.path.join(re... | def function[OSLibpath, parameter[self]]:
constant[
Microsoft Windows SDK Libraries Paths
]
variable[ref] assign[=] call[name[os].path.join, parameter[name[self].si.WindowsSdkDir, constant[References]]]
variable[libpath] assign[=] list[[]]
if compare[name[self].vc_ver les... | keyword[def] identifier[OSLibpath] ( identifier[self] ):
literal[string]
identifier[ref] = identifier[os] . identifier[path] . identifier[join] ( identifier[self] . identifier[si] . identifier[WindowsSdkDir] , literal[string] )
identifier[libpath] =[]
keyword[if] identifier[self... | def OSLibpath(self):
"""
Microsoft Windows SDK Libraries Paths
"""
ref = os.path.join(self.si.WindowsSdkDir, 'References')
libpath = []
if self.vc_ver <= 9.0:
libpath += self.OSLibraries # depends on [control=['if'], data=[]]
if self.vc_ver >= 11.0:
libpath += [os.pa... |
def _load_results(self, container_id):
"""
load results from recent build
:return: BuildResults
"""
if self.temp_dir:
dt = DockerTasker()
# FIXME: load results only when requested
# results_path = os.path.join(self.temp_dir, RESULTS_JSON)
... | def function[_load_results, parameter[self, container_id]]:
constant[
load results from recent build
:return: BuildResults
]
if name[self].temp_dir begin[:]
variable[dt] assign[=] call[name[DockerTasker], parameter[]]
variable[results] assign[=] c... | keyword[def] identifier[_load_results] ( identifier[self] , identifier[container_id] ):
literal[string]
keyword[if] identifier[self] . identifier[temp_dir] :
identifier[dt] = identifier[DockerTasker] ()
... | def _load_results(self, container_id):
"""
load results from recent build
:return: BuildResults
"""
if self.temp_dir:
dt = DockerTasker()
# FIXME: load results only when requested
# results_path = os.path.join(self.temp_dir, RESULTS_JSON)
# df_path = os.p... |
def dePrefixAndSuffixFasta(sequences):
"""
sequences: an iterator producing Bio.Seq sequences.
return: a generator of sequences with no duplicates and no fully contained
subsequences.
"""
sequences = sorted(sequences, key=lambda s: len(s.seq), reverse=True)
seen = set()
for s in seq... | def function[dePrefixAndSuffixFasta, parameter[sequences]]:
constant[
sequences: an iterator producing Bio.Seq sequences.
return: a generator of sequences with no duplicates and no fully contained
subsequences.
]
variable[sequences] assign[=] call[name[sorted], parameter[name[sequen... | keyword[def] identifier[dePrefixAndSuffixFasta] ( identifier[sequences] ):
literal[string]
identifier[sequences] = identifier[sorted] ( identifier[sequences] , identifier[key] = keyword[lambda] identifier[s] : identifier[len] ( identifier[s] . identifier[seq] ), identifier[reverse] = keyword[True] )
... | def dePrefixAndSuffixFasta(sequences):
"""
sequences: an iterator producing Bio.Seq sequences.
return: a generator of sequences with no duplicates and no fully contained
subsequences.
"""
sequences = sorted(sequences, key=lambda s: len(s.seq), reverse=True)
seen = set()
for s in seq... |
def adapt_datetimefield_value(self, value):
"""
Transform a datetime value to an object compatible with what is expected
by the backend driver for datetime columns.
"""
if value is None:
return None
if self.connection._DJANGO_VERSION >= 14 and settings.USE_TZ:... | def function[adapt_datetimefield_value, parameter[self, value]]:
constant[
Transform a datetime value to an object compatible with what is expected
by the backend driver for datetime columns.
]
if compare[name[value] is constant[None]] begin[:]
return[constant[None]]
... | keyword[def] identifier[adapt_datetimefield_value] ( identifier[self] , identifier[value] ):
literal[string]
keyword[if] identifier[value] keyword[is] keyword[None] :
keyword[return] keyword[None]
keyword[if] identifier[self] . identifier[connection] . identifier[_DJANGO... | def adapt_datetimefield_value(self, value):
"""
Transform a datetime value to an object compatible with what is expected
by the backend driver for datetime columns.
"""
if value is None:
return None # depends on [control=['if'], data=[]]
if self.connection._DJANGO_VERSION >=... |
def func(self, f, state):
'''Intended to be overridden by subclasses. Raises
NotImplementedError.'''
message = 'Tried to use unimplemented lens {}.'
raise NotImplementedError(message.format(type(self))) | def function[func, parameter[self, f, state]]:
constant[Intended to be overridden by subclasses. Raises
NotImplementedError.]
variable[message] assign[=] constant[Tried to use unimplemented lens {}.]
<ast.Raise object at 0x7da20c6a8370> | keyword[def] identifier[func] ( identifier[self] , identifier[f] , identifier[state] ):
literal[string]
identifier[message] = literal[string]
keyword[raise] identifier[NotImplementedError] ( identifier[message] . identifier[format] ( identifier[type] ( identifier[self] ))) | def func(self, f, state):
"""Intended to be overridden by subclasses. Raises
NotImplementedError."""
message = 'Tried to use unimplemented lens {}.'
raise NotImplementedError(message.format(type(self))) |
def gantry_axes(cls) -> Tuple['Axis', 'Axis', 'Axis', 'Axis']:
""" The axes which are tied to the gantry and require the deck
calibration transform
"""
return (cls.X, cls.Y, cls.Z, cls.A) | def function[gantry_axes, parameter[cls]]:
constant[ The axes which are tied to the gantry and require the deck
calibration transform
]
return[tuple[[<ast.Attribute object at 0x7da1b0924a00>, <ast.Attribute object at 0x7da1b09257b0>, <ast.Attribute object at 0x7da204345390>, <ast.Attribute o... | keyword[def] identifier[gantry_axes] ( identifier[cls] )-> identifier[Tuple] [ literal[string] , literal[string] , literal[string] , literal[string] ]:
literal[string]
keyword[return] ( identifier[cls] . identifier[X] , identifier[cls] . identifier[Y] , identifier[cls] . identifier[Z] , identifier[... | def gantry_axes(cls) -> Tuple['Axis', 'Axis', 'Axis', 'Axis']:
""" The axes which are tied to the gantry and require the deck
calibration transform
"""
return (cls.X, cls.Y, cls.Z, cls.A) |
def after_request(self, region, endpoint_name, method_name, url, response):
"""
Called after a response is received and before it is returned to the user.
:param string region: the region of this request
:param string endpoint_name: the name of the endpoint that was requested
:p... | def function[after_request, parameter[self, region, endpoint_name, method_name, url, response]]:
constant[
Called after a response is received and before it is returned to the user.
:param string region: the region of this request
:param string endpoint_name: the name of the endpoint th... | keyword[def] identifier[after_request] ( identifier[self] , identifier[region] , identifier[endpoint_name] , identifier[method_name] , identifier[url] , identifier[response] ):
literal[string]
keyword[for] identifier[limiter] keyword[in] identifier[self] . identifier[_limiters] :
id... | def after_request(self, region, endpoint_name, method_name, url, response):
"""
Called after a response is received and before it is returned to the user.
:param string region: the region of this request
:param string endpoint_name: the name of the endpoint that was requested
:param... |
def is_declared(self):
"""
:return: True is the table is declared in the schema.
"""
return self.connection.query(
'SHOW TABLES in `{database}` LIKE "{table_name}"'.format(
database=self.database, table_name=self.table_name)).rowcount > 0 | def function[is_declared, parameter[self]]:
constant[
:return: True is the table is declared in the schema.
]
return[compare[call[name[self].connection.query, parameter[call[constant[SHOW TABLES in `{database}` LIKE "{table_name}"].format, parameter[]]]].rowcount greater[>] constant[0]]] | keyword[def] identifier[is_declared] ( identifier[self] ):
literal[string]
keyword[return] identifier[self] . identifier[connection] . identifier[query] (
literal[string] . identifier[format] (
identifier[database] = identifier[self] . identifier[database] , identifier[table_name... | def is_declared(self):
"""
:return: True is the table is declared in the schema.
"""
return self.connection.query('SHOW TABLES in `{database}` LIKE "{table_name}"'.format(database=self.database, table_name=self.table_name)).rowcount > 0 |
def typeSort(self):
'''
Sorts ``self.children`` in place, and has each child sort its own children.
Refer to :func:`~exhale.graph.ExhaleRoot.deepSortList` for more information on
when this is necessary.
'''
self.children.sort()
for c in self.children:
... | def function[typeSort, parameter[self]]:
constant[
Sorts ``self.children`` in place, and has each child sort its own children.
Refer to :func:`~exhale.graph.ExhaleRoot.deepSortList` for more information on
when this is necessary.
]
call[name[self].children.sort, parameter... | keyword[def] identifier[typeSort] ( identifier[self] ):
literal[string]
identifier[self] . identifier[children] . identifier[sort] ()
keyword[for] identifier[c] keyword[in] identifier[self] . identifier[children] :
identifier[c] . identifier[typeSort] () | def typeSort(self):
"""
Sorts ``self.children`` in place, and has each child sort its own children.
Refer to :func:`~exhale.graph.ExhaleRoot.deepSortList` for more information on
when this is necessary.
"""
self.children.sort()
for c in self.children:
c.typeSort() # ... |
def makefractalCIJ(mx_lvl, E, sz_cl, seed=None):
'''
This function generates a directed network with a hierarchical modular
organization. All modules are fully connected and connection density
decays as 1/(E^n), with n = index of hierarchical level.
Parameters
----------
mx_lvl : int
... | def function[makefractalCIJ, parameter[mx_lvl, E, sz_cl, seed]]:
constant[
This function generates a directed network with a hierarchical modular
organization. All modules are fully connected and connection density
decays as 1/(E^n), with n = index of hierarchical level.
Parameters
--------... | keyword[def] identifier[makefractalCIJ] ( identifier[mx_lvl] , identifier[E] , identifier[sz_cl] , identifier[seed] = keyword[None] ):
literal[string]
identifier[rng] = identifier[get_rng] ( identifier[seed] )
identifier[t] = identifier[np] . identifier[ones] (( literal[int] , literal[int] ))* li... | def makefractalCIJ(mx_lvl, E, sz_cl, seed=None):
"""
This function generates a directed network with a hierarchical modular
organization. All modules are fully connected and connection density
decays as 1/(E^n), with n = index of hierarchical level.
Parameters
----------
mx_lvl : int
... |
def request(self, url, parameters):
"""Perform a http(s) request for given parameters to given URL
Keyword arguments:
url -- API url
parameters -- dict with payload.
"""
try:
request = Request(url + '?' + urlencode(parameters), None, {
... | def function[request, parameter[self, url, parameters]]:
constant[Perform a http(s) request for given parameters to given URL
Keyword arguments:
url -- API url
parameters -- dict with payload.
]
<ast.Try object at 0x7da18f720e80>
if <ast.BoolOp object at ... | keyword[def] identifier[request] ( identifier[self] , identifier[url] , identifier[parameters] ):
literal[string]
keyword[try] :
identifier[request] = identifier[Request] ( identifier[url] + literal[string] + identifier[urlencode] ( identifier[parameters] ), keyword[None] ,{
... | def request(self, url, parameters):
"""Perform a http(s) request for given parameters to given URL
Keyword arguments:
url -- API url
parameters -- dict with payload.
"""
try:
request = Request(url + '?' + urlencode(parameters), None, {'X-Authentication-Token'... |
def connect(dsn=None, turbodbc_options=None, connection_string=None, **kwargs):
"""
Create a connection with the database identified by the ``dsn`` or the ``connection_string``.
:param dsn: Data source name as given in the (unix) odbc.ini file
or (Windows) ODBC Data Source Administrator tool.
... | def function[connect, parameter[dsn, turbodbc_options, connection_string]]:
constant[
Create a connection with the database identified by the ``dsn`` or the ``connection_string``.
:param dsn: Data source name as given in the (unix) odbc.ini file
or (Windows) ODBC Data Source Administrator to... | keyword[def] identifier[connect] ( identifier[dsn] = keyword[None] , identifier[turbodbc_options] = keyword[None] , identifier[connection_string] = keyword[None] ,** identifier[kwargs] ):
literal[string]
keyword[if] identifier[turbodbc_options] keyword[is] keyword[None] :
identifier[turbodbc_op... | def connect(dsn=None, turbodbc_options=None, connection_string=None, **kwargs):
"""
Create a connection with the database identified by the ``dsn`` or the ``connection_string``.
:param dsn: Data source name as given in the (unix) odbc.ini file
or (Windows) ODBC Data Source Administrator tool.
... |
def process_update(self, update):
"""Process an incoming update from a remote NetworkTables"""
data = json.loads(update)
NetworkTables.getEntry(data["k"]).setValue(data["v"]) | def function[process_update, parameter[self, update]]:
constant[Process an incoming update from a remote NetworkTables]
variable[data] assign[=] call[name[json].loads, parameter[name[update]]]
call[call[name[NetworkTables].getEntry, parameter[call[name[data]][constant[k]]]].setValue, parameter[c... | keyword[def] identifier[process_update] ( identifier[self] , identifier[update] ):
literal[string]
identifier[data] = identifier[json] . identifier[loads] ( identifier[update] )
identifier[NetworkTables] . identifier[getEntry] ( identifier[data] [ literal[string] ]). identifier[setValue] (... | def process_update(self, update):
"""Process an incoming update from a remote NetworkTables"""
data = json.loads(update)
NetworkTables.getEntry(data['k']).setValue(data['v']) |
def enqueue(self, s):
"""
Append `s` to the queue.
Equivalent to::
queue += s
if `queue` where a regular string.
"""
self._parts.append(s)
self._len += len(s) | def function[enqueue, parameter[self, s]]:
constant[
Append `s` to the queue.
Equivalent to::
queue += s
if `queue` where a regular string.
]
call[name[self]._parts.append, parameter[name[s]]]
<ast.AugAssign object at 0x7da20... | keyword[def] identifier[enqueue] ( identifier[self] , identifier[s] ):
literal[string]
identifier[self] . identifier[_parts] . identifier[append] ( identifier[s] )
identifier[self] . identifier[_len] += identifier[len] ( identifier[s] ) | def enqueue(self, s):
"""
Append `s` to the queue.
Equivalent to::
queue += s
if `queue` where a regular string.
"""
self._parts.append(s)
self._len += len(s) |
def find(self, rel, key):
"""
Searches for a record with the specified relation to the key
A cursor object is returned, the user can call getkey, getval on the cursor
to retrieve the actual value.
or call cursor.next() / cursor.prev() to enumerate values.
'eq' ... | def function[find, parameter[self, rel, key]]:
constant[
Searches for a record with the specified relation to the key
A cursor object is returned, the user can call getkey, getval on the cursor
to retrieve the actual value.
or call cursor.next() / cursor.prev() to enumerate valu... | keyword[def] identifier[find] ( identifier[self] , identifier[rel] , identifier[key] ):
literal[string]
identifier[page] = identifier[self] . identifier[readpage] ( identifier[self] . identifier[firstindex] )
identifier[stack] =[]
keyword[while] identifier[len] ( ... | def find(self, rel, key):
"""
Searches for a record with the specified relation to the key
A cursor object is returned, the user can call getkey, getval on the cursor
to retrieve the actual value.
or call cursor.next() / cursor.prev() to enumerate values.
'eq' -> record eq... |
def _create_marks(fig, marks=[bq.Mark], options={}, params={}):
"""
Initializes and returns marks for a figure as a list. Each mark is passed
in as a class. The plot options should be passed into options.
Any additional parameters to initialize plot components are passed into
params as a dict of { ... | def function[_create_marks, parameter[fig, marks, options, params]]:
constant[
Initializes and returns marks for a figure as a list. Each mark is passed
in as a class. The plot options should be passed into options.
Any additional parameters to initialize plot components are passed into
params ... | keyword[def] identifier[_create_marks] ( identifier[fig] , identifier[marks] =[ identifier[bq] . identifier[Mark] ], identifier[options] ={}, identifier[params] ={}):
literal[string]
identifier[params] = identifier[_merge_with_defaults] ( identifier[params] )
identifier[x_ax] , identifier[y... | def _create_marks(fig, marks=[bq.Mark], options={}, params={}):
"""
Initializes and returns marks for a figure as a list. Each mark is passed
in as a class. The plot options should be passed into options.
Any additional parameters to initialize plot components are passed into
params as a dict of { ... |
def del_interrupt_callback(self, gpio_id):
""" Delete all interrupt callbacks from a certain gpio """
debug("- removing interrupts on gpio %s" % gpio_id)
gpio_id = _GPIO.channel_to_gpio(gpio_id)
fileno = self._map_gpioid_to_fileno[gpio_id]
# 1. Remove from epoll
self._ep... | def function[del_interrupt_callback, parameter[self, gpio_id]]:
constant[ Delete all interrupt callbacks from a certain gpio ]
call[name[debug], parameter[binary_operation[constant[- removing interrupts on gpio %s] <ast.Mod object at 0x7da2590d6920> name[gpio_id]]]]
variable[gpio_id] assign[=] c... | keyword[def] identifier[del_interrupt_callback] ( identifier[self] , identifier[gpio_id] ):
literal[string]
identifier[debug] ( literal[string] % identifier[gpio_id] )
identifier[gpio_id] = identifier[_GPIO] . identifier[channel_to_gpio] ( identifier[gpio_id] )
identifier[fileno] ... | def del_interrupt_callback(self, gpio_id):
""" Delete all interrupt callbacks from a certain gpio """
debug('- removing interrupts on gpio %s' % gpio_id)
gpio_id = _GPIO.channel_to_gpio(gpio_id)
fileno = self._map_gpioid_to_fileno[gpio_id]
# 1. Remove from epoll
self._epoll.unregister(fileno)
... |
def register(self, request, **cleaned_data):
"""
Given a username, email address and password, register a new
user account, which will initially be inactive.
Along with the new ``User`` object, a new
``registration.models.RegistrationProfile`` will be created,
tied to th... | def function[register, parameter[self, request]]:
constant[
Given a username, email address and password, register a new
user account, which will initially be inactive.
Along with the new ``User`` object, a new
``registration.models.RegistrationProfile`` will be created,
... | keyword[def] identifier[register] ( identifier[self] , identifier[request] ,** identifier[cleaned_data] ):
literal[string]
keyword[if] identifier[Site] . identifier[_meta] . identifier[installed] :
identifier[site] = identifier[Site] . identifier[objects] . identifier[get_current] ()
... | def register(self, request, **cleaned_data):
"""
Given a username, email address and password, register a new
user account, which will initially be inactive.
Along with the new ``User`` object, a new
``registration.models.RegistrationProfile`` will be created,
tied to that `... |
def index(ref_file, out_dir, data):
"""Create a STAR index in the defined reference directory.
"""
(ref_dir, local_file) = os.path.split(ref_file)
gtf_file = dd.get_gtf_file(data)
if not utils.file_exists(gtf_file):
raise ValueError("%s not found, could not create a star index." % (gtf_file)... | def function[index, parameter[ref_file, out_dir, data]]:
constant[Create a STAR index in the defined reference directory.
]
<ast.Tuple object at 0x7da1b1894a90> assign[=] call[name[os].path.split, parameter[name[ref_file]]]
variable[gtf_file] assign[=] call[name[dd].get_gtf_file, parameter[n... | keyword[def] identifier[index] ( identifier[ref_file] , identifier[out_dir] , identifier[data] ):
literal[string]
( identifier[ref_dir] , identifier[local_file] )= identifier[os] . identifier[path] . identifier[split] ( identifier[ref_file] )
identifier[gtf_file] = identifier[dd] . identifier[get_gtf_f... | def index(ref_file, out_dir, data):
"""Create a STAR index in the defined reference directory.
"""
(ref_dir, local_file) = os.path.split(ref_file)
gtf_file = dd.get_gtf_file(data)
if not utils.file_exists(gtf_file):
raise ValueError('%s not found, could not create a star index.' % gtf_file) ... |
def hll_count(expr, error_rate=0.01, splitter=None):
"""
Calculate HyperLogLog count
:param expr:
:param error_rate: error rate
:type error_rate: float
:param splitter: the splitter to split the column value
:return: sequence or scalar
:Example:
>>> df = DataFrame(pd.DataFrame({'a... | def function[hll_count, parameter[expr, error_rate, splitter]]:
constant[
Calculate HyperLogLog count
:param expr:
:param error_rate: error rate
:type error_rate: float
:param splitter: the splitter to split the column value
:return: sequence or scalar
:Example:
>>> df = DataF... | keyword[def] identifier[hll_count] ( identifier[expr] , identifier[error_rate] = literal[int] , identifier[splitter] = keyword[None] ):
literal[string]
keyword[with] identifier[open] ( identifier[os] . identifier[path] . identifier[join] ( identifier[path] , literal[string] , literal[string] )) keyw... | def hll_count(expr, error_rate=0.01, splitter=None):
"""
Calculate HyperLogLog count
:param expr:
:param error_rate: error rate
:type error_rate: float
:param splitter: the splitter to split the column value
:return: sequence or scalar
:Example:
>>> df = DataFrame(pd.DataFrame({'a... |
def read_file(path, absolute=False, encoding='utf-8'):
"""
Read the file at `path`. If `absolute` is True, use absolute path,
otherwise path is assumed to be relative to Tarbell template root dir.
For example:
.. code-block:: html+jinja
<div class="chapter">
{{ read_fi... | def function[read_file, parameter[path, absolute, encoding]]:
constant[
Read the file at `path`. If `absolute` is True, use absolute path,
otherwise path is assumed to be relative to Tarbell template root dir.
For example:
.. code-block:: html+jinja
<div class="chapter">
... | keyword[def] identifier[read_file] ( identifier[path] , identifier[absolute] = keyword[False] , identifier[encoding] = literal[string] ):
literal[string]
identifier[site] = identifier[g] . identifier[current_site]
keyword[if] keyword[not] identifier[absolute] :
identifier[path] = identifie... | def read_file(path, absolute=False, encoding='utf-8'):
"""
Read the file at `path`. If `absolute` is True, use absolute path,
otherwise path is assumed to be relative to Tarbell template root dir.
For example:
.. code-block:: html+jinja
<div class="chapter">
{{ read_fi... |
def _grouper(iterable, n, fillvalue=0):
"""Collect data into fixed-length chunks or blocks.
Args:
n (int): The size of the chunk.
fillvalue (int): The fill value.
Returns:
iterator: An iterator over the chunks.
"""
args = [iter(iterable)] * ... | def function[_grouper, parameter[iterable, n, fillvalue]]:
constant[Collect data into fixed-length chunks or blocks.
Args:
n (int): The size of the chunk.
fillvalue (int): The fill value.
Returns:
iterator: An iterator over the chunks.
]
var... | keyword[def] identifier[_grouper] ( identifier[iterable] , identifier[n] , identifier[fillvalue] = literal[int] ):
literal[string]
identifier[args] =[ identifier[iter] ( identifier[iterable] )]* identifier[n]
keyword[return] identifier[zip_longest] ( identifier[fillvalue] = identifier[fi... | def _grouper(iterable, n, fillvalue=0):
"""Collect data into fixed-length chunks or blocks.
Args:
n (int): The size of the chunk.
fillvalue (int): The fill value.
Returns:
iterator: An iterator over the chunks.
"""
args = [iter(iterable)] * n
re... |
def next_event(self, event_id, prev=False):
"""Get the event following another event in this conversation.
Args:
event_id (str): ID of the event.
prev (bool): If ``True``, return the previous event rather than the
next event. Defaults to ``False``.
Raise... | def function[next_event, parameter[self, event_id, prev]]:
constant[Get the event following another event in this conversation.
Args:
event_id (str): ID of the event.
prev (bool): If ``True``, return the previous event rather than the
next event. Defaults to ``Fa... | keyword[def] identifier[next_event] ( identifier[self] , identifier[event_id] , identifier[prev] = keyword[False] ):
literal[string]
identifier[i] = identifier[self] . identifier[events] . identifier[index] ( identifier[self] . identifier[_events_dict] [ identifier[event_id] ])
keyword[if]... | def next_event(self, event_id, prev=False):
"""Get the event following another event in this conversation.
Args:
event_id (str): ID of the event.
prev (bool): If ``True``, return the previous event rather than the
next event. Defaults to ``False``.
Raises:
... |
def _get_field_by_name(model_class, field_name):
"""
Compatible with old API of model_class._meta.get_field_by_name(field_name)
"""
field = model_class._meta.get_field(field_name)
return (
field, # field
field.model, ... | def function[_get_field_by_name, parameter[model_class, field_name]]:
constant[
Compatible with old API of model_class._meta.get_field_by_name(field_name)
]
variable[field] assign[=] call[name[model_class]._meta.get_field, parameter[name[field_name]]]
return[tuple[[<ast.Name object at 0x7da2... | keyword[def] identifier[_get_field_by_name] ( identifier[model_class] , identifier[field_name] ):
literal[string]
identifier[field] = identifier[model_class] . identifier[_meta] . identifier[get_field] ( identifier[field_name] )
keyword[return] (
identifier[field] ,
identifier[field] . ident... | def _get_field_by_name(model_class, field_name):
"""
Compatible with old API of model_class._meta.get_field_by_name(field_name)
"""
field = model_class._meta.get_field(field_name) # field
# model
# direct
# m2m
return (field, field.model, not field.auto_created or field.concrete, field.... |
def import_from_storage_bucket(self, bucket, file, namespace=None, entity_filter=None, labels=None):
"""
Import a backup from Cloud Storage to Cloud Datastore.
.. note::
Keep in mind that this requests the Admin API not the Data API.
.. seealso::
https://cloud.g... | def function[import_from_storage_bucket, parameter[self, bucket, file, namespace, entity_filter, labels]]:
constant[
Import a backup from Cloud Storage to Cloud Datastore.
.. note::
Keep in mind that this requests the Admin API not the Data API.
.. seealso::
htt... | keyword[def] identifier[import_from_storage_bucket] ( identifier[self] , identifier[bucket] , identifier[file] , identifier[namespace] = keyword[None] , identifier[entity_filter] = keyword[None] , identifier[labels] = keyword[None] ):
literal[string]
identifier[admin_conn] = identifier[self] . iden... | def import_from_storage_bucket(self, bucket, file, namespace=None, entity_filter=None, labels=None):
"""
Import a backup from Cloud Storage to Cloud Datastore.
.. note::
Keep in mind that this requests the Admin API not the Data API.
.. seealso::
https://cloud.googl... |
def clear_file_list_cache(self, load):
'''
Deletes the file_lists cache files
'''
if 'env' in load:
# "env" is not supported; Use "saltenv".
load.pop('env')
saltenv = load.get('saltenv', [])
if saltenv is not None:
if not isinstance(sa... | def function[clear_file_list_cache, parameter[self, load]]:
constant[
Deletes the file_lists cache files
]
if compare[constant[env] in name[load]] begin[:]
call[name[load].pop, parameter[constant[env]]]
variable[saltenv] assign[=] call[name[load].get, parameter[co... | keyword[def] identifier[clear_file_list_cache] ( identifier[self] , identifier[load] ):
literal[string]
keyword[if] literal[string] keyword[in] identifier[load] :
identifier[load] . identifier[pop] ( literal[string] )
identifier[saltenv] = identifier[load] . ident... | def clear_file_list_cache(self, load):
"""
Deletes the file_lists cache files
"""
if 'env' in load:
# "env" is not supported; Use "saltenv".
load.pop('env') # depends on [control=['if'], data=['load']]
saltenv = load.get('saltenv', [])
if saltenv is not None:
if ... |
def get_ip_interface_output_interface_if_state(self, **kwargs):
"""Auto Generated Code
"""
config = ET.Element("config")
get_ip_interface = ET.Element("get_ip_interface")
config = get_ip_interface
output = ET.SubElement(get_ip_interface, "output")
interface = ET.S... | def function[get_ip_interface_output_interface_if_state, parameter[self]]:
constant[Auto Generated Code
]
variable[config] assign[=] call[name[ET].Element, parameter[constant[config]]]
variable[get_ip_interface] assign[=] call[name[ET].Element, parameter[constant[get_ip_interface]]]
... | keyword[def] identifier[get_ip_interface_output_interface_if_state] ( identifier[self] ,** identifier[kwargs] ):
literal[string]
identifier[config] = identifier[ET] . identifier[Element] ( literal[string] )
identifier[get_ip_interface] = identifier[ET] . identifier[Element] ( literal[strin... | def get_ip_interface_output_interface_if_state(self, **kwargs):
"""Auto Generated Code
"""
config = ET.Element('config')
get_ip_interface = ET.Element('get_ip_interface')
config = get_ip_interface
output = ET.SubElement(get_ip_interface, 'output')
interface = ET.SubElement(output, 'inter... |
def make_certifier():
"""
Decorator that can wrap raw functions to create a certifier function.
Certifier functions support partial application. If a function wrapped by
`make_certifier` is called with a value as its first argument it will be
certified immediately. If no value is passed, then it ... | def function[make_certifier, parameter[]]:
constant[
Decorator that can wrap raw functions to create a certifier function.
Certifier functions support partial application. If a function wrapped by
`make_certifier` is called with a value as its first argument it will be
certified immediately. ... | keyword[def] identifier[make_certifier] ():
literal[string]
keyword[def] identifier[decorator] ( identifier[func] ):
@ identifier[six] . identifier[wraps] ( identifier[func] )
keyword[def] identifier[wrapper] ( identifier[value] = identifier[_undefined] ,** identifier[kwargs] ):
... | def make_certifier():
"""
Decorator that can wrap raw functions to create a certifier function.
Certifier functions support partial application. If a function wrapped by
`make_certifier` is called with a value as its first argument it will be
certified immediately. If no value is passed, then it ... |
def parse_tibia_datetime(datetime_str) -> Optional[datetime.datetime]:
"""Parses date and time from the format used in Tibia.com
Accepted format:
- ``MMM DD YYYY, HH:mm:ss ZZZ``, e.g. ``Dec 10 2018, 21:53:37 CET``.
Parameters
-------------
datetime_str: :class:`str`
The date and time ... | def function[parse_tibia_datetime, parameter[datetime_str]]:
constant[Parses date and time from the format used in Tibia.com
Accepted format:
- ``MMM DD YYYY, HH:mm:ss ZZZ``, e.g. ``Dec 10 2018, 21:53:37 CET``.
Parameters
-------------
datetime_str: :class:`str`
The date and time ... | keyword[def] identifier[parse_tibia_datetime] ( identifier[datetime_str] )-> identifier[Optional] [ identifier[datetime] . identifier[datetime] ]:
literal[string]
keyword[try] :
identifier[datetime_str] = identifier[datetime_str] . identifier[replace] ( literal[string] , literal[string] ). identif... | def parse_tibia_datetime(datetime_str) -> Optional[datetime.datetime]:
"""Parses date and time from the format used in Tibia.com
Accepted format:
- ``MMM DD YYYY, HH:mm:ss ZZZ``, e.g. ``Dec 10 2018, 21:53:37 CET``.
Parameters
-------------
datetime_str: :class:`str`
The date and time ... |
def get(self, attri):
'''
Method that dynamically determines the type of attribute that is
passed into this method. Also it then returns that attribute's
associated data.
Parameters
----------
attri : string
The attribute we are looking for.
... | def function[get, parameter[self, attri]]:
constant[
Method that dynamically determines the type of attribute that is
passed into this method. Also it then returns that attribute's
associated data.
Parameters
----------
attri : string
The attribute we... | keyword[def] identifier[get] ( identifier[self] , identifier[attri] ):
literal[string]
identifier[isCol] = keyword[False]
identifier[isHead] = keyword[False]
keyword[if] identifier[attri] keyword[in] identifier[self] . identifier[dcols] :
identifier[isCol] = key... | def get(self, attri):
"""
Method that dynamically determines the type of attribute that is
passed into this method. Also it then returns that attribute's
associated data.
Parameters
----------
attri : string
The attribute we are looking for.
"""
... |
def update(self, fieldname, localValue, remoteValue):
'''
Returns the appropriate current value, based on the changes
recorded by this ChangeTracker, the value stored by the server
(`localValue`), and the value stored by the synchronizing client
(`remoteValue`). If `remoteValue` conflicts with chang... | def function[update, parameter[self, fieldname, localValue, remoteValue]]:
constant[
Returns the appropriate current value, based on the changes
recorded by this ChangeTracker, the value stored by the server
(`localValue`), and the value stored by the synchronizing client
(`remoteValue`). If `re... | keyword[def] identifier[update] ( identifier[self] , identifier[fieldname] , identifier[localValue] , identifier[remoteValue] ):
literal[string]
keyword[if] identifier[localValue] == identifier[remoteValue] :
keyword[return] identifier[localValue]
identifier[ct] = identifier[constants] . ide... | def update(self, fieldname, localValue, remoteValue):
"""
Returns the appropriate current value, based on the changes
recorded by this ChangeTracker, the value stored by the server
(`localValue`), and the value stored by the synchronizing client
(`remoteValue`). If `remoteValue` conflicts with chang... |
def calculate_sunrise_sunset(locator, calc_date=datetime.utcnow()):
"""calculates the next sunset and sunrise for a Maidenhead locator at a give date & time
Args:
locator1 (string): Maidenhead Locator, either 4 or 6 characters
calc_date (datetime, optional): Starting datetime for th... | def function[calculate_sunrise_sunset, parameter[locator, calc_date]]:
constant[calculates the next sunset and sunrise for a Maidenhead locator at a give date & time
Args:
locator1 (string): Maidenhead Locator, either 4 or 6 characters
calc_date (datetime, optional): Starting da... | keyword[def] identifier[calculate_sunrise_sunset] ( identifier[locator] , identifier[calc_date] = identifier[datetime] . identifier[utcnow] ()):
literal[string]
identifier[morning_dawn] = keyword[None]
identifier[sunrise] = keyword[None]
identifier[evening_dawn] = keyword[None]
identifier... | def calculate_sunrise_sunset(locator, calc_date=datetime.utcnow()):
"""calculates the next sunset and sunrise for a Maidenhead locator at a give date & time
Args:
locator1 (string): Maidenhead Locator, either 4 or 6 characters
calc_date (datetime, optional): Starting datetime for th... |
def main(**kwargs):
"""
Entry point for dx-app-wizard.
Note that this function is not meant to be used as a subroutine in your program.
"""
manifest = []
print_intro(API_VERSION)
if args.json_file is not None:
with open(args.json_file, 'r') as json_file:
app_json = json... | def function[main, parameter[]]:
constant[
Entry point for dx-app-wizard.
Note that this function is not meant to be used as a subroutine in your program.
]
variable[manifest] assign[=] list[[]]
call[name[print_intro], parameter[name[API_VERSION]]]
if compare[name[args].json_... | keyword[def] identifier[main] (** identifier[kwargs] ):
literal[string]
identifier[manifest] =[]
identifier[print_intro] ( identifier[API_VERSION] )
keyword[if] identifier[args] . identifier[json_file] keyword[is] keyword[not] keyword[None] :
keyword[with] identifier[open] ( ident... | def main(**kwargs):
"""
Entry point for dx-app-wizard.
Note that this function is not meant to be used as a subroutine in your program.
"""
manifest = []
print_intro(API_VERSION)
if args.json_file is not None:
with open(args.json_file, 'r') as json_file:
app_json = json.l... |
def write_sub_files(self):
"""
Write all the submit files used by the dag to disk. Each submit file is
written to the file name set in the CondorJob.
"""
if not self.__nodes_finalized:
for node in self.__nodes:
node.finalize()
if not self.is_dax():
for job in self.__jobs:
... | def function[write_sub_files, parameter[self]]:
constant[
Write all the submit files used by the dag to disk. Each submit file is
written to the file name set in the CondorJob.
]
if <ast.UnaryOp object at 0x7da1b0b13340> begin[:]
for taget[name[node]] in starred[name[self].__... | keyword[def] identifier[write_sub_files] ( identifier[self] ):
literal[string]
keyword[if] keyword[not] identifier[self] . identifier[__nodes_finalized] :
keyword[for] identifier[node] keyword[in] identifier[self] . identifier[__nodes] :
identifier[node] . identifier[finalize] ()
... | def write_sub_files(self):
"""
Write all the submit files used by the dag to disk. Each submit file is
written to the file name set in the CondorJob.
"""
if not self.__nodes_finalized:
for node in self.__nodes:
node.finalize() # depends on [control=['for'], data=['node']] # dep... |
def meter_calls_with_dims(**dims):
"""Decorator to track the rate at which a function is called
with dimensions.
"""
def meter_wrapper(fn):
@functools.wraps(fn)
def fn_wrapper(*args, **kwargs):
meter("%s_calls" %
pyformance.registry.get_qualname(fn), **dims)... | def function[meter_calls_with_dims, parameter[]]:
constant[Decorator to track the rate at which a function is called
with dimensions.
]
def function[meter_wrapper, parameter[fn]]:
def function[fn_wrapper, parameter[]]:
call[call[name[meter], parameter[bina... | keyword[def] identifier[meter_calls_with_dims] (** identifier[dims] ):
literal[string]
keyword[def] identifier[meter_wrapper] ( identifier[fn] ):
@ identifier[functools] . identifier[wraps] ( identifier[fn] )
keyword[def] identifier[fn_wrapper] (* identifier[args] ,** identifier[kwargs] ... | def meter_calls_with_dims(**dims):
"""Decorator to track the rate at which a function is called
with dimensions.
"""
def meter_wrapper(fn):
@functools.wraps(fn)
def fn_wrapper(*args, **kwargs):
meter('%s_calls' % pyformance.registry.get_qualname(fn), **dims).mark()
... |
def get_plugins_info(self, limit=10, offset=10):
"""
Provide plugins info
:param limit:
:param offset:
:return:
"""
params = {}
if offset:
params['offset'] = offset
if limit:
params['limit'] = limit
url = 'rest/1.0/p... | def function[get_plugins_info, parameter[self, limit, offset]]:
constant[
Provide plugins info
:param limit:
:param offset:
:return:
]
variable[params] assign[=] dictionary[[], []]
if name[offset] begin[:]
call[name[params]][constant[offset... | keyword[def] identifier[get_plugins_info] ( identifier[self] , identifier[limit] = literal[int] , identifier[offset] = literal[int] ):
literal[string]
identifier[params] ={}
keyword[if] identifier[offset] :
identifier[params] [ literal[string] ]= identifier[offset]
... | def get_plugins_info(self, limit=10, offset=10):
"""
Provide plugins info
:param limit:
:param offset:
:return:
"""
params = {}
if offset:
params['offset'] = offset # depends on [control=['if'], data=[]]
if limit:
params['limit'] = limit # depend... |
def preview(ident):
'''Preview an harvesting for a given source'''
source = get_source(ident)
cls = backends.get(current_app, source.backend)
max_items = current_app.config['HARVEST_PREVIEW_MAX_ITEMS']
backend = cls(source, dryrun=True, max_items=max_items)
return backend.harvest() | def function[preview, parameter[ident]]:
constant[Preview an harvesting for a given source]
variable[source] assign[=] call[name[get_source], parameter[name[ident]]]
variable[cls] assign[=] call[name[backends].get, parameter[name[current_app], name[source].backend]]
variable[max_items] a... | keyword[def] identifier[preview] ( identifier[ident] ):
literal[string]
identifier[source] = identifier[get_source] ( identifier[ident] )
identifier[cls] = identifier[backends] . identifier[get] ( identifier[current_app] , identifier[source] . identifier[backend] )
identifier[max_items] = identif... | def preview(ident):
"""Preview an harvesting for a given source"""
source = get_source(ident)
cls = backends.get(current_app, source.backend)
max_items = current_app.config['HARVEST_PREVIEW_MAX_ITEMS']
backend = cls(source, dryrun=True, max_items=max_items)
return backend.harvest() |
def leave(self, reason=None, message=None):
"""Actively close this WAMP session.
Replace :meth:`autobahn.wamp.interface.IApplicationSession.leave`
"""
# see https://github.com/crossbario/autobahn-python/issues/605
return self._async_session.leave(reason=reason, log_message=messa... | def function[leave, parameter[self, reason, message]]:
constant[Actively close this WAMP session.
Replace :meth:`autobahn.wamp.interface.IApplicationSession.leave`
]
return[call[name[self]._async_session.leave, parameter[]]] | keyword[def] identifier[leave] ( identifier[self] , identifier[reason] = keyword[None] , identifier[message] = keyword[None] ):
literal[string]
keyword[return] identifier[self] . identifier[_async_session] . identifier[leave] ( identifier[reason] = identifier[reason] , identifier[log_mess... | def leave(self, reason=None, message=None):
"""Actively close this WAMP session.
Replace :meth:`autobahn.wamp.interface.IApplicationSession.leave`
"""
# see https://github.com/crossbario/autobahn-python/issues/605
return self._async_session.leave(reason=reason, log_message=message) |
def _set_capabilities(self, v, load=False):
"""
Setter method for capabilities, mapped from YANG variable /capabilities (container)
If this variable is read-only (config: false) in the
source YANG file, then _set_capabilities is considered as a private
method. Backends looking to populate this varia... | def function[_set_capabilities, parameter[self, v, load]]:
constant[
Setter method for capabilities, mapped from YANG variable /capabilities (container)
If this variable is read-only (config: false) in the
source YANG file, then _set_capabilities is considered as a private
method. Backends looki... | keyword[def] identifier[_set_capabilities] ( identifier[self] , identifier[v] , identifier[load] = keyword[False] ):
literal[string]
keyword[if] identifier[hasattr] ( identifier[v] , literal[string] ):
identifier[v] = identifier[v] . identifier[_utype] ( identifier[v] )
keyword[try] :
i... | def _set_capabilities(self, v, load=False):
"""
Setter method for capabilities, mapped from YANG variable /capabilities (container)
If this variable is read-only (config: false) in the
source YANG file, then _set_capabilities is considered as a private
method. Backends looking to populate this varia... |
def index_name(table, columns):
"""Generate an artificial index name."""
sig = '||'.join(columns)
key = sha1(sig.encode('utf-8')).hexdigest()[:16]
return 'ix_%s_%s' % (table, key) | def function[index_name, parameter[table, columns]]:
constant[Generate an artificial index name.]
variable[sig] assign[=] call[constant[||].join, parameter[name[columns]]]
variable[key] assign[=] call[call[call[name[sha1], parameter[call[name[sig].encode, parameter[constant[utf-8]]]]].hexdigest,... | keyword[def] identifier[index_name] ( identifier[table] , identifier[columns] ):
literal[string]
identifier[sig] = literal[string] . identifier[join] ( identifier[columns] )
identifier[key] = identifier[sha1] ( identifier[sig] . identifier[encode] ( literal[string] )). identifier[hexdigest] ()[: liter... | def index_name(table, columns):
"""Generate an artificial index name."""
sig = '||'.join(columns)
key = sha1(sig.encode('utf-8')).hexdigest()[:16]
return 'ix_%s_%s' % (table, key) |
def delete_filter(self, filter_id, params=None):
"""
`<>`_
:arg filter_id: The ID of the filter to delete
"""
if filter_id in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument 'filter_id'.")
return self.transport.perform_request(
... | def function[delete_filter, parameter[self, filter_id, params]]:
constant[
`<>`_
:arg filter_id: The ID of the filter to delete
]
if compare[name[filter_id] in name[SKIP_IN_PATH]] begin[:]
<ast.Raise object at 0x7da1b212f3a0>
return[call[name[self].transport.perform_... | keyword[def] identifier[delete_filter] ( identifier[self] , identifier[filter_id] , identifier[params] = keyword[None] ):
literal[string]
keyword[if] identifier[filter_id] keyword[in] identifier[SKIP_IN_PATH] :
keyword[raise] identifier[ValueError] ( literal[string] )
keyw... | def delete_filter(self, filter_id, params=None):
"""
`<>`_
:arg filter_id: The ID of the filter to delete
"""
if filter_id in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument 'filter_id'.") # depends on [control=['if'], data=[]]
return self.transpo... |
def opaque_sky_cover(self, value=99.0):
"""Corresponds to IDD Field `opaque_sky_cover` This is the value for
opaque sky cover (tenths of coverage). (i.e. 1 is 1/10 covered. 10 is
total coverage). (Amount of sky dome in tenths covered by clouds or
obscuring phenomena that prevent observ... | def function[opaque_sky_cover, parameter[self, value]]:
constant[Corresponds to IDD Field `opaque_sky_cover` This is the value for
opaque sky cover (tenths of coverage). (i.e. 1 is 1/10 covered. 10 is
total coverage). (Amount of sky dome in tenths covered by clouds or
obscuring phenomen... | keyword[def] identifier[opaque_sky_cover] ( identifier[self] , identifier[value] = literal[int] ):
literal[string]
keyword[if] identifier[value] keyword[is] keyword[not] keyword[None] :
keyword[try] :
identifier[value] = identifier[float] ( identifier[value] )
... | def opaque_sky_cover(self, value=99.0):
"""Corresponds to IDD Field `opaque_sky_cover` This is the value for
opaque sky cover (tenths of coverage). (i.e. 1 is 1/10 covered. 10 is
total coverage). (Amount of sky dome in tenths covered by clouds or
obscuring phenomena that prevent observing ... |
def generate_image(self, chars):
"""Generate the image of the given characters.
:param chars: text to be generated.
"""
background = random_color(238, 255)
color = random_color(10, 200, random.randint(220, 255))
im = self.create_captcha_image(chars, color, background)
... | def function[generate_image, parameter[self, chars]]:
constant[Generate the image of the given characters.
:param chars: text to be generated.
]
variable[background] assign[=] call[name[random_color], parameter[constant[238], constant[255]]]
variable[color] assign[=] call[name[r... | keyword[def] identifier[generate_image] ( identifier[self] , identifier[chars] ):
literal[string]
identifier[background] = identifier[random_color] ( literal[int] , literal[int] )
identifier[color] = identifier[random_color] ( literal[int] , literal[int] , identifier[random] . identifier[r... | def generate_image(self, chars):
"""Generate the image of the given characters.
:param chars: text to be generated.
"""
background = random_color(238, 255)
color = random_color(10, 200, random.randint(220, 255))
im = self.create_captcha_image(chars, color, background)
self.create_no... |
def ned2ecef(n: float, e: float, d: float,
lat0: float, lon0: float, h0: float,
ell: Ellipsoid = None, deg: bool = True) -> Tuple[float, float, float]:
"""
North, East, Down to target ECEF coordinates
Parameters
----------
n : float or numpy.ndarray of float
North... | def function[ned2ecef, parameter[n, e, d, lat0, lon0, h0, ell, deg]]:
constant[
North, East, Down to target ECEF coordinates
Parameters
----------
n : float or numpy.ndarray of float
North NED coordinate (meters)
e : float or numpy.ndarray of float
East NED coordinate (mete... | keyword[def] identifier[ned2ecef] ( identifier[n] : identifier[float] , identifier[e] : identifier[float] , identifier[d] : identifier[float] ,
identifier[lat0] : identifier[float] , identifier[lon0] : identifier[float] , identifier[h0] : identifier[float] ,
identifier[ell] : identifier[Ellipsoid] = keyword[None] ,... | def ned2ecef(n: float, e: float, d: float, lat0: float, lon0: float, h0: float, ell: Ellipsoid=None, deg: bool=True) -> Tuple[float, float, float]:
"""
North, East, Down to target ECEF coordinates
Parameters
----------
n : float or numpy.ndarray of float
North NED coordinate (meters)
e... |
def process_object(obj):
"Hook to process the object currently being displayed."
invalid_options = OptsMagic.process_element(obj)
if invalid_options: return invalid_options
OutputMagic.info(obj) | def function[process_object, parameter[obj]]:
constant[Hook to process the object currently being displayed.]
variable[invalid_options] assign[=] call[name[OptsMagic].process_element, parameter[name[obj]]]
if name[invalid_options] begin[:]
return[name[invalid_options]]
call[name[... | keyword[def] identifier[process_object] ( identifier[obj] ):
literal[string]
identifier[invalid_options] = identifier[OptsMagic] . identifier[process_element] ( identifier[obj] )
keyword[if] identifier[invalid_options] : keyword[return] identifier[invalid_options]
identifier[OutputMagic] . ide... | def process_object(obj):
"""Hook to process the object currently being displayed."""
invalid_options = OptsMagic.process_element(obj)
if invalid_options:
return invalid_options # depends on [control=['if'], data=[]]
OutputMagic.info(obj) |
def daterange(start, stop, step=1, inclusive=False):
"""In the spirit of :func:`range` and :func:`xrange`, the `daterange`
generator that yields a sequence of :class:`~datetime.date`
objects, starting at *start*, incrementing by *step*, until *stop*
is reached.
When *inclusive* is True, the final d... | def function[daterange, parameter[start, stop, step, inclusive]]:
constant[In the spirit of :func:`range` and :func:`xrange`, the `daterange`
generator that yields a sequence of :class:`~datetime.date`
objects, starting at *start*, incrementing by *step*, until *stop*
is reached.
When *inclusiv... | keyword[def] identifier[daterange] ( identifier[start] , identifier[stop] , identifier[step] = literal[int] , identifier[inclusive] = keyword[False] ):
literal[string]
keyword[if] keyword[not] identifier[isinstance] ( identifier[start] , identifier[date] ):
keyword[raise] identifier[TypeError] ... | def daterange(start, stop, step=1, inclusive=False):
"""In the spirit of :func:`range` and :func:`xrange`, the `daterange`
generator that yields a sequence of :class:`~datetime.date`
objects, starting at *start*, incrementing by *step*, until *stop*
is reached.
When *inclusive* is True, the final d... |
def get_3q_or_more_nodes(self):
"""Deprecated. Use threeQ_or_more_gates()."""
warnings.warn('The method get_3q_or_more_nodes() is being replaced by'
' threeQ_or_more_gates()',
'Returning a list of (node_id, data) tuples is also deprecated, '
... | def function[get_3q_or_more_nodes, parameter[self]]:
constant[Deprecated. Use threeQ_or_more_gates().]
call[name[warnings].warn, parameter[constant[The method get_3q_or_more_nodes() is being replaced by threeQ_or_more_gates()], constant[Returning a list of (node_id, data) tuples is also deprecated, thre... | keyword[def] identifier[get_3q_or_more_nodes] ( identifier[self] ):
literal[string]
identifier[warnings] . identifier[warn] ( literal[string]
literal[string] ,
literal[string]
literal[string] ,
identifier[DeprecationWarning] , literal[int] )
identifie... | def get_3q_or_more_nodes(self):
"""Deprecated. Use threeQ_or_more_gates()."""
warnings.warn('The method get_3q_or_more_nodes() is being replaced by threeQ_or_more_gates()', 'Returning a list of (node_id, data) tuples is also deprecated, threeQ_or_more_gates() returns a list of DAGNodes.', DeprecationWarning, 2)... |
def remove_element(self, e):
"""Remove element `e` from model
"""
if e.label is not None: self.elementdict.pop(e.label)
self.elementlist.remove(e) | def function[remove_element, parameter[self, e]]:
constant[Remove element `e` from model
]
if compare[name[e].label is_not constant[None]] begin[:]
call[name[self].elementdict.pop, parameter[name[e].label]]
call[name[self].elementlist.remove, parameter[name[e]]] | keyword[def] identifier[remove_element] ( identifier[self] , identifier[e] ):
literal[string]
keyword[if] identifier[e] . identifier[label] keyword[is] keyword[not] keyword[None] : identifier[self] . identifier[elementdict] . identifier[pop] ( identifier[e] . identifier[label] )
ident... | def remove_element(self, e):
"""Remove element `e` from model
"""
if e.label is not None:
self.elementdict.pop(e.label) # depends on [control=['if'], data=[]]
self.elementlist.remove(e) |
def _groups_of_size(iterable, n, fillvalue=None):
"""Collect data into fixed-length chunks or blocks."""
# _groups_of_size('ABCDEFG', 3, 'x') --> ABC DEF Gxx
args = [iter(iterable)] * n
return zip_longest(fillvalue=fillvalue, *args) | def function[_groups_of_size, parameter[iterable, n, fillvalue]]:
constant[Collect data into fixed-length chunks or blocks.]
variable[args] assign[=] binary_operation[list[[<ast.Call object at 0x7da204344490>]] * name[n]]
return[call[name[zip_longest], parameter[<ast.Starred object at 0x7da20c6a8a00... | keyword[def] identifier[_groups_of_size] ( identifier[iterable] , identifier[n] , identifier[fillvalue] = keyword[None] ):
literal[string]
identifier[args] =[ identifier[iter] ( identifier[iterable] )]* identifier[n]
keyword[return] identifier[zip_longest] ( identifier[fillvalue] = identifier[f... | def _groups_of_size(iterable, n, fillvalue=None):
"""Collect data into fixed-length chunks or blocks."""
# _groups_of_size('ABCDEFG', 3, 'x') --> ABC DEF Gxx
args = [iter(iterable)] * n
return zip_longest(*args, fillvalue=fillvalue) |
def _perform_read(self, addr, size):
"""Perform a read using the machine controller."""
return self._machine_controller.read(addr, size, self._x, self._y, 0) | def function[_perform_read, parameter[self, addr, size]]:
constant[Perform a read using the machine controller.]
return[call[name[self]._machine_controller.read, parameter[name[addr], name[size], name[self]._x, name[self]._y, constant[0]]]] | keyword[def] identifier[_perform_read] ( identifier[self] , identifier[addr] , identifier[size] ):
literal[string]
keyword[return] identifier[self] . identifier[_machine_controller] . identifier[read] ( identifier[addr] , identifier[size] , identifier[self] . identifier[_x] , identifier[self] . id... | def _perform_read(self, addr, size):
"""Perform a read using the machine controller."""
return self._machine_controller.read(addr, size, self._x, self._y, 0) |
def _convert_a_header_to_a_h2_header(self, hdr_name, hdr_value, is_sensitive, should_index): # noqa: E501
# type: (str, str, Callable[[str, str], bool], Callable[[str], bool]) -> Tuple[HPackHeaders, int] # noqa: E501
""" _convert_a_header_to_a_h2_header builds a HPackHeaders from a header
name... | def function[_convert_a_header_to_a_h2_header, parameter[self, hdr_name, hdr_value, is_sensitive, should_index]]:
constant[ _convert_a_header_to_a_h2_header builds a HPackHeaders from a header
name and a value. It returns a HPackIndexedHdr whenever possible. If not, # noqa: E501
it returns a HP... | keyword[def] identifier[_convert_a_header_to_a_h2_header] ( identifier[self] , identifier[hdr_name] , identifier[hdr_value] , identifier[is_sensitive] , identifier[should_index] ):
literal[string]
identifier[idx] = identifier[self] . identifier[get_idx_by_name_and_value] ( identifier[hdr... | def _convert_a_header_to_a_h2_header(self, hdr_name, hdr_value, is_sensitive, should_index): # noqa: E501
# type: (str, str, Callable[[str, str], bool], Callable[[str], bool]) -> Tuple[HPackHeaders, int] # noqa: E501
' _convert_a_header_to_a_h2_header builds a HPackHeaders from a header\n name and a va... |
def insertProcessingEra(self, businput):
"""
Input dictionary has to have the following keys:
processing_version, creation_date, create_by, description
it builds the correct dictionary for dao input and executes the dao
"""
conn = self.dbi.connection()
tran = con... | def function[insertProcessingEra, parameter[self, businput]]:
constant[
Input dictionary has to have the following keys:
processing_version, creation_date, create_by, description
it builds the correct dictionary for dao input and executes the dao
]
variable[conn] assign[... | keyword[def] identifier[insertProcessingEra] ( identifier[self] , identifier[businput] ):
literal[string]
identifier[conn] = identifier[self] . identifier[dbi] . identifier[connection] ()
identifier[tran] = identifier[conn] . identifier[begin] ()
keyword[try] :
identi... | def insertProcessingEra(self, businput):
"""
Input dictionary has to have the following keys:
processing_version, creation_date, create_by, description
it builds the correct dictionary for dao input and executes the dao
"""
conn = self.dbi.connection()
tran = conn.begin()
... |
def reporter(self):
""" Parse the results into a report"""
# Initialise variables
combinedrow = ''
reportdirset = set()
# Populate a set of all the report directories to use. A standard analysis will only have a single report
# directory, while pipeline analyses will have... | def function[reporter, parameter[self]]:
constant[ Parse the results into a report]
variable[combinedrow] assign[=] constant[]
variable[reportdirset] assign[=] call[name[set], parameter[]]
for taget[name[sample]] in starred[name[self].metadata] begin[:]
if compare[call[na... | keyword[def] identifier[reporter] ( identifier[self] ):
literal[string]
identifier[combinedrow] = literal[string]
identifier[reportdirset] = identifier[set] ()
keyword[for] identifier[sample] keyword[in] identifier[self] . identifier[metadata] :
... | def reporter(self):
""" Parse the results into a report"""
# Initialise variables
combinedrow = ''
reportdirset = set()
# Populate a set of all the report directories to use. A standard analysis will only have a single report
# directory, while pipeline analyses will have as many report director... |
def deserialize_unix(attr):
"""Serialize Datetime object into IntTime format.
This is represented as seconds.
:param int attr: Object to be serialized.
:rtype: Datetime
:raises: DeserializationError if format invalid
"""
if isinstance(attr, ET.Element):
... | def function[deserialize_unix, parameter[attr]]:
constant[Serialize Datetime object into IntTime format.
This is represented as seconds.
:param int attr: Object to be serialized.
:rtype: Datetime
:raises: DeserializationError if format invalid
]
if call[name[isin... | keyword[def] identifier[deserialize_unix] ( identifier[attr] ):
literal[string]
keyword[if] identifier[isinstance] ( identifier[attr] , identifier[ET] . identifier[Element] ):
identifier[attr] = identifier[int] ( identifier[attr] . identifier[text] )
keyword[try] :
... | def deserialize_unix(attr):
"""Serialize Datetime object into IntTime format.
This is represented as seconds.
:param int attr: Object to be serialized.
:rtype: Datetime
:raises: DeserializationError if format invalid
"""
if isinstance(attr, ET.Element):
attr = in... |
def _si(number):
"""Format a number using base-2 SI prefixes"""
prefixes = ['', 'K', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y']
while number > 1024:
number /= 1024.0
prefixes.pop(0)
return '%0.2f%s' % (number, prefixes.pop(0)) | def function[_si, parameter[number]]:
constant[Format a number using base-2 SI prefixes]
variable[prefixes] assign[=] list[[<ast.Constant object at 0x7da20e9b3c70>, <ast.Constant object at 0x7da20e9b2890>, <ast.Constant object at 0x7da20e9b15d0>, <ast.Constant object at 0x7da20e9b2e60>, <ast.Constant ob... | keyword[def] identifier[_si] ( identifier[number] ):
literal[string]
identifier[prefixes] =[ literal[string] , literal[string] , literal[string] , literal[string] , literal[string] , literal[string] , literal[string] , literal[string] , literal[string] ]
keyword[while] identifier[number] > literal[in... | def _si(number):
"""Format a number using base-2 SI prefixes"""
prefixes = ['', 'K', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y']
while number > 1024:
number /= 1024.0
prefixes.pop(0) # depends on [control=['while'], data=['number']]
return '%0.2f%s' % (number, prefixes.pop(0)) |
def render(dson_input, saltenv='base', sls='', **kwargs):
'''
Accepts DSON data as a string or as a file object and runs it through the
JSON parser.
:rtype: A Python data structure
'''
if not isinstance(dson_input, six.string_types):
dson_input = dson_input.read()
log.debug('DSON i... | def function[render, parameter[dson_input, saltenv, sls]]:
constant[
Accepts DSON data as a string or as a file object and runs it through the
JSON parser.
:rtype: A Python data structure
]
if <ast.UnaryOp object at 0x7da18dc070a0> begin[:]
variable[dson_input] assign[=]... | keyword[def] identifier[render] ( identifier[dson_input] , identifier[saltenv] = literal[string] , identifier[sls] = literal[string] ,** identifier[kwargs] ):
literal[string]
keyword[if] keyword[not] identifier[isinstance] ( identifier[dson_input] , identifier[six] . identifier[string_types] ):
... | def render(dson_input, saltenv='base', sls='', **kwargs):
"""
Accepts DSON data as a string or as a file object and runs it through the
JSON parser.
:rtype: A Python data structure
"""
if not isinstance(dson_input, six.string_types):
dson_input = dson_input.read() # depends on [control... |
def physical_pins(self, function):
"""
Return the physical pins supporting the specified *function* as tuples
of ``(header, pin_number)`` where *header* is a string specifying the
header containing the *pin_number*. Note that the return value is a
:class:`set` which is not indexa... | def function[physical_pins, parameter[self, function]]:
constant[
Return the physical pins supporting the specified *function* as tuples
of ``(header, pin_number)`` where *header* is a string specifying the
header containing the *pin_number*. Note that the return value is a
:clas... | keyword[def] identifier[physical_pins] ( identifier[self] , identifier[function] ):
literal[string]
keyword[return] {
( identifier[header] , identifier[pin] . identifier[number] )
keyword[for] ( identifier[header] , identifier[info] ) keyword[in] identifier[self] . identifier[head... | def physical_pins(self, function):
"""
Return the physical pins supporting the specified *function* as tuples
of ``(header, pin_number)`` where *header* is a string specifying the
header containing the *pin_number*. Note that the return value is a
:class:`set` which is not indexable.... |
def reloaded(name, jboss_config, timeout=60, interval=5):
'''
Reloads configuration of jboss server.
jboss_config:
Dict with connection properties (see state description)
timeout:
Time to wait until jboss is back in running state. Default timeout is 60s.
interval:
Interval b... | def function[reloaded, parameter[name, jboss_config, timeout, interval]]:
constant[
Reloads configuration of jboss server.
jboss_config:
Dict with connection properties (see state description)
timeout:
Time to wait until jboss is back in running state. Default timeout is 60s.
in... | keyword[def] identifier[reloaded] ( identifier[name] , identifier[jboss_config] , identifier[timeout] = literal[int] , identifier[interval] = literal[int] ):
literal[string]
identifier[log] . identifier[debug] ( literal[string] , identifier[name] )
identifier[ret] ={ literal[string] : identifier[name]... | def reloaded(name, jboss_config, timeout=60, interval=5):
"""
Reloads configuration of jboss server.
jboss_config:
Dict with connection properties (see state description)
timeout:
Time to wait until jboss is back in running state. Default timeout is 60s.
interval:
Interval b... |
def _concat_sparse(to_concat, axis=0, typs=None):
"""
provide concatenation of an sparse/dense array of arrays each of which is a
single dtype
Parameters
----------
to_concat : array of arrays
axis : axis to provide concatenation
typs : set of to_concat dtypes
Returns
-------
... | def function[_concat_sparse, parameter[to_concat, axis, typs]]:
constant[
provide concatenation of an sparse/dense array of arrays each of which is a
single dtype
Parameters
----------
to_concat : array of arrays
axis : axis to provide concatenation
typs : set of to_concat dtypes
... | keyword[def] identifier[_concat_sparse] ( identifier[to_concat] , identifier[axis] = literal[int] , identifier[typs] = keyword[None] ):
literal[string]
keyword[from] identifier[pandas] . identifier[core] . identifier[arrays] keyword[import] identifier[SparseArray]
identifier[fill_values] =[ iden... | def _concat_sparse(to_concat, axis=0, typs=None):
"""
provide concatenation of an sparse/dense array of arrays each of which is a
single dtype
Parameters
----------
to_concat : array of arrays
axis : axis to provide concatenation
typs : set of to_concat dtypes
Returns
-------
... |
def get_which_data_ycols(model, which_data_ycols):
"""
Helper to get the data columns to plot.
"""
if which_data_ycols == 'all' or which_data_ycols is None:
return np.arange(model.output_dim)
return which_data_ycols | def function[get_which_data_ycols, parameter[model, which_data_ycols]]:
constant[
Helper to get the data columns to plot.
]
if <ast.BoolOp object at 0x7da1b1cc8640> begin[:]
return[call[name[np].arange, parameter[name[model].output_dim]]]
return[name[which_data_ycols]] | keyword[def] identifier[get_which_data_ycols] ( identifier[model] , identifier[which_data_ycols] ):
literal[string]
keyword[if] identifier[which_data_ycols] == literal[string] keyword[or] identifier[which_data_ycols] keyword[is] keyword[None] :
keyword[return] identifier[np] . identifier[ara... | def get_which_data_ycols(model, which_data_ycols):
"""
Helper to get the data columns to plot.
"""
if which_data_ycols == 'all' or which_data_ycols is None:
return np.arange(model.output_dim) # depends on [control=['if'], data=[]]
return which_data_ycols |
def getcol(self, startrow=0, nrow=-1, rowincr=1):
"""Get the contents of the column or part of it.
(see :func:`table.getcol`)"""
return self._table.getcol(self._column, startrow, nrow, rowincr) | def function[getcol, parameter[self, startrow, nrow, rowincr]]:
constant[Get the contents of the column or part of it.
(see :func:`table.getcol`)]
return[call[name[self]._table.getcol, parameter[name[self]._column, name[startrow], name[nrow], name[rowincr]]]] | keyword[def] identifier[getcol] ( identifier[self] , identifier[startrow] = literal[int] , identifier[nrow] =- literal[int] , identifier[rowincr] = literal[int] ):
literal[string]
keyword[return] identifier[self] . identifier[_table] . identifier[getcol] ( identifier[self] . identifier[_column] , ... | def getcol(self, startrow=0, nrow=-1, rowincr=1):
"""Get the contents of the column or part of it.
(see :func:`table.getcol`)"""
return self._table.getcol(self._column, startrow, nrow, rowincr) |
def from_dict(cls, d):
"""
Decode from a dictionary as from :meth:`to_dict`.
"""
return cls(
d['id'],
d['start'],
d['end'],
Lnk.charspan(d['from'], d['to']) if 'from' in d else None,
# d.get('paths', [1]),
form=d['fo... | def function[from_dict, parameter[cls, d]]:
constant[
Decode from a dictionary as from :meth:`to_dict`.
]
return[call[name[cls], parameter[call[name[d]][constant[id]], call[name[d]][constant[start]], call[name[d]][constant[end]], <ast.IfExp object at 0x7da1b06c8f70>]]] | keyword[def] identifier[from_dict] ( identifier[cls] , identifier[d] ):
literal[string]
keyword[return] identifier[cls] (
identifier[d] [ literal[string] ],
identifier[d] [ literal[string] ],
identifier[d] [ literal[string] ],
identifier[Lnk] . identifier[charsp... | def from_dict(cls, d):
"""
Decode from a dictionary as from :meth:`to_dict`.
"""
# d.get('paths', [1]),
# ipos=
# lrules=
return cls(d['id'], d['start'], d['end'], Lnk.charspan(d['from'], d['to']) if 'from' in d else None, form=d['form'], surface=d.get('surface'), pos=zip(d.get('tags... |
def create(cls, term, *ranges):
"""Instantiate the indexed sum while applying simplification rules"""
if not isinstance(term, Scalar):
term = ScalarValue.create(term)
return super().create(term, *ranges) | def function[create, parameter[cls, term]]:
constant[Instantiate the indexed sum while applying simplification rules]
if <ast.UnaryOp object at 0x7da18c4ce530> begin[:]
variable[term] assign[=] call[name[ScalarValue].create, parameter[name[term]]]
return[call[call[name[super], parame... | keyword[def] identifier[create] ( identifier[cls] , identifier[term] ,* identifier[ranges] ):
literal[string]
keyword[if] keyword[not] identifier[isinstance] ( identifier[term] , identifier[Scalar] ):
identifier[term] = identifier[ScalarValue] . identifier[create] ( identifier[term] ... | def create(cls, term, *ranges):
"""Instantiate the indexed sum while applying simplification rules"""
if not isinstance(term, Scalar):
term = ScalarValue.create(term) # depends on [control=['if'], data=[]]
return super().create(term, *ranges) |
def _list(self):
"""
list function logic, override to implement different logic
returns list and search widget
"""
if get_order_args().get(self.__class__.__name__):
order_column, order_direction = get_order_args().get(
self.__class__.__name__
... | def function[_list, parameter[self]]:
constant[
list function logic, override to implement different logic
returns list and search widget
]
if call[call[name[get_order_args], parameter[]].get, parameter[name[self].__class__.__name__]] begin[:]
<ast.Tuple o... | keyword[def] identifier[_list] ( identifier[self] ):
literal[string]
keyword[if] identifier[get_order_args] (). identifier[get] ( identifier[self] . identifier[__class__] . identifier[__name__] ):
identifier[order_column] , identifier[order_direction] = identifier[get_order_args] (). ... | def _list(self):
"""
list function logic, override to implement different logic
returns list and search widget
"""
if get_order_args().get(self.__class__.__name__):
(order_column, order_direction) = get_order_args().get(self.__class__.__name__) # depends on [control=['if... |
def _schema(self, path, obj, app):
""" fulfill 'name' field for objects under
'#/definitions' and with 'properties'
"""
if path.startswith('#/definitions'):
last_token = jp_split(path)[-1]
if app.version == '1.2':
obj.update_field('name', scope_spl... | def function[_schema, parameter[self, path, obj, app]]:
constant[ fulfill 'name' field for objects under
'#/definitions' and with 'properties'
]
if call[name[path].startswith, parameter[constant[#/definitions]]] begin[:]
variable[last_token] assign[=] call[call[name[jp_sp... | keyword[def] identifier[_schema] ( identifier[self] , identifier[path] , identifier[obj] , identifier[app] ):
literal[string]
keyword[if] identifier[path] . identifier[startswith] ( literal[string] ):
identifier[last_token] = identifier[jp_split] ( identifier[path] )[- literal[int] ]
... | def _schema(self, path, obj, app):
""" fulfill 'name' field for objects under
'#/definitions' and with 'properties'
"""
if path.startswith('#/definitions'):
last_token = jp_split(path)[-1]
if app.version == '1.2':
obj.update_field('name', scope_split(last_token)[-1]) ... |
def H_mag(self, T):
"""
Calculate the phase's magnetic contribution to enthalpy at the
specified temperature.
:param T: [K] temperature
:returns: [J/mol] The magnetic enthalpy of the compound phase.
Dinsdale, A. T. (1991). SGTE data for pure elements. Calphad, 15(4),
... | def function[H_mag, parameter[self, T]]:
constant[
Calculate the phase's magnetic contribution to enthalpy at the
specified temperature.
:param T: [K] temperature
:returns: [J/mol] The magnetic enthalpy of the compound phase.
Dinsdale, A. T. (1991). SGTE data for pure ... | keyword[def] identifier[H_mag] ( identifier[self] , identifier[T] ):
literal[string]
identifier[tau] = identifier[T] / identifier[self] . identifier[Tc_mag]
keyword[if] identifier[tau] <= literal[int] :
identifier[h] =(- identifier[self] . identifier[_A_mag] / identifier[t... | def H_mag(self, T):
"""
Calculate the phase's magnetic contribution to enthalpy at the
specified temperature.
:param T: [K] temperature
:returns: [J/mol] The magnetic enthalpy of the compound phase.
Dinsdale, A. T. (1991). SGTE data for pure elements. Calphad, 15(4),
... |
def build_job_configs(self, args):
"""Hook to build job configurations
"""
job_configs = {}
components = Component.build_from_yamlfile(args['comp'])
datafile = args['data']
if datafile is None or datafile == 'None':
return job_configs
NAME_FACTORY.upd... | def function[build_job_configs, parameter[self, args]]:
constant[Hook to build job configurations
]
variable[job_configs] assign[=] dictionary[[], []]
variable[components] assign[=] call[name[Component].build_from_yamlfile, parameter[call[name[args]][constant[comp]]]]
variable[da... | keyword[def] identifier[build_job_configs] ( identifier[self] , identifier[args] ):
literal[string]
identifier[job_configs] ={}
identifier[components] = identifier[Component] . identifier[build_from_yamlfile] ( identifier[args] [ literal[string] ])
identifier[datafile] = identifi... | def build_job_configs(self, args):
"""Hook to build job configurations
"""
job_configs = {}
components = Component.build_from_yamlfile(args['comp'])
datafile = args['data']
if datafile is None or datafile == 'None':
return job_configs # depends on [control=['if'], data=[]]
NAME_... |
async def stop(wallet_name: str) -> None:
"""
Gracefully stop an external revocation registry builder, waiting for its current.
The indy-sdk toolkit uses a temporary directory for tails file mustration,
and shutting down the toolkit removes the directory, crashing the external
t... | <ast.AsyncFunctionDef object at 0x7da18f811720> | keyword[async] keyword[def] identifier[stop] ( identifier[wallet_name] : identifier[str] )-> keyword[None] :
literal[string]
identifier[LOGGER] . identifier[debug] ( literal[string] )
identifier[dir_sentinel] = identifier[join] ( identifier[RevRegBuilder] . identifier[dir_tails_sentinel... | async def stop(wallet_name: str) -> None:
"""
Gracefully stop an external revocation registry builder, waiting for its current.
The indy-sdk toolkit uses a temporary directory for tails file mustration,
and shutting down the toolkit removes the directory, crashing the external
tails... |
def get_docker_client():
"""Ripped off and slightly modified based on docker-py's
kwargs_from_env utility function."""
env = get_docker_env()
host, cert_path, tls_verify = env['DOCKER_HOST'], env['DOCKER_CERT_PATH'], env['DOCKER_TLS_VERIFY']
params = {'base_url': host.replace('tcp://', 'https://'),... | def function[get_docker_client, parameter[]]:
constant[Ripped off and slightly modified based on docker-py's
kwargs_from_env utility function.]
variable[env] assign[=] call[name[get_docker_env], parameter[]]
<ast.Tuple object at 0x7da18c4cfe20> assign[=] tuple[[<ast.Subscript object at 0x7da... | keyword[def] identifier[get_docker_client] ():
literal[string]
identifier[env] = identifier[get_docker_env] ()
identifier[host] , identifier[cert_path] , identifier[tls_verify] = identifier[env] [ literal[string] ], identifier[env] [ literal[string] ], identifier[env] [ literal[string] ]
identif... | def get_docker_client():
"""Ripped off and slightly modified based on docker-py's
kwargs_from_env utility function."""
env = get_docker_env()
(host, cert_path, tls_verify) = (env['DOCKER_HOST'], env['DOCKER_CERT_PATH'], env['DOCKER_TLS_VERIFY'])
params = {'base_url': host.replace('tcp://', 'https://... |
def _extract_lines(filename, f_globals, line_no, around):
"""
Extracts a block of lines from the given file
:param filename: Name of the source file
:param f_globals: Globals of the frame of the current code
:param line_no: Current line of code
:param around: Number of line to print before and ... | def function[_extract_lines, parameter[filename, f_globals, line_no, around]]:
constant[
Extracts a block of lines from the given file
:param filename: Name of the source file
:param f_globals: Globals of the frame of the current code
:param line_no: Current line of code
:param around: Numb... | keyword[def] identifier[_extract_lines] ( identifier[filename] , identifier[f_globals] , identifier[line_no] , identifier[around] ):
literal[string]
identifier[current_line] = identifier[linecache] . identifier[getline] ( identifier[filename] , identifier[line_no] , identifier[f_globals] )
keyword[if]... | def _extract_lines(filename, f_globals, line_no, around):
"""
Extracts a block of lines from the given file
:param filename: Name of the source file
:param f_globals: Globals of the frame of the current code
:param line_no: Current line of code
:param around: Number of line to print before and ... |
def startLoop(self, useDriverLoop=True):
"""
Starts an event loop to process queued commands and callbacks.
@param useDriverLoop: If True, uses the run loop provided by the driver
(the default). If False, assumes the caller will enter its own
run loop which will pump any... | def function[startLoop, parameter[self, useDriverLoop]]:
constant[
Starts an event loop to process queued commands and callbacks.
@param useDriverLoop: If True, uses the run loop provided by the driver
(the default). If False, assumes the caller will enter its own
run lo... | keyword[def] identifier[startLoop] ( identifier[self] , identifier[useDriverLoop] = keyword[True] ):
literal[string]
keyword[if] identifier[self] . identifier[_inLoop] :
keyword[raise] identifier[RuntimeError] ( literal[string] )
identifier[self] . identifier[_inLoop] = keyw... | def startLoop(self, useDriverLoop=True):
"""
Starts an event loop to process queued commands and callbacks.
@param useDriverLoop: If True, uses the run loop provided by the driver
(the default). If False, assumes the caller will enter its own
run loop which will pump any eve... |
def _add_input_deps(self, executor, args, kwargs):
"""Look for inputs of the app that are remote files. Submit stage_in
apps for such files and replace the file objects in the inputs list with
corresponding DataFuture objects.
Args:
- executor (str) : executor where the app ... | def function[_add_input_deps, parameter[self, executor, args, kwargs]]:
constant[Look for inputs of the app that are remote files. Submit stage_in
apps for such files and replace the file objects in the inputs list with
corresponding DataFuture objects.
Args:
- executor (str... | keyword[def] identifier[_add_input_deps] ( identifier[self] , identifier[executor] , identifier[args] , identifier[kwargs] ):
literal[string]
keyword[if] identifier[executor] == literal[string] :
keyword[return] identifier[args] , identifier[kwargs]
identifier[in... | def _add_input_deps(self, executor, args, kwargs):
"""Look for inputs of the app that are remote files. Submit stage_in
apps for such files and replace the file objects in the inputs list with
corresponding DataFuture objects.
Args:
- executor (str) : executor where the app is g... |
def geometric_partitions(iterable, floor=1, ceiling=32768):
'''
Partition an iterable into chunks. Returns an iterator over partitions.
'''
partition_size = floor
run_length = multiprocessing.cpu_count()
run_count = 0
try:
while True:
#print("partition_size ="... | def function[geometric_partitions, parameter[iterable, floor, ceiling]]:
constant[
Partition an iterable into chunks. Returns an iterator over partitions.
]
variable[partition_size] assign[=] name[floor]
variable[run_length] assign[=] call[name[multiprocessing].cpu_count, parameter[]]
... | keyword[def] identifier[geometric_partitions] ( identifier[iterable] , identifier[floor] = literal[int] , identifier[ceiling] = literal[int] ):
literal[string]
identifier[partition_size] = identifier[floor]
identifier[run_length] = identifier[multiprocessing] . identifier[cpu_count] ()
ident... | def geometric_partitions(iterable, floor=1, ceiling=32768):
"""
Partition an iterable into chunks. Returns an iterator over partitions.
"""
partition_size = floor
run_length = multiprocessing.cpu_count()
run_count = 0
try:
while True: #print("partition_size =", partition_size)
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.