text stringlengths 78 104k | score float64 0 0.18 |
|---|---|
def save(self, doc):
"""Save a doc to cache
"""
self.log.debug('save()')
self.docs.append(doc)
self.commit() | 0.013514 |
def plot_2d_single(x, y, pdffilename, **kwargs):
"""
Do make_2d_single_plot and pass all arguments
args:
x: array_like
xdata
y: array_like
ydata
filepath: string
filepath of pdf to save
**kwargs:
... | 0.000813 |
def set_left_table(self, left_table=None):
"""
Sets the left table for this join clause. If no table is specified, the first table
in the query will be used
:type left_table: str or dict or :class:`Table <querybuilder.tables.Table>` or None
:param left_table: The left table bein... | 0.008333 |
def get_nameserver_detail_output_show_nameserver_nameserver_portsymb(self, **kwargs):
"""Auto Generated Code
"""
config = ET.Element("config")
get_nameserver_detail = ET.Element("get_nameserver_detail")
config = get_nameserver_detail
output = ET.SubElement(get_nameserver_... | 0.006242 |
def endpoint_list(auth=None, **kwargs):
'''
List endpoints
CLI Example:
.. code-block:: bash
salt '*' keystoneng.endpoint_list
'''
cloud = get_operator_cloud(auth)
kwargs = _clean_kwargs(**kwargs)
return cloud.list_endpoints(**kwargs) | 0.00361 |
def plot_scatter(f, xs, ys, size, pch, colour, title):
"""
Form a complex number.
Arguments:
f -- comma delimited file w/ x,y coordinates
xs -- if f not specified this is a file w/ x coordinates
ys -- if f not specified this is a filew / y coordinates
size -- size of the plo... | 0.000864 |
def restart(self, instance_id):
"""restarts a paused instance.
:param str instance_id: instance identifier
:return: None
"""
try:
if not self._paused:
log.debug("node %s is not paused, can't restart", instance_id)
return
s... | 0.002506 |
def disable_multicolor(self):
""" swap from the multicolor image to the single color image """
# disable the multicolor image
for color in ['red', 'green', 'blue']:
self.multicolorscales[color].config(state=tk.DISABLED, bg='grey')
self.multicolorframes[color].config(bg='g... | 0.006211 |
def profile_bins(self):
""" The binning to use to do the profile fitting
"""
log_mean = np.log10(self.mean())
log_half_width = max(5. * self.sigma(), 3.)
# Default is to profile over +-5 sigma,
# centered on mean, using 100 bins
return np.logspace(log_mean - log_h... | 0.004988 |
def getPostStates(self):
'''
Slightly extends the base version of this method by recalculating aLvlNow to account for the
consumer's (potential) misperception about their productivity level.
Parameters
----------
None
Returns
-------
None
... | 0.008163 |
def orientation(point_p, point_q, point_r):
"""
To find orientation of ordered triplet (p, q, r).
:param point_p:
:type point_p: models.Point
:param point_q:
:type point_q: models.Point
:param point_r:
:type point_r: models.Point
:return: 0: p, q and r are colinear
1: c... | 0.001486 |
def index():
"""Display a list of all user institutes."""
institute_objs = user_institutes(store, current_user)
institutes_count = ((institute_obj, store.cases(collaborator=institute_obj['_id']).count())
for institute_obj in institute_objs if institute_obj)
return dict(institutes... | 0.005917 |
async def main():
"""Run."""
async with ClientSession() as websession:
try:
client = Client(websession)
await client.load_local('<IP ADDRESS>', '<PASSWORD>', websession)
for controller in client.controllers.values():
print('CLIENT INFORMATION')
... | 0.000146 |
def read_dataset_schema(schema_path: str) -> Dict[str, List[TableColumn]]:
"""
Reads a schema from the text2sql data, returning a dictionary
mapping table names to their columns and respective types.
This handles columns in an arbitrary order and also allows
either ``{Table, Field}`` or ``{Table, Fi... | 0.002249 |
def equals(self, rhs):
"""Check to see if RHS is almost equal to float_value
Args:
rhs: the value to compare to float_value
Returns:
bool
"""
try:
return round(rhs-self._float_value, self._places) == 0
except TypeError:
# This is probably because either float_value or ... | 0.011142 |
def _check_holiday_structure(self, times):
""" To check the structure of the HolidayClass
:param list times: years or months or days or number week
:rtype: None or Exception
:return: in the case of exception returns the exception
"""
if not isinstance(times, list):
... | 0.003363 |
def add(self, action=None, subject=None, **conditions):
"""
Add ability are allowed using two arguments.
The first one is the action you're setting the permission for,
the second one is the class of object you're setting it on.
the third one is the subject's conditions must be m... | 0.003125 |
def svds_descending(M, k):
'''
In contrast to MATLAB, numpy's svds() arranges the singular
values in ascending order. In order to have matching codes,
we wrap it around by a function which re-sorts the singular
values and singular vectors.
Args:
M: 2D numpy array; the matrix whose... | 0.001548 |
def _insert_stack(stack, sample_count, call_tree):
"""Inserts stack into the call tree.
Args:
stack: Call stack.
sample_count: Sample count of call stack.
call_tree: Call tree.
"""
curr_level = call_tree
for func in stack:
next_lev... | 0.002706 |
def option_list_all(self):
"""Get a list of all options, including those in option groups."""
res = self.option_list[:]
for i in self.option_groups:
res.extend(i.option_list)
return res | 0.008696 |
def wait_until(what, times=-1):
"""Wait until `what` return True
Args:
what (Callable[bool]): Call `wait()` again and again until it returns True
times (int): Maximum times of trials before giving up
Returns:
True if success, False if times threshold reached
"""
while time... | 0.004739 |
def parse_time(t):
"""
Parse string time format to microsecond
"""
if isinstance(t, (str, unicode)):
b = re_time.match(t)
if b:
v, unit = int(b.group(1)), b.group(2)
if unit == 's':
return v*1000
elif unit == 'm':
return... | 0.001704 |
def update_option_set_by_id(cls, option_set_id, option_set, **kwargs):
"""Update OptionSet
Update attributes of OptionSet
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async=True
>>> thread = api.update_option_set_by_i... | 0.005786 |
def copy_rec(source, dest):
"""Copy files between diferent directories.
Copy one or more files to an existing directory. This function is
recursive, if the source is a directory, all its subdirectories are created
in the destination. Existing files in destination are overwrited without
any warning.... | 0.001081 |
def main():
"""
Testing function for PDA - DFA Diff Operation
"""
if len(argv) < 2:
print 'Usage: '
print ' Get A String %s CFG_fileA FST_fileB' % argv[0]
return
alphabet = createalphabet()
cfgtopda = CfgPDA(alphabet)
print '* Parsing Grammar:',... | 0.002736 |
def register_finders():
"""Register finders necessary for PEX to function properly."""
# If the previous finder is set, then we've already monkeypatched, so skip.
global __PREVIOUS_FINDER
if __PREVIOUS_FINDER:
return
# save previous finder so that it can be restored
previous_finder = _get_finder(zipim... | 0.019584 |
def block_uid(value: Union[str, BlockUID, None]) -> BlockUID:
"""
Convert value to BlockUID instance
:param value: Value to convert
:return:
"""
if isinstance(value, BlockUID):
return value
elif isinstance(value, str):
return BlockUID.from_str(value)
elif value is None:
... | 0.002278 |
def get_pod_container(self,
volume_mounts,
persistence_outputs=None,
persistence_data=None,
outputs_refs_jobs=None,
outputs_refs_experiments=None,
secret_refs=None,... | 0.008569 |
def pa11y_counts(results):
"""
Given a list of pa11y results, return three integers:
number of errors, number of warnings, and number of notices.
"""
num_error = 0
num_warning = 0
num_notice = 0
for result in results:
if result['type'] == 'error':
num_error += 1
... | 0.002 |
def set_input_by_number(self, number, value):
"""
Set the value of form element by its number in the form
:param number: number of element
:param value: value which should be set to element
"""
sel = XpathSelector(self.form)
elem = sel.select('.//input[@type="te... | 0.005051 |
def get_previous_version(version: str) -> Optional[str]:
"""
Returns the version prior to the given version.
:param version: A string with the version number.
:return: A string with the previous version number
"""
debug('get_previous_version')
found_version = False
for commit_hash, comm... | 0.001175 |
def get_model_id_constraints(model):
"""Returns constraints to target a specific model."""
pkname = model.primary_key_name
pkey = model.primary_key
return get_id_constraints(pkname, pkey) | 0.025641 |
def greedy_trails(subg, odds, verbose):
'''Greedily select trails by making the longest you can until the end'''
if verbose:
print('\tCreating edge map')
edges = defaultdict(list)
for x,y in subg.edges():
edges[x].append(y)
edges[y].append(x)
if verbose:
print('\tS... | 0.004711 |
def _dump_field(self, fd):
"""Dump single field.
"""
v = {}
v['label'] = Pbd.LABELS[fd.label]
v['type'] = fd.type_name if len(fd.type_name) > 0 else Pbd.TYPES[fd.type]
v['name'] = fd.name
v['number'] = fd.number
v['default'] = '[default = {}]'.format(fd.de... | 0.010187 |
def convert(image, shape, gray=False, dtype='float64', normalize='max'):
"""Convert image to standardized format.
Several properties of the input image may be changed including the shape,
data type and maximal value of the image. In addition, this function may
convert the image into an ODL object and/o... | 0.001206 |
def substitute(arg, value, replacement=None, else_=None):
"""
Substitute (replace) one or more values in a value expression
Parameters
----------
value : expr-like or dict
replacement : expr-like, optional
If an expression is passed to value, this must be passed
else_ : expr, optional... | 0.001416 |
def url(self, endpoint):
"""
Returns full URL for specified API endpoint
>>> translate = YandexTranslate("trnsl.1.1.20130421T140201Z.323e508a33e9d84b.f1e0d9ca9bcd0a00b0ef71d82e6cf4158183d09e")
>>> translate.url("langs")
'https://translate.yandex.net/api/v1.5/tr.json/getLangs'
>>> translate.url("... | 0.003231 |
def _set_session_type(self, v, load=False):
"""
Setter method for session_type, mapped from YANG variable /mpls_state/rsvp/sessions/psbs/session_type (session-type)
If this variable is read-only (config: false) in the
source YANG file, then _set_session_type is considered as a private
method. Backen... | 0.003979 |
def _add_thread(self, aThread):
"""
Private method to add a thread object to the snapshot.
@type aThread: L{Thread}
@param aThread: Thread object.
"""
## if not isinstance(aThread, Thread):
## if hasattr(aThread, '__class__'):
## typename = aThr... | 0.015248 |
def ecdsa_verify_raw(msg32, vrs, pub):
"""
Takes a message, the signature being verified and a pubkey
Returns 1 if signature is valid with given pubkey
"""
# assert len(vrs) == 3
if len(vrs) == 3:
return ecdsa_verify_compact(msg32, _encode_sig(*vrs), pub)
else:
return... | 0.002793 |
def CmdRegister(self, challenge_param, app_param):
"""Register security key.
Ask the security key to register with a particular origin & client.
Args:
challenge_param: Arbitrary 32 byte challenge string.
app_param: Arbitrary 32 byte applciation parameter.
Returns:
A binary structure... | 0.001916 |
def accept_changes(self):
"""Accept changes"""
for (i, j), value in list(self.model.changes.items()):
self.data[i, j] = value
if self.old_data_shape is not None:
self.data.shape = self.old_data_shape | 0.007937 |
def decrypt(encrypted_privkey, passphrase):
"""BIP0038 non-ec-multiply decryption. Returns WIF privkey.
:param Base58 encrypted_privkey: Private key
:param str passphrase: UTF-8 encoded passphrase for decryption
:return: BIP0038 non-ec-multiply decrypted key
:rtype: Base58
:raises SaltException... | 0.001702 |
def from_httplib(cls, message, duplicates=('set-cookie',)): # Python 2
"""Read headers from a Python 2 httplib message object."""
ret = cls(message.items())
# ret now contains only the last header line for each duplicate.
# Importing with all duplicates would be nice, but this would
... | 0.005533 |
def writeGraph(grph, name, edgeInfo = True, typing = False, suffix = 'csv', overwrite = True, allSameAttribute = False):
"""Writes both the edge list and the node attribute list of _grph_ to files starting with _name_.
The output files start with _name_, the file type (edgeList, nodeAttributes) then if typing ... | 0.012512 |
def action_list(self):
"Lists all hosts on the LB"
format = "%-35s %-25s %-8s"
print format % ("HOST", "ACTION", "SUBDOMS")
for host, details in sorted(self.client.get_all().items()):
if details[0] in ("proxy", "mirror"):
action = "%s<%s>" % (
... | 0.001754 |
def fromMessage(klass, message, op_endpoint=UNUSED):
"""Construct me from an OpenID Message.
@param message: An OpenID check_authentication Message
@type message: L{openid.message.Message}
@returntype: L{CheckAuthRequest}
"""
self = klass.__new__(klass)
self.mes... | 0.00239 |
def remove_tag(tag_id):
'''
Delete the records of certain tag.
'''
entry = TabPost2Tag.delete().where(
TabPost2Tag.tag_id == tag_id
)
entry.execute() | 0.009569 |
def get_mean_and_stddevs(self, sites, rup, dists, imt, stddev_types):
"""
See :meth:`superclass method
<.base.GroundShakingIntensityModel.get_mean_and_stddevs>`
for spec of input and result values.
"""
C = self.COEFFS[imt]
mean = (
self._get_magnitude_... | 0.003241 |
def plot_elbo(self, figsize=(15,7)):
"""
Plots the ELBO progress (if present)
"""
import matplotlib.pyplot as plt
plt.figure(figsize=figsize)
plt.plot(self.elbo_records)
plt.xlabel("Iterations")
plt.ylabel("ELBO")
plt.show() | 0.010101 |
def position(self):
""" Returns an integer corresponding to the position of the post in the topic. """
position = self.topic.posts.filter(Q(created__lt=self.created) | Q(id=self.id)).count()
return position | 0.017391 |
def _add_axislabels(xlabel,ylabel):
"""
NAME:
_add_axislabels
PURPOSE:
add axis labels to the current figure
INPUT:
xlabel - (raw string!) x-axis label, LaTeX math mode, no $s needed
ylabel - (raw string!) y-axis label, LaTeX math mode, no $s needed
OUTPUT:
... | 0.010568 |
def credit_card_expiration_date(self, minimum: int = 16,
maximum: int = 25) -> str:
"""Generate a random expiration date for credit card.
:param minimum: Date of issue.
:param maximum: Maximum of expiration_date.
:return: Expiration date of credit car... | 0.005803 |
def is_course_complete(last_update):
"""
Determine is the course is likely to have been terminated or not.
We return True if the timestamp given by last_update is 30 days or older
than today's date. Otherwise, we return True.
The intended use case for this is to detect if a given courses has not
... | 0.001468 |
def lazy_constant(fn):
"""Decorator to make a function that takes no arguments use the LazyConstant class."""
class NewLazyConstant(LazyConstant):
@functools.wraps(fn)
def __call__(self):
return self.get_value()
return NewLazyConstant(fn) | 0.007143 |
def to_pixel(self, wcs, mode='all'):
"""
Convert the aperture to an `EllipticalAnnulus` object defined in
pixel coordinates.
Parameters
----------
wcs : `~astropy.wcs.WCS`
The world coordinate system (WCS) transformation to use.
mode : {'all', 'wcs'}... | 0.002663 |
def get_private_room_history(self, room_id, oldest=None, **kwargs):
"""
Get various history of specific private group in this case private
:param room_id:
:param kwargs:
:return:
"""
return GetPrivateRoomHistory(settings=self.settings, **kwargs).call(
... | 0.005063 |
def run(self, series, exponent=None):
'''
:type series: List
:type exponent: int
:rtype: float
'''
try:
return self.calculateHurst(series, exponent)
except Exception as e:
print(" Error: %s" % e) | 0.00722 |
def update(self, authorize_redirect_url=values.unset, company_name=values.unset,
deauthorize_callback_method=values.unset,
deauthorize_callback_url=values.unset, description=values.unset,
friendly_name=values.unset, homepage_url=values.unset,
permissions=value... | 0.006432 |
def enable_encryption(self, output_key, input_key):
"""Enable encryption with the specified keys."""
self._chacha = chacha20.Chacha20Cipher(output_key, input_key) | 0.011236 |
def dropna(self, axis=0, how='any', inplace=False):
"""
Drop 2D from panel, holding passed axis constant.
Parameters
----------
axis : int, default 0
Axis to hold constant. E.g. axis=1 will drop major_axis entries
having a certain amount of NA data
... | 0.001626 |
def esxcli_cmd(cmd_str, host=None, username=None, password=None, protocol=None, port=None, esxi_hosts=None, credstore=None):
'''
Run an ESXCLI command directly on the host or list of hosts.
host
The location of the host.
username
The username used to login to the host, such as ``root``... | 0.003971 |
def p_operation_definition5(self, p):
"""
operation_definition : operation_type variable_definitions directives selection_set
"""
p[0] = self.operation_cls(p[1])(
selections=p[4],
variable_definitions=p[2],
directives=p[3],
) | 0.009967 |
def is_binary(data):
'''
Detects if the passed string of data is binary or text
'''
if not data or not isinstance(data, (six.string_types, six.binary_type)):
return False
if isinstance(data, six.binary_type):
if b'\0' in data:
return True
elif str('\0') in data:
... | 0.003089 |
def vote(self):
"""选举新闻标题
Return:
title -- 新闻标题,str类型
"""
# 初始化
weight_queue = []
sameKV = 0
count = 0
# 相似度计算
for unit in self._queue:
unit_set = convert_to_set(unit)
for i in unit_set:
... | 0.005351 |
def p_iteration_statement_4(self, p):
"""
iteration_statement \
: FOR LPAREN left_hand_side_expr IN expr RPAREN statement
"""
p[0] = ast.ForIn(item=p[3], iterable=p[5], statement=p[7]) | 0.008772 |
def _replace_tex_math(node, mml_url, mc_client=None, retry=0):
"""call mml-api service to replace TeX math in body of node with mathml"""
math = node.attrib['data-math'] or node.text
if math is None:
return None
eq = {}
if mc_client:
math_key = hashlib.md5(math.encode('utf-8')).hex... | 0.000712 |
def _validate_states(states, topology):
'''Validate states to avoid ignoring states during initialization'''
states = states or []
if isinstance(states, dict):
for x in states:
assert x in topology.node
else:
assert len(states) <= len(topology)
return states | 0.003268 |
def read(self, input_stream, kmip_version=enums.KMIPVersion.KMIP_1_0):
"""
Read the data encoding the DeviceCredential struct and decode it into
its constituent parts.
Args:
input_stream (stream): A data stream containing encoded object
data, supporting a rea... | 0.000742 |
def fits_finder_chart(
fitsfile,
outfile,
fitsext=0,
wcsfrom=None,
scale=ZScaleInterval(),
stretch=LinearStretch(),
colormap=plt.cm.gray_r,
findersize=None,
finder_coordlimits=None,
overlay_ra=None,
overlay_decl=None,
overla... | 0.002987 |
def _append_html_element(self, item, element, html, glue=" ",
after=True):
"""Appends an html value after or before the element in the item dict
:param item: dictionary that represents an analysis row
:param element: id of the element the html must be added the... | 0.003822 |
def reparse(self, filepath):
"""Reparses the specified module file from disk, overwriting any
cached representations etc. of the module."""
#The easiest way to do this is to touch the file and then call
#the regular parse method so that the cache becomes invalidated.
self.tramp.t... | 0.011019 |
def dispatch(self, event):
"""Given an event, send it to all the subscribers.
Args
event (:class:`~bigchaindb.events.EventTypes`): the event to
dispatch to all the subscribers.
"""
for event_types, queues in self.queues.items():
if event.type & e... | 0.004938 |
def run(self, lines):
"""Filter method"""
# Nothing to do in this case
if (not self.adjust_path) and (not self.image_ext):
return lines
ret = []
for line in lines:
processed = {}
while True:
alt = ''
img_name =... | 0.003493 |
def delete_records_safely_by_xml_id(env, xml_ids):
"""This removes in the safest possible way the records whose XML-IDs are
passed as argument.
:param xml_ids: List of XML-ID string identifiers of the records to remove.
"""
for xml_id in xml_ids:
logger.debug('Deleting record for XML-ID %s'... | 0.001873 |
def remove_overlap(self, also_remove_contiguous: bool = False) -> None:
"""
Merges any overlapping intervals.
Args:
also_remove_contiguous: treat contiguous (as well as overlapping)
intervals as worthy of merging?
"""
overlap = True
while over... | 0.004808 |
def clear_input(self):
"""Remove all the input files (at the end of a reading)."""
for item in listdir(self.input_dir):
item_path = path.join(self.input_dir, item)
if path.isfile(item_path):
remove(item_path)
logger.debug('Removed input %s.' % item... | 0.005865 |
def make_citation_dict(td):
"""
Update a citation dictionary by editing the Author field
:param td: A BixTex format citation dict or a term
:return:
"""
from datetime import datetime
if isinstance(td, dict):
d = td
name = d['name_link']
else:
d = td.as_dict()
... | 0.005479 |
def _validate_password(self, password):
"""Validate GNTP Message against stored password"""
self.password = password
if password is None:
raise errors.AuthError('Missing password')
keyHash = self.info.get('keyHash', None)
if keyHash is None and self.password is None:
return True
if keyHash is None:
... | 0.026166 |
def handle_msg(self, msg, **config):
"""
If we can handle the given message, return the remainder of the topic.
Returns None if we can't handle the message.
"""
match = self.__prefix__.match(msg['topic'])
if match:
return match.groups()[-1] or "" | 0.006515 |
def get_mems_of_org(self):
"""
Retrieves the emails of the members of the organization. Note this Only
gets public emails. Private emails would need authentication for each
user.
"""
print 'Getting members\' emails.'
for member in self.org_retrieved.iter_members()... | 0.006974 |
def force_user_presence(self, user: User, presence: UserPresence):
""" Forcibly set the ``user`` presence to ``presence``.
This method is only provided to cover an edge case in our use of the Matrix protocol and
should **not** generally be used.
"""
self._userid_to_presence[user... | 0.008824 |
def hybrid_forward(self, F, x):
"""Perform pixel-shuffling on the input."""
# `transpose` doesn't support 8D, need other implementation
f1, f2, f3 = self._factors
# (N, C*f1*f2*f3, D, H, W)
x = F.reshape(x, (0, -4, -1, f1 * f2... | 0.012693 |
def histogram(args):
"""
%prog histogram meryl.histogram species K
Plot the histogram based on meryl K-mer distribution, species and N are
only used to annotate the graphic.
"""
p = OptionParser(histogram.__doc__)
p.add_option("--vmin", dest="vmin", default=1, type="int",
help="... | 0.002308 |
def is_upload(action):
"""Checks if this should be a user upload
:param action:
:return: True if this is a file we intend to upload from the user
"""
return 'r' in action.type._mode and (action.default is None or
getattr(action.default, 'name') not in (sys.s... | 0.005731 |
def save(self, *args, **kwargs):
"""Auto-generate a slug from the name."""
self._create_slug()
self._create_date_slug()
self._render_content()
# Call ``_set_published`` the *first* time this Entry is published.
# NOTE: if this is unpublished, and then republished, this m... | 0.002497 |
def reset(self):
"""
Resets the agent to its initial state (e.g. on experiment start). Updates the Model's internal episode and
time step counter, internal states, and resets preprocessors.
"""
self.episode, self.timestep, self.next_internals = self.model.reset()
self.cur... | 0.008427 |
def pin_auth(self, request):
"""Authenticates with the pin."""
exhausted = False
auth = False
trust = self.check_pin_trust(request.environ)
# If the trust return value is `None` it means that the cookie is
# set but the stored pin hash value is bad. This means that the
... | 0.001847 |
def listen(self):
"""Listen to both stdout and stderr
We'll want messages of a particular origin and format to
cause QML to perform some action. Other messages are simply
forwarded, as they are expected to be plain print or error messages.
"""
def _listen():
... | 0.000729 |
def nvmlDeviceGetEncoderUtilization(handle):
r"""
/**
* Retrieves the current utilization and sampling size in microseconds for the Encoder
*
* For Kepler &tm; or newer fully supported devices.
*
* @param device The identifier of the target device
* @p... | 0.00668 |
def compute_stability_classification(self, predicted_data, record, dataframe_record):
'''Calculate the stability classification for the analysis cases. Must be called after get_experimental_ddg_values.'''
new_idxs = []
stability_classication_x_cutoff, stability_classication_y_cutoff = self.stab... | 0.00972 |
def load_mp(cls, file_pointer, _mft_config=None):
'''The initialization process takes a file like object "file_pointer"
and loads it in the internal structures. "use_cores" can be definied
if multiple cores are to be used. The "size" argument is the size
of the MFT entries. If not provid... | 0.005341 |
def parse_intf_section(interface):
"""Parse a single entry from show interfaces output.
Different cases:
mgmt0 is up
admin state is up
Ethernet2/1 is up
admin state is up, Dedicated Interface
Vlan1 is down (Administratively down), line protocol is down, autostate enabled
Ethernet154/... | 0.00109 |
def config_amend_(self,config_amend):
""" This will take a YAML or dict configuration and load it into
the configuration file for furthur usage. The good part
about this method is that it doesn't clobber, only appends
when keys are missing.
This should provide a ... | 0.006085 |
def _get_step_inputs(step, file_vs, std_vs, parallel_ids, wf=None):
"""Retrieve inputs for a step from existing variables.
Potentially nests inputs to deal with merging split variables. If
we split previously and are merging now, then we only nest those
coming from the split process.
"""
inputs... | 0.003917 |
def erase(self, message=None):
"""Erase something whose you write before: message"""
if not message:
message = self.last_message
# Move cursor to the beginning of line
super(Animation, self).write("\033[G")
# Erase in line from cursor
super(Animation, self).wr... | 0.006006 |
def getMaxWidth(self, rows):
'Return the maximum length of any cell in column or its header.'
w = 0
if len(rows) > 0:
w = max(max(len(self.getDisplayValue(r)) for r in rows), len(self.name))+2
return max(w, len(self.name)) | 0.011278 |
def scores(self):
"""Return a list of the items with their final scores.
The final score of each item is its average score multiplied by the
square root of its length. This reduces to sum * len^(-1/2).
"""
return map(
lambda x: (x[0], sum(x[1]) * len(x[1]) ** -.5),
... | 0.005405 |
def update_job_libraries(
logger,
job_list,
match,
new_library_path,
token,
host,
):
"""
update libraries on jobs using same major version
Parameters
----------
logger: logging object
configured in cli_commands.py
job_list: list of strings
output of get_j... | 0.000511 |
def environment_as(**kwargs):
"""Update the environment to the supplied values, for example:
with environment_as(PYTHONPATH='foo:bar:baz',
PYTHON='/usr/bin/python2.7'):
subprocess.Popen(foo).wait()
"""
new_environment = kwargs
old_environment = {}
def setenv(key, val):
if val... | 0.016591 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.