text stringlengths 78 104k | score float64 0 0.18 |
|---|---|
def get_force(self, component_info=None, data=None, component_position=None):
"""Get force data."""
components = []
append_components = components.append
for _ in range(component_info.plate_count):
component_position, plate = QRTPacket._get_exact(
RTForcePlate... | 0.002894 |
def project_onto_plane(strike, dip, plunge, bearing):
"""
Projects a linear feature(s) onto the surface of a plane. Returns a rake
angle(s) along the plane.
This is also useful for finding the rake angle of a feature that already
intersects the plane in question.
Parameters
----------
... | 0.00111 |
def __get_or_create(
ns_cache: NamespaceMap,
name: sym.Symbol,
module: types.ModuleType = None,
core_ns_name=CORE_NS,
) -> lmap.Map:
"""Private swap function used by `get_or_create` to atomically swap
the new namespace map into the global cache."""
ns = ns_cac... | 0.004255 |
def get_contained_labels(self, inplace=True):
"""
Get the set of unique labels contained in this annotation.
Returns a pandas dataframe or sets the contained_labels
attribute of the object.
Requires the label_store field to be set.
Function will try to use attributes c... | 0.001569 |
def predict(self, v=None, X=None):
"""In classification this returns the classes, in
regression it is equivalent to the decision function"""
if X is None:
X = v
v = None
m = self.model(v=v)
return m.predict(X) | 0.007326 |
def cluster(self, method, **kwargs):
"""
Cluster the tribe.
Cluster templates within a tribe: returns multiple tribes each of
which could be stacked.
:type method: str
:param method:
Method of stacking, see :mod:`eqcorrscan.utils.clustering`
:return... | 0.002068 |
def close(self):
"""Close the socket underlying this connection."""
self.rfile.close()
if not self.linger:
# Python's socket module does NOT call close on the kernel socket
# when you call socket.close(). We do so manually here because we
# want this ... | 0.003752 |
def disassociate_route_table(association_id, region=None, key=None, keyid=None, profile=None):
'''
Dissassociates a route table.
association_id
The Route Table Association ID to disassociate
CLI Example:
.. code-block:: bash
salt myminion boto_vpc.disassociate_route_table 'rtbass... | 0.005507 |
def ConsultarPuerto(self, sep="||"):
"Consulta de Puertos habilitados"
ret = self.client.puertoConsultar(
auth={
'token': self.Token, 'sign': self.Sign,
'cuit': self.Cuit, },
)['puertoReturn']
... | 0.01 |
def get_model_fields(self):
""" List of model fields to include (defaults to all) """
model_fields = getattr(self.Meta, 'fields', None)
if model_fields is not None:
model_fields = set(model_fields)
return model_fields | 0.007576 |
def DeleteItem(self, item):
"Remove the item from the list and unset the related data"
wx_data = self.GetItemData(item)
py_data = self._py_data_map[wx_data]
del self._py_data_map[wx_data]
del self._wx_data_map[py_data]
wx.ListCtrl.DeleteItem(self, item) | 0.006515 |
def lint():
"""
run linter on our code base.
"""
path = os.path.realpath(os.getcwd())
cmd = 'flake8 %s' % path
opt = ''
print(">>> Linting codebase with the following command: %s %s" % (cmd, opt))
try:
return_code = call([cmd, opt], shell=True)
if return_code < 0:
... | 0.003125 |
def hello(self):
"""http://docs.fiesta.cc/index.html#getting-started"""
path = 'hello'
response = self.request(path, do_authentication=False)
return response | 0.010582 |
def injectAttribute(annotationName, depth, attr, value):
"""
Inject an attribute in a class from it's class frame.
Use in class annnotation to create methods/properties dynamically
at class creation time without dealing with metaclass.
depth parameter specify the stack depth from the class definiti... | 0.001672 |
def read_csv(filepath, sep=',', header='infer', names=None, usecols=None, dtype=None, converters=None,
skiprows=None, nrows=None):
"""Read CSV into DataFrame.
Eager implementation using pandas, i.e. entire file is read at this point. Only common/relevant parameters
available at the moment; for... | 0.00303 |
def build_helpers_egginfo_json(
json_field, json_key_registry, json_filename=None):
"""
Return a tuple of functions that will provide the usage of the
JSON egginfo based around the provided field.
"""
json_filename = (
json_field + '.json' if json_filename is None else json_filename... | 0.000418 |
def _filter_markdown(source, filters):
"""Only keep some Markdown headers from a Markdown string."""
lines = source.splitlines()
# Filters is a list of 'hN' strings where 1 <= N <= 6.
headers = [_replace_header_filter(filter) for filter in filters]
lines = [line for line in lines if line.startswith(... | 0.002747 |
def get_userinfo(self, access_token, id_token, payload):
"""Return user details dictionary. The id_token and payload are not used in
the default implementation, but may be used when overriding this method"""
user_response = requests.get(
self.OIDC_OP_USER_ENDPOINT,
heade... | 0.007326 |
def to_map_with_default(value, default_value):
"""
Converts JSON string into map object or returns default value when conversion is not possible.
:param value: the JSON string to convert.
:param default_value: the default value.
:return: Map object value or default when conver... | 0.008565 |
def _read_buckets_cache_file(cache_file):
'''
Return the contents of the buckets cache file
'''
log.debug('Reading buckets cache file')
with salt.utils.files.fopen(cache_file, 'rb') as fp_:
data = pickle.load(fp_)
return data | 0.003846 |
def change_quantiles(x, ql, qh, isabs, f_agg):
"""
First fixes a corridor given by the quantiles ql and qh of the distribution of x.
Then calculates the average, absolute value of consecutive changes of the series x inside this corridor.
Think about selecting a corridor on the
y-Axis and only calcu... | 0.003975 |
async def _roundtrip(cls):
"""Testing helper: gets each value and sets it again."""
getters = {
name[4:]: getattr(cls, name) for name in dir(cls)
if name.startswith("get_") and name != "get_config"
}
setters = {
name[4:]: getattr(cls, name) for name in... | 0.001923 |
def join(
self,
inner_enumerable,
outer_key=lambda x: x,
inner_key=lambda x: x,
result_func=lambda x: x
):
"""
Return enumerable of inner equi-join between two enumerables
:param inner_enumerable: inner enumerable to join to self
... | 0.002379 |
def ls_cmd(argv):
"""List available environments."""
parser = argparse.ArgumentParser()
p_group = parser.add_mutually_exclusive_group()
p_group.add_argument('-b', '--brief', action='store_false')
p_group.add_argument('-l', '--long', action='store_true')
args = parser.parse_args(argv)
lsvirtu... | 0.002976 |
def _wait_for_consistency(checker):
"""Eventual consistency: wait until GCS reports something is true.
This is necessary for e.g. create/delete where the operation might return,
but won't be reflected for a bit.
"""
for _ in xrange(EVENTUAL_CONSISTENCY_MAX_SLEEPS):
if checker():
... | 0.001859 |
def update_movie_ticket(self, code, ticket_class, show_time, duration,
screening_room, seat_number, card_id=None):
"""
更新电影票
"""
ticket = {
'code': code,
'ticket_class': ticket_class,
'show_time': show_time,
'dur... | 0.005034 |
def status(self):
"""Return string indicating the error encountered on failure."""
self._check_valid()
if self._ret_val == swiglpk.GLP_ENOPFS:
return 'No primal feasible solution'
elif self._ret_val == swiglpk.GLP_ENODFS:
return 'No dual feasible solution'
... | 0.005362 |
def _build_url(self, query_params):
"""Build the final URL to be passed to urllib
:param query_params: A dictionary of all the query parameters
:type query_params: dictionary
:return: string
"""
url = ''
count = 0
while count < len(self._url_path):
... | 0.002601 |
def load_visible_suites(cls, paths=None):
"""Get a list of suites whos bin paths are visible on $PATH.
Returns:
List of `Suite` objects.
"""
suite_paths = cls.visible_suite_paths(paths)
suites = [cls.load(x) for x in suite_paths]
return suites | 0.006579 |
def handle_move(self, dest_path):
"""Change semantic of MOVE to change resource tags."""
# path and destPath must be '/by_tag/<tag>/<resname>'
if "/by_tag/" not in self.path:
raise DAVError(HTTP_FORBIDDEN)
if "/by_tag/" not in dest_path:
raise DAVError(HTTP_FORBID... | 0.002751 |
def match(self, rule):
"""
Checks if the given rule matches with the filter.
:param rule: The Flask rule to be matched.
:return: True if the filter matches.
"""
if self.methods:
for method in self.methods:
if method in rule.methods:
... | 0.003899 |
def get_all_label_algorithms():
"""Gets all the possible label (structural grouping) algorithms in MSAF.
Returns
-------
algo_ids : list
List of all the IDs of label algorithms (strings).
"""
algo_ids = []
for name in msaf.algorithms.__all__:
module = eval(msaf.algorithms.__... | 0.002288 |
def get_seconds_until_next_quarter(now=None):
"""
Returns the number of seconds until the next quarter of an hour. This is the short-term rate limit used by Strava.
:param now: A (utc) timestamp
:type now: arrow.arrow.Arrow
:return: the number of seconds until the next quarter, as int
"""
if... | 0.006466 |
def delete_items_by_index(list_, index_list, copy=False):
"""
Remove items from ``list_`` at positions specified in ``index_list``
The original ``list_`` is preserved if ``copy`` is True
Args:
list_ (list):
index_list (list):
copy (bool): preserves original list if True
Exa... | 0.00108 |
def remove_link_button(self):
"""
Function removes link button from Run Window
"""
if self.link is not None:
self.info_box.remove(self.link)
self.link.destroy()
self.link = None | 0.008163 |
def sph_midpoint(coord1, coord2):
"""Compute the midpoint between two points on the sphere.
Parameters
----------
coord1 : `~astropy.coordinates.SkyCoord`
Coordinate of one point on a great circle.
coord2 : `~astropy.coordinates.SkyCoord`
Coordinate of the other point on a great cir... | 0.001346 |
def _get_id_from_name(self, name):
"""List placement group ids which match the given name."""
_filter = {
'placementGroups': {
'name': {'operation': name}
}
}
mask = "mask[id, name]"
results = self.client.call('Account', 'getPlacementGroups... | 0.007481 |
def get_default_view_path(resource):
"Returns the dotted path to the default view class."
parts = [a.member_name for a in resource.ancestors] +\
[resource.collection_name or resource.member_name]
if resource.prefix:
parts.insert(-1, resource.prefix)
view_file = '%s' % '_'.join(par... | 0.002008 |
def getSystemVariable(self, remote, name):
"""Get single system variable from CCU / Homegear"""
var = None
if self.remotes[remote]['username'] and self.remotes[remote]['password']:
LOG.debug(
"ServerThread.getSystemVariable: Getting System variable via JSON-RPC")
... | 0.003971 |
def _get_numbering(document, numid, ilvl):
"""Returns type for the list.
:Returns:
Returns type for the list. Returns "bullet" by default or in case of an error.
"""
try:
abs_num = document.numbering[numid]
return document.abstruct_numbering[abs_num][ilvl]['numFmt']
except:
... | 0.008772 |
def open(cls, path):
"""Load an image file into a PIX object.
Leptonica can load TIFF, PNM (PBM, PGM, PPM), PNG, and JPEG. If
loading fails then the object will wrap a C null pointer.
"""
filename = fspath(path)
with _LeptonicaErrorTrap():
return cls(lept.pi... | 0.005731 |
def _index_sub(self, uri_list, num, batch_num):
"""
Converts a list of uris to elasticsearch json objects
args:
uri_list: list of uris to convert
num: the ending count within the batch
batch_num: the batch number
"""
bname = '%s-%s' % (batch_n... | 0.00167 |
def DumpDirHashToStringIO(directory, stringio, base='', exclude=None, include=None):
'''
Helper to iterate over the files in a directory putting those in the passed StringIO in ini
format.
:param unicode directory:
The directory for which the hash should be done.
:param StringIO stringio:
... | 0.003084 |
def seat_slot(self):
"""The seat slot of the touch event.
A seat slot is a non-negative seat wide unique identifier of an active
touch point.
Events from single touch devices will be represented as one individual
touch point per device.
For events not of type :attr:`~libinput.constant.EventType.TOUCH_DOW... | 0.02551 |
def to_picard_basecalling_params(
self,
directory: Union[str, Path],
bam_prefix: Union[str, Path],
lanes: Union[int, List[int]],
) -> None:
"""Writes sample and library information to a set of files for a given
set of lanes.
**BARCODE PARAMETERS FILES**: Stor... | 0.000434 |
def clone(cls, srcpath, destpath):
"""Clone an existing repository to a new bare repository."""
# Mercurial will not create intermediate directories for clones.
try:
os.makedirs(destpath)
except OSError as e:
if not e.errno == errno.EEXIST:
raise
... | 0.004405 |
def cudnn_gru(units, n_hidden, n_layers=1, trainable_initial_states=False,
seq_lengths=None, input_initial_h=None, name='cudnn_gru', reuse=False):
""" Fast CuDNN GRU implementation
Args:
units: tf.Tensor with dimensions [B x T x F], where
B - batch size
T - number ... | 0.002064 |
def power_off(self, interval=200):
"""230v power off"""
if self.__power_off_port is None:
cij.err("cij.usb.relay: Invalid USB_RELAY_POWER_OFF")
return 1
return self.__press(self.__power_off_port, interval=interval) | 0.007605 |
def validate_version_argument(version, hint=4):
""" validate the version argument against the supported MDF versions. The
default version used depends on the hint MDF major revision
Parameters
----------
version : str
requested MDF version
hint : int
MDF revision hint
Retur... | 0.001068 |
def disconnect(self):
"""Disconnect from AWS IOT message broker
"""
if self.client is None:
return
try:
self.client.disconnect()
except operationError as exc:
raise InternalError("Could not disconnect from AWS IOT", message=exc.message) | 0.009554 |
def set_pubkey(self, pkey):
"""
Set the public key of the certificate signing request.
:param pkey: The public key to use.
:type pkey: :py:class:`PKey`
:return: ``None``
"""
set_result = _lib.X509_REQ_set_pubkey(self._req, pkey._pkey)
_openssl_assert(set... | 0.006006 |
def help_completion_options(self):
""" Return options of this command.
"""
for opt in self.parser.option_list:
for lopt in opt._long_opts:
yield lopt | 0.00995 |
def fit(self, trX, trY, batch_size=64, n_epochs=1, len_filter=LenFilter(), snapshot_freq=1, path=None):
"""Train model on given training examples and return the list of costs after each minibatch is processed.
Args:
trX (list) -- Inputs
trY (list) -- Outputs
batch_size (in... | 0.004915 |
def write(self):
"""
Write contents of cache to disk.
"""
io.debug("Storing cache '{0}'".format(self.path))
with open(self.path, "w") as file:
json.dump(self._data, file, sort_keys=True, indent=2,
separators=(',', ': ')) | 0.006803 |
def gen_mu(K, delta, c):
"""The Robust Soliton Distribution on the degree of
transmitted blocks
"""
S = c * log(K/delta) * sqrt(K)
tau = gen_tau(S, K, delta)
rho = gen_rho(K)
normalizer = sum(rho) + sum(tau)
return [(rho[d] + tau[d])/normalizer for d in range(K)] | 0.010067 |
def set_published(self, published):
"""Sets the published status.
arg: published (boolean): the published status
raise: NoAccess - ``Metadata.isReadOnly()`` is ``true``
*compliance: mandatory -- This method must be implemented.*
"""
# Implemented from template for o... | 0.005034 |
def alter_change_column(self, table, column, field):
"""Support change columns."""
ctx = self.make_context()
field_null, field.null = field.null, True
ctx = self._alter_table(ctx, table).literal(' ALTER COLUMN ').sql(field.ddl(ctx))
field.null = field_null
return ctx | 0.009524 |
def to_bigquery_field(self, name_case=DdlParseBase.NAME_CASE.original):
"""Generate BigQuery JSON field define"""
col_name = self.get_name(name_case)
mode = self.bigquery_mode
if self.array_dimensional <= 1:
# no or one dimensional array data type
type = self.bi... | 0.003289 |
def __potential_connection_failure(self, e):
""" OperationalError's are emitted by the _mysql library for
almost every error code emitted by MySQL. Because of this we
verify that the error is actually a connection error before
terminating the connection and firing off a PoolConnectionEx... | 0.003096 |
def save(self, *args, **kwargs):
"""If creating new instance, create profile on Authorize.NET also"""
data = kwargs.pop('data', {})
sync = kwargs.pop('sync', True)
if not self.id and sync:
self.push_to_server(data)
super(CustomerProfile, self).save(*args, **kwargs) | 0.006309 |
def build_signature_template(key_id, algorithm, headers):
"""
Build the Signature template for use with the Authorization header.
key_id is the mandatory label indicating to the server which secret to use
algorithm is one of the supported algorithms
headers is a list of http headers to be included ... | 0.00119 |
def variable(self, name: str, default_value=None):
"""
Safely returns the value of the variable given in PUM
Parameters
----------
name
the name of the variable
default_value
the default value for the variable if it does not exist
"""
... | 0.005376 |
def normalise_filled(self, meta, val):
"""Only care about valid image names"""
available = list(meta.everything["images"].keys())
val = sb.formatted(sb.string_spec(), formatter=MergedOptionStringFormatter).normalise(meta, val)
if val not in available:
raise BadConfiguration("... | 0.009852 |
def xross_listener(http_method=None, **xross_attrs):
"""Instructs xross to handle AJAX calls right from the moment it is called.
This should be placed in a view decorated with `@xross_view()`.
:param str http_method: GET or POST. To be used as a source of data for xross.
:param dict xross_attrs: xros... | 0.004615 |
def population_chart_header_element(feature, parent):
"""Retrieve population chart header string from definitions."""
_ = feature, parent # NOQA
header = population_chart_header['string_format']
return header.capitalize() | 0.004202 |
def hide_routemap_holder_route_map_content_set_weight_weight_value(self, **kwargs):
"""Auto Generated Code
"""
config = ET.Element("config")
hide_routemap_holder = ET.SubElement(config, "hide-routemap-holder", xmlns="urn:brocade.com:mgmt:brocade-ip-policy")
route_map = ET.SubElem... | 0.003883 |
def load_remote_system(url, format=None):
'''Load a system from the remote location specified by *url*.
**Example**
::
load_remote_system('https://raw.github.com/chemlab/chemlab-testdata/master/naclwater.gro')
'''
filename, headers = urlretrieve(url)
return load_system(filename, forma... | 0.00304 |
def get_input_peer(entity, allow_self=True, check_hash=True):
"""
Gets the input peer for the given "entity" (user, chat or channel).
A ``TypeError`` is raised if the given entity isn't a supported type
or if ``check_hash is True`` but the entity's ``access_hash is None``.
Note that ``check_hash``... | 0.00041 |
def plotRealImg(sim, cam, rawdata, t: int, odir: Path=None, fg=None):
"""
sim: histfeas/simclass.py
cam: camclass.py
rawdata: nframe x ny x nx ndarray
t: integer index to read
odir: output directory (where to write results)
plots both cameras together,
and magnetic zenith 1-D cut line
... | 0.001962 |
def write(self, pkt):
"""accepts a either a single packet or a list of packets
to be written to the dumpfile
"""
if not self.header_present:
self._write_header(pkt)
if isinstance(pkt, BasePacket):
self._write_packet(pkt)
else:
for p in pk... | 0.008333 |
def _initialize_providers(self):
"""Read config file and initialize providers"""
configured_providers = active_config.DATABASES
provider_objects = {}
if not isinstance(configured_providers, dict) or configured_providers == {}:
raise ConfigurationError(
"'DATA... | 0.005165 |
def _copy_stream_position(position):
"""Copy a StreamPosition.
Args:
position (Union[ \
dict, \
~google.cloud.bigquery_storage_v1beta1.types.StreamPosition \
]):
StreamPostion (or dictionary in StreamPosition format) to copy.
Returns:
~google.clo... | 0.001623 |
def _dqtoi(self, dq):
"""Convert dotquad or hextet to long."""
# hex notation
if dq.startswith('0x'):
return self._dqtoi_hex(dq)
# IPv6
if ':' in dq:
return self._dqtoi_ipv6(dq)
elif len(dq) == 32:
# Assume full heximal notation
... | 0.004032 |
def xlate(self, type):
"""
Get a (namespace) translated I{qualified} name for specified type.
@param type: A schema type.
@type type: I{suds.xsd.sxbasic.SchemaObject}
@return: A translated I{qualified} name.
@rtype: str
"""
resolved = type.resolve()
... | 0.00346 |
def restore_saved_local_scope(
self,
saved_variables,
args_mapping,
line_number
):
"""Restore the previously saved variables to their original values.
Args:
saved_variables(list[SavedVariable])
args_mapping(dict): A mapping of call argument to d... | 0.003386 |
def add(self, path, compress=None):
"""Add `path` to the MAR file.
If `path` is a file, it will be added directly.
If `path` is a directory, it will be traversed recursively and all
files inside will be added.
Args:
path (str): path to file or directory on disk to a... | 0.003503 |
def terminal(exec_='', background=False, shell_after_cmd_exec=False,
keep_open_after_cmd_exec=False, return_cmd=False):
'''Start the default terminal emulator.
Start the user's preferred terminal emulator, optionally running a command in it.
**Order of starting**
Windows:
Powershell
Mac:
- iTe... | 0.029053 |
def exec_notebook_daemon_command(self, name, cmd, port=0):
"""Run a daemon script command."""
cmd = self.get_notebook_daemon_command(name, cmd, port)
# Make all arguments explicit strings
cmd = [str(arg) for arg in cmd]
logger.info("Running notebook command: %s", " ".join(cmd))... | 0.004288 |
def _connect(self, key, spec, via=None):
"""
Actual connect implementation. Arranges for the Mitogen connection to
be created and enqueues an asynchronous call to start the forked task
parent in the remote context.
:param key:
Deduplication key representing the conne... | 0.001283 |
def _decrypt_object(obj, **kwargs):
'''
Recursively try to decrypt any object. If the object is a six.string_types
(string or unicode), and it contains a valid NACLENC pretext, decrypt it,
otherwise keep going until a string is found.
'''
if salt.utils.stringio.is_readable(obj):
return _... | 0.002203 |
def state_probabilities(alpha, beta, T=None, gamma_out=None):
""" Calculate the (T,N)-probabilty matrix for being in state i at time t.
Parameters
----------
alpha : ndarray((T,N), dtype = float), optional, default = None
alpha[t,i] is the ith forward coefficient of time t.
beta : ndarray((... | 0.001485 |
def _query(queue_name=None, build_id=None, release_id=None, run_id=None,
count=None):
"""Queries for work items based on their criteria.
Args:
queue_name: Optional queue name to restrict to.
build_id: Optional build ID to restrict to.
release_id: Optional release ID to restri... | 0.000998 |
def setdefault(self, key, val):
"""
set a default value for key
this is different than dict's setdefault because it will set default either
if the key doesn't exist, or if the value at the key evaluates to False, so
an empty string or a None value will also be updated
:... | 0.007067 |
def get_weights_fn(modality_type, value=None):
"""Gets default weights function; if none available, return value."""
if modality_type in (ModalityType.CTC_SYMBOL,
ModalityType.IDENTITY_SYMBOL,
ModalityType.MULTI_LABEL,
ModalityType.SYMBOL,
... | 0.009804 |
def _attach_module_identifier(command_dict, modulefn):
"""
Attaches a 'module': modulename entry to each node in the dictionary.
This is used by the help printer so that the user can tell if a command was
included by default or via a module.
"""
for command in command_dict:
command_dict[command]['modul... | 0.00978 |
def gramm_to_promille(gramm, age, weight, height, sex):
"""Return the blood alcohol content (per mill) for a person with the
given body stats and amount of alcohol (in gramm) in blood
"""
bw = calculate_bw(age, weight, height, sex)
return (gramm * W) / (PB * bw) | 0.014545 |
def download(self, callback=None):
"""
Downloads this resource from its URL to a file on the local system. This method should
only be invoked on a worker node after the node was setup for accessing resources via
prepareSystem().
"""
dirPath = self.localDirPath
if ... | 0.00653 |
def tag(self, tokens):
"""Return a list of (token, tag) tuples for a given list of tokens."""
if not self._loaded_model:
self.load(self.model)
tags = [None] * len(tokens)
norm = self._normalize(tokens)
length = len(norm)
# A set of allowed indexes for matches ... | 0.004715 |
def send(self):
"""Send this message to the controller."""
self._file.write(self.as_bytes())
self._file.write(b'\r\n') | 0.014085 |
def periodic(period, drain_timeout=_DEFAULT_DRAIN, reset_timeout=_DEFAULT_RESET, max_consecutive_attempts=_DEFAULT_ATTEMPTS):
"""Create a periodic consistent region configuration.
The IBM Streams runtime will trigger a drain and checkpoint
the region periodically at the time interval specified b... | 0.006565 |
def catch_factory(attr):
"""
Factory returning a catch function
"""
def _catch(s, *args, **kw):
"""
This is used to catch and process all calls.
"""
def process(value):
"""
return the actual value after processing
"""
if a... | 0.000954 |
async def _request(
self,
method: str,
url: str,
*,
headers: dict = None,
params: dict = None,
json: dict = None) -> dict:
"""Make a request against AirVisual."""
full_url = '{0}/{1}'.format(url, self.zip_code)
p... | 0.001887 |
def unsubscribe(self, callback_id):
"""Ask the hub to cancel the subscription for callback_id, then delete
it from the local database if successful.
"""
request = self.get_active_subscription(callback_id)
request['mode'] = 'unsubscribe'
self.subscribe_impl(callback_id, *... | 0.006079 |
def del_client(self, **kwargs):
"""
Registers a new client to the specified network.
Usage:
======= ===================================
Method URI
======= ===================================
DELETE /vtep/networks/{vni}/clients/{mac}
... | 0.001887 |
def getStormQuery(self, text):
'''
Parse storm query text and return a Query object.
'''
query = s_syntax.Parser(text).query()
query.init(self)
return query | 0.009804 |
def get_analyses(self):
"""Returns a list of analyses from the AR
"""
analyses = self.context.getAnalyses(full_objects=True)
return filter(self.is_analysis_attachment_allowed, analyses) | 0.009217 |
def parser_add(self, parser, prefix=''):
"""Add config to an :py:class:`argparse.ArgumentParser` object.
The parser’s :py:meth:`~argparse.ArgumentParser.add_argument`
method is called for each config item. The argument name is
constructed from the parent and item names, with a dot
... | 0.003279 |
def disable_glut(self):
"""Disable event loop integration with glut.
This sets PyOS_InputHook to NULL and set the display function to a
dummy one and set the timer to a dummy timer that will be triggered
very far in the future.
"""
import OpenGL.GLUT as glut # @Unresolv... | 0.003759 |
def get_table(self, schema_type):
"""Retrieve a SQLAlchemy table based on the supplied GraphQL schema type name."""
table_name = schema_type.lower()
if not self.has_table(table_name):
raise exceptions.GraphQLCompilationError(
'No Table found in SQLAlchemy metadata for... | 0.009479 |
def fast_sweep_time_evolution(Ep, epsilonp, gamma,
omega_level, rm, xi, theta,
semi_analytic=True,
file_name=None, return_code=False):
r"""Return a spectrum of time evolutions of the density matrix.
We test a basic two-le... | 0.001176 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.