text stringlengths 78 104k | score float64 0 0.18 |
|---|---|
def modifyInPlace(self, *, sort=None, purge=False, done=None):
"""Like Model.modify, but changes existing database instead of
returning a new one."""
self.data = self.modify(sort=sort, purge=purge, done=done) | 0.008621 |
def execute(self, *args, **kwargs):
"""
Fill all variables from *args and **kwargs, build the request,
and send it. If we set the _verbose kwarg to true, then we'll
get a Response object back instead of loaded data.
"""
_verbose = kwargs.pop('_verbose', False)
ret... | 0.003096 |
def itemData(self, f=None, savePath=None):
""" returns data for an item on agol/portal
Inputs:
f - output format either zip of json
savePath - location to save the file
Output:
either JSON/text or filepath
"""
params = {
}
if f i... | 0.003877 |
def get_access_info(self, unscoped_auth):
"""Get the access info object
We attempt to get the auth ref. If it fails and if the K2K auth plugin
was being used then we will prepend a message saying that the error was
on the service provider side.
:param: unscoped_auth: Keystone au... | 0.002646 |
def load_jupyter_server_extension(app): # pragma: no cover
"""Use Jupytext's contents manager"""
if isinstance(app.contents_manager_class, TextFileContentsManager):
app.log.info("[Jupytext Server Extension] NotebookApp.contents_manager_class is "
"(a subclass of) jupytext.TextFileC... | 0.004622 |
def _parse_file_usage(cls, action_class, args):
"""Find all external files referenced by an action."""
fixed_files = {}
variable_files = []
if not hasattr(action_class, 'FILES'):
return fixed_files, variable_files
for file_arg in action_class.FILES:
arg... | 0.003871 |
def do_download_datafiles(self, _):
''' Download datafiles. '''
contents = {"trialdata": lambda p: p.get_trial_data(), "eventdata": \
lambda p: p.get_event_data(), "questiondata": lambda p: \
p.get_question_data()}
query = Participant.query.all()
f... | 0.007921 |
def do_chan_log_all(self, line):
"""Set the channel log level to ALL_COMMS. Command syntax is: chan_log_all"""
self.application.channel.SetLogFilters(openpal.LogFilters(opendnp3.levels.ALL_COMMS))
print('Channel log filtering level is now: {0}'.format(opendnp3.levels.ALL_COMMS)) | 0.016502 |
def mequg(m1, nr, nc):
"""
Set one double precision matrix of arbitrary size equal to another.
http://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/mequg_c.html
:param m1: Input matrix.
:type m1: NxM-Element Array of floats
:param nr: Row dimension of m1.
:type nr: int
:param nc: Co... | 0.001517 |
def interpreter(self):
"""
Launch an AML interpreter session for testing
"""
while True:
message = input('[#] ')
if message.lower().strip() == 'exit':
break
reply = self.get_reply('#interpreter#', message)
if not reply:
... | 0.004141 |
def _build_dictionary(self, models):
"""
Build a dictionary with the models.
:param models: The models
:type models: Collection
"""
for model in models:
key = getattr(model, self._morph_type, None)
if key:
foreign = getattr(model, ... | 0.003284 |
def project_ranges(cb, msg, attributes):
"""
Projects ranges supplied by a callback.
"""
if skip(cb, msg, attributes):
return msg
plot = get_cb_plot(cb)
x0, x1 = msg.get('x_range', (0, 1000))
y0, y1 = msg.get('y_range', (0, 1000))
extents = x0, y0, x1, y1
x0, y0, x1, y1 = pr... | 0.001852 |
def get_file(self,
target_path,
host_path,
note=None,
loglevel=logging.DEBUG):
"""Copy a file from the target machine to the host machine
@param target_path: path to file in the target
@param host_path: path to file on the host machine (e.g. copy test)
... | 0.040316 |
def get_bounds(self):
"""
Get the parameters of bounding box of the UI element.
Returns:
:obj:`list` <:obj:`float`>: 4-list (top, right, bottom, left) coordinates related to the edge of screen in
NormalizedCoordinate system
"""
size = self.get_size()
... | 0.008081 |
def fix_dashes(string):
"""Fix bad Unicode special dashes in string."""
string = string.replace(u'\u05BE', '-')
string = string.replace(u'\u1806', '-')
string = string.replace(u'\u2E3A', '-')
string = string.replace(u'\u2E3B', '-')
string = unidecode(string)
return re.sub(r'--+', '-', string... | 0.003115 |
def get_pythonpath(self, at_start=False):
"""Get project path as a list to be added to PYTHONPATH"""
if at_start:
current_path = self.get_option('current_project_path',
default=None)
else:
current_path = self.get_active_pro... | 0.004566 |
def _to_dict(self):
"""Return a json dictionary representing this model."""
_dict = {}
if hasattr(self, 'document_id') and self.document_id is not None:
_dict['document_id'] = self.document_id
if hasattr(self,
'configuration_id') and self.configuration_id i... | 0.001708 |
def spectrogram(source, nfft=512, overlap=90, window='hanning', caldb=93, calv=2.83):
"""
Produce a matrix of spectral intensity, uses matplotlib's specgram
function. Output is in dB scale.
:param source: filename of audiofile, or samplerate and vector of audio signal
:type source: str or (int, num... | 0.003406 |
def submit(recaptcha_challenge_field,
recaptcha_response_field,
private_key,
remoteip,
use_ssl=False):
"""
Submits a reCAPTCHA request for verification. Returns RecaptchaResponse
for the request
recaptcha_challenge_field -- The value of recaptcha_challenge_fi... | 0.00284 |
def module2upstream(mod):
"""Return a corresponding OpenStack upstream name for a python module.
mod -- python module name
"""
for rule in OPENSTACK_UPSTREAM_PKG_MAP:
pkglist = rule(mod, dist=None)
if pkglist:
return pkglist[0]
return mod | 0.003472 |
def source_path(cls, organization, source):
"""Return a fully-qualified source string."""
return google.api_core.path_template.expand(
"organizations/{organization}/sources/{source}",
organization=organization,
source=source,
) | 0.006969 |
def frame_update_count(self):
"""
The number of frames before this Layout should be updated.
"""
result = 1000000
for column in self._columns:
for widget in column:
if widget.frame_update_count > 0:
result = min(result, widget.frame... | 0.005618 |
def make_linkcode_resolve(package, url_fmt):
"""Returns a linkcode_resolve function for the given URL format
revision is a git commit reference (hash or name)
package is the name of the root module of the package
url_fmt is along the lines of ('https://github.com/USER/PROJECT/'
... | 0.001757 |
def andrews_curves(frame, class_column, ax=None, samples=200, color=None,
colormap=None, **kwds):
"""
Generate a matplotlib plot of Andrews curves, for visualising clusters of
multivariate data.
Andrews curves have the functional form:
f(t) = x_1/sqrt(2) + x_2 sin(t) + x_3 cos(t... | 0.000324 |
def truncate_graph_bbox(G, north, south, east, west, truncate_by_edge=False, retain_all=False):
"""
Remove every node in graph that falls outside a bounding box.
Needed because overpass returns entire ways that also include nodes outside
the bbox if the way (that is, a way with a single OSM ID) has a n... | 0.002343 |
def get_layout_as_string(layout):
"""
Take a dict or string and return a string.
The dict will be json dumped.
The string will json parsed to check for json validity. In order to deal
with strings which have been json encoded multiple times, keep json decoding
until a dict is... | 0.006525 |
def _postloop_hook(self) -> None:
""" Stops the alerter thread """
# After this function returns, cmdloop() releases self.terminal_lock which could make the alerter
# thread think the prompt is on screen. Therefore this is the best place to stop the alerter thread.
# You can also stop i... | 0.008421 |
def get_database_columns(self, tables=None, database=None):
"""Retrieve a dictionary of columns."""
# Get table data and columns from source database
source = database if database else self.database
tables = tables if tables else self.tables
return {tbl: self.get_columns(tbl) for... | 0.008658 |
def reftrack_alien_data(rt, role):
"""Return the data for the alien status
:param rt: the :class:`jukeboxcore.reftrack.Reftrack` holds the data
:type rt: :class:`jukeboxcore.reftrack.Reftrack`
:param role: item data role
:type role: QtCore.Qt.ItemDataRole
:returns: data for the alien status
... | 0.001838 |
def needs_to_be_resolved(parent_obj, attr_name):
"""
This function determines, if a reference (CrossReference) needs to be
resolved or not (while creating the model, while resolving references).
Args:
parent_obj: the object containing the attribute to be resolved.
attr_name: the attribu... | 0.00111 |
def send_http_request_with_json(context, method):
"""
Parameters:
.. code-block:: json
{
"param1": "value1",
"param2": "value2",
"param3": {
"param31": "value31"
}
}
"""
safe_add_http_re... | 0.001887 |
def main(argv: Optional[Sequence[str]] = None) -> None:
"""Parse arguments and process the homework assignment."""
parser = ArgumentParser(description="Convert Jupyter Notebook assignments to PDFs")
parser.add_argument(
"--hw",
type=int,
required=True,
help="Homework number t... | 0.002307 |
def result(self, psd_state):
"""Return freqs and averaged PSD for given center frequency"""
freq_array = numpy.fft.fftshift(psd_state['freq_array'])
pwr_array = numpy.fft.fftshift(psd_state['pwr_array'])
if self._crop_factor:
crop_bins_half = round((self._crop_factor * self.... | 0.002937 |
def mangle_signature(sig, max_chars=30):
"""Reformat a function signature to a more compact form."""
s = re.sub(r"^\((.*)\)$", r"\1", sig).strip()
# Strip strings (which can contain things that confuse the code below)
s = re.sub(r"\\\\", "", s)
s = re.sub(r"\\'", "", s)
s = re.sub(r"'[^']*'", "... | 0.000925 |
def _parse(self, command):
""" Parse a single command.
"""
cmd, id_, args = command[0], command[1], command[2:]
if cmd == 'CURRENT':
# This context is made current
self.env.clear()
self._gl_initialize()
self.env['fbo'] = args[0]
... | 0.000723 |
def wait_for_task(task_data, task_uri='/tasks'):
"""Run task and check the result.
Args:
task_data (str): the task json to execute
Returns:
str: Task status.
"""
taskid = post_task(task_data, task_uri)
if isinstance(task_data, str):
json_data = json.loads(task_data)
... | 0.002849 |
def listdir(dir_name, get_dirs=None, get_files=None, hide_ignored=False):
"""
Return list of all dirs and files inside given dir.
Also can filter contents to return only dirs or files.
Args:
- dir_name: Which directory we need to scan (relative)
- get_dirs: Return dirs list
- get_files: Re... | 0.001066 |
def make_purge_data(parser):
"""
Purge (delete, destroy, discard, shred) any Ceph data from /var/lib/ceph
"""
parser.add_argument(
'host',
metavar='HOST',
nargs='+',
help='hosts to purge Ceph data from',
)
parser.set_defaults(
func=purgedata,
) | 0.003125 |
def to_file(self, output_filename):
'''Handles pdf and epub format.
Inpute: output_filename should have the proper extension.
Output: The name of the file created, or an IOError if failed'''
temp_file = NamedTemporaryFile(mode="w", suffix=".md", delete=False)
temp_file.write(self... | 0.004561 |
def is_opus_maximum(self):
"""Check whether the work is the author's opus maximum.
Two cases:
1. the work is flagged as opus max
2. there is only one work by this author
:return: boolean
"""
opmax = self._get_opus_maximum()
types = self.ecrm_P2_has_type
... | 0.003922 |
def create(self, create_info=None, hyperparameter=None, server='local', insights=False):
"""
Creates a new job in git and pushes it.
:param create_info: from the api.create_job_info(id). Contains the config and job info (type, server)
:param hyperparameter: simple nested dict with key->... | 0.004699 |
def get_environmental_configuration(self):
"""
Gets the settings that describe the environmental configuration (supported feature set, calibrated minimum &
maximum power, location & dimensions, ...) of the enclosure resource.
Returns:
Settings that describe the environmental... | 0.00655 |
def get_causal_central_nodes(graph: BELGraph, func: str) -> Set[BaseEntity]:
"""Return a set of all nodes that have both an in-degree > 0 and out-degree > 0.
This means that they are an integral part of a pathway, since they are both produced and consumed.
"""
return {
node
for node in ... | 0.007519 |
def simulate(self):
"""Generates a random integer in the available range."""
min_ = (-sys.maxsize - 1) if self._min is None else self._min
max_ = sys.maxsize if self._max is None else self._max
return random.randint(min_, max_) | 0.007722 |
def _influxdb_url(self):
""" Return REST API URL to access time series.
"""
url = "{0}/db/{1}/series".format(self.influxdb.url.rstrip('/'), self.config.dbname)
if self.influxdb.user and self.influxdb.password:
url += "?u={0}&p={1}".format(self.influxdb.user, self.influxdb.pa... | 0.011527 |
def get_readme():
"""Generate long description"""
pandoc = None
for path in os.environ["PATH"].split(os.pathsep):
path = path.strip('"')
pandoc = os.path.join(path, 'pandoc')
if os.path.isfile(pandoc) and os.access(pandoc, os.X_OK):
break
else:
pandoc ... | 0.001618 |
def get(self):
"""
Returns the next connection in this pool that is ready to be
reused. Returns None of there aren't any.
"""
# Discard ready connections that are too old.
self.clean()
# Return the first connection that is ready, and remove it
# from the... | 0.00277 |
def get_namespace_preorder_burn_info( outputs ):
"""
Given the set of outputs, find the fee sent
to our burn address.
Return the fee and burn address on success as {'op_fee': ..., 'burn_address': ...}
Return None if not found
"""
if len(outputs) < 3:
# not a well-formed preorde... | 0.014472 |
def _set_sub_prop(container, keys, value):
"""Set a nested value in a dictionary.
Arguments:
container (dict):
A dictionary which may contain other dictionaries as values.
keys (iterable):
A sequence of keys to attempt to set the value for. Each item in
the s... | 0.000734 |
def create_token(self, obj_id, extra_data):
"""Create a token referencing the object id with extra data.
Note random data is added to ensure that no two tokens are identical.
"""
return self.dumps(
dict(
id=obj_id,
data=extra_data,
... | 0.005 |
def case(self, case_id=None, institute_id=None, display_name=None):
"""Fetches a single case from database
Use either the _id or combination of institute_id and display_name
Args:
case_id(str): _id for a caes
institute_id(str):
display_name(str)
Yie... | 0.004624 |
def __insert_data(self):
"""!
@brief Inserts input data to the tree.
@remark If number of maximum number of entries is exceeded than diameter is increased and tree is rebuilt.
"""
for index_point in range(0, len(self.__pointer_data)):
... | 0.024605 |
def inverse(self, encoded, duration=None):
'''Inverse static tag transformation'''
ann = jams.Annotation(namespace=self.namespace, duration=duration)
if np.isrealobj(encoded):
detected = (encoded >= 0.5)
else:
detected = encoded
for vd in self.encoder.i... | 0.003257 |
def get(self, sid):
"""
Constructs a BindingContext
:param sid: The unique string that identifies the resource
:returns: twilio.rest.notify.v1.service.binding.BindingContext
:rtype: twilio.rest.notify.v1.service.binding.BindingContext
"""
return BindingContext(s... | 0.007752 |
def _ExtractPathSpecsFromFileSystem(
self, path_spec, find_specs=None, recurse_file_system=True,
resolver_context=None):
"""Extracts path specification from a file system within a specific source.
Args:
path_spec (dfvfs.PathSpec): path specification of the root of
the file system.
... | 0.007821 |
def hinit(func, x, t, pos_neg, f0, iord, hmax, rtol, atol, args):
"""
Estimate initial step size
"""
sk = atol + rtol * np.fabs(x)
dnf = np.sum(np.square(f0 / sk), axis=0)
dny = np.sum(np.square(x / sk), axis=0)
h = np.sqrt(dny / dnf) * 0.01
h = np.min([h, np.fabs(hmax)])
h = custo... | 0.002262 |
def tag(check, version, push, dry_run):
"""Tag the HEAD of the git repo with the current release number for a
specific check. The tag is pushed to origin by default.
You can tag everything at once by setting the check to `all`.
Notice: specifying a different version than the one in __about__.py is
... | 0.00168 |
def sibling(self, name: InstanceName) -> "ObjectMember":
"""Return an instance node corresponding to a sibling member.
Args:
name: Instance name of the sibling member.
Raises:
NonexistentSchemaNode: If member `name` is not permitted by the
schema.
... | 0.002347 |
def process_response(self, request, response):
"""Commits and leaves transaction management."""
if tldap.transaction.is_managed():
tldap.transaction.commit()
tldap.transaction.leave_transaction_management()
return response | 0.007407 |
def get_data(self):
"""
attempt to read measurements file in working directory.
"""
meas_file = os.path.join(self.WD, 'magic_measurements.txt')
if not os.path.isfile(meas_file):
print("-I- No magic_measurements.txt file")
return {}
try:
... | 0.002789 |
def assignrepr(self, prefix: str) -> str:
"""Return a |repr| string with a prefixed assignment."""
with objecttools.repr_.preserve_strings(True):
with hydpy.pub.options.ellipsis(2, optional=True):
with objecttools.assignrepr_tuple.always_bracketed(False):
... | 0.002389 |
def _retrieve_and_validate_certificate_chain(self, cert_url):
# type: (str) -> Certificate
"""Retrieve and validate certificate chain.
This method validates if the URL is valid and loads and
validates the certificate chain, before returning it.
:param cert_url: URL for retrievi... | 0.003812 |
def _get_bandgap_doscar(filename):
"""Get the bandgap from the DOSCAR file"""
with open(filename) as fp:
for i in range(6):
l = fp.readline()
efermi = float(l.split()[3])
step1 = fp.readline().split()[0]
step2 = fp.readline().split()[0]
... | 0.004162 |
def histogram(self, tag, values, bins, step=None):
"""Saves histogram of values.
Args:
tag: str: label for this data
values: ndarray: will be flattened by this routine
bins: number of bins in histogram, or array of bins for onp.histogram
step: int: training step
"""
if step is N... | 0.002358 |
def get_config_groups(self, groups_conf, groups_pillar_name):
'''
get info from groups in config, and from the named pillar
todo: add specification for the minion to use to recover pillar
'''
# Get groups
# Default to returning something that'll never match
ret_g... | 0.005638 |
def parameters(self):
"""Parameter declaration lines."""
lines = Lines()
lines.add(0, '@cython.final')
lines.add(0, 'cdef class Parameters(object):')
for subpars in self.model.parameters:
if subpars:
lines.add(1, 'cdef public %s %s'
... | 0.002016 |
def _save_owner_cover_photo(session, hash, photo):
"""
https://vk.com/dev/photos.saveOwnerCoverPhoto
"""
response = session.fetch('photos.saveOwnerCoverPhoto', hash=hash, photo=photo)
return response | 0.012552 |
def register_func_list(self, func_and_handler):
""" register a function to determine if the handle
should be used for the type
"""
for func, handler in func_and_handler:
self._function_dispatch.register(func, handler)
self.dispatch.cache_clear() | 0.006645 |
def from_element(self, element, defaults={}):
"""Populate object variables from SVD element"""
if isinstance(defaults, SvdElement):
defaults = vars(defaults)
for key in self.props:
try:
value = element.find(key).text
except AttributeError: # M... | 0.002281 |
def on_diff(request, page_name):
"""Show the diff between two revisions."""
old = request.args.get("old", type=int)
new = request.args.get("new", type=int)
error = ""
diff = page = old_rev = new_rev = None
if not (old and new):
error = "No revisions specified."
else:
revisio... | 0.000724 |
def determine_eigen_directions(metricParams, preserveMoments=False,
vary_fmax=False, vary_density=None):
"""
This function will calculate the coordinate transfomations that are needed
to rotate from a coordinate system described by the various Lambda
components in the freq... | 0.002973 |
def annotate(self):
"""
Returns a list of three element tuples with lineno,changeset and line
"""
if self.changeset is None:
raise NodeError('Unable to get changeset for this FileNode')
return self.changeset.get_file_annotate(self.path) | 0.006944 |
def get_tagged_artists(self, tag, limit=None):
"""Returns the artists tagged by a user."""
params = self._get_params()
params["tag"] = tag
params["taggingtype"] = "artist"
if limit:
params["limit"] = limit
doc = self._request(self.ws_prefix + ".getpersonaltag... | 0.005155 |
def add_data(self, data_id=None, default_value=EMPTY, initial_dist=0.0,
wait_inputs=False, wildcard=None, function=None, callback=None,
description=None, filters=None, await_result=None, **kwargs):
"""
Add a single data node to the dispatcher.
:param data_id:
... | 0.002057 |
def trace_debug_dispatch(self, frame, event, arg):
"""Utility function to add debug to tracing"""
trace_log.info(
'Frame:%s. Event: %s. Arg: %r' % (pretty_frame(frame), event, arg)
)
trace_log.debug(
'state %r breaks ? %s stops ? %s' % (
self.state... | 0.002283 |
def exception_handler(self, ex): # pylint: disable=no-self-use
""" The default exception handler """
if isinstance(ex, CLIError):
logger.error(ex)
else:
logger.exception(ex)
return 1 | 0.008368 |
def validate(self, value):
"""Validate field value."""
if value is not None:
if not isinstance(value, list):
raise ValidationError("field must be a list")
for index, element in enumerate(value):
try:
self.inner.validate(element... | 0.003503 |
def s_supply(self, bus):
""" Returns the total complex power generation capacity.
"""
Sg = array([complex(g.p, g.q) for g in self.generators if
(g.bus == bus) and not g.is_load], dtype=complex64)
if len(Sg):
return sum(Sg)
else:
return ... | 0.006135 |
def get_build_logs_zip(self, project, build_id, **kwargs):
"""GetBuildLogsZip.
Gets the logs for a build.
:param str project: Project ID or project name
:param int build_id: The ID of the build.
:rtype: object
"""
route_values = {}
if project is not None:
... | 0.004931 |
def save(self, filename):
'''save fence points to a file'''
f = open(filename, mode='w')
for p in self.points:
f.write("%f\t%f\n" % (p.lat, p.lng))
f.close() | 0.00995 |
def serialized(f):
"""Decorator that serializes access to all decorated functions.
The decorator acquires pyspotify's single global lock while calling any
wrapped function. It is used to serialize access to:
- All calls to functions on :attr:`spotify.lib`.
- All code blocks working on pointers re... | 0.001106 |
def fit(self, choosers, alternatives, current_choice):
"""
Fit and save models based on given data after segmenting
the `choosers` table. Segments that have not already been explicitly
added will be automatically added with default model.
Parameters
----------
ch... | 0.001034 |
def _cursor_helper(self, document_fields, before, start):
"""Set values to be used for a ``start_at`` or ``end_at`` cursor.
The values will later be used in a query protobuf.
When the query is sent to the server, the ``document_fields`` will
be used in the order given by fields set by
... | 0.000833 |
def __display_left(self, stat_display):
"""Display the left sidebar in the Curses interface."""
self.init_column()
if self.args.disable_left_sidebar:
return
for s in self._left_sidebar:
if ((hasattr(self.args, 'enable_' + s) or
hasattr(self.args... | 0.004474 |
def qasm(self, prec=15):
"""Return the corresponding OPENQASM string."""
string = "gate " + self.name
if self.arguments is not None:
string += "(" + self.arguments.qasm(prec) + ")"
string += " " + self.bitlist.qasm(prec) + "\n"
string += "{\n" + self.body.qasm(prec) +... | 0.00578 |
def acceptEdit( self ):
"""
Accepts the current text and rebuilds the parts widget.
"""
if ( self._partsWidget.isVisible() ):
return False
use_completion = self.completer().popup().isVisible()
completion = self.completer().currentCompleti... | 0.025045 |
def may_add_vlan(packet, vlan_id):
"""
:type packet: ryu.lib.packet.packet.Packet
:param packet:
:type vlan_id: int (0 <= vlan_id <= 4095) or None (= No VLAN)
:param vlan_id:
"""
if vlan_id is None:
return
e = packet.protocols[0]
assert isinstance(e, ethernet.ethernet)
v... | 0.002347 |
def arrays2wcxf(C):
"""Convert a dictionary with Wilson coefficient names as keys and
numbers or numpy arrays as values to a dictionary with a Wilson coefficient
name followed by underscore and numeric indices as keys and numbers as
values. This is needed for the output in WCxf format."""
d = {}
... | 0.001555 |
def normalize(self, decl_string, arg_separator=None):
"""implementation details"""
if not self.has_pattern(decl_string):
return decl_string
name, args = self.split(decl_string)
for i, arg in enumerate(args):
args[i] = self.normalize(arg)
return self.join(n... | 0.005797 |
def _get_inferred_data_column(column):
"""
Calculate the m/m/m/m for column values.
:param dict column: Column data
:return dict column: Column data - modified
"""
try:
with warnings.catch_warnings():
warnings.simplefilter("ignore")
# Get the values for this colum... | 0.004023 |
def start_state_id(self):
""" The start state is the state to which the first transition goes to.
The setter-method creates a unique first transition to the state with the given id.
Existing first transitions are removed. If the given state id is None, the first transition is removed.
... | 0.00565 |
def _get_sync_model_vars_op(self):
"""
Get the op to sync local model_variables to PS.
"""
ops = []
for (shadow_v, local_v) in self._shadow_model_vars:
ops.append(shadow_v.assign(local_v.read_value()))
assert len(ops)
return tf.group(*ops, name='sync_{... | 0.008287 |
def _order(self, value, is_reverse=None):
"""Parsing data to a sortable form
By giving each data type an ID(int), and assemble with the value
into a sortable tuple.
"""
def _dict_parser(dict_doc):
""" dict ordered by:
valueType_N -> key_N -> value_N
... | 0.000905 |
def getBranch(self, name, **context):
"""Return a branch of this tree where the 'name' OID may reside"""
for keyLen in self._vars.getKeysLens():
subName = name[:keyLen]
if subName in self._vars:
return self._vars[subName]
raise error.NoSuchObjectError(nam... | 0.005698 |
def convert_gempak_color(c, style='psc'):
"""Convert GEMPAK color numbers into corresponding Matplotlib colors.
Takes a sequence of GEMPAK color numbers and turns them into
equivalent Matplotlib colors. Various GEMPAK quirks are respected,
such as treating negative values as equivalent to 0.
Param... | 0.001888 |
def _set_source(self, v, load=False):
"""
Setter method for source, mapped from YANG variable /overlay_class_map/cmap_seq/match/source (ipv4-address)
If this variable is read-only (config: false) in the
source YANG file, then _set_source is considered as a private
method. Backends looking to populat... | 0.004808 |
def unregister(self, observers):
u"""
Concrete method of Subject.unregister().
Unregister observers as an argument to self.observers.
"""
if isinstance(observers, list) or isinstance(observers, tuple):
for observer in observers:
try:
... | 0.001724 |
def kms_to_kpcGyrDecorator(func):
"""Decorator to convert velocities from km/s to kpc/Gyr"""
@wraps(func)
def kms_to_kpcGyr_wrapper(*args,**kwargs):
return func(args[0],velocity_in_kpcGyr(args[1],1.),args[2],**kwargs)
return kms_to_kpcGyr_wrapper | 0.022222 |
def clear(self):
"""Clear task output: remove value ``budget_inflation_adjusted`` from all :class:`Movie` objects.
"""
self.mark_incomplete()
session = client.get_client().create_session()
movies = session.query(models.Movie)
movies.update({'budget_inflation_adjusted': N... | 0.008 |
def valid(self,individuals=None,F=None):
"""returns the sublist of individuals with valid fitness."""
if F:
valid_locs = self.valid_loc(F)
else:
valid_locs = self.valid_loc(self.F)
if individuals:
return [ind for i,ind in enumerate(individuals) if i i... | 0.016055 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.