text
string
label_name
string
labels
int64
} if (number_of_columns == None): no_columns = log.progress("No columns found") no_columns.status("No columns found") else: for i in range(0, number_of_columns): column_name = log.progress("Column %s" % i) column_nam...
Python
1
chemical id that is produced, contains amount produced and required. produced_by: Vec<(ChemicalAmount, Vec<ChemicalAmount>)>, fuel_id: ChemicalId, ore_id: ChemicalId, } impl Reactions { fn parse(input_string: &str) -> Reactions { let mut id_assigner = ChemicalIdAssigner::new(); // Ind...
Rust
0
::from(1 as i8)]); //! # client.run_with_metadata("MATCH (n {test: 'doctest-v3'}) DETACH DELETE n;", None, None).await?; //! # client.pull_all().await?; //! # //! # let params = Params::from_iter(vec![("name", "Rust")]); //! # client.run_with_metadata( //! # "CREATE (:Client {test: 'doctest-v3'}...
Rust
0
def forward_vit(pretrained, x): b, c, h, w = x.shape glob = pretrained.model.forward_flex(x) layer_1 = pretrained.activations['1'] layer_2 = pretrained.activations['2'] layer_3 = pretrained.activations['3'] layer_4 = pretrained.activations['4'] layer_1 = pretrained.act_postprocess1[0:2](laye...
Python
1
image_data = cv2.cvtColor(image_data, cv2.COLOR_HSV2RGB) #---------------------------------# # 对真实框进行调整 #---------------------------------# if len(box)>0: np.random.shuffle(box) box[:, [0,2,4,6,8,10,12]] = box[:, [0,2,4,6,8,10,12]]*nw/iw + dx ...
Python
1
(Resource, NonZeroU32) { ( Resource::Crystal(DatabaseId::default()), NonZeroU32::new(10_f64.powi(self.properties[3] as i32 - 1) as u32).unwrap(), ) } fn longitude_resolution_req(&self) -> (Resource, NonZeroU32) { ( Resource::Crystal(DatabaseId::defaul...
Rust
0
OUTPUTN_A::PLU_OUTPUT5 } #[doc = "Checks if the value of the field is `PLU_OUTPUT6`"] #[inline(always)] pub fn is_plu_output6(&self) -> bool { **self == OUTPUTN_A::PLU_OUTPUT6 } #[doc = "Checks if the value of the field is `PLU_OUTPUT7`"] #[inline(always)] pub fn is_plu_output7(...
Rust
0
b']' => { sum -= 1; if sum < 0 { return false; } }, _ => (), } } sum == 0 } #[inline] fn munch_forward( bytes: &[u8], index: &mut usize, inc: u8, dec: u8 ) -> i32 { let mut sum = 0; while let Some(&byte) = by...
Rust
0
import copy dx, dy = [0,1,0,-1],[1,0,-1,0] def backtrack(i, result) : global min_value if i == K: # 백트래킹 완료 시 for j in result: # 최소값 비교 if min_value > sum(j): min_value = sum(j) for idx in range(K): if visit[idx] == 0 : ...
Python
1
\s\\s\\s\\u{2665}\\u{2665}\\u{2665}\\s\\d\\d\\sand\\s\\d\\sand\\sy\\u{306}y\\u{306}\\sand\\s\\u{1f4a9}\\u{1f4a9}\\.$\n" )); } #[test] fn succeeds_with_escape_and_surrogate_option() { let mut grex = init_command(); grex.args(&[ "--digits", ...
Rust
0
ete, Insert { auto_increment_id: AutoIncrementId, returning: Option<SelectType<'a>>, }, Update, Replace { returning: Option<SelectType<'a>>, }, Invalid, } pub(crate) fn type_statement<'a, 'b>( typer: &mut Typer<'a, 'b>, statement: &Statement<'a>, ) -> InnerStatem...
Rust
0
import random import numpy as np import pinocchio as pin import torch def set_random_seed(seed): """Set random seed.""" random.seed(seed) np.random.seed(seed) torch.manual_seed(seed) torch.cuda.manual_seed(seed) torch.cuda.manual_seed_all(seed) def get_pose_from_rot_pos(rot, pos): """Ge...
Python
1
import pytest import time from utils.exception_handler.decorator_error_handler import exception_handler from pages.workflow_editor_page import WorkflowEditorPage from utils.refresh_and_wait import refresh_and_wait from settings.variables import USER1_LOGIN import allure @allure.severity(allure.severity_level.CRITICAL)...
Python
1
pub context_hash: ContextHash, pub protocol_hash: ProtocolHash, pub next_protocol_hash: ProtocolHash, pub block_header_proto_json: String, pub block_header_proto_metadata_bytes: Vec<u8>, pub operations_proto_metadata_bytes: Vec<Vec<Vec<u8>>>, pub max_operations_ttl: i32, pub last_allowe...
Rust
0
/// c pub enum Ccw { CounterClockwise, Clockwise, OnlineBack, OnlineFront, OnSegment, } /// Returns a counter-clockwise result from given three points pub fn ccw(a: Point2d, b: Point2d, c: Point2d) -> Ccw { let ...
Rust
0
import argparse import os from pydub import AudioSegment from tqdm import tqdm # 导入 tqdm 库 def cut_audio(input_audio_path, start, duration, output_audio_path): """ 从原始音频中切割指定时间段的音频片段 :param input_audio_path: 原始音频路径 :param start: 起始时间(秒) :param duration: 持续时间(秒) :param output_audio_path: 输出音频片...
Python
1
40, ] ); set_pokemon_pic_test!( set_pokemon_pic_front_105, 105, PokemonPicFace::FRONT, "../secrets/data/pokemon_pic/front-105.png", PicEncodingMethod::TWO(1), 0x32F8F, vec![ 0x66, 0xA1, 0xFD, 0x4F, 0x3F, 0x7D, 0x3C, 0x85, 0x18, 0x8A, 0x3C, 0xE5, 0x41, 0x55, 0x55, 0x4F, 0...
Rust
0
pub sequence: u16, pub length: u32, } impl TryParse for GrabKeyboardReply { fn try_parse(initial_value: &[u8]) -> Result<(Self, &[u8]), ParseError> { let remaining = initial_value; let (response_type, remaining) = u8::try_parse(remaining)?; let (status, remaining) = u8::try_parse(rem...
Rust
0
lor(111, 0, 255); pub const ELECTRIC_LAVENDER: RgbColor = RgbColor(244, 187, 255); pub const ELECTRIC_LIME: RgbColor = RgbColor(204, 255, 0); pub const ELECTRIC_PURPLE: RgbColor = RgbColor(191, 0, 255); pub const ELECTRIC_ULTRAMARINE: RgbColor = RgbColor(63, 0, 255); pub const ELECTRIC_VIOLET: RgbCo...
Rust
0
elif response.__contains__("NoMatchingTemplate"): print "NoMatchingTemplate" ans = search_summary.kwquery(input_message) if len(ans) == 0: ans = mybot.respond('找不到答案') print 'Eric:' + ans ...
Python
1
# coding=utf-8 from numpy import * from numpy.linalg import * inp = open('input.txt', 'r') out = open('output.txt', 'w') n, m = 5, 5 A, f, E = [], [], identity(n) eps = 10 ** (-5) for line in inp: # читаем А и b temp = [float(x) for x in line.split()] f.append(temp.pop()) A.append(temp) a, b = array(A)...
Python
1
# finished_page.py # # Copyright 2025 sepehr-rs # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is di...
Python
1
# -*- coding: utf-8 -*- """ This program needs the following libraries to work : - PyCrypto - Click - SCP (You can install them with `pip install click scp pycrypto`) """
Python
1
# ------------------------------------------------------------------------------ # Copyright 2022 Upstream Data Inc - # - # Licensed under the Apache License, Version 2.0 (the "License"); ...
Python
1
.with_spacer(1.0) .with_flex_child( flex_row( digit_button(7), digit_button(8), digit_button(9), op_button('×'), ), 1.0, ) .with_spacer(1.0) .with_flex_child( flex_row( ...
Rust
0
ps.append(chat) except Exception: continue for i, group in enumerate(groups): print(f'{gr}[{cy}{str(i)}{gr}]{cy} - {group.title}|{group.title}') print('') if (target_group == ''): g_index = input( f"{gr}[+] Введите номер группы для инвайта пользователей или N...
Python
1
, "nreset_i"] ); emit_rp_group_end("dff") emit_module_footer() if len(sys.argv) == 4 : # suffix, basecell; e.g. dff, dff generate_dff_nreset_en( sys.argv[1], int(sys.argv[2]), int(sys.argv[3]) ); else : if ((len(sys.argv) == 5) and (sys.argv[4]==...
Python
1
""" pytest 配置文件,提供共享的测试配置和夹具 """ import pytest def pytest_addoption(parser: pytest.Parser): """添加命令行选项""" parser.addoption("--target", default="127.0.0.1", help="目标主机名或 IP 地址") parser.addoption("--timeout", type=int, default=5000, help="超时时间(毫秒)") parser.addoption("--interval", type=int, default=1000...
Python
1
_hack!(_mm256_srli_epi64, MaximumLaneCrossingShift - 51), 52 => compiler_const_generics_hack!(_mm256_srli_epi64, MaximumLaneCrossingShift - 52), 53 => compiler_const_generics_hack!(_mm256_srli_epi64, MaximumLaneCrossingShift - 53), 54 => compiler_const_generics_hack!(_mm256_srli_epi64, MaximumLaneCrossingShift - ...
Rust
0
+= ( ( pix >> 8 ) & 0xff ) as u8; rgba[ 2 ] += ( ( pix >> 0 ) & 0xff ) as u8; rgba[ 3 ] += ( ( pix >> 24 ) & 0xff ) as u8; rgba[ 3 ] = 0xff; *pixel = image::Rgba(rgba); }; match imgbuf.save(filename) { Err(e) => { println!("Error saving PNG: {:?}", e ); }, _ => {}, } } ...
Rust
0
efault) => write!(f, "DEFAULT {}", default), Self::Collation(collation) => write!(f, "COLLATE {}", collation), } } } /// SQL table constraint definition. /// /// ```txt /// <table constraint definition> ::= [ CONSTRAINT <constraint name> ] <table constraint> /// ``` pub type TableConstraintDef ...
Rust
0
from operations import sub, sum print(sum(1, 2)) print(sub(1, 2))
Python
1
{Client, Result}; use serde::{de::DeserializeOwned, Deserialize}; /// - https://docs.kraken.com/rest/#operation/unstake /// - https://api.kraken.com/0/private/Unstake #[must_use = "Does nothing until you send or execute it"] pub struct UnstakeAssetRequest { client: Client, /// Asset to unstake (asset ID or alt...
Rust
0
/', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', ':', ';', '<', '=', '>', '?', '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '[', '\\', ']', '^', '_', '`', 'c', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'm', 'n', 'p', 'q', 't', 'w', ...
Python
1
CityGML', 'vtkIOChemistry', 'vtkIOCesium3DTiles', 'vtkIOCONVERGECFD', 'vtkIOHDF', 'vtkIOCGNSReader', 'vtkIOAsynchronous', 'vtkIOAMR', 'vtkInteractionImage', 'vtkImagingStencil', 'vtkImagingStatistics', 'vtkImagingGeneral', 'vtkImagingOpenGL2', 'vtkImagingMorphological...
Python
1
import sys from pathlib import Path sys.path.append(str(Path(__file__).parent.parent)) from automata.backend.grammar.transducers.scfg_parser import SCFG def main(): """ Shows an example of converting an SCFG to Chomsky Normal Form. """ # 1. Define a grammar that is not in CNF grammar_str = """ ...
Python
1
el="CDF_negative") plt.plot(a['percent'],a['ks'],label="K-S") sx = np.linspace(0,1,10) sy = sx plt.plot(sx,sy,linestyle='--',color='darkgrey',linewidth=1.2) plt.legend() plt.grid(True) ymin, ymax = plt.ylim() plt.xlabel('Sample percent') plt.ylab...
Python
1
value ))) } }, validator_address: asc_new(heap, &Bytes(&self.validator_address), gas)?, timestamp: asc_new_or_missing(heap, &self.timestamp, gas, "CommitSig", "timestamp")?, signature: asc_new(heap, &Bytes(&self.signature), gas)?, ...
Rust
0
ime result = SuccessResponse( data=SuccessData( answer=final_synthesis, consensus=ConsensusInfo( models_queried=len(models), models_succeeded=len(valid_responses), models_failed=len(responses) - len(valid_res...
Python
1
> { check_integer(self)?; Ok(<i32>::try_from(self.as_i64().ok_or_else(|| self.expected(JsonTy::Number))?)?) } fn parse_i64(&self) -> Result<i64, FieldError> { check_integer(self)?; self.as_i64().ok_or_else(|| self.expected(JsonTy::Number)) } fn parse_string(&self, max: u3...
Rust
0
348, fill=0 before: qualifier_emb : [a,b,c,d,e,f,g,......] (here a,b,c ... are of 200 dim) qual_index : [1,1,2,1,2,3,2,......] (here 1,2,3 .. are edge index of Main COO) edge_type 190348 : [0,0,0,0,0,0,0, .....] (...
Python
1
::core::option::Option<unsafe extern "C" fn(n: GLsizei, semaphores: *mut GLuint)>; pub type PFNGLDELETESEMAPHORESEXTPROC = ::core::option::Option<unsafe extern "C" fn(n: GLsizei, semaphores: *const GLuint)>; pub type PFNGLISSEMAPHOREEXTPROC = ::core::option::Option<unsafe extern "C" fn(semaphore: GLuint) -> GLb...
Rust
0
import torch from torchmdnet.models.model import load_model class External: def __init__(self, netfile, embeddings, device="cpu"): self.model = load_model(netfile, device=device, derivative=True) self.device = device self.n_atoms = embeddings.size(1) self.embeddings = embeddings.re...
Python
1
root /// /// This information is used to compute the hash /// /// - Dependencies in `Xargo.toml` for a specific target /// - RUSTFLAGS / build.rustflags / target.*.rustflags /// - The target specification file, is any /// - `[profile.release]` in `Cargo.toml` /// - `rustc` commit hash fn hash( cmode: &CompilationMo...
Rust
0
('aarch64', 'Linux'): 'linux-arm64', ('armv7l', 'Linux'): 'linux-arm-7', ('mips64', 'Linux'): 'linux-mips64', ('mips64le', 'Linux'): 'linux-mips64le', ('ppc64le', 'Linux'): 'linux-ppc64le', ('riscv64', 'Linux'): 'linux-riscv...
Python
1
``` pub fn as_str_vector(&self) -> Option<Vec<&str>> { if let Some(iter) = self.as_str_iter() { Some(iter.collect()) } else { None } } /// Get a read-only reference to a scalar string type. /// ``` /// use extendr_api::prelude::*; /// test! { ...
Rust
0
OO` is dropped last. }); scope.spawn(|_| { thread::sleep(ms(100)); s.send(()).unwrap(); }); }).unwrap(); } use python_runner::*; #[test] fn load_lib() { test_function(); }//! A lightweight low-level CoAP message manipulation crate. //! //! Its goal is to be comp...
Rust
0
cls.mean.x == 2.0 && cls.mean.y == 3.0); assert!(cls.n == 2); } #[derive(Debug)] struct Classifer { list: Vec<Class>, ncls_dist: f32, } impl Classifer { pub fn new(mdist: f32) -> Classifer { Classifer { ncls_dist: mdist, list: Vec::new() } } pub fn classificate(&mut self, m: &Measure)...
Rust
0
:3 root stylesheet", ); } } mod scope { #[allow(unused)] fn runner() -> crate::TestRunner { super::runner().with_cwd("scope") } #[test] #[ignore] // missing error fn diamond() { let runner = runner().with_cwd("diamond"); assert_eq!( runner.err( ...
Rust
0
# Problem: High Low # We want you to gain more experience working with control flow and Booleans in Python. To do this, we are going to have you develop a game! The game is called High-Low and the way it's played goes as follows: # Two numbers are generated from 1 to 100 (inclusive on both ends): one for you and one f...
Python
1
import sqlite3 def create_table(): conn = sqlite3.connect('Employees.db') cursor = conn.cursor() cursor.execute(''' CREATE TABLE IF NOT EXISTS Employees ( id TEXT PRIMARY KEY, name TEXT, role TEXT, gender TEXT, status TEXT, ...
Python
1
.ok_or("title requires a parameter".to_string()) .and_then(|param| { Regex::new(param) .map(|r| Some(Match::Title(r))) .map_err(|e| format!("title: {}", e)) }), "urgent" => token_split .get(1) .ok_or("ur...
Rust
0
# Copyright (C) 2020-2025 Mitsubishi Electric Research Laboratories (MERL) # # SPDX-License-Identifier: AGPL-3.0-or-later # Code purpose: Check if methods in pycvxset are consistent from pycvxset import ConstrainedZonotope, Ellipsoid, Polytope in_polytope_but_not_in_constrained_zonotope = [ v for v in dir(Po...
Python
1
unsafe { std::slice::from_raw_parts(offsets.raw_data() as *const i32, num_agents + 1) }; (0..num_agents).flat_map(move |j| { let num_messages = i32_offsets[j + 1] - i32_offsets[j]; let agent_index = j as u32; (0..num_messages).map(move |k| (group_index, agent_index...
Rust
0
mod RW {} } /// Sequence Index for AHB Write triggered Command. pub mod AWRSEQID { /// Offset (8 bits) pub const offset: u32 = 8; /// Mask (4 bits: 0b1111 << 8) pub const mask: u32 = 0b1111 << offset; /// Read-only values (empty) pub mod R {} /// Writ...
Rust
0
RRR[ US5S5nUHlnUVs/sHn[ UR 55PM nnUR[RRSRU5S-55 ...
Python
1
mesh.triangles = open3d.utility.Vector3iVector(mano.th_faces) hand_verts = hand_verts.clone().detach().cpu().numpy()[0] hand_verts = mesh_fliter.process(hand_verts) hand_verts = np.matmul(view_mat, hand_verts.T).T hand_verts[:, 0] = hand_verts[:, 0] - 50 hand_verts[:, 1] = hand_verts[:, 1] - 50 ...
Python
1
* cos + sin * sin; let difference = (1.0 - result).abs(); assert!( difference < 1e-10, "cos^2 + sin^2 for {:?} returned value different from 1", source ); }); } #[test] fn sin_asin_test() { let mut rng = rand::thread_rng(); let dist = rand::distr...
Rust
0
trainer: sac batch_size: 32 buffer_size: 10240 buffer_init_steps: 1000 hidden_units: 64 init_entcoef: 0.01 learning_rate: 5.0e-3 max_steps: 2000 memory_size: 256 normalize: false num_update: 1 train_interval: 1 num_...
Python
1
n::from_str(&data).unwrap(); assert_eq!( tag, TagInfo { name: "Exec".into(), path: "crates/maple_cli/src/cmd/exec.rs".into(), pattern: "/^pub struct Exec {$/".into(), line: 10, kind: "struct".into() ...
Rust
0
its 3:4"] #[inline(always)] pub fn gpio_pin9_sync1_bypass(&mut self) -> GPIO_PIN9_SYNC1_BYPASS_W { GPIO_PIN9_SYNC1_BYPASS_W { w: self } } #[doc = "Bit 2"] #[inline(always)] pub fn gpio_pin9_pad_driver(&mut self) -> GPIO_PIN9_PAD_DRIVER_W { GPIO_PIN9_PAD_DRIVER_W { w: self } }...
Rust
0
(frame.line as i32); let col = Object::Int(frame.col as i32); let name = frame.name; Ok(Object::from(vec![id, line, col, name])) } fn stack_len(env: &mut Env, _pself: &Object, _argv: &[Object]) -> FnResult { Ok(Object::Int(frame_stack_len(env) as i32)) } /* == Backlinks == info, stack_len: sys.trace, ...
Rust
0
import bpy from maze_generator.blender.mesh.helper import update_mesh_smooth def update_smooth_all_meshes(self): for mesh in (self.cells, self.walls): update_mesh_smooth(mesh, self.use_smooth) class MeshesPropertyGroup(bpy.types.PropertyGroup): """ Stores the meshes used in the add-on """ ...
Python
1
pache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your option. // All files in the project carrying such notice may not be copied, modified, or distributed // except according to those terms. //! Url History Interfaces use ctypes::c_void; use shared::guiddef::...
Rust
0
128Cfb128::IV_LEN, CAMELLIA_192_CFB1 => Camellia192Cfb1::IV_LEN, CAMELLIA_192_CFB8 => Camellia192Cfb8::IV_LEN, CAMELLIA_192_CFB128 => Camellia192Cfb128::IV_LEN, CAMELLIA_256_CFB1 => Camellia256Cfb1::IV_LEN, CAMELLIA_256_CFB8 => Camellia256Cfb8::IV_LEN, ...
Rust
0
$on_die_termination }]")); assert!(xdc.contains("set_property IOSTANDARD SSTL15 [get_ports { uut$on_die_termination }]")); assert!(xdc.contains("set_property PACKAGE_PIN AA1 [get_ports { uut$data_mask[0] }]")); assert!(xdc.contains("set_property PACKAGE_PIN V2 [get_ports { uut$data_mask[1] }]")); asser...
Rust
0
digit(16).unwrap() as u8; let lower = (*iter.next().unwrap() as char) .to_digit(16).unwrap() as u8; res.push(upper << 4 | lower); } else { res.push(*ch) } } ...
Rust
0
ad_code)] pub struct Running { child_pid: i32, input: Option<RunningInput>, output: Option<RunningOutput>, error: Option<RunningOutput>, term_thr: Arc<Mutex<JoinHandle<()>>>, term_delay: Arc<Mutex<Option<Duration>>>, wait_thr: JoinHandle<()>, result: Arc<(Mutex<Option<i32>>, Con...
Rust
0
# Copyright 2023 The Google Earth Engine Community 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable...
Python
1
// winners.sort_by(|a,b|a.spot.cmp(&b.spot)); // for i in 0..vie.podium.len() { // let winnings = vie.podium[i].payout.clone(); // let competitor = winners[i].competitor.clone(); // T::Currency::repatriate_reserved(&vie.operator,&competitor,winnings,BalanceStatus::Free); // } // true // } fn validat...
Rust
0
el::Error) || (level == log::Level::Warn) || (level == log::Level::Info) } fn log(&self, record: &log::Record) { if !self.enabled(record.metadata()) { return; } let level = record.level(); let msg = JsValue::from_str(&format!("{}", record.args...
Rust
0
::default(), entries_alive: Default::default(), specialized_widgets, style, root_keys: Default::default(), } } pub fn get_root_keys_mut(&mut self) -> &mut Vec<Key> { &mut self.root_keys } pub fn get_widgets_mut(&mut self) -> &mut HashMap<Ty...
Rust
0
keypoints2d, src='mano', dst='human_data') keypoints3d = np.array(keypoints3d) keypoints3d, keypoints3d_mask = convert_kps( keypoints3d, src='mano', dst='human_data') smplx['global_orient'] = np.array(smplx['global_orient']).reshape( -1, 3) smplx['betas'] = np.ar...
Python
1
mber_name = comment['member']['uname'] comment_time = Tools.format_timestamp(int(comment['ctime'])) # 使用 dict.get() 方法获取字段值,提供默认值,避免 keyError。 reply_control = comment.get('reply_control', {}) sub_reply_entry_text = reply_control.get('sub_reply_entry_text', 'N/A') ...
Python
1
/// /// # Example /// /// ``` /// use stm32wlxx_hal::subghz::LoRaBandwidth; /// /// assert_eq!(LoRaBandwidth::Bw7.hertz(), 7_810); /// assert_eq!(LoRaBandwidth::Bw10.hertz(), 10_420); /// assert_eq!(LoRaBandwidth::Bw15.hertz(), 15_630); /// assert_eq!(LoRaBandwidth::Bw20.hertz(), 2...
Rust
0
let (x1, y1, x2, y2) = scan_fmt!(line, "{},{} -> {},{}", usize, usize, usize, usize).unwrap(); ((x1, y1), (x2, y2)) }) } fn draw_line(grid: &mut Array2<usize>, ((x1, y1), (x2, y2)): Pair) { let increment = if x1 == x2 || y1 == y2 { array![[1]] // Horizontal or vertical line ...
Rust
0
ct_token(Token::COMMA)?; match self.lexer.next_token()? { Token::REGISTER(reg) => Ok(0x8004 + 0x100 * register + 0x10 * reg), Token::BYTE(byte) => Ok(0x7000 + 0x100 * register + byte), token => Err(format!("Unexpected token {:?}", token).into()...
Rust
0
, /// promise to be online until which block pub promise: BlockNumber, } impl From<Geode<AccountId, Hash>> for WrappedGeode<Hash> { fn from(geode: Geode<AccountId, Hash>) -> Self { WrappedGeode { id: geode.id.into(), provider: geode.provider.into(), order: geode....
Rust
0
load type 0x{:02x} for LTE RRC OTA packet version 0x{:02x} is not known'.format(item.pdu_num, pkt_version)) self.parent.logger.log(logging.DEBUG, util.xxd(pkt_body)) return None pkt_ts = util.parse_qxdm_ts(pkt_header.timestamp) ts_sec = calendar.timegm(pkt_ts.timetuple()) ...
Python
1
from database.models import Referrer, User from plugins.settings.language import language from pyrogram import Client, filters from sqlalchemy import exists, select, update @Client.on_message(filters.command("start")) async def message(Client, message): params = message.command[-1] if message.command[-1] != "star...
Python
1
# Heater handling on homing moves # # Copyright (C) 2016-2018 Kevin O'Connor <kevin@koconnor.net> # # This file may be distributed under the terms of the GNU GPLv3 license. import logging class HomingHeaters: def __init__(self, config): self.printer = config.get_printer() self.printer.register_ev...
Python
1
in visited_points: visited_points.add(config_point) new_configs = True if cur_score == last_best_score: rounds_since_last_improvement += 1 else: rounds_since_last_improvement = 0 if not changed or ro...
Python
1
# Copyright (c) 2022 Hongji Wang (jijijiang77@gmail.com) # # 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...
Python
1
""" 手机卡数据模型定义 """ from datetime import datetime from typing import List, Optional from decimal import Decimal from sqlalchemy import Column, Integer, String, Text, DECIMAL, DateTime, Index from pydantic import BaseModel, Field from database import Base class MobileCardLatest(Base): """手机卡最新数据表""" __tablenam...
Python
1
se_adv_norm", # Whether to use advantage normalization. type="bool", distribution=[True, False], log=False, default=False ), Hyperparameter( name="use_gae", # Whether to use GAE trick. type="bool", distribution=[True, False], log=False, d...
Python
1
# -*- coding: utf-8 -*- """ Created on Sun Jun 26 08:03:07 2016 @author: rlabbe """ from filterpy.common import Saver from filterpy.kalman import CubatureKalmanFilter as CKF from filterpy.kalman import UnscentedKalmanFilter as UKF from filterpy.kalman import MerweScaledSigmaPoints import numpy as np from numpy.random...
Python
1
#!/usr/bin/env python # coding: utf-8 # import argparse import importlib from PIL import Image, ImageDraw, ImageFont popfe = importlib.import_module("pop-fe") from gamedb import games def has_transparency(img): if img.info.get("transparency", None) is not None: return True if img.mode == "P": t...
Python
1
let id_b = id_slab.insert(2); let id_c = id_slab.insert(3); // Id-s all differ from each other. assert!(id_a != id_b); assert!(id_b != id_c); assert!(id_c != id_a); // `get` returns the correct values. assert_eq!(id_slab.get(id_a).map(|&x| x), Some(1)); ...
Rust
0
"""Tests for runway.cfngin.lookups.registry.""" from __future__ import annotations from typing import TYPE_CHECKING, Any import pytest from runway.cfngin.lookups.handlers.default import DefaultLookup from runway.cfngin.lookups.registry import ( CFNGIN_LOOKUP_HANDLERS, register_lookup_handler, unregister...
Python
1
class Target: """ The Target defines the domain-specific interface used by the client code. """ def request(self) -> str: return "Target: The default target's behavior." class Adaptee: """ The Adaptee contains some useful behavior, but its interface is incompatible with the existi...
Python
1
price_format_data() { let mut t = new_test_ext(); let price_key_btc_price = PriceKey::create_on_vec(to_test_vec("btc_price")); let price_key_eth_price = PriceKey::create_on_vec(to_test_vec("eth_price")); let price_key_dot_price = PriceKey::create_on_vec(to_test_vec("dot_price")); let price_key_xrp_price = PriceKe...
Rust
0
usb_context) } Err(ContextInitializationError::CouldNotAllocateMemoryInRust(error)) } } } #[inline(always)] pub(crate) fn as_ptr(&self) -> *mut libusb_context { self.inner().libusb_context } #[inline(always)] fn fallible_clone(&self) -> Result<Self, ContextInitializationError> { let (previous_r...
Rust
0
import acpc_python_client.agent_lib as lib import acpc_python_client.wrappers as wrappers from acpc_python_client.data.game import Game from acpc_python_client.data.state import State _MAX_SUITS = 4 _MAX_RANKS = 13 def card_rank(card): """Returns card rank from card's int representation. Args: card...
Python
1
import sys def diverse_garland(): n = int(input()) s = input() # Initialize 2D array DP_state[][] with zeros dp = [[0] * 3 for _ in range(n + 1)] # Fill the base case (first lamp) for i in range(3): if s[0] == 'R' and i == 0: dp[1][i] = 2 elif s[0] == 'G' and i == ...
Python
1
import bpy from . icons import get_ToolkitIconId class OBJECT_PT_paradox_geometry(bpy.types.Panel): bl_idname = "OBJECT_PT_ParadoxGeometry" bl_label = "Construct Geometry" bl_space_type = "VIEW_3D" bl_region_type = "UI" bl_category = "Paradox Tools" bl_context = "objectmode" def draw(self,...
Python
1
odelA, context: dict[str, Any]): audio_file_path = data_dict['audio_file_path'] resp = stt_model.audio_2_text(audio_file_path) context['stt_name'] = stt_model.name context['stt_time_sec'] = resp.spent_time_sec context['stt_output'] = resp.text return {'question': resp.text} parse_audio_...
Python
1
ction) # Open right gripper self.move(self.open_gripper(ArmTag("right"))) # Move left arm to end position while moving right arm to origin self.move((ArmTag("left"), [left_end_action]), self.back_to_origin("right")) # Open left gripper ...
Python
1
fs::read_to_string("dog_facts.json") .expect("Dog facts file not found!")).unwrap(); fact_count.with_label_values(&["dog"]).inc_by(facts.len() as i64); println!("Dog facts loaded!"); facts }; println!("----------------------"); println!("Loading API Admins...")...
Rust
0
class Solution: def assignBikes(self, workers, bikes) -> int: def permutations(iterable, r=None): # permutations('ABCD', 2) --> AB AC AD BA BC BD CA CB CD DA DB DC # permutations(range(3)) --> 012 021 102 120 201 210 pool = tuple(iterable) n = len(pool) ...
Python
1
# -*- coding: utf-8 -*- # Copyright 2025 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...
Python
1