content
stringlengths
35
762k
sha1
stringlengths
40
40
id
int64
0
3.66M
def afwd(data): """ AFWD - Request 4WD status """ return data
47823c8e8d306c8fc84eea20ad703bc997498049
3,627,242
import hashlib def create_timestamp_anti_leech_url(host, file_name, query_string_dict, encrypt_key, deadline): """ 创建时间戳防盗链 Args: host: 带访问协议的域名 file_name: 原始文件名,不需要urlencode query_string_dict: 查询参数,不需要urlencode encrypt_key: 时间戳防盗链密钥 dead...
3d7a57ff84e81366089ea0084498322338944bfa
3,627,243
def centroid_points_xy(points): """Compute the centroid of a set of points lying in the XY-plane. Warning ------- Duplicate points are **NOT** removed. If there are duplicates in the sequence, they should be there intentionally. Parameters ---------- points : list of list A seq...
8da6c4154ff0632942108f9b63240c86438f3eb4
3,627,244
def driver(tag): """ Determine driver module :Parameters: `tag` : ``str`` Connection tag :Return: Driver module :Rtype: ``module`` :Exceptions: - `DBConfigurationError` : DB not configured - `KeyError` : DB name not found - `ImportError` : Driver not found ...
74e2a1164c73f6ce35afc040b9ef984bef3741c6
3,627,245
def should_force_reinit(config): """Configs older than 2.0.0 should be replaced""" ver = config.get("cli_version", "0.0.0") return int(ver.split(".")[0]) < 2
12b704fe2f3d2ef7cedf497a4a2e3a92321f52b2
3,627,246
def _import_package(*args, **kwargs): """ Import modules and things from a package """ package_name = kwargs['package_name'] if PACKAGES[package_name] is None: if len(args) < 2: return None return (None for _ in args) module = kwargs.get('module') modules = [] for ...
10b99a766159135237b2adcf480fdb2c13b3667d
3,627,247
def check_tag_list(tag_list): """ Makes a list of any tags entered on the command line. """ tags = [] if len(tag_list) != 0: tags = tag_list[0].split(",") return tags
24fb7d5c1f408ef9825a8efb461dc88483dcba9e
3,627,248
def tipo_cambio_agregar(): """ Agregar nuevo registro a 'tipos_cambio' """ form = SQLFORM(db.tipos_cambio, submit_button='Aceptar') if form.accepts(request.vars, session): response.flash = 'Registro ingresado' return dict(form=form)
f43bc0d5fafd1323c19c87d59af0f7d0ab4c9648
3,627,249
def start_uploading(main_pid): """ Start the process of uploading stdout/stderr """ process = Process(target=upload_stdout_stderr, args=(main_pid,)) process.start() return process
ff35189181a1604bb5b2ebfe98257f3dc64e75c1
3,627,250
import json from datetime import datetime def accounts_post(**kwargs): """ add new account and set first transaction with rests of money """ obj = json.loads(request.data.decode('utf-8', 'strict')) new_account = Account( title=obj['title'], currency_id=int(obj['currency.id'])) ...
caf2ed6aa6abddc9455f24d57a9d82b8da6bc257
3,627,251
def labels_to_image_model(labels_shape, n_channels, generation_labels, output_labels, n_neutral_labels, atlas_res, target_res, output_shap...
3d6b93cc011351a6d063fe851c2b2a9b94eb28eb
3,627,252
from typing import Optional async def unpack_from_prior_in_place( message: dict, resolvers_config: ResolversConfig ) -> Optional[DID_URL]: """ Unpacks from_prior field within a given message from JWT (compactly serialized JWS with claim set) if the message contains from_prior. In result, the messa...
38ea89e2c0867ae636de2d09aca6e48090331c42
3,627,253
def remove_leading_character(string, character): """ If "string" starts with "character", strip that leading character away. Only removes the first instance :param string: :param character: :return: String without the specified, leading character """ if string.startswith(character): ...
4af4d6f86b9a6ed8975c4564904d2e1ca9e6d15a
3,627,255
def _rfind(lst, item): """ Returns the index of the last occurance of <item> in <lst>. Returns -1 if <item> is not in <l>. ex: _rfind([1,2,1,2], 1) == 2 """ try: return (len(lst) - 1) - lst[::-1].index(item) except ValueError: return -1
ab165a6795b0a495d24288d8e757c16ba9c968a4
3,627,256
def plot_all_continuous_efficiency_with_diefk(diefkDF: np.ndarray, colors: list) -> list: """ Generate radar plots that compare dief@k at different answer completeness in a specific test as in <doi:10.1007/978-3-319-68204-4_1>. This function plots the results reported in "Experiment 2". "Experiment...
f856a3fa498efefc886b40ddce5b7cb24a60c1be
3,627,257
from typing import Optional def measure_int_interval(interval: Interval[int]) -> Optional[int]: """Return the size of the integer interval.""" if interval.lower_bound is None or interval.upper_bound is None: return None if interval.is_empty(): return 0 return interval.upper_bound - int...
33b83b1737d1e2037fc4bca1c8467cdcdcd2fab2
3,627,258
def get_case_statuses(read_only): """ Get a list of the case statuses that are read-only. """ if read_only: return CaseStatusEnum.read_only_statuses() else: return [status for status, value in CaseStatusEnum.choices if not CaseStatusEnum.is_read_only(status)]
024c6f42f5049e32d7d14f9abc895e561ff444b2
3,627,259
def laggauss(deg): """ Gauss-Laguerre quadrature. Computes the sample points and weights for Gauss-Laguerre quadrature. These sample points and weights will correctly integrate polynomials of degree :math:`2*deg - 1` or less over the interval :math:`[0, \\inf]` with the weight function :math:`f...
8261ee7883158f7f01eba4951341d1d6e25aadac
3,627,260
def list_uiactions(content, request=None, registry=None, category=''): """ List ui actions for specific content """ if request is not None: registry = request.registry url = request.resource_url(content) else: url = '' actions = [] for name, action in registry.adapters.looku...
cb88d0fb86ea0487674f76896f604532796173d9
3,627,261
def create_singularity_cmd(args): """Function that creates and returns the BIDS App singularity run command. Parameters ---------- args : dict Dictionary of parsed input argument in the form:: { 'bids_dir': "/path/to/bids/dataset/directory", 'output_...
1330d7bcdb70fd7194b14395bbaacfbc92a37650
3,627,262
def define_index(min_date: int, max_date: int, interval: str) -> int: """ Return the index of a specific date """ interval_minutes = constants.TICKER_INTERVAL_MINUTES[interval] return int((max_date - min_date) / (interval_minutes * 60))
06dd1a70da23349d04a4a199410118c7e51722c6
3,627,263
def map_box(sbox, dbox, v): """ sbox is (lat1, lat2, long1, long2), dbox is (x1, x2, y1, y2), v is (lat, long). result is (x, y) """ xscale = abs(dbox[1]-dbox[0])/abs(sbox[3]-sbox[2]) yscale = abs(dbox[3]-dbox[2])/abs(sbox[1]-sbox[0]) x = (v[1]-sbox[2]+dbox[0])*xscale y = (v[0]-...
de1cb095d03eacc4930f37a05c5b01ebd983baca
3,627,264
def clash_iter(atoms, min_clash=0.4, radii_attr='radius'): """ Returns an iterator over pairs: -clash value -the pair of clashing atoms min_clash. """ max_radii = max([getattr(a, radii_attr) for a in atoms]) gridhash = GridHash([(a.coordinates, a) for a in atoms], max_radii*2 - m...
b07cd7e5368c3c0102fe5db04553c8ae63b4b6f2
3,627,265
def recognize_po_file(filename: str) -> bool: """ Recognize .po file """ if filename.endswith(".po"): return True return False
9993e1d0f1a45f1ce60709650a7381df00ebdce0
3,627,266
def circle_xy(x0, y0, r0): """ To obtain cartesian coordinates of a circle @param x0: float x coordinate of the center of the circle @param y0: float y coordinate of the center of the circle @param r0: float radius of the circle @return: np.array([float]),np.array([float]...
561db75a9e6aaf7c912921137d49689a19e47610
3,627,267
from typing import List def _build_dev_requirements() -> List[Requirement]: """Load requirements from file.""" with open(REQUIREMENT_PATH, "rt") as req_file: return list(parse_requirements(req_file.read()))
f4e253819459c8f249b3d779f2a01b54d26ea0ca
3,627,268
from bs4 import BeautifulSoup def scrape_video_menu(url): """ Scrape videos from url Args: url (str): url to scrape from (e.g. https://www.exploratorium.edu/video/subjects) Returns TopicNode containing all videos """ LOGGER.info("SCRAPING VIDEOS...") video_topic = nodes.Top...
394bf809c828b2c0816bf056ea91d459cb2dd881
3,627,269
def multiply_nums(n1, n2): """Function to multiplies two numbers. n1 : Must be a numeric type n2 : Must be a numeric type """ result = n1 * n2 return result
05549b4780fec2e2ba14719ebbb93e45491710e7
3,627,270
from typing import Optional import textwrap def _get_setup( benchmark: GroupedBenchmark, runtime: RuntimeMode, language: Language, stmt: str, model_path: Optional[str] ) -> str: """Specialize a GroupedBenchmark for a particular configuration. Setup requires two extra pieces of information...
1b1461a35d4be46bda42d401fad2580fdcbac261
3,627,271
from sense_hat import SenseHat async def read_temperature(request: web.BaseRequest): """ Request handler for retrieving local sensor data. Args: request: aiohttp request object """ context = request.app["request_context"] sense = SenseHat() temperature = sense.get_temperature() ...
0d40d6d577d8d5ff247e9311062ab65510c2ec08
3,627,273
def expressions(): """Return a sequence of test expressions.""" A = Lambda('a') X = Lambda('x') Y = Lambda('y') Z = Lambda('z') XA = Lambda(X, A) XY = Lambda(X, Y) XZ = Lambda(X, Z) YZ = Lambda(Y, Z) XYZ = Lambda(XY, Z) xX = Lambda('x', X) xyX = Lambda('x', Lambda('y', X)...
98f8fd1bae29bf20cc27ad2022d1c0a4d7118f2b
3,627,274
def misc_tasks_to_goals(real_goals, misc_goals, extra_time=0): """ Converts misc-goal tasks into goals for themselves. That is, each task is a goal for itself consisting of only one task (itself). Args: real_goals: [Goal] representing real goals misc_goals: [{node}] representing mis...
6cd2653b047e23c6b5bbdbf47516d4d0700af12b
3,627,275
def normalize_timedelta(val): """ produces a normalized string value of the timedelta This module returns a normalized time span value consisting of the number of hours in fractional form. For example '1h 15min' is formatted as 01.25. """ if type(val) == str: val = parse_timedelta(v...
c004f5bf8d11c0f71b058e080100fea2d0529061
3,627,276
def up_to(s, i, c): """Il faudrait commenter, je ne sais plus ce que ça fait.""" t = [] k = i while s[k] != c: t.append(s[k]) k += 1 return "".join(t)
ec4ffc90949b3b66c74c52a0019981564ace8aef
3,627,277
def main(): """CollatzPy CLI""" return 0
51f497ce25f4e90da4f0178510ba25d568edfc0b
3,627,278
def bf_get_users(selected_bfaccount): """ Function to get list of users belonging to the organization of the given Blackfynn account Args: selected_bfaccount: name of selected Blackfynn acccount (string) Retun: list_users : list of users (first name -- last name) associated with the o...
8fd449f6692d2dbe3b54c6bafa26473f65fbd2a8
3,627,279
def load_service(service: str, version: str = None, model_type="service-2") -> ServiceModel: """ For example: load_service("sqs", "2012-11-05") """ service_description = loader.load_service_model(service, model_type, version) return ServiceModel(service_description, service)
8a42cba607a07a6ee81f0ac43438166aa024dc40
3,627,280
def _kv_to_dict(meta): """Transform a list with key/value strings into a dictionary. """ try: return dict(m.split("=", 1) for m in meta) except ValueError: raise _errors.MachineError("Invalid parameter (%s)." % (meta, ))
93ab5ff6d1bd092f6ad0ae4d5a9e071db4caf3a3
3,627,282
def _flip_row_coordinates(move): """Flips a coordinate of a move horizontally. Args: move: row, col index or None if pass move Returns: Horizontally flipped move if move was not None """ if move is None: return move row, col = move row = go.BOARD_SIZE - 1 - row ...
cc89be66ba6de140ffb8d13ad669690b53429d61
3,627,283
def faultReturnHandler(func): """ Handles functions with return. Decorated function returns erro message if something went wrong. """ @wraps(func) def wrapper(*args, **kwargs): try: return func(*args, **kwargs); except Exception as error_message: ...
75a18e45bc6d734571ee118dd8fa9cd8d64a9feb
3,627,284
def tag_t_offset_compare_key(): """ Convert a tag_t_offset_compare function into a key=function This method is modeled after functools.cmp_to_key(_func_). It can be used by functions that accept a key function, such as sorted(), min(), max(), etc. to compare tags by their offsets, e.g., sorted(t...
e6d6f82421face3f709045a41315490e5a0302dd
3,627,285
from pyscf.nao.m_ao_matelem import ao_matelem_c def comp_coulomb_den(sv, ao_log=None, funct=coulomb_am, dtype=np.float64, **kvargs): """ Computes the matrix elements given by funct, for instance coulomb interaction Args: sv : (System Variables), this must have arrays of coordinates and species, etc ...
a8cf0bc871271a03d9b5c09ef5b30ed8c7195ede
3,627,286
def dmp_gcd(f, g, u, K): """ Computes polynomial GCD of `f` and `g` in `K[X]`. Examples ======== >>> R, x, y = ring("x y", ZZ) >>> f = x**2 + 2*x*y + y**2 >>> g = x**2 + x*y >>> R.dmp_gcd(f, g) x + y """ return dmp_inner_gcd(f, g, u, K)[0]
20591ac511f83da5bfa145145807d2001d8b8cd7
3,627,287
import gettext def preferences(): """Render preferences page && save user preferences""" # save preferences if request.method == 'POST': resp = make_response(redirect(urljoin(settings['server']['base_url'], url_for('index')))) try: request.preferences.parse_form(request.form) ...
a4afe0d5728709ab5550d3cf58a8e56420003646
3,627,288
def freq2lin(freq_hz): """Compatibility hack to allow for linearly spaced cosine filters with `make_erb_cos_filters_nx`; intended to generalize the functionality of `make_lin_cos_filters`. """ return _identity(freq_hz)
7f65e09f2223b29355afa26cef282e98e536d41b
3,627,289
import zipfile import json def _GetVersionFromCrx(crx_path): """Retrieves extension version from CRX archive. Args: crx_path: path to CRX archive to extract version from. """ with zipfile.ZipFile(crx_path, 'r') as crx_zip: manifest_contents = crx_zip.read('manifest.json') version = json.loads(man...
e6b612f94b0fa4e62f5ecb8df297a6255294ec5f
3,627,290
def get_fuzzy_continuous_sets(divisions, point_set_method='point_set'): """Generate a list with the triangular fuzzy sets of a variable of a DataFrame given the peaks of the triangles Parameters ---------- divisions : list List of tuples with the names of the sets and the peak of the tr...
16d776625679319ad44da4b96af5ac888294ea59
3,627,291
def angle_distance_degree(deg1: float, deg2: float) -> float: """ Return the distance between angles. :param deg1: the starting angle, in degrees. :param deg2: the ending angle, in degrees. :return: the distance in range [-180, 180] """ return _s_dist(deg1, deg2, 360)
40c7767ff7d64ea77c1a546d4087fcb4cda5328e
3,627,293
def _get_transf_matrix(n: int, transform_type: str, dec_levels: int = 0, flip_hardcoded: bool = False) -> (np.ndarray, np.ndarray): """ Create forward and inverse transform matrices, which allow for perfect reconstruction. The forward transform matrix is normalized so that the l2-...
e4d3740f7ae1cc9e57190dc423f3de60822c2233
3,627,294
from typing import OrderedDict def get_hierarchical_data_for_apps(apps): """ Return a hierarchical data structure consisting of nested OrderedDicts for all data collected for apps listed in `apps`. The format of the returned data structure is: ``` { <session_1_code>: { 'code':...
79ea7e411843cf7541d35aad6f8f654fe14d1e0f
3,627,295
from typing import Optional from typing import List def get_available_source_annotations(doc: Optional[str] = None, docs: Optional[List[str]] = None) -> List[str]: """Get a list of available annotations generated from the source, either for a single document or multiple.""" assert doc or docs, "Either 'doc' o...
f8f07a5cb2a1bb5ce7793d18931343e34f72f79c
3,627,296
def get_GEOS_data_folder4dt(dt=None, product='GEOS_CF', host=None, mode='fcast', collection='inst3_3d_aer_Np', inc_collection=True): """ Get the data folder location for a given GEOS product and datetime """ # Where is the data for the product? ...
ae8e9d8484937b999fc96f3968ae0b9efe32c83a
3,627,297
import hashlib def safe_md5(open_file, block_size=2**20): """Computes an md5 sum without loading the file into memory This method is based on the answers given in: http://stackoverflow.com/questions/1131220/get-md5-hash-of-a-files-without-open-it-in-python """ md5 = hashlib.md5() data = True ...
3711eba8479fabc69f30063cfc6fb585345bab66
3,627,299
import random def generator_order_code(sex=None): """ 生成顺序码 :param sex: :return: """ order_code = random.randint(101, 1000) if sex == 1: order_code = order_code - 1 if order_code % 2 == 0 else order_code if sex == 0: order_code = order_code if order_code % 2 == 0 else o...
52be4dd5d9a40d261511adbe57271824a09592bf
3,627,300
def fasta_reader(fa, q, *filters): # TO DO # Check packing/unpacking # Should this be just a list, even if it's empty? """ Reader worker for the fa file in the specified q(ueue) Applies a filter on the sequence length > 1. This is there to parse out (a) empty sequence strings (b) se...
dde75f77b33d7dc65c4c37087bd4e04eb7b0c8c3
3,627,301
def test(model, test_inputs, test_labels): """ Runs through one epoch - all testing examples :returns: accuracy """ num_predict_corrections = 0 num_times_we_guessed_zero = 0 num_batches = len(test_labels) for batch_no in range(num_batches): test_input = test_inputs[batch_no] ...
c84b705ce321d60fe294de10ded6f6c474b79dae
3,627,302
def mirantis(cred): """ :returns: list [{'region': str, 'timestamp': int, 'nodes': list}] """ return _openstack(Provider.OPENSTACK, cred)
d5ad35b8cdb6bc48d4d75d4d8d72715fe0cfb566
3,627,303
def load(path, encoding="utf-8"): """ 从文件夹加载 CDTB 格式文档 :param path: 文档文件夹路径 :param encoding: 文档编码 :return structure.tree.Discourse 生成器 """ return CDTB.load(path, encoding=encoding)
8993d79e112ff97ced08c6315523433e0d20b85d
3,627,304
import io def _get_exchange_info() -> pd.DataFrame: """ Returns a dataframe of exchange listings for initializing the Universe class Called upon initialization of the Universe class, updates the stock listings that are available by default when gathering stock data from the internet Returns: ...
7384879bb4009851bd761093c04d00c60aee2feb
3,627,306
import pathlib def read_xr_and_concat(fname: pathlib.Path): """Reads the given filename and concatenates it into a single file. Assumes that the filename is an xarray file which was made by parsing many calcium analysis results. """ data = xr.open_dataset(fname).dff return np.vstack(data)
2b23bffcbbae0ed9e9d4cfeaaecc72107ba8cdc6
3,627,308
def is_win(record): """ Test for specific domains :param record: line to analyse :return: True if is specific for Windows, False otherwise """ return win_reg1.search(record) or win_reg2.search(record) or win_reg3.search(record) \ or win_reg4.search(record) or win_reg5.search(record) o...
3c2f3af4a6c203d16e22341d2545f4cfe262d7c0
3,627,311
def sq_sums(a_gpu, b_gpu, GSZ=GSZ): """ Compute squared summations of rows from GPUArrays and then their pairwise summations. Parameters ---------- A : GPUArray B : GPUArray GSZ : int, optional Grid size for CUDA kernel invocation Returns ------- out : GPUArray ...
4de45c202abcb665ca3b33aee504c646727ba486
3,627,313
def timealize_img(experiment, image, label): """ Transforms an image to an image with timesteps to be fed into a SNN. Copies the image timesteps times and stacks them together. Equivalent of feeding the SNN a raw input current, not feeding it spikes. :param experiment: :param image: :param l...
acefe04bc5de1fcc5a6cdf6fd400bb69ebe0e224
3,627,314
def simpleClosedPath(listPts): """Returns the closed path of the given points""" points = listPts[:] # making a compy of the listPts y_min_index = getBottomRight(listPts) y_min_point = points.pop(y_min_index) closed_path = [(y_min_point, 0)] for point in points: angle = theta(y_min_p...
151967973bd1c777a4aa0ff65c1516ffa6d50016
3,627,315
def home(): """ Route for displaying the homepage. """ return render_template("home.html", home=True)
e7426ac8cd8f2e2792ec0940ae8555444b47e962
3,627,316
def timefunc(func, msg, *args, **kwargs): """Benchmark *func* and print out its runtime. Args: msg (str): func: *args: **kwargs: Returns: object: """ # Make sure the function is compiled before we start the benchmark res = func(*args, **kwargs) # T...
67c2c1b8abe0f8dc05020d88b45154619fd49012
3,627,317
def button(where=None, x=0, y=0, label="", width=0, height=30, idle=None, over=None, down=None, color=(50,50,50)): """Display a button whose graphics are images (np.ndarray). The button accepts three images to describe its states, which are idle (no mouse interaction), over (mouse is over the button) and down (mouse c...
ced0cb82fca6a8af9913a899a6714ea9cc0f8c4d
3,627,318
def action_checker(target_name): """ Checks in on targets.json and determines what actions are available for the requesting target. Parameters ---------- target_name: str Returns ------- A list of available actions for the target. """ target_json = get_target_data(target_name) ...
4168219285f0c884d6640103eb2e9b95d94bf6c9
3,627,319
def get_licence(html): """ Searches the HTML content for a mention of a CC licence. """ if "creative-commons" in html or "Creative Commons" in html: licence = "CC" else: licence = "N/A" return licence
07dcd2439455fd23b034e11204d2a474c9502cdf
3,627,320
def get_selected_ctrl(): """ the joints from current selection. :return: <tuple> array of joints from selection. """ selected_obj = object_utils.get_selected_node() if selected_obj and object_utils.is_shape_curve(selected_obj): return selected_obj
60f935377302c4a6ebb6ddc3afed161306666e6d
3,627,321
def sum_temp(s, n): """ :param s: int, sum of total value of temperature :param n: int, latest information to add up :return: s + n """ s += n return s
4dc7da032fd91da86d73bf545fdf527497c12cd5
3,627,322
def foreground_rainbow(ncolors=20, background_color=BLACK): """ A rainbow gradient of `ncolors` ColorPairs with a given background color. """ return [ ColorPair(*foreground_color, *background_color) for foreground_color in _rainbow_gradient(ncolors) ]
44a934ea8ee4a95b46ad3559e91e6044c0f0494b
3,627,323
import re def get_method_parameter_values(code, line, full_sig): """ Returns a List of parameter values for the method at a given line """ param_list = [] offset = int((get_offset(code, line, "catch(") - 3)) line += (1 + int(offset / 2)) for i in range(int(offset / 2)): param_pattern = re...
0c4803710daaffcb015361665dcd3604d0b9960b
3,627,324
def mrc_to_dask(fname: Pathlike, chunks: tuple): """ Generate a dask array backed by a memory-mapped .mrc file """ with access_mrc(fname, mode="r") as mem: shape, dtype = mrc_shape_dtype_inference(mem) chunks_ = normalize_chunks(chunks, shape) def chunk_loader(fname, block_info=None): ...
10da8a3a8d9abf13fafbd98be3e3f1f4b2bc7264
3,627,325
def mock_random_choice(seq): """Always returns first element from the sequence.""" # We could try to mock a particular |seq| to be a list with a single element, # but it does not work well, as random_choice returns a 'mock.mock.MagicMock' # object that behaves differently from the actual type of |seq[0]|. ret...
a889c7ca32b6d494493000134c1d9d26fe5e97c3
3,627,327
def find_entries_without_field(path_or_db, field): """Return entries without field.""" _, db = _load_or_use(path_or_db) lacking_entries = [] for entry in db.entries: if field not in entry: lacking_entries += [entry] return lacking_entries
308aab183bb1a8977f7c7404515911076eb0450d
3,627,329
import numpy def valley_width_transform(valleys): """Calculate the approximate distributed valley width `from bluegeo.water import valley_width_transform;test = valley_width_transform('/Users/devin/Desktop/valley.tif')` Arguments: valleys {[type]} -- [description] """ valleys = Raster(va...
2f76a3484264ca1c509ad6c7e07839c6655a47af
3,627,330
def add_contents_entry(section, page_variable, feature, parent): """ Adds a new row to the table of contents table. <p> The table should be called 'report_contents' and be structured with a 'section' and a 'page' column. No detailed checks are made to confirm this structure is in place. </p><p>...
9e50715bd40bad8f94c560ada09833a270e7d512
3,627,331
def V_6_3_3(b, h0, ft): """ 不配置箍筋和弯起钢筋的一般板类受弯构件斜截面承载力 """ if h0<800: beta_h = 1 elif h0<2000: beta_h = (800/h0)**0.25 else: beta_h = (800/2000)**0.25 return 0.7*beta_h*ft*b*h0
79e9d97fcc755ed163cedb5f775d07abb6c26595
3,627,332
def removeInteger(string): """ Remove an integer from a string. Args: string: write your description """ _checkSequenceError(string=string, start=bytesHexB, expected="02") length, lengthLen = _readLength(string[1:]) numberBytes = string[1 + lengthLen:1 + lengthLen + length] res...
54e2905bf9f68224ba35b3c9e2d5c94bf81bdfd0
3,627,334
import select def get_urls(): """The get_urls function fetches 16 urls from the database that need to be scraped by the bee. The Url which are set with a priority in the database will be retrieved first. """ return select(u for u in Url if u.date_scraped is None).order_by(desc(Url.priority_scrape))[:8...
2e181424ae6795838f2a468cd3e59a6153cd3d5c
3,627,335
import json def convert_input_to_userid(input_id): """ Take user input from app (Steam user ID or vanity URL) and output Steam user ID for further API calls ] """ req = Request('http://api.steampowered.com/ISteamUser/ResolveVanityURL/v0001/?key=%s&vanityurl=%s'%(api_key, input_id)) try: data_raw = urlopen(re...
7f18e720dca48c33c892b7ad3e1970c057d4e6b8
3,627,336
def create_citydist(create_environment, create_building): """ Pytest fixture function to generate city district with three res. buildings (with demands) on positions (0, 0), (0, 10), (10, 10) Parameters ---------- create_environment : object Environment object (as fixture of pytest) ...
116cc1974b295198aade37b9bc0ee49a5e141a2b
3,627,337
def read_log(log_file, skip_log_rows=None, skip_log_conditions=None): """Reads the behavioral log file with information about each EEG trial.""" # Check if data are already in a DataFrame if isinstance(log_file, pd.DataFrame): log = log_file else: # Detect file encoding with op...
b52a852092b9e0d56cbe264301b5000d2df777f8
3,627,338
import hashlib def sha1_base32(buf: bytes, n: int = None): """ Return a base32 representation of the first n bytes of SHA1(buf). If n = None, the entire buffer will be encoded. """ return base32(hashlib.sha1(buf).digest()[slice(0, n)])
f5cae574c2dfaf6e2a031203858145239289e41e
3,627,339
def get_lsf_grid_name(fibre_number): """ Return the appropriate LSF name (a, b, c, or d) to use, given a mean fiber number. :param fiber_number: The mean fiber number of observations. :returns: A one-length string describing which LSF grid to use ('a', 'b', 'c', or 'd'). """ ...
009b20027f895e19c5b6cabb4476cf41a222e465
3,627,340
from typing import List def get_named_layers_and_params_by_regex( module: Module, param_names: List[str], params_strict: bool = False, ) -> List[NamedLayerParam]: """ :param module: the module to get the matching layers and params from :param param_names: a list of names or regex patterns to m...
6f6e2a42158e2dbe7762bcc13d9991279967d3e0
3,627,341
def draw_box(to_draw, xmin, xmax, ymin, ymax, cname, cindex, class_colors, conf=None, extratext=""): """ Draws a box on top of an image. The image is then returned. Arguments: to_draw -- image to draw on xmin, xmax, ymin, ymax -- coordinates of the box cname ...
db60a02cfe0e3cb438f078cabba3be1b445ea060
3,627,342
def _get_node(pending_set, pre_sel=[], opts={}): """ Next node preferably in pre-selected nodes """ shuffle(pre_sel) for node in pre_sel: if node in pending_set: pending_set.remove(node) return node # Random if not return pending_set.pop()
2dfcfd96479ec19c074cd52129dee9fd018243b0
3,627,343
import functools def callCounter(func): """function call counter""" @functools.wraps(func) def helper(*args, **kwargs): helper.calls += 1 return func(*args, **kwargs) helper.calls = 0 return helper
a999210fd0f553ccc5d00ffc4c61ccc09deba4b9
3,627,344
def deprecated(func): """Print a deprecation warning once on first use of the function. >>> @deprecated # doctest: +SKIP ... def f(): ... pass >>> f() # doctest: +SKIP f is deprecated """ count = [0] def wrapper(*args, **kwargs)...
882b26592fa620be65eb7e1306abdf1d138ca022
3,627,345
import numpy def eigsh(a, k=6, *, which='LM', ncv=None, maxiter=None, tol=0, return_eigenvectors=True): """Finds ``k`` eigenvalues and eigenvectors of the real symmetric matrix. Solves ``Ax = wx``, the standard eigenvalue problem for ``w`` eigenvalues with corresponding eigenvectors ``x``. ...
5486b984e47b0e1702c57c077a55519371117c09
3,627,346
def calc_t_frame(n_col, n_row, n_amp, ins): """Calculates the frame time for a given ins/readmode/subarray. Parameters ---------- n_col : int Number of columns. n_row : int Number of rows. n_amp : int Amplifiers reading data. ins : str The instrument key. ...
3f26f0e29a3522c1a3ccf6fdc35635ac11e1648e
3,627,347
def verify_bytesio(enc_message, verify_key_hex, signature): """ Verify asymmetrically signed bytesreams. :param bytes enc_message: encrypted data :param bytes verify_key_hex: serialized verification key :param bytes signature: signature """ verify_key = nacl.signing.VerifyKey(verify_key_hex, en...
b98a9c9c9c4a14dc52e91ea5764143a2c2f36ab2
3,627,348
import logging import json def rest_error_message(error, jid): """Returns exception error message as valid JSON string to caller :param error: Exception, error message :param jid: string, job ID :return: JSON string """ logging.exception(error) e = str(error) return json.dumps({'user_i...
7422c77be37ed473ed15acc5fdfae9e85ff90812
3,627,349
def typedefn_from_root_element(el: UxsdElement) -> str: """Generate a C++ class declaration of a root element, which inherits its content type and adds load and write functions. """ out = "" out += "/** Generated from:\n" out += utils.to_comment_body(el.source) out += "\n*/\n" out += "class %s : public %s {\n" ...
63ecabd9b8e778ef7ccd4d6516ba0f60ef450990
3,627,350
def store(url, date, content): """Store article in database.""" if type(date) is str: date = iso2ts(date) return crawldb.add(url, content, version=date)
0114dbdfebdf76b70378f32c9cb4698e99359df4
3,627,351
def Dict(val): """ Build a dict for key/value pairs. """ return dict(val)
47864a91183070a7f8ce285e330d1278828b8352
3,627,352
def get_distracting_answer_by_visual7w_generation(qa_id, correct_answer, candidate_dict, res_cnt=3): """ Args: qa_id: int correct_answer: str candidate_dict: dict of (id, candidate), generated by visual7w baseline model """ res = [] if qa_id not in candidate_dict: pri...
f114a0da2b0598f48326a701c5d2e7fa1bc34023
3,627,353
def diag(req, resp): """ Data about the state of the database """ return { 'driver': engine.driver, 'tables': engine.table_names() }
d141aba9c726775505ed98c8ea80ca277b1acc95
3,627,354