content
stringlengths
35
762k
sha1
stringlengths
40
40
id
int64
0
3.66M
from typing import Set import requests def get_filter_fields(target: str, data_registry_url: str, token: str) -> Set[str]: """ Returns a list of filterable fields from a target end point by calling OPTIONS :param target: target end point of the data registry :param data_registry_url: the url of the d...
34b6cccc2f8529391357ab70b212f1fddbd9e37d
3,651,739
def azimuthalAverage(image, center=None): """ Calculate the azimuthally averaged radial profile. image - The 2D image center - The [x,y] pixel coordinates used as the center. The default is None, which then uses the center of the image (including fracitonal pixels). http...
f086d0868bd56b01de976f346e2a66f5e0d7a10b
3,651,740
def train_transforms_fisheye(sample, image_shape, jittering): """ Training data augmentation transformations Parameters ---------- sample : dict Sample to be augmented image_shape : tuple (height, width) Image dimension to reshape jittering : tuple (brightness, contrast, sat...
c815d28a5e9e62234544adc4f2ba816e9f1c366a
3,651,741
from typing import Any def build_json_output_request(**kwargs: Any) -> HttpRequest: """A Swagger with XML that has one operation that returns JSON. ID number 42. See https://aka.ms/azsdk/python/protocol/quickstart for how to incorporate this request builder into your code flow. :return: Returns an :...
b920f0955378f0db1fdddadefc4037a33bedecad
3,651,742
def merge_extended(args_container: args._ArgumentContainer, hold: bool, identificator: str) -> int: """ Merge the args_container into the internal, like merge_named, but hold specifies if the internal container should not be cleared. :param args_container: The argument container with the data to merge ...
111765aa0a62a1050387670472d3718aca8a015f
3,651,743
def video_path_file_name(instance, filename): """ Callback for video node field to get path file name :param instance: the image field :param filename: the file name :return: the path file name """ return path_file_name(instance, 'video', filename)
b34b96961ad5f9275cd89809828b8dd0aed3dafb
3,651,744
def radiative_processes_mono(flux_euv, flux_fuv, average_euv_photon_wavelength=242.0, average_fuv_photon_wavelength=2348.0): """ Calculate the photoionization rate of helium at null optical depth based on the EUV spectrum arriving at the planet. ...
b555fe1af2bdcdab4ac8f78ed2e64bef35a2cdab
3,651,745
import typing from datetime import datetime def date_yyyymmdd(now: typing.Union[datetime.datetime, None] = None, day_delta: int = 0, month_delta: int = 0) -> str: """ :param day_delta: :param month_delta: :return: today + day_delta + month_delta -> str YYYY-MM-DD """ return date_delta(now, day...
8a3ff535964aba6e3eeaa30dc6b98bfcab1b5794
3,651,746
from .geocoder import description_for_number as real_fn def description_for_number(*args, **kwargs): """Return a text description of a PhoneNumber object for the given language. The description might consist of the name of the country where the phone number is from and/or the name of the geographical are...
c60423fb26d892a43db6017a08cce3d589481cb6
3,651,747
def get_pathway_nodes(pathway): """Return single nodes in pathway. :param pathme_viewer.models.Pathway pathway: pathway entry :return: BaseAbundance nodes :rtype: list[pybel.dsl.BaseAbundance] """ # Loads the BELGraph graph = from_bytes(pathway.blob) collapse_to_genes(graph) # Ret...
5ec451d9e9192b7d07230b05b2e3493df7ab3b4d
3,651,748
import copy def handle_domain_addition_commands(client: Client, demisto_args: dict) -> CommandResults: """ Adds the domains to the inbound blacklisted list. :type client: ``Client`` :param client: Client to use. :type demisto_args: ``dict`` :param demisto_args: The demis...
b5b281e3254a433c9431e77631001cb2be4e37e3
3,651,750
import torch def _tc4(dom: AbsDom): """ Validate that my AcasNet module can be optimized at the inputs. """ mse = nn.MSELoss() max_retries = 100 max_iters = 30 # at each retry, train at most 100 iterations def _loss(outputs_lb): lows = outputs_lb[..., 0] distances = 0 - lows ...
f008fd4bff6e1986f2354ef9338a3990e947656c
3,651,751
def skip_url(url): """ Skip naked username mentions and subreddit links. """ return REDDIT_PATTERN.match(url) and SUBREDDIT_OR_USER.search(url)
60c54b69916ad0bce971df06c5915cfbde10018c
3,651,752
def registry(): """ Return a dictionary of problems of the form: ```{ "problem name": { "params": ... }, ... }``` where `flexs.landscapes.AdditiveAAVPackaging(**problem["params"])` instantiates the additive AAV packaging landscape for the given set of paramet...
5dd2e4e17640e0831daf02d0a2a9b9f90305a1c4
3,651,753
import time import random def ecm(n, rounds, b1, b2, wheel=2310, output=True): """Elliptic Curve Factorization Method. In each round, the following steps are performed: 0. Generate random point and curve. 1. Repeatedly multiply the current point by small primes raised to some power, determined ...
9490e6ac4308aed9835e85b3093a1c2b18877fd1
3,651,754
from typing import Optional import re from datetime import datetime import logging def dc_mode_option(update: Update, contex: CallbackContext) -> Optional[int]: """Get don't care response mode option""" ndc = contex.user_data[0] if ndc.response_mode == DoesntCare.ResponseMode.TIME: if not re.matc...
accf998e660898d9de2d17d45e18b6d49ba90f4c
3,651,755
def is_in_period(datetime_, start, end): """指定した日時がstartからendまでの期間に含まれるか判定する""" return start <= datetime_ < end
3b830cb8d9e74934a09430c9cd6c0940cf36cf2e
3,651,756
def create_experiment_summary(): """Returns a summary proto buffer holding this experiment""" # Convert TEMPERATURE_LIST to google.protobuf.ListValue temperature_list = struct_pb2.ListValue().extend(TEMPERATURE_LIST) return summary.experiment_pb( hparam_infos=[ api_pb2.HParamInfo(name="initial_t...
678a9f1b004f4c5a60784ccf814082731eace826
3,651,757
import requests def get_session(token, custom_session=None): """Get requests session with authorization headers Args: token (str): Top secret GitHub access token custom_session: e.g. betamax's session Returns: :class:`requests.sessions.Session`: Session """ sessi...
88bf566144a55cf36daa46d3f9a9886d3257d767
3,651,758
def mass_to_tbint_to_energy_map(dpath, filterfn=lambda x: True, fpath_list=None): """Given a directory, creates a mapping mass number -> ( a, b, c, d, j -> energy ) using the files in the directory :param fpath_list: :param dpath: the directory which is a direct p...
a13caba5ff41e2958d7f4e6104eb809de1cda1c1
3,651,759
import unicodedata def strip_accents(text): """ Strip accents from input String. :param text: The input string. :type text: String. :returns: The processed String. :rtype: String. """ text = unicodedata.normalize('NFD', text) text = text.encode('ascii', 'ignore') text = text....
4a6e11e0a72438a7e604e90e44a7220b1426df69
3,651,760
import json def json_formatter(result, _verbose): """Format result as json.""" if isinstance(result, list) and "data" in result[0]: res = [json.dumps(record) for record in result[0]["data"]] output = "\n".join(res) else: output = json.dumps(result, indent=4, sort_keys=True) re...
68aae87577370d3acf584014651af21c7cbfa309
3,651,761
def show_all_companies(): """Show all companies a user has interest in.""" # redirect if user is not logged in if not session: return redirect('/') else: # get user_id from session user_id = session['user_id'] user = User.query.filter(User.user_id == user_id).one() ...
7f2d7215627747ff44caff4f58324dce2e3aa749
3,651,762
def ll_combined_grad(x, item_ids, judge_ids, pairwise=[], individual=[]): """ This function computes the _negative_ gradient of the loglikelihood for each parameter in x, for both the individual and pairwise data. Keyword arguments: x -- the current parameter estimates. item_ids -- the ids...
54936fe9b0e9b7a17acb7455c606bf754532a8b8
3,651,763
def relu(inp): # ReLu function as activation function """ ReLu neural network activation function :param inp: Node value before activation :return: Node value after activation """ return np.max(inp, 0)
fbe6caf2246684a62d00956e38579fab3dff3418
3,651,764
from typing import List from typing import Tuple import logging def augment_sentence(tokens: List[str], augmentations: List[Tuple[List[tuple], int, int]], begin_entity_token: str, sep_token: str, relation_sep_token: str, end_entity_token: str) -> str: """ Augment a sentence by adding tags...
916745727dd6ce19e67a28bdadb2bd74b54075a3
3,651,765
import multiprocessing def evaluate_model_recall_precision(mat, num_items, testRatings, K_recall, K_precision, num_thread): """ Evaluate the performance (Hit_Ratio, NDCG) of top-K recommendation Return: score of each test rating. """ global _mat global _testRatings global _K_recall glo...
bb504053937faf6e3017f8d79fee6a4a4e864b15
3,651,766
def pipe_hoop_stress(P, D, t): """Calculate the hoop (circumferential) stress in a pipe using Barlow's formula. Refs: https://en.wikipedia.org/wiki/Barlow%27s_formula https://en.wikipedia.org/wiki/Cylinder_stress :param P: the internal pressure in the pipe. :type P: float :param D: the ou...
9985d35c2c55e697ce21a880bb2234c160178f33
3,651,767
def node_constraints(node): """ Returns all constraints a node is linked to :param node: str :return: list(str) """ return maya.cmds.listRelatives(node, type='constraint')
85c619f4c1b6ec24feb8c3dac3e73b92f8fdf7fc
3,651,768
def load_opencv_stereo_calibration(path): """ Load stereo calibration information from xml file @type path: str @param path: video_path to xml file @return stereo calibration: loaded from the given xml file @rtype calib.data.StereoRig """ tree = etree.parse(path) stereo_calib_elem = ...
07ace05e8d377ba1fdcef632e5afa1d9ea309185
3,651,771
def _IsSingleElementTuple(token): """Check if it's a single-element tuple.""" close = token.matching_bracket token = token.next_token num_commas = 0 while token != close: if token.value == ',': num_commas += 1 if token.OpensScope(): token = token.matching_bracket else: token = to...
8d675bcee737ddb106817db79e2b989509d2efaa
3,651,772
def exportBufferView(gltf: GLTF2, primaryBufferIndex: int, byteOffset: int, byteLength: int) -> GLTFIndex: """Creates a glTF bufferView with the specified offset and length, referencing the default glB buffer. Args: gltf: Gltf object to append new buffer onto. primaryBufferIndex: Index of the p...
6905f3544470860a125b0d28f5f422a39bc7b91f
3,651,773
import numpy def ReadCan(filename): """Reads the candump in filename and returns the 4 fields.""" trigger = [] trigger_velocity = [] trigger_torque = [] trigger_current = [] wheel = [] wheel_velocity = [] wheel_torque = [] wheel_current = [] trigger_request_time = [0.0] tr...
773657474462aa3a129ea7459c72ea0b0dc0cefa
3,651,774
def retrieve(func): """ Decorator for Zotero read API methods; calls _retrieve_data() and passes the result to the correct processor, based on a lookup """ def wrapped_f(self, *args, **kwargs): """ Returns result of _retrieve_data() func's return value is part of a URI, and ...
442f18f4c00a13b5eb68285202088b009f9f351b
3,651,775
from typing import Dict async def health() -> Dict[str, str]: """Health check function :return: Health check dict :rtype: Dict[str, str] """ health_response = schemas.Health(name=settings.PROJECT_NAME, api_version=__version__) return health_response.dict()
8c2841cea1fb9118cbc063d9352d375188025614
3,651,776
def detail(video_id): """ return value is [ { 'video_path' : s }, { 'person_id': n, 'person_info_list' : [ { 'frame' : n 'millisec' : n ...
7447f5ea45ab6fa1c6d10f97ac7d57add68fdf40
3,651,777
import logging def RunLinters(prefix, name, data, settings=None): """Run linters starting with |prefix| against |data|.""" ret = [] if settings is None: settings = ParseOptions([]) ret += settings.errors linters = [x for x in FindLinters(prefix) if x not in settings.skip] for linter in linters: ...
9b8c780fe3684405d17e59897bee11118dff5590
3,651,779
def element_norm_spatial_exoao(processes, comp_sol, test_time, test_var_list, exact_solution, subel_ints = 1, zfill=None, ...
323fe13213a5ae8ad980d760943bc5cf1fc46074
3,651,780
from typing import Iterator def generate_close_coordinates( draw: st.DrawFn, prev_coord: Coordinates[str, np.float64] ) -> Coordinates[str, np.float64]: """Create coordinates using Hypothesis.""" diff = [ draw(hynp.from_dtype(np.dtype(np.float64), min_value=0.1, max_value=1.0)), draw(hynp....
8b207d5989f59a30e0c99eebd4654b609a03be93
3,651,781
from typing import Union def redistribute_vertices( geom: Union[LineString, MultiLineString], distance: float ) -> Union[LineString, MultiLineString]: """Redistribute the vertices of input line strings Parameters ---------- geom : LineString or MultiLineString Input li...
1a5f0c3f409d5f3de46831bfa8456a734985d2b8
3,651,782
def get_boolean_value(value): """Get the boolean value of the ParameterValue.""" if value.type == ParameterType.PARAMETER_BOOL: return value.bool_value else: raise ValueError('Expected boolean value.')
fc5452a45983d16f30433ffe54b8883c24c1eb94
3,651,783
import torch def eval_bayesian_optimization(net: torch.nn.Module, input_picture: DATA,\ label_picture: DATA, ) -> float: """ Compute classification accuracy on provided dataset to find the optimzed hyperparamter settings. Args: net: trained neural network Input: The image ...
4833627f5239f7c713f11a1ab9f97e6898a303b1
3,651,784
import urllib def parse(url): """ URL-parsing function that checks that - port is an integer 0-65535 - host is a valid IDNA-encoded hostname with no null-bytes - path is valid ASCII Args: A URL (as bytes or as unicode) Returns: ...
d1af42d9ee5b9c786cae9a6a16da89a545d27e33
3,651,785
def is_amicable(num: int) -> bool: """ Returns whether the number is part of an amicable number pair """ friend = sum(divisors(num)) - num # Only those in pairs are amicable numbers. If the sum is the number itself, it's a perfect number return friend != num and sum(divisors(friend)) - friend == num
e5fc62d4f390a95f6d54d57979c4e39b9d4e4316
3,651,786
import html def no_data_info(): """Returns information about not having enough information yet to display""" return html.Div(children=[dcc.Markdown(''' # Please wait a little bit... The MongoDB database was probably just initialized and is currently empty. You will need to wait a bit (~30 min)...
59ce4a2a0e2b18298006746be31f30b8c2cb4a6a
3,651,787
def delta_t(soil_type): """ Displacement at Tu """ delta_ts = { "dense sand": 0.003, "loose sand": 0.005, "stiff clay": 0.008, "soft clay": 0.01, } return delta_ts.get(soil_type, ValueError("Unknown soil type."))
c542adb7c302bc1f50eb4c49bf9da70932758814
3,651,788
def extractPlate(imgOriginal, listOfMatchingChars, PlateWidthPaddingFactor, PlateHeightPaddingFactor): """ Extract license-plate in the provided image, based on given contours group that corresponds for matching characters """ # Sort characters from left to right based on x position: listOfMatchingChars.so...
f6d726727762b752003ae16c3cf9d286a0ebe990
3,651,789
def create_stratified_name(stem, stratification_name, stratum_name): """ generate a standardised stratified compartment name :param stem: str the previous stem to the compartment or parameter name that needs to be extended :param stratification_name: str the "stratification" or rational...
2677dec386dfd235e7fb5d088c5481987acf4beb
3,651,790
import inspect import typing def bind_args_kwargs(sig: inspect.Signature, *args: typing.Any, **kwargs: typing.Any) -> typing.List[BoundParameter]: """Bind *args and **kwargs to signature and get Bound Parameters. :param sig: source signature :type sig: inspect.Signature :param args: not keyworded arg...
3fc8b16449981e920998ff84839a71cbbfc26d28
3,651,791
def user(user_type): """ :return: instance of a User """ return user_type()
a8c8cd4ef57915c555864f6fc09dce63c2a1c6fb
3,651,792
def true_or_false(item): """This function is used to assist in getting appropriate values set with the PythonOption directive """ try: item = item.lower() except: pass if item in ['yes','true', '1', 1, True]: return True elif item in ['no', 'false', '0', 0, None, Fal...
3e7c0cee07f6796c6134b182572a7d5ff95cf42d
3,651,793
import time def time_ms(): """currently pypy only has Python 3.5.3, so we are missing Python 3.7's time.time_ns() with better precision see https://www.python.org/dev/peps/pep-0564/ the function here is a convenience; you shall use `time.time_ns() // 1e6` if using >=Python 3.7 """ return int(time...
1bff241db79007314d7a876ddd007af137ba7306
3,651,795
def _calculate_mk(tp, fp, tn, fn): """Calculate mk.""" ppv = np.where((tp + fp) > 0, tp / (tp + fp), np.array(float("nan"))) npv = np.where((tn + fn) > 0, tn / (tn + fn), np.array(float("nan"))) npv = tn / (tn + fn) numerator = ppv + npv - 1.0 denominator = 1.0 return numerator, denominator
d777db3abd9296b2a67e038396d29e8ef8529a74
3,651,796
def geometric_progression_for_stepsize( x, update, dist, decision_function, current_iteration ): """Geometric progression to search for stepsize. Keep decreasing stepsize by half until reaching the desired side of the boundary. """ epsilon = dist / np.sqrt(current_iteration) while True: ...
d5a043f434efa68e827ff89f6f469eab37a79383
3,651,797
def absorption_two_linear_known(freq_list, interaction_strength, decay_rate): """ The absorption is half the imaginary part of the susecptibility. """ return susceptibility_two_linear_known(freq_list, interaction_strength, decay_rate).imag/2.0
9d4819715150ce63753f4e356c406685852fc761
3,651,798
def post_to_conf(post_grid, cell_size): """ Converts a N-dimensional grid of posterior values into a grid of confidence levels. The posterior values do not need to be normalised, i.e. their distribution need not integrate to 1. Works with likelihood values (not log-likelihood) instead of posteriors, ass...
b4bcb8dddeceb7a4e1bb0914e503868e443ecb09
3,651,800
def get_fuzzer_display(testcase): """Return FuzzerDisplay tuple.""" if (testcase.overridden_fuzzer_name == testcase.fuzzer_name or not testcase.overridden_fuzzer_name): return FuzzerDisplay( engine=None, target=None, name=testcase.fuzzer_name, fully_qualified_name=testcase....
273e0a2f92a4e24606908586111f1bad17e50b4c
3,651,801
def process_articles_results(articles_list): """ Function that processes the articles result and transform them to a list of Objects Args: articles_list: A list of dictionaries that contain sources details Returns : articles_results: A list of source objects """ articles_...
7b4e540474757b2e0e9b93f66f5bee926992a782
3,651,802
def list_to_bytes_list(strList): """ This function turns an array of strings into a pointer array with pointers pointing to the encodings of those strings Possibly contained bytes are kept as they are. :param strList: List of strings that shall be converted :type strList: List of strings :r...
19bcc6751e4805adcbfde54656ff83ef52ef02b8
3,651,803
def handle_td(element, box, _get_image_from_uri): """Handle the ``colspan``, ``rowspan`` attributes.""" if isinstance(box, boxes.TableCellBox): # HTML 4.01 gives special meaning to colspan=0 # http://www.w3.org/TR/html401/struct/tables.html#adef-rowspan # but HTML 5 removed it # ...
d3a2669ffc8ccac27d3b40c4f693751239b9c135
3,651,804
import pipes def login_flags(db, host, port, user, db_prefix=True): """ returns a list of connection argument strings each prefixed with a space and quoted where necessary to later be combined in a single shell string with `"".join(rv)` db_prefix determines if "--dbname" is prefixed to the db arg...
2c844def8e6f1154a9962d43c858b39b9a7adf2a
3,651,805
def glplot(ncfile, times, colora, label): """ add a plot of grounding line points to current axes. makes use of the numpy.ma.MaskedArray when reading xGL,yGL """ try: ncid = Dataset(ncfile, 'r') except: print("Failed to open file: {}. Skipping.".format(ncfile)) return 350.0,...
149836ceb0f6b65ba792bffcbdafad6fe8702f62
3,651,806
def roi_intersect(a, b): """ Compute intersection of two ROIs. .. rubric:: Examples .. code-block:: s_[1:30], s_[20:40] => s_[20:30] s_[1:10], s_[20:40] => s_[10:10] # works for N dimensions s_[1:10, 11:21], s_[8:12, 10:30] => s_[8:10, 11:21] """ def slice_inter...
d1070c8ec0c493296dfee6bdc54b7430e703bda8
3,651,807
def _flows_finished(pgen_grammar, stack): """ if, while, for and try might not be finished, because another part might still be parsed. """ for stack_node in stack: if stack_node.nonterminal in ('if_stmt', 'while_stmt', 'for_stmt', 'try_stmt'): return False return True
dd0fe435d1328b3ae83ba2507006b6825ca23087
3,651,808
def PositionToPercentile(position, field_size): """Converts from position in the field to percentile. position: int field_size: int """ beat = field_size - position + 1 percentile = 100.0 * beat / field_size return percentile
c75869f3d7f8437f28d3463fcf12b2b446fe930a
3,651,809
def grid(num, ndim, large=False): """Build a uniform grid with num points along each of ndim axes.""" if not large: _check_not_too_large(np.power(num, ndim) * ndim) x = np.linspace(0, 1, num, dtype='float64') w = 1 / (num - 1) points = np.stack( np.meshgrid(*[x for _ in range(ndim)], indexing='ij'),...
51a3ef70da4581a774d76839d05a14042e7bf78c
3,651,810
def rolling_outlier_quantile(x, width, q, m): """Detect outliers by multiples of a quantile in a window. Outliers are the array elements outside `m` times the `q`'th quantile of deviations from the smoothed trend line, as calculated from the trend line residuals. (For example, take the magnitude of the...
3c28fa245c8dfce03958dee33c47828eb38ac979
3,651,811
def compute_region_classification_len(dataset_output, dataset_type: str): """ Compute the number of points per class and return a dictionary (dataset_type specifies the keys) with the results """ stable_region_indices, marginal_stable_region_indices, marginal_regio...
ba78d7d000b97cfcefa2acac263612ebd4aff377
3,651,812
def set_world_properties(world_uid, world_name=None, owner=None, config=None): """ Set the properties of the given world """ return runtime.set_world_properties(world_uid, world_name, owner, config)
4c063554390c0fb33ec74394a5a7cc967d55211d
3,651,813
def _resize_and_pad(img, desired_size): """ Resize an image to the desired width and height :param img: :param desired_size: :return: """ old_size = img.shape[:2] # old_size is in (height, width) format ratio = float(desired_size) / max(old_size) new_size = tuple([int(x * ratio) fo...
1053748c0a303e3b5b3712623a089e42ba822301
3,651,814
from cntk.ops.cntk2 import Dropout def dropout(x, name=None): """ Compute a new tensor with `dropoutRate` perecent set to zero. The values that are set to zero are randomly chosen. This is commonly used to prevent overfitting during the training process. The output tensor has the same shape as ...
ae688aa478842ba451b92de2bc0503e42f1a9363
3,651,816
def mol2graph(crystal_batch: CrystalDataset, args: Namespace) -> BatchMolGraph: """ Converts a list of SMILES strings to a BatchMolGraph containing the batch of molecular graphs. :param crystal_batch: a list of CrystalDataset :param args: Arguments. :return: A BatchMolGraph containing the combined ...
604351ad5ae6c1ccfa6ce01a1e7b03c5e80ff2a4
3,651,817
import ast def _compile(s: str): """compiles string into AST. :param s: string to be compiled into AST. :type s: str """ return compile( source = s, filename = '<unknown>', mode = 'eval', flags = ast.PyCF_ONLY_AST, )
4709cfa84ab6e5d7210924cf3aa206a1d297b7bd
3,651,818
def temp_get_users_with_permission_form(self): """Used to test that swapping the Form method works""" # Search string: ABC return ()
72390791304d62fc5d78720aac4e2807e918587c
3,651,819
def permute_images(images, permutation_index): """ Permute pixels in all images. :param images: numpy array of images :param permutation_index: index of the permutation (#permutations = #tasks - 1) :return: numpy array of permuted images (of the same size) """ # seed = np.random.randint(low...
5742c9c2bce5012b0c17b60eb5e66328b91e53b4
3,651,821
def new_user(request, id): """ Page for creating users after registering a person. person must be either volunteer, NGO employee or Government """ msg = '' password = '' try: person_id = int(id) # Get Name user = RegPerson.objects.get(pk=person_id) personfna...
26ff9e3fa289915218a6f60e138a3491955c0228
3,651,822
def multi_conv(func=None, options=None): """A function decorator for generating multi-convolution operations. Multi-convolutions allow for a set of data-independent convolutions to be executed in parallel. Executing convolutions in parallel can lead to an increase in the data throughput. The ``multi_conv`` f...
d1c9a69fbcec7b374142bc7568fc89ba8dddb0b9
3,651,823
def hi_joseangel(): """ Hi Jose Angel Function """ return "hi joseangel!"
5889a51977d3ec2269040a9a7e7968801209ff25
3,651,824
import time def received_date_date(soup): """ Find the received date received_date_date in human readable form """ received_date = get_history_date(soup, date_type = "received") date_string = None try: date_string = time.strftime("%B %d, %Y", received_date) except(TypeError): # Date did not convert pass ...
3963d846a64e06ed0d2e60b7ecba26efcd4d9e6e
3,651,825
def is_on(hass, entity_id): """ Returns if the group state is in its ON-state. """ state = hass.states.get(entity_id) if state: group_type = _get_group_type(state.state) # If we found a group_type, compare to ON-state return group_type and state.state == _GROUP_TYPES[group_type][0]...
8e77a7a3f4a09d68d92d58105b3d5a36c830cd0c
3,651,826
def pytest_report_header(config, startdir): """return a string to be displayed as header info for terminal reporting.""" capabilities = config.getoption('capabilities') if capabilities: return 'capabilities: {0}'.format(capabilities)
4e6ada67f5f08c1db8f5b6206089db4e3ee84f46
3,651,827
def chessboard_distance(x_a, y_a, x_b, y_b): """ Compute the rectilinear distance between point (x_a,y_a) and (x_b, y_b) """ return max(abs(x_b-x_a),abs(y_b-y_a))
9b11bf328faf3b231df23585914f20c2efd02bf9
3,651,828
from pgmpy.factors import TabularCPD from pgmpy.models import BayesianModel import pandas as pd from pgmpy.inference import VariableElimination # NOQA from pgmpy.factors import TabularCPD import pgmpy import plottool as pt import networkx as netx def bayesnet(): """ References: https://class.coursera...
05853fb3a7e84a1864399588af4b27390a1c8d31
3,651,829
def sigma_R(sim, Pk=None, z=None, non_lin=False): """ return amplitude of density fluctuations if given Pk -- C++ class Extrap_Pk or Extrap_Pk_Nl -- computes its sigma_R. if given redshift, computes linear or non-linear (emulator) amplitude of density fluctuations """ sigma = fs.Data_Vec_2() if Pk:...
956a4ca092ce56c1d8120c3b9047280306005326
3,651,830
def session_ended_request_handler(handler_input): """Handler for Session End.""" # type: (HandlerInput) -> Response logger.info("Entering AMAZON.SessionEndedRequest") save_data(handler_input) return handler_input.response_builder.response
a3bd1c38699a69da0cdce0203ee0549e9132b1c1
3,651,831
import unittest def _getTestSuite(testFiles): """ Loads unit tests recursively from beneath the current directory. Inputs: testFiles - If non-empty, a list of unit tests to selectively run. Outputs: A unittest.TestSuite object containing the unit tests to run. """ loader = unittest.TestLoad...
786baa4d70161e1ae6c60160460f379c66ea465c
3,651,832
def stratifiedsmooth2stratifiedwavy_c(rho_gas, rho_liq, vel_gas, d_m, beta, mu_liq, mu_gas): """ function for construction of boundary transition from stratified-smooth to stratified-wavy structure resulting from the "wind" effect :param rho_gas: gas density :param rho_liq: liquid density :para...
a80c1b5f400d4db36979960a26f5b914047abe8d
3,651,833
def box( data_frame=None, x=None, y=None, color=None, facet_row=None, facet_row_weights=None, facet_col=None, facet_col_weights=None, facet_col_wrap=0, facet_row_spacing=None, facet_col_spacing=None, hover_name=None, hover_data=None, custom_data=None, animatio...
2e5a22fd4fa875b4cb506c7d21ff91e56908ed65
3,651,834
def _infer_main_columns(df, index_level='Column Name', numeric_dtypes=_numeric_dtypes): """ All numeric columns up-until the first non-numeric column are considered main columns. :param df: The pd.DataFrame :param index_level: Name of the index level of the column names. Default 'Column Name' :param...
3eae67b765ca7a1a048047e12511c1a9721f9fea
3,651,835
def index(): """ 显示首页 :return: """ return render_template('index.html')
8965ff54f131a0250f1a05183ceb79d6d677883c
3,651,836
def two_phase(model, config): """Two-phase simulation workflow.""" wea_path, datetime_stamps = get_wea(config) smx = gen_smx(wea_path, config.smx_basis, config.mtxdir) pdsmx = prep_2phase_pt(model, config) vdsmx = prep_2phase_vu(model, config) if not config.no_multiply: calc_2phase_pt(mo...
0f2eb619dcfea233446e90565bc1310ee1a3bc3f
3,651,837
def str_with_tab(indent: int, text: str, uppercase: bool = True) -> str: """Create a string with ``indent`` spaces followed by ``text``.""" if uppercase: text = text.upper() return " " * indent + text
3306ba86781d272a19b0e02ff8d06da0976d7282
3,651,838
def delete(card, files=None): """Delete individual notefiles and their contents. Args: card (Notecard): The current Notecard object. files (array): A list of Notefiles to delete. Returns: string: The result of the Notecard request. """ req = {"req": "file.delete"} if fi...
2acfa67b7531244e44a183286a9d87b9ac849c83
3,651,839
def test_timed_info(): """Test timed_info decorator""" @timed_info def target(): return "hello world" result = target() assert result == "hello world"
4deb25b542bcc1a3ad2fc5859c2c3f243060b6d9
3,651,840
from typing import Set def get_doc_word_token_set(doc: Doc, use_lemma=False) -> Set[Token]: """Return the set of tokens in a document (no repetition).""" return set([token.lemma_ if use_lemma else token.text for token in get_word_tokens(doc)])
56e1d8bfcad363049b4dd455e728d5c4dd3754f5
3,651,841
from typing import List def finding_the_percentage(n: int, arr: List[str], query_name: str) -> str: """ >>> finding_the_percentage(3, ['Krishna 67 68 69', 'Arjun 70 98 63', ... 'Malika 52 56 60'], 'Malika') '56.00' >>> finding_the_percentage(2, ['Harsh 25 26.5 28', 'Anurag 26 28 30'], ... 'Har...
86c2ad777c667f9ba424bc2b707f46465a10accc
3,651,842
def mvg_logpdf_fixedcov(x, mean, inv_cov): """ Log-pdf of the multivariate Gaussian distribution where the determinant and inverse of the covariance matrix are precomputed and fixed. Note that this neglects the additive constant: -0.5 * (len(x) * log(2 * pi) + log_det_cov), because it is irrelevant ...
648d1925ed4b4793e8e1ce1cec8c7ccd0efb9f6b
3,651,843
def make_frac_grid(frac_spacing, numrows=50, numcols=50, model_grid=None, seed=0): """Create a grid that contains a network of random fractures. Creates and returns a grid containing a network of random fractures, which are represented as 1's embedded in a grid of 0's. Parameters ...
2e1ffc1bab30726dcbbe1b022c6cf92920c2dcc2
3,651,845
import colorsys def generate_colors(): """ Generate random colors. To get visually distinct colors, generate them in HSV space then convert to RGB. """ N = 30 brightness = 0.7 hsv = [(i / N, 1, brightness) for i in range(N)] colors = list(map(lambda c: colorsys.hsv_to_rgb(*c), hsv)) perm = [15, 13...
ee8951d66972190e6d1dcd5dc5c211d5631f6841
3,651,846
def secant_method(f, x0, x1, iterations): """Return the root calculated using the secant method.""" for i in range(iterations): f_x1 = f(x1) x2 = x1 - f_x1 * (x1 - x0) / (f_x1 - f(x0) + 1e-9).float() x0, x1 = x1, x2 return x2
081522ae8e68ad14cb67f8afc03989c46f3999d5
3,651,847