text
string
label_name
string
labels
int64
from django.db import models from rest_framework import generics from api.models.user import User from api.models.workspace_user import WorkspaceUser from api.serializers.user import ProjectUserListSerializer class ProjectUserListView(generics.ListAPIView): queryset = User.objects.all() serializer_class = Pr...
Python
1
esult<Self, ConfigError> { Ok(match path { Some(path) => serde_yaml::from_reader(fs::File::open(path)?)?, None => Config::default(), }) } } <filename>workspace/ucx-sys/src/bindgen/structs/ucp_context_attr_field.rs<gh_stars>1-10 // This file is part of ucx. It is subject to th...
Rust
0
_width => r#" var w : real var i : int get i : w "#, wrong_ref_const => r#" const i : int := 1 get i "#, wrong_ref_value => r#" var i : int := 1 get i + i "#, wrong_ref_literal => r#" get 1 "#, ...
Rust
0
>memnix/memnix-discord<filename>src/memnix/utils.rs use rand::{Rng, seq::SliceRandom}; use rand::thread_rng; use core::time::Duration; use serenity::{ client::Context, framework::standard::CommandResult, model::channel::Message, utils::Color, }; use crate::models::mem::MemnixMem; use crate::{api::{answer::fetch_an...
Rust
0
")), }; LogicalPlan::Limit { limit: limit_count as usize, schema: order_by_plan.schema(), input: Box::new(order_by_plan), } } ...
Rust
0
pub totem_confchg_fn: Option<fn(handle: &Handle, ring_id: RingId, member_list: Vec<NodeId>, )>, } /// Modeldata for [initialize], only v1 supported at the moment #[derive(Copy, Clone)] pub enum ModelData { ModelNone, ModelV1 (Model1Data) } /// A handle into the cpg library. Returned f...
Rust
0
` //! - `SyntaxError` //! - `SecurityError` //! - `SignalException` //! - `Interrupt` //! - `StandardError` -- default for `rescue` //! - `ArgumentError` //! - `UncaughtThrowError` //! - `EncodingError` //! - `FiberError` //! - `IOError` //! - `EOFError` //! - `IndexError` //! - `KeyError` //!...
Rust
0
# Copyright (c) Facebook, Inc. and its affiliates. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. # import os import logging import time from datetime import timedelta import pandas as pd class LogFormatter: def __i...
Python
1
assert_eq!(func.block_order, vec![MilBlockId(0)]); assert!(func.blocks.get(&MilBlockId(0)).is_some()); assert!(func.blocks.get(&MilBlockId(1)).is_none()); assert!(cfg.try_get(MilBlockId(0)).is_some()); assert!(cfg.try_get(MilBlockId(1)).is_none()); } #[test] fn test_...
Rust
0
point.y; let node_pos_x = parent_node_x + self.float_frame.pos.x * parent_node_rect.size.width as f32; let node_pos_y = parent_node_y + self.float_frame.pos.y * parent_node_rect.size.height as f32; let node_x = node_pos_x - node_width * self.anchor_point.x; let node_y = node_pos_y - no...
Rust
0
= 2: knob.setKnobStyle( Qwt.QwtKnob.KnobStyle.Sunken ) knob.setMarkerStyle( Qwt.QwtKnob.MarkerStyle.Tick ) #QwtLinearScaleEngine *scaleEngine = new QwtLinearScaleEngine( 2 ) #scaleEngine.setTransformation( new QwtPowerTransform( 2 ) ) #knob.setScaleEngine( sca...
Python
1
mestamps: [ns6], values: \"3\"", "SeriesFrame, tags: _measurement=swap,host=server01,name=disk0,_field=out, type: 1", "IntegerPointsFrame, timestamps: [ns6], values: \"4\"" ]); assert_eq!( expected_frames, actual_frames, ...
Rust
0
class Subscriptor(): def __init__(self): super().__init__() def run(self): for topic in AmotEngine.subscriber_configs['topics']: AmotEngine.attached(self).run(b'Subscribe', topic)
Python
1
= "Option::is_none")] avg_left_pedal_smoothness: Option<f64>, #[serde(skip_serializing_if = "Option::is_none")] avg_left_power_phase: Option<Vec<f64>>, #[serde(skip_serializing_if = "Option::is_none")] avg_left_power_phase_peak: Option<Vec<f64>>, #[serde(skip_serializing_if = "Option::is_non...
Rust
0
set_ylabel(ax, 'Detuning', 'Hz') def plot_ffts(self, ax=None, title='', nyquist_unwrap=False, **kw): if ax is None: ax = plt.gca() if nyquist_unwrap: raise NotImplementedError ax.set_title(title) ffts = np.fft.fft(self.norm_data) freqs = np.ar...
Python
1
cs of this tone. /// All harmonics are added up and scaled to have a total maximum amplitude of one, /// so these maximum amplitudes merely describe the mixing ratio. /// Includes the amplitude for the base frequency for convenience. const HARMONICS_MAX_AMPLITUDES: [f32; 5] = [ 1.0, // fun...
Rust
0
""" ΞΛΩ – Node 7R Directive Composer – Right Hemisphere Transforms tuned right vector into recursion-ready directive trees. Encodes: - Recursion window - Loop control - Symbolic pathing and signatures Broadcasts: 'R7_recursive_directives' """ from data_core.cluster_layer_5_8.cluster_bus import ClusterBus class Nod...
Python
1
) # generate safe spawns (remove balconies) gen_safe_spawns() def force_boss_drop(b=graveward): gen_endboss(boss=b,wave='/Game/Enemies/_Spawning/Slaughters/TechSlaughter/Round1/SpawnOptions_TechSlaughter_Round1Wave1a_Trooper1',wavecode=111,spawners=["Factory_SpawnFactory_OakAI" for i in ran...
Python
1
ides the default profile" )] #[test_case( indoc! {r#" [profile.default] slow-timeout = "30s" [profile.ci] slow-timeout = { period = "60s", terminate-after = 3 } "#}, Ok(SlowTimeout { period: Duration::from_secs(30), terminate_after: None }...
Rust
0
with open("exemple.txt", "r") as fichier: contenu = fichier.read() lignes = contenu.splitlines() mots = contenu.split() caracteres = len(contenu) print(f"Lignes : {len(lignes)}, Mots : {len(mots)}, Caractères : {caracteres}")
Python
1
import numpy as np def get_best_compromise_solution(pareto_solutions): """ Selects the best compromise solution from a set of Pareto-optimal solutions using fuzzy logic. This function applies a fuzzy logic approach to evaluate each solution in the Pareto set by calculating membership degrees for each...
Python
1
external {} } contract foo { function f(I t) public returns (bytes4) { return t.X.selector; } } "#, Target::Solana, ); no_errors(ns.diagnostics); } #[test] fn tx() { let ns = parse_and_resolve( r#" contract fo...
Rust
0
// module; therefore, the value is not truly constant. ctx.scope().add_value(dest, v); } if let Some(v) = m.scope.get_macro(src) { ctx.scope().add_macro(dest, v); } if let Some(v) = m.scope.get_value(src) { ctx.sco...
Rust
0
commit/0bd647e00a25951c39c54173578831f5f81780dc. @unittest.expectedFailure def testJPG( self ) : r = IECore.Reader.create( os.path.join( "test", "IECoreImage", "data", "jpg", "uvMap.512x256.jpg" ) ) self.assertIsInstance( r, IECoreImage.ImageReader ) self.assertTrue( r.isComplete() ) r = IECore.Reader.creat...
Python
1
utConstants = LayoutConstants { height: EXPERT_HEIGHT, width: EXPERT_WIDTH, panel_offset: DEFAULT_DIGIT_PANEL_OFFSET, }; /** * Layout holds all of the information and provides all of the layout information for minesweeper. Therer are const layouts for each * skill level. In theory, the methods should com...
Rust
0
"FIFO byte count: {:?}", length); } Ok(length) } /// Reads exactly count bytes from the fifo. pub fn read_fifo_strict(&mut self, count: u16) -> Result<Vec<u8>, FifoReadError> { let available_bytes = self.read_fifo_byte_count()?; if available_bytes < count { retur...
Rust
0
from utils.file_manager import sc, get_json_dir from models.power_plant import PowerPlantRaw, PowerPlant from utils.file_manager import load_raw_data_from_dict from loguru import logger import json json_dir = get_json_dir() def load_power_plant_from_p4k() -> list[PowerPlant]: """Load a power_plant from a P4K fi...
Python
1
/// /// # Example /// /// Available on the *long_simple_three_mpst_short* examples. /// /// ```ignore /// type EndpointDoneC = MeshedChannelsThree<End, End, RoleEnd, NameC>; /// type EndpointMoreC = MeshedChannelsThree< /// End, /// Send<(), Recv<(), Choose0fromCtoB>>, /// R2A<R2B<RoleB<RoleEnd>>>, /// ...
Rust
0
from setuptools import find_packages, setup package_name = 'dynabot_encoders' setup( name=package_name, version='0.0.0', packages=find_packages(exclude=['test']), data_files=[ ('share/ament_index/resource_index/packages', ['resource/' + package_name]), ('share/' + package_n...
Python
1
tolist()), len(output_ids_without_min_eos_p[0, :].tolist()) ) @require_torch_gpu @slow def test_generate_end_to_end_with_offload(self): input_ids = self.inputs with torch.no_grad(): # standard generation output_with_no_offload = self.model.generate(**input_i...
Python
1
Params(vec![("fg", ":fg").into(), ("hi", "*hi").into()]), ) .await; test_path( &root, "/apples/ab*cde/one/two/three", "/apples/ab*cde/:fg/*hi", Params(vec![("fg", "one").into(), ("hi", "two/three").into()]), ) .await; test_path(&root, "/apples/ab*dde", "/apples/ab*d...
Rust
0
.store_uint(ACCEPT_DEPLOY_OPCODE, 32) .store_uint(query_id, 64) .end_cell() ) @classmethod def build_transfer_nft_body( cls, destination: Address, owner_address: Address, state_init: StateInit, amount: int = 2...
Python
1
# Copyright 2021-2024 Cambridge Quantum Computing Ltd. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law...
Python
1
binedLogger::init(vec![ TermLogger::new(LevelFilter::Debug, Config::default(), TerminalMode::Mixed), WriteLogger::new( LevelFilter::Info, Config::default(), File::create("output.log").unwrap(), ), ]) .unwrap(); } els...
Rust
0
_OBJECTLOCATION: u32 = 1022u32; #[doc = "*Required features: `\"Win32_System_Ole\"`*"] pub const IDC_GP_OBJECTNAME: u32 = 1009u32; #[doc = "*Required features: `\"Win32_System_Ole\"`*"] pub const IDC_GP_OBJECTSIZE: u32 = 1011u32; #[doc = "*Required features: `\"Win32_System_Ole\"`*"] pub const IDC_GP_OBJECTTYPE: u32 = ...
Rust
0
""" salt.cloud.exceptions ~~~~~~~~~~~~~~~~~~~~ Salt cloud related exceptions. :codeauthor: Pedro Algarvio (pedro@algarvio.me) """ import salt.defaults.exitcodes from salt.exceptions import SaltException class SaltCloudException(SaltException): """ Generic Salt Cloud Exception """ clas...
Python
1
pub const OYSTER_DFL: &str = "{BOLD}{USER}{RESET}: {CWD_TOP} {COLOR_ST}>>{RESET} "; pub fn render_prompt(status: i32) -> String { let prompt = match env::var("OYSTER_PROMPT") { Ok(string) => string, Err(_) => OYSTER_DFL.to_string() }; let mut text = Vec::new(); let mut tokens = Ve...
Rust
0
# Copyright (c) OpenMMLab. All rights reserved. from typing import Optional, Union import mmcv from mmcv.runner import load_checkpoint from torch import nn from mmrazor.models import build_algorithm def init_mmseg_model(config: Union[str, mmcv.Config], checkpoint: Optional[str] = None, ...
Python
1
ce_offset, u16); ret } #[inline] pub fn size_for_format(format: u16) -> usize { (format.count_ones() as usize) * u16::PACKED_LEN } #[inline] pub fn smallest_possible_format(&self) -> u16 { let mut ret = 0u16; macro_rules! set_bit_if_nonzero { ($shi...
Rust
0
#!/usr/bin/env python #file: column_parser.py """Parser for column format Works for the following column format: ; COL 1 label ; COL 2 residue ; COL 3 seqpos ; COL 4 alignpos ; COL 5 align_bp ; COL 6 certainty/seqpos_bp Structure part separated b...
Python
1
<div class="p-2 pb-4" > <components::portrait::PortraitComponent {github} /> { components::profile::render(&profile) } <hr class="p-4" /> { self.render_links(links) } </div> }; ...
Rust
0
# For Loop n=int(input("Enter the number up to which you want to print :")) for n in range(0,n): print(n,end = ' ')
Python
1
#!/usr/bin/env python """lispify_ast - returns a tuple representation of the AST Uses 2.5's _ast, not other AST implementations in CPython, since these are not used by the compilation phase. And that's what we're interested in. Since this is a tuple, we can directly compare, and this is going to be handy when compari...
Python
1
ponses_2(): with patch("builtins.input", side_effect=["not a very nice question", "M", "8, it has to be 8", "E", "e"]): try: write_responses() except SystemExit as e: assert str(e) == "\nThank you for playing, had a fun time with you! 😙" def test_write_responses_2(): ...
Python
1
er and counter."] #[inline(always)] pub fn clk_sel_1(self) -> &'a mut W { self.variant(CLK_SEL_A::CLK_SEL_1) } #[doc = "Submodule 0's clock (AUX_CLK) is used as the source clock for the local prescaler and counter. This setting should not be used in submodule 0 as it will force the clock to logi...
Rust
0
Int, SSError> { self.prime.as_ref().ok_or(SSError::PrimeNotSet) } /// Split a secret to shares based on SecretSharing params. pub fn generate_shares(&mut self, secret: &str) -> Result<Vec<String>, SSError> { // Need threshold to be atleast 2. if self.threshold() < 2 { re...
Rust
0
# -*- coding: utf-8 -*- # Copyright (C) 2019 - 2020 by Pedro Mendes, Rector and Visitors of the # University of Virginia, University of Heidelberg, and University # of Connecticut School of Medicine. # All rights reserved. # Copyright (C) 2017 - 2018 by Pedro Mendes, Virginia Tech Intellectual # Properties, Inc.,...
Python
1
#!/usr/bin/env python3 # coding=utf-8 # vim:ts=4:sts=4:sw=4:et # # Author: Hari Sekhon # Date: 2020-03-27 22:34:24 +0000 (Fri, 27 Mar 2020) # # https://github.com/HariSekhon/Nagios-Plugins # # License: see accompanying Hari Sekhon LICENSE file # # If you're using my code you're welcome to connect with me on Link...
Python
1
len(s) as isize); cmd = parseline(&mut s, es)?; peek(&mut s, es, b"\x00" as *const u8 as *const libc::c_char as *mut libc::c_char); if s != es { dprintf(2 as libc::c_int, b"leftovers: %s\n\x00" as *const u8 as *const libc::c_char, s); return Err("synt...
Rust
0
CorpusLoader( "knbc/corpus1", KNBCorpusReader, sorted(fileids, key=_knbc_fileids_sort), encoding="euc-jp", ) print(knbc.fileids()[:10]) print("".join(knbc.words()[:100])) print("\n\n".join(str(tree) for tree in knbc.parsed_sents()[:2])) knbc.morphs2str = lambda mor...
Python
1
# This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. from setuptools import find_packages, setup REQUIREMENTS = [i.strip() for i in open("requirements.txt").readlines()] REQUIREMENTS += [ "CLIP @ git+https://github.com/openai/CLIP.git@a1d071733d71...
Python
1
</div> <button class="btn" onclick="demonstrateES6Syntax()">运行ES6语法示例</button> <h3>2. 模板字符串和默认参数</h3> <div class="code-block"> // 模板字符串 const greeting = (name, age = 18) => { return `你好,${name}!你今年${age}岁了。`; }; // 默认参数 const createUser = (name, role = 'use...
Python
1
# -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. from odoo import models class ReplenishmentReport(models.AbstractModel): _inherit = 'report.stock.report_product_product_replenishment' def _compute_draft_quantity_count(self, product_template_ids, product_var...
Python
1
pub elements: Rc<Vec<Rc<BlockElement>>> } impl Block { /// Creates a new block. pub fn new(is_weighted: bool, protection: Option<BlockProtection>, elements: Vec<Rc<BlockElement>>) -> Self { Block { is_weighted, protection, elements: Rc::new(elements), } } /// Gets the number of el...
Rust
0
chop::removesuffix("", "Once"), ""); assert_eq!( voca_rs::chop::removesuffix("Once upon a time", "None"), "Once upon a time" ); assert_eq!( voca_rs::chop::removesuffix("Once upon a time", "time"), "Once upon a " ); assert_eq!( voca_rs::chop::removesuffix("Once...
Rust
0
lize(images): ''' Normalize the intensity values from [0, 255] into [-1, 1]. images: Image array to normalize. Require each intensity value ranges from 0 to 255. Return normalized image array. ''' return 1.0 * np.array(images) / 255 * 2.0 - 1.0 def unnormalize(images): '...
Python
1
drop(mem::replace(c, SerdeYaml::Sequence(a))); if i == last_key_index { return; } match c { SerdeYaml::Sequence(ref mut a) => { ...
Rust
0
#!/usr/bin/python # -*- coding: UTF-8 -*- # example script that list rise and set azimuth in csv format # from the list of object in file rise_set_list.txt # error messages are directed to stderr # require Skychart version 4.0 # use : python rise_set.py > rise_set.csv import os import sys import socket # default va...
Python
1
); assert_eq!( unsafe { &(*(::std::ptr::null::<CreateRoleStmt>())).options as *const _ as usize }, 16usize, concat!( "Offset of field: ", stringify!(CreateRoleStmt), "::", stringify!(options) ) ); } impl Default for CreateRoleS...
Rust
0
() { let s = r#"{"a":[5 6 ]}"#; let doc: Hocon = dbg!(HoconLoader::new().load_str(dbg!(s))) .expect("during test") .hocon() .expect("during test"); assert_eq!(doc["a"][0].as_i64().expect("during test"), 5); assert_eq!(doc["a"][1].as_i64().expect("during test"), 6); } #[...
Rust
0
::size_of::<CpuManagerCluster>().into(), &get_kernel_manager_cluster().memory_manager, ) .unwrap() }); let cpu_manager = unsafe { &mut *(cpu_manager_address.to_usize() as *mut CpuManagerCluster) }; /* "mov rax, gs:0" is same as "let rax = *(gs as *const u64)"....
Rust
0
) -> ExecResult<(), Self::Error> { // println!("(set-logic {})", logic); write!(self.server.stdin.as_mut().unwrap(), "(set-logic {})", logic)?; Ok(()) } } impl<L, C: Constant, F: Function> Compiler for Internal<L, C, F> { /// Find the ident for the iven syntax symbol. fn ident_of_symbol(&self, sym: &syntax::S...
Rust
0
blue(), style("- tldr").dim().white(), style(util::limit_string(tldr, 30).to_string()).blue(), style("- usage").dim().white(), style(util::limit_string(usage, 30).to_string()).blue(), style("- version").dim().white(), style( version...
Rust
0
RS, _data: &mut InProcessExecutorHandlerData, ) { }*/ impl Handler for InProcessExecutorHandlerData { #[allow(clippy::not_unsafe_ptr_arg_deref)] fn handle(&mut self, _code: ExceptionCode, exception_pointers: *mut EXCEPTION_POINTERS) { unsafe { let data = ...
Rust
0
ampleBorrow<Self::X> + Sized, B2: SampleBorrow<Self::X> + Sized, { UniformCoordinate2D( UniformInt::new(low.borrow().x, high.borrow().x), UniformInt::new(low.borrow().y, high.borrow().y), ) } fn new_inclusive<B1, B2>(low: B1, hi...
Rust
0
shadow_width, self.config .get_color_unchecked(LapceTheme::LAPCE_DROPDOWN_SHADOW), ); ctx.fill( rect, self.config .get_color_unchecked(LapceTheme::EDITOR_BACKGROUND), ); let mut path = self.buffer.path.clone...
Rust
0
false ); assert_eq!( keypair .verify_signature(&message, b"bad sig", None) .is_err(), true ); assert_eq!( keypair .verify_signature(&message, &sig, Some("invalid type")) .is_err(), true ); } <gh_stars>1-10 // ...
Rust
0
e): ndNew = tree.nodes.new(ndTar.bl_idname) ndNew.location = ndTar.location with TryAndPass(): #SimRep'ы. for cyc, sk in enumerate(ndTar.outputs): for lk in sk.vl_sold_links_final: tree.links.new(ndNew.outputs[cyc], lk.to_socket) for cy...
Python
1
# main.py """主预测模块,集成三种模型预测并可视化结果""" import numpy as np import matplotlib.pyplot as plt from Prediction.time_series_prediction.Paragraphs_ARIMA import segmented_arima_predict from Prediction.time_series_prediction.LSTM import predict_next_values, load_data_from_db as lstm_load, preprocess_data from Prediction.time_ser...
Python
1
start_glyph_scale : start.scale, end_glyph_scale : end.scale, angle : options.angle.radians, thickness : options.thickness, start_arrow, end_arrow, dash_length, dash_index, dash_offset : 0, dash_padding : 0...
Rust
0
]) .style(style_primary()) }); let table = Table::new(rows) .header(table_header_style(vec![ "Name", "Status", "Roles", "Version", "Pods", "CPU", "Mem", "CPU %", "Mem %", "Age", ])) .block(block) .highlight_style(style_highlight()) .highlight_symbol(HIGHLIGHT) ...
Rust
0
FactoryClass { _data: [u8; 0], _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>, } pub type GstDynamicTypeFactoryClass = *mut _GstDynamicTypeFactoryClass; #[derive(Copy, Clone)] #[repr(C)] pub struct GstElementClass { pub parent_class: GstObjectClass, pub metadata: gpointer, ...
Rust
0
import logging import time import datetime import re # ---------------------------------------------------------------------- # 格式化日期字符串 # ---------------------------------------------------------------------- FORMAT = "%(asctime)s %(thread)d %(message)s" logging.basicConfig(level=logging.INFO, format=FORMAT, datefm...
Python
1
let val = unsafe { &*self.get() }; val.trace(f); } } impl<A: Finalize> Finalize for Gc<A> { fn finalize(&mut self) { // Already handled by the finalize for A when Gc is finished, // do nothing here. } } impl<A: Finalize> Finalize for GcCell<A> { fn finalize(&mut self) { ...
Rust
0
from typing_extensions import TypedDict from openai import OpenAI from dotenv import load_dotenv from langgraph.graph import StateGraph, START, END import os from openai import AzureOpenAI load_dotenv() client = AzureOpenAI( azure_endpoint = os.getenv("AZURE_OPENAI_ENDPOINT_4o"), api_key=os.getenv("AZURE_OPENAI_...
Python
1
{ pub(crate) fn new(bits: bool) -> Self { HTRGMASKE_R(crate::FieldReader::new(bits)) } #[doc = r"Get enumerated values variant"] #[inline(always)] pub fn variant(&self) -> HTRGMASKE_A { match self.bits { false => HTRGMASKE_A::_0, true => HTRGMASKE_A::_1, ...
Rust
0
tweak: *mut cty::c_int, ); } #[repr(C)] #[derive(Debug)] pub struct notcurses { _unused: [u8; 0], } #[repr(C)] #[derive(Debug)] pub struct ncplane { _unused: [u8; 0], } #[repr(C)] #[derive(Debug)] pub struct ncvisual { _unused: [u8; 0], } #[repr(C)] #[derive(Debug)] pub struct ncuplot { _unus...
Rust
0
w(self, width, height): """将窗口居中。""" screen_width = self.root.winfo_screenwidth() screen_height = self.root.winfo_screenheight() x = (screen_width / 2) - (width / 2) y = (screen_height / 2) - (height / 2) self.root.geometry(f'{width}x{height}+{int(x)}+{int(y)}') if __na...
Python
1
#[test] fn test_arithmetic() { run_boogie(&generate_boogie("test_mvir/test-arithmetic.mvir")); } #[test] fn test_control_flow() { run_boogie(&generate_boogie("test_mvir/test-control-flow.mvir")); } #[test] fn test_func_call() { run_boogie(&generate_boogie("test_mvir/test-func-call.mvir")); } #[test] fn ...
Rust
0
"""EXAMPLE {i}: INPUT: {example.input} CONTEXT: {example.contexts} EXPECTED OUTPUT: {example.expected_output} VERDICT: {{ "verdicts": [ {{"verdict": "{example.verdicts[0]}", "reason": "{example.reasons[0]}"}}, {{"verdict": "{example.verdicts[1]}", "reason": "{example.reasons[1]}"}}, ...
Python
1
nect_gtk_theme_name_notify(move |_| self.set_source_view_scheme_name()); } fn set_source_view_scheme_name(&self) { let scheme_name = self.scheme_name(); if scheme_name != self.account.scheme_name.get() { self.account.scheme_name.set(scheme_name); if let Some(ref scheme...
Rust
0
, b] => a == b, _ => false, }) } fn has_no_naughty_strings(cs: &[u8]) -> bool { cs.windows(2).all(|w| !NAUGHTY.contains(&w)) } fn has_pair_of_letters_twice(cs: &[u8]) -> bool { match cs { [] => false, [a, b, rest @ ..] if rest.windows(2).any(|w| w == [*a, *b]) => true, [_, ...
Rust
0
{ println!("Writing {} entries", CACHE_SIZE); { let trans: Transaction = conn.transaction() .expect("Could not start transaction"); let query: &'static str = INSERT; ...
Rust
0
a=int(input("enter the value of a: ")) match a: case 0: print("given number is zero") case 100: print("given number is hundred") # case _ if a!=100: # print("given number is not equal to 100") # case _ if a!=200: # print(a," is not equal to 200") case _: print(...
Python
1
# Copyright (c) 2023 ING Analytics Wholesale Banking # # 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 limitation the rights to # use, copy, modify, mer...
Python
1
inated ] } if end_offset < len(vocabularies): response["NextToken"] = str(end_offset) if state_equals: response["Status"] = state_equals return response def list_medical_vocabularies( self, state_equals: str, name_contains: str, next_token...
Python
1
} fn get_f32_generic(&self, m: &Message) -> f32 { match self.get_value_option(message_down_cast(m)) { Some(ReflectValueRef::F32(v)) => v, Some(_) => panic!("wrong type"), None => 0.0, // TODO: check type } } fn get_f64_generic(&self, m: &Message) ->...
Rust
0
secret_word = "mouse" ctr = 0 print("\nWelcome to the word guessing game!\n") underscore = "" for x in range(len(secret_word)): underscore += "_ " print(f"Hint: {len(secret_word)} letters") while True: user_guess = input("What is your guess? ").lower() ctr += 1 if user_guess == secret_word: ...
Python
1
ilder::TransactionBuilder, types::LocalAccount}; use aptos_transaction_builder::aptos_stdlib; use aptos_types::{ account_address::AccountAddress, account_config::aptos_root_address, chain_id::ChainId, }; use forge::{AptosContext, AptosTest, Result, Test}; pub struct ErrorReport; impl Test for ErrorReport { fn...
Rust
0
import sys def BROKEN(A, S, B, PRV): if S == "+":return A+B-PRV elif S == "-":return (A-B)*PRV elif S == "*":return (A*B)**2 elif S == "/": if A%2 == 0:return A//2 elif A%2 == 1:return (A+1)//2 def main(): PRV = 1 for _ in range(int(sys.stdin.readline())): X, S, Y = map(s...
Python
1
ret)?; write_varint(&self.hand, &mut ret)?; write_f32(&self.x, &mut ret)?; write_f32(&self.y, &mut ret)?; write_f32(&self.z, &mut ret)?; Ok(ret) } pub fn new(location: (i32, i32, i32), face: i32, hand: i32, x: f32, y: f32, z: f32) -> ServerboundPacket { Serverbou...
Rust
0
", array_slice); assert_eq!(array_slice, &[1, 2]); } fn take_ownership(s: String) { println!("take ownership : {}", s); } fn takes_and_gives_back(s: String) -> String { s } fn copy_nodrop_value(i: i32) { println!("copy no drop value : {}", i) } fn calculate_length(s: &String) -> usize { s.len() ...
Rust
0
0xcf_u8, 0xcd_u8, 0x90_u8, 0x87_u8, 0x97_u8, 0xb2_u8, 0xdc_u8, 0xfc_u8, 0xbe_u8, 0x61_u8, 0xf2_u8, 0x56_u8, 0xd3_u8, 0xab_u8, 0x14_u8, 0x2a_u8, 0x5d_u8, 0x9e_u8, 0x84_...
Rust
0
(Rc::clone(self.leaf_buffer.get(key).unwrap())) } /** put a leaf page to buffer pool, add also write it to disk */ pub fn put_leaf_page( &mut self, file: &mut File, page_id: Key, page: Rc<RefCell<BTreeLeafPage>>, ) { self.leaf_buffer.insert(page_id, Rc::c...
Rust
0
break print("skip_cnt {}".format(skip_cnt)) print("Counter not_equal_cnt {}".format(Counter(not_equal_cnt).most_common())) # Counter not_equal_cnt [(1, 150), (2, 7), (4, 1)] for clip_length==1.5 def main_convert(): import argparse parser = argparse.ArgumentParser() parser.add_argument("--src...
Python
1
40.192.168.127.12.1.10"; #[doc = "*Required features: `\"Win32_Security_Cryptography\"`*"] pub const szOID_INFOSEC_mosaicSignature: &str = "2.16.840.192.168.127.12.1.2"; #[doc = "*Required features: `\"Win32_Security_Cryptography\"`*"] pub const szOID_INFOSEC_mosaicTokenProtection: &str = "2.16.840.192.168.127.12.1.8";...
Rust
0
in(self): with support.CleanImport('marshal'): import marshal imp.reload(marshal) def test_with_deleted_parent(self): # see #18681 from html import parser html = sys.modules.pop('html') def cleanup(): sys.modules['html'] = html sel...
Python
1
:skip] let aff = Projection::from_matrix([ 1.0, 0.0, 1.0, 0.0, 1.0, 1.0, 0.0, 0.0, 1.0 ]).unwrap(); let translated_bicubic = warp(&image, &aff, Interpolation::Bicubic, Luma([0u8])); assert_pixels_eq!(translated_bicubic, expected); } #[bench] ...
Rust
0
import numpy as np import math import matplotlib.pyplot as plt import scipy.signal as sig def add_array(xzm, center, n_elements, pitch, dx, dz, angle=0, elem_size=1): idx = np.zeros((2, n_elements), dtype=int) idx[0, :] = center[0]/dx length_array = (n_elements - 1)*pitch/dx + elem_size idx[1, :] = np...
Python
1
#[inline] pub fn remove_in_radius_by<F>( &mut self, point: Point, radius: f32, mut pred: F, ) -> Vec<T> where F: FnMut(Entry<T>) -> bool, { use rustc_hash::FxHashSet; let in_radius = self.find_in_radius(point, radius); let mut to_re...
Rust
0