text stringlengths 78 104k | score float64 0 0.18 |
|---|---|
def _handle_force_timeout(self) -> None:
"""Called by IOLoop periodically to ask libcurl to process any
events it may have forgotten about.
"""
while True:
try:
ret, num_handles = self._multi.socket_all()
except pycurl.error as e:
r... | 0.004474 |
def explain_weights_dfs(estimator, **kwargs):
# type: (...) -> Dict[str, pd.DataFrame]
""" Explain weights and export them to a dict with ``pandas.DataFrame``
values (as :func:`eli5.formatters.as_dataframe.format_as_dataframes` does).
All keyword arguments are passed to :func:`eli5.explain_weights`.
... | 0.002016 |
def _sge_info(queue):
"""Returns machine information for an sge job scheduler.
"""
qhost_out = subprocess.check_output(["qhost", "-q", "-xml"]).decode()
qstat_queue = ["-q", queue] if queue and "," not in queue else []
qstat_out = subprocess.check_output(["qstat", "-f", "-xml"] + qstat_queue).decode... | 0.004975 |
def init_config_files(self):
"""[optionally] copy default config files into profile dir."""
# copy config files
path = self.builtin_profile_dir
if self.copy_config_files:
src = self.profile
cfg = self.config_file_name
if path and os.path.exists(os.pat... | 0.004608 |
def gibbs_binding_energy(self, eads=False):
"""
Returns the adsorption energy or Gibb's binding energy
of an adsorbate on a surface
Args:
eads (bool): Whether to calculate the adsorption energy
(True) or the binding energy (False) which is just
... | 0.004673 |
def _write_submit_script(self, template, script_filename, job_name, configs):
"""Generate submit script and write it to a file.
Args:
- template (string) : The template string to be used for the writing submit script
- script_filename (string) : Name of the submit script
... | 0.003971 |
def process_result(self, new_sia, min_sia):
"""Check if the new SIA has smaller |big_phi| than the standing
result.
"""
if new_sia.phi == 0:
self.done = True # Short-circuit
return new_sia
elif new_sia < min_sia:
return new_sia
retur... | 0.006079 |
def translate_style(style, colormode, colorpalette):
"""
Translate the given style to an ANSI escape code
sequence.
``style`` examples are:
* green
* bold
* red_on_black
* bold_green
* italic_yellow_on_cyan
:param str style: the style to translate
:param int colormode: the... | 0.001862 |
def _delete_transmissions(self, content_metadata_item_ids):
"""
Delete ContentMetadataItemTransmision models associated with the given content metadata items.
"""
# pylint: disable=invalid-name
ContentMetadataItemTransmission = apps.get_model(
'integrated_channel',
... | 0.007508 |
def download(self, name, ids, datas=None, context=None):
"""Download a report from the server and return it as a remote file.
For instance, to download the "Quotation / Order" report of sale orders
identified by the IDs ``[2, 3]``:
.. doctest::
:options: +SKIP
>... | 0.000591 |
def _prepare_data_XYX0(self, X, Y, X_base, X_res, D, F, run_TRs,
no_DC=False):
"""Prepares different forms of products between design matrix X or
data Y or nuisance regressors X0.
These products are re-used a lot during fitting.
So we pre-calculate ... | 0.002045 |
def write_cycle(filename, graph, cycle, directed):
"""Write an eulerian tour in DOT format
:param filename: the file to be written in DOT format
:param graph: graph in listlist format, cannot be listdict
:param bool directed: describes the graph
:param cycle: tour as a vertex list
... | 0.00149 |
def process(fname, allow_type):
"""Process a file."""
fname = str(fname)
# HACK: ignore op.h which is automatically generated
if fname.endswith('op.h'):
return
arr = fname.rsplit('.', 1)
if fname.find('#') != -1 or arr[-1] not in allow_type:
return
if arr[-1] in CXX_SUFFIX:
... | 0.00464 |
def skyimage_figure(cluster):
"""
Given a cluster create a Bokeh plot figure using the
cluster's image.
"""
pf_image = figure(x_range=(0, 1), y_range=(0, 1),
title='Image of {0}'.format(cluster.name))
pf_image.image_url(url=[cluster.image_path],
x=0, ... | 0.002237 |
def status(name, *args, **kwargs):
'''
Return the status for a service.
If the name contains globbing, a dict mapping service name to True/False
values is returned.
.. versionchanged:: 2018.3.0
The service name can now be a glob (e.g. ``salt*``)
Args:
name (str): The name of th... | 0.002045 |
def delFromTimeVary(self,*params):
'''
Removes any number of parameters from time_vary for this instance.
Parameters
----------
params : string
Any number of strings naming attributes to be removed from time_vary
Returns
-------
None
... | 0.009153 |
def set(self, dic, val=None, force=False):
"""set can assign versatile options from
`CMAOptions.versatile_options()` with a new value, use `init()`
for the others.
Arguments
---------
`dic`
either a dictionary or a key. In the latter
c... | 0.004058 |
def _split_props(thing, doc):
"""
Separate properties from other kinds of member.
"""
props = inspect.getmembers(thing, lambda o: isinstance(o, property))
ps = []
docs = [
(*_get_names(names, types), names, types, desc) for names, types, desc in doc
]
for prop_name, prop in props... | 0.003333 |
def description(self):
"this is only a property so it can raise; make it an attr once it works"
if self.lastx is None: return
if type(self.lastx) not in (sqparse2.SelectX,sqparse2.UpdateX,sqparse2.InsertX): return
if type(self.lastx) in (sqparse2.UpdateX,sqparse2.InsertX) and self.lastx.ret is None: ret... | 0.024242 |
def tracer_diffusion_coefficient( self ):
"""
Tracer diffusion coefficient, D*.
Args:
None
Returns:
(Float): The tracer diffusion coefficient, D*.
"""
if self.has_run:
return self.atoms.sum_dr_squared() / ( 6.0 * float( self.number_of... | 0.023196 |
def _find_usage_elbv1(self):
"""
Find usage for ELBv1 / Classic ELB and update the appropriate limits.
:returns: number of Classic ELBs in use
:rtype: int
"""
logger.debug("Checking usage for ELBv1")
self.connect()
lbs = paginate_dict(
self.co... | 0.001682 |
def _parse_linux_cx_state(self, lines, tcp_states, state_col, protocol=None, ip_version=None):
"""
Parse the output of the command that retrieves the connection state (either `ss` or `netstat`)
Returns a dict metric_name -> value
"""
metrics = {}
for _, val in iteritems(s... | 0.007491 |
def clockIsBroken():
"""
Returns whether twisted.internet.task.Clock has the bug that
returns the wrong DelayedCall or not.
"""
clock = Clock()
dc1 = clock.callLater(10, lambda: None)
dc2 = clock.callLater(1, lambda: None)
if dc1 is dc2:
return True
else:
return False | 0.003125 |
def fill_livetime_hist(skydir, tab_sc, tab_gti, zmax, costh_edges):
"""Generate a sequence of livetime distributions at the sky
positions given by ``skydir``. The output of the method are two
NxM arrays containing a sequence of histograms for N sky positions
and M incidence angle bins where the bin edg... | 0.001271 |
def _add_extra_files(self, files):
'''if extra files are to be analyzed with an sosreport, this will add them to the origin path to be analyzed'''
try:
for f in files:
self.logger.con_out("adding additional file for analysis: %s" % f)
fname = os.path.basenam... | 0.010139 |
def save(self, io, little_endian=False):
"""
Saves the `NBTFile()` to `io`, which can be any file-like object
providing `write()`.
"""
if little_endian:
write = lambda fmt, *args: io.write(pack('<' + fmt, *args))
else:
write = lambda fmt, *args: io... | 0.010025 |
def p_simple_command_element(p):
'''simple_command_element : WORD
| ASSIGNMENT_WORD
| redirection'''
if isinstance(p[1], ast.node):
p[0] = [p[1]]
return
parserobj = p.context
p[0] = [_expandword(parserobj, p.slice[1])]
# c... | 0.002132 |
def bovy_end_print(filename,**kwargs):
"""
NAME:
bovy_end_print
PURPOSE:
saves the current figure(s) to filename
INPUT:
filename - filename for plot (with extension)
OPTIONAL INPUTS:
format - file-format
OUTPUT:
(none)
HISTORY:
2009-12-23 ... | 0.011385 |
def render_like(parser, token):
"""
{% likes user as like_list %}
<ul>
{% for like in like_list %}
<li>{% render_like like %}</li>
{% endfor %}
</ul>
"""
tokens = token.split_contents()
var = tokens[1]
return LikeRenderer(var) | 0.003472 |
def _update_result(self, result, insertions, dimension_index):
"""Insert subtotals into resulting ndarray."""
for j, (ind_insertion, value) in enumerate(insertions):
result = np.insert(
result, ind_insertion + j + 1, value, axis=dimension_index
)
return re... | 0.006173 |
def response_received(self, response):
"""
Called when a response to a job RPC has been received. Decodes the
response and finalizes the result, then reports the result to the
job manager.
"""
if self._closed:
return
assert self._job is not None
... | 0.003953 |
def holm(pvals, alpha=.05):
"""P-values correction with Holm method.
Parameters
----------
pvals : array_like
Array of p-values of the individual tests.
alpha : float
Error rate (= alpha level).
Returns
-------
reject : array, bool
True if a hypothesis is reject... | 0.000359 |
def eth_sign_sha3(data: bytes) -> bytes:
"""
eth_sign/recover compatible hasher
Prefixes data with "\x19Ethereum Signed Message:\n<len(data)>"
"""
prefix = b'\x19Ethereum Signed Message:\n'
if not data.startswith(prefix):
data = prefix + b'%d%s' % (len(data), data)
return keccak(data... | 0.003115 |
def apply_T6(word):
'''If a VVV-sequence contains a long vowel, there is a syllable boundary
between it and the third vowel, e.g. [kor.ke.aa], [yh.ti.öön], [ruu.an],
[mää.yt.te].'''
T6 = ''
WORD = word.split('.')
for i, v in enumerate(WORD):
if contains_VVV(v):
VV = [v.find... | 0.002793 |
def get_data_dir(module_name: str) -> str:
"""Ensure the appropriate Bio2BEL data directory exists for the given module, then returns the file path.
:param module_name: The name of the module. Ex: 'chembl'
:return: The module's data directory
"""
module_name = module_name.lower()
data_dir = os.... | 0.004808 |
def schaffer(self, x):
""" Schaffer function x0 in [-100..100]"""
N = len(x)
s = x[0:N - 1]**2 + x[1:N]**2
return sum(s**0.25 * (np.sin(50 * s**0.1)**2 + 1)) | 0.010582 |
def rguiding(self,*args,**kwargs):
"""
NAME:
rguiding
PURPOSE:
calculate the guiding-center radius (the radius of a circular orbit with the same angular momentum)
INPUT:
pot= potential instance or list of such instances
ro= (Object-wide d... | 0.014615 |
def denoise_z15():
"""Replace tokens instead of masking."""
hparams = xmoe2_dense_0()
hparams.decoder_type = "denoising"
hparams.noising_spec_train = {"type": "random_zipfian", "prob": 0.15}
hparams.noising_use_eval_during_train = 0.25
return hparams | 0.026718 |
def is_list_of_states(self, arg):
"""
A list of states example -
[('x1', 'easy'), ('x2', 'hard')]
Returns
-------
True, if arg is a list of states else False.
"""
return isinstance(arg, list) and all(isinstance(i, tuple) for i in arg) | 0.006667 |
def lookup(self, language_ranges):
"""
Perform an RFC4647 language range lookup on the keys in the
dictionary. `language_ranges` must be a sequence of
:class:`LanguageRange` instances.
Return the entry in the dictionary with a key as produced by
`lookup_language`. If `lo... | 0.00277 |
def recursive_symlink_dirs(source_d, destination_d):
'''
Create dirs and symlink all files recursively from source_d, ignoring
errors (e.g. existing files)
'''
func = os.symlink
if os.name == 'nt':
# NOTE: need to verify that default perms only allow admins to create
# symlinks o... | 0.002037 |
def _get_progress(self):
"""
Get current progress of emerge.
Returns a dict containing current and total value.
"""
input_data = []
ret = {}
# traverse emerge.log from bottom up to get latest information
last_lines = self.py3.command_output(["tail", "-50"... | 0.010989 |
def security_scheme(self, component_id, component):
"""Add a security scheme which can be referenced.
:param str component_id: component_id to use as reference
:param dict kwargs: security scheme fields
"""
if component_id in self._security_schemes:
raise DuplicateCo... | 0.005291 |
def binary_size(self):
'''Return the number of bytes to store this group and its parameters.'''
return (
1 + # group_id
1 + len(self.name.encode('utf-8')) + # size of name and name bytes
2 + # next offset marker
1 + len(self.desc.encode('utf-8')) + # size ... | 0.017241 |
def swag_from(
specs=None, filetype=None, endpoint=None, methods=None,
validation=False, schema_id=None, data=None, definition=None,
validation_function=None, validation_error_handler=None):
"""
Takes a filename.yml, a dictionary or object and loads swagger specs.
:param specs: a fi... | 0.00029 |
def _scan_pth_files(dir_paths):
"""Given an iterable of directory paths, yield paths to all .pth files within."""
for dir_path in dir_paths:
if not os.path.exists(dir_path):
continue
pth_filenames = (f for f in os.listdir(dir_path) if f.endswith('.pth'))
for pth_filename in pth_filena... | 0.013333 |
def unsubscribe_list(self, list_id):
"""
Unsubscribe to a list
:param list_id: list ID number
:return: :class:`~responsebot.models.List` object
"""
return List(tweepy_list_to_json(self._client.unsubscribe_list(list_id=list_id))) | 0.01083 |
def _selector_as_string(self, selector):
"""
Returns a selector as a CSS string
:param selector: A list of tinycss Tokens
:type selector: list
:returns: The CSS string for the selector
:rtype: str
"""
return ','.join(
''.join(token.as_css() fo... | 0.004808 |
def areaBetween(requestContext, *seriesLists):
"""
Draws the vertical area in between the two series in seriesList. Useful for
visualizing a range such as the minimum and maximum latency for a service.
areaBetween expects **exactly one argument** that results in exactly two
series (see example belo... | 0.000641 |
def subtrees_for_phrase(self, phrase_type):
"""
Returns subtrees corresponding all phrases matching a given phrase type
:param phrase_type: POS such as "NP", "VP", "det", etc.
:type phrase_type: str
:return: a list of NLTK.Tree.Subtree instances
:rtype: list of NLTK.Tre... | 0.006652 |
def delete(self):
''' return DELETE SQL
'''
SQL = 'DELETE FROM %s' % self._table
if self._selectors:
SQL = ' '.join([SQL, 'WHERE', self._selectors]).strip()
return SQL | 0.013158 |
def re_filter(text, regexps):
"""Filter text using regular expressions."""
if not regexps:
return text
matched_text = []
compiled_regexps = [re.compile(x) for x in regexps]
for line in text:
if line in matched_text:
continue
for regexp in compiled_regexps:
... | 0.002132 |
def dictlist_replace(dict_list: Iterable[Dict], key: str, value: Any) -> None:
"""
Process an iterable of dictionaries. For each dictionary ``d``, change
(in place) ``d[key]`` to ``value``.
"""
for d in dict_list:
d[key] = value | 0.003906 |
def ip_rtm_config_route_static_route_nh_vrf_static_route_next_hop(self, **kwargs):
"""Auto Generated Code
"""
config = ET.Element("config")
ip = ET.SubElement(config, "ip", xmlns="urn:brocade.com:mgmt:brocade-common-def")
rtm_config = ET.SubElement(ip, "rtm-config", xmlns="urn:br... | 0.007554 |
def SetAttributes(self,
urn,
attributes,
to_delete,
add_child_index=True,
mutation_pool=None):
"""Sets the attributes in the data store."""
attributes[AFF4Object.SchemaCls.LAST] = [
rdfvalue.RDFDatetime.... | 0.014514 |
def pvRvz(self,vR,vz,R,z,gl=True,ngl=_DEFAULTNGL2,vTmax=1.5):
"""
NAME:
pvR
PURPOSE:
calculate the marginalized (vR,vz) probability at this location (NOT normalized by the density)
INPUT:
vR - radial velocity (can be Quantity)
vz - vertic... | 0.021225 |
def process_bucket_inventory(bid, inventory_bucket, inventory_prefix):
"""Load last inventory dump and feed as key source.
"""
log.info("Loading bucket %s keys from inventory s3://%s/%s",
bid, inventory_bucket, inventory_prefix)
account, bucket = bid.split(':', 1)
region = connection.hg... | 0.001413 |
def getIndexOfHeteroMen(genotypes, menIndex):
"""Get the indexes of heterozygous men.
:param genotypes: the genotypes of everybody.
:param menIndex: the indexes of the men (for the genotypes).
:type genotypes: numpy.array
:type menIndex: numpy.array
:returns: a :py:class:`numpy.array` contain... | 0.001209 |
def _set_arp_entry(self, v, load=False):
"""
Setter method for arp_entry, mapped from YANG variable /rbridge_id/arp_entry (list)
If this variable is read-only (config: false) in the
source YANG file, then _set_arp_entry is considered as a private
method. Backends looking to populate this variable sh... | 0.003767 |
def run(self, clock, generalLedger):
"""
Execute the component at the current clock cycle.
:param clock: The clock containing the current execution time and
period information.
:param generalLedger: The general ledger into which to create the
transactions.
""... | 0.004255 |
def removeQuery( self ):
"""
Removes the currently selected query.
"""
items = self.uiQueryTREE.selectedItems()
tree = self.uiQueryTREE
for item in items:
parent = item.parent()
if ( parent ):
parent.takeChild(parent.index... | 0.016985 |
def _memory_usage_ps():
"""return memory usage of python process in MB
>>> isinstance(_memory_usage_ps(),float)
True
"""
out = subprocess.Popen(
['ps', 'v', '-p', str(os.getpid())],
stdout=subprocess.PIPE).communicate()[0].split(b'\n')
vsz_index = out[0].split().index(b'RSS')
... | 0.002611 |
def tlist2dict(tuple_list,**kwargs):
'''
#duplicate keys will lost
tl = [(1,2),(3,4),(1,5)]
tlist2dict(tl)
'''
if('deepcopy' in kwargs):
deepcopy = kwargs['deepcopy']
else:
deepcopy = 1
if('check' in kwargs):
check = kwargs['check']
else:
c... | 0.004243 |
def _kvmatrix2d(km,vm):
'''
km = [[[1], [3]], [[1, 2], [3, 'a']], [[1, 2, 22]]]
show_kmatrix(km)
vm = [[[222]], ['b']]
show_vmatrix(vm)
d = _kvmatrix2d(km,vm)
'''
d = {}
kmwfs = get_kmwfs(km)
vmwfs = elel.get_wfs(vm)
lngth = vmwfs.__len__... | 0.015306 |
def request_ligodotorg(url, debug=False):
"""Request the given URL using LIGO.ORG SAML authentication.
This requires an active Kerberos ticket for the user, to get one:
$ kinit albert.einstein@LIGO.ORG
Parameters
----------
url : `str`
URL path for request
debug : `bool`, optional... | 0.002882 |
def drop_everything(engine):
'''Droping all tables and custom types (enums) using `engine`.
Taken from http://www.sqlalchemy.org/trac/wiki/UsageRecipes/DropEverything
This method is more robust than `metadata.drop_all(engine)`. B.c. when
you change a table or a type name, `drop_all` does not consider t... | 0.00271 |
def main():
"""
The main function of the Andes command-line tool.
This function executes the following workflow:
* Parse the command line inputs
* Show the tool preamble
* Output the requested helps, edit/save configs or remove outputs. Exit
the main program if any of the above is ex... | 0.000925 |
def interpret_waveform(fileContent, RelativeChannelNo):
"""
Extracts the data for just 1 channel and computes the corresponding
time array (in seconds) starting from 0.
Important Note: RelativeChannelNo is NOT the channel number on the Saleae data logger
it is the relative number of the channe... | 0.007678 |
def to_sympy_matrix(value):
"""
Converts value to a `sympy.Matrix` object, if possible.
Leaves the value as `sympy.Matrix` if it already was
:param value: value to convert
:return:
:rtype: `sympy.Matrix`
"""
if isinstance(value, sympy.Matrix):
return value
try:
return... | 0.00206 |
def _assert_path_is_rw(self):
"""
Make sure, that `self.path` exists, is directory a readable/writeable.
Raises:
IOError: In case that any of the assumptions failed.
ValueError: In case that `self.path` is not set.
"""
if not self.path:
raise ... | 0.002681 |
def delete_many(self, **kwargs):
""" Delete multiple objects from collection.
First ES is queried, then the results are used to query the DB.
This is done to make sure deleted objects are those filtered
by ES in the 'index' method (so user deletes what he saw).
"""
db_ob... | 0.00463 |
def patch_namespaced_service(self, name, namespace, body, **kwargs): # noqa: E501
"""patch_namespaced_service # noqa: E501
partially update the specified Service # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass as... | 0.001308 |
def _reprJSON(self):
"""Returns a JSON serializable represenation of a ``Smi`` class
instance. Use :func:`maspy.core.Sai._fromJSON()` to generate a new
``Smi`` instance from the return value.
:returns: a JSON serializable python object
"""
return {'__Smi__': (self.id, se... | 0.003711 |
def list(self, request, *args, **kwargs):
"""
To get a list of supported resources' actions, run **OPTIONS** against
*/api/<resource_url>/* as an authenticated user.
It is possible to filter and order by resource-specific fields, but this filters will be applied only to
resource... | 0.003904 |
def resize(self, size, disk=None):
"""
Resize the droplet
:param size: a size slug or a `Size` object representing the size to
resize to
:type size: string or `Size`
:param bool disk: Set to `True` for a permanent resize, including
disk changes
:r... | 0.002903 |
def find_resources(self, rsrc_type, sort=None, yield_pages=False, **kwargs):
"""Find instances of `rsrc_type` that match the filter in `**kwargs`"""
return rsrc_type.find(self, sort=sort, yield_pages=yield_pages, **kwargs) | 0.012605 |
def make_request(
ins, method, url, stripe_account=None, params=None, headers=None, **kwargs
):
"""
Return a deferred or handle error.
For overriding in various classes.
"""
if txstripe.api_key is None:
raise error.AuthenticationError(
'No API key provided. (HINT: set your A... | 0.000555 |
def count_tokens(tokens, to_lower=False, counter=None):
r"""Counts tokens in the specified string.
For token_delim='(td)' and seq_delim='(sd)', a specified string of two sequences of tokens may
look like::
(td)token1(td)token2(td)token3(td)(sd)(td)token4(td)token5(td)(sd)
Parameters
----... | 0.002141 |
def build_ebound_table(self):
""" Build and return an EBOUNDS table with the encapsulated data.
"""
cols = [
Column(name="E_MIN", dtype=float, data=self._emin, unit='MeV'),
Column(name="E_MAX", dtype=float, data=self._emax, unit='MeV'),
Column(name="E_REF", dt... | 0.00232 |
def columnForCell(self, cell):
"""
Returns the index of the column that a cell belongs to.
:param cell: (int) Cell index
:returns: (int) Column index
"""
self._validateCell(cell)
return int(cell / self.cellsPerColumn) | 0.004032 |
def multi_replace(instr, search_list=[], repl_list=None):
"""
Does a string replace with a list of search and replacements
TODO: rename
"""
repl_list = [''] * len(search_list) if repl_list is None else repl_list
for ser, repl in zip(search_list, repl_list):
instr = instr.replace(ser, re... | 0.002941 |
def Read(self, expected_ids, read_data=True):
"""Read ADB messages and return FileSync packets."""
if self.send_idx:
self._Flush()
# Read one filesync packet off the recv buffer.
header_data = self._ReadBuffered(self.recv_header_len)
header = struct.unpack(self.recv_... | 0.002727 |
def find(self, nameFilter=None, typeFilter=None, enabledFilter=None, serviceId=None):
"""
Gets the list of Historian connectors, they are used to configure the Watson IoT Platform to store IoT data in compatible services.
Parameters:
- nameFilter(string) - Filt... | 0.008914 |
def user_exists(self,
user,
note=None,
loglevel=logging.DEBUG):
"""Returns true if the specified username exists.
@param user: username to check for
@param note: See send()
@type user: string
@rtype: boolean
"""
shutit = self.shutit
shu... | 0.040797 |
def user_method(user_event):
"""Decorator of the Pdb user_* methods that controls the RemoteSocket."""
def wrapper(self, *args):
stdin = self.stdin
is_sock = isinstance(stdin, RemoteSocket)
try:
try:
if is_sock and not stdin.connect():
retu... | 0.001767 |
def _refresh_state(self):
""" Refresh the job info. """
# DataFlow's DataflowPipelineResult does not refresh state, so we have to do it ourselves
# as a workaround.
# TODO(Change this to use runner_results.state once it refreshes itself)
dataflow_internal_job = (
self._runner_results._runne... | 0.009833 |
def load(self):
"""Load the library."""
if not git:
raise EnvironmentError(MISSING_GIT_ERROR)
if os.path.exists(self.path):
if not config.CACHE_DISABLE:
return
shutil.rmtree(self.path, ignore_errors=True)
with files.remove_on_exceptio... | 0.003401 |
def load_config(self):
"""
Used to dynamically load variables from the Flask application config
into the blueprint. To tell this blueprint to pull configuration from
the app, just set key-value pairs in the ``from_config`` dict. Keys
are the name of the local variable to set on t... | 0.002836 |
def markers(data, marker, f_tooltip=None, marker_preferred_size=32):
"""
Draw markers
:param data: data access object
:param marker: full filename of the marker image
:param f_tooltip: function to generate a tooltip on mouseover
:param marker_preferred_size: size in pixel for the marker images
... | 0.004264 |
def calc_refr_sp_wc_v1(self):
"""Calculate refreezing of the water content within the snow layer and
update both the snow layers ice and the water content.
Required control parameters:
|NmbZones|
|ZoneType|
|CFMax|
|CFR|
Required derived parameter:
|TTM|
Required flu... | 0.000226 |
def fetch(self, ui_version=values.unset):
"""
Fetch a ConfigurationInstance
:param unicode ui_version: Pinned UI version
:returns: Fetched ConfigurationInstance
:rtype: twilio.rest.flex_api.v1.configuration.ConfigurationInstance
"""
return self._proxy.fetch(ui_v... | 0.005882 |
def find_coverage(self, zoom):
"""
Returns the bounding box (minx, miny, maxx, maxy) of an adjacent
group of tiles at this zoom level.
"""
# Find a group of adjacent available tiles at this zoom level
rows = self._query('''SELECT tile_column, tile_row FROM tiles
... | 0.002913 |
def krylovMethod(self,tol=1e-8):
"""
We obtain ``pi`` by using the :func:``gmres`` solver for the system of linear equations.
It searches in Krylov subspace for a vector with minimal residual. The result is stored in the class attribute ``pi``.
Example
-------
>>> P... | 0.018182 |
def extract(zf, content, out_dir='.'):
'''
Extracting a Java 1.6 XNAT ZIP archive in Python.
:param zf: ZipFile object
:type zf: zipfile.ZipFile
:param out_dir: Output directory
:type out_dir: str
'''
previous_header_offset = 0
compensation = Namespace(value=2**32, factor=0)
for... | 0.003142 |
def proximal(self):
"""Return the `proximal factory` of the functional.
The proximal operator separates over separable sums.
Returns
-------
proximal : combine_proximals
"""
proximals = [func.proximal for func in self.functionals]
return combine_proximal... | 0.006006 |
def handle_keypress(self, k):
"""Last resort for keypresses."""
if k == "esc":
self.save_file()
raise urwid.ExitMainLoop()
elif k == "delete":
# delete at end of line
self.walker.combine_focus_with_next()
elif k == "backspace":
... | 0.003072 |
def log_create(self, instance, **kwargs):
"""
Helper method to create a new log entry. This method automatically populates some fields when no explicit value
is given.
:param instance: The model instance to log a change for.
:type instance: Model
:param kwargs: Field ove... | 0.005099 |
def run(self, train_set, valid_set=None, test_set=None, train_size=None, epoch_controllers=None):
"""
Run until the end.
:param epoch_controllers: deprecated
"""
epoch_controllers = epoch_controllers if epoch_controllers else []
epoch_controllers += self._epoch_controller... | 0.00339 |
def cli(self, prt=sys.stdout):
"""Command-line interface to print specified GO Terms from the DAG source ."""
kws = self.objdoc.get_docargs(prt=None)
print("KWS", kws)
goids = GetGOs().get_goids(kws.get('GO'), kws.get('GO_FILE'), sys.stdout)
if not goids and 'name' in kws:
... | 0.00759 |
def create_tags(user):
"""Create a tag."""
values = {
'id': utils.gen_uuid(),
'created_at': datetime.datetime.utcnow().isoformat()
}
values.update(schemas.tag.post(flask.request.json))
with flask.g.db_conn.begin():
where_clause = sql.and_(
_TABLE.c.name == values... | 0.001264 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.