text
string
label_name
string
labels
int64
#! /usr/bin/env python2 # -*- coding: utf-8 -*- import struct import sfml as sf # This example shows how you can manipulate the raw string given by # sf.Image.get_pixels(). def main(): window = sf.RenderWindow(sf.VideoMode(640, 480), 'Pixels test') window.framerate_limit = 60 princess = sf.Image.load_...
Python
1
use web30::client::Web3; use web30::types::SendTxOption; // this is required until we migrate our endpoints to async actix // this way we can queue a withdraw from the old futures endpoint // and then process it in a async/await compatible environment and use // the newer web30 now required by eip1550 // only one wit...
Rust
0
import time from datetime import datetime, timedelta import pygame def playAudio(): pygame.mixer.init() pygame.mixer.music.load("audioFiles/audio1.mp3") pygame.mixer.music.play() while pygame.mixer.music.get_busy(): time.sleep(1) pygame.mixer.music.load("audioFiles/audio2.mp3") pygame...
Python
1
found `&y/int` //~^ ERROR mismatched types: expected `&x/int` but found `&y/int` fail; } ) |foo| { let a: &x/int = foo(x, x, |_x, _y, z| z ); let b: &x/int = foo(x, a, |_x, _y, z| z ); let c: &x/int = foo(a, a, |_x, _y, z| z ); ...
Rust
0
) }); } // Set software control adc.cr.modify(|_, w| w.burst().software_controlled_()); // Set lowpower mode, if requested adc.cr.modify(|_, w| w.lpwrmode().bit(low_power)); // Set 10-bit conversion mode adc.cr.modify(|_, w| w.mode10bit().bit(mode10bit)); // Set rising/fallin...
Rust
0
DATA_FINISH_CNT` reader"] pub struct R(crate::R<LEDC_DATA_FINISH_CNT_SPEC>); impl core::ops::Deref for R { type Target = crate::R<LEDC_DATA_FINISH_CNT_SPEC>; #[inline(always)] fn deref(&self) -> &Self::Target { &self.0 } } impl From<crate::R<LEDC_DATA_FINISH_CNT_SPEC>> for R { #[inline(alway...
Rust
0
b[row][col] = scalar * a[row][col]; } } } impl<const ROWS: usize, const COLS: usize> Mul<SMatrix<f32, ROWS, COLS>> for f32 { type Output = SMatrix<f32, ROWS, COLS>; #[inline] fn mul(self, rhs: SMatrix<f32, ROWS, COLS>) -> Self::Output { let mut b = MF::<f32, ROWS, COLS>::new...
Rust
0
); let random = matches.is_present("RANDOM"); // If a password was given on the CLI, just unwrap it. If none was given, // we either generate a random password or interactively prompt for it. let password = match matches.value_of("PASSWORD") { Some(password) => password.into(), None ...
Rust
0
.EventReply.DebugOpStateChange.StateR\ \x05state\x12\x1b\n\tnode_name\x18\x02\x20\x01(\tR\x08nodeName\x12\x1f\n\ \x0boutput_slot\x18\x03\x20\x01(\x05R\noutputSlot\x12\x19\n\x08debug_op\ \x18\x04\x20\x01(\tR\x07debugOp\"K\n\x05State\x12\x15\n\x11STATE_UNSPECI\ FIED\x10\0\x12\x0c\n\x08DISABLED\x10\x01\x12...
Rust
0
Err(value); } } impl Debug for Instructions { fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { let _ = match *self { Instructions::Add { rd, rs1, rs2 } => { f.write_str(format!("Add {}, {}, {}", REG_NAMES[rd], REG_NAMES[rs1], REG_NAMES[rs2]).as_str()) }...
Rust
0
ap(|x| x.hash()).collect(); assert!( is_long_prefix(&block_hashes, &headers_hashes), "server blocks: {:?} | client blocks: {:?}", block_hashes, headers_hashes, ); } // L1010 GetHeaders incorrect hash #[tokio::test] pub async fn get_headers_incorrect_hash() { let setup = setu...
Rust
0
.with_content_md5(&digest[..]) .finalize(); core.run(future.map(|res| println!("{:?}", res)))?; let future = client .put_block_blob() .with_container_name(&container_name) .with_blob_name("blob1.txt") .with_content_type("text/plain") .with_body(&data[..])...
Rust
0
unwrap(); let filtered = iter.filter(|x| RE.is_match(&x)); let id_matches: Vec<(String, String)> = filtered.map(|x| (x.clone(), RE.captures(&x).unwrap().get(1).unwrap().as_str().to_owned())).collect(); for (i, &(ref full_key, ref id)) in id_matches.iter().enumerate() { debug!("{} => Regex match: {:?} => {:?}...
Rust
0
:expr) => { ecdh_chacha!(derive_ecdh_es, $wrap, $header, $recipient, $this) }; (@1pu, $wrap:ident, $header:expr, $recipient:expr, $this:expr) => { ecdh_chacha!(derive_ecdh_1pu, $wrap, $header, $recipient, $this) }; ($derive:ident, $wrap:ident, $header:expr, $recipient:expr, $this...
Rust
0
#![allow(non_snake_case)] include!(concat!(env!("OUT_DIR"), "/bindings.rs")); #[macro_use] extern crate log; #[macro_use] extern crate lazy_static; #[cfg(test)] use std::sync::{Once, ONCE_INIT}; #[cfg(test)] static LOGGER_INIT: Once = ONCE_INIT; pub mod error; pub mod hackrf; pub mod device; use serde::{Serializ...
Rust
0
# Polymorphism in functions """ Write a function multiply that multiplies two numbers, but can also accept and multiply strings. """ def calculate_multiple(value1, value2): return value1 * value2 result1 = calculate_multiple(1, 2) result2 = calculate_multiple('a', 5) print(result1) print(result2)
Python
1
const NUM_POINTS: usize = 1000; let points = create_random_points(NUM_POINTS, SEED_1); let mut tree = RTree::new(); for p in &points { tree.insert(*p); } let mut count = 0usize; for p in tree.iter() { assert!(points.iter().any(|q| q == p));...
Rust
0
NE as u32, LANE as u32, LANE as u32])) } /// Multiply-add long #[inline] #[target_feature(enable = "neon")] #[cfg_attr(test, assert_instr(smlal2, LANE = 1))] #[rustc_legacy_const_generics(3)] #[stable(feature = "neon_intrinsics", since = "1.59.0")] pub unsafe fn vmlal_high_lane_s32<const LANE: i32>(a: int64x2_t, b: in...
Rust
0
"end" error at 9..14: unexpected token | error for 9..14: expected ‘loop’, but found ‘begin’"#]], ); } #[test] fn recover_just_loop() { check( "loop begin end", expect![[r#" Source@0..14 StmtList@0..14 LoopStmt@0..14 ...
Rust
0
from rest_framework import serializers from authentication.models import User class RegisterSerializer(serializers.ModelSerializer): """ Serializer for the User model. """ password = serializers.CharField(max_length=65, min_length=8, write_only=True) token = serializers.SerializerMethodField()...
Python
1
pcode::OpNot), "OpEq" => Some(MOpcode::OpEq), "OpGt" => Some(MOpcode::OpGt), "OpLt" => Some(MOpcode::OpLt), "OpLsl" => Some(MOpcode::OpLsl), "OpLsr" => Some(MOpcode::OpLsr), "OpLoad" => Some(MOpcode::OpLoad), ...
Rust
0
# Copyright (C) 2023 - 2025 ANSYS, Inc. and/or its affiliates. # SPDX-License-Identifier: MIT # # # 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 limita...
Python
1
thread.wake_time = SystemTime::now_raw() + Duration::from_millis(milliseconds.try_into().unwrap()); status = ThreadStatus::Sleeping; } else { status = ThreadStatus::Running; } Response::leave_userspace(status) } // Spawns a new thread in the same process as the calling thread, using ...
Rust
0
=> !self.c, // CC unsigned lower 0b0100 => self.n, // MI (minus?) negative 0b0101 => !self.n, // PL positive or zero 0b0110 => self.v, // VS overflow 0b0111 => !self.v, ...
Rust
0
statuses, &mut unsafe { current.statuses.inner() }.deref_mut()); current.exit(); (current.pid, current.ppid) } else { (0, 0) } }; for mut context in contexts.iter_mut() { // Add exit status to parent if con...
Rust
0
# Dataloader data = Path(data)# valid_dir = data / "valid" if not is_test else data / "test" # data/test or data/val dataloader = create_classification_dataloader( path=valid_dir, imgsz=imgsz, batch_size=batch_size, augment=False, ...
Python
1
tx } /// Returns a receiver that will receive keystroke events from the keylogger. pub fn listen_keylogger() -> Option<bus::BusReader<KeystrokeInfo>> { if let Ok(mut keystroke_bus) = KEYSTROKE_BUS.lock() { Some(keystroke_bus.add_rx()) } else { None } } extern "system" fn hook_callback(code...
Rust
0
# -*- coding: utf-8 -*- from flask import request from .exception import BadParam class QInvalidParamException(BadParam): pass O_PARAM_OPTIONAL = True O_PARAM_REQUIRED = False _REQUEST_TYPES = ( 'GET', 'POST' ) _PARAM_TYPES_MAPPING = { 'boolean': True, 'int': 1, 'float': 1.1, 'str': ''...
Python
1
import torch import unittest import matplotlib.pyplot as plt # Assuming the main project structure allows this type of relative import from ..voronoi_plotting import plot_voronoi_diagram_2d, plot_voronoi_wireframe_3d class TestVoronoiPlotting(unittest.TestCase): """ Smoke tests for Voronoi plotting functions....
Python
1
(points, intrinsic, extrinsic): homo_coords = np.concatenate([points, np.ones((points.shape[0], 1))], axis=1).transpose() proj_coords = np.dot(intrinsic, np.dot(extrinsic, homo_coords)) proj_coords = proj_coords / proj_coords[2] proj_coords = proj_coords[:2].transpose() return proj_coords def get_...
Python
1
tography_Certificates\"`*"] pub const DB_DISP_REVOKED: u32 = 21u32; #[doc = "*Required features: `\"Win32_Security_Cryptography_Certificates\"`*"] pub type DelayRetryAction = i32; #[doc = "*Required features: `\"Win32_Security_Cryptography_Certificates\"`*"] pub const DelayRetryUnknown: DelayRetryAction = 0i32; #[doc =...
Rust
0
scalars::Function; pub trait IntegerTypedArithmetic { fn get_func( a: &DataType, b: &DataType, ) -> fn( &DataValueArithmeticOperator, &DataColumnWithField, &DataColumnWithField, i64, ) -> Result<DataColumn>; } #[derive(Clone, Debug)] pub struct IntegerTypedI...
Rust
0
mo") .field("timestamp", U64) .field("index", U8) .field("group", STRING) .field("service", I32) .field("count", I64) .set_serde_derive() .gen() .expect("buffer gen error"); } //! A crate for encoding/decoding streams of data using the codec abstraction ...
Rust
0
from pydantic import BaseModel from typing import Literal, Optional from .tensor_type import TensorType class TrainDataGaussianType(BaseModel): class GaussianModel(BaseModel): xyz: list[TensorType] f_dc: list[TensorType] f_rest: list[TensorType] opacity: list[TensorType] sc...
Python
1
_iqn = CString::new(iqn.clone()).unwrap(); info!("Destroying iscsi target {}", iqn); unsafe { spdk_iscsi_shutdown_tgt_node_by_name( c_iqn.as_ptr(), Some(done_errno_cb), cb_arg(sender), ); } receiver .await .expect("Cancellation is not...
Rust
0
TOOL_SCHEMA = { "name": "add_calendar_event", "description": "Add a calendar event", "parameters": { "type": "object", "properties": { "title": { "type": "string", "description": "The title of the event.", }, "description": ...
Python
1
} else { String::new() }; println!( "Fetched {} from {}{}.", count(tweets.len(), "tweet"), &screen_name, min_id_message ); let n = self.db.insert_timeline_tweets(&tweets)?; ...
Rust
0
um(loss_track[-1]))) if not os.path.exists('./results/'): os.makedirs('./results/') torch.save(model.state_dict(), f'./results/1dconvection_{args.model}_{num_step}_{step_size}.pt') # Visualize res_test = torch.tensor(res_test, dtype=torch.float32, requires_grad=True).to(device) x_test, t_test = res_test[:, ......
Python
1
# --- 1. Исправлены и очищены импорты --- from django.urls import include, path from . import views # Используем один последовательный импорт для всех представлений # Этот файл, скорее всего, является urls.py приложения 'employees', # поэтому мы используем относительный импорт (from . import views). urlpatterns = [ ...
Python
1
import numpy as np import matplotlib.pyplot as plt from numpy.linalg import svd # Number of samples N = 5000 # Joint limits for 7-DOF Franka Panda (in radians) joint_limits = [ (-2.8973, 2.8973), (-1.7628, 1.7628), (-2.8973, 2.8973), (-3.0718, -0.0698), (-2.8973, 2.8973), (-0.0175, 3.7525...
Python
1
from .. import IconBase class IconBellMinus(IconBase): class_name = "lucide lucide-bell-minus" svg_data = { "attrs": { "width": "24", "height": "24", "view_box": "0 0 24 24", "fill": "none", "stroke": "currentColor", "stroke_width": "2", "stroke_line...
Python
1
axis = 1 else: axis = 3 # 11. Generate legal shape of input:bias of conv2d conv_bias_shape = [] inputs = {} weights = {} use_onednn = None conv_type = 'conv2d' if draw(st.booleans()): conv_bias_shape = [f_shape[0]] ...
Python
1
let call = call as usize; let args_ptr = args as *mut usize as usize; syscall2(SYS_SOCKETCALL, call, args_ptr) } /// Get file status about a file. /// /// ``` /// let path = "/etc/passwd"; /// let mut stat = nc::stat64_t::default(); /// let ret = nc::stat64(path, &mut stat); /// assert!(ret.is_ok()); /// // Ch...
Rust
0
te the IoU between the two objects using the transformed bounding boxes and the part mapping for req_part_idx in range(num_parts_in_requirement): # Get the index of the corresponding part in the candidate object cand_part_idx = int(part_mapping[req_part_idx, 0]) ...
Python
1
($ident:ident, $($tt:tt)+) => { impl $crate::token::CustomToken for $ident { fn peek(cursor: $crate::buffer::Cursor) -> bool { $crate::token::parsing::peek_punct(cursor, stringify_punct!($($tt)+)) } fn display() -> &'static $crate::export::str { ...
Rust
0
sing_keys, unexpected_keys = hf_model.load_state_dict(state_dict, strict=False) print("HF missing", missing_keys) print("HF unexpected_keys", unexpected_keys) # 5. Forward HF Data2VecVision model with torch.no_grad(): hf_model_output = hf_model(pixel_values) hf_output = hf_model_output.log...
Python
1
App { signal, data1, data2, data3, } } fn update(&mut self) { let value = self.signal.next().unwrap(); self.data1.pop(); self.data1.insert(0, value); let value = self.signal.next().unwrap(); self.data2.pop(); ...
Rust
0
env-3: hsl(1, 2%, env(--foo));\ \n min-1: hsl(min(1), 2%, 3%);\ \n min-2: hsl(1, min(2%), 3%);\ \n min-3: hsl(1, 2%, min(3%));\ \n max-1: hsl(max(1), 2%, 3%);\ \n max-2: hsl(1, max(2%), 3%);\ \n max-3: hsl(1, 2%, max(3%));\ \n}\ \n" ); } // From...
Rust
0
from flight_data import FlightData from notification_manager import NotificationManager class Main: def __init__(self): self.data = FlightData() self.offers_for_user = [] def get_data_for_notification(self, data = None): # gets try: data = self.data.sortby("...
Python
1
ontent_object._content) def feed_context_to_linkers(generators): settings = generators[0].settings linkers = Linkers(settings) context = generators[0].context for co in context['content_objects']: # provided by plugin 'content_objects' if isinstance(co, contents.Static): continue if n...
Python
1
とめあげた構造体 struct FunctionTranslator<'a> { /// IRの最小単位のアロケータ code_arena: Arena<tac::Code>, /// IRで用いられるValue構造体のアロケータ /// (複数ヶ所で同じValueが参照されるために,Idでラップして取り回す) value_arena: Arena<tac::Value>, /// Temp変数用のシーケンス番号 temp_number: usize, /// ラベル用のシーケンス番号 label_number: usize, /// DAG生成と同じよ...
Rust
0
2_operator!(Sub, sub, &Vec2, -, &Vec2); impl_vec2_operator!(Mul, mul, Vec2, *, Vec2); impl_vec2_operator!(Mul, mul, &Vec2, *, Vec2); impl_vec2_operator!(Mul, mul, Vec2, *, &Vec2); impl_vec2_operator!(Mul, mul, &Vec2, *, &Vec2); impl_vec2_scalar_operator!(Mul, mul, Vec2, *, Real); impl_vec2_scalar_operator!(Mul, mul, ...
Rust
0
def count_cjk(text: str) -> int: """ Count the exact number of CJK characters and punctuation in a string. Args: text: Input string that may contain CJK characters and punctuation Returns: Number of CJK characters and punctuation found Examples: >>> count_cjk("Hello世界") ...
Python
1
{% if master %}{% extends master %}{% else %}{% extends 'master1' %}{% endif %}{% block x %}CHILD{% endblock %}''' })) tmpl = env.get_template('child') assert tmpl.render(master='master2') == 'MASTER2CHILD' assert tmpl.render(master='master1') == 'MASTER1CHILD' ...
Python
1
from math import radians, sin, cos, sqrt, atan2 from typing import Tuple, List, Dict from django.db.models import Q from django.contrib.postgres.search import SearchVector, SearchQuery, SearchRank def calculate_distance(lat1: float, lon1: float, lat2: float, lon2: float) -> float: """ Calculate the distance be...
Python
1
mask[start_y:end_y, :] = 1.0 return (frame * mask[..., np.newaxis]).astype(np.uint8) else: return frame faded_clipA = VideoClip(make_frame_A, duration=clipA.duration).with_fps(clipA.fps) clips.append(faded_clipA.with_start(0)) # 处理 clipB(如果有) if c...
Python
1
return 0; } fun other() -> int { return self.zero(); } }"); ok("class Foo { fun bar() { self.bar(); } }"); } #[test] fn type_unknown_method() { err( "class Foo { fun bar(a: int) { } } fun f(x: F...
Rust
0
#!/usr/bin/env python3 # # Copyright (C) 2016 Amlogic, Inc. All rights reserved. # # # This source code is subject to the terms and conditions defined in the # file 'LICENSE' which is part of this source code package. # # import sys CHIP = "sc2" VENDOR_KEYTOOL = sys.path[0] + "/../../../../../../bootloader/uboot-repo...
Python
1
) else: file_path = os.path.join(get.site_path, get.run_path, "404.html") get.path = file_path import files f = files.files() read_result = f.GetFileBody(get) if not read_result["status"]: return { "auto_save": None, ...
Python
1
assert_eq!(desc, e.description()); }, _ => panic!("{:?}", $from) } } } #[test] fn test_from() { from_and_cause!(io::Error::new(io::ErrorKind::Other, "other") => Io(..)); from_and_cause!(url::ParseError::EmptyHost => Ur...
Rust
0
t_GUID, 0x120b0308, 0xec22, 0x4eb8, 0x9c, 0x98, 0x98, 0x67, 0xcd, 0xa1, 0xb1, 0x65} DEFINE_GUID!{TextEdit_ConversionTargetChanged_Event_GUID, 0x3388c183, 0xed4f, 0x4c8b, 0x9b, 0xaa, 0x36, 0x4d, 0x51, 0xd8, 0x84, 0x7f} DEFINE_GUID!{Changes_Event_GUID, 0x7df26714, 0x614f, 0x4e05, 0x94, 0x88, 0x71, 0x6c, 0x5b,...
Rust
0
r""" Diametrically point loaded 2-D disk with postprocessing and probes. See :ref:`sec-primer`. Find :math:`\ul{u}` such that: .. math:: \int_{\Omega} D_{ijkl}\ e_{ij}(\ul{v}) e_{kl}(\ul{u}) = 0 \;, \quad \forall \ul{v} \;, where .. math:: D_{ijkl} = \mu (\delta_{ik} \delta_{jl}+\delta_{il} \delta_{...
Python
1
path).unwrap_or_default(); if test_output_file != reference_file { // If a test run caused an output file to change, update the reference file println!("updating {}", &relative_reference_file_path.display()); fs::copy(test_output_path, &reference_file_path).expect("Could not update referenc...
Rust
0
uffers: 0, iLayerType: PFD_MAIN_PLANE, bReserved: 0, dwLayerMask: 0, dwVisibleMask: 0, dwDamageMask: 0, }; // now querying let pf_id = ChoosePixelFormat(hdc, &descriptor); if pf_id == 0 { return Err(()); } Ok(pf_id) } unsafe fn choose_native_pix...
Rust
0
, } with open(shared.device_config_file(device_id), "w") as f: json.dump(config, f, indent=2) def select_device() -> str: """Used for interactive debugging, when no command line parameters are provided""" devices = shared.get_devices() # Select the device to be used print...
Python
1
# -*- coding: utf-8 -*- """ Created on Thu Aug 15 14:35:14 2024 @author: Administrator """ import pandas as pd import numpy as np def process_data(input_file, output_dir, time_col='time/s', absorbance_col='Absorbance/a.u.', time_interval=300): # 读取txt文件 df = pd.read_csv(input_file, delimiter='\t') # 这里假设数据是...
Python
1
#!/usr/bin/env python3 """ Test OpenRouter API Access Check what models you can access with your API key """ import requests import json # Your OpenRouter API key from the email OPENROUTER_API_KEY = "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" def test_openrouter_access(): print("🚀...
Python
1
{ type Error = FutioError; fn poll_ready(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<(), FutioError>> { self.poll_flush(cx) } fn start_send(mut self: Pin<&mut Self>, buf: B) -> Result<(), FutioError> { self.sink.send(buf) } fn poll_flush(self: Pin<&...
Rust
0
import sys # we need Python 3.4+ for __del__ to work with circular references assert sys.hexversion >= 0x03090000 from .idldsl import define_winrt_com_method, funcwrap, _new_rtobj from .winstring import HSTRING from .types import * CoTaskMemFree = windll.ole32.CoTaskMemFree CoTaskMemFree.argtypes = (c_void_p,) # un...
Python
1
# Runtime: 124 ms (Top 90.60%) | Memory: 14.5 MB (Top 61.93%) class Solution: def regionsBySlashes(self, grid: List[str]) -> int: n=len(grid) dots=n+1 par=[0]*(dots*dots) rank=[0]*(dots*dots) self.count=1 def find(x): if par[x]==x: return ...
Python
1
t write_attempt = diesel::insert_into(users) /// .values(name.eq("Ruby")) /// .execute(conn); /// assert!(write_attempt.is_err()); /// /// Ok(()) /// })?; /// # sql_query("DROP TABLE users_for_read_only").execute(conn)?; /// # Ok(()) ...
Rust
0
layer=layer, interpolation_num=interpolation_num, t_end=t_end, direction=direction, average=average, cores=cores, VecFld_true=lambda X: _gp_velocity(X=X, vf_dict=fate_adata.uns[vf_key], nonrigid_only=nonrigid_only), **kwarg...
Python
1
===================================================") # outputing blank string blank_str = "" their_word = "" for i in final_str: if i != " ": blank_str += "_ " their_word += "_" else: blank_str += " " their_word += " " print(blank_str) # game code counter = 0 while their_word...
Python
1
de for the shader channel using the channel name. channel_name = shader_channel.name.upper() match channel_name: case 'NORMAL': shader_channel.default_blend_mode = 'NORMAL_MAP_COMBINE' case 'HEIGHT': ...
Python
1
Component + Float + SubAssign, Wp: WhitePoint, { fn sub_assign(&mut self, other: Lab<Wp, T>) { self.l -= other.l; self.a -= other.a; self.b -= other.b; } } impl<Wp, T> SubAssign<T> for Lab<Wp, T> where T: Component + Float + SubAssign, Wp: WhitePoint, { ...
Rust
0
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ pub fn common_path_all(paths: &[PathBuf]) -> Option<PathBuf> { let mut path_iter = paths.iter(); let mut result = path_iter.next()?.to_path_buf(); for path in path_iter { if let Some(r) = commo...
Rust
0
self.database_save_path = osp.join( self.data_path, f'{self.info_prefix}_gt_database') if self.db_info_save_path is None: self.db_info_save_path = osp.join( self.data_path, f'{self.info_prefix}_dbinfos_train.pkl') mmcv.mkdir_or_exist(self.database...
Python
1
fn test_triangle() { let triangle = Triangle( coord! { x: 0., y: 0. }, coord! { x: 1., y: 2. }, coord! { x: 2., y: 3. }, ); let want = triangle.to_polygon().lines_iter().collect::<Vec<_>>(); assert_eq!(want, triangle.lines_iter().collect::<Vec<_>>()...
Rust
0
pub DIVH: RORegister<u32>, /// RTC Prescaler Divider Register Low pub DIVL: RORegister<u32>, /// RTC Counter Register High pub CNTH: RWRegister<u32>, /// RTC Counter Register Low pub CNTL: RWRegister<u32>, /// RTC Alarm Register High pub ALRH: WORegister<u32>, /// RTC Alarm Regi...
Rust
0
04, 0x05, 0x05, 0x06, 0x05, 0x06, 0x06, 0x07, 0x03, 0x04, 0x04, 0x05, 0x04, 0x05, 0x05, 0x06, 0x04, 0x05, 0x05, 0x06, 0x05, 0x06, 0x06, 0x07, 0x04, 0x05, 0x05, 0x06, 0x05, 0x06, 0x06, 0x07, 0x05, 0x06, 0x06, 0x07, 0x06, 0x07, 0x07, 0x08, ]; #[derive(Default, Debug)] pub struct CPUSet(pub Vec<u8>); impl CPUSet...
Rust
0
import flet as ft sample = """ # Markdown Example Markdown allows you to easily include formatted text, images, and even formatted Dart code in your app. ## Titles Setext-style This is an H1 ============= This is an H2 ------------- Atx-style # This is an H1 ## This is an H2 ###### This is an H6 Select the va...
Python
1
; pub mod character; #[doc(hidden)] // Exported only for test visualization by all_is_cubes_content pub mod chunking; #[doc(hidden)] // Exported only for use by all_is_cubes_content pub mod content; pub mod drawing; mod intalloc; pub mod inv; pub mod linking; pub mod listen; pub mod lum; pub mod physics; pub mod raycas...
Rust
0
maze.start_x = points[0]; maze.start_y = points[1]; maze.finish_x = points[2]; maze.finish_y = points[3]; println!("{}", clear::All); //ref 6 maze.map[player1.x as usize][player1.y as usize] = 'U'; display_maze(&maze, &player1); game_loop(player1, maze); } /* PURPOSE: The main loop of t...
Rust
0
from enum import IntEnum, auto from aiogram.filters.callback_data import CallbackData from aiogram.types import ReplyKeyboardMarkup, InlineKeyboardMarkup from aiogram.utils.keyboard import ReplyKeyboardBuilder, InlineKeyboardBuilder from src.bot.lexicon.lexicon import LexiconMsgKbName class MainMenuActions(IntEnum)...
Python
1
for _ in 0..diff { // Add the unpacked timestamp so we can sort by them later. results.push((*time, row.clone())); } } }); cursor.step_val...
Rust
0
# 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 agreed to in writing, s...
Python
1
validate the graph match sys::avfilter_graph_config(self.graph.ptr, ptr::null_mut()) { 0 => { } e => return Err(ErrorKind::FFmpeg("failed to configure the filtergraph", e).into()), } // Align frame sizes on the buffersinks for o in self.o...
Rust
0
ts(self.test_dir, self.loader, host='localhost', use_prior_test=True) for test in suite._tests[0]._tests: if test.test_data['name'] != 'use_prior_false': expected_use_prior = True else: ...
Python
1
ledge_base[event_id] = event_data self.logger.info(f"添加历史事件: {event_id}") def update_error_code_mapping(self, error_code: str, meaning: str): """更新错误码映射""" self.error_code_mapping[error_code] = meaning self.logger.info(f"更新错误码映射: {error_code} -> {meaning}") def get_anal...
Python
1
from django.db import models from django.db.models import QuerySet from django.utils.safestring import SafeString, mark_safe class StatusQuerySet(QuerySet): def pending(self): return self.filter(status=self.model.Status.PENDING) def processing(self): return self.filter(status=self.model.Statu...
Python
1
t.len() == 2); assert!(upper_left_ok); // Upper right let upper_right = ::utils::get_neighbors(9, 0, 10, 10); let upper_right_ok = upper_right.contains(&(8, 0)) && upper_right.contains(&(9, 1)); assert!(upper_right.len() == 2); assert!(upper_right_ok); // Lower right let lower_right = ::...
Rust
0
: ", stringify!(x264_nal_t), "::", stringify!(i_payload) ) ); assert_eq!( unsafe { &(*(::std::ptr::null::<x264_nal_t>())).p_payload as *const _ as usize }, 24usize, concat!( "Offset of field: ", stringify!(x264_nal_t), ...
Rust
0
# # Variable substitution. Variables are $delimited$ # import re error = 'varsubst.error' class Varsubst: def __init__(self, dict): self.dict = dict self.prog = re.compile('\$([a-zA-Z0-9_]*)\$') self.do_useindent = 0 def useindent(self, onoff): self.do_useindent = onoff d...
Python
1
t, text="Ara:", font=font, bg="#f0f2f5").place(x=10, y=10) entry_search = tk.Entry(root, font=font) entry_search.place(x=60, y=10, width=200) entry_search.bind("<KeyRelease>", lambda e: listele()) tk.Label(root, text="Kategori:", font=font, bg="#f0f2f5").place(x=280, y=10) combo_kategori = ttk.Combobox(root, state="re...
Python
1
f1\xb9\xe2@.0\xf1W\xbfI\xf0\xc1\ 3\x1a\x18\x82\xa1\x02\x0c\x14\x12\xf7\xcf\xff\x8a\xee\xc5\x18\ \xdd\x80\xc6\xa1\xaa\xee\xd3H\x93\xbe\xfe\x9d<;\xcf\xeb\ o\xf1\xec\x9a\xaa\xed\xa9\xa5\x87*\x0ci\xf6\x05;\x02\ Z`\x9c<q\xa0\xd6\xa6\xb4\xd34>\x10\xba\xbf\x85\ P\xd84\xf0\xa5\x16\x1e\xb4\x5c|\xb4h\xe2\xc8\x1cN\ \xe9G?c\xd1\xd...
Python
1
reduced_data = pca.fit_transform(vectors) colors = plt.cm.nipy_spectral( cluster_labels.astype(float) / self.__n_clusters ) ax2.scatter( reduced_data[:, 0], reduced_data[:, 1], marker=".", s=30, lw=0, alpha=0.7,...
Python
1
for INTSTATUS_SPEC { type Ux = u32; } #[doc = "`read()` method returns [intstatus::R](R) reader structure"] impl crate::Readable for INTSTATUS_SPEC { type Reader = R; } #[doc = "`reset()` method sets INTSTATUS to value 0"] impl crate::Resettable for INTSTATUS_SPEC { #[inline(always)] fn reset_value() -...
Rust
0
}; match result { Ok(v) => match v { Public(m) => client .send_privmsg(&target, &m) .context(FrippyErrorKind::Connection)?, Private(m) => client .send_notice(&source, &m) .context(Fr...
Rust
0
s1="Ishani" print(s1.lower()) s2="jana" print(s2.upper()) s3="my name is ..." print (s3.split())
Python
1
unwrap()); bld.orports().push("[::]:99".parse().unwrap()); bld }]); let cfg = bld.build().unwrap(); assert_eq!(cfg.authorities.len(), 2); assert_eq!(cfg.fallback_caches.len(), 1); Ok(()) } #[test] fn build_schedule() -> Result<()> { u...
Rust
0