text stringlengths 78 104k | score float64 0 0.18 |
|---|---|
def _firefox_profile():
"""Configure the Firefox profile, respecting FIREFOX_PROFILE_PATH if set"""
profile_dir = os.environ.get(FIREFOX_PROFILE_ENV_VAR)
if profile_dir:
LOGGER.info(u"Using firefox profile: %s", profile_dir)
try:
firefox_profile = webdriver.FirefoxProfile(profil... | 0.005705 |
def put_warmer(self, doc_types=None, indices=None, name=None, warmer=None, querystring_args=None):
"""
Put new warmer into index (or type)
:param doc_types: list of document types
:param warmer: anything with ``serialize`` method or a dictionary
:param name: warmer name
... | 0.006881 |
def is_ancestor_of_log(self, id_, log_id):
"""Tests if an ``Id`` is an ancestor of a log.
arg: id (osid.id.Id): an ``Id``
arg: log_id (osid.id.Id): the ``Id`` of a log
return: (boolean) - ``true`` if the ``id`` is an ancestor of the
``log_id,`` ``false`` otherwise... | 0.002918 |
def status_for_order(self, order_id, stock):
"""Status For An Existing Order
https://starfighter.readme.io/docs/status-for-an-existing-order
"""
url_fragment = 'venues/{venue}/stocks/{stock}/orders/{order_id}'.format(
venue=self.venue,
stock=stock,
or... | 0.006803 |
def validate_address(self, address_deets):
"""Validates a customer address and returns back a collection of address matches."""
request = self._post('addresses/validate', address_deets)
return self.responder(request) | 0.0125 |
def _attributes(note, data):
"""
attribute of the note
:param note: note object
:param data:
:return:
"""
# attribute of the note: the link to the website
note_attribute = EvernoteMgr.set_note_attribute(data)
if note_attribute:
note.att... | 0.005495 |
def setup(self, # pylint: disable=arguments-differ
endpoint=None,
username=None,
password=None,
incident_id=None,
sketch_id=None):
"""Setup a connection to a Timesketch server and create a sketch if needed.
Args:
endpoint: str, Timesketch endpo... | 0.009021 |
def get_counted_number(context, config, variables, **kw):
"""Compute the number for the sequence type "Counter"
"""
# This "context" is defined by the user in the Setup and can be actually
# anything. However, we assume it is something like "sample" or similar
ctx = config.get("context")
# get ... | 0.001063 |
def artifact_bundles(self):
"""
Gets the Artifact Bundles API client.
Returns:
ArtifactBundles:
"""
if not self.__artifact_bundles:
self.__artifact_bundles = ArtifactBundles(self.__connection)
return self.__artifact_bundles | 0.006757 |
def organization_requests(self, id, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/requests#list-requests"
api_path = "/api/v2/organizations/{id}/requests.json"
api_path = api_path.format(id=id)
return self.call(api_path, **kwargs) | 0.01083 |
def encode_callbacks(callbacks):
"""Encode callbacks to as a dict suitable for JSON encoding."""
from furious.async import Async
if not callbacks:
return
encoded_callbacks = {}
for event, callback in callbacks.iteritems():
if callable(callback):
callback, _ = get_functi... | 0.003929 |
def create_subject_access_review(self, body, **kwargs):
"""
create a SubjectAccessReview
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.create_subject_access_review(body, async_req=True)
... | 0.003997 |
def user_loc_value_to_class(axis_tag, user_loc):
"""Return the OS/2 weight or width class that is closest to the provided
user location. For weight the user location is between 0 and 1000 and for
width it is a percentage.
>>> user_loc_value_to_class('wght', 310)
310
>>> user_loc_value_to_class(... | 0.001672 |
def full_newton(s, nodes1, t, nodes2):
r"""Perform a Newton iteration until convergence to a solution.
This assumes :math:`s` and :math:`t` are sufficiently close to an
intersection. It **does not** govern the maximum distance away
that the solution can lie, though the subdivided intervals that contain... | 0.000503 |
def init(opts):
'''
Open the connection to the Arista switch over the eAPI.
'''
proxy_dict = opts.get('proxy', {})
conn_args = proxy_dict.copy()
conn_args.pop('proxytype', None)
opts['multiprocessing'] = conn_args.get('multiprocessing', True)
# This is not a SSH-based proxy, so it should... | 0.001271 |
def process_loaded_configs(self, values):
"""Takes the loaded config values (from YAML files) and performs the
following clean up steps:
1. remove all value keys that are not uppercase
2. resolve any keys with missing values
Note: resolving missing values does not fail ... | 0.006498 |
def _on_library_name_changed(self, renderer, path, new_library_name):
"""Callback handling a change of a library name
:param Gtk.CellRenderer renderer: Cell renderer showing the library name
:param path: Path of library within the list store
:param str new_library_name: New library name... | 0.007937 |
def _make_cssmin(python_only=False):
"""
Generate CSS minifier.
:Parameters:
`python_only` : ``bool``
Use only the python variant. If true, the c extension is not even
tried to be loaded.
:Return: Minifier
:Rtype: ``callable``
"""
# pylint: disable = W0612
# ("unu... | 0.00283 |
def dump_wcxf(self, C_out, scale_out, fmt='yaml', stream=None, **kwargs):
"""Return a string representation of the Wilson coefficients `C_out`
in WCxf format. If `stream` is specified, export it to a file.
`fmt` defaults to `yaml`, but can also be `json`.
Note that the Wilson coefficien... | 0.003436 |
def set_sampling_strategy(self, sensor_name, strategy_and_params):
"""Set the sampling strategy for the named sensor
Parameters
----------
sensor_name : str
Name of the sensor
strategy_and_params : seq of str or str
As tuple contains (<strat_name>, [<str... | 0.001808 |
def tobytes(self, prim, skipprepack = False):
'''
Compatible to Parser.tobytes()
'''
stream = BytesIO()
self.tostream(prim, stream, skipprepack=skipprepack)
return stream.getvalue() | 0.017467 |
def create(cls, config_file=None, logical_volume = None, cfg = None, **params):
"""
Create a new instance based on the specified configuration file or the specified
configuration and the passed in parameters.
If the config_file argument is not None, the configuration is read fro... | 0.011339 |
def all(self, endpoint, *args, **kwargs):
"""Retrieve all the data of a paginated endpoint, using GET.
:returns: The endpoint unpaginated data
:rtype: dict
"""
# 1. Initialize the pagination parameters.
kwargs.setdefault('params', {})['offset'] = 0
kwargs.setdefau... | 0.001761 |
def get_process(self, dwProcessId):
"""
@type dwProcessId: int
@param dwProcessId: Global ID of the process to look for.
@rtype: L{Process}
@return: Process object with the given global ID.
"""
self.__initialize_snapshot()
if dwProcessId not in self.__p... | 0.004292 |
def scan_code_for_ctypes(co, instrs, i):
"""Detects ctypes dependencies, using reasonable heuristics that should
cover most common ctypes usages; returns a tuple of two lists, one
containing names of binaries detected as dependencies, the other containing
warnings.
"""
def _libFromConst(i):
... | 0.001046 |
def get_record(cls, id_, with_deleted=False):
"""Retrieve the record by id.
Raise a database exception if the record does not exist.
:param id_: record ID.
:param with_deleted: If `True` then it includes deleted records.
:returns: The :class:`Record` instance.
"""
... | 0.003378 |
def isRef(self, elem, attr):
"""Determine whether an attribute is of type Ref. In case we
have DTD(s) then this is simple, otherwise we use an
heuristic: name Ref (upper or lowercase). """
if elem is None: elem__o = None
else: elem__o = elem._o
if attr is None: attr_... | 0.013605 |
def send_unsent(self):
"""
Emails that were not being able to send will be stored in :attr:`self.unsent`.
Use this function to attempt to send these again
"""
for i in range(len(self.unsent)):
recipients, msg_string = self.unsent.pop(i)
self._attempt_send(... | 0.008746 |
def updateD_H(self, x):
"""
Compute Hessian for update of D
See [2] for derivation of Hessian
"""
self.precompute(x)
H = zeros((len(x), len(x)))
Ai = zeros(self.A.shape[0])
Aj = zeros(Ai.shape)
for i in range(len(x)):
Ai = self.A[:, i]... | 0.003125 |
def threshold(self, value, inclusive=False):
"""Return True if > than treshold value (or >= threshold value if
inclusive=True).
"""
if inclusive:
def function(x, y):
return True if x >= y else False
else:
def function(x, y):
... | 0.005 |
def validate_gaslimit(self, header: BlockHeader) -> None:
"""
Validate the gas limit on the given header.
"""
parent_header = self.get_block_header_by_hash(header.parent_hash)
low_bound, high_bound = compute_gas_limit_bounds(parent_header)
if header.gas_limit < low_bound:... | 0.005175 |
def ParseArguments(self):
"""Parses the command line arguments.
Returns:
bool: True if the arguments were successfully parsed.
"""
loggers.ConfigureLogging()
argument_parser = argparse.ArgumentParser(
description=self.DESCRIPTION, epilog=self.EPILOG, add_help=False,
formatter... | 0.002902 |
def ProcessContent(self, strip_expansion=False):
"""Processes the file contents."""
self._ParseFile()
if strip_expansion:
# Without a collection the expansions become blank, removing them.
collection = None
else:
collection = MacroCollection()
for section in self._sections:
s... | 0.012632 |
def target_outdated(target,deps):
"""Determine whether a target is out of date.
target_outdated(target,deps) -> 1/0
deps: list of filenames which MUST exist.
target: single filename which may or may not exist.
If target doesn't exist or is older than any file listed in deps, return
true, othe... | 0.005714 |
def external_links(self) -> List['ExternalLink']:
"""Return a list of found external link objects.
Note:
Templates adjacent to external links are considered part of the
link. In reality, this depends on the contents of the template:
>>> WikiText(
... ... | 0.001003 |
def account_get(self, key):
"""
Get account number for the **public key**
:param key: Public key to get account for
:type key: str
:raises: :py:exc:`nano.rpc.RPCException`
>>> rpc.account_get(
... key="3068BB1CA04525BB0E416C485FE6A67FD52540227D267CC8B6E8DA95... | 0.005017 |
def reset_small(self, eq):
"""Reset numbers smaller than 1e-12 in f and g equations"""
assert eq in ('f', 'g')
for idx, var in enumerate(self.__dict__[eq]):
if abs(var) <= 1e-12:
self.__dict__[eq][idx] = 0 | 0.007782 |
def _batch_norm_op(self, input_batch, mean, variance, use_batch_stats,
stat_dtype):
"""Creates a batch normalization op.
It uses the tf.nn.batch_normalization op by default and the
tf.nn.fused_batch_norm op to support fused batch normalization.
Args:
input_batch: A input Ten... | 0.005618 |
def create_panel_of_normals(items, group_id, work_dir):
"""Create a panel of normals from one or more background read counts.
"""
out_file = os.path.join(work_dir, "%s-%s-pon.hdf5" % (dd.get_sample_name(items[0]), group_id))
if not utils.file_exists(out_file):
with file_transaction(items[0], out... | 0.005242 |
def packages(ciprcfg, env, opts, console):
"""
List installed packages for this project
"""
for name, source in ciprcfg.packages.items():
console.normal('- %s' % name)
if opts.long_details:
console.normal(' - directory: %s' % path.join(env.package_dir, name))
co... | 0.005571 |
async def read_loop(self):
"""
Infinite loop that reads messages off of the socket while not closed.
When a message is received its corresponding pending Future is set
to have the message as its result.
This is never used directly and is fired as a separate callback on the
... | 0.001616 |
def getdict(self, crop=True):
"""Get final dictionary. If ``crop`` is ``True``, apply
:func:`.cnvrep.bcrop` to returned array.
"""
D = self.Y
if crop:
D = cr.bcrop(D, self.cri.dsz, self.cri.dimN)
return D | 0.007547 |
def ssh(lancet, print_cmd, environment):
"""
SSH into the given environment, based on the dploi configuration.
"""
namespace = {}
with open(lancet.config.get('dploi', 'deployment_spec')) as fh:
code = compile(fh.read(), 'deployment.py', 'exec')
exec(code, {}, namespace)
config ... | 0.001684 |
def find_matching(root_path,
relative_paths_to_search,
file_pattern):
"""
Given an absolute `root_path`, a list of relative paths to that
absolute root path (`relative_paths_to_search`), and a `file_pattern`
like '*.sql', returns information about the files. For examp... | 0.000621 |
def init_db(uri, base, **kwargs):
"""Create engine and tables
:param uri: db uri
:param base: declarative base
:returns: an engine
"""
engine = create_engine(uri, **kwargs)
base.metadata.create_all(engine)
return engine | 0.003984 |
def reverse_action(self, url_name, *args, **kwargs):
"""
Extended DRF with fallback to requested namespace if request.version is missing
"""
if self.request and not self.request.version:
return reverse(self.get_url_name(url_name), *args, **kwargs)
return super().reve... | 0.008403 |
def create_proxy_model(name, model_mixins, base_model, attrs=None, module=None):
"""
Create a Django Proxy Model on the fly, to be used by any Cascade Plugin.
"""
from django.apps import apps
class Meta:
proxy = True
app_label = 'cmsplugin_cascade'
name = str(name + 'Model')
... | 0.003221 |
def distance_to_point(self, point):
"""
Computes the absolute distance from the plane to the point
:param point: Point for which distance is computed
:return: Distance between the plane and the point
"""
return np.abs(np.dot(self.normal_vector, point) + self.d) | 0.006472 |
def columns_used(self):
"""
Returns all the columns used in this model for filtering
and in the model expression.
"""
return list(tz.unique(tz.concatv(
util.columns_in_filters(self.fit_filters),
util.columns_in_filters(self.predict_filters),
u... | 0.005435 |
def _to_DOM(self):
"""
Dumps object data to a fully traversable DOM representation of the
object.
:returns: a ``xml.etree.Element`` object
"""
root_node = ET.Element("observation")
reception_time_node = ET.SubElement(root_node, "reception_time")
receptio... | 0.004082 |
def execute_function(function_request):
"""
Given a request created by
`beanstalk_dispatch.common.create_request_body`, executes the
request. This function is to be run on a beanstalk worker.
"""
dispatch_table = getattr(settings, 'BEANSTALK_DISPATCH_TABLE', None)
if dispatch_table is None... | 0.000652 |
def strip_vht(self, idx):
"""strip(12 byte) radiotap.vht
:idx: int
:return: int
idx
:return: collections.namedtuple
"""
vht = collections.namedtuple(
'vht', ['known_bits', 'have_stbc', 'have_txop_ps', 'have_gi',
'have_sgi_nsym_d... | 0.002752 |
def _prm_select_shared_pandas_data(self, pd_node, full_name, **kwargs):
"""Reads a DataFrame from dis.
:param pd_node:
hdf5 node storing the pandas DataFrame
:param full_name:
Full name of the parameter or result whose data is to be loaded
:param kwargs:
... | 0.005979 |
def canonical_request(self, method, path, content, timestamp):
"""Return the canonical request string."""
request = collections.OrderedDict([
('Method', method.upper()),
('Hashed Path', path),
('X-Ops-Content-Hash', content),
('X-Ops-Timestamp', timestamp)... | 0.004107 |
def _format_heatmap(self, filename, heatmap, execution_count):
"""Formats heatmap for UI."""
with open(filename) as src_file:
file_source = src_file.read().split('\n')
skip_map = self._calc_skips(heatmap, len(file_source))
run_time = sum(time for time in heatmap.values())... | 0.003623 |
def mongo_getattr(rec, key):
"""
Get value from dict using MongoDB dot-separated path semantics.
For example:
>>> assert mongo_getattr({'a': {'b': 1}, 'x': 2}, 'a.b') == 1
>>> assert mongo_getattr({'a': {'b': 1}, 'x': 2}, 'x') == 2
>>> assert mongo_getattr({'a': {'b': 1}, 'x': 2}, 'a.b.c') is N... | 0.002674 |
def check_file_version(notebook, source_path, outputs_path):
"""Raise if file version in source file would override outputs"""
if not insert_or_test_version_number():
return
_, ext = os.path.splitext(source_path)
if ext.endswith('.ipynb'):
return
version = notebook.metadata.get('jup... | 0.002939 |
def createSomeItems(store, itemType, values, counter):
"""
Create some instances of a particular type in a store.
"""
for i in counter:
itemType(store=store, **values) | 0.005236 |
def render(self, request, template, context):
"""
Returns a response. By default, this will contain the rendered PDF, but
if both ``allow_force_html`` is ``True`` and the querystring
``html=true`` was set it will return a plain HTML.
"""
if self.allow_force_html and self.... | 0.002174 |
def _ttm_me_compute(self, V, edims, sdims, transp):
"""
Assume Y = T x_i V_i for i = 1...n can fit into memory
"""
shapeY = np.copy(self.shape)
# Determine size of Y
for n in np.union1d(edims, sdims):
shapeY[n] = V[n].shape[1] if transp else V[n].shape[0]
... | 0.004983 |
def van_dec_2d(x, skip_connections, output_shape, first_depth, hparams=None):
"""The VAN decoder.
Args:
x: The analogy information to decode.
skip_connections: The encoder layers which can be used as skip connections.
output_shape: The shape of the desired output image.
first_depth: The depth of th... | 0.002408 |
def returner(load):
'''
Return data to the local job cache
'''
serial = salt.payload.Serial(__opts__)
# if a minion is returning a standalone job, get a jobid
if load['jid'] == 'req':
load['jid'] = prep_jid(nocache=load.get('nocache', False))
jid_dir = salt.utils.jid.jid_dir(load['... | 0.001675 |
def move(self, fromp, to):
''' Usage: move/mv/rename/ren <from> <to> - \
move a file / dir remotely at Baidu Yun
from - source path (file / dir)
to - destination path (file / dir)
'''
frompp = get_pcs_path(fromp)
top = get_pcs_path(to)
pars = {
'method' : 'move',
'from' : frompp,
'to' : top }
... | 0.040909 |
def rgb2term(r: int, g: int, b: int) -> str:
""" Convert an rgb value to a terminal code. """
return hex2term_map[rgb2termhex(r, g, b)] | 0.006993 |
def show(self, wait = False):
"""Show the window."""
self.tk.deiconify()
self._visible = True
self._modal = wait
if self._modal:
self.tk.grab_set() | 0.020101 |
def clear_transaction(self):
"""
Clear the currently active transaction (if exists). If the
transaction stack is not empty, then a new pipeline will
be initialized.
:returns: No return value.
:raises: ``ValueError`` if no transaction is active.
"""
with s... | 0.003876 |
def reset_field_value(self, name):
"""
Resets value of a field
"""
name = self.get_real_name(name)
if name and self._can_write_field(name):
if name in self.__modified_data__:
del self.__modified_data__[name]
if name in self.__deleted_fiel... | 0.003766 |
def bootstrap(self, config):
""" Initialize a new node from scratch and start it. """
pg_hba = config.get('pg_hba', [])
method = config.get('method') or 'initdb'
self._running_custom_bootstrap = method != 'initdb' and method in config and 'command' in config[method]
if self._runn... | 0.006079 |
def user_warning(channel, user, warnings, max_warnings):
"""
Creates an embed UI containing an user warning message
Args:
channel (discord.Channel): The Discord channel to bind the embed to
user (discord.User): The user to warn
warnings (str): The warnings for the user
max_w... | 0.001764 |
def copy_fs(
src_fs, # type: Union[FS, Text]
dst_fs, # type: Union[FS, Text]
walker=None, # type: Optional[Walker]
on_copy=None, # type: Optional[_OnCopy]
workers=0, # type: int
):
# type: (...) -> None
"""Copy the contents of one filesystem to another.
Arguments:
src_fs (F... | 0.002809 |
def _gcs_get_keys(bucket, pattern):
""" Get names of all Google Cloud Storage keys in a specified bucket that match a pattern. """
return [obj for obj in list(bucket.objects()) if fnmatch.fnmatch(obj.metadata.name, pattern)] | 0.02193 |
def numbers(self):
"""
Access the numbers
:returns: twilio.rest.pricing.v1.voice.number.NumberList
:rtype: twilio.rest.pricing.v1.voice.number.NumberList
"""
if self._numbers is None:
self._numbers = NumberList(self._version, )
return self._numbers | 0.006309 |
def _tobytes(self):
"""Serializes the write buffer into a single string (bytes).
Returns:
a string (bytes) object.
"""
if not self._has_view:
# fast path optimization
if len(self._deque) == 0:
return b""
elif len(self._dequ... | 0.003279 |
def util_pattern_space(time_series, lag, dim):
"""Create a set of sequences with given lag and dimension
Args:
time_series: Vector or string of the sample data
lag: Lag between beginning of sequences
dim: Dimension (number of patterns)
Returns:
2D array of vectors
"""
... | 0.002681 |
def _STM(cpu, insn_id, base, regs):
"""
STM (Store Multiple) stores a non-empty subset (or possibly all) of the general-purpose registers to
sequential memory locations.
:param int insn_id: should be one of ARM_INS_STM, ARM_INS_STMIB, ARM_INS_STMDA, ARM_INS_STMDB
:param Armv7Ope... | 0.00504 |
def parse_perfmetric(metric):
"""Return (sympy expressions, event names and symbols dict) from performance metric str."""
# Find all perfs counter references
perfcounters = re.findall(r'[A-Z0-9_]+:[A-Z0-9\[\]|\-]+(?::[A-Za-z0-9\-_=]+)*', metric)
# Build a temporary metric, with parser-f... | 0.007835 |
def detect_sense(curve, tol):
""" Detects the sense, i.e. clockwise or counter-clockwise, of the curve.
:param curve: 2-dimensional trim curve
:type curve: abstract.Curve
:param tol: tolerance value
:type tol: float
:return: True if detection is successful, False otherwise
:rtype: bool
... | 0.001466 |
def _ModifiedDecoder(wire_type, decode_value, modify_value):
"""Like SimpleDecoder but additionally invokes modify_value on every value
before storing it. Usually modify_value is ZigZagDecode.
"""
# Reusing _SimpleDecoder is slightly slower than copying a bunch of code, but
# not enough to make a significan... | 0.011834 |
def join2(ol,*sps):
'''
from elist.elist import *
ol = [1,2,3,4]
join2(ol,"-","+","*")
'''
rslt =""
length = ol.__len__()
for i in range(0,length-1):
rslt = rslt + str(ol[i]) + sps[i]
rslt = rslt + str(ol[length - 1])
return(rslt) | 0.013793 |
def from_Composition(composition):
"""Return the LilyPond equivalent of a Composition in a string."""
# warning Throw exception
if not hasattr(composition, 'tracks'):
return False
result = '\\header { title = "%s" composer = "%s" opus = "%s" } '\
% (composition.title, composition.author... | 0.004494 |
def xmlrpc_reschedule(self):
"""
Reschedule all running tasks.
"""
if not len(self.scheduled_tasks) == 0:
self.reschedule = list(self.scheduled_tasks.items())
self.scheduled_tasks = {}
return True | 0.011494 |
def DFS_Tree(G):
"""
Return an oriented tree constructed from dfs.
"""
if not G.vertices:
raise GraphInsertError("This graph have no vertices.")
pred = {}
T = digraph.DiGraph()
vertex_data = DFS(G)
for vertex in vertex_data:
pred[vertex] = vertex_data[vertex][0]... | 0.00303 |
def diff_aff(self):
"""Symmetric diffusion affinity matrix
Return or calculate the symmetric diffusion affinity matrix
.. math:: A(x,y) = K(x,y) (d(x) d(y))^{-1/2}
where :math:`d` is the degrees (row sums of the kernel.)
Returns
-------
diff_aff : array-like,... | 0.002294 |
def send(self, targetPath, parent, diff, showProgress=True, allowDryRun=True):
""" Return context manager for stream to send a (incremental) snapshot. """
if parent is not None:
cmd = ["btrfs", "send", "-p", parent, targetPath]
else:
cmd = ["btrfs", "send", targetPath]
... | 0.006126 |
def _set_attribute(self, obj, attr, value):
"""Set an attribute of an object to a specific value.
Return True if the attribute was changed and False otherwise.
"""
field = obj._meta.get_field(attr)
if field.max_length is not None and len(value) > field.max_length:
cl... | 0.002837 |
def items(self):
"""
Implements the dict.items() method
"""
self.sync()
for k, v in self.db.items():
try:
yield self.key_conv['from'](k), v
except KeyError:
yield k, v | 0.007605 |
def ask(self, question, default=False):
""" Ask a y/n question to the user.
"""
choices = '[%s/%s]' % ('Y' if default else 'y', 'n' if default else 'N')
while True:
response = raw_input('%s %s' % (question, choices)).strip()
if not response:
return... | 0.006565 |
def store(self, report, test_id):
'''
:param report: the report to store
:param test_id: the id of the test reported
:return: report id
'''
report_d = report.to_dict()
content = self._serialize_dict(report_d)
report_id = self.insert(
['test_id'... | 0.00432 |
def train(self, X_feat, X_seq, y, id_vec=None, n_folds=10, use_stored_folds=None, n_cores=1,
train_global_model=False):
"""Train the Concise model in cross-validation.
Args:
X_feat: See :py:func:`concise.Concise.train`
X_seq: See :py:func:`concise.Concise.train`
... | 0.003914 |
def OnInsertTabs(self, event):
"""Insert one table into grid"""
with undo.group(_("Insert table")):
self.grid.actions.insert_tabs(self.grid.current_table - 1, 1)
self.grid.GetTable().ResetView()
self.grid.actions.zoom()
event.Skip() | 0.006969 |
def bundle_apps(self, bundle_name, bundle_apps):
"""Bundle multiple Job or Playbook Apps (.tcx files) into a single zip file.
Args:
bundle_name (str): The output name of the bundle zip file.
bundle_apps (list): A list of Apps to include in the bundle.
"""
bundle_... | 0.00547 |
def itertable(table):
"""Auxiliary function for iterating over a data table."""
for item in table:
res = {
k.lower(): nfd(v) if isinstance(v, text_type) else v for k, v in item.items()}
for extra in res.pop('extra', []):
k, _, v = extra.partition(':')
res[k.st... | 0.005618 |
def turningpoint(self):
"""Turning point (index and value tuple) in the recession part of the
MA approximation of the instantaneous unit hydrograph."""
coefs = self.coefs
old_dc = coefs[1]-coefs[0]
for idx in range(self.order-2):
new_dc = coefs[idx+2]-coefs[idx+1]
... | 0.003165 |
def configure(self, args):
"""Configure the set of plugins with the given args.
After configuration, disabled plugins are removed from the plugins list.
"""
for plug in self._plugins:
plug_name = self.plugin_name(plug)
plug.enabled = getattr(args, "plugin_%s" % p... | 0.005587 |
def num_employers(self, num_employers):
'''Sets the number of employer bees; at least two are required
Args:
num_employers (int): number of employer bees
'''
if num_employers < 2:
self._logger.log(
'warn',
'Two employers are neede... | 0.002976 |
def create_payload(self):
"""Reset ``errata_id`` from DB ID to ``errata_id``."""
payload = super(ContentViewFilterRule, self).create_payload()
if 'errata_id' in payload:
if not hasattr(self.errata, 'errata_id'):
self.errata = self.errata.read()
payload['er... | 0.005319 |
def get_serialized_info(self):
"""See base class for details."""
# Flatten tf-example features dict
# Use NonMutableDict to ensure there is no collision between features keys
features_dict = utils.NonMutableDict()
for feature_key, feature in self._feature_dict.items():
serialized_info = featur... | 0.007049 |
def uninstall_logger(logger=None, module=None):
"""
Uninstalls given logger in given module or default logger in caller introspected module.
:param logger: Logger to uninstall.
:type logger: Logger
:param module: Module.
:type module: ModuleType
:return: Definition success.
:rtype: bool... | 0.00561 |
def add_tip(self, tip_length) -> None:
"""
Add a tip to the pipette for position tracking and validation
(effectively updates the pipette's critical point)
:param tip_length: a positive, non-zero float representing the distance
in Z from the end of the pipette nozzle to the ... | 0.003711 |
def _onShortcutMoveLine(self, down):
"""Move line up or down
Actually, not a selected text, but next or previous block is moved
TODO keep bookmarks when moving
"""
startBlock, endBlock = self._selectedBlocks()
startBlockNumber = startBlock.blockNumber()
endBlockN... | 0.001253 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.