text stringlengths 78 104k | score float64 0 0.18 |
|---|---|
def tuplecount(text):
'''Changes a dictionary into a list of tuples.'''
worddict = wordcount(text)
countlist = []
for key in worddict.keys():
countlist.append((key,worddict[key]))
countlist = list(reversed(sorted(countlist,key = lambda x: x[1])))
return countlist | 0.016949 |
def sync_clock(self):
"""
This will send all the needed messages to sync the cloc
"""
self.send(velbus.SetRealtimeClock())
self.send(velbus.SetDate())
self.send(velbus.SetDaylightSaving()) | 0.008475 |
def wait_for_tasks(self, raise_if_error=True):
"""
Wait for the running tasks lauched from the sessions.
Note that it also wait for tasks that are started from other tasks
callbacks, like on_finished.
:param raise_if_error: if True, raise all possible encountered
er... | 0.0018 |
def compute_K_numerical(dataframe, settings=None, keep_dir=None):
"""Use a finite-element modeling code to infer geometric factors for meshes
with topography or irregular electrode spacings.
Parameters
----------
dataframe : pandas.DataFrame
the data frame that contains the data
setting... | 0.000724 |
def error(self, status_code, request, message=None):
"""Handle error response.
:param int status_code:
:param request:
:return:
"""
status_code_text = HTTP_STATUS_CODES.get(status_code, 'http error')
status_error_tag = status_code_text.lower().replace(' ', '_')
... | 0.001715 |
def save_html(p, *vsheets):
'Save vsheets as HTML tables in a single file'
with open(p.resolve(), 'w', encoding='ascii', errors='xmlcharrefreplace') as fp:
for sheet in vsheets:
fp.write('<h2 class="sheetname">%s</h2>\n'.format(sheetname=html.escape(sheet.name)))
fp.write('<ta... | 0.003846 |
def parse_substitution_from_list(list_rep):
"""
Parse a substitution from the list representation in the config file.
"""
# We are expecting [pattern, replacement [, is_multiline]]
if type(list_rep) is not list:
raise SyntaxError('Substitution must be a list')
if len(list_rep) < 2:
... | 0.001287 |
def stop(self, kill=False, timeout=15):
""" terminate process and wipe out the temp work directory, but only if we actually started it"""
super(AbstractDcsController, self).stop(kill=kill, timeout=timeout)
if self._work_directory:
shutil.rmtree(self._work_directory) | 0.009934 |
def _from_dict(cls, _dict):
"""Initialize a QueryNoticesResponse object from a json dictionary."""
args = {}
if 'matching_results' in _dict:
args['matching_results'] = _dict.get('matching_results')
if 'results' in _dict:
args['results'] = [
QueryNo... | 0.003425 |
def fence_point_encode(self, target_system, target_component, idx, count, lat, lng):
'''
A fence point. Used to set a point when from GCS -> MAV. Also used to
return a point from MAV -> GCS
target_system : System ID (uint8_t)
t... | 0.008294 |
def cdna_codon_sequence_after_deletion_or_substitution_frameshift(
sequence_from_start_codon,
cds_offset,
trimmed_cdna_ref,
trimmed_cdna_alt):
"""
Logic for any frameshift which isn't an insertion.
We have insertions as a special case since our base-inclusive
indexing me... | 0.000803 |
def _decode_sense_packet(self, version, packet):
"""Decode a sense packet into the list of sensors."""
data = self._sense_packet_to_data(packet)
offset = 4
i = 0
datalen = len(data) - offset - 6
temp_count = int(datalen / 2)
temp = []
for i in range(te... | 0.003659 |
def run_config(repl, config_file='~/.ptpython/config.py'):
"""
Execute REPL config file.
:param repl: `PythonInput` instance.
:param config_file: Path of the configuration file.
"""
assert isinstance(repl, PythonInput)
assert isinstance(config_file, six.text_type)
# Expand tildes.
... | 0.006076 |
def cleanup(self):
"""Cleans up this result so that all its pointers reference memory controlled
*outside* of the shared library loaded with ctypes.
"""
#First we *copy* the arrays that we currently have pointers to. This is not
#the optimal solution; however, because of limitati... | 0.016861 |
def get_unit_id(unit_name):
"""
Return the unit id to the unit 'unit_name'
"""
unit_name = unit_name.lower()
attribute = 'uniqueIdentifier'
response = LDAP_search(
pattern_search='(cn={})'.format(unit_name),
attribute=attribute
)
unit_id = ""
try:
for element... | 0.005398 |
def extended_status_request(self):
"""Send status request for group/button."""
self._status_received = False
user_data = Userdata({'d1': self.group,
'd2': 0x00})
cmd = ExtendedSend(self._address,
COMMAND_EXTENDED_GET_SET_0X2E_0X00,... | 0.004329 |
def os_open(document):
"""Open document by the default handler of the OS, could be a url opened by a browser, a text file by an editor etc"""
osname = platform.system().lower()
if osname == "darwin":
os.system("open \"" + document + "\"")
if osname == "linux":
cmd = "xdg-open \"" + docum... | 0.004651 |
def travis(branch: str):
"""
Performs necessary checks to ensure that the travis build is one
that should create releases.
:param branch: The branch the environment should be running against.
"""
assert os.environ.get('TRAVIS_BRANCH') == branch
assert os.environ.get('TRAVIS_PULL_REQUEST') =... | 0.00304 |
def remoteLocation_resolve(self, d_remote):
"""
Resolve the remote path location
:param d_remote: the "remote" specification
:return: a string representation of the remote path
"""
b_status = False
str_remotePath = ""
if 'path' in d_remote.keys():... | 0.015007 |
def lock(self):
"""Lock thread.
Requires that the currently authenticated user has the modposts oauth
scope or has user/password authentication as a mod of the subreddit.
:returns: The json response from the server.
"""
url = self.reddit_session.config['lock']
... | 0.004854 |
def _equivalent(self, char, prev, next, implicitA):
""" Transliterate a Latin character equivalent to Devanagari.
Add VIRAMA for ligatures.
Convert standalone to dependent vowels.
"""
result = []
if char.isVowel == False:
result.append(char.c... | 0.013038 |
def to_kirbidir(self, directory_path):
"""
Converts all credential object in the CCACHE object to the kirbi file format used by mimikatz.
The kirbi file format supports one credential per file, so prepare for a lot of files being generated.
directory_path: str the directory to write the kirbi files to
"""
... | 0.032149 |
def _add_item(self, item, indent_amt):
"""Add an item to the line.
Reflow the line to get the best formatting after the item is
inserted. The bracket depth indicates if the item is being
inserted inside of a container or not.
"""
if self._prev_item and self._prev_item.i... | 0.001331 |
def _assemble_flowtable(self, values):
""" generate a flowtable from a tuple of descriptors.
"""
values = map(lambda x: [] if x is None else x, values)
src = values[0] + values[1]
dst = values[2] + values[3]
thistable = dict()
for s in src:
thistable[... | 0.005666 |
def expand_fc_groups(users):
""" If user is a firecloud group, return all members of the group.
Caveat is that only group admins may do this.
"""
groups = None
for user in users:
fcgroup = None
if '@' not in user:
fcgroup = user
elif user.lower().endswith('@firecl... | 0.003311 |
def make_charlist(self):
"""Parses the complete text and stores format for each character."""
def worker_output(worker, output, error):
"""Worker finished callback."""
self._charlist = output
if error is None and output:
self._allow_highlight =... | 0.002174 |
def startswith(haystack, prefix):
"""
py3 comp startswith
:param haystack:
:param prefix:
:return:
"""
if haystack is None:
return None
if sys.version_info[0] < 3:
return haystack.startswith(prefix)
return to_bytes(haystack).startswith(to_bytes(prefix)) | 0.003257 |
def create_project(self, project_name, project_des):
""" Create a project
Unsuccessful opertaion will cause an LogException.
:type project_name: string
:param project_name: the Project name
:type project_des: string
:param project_des: the description of a proj... | 0.00738 |
def username(anon, obj, field, val):
"""
Generates a random username
"""
return anon.faker.user_name(field=field) | 0.007752 |
def permutation_from_disjoint_cycles(cycles, offset=0):
"""Reconstruct a permutation image tuple from a list of disjoint cycles
:param cycles: sequence of disjoint cycles
:type cycles: list or tuple
:param offset: Offset to subtract from the resulting permutation image points
:type offset: int
:... | 0.005391 |
def wasModified(self):
"""
Check to see if this module has been modified on disk since the last
time it was cached.
@return: True if it has been modified, False if not.
"""
self.filePath.restat()
mtime = self.filePath.getmtime()
if mtime >= self.lastModif... | 0.005168 |
def message(self, msg):
"""Send a message to third party applications
"""
for broker in self.message_brokers:
try:
broker(msg)
except Exception as exc:
utils.error(exc) | 0.008065 |
def raise_expired_not_yet_valid(certificate):
"""
Raises a TLSVerificationError due to certificate being expired, or not yet
being valid
:param certificate:
An asn1crypto.x509.Certificate object
:raises:
TLSVerificationError
"""
validity = certificate['tbs_certificate']['v... | 0.003282 |
def getTlvProperties(cardConnection, featureList=None, controlCode=None):
""" return the GET_TLV_PROPERTIES structure
@param cardConnection: L{CardConnection} object
@param featureList: feature list as returned by L{getFeatureRequest()}
@param controlCode: control code for L{FEATURE_GET_TLV_PROPERTIES}... | 0.001412 |
def blocks(self, start=None, stop=None):
""" Yields blocks starting from ``start``.
:param int start: Starting block
:param int stop: Stop at this block
:param str mode: We here have the choice between
* "head": the last block
* "irreversibl... | 0.002366 |
def find_usage(self):
"""
Determine the current usage for each limit of this service,
and update corresponding Limit via
:py:meth:`~.AwsLimit._add_current_usage`.
"""
logger.debug("Checking usage for service %s", self.service_name)
for lim in self.limits.values():... | 0.002587 |
def _prepare_text(self, text):
"""Returns `text` with each consituent token wrapped in HTML markup
for later match annotation.
:param text: text to be marked up
:type text: `str`
:rtype: `str`
"""
# Remove characters that should be escaped for XML input (but
... | 0.003571 |
def make_choices(*args):
"""Convert a 1-D sequence into a 2-D sequence of tuples for use in a Django field choices attribute
>>> make_choices(range(3))
((0, u'0'), (1, u'1'), (2, u'2'))
>>> make_choices(dict(enumerate('abcd')))
((0, u'a'), (1, u'b'), (2, u'c'), (3, u'd'))
>>> make_choices('hell... | 0.004582 |
def gevent_run(app, port=5000, log=None, error_log=None, address='',
monkey_patch=True, start=True, **kwargs): # pragma: no cover
"""Run your app in gevent.wsgi.WSGIServer
:param app: wsgi application, ex. Microservice instance
:param port: int, listen port, default 5000
:param address:... | 0.003457 |
def add_f08_to_env(env):
"""Add Builders and construction variables for f08 to an Environment."""
try:
F08Suffixes = env['F08FILESUFFIXES']
except KeyError:
F08Suffixes = ['.f08']
try:
F08PPSuffixes = env['F08PPFILESUFFIXES']
except KeyError:
F08PPSuffixes = []
... | 0.007229 |
def shutdown(self):
"""Shutdown internal workers by pushing terminate signals."""
if not self._shutdown:
# send shutdown signal to the fetcher and join data queue first
# Remark: loop_fetcher need to be joined prior to the workers.
# otherwise, the the fet... | 0.002567 |
def covariance(x,
y=None,
sample_axis=0,
event_axis=-1,
keepdims=False,
name=None):
"""Sample covariance between observations indexed by `event_axis`.
Given `N` samples of scalar random variables `X` and `Y`, covariance may be
estimated a... | 0.002662 |
def pause_tube(self, tube, delay=3600):
"""Pause a tube for some number of seconds, preventing it from issuing jobs.
:param delay: Time to pause for, in seconds
:type delay: int
There is no way to permanently pause a tube; passing 0 for delay actually un-pauses the tube.
.. se... | 0.008562 |
def download_fundflow(self, bill_date, account_type='Basic',
tar_type=None):
"""
下载资金账单
https://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=9_18&index=7
:param bill_date: 下载对账单的日期
:param account_type: 账单的资金来源账户
Basic 基... | 0.003219 |
def _R2deriv(self,R,z,phi=0.,t=0.):
"""
NAME:
_R2deriv
PURPOSE:
evaluate the second radial derivative for this potential
INPUT:
R - Galactocentric cylindrical radius
z - vertical height
phi - azimuth
t - time
OUTPU... | 0.012069 |
def combine_lists_reducer(
key: str,
merged_list: list,
component: COMPONENT
) -> list:
"""
Reducer function to combine the lists for the specified key into a
single, flat list
:param key:
The key on the COMPONENT instances to operate upon
:param merged_list:
... | 0.001427 |
def get_urgent(self, sensors):
""" Determine if any sensors should set the urgent flag. """
if self.urgent_on not in ('warning', 'critical'):
raise Exception("urgent_on must be one of (warning, critical)")
for sensor in sensors:
if self.urgent_on == 'warning' and sensor.i... | 0.004158 |
def split_namedpipe_cls(pair1_file, pair2_file, data):
"""Create a commandline suitable for use as a named pipe with reads in a given region.
"""
if "align_split" in data:
start, end = [int(x) for x in data["align_split"].split("-")]
else:
start, end = None, None
if pair1_file.endswi... | 0.005141 |
def get_compound_amount(self, compound):
"""
Determine the mole amount of the specified compound.
:returns: Amount. [kmol]
"""
index = self.material.get_compound_index(compound)
return stoich.amount(compound, self._compound_masses[index]) | 0.006944 |
def execute(context=None, lens=None, commands=(), load_path=None):
'''
Execute Augeas commands
.. versionadded:: 2014.7.0
CLI Example:
.. code-block:: bash
salt '*' augeas.execute /files/etc/redis/redis.conf \\
commands='["set bind 0.0.0.0", "set maxmemory 1G"]'
context
... | 0.000489 |
def ec2_instances():
"Use the EC2 API to get a list of all machines"
region = boto.ec2.get_region(REGION)
reservations = region.connect().get_all_instances()
instances = []
for reservation in reservations:
instances += reservation.instances
return instances | 0.00346 |
def julian_datetime(julianday, milisecond=0):
"""Return datetime from days since 1/1/4713 BC and ms since midnight.
Convert Julian dates according to MetaMorph.
>>> julian_datetime(2451576, 54362783)
datetime.datetime(2000, 2, 2, 15, 6, 2, 783)
"""
if julianday <= 1721423:
# no dateti... | 0.000952 |
def path(self, which=None):
"""Extend ``nailgun.entity_mixins.Entity.path``.
The format of the returned path depends on the value of ``which``:
incremental_update
/content_view_versions/incremental_update
promote
/content_view_versions/<id>/promote
``su... | 0.002937 |
def get_imports(project, pydefined):
"""A shortcut for getting the `ImportInfo`\s used in a scope"""
pymodule = pydefined.get_module()
module = module_imports.ModuleImports(project, pymodule)
if pymodule == pydefined:
return [stmt.import_info for stmt in module.imports]
return module.get_use... | 0.005882 |
def getSampleTypes(self, active_only=True):
"""Return all sampletypes
"""
catalog = api.get_tool("bika_setup_catalog")
query = {
"portal_type": "SampleType",
# N.B. The `sortable_title` index sorts case sensitive. Since there
# is no sort key for ... | 0.002721 |
def run_migrations_online():
"""Run migrations in 'online' mode.
In this scenario we need to create an Engine
and associate a connection with the context.
"""
engine = create_engine(get_url())
connection = engine.connect()
context.configure(
connection=connection,
target_m... | 0.001721 |
def validate(
message,
get_certificate=lambda url: urlopen(url).read(),
certificate_url_regex=DEFAULT_CERTIFICATE_URL_REGEX,
max_age=DEFAULT_MAX_AGE
):
"""
Validate a decoded SNS message.
Parameters:
message:
Decoded SNS message.
get_certificate:
Fun... | 0.000664 |
def get_rdns_name(rdns):
"""
Gets the rdns String name
:param rdns: RDNS object
:type rdns: cryptography.x509.RelativeDistinguishedName
:return: RDNS name
"""
name = ''
for rdn in rdns:
for attr in rdn._attributes:
if len(name) > 0:
name = name + ','
... | 0.001894 |
def serialize_encrypted_data_key(encrypted_data_key):
"""Serializes an encrypted data key.
.. versionadded:: 1.3.0
:param encrypted_data_key: Encrypted data key to serialize
:type encrypted_data_key: aws_encryption_sdk.structures.EncryptedDataKey
:returns: Serialized encrypted data key
:rtype:... | 0.00077 |
def _newRemoteException(ErrorType):
'''create a new RemoteExceptionType from a given errortype'''
RemoteErrorBaseType = _RemoteExceptionMeta('', (ErrorType,), {})
class RemoteException(RemoteErrorBaseType):
BaseExceptionType = ErrorType
def __init__(self, thrownError, tracebackString):
... | 0.002347 |
def read(path, encoding="utf-8"):
"""Read string from text file.
"""
is_gzip = is_gzip_file(path)
with open(path, "rb") as f:
if is_gzip:
return zlib.decompress(f.read()).decode(encoding)
else:
return f.read().decode(encoding) | 0.003534 |
def debug(func):
"""Print the function name and arguments for debugging."""
@wraps(func)
def wrapper(*args, **kwargs):
print("{} args: {} kwargs: {}".format(func.__name__, args, kwargs))
return func(*args, **kwargs)
return wrapper | 0.003802 |
def _get_property_for(self, p, indexed=True, depth=0):
"""Internal helper to get the Property for a protobuf-level property."""
parts = p.name().split('.')
if len(parts) <= depth:
# Apparently there's an unstructured value here.
# Assume it is a None written for a missing value.
# (It coul... | 0.012245 |
def parse_raw_token(self, raw_token):
"Parse token and secret from raw token response."
if raw_token is None:
return (None, None)
# Load as json first then parse as query string
try:
token_data = json.loads(raw_token)
except ValueError:
qs = pa... | 0.004073 |
def boolean(cls, true_code, false_code=None):
"""Callback to validate a response code.
The returned callback checks whether a given response has a
``status_code`` that is considered good (``true_code``) and
raise an appropriate error if not.
The optional ``false_code`` allows f... | 0.001505 |
def print(
self,
x: int,
y: int,
string: str,
fg: Optional[Tuple[int, int, int]] = None,
bg: Optional[Tuple[int, int, int]] = None,
bg_blend: int = tcod.constants.BKGND_SET,
alignment: int = tcod.constants.LEFT,
) -> None:
"""Print a string on ... | 0.001729 |
def _find_header_row(self):
"""
Evaluate all rows and determine header position, based on
greatest number of 'th' tagged elements
"""
th_max = 0
header_idx = 0
for idx, tr in enumerate(self._tr_nodes):
th_count = len(tr.contents.filter_tags(matches=fta... | 0.005698 |
def show_output_dynamic(fsync_output_dynamic):
"""!
@brief Shows output dynamic (output of each oscillator) during simulation.
@param[in] fsync_output_dynamic (fsync_dynamic): Output dynamic of the fSync network.
@see show_output_dynamics
"""
... | 0.030172 |
def _import_public_names(module):
"Import public names from module into this module, like import *"
self = sys.modules[__name__]
for name in module.__all__:
if hasattr(self, name):
# don't overwrite existing names
continue
setattr(self, name, getattr(module, name)) | 0.003155 |
def build(self, builder):
"""Build XML by appending to builder"""
params = dict(OID=self.oid)
params["mdsol:ProjectType"] = self.project_type
builder.start("Study", params)
# Ask children
if self.global_variables is not None:
self.global_variables.build(buil... | 0.00365 |
def _prm_write_into_pytable(self, tablename, data, hdf5_group, fullname, **kwargs):
"""Stores data as pytable.
:param tablename:
Name of the data table
:param data:
Data to store
:param hdf5_group:
Group node where to store data in hdf5 file
... | 0.005893 |
def get_all_child_edges(self):
"""Return tuples for all child GO IDs, containing current GO ID and child GO ID."""
all_child_edges = set()
for parent in self.children:
all_child_edges.add((parent.item_id, self.item_id))
all_child_edges |= parent.get_all_child_edges()
... | 0.008671 |
def present(
name,
policy_document=None,
policy_document_from_pillars=None,
path=None,
policies=None,
policies_from_pillars=None,
managed_policies=None,
create_instance_profile=True,
region=None,
key=None,
keyid=None,
profil... | 0.001343 |
def add_summary(self, summary, global_step=None):
"""Adds a `Summary` protocol buffer to the event file.
This method wraps the provided summary in an `Event` protocol buffer and adds it
to the event file.
Parameters
----------
summary : A `Summary` protocol buffer
... | 0.004129 |
def CheckForQuestionPending(task):
"""
Check to see if VM needs to ask a question, throw exception
"""
vm = task.info.entity
if vm is not None and isinstance(vm, vim.VirtualMachine):
qst = vm.runtime.question
if qst is not None:
raise TaskBlocked("Task blocked, User Inte... | 0.00295 |
def instanceStarted(self, *args, **kwargs):
"""
Report an instance starting
An instance will report in by giving its instance id as well
as its security token. The token is given and checked to ensure
that it matches a real token that exists to ensure that random
machin... | 0.005505 |
def load_entry_point_group(self, entry_point_group):
"""Load administration interface from entry point group.
:param str entry_point_group: Name of the entry point group.
"""
for ep in pkg_resources.iter_entry_points(group=entry_point_group):
admin_ep = dict(ep.load())
... | 0.001466 |
def save_resource(self, name, resource, pushable=False):
'Saves an object such that it can be used by other tests.'
if pushable:
self.pushable_resources[name] = resource
else:
self.resources[name] = resource | 0.007813 |
def get_transport(name):
'''
Return the transport class.
'''
try:
log.debug('Using %s as transport', name)
return TRANSPORT_LOOKUP[name]
except KeyError:
msg = 'Transport {} is not available. Are the dependencies installed?'.format(name)
log.error(msg, exc_info=True)
... | 0.005495 |
def _cleanup(self):
"""Cleanup the stored sessions"""
current_time = time.time()
timeout = self._config.timeout
if current_time - self._last_cleanup_time > timeout:
self.store.cleanup(timeout)
self._last_cleanup_time = current_time | 0.006969 |
def validate_transaction_schema(tx):
"""Validate a transaction dict.
TX_SCHEMA_COMMON contains properties that are common to all types of
transaction. TX_SCHEMA_[TRANSFER|CREATE] add additional constraints on top.
"""
_validate_schema(TX_SCHEMA_COMMON, tx)
if tx['operation'] == 'TRANSFER':
... | 0.002375 |
def get_institution(self, **kwargs):
"""Get the dissertation institution."""
qualifier = kwargs.get('qualifier', '')
content = kwargs.get('content', '')
if qualifier == 'grantor':
return content
return None | 0.007752 |
def MD_ConfigsPermutate(df_md):
"""Given a MD DataFrame, return a Nx4 array which permutes the current
injection dipoles.
"""
g_current_injections = df_md.groupby(['a', 'b'])
ab = np.array(list(g_current_injections.groups.keys()))
config_mgr = ConfigManager(nr_of_electrodes=ab.max())
config_... | 0.002551 |
def show_message(self):
"""Show message updatable."""
print(
'current version: {current_version}\n'
'latest version : {latest_version}'.format(
current_version=self.current_version,
latest_version=self.latest_version)) | 0.006897 |
def update_counts(self):
"Update counts of fields and wells."
# Properties.attrib['TotalCountOfFields']
fields = str(len(self.fields))
self.properties.attrib['TotalCountOfFields'] = fields
# Properties.CountOfWellsX/Y
wx, wy = (str(x) for x in self.count_of_wells)
... | 0.004386 |
def delete_consumer(self, consumer=None):
"""
Remove a specific consumer from a consumer group.
:consumer: name of consumer to delete. If not provided, will be the
default consumer for this stream.
:returns: number of pending messages that the consumer had before
... | 0.006224 |
def _get_localzone(_root='/'):
"""Tries to find the local timezone configuration.
This method prefers finding the timezone name and passing that to pytz,
over passing in the localtime file, as in the later case the zoneinfo
name is unknown.
The parameter _root makes the function look for files lik... | 0.002212 |
def do_save(self, line):
"""save [config_file] Save session variables to file save (without parameters):
Save session to default file ~/.dataone_cli.conf save.
<file>: Save session to specified file.
"""
config_file = self._split_args(line, 0, 1)[0]
self._command_proces... | 0.008347 |
def start():
'''
Start the saltnado!
'''
mod_opts = __opts__.get(__virtualname__, {})
if 'num_processes' not in mod_opts:
mod_opts['num_processes'] = 1
if mod_opts['num_processes'] > 1 and mod_opts.get('debug', False) is True:
raise Exception((
'Tornado\'s debug imp... | 0.003494 |
def clean_locale(configuration, locale):
"""
Strips out the warning from all of a locale's translated po files
about being an English source file.
Iterates over machine-generated files.
"""
dirname = configuration.get_messages_dir(locale)
if not dirname.exists():
# Happens when we ha... | 0.004057 |
def fvga(a, i, g, n):
""" This function is for the future value of an annuity
with growth rate. It is the future value of a growing
stream of periodic investments.
a = Periodic Investment (1000)
i = interest rate as decimal (.0675)
g = the growth rate (.05)
n = the number of compound per... | 0.004587 |
def get_fun(fun):
'''
Return a dict of the last function called for all minions
'''
serv = _get_serv(ret=None)
sql = '''select first(id) as fid, first(full_ret) as fret
from returns
where fun = '{0}'
group by fun, id
'''.format(fun)
data = serv.que... | 0.002028 |
def contrib_phone(contrib_tag):
"""
Given a contrib tag, look for an phone tag
"""
phone = None
if raw_parser.phone(contrib_tag):
phone = first(raw_parser.phone(contrib_tag)).text
return phone | 0.004464 |
def UNIFAC_Dortmund_groups(self):
r'''Dictionary of Dortmund UNIFAC subgroup: count groups for the
Dortmund UNIFAC subgroups, as determined by `DDBST's online service <http://www.ddbst.com/unifacga.html>`_.
Examples
--------
>>> pprint(Chemical('Cumene').UNIFAC_Dortmund_groups)
... | 0.005181 |
def _set_default_vertex_attributes(self) -> None:
"""Assign default values on attributes to all vertices."""
self.graph.vs["l2fc"] = 0
self.graph.vs["padj"] = 0.5
self.graph.vs["symbol"] = self.graph.vs["name"]
self.graph.vs["diff_expressed"] = False
self.graph.vs["up_reg... | 0.005208 |
def add_port_callback(self, port, cb):
"""Add a callback for data that comes on a specific port"""
logger.debug('Adding callback on port [%d] to [%s]', port, cb)
self.add_header_callback(cb, port, 0, 0xff, 0x0) | 0.008547 |
def get_config_value(self, section_name, option, default_option="default"):
"""
Read a value from the configuration, with a default.
Args:
section_name (str): name of the section in the configuration from which
the option should be found.
option (str): na... | 0.004513 |
def _hash(self, obj, parent, parents_ids=EMPTY_FROZENSET):
"""The main diff method"""
try:
result = self[obj]
except (TypeError, KeyError):
pass
else:
return result
result = not_hashed
if self._skip_this(obj, parent):
ret... | 0.00398 |
def rowsBeforeItem(self, item, count):
"""
The inverse of rowsAfterItem.
@param item: then L{Item} to request rows before.
@type item: this L{InequalityModel}'s L{itemType} attribute.
@param count: The maximum number of rows to return.
@type count: L{int}
@retu... | 0.00188 |
def _find_image_id(self, image_id):
"""Finds an image id to a given id or name.
:param str image_id: name or id of image
:return: str - identifier of image
"""
if not self._images:
connection = self._connect()
self._images = connection.get_all_images()
... | 0.003008 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.