text stringlengths 78 104k | score float64 0 0.18 |
|---|---|
def get_root_vaults(self):
"""Gets the root vaults in this vault hierarchy.
return: (osid.authorization.VaultList) - the root vaults
raise: OperationFailed - unable to complete request
raise: PermissionDenied - authorization failure
*compliance: mandatory -- This method is mus... | 0.002882 |
def worker_errordown(self, node, error):
"""Emitted by the WorkerController when a node dies."""
self.config.hook.pytest_testnodedown(node=node, error=error)
try:
crashitem = self.sched.remove_node(node)
except KeyError:
pass
else:
if crashitem... | 0.002997 |
def update_roster(self, REQUEST=None):
"""
If workspace is team managed, users can add/remove participants.
Any user with the manage workspace permission can add/remove
participants and admins.
"""
CheckAuthenticator(self.request)
PostOnly(self.request)
fo... | 0.003101 |
def _transcoding(cls, data):
"""编码转换
:param data: 需要转换的数据
:return: 转换好的数据
"""
if not data:
return data
result = None
if isinstance(data, str) and hasattr(data, 'decode'):
result = data.decode('utf-8')
else:
result = dat... | 0.005831 |
def label_from_bin(buf):
"""
Converts binary representation label to integer.
:param buf: Binary representation of label.
:return: MPLS Label and BoS bit.
"""
mpls_label = type_desc.Int3.to_user(six.binary_type(buf))
return mpls_label >> 4, mpls_label & 1 | 0.003509 |
def _get_tasks_from_reminder_list(
self,
listName):
"""*get the tasks from a reminder app list as a string in taskpaper format*
**Key Arguments:**
- ``listName`` -- the name of the reminders list
**Return:**
- ``newTasks`` -- a string containing ... | 0.004 |
def search_in_hdx(cls, query='*:*', configuration=None, page_size=1000, **kwargs):
# type: (Optional[str], Optional[Configuration], int, Any) -> List['Dataset']
"""Searches for datasets in HDX
Args:
query (Optional[str]): Query (in Solr format). Defaults to '*:*'.
config... | 0.004545 |
def load_image(self, file_path, redraw=True):
"""
Accepts a path to an 8 x 8 image file and updates the LED matrix with
the image
"""
if not os.path.exists(file_path):
raise IOError('%s not found' % file_path)
img = Image.open(file_path).convert('RGB')
... | 0.004415 |
def gen_cv_preds(clf, arr, sel_score, num_chunks=3):
"""
Generates cross validated predictions using an input classifier and data.
clf is a classifier that implements that implements the fit and predict methods.
arr is the input data array (X)
sel_score is the target list (y). y[n] corresponds to X... | 0.003175 |
def get_td_from_freqtau(template=None, taper=None, **kwargs):
"""Return time domain ringdown with all the modes specified.
Parameters
----------
template: object
An object that has attached properties. This can be used to substitute
for keyword arguments. A common example would be a row... | 0.000898 |
def interval_timer(interval, func, *args, **kwargs):
'''Interval timer function.
Taken from: http://stackoverflow.com/questions/22498038/improvement-on-interval-python/22498708
'''
stopped = Event()
def loop():
while not stopped.wait(interval): # the first call is after interval
... | 0.004673 |
def _new_device_id(self, key):
"""
Generate a new device id or return existing device id for key
:param key: Key for device
:type key: unicode
:return: The device id
:rtype: int
"""
device_id = Id.SERVER + 1
if key in self._key2deviceId:
... | 0.004474 |
def parse(self):
"""Iterate through the directory and extract package/version info."""
for package in os.listdir(self.root_directory):
directory = os.path.join(self.root_directory, package)
if not os.path.isdir(directory):
continue
dir_contents = os.li... | 0.002837 |
def topological_sort(data):
"""Topological sort the given dictionary structure.
Args:
data (dict); dictionary structure where the value is a list of dependencies for that given key.
For example: ``{'a': (), 'b': ('a',)}``, where ``a`` depends on nothing and ``b`` depends on ``a``.
Retu... | 0.004608 |
def check_redirect_uris(uris, client_type=None):
"""
This function checks all return uris provided and tries to deduce
as what type of client we should register.
:param uris: The redirect URIs to check.
:type uris: list
:param client_type: An indicator of which client type you are expecting
... | 0.001241 |
def _get_all_objs_of_type(type_, parent):
"""Get all attributes of the given type from the given object.
Parameters
----------
type_ : The desired type
parent : The object from which to get the attributes with type matching
'type_'
Returns
-------
A list (possibly empty) of att... | 0.002227 |
def createSite(self,
username,
password,
configStoreConnection,
directories,
cluster=None,
logsSettings=None,
runAsync=False
):
"""
This is the first op... | 0.008188 |
def _ExpandArtifactFilesSource(self, source, requested):
"""Recursively expands an artifact files source."""
expanded_source = rdf_artifacts.ExpandedSource(base_source=source)
sub_sources = []
artifact_list = []
if "artifact_list" in source.attributes:
artifact_list = source.attributes["artifa... | 0.006545 |
def configure(self, options, conf):
"""Configure the plugin and system, based on selected options.
The base plugin class sets the plugin to enabled if the enable option
for the plugin (self.enableOpt) is true.
"""
if not self.can_configure:
return
self.conf =... | 0.004651 |
def numenta_local_wmax_extended(self, x):
r"""
New local w-max procedure (experimental).
This `encode`-function extends the local w-max overlap procedure.
See "Numenta’s local inhibition revisited" (Section 6) in `latex/notes.pdf`.
Note that we the "activation probabilies" $a_{ij}$ are already enco... | 0.013739 |
def parse_transdos(path_dir, efermi, dos_spin=1, trim_dos=False):
"""
Parses .transdos (total DOS) and .transdos_x_y (partial DOS) files
Args:
path_dir: (str) dir containing DOS files
efermi: (float) Fermi energy
dos_spin: (int) -1 for spin down, +1 for spin ... | 0.000888 |
def open_file(self, fname, external=False):
"""
Open filename with the appropriate application
Redirect to the right widget (txt -> editor, spydata -> workspace, ...)
or open file outside Spyder (if extension is not supported)
"""
fname = to_text_string(fname)
... | 0.003026 |
def flush(self, key=None):
"""Flush the cache.
If I{key} is specified, only that item is flushed. Otherwise
the entire cache is flushed.
@param key: the key to flush
@type key: (dns.name.Name, int, int) tuple or None
"""
if not key is None:
if key ... | 0.006263 |
def vec(val, width, signed=None):
"""create hdl vector value"""
return Bits(width, signed, forceVector=True).fromPy(val) | 0.007813 |
def add_geo(self, geo_location):
"""
Saves a <geo-location> Element, to be incoporated into the Open511
geometry field.
"""
if not geo_location.xpath('latitude') and geo_location.xpath('longitude'):
raise Exception("Invalid geo-location %s" % etree.tostring(geo_locati... | 0.008054 |
def click(self) -> None:
"""Send click event."""
if self.connected:
self.js_exec('click')
else:
# Web上に表示されてれば勝手にブラウザ側からクリックイベント発生する
# のでローカルのクリックイベント不要
msg = {'proto': '', 'type': 'click',
'currentTarget': {'id': self.wdom_id},
... | 0.004545 |
def heightmap_get_interpolated_value(
hm: np.ndarray, x: float, y: float
) -> float:
"""Return the interpolated height at non integer coordinates.
Args:
hm (numpy.ndarray): A numpy.ndarray formatted for heightmap functions.
x (float): A floating point x coordinate.
y (float): A floa... | 0.001961 |
def has_permissions(**perms):
"""A :func:`.check` that is added that checks if the member has all of
the permissions necessary.
The permissions passed in must be exactly like the properties shown under
:class:`.discord.Permissions`.
This check raises a special exception, :exc:`.MissingPermissions`... | 0.001957 |
def mask(self):
"""Masks the layer below with this layer.
Commits the current layer to the alpha channel of
the previous layer. Primarily, mask() is useful when
using gradient layers as masks on images below.
For example:
canvas.layer("image.jpg")
... | 0.019247 |
def _check_stations_csv(self, usr, root):
''' Reclocate a stations.csv copy in user home for easy manage.
E.g. not need sudo when you add new station, etc '''
if path.exists(path.join(usr, 'stations.csv')):
return
else:
copyfile(root, path.join(usr, 'stations... | 0.006116 |
def check_status(self):
""" tests both the ext_url and local_url to see if the database is
running
returns:
True if a connection can be made
False if the connection cannot me made
"""
log = logging.getLogger("%s.%s" % (self.log_name,
... | 0.005111 |
def _clone_post_init(self, obj=None, **kwargs):
"""
obj must be another Plottable instance. obj is used by Clone to properly
transfer all attributes onto this object.
"""
# Initialize the extra attributes
if obj is None or obj is self:
# We must be asrootpy-in... | 0.002048 |
def list_distributions(region=None, key=None, keyid=None, profile=None):
'''
List, with moderate information, all CloudFront distributions in the bound account.
region
Region to connect to.
key
Secret key to use.
keyid
Access key to use.
profile
Dict, or pilla... | 0.003901 |
def gen_image(img, width, height, outfile, img_type='grey'):
"""Save an image with the given parameters."""
assert len(img) == width * height or len(img) == width * height * 3
if img_type == 'grey':
misc.imsave(outfile, img.reshape(width, height))
elif img_type == 'color':
misc.imsave(... | 0.002786 |
def _points(self, x_pos):
"""
Convert given data values into drawable points (x, y)
and interpolated points if interpolate option is specified
"""
for series_group in (self.series, self.secondary_series):
accumulation = [0] * self._len
for serie in series_... | 0.002646 |
def fix_relative_url(self, publish_type, rel_url):
"""
Fix post or page relative url to a standard, uniform format.
:param publish_type: publish type ('post' or 'page')
:param rel_url: relative url to fix
:return: tuple(fixed relative url or file path if exists else None,
... | 0.002762 |
def split_input(cls, mapper_spec):
"""Returns a list of input readers.
An equal number of input files are assigned to each shard (+/- 1). If there
are fewer files than shards, fewer than the requested number of shards will
be used. Input files are currently never split (although for some formats
co... | 0.002776 |
def _set_firmware(self, v, load=False):
"""
Setter method for firmware, mapped from YANG variable /firmware (container)
If this variable is read-only (config: false) in the
source YANG file, then _set_firmware is considered as a private
method. Backends looking to populate this variable should
d... | 0.005566 |
def case(context, institute, case_id, display_name):
"""Delete a case and it's variants from the database"""
adapter = context.obj['adapter']
if not (case_id or display_name):
click.echo("Please specify what case to delete")
context.abort()
if display_name:
if not institute:
... | 0.000998 |
def getDynMeth(name):
'''
Retrieve and return an unbound method by python path.
'''
cname, fname = name.rsplit('.', 1)
clas = getDynLocal(cname)
if clas is None:
return None
return getattr(clas, fname, None) | 0.004082 |
def chunks(lst, size):
"""Yield successive n-sized chunks from lst."""
for i in xrange(0, len(lst), size):
yield lst[i:i + size] | 0.006944 |
def as_hex(self):
"""
Return a color palette with hex codes instead of RGB values.
"""
hex = [mpl.colors.rgb2hex(rgb) for rgb in self]
return ColorPalette(hex) | 0.01005 |
def get_hierarchy_form(self, *args, **kwargs):
"""Pass through to provider HierarchyAdminSession.get_hierarchy_form_for_update"""
# Implemented from kitosid template for -
# osid.resource.BinAdminSession.get_bin_form_for_update_template
# This method might be a bit sketchy. Time will tel... | 0.005405 |
def get_fallbackservers(self, orgid, page=None):
"""Get Fallback server"""
opts = {}
if page:
opts['page'] = page
return self.api_call(
ENDPOINTS['fallbackservers']['list'],
dict(orgid=orgid), **opts) | 0.007463 |
def get(self, name, typ):
"""
Gets a counter specified by its name.
It counter does not exist or its type doesn't match the specified type
it creates a new one.
:param name: a counter name to retrieve.
:param typ: a counter type.
:return: an existing or newly c... | 0.004957 |
def get_channel_id(self):
"""Fetches id
:return: id of youtube channel
"""
soup = BeautifulSoup(
self.get_channel_page(), "lxml"
) # parser for source page
channel_id = soup.find_all(
"span",
{
"class": "channel-header... | 0.003384 |
def load_scores_wiggle( fname ):
"""
Read a wiggle file and return a dict of BinnedArray objects keyed
by chromosome.
"""
scores_by_chrom = dict()
for chrom, pos, val in bx.wiggle.Reader( misc.open_compressed( fname ) ):
if chrom not in scores_by_chrom:
scores_by_chrom[chrom... | 0.019704 |
def copy_uri_options(hosts, mongodb_uri):
"""Returns a MongoDB URI to hosts with the options from mongodb_uri.
"""
if "?" in mongodb_uri:
options = mongodb_uri.split("?", 1)[1]
else:
options = None
uri = "mongodb://" + hosts
if options:
... | 0.00554 |
def compare_versions(x, y):
"""
Expects 2 strings in the format of 'X.Y.Z' where X, Y and Z are
integers. It will compare the items which will organize things
properly by their major, minor and bugfix version.
::
>>> my_list = ['v1.13', 'v1.14.2', 'v1.14.1', 'v1.9', 'v1.1']
>>> sort... | 0.001938 |
def tree(c):
"""
Display documentation contents with the 'tree' program.
"""
ignore = ".git|*.pyc|*.swp|dist|*.egg-info|_static|_build|_templates"
c.run('tree -Ca -I "{0}" {1}'.format(ignore, c.sphinx.source)) | 0.004367 |
def set_base_headers(self, hdr):
"""Set metadata in FITS headers."""
hdr['NUMXVER'] = (__version__, 'Numina package version')
hdr['NUMRNAM'] = (self.__class__.__name__, 'Numina recipe name')
hdr['NUMRVER'] = (self.__version__, 'Numina recipe version')
return hdr | 0.006623 |
def remove_child(self, *sprites):
"""Remove one or several :class:`Sprite` sprites from scene """
# first drop focus
scene = self.get_scene()
if scene:
child_sprites = list(self.all_child_sprites())
if scene._focus_sprite in child_sprites:
scene.... | 0.004878 |
def _run_parallel_job(self, job_id, array_id = None, no_log = False, nice = None, verbosity = 0):
"""Executes the code for this job on the local machine."""
environ = copy.deepcopy(os.environ)
environ['JOB_ID'] = str(job_id)
if array_id:
environ['SGE_TASK_ID'] = str(array_id)
else:
envir... | 0.018384 |
def compare(self):
"""
Main comparison function
"""
"""
Note: Make sure to be able to handle these ref/test scenarios:
A:
o----o---o---o
x-------x----x
B:
o----o-----o---o
x--------x--x--x
C:
o------o-----o---o
... | 0.001715 |
def dasec(handle, bufsiz=_default_len_out, buflen=_default_len_out):
"""
Extract comments from the comment area of a binary DAS file.
http://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/dasec_c.html
:param handle: Handle of binary DAS file open with read access.
:type handle: int
:param bu... | 0.000933 |
def get_aliases(self, includename=True):
"""Retrieve the aliases of this object as a list of strings.
Arguments
---------
includename : bool
Include the 'name' parameter in the list of aliases.
"""
# empty list if doesnt exist
alias_quanta = self.get(... | 0.003656 |
def main(argv=None):
"""Run dvc CLI command.
Args:
argv: optional list of arguments to parse. sys.argv is used by default.
Returns:
int: command's return code.
"""
args = None
cmd = None
try:
args = parse_args(argv)
if args.quiet:
logger.setLev... | 0.001156 |
def check_chunks(n_samples, n_features, chunks=None):
"""Validate and normalize the chunks argument for a dask.array
Parameters
----------
n_samples, n_features : int
Give the shape of the array
chunks : int, sequence, optional, default None
* For 'chunks=None', this picks a "good" ... | 0.000635 |
def copy_workspace(self, uri, new_name):
'''
Copy the current workspace.
Args:
- uri (dict): the uri of the workspace being copied. Needs to have a did and wid key.
- new_name (str): the new name of the copied workspace.
Returns:
- requests.Response:... | 0.006957 |
def _add_relations(self, relations):
"""Add all of the relations for the services."""
for k, v in six.iteritems(relations):
self.d.relate(k, v) | 0.011696 |
def gen_methods(self, *args, **kwargs):
'''Find all method names this input dispatches to. This method
can accept *args, **kwargs, but it's the gen_dispatch method's
job of passing specific args to handler methods.
'''
dispatched = False
for invoc, methodname in self.regi... | 0.002387 |
def kill_session_input_session_id(self, **kwargs):
"""Auto Generated Code
"""
config = ET.Element("config")
kill_session = ET.Element("kill_session")
config = kill_session
input = ET.SubElement(kill_session, "input")
session_id = ET.SubElement(input, "session-id")... | 0.004329 |
def distance(image_path, other_image_path):
""" Compute the hamming distance between two images"""
image_hash = average_hash(image_path)
other_image_hash = average_hash(other_image_path)
return hash_distance(image_hash, other_image_hash) | 0.003937 |
def load_transactions(input_file, **kwargs):
"""
Load transactions and returns a generator for transactions.
Arguments:
input_file -- An input file.
Keyword arguments:
delimiter -- The delimiter of the transaction.
"""
delimiter = kwargs.get('delimiter', '\t')
for transacti... | 0.002375 |
def _set_show_vcs(self, v, load=False):
"""
Setter method for show_vcs, mapped from YANG variable /brocade_vcs_rpc/show_vcs (rpc)
If this variable is read-only (config: false) in the
source YANG file, then _set_show_vcs is considered as a private
method. Backends looking to populate this variable sh... | 0.00578 |
def plot(self, figsize=None, rotation=45):
"""Plot the confusion matrix.
Args:
figsize: tuple (x, y) of ints. Sets the size of the figure
rotation: the rotation angle of the labels on the x-axis.
"""
fig, ax = plt.subplots(figsize=figsize)
plt.imshow(self._cm, interpolation='nearest',... | 0.007396 |
def gsea_pval(es, esnull):
"""Compute nominal p-value.
From article (PNAS):
estimate nominal p-value for S from esnull by using the positive
or negative portion of the distribution corresponding to the sign
of the observed ES(S).
"""
# to speed up, using numpy function to compute pval in p... | 0.01473 |
def _compute_length(nodes):
r"""Approximately compute the length of a curve.
.. _QUADPACK: https://en.wikipedia.org/wiki/QUADPACK
If ``degree`` is :math:`n`, then the Hodograph curve
:math:`B'(s)` is degree :math:`d = n - 1`. Using this curve, we
approximate the integral:
.. math::
\i... | 0.00069 |
def add_new(self, command):
"""Add a new entry to the queue."""
self.queue[self.next_key] = command
self.queue[self.next_key]['status'] = 'queued'
self.queue[self.next_key]['returncode'] = ''
self.queue[self.next_key]['stdout'] = ''
self.queue[self.next_key]['stderr'] = '... | 0.00431 |
def visit_Tuple(self, node):
'''
A tuple is abstracted as an ordered container of its values
>>> from pythran import passmanager
>>> pm = passmanager.PassManager('demo')
>>> module = ast.parse('def foo(a, b): return a, b')
>>> result = pm.gather(Aliases, module)
... | 0.002286 |
def get_users(self, email):
"""
Make sure users are staff users.
Additionally to the other PasswordResetForm conditions ensure
that the user is a staff user before sending them a password
reset email.
:param email: Textual email address.
:return: List of users.
... | 0.004651 |
def save(self, filename, chunk_size=CHUNK_SIZE):
"""
Write file to disk
:param filename:
:param chunk_size:
"""
with open(filename, 'wb') as fp:
while True:
# Chunk writer
data = self.file.read(chunk_size)
if no... | 0.003766 |
def get(datasets_identifiers, identifier_type='hid', history_id=None):
"""
Given the history_id that is displayed to the user, this function will
download the file[s] from the history and stores them under /import/
Return value[s] are the path[s] to the dataset[s] stored under /import/
"... | 0.003243 |
def udf(f):
"""Create a SQLite scalar UDF from `f`
Parameters
----------
f
A callable object
Returns
-------
callable
A callable object that returns ``None`` if any of its inputs are
``None``.
"""
@functools.wraps(f)
def wrapper(*args):
if any(a... | 0.002203 |
def set_fan_timer(self, timer):
"""
:param timer: an int between fan_timer_range
:return: nothing
"""
desired_state = {"timer": timer}
resp = self.api_interface.set_device_state(self, {
"desired_state": desired_state
})
self._update_state_fro... | 0.005952 |
def pca_svd(x):
"""Calculate PCA using SVD.
Parameters
----------
x : ndarray, shape (channels, samples)
Two-dimensional input data.
Returns
-------
w : ndarray, shape (channels, channels)
Eigenvectors (principal components) (in columns).
s : ndarray, shape ... | 0.006928 |
def add_group(id, description=None):
""" Adds group to the DCOS Enterprise. If not description
is provided the id will be used for the description.
:param id: group id
:type id: str
:param desc: description of user
:type desc: str
"""
if not description:
de... | 0.001595 |
def _action__get(self):
"""
Get/set the form's ``action`` attribute.
"""
base_url = self.base_url
action = self.get('action')
if base_url and action is not None:
return urljoin(base_url, action)
else:
return action | 0.006803 |
def write_aims(filename, atoms):
"""Method to write FHI-aims geometry files in phonopy context."""
lines = ""
lines += "# geometry.in for FHI-aims \n"
lines += "# | generated by phonopy.FHIaims.write_aims() \n"
lattice_vector_line = "lattice_vector " + "%16.16f "*3 + "\n"
for vec in atoms.get_... | 0.00114 |
def main():
"""Execute all checks."""
check_python_version()
check_python_modules()
check_executables()
home = os.path.expanduser("~")
print("\033[1mCheck files\033[0m")
rcfile = os.path.join(home, ".hwrtrc")
if os.path.isfile(rcfile):
print("~/.hwrtrc... %sFOUND%s" %
... | 0.001792 |
def ITE(s, d1, d0, simplify=True):
"""Expression If-Then-Else (ITE) operator
If *simplify* is ``True``, return a simplified expression.
"""
s = Expression.box(s).node
d1 = Expression.box(d1).node
d0 = Expression.box(d0).node
y = exprnode.ite(s, d1, d0)
if simplify:
y = y.simplif... | 0.002915 |
def _parse_info(self, data):
"""Parse the first line of a GNTP message to get security and other info values
:param string data: GNTP Message
:return dict: Parsed GNTP Info line
"""
match = GNTP_INFO_LINE.match(data)
if not match:
raise errors.ParseError('ERROR_PARSING_INFO_LINE')
info = match.grou... | 0.03271 |
def in_labelset(xmrs, nodeids, label=None):
"""
Test if all nodeids share a label.
Args:
nodeids: iterable of nodeids
label (str, optional): the label that all nodeids must share
Returns:
bool: `True` if all nodeids share a label, otherwise `False`
"""
nodeids = set(node... | 0.002179 |
def inverse(self, name=None):
"""Returns a `sonnet` module to compute inverse affine transforms.
The function first assembles a network that given the constraints of the
current AffineGridWarper and a set of input parameters, retrieves the
coefficients of the corresponding inverse affine transfor... | 0.009135 |
def read_in_admin1(filepath):
"""
Small helper function to read in a admin1 code <--> admin1 name document.
Parameters
----------
filepath: string
path to the admin1 mapping JSON. This file is usually
mordecai/resources/data/admin1CodesASCII.json
Returns
-------... | 0.001592 |
def addScalarBar(self, c=None, title="", horizontal=False, vmin=None, vmax=None):
"""
Add a 2D scalar bar to actor.
.. hint:: |mesh_bands| |mesh_bands.py|_
"""
# book it, it will be created by Plotter.show() later
self.scalarbar = [c, title, horizontal, vmin, vmax]
... | 0.008982 |
def normalize_name(name):
"""
Given a key name (e.g. "LEFT CONTROL"), clean up the string and convert to
the canonical representation (e.g. "left ctrl") if one is known.
"""
if not name or not isinstance(name, basestring):
raise ValueError('Can only normalize non-empty string names. Unexpect... | 0.005929 |
def get(self):
"""
*get the check_coverage object*
**Return:**
- ``check_coverage``
"""
self.log.info('starting the ``get`` method')
match = self._query_sdss()
self.log.info('completed the ``get`` method')
return match | 0.006734 |
def _make_association(self, clk=None, rst=None) -> None:
"""
Associate this object with specified clk/rst
"""
if clk is not None:
assert self._associatedClk is None
self._associatedClk = clk
if rst is not None:
assert self._associatedRst is No... | 0.005556 |
def validate_changeset(changeset):
"""Validate a changeset is compatible with Amazon's API spec.
Args: changeset: lxml.etree.Element (<ChangeResourceRecordSetsRequest>)
Returns: [ errors ] list of error strings or []."""
errors = []
changes = changeset.findall('.//{%s}Change' % R53_XMLNS)
num_changes = len... | 0.01848 |
def reign_year_to_ad(reign_year: int, reign: int) -> int:
"""
Reign year of Chakri dynasty, Thailand
"""
if int(reign) == 10:
ad = int(reign_year) + 2015
elif int(reign) == 9:
ad = int(reign_year) + 1945
elif int(reign) == 8:
ad = int(reign_year) + 1928
elif int(reign... | 0.002653 |
def update_lbaas_pool(self, lbaas_pool, body=None):
"""Updates a lbaas_pool."""
return self.put(self.lbaas_pool_path % (lbaas_pool),
body=body) | 0.010929 |
def pairwise(iterable):
"s -> (s0,s1), (s1,s2), (s2, s3), ..."
a, b = tee(iterable)
next(b, None)
return izip(a, b) | 0.007634 |
def assign_extension_to_users(self, body):
"""AssignExtensionToUsers.
[Preview API] Assigns the access to the given extension for a given list of users
:param :class:`<ExtensionAssignment> <azure.devops.v5_0.licensing.models.ExtensionAssignment>` body: The extension assignment details.
:... | 0.007853 |
def per_callback_query_chat_id(types='all'):
"""
:param types:
``all`` or a list of chat types (``private``, ``group``, ``channel``)
:return:
a seeder function that returns a callback query's originating chat id
if the chat type is in ``types``.
"""
def f(msg):
if (f... | 0.00365 |
def route(regex, method, name):
"""
Route the decorated view.
:param regex: A string describing a regular expression to which the request path will be matched.
:param method: A string describing the HTTP method that this view accepts.
:param name: A string describing the name of the URL pattern.
... | 0.014409 |
def fit(self, X, y=None, input_type='affinity'):
"""
Fit the model from data in X.
Parameters
----------
input_type : string, one of: 'similarity', 'distance' or 'data'.
The values of input data X. (default = 'data')
X : array-like, shape (n_samples, n_featur... | 0.022973 |
def UniversalCRTSdkDir(self):
"""
Microsoft Universal CRT SDK directory.
"""
# Set Kit Roots versions for specified MSVC++ version
if self.vc_ver >= 14.0:
vers = ('10', '81')
else:
vers = ()
# Find path of the more recent Kit
for v... | 0.003817 |
def i2repr(self, pkt, x):
"""Convert internal value to a nice representation"""
if len(hex(self.i2m(pkt, x))) < 7: # short address
return hex(self.i2m(pkt, x))
else: # long address
x = "%016x" % self.i2m(pkt, x)
return ":".join(["%s%s" % (x[i], x[i + 1]) for... | 0.008646 |
def get_cytoband_maps(names=[]):
"""Load all cytoband maps
>>> maps = get_cytoband_maps()
>>> maps["ucsc-hg38"]["1"]["p32.2"]
[55600000, 58500000, 'gpos50']
>>> maps["ucsc-hg19"]["1"]["p32.2"]
[56100000, 59000000, 'gpos50']
"""
if names == []:
names = get_cytoband_names()
re... | 0.002681 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.