text stringlengths 78 104k | score float64 0 0.18 |
|---|---|
def restricted_to_files(self,
filenames: List[str]
) -> 'Spectra':
"""
Returns a variant of this spectra that only contains entries for
lines that appear in any of the files whose name appear in the
given list.
"""
t... | 0.008065 |
def get_cpu_info():
'''
Returns the CPU info by using the best sources of information for your OS.
Returns the result in a dict
'''
import json
output = get_cpu_info_json()
# Convert JSON to Python with non unicode strings
output = json.loads(output, object_hook = _utf_to_str)
return output | 0.039474 |
def sendcmd(self, cmd='AT', timeout=1.0):
"""send command, wait for response. returns response from modem."""
import time
if self.write(cmd):
while self.get_response() == '' and timeout > 0:
time.sleep(0.1)
timeout -= 0.1
return self.get_lines(... | 0.006231 |
def check_dimensionless_vertical_coordinate(self, ds):
'''
Check the validity of dimensionless coordinates under CF
CF §4.3.2 The units attribute is not required for dimensionless
coordinates.
The standard_name attribute associates a coordinate with its definition
from ... | 0.002438 |
def from_(self, pct_pts):
"""Reverse of :meth:`to_`."""
pct_pts = np.asarray(pct_pts, dtype=np.float)
has_z = (pct_pts.shape[-1] > 2)
max_pt = list(self.viewer.get_window_size())
if has_z:
max_pt.append(0.0)
win_pts = np.multiply(pct_pts, max_pt)
# ... | 0.00431 |
def normpdf(x, mu, sigma):
"""
Describes the relative likelihood that a real-valued random variable X will
take on a given value.
http://en.wikipedia.org/wiki/Probability_density_function
"""
u = (x-mu)/abs(sigma)
y = (1/(math.sqrt(2*pi)*abs(sigma)))*math.exp(-u*u/2)
return y | 0.00639 |
def split_full_path(path):
"""Return pair of bucket without protocol and path
Arguments:
path - valid S3 path, such as s3://somebucket/events
>>> split_full_path('s3://mybucket/path-to-events')
('mybucket', 'path-to-events/')
>>> split_full_path('s3://mybucket')
('mybucket', None)
>>> ... | 0.001185 |
def check(self):
"""
Checks the status of the stop exposure command
This is run in background and can take a few seconds
"""
g = get_root(self).globals
if self.stopped_ok:
# Exposure stopped OK; modify buttons
self.disable()
# try and ... | 0.001346 |
def update(self):
"""Update |WZ| based on |RelWZ| and |NFk|.
>>> from hydpy.models.lland import *
>>> parameterstep('1d')
>>> nhru(2)
>>> lnk(ACKER)
>>> relwz(0.8)
>>> nfk(100.0, 200.0)
>>> derived.wz.update()
>>> derived.wz
wz(80.0, 160.0... | 0.004938 |
def make_wrapper(self, callable_):
"""Given a free-standing function 'callable', return a new
callable that will call 'callable' and report all exceptins,
using 'call_and_report_errors'."""
assert callable(callable_)
def wrapper(*args, **kw):
return self.call_and_repo... | 0.007979 |
def restart(self, key):
"""Restart a previously finished entry."""
if key in self.queue:
if self.queue[key]['status'] in ['failed', 'done']:
new_entry = {'command': self.queue[key]['command'],
'path': self.queue[key]['path']}
self.... | 0.004808 |
def is_valid_vpnv4_prefix(prefix):
"""Returns True if given prefix is a string represent vpnv4 prefix.
Vpnv4 prefix is made up of RD:Ipv4, where RD is represents route
distinguisher and Ipv4 represents valid dot-decimal ipv4 notation string.
"""
if not isinstance(prefix, str):
return False
... | 0.001515 |
def _read_extensions(self, context):
"""Return list of extensions as str to be passed on to the Jinja2 env.
If context does not contain the relevant info, return an empty
list instead.
"""
try:
extensions = context['cookiecutter']['_extensions']
except KeyErr... | 0.004866 |
def _program_dcnm_static_route(self, tenant_id, tenant_name):
"""Program DCNM Static Route. """
in_ip_dict = self.get_in_ip_addr(tenant_id)
in_gw = in_ip_dict.get('gateway')
in_ip = in_ip_dict.get('subnet')
if in_gw is None:
LOG.error("No FW service GW present")
... | 0.001417 |
def sample_stats_to_xarray(self):
"""Extract sample_stats from tfp trace."""
if self.model_fn is None or self.observed is None:
return None
log_likelihood = []
sample_size = self.posterior[0].shape[0]
for i in range(sample_size):
variables = {}
... | 0.003687 |
def _get_dict_default(obj, key):
"""
obj MUST BE A DICT
key IS EXPECTED TO BE LITERAL (NO ESCAPING)
TRY BOTH ATTRIBUTE AND ITEM ACCESS, OR RETURN Null
"""
try:
return obj[key]
except Exception as f:
pass
try:
if float(key) == round(float(key), 0):
ret... | 0.002451 |
def _create_fit_summary(self):
"""
Create and store a pandas series that will display to users the
various statistics/values that indicate how well the estimated model
fit the given dataset.
Returns
-------
None.
"""
# Make sure we have all attrib... | 0.001007 |
def sum_mags(mags, weights=None):
"""
Sum an array of magnitudes in flux space.
Parameters:
-----------
mags : array of magnitudes
weights : array of weights for each magnitude (i.e. from a pdf)
Returns:
--------
sum_mag : the summed magnitude of all the stars
"""
fl... | 0.004115 |
def website_exists_as_secure(self, website):
"""" Return true if the website has an equivalent that is secure
we will have 2 websites with the same name, one insecure (that will contain just
the redirect and the identity-verification) and one secured
"""
if website['https... | 0.005706 |
def publish(self, value):
"""
Accepts: int, long
Returns: int, long
"""
value = super(Integer, self).publish(value)
if isinstance(value, float):
value = int(value)
if not isinstance(value, (int, long)):
raise ValueError("Not an integer: %r"... | 0.00565 |
def detect_mode(term_hint="xterm-256color"):
"""Poor-mans color mode detection."""
if "ANSICON" in os.environ:
return 16
elif os.environ.get("ConEmuANSI", "OFF") == "ON":
return 256
else:
term = os.environ.get("TERM", term_hint)
if term.endswith("-256color") or term in ("... | 0.002088 |
def parse(self):
"""Parse the data."""
if self._filename:
with open(self._filename) as ifile:
self._data = ifile.read()
with QasmParser(self._filename) as qasm_p:
qasm_p.parse_debug(False)
return qasm_p.parse(self._data) | 0.006734 |
def register_signals(self):
"""Register signals."""
from .models import Collection
from .receivers import CollectionUpdater
if self.app.config['COLLECTIONS_USE_PERCOLATOR']:
from .percolator import collection_inserted_percolator, \
collection_removed_percolat... | 0.00181 |
def _list_tables(self, max_results=None, marker=None, timeout=None):
'''
Returns a list of tables under the specified account. Makes a single list
request to the service. Used internally by the list_tables method.
:param int max_results:
The maximum number of tables to retu... | 0.004065 |
def rename_annotations(self, sentence):
"""Function that renames and restructures clause information."""
annotations = []
for token in sentence:
data = {CLAUSE_IDX: token[CLAUSE_IDX]}
if CLAUSE_ANNOT in token:
if 'KINDEL_PIIR' in token[CLAUSE_ANNOT]:
... | 0.002894 |
def _paths_must_exists(path):
"""
Raises error if path doesn't exist.
:param path: str path to check
:return: str same path passed in
"""
path = to_unicode(path)
if not os.path.exists(path):
raise argparse.ArgumentTypeError("{} is not a valid file/folder.".format(path))
return pa... | 0.006211 |
def _satisfyVersionByInstallingVersion(name, version_required, working_directory, version, type='module', inherit_shrinkwrap=None):
''' installs and returns a Component/Target for the specified version requirement into
'working_directory' using the provided remote version object.
This function is no... | 0.006146 |
def pause(self):
"""Pause the sampler. Sampling can be resumed by calling `icontinue`.
"""
self.status = 'paused'
# The _loop method will react to 'paused' status and stop looping.
if hasattr(
self, '_sampling_thread') and self._sampling_thread.isAlive():
... | 0.004415 |
def create_keyspace_network_topology(name, dc_replication_map, durable_writes=True, connections=None):
"""
Creates a keyspace with NetworkTopologyStrategy for replica placement
If the keyspace already exists, it will not be modified.
**This function should be used with caution, especially in productio... | 0.006565 |
def imei(number):
'''
Printable International Mobile Station Equipment Identity (IMEI) numbers.
:param number: string or int
>>> print(imei(12345678901234))
12-345678-901234-7
>>> print(imei(1234567890123456))
12-345678-901234-56
'''
number = to_decimal(number)
length = len(num... | 0.001475 |
def normal_cdf(x, mu=0, sigma=1):
"""Cumulative Normal Distribution Function.
:param x: scalar or array of real numbers.
:type x: numpy.ndarray, float
:param mu: Mean value. Default 0.
:type mu: float, numpy.ndarray
:param sigma: Standard deviation. Default 1.
:type sigma: float
:ret... | 0.008696 |
def _valid_atoms(model, expression):
"""Check whether a sympy expression references the correct variables.
Parameters
----------
model : cobra.Model
The model in which to check for variables.
expression : sympy.Basic
A sympy expression.
Returns
-------
boolean
T... | 0.001916 |
def insertions_from_masked(seq):
"""
get coordinates of insertions from insertion-masked sequence
"""
insertions = []
prev = True
for i, base in enumerate(seq):
if base.isupper() and prev is True:
insertions.append([])
prev = False
elif base.islower():
... | 0.002283 |
def to_tile(self, zoom):
""" Converts EPSG:900913 to tile coordinates in given zoom level """
p1 = self.min.to_tile(zoom)
p2 = self.max.to_tile(zoom)
return GridBB(zoom, p1.x, p2.y, p2.x, p1.y) | 0.008889 |
def column_signs_(self):
"""
Return a numpy array with expected signs of features.
Values are
* +1 when all known terms which map to the column have positive sign;
* -1 when all known terms which map to the column have negative sign;
* ``nan`` when there are both positiv... | 0.00321 |
def p_continue_statement_2(self, p):
"""continue_statement : CONTINUE identifier SEMI
| CONTINUE identifier AUTOSEMI
"""
p[0] = self.asttypes.Continue(p[2])
p[0].setpos(p) | 0.008584 |
def find_eigen(hint=None):
r'''
Try to find the Eigen library. If successful the include directory is returned.
'''
# search with pkgconfig
# ---------------------
try:
import pkgconfig
if pkgconfig.installed('eigen3','>3.0.0'):
return pkgconfig.parse('eigen3')['include_dirs'][0]
except:
... | 0.019011 |
def create_instance(self, image_id, pem_file, group_ids, instance_type, volume_type='gp2', ebs_optimized=False, instance_monitoring=False, iam_profile='', tag_list=None, auction_bid=0.0):
'''
a method for starting an instance on AWS EC2
:param image_id: string with aws id of im... | 0.005733 |
def process_response(self):
"""
Parses an HTTP response after an HTTP request is sent
"""
split_response = self.response.split(self.CRLF)
response_line = split_response[0]
response_headers = {}
response_data = None
data_line = None
for line_num in ... | 0.000562 |
def set(cls, prop, value):
""" Set the value of the given configuration property.
:param prop: (string) name of the property
:param value: (object) value to set
"""
if cls._properties is None:
cls._readStdConfigFiles()
cls._properties[prop] = str(value) | 0.006993 |
def describe(self, tablename, refresh=False, metrics=False, require=False):
""" Get the :class:`.TableMeta` for a table """
table = self.cached_descriptions.get(tablename)
if refresh or table is None or (metrics and not table.consumed_capacity):
desc = self.connection.describe_table(... | 0.004836 |
def delete_collection_percolator(target):
"""Delete percolator associated with the new collection.
:param target: Collection where the percolator was attached.
"""
for name in current_search.mappings.keys():
if target.name and target.dbquery:
current_search.client.delete(
... | 0.002101 |
def datetime_to_iso(date, only_date=True):
""" Convert datetime format to ISO 8601 time format
This function converts a date in datetime instance, e.g. ``datetime.datetime(2017,9,14,0,0)`` to ISO format,
e.g. ``2017-09-14``
:param date: datetime instance to convert
:type date: datetime
:param ... | 0.005146 |
def set_color(fg=None, bg=None):
"""Set the current colors.
If no arguments are given, sets default colors.
"""
if fg or bg:
_color_manager.set_color(fg, bg)
else:
_color_manager.set_defaults() | 0.004329 |
def random_string(length):
'''
Generate random string with parameter length.
Example:
>>> from eggit.egg_string import random_string
>>> random_string(8)
'q4f2eaT4'
>>>
'''
str_list = [random.choice(string.digits + string.ascii_letters) for i in range(length)]
... | 0.005814 |
def write_report(self, force=False):
'''
Writes the report to a file.
'''
path = self.title + '.html'
value = self._template.format(
title=self.title, body=self.body, sidebar=self.sidebar)
write_file(path, value, force=force)
plt.ion() | 0.006601 |
def class_traits(cls, **metadata):
"""Get a list of all the traits of this class.
This method is just like the :meth:`traits` method, but is unbound.
The TraitTypes returned don't know anything about the values
that the various HasTrait's instances are holding.
This follows th... | 0.003328 |
def overall_MCC_calc(classes, table, TOP, P):
"""
Calculate Overall_MCC.
:param classes: classes
:type classes : list
:param table: input matrix
:type table : dict
:param TOP: test outcome positive
:type TOP : dict
:param P: condition positive
:type P : dict
:return: Overal... | 0.00133 |
async def search(self, q: str, *, types: Optional[Iterable[str]] = ['track', 'playlist', 'artist', 'album'], limit: Optional[int] = 20, offset: Optional[int] = 0, market: Optional[str] = None) -> Dict[str, List[Union[Track, Playlist, Artist, Album]]]:
"""Access the spotify search functionality.
Paramet... | 0.00458 |
def parse_host_port(host_port):
"""
Takes a string argument specifying host or host:port.
Returns a (hostname, port) or (ip_address, port) tuple. If no port is given,
the second (port) element of the returned tuple will be None.
host:port argument, for example, is accepted in the forms of:
-... | 0.0023 |
def _validate_virtualbox(self):
'''
a method to validate that virtualbox is running on Win 7/8 machines
:return: boolean indicating whether virtualbox is running
'''
# validate operating system
if self.localhost.os.sysname != 'Windows':
return Fal... | 0.005119 |
def respond_unauthorized(self, request_authentication=False):
"""
Respond to the client that the request is unauthorized.
:param bool request_authentication: Whether to request basic authentication information by sending a WWW-Authenticate header.
"""
headers = {}
if request_authentication:
headers['WWW... | 0.027426 |
def get_by_id(self, institution_id, _options=None):
'''
Fetch a single institution by id.
:param str institution_id:
'''
options = _options or {}
return self.client.post_public_key('/institutions/get_by_id', {
'institution_id': institution_id,
... | 0.005666 |
def search(self, start_ts, end_ts):
"""Searches through all documents and finds all documents that were
modified or deleted within the range.
Since we have very few documents in the doc dict when this is called,
linear search is fine. This method is only used by rollbacks to query
... | 0.002342 |
def interpolate_slice(slice_rows, slice_cols, interpolator):
"""Interpolate the given slice of the larger array."""
fine_rows = np.arange(slice_rows.start, slice_rows.stop, slice_rows.step)
fine_cols = np.arange(slice_cols.start, slice_cols.stop, slice_cols.step)
return interpolator(fine_cols, fine_rows... | 0.003115 |
def put_annotation(self, key, value):
"""
Annotate segment or subsegment with a key-value pair.
Annotations will be indexed for later search query.
:param str key: annotation key
:param object value: annotation value. Any type other than
string/number/bool will be dr... | 0.006452 |
def get_sub_electrodes(self, adjacent_only=True):
"""
If this electrode contains multiple voltage steps, then it is possible
to use only a subset of the voltage steps to define other electrodes.
For example, an LiTiO2 electrode might contain three subelectrodes:
[LiTiO2 --> TiO2,... | 0.001471 |
def _getRunningApps(cls):
"""Get a list of the running applications."""
def runLoopAndExit():
AppHelper.stopEventLoop()
AppHelper.callLater(1, runLoopAndExit)
AppHelper.runConsoleEventLoop()
# Get a list of running applications
ws = AppKit.NSWorkspace.shared... | 0.005115 |
def get_visible_commands(self) -> List[str]:
"""Returns a list of commands that have not been hidden or disabled."""
commands = self.get_all_commands()
# Remove the hidden commands
for name in self.hidden_commands:
if name in commands:
commands.remove(name)
... | 0.004016 |
def Operate(self, values):
"""Takes a list of values and if at least one matches, returns True."""
for val in values:
try:
if self.Operation(val, self.right_operand):
return True
except (TypeError, ValueError):
pass
return False | 0.014337 |
def check(self, func=None, name=None):
"""
A decorator to register a new Dockerflow check to be run
when the /__heartbeat__ endpoint is called., e.g.::
from dockerflow.flask import checks
@dockerflow.check
def storage_reachable():
try:
... | 0.001603 |
def record(self, i=0):
"""Returns a specific dbf record based on the supplied index."""
f = self.__getFileObj(self.dbf)
if not self.numRecords:
self.__dbfHeader()
i = self.__restrictIndex(i)
recSize = self.__recordFmt()[1]
f.seek(0)
f.seek(self... | 0.005141 |
def from_json(cls, json_moc):
"""
Creates a MOC from a dictionary of HEALPix cell arrays indexed by their depth.
Parameters
----------
json_moc : dict(str : [int]
A dictionary of HEALPix cell arrays indexed by their depth.
Returns
-------
moc... | 0.003247 |
def set_mindays(name, mindays):
'''
Set the minimum number of days between password changes. See man passwd.
CLI Example:
.. code-block:: bash
salt '*' shadow.set_mindays username 7
'''
pre_info = info(name)
if mindays == pre_info['min']:
return True
cmd = 'passwd -n {... | 0.00189 |
def login(username=None, password=None):
"""
Log in to PNC using the supplied username and password. The keycloak token will
be saved for all subsequent pnc-cli operations until login is called again
:return:
"""
global user
user = UserConfig()
if username:
user.username = userna... | 0.006964 |
def hashify_targets(targets: list, build_context) -> list:
"""Return sorted hashes of `targets`."""
return sorted(build_context.targets[target_name].hash(build_context)
for target_name in listify(targets)) | 0.004329 |
def fetch_project(self, project_id):
"""Fetch an existing project and it's relevant metadata by ID.
.. note::
If the project does not exist, this will raise a
:class:`NotFound <google.cloud.exceptions.NotFound>` error.
:type project_id: str
:param project_id: T... | 0.003063 |
def find_best_step(err_vals):
"""
Returns the index of the lowest of the passed values. Catches nans etc.
"""
if np.all(np.isnan(err_vals)):
raise ValueError('All err_vals are nans!')
return np.nanargmin(err_vals) | 0.004149 |
def dumps(obj, **kwargs):
"""
Serialize `obj`, which may contain :class:`JsonRef` objects, to a JSON
formatted string. `JsonRef` objects will be dumped as the original
reference object they were created from.
:param obj: Object to serialize
:param kwargs: Keyword arguments are the same as to :f... | 0.002174 |
def _did_timeout(self):
""" Called when a resquest has timeout """
bambou_logger.debug('Bambou %s on %s has timeout (timeout=%ss)..' % (self._request.method, self._request.url, self.timeout))
self._has_timeouted = True
if self.async:
self._callback(self)
else:
... | 0.011834 |
def numpymat2df(mat):
"""
Sometimes (though not very often) it is useful to convert a numpy matrix
which has no column names to a Pandas dataframe for use of the Pandas
functions. This method converts a 2D numpy matrix to Pandas dataframe
with default column headers.
Parameters
----------
... | 0.001647 |
async def get(self, request, resource=None, **kwargs):
"""Get resource or collection of resources.
---
parameters:
- name: resource
in: path
type: string
"""
if resource is not None and resource != '':
return self.to_simple(re... | 0.004717 |
def draw_court(ax=None, color='gray', lw=1, outer_lines=False):
"""Returns an axes with a basketball court drawn onto to it.
This function draws a court based on the x and y-axis values that the NBA
stats API provides for the shot chart data. For example the center of the
hoop is located at the (0,0) ... | 0.00027 |
def init(name, *args, **kwargs):
"""Instantiate a timeframe from the catalog.
"""
if name in _TIMEFRAME_CATALOG:
if rapport.config.get_int("rapport", "verbosity") >= 2:
print("Initialize timeframe {0}: {1} {2}".format(name, args, kwargs))
try:
return _TIMEFRAME_CATALO... | 0.006667 |
def line_to(self, x, y):
"""Adds a line to the path from the current point
to position ``(x, y)`` in user-space coordinates.
After this call the current point will be ``(x, y)``.
If there is no current point before the call to :meth:`line_to`
this method will behave as ``context... | 0.003373 |
def setup_actions(self):
""" Connects slots to signals """
self.actionOpen.triggered.connect(self.on_open)
self.actionNew.triggered.connect(self.on_new)
self.actionSave.triggered.connect(self.on_save)
self.actionSave_as.triggered.connect(self.on_save_as)
self.actionQuit.t... | 0.005736 |
def _get_locations(self, calc):
"""Locate locations within the profile."""
return (self._location_in(calc.profile),
self._location_out(calc.profile)) | 0.01105 |
def controls(self, timeline_slider_args={}, toggle_args={}):
"""Creates interactive controls for the animation
Creates both a play/pause button, and a time slider at once
Parameters
----------
timeline_slider_args : Dict, optional
A dictionary of arguments to be pas... | 0.003676 |
def setup(self):
"""
Do any setup work needed to run i3status modules
"""
for conf_name in self.py3_config["i3s_modules"]:
module = I3statusModule(conf_name, self)
self.i3modules[conf_name] = module
if module.is_time_module:
self.time_m... | 0.005865 |
def export_module_spec(spec, path, checkpoint_path, name_transform_fn):
"""Helper function to ModuleSpec.export()."""
with tf.Graph().as_default():
m = Module(spec)
assign_map = {
name_transform_fn(name): value for name, value in m.variable_map.items()
}
tf_v1.train.init_from_checkpoint(chec... | 0.012245 |
def create_service(self, *args, **kwargs):
"""Create a service to current scope.
See :class:`pykechain.Client.create_service` for available parameters.
.. versionadded:: 1.13
"""
return self._client.create_service(*args, scope=self.id, **kwargs) | 0.006969 |
def update_endpoint(self, updated_ed):
"""
Update a previously advertised endpoint_description.
:param endpoint_description: an instance of EndpointDescription to
update. Must not be None.
:return: True if advertised, False if not
(e.g. it's already been advertised)
... | 0.002587 |
def perform_command(self):
"""
Perform command and return the appropriate exit code.
:rtype: int
"""
if len(self.actual_arguments) < 1:
return self.print_help()
audio_file_path = self.actual_arguments[0]
try:
audiofile = AudioFile(audio_f... | 0.005376 |
def inv(z: int) -> int:
"""$= z^{-1} mod q$, for z != 0"""
# Adapted from curve25519_athlon.c in djb's Curve25519.
z2 = z * z % q # 2
z9 = pow2(z2, 2) * z % q # 9
z11 = z9 * z2 % q # 11
z2_5_0 = (z11 * z11) % q * z9 % q # 31 == 2^5 - 2^0
z2_10_0 = pow2(z2_5_0, 5) * z2_5_0 % q # 2^10 - 2... | 0.001502 |
def IP_verified(directory,
extensions_to_ignore=None,
directories_to_ignore=None,
files_to_ignore=None,
verbose=False):
"""Find and audit potential data files that might violate IP
This is the public function to be used to ascertain that
all d... | 0.004431 |
def draw(self, size=None, background_threshold=0.01, background_class_id=None, colors=None,
return_foreground_mask=False):
"""
Render the segmentation map as an RGB image.
Parameters
----------
size : None or float or iterable of int or iterable of float, optional
... | 0.005045 |
def entry_point(args=None, configuration=None):
"""
Standard entry point for the docker interface CLI.
Parameters
----------
args : list or None
list of command line arguments or `None` to use `sys.argv`
configuration : dict
parsed configuration or `None` to load and build a con... | 0.002401 |
def _on_channel_open(self, channel):
"""
Callback used when a channel is opened.
This registers all the channel callbacks.
Args:
channel (pika.channel.Channel): The channel that successfully opened.
"""
channel.add_on_close_callback(self._on_channel_close)
... | 0.006696 |
def _show_prompt(self, prompt=None, html=False, newline=True):
""" Writes a new prompt at the end of the buffer.
Parameters
----------
prompt : str, optional
The prompt to show. If not specified, the previous prompt is used.
html : bool, optional (default False)
... | 0.002087 |
def __version(client):
'''
Grab DRAC version
'''
versions = {9: 'CMC',
8: 'iDRAC6',
10: 'iDRAC6',
11: 'iDRAC6',
16: 'iDRAC7',
17: 'iDRAC7'}
if isinstance(client, paramiko.SSHClient):
(stdin, stdout, stderr) = cl... | 0.003711 |
async def edit(self, *, reason=None, **options):
"""|coro|
Edits the channel.
You must have the :attr:`~Permissions.manage_channels` permission to
use this.
Parameters
----------
name: :class:`str`
The new category's name.
position: :class:`... | 0.003303 |
def delete_many(cls, documents):
"""Delete multiple documents"""
# Ensure all documents have been converted to frames
frames = cls._ensure_frames(documents)
all_count = len(documents)
assert len([f for f in frames if '_id' in f._document]) == all_count, \
"Can't... | 0.00431 |
def fit_multinest(self, n_live_points=1000, basename=None,
verbose=True, refit=False, overwrite=False,
test=False,
**kwargs):
"""
Fits model using MultiNest, via pymultinest.
:param n_live_points:
Number of live point... | 0.004496 |
def print_value(value: Any, type_: GraphQLInputType) -> str:
"""Convenience function for printing a Python value"""
return print_ast(ast_from_value(value, type_)) | 0.005882 |
def _parse_guild_members(self, parsed_content):
"""
Parses the guild's member and invited list.
Parameters
----------
parsed_content: :class:`bs4.Tag`
The parsed content of the guild's page
"""
member_rows = parsed_content.find_all("tr", {'bgcolor': [... | 0.004071 |
def readline(self, size=None):
"""Read a single line from rfile buffer and return it.
Args:
size (int): minimum amount of data to read
Returns:
bytes: One line from rfile.
"""
if size is not None:
data = self.rfile.readline(size)
... | 0.00232 |
def lookup_subclass(cls, d):
"""Look up a class based on a serialized dictionary containing a typeid
Args:
d (dict): Dictionary with key "typeid"
Returns:
Serializable subclass
"""
try:
typeid = d["typeid"]
except KeyError:
... | 0.003509 |
def return_hdr(self):
"""Return the header for further use.
Returns
-------
subj_id : str
subject identification code
start_time : datetime
start time of the dataset
s_freq : float
sampling frequency
chan_name : list of str
... | 0.001074 |
def DataRefreshRequired(self, path=None, last=None):
"""True if we need to update this path from the client.
Args:
path: The path relative to the root to check freshness of.
last: An aff4:last attribute to check freshness of.
At least one of path or last must be supplied.
Returns:
... | 0.006254 |
def chu_liu_edmonds(length: int,
score_matrix: numpy.ndarray,
current_nodes: List[bool],
final_edges: Dict[int, int],
old_input: numpy.ndarray,
old_output: numpy.ndarray,
representatives: List[Set[int... | 0.000498 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.