text stringlengths 78 104k | score float64 0 0.18 |
|---|---|
def Harms(x, rhol, rhog, mul, mug, m, D):
r'''Calculates void fraction in two-phase flow according to the model of
[1]_ also given in [2]_ and [3]_.
.. math::
\alpha = \left[1 - 10.06Re_l^{-0.875}(1.74 + 0.104Re_l^{0.5})^2
\left(1.376 + \frac{7.242}{X_{tt}^{1.655}}\right)^{-0.5}\right]^2
... | 0.006458 |
def concatenate(tup, axis=0):
"""Join a sequence of arrays together.
Will aim to join `ndarray`, `RemoteArray`, and `DistArray` without moving
their data, if they happen to be on different engines.
Args:
tup (sequence of array_like): Arrays to be concatenated. They must have
the same sh... | 0.001748 |
def start(self):
"""Start the thread's activity.
It must be called at most once per thread object. It arranges for the
object's run() method to be invoked in a separate thread of control.
This method will raise a RuntimeError if called more than once on the
same thread object.
... | 0.00225 |
def _sline_bokeh(self, window_size, y_label):
"""
Returns a chart with a smooth line from a serie
"""
try:
ds2 = self.clone_()
window = np.ones(int(window_size)) / float(window_size)
ds2.df[y_label] = np.convolve(self.df[self.y], window, 'same')
... | 0.004073 |
def write_source(self, filename):
'''
Save XML source to file by calling `write` on the root element.
'''
return self.message._elem.getroottree().write(filename, encoding='utf8') | 0.014019 |
def two_antidepressant_episodes(
patient_drug_date_df: DataFrame,
patient_colname: str = DEFAULT_SOURCE_PATIENT_COLNAME,
drug_colname: str = DEFAULT_SOURCE_DRUG_COLNAME,
date_colname: str = DEFAULT_SOURCE_DATE_COLNAME,
course_length_days: int = DEFAULT_ANTIDEPRESSANT_COURSE_LENGT... | 0.000301 |
def set_hosts(hosts, use_ssl=False, ssl_cert_path=None):
"""
Sets the Elasticsearch hosts to use
Args:
hosts (str): A single hostname or URL, or list of hostnames or URLs
use_ssl (bool): Use a HTTPS connection to the server
ssl_cert_path (str): Path to the certificate chain
"""
... | 0.001364 |
def first_up(ofile, Rec, file_type):
"""
writes the header for a MagIC template file
"""
keylist = []
pmag_out = open(ofile, 'a')
outstring = "tab \t" + file_type + "\n"
pmag_out.write(outstring)
keystring = ""
for key in list(Rec.keys()):
keystring = keystring + '\t' + key
... | 0.002208 |
def mixture_property(self, T, P, zs, ws):
r'''Method to calculate the property with sanity checking and without
specifying a specific method. `select_valid_methods` is used to obtain
a sorted list of methods to try. Methods are then tried in order until
one succeeds. The methods are allo... | 0.002392 |
def node(self, name, bigdl_type="float"):
"""
Return the corresponding node has the given name. If the given name doesn't match any node,
an exception will be thrown
:param name: node name
:param bigdl_type:
:return:
"""
jnode = callBigDlFunc(bigdl_type,... | 0.012987 |
def convertNeutral2Xml(infile, outfile=None):
"""Convert Neutral file format to Dolfin XML."""
f = open(infile, "r")
lines = f.readlines()
f.close()
ncoords = int(lines[0])
fdolf_coords = []
for i in range(1, ncoords + 1):
x, y, z = lines[i].split()
fdolf_coords.append([flo... | 0.001192 |
def naive_request(self, url, method, **kwargs):
""" Makes a request to url using an without oauth authorization
session, but through a normal session
:param str url: url to send request to
:param str method: type of request (get/put/post/patch/delete)
:param kwargs: extra params... | 0.005825 |
def replace_vertex_references(self, mask):
"""
Replace the vertex index references in every entity.
Parameters
------------
mask : (len(self.vertices), ) int
Contains new vertex indexes
Alters
------------
entity.points in self.entities
... | 0.004435 |
def transform_concepts(rdf, typemap):
"""Transform Concepts into new types, as defined by the config file."""
# find out all the types used in the model
types = set()
for s, o in rdf.subject_objects(RDF.type):
if o not in typemap and in_general_ns(o):
continue
types.add(o)
... | 0.001117 |
def run(ctx, args):
"""Run commands in the proper repo."""
if not args:
click.echo(ctx.get_help())
return
with chdir(get_root()):
result = run_command(args)
ctx.exit(result.code) | 0.004545 |
def get(self, doc_id):
"""Retrieve the specified document."""
resp_dict = self._get_query(q='id:{}'.format(doc_id))
if resp_dict['response']['numFound'] > 0:
return resp_dict['response']['docs'][0] | 0.008584 |
def write(self, s, level=0, color=None):
"""Write message with indentation, context and optional timestamp."""
if level > self.level:
return
if self.timestamps:
timestamp = time.strftime(u'%H:%M:%S ')
else:
timestamp = u''
with lock:
... | 0.002561 |
async def persist_checkpoint_async(self, checkpoint, event_processor_context=None):
"""
Persists the checkpoint, and - optionally - the state of the Event Processor.
:param checkpoint: The checkpoint to persist.
:type checkpoint: ~azure.eventprocessorhost.checkpoint.Checkpoint
:... | 0.00554 |
def list_datasets(self):
"""Lists available datasets in a readable DataFrame format.
Returns:
pd.DataFrame: Frame listing available datasets.
"""
def _row_gen(attributes):
for attr in attributes.values():
yield (attr.name, attr.display_name)
... | 0.004545 |
def _loop(self, *args, **kwargs):
"""Loops the target function
:param args: The args specified on initiation
:param kwargs: The kwargs specified on initiation
"""
self.on_start(*self.on_start_args, **self.on_start_kwargs)
try:
while not self._stop_signal:
... | 0.003899 |
def scan(self, regex):
"""
Match a pattern from the current position.
If a match is found, advances the scan pointer and returns the matched
string. Otherwise returns ``None``.
>>> s = Scanner("test string")
>>> s.pos
0
>>> s.scan(r'foo')... | 0.003527 |
def setArrowStyle( self, state ):
"""
Sets whether or not to use arrows for the grouping mechanism.
:param state | <bool>
"""
self._arrowStyle = state
if not state:
self.setStyleSheet('')
else:
right = reso... | 0.014159 |
def pull(args):
"""
%prog pull version partID unitigID
For example, `%prog pull 5 530` will pull the utg530 from partition 5
The layout is written to `unitig530`
"""
p = OptionParser(pull.__doc__)
opts, args = p.parse_args(args)
if len(args) != 3:
sys.exit(not p.print_help())
... | 0.001522 |
def to_unicode(obj):
"""Convert obj to unicode (if it can be be converted).
Conversion is only attempted if `obj` is a string type (as
determined by :data:`six.string_types`).
.. versionchanged:: 0.7.0
removed `encoding keyword argument
"""
if not isinstance(obj, six.string_types):
... | 0.002336 |
def result(self, value):
"""The result of the command."""
if self._process_result:
self._result = self._process_result(value)
self._raw_result = value | 0.010695 |
def setDataFrame(self, dataFrame):
"""setter function to _dataFrame. Holds all data.
Note:
It's not implemented with python properties to keep Qt conventions.
Raises:
TypeError: if dataFrame is not of type pandas.core.frame.DataFrame.
Args:
dataFram... | 0.005789 |
def predict(self, query_data, verbose=False, distribution=False, cleanup=True):
"""
Iterates over the predicted values and probability (if supported).
Each iteration yields a tuple of the form (prediction, probability).
If the file is a test file (i.e. contains no query variable... | 0.005135 |
def get_bitseq_from_selection(self, selection_start: int, selection_width: int):
"""
get start and end index of bit sequence from selected samples
:rtype: tuple[int,int,int,int]
:return: start_message index, start index, end message index, end index
"""
start_message, st... | 0.00265 |
def ipshuffle(l, random=None):
r"""Shuffle list `l` inplace and return it."""
import random as _random
_random.shuffle(l, random)
return l | 0.012987 |
def get_element_attribute(elem_to_parse, attrib_name, default_value=u''):
"""
:return: an attribute from the parsed element if it has the attribute,
otherwise the default value
"""
element = get_element(elem_to_parse)
if element is None:
return default_value
return element.attrib.... | 0.002849 |
def duplicate(self, contributor=None):
"""Duplicate (make a copy) ``Data`` objects.
:param contributor: Duplication user
"""
bundle = [
{'original': data, 'copy': data.duplicate(contributor=contributor)}
for data in self
]
bundle = rewire_inputs(... | 0.00489 |
def export(self, nidm_version, export_dir):
"""
Create prov entities and activities.
"""
# Create "Excursion set" entity
self.add_attributes((
(PROV['type'], self.type),
(NIDM_IN_COORDINATE_SPACE, self.coord_space.id),
(PROV['label'], self.labe... | 0.00188 |
def iter_prefix(reader, key):
"""
Creates an iterator which iterates over lines that start with prefix
'key' in a sorted text file.
"""
return itertools.takewhile(
lambda line: line.startswith(key),
search(reader, key)) | 0.003906 |
def _activate_organization(organization):
"""
Activates an inactivated (soft-deleted) organization as well as any inactive relationships
"""
[_activate_organization_course_relationship(record) for record
in internal.OrganizationCourse.objects.filter(organization_id=organization.id, active=False)]
... | 0.006818 |
def subnet_update(auth=None, **kwargs):
'''
Update a subnet
name_or_id
Name or ID of the subnet to update
subnet_name
The new name of the subnet
enable_dhcp
Set to ``True`` if DHCP is enabled and ``False`` if disabled
gateway_ip
The gateway IP address. When yo... | 0.001646 |
def p2pkh_input_and_witness(outpoint, sig, pubkey, sequence=0xFFFFFFFE):
'''
OutPoint, hex_string, hex_string, int -> (TxIn, InputWitness)
Create a signed legacy TxIn from a p2pkh prevout
Create an empty InputWitness for it
Useful for transactions spending some witness and some legacy prevouts
'... | 0.001754 |
def validate_SUMTO(in_value, restriction):
"""
Test to ensure the values of a list sum to a specified value:
Parameters: a list of numeric values and a target to which the values
in the list must sum
"""
#Sometimes restriction values can accidentally be put in the template <item>100<... | 0.00965 |
def PrintSets(self):
"""Prints set name and number of photos in set"""
sets=self._getphotosets()
for setname in sets:
print("%s [%d]"%(setname,sets[setname]['number_photos'])) | 0.023697 |
def download(queries, user=None, pwd=None,
email=None, pred_type='and'):
"""
Spin up a download request for GBIF occurrence data.
:param queries: One or more of query arguments to kick of a download job.
See Details.
:type queries: str or list
:param pred_type: (character) One ... | 0.000462 |
def tojson(table, source=None, prefix=None, suffix=None, *args, **kwargs):
"""
Write a table in JSON format, with rows output as JSON objects. E.g.::
>>> import petl as etl
>>> table1 = [['foo', 'bar'],
... ['a', 1],
... ['b', 2],
... ['c', ... | 0.002618 |
def visualRect(self, index):
"""
Returns the visual rectangle for the inputed index.
:param index | <QModelIndex>
:return <QtCore.QRect>
"""
rect = super(XTreeWidget, self).visualRect(index)
item = self.itemFromIndex(index)
... | 0.00692 |
def _value_maps_row(value_maps_keyword):
"""Helper to make a message row from a value maps.
Expected keywords:
'value_maps': {
'structure': {
'ina_structure_flood_hazard_classification': {
'classes': {
'low': [1, 2, 3],
... | 0.000485 |
def nvmlDeviceGetName(handle):
r"""
/**
* Retrieves the name of this device.
*
* For all products.
*
* The name is an alphanumeric string that denotes a particular product, e.g. Tesla &tm; C2070. It will not
* exceed 64 characters in length (including the NULL terminator). See \re... | 0.005795 |
def read_creds_from_ecs_container_metadata():
"""
Read credentials from ECS instance metadata (IAM role)
:return:
"""
creds = init_creds()
try:
ecs_metadata_relative_uri = os.environ['AWS_CONTAINER_CREDENTIALS_RELATIVE_URI']
credentials = requests.get('http://169.254.170.2' + ec... | 0.008606 |
def _get_splunk_search_props(search):
'''
Get splunk search properties from an object
'''
props = search.content
props["app"] = search.access.app
props["sharing"] = search.access.sharing
return props | 0.004405 |
def summary(self):
"""
A succinct summary of the argument specifier. Unlike the repr,
a summary does not have to be complete but must supply the
most relevant information about the object to the user.
"""
print("Items: %s" % len(self))
varying_keys = ', '.join('%r... | 0.006814 |
def get_class_that_defined_method(meth):
""" Gets the class object which defined a given method
@meth: a class method
-> owner class object
"""
if inspect.ismethod(meth):
for cls in inspect.getmro(meth.__self__.__class__):
if cls.__dict__.get(meth.__name__) is meth:
... | 0.001543 |
def allow_client_incoming(self, client_name):
"""
Allow the user of this token to accept incoming connections.
:param str client_name: Client name to accept calls from
"""
self.client_name = client_name
self.capabilities['incoming'] = ScopeURI('client', 'incoming', {'cli... | 0.008746 |
def acquire(self, key: str, blocking: bool=True, timeout: float=None, metadata: Any=None,
on_before_lock: LockEventListener=lambda key: None,
on_lock_already_locked: LockEventListener=lambda key: None,
lock_poll_interval_generator: Callable[[int], float]=DEFAULT_LOCK_POLL... | 0.008878 |
def handle_exec(args):
"""usage: cosmic-ray exec <session-file>
Perform the remaining work to be done in the specified session.
This requires that the rest of your mutation testing
infrastructure (e.g. worker processes) are already running.
"""
session_file = get_db_name(args.get('<session-file... | 0.002538 |
def do_set_port_config(self, line):
"""set_port_config <peer> <target> <port> <key> <value>
eg. set_port_config sw1 running LogicalSwitch7-Port2 admin-state down
eg. set_port_config sw1 running LogicalSwitch7-Port2 no-forward false
"""
def f(p, args):
try:
... | 0.002281 |
def temp_filename(self):
"""Return a unique tempfile name.
"""
# TODO: it would be nice to get this to behave more like a
# context so we can make sure these temporary files are
# removed, regardless of whether an error occurs or the
# program is terminated.
handl... | 0.004988 |
def run_git_concurrently(base_dir):
"""Runs the 'git status' and 'git pull' commands in threads and reports
the results in a pretty table."""
os.chdir(base_dir)
git_dirs = get_list_of_git_directories()
print("Processing %d git repos: %s" % (len(git_dirs), ', '.join(git_dirs)))
widgets = [Percen... | 0.001028 |
def updateReferenceURL(self, pid, name, ref_url, path=""):
"""Update a Referenced Content File (.url)
:param pid: The HydroShare ID of the resource for which the file should be updated
:param name: Filename for the referenced file
:param r... | 0.008841 |
def run(self, data):
"""Parser runner.
To use this module stand-alone.
"""
ast = self.parser.parse(data, debug=True)
self.parser.parse(data, debug=True)
ast.to_string(0) | 0.009174 |
def _stripped_name_version(self):
"""Returns filename stripped of the suffix.
Returns:
Filename stripped of the suffix (extension).
"""
# we don't use splitext, because on "a.tar.gz" it returns ("a.tar",
# "gz")
filename = os.path.basename(self.local_file)
... | 0.002849 |
def draw(self):
"""
Draws all layers of this LayeredWidget.
This should normally be unneccessary, since it is recommended that layers use Vertex Lists instead of OpenGL Immediate Mode.
"""
super(LayeredWidget,self).draw()
for layer,_ in self.layers:
l... | 0.018072 |
def remove_object(self, obj):
"""Remove current object from the ElasticSearch."""
obj_id = self.generate_id(obj)
es_obj = self.document_class.get(obj_id, ignore=[404])
# Object may not exist in this index.
if es_obj:
es_obj.delete(refresh=True) | 0.006757 |
def artist_commentary_revert(self, id_, version_id):
"""Revert artist commentary (Requires login) (UNTESTED).
Parameters:
id_ (int): The artist commentary id.
version_id (int): The artist commentary version id to
revert to.
"""
param... | 0.004132 |
def handle_event(self, packet):
"""Handle incoming packet from rflink gateway."""
if packet.get('command'):
task = self.send_command_ack(packet['id'], packet['command'])
self.loop.create_task(task) | 0.008439 |
def _parse_file(cls, path, pickle=False):
"""parse a .chain file into a list of the type [(L{Chain}, arr, arr, arr) ...]
:param fname: name of the file"""
fname = path
if fname.endswith(".gz"):
fname = path[:-3]
if fname.endswith('.pkl'):
#you asked for... | 0.008741 |
def installStatsLoop(statsFile, statsDelay):
"""Installs an interval loop that dumps stats to a file."""
def dumpStats():
"""Actual stats dump function."""
scales.dumpStatsTo(statsFile)
reactor.callLater(statsDelay, dumpStats)
def startStats():
"""Starts the stats dump in "statsDelay" seconds.""... | 0.012346 |
async def _tcp_on_closed(self):
"""Invoked when the socket is closed."""
LOGGER.warning('Not connected to statsd, connecting in %s seconds',
self._tcp_reconnect_sleep)
await asyncio.sleep(self._tcp_reconnect_sleep)
self._sock = self._tcp_socket() | 0.006645 |
def read(cls, iprot):
'''
Read a new object from the given input protocol and return the object.
:type iprot: thryft.protocol._input_protocol._InputProtocol
:rtype: pastpy.gen.database.database_configuration.DatabaseConfiguration
'''
init_kwds = {}
iprot.read_s... | 0.005367 |
def decode_callbacks(encoded_callbacks):
"""Decode the callbacks to an executable form."""
from furious.async import Async
callbacks = {}
for event, callback in encoded_callbacks.iteritems():
if isinstance(callback, dict):
async_type = Async
if '_type' in callback:
... | 0.003584 |
def view(self, tempname='/tmp/tempimage'):
"""Display the image using casaviewer.
If the image is not persistent, a copy will be made that the user
has to delete once viewing has finished. The name of the copy can be
given in argument `tempname`. Default is '/tmp/tempimage'.
""... | 0.003053 |
def check_all_types(src_dict, sinks, sourceField):
# type: (Dict[Text, Any], List[Dict[Text, Any]], Text) -> Dict[Text, List[SrcSink]]
# sourceField is either "soure" or "outputSource"
"""Given a list of sinks, check if their types match with the types of their sources.
"""
validation = {"warning":... | 0.005295 |
def _parse_italics_and_bold(self):
"""Parse wiki-style italics and bold together (i.e., five ticks)."""
reset = self._head
try:
stack = self._parse(contexts.STYLE_BOLD)
except BadRoute:
self._head = reset
try:
stack = self._parse(contex... | 0.001371 |
async def write_deal(self, **params):
"""Writes deal to database
Accepts:
- cid
- access_type
- buyer public key
- seller public key
- price
- coinid
"""
if params.get("message"):
params = json.loads(params.get("message", "{}"))
if not params:
return {"error":400, "reason":"Missed require... | 0.0508 |
def set_library_names(self, *names):
"""
Set some common names of this library by which it may be referred during linking
:param names: Any number of string library names may be passed as varargs.
"""
for name in names:
self.names.append(name)
SIM_LIBRA... | 0.011869 |
def text_changed(self):
"""Text has changed"""
# Save text as bytes, if it was initially bytes
if self.is_binary:
self.text = to_binary_string(self.edit.toPlainText(), 'utf8')
else:
self.text = to_text_string(self.edit.toPlainText())
if self.btn_sav... | 0.004016 |
def getElements(self,name=''):
'Get a list of child elements'
#If no tag name is specified, return the all children
if not name:
return self.children
else:
# else return only those children with a matching tag name
elements = []
for element in self.children:
if element.name == name:
element... | 0.042135 |
def get(self, path, watch=None):
"""
Gets the content of a ZooKeeper node
:param path: Z-Path
:param watch: Watch method
"""
return self._zk.get(self.__path(path), watch=watch) | 0.008889 |
def get_meta(self, key, conforming=True):
"""
RETURN METADATA ON FILE IN BUCKET
:param key: KEY, OR PREFIX OF KEY
:param conforming: TEST IF THE KEY CONFORMS TO REQUIRED PATTERN
:return: METADATA, IF UNIQUE, ELSE ERROR
"""
try:
metas = list(self.bucke... | 0.002953 |
def get_key_from_cmdline(parser, args):
"""Return the signing key and signing algoritm from the commandline."""
if args.keyfiles:
signing_key = open(args.keyfiles[0], 'rb').read()
bits = get_keysize(signing_key)
if bits == 2048:
signing_algorithm = 'sha1'
elif bits ==... | 0.004354 |
def guess_lexer_for_filename(_fn, _text, **options):
"""
Lookup all lexers that handle those filenames primary (``filenames``)
or secondary (``alias_filenames``). Then run a text analysis for those
lexers and choose the best result.
usage::
>>> from pygments.lexers import guess_lexer_for_f... | 0.000535 |
def on_revert(request, page_name):
"""Revert an old revision."""
rev_id = request.args.get("rev", type=int)
old_revision = page = None
error = "No such revision"
if request.method == "POST" and request.form.get("cancel"):
return redirect(href(page_name))
if rev_id:
old_revisio... | 0.002261 |
def _matches_docs(self, docs, other_docs):
"""Overridable method."""
for doc, other_doc in zip(docs, other_docs):
if not self._match_map(doc, other_doc):
return False
return True | 0.008658 |
def parse_assignment(self, stream):
"""
AssignmentStmt ::= Name WSC AssignmentSymbol WSC Value StatementDelim
"""
lineno = stream.lineno
name = self.next_token(stream)
self.ensure_assignment(stream)
at_an_end = any((
self.has_end_group(stream),
... | 0.002759 |
def transition(self, inputSymbol):
"""
Transition between states, returning any outputs.
"""
outState, outputSymbols = self._automaton.outputForInput(self._state,
inputSymbol)
outTracer = None
if self._trace... | 0.003534 |
def set_cooling_motor(self, cooling_motor):
"""Set the cooling motor config.
:param cooling_motor: Value to set the cooling motor
:type cooling_motor: bool
:returns: None
:raises: InvalidInput
"""
if type(cooling_motor) != bool:
raise InvalidInput("Co... | 0.004444 |
def logged_exception(self, e):
"""Record the exception, but don't log it; it's already been logged
:param e: Exception to log.
"""
if str(e) not in self._errors:
self._errors.append(str(e))
self.set_error_state()
self.buildstate.state.exception_type = str(... | 0.005128 |
def get_top(self, *args, **kwargs):
"""Return a get_content generator for top submissions.
Corresponds to the submissions provided by
``https://www.reddit.com/top/`` for the session.
The additional parameters are passed directly into
:meth:`.get_content`. Note: the `url` parame... | 0.004717 |
def element_href_use_wildcard(name):
""" Get element href using a wildcard rather than matching only on the name
field. This will likely return multiple results.
:param name: name of element
:return: list of matched elements
"""
if name:
element = fetch_meta_by_name(name, exact_match=Fa... | 0.002841 |
def win_login():
"""登陆界面"""
email = input(EMAIL_INFO)
password = getpass.getpass(PASS_INFO)
captcha_id = get_captcha_id()
get_capthca_pic(captcha_id)
file = '/tmp/captcha_pic.jpg'
try:
from subprocess import call
from os.path import expanduser
call([expanduser('~') + ... | 0.00381 |
def _get_action_endpoint(action):
"""
Return the endpoint base on the view's action
:param action:
:return:
"""
_endpoint = None
if is_method(action):
if hasattr(action, "_rule_cache"):
rc = action._rule_cache
if rc:
k = list(rc.keys())[0]
... | 0.000972 |
def connect(self, port: str = None,
options: Any = None):
""" Connect to the robot hardware.
This function is provided for backwards compatibility. In most cases
it need not be called.
Calls to this method should be replaced with calls to
:py:meth:`.ProtocolCont... | 0.003297 |
def scourLength(length):
"""
Scours a length. Accepts units.
"""
length = SVGLength(length)
return scourUnitlessLength(length.value) + Unit.str(length.units) | 0.005618 |
def generate_url(self, expires_in, method='GET', headers=None,
query_auth=True, force_http=False, response_headers=None,
expires_in_absolute=False):
"""
Generate a URL to access this key.
:type expires_in: int
:param expires_in: How long the url... | 0.003512 |
def _conditional(Xnew, X, kern, f, *, full_cov=False, q_sqrt=None, white=False, full_output_cov=None):
"""
Given f, representing the GP at the points X, produce the mean and
(co-)variance of the GP at the points Xnew.
Additionally, there may be Gaussian uncertainty about f as represented by
q_sqrt.... | 0.002593 |
def indices(self):
""" dict {group name -> group indices} """
if len(self.groupings) == 1:
return self.groupings[0].indices
else:
label_list = [ping.labels for ping in self.groupings]
keys = [com.values_from_object(ping.group_index)
for pin... | 0.005076 |
def show_and_run(self):
"""Show the main widget in a window and run the gtk loop"""
self.display_widget = gtk.Window()
self.display_widget.add(self.widget)
self.display_widget.show()
BaseDelegate.show_and_run(self) | 0.007874 |
def get_usersettings_model():
"""
Returns the ``UserSettings`` model that is active in this project.
"""
try:
from django.apps import apps
get_model = apps.get_model
except ImportError:
from django.db.models.loading import get_model
try:
app_label, model_name = s... | 0.003681 |
def wait(self, delay):
"""
Wait at the current location for the specified number of iterations.
:param delay: The time to wait (in animation frames).
"""
for _ in range(0, delay):
self._add_step((self._rec_x, self._rec_y)) | 0.007273 |
def schedule_recurring(interval, target=None, maxtimes=0, starting_at=0,
args=(), kwargs=None):
"""insert a greenlet into the scheduler to run regularly at an interval
If provided a function, it is wrapped in a new greenlet
:param interval: the number of seconds between invocations
... | 0.000458 |
def logging_config(logpath=None,
level=logging.DEBUG,
console_level=logging.INFO,
no_console=False):
"""
Config the logging.
"""
logger = logging.getLogger('nli')
# Remove all the current handlers
for handler in logger.handlers:
lo... | 0.000999 |
def value(self, value):
"""Sets the DATA_OBJECT stored value."""
dtype = TYPES[type(value)] if self._type is None else self._type
lib.set_data_type(self._data, dtype)
lib.set_data_value(self._data, self.clips_value(value)) | 0.007843 |
def login_required(func):
"""
A wrapper around the flask_login.login_required.
But it also checks the presence of the decorator: @no_login_required
On a "@login_required" class, method containing "@no_login_required" will
still be able to access without authentication
:param func:
:return:
... | 0.001555 |
def no_moves(position):
"""
Finds if the game is over.
:type: position: Board
:rtype: bool
"""
return position.no_moves(color.white) \
or position.no_moves(color.black) | 0.004975 |
def sense_tta(self, target):
"""Activate the RF field and probe for a Type A Target.
The RC-S956 can discover all Type A Targets (Type 1 Tag, Type
2 Tag, and Type 4A Tag) at 106 kbps. Due to firmware
restrictions it is not possible to read a Type 1 Tag with
dynamic memory layout... | 0.002079 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.