text stringlengths 78 104k | score float64 0 0.18 |
|---|---|
def HasDynamicInvoke(self):
"""
Flag indicating if dynamic invocation is supported.
Returns:
bool: True if supported. False otherwise.
"""
from neo.Core.State.ContractState import ContractPropertyState
return self.ContractProperties & ContractPropertyState.Ha... | 0.008876 |
def _random_crop(image, size):
"""Make a random crop of (`size` x `size`)."""
bbox = tf.constant([0.0, 0.0, 1.0, 1.0], dtype=tf.float32, shape=[1, 1, 4])
random_image, bbox = distorted_bounding_box_crop(
image,
bbox,
min_object_covered=0.1,
aspect_ratio_range=(3. / 4, 4. / 3.),
area_... | 0.011272 |
def script_start_type(script):
"""Return the type of block the script begins with."""
if script[0].type.text == 'when @greenFlag clicked':
return HairballPlugin.HAT_GREEN_FLAG
elif script[0].type.text == 'when I receive %s':
return HairballPlugin.HAT_WHEN_I_RECEIVE
... | 0.003466 |
def utc_strftime(self, format):
"""Format the UTC time using a Python date formatting string.
This internally calls the Python ``strftime()`` routine from the
Standard Library ``time()`` module, for which you can find a
quick reference at ``http://strftime.org/``. If this object is
... | 0.00246 |
def _get_and_count_containers(self, custom_cgroups=False, healthchecks=False):
"""List all the containers from the API, filter and count them."""
# Querying the size of containers is slow, we don't do it at each run
must_query_size = self.collect_container_size and self._latest_size_query == 0
... | 0.004975 |
def process(self, salt_data, token, opts):
'''
Process events and publish data
'''
parts = salt_data['tag'].split('/')
if len(parts) < 2:
return
# TBD: Simplify these conditional expressions
if parts[1] == 'job':
if parts[3] == 'new':
... | 0.002334 |
def _get_fieldsets_post_form_or_formset(self, request, form, obj=None):
"""
Generic get_fieldsets code, shared by
TranslationAdmin and TranslationInlineModelAdmin.
"""
base_fields = self.replace_orig_field(form.base_fields.keys())
fields = base_fields + list(self.get_read... | 0.004819 |
def view_status_code(codes):
"""Return status code or random status code if more than one are given
---
tags:
- Status codes
parameters:
- in: path
name: codes
produces:
- text/plain
responses:
100:
description: Informational responses
200:
d... | 0.000915 |
def _parse_launch_error(data):
"""
Parses a LAUNCH_ERROR message and returns a LaunchFailure object.
:type data: dict
:rtype: LaunchFailure
"""
return LaunchFailure(
data.get(ERROR_REASON, None),
data.get(APP_ID),
data.get(REQUEST_ID),... | 0.006061 |
def get_channels(self, current=True, publish_only=False, settings=False):
"""
if "current" is false it will return all channels that a user
has published to in the past.
if publish_only is set to true, then return only the channels
that are publishable.
... | 0.003289 |
def commit_file(self, message, path, content):
"""
Add a new file as blob in the storage, add its tree entry into the index and commit the index.
:param message: str
:param path: str
:param content: str
:return:
"""
if self.git_batch_commit:
... | 0.006289 |
def list(members, meta=None) -> List: # pylint:disable=redefined-builtin
"""Creates a new list."""
return List( # pylint: disable=abstract-class-instantiated
plist(iterable=members), meta=meta
) | 0.00463 |
def attach(self, remote_entry):
"""Attach a remote entry to a local entry"""
self.name = remote_entry.name
self.sha = remote_entry.sha
self.url = remote_entry.url
self.author = remote_entry.author
return self | 0.007813 |
def secgroup_info(call=None, kwargs=None):
'''
Retrieves information for the given security group. Either a name or a
secgroup_id must be supplied.
.. versionadded:: 2016.3.0
name
The name of the security group for which to gather information. Can be
used instead of ``secgroup_id``... | 0.001828 |
def get_item(self, path_, default):
"""Return item or default. In the latter, change file to have default.
Arguments:
path_ -- path to item in section/subsection structure. May be either:
["section", "subsection", ...] or
"[/]section/subsectio... | 0.004425 |
def _wait_for_read_ready_or_timeout(self, timeout):
"""Returns tuple of whether stdin is ready to read and an event.
If an event is returned, that event is more pressing than reading
bytes on stdin to create a keyboard input event.
If stdin is ready, either there are bytes to read or a ... | 0.001312 |
def filter_by_type(stmts_in, stmt_type, **kwargs):
"""Filter to a given statement type.
Parameters
----------
stmts_in : list[indra.statements.Statement]
A list of statements to filter.
stmt_type : indra.statements.Statement
The class of the statement type to filter for.
Exa... | 0.000792 |
def hexdump(src, length=16, sep='.'):
"""
Returns src in hex dump.
From https://gist.github.com/ImmortalPC/c340564823f283fe530b
:param length: Nb Bytes by row.
:param sep: For the text part, sep will be used for non ASCII char.
:return: The hexdump
"""
result = []
for i in range(0,... | 0.0009 |
def put_multiple(self, packages):
"""put tasks
This method places multiple tasks in the working area and have
the dispatcher execute them.
Parameters
----------
packages : list(callable)
A list of tasks
Returns
-------
list(int)
... | 0.003731 |
def copy(self, dst_bucket, dst_key, metadata=None,
reduced_redundancy=False, preserve_acl=False,
encrypt_key=False):
"""
Copy this Key to another bucket.
:type dst_bucket: string
:param dst_bucket: The name of the destination bucket
:type dst_key: stri... | 0.001669 |
def get_checker_executable(name):
"""Return checker executable in the form of a list of arguments
for subprocess.Popen"""
if programs.is_program_installed(name):
# Checker is properly installed
return [name]
else:
path1 = programs.python_script_exists(package=None,
... | 0.001072 |
def rc_stats(stats):
"""
reverse completement stats
"""
rc_nucs = {'A':'T', 'T':'A', 'G':'C', 'C':'G', 'N':'N'}
rcs = []
for pos in reversed(stats):
rc = {}
rc['reference frequencey'] = pos['reference frequency']
rc['consensus frequencey'] = pos['consensus frequency']
... | 0.009231 |
def _get_zk_path_children(self, zk_conn, zk_path, name_for_error):
"""Fetch child nodes for a given Zookeeper path."""
children = []
try:
children = zk_conn.get_children(zk_path)
except NoNodeError:
self.log.info('No zookeeper node at %s', zk_path)
except ... | 0.006834 |
def error_mode(self):
"""error mode: enable only errors; no reports, no persistent"""
self._error_mode = True
self.disable_noerror_messages()
self.disable("miscellaneous")
if self._python3_porting_mode:
self.disable("all")
for msg_id in self._checker_messa... | 0.002367 |
def shift(self, time: int) -> 'Interval':
"""Return a new interval shifted by `time` from self
Args:
time: time to be shifted
Returns:
Interval: interval shifted by `time`
"""
return Interval(self._begin + time, self._end + time) | 0.00678 |
def get_reply(self, method, replyroot):
"""
Process the I{reply} for the specified I{method} by unmarshalling it
into into Python object(s).
@param method: The name of the invoked method.
@type method: str
@param replyroot: The reply XML root node received after invoking... | 0.001555 |
def get_conventional_standard_structure(
self, international_monoclinic=True):
"""
Gives a structure with a conventional cell according to certain
standards. The standards are defined in Setyawan, W., & Curtarolo,
S. (2010). High-throughput electronic band structure calculati... | 0.000677 |
def history(self, raw=True, output=False, hist_access_type='range', **kwargs):
"""Get entries from the history list.
Parameters
----------
raw : bool
If True, return the raw input.
output : bool
If True, then return the output as well.
hist_access... | 0.003655 |
def authorized_signup_handler(resp, remote, *args, **kwargs):
"""Handle sign-in/up functionality.
:param remote: The remote application.
:param resp: The response.
:returns: Redirect response.
"""
# Remove any previously stored auto register session key
session.pop(token_session_key(remote.... | 0.000344 |
def songs_delete(self, songs):
"""Delete songs from library.
Parameters:
song (list): A list of song dicts.
Returns:
list: Successfully deleted song IDs.
"""
mutations = [mc_calls.TrackBatch.delete(song['id']) for song in songs]
response = self._call(
mc_calls.TrackBatch,
mutations
)
suc... | 0.041118 |
def _run_germline(align_bams, items, ref_file, target, out_file):
"""Run germline calling, handling populations.
TODO:
- We could better handle trio calling with ped inputs as octopus
has special support.
"""
align_bams = " ".join(align_bams)
cores = dd.get_num_cores(items[0])
cmd... | 0.002601 |
def same_tech(self, other: Union[UnitTypeId, Set[UnitTypeId], List[UnitTypeId], Dict[UnitTypeId, Any]]) -> "Units":
""" Usage:
'self.units.same_tech(UnitTypeId.COMMANDCENTER)' or 'self.units.same_tech(UnitTypeId.ORBITALCOMMAND)'
returns all CommandCenter, CommandCenterFlying, OrbitalCommand, Orb... | 0.006745 |
def target_is_valid(self, target_id=0):
"""
Returns True or False indicating whether or not the specified
target is present and valid.
`target_id` is a target ID (or None for the first target)
"""
try:
target = self._target(target_id=target_id)
except... | 0.007692 |
def _match_overlay(self, raster, overlay_spec):
"""
Given a raster or input overlay, generate a list of matched
elements (None if no match) and corresponding tuple of match
strength values.
"""
ordering = [None]*len(overlay_spec) # Elements to overlay
strengths = ... | 0.006466 |
def replace_uid(old_uwnetid, new_uwnetid, no_custom_fields=True):
"""
Return a list of BridgeUser objects without custom fields
"""
url = author_uid_url(old_uwnetid)
if not no_custom_fields:
url += ("?%s" % CUSTOM_FIELD)
resp = patch_resource(url, '{"user":{"uid":"%s@uw.edu"}}' % new_uwn... | 0.002294 |
def find_first_available_template(self, template_name_list):
"""
Given a list of template names, find the first one that actually exists
and is available.
"""
if isinstance(template_name_list, six.string_types):
return template_name_list
else:
# Ta... | 0.004608 |
def update(self, **kwargs):
'''
Update an existing GraftM package with new sequences and taxonomy. If no
taxonomy is provided, attempt to decorate the new sequences with
pre-existing taxonomy.
Parameters
----------
input_sequence_path: str
Path to FAS... | 0.004349 |
def add_record_predicate(self, record_predicate,
code=RECORD_PREDICATE_FALSE,
message=MESSAGES[RECORD_PREDICATE_FALSE],
modulus=1):
"""
Add a record predicate function.
N.B., everything you can do with record predicates can... | 0.006981 |
def event_handler(event_name):
"""
Decorator for designating a handler for an event type. ``event_name`` must be a string
representing the name of the event type.
The decorated function must accept a parameter: the body of the received event,
which will be a Python object that can be encoded as a J... | 0.007342 |
def _add_token(self, token, parent_node='root'):
"""add a token to this docgraph"""
if parent_node == 'root':
parent_node = self.root
token_node_id = 'token:{}'.format(self.token_count)
self.add_node(token_node_id, layers={self.ns, self.ns+':token'},
at... | 0.003466 |
def parse_field_options(self, *options):
"""
Parse the field options query string and return it as a dictionary.
"""
defaults = {}
for option in options:
if isinstance(option, six.text_type):
tokens = [token.strip() for token in option.split(self.view.... | 0.005566 |
def save_plain_image_as_file(self, filepath, format='png', quality=90):
"""Used for generating thumbnails. Does not include overlaid
graphics.
"""
qimg = self.get_plain_image_as_widget()
qimg.save(filepath, format=format, quality=quality) | 0.007168 |
def aggregate(self, instance, owner):
"""Given an instance and a class, aggregate together some panglers.
Walks every class in the MRO of the `owner` class, including `owner`,
collecting panglers exposed as `self.attr_name`. The resulting pangler
will be bound to the provided `instance`... | 0.00246 |
def myself(self):
"""
Return a :class:`Context` referring to the current process.
"""
return self.context_class(
router=self,
context_id=mitogen.context_id,
name='self',
) | 0.008097 |
def incoming_phone_numbers(self):
"""
Access the incoming_phone_numbers
:returns: twilio.rest.api.v2010.account.incoming_phone_number.IncomingPhoneNumberList
:rtype: twilio.rest.api.v2010.account.incoming_phone_number.IncomingPhoneNumberList
"""
if self._incoming_phone_n... | 0.007366 |
def alarm_on_segfault(self, alarm):
"""Raise the specified alarm when the segmentation fault handler is executed.
Sends a backtrace.
:param AlarmType|list[AlarmType] alarm: Alarm.
"""
self.register_alarm(alarm)
for alarm in listify(alarm):
self._set('alarm-... | 0.007792 |
def pic_totalremotedischarge_v1(self):
"""Update the receiver link sequence."""
flu = self.sequences.fluxes.fastaccess
rec = self.sequences.receivers.fastaccess
flu.totalremotedischarge = rec.q[0] | 0.004717 |
def with_color_stripped(f):
"""
A function decorator for applying to `len` or imitators thereof that strips
ANSI color sequences from a string before passing it on. If any color
sequences are not followed by a reset sequence, an `UnterminatedColorError`
is raised.
"""
@wraps(f)
def colo... | 0.001531 |
def color_conversion_function(start_type, target_type):
"""
Decorator to indicate a function that performs a conversion from one color
space to another.
This decorator will return the original function unmodified, however it will
be registered in the _conversion_manager so it can be used to perform... | 0.002418 |
def memoize(f):
""" Decorator which caches function's return value each it is called.
If called later with same arguments, the cached value is returned.
"""
cache = {}
@wraps(f)
def inner(arg):
if arg not in cache:
cache[arg] = f(arg)
return cache[arg]
return inn... | 0.003106 |
def write_loom(self, filename: PathLike, write_obsm_varm: bool = False):
"""Write ``.loom``-formatted hdf5 file.
Parameters
----------
filename
The filename.
"""
from .readwrite.write import write_loom
write_loom(filename, self, write_obsm_varm = writ... | 0.012048 |
def AgregarCertificado(self, tipo_certificado_deposito=None,
nro_certificado_deposito=None,
peso_neto=None,
cod_localidad_procedencia=None,
cod_prov_procedencia=None,
campania=None, fec... | 0.006271 |
def create(cls, name, ncpus=None):
"""Create a Moap instance based on the predictor name.
Parameters
----------
name : str
Name of the predictor (eg. Xgboost, BayesianRidge, ...)
ncpus : int, optional
Number of threads. Default is the number spec... | 0.006734 |
def parse_arguments(
argv: Optional[Sequence[str]] = None) -> argparse.Namespace:
"""
Parse the command line arguments.
Args:
argv:
If not ``None``, use the provided command line arguments for
parsing. Otherwise, extract them automatically.
Returns:
The ... | 0.000726 |
def cum_returns(returns, starting_value=0, out=None):
"""
Compute cumulative returns from simple returns.
Parameters
----------
returns : pd.Series, np.ndarray, or pd.DataFrame
Returns of the strategy as a percentage, noncumulative.
- Time series with decimal returns.
- Ex... | 0.000607 |
def deploy(self):
'''
Deploy salt-thin
'''
self.shell.send(
self.thin,
os.path.join(self.thin_dir, 'salt-thin.tgz'),
)
self.deploy_ext()
return True | 0.008772 |
def load(cls, database, doc_id):
"""Load a specific document from the given database.
:param database: the `Database` object to retrieve the document from
:param doc_id: the document ID
:return: the `Document` instance, or `None` if no document with the
given ID was fou... | 0.004484 |
def verify_arguments(self, args=None, kwargs=None):
"""Ensures that the arguments specified match the signature of the real method.
:raise: ``VerifyingDoubleError`` if the arguments do not match.
"""
args = self.args if args is None else args
kwargs = self.kwargs if kwargs is N... | 0.005329 |
def grid_reload_from_ids(oargrid_jobids):
"""Reload all running or pending jobs of Grid'5000 from their ids
Args:
oargrid_jobids (list): list of ``(site, oar_jobid)`` identifying the
jobs on each site
Returns:
The list of python-grid5000 jobs retrieved
"""
gk = get_api_... | 0.002237 |
def fill_notebook(work_notebook, script_blocks):
"""Writes the Jupyter notebook cells
Parameters
----------
script_blocks : list
Each list element should be a tuple of (label, content, lineno).
"""
for blabel, bcontent, lineno in script_blocks:
if blabel == 'code':
... | 0.002304 |
def validate(
schema: GraphQLSchema,
document_ast: DocumentNode,
rules: Sequence[RuleType] = None,
type_info: TypeInfo = None,
) -> List[GraphQLError]:
"""Implements the "Validation" section of the spec.
Validation runs synchronously, returning a list of encountered errors, or an empty
list... | 0.003127 |
def pkcs7_unpad(data):
"""
Remove the padding bytes that were added at point of encryption.
Implementation copied from pyaspora:
https://github.com/mjnovice/pyaspora/blob/master/pyaspora/diaspora/protocol.py#L209
"""
if isinstance(data, str):
return data[0:-ord(data[-1])]
else:
... | 0.002874 |
def OnMacroToolbarToggle(self, event):
"""Macro toolbar toggle event handler"""
self.main_window.macro_toolbar.SetGripperVisible(True)
macro_toolbar_info = self.main_window._mgr.GetPane("macro_toolbar")
self._toggle_pane(macro_toolbar_info)
event.Skip() | 0.006757 |
def edges(self, **kwargs):
"""Get the known catalog edges, formed between two resources.
:param \*\*kwargs: The rest of the keyword arguments are passed
to the _query function.
:returns: A generating yielding Edges.
:rtype: :class:`pypuppetdb.types.Edge`
... | 0.004728 |
def _draw_tiles(self, x_offset, y_offset, bg):
"""Render all visible tiles a layer at a time."""
count = 0
for layer_name, c_filters, t_filters in self._get_features():
colour = (self._256_PALETTE[layer_name]
if self._screen.colours >= 256 else self._16_PALETTE[... | 0.004992 |
def compartments(self):
"""lists compartments the metabolites are in"""
if self._compartments is None:
self._compartments = {met.compartment for met in self._metabolites
if met.compartment is not None}
return self._compartments | 0.006734 |
def remove(key, val, delimiter=DEFAULT_TARGET_DELIM):
'''
.. versionadded:: 0.17.0
Remove a value from a list in the grains config file
key
The grain key to remove.
val
The value to remove.
delimiter
The key can be a nested dict key. Use this parameter to
spec... | 0.000868 |
def to_database(self, manager=None):
"""Send the model to the PyBEL database
This function wraps :py:func:`pybel.to_database`.
Parameters
----------
manager : Optional[pybel.manager.Manager]
A PyBEL database manager. If none, first checks the PyBEL
confi... | 0.002323 |
def _add_modifiers(self, sql, blueprint, column):
"""
Add the column modifiers to the deifinition
"""
for modifier in self._modifiers:
method = '_modify_%s' % modifier
if hasattr(self, method):
sql += getattr(self, method)(blueprint, column)
... | 0.005988 |
def init_current_directory():
"""Initialize and create dry config file(s) inside current directory"""
settings_directory=project_path+'/.dry'
settings_file=settings_directory+'/config.py'
if os.path.isdir(settings_directory):
# already initialized
print("directory already initialized.")
return
# ... | 0.02027 |
def _handle_decl_list(self, node, scope, ctxt, stream):
"""Handle For nodes
:node: TODO
:scope: TODO
:ctxt: TODO
:stream: TODO
:returns: TODO
"""
self._dlog("handling decl list")
# just handle each declaration
for decl in node.decls:
... | 0.005376 |
def heartbeat(self):
"""
Heartbeats update the job's entry in the database with a timestamp
for the latest_heartbeat and allows for the job to be killed
externally. This allows at the system level to monitor what is
actually active.
For instance, an old heartbeat for Sch... | 0.001418 |
def vamp_1_score(K, C00_train, C0t_train, Ctt_train, C00_test, C0t_test, Ctt_test, k=None):
""" Computes the VAMP-1 score of a kinetic model.
Ranks the kinetic model described by the estimation of covariances C00, C0t and Ctt,
defined by:
:math:`C_{0t}^{train} = E_t[x_t x_{t+\tau}^T]`
:ma... | 0.00661 |
def cloud_cover_to_irradiance_clearsky_scaling(self, cloud_cover,
method='linear',
**kwargs):
"""
Estimates irradiance from cloud cover in the following steps:
1. Determine clear sky GHI using ... | 0.002275 |
def _get_consent_id(self, requester, user_id, filtered_attr):
"""
Get a hashed id based on requester, user id and filtered attributes
:type requester: str
:type user_id: str
:type filtered_attr: dict[str, str]
:param requester: The calling requester
:param user_... | 0.003452 |
def encoder_vgg(x, enc_final_size, reuse=False, scope_prefix='', hparams=None,
is_training=True):
"""VGG network to use as encoder without the top few layers.
Can be pretrained.
Args:
x: The image to encode. In the range 0 to 1.
enc_final_size: The desired size of the encoding.
reuse... | 0.007349 |
def context(self, context):
"""Sets the context that Selenium commands are running in using
a `with` statement. The state of the context on the server is
saved before entering the block, and restored upon exiting it.
:param context: Context, may be one of the class properties
... | 0.002789 |
def xml_import(self,
xml_fname=None,
xml_content=None,
ns_mapping=None,
embedded_predicate=None,
id_and_revision_extractor=None,
extract_empty_embedded=False,
keep_attrs_in_created_refere... | 0.006835 |
def add_interceptor(self, interceptor):
"""
Adds an interceptor for this map. Added interceptor will intercept operations and execute user defined methods.
:param interceptor: (object), interceptor for the map which includes user defined methods.
:return: (str),id of registered intercep... | 0.011416 |
def kv_format_object(o, keys=None, separator=DEFAULT_SEPARATOR):
"""Formats an object's attributes. Useful for object representation
implementation. Will skip methods or private attributes.
For more details see :func:`kv_format`.
:param o:
Object to format.
:param collections.Sequence ke... | 0.001021 |
def pexpire_at(self, _time):
""" Sets the expiration time of :prop:key_prefix to @_time
@_time: absolute Unix timestamp (milliseconds
since January 1, 1970)
"""
return self._client.pexpireat(self.key_prefix, round(_time)) | 0.007326 |
def get_application_choices():
"""
Get the select options for the application selector
:return:
"""
result = []
keys = set()
for ct in ContentType.objects.order_by('app_label', 'model'):
try:
if issubclass(ct.model_class(), TranslatableModel) and ct.app_label not in keys... | 0.005725 |
def locked_get(self):
"""Retrieve Credential from datastore.
Returns:
oauth2client.Credentials
"""
credentials = None
if self._cache:
json = self._cache.get(self._key_name)
if json:
credentials = client.Credentials.new_from_jso... | 0.00271 |
def get_unaligned_lines(self):
"""get the lines that are not aligned"""
sys.stderr.write("error unimplemented get_unaligned_lines\n")
sys.exit()
return [self._lines[x-1] for x in self._unaligned] | 0.004739 |
def convert_array(array):
"""
Converts an ARRAY string stored in the database back into a Numpy array.
Parameters
----------
array: ARRAY
The array object to be converted back into a Numpy array.
Returns
-------
array
The converted Numpy array.
"""
out = io... | 0.002667 |
def format_dapi_score(cls, meta, offset):
'''Format the line with DAPI user rating and number of votes'''
if 'average_rank' and 'rank_count' in meta:
label = (cls._nice_strings['average_rank'] + ':').ljust(offset + 2)
score = cls._format_field(meta['average_rank'])
vo... | 0.004444 |
def getSNPSetsList() :
"""Return the names of all imported snp sets"""
import rabaDB.filters as rfilt
f = rfilt.RabaQuery(SNPMaster)
names = []
for g in f.iterRun() :
names.append(g.setName)
return names | 0.047393 |
def not_equal(lhs, rhs):
"""Returns the result of element-wise **not equal to** (!=) comparison operation
with broadcasting.
For each element in input arrays, return 1(true) if corresponding elements are different,
otherwise return 0(false).
Equivalent to ``lhs != rhs`` and ``mx.nd.broadcast_not_e... | 0.002567 |
def write(self, s):
"""
Write wrapper.
Parameters
----------
s : bytes
Bytes to write
"""
try:
return self.handle.write(s)
except OSError:
print()
print("Piksi disconnected")
print()
ra... | 0.006042 |
def channels_leave(self, room_id, **kwargs):
"""Causes the callee to be removed from the channel."""
return self.__call_api_post('channels.leave', roomId=room_id, kwargs=kwargs) | 0.015544 |
def write_config(config, app_dir, filename='configuration.json'):
"""Write configuration to the applicaiton directory."""
path = os.path.join(app_dir, filename)
with open(path, 'w') as f:
json.dump(
config, f, indent=4, cls=DetectMissingEncoder,
separators=(',', ': ')) | 0.003195 |
def process_non_raw_string_token(self, prefix, string_body, start_row):
'''
check for bad escapes in a non-raw string.
prefix: lowercase string of eg 'ur' string prefix markers.
string_body: the un-parsed body of the string, not including the quote
marks.
start_row: inte... | 0.003906 |
def face_adjacency_angles(self):
"""
Return the angle between adjacent faces
Returns
--------
adjacency_angle : (n,) float
Angle between adjacent faces
Each value corresponds with self.face_adjacency
"""
pairs = self.face_normals[self.face_adj... | 0.005063 |
def io_check(*args, func=None):
"""Check if arguments are file-like object."""
func = func or inspect.stack()[2][3]
for var in args:
if not isinstance(var, io.IOBase):
name = type(var).__name__
raise IOObjError(
f'Function {func} expected file-like object, {na... | 0.005917 |
def _image_summary(self, tf_name, images, step=None):
"""
Log a list of images.
References:
https://github.com/yunjey/pytorch-tutorial/blob/master/tutorials/04-utils/tensorboard/logger.py#L22
Example:
>>> tf_name = 'foo'
>>> value = ([0, 1, 2, 3, 4, ... | 0.002559 |
def _CreateDictReader(self, line_reader):
"""Returns a reader that processes each row and yields dictionaries.
csv.DictReader does this job well for single-character delimiters; parsers
that need multi-character delimiters need to override this method.
Args:
line_reader (iter): yields lines from... | 0.004008 |
def error(self, msg):
"""Callback run when a recoverable parsing error occurs"""
self._error = True
self._progress.printMsg('XML parse error: %s' % msg, error=True) | 0.010582 |
def about(self):
"""Create About Spyder dialog with general information."""
versions = get_versions()
# Show Git revision for development version
revlink = ''
if versions['revision']:
rev = versions['revision']
revlink = " (<a href='https://github.c... | 0.000421 |
def flattening(self,R,z):
"""
NAME:
flattening
PURPOSE:
calculate the potential flattening, defined as sqrt(fabs(z/R F_R/F_z))
INPUT:
R - Galactocentric radius (can be Quantity)
z - height ... | 0.035938 |
def on_edit(request, page_name):
"""Edit the current revision of a page."""
change_note = error = ""
revision = (
Revision.query.filter(
(Page.name == page_name) & (Page.page_id == Revision.page_id)
)
.order_by(Revision.revision_id.desc())
.first()
)
if re... | 0.000797 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.