content
stringlengths
35
762k
sha1
stringlengths
40
40
id
int64
0
3.66M
import os def load_fragments(paths=None, exceptions=None): """ :type paths: list[str] | None :type exceptions: list[tuple[str, Exception]] | None """ if not paths: config = ChangelogConfig(CONFIG_PATH) fragments_dir = os.path.join(CHANGELOG_DIR, config.notes_dir) paths = [o...
51271416b2ddc0c2306813145cfc5f49babac56e
3,605,400
def getSheetContent(sheet): """ Returns two dimensional array of all non empty content of the given sheet. Array contains string and double values. """ cursor = sheet.createCursor() cursor.gotoStartOfUsedArea(False) cursor.gotoEndOfUsedArea(True) return [list(row) for row in cursor.getDa...
9a77c7dadcdf5247f30fa3dc4fa87cc5683cfee2
3,605,401
def loaddata(data_filename): """load matrix data""" data = np.genfromtxt(data_filename, delimiter='\t') data_nm = data[1:,0] #wavelength in nm data_time = data[0,1:] data_z = data[1:, 1:] return data_nm, data_time, data_z
0d3747a0ac2438c21dc7146e872e2c7728781e13
3,605,402
import time def get_meas(pix,nside=128): """ Get the measurements for a particular healpix.""" # objid, ra, raerr, dec, decerr, mjd t0 = time.time() connection = pq.connect(user="dlquery",host="db01.datalab.noao.edu", password="",port = "5432",database = "tapdb") cur ...
88e51f1c42da9511e86dd872bb3f262b02fe3c08
3,605,403
def generic_delete(cfg, request, *args, **kwargs): """ Support for rendering all delete object pages & processing submissions. """ Shared().request = request # FIXME: access control using ViewSet code # FIXME: as there is no delete page, merge in the process delete code directly into this functi...
e20e23ed16ccc2fad89b3950bcb71db645c3b1b3
3,605,404
import uuid def plugin_poll(handle): """ Extracts data from the sensor and returns it in a JSON document as a Python dict. Available for poll mode only. Args: handle: handle returned by the plugin initialisation call Returns: returns a sensor reading in a JSON document, as a Python dic...
735886b3c355f8a24593d0ab1dd8c6588118272d
3,605,405
def sbas_nav_decode(dwrds: list) -> dict: """ Helper function to decode RXM-SFRBX dwrds for SBAS navigation data. :param list dwrds: array of navigation data dwrds :return: dict of navdata attributes :rtype: dict """ return {"dwrds": dwrds}
215d945ac939a817ae84fa08607b72e0c14a1cc9
3,605,406
def _sql(child, sql, returnresult=True, includefields=True): """Execute SQL statement in interactive mode. """ sql = sql.strip() if '\n' in sql: sql = ' '.join([line.strip() for line in sql.split('\n')]) if not sql.endswith(';'): sql += ';' child.sendline(sql) i = child.expe...
7a9ff1fa221c23e444d8d6189da3cd5a0927311f
3,605,407
def qfunc(x, y): """Simple quantum function""" qml.RX(x, wires=0) qml.RX(y, wires=1) qml.CNOT(wires=[0, 1]) return expval(qml.PauliZ(wires=1))
d2f0f8c8e137da77a1c958cdb3c90bdf1bb91a92
3,605,408
def compute_overlaps_in_parallel( step ): """ Function used for the making the computation of overlaps parallel via python multiprocessing """ s_sd = step3.mapping.ovlp_mat_arb( sd_states_reindexed_sorted[step], sd_states_reindexed_sorted[step], S_ks[0][step], use_minimal=False ) s_sd = data_co...
0afd7950efcb7a60e4f7bfd3b57c9baea84fbc8f
3,605,409
def scanmeta(fstype, device): """Returns command for scanning metadata. Clonemeta1 will be tried first replacing target with '/dev/null'. """ tup = _FILESYSTEMS[fstype] cmd = clonemeta1(fstype, device, '/dev/null') if cmd: return cmd cmd = tup[2] if cmd: return list(cmd) + [dev...
937f6e8bbd5cf9feec9d2439564514afed90dd8e
3,605,410
def page_templates_loading_check(app_configs, **kwargs): """ Check if any page template can't be loaded. """ errors = [] for page_template in settings.get_page_templates(): try: loader.get_template(page_template[0]) except template.TemplateDoesNotExist: errors.append...
7dd30b7192d848ff6e6419ee0299676d31235f57
3,605,411
def constant(step, total_train_steps, value=1.0): """Constant learning rate (multiplier). Args: step: a tf.Scalar total_train_steps: a number value: a number or tf.Scalar Returns: a tf.Scalar, the learning rate for the step. """ del step, total_train_steps return value
53285310764c8d627ae366b2ec8e5ff98339e612
3,605,412
from typing import Any from typing import Union from datetime import datetime from typing import Optional from typing import Dict def filter_traces_attribute_in_timeframe(log: EventLog, attribute: str, attribute_value: Any, dt1: Union[str, datetime.datetime], dt2: Union[str, datetime.datetime], parameters: Optional[D...
cdbfda0d075514870996f7d080227231fd56f5ca
3,605,413
import random def normal113(startt,endt,money,first,second,third,forth,fifth,sixth,seventh,ff1,ff2,mm1,mm2): """ for source and destination id generation """ """ for type of banking work,label of fraud and type of fraud """ idvariz=random.choice(mm1) idgirande...
d584f61556bf04c92b87ed1935d5e841e95126b5
3,605,414
def ww_sim(word, mat, topn=10): """find topn most similar words to word""" indx = tok2indx[word] # check type of 'mat' if isinstance(mat, sparse.csr_matrix): v1 = mat.getrow(indx) else: print("not sparse") v1 = mat[indx:indx+1, :] # using sklearn cosine similari...
5242b9282b0699a764606c8491031009c14e30d7
3,605,415
def encriptar(frase: str, clave: str, s: str = "02468") -> str: """Función que encripta una frase. :param frase: Frase a encriptar. :type frase: str :param clave: Clave de encriptación. :type clave: str :param s: Símbolo de sustitución. :type s: str :return: Frase encriptada. :r...
1e1a4e3369180418184411b4c74fa468976ff872
3,605,416
def detach_user(current_user: User, target_user: User, user_group: UserGroup) -> UserGroup: """ Remove a user from a user group. :param current_user: :param target_user: :param user_group: :return: """ if target_user is current_user or is_user_group_admin(current_user, user_group): ...
e191516409e72eb4160e67b2feecf89c08b3967d
3,605,417
import os def DetectIpView(request, secret=None): """ Put the IP address (can be v4 or v6) of the client requesting this view into the client's session. :param request: django request object :param secret: session key used to find the correct session w/o session cookie :return: HttpResponse o...
926862a1c93da8bfc8efe6bd1f3a0599c94f0afd
3,605,418
import random def data_circle(num_samples, noise): """ Generates the two circles dataset with the given number of samples and noise :param num_samples: total number of samples :param noise: noise percentage (0 .. 50) :return: None https://github.com/hyounesy/TFPlaygroundPSA/blob/master/src/da...
4d0ac091382bd76677207e23d422bf5fab8dfd9f
3,605,419
def argmax_2d(a): """Return the tuple (i, j) where a[i, j] = a.max()""" return np.unravel_index(np.argmax(a), a.shape)
c969d856b1e6482086ece5bda19476c546238399
3,605,420
from typing import Optional def _reverse_cumsum( x: np.ndarray, axis: Optional[int] = None ) -> np.ndarray: # pragma: no cover """ (x0, x1, x2) -> (x0, x0 + x1, x0 + x1 + x2)""" if axis is None: axis = 0 return np.flip(np.cumsum(np.flip(x, axis=axis), axis=axis), axis=axis)
370facbca5bb5cd5e4d9d329af0aed941498dda8
3,605,421
import hashlib def prepareMessage( message: bytes, q: int, hashFunction: callable = hashlib.sha256 ) -> int: """Processes the message before signing or verifying according to FIPS 186-4. The procedure works as follows: 1) compute zLength = min(N, outlen), where outlen is the l...
c275455dfddaecb2480ed9c990b61804871cdb73
3,605,422
def fetch_ground_energy(bond_length): """Fetches exact ground state energy given the bond length. Args: ===== bond_length : float Bond length for fetching correct ground state energy Returns: ======== exact_energy : float Exact ground state energy """ exact_energy =...
e90657846d2973bdf9c8bb7cc6607f3f139dc008
3,605,423
import requests from bs4 import BeautifulSoup def grab_record(match_id): """ 根据比赛的id爬取比赛的文字实录 :param match_id: 比赛的id :return: list -> Record类型的列表 """ # 首先定义一个时间转换函数 def translate_time(time_to_end): time = 0 if ':' in time_to_end: time = int(time_to_end.split(':...
fcfeb871f5d801db2267aa607b8e3f57593dc501
3,605,424
def selfsigned_certificate_for_key( key, subject={}, serial_number=1, digest="sha256", length=None, file_name=None ): """ Creates self-signed certificate for a given key Args: - key: Key to create and sign the certificate. ...
0562f13a602acbd49ea99617696e4cb5d56e8b2d
3,605,425
def unconfirmed() -> str: """Unconfirmed email route. :return: Rendered auth/unconfirmed template. """ return render_template("auth/unconfirmed.html")
0656df3a95447a940ae53ae685922441732b8094
3,605,426
def predict(test_img): """ purpose: to leverage the recognizers to detect and identify the people whose faces are present in the uploaded image args: img - the image on which the label has to be added text - the label of the identified person x,y - the co-ordinates of the starting point for the...
9c1793176ae981640a688dcb21af5d4b987efb0a
3,605,427
def shape(x): """Get a list of integers representing this tensor's shape""" if get_backend() == "pytorch": return [s for s in x.shape] else: return [s for s in x.shape]
5bd451d21a101992f1c4dde4f56c6d5854463eb2
3,605,428
def ssh(uuid, cook_url=None, env=None, flags=None): """Invokes the ssh subcommand""" args = f'ssh {uuid}' cp = cli(args, cook_url, flags=flags, env=env) return cp
99e7a4cb8f77da06ac6fb9b7bc5e570bb8395685
3,605,429
def set_image(images, row, issues, pre, overrides={}, verbose=False): """ Update an image based on known issues. Given an image, image metadata, and a set of known issues, determine if any of the known issues apply to the image in question and, if they do, make the appropriate edits to the imag...
fae11f006dc93abdc0b04dc0aaf09c2ce4642450
3,605,430
def charvectorize(word, lower=True, setsize=128): """ Convert a word (sequence of characters) to a n-vector of length setsize, using one-hot encoding :param word: Word to vectorize :param lower: Render word lowercase first before vectorizing :param setsize: Size of character set :return: >>>...
34678377645e5bb873e7947edfb7900f67713ced
3,605,431
def get_downloader(start_date, end_date,): """returns a downloader closure for iex cloud :param start_date: the first day on which dat are downloaded :param end_date: the last day on which data are downloaded :type start_date: str in format YYYY-MM-DD :type end_date: str in format YYY...
3264da4d2f5309855830655f6ac4bcf31d8b5661
3,605,432
def filter_lines(filter_cmd, lines, attrs={}): """ Run 'lines' through the 'filter_cmd' shell command and return the result. The 'attrs' dictionary contains additional filter attributes. """ def findfilter(name,dir,filter): """Find filter file 'fname' with style name 'name' in directory ...
03c3cf2b49ba2785bcb8429091af5074d8caa136
3,605,433
def SPL(p): """Convert sound pressure to sound pressure level. Uses the standard reference value for airborne acoustics: 20 µPa. Note that the input is the pressure amplitude, not the RMS value. Parameters ---------- p : numeric, complex The complex sound pressure amplitude. Retur...
5ddcca44ab619aee04b55a98fb88ec957d451f7c
3,605,434
import os import errno def makedirs(path, *paths): """Join one or more path components, make that directory path (using the default mode 0o0777), and return the full path. Raise OSError if it can't achieve the result (e.g. the containing directory is readonly or the path contains a file); not if the ...
2645f2cc3b7503da95898c3b6dbb991c8ee24aa4
3,605,435
def compute_variants(linelist, anyonarray): """ Variant construction """ print('generating_variants ...') # generate variants of the poem df = pd.DataFrame(anyonarray) allpoemsidx = [] allpoems = [] allidx = [] nvariants = 0 for i in range(len(linelist)): ...
15931e3b39b39d012bb5bbe21ce371ed40510928
3,605,436
from itertools import islice import os def chooseData(): """ choose a file and show its content """ # tools.localization() file_name = '' data_name = '' data_path = '' dirs = os.listdir(app.config['UPLOAD_DIR']) if request.method == 'POST': file_name = request.form['submit'] ...
ca87fff5f4a4adf62c2cb6ccfc13e494a4fa7456
3,605,437
def boyer_moore_preprocessing(pattern, alphabet_size=4): """ Bad character rule used by Boyer-Moore algorithm: For each character x in the alphabet, let R(x) be the position of right-most occurrence of character x in P. R(x) is defined to be zero if x does not occur in P. """ R = [0] * alphabet_...
1d70891cfe0f0f55579c7a9349fb24d6954379fd
3,605,438
def get_basic_pm(transpiler_config: TranspileConfig, level: int = 0) -> PassManager: """ Get a pre-populated PassManager from the native Qiskit implementation. Args: transpiler_config (TranspileConfig): Configuration used to generate the tailored PassManager. level (int): Optional. ...
47d2dc6bc183192c686dbf68c484e7233bb3dea2
3,605,439
import os def unzip_file(src, target, clean=False, overwrite=False): """ unzip_file: str str bool -> str AND Effect --------------------------------------------------------------- Unzips the specified source file [src] if it is a zip file to a target directory or file [target]. Retu...
7257661a758ff1bb5a982338e6b08e708d4a3d94
3,605,440
def max_consecutive_sum(array): """ given an array of numbers (positive, negative, or 0) return the maximum sum of consecutive numbers """ max_value = max(array) running_sum = 0 for num in array: if running_sum < 0: running_sum = 0 running_sum += num if ru...
32e7322f8936f8399ec2ebe0702dbb10332cb529
3,605,441
import argparse def parse_outputs_option(outputs): """Parse value from CLI and validate all outputs are valid. Args: outputs (str): value gotten from CLI, e.g. "dots,excel". Returns: set: set of all parsed output handlers. """ if not outputs: return None requested_ha...
1c7b9b92c1208b382699d515ff6bc250233c0e1b
3,605,442
def _feature_importances(clf, FEATURES): """ finds and prints feature importances for given clf """ if hasattr(clf, "feature_importances_"): results = {} params = zip(FEATURES, clf.feature_importances_) for param, importance in sorted(params, key=lambda x: x[1], reverse=True): ...
96e218ec60c0a780624524187274a6a7e1ea61a7
3,605,443
from HHFtools.htccorrelations.seidertate import htc as htc_seidertate from HHFtools.htccorrelations.berglesrohsenow import get_T_onb from HHFtools.htccorrelations.berglesrohsenow import htc as htc_berglesrohsenow from HHFtools.htccorrelations.tong75 import get_wchf as wchf_tong75 def htc(water, geometry, ...
39478c381aa0ae81951b487d821e2743aaadb338
3,605,444
import os def estimateDG(parameters, cleanupClusterCentersAtStart=False): """ Estimates the absolute binding free energy using the parameters in the Parameters object. It copies the trajectory files from "folderWithTraj" into the current folder makes a certain number of iterations Docume...
e7dbb65b896bbf860e1f4af116c4418e3094dd8c
3,605,445
from datetime import datetime async def middleware(request: Request, call_next): """ Middleware is used to do tasks which are common to every API route request -> middleware -> actual api route -> response -> middleware -> modified response :param request: request to the API Server :param call_n...
edb580a71325ff0e41d14018a57b91b677329f8b
3,605,446
import os import fnmatch from pathlib import PurePosixPath def upload_files(client, source, destination, relative_directory): #exclude_files=[], #process_file=None, #process_directory=None, #process_conflict=False, #chunk_size=CHUNK_SIZE, #process_chunk=None, #timeout=None): """ Upload...
a241b7c77583efaf5c9c0d927feb04549babc842
3,605,447
def policy_defaults_to_floatx(): """Returns True if `global_policy()` will use the current value of floatx.""" return _global_policy is None and base_layer_utils.v2_dtype_behavior_enabled()
67237570b87ef78eb3e8a27fdecfef144835092c
3,605,448
import signal import subprocess def run_process(process_arg_list, on_interrupt=None, working_dir=None): """ This runs a process using subprocess python module but handles SIGINT properly. In case we received SIGINT (Ctrl+C) we will send a SIGTERM to terminate the subprocess and call the supplied callb...
75b53dc2b877791f37eb6f01669ea58a423a17e0
3,605,449
import os import logging import sys def set_up_logger(output_full_prefix: str, logging_level: str): """ Set up the logger for this utility. :param output_full_prefix: Full prefix to use for output files :param logging_level: Level of verbosity of logging object. :return: Returns the full path to...
5e294d547ce072215ef80b7eb93ed3d1cc9a7a4a
3,605,450
def _mask_for_bits(i): """Generate a mask to grab `i` bits from an int value.""" return (1 << i) - 1
53fc285225632cce34a74536a085cfe0af10300a
3,605,451
def getCurrentPackageDate(fileaddress): """Reads a given file and extracts the current dating of the linkkidata-package""" #setFile = reader(fileaddress) #Commented out for now #TODO: handle the setting file reading currentPackageDate = "3.9.2015" return currentPackageDate
9526abcdcd78f498b3192b0454ff574a37bdef8e
3,605,452
def is_column_based(fname, sep='\t', skip=0, is_multi_byte=False): """ Checks whether the file is column based with respect to a separator (defaults to tab separator). >>> fname = get_test_fname('test.gff') >>> is_column_based(fname) True >>> fname = get_test_fname('test_tab.bed') >>> i...
e88202cbe67703b63d1d7598946938a96da1fd8a
3,605,453
import urllib def _quote(s, encoding='utf-8'): """ Url quote as str. >>> _quote('http://example/test?a=1+') 'http%3A//example/test%3Fa%3D1%2B' >>> _quote(u"hello world!") 'hello%20world%21' >>> _quote('http://example/s=中文') 'http%3A//example/s%3D%E4%B8%AD%E6%96%87' """ if isin...
60ca1f098e0fb7359ef4a83badb2cc665e1803b4
3,605,454
def merge_idxs(src_idxs, dest_idxs): """Return source and destination index arrays, built up from smaller index arrays and combined in order of ascending source index (to allow us to convert src indices to a slice in some cases). """ assert(len(src_idxs) == len(dest_idxs)) # filter out any zero...
0c53dc55619ddf60eb1648c8e213d0c275cc806a
3,605,455
import random def random_int(min_num=1, max_num=200): """ return an int inclusively between min_nim and max_num :param min_num: :param max_num: :return: {int} a number """ return random.randint(min_num, max_num)
0c481f889f4a40e8a72a1efa44244e113f395168
3,605,456
import ctypes def read_dSdm(file_path, bdio_path='./libbdio.so', **kwargs): """ Extract dSdm data from a bdio file and return it as a dictionary The dictionary can be accessed with a tuple consisting of (type, kappa) read_dSdm requires bdio to be compiled into a shared library. This can be achieved by ...
b13608eec0fa0d61284a87ce6b531be04e873b01
3,605,457
import os import codecs import json def build_from_path(hparams, input_dirs, out_dir, mel_dir, linear_dir, pitch_dir, wav_dir, pinyin_symbols, n_jobs=12, tqdm=lambda x: x): """ Preprocesses the speech dataset from a gven input path to given output directories Args: - hparams: hyper parameters - input_dir: inp...
fe40a687e6381dfad7a20cb8548c01732ccf197c
3,605,458
import os import sys def gettestfiles(testdir=None, randomizer=None): """Get all test files from the passed test directory. If none is passed, use the default sdl test directory. """ if not testdir: testdir = os.path.dirname(__file__) if testdir not in sys.path: sys.path.append(tes...
64383d657f074f22d9193e49e3838ee6f4a8c290
3,605,459
from typing import Iterable from typing import BinaryIO def _plot(predictions: Iterable[BinaryIO]): """Plots predictions from a file. Parameters ---------- predictions Files containing predictions. """ return plot(predictions)
f52e2190273aa88558f5de654215853305e8f1c3
3,605,460
def get_train_sentences(vocabulary_size): """Get training sentences with word to index map and vice versa.""" sent1_train_indices, sent2_train_indices, word_to_index, index_to_word, label_train = get_train_data( vocabulary_size) all_sentences = [] all_sentences.extend(sent1_train_indices) al...
3748e2257a9a661cfeb25f74304210861da36292
3,605,461
from io import StringIO def extract_pandas_data_frames(remote_data): """ Skip convertin datetime related columns to datetime, cause pandas in case of all parsed rows is convertin type o column to datetime64 even dateparse returns datetime. If try to convert datetime64 to datetime using x.astype(da...
05a0bb33896cc98e4b18599803928ab429efb966
3,605,462
import ipaddress import anyio def main(**kwargs): """Console script for naps.""" network = ipaddress.ip_network(kwargs["network"]) anyio.run(schedule, network, kwargs["port_range_start"], kwargs["port_range_end"] + 1) return 0
901103a4b2e628598e12e2e9db34d3ae9cc568c9
3,605,463
def normalize_prefix(prefix): """ Removes slashes from a URL path prefix. :param str prefix: :rtype: str """ if prefix and prefix.startswith("/"): prefix = prefix[1:] if prefix and prefix.endswith("/"): prefix = prefix[:-1] return prefix
0db359f10fa213bf638fa3fca5bd58c530faf788
3,605,464
def hdf_file_path(tmpdir, test_data_dir): """This file contains the following: Object Tree: / (RootGroup) '' /cause (Group) '' /population (Group) '' /population/age_bins (Group) '' /population/age_bins/table (Table(23,), shuffle, zlib(9)) '' /population/structure...
bd68581f3174a80abaeef408ca844b9fbb6f7889
3,605,465
def capture(*args, **kwds) -> str: """\ Like `rich.console.Console.print`, but renders to a string. Yes, this is confusing because we already had `render_to_string`, which does something different -- I _think_ it's useful for intermediate renders that will eventually be given to `rich.console.Conso...
dbd0e7e3eb8923a8670b4d2f4496b92b6359d79a
3,605,466
from datetime import datetime def upgrade_trial(request): """ View that handles upgrading from a Free account to a Trial account. """ userprofile = request.user.userprofile if userprofile.account_level.level == 'Paid': messages.error(request, 'You already have a Paid account.') ...
43ed366ecc9ce11abb6ebdab8a092c148042f446
3,605,467
def stitch_image(mat1, mat2, overlap, side, wei_mat1=None, wei_mat2=None, norm=True, total_width=None): """ Stitch projection images or sinogram images using a linear ramp. Parameters ---------- mat1 : array_like 2D array. Projection image or sinogram image. mat2 : arr...
2bb65f533c9e2288f1632721a627491eacaf5e1e
3,605,468
def skeleton_binary(image, kernel=None, n=None): """ This operation reduces the foreground regions in a binary image to a skeletal remnant that largely preserves the extent and connectivity of the original region while throwing away most of the original foreground pixels. https://homepages....
e109469e249e40323203627ee6b24e96900aaff8
3,605,469
def predict_factor(h_abs, h_abs_old, error_norm, error_norm_old, prec): """Predict by which factor to increase/decrease the step size. The algorithm is described in [1]_. Parameters ---------- h_abs, h_abs_old : float Current and previous values of the step size, `h_abs_old` can be None ...
1b7ff5987fce3b9c03a3a88e1c192d9989a32358
3,605,470
def getRealPythonOrder()->str: """获取非虚拟环境的Python命令""" obj = getEnvXmlObj() node = obj.get_xpath_node('real/python3') return node.text
60a6a86525428f34223bc43e32e7f0f037a50107
3,605,471
from tensorflow.python.framework.graph_util import convert_variables_to_constants def freeze_session(session, keep_var_names=None, output_names=None, clear_devices=True): """ Freezes the state of a session into a pruned computation graph. Creates a new computation graph where variable nodes are replaced ...
00b2b63d7b2aa59d91f225d0257adbbebde182b5
3,605,472
from pm4py.statistics.ocel import objects_ot_count from typing import Dict def ocel_objects_ot_count(ocel: OCEL) -> Dict[str, Dict[str, int]]: """ Counts for each event the number of related objects per type Parameters ------------------- ocel Object-centric Event log parameters ...
6209e230dd688aa82e862c0b92e57037aaaa2d71
3,605,473
def apply_argmax(array, argmax, axis): """Apply precomputed argmax indices in multi dimension arrays array[np.argmax(array)] works fine in dimension 1, but not in higher ones. This function extends it to higher dimensions. Examples -------- >>> import cupy >>> array = cupy.random.randn(10,...
7d6168a4f610283b7b442c5b6e6a9c7f6a7e9089
3,605,474
def checkIfDuplicates_2(listOfElems): """ Check if given list contains any duplicates """ setOfElems = set() for elem in listOfElems: if elem in setOfElems: return True else: setOfElems.add(elem) return False
a7d9f322faefa4b0b0191ca96097bbf38c61ee3d
3,605,475
import sys import traceback import os def perform(input_image_source, log_level='info', output_file_prefix=None, skip_gaia_alignment=False): """Main calling subroutine Parameters ---------- input_image_source : str Search pattern to be used to identify images to process or the name of a text ...
d2fda93f8c6738e47ca01cc6fcaeb3aeca671664
3,605,476
def get_gpus(): """List of NVIDIA GPUs """ return _GPUS
c537c5cbb36d1d9e4df6450d2686423781397a61
3,605,477
from datetime import datetime def raw_to_session(timestamp): """ :param timestamp: <float> from time.time() output :return string in YYYYMMDDHHmmSS format""" t = datetime.utcfromtimestamp(timestamp) return t.strftime(SYNERGY_SESSION_PATTERN)
bf04ea331f7878b01c8adc2de48aaa48cbfd33b3
3,605,478
def gtex_position_translate(ens_gene_id,gtex_variants,tss,promoter_start,promoter_end,strand,promoter_before_tss,promoter_after_tss): """ Convert the GTEx data genome positions to those which can be mapped into the final figure. Reduce to those that are within range of the promoter before/after tss. """...
3f4c9de586975b788e38599793209700a5569708
3,605,479
def output_addresses(df, file_out): """ """ addresses = get_addresses(df) with open(file_out, 'w') as output: for address in addresses: output.write(address + '\n') return addresses
f15c0937e30e7bb76477e31d77da6c7fe7de1f4b
3,605,480
def qn(tag): """ qn is short for *qualified name*. Return fully qualified (Clark notation) tagname corresponding to short-form prefixed tagname *tag*. """ prefix, tagroot = tag.split(':') uri = nsmap[prefix] return '{%s}%s' % (uri, tagroot)
dbb09c62fb64118f10a84fe3cc6cdcfba9308c5a
3,605,481
def flow_to_image(flow): """ Convert flow into middlebury color code image :param flow: optical flow map :return: optical flow image in middlebury color """ u = flow[:, :, 0] v = flow[:, :, 1] maxu = -999. maxv = -999. minu = 999. minv = 999. idxUnknow = (abs(u) > UNKNO...
70ce644fb34af309cbf4498cb5f3eaa134409a9f
3,605,482
import platform def is_windows(): """ Check and return if running platform is Windows. Arguments: None Returns: bool """ return any(platform.win32_ver())
4c166c57d96c84bafa6750327b7481be584129e8
3,605,483
def riemann_metric(Y, laplacian, n_dim=None, invert_h=False, mode_inv = 'svd'): """ Parameters ---------- Y: array-like, shape = (n_samples, mdimY ) The embedding coordinates of the points laplacian: array-like, shape = (n_samples, n_samples) The Laplacian of the data. It is recommen...
d7eb4e013d22dd23436f56e2270162acf3934efb
3,605,484
def mk_co_eclip (lambda_str, beta_str,equinox=''): """ Create a coordinate in the Ecliptic coordinate system. By default, in J2000 equinox Args: lambda_str : Ecliptic longitude in angle units as string (e.g. "184d43m35.5s") [0,360) degrees beta_str: Ecliptic latitu...
5547ba2592dccc6b90cb1c7d8ac8a2f689936c87
3,605,485
def fib(n): """Assumes n int >= 0 Returns Fibonacci of n""" global fib_2_counter if n == 2: fib_2_counter += 1 if n == 0 or n == 1: return 1 else: return fib(n-1) + fib(n-2)
77717282869da8dc09032907ed81d2171877de36
3,605,486
async def root(): """ Default endpoint for testing if the server is running :return: Positive JSON Message """ return {"MLDatasetTemplate is Running!"}
17fccde4f21561a5166e39ca43df9e88539e0b2e
3,605,487
def load_CIFAR100_batch(filename, number): """ load single batch of cifar """ with open(filename, "rb") as f: datadict = load_pickle(f) # dict类型 X = datadict["data"] # X, ndarray, 像素值 Y = datadict["fine_labels"] # Y, list, 标签, 分类 # reshape, 一维数组转为矩阵10000行3列。每个entries是32x32 ...
98724d3cf6dc63c441ae2a0f6417e2fead682524
3,605,488
from datetime import datetime def parse_trioptics_metadata_mtflab_v5(file_contents): """Read metadata from the contents of a Trioptics .mht file. Compatible with MTF-Lab v5. Parameters ---------- file_contents : `str` contents of a .mht file. Returns ------- `dict` dicti...
07b7611f77b7097deec5efd970058e342d97a740
3,605,489
def get_details_format(s: str, lang: str = 'zh-cn'): """ Get API Request Parameters ---------- s: Company Name lang: Lang Returns ------- URL """ return "http://www.solvusoft.com/%s/file-extensions/software/%s/" % (lang, s)
4df1c9526febf2eadb9f6fe9d13d8b9615535aa2
3,605,490
def semiFixedComponentConstraintsNMF(W, H, iter, numIter, parameter): """Implements a simplified version of the soft constraints in [2]. References ---------- [2] Patricio López-Serrano, Christian Dittmar, Jonathan Driedger, and Meinard Müller. Towards modeling and decomposing loop-base...
be18460624d8ae319acdc3bb4d1a992b8bb5f954
3,605,491
def eis_process(data=None, freq_column=10, real_column=0, imag_column=1, area=5, threshold=5, min_step_length=5, export_data=False, save_dir='processed', **kwargs): """ Processes electrochemical impedance spectroscopy data Can either process pre-loaded data or load and process data files. If called with no argument...
6818cea62e3fb21ad61dac0672f1294c3ddee459
3,605,492
def create_admin_agent( client_args, client_id, req_processors, secure_train, server_args, federated_client: FederatedClient, args, is_multi_gpu, rank, ): """Creates an admin agent. Args: client_args: start client command args client_id: client name r...
d36e63db74190ac30cd256659999a9f3ae468f1d
3,605,493
def delete(context, key): """Delete a key from the current task context.""" return context.pop(key, None)
0b697ede943653ba41e7c50fff86907f93becee1
3,605,494
def login_user(request): """Logs the user in Retrieves the username and password provided by the user after validating the form. The username and password is authenticated, and if successful, the user is logged into the current session. If the authentication fails, or the form data provided ...
0f4eaa7974bf25fec30cec5b2302c42519f6053d
3,605,495
def matches_beginning(prefix: str, allowlist_key: str) -> bool: """" :param prefix: the value of the prefix query parameter :param allowlist_key: the key from :return: a bool of whether the prefix can be found on the allowlist. Both values are stripped of leading `/` before comparison. """ ...
ef047dfe16722d98b8fe894d3c400330a2defd74
3,605,496
def readstarmodel(starmodel_file, nmodeltype, quiet=False): """Usage: starmodel_wv,starmodel_flux=readstarmodel(starmodel_file,smodeltype) Inputs: starmodel_file - full path and filename to star spectral model smodeltype - type of model. 2==ATLAS Returns: starmodel_wv : wavelength (A) ...
7bb94f178d2a50e41e091240096c99b738e4038b
3,605,497
def gene_to_cds(feature, start, end=None, raise_error=True): """Map gene coordinates to CDS coordinates.""" result = [] for pos in gene_to_transcript(feature, start, end, raise_error=False): result.extend(transcript_to_cds(*pos.to_tuple(), raise_error=False)) if not result and raise_error: ...
6b0e3da826d387982b3de57e8c86e0ff1c45b0cc
3,605,498
def ExecuteFunction(function, *args, **kwargs): """Stub method so that it can be used for mocking purposes as well. """ return function(*args, **kwargs)
1b3d30c4053fe7b64f530d1c2e45518473c27b0e
3,605,499