text stringlengths 78 104k | score float64 0 0.18 |
|---|---|
def parse_result(result):
"""parse_result(json result) -- print the web query according to the type
of result from duckduckgo.
"""
if(result['Type'] == 'D'):
print """There is more than one answer for this. Try making your query\
more specific. For example, if you want to learn about apple the company\
and ... | 0.035451 |
def delete_file(db, user_id, api_path):
"""
Delete a file.
TODO: Consider making this a soft delete.
"""
result = db.execute(
files.delete().where(
_file_where(user_id, api_path)
)
)
rowcount = result.rowcount
if not rowcount:
raise NoSuchFile(api_pa... | 0.002907 |
def show(args):
"""Convert and print JSON.
Argument:
args: arguments object
"""
domain = check_infile(args.infile)
action = True
try:
print(json.dumps(set_json(domain, action, filename=args.infile),
sort_keys=True, indent=2))
except UnicodeDecodeErr... | 0.002217 |
def search(self, id_egroup):
"""Search Group Equipament from by the identifier.
:param id_egroup: Identifier of the Group Equipament. Integer value and greater than zero.
:return: Following dictionary:
::
{‘group_equipament’: {‘id’: < id_egrupo >,
‘nome’: < n... | 0.005165 |
def get_url_endpoint(self):
"""
Returns the Hypermap endpoint for a layer.
This endpoint will be the WMTS MapProxy endpoint, only for WM we use the original endpoint.
"""
endpoint = self.url
if self.type not in ('Hypermap:WorldMap',):
endpoint = 'registry/%s/l... | 0.008602 |
def add_monitor(self, pattern, callback, limit=80):
"""
Calls the given function whenever the given pattern matches the
buffer.
Arguments passed to the callback are the index of the match, and
the match object of the regular expression.
:type pattern: str|re.RegexObjec... | 0.002759 |
def list_snapshots(kwargs=None, call=None):
'''
List snapshots either for all VMs and templates or for a specific VM/template
in this VMware environment
To list snapshots for all VMs and templates:
CLI Example:
.. code-block:: bash
salt-cloud -f list_snapshots my-vmware-config
T... | 0.003928 |
def encoded_class(block, offset=0):
"""
predicate indicating whether a block of memory includes a magic number
"""
if not block:
raise InvalidFileFormatNull
for key in __magicmap__:
if block.find(key, offset, offset + len(key)) > -1:
retur... | 0.005376 |
def create_message(self):
"""Create and send a unique message for this service."""
self.counter += 1
self._transport.send(
"transient.transaction",
"TXMessage #%d\n++++++++Produced@ %f"
% (self.counter, (time.time() % 1000) * 1000),
)
self.log.... | 0.005556 |
def rbeta(alpha, beta, size=None):
"""
Random beta variates.
"""
from scipy.stats.distributions import beta as sbeta
return sbeta.ppf(np.random.random(size), alpha, beta) | 0.005263 |
def _figure_data(self, plot, fmt='html', doc=None, as_script=False, **kwargs):
"""
Given a plot instance, an output format and an optional bokeh
document, return the corresponding data. If as_script is True,
the content will be split in an HTML and a JS component.
"""
mod... | 0.001566 |
def is_sequence_match(pattern: list, instruction_list: list, index: int) -> bool:
"""Checks if the instructions starting at index follow a pattern.
:param pattern: List of lists describing a pattern, e.g. [["PUSH1", "PUSH2"], ["EQ"]] where ["PUSH1", "EQ"] satisfies pattern
:param instruction_list: List of ... | 0.004615 |
def make_sudouser(c):
"""
Create a passworded sudo-capable user.
Used by other tasks to execute the test suite so sudo tests work.
"""
user = c.travis.sudo.user
password = c.travis.sudo.password
# --create-home because we need a place to put conf files, keys etc
# --groups travis becaus... | 0.000861 |
def command_help_long(self):
"""
Return command help for use in global parser usage string
@TODO update to support self.current_indent from formatter
"""
indent = " " * 2 # replace with current_indent
help = "Command must be one of:\n"
for action_name in self.parser.valid_commands... | 0.010929 |
def _local_sym_to_py_ast(
ctx: GeneratorContext, node: Local, is_assigning: bool = False
) -> GeneratedPyAST:
"""Generate a Python AST node for accessing a locally defined Python variable."""
assert node.op == NodeOp.LOCAL
sym_entry = ctx.symbol_table.find_symbol(sym.symbol(node.name))
assert sym_e... | 0.003326 |
def five_crop(img, size):
"""Crop the given PIL Image into four corners and the central crop.
.. Note::
This transform returns a tuple of images and there may be a
mismatch in the number of inputs and targets your ``Dataset`` returns.
Args:
size (sequence or int): Desired output siz... | 0.003808 |
async def subscriptions(self, request):
"""
Handles requests for new subscription websockets.
Args:
request (aiohttp.Request): the incoming request
Returns:
aiohttp.web.WebSocketResponse: the websocket response, when the
resulting websocket is cl... | 0.002086 |
def handler(event, context):
"""
Historical {{cookiecutter.technology_name}} event collector.
This collector is responsible for processing Cloudwatch events and polling events.
"""
records = deserialize_records(event['Records'])
# Split records into two groups, update and delete.
# We don't... | 0.003974 |
def ping(self, endpoint=''):
"""
Ping the server to make sure that you can access the base URL.
Arguments:
None
Returns:
`boolean` Successful access of server (or status code)
"""
r = requests.get(self.url() + "/" + endpoint)
return r.stat... | 0.006116 |
def _parse_message(self, data):
"""
Parse the raw message from the device.
:param data: message data
:type data: string
:raises: :py:class:`~alarmdecoder.util.InvalidMessageError`
"""
try:
header, values = data.split(':')
address, channel... | 0.004802 |
def partition(f, xs):
"""
Works similar to filter, except it returns a two-item tuple where the
first item is the sequence of items that passed the filter and the
second is a sequence of items that didn't pass the filter
"""
t = type(xs)
true = filter(f, xs)
false = [x for x in x... | 0.00271 |
def ping(self, id):
""" Pings the motor with the specified id.
.. note:: The motor id should always be included in [0, 253]. 254 is used for broadcast.
"""
pp = self._protocol.DxlPingPacket(id)
try:
self._send_packet(pp, error_handler=None)
retu... | 0.007813 |
def update(self, ptime):
"""Update tween with the time since the last frame"""
delta = self.delta + ptime
total_duration = self.delay + self.duration
if delta > total_duration:
delta = total_duration
if delta < self.delay:
pass
elif delta == tota... | 0.002956 |
def lset(self, key, index, value):
"""Emulate lset."""
redis_list = self._get_list(key, 'LSET')
if redis_list is None:
raise ResponseError("no such key")
try:
redis_list[index] = self._encode(value)
except IndexError:
raise ResponseError("index... | 0.00597 |
def detect_file_triggers(trigger_patterns):
"""The existence of files matching configured globs will trigger a version bump"""
triggers = set()
for trigger, pattern in trigger_patterns.items():
matches = glob.glob(pattern)
if matches:
_LOG.debug("trigger: %s bump from %r\n\t%s", ... | 0.006342 |
def start(self):
"""
Starts this router.
At least the IOS image must be set before starting it.
"""
# trick: we must send sensors and power supplies info after starting the router
# otherwise they are not taken into account (Dynamips bug?)
yield from Router.start... | 0.005566 |
def list(self, limit=None, marker=None, name=None, visibility=None,
member_status=None, owner=None, tag=None, status=None,
size_min=None, size_max=None, sort_key=None, sort_dir=None,
return_raw=False):
"""
Returns a list of resource objects. Pagination is supported th... | 0.008649 |
def __field_to_subfields(self, field):
"""Fully describes data represented by field, including the nested case.
In the case that the field is not a message field, we have no fields nested
within a message definition, so we can simply return that field. However, in
the nested case, we can't simply descr... | 0.002247 |
def add(user_id, resource_policy, admin, inactive, rate_limit):
'''
Add a new keypair.
USER_ID: User ID of a new key pair.
RESOURCE_POLICY: resource policy for new key pair.
'''
try:
user_id = int(user_id)
except ValueError:
pass # string-based user ID for Backend.AI v1.4+... | 0.001047 |
def _wait_for_spot_instance(update_callback,
update_args=None,
update_kwargs=None,
timeout=10 * 60,
interval=30,
interval_multiplier=1,
max_failures=10)... | 0.000327 |
def _navigator_or_thunk(self, link):
'''Crafts a navigator or from a hal-json link dict.
If the link is relative, the returned navigator will have a
uri that relative to this navigator's uri.
If the link passed in is templated, a PartialNavigator will be
returned instead.
... | 0.002829 |
def solve(grid):
"""
solve a Sudoku grid inplace
"""
clauses = sudoku_clauses()
for i in range(1, 10):
for j in range(1, 10):
d = grid[i - 1][j - 1]
# For each digit already known, a clause (with one literal).
# Note:
# We could also remove... | 0.001088 |
def get_translation_dicts(self):
"""
Returns dictionaries for the translation of keysyms to strings and from
strings to keysyms.
"""
keysym_to_string_dict = {}
string_to_keysym_dict = {}
#XK loads latin1 and miscellany on its own; load latin2-4 and greek
X... | 0.00492 |
def _fused_batch_norm_op(self, input_batch, mean, variance, use_batch_stats):
"""Creates a fused batch normalization op."""
# Store the original shape of the mean and variance.
mean_shape = mean.get_shape()
variance_shape = variance.get_shape()
# The fused batch norm expects the mean, variance, gamm... | 0.00457 |
def k_fold_cross_validation(
fitters,
df,
duration_col,
event_col=None,
k=5,
evaluation_measure=concordance_index,
predictor="predict_expectation",
predictor_kwargs={},
fitter_kwargs={},
): # pylint: disable=dangerous-default-value,too-many-arguments,too-many-locals
"""
Perf... | 0.002644 |
def _defines(prefix, defs, suffix, env, c=_concat_ixes):
"""A wrapper around _concat_ixes that turns a list or string
into a list of C preprocessor command-line definitions.
"""
return c(prefix, env.subst_path(processDefines(defs)), suffix, env) | 0.003817 |
def outputtemplate(self, template_id):
"""Get an output template by ID"""
for profile in self.profiles:
for outputtemplate in profile.outputtemplates():
if outputtemplate.id == template_id:
return outputtemplate
return KeyError("Outputtemplate " + ... | 0.005764 |
def send_request(self, request):
"""
Create the transaction and fill it with the outgoing request.
:type request: Request
:param request: the request to send
:rtype : Transaction
:return: the created transaction
"""
logger.debug("send_request - " + str(re... | 0.00185 |
def build_info_string(info):
"""
Build a new vcf INFO string based on the information in the info_dict.
The info is a dictionary with vcf info keys as keys and lists of vcf values
as values. If there is no value False is value in info
Args:
info (dict): A dictionary with informatio... | 0.012676 |
def _render_ngram_row(self, ngram, ngram_group, row_template, labels):
"""Returns the HTML for an n-gram row."""
cell_data = {'ngram': ngram}
label_data = {}
for label in labels:
label_data[label] = []
work_grouped = ngram_group.groupby(constants.WORK_FIELDNAME)
... | 0.002022 |
def removeTab(self, index):
"""
Removes tab at index ``index``.
This method will emits tab_closed for the removed tab.
:param index: index of the tab to remove.
"""
widget = self.widget(index)
try:
self._widgets.remove(widget)
except ValueErr... | 0.003817 |
def _add_match(self, match):
"""
Add a match
:param match:
:type match: Match
"""
if self.__name_dict is not None:
if match.name:
_BaseMatches._base_add(self._name_dict[match.name], (match))
if self.__tag_dict is not None:
f... | 0.002309 |
def regions():
"""
Get all available regions for the SNS service.
:rtype: list
:return: A list of :class:`boto.regioninfo.RegionInfo` instances
"""
return [RegionInfo(name='us-east-1',
endpoint='sns.us-east-1.amazonaws.com',
connection_cls=SNSConnec... | 0.000765 |
def list_object_names(self, container, marker=None, limit=None, prefix=None,
delimiter=None, end_marker=None, full_listing=False):
"""
Return a list of then names of the objects in this container. You can
use the marker, end_marker, and limit params to handle pagination, and
... | 0.006803 |
def find_path(self, start, end, grid):
"""
find a path from start to end node on grid using the A* algorithm
:param start: start node
:param end: end node
:param grid: grid that stores all possible steps/tiles as 2D-list
:return:
"""
self.start_time = time... | 0.001461 |
def load_rdf(self,
uri_or_path=None,
data=None,
file_obj=None,
rdf_format="",
verbose=False,
hide_base_schemas=True,
hide_implicit_types=True,
hide_implicit_preds=True):
"""Loa... | 0.014514 |
def expected_bar_value(asset_id, date, colname):
"""
Check that the raw value for an asset/date/column triple is as
expected.
Used by tests to verify data written by a writer.
"""
from_asset = asset_id * 100000
from_colname = OHLCV.index(colname) * 1000
from_date = (date - PSEUDO_EPOCH)... | 0.002674 |
def set_precision(self, precision, persist=False):
"""
Set the precision of the sensor for the next readings.
If the ``persist`` argument is set to ``False`` this value
is "only" stored in the volatile SRAM, so it is reset when
the sensor gets power-cycled.
... | 0.002579 |
def copy_nrpe_checks(nrpe_files_dir=None):
"""
Copy the nrpe checks into place
"""
NAGIOS_PLUGINS = '/usr/local/lib/nagios/plugins'
if nrpe_files_dir is None:
# determine if "charmhelpers" is in CHARMDIR or CHARMDIR/hooks
for segment in ['.', 'hooks']:
nrpe_files_dir = o... | 0.001027 |
def rmlinematch(oldstr, infile, dryrun=False):
"""
Sed-like line deletion function based on given string..
Usage: pysed.rmlinematch(<Unwanted string>, <Text File>)
Example: pysed.rmlinematch('xyz', '/path/to/file.txt')
Example:
'DRYRUN': pysed.rmlinematch('xyz', '/path/to/file.txt', dryrun=True)... | 0.001854 |
def delete_entity(self, entity: int, immediate=False) -> None:
"""Delete an Entity from the World.
Delete an Entity and all of it's assigned Component instances from
the world. By default, Entity deletion is delayed until the next call
to *World.process*. You can request immediate delet... | 0.001838 |
def get_build_info_for_index(self, build_index=None):
"""Get additional information for the build at the given index."""
url = urljoin(self.base_url, self.build_list_regex)
self.logger.info('Retrieving list of builds from %s' % url)
parser = self._create_directory_parser(url)
pa... | 0.001381 |
def ping(self, data):
"""PING reply"""
self.bot.send('PONG :' + data)
self.pong(event='PING', data=data) | 0.015625 |
def prepare(args):
"""
%prog prepare mcscanfile cdsfile [options]
Pick sequences from cdsfile to form fasta files, according to multiple
alignment in the mcscanfile.
The fasta sequences can then be used to construct phylogenetic tree.
Use --addtandem=tandemfile to collapse tandems of anchors i... | 0.004622 |
def json(self, branch='master', filename=''):
"""Retrieve _filename_ from GitLab.
Args:
branch (str): Git Branch to find file.
filename (str): Name of file to retrieve.
Returns:
dict: Decoded JSON.
Raises:
SystemExit: Invalid JSON provid... | 0.002094 |
def device_function(self, var):
"""Choose a device for the input variable.
Args:
var: an Variable.
Returns:
The device for placing the var.
"""
if var.type not in ('Variable', 'VariableV2', 'VarHandleOp'):
tf.logging.debug('Place {} on last device: {}.'.format(
var.name... | 0.003672 |
def verify(full, dataset_uri):
"""Verify the integrity of a dataset.
"""
dataset = dtoolcore.DataSet.from_uri(dataset_uri)
all_okay = True
generated_manifest = dataset.generate_manifest()
generated_identifiers = set(generated_manifest["items"].keys())
manifest_identifiers = set(dataset.iden... | 0.000519 |
def raise_for_redefined_annotation(self, line: str, position: int, annotation: str) -> None:
"""Raise an exception if the given annotation is already defined.
:raises: RedefinedAnnotationError
"""
if self.disallow_redefinition and self.has_annotation(annotation):
raise Redef... | 0.01023 |
def run(provider,
job_resources,
job_params,
task_descriptors,
name=None,
dry_run=False,
command=None,
script=None,
user=None,
user_project=None,
wait=False,
retries=0,
poll_interval=10,
after=None,
skip=Fals... | 0.010061 |
def create_child(self, nurest_object, response_choice=None, async=False, callback=None, commit=True):
""" Add given nurest_object to the current object
For example, to add a child into a parent, you can call
parent.create_child(nurest_object=child)
Args:
nur... | 0.007106 |
def _update_lru_unlocked(self, new_context, spec, via):
"""
Update the LRU ("MRU"?) list associated with the connection described
by `kwargs`, destroying the most recently created context if the list
is full. Finally add `new_context` to the list.
"""
self._via_by_context... | 0.002342 |
def export_as_package(self, package_path, cv_source):
"""Exports the ensemble as a Python package and saves it to `package_path`.
Args:
package_path (str, unicode): Absolute/local path of place to save package in
cv_source (str, unicode): String containing actual code for base ... | 0.003894 |
def half_mag_amplitude_ratio2(self, mag, avg):
"""
Return ratio of amplitude of higher and lower magnitudes.
A ratio of amplitude of higher and lower magnitudes than average,
considering weights. This ratio, by definition, should be higher
for EB than for others.
Param... | 0.001838 |
def popen(fn, *args, **kwargs) -> subprocess.Popen:
"""
Please ensure you're not killing the process before it had started properly
:param fn:
:param args:
:param kwargs:
:return:
"""
args = popen_encode(fn, *args, **kwargs)
logging.getLogger(__name__).debug('Start %s', args)
... | 0.002786 |
def _handle_intermediate_metric_data(self, data):
"""Call assessor to process intermediate results
"""
if data['type'] != 'PERIODICAL':
return
if self.assessor is None:
return
trial_job_id = data['trial_job_id']
if trial_job_id in _ended_trials:
... | 0.003161 |
def where(self, other, cond, align=True, errors='raise',
try_cast=False, axis=0, transpose=False):
"""
evaluate the block; return result block(s) from the result
Parameters
----------
other : a ndarray/object
cond : the condition to respect
align :... | 0.000763 |
def execute(self, dataman):
'''
run the task
:type dataman: :class:`~kitty.data.data_manager.DataManager`
:param dataman: the executing data manager
'''
self._event.clear()
try:
self._result = self._task(dataman, *self._args)
#
# We ar... | 0.002886 |
def _build_context(self, request, enterprise_customer_uuid):
"""
Build common context parts used by different handlers in this view.
"""
enterprise_customer = EnterpriseCustomer.objects.get(uuid=enterprise_customer_uuid) # pylint: disable=no-member
context = {
self.... | 0.005464 |
def load_frame_building_sample_data():
"""
Sample data for the BuildingFrame object
:return:
"""
number_of_storeys = 6
interstorey_height = 3.4 # m
masses = 40.0e3 # kg
n_bays = 3
fb = models.BuildingFrame(number_of_storeys, n_bays)
fb.interstorey_heights = interstorey_height... | 0.001193 |
def set_yearly(self, interval, month, *, day_of_month=None,
days_of_week=None, index=None, **kwargs):
""" Set to repeat every month on specified days for every x no. of days
:param int interval: no. of days to repeat at
:param int month: month to repeat
:param int day... | 0.003681 |
def sections_list(self, cmd=None):
"""List of config sections used by a command.
Args:
cmd (str): command name, set to ``None`` or ``''`` for the bare
command.
Returns:
list of str: list of configuration sections used by that command.
"""
... | 0.003026 |
def draw_network(self, anim):
"""Draws solution's graph using networkx
Parameters
----------
AnimationDing0
AnimationDing0 object
"""
g = nx.Graph()
ntemp = []
nodes_pos = {}
demands = {}
demands_pos = {}
... | 0.002952 |
def list(cls, service, ops_filter, page_size=0):
"""Gets the list of operations for the specified filter.
Args:
service: Google Genomics API service object
ops_filter: string filter of operations to return
page_size: the number of operations to requested on each list operation to
the ... | 0.008651 |
def remove_isolated_nodes(graph):
"""Remove isolated nodes from the network, in place.
:param pybel.BELGraph graph: A BEL graph
"""
nodes = list(nx.isolates(graph))
graph.remove_nodes_from(nodes) | 0.00463 |
def get_accent_char(char):
"""
Get the accent of an single char, if any.
"""
index = utils.VOWELS.find(char.lower())
if (index != -1):
return 5 - index % 6
else:
return Accent.NONE | 0.004545 |
def load(self, file_key):
"""Load the data."""
var = self.sd.select(file_key)
data = xr.DataArray(from_sds(var, chunks=CHUNK_SIZE),
dims=['y', 'x']).astype(np.float32)
data = data.where(data != var._FillValue)
try:
data = data * np.float32(... | 0.004938 |
def _Rforce(self,R,z,phi=0.,t=0.):
"""
NAME:
Rforce
PURPOSE:
evaluate radial force K_R (R,z)
INPUT:
R - Cylindrical Galactocentric radius
z - vertical height
phi - azimuth
t - time
OUTPUT:
K_R (R,z)
... | 0.024424 |
def uri_to_regexp(self, uri):
"""converts uri w/ placeholder to regexp
'/cars/{carName}/drivers/{DriverName}'
-> '^/cars/.*/drivers/[^/]*$'
'/cars/{carName}/drivers/{DriverName}/drive'
-> '^/cars/.*/drivers/.*/drive$'
"""
def _convert(elem, is_last):
... | 0.004 |
def _ces_distance_simple(C1, C2):
"""Return the distance between two cause-effect structures.
Assumes the only difference between them is that some concepts have
disappeared.
"""
# Make C1 refer to the bigger CES.
if len(C2) > len(C1):
C1, C2 = C2, C1
destroyed = [c1 for c1 in C1 if... | 0.002169 |
def cleanup(self):
"""
This function is called when the service has finished running
regardless of intentionally or not.
"""
# if an event broker has been created for this service
if self.event_broker:
# stop the event broker
self.event_br... | 0.003484 |
def _arg_to_str(arg):
"""Convert argument to a string."""
if isinstance(arg, str):
return _sugar(repr(arg))
elif arg is Empty:
return '\u2014'
else:
return _sugar(str(arg)) | 0.004717 |
def get_histories_fix_params(self, exp, rep, tag, **kwargs):
""" this function uses get_history(..) but returns all histories where the
subexperiments match the additional kwargs arguments. if alpha=1.0,
beta = 0.01 is given, then only those experiment histories are returned,
... | 0.011236 |
def accept_vpc_peering_connection(name=None, conn_id=None, conn_name=None,
region=None, key=None, keyid=None, profile=None):
'''
Accept a VPC pending requested peering connection between two VPCs.
name
Name of this state
conn_id
The connection ID to ac... | 0.003495 |
def request(self, command=None):
"""Run CLI -show commands
*command* (show) command to run
"""
node = new_ele('get')
filter = sub_ele(node, 'filter')
block = sub_ele(filter, 'oper-data-format-cli-block')
sub_ele(block, 'cli-show').text = command
return s... | 0.005917 |
def start(self):
"""
Invokes the mod-host process.
mod-host requires JACK to be running.
mod-host does not startup JACK automatically, so you need to start it before running mod-host.
.. note::
This function is experimental. There is no guarantee that the process w... | 0.006243 |
def getskyimg(self,chip):
"""
Notes
=====
Return an array representing the sky image for the detector. The value
of the sky is what would actually be subtracted from the exposure by
the skysub step.
:units: electrons
"""
sci_chip = self._image[s... | 0.013793 |
def post_manager_view(model, view="PostManager", template_dir=None):
"""
:param PostStruct:
"""
PostStruct = model.PostStruct
Pylot.context_(COMPONENT_POST_MANAGER=True)
if not template_dir:
template_dir = "Pylot/PostManager"
template_page = template_dir + "/%s.html"
class Po... | 0.001466 |
def _open_connection(self):
"""
Open the connection to the database based on the configuration file.
"""
if self._connection:
try:
self._connection.close()
except Exception:
pass
db = self._get_db()
self._connection... | 0.005013 |
def get_item2(self, tablename, key, attributes=None, alias=None,
consistent=False, return_capacity=None):
"""
Fetch a single item from a table
Parameters
----------
tablename : str
Name of the table to fetch from
key : dict
Prima... | 0.001866 |
def detect_client_auth_request(server_handshake_bytes):
"""
Determines if a CertificateRequest message is sent from the server asking
the client for a certificate
:param server_handshake_bytes:
A byte string of the handshake data received from the server
:return:
A boolean - if a c... | 0.004491 |
def cross_validate(model, X, y, k_folds=5, metric="auto", shuffle=True):
"""Cross Validation
Evaluates the given model using the given data
repetitively fitting and predicting on different
chunks (folds) from the data.
Parameters:
-----------
model : dojo-model, the model to be evaluat... | 0.002736 |
def run(self, bundle,
container_id=None,
log_path=None,
pid_file=None,
log_format="kubernetes"):
''' run is a wrapper to create, start, attach, and delete a container.
Equivalent command line example:
singularity oci run -b ~/bundle m... | 0.006129 |
def cli(env,
format='table',
config=None,
verbose=0,
proxy=None,
really=False,
demo=False,
**kwargs):
"""Main click CLI entry-point."""
# Populate environement with client and set it as the context object
env.skip_confirmations = really
env.config... | 0.001073 |
def _isInt(x, precision = 0.0001):
"""
Return (isInt, intValue) for a given floating point number.
Parameters:
----------------------------------------------------------------------
x: floating point number to evaluate
precision: desired precision
retval: (isInt, intValue)
isInt: True if x... | 0.012739 |
def call_cc(fn: Callable) -> 'Observable':
r"""call-with-current-continuation.
Haskell: callCC f = Cont $ \c -> runCont (f (\a -> Cont $ \_ -> c a )) c
"""
def subscribe(on_next):
return fn(lambda a: Observable(lambda _: on_next(a))).subscribe(on_next)
return Observ... | 0.01194 |
def eclipse_tt(p0,b,aR,P=1,ecc=0,w=0,npts=100,u1=0.394,u2=0.261,conv=True,
cadence=1626./86400,frac=1,sec=False,pars0=None,tol=1e-4,width=3):
"""
Trapezoidal parameters for simulated orbit.
All arguments passed to :func:`eclipse` except the following:
:param pars0: (optional)
... | 0.042132 |
def _baseattrs(self):
"""A dict of members expressed in literals"""
result = super()._baseattrs
result["static_spaces"] = self.static_spaces._baseattrs
result["dynamic_spaces"] = self.dynamic_spaces._baseattrs
result["cells"] = self.cells._baseattrs
result["refs"] = self... | 0.004032 |
def phone():
"""Return a random phone number in `#-(###)###-####` format."""
format = '#-(###)###-####'
result = ''
for item in format:
if item == '#':
result += str(random.randint(0, 9))
else:
result += item
return result | 0.003521 |
def _process_handler_result(self, response):
"""Examines out the response returned by a stanza handler and sends all
stanzas provided.
:Parameters:
- `response`: the response to process. `None` or `False` means 'not
handled'. `True` means 'handled'. Stanza or stanza li... | 0.00232 |
def batch_process(
self, zoom=None, tile=None, multi=cpu_count(), max_chunksize=1
):
"""
Process a large batch of tiles.
Parameters
----------
process : MapcheteProcess
process to be run
zoom : list or int
either single zoom level or l... | 0.003699 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.