content
stringlengths
35
762k
sha1
stringlengths
40
40
id
int64
0
3.66M
def get_orders_history_currency(currency='BTC'): """ Shows all orders with transactions in chosen currency and with information about them :param currency: currency name :return: dict with keys 'orders' and 'pages_count' (because pagination is used) """ result = pay.get_orders_history(currency=c...
cb5ebf75ca0e0384ccd645331118a992150c3bde
3,606,400
def infected_symptomatic_recovery_rate(): """ Real Name: b'infected symptomatic recovery rate' Original Eqn: b'infected symptomatic recovery rate 80 +infected symptomatic recovery rate 70 +infected symptomatic recovery rate 60 +infected symptomatic recovery rate 50 +infected symptomatic recovery rate 40 +in...
bdbc577e2a118ff5d2dcb8e443035200a3192497
3,606,401
def make_usage(template, command_map, alias_map): """Generate the usage doc based on configured commands and aliases""" def format_command_info(command_name): func = command_map[command_name] # Some commands (but not all) have aliases aliases = [k for k in alias_map.keys() if alias_map...
2cee786c095a897dc583fedff17aeef974ba8d5b
3,606,402
def get_facebook_app_data(): """ :return: a command that returns the Facebook App Data from db """ return GetFacebookApp()
64d7db60964e96570b11cc08153292a339c6b1fb
3,606,403
def vertical_line(x=0, y=0): """Infinite iterator of pt representing a vertical line.""" return _coconut_tail_call(_coconut.itertools.chain.from_iterable, (_coconut_func() for _coconut_func in (lambda: (pt(x, y),), lambda: vertical_line(x, y + 1))))
2f2a9e6862a79e17b668f6553dbcb47060e3350d
3,606,404
import numpy def logdet(x): """ computes log(det(x)) """ if isinstance(x, numpy.ndarray) or numpy.isscalar(x): return numpy.linalg.slogdet(x)[1] elif isinstance(x, UTPM) or isinstance(x, Function): return x.__class__.logdet(x) else: raise ValueError('don\'t know what ...
4aa2711d4d979a89567cf19a42b343b4ab91b0f8
3,606,405
import re def county_permits(permits, out=True): """Processes County building permits in the Odyssey-system format.""" # Only accept XLSX files if not permits.lower().endswith(".xlsx"): raise IOError("Input must be manually cleaned and converted to XLSX") # Get year from filename year = re...
d25613dd52fcf0bdd377b403cd3a2faee6663106
3,606,406
from datetime import datetime def timedelta_two_units(delta): """Render a timedelta in English, to two units (seconds, minutes, hours, days). """ if delta <= datetime.timedelta(seconds=0): return 'just now' total_seconds = int(delta.total_seconds()) if delta.days: days = ...
f6035dfc84ae837511899c222c7c9de0b492bf60
3,606,407
def plot_sample_fit(model_fit, param_samples, fit_kws=None, data_kws=None, sample_kws=None): """Plot of sampled curve fits. The function will plot the main model fit and the sampled curve fits based on a table of sample parameters. Parameters ---------- model_fit : lmfit.ModelResult the result of a model fitt...
b56223db7b1e0ccddf6cff1fac47b93c83c1fbd3
3,606,408
def simple_without_split(): """simple multiple linear regression without splitting data""" # ******* generate & prepare data ******* df = generate_data(10000) input_columns = ['a', 'b', 'c', 'd', 'e'] X = df[input_columns] Y = df['out'] # ******* create model ******* regr = linear_m...
0dc644ea0ed32b345b3b08b66aba9d9c3abdb469
3,606,409
import commands def getFileListFromDAS(query): """ Return the result of running das_client.py --limit=0 --query='query'. The output is returned as a list splitted by newline. """ files = commands.getoutput("das_client.py --limit=0 --query='%s'" % query).split('\n') return files
ef3579b93356039dca4503964192e6dca8f86ae3
3,606,410
def import_js(module_name, skip=None): """ :param module_name: :return: """ if skip is None: skip = [] if module_name in skip: return [] imported_js = [] if module_name in js_module_cache: js = js_module_cache[module_name][1] for dep in js_module_cache...
bb1c2e2dd39df54f502acd945ba01e109f96a80a
3,606,411
def create_integrand_vectors(player_count, q, w): """ Creating the vector of standard deviations and integrand limits. :param player_count (int): Number of players in the game. :param q (float): Quota to win the game. :param w (float): Weight of the player in the game. :return a_s: Vector of lo...
2b912422cdb6a4105a6b454b54eebc9bf51d0f15
3,606,412
def scalar_leaf_only(operator): """Ensure the filter function is only applied to scalar leaf types.""" def decorator(f): """Decorate the supplied function with the "scalar_leaf_only" logic.""" @wraps(f) def wrapper(filter_operation_info, context, parameters, *args, **kwargs): ...
b515a37dd3d5b31ed35b1dc323270b562b23e0ae
3,606,413
def from_json( source, nan_string=None, infinity_string=None, minus_infinity_string=None, complex_record_fields=None, highlevel=True, behavior=None, ): """ Args: source (str): JSON-formatted string to convert into an array. The string must comply with 'ndjson' spe...
ddd365698ccaa256636404499b30fad1f8a91c2e
3,606,414
import threading def setInterval(interval): """ Decorator generator. Calls the decorated methods every `interval` seconds. Args: interval (int): Period Returns: (function) Decorated Function. """ def decorator(function): """ Helper method. """ ...
c6bbced84a081fad88056bce5ec1f9f762336cbb
3,606,415
def object_path_to_string(node_path_arr): """Converts a list of nodes to a string.""" return "/".join( (escape_local_name(trackable.name) for trackable in node_path_arr))
8e029a640da96ccd0dcd3291ba62a835d6ca78b6
3,606,416
from typing import Dict from typing import Optional from datetime import datetime def fetch_incidents(client: Client, fetch_time: str, fetch_shaping: str, last_run: Dict, fetch_limit: str, fetch_queue_id: Optional[list] = None, fetch_filter: Optional[str] = None) -> list: """ This function...
d7cc30797e5a67d69ac6ddd9b18389af0007f831
3,606,417
def import_module(module_name_string): """ TODO: 6 COMMENT """ module = __import__(module_name_string) components = module_name_string.split('.') for comp in components[1:]: module = getattr(module, comp) return module
f0e7e783af192704721578a6042891309df95420
3,606,418
import os import gzip import pickle def load_annotations_class(annotations_path): """Load full annotations into the DALI class object Args: annotations_path (str): path to a DALI annotation file Returns: DALI.annotations: DALI annotations object """ if not os.path.exists(annotat...
cede8cf305d6b512dbf44d8d999362d04b9be6cc
3,606,419
from re import A def bessel_k1e_compute(input_x, output_y, kernel_name="bessel_k1e"): """bessel_k1e_compute""" shape = input_x.shape dtype = input_x.dtype has_improve_precision = False if dtype != "float32": input_x = dsl.cast_to(input_x, "float32") dtype = "float32" has_i...
306cae85aaed4fc679db13fb69d099aa80f5eb30
3,606,420
from scipydirect import minimize def acq_max_scipydirect(ac,gp,bounds): """ A function to find the maximum of the acquisition function using the 'DIRECT' library. Input Parameters ---------- ac: The acquisition function object that return its point-wise value. gp: A gaussian process fitte...
dca6af9e9ba09ef94da424900fad68868b81a3c7
3,606,421
import requests import re def get_google_results(api_id, address, return_response_fields=None): """ Get google results from Google Maps Geocoding API / Google Maps Places API / Google Maps Place details API :param: address: String address. Complete Address example "18 Starbucks Alexanderplatz, Berlin, Ge...
c338f6bc12c50b339ef6512f9bf0bcf287dc0a6f
3,606,422
def apply_norm(x, epsilon=1e-6): """Applies layer normalization to x. Based on "Layer Normalization": https://arxiv.org/abs/1607.06450 Args: x: <float>[..., input_size] epsilon: Used to avoid division by 0. Returns: <float>[..., input_size] """ input_size = x.get_shape()[-1] with tf...
c53180647b55fa6fb091a1bdd973109c9ec2937c
3,606,423
def bbreg(boundingbox,reg): """Calibrate bounding boxes""" if reg.shape[1]==1: reg = np.reshape(reg, (reg.shape[2], reg.shape[3])) w = boundingbox[:,2]-boundingbox[:,0]+1 h = boundingbox[:,3]-boundingbox[:,1]+1 b1 = boundingbox[:,0]+reg[:,0]*w b2 = boundingbox[:,1]+reg[:,1]*h b3 = b...
a4dc6a21b68a33626560c1b4588beb6ab5b1e4fa
3,606,424
import locale def to_str(value, encoding=None): """ Returns the value as an 8-bit string. Tries encoding as UTF-8 if locale encoding fails. """ result = value if isinstance(value, unicode): encoding = encoding or locale.getpreferredencoding() try: result = value.encode(encodin...
f51ea822f31ed59edbe8edba247adf3017add163
3,606,425
from sklearn.cluster import MeanShift def cluster_bounds_within_each_slice(bounds_raw, direct, opt): """ add by zzhou reduce the number of patches within slices, especially useful for multi-nodule """ new_bounds_raw = [] # prepare data bound2ds_dict = {} patch_dict = {} for i ...
6b0d3e614298cce7c223b2c35bf0be4e82c846e2
3,606,426
def _rebuild_path_parameter(parameter_type, parameter_name): """ Rebuilds a typed path part from it's type identifier and from it's name. Parameters ---------- parameter_type : `int` Parameter type identifier. parameter_name : `str` The parameter's name. Returns -------...
fa8281a19b3aa43f4b74fa85133e677ea9c3f3fa
3,606,427
from typing import Mapping def sa_model_info(Model: type, *, types: AttributeType, exclude: FilterT = (), ) -> Mapping[str, AttributeInfo]: """ Extract information on every attribute of an SqlAlchemy model Note: it's really cheap to use this function beca...
4d76a9a24e024fa2f2ba8d509e274122cf84ad25
3,606,428
def Consonant(text = ''): """ A function which return a set of consonants and the total number of each consonant in the text. """ string_B = '' string_C = '' for arg in lower(text): if not Vowel_or_Consonant(str(arg)) and str(arg) in 'bcdfghjklmnpqrstvwxz': string_B...
62b54d4582837b6bb3860604e68c6f67c7a994fe
3,606,429
def save_group(batch_dir, group): """ make group directory and save group info. """ group_name = group["group_name"] group_dir = batch_dir / group_name group_dir.mkdir() # save group information info_file = group_dir / "group_info.txt" with open(info_file, "w") as info_f: in...
aabf6e1a4e4ee08df4cfab490982f4eafa694b7e
3,606,430
async def create_pipeline(request): """Create pipeline.""" pipeline = Pipeline.parse_data(request.json) if not pipeline.outputs: return response.json({ "status":"error", "description": "No outputs specified" }, status=400) for output in pipeline.output...
448546c4df414ffb78a0741cc9aeb30b425c73f9
3,606,431
def update_actor(actorId: str, tapis_token: str) -> int: """ Updates an actor to the latest version of its respective image. Args: actorId: The Abaco ID of the actor you want to update. tapisToken: The auth token that Tapis needs to access the actor and make a new one. Returns: ...
c96e9b2c6efa83d1fcf5684ec6f40614b3d76ab7
3,606,432
def get_environment_obj(name, *args, **kwargs): """Instantiate a pycolab environment by name. Args: name: Name of the pycolab environment. *args: Arguments for the environment class constructor. **kwargs: Keyword arguments for the environment class constructor. Returns: A new environment class i...
24c8b41c97f114b6defa3c03024848fb089df106
3,606,433
def log2(instructions): """Integer only algorithm to calculate the number of bits needed to store a number""" bits = 1 power = 2 while power < instructions: bits += 1 power *= 2 return bits
8933e1c5d2cf6811cd15351f76658a7ed2be707f
3,606,434
def codepipeline_approval(message): """Uses Slack's Block Kit.""" console_link = message['consoleLink'] approval = message['approval'] pipeline_name = approval['pipelineName'] action_name = approval['actionName'] approval_review_link = approval['approvalReviewLink'] expires = approval['expir...
3d3aaa51b916d77d67c6c071c3e9403df691c1d9
3,606,435
def partition_combinations(n, k): """ Generates combinations of k distinct objects, such that there are i total objects, for i from 0 - n This is related to the permutations of the partition of an integer i, but with explicit 0's added for the unrepresented k's Args: n: int. last integ...
befda3bc2de2a3488f9ea4648cccf3efc0390ca8
3,606,436
def generate_relative_positions_matrix(length, max_relative_position): """ From tensor2tensor: https://github.com/tensorflow/tensor2tensor Generates matrix of relative positions between inputs. [length, length] positional info matrix. """ range_vec = tf.range(length) range_mat = tf.reshape(tf.tile(range...
526f9a1c0c5a8431b2e4deb7352a32932904f0ab
3,606,437
def fetch_intron(start, cigar): """ To retrieve the 'N' cigar :param start: :param cigar: :return: """ intronbound = [] for c, l in cigar: if c == 3: intronbound.append((start + 1, start + l)) start += l elif c == 1: continue ...
f52f383077d8e4ef99721279405c2cd47cb94e2b
3,606,438
def get_F_field(model, dims, save_path): """ Run inference on the model to get the force field (array on the spatial grid) """ row_sec_size = 10 grid = np.zeros((dims, dims, 2)) xg, yg = get_meshgrid(model.xlims, model.ylims, dims, False) for row_sector in range(dims // row_sec_size): ...
506030cbfecc97b1b508a47c2718786467e1e8b3
3,606,439
def _formatted_hour_min(seconds): """Turns |seconds| seconds into %H:%m format. We don't use to_datetime() or to_timedelta(), because we want to show hours larger than 23, e.g.: 24h:00m. """ time_string = '' hours = int(seconds / 60 / 60) minutes = int(seconds / 60) % 60 if hours: ...
87fb84b5b8f190102309facfb1e33cffa24bcdbf
3,606,440
def get_sample_ids_with_cancer_subtypes(path: str, subtype_column: str = 'subtype_BRCA_Subtype_PAM50'): """Get sample IDs where BRCA subtypes are reported according to PAM50 classification.""" df = pd.read_csv(path, sep='\t') df.drop("barcode", axis=1, inplace=True) # TODO: remove barcode column upon creat...
1a74349e709565d8b47d65f45f1a4892b7155181
3,606,441
def get_article_metadata(page: pywikibot.page.BasePage) -> Article: """Returns article creator and content assesment class as a NamedTuple""" return Article( title=page.title(), quality=get_article_quality(page), author=page.oldest_revision.user, )
10c811a790755811514820d0b6cb7ee219e565b6
3,606,442
def parse( dateString, formatString="yyyy-MM-dd HH:mm:ss", locale=Locale.ENGLISH ): """Attempts to parse a string and create a Date. Causes ParseException if the date dateString parameter is in an unrecognized format. Args: dateString (str): The string to parse into a date. formatSt...
513deca5cdf0dac94e329a2f1bbb67e1a5157ed8
3,606,443
import requests def get_elasticubes(extract=True, live=True): """ Returns every standard elasticube the user has access to if called as simply get_elasticubes(). If extract is set to False, returns only live models. If live is set to False, returns only extract models. """ token = get_auth() ...
c579b29e27323f64cc63339d3b0cbfd641fc86cc
3,606,444
def get_bbox_span_subset(spans, bbox, threshold=0.5): """ Reduce the set of spans to those that fall within a bounding box. threshold: the fraction of the span that must overlap with the bbox. """ span_subset = [] for span in spans: if overlaps(span['bbox'], bbox, threshold): ...
6a95f542ff0b70e3add9c3113e0f20069eeefc4f
3,606,445
import re import string def replace_refs(strings): """Replaces [1] or [2] or any bracket[digit] combinations for either a list or strings or single string.""" results = [] if isinstance(strings, list): for i in range(len(strings)): strings[i] = re.sub("\[\d\]", "", strings[i]) ...
8033b757ccf0fe8477fe45016e284674ebfe50f6
3,606,446
def wrap_whois(cache, whois_func): """ Wrap a WHOIS query function with a cache. """ if cache is None: return whois_func def wrapped(query): response = cache.get(query) if response is None: response = whois_func(query) cache.set(query, response) ...
4658b3c89567a28dff33a0455de824b22feb1abc
3,606,447
import json def build_new_relic_insights_payload(event_type, event_body): """ Build New Relic Insights event of the specified event type. Args: event_type (str): eventType value to use for constructed event payload. event_body (dict): Native Dictionary representation of event attributes. ...
cf4ab4ef21ebfd9083bf16dcdee1738cea315766
3,606,448
def get_by_name(dm_name): """ Get detailed information about DeviceModel by dm_name. Response: { 'state': 'ok', 'data': { 'dm_id': 42, 'dm_name': 'FooModel', 'df_list': [...] 'dm_type': 'other', }, ...
7f0ca5c01c64f0b2302270a9da5eada18d65301a
3,606,449
def Servo(port="SERVO1", gpg=None, use_mutex=False): """ Use :py:class:`easysensors.Servo` instead """ if not isinstance(gpg, gopigo3.GoPiGo3): raise TypeError("Use a GoPiGo3 object for the gpg parameter.") return old_instantiation(gpg.init_servo, "servo", port, gpg, use_mutex)
6e687cae7f4ed78c3ba1a5e34de07acdd36a8d8d
3,606,450
def dt2ts(dt): """Converts a datetime object to timestamp Important note: naive datetime are supported and are considered UTC. Usage ===== >>> from sact.epoch import dt2ts >>> from sact.epoch import tt2ts, TzLocal, UTC >>> import datetime >>> epoch = datetime.date...
7d75f6ce2044a0b167cd840bfa4ddbdaef273b84
3,606,451
from typing import OrderedDict import sys from sys import version def get_info_version(): """Get detailed info about Gammapy version.""" info = OrderedDict() try: path = sys.modules['gammapy'].__path__[0] except: path = 'unknown' info['path'] = path info['version'] = version.ve...
a9bbe866ba8fbb3f0c57bfdddc35d772c8833846
3,606,452
def extractSbtResponseXML(itemResult, headerDict): """Given a XML node "itemResult", return a list of responses :param itemResult: a xml.etree node that is itemResult :param headerDict: a dictionary with student-level information such as teh BookletNumber, etc. :return a list of dicts or None """ ...
ccc414522fad5d4894573254747759287a6a9442
3,606,453
def get_folder_filtered_items(item_container, alpha_mode=False, app_types=[]): """ liefert die Liste der entsprechenden item_container zurueck """ myQ = None for app_name in app_types: if myQ == None: myQ = Q(item__app__name=app_name) else: myQ = myQ | Q(item__app__name=app_name) items = Dms...
f2aa4d132902bd1ddc1cb57ac7c9d3fa5feccf1e
3,606,454
from io import StringIO import csv import os def export_csv(jsp: Jasper, data: list, filename: str) -> None: """ Store data in CSV format on Meteostat Bulk """ # Print to console and abort if in dev mode if jsp.dev_mode: print(data) return None # Create a file file = Bytes...
d6458fb96d65b4fdb76c5206a67c7ecfac431475
3,606,455
import eliqonline async def async_setup_platform(hass, config, async_add_entities, discovery_info=None): """Set up the ELIQ Online sensor.""" access_token = config.get(CONF_ACCESS_TOKEN) name = config.get(CONF_NAME, DEFAULT_NAME) channel_id = config.get(CONF_CHANNEL_ID)...
e4e96d0038fb384ddbd5b7b48dceeeab2cf18db3
3,606,456
def is_valid_uuid(uuid_to_test: str, version: int = 4) -> bool: """ Check if uuid_to_test is a valid UUID. Parameters ---------- uuid_to_test : str version : {1, 2, 3, 4} Returns ------- `True` if uuid_to_test is a valid UUID, otherwise `False`. Examples -------- >>> i...
d975d79ea1d1e175f8d6bfceaaadd007fdc514e3
3,606,457
from typing import Counter def number_of_pairs(gloves): """ Given an array describing the color of each glove, return the number of pairs you can constitute, assuming that only gloves of the same color can form pairs. Examples: input = ["red", "green", "red", "blue", "blue"] result = 2 (1 ...
e499f0e924b0154684ad2ecda51d7ed0ed63d183
3,606,458
def anglicize100to999(n): """ Returns the English equiv of n. Parameter: the integer to anglicize Precondition: n in 100..999 """ # Anglicize the first three digits hundreds = n % 100 suffix = '' if hundreds > 0 and hundreds < 20: suffix = ' '+anglicize1to19(hundreds) ...
1dcd50747c9fa2758a54a9ae54bdd2efbaa7dc83
3,606,459
def Rmax_Q11(Vmax): """ Estimation of the radius of maximum wind according to the formula proposed by Quiring et al. (2011); Vmax and Rmax are in nautical miles. Expression herein converted in km""" Vm= Vmax * 0.5399568 Rmax = ((49.67 - 0.24 * Vm)) * 1.852 return Rmax
e320acfd64abc9e7ae30ca70979cf057239bae09
3,606,460
import os def evaluateFile(filename, testInputs, testOutputs, normalize = False, normInput = False, denormOutput = False): """ Load network and evaluate testInputs with and without Marabou Args: filename (str): name of network file without path """ # Load network relative to this ...
7f943d64a3dce6e4f3f7fc8c12d924fe80fded2e
3,606,461
import warnings import os import glob def update_header(arr_imgs,obj,filter_i): """ This function takes images per object per filter and checks for CCDGAIN and EXPTIME keywords in the first 2 headers of the fits file. If it finds the keywords it writes them to both headers if it is missing in e...
9219c18cb2e17803c3b28bf1b972b4ecf3284e20
3,606,462
def get_option_value(elem): """ Get the value attribute, or if it doesn't exist the text content. <option value="foo">bar</option> => "foo" <option>bar</option> => "bar" :param elem: a soup element """ value = elem.get("value") if value is None: value = elem.text....
b2a549d8b5ec3c895ff2b3c2978437a25afe99b1
3,606,463
def scatter_scale(target, max_size=50.0): """Return a scaled list of sizes.""" result = target.apply(lambda x:max_size*(1-x)) return result
0ea6b68b4f8e3f579b98becf3e12b1bec7de95e2
3,606,464
import copy import random def buildData_prediction_nomissing(collection, training=0.7,minlen=10,class_=None): """ Builds the training and out-of-sample sets for the score-prediction task (Section 2.4.3). Parameters ---------- collection : data is located. training : float, optio...
195c23ab86cd1f2b76a970d462e7a76a52ed9718
3,606,465
import smtplib def send_email(email_addr='', email_template=Email, payload_plain=None, payload_html=None, subject=None): """ Encrypts a payload using itsDangerous.TimeSerializer, adding it along with a base URL to an email template. Sends an email with this data using the current app's 'mail' extensio...
fa3c2c206b12b7d9eeb75ae709ae1e00840cf3af
3,606,466
def clearDiskCache(): """ clearDiskCache() -> None Clear the disk cache of all files. """ return None
4f1ad8928b637505d96172a002507a8a658e363f
3,606,467
def bin_by_list(df, column_to_bin, bins, round_to_decimal=0): """ Creates a new column "bin" of which maps column_to_bin to the specified values in bins [type: list, ndarray, tupe]. Note, that this does not change the original dataframe in any way. It only adds a new column to enable grouping. """ ...
d9c5b1221d2655c08602f5b4f72f76bd8215ed04
3,606,468
def value_overlays_from_parsing(dataset, parse_rule): """Return value TransformOverlays instance from parse rule.""" overlays = TransformOverlays() parsed = [] items = _get_sorted_items(dataset) # Parse metadata from relpaths that match the glob rule. for relpath, identifier in items: ...
4db13db72306201593235edb42bcc812a666e273
3,606,469
def chao1_var_no_singletons(n, observed): """Calculates chao1 variance in absence of singletons. n = # individuals. From EstimateS manual, equation 8. """ o = float(observed) return o*exp(-n/o)*(1-exp(-n/o))
ddc26c86415dafcd5a1f2cf17b19d59b72369ad1
3,606,470
import weakref def shared_client(ClientType, *args, **kwargs): """Return a shared kubernetes client instance based on the provided arguments. A weak reference to the instance is cached, so that concurrent calls to shared_client will all return the same instance until all references to the cli...
ad87a485b674f993d93753864f8de36d761da8c6
3,606,471
def color_distortion(image, strength=1.0, jitter_prob=0.8, drop_prob=0.2, seed=None): """Color distortion (jitter + drop) augmentation as defined in SimCLR paper""" if tf_chance(seed) <= jitter_prob: image = color_jitter(image, strength, seed) if tf_chance(seed) <= drop_prob: image = color_...
3d93c44558cfdc72b3b37b9542401369a606469d
3,606,472
def random_fact(): """ returns: A str object with a random fact. Gets a random fact in HTML from http://randomfactgenerator.net/ and parses it to a string. """ # Get the HTML and strip the RE response = get(URL) fact = extract(r"<div id=\\'z\\'>.+?<br/>", "<di...
de5ef8a628ea8b0c2f0929ee458ec49400838691
3,606,473
def allBin2Pickle(directory='C:\\Users\\SPAD-FCS\\OneDrive - Fondazione Istituto Italiano Tecnologia'): """ Convert all FCS bin files in the given directory to picle files. Files that already already have a bin file are skipped return parameter: data from the last file """ binfiles = listFile...
b2efe2c5aa239af9bbf4844f80bfe8f108bba47f
3,606,474
def EI(sections, normal=None): # {{{ """Calculate the bending stiffnes of a cross-section. The cross-section is composed out of rectangular nonoverlapping sections that can have different Young's moduli. Each section is represented by a 4-tuple (width, height, offset, E). The offset is the distan...
24b5ca79f0a3f041586e2f9d7fe8d7953cd96780
3,606,475
def get_teds_model( channel ): """ *** Set/Get functions for DAQmx_PhysicalChan_TEDS_ModelNum *** """ model = uInt32(0) CALL('GetPhysicalChanTEDSModelNum', channel, byref(model)) return model.value
1dea780dcca68543de2e5a89158ce40cf3ccee69
3,606,476
def karyoplot(data, ax=None, width=0.5, CHR=None, alpha=0.8, color4none="#34728B", **kwargs): """ Create karyotype plot. Parameters ---------- data : string or array A karyotype information list or input file path, even more could be any kind of URL link. e.g. AWS S3 link. ax : ma...
77bddad8747248553b2543eab15a20b0f16ed342
3,606,477
def filter_labels_by_class(obj_labels, classes): """Filters object labels by classes. Args: obj_labels: List of object labels classes: List of classes to keep, e.g. ['Car', 'Pedestrian', 'Cyclist'] Returns: obj_labels: List of filtered labels class_mask: Mask of labels to k...
854a32da802c794b0622a0a36895590823b7c780
3,606,478
def customized_upstream(*args, **kwargs): """ To enable your customized pretrained model, you only need to implement upstream/example/expert.py and leave this file as is. This file is used to register the UpstreamExpert in upstream/example/expert.py The following is a brief introduction of the regis...
89a74b0e14d9b78eadf66b47584fd01ce51c9d08
3,606,479
def calc_mixing(p0, p1, l_log = True): """ INPUT: p0 : dry mixing member list: [H2O, dD] p1 : moist mixing member list: [H2O, dD] RETURN: q : H2O along mixing curve dD : dD along mixing curve """ q0, dD0 = p0 q1, dD1 = p1 if l_log: q = np.exp(...
d65873f07b30f32dfdb2a44a9343797fcbc1772e
3,606,480
def find_four(opositions, far): """finds four membered rings and returns a list of lists of their locaitons""" rings = [[]] remov = [] # for each oxygen for i in range(len(opositions)): rings.append([""]) rings[i] = [opositions[i]] # for each oxygen with an x position ...
0bfcd9f7e505921f01ab1fcfce6c5f0970cd2378
3,606,481
def estimate_backup_duration(read_throughput_percent, table_size_bytes, read_capacity_units): """ Gives rough estimate, on how long backing up dynamo db table will take. :param table_size_bytes: :param read_capacity_units :return: Estimated time in seconds. """ read_bytes_per_second = read_c...
be3e2463426b8e941e79fbbb69f9adcb5cb2aa32
3,606,482
def _update_entries(data_arr, first_one, second_one): """ Replaces 2 entries in the array, and returns the modified array. This only operates on arrays returned by the likes of _augment_array(). """ temp1 = data_arr[first_one] temp2 = data_arr[second_one] intended_index = temp2[0] - 1 ...
505f0334152819408b0e1eb358f635f5793e93ff
3,606,483
from datetime import datetime def get_month_first_total_balance(month: float, year: float = datetime.today().year): """ Returns the total balance from the earliest entry of the selected month """ # Get date of first entry of selected month # TODO: new function to get balance from specific day ...
4e049252b255e8c3dc58cdbfee37c1ab87a556ae
3,606,484
def compute_qgpv_givenvort(omega,nlat,nlon,kmax,unih,ylat,avort,potential_temp, t0_cn,t0_cs,stat_cn,stat_cs,nlat_s=None,scale_height=7000.): """ The function "compute_qgpv_givenvort" computes the quasi-geostrophic potential vorticity based on the absolute vorticity, potential temp...
346a66b205aaefaa1e986da2dc5b38dfc673a117
3,606,485
import logging def star_data_gatherer(image_data, mask, **kwargs): """ finds stars based on config parameters and returns list sorted by flux """ logging.info('Finding stars on image...') fwhm = kwargs['fwhm'] threshold = kwargs['threshold'] sigma = kwargs['sigma'] mean, median, std = sig...
e05018d6ad4612be6b7ba8379473e8b05c6f5073
3,606,486
async def async_setup_entry(hass, config_entry): """Set up config entry.""" hass.async_create_task( hass.config_entries.async_forward_entry_setup(config_entry, "sensor") ) return True
96c0128fdac3186f202150d27e45c48b337057d1
3,606,487
from bs4 import BeautifulSoup def FourD(): """ 4D Results! """ # Connect to Source url = 'https://www.gidapp.com/lottery/singapore/4d' data = urlopen(url) soup = BeautifulSoup(data, 'html.parser') # Find latest Result result = soup.findAll('time') latest_result_date = result[6].get_t...
920381133c1ff234002a2237fe3905a54ebb4739
3,606,488
def probably_reconstruction(file) -> bool: """Decide if a path may be a reconstruction file.""" return file.endswith("json") and "reconstruction" in file
fc5c20fe8fddc9f8ffaab0e746100a534e6a5f57
3,606,489
import requests import urllib def infer_timestamp_from_retrieved_response(response: requests.Response) -> str: """Infers the timestamp of the retrieved response from the request URL. The function uses the fact that the retrieval of the active configuration is initiated by sending a GET request to the Wat...
52837f9f14cc7f258fbf49e34adfe122440b6e63
3,606,490
def target_h(m, eta, omega1, omega2, phi1, phi2, times, max_drive_strength, ramp_time=None): """ The time dependent magnetic field corresponding to the Hamiltonian in [PRX 7, 041008 (2017)] Eq.(28) and [arXiv:2012.XXXXX] Eq.(7) Includes a linear ramp of omega1 and omega2 to reduce transient effects fr...
5b2b4f85fec3ca9c5126ad3b8b9a8619e188c4bc
3,606,491
import re def error_086_ext_link_two_brackets(text): """Fix some cases and return (new_text, replacements_count) tuple.""" # case: [[http://youtube.com/|YouTube]] def _process_link(match_obj): """Deals with founded wiki-link.""" link = match_obj.group(1) name = match_obj.group(2) ...
6e5acc412be1de2b5cbc580984b70cc66cf7fba6
3,606,492
import sys import inspect def linkcode_resolve(domain, info): """ Determine the URL corresponding to Python object This code is from https://github.com/numpy/numpy/blob/master/doc/source/conf.py#L290 and https://github.com/Lasagne/Lasagne/pull/262 """ if domain != "py": return None...
066c4c8403f843beaed834fa4e6e18415b376156
3,606,493
def _CredentialStoreConfigured(): """Returns True if a credential store is specified in the docker config. Returns: True if a credential store is specified in the docker config. False if the config file does not exist or does not contain a 'credsStore' key. """ try: # Not Using DockerConfigInfo...
e161d14457e905606e443439b4b52c40372aedf3
3,606,494
def board_contains_word_in_column(board, word): """ (list of list of str, str) -> bool Return True if and only if one or more of the columns of the board contains word. Preconditions: 1) board has at least one row and one column, and word is a valid word. 2) len(board[0] == len(board[n] ...
274b3ed6f41555ab514739c0f2ba3a567b2bb215
3,606,495
import re def get_ip(ip_str): """ input format: SH-IDC1-10-5-30-[137,152] or SH-IDC1-10-5-30-[137-142,152] or SH-IDC1-10-5-30-[152, 137-142] output format 10.5.30.137 """ # return ".".join(ip_str.replace("[", "").split(',')[0].split("-")[2:]) return ".".join(re.findall(r'\d+', ip_str)[1:5])
0a49bf6ae1bdaed6a88e793a9d9d1cd2e1064de3
3,606,496
def c(n, k): """ Количество сочетаний k элементов из n Биномиальный коэффициент """ return fact(n) / (fact(n - k) * fact(k))
f27495d8ccebf7aedfd81cb6681283b652cbafd3
3,606,497
def binaryMatrixFunction(X, Y, fnName): """ Common function called by supported PyDML built-in function that has two arguments. """ inputs = [] lhsStr, inputs = _matricize(X, inputs) rhsStr, inputs = _matricize(Y, inputs) return construct_intermediate_node(inputs, [OUTPUT_ID, ' = ', fnName,'...
9e7b34dd657ca5d1ff13cfbe9f4ed2ed3c40091b
3,606,498
def _from_file(xml): """ Recursively parse the xml tree into nested data format. Args: xml: the xml tree Returns: the nested data """ tag = xml.tag if not len(xml): return odict({tag: xml.text or ''}) # store empty tags (text is None) as empty string nested_dat...
0c90d130c77d0ca763e8af8d3fe493f70e3eed84
3,606,499