text
string
label_name
string
labels
int64
0 0 * * XA:i:1 MD:Z:12C13 NM:i:1 RX:Z:ATTA", ) .unwrap()), freq: 456, }, connections: vec![0, 2, 3], }; let node2 = Node { umi: BaseBits::new(b"AGGA").unwrap(), freq: ReadFreq { read: ReadCollection::SingleRead(bam::record::Record::...
Rust
0
logits( logits=logits, labels=labels, name='cross_entropy_per_example') cross_entropy_mean = tf.reduce_mean( cross_entropy, name='cross_entropy') tf.add_to_collection(LOSSES, cross_entropy_mean) # The total loss is defined as the cross entropy loss pl...
Python
1
`_001`"] #[inline] pub fn is_001(&self) -> bool { *self == PINCFGR::_001 } #[doc = "Checks if the value of the field is `_010`"] #[inline] pub fn is_010(&self) -> bool { *self == PINCFGR::_010 } #[doc = "Checks if the value of the field is `_011`"] #[inline] pub f...
Rust
0
this operation is // non-reversible, so let's make it harder for users to shoot themselves in the foot. let mut full_iso = IsoFs::from_file(open_live_iso(&config.input, None)?)?; // For now, we require the full ISO to be completely vanilla. Otherwise, the hashes won't // match. let iso = IsoConfig...
Rust
0
", "STARTAN2", "STARTAN3", "STEP1", "STEP2", "STEP3", "STEP4", "STEP5", "STEP6", "STONE", "STONE2", "STONE3", "STONPOIS", "SUPPORT2", "SW1BRCOM", "SW1BRN1", "SW1BRN2", "SW1BRNGN", "SW1BROWN", "SW1COMM", "SW1COMP", "SW1DIRT", "SW1EXIT", "SW1GRAY", "SW1GRAY1", "SW1METAL", "SW1PIPE", "SW1SLAD", "SW1STARG", "SW...
Rust
0
flags2(F2::empty()), F2::empty()); assert_eq!(roundtrip_flags2(F2::D), F2::D); assert_eq!(roundtrip_flags2(F2::C | F2::E), F2::C | F2::E); assert_eq!( roundtrip_flags3(Flag8::B0, Flag16::B1, Flag32::B2, Flag64::B3), (Flag8::B0, Flag16::B1, Flag32::B2, Flag64::B3) ...
Rust
0
); totals.intelligence += attr.intelligence.unwrap_or(0); } } // Apply the data to Pools for (entity, item) in to_update.iter() { if let Some(pool) = pools.get_mut(*entity) { pool.total_weight = item.weight; pool.total_init...
Rust
0
ianness::BigEndian } } use std::ops::Index; #[derive(Copy, Clone)] struct Foo; struct Bar; impl Index<Bar> for Foo { type Output = Foo; fn index<'a>(&'a self, _index: Bar) -> &'a Foo { println!("Indexing!"); self } } fn main() { Foo[Bar]; } use crate::Result; use osm_db::entity::...
Rust
0
import digitalio import board import time allButtons = [] scaleButton = digitalio.DigitalInOut(board.GP9) loopButton = digitalio.DigitalInOut(board.GP8) shiftLockButton = digitalio.DigitalInOut(board.GP2) lengthLockButton = digitalio.DigitalInOut(board.GP1) quantizeLockButton = digitalio.DigitalInOut(board.GP13) range...
Python
1
#[inline(always)] fn post_transfer_control_to_coroutine(&mut self, global_allocator: &'static GTACSA) { self.inactive_current_allocator_in_use = global_allocator.replace_current_allocator_in_use(self.inactive_current_allocator_in_use); self.inactive_coroutine_local_allocator = global_allocator.swap_coroutine_loca...
Rust
0
Send<i32, End>, Send<i32, Recv<i32, End>>, RoleA<RoleS<RoleS<RoleEnd>>>, NameC, >; type ChoiceCNo = MeshedChannelsThree<Send<i32, End>, End, RoleA<RoleEnd>, NameC>; type EndpointC = MeshedChannelsThree<Choose0fromCtoA, Choose0fromCtoS, RoleBroadcast, NameC>; type EndpointCLoop = MeshedChannelsThree< Se...
Rust
0
} } } } }; let mut router = Router::<Rule>::from_config(config); if !_message.is_null() { let message = Box::from_raw(_message); for rule in message.rules { router.insert(rule.into_route(&router.config)); } } ...
Rust
0
crate::emitters::emitter::Velocity; use rand::{thread_rng, Rng}; pub fn equalize_total_speed(speed_squared: f32, new: &mut Velocity) { let new_vx_squared = new.vx.powi(2); let new_vy_squared = new.vy.powi(2); let new_vz_squared = new.vz.powi(2); let new_speed_squared = new_vx_squared + new_vy_squared ...
Rust
0
sdk_hash: hex!("31 32 37 38 62 64 35 61 64 62"), }; pub const DART_2_16_0_134: ComponentHeader = ComponentHeader { magic: HeaderMagic, version: 75, sdk_hash: hex!("34 35 35 66 65 39 64 31 38 30"), }; pub const DART_2_17_0_1: ComponentHeader = ComponentHeader { ma...
Rust
0
ader { pub name: String, pub value: String, } #[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] pub struct CanisterHttpPayload { pub status: u64, pub headers: Vec<CanisterHttpHeader>, pub body: Vec<u8>, } impl CountBytes for CanisterHttpPayload { fn count_bytes(&self) -> usi...
Rust
0
[derive(Debug, Copy, Clone)] pub struct sfClock { _unused: [u8; 0], } #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct sfMutex { _unused: [u8; 0], } #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct sfThread { _unused: [u8; 0], } extern "C" { pub fn sfClock_create() -> *mut sfClock; } extern "C" { ...
Rust
0
y(&mut self, k: &str) -> Result<&mut dyn Visitor> { //! // Figure out which field is being deserialized and return a place //! // to write it. //! // //! // The code here ignores unrecognized fields but an implementation //! // would be free to return an error instead. Similarly ...
Rust
0
quires_grad = False self.patch_embed.eval() for param in self.patch_embed.parameters(): param.requires_grad = False for i in range(0, self.depth): m = self.blocks[i] m.mlp.eval() m.norm2.eval() for param ...
Python
1
ty, val) = check_lit_float(self.vm, self.xconst.file_id, expr, false); (ty, ConstValue::Float(val)) } &Expr::LitBool(ref expr) => (SourceType::Bool, ConstValue::Bool(expr.value)), &Expr::Un(ref expr) if expr.op == UnOp::Neg && expr.opnd.is_lit_int() => { ...
Rust
0
` if the bit is set (1)"] #[inline] pub fn bit_is_set(&self) -> bool { self.bit() } #[doc = r" Value of the field as raw bits"] #[inline] pub fn bit(&self) -> bool { match *self { SELR::AUX_ADC_FIFO_ALMOST_FULL => true, SELR::AUX_ADC_FIFO_NOT_EMPTY => fals...
Rust
0
hmget( conn, "orders", fifo_orders .into_iter() .map(|ord| (order_store::ListEntry::deserialize(&ord)).uuid) .collect::<Vec<String>>() ) { Ok(e) => { ...
Rust
0
stable_maybe_uninit, feature = "unstable")))] let scratchpad_ref = &scratchpad; validate_memory_limits( scratchpad_ref, |scratchpad| scratchpad.mark_front(), |scratchpad| scratchpad.mark_back(), ); } } /// Verifies that the available space for allocation...
Rust
0
view_box : usvg::ViewBox { rect : usvg::Rect::new( 0.0, 0.0, pixmap.width().into(), pixmap.height().into()) .unwrap(), aspect : usvg::AspectRatio::default(), ...
Rust
0
async fn main() -> Result<(), Box<dyn std::error::Error>> { env_logger::init(); let opts: Opts = Opts::parse(); match opts.subcmd { Command::GenerateJson => { let target_dir_path = PathBuf::new().join("output").join(TARGET); tokio::fs::create_dir_all(&target_dir_path).await...
Rust
0
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import os import time from PyPDF2 import PdfReader, PdfWriter INPUT_FILE = "C-崔玉涛育儿百科.pdf" # 原始PDF OUTPUT_FILE_PREFIX = "split" # 分割后的 PDF 文件前缀 PAGES_PER_SUBFILE = 10 # 每份分割的页数 # 分割 PDF def split_pdf(reader, page_count): """将PDF按指定页数分割成多个小PDF""" subfile_count...
Python
1
from typing import List import logging from schemas.bot_chats_schema import BotChatsRequest, BotChatsResponse, BotChatResponseData, UserInfoResponse, BotChatQueueRequest import os from models.model_loader import ModelLoader from langchain.memory import ConversationBufferWindowMemory # ConversationBufferWindowMemory로 변경...
Python
1
import sys import argparse import os import yaml from bento.common.utils import get_logger, LOG_PREFIX, APP_NAME from neo4j_summary import neo4j_summary S3_BUCKET = "s3_bucket" S3_FOLDER = "s3_folder" NEO4J_IP = "neo4j_ip" NEO4J_USER = "neo4j_user" NEO4J_PASSWORD = "neo4j_password" NEO4J_SUMMARY_FILE_NAME = "neo4j_su...
Python
1
C_SR1_SB: u32 = 1; pub const I2C_SR1_ADDR_Pos: u32 = 1; pub const I2C_SR1_ADDR_Msk: u32 = 2; pub const I2C_SR1_ADDR: u32 = 2; pub const I2C_SR1_BTF_Pos: u32 = 2; pub const I2C_SR1_BTF_Msk: u32 = 4; pub const I2C_SR1_BTF: u32 = 4; pub const I2C_SR1_ADD10_Pos: u32 = 3; pub const I2C_SR1_ADD10_Msk: u32 = 8; pub const I2C_...
Rust
0
(); if self.stats { subscriber.spawn(core::time::Duration::from_secs(1)); } let subscriber = ( subscriber, s2n_quic::provider::event::tracing::Subscriber::default(), ); let server = Server::builder() .with_limits(self.limits.limi...
Rust
0
# Copyright 2025 Aner Arregi - AvanzOSC # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). from odoo import api, fields, models class MrpWorkcenterProductivity(models.Model): _inherit = "mrp.workcenter.productivity" calendar_id = fields.Many2one( comodel_name="resource.calendar", ...
Python
1
import collections def get_tree_max_id_old(value, list_id=[]): """ 得到最大Tree max id """ if not value: return 0 # the first node id if isinstance(value, list): for content in value: # content -> dict children = content.get("children") if children: ...
Python
1
.0, 5.0, 4.0, 3.0, 2.0, 1.0], height, width); // | 7.0 7.0 7.0 | // | 7.0 7.0 7.0 | matrix_addition(&matrix1, &matrix2).unwrap().print(); // | 2.0 4.0 6.0 | // | 8.0 10.0 12.0 | scalar_multiplication(2.0, &matrix1).print(); // | -5.0 -3.0 -1.0 | // | 1.0 3.0 5.0 | ...
Rust
0
cow = str(r""" /) (\ .-._((,~~.))_.-, `=. 99 ,=' / ,o~~o. \ { { .__. } } ) `~~~\' ( /`-._ _\.-\ / ) \ ,-X X-. / \ / \...
Python
1
e the documentation for `AccountAssociation` for explanations of the /// fields. This type is different than AccountAssociation in that it contains /// references to borrowed values for non-Copy types, rather than owned /// values. #[derive(Debug, Insertable, PartialEq)] #[table_name = "account_associations"] pub struc...
Rust
0
d)); Ok(()) } else { Err(parse::Error::new(field.ident.span(),"Arrays of 16/32bit fields not supported")) } }, _ => Err( parse::Error::new(field.ident.span(),"Unsupported report size for serialization") ...
Rust
0
from rgbd import rgbd import os import numpy as np import cPickle as pickle from cifar2im import load_CIFAR_batch def packrgbd(rgbPath,dPath): ext='.jpg' datadict=dict() data=[] labels=np.loadtxt('label.csv',delimiter=',') labels=labels.T[1].astype(int) l=[] percent=0 for i in range(6000...
Python
1
=> "Ring 0 segment selector.", }; let r1 = match self.contains(SegmentSelector::RPL_1) { false => "", true => "Ring 1 segment selector.", }; let r2 = match self.contains(SegmentSelector::RPL_2) { false => "", true => "Ring 2 segment selecto...
Rust
0
ADE, editable=False) source = models.ForeignKey(Source, on_delete=models.CASCADE, editable=False) user = models.ForeignKey(User, on_delete=models.SET_NULL, editable=False, null=True) class AnnotationToolSettings(models.Model): user = models.OneToOneField(User, on_delete=models.CASCADE, editable=False) ...
Python
1
, inpt=True, fp=fp) PKey = { "n": "", "e": "", "d": "", "p": "", "q": "", } for i in PKey: for i1 in Key: if i1 == ",": Key = Key[1:len(Key)+1] break elif i1 == " ": Key = Key[1:len(Key)+1] continue else: ...
Python
1
# -*- coding: utf-8 -*- """ Created on Mon Mar 27 22:45:07 2017 @author: Shabaka """ # Create a 5 x 5 matrix using a list of lists: matrix matrix = [[col for col in range(5)] for row in range(5)] # Print the matrix for row in matrix: print(row) # Create a list of strings: fellowship fellowship = ['frodo', 'sam...
Python
1
def gen(): for ex in features: d = {k: v for k, v in asdict(ex).items() if v is not None} label = d.pop('label') yield d, label
Python
1
sert_eq!(eval(&parse("5 * 9 * (7 * 3 * 3 + 9 * 3 + (8 + 6 * 4))")), 12240); assert_eq!(eval2(&parse("5 * 9 * (7 * 3 * 3 + 9 * 3 + (8 + 6 * 4))")), 669060); } #[test] fn test_example6() { assert_eq!(eval(&parse("((2 + 4 * 9) * (6 + 9 * 8 + 6) + 6) + 2 + 4 * 2")), 13632); assert_eq!(e...
Rust
0
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License # Use this for now instead of a wrapper """A module containing 'NodePosition' model.""" from dataclasses import dataclass @dataclass class NodePosition: """Node position class definition.""" label: str cluster: str size: f...
Python
1
# Copyright 2012 Christoph Reiter # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. from ctypes import POINTER...
Python
1
# dict: 3 # 0 pred_logits 分类头输出[bs, 100, 92(类别数)] # 1 pred_boxes 回归头输出[bs, 100, 4] # 3 aux_outputs list: 5 前5个decoder层输出 5个pred_logits[bs, 100, 92(类别数)] 和 5个pred_boxes[bs, 100, 4] outputs = model(samples) # 计算损失 显示log loss_dict = criterion(outputs, targets) ...
Python
1
#"Reverse budget booking"#, M::WP410_hhvaluta => r#"_Date"#, M::WP410_hhvaluta_tt => r#"Date for booking"#, M::WP410_hhbetrag => r#"_Payment"#, M::WP410_hhbetrag_tt => r#"Payment amount"#, M::WP410_hhereignis => r#"Booking event"#, M::WP410_hhereig...
Rust
0
import fitz # PyMuPDF import base64 from PIL import Image import io from pathlib import Path from typing import List, Dict, Any, Optional from ..base import BaseParser, ParseResult from ....utils.logger import get_logger logger = get_logger(__name__) class MultimodalPDFParser(BaseParser): """多模态PDF解析器,支持提取文本和图...
Python
1
ode( category.name, category.get_absolute_url(), "{}-{}".format(category.__class__.__name__, category.pk), ("{}-{}".format(category.__class__.__name__, category.parent.id) if category.parent else None), )...
Python
1
.as_mut_ptr() }); } pub_fn_string_ptr_get_set!('c, lpszProgressTitle, set_lpszProgressTitle); } /// [`SHSTOCKICONINFO`](https://docs.microsoft.com/en-us/windows/win32/api/shellapi/ns-shellapi-shstockiconinfo) /// struct. #[cfg_attr(docsrs, doc(cfg(feature = "shell")))] #[repr(C)] pub struct SHSTOCKICONINF...
Rust
0
_count": 1, "ip_address": "127.0.0.1", "last_error_date": 0, "last_error_message": "error", "max_connections": 10, "allowed_updates": ["message", "poll"] })) .unwrap(); assert_eq!(data.url, "https://example.com/tg-webhook"); ass...
Rust
0
count, shape_system_id, _) = layer.shape_system_registry.drop_instance::<S>(); if instance_count == 0 { layer.remove_shape_system(shape_system_id); } } } self.shape.drop_instances(); self.unregister_existing_mous...
Rust
0
[cfg_attr(not(target_os = "horizon"), mocktopus::macros::mockable)] pub fn get_product_info(process_id: u32) -> CtrResult<ProductInfo> { let mut command = ThreadCommandBuilder::new(0x82Eu16); command.push(process_id); command .build() .send_sync_request_with_raw_hand...
Rust
0
ow!("some test case failed:\n{:#?}", failed_case)) } else { Ok(()) } } async fn flush_stdout() -> std::io::Result<()> { tokio::task::block_in_place(|| stdout().flush()) } async fn run_test_file(engine: Postgres, filename: impl AsRef<Path>) -> Result<()> { let filename = filename.as_ref(); ...
Rust
0
eStatic::Nonstatic(v) => MaybeStatic::Nonstatic(*v), } } } impl<'a, T> Deref for MaybeStatic<'a, T> where T: ?Sized, { type Target = T; fn deref(&self) -> &Self::Target { match self { MaybeStatic::Static(v) => *v, MaybeStatic::Nonstatic(v) => *v, } }...
Rust
0
penapi.Response("Bad Request", openapi.Schema( type=openapi.TYPE_OBJECT, properties={ 'error': openapi.Schema(type=openapi.TYPE_STRING) } )), 404: openapi.Response("Not Found", openapi.Schema( type=openapi.TYPE_O...
Python
1
""" Joining, Splitting, and Sorting Strings --------------------------------------- To remember: - join() - split() - sorted() - sort() """ # join() # The join() = joins multiple strings into a single string # - the argument is a list of strings print(' '.join(['This', 'is', 'a', 'sentence'])) # spl...
Python
1
_urls = provider_urls .iter() .map(|provider| parse_provider_url(provider)) .collect::<DfxResult<_>>(); validated_urls.map(|provider_urls| NetworkDescriptor { name: network_name.to_string(), providers: provider_urls, ...
Rust
0
# Tinrux Cli a database writed on python # Copyright (C) 2025 Guillermo Leira Temes # # 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...
Python
1
use serde::{Deserialize, Serialize}; use std::collections::HashMap; use std::fs; use std::path::PathBuf; mod parsers; mod process; use parsers::ConfigParser; pub use parsers::YamlConfigParser; use brix_cli::select::do_select; use brix_commands::{Command, ProcessedCommandParams}; use brix_common::AppContext; use brix...
Rust
0
from __future__ import unicode_literals from .base import ProgressBar from .formatters import ( Bar, Formatter, IterationsPerSecond, Label, Percentage, Progress, Rainbow, SpinningWheel, Text, TimeElapsed, TimeLeft, ) __all__ = [ 'ProgressBar', # Formatters. 'Fo...
Python
1
estados = [ (1, 'Acre', 'AC', 1), (2, 'Alagoas', 'AL', 1), (3, 'Amazonas', 'AM', 1), (4, 'Amapá', 'AP', 1), (5, 'Bahia', 'BA', 1), (6, 'Ceará', 'CE', 1), (7, 'Distrito Federal', 'DF', 1), (8, 'Espírito Santo', 'ES', 1), (9, 'Goiás', 'GO', 1), (10, 'Maranhão', 'MA', 1), (11, '...
Python
1
ethod<H> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "...") } } pub struct DebugProp<H: Handlers>(pub Option<H::GetProp>, pub Option<H::SetProp>); impl<H: Handlers> fmt::Debug for DebugProp<H> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "...") } } pub trait Handle...
Rust
0
32; unsafe { match CString::new(name) { Ok(name) => match sys::SDL_GetKeyFromName(name.as_ptr() as *const c_char) { UNKNOWN => None, keycode_id => Some(Keycode::from_i32(keycode_id as i32).unwrap()) }, // string ...
Rust
0
ascii=False is used in JSON output.""" data = {"message": "Hello 世界"} query = ".message" mock_jq = MagicMock() mock_compiled = Mock() mock_compiled.input.return_value.all.return_value = ["Hello 世界"] mock_jq.compile.return_value = mock_compiled with patch.dict("s...
Python
1
esult<Vec<u8>> { let proto: ProtoRumor = self.into(); let mut buf = BytesMut::with_capacity(proto.encoded_len()); proto.encode(&mut buf)?; Ok(buf.to_vec()) } } impl From<RumorEnvelope> for ProtoRumor { fn from(value: RumorEnvelope) -> ProtoRumor { ProtoRumor { r#type: v...
Rust
0
>, conn: IcmpConnId<Ipv6>, seq_num: u16, body: B, ) -> Result<(), SendError> { send_icmp_echo_request_inner(ctx, conn, seq_num, body) } fn send_icmp_echo_request_inner<I: IcmpIpExt, B: BufferMut, C: BufferIcmpContext<I, B>>( ctx: &mut C, conn: IcmpConnId<I>, seq_num: u16, body: B, ) -> ...
Rust
0
ian, u32>, ) -> usize { dbg!(this); nullck!(this => 0); dbg!((&**this).len()); (&**this).len() } /** Computes the length, in bits, of a bit slice behind a handle. # Parameters - `this: *const *const BitSlice<LittleEndian, u32>`: Const-pointer to a `BitSlice` handle of immutable bits. # Returns The number of b...
Rust
0
gen_u32, gen_mod_u32, "Generates a random `isize` in the given range." ); #[cfg(target_pointer_width = "32")] rng_integer!( isize, usize, gen_u32, gen_mod_u32, "Generates a random `isize` in the given range." ); #[cfg(target_pointer_width = "6...
Rust
0
in(topKwords)) topic_id+=1 topwords.append(topKwords) return topwords def print_topic_to_list_with_rerank(topic_word_list, vocab, top_k=20): topic_id = 0 topwords = [] for l, topic_word in enumerate(np.flip(topic_word_list)): #for each level word_sum_prob = np.sum(topic...
Python
1
ge, idx_to_group_img=idx_to_group_img, image_atts=image_atts) image_embeds_fullatts = torch.gather(image_embeds_fullatts, dim=0, index=idx_to_group_img.view(-1, 1, 1).expand( -1, image_embeds_f...
Python
1
ists(self.testSensorName) assert sensorExists, f"Sensor {self.testSensorName} should still exist after scene deletion" assert foundSensorUID == sensorUID, "Sensor UID mismatch" # Verify sensor is orphaned (scene is None) log.info("Verifying sensor is orphaned") assert self._verifySensorOr...
Python
1
import pytest import pcapi.core.offerers.factories as offerers_factories from pcapi.core.offers import factories as offers_factories from pcapi.core.testing import assert_num_queries pytestmark = pytest.mark.usefixtures("db_session") class Returns401Test: def test_return_403_if_user_is_not_authorized(self, cli...
Python
1
ody.trailers() { encode_headers(trailers, writer)?; } write!(writer, "\r\n")?; } Ok(()) } /// Checks if it is a [forbidden header name](https://fetch.spec.whatwg.org/#forbidden-header-name) /// /// We removed some of them not managed by this library (`Access-Control-Request-Headers`...
Rust
0
d::new(reader)?, package_flags: reader.read_u32::<LittleEndian>()?, not_always_loaded_for_editor_game: if IsFileVersionGt!(VER_UE4_LOAD_FOR_EDITOR_GAME) { reader.read_i32::<LittleEndian>()? != 0 } else { false }, is_asset: ...
Rust
0
get_unchecked((0, 1)); let az = self.get_unchecked((0, 2)); let bx = b.get_unchecked((0, 0)); let by = b.get_unchecked((0, 1)); let bz = b.get_unchecked((0, 2)); *res.get_unchecked_mut((0, 0)) = ay.inlined_clone() * bz.inlined_clone() ...
Rust
0
modulus at compile time const NO_CARRY: bool = { let first_bit_set = Self::MODULUS.0[N - 1] >> 63 != 0; // $limbs can be 1, hence we can run into a case with an unused mut. #[allow(unused_mut)] let mut all_bits_set = Self::MODULUS.0[N - 1] == !0 - (1 << 63); let mut i = 1; ...
Rust
0
fi = np.where(backward_k_neigh_index==i)[0] return forward_k_neigh_index[fi] def re_ranking_new(q_g_dist, q_q_dist, g_g_dist, k1=20, k2=6, lambda_value=0.3): # The following naming, e.g. gallery_num, is different from outer scope. # Don't care about it. original_dist = np.concatenate( [np.co...
Python
1
me: String, #[structopt(subcommand)] action: Action } fn main() -> Result { let opts = Opts::from_args(); let contents = std::fs::read_to_string(&opts.filename)?; let json = json::parse(&contents)?; match opts.action { Action::Explain => explain::explain(json), Action::Format ...
Rust
0
<PyMapping> = PyDict::new(py).as_mapping().into(); let mapping_ref: &PyMapping = mapping.as_ref(py); assert_eq!(mapping_ref.len().unwrap(), 0); }) } #[test] fn test_into_ref() { Python::with_gil(|py| { let bare_mapping = PyDict::new(py).as_mapping(); ...
Rust
0
#!/usr/bin/env python3 import requests import json import pprint product_map = {} features_map = {} for url in ["https://raw.githubusercontent.com/LIFX/products/master/products.json"]: resp = requests.get(url) lifxp = json.loads(resp.text) defaults = lifxp[0]["defaults"] for product in lifxp[0]["pro...
Python
1
ount < zero_count { oxygen_list = oxygen_list .into_iter() .filter(|x| *x & counter != counter) .collect(); } else { oxygen_list = oxygen_list .into_iter() .filter(|x| *x & counter == counter) ...
Rust
0
Self: From<B>, { Self::over_fallback(dst, src, clr); } /// Blend pixels with `over` operation (slow fallback). /// /// * `dst` Destination pixels. /// * `src` Source pixels. /// * `clr` Mask color. fn over_fallback<B: Blend>(dst: &mut [Self], src: &[B], clr: Self) w...
Rust
0
return &buffer[3]; } else { if (value < 0) { *buffer++ = '-'; value = -value; } int length, K; Grisu2(value, buffer, &length, &K); return Prettify(buffer, length, K, maxDecimalPlaces); } } */ #[allow(deprecated)] #[inline] unsafe fn dtoa<...
Rust
0
g, SoundPWMControlReg }; use crate::log::*; use crate::utils::Cycle; macro_rules! unreadable { ($kind:expr, $reg:expr) => {{ warn!($kind, "Tried to read the write-only {} (at 0x{:X}).", stringify!($reg), $reg); 0 }} } macro_rules! unwriteable { ($kind:expr, $reg:expr, $value:expr) => { ...
Rust
0
_result import MessageEventResult from astrbot.core.message.components import Plain msg_result = MessageEventResult() msg_result.chain.append(Plain(str(result))) event._result = msg_result event.set_result = set_result ...
Python
1
x = [100,101,103,104,105,106,107,108,109] y = (00,10,20,40,50,60,70,80,90) z = "Dakalo" #Slicing print(x[0:3:1]) print(x[0:3]) print(x[4:]) print(x[:5]) print(x[:]) print(x[::5])# gap print(x[::-1])#reverse order
Python
1
raise NotImplementedError() def remove_issue(self, issue): """ Remove an issue. :param issue: issue :type issue: :class:`Issue` """ raise NotImplementedError() def iter_projects(self): """ Iter projects. :rtype: iter[:class:`Proj...
Python
1
import gradio as gr import sys import html import base64 from pathlib import Path import webbrowser from chatbot import ( load_or_create_vectorstore, create_rag_chain, DATA_PATH, VECTORSTORE_PATH, EMBEDDING_MODEL_NAME, OLLAMA_MODEL_NAME, INDEX_BATCH_SIZE ) # Avatar-Bilder Per BASE64 Einles...
Python
1
Box_::into_raw(f), ) } } } impl fmt::Display for DOMHTMLObjectElement { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.write_str("DOMHTMLObjectElement") } } use std::collections::HashMap; use config::{Config, ConfigError, File}; use crate::jira::Crede...
Rust
0
# Ultralytics YOLO 🚀, AGPL-3.0 license # YOLOv8 object detection model with P3-P5 outputs. For Usage examples see https://docs.ultralytics.com/tasks/detect # Parameters nc: 80 # number of classes scales: # model compound scaling constants, i.e. 'model=yolov8n.yaml' will call yolov8.yaml with scale 'n' # [depth, w...
Python
1
time_stamp; Some((cache_entry.file.clone(), cache_entry.line_number, pos - cache_entry.line.start)) } } #[inline] fn file_contains(file: &SourceFile, pos: BytePos) -> bool { // `SourceMap::lookup_source_file_idx` and `SourceFile::contains` both consider the position // one past the end of a file t...
Rust
0
contents=prompt1, config={ "response_mime_type": "application/json", "temperature": 0.0, "response_schema": AnswerAccuracy, "system_instruction": LLM_JURY_SYSTEM_INSTRUCTION, "thinking_config": { "thinking_budget": 0 } ...
Python
1
e.raw() as i32 } } } } #[no_mangle] pub unsafe extern "C" fn wasi_vfs_fd_datasync(arg0: i32) -> i32 { #[cfg(feature = "trace-syscall")] crate::trace::trace_syscall_entry(format_args!("fd_datasync(fd: {})\n", arg0)); let fs = if let Some(fs) = crate::GLOBAL_STATE.ove...
Rust
0
ts(&self) -> u8 { match *self { PWM_3_CTL_DBFALLUPDR::PWM_3_CTL_DBFALLUPD_I => 0, PWM_3_CTL_DBFALLUPDR::PWM_3_CTL_DBFALLUPD_LS => 2, PWM_3_CTL_DBFALLUPDR::PWM_3_CTL_DBFALLUPD_GS => 3, PWM_3_CTL_DBFALLUPDR::_Reserved(bits) => bits, } } #[allow(missi...
Rust
0
# Given an integer array nums and an integer k, return the k most frequent elements. You may return the answer in any order. # Example 1: # Input: nums = [1,1,1,2,2,3], k = 2 # Output: [1,2] # Example 2: # Input: nums = [1], k = 1 # Output: [1] # Constraints: # 1 <= nums.length <= 105 # -104 <= nums[i] <= 104 # k i...
Python
1
""" Q42. Ask a number from user. Print all the numbers from 1 to that number. """ # n=int(input("Enter a number: ")) # i=1 # while i<=n: # print(i,end=" ") # i=i+1 # n=int(input("Enter a nunmber: ")) # for i in range(1,n+1): # print(i,end=" ") """ Q43. Ask a number (N) from user. Print all the numbers f...
Python
1
import os from io import StringIO import pytest from django.core.management import call_command, CommandError from django.conf import settings @pytest.mark.django_db def test_check(): out = StringIO() call_command("check", stdout=out) assert "db:\tok" in out.getvalue() assert "env:\tok" in out.getval...
Python
1
t_vPMC_Angel = TestList_vPMC_Angel[i_test] Test_vPMC_Angel_v = torch.zeros([1, num_vPMC], dtype=torch.float) Test_vPMC_Angel_v[0, Test_vPMC_Angel - 1] = 20 Test_STS_Angel_v = torch.zeros([1, num_STS], dtype=torch.float) for t in range(2): IPL(Test_vPMC_Angel_v, Test_STS_Angel...
Python
1
lected objects ################################################### class objectDoubleSided(bpy.types.Operator): """Toggle Double Sided Option""" bl_label = "Toggle Double Sided" bl_idname = "object.double_sided" bl_description = "Toggle double-sided on all selected objects" def execute(self, cont...
Python
1
cfg(target_arch = "aarch64")] global_asm!(""); #[cfg(target_arch = "mips")] global_asm!(""); fn main() {} use locspan::Location; use treeldr::{reporting::DiagnoseWithCauseAndVocabulary, Caused, Vocabulary}; pub type Error<F> = Caused<Description<F>, F>; pub trait AnyError<F> { fn message(&self, vocab: &Vocabulary)...
Rust
0