text stringlengths 78 104k | score float64 0 0.18 |
|---|---|
def select_coins(target, fee, output_size, min_change, *, absolute_fee=False,
consolidate=False, unspents):
'''
Implementation of Branch-and-Bound coin selection defined in Erhart's
Master's thesis An Evaluation of Coin Selection Strategies here:
http://murch.one/wp-content/uploads/2016... | 0.000739 |
def times(self, func, *args):
""" Run a function **n** times.
"""
n = self.obj
i = 0
while n is not 0:
n -= 1
func(i)
i += 1
return self._wrap(func) | 0.008584 |
def get_web_alert(self, web, header="", log=False):
"""Return the alert status relative to the web/url scan return value."""
ret = 'OK'
if web['status'] is None:
ret = 'CAREFUL'
elif web['status'] not in [200, 301, 302]:
ret = 'CRITICAL'
elif web['rtt_warn... | 0.005229 |
def from_input(cls, input, workdir=None, manager=None):
"""
Create an instance of `AbinitTask` from an ABINIT input.
Args:
ainput: `AbinitInput` object.
workdir: Path to the working directory.
manager: :class:`TaskManager` object.
"""
return c... | 0.00551 |
def handler(self,data):
'''
Function to handle notification data as part of Callback URL handler.
:param str data: data posted to Callback URL by connector.
:return: nothing
'''
if isinstance(data,r.models.Response):
self.log.debug("data is request object = %s", str(data.content))
data = data.con... | 0.03609 |
def _ctypes_variables(parameter):
"""Returns the local parameter definition for implementing a Fortran wrapper subroutine
for this parameter's parent executable.
"""
if parameter.dimension is not None and ":" in parameter.dimension:
#For arrays that provide input (including 'inout'), we pass the... | 0.009153 |
def main():
"""Main function for :command:`fabulous-image`."""
import optparse
parser = optparse.OptionParser()
parser.add_option(
"-w", "--width", dest="width", type="int", default=None,
help=("Width of printed image in characters. Default: %default"))
(options, args) = parser.pars... | 0.002242 |
def _add_complex(self, members, is_association=False):
"""Assemble a Complex statement."""
params = {'color': '#0000ff',
'arrowhead': 'dot',
'arrowtail': 'dot',
'dir': 'both'}
for m1, m2 in itertools.combinations(members, 2):
if s... | 0.002372 |
def create_object(self, data, view_kwargs):
"""Create an object through sqlalchemy
:param dict data: the data validated by marshmallow
:param dict view_kwargs: kwargs from the resource view
:return DeclarativeMeta: an object from sqlalchemy
"""
self.before_create_object(... | 0.004992 |
def get_overridden_calculated_entry(self):
"""Gets the calculated entry this entry overrides.
return: (osid.grading.GradeEntry) - the calculated entry
raise: IllegalState - ``overrides_calculated_entry()`` is
``false``
raise: OperationFailed - unable to complete reques... | 0.006329 |
def distance_to_contact(D, alpha=1):
"""Compute contact matrix from input distance matrix. Distance values of
zeroes are given the largest contact count otherwise inferred non-zero
distance values.
"""
if callable(alpha):
distance_function = alpha
else:
try:
a = np.f... | 0.001289 |
def get_kafka_brokers():
"""
Parses the KAKFA_URL and returns a list of hostname:port pairs in the format
that kafka-python expects.
"""
# NOTE: The Kafka environment variables need to be present. If using
# Apache Kafka on Heroku, they will be available in your app configuration.
if not os.... | 0.003466 |
def _update(self):
""" update num_inst and sum_metric """
aps = []
for k, v in self.records.items():
recall, prec = self._recall_prec(v, self.counts[k])
ap = self._average_precision(recall, prec)
aps.append(ap)
if self.num is not None and k < (self... | 0.003311 |
def can_lookup_assets(self):
"""Tests if this user can perform ``Asset`` lookups.
A return of true does not guarantee successful authorization. A
return of false indicates that it is known all methods in this
session will result in a ``PermissionDenied``. This is intended
as a h... | 0.003886 |
def get_application_configurations(self, name=None):
"""Retrieves application configurations for this instance.
Args:
name (str, optional): Only return application configurations containing property **name** that matches `name`. `name` can be a
regular expression. If `name` ... | 0.010624 |
def content_present(self, x: int, y: int) -> bool:
"""Determines if a line or printed text is at the given location."""
# Text?
if (x, y) in self.entries:
return True
# Vertical line?
if any(v.x == x and v.y1 < y < v.y2 for v in self.vertical_lines):
ret... | 0.003929 |
def locate(self, path):
"""
Find a config item along a path; leading slash is optional and ignored.
"""
return Zconfig(lib.zconfig_locate(self._as_parameter_, path), False) | 0.009804 |
def calc_targetedrelease_v1(self):
"""Calculate the targeted water release for reducing drought events,
taking into account both the required water release and the actual
inflow into the dam.
Some dams are supposed to maintain a certain degree of low flow
variability downstream. In case parameter ... | 0.00008 |
def _get_interfaces(self):
"""Get a list of interfaces on this hosting device.
:return: List of the interfaces
"""
ios_cfg = self._get_running_config()
parse = HTParser(ios_cfg)
itfcs_raw = parse.find_lines("^interface GigabitEthernet")
itfcs = [raw_if.strip().sp... | 0.004566 |
def _folder_item_instrument(self, analysis_brain, item):
"""Fills the analysis' instrument to the item passed in.
:param analysis_brain: Brain that represents an analysis
:param item: analysis' dictionary counterpart that represents a row
"""
item['Instrument'] = ''
if n... | 0.001231 |
def write_ioc_string(root, force=False):
"""
Serialize an IOC, as defined by a set of etree Elements, to a String.
:param root: etree Element to serialize. Should have the tag 'OpenIOC'
:param force: Skip the root node tag check.
:return:
"""
root_tag = 'OpenIOC'
if not force and root.t... | 0.004038 |
def network_io_counters():
"""Return network I/O statistics for every network interface
installed on the system as a dict of raw tuples.
"""
f = open("/proc/net/dev", "r")
try:
lines = f.readlines()
finally:
f.close()
retdict = {}
for line in lines[2:]:
colon = l... | 0.001138 |
def get_proof(self):
"""
Get a proof produced when deciding the formula.
"""
if self.lingeling and self.prfile:
self.prfile.seek(0)
return [line.rstrip() for line in self.prfile.readlines()] | 0.007968 |
def walk_snmp_values(sess, helper, oid, check):
""" return a snmp value or exits the plugin with unknown"""
try:
snmp_walk = sess.walk_oid(oid)
result_list = []
for x in range(len(snmp_walk)):
result_list.append(snmp_walk[x].val)
if resul... | 0.004894 |
def _parse_pypi_json_package_info(self, package_name, current_version, response):
"""
:type package_name: str
:type current_version: version.Version
:type response: requests.models.Response
"""
data = response.json()
all_versions = [version.parse(vers) for vers i... | 0.004301 |
def get_order_matchresults(self, order_id, _async=False):
"""
查询某个订单的成交明细
:param order_id:
:return:
"""
params = {}
path = f'/v1/order/orders/{order_id}/matchresults'
return api_key_get(params, path, _async=_async) | 0.007194 |
def key_to_str(modifiers, key, mods_table = mods, key_table = wx, key_prefix = 'WXK_'):
"""
Returns a human-readable version of numerical modifiers and key.
To make the key suitable for global hotkey usage, supply:
mods_table = global_mods, key_table = win32con, key_prefix = 'VK_'
"""
logger.debug('Converting (... | 0.035573 |
def keep_path(self, path):
"""
Given a path, returns True if the path should be kept, False if it should be cut.
"""
if len(path.addr_trace) < 2:
return True
return self.should_take_exit(path.addr_trace[-2], path.addr_trace[-1]) | 0.010676 |
def __store(self, stored_object, overwrite=False):
"""
Store a variable into the storage.
:param StoredObject stored_object: The descriptor describing start address and the variable.
:param bool overwrite: Whether existing objects should be overwritten or not. True to make a strong upd... | 0.002606 |
def make_python_patterns(additional_keywords=[], additional_builtins=[]):
"Strongly inspired from idlelib.ColorDelegator.make_pat"
kwlist = keyword.kwlist + additional_keywords
builtinlist = [str(name) for name in dir(builtins)
if not name.startswith('_')] + additional_builtins
r... | 0.002695 |
def p_expr_XOR_expr(p):
""" expr : expr XOR expr
"""
p[0] = make_binary(p.lineno(2), 'XOR', p[1], p[3], lambda x, y: (x and not y) or (not x and y)) | 0.0125 |
def getDbNames(self):
"""This function returns the list of open databases"""
request = []
request.append(uu({'-dbnames': '' }))
result = self._doRequest(request)
result = FMResultset.FMResultset(result)
dbNames = []
for dbName in result.resultset:
dbNames.append(string.lower(dbName['DATABASE_NAME'])... | 0.035398 |
def format_cftime_datetime(date):
"""Converts a cftime.datetime object to a string with the format:
YYYY-MM-DD HH:MM:SS.UUUUUU
"""
return '{:04d}-{:02d}-{:02d} {:02d}:{:02d}:{:02d}.{:06d}'.format(
date.year, date.month, date.day, date.hour, date.minute, date.second,
date.microsecond) | 0.003165 |
def add_release(self, release):
""" Add a release object if it does not already exist """
for r in self.releases:
if r.version == release.version:
return
self.releases.append(release) | 0.008511 |
def write(path, content, encoding="UTF-8", append=False, raw=False):
"""Write *content* to file *path*"""
mode = 'wb' if not append else 'ab'
with OPEN_FUNC(path, mode) as _file:
if raw:
import shutil
shutil.copyfileobj(content, _file)
else:
_file.write(co... | 0.002915 |
def types(self):
''' Returns an iterator over the types of the neurites in the object.
If the object is a tree, then one value is returned.
'''
neurites = self._obj.neurites if hasattr(self._obj, 'neurites') else (self._obj,)
return (neu.type for neu in neurites) | 0.009772 |
def unassign_assessment_part_from_bank(self, assessment_part_id, bank_id):
"""Removes an ``AssessmentPart`` from an ``Bank``.
arg: assessment_part_id (osid.id.Id): the ``Id`` of the
``AssessmentPart``
arg: bank_id (osid.id.Id): the ``Id`` of the ``Bank``
raise: No... | 0.00194 |
def unregister(callback, event=None):
"""
Inverse operation of `register` (though not a decorator). Client-less
`remove_event_handler
<telethon.client.updates.UpdateMethods.remove_event_handler>`
variant. **Note that this won't remove handlers from the client**,
because it simply can't, so you w... | 0.000969 |
def ADOSC(frame, fast=3, slow=10, high_col='high', low_col='low', close_col='close', vol_col='Volume'):
"""Chaikin A/D oscillator"""
return _frame_to_series(frame, [high_col, low_col, close_col, vol_col], talib.ADOSC, fast, slow) | 0.012658 |
def get_version():
"""Get version from package resources."""
requirement = pkg_resources.Requirement.parse("yoda")
provider = pkg_resources.get_provider(requirement)
return provider.version | 0.004878 |
def probe(self, hosts):
'''
.. seealso:: :attr:`probe`
'''
def __send_probe(host):
ping = self.m(
'',
cmdd=dict(
cmd=' '.join([
self.__ping_cmd,
self.__num,
... | 0.001474 |
def get_closest(self, lon, lat, depth=0):
"""
Get the closest object to the given longitude and latitude
and its distance.
:param lon: longitude in degrees
:param lat: latitude in degrees
:param depth: depth in km (default 0)
:returns: (object, distance)
... | 0.004283 |
def _hl_as_string(self, highlight):
"""
Given a solr string of highlighted text, returns the
str representations
For example:
"Foo <em>Muscle</em> bar <em>atrophy</em>, generalized"
Returns:
"Foo Muscle bar atrophy, generalized"
:return: str
"""
... | 0.003407 |
def classify_intersection8(s, curve1, surface1, curve2, surface2):
"""Image for :func:`._surface_helpers.classify_intersection` docstring."""
if NO_IMAGES:
return
ax = classify_help(s, curve1, surface1, curve2, surface2, None)
ax.set_xlim(-1.125, 1.125)
ax.set_ylim(-0.125, 1.125)
save_i... | 0.00274 |
def validate_regexp(pattern, flags=0):
"""
Validate the field matches the given regular expression.
Should work with anything that supports '==' operator.
:param pattern: Regular expresion to match. String or regular expression instance.
:param pattern: Flags for the regular expression.
:raises... | 0.002994 |
def validate(style):
"""Check `style` against pyout.styling.schema.
Parameters
----------
style : dict
Style object to validate.
Raises
------
StyleValidationError if `style` is not valid.
"""
try:
import jsonschema
except ImportError:
return
try:
... | 0.00156 |
def ContrastNormalization(alpha=1.0, per_channel=False, name=None, deterministic=False, random_state=None):
"""
Augmenter that changes the contrast of images.
dtype support:
See ``imgaug.augmenters.contrast.LinearContrast``.
Parameters
----------
alpha : number or tuple of number or l... | 0.002004 |
def addIndividual(self, individual):
"""
Adds the specified individual to this dataset.
"""
id_ = individual.getId()
self._individualIdMap[id_] = individual
self._individualIds.append(id_)
self._individualNameMap[individual.getName()] = individual | 0.006601 |
def open_display(self):
"""Establishes connection with X server and prepares objects
necessary to retrieve and send data.
"""
self.close_display() # Properly finish previous open_display()
XkbIgnoreExtension(False)
display_name = None
major = c_int(XkbMajorVe... | 0.003354 |
def emit(self, record):
"""Actually log the specified logging record.
Overrides the default emit behavior of ``StreamHandler``.
See https://docs.python.org/2/library/logging.html#handler-objects
:type record: :class:`logging.LogRecord`
:param record: The record to be logged.
... | 0.006186 |
def init_key_jar(public_path='', private_path='', key_defs='', owner='',
read_only=True):
"""
A number of cases here:
1. A private path is given
a. The file exists and a JWKS is found there.
From that JWKS a KeyJar instance is built.
b.
If the private pat... | 0.000218 |
def has_child_bins(self, bin_id):
"""Tests if a bin has any children.
arg: bin_id (osid.id.Id): the ``Id`` of a bin
return: (boolean) - ``true`` if the ``bin_id`` has children,
``false`` otherwise
raise: NotFound - ``bin_id`` not found
raise: NullArgument - ... | 0.002413 |
def install(path, capture_error=False): # type: (str, bool) -> None
"""Install a Python module in the executing Python environment.
Args:
path (str): Real path location of the Python module.
capture_error (bool): Default false. If True, the running process captures the
stderr, and ... | 0.00561 |
def store_new(self, coll, path, mtime):
"""Load a collections metadata file and store it
:param str coll: The name of the collection the metadata is for
:param str path: The path to the collections metadata file
:param float mtime: The current mtime of the collections metadata file
... | 0.004115 |
def _set_sla_data(self, test_id, metrics):
"""
Get sla data from each metric and set it in the _Analysis object specified by test_id to make it available
for retrieval
:return: currently always returns CONSTANTS.OK. Maybe enhanced in future to return additional status
"""
for metric in metrics:
... | 0.009685 |
def get_template_as_json(template_id, **kwargs):
"""
Get a template (including attribute and dataset definitions) as a JSON
string. This is just a wrapper around the get_template_as_dict function.
"""
user_id = kwargs['user_id']
return json.dumps(get_template_as_dict(template_id, user_id... | 0.006061 |
def findObjects(path):
"""Finds objects in pairtree.
Given a path that corresponds to a pairtree, walk it and look for
non-shorty (it's ya birthday) directories.
"""
objects = []
if not os.path.isdir(path):
return []
contents = os.listdir(path)
for item in contents:
full... | 0.001414 |
def get_handler(query_result_type, return_type):
""" Find the appropriate return type handler to convert the query result to the desired return type
:param query_result_type: type, desired return type
:param return_type: type, actual return type
:return: callable, function that will han... | 0.008621 |
def business_date(self, business_date):
"""
Force the business_date to always be a date
:param business_date:
:return:
"""
if business_date is not None:
if isinstance(business_date, type_check):
self._business_date = parse(business_date).date()... | 0.007712 |
def get_biased_correlations(data, threshold= 10):
"""
Gets the highest few correlations for each bit, across the entirety of the
data. Meant to provide a comparison point for the pairwise correlations
reported in the literature, which are typically between neighboring neurons
tuned to the same inputs. We wo... | 0.015544 |
def check_content(self):
"""Check content of URL.
@return: True if content can be parsed, else False
"""
if self.do_check_content and self.valid:
# check content and recursion
try:
if self.can_get_content():
self.aggregate.plugi... | 0.004386 |
def list_groups(self, filtr, url_prefix, auth, session, send_opts):
"""Get the groups the logged in user is a member of.
Optionally filter by 'member' or 'maintainer'.
Args:
filtr (string|None): ['member'|'maintainer'] or defaults to None.
url_prefix (string): Protocol ... | 0.004834 |
def no_type_check_decorator(decorator):
"""Decorator to give another decorator the @no_type_check effect.
This wraps the decorator with something that wraps the decorated
function in @no_type_check.
"""
@functools.wraps(decorator)
def wrapped_decorator(*args, **kwds):
func = decorator(... | 0.002387 |
def community_post_comments(self, post_id, **kwargs):
"https://developer.zendesk.com/rest_api/docs/help_center/post_comments#list-comments"
api_path = "/api/v2/community/posts/{post_id}/comments.json"
api_path = api_path.format(post_id=post_id)
return self.call(api_path, **kwargs) | 0.009585 |
def playlist_subscribe(self, playlist):
"""Subscribe to a public playlist.
Parameters:
playlist (dict): A public playlist dict.
Returns:
dict: Playlist information.
"""
mutation = mc_calls.PlaylistBatch.create(
playlist['name'],
playlist['description'],
'SHARED',
owner_name=playlist.get('... | 0.037975 |
def search(self, fields=None, query=None, filters=None):
"""Search for entities.
:param fields: A set naming which fields should be used when generating
a search query. If ``None``, all values on the entity are used. If
an empty set, no values are used.
:param query: A d... | 0.00128 |
def create(dataset, target, features=None,
penalty=1.0, solver='auto',
feature_rescaling=True,
convergence_threshold = _DEFAULT_SOLVER_OPTIONS['convergence_threshold'],
lbfgs_memory_level = _DEFAULT_SOLVER_OPTIONS['lbfgs_memory_level'],
max_iterations = _DEFAULT_SOLVER_OPTIONS['max_iterations'],
... | 0.005876 |
def preprocess_plain_text_file(self, filename, pmid, extra_annotations):
"""Preprocess a plain text file for use with ISI reder.
Preprocessing results in a new text file with one sentence
per line.
Parameters
----------
filename : str
The name of the plain t... | 0.002299 |
def load_facts(self, facts):
"""Load a set of facts into the CLIPS data base.
The C equivalent of the CLIPS load-facts command.
Facts can be loaded from a string or from a text file.
"""
facts = facts.encode()
if os.path.exists(facts):
ret = lib.EnvLoadFac... | 0.003442 |
def share_column_widths(self, tables, shared_limit=None):
"""
To have this table use sync with the columns in tables
Note, this will need to be called on the other tables to be fully
synced.
:param tables: list of SeabornTables to share column widths
:param sh... | 0.004942 |
def update_settings(self, index, newvalues):
"""
Update Settings of an index.
(See :ref:`es-guide-reference-api-admin-indices-update-settings`)
"""
path = make_path(index, "_settings")
return self.conn._send_request('PUT', path, newvalues) | 0.00692 |
def communicate(self, input=None):
"""Interact with process: Send data to stdin. Read data from
stdout and stderr, until end-of-file is reached. Wait for
process to terminate. The optional input argument should be a
string to be sent to the child process, or None, if no data
s... | 0.001807 |
def from_raw(self, raw: RawScalar) -> Optional[bytes]:
"""Override superclass method."""
try:
return base64.b64decode(raw, validate=True)
except TypeError:
return None | 0.009302 |
def preprocess(img):
"""Preprocess 210x160x3 uint8 frame into 6400 (80x80) 1D float vector."""
# Crop the image.
img = img[35:195]
# Downsample by factor of 2.
img = img[::2, ::2, 0]
# Erase background (background type 1).
img[img == 144] = 0
# Erase background (background type 2).
i... | 0.002232 |
def parse_event_xml(self, event_data) -> dict:
"""Parse metadata xml."""
event = {}
event_xml = event_data.decode()
message = MESSAGE.search(event_xml)
if not message:
return {}
event[EVENT_OPERATION] = message.group(EVENT_OPERATION)
topic = TOPIC.s... | 0.002427 |
def send_miniprogrampage_message(
self, user_id, title, appid, pagepath, thumb_media_id, kf_account=None
):
"""
发送小程序卡片(要求小程序与公众号已关联)
:param user_id: 用户 ID 。 就是你收到的 `Message` 的 source
:param title: 小程序卡片的标题
:param appid: 小程序的 appid,要求小程序的 appid 需要与公众号有关联关系
:p... | 0.003721 |
def process_rules(self, path: Path, system: System):
"""writes the templates read from the rules document"""
self.context.update({
'system': system,
})
document = FileSystem.load_yaml(path, required=True)
for module, rules in document.items():
click.secho(... | 0.00489 |
def from_view(cls, view, *methods, name=None):
"""Create a handler class from function or coroutine."""
docs = getattr(view, '__doc__', None)
view = to_coroutine(view)
methods = methods or ['GET']
if METH_ANY in methods:
methods = METH_ALL
def proxy(self, *a... | 0.003448 |
def disconnect_entry_signals():
"""
Disconnect all the signals on Entry model.
"""
post_save.disconnect(
sender=Entry,
dispatch_uid=ENTRY_PS_PING_DIRECTORIES)
post_save.disconnect(
sender=Entry,
dispatch_uid=ENTRY_PS_PING_EXTERNAL_URLS)
post_save.disconnect(
... | 0.002049 |
def disconnect(self, frame):
"""
Handles the DISCONNECT command: Unbinds the connection.
Clients are supposed to send this command, but in practice it should not be
relied upon.
"""
self.engine.log.debug("Disconnect")
self.engine.unbind() | 0.010169 |
def get_quizzes(self, course_id):
"""
List quizzes for a given course
https://canvas.instructure.com/doc/api/quizzes.html#method.quizzes_api.index
"""
url = QUIZZES_API.format(course_id)
data = self._get_resource(url)
quizzes = []
for datum in data:
... | 0.005236 |
def ToScriptHash(self, address):
"""
Retrieve the script_hash based from an address.
Args:
address (str): a base58 encoded address.
Raises:
ValuesError: if an invalid address is supplied or the coin version is incorrect
Exception: if the address stri... | 0.003891 |
def visit_children_decor(func):
"See Interpreter"
@wraps(func)
def inner(cls, tree):
values = cls.visit_children(tree)
return func(cls, values)
return inner | 0.005319 |
def rename_file(self, relativePath, newRelativePath,
force=False, raiseError=True, ntrials=3):
"""
Rename a file in the repository. It insures renaming the file in the system.
:Parameters:
#. relativePath (string): The relative to the repository path of
... | 0.011917 |
def boolValue(self):
"""
returns : (boolean) Value
"""
if self.lastValue == 1 or self.lastValue == "active":
self._key = 1
self._boolKey = True
else:
self._key = 0
self._boolKey = False
return self._boolKey | 0.006623 |
def get_possible_initializer_keys(cls, use_peepholes=False,
use_projection=False):
"""Returns the keys the dictionary of variable initializers may contain.
The set of all possible initializer keys are:
w_gates: weight for gates
b_gates: bias of gates
w_f_... | 0.003562 |
def get_share_url_with_dirname(uk, shareid, dirname):
'''得到共享目录的链接'''
return ''.join([
const.PAN_URL, 'wap/link',
'?shareid=', shareid,
'&uk=', uk,
'&dir=', encoder.encode_uri_component(dirname),
'&third=0',
]) | 0.003559 |
def from_blob(self, blob, store=current_store,
extra_args=None, extra_kwargs=None):
"""Stores the ``blob`` (byte string) for the image
into the ``store``.
:param blob: the byte string for the image
:type blob: :class:`str`
:param store: the storage to store the... | 0.002999 |
def remove(self, key):
"""
Removes the mapping for a key from this map if it is present. The map will not contain a mapping for the
specified key once the call returns.
**Warning: This method uses __hash__ and __eq__ methods of binary form of the key, not the actual implementations
... | 0.008119 |
def _TerminateProcess(self, process):
"""Terminate a process.
Args:
process (MultiProcessBaseProcess): process to terminate.
"""
pid = process.pid
logger.warning('Terminating process: (PID: {0:d}).'.format(pid))
process.terminate()
# Wait for the process to exit.
process.join(tim... | 0.006303 |
def maybe_infer_to_datetimelike(value, convert_dates=False):
"""
we might have a array (or single object) that is datetime like,
and no dtype is passed don't change the value unless we find a
datetime/timedelta set
this is pretty strict in that a datetime/timedelta is REQUIRED
in addition to po... | 0.000298 |
def update(self, body):
"""
Update the MessageInstance
:param unicode body: The text of the message you want to send
:returns: Updated MessageInstance
:rtype: twilio.rest.api.v2010.account.message.MessageInstance
"""
data = values.of({'Body': body, })
p... | 0.003273 |
def merge(left, right):
"""
deep merge dictionary on the left with the one
on the right.
Fill in left dictionary with right one where
the value of the key from the right one in
the left one is missing or None.
"""
if isinstance(left, dict) and isinstance(right, dict):
for key, v... | 0.001773 |
def _validate_many(args, specs, defaults,passed_conditions,value_conditions,
allow_unknowns,unknowns_spec):
'''
Similar to validate but validates multiple objects at once, each with their own specification.
Fill objects that were specified but not provided with NotPassed or default ... | 0.01168 |
def close (self, force=True): # File-like object.
"""This closes the connection with the child application. Note that
calling close() more than once is valid. This emulates standard Python
behavior with files. Set force to True if you want to make sure that
the child is terminated (SI... | 0.009889 |
def stop_app(self, package_name, clear=False):
'''
Stop application
Args:
package_name: string like com.example.app1
clear: bool, remove user data
Returns:
None
'''
if clear:
self.adb_shell(['pm', 'clear', package_name])
... | 0.004819 |
def timetree(params):
"""
implementeing treetime tree
"""
if params.relax is None:
relaxed_clock_params = None
elif params.relax==[]:
relaxed_clock_params=True
elif len(params.relax)==2:
relaxed_clock_params={'slack':params.relax[0], 'coupling':params.relax[1]}
date... | 0.009594 |
def _Backward3_T_Ph(P, h):
"""Backward equation for region 3, T=f(P,h)
Parameters
----------
P : float
Pressure, [MPa]
h : float
Specific enthalpy, [kJ/kg]
Returns
-------
T : float
Temperature, [K]
"""
hf = _h_3ab(P)
if h <= hf:
T = _Backwar... | 0.002551 |
def _process_datum(self, data, input_reader, ctx, transient_shard_state):
"""Process a single data piece.
Call mapper handler on the data.
Args:
data: a datum to process.
input_reader: input reader.
ctx: mapreduce context
transient_shard_state: transient shard state.
Returns:
... | 0.01037 |
def download_file(self, remote_path, local_path, progress=None):
"""Downloads file from WebDAV server and save it locally.
More information you can find by link http://webdav.org/specs/rfc4918.html#rfc.section.9.4
:param remote_path: the path to remote file for downloading.
:param local... | 0.002717 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.