text
string
label_name
string
labels
int64
rtialEq, Eq, Ord, PartialOrd, Copy, Clone, Hash)] pub enum Chirality { /// `@` Anticlockwise, /// `@@` Clockwise, /// `@TH1`, `@TH2` Tetrahedral(u8), /// `@AL1`, `@AL2` Allenal(u8), /// `@SP1`, `@SP2`, `@SP3` SquarePlanar(u8), /// `@TB1` ... `@TB20` TrigonalBipyramidal(u8...
Rust
0
choices=["stable", "development"], default="stable") parser.add_argument("--revision", help="Specify a git commit hash or tag to install", default="master") parser.add_argument("--cloudbiolinux", help="Specify a cloudbiolinux git commit hash or tag to install", ...
Python
1
excluded_books(user) preferences = ExclusionProvider._get_user_preferences(user) # Remove livros da estante available_books = [ book for book in recommended_books if book.id not in excluded_ids ] # Se houver preferências, prioriza livros relevantes ...
Python
1
(k[6:] if k.startswith("model.") else k): v for k, v in non_lora_trainables.items() } # 加载这些非 LoRA 权重,strict=False 表示不要求所有 key 都完全匹配。 model.load_state_dict(non_lora_trainables, strict=False) # 使用 PEFT 库来加载 LoRA 适配器权重。 from peft import PeftModel pr...
Python
1
1000, UTR3)]); } #[test] fn tbuilder_coords_fwd_coding_1_2_to_split() { let (trx, fxs) = trx_fxs(100, 1000, Forward, vec![(100, 300), (400, 500), (700, 1000)], Some((149, 299))); assert_eq!(exon_coords(&trx), vec![(100, 300), (400, 500), (700, 1000)]); assert_eq!(fxs.len(), 3)...
Rust
0
""" @author RazrCraft @create date 2025-06-17 18:34:53 @modify date 2025-06-23 04:48:33 @desc A really simple (and perhaps buggy) scanner script that indicates at what coordinates it's discovering certain blocks (configurable) in a 64 blocks radius of the player (also configurable), displayin...
Python
1
emarkName @property def KuberneteApiServer(self): return self._KuberneteApiServer @KuberneteApiServer.setter def KuberneteApiServer(self, KuberneteApiServer): self._KuberneteApiServer = KuberneteApiServer @property def KuberneteNativeType(self): return self._KuberneteN...
Python
1
# MIT License # Copyright (c) 2024 Juan L. Gamella # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge...
Python
1
from django.test import TestCase from constance import config from constance.test import override_config class OverrideConfigFunctionDecoratorTestCase(TestCase): """ Test that the override_config decorator works correctly. Test usage of override_config on test method and as context manager. """ ...
Python
1
: ibv_port_cap_flags2 = ibv_port_cap_flags2(2); } impl ibv_port_cap_flags2 { pub const IBV_PORT_VIRT_SUP: ibv_port_cap_flags2 = ibv_port_cap_flags2(4); } impl ibv_port_cap_flags2 { pub const IBV_PORT_SWITCH_PORT_STATE_TABLE_SUP: ibv_port_cap_flags2 = ibv_port_cap_flags2(8); } impl ibv_port_cap_flags2 { pub ...
Rust
0
1) { (false, false) => Value::Nil, (true, true) => { let x = demodulate(it)?; let y = demodulate(it)?; Value::Cons(Box::new(x), Box::new(y)) } (_, y) => { let mut t = 0; while it.next()? { t += 1; } ...
Rust
0
_with_nul(b"1234\0").unwrap() ) ); let val: u8 = gm.read_obj(cmdline_address).unwrap(); assert_eq!(val, '1' as u8); cmdline_address = cmdline_address.unchecked_add(1); let val: u8 = gm.read_obj(cmdline_address).unwrap(); assert_eq!(val, '2' as u8); cmd...
Rust
0
_attributes<H: Into<Addr>, S: Into<String>, T: DeserializeOwned>( &self, address: H, name: S, ) -> StdResult<Vec<T>> { // Gather results let resp = self.query_attributes(AttributeQueryParams::GetAttributes { address: validate_address(address)?, name: v...
Rust
0
类型 * content中的title, begin_time, end_time为必填项 * remind_start和remind_before为必填项(默认值分别为end_time那一天的08:00:00和120分钟) 3. 特别注意: - 完全忽略id字段的识别和创建,id应由数据库自动生成 - 所有id字段应保持为None或直接不包含该字段 4. 时间处理规则: - 如果用户只说"今天",...
Python
1
from enum import IntEnum class ColorCode(IntEnum): red = 31 green = 32 orange = 33 blue = 34 purple = 35 cyan = 36 lightgrey = 37 darkgrey = 90 lighred = 91 lightgreen = 92 yellow = 93 lightblue = 94 pink = 95 lightcyan = 96 def _color_str_template(color:Color...
Python
1
_names = HashSet::new(); for (course_id, sg_index) in valid_assignment_for_courses { if let Some(course_status) = self.degree_status.get_mut_course_status(&course_id) { if complete_sgs_indices.contains(&sg_index) { course_status.set_specialization_group_name(&sgs....
Rust
0
rics {}/{} refine metrics {}/{} \n'.format(object_name,p0,s0,p1,s1)) avg_psnr_objects = np.array(avg_psnr_objects).reshape(-1,2) avg_ssim_objects = np.array(avg_ssim_objects).reshape(-1,2) print('init',avg_psnr_objects[:,0].mean(),avg_ssim_objects[:,0].mean()) print('refine',avg_psnr_objects[:,1].mean(),avg_ssim_objec...
Python
1
import pandas as pd from sklearn.feature_extraction.text import TfidfVectorizer from sklearn.metrics.pairwise import cosine_similarity import streamlit as st df = pd.read_csv("books.csv") df['title'] = df['title'].str.strip() df['description'] = df['description'].fillna("") vectorizer = TfidfVectorizer(stop_words='en...
Python
1
"""Telemetry module. This module provides metrics and tracing functionality. """ from .config import StrandsTelemetry from .metrics import EventLoopMetrics, MetricsClient, Trace, metrics_to_string from .tracer import Tracer, get_tracer __all__ = [ # Metrics "EventLoopMetrics", "Trace", "metrics_to_st...
Python
1
V>, key: Option<K>, value: Option<V>, } impl<'a, K: Ord, V> MapBuilder<'a, K, V> { fn shift(&mut self) { if let (Some(k), Some(v)) = (self.key.take(), self.value.take()) { self.map.insert(k, v); } } ...
Rust
0
'bilinear', align_corners=True) depth_list += [depth[i][0].cpu().numpy() for i in range(depth.shape[0])] pre_input = cur_input del frame_list gc.collect() depth_list_aligned = [] ref_align = [] align_len = OVERLAP - INTERP_LEN kf_align_list = KE...
Python
1
ound_slugs); // Slug matches, is included let slug2 = project.create_slug().with_slug(&slug.slug).finish(); let mut found_slugs = Slug::find_by_slug(&slug.slug, connection).unwrap(); found_slugs.sort_by_key(|s| s.id); let mut expected_slugs = vec![slug.clone(), slug2]; expected_slugs.sort_by_ke...
Rust
0
g<u32>, pub mvfr: [Reg<u32>; 2], } #[cfg(feature = "cpu:cortex-m4f")] const SCB_FP_ADDRESS : usize = 0xe000ef34; #[cfg(feature = "cpu:cortex-m4f")] pub struct ScbFp; #[cfg(feature = "cpu:cortex-m4f")] pub static SCB_FP : ScbFp = ScbFp; bit_wrappers! { pub struct Fpccr(pub u32); } impl Fpccr { bitfie...
Rust
0
CTL>; #[doc = "Register PMAPCTL `reset()`'s with value 0x01"] impl crate::ResetValue for super::PMAPCTL { type Type = u16; #[inline(always)] fn reset_value() -> Self::Type { 0x01 } } #[doc = "Port mapping lock bit\n\nValue on reset: 1"] #[derive(Clone, Copy, Debug, PartialEq)] pub enum PMAPLOCKE...
Rust
0
// Hardware offload features need to be used with caution as they vary widely amongst vendors and their is no way to validate the quality of code they rely upon. #[inline(always)] fn hardware_offload_tunnel_packet_type(self) -> HardwareOffloadTunnelPacketType; /// A network driver may support hardware offload cate...
Rust
0
), (TipoToken.MENORQUE, r"<", Operator), # Delimitadores y puntuación (TipoToken.LPAREN, r"\(", Punctuation), (TipoToken.RPAREN, r"\)", Punctuation), (TipoToken.LBRACE, r"\{", Punctuation), (TipoToken.RBRACE, r"\}", Punctuation), (TipoToken.LBRACKET, r"\[", Punctuation), (TipoToken.RBRAC...
Python
1
d)?; return Ok(ret as i64) } pub fn SysLchown(task: &mut Task, args: &SyscallArguments) -> Result<i64> { let addr = args.arg0 as u64; let uid = args.arg1 as u32; let gid = args.arg2 as u32; let uid = UID(uid as u32); let gid = GID(gid as u32); return chownAt(task, ATType::AT_FDCWD, addr, ...
Rust
0
bindgen_test] fn pass() { init_hook(); assert_eq!(true, has_wait_for("hi")); }use std::fmt; use std::marker; use crate::assert_send; use crate::assert_sync; use crate::AsyncSocket; use crate::AsyncSocketBox; use crate::BoxFuture; use crate::ImplInfo; use crate::TlsConnector; use crate::TlsConnectorBuilder; use...
Rust
0
A12A13Odd = 13, /// If ADC14DIF = 0: A14; If ADC14DIF = 1: Ain+ = A14, Ain- = A15 A14A15Even = 14, /// If ADC14DIF = 0: A15; If ADC14DIF = 1: Ain+ = A14, Ain- = A15 A14A15Odd = 15, /// If ADC14DIF = 0: A16; If ADC14DIF = 1: Ain+ = A16, Ain- = A17 A...
Rust
0
unwrap(); setup::exit(); } #[test] fn echo_server_benchmark_std_net_tcp_raw_random_multithreads_test() { let name = "echo_server_benchmark_std_net_tcp_raw_random_multithreads"; setup::setup_and_wait(name); let port = "10004"; let threads = MANY_THREADS; let thread_handle = echo_server_std_net_t...
Rust
0
(&c[..]).unwrap(); // This returns correct for all keys. assert!(cert.key_is_correct(&pk).is_ok()); assert!(cert.key_is_correct(&wrong_pk).is_ok()); // But it isn't well-signed with the wrong pk. assert!(cert.is_well_signed(&wrong_pk).is_err()); let cert = cert .check_signature(&pk) ...
Rust
0
E - e*math.sin(E) - M df = 1 - e*math.cos(E) E = E - f/df return E def ecc2mean(E, e): ''' This function converts from Eccentric Anomaly to Mean Anomaly Parameters ------ E : float eccentric anomaly [rad] e : float eccentricity Returns ------ M : ...
Python
1
=> print!("Just move, no extra roll!"), } println!("[MATCH] Exhaustiveness checking..."); let is_confirmed = true; let is_active = false; match (is_confirmed, is_active) { (true, true) => println!("This account is in good standing."), (false, true) => println!("Please confirm your...
Rust
0
import time import rtmidi import os midiout = rtmidi.MidiOut() available_ports = midiout.get_ports() print(available_ports) if available_ports: midiout.open_port(0) else: midiout.open_virtual_port("My virtual output") with midiout: note_c = [0x90, 60, 127] # channel 1, middle C, velocity 112 note_d ...
Python
1
, "scale": -2 }"#, false ), ( r#"{ "type": "bytes", "logicalType": "decimal", "precision": -2, "scale": 2 }"#, false ), ( r#"{ "type": "bytes", "logicalType": "decimal", ...
Rust
0
Ok(()) } #[test] fn test_from_toml() -> TestResult { let ckt = Ckt::from_toml( r#" name = "tbd" defs = [] comps = [ {type="R", name= "r1", p= "a", n= "", g= 0.001 }, {type="C", name= "r2", p= "a", n= "", c= 0.001 } ...
Rust
0
(crate) upper_ops: UpperOps, pub(crate) lower_ops: LowerOps, /// to convert *Expr in *Syntax into *ExprLabel pub(crate) expr_resolver: ExprResolver, } impl QueryPlan { pub(crate) fn input_type(&self) -> PumpInputType { if self.upper_ops.has_window() || self.lower_ops.has_window() { ...
Rust
0
r(AddressbookError::IO), } } /// Delete address entry in addressbook storage (address cannot change) pub fn delete(&self, entry: &serde_json::Value) -> Result<(), AddressbookError> { let addr = entry.as_str().expect( "Expect id be convertible to a string", ); let...
Rust
0
import pygame import sys # Inicializar Pygame pygame.init() # Crear ventana pantalla = pygame.display.set_mode((600, 400)) pygame.display.set_caption("Círculo Movible") # Colores color_fondo = (30, 30, 30) color_circulo = (255, 0, 0) # Posición inicial del círculo x = 300 y = 200 radio = 30 velocidad = 5 # Cuántos...
Python
1
""" Write a function to put spaces between words starting with capital letters in a given string. assert capital_words_spaces("Python") == 'Python' """ def capital_words_spaces(string): """ This function takes a string as an input and returns the string with spaces between words starting with capital letters. ...
Python
1
struct xcb_timecoord_iterator_t { pub data: *mut xcb_timecoord_t, pub rem: ::std::os::raw::c_int, pub index: ::std::os::raw::c_int, } #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct xcb_get_motion_events_cookie_t { pub sequence: ::std::os::raw::c_uint, } #[repr(C)] #[derive(Debug, Copy, Clone)] pub...
Rust
0
# training params MAX_LEN = 256 TRAIN_BATCH_SIZE = 16 VALID_BATCH_SIZE = 16 EPOCHS = 10 LEARNING_RATE = 1e-05 # bert model params BERT_MODEL_PATH = '/home/user/project/NLP-Series-text-cls/models/bert-large-uncased' BERT_HIDDEN_LAYER_SIZE = 1024 # finetuned llm params LLM_MODEL_PATH = '/home/user/project/LLaMA-Factory/...
Python
1
import random import os from datetime import datetime from colorama import Fore, Style, init init(autoreset=True) red = Fore.RED yellow = Fore.YELLOW green = Fore.GREEN blue = Fore.BLUE magenta = Fore.MAGENTA cyan = Fore.CYAN reset = Fore.RESET card_info_db = { "461046": { "brand": "Visa", "type"...
Python
1
// Note: This B-spline curve is plotted in `bspline_examples.rs` #[test] fn bspline_example_2_a() { let curve = create_bspline_example(2, vec![1.0, 2.0, 3.0], vec![1.0, 3.0, 2.0, 4.0]); check_bspline_example( curve, vec![ (None, 0.5, -1.625), ...
Rust
0
(solver.get_value(midpoints[2].x), solver.get_value(midpoints[2].y)), (solver.get_value(midpoints[3].x), solver.get_value(midpoints[3].y))], [(10.0, 105.0), (105.0, 200.0), (200.0, 105.0), (105.0, 10.0)...
Rust
0
2); h1 = h1.wrapping_add(h3); h1 = h1.wrapping_add(h4); h2 = h2.wrapping_add(h1); h3 = h3.wrapping_add(h1); h4 = h4.wrapping_add(h1); h1 = fmix32(h1); h...
Rust
0
-> Self { Self { status: H256, } } } impl Hash for Ripemd256 { fn hash_to_bytes(&mut self, message: &[u8]) -> Vec<u8> { impl_md_flow_minimal!(u32 => self, message, from_le_bytes, to_le_bytes); self.status .iter() .flat_map(|word| word.to_le_b...
Rust
0
Commit { fn cmp(&self, other: &Commit) -> std::cmp::Ordering { self .time .cmp(&other.time) .reverse() .then(self.id.cmp(&other.id)) } } <reponame>rdelfin/rush<filename>src/parser/lexer.rs use std::{iter::Peekable, str::Chars}; use thiserror::Error; use crate::parser::tokens::LexerToke...
Rust
0
Error creating authenticator")?; let access_token = authenticator .get_access_token() .with_context(|| format!("Error getting access token for {}", account.email))?; let bearer_token = authenticator .get_bearer_token(&access_token) .with_context(|| format!...
Rust
0
on several\n", // 6 "lines\n", // 7 "*/\n", // 8 "foo\n", // 9 ) .as_bytes(), ); assert_eq!(p.next_token(), Token::PreprocDefine); assert_eq!(p.next_token(), Token...
Rust
0
f, sample_data): """Test that prediction intervals (q10-q90) have appropriate coverage.""" # Train models for different quantiles q10_model = create_quantile_model(alpha=0.1) q90_model = create_quantile_model(alpha=0.9) # Prepare features and target X = sample_da...
Python
1
::now(), Instant::now())], 42, ) .await; assert_eq!( events, vec![Event::success("one", Instant::now(), Instant::now())] ); } #[test] fn noop_step_does_not_require_capacity() { let step = NoopStep::<usize>::new(); ...
Rust
0
# Copyright (c) Streamlit Inc. (2018-2022) Snowflake Inc. (2022-2024) # # 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
import numpy as np from sklearn.metrics import f1_score, confusion_matrix, roc_curve, roc_auc_score, accuracy_score from sklearn.metrics import cohen_kappa_score as kappa def compute_metric(datanpGT, datanpPRED, target_names): n_class = len(target_names) argmaxPRED = np.argmax(datanpPRED, axis=1) F1_metri...
Python
1
d3d12::D3D12_DEPTH_WRITE_MASK_ZERO }, DepthFunc: map_comparison(ds.depth_compare), StencilEnable: if ds.stencil.is_enabled() { 1 } else { 0 }, StencilReadMask: ds.stencil.read_mask as u8, StencilWriteMask: ds.stencil.write_mask as u8, FrontFace: map_stencil_face(...
Rust
0
x<Set<String>> = Mutex::new(Set::new()); static ref START_P: ProbStart = serde_pickle::from_reader(load_model(PROB_START_P)).unwrap(); static ref TRANS_P: ProbTrans = serde_pickle::from_reader(load_model(PROB_TRANS_P)).unwrap(); static ref EMIT_P: ProbEmit = serde_pickle::from_reader(load_model(PROB_EMIT_P...
Rust
0
", "い", "え", "お", "って", "った"]); } GodanVerbTsu => { end_replace_push(word, "つ", &["た", "ち", "て", "と", "って", "った"]); } GodanVerbRu => { end_replace_push(word, "ち", &["ら", "り", "れ", "ろ", "って", "った"]); } GodanVerbKu ...
Rust
0
lone.profile_statemonitor_copy_to_host = 'v' warp_size = 32 num_recorded_neurons = self.n num_neurons = int(32 * 10**6) G = NeuronGroup(num_neurons, 'v:1') G.v = 'i' assert self.coalesced_reads is not None, "Don't use base benchmark class" if self.coalesced_reads...
Python
1
print(f"✅ 去掉阴影,直接使用原视频尺寸: {video_clip.size}") print(f"最终视频尺寸: {video_clip.size}, 时长: {video_clip.duration}") return video_clip except Exception as e: print(f"❌ 加载视频失败: {video_path}, 错误: {e}") # 返回一个合理大小的彩色占位符 import numpy as np placeholder_array = np.full((38...
Python
1
deepest_command<'a>(matches: &'a ArgMatches, path: &mut Vec<String>) -> &'a ArgMatches<'a> { let (name, subcommand_matches) = matches.subcommand(); path.push(name.to_string()); if let Some(matches) = subcommand_matches { return get_deepest_command(matches, path); } matches } fn reset_requir...
Rust
0
################################################################ # Now let’s plot model and data. We plot only the normalisation of the # temporal model in relative units for one particular energy range # plt.figure(figsize=(8, 7)) plt.subplots_adjust(bottom=0.3) dataset_fp.plot_spectrum(axis_name="time") plt.show() ...
Python
1
# Copyright (c) OpenMMLab. All rights reserved. import numpy as np from mmdet3d.datasets import SemanticKITTIDataset def test_getitem(): np.random.seed(0) root_path = './tests/data/semantickitti/' ann_file = './tests/data/semantickitti/semantickitti_infos.pkl' class_names = ('unlabeled', 'car', 'bicy...
Python
1
"migrate": "app/migrate", "migrate.sh": "app/migrate.sh", "templates": "app/templates", }, "stage": ["app/migrate", "app/migrate.sh", "app/static", "app/templates"], } @pytest.mark.usefixtures("go_extension") def test_go_extension_extra_assets_overridden(tmp_path, go_in...
Python
1
num1 = int(input("Enter the first number: ")) num2 = int(input("Enter the second number: ")) print(f"Floor division result: {num1 // num2}") print(f"Modulo result: {num1 % num2}")
Python
1
+0000") } else { // Else there is one so just convert dt_str to String dt_str.to_string() }; let fs = format!("{fmt_str}%#z"); let dtfo = DateTime::parse_from_str(&s, &fs)?; ...
Rust
0
21.0, 22.0, 23.0, 24.0, 31.0, 32.0, 33.0, 34.0, 41.0, 42.0, 43.0, 44.0, 51.0, 52.0, 53.0, 54.0); let expected_m = Matrix5x4::new( 11.0, 12.0, 0.0, 0.0, 21.0, 22.0, 23.0, 0.0, 31.0, 32.0, 33.0, 34.0, 41.0, 42.0, 43.0, 44.0, 51.0, 52.0, 53.0, 54...
Rust
0
xucxac3 = random.randint(1, 6) ket_qua = int(xucxac1 + xucxac2 + xucxac3) tai = [11,12,13,14,15,16,17,18] xiu = [4,5,6,7,8,9,10] if ket_qua == 3: print("Kết Quả") print("XỈU : {}".format(ket_qua)) ...
Python
1
] = "float" #申卖量四 CThostFtdcDepthMarketDataField["AskVolume4"] = "int" #申买价五 CThostFtdcDepthMarketDataField["BidPrice5"] = "float" #申买量五 CThostFtdcDepthMarketDataField["BidVolume5"] = "int" #申卖价五 CThostFtdcDepthMarketDataField["AskPrice5"] = "float" #申卖量五 CThostFtdcDepthMarketDataField["AskVolume5"] = "int" #当日均价 CThos...
Python
1
>salmans/rusty-razor use super::{constants::*, Error}; use itertools::Itertools; use razor_fol::{syntax, transform::Relational}; use std::convert::TryFrom; use std::ops::Deref; use std::str::FromStr; use Variant::*; /// Is the variants of attributes. #[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)] pub(su...
Rust
0
de`]'s attributes, because [`serde`] is very commonly //! used to read the structured data. //! //! # Examples //! //! ```rust //! # #![allow(dead_code)] //! use std::num::NonZeroU32; //! //! use serde_derive::Deserialize; //! use structdoc::StructDoc; //! //! #[derive(Deserialize, StructDoc)] //! struct Point { //! ...
Rust
0
# Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause from __future__ import annotations from PySide6.QtCore import Qt, qVersion, qFuzzyCompare from PySide6.QtGui import QGuiApplication, QFontDatabase from PySide6.QtWidgets import (QDialog, QDialogButtonBox, ...
Python
1
or; fn try_from(log_entry: &LogEntry) -> anyhow::Result<Self> { // Create a copy of the LogEntry, but skip the verification. let entry_subset = LogEntry { body: log_entry.body.clone(), integrated_time: log_entry.integrated_time, log_id: log_entry.log_id.clone(), ...
Rust
0
) -> HRESULT, fn get_Class( strClass: *mut BSTR, ) -> HRESULT, fn put_Class( strClass: BSTR, ) -> HRESULT, fn get_IsClass( bIsClass: *mut VARIANT_BOOL, ) -> HRESULT, fn SetAsClass() -> HRESULT, fn get_IsSingleton( bIsSingleton: *mut VARIANT_BOOL, ...
Rust
0
# coding=utf-8 # Copyright 2022 The SimREC 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...
Python
1
})?; Ok(()) } } <reponame>60ke/wasm_std //! 预留debug处理 mod external{ extern { pub fn debug(msg_ptr: *const u8, msg_len: u32); } } /// log of runtime's debug mode pub fn debug<'a>(msg: &'a str){ unsafe{ external::debug(msg.as_ptr(),msg.len() as u32); } } <filename>s...
Rust
0
me(e) => Err(nb::Error::Other(e)), None => Ok(w.response), } } } #[cfg(test)] mod test { use embedded_hal::adc::OneShot; use crate::adc::{Mock, MockChan0, MockChan1, MockChan2, Transaction}; use crate::MockError; use std::io::ErrorKind; #[test] fn test_adc_single_read1...
Rust
0
s: u_int32_t, pub tcpi_rcv_mss: u_int32_t, pub tcpi_unacked: u_int32_t, pub tcpi_sacked: u_int32_t, pub tcpi_lost: u_int32_t, pub tcpi_retrans: u_int32_t, pub tcpi_fackets: u_int32_t, pub tcpi_last_data_sent: u_int32_t, pub tcpi_last_ack_sent: u_int32_t, pub tcpi_last_data_recv: u_in...
Rust
0
import pandas as pd import os from sklearn.model_selection import train_test_split, cross_val_score from sklearn.tree import DecisionTreeClassifier, export_text from sklearn.metrics import classification_report from sklearn.linear_model import LogisticRegression # 設定路徑與讀取資料 DIR_PATH = os.path.dirname(os.path.realpath(...
Python
1
from config.database import db from bson import ObjectId async def create_comments(video_id: str, comments: list): result = await db.comments.insert_one( {"video_id": ObjectId(video_id), "comments": comments} ) return str(result.inserted_id) async def get_comments_by_video_id(video_id: str): ...
Python
1
import os ROOT_PATH = "" i = 0 for dir_size in [500, 1000]: for max_parallel in [10, 20, 30, 40, 50]: with open(f'./{i}.toml', 'w') as f: f.write(f""" thread = 4 max_parallel = {max_parallel} root_path = "{ROOT_PATH}" dir_cnt = 200 dir_size = {dir_size} zipf_s = 0 o...
Python
1
import os import sys import pygame def test_sound(sound_file): """Test if a specific sound file can be played.""" print(f"Testing sound file: {sound_file}") # Initialize pygame mixer pygame.mixer.pre_init(frequency=22050, size=-16, channels=2, buffer=512) pygame.mixer.init() if not os.path....
Python
1
he situation detected. pub fn force_skia_binaries_download() -> bool { env::var("FORCE_SKIA_BINARIES_DOWNLOAD").is_ok() } /// Force to build skia. pub fn force_skia_build() -> bool { env::var("FORCE_SKIA_BUILD").is_ok() } } const SRC_BINDINGS_RS: &str = "src/bindings.rs"; fn main(...
Rust
0
20 20 L 20 180 L 180.30273 180 L 180.30273 20 L 20 20 z M 100 55 L 145 145 L 55 145 L 100 55 z "/> /// <path style="fill:#aad400;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-" d="m 219.75767,872.36216 0,160.00004 160.30273,0 0,-160.00004 -160.30273,0 z m 80,35 4...
Rust
0
} ) result = { "index": index, "beams": decoded, } except Exception as e: result = {"index": index, "error": str(e), "trace": traceback.format_exc()} return json.dumps(result) + "\n" def main( args=None, logdir...
Python
1
Result<T, DE>) -> __ResultTuple { match res { Ok(_) => (IS_OK, 0, 0, '\0'), Err(err) => { let kind = err.kind() as isize; match err { DE::InvalidByte(x) => (kind, x.index, x.byte as _, x.as_char), DE::MismatchedOutputLength(x) => (kind, x.expe...
Rust
0
_string()))?; return Ok(res_obj); } } Err(HttpClientError::InternalError("Unexpected".to_string())) } pub async fn get<S>(&self, url: String, jwt_token: Option<String>) -> Result<S, HttpClientError> where S: DeserializeOwned, { let uri = url...
Rust
0
Path, to: &'a DavPath) -> FsFuture<()> { self.fs.copy(from, to) } #[cfg(feature = "quota")] fn get_quota<'a>(&'a self) -> FsFuture<(u64, Option<u64>)> { use crate::cache; use fs_quota::*; use futures::future::FutureExt; use std::time::Duration; lazy_static::...
Rust
0
from datetime import datetime from pydantic import UUID4 from sqlalchemy import func from sqlalchemy.dialects.postgresql import TIMESTAMP, UUID from sqlalchemy.orm import Mapped, mapped_column class UUIdMixin: id: Mapped[UUID4] = mapped_column( UUID(as_uuid=True), primary_key=True, server...
Python
1
R Adjusted for ELB: {:.2f}%".format( data['adjusted_fdr_rule_after_elb'])) print("\n Policy Inertia Adjustment:") print(" Policy Inertia Coefficient (rho): {:.2f}".format( data['rho'])) print(" Last Fed Rate: * {:....
Python
1
prInstance { nodes: (a, b) })), )) } #[tracable_parser] #[packrat_parser] pub(crate) fn sequence_expr_paren(s: Span) -> IResult<Span, SequenceExpr> { let (s, a) = paren(pair( sequence_expr, many0(pair(symbol(","), sequence_match_item)), ))(s)?; let (s, b) = opt(sequence_abbrev)(s)?; ...
Rust
0
WeatherCondition { pub fn to_metar(self) -> &'static str { match self { WeatherCondition::SlightRain => "-RA", WeatherCondition::Rain => "RA", WeatherCondition::HeavyRain => "+RA", WeatherCondition::Thunderstorm => "TS", WeatherCondition::Fog => "...
Rust
0
###################################################################### # # File: b2sdk/_internal/requests/included_source_meta.py # # Copyright 2022 Backblaze Inc. All Rights Reserved. # # License https://www.backblaze.com/using_b2_code.html # ###################################################################### from ...
Python
1
MS_NOEXEC | libc::MS_RDONLY) as usize, )?; // To enable perfetto tracing, we need to give access to the perfetto service IPC // endpoints. let perfetto_path = Path::new("/run/perfetto"); if perfetto_path.exists() { jail.mount_bind(perfetto_pat...
Rust
0
Err(status) } else { Ok(()) } } #[cfg(feature = "cl_intel_accelerator")] pub fn create_accelerator_intel( context: cl_context, accelerator_type: cl_accelerator_type_intel, descriptor_size: size_t, descriptor: *const c_void, ) -> Result<cl_accelerator_intel, cl_int> { let mut status:...
Rust
0
#!/usr/bin/python ## ### # IP: GHIDRA # # 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...
Python
1
from typing import Optional import click from pathlib import Path from platformdirs import user_data_dir, user_config_dir OLD_CONFIG = Path(user_data_dir("dooit")) / "todo.yaml" VERSION = "3.3.3" def run_dooit(config: Optional[str] = None, db_path: Optional[str] = None): config_path = None if not config else Pat...
Python
1
-> Option<Self::Output> { let ($($name,)*) = ZipExt::<<&Self::WorldBorrows as AsRefExt>::Output>::zip(self.as_ref(), borrows.as_ref()); $( let (fetch, borrows) = $name; let $name = $name::get_world(fetch, borrows, id)?; )* ...
Rust
0
import numpy import copy class CreateHardDistortion(): """Creating a distortion audio-effect class/device. Its a wave-shaper and messes with dynamic range, but doesn't introduce latency. Parameters ---------- None : None """ def __init__(self): self.linear_limit = 0.8 def ap...
Python
1
ijk2[[i, j, j]], eta, &CD) * (mu2_term[i] * mu2_term[j] * mu2_term[j] / (p.sigma_ij[[di, dj]] * p.sigma_ij[[di, dj]] * p.sigma_ij[[dj, dj]]) * 3.0)); for k in j + 1..p.ndipole { let dk = p.dipole_comp[k]; phi3 -= &...
Rust
0
U0001ee51', '\U0001ee52'), ('\U0001ee54', '\U0001ee54'), ('\U0001ee57', '\U0001ee57'), ('\U0001ee59', '\U0001ee59'), ('\U0001ee5b', '\U0001ee5b'), ('\U0001ee5d', '\U0001ee5d'), ('\U0001ee5f', '\U0001ee5f'), ('\U0001ee61', '\U0001ee62'), ('\U0001ee64', '\U0001ee64'), ('\U0001ee67', '\U0001ee6a'),...
Rust
0