text stringlengths 78 104k | score float64 0 0.18 |
|---|---|
def _post(url, headers={}, data=None, files=None):
"""Tries to POST data to an endpoint"""
try:
response = requests.post(url, headers=headers, data=data, files=files, verify=VERIFY_SSL)
return _process_response(response)
except requests.exceptions.RequestException as e:
_log_and_rais... | 0.005348 |
def strip_code(self, normalize=True, collapse=True,
keep_template_params=False):
"""Return a rendered string without unprintable code such as templates.
The way a node is stripped is handled by the
:meth:`~.Node.__strip__` method of :class:`.Node` objects, which
gener... | 0.00186 |
def search(self, lat_range=None, long_range=None, variance=None,
bssid=None, ssid=None,
last_update=None,
address=None, state=None, zipcode=None,
on_new_page=None, max_results=100):
"""
Search the Wigle wifi database for matching entries. The f... | 0.003509 |
def getcodeobj(consts, intcode, newcodeobj, oldcodeobj):
"""Get code object from decompiled code.
:param list consts: constants to add in the result.
:param list intcode: list of byte code to use.
:param newcodeobj: new code object with empty body.
:param oldcodeobj: old code object.
:return: n... | 0.000957 |
def write(self, data, mode='w'):
"""
Write data to the file.
`data` is the data to write
`mode` is the mode argument to pass to `open()`
"""
with open(self.path, mode) as f:
f.write(data) | 0.008065 |
def search(self, **kwargs):
"""
Method to search vlan's based on extends search.
:param search: Dict containing QuerySets to find vlan's.
:param include: Array containing fields to include on response.
:param exclude: Array containing fields to exclude on response.
:para... | 0.004525 |
def _set_ldp_hello_timeout_basic(self, v, load=False):
"""
Setter method for ldp_hello_timeout_basic, mapped from YANG variable /mpls_config/router/mpls/mpls_cmds_holder/ldp/ldp_holder/ldp_hello_timeout_basic (uint32)
If this variable is read-only (config: false) in the
source YANG file, then _set_ldp_h... | 0.004559 |
def rl_get_point() -> int: # pragma: no cover
"""
Returns the offset of the current cursor position in rl_line_buffer
"""
if rl_type == RlType.GNU:
return ctypes.c_int.in_dll(readline_lib, "rl_point").value
elif rl_type == RlType.PYREADLINE:
return readline.rl.mode.l_buffer.point
... | 0.00289 |
def query_bypass(self, query, raw_output=True):
''' Bypass query meaning that field check and validation is skipped, then query object directly executed by pymongo.
:param raw_output: Skip OmMongo ORM layer (default: True)
'''
if not isinstance(query, dict):
rais... | 0.007394 |
def __register_class(self, parsed_config):
"""Register the class implementing this config, so we only add it once.
Args:
parsed_config: The JSON object with the API configuration being added.
Raises:
ApiConfigurationError: If the class has already been registered.
"""
methods = parsed_... | 0.006166 |
def safe_unit_norm(a):
"""
Ensure that the vector or vectors have unit norm
"""
if 1 == len(a.shape):
n = np.linalg.norm(a)
if n:
return a / n
return a
norm = np.sum(np.abs(a) ** 2, axis=-1) ** (1. / 2)
# Dividing by a norm of zero will cause a warning to be... | 0.001828 |
def get_access_string(self, shape, table):
"""Returns a string, with which the selection can be accessed
Parameters
----------
shape: 3-tuple of Integer
\tShape of grid, for which the generated keys are valid
table: Integer
\tThird component of all returned keys.... | 0.001146 |
def get_playlists(self, offset=0, limit=50):
""" Get user's playlists. """
response = self.client.get(
self.client.USER_PLAYLISTS % (self.name, offset, limit))
return self._parse_response(response, splaylist)
return playlists | 0.007407 |
def parse_soap_enveloped_saml_thingy(text, expected_tags):
"""Parses a SOAP enveloped SAML thing and returns the thing as
a string.
:param text: The SOAP object as XML string
:param expected_tags: What the tag of the SAML thingy is expected to be.
:return: SAML thingy as a string
"""
envelo... | 0.000995 |
def has_dag_access(**dag_kwargs):
"""
Decorator to check whether the user has read / write permission on the dag.
"""
def decorator(f):
@functools.wraps(f)
def wrapper(self, *args, **kwargs):
has_access = self.appbuilder.sm.has_access
dag_id = request.args.get('da... | 0.003812 |
def get_instance(self, payload):
"""
Build an instance of IpAccessControlListInstance
:param dict payload: Payload response from the API
:returns: twilio.rest.trunking.v1.trunk.ip_access_control_list.IpAccessControlListInstance
:rtype: twilio.rest.trunking.v1.trunk.ip_access_co... | 0.01046 |
def get_jwt_decrypt_keys(self, jwt, **kwargs):
"""
Get decryption keys from this keyjar based on information carried
in a JWE. These keys should be usable to decrypt an encrypted JWT.
:param jwt: A cryptojwt.jwt.JWT instance
:param kwargs: Other key word arguments
:retur... | 0.001509 |
def load_from_file(self, path):
"""
Load cookies from the file.
Content of file should be a JSON-serialized list of dicts.
"""
with open(path) as inf:
data = inf.read()
if data:
items = json.loads(data)
else:
i... | 0.00361 |
def media(soup):
"""
All media tags and some associated data about the related component doi
and the parent of that doi (not always present)
"""
media = []
media_tags = raw_parser.media(soup)
position = 1
for tag in media_tags:
media_item = {}
copy_attribute(tag.attrs... | 0.004805 |
def auth_in_stage2(self,stanza):
"""Handle the second stage (<iq type='set'/>) of legacy ("plain" or
"digest") authentication.
[server only]"""
self.lock.acquire()
try:
if "plain" not in self.auth_methods and "digest" not in self.auth_methods:
iq=stan... | 0.015873 |
def cleanup(self):
"""
Cleans up references to the plot after the plot has been
deleted. Traverses through all plots cleaning up Callbacks and
Stream subscribers.
"""
plots = self.traverse(lambda x: x, [BokehPlot])
for plot in plots:
if not isinstance(... | 0.002693 |
def create(cls, name, ipv4_network=None, ipv6_network=None,
comment=None):
"""
Create the network element
:param str name: Name of element
:param str ipv4_network: network cidr (optional if ipv6)
:param str ipv6_network: network cidr (optional if ipv4)
:pa... | 0.004405 |
def iterparse_elements(element_function, file_or_path, **kwargs):
"""
Applies element_function to each of the sub-elements in the XML file.
The passed in function must take at least one element, and an optional
list of **kwarg which are relevant to each of the elements in the list:
def elem_func... | 0.000959 |
def create_roles(apps, schema_editor):
"""Create the enterprise roles if they do not already exist."""
EnterpriseFeatureRole = apps.get_model('enterprise', 'EnterpriseFeatureRole')
EnterpriseFeatureRole.objects.update_or_create(name=ENTERPRISE_CATALOG_ADMIN_ROLE)
EnterpriseFeatureRole.objects.update_or_... | 0.010917 |
def submit_evaluation(self, variant_obj, user_obj, institute_obj, case_obj, link, criteria):
"""Submit an evaluation to the database
Get all the relevant information, build a evaluation_obj
Args:
variant_obj(dict)
user_obj(dict)
institute_obj(dict)
... | 0.003209 |
def _get_retention_policy_value(self):
"""
Sets the deletion policy on this resource. The default is 'Retain'.
:return: value for the DeletionPolicy attribute.
"""
if self.RetentionPolicy is None or self.RetentionPolicy.lower() == self.RETAIN.lower():
return self.RE... | 0.006649 |
def isdir(self, path):
"""Return true if the path refers to an existing directory.
Parameters
----------
path : str
Path of directory on the remote side to check.
"""
result = True
try:
self.sftp_client.lstat(path)
except FileNotFo... | 0.005277 |
def esrchc(value, array):
"""
Search for a given value within a character string array.
Return the index of the first equivalent array entry, or -1
if no equivalent element is found.
http://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/esrchc_c.html
:param value: Key value to be found in ar... | 0.001211 |
def date(name=None):
"""
Creates the grammar for a Date (D) field, accepting only numbers in a
certain pattern.
:param name: name for the field
:return: grammar for the date field
"""
if name is None:
name = 'Date Field'
# Basic field
# This regex allows values from 000001... | 0.001441 |
def setVisible( self, state ):
"""
Updates the visible state for this message box.
:param state | <bool>
"""
super(XMessageBox, self).setVisible(state)
if ( state ):
self.startTimer(100)
self.layout().setSizeConstraint(QLayou... | 0.025063 |
def get_vnetwork_vswitches_output_has_more(self, **kwargs):
"""Auto Generated Code
"""
config = ET.Element("config")
get_vnetwork_vswitches = ET.Element("get_vnetwork_vswitches")
config = get_vnetwork_vswitches
output = ET.SubElement(get_vnetwork_vswitches, "output")
... | 0.003953 |
def systemInformationType5ter():
"""SYSTEM INFORMATION TYPE 5ter Section 9.1.39"""
a = L2PseudoLength(l2pLength=0x12)
b = TpPd(pd=0x6)
c = MessageType(mesType=0x6) # 00000110
d = NeighbourCellsDescription2()
packet = a / b / c / d
return packet | 0.003663 |
def lowercase_to_camelcase(python_input, camelcase_input=None):
'''
a function to recursively convert data with lowercase key names into camelcase keys
:param camelcase_input: list or dictionary with lowercase keys
:param python_input: [optional] list or dictionary with default camel... | 0.010033 |
def configure():
"""
Configure information about Databricks account and default behavior.
Configuration is stored in a `.apparatecfg` file. A config file must exist
before this package can be used, and can be supplied either directly as a
text file or generated using this configuration tool.
... | 0.001179 |
def list_all_versions(pkg,
bin_env=None,
include_alpha=False,
include_beta=False,
include_rc=False,
user=None,
cwd=None,
index_url=None,
extra_i... | 0.001361 |
def loadgrants(source=None, setspec=None, all_grants=False):
"""Harvest grants from OpenAIRE.
:param source: Load the grants from a local sqlite db (offline).
The value of the parameter should be a path to the local file.
:type source: str
:param setspec: Harvest specific set through OAI-PMH
... | 0.000743 |
def poly(self, polys):
"""Creates a POLYGON shape.
Polys is a collection of polygons, each made up of a list of xy values.
Note that for ordinary polygons the coordinates must run in a clockwise direction.
If some of the polygons are holes, these must run in a counterclockwise direct... | 0.009615 |
def components(arg):
"""Converts a dict of components to the format expected by the Google Maps
server.
For example:
c = {"country": "US", "postal_code": "94043"}
convert.components(c)
# 'country:US|postal_code:94043'
:param arg: The component filter.
:type arg: dict
:rtype: bases... | 0.002364 |
def setupTable_post(self):
"""
Make the post table.
**This should not be called externally.** Subclasses
may override or supplement this method to handle the
table creation in a different way if desired.
"""
if "post" not in self.tables:
return
... | 0.004583 |
def max(x, axis=None, keepdims=False, with_index=False, only_index=False):
"""Reduce the input N-D array `x` along the given `axis` using the max
operation. The `axis` argument may be a single integer to reduce
over one axis, a tuple of integers to reduce over multiple axes,
or ``None`` to reduce over a... | 0.000509 |
def gen_radio_list(sig_dic):
'''
For generating List view HTML file for RADIO.
for each item.
'''
view_zuoxiang = '''<span class="iga_pd_val">'''
dic_tmp = sig_dic['dic']
for key in dic_tmp.keys():
tmp_str = '''{{% if postinfo.extinfo['{0}'][0] == "{1}" %}} {2} {{% end %}}
'... | 0.004376 |
def compliance(self, value):
"""Set the compliance profile URI."""
if (self.api_version < '2.0'):
self.profile = value
else:
try:
self.profile[0] = value
except AttributeError:
# handle case where profile not initialized as arra... | 0.005556 |
def get_mac_address_table(self):
"""
Returns a lists of dictionaries. Each dictionary represents an entry in the MAC Address
Table, having the following keys
* mac (string)
* interface (string)
* vlan (int)
* active (boolean)
* static (... | 0.001469 |
def list_joysticks():
'''Print a list of available joysticks'''
print('Available joysticks:')
print()
for jid in range(pygame.joystick.get_count()):
j = pygame.joystick.Joystick(jid)
print('({}) {}'.format(jid, j.get_name())) | 0.003876 |
def log_pdf(self, y, mu, weights=None):
"""
computes the log of the pdf or pmf of the values under the current distribution
Parameters
----------
y : array-like of length n
target values
mu : array-like of length n
expected values
weights ... | 0.004274 |
def n_sum(n, nums, target, **kv):
"""
n: int
nums: list[object]
target: object
sum_closure: function, optional
Given two elements of nums, return sum of both.
compare_closure: function, optional
Given one object of nums and target, return -1, 1, or 0.
same_closure: function, ... | 0.000594 |
def get_extra_pids(self):
"""
Gets the list of process ids that should be marked as high priority.
:return: A list of process ids that are used by this bot in addition to the ones inside the python process.
"""
while not self.is_retired:
for proc in psutil.process_ite... | 0.006087 |
def _add_include_arg(arg_parser):
"""
Adds optional repeatable include parameter to a parser.
:param arg_parser: ArgumentParser parser to add this argument to.
"""
arg_parser.add_argument("--include",
metavar='Path',
action='append',
... | 0.003656 |
def create(path, value='', acls=None, ephemeral=False, sequence=False, makepath=False, profile=None,
hosts=None, scheme=None, username=None, password=None, default_acl=None):
'''
Create Znode
path
path of znode to create
value
value to assign to znode (Default: '')
acls... | 0.003876 |
def drange(start, stop, step):
"""
A generator that yields successive samples from start (inclusive)
to stop (exclusive) in step intervals.
Parameters
----------
start : float
starting point
stop : float
stopping point
step : float
stepping interval
Yields
... | 0.005548 |
def datetime_format(desired_format, datetime_instance=None, *args, **kwargs):
"""
Replaces format style phrases (listed in the dt_exps dictionary)
with this datetime instance's information.
.. code :: python
reusables.datetime_format("Hey, it's {month-full} already!")
"Hey, it's March... | 0.001138 |
def _parse_s3_location(location):
"""
Parses the given location input as a S3 Location and returns the file's bucket, key and version as separate
values. Input can be in two different formats:
1. Dictionary with ``Bucket``, ``Key``, ``Version`` keys
2. String of S3 URI in format... | 0.005382 |
def consumer(self, fn):
"""Consumer decorator
:param fn: coroutine consumer function
Example:
>>> api = StreamingAPI('my_service_key')
>>> stream = api.get_stream()
>>> @stream.consumer
>>> @asyncio.coroutine
>>> def handle_event(payload):
>>> ... | 0.002857 |
def shifted(self, rows, cols):
"""Returns a new selection that is shifted by rows and cols.
Negative values for rows and cols may result in a selection
that addresses negative cells.
Parameters
----------
rows: Integer
\tNumber of rows that the new selection is ... | 0.002096 |
def element_not_contains(self, element_id, value):
"""
Assert provided content is not contained within an element found by ``id``.
"""
elem = world.browser.find_elements_by_xpath(str(
'id("{id}")[contains(., "{value}")]'.format(
id=element_id, value=value)))
assert not elem, \
... | 0.002667 |
def createStatus(self,
repo_user, repo_name, sha, state, target_url=None,
context=None, issue=None, description=None):
"""
:param repo_user: GitHub user or organization
:param repo_name: Name of the repository
:param sha: Full sha to create the s... | 0.004542 |
def set_context(context=None, font_scale=1, rc=None):
"""Set the plotting context parameters.
This affects things like the size of the labels, lines, and other
elements of the plot, but not the overall style. The base context
is "notebook", and the other contexts are "paper", "talk", and "poster",
w... | 0.000677 |
def get_child_family_ids(self, family_id):
"""Gets the child ``Ids`` of the given family.
arg: family_id (osid.id.Id): the ``Id`` to query
return: (osid.id.IdList) - the children of the family
raise: NotFound - ``family_id`` is not found
raise: NullArgument - ``family_id`` ... | 0.003614 |
def run(self, value, model=None, context=None):
"""
Run validation
Wraps concrete implementation to ensure custom validators return
proper type of result.
:param value: a value to validate
:param model: parent model of the property
:pa... | 0.002554 |
def _add_meta_dict_to_xml(self, doc, parent, meta_dict):
"""
Values in the meta element dict are converted to a BadgerFish-style
encoding (see _convert_hbf_meta_val_for_xml), so regardless of input_format,
we treat them as if they were BadgerFish.
"""
if not meta_... | 0.005042 |
def get_shutit_pexpect_sessions():
"""Returns all the shutit_pexpect sessions in existence.
"""
sessions = []
for shutit_object in shutit_global_object.shutit_objects:
for key in shutit_object.shutit_pexpect_sessions:
sessions.append(shutit_object.shutit_pexpect_sessions[key])
return sessions | 0.026403 |
def get(ctx, key):
'''Retrieve the value for the given key.'''
file = ctx.obj['FILE']
stored_value = get_key(file, key)
if stored_value:
click.echo('%s=%s' % (key, stored_value))
else:
exit(1) | 0.004386 |
def _GetOutputModulesInformation(self):
"""Retrieves the output modules information.
Returns:
list[tuple[str, str]]: pairs of output module names and descriptions.
"""
output_modules_information = []
for name, output_class in output_manager.OutputManager.GetOutputClasses():
output_modul... | 0.004831 |
def expand_groups(grp):
"""Expand group names.
Args:
grp (string): group names to expand
Returns:
list of groups
Examples:
* grp[1-3] will be expanded to [grp1, grp2, grp3]
* grp1 will be expanded to [grp1]
"""
p = re.compile(r"(?P<name>.+)\[(?P<start>\d+)-(?P... | 0.00177 |
def create_or_replace_primary_key(self,
table: str,
fieldnames: Sequence[str]) -> int:
"""Make a primary key, or replace it if it exists."""
# *** create_or_replace_primary_key: Uses code specific to MySQL
sql = """
... | 0.003663 |
def stop(self):
"""
Stop the node process.
"""
if self._wrapper_telnet_server:
self._wrapper_telnet_server.close()
yield from self._wrapper_telnet_server.wait_closed()
self.status = "stopped" | 0.007843 |
def configure(self, statistics="max", max_ticks=5, plot_hists=True, flip=True,
serif=True, sigma2d=False, sigmas=None, summary=None, bins=None, rainbow=None,
colors=None, linestyles=None, linewidths=None, kde=False, smooth=None,
cloud=None, shade=None, shade_alpha=N... | 0.004796 |
def save_swagger_spec(self, filepath=None):
"""
Saves a copy of the origin_spec to a local file in JSON format
"""
if filepath is True or filepath is None:
filepath = self.file_spec.format(server=self.server)
json.dump(self.origin_spec, open(filepath, 'w+'), indent=3... | 0.006231 |
def reproject_to_grid_coordinates(self, grid_coordinates, interp=gdalconst.GRA_NearestNeighbour):
""" Reprojects data in this layer to match that in the GridCoordinates
object. """
source_dataset = self.grid_coordinates._as_gdal_dataset()
dest_dataset = grid_coordinates._as_gdal_dataset(... | 0.004255 |
def H10(self):
"Difference variance."
c = (self.rlevels * self.p_xminusy).sum(1)
c1 = np.tile(c, (self.nlevels,1)).transpose()
e = self.rlevels - c1
return (self.p_xminusy * e ** 2).sum(1) | 0.013158 |
def bar3_chart(self, title, labels, data1, file_name, data2, data3, legend=["", ""]):
"""
Generate a bar plot with three columns in each x position and save it to file_name
:param title: title to be used in the chart
:param labels: list of labels for the x axis
:param data1: val... | 0.003642 |
def remove_object_metadata_key(self, container, obj, key, prefix=None):
"""
Removes the specified key from the storage object's metadata. If the key
does not exist in the metadata, nothing is done.
"""
self.set_object_metadata(container, obj, {key: ""}, prefix=prefix) | 0.00974 |
def search_images(q, start=1, count=10, wait=10, asynchronous=False, cached=False):
""" Returns a Yahoo images query formatted as a YahooSearch list object.
"""
service = YAHOO_IMAGES
return YahooSearch(q, start, count, service, None, wait, asynchronous, cached) | 0.017361 |
def get_gsims(self, trt):
"""
:param trt: tectonic region type
:returns: sorted list of available GSIMs for that trt
"""
if trt == '*' or trt == b'*': # fake logictree
[trt] = self.values
return sorted(self.values[trt]) | 0.007143 |
def join(tokens, start, result):
"""Join tokens into a single string with spaces between."""
texts = []
if len(result) > 0:
for e in result:
for child in e.iter():
if child.text is not None:
texts.append(child.text)
return [E(result[0].tag, ' '... | 0.002994 |
def percent_rank(expr, sort=None, ascending=True):
"""
Calculate percentage rank of a sequence expression.
:param expr: expression for calculation
:param sort: name of the sort column
:param ascending: whether to sort in ascending order
:return: calculated column
"""
return _rank_op(exp... | 0.005236 |
def to_json_data(self, model_name=None):
"""
Parameters
----------
model_name: str, default None
if given, will be used as external file directory base name
Returns
-------
A dictionary of serialized data.
"""
return collections.Ordere... | 0.009852 |
def ebi_expression_atlas(accession: str, *, filter_boring: bool = False):
"""Load a dataset from the `EBI Single Cell Expression Atlas <https://www.ebi.ac.uk/gxa/sc/experiments>`__.
Downloaded datasets are saved in directory specified by `sc.settings.datasetdir`.
Params
------
accession
Da... | 0.001866 |
def grid(self, start=None, stop=None, St=None, **kwargs):
"""Grid-like representation of payoff & profit structure.
Returns
-------
tuple
Tuple of `St` (price at expiry), `payoffs`, `profits`.
"""
lb = 0.75
rb = 1.25
if not any((st... | 0.002503 |
def get_page_number(self, index):
"""
Given an index, return page label as specified by
catalog['PageLabels']['Nums']
In a PDF, page labels are stored as a list of pairs, like
[starting_index, label_format, starting_index, label_format ...]
For example:
... | 0.001481 |
def devserver(arguments):
"""Run a development server."""
import coil.web
if coil.web.app:
port = int(arguments['--port'])
url = 'http://localhost:{0}/'.format(port)
coil.web.configure_url(url)
coil.web.app.config['DEBUG'] = True
if arguments['--browser']:
... | 0.001795 |
async def enable_analog_reporting(self, pin):
"""
Enables analog reporting. By turning reporting on for a single pin,
:param pin: Analog pin number. For example for A0, the number is 0.
:returns: No return value
"""
command = [PrivateConstants.REPORT_ANALOG + pin,
... | 0.004878 |
def alter_configs(self, config_resources):
"""Alter configuration parameters of one or more Kafka resources.
Warning:
This is currently broken for BROKER resources because those must be
sent to that specific broker, versus this always picks the
least-loaded node. See... | 0.00527 |
def predict(self, n_periods=10, exogenous=None,
return_conf_int=False, alpha=0.05):
"""Forecast future values
Generate predictions (forecasts) ``n_periods`` in the future.
Note that if ``exogenous`` variables were used in the model fit, they
will be expected for the pred... | 0.000901 |
def buildhtml(self):
"""Build the HTML page
Create the htmlheader with css / js
Create html page
"""
self.buildcontent()
self.buildhtmlheader()
self.content = self._htmlcontent.decode('utf-8') # need to ensure unicode
self._htmlcontent = self.template_page... | 0.010444 |
def escape(s):
"""Convert the characters &, <, >, ' and " in string s to HTML-safe
sequences. Use this if you need to display text that might contain
such characters in HTML. Marks return value as markup string.
"""
if hasattr(s, '__html__'):
return s.__html__()
if isinstance(s, six.bi... | 0.011129 |
def bind_transient(type_to_bind: hexdi.core.restype, accessor: hexdi.core.clstype):
"""
shortcut for bind_type with PerResolveLifeTimeManager on root container
:param type_to_bind: type that will be resolved by accessor
:param accessor: accessor for resolving object
"""
hexdi.core.get_root_cont... | 0.007557 |
def _has_next_page(self):
"""Determines whether or not there are more pages with results.
Returns:
bool: Whether the iterator has more pages.
"""
if self.page_number == 0:
return True
if self.max_results is not None:
if self.num_results >= se... | 0.003571 |
def add_voice_call_api(mock):
'''Add org.ofono.VoiceCallManager API to a mock'''
# also add an emergency number which is not a real one, in case one runs a
# test case against a production ofono :-)
mock.AddProperty('org.ofono.VoiceCallManager', 'EmergencyNumbers', ['911', '13373'])
mock.calls = [... | 0.004028 |
def set_dialect(dialect):
'''set the MAVLink dialect to work with.
For example, set_dialect("ardupilotmega")
'''
global mavlink, current_dialect
from .generator import mavparse
if 'MAVLINK20' in os.environ:
wire_protocol = mavparse.PROTOCOL_2_0
modname = "pymavlink.dialects.v20."... | 0.002865 |
def create_single_weather(df, rename_dc):
"""Create an oemof weather object for the given geometry"""
my_weather = weather.FeedinWeather()
data_height = {}
name = None
# Create a pandas.DataFrame with the time series of the weather data set
weather_df = pd.DataFrame(index=df.time_series.iloc[0].... | 0.001161 |
def raise_error(error):
"""Intakes a dict of remote error information and raises a DashiError
"""
exc_type = error.get('exc_type')
if exc_type and exc_type.startswith(ERROR_PREFIX):
exc_type = exc_type[len(ERROR_PREFIX):]
exc_cls = ERROR_TYPE_MAP.get(exc_type, DashiError)
else:
... | 0.002695 |
def eval_nonagg_call(self, exp):
"helper for eval_callx; evaluator for CallX that consume a single value"
# todo: get more concrete about argument counts
args=self.eval(exp.args)
if exp.f=='coalesce':
a,b=args # todo: does coalesce take more than 2 args?
return b if a is None else a
elif... | 0.029514 |
def len_on_depth(d, depth):
"""Get the number of nodes on specific depth.
"""
counter = 0
for node in DictTree.v_depth(d, depth-1):
counter += DictTree.length(node)
return counter | 0.008658 |
def create_target_group(Name=None, Protocol=None, Port=None, VpcId=None, HealthCheckProtocol=None, HealthCheckPort=None, HealthCheckPath=None, HealthCheckIntervalSeconds=None, HealthCheckTimeoutSeconds=None, HealthyThresholdCount=None, UnhealthyThresholdCount=None, Matcher=None):
"""
Creates a target group.
... | 0.005946 |
def _file_prompt_quiet(f):
"""Decorator to toggle 'file prompt quiet' for methods that perform file operations."""
@functools.wraps(f)
def wrapper(self, *args, **kwargs):
if not self.prompt_quiet_configured:
if self.auto_file_prompt:
# disable fil... | 0.003754 |
def import_from_setting(setting_name, fallback):
"""Return the resolution of an import path stored in a Django setting.
:arg setting_name: The name of the setting holding the import path
:arg fallback: An alternate object to use if the setting is empty or
doesn't exist
Raise ImproperlyConfigured... | 0.001626 |
def hold_exception(method):
"""Decorator for glib callback methods of GLibMainLoop used to store the
exception raised."""
@functools.wraps(method)
def wrapper(self, *args, **kwargs):
"""Wrapper for methods decorated with `hold_exception`."""
# pylint: disable=W0703,W0212
try:
... | 0.004883 |
def form(self):
"""
This attribute points to default form.
If form was not selected manually then select the form
which has the biggest number of input elements.
The form value is just an `lxml.html` form element.
Example::
g.go('some URL')
# C... | 0.002257 |
async def result_processor(tasks):
"""An async result aggregator that combines all the results
This gets executed in unsync.loop and unsync.thread"""
output = {}
for task in tasks:
num, res = await task
output[num] = res
return output | 0.003663 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.