content
stringlengths
35
762k
sha1
stringlengths
40
40
id
int64
0
3.66M
def get_provider_info(provider_name): """Get provider info matching given provider name""" return PROVIDERS_INFO.get(provider_name)
6f95c632ad8842777390751a1bc5f7cf5a62b4e0
37,362
def close_ticket(session, ticket_id, return_type=None, **kwargs): """ Closes a support ticket for the VPSA. :type session: zadarapy.session.Session :param session: A valid zadarapy.session.Session object. Required. :type ticket_id: int :param ticket_id: The support ticket 'id' value as return...
79f5f2dba8ab993ddfa3fecb110a205cb3ded066
37,364
import re def verify_mpls_ping( device, address=None, mask=None, expected_max_success_rate=100, expected_min_success_rate=0,count=None, source=None, vc_id=None, tunnel_id=None, vrf=None, max_time=60, check_interval=10,): """Verify ping Args: device ('obj'): Device object ...
3efc533d5c97caf577c32efd5cc784816a1b9949
37,365
def cryoscope_v2_processing( time_ns: np.array, osc_data: np.array, pnts_per_fit_first_pass: int = 4, pnts_per_fit_second_pass: int = 3, init_guess_first_pass: dict = {}, fixed_params_first_pass: dict = {}, init_guess_second_pass: dict = {}, max_params: dict = {}, min_params: dict = ...
8540da6a1458c84a88bbde6a58aceaaea883444e
37,367
def getCurrentSettingsAsDict(): """ Returns the current babylon parameters saved in the root node as a dict \nout: dictionary key: pymxs user property string value: var """ sceneRoot = sceneUtils.getSceneRootNode() newDict = dict() for val in BabylonPYMXS.babylonParame...
aeb36e9a4cc456c5ff46eb0503db14de423ddf49
37,369
def isjsonclass(class_: type) -> bool: """Check if a class is jsonclass. Args: class_ (type): The class to check. Returns: bool: True if it's a jsonclass, otherwise False. """ return hasattr(class_, '__is_jsonclass__')
3234cf62beb03aa968888dd8ec3b65f4c5f4cab3
37,370
import math def mu_from_pdiv(pdiv, nobj=3): """ Get population count based on divisions per objective for NSGA-III """ h = int(math.factorial(nobj + pdiv - 1) / (math.factorial(pdiv) * math.factorial(nobj - 1))) mu = int(h + (4 - h % 4)) return mu
b4087bcab34a0fe03c6a1d5c9e2d9fb1f47d79f0
37,371
def on_reload_plugins(branch='master'): """ `[branch]` - reload plugins in debot """ resp = [] try: git_plugins_manager = current_app.extensions['git_plugins_manager'] except KeyError: pass else: resp.append(git_plugins_manager.reload(branch)) dispatcher = current...
17b521b3812a3c5130e7595df63389d4abac9fdb
37,372
import copy def _get_model_cfg(fname): """Grab configs necessary to create a model. These are deep copied to allow for safe modification of parameters without influencing other tests. """ config = _get_config_module(fname) model = copy.deepcopy(config.model) return model
9f64d51e20a60c61388b2488dbfa9c640c103d84
37,373
def make_inference_request(serving_name, data, verb=":predict"): """ Submit an inference request Example use-case: >>> from hops import serving >>> serving.make_inference_request("irisFlowerClassifier", [[1,2,3,4]], ":predict") Args: :serving_name: name of the model being served ...
ee59fb0949390c91ee53200447b290f87fa0742a
37,374
import tqdm def online_variance(paths): """ Calculate mean and variance in an online way (Welford's algorithm) :param paths: :return: """ mean = np.zeros((conf.img_h, conf.img_w, conf.dest_channels)) M2 = np.zeros((conf.img_h, conf.img_w, conf.dest_channels)) i = 0 for i, path in ...
67b09232c0518ea60b6f2fbfe439f2bd607b9c02
37,375
def check_requires(request): """ This call checks whether a certain value requires another input to be filled. """ values = map(int, request.POST.getlist('value[]')) model = apps.get_model(request.POST.get('app'), request.POST.get('model')) required_values = model.objects.filter(**{ requ...
cca52b6d7b02d9deb05e3f72aa5dd3186e404f5d
37,376
def start(name): """ Start running a recipe. :param name: The recipe name. Must be one of the items returned by /list :return: object response One of: ok error message Only present if response is "error" and there is a ...
34615ec7e2b8832f2458275116c423adf5b344ad
37,379
def ate_exploitability(dist, payoff_tensor, p=1, aggregate=np.mean): """Compute Tsallis regularized exploitability of dist for non-symmetric game. Args: dist: list of 1-d np.arrays, current estimate of nash distribution payoff_tensor: (n x A1 x ... x An) np.array, payoffs for each joint action assume...
a7b119c3f38c3bcacc075abbc1457a6cb57058eb
37,381
def angular_cl_cov_SSC(cosmo, cltracer1, cltracer2, ell, tkka, sigma2_B=None, fsky=1., cltracer3=None, cltracer4=None, ell2=None, integration_method='qag_quad'): """Calculate the super-sample contribution to the connected non-Gaussian covarian...
1abac47d2414ba7fd297fc829285285749e811e4
37,382
def locals_in_putty(): """Hard-coded information regarding local variables """ locals_d = { # k: index # v: dict of local properties 0x14007DA84: { 6: {'name': 'v6', 'size': 8, 'type_name': '__int64'}, 7: {'name': 'v7', 'size': 8, 'type_name': '__int64'}, ...
52398e84aa324f8f751e2ca50bee9ad33be6eeb5
37,383
def _post_apply_columns( pydf: "PyDataFrame", columns: ColumnsType, ) -> "PyDataFrame": """ Apply 'columns' param _after_ PyDataFrame creation (if no alternative). """ pydf_columns, pydf_dtypes = pydf.columns(), pydf.dtypes() columns, dtypes = _unpack_columns(columns or pydf_columns) if ...
7373b774b5e76da1b8820feff4ccc7d37e6a572f
37,384
import torch def join_blocks(splitted, final_shape): """Join blocks to reobtain a splitted image Attribute: splitted (tensor) = image splitted in blocks, size = (N_blocks, Channels, Height, Width) final_shape (tuple) = size of the final image reconstructed (Height, Width) Return: ...
e6cf7382011e7f1ce0463f949e227e677cd0e8f2
37,385
def log_agg_function_alpha(alpha, cent1, cent2): """ Allows additional scaling of log_agg_function with a parameter alpha to roughly get retain factors for BA use retain factor 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9 alpha 1.7, 1.0, 0.7, 0.5, 0.4, 0.26, 0.2, 0.1, 0.015 """ return np.cli...
e488468838987bc95ea12789e6abd4b7fe499843
37,386
from typing import Type from re import T def from_yaml(c: Type[T], s: str, de=YamlDeserializer, **opts) -> T: """ Take yaml string and return deserialized object.. >>> from dataclasses import dataclass >>> from serde import deserialize >>> >>> @deserialize ... @dataclass ... class Set...
5eb24a55ec63dbe01e4efa8c536c84e120b875f2
37,387
from ..interfaces.nibabel import Binarize def init_n4_only_wf( atropos_model=None, atropos_refine=True, atropos_use_random_seed=True, bids_suffix="T1w", mem_gb=3.0, name="n4_only_wf", omp_nthreads=None, ): """ Build a workflow to sidetrack brain extraction on skull-stripped dataset...
d8708f3d1d4c93dafd901bbf89704c6677473657
37,388
def dvi( redchan, nirchan ): """ DVI: Difference Vegetation Index dvi( redchan, nirchan ) """ redchan = 1.0*redchan nirchan = 1.0*nirchan result = ( nirchan - redchan ) return result
afa5ffffccc3053598cd3597de1efd3dcfc4cd8f
37,389
def needs_min_max_values(mode, buckets): """ Returns True, if an encoding mode needs minimum and maximum column values, otherwise False """ return not buckets and mode in ['one-hot', 'one-hot-gaussian', 'one-hot-gaussian-fluent', ...
50ae2b899e5957347061dd59905290506c460093
37,390
def _rolling_player_f(player, gfcf, **kwargs): """ Creates a graph with CF% or GF% (on plus off). Use gfcf to indicate which one. :param player: str or int, player to generate for :param gfcf: str. Use 'G' for GF% and GF% Off and 'C' for CF% and CF% Off :param kwargs: other filters. See scrapenhl2....
6d3ef2716f5d72c7599c6fd68fdb0d09ce7a148f
37,391
def param(myval=None): """Parameterised decorator example""" if myval: print(f"Param: {myval}") def decorator(func): # real decorator decorated["param"].append(func) name = func.__name__ @wraps(func) def wrapparam(*argv): # inner to return arg_str = ",...
9b709bb0fca9d8efbbcd489161c39dcfc9c84dbc
37,392
def listed_list(list_list): """Return presentable string from given list """ return '{} and {}'.format(', '.join(list_list[:-1]), list_list[-1]) if ( len(list_list) > 1) else list_list[0]
da35296196fff56816fe7b0427985ee278238dab
37,394
import re def remove_plus_signs(_s: str) -> str: """Removes plus signs from string""" return re.sub(pattern=r'\+', repl=r'', string=_s)
53cf3117221ce82578a20d75e7eb807c2d41b8fc
37,395
def has_more_than_two_occurence(x): """creating a function for finding words with more than 2 occurences""" if(x[1]>1): return(x)
6e39c6cf4b473480786add14e76112c122ce439f
37,396
def compute_gas_flux(gas_coords, star_data, times, params, bins, fig_name, plot_flag=True): """Calculate the flux contribution from each point particle. Assumptions: light travel time from stars to gas plus the recombination time is shorter than the time it takes the stars to move ...
1f643946723f60b366795c44242796aeceeb984b
37,397
def evaluate(predictions, answerss): """ Returns a tuple of (F1 score, EM score, sentence score) The sentence score is our evaluation method for determining the effectiveness of finding the correct sentence within the context paragraph that may contain the answer. This metric is much softer than the F1 or...
f5edd23faf0a46cfd1407285b8d7d38d8b2b955c
37,398
from typing import Any from typing import Union from typing import List def style( text: Any, *, fg: Union[str, fg] = '', bg: Union[str, bg] = '', bold: bool = False, dim: bool = False, underline: bool = False ) -> str: """ Apply ANSI colors and/or styles to a string and return it....
bf1ad5b0d88f74a2496d4ad7e4951e4b89414916
37,399
def get_shape_tags(tags, font_info=(cv2.FONT_HERSHEY_COMPLEX_SMALL, 0.75, (255,255,255), 1)): """Get information about how much the list of tags will occupy (width and height) with the current configuration. Arguments: tags -- list of strings/tags you want to check shape. Keyword arguments: fo...
a95d546432adb1e0d1656a8420ba63c29e4d23bd
37,400
def Intersection(S1x, S1y, D1x, D1y, S2x, S2y, D2x, D2y): """ Find intersection of 2 line segments :param S1x: x coordinate of segment 1's start point :param S1y: y coordinate of segment 1's start point :param D1x: x coordinate of segment 1's end point :param D1y: y coordinate of segment 1's end...
2dba8839ebf24b55fe3c1b7797e53c7e0c3ed72a
37,401
def optimization_writer(): """ Writes an input file for a geometry optimization. """ return opt_string
b3cc7ba7d96c0f2ee584a09e0dadc8db2b8e3eb4
37,402
def _offset(ax, x, y): """Provide offset in pixels Parameters ---------- x : int Offset in pixels for x y : int Offset in pixels for y Idea borrowed from http://www.scipy.org/Cookbook/Matplotlib/Transformations but then heavily extended to be compatible with many reinc...
e8051a75f5cdcb5de0f36d354ee10bd72398045c
37,403
def augment(input_img, input_angle): """ Increase the training data set. """ output_images, output_angles = [],[] """ Fun fact: I had this condition around the data flipping code but these function calls somehow SIGNIFICANTLY slowed down the training process!!! if ((abs(in...
56b5e06a71631264a897f4b6a7fd78f93410c304
37,404
def check_host(hwaddr, ipaddr, config, args, timestr): """ check host infos against the config returns changes, updated_config """ changes = [] # get hostname hostname = get_hostname(ipaddr) if hwaddr in config: # shortcut c = config[hwaddr] # check statu...
6d20938332dec55acb480abcde32e53cb30c7084
37,405
def Update(dEntities): """This will initiate all of the different updates that need done for the Chunk Manager Entity.""" Update_Load_List({"LoadList":dEntities["ChunkMan"].get_component("LIST:LoadList"), \ "ChunkDataDir":dEntities["ChunkMan"].get_component("MISC:C...
18518cdb7718718599c7943db86e0adfe4e93945
37,406
import sqlite3 def getIdForTable(table): """resolve a table name to an ID""" with sqlite3.connect(DB_PATH) as conn: db = conn.cursor() db.execute('SELECT table_id FROM tables WHERE table_name=?', [table]) return db.fetchone()[0]
8b11309b50d4bc7fef35a3096f5bf8f42e36b0a2
37,407
def blasi(wood, gas, tar, char, T, dt, s=1): """ Primary and secondary kinetic reactions from Table 1 in Blasi 1993 paper. Note that primary reaction parameters in table are not cited correctly from the Thurner and Mann 1981 paper, this function uses the correct parameters. Parameters ---------...
813f532b5750ec6c7e1a402a980ac2041b0bdebf
37,408
def davis_southern_women_graph() -> nx.Graph: """Returns Davis Southern women social network. This is a bipartite graph. References ---------- .. [1] A. Davis, Gardner, B. B., Gardner, M. R., 1941. Deep South. University of Chicago Press, Chicago, IL. """ G = nx.Graph() # Top n...
af8d628cb03db7a64609b36af59c93b24299f2cc
37,410
def is_extension_enabled(extension_name, service): """A function that will check the list of enabled extensions from config """ config_dict = { 'compute': CONF.compute_feature_enabled.api_extensions, 'volume': CONF.volume_feature_enabled.api_extensions, 'network': CONF.network_featu...
524fc5abb3826058ab16cb3ee4b516d6eb3e2a01
37,411
import requests def existing_droplets(token): """infos about existing Marian droplets.""" params = { 'tag_name': 'marian' } url = 'https://api.digitalocean.com/v2/droplets' request = requests.get(url, headers=headers(token), params=params) return request.json()['droplets']
824a955d4c928004c265991b7268061f24c1cd27
37,412
import io import numpy def overlayLabel(dataSource, labelSource, sink = None, alpha = False, labelColorMap = 'jet', x = all, y = all, z = all): """Overlay a gray scale image with colored labeled image Arguments: dataSouce (str or array): volumetric image data labelSource (str or array): ...
7f84924fac34a0aea0fefc088b45eee32ac24f8d
37,413
def constrain_sum(a, b, result): """Constrain a + b == result. Note that overflows are forbidden, even if the result is never used.""" # This is a ripple-carry adder. c = False # carry bit # Optimization: stop at the the necessary number of bits. max_bit = max([i+1 for i in BITS if a.bits[i].i...
09371cbae682bfdef52b5db95b5dc904b7eb2ca2
37,414
def min_pos_root(a, b, c): """Returns the minimum positive root for the function ax²+bx+c = 0. If no positive roots exist, returns None""" roots = all_pos_roots(a, b, c) if not roots or len(roots) == 0: return None return roots[0]
afd619261002d8f65b982f74858b198d848eb572
37,415
from typing import Iterable def patch_module(module): """ Extends all iterables in the module with ``asq.queryables.Queryable`` methods. Applies the same as ``patch_type`` to every appropriate member of the module. Args: module: Module object or its __dict__. Returns: A ...
d5f0f7e7def1ca0938e0a52930eb3f746996e403
37,416
def trace_func(resource): """Trace calls to function using provided resource name""" @wrapt.function_wrapper def _trace_func(wrapped, instance, args, kwargs): pin = Pin.get_from(molten) if not pin or not pin.enabled(): return wrapped(*args, **kwargs) with pin.tracer.tr...
968fc735e755d8960d5d457f3ae2923a655a087e
37,417
def search_for_item(project): """Generate a string search key for a project""" elements = [] elements.append(project['attributes']['title']) return u' '.join(elements)
3ca0850b0c7b01900609aedfa41fd3fb8b86abac
37,418
def sort_by_status(ori_list): """ sort feature progress :param ori_list: :return: """ for i in range(len(ori_list) - 1): for j in range(len(ori_list) - 1 - i): if compare_two_features(ori_list[j], ori_list[j + 1]): ori_list[j], ori_list[j + 1] = ori_list[j + 1...
389add5b03278b7cee490b507fcc0b9261a2dd4c
37,419
def perturb_word(word: str, skip_stopwords=True, skip_punctuation=True): """ :param skip_stopwords: :param word: :return: pertubed word, None if no perturbation is available """ if skip_stopwords and word.lower() in stopwords.words('english') \ or skip_punctuation and not word.lowe...
6334896e3f489ed1cc0baa7cfe785179579c77c5
37,420
def boxzoom(viewer, event): """Enable box zoom.""" def _get_shape(): if "Control" in event.modifiers: return Shape.VERTICAL elif "Shift" in event.modifiers: return Shape.HORIZONTAL return Shape.BOX # make sure box is visible if not viewer.drag_tool.tool....
49716b217b04a78c4dada95a60c9aa6c4f8e2f4c
37,421
def gen_coeffs(num_dim): """ Helper function for generating a linear simulation. :param num_dim: number of dimensions for the simulation :return: a vector of coefficients """ coeff_vec = np.array([1 / (x+1) for x in range(num_dim)]) return coeff_vec.reshape(-1, 1)
87fe28331ec0be2d4eef59ca68fbd2055d49304f
37,422
def read_passwords(addr): """ read passwords as list from a file """ with open(addr) as f: lines = f.readlines() pwlist = [clean_word(line) for line in lines] pwlist = [x for x in pwlist if x != ""] return pwlist
e2190dee8fe0b5afbc3f0b7e23d7267e837be975
37,423
def get_model(name, version, project_name=None): """ Get a specific model version given a model name and a version. For example if you run this: >>> from hops import model >>> model.get_model('mnist', 1) You will get version 1 of the model 'mnist' Args: :name: name of the model ...
2e82f7b6703df0313abc29cbadbe6e140a01aeb2
37,424
def index(): """Return the home page.""" return render_template('index.html')
193f867973725dc89f5b213217cb15bc6980a66a
37,425
def generate_scope_name(data_loader): """ Generate scope name according to computation graph. Args: data_loader (OnnxDataLoader): Data loader instance. Returns: list[str], generated scope name. """ init_dag = _build_connection(data_loader) try: if USER_DEFINED_PATTE...
d57495866f8c100271b2327669b6245409052060
37,426
def get_active_questions(netid, course_id): """Gets all questions that are not yet being helped Returns a list of questions with their question text, id, enqueue_time, and the asking student's name or None if the requester is not a TA """ if not verify_is_ta(netid, course_id): return None ...
95d670927231e20cbbc9f468dace1ebe6c760eef
37,428
def hamiltonian(edges, directed=False, time_limit=5, concorde=False, precision=0): """ Calculates shortest path that traverses each node exactly once. Convert Hamiltonian path problem to TSP by adding one dummy point that has a distance of zero to all your other points. Solve the TSP and get rid of the ...
24a857d2184c20ef00b46fb06aa2a1c87a21299c
37,429
def analytic_kernel(k): """Calculate the X4 kernel from the X2 kernel (for proof see appendix in paper)""" k_size = k.shape[0] # Calculate the big kernels size big_k = np.zeros((3 * k_size - 2, 3 * k_size - 2)) # Loop over the small kernel to fill the big one for r in range(k_size): for ...
385ccd1e2ae4906780df909aa2e7830208466e48
37,430
def simple_3dof_arm(seg1_len, seg2_len, seg3_len, q0, base=None): """Creates a simple human-like robotic arm with 7 links and 2 segments with the desired lengths and starting joint configuration :param seg1_len: The length of the first segment of the arm :type seg1_len: int :param seg2_len: The le...
8a0c211cf72c764dc8b973c04ce8a045397660c8
37,431
def collect_nodes(points, highlighted_nodes=[], color='#79FF06', highlighted_color='blue', width=200, highlighted_width=400): """ Собирает необходимые нам вершины в нужный формат Parameters ---------- points : [str, str, ...] Вершины графа. highlighted_nodes : [str, str, ...], optional ...
a3a218b5f8c8c25a0f13a4154f12779a84726f9d
37,432
def conv3x3(in_planes, out_planes, stride=1): """3x3 convolution with padding""" conv3x3 = nn.Sequential( nn.Conv2d(in_planes, out_planes, kernel_size=3, stride=stride, padding=1, bias=False), nn.BatchNorm2d(out_planes), nn.ReLU(inplace=True), ) return conv3x3
f1c658e9115a741b34ebb9e6c89965d97d18cbf9
37,433
def get_ransac_pipeline(): """ Function return pipeline with lagged transformation in it """ node_ransac = PrimaryNode('ransac_lin_reg') node_final = SecondaryNode('linear', nodes_from=[node_ransac]) pipeline = Pipeline(node_final) return pipeline
4a6e0b21fe35691753885cd509c5344b96f4da67
37,436
def feature_names_from_extractor_list(feature_extractors): """ get a list of feature names from a list of feature extractors :param feature_extractors: a list of feature extractors :return: a list of the feature names for each extractor (think first row of .csv file) """ feature_names = [feature...
2f23aa860137e70270e9c7d564df5dacfa1d22a2
37,437
def blank_publish_view(request): """Save posts into db w/o publishing.""" return poster(lambda: tasks.fetch_and_publish(force=True, blank=True))
6883c038bdfbee7d975134152fd83f61f830b22f
37,439
import io def read_txt(filename, encoding='utf-8'): """Text file reader.""" with io.open(filename, 'r', encoding=encoding) as f: return f.read()
2ca0d80bddc49b793e8cbc63c513410154b4d460
37,440
def level_detect(x, fs, attack_ms=0.1, release_ms=100, mode='peak'): """Performs level detection on an input signal Parameters ---------- x : ndarray Input vector fs : float Sample rate [Hz] attack_ms : float, optional Time constant for attack [ms] release_ms : float...
dacde4e210f2d9d821c26cfc7a2965dbc3bcebe4
37,441
import copy def get_doc_permissions(doc, verbose=False, user=None, ptype=None): """Returns a dict of evaluated permissions for given `doc` like `{"read":1, "write":1}`""" if not user: user = frappe.session.user if frappe.is_table(doc.doctype): return {"read": 1, "write": 1} meta = frappe.get_meta(doc.doctype) ...
06698057696dbb6385de951668baddd535ae7b5c
37,442
def get_job_type(name): """Returns job type based on its name.""" if 'phase1' in name: return 'phase1' elif 'phase2' in name: return 'phase2' elif 'dfg' in name: return 'dfg' else: return 'other'
50db4a7833028b0a0944a4b915d82a8cabf91595
37,443
def ames_score(emb): """ Measure the ames positive probability of molecule, more close to 1, more "toxic" Parameters ---------- emb : numpy.ndarray, size (x,512) the cddd descriptor of molecule Returns ------- ames : float ames score """ ames = ames_model.p...
5dc55dd36c8627ea97314227e9f72e168b488da8
37,444
def quadrature(func,a,b,args=(),tol=1.49e-8,maxiter=50, reference=False): """Compute a definite integral using fixed-tolerance Gaussian quadrature. Description: Integrate func from a to b using Gaussian quadrature with absolute tolerance tol. Inputs: func -- a Python function or method to integr...
dc3188ced57ae6d138410bcbd34595f4142f078c
37,445
def read_sensor(): """Returns the orientation in quaternion form""" quat = sensor.quaternion return quat
f8dfc128987f03de35ef9ed7e1bd184919411989
37,447
def is_resnet(name): """ Simply checks if name represents a resnet, by convention, all resnet names start with 'resnet' :param name: :return: """ name = name.lower() return name.startswith('resnet')
6310d849b76a1006c7c2e97405aa9f0ebc53a78b
37,448
from typing import Optional def _get_object_system_id(obj) -> Optional[str]: """Finds the System id (as a string) for the supplied object""" system_id = None if isinstance(obj, System): system_id = obj.id elif isinstance(obj, BrewtilsSystem): system_id = ObjectId(obj.id) elif type...
40545e2a572954a8ed1e2e81de17e47a7941616c
37,449
def _regress_1d(design_matrix, boot_mean, boot_var, Nc_list, treatment_idx, **kwargs): """ Performs hypothesis testing for a single gene for many bootstrap iterations. Here, :X_center:, :X_center_Sq:, :boot_var:, :boot_mean: should have the same number of rows """ num_boot = boot_mean.shape[1] nonneg = Fal...
042f3ea973db7602c7b3e3e712715c39788e1ca4
37,451
def handle_pmid_25502872(filename): """Bergseng, ..., Sollid. Immunogenetics 2015 [PMID 25502872]""" return None
25a11d19293c59e4ae636b0b26389dbfd6b74955
37,453
def expand_schema_for_inheritance(schema): """ Allows the schema to support inheritance. The schema supports configs that (optionally) point to zero or more parent YAML configs (using a path) that will be taken as base configurations to be overwritten. """ return merge({'inherit': stlistorstring...
045505ea4634aef392196c1c174fefd8c1b541e6
37,454
def option_two(choice_two): """Functions to for different methods to search the database""" if choice_two == 1: query_sub = search_record.search_date() elif choice_two == 2: query_sub = search_record.search_time() elif choice_two == 3: query_sub = search_record.search_string() ...
6b1b20f452cfa24eed6c67346215da204a5d3012
37,455
import re def parse_fmt(fmt: str) -> (int, int): """Parse Q<m>.<n> string Parameters ---------- fmt Format string in the form 'Qm.n', where m is the number of integer bits n is the number of fractional bits Returns ------- n, m Number o...
f72133fdef9bbf40eb89d977d217376df8f2a3bd
37,456
from typing import Dict def invert_dictionary(mapping: Dict) -> Dict: """Invert the keys and values of a dictionary.""" remap = {v: k for k, v in mapping.items()} if len(remap) != len(mapping): raise ValueError("Dictionary cannot be inverted; some values were not unique") return remap
911aee48eff3bf0d980e5ad054c77c8a3081e232
37,457
def store_file(file): """Stores the file to specified destination""" destination = "/".join(["api/test_docs", file.name]) file.save(destination) return destination
1118415a1c1b7c2a33ecc539df7bf27dfd783d16
37,458
def getNumberedTypedString(items, maxLen=5000, numPrefix=''): """get a string that has each item of the list on its own line, and each item is numbered on the left from zero""" digits = 0 n = len(items) while n > 0: digits += 1 n //= 10 digits = digits format = numPrefix + '%...
4fa1f93c420c555093f1fc3b3ba3e43a4ce839f0
37,460
def mpl_dict(params): """"Convert _ to . for easier mpl rcparams grid definition""" return {k.replace('_', '.'): v for k, v in params.items()}
a8c4ae683205a1412a73f00e6965cb345ec63a3e
37,461
def data_source_get(context, data_source): """Return the Data Source or None if it does not exist.""" return IMPL.data_source_get(context, data_source)
5da4900f1e1099830253293ddf7391279d75c38e
37,463
def add_pseudo_counts(ccm,ad=None,num=None): """Add a small number of fake mutations or 'pseudo counts' to the co-clustering and ancestor-descendant matrices for subchallenges 2 and 3, each in their own, new cluster. This ensures that there are not cases where either of these matrices has a variance of zero...
f239f26ac0349bb3011b74f8a8d040fb34adb8a9
37,464
def compute_coefficients(xyz): """Fit a plane to the first three dimensions of a matrix Parameters ---------- xyz : array-like The matrix of data to fit the plane to. Returns ------- np.array 1-dimensional array with four values, the coefficients `a`, `b`, `c` and `...
07fb6af0c63a75f2a4e88e2a01836a212b2a8a57
37,465
def _build_step( docker_api, variables, build_config, step_config, from_image, should_ignore_cache, should_remove_container): """ Builds the image for the given step :param docker_api: The api interface that is to be used to connect to the docker daemon :param variables: The list of var...
437a279364bd89e83ffb01d39089bf23f2480994
37,466
from functools import reduce def Sum(onnx_node, ng_inputs): # type: (NodeWrapper, List[TensorOp]) -> Op """Calculate element-wise sum of the input tensors.""" return reduce(ng.add, ng_inputs)
7d1080e490a4cf6d7d06d0f95c903013df730525
37,467
def test_df_keys(): """List of keys to be used for populating a bucket with DataFrames""" return { 'avro': ['df.avro'], 'csv': ['df.csv'], 'csv.gz': ['df.csv.gz'], 'csv.zip': ['df.csv.zip'], 'csv.bz2': ['df.csv.bz2'], 'csv.xz': ['df.csv.xz'], 'psv': ['df.p...
3b008664744fb6abf8960caebe658ecc2f6525af
37,468
def first_existing(d, keys): """Returns the value of the first key in keys which exists in d.""" for key in keys: if key in d: return d[key] return None
eb9f34f1f5adb0a8e44127fe777e35ca8d36dc04
37,469
def _expand_right(a, n): """Insert multiple axes of size 1 at right end of tensor's shape. Equivalent to performing `expand_dims(..., -1)` `n` times. Args: a: tensor into which extra axes will be inserted. n: number of inserted axes. """ return tf.reshape(a, tf.concat([ tf.shape(a), tf.ones([...
69a3acb3aa717070ac3e1410c0f30fa71acbc56b
37,471
def unregister_mod(mod: Mod) -> bool: """ unregisters a mod from the global cache `mods` :param mod: mod to unregister :return: if it successfully unregistered it """ if mod.name_or_class_name() not in mods: return False get_event_loop().create_task(mod.unloaded()) del mods[mod....
48e018ebb2d56fd2e6713a6df4ae3f59160d78a8
37,472
def errors(module): """ dict: {name:Exception or None} for tests in module. """ modname = module.__name__ errors = ((k, do(v)) for k, v in all_tests(module)) errors = ((k, v) for k, v in errors if v is not None) return {f"{modname}.{name}": err for name, err in errors}
d60e604a821b4e56f1b560425157d11bc21c0be7
37,474
def add_column(graph, results, selector): """Add a column to `graph`, produce a new graph. Args: graph (:class:`Graph`): Source ArrowProperty graph. results (:class:`Context`): Results that generated by previous app querying. selector (str): Used to select a subrange of data of results,...
947160324c54d7d0d2fb7841513269be53f41642
37,475
def list_templates(sitename): """return a list of template names for this site""" path = WEBROOT / sitename / '.templates' if not path.exists(): return [] return sorted([f.name for f in path.iterdir() if f.suffix == '.tpl'])
05c6501b17ec1d6466aa82e818b95bede51c4713
37,476
import collections def from_pyqtgraph_struct(dct): """ Get simple structured dict from pyqtgraph params saveState() export. :param dct: dct = parameters.saveState() :return: """ output = {} key = dct["name"] if "children" in dct.keys(): reconstruction_type = "dict" if...
1c8d5b9f5fa10d0feb812e13dc3f7a8435958c61
37,478
def receive_msg(topic): """ Decorator """ def inner(func): @sio.on(topic) async def handle_request(data): # call 'func' to return the data func(data) # returning inner function return inner
5e9ccdf39762777850ba94beb9a46167256ebf3b
37,479
def get_requirements(): """Return a list of package requirements from the requirements.txt file.""" with open('requirements.txt') as f: return f.read().split()
85efbe71d02ced7c5987f08a56a1a966bff2e1ef
37,480
def integer_to_real_mapper(integers): """Define Integer Mapping Function Here(If Needed.)""" real_numbers = [] range_of_integers = 32767 # each value goes from 0-32767(2 ^ length_of_chromosome) integer_to_real_number_mapper = 1 / range_of_integers # will produce number between 0-1 when multiplied by ...
18cc9dc1efe2dd8122d4953a4256cedd5fe234c9
37,482