code stringlengths 75 104k | code_sememe stringlengths 47 309k | token_type stringlengths 215 214k | code_dependency stringlengths 75 155k |
|---|---|---|---|
def read_configuration(self):
"""
Read the PyPI access configuration as supported by distutils, getting
PyPI to do the actual work. This populates ``username``, ``password``,
``realm`` and ``url`` attributes from the configuration.
"""
# get distutils to do the work
... | def function[read_configuration, parameter[self]]:
constant[
Read the PyPI access configuration as supported by distutils, getting
PyPI to do the actual work. This populates ``username``, ``password``,
``realm`` and ``url`` attributes from the configuration.
]
variable[c]... | keyword[def] identifier[read_configuration] ( identifier[self] ):
literal[string]
identifier[c] = identifier[self] . identifier[_get_pypirc_command] ()
identifier[c] . identifier[repository] = identifier[self] . identifier[url]
identifier[cfg] = identifier[c] . identifie... | def read_configuration(self):
"""
Read the PyPI access configuration as supported by distutils, getting
PyPI to do the actual work. This populates ``username``, ``password``,
``realm`` and ``url`` attributes from the configuration.
"""
# get distutils to do the work
c = self.... |
def get_extension_attribute(self, ext_name, key):
"""
Banana banana
"""
attributes = self.extension_attributes.get(ext_name)
if not attributes:
return None
return attributes.get(key) | def function[get_extension_attribute, parameter[self, ext_name, key]]:
constant[
Banana banana
]
variable[attributes] assign[=] call[name[self].extension_attributes.get, parameter[name[ext_name]]]
if <ast.UnaryOp object at 0x7da18dc980d0> begin[:]
return[constant[None]]
... | keyword[def] identifier[get_extension_attribute] ( identifier[self] , identifier[ext_name] , identifier[key] ):
literal[string]
identifier[attributes] = identifier[self] . identifier[extension_attributes] . identifier[get] ( identifier[ext_name] )
keyword[if] keyword[not] identifier[attr... | def get_extension_attribute(self, ext_name, key):
"""
Banana banana
"""
attributes = self.extension_attributes.get(ext_name)
if not attributes:
return None # depends on [control=['if'], data=[]]
return attributes.get(key) |
def error_retry_codes(self, value):
"""Set value for error_retry_codes."""
if isinstance(value, six.string_types):
value = [int(x) for x in value.split(",")]
self._set_option("error_retry_codes", value) | def function[error_retry_codes, parameter[self, value]]:
constant[Set value for error_retry_codes.]
if call[name[isinstance], parameter[name[value], name[six].string_types]] begin[:]
variable[value] assign[=] <ast.ListComp object at 0x7da1b19e5600>
call[name[self]._set_option, pa... | keyword[def] identifier[error_retry_codes] ( identifier[self] , identifier[value] ):
literal[string]
keyword[if] identifier[isinstance] ( identifier[value] , identifier[six] . identifier[string_types] ):
identifier[value] =[ identifier[int] ( identifier[x] ) keyword[for] identifier[x... | def error_retry_codes(self, value):
"""Set value for error_retry_codes."""
if isinstance(value, six.string_types):
value = [int(x) for x in value.split(',')] # depends on [control=['if'], data=[]]
self._set_option('error_retry_codes', value) |
def _aicc(model_results, nobs):
"""Compute the corrected Akaike Information Criterion"""
aic = model_results.aic
df_model = model_results.df_model + 1 # add one for constant term
return aic + 2. * df_model * (nobs / (nobs - df_model - 1.) - 1.) | def function[_aicc, parameter[model_results, nobs]]:
constant[Compute the corrected Akaike Information Criterion]
variable[aic] assign[=] name[model_results].aic
variable[df_model] assign[=] binary_operation[name[model_results].df_model + constant[1]]
return[binary_operation[name[aic] + bina... | keyword[def] identifier[_aicc] ( identifier[model_results] , identifier[nobs] ):
literal[string]
identifier[aic] = identifier[model_results] . identifier[aic]
identifier[df_model] = identifier[model_results] . identifier[df_model] + literal[int]
keyword[return] identifier[aic] + literal[int] *... | def _aicc(model_results, nobs):
"""Compute the corrected Akaike Information Criterion"""
aic = model_results.aic
df_model = model_results.df_model + 1 # add one for constant term
return aic + 2.0 * df_model * (nobs / (nobs - df_model - 1.0) - 1.0) |
def resolve_import(self, item):
"""Simulate how Python resolves imports.
Returns the filename of the source file Python would load
when processing a statement like 'import name' in the module
we're currently under.
Args:
item: An instance of ImportItem
Retu... | def function[resolve_import, parameter[self, item]]:
constant[Simulate how Python resolves imports.
Returns the filename of the source file Python would load
when processing a statement like 'import name' in the module
we're currently under.
Args:
item: An instance ... | keyword[def] identifier[resolve_import] ( identifier[self] , identifier[item] ):
literal[string]
identifier[name] = identifier[item] . identifier[name]
identifier[short_name] = keyword[None]
keyword[if] identifier[item] . identifier[is_from] keyword[and] key... | def resolve_import(self, item):
"""Simulate how Python resolves imports.
Returns the filename of the source file Python would load
when processing a statement like 'import name' in the module
we're currently under.
Args:
item: An instance of ImportItem
Returns:... |
def _get_gcloud_records(self, gcloud_zone, page_token=None):
""" Generator function which yields ResourceRecordSet for the managed
gcloud zone, until there are no more records to pull.
:param gcloud_zone: zone to pull records from
:type gcloud_zone: google.cloud.dns.ManagedZ... | def function[_get_gcloud_records, parameter[self, gcloud_zone, page_token]]:
constant[ Generator function which yields ResourceRecordSet for the managed
gcloud zone, until there are no more records to pull.
:param gcloud_zone: zone to pull records from
:type gcloud_zone: goo... | keyword[def] identifier[_get_gcloud_records] ( identifier[self] , identifier[gcloud_zone] , identifier[page_token] = keyword[None] ):
literal[string]
identifier[gcloud_iterator] = identifier[gcloud_zone] . identifier[list_resource_record_sets] (
identifier[page_token] = identifier[page_tok... | def _get_gcloud_records(self, gcloud_zone, page_token=None):
""" Generator function which yields ResourceRecordSet for the managed
gcloud zone, until there are no more records to pull.
:param gcloud_zone: zone to pull records from
:type gcloud_zone: google.cloud.dns.ManagedZone
... |
def load_into_collection_from_url(collection, url, content_type=None):
"""
Loads resources from the representation contained in the given URL into
the given collection resource.
:returns: collection resource
"""
parsed = urlparse.urlparse(url)
scheme = parsed.scheme # pylint: disable=E1101
... | def function[load_into_collection_from_url, parameter[collection, url, content_type]]:
constant[
Loads resources from the representation contained in the given URL into
the given collection resource.
:returns: collection resource
]
variable[parsed] assign[=] call[name[urlparse].urlparse... | keyword[def] identifier[load_into_collection_from_url] ( identifier[collection] , identifier[url] , identifier[content_type] = keyword[None] ):
literal[string]
identifier[parsed] = identifier[urlparse] . identifier[urlparse] ( identifier[url] )
identifier[scheme] = identifier[parsed] . identifier[sche... | def load_into_collection_from_url(collection, url, content_type=None):
"""
Loads resources from the representation contained in the given URL into
the given collection resource.
:returns: collection resource
"""
parsed = urlparse.urlparse(url)
scheme = parsed.scheme # pylint: disable=E1101... |
def add_input_endpoint(kwargs=None, conn=None, call=None):
'''
.. versionadded:: 2015.8.0
Add an input endpoint to the deployment. Please note that
there may be a delay before the changes show up.
CLI Example:
.. code-block:: bash
salt-cloud -f add_input_endpoint my-azure service=mys... | def function[add_input_endpoint, parameter[kwargs, conn, call]]:
constant[
.. versionadded:: 2015.8.0
Add an input endpoint to the deployment. Please note that
there may be a delay before the changes show up.
CLI Example:
.. code-block:: bash
salt-cloud -f add_input_endpoint my-a... | keyword[def] identifier[add_input_endpoint] ( identifier[kwargs] = keyword[None] , identifier[conn] = keyword[None] , identifier[call] = keyword[None] ):
literal[string]
keyword[return] identifier[update_input_endpoint] (
identifier[kwargs] = identifier[kwargs] ,
identifier[conn] = identifier[co... | def add_input_endpoint(kwargs=None, conn=None, call=None):
"""
.. versionadded:: 2015.8.0
Add an input endpoint to the deployment. Please note that
there may be a delay before the changes show up.
CLI Example:
.. code-block:: bash
salt-cloud -f add_input_endpoint my-azure service=mys... |
def police_priority_map_exceed_map_pri7_exceed(self, **kwargs):
"""Auto Generated Code
"""
config = ET.Element("config")
police_priority_map = ET.SubElement(config, "police-priority-map", xmlns="urn:brocade.com:mgmt:brocade-policer")
name_key = ET.SubElement(police_priority_map, ... | def function[police_priority_map_exceed_map_pri7_exceed, parameter[self]]:
constant[Auto Generated Code
]
variable[config] assign[=] call[name[ET].Element, parameter[constant[config]]]
variable[police_priority_map] assign[=] call[name[ET].SubElement, parameter[name[config], constant[poli... | keyword[def] identifier[police_priority_map_exceed_map_pri7_exceed] ( identifier[self] ,** identifier[kwargs] ):
literal[string]
identifier[config] = identifier[ET] . identifier[Element] ( literal[string] )
identifier[police_priority_map] = identifier[ET] . identifier[SubElement] ( identif... | def police_priority_map_exceed_map_pri7_exceed(self, **kwargs):
"""Auto Generated Code
"""
config = ET.Element('config')
police_priority_map = ET.SubElement(config, 'police-priority-map', xmlns='urn:brocade.com:mgmt:brocade-policer')
name_key = ET.SubElement(police_priority_map, 'name')
name... |
def read_vcf(vcf_file, ref_file):
"""
Reads in a vcf/vcf.gz file and associated
reference sequence fasta (to which the VCF file is mapped).
Parses mutations, insertions, and deletions and stores them in a nested dict,
see 'returns' for the dict structure.
Calls with heterozygous values... | def function[read_vcf, parameter[vcf_file, ref_file]]:
constant[
Reads in a vcf/vcf.gz file and associated
reference sequence fasta (to which the VCF file is mapped).
Parses mutations, insertions, and deletions and stores them in a nested dict,
see 'returns' for the dict structure.
Calls w... | keyword[def] identifier[read_vcf] ( identifier[vcf_file] , identifier[ref_file] ):
literal[string]
identifier[sequences] = identifier[defaultdict] ( identifi... | def read_vcf(vcf_file, ref_file):
"""
Reads in a vcf/vcf.gz file and associated
reference sequence fasta (to which the VCF file is mapped).
Parses mutations, insertions, and deletions and stores them in a nested dict,
see 'returns' for the dict structure.
Calls with heterozygous values 0/1, 0/... |
def verify(self, verify_key):
"""Verify that this MAR file has a valid signature.
Args:
verify_key (str): PEM formatted public key
Returns:
True if the MAR file's signature matches its contents
False otherwise; this includes cases where there is no signature... | def function[verify, parameter[self, verify_key]]:
constant[Verify that this MAR file has a valid signature.
Args:
verify_key (str): PEM formatted public key
Returns:
True if the MAR file's signature matches its contents
False otherwise; this includes cases ... | keyword[def] identifier[verify] ( identifier[self] , identifier[verify_key] ):
literal[string]
keyword[if] keyword[not] identifier[self] . identifier[mardata] . identifier[signatures] keyword[or] keyword[not] identifier[self] . identifier[mardata] . identifier[signatures] . identifier[sigs] :
... | def verify(self, verify_key):
"""Verify that this MAR file has a valid signature.
Args:
verify_key (str): PEM formatted public key
Returns:
True if the MAR file's signature matches its contents
False otherwise; this includes cases where there is no signature.
... |
def delete_user_contact_list(self, id, contact_list_id, **data):
"""
DELETE /users/:id/contact_lists/:contact_list_id/
Deletes the contact list. Returns ``{"deleted": true}``.
"""
return self.delete("/users/{0}/contact_lists/{0}/".format(id,contact_list_id), data=data) | def function[delete_user_contact_list, parameter[self, id, contact_list_id]]:
constant[
DELETE /users/:id/contact_lists/:contact_list_id/
Deletes the contact list. Returns ``{"deleted": true}``.
]
return[call[name[self].delete, parameter[call[constant[/users/{0}/contact_lists/{0}/].f... | keyword[def] identifier[delete_user_contact_list] ( identifier[self] , identifier[id] , identifier[contact_list_id] ,** identifier[data] ):
literal[string]
keyword[return] identifier[self] . identifier[delete] ( literal[string] . identifier[format] ( identifier[id] , identifier[contact_list_id] )... | def delete_user_contact_list(self, id, contact_list_id, **data):
"""
DELETE /users/:id/contact_lists/:contact_list_id/
Deletes the contact list. Returns ``{"deleted": true}``.
"""
return self.delete('/users/{0}/contact_lists/{0}/'.format(id, contact_list_id), data=data) |
def from_raw(self, rval: RawObject, jptr: JSONPointer = "") -> ObjectValue:
"""Override the superclass method."""
if not isinstance(rval, dict):
raise RawTypeError(jptr, "object")
res = ObjectValue()
for qn in rval:
if qn.startswith("@"):
if qn != ... | def function[from_raw, parameter[self, rval, jptr]]:
constant[Override the superclass method.]
if <ast.UnaryOp object at 0x7da1b02e4be0> begin[:]
<ast.Raise object at 0x7da1b02e6dd0>
variable[res] assign[=] call[name[ObjectValue], parameter[]]
for taget[name[qn]] in starred[name[... | keyword[def] identifier[from_raw] ( identifier[self] , identifier[rval] : identifier[RawObject] , identifier[jptr] : identifier[JSONPointer] = literal[string] )-> identifier[ObjectValue] :
literal[string]
keyword[if] keyword[not] identifier[isinstance] ( identifier[rval] , identifier[dict] ):
... | def from_raw(self, rval: RawObject, jptr: JSONPointer='') -> ObjectValue:
"""Override the superclass method."""
if not isinstance(rval, dict):
raise RawTypeError(jptr, 'object') # depends on [control=['if'], data=[]]
res = ObjectValue()
for qn in rval:
if qn.startswith('@'):
... |
def scaleField(self, scalingFactor):
"""
Adjust the field of the magnet by the value of ``scalingFactor``. The adjustment
is multiplicative, so a value of ``scalingFactor = 1.0`` will result in no change
of the field.
"""
self.field_strength = self.field_strength._replac... | def function[scaleField, parameter[self, scalingFactor]]:
constant[
Adjust the field of the magnet by the value of ``scalingFactor``. The adjustment
is multiplicative, so a value of ``scalingFactor = 1.0`` will result in no change
of the field.
]
name[self].field_strengt... | keyword[def] identifier[scaleField] ( identifier[self] , identifier[scalingFactor] ):
literal[string]
identifier[self] . identifier[field_strength] = identifier[self] . identifier[field_strength] . identifier[_replace] (
identifier[val] = identifier[self] . identifier[field_strength] . ide... | def scaleField(self, scalingFactor):
"""
Adjust the field of the magnet by the value of ``scalingFactor``. The adjustment
is multiplicative, so a value of ``scalingFactor = 1.0`` will result in no change
of the field.
"""
self.field_strength = self.field_strength._replace(val=se... |
def ignite(self, args=None):
"""
* Make the virtualenv
* Install dependencies into that virtualenv
* Start the program!
"""
if args is None:
args = sys.argv[1:]
if os.environ.get("MANAGED_VIRTUALENV", None) != "1":
made = self.make_virtual... | def function[ignite, parameter[self, args]]:
constant[
* Make the virtualenv
* Install dependencies into that virtualenv
* Start the program!
]
if compare[name[args] is constant[None]] begin[:]
variable[args] assign[=] call[name[sys].argv][<ast.Slice objec... | keyword[def] identifier[ignite] ( identifier[self] , identifier[args] = keyword[None] ):
literal[string]
keyword[if] identifier[args] keyword[is] keyword[None] :
identifier[args] = identifier[sys] . identifier[argv] [ literal[int] :]
keyword[if] identifier[os] . identifie... | def ignite(self, args=None):
"""
* Make the virtualenv
* Install dependencies into that virtualenv
* Start the program!
"""
if args is None:
args = sys.argv[1:] # depends on [control=['if'], data=['args']]
if os.environ.get('MANAGED_VIRTUALENV', None) != '1':
... |
def plot_winds(self, ws, wd, wsmax, plot_range=None):
"""
Required input:
ws: Wind speeds (knots)
wd: Wind direction (degrees)
wsmax: Wind gust (knots)
Optional Input:
plot_range: Data range for making figure (list of (min,max,step))
"""
... | def function[plot_winds, parameter[self, ws, wd, wsmax, plot_range]]:
constant[
Required input:
ws: Wind speeds (knots)
wd: Wind direction (degrees)
wsmax: Wind gust (knots)
Optional Input:
plot_range: Data range for making figure (list of (min,max... | keyword[def] identifier[plot_winds] ( identifier[self] , identifier[ws] , identifier[wd] , identifier[wsmax] , identifier[plot_range] = keyword[None] ):
literal[string]
identifier[self] . identifier[ax1] = identifier[fig] . identifier[add_subplot] ( literal[int] , literal[int] , literal[in... | def plot_winds(self, ws, wd, wsmax, plot_range=None):
"""
Required input:
ws: Wind speeds (knots)
wd: Wind direction (degrees)
wsmax: Wind gust (knots)
Optional Input:
plot_range: Data range for making figure (list of (min,max,step))
"""
# ... |
def getPayloadStruct(self, attributes, objType):
""" Function getPayloadStruct
Get the payload structure to do a creation or a modification
@param attribute: The data
@param objType: SubItem type (e.g: hostgroup for hostgroup_class)
@return RETURN: the payload
"""
... | def function[getPayloadStruct, parameter[self, attributes, objType]]:
constant[ Function getPayloadStruct
Get the payload structure to do a creation or a modification
@param attribute: The data
@param objType: SubItem type (e.g: hostgroup for hostgroup_class)
@return RETURN: the... | keyword[def] identifier[getPayloadStruct] ( identifier[self] , identifier[attributes] , identifier[objType] ):
literal[string]
identifier[payload] ={ identifier[self] . identifier[payloadObj] : identifier[attributes] ,
identifier[objType] + literal[string] :
{ identifier[self] . id... | def getPayloadStruct(self, attributes, objType):
""" Function getPayloadStruct
Get the payload structure to do a creation or a modification
@param attribute: The data
@param objType: SubItem type (e.g: hostgroup for hostgroup_class)
@return RETURN: the payload
"""
payloa... |
def paddingsize(self, namedstruct):
'''
Return the size of the padded struct (including the "real" size and the padding bytes)
:param namedstruct: a NamedStruct object of this type.
:returns: size including both data and padding.
'''
if self.base is not ... | def function[paddingsize, parameter[self, namedstruct]]:
constant[
Return the size of the padded struct (including the "real" size and the padding bytes)
:param namedstruct: a NamedStruct object of this type.
:returns: size including both data and padding.
]
... | keyword[def] identifier[paddingsize] ( identifier[self] , identifier[namedstruct] ):
literal[string]
keyword[if] identifier[self] . identifier[base] keyword[is] keyword[not] keyword[None] :
keyword[return] identifier[self] . identifier[base] . identifier[paddingsize] ( identifier[... | def paddingsize(self, namedstruct):
"""
Return the size of the padded struct (including the "real" size and the padding bytes)
:param namedstruct: a NamedStruct object of this type.
:returns: size including both data and padding.
"""
if self.base is not None:
... |
def filter_effect(self, analytes=None, stats=['mean', 'std'], filt=True):
"""
Quantify the effects of the active filters.
Parameters
----------
analytes : str or list
Which analytes to consider.
stats : list
Which statistics to calculate.
... | def function[filter_effect, parameter[self, analytes, stats, filt]]:
constant[
Quantify the effects of the active filters.
Parameters
----------
analytes : str or list
Which analytes to consider.
stats : list
Which statistics to calculate.... | keyword[def] identifier[filter_effect] ( identifier[self] , identifier[analytes] = keyword[None] , identifier[stats] =[ literal[string] , literal[string] ], identifier[filt] = keyword[True] ):
literal[string]
keyword[if] identifier[analytes] keyword[is] keyword[None] :
identifier[an... | def filter_effect(self, analytes=None, stats=['mean', 'std'], filt=True):
"""
Quantify the effects of the active filters.
Parameters
----------
analytes : str or list
Which analytes to consider.
stats : list
Which statistics to calculate.
... |
def replace_route(route_table_id=None, destination_cidr_block=None,
route_table_name=None, gateway_id=None,
instance_id=None, interface_id=None,
region=None, key=None, keyid=None, profile=None,
vpc_peering_connection_id=None):
'''
Replaces ... | def function[replace_route, parameter[route_table_id, destination_cidr_block, route_table_name, gateway_id, instance_id, interface_id, region, key, keyid, profile, vpc_peering_connection_id]]:
constant[
Replaces a route.
CLI Example:
.. code-block:: bash
salt myminion boto_vpc.replace_rou... | keyword[def] identifier[replace_route] ( identifier[route_table_id] = keyword[None] , identifier[destination_cidr_block] = keyword[None] ,
identifier[route_table_name] = keyword[None] , identifier[gateway_id] = keyword[None] ,
identifier[instance_id] = keyword[None] , identifier[interface_id] = keyword[None] ,
ide... | def replace_route(route_table_id=None, destination_cidr_block=None, route_table_name=None, gateway_id=None, instance_id=None, interface_id=None, region=None, key=None, keyid=None, profile=None, vpc_peering_connection_id=None):
"""
Replaces a route.
CLI Example:
.. code-block:: bash
salt mymin... |
def add_size_info (self):
"""Get size of file content and modification time from filename path."""
if self.is_directory():
# Directory size always differs from the customer index.html
# that is generated. So return without calculating any size.
return
filename... | def function[add_size_info, parameter[self]]:
constant[Get size of file content and modification time from filename path.]
if call[name[self].is_directory, parameter[]] begin[:]
return[None]
variable[filename] assign[=] call[name[self].get_os_filename, parameter[]]
name[self].siz... | keyword[def] identifier[add_size_info] ( identifier[self] ):
literal[string]
keyword[if] identifier[self] . identifier[is_directory] ():
keyword[return]
identifier[filename] = identifier[self] . identifier[get_os_filename] ()
identifier[self] . ide... | def add_size_info(self):
"""Get size of file content and modification time from filename path."""
if self.is_directory():
# Directory size always differs from the customer index.html
# that is generated. So return without calculating any size.
return # depends on [control=['if'], data=[... |
def order_modified_volume(self, volume_id, new_size=None, new_iops=None, new_tier_level=None):
"""Places an order for modifying an existing block volume.
:param volume_id: The ID of the volume to be modified
:param new_size: The new size/capacity for the volume
:param new_iops: The new ... | def function[order_modified_volume, parameter[self, volume_id, new_size, new_iops, new_tier_level]]:
constant[Places an order for modifying an existing block volume.
:param volume_id: The ID of the volume to be modified
:param new_size: The new size/capacity for the volume
:param new_io... | keyword[def] identifier[order_modified_volume] ( identifier[self] , identifier[volume_id] , identifier[new_size] = keyword[None] , identifier[new_iops] = keyword[None] , identifier[new_tier_level] = keyword[None] ):
literal[string]
identifier[mask_items] =[
literal[string] ,
lite... | def order_modified_volume(self, volume_id, new_size=None, new_iops=None, new_tier_level=None):
"""Places an order for modifying an existing block volume.
:param volume_id: The ID of the volume to be modified
:param new_size: The new size/capacity for the volume
:param new_iops: The new IOPS... |
def publish_server_closed(self, server_address, topology_id):
"""Publish a ServerClosedEvent to all server listeners.
:Parameters:
- `server_address`: The address (host/port pair) of the server.
- `topology_id`: A unique identifier for the topology this server
is a part of.... | def function[publish_server_closed, parameter[self, server_address, topology_id]]:
constant[Publish a ServerClosedEvent to all server listeners.
:Parameters:
- `server_address`: The address (host/port pair) of the server.
- `topology_id`: A unique identifier for the topology this serv... | keyword[def] identifier[publish_server_closed] ( identifier[self] , identifier[server_address] , identifier[topology_id] ):
literal[string]
identifier[event] = identifier[ServerClosedEvent] ( identifier[server_address] , identifier[topology_id] )
keyword[for] identifier[subscriber] keywo... | def publish_server_closed(self, server_address, topology_id):
"""Publish a ServerClosedEvent to all server listeners.
:Parameters:
- `server_address`: The address (host/port pair) of the server.
- `topology_id`: A unique identifier for the topology this server
is a part of.
... |
def pop_result(self, key):
"""Returns the result for ``key`` and unregisters it."""
self.pending_callbacks.remove(key)
return self.results.pop(key) | def function[pop_result, parameter[self, key]]:
constant[Returns the result for ``key`` and unregisters it.]
call[name[self].pending_callbacks.remove, parameter[name[key]]]
return[call[name[self].results.pop, parameter[name[key]]]] | keyword[def] identifier[pop_result] ( identifier[self] , identifier[key] ):
literal[string]
identifier[self] . identifier[pending_callbacks] . identifier[remove] ( identifier[key] )
keyword[return] identifier[self] . identifier[results] . identifier[pop] ( identifier[key] ) | def pop_result(self, key):
"""Returns the result for ``key`` and unregisters it."""
self.pending_callbacks.remove(key)
return self.results.pop(key) |
def init_batch(raw_constraints: List[Optional[RawConstraintList]],
beam_size: int,
start_id: int,
eos_id: int) -> List[Optional[ConstrainedHypothesis]]:
"""
:param raw_constraints: The list of raw constraints (list of list of IDs).
:param beam_size: The beam size... | def function[init_batch, parameter[raw_constraints, beam_size, start_id, eos_id]]:
constant[
:param raw_constraints: The list of raw constraints (list of list of IDs).
:param beam_size: The beam size.
:param start_id: The target-language vocabulary ID of the SOS symbol.
:param eos_id: The target... | keyword[def] identifier[init_batch] ( identifier[raw_constraints] : identifier[List] [ identifier[Optional] [ identifier[RawConstraintList] ]],
identifier[beam_size] : identifier[int] ,
identifier[start_id] : identifier[int] ,
identifier[eos_id] : identifier[int] )-> identifier[List] [ identifier[Optional] [ ident... | def init_batch(raw_constraints: List[Optional[RawConstraintList]], beam_size: int, start_id: int, eos_id: int) -> List[Optional[ConstrainedHypothesis]]:
"""
:param raw_constraints: The list of raw constraints (list of list of IDs).
:param beam_size: The beam size.
:param start_id: The target-language vo... |
def do_authenticate_account(self, authc_token):
"""
Returns an account object only when the current token authenticates AND
the authentication process is complete, raising otherwise
:returns: Account
:raises AdditionalAuthenticationRequired: when additional tokens are required,... | def function[do_authenticate_account, parameter[self, authc_token]]:
constant[
Returns an account object only when the current token authenticates AND
the authentication process is complete, raising otherwise
:returns: Account
:raises AdditionalAuthenticationRequired: when addi... | keyword[def] identifier[do_authenticate_account] ( identifier[self] , identifier[authc_token] ):
literal[string]
keyword[try] :
identifier[realms] = identifier[self] . identifier[token_realm_resolver] [ identifier[authc_token] . identifier[__class__] ]
keyword[except] identif... | def do_authenticate_account(self, authc_token):
"""
Returns an account object only when the current token authenticates AND
the authentication process is complete, raising otherwise
:returns: Account
:raises AdditionalAuthenticationRequired: when additional tokens are required,
... |
def _get_upsert_fields(self, kwargs):
"""Gets the fields to use in an upsert.
This some nice magic. We'll split the fields into
a group of "insert fields" and "update fields":
INSERT INTO bla ("val1", "val2") ON CONFLICT DO UPDATE SET val1 = EXCLUDED.val1
^^^^... | def function[_get_upsert_fields, parameter[self, kwargs]]:
constant[Gets the fields to use in an upsert.
This some nice magic. We'll split the fields into
a group of "insert fields" and "update fields":
INSERT INTO bla ("val1", "val2") ON CONFLICT DO UPDATE SET val1 = EXCLUDED.val1
... | keyword[def] identifier[_get_upsert_fields] ( identifier[self] , identifier[kwargs] ):
literal[string]
identifier[model_instance] = identifier[self] . identifier[model] (** identifier[kwargs] )
identifier[insert_fields] =[]
identifier[update_fields] =[]
keyword[for] id... | def _get_upsert_fields(self, kwargs):
"""Gets the fields to use in an upsert.
This some nice magic. We'll split the fields into
a group of "insert fields" and "update fields":
INSERT INTO bla ("val1", "val2") ON CONFLICT DO UPDATE SET val1 = EXCLUDED.val1
^^^^^^^^... |
def json(self):
''' If the ``Content-Type`` header is ``application/json``, this
property holds the parsed content of the request body. Only requests
smaller than :attr:`MEMFILE_MAX` are processed to avoid memory
exhaustion. '''
ctype = self.environ.get('CONTENT_TYPE'... | def function[json, parameter[self]]:
constant[ If the ``Content-Type`` header is ``application/json``, this
property holds the parsed content of the request body. Only requests
smaller than :attr:`MEMFILE_MAX` are processed to avoid memory
exhaustion. ]
variable[ctype... | keyword[def] identifier[json] ( identifier[self] ):
literal[string]
identifier[ctype] = identifier[self] . identifier[environ] . identifier[get] ( literal[string] , literal[string] ). identifier[lower] (). identifier[split] ( literal[string] )[ literal[int] ]
keyword[if] identifier[ctype]... | def json(self):
""" If the ``Content-Type`` header is ``application/json``, this
property holds the parsed content of the request body. Only requests
smaller than :attr:`MEMFILE_MAX` are processed to avoid memory
exhaustion. """
ctype = self.environ.get('CONTENT_TYPE', '').lo... |
def commit(self, container, repository=None, tag=None, message=None,
author=None, changes=None, conf=None):
"""
Commit a container to an image. Similar to the ``docker commit``
command.
Args:
container (str): The image hash of the container
reposit... | def function[commit, parameter[self, container, repository, tag, message, author, changes, conf]]:
constant[
Commit a container to an image. Similar to the ``docker commit``
command.
Args:
container (str): The image hash of the container
repository (str): The rep... | keyword[def] identifier[commit] ( identifier[self] , identifier[container] , identifier[repository] = keyword[None] , identifier[tag] = keyword[None] , identifier[message] = keyword[None] ,
identifier[author] = keyword[None] , identifier[changes] = keyword[None] , identifier[conf] = keyword[None] ):
literal... | def commit(self, container, repository=None, tag=None, message=None, author=None, changes=None, conf=None):
"""
Commit a container to an image. Similar to the ``docker commit``
command.
Args:
container (str): The image hash of the container
repository (str): The repo... |
def get_account(self, address, token_type):
"""
Get the state of an account for a given token type
"""
cur = self.db.cursor()
return namedb_get_account(cur, address, token_type) | def function[get_account, parameter[self, address, token_type]]:
constant[
Get the state of an account for a given token type
]
variable[cur] assign[=] call[name[self].db.cursor, parameter[]]
return[call[name[namedb_get_account], parameter[name[cur], name[address], name[token_type]]]... | keyword[def] identifier[get_account] ( identifier[self] , identifier[address] , identifier[token_type] ):
literal[string]
identifier[cur] = identifier[self] . identifier[db] . identifier[cursor] ()
keyword[return] identifier[namedb_get_account] ( identifier[cur] , identifier[address] , id... | def get_account(self, address, token_type):
"""
Get the state of an account for a given token type
"""
cur = self.db.cursor()
return namedb_get_account(cur, address, token_type) |
def threadsafe_call(self, fn, *args, **kwargs):
"""Wrapper around `AsyncSession.threadsafe_call`."""
def handler():
try:
fn(*args, **kwargs)
except Exception:
warn("error caught while excecuting async callback\n%s\n",
format_ex... | def function[threadsafe_call, parameter[self, fn]]:
constant[Wrapper around `AsyncSession.threadsafe_call`.]
def function[handler, parameter[]]:
<ast.Try object at 0x7da1b22afcd0>
def function[greenlet_wrapper, parameter[]]:
variable[gr] assign[=] call[name[greenlet].gree... | keyword[def] identifier[threadsafe_call] ( identifier[self] , identifier[fn] ,* identifier[args] ,** identifier[kwargs] ):
literal[string]
keyword[def] identifier[handler] ():
keyword[try] :
identifier[fn] (* identifier[args] ,** identifier[kwargs] )
keyw... | def threadsafe_call(self, fn, *args, **kwargs):
"""Wrapper around `AsyncSession.threadsafe_call`."""
def handler():
try:
fn(*args, **kwargs) # depends on [control=['try'], data=[]]
except Exception:
warn('error caught while excecuting async callback\n%s\n', format_exc()... |
def sign(node=None):
""" Sign a specific node to grant it access
you can specify "all" to sign all nodes
returns the nodes that were signed
"""
if not node:
raise Exception("Specify either 'all' your specify token/host_name of node to sign. ")
if node == 'all':
node = 'unsign... | def function[sign, parameter[node]]:
constant[ Sign a specific node to grant it access
you can specify "all" to sign all nodes
returns the nodes that were signed
]
if <ast.UnaryOp object at 0x7da18dc06ec0> begin[:]
<ast.Raise object at 0x7da18dc07f40>
if compare[name[node... | keyword[def] identifier[sign] ( identifier[node] = keyword[None] ):
literal[string]
keyword[if] keyword[not] identifier[node] :
keyword[raise] identifier[Exception] ( literal[string] )
keyword[if] identifier[node] == literal[string] :
identifier[node] = literal[string]
iden... | def sign(node=None):
""" Sign a specific node to grant it access
you can specify "all" to sign all nodes
returns the nodes that were signed
"""
if not node:
raise Exception("Specify either 'all' your specify token/host_name of node to sign. ") # depends on [control=['if'], data=[]]
... |
def _generate_examples(self, split_subsets, extraction_map):
"""Returns the examples in the raw (text) form."""
source, _ = self.builder_config.language_pair
def _get_local_paths(ds, extract_dirs):
rel_paths = ds.get_path(source)
if len(extract_dirs) == 1:
extract_dirs = extract_dirs * ... | def function[_generate_examples, parameter[self, split_subsets, extraction_map]]:
constant[Returns the examples in the raw (text) form.]
<ast.Tuple object at 0x7da1b20c8c10> assign[=] name[self].builder_config.language_pair
def function[_get_local_paths, parameter[ds, extract_dirs]]:
... | keyword[def] identifier[_generate_examples] ( identifier[self] , identifier[split_subsets] , identifier[extraction_map] ):
literal[string]
identifier[source] , identifier[_] = identifier[self] . identifier[builder_config] . identifier[language_pair]
keyword[def] identifier[_get_local_paths] ( ident... | def _generate_examples(self, split_subsets, extraction_map):
"""Returns the examples in the raw (text) form."""
(source, _) = self.builder_config.language_pair
def _get_local_paths(ds, extract_dirs):
rel_paths = ds.get_path(source)
if len(extract_dirs) == 1:
extract_dirs = extra... |
def get_all_file_report_pages(self, query):
""" Get File Report (All Pages).
:param query: a VirusTotal Intelligence search string in accordance with the file search documentation.
:return: All JSON responses appended together.
"""
responses = []
next_page, response = se... | def function[get_all_file_report_pages, parameter[self, query]]:
constant[ Get File Report (All Pages).
:param query: a VirusTotal Intelligence search string in accordance with the file search documentation.
:return: All JSON responses appended together.
]
variable[responses] as... | keyword[def] identifier[get_all_file_report_pages] ( identifier[self] , identifier[query] ):
literal[string]
identifier[responses] =[]
identifier[next_page] , identifier[response] = identifier[self] . identifier[get_hashes_from_search] ( identifier[self] , identifier[query] )
iden... | def get_all_file_report_pages(self, query):
""" Get File Report (All Pages).
:param query: a VirusTotal Intelligence search string in accordance with the file search documentation.
:return: All JSON responses appended together.
"""
responses = []
(next_page, response) = self.get_has... |
def decrypt_attributes(self, attribute_statement):
"""
Decrypts possible encrypted attributes and adds the decrypts to the
list of attributes.
:param attribute_statement: A SAML.AttributeStatement which might
contain both encrypted attributes and attributes.
"""
... | def function[decrypt_attributes, parameter[self, attribute_statement]]:
constant[
Decrypts possible encrypted attributes and adds the decrypts to the
list of attributes.
:param attribute_statement: A SAML.AttributeStatement which might
contain both encrypted attributes and a... | keyword[def] identifier[decrypt_attributes] ( identifier[self] , identifier[attribute_statement] ):
literal[string]
keyword[for] identifier[encattr] keyword[in] identifier[attribute_statement] . identifier[encrypted_attribute] :
keyword[if] keyword[not] ... | def decrypt_attributes(self, attribute_statement):
"""
Decrypts possible encrypted attributes and adds the decrypts to the
list of attributes.
:param attribute_statement: A SAML.AttributeStatement which might
contain both encrypted attributes and attributes.
"""
# ... |
def _dens(self, R, z, phi=0, t=0):
"""
NAME:
_dens
PURPOSE:
Evaluate the density. If not given, the density is computed using the Poisson equation
from the first and second derivatives of the potential (if all are implemented).
INPUT:
:para... | def function[_dens, parameter[self, R, z, phi, t]]:
constant[
NAME:
_dens
PURPOSE:
Evaluate the density. If not given, the density is computed using the Poisson equation
from the first and second derivatives of the potential (if all are implemented).
I... | keyword[def] identifier[_dens] ( identifier[self] , identifier[R] , identifier[z] , identifier[phi] = literal[int] , identifier[t] = literal[int] ):
literal[string]
identifier[g] = identifier[self] . identifier[_gamma] ( identifier[R] , identifier[phi] - identifier[self] . identifier[_omega] * ide... | def _dens(self, R, z, phi=0, t=0):
"""
NAME:
_dens
PURPOSE:
Evaluate the density. If not given, the density is computed using the Poisson equation
from the first and second derivatives of the potential (if all are implemented).
INPUT:
:param R:... |
def fetchEC2InstanceDict(regionNickname=None):
"""
Fetches EC2 instances types by region programmatically using the AWS pricing API.
See: https://aws.amazon.com/blogs/aws/new-aws-price-list-api/
:return: A dict of InstanceType objects, where the key is the string:
aws instance name (examp... | def function[fetchEC2InstanceDict, parameter[regionNickname]]:
constant[
Fetches EC2 instances types by region programmatically using the AWS pricing API.
See: https://aws.amazon.com/blogs/aws/new-aws-price-list-api/
:return: A dict of InstanceType objects, where the key is the string:
... | keyword[def] identifier[fetchEC2InstanceDict] ( identifier[regionNickname] = keyword[None] ):
literal[string]
identifier[ec2Source] = literal[string]
keyword[if] identifier[regionNickname] keyword[is] keyword[None] :
identifier[regionNickname] = literal[string]
identifier[region] = ... | def fetchEC2InstanceDict(regionNickname=None):
"""
Fetches EC2 instances types by region programmatically using the AWS pricing API.
See: https://aws.amazon.com/blogs/aws/new-aws-price-list-api/
:return: A dict of InstanceType objects, where the key is the string:
aws instance name (examp... |
def py_to_weld_type(self, obj):
"""Summary
Args:
obj (TYPE): Description
Returns:
TYPE: Description
Raises:
Exception: Description
"""
if isinstance(obj, np.ndarray):
dtype = str(obj.dtype)
if dtype == 'int16'... | def function[py_to_weld_type, parameter[self, obj]]:
constant[Summary
Args:
obj (TYPE): Description
Returns:
TYPE: Description
Raises:
Exception: Description
]
if call[name[isinstance], parameter[name[obj], name[np].ndarray]] begin[:... | keyword[def] identifier[py_to_weld_type] ( identifier[self] , identifier[obj] ):
literal[string]
keyword[if] identifier[isinstance] ( identifier[obj] , identifier[np] . identifier[ndarray] ):
identifier[dtype] = identifier[str] ( identifier[obj] . identifier[dtype] )
keyw... | def py_to_weld_type(self, obj):
"""Summary
Args:
obj (TYPE): Description
Returns:
TYPE: Description
Raises:
Exception: Description
"""
if isinstance(obj, np.ndarray):
dtype = str(obj.dtype)
if dtype == 'int16':
ba... |
def mkparam(self, method, pdef, object):
"""
Builds a parameter for the specified I{method} using the parameter
definition (pdef) and the specified value (object).
@param method: A method name.
@type method: str
@param pdef: A parameter definition.
@type pdef: tup... | def function[mkparam, parameter[self, method, pdef, object]]:
constant[
Builds a parameter for the specified I{method} using the parameter
definition (pdef) and the specified value (object).
@param method: A method name.
@type method: str
@param pdef: A parameter definiti... | keyword[def] identifier[mkparam] ( identifier[self] , identifier[method] , identifier[pdef] , identifier[object] ):
literal[string]
identifier[marshaller] = identifier[self] . identifier[marshaller] ()
identifier[content] = identifier[Content] ( identifier[tag] = identifier[pdef] [ literal... | def mkparam(self, method, pdef, object):
"""
Builds a parameter for the specified I{method} using the parameter
definition (pdef) and the specified value (object).
@param method: A method name.
@type method: str
@param pdef: A parameter definition.
@type pdef: tuple: ... |
def login(self):
"""
登陆系统,返回一个requests的session对象
:return: session with login cookies
:rtype: requests.sessions.Session
"""
if not hasattr(self, 'session'):
self.last_connect = time.time()
s = requests.session()
s.get('http://bkjws.sdu.... | def function[login, parameter[self]]:
constant[
登陆系统,返回一个requests的session对象
:return: session with login cookies
:rtype: requests.sessions.Session
]
if <ast.UnaryOp object at 0x7da20e9626b0> begin[:]
name[self].last_connect assign[=] call[name[time].time, ... | keyword[def] identifier[login] ( identifier[self] ):
literal[string]
keyword[if] keyword[not] identifier[hasattr] ( identifier[self] , literal[string] ):
identifier[self] . identifier[last_connect] = identifier[time] . identifier[time] ()
identifier[s] = identifier[reque... | def login(self):
"""
登陆系统,返回一个requests的session对象
:return: session with login cookies
:rtype: requests.sessions.Session
"""
if not hasattr(self, 'session'):
self.last_connect = time.time()
s = requests.session()
s.get('http://bkjws.sdu.edu.cn')
dat... |
def simulate_async_event():
"""Simulate an asynchronous event."""
scc.state = 'executing'
def async_event(result):
"""All other asynchronous events or function calls
returned from later steps will wait until this
callback fires."""
scc.state = result
return 'some even... | def function[simulate_async_event, parameter[]]:
constant[Simulate an asynchronous event.]
name[scc].state assign[=] constant[executing]
def function[async_event, parameter[result]]:
constant[All other asynchronous events or function calls
returned from later steps will w... | keyword[def] identifier[simulate_async_event] ():
literal[string]
identifier[scc] . identifier[state] = literal[string]
keyword[def] identifier[async_event] ( identifier[result] ):
literal[string]
identifier[scc] . identifier[state] = identifier[result]
keyword[return] ... | def simulate_async_event():
"""Simulate an asynchronous event."""
scc.state = 'executing'
def async_event(result):
"""All other asynchronous events or function calls
returned from later steps will wait until this
callback fires."""
scc.state = result
return 'some eve... |
def set_command(value, parameter):
"""
Executor for `globus config set`
"""
conf = get_config_obj()
section = "cli"
if "." in parameter:
section, parameter = parameter.split(".", 1)
# ensure that the section exists
if section not in conf:
conf[section] = {}
# set th... | def function[set_command, parameter[value, parameter]]:
constant[
Executor for `globus config set`
]
variable[conf] assign[=] call[name[get_config_obj], parameter[]]
variable[section] assign[=] constant[cli]
if compare[constant[.] in name[parameter]] begin[:]
<ast... | keyword[def] identifier[set_command] ( identifier[value] , identifier[parameter] ):
literal[string]
identifier[conf] = identifier[get_config_obj] ()
identifier[section] = literal[string]
keyword[if] literal[string] keyword[in] identifier[parameter] :
identifier[section] , identifier... | def set_command(value, parameter):
"""
Executor for `globus config set`
"""
conf = get_config_obj()
section = 'cli'
if '.' in parameter:
(section, parameter) = parameter.split('.', 1) # depends on [control=['if'], data=['parameter']]
# ensure that the section exists
if section n... |
def setCard(self, name, value, add_quotes=False):
"""
Adds/updates card for gssha project file
Args:
name (str): Name of card to be updated/added.
value (str): Value to attach to the card.
add_quotes (Optional[bool]): If True, will add quotes around string. D... | def function[setCard, parameter[self, name, value, add_quotes]]:
constant[
Adds/updates card for gssha project file
Args:
name (str): Name of card to be updated/added.
value (str): Value to attach to the card.
add_quotes (Optional[bool]): If True, will add qu... | keyword[def] identifier[setCard] ( identifier[self] , identifier[name] , identifier[value] , identifier[add_quotes] = keyword[False] ):
literal[string]
identifier[gssha_card] = identifier[self] . identifier[getCard] ( identifier[name] )
keyword[if] identifier[add_quotes] :
i... | def setCard(self, name, value, add_quotes=False):
"""
Adds/updates card for gssha project file
Args:
name (str): Name of card to be updated/added.
value (str): Value to attach to the card.
add_quotes (Optional[bool]): If True, will add quotes around string. Defau... |
def get_list(self, name):
'''Return all the values for given name.'''
normalized_name = normalize_name(name, self._normalize_overrides)
return self._map[normalized_name] | def function[get_list, parameter[self, name]]:
constant[Return all the values for given name.]
variable[normalized_name] assign[=] call[name[normalize_name], parameter[name[name], name[self]._normalize_overrides]]
return[call[name[self]._map][name[normalized_name]]] | keyword[def] identifier[get_list] ( identifier[self] , identifier[name] ):
literal[string]
identifier[normalized_name] = identifier[normalize_name] ( identifier[name] , identifier[self] . identifier[_normalize_overrides] )
keyword[return] identifier[self] . identifier[_map] [ identifier[n... | def get_list(self, name):
"""Return all the values for given name."""
normalized_name = normalize_name(name, self._normalize_overrides)
return self._map[normalized_name] |
def main():
"""
Example of self documenting (of sorts) code, via aikif.
Simply call functions like below to build an overview
which has metadata automatically updated.
"""
fldr = mod_cfg.fldrs['program_path']
p = mod_prg.Programs('AIKIF Programs', fldr)
document_core_programs(p)
do... | def function[main, parameter[]]:
constant[
Example of self documenting (of sorts) code, via aikif.
Simply call functions like below to build an overview
which has metadata automatically updated.
]
variable[fldr] assign[=] call[name[mod_cfg].fldrs][constant[program_path]]
variabl... | keyword[def] identifier[main] ():
literal[string]
identifier[fldr] = identifier[mod_cfg] . identifier[fldrs] [ literal[string] ]
identifier[p] = identifier[mod_prg] . identifier[Programs] ( literal[string] , identifier[fldr] )
identifier[document_core_programs] ( identifier[p] )
identifier[d... | def main():
"""
Example of self documenting (of sorts) code, via aikif.
Simply call functions like below to build an overview
which has metadata automatically updated.
"""
fldr = mod_cfg.fldrs['program_path']
p = mod_prg.Programs('AIKIF Programs', fldr)
document_core_programs(p)
doc... |
def _finalize_cwl_in(data, work_dir, passed_keys, output_cwl_keys, runtime):
"""Finalize data object with inputs from CWL.
"""
data["dirs"] = {"work": work_dir}
if not tz.get_in(["config", "algorithm"], data):
if "config" not in data:
data["config"] = {}
data["config"]["algor... | def function[_finalize_cwl_in, parameter[data, work_dir, passed_keys, output_cwl_keys, runtime]]:
constant[Finalize data object with inputs from CWL.
]
call[name[data]][constant[dirs]] assign[=] dictionary[[<ast.Constant object at 0x7da1b1897910>], [<ast.Name object at 0x7da1b1897fa0>]]
if <... | keyword[def] identifier[_finalize_cwl_in] ( identifier[data] , identifier[work_dir] , identifier[passed_keys] , identifier[output_cwl_keys] , identifier[runtime] ):
literal[string]
identifier[data] [ literal[string] ]={ literal[string] : identifier[work_dir] }
keyword[if] keyword[not] identifier[tz]... | def _finalize_cwl_in(data, work_dir, passed_keys, output_cwl_keys, runtime):
"""Finalize data object with inputs from CWL.
"""
data['dirs'] = {'work': work_dir}
if not tz.get_in(['config', 'algorithm'], data):
if 'config' not in data:
data['config'] = {} # depends on [control=['if']... |
def get_dummy_distribution():
"""
Returns a distutils Distribution object used to instrument the setup
environment before calling the actual setup() function.
"""
from .setup_helpers import _module_state
if _module_state['registered_commands'] is None:
raise RuntimeError(
'... | def function[get_dummy_distribution, parameter[]]:
constant[
Returns a distutils Distribution object used to instrument the setup
environment before calling the actual setup() function.
]
from relative_module[setup_helpers] import module[_module_state]
if compare[call[name[_module_state]... | keyword[def] identifier[get_dummy_distribution] ():
literal[string]
keyword[from] . identifier[setup_helpers] keyword[import] identifier[_module_state]
keyword[if] identifier[_module_state] [ literal[string] ] keyword[is] keyword[None] :
keyword[raise] identifier[RuntimeError] (
... | def get_dummy_distribution():
"""
Returns a distutils Distribution object used to instrument the setup
environment before calling the actual setup() function.
"""
from .setup_helpers import _module_state
if _module_state['registered_commands'] is None:
raise RuntimeError('astropy_helpers... |
def renamed(self, name):
"""
Duplicate the datum and rename it
"""
duplicate = copy(self)
duplicate._name = name
return duplicate | def function[renamed, parameter[self, name]]:
constant[
Duplicate the datum and rename it
]
variable[duplicate] assign[=] call[name[copy], parameter[name[self]]]
name[duplicate]._name assign[=] name[name]
return[name[duplicate]] | keyword[def] identifier[renamed] ( identifier[self] , identifier[name] ):
literal[string]
identifier[duplicate] = identifier[copy] ( identifier[self] )
identifier[duplicate] . identifier[_name] = identifier[name]
keyword[return] identifier[duplicate] | def renamed(self, name):
"""
Duplicate the datum and rename it
"""
duplicate = copy(self)
duplicate._name = name
return duplicate |
def simxAddStatusbarMessage(clientID, message, operationMode):
'''
Please have a look at the function description/documentation in the V-REP user manual
'''
if (sys.version_info[0] == 3) and (type(message) is str):
message=message.encode('utf-8')
return c_AddStatusbarMessage(clientID, messa... | def function[simxAddStatusbarMessage, parameter[clientID, message, operationMode]]:
constant[
Please have a look at the function description/documentation in the V-REP user manual
]
if <ast.BoolOp object at 0x7da207f000d0> begin[:]
variable[message] assign[=] call[name[message].e... | keyword[def] identifier[simxAddStatusbarMessage] ( identifier[clientID] , identifier[message] , identifier[operationMode] ):
literal[string]
keyword[if] ( identifier[sys] . identifier[version_info] [ literal[int] ]== literal[int] ) keyword[and] ( identifier[type] ( identifier[message] ) keyword[is] ident... | def simxAddStatusbarMessage(clientID, message, operationMode):
"""
Please have a look at the function description/documentation in the V-REP user manual
"""
if sys.version_info[0] == 3 and type(message) is str:
message = message.encode('utf-8') # depends on [control=['if'], data=[]]
return ... |
def find_config_files(self):
"""Find as many configuration files as should be processed for this
platform, and return a list of filenames in the order in which they
should be parsed. The filenames returned are guaranteed to exist
(modulo nasty race conditions).
There are three possible config file... | def function[find_config_files, parameter[self]]:
constant[Find as many configuration files as should be processed for this
platform, and return a list of filenames in the order in which they
should be parsed. The filenames returned are guaranteed to exist
(modulo nasty race conditions).
There... | keyword[def] identifier[find_config_files] ( identifier[self] ):
literal[string]
identifier[files] =[]
identifier[check_environ] ()
identifier[sys_dir] = identifier[os] . identifier[path] . identifier[dirname] ( identifier[sys] . identifier[modules] [ literal[string] ]. identifier[__file__... | def find_config_files(self):
"""Find as many configuration files as should be processed for this
platform, and return a list of filenames in the order in which they
should be parsed. The filenames returned are guaranteed to exist
(modulo nasty race conditions).
There are three possible config file... |
def create_resource_group(access_token, subscription_id, rgname, location):
'''Create a resource group in the specified location.
Args:
access_token (str): A valid Azure authentication token.
subscription_id (str): Azure subscription id.
rgname (str): Azure resource group name.
... | def function[create_resource_group, parameter[access_token, subscription_id, rgname, location]]:
constant[Create a resource group in the specified location.
Args:
access_token (str): A valid Azure authentication token.
subscription_id (str): Azure subscription id.
rgname (str): Azur... | keyword[def] identifier[create_resource_group] ( identifier[access_token] , identifier[subscription_id] , identifier[rgname] , identifier[location] ):
literal[string]
identifier[endpoint] = literal[string] . identifier[join] ([ identifier[get_rm_endpoint] (),
literal[string] , identifier[subscription_... | def create_resource_group(access_token, subscription_id, rgname, location):
"""Create a resource group in the specified location.
Args:
access_token (str): A valid Azure authentication token.
subscription_id (str): Azure subscription id.
rgname (str): Azure resource group name.
... |
def add(self, p_src):
"""
Given a todo string, parse it and put it to the end of the list.
"""
todos = self.add_list([p_src])
return todos[0] if len(todos) else None | def function[add, parameter[self, p_src]]:
constant[
Given a todo string, parse it and put it to the end of the list.
]
variable[todos] assign[=] call[name[self].add_list, parameter[list[[<ast.Name object at 0x7da18eb56440>]]]]
return[<ast.IfExp object at 0x7da18eb55810>] | keyword[def] identifier[add] ( identifier[self] , identifier[p_src] ):
literal[string]
identifier[todos] = identifier[self] . identifier[add_list] ([ identifier[p_src] ])
keyword[return] identifier[todos] [ literal[int] ] keyword[if] identifier[len] ( identifier[todos] ) keyword[else] ... | def add(self, p_src):
"""
Given a todo string, parse it and put it to the end of the list.
"""
todos = self.add_list([p_src])
return todos[0] if len(todos) else None |
def safe_dump(data):
"""
Dump the provided data to a YAML document and returns a string.
:param data: A string containing an absolute path to the file to parse.
:return: str
"""
# TODO(retr0h): Do we need to encode?
# yaml.dump(data) produces the document as a str object in both python
... | def function[safe_dump, parameter[data]]:
constant[
Dump the provided data to a YAML document and returns a string.
:param data: A string containing an absolute path to the file to parse.
:return: str
]
return[call[name[yaml].dump, parameter[name[data]]]] | keyword[def] identifier[safe_dump] ( identifier[data] ):
literal[string]
keyword[return] identifier[yaml] . identifier[dump] (
identifier[data] , identifier[Dumper] = identifier[SafeDumper] , identifier[default_flow_style] = keyword[False] , identifier[explicit_start] = keyword[True] ) | def safe_dump(data):
"""
Dump the provided data to a YAML document and returns a string.
:param data: A string containing an absolute path to the file to parse.
:return: str
"""
# TODO(retr0h): Do we need to encode?
# yaml.dump(data) produces the document as a str object in both python
... |
def param_defs(self, method):
"""Get parameter definitions for document literal."""
pts = self.bodypart_types(method)
if not method.soap.input.body.wrapped:
return pts
pt = pts[0][1].resolve()
return [(c.name, c, a) for c, a in pt if not c.isattr()] | def function[param_defs, parameter[self, method]]:
constant[Get parameter definitions for document literal.]
variable[pts] assign[=] call[name[self].bodypart_types, parameter[name[method]]]
if <ast.UnaryOp object at 0x7da18f722a10> begin[:]
return[name[pts]]
variable[pt] assign[=... | keyword[def] identifier[param_defs] ( identifier[self] , identifier[method] ):
literal[string]
identifier[pts] = identifier[self] . identifier[bodypart_types] ( identifier[method] )
keyword[if] keyword[not] identifier[method] . identifier[soap] . identifier[input] . identifier[body] . id... | def param_defs(self, method):
"""Get parameter definitions for document literal."""
pts = self.bodypart_types(method)
if not method.soap.input.body.wrapped:
return pts # depends on [control=['if'], data=[]]
pt = pts[0][1].resolve()
return [(c.name, c, a) for (c, a) in pt if not c.isattr()] |
def start_packet_groups(self, clear_time_stamps=True, *ports):
""" Start packet groups on ports.
:param clear_time_stamps: True - clear time stamps, False - don't.
:param ports: list of ports to start traffic on, if empty start on all ports.
"""
port_list = self.set_ports_list(*... | def function[start_packet_groups, parameter[self, clear_time_stamps]]:
constant[ Start packet groups on ports.
:param clear_time_stamps: True - clear time stamps, False - don't.
:param ports: list of ports to start traffic on, if empty start on all ports.
]
variable[port_list] a... | keyword[def] identifier[start_packet_groups] ( identifier[self] , identifier[clear_time_stamps] = keyword[True] ,* identifier[ports] ):
literal[string]
identifier[port_list] = identifier[self] . identifier[set_ports_list] (* identifier[ports] )
keyword[if] identifier[clear_time_stamps] :
... | def start_packet_groups(self, clear_time_stamps=True, *ports):
""" Start packet groups on ports.
:param clear_time_stamps: True - clear time stamps, False - don't.
:param ports: list of ports to start traffic on, if empty start on all ports.
"""
port_list = self.set_ports_list(*ports)
... |
def create_table_service(self):
'''
Creates a TableService object with the settings specified in the
CloudStorageAccount.
:return: A service object.
:rtype: :class:`~azure.storage.table.tableservice.TableService`
'''
try:
from ..table.tableservice im... | def function[create_table_service, parameter[self]]:
constant[
Creates a TableService object with the settings specified in the
CloudStorageAccount.
:return: A service object.
:rtype: :class:`~azure.storage.table.tableservice.TableService`
]
<ast.Try object at 0x7da... | keyword[def] identifier[create_table_service] ( identifier[self] ):
literal[string]
keyword[try] :
keyword[from] .. identifier[table] . identifier[tableservice] keyword[import] identifier[TableService]
keyword[return] identifier[TableService] ( identifier[self] . ident... | def create_table_service(self):
"""
Creates a TableService object with the settings specified in the
CloudStorageAccount.
:return: A service object.
:rtype: :class:`~azure.storage.table.tableservice.TableService`
"""
try:
from ..table.tableservice import TableSe... |
def cell_start(self, cell, cell_index=None, **kwargs):
"""
Set and save a cell's start state.
Optionally called by engines during execution to initialize the
metadata for a cell and save the notebook to the output path.
"""
if self.log_output:
ceel_num = cell... | def function[cell_start, parameter[self, cell, cell_index]]:
constant[
Set and save a cell's start state.
Optionally called by engines during execution to initialize the
metadata for a cell and save the notebook to the output path.
]
if name[self].log_output begin[:]
... | keyword[def] identifier[cell_start] ( identifier[self] , identifier[cell] , identifier[cell_index] = keyword[None] ,** identifier[kwargs] ):
literal[string]
keyword[if] identifier[self] . identifier[log_output] :
identifier[ceel_num] = identifier[cell_index] + literal[int] keyword[if... | def cell_start(self, cell, cell_index=None, **kwargs):
"""
Set and save a cell's start state.
Optionally called by engines during execution to initialize the
metadata for a cell and save the notebook to the output path.
"""
if self.log_output:
ceel_num = cell_index + 1 i... |
def _emit_twisted(signal, *args, **kwargs):
"""
Emits a single signal to call callbacks registered to respond to that signal.
Optionally accepts args and kwargs that are passed directly to callbacks.
:param signal: Signal to send
"""
errback = kwargs.pop('errback', lambda f: f)
dl = []
... | def function[_emit_twisted, parameter[signal]]:
constant[
Emits a single signal to call callbacks registered to respond to that signal.
Optionally accepts args and kwargs that are passed directly to callbacks.
:param signal: Signal to send
]
variable[errback] assign[=] call[name[kwargs]... | keyword[def] identifier[_emit_twisted] ( identifier[signal] ,* identifier[args] ,** identifier[kwargs] ):
literal[string]
identifier[errback] = identifier[kwargs] . identifier[pop] ( literal[string] , keyword[lambda] identifier[f] : identifier[f] )
identifier[dl] =[]
keyword[for] identifier[ca... | def _emit_twisted(signal, *args, **kwargs):
"""
Emits a single signal to call callbacks registered to respond to that signal.
Optionally accepts args and kwargs that are passed directly to callbacks.
:param signal: Signal to send
"""
errback = kwargs.pop('errback', lambda f: f)
dl = []
... |
def import_plugin(name, superclasses=None):
"""Import name as a module and return a list of all classes defined in that
module. superclasses should be a tuple of valid superclasses to import,
this defaults to (Plugin,).
"""
plugin_fqname = "sos.plugins.%s" % name
if not superclasses:
sup... | def function[import_plugin, parameter[name, superclasses]]:
constant[Import name as a module and return a list of all classes defined in that
module. superclasses should be a tuple of valid superclasses to import,
this defaults to (Plugin,).
]
variable[plugin_fqname] assign[=] binary_operati... | keyword[def] identifier[import_plugin] ( identifier[name] , identifier[superclasses] = keyword[None] ):
literal[string]
identifier[plugin_fqname] = literal[string] % identifier[name]
keyword[if] keyword[not] identifier[superclasses] :
identifier[superclasses] =( identifier[Plugin] ,)
... | def import_plugin(name, superclasses=None):
"""Import name as a module and return a list of all classes defined in that
module. superclasses should be a tuple of valid superclasses to import,
this defaults to (Plugin,).
"""
plugin_fqname = 'sos.plugins.%s' % name
if not superclasses:
sup... |
def reset(self):
"""
Reset all fields of this object to class defaults
"""
for name in self.__dict__:
if name.startswith("_"):
continue
attr = getattr(self, name)
setattr(self, name, attr and attr.__class__()) | def function[reset, parameter[self]]:
constant[
Reset all fields of this object to class defaults
]
for taget[name[name]] in starred[name[self].__dict__] begin[:]
if call[name[name].startswith, parameter[constant[_]]] begin[:]
continue
variable... | keyword[def] identifier[reset] ( identifier[self] ):
literal[string]
keyword[for] identifier[name] keyword[in] identifier[self] . identifier[__dict__] :
keyword[if] identifier[name] . identifier[startswith] ( literal[string] ):
keyword[continue]
iden... | def reset(self):
"""
Reset all fields of this object to class defaults
"""
for name in self.__dict__:
if name.startswith('_'):
continue # depends on [control=['if'], data=[]]
attr = getattr(self, name)
setattr(self, name, attr and attr.__class__()) # depends... |
def load_chkpt_vars(model_path):
""" Load all variables from a checkpoint to a dict.
Args:
model_path(str): path to a checkpoint.
Returns:
dict: a name:value dict
"""
model_path = get_checkpoint_path(model_path)
reader = tfv1.train.NewCheckpointReader(model_path)
var_names ... | def function[load_chkpt_vars, parameter[model_path]]:
constant[ Load all variables from a checkpoint to a dict.
Args:
model_path(str): path to a checkpoint.
Returns:
dict: a name:value dict
]
variable[model_path] assign[=] call[name[get_checkpoint_path], parameter[name[mode... | keyword[def] identifier[load_chkpt_vars] ( identifier[model_path] ):
literal[string]
identifier[model_path] = identifier[get_checkpoint_path] ( identifier[model_path] )
identifier[reader] = identifier[tfv1] . identifier[train] . identifier[NewCheckpointReader] ( identifier[model_path] )
identifie... | def load_chkpt_vars(model_path):
""" Load all variables from a checkpoint to a dict.
Args:
model_path(str): path to a checkpoint.
Returns:
dict: a name:value dict
"""
model_path = get_checkpoint_path(model_path)
reader = tfv1.train.NewCheckpointReader(model_path)
var_names ... |
def declare_exchange(self, name, type, *, durable=True, auto_delete=False,
passive=False, internal=False, nowait=False,
arguments=None):
"""
Declare an :class:`Exchange` on the broker. If the exchange does not exist, it will be created.
This met... | def function[declare_exchange, parameter[self, name, type]]:
constant[
Declare an :class:`Exchange` on the broker. If the exchange does not exist, it will be created.
This method is a :ref:`coroutine <coroutine>`.
:param str name: the name of the exchange.
:param str type: the ... | keyword[def] identifier[declare_exchange] ( identifier[self] , identifier[name] , identifier[type] ,*, identifier[durable] = keyword[True] , identifier[auto_delete] = keyword[False] ,
identifier[passive] = keyword[False] , identifier[internal] = keyword[False] , identifier[nowait] = keyword[False] ,
identifier[argu... | def declare_exchange(self, name, type, *, durable=True, auto_delete=False, passive=False, internal=False, nowait=False, arguments=None):
"""
Declare an :class:`Exchange` on the broker. If the exchange does not exist, it will be created.
This method is a :ref:`coroutine <coroutine>`.
:param... |
def merge_pairs(data, two_files, merged_out, revcomp, merge):
"""
Merge PE reads. Takes in a list of unmerged files [r1, r2] and the
filehandle to write merged data to, and it returns the number of reads
that were merged (overlapping). If merge==0 then only concat pairs (nnnn),
no merging in vsearch... | def function[merge_pairs, parameter[data, two_files, merged_out, revcomp, merge]]:
constant[
Merge PE reads. Takes in a list of unmerged files [r1, r2] and the
filehandle to write merged data to, and it returns the number of reads
that were merged (overlapping). If merge==0 then only concat pairs (n... | keyword[def] identifier[merge_pairs] ( identifier[data] , identifier[two_files] , identifier[merged_out] , identifier[revcomp] , identifier[merge] ):
literal[string]
identifier[LOGGER] . identifier[debug] ( literal[string] )
identifier[nmerged] =- literal[int]
keyword[for] identifi... | def merge_pairs(data, two_files, merged_out, revcomp, merge):
"""
Merge PE reads. Takes in a list of unmerged files [r1, r2] and the
filehandle to write merged data to, and it returns the number of reads
that were merged (overlapping). If merge==0 then only concat pairs (nnnn),
no merging in vsearch... |
def save(self, p_todolist):
"""
Saves a tuple with archive, todolist and command with its arguments
into the backup file with unix timestamp as the key. Tuple is then
indexed in backup file with combination of hash calculated from
p_todolist and unix timestamp. Backup file is clo... | def function[save, parameter[self, p_todolist]]:
constant[
Saves a tuple with archive, todolist and command with its arguments
into the backup file with unix timestamp as the key. Tuple is then
indexed in backup file with combination of hash calculated from
p_todolist and unix ti... | keyword[def] identifier[save] ( identifier[self] , identifier[p_todolist] ):
literal[string]
identifier[self] . identifier[_trim] ()
identifier[current_hash] = identifier[hash_todolist] ( identifier[p_todolist] )
identifier[list_todo] =( identifier[self] . identifier[todolist] . ... | def save(self, p_todolist):
"""
Saves a tuple with archive, todolist and command with its arguments
into the backup file with unix timestamp as the key. Tuple is then
indexed in backup file with combination of hash calculated from
p_todolist and unix timestamp. Backup file is closed ... |
def task_estimates(channel, states):
"""
Estimate remaining time for all tasks in this channel.
:param channel: txkoji.channel.Channel
:param list states: list of task_states ints, eg [task_states.OPEN]
:returns: deferred that when fired returns a list of
(task, est_remaining) tuples
... | def function[task_estimates, parameter[channel, states]]:
constant[
Estimate remaining time for all tasks in this channel.
:param channel: txkoji.channel.Channel
:param list states: list of task_states ints, eg [task_states.OPEN]
:returns: deferred that when fired returns a list of
... | keyword[def] identifier[task_estimates] ( identifier[channel] , identifier[states] ):
literal[string]
keyword[for] identifier[state] keyword[in] identifier[states] :
keyword[if] identifier[state] != identifier[task_states] . identifier[OPEN] :
keyword[raise] identifier[NotImpleme... | def task_estimates(channel, states):
"""
Estimate remaining time for all tasks in this channel.
:param channel: txkoji.channel.Channel
:param list states: list of task_states ints, eg [task_states.OPEN]
:returns: deferred that when fired returns a list of
(task, est_remaining) tuples
... |
def integrate_data(xdata, ydata, xmin=None, xmax=None, autozero=0):
"""
Numerically integrates up the ydata using the trapezoid approximation.
estimate the bin width (scaled by the specified amount).
Returns (xdata, integrated ydata).
autozero is the number of data points to use as an estimate of t... | def function[integrate_data, parameter[xdata, ydata, xmin, xmax, autozero]]:
constant[
Numerically integrates up the ydata using the trapezoid approximation.
estimate the bin width (scaled by the specified amount).
Returns (xdata, integrated ydata).
autozero is the number of data points to use ... | keyword[def] identifier[integrate_data] ( identifier[xdata] , identifier[ydata] , identifier[xmin] = keyword[None] , identifier[xmax] = keyword[None] , identifier[autozero] = literal[int] ):
literal[string]
[ identifier[xdata] , identifier[ydata] ]= identifier[sort_matrix] ([ identifier[xdata] , ident... | def integrate_data(xdata, ydata, xmin=None, xmax=None, autozero=0):
"""
Numerically integrates up the ydata using the trapezoid approximation.
estimate the bin width (scaled by the specified amount).
Returns (xdata, integrated ydata).
autozero is the number of data points to use as an estimate of t... |
def insert_rows_json(
self,
table,
json_rows,
row_ids=None,
skip_invalid_rows=None,
ignore_unknown_values=None,
template_suffix=None,
retry=DEFAULT_RETRY,
):
"""Insert rows into a table without applying local type conversions.
See
... | def function[insert_rows_json, parameter[self, table, json_rows, row_ids, skip_invalid_rows, ignore_unknown_values, template_suffix, retry]]:
constant[Insert rows into a table without applying local type conversions.
See
https://cloud.google.com/bigquery/docs/reference/rest/v2/tabledata/insertA... | keyword[def] identifier[insert_rows_json] (
identifier[self] ,
identifier[table] ,
identifier[json_rows] ,
identifier[row_ids] = keyword[None] ,
identifier[skip_invalid_rows] = keyword[None] ,
identifier[ignore_unknown_values] = keyword[None] ,
identifier[template_suffix] = keyword[None] ,
identifier[retry] =... | def insert_rows_json(self, table, json_rows, row_ids=None, skip_invalid_rows=None, ignore_unknown_values=None, template_suffix=None, retry=DEFAULT_RETRY):
"""Insert rows into a table without applying local type conversions.
See
https://cloud.google.com/bigquery/docs/reference/rest/v2/tabledata/inse... |
def generate_headers(self, client_type, client_id, secret):
"""
generate_headers is used to generate the headers automatically for your http request
:param client_type (str): remoteci or feeder
:param client_id (str): remoteci or feeder id
:param secret (str): api secret
... | def function[generate_headers, parameter[self, client_type, client_id, secret]]:
constant[
generate_headers is used to generate the headers automatically for your http request
:param client_type (str): remoteci or feeder
:param client_id (str): remoteci or feeder id
:param secre... | keyword[def] identifier[generate_headers] ( identifier[self] , identifier[client_type] , identifier[client_id] , identifier[secret] ):
literal[string]
identifier[self] . identifier[request] . identifier[add_header] ( identifier[self] . identifier[dci_datetime_header] , identifier[self] . identifie... | def generate_headers(self, client_type, client_id, secret):
"""
generate_headers is used to generate the headers automatically for your http request
:param client_type (str): remoteci or feeder
:param client_id (str): remoteci or feeder id
:param secret (str): api secret
:re... |
def start(track_file,
twitter_api_key,
twitter_api_secret,
twitter_access_token,
twitter_access_token_secret,
poll_interval=15,
unfiltered=False,
languages=None,
debug=False,
outfile=None):
"""Start the stream."""
listener... | def function[start, parameter[track_file, twitter_api_key, twitter_api_secret, twitter_access_token, twitter_access_token_secret, poll_interval, unfiltered, languages, debug, outfile]]:
constant[Start the stream.]
variable[listener] assign[=] call[name[construct_listener], parameter[name[outfile]]]
... | keyword[def] identifier[start] ( identifier[track_file] ,
identifier[twitter_api_key] ,
identifier[twitter_api_secret] ,
identifier[twitter_access_token] ,
identifier[twitter_access_token_secret] ,
identifier[poll_interval] = literal[int] ,
identifier[unfiltered] = keyword[False] ,
identifier[languages] = keyw... | def start(track_file, twitter_api_key, twitter_api_secret, twitter_access_token, twitter_access_token_secret, poll_interval=15, unfiltered=False, languages=None, debug=False, outfile=None):
"""Start the stream."""
listener = construct_listener(outfile)
checker = BasicFileTermChecker(track_file, listener)
... |
def add(self, phase_name, result):
"""
Add the result of a phase.
Parameters
----------
phase_name: str
The name of the phase
result
The result of that phase
"""
if phase_name in self.__result_dict:
raise exc.PipelineEx... | def function[add, parameter[self, phase_name, result]]:
constant[
Add the result of a phase.
Parameters
----------
phase_name: str
The name of the phase
result
The result of that phase
]
if compare[name[phase_name] in name[self].__... | keyword[def] identifier[add] ( identifier[self] , identifier[phase_name] , identifier[result] ):
literal[string]
keyword[if] identifier[phase_name] keyword[in] identifier[self] . identifier[__result_dict] :
keyword[raise] identifier[exc] . identifier[PipelineException] (
... | def add(self, phase_name, result):
"""
Add the result of a phase.
Parameters
----------
phase_name: str
The name of the phase
result
The result of that phase
"""
if phase_name in self.__result_dict:
raise exc.PipelineException('Res... |
def changed(self):
""":class:`dict` containing the key value pairs that are not the
default"""
return {key: value for key, value in six.iteritems(self)
if getattr(self, key).changed} | def function[changed, parameter[self]]:
constant[:class:`dict` containing the key value pairs that are not the
default]
return[<ast.DictComp object at 0x7da18c4cf670>] | keyword[def] identifier[changed] ( identifier[self] ):
literal[string]
keyword[return] { identifier[key] : identifier[value] keyword[for] identifier[key] , identifier[value] keyword[in] identifier[six] . identifier[iteritems] ( identifier[self] )
keyword[if] identifier[getattr] ( iden... | def changed(self):
""":class:`dict` containing the key value pairs that are not the
default"""
return {key: value for (key, value) in six.iteritems(self) if getattr(self, key).changed} |
def extraneous_whitespace(logical_line):
"""
Avoid extraneous whitespace in the following situations:
- Immediately inside parentheses, brackets or braces.
- Immediately before a comma, semicolon, or colon.
"""
line = logical_line
for char in '([{':
found = line.find(char + ' ')
... | def function[extraneous_whitespace, parameter[logical_line]]:
constant[
Avoid extraneous whitespace in the following situations:
- Immediately inside parentheses, brackets or braces.
- Immediately before a comma, semicolon, or colon.
]
variable[line] assign[=] name[logical_line]
... | keyword[def] identifier[extraneous_whitespace] ( identifier[logical_line] ):
literal[string]
identifier[line] = identifier[logical_line]
keyword[for] identifier[char] keyword[in] literal[string] :
identifier[found] = identifier[line] . identifier[find] ( identifier[char] + literal[string]... | def extraneous_whitespace(logical_line):
"""
Avoid extraneous whitespace in the following situations:
- Immediately inside parentheses, brackets or braces.
- Immediately before a comma, semicolon, or colon.
"""
line = logical_line
for char in '([{':
found = line.find(char + ' ')
... |
def _query(self, x, result):
'''
Same as self.query, but uses a provided list to accumulate results into.
'''
if self.single_interval is None: # Empty
return
elif self.single_interval != 0: # Single interval, just check whether x is in it
if self.single_i... | def function[_query, parameter[self, x, result]]:
constant[
Same as self.query, but uses a provided list to accumulate results into.
]
if compare[name[self].single_interval is constant[None]] begin[:]
return[None] | keyword[def] identifier[_query] ( identifier[self] , identifier[x] , identifier[result] ):
literal[string]
keyword[if] identifier[self] . identifier[single_interval] keyword[is] keyword[None] :
keyword[return]
keyword[elif] identifier[self] . identifier[single_interval] !... | def _query(self, x, result):
"""
Same as self.query, but uses a provided list to accumulate results into.
"""
if self.single_interval is None: # Empty
return # depends on [control=['if'], data=[]]
elif self.single_interval != 0: # Single interval, just check whether x is in it
... |
def prepare(self):
'''
Returns a new Prepare message with a proposal id higher than
that of any observed proposals. A side effect of this method is
to clear the leader flag if it is currently set.
'''
self.leader = False
self.promises_received = set()
sel... | def function[prepare, parameter[self]]:
constant[
Returns a new Prepare message with a proposal id higher than
that of any observed proposals. A side effect of this method is
to clear the leader flag if it is currently set.
]
name[self].leader assign[=] constant[False]
... | keyword[def] identifier[prepare] ( identifier[self] ):
literal[string]
identifier[self] . identifier[leader] = keyword[False]
identifier[self] . identifier[promises_received] = identifier[set] ()
identifier[self] . identifier[nacks_received] = identifier[set] ()
identif... | def prepare(self):
"""
Returns a new Prepare message with a proposal id higher than
that of any observed proposals. A side effect of this method is
to clear the leader flag if it is currently set.
"""
self.leader = False
self.promises_received = set()
self.nacks_received ... |
def child_end_handler(self,scache):
'''
_upgrade_breadth_info
update breadth, breadth_path, and add desc to desc_level
'''
desc = self.desc
desc_level = scache.desc_level
breadth = desc_level.__len__()
desc['breadth'] = breadth
desc['breadt... | def function[child_end_handler, parameter[self, scache]]:
constant[
_upgrade_breadth_info
update breadth, breadth_path, and add desc to desc_level
]
variable[desc] assign[=] name[self].desc
variable[desc_level] assign[=] name[scache].desc_level
variable[br... | keyword[def] identifier[child_end_handler] ( identifier[self] , identifier[scache] ):
literal[string]
identifier[desc] = identifier[self] . identifier[desc]
identifier[desc_level] = identifier[scache] . identifier[desc_level]
identifier[breadth] = identifier[desc_level] . identi... | def child_end_handler(self, scache):
"""
_upgrade_breadth_info
update breadth, breadth_path, and add desc to desc_level
"""
desc = self.desc
desc_level = scache.desc_level
breadth = desc_level.__len__()
desc['breadth'] = breadth
desc['breadth_path'].append(breadth... |
def _start_reader_thread(self, stream, chunks):
"""Starts a thread for reading output from FFMPEG.
The thread reads consecutive chunks from the stream and saves them in
the given list.
Args:
stream: output stream of the FFMPEG process.
chunks: list to save output chunks to.
Returns:
... | def function[_start_reader_thread, parameter[self, stream, chunks]]:
constant[Starts a thread for reading output from FFMPEG.
The thread reads consecutive chunks from the stream and saves them in
the given list.
Args:
stream: output stream of the FFMPEG process.
chunks: list to save ou... | keyword[def] identifier[_start_reader_thread] ( identifier[self] , identifier[stream] , identifier[chunks] ):
literal[string]
keyword[import] identifier[io]
keyword[import] identifier[threading]
keyword[def] identifier[target] ():
keyword[while] keyword[True] :
identifier[ch... | def _start_reader_thread(self, stream, chunks):
"""Starts a thread for reading output from FFMPEG.
The thread reads consecutive chunks from the stream and saves them in
the given list.
Args:
stream: output stream of the FFMPEG process.
chunks: list to save output chunks to.
Returns:
... |
def batches(arrays, steps=100, batch_size=64, rng=None):
'''Create a callable that generates samples from a dataset.
Parameters
----------
arrays : list of ndarray (time-steps, data-dimensions)
Arrays of data. Rows in these arrays are assumed to correspond to time
steps, and columns to ... | def function[batches, parameter[arrays, steps, batch_size, rng]]:
constant[Create a callable that generates samples from a dataset.
Parameters
----------
arrays : list of ndarray (time-steps, data-dimensions)
Arrays of data. Rows in these arrays are assumed to correspond to time
ste... | keyword[def] identifier[batches] ( identifier[arrays] , identifier[steps] = literal[int] , identifier[batch_size] = literal[int] , identifier[rng] = keyword[None] ):
literal[string]
keyword[assert] identifier[batch_size] >= literal[int] , literal[string]
keyword[assert] identifier[isinstance] ( ide... | def batches(arrays, steps=100, batch_size=64, rng=None):
"""Create a callable that generates samples from a dataset.
Parameters
----------
arrays : list of ndarray (time-steps, data-dimensions)
Arrays of data. Rows in these arrays are assumed to correspond to time
steps, and columns to ... |
def targetSurfacemass(self,R,log=False):
"""
NAME:
targetSurfacemass
PURPOSE:
evaluate the target surface mass at R
INPUT:
R - radius at which to evaluate (can be Quantity)
log - if True, return the log (default: False)
... | def function[targetSurfacemass, parameter[self, R, log]]:
constant[
NAME:
targetSurfacemass
PURPOSE:
evaluate the target surface mass at R
INPUT:
R - radius at which to evaluate (can be Quantity)
log - if True, return the log (defa... | keyword[def] identifier[targetSurfacemass] ( identifier[self] , identifier[R] , identifier[log] = keyword[False] ):
literal[string]
keyword[return] identifier[self] . identifier[_surfaceSigmaProfile] . identifier[surfacemass] ( identifier[R] , identifier[log] = identifier[log] ) | def targetSurfacemass(self, R, log=False):
"""
NAME:
targetSurfacemass
PURPOSE:
evaluate the target surface mass at R
INPUT:
R - radius at which to evaluate (can be Quantity)
log - if True, return the log (default: False)
OUT... |
def convert_descriptor(self, descriptor):
"""Convert descriptor to BigQuery
"""
# Fields
fields = []
fallbacks = []
schema = tableschema.Schema(descriptor)
for index, field in enumerate(schema.fields):
converted_type = self.convert_type(field.type)
... | def function[convert_descriptor, parameter[self, descriptor]]:
constant[Convert descriptor to BigQuery
]
variable[fields] assign[=] list[[]]
variable[fallbacks] assign[=] list[[]]
variable[schema] assign[=] call[name[tableschema].Schema, parameter[name[descriptor]]]
for t... | keyword[def] identifier[convert_descriptor] ( identifier[self] , identifier[descriptor] ):
literal[string]
identifier[fields] =[]
identifier[fallbacks] =[]
identifier[schema] = identifier[tableschema] . identifier[Schema] ( identifier[descriptor] )
keyword[for] ... | def convert_descriptor(self, descriptor):
"""Convert descriptor to BigQuery
"""
# Fields
fields = []
fallbacks = []
schema = tableschema.Schema(descriptor)
for (index, field) in enumerate(schema.fields):
converted_type = self.convert_type(field.type)
if not converted_type... |
def words(self):
"""
Возвращает итератор по словам, содержащимся в боре
"""
branch, word, indexes = [self.root], [], [0]
letters_with_children = [self._get_children_and_letters(self.root)]
while len(branch) > 0:
if self.is_final(branch[-1]):
yi... | def function[words, parameter[self]]:
constant[
Возвращает итератор по словам, содержащимся в боре
]
<ast.Tuple object at 0x7da2054a4550> assign[=] tuple[[<ast.List object at 0x7da2054a45b0>, <ast.List object at 0x7da2054a52a0>, <ast.List object at 0x7da2054a69b0>]]
variable[lett... | keyword[def] identifier[words] ( identifier[self] ):
literal[string]
identifier[branch] , identifier[word] , identifier[indexes] =[ identifier[self] . identifier[root] ],[],[ literal[int] ]
identifier[letters_with_children] =[ identifier[self] . identifier[_get_children_and_letters] ( iden... | def words(self):
"""
Возвращает итератор по словам, содержащимся в боре
"""
(branch, word, indexes) = ([self.root], [], [0])
letters_with_children = [self._get_children_and_letters(self.root)]
while len(branch) > 0:
if self.is_final(branch[-1]):
yield ''.join(word) #... |
def raise_on_packet(self, pkt_cls, state, get_next_msg=True):
"""
If the next message to be processed has type 'pkt_cls', raise 'state'.
If there is no message waiting to be processed, we try to get one with
the default 'get_next_msg' parameters.
"""
# Maybe we already pa... | def function[raise_on_packet, parameter[self, pkt_cls, state, get_next_msg]]:
constant[
If the next message to be processed has type 'pkt_cls', raise 'state'.
If there is no message waiting to be processed, we try to get one with
the default 'get_next_msg' parameters.
]
i... | keyword[def] identifier[raise_on_packet] ( identifier[self] , identifier[pkt_cls] , identifier[state] , identifier[get_next_msg] = keyword[True] ):
literal[string]
keyword[if] identifier[get_next_msg] :
identifier[self] . identifier[get_next_msg] ()
keyword[if] ( key... | def raise_on_packet(self, pkt_cls, state, get_next_msg=True):
"""
If the next message to be processed has type 'pkt_cls', raise 'state'.
If there is no message waiting to be processed, we try to get one with
the default 'get_next_msg' parameters.
"""
# Maybe we already parsed the... |
def _connect_mitogen_su(spec):
"""
Return ContextService arguments for su as a first class connection.
"""
return {
'method': 'su',
'kwargs': {
'username': spec.remote_user(),
'password': spec.password(),
'python_path': spec.python_path(),
... | def function[_connect_mitogen_su, parameter[spec]]:
constant[
Return ContextService arguments for su as a first class connection.
]
return[dictionary[[<ast.Constant object at 0x7da1b1d50ca0>, <ast.Constant object at 0x7da1b1d528c0>], [<ast.Constant object at 0x7da1b1d500a0>, <ast.Dict object at 0x7d... | keyword[def] identifier[_connect_mitogen_su] ( identifier[spec] ):
literal[string]
keyword[return] {
literal[string] : literal[string] ,
literal[string] :{
literal[string] : identifier[spec] . identifier[remote_user] (),
literal[string] : identifier[spec] . identifier[password] (),
... | def _connect_mitogen_su(spec):
"""
Return ContextService arguments for su as a first class connection.
"""
return {'method': 'su', 'kwargs': {'username': spec.remote_user(), 'password': spec.password(), 'python_path': spec.python_path(), 'su_path': spec.become_exe(), 'connect_timeout': spec.timeout(), '... |
def CheckBlobsExist(self, blob_ids):
"""Check if blobs for the given digests already exist."""
res = {blob_id: False for blob_id in blob_ids}
urns = {self._BlobUrn(blob_id): blob_id for blob_id in blob_ids}
existing = aff4.FACTORY.MultiOpen(
urns, aff4_type=aff4.AFF4MemoryStreamBase, mode="r")... | def function[CheckBlobsExist, parameter[self, blob_ids]]:
constant[Check if blobs for the given digests already exist.]
variable[res] assign[=] <ast.DictComp object at 0x7da1b1c254b0>
variable[urns] assign[=] <ast.DictComp object at 0x7da1b1c0e3b0>
variable[existing] assign[=] call[name[... | keyword[def] identifier[CheckBlobsExist] ( identifier[self] , identifier[blob_ids] ):
literal[string]
identifier[res] ={ identifier[blob_id] : keyword[False] keyword[for] identifier[blob_id] keyword[in] identifier[blob_ids] }
identifier[urns] ={ identifier[self] . identifier[_BlobUrn] ( identifie... | def CheckBlobsExist(self, blob_ids):
"""Check if blobs for the given digests already exist."""
res = {blob_id: False for blob_id in blob_ids}
urns = {self._BlobUrn(blob_id): blob_id for blob_id in blob_ids}
existing = aff4.FACTORY.MultiOpen(urns, aff4_type=aff4.AFF4MemoryStreamBase, mode='r')
for bl... |
def set_timeout(scope, timeout):
"""
Defines the time after which Exscript fails if it does not receive a
prompt from the remote host.
:type timeout: int
:param timeout: The timeout in seconds.
"""
conn = scope.get('__connection__')
conn.set_timeout(int(timeout[0]))
return True | def function[set_timeout, parameter[scope, timeout]]:
constant[
Defines the time after which Exscript fails if it does not receive a
prompt from the remote host.
:type timeout: int
:param timeout: The timeout in seconds.
]
variable[conn] assign[=] call[name[scope].get, parameter[co... | keyword[def] identifier[set_timeout] ( identifier[scope] , identifier[timeout] ):
literal[string]
identifier[conn] = identifier[scope] . identifier[get] ( literal[string] )
identifier[conn] . identifier[set_timeout] ( identifier[int] ( identifier[timeout] [ literal[int] ]))
keyword[return] keywo... | def set_timeout(scope, timeout):
"""
Defines the time after which Exscript fails if it does not receive a
prompt from the remote host.
:type timeout: int
:param timeout: The timeout in seconds.
"""
conn = scope.get('__connection__')
conn.set_timeout(int(timeout[0]))
return True |
def as_bel(self) -> str:
"""Return this fusion range as a BEL string."""
return '{reference}.{start}_{stop}'.format(
reference=self[FUSION_REFERENCE],
start=self[FUSION_START],
stop=self[FUSION_STOP],
) | def function[as_bel, parameter[self]]:
constant[Return this fusion range as a BEL string.]
return[call[constant[{reference}.{start}_{stop}].format, parameter[]]] | keyword[def] identifier[as_bel] ( identifier[self] )-> identifier[str] :
literal[string]
keyword[return] literal[string] . identifier[format] (
identifier[reference] = identifier[self] [ identifier[FUSION_REFERENCE] ],
identifier[start] = identifier[self] [ identifier[FUSION_STAR... | def as_bel(self) -> str:
"""Return this fusion range as a BEL string."""
return '{reference}.{start}_{stop}'.format(reference=self[FUSION_REFERENCE], start=self[FUSION_START], stop=self[FUSION_STOP]) |
def create_alert(self, **kwargs): # noqa: E501
"""Create a specific alert # noqa: E501
# noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.create_alert(async_req=True)
... | def function[create_alert, parameter[self]]:
constant[Create a specific alert # noqa: E501
# noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.create_alert(async_req=True)
... | keyword[def] identifier[create_alert] ( identifier[self] ,** identifier[kwargs] ):
literal[string]
identifier[kwargs] [ literal[string] ]= keyword[True]
keyword[if] identifier[kwargs] . identifier[get] ( literal[string] ):
keyword[return] identifier[self] . identifier[creat... | def create_alert(self, **kwargs): # noqa: E501
'Create a specific alert # noqa: E501\n\n # noqa: E501\n This method makes a synchronous HTTP request by default. To make an\n asynchronous HTTP request, please pass async_req=True\n >>> thread = api.create_alert(async_req=True)\n ... |
def reftrack_version_data(rt, role):
"""Return the data for the version that is loaded by the reftrack
:param rt: the :class:`jukeboxcore.reftrack.Reftrack` holds the data
:type rt: :class:`jukeboxcore.reftrack.Reftrack`
:param role: item data role
:type role: QtCore.Qt.ItemDataRole
:returns: d... | def function[reftrack_version_data, parameter[rt, role]]:
constant[Return the data for the version that is loaded by the reftrack
:param rt: the :class:`jukeboxcore.reftrack.Reftrack` holds the data
:type rt: :class:`jukeboxcore.reftrack.Reftrack`
:param role: item data role
:type role: QtCore.... | keyword[def] identifier[reftrack_version_data] ( identifier[rt] , identifier[role] ):
literal[string]
identifier[tfi] = identifier[rt] . identifier[get_taskfileinfo] ()
keyword[if] keyword[not] identifier[tfi] :
keyword[return]
keyword[return] identifier[filesysitemdata] . identifier... | def reftrack_version_data(rt, role):
"""Return the data for the version that is loaded by the reftrack
:param rt: the :class:`jukeboxcore.reftrack.Reftrack` holds the data
:type rt: :class:`jukeboxcore.reftrack.Reftrack`
:param role: item data role
:type role: QtCore.Qt.ItemDataRole
:returns: d... |
def unscale_and_snap_to_nearest(x, tune_params, eps):
"""helper func that snaps a scaled variable to the nearest config"""
x_u = [i for i in x]
for i, v in enumerate(tune_params.values()):
#create an evenly spaced linear space to map [0,1]-interval
#to actual values, giving each value an equ... | def function[unscale_and_snap_to_nearest, parameter[x, tune_params, eps]]:
constant[helper func that snaps a scaled variable to the nearest config]
variable[x_u] assign[=] <ast.ListComp object at 0x7da1b04d8160>
for taget[tuple[[<ast.Name object at 0x7da1b04da320>, <ast.Name object at 0x7da1b04d... | keyword[def] identifier[unscale_and_snap_to_nearest] ( identifier[x] , identifier[tune_params] , identifier[eps] ):
literal[string]
identifier[x_u] =[ identifier[i] keyword[for] identifier[i] keyword[in] identifier[x] ]
keyword[for] identifier[i] , identifier[v] keyword[in] identifier[enumerate... | def unscale_and_snap_to_nearest(x, tune_params, eps):
"""helper func that snaps a scaled variable to the nearest config"""
x_u = [i for i in x]
for (i, v) in enumerate(tune_params.values()):
#create an evenly spaced linear space to map [0,1]-interval
#to actual values, giving each value an e... |
def list_boards():
"""! @brief Generate dictionary with info about supported boards.
Output version history:
- 1.0, initial version
"""
boards = []
obj = {
'pyocd_version' : __version__,
'version' : { 'major' : 1, 'minor' : 0 },
... | def function[list_boards, parameter[]]:
constant[! @brief Generate dictionary with info about supported boards.
Output version history:
- 1.0, initial version
]
variable[boards] assign[=] list[[]]
variable[obj] assign[=] dictionary[[<ast.Constant object at 0x7da1... | keyword[def] identifier[list_boards] ():
literal[string]
identifier[boards] =[]
identifier[obj] ={
literal[string] : identifier[__version__] ,
literal[string] :{ literal[string] : literal[int] , literal[string] : literal[int] },
literal[string] : literal[int] ,
... | def list_boards():
"""! @brief Generate dictionary with info about supported boards.
Output version history:
- 1.0, initial version
"""
boards = []
obj = {'pyocd_version': __version__, 'version': {'major': 1, 'minor': 0}, 'status': 0, 'boards': boards}
for (board_id, inf... |
def plot_qq_unf(fignum, D, title, subplot=False, degrees=True):
"""
plots data against a uniform distribution in 0=>360.
Parameters
_________
fignum : matplotlib figure number
D : data
title : title for plot
subplot : if True, make this number one of two subplots
degrees : if True, a... | def function[plot_qq_unf, parameter[fignum, D, title, subplot, degrees]]:
constant[
plots data against a uniform distribution in 0=>360.
Parameters
_________
fignum : matplotlib figure number
D : data
title : title for plot
subplot : if True, make this number one of two subplots
... | keyword[def] identifier[plot_qq_unf] ( identifier[fignum] , identifier[D] , identifier[title] , identifier[subplot] = keyword[False] , identifier[degrees] = keyword[True] ):
literal[string]
keyword[if] identifier[subplot] == keyword[True] :
identifier[plt] . identifier[subplot] ( literal[int] , l... | def plot_qq_unf(fignum, D, title, subplot=False, degrees=True):
"""
plots data against a uniform distribution in 0=>360.
Parameters
_________
fignum : matplotlib figure number
D : data
title : title for plot
subplot : if True, make this number one of two subplots
degrees : if True, a... |
def _sline_bokeh(self, window_size, y_label):
"""
Returns a chart with a smooth line from a serie
"""
try:
ds2 = self.clone_()
window = np.ones(int(window_size)) / float(window_size)
ds2.df[y_label] = np.convolve(self.df[self.y], window, 'same')
... | def function[_sline_bokeh, parameter[self, window_size, y_label]]:
constant[
Returns a chart with a smooth line from a serie
]
<ast.Try object at 0x7da204622050> | keyword[def] identifier[_sline_bokeh] ( identifier[self] , identifier[window_size] , identifier[y_label] ):
literal[string]
keyword[try] :
identifier[ds2] = identifier[self] . identifier[clone_] ()
identifier[window] = identifier[np] . identifier[ones] ( identifier[int] ( ... | def _sline_bokeh(self, window_size, y_label):
"""
Returns a chart with a smooth line from a serie
"""
try:
ds2 = self.clone_()
window = np.ones(int(window_size)) / float(window_size)
ds2.df[y_label] = np.convolve(self.df[self.y], window, 'same')
ds2.chart(self.x, ... |
def get_structure_seqs(pdb_file, file_type):
"""Get a dictionary of a PDB file's sequences.
Special cases include:
- Insertion codes. In the case of residue numbers like "15A", "15B", both residues are written out. Example: 9LPR
- HETATMs. Currently written as an "X", or unknown amino acid.
... | def function[get_structure_seqs, parameter[pdb_file, file_type]]:
constant[Get a dictionary of a PDB file's sequences.
Special cases include:
- Insertion codes. In the case of residue numbers like "15A", "15B", both residues are written out. Example: 9LPR
- HETATMs. Currently written as an ... | keyword[def] identifier[get_structure_seqs] ( identifier[pdb_file] , identifier[file_type] ):
literal[string]
identifier[my_structure] = identifier[StructureIO] ( identifier[pdb_file] )
identifier[model] = identifier[my_structure] . identifier[first_model]
identifier[structure_... | def get_structure_seqs(pdb_file, file_type):
"""Get a dictionary of a PDB file's sequences.
Special cases include:
- Insertion codes. In the case of residue numbers like "15A", "15B", both residues are written out. Example: 9LPR
- HETATMs. Currently written as an "X", or unknown amino acid.
... |
def set_inheritance(obj_name, enabled, obj_type='file', clear=False):
'''
Enable or disable an objects inheritance.
Args:
obj_name (str):
The name of the object
enabled (bool):
True to enable inheritance, False to disable
obj_type (Optional[str]):
... | def function[set_inheritance, parameter[obj_name, enabled, obj_type, clear]]:
constant[
Enable or disable an objects inheritance.
Args:
obj_name (str):
The name of the object
enabled (bool):
True to enable inheritance, False to disable
obj_type (Option... | keyword[def] identifier[set_inheritance] ( identifier[obj_name] , identifier[enabled] , identifier[obj_type] = literal[string] , identifier[clear] = keyword[False] ):
literal[string]
keyword[if] identifier[obj_type] keyword[not] keyword[in] [ literal[string] , literal[string] , literal[string] ]:
... | def set_inheritance(obj_name, enabled, obj_type='file', clear=False):
"""
Enable or disable an objects inheritance.
Args:
obj_name (str):
The name of the object
enabled (bool):
True to enable inheritance, False to disable
obj_type (Optional[str]):
... |
def SetFlushInterval(self, flush_interval):
"""Set the flush interval.
Args:
flush_interval (int): number of events to buffer before doing a bulk
insert.
"""
self._flush_interval = flush_interval
logger.debug('Elasticsearch flush interval: {0:d}'.format(flush_interval)) | def function[SetFlushInterval, parameter[self, flush_interval]]:
constant[Set the flush interval.
Args:
flush_interval (int): number of events to buffer before doing a bulk
insert.
]
name[self]._flush_interval assign[=] name[flush_interval]
call[name[logger].debug, param... | keyword[def] identifier[SetFlushInterval] ( identifier[self] , identifier[flush_interval] ):
literal[string]
identifier[self] . identifier[_flush_interval] = identifier[flush_interval]
identifier[logger] . identifier[debug] ( literal[string] . identifier[format] ( identifier[flush_interval] )) | def SetFlushInterval(self, flush_interval):
"""Set the flush interval.
Args:
flush_interval (int): number of events to buffer before doing a bulk
insert.
"""
self._flush_interval = flush_interval
logger.debug('Elasticsearch flush interval: {0:d}'.format(flush_interval)) |
def summary(args):
"""
%prog summary coordsfile
provide summary on id% and cov%, for both query and reference
"""
from jcvi.formats.blast import AlignStats
p = OptionParser(summary.__doc__)
p.add_option("-s", dest="single", default=False, action="store_true",
help="provide stat... | def function[summary, parameter[args]]:
constant[
%prog summary coordsfile
provide summary on id% and cov%, for both query and reference
]
from relative_module[jcvi.formats.blast] import module[AlignStats]
variable[p] assign[=] call[name[OptionParser], parameter[name[summary].__doc__]]
... | keyword[def] identifier[summary] ( identifier[args] ):
literal[string]
keyword[from] identifier[jcvi] . identifier[formats] . identifier[blast] keyword[import] identifier[AlignStats]
identifier[p] = identifier[OptionParser] ( identifier[summary] . identifier[__doc__] )
identifier[p] . identi... | def summary(args):
"""
%prog summary coordsfile
provide summary on id% and cov%, for both query and reference
"""
from jcvi.formats.blast import AlignStats
p = OptionParser(summary.__doc__)
p.add_option('-s', dest='single', default=False, action='store_true', help='provide stats per referen... |
def get_refresh_stats(self):
"""Return the measured statistics for timed refresh intervals.
Returns
-------
stats : float
The measured rate of actual back end updates in frames per second.
"""
if self.rf_draw_count == 0:
fps = 0.0
else:
... | def function[get_refresh_stats, parameter[self]]:
constant[Return the measured statistics for timed refresh intervals.
Returns
-------
stats : float
The measured rate of actual back end updates in frames per second.
]
if compare[name[self].rf_draw_count equa... | keyword[def] identifier[get_refresh_stats] ( identifier[self] ):
literal[string]
keyword[if] identifier[self] . identifier[rf_draw_count] == literal[int] :
identifier[fps] = literal[int]
keyword[else] :
identifier[interval] = identifier[time] . identifier[time] ... | def get_refresh_stats(self):
"""Return the measured statistics for timed refresh intervals.
Returns
-------
stats : float
The measured rate of actual back end updates in frames per second.
"""
if self.rf_draw_count == 0:
fps = 0.0 # depends on [control=['if... |
def init():
'''
Return the list of svn remotes and their configuration information
'''
bp_ = os.path.join(__opts__['cachedir'], 'svnfs')
new_remote = False
repos = []
per_remote_defaults = {}
for param in PER_REMOTE_OVERRIDES:
per_remote_defaults[param] = \
six.text_... | def function[init, parameter[]]:
constant[
Return the list of svn remotes and their configuration information
]
variable[bp_] assign[=] call[name[os].path.join, parameter[call[name[__opts__]][constant[cachedir]], constant[svnfs]]]
variable[new_remote] assign[=] constant[False]
va... | keyword[def] identifier[init] ():
literal[string]
identifier[bp_] = identifier[os] . identifier[path] . identifier[join] ( identifier[__opts__] [ literal[string] ], literal[string] )
identifier[new_remote] = keyword[False]
identifier[repos] =[]
identifier[per_remote_defaults] ={}
keyw... | def init():
"""
Return the list of svn remotes and their configuration information
"""
bp_ = os.path.join(__opts__['cachedir'], 'svnfs')
new_remote = False
repos = []
per_remote_defaults = {}
for param in PER_REMOTE_OVERRIDES:
per_remote_defaults[param] = six.text_type(__opts__['... |
def load_plugins(self, raise_error=False):
"""
Load the plotters and defaultParams from the plugins
This method loads the `plotters` attribute and `defaultParams`
attribute from the plugins that use the entry point specified by
`group`. Entry points must be objects (or modules) ... | def function[load_plugins, parameter[self, raise_error]]:
constant[
Load the plotters and defaultParams from the plugins
This method loads the `plotters` attribute and `defaultParams`
attribute from the plugins that use the entry point specified by
`group`. Entry points must be ... | keyword[def] identifier[load_plugins] ( identifier[self] , identifier[raise_error] = keyword[False] ):
literal[string]
identifier[pm_env] = identifier[os] . identifier[getenv] ( literal[string] , literal[string] ). identifier[split] ( literal[string] )
identifier[include_pms] =[ identifie... | def load_plugins(self, raise_error=False):
"""
Load the plotters and defaultParams from the plugins
This method loads the `plotters` attribute and `defaultParams`
attribute from the plugins that use the entry point specified by
`group`. Entry points must be objects (or modules) that... |
def get_3_tuple_list(self,obj,default=None):
"""Return list of 3-tuples from
sequence of a sequence,
sequence - it is mapped to sequence of 3-sequences if possible
number
"""
if is_sequence2(obj):
return [self.get_3_tuple(o,default) for o in obj]
elif ... | def function[get_3_tuple_list, parameter[self, obj, default]]:
constant[Return list of 3-tuples from
sequence of a sequence,
sequence - it is mapped to sequence of 3-sequences if possible
number
]
if call[name[is_sequence2], parameter[name[obj]]] begin[:]
return[<... | keyword[def] identifier[get_3_tuple_list] ( identifier[self] , identifier[obj] , identifier[default] = keyword[None] ):
literal[string]
keyword[if] identifier[is_sequence2] ( identifier[obj] ):
keyword[return] [ identifier[self] . identifier[get_3_tuple] ( identifier[o] , identifier[d... | def get_3_tuple_list(self, obj, default=None):
"""Return list of 3-tuples from
sequence of a sequence,
sequence - it is mapped to sequence of 3-sequences if possible
number
"""
if is_sequence2(obj):
return [self.get_3_tuple(o, default) for o in obj] # depends on [control... |
def read_raw_table(self, table):
"""
Yield rows in the [incr tsdb()] *table*. A row is a dictionary
mapping column names to values. Data from a profile is decoded
by decode_row(). No filters or applicators are used.
"""
fields = self.table_relations(table) if self.cast el... | def function[read_raw_table, parameter[self, table]]:
constant[
Yield rows in the [incr tsdb()] *table*. A row is a dictionary
mapping column names to values. Data from a profile is decoded
by decode_row(). No filters or applicators are used.
]
variable[fields] assign[=] ... | keyword[def] identifier[read_raw_table] ( identifier[self] , identifier[table] ):
literal[string]
identifier[fields] = identifier[self] . identifier[table_relations] ( identifier[table] ) keyword[if] identifier[self] . identifier[cast] keyword[else] keyword[None]
identifier[field_names... | def read_raw_table(self, table):
"""
Yield rows in the [incr tsdb()] *table*. A row is a dictionary
mapping column names to values. Data from a profile is decoded
by decode_row(). No filters or applicators are used.
"""
fields = self.table_relations(table) if self.cast else None
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.