text
string
label_name
string
labels
int64
static! { static ref RE: Regex = Regex::new(r"^(\d+)(?:-(\d+))?$").unwrap(); } let mut result: Vec<u8> = Vec::new(); for s in input.split(',') { if let Some(c) = RE.captures(s) { if c.get(2).is_none() { let val = c ...
Rust
0
for skill_name in list(info_data['info'].keys()): cn_name = info_data['info'][skill_name]['中文名'] rarity = info_data['info'][skill_name]['稀有度'].replace('·', '') color = info_data['info'][skill_name]['颜色'] tw_name = info_data['info'][skill_name]['繁中译名'] limit = info_data['info'...
Python
1
cted_url": "/dashboard" }, { "username": "invalid@example.com", "password": "wrongpassword", "expected_result": "failure", "expected_error": "Invalid username or password" }, { "username": ""...
Python
1
s) s_frame.store_w_receiver(w_frame) s_frame.push(w_frame) interp._loop = True def do_test(): interp.stack_frame(s_frame, None, True) py.test.raises(interpreter.NonVirtualReturn, do_test) def test_objectsAsMethods(): w_foo = space.wrap_string("foo") w_foo_ = space.wrap_string("fo...
Python
1
# coding=utf-8 # Copyright 2018 The Google AI Language Team Authors. # # 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 ...
Python
1
pub fn reset_old_password(&mut self) { self.r#old_password = None; } } use std::fmt; use std::ops::Index; use crate::solver::board::CellState::{Solved, Unsolved}; use crate::solver::calc::{Cell, number_to_mask}; use crate::errors::{ContradicoryAssignmentError, UnsolvableError}; #[derive(Clone, Copy, Partia...
Rust
0
; use nia_protocol_rust::ModifierDescription; use crate::error::NiaServerError; use crate::error::NiaServerResult; use crate::protocol::NiaModifierDescription; use crate::protocol::Serializable; #[derive(Debug, Clone, PartialEq, Eq)] pub struct NiaDefineModifierRequest { modifier: NiaModifierDescription, } impl...
Rust
0
nd_message( single_row["chat_id"], f"Vehicle found: {vehicle_name}") with open("already-done.txt", "a") as txt_file: txt_file.write(record + "\n") session.close() # FLASK APP - app = Flask(__name__) @app.route('/') def index(): url = "https://www....
Python
1
flanes = Flan.objects.all() print(flanes) context = { 'flanes': flanes } return render(request,"index.html",context) agregamos el diccionadio de flanes y agregamos al return el context deactivate ---> desactivas entorno y proyecto """ """ ORM instalar drivers de bse de da...
Python
1
let mut rx = UnboundedReceiverStream::new(rx); // if on windows, get the systray #[cfg(windows)] { Tray::new(tx.clone()).unwrap(); } // routes let quit = warp::path("quit").map(move || { let tx = tx.clone(); tx.send(()).unwrap(); "quit ok" }); let wspool_w = warp::any().map(move || wspool.clo...
Rust
0
s_with("URIError: ") { &message[10..] } else if message.starts_with("EvalError: ") { &message[11..] } else { message }; let mut report = Report::<(&str, Range<usize>)>::build(ReportKind::Error, "eval", range.start) .with_message(message) .with_label(Label::new(("...
Rust
0
ell.api.sequence.add_task_time(self.file, task=task) ifcopenshell.api.sequence.edit_task_time( self.file, task_time=task_time, attributes={ "DurationType": "WORKTIME", "ScheduleDuration": "P7D", "ScheduleStart": datetime.datetim...
Python
1
# -*- coding: utf-8 -*- # # Copyright 2022 Google LLC. All Rights Reserved. # # 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 requir...
Python
1
erveMost = 14, PreserveAll = 15, Swift = 16, CXXFASTTLS = 17, X86Stdcall = 64, X86Fastcall = 65, ARMAPCS = 66, ARMAAPCS = 67, ARMAAPCSVFP = 68, MSP430INTR = 69, X86ThisCall = 70, PTXKernel = 71, PTXDevice = 72, SPIRFUNC ...
Rust
0
pub const FILEMK: &[u8] = b"SRC_FILE= main.cpp CLASSES= INTERFACES= TEMPLATES= HEADERS= "; pub const MAIN: &[u8] = b"#include <iostream> int main(void) { std::cout << \"Hello_world\" << std::endl; return (0); } "; //! Define a domain to represent bounded sets of disjoint integers. use proc_macro2::TokenStr...
Rust
0
{ println!( "{}{}", "undo".bright_green(), if newline { "\n" } else { "" } ); } pub fn report_exit() { println!("{}", "exiting".bright_green()); } pub fn report_nothing_to_redo() { eprintln!("{}", "nothing to redo\n".bright_red()); } pub fn report_redo() { println!("{}", ...
Rust
0
messages.create( model=model, max_tokens=1024, temperature=temp, system="你是一个知识渊博且擅长分析的写作助手。你的任务是帮助用户基于文本内容重新创作一篇文章或总结,需遵循以下要求:1. 确保文章结构合理 2. 根据用户的要求调整文章的语气、风格、视角 3.确保文章结构合理,逻辑清晰", messages=[{"role": "user", "content": f"请你根据下面的文本内容写一篇{lang...
Python
1
import json from typing import Any from loguru import logger from app.config.config import EnvironmentOption # Environment to log level mapping ENV_LOG_LEVEL_MAP = { EnvironmentOption.LOCAL: "DEBUG", EnvironmentOption.DEV: "INFO", EnvironmentOption.UAT: "WARNING", EnvironmentOption.PRODUCTION: "WARNI...
Python
1
map(|(_, (id, container))| (id, container)) .collect(), queued: Vec::new(), running: HashSet::new(), dependants_scratch: Vec::new(), }) } } <filename>src/lib_test.rs #[cfg(test)] mod lib_test{ #[test] fn base(){ print!("{}", uymas::VERSION)...
Rust
0
fn getpeername(socket: &OwnedFd) -> Result<SocketAddr> { let mut saddr: MaybeUninit<sockaddr_l2> = MaybeUninit::uninit(); let mut length = size_of::<sockaddr_l2>() as socklen_t; if unsafe { libc::getpeername(socket.as_raw_fd(), saddr.as_mut_ptr() as *mut _, &mut length) } == -1 { return Err(Error::...
Rust
0
); } #[test] fn test_tokenize32() { let comp = vec!["12", "h", " ", "01", "m", "02", "s", " ", "am"]; tokenize_assert("12h 01m02s am", comp); } #[test] fn test_tokenize33() { let comp = vec!["12", ":", "08", " ", "PM"]; tokenize_assert("12:08 PM", comp); } #[test] fn test_tokenize34() { let comp ...
Rust
0
capacity(4), }; // Only record if skipping; // Need to do before update because // we need to serialize the state this action // will bring us to. // // NOTE: Since skipping isn't processed // until the input system runs, this is // safe from dupl...
Rust
0
ernion(w=1.0)), Pose(position=Point(x=1.29, y=1.14, z=0.97), orientation=Quaternion(w=1.0)), ], "kuka_blue": [ Pose(position = Point(x = 0.0, y = 0.0, z = 1.0), orientation = Quaternion(w = 1.0)), Pose(position = Point(x = 0.2, y = 0.2, z = 0.8), orientation = Quatern...
Python
1
# Copyright 2022 The Deep RL Zoo Authors. All Rights Reserved. # # 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 applica...
Python
1
array::IxDynImpl>>, pub b3: ndarray::Array<f32, ndarray::Dim<ndarray::IxDynImpl>>, } impl Parameters { fn as_json(&self)-> String { return serde_json::to_string(&self).unwrap() } } fn main() { let (x_train, y_train) = dataset::load(); let ref w1 = ag::variable(ag::ndarray_ext::random_...
Rust
0
^^^ ERROR `if` and `else` have incompatible types } <filename>src/lib.rs #[macro_use] extern crate cpython; use cpython::{PyResult, PyString, Python}; // A trivial function which returns a static string to the caller fn hello(py: Python) -> PyResult<PyString> { Ok(PyString::new(py, "Rust says: Hello world")) } /...
Rust
0
<NonNull<Node<K, V>>>, key: K, val: V) -> Option<NonNull<Node<K, V>>> where K: Ord, { let mut h = NodeQuery::new(h); match h.get_key() { None => return Some(Node::new_leaf(key, Some(val), None)), Some(h_key) => match key.cmp(h_key) { Ordering::Equal => h.set_entry((key, Some(val...
Rust
0
from tkinter import * from tkinter.ttk import Combobox from newtrans import Mytranslator root5=Tk() root5.geometry('350x520') root5.title('Google Translate') root5.config(bg="blue") def get(): s=cmb001.get() d=cmb002.get() message= t01.get(1.0,END) translator=Mytranslator() text=translator.run(txt=...
Python
1
TCFavorUASTCError: UastcPackFlags = 8; pub const UastcPackFlags_PackUASTCFavorBC7Error: UastcPackFlags = 16; pub const UastcPackFlags_PackUASTCETC1FasterHints: UastcPackFlags = 64; pub const UastcPackFlags_PackUASTCETC1FastestHints: UastcPackFlags = 128; pub const UastcPackFlags_PackUASTCETC1DisableFlipAndIndividual: U...
Rust
0
; mod utils; mod vector; pub use crate::error::*; pub use crate::gfx::*; pub use crate::matrix::*; pub use crate::memory::*; pub use crate::program::*; pub use crate::shader::*; pub use crate::texture::*; pub use crate::types::*; pub use crate::utils::*; pub use crate::vector::*; #[cfg(feature = "wee_alloc")] #[glo...
Rust
0
import argparse import unicodedata import pickle import unicodedata import pickle from transformers import AutoTokenizer def generate_subword2word(file): S_ID = -1 idx_subword2word_list = [] for line in open(file, encoding='utf8'): S_ID += 1 line = line.strip('\n').split() idx_subw...
Python
1
//! We provide `HazardEpoch`, a practical implementation of `Hazard Pointers`, which make further //! improvement and provide an easier way for usage. //! `LockFreeQueue` and `LockFreeStack`, implemented based on `HazardEpoch`, contain a few simple //! methods like `push`, `pop`. //! #![feature(core_intrinsics)] #![fea...
Rust
0
from .process_string import process_string from django.test import TestCase class StringProcessingTest(TestCase): def test_process_string(self): self.assertEqual("Unspecified", process_string("", ["example", "example"])) self.assertEqual( "example example example", process_...
Python
1
attempts, so we failed. // Reclaim the Boxed `Node`, drop the Box, and return the inner data of type `V`. // SAFE: no one has touched this node except for us when we created it above. let reclaimed_node = unsafe { Box::from_raw(node_ptr) }; Err(reclaimed_node.value...
Rust
0
}; r.map(|(a, b)| (a as u8, b)) } #[cfg(not(feature = "library"))] use cosmwasm_std::entry_point; use cosmwasm_std::{ attr, to_binary, Binary, CosmosMsg, Deps, DepsMut, Env, MessageInfo, Response, StdResult, Uint128, WasmMsg, }; use crate::state::{ read_all_assigned_tickets, read_config, rea...
Rust
0
#exit() print(context) out_tokens = [[] for _ in range(Target_batch)] out_last = [0 for _ in range(Target_batch)] output_text = ['' for _ in range(Target_batch)] FirstTime = 1 t000 = tim...
Python
1
ASE_RESTART_EXIT_CODE) => Err(Error::Restart), // Process error code `c` Some(c) => Err(Error::ExitCode(c)), // Unknown error, couldn't determine error code _ => Err(Error::Unknown), } }) ); global_cleanup(); res } #[derive(Debug)] /// Status used to exit or restart the program. struct ExitSta...
Rust
0
{ None } })) } } <gh_stars>100-1000 /******************************************************************************************* * * raylib [models] example - Drawing billboards * * This example has been created using raylib 1.3 (www.raylib.com) * raylib is licensed under ...
Rust
0
ext)) => { // Ok to drop it like this because we have exclusive // reference to the queue. unsafe { OwnedAlloc::from_raw(front_node) }; *front = next.as_ptr(); front_node = next; }, } ...
Rust
0
::Mul), Token::Slash => Some(BinOp::Div), _ => None, } } fn to_un_op(self) -> Option<UnOp> { match self { Token::Not => Some(UnOp::Not), Token::Minus => Some(UnOp::Neg), _ => None, } } } static INPUT: &str = include_str!("....
Rust
0
Into; #[cfg(windows)] use std::os::windows::io::AsRawSocket; mod platform { include!(concat!(env!("OUT_DIR"), "/bindings.rs")); } #[cfg(test)] mod tests; pub const EV_POLLIN: i16 = 1 << 0; pub const EV_POLLOUT: i16 = 1 << 1; /// Polls the socket /// /// # Arguments /// /// * `socket` - Socket to poll /// * `eve...
Rust
0
les( &self, ) -> Result<Box<dyn ExactSizeIterator<Item = Role>>, RoleBasedAuthorizationStoreError> { unimplemented!() } fn add_role(&self, _role: Role) -> Result<(), RoleBasedAuthorizationStoreError> { unimplemented!() } fn update_rol...
Rust
0
ap() ); fs.inactive(fd).await; let new_fd = fs.lookup(None, &root, &dst).await.unwrap(); let v = fs.getextattr(&new_fd, ns, &name).await.unwrap(); assert_eq!(&v[..], &value); } // rename updates a file's parent directories' ctime and mtime #[tokio::test] async f...
Rust
0
nes; mod n1005_maximize_sum_of_array_after_k_negations; mod other_estimate_pi_monte_carlo; mod other_maximum_sum_nonadjacents; // # Table // ## Prelude #[cfg(feature = "no-std")] use alloc::fmt; #[cfg(feature = "no-std")] use alloc::string::String; #[cfg(feature = "no-std")] use alloc::vec::Vec; #[cfg(not(feature = ...
Rust
0
.execute(conn) .is_ok() } /// Determines whether or not the user with ID `user_id` owns the list with ID `list_id`. pub fn is_list_owner(list_id: i32, user_id: i32, conn: &PgConnection) -> bool { let row: QueryResult<UserList> = dsl::user_lists .filter(dsl::user_id.e...
Rust
0
#![no_main] #![no_std] #[allow(unused)] use panic_halt; use xmc1100_hal as hal; use crate::hal::prelude::*; use crate::hal::scu::Scu; use crate::hal::serial::Serial; use crate::hal::time::Bps; use crate::hal::usic; use crate::hal::xmc1100; use cortex_m_rt::entry; #[entry] fn main() -> ! { if let Some(p) = xmc1...
Rust
0
le: Array1<f64>) -> Self { RollingMean { current_mean: first_sample, n_samples: 1, } } pub fn accumulate<A>(&mut self, new_sample: &ArrayBase<A, Ix1>) where A: Data<Elem = f64>, { let mut increment: Array1<f64> = &self.current_mean - new_sample; ...
Rust
0
# Part of Odoo. See LICENSE file for full copyright and licensing details. { 'name': 'Compare timesheets and forecast for your projects', 'version': '1.0', 'category': 'Services/Project', 'description': """ Compare timesheets and forecast for your projects. =============================================...
Python
1
) def __mock_objects(self, mock_import_module, database): mock_io_module = MagicMock() mock_io_class = MagicMock() mock_io_client = MagicMock() mock_import_module.return_value = mock_io_module mock_io_class.with_config.return_value = mock_io_client setattr(mock_io_...
Python
1
0x380; const GIC_DIST_PRI: usize = 0x400; const GIC_DIST_TARGET: usize = 0x800; const GIC_DIST_CONFIG: usize = 0xc00; const GIC_DIST_SOFTINT: usize = 0xf00; const GIC_DIST_SGI_PENDING_CLEAR: usize = 0xf10; const GIC_DIST_SGI_PENDING_SET: usize = 0xf20; const GICD_ENABLE: usize = 0x1; const GICD_DISABLE: usize = 0x0; ...
Rust
0
rhs): Self) { *self += rhs } } impl FmtMetric for Counter { const KIND: &'static str = "counter"; fn fmt_metric<N: Display>(&self, f: &mut fmt::Formatter<'_>, name: N) -> fmt::Result { writeln!(f, "{} {}", name, self.0) } fn fmt_metric_labeled<N, L>( &self, f: &mut...
Rust
0
xcb_discard_reply /// [`xcb_xv_grab_port_reply`]: Self::xcb_xv_grab_port_reply #[inline] pub unsafe fn xcb_xv_grab_port_unchecked( &self, c: *mut xcb_connection_t, port: xcb_xv_port_t, time: xcb_timestamp_t, ) -> xcb_xv_grab_port_cookie_t { sym!(self, xcb_xv_grab_...
Rust
0
Movement { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!( f, "{:#} {:#} {:#} {:#}", self.affected, self.source, self.target, self.selection )?; write!( f, "{} moves {} from {} to {}", self...
Rust
0
)) # lo transforma en una lista colores = "amarillo,azul,rojo,blanco" print(colores) colores = colores.split(",") # Divideremos los colores por las comas print(colores) # División con indices print(cadena_string[:15] + " / " + cadena_string[22:]) # Unión print(" ".join(colores)) # Verificación // Comprobación prin...
Python
1
} #[test] fn get_month() { assert_eq!(DtfDate::parse(b"19700111").unwrap().month(), 1); assert_eq!(DtfDate::parse(b"19700201").unwrap().month(), 2); assert_eq!(DtfDate::parse(b"19701030").unwrap().month(), 10); assert_eq!(DtfDate::parse(b"19701131").unwrap().month(), 11); ...
Rust
0
from typing import Optional from capymoa.drift.base_detector import MOADriftDetector from moa.classifiers.core.driftdetection import EWMAChartDM as _EWMAChartDM class EWMAChart(MOADriftDetector): """EWMA Charts Drift Detector Example: -------- >>> import numpy as np >>> from capymoa.drift.dete...
Python
1
957007e-2], [8.95208507e-2, 2.47938042e-2], [1.10183514e-1, 3.48310940e-2], [1.35615410e-1, 4.80927187e-2], [1.66917342e-1, 6.53942797e-2], [2.05444198e-1, 8.76799765e-2], [2.52863591e-1, 1.16002762e-1], [3.11228042e-1, 1.51476323e-1], [3.83063825e-1, 1.95186518e-1], [4.71480311e-1, 2.48049500e-1], ...
Rust
0
= test_codegen_with_options( r#" .test "a" { nop .trace .assert foo } asl"#, CodegenOptions { active_test: None, ..Default::default() }, )?; assert_eq!...
Rust
0
_test }; use arkworks::kzg_types::FsFr; use arkworks::utils::PolyData; use arkworks::kzg_proofs::FFTSettings; #[test] fn create_poly_of_length_ten_() { create_poly_of_length_ten::<FsFr, PolyData>(); } #[test] fn poly_eval_check_() { poly_eval_check::<FsFr, PolyData...
Rust
0
import os def get_render_code(show_joints=False): return f""" model.worldbody.add('camera', name='track_cam', pos=[-3, 2, 1],mode='targetbody', target='root') model.asset.add('texture', name='groundplane', type="2d", builtin="checker", mark="edge", rgb1="0.2 0.3 0.4", rgb2="0.1 0.2 0.3", markrgb=[0.8, 0.8, 0.8], w...
Python
1
ct.getmembers(obj, callable): if not hasattr(handler, "_pyxmpp_stanza_handled"): continue element_name, stanza_type = handler._pyxmpp_stanza_handled restr = handler._pyxmpp_usage_restriction if restr and restr != usage_restriction: ...
Python
1
include_str!("square.geom")), ) .unwrap(), } } /// Takes a glium Facade, a drawing Surface, a Grid, a transform, and a cell to color map. /// /// Renders the cells in a space from <-1, -1> to <1, 1> which is transformed with the transform matrix. pub fn render< ...
Rust
0
Ok(StringEnum::BAR), _ => std::result::Result::Err(format!("Value not valid: {}", s)), } } } impl StringEnum { /// Helper function to allow us to convert this model to an XML string. /// Will panic if serialisation fails. #[allow(dead_code)] pub(crate) fn to_xml(&self) -> String...
Rust
0
import torchvision.datasets as dset from torch.utils.data import DataLoader import torchvision.transforms as transforms import torch import os transform_pipeline = transforms.Compose( [ transforms.ToTensor(), # transforms.ConvertImageDtype(torch.float32), ] ) FILTER_ZERO = True N_TRAIN = 2048 ...
Python
1
.limit(1) .filter(dsl_username.eq(username)) .load::<User>(conn) .map(|u| u.into_iter().next()) } pub fn username_taken(conn: &PgConnection, username: &str) -> Result<bool, diesel::result::Error> { use crate::schema::users::dsl::{username as dsl_username, users}; use diesel::dsl::{...
Rust
0
4] to [-1,0] = 4 seconds * Total time = 7 seconds * Example 2: * * Input: points = [[3,2],[-2,2]] * Output: 5 * * * Constraints: * * points.length == n * 1 <= n <= 100 * points[i].length == 2 * -1000 <= points[i][0], points[i][1] <= 1000 * * Problem link: https://leetcode.com/problems/minimum-time-...
Rust
0
use neutrino::widgets::container::{Container, Direction}; use neutrino::widgets::image::Image; use neutrino::widgets::menubar::{MenuBar, MenuFunction, MenuItem}; use neutrino::utils::event::Key; use neutrino::{App, Window}; mod image_viewer_mod; use image_viewer_mod::listeners::{ MyImageListener, MyMenuBarListener...
Rust
0
one: prefac = self._second_kinematic_prefactor(dt) overload_operator_kinematic_numba( System.n_nodes, prefac, System.kinematic_states.position_collection, System.kinematic_states.director_collection, System.velocity_collection, Syst...
Python
1
ntextCache; use antlr_rust::TokenSource; use antlr_rust::{lazy_static, Tid, TidAble, TidExt}; use std::cell::RefCell; use std::marker::PhantomData; use std::ops::{Deref, DerefMut}; use std::rc::Rc; use std::sync::Arc; pub const T__0: isize = 1; pub const T__1: isize = 2; pub const T__2: isize = 3; pub const T__3: is...
Rust
0
# Part of Odoo. See LICENSE file for full copyright and licensing details. { 'name': 'Bulgaria - Accounting', 'website': 'https://www.fothz.com/documentation/17.0/applications/finance/fiscal_localizations.html', 'icon': '/account/static/description/l10n.png', 'countries': ['bg'], 'version': '1.0', ...
Python
1
ctId = match collection.insert_one(doc! {}, None).await { Ok(result) => { bson::from_bson(result.inserted_id).expect("Could not deserialize new game _id.") } Err(e) => { log::error!("ERROR: failed to create new game. {}.", e); return Er...
Rust
0
[derive(Serialize)] pub struct OutputInfo { // Name of the configuration (e.g., `astigmatism`) pub configname: String, /// Path without basename, e.g., `path/to` (drops suffix after last `/`). pub dirname: String, /// Path without dirname, e.g., `image.png` (drops prefix up to last `/`). pub bas...
Rust
0
om_iter(0..4000); let sub = RoaringBitmap::from_iter(2000..3000); assert_eq!(sub.is_subset(&sup), true); } #[test] fn array_bitmap_not() { let sup = RoaringBitmap::from_iter(0..2000); let sub = RoaringBitmap::from_iter(1000..15000); assert_eq!(sub.is_subset(&sup), false); } #[test] fn bitmap_not()...
Rust
0
( "ARABIC LIGATURE YEH WITH MEEM WITH MEEM", ("\u{064A}\u{0645}\u{0645}", ["", "\u{FD9D}", "", "\u{FD9C}"]), ), ( "ARABIC LIGATURE YEH WITH MEEM WITH YEH", ("\u{064A}\u{0645}\u{064A}", ["", "", "", "\u{FDB0}"]), ), ( "ARABIC LIGATURE YEH WITH NOON", (...
Rust
0
2 + 1) % servers); time::sleep(2 * RAFT_ELECTION_TIMEOUT).await; t.check_no_leader(); // if a quorum arises, it should elect a leader. t.connect((leader2 + 1) % servers); t.check_one_leader().await; // re-join of last node shouldn't prevent leader from existing. t.connect(leader2); t.c...
Rust
0
pub fn main() { println!("{}", hello()) } #[test] fn test_hello() { assert_eq!(hello(), "hello") }"#); assert_that(p.cargo_process("build"), execs()); assert_that(&p.bin("foo"), existing_file()); assert_that(process(&p.bi...
Rust
0
Self { TapFlags::TAP_API_FLAG_GSO } } impl AsEnumFlag for TapFlags { fn as_u32(data: &Self) -> u32{ *data as u32 } fn from_u32(data: u32) -> Self{ match data{ 1 => TapFlags::TAP_API_FLAG_GSO, 2 => TapFlags::TAP_API_FLAG_CSUM_OFFLOAD, 4 => TapFlags::TAP_API_FLAG_PERSIST, 8 => TapFlags::TAP...
Rust
0
ata with a low-pass filter fs = 1 # Sampling frequency (1 sample per second for frame-rate) cutoff = 0.1 # Cutoff frequency (adjust based on expected signal) x_vals_smooth = low_pass_filter(x_vals, cutoff, fs) # Fit a sine wave to smoothed x-values peaks, _ = find_peaks(x_vals_smooth) period ...
Python
1
import threading from typing import Dict from topic import Topic from subscriber import Subscriber from message import Message from concurrent.futures import ThreadPoolExecutor class PubSubService: _instance = None _lock = threading.Lock() def __new__(cls): if cls._instance is None: wi...
Python
1
ast_index = max(last_index, j2) case ('equal', _, _, _, _): pass case _: raise Exception(f"Unknown opcode {op}") return Event( filename=filename, file_extension=f"{filename}#wakapi-anyide-binaryfile", # custom handl...
Python
1
ersenCommitmentCompressorGadget< EdwardsBls, EdwardsCompressor, CoreCheckF, EdwardsBlsGadget, EdwardsCompressorGadget, >; pub type AddressCommGadget = PedersenCommitmentCompressorGadget< EdwardsBls, EdwardsCompressor, CoreCheckF, EdwardsBlsGadget, EdwardsCompressorGadget, >; pub ...
Rust
0
from typing import List, Dict, Any, Optional from fastapi import APIRouter, Depends from pydantic import BaseModel from app.core.dependency import DependApiTokenAuth, DependPermisson from app.controllers.batch_controller import BatchController from app.schemas.base import Fail, SuccessExtra from app.schemas.blog impor...
Python
1
import pytest from aphrodite.assets.video import VideoAsset from aphrodite.multimodal import MULTIMODAL_REGISTRY from ...utils import build_model_context @pytest.mark.parametrize("model_id", ["zai-org/GLM-4.1V-9B-Thinking"]) @pytest.mark.parametrize("expected_toks_per_frame", [299]) @pytest.mark.parametrize("num_fr...
Python
1
rc::new(Translate::new( Arc::new(RotateY::new(tall_box, 15.0)), Vec3::new(265.0, 0.0, 295.0), ))); scene } pub fn cornell_smoke_scene() -> Vec<Arc<dyn Hittable>> { let mut scene: Vec<Arc<dyn Hittable>> = Vec::new(); let red = Arc::new(Lambertian::new(Arc::new(ConstantTexture::new(Vec3:...
Rust
0
18-sum-of-squares/solutions/rust/ericwburden/ericwburden.rs<gh_stars>10-100 pub fn can_sum_in_steps(total: usize, steps: usize, addends: &[usize]) -> bool { if steps == 0 { return false; } if addends.contains(&total) { return true; } for addend in addends { if addend > &total { continue; } ...
Rust
0
sG = scipy.sparse.coo_matrix(sG) l1 = labels1 is not None l2 = labels2 is not None header = ['i', 'j', 'val'] if l1: header.append('ci') if l2: header.append('cj') with open(fp, 'w') as f: f.write(sep.join(header) + '\n') for i,j,v in zip(sG.row, sG.col, sG.data): ...
Python
1
widget_params = { 'master': self.window, 'from_': self._min_samples_split_range[0], 'to': self._min_samples_split_range[1], 'variable': samples_split_var } self._add_tunable_widget( key='min_samples_split', widget_cls=IntSlider, param_values=self._m...
Python
1
: return await eod(output[0], f"**Error :**\n__{exc}__") legend = f"https://telegra.ph{response[0]}" await output[0].edit("`Searching for result..`") async with aiohttp.ClientSession() as session: async with session.post( f"https://api.trace.moe/search?anilistInfo&url={quote_...
Python
1
# Copyright 2017 Google LLC # # 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 in writing, s...
Python
1
opic) finally: print("## OVERVIEW ##") print(bag) bag.close() elif args.kitti_type.find("odom") != -1: if args.sequence == None: print("Sequence option is not given. It is mandatory for odometry dataset.") print("Usag...
Python
1
import numpy as np def wkb1(V0, V2, n=0): return np.sqrt(V0) - 1j*(n+0.5)*np.sqrt(-2.0*V2)/(2.0*np.sqrt(V0)) def iyer_will_L2_L3(V2,V3,V4,V5,V6,n=0): alpha = n + 0.5 R2 = V2 A = V3/R2; B = V4/R2; C = V5/R2; D = V6/R2 sqrt_term = np.sqrt(-2.0*R2) L2 = (1.0/sqrt_term)*( (1.0/8.0)*B*(alpha**2 + ...
Python
1
city torque = torque * args.scale print() # Find the largest velocity change among all our traces, then # discard anything that has less than X% of that change. def velocity_change(trace): start_index = len(trace) // 4 end_index = len(trace) // 2 return abs(trace[end_...
Python
1
# cook your dish here t = int(input()) for i in range(t): x, y = map(int,input().split()) solved_time = x+y a = 500 - (x*2) b = 1000 - (solved_time*4) c = 1000 - (y*4) d = 500 - (solved_time * 2) if((a+b)>=(c+d)): print(a+b) else: print(c+d)
Python
1
="$\\mathrm{trap}$") plt.ylim([-0.01, max(abs(psi0) ** 2) + 0.01]) plt.xlabel("$\\mathrm{lattice\\ sites}$", fontsize=14) plt.title( "$Jt=%0.2f,\\ E(t)-E_\\mathrm{GS}=%0.4fJ$" % (t[i], E - E_GS), fontsize=14 ) plt.legend(loc="upper right", fontsize=14) plt.draw() # draw frame plt.pa...
Python
1
if max_jitter_ms is not None: max_jitter = int(max_jitter_ms * templates.sampling_frequency / 1000.0) shifts = get_template_extremum_channel_peak_shift(templates) to_select = [] for unit_id in templates.unit_ids: if np.abs(shifts[unit_id]) <= max_jitter: to...
Python
1
from unittest.case import TestCase from tests.utils_func_tests import reBpHint, _findBpHintWithContent, Rpdb2Stdout class TestFindBpHint( TestCase ): def testReBpHint(self): self.assertEqual( reBpHint.search( 'asldfkj # BP1\n').group(1), 'BP1' ) def testFindBpHint( self ): self.assertEqual( ...
Python
1
s=%s" % (complex_chars, complex_chars) in env_list assert process.stderr == b"" @pytest.mark.parametrize("wsman_conn", [[True, "test_winrs_extra_opts"]], indirect=True) def test_winrs_extra_opts(self, wsman_conn): with WinRS(wsman_conn, name="shell 1", lifetime=60, idle_time_out=60, working...
Python
1
workers, NOT on the # EnvRunners. learner_only=True, # Configure the architecture of the ICM here. model_config={ "feature_dim": 288, "feature_net_hiddens": (256, 256),...
Python
1
: """ [MS-FSCC] 2.5.4 FileFsFullSizeInformation https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-fscc/63768db7-9012-4209-8cca-00781e7322f5 """ INFO_TYPE = InfoType.SMB2_0_INFO_FILESYSTEM INFO_CLASS = FileSystemInformationClass.FILE_FS_FULL_SIZE_INFORMATION def __init__(self)...
Python
1
(4) prjMatrix[0, 0] = 2 * K[0, 0] / img_w prjMatrix[1, 1] = 2 * K[1, 1] / img_h prjMatrix[0, 2] = 2 * K[0, 2] / img_w - 1 prjMatrix[1, 2] = 2 * K[1, 2] / img_h - 1 prjMatrix[2, 2] = 1 prjMatrix[3, 3] = 0 prjMatrix[3, 2] = 1 # make 1st elem for height, 2nd...
Python
1