text stringlengths 78 104k | score float64 0 0.18 |
|---|---|
def get_selected_submissions(self, course, filter_type, selected_tasks, users, aggregations, stype):
"""
Returns the submissions that have been selected by the admin
:param course: course
:param filter_type: users or aggregations
:param selected_tasks: selected tasks id
:... | 0.007007 |
def parse_at_root(
self,
root, # type: ET.Element
state # type: _ProcessorState
):
# type: (...) -> Any
"""Parse the given element as the root of the document."""
xml_value = self._processor.parse_at_root(root, state)
return _hooks_apply_after_pa... | 0.011299 |
def fit(self, X, y=None):
'''
Learn the linear transformation to flipped eigenvalues.
Parameters
----------
X : array, shape [n, n]
The *symmetric* input similarities. If X is asymmetric, it will be
treated as if it were symmetric based on its lower-trian... | 0.002577 |
def _set_mpls_traffic_bypass(self, v, load=False):
"""
Setter method for mpls_traffic_bypass, mapped from YANG variable /telemetry/profile/mpls_traffic_bypass (list)
If this variable is read-only (config: false) in the
source YANG file, then _set_mpls_traffic_bypass is considered as a private
method... | 0.004242 |
def start_exp():
""" Serves up the experiment applet. """
if not (('hitId' in request.args) and ('assignmentId' in request.args) and
('workerId' in request.args) and ('mode' in request.args)):
raise ExperimentError('hit_assign_worker_id_not_set_in_exp')
hit_id = request.args['hitId']
... | 0.001718 |
def _auth(profile=None):
'''
Set up neutron credentials
'''
if profile:
credentials = __salt__['config.option'](profile)
user = credentials['keystone.user']
password = credentials['keystone.password']
tenant = credentials['keystone.tenant']
auth_url = credentials[... | 0.000864 |
def entropy_from_samples(samples, vec):
"""
Estimate H(x|s) ~= -E_{x \sim P(x|s)}[\log Q(x|s)], where x are samples, and Q is parameterized by vec.
"""
samples_cat = tf.argmax(samples[:, :NUM_CLASS], axis=1, output_type=tf.int32)
samples_uniform = samples[:, NUM_CLASS:]
cat, uniform = get_distri... | 0.007184 |
def show_bandwidth_limit_rule(self, rule, policy, body=None):
"""Fetches information of a certain bandwidth limit rule."""
return self.get(self.qos_bandwidth_limit_rule_path %
(policy, rule), body=body) | 0.008264 |
def read_anchors(ac, qorder, sorder, minsize=0):
"""
anchors file are just (geneA, geneB) pairs (with possible deflines)
"""
all_anchors = defaultdict(list)
nanchors = 0
anchor_to_block = {}
for a, b, idx in ac.iter_pairs(minsize=minsize):
if a not in qorder or b not in sorder:
... | 0.001468 |
def _is_auth_info_available():
"""Check if user auth info has been set in environment variables."""
return (_ENDPOINTS_USER_INFO in os.environ or
(_ENV_AUTH_EMAIL in os.environ and _ENV_AUTH_DOMAIN in os.environ) or
_ENV_USE_OAUTH_SCOPE in os.environ) | 0.010909 |
def _init(creds, bucket, multiple_env, environment, prefix, s3_cache_expire):
'''
Connect to S3 and download the metadata for each file in all buckets
specified and cache the data to disk.
'''
cache_file = _get_buckets_cache_filename(bucket, prefix)
exp = time.time() - s3_cache_expire
# ch... | 0.001807 |
def list_audit_sink(self, **kwargs):
"""
list or watch objects of kind AuditSink
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.list_audit_sink(async_req=True)
>>> result = thread.... | 0.001994 |
def _labeledInput(activeInputs, cellsPerCol=32):
"""Print the list of [column, cellIdx] indices for each of the active
cells in activeInputs.
"""
if cellsPerCol == 0:
cellsPerCol = 1
cols = activeInputs.size / cellsPerCol
activeInputs = activeInputs.reshape(cols, cellsPerCol)
(cols, cellIdxs) = active... | 0.023392 |
def _get_params(self, rdata):
"""
Returns a list of jsonrpc request's method parameters.
"""
if 'params' in rdata:
if isinstance(rdata['params'], dict) \
or isinstance(rdata['params'], list) \
or rdata['params'] is None:
... | 0.004255 |
def _clear(self):
"""
Clear the current image.
"""
self._plain_image = [" " * self._width for _ in range(self._height)]
self._colour_map = [[(None, 0, 0) for _ in range(self._width)]
for _ in range(self._height)] | 0.007143 |
def visit_assignment(self, node, children):
"""
Create parser rule for assignments and register attribute types
on metaclass.
"""
attr_name = children[0]
op = children[1]
rhs_rule, modifiers = children[2]
cls = self._current_cls
target_cls = None
... | 0.000423 |
def get_varval_from_locals(key, locals_, strict=False):
"""
Returns a variable value from locals.
Different from locals()['varname'] because
get_varval_from_locals('varname.attribute', locals())
is allowed
"""
assert isinstance(key, six.string_types), 'must have parsed key into a string alre... | 0.002418 |
def depopulate(self, is_update):
"""Get all the fields that need to be saved
:param is_udpate: bool, True if update query, False if insert
:returns: dict, key is field_name and val is the field value to be saved
"""
fields = {}
schema = self.schema
for k, field i... | 0.003868 |
def mod_watch(name,
sfun=None,
sig=None,
full_restart=False,
init_delay=None,
force=False,
**kwargs):
'''
The service watcher, called to invoke the watch command.
When called, it will restart or reload the named service.
... | 0.001079 |
def _format(color, style=''):
"""Return a QTextCharFormat with the given attributes.
"""
_color = QColor()
_color.setNamedColor(color)
_format = QTextCharFormat()
_format.setForeground(_color)
if 'bold' in style:
_format.setFontWeight(QFont.Bold)
if 'italic' in style:
... | 0.002646 |
def plot(x, y, z, ax=None, **kwargs):
r"""
Plot iso-probability mass function, converted to sigmas.
Parameters
----------
x, y, z : numpy arrays
Same as arguments to :func:`matplotlib.pyplot.contour`
ax: axes object, optional
:class:`matplotlib.axes._subplots.AxesSubplot` to pl... | 0.000298 |
def zip_dict(a: Dict[str, A], b: Dict[str, B]) \
-> Dict[str, Tuple[Optional[A], Optional[B]]]:
"""
Combine the values within two dictionaries by key.
:param a: The first dictionary.
:param b: The second dictionary.
:return: A dictionary containing all keys that appear in the union of a and... | 0.001894 |
def _make_sentence(txt):
"""Make a sentence from a piece of text."""
#Make sure first letter is capitalized
txt = txt.strip(' ')
txt = txt[0].upper() + txt[1:] + '.'
return txt | 0.010204 |
def _construct_stage(self, deployment, swagger):
"""Constructs and returns the ApiGateway Stage.
:param model.apigateway.ApiGatewayDeployment deployment: the Deployment for this Stage
:returns: the Stage to which this SAM Api corresponds
:rtype: model.apigateway.ApiGatewayStage
... | 0.005 |
def outfile(self, p):
"""Path for an output file.
If :attr:`outdir` is set then the path is
``outdir/basename(p)`` else just ``p``
"""
if self.outdir is not None:
return os.path.join(self.outdir, os.path.basename(p))
else:
return p | 0.006579 |
def resample(self,N,**kwargs):
"""Random resampling of the doublegauss distribution
"""
lovals = self.mu - np.absolute(rand.normal(size=N)*self.siglo)
hivals = self.mu + np.absolute(rand.normal(size=N)*self.sighi)
u = rand.random(size=N)
hi = (u < float(self.sighi)/(self... | 0.007797 |
def info(self, cloud=None, api_key=None, version=None, **kwargs):
"""
Return the current state of the model associated with a given collection
"""
url_params = {"batch": False, "api_key": api_key, "version": version, "method": "info"}
return self._api_handler(None, cloud=cloud, a... | 0.013699 |
def reload(self):
"""Reload server configuration."""
status = self.get_status()
if status != 'running':
raise ClusterError('cannot reload: cluster is not running')
process = subprocess.run(
[self._pg_ctl, 'reload', '-D', self._data_dir],
stdout=subpro... | 0.003448 |
def Page_setDeviceMetricsOverride(self, width, height, deviceScaleFactor,
mobile, **kwargs):
"""
Function path: Page.setDeviceMetricsOverride
Domain: Page
Method name: setDeviceMetricsOverride
WARNING: This function is marked 'Experimental'!
Parameters:
Required arguments:
'width' (t... | 0.032563 |
def propagate_name_down(self, col_name, df_name, verbose=False):
"""
Put the data for "col_name" into dataframe with df_name
Used to add 'site_name' to specimen table, for example.
"""
if df_name not in self.tables:
table = self.add_magic_table(df_name)[1]
... | 0.002429 |
def list_pages_ajax(request, invalid_move=False):
"""Render pages table for ajax function."""
language = get_language_from_request(request)
pages = Page.objects.root()
context = {
'invalid_move': invalid_move,
'language': language,
'pages': pages,
}
return render_to_respo... | 0.00905 |
def analyse(self, name):
"""
reads the specified file.
:param name: the name.
:return: the analysis as frequency/Pxx.
"""
if name in self._cache:
target = self._cache[name]
if target['type'] == 'wav':
signal = self._uploadController... | 0.002162 |
def run_service_actions(self):
"""Run any actions on services requested."""
if not self.service_actions:
return
for svc_action in self.service_actions:
name = svc_action['service']
actions = svc_action['actions']
log("Running service '%s' actions ... | 0.002886 |
def magicrun(
text,
shell,
prompt_template="default",
aliases=None,
envvars=None,
extra_commands=None,
speed=1,
test_mode=False,
commentecho=False,
):
"""Echo out each character in ``text`` as keyboard characters are pressed,
wait for a RETURN keypress, then run the ``text`` ... | 0.001504 |
def get_dirs_differance(self):
'''
Makes final versions of site_packages and scripts using DirsContent
sub method and filters
'''
try:
diff = self.dirs_after_install - self.dirs_before_install
except ValueError:
raise VirtualenvFailException(
... | 0.001978 |
def translate_formes_visuelles(s):
"""s.u.-'O:M:.-'O:.-',+s.u.-'M:O:.-O:.-'M:.-', => b.-S:.U:.-'O:M:.-'O:.-', + b.-S:.U:.-'M:O:.-O:.-'M:.-',"""
def set_bSU_subst(s):
subst, attr, mode = s
return m(script("b.-S:.U:.-'"), attr, mode)
if isinstance(s, AdditiveScript):
return AdditiveS... | 0.004914 |
def exit(self):
"""Overwrite the exit method to close the GPU API."""
if self.nvml_ready:
try:
pynvml.nvmlShutdown()
except Exception as e:
logger.debug("pynvml failed to shutdown correctly ({})".format(e))
# Call the father exit method
... | 0.008523 |
def _encrypt(key_data, derived_key_information):
"""
Encrypt 'key_data' using the Advanced Encryption Standard (AES-256) algorithm.
'derived_key_information' should contain a key strengthened by PBKDF2. The
key size is 256 bits and AES's mode of operation is set to CTR (CounTeR Mode).
The HMAC of the ciphert... | 0.012666 |
def loudness(self, gain_db=-10.0, reference_level=65.0):
'''Loudness control. Similar to the gain effect, but provides
equalisation for the human auditory system.
The gain is adjusted by gain_db and the signal is equalised according
to ISO 226 w.r.t. reference_level.
Parameters... | 0.001622 |
def get_gain(data, attr, class_attr,
method=DEFAULT_DISCRETE_METRIC,
only_sub=0, prefer_fewer_values=False, entropy_func=None):
"""
Calculates the information gain (reduction in entropy) that would
result by splitting the data on the chosen attribute (attr).
Parameters:
prefer_fewe... | 0.006074 |
def plotly_graph(
kmgraph,
graph_layout="kk",
colorscale=None,
showscale=True,
factor_size=3,
edge_linecolor="rgb(180,180,180)",
edge_linewidth=1.5,
node_linecolor="rgb(255,255,255)",
node_linewidth=1.0,
):
"""Generate Plotly data structures that represent the mapper g... | 0.001305 |
def stats(self):
""" shotcut to pull out useful info for interactive use """
printDebug("Classes.....: %d" % len(self.all_classes))
printDebug("Properties..: %d" % len(self.all_properties)) | 0.00939 |
def pi0est(p_values, lambda_ = np.arange(0.05,1.0,0.05), pi0_method = "smoother", smooth_df = 3, smooth_log_pi0 = False):
""" Estimate pi0 according to bioconductor/qvalue """
# Compare to bioconductor/qvalue reference implementation
# import rpy2
# import rpy2.robjects as robjects
# from rpy2.robj... | 0.011567 |
def phonetic_fingerprint(
phrase, phonetic_algorithm=double_metaphone, joiner=' ', *args, **kwargs
):
"""Return the phonetic fingerprint of a phrase.
This is a wrapper for :py:meth:`Phonetic.fingerprint`.
Parameters
----------
phrase : str
The string from which to calculate the phoneti... | 0.000781 |
def console_user(username=False):
'''
Gets the UID or Username of the current console user.
:return: The uid or username of the console user.
:param bool username: Whether to return the username of the console
user instead of the UID. Defaults to False
:rtype: Interger of the UID, or a string... | 0.002212 |
def age(*paths):
'''Return the minimum age of a set of files.
Returns 0 if no paths are given.
Returns time.time() if a path does not exist.'''
if not paths:
return 0
for path in paths:
if not os.path.exists(path):
return time.time()
return min([(time.time() - os.path.getmtime(path)) for path in paths]) | 0.031348 |
def set_requests_per_second(self, req_per_second):
'''Adjusts the request/second at run-time'''
self.req_per_second = req_per_second
self.req_duration = 1 / self.req_per_second | 0.01 |
def _update_alpha(self, event=None):
"""Update display after a change in the alpha spinbox."""
a = self.alpha.get()
hexa = self.hexa.get()
hexa = hexa[:7] + ("%2.2x" % a).upper()
self.hexa.delete(0, 'end')
self.hexa.insert(0, hexa)
self.alphabar.set(a)
sel... | 0.0059 |
def install(plugin_name, *args, **kwargs):
'''
Install plugin packages based on specified Conda channels.
.. versionchanged:: 0.19.1
Do not save rollback info on dry-run.
.. versionchanged:: 0.24
Remove channels argument. Use Conda channels as configured in Conda
environment.
... | 0.000728 |
def get_value_product_unique(self, pos):
"""
Return all products unique relationship with POS's Storage (only salable zones)
"""
qs = ProductUnique.objects.filter(
box__box_structure__zone__storage__in=pos.storage_stock.filter(storage_zones__salable=True),
product... | 0.011142 |
def to_world(self, shape, dst_crs=None):
"""Return the shape (provided in pixel coordinates) in world coordinates, as GeoVector."""
if dst_crs is None:
dst_crs = self.crs
shp = transform(shape, self.crs, dst_crs, dst_affine=self.affine)
return GeoVector(shp, dst_crs) | 0.009646 |
def align_to_sort_bam(fastq1, fastq2, aligner, data):
"""Align to the named genome build, returning a sorted BAM file.
"""
names = data["rgnames"]
align_dir_parts = [data["dirs"]["work"], "align", names["sample"]]
if data.get("disambiguate"):
align_dir_parts.append(data["disambiguate"]["geno... | 0.001373 |
def send(self, jlink):
"""Starts the SWD transaction.
Steps for a Read Transaction:
1. First phase in which the request is sent.
2. Second phase in which an ACK is received. This phase consists of
three bits. An OK response has the value ``1``.
3. Once th... | 0.001365 |
def invert(self, src=None):
"""Calculate the inverted matrix. Return 0 if successful and replace
current one. Else return 1 and do nothing.
"""
if src is None:
dst = TOOLS._invert_matrix(self)
else:
dst = TOOLS._invert_matrix(src)
if dst[0] == 1:
... | 0.004762 |
def export(self, name, columns, points):
"""Write the points to the ES server."""
logger.debug("Export {} stats to ElasticSearch".format(name))
# Create DB input
# https://elasticsearch-py.readthedocs.io/en/master/helpers.html
actions = []
for c, p in zip(columns, points... | 0.004655 |
def newKey(a, b, k):
""" Try to find two large pseudo primes roughly between a and b.
Generate public and private keys for RSA encryption.
Raises ValueError if it fails to find one"""
try:
p = findAPrime(a, b, k)
while True:
q = findAPrime(a, b, k)
if q != p:
... | 0.00361 |
def fast_gradient_method(model_fn, x, eps, ord, clip_min=None, clip_max=None, y=None,
targeted=False, sanity_checks=False):
"""
Tensorflow 2.0 implementation of the Fast Gradient Method.
:param model_fn: a callable that takes an input tensor and returns the model logits.
:param x: input... | 0.010749 |
def human_duration(duration_seconds: float) -> str:
"""Convert a duration in seconds into a human friendly string."""
if duration_seconds < 0.001:
return '0 ms'
if duration_seconds < 1:
return '{} ms'.format(int(duration_seconds * 1000))
return '{} s'.format(int(duration_seconds)) | 0.003195 |
def filter_data(data, kernel, mode='constant', fill_value=0.0,
check_normalization=False):
"""
Convolve a 2D image with a 2D kernel.
The kernel may either be a 2D `~numpy.ndarray` or a
`~astropy.convolution.Kernel2D` object.
Parameters
----------
data : array_like
T... | 0.000489 |
def req(self, method, params=()):
"""send request to ppcoind"""
response = self.session.post(
self.url,
data=json.dumps({"method": method, "params": params, "jsonrpc": "1.1"}),
).json()
if response["error"] is not None:
return response["error"]
... | 0.008197 |
def loudest_triggers_from_cli(opts, coinc_parameters=None,
sngl_parameters=None, bank_parameters=None):
""" Parses the CLI options related to find the loudest coincident or
single detector triggers.
Parameters
----------
opts : object
Result of parsing the CLI ... | 0.001488 |
async def submit_action(pool_handle: int,
request_json: str,
nodes: Optional[str],
timeout: Optional[int]) -> str:
"""
Send action to particular nodes of validator pool.
The list of requests can be send:
POOL_RESTART
... | 0.003721 |
def get_resource(resource_name):
"""
Return a resource in current directory or in frozen package
"""
resource_path = None
if hasattr(sys, "frozen"):
resource_path = os.path.normpath(os.path.join(os.path.dirname(sys.executable), resource_name))
elif not hasattr(sys, "frozen") and pkg_res... | 0.007435 |
def load(cls, data, promote=False):
"""Create a new ent from an existing value. The value must either
be an instance of Ent, or must be an instance of SAFE_TYPES. If
the value is a base type (bool, int, string, etc), it will just be
returned. Iterable types will be loaded recursively,... | 0.001529 |
def _get_cf_grid_mapping_var(self):
"""Figure out which grid mapping should be used"""
gmaps = ['fixedgrid_projection', 'goes_imager_projection',
'lambert_projection', 'polar_projection',
'mercator_projection']
if 'grid_mapping' in self.filename_info:
... | 0.003509 |
def knapsack(p, v, cmax):
"""Knapsack problem: select maximum value set of items if total size not more than capacity
:param p: table with size of items
:param v: table with value of items
:param cmax: capacity of bag
:requires: number of items non-zero
:returns: value optimal solution, list of... | 0.001542 |
def shape(self):
"""Tuple of array dimensions.
Examples
--------
>>> x = mx.nd.array([1, 2, 3, 4])
>>> x.shape
(4L,)
>>> y = mx.nd.zeros((2, 3, 4))
>>> y.shape
(2L, 3L, 4L)
"""
ndim = mx_int()
pdata = ctypes.POINTER(mx_int)... | 0.003663 |
def wrap_get_user(cls, response):
"""Wrap the response from getting a user into an instance
and return it
:param response: The response from getting a user
:type response: :class:`requests.Response`
:returns: the new user instance
:rtype: :class:`list` of :class:`User`
... | 0.00463 |
def get_header(headers, name, default=None):
"""Return the value of header *name*.
The *headers* argument must be a list of ``(name, value)`` tuples. If the
header is found its associated value is returned, otherwise *default* is
returned. Header names are matched case insensitively.
"""
name =... | 0.002242 |
def make_article_info_copyright(self, article_info_div):
"""
Makes the copyright section for the ArticleInfo. For PLoS, this means
handling the information contained in the metadata <permissions>
element.
"""
perm = self.article.root.xpath('./front/article-meta/permission... | 0.003215 |
def remove_duplicates(apps, schema_editor):
"""
Remove any duplicates from the entity relationship table
:param apps:
:param schema_editor:
:return:
"""
# Get the model
EntityRelationship = apps.get_model('entity', 'EntityRelationship')
# Find the duplicates
duplicates = Entity... | 0.001065 |
def data_filler_simple_registration(self, number_of_rows, conn):
'''creates and fills the table with simple regis. information
'''
cursor = conn.cursor()
cursor.execute('''
CREATE TABLE simple_registration(id TEXT PRIMARY KEY,
email TEXT , password TEXT)
''')
... | 0.008363 |
def parse_tables(self):
"""
Parse and return all tables from the DOM.
Returns
-------
list of parsed (header, body, footer) tuples from tables.
"""
tables = self._parse_tables(self._build_doc(), self.match, self.attrs)
return (self._parse_thead_tbody_tfoo... | 0.005731 |
def _update_Prxy_diag(self):
"""Update `D`, `A`, `Ainv` from `Prxy`, `prx`."""
for r in range(self.nsites):
pr_half = self.prx[r]**0.5
pr_neghalf = self.prx[r]**-0.5
#symm_pr = scipy.dot(scipy.diag(pr_half), scipy.dot(self.Prxy[r], scipy.diag(pr_neghalf)))
... | 0.006961 |
def _build_dist(self, spec, label, dist, **kwargs):
''' Build and return a PyMC3 Distribution. '''
if isinstance(dist, string_types):
if hasattr(pm, dist):
dist = getattr(pm, dist)
elif dist in self.dists:
dist = self.dists[dist]
else:
... | 0.001566 |
def first_field(self):
""" Returns the first :class:`Field` in the `Sequence` or ``None``
for an empty `Sequence`.
"""
for name, item in enumerate(self):
# Container
if is_container(item):
field = item.first_field()
# Container is n... | 0.003484 |
def get_repo_url(pypirc, repository):
"""Fetch the RepositoryURL for a given repository, reading info from pypirc.
Will try to find the repository in the .pypirc, including username/password.
Args:
pypirc (str): path to the .pypirc config file
repository (str): URL or alias for the reposit... | 0.004498 |
def prepare(self, pseudocount=0.0, lenfile=None, read_length=100):
"""
Initializes the probability of read origin according to the alignment profile
:param pseudocount: Uniform prior for allele specificity estimation
:return: Nothing (as it performs an in-place operations)
"""
... | 0.005239 |
def pass_q_v1(self):
"""Update the outlet link sequence."""
flu = self.sequences.fluxes.fastaccess
out = self.sequences.outlets.fastaccess
out.q[0] += flu.qa | 0.00578 |
def equality(self, other):
"""Compare two objects for equality.
@param self: first object to compare
@param other: second object to compare
@return: boolean result of comparison
"""
# Compare specified attributes for equality
cname = self.__class__.__name__
... | 0.002342 |
def load_or_create_vocabs(source_paths: List[str],
target_path: str,
source_vocab_paths: List[Optional[str]],
target_vocab_path: Optional[str],
shared_vocab: bool,
num_words_source: Optional... | 0.006321 |
def create_index(config):
"""Create the root index."""
filename = pathlib.Path(config.cache_path) / "index.json"
index = {"version": __version__}
with open(filename, "w") as out:
out.write(json.dumps(index, indent=2)) | 0.004149 |
def discover_package_doc_dir(initial_dir):
"""Discover the ``doc/`` dir of a package given an initial directory.
Parameters
----------
initial_dir : `str`
The inititial directory to search from. In practice, this is often the
directory that the user is running the package-docs CLI from.... | 0.000741 |
def replace(self, old_patch, new_patch):
""" Replace old_patch with new_patch
The method only replaces the patch and doesn't change any comments.
"""
self._check_patch(old_patch)
old_patchline = self.patch2line[old_patch]
index = self.patchlines.index(old_patchline)
... | 0.003333 |
def region_screenshot(self, filename=None):
"""Deprecated
Take part of the screenshot
"""
# warnings.warn("deprecated, use screenshot().crop(bounds) instead", DeprecationWarning)
screen = self.__last_screen if self.__keep_screen else self.screenshot()
if self.bounds:
... | 0.009132 |
def set_server(self, pos, key, value):
"""Set the key to the value for the pos (position in the list)."""
self._web_list[pos][key] = value | 0.012987 |
def pause(jid, state_id=None, duration=None):
'''
Set up a state id pause, this instructs a running state to pause at a given
state id. This needs to pass in the jid of the running state and can
optionally pass in a duration in seconds.
'''
minion = salt.minion.MasterMinion(__opts__)
minion.... | 0.00271 |
def equals(self, other):
"""
Ensures :attr:`subject` is equal to *other*.
"""
self._run(unittest_case.assertEqual, (self._subject, other))
return ChainInspector(self._subject) | 0.009302 |
def push_dir(path, glob=None, upload_path=None):
'''
Push a directory from the minion up to the master, the files will be saved
to the salt master in the master's minion files cachedir (defaults to
``/var/cache/salt/master/minions/minion-id/files``). It also has a glob
for matching specific files u... | 0.001004 |
def cacheback(lifetime=None, fetch_on_miss=None, cache_alias=None,
job_class=None, task_options=None, **job_class_kwargs):
"""
Decorate function to cache its return value.
:lifetime: How long to cache items for
:fetch_on_miss: Whether to perform a synchronous fetch when no cached
... | 0.000686 |
def print_chain_summary(self, stream=sys.stdout, indent=""):
"""Print a summary of the files in this file dict.
This version uses chain_input_files and chain_output_files to
count the input and output files.
"""
stream.write("%sTotal files : %i\n" %
(in... | 0.002558 |
def dict_to_pendulum(d: Dict[str, Any],
pendulum_class: ClassType) -> DateTime:
"""
Converts a ``dict`` object back to a ``Pendulum``.
"""
return pendulum.parse(d['iso']) | 0.004831 |
def locate(command, on):
"""Locate the command's man page."""
location = find_page_location(command, on)
click.echo(location) | 0.007299 |
def workbench_scenarios(cls):
"""
Gather scenarios to be displayed in the workbench
"""
module = cls.__module__
module = module.split('.')[0]
directory = pkg_resources.resource_filename(module, 'scenarios')
files = _find_files(directory)
scenarios = _read_... | 0.005602 |
def async_do(self, size=10):
"""Execute all asynchronous jobs and wait for them to finish. By default it will run on 10 threads.
:param size: number of threads to run on.
"""
if hasattr(self._session, '_async_jobs'):
logging.info("Executing asynchronous %s jobs found in queu... | 0.008403 |
def set_cookie(self, name: str, value: str, *,
expires: Optional[str]=None,
domain: Optional[str]=None,
max_age: Optional[Union[int, str]]=None,
path: str='/',
secure: Optional[str]=None,
httponly: Optional... | 0.016643 |
def text2labels(text, sents):
'''
Marks all characters in given `text`, that doesn't exists within any
element of `sents` with `1` character, other characters (within sentences)
will be marked with `0`
Used in training process
>>> text = 'привет. меня зовут аня.'
>>> sents = ['привет.', 'мен... | 0.001227 |
def Parse(conditions):
"""Parses the file finder condition types into the condition objects.
Args:
conditions: An iterator over `FileFinderCondition` objects.
Yields:
`MetadataCondition` objects that correspond to the file-finder conditions.
"""
kind = rdf_file_finder.FileFinderConditi... | 0.005479 |
def run_base_recalibration(job, bam, bai, ref, ref_dict, fai, dbsnp, mills, unsafe=False):
"""
Creates recalibration table for Base Quality Score Recalibration
:param JobFunctionWrappingJob job: passed automatically by Toil
:param str bam: FileStoreID for BAM file
:param str bai: FileStoreID for BA... | 0.003113 |
def performFirmwareUpdate(self, unDeviceIndex):
"""
Performs the actual firmware update if applicable.
The following events will be sent, if VRFirmwareError_None was returned: VREvent_FirmwareUpdateStarted, VREvent_FirmwareUpdateFinished
Use the properties Prop_Firmware_UpdateAvailable... | 0.012179 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.