text stringlengths 78 104k | score float64 0 0.18 |
|---|---|
def build_list_type_validator(item_validator):
"""Return a function which validates that the value is a list of items
which are validated using item_validator.
"""
def validate_list_of_type(value):
return [item_validator(item) for item in validate_list(value)]
return validate_list_of_type | 0.003155 |
def prepare_untran(feat_type, tgt_dir, untran_dir):
""" Preprocesses untranscribed audio."""
org_dir = str(untran_dir)
wav_dir = os.path.join(str(tgt_dir), "wav", "untranscribed")
feat_dir = os.path.join(str(tgt_dir), "feat", "untranscribed")
if not os.path.isdir(wav_dir):
os.makedirs(wav_di... | 0.001969 |
def randomString(size: int = 20,
chars: str = string.ascii_letters + string.digits) -> str:
"""
Generate a random string of the specified size.
Ensure that the size is less than the length of chars as this function uses random.choice
which uses random sampling without replacement.
... | 0.005263 |
def remove(self, id_option_vip):
"""Remove Option VIP from by the identifier.
:param id_option_vip: Identifier of the Option VIP. Integer value and greater than zero.
:return: None
:raise InvalidParameterError: Option VIP identifier is null and invalid.
:raise OptionVipNotFoun... | 0.005495 |
def get_stats(self):
"""Return a string describing the stats"""
ostr = ''
errtotal = self.deletions['total']+self.insertions['total']+self.mismatches
ostr += "ALIGNMENT_COUNT\t"+str(self.alignment_count)+"\n"
ostr += "ALIGNMENT_BASES\t"+str(self.alignment_length)+"\n"
ostr += "ANY_ERROR\t"+str(e... | 0.001205 |
def _process_current(self, handle, op, dest_path=None, dest_name=None):
"""Process current member with 'op' operation."""
unrarlib.RARProcessFileW(handle, op, dest_path, dest_name) | 0.010204 |
def attach(self, lun_or_snap, skip_hlu_0=False):
""" Attaches lun, snap or member snap of cg snap to host.
Don't pass cg snapshot in as `lun_or_snap`.
:param lun_or_snap: the lun, snap, or a member snap of cg snap
:param skip_hlu_0: whether to skip hlu 0
:return: the hlu number... | 0.001534 |
def document(schema):
"""Print a documented teleport version of the schema."""
teleport_schema = from_val(schema)
return json.dumps(teleport_schema, sort_keys=True, indent=2) | 0.005376 |
def symbolic_run_get_cons(trace):
'''
Execute a symbolic run that follows a concrete run; return constraints generated
and the stdin data produced
'''
m2 = Manticore.linux(prog, workspace_url='mem:')
f = Follower(trace)
m2.verbosity(VERBOSITY)
m2.register_plugin(f)
def on_term_test... | 0.00227 |
def add_experiences(self, curr_all_info: AllBrainInfo, next_all_info: AllBrainInfo, take_action_outputs):
"""
Adds experiences to each agent's experience history.
:param curr_all_info: Dictionary of all current brains and corresponding BrainInfo.
:param next_all_info: Dictionary of all c... | 0.00573 |
def get_map_values(self, lons, lats, ibin=None):
"""Return the map values corresponding to a set of coordinates.
Parameters
----------
lons : array-like
'Longitudes' (RA or GLON)
lats : array-like
'Latitidues' (DEC or GLAT)
ibin : int or array-l... | 0.003064 |
def free(host, port, timeout=float('Inf')):
"""
Wait for the specified port to become free (dropping or rejecting
requests). Return when the port is free or raise a Timeout if timeout has
elapsed.
Timeout may be specified in seconds or as a timedelta.
If timeout is None or ∞, the routine will run indefinitely.
... | 0.027632 |
def status(self, vm_name=None):
'''
Return the results of a `vagrant status` call as a list of one or more
Status objects. A Status contains the following attributes:
- name: The VM name in a multi-vm environment. 'default' otherwise.
- state: The state of the underlying guest... | 0.002233 |
def prepare_blacklist(src, dst, duration=3600, src_port1=None,
src_port2=None, src_proto='predefined_tcp',
dst_port1=None, dst_port2=None,
dst_proto='predefined_tcp'):
"""
Create a blacklist entry.
A blacklist can be added directly from... | 0.004982 |
async def set(
self, key, value, ttl=SENTINEL, dumps_fn=None, namespace=None, _cas_token=None, _conn=None
):
"""
Stores the value in the given key with ttl if specified
:param key: str
:param value: obj
:param ttl: int the expiration time in seconds. Due to memcached... | 0.005742 |
def get_assignment_group(self, course_id, assignment_group_id, grading_period_id=None, include=None, override_assignment_dates=None):
"""
Get an Assignment Group.
Returns the assignment group with the given id.
"""
path = {}
data = {}
params = {}
... | 0.004975 |
def flp_nonlinear_mselect(I,J,d,M,f,c,K):
"""flp_nonlinear_mselect -- use multiple selection model
Parameters:
- I: set of customers
- J: set of facilities
- d[i]: demand for customer i
- M[j]: capacity of facility j
- f[j]: fixed cost for using a facility in point j
... | 0.019282 |
def parse(self, instrs):
"""Parse an IR instruction.
"""
instrs_reil = []
try:
for instr in instrs:
instr_lower = instr.lower()
# If the instruction to parsed is not in the cache,
# parse it and add it to the cache.
... | 0.00375 |
def name_insert_prefix(records, prefix):
"""
Given a set of sequences, insert a prefix for each sequence's name.
"""
logging.info('Applying _name_insert_prefix generator: '
'Inserting prefix ' + prefix + ' for all '
'sequence IDs.')
for record in records:
ne... | 0.002494 |
def createSQL(self, sql, args=()):
"""
For use with auto-committing statements such as CREATE TABLE or CREATE
INDEX.
"""
before = time.time()
self._execSQL(sql, args)
after = time.time()
if after - before > 2.0:
log.msg('Extremely long CREATE: ... | 0.00542 |
def _CreateTaskStorageWriter(self, path, task):
"""Creates a task storage writer.
Args:
path (str): path to the storage file.
task (Task): task.
Returns:
SQLiteStorageFileWriter: storage writer.
"""
return SQLiteStorageFileWriter(
self._session, path,
storage_type... | 0.002762 |
def unpack(s):
"""Unpack a MXImageRecord to string.
Parameters
----------
s : str
String buffer from ``MXRecordIO.read``.
Returns
-------
header : IRHeader
Header of the image record.
s : str
Unpacked string.
Examples
--------
>>> record = mx.record... | 0.002703 |
def start_centroid_distance(item_a, item_b, max_value):
"""
Distance between the centroids of the first step in each object.
Args:
item_a: STObject from the first set in TrackMatcher
item_b: STObject from the second set in TrackMatcher
max_value: Maximum distance value used as scali... | 0.004412 |
def asnumpy(self):
"""Returns a ``numpy.ndarray`` object with value copied from this array.
Examples
--------
>>> x = mx.nd.ones((2,3))
>>> y = x.asnumpy()
>>> type(y)
<type 'numpy.ndarray'>
>>> y
array([[ 1., 1., 1.],
[ 1., 1., ... | 0.00411 |
def stage_signature(vcs, signature):
"""Add `signature` to the list of staged signatures
Args:
vcs (easyci.vcs.base.Vcs)
signature (basestring)
Raises:
AlreadyStagedError
"""
evidence_path = _get_staged_history_path(vcs)
staged = get_staged_signatures(vcs)
if signat... | 0.002037 |
def stop(self):
"""
Stop ZMQ tools.
:return: self
"""
LOGGER.debug("zeromq.Driver.stop")
for publisher in self.publishers_registry:
publisher.stop()
self.publishers_registry.clear()
for subscriber in self.subscribers_registry:
if su... | 0.004193 |
def get_smtp_mail(self):
"""
Returns the SMTP formatted email, as it may be passed to sendmail.
:rtype: string
:return: The SMTP formatted mail.
"""
header = self.get_smtp_header()
body = self.get_body().replace('\n', '\r\n')
return header + '\r\n' + bod... | 0.006061 |
def from_string(cls, s):
"""Instantiate Relations from a relations string."""
tables = []
seen = set()
current_table = None
lines = list(reversed(s.splitlines())) # to pop() in right order
while lines:
line = lines.pop().strip()
table_m = re.match... | 0.001311 |
def parse_netmhcpan28_stdout(
stdout,
prediction_method_name="netmhcpan",
sequence_key_mapping=None):
"""
# Affinity Threshold for Strong binding peptides 50.000',
# Affinity Threshold for Weak binding peptides 500.000',
# Rank Threshold for Strong binding peptides 0.500',
... | 0.001056 |
def get_transactions_filtered(self, asset_id, operation=None):
"""Get a list of transactions filtered on some criteria
"""
txids = backend.query.get_txids_filtered(self.connection, asset_id,
operation)
for txid in txids:
yield ... | 0.00578 |
def list_available_devices():
"""
List all available devices for the respective backend
returns: devices: a list of dictionaries with the keys 'identifier' and 'instance': \
[ {'identifier': 'usb://0x04f9:0x2015/C5Z315686', 'instance': pyusb.core.Device()}, ]
The 'identifier' is of the form... | 0.007488 |
def default_instruction_to_svg_dict(self, instruction):
"""Returns an xml-dictionary with the same content as
:meth:`default_instruction_to_svg`
If no file ``default.svg`` was loaded, an empty svg-dict is returned.
"""
instruction_type = instruction.type
default_type = "... | 0.002558 |
def make_flow_labels(graph, flow, capac):
"""Generate arc labels for a flow in a graph with capacities.
:param graph: adjacency list or adjacency dictionary
:param flow: flow matrix or adjacency dictionary
:param capac: capacity matrix or adjacency dictionary
:returns: listdic graph representation... | 0.002882 |
def _handle_double_click(self, event):
""" Double click with left mouse button focuses the state and toggles the collapse status"""
if event.get_button()[1] == 1: # Left mouse button
path_info = self.tree_view.get_path_at_pos(int(event.x), int(event.y))
if path_info: # Valid en... | 0.005425 |
def quote_identifier(identifier: str,
mixed: Union[SQLCompiler, Engine, Dialect]) -> str:
"""
Converts an SQL identifier to a quoted version, via the SQL dialect in
use.
Args:
identifier: the identifier to be quoted
mixed: an SQLAlchemy :class:`SQLCompiler`, :class:... | 0.001704 |
def write(self, content):
"""Save content on disk"""
with io.open(self.target, 'w', encoding='utf-8') as fp:
fp.write(content)
if not content.endswith(u'\n'):
fp.write(u'\n') | 0.008696 |
def run(cmd, background=False):
"""
Executes the given command
If background flag is True the command will run in background
and this method will return a :class:`Popen` object
If background is False (default) the command will run in this thread
and this method will return stdout.
A Comma... | 0.00123 |
def rm_corr(data=None, x=None, y=None, subject=None, tail='two-sided'):
"""Repeated measures correlation.
Parameters
----------
data : pd.DataFrame
Dataframe.
x, y : string
Name of columns in ``data`` containing the two dependent variables.
subject : string
Name of colum... | 0.000267 |
def confirm(pid, record, template, **kwargs):
"""Confirm email address."""
recid = int(pid.pid_value)
token = request.view_args['token']
# Validate token
data = EmailConfirmationSerializer.compat_validate_token(token)
if data is None:
flash(_("Invalid confirmation link."), category='da... | 0.001229 |
def get_col_rgba(color, transparency=None, opacity=None):
"""This class converts a Gdk.Color into its r, g, b parts and adds an alpha according to needs
If both transparency and opacity is None, alpha is set to 1 => opaque
:param Gdk.Color color: Color to extract r, g and b from
:param float | None t... | 0.004216 |
def ui_clear_clicked_image(self, value):
"""
Setter for **self.__ui_clear_clicked_image** attribute.
:param value: Attribute value.
:type value: unicode
"""
if value is not None:
assert type(value) is unicode, "'{0}' attribute: '{1}' type is not 'unicode'!".... | 0.007055 |
def transformer(self):
"""
Creates the internal transformer that maps the cluster center's high
dimensional space to its two dimensional space.
"""
ttype = self.embedding.lower() # transformer method type
if ttype == 'mds':
return MDS(n_components=2, random_s... | 0.005758 |
def get_uri_obj(uri, storage_args={}):
"""
Retrieve the underlying storage object based on the URI (i.e., scheme).
:param str uri: URI to get storage object for
:param dict storage_args: Keyword arguments to pass to the underlying storage object
"""
if isinstance(uri, BaseURI): return uri
... | 0.00639 |
def weights_to_cpu(state_dict):
"""Copy a model state_dict to cpu.
Args:
state_dict (OrderedDict): Model weights on GPU.
Returns:
OrderedDict: Model weights on GPU.
"""
state_dict_cpu = OrderedDict()
for key, val in state_dict.items():
state_dict_cpu[key] = val.cpu()
... | 0.002915 |
def magic_session(db_session=None, url=None):
"""Either does nothing with the session you already have or
makes one that commits and closes no matter what happens
"""
if db_session is not None:
yield db_session
else:
session = get_session(url, expire_on_commit=False)
try:
... | 0.00216 |
def calc_pvalues(query, gene_sets, background=20000, **kwargs):
""" calculate pvalues for all categories in the graph
:param set query: set of identifiers for which the p value is calculated
:param dict gene_sets: gmt file dict after background was set
:param set background: total number of genes in yo... | 0.008445 |
def handle_button(self, event, event_type):
"""Convert the button information from quartz into evdev format."""
# 0 for left
# 1 for right
# 2 for middle/center
# 3 for side
mouse_button_number = self._get_mouse_button_number(event)
# Identify buttons 3,4,5
... | 0.002103 |
def list_lbaas_pools(self, retrieve_all=True, **_params):
"""Fetches a list of all lbaas_pools for a project."""
return self.list('pools', self.lbaas_pools_path,
retrieve_all, **_params) | 0.008811 |
def appendSpacePadding(str, blocksize=AES_blocksize):
'Pad with spaces'
pad_len = paddingLength(len(str), blocksize)
padding = '\0'*pad_len
return str + padding | 0.039326 |
def submitted_projects(raw_df):
"""
Return all submitted projects.
"""
df = raw_df.astype({'PRONAC': str, 'CgcCpf': str})
submitted_projects = df.groupby('CgcCpf')[
'PRONAC'
].agg(['unique', 'nunique'])
submitted_projects.columns = ['pronac_list', 'num_pronacs']
return submitte... | 0.00303 |
def example_delete_topics(a, topics):
""" delete topics """
# Call delete_topics to asynchronously delete topics, a future is returned.
# By default this operation on the broker returns immediately while
# topics are deleted in the background. But here we give it some time (30s)
# to propagate in t... | 0.001362 |
def exists_uda(self, name, database=None):
"""
Checks if a given UDAF exists within a specified database
Parameters
----------
name : string, UDAF name
database : string, database name
Returns
-------
if_exists : boolean
"""
retur... | 0.005333 |
def get_global_config_dir():
"""Returns global config location. E.g. ~/.config/dvc/config.
Returns:
str: path to the global config directory.
"""
from appdirs import user_config_dir
return user_config_dir(
appname=Config.APPNAME, appauthor=Config.APPAUTH... | 0.006024 |
def _or_join(self, close_group=False):
"""Combine terms with OR.
There must be a term added before using this method.
Arguments:
close_group (bool): If ``True``, will end the current group and start a new one.
If ``False``, will continue current group.
... | 0.005031 |
def _authorization_header(cls, credentials):
"""
Creates authorization headers if the provider supports it. See:
http://en.wikipedia.org/wiki/Basic_access_authentication.
:param credentials:
:class:`.Credentials`
:returns:
Headers as :class:`dict`.
... | 0.003106 |
def add_directory(self, relativePath, description=None, clean=False,
raiseError=True, ntrials=3):
"""
Add a directory in the repository and creates its attribute in the
Repository with utc timestamp. It insures adding all the missing
directories in the path.
... | 0.006277 |
def run_task(self, task_name, **options):
""" Runs a named CumulusCI task for the current project with optional
support for overriding task options via kwargs.
Examples:
| =Keyword= | =task_name= | =task_options= | =comment= |
|... | 0.0075 |
def _onCompletionListItemSelected(self, index):
"""Item selected. Insert completion to editor
"""
model = self._widget.model()
selectedWord = model.words[index]
textToInsert = selectedWord[len(model.typedText()):]
self._qpart.textCursor().insertText(textToInsert)
... | 0.005831 |
def conf_as_dict(conf_filename, encoding=None, case_sensitive=False):
"""
读入 ini 配置文件,返回根据配置文件内容生成的字典类型变量;
:param:
* conf_filename: (string) 需要读入的 ini 配置文件长文件名
* encoding: (string) 文件编码
* case_sensitive: (bool) 是否大小写敏感,默认为 False
:return:
* flag: (bool) 读取配置文件是否正确,正确返回 Tr... | 0.004772 |
def getAtomic(rates, ver, lamb, br, reactfn):
""" prompt atomic emissions (nm)
844.6 777.4
"""
with h5py.File(reactfn, 'r') as f:
lambnew = f['/atomic/lambda'].value.ravel(order='F') # some are not 1-D!
vnew = np.concatenate((rates.loc[..., 'po3p3p'].values[..., None],
... | 0.006787 |
def extract(self, msg):
"""Yield an ordered dictionary if msg['type'] is in keys_by_type."""
def normal(key):
v = msg.get(key)
if v is None:
return v
normalizer = self.normalizers.get(key, lambda x: x)
return normalizer(v)
def odic... | 0.002384 |
def dvds_new_releases(self, **kwargs):
"""Gets the upcoming movies from the API.
Args:
page_limit (optional): number of movies to show per page, default=16
page (optional): results page number, default=1
country (optional): localized data for selected country, default="us"... | 0.003442 |
def run_epoch(self, epoch_info: EpochInfo, source: 'vel.api.Source'):
""" Run full epoch of learning """
epoch_info.on_epoch_begin()
lr = epoch_info.optimizer.param_groups[-1]['lr']
print("|-------- Epoch {:06} Lr={:.6f} ----------|".format(epoch_info.global_epoch_idx, lr))
sel... | 0.005348 |
def quote_header_value(value, extra_chars='', allow_token=True):
"""Quote a header value if necessary.
:param value: the value to quote.
:param extra_chars: a list of extra characters to skip quoting.
:param allow_token: if this is enabled token values are returned
unchanged.
"""
value ... | 0.001799 |
def _get_flat_db_sources(self, model):
""" Return a flattened representation of the individual ``sources`` lists. """
sources = []
for source in self.sources:
for sub_source in self.expand_source(source):
target_field = self.resolve_source(model, sub_source)
... | 0.007264 |
def create_stash(self, payload, path=None):
"""
Create a stash. (JSON document)
"""
if path:
self._request('POST', '/stashes/{}'.format(path),
json=payload)
else:
self._request('POST', '/stashes', json=payload)
return True | 0.00625 |
def all_agents(stmts):
"""Return a list of all of the agents from a list of statements.
Only agents that are not None and have a TEXT entry are returned.
Parameters
----------
stmts : list of :py:class:`indra.statements.Statement`
Returns
-------
agents : list of :py:class:`indra.stat... | 0.001287 |
def save(self, info):
""" Handles saving the current model to the last file.
"""
save_file = self.save_file
if not isfile(save_file):
self.save_as(info)
else:
fd = None
try:
fd = open(save_file, "wb")
dot_code =... | 0.004367 |
def resolve_include(self, t):
"""Resolve a tuple-ized #include line.
This handles recursive expansion of values without "" or <>
surrounding the name until an initial " or < is found, to handle
#include FILE
where FILE is a #define somewhere else."""
s = t[1]
... | 0.003831 |
def attach_volume(self, xml_bytes):
"""Parse the XML returned by the C{AttachVolume} function.
@param xml_bytes: XML bytes with a C{AttachVolumeResponse} root
element.
@return: a C{dict} with status and attach_time keys.
TODO: volumeId, instanceId, device
"""
... | 0.003401 |
def _AsList(arg):
"""Encapsulates an argument in a list, if it's not already iterable."""
if (isinstance(arg, string_types) or
not isinstance(arg, collections.Iterable)):
return [arg]
else:
return list(arg) | 0.016807 |
def iter_parsed_values(self, field: Field) -> Iterable[Tuple[str, Any]]:
"""
Walk the dictionary of parsers and emit all non-null values.
"""
for key, func in self.parsers.items():
value = func(field)
if not value:
continue
yield key, ... | 0.006154 |
def query_tissue_specificity():
"""
Returns list of tissue specificity by query parameters
---
tags:
- Query functions
parameters:
- name: comment
in: query
type: string
required: false
description: Comment to tissue specificity
default: '%APP6... | 0.001186 |
def _parse_resource(resource):
""" Parses and completes resource information """
resource = resource.strip() if resource else resource
if resource in {ME_RESOURCE, USERS_RESOURCE}:
return resource
elif '@' in resource and not resource.startswith(USERS_RESOURCE):
#... | 0.003226 |
def load_json(json_file, **kwargs):
"""
Open and load data from a JSON file
.. code:: python
reusables.load_json("example.json")
# {u'key_1': u'val_1', u'key_for_dict': {u'sub_dict_key': 8}}
:param json_file: Path to JSON file as string
:param kwargs: Additional arguments for the ... | 0.002283 |
def GetSummary(self):
"""Gets a client summary object.
Returns:
rdf_client.ClientSummary
Raises:
ValueError: on bad cloud type
"""
summary = rdf_client.ClientSummary()
summary.client_id = self.client_id
summary.timestamp = self.timestamp
summary.system_info.release = self.o... | 0.008844 |
def create_framework(
bundles,
properties=None,
auto_start=False,
wait_for_stop=False,
auto_delete=False,
):
# type: (Union[list, tuple], dict, bool, bool, bool) -> Framework
"""
Creates a Pelix framework, installs the given bundles and returns its
instance reference.
If *auto_st... | 0.000446 |
def exponential(x, y, xscale, yscale):
"""
Two-dimensional oriented exponential decay pattern.
"""
if xscale==0.0 or yscale==0.0:
return x*0.0
with float_error_ignore():
x_w = np.divide(x,xscale)
y_h = np.divide(y,yscale)
return np.exp(-np.sqrt(x_w*x_w+y_h*y_h)) | 0.015873 |
def do_photometry(self):
"""
Does photometry and estimates uncertainties by calculating the scatter around a linear fit to the data
in each orientation. This function is called by other functions and generally the user will not need
to interact with it directly.
"""
... | 0.011728 |
def get_subgraphs_by_annotation(graph, annotation, sentinel=None):
"""Stratify the given graph into sub-graphs based on the values for edges' annotations.
:param pybel.BELGraph graph: A BEL graph
:param str annotation: The annotation to group by
:param Optional[str] sentinel: The value to stick unannot... | 0.007267 |
def add_factors(self, *factors):
"""
Associate a factor to the graph.
See factors class for the order of potential values
Parameters
----------
*factor: pgmpy.factors.factors object
A factor object on any subset of the variables of the model which
... | 0.00172 |
def write_path(target, path, value, separator='/'):
"""Write a value deep into a dict building any intermediate keys.
:param target: a dict to write data to
:param path: a key or path to a key (path is delimited by `separator`)
:param value: the value to write to the key
:keyword separator: the sep... | 0.001543 |
def update_user(self, user_is_artist="", artist_level="", artist_specialty="", real_name="", tagline="", countryid="", website="", bio=""):
"""Update the users profile information
:param user_is_artist: Is the user an artist?
:param artist_level: If the user is an artist, what level are they
... | 0.003868 |
def evaluate_model(self,
accuracy,
num_steps,
feed_vars=(),
feed_data=None,
summary_tag=None,
print_every=0):
"""Evaluates the given model.
Args:
accuracy: The metric that is bein... | 0.006809 |
def descendents(self, method=None, state=None):
"""
Find descendant tasks, optionally filtered by method and/or state.
:param method: (optional) filter for tasks, eg. "buildArch".
:param state: (optional) filter for tasks, eg. task_states.OPEN.
:returns: deferred that when fired... | 0.00317 |
def write_word(self, offset, word):
"""
.. _write_word:
Writes one word from a device,
see read_word_.
"""
self._lock = True
if(offset > self.current_max_offset):
raise BUSError("Offset({}) exceeds address space of BUS({})".format(offset, self.current_max_offset))
self.writes += 1
self.truncat... | 0.040241 |
def find_message_handler(self, handler_name, handler_type='primary'):
"""Returns the MessageHandler given its name and type for this class."""
ret = lib.EnvFindDefmessageHandler(
self._env, self._cls, handler_name.encode(), handler_type.encode())
if ret == 0:
raise CLIPSE... | 0.007634 |
def evaluated_variants(self, case_id):
"""Returns variants that has been evaluated
Return all variants, snvs/indels and svs from case case_id
which have a entry for 'acmg_classification', 'manual_rank', 'dismiss_variant'
or if they are commented.
Args:
case_id(str)
... | 0.002342 |
def join(self, _id):
""" Join a room """
if not SockJSRoomHandler._room.has_key(self._gcls() + _id):
SockJSRoomHandler._room[self._gcls() + _id] = set()
SockJSRoomHandler._room[self._gcls() + _id].add(self) | 0.012397 |
def simulate():
'''instantiate and execute network simulation'''
#separate model execution from parameters for safe import from other files
nest.ResetKernel()
'''
Configuration of the simulation kernel by the previously defined time
resolution used in the simulation. Setting "print_time" to Tru... | 0.010114 |
def add_subsegment(self, subsegment):
"""
Add input subsegment as a child subsegment.
"""
self._check_ended()
subsegment.parent_id = self.id
self.subsegments.append(subsegment) | 0.008929 |
def license():
''' Print the Bokeh license to the console.
Returns:
None
'''
from os.path import join
with open(join(__path__[0], 'LICENSE.txt')) as lic:
print(lic.read()) | 0.004785 |
def datasets_create_new(self, dataset_new_request, **kwargs): # noqa: E501
"""Create a new dataset # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.datasets_create_new(dataset_new_re... | 0.002039 |
def apply_to(self, A):
"""Apply the coordinate transformation to points in A. """
if A.ndim == 1:
A = np.expand_dims(A, axis=0)
rows, cols = A.shape
A_new = np.hstack([A, np.ones((rows, 1))])
A_new = np.transpose(self.T.dot(np.transpose(A_new)))
return A_new[... | 0.006061 |
def update_from_stats(self, stats):
"""Update columns based on partition statistics"""
sd = dict(stats)
for c in self.columns:
if c not in sd:
continue
stat = sd[c]
if stat.size and stat.size > c.size:
c.size = stat.size
... | 0.005764 |
def save_cursor(self):
"""Push the current cursor position onto the stack."""
self.savepoints.append(Savepoint(copy.copy(self.cursor),
self.g0_charset,
self.g1_charset,
self.charset... | 0.004435 |
def get_channel_access_token(self, channel):
"""Return the token and sig for the given channel
:param channel: the channel or channel name to get the access token for
:type channel: :class:`channel` | :class:`str`
:returns: The token and sig for the given channel
:rtype: (:class... | 0.003339 |
def authenticated(f):
"""Decorator that authenticates to Keystone automatically."""
@wraps(f)
def new_f(self, *args, **kwargs):
if not self.nova_client.client.auth_token:
self.authenticate()
return f(self, *args, **kwargs)
return new_f | 0.003584 |
def convert_errno(e):
"""
Convert an errno value (as from an ``OSError`` or ``IOError``) into a
standard SFTP result code. This is a convenience function for trapping
exceptions in server code and returning an appropriate result.
:param int e: an errno code, as from ``OSError.e... | 0.002937 |
def create_router(self, name, ext_network=None, admin_state_up=True):
'''
Creates a new router
'''
body = {'name': name,
'admin_state_up': admin_state_up}
if ext_network:
net_id = self._find_network_id(ext_network)
body['external_gateway_in... | 0.004773 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.