text stringlengths 78 104k | score float64 0 0.18 |
|---|---|
def run_script(self, requires, script_name):
"""Locate distribution for `requires` and run `script_name` script"""
ns = sys._getframe(1).f_globals
name = ns['__name__']
ns.clear()
ns['__name__'] = name
self.require(requires)[0].run_script(script_name, ns) | 0.006601 |
def search_device_by_id(self, deviceID) -> Device:
""" searches a device by given id
Args:
deviceID(str): the device to search for
Returns
the Device object or None if it couldn't find a device
"""
for d in self.devices:
... | 0.010256 |
def get_triplet_tuple(a: BaseEntity, b: BaseEntity, c: BaseEntity) -> Tuple[str, str, str, str, str, str]:
"""Get the triple as a tuple of BEL/hashes."""
return a.as_bel(), a.sha512, b.as_bel(), b.sha512, c.as_bel(), c.sha512 | 0.008584 |
def with_roles(obj=None, rw=None, call=None, read=None, write=None):
"""
Convenience function and decorator to define roles on an attribute. Only
works with :class:`RoleMixin`, which reads the annotations made by this
function and populates :attr:`~RoleMixin.__roles__`.
Examples::
id = db.... | 0.00199 |
def func_load(code, defaults=None, closure=None, globs=None):
"""
Reload a function
:param code: The code object
:param defaults: Default values
:param closure: The closure
:param globs: globals
:return:
"""
if isinstance(code, (tuple, list)): # unpack previous dump
code, de... | 0.003344 |
def parse_expression(expression: str) -> Tuple[Set[str], List[CompositeAxis]]:
"""
Parses an indexing expression (for a single tensor).
Checks uniqueness of names, checks usage of '...' (allowed only once)
Returns set of all used identifiers and a list of axis groups
"""
identifiers = set()
... | 0.003176 |
def relative_ref(self, baseURI):
"""
Return string containing relative reference to package item from
*baseURI*. E.g. PackURI('/ppt/slideLayouts/slideLayout1.xml') would
return '../slideLayouts/slideLayout1.xml' for baseURI '/ppt/slides'.
"""
# workaround for posixpath bu... | 0.003484 |
def grouper(iterable: Iterable, size: int) -> Iterable:
"""
Collect data into fixed-length chunks or blocks without discarding underfilled chunks or padding them.
:param iterable: A sequence of inputs.
:param size: Chunk size.
:return: Sequence of chunks.
"""
it = iter(iterable)
while T... | 0.004608 |
def serializeable_exc_info(thetype, ex, tb):
"""
Since traceback objects can not be pickled, this function manipulates
exception info tuples before they are passed accross process
boundaries.
"""
return thetype, ex, ''.join(traceback.format_exception(thetype, ex, tb)) | 0.003425 |
def fill_out(self, data, prefix='', turbo=False):
"""
Shortcut for filling out first ``<form>`` on page. See
:py:class:`~webdriverwrapper.forms.Form` for more information.
.. versionadded:: 2.0
"""
return self.get_elm(tag_name='form').fill_out(data, prefix, turbo) | 0.00639 |
def delete(self, using=None):
"""
Delete this entry.
"""
using = using or router.db_for_write(self.__class__, instance=self)
connection = connections[using]
logger.debug("Deleting LDAP entry %s" % self.dn)
connection.delete_s(self.dn)
signals.post_delete.s... | 0.00554 |
def create(self, handle=None, handle_type=None, **args):
"""
Creates an ontology based on a handle
Handle is one of the following
- `FILENAME.json` : creates an ontology from an obographs json file
- `obo:ONTID` : E.g. obo:pato - creates an ontology from obolibrary PURL (re... | 0.00391 |
def offline_plotly_data(data, filename=None, config=None, validate=True,
default_width='100%', default_height=525, global_requirejs=False):
r""" Write a plotly scatter plot to HTML file that doesn't require server
>>> from nlpia.loaders import get_data
>>> df = get_data('etpinard') ... | 0.003482 |
def convert_notebooks(self):
"""Convert IPython notebooks to Python scripts in editor"""
fnames = self.get_selected_filenames()
if not isinstance(fnames, (tuple, list)):
fnames = [fnames]
for fname in fnames:
self.convert_notebook(fname) | 0.006689 |
def add_edge(self, u_vertex, v_vertex):
"""Adds the edge ``u_vertex -> v_vertex`` to the graph if the edge is not already present.
:param u_vertex: Vertex
:param v_vertex: Vertex
:return: ``True`` if a new edge was added. ``False`` otherwise.
"""
self._vertices.ad... | 0.00531 |
def to_dict(self):
""" to_dict: puts Topic or Content node data into the format that Kolibri Studio expects
Args: None
Returns: dict of channel data
"""
return {
"title": self.title,
"language" : self.language,
"description": self.descr... | 0.007143 |
def nlmsg_alloc(len_=default_msg_size):
"""Allocate a new Netlink message with maximum payload size specified.
https://github.com/thom311/libnl/blob/libnl3_2_25/lib/msg.c#L299
Allocates a new Netlink message without any further payload. The maximum payload size defaults to
resource.getpagesize() or as... | 0.003654 |
def deep_merge(dict_one, dict_two):
'''
Deep merge two dicts.
'''
merged = dict_one.copy()
for key, value in dict_two.items():
# value is equivalent to dict_two[key]
if (key in dict_one and
isinstance(dict_one[key], dict) and
isinstance(value, dict)):
... | 0.0016 |
def _apply_snap_off(self, queue=None):
r"""
Add all the throats to the queue with snap off pressure
This is probably wrong!!!! Each one needs to start a new cluster.
"""
net = self.project.network
phase = self.project.find_phase(self)
snap_off = self.settings['sna... | 0.002484 |
def colorize_text(self, text):
"""Adds escape sequences to colorize text and make it
beautiful. To colorize text, prefix the text you want to color
with the color (capitalized) wrapped in double angle brackets
(i.e.: <<GREEN>>). End your string with <<NORMAL>>. If you
don't, it w... | 0.002378 |
def close(self):
"""Explicitly kill this cursor on the server. Call like (in Tornado):
.. code-block:: python
yield cursor.close()
"""
if not self.closed:
self.closed = True
yield self._framework.yieldable(self._close()) | 0.006897 |
def bmes_tags_to_spans(tag_sequence: List[str],
classes_to_ignore: List[str] = None) -> List[TypedStringSpan]:
"""
Given a sequence corresponding to BMES tags, extracts spans.
Spans are inclusive and can be of zero length, representing a single word span.
Ill-formed spans are also... | 0.003353 |
def _find_player_url(response):
"""
Finds embedded player url in HTTP response.
:param response: Response object.
:returns: Player url (str).
"""
url = ''
matches = _player_re.search(response.text)
if matches:
tmp_url = matches.group(0).replace('&', '&')
if 'hash' no... | 0.001634 |
def get_vector(self):
"""Return the vector for this survey."""
vec = {}
for dim in ['forbidden', 'required', 'permitted']:
if self.survey[dim] is None:
continue
dim_vec = map(lambda x: (x['tag'], x['answer']),
self.survey[dim])
... | 0.008021 |
def model_data(self):
"""str: The model location in S3. Only set if Estimator has been ``fit()``."""
if self.latest_training_job is not None:
model_uri = self.sagemaker_session.sagemaker_client.describe_training_job(
TrainingJobName=self.latest_training_job.name)['ModelArtifa... | 0.011628 |
def operations(*operations):
'''Decorator for marking Resource methods as HTTP operations.
This decorator does a number of different things:
- It transfer onto itself docstring and annotations from the decorated
method, so as to be "transparent" with regards to introspection.
- It tra... | 0.000537 |
def get_search(self):
"""Get current search or search from session, reset page if search is changed"""
old_search = self.get_session_value('search', '')
search = self.get_and_save_value('search', '')
if old_search != search:
self.page = 1
self.get_session_value('p... | 0.00838 |
def standardize():
"""
return variant standarize function
"""
def f(G, bim):
G_out = standardize_snps(G)
return G_out, bim
return f | 0.005618 |
def kappa_analysis_altman(kappa):
"""
Analysis kappa number with Altman benchmark.
:param kappa: kappa number
:type kappa : float
:return: strength of agreement as str
"""
try:
if kappa < 0.2:
return "Poor"
if kappa >= 0.20 and kappa < 0.4:
return "Fa... | 0.00161 |
def get_snapshot_closest_to_state_change(
self,
state_change_identifier: int,
) -> Tuple[int, Any]:
""" Get snapshots earlier than state_change with provided ID. """
if not (state_change_identifier == 'latest' or isinstance(state_change_identifier, int)):
raise V... | 0.003671 |
def _get_stripped_marker(marker, strip_func):
"""Build a new marker which is cleaned according to `strip_func`"""
if not marker:
return None
marker = _ensure_marker(marker)
elements = marker._markers
strip_func(elements)
if elements:
return marker
return None | 0.003289 |
def change_t(self, t):
'''
Change temperature.
Override.
Args:
t: Now temperature.
Returns:
Next temperature.
'''
t = super().change_t(t)
self.__now_cycles += 1
if self.__now_cycles % self.__rea... | 0.012605 |
def insert(self, data):
"""insert inserts one datapoint with the given data, and appends it to
the end of the stream::
s = cdb["mystream"]
s.create({"type": "string"})
s.insert("Hello World!")
"""
self.insert_array([{"d": data, "t": time.time()}], ... | 0.006006 |
def _prompt_started(self):
""" Called immediately after a new prompt is displayed.
"""
# Temporarily disable the maximum block count to permit undo/redo and
# to ensure that the prompt position does not change due to truncation.
self._control.document().setMaximumBlockCount(0)
... | 0.002073 |
def difference(self, other):
"""Return a new set which I{self} - I{other}, i.e. the items
in I{self} which are not also in I{other}.
@param other: the other set
@type other: Set object
@rtype: the same type as I{self}
"""
obj = self._clone()
obj.differen... | 0.005634 |
def absent(name, hostid=None, **kwargs):
'''
Ensures that the mediatype does not exist, eventually deletes the mediatype.
:param name: name of the usermacro
:param hostid: id's of the hosts to apply the usermacro on, if missing a global usermacro is assumed.
:param _connection_user: Optional - zab... | 0.005415 |
def _realpath(fs, path, seen=pset()):
"""
.. warning::
The ``os.path`` module's realpath does not error or warn about
loops, but we do, following the behavior of GNU ``realpath(1)``!
"""
real = Path.root()
for segment in path.segments:
current = real / segment
seen ... | 0.001292 |
def _drop_oldest_chunk(self):
'''
To handle the case when the items comming in the chunk
is more than the maximum capacity of the chunk. Our intent
behind is to remove the oldest chunk. So that the items come
flowing in.
>>> s = StreamCounter(5,5)
>>> data_stream ... | 0.001978 |
def parse_package(self, p_term):
"""Parses package fields."""
# Check there is a pacakge name
if not (p_term, self.spdx_namespace['name'], None) in self.graph:
self.error = True
self.logger.log('Package must have a name.')
# Create dummy package so that we may... | 0.003041 |
def get_var(var):
'''
Get the value of a variable in make.conf
Return the value of the variable or None if the variable is not in
make.conf
CLI Example:
.. code-block:: bash
salt '*' makeconf.get_var 'LINGUAS'
'''
makeconf = _get_makeconf()
# Open makeconf
with salt.u... | 0.001391 |
def persist(self, status=None):
"""
Enables persistent mode for the current mock.
Returns:
self: current Mock instance.
"""
self._persist = status if type(status) is bool else True | 0.008584 |
def get_version(root):
"""
Load and return the contents of version.json.
:param root: The root path that the ``version.json`` file will be opened
:type root: str
:returns: Content of ``version.json`` or None
:rtype: dict or None
"""
version_json = os.path.join(root, 'version.json')
... | 0.002105 |
def list_packages(self, installed=True, notinstalled=True):
"""Return a list with all the installed/notinstalled packages"""
self.profile = Profile()
# Classify packages
installed_packages = []
notinstalled_packages = []
for package in self.packages:
data =... | 0.000869 |
def write(self, pkt):
"""
Writes a Packet or bytes to a pcap file.
:param pkt: Packet(s) to write (one record for each Packet), or raw
bytes to write (as one record).
:type pkt: iterable[Packet], Packet or bytes
"""
if isinstance(pkt, bytes):
... | 0.003205 |
def create_mask(indexer, shape, chunks_hint=None):
"""Create a mask for indexing with a fill-value.
Parameters
----------
indexer : ExplicitIndexer
Indexer with -1 in integer or ndarray value to indicate locations in
the result that should be masked.
shape : tuple
Shape of t... | 0.000578 |
def iter_ancestors(self):
"""
Iterates over the list of all ancestor nodes from
current node to the current tree root.
"""
node = self
while node.up is not None:
yield node.up
node = node.up | 0.015152 |
def from_taxdb(cls, con, root=None):
"""
Generate a TaxNode from a taxonomy database
"""
cursor = con.cursor()
if root is None:
cursor.execute(
"SELECT tax_id, rank FROM nodes WHERE tax_id = parent_id")
else:
cursor.execute(
... | 0.001899 |
def getReadGroupSetByName(self, name):
"""
Returns a ReadGroupSet with the specified name, or raises a
ReadGroupSetNameNotFoundException if it does not exist.
"""
if name not in self._readGroupSetNameMap:
raise exceptions.ReadGroupSetNameNotFoundException(name)
... | 0.005556 |
def calcphot(log, wavelengthArray, fluxArray, obsmode, extrapolate=False):
"""
*Run calcphot on single spectrum and filter.*
**Key Arguments:**
- ``log`` -- logger
- ``wavelengthArray`` -- the array containing the wavelength range of the spectrum
- ``fluxArray`` -- the array contain... | 0.00919 |
def memcached(servers, key=None, from_cache=None, to_cache=None, time=0,
min_compress_len=0, debug=False):
"""memcached memoization function decorator.
The wrapped function is expected to return a value that is stored to a
memcached server, first translated by `to_cache` if provided. In the e... | 0.003329 |
def set_version(old_version, new_version):
"""
Write new version into VERSION_FILE
"""
try:
if APISettings.DEBUG:
Shell.debug('* ' + old_version + ' --> ' + new_version)
return True
for line in fileinput.input(os.path.abspath(APISe... | 0.005245 |
def confirm_value(self, widget, x, y):
"""event called clicking on the gauge and so changing its value.
propagates the new value
"""
self.gauge.onmousedown(self.gauge, x, y)
params = (self.gauge.value)
return params | 0.007519 |
def create_oss_volume(cls, name, bucket, endpoint, access_key_id,
secret_access_key, access_mode, description=None,
prefix=None, properties=None, api=None):
"""
Create oss volume.
:param name: Volume name.
:param bucket: Referenced buck... | 0.002483 |
def order(self, last):
'''Perform ordering with respect model fields.'''
desc = last.desc
field = last.name
nested = last.nested
nested_args = []
while nested:
meta = nested.model._meta
nested_args.extend((self.backend.basekey(meta), nested... | 0.002972 |
def batch(self, batch_size, batch_num, fluxes=True):
"""Create a batch generator.
This is useful to generate n batches of m samples each.
Parameters
----------
batch_size : int
The number of samples contained in each batch (m).
batch_num : int
Th... | 0.002022 |
def _memcache_key(self, timestamped=False):
"""Makes a key suitable as a memcache entry."""
request = tuple(map(str, self.package_requests))
repo_ids = []
for path in self.package_paths:
repo = package_repository_manager.get_repository(path)
repo_ids.append(repo.u... | 0.003035 |
def _load_mnist_dataset(shape, path, name='mnist', url='http://yann.lecun.com/exdb/mnist/'):
"""A generic function to load mnist-like dataset.
Parameters:
----------
shape : tuple
The shape of digit images.
path : str
The path that the data is downloaded to.
name : str
T... | 0.000692 |
def draw_panel(self, data, panel_params, coord, ax, **params):
"""
Plot all groups
For effeciency, geoms that do not need to partition
different groups before plotting should override this
method and avoid the groupby.
Parameters
----------
data : datafr... | 0.001672 |
def hot(self, limit=None):
"""GETs hot links from this subreddit. Calls :meth:`narwal.Reddit.hot`.
:param limit: max number of links to return
"""
return self._reddit.hot(self.display_name, limit=limit) | 0.016393 |
def select_directory(self):
"""Select directory"""
self.redirect_stdio.emit(False)
directory = getexistingdirectory(self.main, _("Select directory"),
getcwd_or_home())
if directory:
self.chdir(directory)
self.redirect_st... | 0.005988 |
def underscore_to_camelcase(value, first_upper=True):
"""Transform string from underscore_string to camelCase.
:param value: string with underscores
:param first_upper: the result will have its first character in upper case
:type value: str
:return: string in CamelCase or camelCase according to the... | 0.001393 |
def _get_nblock_regions(in_file, min_n_size, ref_regions):
"""Retrieve coordinates of regions in reference genome with no mapping.
These are potential breakpoints for parallelizing analysis.
"""
out_lines = []
called_contigs = set([])
with utils.open_gzipsafe(in_file) as in_handle:
for l... | 0.003429 |
def do_inspect(self, arg):
"""
i(nspect) object
Inspect an object
"""
if arg in self.curframe.f_locals:
obj = self.curframe.f_locals[arg]
elif arg in self.curframe.f_globals:
obj = self.curframe.f_globals[arg]
else:
obj = WebPdb... | 0.002169 |
def notify_about_new_variables(callback):
"""Calls `callback(var)` for all newly created variables.
Callback should not modify the variable passed in. Use cases that require
variables to be modified should use `variable_creator_scope` directly and sit
within the variable creator stack.
>>> variables = []
... | 0.005115 |
def append(ol,ele,**kwargs):
'''
from elist.elist import *
ol = [1,2,3,4]
ele = 5
id(ol)
append(ol,ele,mode="original")
ol
id(ol)
####
ol = [1,2,3,4]
ele = 5
id(ol)
new = append(ol,ele)
new
id(new)
''... | 0.005367 |
def all_experiments(self):
"""
Similar to experiments,
but uses the default manager to return archived experiments as well.
"""
from db.models.experiments import Experiment
return Experiment.all.filter(experiment_group=self) | 0.007326 |
def getAttributeValue(self, index):
"""
This function is only used to look up strings
All other work is done by
:func:`~androguard.core.bytecodes.axml.format_value`
# FIXME should unite those functions
:param index: index of the attribute
:return:
"""
... | 0.003263 |
def visit_subscript(self, node, parent):
"""visit a Subscript node by returning a fresh instance of it"""
context = self._get_context(node)
newnode = nodes.Subscript(
ctx=context, lineno=node.lineno, col_offset=node.col_offset, parent=parent
)
newnode.postinit(
... | 0.007092 |
def moran_sexual(network):
"""The generalized sexual Moran process.
Ateach time step, and individual is chosen for replication and another
individual is chosen to die. The replication replaces the one who dies.
For this process to work you need to add a new agent before calling step.
"""
if not... | 0.000772 |
def get_blob(profile, sha):
"""Fetch a blob.
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 with.
sha
The SHA of th... | 0.001992 |
def read_calibration(
detx=None, det_id=None, from_file=False, det_id_table=None
):
"""Retrive calibration from file, the DB."""
from km3pipe.calib import Calibration # noqa
if not (detx or det_id or from_file):
return None
if detx is not None:
return Calibration(filename=det... | 0.001217 |
def seek(self, frames, whence=SEEK_SET):
"""Set the read/write position.
Parameters
----------
frames : int
The frame index or offset to seek.
whence : {SEEK_SET, SEEK_CUR, SEEK_END}, optional
By default (``whence=SEEK_SET``), `frames` are counted from
... | 0.001671 |
def find_author(self):
"""Get the author information from the version control system."""
return Author(name=self.context.capture('git', 'config', 'user.name', check=False, silent=True),
email=self.context.capture('git', 'config', 'user.email', check=False, silent=True)) | 0.012987 |
def read(self, size=None):
"""
Reads `size` bytes from current directory entry. If `size` is empty,
it'll read all data till entry's end.
"""
if self._is_mini:
self.seek(self._position)
else:
self.source.seek(self._source_position)
if not s... | 0.001594 |
def faz(input_file, variables=None):
"""
FAZ entry point.
"""
logging.debug("input file:\n {0}\n".format(input_file))
tasks = parse_input_file(input_file, variables=variables)
print("Found {0} tasks.".format(len(tasks)))
graph = DependencyGraph(tasks)
graph.show_tasks()
graph.execute... | 0.003106 |
def ckw01(handle, begtim, endtim, inst, ref, avflag, segid, nrec, sclkdp, quats,
avvs):
"""
Add a type 1 segment to a C-kernel.
http://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/ckw01_c.html
:param handle: Handle of an open CK file.
:type handle: int
:param begtim: The beginnin... | 0.001244 |
def active(self):
"""
Get a list of active projects.
:return list: A list of tuples containing a title and pageid in that order.
"""
projects = []
r = requests.get(self.api,
params={'action': 'query', 'list': 'categorymembers', 'cmpageid': self.a... | 0.006494 |
def register_report(self, reportid, r_title, r_cb, checker):
"""register a report
reportid is the unique identifier for the report
r_title the report's title
r_cb the method to call to make the report
checker is the checker defining the report
"""
reportid = repo... | 0.005038 |
def inter(a, b):
"""
Intersect two sets of any data type to form a third set.
http://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/inter_c.html
:param a: First input set.
:type a: spiceypy.utils.support_types.SpiceCell
:param b: Second input set.
:type b: spiceypy.utils.support_types.Sp... | 0.000946 |
def port_create_gre(br, port, id, remote):
'''
Generic Routing Encapsulation - creates GRE tunnel between endpoints.
Args:
br: A string - bridge name.
port: A string - port name.
id: An integer - unsigned 32-bit number, tunnel's key.
remote: A string - remote endpoint's IP a... | 0.002471 |
def get_plug_mro(self, plug_type):
"""Returns a list of names identifying the plug classes in the plug's MRO.
For example:
['openhtf.plugs.user_input.UserInput']
Or:
['openhtf.plugs.user_input.UserInput',
'my_module.advanced_user_input.AdvancedUserInput']
"""
ignored_classe... | 0.001835 |
def get(self, id, service='facebook', type='analysis'):
""" Get a given Pylon task
:param id: The ID of the task
:type id: str
:param service: The PYLON service (facebook)
:type service: str
:return: dict of REST API output with headers attached
... | 0.003425 |
def is_transition_matrix(T, tol=1e-10):
"""
Tests whether T is a transition matrix
Parameters
----------
T : ndarray shape=(n, n)
matrix to test
tol : float
tolerance to check with
Returns
-------
Truth value : bool
True, if all elements are in interval [0, ... | 0.00156 |
def generateNodeDocuments(self):
'''
Creates all of the reStructuredText documents related to types parsed by
Doxygen. This includes all leaf-like documents (``class``, ``struct``,
``enum``, ``typedef``, ``union``, ``variable``, and ``define``), as well as
namespace, file, and d... | 0.00792 |
def lines(self, line_length=None):
"""
Generates a list with lines. These lines form the text drawing.
Args:
line_length (int): Optional. Breaks the circuit drawing to this length. This
useful when the drawing does not fit in the console. If
... | 0.003448 |
def tree(config=None,
path=None,
with_tags=False,
saltenv='base'):
'''
Transform Cisco IOS style configuration to structured Python dictionary.
Depending on the value of the ``with_tags`` argument, this function may
provide different views, valuable in different situations.
... | 0.000716 |
def show_command(endpoint_id, rule_id):
"""
Executor for `globus endpoint permission show`
"""
client = get_client()
rule = client.get_endpoint_acl_rule(endpoint_id, rule_id)
formatted_print(
rule,
text_format=FORMAT_TEXT_RECORD,
fields=(
("Rule ID", "id"),
... | 0.002174 |
def __parse_aliases_line(self, raw_alias, raw_username):
"""Parse aliases lines"""
alias = self.__encode(raw_alias)
username = self.__encode(raw_username)
return alias, username | 0.009479 |
def get_argument_starttime(self):
"""
Helper function to get starttime argument.
Raises exception if argument is missing.
Returns the starttime argument.
"""
try:
starttime = self.get_argument(constants.PARAM_STARTTIME)
return starttime
except tornado.web.MissingArgumentError as ... | 0.011142 |
def imagetransformer_base_8l_8h_big_cond_dr03_dan():
"""big 1d model for conditional image generation.2.99 on cifar10."""
hparams = imagetransformer_sep_channels_8l()
hparams.block_width = 256
hparams.block_length = 256
hparams.hidden_size = 512
hparams.num_heads = 8
hparams.filter_size = 2048
hparams.b... | 0.027473 |
def is_valid_embedding(emb, source, target):
"""A simple (bool) diagnostic for minor embeddings.
See :func:`diagnose_embedding` for a more detailed diagnostic / more information.
Args:
emb (dict): a dictionary mapping source nodes to arrays of target nodes
source (graph or edgelist): the g... | 0.003591 |
def command_line_arguments(command_line_parameters):
"""Defines the command line parameters that are accepted."""
# create parser
parser = argparse.ArgumentParser(description='Execute baseline algorithms with default parameters', formatter_class=argparse.ArgumentDefaultsHelpFormatter)
# add parameters
# - t... | 0.034104 |
def interpolate(self, transform, transitions=None, Y=None):
"""Interpolate new data onto a transformation of the graph data
One of either transitions or Y should be provided
Parameters
----------
transform : array-like, shape=[n_samples, n_transform_features]
transiti... | 0.001832 |
async def reject(self, reason: str = '') -> None:
"""
Reject the request.
:param reason: reason to reject (only works in group request)
"""
try:
await self.bot.call_action(
action='.handle_quick_operation_async',
self_id=self.ctx.get('... | 0.004115 |
def close (self):
"""Get results and close clamd daemon sockets."""
self.wsock.close()
data = self.sock.recv(self.sock_rcvbuf)
while data:
if "FOUND\n" in data:
self.infected.append(data)
if "ERROR\n" in data:
self.errors.append(dat... | 0.0075 |
def update_version_records(self):
"""
Update rash_info table if necessary.
"""
from .__init__ import __version__ as version
with self.connection(commit=True) as connection:
for vrec in self.get_version_records():
if (vrec.rash_version == version and
... | 0.004854 |
def _add_flow_v1_0(self, src, port, timeout, datapath):
"""enter a flow entry for the packet from the slave i/f
with idle_timeout. for OpenFlow ver1.0."""
ofproto = datapath.ofproto
parser = datapath.ofproto_parser
match = parser.OFPMatch(
in_port=port, dl_src=addrco... | 0.002688 |
def n_join(self, other, psi=-40.76, omega=-178.25, phi=-65.07,
o_c_n_angle=None, c_n_ca_angle=None, c_n_length=None, relabel=True):
"""Joins other to self at the N-terminus via a peptide bond.
Notes
-----
This function directly modifies self. It does not return a new obje... | 0.001669 |
def meta_features_path(self, path):
"""Returns path for meta-features
Args:
path (str): Absolute/local path of xcessiv folder
"""
return os.path.join(
path,
app.config['XCESSIV_META_FEATURES_FOLDER'],
str(self.id)
)... | 0.006079 |
def send_robust(self, **kwargs):
""" Trigger all receiver and pass them the parameters
If an exception is raised it will be catched and displayed as error
in the logger (if defined).
:param kwargs: all arguments from the event.
"""
for receiver in self.event_recei... | 0.003135 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.