content
stringlengths
35
762k
sha1
stringlengths
40
40
id
int64
0
3.66M
def svn_stream_set_skip(*args): """svn_stream_set_skip(svn_stream_t stream, svn_stream_skip_fn_t skip_fn)""" return _core.svn_stream_set_skip(*args)
9c93ca3d3907f2e6135b18f862707d83f703d33e
3,618,800
import json import yaml def load_manifest(filepath): """ Reads k8s manifest files and returns as string :param str filepath: filename of k8s manifest file to read :return: k8s resource definition as string """ with open(filepath) as handle: data = handle.read() try: mani...
bfe74d7369bcfa8f3392bd15a37be5432b81a08a
3,618,801
def regularize_layer_weighted(layers, penalty, tags={'regularizable': True}, **kwargs): """ Computes a regularization cost by applying a penalty to a group of layers, weighted by a coefficient for each layer. Parameters ---------- layers : dict A mapping from : tuple of class:`Layer` instances to coefficients. ...
e4de182b3e99ace5fd41c05d2a318fc865a6dd9c
3,618,802
def django_icon(name, color=None): """Add font-awesome icons in your HTML code""" return mark_safe( '<i class="di di-{name}" {color}></i>'.format( name=name, color='style="color:%s;"' % color if color else "" ) )
0e8f1ff0b0c7919376c6180b799ccba1aa53f70b
3,618,803
def xattr_del(xfile, xsetter): """ Remove extended file attributes Accepts a list/array with attrib names that are not prefixed with the 'user.' namespace """ for k in xsetter: try: xattr.removexattr(xfile, 'user.'+str(k)) except Exception as e: logthis("Faile...
148314c7e60f890431ca1b1788435f496194a3cc
3,618,804
def compressibility_drag_wing_total(state,settings,geometry): """Sums compressibility drag for all wings combined Assumptions: None Source: adg.stanford.edu (Stanford AA241 A/B Course Notes) Inputs: state.conditions.aerodynamics.drag_breakdown.compressible[wing.tag].compressibility_drag ...
ccc69d2d9690d5ce2c7dcd752cfde0a88ae484bb
3,618,805
def convert_df_2_string(df): """ Convert data frame rows to string output where each new line is defined as \n """ # ititialise string output = 'agent,wkt\n' for i, row in df.iterrows(): if i == len(df) - 1: output += str(row['label']) + ',' + str(row['geometry']) els...
c8d2717b72f875f0f4ae743a2cc6c82550221447
3,618,806
def remove_admin_auth_token(auth_token: str) -> bool: """ Removes an admin auth token. :param auth_token: The auth token to remove. :return: True/False indicating success of operation. """ try: query = db.session.query(AdminAPIKeyData) instance = query.get(ident=auth_token) ...
f3a4e941fa3d3568dcbf939121451e8ec82543d9
3,618,807
def Packet_genWriteBinaryOutput1(errorDetectionMode, buffer, size, asyncMode, rateDivisor, commonField, timeField, imuField, gpsField, attitudeField, insField): """Packet_genWriteBinaryOutput1(vn::protocol::uart::ErrorDetectionMode errorDetectionMode, char * buffer, size_t size, uint16_t asyncMode, uint16_t rateDiv...
e0131808ae3221c1abc0b7f767dc2f6ec3fdab40
3,618,808
def energy_window(lower, upper): """ Creates an eigenvalue weighting function that only takes into account eigenvalues in a certain energy window. :param lower: Lower bound of the energy window. :type lower: float :param upper: Upper bound of the energy window. :type upper: float """ l...
f7555038bac045ca0158a4aefd5296a146111f87
3,618,809
def svn_fs_upgrade(*args): """svn_fs_upgrade(char const * path, apr_pool_t pool) -> svn_error_t""" return _fs.svn_fs_upgrade(*args)
b043cbdcac7bf2267864be4287b0c8b023c1e40b
3,618,810
import argparse def parse_args(): """ Parse input arguments """ parser = argparse.ArgumentParser(description='Prepare MCG roidb') parser.add_argument('--input', dest='input_dir', help='folder contain input mcg proposals', default='data/MCG-raw/', type=st...
6291c448f90b5ac32610c2037ad9732f108783f5
3,618,811
def get_distance_map(img, bbox): """ img: croped image, PIL image (h,w,3) bbox: (x1,y1,x2,y2) bbox from annotation return: distance_map: numpy array of (h,w) with distance map in ECCV paper "Deep GrabCut for Object Selection" """ img_arr = np.asarray(img) distance_map ...
74f963c7570b70c13e66f03f812fa0aac90b689a
3,618,812
def make_channel_eroded_layer( name, layer_size, channel_width, edge_width, color_RGB=None, z_position=0.0, parent=None, material=None, **kwargs, ): """Create a 3D print eroded channel layer. Args: name (str): Name to give the object. layer_size (3-element tu...
8a1914244b7a28de19adee95e68f70a7221065d7
3,618,813
def deletealertrulebasedonip(ip, file_name=None): """ Deletes a Snort rule to alert based on traffic incoming from an ip address. Arguments: ip: String with an ip address. filename: String with a path to a Snort rule file. Passed directly to writerule. """ found = Fal...
a08f3b7645372c8e05ab6fbcb3faed6d84ccb0d6
3,618,814
def handle_piecewise_function(universe, x_values, fx_values): """ This function receives the universe and the values for x (`x_values`) and f(x) (`fx_values`). It generate new fx values for the given arguments, considering that it will fill the return np.array with zeroes for the f(x) of x that wher...
70546bc0e5da7699fa1d83a739794fbcd12c703b
3,618,815
def submit_new_experiment(): # TODO: start new experiment track """ Submit a new experiment action. 1. Retrieve the config from user's config table 2. Retrieve the csv to user's csv table x. Create ABEX Config y. Submit the ABEX experiment """ data = request.get_data() print(f"D...
1b75a9243c9bcd0811bc67e4174d17615f4dc9e8
3,618,816
import os def export_file(isamAppliance, instance_name, file_name, file_path, check_mode=False, force=False): """ Exporting a file in the API Access Control documentation root """ if os.path.exists(file_path) is True: warn_str = "File {0} already exists".format(file_path) warnings = [w...
b35b6d40e33dff1973abe295c22cacf844a8fbb9
3,618,817
def to_binary(x, num_bits): """Transform an array of floats into binary representation. Parameters ---------- x: ndarray Input array containing float values. The first dimension has to be of length 1. num_bits: int The fixed point precision to be used when converting to bin...
e6a413cf9ead03b858b82d5f60770955e206c195
3,618,818
import os def import_difmap_model(mdl_fname, mdl_dir=None, remove_last_char=True): """ Function that reads difmap-format model and returns list of ``Components`` instances. :param mdl_fname: File name with difmap model. :param mdl_dir: (optional) Directory with difmap model. If ``...
1b4a58191ffff382a18d2ed44cf018efe79d84af
3,618,819
def load_user_roles(user, roles): """ Loads user roles from keycloak to django on user login Args: user: (Not user. Could remove) user_name: user_name of user roles: List of keycloak roles Returns: None """ # Remove any existing roles that ar...
8f952197fcb4ab9c5cb89c80bfdc9c919cf6af91
3,618,820
def random_image(breed=None, subbreed=None): """Gets a random dog image. Returns a url as a string""" if breed == None and subbreed == None: return _get('breeds/image/random') elif subbreed == None: return _get('breed/{0}/images/random'.format(breed)) else: return _get('breed/{0}...
e40b229a2c3118cf09b7ebbb5a7b91e6c6ff7752
3,618,821
def get_calibration_info(): """ Gets the last modified date for any existing homography calibration files. """ camera_pairs_dict = redis_tools.get_dict(db,'camera_pairs_dict') calibration_info = mct_introspection.get_transform_2d_calibration_info() calibration_info_mod = {} for pairs_list i...
9967e9a0b8aa3063d627cc857286b86f0fca9620
3,618,822
def bold(string: str) -> str: """Add bold colour codes to string Args: string (str): Input string Returns: str: Bold string """ return "\033[1m" + string + "\033[0m"
ba47ccc0a2c514a60cdc751062169af9a3723e4c
3,618,823
import random import math def random_quat_biax(): """Return a random rotation quat for biaxial molecules.""" phi = random.uniform(0, 2*math.pi) ct = random.uniform(-1, 1) theta = math.acos(ct) # mozna tez -ct psi = random.uniform(0, 2*math.pi) quat = Quat.from_eulers(phi, theta, psi) ret...
0714c1d5d746cdf75eecf5ee847eb55b54772f72
3,618,824
from typing import Callable from typing import Any from typing import Union from enum import Enum def global_step_from_engine(engine: Engine) -> Callable: """Helper method to setup `global_step_transform` function using another engine. This can be helpful for logging trainer epoch/iteration while output handl...
bfd1c30d307e3db16a8c21138571fa75a363f47e
3,618,825
import pandas as pd def extract_lut_priors_from_atlas(atlas_file,contrast_name): """ Given an MGDM segmentation priors atlas file, extract the lut and identify the start index (in the file) of the contrast of interest, and the number of rows of priors that it should have. Returns pandas dataframe of lut, ...
f32c83382bb415d01e0ca4eefcd643441aa1f104
3,618,826
def load_environment(context, key, primary=True): """ Loads an environment dict from persistent storage. This helps get around the 8192 character limit in ECS Tasks. :param context: a aws_lambda_fsm.fsm.Context instance :param key: a str key as returned from store_environment :param primary: if...
2e7c8001af15bbcf6d9103b6e6c8916025a105e9
3,618,827
import operator def get_trans_co(x2ys, n_trans): """Use co-occurrences to compute scores.""" x2ys_co = dict() for x, ys in x2ys.items(): ys = [y for y, cnt in sorted(ys.items(), key=operator.itemgetter(1), reverse=True)[:n_trans]] x2ys_co[x] = ys return x2ys_co
390a5fde3274ec770e4d25becbbba726ea6804b7
3,618,828
from typing import Union from typing import Dict def replace( source: Union[list, set, str, tuple], var: Dict[str, Union[str, int, bool, float]] ) -> None: """ Various types of multi-replace. Parameters ========== source: typing.Union[list, set, str, tuple] string or list before being...
802aa8262ca399e3a21a193000c4fba6d11b9fb9
3,618,829
def constraints(logits, attributes): """ E[XZ] - E[X]E[Z] """ EPS = 1e-8 group_a = jnp.where(attributes > 0, logits, 0).sum() / (jnp.where(attributes > 0, 1, 0).sum() + EPS) group_b = jnp.where(attributes <= 0, logits, 0).sum() / (jnp.where(attributes <= 0, 1, 0).sum() + EPS) # correlation = jnp.where(attri...
6491b17cf4b48688023e7b556fc2f5c32ffe2199
3,618,830
from typing import List from typing import Any import random def shuffle_list(elements: List[Any]) -> List[Any]: """ Shuffle the input list in random order :param elements: List to be reshuffled :return: reshuffled list """ random.shuffle(elements) return elements
17a6520fce91e60f1cfe59d31736c2e5f50ded6f
3,618,831
def get_time_range(xml_path): """ Get the first and last timepoint present. Arguments: xml_path (str): path to the xml file with the metadata """ root = ET.parse(xml_path).getroot() seqdesc = root.find('SequenceDescription') tpoints = seqdesc.find('Timepoints') first = int(tpoints.f...
0e6c558dd63fdca3f39220f11d387cecf47210ae
3,618,832
def url_decode(string: str) -> str: """Decodes a url escaped string""" return __ulp.unquote(string)
8435507f048cd92fe7a59ec464e711c5c99bd723
3,618,833
import math def pool_output(shape, Kernel, Padding=(0, 0, 0), Stride=(1, 1, 1)): """ Z : depth Y : height X : width P : padding K : kernel """ Z, Y, X = shape Z_out = math.floor(((Z + 2 * Padding[0] - (Kernel[0] - 1) - 1) / Stride[0]) + 1) Y_out = math.floor(((Y + 2 * Padding[...
3506da0743289733df240b19416e42847f94e3d6
3,618,834
import os def get_channel_dir(channel): """ Returns the directory containing the channel data file(s) which is: - <self.base_dir>/input/data/<channel> Returns: (str) The input data directory for the specified channel. """ return os.path.join(INPUT_DATA_PATH, channel)
e8f5f6fb97a2f294dbb32e8846be83384ab39367
3,618,835
def run_riemannian_revolute_experiment( graph: RobotGraph, solver: RiemannianSolver, n_per_dim: int, D_goal, Y_goal, ee_goals: dict, Y_init: dict, T_goal=None, use_limits: bool = False, verbosity=2, do_bound_smoothing: bool = False, pose_goals: bool = False, ) -> pd.DataF...
169bf39ee742628e87d854eeb249f59fcf6a8f9b
3,618,836
from operator import and_ def reserve_vxlan(db_session, network_profile): """ Reserve a VXLAN ID within the range of the network profile. :param db_session: database session :param network_profile: network profile object """ seg_min, seg_max = get_segment_range(network_profile) segment_ty...
ef624e728585fe0782dadf3515ca8bfbe7022659
3,618,837
def _make_pink_noise(T,rms_normalization=False): """ Makes a segment of pink noise length T and returns a numpy array with the values Parameters ---------- T : int length of the pink noise to generate rms_normalization : float normalization factor for the pink noise, ie the rms ...
6a0f46caa23573a881ceec9506d29181f779b245
3,618,838
def merge_sort(array): """ ### Merge sort Implementation of one of the most powerful sorting algorithms algorithms.\n Return a sorted array, """ def merge(L, R): res = [] left_ind = right_ind = 0 while left_ind < len(L) and right_ind < len(R): if...
9f2101b0286525490aedce6d6f99962f5e6050f2
3,618,839
def add_paginate_all(method: str = 'page'): """Decorator that adds auto-pagination support, invoked by passing ``page='all'`` to the wrapped API function. """ def decorator(func): @wraps(func) def wrapper(*args, **params): if params.get('page') == 'all': retu...
d19c5a2d5235efe25538891e50e344f2ec001bf3
3,618,840
def meets_version(version, meets): """Check if a version string meets a minimum version. This is a simplified way to compare version strings. For a more robust tool, please check out the ``packaging`` library: https://github.com/pypa/packaging Parameters ---------- version : str Ver...
a1e3984315107a6ec824726e21cdfc5f43462f64
3,618,841
def get_model(cfg): """Gets the model class specified in the config.""" err_str = "Model type '{}' not supported" assert cfg.MODEL.TYPE in _models.keys(), err_str.format(cfg.MODEL.TYPE) return _models[cfg.MODEL.TYPE]
dca9aa79f562428192fd5d3cf55e2f3cbd798440
3,618,842
def shift_message(text: str, key: str, mode: str) -> str: """Perform the letter shifting for the polyalphabetic substitution cipher (e.g. Vigénere). Args: text (str): The string that is being shifted. key (str): The key used to shift the string. mode (str): The mode (either "encrypt" or...
995eb446303bb39e69f974d1d4e1e9ac4f902823
3,618,843
import urllib def get_train_infos(host_api, login, password, gare, depart): """Retrieve the data provided by the SNCF API. :param host_api: Host of the SNCF API, protocol (HTTP or HTTPS) more an IP or a domain name. :type host_api: str :param login: Login for the SNCF API. :type login: str ...
7a20f08586155f5a9d1e2ac2c0c6abbc56858d3f
3,618,844
def haproxy_username() -> str: """Retrieve the name of the user to use for authentication to the secure haproxy service.""" return _haproxy_username(scale_factor=1)[0]
d092e7d0db18e77c0f768e1819c2444c2657e56b
3,618,845
def hue_lite(rgb: np.ndarray, alpha: np.ndarray, beta: np.ndarray) -> np.ndarray: """色相の変更の適当バージョン。""" assert alpha.shape == (3,) assert beta.shape == (3,) assert (alpha > 0).all() ma = 3 / (1 / (alpha + 1e-7)).sum() mb = np.mean(beta.astype(np.float32)) return to_uint8(rgb.astype(np.float32...
25810d158b24a1854b25e150e9c0da18cc8768ce
3,618,846
from pathlib import Path from typing import Dict from typing import Any import json def get_wow_config(pricer_path: Path) -> Dict[str, Any]: """Gets the pricer config file.""" try: with open(pricer_path, "r") as f: path_config = json.load(f) except FileNotFoundError: logger.err...
15afe4f01fc224d55b26aaacb240cf28bede64a3
3,618,847
def materialize_computation_from_cache( factory_func, cache, arg_spec, **factory_kwargs): """Materialize a tf_computation generated by factory_func. If this function has already been called with a given combination of factory_func, arg_spec, and factory_kwargs, the resulting function proto & type spec wi...
392f914d0f6efb2aa5cd7dd754d9fb4a77fb8f6e
3,618,848
from pathlib import Path def extract_audio(file_path, format: str="wav"): """ Extract audio from video. Args: file_path: File path for the video clip. Returns: mv_audio_file: Audio file path extracted. """ print(f"Extracting audio from {file_path}") ...
d9e4ec18e479fafa521f478b21159418a6796bc4
3,618,849
def flash_message(message, category="message"): """flash message""" return flash(message, category)
3cc508c98db584bc13b2d4e9fa0796ab6f191fe2
3,618,850
def RectangleCommandAddLowerRight(builder, lowerRight): """This method is deprecated. Please switch to AddLowerRight.""" return AddLowerRight(builder, lowerRight)
e6ed04fccc8a6e38fc0f1d2fa1b5f1b37cf6a47b
3,618,851
def transform_row_into_list(row): """This function transform a row into a named tuple""" result = row.strip('\n').split(',') return result
7944bd2af1c06cbce44de63a14a856a8ce8699f1
3,618,852
def split_col_row(ref): """Split the letter and number components of a cell reference. Examples: >>> split_col_row('A1') ('A', 1) >>> split_col_row('B100') ('B', 100) >>> split_col_row('CC12') ('CC', 12) """ head = ref.rstrip("0123456789") tail = ref[...
ae236aa0521564958bd61643fbce932f1b8a2d99
3,618,853
def home(request): """render contact form if a form is submitted check if it is valid and save it """ ci = RequestContext(request) tmpl = {} if request.method == 'POST': form = MessageForm(request.POST) if form.is_valid(): message = Message( name=...
f0eaa62d86a6b64f1f4b3b8a26d390cdac3b483d
3,618,854
def returnModelFit(data, theta, **kwargs): """ Function to be fed into the MCMC. Input: 'data' : spectrum obj of data 'params' : parameters to synthesize a model with 'makeModel' Output: 'chi' : chi-squared fit between data and synthesized model """ params = kwargs.get('params') lsf = kwargs.get('ls...
c9514195c135b1cc08d7069f85aa7417c66b1bfc
3,618,855
from typing import List from typing import Dict def update_subjects(subjects: List[Dict[str, str]]) -> None: """ 更新subject """ url_path = "/api/v1/web/subjects" return _call_iam_api(http_put, url_path, data=subjects)
7deac59f89e7368d8cfbaca1914f5c93a8c48511
3,618,856
def get_mapping(from_file=None, resource_ids=None, pyrog_client=None): """ Get all available resources from a pyrog mapping. The mapping may either come from a static file or from a pyrog graphql API. Args: source_name: name of the project (eg: Mimic) from_file: path to the static f...
2001d35ae730073ec568241e2b06e881f3d63b3f
3,618,857
import json def channel_response_callback(container, channels): """ A callback to give back a canned response for regex matches in channels """ payload = container.payload logger.debug('channel response callback text: {}'.format(payload['text'])) logger.debug('channel response payload: {}'.for...
c1cda9b827a2250d777147b4b5a9b45093387c4b
3,618,858
from typing import List from typing import Optional from typing import Tuple from typing import Dict def featurize_training_examples( training_examples: List[Message], attributes: List[Text], entity_tag_specs: Optional[List["EntityTagSpec"]] = None, featurizers: Optional[List[Text]] = None, bilou_...
85bceb56d7634be3302792dc9abb30f85b0603df
3,618,859
import configparser import ast def configure_agent(filename): """ Configure Agent Core with configuration file specified by filename. :param filename: name of the configuration file needed to configure the Agent Core :type filename: str :return: Agent Core configured :rtype: AgentCore """...
6f697407562bb48a547b5d65d3713b3efc72497c
3,618,860
def load_fishcatch(): """Missing values were imputed with -1!""" module_path = dirname(__file__) data, target = load_data(module_path, 'fishcatch.csv', is_classification=False) return data, target
2a518286eef79620970d39ada546c0de5039e1a1
3,618,861
def ClassifyRspecifier(rspecifier): """Interprets type / filename / options for the given rspecifier. Args: rspecifier: A string indicating the rspecifier. Returns: (RspecifierType, filename, RspecifierOptions) for the given filename. Note: We also allow the meaningless prefix...
93648454ecf33eed9aa2069cea06888d44ea1cfa
3,618,862
def cross_validation(x_tra, y_tra): """ The method performs 5-fold cross-validation on training data and returns the error rates. Parameters ---------- x_tra: features of training data y_tra: labels of training data """ errors = [] maes = [] pcc = [] X = x_tra Y = y_tra...
e3d6ccc0976fc698267b0af1504769c375df1965
3,618,863
import numpy def lduG(G): """ G a Cell object containing AtA + rhoI matrices. The A matrices are the PSF matrices, I is the identity matrix and rho is the ADMM timestep. """ nr, nc = G.getCellsShape() mshape = G.getMatrixShape() assert (nr == nc), "G Cell must be square!" nmat = ...
9b022166321028bc0b65da68251e7e1cae1f0c15
3,618,864
def generate_test_input(name, test_class): """Generate the test input for @J2clTestInput. This will triggers processing the test class. Args: name: target name. test_class: the test class to be processed. Returns: J2clTestInput java src file which will be used to generate adapt...
0b5f674432971ee9cdaa90028277f74b567b6177
3,618,865
def drive_needs_mounting(mapper_device): """ Check if an encrypted drive can be mounted directly. :param mapper_device: The pathname of the device mapper device (a string). :returns: ``True`` if the drive should be mounted, ``False`` otherwise. """ if any(fs.device_file == mapper_device for fs ...
7d5ca41704825b3b5802efe1d79ac3a62ada1032
3,618,866
import re def check_if_string_in_file( file_name: str, string_to_search: str, search_flag: int = 0 ) -> bool: """Check if any line in the file contains given string""" with open(file_name, "r") as read_obj: file_data = read_obj.read() if re.search(string_to_search, file_data, flags=search_...
e47899377daecc7a47adb0f79920a06de15fe8d8
3,618,867
def single_performance_metric(actual, predicted): """Weighted F1_score Arguments: actual: numpy array --> Array containing actual labels. predicted: numpy array --> Array containing predicted labels. Returns: f1_score: float --> Weighted F1_score. """ return f1_score(actua...
08b88ee7e7e963418d41a2db52f3cec1dbf2d788
3,618,868
def conformalset(X, y, model, alpha=0.1, gamma=None, tol=1e-3, nqp=10, algo=None, stat=False): """ Compute full conformal prediction set with root-finding solver. Parameters ---------- X : {array-like}, shape (n_samples, n_features) Training data. y : ndarray, shape = (n_sa...
d3e8b3fc9d2ca2910e17a11b1219f1ae5b928d13
3,618,869
def indentlevel(line): """Return the indent level of a line""" m = re_indent.match(line) if not m: return 0 return len(m.group(0))
9c2ec938901f5b86bb46014ef8252f96839d2cdf
3,618,870
import numpy def approximate_moment( distribution, k_loc, order=None, rule="fejer", **kwargs ): """ Approximation method for estimation of raw statistical moments. Uses quadrature integration to estimate the values. Args: distribution (Distribution): ...
7a7a1250074a6abd0e5daebd56971c538cc15388
3,618,871
from typing import List def get_projects_from_sln_file(path: str) -> List[str]: """ Gets the projects defined in a sln file. :param path: The path of a Visual Studio sln file. """ with open(path, "r", encoding="utf-8") as file: return list(get_projects_from_sln_file_contents(file.read()))
47fb2b14b149667b0345071f7a73f748905e8253
3,618,872
def get_bar_yz_transform(v, ihat, eid, n1, n2, nid1, nid2, i, Li): """helper method for _get_bar_yz_arrays""" vhat = v / norm(v) # j try: z = np.cross(ihat, vhat) # k except ValueError: msg = 'Invalid vector length\n' msg += 'n1 =%s\n' % str(n1) msg += 'n2 =%s\n' % str(...
4fbc8125c9dbd7054589d1bbb79f801a76c3a090
3,618,873
from .. import pcomp from ..pydlutils.math import computechi2, djs_reject import time def pca_solve(newflux, newivar, maxiter=0, niter=10, nkeep=3, nreturn=None, verbose=False): """Replacement for idlspec2d pca_solve.pro. Parameters ---------- newflux : array-like The input spec...
554a804caf0e2e614916e67b7ffce766e3bed2b5
3,618,874
import os import yaml def list_models(): """ list model zoo """ zoo_config = os.path.join(model_zoo_path) zoo_config = yaml.load(open(zoo_config, 'r'), Loader=yaml.FullLoader) custom_zoo_config = yaml.load(open(custom_zoo, 'r'), Loader=yaml...
f39823ad68876c3108c9803a597b28cd9f871fbc
3,618,875
def extract_post_info(browser): """Get the information from the current post""" post = browser.find_element_by_class_name('_622au') print('BEFORE IMG') imgs = post.find_elements_by_tag_name('img') img = '' if len(imgs) >= 2: img = imgs[1].get_attribute('src') likes = 0 if len(post.find_elements...
2113d1ab3ff05be05f164b564f96c3e9d456b8fb
3,618,876
import os import subprocess def fact(): """Returns the Node.js version if installed""" version = "None" binary = "/usr/local/bin/node" if os.path.exists(binary): try: cmd = [binary, "--version"] proc = subprocess.check_output(cmd) version = proc[1:].strip() ...
70f889448128b18ca611b0ac1a4766e038cd3f33
3,618,877
def TL2Q(T=None, L=None): """ Compute Q from angle and wavelength. Q = 4 pi sin(T) / L Returns Q in inverse Angstroms. """ return 4 * pi * sin(radians(T)) / L
aaa42d4624901f003ae8a1821d12bae64a3c5261
3,618,878
def StationGroup_Meta(): """StationGroup_Meta() -> MetaObject""" return _DataModel.StationGroup_Meta()
9b1ef8377359018f311fe42af6f0b9f920bfea63
3,618,879
def query_identifiers( object_type, object_ids, db_from, db_to, max_separation=3 ): """Return id for given metabolite from the corresponding database. :param object_type: The type of the object, e.g. Metabolite, Gene or Reaction. :param object_ids: list of identifiers :param db_from: databa...
3c83ddee4174b5f78b95bcb5dc81e70634465c10
3,618,880
def MROMerge(input_seqs): """Merge a sequence of MROs into a single resulting MRO. Args: input_seqs: A sequence of MRO sequences. Returns: A single resulting MRO. Raises: MROError: If we discovered an illegal inheritance. """ seqs = [Dedup(s) for s in input_seqs] try: return visitors.Me...
f51c4c7e9ba825f9e0e776b35b3d93b6bab3741b
3,618,881
def handCard(handPos, game): """ Return the value of indexed card in player's hand :param handPos: :param game: :return: """ return game.players[game.whoseTurn].handCards[handPos]
a5556b37f9f220b1f2a42ab95ef8743dac67f735
3,618,882
def create_config_file(config): """Create config file with given contents.""" with open(conf_file_name, 'w') as conf_file: conf_file.write(config) return conf_file_name
7bd1d29c5d9930992f17d3e834c98b78f163a2c8
3,618,883
def countHostBits(binaryString): """ This will calculate the number of host bits in the mask """ # count the number of 0s in the subnet string return binaryString.count('0')
f86ca0131470e33b3a83350b2b58bc4621a07574
3,618,884
def diskthick(): """ A test procedure to demonstrate the KinMS code, and check if it works on your system. This procedure demonstrates how to create a simulation of an exponential disk of molecular gas with a thickness that varies with radius. Any default parameters can be changed by specifying them at ...
962eb7583358815e51a8e8f7b38d833537008ef2
3,618,885
from typing import Optional def _serve_logs(skip_serve_logs: bool = False) -> Optional[Process]: """Starts serve_logs sub-process""" if skip_serve_logs is False: sub_proc = Process(target=serve_logs) sub_proc.start() return sub_proc return None
0281197ae1721740b49790278db8982f9eadc0a5
3,618,886
def sincos_func(x_data, a, b): """ Computes the function a * sin(b * x) + b * cos(a * x) Args: x_data : A Numpy array of input data a : Real-valued argument of the function b : Real-valued argument of the function Returns: A Numpy array of values of the function a * sin(b * ...
68a08cb0fac1e24e02d553b7a7a22ab40e280aa0
3,618,887
def build_model_modified_field_list(queryset): """ Setup the field list for a 'modified' api query, add any Foreign Key field names """ fields = list() fields.append('id') fields.append('modified') if not queryset: return fields try: for field in queryset.model._meta.local_fie...
6a004ec17f03ad7a96ee6ff0f3cf543a3e525465
3,618,888
def convert(md_text): """ Convert markdown string to html format :param md_text: str, the markdown file :return: str, the html content """ # separate by line md_text = md_text.split('\n') # save the html content for return html_text = '' # begin looping from the first line ind...
052379c05cabd1d5e33e555da7a7bfe9147f82d4
3,618,889
from typing import Union from typing import Dict def interpolate_model(cat_file: str, names: Union[str, list]) -> Dict[str, np.ndarray]: """Interpolates 2D model field into dense Cloudnet grid. Args: cat_file: Categorize file name. names: Model variable to be interpolated, e.g. 'temperature' ...
ba2875fbdadbd9f137d7a72eed628501ed478623
3,618,890
def should_retry_request(req): """ Whether should retry this request. :param request: Request as a dictionary. :returns: True if should retry it; False if no more retry. """ if req['state'] == RequestState.SUBMITTING: return True if req['state'] == RequestState.NO_SOURCES or req['st...
112295ec286ae9deb9164ed6b49b315526347416
3,618,891
def getSiteStore(store): """ Given C{store} find the site store. """ siteStore = store while siteStore.parent: siteStore = siteStore.parent return siteStore
f6ee30355c8f78f12a45b5e58bea8ad96ff6a960
3,618,892
def fit_aerofoil(xy, chi, zte, order): """Fit Bernstein polynomial coefficients for both aerofoils surfaces.""" n = order - 1 dx = 0.02 # When converting from real coordinates to shape space, we end up with # singularities and numerical instability at leading and trailing edges. # So in these ca...
694d77b755ea03889011e712afe7940174d031ab
3,618,893
from typing import List def process_stocks(list_of_stocks: List[str], period: str = "3mo") -> pd.DataFrame: """Get adjusted closing price for each stock in the list Parameters ---------- list_of_stocks: List[str] List of tickers to get historical data for period: str Period to get...
fa3bcf2f440203f2bd0e5c75fa17b80a7a48c5a4
3,618,894
import gzip def get_file_handle(file_path, compression): """ Returns a file handle to the given path. :param file_path: path to the file to open :param compression: indicates whether or not the input file is compressed :return: a file handle to file_path """ if compression: return...
44c97b211c4b44679934eede62845c58947c4091
3,618,895
def solve(firewall): """Return severity if the trip through the firewall. :firewall: list of depth and range of the scanner (separated by a colon) for each layer (separated by newline) :returns: severity of a trip >>> solve('''0: 3 ... 1: 2 ... 4: 4 ... 6: 4''') 24 "...
01d8f2af59cfacde1e36f9014ceaa2083ebc0df9
3,618,896
import resource def cputime(t=0, subprocesses=False): """ Return the time in CPU seconds since Sage started, or with optional argument ``t``, return the time since ``t``. This is how much time Sage has spent using the CPU. If ``subprocesses=False`` this does not count time spent in subprocesses s...
a4899cc51a3a5a3c82d4733ecb76f012e92d4c93
3,618,897
def toggle(request, segment_id): """Toggle the status of the selected segment. :param request: The http request :type request: django.http.HttpRequest :param segment_id: The primary key of the segment :type segment_id: int :returns: A redirect to the original page :rtype: django.http.HttpRe...
423777c1cc6f89fd47988df19ec856e6248ec0ff
3,618,898
def _maketrans_c(arg1, arg2, delete=False): """Make a complement tr table for the 'c' flag. If the 'd' flag is passed, then delete=True. Ranges are expanded in arg1 and arg2 but arg2 is not otherwise normalized""" t = str.maketrans(arg1, arg1) d = dict() for i in range(257): if i not in t: ...
75cbc9c0d4df62736c4ae9d04f940d4e7104d77a
3,618,899