text stringlengths 78 104k | score float64 0 0.18 |
|---|---|
def by_geopoint(self, lat, long, radius, term=None, num_biz_requested=None, category=None):
"""
Perform a Yelp Review Search based on a geopoint and radius tuple.
Args:
lat - geopoint latitude
long - geopoint longitude
radius - search radius (in miles... | 0.028451 |
def commit_or_abort(self, ctx, timeout=None, metadata=None,
credentials=None):
"""Runs commit or abort operation."""
return self.stub.CommitOrAbort(ctx, timeout=timeout, metadata=metadata,
credentials=credentials) | 0.010274 |
def regular_fragments(self):
"""
Iterates through the regular fragments in the list
(which are sorted).
:rtype: generator of (int, :class:`~aeneas.syncmap.SyncMapFragment`)
"""
for i, fragment in enumerate(self.__fragments):
if fragment.fragment_type == SyncM... | 0.005333 |
def human(self, size, base=1000, units=' kMGTZ'):
"""Convert the input ``size`` to human readable, short form."""
sign = '+' if size >= 0 else '-'
size = abs(size)
if size < 1000:
return '%s%d' % (sign, size)
for i, suffix in enumerate(units):
unit = 1000 ... | 0.00361 |
def service_command(name, command):
"""Run an init.d/upstart command."""
service_command_template = getattr(env, 'ARGYLE_SERVICE_COMMAND_TEMPLATE',
u'/etc/init.d/%(name)s %(command)s')
sudo(service_command_template % {'name': name,
... | 0.002841 |
def whoami(self):
"""
Return a Deferred which fires with a 2-tuple of (dotted quad ip, port
number).
"""
def cbWhoAmI(result):
return result['address']
return self.callRemote(WhoAmI).addCallback(cbWhoAmI) | 0.007576 |
def get_config(ini_path=None, rootdir=None):
""" Load configuration from INI.
:return Namespace:
"""
config = Namespace()
config.default_section = 'pylama'
if not ini_path:
path = get_default_config_file(rootdir)
if path:
config.read(path)
else:
config.... | 0.002833 |
def mark_alert_as_read(self, alert_id):
"""
Mark an alert as read.
:param alert_id: The ID of the alert to mark as read.
:return:
"""
req = self.url + "/api/alert/{}/markAsRead".format(alert_id)
try:
return requests.post(req, headers={'Content-Type': ... | 0.005725 |
def remove_api_gateway_logs(self, project_name):
"""
Removed all logs that are assigned to a given rest api id.
"""
for rest_api in self.get_rest_apis(project_name):
for stage in self.apigateway_client.get_stages(restApiId=rest_api['id'])['item']:
self.remove_... | 0.009804 |
def _get_link(self, cobj):
"""Get a valid link, False if not found"""
fname_idx = None
full_name = cobj['module_short'] + '.' + cobj['name']
if full_name in self._searchindex['objects']:
value = self._searchindex['objects'][full_name]
if isinstance(value, dict):
... | 0.000954 |
def list_folder(self, folder_id=None):
"""Request a list of files and folders in specified folder.
Note:
if folder_id is not provided, ``Home`` folder will be listed
Args:
folder_id (:obj:`str`, optional): id of the folder to be listed.
Returns:
dic... | 0.001655 |
def set_nodes_aggregation_flag(self, peak_current_branch_max):
""" Set Load Areas with too high demand to aggregated type.
Args
----
peak_current_branch_max: float
Max. allowed current for line/cable
"""
for lv_load_area in self.grid_district.lv_load_areas(... | 0.004545 |
def _send_to_address(self, address, data, timeout=10):
"""send data to *address* and *port* without verification of response.
"""
# Socket to talk to server
socket = get_context().socket(REQ)
try:
socket.setsockopt(LINGER, timeout * 1000)
if address.find("... | 0.002821 |
def _normal_model(self, beta):
""" Creates the structure of the model (model matrices, etc) for
a Normal family ARIMAX model.
Parameters
----------
beta : np.ndarray
Contains untransformed starting values for the latent variables
Returns
----------
... | 0.007391 |
def wrap(self, message):
"""
[MS-NLMP] v28.0 2016-07-14
3.4.6 GSS_WrapEx()
Emulates the GSS_Wrap() implementation to sign and seal messages if the correct flags
are set.
@param message: The message data that will be wrapped
@return message: The message that has ... | 0.004566 |
def aes_key(self, data):
"""
AES128 key to program into YubiKey.
Supply data as either a raw string, or a hexlified string prefixed by 'h:'.
The result, after any hex decoding, must be 16 bytes.
"""
old = self.key
if data:
new = self._decode_input_str... | 0.007722 |
def ledger_effects(self, ledger_id, cursor=None, order='asc', limit=10):
"""This endpoint represents all effects that occurred in the given
ledger.
`GET /ledgers/{id}/effects{?cursor,limit,order}
<https://www.stellar.org/developers/horizon/reference/endpoints/effects-for-ledger.html>`_
... | 0.00333 |
def community_names(name, communities=None):
'''
Manage the SNMP accepted community names and their permissions.
:param str communities: A dictionary of SNMP communities and permissions.
Example of usage:
.. code-block:: yaml
snmp-community-names:
win_snmp.community_names:
... | 0.001552 |
def _api_scrape(json_inp, ndx):
"""
Internal method to streamline the getting of data from the json
Args:
json_inp (json): json input from our caller
ndx (int): index where the data is located in the api
Returns:
If pandas is present:
DataFrame (pandas.DataFrame): d... | 0.000796 |
def resolve_redirects_if_needed(self, uri):
"""
substitute with final uri after 303 redirects (if it's a www location!)
:param uri:
:return:
"""
if type(uri) == type("string") or type(uri) == type(u"unicode"):
if uri.startswith("www."): # support for lazy pe... | 0.003866 |
def build_engine_session(connection: str,
echo: bool = False,
autoflush: Optional[bool] = None,
autocommit: Optional[bool] = None,
expire_on_commit: Optional[bool] = None,
scopefunc=None) -> Tupl... | 0.002836 |
def things_near(self, location, radius=None):
"Return all things within radius of location."
if radius is None: radius = self.perceptible_distance
radius2 = radius * radius
return [thing for thing in self.things
if distance2(location, thing.location) <= radius2] | 0.009677 |
def get_label(self, name):
"""Find the label by name."""
label_tag = self._find_label(name)
return _Label(label_tag.get('id'), label_tag.get('color'), label_tag.text) | 0.015789 |
def sendIq(self, entity):
"""
:type entity: IqProtocolEntity
"""
if entity.getType() == IqProtocolEntity.TYPE_SET and entity.getXmlns() == "w:m":
#media upload!
self._sendIq(entity, self.onRequestUploadSuccess, self.onRequestUploadError) | 0.017065 |
def percentage_of_reoccurring_datapoints_to_all_datapoints(x):
"""
Returns the percentage of unique values, that are present in the time series
more than once.
len(different values occurring more than once) / len(different values)
This means the percentage is normalized to the number of unique... | 0.002646 |
def start(st_reg_number):
"""Checks the number valiaty for the Paraiba state"""
#st_reg_number = str(st_reg_number)
weights = [9, 8, 7, 6, 5, 4, 3, 2]
digit_state_registration = st_reg_number[-1]
if len(st_reg_number) != 9:
return False
sum_total = 0
for i in range(0, 8):
... | 0.00361 |
def import_obj(cls, i_datasource, import_time=None):
"""Imports the datasource from the object to the database.
Metrics and columns and datasource will be overrided if exists.
This function can be used to import/export dashboards between multiple
superset instances. Audit metadata is... | 0.002103 |
def _refresh_html_home(self):
"""
Function to refresh the self._parent.html['home'] object
which provides the status if zones are scheduled to
start automatically (program_toggle).
"""
req = self._parent.client.get(HOME_ENDPOINT)
if req.status_code == 403:
... | 0.003802 |
def track_event(self, name: str, properties: Dict[str, object] = None,
measurements: Dict[str, object] = None) -> None:
"""
Send information about a single event that has occurred in the context of the application.
:param name: the data to associate to this event.
:... | 0.013746 |
def ref_file_from_bam(bam_file, data):
"""Subset a fasta input file to only a fraction of input contigs.
"""
new_ref = os.path.join(utils.safe_makedir(os.path.join(dd.get_work_dir(data), "inputs", "ref")),
"%s-subset.fa" % dd.get_genome_build(data))
if not utils.file_exists(ne... | 0.004817 |
def add_payment(self, payment):
"""
Function to add payments
@param payment: The payment dict
@raise exception: when payment is invalid
"""
if self.clean:
from text_unidecode import unidecode
payment['name'] = unidecode(payment['name'])[:70]
... | 0.00072 |
def addtoindex(self,norecurse=None):
"""Makes sure this element (and all subelements), are properly added to the index"""
if not norecurse: norecurse = (Word, Morpheme, Phoneme)
if self.id:
self.doc.index[self.id] = self
for e in self.data:
if all([not isinstance(... | 0.010504 |
def nodes(self, data=False, native=True):
"""
Returns a list of all nodes in the :class:`.GraphCollection`\.
Parameters
----------
data : bool
(default: False) If True, returns a list of 2-tuples containing
node labels and attributes.
Returns
... | 0.004747 |
def clear(self):
"""Convenience method to reset all the block values to 0
"""
if self._bit_count == 0:
return
block = self._qpart.document().begin()
while block.isValid():
if self.getBlockValue(block):
self.setBlockValue(block, 0)
... | 0.005814 |
def bces(x1, x2, x1err=[], x2err=[], cerr=[], logify=True, model='yx', \
bootstrap=5000, verbose='normal', full_output=True):
"""
Bivariate, Correlated Errors and intrinsic Scatter (BCES)
translated from the FORTRAN code by Christina Bird and Matthew Bershady
(Akritas & Bershady, 1996)
Lin... | 0.007834 |
def inherit_dict(base, namespace, attr_name,
inherit=lambda k, v: True):
"""
Perform inheritance of dictionaries. Returns a list of key
and value pairs for values that were inherited, for
post-processing.
:param base: The base class being considered; see
... | 0.001673 |
def _SID_call_prep(align_bams, items, ref_file, assoc_files, region=None, out_file=None):
"""Preparation work for SomaticIndelDetector.
"""
base_config = items[0]["config"]
for x in align_bams:
bam.index(x, base_config)
params = ["-R", ref_file, "-T", "SomaticIndelDetector", "-U", "ALLOW_N_... | 0.004409 |
def data_request(self, vehicle_id, name, wake_if_asleep=False):
"""Get requested data from vehicle_id.
Parameters
----------
vehicle_id : string
Identifier for the car on the owner-api endpoint. Confusingly it
is not the vehicle_id field for identifying the car a... | 0.001944 |
def numpart_qaoa(asset_list, A=1.0, minimizer_kwargs=None, steps=1):
"""
generate number partition driver and cost functions
:param asset_list: list to binary partition
:param A: (float) optional constant for level separation. Default=1.
:param minimizer_kwargs: Arguments for the QAOA minimizer
... | 0.002782 |
def split(self, split_dimension, cache_points):
"""!
@brief Split BANG-block into two new blocks in specified dimension.
@param[in] split_dimension (uint): Dimension where block should be split.
@param[in] cache_points (bool): If True then covered points are cached. Used for leaf b... | 0.007735 |
def _connect(cls, url, token, timeout, results, i, job_is_done_event=None):
""" Connects to the specified cls with url and token. Stores the connection
information to results[i] in a threadsafe way.
Arguments:
cls: the class which is responsible for establishing connection, basically it... | 0.004695 |
def get_update(self, z=None):
"""
Computes the new estimate based on measurement `z` and returns it
without altering the state of the filter.
Parameters
----------
z : (dim_z, 1): array_like
measurement for this update. z can be a scalar if dim_z is 1,
... | 0.001579 |
def configure(self, options, conf):
"""Configure plugin.
"""
self.conf = conf
# Disable if explicitly disabled, or if logging is
# configured via logging config file
if not options.logcapture or conf.loggingConfig:
self.enabled = False
self.logformat =... | 0.003344 |
def dataframe(self):
"""
Returns a pandas DataFrame containing all other class properties and
values. The index for the DataFrame is the string URI that is used to
instantiate the class, such as 'BOS201806070'.
"""
if self._away_runs is None and self._home_runs is None:
... | 0.000381 |
def set_plugin_filepaths(self, filepaths, except_blacklisted=True):
"""
Sets internal state to `filepaths`. Recommend passing
in absolute filepaths. Method will attempt to convert to
absolute paths if they are not already.
`filepaths` can be a single object or an iterable.
... | 0.003552 |
def _merge_command(run, full_result, results):
"""Merge a group of results from write commands into the full result.
"""
for offset, result in results:
affected = result.get("n", 0)
if run.op_type == _INSERT:
full_result["nInserted"] += affected
elif run.op_type == _DE... | 0.000436 |
def query_db_reference():
"""
Returns list of cross references by query parameters
---
tags:
- Query functions
parameters:
- name: type_
in: query
type: string
required: false
description: Reference type
default: EMBL
- name: identifier
... | 0.00103 |
def show_order_parameter(sync_output_dynamic, start_iteration = None, stop_iteration = None):
"""!
@brief Shows evolution of order parameter (level of global synchronization in the network).
@param[in] sync_output_dynamic (sync_dynamic): Output dynamic of the Sync network whose evol... | 0.02294 |
def getRaw(self, instance, **kwargs):
"""Returns raw field value (possible wrapped in BaseUnit)
"""
value = ObjectField.get(self, instance, **kwargs)
# getattr(instance, "Remarks") returns a BaseUnit
if callable(value):
value = value()
return value | 0.006494 |
def users_lookupByEmail(self, *, email: str, **kwargs) -> SlackResponse:
"""Find a user with an email address.
Args:
email (str): An email address belonging to a user in the workspace.
e.g. 'spengler@ghostbusters.example.com'
"""
kwargs.update({"email": email... | 0.007389 |
def determine_hooks(self, controller=None):
'''
Determines the hooks to be run, in which order.
:param controller: If specified, includes hooks for a specific
controller.
'''
controller_hooks = []
if controller:
controller_hooks = ... | 0.003175 |
def ExpireRules(self):
"""Removes any rules with an expiration date in the past."""
rules = self.Get(self.Schema.RULES)
new_rules = self.Schema.RULES()
now = time.time() * 1e6
expired_session_ids = set()
for rule in rules:
if rule.expires > now:
new_rules.Append(rule)
else:
... | 0.007353 |
def _get_synset_offsets(synset_idxes):
"""Returs pointer offset in the WordNet file for every synset index.
Notes
-----
Internal function. Do not call directly.
Preserves order -- for [x,y,z] returns [offset(x),offset(y),offset(z)].
Parameters
----------
synset_idxes : list of ints
... | 0.00578 |
def _set_i2c_speed(self, i2c_speed):
""" Set I2C speed to one of '400kHz', '100kHz', 50kHz', '5kHz'
"""
lower_bits_mapping = {
'400kHz': 3,
'100kHz': 2,
'50kHz': 1,
'5kHz': 0,
}
if i2c_speed not in lower_bits_mapping:
ra... | 0.004724 |
def _load_json_file(json_file):
""" load json file and check file content format
"""
with io.open(json_file, encoding='utf-8') as data_file:
try:
json_content = json.load(data_file)
except p_exception.JSONDecodeError:
err_msg = u"JSO... | 0.005597 |
def extended_cigar(aligned_template, aligned_query):
''' Convert mutation annotations to extended cigar format
https://github.com/lh3/minimap2#the-cs-optional-tag
USAGE:
>>> template = 'CGATCGATAAATAGAGTAG---GAATAGCA'
>>> query = 'CGATCG---AATAGAGTAGGTCGAATtGCA'
>>> extended_cigar(tem... | 0.029308 |
def _summarize_pscore(self, pscore_c, pscore_t):
"""
Called by Strata class during initialization.
"""
self._dict['p_min'] = min(pscore_c.min(), pscore_t.min())
self._dict['p_max'] = max(pscore_c.max(), pscore_t.max())
self._dict['p_c_mean'] = pscore_c.mean()
self._dict['p_t_mean'] = pscore_t.mean() | 0.028481 |
def _bias_add(x, b, data_format):
"""Alternative implementation of tf.nn.bias_add which is compatiable with tensorRT."""
if data_format == 'NHWC':
return tf.add(x, b)
elif data_format == 'NCHW':
return tf.add(x, _to_channel_first_bias(b))
else:
raise ValueError('invalid data_form... | 0.005848 |
def enumerateAll(self, subsectionTitle, lst, openFile):
'''
Helper function for :func:`~exhale.graph.ExhaleRoot.generateUnabridgedAPI`.
Simply writes a subsection to ``openFile`` (a ``toctree`` to the ``file_name``)
of each ExhaleNode in ``sorted(lst)`` if ``len(lst) > 0``. Otherwise, n... | 0.005762 |
def read(self, istream, kmip_version=enums.KMIPVersion.KMIP_1_0):
"""
Read the data encoding the ExtensionInformation object and decode it
into its constituent parts.
Args:
istream (Stream): A data stream containing encoded object data,
supporting a read meth... | 0.001637 |
def fn_x(i, dfs_data):
"""The minimum vertex (DFS-number) in a frond contained in Ri."""
try:
return R(i, dfs_data)['x']
except Exception as e:
# Page 17 states that if Ri is empty, then we take xi to be n
return dfs_data['graph'].num_nodes() | 0.003597 |
def port_profile_qos_profile_qos_trust_trust_cos(self, **kwargs):
"""Auto Generated Code
"""
config = ET.Element("config")
port_profile = ET.SubElement(config, "port-profile", xmlns="urn:brocade.com:mgmt:brocade-port-profile")
name_key = ET.SubElement(port_profile, "name")
... | 0.004559 |
def build_y(self):
"""Build transmission line admittance matrix into self.Y"""
if not self.n:
return
self.y1 = mul(self.u, self.g1 + self.b1 * 1j)
self.y2 = mul(self.u, self.g2 + self.b2 * 1j)
self.y12 = div(self.u, self.r + self.x * 1j)
self.m = polar(self.ta... | 0.002141 |
def block_view(self, mri):
# type: (str) -> Block
"""Get a view of a block
Args:
mri: The mri of the controller hosting the block
Returns:
Block: The block we control
"""
controller = self.get_controller(mri)
block = controller.block_view... | 0.008287 |
def _openFile(self):
""" Open the HDF5 file for reading/writing.
This methad is called during the initialization of this class.
"""
if self.filename is not None:
self.h5 = h5py.File(self.filename)
else:
return
if 'bp' not in self.h5:
... | 0.001984 |
def sort_projects(
self,
workflowTags):
"""*order the projects within this taskpaper object via a list of tags*
The order of the tags in the list dictates the order of the sort - first comes first*
**Key Arguments:**
- ``workflowTags`` -- a string of space/... | 0.003067 |
def element_data_from_name(name):
'''Obtain elemental data given an elemental name
The given name is not case sensitive
An exception is thrown if the name is not found
'''
name_lower = name.lower()
if name_lower not in _element_name_map:
raise KeyError('No element data for name \'{}\'... | 0.00266 |
def register(self,obj,cls=type(None),hist={}):
"""
Takes a FortranObject and adds it to the appropriate list, if
not already present.
"""
#~ ident = getattr(obj,'ident',obj)
if is_submodule(obj,cls):
if obj not in self.submodules: self.submodules[obj] = Submod... | 0.030461 |
def _analyze_function_features(self, all_funcs_completed=False):
"""
For each function in the function_manager, try to determine if it returns or not. A function does not return if
it calls another function that is known to be not returning, and this function does not have other exits.
... | 0.004259 |
def get_table_idcb_field(endianess, data):
"""
Return data from a packed TABLE_IDC_BFLD bit-field.
:param str endianess: The endianess to use when packing values ('>' or '<')
:param str data: The packed and machine-formatted data to parse
:rtype: tuple
:return: Tuple of (proc_nbr, std_vs_mfg, proc_flag, flag1, f... | 0.025723 |
async def _check_resolver_ans(
self, dns_answer_list, record_name,
record_data_list, record_ttl, record_type_code):
"""Check if resolver answer is equal to record data.
Args:
dns_answer_list (list): DNS answer list contains record objects.
record_name (st... | 0.001461 |
def ystep(self):
r"""Minimise Augmented Lagrangian with respect to
:math:`\mathbf{y}`.
"""
self.Y = np.asarray(sp.prox_l1(self.S - self.AX - self.U,
self.lmbda/self.rho), dtype=self.dtype) | 0.007692 |
def emit( self, record ):
"""
Throws an error based on the information that the logger reported,
given the logging level.
:param record | <logging.LogRecord>
"""
msg = self._formatter.format(record)
align = self._splash.textAlignment()
fg ... | 0.022113 |
def _tr_magic(line_info):
"Translate lines escaped with: %"
tpl = '%sget_ipython().magic(%r)'
cmd = ' '.join([line_info.ifun, line_info.the_rest]).strip()
return tpl % (line_info.pre, cmd) | 0.009091 |
def to_timezone(dt, timezone):
"""
Return an aware datetime which is ``dt`` converted to ``timezone``.
If ``dt`` is naive, it is assumed to be UTC.
For example, if ``dt`` is "06:00 UTC+0000" and ``timezone`` is "EDT-0400",
then the result will be "02:00 EDT-0400".
This method follows the guid... | 0.002066 |
def get_rsa_pub_key(path):
'''
Read a public key off the disk.
'''
log.debug('salt.crypt.get_rsa_pub_key: Loading public key')
if HAS_M2:
with salt.utils.files.fopen(path, 'rb') as f:
data = f.read().replace(b'RSA ', b'')
bio = BIO.MemoryBuffer(data)
key = RSA.loa... | 0.002208 |
def identify(mw_uri, consumer_token, access_token, leeway=10.0,
user_agent=defaults.USER_AGENT):
"""
Gather identifying information about a user via an authorized token.
:Parameters:
mw_uri : `str`
The base URI of the MediaWiki installation. Note that the URI
s... | 0.00089 |
def get_rank(self, entity, criteria, condition = True):
"""
Get the rank of a person within an entity according to a criteria.
The person with rank 0 has the minimum value of criteria.
If condition is specified, then the persons who don't respect it are not taken into account and their r... | 0.006281 |
def nvmlDeviceGetRetiredPagesPendingStatus(device):
r"""
/**
* Check if any pages are pending retirement and need a reboot to fully retire.
*
* For Kepler &tm; or newer fully supported devices.
*
* @param device The identifier of the target device
* @para... | 0.006988 |
def prepare_response_header(origin_header, segment):
"""
Prepare a trace header to be inserted into response
based on original header and the request segment.
"""
if origin_header and origin_header.sampled == '?':
new_header = TraceHeader(root=segment.trace_id,
... | 0.002212 |
def present(profile='pagerduty', subdomain=None, api_key=None, **kwargs):
'''
Ensure that a pagerduty escalation policy exists. Will create or update as needed.
This method accepts as args everything defined in
https://developer.pagerduty.com/documentation/rest/escalation_policies/create.
In addit... | 0.003347 |
def move_in_stack(move_up):
'''Move up or down the stack (for the py-up/py-down command)'''
frame = Frame.get_selected_python_frame()
while frame:
if move_up:
iter_frame = frame.older()
else:
iter_frame = frame.newer()
if not iter_frame:
break
... | 0.00157 |
def load_dataset_items(test_file, predict_file_lst, nonfeature_file):
"""
This function is used to read 3 kinds of data into list, 3 kinds of data are stored in files given by parameter
:param test_file: path string, the testing set used for SVm rank
:param predict_file_lst: filename lst, all predic... | 0.002371 |
def _add_column(self, type, name, **parameters):
"""
Add a new column to the blueprint.
:param type: The column type
:type type: str
:param name: The column name
:type name: str
:param parameters: The column parameters
:type parameters: dict
:r... | 0.003752 |
def Main():
"""The main program function.
Returns:
bool: True if successful or False if not.
"""
argument_parser = argparse.ArgumentParser(description=(
'Plots memory usage from profiling data.'))
argument_parser.add_argument(
'--output', dest='output_file', type=str, help=(
'path ... | 0.011229 |
def so4_to_magic_su2s(
mat: np.ndarray,
*,
rtol: float = 1e-5,
atol: float = 1e-8,
check_preconditions: bool = True
) -> Tuple[np.ndarray, np.ndarray]:
"""Finds 2x2 special-unitaries A, B where mat = Mag.H @ kron(A, B) @ Mag.
Mag is the magic basis matrix:
1 0 ... | 0.000804 |
def OR(*fns):
""" Validate with any of the chainable valdator functions """
if len(fns) < 2:
raise TypeError('At least two functions must be passed')
@chainable
def validator(v):
for fn in fns:
last = None
try:
return fn(v)
except Valu... | 0.00237 |
def get_by_params(self, params: [Scope]) -> (Scope, [[Scope]]):
""" Retrieve a Set of all signature that match the parameter list.
Return a pair:
pair[0] the overloads for the functions
pair[1] the overloads for the parameters
(a list of candidate list of paramet... | 0.000407 |
def get_joined_filters(self, filters):
"""
Creates a new filters class with active filters joined
"""
retfilters = Filters(self.filter_converter, self.datamodel)
retfilters.filters = self.filters + filters.filters
retfilters.values = self.values + filters.values
... | 0.005882 |
def define_haystack_units():
"""
Missing units found in project-haystack
Added to the registry
"""
ureg = UnitRegistry()
ureg.define('% = [] = percent')
ureg.define('pixel = [] = px = dot = picture_element = pel')
ureg.define('decibel = [] = dB')
ureg.define('ppu = [] = parts_per_uni... | 0.001385 |
def _zbufcountlines(filename, gzipped):
""" faster line counter """
if gzipped:
cmd1 = ["gunzip", "-c", filename]
else:
cmd1 = ["cat", filename]
cmd2 = ["wc"]
proc1 = sps.Popen(cmd1, stdout=sps.PIPE, stderr=sps.PIPE)
proc2 = sps.Popen(cmd2, stdin=proc1.stdout, stdout=sps.PIPE, s... | 0.003724 |
def matlab_formatter(level, vertices, codes=None):
"""`MATLAB`_ style contour formatter.
Contours are returned as a single Nx2, `MATLAB`_ style, contour array.
There are two types of rows in this format:
* Header: The first element of a header row is the level of the contour
(the lower level for... | 0.00058 |
def _ParseRedirected(
self, parser_mediator, msiecf_item, recovered=False):
"""Extract data from a MSIE Cache Files (MSIECF) redirected item.
Every item is stored as an event object, one for each timestamp.
Args:
parser_mediator (ParserMediator): mediates interactions between parsers
... | 0.001096 |
def get_query_tokens(query):
"""
:type query str
:rtype: list[sqlparse.sql.Token]
"""
query = preprocess_query(query)
parsed = sqlparse.parse(query)
# handle empty queries (#12)
if not parsed:
return []
tokens = TokenList(parsed[0].tokens).flatten()
# print([(token.valu... | 0.002326 |
async def send_data(self, data, addr):
"""
Send data to a remote host via the TURN server.
"""
channel = self.peer_to_channel.get(addr)
if channel is None:
channel = self.channel_number
self.channel_number += 1
self.channel_to_peer[channel] = a... | 0.00369 |
def video_top(body_output, targets, model_hparams, vocab_size):
"""Top transformation for video."""
del targets # unused arg
num_channels = model_hparams.problem.num_channels
shape = common_layers.shape_list(body_output)
reshape_shape = shape[:-1] + [num_channels, vocab_size]
res = tf.reshape(body_output, ... | 0.020583 |
def p40baro(msg):
"""Barometric pressure setting
Args:
msg (String): 28 bytes hexadecimal message (BDS40) string
Returns:
float: pressure in millibar
"""
d = hex2bin(data(msg))
if d[26] == '0':
return None
p = bin2int(d[27:39]) * 0.1 + 800 # millibar
return... | 0.003106 |
def add(self, coro, args=(), kwargs={}, first=True):
"""Add a coroutine in the scheduler. You can add arguments
(_args_, _kwargs_) to init the coroutine with."""
assert callable(coro), "'%s' not a callable object" % coro
coro = coro(*args, **kwargs)
if first:
se... | 0.013636 |
def identify(self, text, **kwargs):
"""
Identify language.
Identifies the language of the input text.
:param str text: Input text in UTF-8 format.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers a... | 0.002885 |
def GetStars(campaign, module, model='nPLD', **kwargs):
'''
Returns de-trended light curves for all stars on a given module in
a given campaign.
'''
# Get the channel numbers
channels = Channels(module)
assert channels is not None, "No channels available on this module."
# Get the EPI... | 0.00095 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.