text
string
label_name
string
labels
int64
CueAction :param quiet: If True `all_executed` is not emitted :type quiet: bool """ for cue in self.cues(): cue.execute(action) if not quiet: self.all_executed.emit(action) def stop_all(self): if self.app.conf.get("layout.stopAllFade", False)...
Python
1
index, self.len() + 1)?; unsafe { cv_VectorOfPlatformInfo_insert(self.as_raw_mut_VectorOfPlatformInfo(), index, val.as_raw_mut_PlatformInfo()) } Ok(()) } #[inline] fn set(&mut self, index: size_t, mut val: core::PlatformInfo) -> Result<()> { extern "C" { fn cv_VectorOfPlatformInfo_set(instance: *mut c_...
Rust
0
def maximumSegments(n, a, b, c): dp = [-1] * (n + 10) dp[0] = 0 for i in range(0, n): if (dp[i] != -1): if i + a <= n: dp[i + a] = max(dp[i] + 1, dp[i + a]) if i + b <= n: dp[i + b] = max(dp[i] + 1, dp[i + b]) if i + c <= n: ...
Python
1
l { if a == b { return true; } let thresh = 0.1 / ((10i32.pow(cmp_decimals)) as f32); let diff = (a - b).abs(); diff <= thresh } /// An in memory representation of a Weld vector. #[derive(Clone, Debug)] #[allow(dead_code)] #[repr(C)] struct WeldVec<T> { data: *const T, len: i64, } ...
Rust
0
# -*- coding: utf-8 -*- """ 代理績效監控面板組件 此模組提供實時績效追蹤和可視化分析,包括: - 實時績效指標監控 - 交互式圖表和可視化 - 代理排名和績效對比 - 歷史績效回測和分析 主要功能: - 多維度績效指標 - 實時數據更新 - 交互式圖表 - 績效對比分析 - 風險收益分析 """ import streamlit as st import pandas as pd import numpy as np import plotly.express as px import plotly.graph_objects as go from plotly.subplots import ma...
Python
1
bv_from_u32(4, width); let eight = state.bv_from_u32(8, width); let sixteen = state.bv_from_u32(16, width); // if x = 0 we'll eventually return `width` let x_eq_0 = x._eq(&zero); // n <- 0 let n = zero.clone(); match width { 32 => { // if (x & 0x0000FFFF) = 0: n <- n + ...
Rust
0
Ok(("", GoodToolsToken::DumpCode("h", Some("2"), Some("IR"), None, None, Some("ff")))) ); assert_eq!(parse_dump_tag("h")("[hMF6]"), Ok(("", GoodToolsToken::DumpCode("h", None, Some("MF"), None, None, Some("6")))) ); assert_eq!(parse_dump_tag("h")("[h1+2C]"), ...
Rust
0
GovQueryMsg>(x).unwrap() { GovQueryMsg::Staker { address } => to_binary(&StakerResponse { balance: match address.as_str() { "tester_1" => Uint128::from(5u64), "tester_2" => Uint128::from(15u64), _ => Uint128::zero(), ...
Rust
0
x0a\x00\x00\x00\x0dIHDR\x00\ \x00\x00 \x00\x00\x00 \x08\x06\x00\x00\x00szz\xf4\ \x00\x00\x00\x19tEXtSoftware\ \x00Adobe ImageRead\ yq\xc9e<\x00\x00\x03$iTXtXML\ :com.adobe.xmp\x00\x00\ \x00\x00\x00<?xpacket beg\ in=\x22\xef\xbb\xbf\x22 id=\x22W5M\ 0MpCehiHzreSzNTc\ zkc9d\x22?> <x:xmpm\ eta xmlns:x=\x22ado\ be:ns:meta/\...
Python
1
DEFAULT_ANALYSIS_WIDGETS = [ { "id": 'AnalysisLayout', "type": 'AnalysisLayout', "metadata": { "name": '布局组件', }, "properties": { "showFloatPanel": False, "showSidePanel": False, "showBottomPanel": False, }, }, {...
Python
1
fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d" and base58 "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY" in westend network const BOB: &[u8] = &[ 142, 175, 4, 21, 22, 135, 115, 99, 38, 201, 254, 161, 126, 37, 252, 82, 135, 97, 54, 147, 201, 18, 144, 156, 178, 38, 170, 71, 148, 242, 106,...
Rust
0
Key}; use async_rustls::rustls::Certificate as RustlsCertificate; use async_rustls::rustls::{ClientHello, PrivateKey, ResolvesServerCert}; use async_std::path::Path; use async_std::task::sleep; use chrono::Utc; use futures::future::try_join_all; use pem::PemError; use rcgen::{CertificateParams, DistinguishedName, Rcgen...
Rust
0
n is_mature( &self, tx: &transaction::Transaction, head_header: &block::BlockHeader, ) -> Result<(), PoolError> { if head_header.height < tx.lock_height() { return Err(PoolError::ImmatureTransaction { lock_height: tx.lock_height(), }); } Ok(()) } } #[cfg(test)] mod tests { use super::*; use c...
Rust
0
# -*- coding: utf-8 -*- # # Copyright 2015 Google LLC. All Rights Reserved. # # 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 requir...
Python
1
eplace_user; pub use create_collection::*; pub use create_database::*; pub use create_document::*; pub use create_or_replace_attachment::*; pub use create_or_replace_slug_attachment::*; pub use create_or_replace_trigger::*; pub use create_or_replace_user_defined_function::*; pub use create_permission::*; pub use creat...
Rust
0
F_RECORD_NAMESPACES: perf_event_type = 16; pub const perf_event_type_PERF_RECORD_MAX: perf_event_type = 17; pub type perf_event_type = u32; pub const perf_callchain_context_PERF_CONTEXT_HV: perf_callchain_context = 18446744073709551584; pub const perf_callchain_context_PERF_CONTEXT_KERNEL: perf_callchain_context = 1844...
Rust
0
a d3 @sdZgdZddlZddlZddlZddlTddlmZmZddlZdZ dZ dZ Gdd d ej Z ddd dddddd d dZed ddfddZeddfddZdS)aSInterface to the liblzma compression library. This module provides a class for reading and writing compressed files...
Python
1
DeviceFragmentShaderBarycentricFeaturesNV.html) · Structure"] #[doc(alias = "VkPhysicalDeviceFragmentShaderBarycentricFeaturesNV")] #[derive(Copy, Clone)] #[repr(C)] pub struct PhysicalDeviceFragmentShaderBarycentricFeaturesNV { pub s_type: crate::vk1_0::StructureType, pub p_next: *mut std::ffi::c_void, pub...
Rust
0
teRef::from_static(":review/book")) //! .match_value(1) //! .entity(); //! ``` use std::ops::Deref; use crate::types::AttributeRef; use crate::{soup::Encoded, Value, ValueRef}; /// A borrowing type alias for [`GenericNetwork`] using [`ValueRef`]. /// /// TODO this doesn't work for some reason. The compiler k...
Rust
0
import pandas as pd import numpy as np import pyaf.ForecastEngine as autof import pyaf.Bench.TS_datasets as tsds #get_ipython().magic('matplotlib inline') import datetime as dt from dateutil.relativedelta import relativedelta def addMinutes(iTime , iMinutes): lTime = iTime date_after_minutes = lTime + relati...
Python
1
from sqlalchemy import Column from sqlalchemy import Integer from sqlalchemy import Table from sqlalchemy.sql import text from alembic import testing from alembic.testing import eq_ from alembic.testing.fixtures import FutureEngineMixin from alembic.testing.fixtures import TablesTest class ImplTest(TablesTest): ...
Python
1
from typing import Annotated from nonebot import get_bot, on_command from nonebot_plugin_apscheduler import scheduler from nonebot.adapters.onebot.v11 import Bot, Message, MessageSegment from src.provider.kv.utils import GetValue, get_value @on_command("passnat").handle() @scheduler.scheduled_job("cron", day="*", h...
Python
1
x_repmax1 = [dt.datetime.strptime(d,"%Y-%m-%d").date() for d in repmax1_dates] #x_repmax3 = [dt.datetime.fromtimestamp(d).date() for d in repmax3_dates] x_repmax3 = [d for d in repmax3_dates] x_repmax3 = x_repmax1 #x_barchart = [dt.datetime.fromtimestamp(d).date() for d in barchart_dates] x_barchart = [d for d ...
Python
1
import socket import argparse RED = "\033[91m" GREEN = "\033[92m" RESET = "\033[0m" def conexão_ftp(ip): try: tcp = socket.socket((socket.AF_INET, socket.SOCK_STREAM)) tcp.connect(ip, 21) #enviando conexão print(f"{RED}Conectando ao servidor...{RESET}") banner = tc...
Python
1
norm(); return n3.nbits(); } /* prepare for multi-pairing */ pub fn initmp() -> [FP48; rom::ATE_BITS] { let r: [FP48; rom::ATE_BITS] = [FP48::new_int(1); rom::ATE_BITS]; return r } /* basic Miller loop */ pub fn miller(r:&[FP48]) -> FP48 { let mut res=FP48::new_int(1); for i in (1..rom::ATE_BITS)....
Rust
0
import os.path import sys import traceback import PIL.Image import numpy as np import torch from basicsr.utils.download_util import load_file_from_url import modules.upscaler from modules import devices, modelloader from scunet_model_arch import SCUNet as net class UpscalerScuNET(modules.upscaler.Upscaler): def...
Python
1
from .utils import kconfig_contains # Based on Linux Kernel 5.9 # arch/mips/Kconfig # menu 'CPU selection' _mips32_v1 = ['CPU_MIPS32_R1'] _mips32_v2 = ['CPU_MIPS32_R2'] _mips32_v5 = ['CPU_MIPS32_R5'] _mips32_v6 = ['CPU_MIPS32_R6'] _mips64_v1 = ['CPU_MIPS64_R1'] _mips64_v2 = ['CPU_MIPS64_R2'] _mips64_v5 = ['CPU_MIPS...
Python
1
u16, api_port: params.api_base_port + id_u16, hbbft_pk: *netinf.public_key(&id).unwrap(), }; (id, peer) }) .collect::<BTreeMap<_, _>>(); let (wallet_server_cfg, wallet_client_cfg) = WalletConfig::truste...
Rust
0
to(Coord2(5.0, 1.0)) .line_to(Coord2(1.0, 1.0)) .build(); let rectangle2 = BezierPathBuilder::<SimpleBezierPath>::start(Coord2(11.0, 1.0)) .line_to(Coord2(11.0, 5.0)) .line_to(Coord2(15.0, 5.0)) .line_to(Coord2(15.0, 1.0)) .line_to(Coord2(11.0, 1.0)) .build();...
Rust
0
""" Module to store a str enum class representation of expire date. """ from enum import StrEnum __all__ = ["Expire"] class Expire(StrEnum): """ A str enum class that define valid expiration date. Attributes: NEVER (str): `"N"`, never expire TEN_MINUTES (str): `"10M"`, expire after ten ...
Python
1
many units } /// KeyboardReport describes a report and its companion descriptor that can be /// used to send keyboard button presses to a host and receive the status of the /// keyboard LEDs. #[gen_hid_descriptor( (collection = APPLICATION, usage_page = GENERIC_DESKTOP, usage = KEYBOARD) = { (usage_page = ...
Rust
0
16 | TextEncoding::UTF16BE => { while let (Ok(b1), Ok(b2)) = (reader.read_u8(), reader.read_u8()) { if b1 == 0 && b2 == 0 { break; } text_bytes.push(b1); text_bytes.push(b2) } }, } (!text_bytes.is_empty()).then(|| text_bytes) } pub(crate) fn utf16_decode(reader: &[u8], endianness: fn([...
Rust
0
|jj ||n|j| |_|S(Nisillegal offset value( RR<R$R%RRRDR1R(RRR*R"(R RtnewTexttnext((s minidom.pyt splitTexts!    R cCs!t|d||j|fdS(Ns...
Python
1
from pandas import DataFrame from pilotscope.DBController.BaseDBController import BaseDBController from pilotscope.PilotSysConfig import PilotSysConfig class TableVisitedTracker: def __init__(self, db_controller: BaseDBController): self.db_controller = db_controller # The table records the "id"...
Python
1
510060780V男生当然是不用说了,\n', '低年级的女生也都会去买的。', TxtCtl.Enter, TxtCtl.Clear, '#0510060781V#641F而且买到手的时候还会高喊\n', '『姐姐大人~』呢㈱', TxtCtl.Enter, ), ) CloseMessageWindow() ChrTalk( 0x0105, ( '#0060060782V#045F#2P...
Python
1
if "alpha" in key: lora_module_name = key[: key.rfind(".alpha")] alpha = float(lora_sd[key].detach().numpy()) alphas[lora_module_name] = alpha if lora_module_name not in base_alphas: base_alphas[lora_module_name] = alpha ...
Python
1
class Solution: def divideArray(self, nums: List[int]) -> bool: return all(value % 2 == 0 for value in collections.Counter(nums).values())
Python
1
, None), (Purple, None), (Purple, None), (Purple, None), (Purple, None), (Fpack, F9), (Purple, None), (Purple, None), (Purple, None), (Fand, F9), (Fandcm, F9), (For, F9), (Fxor, F9), (Purple, None), (Purple, None), (Purple, None), (Purple, ...
Rust
0
/ * 1 * \ * 2 * * * Example 2: * * * Input: [3,1,4,null,null,2] * * 3 * / \ * 1 4 * / * 2 * * Output: [2,1,4,null,null,3] * * 2 * / \ * 1 4 * / * 3 * * * Follow up: * * * A solution using O(n) space is pretty straight for...
Rust
0
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may...
Python
1
s_unpack(&array, &mut c); nres_it(&mut c); poly_mul(&mut c, &sd); intt(&mut c); error(&mut rng, &mut ed); poly_add(&mut c, &ed); poly_add(&mut c, &k); compress(&c, &mut cc); sh = SHA3::new(sha3::HASH256); for i in 0..32 { sh.process(key[i]); } sh.hash(&mut key); ...
Rust
0
{ **BASE_QUANT_CONFIG, **dict(group_size=group_size, axis=axis), } M, N, K = shape quant_config = BaseQuantizeConfig( quant_zero=False, quant_scale=False, offload_meta=False, view_as_float=False ) quant_config.update({"weight_quant_params": qcfg}) W_q = torch.randint(0,...
Python
1
email String @unique // Comment 2 } "#; let expected = r#"model User { id Int @id // Comment email String @unique // Comment 2 } "#; assert_reformat(input, expected); } #[test] fn end_of_line_comments_must_not_influence_table_layout_in_models() { let input = r#"mode...
Rust
0
let summary = Box::into_raw(Box::new(::gphoto2::CameraText{ text: [0; 32 *1024] })); try_unsafe!(::gphoto2::gp_camera_get_summary(self.camera, summary, context.as_mut_ptr())); util::camera_text_to_string(summary) } /// Returns the camera's manual. /// /// The manual contains inf...
Rust
0
from celery import shared_task from .models import Ai_todo_steps, Todo import ollama from django.contrib.auth.models import User @shared_task def generate_todo_steps(task, user_id): ai_todosteps = Ai_todo_steps(steps=[]) prompth = f""" You are a friendly and helpful assistant inside a to-do app. You...
Python
1
def kl_divergence(self, hidden_states): mean = hidden_states.mean() var = hidden_states.var() return var + mean ** 2 - 1 - torch.log(var + 1e-07)
Python
1
attributes: &[ wgpu::VertexAttributeDescriptor { offset: 0, shader_location: 0, format: wgpu::VertexFormat::Float3, }, wgpu::VertexAttributeDescriptor { offset: mem::size_of::<[f3...
Rust
0
#!/usr/bin/env python3 import os import sys import networkx as nx import pylab as plt from networkx.drawing.nx_pydot import read_dot ret = os.system("./a.out "+sys.argv[1]+" debug") assert(ret == 0) df = "debug/model.hwx.zinir_graph_after_reg_spill.dot" #from graphviz import render #render('dot', 'png', df) #plt = ...
Python
1
> IdRef { if i != nil { let _: id = unsafe { msg_send![i, retain] }; } IdRef(i) } fn non_nil(self) -> Option<IdRef> { if self.0 == nil { None } else { Some(self) } } } impl Drop for IdRef { fn drop(&mut self) { if self.0 != nil { let _: (...
Rust
0
: 20, y: 10 }; println!("pos1 == pos2 : {}", pos1 == pos2); println!("pos1 == pos3 : {}", pos1 == pos3); println!("pos1 != pos3 : {}", pos1 != pos3); println!("pos1 == pos4 : {}", pos1 == pos4); println!("pos1 < pos3 : {}", pos1 < pos3); println!("pos1 > pos3 : {}", pos1 > pos3); let pos5 ...
Rust
0
} // } else { // panic!("Unexpected Interrupt: {:?}", isr); // } // }, // I2cAction::Stop => { // if isr.test_tc() { // self.i2c.with_cr2(|r| r.set...
Rust
0
#! /usr/bin/env python """Configure the baseline on Vagrant device Copyright (c) 2018 Cisco and/or its affiliates. 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 w...
Python
1
"""defenition: map(function, iterable)""" """eg using user defined fn""" # def cube(num): # return num**3 # print(list(map(cube, [1,2,3,4]))) """eg using in-build fn""" # num_list=[1,2,-3,-4,5,6,-7,8,-9,0] # print(list(map(abs,num_list))) """abs is a inbuild fn to find absolute value it ignore signs)""" #eg...
Python
1
ons(): ForkingPickler.register(torch.cuda.Event, reduce_event) for t in torch._storage_classes: if t.__name__ == "UntypedStorage": ForkingPickler.register(t, reduce_storage) else: ForkingPickler.register(t, reduce_typed_storage_child) ForkingPickler.register(torch.s...
Python
1
Nm * 100 - Nhk * 10 Nk = Num // 1000 - Nm * 1000 - Nhk * 100 - Ntk * 10 Nh = Num // 100 - Nm * 10000 - Nhk * 1000 - Ntk * 100 - Nk * 10 Nt = Num // 10 - Nm * 100000 - Nhk * 10000 - Ntk * 1000 - Nk * 100 - Nh * 10 Ns = Num - Nm * 1000000 - Nhk * 100000 - Ntk * 10000 - Nk * 1000 - Nh * 10...
Python
1
"std")] mod if_std { use super::*; // Export a thread-safe version using parking_lot::RawMutex /// A [`GenericSemaphore`] backed by [`parking_lot`]. pub type Semaphore = GenericSemaphore<parking_lot::RawMutex>; /// A [`GenericSemaphoreReleaser`] for [`Semaphore`]. pub type SemaphoreReleaser<'...
Rust
0
ns(fo) .clone("<EMAIL>:davidB/git2_credentials.git", dst.as_ref())?; Ok(()) } use super::unit::Unit; use crate::consts::{RATIO_MAX}; use crate::{ApproxEq, DEFAULT_APPROX_EQ_PRECISION}; use crate::common::approx::approx; #[derive(Clone, PartialEq, Debug, Default)] pub(crate) struct Alpha { value: Option...
Rust
0
#[cfg(feature = "fix_50sp2")] Quote::FIX50SP2(m) => m.get_header(), } } } #[derive(Deserialize, Clone, Debug, PartialEq)] #[serde(tag = "1128")] pub enum SettlementInstructions { /// FIX50 #[cfg(feature = "fix_50")] #[serde(rename = "7")] FIX50(Box<fix50::messages::settlement_instr...
Rust
0
ration (memory allocated) let words: [&str; 2]; words = ["ok"; 2]; // repeat expression, equivalent to ["ok", "ok"] println!("words is {}", words[1]); /* length of usize is based on number of bytes needed to reference memory in your target architecture: - for 32 bit compilation target -> usize ...
Rust
0
andle = worker.start(); EventLoopActor::item().register_and_start(&mut context); PulseActor::item().register_and_start(&mut context); InputActor::item().register_and_start(&mut context); debug!("Actor system started"); actor_system_handle.await? } fn main() -> Result<()> { info!("Starting RsMixer"); let thre...
Rust
0
dev = variance ** 0.5 # Assuming risk-free rate of 0.02 (2%) risk_free_rate = 0.02 sharpe_ratio = ((avg_return - risk_free_rate) / std_dev) if std_dev > 0 else 0 # Store the result await connection.execute(...
Python
1
pub struct _SW_PAD_CTL_PAD_GPIO_SPI_B1_05; #[doc = "`read()` method returns [sw_pad_ctl_pad_gpio_spi_b1_05::R](sw_pad_ctl_pad_gpio_spi_b1_05::R) reader structure"] impl crate::Readable for SW_PAD_CTL_PAD_GPIO_SPI_B1_05 {} #[doc = "`write(|w| ..)` method takes [sw_pad_ctl_pad_gpio_spi_b1_05::W](sw_pad_ctl_pad_gpio_spi_b...
Rust
0
# encoding: utf-8 """ python调用linux系统命令获取当前脚本运行内存 """ # os.system 返回为状态 # os.popen 返回值可以接收,eg: 可以通过os.popen('ps -ah').read()来接收 import os def test_memory_usage(): # 获取当前脚本的进程ID print(os.getpid()) # 获取当前脚本占用的内存 # cmd = 'ps -p %s -o rss=' % os.getpid() cmd = 'ps -p 7813 -o rss=' print(cmd) ...
Python
1
for ProtobufEncoding { type DecodeError = prost::DecodeError; type EncodeError = prost::EncodeError; } impl<M: prost::Message + Default> Message<ProtobufEncoding> for M { fn encode<B: BufMut>(&self, buf: &mut B) -> Result<(), prost::EncodeError> { M::encode(self, buf) } fn decode<S: AsRef...
Rust
0
rtcp::packet::Packet + Send + Sync>>, Attributes)> { let mut b = vec![0u8; receive_mtu]; let (n, attributes) = self.read(&mut b).await?; let mut buf = &b[..n]; let pkts = rtcp::packet::unmarshal(&mut buf)?; Ok((pkts, attributes)) } } /// RTPSender allows an application to...
Rust
0
cache-friendly for small sets. /// /// Example usage: /// /// ``` /// use smolset::SmolSet; /// /// // `s` and its elements will be completely stack-allocated in this example. /// let mut s: SmolSet<[u32; 4]> = SmolSet::new(); /// s.insert(1); /// s.insert(2); /// s.insert(3); /// assert_eq!(s.len(), 3); /// assert!(s...
Rust
0
# -*- coding: utf-8 -*- """ 预测脚本: - 加载模型与标准化器 - 对测试集评估,计算 MAPE/MAE - 进行短期与长期迭代预测,生成预警 """ from __future__ import annotations from typing import List, Dict import json from pathlib import Path import numpy as np import pandas as pd import torch from .config import ( ensure_directories, PROCESSED_DIR, MODE...
Python
1
LES"); //! let files = vec![]; //! //! finish!(tmr, "Found {} files", files.len()); //! return files; //! } // tmr is dropped here but no message is produced. //!``` //! //! # Setting the log level //! //! By default both `timer` and `stimer` log at `Debug` level. An optional first parameter to //! these ma...
Rust
0
call_function_by_id(BIRL_GLOBAL_FUNCTION_ID, vec![]) { Ok(_) => {} Err(e) => return Err(e) } loop { match self.execute_next_instruction() { Ok(ExecutionStatus::Normal) => {} Ok(ExecutionStatus::Returned) => {}, Ok(Execu...
Rust
0
nce_length'] = max(1, arguments['input_sequence_length']) arguments['horizon'] = max(0, arguments['horizon']) arguments['output_sequence_length'] = max(1, arguments['output_sequence_length']) arguments['lstm_hidden_units'] = [int(x) for x in arguments['lstm_hidden_units'].split(' ')] print ("Will u...
Python
1
se ark_serialize::{CanonicalDeserialize, CanonicalSerialize, SerializationError}; use ark_std::{ convert::TryFrom, fmt, io::{Read, Write}, vec::Vec, }; mod fft; /// Defines a domain over which finite field (I)FFTs can be performed. Works /// only for fields that have a large multiplicative subgroup of...
Rust
0
"""Calculate the cost of a completion using the Cohere API.""" from ..base.types import CostMetadata def calculate_cost( metadata: CostMetadata, model: str = "command-r-plus", ) -> float | None: """Calculate the cost of a completion using the Cohere API. https://cohere.com/pricing Model ...
Python
1
ostics emitted during the current // compilation session. current_diagnostics: RefCell<FxHashMap<DepNodeIndex, Vec<Diagnostic>>>, // This will eventually be needed for creating Decoders that can rebase // spans. _prev_filemap_starts: BTreeMap<BytePos, StableFilemapId>, codemap: &'sess CodeMap, ...
Rust
0
, DBValue>::default(); reference_trie::compare_implementations(data, memdb, hashdb); } fn compare_implementations_h(data: Vec<(Vec<u8>, Vec<u8>)>) { let memdb = MemoryDB::<_, HashKey<_>, _>::default(); let hashdb = MemoryDB::<KeccakHasher, HashKey<_>, DBValue>::default(); reference_trie::compare_implementatio...
Rust
0
stderr_r = io.open(stderr_r, 'r', encoding=encoding) else: stderr_r = os.fdopen(stderr_r, 'rb') stderr_pipe = True else: stderr_r = stderr_w = stderr if stdout_pipe or stderr_pipe: capture_encoding = None else: capture_encoding = encoding w = Wurli...
Python
1
TwoWayMap { normal, reversed } } } const HIRAGANA_KATAKANA_DIFF: u32 = 'ア' as u32 - 'あ' as u32; lazy_static! { static ref VOWEL_MAP: TwoWayMap = TwoWayMap::new(hashmap! { Vowel::A => 'あ', Vowel::I => 'い', Vowel::U => 'う', Vowel::E => 'え', Vowel::O => 'お', }); st...
Rust
0
, &possible_vals); //! // The implementation trys to order matches from "best" to "wort" //! assert_eq!(suggestions, vec!["testing", "tempo"]); //! ``` //! //! Asking for a single suggestion here (`provide_a_suggestion`) would attempt to return the "best" one. //! As you can immagine, that may not be what the user expe...
Rust
0
none")] pub deployed_bytecode: Option<DeployedBytecode>, } impl ContractBytecode { /// Returns the `ContractBytecodeSome` if all fields are `Some` /// /// # Panics /// /// Panics if any of the fields equal `None` /// /// # Example /// /// ``` /// use ethers_solc::Project; ...
Rust
0
?\xc2\xcfG*\x91\xff\xf0\xe6\xbf\x01\x7f\x86\xf9\ \x9a\ \x00\x00\x0al\ \x00\ \x00*\x87x\x9c\xedZ{o\xdb8\x12\xff?\x9fB\ \xe7\xe2\xb0-\xce\x92\xf9\x14I7\xce\xe2v\x8b],\ \xd0\xc3\x1e6\xed\xbd\xfe\x09\x14\x89\xb6u\x91%C\xa2\ c\xbb\x9f\xe6>\xcb}\xb2\x1b\xcaz\xd9\x91\xda$\xf5\ \x06{\xc0\xa6\x8fHCr\xc8\x99\xf9\xcdpf\xec\xcb\ o...
Python
1
now.round_to(Grain::Minute)); assert_eq!(Moment(Paris.ymd(2017, 04, 25).and_hms(9, 10, 11)), now.round_to(Grain::Second)); assert_eq!(Moment(Paris.ymd(2017, 04, 24).and_hms(0, 0, 0)), now.round_to(Grain::Week)); assert_eq!(Moment(Paris.ymd...
Rust
0
# ✅ Sort the data based on preferred_order data.sort(key=lambda x: preferred_order.index(x['server']) if x['server'] in preferred_order else 999) return jsonify(data) except Exception as e: print(f"Error in /api/realtime: {str(e)}") return jsonify({'error': str(e)}), 500 # AP...
Python
1
tication::basic(|req, cred| async move { match cred.user_id() { id if id == "test_id" => Ok(req), _ => Err(error::ErrorUnauthorized("")), } }) .new_transform(ok_service()) .await .unwrap(); let req = TestRequest::default();...
Rust
0
/// Creates a new `&PartialTimeStr` from a string slice. /// /// # Examples /// /// ``` /// # use datetime_string::rfc3339::PartialTimeStr; /// let time = PartialTimeStr::from_str("12:34:56.7890")?; /// assert_eq!(time.as_str(), "12:34:56.7890"); /// /// assert!(PartialTimeStr:...
Rust
0
ed) as Rc<dyn AudioRender>)) }) as NativeFn)); rt.insert("test_audio", r(Box::new(|_vec: Vec<Val>| { use crate::audio_renders::{note::Note, sequencer::Sequencer}; fn note(dur: f64, nn: i32, vel: f64, pan: f64) -> Box<dyn AudioRender> { Box::new(Note { frequency: 440.0...
Rust
0
t(): return datalab.bigquery.Dialect.default().bq_dialect def _set_bq_dialect(bq_dialect): datalab.bigquery.Dialect.default().set_bq_dialect(bq_dialect) try: if 'datalab_project_id' not in _IPython.get_ipython().user_ns: _IPython.get_ipython().user_ns['datalab_project_id'] = _get_project_id ...
Python
1
writer.flush()?; } _ => (), } Ok(()) } // compile-flags: -Zmir-opt-level=1 trait NeedsDrop:Sized{ const NEEDS:bool=std::mem::needs_drop::<Self>(); } impl<This> NeedsDrop for This{} // EMIT_MIR control_flow_simplification.hello.ConstProp.diff // EMIT_MIR control_flow_simplifi...
Rust
0
K: u32 = 0x0; // FLASHCALW and HRAMC1 clocks allowed // // This is identical to the reset value of the PBBMASK except it allows the // flash's HRAMC1 clock as well. const DEEP_SLEEP_PBBMASK: u32 = 0x3; /// Determines if the chip can safely go into deep sleep without preventing /// currently active peripherals from op...
Rust
0
from flet_core.plotly_chart import PlotlyChart
Python
1
msg: String, data: Data, } #[derive(Debug, Serialize, Deserialize)] struct Data { unique_id: String, ip: String, port: String, country: String, ip_address: String, anonymity: i32, protocol: String, isp: String, speed: ...
Rust
0
import pandas as pd from sklearn.model_selection import train_test_split from sklearn.metrics import accuracy_score import xgboost as xgb # Load the dataset CSV file df = pd.read_csv(r'C:\Users\freed\Downloads\yolopose\dataset_path\dataset_pathdataset.csv') # Prepare feature matrix X and target vector y X = df.drop([...
Python
1
) => { let file_path = Path::new(path); let metadata = fs::metadata(file_path)?; if metadata.is_dir() { for entry in fs::read_dir(file_path)? { let entry_result = entry?; if entry_result.metadata()?.is_file() { let...
Rust
0
#!/usr/bin/env python from pathlib import Path import websocket import requests import json import sys import os ntfy_url = os.environ["NTFY_URL"] meta_info = Path("/tmp/metadata.txt").read_text().strip("\n\r\t ") def on_message(_, message): msg = json.loads(message) if msg["event"] == "open": print...
Python
1
# -*- coding: utf-8 -*- # pylint: disable=all # flake8: noqa # type: ignore # mypy: ignore-errors #!/usr/bin/env python3 import socket import requests import ssl import json from datetime import datetime import time def quick_pentest(target): """Quick professional pentest with immediate results""" print("🔥"...
Python
1
ll be uploaded to {s3_results_path}/model_output/") print(f" >> Run id is {self.run_id}") print(f" >> config is {config_file.split('/')[-1]}") csp_branch = subprocess.getoutput(f"cd {self.csp_path}; git rev-parse --abbrev-ref HEAD") data_branch = subprocess.getoutput(f"cd {self.data_path...
Python
1
as_bool(&self) -> bool { true } fn get_value(&self) -> &dyn std::any::Any { &self.value } fn get_mut_value(&mut self) -> &mut dyn std::any::Any { &mut self.value } fn to_msg(&self, content_type: String) -> Message { Message { content_type, ...
Rust
0
from tkinter import * import requests quote = "Kanye Quote Goes HERE" def get_quote(): response = requests.get(url="https://api.kanye.rest") response.raise_for_status() data = response.json() print(data) quote = data["quote"] canvas.itemconfig(quote_text, text = quote) window...
Python
1
( since = "0.2.0", note = "please use `Card::parse_to_iter().try_collect::<Vec<_>>()` instead. This will \ disappear soon." )] pub fn parse_to_vec<S, T>(strings: S) -> Result<Vec<Self>, ParseCardError> where S: IntoIterator<Item = T>, T: AsRef<str>, { ...
Rust
0
in state.output.iter().rev().take(output_area.height as usize) { let entry_lines = entry .trim_end() .as_bytes() .chunks(output_area.width as usize - 2) .rev() .map(|bytearray| std::str::from_utf8(bytear...
Rust
0
::Error> where S: serde::Serializer { serializer.serialize_newtype_struct("ThreadId", self.0) } } /// A unique identifier for a traced event or start/stop pair. /// /// The pair of `(id.u32(), id.thread())` must be unique across all IDs of a /// particalur `TraceId` type. In other words, either...
Rust
0
draft202012="relative-json-pointer", raises=jsonpointer.JsonPointerException, ) def is_relative_json_pointer(instance: object) -> bool: # Definition taken from: # https://tools.ietf.org/html/draft-handrews-relative-json-pointer-01#section-3 if not isinstance(instance, str): ...
Python
1