text stringlengths 78 104k | score float64 0 0.18 |
|---|---|
def corrwith(self, other, axis=0, drop=False, method='pearson'):
"""
Compute pairwise correlation between rows or columns of DataFrame
with rows or columns of Series or DataFrame. DataFrames are first
aligned along both axes before computing the correlations.
Parameters
... | 0.00065 |
def empty(self, name, **kwargs):
"""Create an array. Keyword arguments as per
:func:`zarr.creation.empty`."""
return self._write_op(self._empty_nosync, name, **kwargs) | 0.010471 |
def _linkUser(self, user):
"""Set the UID of the current Contact in the User properties and update
all relevant own properties.
"""
KEY = "linked_contact_uid"
username = user.getId()
contact = self.getContactByUsername(username)
# User is linked to another conta... | 0.001005 |
def _place_order(self,
side,
product_id='BTC-USD',
client_oid=None,
type=None,
stp=None,
price=None,
size=None,
funds=None,
time_in_force=None,
... | 0.029262 |
def _transform_constant_sequence(self, seq):
"""
Transform a frozenset or tuple.
"""
should_transform = is_a(self.types)
if not any(filter(should_transform, flatten(seq))):
# Tuple doesn't contain any transformable strings. Ignore.
yield LOAD_CONST(seq)
... | 0.002162 |
def is_pre_prepare_time_acceptable(self, pp: PrePrepare, sender: str) -> bool:
"""
Returns True or False depending on the whether the time in PRE-PREPARE
is acceptable. Can return True if time is not acceptable but sufficient
PREPAREs are found to support the PRE-PREPARE
:param p... | 0.004 |
def unsplat(f: Callable[[Iterable], A]) -> Callable[..., A]:
"""Convert a function taking a single iterable argument into a function taking multiple arguments.
Args:
f: Any function taking a single iterable argument
Returns:
A function that accepts multiple arguments. Each argument of this... | 0.004754 |
def plot_lines(f, x, samples, ax=None, **kwargs):
r"""
Plot a representative set of functions to sample
Additionally, if a list of log-evidences are passed, along with list of
functions, and list of samples, this function plots the probability mass
function for all models marginalised according to ... | 0.000403 |
def force_unicode(raw):
'''Try really really hard to get a Unicode copy of a string.
First try :class:`BeautifulSoup.UnicodeDammit` to try to force
to Unicode; if that fails, assume UTF-8 encoding, and ignore
all errors.
:param str raw: string to coerce
:return: Unicode approximation of `raw`
... | 0.001374 |
def ResolveObject(self, document):
'''Tries to locate a document in the archive.
This function tries to locate the document inside the archive. It
returns a tuple where the first element is zero if the function
was successful, and the second is the UnitInfo for that document.
The... | 0.003604 |
def _partition(iter_dims, data_sources):
"""
Partition data sources into
1. Dictionary of data sources associated with radio sources.
2. List of data sources to feed multiple times.
3. List of data sources to feed once.
"""
src_nr_vars = set(source_var_types().values())
iter_dims = set... | 0.001537 |
def mgmt_request(self, message, operation, op_type=None, node=None, callback=None, **kwargs):
"""Run a request/response operation. These are frequently used for management
tasks against a $management node, however any node name can be specified
and the available options will depend on the target... | 0.006211 |
def remove_duplicates(list_to_prune: List) -> List:
"""Removes duplicates from a list while preserving order of the items.
:param list_to_prune: the list being pruned of duplicates
:return: The pruned list
"""
temp_dict = collections.OrderedDict()
for item in list_to_prune:
temp_dict[it... | 0.00274 |
def aggregate_task_lm_losses(hparams,
problem_hparams,
logits,
feature_name,
feature):
"""LM loss for multiproblems."""
summaries = []
vocab_size = problem_hparams.vocab_size[feature_name]
if voca... | 0.011424 |
def get_attributes(self, template_pack=TEMPLATE_PACK):
"""
Used by crispy_forms_tags to get helper attributes
"""
items = {
'form_method': self.form_method.strip(),
'form_tag': self.form_tag,
'form_style': self.form_style.strip(),
'form_sho... | 0.004189 |
def get_input_string_port(self, port_name, default=None):
"""
Get input string port value
:param port_name:
:param default:
:return: :rtype:
"""
if self.__string_input_ports:
return self.__string_input_ports.get(port_name, default)
return defau... | 0.006211 |
def get_gradebook_column_query_session(self, proxy):
"""Gets the ``OsidSession`` associated with the gradebook column query service.
arg: proxy (osid.proxy.Proxy): a proxy
return: (osid.grading.GradebookColumnQuerySession) - a
``GradebookColumnQuerySession``
raise: N... | 0.004566 |
def _ParseStringOption(cls, options, argument_name, default_value=None):
"""Parses a string command line argument.
Args:
options (argparse.Namespace): parser options.
argument_name (str): name of the command line argument.
default_value (Optional[str]): default value of the command line argum... | 0.006761 |
def calibrate_dates(chron, calib_curve, d_r, d_std, cutoff=0.0001, normal_distr=False, t_a=[3], t_b=[4]):
"""Get density of calendar dates for chron date segment in core
Parameters
----------
chron : DatedProxy-like
calib_curve : CalibCurve or list of CalibCurves
d_r : scalar or ndarray
... | 0.002193 |
def find_descriptor(self, uuid):
"""Return the first child descriptor found that has the specified
UUID. Will return None if no descriptor that matches is found.
"""
for desc in self.list_descriptors():
if desc.uuid == uuid:
return desc
return None | 0.006309 |
def PrivateKeyFromWIF(wif):
"""
Get the private key from a WIF key
Args:
wif (str): The wif key
Returns:
bytes: The private key
"""
if wif is None or len(wif) is not 52:
raise ValueError('Please provide a wif with a length of 52 bytes... | 0.004219 |
def velocity(adata, var_names=None, basis=None, groupby=None, groups=None, mode=None, fits='all', layers='all',
color=None, color_map='RdBu_r', colorbar=False, perc=[2,98], use_raw=False, size=None, alpha=.5,
fontsize=None, figsize=None, dpi=None, show=True, save=None, ax=None, ncols=None, **k... | 0.005118 |
def call(self, command, params=None, expect_body=True, stream=False):
"""
Sends the provided command to Serf for evaluation, with
any parameters as the message body.
"""
if self._socket is None:
raise SerfConnectionError('handshake must be made first')
header... | 0.000548 |
def kurtosis(data):
"""
Return the kurtosis for ``data``.
"""
if len(data) == 0:
return None
num = moment(data, 4)
denom = moment(data, 2) ** 2.
return num / denom if denom != 0 else 0 | 0.004484 |
def omnigraffle(self):
""" tries to open an export directly in omnigraffle """
temp = self.rdf_source("dot")
try: # try to put in the user/tmp folder
from os.path import expanduser
home = expanduser("~")
filename = home + "/tmp/turtle_sketch.dot"
f = open(filename, "w")
except:
filename = "turt... | 0.042283 |
def _write_config(config):
'''
writes /usbkey/config
'''
try:
with salt.utils.atomicfile.atomic_open('/usbkey/config', 'w') as config_file:
config_file.write("#\n# This file was generated by salt\n#\n")
for prop in salt.utils.odict.OrderedDict(sorted(config.items())):
... | 0.003538 |
def minimal_raw_seqs(self):
''' m.minimal_raw_seqs() -- Return minimal list of seqs that represent consensus '''
seqs = [[], []]
for letter in self.oneletter:
if one2two.has_key(letter):
seqs[0].append(one2two[letter][0])
seqs[1].append(one2two[letter]... | 0.013722 |
def is_address_readable(self, address):
"""
Determines if an address belongs to a commited and readable page.
The page may or may not have additional permissions.
@note: Returns always C{False} for kernel mode addresses.
@type address: int
@param address: Memory addres... | 0.002574 |
def periodic_send(self, content, interval, title=''):
"""
发送周期消息
:param content: (必填|str) - 需要发送的消息内容
:param interval: (必填|int|datetime.timedelta) - 发送消息间隔时间,支持 datetime.timedelta 或 integer 表示的秒数
:param title: (选填|str) - 需要发送的消息标题
:return: * status:发送状态,True 发送成,False 发... | 0.003617 |
def tag_media_sibling_ordinal(tag):
"""
Count sibling ordinal differently depending on if the
mimetype is video or not
"""
if hasattr(tag, 'name') and tag.name != 'media':
return None
nodenames = ['fig','supplementary-material','sub-article']
first_parent_tag = first_parent(tag, nod... | 0.00451 |
def fstab_present(name, fs_file, fs_vfstype, fs_mntops='defaults',
fs_freq=0, fs_passno=0, mount_by=None,
config='/etc/fstab', mount=True, match_on='auto'):
'''
Makes sure that a fstab mount point is pressent.
name
The name of block device. Can be any valid fs_sp... | 0.000145 |
def _init_from_csr(self, csr):
"""
Initialize data from a CSR matrix.
"""
if len(csr.indices) != len(csr.data):
raise ValueError('length mismatch: {} vs {}'.format(len(csr.indices), len(csr.data)))
handle = ctypes.c_void_p()
_check_call(_LIB.XGDMatrixCreateFro... | 0.010169 |
def main():
"""
NAME
remanence_aniso_magic.py
DESCRIPTION
This program is similar to aarm_magic.py and atrm_magic.py with minor modifications.
Converts magic measurement file with ATRM/AARM data to best-fit tensor (6 elements plus sigma)
following Hext (1963), and calculate... | 0.031564 |
def run(cmd, filename=None, threads=True, verbose=False):
"""Similar to profile.run ."""
_run(threads, verbose, 'run', filename, cmd) | 0.007092 |
def bilinear_interpolation(x, y, points):
'''Interpolate (x,y) from values associated with four points.
The four points are a list of four triplets: (x, y, value).
The four points can be in any order. They should form a rectangle.
>>> bilinear_interpolation(12, 5.5,
... ... | 0.006165 |
def DoxySourceScan(node, env, path):
"""
Doxygen Doxyfile source scanner. This should scan the Doxygen file and add
any files used to generate docs to the list of source files.
"""
default_file_patterns = [
'*.c', '*.cc', '*.cxx', '*.cpp', '*.c++', '*.java', '*.ii', '*.ixx',
'*.ipp', '*.i++'... | 0.020661 |
def _create_wx_app():
"""
Creates a wx.App instance if it has not been created sofar.
"""
wxapp = wx.GetApp()
if wxapp is None:
wxapp = wx.App(False)
wxapp.SetExitOnFrameDelete(True)
# retain a reference to the app object so it does not get garbage
# collected and cau... | 0.002618 |
def is_primitive(self):
"""is the value a built-in type?"""
if is_py2:
return isinstance(
self.val,
(
types.NoneType,
types.BooleanType,
types.IntType,
types.LongType,
... | 0.004942 |
def reply(self, message: typing.Union[int, types.Message]):
"""
Reply to message
:param message: :obj:`int` or :obj:`types.Message`
:return: self
"""
setattr(self, 'reply_to_message_id', message.message_id if isinstance(message, types.Message) else message)
retu... | 0.009174 |
def _set_id_variable_by_entity_key(self) -> Dict[str, str]:
'''Identify and set the good ids for the different entities'''
if self.id_variable_by_entity_key is None:
self.id_variable_by_entity_key = dict(
(entity.key, entity.key + '_id') for entity in self.tax_benefit_system.... | 0.008386 |
def parse_token_list_rec(self, min_precedence):
"""
Parses a tokenized arithmetic expression into a parse tree. It calls
itself recursively to handle bracketed subexpressions.
@return: Returns a token string.
@rtype: lems.parser.expr.ExprNode
@attention: Does not handle... | 0.013676 |
def _handle_invite(self, room_id: _RoomID, state: dict):
""" Join rooms invited by whitelisted partners """
if self._stop_event.ready():
return
self.log.debug('Got invite', room_id=room_id)
invite_events = [
event
for event in state['events']
... | 0.00245 |
def run(self, *,
connector: Union[EnvVar, Token, SlackClient, None] = None,
interval: float = 0.5, retries: int = 16,
backoff: Callable[[int], float] = None,
until: Callable[[List[dict]], bool] = None) -> None:
"""
Connect to the Slack API and run the even... | 0.002217 |
def to_segment_xml(self, override_file_if_exists=False):
"""
Write the segment list in self.segmentList to self.storage_path.
"""
# create XML doc and add process table
outdoc = ligolw.Document()
outdoc.appendChild(ligolw.LIGO_LW())
process = ligolw_process.regist... | 0.003069 |
def setCurrentIndex(self, index):
"""
Sets the current index on self and on the tab bar to keep the two insync.
:param index | <int>
"""
super(XViewPanel, self).setCurrentIndex(index)
self.tabBar().setCurrentIndex(index) | 0.010989 |
def set_end_of_event_function(self, function):
''' Adding function to module.
This is maybe the only way to make the clusterizer to work with multiprocessing.
'''
self.cluster_functions._end_of_event_function = self._jitted(function)
self._end_of_event_function = function | 0.009615 |
def set_distribute_compositions(self, distribute_comps):
"""Sets the distribution rights.
This sets distribute verbatim to ``true``.
arg: distribute_comps (boolean): right to distribute
modifications
raise: InvalidArgument - ``distribute_comps`` is invalid
r... | 0.003755 |
def start_udp_client(self, ip=None, port=None, name=None, timeout=None, protocol=None, family='ipv4'):
"""Starts a new UDP client.
Client can be optionally given `ip` and `port` to bind to, as well as
`name`, default `timeout` and a `protocol`. `family` can be either
ipv4 (default) or ... | 0.005102 |
def get_function_argspec(func, is_class_method=None):
'''
A small wrapper around getargspec that also supports callable classes
:param is_class_method: Pass True if you are sure that the function being passed
is a class method. The reason for this is that on Python 3
... | 0.00391 |
def estimate_ride(api_client):
"""Use an UberRidesClient to fetch a ride estimate and print the results.
Parameters
api_client (UberRidesClient)
An authorized UberRidesClient with 'request' scope.
"""
try:
estimate = api_client.estimate_ride(
product_id=SURGE_PRO... | 0.001582 |
def check_config_options(_class, required_options, optional_options, options):
"""Helper method to check options.
Arguments:
_class -- the original class that takes received the options.
required_options -- the options that are required. If they are not
present, a Conf... | 0.000875 |
def simple_time(value):
"""
Format a datetime or timedelta object to a string of format HH:MM
"""
if isinstance(value, timedelta):
return ':'.join(str(value).split(':')[:2])
return datetime_to_string(value, '%H:%M') | 0.004115 |
def _createGsshaPyObjects(self, eventChunk):
"""
Create GSSHAPY PrecipEvent, PrecipValue, and PrecipGage Objects Method
"""
## TODO: Add Support for RADAR file format type values
# Create GSSHAPY PrecipEvent
event = PrecipEvent(description=eventChunk['description'],
... | 0.002092 |
def motif_tree_plot(outfile, tree, data, circle=True, vmin=None, vmax=None, dpi=300):
"""
Plot a "phylogenetic" tree
"""
try:
from ete3 import Tree, faces, AttrFace, TreeStyle, NodeStyle
except ImportError:
print("Please install ete3 to use this functionality")
sys.exit(1)
... | 0.012857 |
def branch_type(cls, branch):
"""
Return the string representation for the type of a branch
"""
typename = branch.GetClassName()
if not typename:
leaf = branch.GetListOfLeaves()[0]
typename = leaf.GetTypeName()
# check if leaf has multiple elem... | 0.003236 |
def undeploy_api_gateway(self, lambda_name, domain_name=None, base_path=None):
"""
Delete a deployed REST API Gateway.
"""
print("Deleting API Gateway..")
api_id = self.get_api_id(lambda_name)
if domain_name:
# XXX - Remove Route53 smartly here?
... | 0.001951 |
def qeuler(yaw, pitch, roll):
"""Convert Euler angle to quaternion.
Parameters
----------
yaw: number
pitch: number
roll: number
Returns
-------
np.array
"""
yaw = np.radians(yaw)
pitch = np.radians(pitch)
roll = np.radians(roll)
cy = np.cos(yaw * 0.5)
sy ... | 0.001603 |
def update(self, cookies):
"""Add specified cookies to our cookie jar, and persists it.
:param cookies: Any iterable that yields http.cookiejar.Cookie instances, such as a CookieJar.
"""
cookie_jar = self.get_cookie_jar()
for cookie in cookies:
cookie_jar.set_cookie(cookie)
with self._loc... | 0.011561 |
def _reschedule(self, node):
"""Maybe schedule new items on the node.
If there are any globally pending work units left then this will check
if the given node should be given any more tests.
"""
# Do not add more work to a node shutting down
if node.shutting_down:
... | 0.002463 |
def name(self):
"""Concatenates the names of the given criteria in alphabetical order.
If a sub-criterion is itself a combined criterion, its name is
first split into the individual names and the names of the
sub-sub criteria is used instead of the name of the sub-criterion.
Thi... | 0.00274 |
def members(self, is_manager=None):
"""
Retrieve members of the scope.
:param is_manager: (optional) set to True to return only Scope members that are also managers.
:type is_manager: bool
:return: List of members (usernames)
Examples
--------
>>> member... | 0.007123 |
def _parse_categories(element):
"""
Returns a list with categories with relations.
"""
reference = {}
items = element.findall("./{%s}category" % WP_NAMESPACE)
for item in items:
term_id = item.find("./{%s}term_id" % WP_NAMESPACE).text
nicename = item.find("./{%s}category_nicenam... | 0.001368 |
def comparator(objective):
"""
Higher order function creating a compare function for objectives.
Args:
objective (cipy.algorithms.core.Objective): The objective to create a
compare for.
Returns:
callable: Function accepting two objectives to compare.
Examples:
... | 0.00173 |
def download(self, protocol, host, user, password,
file_name, rbridge='all'):
"""
Download firmware to device
"""
urn = "{urn:brocade.com:mgmt:brocade-firmware}"
request_fwdl = self.get_firmware_download_request(protocol, host,
... | 0.003911 |
def best_fit_font_size(cls, text, extents, max_size, font_file):
"""
Return the largest whole-number point size less than or equal to
*max_size* that allows *text* to fit completely within *extents* when
rendered using font defined in *font_file*.
"""
line_source = _LineS... | 0.004474 |
def deep_force_unicode(value):
"""
Recursively call force_text on value.
"""
if isinstance(value, (list, tuple, set)):
value = type(value)(map(deep_force_unicode, value))
elif isinstance(value, dict):
value = type(value)(map(deep_force_unicode, value.items()))
elif isinstance(val... | 0.002604 |
def buckets_list(self, projection='noAcl', max_results=0, page_token=None, project_id=None):
"""Issues a request to retrieve the list of buckets.
Args:
projection: the projection of the bucket information to retrieve.
max_results: an optional maximum number of objects to retrieve.
page_token:... | 0.006863 |
def _validate_input_data(self, data, request):
""" Validate input data.
:param request: the HTTP request
:param data: the parsed data
:return: if validation is performed and succeeds the data is converted
into whatever format the validation uses (by default Django's
... | 0.003044 |
def as_dataframe(self, fillna=True, subjects=None):
"""
Return association set as pandas DataFrame
Each row is a subject (e.g. gene)
Each column is the inferred class used to describe the subject
"""
entries = []
selected_subjects = self.subjects
if subje... | 0.003871 |
def calc_xyz2surf(surf, xyz, threshold=20, exponent=None, std=None):
"""Calculate transformation matrix from xyz values to vertices.
Parameters
----------
surf : instance of wonambi.attr.Surf
the surface of only one hemisphere.
xyz : numpy.ndarray
nChan x 3 matrix, with the location... | 0.000613 |
def aggregate_region(self, variable, region='World', subregions=None,
components=None, append=False):
"""Compute the aggregate of timeseries over a number of regions
including variable components only defined at the `region` level
Parameters
----------
v... | 0.001311 |
def create_chan_labels(self):
"""Create the channel labels, but don't plot them yet.
Notes
-----
It's necessary to have the width of the labels, so that we can adjust
the main scene.
"""
self.idx_label = []
for one_grp in self.parent.channels.groups:
... | 0.0033 |
def bind(self, data_shapes, label_shapes=None, for_training=True,
inputs_need_grad=False, force_rebind=False, shared_module=None,
grad_req='write'):
"""Binds the symbols to construct executors. This is necessary before one
can perform computation with the module.
Param... | 0.004693 |
def fcoe_fcoe_map_fcoe_map_fabric_map_fcoe_map_fabric_map_name(self, **kwargs):
"""Auto Generated Code
"""
config = ET.Element("config")
fcoe = ET.SubElement(config, "fcoe", xmlns="urn:brocade.com:mgmt:brocade-fcoe")
fcoe_map = ET.SubElement(fcoe, "fcoe-map")
fcoe_map_nam... | 0.005168 |
def get_ldap(cls, global_options=None):
"""
Returns the configured ldap module.
"""
# Apply global LDAP options once
if not cls._ldap_configured and global_options is not None:
for opt, value in global_options.items():
ldap.set_option(opt, value)
... | 0.005319 |
def __put_names_on_csv_cols(names, cols):
"""
Put the variableNames with the corresponding column data.
:param list names: variableNames
:param list cols: List of Lists of column data
:return dict:
"""
_combined = {}
for idx, name in enumerate(names):
... | 0.006536 |
def process_allele(allele_data, dbsnp_data, header, reference):
"""Combine data from multiple lines refering to a single allele.
Returns three items in this order:
(string) concatenated variant sequence (ie allele the genome has)
(string) concatenated reference sequence
(string) start p... | 0.000637 |
def process_tcase(tcase):
"""Goes through the trun and processes "run.log" """
tcase["src_content"] = src_to_html(tcase["fpath"])
tcase["log_content"] = runlogs_to_html(tcase["res_root"])
tcase["aux_list"] = aux_listing(tcase["aux_root"])
tcase["descr_short"], tcase["descr_long"] = tcase_parse_desc... | 0.002545 |
def TextToAttachmentStatus(self, Text):
"""Returns attachment status code.
:Parameters:
Text : unicode
Text, one of 'UNKNOWN', 'SUCCESS', 'PENDING_AUTHORIZATION', 'REFUSED', 'NOT_AVAILABLE',
'AVAILABLE'.
:return: Attachment status.
:rtype: `enums`.apiA... | 0.003641 |
def Match(pattern, s):
"""Matches the string with the pattern, caching the compiled regexp."""
# The regexp compilation caching is inlined in both Match and Search for
# performance reasons; factoring it out into a separate function turns out
# to be noticeably expensive.
if pattern not in _regexp_compile_cac... | 0.015982 |
def parse_args():
'''Parse args
'''
parser = argparse.ArgumentParser(description='Train and Test an Adversarial Variatiional Encoder')
parser.add_argument('--train', help='train the network', action='store_true')
parser.add_argument('--test', help='test the network', action='store_true')
parser... | 0.0079 |
def is_commit_id_equal(self, dest, name):
"""
Return whether the current commit hash equals the given name.
Args:
dest: the repository directory.
name: a string name.
"""
if not name:
# Then avoid an unnecessary subprocess call.
return... | 0.005348 |
def _index_counter_keys(self, counter, unknown_token, reserved_tokens, most_freq_count,
min_freq):
"""Indexes keys of `counter`.
Indexes keys of `counter` according to frequency thresholds such as `most_freq_count` and
`min_freq`.
"""
assert isinsta... | 0.005208 |
def plugins(self):
"""
Newest version of all plugins in the group filtered by ``blacklist``
Returns:
dict: Nested dictionary of plugins accessible through dot-notation.
Plugins are returned in a nested dictionary, but can also be accessed through dot-notion.
Just as... | 0.006682 |
def config(ctx):
"""[GROUP] Configuration management operations"""
from hfos import database
database.initialize(ctx.obj['dbhost'], ctx.obj['dbname'])
from hfos.schemata.component import ComponentConfigSchemaTemplate
ctx.obj['col'] = model_factory(ComponentConfigSchemaTemplate) | 0.003333 |
def init_log(logger, filename=None, loglevel=None):
"""
Initializes the log file in the proper format.
Arguments:
filename (str): Path to a file. Or None if logging is to
be disabled.
loglevel (str): Determines the level of the log output.
"""
... | 0.006381 |
def retrieve_file_from_url(url):
"""
Retrieve a file from an URL
Args:
url: The URL to retrieve the file from.
Returns:
The absolute path of the downloaded file.
"""
try:
alias_source, _ = urlretrieve(url)
# Check for HTTPError in Python 2.x
with open(al... | 0.002837 |
def fpn_map_rois_to_levels(boxes):
"""
Assign boxes to level 2~5.
Args:
boxes (nx4):
Returns:
[tf.Tensor]: 4 tensors for level 2-5. Each tensor is a vector of indices of boxes in its level.
[tf.Tensor]: 4 tensors, the gathered boxes in each level.
Be careful that the retur... | 0.002703 |
def _get_api_params(api_url=None,
page_id=None,
api_key=None,
api_version=None):
'''
Retrieve the API params from the config file.
'''
statuspage_cfg = __salt__['config.get']('statuspage')
if not statuspage_cfg:
statuspage_cfg = {}
... | 0.004505 |
def _get_uploaded_versions_warehouse(project_name, index_url, requests_verify=True):
""" Query the pypi index at index_url using warehouse api to find all of the "releases" """
url = '/'.join((index_url, project_name, 'json'))
response = requests.get(url, verify=requests_verify)
if response.status_code ... | 0.007634 |
def update(data_df, cal_dict, param, bound, start, end):
'''Update calibration times for give parameter and boundary'''
from collections import OrderedDict
if param not in cal_dict['parameters']:
cal_dict['parameters'][param] = OrderedDict()
if bound not in cal_dict['parameters'][param]:
... | 0.003922 |
def _write_summary_cnts(self, cnts):
"""Write summary of level and depth counts for active GO Terms."""
# Count level(shortest path to root) and depth(longest path to root)
# values for all unique GO Terms.
max_val = max(max(dep for dep in cnts['depth']),
max(lev fo... | 0.004016 |
def get_fields(model, fields, meta=None):
"""
Acording to model and fields to get fields list
Each field element is a two elements tuple, just like:
(name, field_obj)
"""
model = get_model(model)
if fields is not None:
f = fields
elif meta and hasattr(model, meta):
... | 0.004717 |
def get_nnsoap(obj, first_shell, alphas, betas, rcut=6, nmax=10, lmax=9, all_atomtypes=[]):
"""Takes cluster structure and nearest neighbour information of a datapoint,
Returns concatenated soap vectors for each nearest
neighbour (up to 3). Top, bridge, hollow fill the initial
zero soap vector from left... | 0.011364 |
def _decrypt_data(self, data, options):
'''Decrypt data'''
if options['encryption_algorithm_id'] not in self.encryption_algorithms:
raise Exception('Unknown encryption algorithm id: %d'
% options['encryption_algorithm_id'])
encryption_algorithm = \
... | 0.004762 |
def append_lookup_key(model, lookup_key):
"Transform spanned__lookup__key into all possible translation versions, on all levels"
pieces = lookup_key.split('__', 1)
fields = append_translated(model, (pieces[0],))
if len(pieces) > 1:
# Check if we are doing a lookup to a related trans model
... | 0.004065 |
def can_access_api(self):
"""
:return: True when we can access the REST API
"""
try:
version_dict = self.get_version()
except Exception, e:
msg = 'An exception was raised when connecting to REST API: "%s"'
raise APIException(msg % e)
el... | 0.002375 |
def gen_file_path(self, name):
"""
Returns full path to generated files. Checks to see if directory
exists where generated files are stored and creates one otherwise.
"""
relative_path = self.convert_path(name)
file_path = self.get_path("%s.ipynb"%relative_path)
... | 0.01722 |
def split_merged_reads(outhandles, input_derep):
"""
Takes merged/concat derep file from vsearch derep and split it back into
separate R1 and R2 parts.
- sample_fastq: a list of the two file paths to write out to.
- input_reads: the path to the input merged reads
"""
handle1, handle2 = ou... | 0.008616 |
def set_executing(on: bool):
"""
Toggle whether or not the current thread is executing a step file. This
will only apply when the current thread is a CauldronThread. This function
has no effect when run on a Main thread.
:param on:
Whether or not the thread should be annotated as executing ... | 0.002105 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.