text stringlengths 78 104k | score float64 0 0.18 |
|---|---|
def juncs(args):
"""
%prog junctions junctions1.bed [junctions2.bed ...]
Given a TopHat junctions.bed file, trim the read overhang to get intron span
If more than one junction bed file is provided, uniq the junctions and
calculate cumulative (sum) junction support
"""
from tempfile import ... | 0.005772 |
def connectionStats(self) -> ConnectionStats:
"""
Get statistics about the connection.
"""
if not self.isReady():
raise ConnectionError('Not connected')
return ConnectionStats(
self._startTime,
time.time() - self._startTime,
self._n... | 0.004902 |
def from_geojson(geojson, srid=4326):
"""
Create a Geometry from a GeoJSON. The SRID can be overridden from the
expected 4326.
"""
type_ = geojson["type"].lower()
if type_ == "geometrycollection":
geometries = []
for geometry in geojson["geometries... | 0.002381 |
def add(self, *args, **kwargs):
"""Add the instance tied to the field to all the indexes
For the parameters, seen BaseIndex.add
"""
check_uniqueness = kwargs.pop('check_uniqueness', False)
args = self.prepare_args(args)
for index in self._indexes:
index.ad... | 0.005964 |
def remap(im, coords):
"""
Remap an RGB image using the given target coordinate array.
If available, OpenCV is used (faster), otherwise SciPy.
:type im: ndarray of shape (h,w,3)
:param im: RGB image to be remapped
:type coords: ndarray of shape (h,w,2)
:param coords: target coordin... | 0.005682 |
def capture_heroku_database(self):
""" Capture Heroku database backup. """
self.print_message("Capturing database backup for app '%s'" % self.args.source_app)
args = [
"heroku",
"pg:backups:capture",
"--app=%s" % self.args.source_app,
]
if self... | 0.005425 |
def parse(source, filename="<unknown>", mode="exec",
flags=[], version=None, engine=None):
"""
Parse a string into an abstract syntax tree.
This is the replacement for the built-in :meth:`..ast.parse`.
:param source: (string) Source code in the correct encoding
:param filename: (string) F... | 0.000755 |
def close(self):
"""Return this instance's socket to the connection pool.
"""
if not self.__closed:
self.__closed = True
self.pool.return_socket(self.sock)
self.sock, self.pool = None, None | 0.008032 |
def received(self, limit=None):
"""
Returns all the events that have been received (excluding sent events), until a limit if defined
Args:
limit (int, optional): the max length of the events to return (Default value = None)
Returns:
list: a list of received events
... | 0.011364 |
def replace_certificate_signing_request_approval(self, name, body, **kwargs):
"""
replace approval of the specified CertificateSigningRequest
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api... | 0.004079 |
def format_doc(*args, **kwargs):
"""
Replaces the docstring of the decorated object and then formats it.
Modeled after astropy.utils.decorators.format_doc
"""
def set_docstring(obj):
# None means: use the objects __doc__
doc = obj.__doc__
# Delete documentation in this case... | 0.001548 |
def generate_telesign_headers(customer_id,
api_key,
method_name,
resource,
url_encoded_fields,
date_rfc2616=None,
no... | 0.007846 |
def after_feature(context, feature):
"""Clean method that will be executed after each feature
:param context: behave context
:param feature: running feature
"""
# Behave dynamic environment
context.dyn_env.execute_after_feature_steps(context)
# Close drivers
DriverWrappersPool.close_dr... | 0.004425 |
def IndexedREMap(*re_strings, **kwargs):
"""Build a :class:`~.REMap` from the provided regular expression string.
Each string will be associated with the index corresponding to its position
in the argument list.
:param re_strings: The re_strings that will serve as keys in the map.
:param default: T... | 0.002988 |
def preload_record_data(self, obj):
"""
Modifies the ``obj`` values dict to alias the selected values to the column name that asked
for its selection.
For example, a datatable that declares a column ``'blog'`` which has a related lookup source
``'blog__name'`` will ensure that t... | 0.005583 |
def _parse_game_date_and_location(self, boxscore):
"""
Retrieve the game's date and location.
The game's meta information, such as date, location, attendance, and
duration, follow a complex parsing scheme that changes based on the
layout of the page. The information should be ab... | 0.000873 |
def stop_s3_bucket(client, resource):
"""
Stop an S3 bucket from being used
This function will try to
1. Add lifecycle policy to make sure objects inside it will expire
2. Block certain access to the bucket
"""
bucket_policy = {
'Version': '2012-10-17',
'Id': 'PutOb... | 0.002675 |
def clustal_align_protein(recs, work_dir, outfmt="fasta"):
"""
Align given proteins with clustalw.
recs are iterable of Biopython SeqIO objects
"""
fasta_file = op.join(work_dir, "prot-start.fasta")
align_file = op.join(work_dir, "prot.aln")
SeqIO.write(recs, file(fasta_file, "w"), "fasta")
... | 0.003731 |
def reachability_latency(tnet=None, paths=None, rratio=1, calc='global'):
"""
Reachability latency. This is the r-th longest temporal path.
Parameters
---------
data : array or dict
Can either be a network (graphlet or contact), binary unidrected only. Alternative can be a paths dictionar... | 0.002226 |
def get_or_create_pull(github_repo, title, body, head, base, *, none_if_no_commit=False):
"""Try to create the PR. If the PR exists, try to find it instead. Raises otherwise.
You should always use the complete head syntax "org:branch", since the syntax is required
in case of listing.
if "none_if_no_co... | 0.006008 |
def sql_datetime_literal(dt: DateTimeLikeType,
subsecond: bool = False) -> str:
"""
Transforms a Python object that is of duck type ``datetime.datetime`` into
an ANSI SQL literal string, like ``'2000-12-31 23:59:59'``, or if
``subsecond=True``, into the (non-ANSI) format
``'... | 0.00165 |
async def pin(self, disable_notification: bool = False):
"""
Pin message
:param disable_notification:
:return:
"""
return await self.chat.pin_message(self.message_id, disable_notification) | 0.012658 |
def allocate(self, nodes, append=True):
# TODO: check docstring
"""Allocates all nodes from `nodes` list in this route
Parameters
----------
nodes : type
Desc
append : bool, defaults to True
Desc
"""
nodes_demand ... | 0.006897 |
def remove_listener(self, uid):
"""Remove listener with given uid."""
self.listeners[:] = (listener for listener in self.listeners
if listener['uid'] != uid) | 0.009901 |
def _get_width(maxwidth):
"""Return the width of a single bar, when width of the page is given."""
width = maxwidth / 3
if maxwidth <= 60:
width = maxwidth
elif 60 < maxwidth <= 120:
width = maxwidth / 2
return width | 0.003968 |
def startLoop(self, useDriverLoop=True):
"""
Starts an event loop to process queued commands and callbacks.
@param useDriverLoop: If True, uses the run loop provided by the driver
(the default). If False, assumes the caller will enter its own
run loop which will pump any... | 0.003012 |
def quick_idw(input_geojson_points, variable_name, power, nb_class,
nb_pts=10000, resolution=None, disc_func=None,
mask=None, user_defined_breaks=None,
variable_name2=None, output='GeoJSON', **kwargs):
"""
Function acting as a one-shot wrapper around SmoothIdw object.
... | 0.003823 |
def neg_loglikelihood(y, mean, scale, shape, skewness):
""" Negative loglikelihood function
Parameters
----------
y : np.ndarray
univariate time series
mean : np.ndarray
array of location parameters for the Exponential distribution
scale : float... | 0.00274 |
def printhtml(csvdiffs):
"""print the html"""
soup = BeautifulSoup()
html = Tag(soup, name="html")
para1 = Tag(soup, name="p")
para1.append(csvdiffs[0][0])
para2 = Tag(soup, name="p")
para2.append(csvdiffs[1][0])
table = Tag(soup, name="table")
table.attrs.update(dict(border="1"))
... | 0.001656 |
def _fix_left(self, reading_id, last, start, found_id):
"""Fix a reading by looking for the nearest anchor point before it."""
accum_delta = 0
exact = True
crossed_break = False
if start == 0:
return None
for curr in self._anchor_points.islice(None, start -... | 0.003382 |
def detect(self, G):
"""Detect a single core-periphery pair using the Borgatti-Everett algorithm.
Parameters
----------
G : NetworkX graph object
Examples
--------
>>> import networkx as nx
>>> import cpalgorithm as cpa
>>> G = nx.karate_club_graph() # load the karate club network.
>>> be = c... | 0.045833 |
def list_devices(self, **kwargs):
"""List devices in the device catalog.
Example usage, listing all registered devices in the catalog:
.. code-block:: python
filters = { 'state': {'$eq': 'registered' } }
devices = api.list_devices(order='asc', filters=filters)
... | 0.002841 |
def time_indices(npts, dt, start, end, index):
"""
Determine the new start and end indices of the time series.
:param npts: Number of points in original time series
:param dt: Time step of original time series
:param start: int or float, optional, New start point
:param end: int or float, optio... | 0.003448 |
def get_key(bytes_, encoding, keynames='curtsies', full=False):
"""Return key pressed from bytes_ or None
Return a key name or None meaning it's an incomplete sequence of bytes
(more bytes needed to determine the key pressed)
encoding is how the bytes should be translated to unicode - it should
ma... | 0.005707 |
def collapseDuplicateSubtrees(ast):
"""Common subexpression elimination.
"""
seen = {}
aliases = []
for a in ast.allOf('op'):
if a in seen:
target = seen[a]
a.astType = 'alias'
a.value = target
a.children = ()
aliases.append(a)
... | 0.001776 |
def issue_link_types(self):
"""Get a list of issue link type Resources from the server.
:rtype: List[IssueLinkType]
"""
r_json = self._get_json('issueLinkType')
link_types = [IssueLinkType(self._options, self._session, raw_link_json) for raw_link_json in
r_... | 0.00813 |
def render_mako_template(self, template_path, context=None):
"""
Evaluate a mako template by resource path, applying the provided context
"""
context = context or {}
template_str = self.load_unicode(template_path)
lookup = MakoTemplateLookup(directories=[pkg_resources.res... | 0.008677 |
def verify_credentials(self, delegate=None):
"Verify a user's credentials."
parser = txml.Users(delegate)
return self.__downloadPage('/account/verify_credentials.xml', parser) | 0.01005 |
def selection_pos(self):
"""Return start and end positions of the visual selection respectively."""
buff = self._vim.current.buffer
beg = buff.mark('<')
end = buff.mark('>')
return beg, end | 0.0131 |
def _get_number_from_sign(sign):
"""
Captures numbers after sign for __convert_num__.
input = ["a", "a1", "be2", "bad3", "buru14"]
output = [0, 1, 2, 3, 14]
:param sign: string
:return: string, integer
"""
match = re.search(r'\d{1,3}$', sign)
if ... | 0.004608 |
def rectangle_centroid(rectangle):
"""
get the centroid of the rectangle
Keyword arguments:
rectangle -- polygon geojson object
return centroid
"""
bbox = rectangle['coordinates'][0]
xmin = bbox[0][0]
ymin = bbox[0][1]
xmax = bbox[2][0]
ymax = bbox[2][1]
xwidth = xmax ... | 0.004598 |
def location(self):
"""Return the location of the printer."""
try:
return self.data.get('identity').get('location')
except (KeyError, AttributeError):
return self.device_status_simple('') | 0.008333 |
def get_prep_lookup(self, lookup_name, rhs):
"""
Perform preliminary non-db specific lookup checks and conversions
"""
if lookup_name == 'exact':
if not isinstance(rhs, Model):
raise FilteredGenericForeignKeyFilteringException(
"For exact l... | 0.002413 |
def serveInBackground(port, serverName, prefix='/status/'):
"""Convenience function: spawn a background server thread that will
serve HTTP requests to get the status. Returns the thread."""
import flask, threading
from wsgiref.simple_server import make_server
app = flask.Flask(__name__)
registerStatsHandler... | 0.023013 |
def get_user_uk(cookie, tokens):
'''获取用户的uk'''
url = 'http://yun.baidu.com'
req = net.urlopen(url, headers={'Cookie': cookie.header_output()})
if req:
content = req.data.decode()
match = re.findall('/share/home\?uk=(\d+)" target=', content)
if len(match) == 1:
return ... | 0.006928 |
def async_refresh(self, *args, **kwargs):
"""
Trigger an asynchronous job to refresh the cache
"""
# We trigger the task with the class path to import as well as the
# (a) args and kwargs for instantiating the class
# (b) args and kwargs for calling the 'refresh' method
... | 0.002116 |
def strobogrammatic_in_range(low, high):
"""
:type low: str
:type high: str
:rtype: int
"""
res = []
count = 0
low_len = len(low)
high_len = len(high)
for i in range(low_len, high_len + 1):
res.extend(helper2(i, i))
for perm in res:
if len(perm) == low_len and... | 0.002 |
def get_container_mapping(self):
"""Returns a mapping of container -> postition
"""
layout = self.context.getLayout()
container_mapping = {}
for slot in layout:
if slot["type"] != "a":
continue
position = slot["position"]
contai... | 0.004545 |
def load(self, cachedir=None, cfgstr=None, fpath=None, verbose=None,
quiet=QUIET, ignore_keys=None):
"""
Loads the result from the given database
"""
if verbose is None:
verbose = getattr(self, 'verbose', VERBOSE)
if fpath is None:
fpath = sel... | 0.003953 |
def create_list_stories(
list_id_stories, number_of_stories, shuffle, max_threads
):
"""Show in a formatted way the stories for each item of the list."""
list_stories = []
with ThreadPoolExecutor(max_workers=max_threads) as executor:
futures = {
executor.submit(get_story, new)
... | 0.001546 |
def _write_executor_script(self, ostr):
"""Write shell script in charge of executing the command"""
environment = self.execution.get('environment') or {}
if not isinstance(environment, Mapping):
msg = 'Expected mapping for environment but got '
msg += str(type(environment... | 0.002494 |
def _interpret_ltude(value, name, psuffix, nsuffix):
"""Interpret a string, float, or tuple as a latitude or longitude angle.
`value` - The string to interpret.
`name` - 'latitude' or 'longitude', for use in exception messages.
`positive` - The string that indicates a positive angle ('N' or 'E').
`... | 0.000958 |
def djfrontend_normalize(version=None):
"""
Returns Normalize CSS file.
Included in HTML5 Boilerplate.
"""
if version is None:
version = getattr(settings, 'DJFRONTEND_NORMALIZE', DJFRONTEND_NORMALIZE_DEFAULT)
return format_html(
'<link rel="stylesheet" href="{0}djfrontend/css/no... | 0.007916 |
def set_widgets(self):
"""Set widgets on the Impact Functions Table 2 tab."""
self.tblFunctions2.clear()
hazard, exposure, _, _ = self.parent.\
selected_impact_function_constraints()
hazard_layer_geometries = get_allowed_geometries(
layer_purpose_hazard['key'])
... | 0.00064 |
def _set_dhw(self, status="Scheduled", mode=None, next_time=None):
"""Set DHW to On, Off or Auto, either indefinitely, or until a
specified time.
"""
data = {"Status": status,
"Mode": mode,
"NextTime": next_time,
"SpecialModes": None,
... | 0.002294 |
def query(function,
api_key=None,
args=None,
method='GET',
header_dict=None,
data=None,
opts=None):
'''
Slack object method function to construct and execute on the API URL.
:param api_key: The Slack api key.
:param function: The Slack ... | 0.000695 |
def sort(self, *args, **kwargs):
"""Sort this setlist in place."""
self._list.sort(*args, **kwargs)
for index, value in enumerate(self._list):
self._dict[value] = index | 0.033898 |
def analyse(self, demand_item, demand_item_code):
""" Run the analyis of the model
Doesn't return anything, but creates a new item ``LcoptModel.result_set`` containing the results
"""
my_analysis = Bw2Analysis(self)
self.result_set = my_analysis.run_analyses(demand_item, dema... | 0.010526 |
def _nodetool(cmd):
'''
Internal cassandra nodetool wrapper. Some functions are not
available via pycassa so we must rely on nodetool.
'''
nodetool = __salt__['config.option']('cassandra.nodetool')
host = __salt__['config.option']('cassandra.host')
return __salt__['cmd.run_stdout']('{0} -h {... | 0.005618 |
def setUpImports(self):
'''set import statements
'''
i = self.imports
print >>i, 'from pyremotevbox.ZSI.schema import GED, GTD'
print >>i, 'from pyremotevbox.ZSI.TCcompound import ComplexType, Struct'
module = self.getTypesModuleName()
package = self.getTypesModu... | 0.016187 |
def generate_new_bracket(self):
"""generate a new bracket"""
logger.debug(
'start to create a new SuccessiveHalving iteration, self.curr_s=%d', self.curr_s)
if self.curr_s < 0:
logger.info("s < 0, Finish this round of Hyperband in BOHB. Generate new round")
se... | 0.009667 |
def regenerate_routes(self):
'regenerate the routes after a new route is added'
for destination, origins in self.regexes.items():
# we want only the names that match the destination regexes.
resolved = [
name for name in self.names
if name is not d... | 0.004202 |
def process_rename(self, client, tag_value, resource_set):
"""
Move source tag value to destination tag value
- Collect value from old tag
- Delete old tag
- Create new tag & assign stored value
"""
self.log.info("Renaming tag on %s instances" % (len(resource_set... | 0.001803 |
def to_dict(self):
"""Converts this embed object into a dict."""
# add in the raw data into the dict
result = {
key[1:]: getattr(self, key)
for key in self.__slots__
if key[0] == '_' and hasattr(self, key)
}
# deal with basic conven... | 0.00184 |
def add_trajectory(self, name, overwrite=False, shape=(0,), title='',
chunksize=2**19, comp_filter=default_compression,
atom=tables.Float64Atom(), params=dict(),
chunkslice='bytes'):
"""Add an trajectory array in '/trajectories'.
"""
... | 0.010973 |
def sample_indexes(segyfile, t0=0.0, dt_override=None):
"""
Creates a list of values representing the samples in a trace at depth or time.
The list starts at *t0* and is incremented with am*dt* for the number of samples.
If a *dt_override* is not provided it will try to find a *dt* in the file.
Pa... | 0.004155 |
def __get_payload(self, uuid, failed):
"""Retry reading a message from the publish_uuid_store once, delete on the second failure."""
# Caller should have the publish_uuid_store lock
try:
return self.publish_uuid_store[uuid]
except Exception as exc:
msg = "Failed t... | 0.00607 |
def _save(self, objects, old_pos, new_pos):
"""WARNING: Intensive giggery-pokery zone."""
to_shift = objects.exclude(pk=self.pk) if self.pk else objects
# If not set, insert at end.
if self.sort_order is None:
self._move_to_end(objects)
# New insert.
elif no... | 0.002663 |
def formatMessage(self, record: logging.LogRecord) -> str:
"""Convert the already filled log record to a string."""
level_color = "0"
text_color = "0"
fmt = ""
if record.levelno <= logging.DEBUG:
fmt = "\033[0;37m" + logging.BASIC_FORMAT + "\033[0m"
elif recor... | 0.003083 |
def show_sidebar_button_info(python_input):
"""
Create `Layout` for the information in the right-bottom corner.
(The right part of the status bar.)
"""
@if_mousedown
def toggle_sidebar(mouse_event):
" Click handler for the menu. "
python_input.show_sidebar = not python_input.show... | 0.004573 |
def _strip_key(dictionary, keyword):
'''
look for a certain key within a dictionary and nullify ti's contents, check within nested
dictionaries and lists as well. Certain attributes such as "generation" will change even
when there were no changes made to the entity.
'''
for key, value in six.i... | 0.004539 |
def start_file(filename):
"""
Generalized os.startfile for all platforms supported by Qt
This function is simply wrapping QDesktopServices.openUrl
Returns True if successfull, otherwise returns False.
"""
from qtpy.QtCore import QUrl
from qtpy.QtGui import QDesktopServices
... | 0.001592 |
def _load_embedding(self, pretrained_file_path, elem_delim, init_unknown_vec, encoding='utf8'):
"""Load embedding vectors from the pre-trained token embedding file.
For every unknown token, if its representation `self.unknown_token` is encountered in the
pre-trained token embedding file, index... | 0.005375 |
def load_sample(self, file_path, tags=None):
"""Load a sample (or samples) into workbench
Args:
file_path: path to a file or directory
tags (optional): a list of tags for the sample/samples ['bad','aptz13']
Returns:
The list of md5s for all... | 0.004292 |
def host_config(self):
""" Ensure the host configuration file exists """
if platform.system() == 'Darwin':
default_file_dir = join(expanduser('~'),
'vent_files')
else:
default_file_dir = '/opt/vent_files'
status = self.ensure_di... | 0.0022 |
def get_mfd(self, slip, fault_width, shear_modulus=30.0,
disp_length_ratio=1.25E-5):
'''
Calculates activity rate on the fault
:param float slip:
Slip rate in mm/yr
:param fault_width:
Width of the fault (km)
:param float shear_modulus:
... | 0.001628 |
def calcfluxscale(d, imstd_med, flagfrac_med):
""" Given state dict and noise properties, estimate flux scale at the VLA
imstd and flagfrac are expected to be median (typical) values from sample in merged noise pkl.
"""
# useful functions and VLA parameters
sensitivity = lambda sefd, dt, bw, eta,... | 0.008106 |
def can_use_cached_output(self, contentitem):
"""
Tell whether the code should try reading cached output
"""
plugin = contentitem.plugin
return appsettings.FLUENT_CONTENTS_CACHE_OUTPUT and plugin.cache_output and contentitem.pk | 0.011236 |
def create_actor_polygon(pts, color, **kwargs):
""" Creates a VTK actor for rendering polygons.
:param pts: points
:type pts: vtkFloatArray
:param color: actor color
:type color: list
:return: a VTK actor
:rtype: vtkActor
"""
# Keyword arguments
array_name = kwargs.get('name', "... | 0.000738 |
def __verify_arguments(self):
"""!
@brief Checks algorithm's arguments and if some of them is incorrect then exception is thrown.
"""
if self.__kmax > len(self.__data):
raise ValueError("K max value '" + str(self.__kmax) + "' is bigger than amount of objects '" +
... | 0.008157 |
def create(self, notification_type, label=None, name=None, details=None):
"""
Defines a notification for handling an alarm.
"""
uri = "/%s" % self.uri_base
body = {"label": label or name,
"type": utils.get_id(notification_type),
"details": details,... | 0.004405 |
def pylint_color(score):
"""Return Pylint badge color.
Parameters
----------
score : float
A Pylint score
Returns
-------
str
Badge color
"""
# These are the score cutoffs for each color above.
# I.e. score==10 -> brightgreen, down to 7.5 > score >= 5 -> orange... | 0.001883 |
def _get_pitch(self, soup, pa):
"""
get pitch data
:param soup: Beautifulsoup object
:param pa: atbat data for plate appearance
:return: pitches result(list)
"""
pitches = []
ball_tally, strike_tally = 0, 0
for pitch in soup.find_all('pitch'):
... | 0.004918 |
def get_volume(self, id):
"""
return volume information if the argument is an id or a path
"""
# If the id is actually a path
if exists(id):
with open(id) as file:
size = os.lseek(file.fileno(), 0, os.SEEK_END)
return {'path': id, 'size': s... | 0.005571 |
def decode_data(self, data):
"""
Decode the response data
"""
assert self.get_empty() is False
assert self._data_encoded is True
if self._block_allowed:
data = self._decode_transfer_block_data(data)
else:
data = self._decode_transfer_data(d... | 0.005814 |
def __expand_subfeatures_aux (property_, dont_validate = False):
""" Helper for expand_subfeatures.
Given a feature and value, or just a value corresponding to an
implicit feature, returns a property set consisting of all component
subfeatures and their values. For example:
expand... | 0.006615 |
def images(language, word, n = 20, *args, **kwargs):
''' Returns a list of URLs to suitable images for a given word.'''
from lltk.images import google
return google(language, word, n, *args, **kwargs) | 0.029412 |
def setLogLevel(namespace=None, levelStr='info'):
'''
Set a new log level for a given namespace
LevelStr is: 'critical', 'error', 'warn', 'info', 'debug'
'''
level = LogLevel.levelWithName(levelStr)
logLevelFilterPredicate.setLogLevelForNamespace(namespace=namespace, level=level) | 0.006579 |
def list_dir_all(cookie, tokens, path):
'''得到一个目录中所有文件的信息, 并返回它的文件列表'''
pcs_files = []
page = 1
while True:
content = list_dir(cookie, tokens, path, page)
if not content:
return (path, None)
if not content['list']:
return (path, pcs_files)
pcs_file... | 0.00271 |
def protocol(self, name):
"""Returns the protocol object in the database given a certain name. Raises
an error if that does not exist."""
return self.query(Protocol).filter(Protocol.name==name).one() | 0.009434 |
def makeplantloop(idf, loopname, sloop, dloop, testing=None):
"""make plant loop with pip components"""
# -------- <testing ---------
testn = 0
# -------- testing> ---------
newplantloop = idf.newidfobject("PLANTLOOP", Name=loopname)
# -------- <testing ---------
testn = doingtesting(testing... | 0.002177 |
def to_dict(self, index=True, ordered=False):
"""
Returns a dict where the keys are the column names and the values are lists of the values for that column.
:param index: If True then include the index in the dict with the index_name as the key
:param ordered: If True then return an Ord... | 0.008363 |
def debug_tag(self, tag):
"""Setter for the debug tag.
By default, the tag is the serial of the device, but sometimes it may
be more descriptive to use a different tag of the user's choice.
Changing debug tag changes part of the prefix of debug info emitted by
this object, like... | 0.002506 |
def csv_tolist(path_to_file, **kwargs):
"""
Parse the csv file to a list of rows.
"""
result = []
encoding = kwargs.get('encoding', 'utf-8')
delimiter = kwargs.get('delimiter', ',')
dialect = kwargs.get('dialect', csv.excel)
_, _ext = path_to_file.split('.', 1)
try:
file... | 0.001403 |
def set_rinput(self, name, input_type, value):
"""
Add rinput to be used in next api call
:param name: key
:param input_type: variable type
:param value: value
:return: True/False, message
"""
if type(name) != str:
return False, "Name must be s... | 0.003906 |
def info(self, text, screenshot=None):
"""
Args:
- text(str): description
- screenshot: Bool or PIL.Image object
"""
step = {
'time': '%.1f' % (time.time()-self.start_time,),
'action': 'info',
'description': text,
's... | 0.00818 |
def generate_master_proteins(psms, protcol):
"""Fed with a psms generator, this returns the master proteins present
in the PSM table. PSMs with multiple master proteins are excluded."""
master_proteins = {}
if not protcol:
protcol = mzidtsvdata.HEADER_MASTER_PROT
for psm in psms:
pro... | 0.001558 |
def close(self):
"""
Release all resources associated with this factory.
"""
if self.mdr is None:
return
exc = (None, None, None)
try:
self.cursor.close()
except:
exc = sys.exc_info()
try:
if self.mdr.__exit_... | 0.007449 |
def task_failure_message(task_report):
"""Task failure message."""
trace_list = traceback.format_tb(task_report['traceback'])
body = 'Error: task failure\n\n'
body += 'Task ID: {}\n\n'.format(task_report['task_id'])
body += 'Archive: {}\n\n'.format(task_report['archive'])
body += 'Docker image: ... | 0.001866 |
def role_list(profile=None, **connection_args):
'''
Return a list of available roles (keystone role-list)
CLI Example:
.. code-block:: bash
salt '*' keystone.role_list
'''
kstone = auth(profile, **connection_args)
ret = {}
for role in kstone.roles.list():
ret[role.name... | 0.005405 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.