text stringlengths 78 104k | score float64 0 0.18 |
|---|---|
def handle_ping(self, payload):
"""\
Respond to periodic PING messages from server
"""
self.logger.info('server ping: %s' % payload)
self.send('PONG %s' % payload, True) | 0.009569 |
def apply_vcc(self,vcc):
"""
Applies velocity contrast curve constraint to each population
See :func:`vespa.stars.StarPopulation.apply_vcc`;
all arguments passed to that function for each population.
"""
if 'secondary spectrum' not in self.constraints:
self.... | 0.008306 |
def node_set_to_surface(self, tag):
"""
Converts a node set to surface.
"""
# Create a dummy node with label 0
nodes = self.nodes.copy()
dummy = nodes.iloc[0].copy()
dummy["coords"] *= np.nan
dummy["sets"] = True
nodes.loc[0] = dummy
# Getting element surfaces
element_surface... | 0.011658 |
def load(self, code, setup='', teardown=''):
"""Prepares a set of setup, test, and teardown code to be
run in the console.
PARAMETERS:
code -- list; processed lines of code. Elements in the list are
either strings (input) or CodeAnswer objects (output)
se... | 0.003623 |
def serialize_break(ctx, document, elem, root):
"Serialize break element."
if elem.break_type == u'textWrapping':
_div = etree.SubElement(root, 'br')
else:
_div = etree.SubElement(root, 'span')
if ctx.options['embed_styles']:
_div.set('style', 'page-break-after: always;'... | 0.002445 |
def on_lstLayerModes_itemSelectionChanged(self):
"""Update layer mode description label and unit widgets.
.. note:: This is an automatic Qt slot
executed when the subcategory selection changes.
"""
self.clear_further_steps()
# Set widgets
layer_mode = self.sel... | 0.00311 |
def top_charts(self):
"""Get a listing of the default top charts."""
response = self._call(mc_calls.BrowseTopChart)
top_charts = response.body
return top_charts | 0.035294 |
def initialize():
"""
Initializes the cauldron library by confirming that it can be imported
by the importlib library. If the attempt to import it fails, the system
path will be modified and the attempt retried. If both attempts fail, an
import error will be raised.
"""
cauldron_module = ge... | 0.001439 |
def set_room_name(self, room_id, name, timestamp=None):
"""Perform PUT /rooms/$room_id/state/m.room.name
Args:
room_id (str): The room ID
name (str): The new room name
timestamp (int): Set origin_server_ts (For application services only)
"""
body = {
... | 0.00907 |
def run(self):
""" Run reinforcement learning algorithm """
device = self.model_config.torch_device()
# Reinforcer is the learner for the reinforcement learning model
reinforcer = self.reinforcer.instantiate(device)
optimizer = self.optimizer_factory.instantiate(reinforcer.model... | 0.001365 |
def to_timestamp(dt, timestamp):
"""Convert datetime to google.protobuf.Timestamp.
Args:
dt: a timezone naive datetime.
timestamp: a google.protobuf.Timestamp to populate.
Raises:
TypeError: if a timezone aware datetime was provided.
"""
if dt.tzinfo:
# this is an "aware" datetime with an ex... | 0.00846 |
def read(filename, attrs=None):
"""This will read any VTK file! It will figure out what reader to use
then wrap the VTK object for use in ``vtki``.
Parameters
----------
attrs : dict, optional
A dictionary of attributes to call on the reader. Keys of dictionary are
the attribute/met... | 0.004018 |
def SetAlpha(self, alpha):
'''
Change the window's transparency
:param alpha: From 0 to 1 with 0 being completely transparent
:return:
'''
self._AlphaChannel = alpha
if self._AlphaChannel is not None:
self.QT_QMainWindow.setWindowOpacity(self._AlphaCha... | 0.006154 |
def calc_environment_entropy(world, world_size=(60, 60),
exclude_desert=False):
"""
Calculate the Shannon entropy of a given environment, treating each niche
(where niches are defined by regions in which different sets of resources
are rewarded) as a category. The environmen... | 0.000977 |
def filter_on_wire_representation(ava, acs, required=None, optional=None):
"""
:param ava: A dictionary with attributes and values
:param acs: List of tuples (Attribute Converter name,
Attribute Converter instance)
:param required: A list of saml.Attributes
:param optional: A list of saml.At... | 0.000841 |
def dfs_inorder(self, reverse=False):
"""Generator that returns each element of the tree in Inorder order.
Keyword arguments:
reverse -- if true, the search is done from right to left."""
stack = deque()
visited = set()
visited.add(self)
if reverse:
st... | 0.002058 |
def once(ctx, name):
"""Run kibitzr checks once and exit"""
from kibitzr.app import Application
app = Application()
sys.exit(app.run(once=True, log_level=ctx.obj['log_level'], names=name)) | 0.004902 |
def accuracy(current, predicted):
"""
Computes the accuracy of the TM at time-step t based on the prediction
at time-step t-1 and the current active columns at time-step t.
@param current (array) binary vector containing current active columns
@param predicted (array) binary vector containing predicted act... | 0.014599 |
def getcomponentdetails(self, product, component, force_refresh=False):
"""
Helper for accessing a single component's info. This is a wrapper
around getcomponentsdetails, see that for explanation
"""
d = self.getcomponentsdetails(product, force_refresh)
return d[component... | 0.006231 |
def cert(name,
aliases=None,
email=None,
webroot=None,
test_cert=False,
renew=None,
keysize=None,
server=None,
owner='root',
group='root',
mode='0640',
certname=None,
preferred_challenges=None,
tls_sni_0... | 0.003599 |
def update_sources(self):
"""Update local sources based on response from Elasticsearch"""
ES_documents = self.get_docs_sources_from_ES()
for doc, update_spec, action_buffer_index, get_from_ES in self.doc_to_update:
if get_from_ES:
# Update source based on response fr... | 0.001772 |
def salt_api_acl_tool(username, request):
'''
..versionadded:: 2016.3.0
Verifies user requests against the API whitelist. (User/IP pair)
in order to provide whitelisting for the API similar to the
master, but over the API.
..code-block:: yaml
rest_cherrypy:
api_acl:
... | 0.000446 |
def _check_and_uninstall_ruby(ret, ruby, user=None):
'''
Verify that ruby is uninstalled
'''
ret = _ruby_installed(ret, ruby, user=user)
if ret['result']:
if ret['default']:
__salt__['rbenv.default']('system', runas=user)
if __salt__['rbenv.uninstall_ruby'](ruby, runas=u... | 0.001359 |
def update(gandi, resource, memory, cores, console, password, background,
reboot):
"""Update a virtual machine.
Resource can be a Hostname or an ID
"""
pwd = None
if password:
pwd = click.prompt('password', hide_input=True,
confirmation_prompt=True)
... | 0.001255 |
def send(self, message_type, message, connection_id, one_way=False):
"""Sends a message via the network.
Args:
message_type (str): The type of the message.
message (bytes): The message to be sent.
connection_id (str): The connection to send it to.
"""
... | 0.002778 |
def set_frequency(self, host, sem=None, interval=None):
"""Set frequency for host with sem and interval."""
# single sem or global sem
sem = sem or self.sem
interval = self.interval if interval is None else interval
frequency = Frequency(sem, interval, host)
frequencies =... | 0.004926 |
def get_settings(application, force_instance=False):
"""
Retrieve the media type settings for a application.
:param tornado.web.Application application:
:keyword bool force_instance: if :data:`True` then create the
instance if it does not exist
:return: the content settings instance
:r... | 0.001792 |
def set_status(self, new_status, notes=None):
'''Save all changes and set to the given new_status'''
self.status_id = new_status
try:
self.status['id'] = self.status_id
# We don't have the id to name mapping, so blank the name
self.status['name'] = None
... | 0.008086 |
def cmp_public_numbers(pn1, pn2):
"""
Compare 2 sets of public numbers. These is a way to compare
2 public RSA keys. If the sets are the same then the keys are the same.
:param pn1: The set of values belonging to the 1st key
:param pn2: The set of values belonging to the 2nd key
:return: True i... | 0.002179 |
def replace_seqs(ol,value,indexes,**kwargs):
'''
from elist.elist import *
ol = [1,'a',3,'a',5,'a',6,'a']
id(ol)
new = replace_seqs(ol,'AAA',[1,3,7])
ol
new
id(ol)
id(new)
####
ol = [1,'a',3,'a',5,'a',6,'a']
id(ol)
rslt ... | 0.005549 |
def post(method, hmc, uri, uri_parms, body, logon_required,
wait_for_completion):
"""Operation: Activate Logical Partition (requires classic mode)."""
assert wait_for_completion is True # async not supported yet
lpar_oid = uri_parms[0]
lpar_uri = '/api/logical-partitions/' ... | 0.001544 |
def toxml(self):
"""
Exports this object into a LEMS XML object
"""
xmlstr = '<OnEvent port="{0}"'.format(self.port)
chxmlstr = ''
for action in self.actions:
chxmlstr += action.toxml()
if chxmlstr:
xmlstr += '>' + chxmlstr + '</OnEvent... | 0.005181 |
def load_user_options(self):
"""Load user options from self.user_options dict
This can be set via POST to the API or via options_from_form
Only supported argument by default is 'profile'.
Override in subclasses to support other options.
"""
if self._profile_list is None... | 0.004754 |
def getElementsByType(self, type):
"""
retrieves all Elements that are of type type
@type type: class
@param type: type of the element
"""
foundElements=[]
for element in self.getAllElementsOfHirarchy():
if isinstance(element, type):
... | 0.016949 |
def pull(options):
"""
pull all remote programs to a local directory
"""
configuration = config.get_default()
app_url = configuration['app_url']
if options.deployment != None:
deployment_name = options.deployment
else:
deployment_name = configuration['deployment_name']
... | 0.001863 |
def plaintext(cls):
"""Uses only authentication mechanisms that provide the credentials in
un-hashed form, typically meaning
:attr:`~pysasl.AuthenticationCredentials.has_secret` is True.
Returns:
A new :class:`SASLAuth` object.
"""
builtin_mechs = cls._get_b... | 0.003817 |
def on_config_value_changed(self, config_m, prop_name, info):
"""Callback when a config value has been changed
Only collects information, delegates handling further to _handle_config_update
:param ConfigModel config_m: The config model that has been changed
:param str prop_name: Should... | 0.007364 |
def pivot_table(expr, values=None, rows=None, columns=None, aggfunc='mean',
fill_value=None):
"""
Create a spreadsheet-style pivot table as a DataFrame.
:param expr: collection
:param values (optional): column to aggregate
:param rows: rows to group
:param columns: keys to group... | 0.001207 |
def runRmFile(self, path, timeout=None, **kwargs):
""" remove a file from the worker """
cmd_args = {'path': path, 'logEnviron': self.logEnviron}
if timeout:
cmd_args['timeout'] = timeout
if self.workerVersionIsOlderThan('rmfile', '3.1'):
cmd_args['dir'] = os.path... | 0.004246 |
def log_p(self,z):
"""
The unnormalized log posterior components (the quantity we want to approximate)
RAO-BLACKWELLIZED!
"""
return np.array([self.log_p_blanket(i) for i in z]) | 0.022422 |
def parse_xml(self, xml):
'''
:param key_xml: lxml.etree.Element representing a single VocabularyCodeSet
'''
xmlutils = XmlUtils(xml)
self.name = xmlutils.get_string_by_xpath('name')
self.family = xmlutils.get_string_by_xpath('family')
self.version = xmlutils.... | 0.006885 |
def _plot_time_list(sdat, lovs, tseries, metas, times=None):
"""Plot requested profiles"""
if times is None:
times = {}
for vfig in lovs:
fig, axes = plt.subplots(nrows=len(vfig), sharex=True,
figsize=(12, 2 * len(vfig)))
axes = [axes] if len(vfig) ==... | 0.000569 |
def meta_(cls, **kwargs):
"""
Meta allows you to add meta data to site
:params **kwargs:
meta keys we're expecting:
title (str)
description (str)
url (str) (Will pick it up by itself if not set)
image (str)
site_name (str) (but... | 0.001584 |
def maskrcnn_loss(mask_logits, fg_labels, fg_target_masks):
"""
Args:
mask_logits: #fg x #category xhxw
fg_labels: #fg, in 1~#class, int64
fg_target_masks: #fgxhxw, float32
"""
num_fg = tf.size(fg_labels, out_type=tf.int64)
indices = tf.stack([tf.range(num_fg), fg_labels - 1]... | 0.002011 |
def close(self):
"""close all pooled connections"""
print("PGPooledTransaction - shutting down connection pool")
for name, conn in self.pool.iteritems():
conn.close()
print("PGPooledTransaction - connection %s closed" % name) | 0.007326 |
def get_gzh_by_search(text):
"""从搜索公众号获得的文本 提取公众号信息
Parameters
----------
text : str or unicode
搜索公众号获得的文本
Returns
-------
list[dict]
{
'open_id': '', # 微信号唯一ID
'profile_url': '', # 最近10条群发页链接
... | 0.002533 |
def proof_req_pred_referents(proof_req: dict) -> dict:
"""
Given a proof request with all requested predicates having cred def id restrictions,
return its predicate referents by cred def id and attribute, mapping a predicate and a limit.
The returned structure can be useful in downstream processing to ... | 0.002979 |
def findBinomialNsWithExpectedSampleMinimum(desiredValuesSorted, p, numSamples, nMax):
"""
For each desired value, find an approximate n for which the sample minimum
has a expected value equal to this value.
For each value, find an adjacent pair of n values whose expected sample minima
are below and above th... | 0.008368 |
def batches(iterable, n=1):
"""
From http://stackoverflow.com/a/8290508/270334
:param n:
:param iterable:
"""
l = len(iterable)
for ndx in range(0, l, n):
yield iterable[ndx:min(ndx + n, l)] | 0.00885 |
def cancel_confirmation(self, confirmation_id):
"""
Cancelles an confirmation
:param confirmation_id: the confirmation id
:return Response
"""
return self._create_put_request(
resource=CONFIRMATIONS,
billomat_id=confirmation_id,
comman... | 0.0059 |
def rootChild_resetPassword(self, req, webViewer):
"""
Redirect authenticated users to their settings page (hopefully they
have one) when they try to reset their password.
This is the wrong way for this functionality to be implemented. See
#2524.
"""
from xmanti... | 0.003868 |
def esc(self, val):
"""
Returns the given object in the appropriate wrapper class from esc_types.py.
In most cases, you will not need to call this directly. However, if you are
passing a string to the interp method that should be used as an SQL bind value
and not raw SQL, you m... | 0.006883 |
def down(self, h, cr=True):
"""moves current vertical position h mm down
cr True will navigate to the left margin
"""
if cr:
self.oPdf.ln(h=0)
self.oPdf.set_y(self.oPdf.get_y() + h) | 0.008584 |
def set_value(self, key, value):
# type: (str, Any) -> None
"""Modify a value in the configuration.
"""
self._ensure_have_load_only()
fname, parser = self._get_parser_to_modify()
if parser is not None:
section, name = _disassemble_key(key)
# Mod... | 0.005085 |
def _CreateNewSeasonDir(self, seasonNum):
"""
Creates a new season directory name in the form 'Season <NUM>'.
If skipUserInput is True this will be accepted by default otherwise the
user can choose to accept this, use the base show directory or enter
a different name.
Parameters
----------... | 0.007519 |
def process_dynamic_completion(self, completion):
""" how to validate and generate completion for dynamic params """
if len(completion.split()) > 1:
completion = '\"' + completion + '\"'
if self.validate_completion(completion):
yield Completion(completion, -len(self.unfi... | 0.006006 |
def reset(self):
""" reset filter back to state at time of construction"""
self.n = 0 # nth step in the recursion
self.x = np.zeros(self._order + 1)
self.K = np.zeros(self._order + 1)
self.y = 0 | 0.008475 |
def attn(image_feat, query, hparams, name="attn"):
"""Attention on image feature with question as query."""
with tf.variable_scope(name, "attn", values=[image_feat, query]):
attn_dim = hparams.attn_dim
num_glimps = hparams.num_glimps
num_channels = common_layers.shape_list(image_feat)[-1]
if len(com... | 0.003992 |
def restore(self, state):
"""Restore the state of this InMemoryStorageEngine from a dict."""
storage_data = state.get(u'storage_data', [])
streaming_data = state.get(u'streaming_data', [])
if len(storage_data) > self.storage_length or len(streaming_data) > self.streaming_length:
... | 0.009126 |
def channel(self, channel_id=None, synchronous=False):
"""
Fetch a Channel object identified by the numeric channel_id, or
create that object if it doesn't already exist. If channel_id is not
None but no channel exists for that id, will raise InvalidChannel. If
there are alread... | 0.001217 |
def space_before(self):
"""
The EMU equivalent of the centipoints value in
`./a:spcBef/a:spcPts/@val`.
"""
spcBef = self.spcBef
if spcBef is None:
return None
spcPts = spcBef.spcPts
if spcPts is None:
return None
return spcP... | 0.006135 |
def setMimeTypeByName(self, name):
" Guess the mime type "
mimetype = mimetypes.guess_type(name)[0]
if mimetype is not None:
self.mimetype = mimetypes.guess_type(name)[0].split(";")[0] | 0.009091 |
def match(self, row, template_row=None):
"""
匹配一个模板时,只比较起始行,未来考虑支持比较关键字段即可,现在是起始行的所有字段全匹配
:param row:
:return:
"""
if not template_row:
template_cols = self.template[0]['cols']
else:
template_cols = template_row['cols']
#check if l... | 0.01005 |
def login(self, user: str, passwd: str) -> None:
"""Log in to instagram with given username and password and internally store session object.
:raises InvalidArgumentException: If the provided username does not exist.
:raises BadCredentialsException: If the provided password is wrong.
:r... | 0.009091 |
def from_args(cls, **kwargs):
"""
Generates one or more VSGSuite instances from command line arguments.
:param kwargs: List of additional keyworded arguments to be passed into the VSGSuite defined in the :meth:`~VSGSuite.make_parser` method.
"""
# Create a VSGSuite for each fil... | 0.003667 |
def delete_plate(self, plate_id, delete_meta_data=False):
"""
Delete a plate from the database
:param plate_id: The plate id
:param delete_meta_data: Optionally delete all meta data associated with this plate as well
:return: None
"""
if plate_id not in ... | 0.003922 |
def get_announce_filename( working_dir ):
"""
Get the path to the file that stores all of the announcements.
"""
announce_filepath = os.path.join( working_dir, get_default_virtualchain_impl().get_virtual_chain_name() ) + '.announce'
return announce_filepath | 0.033088 |
def set_size(self, data_size):
"""
Set the data slice size.
"""
if len(str(data_size)) > self.first:
raise ValueError(
'Send size is too large for message size-field width!')
self.data_size = data_size | 0.01087 |
def list_available_work_units(self, work_spec_name, start=0, limit=None):
"""Get a dictionary of available work units for some work spec.
The dictionary is from work unit name to work unit definiton.
Only work units that have not been started, or units that were
started but did not comp... | 0.003509 |
def read(domain, key, user=None):
'''
Write a default to the system
CLI Example:
.. code-block:: bash
salt '*' macdefaults.read com.apple.CrashReporter DialogType
salt '*' macdefaults.read NSGlobalDomain ApplePersistence
domain
The name of the domain to read from
ke... | 0.001862 |
def __create_point_comparator(self, type_point):
"""!
@brief Create point comparator.
@details In case of numpy.array specific comparator is required.
@param[in] type_point (data_type): Type of point that is stored in KD-node.
@return (callable) Callable point comparator... | 0.005803 |
def resolve_incident(self, incident_key,
description=None, details=None):
""" Causes the referenced incident to enter resolved state.
Send a resolve event when the problem that caused the initial
trigger has been fixed.
"""
return self.create_event(descr... | 0.007614 |
def _get_isolated(self, hostport):
"""Get a Peer for the given destination for a request.
A new Peer is added and returned if one does not already exist for the
given host-port. Otherwise, the existing Peer is returned.
**NOTE** new peers will not be added to the peer heap.
"""... | 0.002805 |
def check_type_keywords(self, schema, rule, path):
"""
All supported keywords:
- allowempty_map
- assertion
- class
- date
- default
- desc
- enum
- example
- extensions
- func
- ident
- include_n... | 0.003709 |
def init(self):
"""
Creates the virtual environment.
"""
r = self.local_renderer
# if self.virtualenv_exists():
# print('virtualenv exists')
# return
print('Creating new virtual environment...')
with self.settings(warn_only=True):
... | 0.005682 |
def del_preset(self, name):
"""Delete a named command line preset.
:param name: the name of the preset to delete
:returns: True on success or False otherwise
"""
policy = self.policy
if not policy.find_preset(name):
self.ui_log.error("Preset '%s' not ... | 0.003373 |
def update(did):
"""Update DDO of an existing asset
---
tags:
- ddo
consumes:
- application/json
parameters:
- in: body
name: body
required: true
description: DDO of the asset.
schema:
type: object
required:
- "@contex... | 0.002428 |
def clusterflow_commands_table (self):
""" Make a table of the Cluster Flow commands """
# I wrote this when I was tired. Sorry if it's incomprehensible.
desc = '''Every Cluster Flow run will have many different commands.
MultiQC splits these by whitespace, collects by the tool nam... | 0.007718 |
def stream_filter(self, delegate, follow=None, track=None, locations=None,
stall_warnings=None):
"""
Streams public messages filtered by various parameters.
https://dev.twitter.com/docs/api/1.1/post/statuses/filter
At least one of ``follow``, ``track``, or ``locat... | 0.001569 |
def enabled(name, **kwargs):
'''
Return True if the named service is enabled at boot and the provided
flags match the configured ones (if any). Return False otherwise.
name
Service name
CLI Example:
.. code-block:: bash
salt '*' service.enabled <service name>
salt '*'... | 0.002913 |
def _integrateRZOrbit(vxvv,pot,t,method,dt):
"""
NAME:
_integrateRZOrbit
PURPOSE:
integrate an orbit in a Phi(R,z) potential in the (R,z) plane
INPUT:
vxvv - array with the initial conditions stacked like
[R,vR,vT,z,vz]; vR outward!
pot - Potential instance
... | 0.021086 |
def _get_reader(self, network_reader):
"""
Get a reader or None if another reader is already reading.
"""
with (yield from self._lock):
if self._reader_process is None:
self._reader_process = network_reader
if self._reader:
if self.... | 0.007921 |
def make_uhs(hmap, info):
"""
Make Uniform Hazard Spectra curves for each location.
:param hmap:
array of shape (N, M, P)
:param info:
a dictionary with keys poes, imtls, uhs_dt
:returns:
a composite array containing uniform hazard spectra
"""
uhs = numpy.zeros(len(h... | 0.001838 |
def reraise(additional_msg):
"""Reraise an exception with an additional message."""
exc_type, exc_value, exc_traceback = sys.exc_info()
msg = str(exc_value) + "\n" + additional_msg
six.reraise(exc_type, exc_type(msg), exc_traceback) | 0.020833 |
def plot_state_hinton(rho, title='', figsize=None):
"""Plot a hinton diagram for the quanum state.
Args:
rho (ndarray): Numpy array for state vector or density matrix.
title (str): a string that represents the plot title
figsize (tuple): Figure size in inches.
Returns:
matp... | 0.00036 |
def create_item(self, name):
"""
create a new todo list item
"""
elem = self.controlled_list.create_item(name)
if elem:
return TodoElementUX(parent=self, controlled_element=elem) | 0.008696 |
def _Download(campaign, subcampaign):
'''
Download all stars from a given campaign. This is
called from ``missions/k2/download.pbs``
'''
# Are we doing a subcampaign?
if subcampaign != -1:
campaign = campaign + 0.1 * subcampaign
# Get all star IDs for this campaign
stars = [s[0... | 0.001439 |
def maybe_reshape_4d_to_3d(x):
"""Reshape input from 4D to 3D if necessary."""
x_shape = common_layers.shape_list(x)
is_4d = False
if len(x_shape) == 4:
x = tf.reshape(x, [x_shape[0], x_shape[1]*x_shape[2], x_shape[3]])
is_4d = True
return x, x_shape, is_4d | 0.021818 |
def set_doc_data_lics(self, doc, lics):
"""Sets the document data license.
Raises value error if malformed value, CardinalityError
if already defined.
"""
if not self.doc_data_lics_set:
self.doc_data_lics_set = True
if validations.validate_data_lics(lics):... | 0.003472 |
def create_key(self, title, key):
"""Create a new key for the authenticated user.
:param str title: (required), key title
:param key: (required), actual key contents, accepts path as a string
or file-like object
:returns: :class:`Key <github3.users.Key>`
"""
... | 0.0033 |
def make_pubmed_gene_group(entrez_ids: Iterable[Union[str, int]]) -> Iterable[str]:
"""Builds a skeleton for gene summaries
:param entrez_ids: A list of Entrez Gene identifiers to query the PubMed service
:return: An iterator over statement lines for NCBI Entrez Gene summaries
"""
url = PUBMED_GENE... | 0.007282 |
def robust_init(stochclass, tries, *args, **kwds):
"""Robust initialization of a Stochastic.
If the evaluation of the log-probability returns a ZeroProbability
error, due for example to a parent being outside of the support for
this Stochastic, the values of parents are randomly sampled until
a val... | 0.001688 |
def eval_advs(self, x, y, preds_adv, X_test, Y_test, att_type):
"""
Evaluate the accuracy of the model on adversarial examples
:param x: symbolic input to model.
:param y: symbolic variable for the label.
:param preds_adv: symbolic variable for the prediction on an
adversarial... | 0.002334 |
def GetLayerFromFeatureService(self, fs, layerName="", returnURLOnly=False):
"""Obtains a layer from a feature service by feature service reference.
Args:
fs (FeatureService): The feature service from which to obtain the layer.
layerName (str): The name of the layer. Defaults to... | 0.003205 |
def get_connections(app):
"""
Return all Heroku Connect connections setup with the given application.
For more details check the link -
https://devcenter.heroku.com/articles/heroku-connect-api#step-4-retrieve-the-new-connection-s-id
Sample response from the API call is below::
{
... | 0.003521 |
def _assemble_regulate_activity(self, stmt):
"""Example: p(HGNC:MAP2K1) => act(p(HGNC:MAPK1))"""
act_obj = deepcopy(stmt.obj)
act_obj.activity = stmt._get_activity_condition()
# We set is_active to True here since the polarity is encoded
# in the edge (decreases/increases)
... | 0.003766 |
def session_end_pb(status, end_time_secs=None):
"""Constructs a SessionEndInfo protobuffer.
Creates a summary that contains status information for a completed
training session. Should be exported after the training session is completed.
One such summary per training session should be created. Each should have
... | 0.005808 |
def get_dword_from_offset(self, offset):
"""Return the double word value at the given file offset. (little endian)"""
if offset+4 > len(self.__data__):
return None
return self.get_dword_from_data(self.__data__[offset:offset+4], 0) | 0.011194 |
def and_(cls, *queries):
"""
根据传入的 Query 对象,构造一个新的 AND 查询。
:param queries: 需要构造的子查询列表
:rtype: Query
"""
if len(queries) < 2:
raise ValueError('and_ need two queries at least')
if not all(x._query_class._class_name == queries[0]._query_class._class_nam... | 0.005725 |
def _run(self, *args: Any, **kwargs: Any) -> None:
"""
Wraps around the process body (the function that implements a process within the simulation) so as to catch the
eventual Interrupt that may terminate the process.
"""
try:
self._body(*args, **kwargs)
i... | 0.005505 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.