text stringlengths 78 104k | score float64 0 0.18 |
|---|---|
def J(self, log_sigma):
"""Return the sensitivity matrix
Parameters
----------
log_sigma : numpy.ndarray
log_e conductivities
"""
m = 1.0 / np.exp(log_sigma)
tdm = self._get_tdm(m)
tdm.model(
sensitivities=True,
# out... | 0.001329 |
def setDirection( self, direction ):
"""
Sets the direction for this widget to the inputed direction.
:param direction | <XPopupWidget.Direction>
"""
if ( direction == XPopupWidget.Direction.North ):
self.setAnchor(XPopupWidget.Anchor.TopCenter)
... | 0.02099 |
def query(self):
""" Returns the base query which filters out data for all queries. """
query = (
self.book.session.query(Commodity)
.filter(Commodity.namespace != "CURRENCY",
Commodity.namespace != "template")
)
return query | 0.006645 |
def _clean(c):
"""
Nuke docs build target directory so next build is clean.
"""
if isdir(c.sphinx.target):
rmtree(c.sphinx.target) | 0.006494 |
def getRole(self, ID):
""" Returns the role (active or passive) of an object
in this aspect.
"""
if self.active.id == ID:
return {
'role': 'active',
'inOrb': self.active.inOrb,
'movement': self.active.movement
... | 0.005505 |
async def set_did_endpoint(self, remote_did: str, did_endpoint: str) -> EndpointInfo:
"""
Set endpoint as metadata for pairwise remote DID in wallet. Pick up (transport)
verification key from pairwise relation and return with endpoint in EndpointInfo.
Raise BadIdentifier on bad DID. R... | 0.006384 |
def deploy_s3(
src, requirements=None, local_package=None,
config_file='config.yaml', profile_name=None,
preserve_vpc=False
):
"""Deploys a new function via AWS S3.
:param str src:
The path to your Lambda ready project (folder must contain a valid
config.yaml and handler module (e.g... | 0.000708 |
def using(self, tube):
"""Context-manager to insert jobs into a specific tube
:param tube: Tube to insert to
Yields out an instance of :class:`BeanstalkInsertingProxy` to insert items into that tube
.. seealso::
:func:`use()`
Change the default tube
... | 0.004405 |
def addPort(n: LNode, intf: Interface):
"""
Add LayoutExternalPort for interface
"""
d = PortTypeFromDir(intf._direction)
ext_p = LayoutExternalPort(
n, name=intf._name, direction=d, node2lnode=n._node2lnode)
ext_p.originObj = originObjOfPort(intf)
n.children.append(ext_p)
addPor... | 0.002625 |
def set_children(self, item, *newchildren):
"""
Replaces item’s children with newchildren.
Children present in item that are not present in newchildren are detached
from tree. No items in newchildren may be an ancestor of item.
:param newchildren: new item's children (list of i... | 0.005906 |
async def get_record(self, *,
chat: typing.Union[str, int, None] = None,
user: typing.Union[str, int, None] = None) -> typing.Dict:
"""
Get record from storage
:param chat:
:param user:
:return:
"""
chat, user = s... | 0.008606 |
def _prefix_from_prefix_string(cls, prefixlen_str):
"""Return prefix length from a numeric string
Args:
prefixlen_str: The string to be converted
Returns:
An integer, the prefix length.
Raises:
NetmaskValueError: If the input is not a valid netmask
... | 0.002387 |
def get_new_version(self, last_version, last_commit,
diff_to_increase_ratio):
"""Gets new version
:param last_version: last version known
:param last_commit: hash of commit of last version
:param diff_to_increase_ratio: Ratio to convert number of changes into
... | 0.004808 |
def extension_by_source(source, mime_type):
"Return the file extension used by this plugin"
# TODO: should get this information from the plugin
extension = source.plugin_name
if extension:
return extension
if mime_type:
return mime_type.split("/")[-1] | 0.00346 |
def removeFixedEffect(self, index=None):
"""
set sample and trait designs
F: NxK sample design
A: LxP sample design
REML: REML for this term?
index: index of which fixed effect to replace. If None, remove last term.
"""
if self._n_terms==0:
... | 0.022043 |
def write(text, delay=0, restore_state_after=True, exact=None):
"""
Sends artificial keyboard events to the OS, simulating the typing of a given
text. Characters not available on the keyboard are typed as explicit unicode
characters using OS-specific functionality, such as alt+codepoint.
To ensure ... | 0.003562 |
def maybe_download(url, filename):
"""Download the data from Yann's website, unless it's already here."""
if not os.path.exists(WORK_DIRECTORY):
os.mkdir(WORK_DIRECTORY)
filepath = os.path.join(WORK_DIRECTORY, filename)
if not os.path.exists(filepath):
filepath, _ = request.urlretrieve(url + filename, f... | 0.013216 |
def recalculate_balance(stmt):
"""Recalculate statement starting and ending dates and balances.
When starting balance is not available, it will be assumed to be 0.
This function can be used in statement parsers when balance information is
not available in source statement.
"""
total_amount = ... | 0.001739 |
def mapAnchorFrom(self, widget, point):
"""
Returns the anchor point that best fits within the given widget from
the inputed global position.
:param widget | <QWidget>
point | <QPoint>
:return <XPopupWidget.Anchor>... | 0.004942 |
def paginate(data: typing.Iterable, page: int = 0, limit: int = 10) -> typing.Iterable:
"""
Slice data over pages
:param data: any iterable object
:type data: :obj:`typing.Iterable`
:param page: number of page
:type page: :obj:`int`
:param limit: items per page
:type limit: :obj:`int`
... | 0.004556 |
def cbpdn_setdict():
"""Set the dictionary for the cbpdn stage. There are no parameters
or return values because all inputs and outputs are from and to
global variables.
"""
global mp_DSf
# Set working dictionary for cbpdn step and compute DFT of dictionary
# D and of D^T S
mp_Df[:] = s... | 0.003597 |
def report_vm_statistics(self, valid_stats, cpu_user, cpu_kernel, cpu_idle, mem_total, mem_free, mem_balloon, mem_shared, mem_cache, paged_total, mem_alloc_total, mem_free_total, mem_balloon_total, mem_shared_total, vm_net_rx, vm_net_tx):
"""Passes statistics collected by VM (including guest statistics) to VBox... | 0.005369 |
def do_resolve(self, definitions):
"""
Resolve named references to other WSDL objects. This includes
cross-linking information (from) the portType (to) the I{SOAP} protocol
information on the binding for each operation.
@param definitions: A definitions object.
@type def... | 0.003367 |
def route_filter_rules(self):
"""Instance depends on the API version:
* 2016-12-01: :class:`RouteFilterRulesOperations<azure.mgmt.network.v2016_12_01.operations.RouteFilterRulesOperations>`
* 2017-03-01: :class:`RouteFilterRulesOperations<azure.mgmt.network.v2017_03_01.operations.RouteFil... | 0.007762 |
def generate_function(info, method=False):
"""Creates a Python callable for a GIFunctionInfo instance"""
assert isinstance(info, GIFunctionInfo)
arg_infos = list(info.get_args())
arg_types = [a.get_type() for a in arg_infos]
return_type = info.get_return_type()
func = None
messages = []
... | 0.001309 |
def setTotal( self, amount ):
"""
Sets the total amount for the main progress bar.
:param amount | <int>
"""
self._primaryProgressBar.setValue(0)
self._primaryProgressBar.setMaximum(amount)
if amount:
self.setCurrentMode(XLoaderW... | 0.017647 |
def add_line_segments(self, vertices, close=True):
"""Add a straight line segment to each point in *vertices*.
*vertices* must be an iterable of (x, y) pairs (2-tuples). Each x and
y value is rounded to the nearest integer before use. The optional
*close* parameter determines whether th... | 0.003241 |
def golden_section_search(fn, a, b, tolerance=1e-5):
"""
WIKIPEDIA IMPLEMENTATION
golden section search
to find the minimum of f on [a,b]
f: a strictly unimodal function on [a,b]
example:
>>> f=lambda x:(x-2)**2
>>> x=gss(f,1,5)
>>> x
2.000009644875678
"""
c = b - GOLDEN... | 0.004717 |
def getClassAllSubs(self, aURI):
"""
note: requires SPARQL 1.1
2015-06-04: currenlty not used, inferred from above
"""
aURI = aURI
try:
qres = self.rdfgraph.query(
"""SELECT DISTINCT ?x
WHERE {
{ ... | 0.0064 |
def create_bdew_load_profiles(self, dt_index, slp_types, holidays=None):
"""Calculates the hourly electricity load profile in MWh/h of a region.
"""
# define file path of slp csv data
file_path = os.path.join(self.datapath, 'selp_series.csv')
# Read standard load profile series... | 0.000934 |
def _bfs_subgraph(self, start_id, forward=True):
"""
Private method creates a subgraph in a bfs order.
The forward parameter specifies whether it is a forward or backward
traversal.
"""
if forward:
get_bfs = self.forw_bfs
get_nbrs = self.out_nbrs... | 0.006088 |
def _extract_match(self, candidate, offset):
"""Attempts to extract a match from a candidate string.
Arguments:
candidate -- The candidate text that might contain a phone number.
offset -- The offset of candidate within self.text
Returns the match found, None if none can be foun... | 0.001808 |
def compare(graph: BELGraph, annotation: str = 'Subgraph') -> Mapping[str, Mapping[str, float]]:
"""Compare generated mechanisms to actual ones.
1. Generates candidate mechanisms for each biological process
2. Gets sub-graphs for all NeuroMMSig signatures
3. Make tanimoto similarity comparison for all ... | 0.003666 |
def get_object_as_string(obj):
"""
Converts any object to JSON-like readable format, ready to be printed for debugging purposes
:param obj: Any object
:return: string
"""
if isinstance(obj, str):
return obj
if isinstance(obj, list):
return '\r\n\;'.join([get_object_as_string(... | 0.006593 |
def main(arguments=None):
"""
*The main function used when ``cl_utils.py`` is run as a single script from the cl, or when installed as a cl command*
"""
from astrocalc.coords import unit_conversion
# setup the command-line util settings
su = tools(
arguments=arguments,
docString=... | 0.001271 |
def sce2c(sc, et):
"""
Convert ephemeris seconds past J2000 (ET) to continuous encoded
spacecraft clock "ticks". Non-integral tick values may be
returned.
http://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/sce2c_c.html
:param sc: NAIF spacecraft ID code.
:type sc: int
:param et: ... | 0.001468 |
def remove(path, force=False):
'''
Remove the named file or directory
Args:
path (str): The path to the file or directory to remove.
force (bool): Remove even if marked Read-Only. Default is False
Returns:
bool: True if successful, False if unsuccessful
CLI Example:
.... | 0.00101 |
def conf_budget(self, budget):
"""
Set limit on the number of conflicts.
"""
if self.minisat:
pysolvers.minisat22_cbudget(self.minisat, budget) | 0.010417 |
def _reverse_op(name, doc="binary operator"):
""" Create a method for binary operator (this object is on right side)
"""
def _(self, other):
jother = _create_column_from_literal(other)
jc = getattr(jother, name)(self._jc)
return Column(jc)
_.__doc__ = doc
return _ | 0.003247 |
def bbox_to_mip(self, bbox, mip, to_mip):
"""Convert bbox or slices from one mip level to another."""
if not type(bbox) is Bbox:
bbox = lib.generate_slices(
bbox,
self.mip_bounds(mip).minpt,
self.mip_bounds(mip).maxpt,
bounded=False
)
bbox = Bbox.from_slices(... | 0.019694 |
def run(cmd, input=None, capture_output=False, check=False, quiet=False, **kwargs):
"""Run the command described by cmd and return its (stdout, stderr) tuple."""
if input is not None:
kwargs['stdin'] = subprocess.PIPE
if capture_output:
kwargs['stdout'] = kwargs['stderr'] = subprocess.PIPE
... | 0.003817 |
def _parse_header(stream):
'''
Parse a PLY header from a readable file-like stream.
'''
parser = _PlyHeaderParser()
while parser.consume(stream.readline()):
pass
return PlyData(
[PlyElement(*e) for e in parser.elements],
parser.format... | 0.004515 |
def attempt_renew_lease(self, lease_task, owned_by_others_q, lease_manager):
"""
Make attempt_renew_lease async call sync.
"""
loop = asyncio.new_event_loop()
loop.run_until_complete(self.attempt_renew_lease_async(lease_task, owned_by_others_q, lease_manager)) | 0.01 |
def decode(self, s, _w=WHITESPACE.match):
"""Return the Python representation of ``s`` (a ``str`` or ``unicode``
instance containing a JSON document)
"""
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
end = _w(s, end).end()
if end != len(s):
raise ValueErr... | 0.005277 |
def editlabel(self, project_id, name, new_name=None, color=None):
"""
Updates an existing label with new name or now color.
At least one parameter is required, to update the label.
:param project_id: The ID of a project
:param name: The name of the label
:return: True if... | 0.004115 |
def clear_data(self):
"""
Clear menu data from previous menu generation.
"""
self.__header.title = None
self.__header.subtitle = None
self.__prologue.text = None
self.__epilogue.text = None
self.__items_section.items = None | 0.006969 |
def visit_Import(self, node, frame):
"""Visit regular imports."""
if node.with_context:
self.unoptimize_scope(frame)
self.writeline('l_%s = ' % node.target, node)
if frame.toplevel:
self.write('context.vars[%r] = ' % node.target)
self.write('environment.ge... | 0.00267 |
def message(self):
"""Return RTSP method based on sequence number from session."""
message = self.message_methods[self.session.method]()
_LOGGER.debug(message)
return message | 0.009709 |
def wait_until_running(self, callback=None):
"""Waits until the remote worker is running, then calls the callback.
Usually, this method is passed to a different thread; the callback
is then a function patching results through to the result queue."""
status = self.machine.scheduler.wait_u... | 0.003077 |
def has_previous_assessment_section(self, assessment_section_id):
"""Tests if there is a previous assessment section in the assessment following the given assessment section ``Id``.
arg: assessment_section_id (osid.id.Id): ``Id`` of the
``AssessmentSection``
return: (boolean)... | 0.002976 |
def signable(self, request, authheaders, bodyhash=None):
"""Creates the signable string for a request and returns it.
Keyword arguments:
request -- A request object which can be consumed by this API.
authheaders -- A string-indexable object which contains the headers appropriate for thi... | 0.005806 |
def load_config(filename, filepath=''):
"""
Loads config file
Parameters
----------
filename: str
Filename of config file (incl. file extension
filepath: str
Absolute path to directory of desired config file
"""
FILE = path.join(filepath, filename)
try:
cfg... | 0.004673 |
def join_session(self, sid):
"""Attach to an existing session."""
self._rest.add_header('X-STC-API-Session', sid)
self._sid = sid
try:
status, data = self._rest.get_request('objects', 'system1',
['version', 'name'])
ex... | 0.003663 |
def normalize(self, mode="max", value=1):
"""
Normalize the spectrum with respect to the sum of intensity
Args:
mode (str): Normalization mode. Supported modes are "max" (set the
max y value to value, e.g., in XRD patterns), "sum" (set the
sum of y to... | 0.002774 |
def takes_only_self(self):
"""
Return an argument list node that takes only ``self``.
"""
return ast.arguments(
args=[ast.arg(arg="self")],
defaults=[],
kw_defaults=[],
kwonlyargs=[],
) | 0.007273 |
def apply_update(self, doc, update_spec):
"""Apply an update operation to a document."""
# Helper to cast a key for a list or dict, or raise ValueError
def _convert_or_raise(container, key):
if isinstance(container, dict):
return key
elif isinstance(conta... | 0.000492 |
def TR(self,**kwargs): #pragma: no cover
"""
NAME:
TR
PURPOSE:
Calculate the radial period for a power-law rotation curve
INPUT:
scipy.integrate.quadrature keywords
OUTPUT:
T_R(R,vT,vT)*vc/ro + estimate of the error
HISTORY:
... | 0.02099 |
def _rollback(self):
"""Restore the index in its previous state
This uses values that were indexed/deindexed since the last call
to `_reset_cache`.
This is used when an error is encountered while updating a value,
to return to the previous state
"""
# to avoid u... | 0.003145 |
def infer_transportation_mode(self, clf, min_time):
"""In-place transportation mode inferring of segments
Returns:
This track
"""
for segment in self.segments:
segment.infer_transportation_mode(clf, min_time)
return self | 0.007018 |
def to_binary(self):
"""Produce a framed/packed SBP message.
"""
c = containerize(exclude_fields(self))
self.payload = MsgEphemerisGPSDepF._parser.build(c)
return self.pack() | 0.005128 |
def replace_volume_attachment_status(self, name, body, **kwargs): # noqa: E501
"""replace_volume_attachment_status # noqa: E501
replace status of the specified VolumeAttachment # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request,... | 0.001376 |
def get(self, repository, snapshot, params=None):
"""
Retrieve information about a snapshot.
`<http://www.elastic.co/guide/en/elasticsearch/reference/current/modules-snapshots.html>`_
:arg repository: A repository name
:arg snapshot: A comma-separated list of snapshot names
... | 0.004897 |
async def _run_loop(self, executor):
"""Main loop."""
loop = asyncio.get_event_loop()
# Get first heap in each stream (should be empty).
self._log.info("Waiting for %d streams to start...", self._num_streams)
for stream in self._streams:
await stream.get(loop=loop)
... | 0.001139 |
def get_completerlib():
"""Implementations for various useful completers.
These are all loaded by default by IPython.
"""
#-----------------------------------------------------------------------------
# Copyright (C) 2010-2011 The IPython Development Team.
#
# Distributed under the terms ... | 0.006175 |
def request_patch(self, *args, **kwargs):
"""Maintains the existing api for Session.request.
Used by all of the higher level methods, e.g. Session.get.
The background_callback param allows you to do some processing on the
response in the background, e.g. call resp.json() so that json parsing
happens... | 0.001309 |
def _set_publication_info_field(self, field_name, value):
"""Put a value in the publication info of the reference."""
self._ensure_reference_field('publication_info', {})
self.obj['reference']['publication_info'][field_name] = value | 0.007813 |
def execute(self, triple_map, output, **kwargs):
"""Method iterates through triple map's predicate object maps
and processes query.
Args:
triple_map(SimpleNamespace): Triple Map
"""
sparql = PREFIX + triple_map.logicalSource.query.format(
**kwargs)
... | 0.000995 |
def get_schematron(sct_path):
"""Return an lxml ``isoschematron.Schematron()`` instance using the
schematron file at ``sct_path``.
"""
sct_path = _get_file_path(sct_path)
parser = etree.XMLParser(remove_blank_text=True)
sct_doc = etree.parse(sct_path, parser=parser)
return isoschematron.Sche... | 0.002825 |
def extract_node(code, module_name=""):
"""Parses some Python code as a module and extracts a designated AST node.
Statements:
To extract one or more statement nodes, append #@ to the end of the line
Examples:
>>> def x():
>>> def y():
>>> return 1 #@
The return st... | 0.000778 |
def log_parameters(self):
"""
Logs information about model parameters.
"""
arg_params, aux_params = self.module.get_params()
total_parameters = 0
fixed_parameters = 0
learned_parameters = 0
info = [] # type: List[str]
for name, array in sorted(arg... | 0.004023 |
def all_to_annot(self, annot, names=['TPd', 'TPs', 'FP', 'FN']):
"""Convenience function to write all events to XML by category, showing
overlapping TP detection and TP standard."""
self.to_annot(annot, 'tp_det', names[0])
self.to_annot(annot, 'tp_std', names[1])
self.to_annot(an... | 0.005195 |
def create_badge(self, update=False):
"""
Saves the badge in the database (or updates it if ``update`` is ``True``).
Returns a tuple: ``badge`` (the badge object) and ``created`` (``True``, if
badge has been created).
"""
badge, created = self.badge, False
if badg... | 0.003745 |
def image2surface(img):
"""
Convert a PIL image into a Cairo surface
"""
if not CAIRO_AVAILABLE:
raise Exception("Cairo not available(). image2surface() cannot work.")
# TODO(Jflesch): Python 3 problem
# cairo.ImageSurface.create_for_data() raises NotImplementedYet ...
# img.putalp... | 0.001256 |
def get_mpl_colormap(self, **kwargs):
"""
A color map that can be used in matplotlib plots. Requires matplotlib
to be importable. Keyword arguments are passed to
`matplotlib.colors.LinearSegmentedColormap.from_list`.
"""
if not HAVE_MPL: # pragma: no cover
... | 0.003802 |
def analysis_list(self):
"""
Fetch a list of all analyses.
"""
response = self._post(self.apiurl + '/v2/analysis/list', data={'apikey': self.apikey})
return self._raise_or_extract(response) | 0.013043 |
def after_init_apps(sender):
"""
Check redis version
"""
from uliweb import settings
from uliweb.utils.common import log
check = settings.get_var('REDIS/check_version')
if check:
client = get_redis()
try:
info = client.info()
except Exception as e:
... | 0.003937 |
def setColor( self, color ):
"""
Sets the color value for this button to the given color.
:param color | <QColor>
"""
self._color = color
palette = self.palette()
palette.setColor(palette.Button, color)
self.setPalette(palette)
... | 0.022388 |
def _sparse_or_dense_matmul_onehot(sparse_or_dense_matrix, col_index):
"""Returns a (dense) column of a Tensor or SparseTensor.
Args:
sparse_or_dense_matrix: matrix-shaped, `float` `Tensor` or `SparseTensor`.
col_index: scalar, `int` `Tensor` representing the index of the desired
column.
Returns:
... | 0.002586 |
def fieldset(title, items, options=None):
"""A field set with a title and sub items"""
result = {
'title': title,
'type': 'fieldset',
'items': items
}
if options is not None:
result.update(options)
return result | 0.003788 |
def p_if_elseif(p):
""" statement : if_then_part NEWLINE program_co elseiflist
| if_then_part NEWLINE elseiflist
"""
cond_ = p[1]
stats_ = p[3] if len(p) == 5 else make_nop()
eliflist = p[4] if len(p) == 5 else p[3]
p[0] = make_sentence('IF', cond_, stats_, eliflist, lineno=p.l... | 0.00304 |
def is_python(text, filename='<string>'):
"Is this string a valid Python script?"
try:
compile(text, filename, 'exec')
except (SyntaxError, TypeError):
return False
else:
return True | 0.004505 |
def get_instance(self, payload):
"""
Build an instance of TaskQueueRealTimeStatisticsInstance
:param dict payload: Payload response from the API
:returns: twilio.rest.taskrouter.v1.workspace.task_queue.task_queue_real_time_statistics.TaskQueueRealTimeStatisticsInstance
:rtype: ... | 0.005917 |
def get_skeleton(self):
"""
Return an empty copy of the source model, i.e. without sources,
but with the proper attributes for each SourceGroup contained within.
"""
src_groups = []
for grp in self.src_groups:
sg = copy.copy(grp)
sg.sources = []
... | 0.003937 |
def _set(self, value):
"""Updates all descendants to a specified value."""
if self.__is_parent_node():
for child in self.__sub_counters.itervalues():
child._set(value)
else:
self.__counter = value | 0.013158 |
def copy(self):
"""Create a copy of a BinaryQuadraticModel.
Returns:
:class:`.BinaryQuadraticModel`
Examples:
>>> bqm = dimod.BinaryQuadraticModel({1: 1, 2: 2}, {(1, 2): 0.5}, 0.5, dimod.SPIN)
>>> bqm2 = bqm.copy()
"""
# new objects are co... | 0.008403 |
def args_str(self):
"""
Return an args string for the repr.
"""
matched = [str(m) for m in self._used_matchers]
unmatched = [str(m) for m in self._unused_matchers]
return 'matched=[{}], unmatched=[{}]'.format(
', '.join(matched), ', '.join(unmatched)) | 0.006431 |
def _parse_template(self, element):
"""
Parse the response template
:param element: The XML Element object
:type element: etree._Element
"""
# If the response element has no tags, just store the raw text as the only response
if not len(element):
self.... | 0.00531 |
def create_body(arch:Callable, pretrained:bool=True, cut:Optional[Union[int, Callable]]=None):
"Cut off the body of a typically pretrained `model` at `cut` (int) or cut the model as specified by `cut(model)` (function)."
model = arch(pretrained)
cut = ifnone(cut, cnn_config(arch)['cut'])
if cut is None:... | 0.028274 |
def initFormatA(self):
""" Initialize A read :class:`~ekmmeters.SerialBlock`."""
self.m_blk_a["reserved_1"] = [1, FieldType.Hex, ScaleType.No, "", 0, False, False]
self.m_blk_a[Field.Model] = [2, FieldType.Hex, ScaleType.No, "", 0, False, True]
self.m_blk_a[Field.Firmware] = [1, FieldTyp... | 0.01032 |
def update_os_image_from_image_reference(self, image_name, os_image):
'''
Updates metadata elements from a given OS image reference.
image_name:
The name of the image to update.
os_image:
An instance of OSImage class.
os_image.label: Optional. Specifies a... | 0.001926 |
def decimal_time(year, month, day, hour, minute, second):
"""
Returns the full time as a decimal value
:param year:
Year of events (integer numpy.ndarray)
:param month:
Month of events (integer numpy.ndarray)
:param day:
Days of event (integer numpy.ndarray)
:param hour:... | 0.000476 |
def certify_bool(value, required=True):
"""
Certifier for boolean values.
:param value:
The value to be certified.
:param bool required:
Whether the value can be `None`. Defaults to True.
:raises CertifierTypeError:
The type is invalid
"""
if certify_required(
... | 0.001558 |
def read_headers(self, bucket_name, record_key, record_version='', version_check=False):
'''
a method for retrieving the headers of a record from s3
:param bucket_name: string with name of bucket
:param record_key: string with key value of record
:param record_version: [opt... | 0.005422 |
def linearBlend(img1, img2, overlap, backgroundColor=None):
'''
Stitch 2 images vertically together.
Smooth the overlap area of both images with a linear fade from img1 to img2
@param img1: numpy.2dArray
@param img2: numpy.2dArray of the same shape[1,2] as img1
@param overlap: number of ... | 0.001011 |
def change_parent_of_project(self, ID, NewParrentID):
"""Change parent of project."""
# http://teampasswordmanager.com/docs/api-projects/#change_parent
log.info('Change parrent for project %s to %s' % (ID, NewParrentID))
data = {'parent_id': NewParrentID}
self.put('projects/%s/ch... | 0.005731 |
def parse_query(query, delim='/'):
"""
Parse a boto query
"""
key = ''
prefix = ''
postfix = ''
parsed = urlparse(query)
query = parsed.path.lstrip(delim)
bucket = parsed.netloc
if not parsed.scheme.lower() in ('', "gs", "s3", "s3n"):
... | 0.004107 |
def get_next_entity_to_export(self):
"""
Examines the archive_observationExport and archive_metadataExport tables, and builds
either a :class:`meteorpi_db.ObservationExportTask` or a :class:`meteorpi_db.MetadataExportTask` as appropriate.
These task objects can be used to retrieve the un... | 0.005351 |
def _refresh_state(self):
""" Get the state of a job. If the job is complete this does nothing;
otherwise it gets a refreshed copy of the job resource.
"""
# TODO(gram): should we put a choke on refreshes? E.g. if the last call was less than
# a second ago should we return the cached value?
... | 0.011659 |
def is_domain_class_collection_attribute(ent, attr_name):
"""
Checks if the given attribute name is a aggregate attribute of the given
registered resource.
"""
attr = get_domain_class_attribute(ent, attr_name)
return attr.kind == RESOURCE_ATTRIBUTE_KINDS.COLLECTION | 0.00346 |
def unexpo(intpart, fraction, expo):
"""Remove the exponent by changing intpart and fraction."""
if expo > 0: # Move the point left
f = len(fraction)
intpart, fraction = intpart + fraction[:expo], fraction[expo:]
if expo > f:
intpart = intpart + '0'*(expo-f)
elif expo < 0... | 0.005576 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.