content
stringlengths
35
762k
sha1
stringlengths
40
40
id
int64
0
3.66M
def generate(fin, fout): """ Search first author last name, year, and first meaningful word in title. Assemble Google-Scholar-style keys (lastname+year+titlefirstword). Replace original keys ``RN+number" with new keys. Also adds letter suffixes to repeated keys (e.g. peter1998researcha, peter1...
30d7f2ae0a344dc663198aabecec4c8b9b05a8ff
3,629,417
import torch from typing import Optional from typing import Union def fbeta_score( outputs: torch.Tensor, targets: torch.Tensor, beta: float = 1.0, eps: float = 1e-7, argmax_dim: int = -1, num_classes: Optional[int] = None, ) -> Union[float, torch.Tensor]: """ Counts fbeta score for gi...
081a90826acd0174a46af3cf8969a7935c7cde19
3,629,418
def gc_blocks(seq,block_size): """ Divide sequence into non-overlapping blocks and compute GC content of each block.""" blocks = [] for i in range(0, len(seq) - (len(seq) % block_size), block_size): blocks.append(gc_content(seq[i:i+block_size])) return tuple(blocks)
3bf33ab361f520ffc53781ae48d51037bdd343e6
3,629,419
def is_android(filename): """ check if the files is an apk file or not """ with open(filename, "rb") as f: # AndroidManifest.xml if b"AndroidManifest.xml" in f.read(4096): return True return False
95405710bbf361eef9ddc4dff877745c4c42be02
3,629,420
def enrich(alert, rules): """Determine if an alert meets an enrichment rule :param alert: The alert to test :param rules: An array of enrichment rules to test against :returns: Alert - The enriched Alert object """ for enrichment in rules: updates = enrichment(alert) if not upda...
97bf2d387e4c6e1ab38628860415bdf83c4634b9
3,629,421
def max_ea(): """ Return the highest mapped address of the IDB. Wrapper on :meth:`BipIdb.max_ea`. """ return BipIdb.max_ea()
9f79ad7e6b71e81b3ecf9440a313243b6946d116
3,629,422
from ..architectures import create_unet_model_3d from ..utilities import get_pretrained_network from ..utilities import get_antsxnet_data from ..utilities import preprocess_brain_image def desikan_killiany_tourville_labeling(t1, do_preprocessing=True, ...
e7b37f918f07823e9b4e297f065e72fa5a8aad16
3,629,423
def empty(document, selection, selectmode=''): """Reduce the selection to a single uppermost empty interval.""" beg = selection[0][0] return Selection(Interval(beg, beg))
dc349c95bd9cf492695e906630762d6e67bf33bf
3,629,424
def re(rm,rf,beta): """Returns cost of equity using CAPM formula.""" return rf + beta*(rm-rf)
5f91fd21ba1833dcb816ac767c8e1a15e2a30a5a
3,629,425
from typing import Dict def _kwargs_to_bond_parameters(bond_type: Array, kwargs: Dict[str, Array]) -> Dict[str, Array]: """Extract parameters from keyword arguments.""" # NOTE(schsam): We could pull out the species case from the generic case. for k, v in kwargs.items(): if bon...
6ff9cf3d3662d84ca5a8c0fbb0298a33f59ac253
3,629,427
import time def wait_for_result(func, *args, matcher=simple_matcher(True), attempts=20, interval=5, decode=decode_wrapper): """Runs `func` with `args` until `matcher(out)` returns true or timesout Returns the matching result, or raises an exception. """ for i in range(attempts): ...
fcaf21eeceac3c2f5096763f41250de1d9508fec
3,629,428
def host_is_trusted(hostname: str, trusted_list: t.Iterable[str]) -> bool: """Check if a host matches a list of trusted names. :param hostname: The name to check. :param trusted_list: A list of valid names to match. If a name starts with a dot it will match all subdomains. .. versionadded:: 0....
e33fb74f12e61016f0e042d6765c93547b26fd15
3,629,429
from typing import Sequence import copy def average_data(flow_fields: Sequence[GmxFlow]) -> GmxFlow: """Average a given list of flow fields. The flow fields must be of identical shape and be regular. It is further assumed that they have the same origin and bin spacing, and that the bins have the same...
57454ec23498e54bc6792c37b94ed5c2bb9cec50
3,629,430
def user_dashboard_request_view(request, **kwargs): """User dashboard request details view.""" avatar = current_user_resources.users_service.links_item_tpl.expand( current_user )["avatar"] request_type = request["type"] is_draft_submission = request_type == CommunitySubmission.type_id ...
afd57187d5a0c74229e3190c5e30079a7d8019a9
3,629,432
from typing import Sequence def _is_generator_like(data): """Checks if data is a generator, Sequence, or Iterator.""" return (hasattr(data, 'next') or hasattr(data, '__next__') or isinstance( data, (Sequence, iterator_ops.Iterator, iterator_ops.IteratorV2)))
444516eed895f1877cd63d1970254ad3890c9cd9
3,629,434
import socket def check_tcp_port(host, port, timeout=3): """ Try connecting to a given TCP port. :param host: Host to connect to :param port: TCP port to connect to :param timeout: Connection timeout, in seconds :return: True if the port is open, False otherwise. """ s = socket.socke...
5e49ebab2c219e9772174d830dffcb958033befd
3,629,435
import logging def create_logger(logger=None, loglevel=DEFAULT_LOGLEVEL): """ Attaches or creates a new logger and creates console handlers if not present """ logger = logger or logging.getLogger('{0}.SSHTunnelForwarder'. \ format(__name__)) if not logger....
7f6f9721964c0644d882e0206c2eb75f07fe0258
3,629,436
def psi_from(grid, axis_ratio, core_radius): """ Returns the $\Psi$ term in expressions for the calculation of the deflection of an elliptical isothermal mass distribution. This is used in the `Isothermal` and `Chameleon` `MassProfile`'s. The expression for Psi is: $\Psi = \sqrt(q^2(s^2 + x^2) + y...
257bbbd0f5826e5d78c1d24a9a565fd4473d6887
3,629,437
from io import StringIO def create_station_dataframe(): """Creates a pandas dataframe from the csv list of all stations downloaded from the uhrqds. """ files = get_station_files() combinedlst = "" for item in files: for line in item.read().decode().splitlines(): try: ...
924de681b7cc6803e83705d35fe8ad81d7a87c07
3,629,438
def _get_value_from_value_pb(value_pb): """Given a protobuf for a Value, get the correct value. The Cloud Datastore Protobuf API returns a Property Protobuf which has one value set and the rest blank. This function retrieves the the one value provided. Some work is done to coerce the return value...
cc3d2585d1afbb92fcf8dd363c28c1d362ee97a7
3,629,439
def load_audio(path): """Load audio data, mp3 or wav format Parameters ---------- path : str audio file path. Returns: ------- data : array-like Audio data. fs : int Sampling frequency in Hz. """ if path[-4:] == ".wav": fs...
d4c4ba20cde2332fa9e6379ddcfdd6a2a40a5e51
3,629,440
from . import operators import inspect def export_rule_data(variables, actions): """ export_rule_data is used to export all information about the variables, actions, and operators to the client. This will return a dictionary with three keys: - variables: a list of all available variables along with th...
d348ca2e6b79276a41da9b63764f9a56c534727d
3,629,441
def randonness_test(ts, lag=None): """ 样本的随机性检验; :param ts: :return: """ # The Run Test """ H0: the sequence was produced in a random manner """ ts = ts.dropna() statistic, pval = runstest_1samp(ts, correction=False) print(" The Run Test Result \n" "=======...
9e4325c29c07a219741664317838fcea90c56998
3,629,444
import torch def batch_norm1d ( input # in_minibatch x 1 x in_size , running_mean # 1 x in_size (not no minibatch) , running_var # 1 x in_size (not no minibatch) , weight=None # 1 x in_size , bias=None # 1 x in_size , eps=1E-5 ...
4ac97e421e835e4488711e0e490401be24daf558
3,629,445
def isolated_margin_account(self, **kwargs): """Query Isolated Margin Account Info (USER_DATA) GET /sapi/v1/margin/isolated/account https://binance-docs.github.io/apidocs/spot/en/#query-isolated-margin-account-info-user_data Keyword Args: symbols (str, optional): Max 5 symbols can be sent; se...
6109b995f9f64f850816963fa098117f4a4230fd
3,629,446
import random def multiplex_erdos_renyi(mg, seed=None, include_all=True): """Return a Multinet such that each layer is an Erdos-Renyi network with same p as the original Multinet given. Parameters ---------- mg : Multinet Multiplex network to be configured. seed : object Seed for...
78a8e7989b0fbe53e680f35734f73ef8b5078ef2
3,629,447
def homography(points1, points1_indices, points2, points2_indices, num_points=4, min_num_points=4): """ Computes homography matrix for given two sets of points :param points1: First point set :param points1_indices: First point set indices :param points2: Second point set :param points2_indices...
f873c5adb4f78f9e3d9e903ff4b0e4055c486a4a
3,629,449
def get_sid_trid_combination_score(site_id, tr_ids_list, idfilt2best_trids_dic): """ Get site ID - transcript ID combination score, based on selected transcripts for each of the 10 different filter settings. 10 transcript quality filter settings: EIR EXB TSC ISRN ISR ISRFC S...
9cc2d9a0f2fab4e4bf3030ef360b582caeaab45f
3,629,450
def extract_address_from_dnb_company(dnb_company, prefix, ignore_when_missing=()): """ Extract address from dnb company data. This takes a `prefix` string to extract address fields that start with a certain prefix. """ country = Country.objects.filter( iso_alpha2_code=dnb_company[f'{prefix}...
9d004152bf2091538c00b9d871ebfaba9ad09739
3,629,451
def prepare_inverse_operator(orig, nave, lambda2, dSPM): """Prepare an inverse operator for actually computing the inverse Parameters ---------- orig: dict The inverse operator structure read from a file nave: int Number of averages (scales the noise covariance) lambda2: float ...
5d48cada9c80fd77e155b737676dca2be19822d6
3,629,452
def float_convert(d, include_keys=None, exclude_keys=None): """Convert elements in a document to floats. By default, traverse all keys If include_keys is specified, only convert the list from include_keys a.b, a.b.c If exclude_keys is specified, only exclude the list from exclude_keys :param d: a ...
5bb592e20e37696c36738a41c20c1c516bb24d7c
3,629,454
def bin_downsample(Ain, dsfac): """ Downsample an array by binning. Parameters ---------- Ain : 2-D array The matrix to be downsampled dsfac : int Downsampling factor for the matrix Returns ------- Aout : 2-D array Downsampled array """ # Err...
80bf451b719f6e62275c3ded950cdc34cfecaa4d
3,629,455
def testComPolValidity(compol): """ The P3P header syntax must be one of the followings: * P3P: CP="...", policyref="..." * P3P: policyref="...", CP="..." * P3P: CP="..." * P3P: policyref="..." --- 'policyref="..."' contains ONE Link to a Policy Reference file 'CP="..."' contains spe...
c7e364d63e1afba0309b986e4344e1f792eb834a
3,629,456
from typing import List from typing import Optional from typing import Dict from typing import Any import re def sentry_event_filter( # noqa: WPS231 event, hint, ignored_types: List[str] = None, ignored_messages: List[str] = None ) -> Optional[Dict[str, Any]]: """Avoid sending events to Sentry that match the...
54f4aa87a256418e9fad3a82ec57636af2420b61
3,629,457
def map_dymola_and_json(results, case, res_fin, case_dict): """ This function couples the .mat file variable with the final .json variable :param results: Result obtained from the _extract_data function :param case: Dictionary that specifies the BESTEST case :param res_fin: Dictionary with the same...
138224f9fd3e2060b43ca08cbc4b0af459b60b6f
3,629,458
def statusName(dictname): """Return the underlying key used for access to the status of the dictlist named dictname. """ return (dictname, "S")
77700d17830c1521d543551a380ad611b050bda5
3,629,460
def stydiffstat(dataNameList, SELECT_RANGE, dateStart, dateEnd): """ Return the place name of input places Parameters ---------- dataNameList : list - list of strings of all participant id with shared data SELECT_RANGE: var - flag to define if select certain period dateStart: str - the s...
aef52a67e06013aa51ab43f1b2cc0220f7a94b72
3,629,461
def ergsperSecondtoLsun(ergss): """ Converts ergs per second to solar luminosity in L_sun. :param ergss: ergs per second :type ergss: float or ndarray :return: luminosity in L_sun :rtype: float or ndarray """ return ergss / 3.839e33
806b590c713bc9177db66993aff2f6feaa32d736
3,629,462
def svd(A, maxiter=30): """ Given a matrix A, this routine computes its SVD A = U.W.VT - The matrix U is output mxm matrix. This mean matrix U will have same size of matrix A. - The matrix W is ouput as the diagonal mxn matrix that contains the singular values - The matrix V ...
121efa0b27fb135af9a226a74f58feb3ac9ae9e3
3,629,463
from typing import Any def produces_record(obj: Any) -> bool: """Check if `obj` is annotated to generate records.""" if hasattr(obj, 'get_data_specs'): return True else: return False
b65ffe3d599963f8f5ee4d1581179ab7567aa074
3,629,467
import json def readJson(fname): """ Read json file and load it line-by-line into data """ data = [] line_num = 0 with open(fname, encoding="utf-8") as f: for line in f: line_num += 1 try: data.append(json.loads(line)) except: ...
0a4a78ce7e36fbc444b27ca6eec3ad5ba582b7cd
3,629,468
def parse_address(address): """Parse an address and return it as an Integer.""" if is_hex(address): return int(address, 16) return to_unsigned_long(gdb.parse_and_eval(address))
a6fbde1fc69f1ea815c983e0b43455dc0030e617
3,629,469
def index(request): """Index page for upload images""" form = ImageForm(request.POST or None, files=request.FILES or None) context = { "form": form } if not form.is_valid(): return render(request, "index.html", context) image = form.save() pixel_count_add(image.id) return...
7e2b31845ce492aee84de0cb275c3f0c8328a380
3,629,470
def binary_search(arr, val): """ Summary of binary_search function: searches an input array for a value and returns the index to matching element in array or -1 if not found. Parameters: array (array): An array of values val (integer): An integer value Returns: index (integer): Re...
3d5a44b5edce3820d1e669e549f9395d9052d433
3,629,471
def update_resource(resource, incoming_request): """Replace the contents of a resource with *data* and return an appropriate *Response*. :param resource: :class:`sandman.model.Model` to be updated :param data: New values for the fields in *resource* """ resource.from_dict(get_resource_data(inc...
f21b679b16926fea8b1d47897bbd3f5e86d2b58c
3,629,473
import types def new_object_graph( modules=finding.ALL_IMPORTED_MODULES, classes=None, binding_specs=None, only_use_explicit_bindings=False, allow_injecting_none=False, configure_method_name='configure', dependencies_method_name='dependencies', get_arg_names_from_class_name=( ...
d44d83a9d47260fd545ad9cb4193f927ceadff7e
3,629,474
def telegram_settings(): """set telegram client configuration. """ return { 'result': [] }
01aff4c347759ca34c609b69b53b4ce4880dc803
3,629,475
def find_pointing_documents(path, index): """ Returns the Metadata of the documents that use a given block as a pointer. Args: path(str): Path to the file index(int): Index of the block in the file Returns: list(Metadata): List of documents that used the block as a pointer ""...
4e6b447cdb2c4b0a841313956d67cce59c099bf2
3,629,476
def make_shell_context(): """注册了程序,数据库实例,以及模型,使得这些对象可直接导入shell""" return dict(app=app, db=db, User=User, Post=Post, Category=Category, Tag=Tag, Role=Role, Permission=Permission)
470667f7b551817999a0c2f51660487cdd42ab51
3,629,477
import torch def compute_jacobian(x, y, structured_tensor=False, retain_graph=False): """Compute the Jacobian matrix of output with respect to input. If input and/or output have more than one dimension, the Jacobian of the flattened output with respect to the flattened input is retur...
bd5fd8e3e2b8171680bf059d10fadfe1c39d8899
3,629,478
def unwarp_chunk_slices_backward(mat3D, xcenter, ycenter, list_fact, start_index, stop_index): """ Generate a chunk of unwarped slices [:,start_index: stop_index, :] used for tomographic data. Parameters ---------- mat3D : array_like 3D array. Corre...
0f6115c63ce752d82087c93582952dae08e1d475
3,629,479
def load_data(database_filepath): """ Function to load data from a database Inputs: database_filepath (path): location of the database Returns: X (pandas dataframe): messages (features) Y (pandas dataframe): categories (targets) category_name...
7115c50901b5edca01f92387c2971817cff6c6b7
3,629,480
def ndarray_duplicate_element_by_array(arr1,arr2): """ Duplicate each element in arr1[i] by the corresponding value of arr2[i], if arr2[i]==0, then arr1[i] will be dropped in final output, if all elements of arr2 is zero, then a None value will be returned. Parameters: ---------...
b2d2b3979681d818f20f47ada905756101a36488
3,629,481
import collections def namedtuple(typename, field_names, default_value=None, default_values=()): """namedtuple with default value. Args: typename (str): type name of this namedtuple field_names (list[str]): name of each field default_value (Any): the default value for all fields ...
1b387e870e3e5acfd11e5c709d21e77ebd67723d
3,629,482
def log_quaternion_loss_batch(predictions, labels, params): """A helper function to compute the error between quaternions. Args: predictions: A Tensor of size [batch_size, 4]. labels: A Tensor of size [batch_size, 4]. params: A dictionary of parameters. Expecting 'use_logging', 'batch_size'. Returns...
39738a93a62d4330703aa58fb08fc11ac40e88ac
3,629,483
from typing import List import requests import time def scrape_users(basic_users: List[BasicUser]) -> List[User]: """Scrape user pages for list of User objects. """ def major_delay(base: int, offset: int) -> None: delay = getdelay(base, offset) print(f"\nDelaying server request for {delay}...
5996033a94b121e545ca896c1a12b2ba887b0c0b
3,629,484
def angle_section( d: float, b: float, t: float, r_r: float, r_t: float, n_r: int, material: pre.Material = pre.DEFAULT_MATERIAL, ) -> geometry.Geometry: """Constructs an angle section with the bottom left corner at the origin *(0, 0)*, with depth *d*, width *b*, thickness *t*, root ...
e66a2a2a717c1b1fbe02a3ba5a456bee7b3fc27e
3,629,485
def normalize_adj(adj, type='sym'): """Symmetrically normalize adjacency matrix.""" if type == 'sym': adj = sp.coo_matrix(adj) rowsum = np.array(adj.sum(1)) # d_inv_sqrt = np.power(rowsum, -0.5) # d_inv_sqrt[np.isinf(d_inv_sqrt)] = 0. # return adj*d_inv_sqrt*d_inv_sqrt.fl...
0e1e2c428fbfd1961c13e86279a5072b76db5951
3,629,486
def get_mb( num): """get_mb convert a the number of bytes (as an ``integer``) to megabytes with 2 decimal points of precision :param num: integer - number of bytes """ return to_f(num / NUM_BYTES_IN_AN_MB)
984ee371db8d9f82f9bf8bcd288a1677acf483ff
3,629,487
def GetComments(node, layers='core') : """Get the rdfs:comment(s) we find on this node within any of the specified layers.""" return GetTargets(Unit.GetUnit("rdfs:comment", True), node, layers=layers )
61959b90ff8f522bcfdda637e3cb01284f899548
3,629,488
def _ValidateObbFileList(arg_internal_name, arg_value): """Validates that 'obb-files' contains at most 2 entries.""" arg_value = ValidateStringList(arg_internal_name, arg_value) if len(arg_value) > 2: raise test_exceptions.InvalidArgException( arg_internal_name, 'At most two OBB files may be specified...
b99604b220e475ae858908f2decba0af4fd0bf07
3,629,489
def _depol_error_value_one_qubit(gate_error, gate_time=0, t1=inf, t2=inf): """Return 2-qubit depolarizing channel probability for device model""" # Check trivial case where there is no gate error if gate_error is None: return None if gate_error == 0: return 0 # Check t1 and t2 are v...
135304ea8853f81aba5ad00bf7a556072fcb8370
3,629,490
def meh(text): """ >>> meh(EXAMPLE_INPUT) [3, 8, 9, 1, 2, 5, 4, 6, 7] """ return [int(c) for c in text]
a295b94395f132cf4f8906fb293e9c989da1d7d1
3,629,491
def get_latest_dataset(): """ Return latest dataset that was created """ return getattr(qcodes.DataSet._latest, None)
7179904df6a7d2269ad845c5401f934ec4527bed
3,629,492
def insert_newlines(text, line_length): """ Given text and a desired line length, wrap the text as a typewriter would. Insert a newline character ("\n") after each word that reaches or exceeds the desired line length. text: a string containing the text to wrap. line_length: the number of charac...
3f6ef4dc02cac415c586be04c86b032b415ef0ea
3,629,493
def gen_annular_fpm(inputs): """ Generate an annular FPM using PROPER. Outside the outer ring is opaque.If rhoOuter = infinity, then the outer ring is omitted and the mask is cropped down to the size of the inner spot. The inner spot has a specifyable amplitude value. The output array is the sm...
74591fb8a5eeccc332d804b0c8c757ecc4bd52c1
3,629,494
import time import re def _get_time_ts(string: str) -> float: """ 通过传入的字符串获取时间戳 """ year = time.localtime().tm_year month = re.search(r"(\d+)月", string).group(1) day = re.search(r"(\d+)日", string).group(1) return time.mktime(time.strptime(f"{year}-{month:>02}-{day:>02}", "%Y-%m-%d"))
bce5550c23bb3f60ada2e0a8fdc1054a347fdecc
3,629,495
def octresnet10_ad2(**kwargs): """ Oct-ResNet-10 (alpha=1/2) model from 'Drop an Octave: Reducing Spatial Redundancy in Convolutional Neural Networks with Octave Convolution,' https://arxiv.org/abs/1904.05049. Parameters: ---------- pretrained : bool, default False Whether to load the p...
1eab26df3ac3c8b4f7a905e9dc90d602d7ef2672
3,629,496
def generate_template(global_entity, sentence, sent_ent, kb_arr, domain): """ code from GLMP: https://github.com/jasonwu0731/GLMP/blob/master/utils/utils_Ent_kvr.py Based on the system response and the provided entity table, the output is the sketch response. """ sketch_response = [] if sent_ent...
d409a21965ce84e09fc785172aae9fdd41726d69
3,629,499
import json def project_file_read(request): """ get content of project file :param request: request object :return: file content """ if request.method == 'POST': data = json.loads(request.body) path = join(data['path'], data['label']) # binary file with open(pat...
854dcd4bb8475e84f020e10229f1729dcd8980ec
3,629,500
from typing import Final def ast_to_graph(root: Node) -> nx.DiGraph: """ You will create your regular expression with a specific syntax which is transformed into an AST, however the regular expression engine expects to navigate in a graph. As it is too complicated to navigate inside the AST direct...
c57178bae24655f29c1fdd36002551a16cd07f0b
3,629,501
def transform(record): """ Transforms (maps) a record. Parameters ---------- record : dict The record to transform. Returns ------- dict The transformed record. """ return { record["stakeholder_approach"]: { record["stakeholder_id"]: { ...
cc9e378c96ee78c46f52184051c3d69568807e0b
3,629,502
def easeInQuart(n): """A quartic tween function that begins slow and then accelerates. Args: n (float): The time progress, starting at 0.0 and ending at 1.0. Returns: (float) The line progress, starting at 0.0 and ending at 1.0. Suitable for passing to getPointOnLine(). """ _checkRange...
50f075b8ce1ffd0a1b6dcbf02995275c3b8dff0d
3,629,503
def apply(dataframe, parameters=None, variant=CLASSIC): """ Discover a StarStar model from an ad-hoc built dataframe Parameters ------------- df Dataframe parameters Possible parameters of the algorithm variant Variant of the algorithm, possible values: classic ...
615671920f2a60e356cf79b64da70e383bff4248
3,629,504
def invoke_cli(cli_runner): """ invoking cli commands with options""" return partial(cli_runner.invoke, cli)
e8811d3e5d640cd41b8f7de71cf190f9f7a72621
3,629,506
import uuid def create_launch_template(client, name, image_ami_id, iam_instance_profile_arn, user_data): """Create a launch template for provisioning instances Args: client (EC2.Client): boto3 ec2 client name (str): the name of the launch template image_ami_...
fc918d436500a04b854571ac4fcb699aa9edf623
3,629,507
def FlowGradedComplex(complex, discrete_flow): """ Overview: Given a complex and a graph on its top dimensional cells, produce a GradedComplex such that the preimage of a down set is the collection of cells in the closure of all the associated top cells Inputs: complex : a complex flow...
90ecf9cce9a3814037099bfec049220d37c52673
3,629,508
from relevanceai.utils import make_id import random import string from typing import List from typing import Dict def mock_documents(number_of_documents: int = 100, vector_length=5): """ Utility function to mock documents. Aimed at helping users reproduce errors if required. The schema for the documen...
83ffbac02725b2f46f8308af01184e0bb46c7f4b
3,629,509
import numpy def rearrange(blist, flist): """Alligns the number of evaluations taken from the blist with the correpsning flist""" final_b=[] final_f=[] for i in range(0,len(blist)): #runs over dimensions erg_b = numpy.empty((0), float) erg_f = [numpy.empty ((0), float), numpy.empty ((0...
1c8865ab3f65bc4fea34098fa1c718b134a2dfc0
3,629,510
def change_password_fields(): """Return Change Password Fields""" return f.Fields([ f.PasswordField('Old Password', v.required), f.PasswordField('New Password', v.required), f.PasswordField('Confirm New Password', v.required), ])
249b380da4b7b538456162b2049d9abcc80574c5
3,629,511
from dateutil import tz def montage_stream(ims, montage_order=None, channel_order=[0, 1, 2], clear_none=True): """From a sequence of single-channel field images, montage multichannels. Suppose the input is a list: ``` ims = [green1a, blue1a, red1a, green1b, blue1b, red1b, ...
0e2bc0307740ff673b2aeaa1a8e8bef32a75921f
3,629,512
def load_and_prepare_cmd(filename,verbose=False): # (g, gr) = load_and_prepare_cmd('fieldA.csv') """ Loads in data. Returns pandas Series of g-r and r respectively. """ FIELD = pd.read_csv("fieldA.csv") g = FIELD["g"] # probs slower than inital idea gr = g - FIELD["r"] mask = (g>14) & (g<24...
995099663179c6d813f32117c9514011201df00a
3,629,513
def make_rows(cngrs_prsn): """Output a list of dicitonaries for each JSON object representing a congressperson. Each individaul dictionary will contain information about the congressperson as well as info about their term. """ name = cngrs_prsn["name"]["first"] + " " + cngrs_prsn["name"]["last"] birthd...
a80c55c3db1261a339ec08814c0f532efd35e45a
3,629,514
def getNumProfileArgs(device): """ Get the number of Power Profile fields for a specific device Parameters: device -- DRM device identifier This varies per ASIC, so ensure that we get the right number of arguments """ profile = getSysfsValue(device, 'profile') numHiddenFields = 0 if n...
d4baa9936bc1d89a4fd3aca8f7aec4796d407bb7
3,629,515
def singlePass(A,Omega,k,s=1,check=False): """ The single pass algorithm for the Hermitian Eigenvalues Problems (HEP) as presented in [1]. Inputs: - :code:`A`: the operator for which we need to estimate the dominant eigenpairs. - :code:`Omega`: a random gassian matrix with :math:`m \\geq k` co...
888f4337a7317a22c32bdb20b06d13f0aad4eb95
3,629,516
def _cons6_77(m6, L66, L67, d_byp, k, Cp, h_byp, dw1, kw1, dw2, kw2, adiabatic_duct=False, conv_approx=False): """dz constrant for edge bypass sc touching 2 corner bypass sc""" term1_out = 0.0 if not adiabatic_duct: if conv_approx: R2 = 1 / h_byp + dw2 / 2 / kw2 ...
cedeaf3125454f4b73f082d43eeb7078a4b71412
3,629,517
def load_user(username): """Load user by usename.""" return User.get_by_username(username)
e037dc226ffff9bc900bc08e2fd323816b3eb7f3
3,629,518
def num_to_hex_string(num, size=1, little_endian=False): """Convert a given number to hex string. Converts a number to a big endian hexstring of a suitable size, optionally little endian Args: num (int) : Input int for which we need to get the hex string size (int) : The required size i...
44093d7b7372998398c360e66b2c2a9115f197de
3,629,519
def validate(number, table=None): """Checks to see if the number provided passes the Damm algorithm.""" if not bool(number): raise InvalidFormat() try: valid = checksum(number, table=table) == 0 except Exception: raise InvalidFormat() if not valid: raise InvalidChecks...
7d516863b2858a5ee922be5046a5ac3add3c7854
3,629,520
from typing import Optional from typing import Sequence def get_saliva_example(sample_times: Optional[Sequence[int]] = None) -> SalivaRawDataFrame: """Return saliva example data. Parameters ---------- sample_times : list of int, optional sample times of saliva samples in minutes Returns ...
004724f81e3bec47bc8a3846567e2da41e27130b
3,629,521
from typing import List from typing import Union def process_json_content(input_type: str, content_array: List[str], json_content_array: Union[List[str], None]): """ Process the array of json_contents """ if json_content_array is None: return [...
be7567f34d31790307c4db9e71e1ef4890bf080e
3,629,522
from typing import Set from typing import Tuple from typing import FrozenSet def knapsack( items: Set[Tuple[float, float]], max_weight: float ) -> FrozenSet[Tuple[float, float]]: """Given a set of (value, weight) pairs and a maximum weight, return the most valuable subset of items whose total weig...
f0bd51643da1f1cea24116e95fb4ea25e3d6dde0
3,629,523
import json def get_json(query_parsed): """Call taskwarrior, returning objects from json""" result, err = call_taskwarrior( 'export %s rc.json.array=on rc.verbose=nothing' % query_parsed) return json.loads(result)
c0537b3a7ca70839543e7867049bee8926f1da2c
3,629,524
def get_list_of_results(results): """Modify the outputs so that they are returned in a list format where it is sometimes easier to be used by other functions. Parameters ---------- results : list A list of named tuples for each iteration Returns ------- list, list, list ...
b5903e3b99aeb37ce90190e86a7cd6e2408ad35b
3,629,525
def get_dagger_of_native(gate: Gate) -> Gate: """ :param gate: A gate from native gate set :return: the conjugated and transposed gate """ if isinstance(gate, Gate): if gate.name == "RZ": return RZ(-gate.params[0], gate.qubits[0]) if gate.name == "RX": ...
4cc765c9deda05b7bec2811614d801b9cbd50836
3,629,526
from typing import List def get_movies_list(request_params: dict) -> List[ShortMovie]: """ :param request_params: Get request query params :return: List of movies, grabed with ElasticSearch """ sort_value = request_params.get('sort') sort_order = request_params.get('sort_order') limit = int(req...
f0704aee0b29f661bb4c7f820db6c500d633aefb
3,629,527
def statUniq(passwords, status): """produce data about unicity stats""" unicity = {"empty":0, "non empty": 0, "unique": 0} unicity['empty'] = passwords[status].count('') unicity['non empty'] = len( passwords[status] ) - unicity['empty'] unicity['unique'] = len( set( passwords[status] )) return u...
645e20c4dceeb1ee7dee028776709ec739e8a6e0
3,629,528
import re def _read_logo(content): """ Read info from logo in file header. """ def _read_logo(pat): pattern = pat + r":\s+\S+" data_str = re.compile(pattern).search(content).group() return data_str.split(':')[1].strip() info = {} for pat in ['Version', 'Website']: info...
e5ed2adb67c42854a3889dd823de6a3517cf1bad
3,629,529
def modulate_position(timestamp): """ counts the position in time-sorted log of IP activity as based on the timestamp attached to the particular log in rdd timestamp: attached timestamp """ result = (INCREMENT - timestamp) % time_dimension return result
f123acb1dd4924151a293789f3a3432f9000541e
3,629,530
def resnet50(mask_init='1s', mask_scale=1e-2, threshold_fn='binarizer', **kwargs): """Constructs a ResNet-50 model.""" #print('resnet50 get in') #print('resnet50 mask_init', mask_init) model = ResNet(Bottleneck, [3, 4, 6, 3], mask_init, mask_scale, threshold_fn, **kwargs) return m...
4713b7b27408e8a80d5603db3b4875cb88321248
3,629,531