text
string
label_name
string
labels
int64
from typing import ( Literal, Optional, ) import yaml from pydantic import ( BaseModel, RootModel, ) from galaxy.util.resources import resource_string RuleBuilderImportType = Literal["datasets", "collections"] RuleBuilderModes = Literal[ "raw", "ftp", "datasets", "library_datasets", ...
Python
1
use_online_data=True, analysis_kwargs={'initial_f_k': initial_f_k}, unbias_restraint=False) assert analyzer.use_online_data is True assert analyzer._online_data is not None _ = analyzer.mbar assert np.all(analyzer._extra_analysis_kwargs['ini...
Python
1
Mock the logger to capture warning messages with patch.object(analyzer.logger, 'warning') as mock_warning: analyzer.print_statistics() # Verify all expected calls were made warning_calls = [call.args[0] for call in mock_warning.call_args_list] warning_text = ' '.join(warning_calls) ...
Python
1
field:google.protobuf.FieldDescriptorProto.oneof_index) oneof_index: ::std::option::Option<i32>, /// JSON name of this field. The value is set by protocol compiler. If the /// user has set a "json_name" option on this field, that option's value /// will be used. Otherwise, it's deduced from the field...
Rust
0
assert_eq!(r[0].r#type, 5); assert_eq!(r[0].TTL, 988); assert_eq!(r[1].name, "sendgrid.com."); assert_eq!(r[1].data, "172.16.58.3"); assert_eq!(r[1].r#type, 1); assert_eq!(r[1].TTL, 89); assert_eq!(r[2].name, "sendgrid.com."); assert_eq!(r[2].data, "172.1...
Rust
0
ema.MAP, _('List of security group ingress rules.'), schema=_rule_schema, ), update_allowed=True ), SECURITY_GROUP_EGRESS: properties.Schema( properties.Schema.LIST, schema=properties.Schema( properties.Schem...
Python
1
reflink test runs at a time. use std::sync::Mutex; use std::sync::MutexGuard; use lazy_static::lazy_static; lazy_static! { pub static ref CROSSTEST: Mutex<bool> = Mutex::new(false); pub static ref SEQUENTIAL_REFLINK_TESTS: Mutex<()> = Mutex::default(); ...
Rust
0
self.lua.exec_func1("msg_redis_result", cookie) } else { self.lua.exec_func2("msg_redis_result", cookie, RedisWrapperResult(result.unwrap())) } } pub fn execute_message(&mut self, fd: i32, mut net_msg: NetMs...
Rust
0
''' Дан массив nums, содержащий n уникальных чисел в диапазоне [0, n], верните единственное недостающее в массиве nums число, которое входит в этот диапазон. Пример 1: ``` Ввод: nums = [3,0,1] Вывод: 2 Пояснение: n = 3, так как в массиве 3 числа, значит, все числа находятся в диапазоне [0,3]. Число 2 является единст...
Python
1
# The Board Game aka Bradspelet # https://open.kattis.com/problems/bradspelet # TAGS: dynamic programming, game, improve # CP4: 0, Not In List Yet # NOTES: """ TODO: IMPROVE: resolve with a proof/game analysis. Currently solve with dynamic programming logic. --- To win you must force your opponent to choose between 2...
Python
1
crate) fn make_current(&self) { unsafe { self.ctxt.make_current(self.hdc); } } fn swap_buffers(&self) { unsafe { SwapBuffers(self.hdc); } } } <reponame>luciotato/near-sdk-rs //! Blockchain-specific methods available to the smart contract. This is a wr...
Rust
0
.simulations.sample_from_priors( initialized_priors, True, 10, 5, 1, "deep_prior", parameters_deep, network, expert, ) # check expected shape of prior samples (1, num_samples, num_params) np.testing.assert_array_equal(prior_samples.sha...
Python
1
/ Add prepaid value for an existed file success. /// The first item is the account who add the prepaid. /// The second item is the cid of the file. /// The third item is the prepaid amount of currency. AddPrepaidSuccess(AccountId, MerkleRoot, Balance), /// Calculate the reward fo...
Rust
0
Ok(t) => t, Err(e) => return Err(format!("Error: {}", e.to_string())), }; let res = tzs.choose(&mut thread_rng()).unwrap(); Ok(res.clone()) } pub fn tz_by_iso_code(iso_code: &str) -> Result<Option<String>, Error> { //! Get the countries time zone informat...
Rust
0
#!/usr/bin/env python3 import sys CONTIG_IDX=0 START_IDX=6 END_IDX=7 def main(): if len(sys.argv) < 3: exit('Wrong number of arguments') blast_input_file = sys.argv[1] blast_output_file = sys.argv[2] threshold_length = 1000000 if len(sys.argv) < 4 else int(sys.argv[3]) with open(blast_input_file, 'r') as ...
Python
1
pRequest<S>) -> Self::Result { let matrix = { // Entries are column major. let e: Vec<f32> = req .query() .get("matrix") .ok_or(PointsViewerError::BadRequest( "Expected 4x4 Matrix".to_string(), ))? ...
Rust
0
_camel_case_types)] pub type f32m2x2 = Mat2x2<f32>; impl_mat2x2!(f32); #[allow(non_camel_case_types)] pub type f64m2x2 = Mat2x2<f64>; impl_mat2x2!(f64); #[derive(Copy,Clone)] pub struct Mat3x3<T> { pub x: XYZ<T>, pub y: XYZ<T>, pub z: XYZ<T>, } macro_rules! impl_mat3x3 ( ($t:ty) => ( impl M...
Rust
0
; use super::StoreState; use super::WindowBehavior; use super::WindowTransition; /// Locks the view to the top (first page) of the store view /// /// If you implement reporting tool and would like to show /// top 10 records in the store and nothing else. #[derive(Debug)] pub struct KeepOnTop {} impl WindowBehavior ...
Rust
0
, symlink it. ensure!( target_from_path.hashes.sha256 == repo_target.hashes.sha256, error::HashMismatch { context: "target", calculated: hex::encode(target_from_path.hashes.sha256), expected: hex::encode(&repo_target...
Rust
0
).unwrap(); // current hash is equal to genesis in new storage assert_eq!(mainnet_init_info.genesis_block_header_hash, mainnet_init_info.current_block_header_hash); // checks chains assert_ne!(alphanet_init_info.chain_id, mainnet_init_info.chain_id); // checks genesis assert_ne!(alphanet_...
Rust
0
renderer::{RenderDevice, RenderQueue}, texture::Image, }, utils::HashMap, window::WindowId, }; use wgpu::{BindGroupDescriptor, BindGroupEntry, BindingResource}; use crate::{ egui_node::EguiPipeline, EguiContext, EguiManagedTextures, EguiRenderOutput, EguiSettings, WindowSize, }; pub(c...
Rust
0
1; ret.push((p, mult)); a_idx += 1; b_idx += 1; } } } ret.extend_from_slice(&a[a_idx..]); ret.extend_from_slice(&b[b_idx..]); ret } fn p1fac<N: FactorNum>( n: &mut N, start_power: N, prime: &mut u64, sieve: &mut PrimeSi...
Rust
0
ATE_OFFSET+HOST_OFFSET_SP,A0)); info!("{}",sd!(GP,HOST_STATE_OFFSET+HOST_OFFSET_GP,A0)); info!("{}",sd!(TP,HOST_STATE_OFFSET+HOST_OFFSET_TP,A0)); info!("{}",sd!(S0,HOST_STATE_OFFSET+HOST_OFFSET_S0,A0)); info!("{}",sd!(S1,HOST_STATE_OFFSET+HOST_OFFSET_S1,A0)); info!("{}",sd!(A1,HOST_STATE_OFFSET+HOST_OFFSET_A1,A0))...
Rust
0
_base_ = [ '../_base_/models/pointrend_r50.py', '../_base_/datasets/ade20k.py', '../_base_/default_runtime.py', '../_base_/schedules/schedule_160k.py' ] crop_size = (512, 512) data_preprocessor = dict(size=crop_size) norm_cfg = dict(type='SyncBN', requires_grad=True) model = dict( data_preprocessor=data_pre...
Python
1
const SPI3_RCC_APB1R1_ENABLE: u32 = common::BIT_15; /* NVIC Enumerated Set Of All Interrupts On STM32L4 controllers */ pub enum NvicIrq { WWDG_IRQ, /* 0 Window Watchdog interrupt */ PVD_PVM_IRQ, /* 1 PVD/PVM1/PVM2(1)/PVM3/PVM4 through EXTI */ RTC_TAMP_STAMP_IRQ, ...
Rust
0
s; let baddie = self.squadron.iter().filter(|f| f.state == State::Alive).nth(index).unwrap(); /* now find the alien in the same x column with the lowest y. this assumes * the vector remains sorted from top left to bottom right... */ let lowest = self.squadron.iter().filter(|f| f.x == baddie.x ...
Rust
0
e_image, knife_scale) images["texture"] = pg.image.load("wall_texture.jpg").convert() sky_size = int(SCREEN_SIZE[0]*(CIRCLE/FIELD_OF_VIEW)), SCREEN_SIZE[1] sky_box_image = pg.image.load("deathvalley_panorama.jpg").convert() images["sky"] = pg.transform.smoothscale(sky_box_image, sky_size) return ima...
Python
1
{ p_mapped[1] *= -1; } if rot.flips.2 { p_mapped[2] *= -1; } Pos(p_mapped[0], p_mapped[1], p_mapped[2]) } pub fn apply_offset(&self, offset: &Offset) -> Pos { Pos(self.0 + offset.0, self.1 + offset.1, self.2 + offset.2) } } #[derive(Debug, Cl...
Rust
0
ameters, ConstraintF: PrimeField, FG: FieldGadget<M::BaseField, ConstraintF> + ToConstraintFieldGadget<ConstraintF, FieldGadget = FpGadget<ConstraintF>>, { type FieldGadget = FpGadget<ConstraintF>; #[inline] fn to_field_gadget_elements<CS: ConstraintSystemAbstract<ConstraintF>>( &se...
Rust
0
] button /// * the current selected value /// * a function that will be called when the [`Radio`] is selected. It /// receives the value of the radio and must produce a `Message`. /// /// [`Radio`]: struct.Radio.html pub fn new<F, V>( value: V, label: impl Into<String>, ...
Rust
0
Id, RegId, RegId), // LShiftSignValue(RegId, RegId, u16), // LShiftZero(RegId, RegId, RegId), // LShiftZeroValue(RegId, RegId, u16), // Special Instructions Halt, // StoreSpecial(SpecialRegId, RegId), // LoadSpecial(RegId, SpecialRegId), Nop, // Trap(TrapId), // ReturnFromExcept...
Rust
0
# -*- coding: utf-8 -*- """ Created on Thu Mar 30 21:27:31 2017 @author: Shabaka """ import pandas as pd # Open a connection to the file with open('world_dev_ind.csv') as file: # Skip the column names file.readline() # Initialize an empty dictionary: counts_dict counts_dict = {} # Process only...
Python
1
y 45 seconds print("Time to calculate the view of all nodes for one timestep (10000 gs, 2 sat): ", _otherTaken, " seconds") print("Ignoring multiprocessing, for the time based method to be faster, the simulation should be run with a timestep of ", _timeTaken/_otherTaken, " seconds") pri...
Python
1
'y' or 'Y'
Python
1
::Foundation::PSID, dwcount: u32) -> super::super::Foundation::BOOL; #[doc = "*Required features: 'Win32_Security_Authorization', 'Win32_Foundation'*"] #[cfg(feature = "Win32_Foundation")] pub fn AuthzReportSecurityEventFromParams(dwflags: u32, heventprovider: AUTHZ_SECURITY_EVENT_PROVIDER_HANDLE, dwauditid...
Rust
0
# -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. from datetime import datetime, timedelta from odoo.addons.event_booth.tests.common import TestEventBoothCommon from odoo.fields import Datetime as FieldsDatetime from odoo.tests.common import users, tagged @tagged('po...
Python
1
(upper, lower) = root_area.split_vertically(512); let mut cc = ChartBuilder::on(&upper) .x_label_area_size(50) .y_label_area_size(60) .top_x_label_area_size(50) .right_y_label_area_size(40) .caption("Sine and Cosine", ("Arial", 40).into_font()) .build_ranged(-3.4f32...
Rust
0
)?; let bound = if let Some(bound) = bound { Some(Legalize::legalize(ns, ss, scope, bound)?) } else { None }; TypeDecl::Rename(Rename { id, ty: TypeRef::List { ...
Rust
0
(redirect_home()) } else { Err(HttpError::WrongPassword) } } /// Logout out user pub async fn logout(id: Identity) -> HttpResponse { id.forget(); redirect("/login") } extern crate roaring; use roaring::RoaringTreemap; #[test] fn array() { let mut bitmap1 = (0..2000).collect::<RoaringTreemap...
Rust
0
Cell::new(skin)); self.skins.push(RefOwn::new(counted.clone())); counted } pub fn add_animation(&mut self, animation: GLTFAnimation) -> Rc<RefCell<GLTFAnimation>> { let counted = Rc::new(RefCell::new(animation)); self.animations.push(RefOwn::new(counted.clone())); counte...
Rust
0
n, move_smoothness: 1.0, look_smoothness: 1.0, move_speed: 12.0, } } } impl Camera for FirstPersonCamera { type InputType = FirstPersonCameraInput; fn update<InputType: Into<Self::InputType>>(&mut self, input: InputType) { let input = input.into(); ...
Rust
0
ue=1.0, endValue=0)) # x坐标 parAnimation2.addAnimation( QPropertyAnimation(item, b'x', self, duration=400, ...
Python
1
import os import pytest from filecmp import dircmp from places.tests.conftest import run_command from places.tests.test_utils import get_directory_differences @pytest.mark.usefixtures("test_dirs") def test_cli(test_dirs): temp_dir, expected_dir, original_dir = test_dirs # Change to temp directory and run com...
Python
1
00 start_time = time.time() loss_history = [] print("Starting GPU-accelerated training for Lid-Driven Cavity...") for epoch in range(epochs): optimizer.zero_grad() loss_pde = pinn.compute_pde_loss(t_pde, x_pde, y_pde) u_ic_pred, v_ic_pred, _ = pinn.forward(t_ic, x_ic, y_ic) ...
Python
1
x: Xtx<T::AccountId, T::BlockNumber, <T as frame_system::Config>::Hash, BalanceOf<T>>, ) -> Result<StepEntry<T::AccountId, T::BlockNumber, T::Hash, BalanceOf<T>>, &'static str> { let current_step = xtx.schedule.phases[xtx.current_round as usize].clone() [xtx.current_step as usize] .c...
Rust
0
mut ::std::os::raw::c_int, ) -> *mut *mut ::std::os::raw::c_char; } extern "C" { pub fn hts_set_threads(fp: *mut htsFile, n: ::std::os::raw::c_int) -> ::std::os::raw::c_int; } extern "C" { pub fn hts_set_thread_pool(fp: *mut htsFile, p: *mut htsThreadPool) -> ::std::os::raw::c_int; } extern "C" { pub fn...
Rust
0
tmp, "dir3/Cargo.toml", "")?; let r = auto_locate_template_dir(tmp.path(), |_slots| Err(anyhow!("test")))?; assert_eq!(tmp.path().join("dir2/dir2_2"), r); Ok(()) } #[test] fn auto_locate_template_prompts_when_multiple_cargo_generate_is_found() -> anyhow::Result<()> { let tm...
Rust
0
)); assert_eq!(c, (1, 2, 3, 4, 5, 6)) } use advent_of_code::cli; fn main() { let args = cli::parse_args(); let positions: Vec<i64> = std::fs::read_to_string(args.file_path) .expect("Could not read file.") .trim() .split(",") .map(|x| x.parse::<i64>().expect("Cannot parse val...
Rust
0
await.unwrap(); }; let udp_recv = async { udp_recvr(PACKETS, 2001).await.unwrap() }; // start stransmit process let mut child = allow_not_found!(Command::new("srt-live-transmit") .arg("srt://:2000?latency=123?blocking=true") .arg("udp://127.0.0.1:2001") .arg("-a:no") // don't a...
Rust
0
print(abs.__doc__) print(int.__doc__) print(input.__doc__) def nlt(x): '''Trả về giá trị bình phương của giá trị x x phải là số nguyên''' return x**2 x=int(input("Nhập x:")) print(nlt(x).__doc__)
Python
1
x: f64 = 3.5; let error: f64 = error::erf(x); assert_relative_eq!(0.9999992569016276, error, epsilon=3.0 * f64::EPSILON); } #[test] fn erfc_0() { let x: f64 = 0.0; let error: f64 = error::erfc(x); assert_relative_eq!(1.0, error, epsilon=3.0 * f64::EPSILON); } #[test] fn erfc_1() { let x: ...
Rust
0
estate: *mut EState, erm: *mut ExecRowMark, rowid: Datum, updated: *mut bool, ) -> HeapTuple, >; pub type ReparameterizeForeignPathByChild_function = ::std::option::Option< unsafe extern "C" fn( root: *mut PlannerInfo, fdw_private: *mut List, child_rel: *...
Rust
0
access_storage().await?; let mut tokens = storage.tokens_schema().load_tokens().await.map_err(|err| { vlog::warn!("Internal Server Error: '{}'; input: N/A", err); Error::internal_error() })?; // HACK: Special case for the Golem: // // Currently, their tok...
Rust
0
CES_R { CES_R::new((self.bits & 0x0f) as u8) } #[doc = "Bits 4:7 - CE hold min time"] #[inline(always)] pub fn ceh(&self) -> CEH_R { CEH_R::new(((self.bits >> 4) & 0x0f) as u8) } #[doc = "Bits 8:11 - Address setup time"] #[inline(always)] pub fn as_(&self) -> AS_R { ...
Rust
0
import os from datetime import datetime, timedelta, timezone from dotenv import load_dotenv from utils.ph_utils import fetch_product_hunt_data from utils.markdown_utils import generate_markdown_file # 加载环境变量 load_dotenv() def main(): # 校验环境变量 ph_api_key = os.getenv('PH_API_KEY') ph_api_secret = os.getenv...
Python
1
, (_, 0) => Horizontal, _ => Diagonal, }; Ok(Self { start, end, curr: None, line_type, }) } } impl Iterator for LineSegment { type Item = Coord; fn next(&mut self) -> Option<Self::Item> { if self.curr....
Rust
0
sert_receive(out_receiver, |bytes| bytes == vec![1]); } .boxed() }); assert_beaviour_test_succeeds(session_factory, client_behaviour).await; } #[tokio::test] async fn wait_for_disconnect_fails_if_not_disconnected() { let session_factory = |_, unu...
Rust
0
# if match[0]=='true': # print match[0] if typo == 1: time.sleep(intensity) # print '=========to choose'+str(list_humanity[index]) header = fake_headers[headerNum] url = 'http://xk.urp.seu.edu.cn/jw_css/xk/runSelectclassSelectionAction.acti...
Python
1
onstant=True, doc="Current player value") _rename: ClassVar[Mapping[str, str | None]] = {'name': None, 'options': None} _source_transforms: ClassVar[Mapping[str, str | None]] = {'value': None, 'value_throttled': None} def _process_param_change(self, msg): values = self.values if 'options'...
Python
1
= res.unwrap(); let res = Op::from_bytes(&mul_buf); assert!(res.is_ok()); let mul_b = res.unwrap(); assert_eq!(mul_a, mul_b); } } #[test] fn test_op_validate() { let valid_noop = Op::new_noop(); let res = valid_noop.validate(); assert!(res.is_ok()); for _ in 0..1...
Rust
0
K_NV_FILL_RECTANGLE_EXTENSION_NAME; pub use enums::VK_NV_FILL_RECTANGLE_SPEC_VERSION; } #[cfg(feature = "VK_EXT_post_depth_coverage")] pub mod vk_ext_post_depth_coverage { pub use enums::VK_EXT_POST_DEPTH_COVERAGE_EXTENSION_NAME; pub use enums::VK_EXT_POST_DEPTH_COVERAGE_SPEC_VERSION; } #[cfg(feature = "VK_KHR_bi...
Rust
0
# File: toolbench/runner/dispatcher.py from typing import Any, AsyncGenerator, Dict, Union import httpx from models.llm_request import LLMRequest from models.stage_http_output import ( StageHttpTextOutput, StageHttpToolCallOutput, StageInfo, ) async def execute_toolchain_stage( request: LLMRequest, ...
Python
1
(self.glIsEnabledi_p)(target, index) } /// glIsFramebuffer /// * `framebuffer` class: framebuffer pub unsafe fn IsFramebuffer(&self, framebuffer: GLuint) -> GLboolean { (self.glIsFramebuffer_p)(framebuffer) } /// glIsProgram /// * `program` class: program pub unsafe fn IsProgram(&self, program: ...
Rust
0
{ // I think this is wrong. What if the TTLs are different? let key = (responses[0].name.join("."), question.qtype().ok()?); self.data.put(key, (ttl, message.clone())); } } } Some(()) } pub fn remove(&mut ...
Rust
0
ore::ops::Deref for W { type Target = crate::W<CHEHIT_SPEC>; #[inline(always)] fn deref(&self) -> &Self::Target { &self.0 } } impl core::ops::DerefMut for W { #[inline(always)] fn deref_mut(&mut self) -> &mut Self::Target { &mut self.0 } } impl core::convert::From<crate::W<CH...
Rust
0
nt(f" Compression ratio: {result.compression_efficiency:.3f}") print(f" Compression error: {result.compression_error:.6f}") print(f" Compression time: {result.compression_time:.3f}s") # Decompress reconstructed = compressor.decompress(result) print(f" Decompression time: {re...
Python
1
#[test] fn sub_if_known() { let mut len = DecodedLength::new(30); len.sub_if(20); assert_eq!(len.0, 10); } #[test] fn sub_if_chunked() { let mut len = DecodedLength::CHUNKED; len.sub_if(20); assert_eq!(len, DecodedLength::CHUNKED); } } <filename>car...
Rust
0
os(), RANGE_HARVEST)?; creep.obj.harvest(&target); // FIXME: Check if it worked Ok(()) } fn build(creep: &mut Creep, site_id: &Id) -> Res<()> { let site: ConstructionSite = screeps::game::get_object_typed(&site_id)? .ok_or_else(|| format!("no object with id {}", site_id))?; prepend_go_to...
Rust
0
ExprMethodCall { receiver, method, turbofish, args, .. } = call; // translate to types if let Some(turbofish) = turbofish { return Err(Error::new(turbofish.span(), "turbofish is not supported")); } let receiver_ty = translate_expr(&**receiver, env, ...
Rust
0
# pylint: disable=no-member """ add unit history table Revision ID: 07e436912603 Revises: 74e78ac98245 Create Date: 2025-01-03 15:21:59.890916 """ from alembic import op import sqlalchemy as sa from sqlalchemy.dialects import postgresql # revision identifiers, used by Alembic. revision = '07e436912603' down_revision...
Python
1
"library_pid": "lib1", "loan_status": "PENDING", }, "record": {"type": "illr", "value": ill_request_martigny.pid, "organisation_pid": "org1"}, }, ), ] for rec_type, extra in records: res = next( OperationLogsSea...
Python
1
// if the destination is a file then our source is a bat file // else if the the destination is a dir then our source is a sym link if is_file { // make the link path of {in_dir}/{link.name}.bat let mut link_name: String = self.name.clone(); link_name.push_str(".bat"); let link_path = in_dir....
Rust
0
import matplotlib.pyplot as plt import pandas as pd import numpy as np def sum_reve(): print("query39") df_primary = pd.read_csv('/home/postgres/code/data/net/net_3_five/tpcds39primarykey') df_replication = pd.read_csv('/home/postgres/code/data/net/net_3_five/tpcds39replication') y1 = df_primary['rec...
Python
1
#!/usr/bin/env python # # https://www.dexterindustries.com/BrickPi/ # https://github.com/DexterInd/BrickPi3 # # Copyright (c) 2016 Dexter Industries # Released under the MIT license (http://choosealicense.com/licenses/mit/). # For more information, see https://github.com/DexterInd/BrickPi3/blob/master/LICENSE.md # # Th...
Python
1
import asyncio import concurrent from openai import OpenAI from Citlali.models.entity import ChatMessage from Citlali.models.openai.client import OpenAIChatClient from Citlali.utils.image import Image from Fairy.config.model_config import ModelConfig class VisualDescriptionGenerator: def __init__(self, visual_p...
Python
1
ip_refresh_computed_fields @skip_refresh_computed_fields.setter def skip_refresh_computed_fields(self, skip_refresh_computed_fields): """Sets the skip_refresh_computed_fields of this DeploymentModel. Skip refresh computed fields on tracker items # noqa: E501 :param skip_refresh_compu...
Python
1
MatMatMulUnaryFinite<TA, TB, TC, TI> where TA: Datum + Copy + Zero, TB: Datum + Copy + Zero, TC: Datum + Copy, TI: Datum + Copy + Add + Mul + Zero + fmt::Debug, { pub(crate) c_shape: TVec<usize>, pub(crate) c_prefix_dim_and_stride: Option<(TVec<usize>, TVec<isize>)>, pub(crate) packed_as: A...
Rust
0
impl From<Url> for OsvReference { fn from(url: Url) -> Self { OsvReference { kind: guess_url_kind(&url), url, } } } #[allow(dead_code)] // we don't (yet) construct all the variants #[derive(Debug, Clone, Serialize)] pub enum OsvReferenceKind { ADVISORY, ARTICLE,...
Rust
0
} } } impl FromHashMap for BibliographyType { fn from_hash_map(map: &HashMap<String, String>) -> Result<Box<Self>, String> { match map.get(K_TYPE).ok_or(missing_field!(K_TYPE))?.as_str() { T_ARTICLE => Ok(Box::new(Self::Article(*Article::from_hash_map(map)?))), T_BOOK => Ok(B...
Rust
0
)) .collect(), ), ); dotter.insert("files".into(), files_as_toml(files)); dotter.insert( "os".into(), (if cfg!(windows) { "windows" } else { "unix" }).into(), ); variables.insert("dotter".into(), dotter.into()); } #[cfg(test)] mod test { use super::*; ...
Rust
0
ViTModelIntegrationTest(unittest.TestCase): @cached_property def default_image_processor(self): return ViTImageProcessor.from_pretrained("google/vit-base-patch16-224") if is_vision_available() else None @slow def test_inference_image_classification_head(self): model = TFViTForImageClass...
Python
1
ote::new(2, 1), eng.state.vote); assert_eq!( Some(Leader { vote_granted_by: btreeset! {1} }), eng.state.leader ); assert_eq!(ServerState::Candidate, eng.state.server_state); assert_eq!( MetricsChangeFlags { ...
Rust
0
/// use noodles_sam::record::cigar::op::Kind; /// /// // 36M8S /// let data = [0x40, 0x02, 0x00, 0x00, 0x84, 0x00, 0x00, 0x00]; /// let cigar = Cigar::new(&data); /// /// let mut ops = cigar.ops(); /// /// assert_eq!(ops.next(), Some(Op::new(Kind::Match, 36))); /// assert_eq!(ops....
Rust
0
t_v16i8(a.as_i8x16()), src.as_i8x16(), )) } /// Considers the input `b` as packed 64-bit integers and `c` as packed 8-bit integers. /// Then groups 8 8-bit values from `c`as indices into the the bits of the corresponding 64-bit integer. /// It then selects these bits and packs them into the output. /// ///...
Rust
0
lf) { self.level += 1; } pub fn dec(&mut self) { assert!(self.level > 0); self.level -= 1; } } impl Default for LevelColor { fn default() -> Self { Self::new() } } fn draw_node<const K: usize, const M: usize>( node: &SsNode<K, M>, canvas: &mut Canvas, le...
Rust
0
def rearrange(l): list1 = [x for x in l if x <= 0] list2 = [y for y in l if y > 0] return list1 + list2
Python
1
35)) palette.setColor(QPalette.ColorRole.Text, QColor(190, 190, 190)) palette.setColor(QPalette.ColorRole.BrightText, QColor(180, 180, 180)) palette.setColor(QPalette.ColorRole.ButtonText, QColor(180, 180, 180)) palette.setColor(QPalette.ColorRole.Base, QColor(42, 42, 42)) palett...
Python
1
let tyS = ctx.input_ty(branches[0], 0); if is_int_ty(tyS) { let rS = ctx.input(branches[0], 0); let cc = match op0 { Opcode::Brz => CC::Z, Opcode::Brnz => CC::NZ, ...
Rust
0
TH", dest_workspace.as_str().unwrap().to_owned())]); command_line_test_with_env([~"install", ~"--rust-path-hack"], &source_dir, rust_path); debug!("Checking that foo exists in {}", dest_workspace.display()); assert_lib_exists(dest_workspace, &Path::new("foo"), NoVersion); assert_built_library_exists(dest_wo...
Rust
0
match self.peeked.take() { Some(Peeked { token: None, .. }) => return None, Some(Peeked { token: v @ Some(_), .. }) => v, None => None, }; self.lexer.last().or(peek_opt) } fn nth(&mut self, n: usize) -> Option<T> { match s...
Rust
0
f = 0 nomes = ('PYTHON', 'MOUSE', 'CELULAR', 'ESTUDAR', 'DECLINIO', 'ARLONG', 'PLANTA') for c in nomes: print(f'Na palavra {c} temos de vogal: ', end='') for f in range(0, len(c)): if c[f] == 'A': print('a', end=' ') if c[f] == 'E': print('e', end=' ') if c[f] == ...
Python
1
''' Given a string s, return the longest palindromic substring in s. Example 1: Input: s = "babad" Output: "bab" Explanation: "aba" is also a valid answer. Example 2: Input: s = "cbbd" Output: "bb" Constraints: 1 <= s.length <= 1000 s consist of only digits and Eng...
Python
1
''' Train.py 对搭建好的网络进行训练,并保存训练参数,以便下次使用 2018/7/19实现文件调用 -------copyright@GCN------- ''' # 导入文件 import os import numpy as np import tensorflow as tf from PreWork import get_file, get_batch from Model import inference, losses, trainning, evaluation # 变量声明 N_CLASSES = 6 IMG_W = 28 # resize图像,太大的话训练时间久 IMG_H = 28 BATCH_S...
Python
1
bloaderapi::LockResource; unsafe { LockResource(self.data_handle) } } } /** EmbedResource represent an embed resource file (".rc") inside on the executable module. By default (without any arguments), the embed resources wraps the executable. If the embed resources are in a dll, it's also possible to load...
Rust
0
_TIER, )); } buf.push_int(REQ_SOFT_DOLLAR_TIERS); buf.push_int(req.req_id); Ok(DispatchId::Oneshot(req.req_id)) } pub fn decode_soft_dollar_tiers_msg( ctx: &mut Context, buf: &mut BytesMut, ) -> Result<(Response, i32), io::Error> { let req_id = buf.read_int()?; let count = buf...
Rust
0
} {E_data=} {E_data_squared=} {num_runs=}", flush=True) dist.barrier() dist.all_reduce(weight, op=reduceOp) dist.all_reduce(E_data, op=reduceOp) dist.all_reduce(E_data_squared, op=reduceOp) dist.all_reduce(num_runs, op=reduceOp) print(f"{weight=} {E_data=} {E_data_squar...
Python
1
fn run(self) -> IOResult<()> { let Self { admin, workers, listeners, } = self; let admin_thread = thread::Builder::new() .name("admin".to_owned()) .spawn(move || -> IOResult<()> { let mut runtime = Builder::new() ...
Rust
0
# Extracted from ./data/repos/pandas/pandas/core/missing.py """ Logic for the 1-d interpolation. The input indices and yvalues will each be 1-d arrays of the same length. Bounds_error is currently hardcoded to False since non-scipy ones don't take it as an argument. Notes ----- Fills 'yva...
Python
1
_dict( font_dict, pdf_new_name(b"FontScale\x00" as *const u8 as *const i8), pdf_new_number(1.0f64), ); if top_stack < 1024_u32 { let fresh3 = top_stack; top_stack = top_stack.wrapping_add(1); stack[fr...
Rust
0
2) def Save(self): '''save the manually selected calibration points''' from numpy import savetxt saveName = os.path.join(self.folder, self.cam_name+'_manualPoints') savetxt(saveName, self.point_list, fmt='%.1f', delimiter='\t') print('Points sav...
Python
1