content stringlengths 22 815k | id int64 0 4.91M |
|---|---|
def sample_and_group(npoint, nsample, xyz, points, density_scale = None):
"""
Input:
npoint:
nsample:
xyz: input points position data, [B, N, C]
points: input points data, [B, N, D]
Return:
new_xyz: sampled points position data, [B, 1, C]
new_points: sampled p... | 65,300 |
def main(corpus, allrules, names, maxrules, iteration, options, display):
"""
Produces lists of grams, from monograms up to k-grams.
Duplicate found in /scripts/readnames.py
Example use to get monograms, birgams, and trigrams:
getKgrams(getPNs(), 3)
Args:
corpus (set) = set of all tokens... | 65,301 |
def bin2hex(binary):
""" Converts Binary to HExaDEcimal"""
binary_split1 = (binary[0:4])
binary_split2 = (binary[4:8])
hex1 = b[binary_split1]
hex2 = b[binary_split2]
return str(hex1) + str(hex2) | 65,302 |
def test_get_all_artifacts(mock_properties, mock_find_aql, artifactory):
"""Tests get_all_repo_artifacts returns all artifacts."""
test_artifacts = {'results': [TEST_ARTIFACT2, TEST_ARTIFACT1]}
mock_find_aql.return_value = test_artifacts
expected_return = [TEST_ARTIFACT2, TEST_ARTIFACT1]
artifacts ... | 65,303 |
def derive_along_path(path, seed):
"""Derive an extended key from a 64-byte binary seed and a BIP-0044 path.
Returns the extended key obtained by following the given derivation path,
starting at the extended master key derived from the given binary seed.
"""
elements = list(element.rstrip("'") for... | 65,304 |
def _convert_to_float(score):
"""
Convert a string ('score') to float.
If the string is empty, return None.
If the string is float-like, return its float.
"""
if len(score) == 0:
return None
else:
return float(score) | 65,305 |
def ensure_host_configured(f):
"""Ensure that this configuration has been set up."""
@click.pass_obj
@functools.wraps(f)
def _wrapper(cfg, *args, **kwargs):
if cfg.get('remote.ssh.host', '*') == '*':
click.echo(f"{click.style('ERROR', fg='red')}: No configuration found at {cfg.filen... | 65,306 |
def _next_good_prime(p, R, qq, patience, qqold):
"""
Find the next prime `\\ell` which is good by ``qq`` but not by ``qqold``, 1 mod ``p``, and for which
``b^2+4*c`` is a square mod `\\ell`, for the sequence ``R`` if it is possible in runtime patience.
INPUT:
- ``p`` -- a prime
- ``R`` -- an... | 65,307 |
def test_eql_boost_random_state():
"""
Check if EQLHarmonicBoost produces same result by setting random_state
"""
region = (-3e3, -1e3, 5e3, 7e3)
# Build synthetic point masses
points = vd.grid_coordinates(region=region, shape=(6, 6), extra_coords=-1e3)
masses = vd.datasets.CheckerBoard(ampl... | 65,308 |
def Satellite_Simulator(
Satellite_skyfield,
SimulationTime,
Timeline_settings,
pointing_altitude,
LogFlag=False,
Logger=None,
):
"""Simulates a single point in time for a Satellite using Skyfield and also the pointing of the satellite.
Only estimates the actual pointing definition used... | 65,309 |
def leapyear(year):
"""Judge year is leap year or not."""
return (year % 4 == 0 and year % 100 != 0) or (year % 400 == 0) | 65,310 |
def correlate_clines(x1,x2,y1,y2,penalty):
"""use dynamic time warping to correlate centerlines
inputs:
x1, y1 - coordinates of first centerline
x2, y2 - coordinates of second centerline
penalty - parameter that forces more parallel correlation (or not)
outputs:
p - indices of correlation in... | 65,311 |
def write_constant_declarations(s, spec):
"""
Write all the constants from a spec as static members
@param s: The stream to write to
@type s: stream
@param spec: The message spec
@type spec: roslib.msgs.MsgSpec
"""
for constant in spec.constants:
write_constant_declaration(s, co... | 65,312 |
def _serialize_params(params: List[ParamsDependency]):
"""Return two types of values from stage:
`keys` - which is list of params without values, used in a pipeline file
which is in the shape of:
['lr', 'train', {'params2.yaml': ['lr']}]
`key_vals` - which is list of params with values, used ... | 65,313 |
def evolve_profile(diff_matrix, x_points, dc_init, exp_norm_profiles=None,
plot=True, return_data=False, labels=None):
"""
Theoretical diffusion profile, given the diffusion matrix.
Parameters
----------
diff_matrix : tuple
diffusion matrix, tuple of (eigenvalues, eigenv... | 65,314 |
def send_import_failure_email(study, user, import_id, import_params):
"""
Sends an import failure email to notify the user of a failed (large) import. Note that
failure modes exist that aren't covered by this notification but it does capture the most
likely error path (custom EDD import code).
"""
... | 65,315 |
def evaluate(model, inputs, **kwargs):
"""Performs model rollouts and create stats."""
initial_state = {k: v[0] for k, v in inputs.items()}
num_steps = inputs['cells'].shape[0]
prediction = _rollout(model, initial_state, num_steps)
error = tf.reduce_mean((prediction - inputs['velocity'])**2, axis=-1)
scala... | 65,316 |
def reset_option(key):
"""
Reset one or more options to their default value.
Pass "all" as argument to reset all options.
Available options:
parse.full_codestream
print.xml
print.codestream
print.short
Parameter
---------
key : str
Name of a single... | 65,317 |
def add_stereo_from_geometries(rxn, rct_geos, prd_geos):
""" Add stereo assignments to this reaction object from geometries.
:param rxn: a reaction object
:type rxn: Reaction
:param rct_geos: the reactant geometries
:param prd_geos: the product geometries
:returns: a reaction object with stereo... | 65,318 |
def determine_suitable_lda(displace_elev, margin):
"""Given a displacement elevation and safety marign, determine the
minimum acceptable LDA settings."""
return displace_elev * margin | 65,319 |
def current_client_year():
"""
gets the current year based on client timezone.
this is a helper method to let get the client year
without providing value to `current_year` method.
:rtype: int
"""
return get_component(DateTimePackage.COMPONENT_NAME).current_client_year() | 65,320 |
def einsum(x1, x3):
"""paddle.einsum only support in dynamic graph mode.
x1 : n c u v
x2 : n c t v
"""
n, c, u, v1 = x1.shape
n, c, t, v3 = x3.shape
assert (v1 == v3), "Args of einsum not match!"
x1 = paddle.transpose(x1, perm=[0, 1, 3, 2]) # n c v u
y = paddle.matmul(x3, x1)
# ... | 65,321 |
def format_raw_object(raw_object, internal_dict):
"""Format a RawObject."""
raw = raw_object.GetChildMemberWithName("raw_").GetValueAsUnsigned()
# SmallInt
if raw & 0x1 == 0:
return str(raw_object.GetChildMemberWithName("raw_").GetValueAsSigned() >> 1)
low_tag = (raw >> 1) & 0x3
if low_... | 65,322 |
def constructfullKMap(tmap, kmap):
"""construct a complete k-map from the complete t-map and mapping between t-vals and k-vals"""
newarr = tmap.copy()
for t, k in enumerate(kmap):
newarr[tmap==t] = k
return newarr | 65,323 |
def get_format_from_name(name: str) -> str:
"""
Function to infer the input format. Used when the input format is auto.
"""
try:
int(name)
src_format = "numeric"
except ValueError:
if len(name) == 2:
src_format = "alpha-2"
elif len(name) == 3:
... | 65,324 |
def get_linexp_from_variables(variables):
"""
Return a linear expression from the supplied list
of variables.
"""
linexp = gp.LinExpr()
for v in variables:
linexp += v
return linexp | 65,325 |
def test_mailgun_message_send_http_error_logs_error(caplog):
"""Tests error logged on mailgun HTTP status error."""
with mock.patch('requests.post', autospec=True) as mock_post:
mock_json = mock_post.return_value.json
mock_json.return_value = _a_site_verify_response_with(success=True)
mo... | 65,326 |
def iter_window_step(x, width, step, func=lambda win: win, minsize=0):
"""
iterates a sliding window over x with width 'width'
x must be sorted least to greatest
return an iterator with (midx, func(x[lowi:highi]))
"""
for lowi, highi, low, high in iter_window_index_step(
x, width, ... | 65,327 |
def read_zip(apath, fname, encoding='utf-8', errors='ignore',
process_line=None):
"""Read lines from a file in zip archive.
:param fname: a name of the file in the archive
:param process_line: a function that will be invoked to process each file's
line. If its result i... | 65,328 |
def get_landing_from_url(path):
""" determine whether a URL is a landing page.
This should always return boolean, not search result.
"""
if LANDING_RE.search(path):
return True
else:
return False | 65,329 |
def write_max_like_results(result_dict,comp_dict,header_dict,fit_mask,run_dir,
binnum=None,spaxelx=None,spaxely=None):
"""
Write maximum likelihood fit results to FITS table
if MCMC is not performed.
"""
# for key in result_dict:
# print(key, result_dict[key])
# ... | 65,330 |
def svn_diff_fns_invoke_datasource_close(*args):
"""svn_diff_fns_invoke_datasource_close(svn_diff_fns_t _obj, void diff_baton, svn_diff_datasource_e datasource) -> svn_error_t"""
return _diff.svn_diff_fns_invoke_datasource_close(*args) | 65,331 |
async def set_turn(pnum):
"""Set turn manually."""
try:
player_num = int(pnum)
except ValueError:
return jsonify({"status": "error", "error": "invalid player id"})
if player_num < 0 or player_num > 3:
return jsonify({"status": "error", "error": "invalid player id"})
try:
... | 65,332 |
def _help(session: "DebugSession") -> List:
""" Display command help for both general and connection-specific commands
:param session: Current DebugSession
"""
# Construct a help table for standard shell commands
outputs = [
_create_help_table(
first_column_name="Standard Comma... | 65,333 |
def do_mixup(x, mixup_lambda):
"""Mixup x of even indexes (0, 2, 4, ...) with x of odd indexes
(1, 3, 5, ...).
Args:
x: (batch_size * 2, ...)
mixup_lambda: (batch_size * 2,)
Returns:
out: (batch_size, ...)
"""
out = (x[0 :: 2].transpose(0, -1) * mixup_lambda[0 :: 2] + \
... | 65,334 |
def get_function_inputs(f):
"""
Given function signatures gets the name of the function.
:param f: a callable function
:return: input names on a tuple.
"""
if hasattr(f, cts.INTERNAL_PARAMETERS):
# 'internal_parameters' is defined inside the solver() annotation, see solver.py for details... | 65,335 |
def find_and_replace_characters_in_folder(find, replace_with, folder):
"""Swap the string `find` with the string `replace_with` in `folder`.
This search is global in the files, and recursive through the folder.
Args:
find: The string to search for.
replace_with: The string that `find` is t... | 65,336 |
def ensure_paramiko():
"""
.. warning:: :exc:`.OptionalPackageRequirementError` will be raised if ``paramiko`` is not installed.
"""
if paramiko is None: # pragma: no cover
raise OptionalPackageRequirementError('paramiko') | 65,337 |
def play_video(path):
"""
Play a video by the provided path.
:param path: str
"""
# Create a playable item with a path to play.
encoded_path = path.encode("utf-8")
play_item = xbmcgui.ListItem(path=encoded_path)
play_item.setInfo('video', {})
# Pass the item to the Kodi player.
... | 65,338 |
def recursive_dict_evaluate(d):
"""
Recursively run :func:`eval` on each element of the provided
dictionary.
A raw read of a configuration file with `ConfigObj` results in a
dictionary that contains strings or lists of strings. However, when
assigning the values for the various ParSets, the `f... | 65,339 |
def firmware_version(ip_address):
"""
Returns the firmware version
"""
return str(snmp_get(FIRMWARE_VERSION_OID, ip_address)) | 65,340 |
def adjugate(matrix : Matrix) -> float:
"""It transposes a given Matrix,"""
array = [item[:] for item in matrix.rawMatrix()]
arrays = [[] for item in matrix.collsAll()]
for row in array:
i = 0
for num in row:
arrays[i].append(num)
i+=1
return Matrix(arrays) | 65,341 |
def shorten(message):
"""Convert message into a shorter form"""
if message == 'On time':
return '0'
number = message.translate(None, string.ascii_letters).strip()
sign = '+' if 'late' in message else '-'
return '{}{}'.format(sign, number) | 65,342 |
def index():
"""Serve index page."""
default_application_json = post('test', 'group/project', {})
rendered = flask.render_template('index.html.j2', application_json=default_application_json)
return rendered | 65,343 |
def get_ground_truth(data, keypoints, warped_keypoints, shape, correctness_thresh, inv):
"""
Compute the ground truth keypoints matchings from image to image' where image' in the result
of warping image with H_matrix.
"""
#keypoints = np.stack([keypoints[0], keypoints[1]], axis=-1)
# Warp the ... | 65,344 |
def bsonjs_dump(doc, file, mode=bsonjs.LEGACY):
"""Provide same API as json_util.dumps"""
return bsonjs.dump(to_bson(doc), file, mode=mode) | 65,345 |
def get_create_table_field_data(field_data):
"""
Generates the field wise query segments needed to create a table.
:param field_data: List of dicts with each dict having keys 'name', 'type' and, optionally, 'modifiers'
:return: none
"""
field_query_list = []
for field in field_data:
... | 65,346 |
def compile(conf):
"""
Compiles the executable program from its sources in the source directory.
"""
exe_file = os.path.join(conf.bindir, conf.name)
if os.path.isfile(exe_file):
mtime = os.path.getmtime(exe_file)
skip = True
for s in find_files(conf.srcdir, [ '*.c', '*.h' ... | 65,347 |
def load_cached_creds(bless_config):
""" Load cached AWS credentials for the user that has recently MFA'ed
Args:
bless_config (BlessConfig): Loaded BlessConfig
Return:
dict of AWS credentials, or {} if no current credentials are found
"""
client_config = bless_config.get_client_confi... | 65,348 |
def hough_lines(img, ρ, θ, threshold, min_line_len, max_line_gap):
"""
`img` should be the output of a Canny transform.
Returns the hough lines.
"""
lines = cv2.HoughLinesP(img, ρ, θ, threshold, np.array([]), minLineLength=min_line_len, maxLineGap=max_line_gap)
return lines | 65,349 |
def url2pathname(pathname):
"""OS-specific conversion from a relative URL of the 'file' scheme
to a file system path; not recommended for general use."""
tp = urllib.splittype(pathname)[0]
if tp and tp != 'file':
raise RuntimeError, 'Cannot convert non-local URL to pathname'
if pathname[:3] ... | 65,350 |
def _shellquote(s):
"""Return a shell-escaped version of the string *s*.
Args:
s (str): String to shell quote.
Returns:
str: The shell-quoted string.
"""
if not s:
return "''"
if _find_unsafe(s) is None:
return s
# use single quotes, and put single quotes... | 65,351 |
def cancel_order(order_id):
"""method to get and edit an order by the user"""
if request.method == "PUT":
data = request.get_json()
response = validate_parcel_data(data)
if response == "valid":
sender_name = data['sender_name']
descr = data['descr']
se... | 65,352 |
def determine_timestamp(item):
"""Determine the timestamp of the given item
Args:
item: [dict] Specifies an resource instance created by an API
"""
# There is no standard for this.
# The following are common to some APIs.
for key in ['creationTimestamp', 'timeCreated']:
if key in item:
return i... | 65,353 |
def EmptyActivation():
"""EmptyActivation() object"""
return Activation(handle=_interpreter.interpreter_EmptyActivation()) | 65,354 |
def checkbox_to_boolean(list_checkbox_params, dict_all_params):
""" Takes a list of strings that are to be processed as checkboxes on a post parameter,
(checkboxes supply some arbitrary value in a post if they are checked, and no value at all if
they are not checked.), and a dict of parameters and their ... | 65,355 |
def distribution_data(history,mutant_id,i,all_types=False):
"""
generates neighbour data for mutants (or all cells if all_types is True)
cells are labelled by their ancestor. all cells with ancestor=mutant_id are type 1, all other cells type 0.
returns list of dicts with keys: tissueid, time, n, k, ... | 65,356 |
def likes(names):
"""Take string of names and let you know who likes 'it'."""
if len(names) == 0:
return "no one likes this"
elif len(names) == 1:
return "{} likes this".format(names[0])
elif len(names) > 3:
return "{}, {} and {} others like this".format(names[0], names[1],
... | 65,357 |
def is_on_board(board_location: int) -> bool:
"""
Checks if the square entered is on the board
""" | 65,358 |
def vmkernel_adapter_absent(
name, datacenter_name=None, cluster_name=None, host_name=None, service_instance=None
):
"""
Ensure VMKernel Adapter exists on matching ESXi hosts.
name
The name of the VMKernel interface to update. (required).
datacenter_name
Filter by this datacenter n... | 65,359 |
def josa_en(word):
"""add josa either '은' or '는' at the end of this word"""
word = word.strip()
if not is_hangul(word): raise NotHangulException('')
last_letter = word[-1]
josa = u'은' if has_jongsung(last_letter) else u'는'
return word + josa | 65,360 |
def move_to_position(m):
"""change the position of the arm base by writing new end time to PWM chip for channel 0 of servo hat"""
if m == 0:
time.sleep(.5)
bus.write_word_data(addr, 0x08, position_zero)
elif m == 1:
time.sleep(.5)
bus.write_word_data(addr, 0x08, position_one)... | 65,361 |
def workflow(settings: dict) -> None:
"""
WORKFLOW to pull profiles
@rtype: null
@param settings: dictionary of settings params of the workflow
"""
hrflow_client = Hrflow(api_secret=settings["API_KEY"], api_user=settings["USER_EMAIL"])
talentsoft_client = Talentsoft(settings["BASE_URL"], se... | 65,362 |
def veg_indices(input_image, output_image, input_index, sensor, k=0.,
storage='float32', no_data=0, in_no_data=0,
chunk_size=-1, be_quiet=False, overwrite=False,
overviews=False, mask_band=None, scale_factor=1.):
"""
Computes vegetation indexes
Assumes s... | 65,363 |
def get_runtime_env(yml_filename):
"""Reads input YAML filename and returns a dictionary in which each key
is a category name of runtime environment and the corresponding value
is an object that includes version information of packages listed in
that category.
"""
runtime_env = dict()
with ... | 65,364 |
def single_example():
"""
Parses expression from sample string and checks it for several strings
"""
rex = parse("(a,(b|c))*")
assert rex.accepts("")
assert rex.accepts("acab")
assert rex.accepts("ac")
assert not rex.accepts("a")
assert not rex.accepts("bacbac")
assert not rex... | 65,365 |
def matrix_power(M, n):
"""
Raise a square matrix to the (integer) power n.
Parameters
----------
M : Tensor variable
n : Python int
"""
result = 1
for i in xrange(n):
result = theano.dot(result, M)
return result | 65,366 |
def camera_rays(camK, W=None, H=None, c2w=None, graphics_coordinate=True,
center=False):
"""shoot viewing rays from camera parameters.
Args:
camK: Tensor of shape `[3,3]`, the intrinsic matrix.
W: Integer, if set None, then `W` is calculated as `2*cx`.
H: Integer, if set ... | 65,367 |
def basic_project_data():
"""
Provide a basic collection of Sample-independent data.
:return dict[str, object]: Mapping from Project section name to
value or collection of values.
"""
return {
METADATA_KEY: {
NAME_TABLE_ATTR: "anns.csv",
OUTDIR_KEY: "outdir",... | 65,368 |
def _zip_them_all(full_zip_path, zip_list_path):
"""
Takes a list of zip paths and brings the content together in a single zip
"""
full_zip_file = zipfile.ZipFile(full_zip_path, 'w', zipfile.ZIP_DEFLATED)
for zip_path in zip_list_path:
if zip_path != '':
zip_file = zipfile.ZipFi... | 65,369 |
def get_data(filename, args):
"""
@ input
filename: ex. kr00001973962b1p-4
@ output
image, coordinates, labels
"""
xmlfile = filename
jpgfile = filename.replace(".xml",".jpg")
doc = ET.parse(xmlfile)
root = doc.getroot()
object_dict = {}
for x in root.findall('... | 65,370 |
def printSection(configtree):
""" prints configtree in a nice way """
printSectionRecursive(configtree, "") | 65,371 |
def suggest_recovery_options(command, parents, path, children_names):
"""Suggest sensible recovery options when no command is found.
There is likely a syntax error, or a non-existent command, e.g.
orchestrate images crate (instead of create)
orchestrate foobar create (foobar in not a command)
User could... | 65,372 |
def photos(context, group):
"""
Render one or more photos defined in the spreadsheet.
"""
photoset = [photo for photo in context['COPY']['photos'] if photo['group'] == group]
whitespace_regex = re.compile(r'\s+') # Remove whitespace for Markdown embedding
fragments = []
for row in photoset:
... | 65,373 |
def main(input_filepath, output_filepath):
"""Trains a model from processed data into a joblib-serialised model"""
# load processed dataset
logger.info("Loading raw dataset")
_df: pd.DataFrame = pd.read_csv(os.path.join(input_filepath, "data.csv"))
Y = np.array(_df["y"]).reshape(-1, 1)
N = le... | 65,374 |
def run_command(cmd,input_dir):
"""
Another git convienience function, this time just running
an arbitrary command in an arbitrary location and waiting until quit.
"""
p = subprocess.Popen(cmd, cwd=input_dir,stdout=subprocess.PIPE)
out, err = p.communicate()
return out | 65,375 |
def makepath(subsystem, group, pseudofile=None):
"""Pieces together a full path of the cgroup"""
mountpoint = get_mountpoint(subsystem)
group = group.strip('/')
if pseudofile:
return os.path.join(mountpoint, group, pseudofile)
return os.path.join(mountpoint, group) | 65,376 |
def sky_noise_jy_autos(lsts, freqs, autovis, omega_p, integration_time, channel_width=None, Trx=0.0):
"""Make a noise realization for a given auto-visibility level and beam.
This is a simple replacement for ``hera_sim.noise.sky_noise_jy``.
Parameters
----------
lsts : array_like
LSTs at wh... | 65,377 |
def shortestDist(S1, S2):
"""Returns the distance between the time series S1 and S2.
S1 and S2 have size N x ... x 3
Assumes linear interpolation between points but no assumption about the
velocity between grid points (hence the shortest distance is between segments is returned)
return array of size... | 65,378 |
def parse_all_tasks(
inputs: List[str], all_possible_tasks: List[TileIdx_txy]
) -> List[TileIdx_txy]:
"""
Select a subset of all possible tasks given user input on cli.
Every input task can be one of:
<int> -- 0 based index into all_possible_tasks list
<start>:<stop>[:<step... | 65,379 |
def Starter(valuelist):
"""
:param: list of imported parameters
:return: MinOverlapBlocks, MinOverlapMST, MinArea, MinBdgCount, MinPatchSize, MaxHoleSize, MaxGapSize, partstart, partend, partlist
- checks whether all needed files are present
- coverts valuelist to single variables and return them
... | 65,380 |
def extract_labels(f, one_hot=False, num_classes=10):
"""Extract the labels into a 1D uint8 numpy array [index].
Args:
f: A file object that can be passed into a gzip reader.
one_hot: Does one hot encoding for the result.
num_classes: Number of classes for the one hot encoding.
Returns:
labels: a ... | 65,381 |
def delete_user(user_id, **kwargs):
"""
Remove a user from the framework.
"""
import sfa_api.utils.storage_interface as storage
try:
storage._call_procedure(
'delete_user', str(user_id),
with_current_user=False)
except pymysql.err.InternalError as e:
if e.... | 65,382 |
def head(filename, numlines=200):
"""Route: head the contents of a file given the numlines"""
return process_file(tailer.head, filename, int(numlines)) | 65,383 |
def PV_set_value(PV_name, value, keep_type=True):
"""Modify the local value of a process variable
(The value retreived by 'PV_value')"""
if DEBUG:
debug("set %s = %r" % (PV_name, value))
if keep_type:
value = convert(PV_name, value)
for object, name in registered_object_list:
... | 65,384 |
def test_stray_files(image):
"""
Test to ensure that unnecessary build artifacts are not present in any easily visible or tmp directories
:param image: ECR image URI
"""
ctx = Context()
container_name = _get_container_name("test_tmp_dirs", image)
_start_container(container_name, image, ctx)... | 65,385 |
def get_rpm_properties(input_file: str):
"""
Summary:
processes the structured name of the rpm file to get the
arch, release, version, and name
Parameters:
input_file (str): the file
Returns:
dictionary containing arch, release, version, and name
"""
#get prope... | 65,386 |
def _proxy_bypass_macosx_sysconf(host, proxy_settings):
"""
Return Prawda iff this host shouldn't be accessed using a proxy
This function uses the MacOSX framework SystemConfiguration
to fetch the proxy information.
proxy_settings come z _scproxy._get_proxy_settings albo get mocked ie:
{ 'excl... | 65,387 |
def create_graphql_api(name=None, logConfig=None, authenticationType=None, userPoolConfig=None, openIDConnectConfig=None, tags=None, additionalAuthenticationProviders=None, xrayEnabled=None):
"""
Creates a GraphqlApi object.
See also: AWS API Documentation
Exceptions
:example: response = c... | 65,388 |
def get_sig_symbol(corr_p_val, ctrl=False, percentile=False, sensitivity=None,
side=1, tails=2, p_thresh=0.05):
"""
get_sig_symbol(corr_p_val)
Return significance symbol.
Required args:
- corr_p_val (float):
corrected p-value (e.g., corrected for multiple compa... | 65,389 |
def test_find_obj__missing(tmpdir: LocalPath) -> None:
"""Return `None` when looking for file along path."""
filename = "SAMPLE_FILE.ext"
start_dir = Path(tmpdir)
end_dir = start_dir / "to" / "some" / "dir"
end_dir.mkdir(parents=True)
filepath = find_obj(obj_name=filename, start=start_dir, fin... | 65,390 |
def equalize_hist_rgb(rgb_img: np.ndarray) -> np.ndarray:
"""
Equalize the histogram of a RGB image.
:param rgb_img: RGB image
:return: equalized RGB image
"""
ycrcb_img = cv2.cvtColor(rgb_img, cv2.COLOR_RGB2YCrCb) # convert from RGB color-space to YCrCb
ycrcb_img[:, :, 0] = cv2.equalizeHi... | 65,391 |
def ls():
"""List loaded assets"""
for container in lib.lsattr("id", "pyblish.mindbender.container"):
data = dict(
schema="pyblish-mindbender:container-1.0",
name=container,
**lib.read(container)
)
api.schema.validate(data, "container")
yield... | 65,392 |
def move_file(cpu_context, func_name, func_args):
"""
Moves an existing file (or directory) to new location.
"""
old_name_ptr, new_name_ptr, *_ = func_args
old_path = cpu_context.read_data(old_name_ptr).decode("utf8")
new_path = cpu_context.read_data(new_name_ptr).decode("utf8")
logger.debug... | 65,393 |
def get_artists_in_genre(incl_genres, lydir: str=LYRICDIR):
"""
creates and displays a list of all artists for genres selected via incl_genres parm.
selects all genres if incl_genres is left blank or if 'all' is passed as str or list
:param incl_genres:
:param lydir: folder for lyric files
:retu... | 65,394 |
def ingest(args):
"""Ingest datasets into the SQLite3 database."""
for ingest, module in INGESTS:
if ingest in args.datasets:
log(SEPARATOR)
module.ingest()
log(SEPARATOR) | 65,395 |
def authenticate():
"""Sends a 401 response that enables basic auth"""
return (
jsonify({"description": "Incorrect Credentials"}),
401,
{'WWW-Authenticate': 'Basic realm="Credentials Required"'}) | 65,396 |
def update_batch_flow():
"""
手动置批处理节点为完成状态
"""
form = BusinessBatchFlowForm()
if form.validate_on_submit():
db_info = EnvironMapping.query.filter_by(tms_ip=form.test_env.data).first()
engine = OracleEngine('BATCH', db_info=db_info)
engine.update_business_batch_flow(form.trad... | 65,397 |
def spherical_to_cartesian(spherical: np.ndarray) -> np.ndarray:
"""Returns the cartesian form of the spherical vector.
spherical_vector can be a numpy array where rows are spherical vectors
(or a single vector)"""
cartesian = np.empty_like(spherical, dtype=float)
cartesian[..., 0] = spheri... | 65,398 |
def max_flow_rule(mod, l, tmp):
"""
**Constraint Name**: TxSimple_Max_Flow_Constraint
**Enforced Over**: TX_SIMPLE_OPR_TMPS_W_MAX_CONSTRAINT
Transmitted power should not exceed the defined maximum flow in
each operational timepoint.
"""
var = mod.tx_simple_max_flow_mw[l, tmp]
if var == ... | 65,399 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.