text stringlengths 78 104k | score float64 0 0.18 |
|---|---|
def model_segments(copy_file, work_dir, paired):
"""Perform segmentation on input copy number log2 ratio file.
"""
out_file = os.path.join(work_dir, "%s.cr.seg" % dd.get_sample_name(paired.tumor_data))
tumor_counts, normal_counts = heterogzygote_counts(paired)
if not utils.file_exists(out_file):
... | 0.004637 |
def is_merged(sheet, row, column):
"""
Check if a row, column cell is a merged cell
"""
for cell_range in sheet.merged_cells:
row_low, row_high, column_low, column_high = cell_range
if (row in range(row_low, row_high)) and \
(column in range(column_low, column_high)):
... | 0.001825 |
def azureTables(self, *args, **kwargs):
"""
List Tables in an Account Managed by Auth
Retrieve a list of all tables in an account.
This method gives output: ``v1/azure-table-list-response.json#``
This method is ``stable``
"""
return self._makeApiCall(self.func... | 0.005602 |
def draw_transition(self, from_pos, to_pos, width, waypoints=None, selected=False, depth=0):
"""Draw a state with the given properties
This method is called by the controller to draw the specified transition.
:param tuple from_pos: Starting position
:param tuple to_pos: Ending position... | 0.004661 |
def detach_lb_from_subnets(self, name, subnets):
"""
Detaches load balancer from one or more subnets.
:type name: string
:param name: The name of the Load Balancer
:type subnets: List of strings
:param subnets: The name of the subnet(s) to detach.
:rtype: List ... | 0.007215 |
def add_requirement_libs_from(self, req_libs, platforms=None):
"""Multi-platform dependency resolution for PEX files.
:param builder: Dump the requirements into this builder.
:param interpreter: The :class:`PythonInterpreter` to resolve requirements for.
:param req_libs: A list of :class:`PythonRequire... | 0.004399 |
def _get_date(self, decrypted_content):
"""This method is used to decode the packed dates of entries"""
# Just copied from original KeePassX source
date_field = struct.unpack('<5B', decrypted_content[:5])
dw1 = date_field[0]
dw2 = date_field[1]
dw3 = date_field[2... | 0.004587 |
def save(self, idempotency_key=None):
"""Return a deferred."""
updated_params = self.serialize(None)
headers = populate_headers(idempotency_key)
if not updated_params:
util.logger.debug("Trying to save already saved object %r", self)
return defer.succeed(self)
... | 0.004228 |
def authenticate(self, username, password):
"""
Authenticate user on server.
:param username: Username used to be authenticated.
:type username: six.string_types
:param password: Password used to be authenticated.
:type password: six.string_types
:return: True if... | 0.004491 |
def handler(self):
"""returns the handler"""
if self._handler is None:
self._handler = self.HTTPSClientAuthHandler(key=self._keyfile,
cert=self._certificatefile)
return self._handler | 0.010949 |
async def nodes(self, *,
dc=None, near=None, watch=None, consistency=None):
"""Lists nodes in a given DC
Parameters:
dc (str): Specify datacenter that will be used.
Defaults to the agent's local datacenter.
near (str): Sort the node list... | 0.002066 |
def of_file(self, abspath, nbytes=0):
"""Use default hash method to return hash value of a piece of a file
Estimate processing time on:
:param abspath: the absolute path to the file
:param nbytes: only has first N bytes of the file. if 0, hash all file
CPU = i7-4600U 2.10GHz -... | 0.002861 |
def relabel(self, label=None, group=None, depth=1):
"""Clone object and apply new group and/or label.
Applies relabeling to children up to the supplied depth.
Args:
label (str, optional): New label to apply to returned object
group (str, optional): New group to apply to... | 0.00339 |
def json2lte(self, filename):
""" convert json to lte
return tuple of json, lte file content
"""
data_json = open(filename, 'r').read().strip()
latins = lattice.Lattice(data_json)
self.lattice_instance = latins
self.all_beamlines = latins.getAllBl()
... | 0.004011 |
def average_overlap_ratio(ref_intervals, est_intervals, matching):
"""Compute the Average Overlap Ratio between a reference and estimated
note transcription. Given a reference and corresponding estimated note,
their overlap ratio (OR) is defined as the ratio between the duration of
the time segment in w... | 0.000461 |
def load_rsa_key(key, key_type, key_encoding):
# (bytes, EncryptionKeyType, KeyEncodingType) -> Any
# TODO: narrow down the output type
"""Load an RSA key object from the provided raw key bytes.
:param bytes key: Raw key bytes to load
:param EncryptionKeyType key_type: Type of key to load
:para... | 0.003784 |
def add_token_to_database(encoded_token, identity_claim):
"""
Adds a new token to the database. It is not revoked when it is added.
:param identity_claim:
"""
decoded_token = decode_token(encoded_token)
jti = decoded_token['jti']
token_type = decoded_token['type']
user_identity = decoded... | 0.001546 |
def __response_url(self, message_id):
"""
URL for responding to agent requests.
"""
if self.from_.pid != 0:
path = AGENT_RESPONSE_PATH % (self.from_.pid, message_id)
return "http://%s:%s/%s" % (self.host, self.port, path) | 0.007299 |
def resolve(container, expression):
"""
Return the string that is the resolution of the alignment expression
`expression`, which selects ids from `container`.
"""
itemgetter = getattr(container, 'get_item', container.get)
tokens = []
expression = expression.strip()
for sel_delim, _id, _r... | 0.00085 |
def serialize(self, raw=False):
'''Encode the private part of the key in a base64 format by default,
but when raw is True it will return hex encoded bytes.
@return: bytes
'''
if raw:
return self._key.encode()
return self._key.encode(nacl.encoding.Base64Encoder... | 0.006231 |
def variance_at(self, singular_value):
"""get the error variance of all three terms at a singluar value
Parameters
----------
singular_value : int
singular value to test
Returns
-------
dict : dict
dictionary of (err var term,prediction_n... | 0.005051 |
def pid(name):
'''
Returns the PID of a container
name
Container name
CLI Example:
.. code-block:: bash
salt myminion nspawn.pid arch1
'''
try:
return int(info(name).get('PID'))
except (TypeError, ValueError) as exc:
raise CommandExecutionError(
... | 0.0025 |
def build(matrix):
"""Yield lines generated from given matrix"""
max_x = max(matrix, key=lambda t: t[0])[0]
min_x = min(matrix, key=lambda t: t[0])[0]
max_y = max(matrix, key=lambda t: t[1])[1]
min_y = min(matrix, key=lambda t: t[1])[1]
yield from (
# '{}:'.format(j).ljust(4) + ''.join(m... | 0.004264 |
def update(self):
""" Update will try to update the target directory
w.r.t source directory. Only files that are common
to both directories will be updated, no new files
or directories are created """
self._copyfiles = False
self._updatefiles = True
self._purge =... | 0.003676 |
def get_iam_policy(self, client=None):
"""Retrieve the IAM policy for the bucket.
See
https://cloud.google.com/storage/docs/json_api/v1/buckets/getIamPolicy
If :attr:`user_project` is set, bills the API request to that project.
:type client: :class:`~google.cloud.storage.clien... | 0.001779 |
def _serialize_data(self, data):
"""Return serialized data or list of ids, depending on `hydrate_data` query param."""
if self.request and self.request.query_params.get('hydrate_data', False):
serializer = DataSerializer(data, many=True, read_only=True)
serializer.bind('data', se... | 0.009709 |
def vprint(msg, pretty=False):
"""
Print the provided string {msg}, but only when the --verbose option is on.
:param msg String to print.
:param pretty If on, then pprint() will be used instead of the regular print function.
"""
if not config["verbose"]:
return
if pretty:
... | 0.005525 |
def remove_assigned_resource(self, resource_type: str,
value: Union[str, int, float, bool] = None,
parameters: dict = None):
"""Remove assigned resources from the processing block.
All matching resources will be removed. If only type is ... | 0.00307 |
def ids(self):
"""
list[str]: All applicable IDs
"""
ids = []
try:
ids.append(self.election_group_id)
except ValueError:
pass
if isinstance(self.spec.subtypes, tuple):
try:
ids.append(self.subtype_group_id)
... | 0.00289 |
def prune(self):
"""
On a subtree where the root node's s_center is empty,
return a new subtree with no empty s_centers.
"""
if not self[0] or not self[1]: # if I have an empty branch
direction = not self[0] # graft the other branch here
#if trace... | 0.007937 |
def signature(self):
"""The 32-byte ECC tag signature programmed at chip production. The
signature is provided as a string and can only be read.
The signature attribute is always loaded from the tag when it
is accessed, i.e. it is not cached. If communication with the
tag fails ... | 0.003333 |
def _read(self):
"""Read the kube config file.
"""
stream = self.path.read_text()
data = yaml.load(stream)
return data | 0.018868 |
def map_title(self):
"""Get the map title from the layer keywords if possible.
:returns: None on error, otherwise the title.
:rtype: None, str
"""
# noinspection PyBroadException
try:
title = self._keyword_io.read_keywords(
self.impact, 'map_t... | 0.004049 |
def get_account_metadata(self, prefix=None):
"""
Returns a dictionary containing metadata about the account.
"""
headers = self.get_account_headers()
if prefix is None:
prefix = ACCOUNT_META_PREFIX
low_prefix = prefix.lower()
ret = {}
for hkey,... | 0.003578 |
def update_translations(condition=None):
"""
Updates FieldTranslations table
"""
if condition is None:
condition = {}
# Number of updated translations
num_translations = 0
# Module caching
FieldTranslation._init_module_cache()
# Current languages dict
LANGUAGES = dict(lang for lang in MODELT... | 0.03166 |
def _raise_on_bad_jar_filename(jar_filename):
"""Ensure that jar_filename is a valid path to a jar file."""
if jar_filename is None:
return
if not isinstance(jar_filename, string_type):
raise TypeError("jar_filename is not a string: %r" % jar_filename)
if not os... | 0.004695 |
def cached_property(prop):
"""
A replacement for the property decorator that will only compute the
attribute's value on the first call and serve a cached copy from
then on.
"""
def cache_wrapper(self):
if not hasattr(self, "_cache"):
self._cache = {}
if prop.__name__ ... | 0.001664 |
def create_stack(
self,
stack_name,
stack_template_name,
parameters=None,
capabilities=None
):
"""Create a stack using Amazon's Cloud formation"""
# Build template_path
stack_template_path = pathlib.Path(
self.template_dir).joinpath(st... | 0.005725 |
def _setup_metric_group_definitions(self):
"""
Return the dict of MetricGroupDefinition objects for this metrics
context, by processing its 'metric-group-infos' property.
"""
# Dictionary of MetricGroupDefinition objects, by metric group name
metric_group_definitions = di... | 0.001813 |
def software_breakpoint_set(self, addr, thumb=False, arm=False, flash=False, ram=False):
"""Sets a software breakpoint at the specified address.
If ``thumb`` is ``True``, the breakpoint is set in THUMB-mode, while if
``arm`` is ``True``, the breakpoint is set in ARM-mode, otherwise a
no... | 0.002103 |
def _add32(ins):
""" Pops last 2 bytes from the stack and adds them.
Then push the result onto the stack.
Optimizations:
* If any of the operands is ZERO,
then do NOTHING: A + 0 = 0 + A = A
"""
op1, op2 = tuple(ins.quad[2:])
if _int_ops(op1, op2) is not None:
o1, o2 = _in... | 0.000796 |
def formfield_for_dbfield(self, db_field, **kwargs):
"""
Same as parent but sets the widget for any OrderFields to
HiddenTextInput.
"""
if isinstance(db_field, fields.OrderField):
kwargs['widget'] = widgets.HiddenTextInput
return super(ListView, self).formfie... | 0.00565 |
def get_terminal_size(defaultw=80):
""" Checks various methods to determine the terminal size
Methods:
- shutil.get_terminal_size (only Python3)
- fcntl.ioctl
- subprocess.check_output
- os.environ
Parameters
----------
defaultw : int
Default width of terminal.
Retur... | 0.004065 |
def delete(cls, object_version, key=None):
"""Delete tags.
:param object_version: The object version instance or id.
:param key: Key of the tag to delete.
Default: delete all tags.
"""
with db.session.begin_nested():
q = cls.query.filter_by(
... | 0.004396 |
def consume(self, queue, consumer, consumer_tag='', no_local=False,
no_ack=True, exclusive=False, nowait=True, ticket=None,
cb=None, cancel_cb=None):
'''Start a queue consumer.
Accepts the following optional arg in addition to those of
`BasicClass.consume()`:
... | 0.004934 |
def run(self):
"""Run the monitor.
This function loops forever, checking for messages about dead database
clients and cleaning up state accordingly.
"""
# Initialize the subscription channel.
self.subscribe(ray.gcs_utils.XRAY_HEARTBEAT_BATCH_CHANNEL)
self.subscri... | 0.001706 |
def backward(A, pobs, T=None, beta_out=None, dtype=np.float32):
"""Compute all backward coefficients. With scaling!
Parameters
----------
A : ndarray((N,N), dtype = float)
transition matrix of the hidden states
pobs : ndarray((T,N), dtype = float)
pobs[t,i] is the observation probab... | 0.002792 |
def low(data, **kwargs):
'''
Execute a single low data call
This function is mostly intended for testing the state system
CLI Example:
.. code-block:: bash
salt '*' state.low '{"state": "pkg", "fun": "installed", "name": "vi"}'
'''
st_kwargs = __salt__.kwargs
__opts__['grains'... | 0.001266 |
def add_schedule(self, name, activation_date, day_period='one_time',
final_action='ALERT_FAILURE', activated=True,
minute_period='one_time', day_mask=None,
repeat_until_date=None, comment=None):
"""
Add a schedule to an existing task.
... | 0.006008 |
def add_volume_bricks(name, bricks):
'''
Add brick(s) to an existing volume
name
Volume name
bricks
List of bricks to add to the volume
.. code-block:: yaml
myvolume:
glusterfs.add_volume_bricks:
- bricks:
- host1:/srv/gluster/drive1
... | 0.001768 |
def infer_literal(self, args, diagnostic=None):
"""
Infer type from an LITERAL!
Type of literal depend of language.
We adopt a basic convention
"""
literal, t = args
#self.type_node.add(EvalCtx.from_sig(Val(literal, t)))
self.infer_node.scope_node.add(Eval... | 0.008571 |
def add_layers_to_canvas_with_custom_orders(
order, impact_function, iface=None):
"""Helper to add layers to the map canvas following a specific order.
From top to bottom in the legend:
[
('FromCanvas', layer name, full layer URI, QML),
('FromAnalysis', layer purpose, la... | 0.000266 |
def count_cycle(iterable, n=None):
"""Cycle through the items from *iterable* up to *n* times, yielding
the number of completed cycles along with each item. If *n* is omitted the
process repeats indefinitely.
>>> list(count_cycle('AB', 3))
[(0, 'A'), (0, 'B'), (1, 'A'), (1, 'B'), (2, 'A'), (2, 'B')... | 0.001938 |
def get_read_strategy(cls, response):
'''Return the appropriate algorithm of reading response.
Returns:
str: ``chunked``, ``length``, ``close``.
'''
chunked_match = re.match(
r'chunked($|;)',
response.fields.get('Transfer-Encoding', '')
)
... | 0.004082 |
def get_percentage_relative_to(val, other):
"""Finds percentage between 2 numbers
:param val: number
:param other: number to compare to
:return: percentage of delta between first and second
"""
val = float(val)
other = float(other)
ratio = val / other - 1
return ratio * 100.0 | 0.003185 |
def memoize(max_cache_size=1000):
"""Python 2.4 compatible memoize decorator.
It creates a cache that has a maximum size. If the cache exceeds the max,
it is thrown out and a new one made. With such behavior, it is wise to set
the cache just a little larger that the maximum expected need.
Paramet... | 0.000932 |
def dist_abs(self, src, tar):
"""Return the MRA comparison rating of two strings.
Parameters
----------
src : str
Source string for comparison
tar : str
Target string for comparison
Returns
-------
int
MRA comparison r... | 0.001228 |
def references_json(references):
''' Given a list of all models in a graph, return JSON representing
them and their properties.
Args:
references (seq[Model]) :
A list of models to convert to JSON
Returns:
list
'''
references_json = []
for r in references:
... | 0.002141 |
def listen_init(self):
"""Setup the service to listen for clients."""
self.dispatcher = ObjectDispatch(self)
self.factory = MsgPackProtocolFactory(self.dispatcher)
self.server = UnixServer(self.loop, self.factory, self.path)
self.server.start() | 0.007042 |
def download_file(save_path, file_url):
""" Download file from http url link """
r = requests.get(file_url) # create HTTP response object
with open(save_path, 'wb') as f:
f.write(r.content)
return save_path | 0.004274 |
def status(self, jobId=None, jobType=None):
"""
Inquire about status when publishing an item, adding an item in
async mode, or adding with a multipart upload. "Partial" is
available for Add Item Multipart, when only a part is uploaded
and the item is not committed.
... | 0.005143 |
def getOverlayTransformTrackedDeviceComponent(self, ulOverlayHandle, pchComponentName, unComponentNameSize):
"""Gets the transform information when the overlay is rendering on a component."""
fn = self.function_table.getOverlayTransformTrackedDeviceComponent
punDeviceIndex = TrackedDeviceIndex_... | 0.01087 |
def remove_cmdline_arg(args, arg, n=1):
"""
Removes the command line argument *args* from a list of arguments *args*, e.g. as returned from
:py:func:`global_cmdline_args`. When *n* is 1 or less, only the argument is removed. Otherwise,
the following *n-1* values are removed. Example:
.. code-block:... | 0.004104 |
def normal(target, seeds, scale, loc):
r"""
Produces values from a Weibull distribution given a set of random numbers.
Parameters
----------
target : OpenPNM Object
The object with which this function as associated. This argument
is required to (1) set number of values to generate ... | 0.000792 |
def post_merge_request(profile, payload):
"""Do a POST request to Github's API to merge.
Args:
profile
A profile generated from ``simplygithub.authentication.profile``.
Such profiles tell this module (i) the ``repo`` to connect to,
and (ii) the ``token`` to connect ... | 0.001144 |
def start_plasma_store(self):
"""Start the plasma store."""
stdout_file, stderr_file = self.new_log_files("plasma_store")
process_info = ray.services.start_plasma_store(
stdout_file=stdout_file,
stderr_file=stderr_file,
object_store_memory=self._ray_params.obj... | 0.002759 |
async def monitor_mode(self, poll_devices=False, device=None,
workdir=None):
"""Place the IM in monitoring mode."""
print("Running monitor mode")
await self.connect(poll_devices, device, workdir)
self.plm.monitor_mode() | 0.010791 |
def UNIFAC_RQ(groups, subgroup_data=None):
r'''Calculates UNIFAC parameters R and Q for a chemical, given a dictionary
of its groups, as shown in [1]_. Most UNIFAC methods use the same subgroup
values; however, a dictionary of `UNIFAC_subgroup` instances may be
specified as an optional second parameter... | 0.003924 |
def _get_ca_bundle_path(self):
"""
Return a path to the CA bundle which is used for verifying the hosts
SSL certificate.
"""
if self.ca_certs_bundle_path:
# User provided a custom path
return self.ca_certs_bundle_path
# Return first bundle which i... | 0.004016 |
def _get_args(args):
"""Argparse logic lives here.
returns: parsed arguments.
"""
parser = argparse.ArgumentParser(
description='A tool to extract features into a simple format.',
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
)
parser.add_argument('--no-cache', action=... | 0.001332 |
def getActiveJobCountForClientInfo(self, clientInfo):
""" Return the number of jobs for the given clientInfo and a status that is
not completed.
"""
with ConnectionFactory.get() as conn:
query = 'SELECT count(job_id) ' \
'FROM %s ' \
'WHERE client_info = %%s ' \
... | 0.009709 |
def remove_from_role(server_context, role, user_id=None, email=None, container_path=None):
"""
Remove user/group from security role
:param server_context: A LabKey server context. See utils.create_server_context.
:param role: (from get_roles) to remove user from
:param user_id: to remove permissions... | 0.008345 |
def collect_results(self, data_values):
"""Receive the data from the consumers polled and process it.
:param dict data_values: The poll data returned from the consumer
:type data_values: dict
"""
self.last_poll_results['timestamp'] = self.poll_data['timestamp']
# Get t... | 0.002265 |
def scroll_to_beginning_vertically(self, steps=10, *args,**selectors):
"""
Scroll the object which has *selectors* attributes to *beginning* vertically.
See `Scroll Forward Vertically` for more details.
"""
return self.device(**selectors).scroll.vert.toBeginning(steps=steps) | 0.012658 |
def format_currency_field(__, prec, number, locale):
"""Formats a currency field."""
locale = Locale.parse(locale)
currency = get_territory_currencies(locale.territory)[0]
if prec is None:
pattern, currency_digits = None, True
else:
prec = int(prec)
pattern = locale.currency_... | 0.001745 |
def get_path_info(self, path):
"""
Get information about ``path`` as a dict of properties.
The return value, based upon ``fs.FileStatus`` from the Java API,
has the following fields:
* ``block_size``: HDFS block size of ``path``
* ``group``: group associated with ``path... | 0.001967 |
def get_registered_courses (self):
""" 履修登録済み授業を取得 """
kdb = twins.kdb.Kdb()
_reged = []
for x in ((1, "A"), (2, "A"), (3, "A"), (4, "B"), (5, "B"), (6, "B")):
self.req("RSW0001000-flow")
self.get({
"_eventId": "search",
... | 0.002558 |
def set_property_value(self, name, value, dry_run=False):
"""Set or remove property value.
See DAVResource.set_property_value()
"""
raise DAVError(
HTTP_FORBIDDEN, err_condition=PRECONDITION_CODE_ProtectedProperty
) | 0.007463 |
def download(client, target_dir):
"""Download images from play store into folder herachy."""
print('download image previews')
print(
"Warning! Downloaded images are only previews!"
"They may be to small for upload.")
tree = {}
listings = client.list('listings')
languages = map(la... | 0.00053 |
async def playing(self):
"""Return what is currently playing."""
# TODO: This is hack-ish
if self._setstate is None:
await self.protocol.start()
# No SET_STATE_MESSAGE received yet, use default
if self._setstate is None:
return MrpPlaying(protobuf.SetStat... | 0.005025 |
def getSubjectSequence(self, title):
"""
Obtain information about a subject sequence given its title.
This information is cached in self._subjectTitleToSubject. It can
be obtained from either a) an sqlite database (given via the
sqliteDatabaseFilename argument to __init__), b) t... | 0.000869 |
def get_object_cache_keys(instance):
"""
Return the cache keys associated with an object.
"""
if instance.pk is None or instance._state.adding:
return []
keys = []
tr_models = instance._parler_meta.get_all_models()
# TODO: performs a query to fetch the language codes. Store that in... | 0.005693 |
def from_xdr_object(cls, op_xdr_object):
"""Creates a :class:`CreateAccount` object from an XDR Operation
object.
"""
if not op_xdr_object.sourceAccount:
source = None
else:
source = encode_check(
'account', op_xdr_object.sourceAccount[0].... | 0.002725 |
def get_users(self, omit_empty_organisms=False):
"""
Get all users known to this Apollo instance
:type omit_empty_organisms: bool
:param omit_empty_organisms: Will omit users having no access to any organism
:rtype: list of dicts
:return: list of user info dictionaries
... | 0.00531 |
def set_assets(self, asset_ids=None):
"""Sets the assets.
arg: assetIds (osid.id.Id): the asset Ids
raise: INVALID_ARGUMENT - assetIds is invalid
raise: NullArgument - assetIds is null
raise: NoAccess - metadata.is_read_only() is true
compliance: mandatory - This m... | 0.002614 |
def all_exist(filepaths):
"""Returns true if all files in the list exist."""
for fname in filepaths:
if not tf.gfile.Exists(fname):
return False
return True | 0.02907 |
def camel_to_snake_case(string):
"""Converts 'string' presented in camel case to snake case.
e.g.: CamelCase => snake_case
"""
s = _1.sub(r'\1_\2', string)
return _2.sub(r'\1_\2', s).lower() | 0.004739 |
def to_decimal(alpha_number, alphabet=ALPHABET, default=_marker):
"""Converts an alphanumeric code (e.g AB12) to an integer
:param alpha_number: representation of an alphanumeric code
:param alphabet: alphabet to use when alpha_number is a non-int string
:type number: int, string, Alphanumber, float
... | 0.000933 |
def get_circulations(elements: T) -> Iterable[T]:
"""Iterate over all possible circulations of an ordered collection (tuple or list).
Example:
>>> list(get_circulations([1, 2, 3]))
[[1, 2, 3], [2, 3, 1], [3, 1, 2]]
"""
for i in range(len(elements)):
yield elements[i:] + elements[:i] | 0.006309 |
def register(self, collector):
"""Add a collector to the registry."""
with self._lock:
names = self._get_names(collector)
duplicates = set(self._names_to_collectors).intersection(names)
if duplicates:
raise ValueError(
'Duplicated t... | 0.00365 |
def _bdev(dev=None):
'''
Resolve a bcacheX or cache to a real dev
:return: basename of bcache dev
'''
if dev is None:
dev = _fssys('cache0')
else:
dev = _bcpath(dev)
if not dev:
return False
else:
return _devbase(os.path.dirname(dev)) | 0.003344 |
def openlines(image, linelength=10, dAngle=10, mask=None):
"""
Do a morphological opening along lines of different angles.
Return difference between max and min response to different angles for each pixel.
This effectively removes dots and only keeps lines.
image - pixel image to operate on
le... | 0.012615 |
async def async_open(self) -> None:
"""Opens connection to the LifeSOS ethernet interface."""
await self._loop.create_connection(
lambda: self,
self._host,
self._port) | 0.009091 |
def from_dict(cls, fields, mapping):
"""
Create a Record from a dictionary of field mappings.
The *fields* object is used to determine the column indices
of fields in the mapping.
Args:
fields: the Relation schema for the table of this record
mapping: a ... | 0.002587 |
def check_flags(self, ds):
'''
Check the flag_values, flag_masks and flag_meanings attributes for
variables to ensure they are CF compliant.
CF §3.5 The attributes flag_values, flag_masks and flag_meanings are
intended to make variables that contain flag values self describing.
... | 0.002514 |
def umount(self, source):
"""
Unmount partion
:param source: Full partition path like /dev/sda1
"""
args = {
'source': source,
}
self._umount_chk.check(args)
response = self._client.raw('disk.umount', args)
result = response.get()
... | 0.006865 |
def vlcom3(a, v1, b, v2, c, v3):
"""
This subroutine computes the vector linear combination
a*v1 + b*v2 + c*v3 of double precision, 3-dimensional vectors.
http://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/vlcom3_c.html
:param a: Coefficient of v1
:type a: float
:param v1: Vector in ... | 0.006744 |
def folderitem(self, obj, item, index):
"""Applies new properties to the item (Batch) that is currently being
rendered as a row in the list
:param obj: client to be rendered as a row in the list
:param item: dict representation of the batch, suitable for the list
:param index: c... | 0.001231 |
def duration(self):
"""
Returns the current value of the counter and then multiplies it by
:attr:`factor`
:rtype: float
"""
d = self.for_attempt(self.cur_attempt)
self.cur_attempt += 1
return d | 0.007752 |
def path(self, which=None):
"""Extend ``nailgun.entity_mixins.Entity.path``.
The format of the returned path depends on the value of ``which``:
download_html
/api/compliance/arf_reports/:id/download_html
Otherwise, call ``super``.
"""
if which in ('download... | 0.003914 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.