text stringlengths 78 104k | score float64 0 0.18 |
|---|---|
def crt_prf_tc(aryNrlTc, varNumVol, varTr, varTmpOvsmpl, switchHrfSet,
tplPngSize, varPar, dctPrm=None, lgcPrint=True):
"""Convolve every neural time course with HRF function.
Parameters
----------
aryNrlTc : 4d numpy array, shape [n_x_pos, n_y_pos, n_sd, n_vol]
Temporally upsamp... | 0.000237 |
def laminar_entry_thermal_Hausen(Re=None, Pr=None, L=None, Di=None):
r'''Calculates average internal convection Nusselt number for laminar flows
in pipe during the thermal entry region according to [1]_ as shown in
[2]_ and cited by [3]_.
.. math::
Nu_D=3.66+\frac{0.0668\frac{D}{L}Re_{D}Pr}{1+0... | 0.000649 |
def add_insertions(self, skip=10, window=1, test=False):
'''Adds a random base within window bases around every skip bases. e.g. skip=10, window=1 means a random base added somwhere in theintervals [9,11], [19,21] ... '''
assert 2 * window < skip
new_seq = list(self.seq)
for i in range(l... | 0.005102 |
def set_sampling_strategies(self, filter, strategy_and_params):
"""Set sampling strategy for the sensors of all the group's clients.
Only sensors that match the specified filter are considered. See the
`KATCPResource.set_sampling_strategies` docstring for parameter
definitions and more ... | 0.002157 |
def make_masks(self, template):
"""This method generates all seven masks so that the best mask can
be determined. The template parameter is a code matrix that will
server as the base for all the generated masks.
"""
from copy import deepcopy
nmasks = len(tables.mask_patt... | 0.008669 |
def _fix_component_id(self, component):
'Fix name of component ad all of its children'
theID = getattr(component, "id", None)
if theID is not None:
setattr(component, "id", self._fix_id(theID))
try:
for c in component.children:
self._fix_component... | 0.012887 |
def angle(vec1, vec2):
"""Calculate the angle between two Vector2's"""
dotp = Vector2.dot(vec1, vec2)
mag1 = vec1.length()
mag2 = vec2.length()
result = dotp / (mag1 * mag2)
return math.acos(result) | 0.00813 |
def check_config_file(msg):
"""
Checks the config.json file for default settings and auth values.
Args:
:msg: (Message class) an instance of a message class.
"""
with jsonconfig.Config("messages", indent=4) as cfg:
verify_profile_name(msg, cfg)
retrieve_data_from_config(msg... | 0.001972 |
def load_variant(self, variant_obj):
"""Load a variant object
Args:
variant_obj(dict)
Returns:
inserted_id
"""
# LOG.debug("Loading variant %s", variant_obj['_id'])
try:
result = self.variant_collection.insert_one(variant_obj)
... | 0.006397 |
def save(self, *args, **kwargs):
"""save(filething=None, padding=None)"""
super(MP4, self).save(*args, **kwargs) | 0.015504 |
def parse(self, line, cell, namespace=None):
"""Parses a line and cell into a dictionary of arguments, expanding variables from a namespace.
For each line parameters beginning with --, it also checks the cell content and see if it exists
there. For example, if "--config1" is a line parameter, it checks to ... | 0.010764 |
def minimum_distance2(hull_a, center_a, hull_b, center_b):
'''Return the minimum distance or 0 if overlap between 2 convex hulls
hull_a - list of points in clockwise direction
center_a - a point within the hull
hull_b - list of points in clockwise direction
center_b - a point within the hull
... | 0.003876 |
def get_sketch(self, sketch_id):
"""Get information on the specified sketch.
Args:
sketch_id (int): ID of sketch
Returns:
dict: Dictionary of sketch information
Raises:
ValueError: Sketch is inaccessible
"""
resource_url = '{0:s}/sketches/{1:d}/'.format(self.api_base_url, sk... | 0.0053 |
def visit(spht, node):
"""Append opening tags to document body list.
:param sphinx.writers.html.SmartyPantsHTMLTranslator spht: Object to modify.
:param sphinxcontrib.imgur.nodes.ImgurEmbedNode node: This class' instance.
"""
html_attrs_bq = {'CLASS': 'imgur-embed-pub', 'lang': ... | 0.010929 |
def cleanup_candidates(self, node_ip):
"""
Removes old TCP hole punching candidates for a
designated node if a certain amount of time has passed
since they last connected.
"""
if node_ip in self.factory.candidates:
old_candidates = []
for c... | 0.003067 |
def compile_tag_re(self, tags):
"""
Return the regex used to look for Mustache tags compiled to work with
specific opening tags, close tags, and tag types.
"""
return re.compile(self.raw_tag_re % tags, self.re_flags) | 0.007813 |
def geometricBar(weights, alldistribT):
"""return the weighted geometric mean of distributions"""
assert(len(weights) == alldistribT.shape[1])
return np.exp(np.dot(np.log(alldistribT), weights.T)) | 0.004808 |
def set_table_cb(self, viewer, table):
"""Display the given table object."""
self.clear()
tree_dict = OrderedDict()
# Extract data as astropy table
a_tab = table.get_data()
# Fill masked values, if applicable
try:
a_tab = a_tab.filled()
excep... | 0.001361 |
def closestsites(struct_blk, struct_def, pos):
"""
Returns closest site to the input position
for both bulk and defect structures
Args:
struct_blk: Bulk structure
struct_def: Defect structure
pos: Position
Return: (site object, dist, index)
"""
blk_close_sites = struc... | 0.005042 |
def commandify(use_argcomplete=False, exit=True, *args, **kwargs):
'''Turns decorated functions into command line args
Finds the main_command and all commands and generates command line args
from these.'''
parser = CommandifyArgumentParser(*args, **kwargs)
parser.setup_arguments()
if use_argcom... | 0.001316 |
def polemap_magic(loc_file="locations.txt", dir_path=".", interactive=False, crd="",
sym='ro', symsize=40, rsym='g^', rsymsize=40,
fmt="pdf", res="c", proj="ortho",
flip=False, anti=False, fancy=False,
ell=False, ages=False, lat_0=90., lon_0=0., sa... | 0.001879 |
def collect_trajectories(env,
policy_fun,
num_trajectories=1,
policy="greedy",
max_timestep=None,
epsilon=0.1):
"""Collect trajectories with the given policy net and behaviour.
Args:
env... | 0.008628 |
def mme_matches(case_obj, institute_obj, mme_base_url, mme_token):
"""Show Matchmaker submission data for a sample and eventual matches.
Args:
case_obj(dict): a scout case object
institute_obj(dict): an institute object
mme_base_url(str) base url of the MME server
mme_token(str)... | 0.005814 |
def _in6_getifaddr(ifname):
"""
Returns a list of IPv6 addresses configured on the interface ifname.
"""
# Get the output of ifconfig
try:
f = os.popen("%s %s" % (conf.prog.ifconfig, ifname))
except OSError:
log_interactive.warning("Failed to execute ifconfig.")
return [... | 0.001005 |
def get_events(self, from_=None, to=None):
"""Query a slice of the events.
Events are always returned in the order the were added.
Parameters:
from_ -- if not None, return only events added after the event with
id `from_`. If None, return from the start of history.... | 0.001259 |
def mangleNec(code, freq=40):
"""Convert NEC code to shorthand notation"""
# base time is 550 microseconds
# unit of burst time
# lead in pattern: 214d 10b3
# "1" burst pattern: 0226 0960
# "0" burst pattern: 0226 0258
# lead out pattern: 0226 2000
# there's large disagreement between... | 0.003158 |
def discrete(self):
"""
A sequence of connected vertices in space, corresponding to
self.paths.
Returns
---------
discrete : (len(self.paths),)
A sequence of (m*, dimension) float
"""
discrete = np.array([self.discretize_path(i)
... | 0.005263 |
def max(self, axis=None, keepdims=False):
"""
Return the maximum of the array over the given axis.
Parameters
----------
axis : tuple or int, optional, default=None
Axis to compute statistic over, if None
will compute over all axes
keepdims : boo... | 0.003839 |
def game(self):
"""
If the message media is a game, this returns the :tl:`Game`.
"""
if isinstance(self.media, types.MessageMediaGame):
return self.media.game | 0.009901 |
def set_hflip(self, val):
"""val is True or False that determines if we should horizontally flip the surface or not."""
if self.__horizontal_flip is not val:
self.__horizontal_flip = val
self.image = pygame.transform.flip(self.untransformed_image, val, self.__vertical_flip) | 0.012739 |
def text(self):
"""Get value of output stream (StringIO).
"""
if self.out:
self.out.close() # pragma: nocover
return self.fp.getvalue() | 0.011111 |
def _copy_with_dtype(data, dtype):
"""Create a copy of an array with the given dtype.
We use this instead of np.array() to ensure that custom object dtypes end
up on the resulting array.
"""
result = np.empty(data.shape, dtype)
result[...] = data
return result | 0.00346 |
def delete_objective(self, objective_id=None):
"""Deletes the Objective identified by the given Id.
arg: objectiveId (osid.id.Id): the Id of the Objective to
delete
raise: NotFound - an Objective was not found identified by the
given Id
raise: NullAr... | 0.002039 |
def send(self, url, data, headers):
"""
Spawn an async request to a remote webserver.
"""
eventlet.spawn(self._send_payload, (url, data, headers)) | 0.011236 |
def update_attribute_value_items(self):
"""
Returns an iterator of items for an attribute value map to use for
an UPDATE operation.
The iterator ignores collection attributes as these are processed
implicitly by the traversal algorithm.
:returns: iterator yielding tuple... | 0.002372 |
def git_hash(blob):
"""Return git-hash compatible SHA-1 hexdigits for a blob of data."""
head = str("blob " + str(len(blob)) + "\0").encode("utf-8")
return sha1(head + blob).hexdigest() | 0.005076 |
def get_crawler(self, crawler, url):
"""
Checks if a crawler supports a website (the website offers e.g. RSS
or sitemap) and falls back to the fallbacks defined in the config if
the site is not supported.
:param str crawler: Crawler-string (from the crawler-module)
:para... | 0.002051 |
def planSummary(self):
"""Extract planSummary if available (lazy)."""
if not self._counters_calculated:
self._counters_calculated = True
self._extract_counters()
return self._planSummary | 0.008511 |
def add_membership_listener(self, member_added=None, member_removed=None, fire_for_existing=False):
"""
Helper method for adding membership listeners
:param member_added: (Function), Function to be called when a member is added, in the form of f(member)
(optional).
:param member... | 0.009736 |
def Units(uname):
"""Generate a unit object.
Parameters
----------
uname : str
Wavelength or flux unit name.
Returns
-------
unit : `BaseUnit` or `None`
Unit object. `None` means unitless.
Raises
------
ValueError
Unknown unit name.
"""
if isin... | 0.005495 |
async def send_message():
"""Example of sending a message."""
jar = aiohttp.CookieJar(unsafe=True)
websession = aiohttp.ClientSession(cookie_jar=jar)
modem = eternalegypt.Modem(hostname=sys.argv[1], websession=websession)
await modem.login(password=sys.argv[2])
await modem.sms(phone=sys.argv[3... | 0.002513 |
def get_lat_variable(nc):
'''
Returns the variable for latitude
:param netcdf4.dataset nc: an open netcdf dataset object
'''
if 'latitude' in nc.variables:
return 'latitude'
latitudes = nc.get_variables_by_attributes(standard_name="latitude")
if latitudes:
return latitudes[0... | 0.002924 |
def get_next_item(iterable):
"""Gets the next item of an iterable.
If the iterable is exhausted, returns None."""
try: x = iterable.next()
except StopIteration: x = None
except AttributeError: x = None
return x | 0.017094 |
def init_object(self, args, kwargs):
"""This method is reponsible for setting :attr:`obj`.
It is called during :meth:`prepare_args`.
"""
self.object_id = kwargs.pop(self.pk, None)
if self.object_id is not None:
self.obj = self.Model.query.get(self.object_id)
... | 0.005141 |
def exists(self, model_class, ID):
'''Check if a record of id==ID exists in table model_class.__name__.lower()'''
assert hasattr(model_class, '_fields'), 'Not a valid model class'
res = self.get(model_class, id=ID, fetchOne=True)
if res:
return True
return False | 0.009524 |
def query(self, resource):
"""
Given a resource identifier find the domain specifier and then
construct the webfinger request. Implements
http://openid.net/specs/openid-connect-discovery-1_0.html#NormalizationSteps
:param resource:
"""
if resource[0] in ['=', '@'... | 0.000943 |
def _local_call(self, call_conf):
'''
Execute local call
'''
try:
ret = self._get_caller(call_conf).call()
except SystemExit:
ret = 'Data is not available at this moment'
self.out.error(ret)
except Exception as ex:
ret = 'Un... | 0.004396 |
def get_domain(self, name):
"""
获取域名信息,文档 https://developer.qiniu.com/fusion/api/4246/the-domain-name
Args:
name: 域名, 如果是泛域名,必须以点号 . 开头
Returns:
返回一个tuple对象,其格式为(<result>, <ResponseInfo>)
- result 成功返回dict{},失败返回{"error": "<errMsg string>"... | 0.004292 |
def attach(self):
"""Attach strategy to its sensor and send initial update."""
s = self._sensor
self.update(s, s.read())
self._sensor.attach(self) | 0.011236 |
def _siftup_max(heap, pos):
'Maxheap variant of _siftup'
endpos = len(heap)
startpos = pos
newitem = heap[pos]
# Bubble up the larger child until hitting a leaf.
childpos = 2*pos + 1 # leftmost child position
while childpos < endpos:
# Set childpos to index of larger child.
... | 0.001299 |
def extract(data, items, out_dir=None):
"""Extract germline calls for the given sample, if tumor only.
"""
if vcfutils.get_paired_phenotype(data):
if len(items) == 1:
germline_vcf = _remove_prioritization(data["vrn_file"], data, out_dir)
germline_vcf = vcfutils.bgzip_and_inde... | 0.006977 |
def to_jupyter(graph: BELGraph, chart: Optional[str] = None) -> Javascript:
"""Render the graph as JavaScript in a Jupyter Notebook."""
with open(os.path.join(HERE, 'render_with_javascript.js'), 'rt') as f:
js_template = Template(f.read())
return Javascript(js_template.render(**_get_context(graph, ... | 0.002994 |
def build_conflict_dict(key_list, val_list):
"""
Builds dict where a list of values is associated with more than one key
Args:
key_list (list):
val_list (list):
Returns:
dict: key_to_vals
CommandLine:
python -m utool.util_dict --test-build_conflict_dict
Exampl... | 0.001099 |
def run_once_per_node(func):
"""
Decorator preventing wrapped function from running more than
once per host (not just interpreter session).
Using env.patch = True will allow the wrapped function to be run
if it has been previously executed, but not otherwise
Stores the result of a function... | 0.015539 |
def sde(self):
"""
Return the state space representation of the standard periodic covariance.
! Note: one must constrain lengthscale not to drop below 0.2. (independently of approximation order)
After this Bessel functions of the first becomes NaN. Rescaling
t... | 0.029015 |
def method_args(self, context, **kwargs):
"""
Collect the set of arguments that should be used by a set of methods
:param context: Which service we're working for
:param kwargs: A set of keyword arguments that are added at run-time.
:return: A set of keyword arguments
""... | 0.004 |
def wait_for(self, timeout=None):
""" When a timeout should be applied for awaiting use this method.
:param timeout: optional timeout in seconds.
:returns: a future returning the emitted value
"""
from broqer.op import OnEmitFuture # due circular dependency
return self |... | 0.005714 |
def multiqc(institute_id, case_name):
"""Load multiqc report for the case."""
data = controllers.multiqc(store, institute_id, case_name)
if data['case'].get('multiqc') is None:
return abort(404)
out_dir = os.path.abspath(os.path.dirname(data['case']['multiqc']))
filename = os.path.basename(d... | 0.002545 |
def get_f_code_idx():
"""
How many pointers into PyFrame is the ``f_code`` variable?
"""
frame = sys._getframe()
frame_ptr = id(frame)
LARGE_ENOUGH = 20
# Look through the frame object until we find the f_tstate variable, whose
# value we know from above.
ptrs = [ctypes.c_voidp.fro... | 0.001481 |
def console_get_height(con: tcod.console.Console) -> int:
"""Return the height of a console.
Args:
con (Console): Any Console instance.
Returns:
int: The height of a Console.
.. deprecated:: 2.0
Use `Console.height` instead.
"""
return int(lib.TCOD_console_get_height(_... | 0.002994 |
def should_use_ephemeral_cache(
req, # type: InstallRequirement
format_control, # type: FormatControl
autobuilding, # type: bool
cache_available # type: bool
):
# type: (...) -> Optional[bool]
"""
Return whether to build an InstallRequirement object using the
ephemeral cache.
:p... | 0.000616 |
def _evaluate_barycentric_multi(nodes, degree, param_vals, dimension):
r"""Compute multiple points on the surface.
.. note::
There is also a Fortran implementation of this function, which
will be used if it can be built.
Args:
nodes (numpy.ndarray): Control point nodes that define t... | 0.000956 |
def encode_hdr(self, boundary):
"""Returns the header of the encoding of this parameter"""
boundary = encode_and_quote(boundary)
headers = ["--%s" % boundary]
if self.filename:
disposition = 'form-data; name="%s"; filename="%s"' % (self.name,
... | 0.003817 |
def set_coordsys(self):
"""
Mapping to astropy's coordinate system name
# TODO: needs expert attention (Most reference systems are not mapped)
"""
if self.coordsys.lower() in self.coordsys_mapping:
self.coordsys = self.coordsys_mapping[self.coordsys.lower()] | 0.006431 |
def _handle_is_dag_stopped(self, request):
""" The handler for the dag_stopped request.
The dag_stopped request checks whether a dag is flagged to be terminated.
Args:
request (Request): Reference to a request object containing the
incoming request. T... | 0.006674 |
def pause_unit(assess_status_func, services=None, ports=None,
charm_func=None):
"""Pause a unit by stopping the services and setting 'unit-paused'
in the local kv() store.
Also checks that the services have stopped and ports are no longer
being listened to.
An optional charm_func() ... | 0.000642 |
def search(self, **kwargs):
"""
Method to search Virtual Interfaces based on extends search.
:param search: Dict containing QuerySets to find Virtual Interfaces.
:param include: Array containing fields to include on response.
:param exclude: Array containing fields to exclude on... | 0.004399 |
def __put_buttons_in_buttonframe(choices):
"""Put the buttons in the buttons frame"""
global __widgetTexts, __firstWidget, buttonsFrame
__firstWidget = None
__widgetTexts = {}
i = 0
for buttonText in choices:
tempButton = tk.Button(buttonsFrame, takefocus=1, text=buttonText)
_... | 0.003745 |
def render_indirect(self, program: moderngl.Program, buffer, mode=None, count=-1, *, first=0):
"""
The render primitive (mode) must be the same as the input primitive of the GeometryShader.
The draw commands are 5 integers: (count, instanceCount, firstIndex, baseVertex, baseInstance).
A... | 0.005981 |
def btc_tx_sign_multisig(tx, idx, redeem_script, private_keys, hashcode=SIGHASH_ALL):
"""
Sign a p2sh multisig input (not segwit!).
@tx must be a hex-encoded tx
Return the signed transaction
"""
from .multisig import parse_multisig_redeemscript
# sign in the right order. map all pos... | 0.005232 |
def register(self):
"""Proxy method to register the device with the parent.
"""
if not self.registered:
self.registered = True
if self.parent:
self.parent.register(self) | 0.008584 |
def getRaDecs(self, mods):
"""Internal function converting cartesian coords to
ra dec"""
raDecOut = np.empty( (len(mods), 5))
raDecOut[:,0:3] = mods[:,0:3]
for i, row in enumerate(mods):
raDecOut[i, 3:5] = r.raDecFromVec(row[3:6])
return raDecOut | 0.016287 |
def handle_500(self, request, exception):
# type: (BaseHttpRequest, BaseException) -> Resource
"""
Handle an *un-handled* exception.
"""
# Let middleware attempt to handle exception
try:
for middleware in self.middleware.handle_500:
resource = ... | 0.003576 |
def get_message_state_scope(self, msgid, line=None, confidence=UNDEFINED):
"""Returns the scope at which a message was enabled/disabled."""
if self.config.confidence and confidence.name not in self.config.confidence:
return MSG_STATE_CONFIDENCE
try:
if line in self.file_s... | 0.006036 |
def draw(self, img, pixmapper, bounds):
'''draw the trail'''
for p in self.points:
(px,py) = pixmapper(p)
if px >= 0 and py >= 0 and px < img.width and py < img.height:
cv.Circle(img, (px,py), 1, self.colour) | 0.015152 |
def get_all_conditions(self):
"""
Returns a generator which yields groups of lists of conditions.
>>> for set_id, label, field in gargoyle.get_all_conditions(): #doctest: +SKIP
>>> print "%(label)s: %(field)s" % (label, field.label) #doctest: +SKIP
"""
for condition_... | 0.008681 |
def parseAcceptHeader(value):
"""Parse an accept header, ignoring any accept-extensions
returns a list of tuples containing main MIME type, MIME subtype,
and quality markdown.
str -> [(str, str, float)]
"""
chunks = [chunk.strip() for chunk in value.split(',')]
accept = []
for chunk in... | 0.00093 |
def getFirstUrn(self, reference=None):
""" Get the first children URN for a given resource
:param reference: CtsReference from which to find child (If None, find first reference)
:type reference: CtsReference, str
:return: Children URN
:rtype: URN
"""
if referenc... | 0.003911 |
def google_register(username:str, email:str, full_name:str, google_id:int, bio:str, token:str=None):
"""
Register a new user from google.
This can raise `exc.IntegrityError` exceptions in
case of conflics found.
:returns: User
"""
auth_data_model = apps.get_model("users", "AuthData")
use... | 0.00827 |
def calc_temp(Data_ref, Data):
"""
Calculates the temperature of a data set relative to a reference.
The reference is assumed to be at 300K.
Parameters
----------
Data_ref : DataObject
Reference data set, assumed to be 300K
Data : DataObject
Data object to have the temperatu... | 0.001862 |
def slh_associate(a_features, b_features, max_sigma=5):
"""
An implementation of the Scott and Longuet-Higgins algorithm for feature
association.
This function takes two lists of features. Each feature is a
:py:class:`MultivariateNormal` instance representing a feature
location and its associat... | 0.001114 |
def on_key_release(self, symbol, modifiers):
"""
Pyglet specific key release callback.
Forwards and translates the events to :py:func:`keyboard_event`
"""
self.keyboard_event(symbol, self.keys.ACTION_RELEASE, modifiers) | 0.007576 |
def watch(self, path, action, *args, **kwargs):
"""
Called by the Server instance when a new watch task is requested.
"""
if action is None:
action = _set_changed
event_handler = _WatchdogHandler(self, action)
self._observer.schedule(event_handler, path=path, ... | 0.00597 |
def encrypt(self, data):
'''
encrypt data with AES-CBC and sign it with HMAC-SHA256
'''
aes_key, hmac_key = self.keys
pad = self.AES_BLOCK_SIZE - len(data) % self.AES_BLOCK_SIZE
if six.PY2:
data = data + pad * chr(pad)
else:
data = data + s... | 0.00355 |
def subjects_create(self, filename):
"""Create subject from given data files. Expects the file to be a
Freesurfer archive.
Raises ValueError if given file is not a valid subject file.
Parameters
----------
filename : File-type object
Freesurfer archive file
... | 0.003636 |
def tuple_replace(tup, *pairs):
"""Return a copy of a tuple with some elements replaced.
:param tup: The tuple to be copied.
:param pairs: Any number of (index, value) tuples where index is the index
of the item to replace and value is the new value of the item.
"""
tuple_list = list(tup)
... | 0.002427 |
def compose_receipt(message):
"""
Compose a :xep:`184` delivery receipt for a :class:`~aioxmpp.Message`.
:param message: The message to compose the receipt for.
:type message: :class:`~aioxmpp.Message`
:raises ValueError: if the input message is of type
:attr:`~aioxmpp.MessageType.ERROR`
... | 0.001018 |
def meth_new(args):
""" Submit a new workflow (or update) to the methods repository. """
r = fapi.update_repository_method(args.namespace, args.method,
args.synopsis, args.wdl, args.doc,
args.comment)
fapi._check_response_code(r, 20... | 0.002008 |
def add_vertex(self, v):
""" Add a vertex to the graph
:param v: The vertex name.
"""
self.graph.add_vertex(v)
self.vs.add(v) | 0.012048 |
def purge(gandi, email, background, force, alias):
"""Purge a mailbox."""
login, domain = email
if alias:
if not force:
proceed = click.confirm('Are you sure to purge all aliases for '
'mailbox %s@%s ?' % (login, domain))
if not proceed:
... | 0.001447 |
def stop_volume(name, force=False):
'''
Stop a gluster volume
name
Volume name
force
Force stop the volume
.. versionadded:: 2015.8.4
CLI Example:
.. code-block:: bash
salt '*' glusterfs.stop_volume mycluster
'''
volinfo = info()
if name not in v... | 0.001541 |
def fit(self, X, C):
"""
Fit one weighted classifier per class
Parameters
----------
X : array (n_samples, n_features)
The data on which to fit a cost-sensitive classifier.
C : array (n_samples, n_classes)
The cost of predicting each label... | 0.007389 |
def generate_take(out_f, steps, line_prefix):
"""Generate the take function"""
out_f.write(
'{0}constexpr inline int take(int n_)\n'
'{0}{{\n'
'{0} return {1} 0 {2};\n'
'{0}}}\n'
'\n'.format(
line_prefix,
''.join('n_ >= {0} ? {0} : ('.format(s) fo... | 0.002639 |
def prefix_items(self, prefix, strip_prefix=False):
"""Get all (key, value) pairs with keys that begin with ``prefix``.
:param prefix: Lexical prefix for keys to search.
:type prefix: bytes
:param strip_prefix: True to strip the prefix from yielded items.
:type strip_prefix: bo... | 0.002861 |
def get_evernote_notes(self, evernote_filter):
"""
get the notes related to the filter
:param evernote_filter: filtering
:return: notes
"""
data = []
note_store = self.client.get_note_store()
our_note_list = note_store.findNotesMetadata(self.t... | 0.008475 |
def draw(self):
"""Draws the checkbox."""
if not self.visible:
return
# Blit the current checkbox's image.
if self.isEnabled:
if self.mouseIsDown and self.lastMouseDownOverButton and self.mouseOverButton:
if self.value:
... | 0.004608 |
def _vertex_data_to_sframe(data, vid_field):
"""
Convert data into a vertex data sframe. Using vid_field to identify the id
column. The returned sframe will have id column name '__id'.
"""
if isinstance(data, SFrame):
# '__id' already in the sframe, and it is ok to not specify vid_field
... | 0.002871 |
def auth_user_oid(self, email):
"""
OpenID user Authentication
:param email: user's email to authenticate
:type self: User model
"""
user = self.find_user(email=email)
if user is None or (not user.is_active):
log.info(LOGMSG_WAR_SEC_LOGIN_... | 0.004464 |
def resize_max(img, max_side):
"""
Resize the image to threshold the maximum dimension within max_side
:param img:
:param max_side: Length of the maximum height or width
:return:
"""
h, w = img.shape[:2]
if h > w:
nh = max_side
nw = w * (nh / h)
else:
nw = max... | 0.002577 |
def remove_props(self,*args):
"""
Removes desired properties from ``self.properties``.
"""
for arg in args:
if arg in self.properties:
del self.properties[arg] | 0.017544 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.