text
string
label_name
string
labels
int64
( base_rate: Ratio, jump_rate: Ratio, full_rate: Ratio, target_utilization: Percent, ) -> Option<JumpModel> { let model = Self { base_rate, jump_rate, full_rate, target_utilization }; if model.base_rate <= Self::MAX_BASE_RATE && model.jump_rate <= Self::MAX_JUMP_RATE && model.full_rate <= Self::MAX_...
Rust
0
tes, **{'delete-catalog': 'off', 'name': 'changed'}) response = self.client.post(self.url, new_attributes) self.mock_catalog_endpoint(new_attributes, catalog_id=self.catalog.id) self.assertRedirects(response, reverse('api_admin:catalog-edit', kwargs={'catalog_id': self.catalog.id})) @httpre...
Python
1
from datetime import datetime from pandas.tseries.holiday import ( AbstractHolidayCalendar, USMartinLutherKingJr, USMemorialDay, ) def test_no_mlk_before_1986(): # see gh-10278 class MLKCalendar(AbstractHolidayCalendar): rules = [USMartinLutherKingJr] holidays = MLKCalendar().holiday...
Python
1
SRCW::AUXIO9) } #[doc = "AUX_EVCTL:EVSTAT0.AUXIO8"] #[inline] pub fn auxio8(self) -> &'a mut W { self.variant(CAPT_SRCW::AUXIO8) } #[doc = "AUX_EVCTL:EVSTAT0.AUXIO7"] #[inline] pub fn auxio7(self) -> &'a mut W { self.variant(CAPT_SRCW::AUXIO7) } #[doc = "AUX_EVCTL...
Rust
0
_branches = root.branches as usize; btree.write_chunk(&index[..1])?; // Write the header with all the necessary information. let mut buf = [0; HEADER_SIZE]; BTreeHeader::new(length as u64, node_offset).to_buf(&mut buf); btree.file.seek(SeekFrom::Start(0))?; btree.file.wr...
Rust
0
.field("_ges_reserved", unsafe { &self._ges_reserved }) .field("abi", unsafe { &self.abi }) .finish() } } #[repr(C)] #[derive(Copy, Clone)] pub union GESVideoSourceClass_ABI { pub _ges_reserved: [gpointer; 4], pub abi: GESVideoSourceClass_ABI_abi, } impl ::std::fmt::Deb...
Rust
0
e } => identifier.span().join_span(value), TableOption::MinRows { identifier, value } => identifier.span().join_span(value), TableOption::Password { identifier, value } => identifier.span().join_span(value), TableOption::RowFormat { identifier, value } => identifier.span().join_span(...
Rust
0
15 => InterfaceDescriptionOption::IfHardware(Cow::Borrowed(std::str::from_utf8(slice)?)), 2988 | 19372 => InterfaceDescriptionOption::CustomUtf8(CustomUtf8Option::from_slice::<B>(code, slice)?), 2989 | 19373 => InterfaceDescriptionOption::CustomBinary(CustomBinaryOption::from...
Rust
0
""" Write a python function to move all zeroes to the end of the given list. assert move_zero([1,0,2,0,3,4]) == [1,2,3,4,0,0] """ def move_zero(arr): """ :param arr: list :return: list """ zero_index = 0 for i in range(len(arr)): if arr[i] == 0: zero_index += 1 for i in...
Python
1
} /// Fetch a card by its set and number. /// /// # Examples /// ```rust /// use scryfall::card::Card; /// match Card::set_and_number("vma", 4) { /// Ok(card) => assert_eq!(card.name, "Black Lotus"), /// Err(e) => panic!("{:?}", e), /// } /// ``` pub fn set_and_numbe...
Rust
0
# Field: Honnou-ji : Honnou-ji Eastern Wall Exterior (807050201) # Quest: Honnou-ji Infiltration 2 (57437) # Author: Tiger if sm.hasQuest(57437): # Honnou-ji Infiltration 2 if sm.getFieldID() == 807050201: # Honnou-ji Eastern Wall Exterior sm.lockInGameUI(True, True) sm.showEffect("Effect/Directio...
Python
1
f cache_position[0] == 0: model_inputs["images"] = images model_inputs["images_seq_mask"] = images_seq_mask model_inputs["images_spatial_crop"] = images_spatial_crop return model_inputs def _reorder_cache(self, past_key_values: tuple[tuple[torch.Tensor]], beam_idx: torc...
Python
1
g to those terms. use ethvm_internals; // TODO Unimplemented! pub type ActionFunc = fn(); ethvm_internals::create_action_groups!( ACTIONS_GROUP_DEFAULT, [ |STOP| { println!("[Action] STOP"); }, |ADD| { println!("[Action] ADD"); }, ], { p...
Rust
0
fn query_all() { let mut world = World::new(); let e = world.spawn(("abc", 123)); let f = world.spawn(("def", 456)); let ents = world .query::<(&i32, &&str)>() .iter() .map(|(e, (&i, &s))| (e, i, s)) .collect::<Vec<_>>(); assert_eq!(ents.len(), 2); assert!(ents....
Rust
0
quires_grad) avg_time = 0 avg_mem = 0 import time with torch.no_grad(): for i in range(100): start_time = time.time() outputs = conv_3x3(feats) outputs = baseoc_infer(outputs) torch.cuda.synchronize() avg_time += (time.time() - start_...
Python
1
from junjo import Node from base.gemini_tool import GeminiTool from base.sample_workflow.sample_subflow.nodes.create_fact_node.prompt import create_fact_prompt from base.sample_workflow.sample_subflow.store import SampleSubflowStore class CreateFactNode(Node[SampleSubflowStore]): """Workflow node that creates a ...
Python
1
Tic += self.ticPeriod @staticmethod def thinkSuits(suitList, startTime, ticFreq = MazeGameGlobals.SUIT_TIC_FREQ): curT = globalClock.getFrameTime() - startTime curTic = int(curT * float(ticFreq)) suitUpdates = [] for i in range(len(suitList)): updateTics = suitList[i...
Python
1
d_device) def prop_selected(self, id_: int, name: str, val: str) -> None: '''Set selected device property. Args: id_: Property ID. name: Property name. val: Property value. ''' self.model.set_selected_prop(id_, name, val) self.prop_list....
Python
1
turn await send_store_hours(request, responder) form_store_phone = { "entities": [ FormEntity( entity="store_name", responses="Which store would you like to know about?", retry_response="Sorry, I did not get you. " "Which store would you like to know about?"...
Python
1
two Match items within one file will have // the same offset. items.sort_unstable_by_key(|i| i.offset()); // Iterate over the items in _reverse_ order -> this is so offsets can stay the same even though we're making // changes to the string. let mut did_skip_replacement = false; for (i, item) i...
Rust
0
from rpython.translator.tool.cbuild import ExternalCompilationInfo from rpython.rtyper.tool import rffi_platform as platform from rpython.rtyper.lltypesystem import rffi, lltype from hippy.tool.platform import get_gmake import subprocess import py LIBDIR = py.path.local(__file__).join('..', 'lib', 'md/') subprocess.c...
Python
1
(alignment_start) .set_alignment_span(alignment_span) .set_record_count(record_count) .set_record_counter(record_counter) .set_block_count(block_count) .set_block_content_ids(block_content_ids) .set_embedded_reference_bases_block_content_id(embedded_reference_bases_block_...
Rust
0
import os def get_resource_path(): return os.path.dirname(__file__)
Python
1
key_value = key_fn(parameters, one_row, the_draws, the_random_variables) key_int = jnp.asarray(key_value, dtype=jnp.int32) matches = key_array == key_int branch_index = jnp.argmax(matches) result = jax.lax.switch( branch_index, ...
Python
1
beacon_flat = array_ref![data_flat, offset, SECP256K1_PUBLIC_KEY_LENGTH]; #[allow(clippy::ptr_offset_with_cast)] let new_beacon = Secp256k1Pubkey::new(beacon_flat); beacons.push(new_beacon); offset += SECP256K1_PUBLIC_KEY_LENGTH; } Ok(IncognitoProxy { ...
Rust
0
rdBook => { if !self.some_full_screen_object_is_appeared() { self.slide_appear_record_book(t); self.record_book_is_staged = true; return true; } } OnDeskType::ManualBook => { ...
Rust
0
from enum import StrEnum __all__ = ('MeasurementUnit',) class MeasurementUnit(StrEnum): QUANTITY = 'Quantity' KILOGRAM = 'Kilogram' LITER = 'Liter' METER = 'Meter'
Python
1
import grok @grok.subscribe() def subscriber(): pass
Python
1
n!(); println!("length: {}", path.len()); } None => println!("No path found!"), } } #[cfg(test)] mod tests { use super::*; const START: Point = Point { x: 0, y: 0 }; const END: Point = Point { x: 3, y: 3 }; fn read_moves(s: &str) -> Vec<Move> { use Move::*; ...
Rust
0
from ..Responses.Response import Response class CORSMiddleware: def __init__(self, allowed_origins="*"): self.allowed_origins = allowed_origins.encode() async def __call__(self, scope, receive, send, next_middleware): async def custom_send(event): if event["type"] == "http.response...
Python
1
elf.ui.precision_Slider.sliderMoved.connect(self.argu_update_precision) self.ui.precision_Slider.valueChanged.connect(self.argu_update_precision) self.ui.type_Box.currentIndexChanged.connect(self.algorithm.argu_update_rna_type) # ... existing code ... if __name__ == "__main__": # 创建 QApplication ...
Python
1
ocket-rust use crate::error::RSocketError; use crate::frame::{self, Frame}; use crate::payload::{Payload, SetupPayload, SetupPayloadBuilder}; use crate::runtime::{DefaultSpawner, Spawner}; use crate::spi::{ClientResponder, Flux, Mono, RSocket}; use crate::transport::{ self, Acceptor, ClientTransport, DuplexSocket, ...
Rust
0
ection+='_'+algo if(quality =='') and (algo==''): RefSelection+='_ootb' print('After RefSelection: ' + RefSelection) GlobalTagUse=IdealTagUse do_validation(idealsamples, IdealTag, quality , algo) RefSelection=StartupReferenceSelection print('Before StartupRefS...
Python
1
# dataclasses - O que são dataclasses? # O módulo dataclasses fornece um decorador e funções para criar métodos como # __init__(), __repr__(), __eq__() (entre outros) em classes definidas pelo # usuário. # Em resumo: dataclasses são syntax sugar para criar classes normais. # Foi descrito na PEP 557 e adicionado na vers...
Python
1
add_attribute("hook", addr)) } #[cfg_attr(not(feature = "library"), entry_point)] pub fn query(deps: Deps, env: Env, msg: QueryMsg) -> StdResult<Binary> { match msg { QueryMsg::GetConfig {} => to_binary(&query_config(deps)?), QueryMsg::StakedBalanceAtHeight { address, height } => { to_b...
Rust
0
"Javascript", "Java", "Cplusplus", "PHP", "Csharp", "HTML", "CSS", "SQL", "Go", "R", "Swift", "Kotlin", "Flutter", "Dart", "JSON", ]) bahasa = ' '.join(input_bahasa) input_role = st.multi...
Python
1
1", &self._gtk_reserved1) .field("_gtk_reserved2", &self._gtk_reserved2) .field("_gtk_reserved3", &self._gtk_reserved3) .field("_gtk_reserved4", &self._gtk_reserved4) .finish() } } #[repr(C)] pub struct GtkTreeModelFilterPrivate(c_void); impl ::std::fmt::Debug for GtkTreeModelF...
Rust
0
_image(self, buf: &mut [u8]) -> ImageResult<()> { assert_eq!(u64::try_from(buf.len()), Ok(self.total_bytes())); dcp::initialize(); if self.picture.pixel_layout() != PixelLayout::I400 { let pixel_format = match self.picture.pixel_layout() { PixelLayout::I400 => todo!...
Rust
0
32::consts::FRAC_PI_2); assert_nearly_eq!(m * Point::new(1.0, 0.0, 0.0), &Point::new(0.0, -1.0, 0.0)); } #[test] fn rotation_from_vector_to_vector() { let m = Matrix4::rotation_from_vector_to_vector( Vector3::new(1.0, 0.0, 0.0), Vector3::new(0.0, 0.0, 1.0), )...
Rust
0
se rand_core::RngCore; use std::fmt; use std::num::NonZeroU64; /// Divides a set of samples into 2 classes. #[derive(Debug, Copy, Clone)] pub enum PairClass { /// Class 1 of 2. A, /// Class 2 of 2. B, } /// Divides a set of samples into 4 classes. #[derive(Debug, Copy, Clone)] pub enum QuadClass { ...
Rust
0
from mnoptical.topo.linear import LinearTopology operational_power_dBm = 0 net = LinearTopology.build(op=operational_power_dBm, non=2) # Retrieve line terminals (transceivers) from network lt_1 = net.name_to_node['lt_1'] lt_2 = net.name_to_node['lt_2'] num_wavelengths = 3 ports = channel_indexes = list(range(1, ...
Python
1
#!/usr/bin/env python # -*- coding:utf-8 -*- class VulnChecker(VulnCheck): def __init__(self, ip_and_port_list): self._name = 'jboss_readonly' self.info = "Check if the JBoss path /invoker/readonly exists for CVE-2017-12149" self.keyword = ['all', 'jboss', 'rce', 'cve_2017_12149', 'web', 'i...
Python
1
// (y, x, z) [[0, 1, 0], [1, 0, 0], [0, 0, 1]], [[0, 1, 0], [-1, 0, 0], [0, 0, 1]], [[0, 1, 0], [1, 0, 0], [0, 0, -1]], [[0, 1, 0], [-1, 0, 0], [0, 0, -1]], [[0, -1, 0], [1, 0, 0], [0, 0, 1]], [[0, -1, 0], [-1, 0, 0], [0, 0, 1]], [[0, -1, 0], [1, 0, 0], [0, 0, -1]], [[0, -1, 0], [-1, 0, ...
Rust
0
] pub uca1irtctl: UCA1IRTCTL, #[doc = "0x13 - USCI A1 IrDA Receive Control"] pub uca1irrctl: UCA1IRRCTL, _reserved3: [u8; 10usize], #[doc = "0x1e - USCI A1 Interrupt Vector Register"] pub uca1iv: UCA1IV, } #[doc = "USCI A1 Control Register 1"] pub struct UCA1CTL1 { register: ::vcell::Volatil...
Rust
0
Associativity::Right } else { Associativity::Left } } } #[derive(Debug)] pub enum Expr { /// Number literal. Num(NumLit), Str(StrLit), UnOp(UnaryOp), BinOp(BinaryOp), Assign(AssignOp), AccessField(AccessField), Variable(VarAccess), } /// Numb...
Rust
0
# Copyright (C) 2010 Savoir-faire Linux (<http://www.savoirfairelinux.com>). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). from odoo import fields, models class MgmtsystemHazardType(models.Model): _name = "mgmtsystem.hazard.type" _description = "Type of Hazard" company_id = fields.Many...
Python
1
)) } } } impl<DataType, DeserializerType, FormatType> VariantTrait<DataType, FormatType> for DeserializerType where FormatType: crate::format::Trait, DeserializerType: crate::deserializer::identity::Trait<DataType, FormatType> { fn context_variant(variant_name_ref: &str) -> Context { ...
Rust
0
color channels # BGR to RGB, HWC to CHW, numpy to tensor img_gt, img_lq = img2tensor([img_gt, img_lq], bgr2rgb=True, float32=True) # random color jitter (pytorch version) (only for lq) if self.color_jitter_pt_prob is not None and (np.random.uniform() < self.color_jitter_pt_prob): ...
Python
1
#! /usr/bin/env python """ Description: Example python script plot 3D penetration depth for a folder of EDI files input = path2edifolder CreationDate: 23/03/2018 Developer: fei.zhang@ga.gov.au Revision History: LastUpdate: 23/03/2018 FZ LastUpdate: 23/10/2018 FZ """ import glo...
Python
1
json!({ "foo": "bar" }), /// ResponseStatus::OK, /// OutgoingShortTermTimingProperties::until_now(start_timestamp), /// ); /// ``` pub fn to_response<R>( &self, data: R, status: ResponseStatus, timing: OutgoingShortTermTimingProperties, api_versio...
Rust
0
from spm._runtime import Runtime def spm_voice_ff(*args, **kwargs): """ Decomposition at fundamental frequency FORMAT [xY] = spm_voice_ff(Y,FS) Y - timeseries FS - sampling frequency requires the following in the global VOX structure: ...
Python
1
import torch torch.set_num_threads(1) from espnet2.bin.asr_inference import Speech2Text import soundfile import resampy from espnet_model_zoo.downloader import ModelDownloader, str_to_hash from utils.data_io import parse_yaml class ImsASR: def __init__(self, model_path, device, ctc_weight=0.2, utt_start_token='...
Python
1
, } impl EarlyReflectionTapDelayLine { pub fn new(delay: f32) -> EarlyReflectionTapDelayLine { let delay_samples = SAMPLE_RATE * delay; EarlyReflectionTapDelayLine { write_position: 0, read_position: 0, buffer: [0.0; MAX_BUFFER_SIZE], delay_samples: f...
Rust
0
# Pyrogram - Telegram MTProto API Client Library for Python # Copyright (C) 2017-present Dan <https://github.com/delivrance> # # This file is part of Pyrogram. # # Pyrogram 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 F...
Python
1
as p_cwe2x8jt7, ya74lebm_4s as clehvnb2h8_, x9tmx9rm5dg, fmqvke2hjju, l4q4qi6ddp7 as xab8hluaqi9 '# hatchet_canister_header -> machines_battleships_unions' (xz4nk6ynuro): '' = pvrn29dc44t whpjnx283lf = False '# hatchet_canister_header -> machines_battleships_unions' return diel0pepmmj @g_rghavv2n3(...
Python
1
_tau_to_pole() { let pole = OnePole::tau_to_pole(0.9, 48000.); assert_eq!(pole, 0.999884247); } #[test] fn test_one_pole() { let mut filter = OnePole::new(POLE); for item in RESULTS.into_iter() { let out = filter.process(INPUT); assert!(out == item); ...
Rust
0
name, confidence=conf) session.add(detection) session.commit() # 更新最新畫面(含標註) with lock: latest_frame = result.plot() # Alert Worker 線程 def alert_worker(): print("alert_worker 線程正在運行") while True: ...
Python
1
import os from openai import AzureOpenAI from backend import Secret_Manager from backend import ADO_Utilities def create_azure_openai_client(azure_endpoint, api_key, api_version): print("Creating Azure OpenAI Client.") return AzureOpenAI( azure_endpoint=azure_endpoint, api_key=api_key, ...
Python
1
beg: u8, end: u8, ) -> std::thread::JoinHandle<Result<u8, isha1::Error>> { let mut bad_sig_t = bad_sig.clone(); let hm = hmac.clone(); let t = text.clone(); std::thread::spawn(move || { if inner_timing_loop_short(hm, &mut bad_sig_t, t.as_ref(), i, beg, end) { return Ok(...
Rust
0
liumDisplay, EventLoop<()>), Error> { debug!("Initialize Glium Display adapter."); let event_loop = EventLoop::new(); let monitors: Vec<MonitorHandle> = event_loop.available_monitors().collect(); if monitors.is_empty() { return Err(Error::new(ErrorKind::Other, ...
Rust
0
nit_2d = mode == b"2" if init_2d: calib_method = "HMD_Calibration" else: calib_method = "HMD_Calibration_3D" ipc_pub.notify({"subject": "start_plugin", "name": calib_method}) ipc_pub.notify({"subject": "pupil_detector.set_enabled", "value"...
Python
1
_4() { run_test( &Instruction { mnemonic: Mnemonic::CVTSI2SS, operand1: Some(Direct(XMM7)), operand2: Some(IndirectScaledDisplaced( RSI, Two, 1287331239, Some(OperandSize::Dword), None, ...
Rust
0
rget, data.as_slice())?; let erased: Box<dyn ::prost_wkt::MessageSerde> = Box::new(target); Ok(erased) } fn encoded(&self) -> Vec<u8> { let mut buf = Vec::new(); buf.reserve(::prost::Message::encoded_len(self)); ::prost::Message::encode(self, &...
Rust
0
import sqlite3 from swiggy_analytics.constants import DB_FILEPATH from swiggy_analytics.exceptions import SwiggyDBError from swiggy_analytics.queries import (create_items_table_query, create_orders_table_query, insert_items_query, insert_order...
Python
1
########################################################################## # # Copyright (c) 2008-2013, Image Engine Design Inc. All rights reserved. # Copyright (c) 2011, John Haddon. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided ...
Python
1
import random import nuke import os def map(prompt,thenode): prompt['3']["inputs"]["seed"]=thenode["smp_seed"].getValue() if thenode["smp_seed"].getValue() > 0 else random.randrange(0, 100000000) prompt['3']["inputs"]["steps"]=thenode["smp_steps"].getValue() prompt['3']["inputs"]["cfg"]=thenode["smp_cfg"].g...
Python
1
(format!("get_bit({}) of unset bit is true", i)); } } } // Current bit should be set if !get_bit(u32::from(bit)) { return Err("get_bit of set bit is false".to_string()); } last_bit = Some(bit); } ...
Rust
0
for _ in 0..cfg.operations_per_worker() { let _ = pool.get().await; } }) }) .collect(); for join_handle in join_handles { join_handle.await.unwrap(); } } fn criterion_benchmark(c: &mut Criterion) { let mut group = c.ben...
Rust
0
("--pre", "bump_type", flag_value="c") @click.option("--post", "bump_type", flag_value="b") @click.option("--patch", "bump_type", flag_value="p") @click.option("--minor", "bump_type", flag_value="m") @click.option("--major", "bump_type", flag_value="M") def bump(bump_type: t.Optional[str]): packages = _find_package...
Python
1
rmal_(m.weight, std=.02) nn.init.constant_(m.bias, 0) def init_weights(self, pretrained=None): """Initialize the weights in backbone. Args: pretrained (str, optional): Path to pre-trained weights. Defaults to None. """ def _init_weights(m): ...
Python
1
:Icmpv6MessageKind; use crate::protocols::tcp::TcpControlBits; use crate::protocols::{ProtocolHeader, ProtocolNumber, ProtocolPacket}; use crate::Addr; pub mod collector; pub mod evaluate; use std::io::Write; use evaluate::PacketStatus; use tokio::task::JoinHandle; use crate::bpf::filter::{FilterBuilder, FilterOpti...
Rust
0
nch = true //! ``` //! //! `post_build.rs` //! ```rust //! #[cfg(any(target_os = "windows", target_os = "macos"))] //! fn main() -> Result<(), Box<dyn std::error::Error>> { //! fm_plugin::post_build::bundle_plugin()?; //! Ok(()) //! } //! # #[cfg(target_os = "linux")] //! # fn main() -> Result<(), Box<dyn std::...
Rust
0
from turtle import Turtle SCOREBOARD_POSITION = (-200, 240) FONT = ("Courier", 24, "normal") class Scoreboard(Turtle): def __init__(self): self.current_level = 1 super().__init__() self.hideturtle() self.penup() self.goto(SCOREBOARD_POSITION) self.write(f"Level: {se...
Python
1
from .build import build_model, MODEL_REGISTRY # isort:skip from .umeml import umeml
Python
1
x: Tensor) -> Tensor: # aux1: N x 512 x 14 x 14, aux2: N x 528 x 14 x 14 x = F.adaptive_avg_pool2d(x, (4, 4)) # aux1: N x 512 x 4 x 4, aux2: N x 528 x 4 x 4 x = self.conv(x) # N x 128 x 4 x 4 x = torch.flatten(x, 1) # N x 2048 x = F.relu(self.fc1(x), inpl...
Python
1
rchical Rows as merged cells. inf_rep : str, default `'inf'` representation for np.inf values (which aren't representable in Excel) A `'-'` sign will be added in front of -inf. style_converter : callable, optional This translates Styler styles (CSS) into ExcelWriter styles. Defau...
Python
1
() { struct Test(&'static str, f64); let t = Test; let tests = [ t("let a = 5; a;", 5.0), t("let a = 5 * 5; a;", 25.0), t("let a = 5; let b = a; b;", 5.0), t("let a = 5; let b = a; let c = a + b + 5; c;", 15.0), ]; for (_, test) i...
Rust
0
CENSE-2.0> // respectively. // // Portions of documentation are copied from the LGPL 2.1+ licensed PulseAudio C headers on a // fair-use basis, as discussed in the overall project readme (available in the git repository). //! Global definitions. use std::os::raw::c_void; use crate::time::{Timeval, MicroSeconds}; pub...
Rust
0
r+cot (alternate cot template) text2answer_cot_template = convert_to_instruction(all_caption_data, prompt_image=False, prompt_text=True, prompt_type="text2ans", cot=True, image_RGB=False, cot_alt_template=True) with open(os.path.join(output_dir, 'text2answer+cot-template.json'), 'w') as f: json.dump(tex...
Python
1
pe(signature), signature) # pprint(dir(signature)) print(type(signature.parameters), signature.parameters) for param_name, param in signature.parameters.items(): print(type(param), param, param.name, param.default) # pprint(dir(param)) get_signature = inspect.signature(requests.get) for param_name, param in ge...
Python
1
# This file is part of the DiscoPoP software (http://www.discopop.tu-darmstadt.de) # # Copyright (c) 2020, Technische Universitaet Darmstadt, Germany # # This software may be modified and distributed under the terms of # the 3-Clause BSD License. See the LICENSE file in the package base # directory for details. from ...
Python
1
import autograd.numpy as np from rdkit import Chem from util import one_of_k_encoding, one_of_k_encoding_unk def atom_features(atom): return np.array(one_of_k_encoding_unk(atom.GetSymbol(), ['C', 'N', 'O', 'S', 'F', 'Si', 'P', 'Cl', 'Br', 'Mg', 'Na', ...
Python
1
fn span(&self) -> Span { match self { Expr::Id(v) => v.span(), Expr::Fn(v) => v.span(), Expr::FnCall(v) => v.span(), Expr::Binary(v) => v.span(), Expr::LitBoolean(v) => v.span(), Expr::LitNumber(v) => v.span(), Expr::LitString(...
Rust
0
p['efficiency_score'] for p in list(self.performance_history)[-20:] ]) if recent_efficiency < 0.6: self.config.optimize_for_speed() optimizations_applied.append("Config optimized for speed") final_memory = self._get_memory_usage() ...
Python
1
#! python3 # password breaker - will break into any encrypted PDF document that has # a password that is one english word """ Using the file-reading skills you learned in Chapter 8, create a list of word strings by reading this file. Then loop over each word in this list, passing it to the decrypt() method. If this met...
Python
1
gn, note, flair['odd']) lecture+=1 # elif lecture_date in course.extralab: # assign = course.assignments_labs[lecture_date] # printLecture("L" + str(lab+1), lecture_date, course.labs[lab], assign, note, flair['lab']) # lab+=1 elif course.lecture_days[lecture_date.weekday()]: if course....
Python
1
en truncated to 0 and shifted by a factor of -log(k). This function can take multiple shift magnitudes, each of which is performed and saved separately. :param pathtoraw: The path to the raw co-occurrence matrix. :param corpusname: The name of the corpus. :param shifts: A tuple contain...
Python
1
_amount = round((qpay_amount / 1000000000000000000 * float(coinprice)), 2) #pay_amount = qpay_amount*int(float(coinprice))/1000000/1000000/10000000 elif qpay_amount == 0: pay_amount = int(float(coinprice))/1000000 print(pay_amount) get_user = get_userx(user_id=call.from_user.id) #if pay...
Python
1
_error_panic_hook` feature is enabled, we can call the // `set_panic_hook` function at least once during initialization, and then // we will get better error messages if our code ever panics. // // For more details see // https://github.com/rustwasm/console_error_panic_hook#readme #[cfg(feature ...
Rust
0
TypeId}; use std::cell::{Cell, RefCell}; use std::collections::HashMap; use std::pin::Pin; use std::sync::atomic::{AtomicUsize, Ordering}; use std::task::{Context, Poll}; use std::{fmt, thread}; use futures_channel::mpsc::{unbounded, UnboundedReceiver, UnboundedSender}; use futures_channel::oneshot::{channel, Cancele...
Rust
0
let next = self.next.take(); self.next = next.as_ref().and_then(|next| { Some(match next { WalkEvent::Enter(slot) => match slot { SyntaxSlot::Empty { .. } | SyntaxSlot::Token(_) => { WalkEvent::Leave(slot.clone()) } ...
Rust
0
# Tushar's Birthday Bombs # https://www.interviewbit.com/problems/tushars-birthday-bombs/ # # It’s Tushar’s birthday today and he has N friends. Friends are numbered [0, 1, 2, …., N-1] # and i-th friend have a positive strength S(i). Today being his birthday, his friends have # planned to give him birthday bombs (kicks...
Python
1
if model_id == "text-davinci-003" or model_id == "text-davinci-002": prices = 20, 20 elif "ft:gpt-3.5-turbo" in model_id: prices = 3, 6 elif "ft:gpt-4.1-mini" in model_id: prices = 0.8, 3.2 elif "ft:gpt-4.1" in model_id: prices = 3, 12 elif "ft:gpt-4o-mini" in model_id: ...
Python
1
hableForTOS: IcmpCode = IcmpCode(12); /// ICMP code for "communication administratively prohibited" packet. pub const CommunicationAdministrativelyProhibited: IcmpCode = IcmpCode(13); /// ICMP code for "host precedence violation" packet. pub const HostPrecedenceViolation: IcmpCode = Icmp...
Rust
0
report_lines.append("") # 统计信息 total_issues_found = sum(len(issues) for issues in issues_found.values()) total_issues_fixed = sum(len(fixes) for fixes in issues_fixed.values()) report_lines.append("修复统计:") report_lines.append(f" 发现问题总数: {total_issues_fo...
Python
1
Author: Jesse 'Jeaye' Wilkerson Description: Renders an MD5 mesh. */ use std::{ mem, ptr }; use gl, gl::types::*; use gfx; use math; use super::Mesh; #[macro_escape] #[path = "../../gfx/check.rs"] mod check; struct Mesh_Renderer<'self> { priv mesh: &'self Mesh, priv vao: gfx::VAO, priv position...
Rust
0
) if image.endswith('.jpg')]) if img_num>200: # print(f"Video {video} already processed, skip") continue # print(f"Processing video: {video}") #coords_list, frames = get_landmark_and_bbox(model, fa, video_path, upperbondrange) #co...
Python
1
Int::new(id), reason_code: PubCompReasonCode::Success, props: Properties::new(), } } pub fn identifier(&self) -> u16 { self.packet_identifier.inner() } pub fn reason_code(&self) -> PubCompReasonCode { self.reason_code } pub fn set_reason_code(&mut ...
Rust
0
tosi", "1KLCM-MX-EE" => "Zacatecas", "1KLCM-MX-F" => "South-Central Mexico", "1KLCM-MX-FA" => "Mexico City", "1KLCM-MX-FB" => "Mexico State", "1KLCM-MX-FBM" => "Teotihuacan", "1KLCM-MX-FC" => "Morelos", "1KLCM-MX-G" => "Southwest Mexico", "1KLCM-MX-GA" => "Chiapas", "1KLCM-MX-GB" => ...
Rust
0
ains_key_image() .times(1) .return_const(Err(LedgerError::KeyImageAlreadySpent)); let untrusted = DefaultTxManagerUntrustedInterfaces::new(ledger); assert_eq!( untrusted.is_valid(Arc::new(well_formed_tx_context)), Err(TransactionValidationError::Contains...
Rust
0