text stringlengths 78 104k | score float64 0 0.18 |
|---|---|
def _set_repo_urls_from_channels(self, channels):
"""
Convert a channel into a normalized repo name including.
Channels are assumed in normalized url form.
"""
repos = []
sys_platform = self._conda_api.get_platform()
for channel in channels:
url = '{... | 0.004684 |
def render(self, width: int, height: int) -> List[str]:
"""Returns a list of text lines representing the block's contents.
Args:
width: The width of the output text. Must be at least as large as
the block's minimum width.
height: The height of the output text. Mu... | 0.001184 |
def _subthread_handle_readable(self, conn):
"""Handles readable client sockets. Calls the user modified handle_readable with
the client socket as the only variable. If the handle_readable function returns
true the client is again registered to the selector object otherwise the client
is ... | 0.010753 |
def _fS1(self, pos_pairs, A):
"""The gradient of the similarity constraint function w.r.t. A.
f = \sum_{ij}(x_i-x_j)A(x_i-x_j)' = \sum_{ij}d_ij*A*d_ij'
df/dA = d(d_ij*A*d_ij')/dA
Note that d_ij*A*d_ij' = tr(d_ij*A*d_ij') = tr(d_ij'*d_ij*A)
so, d(d_ij*A*d_ij')/dA = d_ij'*d_ij
"""
dim = pos_... | 0.006961 |
def update_cached_fields_pre_save(self, update_fields: list):
"""
Call on pre_save signal for objects (to automatically refresh on save).
:param update_fields: list of fields to update
"""
if self.id and update_fields is None:
self.update_cached_fields(commit=False, e... | 0.005952 |
def rebuild( self ):
"""
Rebuilds the current item in the scene.
"""
self.markForRebuild(False)
self._textData = []
if ( self.rebuildBlocked() ):
return
scene = self.scene()
if ( not scene ):
... | 0.028319 |
def write(self, s, flush=True):
"""Write bytes to the pseudoterminal.
Returns the number of bytes written.
"""
return self._writeb(s, flush=flush) | 0.016043 |
def get_classes(cls, el):
"""Get classes."""
classes = cls.get_attribute_by_name(el, 'class', [])
if isinstance(classes, util.ustr):
classes = RE_NOT_WS.findall(classes)
return classes | 0.008734 |
def make_calls(self, num_calls=1):
"""Adds appropriate sleep to avoid making too many calls.
Args:
num_calls: int the number of calls which will be made
"""
self._cull()
while self._outstanding_calls + num_calls > self._max_calls_per_second:
time.sleep(0)... | 0.006148 |
def _ingest_response(self, response):
'''Takes a response object and ingests state, links, embedded
documents and updates the self link of this navigator to
correspond. This will only work if the response is valid
JSON
'''
self.response = response
if self._can_par... | 0.001437 |
def ci(ctx, enable, disable): # pylint:disable=assign-to-new-keyword
"""Enable/Disable CI on this project.
Uses [Caching](/references/polyaxon-cli/#caching)
Example:
\b
```bash
$ polyaxon project ci --enable
```
\b
```bash
$ polyaxon project ci --disable
```
"""
... | 0.004801 |
def main_encrypt(A):
"Encrypt to recipient list using primary key OR prompted key. Recipients may be IDs or petnames."
profile = get_profile(A)
localKeys = profile.get('local keys', [])
if not localKeys:
localKeys = [make_lock_securely(warn_only = A.ignore_entropy)]
else:
localKeys =... | 0.006347 |
def box_plot(x, y, xlabel=LABEL_DEFAULT, ylabel=LABEL_DEFAULT, title=LABEL_DEFAULT):
"""
Plots the data in `x` on the X axis and the data in `y` on the Y axis
in a 2d box and whiskers plot, and returns the resulting Plot object.
The function x as SArray of dtype str and y as SArray of dtype: int, f... | 0.007519 |
def get_dropbox_folder_location():
"""
Try to locate the Dropbox folder.
Returns:
(str) Full path to the current Dropbox folder
"""
host_db_path = os.path.join(os.environ['HOME'], '.dropbox/host.db')
try:
with open(host_db_path, 'r') as f_hostdb:
data = f_hostdb.read... | 0.002062 |
def send(self, sender: PytgbotApiBot):
"""
Send the message via pytgbot.
:param sender: The bot instance to send with.
:type sender: pytgbot.bot.Bot
:rtype: PytgbotApiMessage
"""
return sender.send_video(
# receiver, self.media, disable_notification... | 0.005502 |
def _parse_button(self, keypad, component_xml):
"""Parses a button device that part of a keypad."""
button_xml = component_xml.find('Button')
name = button_xml.get('Engraving')
button_type = button_xml.get('ButtonType')
direction = button_xml.get('Direction')
# Hybrid keypads have dimmer buttons... | 0.004172 |
def find_l50(contig_lengths_dict, genome_length_dict):
"""
Calculate the L50 for each strain. L50 is defined as the number of contigs required to achieve the N50
:param contig_lengths_dict: dictionary of strain name: reverse-sorted list of all contig lengths
:param genome_length_dict: dictionary of stra... | 0.005146 |
def light_travel_time_to_detector(self, det):
""" Return the light travel time from this detector
Parameters
----------
det: Detector
The other detector to determine the light travel time to.
Returns
-------
time: float
The light travel t... | 0.004515 |
def infer_location(
point,
location_query,
max_distance,
google_key,
foursquare_client_id,
foursquare_client_secret,
limit
):
""" Infers the semantic location of a (point) place.
Args:
points (:obj:`Point`): Point location to infer
loc... | 0.001462 |
def authenticate(json_path=None):
"""Gets a Natural Language API parser by authenticating the API.
**This method is deprecated.** Please use :obj:`budou.get_parser` to obtain a
parser instead.
Args:
json_path (:obj:`str`, optional): The file path to the service account's
credentials.
Returns:
... | 0.009885 |
def cache_key_name(cls, *args):
"""Return the name of the key to use to cache the current configuration"""
if cls.KEY_FIELDS != ():
if len(args) != len(cls.KEY_FIELDS):
raise TypeError(
"cache_key_name() takes exactly {} arguments ({} given)".format(len(cl... | 0.008251 |
def field2type_and_format(self, field):
"""Return the dictionary of OpenAPI type and format based on the field
type
:param Field field: A marshmallow field.
:rtype: dict
"""
# If this type isn't directly in the field mapping then check the
# hierarchy until we fi... | 0.003398 |
def flush(self, frame):
'''
Passes the drawqueue to the sink for rendering
'''
self.sink.render(self.size_or_default(), frame, self._drawqueue)
self.reset_drawqueue() | 0.009709 |
def bind(self, instance_id: str, binding_id: str, details: BindDetails) -> Binding:
"""Binding the instance
see openbrokerapi documentation
"""
# Find the instance
instance = self._backend.find(instance_id)
# Find or create the binding
b... | 0.014583 |
def isrchc(value, ndim, lenvals, array):
"""
Search for a given value within a character string array. Return
the index of the first matching array entry, or -1 if the key
value was not found.
http://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/isrchc_c.html
:param value: Key value to be f... | 0.001081 |
def write_data(msg_type, profile_name, data, cfg):
"""
Write the settings into the data portion of the cfg.
Args:
:msg_type: (str) message type to create config entry.
:profile_name: (str) name of the profile entry
:data: (dict) dict values for the 'settings'
:cfg: (jsonconf... | 0.002119 |
def close(self):
"Terminate document"
if(self.state==3):
return
if(self.page==0):
self.add_page()
#Page footer
self.in_footer=1
self.footer()
self.in_footer=0
#close page
self._endpage()
#close document
self.... | 0.027356 |
def sigfig_int(values, sigfig):
"""
Convert a set of floating point values into integers with a specified number
of significant figures and an exponent.
Parameters
------------
values: (n,) float or int, array of values
sigfig: (n,) int, number of significant figures to keep
Returns
... | 0.001963 |
def _basicload(l: Loader, value: Any, type_: type) -> Any:
"""
This converts a value into a basic type.
In theory it does nothing, but it performs type checking
and raises if conditions fail.
It also attempts casting, if enabled.
"""
if type(value) != type_:
if l.basiccast:
... | 0.003663 |
def p_pvar_list(self, p):
'''pvar_list : pvar_list pvar_def
| empty'''
if p[1] is None:
p[0] = []
else:
p[1].append(p[2])
p[0] = p[1] | 0.009346 |
def pause_trial(self, trial):
"""Pauses the trial.
We want to release resources (specifically GPUs) when pausing an
experiment. This results in PAUSED state that similar to TERMINATED.
"""
assert trial.status == Trial.RUNNING, trial.status
try:
self.save(tria... | 0.003497 |
def add_path(self, path, pattern="*.json"):
"""Add configuration file(s)
in `path`. The path can be a single file or a directory.
If path is a directory, then `pattern`
(Unix glob-style) will be used to get a list of all config
files in the directory.
The name given to e... | 0.002562 |
def get_asset(self, symbol):
'''Get an asset'''
resp = self.get('/assets/{}'.format(symbol))
return Asset(resp) | 0.014815 |
def load_key(self, key):
"""
Load an Elliptic curve key
:param key: An elliptic curve key instance, private or public.
:return: Reference to this instance
"""
self._serialize(key)
if isinstance(key, ec.EllipticCurvePrivateKey):
self.priv_key = key
... | 0.004695 |
def is_ip(address):
"""
Returns True if address is a valid IP address.
"""
try:
# Test to see if already an IPv4/IPv6 address
address = netaddr.IPAddress(address)
return True
except (netaddr.AddrFormatError, ValueError):
return False | 0.003509 |
def init_value(self, string_value):
"""Create an empty defaultdict holding the default value.
"""
value = self.validate_value(string_value)
self._value = defaultdict(lambda: value) | 0.00939 |
def created(self):
"""Datetime at which the job was created.
:rtype: ``datetime.datetime``, or ``NoneType``
:returns: the creation time (None until set from the server).
"""
statistics = self._properties.get("statistics")
if statistics is not None:
millis = s... | 0.004338 |
def url(self):
"""
Constructs and returns the View URL.
:returns: View URL
"""
if self._partition_key:
base_url = self.design_doc.document_partition_url(
self._partition_key)
else:
base_url = self.design_doc.document_url
r... | 0.004796 |
def _decode_all_selective(data, codec_options, fields):
"""Decode BSON data to a single document while using user-provided
custom decoding logic.
`data` must be a string representing a valid, BSON-encoded document.
:Parameters:
- `data`: BSON data
- `codec_options`: An instance of
... | 0.000675 |
def guess_type_name(value):
'''
Guess the type name of a serialized value.
'''
value = str(value)
if value.upper() in ['TRUE', 'FALSE']:
return 'BOOLEAN'
elif re.match(r'(-)?(\d+)(\.\d+)', value):
return 'REAL'
elif re.match(r'(-)?(\d+)', value):
return... | 0.01217 |
def next(self):
"""
Handles the iteration by pulling the next line out of the stream,
attempting to convert the response to JSON if necessary.
:returns: Data representing what was seen in the feed
"""
while True:
if not self._resp:
self._start... | 0.003876 |
def get_module_at_address(self, address):
"""
@type address: int
@param address: Memory address to query.
@rtype: L{Module}
@return: C{Module} object that best matches the given address.
Returns C{None} if no C{Module} can be found.
"""
bases = self... | 0.003185 |
def include(self, path):
"""
Returns False if any pattern matches the path
:param path: str: filename path to test
:return: boolean: True if we should include this path
"""
for regex_item in self.regex_list:
if regex_item.match(path):
return Fa... | 0.005831 |
def enable_contactgroup_host_notifications(self, contactgroup):
"""Enable host notifications for a contactgroup
Format of the line that triggers function call::
ENABLE_CONTACTGROUP_HOST_NOTIFICATIONS;<contactgroup_name>
:param contactgroup: contactgroup to enable
:type contactg... | 0.005545 |
def terms(self):
"""Initialization terms and options for Property"""
terms = PropertyTerms(
self.name,
self.__class__,
self._args,
self._kwargs,
self.meta
)
return terms | 0.007663 |
def get_dump_type(value):
'''Get the libconfig datatype of a value
Return values: ``'d'`` (dict), ``'l'`` (list), ``'a'`` (array),
``'i'`` (integer), ``'i64'`` (long integer), ``'b'`` (bool),
``'f'`` (float), or ``'s'`` (string).
Produces the proper type for LibconfList, LibconfArray, LibconfInt64... | 0.001195 |
def make_key_url(self, key):
"""Gets a URL for a key."""
if type(key) is bytes:
key = key.decode('utf-8')
buf = io.StringIO()
buf.write(u'keys')
if not key.startswith(u'/'):
buf.write(u'/')
buf.write(key)
return self.make_url(buf.getvalue()... | 0.006231 |
async def providers():
"""
Iterates over all instances of analytics provider found in configuration
"""
for provider in settings.ANALYTICS_PROVIDERS:
cls: BaseAnalytics = import_class(provider['class'])
yield await cls.instance(*provider['args']) | 0.003584 |
def interp_head_addr(self):
"""Returns PtrTo(PtrTo(PyInterpreterState)) value"""
if self._interp_head_addr is not None:
return self._interp_head_addr
try:
interp_head_addr = self.get_interp_head_addr_through_symbol()
except SymbolNotFound:
logger.debug... | 0.005425 |
def get_files(dirname=None, pattern='*.*', recursive=True):
"""
Get all file names within a given directory those names match a
given pattern.
Parameters
----------
dirname : str | None
Directory containing the datafiles.
If None is given, open a dialog box.
pattern : str
... | 0.000844 |
def _serialize(
self, obj, fields_dict, error_store, many=False,
accessor=None, dict_class=dict, index_errors=True,
index=None,
):
"""Takes raw data (a dict, list, or other object) and a dict of
fields to output and serializes the data based on those fields.
:param o... | 0.003831 |
def validation_requests(self):
"""
Access the validation_requests
:returns: twilio.rest.api.v2010.account.validation_request.ValidationRequestList
:rtype: twilio.rest.api.v2010.account.validation_request.ValidationRequestList
"""
if self._validation_requests is None:
... | 0.010616 |
def _mpda(self, re_grammar, splitstring=0):
"""
Args:
re_grammar (list): A list of grammar rules
splitstring (bool): A boolean for enabling or disabling
the splitting of symbols using a space
Returns:
PDA: The generated PDA
... | 0.001235 |
def collect_related(self, finder_funcs, obj, count, *args, **kwargs):
"""
Collects objects related to ``obj`` using a list of ``finder_funcs``.
Stops when required count is collected or the function list is
exhausted.
"""
collected = []
for func in finder_funcs:
... | 0.003597 |
def get_arguments():
"""Get parsed arguments."""
parser = argparse.ArgumentParser("Lupupy: Command Line Utility")
parser.add_argument(
'-u', '--username',
help='Username',
required=False)
parser.add_argument(
'-p', '--password',
help='Password',
required... | 0.002457 |
def group_push(name, app, weight, **kwargs):
"""
Add application with its weight into the routing group.
Warning: application weight must be positive integer.
"""
ctx = Context(**kwargs)
ctx.execute_action('group:app:add', **{
'storage': ctx.repo.create_secure_service('storage'),
... | 0.002577 |
def all(self, *args, **kwargs):
"""
Gets all usage periods.
"""
return self.client._get(
self._url(),
{},
headers={
'x-contentful-enable-alpha-feature': 'usage-insights'
}
) | 0.007194 |
def _get_colordata(bs, elements, bs_projection):
"""
Get color data, including projected band structures
Args:
bs: Bandstructure object
elements: elements (in desired order) for setting to blue, red, green
bs_projection: None for no projection, "elements" for ... | 0.003383 |
def text_to_title(value):
"""when a title is required, generate one from the value"""
title = None
if not value:
return title
words = value.split(" ")
keep_words = []
for word in words:
if word.endswith(".") or word.endswith(":"):
keep_words.append(word)
i... | 0.001608 |
def GetEntries(self, parser_mediator, match=None, **unused_kwargs):
"""Extracts relevant Airport entries.
Args:
parser_mediator (ParserMediator): mediates interactions between parsers
and other components, such as storage and dfvfs.
match (Optional[dict[str: object]]): keys extracted from... | 0.009281 |
def set_inteface_up(ifindex, auth, url, devid=None, devip=None):
"""
function takest devid and ifindex of specific device and interface and issues a RESTFUL call
to "undo shut" the specified interface on the target device.
:param devid: int or str value of the target device
:param devip: ipv4 addr... | 0.00558 |
def cluster_replicate(self, node_id):
"""Reconfigure a node as a slave of the specified master node."""
fut = self.execute(b'CLUSTER', b'REPLICATE', node_id)
return wait_ok(fut) | 0.00995 |
def delete_collection_namespaced_service_account(self, namespace, **kwargs):
"""
delete collection of ServiceAccount
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.delete_collection_namesp... | 0.002733 |
def getAll(self, deviceUid):
"""
Retrieves a list of the last cached message for all events from a specific device.
"""
if not isinstance(deviceUid, DeviceUid) and isinstance(deviceUid, dict):
deviceUid = DeviceUid(**deviceUid)
url = "api/v0002/device/types/%s/devic... | 0.007962 |
def gyro_calibration(self):
"""Perform gyroscope calibration for current IMU."""
QtWidgets.QMessageBox.information(self, 'Gyro calibration', 'Ensure the selected IMU is in a stable, unmoving position, then click OK. Don\'t move the the IMU for a few seconds')
self.calibration_state = self.CAL_GY... | 0.008929 |
def iter(self):
"""
Iterate over the sequences in the files in self.files_, yielding each
as an instance of the desired read class.
"""
for _file in self._files:
with asHandle(_file) as fp:
# Use FastqGeneralIterator because it provides access to
... | 0.003049 |
def _get_client():
'''
Return a cloud client
'''
client = salt.cloud.CloudClient(
os.path.join(os.path.dirname(__opts__['conf_file']), 'cloud'),
pillars=copy.deepcopy(__pillar__.get('cloud', {}))
)
return client | 0.003984 |
def fromfile(self, path_to_file, mimetype=None):
"""
load blob content from file in StorageBlobModel instance. Parameters are:
- path_to_file (required): path to a local file
- mimetype (optional): set a mimetype. azurestoragewrap will guess it if not given
"""
if os.... | 0.009608 |
def _get_loader_for_url(self, url):
"""
Determine loading method based on uri
"""
parts = url.split('://', 1)
if len(parts) < 2:
type_ = 'file'
else:
type_ = parts[0]
if '+' in type_:
profile_name, scheme = type_.split('+', 1)
... | 0.002123 |
def _count_objs(self, obj, path=None, **kwargs):
"""
cycles through the object and adds in count values
Args:
-----
obj: the object to parse
path: the current path
kwargs:
-------
current: a dictionary of counts for current call
... | 0.001096 |
def triplifyOverallStructures(self):
"""Insert into RDF graph the textual and network structures.
Ideally, one should be able to make bag of words related to
each item (communities, users, posts, comments, tags, etc).
Interaction and friendship networks should be made.
Human net... | 0.003367 |
def append_all_below(destination, source, join_str=None):
"""
Compared to xml.dom.minidom, lxml's treatment of text as .text and .tail
attributes of elements is an oddity. It can even be a little frustrating
when one is attempting to copy everything underneath some element to
another element; one ha... | 0.002264 |
def save_model(self, net):
"""Save the model.
This function saves some or all of the following:
- model parameters;
- optimizer state;
- training history;
- entire model object.
"""
if self.f_params is not None:
f = self._format_targe... | 0.002198 |
def update_states_geo_zone_by_id(cls, states_geo_zone_id, states_geo_zone, **kwargs):
"""Update StatesGeoZone
Update attributes of StatesGeoZone
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async=True
>>> thread = api... | 0.007073 |
def _get_client(profile):
'''
Return the GitHub client, cached into __context__ for performance
'''
token = _get_config_value(profile, 'token')
key = 'github.{0}:{1}'.format(
token,
_get_config_value(profile, 'org_name')
)
if key not in __context__:
__context__[key] ... | 0.002392 |
def get_publisher_name(self, **kwargs):
"""Get the publisher name."""
children = kwargs.get('children', [])
# Find the creator type in children.
for child in children:
if child.tag == 'name':
return child.content
return None | 0.006849 |
def ismatch(self, s):
""" like compiled_re.match() but returns True or False """
if self._ismatchfun(s) and self._compiled_pattern.match(s):
return True
return False | 0.00995 |
def search(self, string, pos=0, endpos=None, evaluate_result=True):
'''Search the string for my format.
Optionally start the search at "pos" character index and limit the
search to a maximum index of endpos - equivalent to
search(string[:endpos]).
If the ``evaluate_result`` arg... | 0.002548 |
def render_ditaa(self, code, options, prefix='ditaa'):
"""Render ditaa code into a PNG output file."""
hashkey = code.encode('utf-8') + str(options) + \
str(self.builder.config.ditaa) + \
str(self.builder.config.ditaa_args)
infname = '%s-%s.%s' % (prefix, sha(hashkey).hexdigest()... | 0.003304 |
def join_sys_path(currfile, dir_level_num=3):
"""
find certain path then load into sys path
"""
if os.path.isdir(currfile):
root_path = currfile
else:
root_path = get_base_dir(currfile, dir_level_num)
sys.path.append(root_path) | 0.003731 |
def _coltype_to_typeengine(coltype: Union[TypeEngine,
VisitableType]) -> TypeEngine:
"""
An example is simplest: if you pass in ``Integer()`` (an instance of
:class:`TypeEngine`), you'll get ``Integer()`` back. If you pass in
``Integer`` (an instance of :class:`... | 0.001661 |
def erase(self, addresses=None):
"""! @brief Perform the type of erase operation selected when the object was created.
For sector erase mode, an iterable of sector addresses specifications must be provided via
the _addresses_ parameter. The address iterable elements can be either string... | 0.009838 |
def name_resolve(self, name=None, recursive=False,
nocache=False, **kwargs):
"""Gets the value currently published at an IPNS name.
IPNS is a PKI namespace, where names are the hashes of public keys, and
the private key enables publishing new (signed) values. In resolve, th... | 0.002449 |
def sender(url, **kwargs):
"""
Return sender instance from connection url string
url <str> connection url eg. 'tcp://0.0.0.0:8080'
"""
res = url_to_resources(url)
fnc = res["sender"]
return fnc(res.get("url"), **kwargs) | 0.004016 |
def indicator_body(self, indicators):
"""Generate the appropriate dictionary content for POST of a **single** indicator.
For an Address indicator a list with a single IP Address and for File indicators a list of
1 up to 3 hash values. Custom indicators fields have to be in the correct order (e... | 0.007519 |
def run_migrations_online():
"""Run migrations in 'online' mode.
In this scenario we need to create an Engine
and associate a connection with the context.
"""
app_conf = dci_config.generate_conf()
connectable = dci_config.get_engine(app_conf)
with connectable.connect() as connection:
... | 0.001957 |
def check_requirements(script_path, requirements_file = None):
"""
Check versions of opinel and boto3
:param script_path:
:return:
"""
script_dir = os.path.dirname(script_path)
opinel_min_version = opinel_max_version = boto3_min_version = boto3_max_version = None
# Requirements file is e... | 0.004008 |
def GetAccountDetails(alias=None):
"""Return account details dict associated with the provided alias."""
if not alias: alias = Account.GetAlias()
r = clc.v1.API.Call('post','Account/GetAccountDetails',{'AccountAlias': alias})
if r['Success'] != True:
if clc.args: clc.v1.output.Status('ERROR',3,'Error call... | 0.04023 |
def add_choice(self, setting, choices):
'''add a choice input line'''
tab = self.panel(setting.tab)
default = setting.value
if default is None:
default = choices[0]
ctrl = wx.ComboBox(tab, -1, choices=choices,
value = str(default),
... | 0.018561 |
def get(self):
'''
This handles GET requests for the current checkplot-list.json file.
Used with AJAX from frontend.
'''
# add the reviewed key to the current dict if it doesn't exist
# this will hold all the reviewed objects for the frontend
if 'reviewed' not ... | 0.004132 |
def create_resource(model, session_handler, resource_bases=(CRUDL,),
relationships=None, links=None, preprocessors=None,
postprocessors=None, fields=None, paginate_by=100,
auto_relationships=True, pks=None, create_fields=None,
update_fields... | 0.002574 |
def extract(args):
"""
%prog extract idsfile sizesfile
Extract the lines containing only the given IDs.
"""
p = OptionParser(extract.__doc__)
opts, args = p.parse_args(args)
if len(args) != 2:
sys.exit(not p.print_help())
idsfile, sizesfile = args
sizes = Sizes(sizesfile).... | 0.002092 |
def setCredentials(self, username, password):
"""
Sets authentication credentials for accessing the remote gateway.
"""
self.addHeader('Credentials', dict(userid=username.decode('utf-8'),
password=password.decode('utf-8')), True) | 0.010989 |
def get_dtype(data):
"""
Checks what the data type is and returns it as a string label
"""
import six
from ..datageometry import DataGeometry
if isinstance(data, list):
return 'list'
elif isinstance(data, np.ndarray):
return 'arr'
elif isinstance(data, pd.DataFrame):
... | 0.002825 |
def check_meta(pfeed, *, as_df=False, include_warnings=False):
"""
Analog of :func:`check_frequencies` for ``pfeed.meta``
"""
table = 'meta'
problems = []
# Preliminary checks
if pfeed.meta is None:
problems.append(['error', 'Missing table', table, []])
else:
f = pfeed.m... | 0.002935 |
def mute(self):
"""bool: The speaker's mute state.
True if muted, False otherwise.
"""
response = self.renderingControl.GetMute([
('InstanceID', 0),
('Channel', 'Master')
])
mute_state = response['CurrentMute']
return bool(int(mute_state)... | 0.006231 |
def make_extra_json_fields(args):
"""
From the parsed command-line arguments, generate a dictionary of additional
fields to be inserted into JSON logs (logstash_formatter module)
"""
extra_json_fields = {
'data_group': _get_data_group(args.query),
'data_type': _get_data_type(args.que... | 0.001667 |
def bbox(self):
"""
The bounding box for nodes in this network [xmin, ymin, xmax, ymax]
"""
return [self.nodes_df.x.min(), self.nodes_df.y.min(),
self.nodes_df.x.max(), self.nodes_df.y.max()] | 0.008368 |
def example():
"""
example that plots the power spectrum of Mars topography data
"""
# --- input data filename ---
infile = os.path.join(os.path.dirname(__file__),
'../../ExampleDataFiles/MarsTopo719.shape')
coeffs, lmax = shio.shread(infile)
# --- plot grid ---
... | 0.000918 |
def set_mode(self, mode):
"""
:Parameters:
`mode` : *(int)*
New mode, must be one of:
- `StreamTokenizer.STRICT_MIN_LENGTH`
- `StreamTokenizer.DROP_TRAILING_SILENCE`
- `StreamTokenizer.STRICT_MIN_LENGTH | StreamTokenizer.DROP_TRAILING_... | 0.006068 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.