text
string
label_name
string
labels
int64
let mut boards: Vec<_> = lines .map(|line| line.split_whitespace()) .flatten() .map(|n| Some(u32::from_str_radix(n, 10).unwrap())) .collect::<Vec<_>>() .chunks_exact(25) .map(|s| s.to_vec()) .collect(); // check wether a given board fulfills winning cond...
Rust
0
#!/usr/bin/env python # coding: utf-8 # In[10]: with open("/content/drive/MyDrive/exemple.txt","r") as fichier: ligne = fichier.readline() i=1 while ligne: print(i,ligne) i+=1 ligne = fichier.readline()
Python
1
BlendFactor::One, operation: BlendOperation::Min, }, alpha: BlendComponent { src_factor: BlendFactor::OneMinusDstAlpha, dst_factor: BlendFactor::One, operation: BlendOperation::Add, }, }; /// When using premultiplied alpha, use this. ...
Rust
0
import importlib.util from django.conf import settings from django.conf.urls.static import static from django.urls import include, path from django.urls import re_path as url from django.views.generic import RedirectView import eventyay.control.urls import eventyay.eventyay_common.urls import eventyay.presale.urls fr...
Python
1
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ 测试执行模块 负责测试用例的自动化执行、结果收集和异常处理 """ import os import time import json from datetime import datetime from typing import Dict, List, Optional, Any from dataclasses import dataclass from enum import Enum import threading import queue import multiprocessing from modules.dat...
Python
1
bik\ o\xfe\xb1RM\xb21\x1e\xa4\xe7\xf3\xaco\x16\xea\xbe\ 7\xf0\x1d\x82\xda\xe9\xbe\x19\xd4\xb5\x9b\x0b\x8f\x96\xe2\xe9\ \xaf\x03L\xa1\x8e\x09\x1c~4\xbd\xe9\x17\xec\xa19[\ \x9bS\xdb\xa2\xb5\xf3\x7f{\xbbl\xbc|\xd5\xa5uu\ \xf6\xfbO*\xe1Wr}\xd6\xfe*\xf2\xcb\x0f\xda3\ I\xd2\xe2\xb7\xd2\xee\x22\xbc]I\x14\x22\xc6\xcb\xcc\xbc\ ...
Python
1
import argparse import os import random import torch import os import misc_utils as utils def parse_args(): # experiment specifics parser = argparse.ArgumentParser() parser.add_argument('tag', type=str, default='cache', nargs='?', help='folder name to clear') parser.add_argu...
Python
1
DevicePCIBusInfoPropertiesEXT.html). #[derive(Debug, Clone)] pub struct VkPhysicalDevicePCIBusInfoProperties { pub pci_domain: usize, pub pci_bus: usize, pub pci_device: usize, pub pci_function: usize, } #[doc(hidden)] #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct RawVkPhysicalDevicePCIBusInfoPro...
Rust
0
0, gamma=0.1) criterion_resnet34 = nn.CrossEntropyLoss() optimizer_resnet34 = optim.Adam(resnet34.parameters(), lr=0.001, betas=(0.9, 0.999)) exp_lr_scheduler_resnet34 = lr_scheduler.StepLR(optimizer_resnet34, step_size=100, gamma=0.1) criterion_resnet18 = nn.CrossEntropyLoss() optimizer_resnet18 = optim.Adam(resnet1...
Python
1
class LuwaEmployee: def __init__(self, name, department, salary): self.name = name self.department = department self.salary = salary def introduce(self): print( f"Hello my name is {self.name}, I work in the {self.department} department, and I earn UGX {self.salary}!"...
Python
1
mod from; mod write; <gh_stars>1-10 use term; use tty; use std::fmt; macro_rules! warn { ( $ ( $ arg : tt ) * ) => ( $crate::log::warn_fmt ( format_args ! ( $ ( $ arg ) * ) ) ) } macro_rules! err { ( $ ( $ arg : tt ) * ) => ( $crate::log::err_fmt ( format_args ! ( $ ( $ arg ) * ) ) ) } macro_rules! info { ...
Rust
0
extrude(amount=c + 2 * idx) # [Ex. 33] write_svg() # show_object(ex33.part) ########################################## # 34. Embossed and Debossed Text # [Ex. 34] length, width, thickness, fontsz, fontht = 80.0, 60.0, 10.0, 25.0, 4.0 with BuildPart() as ex34: Box(length, width, thickness) topf ...
Python
1
a = 1 b = 2 c = b or a # ou lógico 0 = False / != 0 (diferente de zero) = True d = a | b # or binário print(c) print(d) # 0000.0001 # 0000.0010 # 0000.0011 => 3
Python
1
import numpy as np import scipy.io as sio import os from scipy import signal as scipy_signal from scipy.signal import welch import scipy.signal.windows as windows class SignalGenerator: def __init__(self): """初始化信号生成器""" pass def QPSK(self, N=400): """ 生成QPSK调制信号 "...
Python
1
} } impl<T> Drop for Buffer<T> { fn drop(&mut self) { //Cleanup self.gl.delete_buffer(Some(&self.buf)); } } <filename>asbot/src/main.rs //! <NAME> bot. mod discord; mod server; use uslib::common::*; use discord::Discord; use discord::DiscordConfig; use blockz::prelude::*; use server::GrpcS...
Rust
0
b_codepoint_t) -> hb_position_t; pub fn hb_ot_glyf_get_side_bearing_var(font: *mut hb_font_t, glyph: u32, is_vertical: bool) -> i32; pub fn hb_ot_glyf_get_advance_var(font: *mut hb_font_t, glyph: u32, is_vertical: bool) -> u32; pub fn hb_shape(font: *mut hb_font_t, buffer: *mut rb_buffer_t, features: *const...
Rust
0
s }) }) } use super::{dis_fn, val, val_vulkan}; use std::ffi::OsStr; struct SetEnvVar<'a> { k: &'a OsStr, } impl<'a> SetEnvVar<'a> { fn new(k: &'a impl AsRef<OsStr>, v: impl AsRef<OsStr>) -> Self { let k = k.as_ref(); std::env::set_var(k, v); Self { k } } }...
Rust
0
del rdatas[n] # pyright: ignore[reportPossiblyUnboundVariable] ordered.append(rdatas[0]) return ordered def parse_formatted_hex(formatted, num_chunks, chunk_size, separator): if len(formatted) != num_chunks * (chunk_size + 1) - 1: raise ValueError("invalid formatted hex string") value...
Python
1
_primes // 105: after_computing_primes 2, 199, // 105: load two 3, 188, // 107: store i // 109: before_printing_primes 2, 188, // 109: load i 9, 187, // 111: subtract limit 19, 185, // 113: jump_if_nonnegative after_printing_all_primes 1, 200, // 115: set ...
Rust
0
ert_eq!(&entity.name, "pageview"); println!(); println!("Delete one row\n"); elephantry.delete_one::<EventModel>(&entity)?; let uuid = entity.uuid.unwrap(); assert!(elephantry .find_by_pk::<EventModel>(&elephantry::pk! {uuid => uuid})? .is_none()); assert_eq!( elephantry...
Rust
0
port_map_trans[fr] source_port = port_map_refl[fr] coef_key= eterm+'(%i,%i)'%(receiver_port,source_port) pna_coefs[coef_key] = coefs[k] return pna_coefs def align_measured_ideals(measured, ideals): """ Aligns two lists of networks based on the intersection of ...
Python
1
import pandas as pd import polars as pl from op_analytics.coreutils.gsheets import record_changes, update_gsheet from op_analytics.coreutils.partitioned.dailydata import DEFAULT_DT from .across_bridge import load_across_bridge_addresses, upload_across_bridge_addresses from .goldsky_chains import goldsky_mainnet_chain...
Python
1
bcClientType) -> Self { match value { IbcClientType::Tendermint => ClientType::Tendermint, IbcClientType::Grandpa => ClientType::Grandpa, _ => unreachable!(), } } } impl ClientType { pub fn to_ibc_client_type(self) -> IbcC...
Rust
0
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # SPDX-License-Identifier: MIT-0 import os from aws_cdk import ( Stack, aws_dynamodb as dynamodb_, aws_lambda as lambda_, aws_apigateway as apigw_, aws_ec2 as ec2, aws_iam as iam, Duration, ) from constructs import Constru...
Python
1
from gym import utils from fetch import fetch_env def assign(d, *objs): for o in objs: d.update(o) return d class BoxBlockEnv(fetch_env.FetchEnv, utils.EzPickle): def __init__(self, action, block_gripper=False, n_substeps=20, gripper_extra_height=0.2, target_in...
Python
1
, Hash)] pub(crate) struct BaseArithmeticOperation<F: Field64> { const_0: F, const_1: F, multiplicand_0: Target, multiplicand_1: Target, addend: Target, } // use crate::error; pub struct Signature(humm_crypto::ed25519::signature::Ed25519Signature); // impl std::convert::TryFrom<&crate::token::Toke...
Rust
0
::fs::DirEntry`. Instead it copies /// `file_name`, `file_type`, and optionaly `metadata` out of the underlying /// `std::fs::DirEntry`. This allows it to quickly drop the underlying file /// descriptor. #[derive(Debug)] pub struct DirEntry<C: ClientState> { /// Depth of this entry relative to the root directory wh...
Rust
0
"""Example implementation of an out of code Technique""" from __future__ import print_function ### Out of module technique implementation START from PyExpLabSys.drivers.bio_logic import Technique, DataField,\ TechniqueArgument, c_float, E_RANGES, TECHNIQUE_IDENTIFIERS_TO_CLASS class MyOCV(Technique): # pylint...
Python
1
Vpsrldq,// EVEX_Vpsrldq_xmm_xmmm128_imm8 Mnemonic::Vpsrldq,// EVEX_Vpsrldq_ymm_ymmm256_imm8 Mnemonic::Vpsrldq,// EVEX_Vpsrldq_zmm_zmmm512_imm8 Mnemonic::Psllq,// Psllq_mm_imm8 Mnemonic::Psllq,// Psllq_xmm_imm8 Mnemonic::Vpsllq,// VEX_Vpsllq_xmm_xmm_imm8 Mnemonic::Vpsllq,// VEX_Vpsllq_ymm_ymm_imm8 Mnemonic::Vpsll...
Rust
0
s: RpcResponse<Torrents<Torrent>> = client.torrent_get(None, None).await?; let names: Vec<&String> = res.arguments.torrents.iter().map(|it| it.name.as_ref().unwrap()).collect(); println!("{:#?}", names); let res1: RpcResponse<Torrents<Torrent>> = client.torrent_get(Some(vec![TorrentGetField::Id, TorrentGet...
Rust
0
be cropped width: width of region to be cropped Returns: [..., height, width, C] cropped images, [..., 4] adjusted intrinsics """ shape = tf.to_float(tf.shape(image)) original_height = shape[-3] original_width = shape[-2] # intrinsics = [fx fy cx cy] # Convert to pixels, offset, and normalis...
Python
1
2).propose(context_token_ids=np.array([1, 2, 3, 4, 1, 2, 3])) assert np.array_equal(result, np.array([4, 1])) # Match for both 4-gram and 3-gram. # In this case, the proposer should return the 4-gram match. result = ngram_proposer(min_n=3, max_n=4, k=2).propose( context_token_ids=np.array([2, 3...
Python
1
from django.conf import settings from django.conf.urls.static import static from django.contrib import admin from django.urls import include, path from drf_spectacular.views import ( SpectacularAPIView, SpectacularRedocView, SpectacularSwaggerView, ) from rest_framework.routers import DefaultRouter from re...
Python
1
let u: UserPSNProfile = self .psn() .get_profile::<PSNUserLib>(online_id) .await? .into(); self.cache_pool .build_sets(&[u], crate::handler::cache::USER_PSN_U8, false) .await } fn add_to_queue(&mut self, req: PSNRequest, is_front:...
Rust
0
lder.pop_operands(&[ValType::I32, ValType::I32, ValType::I32]); let segments = module .elems .iter() .enumerate() .filter(|(_, e)| module.tables.iter().any(|t| t.element_type == e.ty)) .map(|(i, _)| i) .collect::<Vec<_>>(); let segment = *u.choose(&segments)?; ...
Rust
0
::End), ])), .. Default::default() })); }: { sbox.invoke(); } // w_br_table = w_bench - 3 * w_param // 1 * w_param + 0.5 * 2 * w_param + 0.25 * 4 * w_param instr_br_table { let r in 0 .. INSTR_BENCHMARK_BATCHES; let table = Box::new(parity_wasm::elements::BrTableData { table: Box::new([0, 1, 2]),...
Rust
0
#!/usr/bin/env python3 """ Route module for the API """ from os import getenv from api.v1.views import app_views from flask import Flask, jsonify, abort, request from flask_cors import (CORS, cross_origin) import os app = Flask(__name__) app.register_blueprint(app_views) CORS(app, resources={r"/api/v1/*": {"origins":...
Python
1
ellAgentError::TenantMask {}: Cell {} has no tenant mask", func_name, cell_id)] // TenantMask { func_name: &'static str, cell_id: CellID }, #[fail(display = "CellAgentError::TreeNameMap {}: Cell {} has no tree name map entry for {}", func_name, cell_id, originator_id)] TreeNameMap { func_name: &'static str, ...
Rust
0
he API. self.borrow_backing().ip6_address_fn.set(std::mem::transmute::< Option<Box<dyn FnMut(Ip6AddressInfo<'_>, bool) + 'a>>, Option<Box<dyn FnMut(Ip6AddressInfo<'_>, bool) + 'static>>, >(fn_box)); } } fn ip6_is_slaac_enabled(&self) -> bool { ...
Rust
0
import os import pytest import musdb import numpy as np import yaml @pytest.fixture(params=['train', 'test', ['train', 'test'], None]) def subset(request): return request.param @pytest.fixture(params=[True, False]) def mus(request, subset): return musdb.DB( root='data/MUS-STEMS-SAMPLE', is_wav=reque...
Python
1
Some(frame) /// }).collect() /// } /// # } /// ``` /// /// **_NOTE:_** It is considered undefined behavior to return a render which has not recorded /// any commands, as shown: /// /// ```rust /// # use screen_13::prelude_rc::*; /// # struct Foo; /// # impl Screen<Rc>...
Rust
0
layout : set_layout, }; Ok(descriptors) } fn setup_renderpass(device: &VkDevice, swapchain: &VkSwapchain) -> VkResult<vk::RenderPass> { use vkbase::ci::pipeline::RenderPassCI; use vkbase::ci::pipeline::{AttachmentDescCI, SubpassDescCI, SubpassDependencyCI}; let color_attachment = AttachmentDescCI...
Rust
0
, ctx : &impl IsCtx<'a>) -> String { match self { Var { dbj } => format!("Var{}", dbj), Sort { level } => format!("Sort {}", level.nanoda_dbg(ctx)), Const { name, levels } => { let name = name.nanoda_dbg(ctx); let levels = levels.nanoda_dbg(ctx...
Rust
0
, 32, 74): {}, # Skrydstrup R&D (0, 32, 75): {}, # Professional Audio Company (0, 32, 76): {}, # NewWave Labs (MadWaves) (0, 32, 77): {}, # Vermona (0, 32, 78): {}, # Nokia (0, 32, 79): {}, # Wave Idea (0, 32, 80): {}, # Hartmann GmbH (0, 32, 81): {}, # Lion's Tracs (0, 32, 82): ...
Python
1
.uniform_(-bound, bound) try: from torch.nn.init import _no_grad_trunc_normal_ def trunc_normal_(tensor, mean=0, std=1, a=-2, b=2): '''Drop-in replacement of `torch.nn.init.trunc_normal_`. Note: - if using this function, ensure `mean`, `std`, `a`, `b` do not depend...
Python
1
a = 10 b = 20 c = a+b print(c)
Python
1
: Box<dyn UserDetails>) -> impl Responder { if user.is::<User>() { match user.downcast_ref::<User>() { Some(user) => HttpResponse::Ok().json(UserResource::from(user)), None => HttpResponse::InternalServerError().finish(), } } else { match user.downcast_ref::<Unreg...
Rust
0
x>, usize>, interpret_allocs: FxIndexSet<interpret::AllocId>, source_map: CachingSourceMapView<'tcx>, file_to_file_index: FxHashMap<*const SourceFile, SourceFileIndex>, hygiene_context: &'a HygieneEncodeContext, } impl<'a, 'tcx, E> CacheEncoder<'a, 'tcx, E> where E: 'a + OpaqueEncoder, { fn sou...
Rust
0
ception(code, message, reqid) except Exception as e: if isinstance(e, TceCloudSDKException): raise else: raise TceCloudSDKException(e.message, e.message) def DescribeClusterCreateProgress(self, request): """获取集群创建进度 :param request: 调用...
Python
1
n range(1, len(segs)): start, end, label = segs[i].strip().split(",") print( "SPEAKER {0} {1} {2:7.3f} {3:7.3f} <NA> <NA> {4} <NA> <NA>".format( reco, args.rttm_channel, float(start), ...
Python
1
_ => println!("Impossible"), } } { // match tuple let pair = (0, -2); match pair { (0, y) => println!("First is `0` and `y` is `{:?}`", y), (x, 0) => println!("`x` is `{:?}` and last is `0`", x), _ => ...
Rust
0
K=V ", "K", "V", ""), (r"K='\x26'", "K", "&", ""), (r#"K='\u{1F600}'"#, "K", "\u{1F600}", ""), ] { assert_eq!( match_one_env(program), (Some((k, v.into())), result_program) ); } } } <reponame>loiclec/fuzzcheck-rs<gh_st...
Rust
0
.eq -= self.eq; assert!(now.neq >= self.neq); now.neq -= self.neq; mem::swap(&mut now, self); } } impl Add for ComparisonCounts { type Output = Self; fn add(self, rhs: Self) -> Self { ComparisonCounts { partial_ord: self.partial_ord + rhs.partial_ord, ord: self.ord + rhs.ord, e...
Rust
0
# Copyright (c) 2014 The WebM project authors. All Rights Reserved. # # Use of this source code is governed by a BSD-style license # that can be found in the LICENSE file in the root of the source # tree. An additional intellectual property rights grant can be found # in the file PATENTS. All contributing project auth...
Python
1
from setuptools import setup, find_packages setup( name="MergeTimelineSubWindow", version="1.0.0", description="MergeTimelineSubWindow", author="Ariesta Putra", author_email="ikadekagusariestaputra@gmail.com", url="", packages=find_packages(), entry_points={ "console_scripts": [...
Python
1
!{struct MEMORY_BASIC_INFORMATION32 { BaseAddress: DWORD, AllocationBase: DWORD, AllocationProtect: DWORD, RegionSize: DWORD, State: DWORD, Protect: DWORD, Type: DWORD, }} pub type PMEMORY_BASIC_INFORMATION32 = *mut MEMORY_BASIC_INFORMATION32; STRUCT!{struct MEMORY_BASIC_INFORMATION64 { // F...
Rust
0
use crate::utils::create_mt; use crate::plotters::Chart; use plotters::prelude::*; use wasm_bindgen::prelude::*; use wasm_bindgen::JsCast; use wasm_bindgen::Clamped; use web_sys::{CanvasRenderingContext2d, HtmlCanvasElement, ImageData}; use js_sys::{ArrayBuffer, Float64Array, Uint8Array, Uint32Array, Object}; use was...
Rust
0
heck!(@ $from, $to=> try v: 1;); check!(@ $from, $to=> $($tail)*); }; (@ $from:ty, $to:ty=> try v: $src:expr, !$dst:expr; $($tail:tt)*) => { { let src: $from = $src; let dst: Result<$to, _> = src.try_into(); assert_eq!(dst, Err($dst(src))); } ...
Rust
0
from typing import List import dotenv from agenthalo.agent import HaloAgent from agenthalo.config import Config from agenthalo.core.tool import AgentHaloToolBase from agenthalo.tools.core import GetTokenAddress from agenthalo.tools.exchanges import ExecuteTokenSwap, GetTokenPrice dotenv.load_dotenv() config = Config(...
Python
1
GRAVITY + acceleration(-2.0, 1.0), Acceleration(Vector2((-2.0, -2.711))) ); } #[test] fn it_can_accelerate_a_particle() { let time = Time::default(); let acceleration = GRAVITY; let expected = Particle { position: Point2::new(0.0, GRAVITY_Y / 2.0), sp...
Rust
0
T, U> {} #[pin_project] struct HasOverlappingLifetimes<'pin, T, U> { #[pin] field1: &'pin mut T, field2: U, } #[allow(single_use_lifetimes)] #[project] impl<'pin, T, U> HasOverlappingLifetimes<'pin, T, U> {} #[pin_project] struct HasOverlappingLifetimes2<T, U>...
Rust
0
32::from($s3)) + mul16(C5S3, i32::from($s5)); let t_d = mul16(C3S5, i32::from($s5)) - mul16(C5S3, i32::from($s3)); let t_a1 = mul16(C4S4, t_a - t_c); let t_b1 = mul16(C4S4, t_b - t_d); let t_c = t_a + t_c; let t_d = t_b + t_d; let t_e = mul16(C4S4, i32::from($s0 + $s4...
Rust
0
hdot', 'dotted'}, optional If *linestyles* is *None*, the default is 'solid' unless the lines are monochrome. In that case, negative contours will take their linestyle from :rc:`contour.negative_linestyle` setting. *linestyles* can also be an iterable of the above strings specifying a ...
Python
1
#!/usr/bin/python2.7 # -*- coding: utf-8 -*- import sys import os import socket import hashlib import plistlib from operator import xor def load_device_info(sn): if '.xml' in sn: device = plistlib.readPlist(sn) else: device = plistlib.readPlist("devices/%s.xml" % sn) return device if sys....
Python
1
2fix(d: u32) -> bool { (d & 0xffff0000) == 0x9e020000 } pub const fn is_UCVTF_S64_float2fix(d: u32) -> bool { (d & 0xffff0000) == 0x9e030000 } pub const fn is_FCVTZS_64S_float2fix(d: u32) -> bool { (d & 0xffff0000) == 0x9e180000 } pub const fn is_FCVTZU_64S_float2fix(d: u32) -> bool { (d & 0xffff0000...
Rust
0
Redmi 9 国际版'}, {'model': 'M2004J19I', 'name': ' Redmi 9 Prime 印度版'}, {'model': 'M2004J19AG', 'name': ' Redmi 9 国际版 (NFC)'}, {'model': 'M2006C3LC', 'name': ' Redmi 9A 全网通版'}, { 'model': 'M2006C3LG', 'name': ' Redmi 9A 国际版'}, {'model': 'M2006C3LVG', 'name': ' Redmi 9AT 国际版'}, {'model': ...
Python
1
roject_id}/questions/{question_id}/stance-analysis" params = {"forceRegenerate": str(force_regenerate).lower()} if custom_prompt: params["customPrompt"] = custom_prompt response = requests.get(url, headers=self._headers(admin_required=force_regenerate), params=params) print(f...
Python
1
*; wasm_bindgen_test_configure!(run_in_browser); #[wasm_bindgen_test] fn pass() { assert_eq!(suffix(String::from("k8stest")), "21324540"); } <reponame>aschaeffer/rust-ecs-poc use indradb::VertexProperties; use serde::{Deserialize, Serialize}; use serde_json::Value; use std::collections::HashMap; use uuid::Uuid; u...
Rust
0
sh,)): Params<(JsonH256,)>, generator: Data<Generator>, ) -> Result<JsonH256> { let l2_sudt_script = build_l2_sudt_script(generator.rollup_context(), &to_h256(l1_sudt_script_hash)); Ok(to_jsonh256(l2_sudt_script.hash().into())) } async fn tests_produce_block( Params((payload,)): Params<(TestMod...
Rust
0
::max(0, i32::min(rect1[0]+rect1[2], rect2[0]+rect2[2]) - i32::max(rect1[0], rect2[0])); let ol_y = i32::max(0, i32::min(rect1[1]+rect1[3], rect2[1]+rect2[3]) - i32::max(rect1[1], rect2[1])); return ol_x * ol_y; } #[test] fn rect_overlap_test(){ let one = overlap_rect_area( [0, 0, 50, 50], ...
Rust
0
set_2() & \ kasumi_F8_testset_3() & kasumi_F8_testset_4() & \ kasumi_F8_testset_5() & \ kasumi_F9_testset_1() & kasumi_F9_testset_2() & \ kasumi_F9_testset_3() & kasumi_F9_testset_4() & \ kasumi_F9_testset_5() ### # SNOW3G, F8, F9, EIA1: testsets from 3GPP T...
Python
1
from a2a.server.agent_execution import AgentExecutor from a2a.server.agent_execution.context import RequestContext from a2a.server.events.event_queue import EventQueue from a2a.utils import ( new_agent_text_message, new_task, ) from a2a.server.tasks import TaskUpdater from a2a.utils.errors import ServerError f...
Python
1
class Solution(object): def smallestDistancePair(self, nums, k): """ :type nums: List[int] :type k: int :rtype: int """ nums.sort() def count_pairs(mid): count = 0 left = 0 for right in range(len(nums)): ...
Python
1
#! /usr/bin/env python import SimpleITK as sitk import vtk def printStats(stats): print(" Min:", stats[0]) print(" Max:", stats[1]) print(" Mean:", stats[2]) print(" StdDev:", stats[3]) def compare_stats(sitkimg, vtkimg): """Compare the statistics of a SimpleITK image and a VTK imag...
Python
1
from restack_ai import Restack restack_client = Restack()
Python
1
} Ok(()) } fn walk_snapshot( snapshot_and_forest: &SnapshotAndForest, reader: &mut read::BlobReader, packed_blobs: &mut FxHashSet<ObjectId>, backup: &mut Option<backup::Backup>, ) -> Result<()> { debug!( "Repacking any loose blobs from snapshot {}", snapshot_and_forest.id ...
Rust
0
unsafe { mem::transmute((self.raw_descriptor_table_ptr, self.queue_size)) } } pub fn available_ring(&self) -> *mut VirtqAvail { unsafe { mem::transmute((self.raw_available_ring_ptr, self.queue_size)) } } pub fn used_ring(&self) -> *mut VirtqUsed { unsafe { mem::transmute((self....
Rust
0
ber self.buyer.loc[buyer_index, '购买货物数量'] = number def search_by_noyixiang(self): for var in ["SR","CF"]: self.tem_seller=self.seller[self.seller['品种']==var] self.tem_buyer=self.buyer[self.buyer['品种']==var] self.tem_buyer=self.tem_buyer.sort_values(by=['购买货物数量'],...
Python
1
import numpy as np import sympy as sp import matplotlib.pyplot as plt from tabulate import tabulate def main(): # Função para derivação x, y = sp.symbols('x y') z = x**2 + x*y + 10*y**2 - 5*x - 3*y # Função para cálculo fxy = sp.lambdify((x, y), z, 'numpy') # Derivadas parciais da função ...
Python
1
true, |oper| oper.is_lit())) { return sl_ast::VExpr::OpApp(value_op, rw_operands, typ); } let oper1_val: u64 = oper1.get_lit_value().expect("Expected at least one operand."); let oper2_val_opt: Option<u64> = oper2_opt.map(|oper| oper.get_lit_value().un...
Rust
0
{ panic!("compression feature not enabled"); } } else { let downloader = DownloadMultiple::new(bio::File::create(tempfile.path())?, bucket, key, total_size); run_downloader(s3.clone(), downloader, decompress).await?; } // If we're trying to download i...
Rust
0
bytes = body.try_concat().await.unwrap(); assert_eq!(bytes.len(), 100); }; join(async move { conn.await.expect("client") }, fut).await; }; join(srv, h2).await; } use num::BigInt; use project_euler_rs::fibonacci::Fibonacci; fn main() { let fib = Fibonacci::new(BigInt::from(1), Big...
Rust
0
opcion = int(input("\nSeleccione una opcion: ")) if opcion == 1: binario() elif opcion == 2: contar() elif opcion == 3: raiz() elif opcion == 4: decimal() elif opcion == 5: enteros() elif opcion == 0: ...
Python
1
put).expect("well-formed UTF-8 on windows") } /// Similar to [`try_from_byte_slice()`], but will panic if there is ill-formed UTF-8 in the `input`. pub fn from_byte_slice(input: &[u8]) -> &Path { try_from_byte_slice(input).expect("well-formed UTF-8 on windows") } fn replace<'a>(path: impl Into<Cow<'a, BStr>>, fin...
Rust
0
''' Description: a python code that calculates the product of all odd numbers between 1 and a given number n Author:Adars v Date:11/11/2024 ''' x=int(input("Enter the number:")) sum=1 i=1 while (i<=x): sum=sum*i i=i+2 print(sum)
Python
1
} } min } } #[cfg(test)] mod tests { use super::Solution; #[test] fn test_0() { assert_eq!(Solution::find_min(vec![3, 4, 5, 1, 2]), 1); } #[test] fn test_1() { assert_eq!(Solution::find_min(vec![4, 5, 6, 7, 0, 1, 2]), 0); } #[test] fn test...
Rust
0
x::Error::from_errno(Errno::EINVAL))) } fn usernamespace(oci: &Spec) -> Result<()> { let linux = oci.linux.as_ref().unwrap(); if contain_namespace(&linux.namespaces, "user") { let user_ns = PathBuf::from("/proc/self/ns/user"); if !user_ns.exists() { return Err(anyhow!("user namespac...
Rust
0
import numpy as np import vedo def update_plot(widget=None, evt=""): k = widget.value if evt else kinit ################################################# y = 2 * k * x / (1 + (k * x)**2) # hill function # y = (k*x)**2 * np.sign(k*x) # another function # y = 2 * (k * x)**3 / (1 + (k * x)**2) #...
Python
1
} } /// Result of breaking a string so it fits in a line and the state it ended in. /// The state informs about what to do with the snippet and how to continue the breaking process. #[derive(Debug, PartialEq)] enum SnippetState { /// The input could not be broken and so rewriting the string is finished. En...
Rust
0
shader pipeline. let pipeline_handle = pipelines.add(p); render_graph.add_system_node( "line_shader", AssetRenderResourcesNode::<LineShader>::new(false), ); render_graph .add_node_edge("line_shader", base::node::MAIN_PASS) .unwrap(); let pipes = RenderPipelines::f...
Rust
0
.entered(); let latest_gc_cutoff_lsn = timeline.tline.get_latest_gc_cutoff_lsn(); let lsn = Self::wait_or_get_last_lsn(timeline, req.lsn, req.latest, &latest_gc_cutoff_lsn)?; let all_rels = timeline.list_rels(pg_constants::DEFAULTTABLESPACE_OID, req.dbnode, lsn)?; let mut total_blocks: ...
Rust
0
subborrowx_u32(&mut x175, &mut x176, x174, x161, 0xffffffff); let mut x177: u32 = 0; let mut x178: fiat_p224_u1 = 0; fiat_p224_subborrowx_u32(&mut x177, &mut x178, x176, x163, 0xffffffff); let mut x179: u32 = 0; let mut x180: fiat_p224_u1 = 0; fiat_p224_subborrowx_u32(&mut x179, &mut x180, x178, (x164 as u3...
Rust
0
ivative](crate::methods::Derivative) Derivative, /// [Integral](crate::methods::Integral) Integral, /// [Mean Absolute Deviation](crate::methods::MeanAbsDev) #[cfg_attr(feature = "serde", serde(rename = "mean_abs_dev"))] MeanAbsDev, /// [Median Absolute Deviation](crate::methods::MedianAbsDev) #[cfg_attr(fea...
Rust
0
"Disk in creation", ); m.insert( convert_str_to_array("89C57F98-2FE5-4DC0-89C1-5EC00CEFF2BE").unwrap(), "dm-crypt disk in creation", ); m.insert( convert_str_to_array("CAFECAFE-9B03-4F30-B4C6-B4B80CEFF106").unwrap(), "Block", ...
Rust
0
return self._dict.__reversed__() def __or__(self, other): if isinstance(other, _dok_base): return self._dict | other._dict return self._dict | other def __ror__(self, other): if isinstance(other, _dok_base): return self._dict | other._dict return self...
Python
1
""" Classes from the 'SetupAssistant' framework. """ try: from rubicon.objc import ObjCClass except ValueError: def ObjCClass(name): return None def _Class(name): try: return ObjCClass(name) except NameError: return None BYAnalyticsExpressRestore = _Class("BYAnalyticsExpres...
Python
1
'1', b'O', b'1', b'P', b'1', b'Q', b'1', b'R', b'1', b'S', b'2', b'0', b'2', b'1', b'2', b'2', b'2', b'3', b'2', b'4', b'2', b'5', b'2', b'6', b'2', b'7', b'2', b'8', b'2', b'9', b'2', b'A', b'2', b'B', b'2', b'C', b'2', b'D', b'2', b'E', b'2', b'F', b'2', b'G', b'2', b'H', b'2', b'I', b'2', b'J', b'2', b'K...
Rust
0
. Returns ------- str The extracted text. """ start_index = text_anchor.text_segments[0].start_index end_index = text_anchor.text_segments[0].end_index return document.text[start_index:end_index] class PDFAnnotator: def __init__(self, input_pdf_...
Python
1
), 0); assertEq(TEST.exports.fless_or_equal32(8,8), 1); assertEq(TEST.exports.fgreater32(5,8), 0); assertEq(TEST.exports.fgreater32(8,5), 1); assertEq(TEST.exports.fgreater32(8,8), 0); assertEq(TEST.exports.fgreater_or_equal32(5,8), 0); assertEq(TEST.exports.fgreater_or_equal32(8,5), 1); assertEq(TEST.exports.fgreater_...
Rust
0
relabel)._latex_dynkin_diagram(node_dist=node_dist) rt_most = (n - 2) * node_dist center_point = rt_most - node_dist ret = "\\draw (0,0.7 cm) -- (%s cm,0);\n"%node_dist ret += "\\draw (0,-0.7 cm) -- (%s cm,0);\n"%node_dist ret += "\\draw (%s cm,0) -- (%s cm,0);\n"%(node_dist, cen...
Python
1