text stringlengths 78 104k | score float64 0 0.18 |
|---|---|
def dm_soundex(word, max_length=6, zero_pad=True):
"""Return the Daitch-Mokotoff Soundex code for a word.
This is a wrapper for :py:meth:`DaitchMokotoff.encode`.
Parameters
----------
word : str
The word to transform
max_length : int
The length of the code returned (defaults to... | 0.00105 |
def rouge_l_sentence_level(evaluated_sentences, reference_sentences):
"""
Computes ROUGE-L (sentence level) of two text collections of sentences.
http://research.microsoft.com/en-us/um/people/cyl/download/papers/
rouge-working-note-v1.3.1.pdf
Calculated according to:
R_lcs = LCS(X,Y)/m
P_lc... | 0.000822 |
def rmdir(path):
"""
Recursively deletes a directory. Includes an error handler to retry with
different permissions on Windows. Otherwise, removing directories (eg.
cloned via git) can cause rmtree to throw a PermissionError exception
"""
logger.debug("DEBUG** Window rmdir sys.platform: {}".form... | 0.002028 |
def get_repo(name, config_path=_DEFAULT_CONFIG_PATH, with_packages=False):
'''
Get detailed information about a local package repository.
:param str name: The name of the local repository.
:param str config_path: The path to the configuration file for the aptly instance.
:param bool with_packages: ... | 0.00199 |
def get_registration_email_link(application):
""" Retrieve a link that can be emailed to the logged other users. """
url = '%s/applications/%d/' % (
settings.REGISTRATION_BASE_URL, application.pk)
is_secret = False
return url, is_secret | 0.003846 |
def _apply_value_predicates(self, i, r,
summarize=False,
report_unexpected_exceptions=True,
context=None):
"""Apply value predicates on the given record `r`."""
for field_name, predicate, code, message, modu... | 0.005246 |
def stacked_graph(labels, data, normal_data, len_categories, args, colors):
"""Prepare the horizontal stacked graph.
Each row is printed through the print_row function."""
val_min = find_min(data)
for i in range(len(labels)):
if args['no_labels']:
# Hide the labels.
l... | 0.00125 |
def __process_node(self, node: yaml.Node,
expected_type: Type) -> yaml.Node:
"""Processes a node.
This is the main function that implements yatiml's \
functionality. It figures out how to interpret this node \
(recognition), then applies syntactic sugar, and final... | 0.000968 |
async def work_async(self):
"""Perform a single Connection iteration asynchronously."""
try:
raise self._error
except TypeError:
pass
except Exception as e:
_logger.warning("%r", e)
raise
try:
await self.lock_async()
... | 0.005442 |
async def process(self, object_dict):
'''[for internal use] convert json/dict into python object
|coro|
Parameters
----------
object_dict : dict
json representation of object from emby
Notes
-----
if a string is given, it is assumed to be an id, obj is returned.
if a list is... | 0.007904 |
def pad(data_to_pad, block_size, style='pkcs7'):
"""Apply standard padding.
:Parameters:
data_to_pad : byte string
The data that needs to be padded.
block_size : integer
The block boundary to use for padding. The output length is guaranteed
to be a multiple of ``block_size``... | 0.003289 |
def all_databases(client, exclude=['local']):
"""
Yield all databases except excluded (default
excludes 'local').
"""
return (
client[db_name]
for db_name in client.list_database_names()
if db_name not in exclude
) | 0.044248 |
def has_auth_params(self, scheme):
"""Check whether all information required for a given auth scheme have
been supplied.
Args:
scheme (str): Name of the authentication scheme to check. One of
Gem-Identify, Gem-Device, Gem-Application
Returns:
True if all... | 0.005576 |
async def open(self) -> 'NodePool':
"""
Explicit entry. Opens pool as configured, for later closure via close().
Creates pool if it does not yet exist, using configured genesis transaction file.
For use when keeping pool open across multiple calls.
Raise any AbsentPool if node p... | 0.007171 |
def get_unverified_header(self, jwt):
"""Returns back the JWT header parameters as a dict()
Note: The signature is not verified so the header parameters
should not be fully trusted until signature verification is complete
"""
headers = self._load(jwt)[2]
self._validate_h... | 0.005571 |
def unitized(value, unit, base=DEFAULT_BASE):
"""
Args:
value (int | float): Value to expand
unit (str | unicode): Given unit (see UNITS)
base (int): Base to use (usually 1024)
Returns:
Deduced value (example: "1k" becomes 1000)
"""
exponent = 0 if not unit else UNIT... | 0.002632 |
def maintainConnections(self, force=False):
"""
Ensure appropriate connections.
"""
now = time.perf_counter()
if now < self.nextCheck and not force:
return False
self.nextCheck = now + (self.config.RETRY_TIMEOUT_NOT_RESTRICTED
... | 0.003077 |
def get_list(self):
"""Return the command line parameters as a list of options, their values and arguments.
:return: list of options, their optional values and arguments
"""
result = []
for key, value in self.parameters.items():
if value is None:
co... | 0.00289 |
def f_ac_power(inverter, v_mp, p_mp):
"""
Calculate AC power
:param inverter:
:param v_mp:
:param p_mp:
:return: AC power [W]
"""
return pvlib.pvsystem.snlinverter(v_mp, p_mp, inverter).flatten() | 0.004386 |
def _read_opt_ra(self, code, *, desc):
"""Read HOPOPT Router Alert option.
Structure of HOPOPT Router Alert option [RFC 2711]:
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|0 0 0|0 0 1 0 1|0 0 0 0 0 0 1 0| Value (2 octets) |
+-+-+-+-... | 0.002931 |
def get_example_by_schema(cls, schema, ignored_schemas=None, paths=None, name=''):
""" Get example by schema object
:param Schema schema: current schema
:param list ignored_schemas: list of previous schemas
for avoid circular references
:param list paths: list object paths (... | 0.00204 |
def run(self, scheduler_schedule_id, **kwargs):
"""
Deactivates the schedule specified by the ID `scheduler_schedule_id` in
the scheduler service.
Arguments:
scheduler_schedule_id {str} -- The ID of the schedule to deactivate
"""
log = self.get_logger(**kwarg... | 0.007722 |
def cosine(x):
'''
cosine(x) is equivalent to cos(x) except that it also works on sparse arrays.
'''
# cos(0) = 1 so no point in keeping these sparse
if sps.issparse(x): x = x.toarray(x)
return np.cos(x) | 0.013216 |
def get_chassis_location(host=None,
admin_username=None,
admin_password=None):
'''
Get the location of the chassis.
host
The chassis host.
admin_username
The username used to access the chassis.
admin_password
The password ... | 0.002841 |
def get_clan_war(self, tag: crtag, **params: keys):
"""Get inforamtion about a clan's current clan war
Parameters
----------
*tag: str
A valid clan tag. Minimum length: 3
Valid characters: 0289PYLQGRJCUV
\*\*keys: Optional[list] = None
Filter ... | 0.011331 |
def _handle_result_line(self, split_line):
"""
Parses the data line and adds the results to the dictionary.
:param split_line: a split data line to parse
:returns: the current result id and the dictionary of values obtained from the results
"""
values = {}
result_... | 0.003289 |
def skip_id3(fileobj):
"""Might raise IOError"""
# WMP writes multiple id3s, so skip as many as we find
while True:
idata = fileobj.read(10)
try:
id3, insize = struct.unpack('>3sxxx4s', idata)
except struct.error:
id3, insize = b'', 0
insize = BitPadd... | 0.00207 |
def _load_models(self) -> None:
"""Maybe load all the models to be assembled together and save them to the ``self._models`` attribute."""
if self._models is None:
logging.info('Loading %d models', len(self._model_paths))
def load_model(model_path: str):
logging.d... | 0.004646 |
def fetch_from(self, year: int, month: int):
"""Fetch data from year, month to current year month data"""
self.raw_data = []
self.data = []
today = datetime.datetime.today()
for year, month in self._month_year_iter(month, year, today.month, today.year):
self.raw_data.... | 0.006667 |
def extract_full(rec, sites, flank, fw):
"""
Full extraction of seq flanking the sites.
"""
for s in sites:
newid = "{0}:{1}".format(rec.name, s)
left = max(s - flank, 0)
right = min(s + flank, len(rec))
frag = rec.seq[left:right].strip("Nn")
newrec = SeqRecord(fr... | 0.002551 |
def filter(self, *predicates):
"""
Filter the data by predicates
:param predicates: the conditions to filter
:return: new collection
:rtype: :class:`odps.df.expr.expressions.CollectionExpr`
"""
predicates = self._get_fields(predicates)
predicate = reduce... | 0.004739 |
def str_max_bit_rate(self):
"""
Returns a human readable maximun upstream- and downstream-rate
of the given connection. The rate is given in bits/sec.
"""
upstream, downstream = self.max_bit_rate
return (
fritztools.format_rate(upstream, unit='bits'),
... | 0.007853 |
def policy_map_clss_span_session(self, **kwargs):
"""Auto Generated Code
"""
config = ET.Element("config")
policy_map = ET.SubElement(config, "policy-map", xmlns="urn:brocade.com:mgmt:brocade-policer")
po_name_key = ET.SubElement(policy_map, "po-name")
po_name_key.text = ... | 0.004161 |
def create(self, request, project):
"""
POST method implementation
"""
JobNote.objects.create(
job=Job.objects.get(repository__name=project,
id=int(request.data['job_id'])),
failure_classification_id=int(request.data['failure_classi... | 0.005348 |
def _retrieve_html_page(self):
"""
Download the requested player's stats page.
Download the requested page and strip all of the comment tags before
returning a pyquery object which will be used to parse the data.
Returns
-------
PyQuery object
The re... | 0.003247 |
def GET_AUTH(self, courseid, aggregationid): # pylint: disable=arguments-differ
""" GET request """
course, __ = self.get_course_and_check_rights(courseid)
if course.is_lti():
raise web.notfound()
return self.page(course, aggregationid) | 0.010601 |
def write_direct(self,
equities=None,
equity_symbol_mappings=None,
equity_supplementary_mappings=None,
futures=None,
exchanges=None,
root_symbols=None,
chunk_size=DEFAULT_CH... | 0.001418 |
def combine(self, a, b):
"""A generator that combines two iterables."""
for l in (a, b):
for x in l:
yield x | 0.019608 |
def _init_sys_auto_lookup(self):
"""Return a list of tuples of available init systems on the
current machine.
Note that in some situations (Ubuntu 14.04 for instance) more than
one init system can be found.
"""
# TODO: Instead, check for executables for systemd and upsta... | 0.00202 |
def _start_lock_renewer(self):
"""
Starts the lock refresher thread.
"""
if self._lock_renewal_thread is not None:
raise AlreadyStarted("Lock refresh thread already started")
logger.debug(
"Starting thread to refresh lock every %s seconds",
se... | 0.002532 |
def shuffle_album(
self, album, *, num_songs=100, only_library=False, recently_played=None
):
"""Get a listing of album shuffle/mix songs.
Parameters:
album (dict): An album dict.
num_songs (int, Optional): The maximum number of songs to return from the station.
Default: ``100``
only_library (bool,... | 0.033362 |
def _line(self, text, indent=0):
"""Write 'text' word-wrapped at self.width characters."""
leading_space = ' ' * indent
while len(leading_space) + len(text) > self.width:
# The text is too wide; wrap if possible.
# Find the rightmost space that would obey our width cons... | 0.004178 |
def load(stream):
"""Parse the LHA document and produce the corresponding Python object.
Accepts a string or a file-like object."""
if isinstance(stream, str):
string = stream
else:
string = stream.read()
tokens = tokenize(string)
return parse(tokens) | 0.003436 |
def nofollow_callback(attrs, new=False):
"""
Turn relative links into external ones and avoid `nofollow` for us,
otherwise add `nofollow`.
That callback is not splitted in order to parse the URL only once.
"""
parsed_url = urlparse(attrs[(None, 'href')])
if parsed_url.netloc in ('', current... | 0.001214 |
def threshold_monitor_hidden_threshold_monitor_Cpu_limit(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")
threshold_monito... | 0.006515 |
def login(self, username, password):
"""
This handles login logic instead of stuffing all that in the __init__.
:param username: The username to log in as or None
:param password: The password for that user or None
:return: Nothing
:raises: :class:`Pymoe.errors.UserLogin... | 0.002846 |
def clean_data(self, data, rename_col=None, drop_col=None,
resample=True, freq='h', resampler='mean',
interpolate=True, limit=1, method='linear',
remove_na=True, remove_na_how='any',
remove_outliers=True, sd_val=3,
remov... | 0.005587 |
def parse_midi_file(self, file):
"""Parse a MIDI file.
Return the header -as a tuple containing respectively the MIDI
format, the number of tracks and the time division-, the parsed
track data and the number of bytes read.
"""
try:
f = open(file, 'r')
... | 0.004478 |
def delete(self, ids):
"""
Method to delete environments by their id's
:param ids: Identifiers of environments
:return: None
"""
url = build_uri_with_ids('api/v3/environment/%s/', ids)
return super(ApiEnvironment, self).delete(url) | 0.006944 |
def create_route_long_name(relation, short_name):
"""Create a meaningful route name."""
if relation.tags.get('from') and relation.tags.get('to'):
return "{0}-to-{1}".format(relation.tags.get('from'),
relation.tags.get('to'))
name = relation.tags.get('name') or\
... | 0.001698 |
def primary_keys_for(self, cls: ClassDefinition) -> List[SlotDefinitionName]:
""" Return all primary keys / identifiers for cls
@param cls: class to get keys for
@return: List of primary keys
"""
return [slot_name for slot_name in self.all_slots_for(cls)
if self.... | 0.007519 |
def get_array_for_fit(observables: dict, track_pt_bin: int, jet_pt_bin: int) -> histogram.Histogram1D:
""" Get a Histogram1D associated with the selected jet and track pt bins.
This is often used to retrieve data for fitting.
Args:
observables (dict): The observables from which the hist should be ... | 0.005405 |
def valid_variable_identifier(string):
"""Raises an |ValueError| if the given name is not a valid Python
identifier.
For example, the string `test_1` (with underscore) is valid...
>>> from hydpy.core.objecttools import valid_variable_identifier
>>> valid_variable_identifier('test_1')
...but t... | 0.000693 |
def dmsToDeg(sign, deg, min, sec):
"""Convert dec sign, degrees, minutes, seconds into a signed angle in
degrees."""
return sign * (deg + min * degPerDmsMin + sec * degPerDmsSec) | 0.005263 |
def ssh(
self, machine, *,
username=None, command=None, boot_only=False, discovered=False,
wait=300):
"""SSH into `machine`."""
start_time = time.monotonic()
with utils.Spinner() as context:
context.msg = colorized(
"{autoblue}Deter... | 0.000703 |
def get_gafvals(self, line):
"""Convert fields from string to preferred format for GAF ver 2.1 and 2.0."""
flds = line.split('\t')
flds[3] = self._get_qualifier(flds[3]) # 3 Qualifier
flds[5] = self._get_set(flds[5]) # 5 DB_Reference
flds[7] = self._get_set(flds[7]) #... | 0.006711 |
def render_select_site_form(self, request, context, form_url=''):
"""
Render the site choice form.
"""
app_label = self.opts.app_label
context.update({
'has_change_permission': self.has_change_permission(request),
'form_url': mark_safe(form_url),
... | 0.003822 |
def getFailedJobIDs(self, extraLapse = TYPICAL_LAPSE):
'''Returns a list of which identify failed jobs in the scriptsRun table.
If a time stamp for a job can be found, we return this. The time stamp can be used to index the log.
If no time stamp was found, return the name of the script instead.
'''
scripts... | 0.036044 |
def score(self, X, y):
"""
Calculate accuracy score.
Needed because of bug in metrics.accuracy_score when comparing
list with numpy array.
"""
predictions = self.predict(X)
true = 0.0
total = 0.0
for i in range(len(predictions)):
total... | 0.004808 |
def get_dashboard_panels_visibility_by_section(section_name):
"""
Return a list of pairs as values that represents the role-permission
view relation for the panel section passed in.
:param section_name: the panels section id.
:return: a list of tuples.
"""
registry_info = get_dashboard_regis... | 0.000846 |
def _get_deploy_image_params(data_holder, host_info, vm_name):
"""
:type data_holder: models.vCenterVMFromImageResourceModel.vCenterVMFromImageResourceModel
"""
image_params = OvfImageParams()
if hasattr(data_holder, 'vcenter_image_arguments') and data_holder.vcenter_image_argume... | 0.004541 |
def active(self, registered_only=True):
"Returns all active users, e.g. not logged and non-expired session."
visitors = self.filter(
expiry_time__gt=timezone.now(),
end_time=None
)
if registered_only:
visitors = visitors.filter(user__isnull=False)
... | 0.0059 |
def form_invalid(self, form):
'''Builds the JSON for the errors'''
response = {self.errors_key: {}}
response[self.non_field_errors_key] = form.non_field_errors()
response.update(self.get_hidden_fields_errors(form))
for field in form.visible_fields():
if field.errors:... | 0.005566 |
def _rest_put(self, suburi, request_headers, request_body):
"""REST PUT operation.
HTTP response codes could be 500, 404, 202 etc.
"""
return self._rest_op('PUT', suburi, request_headers, request_body) | 0.008547 |
def delete_vmss_vms(access_token, subscription_id, resource_group, vmss_name, vm_ids):
'''Delete a VM in a VM Scale Set.
Args:
access_token (str): A valid Azure authentication token.
subscription_id (str): Azure subscription id.
resource_group (str): Azure resource group name.
v... | 0.004386 |
def changeGroupImageRemote(self, image_url, thread_id=None):
"""
Changes a thread image from a URL
:param image_url: URL of an image to upload and change
:param thread_id: User/Group ID to change image. See :ref:`intro_threads`
:raises: FBchatException if request failed
... | 0.006508 |
def update(self, entry_id, new_label):
"""
Updates an entry with entry_id with the given label
Parameters
----------
entry_id : int
entry id of the sample to update.
label : {int, None}
Label of the sample to be update.
"""
self.d... | 0.00409 |
def get(self, name):
""" Looks for a name in the path.
:param name: file name
:return: path to the file
"""
for d in self.paths:
if os.path.exists(d) and name in os.listdir(d):
return os.path.join(d, name)
logger.debug('File not found {}'.for... | 0.005714 |
def _sumLists(a, b):
"""
Algorithm to check validity of NBI and NIF.
Receives string with a umber to validate.
"""
val = 0
for i in map(lambda a, b: a * b, a, b):
val += i
return val | 0.004587 |
def django_api(
self,
name,
introduced_at,
undocumented=False,
deprecated_at=None,
title=None,
**options):
"""Add a django API handler to the service.
:param name: This is the name of the django url to use.
The... | 0.002227 |
def cli(patterns, times, json, csv, rst, md, ref, unit, precision, debug):
'''Execute minibench benchmarks'''
if ref:
ref = JSON.load(ref)
filenames = []
reporters = [CliReporter(ref=ref, debug=debug, unit=unit, precision=precision)]
kwargs = {}
for pattern in patterns or ['**/*.bench.p... | 0.002407 |
def may_be_null_is_nullable():
"""If may_be_null returns nullable or if NULL can be passed in.
This can still be wrong if the specific typelib is older than the linked
libgirepository.
https://bugzilla.gnome.org/show_bug.cgi?id=660879#c47
"""
repo = GIRepository()
repo.require("GLib", "2.... | 0.002066 |
def save_waypoints(self, filename):
'''save waypoints to a file'''
try:
#need to remove the leading and trailing quotes in filename
self.wploader.save(filename.strip('"'))
except Exception as msg:
print("Failed to save %s - %s" % (filename, msg))
r... | 0.007444 |
def _check_type(self, input_val):
""" Check Input Type
This method checks if the input is a list, tuple or a numpy array and
converts the input to a numpy array
Parameters
----------
input_val : list, tuple or np.ndarray
Returns
-------
np.ndarr... | 0.002591 |
def read_data_as_dataframe(self,
travel_impedance_measure,
from_stop_I=None,
to_stop_I=None,
statistic=None):
"""
Recover pre-computed travel_impedance between od-pairs from the da... | 0.006149 |
def set_offset(self, offset, mid=None):
"""This method will allow the menu to be placed anywhere in the open
window instead of just the upper left corner.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Inputs:
offset - This is the x,y tuple of the... | 0.002863 |
def seek(self, pos):
""" Move to new input file position. If position is negative or out of file, raise Exception. """
if (pos > self.file_size) or (pos < 0):
raise Exception("Unable to seek - position out of file!")
self.file.seek(pos) | 0.011029 |
def _CreateDictReader(self, line_reader):
"""Iterates over the log lines and provide a reader for the values.
Args:
line_reader (iter): yields each line in the log file.
Yields:
dict[str, str]: column values keyed by column header.
"""
for line in line_reader:
if isinstance(line,... | 0.009213 |
def get_color(self, color, intensity=0):
""" Returns a QColor for a given color code, or None if one cannot be
constructed.
"""
if color is None:
return None
# Adjust for intensity, if possible.
if color < 8 and intensity > 0:
color += 8
... | 0.002283 |
def add_dimension(self, name, data=None):
"""Add a named dimension to this entity."""
self.dimensions.add(name)
if data is None:
valobj = self.__dimtype__()
else:
valobj = make_object(self.__dimtype__, data)
self._data[name] = valobj
setattr(self, ... | 0.005634 |
def medianThreshold(img, threshold=0.1, size=3, condition='>', copy=True):
'''
set every the pixel value of the given [img] to the median filtered one
of a given kernel [size]
in case the relative [threshold] is exeeded
condition = '>' OR '<'
'''
from scipy.ndimage import median_filte... | 0.00125 |
def _dump_model(model, attrs=None):
"""
Dump the model fields for debugging.
"""
fields = []
for field in model._meta.fields:
fields.append((field.name, str(getattr(model, field.name))))
if attrs is not None:
for attr in attrs:
fields.append((attr, str(getattr(mode... | 0.001484 |
def fput_object(self, bucket_name, object_name, file_path,
content_type='application/octet-stream',
metadata=None, sse=None, progress=None,
part_size=DEFAULT_PART_SIZE):
"""
Add a new object to the cloud storage server.
Examples:
... | 0.004237 |
def ko_data(queryset, field_names=None, name=None, safe=False, return_json=False):
"""
Given a QuerySet, return just the serialized representation
based on the knockout_fields as JavaScript.
"""
try:
try:
# Get an inital instance of the QS.
queryset_instance = query... | 0.002315 |
def r(self,*args,**kwargs):
"""
NAME:
r
PURPOSE:
return spherical radius at time t
INPUT:
t - (optional) time at which to get the radius
ro= (Object-wide default) physical scale for distances to use to convert
use_physical= use to ov... | 0.019006 |
def viewbox_mouse_event(self, event):
""" The ViewBox received a mouse event; update transform
accordingly.
Default implementation adjusts scale factor when scolling.
Parameters
----------
event : instance of Event
The event.
"""
BaseCamera.vi... | 0.003466 |
def _put(self, rtracker):
"""
Put a resource back in the queue.
:param rtracker: A resource.
:type rtracker: :class:`_ResourceTracker`
:raises PoolFullError: If pool is full.
:raises UnknownResourceError: If resource can't be found.
"""
with self._lock:
... | 0.001907 |
def yield_batch(iterable, batch_size, num_tensors=1):
"""Generator that yields batches of a DataFrame iterator.
Args:
:iterable: Spark partition iterator.
:batch_size: number of items to retrieve per invocation.
:num_tensors: number of tensors (columns) expected in each item.
Returns:
An array o... | 0.014398 |
def get_polling_override(self):
"""Get the current polling override value in milliseconds.
See :meth:`set_polling_override` for more information.
Returns:
None on error, otherwise the current override period in milliseconds
(0 = disabled).
"""
pollin... | 0.013158 |
def to_point(self, timestamp):
"""Get a Point conversion of this aggregation.
:type timestamp: :class: `datetime.datetime`
:param timestamp: The time to report the point as having been recorded.
:rtype: :class: `opencensus.metrics.export.point.Point`
:return: a :class: `opencen... | 0.004049 |
def sync(self, resolution, limit=None, **kwargs):
""" Add current Music library section as sync item for specified device.
See description of :func:`plexapi.library.LibrarySection.search()` for details about filtering / sorting and
:func:`plexapi.library.LibrarySection.sync()` for detail... | 0.005525 |
def set_range(self, start_index=0, end_index=None):
'''
Set range of tests to run
.. deprecated::
use :func:`~kitty.fuzzers.base.BaseFuzzer.set_test_list`
:param start_index: index to start at (default=0)
:param end_index: index to end at(default=None)
'''
... | 0.002928 |
def _effectupdate_enlarge_font_on_focus(self, time_passed):
"""Gradually enlarge the font size of the focused line."""
data = self._effects['enlarge-font-on-focus']
fps = data['raise_font_ps']
final_size = data['size'] * data['enlarge_factor']
for i, option in enumerate(self.opt... | 0.001637 |
def set_world(self, grd, start_y_x, y_x):
"""
tell the agent to move to location y,x
Why is there another grd object in the agent? Because
this is NOT the main grid, rather a copy for the agent
to overwrite with planning routes, etc.
The real grid is initialised in Worl... | 0.009032 |
def get_string_module(project, code, resource=None, force_errors=False):
"""Returns a `PyObject` object for the given code
If `force_errors` is `True`, `exceptions.ModuleSyntaxError` is
raised if module has syntax errors. This overrides
``ignore_syntax_errors`` project config.
"""
return pyob... | 0.002331 |
def _initiate_starttls(self, **kwargs):
"""Initiate starttls handshake over the socket.
"""
if self._tls_state == "connected":
raise RuntimeError("Already TLS-connected")
kwargs["do_handshake_on_connect"] = False
logger.debug("Wrapping the socket into ssl")
se... | 0.004425 |
def Sensitivity(self):
"""Sensitivity spectrum to convert flux in
:math:`erg \\; cm^{-2} \\; s^{-1} \\; \\AA^{-1}` to
:math:`count s^{-1} \\AA^{-1}`. Calculation is done by
combining the throughput curves with
:math:`\\frac{h \\; c}{\\lambda}` .
Returns
-------
... | 0.004071 |
def gtpswd(prompt, confirmPassword):
"""
Temporary wrapper for Twisted's getPassword until a version that supports
customizing the 'confirm' prompt is released.
"""
try:
return util.getPassword(prompt=prompt,
confirmPrompt=confirmPassword,
... | 0.002174 |
def findfivo(ol,*args,**kwargs):
'''
#findfivo f,i,v,o四元决定 fivo-4-tuple-engine
#cond_func diff_func(index,value,*diff_args)
'''
args = list(args)
lngth = args.__len__()
if(lngth==0):
diff_funcs_arr = kwargs['cond_funcs']
diff_args_... | 0.008911 |
def cmd_import(*args):
"""
Arguments:
<file_or_folder> [<file_or_folder> [...]]
[-- [--no_ocr] [--no_label_guessing] [--append <document_id>]]
Import a file or a PDF folder. OCR is run by default on images
and on PDF pages without text (PDF containing only images)
Please keep i... | 0.000329 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.