text stringlengths 78 104k | score float64 0 0.18 |
|---|---|
def _installed_snpeff_genome(base_name, config):
"""Find the most recent installed genome for snpEff with the given name.
"""
snpeff_config_file = os.path.join(config_utils.get_program("snpeff", config, "dir"),
"snpEff.config")
if os.path.exists(snpeff_config_file):... | 0.00545 |
def ToABMag(self, wave, flux, **kwargs):
"""Convert to ``abmag``.
.. math::
\\textnormal{AB}_{\\nu} = -2.5 \\; \\log(h \\lambda \\; \\textnormal{photlam}) - 48.6
where :math:`h` is as defined in :ref:`pysynphot-constants`.
Parameters
----------
wave, flux ... | 0.004539 |
def calculate_dependencies():
"""Calculate test dependencies
First do a topological sorting based on the dependencies.
Then sort the different dependency groups based on priorities.
"""
order = []
for group in toposort(dependencies):
priority_sorted_group = so... | 0.006897 |
def run(self, dag):
"""
Run one pass of cx cancellation on the circuit
Args:
dag (DAGCircuit): the directed acyclic graph to run on.
Returns:
DAGCircuit: Transformed DAG.
"""
cx_runs = dag.collect_runs(["cx"])
for cx_run in cx_runs:
... | 0.00177 |
def get_feed(self, buckets=None, since=None, results=15, start=0):
"""
Returns feed (news, blogs, reviews, audio, video) for the catalog artists; response depends on requested buckets
Args:
Kwargs:
buckets (list): A list of strings specifying which feed items to retrieve
... | 0.019324 |
def update(self, request, *args, **kwargs):
"""Update the ``Relation`` object.
Reject the update if user doesn't have ``EDIT`` permission on
the collection referenced in the ``Relation``.
"""
instance = self.get_object()
if (not request.user.has_perm('edit_collection', i... | 0.003899 |
def __disambiguate_with_lexicon(self, docs, lexicon, hiddenWords):
""" Teostab lemmade leksikoni järgi mitmeste morf analüüside
ühestamise - eemaldab üleliigsed analüüsid;
Toetub ideele "üks tähendus teksti kohta": kui mitmeseks jäänud
lemma esineb tekstis/korpuses ka mujal... | 0.005219 |
def sanitize(name):
"""
Sanitize the specified ``name`` for use with breathe directives.
**Parameters**
``name`` (:class:`python:str`)
The name to be sanitized.
**Return**
:class:`python:str`
The input ``name`` sanitized to use with breathe directives (primarily for use
... | 0.004957 |
def joint_sfs_scaled(dac1, dac2, n1=None, n2=None):
"""Compute the joint site frequency spectrum between two populations,
scaled such that a constant value is expected across the spectrum for
neutral variation, constant population size and unrelated populations.
Parameters
----------
dac1 : arr... | 0.000962 |
def formatDateParms(context, date_id):
""" Obtain and reformat the from and to dates
into a printable date parameter construct
"""
from_date = context.REQUEST.get('%s_fromdate' % date_id, None)
to_date = context.REQUEST.get('%s_todate' % date_id, None)
date_parms = {}
if from_date and t... | 0.001873 |
def _src_path_stats(self, src_path):
"""
Return a dict of statistics for the source file at `src_path`.
"""
# Find violation lines
violation_lines = self.violation_lines(src_path)
violations = sorted(self._diff_violations()[src_path].violations)
# Load source sn... | 0.004386 |
def notify(self, event_id):
"""Let the FlowControl system know that there is an event."""
self._event_buffer.extend([event_id])
self._event_count += 1
if self._event_count >= self.threshold:
logger.debug("Eventcount >= threshold")
self.make_callback(kind="event") | 0.00627 |
def create_grid_layout(rowNum=8, colNum=12, row_labels=None, col_labels=None,
xlim=None, ylim=None,
xlabel=None, ylabel=None,
row_label_xoffset=None, col_label_yoffset=None,
hide_tick_labels=True, hide_tick_lines=False,
... | 0.002158 |
def build_request_signature(self, saml_request, relay_state, sign_algorithm=OneLogin_Saml2_Constants.RSA_SHA1):
"""
Builds the Signature of the SAML Request.
:param saml_request: The SAML Request
:type saml_request: string
:param relay_state: The target URL the user should be r... | 0.007018 |
def to_neo4j(graph, neo_connection, use_tqdm=False):
"""Upload a BEL graph to a Neo4j graph database using :mod:`py2neo`.
:param pybel.BELGraph graph: A BEL Graph
:param neo_connection: A :mod:`py2neo` connection object. Refer to the
`py2neo documentation <http://py2neo.org/v3/database.html#the-graph>... | 0.002359 |
def get_design_run_results(self, data_view_id, run_uuid):
"""
Retrieves the results of an existing designrun
:param data_view_id: The ID number of the data view to which the
run belongs, as a string
:type data_view_id: str
:param run_uuid: The UUID of the design run ... | 0.002642 |
def __build_sign_query(saml_data, relay_state, algorithm, saml_type, lowercase_urlencoding=False):
"""
Build sign query
:param saml_data: The Request data
:type saml_data: str
:param relay_state: The Relay State
:type relay_state: str
:param algorithm: The Sign... | 0.005911 |
def read_table_pattern(self, header_pattern, row_pattern, footer_pattern,
postprocess=str, attribute_name=None,
last_one_only=True):
"""
Parse table-like data. A table composes of three parts: header,
main body, footer. All the data matches "... | 0.003119 |
def load_file(self, path=None, just_settings=False):
"""
Loads a data file. After the file is loaded, calls self.after_load_file(self),
which you can overwrite if you like!
just_settings=True will only load the configuration of the controls,
and will not plot anything or run aft... | 0.006867 |
def list_permissions(self, group_name=None, resource=None):
"""
List permission sets associated filtering by group and/or resource.
Args:
group_name (string): Name of group.
resource (intern.resource.boss.Resource): Identifies which data
model object to o... | 0.003361 |
def to_array(self):
"""
Serializes this VideoNote to a dictionary.
:return: dictionary representation of this object.
:rtype: dict
"""
array = super(VideoNote, self).to_array()
array['file_id'] = u(self.file_id) # py2: type unicode, py3: type str
array[... | 0.003082 |
def dynamic_content_item_show(self, id, **kwargs):
"https://developer.zendesk.com/rest_api/docs/core/dynamic_content#show-item"
api_path = "/api/v2/dynamic_content/items/{id}.json"
api_path = api_path.format(id=id)
return self.call(api_path, **kwargs) | 0.010601 |
def pipe(*args):
"""
Takes as parameters several dicts, each with the same
parameters passed to popen.
Runs the various processes in a pipeline, connecting
the stdout of every process except the last with the
stdin of the next process.
Adapted from http://www.enricozini.org/2009/debian/pyt... | 0.00107 |
def make_flask_url_dispatcher():
"""Return an URL dispatcher based on the current :ref:`request context
<flask:request-context>`.
You generally don’t need to call this directly.
The context is used when the dispatcher is first created but not
afterwards. It is not required after this function has ... | 0.000448 |
def get_version():
"""
Get version of pydf and wkhtmltopdf binary
:return: version string
"""
try:
wk_version = _string_execute('-V')
except Exception as e:
# we catch all errors here to make sure we get a version no matter what
wk_version = '%s: %s' % (e.__class__.__nam... | 0.002463 |
def SyncManagedObject(self, difference, deleteNotPresent=False, noVersionFilter=False, dumpXml=None):
"""
Syncs Managed Object.
Method takes the difference object (output of CompareManagedObject) and applies the differences on reference Managed Object.
- difference specifies the Difference object (output of ... | 0.029048 |
def zero_disk(self, disk_xml=None):
""" Collector and publish not zeroed disk metrics
"""
troubled_disks = 0
for filer_disk in disk_xml:
raid_state = filer_disk.find('raid-state').text
if not raid_state == 'spare':
continue
is_zeroed =... | 0.004132 |
def set_cursor_enter_callback(window, cbfun):
"""
Sets the cursor enter/exit callback.
Wrapper for:
GLFWcursorenterfun glfwSetCursorEnterCallback(GLFWwindow* window, GLFWcursorenterfun cbfun);
"""
window_addr = ctypes.cast(ctypes.pointer(window),
ctypes.POINTER... | 0.002345 |
def approxMeanOneLognormal(N, sigma=1.0, **kwargs):
'''
Calculate a discrete approximation to a mean one lognormal distribution.
Based on function approxLognormal; see that function's documentation for
further notes.
Parameters
----------
N : int
Size of discrete space vector to be ... | 0.004921 |
def prefix(self, sign: Optional[PrefixSign] = None,
symbol: bool = False) -> str:
"""Get a random prefix for the International System of Units.
:param sign: Sing of number.
:param symbol: Return symbol of prefix.
:return: Prefix for SI.
:raises NonEnumerableError:... | 0.005155 |
def _create_snapshot(volume):
""" Create a new snapshot
:type volume: boto.ec2.volume.Volume
:param volume: Volume to snapshot
:returns: boto.ec2.snapshot.Snapshot -- The new snapshot
"""
logger.info('Creating new snapshot for {}'.format(volume.id))
snapshot = volume.create_snapshot(
... | 0.002016 |
def has_permission(self, request, view):
"""
If the JWT has a user filter, verify that the filtered
user value matches the user in the URL.
"""
user_filter = self._get_user_filter(request)
if not user_filter:
# no user filters are present in the token to limit... | 0.004243 |
def add_message_for(users, level, message_text, extra_tags='', date=None, url=None, fail_silently=False):
"""
Send a message to a list of users without passing through `django.contrib.messages`
:param users: an iterable containing the recipients of the messages
:param level: message level
:param me... | 0.004739 |
def save_metadata(hparams):
"""Saves FLAGS and hparams to output_dir."""
output_dir = os.path.expanduser(FLAGS.output_dir)
if not tf.gfile.Exists(output_dir):
tf.gfile.MakeDirs(output_dir)
# Save FLAGS in txt file
if hasattr(FLAGS, "flags_into_string"):
flags_str = FLAGS.flags_into_string()
t2t_f... | 0.013481 |
def main():
"""
NAME
lnp_magic.py
DESCRIPTION
makes equal area projections site by site
from specimen formatted file with
Fisher confidence ellipse using McFadden and McElhinny (1988)
technique for combining lines and planes
SYNTAX
lnp_magic [command l... | 0.002762 |
def cmd_host(verbose):
"""Collect information about the host where habu is running.
Example:
\b
$ habu.host
{
"kernel": [
"Linux",
"demo123",
"5.0.6-200.fc29.x86_64",
"#1 SMP Wed Apr 3 15:09:51 UTC 2019",
"x86_64",
"x8... | 0.000964 |
def check_clang_apply_replacements_binary(args):
"""Checks if invoking supplied clang-apply-replacements binary works."""
try:
subprocess.check_call([args.clang_apply_replacements_binary, '--version'])
except:
print('Unable to run clang-apply-replacements. Is clang-apply-replacements '
'binary c... | 0.015 |
def trigger_switch_all_to(request, switch):
"""
switch the status of all the "my" triggers then go back home
:param request: request object
:param switch: the switch value
:type request: HttpRequest object
:type switch: string off or on
"""
now = arrow.utcnow().to(set... | 0.002924 |
def likelihood_data_given_model(self, kwargs_lens, kwargs_source, kwargs_lens_light, kwargs_ps, source_marg=False):
"""
computes the likelihood of the data given a model
This is specified with the non-linear parameters and a linear inversion and prior marginalisation.
:param kwargs_lens:... | 0.008073 |
def read_column(self, col, **keys):
"""
Read the specified column
Alternatively, you can use slice notation
fits=fitsio.FITS(filename)
fits[ext][colname][:]
fits[ext][colname][2:5]
fits[ext][colname][200:235:2]
fits[ext][colname][rows]... | 0.001938 |
def remove_positive_resample(X, y, model_generator, method_name, num_fcounts=11):
""" Remove Positive (resample)
xlabel = "Max fraction of features removed"
ylabel = "Negative mean model output"
transform = "negate"
sort_order = 13
"""
return __run_measure(measures.remove_resample, X, y, mod... | 0.008 |
def _set_config_keystone(self, username, password):
""" Set config to Keystone """
self._keystone_auth = KeystoneAuth(
settings.KEYSTONE_AUTH_URL, settings.KEYSTONE_PROJECT_NAME, username, password,
settings.KEYSTONE_USER_DOMAIN_NAME, settings.KEYSTONE_PROJECT_DOMAIN_NAME,
... | 0.011331 |
def _server_response_handler(self, response: Dict[str, Any]):
"""处理100~199段状态码,针对不同的服务响应进行操作.
Parameters:
(response): - 响应的python字典形式数据
Return:
(bool): - 准确地说没有错误就会返回True
"""
code = response.get("CODE")
if code == 100:
if self.debug:... | 0.003937 |
def _extract_hunt_results(self, output_file_path):
"""Open a hunt output archive and extract files.
Args:
output_file_path: The path where the hunt archive is downloaded to.
Returns:
list: tuples containing:
str: The name of the client from where the files were downloaded.
... | 0.009665 |
def expire(self, key, timeout):
"""Set a timeout on key. After the timeout has expired, the key will
automatically be deleted. A key with an associated timeout is often
said to be volatile in Redis terminology.
The timeout is cleared only when the key is removed using the
:meth:... | 0.000977 |
def latmio_dir(R, itr, D=None, seed=None):
'''
This function "latticizes" a directed network, while preserving the in-
and out-degree distributions. In weighted networks, the function
preserves the out-strength but not the in-strength distributions.
Parameters
----------
R : NxN np.ndarray
... | 0.001317 |
def createEditor(self, parent, column, op, value):
"""
Creates a new editor for the parent based on the plugin parameters.
:param parent | <QWidget>
:return <QWidget> || None
"""
try:
cls = self._operatorMap[nativestring(op)... | 0.009231 |
def _should_skip_entry(self, entry):
"""Determine if this oplog entry should be skipped.
This has the possible side effect of modifying the entry's namespace
and filtering fields from updates and inserts.
"""
# Don't replicate entries resulting from chunk moves
if entry.... | 0.000961 |
def referenceframe(self, event):
"""Handles navigational reference frame updates.
These are necessary to assign geo coordinates to alerts and other
misc things.
:param event with incoming referenceframe message
"""
self.log("Got a reference frame update! ", event, lvl=e... | 0.00542 |
def drag_to(self, target, duration=2.0):
"""
Similar to swipe action, but the end point is provide by a UI proxy or by fixed coordinates.
Args:
target (:py:class:`UIObjectProxy <poco.proxy.UIObjectProxy>`): a UI proxy or 2-list/2-tuple coordinates
(x, y) in NormalizedCo... | 0.0059 |
def _isCheckpointDir(checkpointDir):
"""Return true iff checkpointDir appears to be a checkpoint directory."""
lastSegment = os.path.split(checkpointDir)[1]
if lastSegment[0] == '.':
return False
if not checkpointDir.endswith(g_defaultCheckpointExtension):
return False
if not os.path.isdir(checkpoin... | 0.019553 |
def _compose_restart(services):
"""Well, this is annoying. Compose 1.2 shipped with the
restart functionality fucking broken, so we can't set a faster
timeout than 10 seconds (which is way too long) using Compose.
We are therefore resigned to trying to hack this together
ourselves. Lame.
Releva... | 0.004727 |
def __Delete(self, path, request, headers):
"""Azure Cosmos 'DELETE' http request.
:params str url:
:params str path:
:params dict headers:
:return:
Tuple of (result, headers).
:rtype:
tuple of (dict, dict)
"""
return synchronize... | 0.002947 |
def parse_pasv_response(s):
"""
Parsing `PASV` server response.
:param s: response line
:type s: :py:class:`str`
:return: (ip, port)
:rtype: (:py:class:`str`, :py:class:`int`)
"""
sub, *_ = re.findall(r"[^(]*\(([^)]*)", s)
nums = tuple(map(int, s... | 0.004535 |
def imports_on_separate_lines(logical_line):
r"""Place imports on separate lines.
Okay: import os\nimport sys
E401: import sys, os
Okay: from subprocess import Popen, PIPE
Okay: from myclas import MyClass
Okay: from foo.bar.yourclass import YourClass
Okay: import myclass
Okay: import f... | 0.001832 |
def reduce_paths(G):
"""
Make graph into a directed acyclic graph (DAG).
"""
from jcvi.algorithms.lpsolve import min_feedback_arc_set
while not nx.is_directed_acyclic_graph(G):
edges = []
for a, b, w in G.edges_iter(data=True):
w = w['weight']
edges.append((a... | 0.001898 |
def objHasUnsavedChanges(self):
'''
objHasUnsavedChanges - @see ForeignLinkData.objHasUnsavedChanges
True if ANY object has unsaved changes.
'''
if not self.obj:
return False
for thisObj in self.obj:
if not thisObj:
continue
if thisObj.hasUnsavedChanges(cascadeObjects=True):
return True... | 0.041667 |
def pre_scan(self, func=operator.add, seed=0):
'''
An exclusive prefix sum which returns the cumulative application of the
supplied function up to but excluding the current element.
Args:
func: An optional binary function which is commutative - that is,
the... | 0.001672 |
def dirlist(self, path):
"""
This method returns the directory list for the path specified where SAS is running
"""
code = """
data _null_;
spd = '""" + path + """';
rc = filename('saspydir', spd);
did = dopen('saspydir');
if did > 0 then
... | 0.00255 |
async def call(self, methname, *args, **kwargs):
'''
Call a remote method by name.
Args:
methname (str): The name of the remote method.
*args: Arguments to the method call.
**kwargs: Keyword arguments to the method call.
Most use cases will likely us... | 0.003436 |
def analytics(account=None, *args, **kwargs):
"""
Simple Google Analytics integration.
First looks for an ``account`` parameter. If not supplied, uses
Django ``GOOGLE_ANALYTICS_ACCOUNT`` setting. If account not set,
raises ``TemplateSyntaxError``.
:param account:
Google Analytics acco... | 0.008982 |
def get_netconf_client_capabilities_output_session_session_id(self, **kwargs):
"""Auto Generated Code
"""
config = ET.Element("config")
get_netconf_client_capabilities = ET.Element("get_netconf_client_capabilities")
config = get_netconf_client_capabilities
output = ET.Sub... | 0.004831 |
def cookiejar_from_dict(cookie_dict):
"""Returns a CookieJar from a key/value dictionary.
:param cookie_dict: Dict of key/values to insert into CookieJar.
"""
# return cookiejar if one was passed in
if isinstance(cookie_dict, cookielib.CookieJar):
return cookie_dict
# create cookiejar... | 0.00241 |
def ensure(data_type, check_value, default_value=None):
"""
function to ensure the given check value is in the given data type, if yes,
return the check value directly, otherwise return the default value
:param data_type: different data type: can be int, str, list, tuple etc,
must be python suppo... | 0.002167 |
def proc_check_guard(self, instance, sql):
"""
check to see if the guard SQL returns a single column containing 0 or 1
We return true if 1, else False
"""
self.open_db_connections(instance, self.PROC_GUARD_DB_KEY)
cursor = self.get_cursor(instance, self.PROC_GUARD_DB_KEY)... | 0.004167 |
def log_level(self, subsystem, level, **kwargs):
r"""Changes the logging output of a running daemon.
.. code-block:: python
>>> c.log_level("path", "info")
{'Message': "Changed log level of 'path' to 'info'\n"}
Parameters
----------
subsystem : str
... | 0.002312 |
def by_median_household_income(self,
lower=-1,
upper=2 ** 31,
zipcode_type=ZipcodeType.Standard,
sort_by=SimpleZipcode.median_household_income.name,
... | 0.01238 |
def _copy_problem_hparams(p_hparams):
"""Use input modality, vocab, and space id for target."""
p = p_hparams
# Duplicate input modality.
p.modality["targets"] = p.modality["inputs"]
# Duplicate input vocab size.
p.vocab_size["targets"] = p.vocab_size["inputs"]
# Duplicate input vocabulary.
p.vocabulary... | 0.027311 |
def init_app(self, app, sqla, namespace='api', route_prefix='/api'):
"""
Initialize the adapter if it hasn't already been initialized.
:param app: Flask application
:param sqla: Flask-SQLAlchemy instance
:param namespace: Prefixes all generated routes
:param route_prefix... | 0.004219 |
def raise_on_wrong_settings(self):
"""
Validates the configuration settings and raises RuntimeError on error
"""
self.__ensure_dir_exists(self.working_directory, 'working directory')
for idir in self.include_paths:
self.__ensure_dir_exists(idir, 'include directory')
... | 0.003683 |
def __score_method(X, y, fcounts, model_generator, score_function, method_name, nreps=10, test_size=100, cache_dir="/tmp"):
""" Test an explanation method.
"""
old_seed = np.random.seed()
np.random.seed(3293)
# average the method scores over several train/test splits
method_reps = []
data... | 0.00564 |
def person_involved(self, person):
"""Return True if the given person has been involved in the
discussion, False otherwise.
"""
return any(message.posted_by == person for message in self.discussion) | 0.008658 |
def plotConvergenceByColumnTopology(results, columnRange, featureRange, networkType, numTrials):
"""
Plots the convergence graph: iterations vs number of columns.
Each curve shows the convergence for a given number of unique features.
"""
#######################################################################... | 0.022825 |
def get_formset(self, request, obj=None, **kwargs):
"""
Load Synchronizer schema to display specific fields in admin
"""
if obj is not None:
try:
# this is enough to load the new schema
obj.external
except LayerExternal.DoesNotExist... | 0.006961 |
def acceptNavigationRequest(self, url, kind, is_main_frame):
"""Open external links in browser and internal links in the webview"""
ready_url = url.toEncoded().data().decode()
is_clicked = kind == self.NavigationTypeLinkClicked
if is_clicked and self.root_url not in ready_url:
... | 0.00641 |
def load_obsdata(self, idx: int) -> None:
"""Load the next obs sequence value (of the given index)."""
if self._obs_ramflag:
self.obs[0] = self._obs_array[idx]
elif self._obs_diskflag:
raw = self._obs_file.read(8)
self.obs[0] = struct.unpack('d', raw) | 0.006431 |
def to_capabilities(self):
"""Marshals the IE options to the correct object."""
caps = self._caps
opts = self._options.copy()
if len(self._arguments) > 0:
opts[self.SWITCHES] = ' '.join(self._arguments)
if len(self._additional) > 0:
opts.update(self._add... | 0.004854 |
def shorten_text(self, text):
"""Shortens text to fit into the :attr:`width`."""
if len(text) > self.width:
return text[:self.width - 3] + '...'
return text | 0.010417 |
def notification_message(cls, item):
'''Convert an RPCRequest item to a message.'''
assert isinstance(item, Notification)
return cls.encode_payload(cls.request_payload(item, None)) | 0.009804 |
def serve(args):
"""Start a server which will watch .md and .rst files for changes.
If a md file changes, the Home Documentation is rebuilt. If a .rst
file changes, the updated sphinx project is rebuilt
Args:
args (ArgumentParser): flags from the CLI
"""
# Sever's parameters
port = ... | 0.001041 |
def contains_set(self, other):
"""Return ``True`` if ``other`` is a subset of the real numbers.
Returns
-------
contained : bool
``True`` if other is an instance of `RealNumbers` or
`Integers` False otherwise.
Examples
--------
>>> real_n... | 0.003534 |
def field_items(self, path=str(), **options):
""" Returns a **flatten** list of ``('field path', field item)`` tuples
for the `Pointer` field itself and for each :class:`Field` *nested* in the
:attr:`data` object referenced by the `Pointer` field.
:param str path: path of the `Pointer` ... | 0.002344 |
def unstub(*objs):
"""Unstubs all stubbed methods and functions
If you don't pass in any argument, *all* registered mocks and
patched modules, classes etc. will be unstubbed.
Note that additionally, the underlying registry will be cleaned.
After an `unstub` you can't :func:`verify` anymore because... | 0.002041 |
def update(self):
"""Once you open a dataset, it activates all the widgets.
"""
self.info.display_dataset()
self.overview.update()
self.labels.update(labels=self.info.dataset.header['chan_name'])
self.channels.update()
try:
self.info.markers = self.in... | 0.003891 |
def n2s(n):
"""
Number to string.
"""
s = hex(n)[2:].rstrip("L")
if len(s) % 2 != 0:
s = "0" + s
return s.decode("hex") | 0.006623 |
def generate_random_string(length=6):
'''
Returns a random string of a specified length.
>>> len(generate_random_string(length=25))
25
Test randomness. Try N times and observe no duplicaton
>>> N = 100
>>> len(set(generate_random_string(10) for i in range(N))) == N
True
'''
n =... | 0.002336 |
def get_versioned_references_for(self, instance):
"""Returns the versioned references for the given instance
"""
vrefs = []
# Retrieve the referenced objects
refs = instance.getRefs(relationship=self.relationship)
ref_versions = getattr(instance, REFERENCE_VERSIONS, Non... | 0.002747 |
def apply_obb(self):
"""
Transform the current path so that its OBB is axis aligned
and OBB center is at the origin.
"""
if len(self.root) == 1:
matrix, bounds = polygons.polygon_obb(
self.polygons_closed[self.root[0]])
self.apply_transform... | 0.004556 |
def update_subnet(self, subnet, name=None):
'''
Updates a subnet
'''
subnet_id = self._find_subnet_id(subnet)
return self.network_conn.update_subnet(
subnet=subnet_id, body={'subnet': {'name': name}}) | 0.007937 |
def _get_app_libs_volume_mounts(app_name, assembled_specs):
""" Returns a list of the formatted volume mounts for all libs that an app uses """
volumes = []
for lib_name in assembled_specs['apps'][app_name]['depends']['libs']:
lib_spec = assembled_specs['libs'][lib_name]
volumes.append("{}:{... | 0.007282 |
def __erase_primes(self):
"""Erase all prime markings"""
for i in range(self.n):
for j in range(self.n):
if self.marked[i][j] == 2:
self.marked[i][j] = 0 | 0.009217 |
def clr(M, **kwargs):
"""Implementation of the Context Likelihood or Relatedness Network algorithm.
Args:
mat (numpy.ndarray): matrix, if it is a square matrix, the program assumes
it is a relevance matrix where mat(i,j) represents the similarity content
between nodes i and j. Elements o... | 0.004264 |
def read_config(cls, configparser):
"""Read configuration file options."""
config = dict()
config[cls._filename_re_key] = configparser.get(cls.__name__, cls._filename_re_key) \
if configparser.has_option(cls.__name__, cls._filename_re_key) else None
return config | 0.013029 |
def _convert_axes_to_absolute(dshape, axes):
"""axes = (-2,-1) does not work in reikna, so we have to convetr that"""
if axes is None:
return None
elif isinstance(axes, (tuple, list)):
return tuple(np.arange(len(dshape))[list(axes)])
else:
raise NotImplementedError("axes %s is o... | 0.008152 |
def on_presence(self, session, presence):
"""Handles presence stanzas"""
from_jid = presence.getFrom()
is_member = self.is_member(from_jid.getStripped())
if is_member:
member = self.get_member(from_jid.getStripped())
else:
member = None
logger.inf... | 0.00651 |
def locate_module(module_id: str, module_type: str = None):
"""
Locate module by module ID
Args:
module_id: Module ID
module_type: Type of module, one of ``'master'``, ``'slave'`` and ``'middleware'``
"""
entry_point = None
if module_type:
entry_point = 'ehforwarderbot... | 0.003509 |
def _opening_bracket_index(self, text, bpair=('(', ')')):
"""Return the index of the opening bracket that matches the closing bracket at the end of the text."""
level = 1
for i, char in enumerate(reversed(text[:-1])):
if char == bpair[1]:
level += 1
elif c... | 0.006961 |
def solve(self,stops,
method="POST",
barriers=None,
polylineBarriers=None,
polygonBarriers=None,
travelMode=None,
attributeParameterValues=None,
returnDirections=None,
returnRoutes=True,
returnS... | 0.008649 |
def get_bugs(self, project, status=None):
""" Retrives a List of bugs for a given project.
By default, this will only return activate bugs. If you wish to
retrieve a non-active bug then specify the status through the
status parameter.
:param project: The formal project name.
... | 0.002747 |
def active_conf_set_name(self):
'''The name of the currently-active configuration set.'''
with self._mutex:
if not self.conf_sets:
return ''
if not self._active_conf_set:
return ''
return self._active_conf_set | 0.006826 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.