text stringlengths 78 104k | score float64 0 0.18 |
|---|---|
def resources_of_config(config):
""" Returns all resources and models from config.
"""
return set( # unique values
sum([ # join lists to flat list
list(value) # if value is iter (ex: list of resources)
if hasattr(value, '__iter__')
el... | 0.002262 |
def get_marks(self):
"""
Get a list of the names of all currently set marks.
:rtype: list
"""
data = self.message(MessageType.GET_MARKS, '')
return json.loads(data) | 0.00939 |
def import_wiki_json(path='wikipedia_crawler_data.json', model=WikiItem, batch_len=100, db_alias='default', verbosity=2):
"""Read json file and create the appropriate records according to the given database model."""
return djdb.import_json(path=path, model=model, batch_len=batch_len, db_alias=db_alias, verbos... | 0.011976 |
def _calculate_bounds(self):
"""Calculate beginning and end of logfile."""
if self._bounds_calculated:
# Assume no need to recalc bounds for lifetime of a Logfile object
return
if self.from_stdin:
return False
# we should be able to find a valid log ... | 0.001001 |
def group_callback(self, iocb):
"""Callback when a child iocb completes."""
if _debug: IOGroup._debug("group_callback %r", iocb)
# check all the members
for iocb in self.ioMembers:
if not iocb.ioComplete.isSet():
if _debug: IOGroup._debug(" - waiting for c... | 0.009276 |
def get_orbit_number(self, utc_time, tbus_style=False):
"""Calculate orbit number at specified time.
Optionally use TBUS-style orbit numbering (TLE orbit number + 1)
"""
utc_time = np.datetime64(utc_time)
try:
dt = astronomy._days(utc_time - self.orbit_elements.an_tim... | 0.001299 |
def init_matplotlib_backend(backend=None):
"""This function initializes the matplotlib backend. When no
DISPLAY is available the backend is automatically set to 'Agg'.
Parameters
----------
backend : str
matplotlib backend name.
"""
import matplotlib
try:
os.environ['D... | 0.002188 |
def open_file(self, file_):
"""
Receives a file path has input and returns a
string with the contents of the file
"""
with open(file_, 'r', encoding='utf-8') as file:
text = ''
for line in file:
text += line
return text | 0.006515 |
def document(schema_file):
'''Generate reStructuredText documentation from a confirm schema.'''
schema = load_schema_file(open(schema_file, 'r'))
documentation = generate_documentation(schema)
sys.stdout.write(documentation) | 0.004167 |
def index(self, date):
'''
Overloads the default list.index, because of special behaviour if the
date is not in the list:
- If <date> is not in the list, the index of the latest date before
<date> is returned.
- If <date> is earlier than the earliest date ... | 0.003417 |
def create_sysdig_capture(self, hostname, capture_name, duration, capture_filter='', folder='/'):
'''**Description**
Create a new sysdig capture. The capture will be immediately started.
**Arguments**
- **hostname**: the hostname of the instrumented host where the capture will b... | 0.004866 |
def lobstrindex(args):
"""
%prog lobstrindex hg38.trf.bed hg38.upper.fa
Make lobSTR index. Make sure the FASTA contain only upper case (so use
fasta.format --upper to convert from UCSC fasta). The bed file is generated
by str().
"""
p = OptionParser(lobstrindex.__doc__)
p.add_option("--... | 0.000553 |
def run(items):
"""Perform detection of structural variations with Manta.
"""
paired = vcfutils.get_paired(items)
data = paired.tumor_data if paired else items[0]
work_dir = _sv_workdir(data)
variant_file = _get_out_file(work_dir, paired)
if not utils.file_exists(variant_file):
with ... | 0.003139 |
def p_expr_number(p):
"number : NUMBER"
p[0] = node.number(p[1], lineno=p.lineno(1), lexpos=p.lexpos(1)) | 0.008929 |
def accumulate(iterable):
" Return series of accumulated sums. "
iterator = iter(iterable)
sum_data = next(iterator)
yield sum_data
for el in iterator:
sum_data += el
yield sum_data | 0.030151 |
def syncdb(pool=None):
"""
Create tables if they don't exist
"""
from flask_philo_sqlalchemy.schema import Base # noqa
from flask_philo_sqlalchemy.orm import BaseModel # noqa
from flask_philo_sqlalchemy.connection import create_pool
if pool is None:
pool = create_pool()
for c... | 0.002445 |
def _set_final_path_view(self):
# type: (Descriptor) -> int
"""Set final path view and return required space on disk
:param Descriptor self: this
:rtype: int
:return: required size on disk
"""
# set final path if vectored io stripe
if self._ase.vectored_io... | 0.004367 |
def format_ffmpeg_filter(name, params):
""" Build a string to call a FFMpeg filter. """
return "%s=%s" % (name,
":".join("%s=%s" % (k, v) for k, v in params.items())) | 0.015789 |
def cloudata(site):
""" Returns a dictionary with all the tag clouds related to a site.
"""
# XXX: this looks like it can be done via ORM
tagdata = getquery("""
SELECT feedjack_post.feed_id, feedjack_tag.name, COUNT(*)
FROM feedjack_post, feedjack_subscriber, feedjack_tag,
feedjack_post_tags
WHERE feedjack... | 0.028459 |
def _insert_dLbl_in_sequence(self, idx):
"""
Return a newly created `c:dLbl` element having `c:idx` child of *idx*
and inserted in numeric sequence among the `c:dLbl` children of this
element.
"""
new_dLbl = self._new_dLbl()
new_dLbl.idx.val = idx
dLbl = ... | 0.003289 |
def prepare_for_translation(localization_bundle_path):
""" Prepares the localization bundle for translation.
This means, after creating the strings files using genstrings.sh, this will produce '.pending' files, that contain
the files that are yet to be translated.
Args:
localization_bundle_pat... | 0.005014 |
def render_pdf_file_to_image_files_pdftoppm_pgm(pdf_file_name, root_output_file_path,
res_x=150, res_y=150):
"""Same as renderPdfFileToImageFile_pdftoppm_ppm but with -gray option for pgm."""
comm_output = render_pdf_file_to_image_files_pdftoppm_ppm(pdf_file_name,
... | 0.014052 |
def today(self):
"""Return the Day for the current day"""
today = timezone.now().date()
try:
return Day.objects.get(date=today)
except Day.DoesNotExist:
return None | 0.009091 |
def update_columns_dict(self, kwargs):
"""
TODO: add documentation
"""
super(Mesh, self).update_columns_dict(kwargs)
# if kwargs.get('vnormals', None) is not None or kwargs.get('tnormals', None) is not None:
# self._compute_mus()
if kwargs.get('triangles', No... | 0.00789 |
def twovec(axdef, indexa, plndef, indexp):
"""
Find the transformation to the right-handed frame having a
given vector as a specified axis and having a second given
vector lying in a specified coordinate plane.
http://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/twovec_c.html
:param axdef:... | 0.00094 |
def download(sid, credentials=None, subjects_path=None, overwrite=False, release='HCP_1200',
database='hcp-openaccess', file_list=None):
'''
download(sid) downloads the data for subject with the given subject id. By default, the subject
will be placed in the first HCP subject directory in the... | 0.008707 |
def fill(self, text=""):
"Indent a piece of text, according to the current indentation level"
self.f.write(self.line_marker + " " * self._indent + text)
self.line_marker = "\n" | 0.009852 |
def schemaNewParserCtxt(URL):
"""Create an XML Schemas parse context for that file/resource
expected to contain an XML Schemas file. """
ret = libxml2mod.xmlSchemaNewParserCtxt(URL)
if ret is None:raise parserError('xmlSchemaNewParserCtxt() failed')
return SchemaParserCtxt(_obj=ret) | 0.009804 |
def home_flagged_axes(self, axes_string):
'''
Given a list of axes to check, this method will home each axis if
Smoothieware's internal flag sets it as needing to be homed
'''
axes_that_need_to_home = [
axis
for axis, already_homed in self.homed_flags.item... | 0.003831 |
def paste_action_callback(self, *event):
"""Callback method for paste action"""
if react_to_event(self.view, self.tree_view, event):
sm_selection, _ = self.get_state_machine_selection()
# only list specific elements are cut by widget
if len(sm_selection.states) == 1:
... | 0.005386 |
def get_keys(self, bucket, timeout=None):
"""
Fetch a list of keys for the bucket
"""
bucket_type = self._get_bucket_type(bucket.bucket_type)
url = self.key_list_path(bucket.name, bucket_type=bucket_type,
timeout=timeout)
status, _, body =... | 0.003831 |
async def load_blob(reader, elem_type, params=None, elem=None):
"""
Loads blob from reader to the element. Returns the loaded blob.
:param reader:
:param elem_type:
:param params:
:param elem:
:return:
"""
ivalue = await load_varint(reader)
fvalue = bytearray(ivalue)
await r... | 0.001742 |
def _compute_forearc_backarc_term(self, C, sites, dists, rup):
"""
Compute back-arc term of Equation 3
"""
# flag 1 (R < 335 & R >= 205)
flag1 = np.zeros(len(dists.rhypo))
ind1 = np.logical_and((dists.rhypo < 335), (dists.rhypo >= 205))
flag1[ind1] = 1.0
... | 0.001434 |
def find_all_globals(node, globs):
"""Search Syntax Tree node to find variable names that are global."""
for n in node:
if isinstance(n, SyntaxTree):
globs = find_all_globals(n, globs)
elif n.kind in read_write_global_ops:
globs.add(n.pattr)
return globs | 0.003268 |
def delete_editor(userid):
"""
:param userid: a string representing the user's UW NetID
:return: True if request is successful, False otherwise.
raise DataFailureException or a corresponding TrumbaException
if the request failed or an error code has been returned.
"""
url = _make_del_account... | 0.002079 |
def genetic_algorithm(population, fitness_fn, ngen=1000, pmut=0.1):
"[Fig. 4.8]"
for i in range(ngen):
new_population = []
for i in len(population):
fitnesses = map(fitness_fn, population)
p1, p2 = weighted_sample_with_replacement(population, fitnesses, 2)
chi... | 0.001887 |
def slow_scroll_to(self, selector, by=By.CSS_SELECTOR,
timeout=settings.SMALL_TIMEOUT):
''' Slow motion scroll to destination '''
if self.timeout_multiplier and timeout == settings.SMALL_TIMEOUT:
timeout = self.__get_new_timeout(timeout)
element = self.wait_for... | 0.006977 |
def bytes_available(device):
"""
Determines the number of bytes available for reading from an
AlarmDecoder device
:param device: the AlarmDecoder device
:type device: :py:class:`~alarmdecoder.devices.Device`
:returns: int
"""
bytes_avail = 0
if isinstance(device, alarmdecoder.devi... | 0.001608 |
def calc_autocorrelation(Signal, FFT=False, PyCUDA=False):
"""
Calculates the autocorrelation from a given Signal via using
Parameters
----------
Signal : array-like
Array containing the signal to have the autocorrelation calculated for
FFT : optional, bool
Uses FFT to acce... | 0.006377 |
def validate(policy):
"""
Validates a policy and its parameters and raises an error if invalid
"""
for param, value in policy.items():
if param not in ACCEPTED_SECURITY_TYPES.keys():
raise SecurityError('Invalid Security Parameter: {}'.format(param))
if type(value) != ACCEP... | 0.001637 |
def add_ini_opts(self, cp, section):
"""
Parse command line options from a given section in an ini file and
pass to the executable.
@param cp: ConfigParser object pointing to the ini file.
@param section: section of the ini file to add to the options.
"""
for opt in cp.options(section):
... | 0.010178 |
def _get_msge_with_gradient(data, delta, xvschema, skipstep, p):
"""Calculate mean squared generalization error and its gradient,
automatically selecting the best function.
"""
t, m, l = data.shape
n = (l - p) * t
underdetermined = n < m * p
if underdetermined:
return _msge_with_gr... | 0.003478 |
def define_vol_xml_str(xml, **kwargs): # pylint: disable=redefined-outer-name
'''
Define a volume based on the XML passed to the function
:param xml: libvirt XML definition of the storage volume
:param connection: libvirt connection URI, overriding defaults
.. versionadded:: 2019.2.0
:par... | 0.000696 |
def crossposted_content(self):
"""Content to be cross-posted on other sites. This method adds an
additional line of content with a link back to the original site as
well as the `#end` tag. This signals the end blog content according
to: https://support.google.com/blogger/answer/41452?hl=... | 0.003135 |
def terminate(self, sa):
"""Terminate an SA.
:param sa: the SA to terminate
:type sa: dict
:return: logs emitted by command, with `errmsg` given on failure
:rtype: :py:class:`vici.session.CommandResult`
"""
response = self.handler.streamed_request("terminate", "c... | 0.008 |
def from_files(cls, *glyphdata_files):
"""Return GlyphData holding data from a list of XML file paths."""
name_mapping = {}
alt_name_mapping = {}
production_name_mapping = {}
for glyphdata_file in glyphdata_files:
glyph_data = xml.etree.ElementTree.parse(glyphdata_fi... | 0.003653 |
def getClass(self, id=None, uri=None, match=None):
"""
get the saved-class with given ID or via other methods...
Note: it tries to guess what is being passed..
In [1]: g.getClass(uri='http://www.w3.org/2000/01/rdf-schema#Resource')
Out[1]: <Class *http://www.w3.org/2000/01/rdf-... | 0.003034 |
def print_boolean_net(self, out_file=None):
"""Return a Boolean network from the assembled graph.
See https://github.com/ialbert/booleannet for details about
the format used to encode the Boolean rules.
Parameters
----------
out_file : Optional[str]
A file n... | 0.000885 |
def run(self, schedule_id, **kwargs):
"""
Synchronises the schedule specified by the ID `schedule_id` to the
scheduler service.
Arguments:
schedule_id {str} -- The ID of the schedule to sync
"""
log = self.get_logger(**kwargs)
try:
schedu... | 0.001311 |
def main():
"""
Runs a clusterer from the command-line. Calls JVM start/stop automatically.
Use -h to see all options.
"""
parser = argparse.ArgumentParser(
description='Performs clustering from the command-line. Calls JVM start/stop automatically.')
parser.add_argument("-j", metavar="cl... | 0.005241 |
def parse(cls, requester, entry):
"""
Turns a JSON object into a model instance.
"""
if not type(entry) is dict:
return entry
for key_to_parse, cls_to_parse in six.iteritems(cls.parser):
if key_to_parse in entry:
entry[key_to_parse] = cls_t... | 0.004525 |
def getOutEdges(self, vertex, rawResults = False) :
"""An alias for getEdges() that returns only the out Edges"""
return self.getEdges(vertex, inEdges = False, outEdges = True, rawResults = rawResults) | 0.0553 |
def _create_borderchoice_combo(self):
"""Create border choice combo box"""
choices = [c[0] for c in self.border_toggles]
self.borderchoice_combo = \
_widgets.BorderEditChoice(self, choices=choices,
style=wx.CB_READONLY, size=(50, -1))
s... | 0.002911 |
def list_symbols(self, regex=None, as_of=None, **kwargs):
"""
Return the symbols in this library.
Parameters
----------
as_of : `datetime.datetime`
filter symbols valid at given time
regex : `str`
filter symbols by the passed in regular expr... | 0.002259 |
def gzip_cache(path):
"""
Another GZIP handler for Bottle functions. This may be used to cache the
files statically on the disc on given `path`.
If the browser accepts GZIP and there is file at ``path + ".gz"``, this
file is returned, correct headers are set (Content-Encoding, Last-Modified,
Co... | 0.000604 |
def call_chunk(self, low, running, chunks):
'''
Check if a chunk has any requires, execute the requires and then
the chunk
'''
low = self._mod_aggregate(low, running, chunks)
self._mod_init(low)
tag = _gen_tag(low)
if not low.get('prerequired'):
... | 0.001248 |
def use_dev_config_dir(use_dev_config_dir=USE_DEV_CONFIG_DIR):
"""Return whether the dev configuration directory should used."""
if use_dev_config_dir is not None:
if use_dev_config_dir.lower() in {'false', '0'}:
use_dev_config_dir = False
else:
use_dev_config_dir = DEV or ... | 0.002597 |
def authorized_response(self, args=None):
"""Handles authorization response smartly."""
if args is None:
args = request.args
if 'oauth_verifier' in args:
data = self.handle_oauth1_response(args)
elif 'code' in args:
data = self.handle_oauth2_response(a... | 0.003663 |
def add_variable(self, node):
"""Add a variable node to this node.
:sig: (VariableNode) -> None
:param node: Variable node to add.
"""
if node.name not in self.variable_names:
self.variables.append(node)
self.variable_names.add(node.name)
node... | 0.005988 |
def dict_pick(dictionary, allowed_keys):
"""
Return a dictionary only with keys found in `allowed_keys`
"""
return {key: value for key, value in viewitems(dictionary) if key in allowed_keys} | 0.009709 |
def set_page_permissions(context, token):
"""
Assigns a permissions dict to the given page instance, combining
Django's permission for the page's model and a permission check
against the instance itself calling the page's ``can_add``,
``can_change`` and ``can_delete`` custom methods.
Used withi... | 0.000692 |
def get_max_similar(string, lst):
"""Finds most similar string in list
:param string: String to find
:param lst: Strings available
:return: Max similarity and index of max similar
"""
max_similarity, index = 0.0, -1
for i, candidate in enumerate(lst):
sim = how_similar_are(str(strin... | 0.002232 |
def errors(self, batch_id, halt_on_error=True):
"""Retrieve Batch errors to ThreatConnect API.
.. code-block:: javascript
[{
"errorReason": "Incident incident-001 has an invalid status.",
"errorSource": "incident-001 is not valid."
}, {
... | 0.003156 |
def operator_driven(drain_timeout=_DEFAULT_DRAIN, reset_timeout=_DEFAULT_RESET, max_consecutive_attempts=_DEFAULT_ATTEMPTS):
"""Define an operator-driven consistent region configuration.
The source operator triggers drain and checkpoint cycles for the region.
Args:
drain_timeout: Th... | 0.007725 |
def set_character_set(self, charset):
"""Set the connection character set to charset. The character
set can only be changed in MySQL-4.1 and newer. If you try
to change the character set from the current value in an
older version, NotSupportedError will be raised."""
if charset i... | 0.002364 |
def interpolate_complex_frequency(series, delta_f, zeros_offset=0, side='right'):
"""Interpolate complex frequency series to desired delta_f.
Return a new complex frequency series that has been interpolated to the
desired delta_f.
Parameters
----------
series : FrequencySeries
Frequenc... | 0.00625 |
def until_not_synced(self, timeout=None):
"""Return a tornado Future; resolves when any subordinate client is not synced"""
yield until_any(*[r.until_not_synced() for r in dict.values(self.children)],
timeout=timeout) | 0.015564 |
def typical_or_extreme_period_type(self, value=None):
"""Corresponds to IDD Field `typical_or_extreme_period_type`
Args:
value (str): value for IDD Field `typical_or_extreme_period_type`
if `value` is None it will not be checked against the
specification and ... | 0.002103 |
def autocomplete(self, sources):
"""Autocomplete unique identities profiles.
Autocomplete unique identities profiles using the information
of their identities. The selection of the data used to fill
the profile is prioritized using a list of sources.
"""
email_pattern = ... | 0.001223 |
def _handle_sigint(self, signum, frame):
"""Handler of SIGINT
Does nothing if SIGINT is encountered once but raises a KeyboardInterrupt in case it
is encountered twice.
immediatly.
"""
if self.hit:
prompt = 'Exiting immediately!'
raise KeyboardIn... | 0.004518 |
def cp_files(self, source, target, delete_source=False):
'''Copy files
This function can handle multiple files if source S3 URL has wildcard
characters. It also handles recursive mode by copying all files and
keep the directory structure.
'''
pool = ThreadPool(ThreadUtil, self.opt)
... | 0.008584 |
def _deserialize(self):
"""Try and deserialize a response body based upon the specified
content type.
:rtype: mixed
"""
if not self._responses or not self._responses[-1].body:
return None
if 'Content-Type' not in self._responses[-1].headers:
retu... | 0.002051 |
def _get_subject_public_key(cert):
"""
Returns the SubjectPublicKey asn.1 field of the SubjectPublicKeyInfo
field of the server's certificate. This is used in the server
verification steps to thwart MitM attacks.
:param cert: X509 certificate from pyOpenSSL .get_peer_certificate... | 0.002861 |
def generate_operators(name, n_vars=1, hermitian=None, commutative=False):
"""Generates a number of commutative or noncommutative operators
:param name: The prefix in the symbolic representation of the noncommuting
variables. This will be suffixed by a number from 0 to
n_vars-... | 0.000731 |
def update_instance_extent(self, instance, module, operation):
"""Updates a new instance that was added to a module to be complete
if the end token is present in any remaining, overlapping operations.
"""
#Essentially, we want to look in the rest of the statements that are
#part ... | 0.010382 |
async def runOnceNicely(self):
"""
Execute `runOnce` with a small tolerance of 0.01 seconds so that the Prodables
can complete their other asynchronous tasks not running on the event-loop.
"""
start = time.perf_counter()
msgsProcessed = await self.prodAllOnce()
if... | 0.00639 |
def _make_periodogram(axes,
lspinfo,
objectinfo,
findercmap,
finderconvolve,
verbose=True,
findercachedir='~/.astrobase/stamp-cache'):
'''Makes periodogram, objectinfo, and finder tile... | 0.006974 |
def uri(self):
"""uri(self) -> PyObject *"""
val = _fitz.Outline_uri(self)
if val:
nval = "".join([c for c in val if 32 <= ord(c) <= 127])
val = nval
else:
val = ""
return val | 0.011811 |
def run_ec2_import(self, config_file_location, description, region='us-east-1'):
"""
Runs the command to import an uploaded vmdk to aws ec2
:param config_file_location: config file of import param location
:param description: description to attach to the import task
:return: the ... | 0.005687 |
def _evaluate(self,*args,**kwargs):
"""
NAME:
__call__ (_evaluate)
PURPOSE:
evaluate the actions (jr,lz,jz)
INPUT:
Either:
a) R,vR,vT,z,vz[,phi]:
1) floats: phase-space value for single object (phi is optional) (each can be ... | 0.020705 |
def add_homogeneous_model(self, magnitude, phase=0, frequency=None):
"""Add homogeneous models to one or all tomodirs. Register those as
forward models
Parameters
----------
magnitude : float
Value of homogeneous magnitude model
phase : float, optional
... | 0.002181 |
def generate_dir_rst(dir, fhindex, example_dir, root_dir, plot_gallery):
""" Generate the rst file for an example directory.
"""
if not dir == '.':
target_dir = os.path.join(root_dir, dir)
src_dir = os.path.join(example_dir, dir)
else:
target_dir = root_dir
src_dir = exam... | 0.003337 |
def save(self):
"""
Save environment settings into environment directory, overwriting
any existing configuration and discarding site config
"""
task.save_new_environment(self.name, self.datadir, self.target,
self.ckan_version, self.deploy_target, self.always_prod) | 0.009494 |
def get_excluded_categories():
"""Get excluded category IDs."""
from indico_livesync.plugin import LiveSyncPlugin
return {int(x['id']) for x in LiveSyncPlugin.settings.get('excluded_categories')} | 0.009662 |
def device_status(self):
"""Status of device."""
return {
'active': self.device['active'],
'offline': self.device['offline'],
'last_update': self.last_update,
'battery_level': self.battery_level,
} | 0.007435 |
def _read_dna(self, l, lowercase=False):
"""
Read DNA from a 2bit file where each base is encoded in 2bit
(4 bases per byte).
Parameters
----------
l : tuple
Location tuple
Returns
-------
list
Array of ba... | 0.013716 |
def connect_bulk(self, si, logger, vcenter_data_model, request):
"""
:param si:
:param logger:
:param VMwarevCenterResourceModel vcenter_data_model:
:param request:
:return:
"""
self.logger = logger
self.logger.info('Apply connectivity changes has... | 0.005711 |
def compile(self, source, path=None):
"""Compile source to a ready to run template.
:param source:
The template to compile - should be a unicode string
:return:
A template function ready to execute
"""
container = self._generate_code(source)
de... | 0.002177 |
def parse(self, target):
""" Parse nested rulesets
and save it in cache.
"""
if isinstance(target, ContentNode):
if target.name:
self.parent = target
self.name.parse(self)
self.name += target.name
target.ruleset.... | 0.004505 |
def _get_state(self):
"""
Returns the VM state (e.g. running, paused etc.)
:returns: state (string)
"""
result = yield from self._execute("showvminfo", [self._vmname, "--machinereadable"])
for info in result.splitlines():
if '=' in info:
name... | 0.006593 |
def do_chan_log_normal(self, line):
"""Set the channel log level to NORMAL. Command syntax is: chan_log_normal"""
self.application.channel.SetLogFilters(openpal.LogFilters(opendnp3.levels.NORMAL))
print('Channel log filtering level is now: {0}'.format(opendnp3.levels.NORMAL)) | 0.016667 |
def defvalkey(js, key, default=None, take_none=True):
"""
Returns js[key] if set, otherwise default. Note js[key] can be None.
:param js:
:param key:
:param default:
:param take_none:
:return:
"""
if js is None:
return default
if key not in js:
return default
... | 0.002506 |
def clean_out_dir(directory):
"""
Delete all the files and subdirectories in a directory.
"""
if not isinstance(directory, path):
directory = path(directory)
for file_path in directory.files():
file_path.remove()
for dir_path in directory.dirs():
dir_path.rmtree() | 0.003205 |
def by_organizations(self, field=None):
"""
Used to seggregate the data acording to organizations. This method
pops the latest aggregation from the self.aggregations dict and
adds it as a nested aggregation under itself
:param field: the field to create the parent agg (optional)... | 0.003509 |
def print_all(msg):
"""Print all objects.
Print a table of all active libvips objects. Handy for debugging.
"""
gc.collect()
logger.debug(msg)
vips_lib.vips_object_print_all()
logger.debug() | 0.008032 |
def _parse_date_onblog(dateString):
'''Parse a string according to the OnBlog 8-bit date format'''
m = _korean_onblog_date_re.match(dateString)
if not m:
return
w3dtfdate = '%(year)s-%(month)s-%(day)sT%(hour)s:%(minute)s:%(second)s%(zonediff)s' % \
{'year': m.group(1), 'month': m... | 0.009785 |
def plot_temp_diagrams(config, results, temp_dir):
"""Plot temporary diagrams"""
display_name = {
'time': 'Compilation time (s)',
'memory': 'Compiler memory usage (MB)',
}
files = config['files']
img_files = []
if any('slt' in result for result in results) and 'bmp' in files.va... | 0.002904 |
def large_image_url(self):
"""Optional[:class:`str`]: Returns a URL pointing to the large image asset of this activity if applicable."""
if self.application_id is None:
return None
try:
large_image = self.assets['large_image']
except KeyError:
return ... | 0.008889 |
def _set_suppress_nd(self, v, load=False):
"""
Setter method for suppress_nd, mapped from YANG variable /bridge_domain/suppress_nd (container)
If this variable is read-only (config: false) in the
source YANG file, then _set_suppress_nd is considered as a private
method. Backends looking to populate ... | 0.006068 |
def url(self):
"""
Returns url for accessing stage instance.
"""
return "{server_url}/go/pipelines/{pipeline_name}/{pipeline_counter}/{stage_name}/{stage_counter}".format(
server_url=self._session.server_url,
pipeline_name=self.pipeline_name,
pipeline_... | 0.006757 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.