text stringlengths 78 104k | score float64 0 0.18 |
|---|---|
def processConfig(self, worker_config):
"""Update the pool configuration with a worker configuration.
"""
self.config['headless'] |= worker_config.get("headless", False)
if self.config['headless']:
# Launch discovery process
if not self.discovery_thread:
... | 0.004376 |
def dump(self):
"""Dump the image data"""
scan_lines = bytearray()
for y in range(self.height):
scan_lines.append(0) # filter type 0 (None)
scan_lines.extend(
self.canvas[(y * self.width * 4):((y + 1) * self.width * 4)]
)
# image repre... | 0.002825 |
def find_resource_list(self):
"""Finf resource list by hueristics, returns ResourceList object.
1. Use explicitly specified self.sitemap_name (and
fail if that doesn't work)
2. Use explicitly specified self.capability_list_uri (and
fail is that doesn't work)
3. L... | 0.001411 |
def loadFileList(inputFilelist):
"""Open up the '@ file' and read in the science and possible
ivm filenames from the first two columns.
"""
f = open(inputFilelist[1:])
# check the first line in order to determine whether
# IVM files have been specified in a second column...
lines = f.read... | 0.001479 |
def _expand_sources(sources):
'''
Expands a user-provided specification of source files into a list of paths.
'''
if sources is None:
return []
if isinstance(sources, six.string_types):
sources = [x.strip() for x in sources.split(',')]
elif isinstance(sources, (float, six.integer... | 0.002165 |
def pop(self, number: int, ensure_even_length=False):
"""
Pop number of elements. If there are not enough elements, all remaining elements are returned and the
buffer is cleared afterwards. If buffer is empty, an empty numpy array is returned.
If number is -1 (or any other value below z... | 0.004029 |
def _evaluate(self, message):
"""
Evaluate the expression with the given Python object in its locals.
@param message: A decoded JSON input.
@return: The resulting object.
"""
return eval(
self.code,
globals(), {
"J": message,
... | 0.004651 |
def autoconf(self):
"""Implements Munin Plugin Auto-Configuration Option.
@return: True if plugin can be auto-configured, False otherwise.
"""
ntpinfo = NTPinfo()
ntpstats = ntpinfo.getHostOffsets(self._remoteHosts)
return len(ntpstats) > 0 | 0.012658 |
def next_block(self):
"""
This could probably be improved; at the moment it starts by trying to overshoot the
desired compressed block size, then it reduces the input bytes one by one until it
has met the required block size
"""
assert self.pos <= self.input_len
... | 0.003918 |
def status(i):
"""
Input: {}
Output: {
outdated - if 'yes', newer version exists
return - return code = 0, if successful
> 0, if error
(error) - error text if return > 0
}
"""
outdate... | 0.036387 |
async def forward_to(self, *args, **kwargs):
"""
Forwards the message. Shorthand for
`telethon.client.messages.MessageMethods.forward_messages`
with both ``messages`` and ``from_peer`` already set.
If you need to forward more than one message at once, don't use
this `for... | 0.003378 |
def items(self, section=None):
"""Provide dict like items method"""
if not section and self.section:
section = self.section
config = self.config.get(section, {}) if section else self.config
return config.items() | 0.007843 |
def visit_BinOp(self, node):
"""
Process binary operations while processing the first logging argument.
"""
if self.within_logging_statement() and self.within_logging_argument():
# handle percent format
if isinstance(node.op, Mod):
self.violations... | 0.00354 |
def confirm(action, default=None, skip=False):
"""
A shortcut for typical confirmation prompt.
:param action:
a string describing the action, e.g. "Apply changes". A question mark
will be appended.
:param default:
`bool` or `None`. Determines what happens when user hits :kbd:... | 0.002051 |
def login(*args, **kwargs):
"""
Prompt user for login information (domain/email/password).
Domain, email and password are used to get the user's API key.
Always updates the stored credentials file.
"""
if args and args[0].api_key:
# Handle command-line arguments if provided.
sol... | 0.001122 |
def request(self, method, url, query_params=None, headers=None,
body=None, post_params=None):
"""
:param method: http request method
:param url: http request url
:param query_params: query parameters in the url
:param headers: http request headers
:param b... | 0.001857 |
def render_urchin(self, ctx, data):
"""
Render the code for recording Google Analytics statistics, if so
configured.
"""
key = website.APIKey.getKeyForAPI(self.store, website.APIKey.URCHIN)
if key is None:
return ''
return ctx.tag.fillSlots('urchin-key... | 0.005988 |
def table(self, name=DEFAULT_TABLE, **options):
"""
Get access to a specific table.
Creates a new table, if it hasn't been created before, otherwise it
returns the cached :class:`~tinydb.Table` object.
:param name: The name of the table.
:type name: str
:param c... | 0.004098 |
def reset (self):
"""
Reset all variables to default values.
"""
# self.url is constructed by self.build_url() out of base_url
# and (base_ref or parent) as absolute and normed url.
# This the real url we use when checking so it also referred to
# as 'real url'
... | 0.00223 |
def mandel(x, y, max_iters):
"""
Given the real and imaginary parts of a complex number,
determine if it is a candidate for membership in the Mandelbrot
set given a fixed number of iterations.
"""
i = 0
c = complex(x,y)
z = 0.0j
for i in range(max_iters):
z = z*z + c
... | 0.005038 |
def cropRect(rect, cropTop, cropBottom, cropLeft, cropRight):
"""
Crops a rectangle by the specified number of pixels on each side.
The input rectangle and return value are both a tuple of (x,y,w,h).
"""
# Unpack the rectangle
x, y, w, h = rect
# Crop by the specified value
x += cropLeft
y += cropTop
w ... | 0.059382 |
def update(self, vips):
"""
Method to update vip's
:param vips: List containing vip's desired to updated
:return: None
"""
data = {'vips': vips}
vips_ids = [str(vip.get('id')) for vip in vips]
return super(ApiVipRequest, self).put('api/v3/vip-request/%s... | 0.005051 |
def _element_find_from_root(
root, # type: ET.Element
element_path # type: Text
):
# type: (...) -> Optional[ET.Element]
"""
Find the element specified by the given path starting from the root element of the document.
The first component of the element path is expected to be the name ... | 0.004608 |
def update_user(email, profile="splunk", **kwargs):
'''
Create a splunk user by email
CLI Example:
salt myminion splunk.update_user example@domain.com roles=['user'] realname="Test User"
'''
client = _get_splunk(profile)
email = email.lower()
user = list_users(profile).get(email... | 0.002102 |
def input_timeout(msg='Waiting for input...', timeout=30):
"""
FIXME: Function does not work quite right yet.
Args:
msg (str):
timeout (int):
Returns:
?: ans
References:
http://stackoverflow.com/questions/1335507/keyboard-input-with-timeout-in-python
http:/... | 0.000624 |
def generic_conductance(target, transport_type, pore_diffusivity,
throat_diffusivity, pore_area, throat_area,
conduit_lengths, conduit_shape_factors):
r"""
Calculate the generic conductance (could be mass, thermal, electrical,
or hydraylic) of conduits in the ... | 0.000248 |
def from_epoll_events(cls, epoll_events):
"""
Create a :class:`_EpollSelectorEvents` instance out of a bit mask using
``EPOLL*`` family of constants.
"""
self = cls()
if epoll_events & select.EPOLLIN:
self |= EVENT_READ
if epoll_events & select.EPOLLOU... | 0.003373 |
def recv(self, bufsize, **kws):
"""Receive data from the socket. The return value is a string
representing the data received. The amount of data may be less than the
ammount specified by _bufsize_. """
return Recv(self, bufsize, timeout=self._timeout, **kws) | 0.006803 |
def findOrCreate(self, userItemClass, __ifnew=None, **attrs):
"""
Usage::
s.findOrCreate(userItemClass [, function] [, x=1, y=2, ...])
Example::
class YourItemType(Item):
a = integer()
b = text()
c = integer()
... | 0.001556 |
def clean(self):
"""Routine to return C/NOFS IVM data cleaned to the specified level
Parameters
-----------
inst : (pysat.Instrument)
Instrument class object, whose attribute clean_level is used to return
the desired level of data selectivity.
Returns
--------
Void : (NoneT... | 0.010653 |
def decodeBase64(text, encoding='utf-8'):
"""
Decodes a base 64 string.
:param text | <str>
encoding | <str>
:return <str>
"""
text = projex.text.toBytes(text, encoding)
return projex.text.toUnicode(base64.b64decode(text), encoding) | 0.010169 |
def load_default_config(ipython_dir=None):
"""Load the default config file from the default ipython_dir.
This is useful for embedded shells.
"""
if ipython_dir is None:
ipython_dir = get_ipython_dir()
profile_dir = os.path.join(ipython_dir, 'profile_default')
cl = PyFileConfigLoader(def... | 0.002004 |
def add_proof(self, certificate_metadata, merkle_proof):
"""
:param certificate_metadata:
:param merkle_proof:
:return:
"""
certificate_json = self._get_certificate_to_issue(certificate_metadata)
certificate_json['signature'] = merkle_proof
with open(cert... | 0.006849 |
def ObjectInitializedEventHandler(analysis, event):
"""Actions to be done when an analysis is added in an Analysis Request
"""
# Initialize the analysis if it was e.g. added by Manage Analysis
wf.doActionFor(analysis, "initialize")
# Try to transition the analysis_request to "sample_received". The... | 0.001247 |
def add_config_lock(name):
'''
Prevent other users from changing configuration until the lock is released.
name: The name of the module function to execute.
SLS Example:
.. code-block:: yaml
panos/takelock:
panos.add_config_lock
'''
ret = _default_ret(name)
ret.... | 0.002326 |
def __get_managed_files_rpm(self):
'''
Get a list of all system files, belonging to the RedHat package manager.
'''
dirs = set()
links = set()
files = set()
for line in salt.utils.stringutils.to_str(self._syscall("rpm", None, None, '-qlav')[0]).split(os.linesep):... | 0.005495 |
def summarize(group, fs=None, include_source=True):
"""
Tabulate and write the results of ComparisonBenchmarks to a file or standard out.
:param str group: name of the comparison group.
:param fs: file-like object (Optional)
"""
_line_break = '{0:-<120}\n'.format('')
... | 0.003447 |
def _get_node(self, node_id):
"""Refresh and get info for this node, updating the cache."""
self.non_terminated_nodes({}) # Side effect: updates cache
if node_id in self.cached_nodes:
return self.cached_nodes[node_id]
# Node not in {pending, running} -- retry with a point ... | 0.003472 |
def compile_python_files(self, dir):
'''
Compile the python files (recursively) for the python files inside
a given folder.
.. note:: python2 compiles the files into extension .pyo, but in
python3, and as of Python 3.5, the .pyo filename extension is no
longer us... | 0.003091 |
def config(key):
"""
Decorator to map this class directly to a configuration node. It uses `<parentbase>.key` for configuration
base and configuration mapping.
"""
def decorator(cls):
parent = cls.getConfigurableParent()
if parent is None:
parentbase = None
else:
... | 0.00365 |
def file_name_increase(file_name, file_location):
"""
Function to increase a filename by a number 1
Args:
file_name: The name of file to check
file_location: The location of the file, derive from the os module
Returns: returns a good filename.
"""
add_one = 1
file_name_temp... | 0.002401 |
def setup_logging(level):
""" Setup logger. """
logging.root.setLevel(level)
logging.root.addHandler(STREAM_HANDLER) | 0.007813 |
def cli_delete(context, path, body=None, recursive=False,
yes_empty_account=False, yes_delete_account=False,
until_empty=False):
"""
Deletes the item (account, container, or object) at the path.
See :py:mod:`swiftly.cli.delete` for context usage information.
See :py:class... | 0.000258 |
def at_index(self, pos, predicate=None, index=None):
"""
Retrieves a list of matches from given position
"""
return filter_index(self._index_dict[pos], predicate, index) | 0.00995 |
def create_group(self, name, overwrite=False):
"""Create a sub-group.
Parameters
----------
name : string
Group name.
overwrite : bool, optional
If True, overwrite any existing array with the given name.
Returns
-------
g : zarr.h... | 0.004644 |
def close_editor_buffer(self, editor_buffer):
"""
Close all the windows that have this editor buffer open.
"""
for split, window in self._walk_through_windows():
if window.editor_buffer == editor_buffer:
self._close_window(window) | 0.006897 |
def _update_content(self, other_filth):
"""this updates the bounds, text and placeholder for the merged
filth
"""
if self.end < other_filth.beg or other_filth.end < self.beg:
raise exceptions.FilthMergeError(
"a_filth goes from [%s, %s) and b_filth goes from [... | 0.001691 |
async def execute_command(
self, *args: bytes, timeout: NumType = None
) -> SMTPResponse:
"""
Sends an SMTP command along with any args to the server, and returns
a response.
"""
command = b" ".join(args) + b"\r\n"
await self.write_and_drain(command, timeout=... | 0.007246 |
def create_compiler_path(xml_generator, compiler_path):
"""
Try to guess a path for the compiler.
If you want ot use a specific compiler, please provide the compiler
path manually, as the guess may not be what you are expecting.
Providing the path can be done by passing it as an argument (compiler_... | 0.000464 |
def draw(self):
"""
Renders the class balance chart on the specified axes from support.
"""
# Number of colors is either number of classes or 2
colors = resolve_colors(len(self.support_))
if self._mode == BALANCE:
self.ax.bar(
np.arange(len(se... | 0.002252 |
def _tidy(self, html, smart_tidy):
""" Tidy HTML if we have a tidy method.
This fixes problems with some sites which would otherwise trouble
DOMDocument's HTML parsing.
Although sometimes it makes the problem worse, which is why we can
override it in site config files.
... | 0.002584 |
def upload(self, localfile: str, remotefile: str, overwrite: bool = True, permission: str = '', **kwargs):
"""
This method uploads a local file to the SAS servers file system.
localfile - path to the local file to upload
remotefile - path to remote file to create or overwrite
overwrite ... | 0.024096 |
def updateUi(self):
"""
Updates the interface to show the selection buttons.
"""
index = self._slideshow.currentIndex()
count = self._slideshow.count()
self._previousButton.setVisible(index != 0)
self._nextButton.setText('Finish' if index == count... | 0.008242 |
def check_dashboard_cookie(self):
"""
Check if the dashboard cookie should exist through bikasetup
configuration.
If it should exist but doesn't exist yet, the function creates it
with all values as default.
If it should exist and already exists, it returns the value.
... | 0.002186 |
def uncurry_nested_dictionary(curried_dict):
"""
Transform dictionary from (key_a -> key_b -> float) to
(key_a, key_b) -> float
"""
result = {}
for a, a_dict in curried_dict.items():
for b, value in a_dict.items():
result[(a, b)] = value
return result | 0.003344 |
def make_feature_dict(feature_sequence):
"""A feature dict is a convenient way to organize a sequence of Feature
object (which you have got, e.g., from parse_GFF).
The function returns a dict with all the feature types as keys. Each value
of this dict is again a dict, now of feature names. The values o... | 0.000781 |
def parse_quantitationesultsline(self, line):
""" Parses quantitation result lines
Please see samples/GC-MS output.txt
[MS Quantitative Results] section
"""
# [MS Quantitative Results]
if line.startswith(self.QUANTITATIONRESULTS_KEY) \
or line.sta... | 0.000578 |
def parse(self, type_str):
"""
Parses a type string into an appropriate instance of
:class:`~eth_abi.grammar.ABIType`. If a type string cannot be parsed,
throws :class:`~eth_abi.exceptions.ParseError`.
:param type_str: The type string to be parsed.
:returns: An instance... | 0.004161 |
def convert_requirement(req):
"""
Converts a pkg_resources.Requirement object into a list of Rez package
request strings.
"""
pkg_name = convert_name(req.project_name)
if not req.specs:
return [pkg_name]
req_strs = []
for spec in req.specs:
op, ver = spec
ver = c... | 0.001633 |
def recent_docs(self, include_docs=True, limit=None):
"""
Retrieve recently changed / added docs
Args:
include_docs <bools> if true full document data will be retrieved
limit <int> if != None and > 0 limit the result set to this amount of rows
Returns a view result to be iterated through
... | 0.011338 |
def _evolve(self, state, qargs=None):
"""Evolve a quantum state by the QuantumChannel.
Args:
state (QuantumState): The input statevector or density matrix.
qargs (list): a list of QuantumState subsystem positions to apply
the operator on.
Retu... | 0.002427 |
def init_blueprint(self, blueprint, path='templates.yaml'):
"""Initialize a Flask Blueprint, similar to init_app, but without the access
to the application config.
Keyword Arguments:
blueprint {Flask Blueprint} -- Flask Blueprint instance to initialize (Default: {None})
... | 0.007073 |
def fine_graining(points, steps):
"""
:param points: a list of floats
:param int steps: expansion steps (>= 2)
>>> fine_graining([0, 1], steps=0)
[0, 1]
>>> fine_graining([0, 1], steps=1)
[0, 1]
>>> fine_graining([0, 1], steps=2)
array([0. , 0.5, 1. ])
>>> fine_graining([0, 1], ... | 0.001297 |
def disable_notebook():
"""Disable automatic visualization of NumPy arrays in the IPython Notebook."""
try:
from IPython.core.getipython import get_ipython
except ImportError:
raise ImportError('This feature requires IPython 1.0+')
ip = get_ipython()
f = ip.display_formatter.formatte... | 0.005305 |
def get_gsim_lt(oqparam, trts=['*']):
"""
:param oqparam:
an :class:`openquake.commonlib.oqvalidation.OqParam` instance
:param trts:
a sequence of tectonic region types as strings; trts=['*']
means that there is no filtering
:returns:
a GsimLogicTree instance obtained by ... | 0.000722 |
def DecryptPassword(cipher, key):
""" Decrypts the password using the given key with which the password was encrypted first. """
import base64
import hmac
import sha
from array import array
H = UcsUtils.GetShaHash
cipher = cipher + "\n"
cipher = base64.decodestring(cipher)
n = len(cipher) - 16 - 8
... | 0.028822 |
def create_hook(self, repo_id, repo_name):
"""Create repository hook."""
config = dict(
url=self.webhook_url,
content_type='json',
secret=current_app.config['GITHUB_SHARED_SECRET'],
insecure_ssl='1' if current_app.config['GITHUB_INSECURE_SSL']
... | 0.001296 |
def __update_peripheral_neurons(self, t, step, next_membrane, next_active_sodium, next_inactive_sodium, next_active_potassium):
"""!
@brief Update peripheral neurons in line with new values of current in channels.
@param[in] t (doubles): Current time of simulation.
@param[i... | 0.013186 |
def create_argparser(self):
""" Factory for arg parser. Can be overridden as long as it returns
an ArgParser compatible instance. """
if self.desc:
if self.title:
fulldesc = '%s\n\n%s' % (self.title, self.desc)
else:
fulldesc = self.desc
... | 0.004098 |
def unsubscribe(self, event, hook):
""" Unsubscribe a hook from an event """
if hook in self._hooks[event]:
self._hooks[event].remove(hook) | 0.011976 |
def get_event(self, num):
"""Extract event from dataset."""
if num < 0 or num >= self.params["events_num"]:
raise IndexError("Index out of range [0:%s]" %
(self.params["events_num"]))
ch_num = self.params['channel_number']
ev_size = self.params['... | 0.002006 |
async def handle_command(bot: NoneBot, ctx: Context_T) -> bool:
"""
Handle a message as a command.
This function is typically called by "handle_message".
:param bot: NoneBot instance
:param ctx: message context
:return: the message is handled as a command
"""
cmd, current_arg = parse_c... | 0.000379 |
def default_tree_traversal(root, leaves):
""" default tree traversal """
objs = [('#', root)]
while len(objs) > 0:
path, obj = objs.pop()
# name of child are json-pointer encoded, we don't have
# to encode it again.
if obj.__class__ not in leaves:
objs.extend(map... | 0.003559 |
def _pybossa_req(method, domain, id=None, payload=None, params={},
headers={'content-type': 'application/json'},
files=None):
"""
Send a JSON request.
Returns True if everything went well, otherwise it returns the status
code of the response.
"""
url = _opts['e... | 0.000748 |
def ungrab_hotkey(self, item):
"""
Ungrab a hotkey.
If the hotkey has no filter regex, it is global and is grabbed recursively from the root window
If it has a filter regex, iterate over all children of the root and ungrab from matching windows
"""
import copy
ne... | 0.009642 |
def id_to_name(config, short_name):
"""
Returns the provider :doc:`config` key based on it's ``id`` value.
:param dict config:
:doc:`config`.
:param id:
Value of the id parameter in the :ref:`config` to search for.
"""
for k, v in list(config.items()):
if v.get('id') =... | 0.002217 |
def construct(self, streams, lowcut, highcut, filt_order,
sampling_rate, multiplex, name, align, shift_len=0,
reject=0.3, no_missed=True, plot=False):
"""
Construct a subspace detector from a list of streams, full rank.
Subspace detector will be full-rank, fu... | 0.001087 |
def push_cached_cluster_configuration(self, mdmPassword, liaPassword, noUpload = False, noInstall= False, noConfigure = False):
"""
Method push cached ScaleIO cluster configuration to IM (reconfigurations that have been made to cached configuration are committed using IM)
Method: POST
At... | 0.003866 |
def initialize_from_sql_cursor(self, sqlcursor):
"""Initializes the TimeSeries's data from the given SQL cursor.
You need to set the time stamp format using :py:meth:`TimeSeries.set_timeformat`.
:param SQLCursor sqlcursor: Cursor that was holds the SQL result for any given
"SELE... | 0.003891 |
def toFloat(val):
"""Converts the given value (0-255) into its hexadecimal representation"""
hex = "0123456789abcdef"
return float(hex.find(val[0]) * 16 + hex.find(val[1])) | 0.005435 |
def remove_consumer_process(self, consumer, name):
"""Remove all details for the specified consumer and process name.
:param str consumer: The consumer name
:param str name: The process name
"""
my_pid = os.getpid()
if name in self.consumers[consumer].processes.keys():
... | 0.001947 |
def _handle_tag_definetext(self):
"""Handle the DefineText tag."""
obj = _make_object("DefineText")
self._generic_definetext_parser(obj, self._get_struct_rgb)
return obj | 0.00995 |
def authentication(login, password):
"""
Authentication on vk.com.
:param login: login on vk.com.
:param password: password on vk.com.
:returns: `requests.Session` session with cookies.
"""
session = requests.Session()
response = session.get('https://m.vk.com')
url = re.search(r'act... | 0.002132 |
def HowDoI():
'''
Make and show a window (PySimpleGUI form) that takes user input and sends to the HowDoI web oracle
Excellent example of 2 GUI concepts
1. Output Element that will show text in a scrolled window
2. Non-Window-Closing Buttons - These buttons will cause the form to return with... | 0.010067 |
def read_validate_params(self, request):
"""
Checks if all incoming parameters meet the expected values.
"""
self.client = self.client_authenticator.by_identifier_secret(request)
self.password = request.post_param("password")
self.username = request.post_param("username"... | 0.004902 |
def batch_delete(self, sources):
'''Delete a list of files in batch of batch_delete_size (default=1000).'''
assert(type(sources) == list)
if len(sources) == 0:
return
elif len(sources) == 1:
self.delete(sources[0])
elif len(sources) > self.opt.batch_delete_size:
for i in range(0, ... | 0.013107 |
def find(self, *index):
"""
Searches the current entity for an instance with the specified index.
Returns:
The wanted instance if found, otherwise it returns `None`.
"""
assert self.wrapFunction is not None
if len(index) == 1 and isinstance(index[0], (tuple, ... | 0.003854 |
def on_change(self, path, event_type):
"""Respond to changes in the file system
This method will be given the path to a file that
has changed on disk. We need to reload the keywords
from that file
"""
# I can do all this work in a sql statement, but
# for debuggi... | 0.001919 |
def med_cost_fn_val(self):
'''Returns median cost function return value for all members'''
if len(self.__members) != 0:
if self.__num_processes > 1:
members = [m.get() for m in self.__members]
else:
members = self.__members
return medi... | 0.005076 |
def disable(name, stop=False, **kwargs):
'''
Don't start service ``name`` at boot
Returns ``True`` if operation is successful
name
the service's name
stop
if True, also stops the service
CLI Example:
.. code-block:: bash
salt '*' service.disable <name> [stop=True... | 0.002304 |
def reset(self):
"""
Reset the monitor. Sets all monitored values to defaults.
"""
logger.debug("{}'s Monitor being reset".format(self))
instances_ids = self.instances.started.keys()
self.numOrderedRequests = {inst_id: (0, 0) for inst_id in instances_ids}
self.req... | 0.003667 |
def triggerHapticVibrationAction(self, action, fStartSecondsFromNow, fDurationSeconds, fFrequency, fAmplitude, ulRestrictToDevice):
"""Triggers a haptic event as described by the specified action"""
fn = self.function_table.triggerHapticVibrationAction
result = fn(action, fStartSecondsFromNow, ... | 0.009926 |
def jacobian(self, maps):
"""Returns the Jacobian for transforming mchirp and q to mass1 and
mass2.
"""
mchirp = maps[parameters.mchirp]
q = maps[parameters.q]
return mchirp * ((1.+q)/q**3.)**(2./5) | 0.00813 |
def to_header(self):
"""Converts the object back into an HTTP header."""
if self.date is not None:
return http_date(self.date)
if self.etag is not None:
return quote_etag(self.etag)
return "" | 0.008097 |
def _check_parameter_range(s_min, s_max):
r"""Performs a final check on a clipped parameter range.
.. note::
This is a helper for :func:`clip_range`.
If both values are unchanged from the "unset" default, this returns
the whole interval :math:`\left[0.0, 1.0\right]`.
If only one of the va... | 0.000805 |
def ext(obj, ext_name, ext_args):
""" Run an extension by its name.
\b
EXT_NAME: The name of the extension.
EXT_ARGS: Arguments that are passed to the extension.
"""
try:
mod = import_module('lightflow_{}.__main__'.format(ext_name))
mod.main(ext_args)
except ImportError as e... | 0.003745 |
def update_port_postcommit(self, context):
"""Send port updates to CVX
This method is also responsible for the initial creation of ports
as we wait until after a port is bound to send the port data to CVX
"""
port = context.current
orig_port = context.original
ne... | 0.001325 |
def buff(self, target, buff, **kwargs):
"""
Summon \a buff and apply it to \a target
If keyword arguments are given, attempt to set the given
values to the buff. Example:
player.buff(target, health=random.randint(1, 5))
NOTE: Any Card can buff any other Card. The controller of the
Card that buffs the targ... | 0.031373 |
def fromPy(cls, val, typeObj, vldMask=None):
"""
:param val: value of python type bool or None
:param typeObj: instance of HEnum
:param vldMask: if is None validity is resolved from val
if is 0 value is invalidated
if is 1 value has to be valid
"""
... | 0.002841 |
def pack(window, sizer, expand=1.1):
"simple wxPython pack function"
tsize = window.GetSize()
msize = window.GetMinSize()
window.SetSizer(sizer)
sizer.Fit(window)
nsize = (10*int(expand*(max(msize[0], tsize[0])/10)),
10*int(expand*(max(msize[1], tsize[1])/10.)))
window.SetSize... | 0.009174 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.