text
string
label_name
string
labels
int64
from aim import Repo from aim.sdk.configs import get_aim_repo_name from aim.sdk.types import QueryReportMode from aim.storage.rockscontainer import RocksContainer from performance_tests.utils import timing @timing(10) def open_containers_for_read(container_paths_list): sequences_subdir = f'{get_aim_repo_name()}/s...
Python
1
or("Could not send command to telemetry clearinghouse: {0}")] ClearinghouseSend(#[from] mpsc::error::SendError<ClearinghouseCmd>), #[error("Could not send command to flink collector: {0}")] FlinkCollectionSend(#[from] mpsc::error::SendError<TickMsg>), #[error("Could not receive respons...
Rust
0
# get Christoffel symbols Gamma = self.get_christoffel(x, y) gamma_x = Gamma["Gamma_x_xx"] gamma_y = Gamma["Gamma_y_yy"] # derivatives of vector components dvxdt = -gamma_x * vx[i] * dxdt dvydt = -gamma_y * vy[i] * dydt vx[i + 1]...
Python
1
f.affine_weight[0] + self.eps) yl = yl.transpose(1, 2) # batch, channel, seq for i in range(self.level): yh_ = yh[i].transpose(1, 2) # batch, seq, channel yh_ = yh_ - self.affine_bias[i + 1] yh_ = yh_ / (self.affine_weight[i + 1] + self.eps) ...
Python
1
import time import datetime from contextlib import asynccontextmanager from fastapi import FastAPI, Request from dotenv import load_dotenv #upload variable -> .env load_dotenv() from .database import engine, Base from .routers import analysis, pages, history @asynccontextmanager async def lifespan(app: FastAPI): ...
Python
1
cted = "Missing required backend configuration.")] fn should_require_a_backend_config() { let _ = Builder::<MockBackend<String>, String>::default() .with_update_interval(Duration::from_secs(10)) .with_info_extractor(|| "data".to_string()) .with_error_strategy(Communicatio...
Rust
0
_shift) + (self.data[i - datum_shift - 1] >> (64 - bit_shift)); } return from_array(arr); } } } } macro_rules! signed_shl { ($T:ident) => { impl Shl<$T> for U512 { type Output = U512; fn shl(self, rhs: $T) -> Self::Output { ...
Rust
0
>, next_id: Uint256, // used to assign unique (but artificial) txids to messages pub recorder: RtEnvRecorder, compressor: TxCompressor, charging_policy: Option<(Uint256, Uint256, Uint256)>, num_wallets: u64, chain_init_message: Vec<u8>, } impl RuntimeEnvironment { pub fn new( chain_...
Rust
0
>().unwrap()); } } use std::{env, process, path::PathBuf}; #[macro_use] mod error; mod config; mod repository; mod local; mod remote; fn run() -> Result<(), error::Error> { let args: Vec<String> = env::args().collect(); if args.len() != 3 { Err(internal!("usage: git-diff-sync <-a or -g> <path-to-r...
Rust
0
import numpy as np from scipy.signal import get_window from skimage.filters import window from skimage._shared.testing import parametrize, raises @parametrize("size", [5, 6]) @parametrize("ndim", [2, 3, 4]) def test_window_shape_isotropic(size, ndim): w = window('hann', (size,)*ndim) assert w.ndim == ndim ...
Python
1
t in &builder.root_certificates { connector.cert_store_mut().add_cert((cert.0).0.clone())?; } #[cfg(target_os = "android")] load_android_root_certs(&mut connector)?; Ok(TlsConnector { connector: connector.build(), use_sni: builder.use_sni, ...
Rust
0
ize should be either zero or greater than UART_FIFO_LEN."] #[doc = ""] #[doc = " @param uart_num UART port number, the max port number is (UART_NUM_MAX -1)."] #[doc = " @param rx_buffer_size UART RX ring buffer size."] #[doc = " @param tx_buffer_size UART TX ring buffer size."] #[doc = " If s...
Rust
0
u64::from_le_bytes).ok_or(InvalidInstructionData)?; let space = space.try_into().ok().map(u64::from_le_bytes).ok_or(InvalidInstructionData)?; let (ether, rest) = rest.split_at(20); let ether = H160::from_slice(&*ether); //ether.try_into().map_err(|_| InvalidInstructionDa...
Rust
0
le vector of shape (3,) # Returns: # float: RKHS norm of the mean function # """ # # Ensure correct shapes # N = Dyn_gp_Y_train.shape[0] # assert K_DD.shape == (N, N), "K_DD must have shape (N, N)" # assert Dyn_gp_X_train.shape[0] == N, "Dyn_gp_X_train must have shape (N, 3)" # assert l...
Python
1
[doc = "Enable Request Register\n\nThis register you can [`read`](crate::generic::Reg::read), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify...
Rust
0
nding back: {:?}", &response[..cmp::min(response.len(), 1024)]); middleware.on_response(request_start); Ok(response::ok_response(response)) } use std::usize; use rustcolor::{color::*, printer::ColorPrinter}; macro_rules! print_color_pallette { ($background:expr, $offset:expr, $op:tt) => { for i in (C8_0...
Rust
0
0x7a, 0x00, 0xc0, 0x14, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, 0x08, 0xf3, 0x00, 0x1c, 0x0c, 0x6e, 0x73, 0x2d, 0x69, 0x6e, 0x74, 0x6c, 0x2d, 0x33, 0x38, 0x33, 0x36, 0x0c, 0x61, 0x77, 0x73, 0x64, 0x6e, 0x73, 0x2d, 0x63, 0x6e, 0x2d, 0x34, 0x37, 0xc0, 0x21, 0xc0, 0x14, 0x00, 0x02, 0x00, 0x01, 0x00, 0...
Rust
0
uct DXVA_VideoPropertyRange { pub MinValue: f32, pub MaxValue: f32, pub DefaultValue: f32, pub StepSize: f32, } impl ::core::marker::Copy for DXVA_VideoPropertyRange {} impl ::core::clone::Clone for DXVA_VideoPropertyRange { fn clone(&self) -> Self { *self } } #[repr(C)] #[doc = "*Requir...
Rust
0
Traceback (most recent call last): File "<stdin>", line 1, in <module> File "deepdiff/deepdiff/path.py", line 126, in extract return _get_nested_obj(obj, elements) File "deepdiff/deepdiff/path.py", line 84, in _get_nested_obj obj = obj[elem] TypeErro...
Python
1
nnotate_type(true, &TypeEnv::new(), &Type::Int) .unwrap(); assert_eq!( args.args, vec![ IDLValue::Bool(true), IDLValue::Null, IDLValue::Nat(42.into()), IDLValue::Text("哈哈".to_owned()), IDLValue::Text("string with whitespace".to_owne...
Rust
0
import sqlite3 as sq creacion_y_conexion = sq.connect("C:\\Users\\User\\Documents\\Python\\Tarea2\\Pruebas" + "\\6 - Pruebas con SQLite\\2 - Crear base de datos\\Mi_base_de_datos.sqlite") try: creacion_y_conexion.execute("create table prueba_1 (" + ...
Python
1
return self.expire_time + self.window def _as_tuple(self): return self.counter, self.time def __repr__(self): args = (self.counter, self.time, self.cache_seconds) return "<TotpMatch counter=%d time=%d cache_seconds=%d>" % args #=========================================================...
Python
1
Name => { // FIXME: cause now there's no semantic analyzer, so just pass the literal let mut cur_node = ParseNode::new(NodeType::STRING("__func_name__".to_string())); let len = "__func_name__".len(); let mut t_exp = TypeExpression::new_val(BaseType::Array(len)); ...
Rust
0
use crate::control::DefaultMapControl; use std::cell::RefCell; use std::rc::Rc; pub struct NativeRuntime { map: Map, context: Context, window: ContextWrapper<PossiblyCurrent, Window>, event_loop: glutin::event_loop::EventLoop<()>, control: DefaultMapControl, } impl NativeRuntime { pub fn new(...
Rust
0
m::<usize>()); debug_assert!(!blocks.is_empty()); let num_cols = blocks[0].num_columns(); let mut result_columns = Vec::with_capacity(num_cols); for i in 0..num_cols { let mut columns_to_gather = Vec::with_capacity(blocks.len()); for block in blocks { ...
Rust
0
哪个变量(main 函数无需关心变量和命令行参数的关系,略大材小用) /* fn parse_config(args: &[String]) -> Config { // 返回结构体好过元组 let query = args[1].clone(); let filename = args[2].clone(); // main 中的 args 为参数值的持有者,而 Config 也要属性的所有权,所以 clone // 这里用少许性能交换更多的简洁性是值得的取舍 Config { query, filename } } */ // 将 parse_config 改写为 Config::ne...
Rust
0
assert_eq!(modsel.map[&5], -100); /// } /// ``` #[derive(Clone, Debug, PartialEq, Eq, Hash)] pub struct TakeLast<T>(pub T); impl<T> WrappedBlock<Error> for TakeLast<T> where T: SlhaBlock, { type Wrapper = Option<T>; fn parse_into<'a>(block: &RawBlock<'a>, wrapped: &mut Option<T>, name: &str) -> Result<()> {...
Rust
0
c1: Fp::from_raw_unchecked([ 0x6888bc53d70716dc, 0x3dea6b4117682d70, 0xd8f5f930500ca354, 0x6b5ecb6556f5c155, 0xc96bef0434778ab0, 0x5081505515006ad, ]), }, y: Fp2 { c0: Fp:...
Rust
0
import os import pathlib import tempfile import urllib.request import zipfile from ..ezdb.paths import get_config_path, get_data_path, get_db_path, get_mariadb_bin_path, get_mariadb_daemon_path, get_mariadb_install_db_path from .step import Step # Theoretically, this could use the REST API that MariaDB has to find the...
Python
1
self.ELLIPSOID = ELLIPSOIDS[ellipsoid] self.ellipsoid_key = ellipsoid except KeyError: raise Exception( "Invalid ellipsoid. See geopy.distance.ELLIPSOIDS" ) else: self.ELLIPSOID = ellipsoid sel...
Python
1
transmute(180usize); fun(task, addr, callback_fn, callback_ctx, flags) } pub unsafe fn bpf_loop( nr_loops: __u32, callback_fn: *mut ::aya_bpf_cty::c_void, callback_ctx: *mut ::aya_bpf_cty::c_void, flags: __u64, ) -> ::aya_bpf_cty::c_long { let fun: unsafe extern "C" fn( nr_loops: __u32, ...
Rust
0
nal 1. Usr1, /// User-defined signal 2. Usr2, /// Pollable event. #[cfg(not(target_os = "macos"))] Poll, /// Profiling timer expired. Prof, /// Bad system call. Sys, /// Trace/breakpoint trap. Trap, /// High bandwidth data is available at a socket. Urg, /// Vi...
Rust
0
import pandas as pd import gcsfs def prepare_prs_table(input_path, output_path, bucket=None): """ Prepares the PRS table by reading it from the given path, modifying columns, and saving the modified table. The provided DataFrame must have 'chr' and 'bp' columns. If the values in the 'chr' column start...
Python
1
from aws_cdk import core import json class StackFromCloudformationTemplate(core.Stack): def __init__(self, scope: core.Construct, id: str, ** kwargs) -> None: super().__init__(scope, id, **kwargs) # Import Existing Clouformation Template): try: with open("stacks_from_cfn/sam...
Python
1
, C, E, D> Endpoint for PageIterator<'a, C, E, D> where C: Client, E: Page, D: DeserializeOwned, { fn method(&self) -> Method { self.endpoint.method() } fn path(&self) -> Cow<'static, str> { self.endpoint.path() } fn parameters(&self) -> QueryParameters { let mu...
Rust
0
# SpringBlade_Export_user_SQL_scan.py #SpringBlade export-user SQL 注入漏洞复现 import requests from requests.packages.urllib3.exceptions import InsecureRequestWarning from requests.exceptions import Timeout import os import urllib.parse import urllib.request import re def sc_send(text, desp='', key='[SENDKEY]'): postda...
Python
1
aths in the United States on average \n from 2012 to 2014, by cause') # 5. Average annual death toll from guns in the United States from 2012 to 2014, by cause # In[40]: dataset_byRace.Intent.value_counts(ascending=False) *100/100000 # In[21]: (dataset_byRace.Intent.value_counts(ascending=False) *100/100000).p...
Python
1
gram type: unknown" ); Err(OxidebpfError::UnsupportedProgramType) } } } pub(crate) fn loaded_as(&mut self, fd: RawFd) { self.loaded = true; self.fd = fd; } fn set_fd(&mut self, fd: RawFd) { self.fd = fd } fn get_fd(&s...
Rust
0
#!/usr/bin/env python3 # Copyright © 2020-2025, Meheret Tesfaye Batu <meherett.batu@gmail.com> # Distributed under the MIT software license, see the accompanying # file COPYING or https://opensource.org/license/mit from ..slip44 import CoinTypes from ..eccs import SLIP10Secp256k1ECC from ..consts import ( Info, E...
Python
1
"""def max(x,y): return (x+y + abs(x-y)) /2 def min(x,y): return (x+y - abs(x-y)) / 2 def max4bil(a,b,c,d): max1 = max(a,b) max2 = max(c,d) maxtotal = (max1+max2 + abs(max1-max2)) /2 return maxtotal def min4bil(a,b,c,d): min1 = min(a,b) min2 = min(c,d) mintotal = min1+min2 - ...
Python
1
fn to_bytes(self) -> Vec<u8> { match self { GRBLCommand::QuerySettings => {b"$$\n" .to_vec()} GRBLCommand::QueryGCodeParameters => {b"$#\n" .to_vec()} GRBLCommand::QueryParserState => {b"$G\n" .to_vec()} GRBLCommand::QueryBuildInfo => {b...
Rust
0
afps: int = 22_050, ) -> float: assert Path(ckpt_path).exists(), f"Checkpoint {ckpt_path} does not exist" calculate_sample_feats, calculate_gt_feats = True, True if sample_feats_path is None and sample_audio_path is None: raise ValueError( "Either sample_feats_path or sample_audio_path...
Python
1
weight_available = max_weight; } } let weight_processed = if status[index].message_metadata.is_empty() { debug_assert!(false, "channel exists in status; there must be messages; qed"); 0 } else { // Process up to one block's worth for now. let weight_remaining = weight_available.satur...
Rust
0
class Handler: """ Base handler class for the chain of responsibility. """ def __init__(self, successor=None): self.successor = successor def handle(self, issue): if self.successor: return self.successor.handle(issue) return f"Issue '{issue}' could not be resolve...
Python
1
"""Weapon description mappings.""" WEAPON_DESCRIPTIONS = { "sniper_rifle": (("'GGSLNBFHEX'", "NKQSGYXRYE"), ( f"Sniper rifles have a low rate of fire, but their precision negates the " f"defensive bonus for enemies in cover. The precision of Sniper Rifles also has a " f"dramatic psychologic...
Python
1
import torch from processmodel import ProcessModel, DataManager, Visualizer, Trainer from custom_updater import BucketUpdater device = 'cuda' if torch.cuda.is_available() else 'cpu' # --- Data --- data = DataManager(device) dem = 'data/dem.asc' data.load_dem(dem, outx=38, outy=54) ref = {'storage': 'data/ref_storage...
Python
1
!(uu_kill); // spell-checker:ignore procs uucore <filename>crates/nu-command/tests/format_conversions/mod.rs<gh_stars>10-100 mod bson; mod csv; mod eml; mod html; mod ics; mod json; mod markdown; mod nuon; mod ods; mod ssv; mod toml; mod tsv; mod url; mod vcf; mod xlsx; mod xml; mod yaml; //! Microphone input and OGG, ...
Rust
0
("BRAKES_LEFT_EVENT"), ], 0., to_percent_max, Variable::named("LEFT_BRAKE_PEDAL_INPUT"), ); builder.reduce( ExecuteOn::PreTick, vec![ Variable::aspect("BRAKES"), Variable::aspect("BRAKES_RIGHT"), Variable::aspect("BRAKES_RIGHT_E...
Rust
0
import streamlit as st from src.get_movie_data import CinemagiaScraper st.title("Movie Analyzer") def clean_movies_data(df): """Clean up the movies DataFrame by filtering out invalid ratings and converting data types.""" df = df[df['imdb_rating'].str.strip() != '0'] df['imdb_rating'] = df['imdb_rating']....
Python
1
Duration("1us").ok().unwrap(); /// assert_eq!(hours,time::Duration::new(36000000000000)); /// assert_eq!(complex,time::Duration::new(4210000000000)); /// assert_eq!(micro,time::Duration::new(1000)); /// assert_eq!(micro2,time::Duration::new(1000)); /// println!("{}",hours); /// println!("{}",complex); /// println!("The...
Rust
0
import numpy as np from .base_cam import BaseCAM class GradCAM(BaseCAM): def __init__(self, model, target_layers, reshape_transform=None): super(GradCAM, self).__init__(model, target_layers, reshape_transform) def get_cam_weights( self, input_tensor, target_layer, target_category, activation...
Python
1
} /// The `EC_KEY_get0_group` function. #[must_use] #[allow(clippy::needless_lifetimes)] // to be more explicit pub fn ec_key_get0_group<'a>(&'a self) -> Result<CRef<'a, EC_GROUP>, BoringError> { // get0 doesn't increment the refcount; the lifetimes ensure that the // returned CRef can'...
Rust
0
Normalize::Threshold), ffi::FMOD_DSP_NORMALIZE_MAXAMP => Ok(DspNormalize::MaxAmp), _ => Err(err_enum!("FMOD_DSP_NORMALIZE", value)), } } } #[derive(Debug, Clone, Copy, PartialEq)] pub enum DspLimiter { ReleaseTime, Ceiling, MaximizerGain, Mode, } impl From<DspLimite...
Rust
0
dca40b00, "unexpected glob error: {}", _error), } } pub fn regex (_pattern : &str) -> Outcome<Self> { let _source = _pattern.into (); let mut _builder = regexb::RegexSetBuilder::new (&[_pattern]); _builder.case_insensitive (false); _builder.multi_line (false); _builder.dot_matches_new_line (...
Rust
0
} } impl fmt::Display for SysControlAddr { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "id: {} unit: {}", self.id(), self.unit()) } } } <filename>cameras/src/lib.rs<gh_stars>0 //! Camera #[macro_use] extern crate log; mod environment_camera; mod orthograph...
Rust
0
# Copyright 2025 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
Python
1
t; #[derive(Clone, Component)] #[storage(VecStorage)] pub struct CarretController; pub struct CarretControllerSystem; impl<'a> specs::System<'a> for CarretControllerSystem { type SystemData = ( specs::Read<'a, Input>, specs::ReadStorage<'a, CarretController>, specs::WriteStorage<'a, Trans...
Rust
0
config_directory_path: Option<&Path>, shared: &CheckerShared, ) -> Result<DaemonCfg<T>> { let daemon_cfg = match config_common::read_config(config_path, config_directory_path) { Ok(daemon_cfg) => daemon_cfg, Err(config_common::Error::ReadConfig(path, err)) => match err.downcast_ref::<io::Error>...
Rust
0
3 => UCBRF_A::UCBRF_3, 4 => UCBRF_A::UCBRF_4, 5 => UCBRF_A::UCBRF_5, 6 => UCBRF_A::UCBRF_6, 7 => UCBRF_A::UCBRF_7, 8 => UCBRF_A::UCBRF_8, 9 => UCBRF_A::UCBRF_9, 10 => UCBRF_A::UCBRF_10, 11 => UCBRF_A::UCBRF_11, ...
Rust
0
rg.omg.kerml.xtext/src/org/omg/kerml/xtext/KerML.xtext" kerml_expressions_xtext_def = \ "../../org.omg.kerml.expressions.xtext/src/org/omg/kerml/expressions/xtext/KerMLExpressions.xtext" converter.parse_xtext_grammar( xtext_source_paths=[kerml_xtext_def, kerml_expressions_xtext_def]) convert...
Python
1
_BUFFERF_TIMELENGTH: _DMO_INPUT_DATA_BUFFER_FLAGS = 4i32; #[doc = "*Required features: 'Win32_Media_DxMediaObjects'*"] pub const DMO_INPUT_DATA_BUFFERF_DISCONTINUITY: _DMO_INPUT_DATA_BUFFER_FLAGS = 8i32; #[doc = "*Required features: 'Win32_Media_DxMediaObjects'*"] pub type _DMO_INPUT_STATUS_FLAGS = i32; #[doc = "*Requi...
Rust
0
addr) -> (Receiver<Bytes>, Multiaddr) { let (meta, receiver) = create_meta(1.into(), true); let shandle = create_shandle(); let (addr_sender, addr_receiver) = crossbeam_channel::unbounded(); thread::spawn(move || { let rt = tokio::runtime::Runtime::new().unwrap(); let mut service = crea...
Rust
0
right=True, ) fig, ax = plot_fig_and_ax plot_fmt = next(PLOT_LINE_FMT_CYCLER) if fmt is None else fmt marker_fmt = next(PLOT_MARKER_FMT_CYCLER) if fmt is None else fmt ax.plot( xs_to_be_plotted, ys_to_be_plotted, plot_fmt, # marker = marker_fmt, ...
Python
1
-lang.org/nightly/std/primitive.i32.html /// [`i64`]: https://doc.rust-lang.org/nightly/std/primitive.i64.html /// [`i128`]: https://doc.rust-lang.org/nightly/std/primitive.i128.html /// [`isize`]: https://doc.rust-lang.org/nightly/std/primitive.isize.html #[inline(always)] fn pow_signed<E: SignedPr...
Rust
0
ions*100 vertices_3d = torch.concat([cone_tip.unsqueeze(0), vertices_3d]).numpy(force=True) # 创建面 faces = [] for i in range(1, len(vertices_3d) - 1): # 每个面由锥尖和轮廓点的相邻对定义 faces.append([0, i, i + 1]) # 顶点索引0是锥尖 # 处理最后一个面,连接最后一个...
Python
1
ce({v})) replacer = randomness.choice(candidate_refs) at_least_one_mutated = True return replacer vr_idx += 1 return v self._node = copy_and_operate_on_variable_references(self._node, mutate_ref) return at_least_one_mutated d...
Python
1
let mut vec: Vec<(widget::Widget, widget::Placing)> = repeat((widget::Widget::NoWidget, widget::Placing::NoPlace)).take(num_to_push).collect(); vec.push((default, widget::Placing::NoPlace)); self.data.extend(vec.into_iter()); } else { self.data[ui_id_idx] = (d...
Rust
0
::new() } ); Ok(()) } } macro_rules! timer_create_run { ($timer:ident, $task:ident) => { let $timer = Timer::create(stringify!($timer)); $timer.run($task)?; }; } fn main() -> Result<()> { println!("Disk I/O will be included in timers."); timer_create_ru...
Rust
0
\xda\xa9\xf4&P\ \xb4\xe3\xaf\xfa\x11J_Zn\x1e\xfaH\x08\xf9b\xc2\ \xe3I\x84|^w \x90\x0c\x04\x1eP5\xf7\x10\x02\ \xfc\x19\xbd\xf7\x1c\x08\x07\xd9\xfc\xae,\xbbH\x91\xf8\xf3\ `\x16xu\xba\xde\xc9[\xc7\x8a\xb4\x0c\xab\x9f\xa2*\ \xdc**\x17\xdc\xc6>&\xd0\xe4{\x0e-r\xc7g\ \x05\x5cr\xd2\xe4f\xbcU\xf2[L\x96\xe9\xb8\xd1(\ \x96\xd9\x...
Python
1
lf, right); parse_quote!({ #left #op #right; println!(concat!(stringify!(#left), " = {:?}"), #left); }) } /// Produces a let-binding that assigns the right-hand side to the left-hand /// side and then prints the value. /// /// // Before /// let VA...
Rust
0
debug_assert!(err != 0); } else { let header = get_header(ptr); let err = HeapFree(GetProcessHeap(), 0, header.0 as LPVOID); debug_assert!(err != 0); } } pub fn usable_size(size: usize, _align: usize) -> usize { size } } <filename>par...
Rust
0
if url: urls.append(f"{name}: {url}") topic_content.append(f"🎬 {name}\n{url}") # Process PDFs/Notes notes = lesson_data.get('notes', []) for note in notes: name = note.get('name', 'Untitled Note') url = note.get('u...
Python
1
ve': True}]) def test_middleear(): '''Make sure that using multiple gain values in the middle ear model do the expected thing. ''' gains = np.arange(1., 5.) snd = harmoniccomplex(1000*Hz, duration=5*ms) # use multiple gains for the same sound all_gains = MiddleEar(snd, gain=gains).process...
Python
1
: "task_serializer", "CELERY_TASK_SOFT_TIME_LIMIT": "task_soft_time_limit", "CELERY_TASK_TIME_LIMIT": "task_time_limit", "CELERY_TASK_TRACK_STARTED": "task_track_started", "CELERY_TIMEZONE": "timezone", "CELERY_WORKER_AGENT": "worker_agent", "CELERY_WORKER_AUTOSCALER": "worker_autoscaler", "...
Python
1
# -*- coding: utf-8 -*- # @Time : 2020/7/17 19:30 # @Author : CC # @Desc : t_queue.py import time from leek import get_consumer def t_demo1(): from leek import TaskPublisher, TaskConsumer # for zz in range(1, 11): # TaskPublisher(queue_name='test1').pub({'a': zz, 'b': zz}) # # def pri...
Python
1
ez_compressed(config['model_path'] + \ '{}{}_preprocess_core.npz'.format(tag, pipeline), body_mean_X=body_mean_X, body_std_X=body_std_X, body_mean_Y=body_mean_Y, body_std_Y=body_std_Y, body_mean_audio=body_mean_audio, body_std_audio=body_std_audio) ret...
Python
1
fn config_aux_pid_polarity(&mut self, polarity: AuxPIDPolarity, timeout_ms: i32) -> ErrorCode { self.config_set_parameter( ParamEnum::PIDLoopPolarity, polarity as isize as f64, 0, 1, timeout_ms, ) } fn set_integral_accumulator( ...
Rust
0
ror::<Runtime>::ClassNotFound // ); // assert_noop!( // ArtGalleryModule::destroy_class(&BOB, CLASS_ID), // Error::<Runtime>::NoPermission // ); // assert_noop!( // ArtGalleryModule::destroy_class(&ALICE, CLASS_ID), // Error::<Runtime>::CannotDestroyClass // ); // assert_ok!(ArtGalleryModule:...
Rust
0
ker fixed_frame = rospy.get_param("/fixed_frame") prefix = rospy.get_param("~prefix") pub = rospy.Publisher('update_' + prefix + '_joint_position',Float64MultiArray) rospy.Subscriber('/' + prefix + '/initial_marker', String, initial_callback) rospy.Subscriber('/' + prefix + '_joint_states', JointSt...
Python
1
import requests import sseclient import aiohttp import asyncio def sync_sse_client(url): try: with requests.get(url, stream=True) as response: client = sseclient.SSEClient(response) for event in client.events(): print(f"Event type: {event.event}") pr...
Python
1
import requests from datetime import datetime APP_ID = "43da93d3" API_KEY = "7caab417c262fb011bda2de2e6139705" SHEETY_URL = "https://api.sheety.co/e538d1d0cd7df47a8de3f3f45553ecdf/workoutTrackerPython/workouts" URL = "https://trackapi.nutritionix.com" headers = { "x-app-id" : APP_ID, "x-app-key": API_KEY } ...
Python
1
"5" => assert_eq!(details.primary_output_type, OutputType::Regulated24), _ => { panic!("Unrecognized part code") } } if let Some(secondary) = details.secondary_output_type { match secondary { SecondaryOutputType::RegulatedNeg12 => { ...
Rust
0
""" Sets default args Note all data format is NHWC because slim resnet wants NHWC. """ from __future__ import absolute_import from __future__ import division from __future__ import print_function import sys from absl import flags import os.path as osp from os import makedirs from glob import glob from datetime impor...
Python
1
} impl GetSockOptRawCmd { pub fn new(level: i32, optname: i32, max_optlen: u32) -> Self { // Using uninit slice is safe, since the buffer in rust SDK ocall is [out] type. let optval = unsafe { Box::new_uninit_slice(max_optlen as usize).assume_init() }; Self { level, ...
Rust
0
parse_degrees("1020.12345", "N").unwrap(), 10.335391); assert_eq!(parse_nmea::_parse_degrees("11020.12345", "N").unwrap(), 110.335391); } } mod gga { use crate::nmea::gga; #[test] fn gga_normal() { //${GP,GL,...
Rust
0
ntry in the readtable is an alphabetic. /// /// # Assumption /// /// The readtable is using the standard syntax. /// /// # Parameters /// /// * `readtable`: Reference to the readtable /// * `chr`: Lookup key for the entry. /// /// # Returns /// /// bool pub fn is_alphabetic(readtable: &Readtable, chr: char) -> bool { ...
Rust
0
prototype let prototype = parse_prototype(tokens)?; Err(String::from("unexpected token.")) } macro_rules! ret_err_msg { ($err_msg:expr) => { return Err(String::from($err_msg)) }; } macro_rules! expect_token { ($pattern:pat in $tokens:expr, do $idt:block, except $err:block) => { ...
Rust
0
e { NoneValue::boxed() } } else { CashError::Bug("".to_owned()).boxed() } } } impl std::fmt::Display for Pipe { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { write!(f, "Pipe") } } impl Pipe { pub fn parse_inner( ...
Rust
0
from node_selection import MIN_COPY_SETS_SELECTION, RANDOM_SELECTION, BUDDY_SELECTION # NO_NODES = 4 # Hardcoded into yaml file. NO_REPLICAS = 3 NO_FRAGMENTS = 4 NODE_SELECTION_STRATEGY = RANDOM_SELECTION
Python
1
import os, sys module_path = os.path.abspath(os.path.join('.')) sys.path.append(module_path) from keras.models import Sequential from keras.layers.core import Flatten, Dense, Dropout from keras.layers.convolutional import Convolution2D, MaxPooling2D, ZeroPadding2D from keras.optimizers import SGD import cv2, numpy as ...
Python
1
); std::process::exit(1); } } } #[derive(Debug)] struct Args<'a> { mode: &'a str, addr: &'a str, user: Option<(&'a str, &'a str)>, show_usage: bool, } impl<'a> Default for Args<'a> { fn default() -> Self { Self { mode: "socks5", addr: "lo...
Rust
0
otected_ptr.sub(PAGE_SIZE * 2); let unprotected_size = ptr::read(base_ptr as *const usize); // check if !crate::memeq(canary_ptr as *const u8, CANARY.as_ptr(), CANARY_SIZE) { abort(); } // free let total_size = PAGE_SIZE + PAGE_SIZE + unprotected_size + PAGE_SIZE; _mprotect(base_pt...
Rust
0
import os import subprocess from pathlib import Path # 配置部分 PROJECT_ROOT = Path(__file__).parent # 默认是脚本所在目录 IGNORE_DIRS = {'.git', '__pycache__', 'venv', '.venv', 'env', '.idea', 'node_modules'} IGNORE_FILES = {'.pyc', '.pyo', '.DS_Store'} def generate_tree(start_path): """生成树状结构字符串""" tree_str = '' fo...
Python
1
# -*- coding: utf-8 -*- # Review Heatmap Add-on for Anki # # Copyright (C) 2016-2022 Aristotelis P. <https//glutanimate.com/> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by the Free Software Foundation, either ve...
Python
1
import socket #通信用 import time address = ('192.168.8.195', 4000) #通信を受け付けるIPアドレスと受信に使うポート番号の設定.127.0.0.1とするとPC内通信. udp = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) #udpという名前のUDPソケット生成 udp.bind(address) #udpというソケットにaddressを紐づける while True: #受信ループ try: rcv_byte = bytes() rcv_byte, addr = udp....
Python
1
last update. pub fn text(ctx: &mut Context) -> &str { &ctx.keyboard.unicode_text } } /// Handle mouse input pub mod mouse { use crate::Context; use glutin::{dpi::PhysicalPosition, event::MouseButton}; type Button = MouseButton; pub fn position(ctx: &mut Context) -> PhysicalPosition<f...
Rust
0
st_artists" q += " ON test_artists.artist_id=songs.artist_id" res = conn_tm.execute(q) test_tracks = res.fetchall() print 'Found',len(test_tracks),'from the test artists.' # get 300 most used tags q = "SELECT term,Count(artist_id) FROM artist_term GROUP BY term" res = conn_at.execute(q)...
Python
1
( log_group_name=processor.log_group.log_group_name, human_readable_name='Error logs', pattern='ERROR', alarm_friendly_name='error logs', ) metric_factory = low_level_facade.create_metric_factory() # according to https://docs.aws.amazon.com/eventb...
Python
1
array = [ [12, 45, 76, 2], [23, 54, 67, 34], [62, 57, 43, 8] ] def sort_array(arr): top = len(arr) - 1 swap = True while swap: swap = False for i in range(top): if arr[i] > arr[i + 1]: arr[i], arr[i + 1] = arr[i + 1], arr[i] swap = Tru...
Python
1
ency: latency.unwrap(), } } #[derive(Debug)] pub struct StraceOutput { pub percent_time: f64, pub seconds: f64, pub usecs_per_call: Option<u64>, pub calls: u64, pub errors: u64, } pub fn parse_strace_output(output: &str) -> HashMap<String, StraceOutput> { let mut summary = HashMap::new(); // Filter o...
Rust
0