text stringlengths 78 104k | score float64 0 0.18 |
|---|---|
def responds(status=status.HTTP_200_OK,
meaning='Undocumented status code',
schema=None,
schema_name=None,
**kwargs):
"""Documents the status code per handled case.
Additional parameters may make it into the OpenAPI documentation
per view. Examples of tho... | 0.000778 |
def get_user_language(user):
""" Simple helper that will fire django signal in order to get User language possibly given by other part of application.
:param user:
:return: string or None
"""
return_value = {}
user_language.send(sender=user, user=user, return_value=return_value)
return retur... | 0.005831 |
def predictions_iter(self):
""" property decorated prediction iterator
Returns
-------
iterator : iterator
iterator on prediction sensitivity vectors (matrix)
"""
for fname in self.forecast_names:
yield self.predictions.get(col_names=fname) | 0.006369 |
def watch_file(path, func, *args, **kwargs):
"""
Watch a file for changes by polling its last modification time. Call the
provided function with *args and **kwargs upon modification.
"""
if not path:
raise ValueError('Please specify a file to watch')
print('Watching "{}" for changes'.for... | 0.001387 |
def apply_mtd(self, mtd, *args, cont=False, tag=None, **kwargs):
"""Call the method `mtd` on both sides of the equation
That is, the left-hand-side and right-hand-side are replaced by::
lhs=lhs.<mtd>(*args, **kwargs)
rhs=rhs.<mtd>(*args, **kwargs)
The `cont` and `tag` ... | 0.003155 |
def as_dict(self):
"""
Return the dependencies as a dictionary.
Returns:
dict: dictionary of dependencies.
"""
return {
'name': str(self),
'modules': [m.as_dict() for m in self.modules],
'packages': [p.as_dict() for p in self.packa... | 0.005988 |
def post(self, url, body=None):
"""Sends this `Resource` instance to the service with a
``POST`` request to the given URL. Takes an optional body"""
response = self.http_request(url, 'POST', body or self, {'Content-Type': 'application/xml; charset=utf-8'})
if response.status not in (200,... | 0.004525 |
def call_later(self, delay, callback):
"""Schedule a one-shot timeout given delay seconds.
This method is only useful for compatibility with older versions of pika.
Args:
delay (float): Non-negative number of seconds from now until
expiration
callback (m... | 0.004902 |
def set_published_date(self):
"""Parses published date and set value"""
try:
self.published_date = self.soup.find('pubdate').string
except AttributeError:
self.published_date = None | 0.008734 |
def from_floats(red, green, blue):
"""Return a new Color object from red/green/blue values from 0.0 to 1.0."""
return Color(int(red * Color.MAX_VALUE),
int(green * Color.MAX_VALUE),
int(blue * Color.MAX_VALUE)) | 0.011152 |
async def dump_devinfo(dev: Device, file):
"""Dump developer information.
Pass `file` to write the results directly into a file.
"""
import attr
methods = await dev.get_supported_methods()
res = {
"supported_methods": {k: v.asdict() for k, v in methods.items()},
"settings": [at... | 0.001416 |
def _maxlength(X):
""" Returns the maximum length of signal trajectories X """
return np.fromiter((map(lambda x: len(x), X)), dtype=int).max() | 0.006667 |
def outside_root_to_404(fn):
"""
Decorator for converting PathOutsideRoot errors to 404s.
"""
@wraps(fn)
def wrapped(*args, **kwargs):
try:
return fn(*args, **kwargs)
except PathOutsideRoot as e:
raise HTTPError(404, "Path outside root: [%s]" % e.args[0])
... | 0.002994 |
def from_url(cls, url, db=None, skip_full_coverage_check=False, **kwargs):
"""
Return a Redis client object configured from the given URL, which must
use either `the ``redis://`` scheme
<http://www.iana.org/assignments/uri-schemes/prov/redis>`_ for RESP
connections or the ``unix:... | 0.002308 |
def is_homogeneous(self):
"""True if all the elements of the array are the same."""
hom_base = isinstance(self.base_value, (int, long, numpy.integer, float, bool)) \
or type(self.base_value) == self.dtype \
or (isinstance(self.dtype, type) and isinstance(self.base_v... | 0.014799 |
def generate_megaman_manifold(sampling=2, nfolds=2,
rotate=True, random_state=None):
"""Generate a manifold of the megaman data"""
X, c = generate_megaman_data(sampling)
for i in range(nfolds):
X = np.hstack([_make_S_curve(x) for x in X.T])
if rotate:
rand ... | 0.002088 |
def segmentlistdict_fromsearchsummary_in(xmldoc, program = None):
"""
Convenience wrapper for a common case usage of the segmentlistdict
class: searches the process table in xmldoc for occurances of a
program named program, then scans the search summary table for
matching process IDs and constructs a segmentlistd... | 0.023944 |
def configure_volume(before_change=lambda: None, after_change=lambda: None):
'''Set up storage (or don't) according to the charm's volume configuration.
Returns the mount point or "ephemeral". before_change and after_change
are optional functions to be called if the volume configuration changes.
'... | 0.000861 |
def parse_options(cls, line, ns={}):
"""
Similar to parse but returns a list of Options objects instead
of the dictionary format.
"""
parsed = cls.parse(line, ns=ns)
options_list = []
for spec in sorted(parsed.keys()):
options = parsed[spec]
... | 0.003883 |
def seek(self, offset, whence=0):
"""Seek to the specified position.
:param int offset: The offset in bytes.
:param int whence: Where the offset is from.
Returns the position after seeking."""
logger.debug('seeking to offset: %r whence: %r', offset, whence)
if whence no... | 0.002681 |
def _starts_with_drive_letter(self, file_path):
"""Return True if file_path starts with a drive letter.
Args:
file_path: the full path to be examined.
Returns:
`True` if drive letter support is enabled in the filesystem and
the path starts with a drive lette... | 0.003846 |
def set_permitted_ip(address=None, deploy=False):
'''
Add an IPv4 address or network to the permitted IP list.
CLI Example:
Args:
address (str): The IPv4 address or network to allow access to add to the Palo Alto device.
deploy (bool): If true then commit the full candidate configurat... | 0.003891 |
def generateCatalog(wcs, mode='automatic', catalog=None,
src_find_filters=None, **kwargs):
""" Function which determines what type of catalog object needs to be
instantiated based on what type of source selection algorithm the user
specified.
Parameters
----------
wcs : obj
... | 0.007705 |
def remove_go(self, target):
"""
FOR SAVING MEMORY
"""
with self.lock:
if not self._go:
try:
self.job_queue.remove(target)
except ValueError:
pass | 0.007634 |
def get_node_pos(self, key):
"""Given a string key a corresponding node in the hash ring is returned
along with it's position in the ring.
If the hash ring is empty, (`None`, `None`) is returned.
"""
if len(self.ring) == 0:
return [None, None]
crc = self.hash... | 0.003697 |
def trainRegressor(cls, data, categoricalFeaturesInfo,
impurity="variance", maxDepth=5, maxBins=32, minInstancesPerNode=1,
minInfoGain=0.0):
"""
Train a decision tree model for regression.
:param data:
Training data: RDD of LabeledPoint. L... | 0.002965 |
def generate_docker_compose(self):
""" Generate a sample docker compose
"""
example = {}
example['app'] = {}
example['app']['environment'] = []
for key in sorted(list(self.spec.keys())):
if self.spec[key]['type'] in (dict, list):
value = f"\'{j... | 0.004983 |
def receive(self):
"""I receive data+hash, check for a match, confirm or not
confirm to the sender, and return the data payload.
"""
def _receive(input_message):
self.data = input_message[:-64]
_hash = input_message[-64:]
if h.sha256(self.data).hexdige... | 0.002478 |
def copy(self: BaseBoardT) -> BaseBoardT:
"""Creates a copy of the board."""
board = type(self)(None)
board.pawns = self.pawns
board.knights = self.knights
board.bishops = self.bishops
board.rooks = self.rooks
board.queens = self.queens
board.kings = self... | 0.00367 |
def find_content(self, text):
"""Find content."""
if self.trigraphs:
text = RE_TRIGRAPHS.sub(self.process_trigraphs, text)
for m in self.pattern.finditer(self.norm_nl(text)):
self.evaluate(m) | 0.008299 |
def type_id(self) -> UnitTypeId:
""" UnitTypeId found in sc2/ids/unit_typeid
Caches all type_ids of the same unit type"""
unit_type = self._proto.unit_type
if unit_type not in self._game_data.unit_types:
self._game_data.unit_types[unit_type] = UnitTypeId(unit_type)
re... | 0.005525 |
def noise4d(self, x, y, z, w):
"""
Generate 4D OpenSimplex noise from X,Y,Z,W coordinates.
"""
# Place input coordinates on simplectic honeycomb.
stretch_offset = (x + y + z + w) * STRETCH_CONSTANT_4D
xs = x + stretch_offset
ys = y + stretch_offset
zs = z ... | 0.001882 |
def plot_feature_histograms(xyzall,
feature_labels=None,
ax=None,
ylog=False,
outfile=None,
n_bins=50,
ignore_dim_warning=False,
... | 0.002598 |
def getbalance(self, address: str) -> Decimal:
'''Returns current balance of given address.'''
try:
return Decimal(cast(float, self.ext_fetch('getbalance/' + address)))
except TypeError:
return Decimal(0) | 0.011858 |
def install_from_rpm_py_package(self):
"""Run install from RPM Python binding RPM package."""
self._download_and_extract_rpm_py_package()
# Find ./usr/lib64/pythonN.N/site-packages/rpm directory.
# A binary built by same version Python with used Python is target
# for the safe i... | 0.000729 |
def imshow(*imgs, **options):
"""
Plots multiple images using matplotlib
by dynamically finding the required number of rows and cols.
:param imgs: Images as any number of arguments
:param options: Dict of options
- cmap: Color map for gray scale images
- vmin: Minimum value to be... | 0.001361 |
def set_metadata(self, obj, metadata, clear=False, prefix=None):
"""
Accepts a dictionary of metadata key/value pairs and updates the
specified object metadata with them.
If 'clear' is True, any existing metadata is deleted and only the
passed metadata is retained. Otherwise, th... | 0.001155 |
def closePanel(self):
"""
Closes a full view panel.
"""
# make sure we can close all the widgets in the view first
for i in range(self.count()):
if not self.widget(i).canClose():
return False
container = self.parentWidget()
viewWidget ... | 0.003678 |
def add(self, arg1, arg2=None, arg3=None, bucket_type=None):
"""
Start assembling a Map/Reduce operation. A shortcut for
:func:`RiakMapReduce.add`.
:param arg1: the object or bucket to add
:type arg1: RiakObject, string
:param arg2: a key or list of keys to add (if a buc... | 0.002681 |
def loadcache(json_file):
"""
Loads json file as dictionary, feeds it to monkeycache and spits result
"""
f = open(json_file, 'r')
data = f.read()
f.close()
try:
apicache = json.loads(data)
except ValueError as e:
print("Error processing json:", json_file, e)
retu... | 0.002899 |
def GLOBAL(self, node):
"""
Keep track of globals declarations.
"""
global_scope_index = 1 if self._in_doctest() else 0
global_scope = self.scopeStack[global_scope_index]
# Ignore 'global' statement in global scope.
if self.scope is not global_scope:
... | 0.001533 |
def _from_dict(cls, _dict):
"""Initialize a LanguageModels object from a json dictionary."""
args = {}
if 'customizations' in _dict:
args['customizations'] = [
LanguageModel._from_dict(x)
for x in (_dict.get('customizations'))
]
els... | 0.006211 |
def update_buttons(self):
"""Updates the enable status of delete and reset buttons."""
current_scheme = self.current_scheme
names = self.get_option("names")
try:
names.pop(names.index(u'Custom'))
except ValueError:
pass
delete_enabled = current_sch... | 0.004474 |
def create(self):
"""
Create the local repository (if it doesn't already exist).
:returns: :data:`True` if the local repository was just created,
:data:`False` if it already existed.
What :func:`create()` does depends on the situation:
- When :attr:`exists` i... | 0.003115 |
def get_scale(self):
"""
If exposure was not set in the __init__, get the exposure associated
with this RawImage so that it may be used in other
:class:`~peri.util.RawImage`. This is useful for transferring exposure
parameters to a series of images.
Returns
-----... | 0.003419 |
async def set_ignore_version(request):
"""
This handler expects a POST request of form application/json.
The request body should be formatted as:
{"version": version_ignored}
The POST will 400 in the following scenarios:
1. Sending an empty dict
2. Sending a dict with an empty string
"... | 0.001181 |
def revisions(
request, slug, template_name='wakawaka/revisions.html', extra_context=None
):
"""
Displays the list of all revisions for a specific WikiPage
"""
queryset = WikiPage.objects.all()
page = get_object_or_404(queryset, slug=slug)
template_context = {'page': page}
template_cont... | 0.002433 |
def apply_mask_4d(image, mask_img): # , smooth_mm=None, remove_nans=True):
"""Read a Nifti file nii_file and a mask Nifti file.
Extract the signals in nii_file that are within the mask, the mask indices
and the mask shape.
Parameters
----------
image: img-like object or boyle.nifti.NeuroImage ... | 0.002367 |
def pkcs12_key_as_pem(private_key_bytes, private_key_password):
"""Convert the contents of a PKCS#12 key to PEM using pyOpenSSL.
Args:
private_key_bytes: Bytes. PKCS#12 key in DER format.
private_key_password: String. Password for PKCS#12 key.
Returns:
String. PEM contents of ``pri... | 0.001667 |
def get_compositions_by_search(self, composition_query, composition_search):
"""Gets the search results matching the given search query using the given search.
arg: composition_query (osid.repository.CompositionQuery):
the composition query
arg: composition_search (osid.re... | 0.003299 |
def get_telex_definition(w_shorthand=True, brackets_shorthand=True):
"""Create a definition dictionary for the TELEX input method
Args:
w_shorthand (optional): allow a stand-alone w to be
interpreted as an ư. Default to True.
brackets_shorthand (optional, True): allow typing ][ as
... | 0.001142 |
def remove_stage_from_deployed_values(key, filename):
# type: (str, str) -> None
"""Delete a top level key from the deployed JSON file."""
final_values = {} # type: Dict[str, Any]
try:
with open(filename, 'r') as f:
final_values = json.load(f)
except IOError:
# If there ... | 0.001502 |
def cartesian(self, other):
"""
Return the Cartesian product of this RDD and another one, that is, the
RDD of all pairs of elements C{(a, b)} where C{a} is in C{self} and
C{b} is in C{other}.
>>> rdd = sc.parallelize([1, 2])
>>> sorted(rdd.cartesian(rdd).collect())
... | 0.003063 |
def _coarsegrain_space(coarse_grain, is_cut, system):
"""Spatially coarse-grain the TPM and CM."""
tpm = coarse_grain.macro_tpm(
system.tpm, check_independence=(not is_cut))
node_indices = coarse_grain.macro_indices
state = coarse_grain.macro_state(system.state)
# U... | 0.004274 |
def fit(self, X, y=None, **kwargs):
"""Fit the underlying estimator.
Parameters
----------
X, y : array-like
**kwargs
Additional fit-kwargs for the underlying estimator.
Returns
-------
self : object
"""
logger.info("Starting ... | 0.003407 |
def _getFileNumber(self, filename):
"""
Given a file name, get its file number (if any).
@param filename: A C{str} file name.
@return: An C{int} file number or C{None} if no file with that name
has been added.
"""
cur = self._connection.cursor()
cur.e... | 0.00404 |
def titleOf(self, url):
"""
Returns the title for the inputed url.
:param url | <str>
:return <str>
"""
for m_url, m_title in self._stack:
if url == m_url:
return m_title
return nativestri... | 0.01462 |
def close(self):
"""Close the http/https connect."""
try:
self.response.close()
self.logger.debug("close connect succeed.")
except Exception as e:
self.unknown("close connect error: %s" % e) | 0.008 |
def feedback(self):
"""
Access the feedback
:returns: twilio.rest.api.v2010.account.message.feedback.FeedbackList
:rtype: twilio.rest.api.v2010.account.message.feedback.FeedbackList
"""
if self._feedback is None:
self._feedback = FeedbackList(
... | 0.00409 |
def encode(self, obj):
""" Add the given object to the result.
"""
if isinstance(obj, int_like_types):
self.result.append("i%de" % obj)
elif isinstance(obj, string_types):
self.result.extend([str(len(obj)), ':', str(obj)])
elif hasattr(obj, "__bencode__"):... | 0.002597 |
def _annotated_unpack_infer(stmt, context=None):
"""
Recursively generate nodes inferred by the given statement.
If the inferred value is a list or a tuple, recurse on the elements.
Returns an iterator which yields tuples in the format
('original node', 'infered node').
"""
if isinstance(stm... | 0.001477 |
def random_val(index, tune_params):
"""return a random value for a parameter"""
key = list(tune_params.keys())[index]
return random.choice(tune_params[key]) | 0.005952 |
def do_update(pool,request,models):
"unlike *_check() below, update doesn't worry about missing children"
return {k:fkapply(models,pool,process_update,missing_update,k,v) for k,v in request.items()} | 0.064356 |
def get_address(self, account_id, address_id, **params):
"""https://developers.coinbase.com/api/v2#show-addresss"""
response = self._get('v2', 'accounts', account_id, 'addresses', address_id, params=params)
return self._make_api_object(response, Address) | 0.010791 |
def from_tuples(cls, tups):
"""
Create a new IntervalTree from an iterable of 2- or 3-tuples,
where the tuple lists begin, end, and optionally data.
"""
ivs = [Interval(*t) for t in tups]
return IntervalTree(ivs) | 0.007663 |
def install_webpi(name, install_args=None, override_args=False):
'''
Instructs Chocolatey to install a package via the Microsoft Web PI service.
name
The name of the package to be installed. Only accepts a single argument.
install_args
A list of install arguments you want to pass to th... | 0.003953 |
def set_admin(msg, handler):
"""Handle admin verification responses from NickServ.
| If NickServ tells us that the nick is authed, mark it as verified.
"""
if handler.config['feature']['servicestype'] == "ircservices":
match = re.match("STATUS (.*) ([0-3])", msg)
elif handler.config['featu... | 0.003322 |
def split_results(self):
"""
Convenience method to separate failed and successful results.
.. versionadded:: 2.0.0
This function will split the results of the failed operation
(see :attr:`.all_results`) into "good" and "bad" dictionaries.
The intent is for the applicat... | 0.002494 |
def plot_samples(
ax,
sampler,
modelidx=0,
sed=True,
n_samples=100,
e_unit=u.eV,
e_range=None,
e_npoints=100,
threads=None,
label=None,
last_step=False,
):
"""Plot a number of samples from the sampler chain.
Parameters
----------
ax : `matplotlib.Axes`
... | 0.000423 |
def update_subscription(netid, action, subscription_code, data_field=None):
"""
Post a subscription action for the given netid and subscription_code
"""
url = '{0}/subscription.json'.format(url_version())
action_list = []
if isinstance(subscription_code, list):
for code in subscription_... | 0.001477 |
def argparse_funckw(func, defaults={}, **kwargs):
"""
allows kwargs to be specified on the commandline from testfuncs
Args:
func (function):
Kwargs:
lbl, verbose, only_specified, force_keys, type_hint, alias_dict
Returns:
dict: funckw
CommandLine:
python -m ut... | 0.000957 |
def breadcrumb(self):
"""List of ``(url, title)`` tuples defining the current breadcrumb
path.
"""
if self.path == '.':
return []
path = self.path
breadcrumb = [((self.url_ext or '.'), self.title)]
while True:
path = os.path.normpath(os.p... | 0.003195 |
def broadcast_tx(cls, tx_hex): # pragma: no cover
"""Broadcasts a transaction to the blockchain.
:param tx_hex: A signed transaction in hex form.
:type tx_hex: ``str``
:raises ConnectionError: If all API services fail.
"""
success = None
for api_call in cls.BRO... | 0.002618 |
def plot_spectra(self, nmax, convention='power', unit='per_l', base=10.,
maxcolumns=3, xscale='lin', yscale='log', grid=True,
xlim=(None, None), ylim=(None, None), show=True,
title=True, axes_labelsize=None, tick_labelsize=None,
title_l... | 0.000848 |
def keyPress(self, key):
""" Send a key press to the server
key: string: either [a-z] or a from KEYMAP
"""
log.debug('keyPress %s', key)
self.keyDown(key)
self.keyUp(key)
return self | 0.008197 |
def check_recursion_depth(self):
"""Check recursion depth, raise AsyncRecursionError if too deep."""
from furious.async import MAX_DEPTH
recursion_options = self._options.get('_recursion', {})
max_depth = recursion_options.get('max', MAX_DEPTH)
# Check if recursion check has be... | 0.00565 |
def _add_item(self, dim_vals, data, sort=True, update=True):
"""
Adds item to the data, applying dimension types and ensuring
key conforms to Dimension type and values.
"""
sort = sort and self.sort
if not isinstance(dim_vals, tuple):
dim_vals = (dim_vals,)
... | 0.004184 |
def convert2wkt(self, set3D=True):
"""
export the geometry of each feature as a wkt string
Parameters
----------
set3D: bool
keep the third (height) dimension?
Returns
-------
"""
features = self.getfeatures()
for feature in ... | 0.004878 |
def execute(self, statement, params = ()):
"""
execute sql statement. optionally you can give multiple statements
to save on cursor creation and closure
"""
con = self.__con or self.connection
cur = self.__cur or con.cursor()
if isinstance(statement, list) == Fal... | 0.010101 |
def login(self, username, password):
"""
Log into the WS interface and get the authentication token
if login is:
- accepted, returns True
- refused, returns False
In case of any error, raises a BackendException
:param username: login name
:type username... | 0.002015 |
def compute_diffusion_maps(lapl_type, diffusion_map, lambdas, diffusion_time):
""" Credit to Satrajit Ghosh (http://satra.cogitatum.org/) for final steps """
# Check that diffusion maps is using the correct laplacian, warn otherwise
if lapl_type not in ['geometric', 'renormalized']:
warnings.warn("f... | 0.006772 |
def framework_version_from_tag(image_tag):
"""Extract the framework version from the image tag.
Args:
image_tag (str): Image tag, which should take the form '<framework_version>-<device>-<py_version>'
Returns:
str: The framework version.
"""
tag_pattern = re.compile('^(.*)-(cpu|gpu... | 0.004545 |
def cmd_delete(args):
"""Deletes a node"""
major = args.get(0)
minor = args.get(1)
if major is not None:
if major in penStore.data:
if minor is None:
if len(penStore.data[major]) > 0:
if raw_input("are you sure (y/n)? ") not in ['y', 'Y', 'yes', 'Y... | 0.003125 |
def save_form(self, request, form, change):
"""
Given a ModelForm return an unsaved instance. ``change`` is True if
the object is being changed, and False if it's being added.
"""
r = form.save(commit=False)
parent_id = request.REQUEST.get('parent_id', None)
if pa... | 0.004662 |
def upload(self, params={}):
"""start uploading the file until upload is complete or error.
This is the main method to used, If you do not care about
state of process.
Args:
params: a dict object describe video info, eg title,
tags, description, ... | 0.001797 |
def update(gandi, fqdn, name, type, value, ttl, file):
"""Update record entry for a domain.
--file option will ignore other parameters and overwrite current zone
content with provided file content.
"""
domains = gandi.dns.list()
domains = [domain['fqdn'] for domain in domains]
if fqdn not i... | 0.000958 |
def create_conversation(self, body, recipients, attachment_ids=None, context_code=None, filter=None, filter_mode=None, group_conversation=None, media_comment_id=None, media_comment_type=None, mode=None, scope=None, subject=None, user_note=None):
"""
Create a conversation.
Create a new conve... | 0.00413 |
def contians_attribute(self, attribute):
"""
Returns how many cards in the deck have the specified attribute.
This method requires a library to be stored in the deck instance and
will return `None` if there is no library.
"""
if self.library is None:
return 0... | 0.003711 |
def to_python(self, data):
"""
Adds support for txtinfo format
"""
try:
return super(OlsrParser, self).to_python(data)
except ConversionException as e:
return self._txtinfo_to_jsoninfo(e.data) | 0.007813 |
def _fix_unmapped(mapped_file, unmapped_file, data):
"""
The unmapped.bam file up until at least Tophat 2.1.1 is broken in various
ways, see https://github.com/cbrueffer/tophat-recondition for details.
Run TopHat-Recondition to fix these issues.
"""
out_file = os.path.splitext(unmapped_file)[0] ... | 0.001009 |
def parse_plotFingerprint(self):
"""Find plotFingerprint output. Both --outQualityMetrics and --outRawCounts"""
self.deeptools_plotFingerprintOutQualityMetrics = dict()
for f in self.find_log_files('deeptools/plotFingerprintOutQualityMetrics'):
parsed_data = self.parsePlotFingerprint... | 0.004949 |
def rvs(self, size=1):
""" Rejection samples the parameter space.
"""
# create output FieldArray
out = record.FieldArray(size, dtype=[(arg, float)
for arg in self.variable_args])
# loop until enough samples accepted
n = 0
whil... | 0.003359 |
def update_qa(quietly=False):
"""
Merge code from develop to qa
"""
switch('dev')
switch('qa')
local('git merge --no-edit develop')
local('git push')
if not quietly:
print(red('PLEASE DEPLOY CODE: fab deploy:all')) | 0.003876 |
def issubset(self, other):
"""Test whether the resources available in this machine description are
a (non-strict) subset of those available in another machine.
.. note::
This test being False does not imply that the this machine is
a superset of the other machine; machi... | 0.002833 |
def reload(self):
'''
Clear plugin manager state and reload plugins.
This method will make use of :meth:`clear` and :meth:`load_plugin`,
so all internal state will be cleared, and all plugins defined in
:data:`self.app.config['plugin_modules']` will be loaded.
'''
... | 0.004587 |
def SvelteComponent(name, path):
"""Display svelte components in iPython.
Args:
name: name of svelte component (must match component filename when built)
path: path to compile svelte .js file or source svelte .html file.
(If html file, we try to call svelte and build the file.)
Returns:
A func... | 0.009456 |
def geo_length(arg, use_spheroid=None):
"""
Compute length of a geo spatial data
Parameters
----------
arg : geometry or geography
use_spheroid : default None
Returns
-------
length : double scalar
"""
op = ops.GeoLength(arg, use_spheroid)
return op.to_expr() | 0.003236 |
def _wordAfterCursor(self):
"""Get word, which is located before cursor
"""
cursor = self._qpart.textCursor()
textAfterCursor = cursor.block().text()[cursor.positionInBlock():]
match = _wordAtStartRegExp.search(textAfterCursor)
if match:
return match.group(0)
... | 0.005634 |
def _handle_hr(self):
"""Handle a wiki-style horizontal rule (``----``) in the string."""
length = 4
self._head += 3
while self._read(1) == "-":
length += 1
self._head += 1
self._emit(tokens.TagOpenOpen(wiki_markup="-" * length))
self._emit_text("h... | 0.005405 |
def selectOptimalChunk(self, peer):
"""
select an optimal chunk to send to a peer.
@return: int(chunkNumber), str(chunkData) if there is data to be sent,
otherwise None, None
"""
# stuff I have
have = sets.Set(self.mask.positions(1))
# stuff that this pe... | 0.002256 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.