code stringlengths 75 104k | code_sememe stringlengths 47 309k | token_type stringlengths 215 214k | code_dependency stringlengths 75 155k |
|---|---|---|---|
def dm_soundex(word, max_length=6, zero_pad=True):
"""Return the Daitch-Mokotoff Soundex code for a word.
This is a wrapper for :py:meth:`DaitchMokotoff.encode`.
Parameters
----------
word : str
The word to transform
max_length : int
The length of the code returned (defaults to... | def function[dm_soundex, parameter[word, max_length, zero_pad]]:
constant[Return the Daitch-Mokotoff Soundex code for a word.
This is a wrapper for :py:meth:`DaitchMokotoff.encode`.
Parameters
----------
word : str
The word to transform
max_length : int
The length of the co... | keyword[def] identifier[dm_soundex] ( identifier[word] , identifier[max_length] = literal[int] , identifier[zero_pad] = keyword[True] ):
literal[string]
keyword[return] identifier[DaitchMokotoff] (). identifier[encode] ( identifier[word] , identifier[max_length] , identifier[zero_pad] ) | def dm_soundex(word, max_length=6, zero_pad=True):
"""Return the Daitch-Mokotoff Soundex code for a word.
This is a wrapper for :py:meth:`DaitchMokotoff.encode`.
Parameters
----------
word : str
The word to transform
max_length : int
The length of the code returned (defaults to... |
def assumption_list_string(assumptions, assumption_dict):
'''
Takes in a list of short forms of assumptions and an assumption
dictionary, and returns a "list" form of the long form of the
assumptions.
Raises
------
ValueError
if one of the assumptions is not in assumption_dict.
'''
if isinstance(assump... | def function[assumption_list_string, parameter[assumptions, assumption_dict]]:
constant[
Takes in a list of short forms of assumptions and an assumption
dictionary, and returns a "list" form of the long form of the
assumptions.
Raises
------
ValueError
if one of the assumptions is not in assumption_dict.
... | keyword[def] identifier[assumption_list_string] ( identifier[assumptions] , identifier[assumption_dict] ):
literal[string]
keyword[if] identifier[isinstance] ( identifier[assumptions] , identifier[six] . identifier[string_types] ):
keyword[raise] identifier[TypeError] ( literal[string]
... | def assumption_list_string(assumptions, assumption_dict):
"""
Takes in a list of short forms of assumptions and an assumption
dictionary, and returns a "list" form of the long form of the
assumptions.
Raises
------
ValueError
if one of the assumptions is not in assumption_dict.
"""
if isinstance(assump... |
def F_value(ER, EF, dfnum, dfden):
"""
Returns an F-statistic given the following:
ER = error associated with the null hypothesis (the Restricted model)
EF = error associated with the alternate hypothesis (the Full model)
dfR-dfF = degrees of freedom of the numerator
dfF = degrees ... | def function[F_value, parameter[ER, EF, dfnum, dfden]]:
constant[
Returns an F-statistic given the following:
ER = error associated with the null hypothesis (the Restricted model)
EF = error associated with the alternate hypothesis (the Full model)
dfR-dfF = degrees of freedom of the n... | keyword[def] identifier[F_value] ( identifier[ER] , identifier[EF] , identifier[dfnum] , identifier[dfden] ):
literal[string]
keyword[return] (( identifier[ER] - identifier[EF] )/ identifier[float] ( identifier[dfnum] )/( identifier[EF] / identifier[float] ( identifier[dfden] ))) | def F_value(ER, EF, dfnum, dfden):
"""
Returns an F-statistic given the following:
ER = error associated with the null hypothesis (the Restricted model)
EF = error associated with the alternate hypothesis (the Full model)
dfR-dfF = degrees of freedom of the numerator
dfF = degrees ... |
def _uniquify(_list):
"""Remove duplicates in a list."""
seen = set()
result = []
for x in _list:
if x not in seen:
result.append(x)
seen.add(x)
return result | def function[_uniquify, parameter[_list]]:
constant[Remove duplicates in a list.]
variable[seen] assign[=] call[name[set], parameter[]]
variable[result] assign[=] list[[]]
for taget[name[x]] in starred[name[_list]] begin[:]
if compare[name[x] <ast.NotIn object at 0x7da259... | keyword[def] identifier[_uniquify] ( identifier[_list] ):
literal[string]
identifier[seen] = identifier[set] ()
identifier[result] =[]
keyword[for] identifier[x] keyword[in] identifier[_list] :
keyword[if] identifier[x] keyword[not] keyword[in] identifier[seen] :
iden... | def _uniquify(_list):
"""Remove duplicates in a list."""
seen = set()
result = []
for x in _list:
if x not in seen:
result.append(x)
seen.add(x) # depends on [control=['if'], data=['x', 'seen']] # depends on [control=['for'], data=['x']]
return result |
def generichash_blake2b_update(state, data):
"""Update the blake2b hash state
:param state: a initialized Blake2bState object as returned from
:py:func:`.crypto_generichash_blake2b_init`
:type state: :py:class:`.Blake2State`
:param data:
:type data: bytes
"""
ensure(is... | def function[generichash_blake2b_update, parameter[state, data]]:
constant[Update the blake2b hash state
:param state: a initialized Blake2bState object as returned from
:py:func:`.crypto_generichash_blake2b_init`
:type state: :py:class:`.Blake2State`
:param data:
:type dat... | keyword[def] identifier[generichash_blake2b_update] ( identifier[state] , identifier[data] ):
literal[string]
identifier[ensure] ( identifier[isinstance] ( identifier[state] , identifier[Blake2State] ),
literal[string] ,
identifier[raising] = identifier[exc] . identifier[TypeError] )
ident... | def generichash_blake2b_update(state, data):
"""Update the blake2b hash state
:param state: a initialized Blake2bState object as returned from
:py:func:`.crypto_generichash_blake2b_init`
:type state: :py:class:`.Blake2State`
:param data:
:type data: bytes
"""
ensure(isi... |
def split_namespace(clarkName):
"""Return (namespace, localname) tuple for a property name in Clark Notation.
Namespace defaults to ''.
Example:
'{DAV:}foo' -> ('DAV:', 'foo')
'bar' -> ('', 'bar')
"""
if clarkName.startswith("{") and "}" in clarkName:
ns, localname = clarkName.spl... | def function[split_namespace, parameter[clarkName]]:
constant[Return (namespace, localname) tuple for a property name in Clark Notation.
Namespace defaults to ''.
Example:
'{DAV:}foo' -> ('DAV:', 'foo')
'bar' -> ('', 'bar')
]
if <ast.BoolOp object at 0x7da1b0052470> begin[:]
... | keyword[def] identifier[split_namespace] ( identifier[clarkName] ):
literal[string]
keyword[if] identifier[clarkName] . identifier[startswith] ( literal[string] ) keyword[and] literal[string] keyword[in] identifier[clarkName] :
identifier[ns] , identifier[localname] = identifier[clarkName] . i... | def split_namespace(clarkName):
"""Return (namespace, localname) tuple for a property name in Clark Notation.
Namespace defaults to ''.
Example:
'{DAV:}foo' -> ('DAV:', 'foo')
'bar' -> ('', 'bar')
"""
if clarkName.startswith('{') and '}' in clarkName:
(ns, localname) = clarkName.s... |
def attachRequest(PTmsiSignature_presence=0, GprsTimer_presence=0,
TmsiStatus_presence=0):
"""ATTACH REQUEST Section 9.4.1"""
a = TpPd(pd=0x3)
b = MessageType(mesType=0x1) # 0000001
c = MsNetworkCapability()
d = AttachTypeAndCiphKeySeqNr()
f = DrxParameter()
g = MobileId()... | def function[attachRequest, parameter[PTmsiSignature_presence, GprsTimer_presence, TmsiStatus_presence]]:
constant[ATTACH REQUEST Section 9.4.1]
variable[a] assign[=] call[name[TpPd], parameter[]]
variable[b] assign[=] call[name[MessageType], parameter[]]
variable[c] assign[=] call[name[... | keyword[def] identifier[attachRequest] ( identifier[PTmsiSignature_presence] = literal[int] , identifier[GprsTimer_presence] = literal[int] ,
identifier[TmsiStatus_presence] = literal[int] ):
literal[string]
identifier[a] = identifier[TpPd] ( identifier[pd] = literal[int] )
identifier[b] = identifier... | def attachRequest(PTmsiSignature_presence=0, GprsTimer_presence=0, TmsiStatus_presence=0):
"""ATTACH REQUEST Section 9.4.1"""
a = TpPd(pd=3)
b = MessageType(mesType=1) # 0000001
c = MsNetworkCapability()
d = AttachTypeAndCiphKeySeqNr()
f = DrxParameter()
g = MobileId()
h = RoutingAreaId... |
def disable_active_checks(self, checks):
"""Disable active checks for this host/service
Update check in progress with current object information
:param checks: Checks object, to change all checks in progress
:type checks: alignak.objects.check.Checks
:return: None
"""
... | def function[disable_active_checks, parameter[self, checks]]:
constant[Disable active checks for this host/service
Update check in progress with current object information
:param checks: Checks object, to change all checks in progress
:type checks: alignak.objects.check.Checks
:... | keyword[def] identifier[disable_active_checks] ( identifier[self] , identifier[checks] ):
literal[string]
identifier[self] . identifier[active_checks_enabled] = keyword[False]
keyword[for] identifier[chk_id] keyword[in] identifier[self] . identifier[checks_in_progress] :
i... | def disable_active_checks(self, checks):
"""Disable active checks for this host/service
Update check in progress with current object information
:param checks: Checks object, to change all checks in progress
:type checks: alignak.objects.check.Checks
:return: None
"""
se... |
def confd_state_snmp_listen_udp_port(self, **kwargs):
"""Auto Generated Code
"""
config = ET.Element("config")
confd_state = ET.SubElement(config, "confd-state", xmlns="http://tail-f.com/yang/confd-monitoring")
snmp = ET.SubElement(confd_state, "snmp")
listen = ET.SubElem... | def function[confd_state_snmp_listen_udp_port, parameter[self]]:
constant[Auto Generated Code
]
variable[config] assign[=] call[name[ET].Element, parameter[constant[config]]]
variable[confd_state] assign[=] call[name[ET].SubElement, parameter[name[config], constant[confd-state]]]
... | keyword[def] identifier[confd_state_snmp_listen_udp_port] ( identifier[self] ,** identifier[kwargs] ):
literal[string]
identifier[config] = identifier[ET] . identifier[Element] ( literal[string] )
identifier[confd_state] = identifier[ET] . identifier[SubElement] ( identifier[config] , lite... | def confd_state_snmp_listen_udp_port(self, **kwargs):
"""Auto Generated Code
"""
config = ET.Element('config')
confd_state = ET.SubElement(config, 'confd-state', xmlns='http://tail-f.com/yang/confd-monitoring')
snmp = ET.SubElement(confd_state, 'snmp')
listen = ET.SubElement(snmp, 'listen')
... |
def get_timeline(self, auth_secret, max_cnt_tweets):
"""Get the general or user timeline.
If an empty authentication secret is given, this method returns the general timeline.
If an authentication secret is given and it is valid, this method returns the user timeline.
If an authenticati... | def function[get_timeline, parameter[self, auth_secret, max_cnt_tweets]]:
constant[Get the general or user timeline.
If an empty authentication secret is given, this method returns the general timeline.
If an authentication secret is given and it is valid, this method returns the user timeline.... | keyword[def] identifier[get_timeline] ( identifier[self] , identifier[auth_secret] , identifier[max_cnt_tweets] ):
literal[string]
identifier[result] ={ identifier[pytwis_constants] . identifier[ERROR_KEY] : keyword[None] }
keyword[if] identifier[auth_secret] == literal[string] :
... | def get_timeline(self, auth_secret, max_cnt_tweets):
"""Get the general or user timeline.
If an empty authentication secret is given, this method returns the general timeline.
If an authentication secret is given and it is valid, this method returns the user timeline.
If an authentication s... |
def get_dependency_graph(component):
"""
Generate a component's graph of dependencies, which can be passed to
:func:`run` or :func:`run_incremental`.
"""
if component not in DEPENDENCIES:
raise Exception("%s is not a registered component." % get_name(component))
if not DEPENDENCIES[comp... | def function[get_dependency_graph, parameter[component]]:
constant[
Generate a component's graph of dependencies, which can be passed to
:func:`run` or :func:`run_incremental`.
]
if compare[name[component] <ast.NotIn object at 0x7da2590d7190> name[DEPENDENCIES]] begin[:]
<ast.Raise o... | keyword[def] identifier[get_dependency_graph] ( identifier[component] ):
literal[string]
keyword[if] identifier[component] keyword[not] keyword[in] identifier[DEPENDENCIES] :
keyword[raise] identifier[Exception] ( literal[string] % identifier[get_name] ( identifier[component] ))
keyword... | def get_dependency_graph(component):
"""
Generate a component's graph of dependencies, which can be passed to
:func:`run` or :func:`run_incremental`.
"""
if component not in DEPENDENCIES:
raise Exception('%s is not a registered component.' % get_name(component)) # depends on [control=['if']... |
def _safe_write_to_file(self, file, message):
"""
Writes a string to a file safely (with file locks).
"""
target = file
lock_name = make_lock_name(target, self.outfolder)
lock_file = self._make_lock_path(lock_name)
while True:
if os.path.isfile(lock_f... | def function[_safe_write_to_file, parameter[self, file, message]]:
constant[
Writes a string to a file safely (with file locks).
]
variable[target] assign[=] name[file]
variable[lock_name] assign[=] call[name[make_lock_name], parameter[name[target], name[self].outfolder]]
... | keyword[def] identifier[_safe_write_to_file] ( identifier[self] , identifier[file] , identifier[message] ):
literal[string]
identifier[target] = identifier[file]
identifier[lock_name] = identifier[make_lock_name] ( identifier[target] , identifier[self] . identifier[outfolder] )
i... | def _safe_write_to_file(self, file, message):
"""
Writes a string to a file safely (with file locks).
"""
target = file
lock_name = make_lock_name(target, self.outfolder)
lock_file = self._make_lock_path(lock_name)
while True:
if os.path.isfile(lock_file):
self._w... |
def get_instance(self, payload):
"""
Build an instance of WorkflowStatisticsInstance
:param dict payload: Payload response from the API
:returns: twilio.rest.taskrouter.v1.workspace.workflow.workflow_statistics.WorkflowStatisticsInstance
:rtype: twilio.rest.taskrouter.v1.worksp... | def function[get_instance, parameter[self, payload]]:
constant[
Build an instance of WorkflowStatisticsInstance
:param dict payload: Payload response from the API
:returns: twilio.rest.taskrouter.v1.workspace.workflow.workflow_statistics.WorkflowStatisticsInstance
:rtype: twili... | keyword[def] identifier[get_instance] ( identifier[self] , identifier[payload] ):
literal[string]
keyword[return] identifier[WorkflowStatisticsInstance] (
identifier[self] . identifier[_version] ,
identifier[payload] ,
identifier[workspace_sid] = identifier[self] . ident... | def get_instance(self, payload):
"""
Build an instance of WorkflowStatisticsInstance
:param dict payload: Payload response from the API
:returns: twilio.rest.taskrouter.v1.workspace.workflow.workflow_statistics.WorkflowStatisticsInstance
:rtype: twilio.rest.taskrouter.v1.workspace.... |
def is_jail(name):
'''
Return True if jail exists False if not
CLI Example:
.. code-block:: bash
salt '*' poudriere.is_jail <jail name>
'''
jails = list_jails()
for jail in jails:
if jail.split()[0] == name:
return True
return False | def function[is_jail, parameter[name]]:
constant[
Return True if jail exists False if not
CLI Example:
.. code-block:: bash
salt '*' poudriere.is_jail <jail name>
]
variable[jails] assign[=] call[name[list_jails], parameter[]]
for taget[name[jail]] in starred[name[jail... | keyword[def] identifier[is_jail] ( identifier[name] ):
literal[string]
identifier[jails] = identifier[list_jails] ()
keyword[for] identifier[jail] keyword[in] identifier[jails] :
keyword[if] identifier[jail] . identifier[split] ()[ literal[int] ]== identifier[name] :
keyword[... | def is_jail(name):
"""
Return True if jail exists False if not
CLI Example:
.. code-block:: bash
salt '*' poudriere.is_jail <jail name>
"""
jails = list_jails()
for jail in jails:
if jail.split()[0] == name:
return True # depends on [control=['if'], data=[]] ... |
def write_extracted_licenses(lics, out):
"""
Write extracted licenses fields to out.
"""
write_value('LicenseID', lics.identifier, out)
if lics.full_name is not None:
write_value('LicenseName', lics.full_name, out)
if lics.comment is not None:
write_text_value('LicenseComment',... | def function[write_extracted_licenses, parameter[lics, out]]:
constant[
Write extracted licenses fields to out.
]
call[name[write_value], parameter[constant[LicenseID], name[lics].identifier, name[out]]]
if compare[name[lics].full_name is_not constant[None]] begin[:]
call... | keyword[def] identifier[write_extracted_licenses] ( identifier[lics] , identifier[out] ):
literal[string]
identifier[write_value] ( literal[string] , identifier[lics] . identifier[identifier] , identifier[out] )
keyword[if] identifier[lics] . identifier[full_name] keyword[is] keyword[not] keyword... | def write_extracted_licenses(lics, out):
"""
Write extracted licenses fields to out.
"""
write_value('LicenseID', lics.identifier, out)
if lics.full_name is not None:
write_value('LicenseName', lics.full_name, out) # depends on [control=['if'], data=[]]
if lics.comment is not None:
... |
def create_jinja_env(template_path):
"""
Creates a Jinja2 environment with a specific template path.
"""
jinja_env = jinja2.Environment(
loader=jinja2.FileSystemLoader(template_path),
block_start_string='{%',
block_end_string='%}',
variable_start_string='${',
vari... | def function[create_jinja_env, parameter[template_path]]:
constant[
Creates a Jinja2 environment with a specific template path.
]
variable[jinja_env] assign[=] call[name[jinja2].Environment, parameter[]]
call[name[jinja_env].filters][constant[regexreplace]] assign[=] name[regex_replace]
... | keyword[def] identifier[create_jinja_env] ( identifier[template_path] ):
literal[string]
identifier[jinja_env] = identifier[jinja2] . identifier[Environment] (
identifier[loader] = identifier[jinja2] . identifier[FileSystemLoader] ( identifier[template_path] ),
identifier[block_start_string] = li... | def create_jinja_env(template_path):
"""
Creates a Jinja2 environment with a specific template path.
"""
jinja_env = jinja2.Environment(loader=jinja2.FileSystemLoader(template_path), block_start_string='{%', block_end_string='%}', variable_start_string='${', variable_end_string='}', comment_start_string... |
def chunks(seq, chunk_size):
# type: (Sequence[T], int) -> Iterable[Sequence[T]]
""" Split seq into chunk_size-sized chunks.
:param seq: A sequence to chunk.
:param chunk_size: The size of chunk.
"""
return (seq[i:i + chunk_size] for i in range(0, len(seq), chunk_size)) | def function[chunks, parameter[seq, chunk_size]]:
constant[ Split seq into chunk_size-sized chunks.
:param seq: A sequence to chunk.
:param chunk_size: The size of chunk.
]
return[<ast.GeneratorExp object at 0x7da207f028c0>] | keyword[def] identifier[chunks] ( identifier[seq] , identifier[chunk_size] ):
literal[string]
keyword[return] ( identifier[seq] [ identifier[i] : identifier[i] + identifier[chunk_size] ] keyword[for] identifier[i] keyword[in] identifier[range] ( literal[int] , identifier[len] ( identifier[seq] ), ident... | def chunks(seq, chunk_size):
# type: (Sequence[T], int) -> Iterable[Sequence[T]]
' Split seq into chunk_size-sized chunks.\n\n :param seq: A sequence to chunk.\n :param chunk_size: The size of chunk.\n '
return (seq[i:i + chunk_size] for i in range(0, len(seq), chunk_size)) |
def get_unique_id(element):
"""Returns a unique id for a given element"""
this_id = make_id(element)
dup = True
while dup:
if this_id not in ids:
dup = False
ids.append(this_id)
else:
this_id = make_id(element)
return ids[-1] | def function[get_unique_id, parameter[element]]:
constant[Returns a unique id for a given element]
variable[this_id] assign[=] call[name[make_id], parameter[name[element]]]
variable[dup] assign[=] constant[True]
while name[dup] begin[:]
if compare[name[this_id] <ast.NotIn... | keyword[def] identifier[get_unique_id] ( identifier[element] ):
literal[string]
identifier[this_id] = identifier[make_id] ( identifier[element] )
identifier[dup] = keyword[True]
keyword[while] identifier[dup] :
keyword[if] identifier[this_id] keyword[not] keyword[in] identifier[ids... | def get_unique_id(element):
"""Returns a unique id for a given element"""
this_id = make_id(element)
dup = True
while dup:
if this_id not in ids:
dup = False
ids.append(this_id) # depends on [control=['if'], data=['this_id', 'ids']]
else:
this_id = ma... |
def _request_add_dns_record(self, record):
"""Sends Add_DNS_Record request"""
return self._request_internal("Add_DNS_Record",
domain=self.domain,
record=record) | def function[_request_add_dns_record, parameter[self, record]]:
constant[Sends Add_DNS_Record request]
return[call[name[self]._request_internal, parameter[constant[Add_DNS_Record]]]] | keyword[def] identifier[_request_add_dns_record] ( identifier[self] , identifier[record] ):
literal[string]
keyword[return] identifier[self] . identifier[_request_internal] ( literal[string] ,
identifier[domain] = identifier[self] . identifier[domain] ,
identifier[record] = ident... | def _request_add_dns_record(self, record):
"""Sends Add_DNS_Record request"""
return self._request_internal('Add_DNS_Record', domain=self.domain, record=record) |
def apply_and_get_result(self, string):
"""
Perform the substitution represented by this object on string and return
the result.
"""
if self.is_multiline:
compiled_pattern = re.compile(self.pattern, re.MULTILINE)
else:
compiled_pattern = re.compile... | def function[apply_and_get_result, parameter[self, string]]:
constant[
Perform the substitution represented by this object on string and return
the result.
]
if name[self].is_multiline begin[:]
variable[compiled_pattern] assign[=] call[name[re].compile, parameter[... | keyword[def] identifier[apply_and_get_result] ( identifier[self] , identifier[string] ):
literal[string]
keyword[if] identifier[self] . identifier[is_multiline] :
identifier[compiled_pattern] = identifier[re] . identifier[compile] ( identifier[self] . identifier[pattern] , identifier[... | def apply_and_get_result(self, string):
"""
Perform the substitution represented by this object on string and return
the result.
"""
if self.is_multiline:
compiled_pattern = re.compile(self.pattern, re.MULTILINE) # depends on [control=['if'], data=[]]
else:
compiled_... |
def _get_imagesave_wildcards(self):
'return the wildcard string for the filesave dialog'
default_filetype = self.get_default_filetype()
filetypes = self.get_supported_filetypes_grouped()
sorted_filetypes = filetypes.items()
sorted_filetypes.sort()
wildcards = []
e... | def function[_get_imagesave_wildcards, parameter[self]]:
constant[return the wildcard string for the filesave dialog]
variable[default_filetype] assign[=] call[name[self].get_default_filetype, parameter[]]
variable[filetypes] assign[=] call[name[self].get_supported_filetypes_grouped, parameter[]... | keyword[def] identifier[_get_imagesave_wildcards] ( identifier[self] ):
literal[string]
identifier[default_filetype] = identifier[self] . identifier[get_default_filetype] ()
identifier[filetypes] = identifier[self] . identifier[get_supported_filetypes_grouped] ()
identifier[sorted... | def _get_imagesave_wildcards(self):
"""return the wildcard string for the filesave dialog"""
default_filetype = self.get_default_filetype()
filetypes = self.get_supported_filetypes_grouped()
sorted_filetypes = filetypes.items()
sorted_filetypes.sort()
wildcards = []
extensions = []
filte... |
def get_jid(jid):
'''
Return the information returned when the specified job id was executed
'''
serv = _get_serv(ret=None)
ret = {}
for minion, data in six.iteritems(serv.hgetall('ret:{0}'.format(jid))):
if data:
ret[minion] = salt.utils.json.loads(data)
return ret | def function[get_jid, parameter[jid]]:
constant[
Return the information returned when the specified job id was executed
]
variable[serv] assign[=] call[name[_get_serv], parameter[]]
variable[ret] assign[=] dictionary[[], []]
for taget[tuple[[<ast.Name object at 0x7da1b21f3af0>, <... | keyword[def] identifier[get_jid] ( identifier[jid] ):
literal[string]
identifier[serv] = identifier[_get_serv] ( identifier[ret] = keyword[None] )
identifier[ret] ={}
keyword[for] identifier[minion] , identifier[data] keyword[in] identifier[six] . identifier[iteritems] ( identifier[serv] . ide... | def get_jid(jid):
"""
Return the information returned when the specified job id was executed
"""
serv = _get_serv(ret=None)
ret = {}
for (minion, data) in six.iteritems(serv.hgetall('ret:{0}'.format(jid))):
if data:
ret[minion] = salt.utils.json.loads(data) # depends on [con... |
def hash_data(self, hash_input, algorithm="sha2-256", output_format="hex", mount_point=DEFAULT_MOUNT_POINT):
"""Return the cryptographic hash of given data using the specified algorithm.
Supported methods:
POST: /{mount_point}/hash(/{algorithm}). Produces: 200 application/json
:par... | def function[hash_data, parameter[self, hash_input, algorithm, output_format, mount_point]]:
constant[Return the cryptographic hash of given data using the specified algorithm.
Supported methods:
POST: /{mount_point}/hash(/{algorithm}). Produces: 200 application/json
:param hash_in... | keyword[def] identifier[hash_data] ( identifier[self] , identifier[hash_input] , identifier[algorithm] = literal[string] , identifier[output_format] = literal[string] , identifier[mount_point] = identifier[DEFAULT_MOUNT_POINT] ):
literal[string]
keyword[if] identifier[algorithm] keyword[not] key... | def hash_data(self, hash_input, algorithm='sha2-256', output_format='hex', mount_point=DEFAULT_MOUNT_POINT):
"""Return the cryptographic hash of given data using the specified algorithm.
Supported methods:
POST: /{mount_point}/hash(/{algorithm}). Produces: 200 application/json
:param h... |
def asDict(self):
"""Returns a serializable object"""
return {
'isError': self.isError,
'message': self.message,
'values': self.values,
'value': self.value,
} | def function[asDict, parameter[self]]:
constant[Returns a serializable object]
return[dictionary[[<ast.Constant object at 0x7da18dc058d0>, <ast.Constant object at 0x7da18dc066b0>, <ast.Constant object at 0x7da18dc07580>, <ast.Constant object at 0x7da18dc06020>], [<ast.Attribute object at 0x7da18dc05630>, <a... | keyword[def] identifier[asDict] ( identifier[self] ):
literal[string]
keyword[return] {
literal[string] : identifier[self] . identifier[isError] ,
literal[string] : identifier[self] . identifier[message] ,
literal[string] : identifier[self] . identifier[values] ,
... | def asDict(self):
"""Returns a serializable object"""
return {'isError': self.isError, 'message': self.message, 'values': self.values, 'value': self.value} |
def is_unclaimed(work):
"""Returns True if work piece is unclaimed."""
if work['is_completed']:
return False
cutoff_time = time.time() - MAX_PROCESSING_TIME
if (work['claimed_worker_id'] and
work['claimed_worker_start_time'] is not None
and work['claimed_worker_start_time'] >= cutoff_time):
... | def function[is_unclaimed, parameter[work]]:
constant[Returns True if work piece is unclaimed.]
if call[name[work]][constant[is_completed]] begin[:]
return[constant[False]]
variable[cutoff_time] assign[=] binary_operation[call[name[time].time, parameter[]] - name[MAX_PROCESSING_TIME]]
... | keyword[def] identifier[is_unclaimed] ( identifier[work] ):
literal[string]
keyword[if] identifier[work] [ literal[string] ]:
keyword[return] keyword[False]
identifier[cutoff_time] = identifier[time] . identifier[time] ()- identifier[MAX_PROCESSING_TIME]
keyword[if] ( identifier[work] [ literal[... | def is_unclaimed(work):
"""Returns True if work piece is unclaimed."""
if work['is_completed']:
return False # depends on [control=['if'], data=[]]
cutoff_time = time.time() - MAX_PROCESSING_TIME
if work['claimed_worker_id'] and work['claimed_worker_start_time'] is not None and (work['claimed_w... |
def cleanup_properties(rdf):
"""Remove unnecessary property definitions.
Reemoves SKOS and DC property definitions and definitions of unused
properties."""
for t in (RDF.Property, OWL.DatatypeProperty, OWL.ObjectProperty,
OWL.SymmetricProperty, OWL.TransitiveProperty,
OWL.In... | def function[cleanup_properties, parameter[rdf]]:
constant[Remove unnecessary property definitions.
Reemoves SKOS and DC property definitions and definitions of unused
properties.]
for taget[name[t]] in starred[tuple[[<ast.Attribute object at 0x7da1b0400700>, <ast.Attribute object at 0x7da1b040... | keyword[def] identifier[cleanup_properties] ( identifier[rdf] ):
literal[string]
keyword[for] identifier[t] keyword[in] ( identifier[RDF] . identifier[Property] , identifier[OWL] . identifier[DatatypeProperty] , identifier[OWL] . identifier[ObjectProperty] ,
identifier[OWL] . identifier[SymmetricPro... | def cleanup_properties(rdf):
"""Remove unnecessary property definitions.
Reemoves SKOS and DC property definitions and definitions of unused
properties."""
for t in (RDF.Property, OWL.DatatypeProperty, OWL.ObjectProperty, OWL.SymmetricProperty, OWL.TransitiveProperty, OWL.InverseFunctionalProperty, OWL... |
def get_edef_props(
object_class,
exported_cfgs,
ep_namespace,
ep_id,
ecf_ep_id,
ep_rsvc_id,
ep_ts,
remote_intents=None,
fw_id=None,
pkg_ver=None,
service_intents=None,
):
"""
Prepares the EDEF properties of an endpoint, merge of RSA and ECF
properties
"""
... | def function[get_edef_props, parameter[object_class, exported_cfgs, ep_namespace, ep_id, ecf_ep_id, ep_rsvc_id, ep_ts, remote_intents, fw_id, pkg_ver, service_intents]]:
constant[
Prepares the EDEF properties of an endpoint, merge of RSA and ECF
properties
]
variable[osgi_props] assign[=] ca... | keyword[def] identifier[get_edef_props] (
identifier[object_class] ,
identifier[exported_cfgs] ,
identifier[ep_namespace] ,
identifier[ep_id] ,
identifier[ecf_ep_id] ,
identifier[ep_rsvc_id] ,
identifier[ep_ts] ,
identifier[remote_intents] = keyword[None] ,
identifier[fw_id] = keyword[None] ,
identifier[pkg... | def get_edef_props(object_class, exported_cfgs, ep_namespace, ep_id, ecf_ep_id, ep_rsvc_id, ep_ts, remote_intents=None, fw_id=None, pkg_ver=None, service_intents=None):
"""
Prepares the EDEF properties of an endpoint, merge of RSA and ECF
properties
"""
osgi_props = get_rsa_props(object_class, expor... |
def install(ctx, integrations, delete_after_install=False):
"""Install a honeycomb integration from the online library, local path or zipfile."""
logger.debug("running command %s (%s)", ctx.command.name, ctx.params,
extra={"command": ctx.command.name, "params": ctx.params})
home = ctx.obj[... | def function[install, parameter[ctx, integrations, delete_after_install]]:
constant[Install a honeycomb integration from the online library, local path or zipfile.]
call[name[logger].debug, parameter[constant[running command %s (%s)], name[ctx].command.name, name[ctx].params]]
variable[home] ass... | keyword[def] identifier[install] ( identifier[ctx] , identifier[integrations] , identifier[delete_after_install] = keyword[False] ):
literal[string]
identifier[logger] . identifier[debug] ( literal[string] , identifier[ctx] . identifier[command] . identifier[name] , identifier[ctx] . identifier[params] ,
... | def install(ctx, integrations, delete_after_install=False):
"""Install a honeycomb integration from the online library, local path or zipfile."""
logger.debug('running command %s (%s)', ctx.command.name, ctx.params, extra={'command': ctx.command.name, 'params': ctx.params})
home = ctx.obj['HOME']
integr... |
def normalize(self, bias_range=1, quadratic_range=None,
ignored_variables=None, ignored_interactions=None,
ignore_offset=False):
"""Normalizes the biases of the binary quadratic model such that they
fall in the provided range(s), and adjusts the offset appropriately.
... | def function[normalize, parameter[self, bias_range, quadratic_range, ignored_variables, ignored_interactions, ignore_offset]]:
constant[Normalizes the biases of the binary quadratic model such that they
fall in the provided range(s), and adjusts the offset appropriately.
If `quadratic_range` is... | keyword[def] identifier[normalize] ( identifier[self] , identifier[bias_range] = literal[int] , identifier[quadratic_range] = keyword[None] ,
identifier[ignored_variables] = keyword[None] , identifier[ignored_interactions] = keyword[None] ,
identifier[ignore_offset] = keyword[False] ):
literal[string]
... | def normalize(self, bias_range=1, quadratic_range=None, ignored_variables=None, ignored_interactions=None, ignore_offset=False):
"""Normalizes the biases of the binary quadratic model such that they
fall in the provided range(s), and adjusts the offset appropriately.
If `quadratic_range` is provide... |
def collect_dashboard_js(collector):
"""Generate dashboard javascript for each dashboard"""
dashmat = collector.configuration["dashmat"]
modules = collector.configuration["__active_modules__"]
compiled_static_prep = dashmat.compiled_static_prep
compiled_static_folder = dashmat.compiled_static_folde... | def function[collect_dashboard_js, parameter[collector]]:
constant[Generate dashboard javascript for each dashboard]
variable[dashmat] assign[=] call[name[collector].configuration][constant[dashmat]]
variable[modules] assign[=] call[name[collector].configuration][constant[__active_modules__]]
... | keyword[def] identifier[collect_dashboard_js] ( identifier[collector] ):
literal[string]
identifier[dashmat] = identifier[collector] . identifier[configuration] [ literal[string] ]
identifier[modules] = identifier[collector] . identifier[configuration] [ literal[string] ]
identifier[compiled_sta... | def collect_dashboard_js(collector):
"""Generate dashboard javascript for each dashboard"""
dashmat = collector.configuration['dashmat']
modules = collector.configuration['__active_modules__']
compiled_static_prep = dashmat.compiled_static_prep
compiled_static_folder = dashmat.compiled_static_folder... |
def update(self, ttl=values.unset):
"""
Update the SyncStreamInstance
:param unicode ttl: Stream TTL.
:returns: Updated SyncStreamInstance
:rtype: twilio.rest.sync.v1.service.sync_stream.SyncStreamInstance
"""
return self._proxy.update(ttl=ttl, ) | def function[update, parameter[self, ttl]]:
constant[
Update the SyncStreamInstance
:param unicode ttl: Stream TTL.
:returns: Updated SyncStreamInstance
:rtype: twilio.rest.sync.v1.service.sync_stream.SyncStreamInstance
]
return[call[name[self]._proxy.update, parame... | keyword[def] identifier[update] ( identifier[self] , identifier[ttl] = identifier[values] . identifier[unset] ):
literal[string]
keyword[return] identifier[self] . identifier[_proxy] . identifier[update] ( identifier[ttl] = identifier[ttl] ,) | def update(self, ttl=values.unset):
"""
Update the SyncStreamInstance
:param unicode ttl: Stream TTL.
:returns: Updated SyncStreamInstance
:rtype: twilio.rest.sync.v1.service.sync_stream.SyncStreamInstance
"""
return self._proxy.update(ttl=ttl) |
def p_propertyDeclaration_8(p):
# pylint: disable=line-too-long
"""propertyDeclaration_8 : qualifierList dataType propertyName array defaultValue ';'""" # noqa: E501
quals = OrderedDict([(x.name, x) for x in p[1]])
p[0] = CIMProperty(p[3], cimvalue(p[5], p[2]),
type=p[2], qualifi... | def function[p_propertyDeclaration_8, parameter[p]]:
constant[propertyDeclaration_8 : qualifierList dataType propertyName array defaultValue ';']
variable[quals] assign[=] call[name[OrderedDict], parameter[<ast.ListComp object at 0x7da18f00eb30>]]
call[name[p]][constant[0]] assign[=] call[name[C... | keyword[def] identifier[p_propertyDeclaration_8] ( identifier[p] ):
literal[string]
identifier[quals] = identifier[OrderedDict] ([( identifier[x] . identifier[name] , identifier[x] ) keyword[for] identifier[x] keyword[in] identifier[p] [ literal[int] ]])
identifier[p] [ literal[int] ]= identifier[... | def p_propertyDeclaration_8(p):
# pylint: disable=line-too-long
"propertyDeclaration_8 : qualifierList dataType propertyName array defaultValue ';'" # noqa: E501
quals = OrderedDict([(x.name, x) for x in p[1]])
p[0] = CIMProperty(p[3], cimvalue(p[5], p[2]), type=p[2], qualifiers=quals, is_array=True, a... |
def compute_steadystate(self, nnc=2):
"""
Computes the non-stochastic steady-state of the economy.
Parameters
----------
nnc : array_like(float)
nnc is the location of the constant in the state vector x_t
"""
zx = np.eye(self.A0.shape[0])-self.A0
... | def function[compute_steadystate, parameter[self, nnc]]:
constant[
Computes the non-stochastic steady-state of the economy.
Parameters
----------
nnc : array_like(float)
nnc is the location of the constant in the state vector x_t
]
variable[zx] assig... | keyword[def] identifier[compute_steadystate] ( identifier[self] , identifier[nnc] = literal[int] ):
literal[string]
identifier[zx] = identifier[np] . identifier[eye] ( identifier[self] . identifier[A0] . identifier[shape] [ literal[int] ])- identifier[self] . identifier[A0]
identifier[sel... | def compute_steadystate(self, nnc=2):
"""
Computes the non-stochastic steady-state of the economy.
Parameters
----------
nnc : array_like(float)
nnc is the location of the constant in the state vector x_t
"""
zx = np.eye(self.A0.shape[0]) - self.A0
self.... |
def enter_plane(self, plane):
"""Enter the device plane.
Enter the device plane a.k.a. mode, i.e. admin, qnx, calvados
"""
try:
cmd = CONF['driver'][self.platform]['planes'][plane]
self.plane = plane
except KeyError:
cmd = None
if cmd... | def function[enter_plane, parameter[self, plane]]:
constant[Enter the device plane.
Enter the device plane a.k.a. mode, i.e. admin, qnx, calvados
]
<ast.Try object at 0x7da1b259fbe0>
if name[cmd] begin[:]
call[name[self].log, parameter[call[constant[Entering the {} p... | keyword[def] identifier[enter_plane] ( identifier[self] , identifier[plane] ):
literal[string]
keyword[try] :
identifier[cmd] = identifier[CONF] [ literal[string] ][ identifier[self] . identifier[platform] ][ literal[string] ][ identifier[plane] ]
identifier[self] . identi... | def enter_plane(self, plane):
"""Enter the device plane.
Enter the device plane a.k.a. mode, i.e. admin, qnx, calvados
"""
try:
cmd = CONF['driver'][self.platform]['planes'][plane]
self.plane = plane # depends on [control=['try'], data=[]]
except KeyError:
cmd = Non... |
def host(self, hostname=None):
"""Get or set host (IPv4/IPv6 or hostname like 'plc.domain.net')
:param hostname: hostname or IPv4/IPv6 address or None for get value
:type hostname: str or None
:returns: hostname or None if set fail
:rtype: str or None
"""
if (hos... | def function[host, parameter[self, hostname]]:
constant[Get or set host (IPv4/IPv6 or hostname like 'plc.domain.net')
:param hostname: hostname or IPv4/IPv6 address or None for get value
:type hostname: str or None
:returns: hostname or None if set fail
:rtype: str or None
... | keyword[def] identifier[host] ( identifier[self] , identifier[hostname] = keyword[None] ):
literal[string]
keyword[if] ( identifier[hostname] keyword[is] keyword[None] ) keyword[or] ( identifier[hostname] == identifier[self] . identifier[__hostname] ):
keyword[return] identifier[sel... | def host(self, hostname=None):
"""Get or set host (IPv4/IPv6 or hostname like 'plc.domain.net')
:param hostname: hostname or IPv4/IPv6 address or None for get value
:type hostname: str or None
:returns: hostname or None if set fail
:rtype: str or None
"""
if hostname is ... |
def parse_error(self, response):
"Parse an error response"
error_code = response.split(' ')[0]
if error_code in self.EXCEPTION_CLASSES:
response = response[len(error_code) + 1:]
exception_class = self.EXCEPTION_CLASSES[error_code]
if isinstance(exception_class... | def function[parse_error, parameter[self, response]]:
constant[Parse an error response]
variable[error_code] assign[=] call[call[name[response].split, parameter[constant[ ]]]][constant[0]]
if compare[name[error_code] in name[self].EXCEPTION_CLASSES] begin[:]
variable[response] as... | keyword[def] identifier[parse_error] ( identifier[self] , identifier[response] ):
literal[string]
identifier[error_code] = identifier[response] . identifier[split] ( literal[string] )[ literal[int] ]
keyword[if] identifier[error_code] keyword[in] identifier[self] . identifier[EXCEPTION_... | def parse_error(self, response):
"""Parse an error response"""
error_code = response.split(' ')[0]
if error_code in self.EXCEPTION_CLASSES:
response = response[len(error_code) + 1:]
exception_class = self.EXCEPTION_CLASSES[error_code]
if isinstance(exception_class, dict):
... |
def provider_parser(subparser):
"""Specify arguments for AWS Route 53 Lexicon Provider."""
subparser.add_argument("--auth-access-key",
help="specify ACCESS_KEY for authentication")
subparser.add_argument("--auth-access-secret",
help="specify ACCESS_SECRE... | def function[provider_parser, parameter[subparser]]:
constant[Specify arguments for AWS Route 53 Lexicon Provider.]
call[name[subparser].add_argument, parameter[constant[--auth-access-key]]]
call[name[subparser].add_argument, parameter[constant[--auth-access-secret]]]
call[name[subparser... | keyword[def] identifier[provider_parser] ( identifier[subparser] ):
literal[string]
identifier[subparser] . identifier[add_argument] ( literal[string] ,
identifier[help] = literal[string] )
identifier[subparser] . identifier[add_argument] ( literal[string] ,
identifier[help] = literal[string... | def provider_parser(subparser):
"""Specify arguments for AWS Route 53 Lexicon Provider."""
subparser.add_argument('--auth-access-key', help='specify ACCESS_KEY for authentication')
subparser.add_argument('--auth-access-secret', help='specify ACCESS_SECRET for authentication')
subparser.add_argument('--p... |
def getmergerequests(self, project_id, page=1, per_page=20, state=None):
"""
Get all the merge requests for a project.
:param project_id: ID of the project to retrieve merge requests for
:param page: Page Number
:param per_page: Records per page
:param state: Passes merg... | def function[getmergerequests, parameter[self, project_id, page, per_page, state]]:
constant[
Get all the merge requests for a project.
:param project_id: ID of the project to retrieve merge requests for
:param page: Page Number
:param per_page: Records per page
:param s... | keyword[def] identifier[getmergerequests] ( identifier[self] , identifier[project_id] , identifier[page] = literal[int] , identifier[per_page] = literal[int] , identifier[state] = keyword[None] ):
literal[string]
identifier[data] ={ literal[string] : identifier[page] , literal[string] : identifier[... | def getmergerequests(self, project_id, page=1, per_page=20, state=None):
"""
Get all the merge requests for a project.
:param project_id: ID of the project to retrieve merge requests for
:param page: Page Number
:param per_page: Records per page
:param state: Passes merge re... |
def generate_module_content(self, module):
"""Generate module.rst text content.
::
{{ module_name }}
=================
.. automodule:: {{ module_fullname }}
:members:
"""
if isinstance(module, Module):
return module.rende... | def function[generate_module_content, parameter[self, module]]:
constant[Generate module.rst text content.
::
{{ module_name }}
=================
.. automodule:: {{ module_fullname }}
:members:
]
if call[name[isinstance], parameter[n... | keyword[def] identifier[generate_module_content] ( identifier[self] , identifier[module] ):
literal[string]
keyword[if] identifier[isinstance] ( identifier[module] , identifier[Module] ):
keyword[return] identifier[module] . identifier[render] ()
keyword[else] :
... | def generate_module_content(self, module):
"""Generate module.rst text content.
::
{{ module_name }}
=================
.. automodule:: {{ module_fullname }}
:members:
"""
if isinstance(module, Module):
return module.render() # depen... |
def get_func(func_ea):
"""get_func(func_t or ea) -> func_t
Take an IDA function (``idaapi.func_t``) or an address (EA) and return
an IDA function object.
Use this when APIs can take either a function or an address.
Args:
func_ea: ``idaapi.func_t`` or ea of the function.
Returns:
... | def function[get_func, parameter[func_ea]]:
constant[get_func(func_t or ea) -> func_t
Take an IDA function (``idaapi.func_t``) or an address (EA) and return
an IDA function object.
Use this when APIs can take either a function or an address.
Args:
func_ea: ``idaapi.func_t`` or ea of t... | keyword[def] identifier[get_func] ( identifier[func_ea] ):
literal[string]
keyword[if] identifier[isinstance] ( identifier[func_ea] , identifier[idaapi] . identifier[func_t] ):
keyword[return] identifier[func_ea]
identifier[func] = identifier[idaapi] . identifier[get_func] ( identifier[fun... | def get_func(func_ea):
"""get_func(func_t or ea) -> func_t
Take an IDA function (``idaapi.func_t``) or an address (EA) and return
an IDA function object.
Use this when APIs can take either a function or an address.
Args:
func_ea: ``idaapi.func_t`` or ea of the function.
Returns:
... |
def time_at_elevation(self, elevation, direction=SUN_RISING, date=None, local=True):
"""Calculate the time when the sun is at the specified elevation.
Note:
This method uses positive elevations for those above the horizon.
Elevations greater than 90 degrees are converted to a s... | def function[time_at_elevation, parameter[self, elevation, direction, date, local]]:
constant[Calculate the time when the sun is at the specified elevation.
Note:
This method uses positive elevations for those above the horizon.
Elevations greater than 90 degrees are converted ... | keyword[def] identifier[time_at_elevation] ( identifier[self] , identifier[elevation] , identifier[direction] = identifier[SUN_RISING] , identifier[date] = keyword[None] , identifier[local] = keyword[True] ):
literal[string]
keyword[if] identifier[local] keyword[and] identifier[self] . identifi... | def time_at_elevation(self, elevation, direction=SUN_RISING, date=None, local=True):
"""Calculate the time when the sun is at the specified elevation.
Note:
This method uses positive elevations for those above the horizon.
Elevations greater than 90 degrees are converted to a setti... |
def update(self):
'''
Updates the non-primitive objects needed for solution, using primitive
attributes. This includes defining a "utility from conformity" function
conformUtilityFunc, a grid of population punk proportions, and an array
of future punk proportions (for each value... | def function[update, parameter[self]]:
constant[
Updates the non-primitive objects needed for solution, using primitive
attributes. This includes defining a "utility from conformity" function
conformUtilityFunc, a grid of population punk proportions, and an array
of future punk ... | keyword[def] identifier[update] ( identifier[self] ):
literal[string]
identifier[self] . identifier[conformUtilityFunc] = keyword[lambda] identifier[x] : identifier[stats] . identifier[beta] . identifier[pdf] ( identifier[x] , identifier[self] . identifier[uParamA] , identifier[self] . identifier[... | def update(self):
"""
Updates the non-primitive objects needed for solution, using primitive
attributes. This includes defining a "utility from conformity" function
conformUtilityFunc, a grid of population punk proportions, and an array
of future punk proportions (for each value in ... |
def read(self):
''' Read tagged doc from mutliple files (sents, tokens, concepts, links, tags) '''
warnings.warn("Document.read() is deprecated and will be removed in near future.", DeprecationWarning)
with TxtReader.from_doc(self) as reader:
reader.read(self)
return self | def function[read, parameter[self]]:
constant[ Read tagged doc from mutliple files (sents, tokens, concepts, links, tags) ]
call[name[warnings].warn, parameter[constant[Document.read() is deprecated and will be removed in near future.], name[DeprecationWarning]]]
with call[name[TxtReader].from_d... | keyword[def] identifier[read] ( identifier[self] ):
literal[string]
identifier[warnings] . identifier[warn] ( literal[string] , identifier[DeprecationWarning] )
keyword[with] identifier[TxtReader] . identifier[from_doc] ( identifier[self] ) keyword[as] identifier[reader] :
i... | def read(self):
""" Read tagged doc from mutliple files (sents, tokens, concepts, links, tags) """
warnings.warn('Document.read() is deprecated and will be removed in near future.', DeprecationWarning)
with TxtReader.from_doc(self) as reader:
reader.read(self) # depends on [control=['with'], data=[... |
def log_request_end_send(self, target_system, target_component, force_mavlink1=False):
'''
Stop log transfer and resume normal logging
target_system : System ID (uint8_t)
target_component : Component ID (uint8_t)
'''
... | def function[log_request_end_send, parameter[self, target_system, target_component, force_mavlink1]]:
constant[
Stop log transfer and resume normal logging
target_system : System ID (uint8_t)
target_component : Component ID (uint8_t)
... | keyword[def] identifier[log_request_end_send] ( identifier[self] , identifier[target_system] , identifier[target_component] , identifier[force_mavlink1] = keyword[False] ):
literal[string]
keyword[return] identifier[self] . identifier[send] ( identifier[self] . identifier[log_reque... | def log_request_end_send(self, target_system, target_component, force_mavlink1=False):
"""
Stop log transfer and resume normal logging
target_system : System ID (uint8_t)
target_component : Component ID (uint8_t)
"""
return s... |
def squash_children(self, options):
"""
reduces the memory footprint of this super-change by converting
all child changes into squashed changes
"""
oldsubs = self.collect()
self.changes = tuple(squash(c, options=options) for c in oldsubs)
for change in oldsubs:
... | def function[squash_children, parameter[self, options]]:
constant[
reduces the memory footprint of this super-change by converting
all child changes into squashed changes
]
variable[oldsubs] assign[=] call[name[self].collect, parameter[]]
name[self].changes assign[=] call... | keyword[def] identifier[squash_children] ( identifier[self] , identifier[options] ):
literal[string]
identifier[oldsubs] = identifier[self] . identifier[collect] ()
identifier[self] . identifier[changes] = identifier[tuple] ( identifier[squash] ( identifier[c] , identifier[options] = iden... | def squash_children(self, options):
"""
reduces the memory footprint of this super-change by converting
all child changes into squashed changes
"""
oldsubs = self.collect()
self.changes = tuple((squash(c, options=options) for c in oldsubs))
for change in oldsubs:
change.c... |
def certificate(args):
"""
%prog certificate tpffile certificatefile
Generate certificate file for all overlaps in tpffile. tpffile can be
generated by jcvi.formats.agp.tpf().
North chr1 2 0 AC229737.8 telomere 58443
South chr1 2 1 AC229737.8 AC202463.29 58443 37835 58443 + N... | def function[certificate, parameter[args]]:
constant[
%prog certificate tpffile certificatefile
Generate certificate file for all overlaps in tpffile. tpffile can be
generated by jcvi.formats.agp.tpf().
North chr1 2 0 AC229737.8 telomere 58443
South chr1 2 1 AC229737.8 AC2024... | keyword[def] identifier[certificate] ( identifier[args] ):
literal[string]
identifier[p] = identifier[OptionParser] ( identifier[certificate] . identifier[__doc__] )
identifier[opts] , identifier[args] = identifier[p] . identifier[parse_args] ( identifier[args] )
keyword[if] identifier[len] ( i... | def certificate(args):
"""
%prog certificate tpffile certificatefile
Generate certificate file for all overlaps in tpffile. tpffile can be
generated by jcvi.formats.agp.tpf().
North chr1 2 0 AC229737.8 telomere 58443
South chr1 2 1 AC229737.8 AC202463.29 58443 37835 58443 + N... |
def decrypt_verify(encrypted, session_keys=None):
"""Decrypts the given ciphertext string and returns both the
signatures (if any) and the plaintext.
:param bytes encrypted: the mail to decrypt
:param list[str] session_keys: a list OpenPGP session keys
:returns: the signatures and decrypted plainte... | def function[decrypt_verify, parameter[encrypted, session_keys]]:
constant[Decrypts the given ciphertext string and returns both the
signatures (if any) and the plaintext.
:param bytes encrypted: the mail to decrypt
:param list[str] session_keys: a list OpenPGP session keys
:returns: the signat... | keyword[def] identifier[decrypt_verify] ( identifier[encrypted] , identifier[session_keys] = keyword[None] ):
literal[string]
keyword[if] identifier[session_keys] keyword[is] keyword[not] keyword[None] :
keyword[try] :
keyword[return] identifier[_decrypt_verify_session_keys] ( id... | def decrypt_verify(encrypted, session_keys=None):
"""Decrypts the given ciphertext string and returns both the
signatures (if any) and the plaintext.
:param bytes encrypted: the mail to decrypt
:param list[str] session_keys: a list OpenPGP session keys
:returns: the signatures and decrypted plainte... |
def getEntropies(m):
"""
Recursively get the current and max entropies from every child module
:param m: any module
:return: (currentEntropy, maxEntropy)
"""
entropy = 0.0
max_entropy = 0.0
for module in m.children():
e, m = getEntropies(module)
entropy += e
max_entropy += m
e, m = getE... | def function[getEntropies, parameter[m]]:
constant[
Recursively get the current and max entropies from every child module
:param m: any module
:return: (currentEntropy, maxEntropy)
]
variable[entropy] assign[=] constant[0.0]
variable[max_entropy] assign[=] constant[0.0]
for tag... | keyword[def] identifier[getEntropies] ( identifier[m] ):
literal[string]
identifier[entropy] = literal[int]
identifier[max_entropy] = literal[int]
keyword[for] identifier[module] keyword[in] identifier[m] . identifier[children] ():
identifier[e] , identifier[m] = identifier[getEntropies] ( iden... | def getEntropies(m):
"""
Recursively get the current and max entropies from every child module
:param m: any module
:return: (currentEntropy, maxEntropy)
"""
entropy = 0.0
max_entropy = 0.0
for module in m.children():
(e, m) = getEntropies(module)
entropy += e
max_entro... |
def init_plugins():
"""Return dictionary of available plugins
Returns
-------
plugins : dictionary
key is plugin name, value Plugin object
"""
find_plugins()
d = {}
for c in Plugin.__subclasses__():
ins = c()
if ins.name() in config.get("plugin", []):
... | def function[init_plugins, parameter[]]:
constant[Return dictionary of available plugins
Returns
-------
plugins : dictionary
key is plugin name, value Plugin object
]
call[name[find_plugins], parameter[]]
variable[d] assign[=] dictionary[[], []]
for taget[name[c... | keyword[def] identifier[init_plugins] ():
literal[string]
identifier[find_plugins] ()
identifier[d] ={}
keyword[for] identifier[c] keyword[in] identifier[Plugin] . identifier[__subclasses__] ():
identifier[ins] = identifier[c] ()
keyword[if] identifier[ins] . identifier[nam... | def init_plugins():
"""Return dictionary of available plugins
Returns
-------
plugins : dictionary
key is plugin name, value Plugin object
"""
find_plugins()
d = {}
for c in Plugin.__subclasses__():
ins = c()
if ins.name() in config.get('plugin', []):
... |
def save_sentences(twg, stmts, filename, agent_limit=300):
"""Write evidence sentences for stmts with ungrounded agents to csv file.
Parameters
----------
twg: list of tuple
list of tuples of ungrounded agent_texts with counts of the
number of times they are mentioned in the list of sta... | def function[save_sentences, parameter[twg, stmts, filename, agent_limit]]:
constant[Write evidence sentences for stmts with ungrounded agents to csv file.
Parameters
----------
twg: list of tuple
list of tuples of ungrounded agent_texts with counts of the
number of times they are m... | keyword[def] identifier[save_sentences] ( identifier[twg] , identifier[stmts] , identifier[filename] , identifier[agent_limit] = literal[int] ):
literal[string]
identifier[sentences] =[]
identifier[unmapped_texts] =[ identifier[t] [ literal[int] ] keyword[for] identifier[t] keyword[in] identifier[t... | def save_sentences(twg, stmts, filename, agent_limit=300):
"""Write evidence sentences for stmts with ungrounded agents to csv file.
Parameters
----------
twg: list of tuple
list of tuples of ungrounded agent_texts with counts of the
number of times they are mentioned in the list of sta... |
def combined_stop_to_stop_transit_network(gtfs, start_time_ut=None, end_time_ut=None):
"""
Compute stop-to-stop networks for all travel modes and combine them into a single network.
The modes of transport are encoded to a single network.
The network consists of multiple links corresponding to each trave... | def function[combined_stop_to_stop_transit_network, parameter[gtfs, start_time_ut, end_time_ut]]:
constant[
Compute stop-to-stop networks for all travel modes and combine them into a single network.
The modes of transport are encoded to a single network.
The network consists of multiple links corres... | keyword[def] identifier[combined_stop_to_stop_transit_network] ( identifier[gtfs] , identifier[start_time_ut] = keyword[None] , identifier[end_time_ut] = keyword[None] ):
literal[string]
identifier[multi_di_graph] = identifier[networkx] . identifier[MultiDiGraph] ()
keyword[for] identifier[route_type... | def combined_stop_to_stop_transit_network(gtfs, start_time_ut=None, end_time_ut=None):
"""
Compute stop-to-stop networks for all travel modes and combine them into a single network.
The modes of transport are encoded to a single network.
The network consists of multiple links corresponding to each trave... |
def scan_devices(self, subnet, timeout=None):
"""
Scan cameras in a range of ips
Params:
subnet - subnet, i.e: 192.168.1.0/24
if mask not used, assuming mask 24
timeout_sec - timeout in sec
Returns:
"""
# Maximum range from mask
... | def function[scan_devices, parameter[self, subnet, timeout]]:
constant[
Scan cameras in a range of ips
Params:
subnet - subnet, i.e: 192.168.1.0/24
if mask not used, assuming mask 24
timeout_sec - timeout in sec
Returns:
]
variable[max_... | keyword[def] identifier[scan_devices] ( identifier[self] , identifier[subnet] , identifier[timeout] = keyword[None] ):
literal[string]
identifier[max_range] ={
literal[int] : literal[int] ,
literal[int] : literal[int] ,
literal[int] : literal[int] ,
... | def scan_devices(self, subnet, timeout=None):
"""
Scan cameras in a range of ips
Params:
subnet - subnet, i.e: 192.168.1.0/24
if mask not used, assuming mask 24
timeout_sec - timeout in sec
Returns:
"""
# Maximum range from mask
# Format is... |
def reset_object(self, driver_wrapper=None):
"""Reset each page element object
:param driver_wrapper: driver wrapper instance
"""
from toolium.pageelements.page_elements import PageElements
if driver_wrapper:
self.driver_wrapper = driver_wrapper
self._web_ele... | def function[reset_object, parameter[self, driver_wrapper]]:
constant[Reset each page element object
:param driver_wrapper: driver wrapper instance
]
from relative_module[toolium.pageelements.page_elements] import module[PageElements]
if name[driver_wrapper] begin[:]
... | keyword[def] identifier[reset_object] ( identifier[self] , identifier[driver_wrapper] = keyword[None] ):
literal[string]
keyword[from] identifier[toolium] . identifier[pageelements] . identifier[page_elements] keyword[import] identifier[PageElements]
keyword[if] identifier[driver_wrap... | def reset_object(self, driver_wrapper=None):
"""Reset each page element object
:param driver_wrapper: driver wrapper instance
"""
from toolium.pageelements.page_elements import PageElements
if driver_wrapper:
self.driver_wrapper = driver_wrapper # depends on [control=['if'], data=[... |
def copy_document(destination, identifier, pointer):
"""Copy file to a new destination."""
record = Record.get_record(identifier)
click.echo(json.dumps(
Document(record, pointer).copy(destination)
)) | def function[copy_document, parameter[destination, identifier, pointer]]:
constant[Copy file to a new destination.]
variable[record] assign[=] call[name[Record].get_record, parameter[name[identifier]]]
call[name[click].echo, parameter[call[name[json].dumps, parameter[call[call[name[Document], pa... | keyword[def] identifier[copy_document] ( identifier[destination] , identifier[identifier] , identifier[pointer] ):
literal[string]
identifier[record] = identifier[Record] . identifier[get_record] ( identifier[identifier] )
identifier[click] . identifier[echo] ( identifier[json] . identifier[dumps] (
... | def copy_document(destination, identifier, pointer):
"""Copy file to a new destination."""
record = Record.get_record(identifier)
click.echo(json.dumps(Document(record, pointer).copy(destination))) |
def rackconnectv3(vm_):
'''
Determine if server is using rackconnectv3 or not
Return the rackconnect network name or False
'''
return config.get_cloud_config_value(
'rackconnectv3', vm_, __opts__, default=False,
search_global=False
) | def function[rackconnectv3, parameter[vm_]]:
constant[
Determine if server is using rackconnectv3 or not
Return the rackconnect network name or False
]
return[call[name[config].get_cloud_config_value, parameter[constant[rackconnectv3], name[vm_], name[__opts__]]]] | keyword[def] identifier[rackconnectv3] ( identifier[vm_] ):
literal[string]
keyword[return] identifier[config] . identifier[get_cloud_config_value] (
literal[string] , identifier[vm_] , identifier[__opts__] , identifier[default] = keyword[False] ,
identifier[search_global] = keyword[False]
... | def rackconnectv3(vm_):
"""
Determine if server is using rackconnectv3 or not
Return the rackconnect network name or False
"""
return config.get_cloud_config_value('rackconnectv3', vm_, __opts__, default=False, search_global=False) |
def get_property(self):
"""
Returns the property of the variable
Example
-------------
>>> from pgmpy.readwrite import BIFReader
>>> reader = BIFReader("bif_test.bif")
>>> reader.get_property()
{'bowel-problem': ['position = (335, 99)'],
'dog-out'... | def function[get_property, parameter[self]]:
constant[
Returns the property of the variable
Example
-------------
>>> from pgmpy.readwrite import BIFReader
>>> reader = BIFReader("bif_test.bif")
>>> reader.get_property()
{'bowel-problem': ['position = (33... | keyword[def] identifier[get_property] ( identifier[self] ):
literal[string]
identifier[variable_properties] ={}
keyword[for] identifier[block] keyword[in] identifier[self] . identifier[variable_block] ():
identifier[name] = identifier[self] . identifier[name_expr] . identif... | def get_property(self):
"""
Returns the property of the variable
Example
-------------
>>> from pgmpy.readwrite import BIFReader
>>> reader = BIFReader("bif_test.bif")
>>> reader.get_property()
{'bowel-problem': ['position = (335, 99)'],
'dog-out': ['... |
def execute_sql(self, sql, commit=False):
"""Log and then execute a SQL query"""
logger.info("Running sqlite query: \"%s\"", sql)
self.connection.execute(sql)
if commit:
self.connection.commit() | def function[execute_sql, parameter[self, sql, commit]]:
constant[Log and then execute a SQL query]
call[name[logger].info, parameter[constant[Running sqlite query: "%s"], name[sql]]]
call[name[self].connection.execute, parameter[name[sql]]]
if name[commit] begin[:]
call[... | keyword[def] identifier[execute_sql] ( identifier[self] , identifier[sql] , identifier[commit] = keyword[False] ):
literal[string]
identifier[logger] . identifier[info] ( literal[string] , identifier[sql] )
identifier[self] . identifier[connection] . identifier[execute] ( identifier[sql] )... | def execute_sql(self, sql, commit=False):
"""Log and then execute a SQL query"""
logger.info('Running sqlite query: "%s"', sql)
self.connection.execute(sql)
if commit:
self.connection.commit() # depends on [control=['if'], data=[]] |
def verify_pattern(pattern):
"""Verifies if pattern for matching and finding fulfill expected structure.
:param pattern: string pattern to verify
:return: True if pattern has proper syntax, False otherwise
"""
regex = re.compile("^!?[a-zA-Z]+$|[*]{1,2}$")
def __verify_pattern__(__pa... | def function[verify_pattern, parameter[pattern]]:
constant[Verifies if pattern for matching and finding fulfill expected structure.
:param pattern: string pattern to verify
:return: True if pattern has proper syntax, False otherwise
]
variable[regex] assign[=] call[name[re].compil... | keyword[def] identifier[verify_pattern] ( identifier[pattern] ):
literal[string]
identifier[regex] = identifier[re] . identifier[compile] ( literal[string] )
keyword[def] identifier[__verify_pattern__] ( identifier[__pattern__] ):
keyword[if] keyword[not] identifier[__pattern__] :
... | def verify_pattern(pattern):
"""Verifies if pattern for matching and finding fulfill expected structure.
:param pattern: string pattern to verify
:return: True if pattern has proper syntax, False otherwise
"""
regex = re.compile('^!?[a-zA-Z]+$|[*]{1,2}$')
def __verify_pattern__(__pat... |
def getParameterArrayCount(self, name, index):
"""
Overrides :meth:`~nupic.bindings.regions.PyRegion.PyRegion.getParameterArrayCount`.
TODO: as a temporary hack, getParameterArrayCount checks to see if there's a
variable, private or not, with that name. If so, it returns the value of the
variable.
... | def function[getParameterArrayCount, parameter[self, name, index]]:
constant[
Overrides :meth:`~nupic.bindings.regions.PyRegion.PyRegion.getParameterArrayCount`.
TODO: as a temporary hack, getParameterArrayCount checks to see if there's a
variable, private or not, with that name. If so, it returns ... | keyword[def] identifier[getParameterArrayCount] ( identifier[self] , identifier[name] , identifier[index] ):
literal[string]
identifier[p] = identifier[self] . identifier[getParameter] ( identifier[name] )
keyword[if] ( keyword[not] identifier[hasattr] ( identifier[p] , literal[string] )):
key... | def getParameterArrayCount(self, name, index):
"""
Overrides :meth:`~nupic.bindings.regions.PyRegion.PyRegion.getParameterArrayCount`.
TODO: as a temporary hack, getParameterArrayCount checks to see if there's a
variable, private or not, with that name. If so, it returns the value of the
variable.
... |
async def vcx_ledger_get_fees() -> str:
"""
Get ledger fees from the sovrin network
Example:
fees = await vcx_ledger_get_fees()
:return: JSON representing fees
"""
logger = logging.getLogger(__name__)
if not hasattr(vcx_ledger_get_fees, "cb"):
logger.debug("vcx_ledger_get_fees: ... | <ast.AsyncFunctionDef object at 0x7da1b1c78af0> | keyword[async] keyword[def] identifier[vcx_ledger_get_fees] ()-> identifier[str] :
literal[string]
identifier[logger] = identifier[logging] . identifier[getLogger] ( identifier[__name__] )
keyword[if] keyword[not] identifier[hasattr] ( identifier[vcx_ledger_get_fees] , literal[string] ):
... | async def vcx_ledger_get_fees() -> str:
"""
Get ledger fees from the sovrin network
Example:
fees = await vcx_ledger_get_fees()
:return: JSON representing fees
"""
logger = logging.getLogger(__name__)
if not hasattr(vcx_ledger_get_fees, 'cb'):
logger.debug('vcx_ledger_get_fees: C... |
def get_labels(cs):
"""Return list of every label."""
records = []
for c in cs:
records.extend(c.get('labels', []))
return records | def function[get_labels, parameter[cs]]:
constant[Return list of every label.]
variable[records] assign[=] list[[]]
for taget[name[c]] in starred[name[cs]] begin[:]
call[name[records].extend, parameter[call[name[c].get, parameter[constant[labels], list[[]]]]]]
return[name[rec... | keyword[def] identifier[get_labels] ( identifier[cs] ):
literal[string]
identifier[records] =[]
keyword[for] identifier[c] keyword[in] identifier[cs] :
identifier[records] . identifier[extend] ( identifier[c] . identifier[get] ( literal[string] ,[]))
keyword[return] identifier[record... | def get_labels(cs):
"""Return list of every label."""
records = []
for c in cs:
records.extend(c.get('labels', [])) # depends on [control=['for'], data=['c']]
return records |
def create_response_adu(self, meta_data, response_pdu):
""" Build response ADU from meta data and response PDU and return it.
:param meta_data: A dict with meta data.
:param request_pdu: A bytearray containing request PDU.
:return: A bytearray containing request ADU.
"""
... | def function[create_response_adu, parameter[self, meta_data, response_pdu]]:
constant[ Build response ADU from meta data and response PDU and return it.
:param meta_data: A dict with meta data.
:param request_pdu: A bytearray containing request PDU.
:return: A bytearray containing reque... | keyword[def] identifier[create_response_adu] ( identifier[self] , identifier[meta_data] , identifier[response_pdu] ):
literal[string]
identifier[first_part_adu] = identifier[struct] . identifier[pack] ( literal[string] , identifier[meta_data] [ literal[string] ])+ identifier[response_pdu]
... | def create_response_adu(self, meta_data, response_pdu):
""" Build response ADU from meta data and response PDU and return it.
:param meta_data: A dict with meta data.
:param request_pdu: A bytearray containing request PDU.
:return: A bytearray containing request ADU.
"""
first_p... |
def set_objective(self, measured_metabolites):
'''
Updates objective function for given measured metabolites.
:param dict measured_metabolites: dict in which keys are metabolite names
and values are float numbers represent fold changes in metabolites.
'''
self.clea... | def function[set_objective, parameter[self, measured_metabolites]]:
constant[
Updates objective function for given measured metabolites.
:param dict measured_metabolites: dict in which keys are metabolite names
and values are float numbers represent fold changes in metabolites.
... | keyword[def] identifier[set_objective] ( identifier[self] , identifier[measured_metabolites] ):
literal[string]
identifier[self] . identifier[clean_objective] ()
keyword[for] identifier[k] , identifier[v] keyword[in] identifier[measured_metabolites] . identifier[items] ():
... | def set_objective(self, measured_metabolites):
"""
Updates objective function for given measured metabolites.
:param dict measured_metabolites: dict in which keys are metabolite names
and values are float numbers represent fold changes in metabolites.
"""
self.clean_object... |
def nodes(self, type=None, failed=False, participant_id=None):
"""Get nodes in the network.
type specifies the type of Node. Failed can be "all", False
(default) or True. If a participant_id is passed only
nodes with that participant_id will be returned.
"""
if type is N... | def function[nodes, parameter[self, type, failed, participant_id]]:
constant[Get nodes in the network.
type specifies the type of Node. Failed can be "all", False
(default) or True. If a participant_id is passed only
nodes with that participant_id will be returned.
]
if ... | keyword[def] identifier[nodes] ( identifier[self] , identifier[type] = keyword[None] , identifier[failed] = keyword[False] , identifier[participant_id] = keyword[None] ):
literal[string]
keyword[if] identifier[type] keyword[is] keyword[None] :
identifier[type] = identifier[Node]
... | def nodes(self, type=None, failed=False, participant_id=None):
"""Get nodes in the network.
type specifies the type of Node. Failed can be "all", False
(default) or True. If a participant_id is passed only
nodes with that participant_id will be returned.
"""
if type is None:
... |
def tokenize(expr):
"""
Parse a string expression into a set of tokens that can be used as a path
into a Python datastructure.
"""
tokens = []
escape = False
cur_token = ''
for c in expr:
if escape == True:
cur_token += c
escape = False
else:
... | def function[tokenize, parameter[expr]]:
constant[
Parse a string expression into a set of tokens that can be used as a path
into a Python datastructure.
]
variable[tokens] assign[=] list[[]]
variable[escape] assign[=] constant[False]
variable[cur_token] assign[=] constant[]
... | keyword[def] identifier[tokenize] ( identifier[expr] ):
literal[string]
identifier[tokens] =[]
identifier[escape] = keyword[False]
identifier[cur_token] = literal[string]
keyword[for] identifier[c] keyword[in] identifier[expr] :
keyword[if] identifier[escape] == keyword[True]... | def tokenize(expr):
"""
Parse a string expression into a set of tokens that can be used as a path
into a Python datastructure.
"""
tokens = []
escape = False
cur_token = ''
for c in expr:
if escape == True:
cur_token += c
escape = False # depends on [cont... |
def cmd(send, msg, args):
"""Reposts a url.
Syntax: {command}
"""
result = args['db'].query(Urls).order_by(func.random()).first()
send("%s" % result.url) | def function[cmd, parameter[send, msg, args]]:
constant[Reposts a url.
Syntax: {command}
]
variable[result] assign[=] call[call[call[call[name[args]][constant[db]].query, parameter[name[Urls]]].order_by, parameter[call[name[func].random, parameter[]]]].first, parameter[]]
call[name[sen... | keyword[def] identifier[cmd] ( identifier[send] , identifier[msg] , identifier[args] ):
literal[string]
identifier[result] = identifier[args] [ literal[string] ]. identifier[query] ( identifier[Urls] ). identifier[order_by] ( identifier[func] . identifier[random] ()). identifier[first] ()
identifier[s... | def cmd(send, msg, args):
"""Reposts a url.
Syntax: {command}
"""
result = args['db'].query(Urls).order_by(func.random()).first()
send('%s' % result.url) |
def commented(self, user):
""" True if comment was added in given time frame """
for comment in self.comments:
# Description (comment #0) is not considered as a comment
if comment["count"] == 0:
continue
if (comment.get('author', comment.get('creator')... | def function[commented, parameter[self, user]]:
constant[ True if comment was added in given time frame ]
for taget[name[comment]] in starred[name[self].comments] begin[:]
if compare[call[name[comment]][constant[count]] equal[==] constant[0]] begin[:]
continue
... | keyword[def] identifier[commented] ( identifier[self] , identifier[user] ):
literal[string]
keyword[for] identifier[comment] keyword[in] identifier[self] . identifier[comments] :
keyword[if] identifier[comment] [ literal[string] ]== literal[int] :
keyword[... | def commented(self, user):
""" True if comment was added in given time frame """
for comment in self.comments:
# Description (comment #0) is not considered as a comment
if comment['count'] == 0:
continue # depends on [control=['if'], data=[]]
if comment.get('author', comment... |
def home_page(self, tld_type: Optional[TLDType] = None) -> str:
"""Generate a random home page.
:param tld_type: TLD type.
:return: Random home page.
:Example:
http://www.fontir.info
"""
resource = self.random.choice(USERNAMES)
domain = self.top_leve... | def function[home_page, parameter[self, tld_type]]:
constant[Generate a random home page.
:param tld_type: TLD type.
:return: Random home page.
:Example:
http://www.fontir.info
]
variable[resource] assign[=] call[name[self].random.choice, parameter[name[USER... | keyword[def] identifier[home_page] ( identifier[self] , identifier[tld_type] : identifier[Optional] [ identifier[TLDType] ]= keyword[None] )-> identifier[str] :
literal[string]
identifier[resource] = identifier[self] . identifier[random] . identifier[choice] ( identifier[USERNAMES] )
ident... | def home_page(self, tld_type: Optional[TLDType]=None) -> str:
"""Generate a random home page.
:param tld_type: TLD type.
:return: Random home page.
:Example:
http://www.fontir.info
"""
resource = self.random.choice(USERNAMES)
domain = self.top_level_domain(tld_t... |
def configuration(self, plugin):
"""
Get plugin configuration.
Return a tuple of (on|off|default, args)
"""
conf = self.config.get(plugin, "default;").split(';')
if len(conf) == 1:
conf.append('')
return tuple(conf) | def function[configuration, parameter[self, plugin]]:
constant[
Get plugin configuration.
Return a tuple of (on|off|default, args)
]
variable[conf] assign[=] call[call[name[self].config.get, parameter[name[plugin], constant[default;]]].split, parameter[constant[;]]]
if c... | keyword[def] identifier[configuration] ( identifier[self] , identifier[plugin] ):
literal[string]
identifier[conf] = identifier[self] . identifier[config] . identifier[get] ( identifier[plugin] , literal[string] ). identifier[split] ( literal[string] )
keyword[if] identifier[len] ( identi... | def configuration(self, plugin):
"""
Get plugin configuration.
Return a tuple of (on|off|default, args)
"""
conf = self.config.get(plugin, 'default;').split(';')
if len(conf) == 1:
conf.append('') # depends on [control=['if'], data=[]]
return tuple(conf) |
def naturaldate(date, include_seconds=False):
"""Convert datetime into a human natural date string."""
if not date:
return ''
right_now = now()
today = datetime(right_now.year, right_now.month,
right_now.day, tzinfo=right_now.tzinfo)
delta = right_now - date
delta_... | def function[naturaldate, parameter[date, include_seconds]]:
constant[Convert datetime into a human natural date string.]
if <ast.UnaryOp object at 0x7da1b2345c30> begin[:]
return[constant[]]
variable[right_now] assign[=] call[name[now], parameter[]]
variable[today] assign[=] cal... | keyword[def] identifier[naturaldate] ( identifier[date] , identifier[include_seconds] = keyword[False] ):
literal[string]
keyword[if] keyword[not] identifier[date] :
keyword[return] literal[string]
identifier[right_now] = identifier[now] ()
identifier[today] = identifier[datetime] ... | def naturaldate(date, include_seconds=False):
"""Convert datetime into a human natural date string."""
if not date:
return '' # depends on [control=['if'], data=[]]
right_now = now()
today = datetime(right_now.year, right_now.month, right_now.day, tzinfo=right_now.tzinfo)
delta = right_now ... |
def moveToPoint(self, xxx_todo_changeme1):
"""
Moves the circle to the point x,y
"""
(x,y) = xxx_todo_changeme1
self.set_cx(float(self.get_cx()) + float(x))
self.set_cy(float(self.get_cy()) + float(y)) | def function[moveToPoint, parameter[self, xxx_todo_changeme1]]:
constant[
Moves the circle to the point x,y
]
<ast.Tuple object at 0x7da18c4cd420> assign[=] name[xxx_todo_changeme1]
call[name[self].set_cx, parameter[binary_operation[call[name[float], parameter[call[name[self].get... | keyword[def] identifier[moveToPoint] ( identifier[self] , identifier[xxx_todo_changeme1] ):
literal[string]
( identifier[x] , identifier[y] )= identifier[xxx_todo_changeme1]
identifier[self] . identifier[set_cx] ( identifier[float] ( identifier[self] . identifier[get_cx] ())+ identifier[fl... | def moveToPoint(self, xxx_todo_changeme1):
"""
Moves the circle to the point x,y
"""
(x, y) = xxx_todo_changeme1
self.set_cx(float(self.get_cx()) + float(x))
self.set_cy(float(self.get_cy()) + float(y)) |
def force_ascii(value):
"""
Return enforced ascii string
éko=>ko
"""
if not isinstance(value, (str, unicode)):
return unicode(value)
if isinstance(value, unicode):
return unidecode.unidecode(value)
else:
return unidecode.unidecode(force_unicode(value)) | def function[force_ascii, parameter[value]]:
constant[
Return enforced ascii string
éko=>ko
]
if <ast.UnaryOp object at 0x7da1b1454400> begin[:]
return[call[name[unicode], parameter[name[value]]]]
if call[name[isinstance], parameter[name[value], name[unicode]]] begin[... | keyword[def] identifier[force_ascii] ( identifier[value] ):
literal[string]
keyword[if] keyword[not] identifier[isinstance] ( identifier[value] ,( identifier[str] , identifier[unicode] )):
keyword[return] identifier[unicode] ( identifier[value] )
keyword[if] identifier[isinstance] ( ident... | def force_ascii(value):
"""
Return enforced ascii string
éko=>ko
"""
if not isinstance(value, (str, unicode)):
return unicode(value) # depends on [control=['if'], data=[]]
if isinstance(value, unicode):
return unidecode.unidecode(value) # depends on [control=['if'], dat... |
def marketsDF(token='', version=''):
'''https://iextrading.com/developer/docs/#intraday'''
df = pd.DataFrame(markets(token, version))
_toDatetime(df)
return df | def function[marketsDF, parameter[token, version]]:
constant[https://iextrading.com/developer/docs/#intraday]
variable[df] assign[=] call[name[pd].DataFrame, parameter[call[name[markets], parameter[name[token], name[version]]]]]
call[name[_toDatetime], parameter[name[df]]]
return[name[df]] | keyword[def] identifier[marketsDF] ( identifier[token] = literal[string] , identifier[version] = literal[string] ):
literal[string]
identifier[df] = identifier[pd] . identifier[DataFrame] ( identifier[markets] ( identifier[token] , identifier[version] ))
identifier[_toDatetime] ( identifier[df] )
... | def marketsDF(token='', version=''):
"""https://iextrading.com/developer/docs/#intraday"""
df = pd.DataFrame(markets(token, version))
_toDatetime(df)
return df |
def compute_region_border(start, end):
"""
given the buffer start and end indices of a range, compute the border edges
that should be drawn to enclose the range.
this function currently assumes 0x10 length rows.
the result is a dictionary from buffer index to Cell instance.
the Cell instance ... | def function[compute_region_border, parameter[start, end]]:
constant[
given the buffer start and end indices of a range, compute the border edges
that should be drawn to enclose the range.
this function currently assumes 0x10 length rows.
the result is a dictionary from buffer index to Cell i... | keyword[def] identifier[compute_region_border] ( identifier[start] , identifier[end] ):
literal[string]
identifier[cells] = identifier[defaultdict] ( identifier[Cell] )
identifier[start_row] = identifier[row_number] ( identifier[start] )
identifier[end_row] = identifier[row_number] ( identifier[... | def compute_region_border(start, end):
"""
given the buffer start and end indices of a range, compute the border edges
that should be drawn to enclose the range.
this function currently assumes 0x10 length rows.
the result is a dictionary from buffer index to Cell instance.
the Cell instance ... |
def inject(self, span_context, format, carrier):
"""Injects `span_context` into `carrier`.
The type of `carrier` is determined by `format`. See the
:class:`Format` class/namespace for the built-in OpenTracing formats.
Implementations *must* raise :exc:`UnsupportedFormatException` if
... | def function[inject, parameter[self, span_context, format, carrier]]:
constant[Injects `span_context` into `carrier`.
The type of `carrier` is determined by `format`. See the
:class:`Format` class/namespace for the built-in OpenTracing formats.
Implementations *must* raise :exc:`Unsupp... | keyword[def] identifier[inject] ( identifier[self] , identifier[span_context] , identifier[format] , identifier[carrier] ):
literal[string]
keyword[if] identifier[format] keyword[in] identifier[Tracer] . identifier[_supported_formats] :
keyword[return]
keyword[raise] iden... | def inject(self, span_context, format, carrier):
"""Injects `span_context` into `carrier`.
The type of `carrier` is determined by `format`. See the
:class:`Format` class/namespace for the built-in OpenTracing formats.
Implementations *must* raise :exc:`UnsupportedFormatException` if
... |
def profileit(func):
"""
Decorator straight up stolen from stackoverflow
"""
def wrapper(*args, **kwargs):
datafn = func.__name__ + ".profile" # Name the data file sensibly
prof = cProfile.Profile()
prof.enable()
retval = prof.runcall(func, *args, **kwargs)
prof.d... | def function[profileit, parameter[func]]:
constant[
Decorator straight up stolen from stackoverflow
]
def function[wrapper, parameter[]]:
variable[datafn] assign[=] binary_operation[name[func].__name__ + constant[.profile]]
variable[prof] assign[=] call[name[cProf... | keyword[def] identifier[profileit] ( identifier[func] ):
literal[string]
keyword[def] identifier[wrapper] (* identifier[args] ,** identifier[kwargs] ):
identifier[datafn] = identifier[func] . identifier[__name__] + literal[string]
identifier[prof] = identifier[cProfile] . identifier[Pro... | def profileit(func):
"""
Decorator straight up stolen from stackoverflow
"""
def wrapper(*args, **kwargs):
datafn = func.__name__ + '.profile' # Name the data file sensibly
prof = cProfile.Profile()
prof.enable()
retval = prof.runcall(func, *args, **kwargs)
prof... |
def contains(self, column, value):
"""
Set the main dataframe instance to rows that contains a string
value in a column
"""
df = self.df[self.df[column].str.contains(value) == True]
if df is None:
self.err("Can not select contained data")
return
... | def function[contains, parameter[self, column, value]]:
constant[
Set the main dataframe instance to rows that contains a string
value in a column
]
variable[df] assign[=] call[name[self].df][compare[call[call[name[self].df][name[column]].str.contains, parameter[name[value]]] equ... | keyword[def] identifier[contains] ( identifier[self] , identifier[column] , identifier[value] ):
literal[string]
identifier[df] = identifier[self] . identifier[df] [ identifier[self] . identifier[df] [ identifier[column] ]. identifier[str] . identifier[contains] ( identifier[value] )== keyword[True... | def contains(self, column, value):
"""
Set the main dataframe instance to rows that contains a string
value in a column
"""
df = self.df[self.df[column].str.contains(value) == True]
if df is None:
self.err('Can not select contained data')
return # depends on [control... |
def variable_specifier(self) -> dict:
"""Return the variable specifier for this variable.
The specifier can be used to lookup the value of this variable in a computation context.
"""
if self.value_type is not None:
return {"type": "variable", "version": 1, "uuid": str(self.u... | def function[variable_specifier, parameter[self]]:
constant[Return the variable specifier for this variable.
The specifier can be used to lookup the value of this variable in a computation context.
]
if compare[name[self].value_type is_not constant[None]] begin[:]
return[diction... | keyword[def] identifier[variable_specifier] ( identifier[self] )-> identifier[dict] :
literal[string]
keyword[if] identifier[self] . identifier[value_type] keyword[is] keyword[not] keyword[None] :
keyword[return] { literal[string] : literal[string] , literal[string] : literal[int] ... | def variable_specifier(self) -> dict:
"""Return the variable specifier for this variable.
The specifier can be used to lookup the value of this variable in a computation context.
"""
if self.value_type is not None:
return {'type': 'variable', 'version': 1, 'uuid': str(self.uuid), 'x-nam... |
def sendSMS(self, CorpNum, ItemCode, MgtKey, Sender, Receiver, Contents, UserID=None):
""" 알림문자 전송
args
CorpNum : 팝빌회원 사업자번호
ItemCode : 명세서 종류 코드
[121 - 거래명세서], [122 - 청구서], [123 - 견적서],
[124 - 발주서], [125 - 입금표], [126 - 영수... | def function[sendSMS, parameter[self, CorpNum, ItemCode, MgtKey, Sender, Receiver, Contents, UserID]]:
constant[ 알림문자 전송
args
CorpNum : 팝빌회원 사업자번호
ItemCode : 명세서 종류 코드
[121 - 거래명세서], [122 - 청구서], [123 - 견적서],
[124 - 발주서], [125 -... | keyword[def] identifier[sendSMS] ( identifier[self] , identifier[CorpNum] , identifier[ItemCode] , identifier[MgtKey] , identifier[Sender] , identifier[Receiver] , identifier[Contents] , identifier[UserID] = keyword[None] ):
literal[string]
keyword[if] identifier[MgtKey] == keyword[None] keyw... | def sendSMS(self, CorpNum, ItemCode, MgtKey, Sender, Receiver, Contents, UserID=None):
""" 알림문자 전송
args
CorpNum : 팝빌회원 사업자번호
ItemCode : 명세서 종류 코드
[121 - 거래명세서], [122 - 청구서], [123 - 견적서],
[124 - 발주서], [125 - 입금표], [126 - 영수증]
... |
def get_elements(self, tag_name, attribute):
"""
Return elements in xml files which match with the tag name and the specific attribute
:param tag_name: a string which specify the tag name
:param attribute: a string which specify the attribute
"""
l = []
... | def function[get_elements, parameter[self, tag_name, attribute]]:
constant[
Return elements in xml files which match with the tag name and the specific attribute
:param tag_name: a string which specify the tag name
:param attribute: a string which specify the attribute
... | keyword[def] identifier[get_elements] ( identifier[self] , identifier[tag_name] , identifier[attribute] ):
literal[string]
identifier[l] =[]
keyword[for] identifier[i] keyword[in] identifier[self] . identifier[xml] :
keyword[for] identifier[item] keyword[in] identifier[s... | def get_elements(self, tag_name, attribute):
"""
Return elements in xml files which match with the tag name and the specific attribute
:param tag_name: a string which specify the tag name
:param attribute: a string which specify the attribute
"""
l = []
for i in ... |
def check_configuration_string(
self,
config_string,
is_job=True,
external_name=False
):
"""
Check whether the given job or task configuration string
is well-formed (if ``is_bstring`` is ``True``)
and it has all the required parameters.... | def function[check_configuration_string, parameter[self, config_string, is_job, external_name]]:
constant[
Check whether the given job or task configuration string
is well-formed (if ``is_bstring`` is ``True``)
and it has all the required parameters.
:param string config_string:... | keyword[def] identifier[check_configuration_string] (
identifier[self] ,
identifier[config_string] ,
identifier[is_job] = keyword[True] ,
identifier[external_name] = keyword[False]
):
literal[string]
keyword[if] identifier[is_job] :
identifier[self] . identifier[log] ( literal[st... | def check_configuration_string(self, config_string, is_job=True, external_name=False):
"""
Check whether the given job or task configuration string
is well-formed (if ``is_bstring`` is ``True``)
and it has all the required parameters.
:param string config_string: the byte string or ... |
def handleMethodCallMessage(self, msg):
"""
Handles DBus MethodCall messages on behalf of the DBus Connection and
dispatches them to the appropriate exported object
"""
if (
msg.interface == 'org.freedesktop.DBus.Peer'
and msg.member == 'Ping'
):
... | def function[handleMethodCallMessage, parameter[self, msg]]:
constant[
Handles DBus MethodCall messages on behalf of the DBus Connection and
dispatches them to the appropriate exported object
]
if <ast.BoolOp object at 0x7da1b06dd6c0> begin[:]
variable[r] assign[=... | keyword[def] identifier[handleMethodCallMessage] ( identifier[self] , identifier[msg] ):
literal[string]
keyword[if] (
identifier[msg] . identifier[interface] == literal[string]
keyword[and] identifier[msg] . identifier[member] == literal[string]
):
identif... | def handleMethodCallMessage(self, msg):
"""
Handles DBus MethodCall messages on behalf of the DBus Connection and
dispatches them to the appropriate exported object
"""
if msg.interface == 'org.freedesktop.DBus.Peer' and msg.member == 'Ping':
r = message.MethodReturnMessage(msg.s... |
def get_power_factor(self, output='eigs', doping_levels=True,
relaxation_time=1e-14):
"""
Gives the power factor (Seebeck^2 * conductivity) in units
microW/(m*K^2) in either a full 3x3 tensor form,
as 3 eigenvalues, or as the average value (trace/3.0) If
... | def function[get_power_factor, parameter[self, output, doping_levels, relaxation_time]]:
constant[
Gives the power factor (Seebeck^2 * conductivity) in units
microW/(m*K^2) in either a full 3x3 tensor form,
as 3 eigenvalues, or as the average value (trace/3.0) If
doping_levels=Tr... | keyword[def] identifier[get_power_factor] ( identifier[self] , identifier[output] = literal[string] , identifier[doping_levels] = keyword[True] ,
identifier[relaxation_time] = literal[int] ):
literal[string]
identifier[result] = keyword[None]
identifier[result_doping] = keyword[None]
... | def get_power_factor(self, output='eigs', doping_levels=True, relaxation_time=1e-14):
"""
Gives the power factor (Seebeck^2 * conductivity) in units
microW/(m*K^2) in either a full 3x3 tensor form,
as 3 eigenvalues, or as the average value (trace/3.0) If
doping_levels=True, the resul... |
def delete(self, shape=None, part=None, point=None):
"""Deletes the specified part of any shape by specifying a shape
number, part number, or point number."""
# shape, part, point
if shape and part and point:
del self._shapes[shape][part][point]
# shape, part
... | def function[delete, parameter[self, shape, part, point]]:
constant[Deletes the specified part of any shape by specifying a shape
number, part number, or point number.]
if <ast.BoolOp object at 0x7da1b07a6290> begin[:]
<ast.Delete object at 0x7da1b07a52d0> | keyword[def] identifier[delete] ( identifier[self] , identifier[shape] = keyword[None] , identifier[part] = keyword[None] , identifier[point] = keyword[None] ):
literal[string]
keyword[if] identifier[shape] keyword[and] identifier[part] keyword[and] identifier[point] :
... | def delete(self, shape=None, part=None, point=None):
"""Deletes the specified part of any shape by specifying a shape
number, part number, or point number.""" # shape, part, point
if shape and part and point:
del self._shapes[shape][part][point] # depends on [control=['if'], data=[]] # shape,... |
def get_egg_info(cfg, verbose=False):
"""Call 'setup egg_info' and return the parsed meta-data."""
result = Bunch()
setup_py = cfg.rootjoin('setup.py')
if not os.path.exists(setup_py):
return result
egg_info = shell.capture("python {} egg_info".format(setup_py), echo=True if verbose else No... | def function[get_egg_info, parameter[cfg, verbose]]:
constant[Call 'setup egg_info' and return the parsed meta-data.]
variable[result] assign[=] call[name[Bunch], parameter[]]
variable[setup_py] assign[=] call[name[cfg].rootjoin, parameter[constant[setup.py]]]
if <ast.UnaryOp object at 0... | keyword[def] identifier[get_egg_info] ( identifier[cfg] , identifier[verbose] = keyword[False] ):
literal[string]
identifier[result] = identifier[Bunch] ()
identifier[setup_py] = identifier[cfg] . identifier[rootjoin] ( literal[string] )
keyword[if] keyword[not] identifier[os] . identifier[path... | def get_egg_info(cfg, verbose=False):
"""Call 'setup egg_info' and return the parsed meta-data."""
result = Bunch()
setup_py = cfg.rootjoin('setup.py')
if not os.path.exists(setup_py):
return result # depends on [control=['if'], data=[]]
egg_info = shell.capture('python {} egg_info'.format(... |
def prune(matrix, threshold):
"""
Prune the matrix so that very small edges are removed.
The maximum value in each column is never pruned.
:param matrix: The matrix to be pruned
:param threshold: The value below which edges will be removed
:returns: The pruned matrix
"""
if isspmatr... | def function[prune, parameter[matrix, threshold]]:
constant[
Prune the matrix so that very small edges are removed.
The maximum value in each column is never pruned.
:param matrix: The matrix to be pruned
:param threshold: The value below which edges will be removed
:returns: The pruned... | keyword[def] identifier[prune] ( identifier[matrix] , identifier[threshold] ):
literal[string]
keyword[if] identifier[isspmatrix] ( identifier[matrix] ):
identifier[pruned] = identifier[dok_matrix] ( identifier[matrix] . identifier[shape] )
identifier[pruned] [ identifier[matrix] >= iden... | def prune(matrix, threshold):
"""
Prune the matrix so that very small edges are removed.
The maximum value in each column is never pruned.
:param matrix: The matrix to be pruned
:param threshold: The value below which edges will be removed
:returns: The pruned matrix
"""
if isspmatr... |
def handle_publishable_m2m_changed(
sender, instance, action, reverse, model, pk_set, **kwargs):
"""
Cache related published objects in `pre_clear` so they can be restored in
`post_clear`.
"""
# Do nothing if the target model is not publishable.
if not issubclass(model, PublishingModel):... | def function[handle_publishable_m2m_changed, parameter[sender, instance, action, reverse, model, pk_set]]:
constant[
Cache related published objects in `pre_clear` so they can be restored in
`post_clear`.
]
if <ast.UnaryOp object at 0x7da18dc06230> begin[:]
return[None]
if na... | keyword[def] identifier[handle_publishable_m2m_changed] (
identifier[sender] , identifier[instance] , identifier[action] , identifier[reverse] , identifier[model] , identifier[pk_set] ,** identifier[kwargs] ):
literal[string]
keyword[if] keyword[not] identifier[issubclass] ( identifier[model] , ide... | def handle_publishable_m2m_changed(sender, instance, action, reverse, model, pk_set, **kwargs):
"""
Cache related published objects in `pre_clear` so they can be restored in
`post_clear`.
"""
# Do nothing if the target model is not publishable.
if not issubclass(model, PublishingModel):
... |
def get_stacks_payment(state_engine, nameop, state_op_type):
"""
Find out how many tokens were paid for this nameop, if any.
You need to have called state_create_put_preorder() *before* calling this on a NAME_REGISTRATION.
Return {'status': True, 'token_units': ..., 'tokens_paid': ...} on success
R... | def function[get_stacks_payment, parameter[state_engine, nameop, state_op_type]]:
constant[
Find out how many tokens were paid for this nameop, if any.
You need to have called state_create_put_preorder() *before* calling this on a NAME_REGISTRATION.
Return {'status': True, 'token_units': ..., 'toke... | keyword[def] identifier[get_stacks_payment] ( identifier[state_engine] , identifier[nameop] , identifier[state_op_type] ):
literal[string]
identifier[token_units] = keyword[None]
identifier[tokens_paid] = keyword[None]
identifier[name] = identifier[nameop] [ literal[string] ]
identifier[to... | def get_stacks_payment(state_engine, nameop, state_op_type):
"""
Find out how many tokens were paid for this nameop, if any.
You need to have called state_create_put_preorder() *before* calling this on a NAME_REGISTRATION.
Return {'status': True, 'token_units': ..., 'tokens_paid': ...} on success
R... |
def task(name=None, t=INFO, *args, **kwargs):
"""
This decorator modifies current function such that its start, end, and
duration is logged in console. If the task name is not given, it will
attempt to infer it from the function name. Optionally, the decorator
can log information into files.
"""... | def function[task, parameter[name, t]]:
constant[
This decorator modifies current function such that its start, end, and
duration is logged in console. If the task name is not given, it will
attempt to infer it from the function name. Optionally, the decorator
can log information into files.
... | keyword[def] identifier[task] ( identifier[name] = keyword[None] , identifier[t] = identifier[INFO] ,* identifier[args] ,** identifier[kwargs] ):
literal[string]
keyword[def] identifier[c_run] ( identifier[name] , identifier[f] , identifier[t] , identifier[args] , identifier[kwargs] ):
keyword[d... | def task(name=None, t=INFO, *args, **kwargs):
"""
This decorator modifies current function such that its start, end, and
duration is logged in console. If the task name is not given, it will
attempt to infer it from the function name. Optionally, the decorator
can log information into files.
"""... |
def __calculate_cluster_difference(self, index_cluster, difference):
"""!
@brief Calculates distance from each object in specified cluster to specified object.
@param[in] index_point (uint): Index point for which difference is calculated.
@return (list) Distance from specified ob... | def function[__calculate_cluster_difference, parameter[self, index_cluster, difference]]:
constant[!
@brief Calculates distance from each object in specified cluster to specified object.
@param[in] index_point (uint): Index point for which difference is calculated.
@return (list) Dista... | keyword[def] identifier[__calculate_cluster_difference] ( identifier[self] , identifier[index_cluster] , identifier[difference] ):
literal[string]
identifier[cluster_difference] = literal[int]
keyword[for] identifier[index_point] keyword[in] identifier[self] . identifier[__clusters]... | def __calculate_cluster_difference(self, index_cluster, difference):
"""!
@brief Calculates distance from each object in specified cluster to specified object.
@param[in] index_point (uint): Index point for which difference is calculated.
@return (list) Distance from specified object to ea... |
def dump(self, indent='', depth=0, full=True):
"""
Diagnostic method for listing out the contents of
a :class:`ParseResults`. Accepts an optional ``indent`` argument so
that this string can be embedded in a nested display of other data.
Example::
integer = Word(nums... | def function[dump, parameter[self, indent, depth, full]]:
constant[
Diagnostic method for listing out the contents of
a :class:`ParseResults`. Accepts an optional ``indent`` argument so
that this string can be embedded in a nested display of other data.
Example::
in... | keyword[def] identifier[dump] ( identifier[self] , identifier[indent] = literal[string] , identifier[depth] = literal[int] , identifier[full] = keyword[True] ):
literal[string]
identifier[out] =[]
identifier[NL] = literal[string]
identifier[out] . identifier[append] ( identifier[... | def dump(self, indent='', depth=0, full=True):
"""
Diagnostic method for listing out the contents of
a :class:`ParseResults`. Accepts an optional ``indent`` argument so
that this string can be embedded in a nested display of other data.
Example::
integer = Word(nums)
... |
def serializer_by_type_id(self, type_id):
"""
Find and return the serializer for the type-id
:param type_id: type-id the serializer
:return: the serializer
"""
if type_id <= 0:
indx = index_for_default_type(type_id)
serializer = self._constant_type... | def function[serializer_by_type_id, parameter[self, type_id]]:
constant[
Find and return the serializer for the type-id
:param type_id: type-id the serializer
:return: the serializer
]
if compare[name[type_id] less_or_equal[<=] constant[0]] begin[:]
variab... | keyword[def] identifier[serializer_by_type_id] ( identifier[self] , identifier[type_id] ):
literal[string]
keyword[if] identifier[type_id] <= literal[int] :
identifier[indx] = identifier[index_for_default_type] ( identifier[type_id] )
identifier[serializer] = identifier[s... | def serializer_by_type_id(self, type_id):
"""
Find and return the serializer for the type-id
:param type_id: type-id the serializer
:return: the serializer
"""
if type_id <= 0:
indx = index_for_default_type(type_id)
serializer = self._constant_type_ids.get(indx, N... |
def connect(host=DEFAULT_HOST, port=DEFAULT_PORT, base=DEFAULT_BASE,
chunk_size=multipart.default_chunk_size, **defaults):
"""Create a new :class:`~ipfsapi.Client` instance and connect to the
daemon to validate that its version is supported.
Raises
------
~ipfsapi.exceptions.VersionMism... | def function[connect, parameter[host, port, base, chunk_size]]:
constant[Create a new :class:`~ipfsapi.Client` instance and connect to the
daemon to validate that its version is supported.
Raises
------
~ipfsapi.exceptions.VersionMismatch
~ipfsapi.exceptions.ErrorResponse
~ipfsapi.excep... | keyword[def] identifier[connect] ( identifier[host] = identifier[DEFAULT_HOST] , identifier[port] = identifier[DEFAULT_PORT] , identifier[base] = identifier[DEFAULT_BASE] ,
identifier[chunk_size] = identifier[multipart] . identifier[default_chunk_size] ,** identifier[defaults] ):
literal[string]
iden... | def connect(host=DEFAULT_HOST, port=DEFAULT_PORT, base=DEFAULT_BASE, chunk_size=multipart.default_chunk_size, **defaults):
"""Create a new :class:`~ipfsapi.Client` instance and connect to the
daemon to validate that its version is supported.
Raises
------
~ipfsapi.exceptions.VersionMismatch
~ip... |
def show_result(resource, verbose=False):
"""
TODO
"""
if resource.uri == surf.ns.EFRBROO['F10_Person']:
print("\n{} ({})\n".format(unicode(resource), resource.get_urn()))
works = resource.get_works()
print("Works by {} ({}):\n".format(resource, len(works)))
[show_result(... | def function[show_result, parameter[resource, verbose]]:
constant[
TODO
]
if compare[name[resource].uri equal[==] call[name[surf].ns.EFRBROO][constant[F10_Person]]] begin[:]
call[name[print], parameter[call[constant[
{} ({})
].format, parameter[call[name[unicode], parameter[name[... | keyword[def] identifier[show_result] ( identifier[resource] , identifier[verbose] = keyword[False] ):
literal[string]
keyword[if] identifier[resource] . identifier[uri] == identifier[surf] . identifier[ns] . identifier[EFRBROO] [ literal[string] ]:
identifier[print] ( literal[string] . identifier... | def show_result(resource, verbose=False):
"""
TODO
"""
if resource.uri == surf.ns.EFRBROO['F10_Person']:
print('\n{} ({})\n'.format(unicode(resource), resource.get_urn()))
works = resource.get_works()
print('Works by {} ({}):\n'.format(resource, len(works)))
[show_result(... |
def section(rows, columns, items, label=None):
"""A section consisting of rows and columns"""
# TODO: Integrate label
sections = []
column_class = "section-column col-sm-%i" % (12 / columns)
for vertical in range(columns):
column_items = []
for horizontal in range(rows):
... | def function[section, parameter[rows, columns, items, label]]:
constant[A section consisting of rows and columns]
variable[sections] assign[=] list[[]]
variable[column_class] assign[=] binary_operation[constant[section-column col-sm-%i] <ast.Mod object at 0x7da2590d6920> binary_operation[constan... | keyword[def] identifier[section] ( identifier[rows] , identifier[columns] , identifier[items] , identifier[label] = keyword[None] ):
literal[string]
identifier[sections] =[]
identifier[column_class] = literal[string] %( literal[int] / identifier[columns] )
keyword[for] identifier[vertic... | def section(rows, columns, items, label=None):
"""A section consisting of rows and columns"""
# TODO: Integrate label
sections = []
column_class = 'section-column col-sm-%i' % (12 / columns)
for vertical in range(columns):
column_items = []
for horizontal in range(rows):
... |
def solve(self):
"""Perform the solve.
"""
with log_duration(self._print, "memcache get (resolve) took %s"):
solver_dict = self._get_cached_solve()
if solver_dict:
self.from_cache = True
self._set_result(solver_dict)
else:
self.fro... | def function[solve, parameter[self]]:
constant[Perform the solve.
]
with call[name[log_duration], parameter[name[self]._print, constant[memcache get (resolve) took %s]]] begin[:]
variable[solver_dict] assign[=] call[name[self]._get_cached_solve, parameter[]]
if name[solve... | keyword[def] identifier[solve] ( identifier[self] ):
literal[string]
keyword[with] identifier[log_duration] ( identifier[self] . identifier[_print] , literal[string] ):
identifier[solver_dict] = identifier[self] . identifier[_get_cached_solve] ()
keyword[if] identifier[solv... | def solve(self):
"""Perform the solve.
"""
with log_duration(self._print, 'memcache get (resolve) took %s'):
solver_dict = self._get_cached_solve() # depends on [control=['with'], data=[]]
if solver_dict:
self.from_cache = True
self._set_result(solver_dict) # depends on [co... |
def to_array(self):
"""
Serializes this InlineQueryResultCachedSticker to a dictionary.
:return: dictionary representation of this object.
:rtype: dict
"""
array = super(InlineQueryResultCachedSticker, self).to_array()
array['type'] = u(self.type) # py2: type un... | def function[to_array, parameter[self]]:
constant[
Serializes this InlineQueryResultCachedSticker to a dictionary.
:return: dictionary representation of this object.
:rtype: dict
]
variable[array] assign[=] call[call[name[super], parameter[name[InlineQueryResultCachedSti... | keyword[def] identifier[to_array] ( identifier[self] ):
literal[string]
identifier[array] = identifier[super] ( identifier[InlineQueryResultCachedSticker] , identifier[self] ). identifier[to_array] ()
identifier[array] [ literal[string] ]= identifier[u] ( identifier[self] . identifier[type... | def to_array(self):
"""
Serializes this InlineQueryResultCachedSticker to a dictionary.
:return: dictionary representation of this object.
:rtype: dict
"""
array = super(InlineQueryResultCachedSticker, self).to_array()
array['type'] = u(self.type) # py2: type unicode, py3: ... |
def create(self, list_id, data):
"""
adds a new segment to the list.
"""
return self._mc_client._post(url=self._build_path(list_id, 'segments'), data=data) | def function[create, parameter[self, list_id, data]]:
constant[
adds a new segment to the list.
]
return[call[name[self]._mc_client._post, parameter[]]] | keyword[def] identifier[create] ( identifier[self] , identifier[list_id] , identifier[data] ):
literal[string]
keyword[return] identifier[self] . identifier[_mc_client] . identifier[_post] ( identifier[url] = identifier[self] . identifier[_build_path] ( identifier[list_id] , literal[string] ), ide... | def create(self, list_id, data):
"""
adds a new segment to the list.
"""
return self._mc_client._post(url=self._build_path(list_id, 'segments'), data=data) |
def sort_common_members():
"""Sorts the keys and members"""
filename = PREFIX + '/common_members.json'
sorted_json_data = {}
json_data = read_json(filename)
all_keys = []
for key, value in json_data.items():
all_keys.append(key)
sorted_keys = sorted(all_keys)
for key in sorted... | def function[sort_common_members, parameter[]]:
constant[Sorts the keys and members]
variable[filename] assign[=] binary_operation[name[PREFIX] + constant[/common_members.json]]
variable[sorted_json_data] assign[=] dictionary[[], []]
variable[json_data] assign[=] call[name[read_json], pa... | keyword[def] identifier[sort_common_members] ():
literal[string]
identifier[filename] = identifier[PREFIX] + literal[string]
identifier[sorted_json_data] ={}
identifier[json_data] = identifier[read_json] ( identifier[filename] )
identifier[all_keys] =[]
keyword[for] identifier[key] ... | def sort_common_members():
"""Sorts the keys and members"""
filename = PREFIX + '/common_members.json'
sorted_json_data = {}
json_data = read_json(filename)
all_keys = []
for (key, value) in json_data.items():
all_keys.append(key) # depends on [control=['for'], data=[]]
sorted_keys ... |
def writeOffsetTable(self, output):
"""Writes all of the object reference offsets."""
all_positions = []
writtenReferences = list(self.writtenReferences.items())
writtenReferences.sort(key=lambda x: x[1])
for obj,order in writtenReferences:
# Porting note: Elsewhere w... | def function[writeOffsetTable, parameter[self, output]]:
constant[Writes all of the object reference offsets.]
variable[all_positions] assign[=] list[[]]
variable[writtenReferences] assign[=] call[name[list], parameter[call[name[self].writtenReferences.items, parameter[]]]]
call[name[wri... | keyword[def] identifier[writeOffsetTable] ( identifier[self] , identifier[output] ):
literal[string]
identifier[all_positions] =[]
identifier[writtenReferences] = identifier[list] ( identifier[self] . identifier[writtenReferences] . identifier[items] ())
identifier[writtenReferenc... | def writeOffsetTable(self, output):
"""Writes all of the object reference offsets."""
all_positions = []
writtenReferences = list(self.writtenReferences.items())
writtenReferences.sort(key=lambda x: x[1])
for (obj, order) in writtenReferences:
# Porting note: Elsewhere we deliberately replac... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.