text stringlengths 78 104k | score float64 0 0.18 |
|---|---|
def _set_alarm_falling_event_index(self, v, load=False):
"""
Setter method for alarm_falling_event_index, mapped from YANG variable /rmon/alarm_entry/alarm_falling_event_index (alarm-falling-event-index-type)
If this variable is read-only (config: false) in the
source YANG file, then _set_alarm_falling_... | 0.005086 |
def get_labels(self, **query_params):
'''
Get the labels attached to this board. Returns a label of Label
objects.
Returns:
list(Label): The labels attached to this board
'''
labels = self.get_labels_json(self.base_uri, query_params=query_params)
lab... | 0.004376 |
def exception(self, timeout=None, do_raise=True):
"""
Returns the exception value by the future's worker or :const:`None`.
:param timeout:
:param do_raise:
:param Cancelled:
:param Timeout:
:return: :const:`None` or an exception value.
"""
with self._lock:
self.wait(timeout, ... | 0.011811 |
def _build_hash_magic(self, subtitle_id):
"""Build the other half of the encryption key hash
I have no idea what is going on here
@param int subtitle_id
@return str
"""
media_magic = self.HASH_MAGIC_CONST ^ subtitle_id
hash_magic = media_magic ^ media_magic >> ... | 0.005391 |
def get_tom(self, node):
"""
Convert the given node into a Temporal Occurrence Model object.
:param node: a node of kind poissonTOM or brownianTOM
:returns: a :class:`openquake.hazardlib.mfd.EvenlyDiscretizedMFD.` or
:class:`openquake.hazardlib.mfd.TruncatedGRMFD` inst... | 0.0033 |
def save(self, *args, **kwargs):
"""
Set the current site ID, and ``is_public`` based on the setting
``COMMENTS_DEFAULT_APPROVED``.
"""
if not self.id:
self.is_public = settings.COMMENTS_DEFAULT_APPROVED
self.site_id = current_site_id()
super(Threa... | 0.005571 |
def gen_cannon_grad_spec(base_labels, choose, low, high, coeffs, pivots):
""" Generate Cannon gradient spectra
Parameters
----------
labels: default values for [teff, logg, feh, cfe, nfe, afe, ak]
choose: val of cfe or nfe, whatever you're varying
low: lowest val of cfe or nfe, whatever you're ... | 0.001175 |
def construct(cls, project, *, run=None, name=None, data=None, **desc):
"""
Construct an animation, set the runner, and add in the two
"reserved fields" `name` and `data`.
"""
from . failed import Failed
exception = desc.pop('_exception', None)
if exception:
... | 0.002829 |
def set_scale_base_xy(self, scale_x_base, scale_y_base):
"""Set stretch factors.
Parameters
----------
scale_x_base, scale_y_base : float
Stretch factors for X and Y, respectively.
"""
self.t_.set(scale_x_base=scale_x_base, scale_y_base=scale_y_base) | 0.00641 |
def main():
"""The main function of the script"""
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument(
'--boost_dir',
required=False,
type=existing_path,
help='The path to the include/boost directory of Metaparse'
)
parser.add_argument(
'... | 0.000746 |
def get_assessment_offered(self, assessment_offered_id):
"""Gets the ``AssessmentOffered`` specified by its ``Id``.
In plenary mode, the exact ``Id`` is found or a ``NotFound``
results. Otherwise, the returned ``AssessmentOffered`` may have
a different ``Id`` than requested, such as the... | 0.002457 |
def terminate_pool(self):
"""Terminate and close the multiprocessing pool if necessary."""
if self.pool is not None:
self.pool.terminate()
self.pool.join()
del(self.pool)
self.pool = None | 0.007937 |
def connection_lost(self, exc):
"""
Gets called when the connection to the gateway is lost.
Tear down and clean up the protocol object.
"""
_LOGGER.error("Disconnected: %s", exc)
self.connected = False
self.transport.close()
if self._report_task is not Non... | 0.003704 |
def is_complete(self, zmax=118):
"""
True if table is complete i.e. all elements with Z < zmax have at least on pseudopotential
"""
for z in range(1, zmax):
if not self[z]: return False
return True | 0.016064 |
def project(self,
geometries,
inSR,
outSR,
transformation="",
transformFoward=False):
"""
The project operation is performed on a geometry service resource. This
operation projects an array of input geometries from ... | 0.014991 |
def pad_dataset(subset, side="right", length=-1):
"""
Pad data set to specified length.
Parameters:
length - max length, a just to the max length in the batch if length is -1
"""
assert length == -1 or length > 0
if type(subset[0][0][0]) in [float, int, np.int64, np.int32, np.float32]:
... | 0.004785 |
def _write_docstring_parameters(self, routine):
"""
Writes the parameters part of the docstring for the wrapper method of a stored routine.
:param dict routine: The metadata of the stored routine.
"""
if routine['pydoc']['parameters']:
self._write_line('')
... | 0.006776 |
def get_asn_origin_whois(self, asn_registry='radb', asn=None,
retry_count=3, server=None, port=43):
"""
The function for retrieving CIDR info for an ASN via whois.
Args:
asn_registry (:obj:`str`): The source to run the query against
(asn.... | 0.001045 |
def subcommand(self, description='', arguments={}):
'''
Decorator for quickly adding subcommands to the omnic CLI
'''
def decorator(func):
self.register_subparser(
func,
func.__name__.replace('_', '-'),
description=description,
... | 0.004773 |
def _get_policy_dict(policy):
'''Returns a dictionary representation of a policy'''
profile_dict = {'name': policy.name,
'description': policy.description,
'resource_type': policy.resourceType.resourceType}
subprofile_dicts = []
if isinstance(policy, pbm.profile.C... | 0.000578 |
def hysteresis_magic(output_dir_path=".", input_dir_path="", spec_file="specimens.txt",
meas_file="measurements.txt", fmt="svg",
save_plots=True, make_plots=True, pltspec="", n_specs=5, interactive=False):
"""
Calculate hysteresis parameters and plot hysteresis data.
... | 0.001616 |
def close(self):
"""Close the connection."""
if self.connection:
self.connection.close()
self.connection = None
logging.debug("Connection closed.") | 0.01005 |
def has_permission(self, request):
"""Check if user has permission"""
if not self.object and not self.permission:
return True
if not self.permission:
return request.user.has_perm('{}_{}'.format(
self.model_permission,
self.object.__class__... | 0.004762 |
def model_to_dict(model, mode="", show_defaults=False):
"""
Given a model, return a representation of the model in a dict.
This is mostly useful to have a quick visual represenation of the model.
Args:
model (PybindBase): Model to transform.
mode (string): Whether to print config, sta... | 0.001286 |
def get_feature_info(feature):
"""Returns a dict with feature information"""
dimensions = feature.findall('position')
for dim in dimensions:
if dim.attrib['dim'] == '0':
rt = dim.text
elif dim.attrib['dim'] == '1':
mz = dim.text
return {'rt': float(rt), 'mz': floa... | 0.002174 |
def stat(self, overall_param=None, class_param=None, class_name=None):
"""
Print statistical measures table.
:param overall_param : overall parameters list for print, Example : ["Kappa","Scott PI]
:type overall_param : list
:param class_param : class parameters list for print, E... | 0.005188 |
def conv2d(inputs,
num_filters_out,
kernel_size,
stride=1,
padding='SAME',
activation=tf.nn.relu,
stddev=0.01,
bias=0.0,
weight_decay=0,
batch_norm_params=None,
is_training=True,
trainable=True,
... | 0.003075 |
def _create_alpha(self, data, fill_value=None):
"""Create an alpha band DataArray object.
If `fill_value` is provided and input data is an integer type
then it is used to determine invalid "null" pixels instead of
xarray's `isnull` and `notnull` methods.
The returned array is 1... | 0.00216 |
def sequence(self, per_exon=False):
"""
Return the sequence for this feature.
if per-exon is True, return an array of exon sequences
This sequence is never reverse complemented
"""
db = self.db
if not per_exon:
start = self.txStart + 1
retu... | 0.003231 |
def display(self):
"""A :func:`list` of screen lines as unicode strings."""
def render(line):
is_wide_char = False
for x in range(self.columns):
if is_wide_char: # Skip stub
is_wide_char = False
continue
cha... | 0.003643 |
def forget(self, *keys):
"""
Remove an item from the collection by key.
:param keys: The keys to remove
:type keys: tuple
:rtype: Collection
"""
keys = reversed(sorted(keys))
for key in keys:
del self[key]
return self | 0.006557 |
def scandir(path, app=None):
'''
Config-aware scandir. Currently, only aware of ``exclude_fnc``.
:param path: absolute path
:type path: str
:param app: flask application
:type app: flask.Flask or None
:returns: filtered scandir entries
:rtype: iterator
'''
exclude = app and app.... | 0.001908 |
def dump(self, stream, contentType=None, version=None):
'''
Serializes this FileItem to a byte-stream and writes it to the
file-like object `stream`. `contentType` and `version` must be one
of the supported content-types, and if not specified, will default
to ``application/vnd.omads-file``.
'''
... | 0.009852 |
def bhattacharyya(Ks, dim, required, clamp=True, to_self=False):
r'''
Estimate the Bhattacharyya coefficient between distributions, based on kNN
distances: \int \sqrt{p q}
If clamp (the default), enforces 0 <= BC <= 1.
Returns an array of shape (num_Ks,).
'''
est = required
if clamp:
... | 0.002646 |
def is_cnpj(numero, estrito=False):
"""Uma versão conveniente para usar em testes condicionais. Apenas retorna
verdadeiro ou falso, conforme o argumento é validado.
:param bool estrito: Padrão ``False``, indica se apenas os dígitos do
número deverão ser considerados. Se verdadeiro, potenciais carac... | 0.001795 |
def load_rdkit_mol(cls, mol):
"""
Create a :class:`MolecularSystem` from :class:`rdkit.Chem.rdchem.Mol`.
Parameters
----------
mol : :class:`rdkit.Chem.rdchem.Mol`
An RDKit molecule object.
Returns
-------
:class:`pywindow.molecular.MolecularS... | 0.004283 |
def get_known_periods(self):
"""
Get the list of periods the variable value is known for.
"""
return list(self._memory_storage.get_known_periods()) + list((
self._disk_storage.get_known_periods() if self._disk_storage else [])) | 0.01087 |
def _vmf_log(X, kappa, mu):
"""Computs log(vMF(X, kappa, mu)) using built-in numpy/scipy Bessel
approximations.
Works well on small kappa and mu.
"""
n_examples, n_features = X.shape
return np.log(_vmf_normalize(kappa, n_features) * np.exp(kappa * X.dot(mu).T)) | 0.006993 |
def _make_version(major, minor, micro, level, serial):
"""Generate version string from tuple (almost entirely from coveragepy)."""
level_dict = {"alpha": "a", "beta": "b", "candidate": "rc", "final": ""}
if level not in level_dict:
raise RuntimeError("Invalid release level")
version = "{0:d}.{1:... | 0.001969 |
def validate_detector(self, body, params=None):
"""
`<>`_
:arg body: The detector
"""
if body in SKIP_IN_PATH:
raise ValueError("Empty value passed for a required argument 'body'.")
return self.transport.perform_request(
"POST",
"/_ml/... | 0.007177 |
def score(count_bigram, count1, count2, n_words):
"""Collocation score"""
if n_words <= count1 or n_words <= count2:
# only one words appears in the whole document
return 0
N = n_words
c12 = count_bigram
c1 = count1
c2 = count2
p = c2 / N
p1 = c12 / c1
p2 = (c2 - c12)... | 0.002165 |
def set_digital_latch(self, pin, threshold_type, cb=None):
"""
This method "arms" a digital pin for its data to be latched and saved in the latching table
If a callback method is provided, when latching criteria is achieved, the callback function is called
with latching data notification... | 0.006402 |
def unseen_videos_reset(self):
"""Reset the unseen videos counter."""
url = RESET_CAM_ENDPOINT.format(self.unique_id)
ret = self._session.query(url).get('success')
return ret | 0.009709 |
def element(self, inp=None):
"""Create a new element.
First tries calling the first set, then the second, etc.
For more specific control, use ``set[i].element()`` to pick which
subset to use.
"""
for set in self.sets:
try:
return set.element(... | 0.003937 |
def market_value(self):
"""
[float] 市值
"""
return sum(account.market_value for account in six.itervalues(self._accounts)) | 0.019608 |
def description(self):
"""
Retrieve a description of the columns in the current result set
:return: A tuple of seven elements. Only some elements are meaningful:\n
* Element #0 is the name of the column
* Element #1 is the type code of the column
... | 0.007949 |
def authenticate_credentials(self, token):
"""
Validate the bearer token against the OAuth provider.
Arguments:
token (str): Access token to validate
Returns:
(tuple): tuple containing:
user (User): User associated with the access token
... | 0.004032 |
def special_typechecking(value, msg):
"""
Special Typechecking not available via protocol itself
:param value: <dict>
:param msg: <proto object>
:return: <bool>
"""
result = True
if msg.DESCRIPTOR.name == TARGET:
result &= special_target_typecheck(value)
elif msg.DESCRIPTOR.n... | 0.002494 |
def _write_str(self, data):
"""
Converts the given data then writes it
:param data: Data to be written
:return: The result of ``self.output.write()``
"""
with self.__lock:
self.output.write(
to_str(data, self.encoding)
.encode(... | 0.005051 |
def _begin_write(session: UpdateSession,
loop: asyncio.AbstractEventLoop,
rootfs_file_path: str):
""" Start the write process. """
session.set_progress(0)
session.set_stage(Stages.WRITING)
write_future = asyncio.ensure_future(loop.run_in_executor(
None, file_act... | 0.001486 |
def Gregory(type=float):
"""Return partial sums of the Gregory series converging to atan(1) == pi/4.
Yield 1 - 1/3 + 1/5 - 1/7 + ... computed with the given type.
"""
return seq(type(1), step=2) >> map(lambda x: 1/x) >> alt_sign >> fold(operator.add) | 0.023529 |
def getChargingVoltage(self):
"""Returns the charging voltage, in volts, or 0.0 of not charging"""
command = '$GG'
currentAndVoltage = self.sendCommand(command)
volts = float(currentAndVoltage[2])/1000
return volts | 0.004274 |
def all_valid_time_intervals():
'''
Helper method to return all possible valid time intervals for data
stored by Perfherder
'''
return [PerformanceTimeInterval.DAY,
PerformanceTimeInterval.WEEK,
PerformanceTimeInterval.TWO_WEEKS,
Pe... | 0.004386 |
def check_python_classifiers(package_info, *args):
"""
Does the package have Python classifiers?
:param package_info: package_info dictionary
:return: Tuple (is the condition True or False?, reason if it is False else None, score to be applied)
"""
classifiers = package_info.get('classifiers')
... | 0.005474 |
def _build_error_report(
self, message, report_location=None, http_context=None, user=None
):
"""Builds the Error Reporting object to report.
This builds the object according to
https://cloud.google.com/error-reporting/docs/formatting-error-messages
:type message: str
... | 0.001155 |
def get_table_keys_name(self, table_name, keys):
"""
Given a set of keys, extracts the key and range key
"""
table = self.tables.get(table_name)
if not table:
return None, None
else:
if len(keys) == 1:
for key in keys:
... | 0.003122 |
def connect_tcp(self, address, port):
"""Connect to tcp/ip `address`:`port`. Delegated to `_connect_tcp`."""
info('Connecting to TCP address: %s:%d', address, port)
self._connect_tcp(address, port) | 0.00905 |
def write(self, outfilename=None):
"""Write or overwrite this .MAK file"""
outfilename = outfilename or self.filename
if not outfilename:
raise ValueError('Unable to write MAK file without a filename')
with codecs.open(outfilename, 'wb', 'windows-1252') as outf:
o... | 0.00554 |
def btc_script_to_hex(script):
""" Parse the string representation of a script and return the hex version.
Example: "OP_DUP OP_HASH160 c629...a6db OP_EQUALVERIFY OP_CHECKSIG"
"""
hex_script = ''
parts = script.split(' ')
for part in parts:
if part[0:3] == 'OP_':
value = ... | 0.002793 |
def emit(self, action, payload=None, retry=0):
"""Emit action with payload.
:param action: an action slug
:param payload: data, default {}
:param retry: integer, default 0.
:return: information in form of dict.
"""
payload = payload or {}
if retry:
... | 0.003992 |
def _are_aligned_angles(self, b1, b2):
"Are two boxes aligned according to their angle?"
return abs(b1 - b2) <= self.angle_tol or abs(np.pi - abs(b1 - b2)) <= self.angle_tol | 0.015873 |
def count(y_true, y_score=None, countna=False):
"""
Counts the number of examples. If countna is False then only count labeled examples,
i.e. those with y_true not NaN
"""
if not countna:
return (~np.isnan(to_float(y_true))).sum()
else:
return len(y_true) | 0.00678 |
def _compute_and_transfer_to_progress(self, process_name, start_timeperiod, end_timeperiod, job_record):
""" method computes new unit_of_work for job record in STATE_IN_PROGRESS
it also contains _fuzzy_ logic regard the DuplicateKeyError:
- we try to compute new scope of processing
- in ... | 0.008865 |
def _ReadUnionDataTypeDefinition(
self, definitions_registry, definition_values, definition_name,
is_member=False):
"""Reads an union data type definition.
Args:
definitions_registry (DataTypeDefinitionsRegistry): data type definitions
registry.
definition_values (dict[str, ob... | 0.00113 |
def info(gandi, resource, id, altnames, csr, cert, all_status):
""" Display information about a certificate.
Resource can be a CN or an ID
"""
output_keys = ['cn', 'date_created', 'date_end', 'plan', 'status']
if id:
output_keys.append('id')
if altnames:
output_keys.append('al... | 0.001091 |
def generate(self,
publishParameters,
itemId=None,
filePath=None,
fileType=None,
option='on'
):
"""
The Generate call helps a client generate features from a CSV file
or a shapefile.
CSV... | 0.005773 |
def _xml_element_value(el: Element, int_tags: list):
"""
Gets XML Element value.
:param el: Element
:param int_tags: List of tags that should be treated as ints
:return: value of the element (int/str)
"""
# None
if el.text is None:
return None
# int
try:
if el.tag... | 0.004158 |
def RegisterSourceType(cls, source_type_class):
"""Registers a source type.
Source types are identified based on their type indicator.
Args:
source_type_class (type): source type.
Raises:
KeyError: if source types is already set for the corresponding
type indicator.
"""
... | 0.003273 |
def _prune(self, filename: str, df: pd.DataFrame) -> pd.DataFrame:
"""Depth-first search through the dependency graph
and prune dependent DataFrames along the way.
"""
dependencies = []
for _, depf, data in self._config.out_edges(filename, data=True):
deps = data.get(... | 0.002852 |
def chmod(cls, path, permission_text):
"""
:param str permission_text: "ls -l" style permission string. e.g. -rw-r--r--
"""
try:
check_file_existence(path)
except FileNotFoundError:
_, e, _ = sys.exc_info() # for python 2.5 compatibility
logg... | 0.006211 |
def create_window(self):
"""Create a QMainWindow instance containing this plugin."""
self.undocked_window = window = PluginWindow(self)
window.setAttribute(Qt.WA_DeleteOnClose)
icon = self.get_plugin_icon()
if is_text_string(icon):
icon = self.get_icon(icon)
w... | 0.003268 |
def warn_on_var_indirection(self) -> bool:
"""If True, warn when a Var reference cannot be direct linked (iff
use_var_indirection is False).."""
return not self.use_var_indirection and self._opts.entry(
WARN_ON_VAR_INDIRECTION, True
) | 0.007194 |
def get_quart_iter(tups):
""" returns an iterator to grab four lines at a time """
if tups[0].endswith(".gz"):
ofunc = gzip.open
else:
ofunc = open
## create iterators
ofile1 = ofunc(tups[0], 'r')
fr1 = iter(ofile1)
quart1 = itertools.izip(fr1, fr1, fr1, fr1)
if tups[... | 0.008986 |
def _tag_from_regex(self, tags_regex, service_name):
"""
Use a named regexp on the current service_name to create extra tags
Example HAProxy service name: be_edge_http_sre-prod_elk
Example named regexp: be_edge_http_(?P<team>[a-z]+)\\-(?P<env>[a-z]+)_(?P<app>.*)
Resulting tags: [... | 0.006494 |
def line_range(self):
"""
Return a tuple of the form `(start_line, end_line)`
indicating the start and end line number of the snippet.
"""
num_lines = len(self.text().split('\n'))
end_line = self._start_line + num_lines - 1
return (self._start_line, end_line) | 0.006349 |
def get_true_slice(dims, data_len):
'''
Converts various size tuples or slices representing data ranges returns a
new slice with all non-negative (or None) values.
'''
rangeLen = non_str_len_no_throw(dims)
# Get the range qualifier for length
if isinstance(dims, slice):
start = get_... | 0.01479 |
def hash_opensubtitles(video_path):
"""Compute a hash using OpenSubtitles' algorithm.
:param str video_path: path of the video.
:return: the hash.
:rtype: str
"""
bytesize = struct.calcsize(b'<q')
with open(video_path, 'rb') as f:
filesize = os.path.getsize(video_path)
file... | 0.001043 |
def OnResizeGridDialog(self, event):
"""Resizes current grid by appending/deleting rows, cols and tables"""
# Get grid dimensions
new_shape = self.interfaces.get_dimensions_from_user(no_dim=3)
if new_shape is None:
return
with undo.group(_("Resize grid")):
... | 0.003175 |
def manage_api_keys():
"""Page for viewing and creating API keys."""
build = g.build
create_form = forms.CreateApiKeyForm()
if create_form.validate_on_submit():
api_key = models.ApiKey()
create_form.populate_obj(api_key)
api_key.id = utils.human_uuid()
api_key.secret = ut... | 0.000795 |
def get_user_repos(self, auth, username):
"""
Returns the repositories owned by
the user with username ``username``.
:param auth.Authentication auth: authentication object
:param str username: username of owner of repository
:return: a list of repositories
:rtyp... | 0.004464 |
def _computModelDelay(self):
""" Computes the amount of time (if any) to delay the run of this model.
This can be determined by two mutually exclusive parameters:
delay and sleepModelRange.
'delay' specifies the number of seconds a model should be delayed. If a list
is specified, the appropriate am... | 0.009276 |
def maybe_call(maybe_fn, kwargs: dict, prefix: str = None) -> 'Any':
"""
If maybe_fn is a function, get its arguments from kwargs and call it, also
searching for prefixed kwargs if prefix is specified. Otherwise, return
maybe_fn.
Used to allow both functions and iterables to be passed into plotting... | 0.001558 |
def limits(args):
"""
Describe limits in effect on your AWS account. See also https://console.aws.amazon.com/ec2/v2/home#Limits:
"""
# https://aws.amazon.com/about-aws/whats-new/2014/06/19/amazon-ec2-service-limits-report-now-available/
# Console-only APIs: getInstanceLimits, getAccountLimits, getAu... | 0.007278 |
def scanResource(uri = None, listRegexp = None, verbosity=1, logFolder= "./logs"):
'''
[Optionally] recursive method to scan the files in a given folder.
:param uri: the URI to be scanned.
:param listRegexp: listRegexp is an array of <RegexpObject>.
:return: a dictionary where the key is the name of the fil... | 0.046213 |
def log_tag(self, tag, code, multiline=False):
"""Logs a tagged message if tracing."""
if self.tracing:
if callable(code):
code = code()
tagstr = "[" + str(tag) + "]"
if multiline:
printerr(tagstr + "\n" + displayable(code))
... | 0.005376 |
def row(self, columnnames=[], exclude=False):
"""Return a tablerow object which includes (or excludes) the
given columns.
:class:`tablerow` makes it possible to get/put values in one or
more rows.
"""
from .tablerow import tablerow
return tablerow(self, columnna... | 0.006006 |
def PushItem(self, item, block=True):
"""Push an item on to the queue.
If no ZeroMQ socket has been created, one will be created the first time
this method is called.
Args:
item (object): item to push on the queue.
block (Optional[bool]): whether the push should be performed in blocking
... | 0.00675 |
def _perm_pval(bootstat, estimate, tail='two-sided'):
"""
Compute p-values from a permutation test.
Parameters
----------
bootstat : 1D array
Permutation distribution.
estimate : float or int
Point estimate.
tail : str
'upper': one-sided p-value (upper tail)
... | 0.000953 |
async def RemoveBlocks(self, all_):
'''
all_ : bool
Returns -> None
'''
# map input types to rpc msg
_params = dict()
msg = dict(type='Controller',
request='RemoveBlocks',
version=5,
params=_params)
... | 0.005025 |
def headers_present(html_string):
"""
Checks if the html table contains headers and returns True/False
Parameters
----------
html_string : str
Returns
-------
bool
"""
try:
from bs4 import BeautifulSoup
except ImportError:
print("ERROR: You must have Beautif... | 0.001709 |
def check_input(Verts=None, E2V=None, Agg=None, A=None, splitting=None,
mesh_type=None):
"""Check input for local functions."""
if Verts is not None:
if not np.issubdtype(Verts.dtype, np.floating):
raise ValueError('Verts should be of type float')
if E2V is not None:
... | 0.000654 |
def p_casecontent_condition_single(self, p):
'casecontent_condition : casecontent_condition COMMA expression'
p[0] = p[1] + (p[3],)
p.set_lineno(0, p.lineno(1)) | 0.01087 |
def next(self):
"""
Provide iteration capabilities
Use a small object cache for performance
"""
if not self._cache:
self._cache = self._get_results()
self._retrieved += len(self._cache)
# If we don't have any other data to return, we just
... | 0.00404 |
def MAX(values, *others):
"""
DECISIVE MAX
:param values:
:param others:
:return:
"""
if others:
from mo_logs import Log
Log.warning("Calling wrong")
return MAX([values] + list(others))
output = Null
for v in values:
if v == None:
continu... | 0.006881 |
def save(self, filename=None):
"""Save changes to a file.
If no filename is given, the one most recently loaded is used.
Tags are always written at the end of the file, and include
a header and a footer.
"""
filename = filename or self.filename
try:
... | 0.001237 |
def main():
"""Entry point for the application script"""
arguments = sys.argv[1:]
print('Managing solution with arguments: ')
print(arguments)
SwarmManager.HandleManagement(arguments) | 0.004926 |
def _add_member(self, member):
""" Does not add member if it already knows it.
.. warning:: It should not be called !
:param member: Collection to add to members
"""
if member.id in self.children:
return None
else:
self.children[member.id] = memb... | 0.006211 |
def alias(self, annotationtype, set, fallback=False):
"""Return the alias for a set (if applicable, returns the unaltered set otherwise iff fallback is enabled)"""
if inspect.isclass(annotationtype): annotationtype = annotationtype.ANNOTATIONTYPE
if annotationtype in self.set_alias and set in se... | 0.011583 |
def reduceByKeyAndWindow(self, func, invFunc, windowDuration, slideDuration=None,
numPartitions=None, filterFunc=None):
"""
Return a new DStream by applying incremental `reduceByKey` over a sliding window.
The reduced value of over a new window is calculated using t... | 0.00557 |
def create_link(self, blogname, **kwargs):
"""
Create a link post on a blog
:param blogname: a string, the url of the blog you want to post to.
:param state: a string, The state of the post.
:param tags: a list of tags that you want applied to the post
:param tweet: a st... | 0.004219 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.