text stringlengths 78 104k | score float64 0 0.18 |
|---|---|
def cross(self,p_i,p_j, max_depth = 2):
"""subtree-like swap crossover between programs p_i and p_j."""
# only choose crossover points for out_types available in both programs
# pdb.set_trace()
# determine possible outttypes
types_p_i = [t for t in [p.out_type for p in p_i]]
... | 0.01611 |
def jsonify_parameters(params):
"""
When sent in an authorized REST request, only strings and integers can be
transmitted accurately. Other types of data need to be encoded into JSON.
"""
result = {}
for param, value in params.items():
if isinstance(value, (int, str)):
result... | 0.002421 |
def cloud_cover_to_irradiance_liujordan(self, cloud_cover, **kwargs):
"""
Estimates irradiance from cloud cover in the following steps:
1. Determine transmittance using a function of cloud cover e.g.
:py:meth:`~ForecastModel.cloud_cover_to_transmittance_linear`
2. Calculate G... | 0.001456 |
def sign_input_at(self, start_index, private_key):
# type: (int, PrivateKey) -> None
"""
Signs the input at the specified index.
:param start_index:
The index of the first input transaction.
If necessary, the resulting signature will be split across
... | 0.003141 |
def resize(self, height, width):
"""
Resize the tty session.
Args:
height (int): Height of tty session
width (int): Width of tty session
Raises:
:py:class:`docker.errors.APIError`
If the server returns an error.
"""
re... | 0.005391 |
async def _send_reply(self, obj, reply):
"""Send a reply with added standard fields back to executor.
:param obj: The original Channels message object to which we're
replying.
:param reply: The message contents dictionary. The data id is
added automatically (``reply`` is... | 0.005338 |
def copy(self, inheritance=False):
# type: (bool) -> FactoryContext
"""
Returns a deep copy of the current FactoryContext instance
:param inheritance: If True, current handlers configurations are stored
as inherited ones
"""
# Create a new fac... | 0.003188 |
def __pty_make_controlling_tty(self, tty_fd):
"""This makes the pseudo-terminal the controlling tty. This should be
more portable than the pty.fork() function. Specifically, this should
work on Solaris. """
child_name = os.ttyname(tty_fd)
# Disconnect from controlling tty. Har... | 0.00848 |
def record_get_field(rec, tag, field_position_global=None,
field_position_local=None):
"""
Return the the matching field.
One has to enter either a global field position or a local field position.
:return: a list of subfield tuples (subfield code, value).
:rtype: list
"""
... | 0.00065 |
def _convert_odict_to_classes(self,
data,
clean=False,
merge=True,
pop_schema=True,
compare_to_existing=True,
filter... | 0.001482 |
def run(self):
"""
Run the EventHubClient in blocking mode.
Opens the connection and starts running all Sender/Receiver clients.
Returns a list of the start up results. For a succcesful client start the
result will be `None`, otherwise the exception raised.
If all clients... | 0.005718 |
def parse_coach_go(infile):
"""Parse a GO output file from COACH and return a rank-ordered list of GO term predictions
The columns in all files are: GO terms, Confidence score, Name of GO terms. The files are:
- GO_MF.dat - GO terms in 'molecular function'
- GO_BP.dat - GO terms in 'bi... | 0.004651 |
def group(self, index, chunked=False):
""" Returns a list of Word objects that match the given group.
With chunked=True, returns a list of Word + Chunk objects - see Match.constituents().
A group consists of consecutive constraints wrapped in { }, e.g.,
search("{JJ JJ} NN", S... | 0.005747 |
def mask_hash(hash, show=6, char="*"):
"""
Return the given hash, with only the first ``show`` number shown. The
rest are masked with ``char`` for security reasons.
"""
masked = hash[:show]
masked += char * len(hash[show:])
return masked | 0.003774 |
def quadrature_scheme_lognormal_quantiles(
loc, scale, quadrature_size,
validate_args=False, name=None):
"""Use LogNormal quantiles to form quadrature on positive-reals.
Args:
loc: `float`-like (batch of) scalar `Tensor`; the location parameter of
the LogNormal prior.
scale: `float`-like (bat... | 0.006093 |
def techport(Id):
'''
In order to use this capability, queries can be issued to the system with the following URI
format:
GET /xml-api/id_parameter
Parameter Required? Value Description
id_parameter Yes Type: String
Default: None
The id value of the TechPort record.
TechPort values r... | 0.004111 |
def _extract_from_sans(self):
"""Looks for different TLDs as well as different sub-domains in SAN list"""
self.logger.info("{} Trying to find Subdomains in SANs list".format(COLORED_COMBOS.NOTIFY))
if self.host.naked:
domain = self.host.naked
tld_less = domain.split(".")[... | 0.008721 |
def display(self, codes=[], fg=None, bg=None):
"""Displays the codes using ANSI escapes
"""
codes, fg, bg = Magic.displayformat(codes, fg, bg)
self.stream.write(Magic.display(codes, fg, bg))
self.flush() | 0.00823 |
def _array_newton(func, x0, fprime, args, tol, maxiter, fprime2,
converged=False):
"""
A vectorized version of Newton, Halley, and secant methods for arrays. Do
not use this method directly. This method is called from :func:`newton`
when ``np.isscalar(x0)`` is true. For docstring, see ... | 0.000249 |
def calc_grad(self):
"""The gradient of the cost w.r.t. the parameters."""
residuals = self.calc_residuals()
return 2*np.dot(self.J, residuals) | 0.011976 |
def compute_hr(sig_len, qrs_inds, fs):
"""
Compute instantaneous heart rate from peak indices.
Parameters
----------
sig_len : int
The length of the corresponding signal
qrs_inds : numpy array
The qrs index locations
fs : int, or float
The corresponding signal's samp... | 0.001025 |
def init_session(self):
"""create our session object"""
default_secure(self.config)
self.session = Session(config=self.config, username=u'kernel') | 0.011765 |
def reqContractDetails(self, contract: Contract) -> List[ContractDetails]:
"""
Get a list of contract details that match the given contract.
If the returned list is empty then the contract is not known;
If the list has multiple values then the contract is ambiguous.
The fully qu... | 0.003026 |
def helical_laminar_fd_White(Re, Di, Dc):
r'''Calculates Darcy friction factor for a fluid flowing inside a curved
pipe such as a helical coil under laminar conditions, using the method of
White [1]_ as shown in [2]_.
.. math::
f_{curved} = f_{\text{straight,laminar}} \left[1 - \left(1-\l... | 0.006509 |
def update(self, calendar_item_update_operation_type=u'SendToAllAndSaveCopy', **kwargs):
"""
Updates an event in Exchange. ::
event = service.calendar().get_event(id='KEY HERE')
event.location = u'New location'
event.update()
If no changes to the event have been made, this method ... | 0.009567 |
def DeleteArtifact(self, name, cursor=None):
"""Deletes an artifact with given name from the database."""
cursor.execute("DELETE FROM artifacts WHERE name = %s", [name])
if cursor.rowcount == 0:
raise db.UnknownArtifactError(name) | 0.008 |
def _dump_point(obj, decimals):
"""
Dump a GeoJSON-like Point object to WKT.
:param dict obj:
A GeoJSON-like `dict` representing a Point.
:param int decimals:
int which indicates the number of digits to display after the
decimal point when formatting coordinates.
:returns:
... | 0.001828 |
def copy_spline_array(a):
"""
This returns an instance of a new spline_array with all the fixins, and the data from a.
"""
b = spline_array()
b.x_splines = a.x_splines
b.y_splines = a.y_splines
b.max_y_splines = a.max_y_splines
b.xmin = a.xmin
b.xmax = a.xmax
b.ymin = a.ym... | 0.012295 |
def widget(self, which_viz='viz'):
'''
Generate a widget visualization using the widget. The export_viz_to_widget
method passes the visualization JSON to the instantiated widget, which is
returned and visualized on the front-end.
'''
if hasattr(self, 'widget_class') == True:
self.widget_in... | 0.017544 |
def _expand_glob_path(file_roots):
'''
Applies shell globbing to a set of directories and returns
the expanded paths
'''
unglobbed_path = []
for path in file_roots:
try:
if glob.has_magic(path):
unglobbed_path.extend(glob.glob(path))
else:
... | 0.002237 |
def current_id(self):
"""
Determine the current revision identifier for the working directory
of this Repository
Returns:
str: git HEAD revision identifier
(``git rev-parse --short HEAD``)
"""
try:
cmd = ['git', 'rev-parse', '--sho... | 0.008251 |
def copy(self):
"""Create a shallow copy of self.
This runs in O(len(self.num_unique_elements()))
"""
out = self._from_iterable(None)
out._dict = self._dict.copy()
out._size = self._size
return out | 0.042453 |
def _sysv_services():
'''
Return list of sysv services.
'''
_services = []
output = __salt__['cmd.run'](['chkconfig', '--list'], python_shell=False)
for line in output.splitlines():
comps = line.split()
try:
if comps[1].startswith('0:'):
_services.appe... | 0.002 |
def check_user_can_review(recID, client_ip_address, uid=-1):
""" Check if a user hasn't already reviewed within the last seconds
time limit: CFG_WEBCOMMENT_TIMELIMIT_PROCESSING_REVIEWS_IN_SECONDS
:param recID: record ID
:param client_ip_address: IP => use: str(req.remote_ip)
:param uid: user id, as ... | 0.001166 |
def send(self, event):
"""Send the event to the standard python logger"""
event_str = json.dumps(event, cls=DateTimeJSONEncoder)
# TODO: do something smarter than simply dropping the event on
# the floor.
if self.max_event_size is None or len(event_str) <= self.max_event_size:
... | 0.008571 |
def write_to_hub(self, sid, **kwargs):
"""Send data to gateway to turn on / off device"""
if self.key is None:
_LOGGER.error('Gateway Key is not provided. Can not send commands to the gateway.')
return False
data = {}
for key in kwargs:
data[key] = kwa... | 0.003978 |
def save_method_args(method):
"""
Wrap a method such that when it is called, the args and kwargs are
saved on the method.
>>> class MyClass:
... @save_method_args
... def method(self, a, b):
... print(a, b)
>>> my_ob = MyClass()
>>> my_ob.method(1, 2)
1 2
>>> my_ob._saved_method.args
(1, 2)... | 0.03662 |
def _dump(self):
"""
Dump message attributes.
Returns:
dict: A dictionary of message attributes.
"""
return {
"topic": self.topic,
"headers": self._headers,
"id": self.id,
"body": self.body,
"queue": self.qu... | 0.005988 |
def incompatibilities_for(
self, package
): # type: (DependencyPackage) -> List[Incompatibility]
"""
Returns incompatibilities that encapsulate a given package's dependencies,
or that it can't be safely selected.
If multiple subsequent versions of this package have the same... | 0.003121 |
def owners(self):
'''Read-only list of object owners, separated by the configured
:attr:`OWNER_ID_SEPARATOR`, with whitespace stripped.'''
return [o.strip() for o in self.owner.split(self.OWNER_ID_SEPARATOR)] | 0.008621 |
def threshold_monitor_hidden_threshold_monitor_security_policy_sec_policy_name(self, **kwargs):
"""Auto Generated Code
"""
config = ET.Element("config")
threshold_monitor_hidden = ET.SubElement(config, "threshold-monitor-hidden", xmlns="urn:brocade.com:mgmt:brocade-threshold-monitor")
... | 0.006757 |
def _matching_string(matched, string):
"""Return the string as byte or unicode depending
on the type of matched, assuming string is an ASCII string.
"""
if string is None:
return string
if IS_PY2:
# pylint: disable=undefined-variable
if isinsta... | 0.00354 |
def url_unquote_plus(s, charset="utf-8", errors="replace"):
"""URL decode a single string with the given `charset` and decode "+" to
whitespace.
Per default encoding errors are ignored. If you want a different behavior
you can set `errors` to ``'replace'`` or ``'strict'``. In strict mode a
:exc:`... | 0.001348 |
def delete_repository_config(namespace, name, snapshot_id):
"""Redacts a configuration and all of its associated configurations.
The configuration should exist in the methods repository.
Args:
namespace (str): configuration namespace
configuration (str): configuration name
snapshot... | 0.001686 |
def _get_interpreter_info(interpreter=None):
"""Return the interpreter's full path using pythonX.Y format."""
if interpreter is None:
# If interpreter is None by default returns the current interpreter data.
major, minor = sys.version_info[:2]
executable = sys.executable
else:
... | 0.002915 |
def fmtradec (rarad, decrad, precision=2, raseps='::', decseps='::', intersep=' '):
"""Format equatorial coordinates in a single sexagesimal string.
Returns a string of the RA/lon coordinate, formatted as sexagesimal hours,
then *intersep*, then the Dec/lat coordinate, formatted as degrees. This
yields... | 0.003306 |
def get_matches_lineno(code, fn_name):
"Return a list of line number corresponding to the definition of function with the name fn_name"
class Walker(ast.NodeVisitor):
def __init__(self):
self._hits = set()
#pylint: disable=E0213,E1102
def onvisit(fn):
def wra... | 0.009828 |
def css(self) -> str:
"""Generate a random snippet of CSS.
:return: CSS.
"""
selector = self.random.choice(CSS_SELECTORS)
css_sel = '{}{}'.format(selector, self.__text.word())
cont_tag = self.random.choice(list(HTML_CONTAINER_TAGS.keys()))
mrk_tag = self.random.... | 0.00349 |
def _has_file_rolled(self):
"""Check if the file has been rolled"""
# if the size is smaller then before, the file has
# probabilly been rolled
if self._fh:
size = self._getsize_of_current_file()
if size < self.oldsize:
return True
sel... | 0.005587 |
def _virt_call(domain, function, section, comment,
connection=None, username=None, password=None, **kwargs):
'''
Helper to call the virt functions. Wildcards supported.
:param domain:
:param function:
:param section:
:param comment:
:return:
'''
ret = {'name': domain,... | 0.002551 |
def load(fp, encoding=None, cls=JSONTreeDecoder, object_hook=None,
parse_float=None, parse_int=None, parse_constant=None,
object_pairs_hook=None, **kargs):
"""JSON load from file function that defaults the loading class to be
JSONTreeDecoder
"""
return json.load(fp, encoding, cls, obje... | 0.007246 |
def once(dispatcher, event, handle, *args):
"""
Used to do a mapping like event -> handle
but handle is called just once upon event.
"""
def shell(dispatcher, *args):
try:
handle(dispatcher, *args)
except Exception as e:
raise e
finally:
d... | 0.002532 |
def resolve_sam_resource_id_refs(self, input, supported_resource_id_refs):
"""
Some SAM resources have their logical ids mutated from the original id that the customer writes in the
template. This method recursively walks the tree and updates these logical ids from the old value
to the n... | 0.008596 |
def configure(host=DEFAULT_HOST, port=DEFAULT_PORT):
"""
>>> configure('localhost', 9011)
"""
global __logger
__logger = UDPLogger(host, port) | 0.006173 |
def _analemma_suns(self):
"""Calculate times that should be used for drawing analemma_curves.
Returns:
A list of list of analemma suns.
"""
for h in xrange(0, 24):
if self._analemma_position(h) < 0:
continue
elif self._analemma_positio... | 0.001481 |
def argument(self, *args, **kwargs):
"""
Registers a click.argument which falls back to a configmanager Item
if user hasn't provided a value in the command line.
Item must be the last of ``args``.
"""
if kwargs.get('required', True):
raise TypeError(
... | 0.005831 |
def StaticForEach(parentUnit, items, bodyFn, name=""):
"""
Generate for loop for static items
:param parentUnit: unit where this code should be instantiated
:param items: items which this "for" itering on
:param bodyFn: function which fn(item, index) or fn(item)
returns (statementList, ack)... | 0.000623 |
def username_user_password(self, **kwargs):
"""Auto Generated Code
"""
config = ET.Element("config")
username = ET.SubElement(config, "username", xmlns="urn:brocade.com:mgmt:brocade-aaa")
name_key = ET.SubElement(username, "name")
name_key.text = kwargs.pop('name')
... | 0.005703 |
def mnist_tutorial(train_start=0, train_end=60000, test_start=0,
test_end=10000, nb_epochs=NB_EPOCHS, batch_size=BATCH_SIZE,
learning_rate=LEARNING_RATE,
clean_train=CLEAN_TRAIN,
testing=False,
backprop_through_attack=BACKPRO... | 0.007969 |
def get_default_compartment(model):
"""Return what the default compartment should be set to.
If some compounds have no compartment, unique compartment
name is returned to avoid collisions.
"""
default_compartment = 'c'
default_key = set()
for reaction in model.reactions:
equation = ... | 0.000992 |
def _record(self, value, rank, delta, successor):
"""Catalogs a sample."""
self._observations += 1
self._items += 1
return _Sample(value, rank, delta, successor) | 0.010309 |
def run_analysis( named_analysis, prepared_analyses=None,log_dir=default_log_dir):
"""
Runs just the named analysis. Otherwise just like run_analyses
"""
if prepared_analyses == None:
prepared_analyses = prepare_analyses()
state_collection = funtool.state_collection.StateCollection([],{})
... | 0.015238 |
def _get_secrets(self, secure_data_path, version=None):
"""
Return full json secrets based on the secure data path
Keyword arguments:
secure_data_path (string) -- full path in the secret deposit box that contains the key
/shared/sdb-path/secret
... | 0.007278 |
def _send(self):
"""
Convert message to a json object and send to Lognetries
"""
while len(self.queue) > 0:
metric = self.queue.popleft()
topic, value, timestamp = str(metric).split()
msg = json.dumps({"event": {topic: value}})
req = urllib... | 0.003361 |
def parse(self, limit=None):
"""
:param limit:
:return:
"""
if limit is not None:
LOG.info("Only parsing first %s rows fo each file", str(limit))
LOG.info("Parsing files...")
if self.test_only:
self.test_mode = True
self._proces... | 0.001696 |
def get_refresh_flag(self, filename):
""" set refresh data flag
return True or False
"""
if filename is not None and filename != self.open_filename:
self.open_filename = filename
self.tree_refresh_flag = True
self.data_refresh_flag = True
... | 0.005362 |
def zone_absent(domain, profile):
'''
Ensures a record is absent.
:param domain: Zone name, i.e. the domain name
:type domain: ``str``
:param profile: The profile key
:type profile: ``str``
'''
zones = __salt__['libcloud_dns.list_zones'](profile)
matching_zone = [z for z in zones... | 0.003367 |
def parse_text(self, text):
"""
Parse the given text and return a list of :class:`~taxi.timesheet.lines.DateLine`,
:class:`~taxi.timesheet.lines.Entry`, and :class:`~taxi.timesheet.lines.TextLine` objects. If there's an
error during parsing, a :exc:`taxi.exceptions.ParseError` will be ra... | 0.005324 |
def update_xml_element(self):
"""
Updates the xml element contents to matches the instance contents.
:returns: Updated XML element.
:rtype: lxml.etree._Element
"""
super(Description, self).update_xml_element()
if hasattr(self, 'lang'):
self.xml_elem... | 0.003724 |
def get(self, url, **kwargs):
"""Send a GET request to the specified URL.
Method directly wraps around `Session.get` and updates browser
attributes.
<http://docs.python-requests.org/en/master/api/#requests.get>
Args:
url: URL for the new `Request` object.
... | 0.003339 |
def get_ffmpeg_exe():
"""
Return path to ffmpeg executable
"""
if 'FFMPEG_PATH' in os.environ:
ffmpeg_exe = os.environ['FFMPEG_PATH']
else:
ffmpeg_exe = which('ffmpeg')
if not ffmpeg_exe:
if which('avconv'):
raise FFmpegNormalizeError(
"avconv... | 0.001534 |
def _save_s3(self, temp_file, filename, obj):
"""Saves the specified file to the configured S3 bucket."""
conn = S3Connection(self.access_key_id, self.access_key_secret)
bucket = conn.get_bucket(self.bucket_name)
path = self._get_s3_path(filename)
k = bucket.new_key(path)
... | 0.003914 |
def fromxml(node):
"""Static method return an OutputTemplate instance from the given XML description. Node can be a string or an etree._Element."""
if not isinstance(node,ElementTree._Element): #pylint: disable=protected-access
node = parsexmlstring(node)
assert node.tag.lower() == '... | 0.010145 |
def _get_total_services_problems_unhandled(self):
"""Get the number of services that are a problem and that are not acknowledged
:return: number of problem services which are not acknowledged
:rtype: int
"""
return sum(1 for s in self.services if s.is_problem and not s.problem_h... | 0.01173 |
def acquire_gpus(requested_device_ids: List[int], lock_dir: str = "/tmp",
retry_wait_min: int = 10, retry_wait_rand: int = 60,
num_gpus_available: Optional[int] = None):
"""
Acquire a number of GPUs in a transactional way. This method should be used inside a `with` statement.
... | 0.005459 |
def post_internal_command(self, int_cmd, thread_id):
""" if thread_id is *, post to the '*' queue"""
queue = self.get_internal_queue(thread_id)
queue.put(int_cmd) | 0.010753 |
def bind (self, event, callback):
"""
Bind an event to a call function and ensure that it is called for the
specified event
:param event: the event that should trigger the callback
:type event: str
:param callback: the function that should be called
:rtype callbac... | 0.008147 |
def auto_index(mcs):
"""Builds all indices, listed in model's Meta class.
>>> class SomeModel(Model)
... class Meta:
... indices = (
... Index('foo'),
... )
.. note:: this will result in calls to
:... | 0.003591 |
def update(instance, full_clean=True, post_save=False, **kwargs):
"Atomically update instance, setting field/value pairs from kwargs"
# apply the updated args to the instance to mimic the change
# note that these might slightly differ from the true database values
# as the DB could have been updated by... | 0.001718 |
def get_perceel_by_id(self, id):
'''
Retrieve a `Perceel` by the Id.
:param string id: the Id of the `Perceel`
:rtype: :class:`Perceel`
'''
def creator():
res = crab_gateway_request(
self.client, 'GetPerceelByIdentificatorPerceel', id
... | 0.00283 |
def init_base_logging(directory="./log", verbose=0, silent=False, color=False, no_file=False,
truncate=True, config_location=None):
"""
Initialize the Icetea logging by creating a directory to store logs
for this run and initialize the console logger for Icetea itself.
:param dire... | 0.002757 |
def change_numbering(self, rename_dict, inplace=False):
"""Return the reindexed version of Cartesian.
Args:
rename_dict (dict): A dictionary mapping integers on integers.
Returns:
Cartesian: A renamed copy according to the dictionary passed.
"""
output =... | 0.003953 |
def build_component(res, parent=None):
"Create a gui2py control based on the python resource"
# control specs (parameters)
kwargs = dict(res.items())
comtype = kwargs.pop('type')
if 'components' in res:
components = kwargs.pop('components')
elif comtype == 'Menu' and 'items' in res:
... | 0.003319 |
def kill(self, ti):
"""
Kill (cancel) a Qubole command
:param ti: Task Instance of the dag, used to determine the Quboles command id
:return: response from Qubole
"""
if self.cmd is None:
if not ti and not self.task_instance:
raise Exception("U... | 0.007022 |
def normal_noise(points):
"""Init a noise variable."""
return np.random.rand(1) * np.random.randn(points, 1) \
+ random.sample([2, -2], 1) | 0.006494 |
def get_log_formats(config):
"""
Parse config for log_format directives
:return: iterator over ('format name', 'format string') tuple of found directives
"""
# log_format name [params]
log_format = Literal('log_format') + parameter + Group(OneOrMore(parameter)) + semicolon
log_format.ignore(... | 0.005871 |
def reset(self):
"""
resets the storage if it supports being reset
"""
try:
self._storage.reset()
self.logger.info("Storage has been reset and all limits cleared")
except NotImplementedError:
self.logger.warning("This storage type does not supp... | 0.008902 |
def _prepare_sample(data, run_folder):
"""Extract passed keywords from input LIMS information.
"""
want = set(["description", "files", "genome_build", "name", "analysis", "upload", "algorithm"])
out = {}
for k, v in data.items():
if k in want:
out[k] = _relative_paths(v, run_fold... | 0.002967 |
def create_parser(default_name: str) -> argparse.ArgumentParser:
"""
Creates the default brewblox_service ArgumentParser.
Service-agnostic arguments are added.
The parser allows calling code to add additional arguments before using it in create_app()
Args:
default_name (str):
d... | 0.002779 |
def play_NoteContainer(self, nc, channel=1, velocity=100):
"""Play the Notes in the NoteContainer nc."""
self.notify_listeners(self.MSG_PLAY_NC, {'notes': nc,
'channel': channel, 'velocity': velocity})
if nc is None:
return True
for note in nc:
if not ... | 0.007335 |
def build_reduce(function: Callable[[Any, Any], Any] = None, *,
init: Any = NONE):
""" Decorator to wrap a function to return a Reduce operator.
:param function: function to be wrapped
:param init: optional initialization for state
"""
_init = init
def _build_reduce(function: ... | 0.001397 |
def hide(self):
"""Hides the main window of the terminal and sets the visible
flag to False.
"""
if not HidePrevention(self.window).may_hide():
return
self.hidden = True
self.get_widget('window-root').unstick()
self.window.hide() | 0.006734 |
def write_without_mac(self, data, block):
"""Write a data block without integrity check.
This is the standard write method for a FeliCa Lite. The
16-byte string or bytearray *data* is written to the numbered
*block* in service 0x0009 (NDEF write service). ::
data = bytearra... | 0.002077 |
def sync_entities_watching(instance):
"""
Syncs entities watching changes of a model instance.
"""
for entity_model, entity_model_getter in entity_registry.entity_watching[instance.__class__]:
model_objs = list(entity_model_getter(instance))
if model_objs:
sync_entities(*mode... | 0.006116 |
def bounds(self):
"""Process bounds as defined in the configuration."""
if self._raw["bounds"] is None:
return self.process_pyramid.bounds
else:
return Bounds(*_validate_bounds(self._raw["bounds"])) | 0.00813 |
def plotdata(self, key, part='re', scale='log', steps=50):
"""Return a tuple of arrays x, y that can be fed to plt.plot,
where x is the scale in GeV and y is the parameter of interest.
Parameters:
- key: dicionary key of the parameter to be plotted (e.g. a WCxf
coefficient na... | 0.001768 |
def send_keys(self, keyString):
"""
Send a sequence of keys via keyboard events
Usage: C{keyboard.send_keys(keyString)}
@param keyString: string of keys (including special keys) to send
"""
assert type(keyString) is str
self.mediator.interface.be... | 0.008715 |
def cli(ctx, hpo_term, check_terms, output, p_value_limit, verbose, username,
password, to_json):
"Give hpo terms either on the form 'HP:0001623', or '0001623'"
loglevel = LEVELS.get(min(verbose, 3))
configure_stream(level=loglevel)
if not hpo_term:
logger.info("Please specify ... | 0.004978 |
def hostname_is_compatible(conn, logger, provided_hostname):
"""
Make sure that the host that we are connecting to has the same value as the
`hostname` in the remote host, otherwise mons can fail not reaching quorum.
"""
logger.debug('determining if provided host has same hostname in remote')
re... | 0.002642 |
def form_valid(self, form):
if self.__pk:
obj = PurchasesAlbaran.objects.get(pk=self.__pk)
self.request.albaran = obj
form.instance.albaran = obj
form.instance.validator_user = self.request.user
raise Exception("revisar StorageBatch")
"""
bat... | 0.003316 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.