text stringlengths 78 104k | score float64 0 0.18 |
|---|---|
def get_comments_of_delivery_note_per_page(self, delivery_note_id, per_page=1000, page=1):
"""
Get comments of delivery note per page
:param delivery_note_id: the delivery note
:param per_page: How many objects per page. Default: 1000
:param page: Which page. Default: 1
... | 0.005386 |
def setMood(self, mood):
"""
Update the activity message for the current user.
Args:
mood (str): new mood message
"""
self.conn("POST", "{0}/users/{1}/profile/partial".format(SkypeConnection.API_USER, self.userId),
auth=SkypeConnection.Auth.SkypeTok... | 0.009238 |
def run_job_flow(Name=None, LogUri=None, AdditionalInfo=None, AmiVersion=None, ReleaseLabel=None, Instances=None, Steps=None, BootstrapActions=None, SupportedProducts=None, NewSupportedProducts=None, Applications=None, Configurations=None, VisibleToAllUsers=None, JobFlowRole=None, ServiceRole=None, Tags=None, SecurityC... | 0.00447 |
def get_ordered_tokens_from_vocab(vocab: Vocab) -> List[str]:
"""
Returns the list of tokens in a vocabulary, ordered by increasing vocabulary id.
:param vocab: Input vocabulary.
:return: List of tokens.
"""
return [token for token, token_id in sorted(vocab.items(), key=lambda i: i[1])] | 0.009615 |
def _estimate_expenses(self, num_workers, reward):
''' Returns tuple describing expenses:
amount paid to workers
amount paid to amazon'''
# fee structure changed 07.22.15:
# 20% for HITS with < 10 assignments
# 40% for HITS with >= 10 assignments
commission = 0.2... | 0.00396 |
def refresh_file_dependent_actions(self):
"""Enable/disable file dependent actions
(only if dockwidget is visible)"""
if self.dockwidget and self.dockwidget.isVisible():
enable = self.get_current_editor() is not None
for action in self.file_dependent_actions:
... | 0.005634 |
def genl_register(ops):
"""Register Generic Netlink family backed cache.
https://github.com/thom311/libnl/blob/libnl3_2_25/lib/genl/mngt.c#L241
Same as genl_register_family() but additionally registers the specified cache operations using
nl_cache_mngt_register() and associates it with the Generic Net... | 0.001916 |
def __ensure_provisioning_alarm(table_name, table_key, gsi_name, gsi_key):
""" Ensure that provisioning alarm threshold is not exceeded
:type table_name: str
:param table_name: Name of the DynamoDB table
:type table_key: str
:param table_key: Table configuration option key name
:type gsi_name: ... | 0.000224 |
def geojson_handler(geojson, hType='map'):
"""Restructure a GeoJSON object in preparation to be added directly by add_map_data or add_data_set methods.
The geojson will be broken down to fit a specific Highcharts (highmaps) type, either map, mapline or mappoint.
Meta data in GeoJSON's properties object wi... | 0.011928 |
def p_elseif_list(p):
'''elseif_list : empty
| elseif_list ELSEIF LPAREN expr RPAREN statement'''
if len(p) == 2:
p[0] = []
else:
p[0] = p[1] + [ast.ElseIf(p[4], p[6], lineno=p.lineno(2))] | 0.004255 |
def identify_factory(*extensions):
"""Factory function to create I/O identifiers for a set of extensions
The returned function is designed for use in the unified I/O registry
via the `astropy.io.registry.register_identifier` hool.
Parameters
----------
extensions : `str`
one or more fi... | 0.001126 |
def remove_ifcfg_file(device_index='0'):
"""Removes the ifcfg file at the specified device index
and restarts the network service
:param device_index: (int) Device Index
:return: None
:raises CommandError
"""
log = logging.getLogger(mod_logger + '.remove_ifcfg_file')
if not isinstance(d... | 0.003153 |
def keys(self, namespace, prefix=None, limit=None, offset=None):
"""Get keys from a namespace"""
params = [namespace]
query = 'SELECT key FROM gauged_keys WHERE namespace = %s'
if prefix is not None:
query += ' AND key LIKE %s'
params.append(prefix + '%')
... | 0.003263 |
def on_user_status(
self=None,
filters=None,
group: int = 0
) -> callable:
"""Use this decorator to automatically register a function for handling user status updates.
This does the same thing as :meth:`add_handler` using the :class:`UserStatusHandler`.
Args:
... | 0.006434 |
def xi2_from_mass1_mass2_spin2x_spin2y(mass1, mass2, spin2x, spin2y):
"""Returns the effective precession spin argument for the smaller mass.
This function assumes it's given spins of the secondary mass.
"""
q = q_from_mass1_mass2(mass1, mass2)
a1 = 2 + 3 * q / 2
a2 = 2 + 3 / (2 * q)
return ... | 0.002632 |
def busy(self):
"""Return if the connection is currently executing a query or is locked
by a session that still exists.
:rtype: bool
"""
if self.handle.isexecuting():
return True
elif self.used_by is None:
return False
return not self.use... | 0.005988 |
def set_geometry(im, width_height):
"""Rescale the image to the new geometry.
"""
width, height = width_height
if not width and not height:
return im
im_width, im_height = im.size
# Geometry match the current size?
if (width is None) or (im_width == width):
if (height is No... | 0.00106 |
def H_iso(x,params):
""" Isochrone Hamiltonian = -GM/(b+sqrt(b**2+(r-r0)**2))"""
#r = (np.sqrt(np.sum(x[:3]**2))-params[2])**2
r = np.sum(x[:3]**2)
return 0.5*np.sum(x[3:]**2)-Grav*params[0]/(params[1]+np.sqrt(params[1]**2+r)) | 0.016529 |
def export_compact(self, filename, optimize=True, toco_compatible=False):
"""Create a self-contained inference-only graph and write final graph (in pb format) to disk.
Args:
filename (str): path to the output graph
optimize (bool): whether to use TensorFlow's `optimize_for_infer... | 0.003785 |
def distinct(self):
"""
Only return distinct row.
Return a new query set with distinct mark
"""
new_query_set = self.clone()
new_query_set.query.distinct = True
return new_query_set | 0.012605 |
def failed_login_limit_reached(self):
""" A boolean method to check for failed login limit being reached"""
login_limit = 10
if self.failed_logins and self.failed_logins >= login_limit:
return True
else:
return False | 0.007353 |
def connect_options_namespaced_service_proxy(self, name, namespace, **kwargs):
"""
connect OPTIONS requests to proxy of Service
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.connect_optio... | 0.004958 |
def augmentation_transform(self, data, label): # pylint: disable=arguments-differ
"""Override Transforms input data with specified augmentations."""
for aug in self.auglist:
data, label = aug(data, label)
return (data, label) | 0.01145 |
def extract_options(name):
"""
Extracts comparison option from filename.
As example, ``Binarizer-SkipDim1`` means
options *SkipDim1* is enabled.
``(1, 2)`` and ``(2,)`` are considered equal.
Available options:
* `'SkipDim1'`: reshape arrays by skipping 1-dimension: ``(1, 2)`` --> ``(2,)``
... | 0.00523 |
def get_bench_api(self):
"""
Extend bench functionality with these new commands
:return: Dictionary
"""
# Extend bench functionality with these new commands
ret_dict = dict()
ret_dict["assertTraceDoesNotContain"] = asserts.assertTraceDoesNotContain
ret_dic... | 0.004175 |
def index(self, prefix):
"""
Return the model index for a prefix.
"""
# Any web domain will be handled by the standard URLField.
if self.is_external_url_prefix(prefix):
prefix = 'http'
for i, urltype in enumerate(self._url_types):
if urltype.prefi... | 0.005305 |
def rewrite_elife_funding_awards(json_content, doi):
""" rewrite elife funding awards """
# remove a funding award
if doi == "10.7554/eLife.00801":
for i, award in enumerate(json_content):
if "id" in award and award["id"] == "par-2":
del json_content[i]
# add fundin... | 0.002553 |
def prepare(self, context, stream_id):
"""Invoke prepare() of this custom grouping"""
self.grouping.prepare(context, self.source_comp_name, stream_id, self.task_ids) | 0.011561 |
def morph_cost(self) -> Optional["Cost"]:
""" This returns 150 minerals for OrbitalCommand instead of 550 """
# Fix for BARRACKSREACTOR which has tech alias [REACTOR] which has (0, 0) cost
if self.tech_alias is None or self.tech_alias[0] in {UnitTypeId.TECHLAB, UnitTypeId.REACTOR}:
r... | 0.007431 |
async def auth_crypt(wallet_handle: int,
sender_vk: str,
recipient_vk: str,
msg: bytes) -> bytes:
"""
**** THIS FUNCTION WILL BE DEPRECATED USE pack_message INSTEAD ****
Encrypt a message by authenticated-encryption scheme.
Sender can encr... | 0.003506 |
def multiscale_permutation_entropy(time_series, m, delay, scale):
"""Calculate the Multiscale Permutation Entropy
Args:
time_series: Time series for analysis
m: Order of permutation entropy
delay: Time delay
scale: Scale factor
Returns:
Vector containing Multiscale ... | 0.004435 |
def from_jd(jd: float, fmt: str = 'jd') -> datetime:
"""
Converts a Julian Date to a datetime object.
Algorithm is from Fliegel and van Flandern (1968)
Parameters
----------
jd: float
Julian Date as type specified in the string fmt
fmt: str
Returns
-------
dt: datetime... | 0.00524 |
def eval_pth(filename, sitedir, dest=None, imports=None):
'''
Evaluates a `.pth` file (including support for `import` statements), and
appends the result to the list *dest*. If *dest* is #None, it will fall
back to `sys.path`.
If *imports* is specified, it must be a list. `import` statements will not
execu... | 0.011566 |
def reset_sequence(self, topic):
"""Reset the expected sequence number for a topic
If the topic is unknown, this does nothing. This behaviour is
useful when you have wildcard topics that only create queues
once they receive the first message matching the topic.
Args:
... | 0.004329 |
def _publish_response(self, slug, message):
"""Publish a response message for a device
Args:
slug (string): The device slug that we are publishing on behalf of
message (dict): A set of key value pairs that are used to create the message
that is sent.
"""
... | 0.007366 |
def recarray(self):
"""Return a recarray from the (parsed) string."""
if self.records is None:
self.parse()
try:
# simple (should this also be subjected to convert.to_int64() ?)
return numpy.rec.fromrecords(self.records, names=self.names)
except Value... | 0.005092 |
def Zabransky_quasi_polynomial_integral_over_T(T, Tc, a1, a2, a3, a4, a5, a6):
r'''Calculates the integral of liquid heat capacity over T using the
quasi-polynomial model developed in [1]_.
Parameters
----------
T : float
Temperature [K]
a1-a6 : float
Coefficients
Returns... | 0.005337 |
def mbar_objective_and_gradient(u_kn, N_k, f_k):
"""Calculates both objective function and gradient for MBAR.
Parameters
----------
u_kn : np.ndarray, shape=(n_states, n_samples), dtype='float'
The reduced potential energies, i.e. -log unnormalized probabilities
N_k : np.ndarray, shape=(n_s... | 0.002699 |
def get_page_as_pdf(self, page_id):
"""
Export page as standard pdf exporter
:param page_id: Page ID
:return: PDF File
"""
headers = self.form_token_headers
url = 'spaces/flyingpdf/pdfpageexport.action?pageId={pageId}'.format(pageId=page_id)
return self.ge... | 0.008174 |
def search_onfail_requisites(sid, highstate):
'''
For a particular low chunk, search relevant onfail related states
'''
onfails = []
if '_|-' in sid:
st = salt.state.split_low_tag(sid)
else:
st = {'__id__': sid}
for fstate, fchunks in six.iteritems(highstate):
if fsta... | 0.000444 |
def qualify(workers, qualification, value, by_name, notify, sandbox):
"""Assign a qualification to 1 or more workers"""
if not (workers and qualification and value):
raise click.BadParameter(
"Must specify a qualification ID, value/score, and at least one worker ID"
)
mturk = _mt... | 0.00224 |
def transformer_tpu_range(rhp):
"""Small range of hyperparameters."""
# After starting from base, set intervals for some parameters.
rhp.set_float("learning_rate", 0.3, 3.0, scale=rhp.LOG_SCALE)
rhp.set_discrete("learning_rate_warmup_steps",
[1000, 2000, 4000, 8000, 16000])
rhp.set_float("i... | 0.018256 |
def long_list_to_word(val_list, big_endian=True):
"""Long list (32 bits int) to word list (16 bits int)
By default long_list_to_word() use big endian order. For use little endian, set
big_endian param to False.
:param val_list: list of 32 bits int value
:type val_list: list
... | 0.002193 |
def hooks(self, project):
""" Look up the urls we need to post to"""
return self.get_queryset().filter(
Q(project=None) |
Q(project=project)
).distinct('url') | 0.009662 |
def add_it(workbench, file_list, labels):
"""Add the given file_list to workbench as samples, also add them as nodes.
Args:
workbench: Instance of Workbench Client.
file_list: list of files.
labels: labels for the nodes.
Returns:
A list of md5s.
"""
md5s = []
f... | 0.00149 |
def generate_threshold_mask(hist):
'''Masking array elements when equal 0.0 or greater than 10 times the median
Parameters
----------
hist : array_like
Input data.
Returns
-------
masked array
Returns copy of the array with masked elements.
'''
masked_array = np.ma.... | 0.003711 |
def _assert_gcs_files(files):
"""Check files starts wtih gs://.
Args:
files: string to file path, or list of file paths.
"""
if sys.version_info.major > 2:
string_type = (str, bytes) # for python 3 compatibility
else:
string_type = basestring # noqa
if isinstance(files, string_type):
fi... | 0.015217 |
def _parse_pool_options(options):
"""Parse connection pool options."""
max_pool_size = options.get('maxpoolsize', common.MAX_POOL_SIZE)
min_pool_size = options.get('minpoolsize', common.MIN_POOL_SIZE)
default_idle_seconds = common.validate_timeout_or_none(
'maxidletimems', common.MAX_IDLE_TIME_M... | 0.0006 |
def get_application_modules(self):
"""
Instantiate all application modules (i.e.
:class:`~admin_tools.dashboard.modules.AppList`,
:class:`~fluent_dashboard.modules.AppIconList` and
:class:`~fluent_dashboard.modules.CmsAppIconList`)
for use in the dashboard.
""... | 0.004902 |
def map_indices_child2parent(child, child_indices):
"""Map child RTDCBase event indices to parent RTDCBase
Parameters
----------
child: RTDC_Hierarchy
hierarchy child with `child_indices`
child_indices: 1d ndarray
child indices to map
Returns
-------
parent_indices: 1d ... | 0.001506 |
def get_resource_dirs(resource):
"""Returns a list of all known resource dirs for a given resource.
:param str resource:
Name of the resource (e.g. "themes")
:return:
A list of resource dirs
"""
dirs = [
os.path.join(dir, resource) for dir in
itertools.chain(GLib.get... | 0.003795 |
def instance(self, other):
'''Returns an instance Key, by appending a name to the namespace.'''
assert '/' not in str(other)
return Key(str(self) + ':' + str(other)) | 0.00565 |
def get_response_headers(self, *args, **kwargs):
"""
A convenience method for obtaining the headers that were sent from the
S3 server.
The AWS S3 API depends upon setting headers. This method is used by the
head_object API call for getting a S3 object's metadata.
"""
... | 0.004843 |
def add_attribute_listener(self, attr_name, observer):
"""
Add an attribute listener callback.
The callback function (``observer``) is invoked differently depending on the *type of attribute*.
Attributes that represent sensor values or which are used to monitor connection status are upd... | 0.006066 |
def make_server(host, port, app=None, threaded=False, processes=1,
request_handler=None, passthrough_errors=False,
ssl_context=None):
"""Create a new server instance that is either threaded, or forks
or just processes one request after another.
"""
if threaded and process... | 0.001116 |
def get_best(self):
"""Return best fitted distribution and its parameters
a dictionary with one key (the distribution name) and its parameters
"""
# self.df should be sorted, so then us take the first one as the best
name = self.df_errors.sort_values('sumsquare_error').iloc[0].... | 0.005063 |
def _process_executor_events(self, simple_dag_bag, session=None):
"""
Respond to executor events.
"""
# TODO: this shares quite a lot of code with _manage_executor_state
TI = models.TaskInstance
for key, state in list(self.executor.get_event_buffer(simple_dag_bag.dag_ids... | 0.003456 |
def write_image(self, filename="image.png", magnification=1,
image_format="png"):
"""
Save render window to an image.
Arguments:
filename:
filename to save to. Defaults to image.png.
magnification:
magnification. Use it... | 0.003209 |
def generate_project(args):
"""New project."""
# Project templates path
src = os.path.join(dirname(abspath(__file__)), 'project')
project_name = args.get('<project>')
if not project_name:
logger.warning('Project name cannot be empty.')
return
# Destination project path
dst... | 0.001198 |
def download_ncbi_associations(gene2go="gene2go", prt=sys.stdout, loading_bar=True):
"""Download associations from NCBI, if necessary"""
# Download: ftp://ftp.ncbi.nlm.nih.gov/gene/DATA/gene2go.gz
gzip_file = "{GENE2GO}.gz".format(GENE2GO=gene2go)
if not os.path.isfile(gene2go):
file_remote = "f... | 0.003373 |
def _get_training_data(vrn_files):
"""Retrieve training data, returning an empty set of information if not available.
"""
out = {"SNP": [], "INDEL": []}
# SNPs
for name, train_info in [("train_hapmap", "known=false,training=true,truth=true,prior=15.0"),
("train_omni", "k... | 0.008377 |
def get_key_state(self, status, state_dict):
"""Returns the key associated with the dict. """
for key, val in state_dict.items():
if val == status:
return key | 0.009901 |
def extract_arguments(text):
"""
Returns the argument after the command.
Examples:
extract_arguments("/get name"): 'name'
extract_arguments("/get"): ''
extract_arguments("/get@botName name"): 'name'
:param text: String to extract the arguments from a command
:return: the argume... | 0.018315 |
def prt_error_summary(self, fout_err):
"""Print a summary about the GAF file that was read."""
# Get summary of error types and their counts
errcnts = []
if self.ignored:
errcnts.append(" {N:9,} IGNORED associations\n".format(N=len(self.ignored)))
if self.illegal_lin... | 0.00672 |
def multi_index_df_to_component_dfs(multi_index_df, rid="rid", cid="cid"):
""" Convert a multi-index df into 3 component dfs. """
# Id level of the multiindex will become the index
rids = list(multi_index_df.index.get_level_values(rid))
cids = list(multi_index_df.columns.get_level_values(cid))
# I... | 0.003951 |
def update(ctx, migrate=False):
'''Perform a development update'''
msg = 'Update all dependencies'
if migrate:
msg += ' and migrate data'
header(msg)
info('Updating Python dependencies')
lrun('pip install -r requirements/develop.pip')
lrun('pip install -e .')
info('Updating JavaS... | 0.002232 |
def dictionary(
element_name, # type: Text
children, # type: List[Processor]
required=True, # type: bool
alias=None, # type: Optional[Text]
hooks=None # type: Optional[Hooks]
):
# type: (...) -> RootProcessor
"""
Create a processor for dictionary values.
:pa... | 0.005698 |
def get_cache_data(request):
if 'init' in request.POST:
init = bool(float(request.POST['init']))
else:
init = False
active_variables = []
if 'variables[]' in request.POST:
active_variables = request.POST.getlist('variables[]')
"""
else:
active_variables = list(
... | 0.002346 |
def get(self):
"""
Retrieves all properties again for the collection and
sets the attributes.
"""
data = self.resource(self.name).properties.get()
self.set_data(**data)
return data | 0.008097 |
def sub_menu_pressed(self, widget, event):
"""
Function serves for getting full assistant path and
collects the information from GUI
"""
for index, data in enumerate(self.dev_assistant_path):
index += 1
if settings.SUBASSISTANT_N_STRING.format(index) in se... | 0.00335 |
def recv_msg(self):
'''message receive routine'''
if self._index >= self._count:
return None
m = self._msgs[self._index]
self._index += 1
self.percent = (100.0 * self._index) / self._count
self.messages[m.get_type()] = m
return m | 0.006734 |
def _execute_after_prepare(self, host, connection, pool, response):
"""
Handle the response to our attempt to prepare a statement.
If it succeeded, run the original query again against the same host.
"""
if pool:
pool.return_connection(connection)
if self._fi... | 0.001824 |
def add_noise_to_program(prog, T1=30e-6, T2=30e-6, gate_time_1q=50e-9, gate_time_2q=150e-09,
ro_fidelity=0.95):
"""
Add generic damping and dephasing noise to a program.
.. warning::
This function is deprecated. Please use :py:func:`add_decoherence_noise` instead.
:pa... | 0.007038 |
def mount_volume(volume, device='/dev/xvdf', mountpoint='/mnt/data', fstype='ext4'):
'''
Mount an EBS volume
Args:
volume (str): EBS volume ID
device (str): default /dev/xvdf
mountpoint (str): default /mnt/data
fstype (str): default ext4
'''
_ec2().attach_volume(volu... | 0.004211 |
def consume_payload(rlp, prefix, start, type_, length):
"""Read the payload of an item from an RLP string.
:param rlp: the rlp string to read from
:param type_: the type of the payload (``bytes`` or ``list``)
:param start: the position at which to start reading
:param length: the length of the payl... | 0.001731 |
def __username(self, fname, lname): # pragma: no cover
"""Convert first name + last name into first.last style username."""
self.username = '.'.join([i.lower() for i in [fname, lname]]) | 0.009901 |
def readRaw8(self):
"""Read an 8-bit value on the bus (without register)."""
self._idle()
self._transaction_start()
self._i2c_start()
self._i2c_write_bytes([self._address_byte(False)])
self._i2c_stop()
self._i2c_idle()
self._i2c_start()
self._i2c_w... | 0.003795 |
def _gtu8(ins):
""" Compares & pops top 2 operands out of the stack, and checks
if the 1st operand > 2nd operand (top of the stack).
Pushes 0 if False, 1 if True.
8 bit unsigned version
"""
output = _8bit_oper(ins.quad[2], ins.quad[3], reversed_=True)
output.append('cp h')
o... | 0.002551 |
def _set_cam_share(self, v, load=False):
"""
Setter method for cam_share, mapped from YANG variable /hardware/profile/tcam/cam_share (container)
If this variable is read-only (config: false) in the
source YANG file, then _set_cam_share is considered as a private
method. Backends looking to populate ... | 0.006127 |
def call_audit(func):
"""Print a detailed audit of all calls to this function."""
def audited_func(*args, **kwargs):
import traceback
stack = traceback.extract_stack()
r = func(*args, **kwargs)
func_name = func.__name__
print("@depth %d, trace %s -> %s(*%r, **%r) => %r" ... | 0.001873 |
def update_classification_annotations_and_summaries(
self,
updatePeakMagnitudes=True):
"""*update classification annotations and summaries*
**Key Arguments:**
- ``updatePeakMagnitudes`` -- update the peak magnitudes in the annotations to give absolute magnitudes. Def... | 0.001857 |
def get_queue_func(request):
"""Establish the connection to rabbitmq."""
def cleanup(request):
conn.close()
def queue_func(**kwargs):
return conn.channel().basic_publish(
exchange='', body=json.dumps(kwargs), routing_key=queue,
properties=pika.BasicProperties(deliver... | 0.001709 |
def set_net_configuration(self, ipv4_address=None, ipv4_configuration=None,
ipv4_gateway=None, channel=None):
"""Set network configuration data.
Apply desired network configuration data, leaving unspecified
parameters alone.
:param ipv4_address: CIDR nota... | 0.001569 |
def _updateVariantAnnotationSets(self, variantFile, dataUrl):
"""
Updates the variant annotation set associated with this variant using
information in the specified pysam variantFile.
"""
# TODO check the consistency of this between VCF files.
if not self.isAnnotated():
... | 0.000945 |
def next(self) -> mx.io.DataBatch:
"""
Returns the next batch.
"""
if self.iter_next():
return self.next_batch
raise StopIteration | 0.010989 |
def wait(self, wait_time=0):
"""
Blocking call to check if the worker returns the result. One can use
job.result after this call returns ``True``.
:arg wait_time: Time in seconds to wait, default is infinite.
:return: `True` or `False`.
.. note::
This is a... | 0.004367 |
def splitGenoSlidingWindow(pos,out_file,size=5e4,step=None):
"""
split into windows using a slide criterion
Args:
size: window size
step: moving step (default: 0.5*size)
Returns:
wnd_i: number of windows
nSnps: vector of per-window number of SNPs
... | 0.021053 |
def _expectation(p, kern, feat, mean, none, nghp=None):
"""
Compute the expectation:
expectation[n] = <K_{Z, x_n} x_{n+1}^T>_p(x_{n:n+1})
- K_{.,.} :: Linear kernel
- p :: MarkovGaussian distribution (p.cov 2x(N+1)xDxD)
:return: NxMxD
"""
Xmu, Xcov = p.mu, p.cov
with ... | 0.002339 |
def _txtinfo_to_jsoninfo(self, data):
"""
converts olsr 1 txtinfo format to jsoninfo
"""
# replace INFINITE with inf, which is convertible to float
data = data.replace('INFINITE', 'inf')
# find interesting section
lines = data.split('\n')
# process links ... | 0.001158 |
def best_kmers(dt, response, sequence, k=6, consider_shift=True, n_cores=1,
seq_align="start", trim_seq_len=None):
"""
Find best k-mers for CONCISE initialization.
Args:
dt (pd.DataFrame): Table containing response variable and sequence.
response (str): Name of the column use... | 0.003283 |
def _subprocess_method(self, command):
"""Use the subprocess module to execute ipmitool commands
and and set status
"""
p = subprocess.Popen([self._ipmitool_path] + self.args + command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
self.output, self.error = p.communicate()
... | 0.008571 |
def paginate(self, skip, limit):
"""Paginate list of records"""
if not self.count() or not limit:
return
skip = skip or 0
pages = int(ceil(self.count() / float(limit)))
limits = {}
last = 0
for i in range(pages):
current = limit * i
... | 0.003322 |
def _update_github(
self):
"""commit the changes and push them to github
"""
self.log.debug('starting the ``_update_github`` method')
from subprocess import Popen, PIPE, STDOUT
gdir = self.settings["sherlock wiki root"]
cmd = """cd %(gdir)s && git add --all &... | 0.004511 |
def isTransitionAllowed(instance, transition_id):
"""Checks if the object can perform the transition passed in.
:returns: True if transition can be performed
:rtype: bool
"""
wf_tool = getToolByName(instance, "portal_workflow")
for wf_id in wf_tool.getChainFor(instance):
wf = wf_tool.get... | 0.002242 |
def to_sky(self, wcs, mode='all'):
"""
Convert the aperture to a `SkyRectangularAnnulus` object
defined in celestial coordinates.
Parameters
----------
wcs : `~astropy.wcs.WCS`
The world coordinate system (WCS) transformation to use.
mode : {'all', '... | 0.002628 |
def exists(package):
"""
Return True if package information is available.
If ``pkg-config`` not on path, raises ``EnvironmentError``.
"""
pkg_config_exe = os.environ.get('PKG_CONFIG', None) or 'pkg-config'
cmd = '{0} --exists {1}'.format(pkg_config_exe, package).split()
return call(cmd) == ... | 0.003115 |
def update_from(
self,
obj=None,
yaml_env=None,
yaml_file=None,
json_env=None,
json_file=None,
env_namespace=None,
):
"""
Update dict from several sources at once.
This is simply a convenience method... | 0.001257 |
def available_modes_with_ids(self):
"""Return list of objects containing available mode name and id."""
if not self._available_mode_ids:
all_modes = FIXED_MODES.copy()
self._available_mode_ids = all_modes
modes = self.get_available_modes()
try:
... | 0.002398 |
def update_file(self, id, hidden=None, lock_at=None, locked=None, name=None, on_duplicate=None, parent_folder_id=None, unlock_at=None):
"""
Update file.
Update some settings on the specified file
"""
path = {}
data = {}
params = {}
# REQUIRED -... | 0.003501 |
def islice(self, start, end):
"""
Returns a new DateTimeIndex, containing a subslice of the timestamps in this index,
as specified by the given integer start and end locations.
Parameters
----------
start : int
The location of the start of the range, inclusiv... | 0.005792 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.