content
stringlengths
35
416k
sha1
stringlengths
40
40
id
int64
0
710k
def get_table_13(): """表 13 玄関ポーチに設置された照明設備の人感センサーによる補正係数 Args: Returns: list: 表 13 玄関ポーチに設置された照明設備の人感センサーによる補正係数 """ table_13 = (0.9, 1.0) return table_13
91a89343800ad5e3c587371c91e7d256d9ed85a1
703,429
def find_left_anchor_index(fragment_info, fragments): """ Description: Use the fragment information to find which fragment is the left anchor :param fragment_info: [list[dict]] the list of fragment information :param fragments: [list] the list of fragments being searched :return: left_anchor_ind...
502473f7fee00a5ccd1ed3d6cf5c938e8c4d2041
703,430
def get_all_preconditions(action_set): """ Returns a set of all preconditions for the actions in the given set """ all_precons = set() for a in action_set: all_precons.update(a.precondition) return all_precons
1697c2d013b07bbfc24ca6273d16523eb1d83acf
703,431
def f_line(x, m, b): """ Line fit with equation y = mx + b Parameters ---------- x : array x values m : float slope b : float y-intercept Returns ------- y : array y values """ y = m*x + b return y
daf437461c2e8723a824e4083794d1f6ea6b368b
703,432
def getDistance(sensor): """ Return the distance of an obstacle for a sensor. The value returned by the getValue() method of the distance sensors corresponds to a physical value (here we have a sonar, so it is the strength of the sonar ray). This function makes a conversion to a distance value ...
d00b1d201fb59939d2b8a2e57bfa35588780b6d5
703,433
def update_individual_metadata(ts): """Update individual metadata in ts object. Returns new list of individuals with updated metadata """ individuals = [] oldname = None i = 0 for ind in ts.individuals(): popindex = ts.nodes()[ind.nodes[0]].population popname = ts.population...
4cfaf24fc4e68203e8206163fcb0686ac9fd9692
703,434
import platform def mysql_config_path(): """ 根据平台查询mysql配置文件 :return: """ _platform = platform.system() print('当前平台为:{}'.format(_platform)) mysql_config = None if _platform == 'Darwin': mysql_config = "/Users/yuxiang/Documents/Developer/WeChat/baixiaotu-mini/sqlconfig.json" ...
c24632e4262ea1cfb903492b5d261a8cd5cbcd8e
703,435
import numpy def index_to_position(index, nelx, nely): """ Convert the index of a element to the centroid of the element """ return numpy.array([(index % nelx)+.5, index/nelx+.5])
1402251581df9e346097dbd561ef5f782f18da1e
703,436
import os def get_api_key(api_file): """ Return an API key from the user's home directory """ with open('{_home}/.{_api_file}'.format(_home = os.path.expanduser('~'), _api_file = api_file)) as f: return f.read().replace('\n', '')
0819cfe693478b24a827d12b448ccd1ab274271e
703,437
import requests def get_function_fb_graph(): """Get call - facebook.""" return requests.get('http://graph.facebook.com')
38f790a006a3d8de981e66936e50b7be743e4d1b
703,438
import random def get_random_number_with_zero(min_num: int, max_num: int) -> str: """ Get a random number in range min_num - max_num of len max_num (padded with 0). @param min_num: the lowest number of the range in which the number should be generated @param max_num: the highest number of the range i...
bdc9f192286262566d2b2a87e8124abdf745ecbd
703,439
def raoult_liquido(fraccion_vapor, presion_vapor, presion): """Calcula la fraccion molar de liquido mediante la ec de Raoult""" return fraccion_vapor * presion / presion_vapor
bd15f53ee74ef3dc1925ee3da7133a9c3f455333
703,442
def implemented_motifs(): """ Returns ------- List strings of all implemented motif definitions """ return ['Sheet', 'Gamma', 'Herringbone', 'Sandwich']
63564c7e1b3e7e5f8f6b93354a3e268a79e9c5de
703,443
def left(direction): """rotates the direction counter-clockwise""" return (direction + 3) % 4
f8136385e5fec11bf26a97f77e336b04ce783571
703,444
def union(list1, list2): """Union of two lists, returns the elements that appear in one list OR the other. Args: list1 (list): A list of elements. list2 (list): A list of elements. Returns: result_list (list): A list with the union elements. Examples: >>> union([1,2,3...
983e96ceb4f4eeb2b4b2d96362a0977be0cb2222
703,445
import re def list_all_links_in_page(source: str): """Return all the urls in 'src' and 'href' tags in the source. Args: source: a strings containing the source code of a webpage. Returns: A list of all the 'src' and 'href' links in the source code of the webpage. """ retu...
f17f2ac2724fcfdd041e2ad001557a0565b51e00
703,446
def get_direction(source, destination): """Find the direction drone needs to move to get from src to dest.""" lat_diff = abs(source[0] - destination[0]) long_diff = abs(source[1] - destination[1]) if lat_diff > long_diff: if source[0] > destination[0]: return "S" else: ...
224a8df79cbafbcf1eed8df522ab7f58cc93598d
703,447
import sys def verifyPicklingCompatibility(otherPythonVersion): """ Check a provided python version string versus the present instance string for pickling safety. :param otherPythonVersion: other version string :return: True is safe, False otherwise """ if otherPythonVersion is None: ...
1b5e2a9cb350f8a223b78cfed0a1ebaddb9d346e
703,448
def are_close(col1, col2): """This function used to compare values of collections with numeric data """ if len(col1) != len(col2): raise ValueError("Different size of input collections") result = [] for x, y in zip(col1, col2): result.append(abs(abs(x) - abs(y)) < 0.4) r = T...
72896f522a5fc7cb9f4f96e873c14797009877fe
703,449
def identity(*args, **kwargs): """ An identity function used as a default task to test the timing of. """ return args, kwargs
472808f6b5260569538f26513f24ffcb1bd88c4d
703,450
def list_merger_list0(*lists): """Picks leading list, discards everything else""" return lists[0]
c571adb593de991f633a28b086e61fa7888cbc7e
703,451
def cmp(a,b): """3-way comparison like the cmp operator in perl""" if a is None: a = '' if b is None: b = '' return (a > b) - (a < b)
97c5a33e9161196119abbc323841be0b1cfdda14
703,452
import base64 import os def generate_random_string(length): """Generates a random string of the specified length. Args: length: int. Length of the string to be generated. Returns: str. Random string of specified length. """ return base64.urlsafe_b64encode(os.urandom(length))
10f22582cbe17ac0a4a41b52a8691e12036593d2
703,453
def create_logdir(method, weight, label, rd): """ Directory to save training logs, weights, biases, etc.""" return "bigan/train_logs/mnist/{}/{}/{}/{}".format(weight, method, label, rd)
4b4edcc9c0c36720e76013a6fb0faf1b49472bc0
703,454
import re def camel_case_to_title_case(camel_case_string): """ Turn Camel Case string into Title Case string in which first characters of all the words are capitalized. :param camel_case_string: Camel Case string :return: Title Case string """ if not isinstance(camel_case_string, str): ...
bcc40753a8672355519741f5aec64c262431d582
703,456
def pmr_corr(vlos, r, d): """ Correction on radial proper motion due to apparent contraction/expansion of the cluster. Parameters ---------- vlos : float Line of sight velocity, in km/s. r : array_like, float Projected radius, in degrees. d : float Cluster distan...
c9136c5ae33e89d6f57b936b92c23001fd30ccfa
703,457
def get_min_corner(sparse_voxel): """ Voxel should either be a schematic, a list of ((x, y, z), (block_id, ?)) objects or a list of coordinates. Returns the minimum corner of the bounding box around the voxel. """ if len(sparse_voxel) == 0: return [0, 0, 0] # A schematic if len(...
371b25b795a1a2ffeb0fc3724f01f1a329f917ae
703,458
def ExtractListsFromVertices(vertexProp, g): """ Method to extract the lists at each vertex of a vertex property, vertexProp, belonging to a graph, g, and to return a list of lists, where each sub-list is a list of values from each vertex :param vertexProp: :param g: :return: ...
fd10e9285f9382511a526468e41e8a516a6f50bd
703,459
def is_palindrome_letters_only(str): """ Confirm Palindrome, even when string contains non-alphabet letters and ignore capitalization. casefold() method, which was introduced in Python 3.3, could be used instead of this older method, which converts to lower(). """ i = 0 j = hi = len(str) - ...
5f95add0ecf3fbe31af2b9cd0e27aac36b2c3985
703,460
from typing import Any def validate_delta(delta: Any) -> float: """Make sure that delta is in a reasonable range Args: delta (Any): Delta hyperparameter Raises: ValueError: Delta must be in [0,1]. Returns: float: delta """ if (delta > 1) | (delta < 0): raise ...
1fd3084c047724a14df753e792b8500a103a34c0
703,461
import numpy as np def molpos_1Dbin(data,bins,diameter): """Creates a 1D histogram from X,Y location data of a single tracked molecule over time Args: data (pandas dataframe): time series 2D location data of a tracked molecule bins (int): # of rectangular bins to discretize cell with (bin...
fbc05b9c14d82c19f62ae30ec1d05b7e314b57e8
703,463
def build_authenticate_header(realm=''): """Optional WWW-Authenticate header (401 error)""" return {'WWW-Authenticate': 'OAuth realm="%s"' % realm}
74c2e4e4188b608120f241aadb20d8480ac84008
703,464
def decorator_with_default_params(real_decorator, args, kwargs, default_args=None, default_kwargs=None): """ This function makes it easy to build a parametrized decorator, having a default value. Construct your decorator like this: >>> def decorator(*d_args, **d_kwargs): # d_args with d like decorator ...
63e38bbdaea3483250db7281908a0053e072e866
703,465
import json import copy def get_args(request, required_args): """ Helper function to get arguments for an HTTP request Currently takes args from the top level keys of a json object or www-form-urlencoded for backwards compatability. Returns a tuple (error, args) where if error is non-null, the...
b44e058590945211ca410005a5be2405b4756ca4
703,466
def find_most_sim(mesh, doc_id, top_n=10): """Find documents most similar to the given document.""" doc = mesh.doc_cache[doc_id] results = [] doc_conc = list(map(lambda x: x[1], mesh.graph.out_edges(doc_id))) for other_doc in mesh.doc_cache.values(): if other_doc._.id != doc_id: ...
2eef0091bebb7dd8f4aa1a186020aafb6eefca7c
703,467
def determine_header_length(trf_contents: bytes) -> int: """Returns the header length of a TRF file Determined through brute force reverse engineering only. Not based upon official documentation. Parameters ---------- trf_contents : bytes Returns ------- header_length : int ...
e8aa5110691e877c34f208af5bd508f0f5ec4760
703,469
import re def _join_lines(source): """Remove Fortran line continuations""" return re.sub(r'[\t ]*&[\t ]*[\r\n]+[\t ]*&[\t ]*', ' ', source)
9caa3b6f470a96a7b473f3cce12f57d3787e91dd
703,470
def format(t): """ function to format the stopwatch time to A:BC.D Returns: the formatted six character string """ A = t/600 t = t - A * 600 # this round function isn't needed when t is an integer CD = round(t/10.0, 1) B = "" if CD < 10.0: B = "0" r...
ad6dc72f0d6b090cf4d94d27e1f0560c58a9f42d
703,471
import requests def get_kalliope_bijlage(path, session): """ Perform the API-call to get a poststuk-uit bijlage. :param path: url of the api endpoint that we want to fetch :param session: a Kalliope session, as returned by open_kalliope_api_session() :returns: buffer with bijlage """ r = ...
b2a126b8e33bab50b1e2aa122645d7a45d6dfea9
703,472
def filter_by_book_style(bibtexs, book_style): """Returns bibtex objects of the selected book type. Args: bibtexs (list of core.models.Bibtex): queryset of Bibtex. book_style (str): book style key (e.g. JOUNRAL) Returns: list of Bibtex objectsxs """ return [bib for bib in ...
ca3b46772930a6f6e28b6fc0ee4d175ee8d69c3c
703,474
import torch def attributions(scores: torch.Tensor, targets: torch.Tensor) -> torch.Tensor: """Error analysis for antecedent scoring ## Inputs - `scores`: `(batch_size, max_antecedent_number)`-shaped float tensor. The first dimension might be padded with `-float("-inf")` or approximations...
6ce0c443d6e344bfc84565f8f901984904216194
703,476
def square_quad_f(x, a, matrix): """ Compute the square of the quadratic function. Parameters ---------- x : 1-D array Point in which the square of the quadratic is to be evaluated. minimizer : 1-D array Minimizer of the square of the quadratic function. matrix : 2-D...
1ff7aafd5d4259bfccd110d4f2880071b8fad18a
703,477
import random def random_val(index, tune_params): """return a random value for a parameter""" key = list(tune_params.keys())[index] return random.choice(tune_params[key])
1cf7ba9d1a3ff651f946a8013e338d62f4fec3ab
703,478
def git_version_specifier(refspec, branch, commit, tag): """ Return the minimal set of specifiers that the user input reduces to, in a dict of variables for Ansible. :param refspec: provided refspec like 'pull/1/head' :param branch: provided branch like 'master' :param commit: provided commit S...
9b723b44f3bad03a74b78a10153f4d6120202fc6
703,479
import socket def receive_bytes(socket: socket.socket, buffer_size: int) -> str: """ Receives the specified number of bytes from the specified socket @param socket - the socket from which to receive @param buffer_size - the number of bytes to receive @return - string """ receiver_buffe...
bb28fa45641596a02f6e325e3a62ccc51c9f9905
703,480
def convert_archive_posts(archive_posts): """Convert a list of SQL post rows to the format used for display within the post archive.""" converted_archive = []; current_year = "" current_month = "" for post in archive_posts: # If the posts created year is not the current year being parsed, ...
1572d6105c4ed217f67021ebd7c9a3f1058a7617
703,482
def _get_search_text(keywords): """Get search text.""" search_text = ' '.join(['"{}"'.format(keyword) for keyword in keywords]) search_text = search_text.replace(':', ' ') search_text = search_text.replace('=', ' ') return search_text
cabb5d9ca5b5faf3d9287261aab0cd01df21a680
703,483
def readnext(x): """x is a list""" if len(x) == 0: return False else: return x.pop(0)
dd27ad3c8f750ef3e6df640fd710a0469b0839d0
703,484
def coding_problem_19(house_costs): """ A builder is looking to build a row of N houses that can be of K different colors. He has a goal of minimizing cost while ensuring that no two neighboring houses are of the same color. Given an N by K matrix where the nth row and kth column represents the cost to ...
f9d8b33f449d7a2f87118be3e4d894988b781476
703,486
import requests def requests_get(url): """Make a get request using requests package. Args: url (str): url to do the request Raises: ConnectionError: If a RequestException occurred. Returns: response (str): the response from the get request """ try: r = reque...
a438d211e6b5bf78af56783b5d22c85961a2d563
703,487
def _join_dicts(*dicts): """ joins dictionaries together, while checking for key conflicts """ key_pool = set() for _d in dicts: new_keys = set(_d.keys()) a = key_pool.intersection(new_keys) if key_pool.intersection(new_keys) != set(): assert False, "ERROR: dicts ...
2dee7a6f6a89d310d6a58e35d14c57e8ddb5b804
703,488
def cases_vs_deaths(df): """Checks that death count is no more than case count.""" return (df['deaths'] <= df['cases']).all()
994ae93fb23090de50fc4069342487d0d8e621ed
703,489
import os def list_files_in_dir(dir_path): """ List out files only from a target directory path. """ if not os.path.isdir(dir_path): raise ValueError('`dir_path` must be a directory.') return iter(f for f in os.listdir(dir_path) if os.path.isfile(os.path.join(dir_path, f)))
c502799d34ba5fd1a89a574cfb78d722e6ce4a8c
703,490
import re def add_pronom_link_for_puids(text): """If text is a PUID, add a link to the PRONOM website""" PUID_REGEX = r"fmt\/[0-9]+|x\-fmt\/[0-9]+" # regex to match fmt/# or x-fmt/# if re.match(PUID_REGEX, text) is not None: return '<a href="https://nationalarchives.gov.uk/PRONOM/{}" target="_bla...
5fdc9c15895dfd75be54ad0258e66625462204a2
703,491
def convert(df_column): """ Converts a DataFrame column to list """ data_list = [] for element in df_column: data_list.append(element) return data_list
6cd0f9b445573892612e01e0e3e25eb32d658be4
703,492
from typing import Mapping from typing import Any import textwrap def format_nested_dicts(value: Mapping[str, Mapping[str, Any]]) -> str: """ Format a mapping from string keys to sub-mappings. """ rows = [] if not value: rows.append("(empty)") else: for outer_key, outer_value i...
79d029a062f0e2545265ecdf5d8cdacb271c40c2
703,493
import random def shuffle_string(s): """ Shuffle a string. """ if s is None: return None else: return ''.join(random.sample(s, len(s)))
25d109f11737b60cecf391fd955f2df4366de7e6
703,494
def get_rule_full_description(tool_name, rule_id, test_name, issue_dict): """ Constructs a full description for the rule :param tool_name: :param rule_id: :param test_name: :param issue_dict: :return: """ issue_text = issue_dict.get("issue_text", "") # Extract just the first lin...
546dcb5ce2cbc22db652b3df2bf95f07118611cf
703,495
import itertools def check_length(seed, random, query_words, key_max): """ Google limits searches to 32 words, so we need to make sure we won't be generating anything longer Need to consider - number of words in seed - number of words in random phrase - number of words in the lists from the qu...
14871b468454f324223673a0c57941ea9e63341a
703,496
def is_string(val): """ Is the supplied value a string or unicode string? See: https://stackoverflow.com/a/33699705/324122 """ return isinstance(val, (str, u"".__class__))
99b082ec080f261a7485a4e8e608b7350997cf18
703,497
from datetime import datetime def time_string(): """ Generate a string of numbers generated from now time (UTC). """ # UTC time up to microseconds time_str = datetime.utcnow().strftime("%Y%m%d%H%M%S") return time_str
c7258004db459563a1d229119b6148584cc72584
703,498
def colorvsn1(studydata, column, context): """Please convert numeric codes of 0 and 99 to the text strings they represent.""" return column.mask(column == 0, 'No').mask(column > 90, "Don't Know")
3f05a3a78d1368e6116fa52366079c22dd183bc3
703,499
def score(hand): """ Compute the maximal score for a Yahtzee hand according to the upper section of the Yahtzee score card. hand: full yahtzee hand Returns an integer score """ max_score = 0 sorted_hand_list = sorted(list(set(hand))) for i_mem in sorted_hand_list: temp_sco...
b1fae3c67793a96b040f8abae41514bef2c5b89c
703,500
def context_get(stack, name): """ Find and return a name from a ContextStack instance. """ return stack.get(name)
a5a9a50c54e8f0f685e0cf21991e5c71aee0c3d6
703,501
import os def test_vars(env_vars): """Method to identify the active and inactive environment variables for a specific conda environment test_vars ========= This method is used to get the active and inactive environment variables for a specific conda environment created by ggd. Parameters: ...
f24f2b18c028984ab1dd4e11832a39fcba48d946
703,502
def tree_names (tree): """Get the top-level names in a tree (including files and directories).""" return [x[0] for x in list(tree.keys()) + tree[None] if x is not None]
12a5522974671f3ab81f3a1ee8e8c4db77785bd3
703,504
def fixed_width_repr_of_int(value, width, pad_left=True): """ Format the given integer and ensure the result string is of the given width. The string will be padded space on the left if the number is small or replaced as a string of asterisks if the number is too big. :param int value: An inte...
adb212746dd081112ec1de2c4ea8745d2601c055
703,505
def _getCompiledName(fldName, clsName): """Return mangled fldName if necessary, else no change.""" # If fldName starts with 2 underscores and does *not* end with 2 underscores... if fldName[:2] == '__' and fldName[-2:] != '__': return "_%s%s" % (clsName, fldName) else: return fldName
91285b7c54e001d807850c66ac74521e55d05ca4
703,506
def ConvertListToCSVString(csv_list): """Helper to convert a list to a csv string.""" return ','.join(str(s) for s in csv_list)
547311ceac094211d47d0cc667d54b2a3e697f4e
703,508
def min_distance_bottom_up(word1: str, word2: str) -> int: """ >>> min_distance_bottom_up("intention", "execution") 5 >>> min_distance_bottom_up("intention", "") 9 >>> min_distance_bottom_up("", "") 0 """ m = len(word1) n = len(word2) dp = [[0 for _ in range(n + 1)] for _ in ...
8cd87ffe877aa24d5b1fa36ce1d3b96efb7b4e1e
703,510
def periodize_filter_fourier(h_f, nperiods=1, aggregation='sum'): """ Computes a periodization of a filter provided in the Fourier domain. Parameters ---------- h_f : array_like complex numpy array of shape (N*n_periods,) n_periods: int, optional Number of periods which should be...
f9a2845dcf40eedce9d46faba506f1c1358ce6a5
703,511
def quick_sort(data): """To sort data as an increase order by divide and conquer method.""" def q_sort(left_index, right_index): """Do quicksort recursively.""" if right_index <= left_index: return # Sort sub partition. part = partition(left_index, right_index) ...
e8c530b6da3f705b08279eb213d03bd54820f4a4
703,512
def slope_id(csv_name): """ Extract an integer slope parameter from the filename. :param csv_name: The name of a csv file of the form NWS-<SLP>-0.5.csv :return: int(<SLP>) """ return int(csv_name.split("-")[1])
1ae34f1e5cc91fdc3aaff9a78e1ba26962475625
703,513
def minbox(points): """Returns the minimal bounding box necessary to contain points Args: points (tuple, list, set): ((0,0), (40, 55), (66, 22)) Returns: dict: {ulx, uly, lrx, lry} Example: >>> minbox((0, 0), (40, 55), (66,22)) {'ulx': 0, 'uly': 55, 'lrx': 66, 'lry': 0...
d8b11d40b52886f290d28f3434b17d2b9641c4fb
703,514
import csv def write_csv(history, filename): """ Write Letterboxd format CSV """ if history: with open(filename, 'w', encoding='utf8') as fil: writer = csv.DictWriter(fil, list(history[0].keys())) writer.writeheader() writer.writerows(history) return True ...
66ab2c9734c5d50b59d1aaff2dd62a4fffcfe0ec
703,515
def apply_regression(df, w): """ Apply regression for different classifiers. @param df pandas dataframe; @param w dict[classifier: list of weights]; @return df with appended result. """ # get input if 'state' in df.columns: x = df.drop('state', axis=1).to_numpy(dtype='float64') ...
1fb5fd9f4b297cd024e405dc5d9209213d28ff0d
703,516
import sys def parse_acc_table(infile): """Parsing tab-delim accession table (genome_name<tab>accession) """ if infile == '-': inF = sys.stdin else: inF = open(infile) tbl = [] for line in inF: line = line.rstrip().split('\t') tbl.append(line) return tbl
568aaeb0d6dd4158b1f6e6c59c709c9996948a69
703,517
def get_lambda_cloud_watch_func_name(stackname, asg_name, instanceId): """ Generate the name of the cloud watch metrics as a function of the ASG name and the instance id. :param stackname: :param asg_name: :param instanceId: :return: str """ name = asg_name + '-cwm-' + str(instan...
893abaf60684cbf9d72774d6f5bb2c4351744290
703,518
def secondary_training_status_changed(current_job_description, prev_job_description): """Returns true if training job's secondary status message has changed. Args: current_job_description: Current job description, returned from DescribeTrainingJob call. prev_job_description: Previous job descri...
b1d1a83cccb8cf84fa678345bcf7b3f6531aa2c5
703,519
def string_concat(str1, str2): """Concatenates two strings.""" return str1 + str2
5b6d842fca2d3623d33341d9bba4e4a76ec29e15
703,520
def remove_spaces(input_text, main_rnd_generator=None, settings=None): """Removes spaces. main_rnd_generator argument is listed only for compatibility purposes. >>> remove_spaces("I love carrots") 'Ilovecarrots' """ return input_text.replace(" ", "")
a9ba3bcca4a4ff1610d52271562e053f25815618
703,521
from typing import List from typing import Counter import heapq def top_k_frequent_pq(nums: List[int], k: int) -> List[int]: """Given a list of numbers, return the the top k most frequent numbers. Solved using priority queue approach. Example: nums: [1, 1, 1, 2, 2, 3], k=2 output: [1, 2]...
4d30bd7e11a087be1a23f9db5c8af7f78c083a5f
703,522
def monthFormat(month: int) -> str: """Formats a (zero-based) month number as a full month name, according to the current locale. For example: monthFormat(0) -> "January".""" months = [ "January", "February", "March", "April", "May", "June", "July", ...
cb675f547d9beec0751d8252e99b5c025b8fd291
703,524
def build_fnln_contact(individual_contact): """ Expected parameter format for individual_contact ('My Name', 'myname@gmail.com') Sample output: {'email': 'myname@gmail.com', 'name': 'My Name'} """ return { "email": individual_contact[-1], "name": individual_...
54080191320cfeb425de0f765f10e29726405d0d
703,525
import numpy as np def shortcut( sn ) : """ For a given snana.SuperNova object sn, quickly convert the posterior probabilities computed using the 'mid' class fractions prior into the posterior probabilities you get when adopting the 'galsnid' prior. NOTE: we do not account for redshift...
adca461ca14c941e8f6a69193f796b78f5dc25dd
703,526
def extract_img(size, in_tensor): """ Args: size (int): size of crop in_tensor (tensor): tensor to be cropped """ dim1, dim2 = in_tensor.size()[2:] in_tensor = in_tensor[:, :, int((dim1-size)/2):int((dim1+size)/2), int((dim2-size)/2):int((dim2+size)/2)] return in_tensor
5c167c88aa7c65ca06f46d2795dbcd2af38db71e
703,527
import math import copy def plan_cartesian_path_lin(move_arm, wpose, length, alpha, z_start, cs): """ :type move_arm: class 'moveit_commander.move_group.MoveGroupCommander' :type length: float :type alpha: float """ move_arm.set_start_state(cs) waypoints = [] wpose.position.x += length*math.cos(alpha...
e064ff6239fd7bb6b29d4c210ef94956219b5165
703,528
from numpy import asarray, mean def r_precision(r): """Score is precision after all relevant documents have been retrieved Relevance is binary (nonzero is relevant). >>> r = [0, 0, 1] >>> r_precision(r) 0.33333333333333331 >>> r = [0, 1, 0] >>> r_precision(r) 0.5 >>> r = [1, 0, 0...
37467e1e02284e16a82a3dad6e0e5c14a0afcad3
703,530
import functools def accepts(*types): """ Checks argument types. """ def decorator(f): assert len(types) == f.__code__.co_argcount @functools.wraps(f) def wrapper(*args, **kwds): for (a, t) in zip(args, types): assert isinstance(a, t), "The input arg...
26dd256b466659400898972eea0a19391433be87
703,531
def pass_down(L,L1,map): """map maps L into L1.Populate L1 with values in L""" ## print len(L),len(L1),len(map),max(map) ## print sumsize(L) ## print sumsize(L1) for j in range(len(map)): if L[j] == -1: continue assert L1[map[j]] == -1 or L1[map[j]] == L[j], 'L...
6896de91a37a29d1f0e360f410d83065b7434fc7
703,532
def parse_correctness_stats(filename): """ Parse the results returned from get_Correctness.sh """ results = [] stats_file = open(filename, 'r') line = stats_file.readline() while not line.startswith('Reference:'): line = stats_file.readline() # Add Reference bases. result...
8ac0ff9307169726597bd6bce632560faaed6b3b
703,533
import os def _simple_execution(cmd): """ Shell simple execution Return only exit status (0 : Good) """ return os.system(cmd)
5024f01e82f5da218cc4c6ec4a3c2086b588939c
703,534
def whereSubseq(conditionFunc, seq, length, overlap=False): """ >>> a = [1, 3, 2, 3, 2] >>> b = [1, 2] >>> whereSubseq(lambda seq: seq == b, a, 2) [] >>> c = [3, 2] >>> whereSubseq(lambda seq: seq == c, a, 2) [1, 3] >>> whereSubseq(lambda seq: sum(seq) < 8, a, 3) [0] >>> whereSubseq(lambda seq: sum(seq) < 8,...
f25ded43f91b4ecc05fa28e81095996f4d036418
703,535
import math def bearing(lat1: float, lon1: float, lat2: float, lon2: float) -> float: """Calculate bearing from lat1/lon2 to lat2/lon2 Arguments: lat1 {float} -- Start latitude lon1 {float} -- Start longitude lat2 {float} -- End latitude lon2 {float} -- End longitude Retu...
9148bc2726247cedf8a7de7279dac47316f2864f
703,536
def get_title(reg_doc): """ Extract the title of the regulation. """ parent = reg_doc.xpath('//PART/HD')[0] title = parent.text return title
744759addf0cea3ba6cc3dadad05d535b66b20d6
703,537
import random import requests def get_rising_submissions(subreddit): """Connects to the Reddit API and queries the top rising submission from the specified subreddit. Parameters ---------- subreddit : str The name of the subreddit without forward slashes. Returns ------- ...
115edc8986acdefbb232218d237bcba7320db9a0
703,538
def E_float2(y, _): """Numerically stable implementation of Muller's recurrence.""" return 8 - 15/y
4e8801465994afcb554e048897ec1ff903385bbe
703,539
def compute_packet_csum(pkt): """Computes the checksum for the given GDB packet""" csum = 0 for x in pkt: csum += x csum = csum & 0xFF return csum
29eef2afd1b33ab80013ce7fcd46c3b11c9f639b
703,540
def new_headers() -> list: """Return list of new headers with clean names.""" return [ "date", "Rohs FB1", "Rohs FB2", "Rohs gesamt", "TS Rohschlamm", "Rohs TS Fracht", "Rohs oTS Fracht", "Faulschlamm Menge FB1", "Faulschlamm Menge FB2", ...
c81c38e8521f159f0bbf29b3a32adeaa13d4c38f
703,541
import hashlib import io def calc_file_md5(filepath, chunk_size=None): """ Calculate a file's md5 checksum. Use the specified chunk_size for IO or the default 256KB :param filepath: :param chunk_size: :return: """ if chunk_size is None: chunk_size = 256 * 1024 md5sum = has...
8f391ade85a5b69ca63d8adb3eff6ff6af7a08e3
703,542