text stringlengths 78 104k | score float64 0 0.18 |
|---|---|
def _check_dir(self):
"""Makes sure that the working directory for the wrapper modules exists.
"""
from os import path, mkdir
if not path.isdir(self.dirpath):
mkdir(self.dirpath)
#Copy the ftypes.py module shipped with fortpy to the local directory.
ft... | 0.011275 |
def version(self) -> str:
'''Show the version number of Android Debug Bridge.'''
output, _ = self._execute('version')
return output.splitlines()[0].split()[-1] | 0.010929 |
def matching(self, packages):
"""Message for matching packages
"""
print("\nNot found package with the name [ {0}{1}{2} ]. "
"Matching packages:\nNOTE: Not dependenc"
"ies are resolved\n".format(self.meta.color["CYAN"],
"".joi... | 0.005 |
def submit_form_action(self, url):
"""
Submit the form with the given action URL (i.e. the form that submits to
``/post/my/data``).
"""
form = ElementSelector(
world.browser,
str('//form[@action="%s"]' % url),
)
assert form, \
"Cannot find a form with action '{}' on t... | 0.002786 |
def method_name(func):
"""Method wrapper that adds the name of the method being called to its arguments list in Pascal case
"""
@wraps(func)
def _method_name(*args, **kwargs):
name = to_pascal_case(func.__name__)
return func(name=name, *args, **kwargs)
return _method_name | 0.006472 |
def init_hold_with_account(self):
"""ๅธฆaccount_cookie็ๅๅงๅๆไป
Returns:
[type] -- [description]
"""
return self.init_hold.reset_index().assign(
account_cookie=self.account_cookie
).set_index(['code',
'account_cookie']) | 0.006645 |
def getattrdeep(obj, attr, *default):
'Return dotted attr (like "a.b.c") from obj, or default if any of the components are missing.'
attrs = attr.split('.')
if default:
getattr_default = lambda o,a,d=default[0]: getattr(o, a, d)
else:
getattr_default = lambda o,a: getattr(o, a)
for ... | 0.016746 |
def check_target(target_path):
"""
Checks that the target path is not empty
"""
if not path.exists(target_path):
return
with scandir(target_path) as d:
for entry in d:
if not entry.name.startswith('.'):
fail(f'Target directory "{target_path}" is not empt... | 0.003096 |
def wav2complex(filename):
"""
Return a complex signal vector from a wav file that was used to store
the real (I) and imaginary (Q) values of a complex signal ndarray.
The rate is included as means of recalling the original signal sample
rate.
fs,x = wav2complex(filename)
Mark W... | 0.013333 |
def start(url, funs=None, tags=None):
'''
Listen to salt events and forward them to logstash.
url
The Logstash endpoint.
funs: ``None``
A list of functions to be compared against, looking into the ``fun``
field from the event data. This option helps to select the events
... | 0.000582 |
def get_network_usage(access_token, subscription_id, location):
'''List network usage and limits for a location.
Args:
access_token (str): A valid Azure authentication token.
subscription_id (str): Azure subscription id.
location (str): Azure data center location. E.g. westus.
Retu... | 0.001499 |
def __insert_frond_RF(d_w, d_u, dfs_data):
"""Encapsulates the process of inserting a frond uw into the right side frond group."""
# --Add the frond to the right side
dfs_data['RF'].append( (d_w, d_u) )
dfs_data['FG']['r'] += 1
dfs_data['last_inserted_side'] = 'RF' | 0.013986 |
def dlabbs(handle):
"""
Begin a backward segment search in a DLA file.
https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/dlabbs_c.html
:param handle: Handle of open DLA file.
:type handle: int
:return: Descriptor of last segment in DLA file
:rtype: spiceypy.utils.support_typ... | 0.009091 |
def max_n_day_precipitation_amount(pr, window=1, freq='YS'):
r"""Highest precipitation amount cumulated over a n-day moving window.
Calculate the n-day rolling sum of the original daily total precipitation series
and determine the maximum value over each period.
Parameters
----------
da : xarr... | 0.003208 |
def etree_to_text(tree,
guess_punct_space=True,
guess_layout=True,
newline_tags=NEWLINE_TAGS,
double_newline_tags=DOUBLE_NEWLINE_TAGS):
"""
Convert a html tree to text. Tree should be cleaned with
``html_text.html_text.cleaner.clean_htm... | 0.000395 |
def get_dirs_for_path(*paths):
"""
Returns list of directories, including intermediate.
"""
for path in paths:
head = path
while head:
head, tail = os.path.split(head)
if head:
yield head
else:
# We don't need to yield e... | 0.002849 |
def _parse_datetime_str(self, dtime_str):
"""
Given a standard datetime string (as seen throughout the Petfinder API),
spit out the corresponding UTC datetime instance.
:param str dtime_str: The datetime string to parse.
:rtype: datetime.datetime
:returns: The parsed dat... | 0.006342 |
def release_scheme(self, value):
"""Validate the release scheme."""
if value not in KNOWN_RELEASE_SCHEMES:
msg = "Release scheme %r is not supported! (valid options are %s)"
raise ValueError(msg % (value, concatenate(map(repr, KNOWN_RELEASE_SCHEMES))))
set_property(self, ... | 0.008721 |
def save_controls(self, parameterstep=None, simulationstep=None,
auxfiler=None):
"""Call method |Elements.save_controls| of the |Elements| object
currently handled by the |HydPy| object.
We use the `LahnH` example project to demonstrate how to write
a complete set ... | 0.000434 |
def inject_closure_values(func, **kwargs):
"""
Returns a new function identical to the previous one except that it acts as
though global variables named in `kwargs` have been closed over with the
values specified in the `kwargs` dictionary.
Works on properties, class/static methods and functions.
... | 0.004069 |
def priority(self):
""" Get priority for this Schema.
Used to sort mapping keys
:rtype: int
"""
# Markers have priority set on the class
if self.compiled_type == const.COMPILED_TYPE.MARKER:
return self.compiled.priority
# Other types have static pri... | 0.005115 |
def flairlist(self, limit=1000, after=None, before=None):
"""GETs flairlist for this subreddit. Calls :meth:`narwal.Reddit.flairlist`.
:param limit: max number of items to return
:param after: full id of user to return entries after
:param before: full id of user to return entr... | 0.011312 |
def get_tags_by_fact_id(self, fact_id):
""" Obtains the tags associated by a fact_id.
This function returns a list of the tags name associated
to a fact, such as ['foo', 'bar', 'eggs'].
If the fact has no tags, it will return a empty list.
If there are no fact with id == fact_id... | 0.004854 |
def delete_instance_if_removed(self, port):
"""Enqueue instance delete if it's no longer in the db"""
instance_type = self.get_instance_type(port)
if not instance_type:
return
if not db_lib.instance_provisioned(port['device_id']):
i_res = MechResource(port['device... | 0.004608 |
def dKd_dVar(self, X, X2=None):
"""
Derivative of Kernel function wrt variance applied on inputs X and X2.
In the stationary case there is an inner function depending on the
distances from X to X2, called r.
dKd_dVar(X, X2) = dKdVar_of_r((X-X2)**2)
"""
r = self._scaled_dist(X, X2)
return self.dKdVar_of... | 0.030769 |
def adjacency_projections(mesh):
"""
Test if a mesh is convex by projecting the vertices of
a triangle onto the normal of its adjacent face.
Parameters
----------
mesh : Trimesh
Input geometry
Returns
----------
projection : (len(mesh.face_adjacency),) float
Distance of... | 0.001145 |
def read(varin, fname='MS2_L10.mat.txt'):
'''Read in dataset for variable var
:param varin: Variable for which to read in data.
'''
# # fname = 'MS09_L10.mat.txt'
# # fname = 'MS09_L05.mat.txt' # has PAR
# fname = 'MS2_L10.mat.txt' # empty PAR
d = np.loadtxt(fname, comments='*')
if ... | 0.00337 |
def discover_indexes(self):
"""Save list of index builders into ``_index_builders``."""
self.indexes = []
for app_config in apps.get_app_configs():
indexes_path = '{}.elastic_indexes'.format(app_config.name)
try:
indexes_module = import_module(indexes_pat... | 0.004018 |
def write_rst(self,
prefix: str = "",
suffix: str = "",
heading_underline_char: str = "=",
method: AutodocMethod = None,
overwrite: bool = False,
mock: bool = False) -> None:
"""
Writes the RST fi... | 0.007692 |
def parse_prices_from_file_stream(self, file_stream) -> List[PriceModel]:
"""
Reads a file stream (i.e. from web form) containing a csv prices
into a list of Price models.
"""
content = file_stream.read().decode("utf-8")
file_stream.close()
if not content:
... | 0.004556 |
def rounded(self, image, geometry, options):
"""
Wrapper for ``_rounded``
"""
r = options['rounded']
if not r:
return image
return self._rounded(image, int(r)) | 0.009132 |
def is_inbound_presence_filter(cb):
"""
Return true if `cb` has been decorated with
:func:`inbound_presence_filter`.
"""
try:
handlers = get_magic_attr(cb)
except AttributeError:
return False
hs = HandlerSpec(
(_apply_inbound_presence_filter, ())
)
return h... | 0.003003 |
def get(self, path, auth=None, **kwargs):
"""
Manually make a GET request.
:param str path: relative url of the request (e.g. `/users/username`)
:param auth.Authentication auth: authentication object
:param kwargs dict: Extra arguments for the request, as supported by the
... | 0.008039 |
def delete(sql, *args, **kwargs):
"""Deletes and commits with an insert sql statement"""
assert "delete" in sql.lower(), 'This function requires a delete statement, provided: {}'.format(sql)
CoyoteDb.execute_and_commit(sql, *args, **kwargs) | 0.011364 |
def not_left(self, num):
"""
NOT REQUIRED, EXISTS AS OPPOSITE OF not_right()
"""
if num == None:
return FlatList([_get_list(self)[-1]])
if num <= 0:
return self
return FlatList(_get_list(self)[num::]) | 0.010989 |
def bar(self, counts, phenotype_to_color=None, ax=None, percentages=True):
"""Draw barplots grouped by modality of modality percentage per group
Parameters
----------
Returns
-------
Raises
------
"""
if percentages:
counts = 100 ... | 0.001479 |
def parse_inventory(inventory_output=None):
"""Parse the inventory text and return udi dict."""
udi = {
"name": "",
"description": "",
"pid": "",
"vid": "",
"sn": ""
}
if inventory_output is None:
return udi
# find the record with chassis text in name... | 0.003904 |
def within(self, lat, lon, radius):
'''Convenience method to apply a $loc/$within/$center filter. Radius is in meters.'''
return self.filter(filter_helpers.within_(lat, lon, radius)) | 0.026882 |
def create(self, request):
"""
Change password for logged in django staff user
"""
# TODO: Decorate api with sensitive post parameters as Django admin do?
password_form = PasswordChangeForm(request.user, data=request.data)
if not password_form.is_valid():
ra... | 0.00381 |
def fromrdd(rdd, nrecords=None, shape=None, index=None, labels=None, dtype=None, ordered=False):
"""
Load series data from a Spark RDD.
Assumes keys are tuples with increasing and unique indices,
and values are 1d ndarrays. Will try to infer properties
that are not explicitly provided.
Paramet... | 0.001652 |
def header_encode(self, string):
"""Header-encode a string by converting it first to bytes.
The type of encoding (base64 or quoted-printable) will be based on
this charset's `header_encoding`.
:param string: A unicode string for the header. It must be possible
to encode th... | 0.002448 |
def _get_footer_size(file_obj):
"""Read the footer size in bytes, which is serialized as little endian."""
file_obj.seek(-8, 2)
tup = struct.unpack(b"<i", file_obj.read(4))
return tup[0] | 0.00495 |
def _new_session(self):
"""Helper for concrete methods creating session instances.
:rtype: :class:`~google.cloud.spanner_v1.session.Session`
:returns: new session instance.
"""
if self.labels:
return self._database.session(labels=self.labels)
return self._dat... | 0.00597 |
def pfadd(self, key, value, *values):
"""Adds the specified elements to the specified HyperLogLog."""
return self.execute(b'PFADD', key, value, *values) | 0.011905 |
def get_events(self, service_location_id, appliance_id, start, end,
max_number=None):
"""
Request events for a given appliance
Parameters
----------
service_location_id : int
appliance_id : int
start : int | dt.datetime | pd.Timestamp
e... | 0.002372 |
def edit(self, obj_id, parameters, create_if_not_exists=False):
"""
Edit an item with option to create if it doesn't exist
:param obj_id: int
:param create_if_not_exists: bool
:param parameters: dict
:return: dict|str
"""
if create_if_not_exists:
... | 0.002525 |
def create_frvect(timeseries):
"""Create a `~frameCPP.FrVect` from a `TimeSeries`
This method is primarily designed to make writing data to GWF files a
bit easier.
Parameters
----------
timeseries : `TimeSeries`
the input `TimeSeries`
Returns
-------
frvect : `~frameCPP.Fr... | 0.001188 |
def download_url_single(inputs, outdir, outfile=None):
"""
Downloads a http(s) url to a local file
:param str inputs: the absolute url
:param str outdir: Required. the local directory to put the downloadedfiles.
:param str outfile: // Optional. If this is given, the downloaded url will be renated to outfile;... | 0.011811 |
def in_unit_of(self, unit, as_quantity=False):
"""
Return the current value transformed to the new units
:param unit: either an astropy.Unit instance, or a string which can be converted to an astropy.Unit
instance, like "1 / (erg cm**2 s)"
:param as_quantity: if True, the me... | 0.006812 |
def _normalize_article_dir_with_dtd(self, path):
"""
main.xml from Elsevier assume the existence of a local DTD.
This procedure install the DTDs next to the main.xml file
and normalize it using xmllint in order to resolve all namespaces
and references.
"""
if exis... | 0.004332 |
def check_frame_id(frame_id):
"""Check that the provided frame id is valid in Rapids language."""
if frame_id is None:
return
if frame_id.strip() == "":
raise H2OValueError("Frame id cannot be an empty string: %r" % frame_id)
for i, ch in enumerate(frame_id):
# '$' character has ... | 0.008596 |
def validate(token):
"""Validate token and return auth context."""
token_url = TOKEN_URL_FMT.format(token=token)
headers = {
'x-auth-token': token,
'accept': 'application/json',
}
resp = requests.get(token_url, headers=headers)
if not resp.status_code == 200:
raise HTTPE... | 0.002786 |
def _deadline_until(cls, closure, action_msg, timeout=FAIL_WAIT_SEC,
wait_interval=WAIT_INTERVAL_SEC, info_interval=INFO_INTERVAL_SEC):
"""Execute a function/closure repeatedly until a True condition or timeout is met.
:param func closure: the function/closure to execute (should not block... | 0.01057 |
def is_collection(obj):
"""Tests if an object is a collection."""
col = getattr(obj, '__getitem__', False)
val = False if (not col) else True
if isinstance(obj, basestring):
val = False
return val | 0.004405 |
def is_archive(self):
'''
Determines if the attachment is an archive.
'''
try:
if zipfile.is_zipfile(self.attachment.path) or tarfile.is_tarfile(self.attachment.path):
return True
except Exception:
pass
return False | 0.009772 |
def parseFASTAFilteringCommandLineOptions(args, reads):
"""
Examine parsed FASTA filtering command-line options and return filtered
reads.
@param args: An argparse namespace, as returned by the argparse
C{parse_args} function.
@param reads: A C{Reads} instance to filter.
@return: The fi... | 0.000732 |
def nx_gen_node_values(G, key, nodes, default=util_const.NoParam):
"""
Generates attributes values of specific nodes
"""
node_dict = nx_node_dict(G)
if default is util_const.NoParam:
return (node_dict[n][key] for n in nodes)
else:
return (node_dict[n].get(key, default) for n in n... | 0.003077 |
def check_cmms_affection_status(self, ind_object):
"""
Check if the affection status is correct.
Args:
ind_object : An Individuals object
Yields:
bool : True if affection status is correct
False otherwise
"""
... | 0.012295 |
def cull(self, delta: bool) -> None:
"""
Cull cache entry frame list to size, favouring most recent query time.
:param delta: True to operate on rev reg deltas, False for rev reg states
"""
LOGGER.debug('RevoCacheEntry.cull >>> delta: %s', delta)
rr_frames = self.rr_de... | 0.006363 |
def tag_dssp_solvent_accessibility(self, force=False):
"""Tags each `Monomer` in the Assembly with its solvent accessibility.
Notes
-----
For more about DSSP's solvent accessibilty metric, see:
http://swift.cmbi.ru.nl/gv/dssp/HTML/descrip.html#ACC
DSSP must be avail... | 0.002698 |
def step(self, action):
"""
Move the end effector(s) according to the input control.
Args:
action (numpy array): The array should have the corresponding elements.
0-2: The desired change in end effector position in x, y, and z.
3-6: The desired change... | 0.004782 |
def dump_model(self, fout, fmap='', with_stats=False):
"""
Dump model into a text file.
Parameters
----------
foout : string
Output file name.
fmap : string, optional
Name of the file containing feature map names.
with_stats : bool (option... | 0.002632 |
def stringify(value, encoding_default='utf-8', encoding=None):
"""Brute-force convert a given object to a string.
This will attempt an increasingly mean set of conversions to make a given
object into a unicode string. It is guaranteed to either return unicode or
None, if all conversions failed (or the ... | 0.000898 |
def serve_file(path_to_file: str,
offered_filename: str = None,
content_type: str = None,
as_attachment: bool = False,
as_inline: bool = False) -> HttpResponseBase:
"""
Serve up a file from disk.
Two methods (chosen by ``settings.XSENDFILE``):
... | 0.000682 |
def readRaw8(self):
"""Read an 8-bit value on the bus (without register)."""
result = self._bus.read_byte(self._address) & 0xFF
self._logger.debug("Read 0x%02X",
result)
return result | 0.012766 |
def get_hosting_device_plugging_driver(self, context, id):
"""Returns plugging driver for hosting device template with <id>."""
if id is None:
return
try:
return self._plugging_drivers[id]
except KeyError:
try:
template = self._get_hos... | 0.002762 |
def get_pokemon_by_number(self, number):
"""
Returns an array of Pokemon objects containing all the forms of the
Pokemon specified the Pokedex number.
"""
endpoint = '/pokemon/' + str(number)
return self.make_request(self.BASE_URL + endpoint) | 0.006897 |
def requestJob(self, CorpNum, Type, SDate, EDate, UserID=None):
""" ์์ง ์์ฒญ
args
CorpNum : ํ๋นํ์ ์ฌ์
์๋ฒํธ
Type : ๋ฌธ์ํํ, SELL-๋งค์ถ, BUY-๋งค์
,
SDate : ์์์ผ์, ํ์ํ์(yyyyMMdd)
EDate : ์ข
๋ฃ์ผ์, ํ์ํ์(yyyyMMdd)
UserID : ํ๋นํ์ ์์ด๋
re... | 0.00547 |
def gen_str(src, dst):
"""Return a STR instruction.
"""
return ReilBuilder.build(ReilMnemonic.STR, src, ReilEmptyOperand(), dst) | 0.019737 |
def sar(computation: BaseComputation) -> None:
"""
Arithmetic bitwise right shift
"""
shift_length, value = computation.stack_pop(num_items=2, type_hint=constants.UINT256)
value = unsigned_to_signed(value)
if shift_length >= 256:
result = 0 if value >= 0 else constants.UINT_255_NEGATIVE... | 0.004587 |
def services(doc):
"""View for getting services"""
for service_id, service in doc.get('services', {}).items():
service_type = service.get('service_type')
org = doc['_id']
service['id'] = service_id
service['organisation_id'] = org
yield service_id, service
yield ... | 0.00216 |
def send(self,
send,
expect=None,
shutit_pexpect_child=None,
timeout=None,
check_exit=None,
fail_on_empty_before=True,
record_command=True,
exit_values=None,
echo=None,
escape=False,
retry=3,
note=Non... | 0.040197 |
def getScoringVector(self, profile):
"""
Returns the scoring vector [m-1,m-2,m-3,...,0] where m is the number of candidates in the
election profile. This function is called by getCandScoresMap() which is implemented in the
parent class.
:ivar Profile profile: A Profile object th... | 0.008803 |
def setup_layout(self, orientation=None):
"""Setup the layout for the tooltip in the given orientation
:param layout: the orentation of the layout
:type layout: QtCore.Qt.Orientation | None
:returns: None
:rtype: None
:raises: None
"""
if orientation == Q... | 0.003979 |
def finish(self, code=None, message=None, perfdata=None, extdata=None):
"""
exit when using internal function to add results
automatically generates output, but each parameter can be overriden
all parameters are optional
arguments:
code: exit status code
... | 0.002315 |
def encode(self, word):
"""Return the Kรถlner Phonetik (numeric output) code for a word.
While the output code is numeric, it is still a str because 0s can lead
the code.
Parameters
----------
word : str
The word to transform
Returns
-------
... | 0.000497 |
def convert_in_oid(service_name):
"""
calculate the correct OID for the service name
"""
s = service_name
# convert the service_name to ascci
service_ascii = [ord(c) for c in s]
# we need the length of the service name
length = str(len(s))
# make the oid
oid = base_oid + "." + l... | 0.007732 |
def _ref_has_region_assembled_twice(nucmer_hits, ref_seq, threshold):
'''Returns true iff there is a part of the reference that is assembled
more than once (ie covered by >1 nucmer hit).
Needs a minimum proportin of the ref to be assembled more than once,
determined by threshold... | 0.002107 |
def update(self, environments):
"""
Method to update environments
:param environments: List containing environments desired to updated
:return: None
"""
data = {'environments': environments}
environments_ids = [str(env.get('id')) for env in environments]
... | 0.00641 |
def dict_filter(d, exclude=[]):
"""
Exclude specified keys from a nested dict
"""
if isinstance(d, list):
ret = []
for e in d:
ret.append(dict_filter(e, exclude))
return ret
elif isinstance(d, dict):
ret = {}
for k, v in d.items():
if ... | 0.001835 |
def show(self, resolve_mac=True, print_result=True):
"""Print list of available network interfaces in human readable form"""
res = []
for iface_name in sorted(self.data):
dev = self.data[iface_name]
mac = dev.mac
if resolve_mac and conf.manufdb:
... | 0.003555 |
def process_shells_ordered(self, shells):
"""Processing a list of shells one after the other."""
output = []
for shell in shells:
entry = shell['entry']
config = ShellConfig(script=entry['script'], title=entry['title'] if 'title' in entry else '',
... | 0.007092 |
def remove_core_element(self, model):
"""Remove respective core element of handed global variable name
:param str model: String that is the key/gv_name of core element which should be removed
:return:
"""
gv_name = model
if self.global_variable_is_editable(gv_name, "Dele... | 0.008237 |
def _add_dependency(container, obj):
'''
Add a dependency to the top list.
:param obj:
:param is_file:
:return:
'''
if os.path.basename(obj.__file__).split('.')[0] == '__init__':
container.append(os.path.dirname(obj.__file__))
else:
container.append(obj.__file__.replace(... | 0.002985 |
def update(self, data):
""" Update meta of one document."""
self.debug(data)
self._check(data)
wg_uuid = data.get('workGroup')
self.log.debug("wg_uuid : %s ", wg_uuid)
uuid = data.get('uuid')
url = "%(base)s/%(wg_uuid)s/nodes/%(uuid)s" % {
'base': self... | 0.004484 |
def restart(self, container, **kwargs):
"""
Identical to :meth:`docker.api.container.ContainerApiMixin.restart` with additional logging.
"""
self.push_log("Restarting container '{0}'.".format(container))
super(DockerFabricClient, self).restart(container, **kwargs) | 0.009868 |
def run(*args, **kwargs):
"""
Runs the parser and it executes the action handler with the provided arguments from the CLI.
Also catches the BaseError interrupting the execution and showing the error message to the user.
Default arguments comes from the cli args (sys.argv array) but we can force those argument... | 0.016169 |
def describe(feed: "Feed", sample_date: Optional[str] = None) -> DataFrame:
"""
Return a DataFrame of various feed indicators and values,
e.g. number of routes.
Specialize some those indicators to the given sample date,
e.g. number of routes active on the date.
Parameters
----------
fee... | 0.000582 |
def step(self, metrics):
""" EarlyStopping step on each epoch
Arguments:
metrics {float} -- metric value
"""
if self.best is None:
self.best = metrics
return False
if np.isnan(metrics):
return True
if self.is_better(metri... | 0.003636 |
def p_expr_minus(self, tree):
''' V ::= expr ( V - V )'''
tree.value = convertstr(tree[0].value) - convertstr(tree[2].value) | 0.014085 |
def globals(self):
"""Find the globals of `self` by importing `self.module`"""
try:
return vars(__import__(self.module, fromlist=self.module.split('.')))
except ImportError:
if self.warn_import:
warnings.warn(ImportWarning(
'Cannot impo... | 0.008457 |
def define_parallel_buckets(max_seq_len_source: int,
max_seq_len_target: int,
bucket_width: int = 10,
length_ratio: float = 1.0) -> List[Tuple[int, int]]:
"""
Returns (source, target) buckets up to (max_seq_len_source, max_seq_l... | 0.003375 |
def as_dict(self):
"""
Bson-serializable dict representation of the LightStructureEnvironments object.
:return: Bson-serializable dict representation of the LightStructureEnvironments object.
"""
return {"@module": self.__class__.__module__,
"@class": self.__class... | 0.005709 |
def p_lpartselect_lpointer_minus(self, p):
'lpartselect : pointer LBRACKET expression MINUSCOLON expression RBRACKET'
p[0] = Partselect(p[1], p[3], Minus(p[3], p[5]), lineno=p.lineno(1))
p.set_lineno(0, p.lineno(1)) | 0.012552 |
def set(self, dict_name, key, value, priority=None):
'''Set a single value for a single key.
This requires a session lock.
:param str dict_name: name of the dictionary to update
:param str key: key to update
:param str value: value to assign to `key`
:param int priority... | 0.003584 |
def object_as_axis(arr, dtype, axis=-1):
"""
cast an array of void objects to a typed axis
Parameters
----------
arr : ndarray, [ndim], void
array of type np.void
dtype : numpy dtype object
the output dtype to cast the input array to
axis : int
position to insert the... | 0.001592 |
def _generate_base_anchors(base_size, scales, ratios):
"""
Generate anchor (reference) windows by enumerating aspect ratios X
scales wrt a reference (0, 0, 15, 15) window.
"""
base_anchor = np.array([1, 1, base_size, base_size]) - 1
ratio_anchors = AnchorGenerator._ratio_... | 0.005725 |
def _put_overlay(self, overlay_name, overlay):
"""Store overlay so that it is accessible by the given name.
:param overlay_name: name of the overlay
:param overlay: overlay must be a dictionary where the keys are
identifiers in the dataset
:raises: TypeError if t... | 0.002721 |
def built(name,
runas,
dest_dir,
spec,
sources,
tgt,
template=None,
deps=None,
env=None,
results=None,
force=False,
saltenv='base',
log_dir='/var/log/salt/pkgbuild'):
'''
Ensure that the named... | 0.000225 |
def get_epoch_start(self, window_start):
""" Get the position (seconds) of the nearest epoch.
Parameters
----------
window_start : float
Position of the current window (seconds)
Returns
-------
float
Position (seconds) of the nearest epoc... | 0.003976 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.