text stringlengths 78 104k | score float64 0 0.18 |
|---|---|
def anchore_print(msg, do_formatting=False):
"""
Print to stdout using the proper formatting for the command.
:param msg: output to be printed, either an object or a string. Objects will be serialized according to config
:return:
"""
if do_formatting:
click.echo(formatter(msg))
else... | 0.005797 |
def _parse_xdot_directive(self, name, new):
""" Handles parsing Xdot drawing directives.
"""
parser = XdotAttrParser()
components = parser.parse_xdot_data(new)
# The absolute coordinate of the drawing container wrt graph origin.
x1 = min( [c.x for c in components] )
... | 0.009162 |
def INIT_TLS_SESSION(self):
"""
XXX We should offer the right key according to the client's suites. For
now server_rsa_key is only used for RSAkx, but we should try to replace
every server_key with both server_rsa_key and server_ecdsa_key.
"""
self.cur_session = tlsSessio... | 0.002821 |
def start(self):
"""Start the app for the engines subcommand."""
self.log.info("IPython cluster: started")
# First see if the cluster is already running
# Now log and daemonize
self.log.info(
'Starting engines with [daemon=%r]' % self.daemonize
)
# TO... | 0.003367 |
def record_absent(name, zone, type, data, profile):
'''
Ensures a record is absent.
:param name: Record name without the domain name (e.g. www).
Note: If you want to create a record for a base domain
name, you should specify empty string ('') for this
argu... | 0.001854 |
def identifier_simple(mesh):
"""
Return a basic identifier for a mesh, consisting of properties
that have been hand tuned to be somewhat robust to rigid
transformations and different tesselations.
Parameters
----------
mesh : Trimesh object
Source geometry
Returns
----------
... | 0.000271 |
def duration(self):
"""
Return a timedelta for this build.
Measure the time between this build's start and end time, or "now"
if the build has not yet finished.
:returns: timedelta object
"""
if self.completion_ts:
end = self.completed
else:
... | 0.005141 |
def get_fullpath(self, withext=True):
"""Return the filepath with the filename
:param withext: If True, return with the fileextension.
:type withext: bool
:returns: None
:rtype: None
:raises: None
"""
p = self.get_path(self._obj)
n = self.get_name... | 0.007371 |
def left_indent(text, indent=12, end='\n'):
''' A bit of the ol' ultraviolence :-/ '''
indent = ' ' * indent
lines = [indent + line for line in text.splitlines(True)]
lines.append(end)
return ''.join(lines) | 0.004405 |
def random_int(self, min=0, max=9999, step=1):
"""
Returns a random integer between two values.
:param min: lower bound value (inclusive; default=0)
:param max: upper bound value (inclusive; default=9999)
:param step: range step (default=1)
:returns: random integer betwe... | 0.004843 |
def cluster_on_extra_high_voltage(network, busmap, with_time=True):
""" Main function of the EHV-Clustering approach. Creates a new clustered
pypsa.Network given a busmap mapping all bus_ids to other bus_ids of the
same network.
Parameters
----------
network : pypsa.Network
Container fo... | 0.000377 |
def Emailer(recipients, sender=None):
""" Sends messages as emails to the given list
of recipients. """
import smtplib
hostname = socket.gethostname()
if not sender:
sender = 'lggr@{0}'.format(hostname)
smtp = smtplib.SMTP('localhost')
try:
while True:
logstr ... | 0.001949 |
async def message_fields(self, msg, fields, obj=None):
"""
Load/dump individual message fields
:param msg:
:param fields:
:param obj:
:return:
"""
for field in fields:
await self.message_field(msg, field, obj)
return msg | 0.006579 |
def delete_table(cls):
"""
delete_table
Manually delete a temporary table for model in test data base.
:return:
"""
schema_editor = getattr(connection, 'schema_editor', None)
if schema_editor:
with connection.schema_editor() as schema_editor:
... | 0.004335 |
def kubectl(*args, input=None, **flags):
"""Simple wrapper to kubectl."""
# Build command line call.
line = ['kubectl'] + list(args)
line = line + get_flag_args(**flags)
if input is not None:
line = line + ['-f', '-']
# Run subprocess
output = subprocess.run(
line,
in... | 0.002494 |
def estimate_bitstring_probs(results):
"""
Given an array of single shot results estimate the probability distribution over all bitstrings.
:param np.array results: A 2d array where the outer axis iterates over shots
and the inner axis over bits.
:return: An array with as many axes as there are... | 0.008368 |
def group(self, key, condition, initial, reduce, finalize=None, **kwargs):
"""Perform a query similar to an SQL *group by* operation.
**DEPRECATED** - The group command was deprecated in MongoDB 3.4. The
:meth:`~group` method is deprecated and will be removed in PyMongo 4.0.
Use :meth:`... | 0.001151 |
def list_values(hive, key=None, use_32bit_registry=False, include_default=True):
'''
Enumerates the values in a registry key or hive.
Args:
hive (str):
The name of the hive. Can be one of the following:
- HKEY_LOCAL_MACHINE or HKLM
- HKEY_CURRENT_USER o... | 0.001122 |
def ensure_dir(path):
"""Ensure directory exists.
Args:
path(str): dir path
"""
dirpath = os.path.dirname(path)
if dirpath and not os.path.exists(dirpath):
os.makedirs(dirpath) | 0.004673 |
def expected_os2_weight(style):
"""The weight name and the expected OS/2 usWeightClass value inferred from
the style part of the font name
The Google Font's API which serves the fonts can only serve
the following weights values with the corresponding subfamily styles:
250, Thin
275, ExtraLight
300, Ligh... | 0.009381 |
def print_func_call(ignore_first_arg=False, max_call_number=100):
""" utility function to facilitate debug, it will print input args before
function call, and print return value after function call
usage:
@print_func_call
def some_func_to_be_debu():
pass
:param ignore_firs... | 0.000635 |
def calc_adev_phase(phase, rate, mj, stride):
""" Main algorithm for adev() (stride=mj) and oadev() (stride=1)
see http://www.leapsecond.com/tools/adev_lib.c
stride = mj for nonoverlapping allan deviation
Parameters
----------
phase: np.array
Phase data in seconds.
rate: f... | 0.001538 |
def write_model_to_file(self, mdl, fn):
"""
Write a YANG model that was extracted from a source identifier
(URL or source .txt file) to a .yang destination file
:param mdl: YANG model, as a list of lines
:param fn: Name of the YANG model file
:return:
"""
... | 0.003559 |
def remote(func):
"""
Decorator to mark a function as invoking a remote procedure call.
When invoked in server mode, the function will be called; when
invoked in client mode, an RPC will be initiated.
"""
@functools.wraps(func)
def wrapper(self, *args, **kwargs):
if self.mode == 'se... | 0.000814 |
def add_host(self, host_id=None, host='localhost', port=6379,
unix_socket_path=None, db=0, password=None,
ssl=False, ssl_options=None):
"""Adds a new host to the cluster. This is only really useful for
unittests as normally hosts are added through the constructor and
... | 0.003265 |
def items(self):
"""Get an iter of VenvDirs and VenvFiles within the directory."""
contents = self.paths
contents = (
VenvFile(path.path) if path.is_file else VenvDir(path.path)
for path in contents
)
return contents | 0.007143 |
def bear_rhumb(ra1, dec1, ra2, dec2):
"""
Calculate the bearing of point 2 from point 1 along a Rhumb line.
The bearing is East of North and is in [0, 360), whereas position angle is also East of North but (-180,180]
Parameters
----------
ra1, dec1, ra2, dec2 : float
The sky coordinates... | 0.002427 |
def get_nowait_from_queue(queue):
""" Collect all immediately available items from a queue """
data = []
for _ in range(queue.qsize()):
try:
data.append(queue.get_nowait())
except q.Empty:
break
return data | 0.003817 |
def get_values(self):
"""
Returns the cpd
Examples
--------
>>> from pgmpy.factors.discrete import TabularCPD
>>> cpd = TabularCPD('grade', 3, [[0.1, 0.1],
... [0.1, 0.1],
... [0.8, 0.8]],
... | 0.004149 |
def parse_input_args(input_args):
""" Parses EOWorkflow input arguments provided by user and raises an error if something is wrong. This is
done automatically in the process of workflow execution
"""
input_args = input_args if input_args else {}
for task, args in input_args.... | 0.007538 |
def copy(self, other):
"""Copy metadata from another :py:class:`Metadata` object.
Returns the :py:class:`Metadata` object, allowing convenient
code like this::
md = Metadata().copy(other_md)
:param Metadata other: The metadata to copy.
:rtype: :py:class:`Metadata`... | 0.003976 |
def validate_options(self):
"""
Validate options
"""
for option in self._option_list:
# validate options
if option.required and option.key not in self._results:
raise RuntimeError('Option %s is required.' % option.name) | 0.006873 |
def from_array(cls, array, filename=None, channels=3, scale_to_range=False,
grayscale=False, channel_bitdepth=8,
has_alpha=False, palette=None):
"""
Creates an image by using a provided array. The array may be ready to
be written or still need fine-tuni... | 0.00516 |
def read_stdout(self):
"""
Reads the current state of the print buffer (if it exists) and returns
a body-ready dom object of those contents without adding them to the
actual report body. This is useful for creating intermediate body
values for display while the method is still ex... | 0.003221 |
def createFieldDescription(self):
"""
Provides a field description dict for swarm description.
:return: (dict)
"""
return {
"fieldName": self.getName(),
"fieldType": self._dataType,
"minValue": self._min,
"maxValue": self._max
} | 0.003623 |
def startup_script(self):
"""
Returns the content of the current startup script
"""
script_file = self.script_file
if script_file is None:
return None
try:
with open(script_file, "rb") as f:
return f.read().decode("utf-8", errors=... | 0.00655 |
def alias(*aliases):
"""
Decorating a class with @alias('FOO', 'BAR', ..) allows the class to
be referenced by each of the names provided as arguments.
"""
def decorator(cls):
# alias must be set in globals from caller's frame
caller = sys._getframe(1)
globals_dict = caller.f... | 0.002294 |
def bind(self, **fields):
"""
Return a new L{Message} with this message's contents plus the
additional given bindings.
"""
contents = self._contents.copy()
contents.update(fields)
return Message(contents, self._serializer) | 0.007194 |
def string_matches_sans_whitespace(self, str1, str2_fuzzy_whitespace):
"""Check if two strings match, modulo their whitespace."""
str2_fuzzy_whitespace = re.sub('\s+', '\s*', str2_fuzzy_whitespace)
return re.search(str2_fuzzy_whitespace, str1) is not None | 0.014337 |
def weather(self, latitude=None, longitude=None, date=None):
# type:(float, float, datetime) -> Weather
"""
:param float latitude: Locations latitude
:param float longitude: Locations longitude
:param datetime or str or int date: Date/time for historical weather data
:ra... | 0.004727 |
def _ParseShVariables(self, lines):
"""Extract env_var and path values from sh derivative shells.
Iterates over each line, word by word searching for statements that set the
path. These are either variables, or conditions that would allow a variable
to be set later in the line (e.g. export).
Args:... | 0.01209 |
def get_config_input_source_config_source_running_running(self, **kwargs):
"""Auto Generated Code
"""
config = ET.Element("config")
get_config = ET.Element("get_config")
config = get_config
input = ET.SubElement(get_config, "input")
source = ET.SubElement(input, "... | 0.003378 |
def maybeStartBuildsForWorker(self, worker_name):
"""
Call this when something suggests that a particular worker may now be
available to start a build.
@param worker_name: the name of the worker
"""
builders = self.getBuildersForWorker(worker_name)
self.brd.maybe... | 0.00554 |
def readOutput(self, directory, projectFileName, session, spatial=False, spatialReferenceID=None):
"""
Read only output files for a GSSHA project to the database.
Use this method to read a project when only post-processing tasks need to be performed.
Args:
directory (str): ... | 0.006002 |
def _find_xinput(self):
"""Find most recent xinput library."""
for dll in XINPUT_DLL_NAMES:
try:
self.xinput = getattr(ctypes.windll, dll)
except OSError:
pass
else:
# We found an xinput driver
self.xinpu... | 0.003738 |
def calculate_file_distances(dicom_files, field_weights=None,
dist_method_cls=None, **kwargs):
"""
Calculates the DicomFileDistance between all files in dicom_files, using an
weighted Levenshtein measure between all field names in field_weights and
their corresponding weight... | 0.001376 |
def track(self, event_key, user_id, attributes=None, event_tags=None):
""" Send conversion event to Optimizely.
Args:
event_key: Event key representing the event which needs to be recorded.
user_id: ID for user.
attributes: Dict representing visitor attributes and values which need to be reco... | 0.011635 |
def OnCellFontUnderline(self, event):
"""Cell font underline event handler"""
with undo.group(_("Underline")):
self.grid.actions.toggle_attr("underline")
self.grid.ForceRefresh()
self.grid.update_attribute_toolbar()
event.Skip() | 0.007042 |
def bb(self,*args,**kwargs):
"""
NAME:
bb
PURPOSE:
return Galactic latitude
INPUT:
t - (optional) time at which to get bb
obs=[X,Y,Z] - (optional) position of observer (in kpc)
(default=Object-wide default)
... | 0.015228 |
def split(self, grouper):
'''Split the current DenseRunVariable into multiple columns.
Parameters
----------
grouper : :obj:`pandas.DataFrame`
Binary DF specifying the design matrix to use for splitting. Number
of rows must match current ``DenseRunVariable``; a n... | 0.003027 |
def __make_request_url(self, teststep_dict, entry_json):
""" parse HAR entry request url and queryString, and make teststep url and params
Args:
entry_json (dict):
{
"request": {
"url": "https://httprunner.top/home?v=1&w=2",
... | 0.002046 |
def to_serializable(self, use_bytes=False, bytes_type=bytes):
"""Convert a :class:`SampleSet` to a serializable object.
Note that the contents of the :attr:`.SampleSet.info` field are assumed
to be serializable.
Args:
use_bytes (bool, optional, default=False):
... | 0.002805 |
def answer(request):
"""
Save the answer.
GET parameters:
html:
turn on the HTML version of the API
BODY
json in following format:
{
"answer": #answer, -- for one answer
"answers": [#answer, #answer, #answer ...] -- for multiple ans... | 0.005087 |
def _process_dates(self, timezone_offset, first_date, start, end, title, track_points=False):
''' a helper method to process datetime information for other requests
:param timezone_offset: integer with timezone offset from user profile details
:param first_date: string with ISO date from ... | 0.003295 |
def get_uid(brain_or_object):
"""Get the Plone UID for this object
:param brain_or_object: A single catalog brain or content object
:type brain_or_object: ATContentType/DexterityContentType/CatalogBrain
:returns: Plone UID
:rtype: string
"""
if is_portal(brain_or_object):
return '0'... | 0.002105 |
def segment_str(text: str, phoneme_inventory: Set[str] = PHONEMES) -> str:
"""
Takes as input a string in Kunwinjku and segments it into phoneme-like
units based on the standard orthographic rules specified at
http://bininjgunwok.org.au/
"""
text = text.lower()
text = segment_into_tokens(te... | 0.002793 |
def getitem(self, index, context=None):
"""Get an item from this node.
:param index: The node to use as a subscript index.
:type index: Const or Slice
:raises AstroidTypeError: When the given index cannot be used as a
subscript index, or if this node is not subscriptable.
... | 0.002643 |
def bitdepth(self):
"""The number of bits per sample in the audio encoding (an int).
Only available for certain file formats (zero where
unavailable).
"""
if hasattr(self.mgfile.info, 'bits_per_sample'):
return self.mgfile.info.bits_per_sample
return 0 | 0.00641 |
def _format_operation_list(operation, parameters):
"""Formats parameters in operation in the way BigQuery expects.
The input operation will be a query like ``SELECT %s`` and the output
will be a query like ``SELECT ?``.
:type operation: str
:param operation: A Google BigQuery query string.
:t... | 0.001221 |
def bounds(self) -> Tuple[float, float, float, float]:
"""Returns the bounds of the shape.
Bounds are given in the following order in the origin crs:
west, south, east, north
"""
return self.shape.bounds | 0.00823 |
def modifies_known_mutable(obj, attr):
"""This function checks if an attribute on a builtin mutable object
(list, dict, set or deque) would modify it if called. It also supports
the "user"-versions of the objects (`sets.Set`, `UserDict.*` etc.) and
with Python 2.6 onwards the abstract base classes `Mut... | 0.001147 |
def optimizeAngle(angle):
"""
Because any rotation can be expressed within 360 degrees
of any given number, and since negative angles sometimes
are one character longer than corresponding positive angle,
we shorten the number to one in the range to [-90, 270[.
"""
# First, we put the new ang... | 0.001101 |
def _sbase_notes_dict(sbase, notes):
"""Set SBase notes based on dictionary.
Parameters
----------
sbase : libsbml.SBase
SBML object to set notes on
notes : notes object
notes information from cobra object
"""
if notes and len(notes) > 0:
tokens = ['<html xmlns = "ht... | 0.001718 |
def lomb_scargle_fast(t, y, dy=1, f0=0, df=None, Nf=None,
center_data=True, fit_offset=True,
use_fft=True, freq_oversampling=5, nyquist_factor=2,
trig_sum_kwds=None):
"""Compute a lomb-scargle periodogram for the given data
This implements both ... | 0.000528 |
def n_atom(self, node):
"""atom ::=
('(' [yield_expr|testlist_gexp] ')'
| '[' [listmaker] ']'
| '{' [dictmaker] '}'
| '`' testlist1 '`'
| NAME | NUMBER | STRING+)
"""
length = len(node)
if length == 1:
... | 0.003448 |
def __remove_redundant_proper_names(self, docs, lemma_set):
""" Eemaldame yleliigsed pärisnimeanalüüsid etteantud sõnalemmade
loendi (hulga) põhjal;
"""
for doc in docs:
for word in doc[WORDS]:
# Vaatame vaid s6nu, millele on pakutud rohkem kui yks analyys... | 0.005767 |
def smoothing(labels, smoothing_window):
""" Applies a smoothing on VAD"""
if numpy.sum(labels)< smoothing_window:
return labels
segments = []
for k in range(1,len(labels)-1):
if labels[k]==0 and labels[k-1]==1 and labels[k+1]==1 :
labels[k]=1
for k in range(1,len(labels)-1):
if labels[k]==... | 0.041451 |
def generate_enum(self):
"""
Means that only value specified in the enum is valid.
.. code-block:: python
{
'enum': ['a', 'b'],
}
"""
enum = self._definition['enum']
if not isinstance(enum, (list, tuple)):
raise JsonSc... | 0.005435 |
def get_event_tags_from_dn(dn):
"""
This grabs the event tags from the dn designator. They look like this:
uni/tn-DataDog/ap-DtDg-AP1-EcommerceApp/epg-DtDg-Ecomm/HDl2IngrPktsAg1h
"""
tags = []
node = get_node_from_dn(dn)
if node:
tags.append("node:" + node)
app = get_app_from_dn(... | 0.001473 |
def _dowork(self, dir1, dir2, copyfunc=None, updatefunc=None):
""" Private attribute for doing work """
if self._verbose:
self.log('Source directory: %s:' % dir1)
self._dcmp = self._compare(dir1, dir2)
# Files & directories only in target directory
if self._purge:
... | 0.00082 |
def _build_cookie_jar(cls, session: AppSession):
'''Build the cookie jar'''
if not session.args.cookies:
return
if session.args.load_cookies or session.args.save_cookies:
session.factory.set('CookieJar', BetterMozillaCookieJar)
cookie_jar = session.factory.... | 0.002024 |
def convert_text_w_syntax_to_CONLL( text, feature_generator, layer=LAYER_CONLL ):
''' Converts given estnltk Text object into CONLL format and returns as a
string.
Uses given *feature_generator* to produce fields ID, FORM, LEMMA, CPOSTAG,
POSTAG, FEATS for each token.
Fills fields ... | 0.019367 |
def set_weather(self, weather_type):
"""Queue up a set weather command. It will be applied when `tick` or `step` is called next.
By the next tick, the lighting, skysphere, fog, and relevant particle systems will be updated and/or spawned
to the given weather. If there is no skysphere or directio... | 0.007246 |
def _get_resampled(self,rule,how={'ohlc':'last','volume':'sum'},df=None,**kwargs):
"""
Returns a resampled DataFrame
Parameters
----------
rule : str
the offset string or object representing target conversion
for all aliases available see http://pandas.pydata.org/pandas-docs/stable/timeseries.html#o... | 0.054475 |
def last(self, predicate=None):
'''The last element in a sequence (optionally satisfying a predicate).
If the predicate is omitted or is None this query returns the last
element in the sequence; otherwise, it returns the last element in
the sequence for which the predicate evaluates to ... | 0.002131 |
def update(self, callback_method=values.unset, callback_url=values.unset,
friendly_name=values.unset):
"""
Update the TriggerInstance
:param unicode callback_method: The HTTP method to use to call callback_url
:param unicode callback_url: The URL we call when the trigger ... | 0.004004 |
def ping(self):
"""
Sending ICMP packets.
:return: ``ping`` command execution result.
:rtype: :py:class:`.PingResult`
:raises ValueError: If parameters not valid.
"""
self.__validate_ping_param()
ping_proc = subprocrunner.SubprocessRunner(self.__get_pin... | 0.006803 |
async def clear_state(self, turn_context: TurnContext):
"""
Clears any state currently stored in this state scope.
NOTE: that save_changes must be called in order for the cleared state to be persisted to the underlying store.
:param turn_context: The context object for this turn... | 0.011019 |
def get_address(self, address_id, **params):
"""https://developers.coinbase.com/api/v2#show-addresss"""
return self.api_client.get_address(self.id, address_id, **params) | 0.010811 |
def DbDeleteDeviceAlias(self, argin):
""" Delete a device alias.
:param argin: device alias name
:type: tango.DevString
:return:
:rtype: tango.DevVoid """
self._log.debug("In DbDeleteDeviceAlias()")
self.db.delete_device_alias(argin) | 0.006897 |
def is_absolute(self):
"""Return True if xllcorner==yllcorner==0 indicating that points
in question are absolute.
"""
# FIXME(Ole): It is unfortunate that decision about whether points
# are absolute or not lies with the georeference object. Ross pointed this out.
# More... | 0.005701 |
def get_attribute_data(attr_ids, node_ids, **kwargs):
"""
For a given attribute or set of attributes, return all the resources and
resource scenarios in the network
"""
node_attrs = db.DBSession.query(ResourceAttr).\
options(joinedload_all('attr')... | 0.016231 |
def write(self, arg):
""" Write a string or bytes object to the buffer """
if isinstance(arg, str):
arg = arg.encode(self.encoding)
return self._buffer.write(arg) | 0.010101 |
def store(self, filename=None, location=None, path=None, container=None, region=None, access=None, base64decode=None):
"""
Uploads and stores the current transformation as a Fileink
*returns* [Filestack.Filelink]
```python
filelink = transform.store()
```
"""
... | 0.006039 |
def application_path(path):
"""
Join application project_dir and path
"""
from uliweb import application
return os.path.join(application.project_dir, path) | 0.005714 |
def set_attr_value(self, key, attr, value):
""" set the value of a given attribute for a given key
"""
idx = self._keys[key]
self._attrs[attr][idx].set(value) | 0.010526 |
def vectorize(self, token_list):
'''
Tokenize token list.
Args:
token_list: The list of tokens..
Returns:
[vector of token, vector of token, vector of token, ...]
'''
vector_list = [self.__collection.tf_idf(token, self.__collect... | 0.013298 |
def encrypt_stream(mode, in_stream, out_stream, block_size = BLOCK_SIZE, padding = PADDING_DEFAULT):
'Encrypts a stream of bytes from in_stream to out_stream using mode.'
encrypter = Encrypter(mode, padding = padding)
_feed_stream(encrypter, in_stream, out_stream, block_size) | 0.027682 |
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.
self._runner_results._job = (
self._runner_results._runner.dataflow_client.get_job(self._runner_results.job_id()))
self._is_co... | 0.010267 |
def _check_timeout(start_time, timeout):
'''
Name of the last installed kernel, for Red Hat based systems.
Returns:
List with name of last installed kernel as it is interpreted in output of `uname -a` command.
'''
timeout_milisec = timeout * 60000
if timeout_milisec < (int(round(tim... | 0.004819 |
def knn_initialize(
X,
missing_mask,
verbose=False,
min_dist=1e-6,
max_dist_multiplier=1e6):
"""
Fill X with NaN values if necessary, construct the n_samples x n_samples
distance matrix and set the self-distance of each row to infinity.
Returns contents of X laid... | 0.000792 |
def is_indexing(working_dir):
"""
Is the blockstack daemon synchronizing with the blockchain?
"""
indexing_path = get_indexing_lockfile(working_dir)
if os.path.exists( indexing_path ):
return True
else:
return False | 0.011765 |
def normalize_pred_string(predstr):
"""
Normalize the predicate string *predstr* to a conventional form.
This makes predicate strings more consistent by removing quotes and
the `_rel` suffix, and by lowercasing them.
Examples:
>>> normalize_pred_string('"_dog_n_1_rel"')
'_dog_n_1'
... | 0.001742 |
def _move_consonant(self, letters: list, positions: List[int]) -> List[str]:
"""
Given a list of consonant positions, move the consonants according to certain
consonant syllable behavioral rules for gathering and grouping.
:param letters:
:param positions:
:return:
... | 0.003553 |
def clear_option_value(self, opt_name):
""" Clear the stored option value (so the default will be used)
:param opt_name: option name
:type opt_name: str
"""
if not self.has_option(opt_name):
raise ValueError("Unknow option name (%s)" % opt_name)
self._options... | 0.005917 |
def __insert_wrapper(func):
"""Make sure the arguments given to the insert methods are correct"""
def check_func(self, key, new_item, instance=0):
if key not in self.keys():
raise KeyError("%s not a key in label" % (key))
if not isinstance(new_item, (list, Ordered... | 0.003413 |
def lock_online(self, comment=None):
"""
Executes a Lock-Online operation on the specified node
:param str comment: comment for audit
:raises NodeCommandFailed: cannot lock online
:return: None
"""
self.make_request(
NodeCommandFailed,
met... | 0.004878 |
def value(self):
"""return float Cumulative Distribution Function.
The return value represents a floating point number of the CDF of the
largest eigenvalue of a Wishart(n, p) evaluated at chisq_val.
"""
wishart = self._wishart_cdf
# Prepare variables for integration alg... | 0.002778 |
def fetch_items(self, category, **kwargs):
"""Fetch the pages
:param category: the category of items to fetch
:param kwargs: backend arguments
:returns: a generator of items
"""
from_date = kwargs['from_date']
reviews_api = kwargs['reviews_api']
mediawi... | 0.004149 |
def to_bool_alt(value):
'''
Convert python to zfs yes/no value
'''
value = from_bool_alt(value)
if isinstance(value, bool):
value = 'yes' if value else 'no'
elif value is None:
value = 'none'
return value | 0.004016 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.