content stringlengths 22 815k | id int64 0 4.91M |
|---|---|
def stacks_list(credentials):
"""
List the stacks accessible to the currently logged in user.
"""
url = _urljoin(credentials["host"], "api/a0.1/stacks/")
headers = {"Authorization": "Token {}".format(credentials["token"])}
resp = requests.get(_ensure_protocol(url), headers=headers)
resp.rais... | 5,300,900 |
def remove_0x_head(s):
"""
Better use from django_eth_events.utils import remove_0x_head,
because in pyEthereum version <= 1.6.1 is bugged for Python3
"""
return s[2:] if s[:2] in (b'0x', '0x') else s | 5,300,901 |
def chisq(model: Module, loader: DataLoader, optimizer: optim.Optimizer,
criterion, device: str, alpha: float):
"""Chi^2-DRO"""
model.train()
max_l = 10.
C = math.sqrt(1 + (1 / alpha - 1) ** 2)
for _, (inputs, targets) in enumerate(loader):
inputs, targets = inputs.to(device), targets.to(device... | 5,300,902 |
def build_doc(cls, **kwargs):
"""Decorator to build docstrings for datalad commands
It's intended to decorate the class, the __call__-method of which is the
actual command. It expects that __call__-method to be decorated by
eval_results.
Note that values for any `eval_params` keys in `cls._params_... | 5,300,903 |
def load_base_qb():
"""
load base QB components
"""
pass | 5,300,904 |
def nodeCast(*args, **kwargs):
"""
Given two nodes, a source node of type A and a target node of type B, where type A is either type B or a sub-type of B, this command will replace the target node with the source node.
Returns: `int` 0 for success, 1 for failure.
"""
pass | 5,300,905 |
def test_get_target_size():
"""
Test get_target_image_size for a sample input
"""
image_size = 100, 200
size_factor = 32
expected = 96, 192
actual = net.utilities.get_target_image_size(image_size, size_factor)
assert expected == actual | 5,300,906 |
def run_cross_validation_svm(filename):
"""
This function runs the support vector machines (SVM) algorithm using
the cross-validation technique.
:return: None. It just prints out the accuracy of the model.
:rtype: None
"""
fold_no = constants.CV_NUMBER
kf = KFold(n_splits=fold_no)
... | 5,300,907 |
def get_dev_requirements() -> List[str]:
"""Fetch requirements for library development."""
with open(_DEV_REQUIREMENTS, mode="r") as f:
return f.readlines() | 5,300,908 |
def wait_result(ref):
"""
Waits for the referenced agent to finish, whereupon its latest result will
be returned.
Args:
ref (uuid.UUID): The UUID of the agent. Usually received when a window
is created.
Raises:
KeyError: When an agent with the given UUID could not be fo... | 5,300,909 |
def test_install_fileset_with_bff_extension():
"""
Test install of fileset with bff extension
"""
installp_call = MagicMock(return_value={"retcode": 0, "stdout": ""})
fileset_pkg_name = (
"/cecc/repos/aix72/TL3/BASE/installp/ppc/bos.rte.printers_7.2.2.0.bff"
)
list_pkgs_mock = MagicM... | 5,300,910 |
def mask_tokens(inputs: torch.Tensor, tokenizer: PreTrainedTokenizer, args) -> Tuple[torch.Tensor, torch.Tensor]:
""" Prepare masked tokens inputs/labels for masked language modeling: 80% MASK, 10% random, 10% original. """
if tokenizer.mask_token is None:
raise ValueError(
"This tokenizer ... | 5,300,911 |
def make_dir(dir_name):
"""create a directory if not exists"""
if not os.access(dir_name, os.F_OK):
os.mkdir(dir_name, 0755)
return | 5,300,912 |
def _has_sectors(tax_name: str, ignore_sectors: bool) -> bool:
"""Determine whether we are doing a sector-based forecast."""
return tax_name in ["birt", "sales", "wage", "rtt"] and not ignore_sectors | 5,300,913 |
def merge_modules(pose_graph, module_corners, observations,
image_width, image_height, merge_threshold, max_module_depth, max_num_modules,
max_combinations, reproj_thres, min_ray_angle_degrees):
"""Merge duplicate modules by projecting each module into each keyframe
and finding overlapping modules.""... | 5,300,914 |
def KK_RC23_fit(params, w, t_values):
"""
Kramers-Kronig Function: -RC-
Kristian B. Knudsen (kknu@berkeley.edu / kristianbknudsen@gmail.com)
"""
Rs = params["Rs"]
R1 = params["R1"]
R2 = params["R2"]
R3 = params["R3"]
R4 = params["R4"]
R5 = params["R5"]
R6 = params["R6"]
... | 5,300,915 |
def normalize_dates(df,col):
"""Normalize the DF using min/max"""
scaler = MinMaxScaler(feature_range=(-1, 1))
df_values= df[col].values.reshape(-1,1)
dates_scaled = scaler.fit_transform(df_values)
return pd.DataFrame(dates_scaled) | 5,300,916 |
def _replace_by_new_if_needed(file_new: Path, md5_mode: str = 'b'):
"""Use `file_new` (suffix .new) instead of the old file (same path but no suffix).
If the new file is identical to the old one, the old one will not be touched.
Parameters
----------
file_new : Path
The new file, ending wi... | 5,300,917 |
def discretize_instationary_cg(analytical_problem, diameter=None, domain_discretizer=None, grid_type=None,
grid=None, boundary_info=None, num_values=None, time_stepper=None, nt=None,
preassemble=True):
"""Discretizes an |InstationaryProblem| with an |Sta... | 5,300,918 |
def getFile(path):
"""
Retrieve the path to one of the reference or example files
Relies on the environment variable ``SERPENT_TOOLS_DATA``
to find the data files.
Parameters
----------
path : str
The name of the file without any additional directory
information
Return... | 5,300,919 |
def index():
"""List parties."""
parties = party_service.get_all_parties_with_brands()
parties.sort(key=lambda party: party.starts_at, reverse=True)
active_parties, archived_parties = partition(
parties, lambda party: not party.archived
)
brands = brand_service.get_all_brands()
bra... | 5,300,920 |
def parse_doi(iso_xml):
"""Get the DOI from an ISO XML doc"""
tree = ET.parse('iso.xml')
root = tree.getroot()
doi_el = root.findall(
'.gmd:identificationInfo/gmd:MD_DataIdentification/gmd:citation/'
'gmd:CI_Citation/gmd:identifier/gmd:MD_Identifier/gmd:code/'
'gco:CharacterString', NS_DICT
)[0]
... | 5,300,921 |
def delete_folder(folder_path: Path):
"""Deletes a folder and all of its contents.
Args:
folder_path: Path: A Path object for the folder to delete.
Raises:
DeleteCommandError: An OSError occured while attempting to delete a folder.
"""
try:
rmtree(folder_path)
except OSErr... | 5,300,922 |
def search_image_binary(subscription_key):
"""VisualSearchImageBinary.
This will send an image binary in the body of the post request and print out the imageInsightsToken, the number of tags, the number of actions, and the first actionType.
"""
client = VisualSearchClient(endpoint=ENDPOINT,credential=... | 5,300,923 |
def ajax_instagram_confirm(request):
"""
View called by an ajax function, it confirms that a user saw the Instagram modal.
"""
user = request.user
user.instagram = False
user.save()
return JsonResponse({"ok", True}) | 5,300,924 |
def parse_svg_path(svg_path: str, exploded=False):
"""Parses an svg path.
Exploded means when params repeat each the command is reported as
if multiplied. For example "M1,1 2,2 3,3" would report as three
separate steps when exploded.
Yields tuples of (cmd, (args))."""
command_tuples = []
p... | 5,300,925 |
def get_migration_from_new_config_key(new_config_key: str) -> Optional[AbstractPropertyMigration]:
"""
Get a migration from new config key.
"""
return _history_from_new_config_key_dict.get(new_config_key) | 5,300,926 |
def _build_array_type(var, property_path=None):
""" Builds schema definitions for array type values.
:param var: The array type value
:param List[str] property_path: The property path of the current type,
defaults to None, optional
:param property_path: [type], optional
:return: The built s... | 5,300,927 |
async def lambo(message: types.Message):
"""return a cool joe car."""
if not timer.canMessageOnChatId(message.chat.id):
return
await bot.send_video(chat_id=message.chat.id, video=open("content/videos/joelambo.mp4", 'rb'),
supports_streaming=True)
return | 5,300,928 |
def kfold(predictors: Sequence[ndarray], response: ndarray, k: int = 1,
shuffle: bool = False) -> Iterator[List[Tuple[ndarray, ndarray]]]:
""" Perform K-fold cross validation on N predictors
Args:
predictors: Equal length predictors to select from
response: The response
k: The... | 5,300,929 |
def td_processor(df):
""" Process dataframe for TD trial types """
onset_new, duration_orig, trial_type, delay, response, rt, onset_orig = [
df[name].copy() for name in
['onset', 'duration', 'trial_type',
'delay_time_days',
'response_button',
'reaction_time',
... | 5,300,930 |
def des_descrypt(s):
"""
DES 解密
:param s: 加密后的字符串,16进制
:return: 解密后的字符串
"""
secret_key = '20171117'
iv = secret_key
k = des(secret_key, CBC, iv, pad=None, padmode=PAD_PKCS5)
de = k.decrypt(binascii.a2b_hex(s), padmode=PAD_PKCS5)
return de | 5,300,931 |
def _kirkwood_muller_dispersion_ads(p_ads, m_ads):
"""Calculate the dispersion constant for the adsorbate.
p and m stand for polarizability and magnetic susceptibility
"""
return (1.5 * constants.electron_mass * constants.speed_of_light**2 * p_ads * m_ads) | 5,300,932 |
def connect_mol_from_frags(frags: List[Chem.rdchem.Mol], fragmentor: FragmentorBase) -> Chem.rdchem.Mol:
"""
Given a list of fragments (RDKit mol objects) with attachment points [*] marked by integer pairs (attachment_idx)
Return a new mol object
Atom properties are maintained from input frags
Not... | 5,300,933 |
def get_all_lists() -> Sequence[List]:
"""Return all lists."""
lists = db.session.query(DbList).all()
return [_db_entity_to_list(list_) for list_ in lists] | 5,300,934 |
def annotate_FayAndWusH(T, lineage_uid, df_seqs, fit_params_kingman, fit_params_BSC, seq_string_uid_to_uid):
""" Traverse tree, calculate Fay and Wu's H for each node, and calculate significance """
annotations = []
# Condition for stopping traversal
def stop(node):
if node.name == "germli... | 5,300,935 |
def include_jquery():
"""
Return whether to include jquery
Setting could be False, True|'full', or 'slim'
"""
return get_bootstrap_setting("include_jquery") | 5,300,936 |
def isample_from_lineseg(z_vals, weights, N_importance,
det=False, pytest=False, is_only=False,
alpha_base=0.01):
"""
Importance sampling on the line segments
--
z_vals: original sample points to center on
weights: weighted distribution for importanc... | 5,300,937 |
def read_mf_scans(filename_list=None, # type: ['str']
ub_matrix=None, intensity_matrix=None, processes=1, a3_offset=None, a4_offset=None):
"""
# type: (...) -> ['Scan']
Reads TASMAD scan files.
:param filename_list: A list of TASMAD file names to read. User will be prompted for a fold... | 5,300,938 |
def validate_result_count_2012_general():
"""Should have results for every candidate and contest in 2012 general election"""
# TODO: Include precincts if it's not too hard
reporting_levels = ['county', 'state_legislative']
Election2012General().validate_result_count(reporting_levels) | 5,300,939 |
def get_current_tpc():
"""
Returns: The current TargetPlatformCapabilities that is being used and accessed.
"""
return _current_tpc.get() | 5,300,940 |
def check_inputs(libE_specs, alloc_specs, sim_specs, gen_specs, exit_criteria, H0):
"""
Check if the libEnsemble arguments are of the correct data type contain
sufficient information to perform a run.
"""
if 'comm' not in libE_specs:
libE_specs['comm'] = MPI.COMM_WORLD
if 'color' not i... | 5,300,941 |
def check_rwp_calibration(spectrum_rwp, spectrum_broad):
"""
check the rwp calibration by comparing with a broadened cloud radar spectrum
based on different criteria it is decided if the calibration in trustworthy
(``unsecure_calibration``) and correctable (``mod_calibration``)
Args:
spect... | 5,300,942 |
def concatenate_state_matrices(G):
"""
Takes a State() model as input and returns the A, B, C, D matrices
combined into a full matrix. For static gain models, the feedthrough
matrix D is returned.
Parameters
----------
G : State
Returns
-------
M : ndarray
"""
if not is... | 5,300,943 |
def load_fossil():
"""Fossil"""
return _load_local('fossil') | 5,300,944 |
def parse_args():
"""parse args for binlog2sql"""
parser = argparse.ArgumentParser(description='Parse MySQL binlog to SQL you want', add_help=False)
connect_setting = parser.add_argument_group('connect setting')
connect_setting.add_argument('-h', '--host', dest='host', type=str,
... | 5,300,945 |
def main(args=None, **kwargs):
"""Main function of the Counter module."""
# PROTECTED REGION ID(Counter.main) ENABLED START #
return run((Counter,), args=args, **kwargs)
# PROTECTED REGION END # // Counter.main | 5,300,946 |
def _link_local_maxima_by_velocity(
current_local_max_dict, previous_local_max_dict,
max_velocity_diff_m_s01):
"""Does velocity-matching for local maxima at successive times.
N_c = number of maxima at current time
N_p = number of maxima at previous time
:param current_local_max_dict: S... | 5,300,947 |
def icontrol_rest_folder(method):
"""
Returns iControl REST folder + object name if
a kwarg name is 'name' or else ends in '_name'.
The folder and the name will be prefixed with the global
prefix OBJ_PREFIX.
"""
def wrapper(*args, **kwargs):
""" Necessary wrapper """
preserv... | 5,300,948 |
def safe_iterator_of_objects(input, input_class = None):
"""Create a generator given an object or a list of objects.
Arguments:
input: Object or list of objects.
input_class: Class of the objects.
Returns:
Generator of objects.
"""
if input_class is not None:
if not isinstance(input, (input_class, list))... | 5,300,949 |
def exp(x : float,iterations : int = 100,taylor_exapnsion=False):
"""Calulates the exponential function,\n
if taylor_exapnsion is set to True it will do what it says,\n
use the taylor expansion of the exp function for calculations,\n
else it will use the stored constant e and raise it to the... | 5,300,950 |
def numPointsInSpans(spans):
"""
ARC112B
>>> numPointsInSpans([(1, 3)])
3
>>> numPointsInSpans([(1, 3), (5, 7)])
6
>>> numPointsInSpans([(1, 3), (3, 5)])
5
>>> numPointsInSpans([(1, 3), (2, 5)])
5
"""
timeline = []
for start, end in spans:
assert start <= end
... | 5,300,951 |
def split_file(filename):
"""
Split the input file into separate files, each containing a single patent.
As a hint - each patent declaration starts with the same line that was
causing the error found in the previous exercises.
The new files should be saved with filename in the following format:
... | 5,300,952 |
def load_notebook_template(**kwargs):
"""
kwargs: the parameters to be replaced in the yaml
Reads the yaml for the web app's custom resource, replaces the variables
and returns it as a python dict.
"""
return helpers.load_param_yaml(NOTEBOOK_TEMPLATE_YAML, **kwargs) | 5,300,953 |
def grab_data(conn, schema, table, columns):
""" Obtain data from Postgres.
:param schema: name of schema in db
:param table: name of table in schema
:param columns: list of column names (not working yet)
:type schema: str
:type table: str
:return: data from data
:rtype: two-dimensional... | 5,300,954 |
def merge_import_policies(value, order=""):
"""
Merges and returns policy list for import.
If duplicates are found, only the most specific one will be kept.
"""
if not hasattr(value, "merged_import_policies"):
raise AttributeError("{value} has not merged import policies")
return value.... | 5,300,955 |
def _fix_xlink_ns(tree):
"""Fix xlink namespace problems.
If there are xlink temps, add namespace and fix temps.
If we declare xlink but don't use it then remove it.
"""
xlink_nsmap = {"xlink": xlinkns()}
if "xlink" in tree.nsmap and not len(
tree.xpath("//*[@xlink:href]", namespaces=xl... | 5,300,956 |
def initialize(ip_config, num_servers=1, num_workers=0,
max_queue_size=MAX_QUEUE_SIZE, net_type='socket',
num_worker_threads=1):
"""Initialize DGL's distributed module
This function initializes DGL's distributed module. It acts differently in server
or client modes. In the ser... | 5,300,957 |
def get_queue_policy_output(id: Optional[pulumi.Input[str]] = None,
opts: Optional[pulumi.InvokeOptions] = None) -> pulumi.Output[GetQueuePolicyResult]:
"""
Resource Type definition for AWS::SQS::QueuePolicy
"""
... | 5,300,958 |
def _parse_entries_from_text(text: str) -> DictIter:
"""Parse the given AuditTrail text to an iter of entry dicts."""
for entry_id, entry_match in enumerate(ENTRY_PATTERN.finditer(text)):
entry = entry_match.groupdict("")
entry.update(
{
"entry_id": entry_id,
... | 5,300,959 |
def run_ldd(ldd, binary):
"""Runs `ldd` and gets the combined stdout/stderr output as a list of lines."""
if not detect_elf_binary(resolve_binary(binary)):
raise InvalidElfBinaryError('The "%s" file is not a binary ELF file.' % binary)
process = Popen([ldd, binary], stdout=PIPE, stderr=PIPE)
st... | 5,300,960 |
def set_to_one(operator):
"""
Make a matrix the multiplicative identity, ie, :math:`1`.
.. math::
\\begin{align*}
(A)_{i, j} &= \\delta_{i, j}\\\\
&= \\begin{cases}
1,&i = j\\\\
0,&i\\neq j
\\end{cases}
\\end{align*}
Parameters
------... | 5,300,961 |
def wind_ms(wind_ms):
"""Checks units for wind_ms"""
return check_array_bounds(
arr=wind_ms, lims=(0, 50), action="warn", name="Wind speed (m/s)"
) | 5,300,962 |
def disqus_dev(context):
"""
No longer supported by Disqus
"""
return {} | 5,300,963 |
def config_from_git():
"""Infer revision from local git checkout."""
# if not a released version, use revision tag
env.git_rev = local('git rev-parse --short HEAD', capture=True).strip()
if libraryuse.__version_info__[-1]:
env.rev_tag = '-r' + env.git_rev | 5,300,964 |
def stop_detector(detector):
"""Stop detector"""
pass | 5,300,965 |
def multivariableode(t,x):
"""Function containing the ODE x_1' = -x_1 + x_2
x_2' = -x_2 .
"""
xprime = np.empty([2], float);
xprime[0] = -x[0] + x[1];
xprime[1] = -x[1];
return xprime; | 5,300,966 |
def plot_factor_contribution_to_perf(
perf_attrib_data,
ax=None,
title="Cumulative common returns attribution",
):
"""
Plot each factor's contribution to performance.
Parameters
----------
perf_attrib_data : pd.DataFrame
df with factors, common returns, and specific returns as c... | 5,300,967 |
def dict_to_nice_string(control_dict: Dict) -> str:
"""
Converts a dictionary of options (like template_control_dict)
to a more human readable format. Which can then be printed to a text file,
which can be manually modified before submiting analysis jobs.
Parameters
----------
control_dic... | 5,300,968 |
def min_sentence_set():
""" minimum query """
return {'hello', 'world'} | 5,300,969 |
def _sort_student(name: str) -> str:
"""
Return the given student name in a sortable format.
Students are sorted by last name (i.e., last space-split chunk).
"""
return name.lower().split()[-1] | 5,300,970 |
def XYZ_to_Hunter_Lab(
XYZ: ArrayLike,
XYZ_n: ArrayLike = TVS_ILLUMINANTS_HUNTERLAB[
"CIE 1931 2 Degree Standard Observer"
]["D65"].XYZ_n,
K_ab: ArrayLike = TVS_ILLUMINANTS_HUNTERLAB[
"CIE 1931 2 Degree Standard Observer"
]["D65"].K_ab,
) -> NDArray:
"""
Converts from *CIE XY... | 5,300,971 |
def set_up_window( win ):
"""This function sets up the window to listen for characters and builds the
string as the user types the characters. The Enter button resets the string
to blank."""
win.onkey(clear_string, '.')
win.onkey(finish_string, 'Return')
win.onkey(delete_a_char, "BackSpace")
... | 5,300,972 |
def inverse_transform(w, Jmin=2):
"""
Compute the wavelet inverse transform of w
"""
return perform_wavelet_transf(w, Jmin, -1) | 5,300,973 |
def find_winner(board):
""" Find winner """
winning =
return 'No winner.' | 5,300,974 |
def test_scan_from_acq_dir(fixtures):
"""Test the 'node scan' command run from the acquisition directory"""
tmpdir = fixtures["root"]
runner = CliRunner()
# fixup 'jim' details in the DB
jim = ac.ArchiveFile.get(name="jim")
jim.size_b = 0
jim.md5sum = fixtures["files"]["x"]["jim"]["md5"]
... | 5,300,975 |
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
"""Set up Airly as config entry."""
api_key = entry.data[CONF_API_KEY]
latitude = entry.data[CONF_LATITUDE]
longitude = entry.data[CONF_LONGITUDE]
use_nearest = entry.data.get(CONF_USE_NEAREST, False)
# For backwards ... | 5,300,976 |
def deploy(*paths):
"""
Deploy the latest app(s) to S3 and, if configured, to our servers.
"""
if paths[0] == '':
print 'You must specify at least one slug, like this: "deploy:slug" or "deploy:slug,slug"'
return
for path in paths:
deploy_single(path) | 5,300,977 |
def check_runpage() -> None:
"""Raises utils.RunpageError if on-wiki runpage is not True"""
utils.check_runpage(site, title=config["runpage"]) | 5,300,978 |
def split_element_id(element_id: Union[str, bytes]) -> Tuple[str, int]:
"""
Splits a combined element_id into the collection_string and the id.
"""
if isinstance(element_id, bytes):
element_id = element_id.decode()
collection_str, id = element_id.rsplit(":", 1)
return (collection_str, in... | 5,300,979 |
def test_cli_status_circle():
"""Test the status circle command."""
runner = CliRunner()
result = runner.invoke(cli.main, ["status", "circle"])
assert result.exit_code == 0
assert "CircleCI" in result.output | 5,300,980 |
def is_gcd_file(filename: str) -> bool:
"""Checks whether `filename` is a GCD file."""
if re.search('(gcd|geo)', filename.lower()):
return True
return False | 5,300,981 |
def create_connection(log, mydb):
"""creates a connection to the SQLite db
"""
log.debug("Creating db connection...")
db = QtSql.QSqlDatabase.addDatabase("QSQLITE")
db.setDatabaseName(mydb)
if not db.open():
lasterr = db.lastError()
if lasterr.isValid():
log.error("QS... | 5,300,982 |
def overlap_coeff(arr1, arr2):
"""
This function computes the overlap coefficient between the two input
lists/sets.
Args:
arr1,arr2 (list or set): The input lists or sets for which the overlap
coefficient should be computed.
Returns:
The overlap coefficient if both the ... | 5,300,983 |
def _clean_to_gce_name(identifier):
"""
GCE requires the names of all resources to comply with RFC1035. This
function takes an identifier which might not comply with RFC1035 and
attempts to map it into the logical equivalent identifier that does match
RFC1035.
:param unicode identifier: The inp... | 5,300,984 |
def notify_collision(body,enabled):
"""
Informs the body that it can at any time have its current collision points requested.
Parameters:
body: ``pypal.body`` The body to notify.
enabled: ``bool`` Weather we want to collect the collision poinsts later or not.
"""
_pal.lib.collision_no... | 5,300,985 |
def get_incompatible_fields(ga_ads_service):
"""
Return list of incompatible fields for the metrics and segments
here - we can't directly get incompatible fields, we received list of selectable fields for each fields.
- Hence, to get incompatible fields, we remove selectable from all_fields.
""... | 5,300,986 |
def debugNamespace(*args, **kwargs):
"""
Dynamic library stub function
Derived from mel command `maya.cmds.debugNamespace`
"""
pass | 5,300,987 |
def y():
"""Testing an obvious thing with wrapper 3"""
print("Init...")
print("Done!")
time.sleep(3.0)
assert False == False | 5,300,988 |
def update_user(username, infos):
""" Update a user by its username
arg infos: Dict
return True if deleted or False if not found
"""
with session_scope() as session:
user = session.query(User)
ret = user.filter_by(username=username).update(infos)
return bool(ret) | 5,300,989 |
def rectplot(x,xpos,ylim=[],**kwargs):
""" plot rectangles on an axis
Parameters
----------
x : ndarray
range of x
xpos : ndarray (nbrect,2)
[[start indice in x rectangle 1, end indice in x rectangle 1],
[start indice in x rectangle 2, end indice in x rectangle 2],
... | 5,300,990 |
def test_create_project_none_description(client):
"""Make request with missing title."""
create_unit_admins(num_admins=2)
current_unit_admins = models.UnitUser.query.filter_by(unit_id=1, is_admin=True).count()
assert current_unit_admins == 3
proj_data_none_description = proj_data.copy()
proj_d... | 5,300,991 |
def test_sel_by_physical_coords():
"""
Set up ImageStack with physical coordinates:
x_coords = [1. 1.11111111 1.22222222 1.33333333 1.44444444 1.55555556
1.66666667 1.77777778 1.88888889 2.]
y_coords = [4. 4.22222222 4.44444444 4.66666667 4.88888889 5.11111111
5.33333333 5.55555... | 5,300,992 |
def del_course_package():
"""
swagger-doc: 'schedule'
required: []
req:
course_id:
description: '课程id'
type: 'string'
type:
description: '1:一级,2:二级,3:三级,4:课包'
type: 'string'
res:
verify_code:
description: 'id'
type: ''
"""
cou... | 5,300,993 |
def run_isfa(img_X, img_Y):
"""
Wrapper of the Slow Feature Analysis algorithm.
:param img_X: First image.
:param img_Y: Second image.
:return:
bcm: Binary change matrix between both images
"""
channel, img_height, img_width = img_X.shape
sfa = ISFA(img_X, img_Y)
# when max... | 5,300,994 |
def uniform_bar_modes(n=10, bctype=3, npoints=2001,
barparams=np.array([7.31e10, 2747.0, 0.4]),
kl_over_EA = 1000, m_over_rhoAL = 1000):
"""Mode shapes and natural frequencies of Uniform bar/rod.
Parameters
----------
n: int, numpy array
highest mode ... | 5,300,995 |
def polling_locations_import_from_master_server(request, state_code):
"""
Get the json data, and either create new entries or update existing
:return:
"""
# Request json file from We Vote servers
messages.add_message(request, messages.INFO, "Loading Polling Locations from We Vote Master servers"... | 5,300,996 |
def pactfile() -> str:
"""
A sample Pact file as a string.
"""
with open(
PROJECT_ROOT / "test_app" / "pactfiles" / "LibraryClient-Library-pact.json",
"r",
) as f:
return f.read() | 5,300,997 |
def grig2dataset(grbs, params_of_interest):
"""
Parameters
----------
grbs : TYPE
DESCRIPTION.
params_of_interest : TYPE
DESCRIPTION.
Returns
-------
ds : TYPE
DESCRIPTION.
"""
params_df = params_of_interest.copy()
# get lat and lon
grb = g... | 5,300,998 |
def search_song(df, query):
"""
search_song: Fetches the closest matching song from the database
- If multiple are found, return a list of potential songs
:param df: DataFrame object to obtain info of search result
:param query: A query in string format, usually the name of a so... | 5,300,999 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.