text stringlengths 78 104k | score float64 0 0.18 |
|---|---|
def clean_title(self, title):
"""Clean title with the use of og:site_name
in this case try to get rid of site name
and use TITLE_SPLITTERS to reformat title
"""
# check if we have the site name in opengraph data
if "site_name" in list(self.article.opengraph.keys()):
... | 0.001151 |
def prompt_choices(name, choices, default=None, no_choice=('none',)):
"""
Grabs user input from command line from set of provided choices.
:param name: prompt text
:param choices: list or tuple of available choices.
:param default: default value if no input provided.
:param no_choice: acceptabl... | 0.001427 |
def handleMethodCallMessage(self, msg):
"""
Handles DBus MethodCall messages on behalf of the DBus Connection and
dispatches them to the appropriate exported object
"""
if (
msg.interface == 'org.freedesktop.DBus.Peer'
and msg.member == 'Ping'
):
... | 0.000416 |
def dissociate_values_or_ranges(self, vlan_id_range):
"""
Build a list of vlan ids given a combination of ranges and/or values
Examples:
>>> enet.dissociate_values_or_ranges('1-2,5')
[1, 2, 5]
>>> enet.dissociate_values_or_ranges('5')
[1,... | 0.00303 |
def msg_curse(self, args=None, max_width=10):
"""Return the list to display in the UI."""
# Init the return message
ret = []
# Only process if stats exist...
if not self.stats or self.is_disable():
return ret
# Define the data: Bar (default behavor) or Spark... | 0.002936 |
def quit(self):
"""Close threads and socket."""
# stop all threads and close the socket
self.receive_thread.stopped = True
# self.receive_thread._Thread__stop()
self.message_thread.stopped = True
# self.message_thread._Thread__stop()
# self.ping_thread.... | 0.003466 |
def connect(command, data=None, env=None, cwd=None):
"""Spawns a new process from the given command."""
# TODO: support piped commands
command_str = expand_args(command).pop()
environ = dict(os.environ)
environ.update(env or {})
process = subprocess.Popen(command_str,
universal_newline... | 0.018116 |
def export_graphviz(self, fade_nodes=None):
"""Returns a string, Graphviz script for visualizing the program.
Parameters
----------
fade_nodes : list, optional
A list of node indices to fade out for showing which were removed
during evolution.
Returns
... | 0.000846 |
def promote_pipeline(conf, args):
"""Export a pipeline from a lower environment and import into higher environment."""
src = conf.config['instances'][args.src_instance]
src_url = api.build_pipeline_url(build_instance_url(src))
src_auth = tuple([conf.creds['instances'][args.src_instance]['user'], conf.cr... | 0.005145 |
def get_input_files(oqparam, hazard=False):
"""
:param oqparam: an OqParam instance
:param hazard: if True, consider only the hazard files
:returns: input path names in a specific order
"""
fnames = [] # files entering in the checksum
for key in oqparam.inputs:
fname = oqparam.input... | 0.000511 |
def generate_video(source, outname, settings, options=None):
"""Video processor.
:param source: path to a video
:param outname: path to the generated video
:param settings: settings dict
:param options: array of options passed to ffmpeg
"""
logger = logging.getLogger(__name__)
# Don't... | 0.00055 |
def avl_rotate_double(root, direction):
"""
Double rotation, either 0 (left) or 1 (right).
Figure:
c,1 (right)
----------->
a a c
/ b,0 / a,1 / \
b ---> b --> b a
\ ... | 0.003906 |
def object_from_json(self, object_type, object_json, parent=None):
"""
Given a blob of JSON representing a Zenpy object, recursively deserialize it and
any nested objects it contains. This method also adds the deserialized object
to the relevant cache if applicable.
"""
... | 0.003717 |
def create_graph_from_data(self, data):
"""Use CGNN to create a graph from scratch. All the possible structures
are tested, which leads to a super exponential complexity. It would be
preferable to start from a graph skeleton for large graphs.
Args:
data (pandas.DataFrame): O... | 0.005358 |
def expect_column_values_to_be_between(self,
column,
min_value=None,
max_value=None,
allow_cross_type_comparisons=None,
... | 0.007982 |
def plot_gross_leverage(returns, positions, ax=None, **kwargs):
"""
Plots gross leverage versus date.
Gross leverage is the sum of long and short exposure per share
divided by net asset value.
Parameters
----------
returns : pd.Series
Daily returns of the strategy, noncumulative.
... | 0.00095 |
def ip_address(value,
allow_empty = False,
**kwargs):
"""Validate that ``value`` is a valid IP address.
.. note::
First, the validator will check if the address is a valid IPv6 address.
If that doesn't work, the validator will check if the address is a valid
IPv... | 0.006693 |
def profile_settings_validations(self):
"""Create 2 default validations rules for each output variable.
* One validation rule to check that the output variable is not null.
* One validation rule to ensure the output value is of the correct type.
"""
ij = self.load_install_json(... | 0.002789 |
def cbpdnmd_xstep(k):
"""Do the X step of the cbpdn stage. The only parameter is the slice
index `k` and there are no return values; all inputs and outputs are
from and to global variables.
"""
YU0 = mp_Z_Y0[k] + mp_S[k] - mp_Z_U0[k]
YU1 = mp_Z_Y1[k] - mp_Z_U1[k]
if mp_cri.Cd == 1:
... | 0.002331 |
def get_portchannel_info_by_intf_output_lacp_actor_brcd_state(self, **kwargs):
"""Auto Generated Code
"""
config = ET.Element("config")
get_portchannel_info_by_intf = ET.Element("get_portchannel_info_by_intf")
config = get_portchannel_info_by_intf
output = ET.SubElement(g... | 0.004808 |
def rfecv(model, X, y, ax=None, step=1, groups=None, cv=None,
scoring=None, **kwargs):
"""
Performs recursive feature elimination with cross-validation to determine
an optimal number of features for a model. Visualizes the feature subsets
with respect to the cross-validation score.
This h... | 0.000657 |
def main(args):
"""
Main function - launches the program
"""
if args:
if not args.outputRepository:
HOME_DIR = os.path.expanduser('~')
# Utility's base directory
BASE_DIR = os.path.abspath(os.path.dirname(__file__))
DOWNLOAD_DIR = HOME_DI... | 0.010463 |
def atlas_init_peer_info( peer_table, peer_hostport, blacklisted=False, whitelisted=False ):
"""
Initialize peer info table entry
"""
peer_table[peer_hostport] = {
"time": [],
"zonefile_inv": "",
"blacklisted": blacklisted,
"whitelisted": whitelisted
} | 0.013158 |
def isOpeningTag(self):
"""
Detect whether this tag is opening or not.
Returns:
bool: True if it is opening.
"""
if self.isTag() and \
not self.isComment() and \
not self.isEndTag() and \
not self.isNonPairTag():
return Tr... | 0.005814 |
def check_model(self):
"""
Check the model for various errors. This method checks for the following
errors.
* Checks if factors are defined for all the cliques or not.
* Check for running intersection property is not done explicitly over
here as it done in the add_edge... | 0.006152 |
def refresh_information(self, accept=MEDIA_TYPE_TAXII_V20):
"""Update the properties of this API Root.
This invokes the ``Get API Root Information`` endpoint.
"""
response = self.__raw = self._conn.get(self.url,
headers={"Accept": accept})
... | 0.004988 |
def _salt_send_domain_event(opaque, conn, domain, event, event_data):
'''
Helper function send a salt event for a libvirt domain.
:param opaque: the opaque data that is passed to the callback.
This is a dict with 'prefix', 'object' and 'event' keys.
:param conn: libvirt connection
... | 0.001377 |
def get_fallback_language(self, language_code=None, site_id=None):
"""
Find out what the fallback language is for a given language choice.
.. deprecated:: 1.5
Use :func:`get_fallback_languages` instead.
"""
choices = self.get_active_choices(language_code, site_id=site... | 0.004601 |
def tag(self, querystring, tags, afterwards=None, remove_rest=False):
"""
add tags to messages matching `querystring`.
This appends a tag operation to the write queue and raises
:exc:`~errors.DatabaseROError` if in read only mode.
:param querystring: notmuch search string
... | 0.001699 |
def pluralize(word, count=None, format=u'{word}'):
"""
Converts the inputted word to the plural form of it. This method works
best if you use the inflect module, as it will just pass along the
request to inflect.plural If you do not have that module, then a simpler
and less impressive pluralizatio... | 0.002831 |
def moduleInfo( module ):
"""
Generates HTML information to display for the about info for a module.
:param module | <module>
"""
data = module.__dict__
html = []
html.append( '<h2>%s</h2>' % data.get('__name__', 'Unknown') )
html.a... | 0.027379 |
def forwards(self, orm):
"Write your forwards methods here."
fields = orm['avocado.DataField'].objects.filter(app_name='variants',
model_name='evs', field_name__in=('all_maf', 'aa_maf', 'ea_maf'))
for f in fields:
f.field_name = f.field_name.replace('maf', 'af')
... | 0.009063 |
def intersects(self, other):
"""
Returns True if there exists a segmentlist in self that
intersects the corresponding segmentlist in other; returns
False otherwise.
See also:
.intersects_all(), .all_intersects(), .all_intersects_all()
"""
return any(key in self and self[key].intersects(value) for key... | 0.031519 |
def remove_manager(self, manager):
"""
Remove a single manager to the scope.
:param manager: single username to be added to the scope list of managers
:type manager: basestring
:raises APIError: when unable to update the scope manager
"""
select_action = 'remove_... | 0.009238 |
def setup(self):
"""When subclassing remember to call SubtitleChangeCommand::setup() to perform generic
checks."""
if not isinstance(self.filePath, str):
raise TypeError("File path is not a string!")
if self.controller is None:
raise ValueError("Command controller... | 0.008696 |
def get_ssh_key(self, ssh_key_id):
"""
Return a SSHKey object by its ID.
"""
return SSHKey.get_object(api_token=self.token, ssh_key_id=ssh_key_id) | 0.010989 |
def _repr_html_(self):
"""
Jupyter Notebook magic repr function.
"""
rows, c = '', ''
s = '<tr><td><strong>{k}</strong></td><td style="{stl}">{v}</td></tr>'
for k, v in self.__dict__.items():
if k == '_colour':
k = 'colour'
c =... | 0.002538 |
def cancel_bbuild(self, build_execution_configuration_id, **kwargs):
"""
Cancel the build execution defined with given executionConfigurationId.
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please define a `callback` function
... | 0.00549 |
def ssh_check_mech(self, desired_mech):
"""
Check if the given OID is the Kerberos V5 OID (server mode).
:param str desired_mech: The desired GSS-API mechanism of the client
:return: ``True`` if the given OID is supported, otherwise C{False}
"""
from pyasn1.codec.der imp... | 0.004246 |
def resetPassword(self, email=True):
"""
resets a users password for an account. The password will be randomly
generated and emailed by the system.
Input:
email - boolean that an email password will be sent to the
user's profile email address. The default... | 0.011034 |
def publication_history(self):
"""List of tuples of authored publications in the form
(title, abbreviation, type, issn), where issn is only given
for journals. abbreviation and issn may be None.
"""
pub_hist = self.xml.findall('author-profile/journal-history/')
hist = []... | 0.004178 |
def heatmaps_to_keypoints(maps, rois):
"""Extract predicted keypoint locations from heatmaps. Output has shape
(#rois, 4, #keypoints) with the 4 rows corresponding to (x, y, logit, prob)
for each keypoint.
"""
# This function converts a discrete image coordinate in a HEATMAP_SIZE x
# HEATMAP_SIZ... | 0.00083 |
def get_host_advanced(name=None, ipv4addr=None, mac=None, **api_opts):
'''
Get all host information
CLI Example:
.. code-block:: bash
salt-call infoblox.get_host_advanced hostname.domain.ca
'''
infoblox = _get_infoblox(**api_opts)
host = infoblox.get_host_advanced(name=name, mac=m... | 0.002793 |
def all_pairs(seq1, seq2=None):
"""Yields all pairs drawn from ``seq1`` and ``seq2``.
If ``seq2`` is ``None``, ``seq2 = seq1``.
>>> stop_at.ed(all_pairs(xrange(100000), xrange(100000)), 8)
((0, 0), (0, 1), (0, 2), (0, 3), (0, 4), (0, 5), (0, 6), (0, 7))
"""
if seq2 is None: seq2 = seq1... | 0.004963 |
def find(self, nameFilter=None, typeFilter=None, bindingModeFilter=None, boundFilter=None):
"""
Gets the list of services that the Watson IoT Platform can connect to.
The list can include a mixture of services that are either bound or unbound.
Parameters:
-... | 0.00945 |
def get_run_events(cls, crawler, run_id, start, end, level=None):
"""Events from a particular run"""
key = make_key(crawler, "events", run_id, level)
return cls.event_list(key, start, end) | 0.009434 |
def call(self, items, additional_fields, shape):
"""
Returns all items in an account that correspond to a list of ID's, in stable order.
:param items: a list of (id, changekey) tuples or Item objects
:param additional_fields: the extra fields that should be returned with the item, as Fi... | 0.006211 |
def get_client(self, service, region, public=True, cached=True,
client_class=None):
"""
Returns the client object for the specified service and region.
By default the public endpoint is used. If you wish to work with a
services internal endpoints, specify `public=False`.
... | 0.004983 |
def forestplot(trace_obj, vars=None, alpha=0.05, quartiles=True, rhat=True,
main=None, xtitle=None, xrange=None, ylabels=None, chain_spacing=0.05, vline=0):
""" Forest plot (model summary plot)
Generates a "forest plot" of 100*(1-alpha)% credible intervals for either the
set of variables in ... | 0.00086 |
def get(self, log_set):
"""
Get a specific log or log set
:param log_set: The log set or log to get. Ex: `.get(log_set='app')` or
`.get(log_set='app/log')`
:type log_set: str
:returns: The response of your log set or log
:rtype: dict
:raises: This w... | 0.002833 |
def setup(app) -> Dict[str, Any]:
"""
Sets up Sphinx extension.
"""
app.add_config_value("uqbar_api_directory_name", "api", "env")
app.add_config_value("uqbar_api_document_empty_modules", False, "env")
app.add_config_value("uqbar_api_document_private_members", False, "env")
app.add_config_va... | 0.001104 |
def _compose_mro(cls, types): # noqa
"""Calculates the method resolution order for a given class *cls*.
Includes relevant abstract base classes (with their respective bases) from
the *types* iterable. Uses a modified C3 linearization algorithm.
"""
bases = set(cls.__mro__)
# Remove entries w... | 0.000607 |
def arktimestamp(arkt, forfilename=False):
"""Returns a human-readable timestamp given an Ark timestamp 'arct'.
An Ark timestamp is the number of seconds since Genesis block,
2017:03:21 15:55:44."""
t = arkt + time.mktime((2017, 3, 21, 15, 55, 44, 0, 0, 0))
return '%d %s' % (arkt, timestamp(t)) | 0.003165 |
def to_bitarray(data, width=8):
''' Convert data (list of integers, bytearray or integer) to bitarray '''
if isinstance(data, list) or isinstance(data, bytearray):
data = combine_hex(data)
return [True if digit == '1' else False for digit in bin(data)[2:].zfill(width)] | 0.00692 |
def get_driver(browser='firefox', args=None):
"""
:param browser:
:param args:
:rtype: RemoteDriver
:return:
"""
if browser not in BROWSER_MAPPING.keys():
raise RuntimeError("unknown browser %s. allowed: %s" % (browser, ", ".join(BROWSER_MAPPING.keys())))
driver_cls = BROWSER_MAP... | 0.003115 |
def make_image(self, conf, images, chain=None, parent_chain=None, made=None, ignore_deps=False, ignore_parent=False, pushing=False):
"""Make us an image"""
made = {} if made is None else made
chain = [] if chain is None else chain
parent_chain = [] if parent_chain is None else parent_cha... | 0.004746 |
def get_lang_array(self):
"""gets supported langs as an array"""
r = self.yandex_translate_request("getLangs", "")
self.handle_errors(r)
return r.json()["dirs"] | 0.010309 |
def add_ip_scope(name, description, auth, url, startip=None, endip=None, network_address=None):
"""
Function takes input of four strings Start Ip, endIp, name, and description to add new Ip Scope
to terminal access in the HPE IMC base platform
:param name: str Name of the owner of this IP scope ex. 'a... | 0.00345 |
def _set_properties(self, api_response):
"""Update properties from resource in body of ``api_response``
:type api_response: dict
:param api_response: response returned from an API call
"""
cleaned = api_response.copy()
self._scrub_local_properties(cleaned)
stati... | 0.002222 |
def applyslicer(array, slicer, pmask, cval = 0):
r"""
Apply a slicer returned by the iterator to a new array of the same
dimensionality as the one used to initialize the iterator.
Notes
-----
If ``array`` has more dimensions than ``slicer`` and ``pmask``, the fir... | 0.010381 |
def SaveState( self, config_parser ):
"""Retrieve window state to be restored on the next run..."""
if not config_parser.has_section( 'window' ):
config_parser.add_section( 'window' )
if self.IsMaximized():
config_parser.set( 'window', 'maximized', str(True))
else... | 0.024852 |
def _postprocess(self, x, out=None):
"""Return the post-processed version of ``x``.
C2C: use ``tmp_f`` (C2C operation)
R2C: use ``tmp_f`` (C2C operation)
HALFC: use ``tmp_f`` (C2C operation)
The result is stored in ``out`` if given, otherwise in
a temporary or a new arr... | 0.002567 |
def all_subs(bounds):
"""given a list of tuples specifying the bounds of an array, all_subs()
returns a list of all the tuples of subscripts for that array."""
idx_list = []
for i in range(len(bounds)):
this_dim = bounds[i]
lo,hi = this_dim[0],this_dim[1] # bounds for this dimension... | 0.008677 |
def _fcontext_add_or_delete_policy(action, name, filetype=None, sel_type=None, sel_user=None, sel_level=None):
'''
.. versionadded:: 2019.2.0
Performs the action as called from ``fcontext_add_policy`` or ``fcontext_delete_policy``.
Returns the result of the call to semanage.
'''
if action not ... | 0.003828 |
def to_nodename(string, invalid=None, raise_exc=False):
"""Makes a Quilt Node name (perhaps an ugly one) out of any string.
This should match whatever the current definition of a node name is, as
defined in is_nodename().
This isn't an isomorphic change, the original name can't be recovered
from t... | 0.001495 |
def column_to_bq_schema(self):
"""Convert a column to a bigquery schema object.
"""
kwargs = {}
if len(self.fields) > 0:
fields = [field.column_to_bq_schema() for field in self.fields]
kwargs = {"fields": fields}
return google.cloud.bigquery.SchemaField(s... | 0.004866 |
def _ParseAnalysisPluginOptions(self, options):
"""Parses the analysis plugin options.
Args:
options (argparse.Namespace): command line arguments.
"""
# Get a list of all available plugins.
analysis_plugin_info = self._analysis_manager.GetAllPluginInformation()
# Use set-comprehension to ... | 0.003145 |
def display_the_graphic_connection(self):
"""
The following permits to attribute the function "display_the_graphic" to the slider.
Because, to make a connection, we can not have parameters for the function, but "display_the_graphic" has some.
"""
self.display_the_graphic(self.num... | 0.013193 |
def has_path(nodes, A, B):
r"""Test if nodes from a breadth_first_order search lead from A to
B.
Parameters
----------
nodes : array_like
Nodes from breadth_first_oder_seatch
A : array_like
The set of educt states
B : array_like
The set of product states
Returns... | 0.001927 |
def _sparse_series_to_coo(ss, row_levels=(0, ), column_levels=(1, ),
sort_labels=False):
"""
Convert a SparseSeries to a scipy.sparse.coo_matrix using index
levels row_levels, column_levels as the row and column
labels respectively. Returns the sparse_matrix, row and column lab... | 0.000861 |
def _tokenize_field_path(path):
"""Lex a field path into tokens (including dots).
Args:
path (str): field path to be lexed.
Returns:
List(str): tokens
"""
pos = 0
get_token = TOKENS_REGEX.match
match = get_token(path)
while match is not None:
type_ = match.lastgr... | 0.003617 |
def _stdin_raw_nonblock(self):
"""Use the raw Win32 handle of sys.stdin to do non-blocking reads"""
# WARNING: This is experimental, and produces inconsistent results.
# It's possible for the handle not to be appropriate for use
# with WaitForSingleObject, among other t... | 0.002333 |
def to_string(self):
"""Returns this token as a plain string, suitable for storage.
The resulting string includes the token's secret, so you should never
send or store this string where a third party can read it.
"""
items = [
('oauth_token', self.key),
... | 0.005693 |
def add_block(self, name):
""" Adds a new block to the AST.
`name`
Block name.
* Raises a ``ValueError`` exception if `name` is invalid or
an existing block name matches value provided for `name`.
"""
if not self.RE_NAME.match(name):
... | 0.002491 |
def guess_encoding(request):
""" Try to guess the encoding of a request without going through the slow chardet process"""
ctype = request.headers.get('content-type')
if not ctype:
# we don't have a content-type, somehow, so...
LOGGER.warning("%s: no content-type; headers are %s",
... | 0.003101 |
def astensor(array: TensorLike) -> BKTensor:
"""Converts a numpy array to the backend's tensor object
"""
array = np.asarray(array, dtype=CTYPE)
return array | 0.00578 |
def register_service(self, **kwargs):
"""
register this service with consul
kwargs passed to Consul.agent.service.register
"""
kwargs.setdefault('name', self.app.name)
self.session.agent.service.register(**kwargs) | 0.007663 |
def setup_concept_scheme(rdf, defaultcs):
"""Make sure all concepts have an inScheme property, using the given
default concept scheme if necessary."""
for conc in rdf.subjects(RDF.type, SKOS.Concept):
# check concept scheme
cs = rdf.value(conc, SKOS.inScheme, None, any=True)
if cs is... | 0.002475 |
def get_available_networks(self, **kwargs):
"""
Retrieves the list of Ethernet networks, Fiber Channel networks, and network sets that are available to a
server profile, along with their respective ports.
Args:
enclosureGroupUri (str): The URI of the enclosure group associate... | 0.008641 |
def line_transformation_suggestor(line_transformation, line_filter=None):
"""
Returns a suggestor (a function that takes a list of lines and yields
patches) where suggestions are the result of line-by-line transformations.
@param line_transformation Function that, given a line, returns another
... | 0.000678 |
def Validate(self):
"""Check the Method is well constructed."""
ValidateMultiple(self.probe, "Method has invalid probes")
Validate(self.target, "Method has invalid target")
Validate(self.hint, "Method has invalid hint") | 0.004255 |
def get(self, sid):
"""
Constructs a AlphaSenderContext
:param sid: The sid
:returns: twilio.rest.messaging.v1.service.alpha_sender.AlphaSenderContext
:rtype: twilio.rest.messaging.v1.service.alpha_sender.AlphaSenderContext
"""
return AlphaSenderContext(self._ve... | 0.013158 |
def preProcess(self, variables, domains, constraints, vconstraints):
"""
Preprocess variable domains
This method is called before starting to look for solutions,
and is used to prune domains with specific constraint logic
when possible. For instance, any constraints with a singl... | 0.001408 |
def frames(self, most_recent=False):
"""Retrieve a new frame from the PhoXi and convert it to a ColorImage,
a DepthImage, and an IrImage.
Parameters
----------
most_recent: bool
If true, the OpenCV buffer is emptied for the webcam before reading the most recent frame... | 0.005551 |
def list_users_in_group_category(self, group_category_id, search_term=None, unassigned=None):
"""
List users in group category.
Returns a list of users in the group category.
"""
path = {}
data = {}
params = {}
# REQUIRED - PATH - group_categor... | 0.005733 |
def _read_vtc(vtc_file):
"""Read the VTC file.
Parameters
----------
vtc_file : str
path to vtc file
Returns
-------
mpg_file : list of str
list of avi files
start_time : list of datetime
list of start time of the avi files
end_time : list of datetime
... | 0.00082 |
def remove_usb_controller(self, name):
"""Removes a USB controller from the machine.
in name of type str
raises :class:`VBoxErrorObjectNotFound`
A USB controller with given type doesn't exist.
"""
if not isinstance(name, basestring):
raise TypeE... | 0.008869 |
def ParsePythonFlags(self, start_line=0):
"""Parse python/swig style flags."""
modname = None # name of current module
modlist = []
flag = None
for line_num in range(start_line, len(self.output)): # collect flags
line = self.output[line_num].rstrip()
if not line: ... | 0.010375 |
def deleteTable(self, login, tableName):
"""
Parameters:
- login
- tableName
"""
self.send_deleteTable(login, tableName)
self.recv_deleteTable() | 0.005747 |
def get_response(self, deflate=True):
"""
Returns the Logout Response defated, base64encoded
:param deflate: It makes the deflate process optional
:type: bool
:return: Logout Response maybe deflated and base64 encoded
:rtype: string
"""
if deflate:
... | 0.005988 |
def rc_channels_raw_encode(self, time_boot_ms, port, chan1_raw, chan2_raw, chan3_raw, chan4_raw, chan5_raw, chan6_raw, chan7_raw, chan8_raw, rssi):
'''
The RAW values of the RC channels received. The standard PPM
modulation is as follows: 1000 microseconds: 0%, 2000
... | 0.006874 |
def dumps(obj, mesh_filename=None, *args, **kwargs): # pylint: disable=unused-argument
'''
obj: A dictionary mapping names to a 3-dimension array.
mesh_filename: If provided, this value is included in the <DataFileName>
attribute, which Meshlab doesn't seem to use.
TODO Maybe reconstruct this usi... | 0.004869 |
def visit_Assign(self, node):
"""
Create Assign node for final Cxx representation.
It tries to handle multi assignment like:
>> a = b = c = 2
If only one local variable is assigned, typing is added:
>> int a = 2;
TODO: Handle case of multi-assignement for som... | 0.00091 |
def _check_times(self, min_times, max_times, step):
'''
Make sure that the arguments are valid
:raises: KittyException if not valid
'''
kassert.is_int(min_times)
kassert.is_int(max_times)
kassert.is_int(step)
if not((min_times >= 0) and (max_times > 0) an... | 0.007752 |
def required(self, fn):
"""Request decorator. Forces authentication."""
@functools.wraps(fn)
def decorated(*args, **kwargs):
if (not self._check_auth()
# Don't try to force authentication if the request is part
# of the authentication process - otherwise... | 0.008104 |
def is_anagram(s, t):
"""
:type s: str
:type t: str
:rtype: bool
"""
maps = {}
mapt = {}
for i in s:
maps[i] = maps.get(i, 0) + 1
for i in t:
mapt[i] = mapt.get(i, 0) + 1
return maps == mapt | 0.004065 |
def Tautoignition(CASRN, AvailableMethods=False, Method=None):
r'''This function handles the retrieval or calculation of a chemical's
autoifnition temperature. Lookup is based on CASRNs. No predictive methods
are currently implemented. Will automatically select a data source to use
if no Method is provi... | 0.001171 |
def _edit_task_config(env, task_config, confirm):
""" Launches text editor to edit provided task configuration file.
`env`
Runtime ``Environment`` instance.
`task_config`
Path to task configuration file.
`confirm`
If task config is invalid after edit, pr... | 0.000361 |
def page_down(self, n=1, interval=0, pre_dl=None, post_dl=None):
"""Pres page_down key n times.
**中文文档**
按 page_down 键n次。
"""
self.delay(pre_dl)
self.k.tap_key(self.k.page_down, n, interval)
self.delay(post_dl) | 0.007463 |
def get_d_moments(model,x):
'''
Gradients with respect to x of the moments (mean and sdev.) of the GP
:param model: GPy model.
:param x: location where the gradients are evaluated.
'''
input_dim = model.input_dim
x = reshape(x,input_dim)
_, v = model.predict(x)
dmdx, dvdx = model.pre... | 0.011905 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.