text stringlengths 78 104k | score float64 0 0.18 |
|---|---|
def report_role(self, role):
"""
Return the fields gathered.
"""
self.yaml_files = []
fields = {
"state": "skipped",
"total_files": self.gather_files(),
"total_lines": self.gather_lines(),
"total_facts": self.gather_facts(),
... | 0.00303 |
def min(self):
"""
Returns the minimum value of the domain.
:rtype: `float` or `np.inf`
"""
return int(self._min) if not np.isinf(self._min) else self._min | 0.010204 |
def execute_update(args):
"""Execute the update based on command line args and returns a dictionary
with 'execution result, ''response code', 'response info' and
'process friendly message'.
"""
provider_class = getattr(dnsupdater,
dnsupdater.AVAILABLE_PLUGINS.get(args.p... | 0.000261 |
def copy(self):
"""
Safely get a copy of the current mesh.
Copied objects will have emptied caches to avoid memory
issues and so may be slow on initial operations until
caches are regenerated.
Current object will *not* have its cache cleared.
Returns
--... | 0.00211 |
def extract_wininst_cfg(dist_filename):
"""Extract configuration data from a bdist_wininst .exe
Returns a ConfigParser.RawConfigParser, or None
"""
f = open(dist_filename,'rb')
try:
endrec = zipfile._EndRecData(f)
if endrec is None:
return None
prepended = (endr... | 0.00507 |
def forum_topic_get_by_tag_for_user(self, tag=None, author=None):
"""Get all forum topics with a specific tag"""
if not tag:
return None
if author:
r = self._request('ebuio/forum/search/bytag/' + tag + '?u=' + author)
else:
r = self._request('ebuio/f... | 0.005871 |
def validate_metadata_sign(xml, cert=None, fingerprint=None, fingerprintalg='sha1', validatecert=False, debug=False):
"""
Validates a signature of a EntityDescriptor.
:param xml: The element we should validate
:type: string | Document
:param cert: The public cert
:type:... | 0.005462 |
def initialize(self):
""" A reimplemented initializer.
This method will add the include objects to the parent of the
include and ensure that they are initialized.
"""
super(Block, self).initialize()
block = self.block
if block: #: This block is setting the con... | 0.005019 |
def _get_http(url, temp_file_name, initial_size, file_size, verbose_bool,
progressbar, ncols=80):
"""Safely (resume a) download to a file from http(s)."""
# Actually do the reading
req = urllib.request.Request(url)
if initial_size > 0:
req.headers['Range'] = 'bytes=%s-' % (initial_... | 0.000988 |
def loader_cls(self):
"""Loader class used in `JsonRef.replace_refs`."""
cls = self.app.config['JSONSCHEMAS_LOADER_CLS']
if isinstance(cls, six.string_types):
return import_string(cls)
return cls | 0.008368 |
def f_get_explored_parameters(self, fast_access=False, copy=True):
""" Returns a dictionary containing the full parameter names as keys and the parameters
or the parameter data items as values.
IMPORTANT: This dictionary always contains all explored parameters as keys.
Even when they... | 0.007306 |
def end_parallel(self):
"""
Ends a parallel region by merging the channels into a single stream.
Returns:
Stream: Stream for which subsequent transformations are no longer parallelized.
.. seealso:: :py:meth:`set_parallel`, :py:meth:`parallel`
"""
outport = ... | 0.003413 |
def resize(self, dims):
"""Resize our drawing area to encompass a space defined by the
given dimensions.
"""
width, height = dims[:2]
self.gl_resize(width, height) | 0.009852 |
def open_any(cls, file):
"""Open an image file. If the image is not PNG format, it would convert
the image into PNG with Pillow module. If the module is not
installed, :class:`ImportError` would be raised.
:arg file: Input file.
:type file: path-like or file-like
:rtype: :class:`PNG`
"""
with open_fi... | 0.039832 |
def enqueue_jobs(self):
"""
Move scheduled jobs into queues.
"""
self.log.debug('Checking for scheduled jobs')
jobs = self.get_jobs_to_queue()
for job in jobs:
self.enqueue_job(job)
# Refresh scheduler key's expiry
self.connection.expire(self... | 0.005249 |
def action(self):
"""
This class overrides this method
"""
commandline = "{0} {1}".format(self.command, " ".join(self.arguments))
try:
completed_process = subprocess.run(commandline, shell=True)
self.exit_status = completed_process.returncode
excep... | 0.00489 |
def simulation_manager(self, thing=None, **kwargs):
"""
Constructs a new simulation manager.
:param thing: Optional - What to put in the new SimulationManager's active stash (either a SimState or a list of SimStates).
:param kwargs: Any additional keyword arguments wi... | 0.008169 |
def _if_to_py_ast(ctx: GeneratorContext, node: If) -> GeneratedPyAST:
"""Generate an intermediate if statement which assigns to a temporary
variable, which is returned as the expression value at the end of
evaluation.
Every expression in Basilisp is true if it is not the literal values nil
or false... | 0.002043 |
def Glyph(actor, glyphObj, orientationArray="",
scaleByVectorSize=False, c=None, alpha=1):
"""
At each vertex of a mesh, another mesh - a `'glyph'` - is shown with
various orientation options and coloring.
Color can be specfied as a colormap which maps the size of the orientation
vec... | 0.004177 |
def symbol_to_id(self, symbol):
"""Returns the list of Entrez IDs for a given Geneways symbol
(there may be more than one)"""
if symbol not in self.symbols_to_ids:
m = 'Could not look up Entrez ID for Geneways symbol ' + symbol
raise Exception(m)
return self.symb... | 0.005917 |
def element_at(index):
"""Create a transducer which obtains the item at the specified index."""
if index < 0:
raise IndexError("element_at used with illegal index {}".format(index))
def element_at_transducer(reducer):
return ElementAt(reducer, index)
return element_at_transducer | 0.003185 |
def eval_in_new(cls, expr, *args, **kwargs):
""":meth:`eval` an expression in a new, temporary :class:`Context`.
This should be safe to use directly on user input.
Args:
expr (LispVal): The expression to evaluate.
*args: Args for the :class:`Context` constructor.
... | 0.004107 |
def wantMethod(self, method):
"""Accept the method if its attributes match.
"""
try:
cls = method.im_class
except AttributeError:
return False
return self.validateAttrib(method, cls) | 0.00813 |
def sync_perm_for_dag(self, dag_id, access_control=None):
"""
Sync permissions for given dag id. The dag id surely exists in our dag bag
as only / refresh button or cli.sync_perm will call this function
:param dag_id: the ID of the DAG whose permissions should be updated
:type d... | 0.003452 |
def _generateOverlapping(filename="overlap.csv", numSequences=2, elementsPerSeq=3,
numRepeats=10, hub=[0,1], hubOffset=1, resets=False):
""" Generate a temporal dataset containing sequences that overlap one or more
elements with other sequences.
Parameters:
--------------------------... | 0.023245 |
def decorate(text, style):
""" Console decoration style definitions
:param text: the text string to decorate
:type text: str
:param style: the style used to decorate the string
:type style: str
:return: a decorated string
:rtype: str
"""
return {
's... | 0.005291 |
def index_data(self, data, index_name, doc_type):
"""Index data in Stub Indexer."""
print 'ELS Stub Indexer getting called...'
print '%s %s %s %s' % (self, data, index_name, doc_type) | 0.009615 |
def get_route53_records(self):
''' Get and store the map of resource records to domain names that
point to them. '''
r53_conn = route53.Route53Connection()
all_zones = r53_conn.get_zones()
route53_zones = [ zone for zone in all_zones if zone.name[:-1]
... | 0.004635 |
def setTxPower(self, tx_power):
"""Set the transmission power for one or more antennas.
@param tx_power: index into self.tx_power_table
"""
tx_pow_validated = self.get_tx_power(tx_power)
logger.debug('tx_pow_validated: %s', tx_pow_validated)
needs_update = False
... | 0.002232 |
def _determine_supported_alleles(command, supported_allele_flag):
"""
Try asking the commandline predictor (e.g. netMHCpan)
which alleles it supports.
"""
try:
# convert to str since Python3 returns a `bytes` object
supported_alleles_output = check_output(... | 0.003632 |
def add_element(self, element):
"""
Element can be href or type :py:class:`smc.base.model.Element`
::
>>> from smc.elements.other import Category
>>> category = Category('foo')
>>> category.add_element(Host('kali'))
:param str,Element element: elemen... | 0.00311 |
def freeze_of_gait(self, x):
"""
This method assess freeze of gait following :cite:`g-BachlinPRMHGT10`.
:param x: The time series to assess freeze of gait on. This could be x, y, z or mag_sum_acc.
:type x: pandas.Series
:return freeze_time: What times do freeze ... | 0.008322 |
def as_download(self, data, block_num=-1):
"""
Downloads a DB data into the AG asynchronously.
A whole block (including header and footer) must be available into the
user buffer.
:param block_num: New Block number (or -1)
:param data: the user buffer
"""
... | 0.003656 |
def flatten(iterable, check=is_iterable):
"""Produces a recursively flattened version of ``iterable``
``check``
Recurses only if check(value) is true.
"""
for value in iterable:
if check(value):
for flat in flatten(value, check):
yield flat
else:
... | 0.00295 |
def update_resource_value(self, device_id, _resource_path, resource_value, **kwargs): # noqa: E501
"""Write to a resource or use write-attributes for a resource # noqa: E501
With this API, you can [write a new value to existing resources](/docs/current/connecting/handle-resource-webapp.html) or [use ... | 0.0006 |
def dict2kvlist(o):
'''
Serializes a dict-like object into a generator of the flatten list of
repeating key-value pairs. It is useful when using HMSET method in Redis.
Example:
>>> list(dict2kvlist({'a': 1, 'b': 2}))
['a', 1, 'b', 2]
'''
return chain.from_iterable((k, v) for k, v in o.... | 0.003049 |
def structure_to_abivars(structure, **kwargs):
"""
Receives a structure and returns a dictionary with the ABINIT variables.
"""
if not structure.is_ordered:
raise ValueError("""\
Received disordered structure with partial occupancies that cannot be converted into an Abinit input
Please use Order... | 0.003705 |
def nlmsg_seq(self, value):
"""Sequence setter."""
self.bytearray[self._get_slicers(3)] = bytearray(c_uint32(value or 0)) | 0.014599 |
def make_path(base_uri, path, filename, path_dimensions, split_length):
"""Generate a path as base location for file instance.
:param base_uri: The base URI.
:param path: The relative path.
:param path_dimensions: Number of chunks the path should be split into.
:param split_length: The length of an... | 0.00146 |
def actual_query_range(self):
"""This is the actual query range for the positive strand
:returns: Range of query positive strand covered
:rtype: GenomicRange
"""
a = self.alignment_ranges
#return GenomicRange(a[0][1].chr,a[0][1].start,a[-1][1].end,self.get_strand())
if self.get_strand() ==... | 0.022847 |
def rewrite_record(bdist_dir):
""" Rewrite RECORD file with hashes for all files in `wheel_sdir`
Copied from :method:`wheel.bdist_wheel.bdist_wheel.write_record`
Will also unsign wheel
Parameters
----------
bdist_dir : str
Path of unpacked wheel file
"""
info_dirs = glob.glob(... | 0.000609 |
def derive_key(self,
derivation_method,
derivation_length,
derivation_data=None,
key_material=None,
hash_algorithm=None,
salt=None,
iteration_count=None,
encryption_alg... | 0.001522 |
def _vminFindStart(v,E,Lz,I3V,delta,u0,cosh2u0,sinh2u0,
potu0pi2,pot):
"""
NAME:
_vminFindStart
PURPOSE:
Find adequate start point to solve for vmin
INPUT:
same as JzStaeckelIntegrandSquared
OUTPUT:
rstart
HISTORY:
2012-11-28 - W... | 0.032496 |
def natural_name(self) -> str:
"""Valid python identifier representation of the expession."""
name = self.expression.strip()
for op in operators:
name = name.replace(op, operator_to_identifier[op])
return wt_kit.string2identifier(name) | 0.007168 |
def find_nonzero_constrained_reactions(model):
"""Return list of reactions with non-zero, non-maximal bounds."""
lower_bound, upper_bound = helpers.find_bounds(model)
return [rxn for rxn in model.reactions if
0 > rxn.lower_bound > lower_bound or
0 < rxn.upper_bound < upper_bound] | 0.003165 |
def is_playing_shared_game(self, steamID, appid_playing, format=None):
"""Returns valid lender SteamID if game currently played is borrowed.
steamID: The users ID
appid_playing: The game player is currently playing
format: Return format. None defaults to json. (json, xml, vdf)
... | 0.007452 |
def dump(exif_dict_original):
"""
py:function:: piexif.load(data)
Return exif as bytes.
:param dict exif: Exif data({"0th":dict, "Exif":dict, "GPS":dict, "Interop":dict, "1st":dict, "thumbnail":bytes})
:return: Exif
:rtype: bytes
"""
exif_dict = copy.deepcopy(exif_dict_original)
he... | 0.000731 |
def lower_backtrack_blocks(match_query, location_types):
"""Lower Backtrack blocks into (QueryRoot, MarkLocation) pairs of blocks."""
# The lowering works as follows:
# 1. Upon seeing a Backtrack block, end the current traversal (if non-empty).
# 2. Start new traversal from the type and location to ... | 0.005663 |
def file_exists(db, user_id, path):
"""
Check if a file exists.
"""
try:
get_file(
db,
user_id,
path,
include_content=False,
decrypt_func=unused_decrypt_func,
)
return True
except NoSuchFile:
return False | 0.003165 |
def _fetch_type_main(cls, cls_in, match):
"""
:type cls_in: type
:type match: _sre.SRE_Match
:rtype: type
"""
return cls._str_to_type(
cls_in,
match.group(cls._SUBMATCH_INDEX_TYPE_MAIN)
) | 0.007435 |
def Lr(self,value):
""" set row rotation """
assert value.shape==(self.N, self.N), 'dimension mismatch'
self._Lr = value
self.clear_cache() | 0.023392 |
def get_img_name(self, band, resolution=None):
"""
:param band: band name
:type band: str
:param resolution: Specifies the resolution in case of Sentinel-2 L2A products
:type resolution: str or None
:return: name of band image file
:rtype: str
"""
... | 0.006849 |
def create_blueprint(self, appbuilder, endpoint=None, static_folder=None):
"""
Create Flask blueprint. You will generally not use it
:param appbuilder:
the AppBuilder object
:param endpoint:
endpoint override for this blueprint,
w... | 0.001334 |
def get_mfa(self):
"""Return the currently-valid MFA token for this application."""
token = str(self.totp.now())
# PyOTP doesn't pre-pad tokens shorter than 6 characters
# ROTP does, so we have to.
while len(token) < 6:
token = '0{}'.format(token)
return token | 0.00625 |
def moment_magnitude_scalar(moment):
'''
Uses Hanks & Kanamori formula for calculating moment magnitude from
a scalar moment (Nm)
'''
if isinstance(moment, np.ndarray):
return (2. / 3.) * (np.log10(moment) - 9.05)
else:
return (2. / 3.) * (log10(moment) - 9.05) | 0.003322 |
def generate_base(path: str) -> str:
""" Convert path, which can be a URL or a file path into a base URI
:param path: file location or url
:return: file location or url sans actual name
"""
if ':' in path:
parts = urlparse(path)
parts_dict = parts._asdict()
parts_dict['path'... | 0.003854 |
def H11(self):
"Difference entropy."
return -(self.p_xminusy * np.log(self.p_xminusy + self.eps)).sum(1) | 0.016667 |
def update_record_ip(self, ip, domain, name, record_type):
"""Update the IP address(es) for (a) domain(s) specified by type and name.
:param ip: the new IP for the DNS record (ex. '123.1.2.255')
:param domain: the domain where the DNS belongs to (ex. 'example.com')
:param name: the DNS ... | 0.003774 |
def showsyntaxerror(self, filename=None):
"""Display the syntax error that just occurred."""
# Override for avoid using sys.excepthook PY-12600
type, value, tb = sys.exc_info()
sys.last_type = type
sys.last_value = value
sys.last_traceback = tb
if filename and typ... | 0.002255 |
def _fake_openassociatorinstancepaths(self, namespace, **params):
# pylint: disable=invalid-name
"""
Implements WBEM server responder for
:meth:`~pywbem.WBEMConnection.OpenAssociatorInstancePaths`
with data from the instance repository.
"""
self._validate_namespac... | 0.004121 |
def always_iterable(obj, base_type=(str, bytes)):
"""If *obj* is iterable, return an iterator over its items::
>>> obj = (1, 2, 3)
>>> list(always_iterable(obj))
[1, 2, 3]
If *obj* is not iterable, return a one-item iterable containing *obj*::
>>> obj = 1
>>> list(alwa... | 0.000702 |
def from_blob(cls, blob, stage=0):
""":return: Fully equipped BaseIndexEntry at the given stage"""
return cls((blob.mode, blob.binsha, stage << CE_STAGESHIFT, blob.path)) | 0.010753 |
def convert(self, obj):
"""Takes a dict corresponding to the honeybadgerfish JSON blob of the 1.0.* type and
converts it to BY_ID_HONEY_BADGERFISH version. The object is modified in place
and returned.
"""
if self.pristine_if_invalid:
raise NotImplementedError('pristi... | 0.002938 |
def pwa(self, val, wa='WARN'):
""" Print val: WARN in yellow on STDOUT """
self.pstd(self.color.yellow('{}: {}'.format(val, wa))) | 0.013793 |
def rotateCoords(coords, R):
"""
Rotate the list of points using rotation matrix R
:param coords: List of points to be rotated
:param R: Rotation matrix
:return: List of rotated points
"""
newlist = list()
for pp in coords:
rpp = matrixTimesVector(R, pp)
newlist.append(rp... | 0.002933 |
def delete(self, symbol, chunk_range=None, audit=None):
"""
Delete all chunks for a symbol, or optionally, chunks within a range
Parameters
----------
symbol : str
symbol name for the item
chunk_range: range object
a date range to delete
a... | 0.001554 |
def infos(cls, fqdn):
""" Display information about hosted certificates for a fqdn. """
if isinstance(fqdn, (list, tuple)):
ids = []
for fqd_ in fqdn:
ids.extend(cls.infos(fqd_))
return ids
ids = cls.usable_id(fqdn)
if not ids:
... | 0.004415 |
def addSingleTraitTerm(self,K=None,is_noise=False,normalize=True,Ks=None):
"""
add random effects term for single trait models (no trait-trait covariance matrix)
Args:
K: NxN sample covariance matrix
is_noise: bool labeling the noise term (noise term has... | 0.023856 |
def set_logging_formatter(self):
"""
Sets the logging formatter.
"""
for handler in (RuntimeGlobals.logging_console_handler,
RuntimeGlobals.logging_file_handler,
RuntimeGlobals.logging_session_handler):
handler and handler.setF... | 0.007126 |
def format(self, attrs, args=None):
"""Format attributes including {} tags with arguments."""
if args is None:
return attrs
out = {}
for key, val in attrs.items():
mba = {'indexer': 'annual'}
# Add formatting {} around values to be able to replace the... | 0.005894 |
def strip_accents(s, pass_symbols=(u'й', u'Й', u'\n')):
""" Strip accents from a string """
result = []
for char in s:
# Pass these symbols without processing
if char in pass_symbols:
result.append(char)
continue
for c in unicodedata.normalize('NFD', char):
... | 0.002242 |
def max_pool(arr, block_size, cval=0, preserve_dtype=True):
"""
Resize an array using max-pooling.
dtype support::
See :func:`imgaug.imgaug.pool`.
Parameters
----------
arr : (H,W) ndarray or (H,W,C) ndarray
Image-like array to pool. See :func:`imgaug.pool` for details.
b... | 0.003472 |
def Scharr_edge(im, blurRadius=10, imblur=None):
"""Extract the edges using Scharr kernel (Sobel optimized for rotation
invariance)
Parameters:
-----------
im: 2d array
The image
blurRadius: number, default 10
The gaussian blur raduis (The kernel has size 2*blurRadius+1)
imb... | 0.001182 |
def get_gene(self, gene_name=None, gene_symbol=None, gene_id=None, synonym=None, uniprot_id=None,
pharmgkb_id=None, biogrid_id=None, alt_gene_id=None, limit=None, as_df=False):
"""Get genes
:param bool as_df: if set to True result returns as `pandas.DataFrame`
:param alt_gene_i... | 0.007105 |
def SensorsDataGet(self, sensorIds, parameters):
"""
Retrieve sensor data for the specified sensors from CommonSense.
If SensorsDataGet is successful, the result can be obtained by a call to getResponse(), and should be a json string.
@param sensorIds (list) a list of s... | 0.012458 |
def dtype_repr(dtype):
"""Stringify ``dtype`` for ``repr`` with default for int and float."""
dtype = np.dtype(dtype)
if dtype == np.dtype(int):
return "'int'"
elif dtype == np.dtype(float):
return "'float'"
elif dtype == np.dtype(complex):
return "'complex'"
elif dtype.s... | 0.00232 |
def process_udp_frame(self,
id=None,
msg=None):
"""process_udp_frame
Convert a complex nested json dictionary
to a flattened dictionary and capture
all unique keys for table construction
:param id: key for this msg
:pa... | 0.004061 |
def create_parameter_group(self, name, engine='MySQL5.1', description=''):
"""
Create a new dbparameter group for your account.
:type name: string
:param name: The name of the new dbparameter group
:type engine: str
:param engine: Name of database engine.
:type... | 0.005208 |
def diff_in_days(start, end):
"""
calculate difference between given dates in days
:param BaseDateTuple start: state date
:param BaseDateTuple end: end date
:return float: difference between end date and start date in days
"""
diff = from_ymd_to_excel(*end.date)... | 0.005291 |
def codemirror_script(self, inputid):
"""
Build CodeMirror HTML script tag which contains CodeMirror init.
Arguments:
inputid (string): Input id.
Returns:
string: HTML for field CodeMirror instance.
"""
varname = "{}_codemirror".format(inputid)
... | 0.003731 |
def swap_channels(self, channel_swap):
""" Swaps the two channels specified in the tuple.
Parameters
----------
channel_swap : :obj:`tuple` of int
the two channels to swap
Returns
-------
:obj:`ColorImage`
color image with cols swapped
... | 0.002538 |
def get_common_session_key(self, premaster_secret):
"""K = H(S).
Special implementation for Apple TV.
"""
k_1 = self.hash(premaster_secret, b'\x00\x00\x00\x00', as_bytes=True)
k_2 = self.hash(premaster_secret, b'\x00\x00\x00\x01', as_bytes=True)
return k_1 + k_2 | 0.006431 |
def _load(self, scale=1.0):
"""Load the MetImage RSR data for the band requested"""
data = np.genfromtxt(self.requested_band_filename,
unpack=True,
names=['wavenumber',
'response'],
... | 0.002548 |
def are_imaging_dicoms(dicom_input):
"""
This function will check the dicom headers to see which type of series it is
Possibilities are fMRI, DTI, Anatomical (if no clear type is found anatomical is used)
:param dicom_input: directory with dicom files or a list of dicom objects
"""
# if it is ... | 0.004747 |
def prepare_dataset(dataset,
formula_id2index,
feature_list,
is_traindata,
do_normalization=False):
"""Transform each instance of dataset to a (Features, Label) tuple."""
prepared = []
start_time = time.time()
translation = ... | 0.00092 |
def get_commits(self):
'''
Get all commits involving this filename
:returns: List of commits newest to oldest
'''
if not self.is_managed_by_git():
return []
return self.git.get_commits(self.content.source_path, self.follow) | 0.007067 |
def parse_all(self):
"""Parse the __all__ definition in a module."""
assert self.current.value == "__all__"
self.consume(tk.NAME)
if self.current.value != "=":
raise AllError("Could not evaluate contents of __all__. ")
self.consume(tk.OP)
if self.current.value... | 0.002256 |
def _calculate_states(self, solution, t, step, int_step):
"""!
@brief Calculates new states for neurons using differential calculus. Returns new states for neurons.
@param[in] solution (solve_type): Type solver of the differential equation.
@param[in] t (double): Current ti... | 0.019905 |
def lraise(self,message):
"""log an exception, close the log file, then raise the exception
Parameters
----------
message : str
the exception message
Raises
------
exception with message
"""
s = str(datetime.now()) + " ERROR: " + ... | 0.008048 |
def weather(api_key, latitude, longitude, date_time=None):
# type:(str, float, float) -> Weather
"""
This is a shortcut method that can be used to perform a basic weather request with the default settings.
:param str api_key: Darksky.net API key
:param float latitude: The requested latitude. Maybe ... | 0.006349 |
def default(self, vid):
""" Defaults the VLAN configuration
.. code-block:: none
default vlan <vlanid>
Args:
vid (str): The VLAN ID to default
Returns:
True if the operation was successful otherwise False
"""
command = 'default vlan... | 0.005063 |
def from_api_repr(cls, resource, client):
"""Factory: construct a job given its API representation
.. note:
This method assumes that the project found in the resource matches
the client's project.
:type resource: dict
:param resource: dataset job representation ... | 0.002878 |
def _create_new_thread_loop(self):
"""
Create a daemonized thread that will run Tornado IOLoop.
:return: the IOLoop backed by the new thread.
"""
self._thread_loop = ThreadLoop()
if not self._thread_loop.is_ready():
self._thread_loop.start()
return sel... | 0.005831 |
def create_filebase_name(self, group_info, extension='gz', file_name=None):
"""
Return tuple of resolved destination folder name and file name
"""
dirname = self.filebase.formatted_dirname(groups=group_info)
if not file_name:
file_name = self.filebase.prefix_template ... | 0.005391 |
def manipulate(self, stored_instance, component_instance):
"""
Manipulates the component instance
:param stored_instance: The iPOPO component StoredInstance
:param component_instance: The component instance
"""
# Store the stored instance
self._ipopo_instance = s... | 0.001546 |
def get_parameter_vector(self, include_frozen=False):
"""
Get an array of the parameter values in the correct order
Args:
include_frozen (Optional[bool]): Should the frozen parameters be
included in the returned value? (default: ``False``)
"""
if inc... | 0.004651 |
def any2unicode(text, encoding='utf8', errors='strict'):
"""Convert a string (bytestring in `encoding` or unicode), to unicode."""
if isinstance(text, unicode):
return text
return unicode(text, encoding, errors=errors) | 0.004202 |
def make_inaturalist_api_get_call(endpoint: str, params: Dict, **kwargs) -> requests.Response:
"""Make an API call to iNaturalist.
endpoint is a string such as 'observations' !! do not put / in front
method: 'GET', 'HEAD', 'POST', 'PUT', 'PATCH', 'DELETE'
kwargs are passed to requests.request
Retur... | 0.005671 |
def example_protos_from_path(path,
num_examples=10,
start_index=0,
parse_examples=True,
sampling_odds=1,
example_class=tf.train.Example):
"""Returns a number of examples fro... | 0.009624 |
def XOR(a, b, exc=CertifierValueError('Expected at least one certified value')):
"""
Only one arg must not raise a Certifier exception when called overall.
Raise the specified exception on failure.
:params Certifier a:
The first certifiers to call
:params Certifier b:
The second cer... | 0.00313 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.