text string | label_name string | labels int64 |
|---|---|---|
object.identifier.name().to_owned(), rendered.clone());
rendered
}
fn render_output_object(&self, output_object: &ObjectTypeWeakRef, ctx: &mut RenderContext) -> String {
let output_object = output_object.into_arc();
if ctx.already_rendered(output_object.identifier.name()) {
... | Rust | 0 |
pub use contract::*;
pub use elrond_wasm_output::*;
<gh_stars>0
use super::{IsColorChannel, IsColor, HasAlpha, HasntAlpha, Rgba, Hsl, Hsv};
/// Generic RGB color
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct Rgb<T> {
pub red: T,
pub green: T,
pub blue: T,
}
impl<T: IsColorChannel> IsColor for... | Rust | 0 |
] = new_time
elif edit_item == "3":
# region new status
while True:
new_status = input("Status (active - deactive) : ")
system("cls")
if new_status in ["active", "dea... | Python | 1 |
"minilp")))]
#[cfg(feature = "coin_cbc")]
pub use solvers::coin_cbc::coin_cbc;
#[cfg(feature = "coin_cbc")]
/// When the "coin_cbc" cargo feature is present, it is used as the default solver
pub use solvers::coin_cbc::coin_cbc as default_solver;
#[cfg(feature = "highs")]
#[cfg_attr(docsrs, doc(cfg(feature = "highs")))... | Rust | 0 |
c5,0xc5,0xc5,0xc5,],
pt: [0xd7,0x4e,0xf1,0x85,0xb7,0x2b,0xd1,0x05,0xea,0x32,0x81,0xe1,0x97,0x70,0x8c,0x07,],
ct: [0xc5,0xc5,0xc5,0xc5,0xc5,0xc5,0xc5,0xc5,0xc5,0xc5,0xc5,0xc5,0xc5,0xc5,0xc5,0xc5,]
},
Aes128Test {
key: [<KEY>,],
pt: [0x97,0x7f,0x45,0x6c,0x7e,0x83,0x7c,0x07,0x3f,0x4... | Rust | 0 |
from collections import defaultdict
import heapq
class Twitter:
def __init__(self):
self.time = 0
self.tweets = defaultdict(list) # Stores tweets {userId: [(time, tweetId)]}
self.followees = defaultdict(set) # Stores follow relationships {userId: set(followeeIds)}
def postTweet(self... | Python | 1 |
r#"
//- /main.rs crate:main deps:std
fn foo() { let x: $0 }
//- /std/lib.rs crate:std
pub mod prelude {
pub mod rust_2018 {
pub struct Option;
}
}
"#,
expect![[r#"
md std
st Option
bt u32
"#]],
);
}
#[test]
fn completes_p... | Rust | 0 |
eft) - idx - 1
else:
lchild[idx] = 0
if node.is_leaf:
nfeatureids[idx] = n_features
tids[leaf_idx] = node.targets_ids
tweights[leaf_idx] = node.targets_weights
leaf_idx += 1
else:
nfeatur... | Python | 1 |
media_gpt = MediaGPT()
media_config = config.MEDIA.get('media', {})
for dy in media_config.get('dy', []):
media_info = MediaInfo(url=UrlType.DY_CREATOR_URL, **dy)
media_path = MediaPath(info=media_info)
media_gpt_video = os.path.join(media_path.upload, 'media_gpt')
if not os.p... | Python | 1 |
# bal = 0
# print(bal)
# while True:
# n = str(input("Greeting: "))
# n.lower()
# if n == "hello":
# print("$",bal)
# if n == "hey":
# bal += 20
# print("$",bal)
# else:
# for i in range(0,5):
# if n[0] == "h" and n[1] != "e":
# print("$",b... | Python | 1 |
)?;
Ok(())
})
}
}
// Copyright (c) 2020 PowerSnail
//
// This software is released under the MIT License.
// https://opensource.org/licenses/MIT
use crate::util::lines;
pub fn part1() -> Option<i64> {
let mut x: usize = 3;
let mut tree_count = 0;
for line in lines().into_iter().s... | Rust | 0 |
NGMNTDONE_R { MNGMNTDONE_R::new((self.bits & 0x01) != 0) }
#[doc = "Bit 1 - receive complete interrupt mask"]
#[inline(always)]
pub fn rxcmplt(&self) -> RXCMPLT_R { RXCMPLT_R::new(((self.bits >> 1) & 0x01) != 0) }
#[doc = "Bit 2 - receive used bit read interrupt mask"]
#[inline(always)]
pub fn r... | Rust | 0 |
.read_js(offset, length).await
.map(|js| Uint8Array::new(&js).to_vec())
.map_err(|_| anyhow!("Error calling read_js.").into());
tx.send(result).await.unwrap();
});
rx.recv().await?
}
}
#[wasm_bindgen]
extern "C" {
#[derive(Debug)]
pub type Random... | Rust | 0 |
keeping track of questions and recording
//! interactions.
extern crate rand;
mod file;
use rand::seq::SliceRandom;
use std::error::Error;
use std::fs::File;
use std::fs::OpenOptions;
use std::io::{BufReader, BufWriter};
use std::path::Path;
use std::path::PathBuf;
use std::time::{Duration, SystemTime};
pub const ... | Rust | 0 |
_runtime::{traits::Zero, DispatchError, DispatchResult, RuntimeDebug};
use sp_std::marker::PhantomData;
#[derive(Clone, Copy, PartialEq, Decode, Encode, RuntimeDebug, TypeInfo)]
pub enum VaultPhase {
/// Vault is open for contributions
CollectingContributions,
/// The vault is closed and we should avoid fu... | Rust | 0 |
", "-=", "/=", "*="];
const UNARY_OPS: [&str; 3] = ["<-", "!", "-"];
#[test]
fn expr_stmt() {
for expr in EXAMPLE_EXPR.iter() {
let example = format!("{};", expr);
test(&example);
}
}
#[test]
fn assign() {
for expr in EXAMPLE_EXPR.iter() {
for atom in EXAMPLE_ATOMS.iter() {
... | Rust | 0 |
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "ManagedGroupCallbacks")
}
}
impl PartialEq for ManagedGroupCallbacks {
fn eq(&self, _other: &Self) -> bool {
true
}
}
// Validators
pub type ValidateAdd =
fn(managed_group: &ManagedGroup, sender: &Creden... | Rust | 0 |
,
'test_results': self.test_results,
'working_hosts': self.working_hosts,
'successful_connections': successful_connections
}
report_file = "supabase_host_finder_report.json"
try:
with open(report_file, 'w', encoding='utf-8') as f:
... | Python | 1 |
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
import numpy as np
import torch.nn.functional as F
def kl_loss_compute(pred, soft_targets, reduce=True):
kl = F.kl_div(F.log_softmax(pred, dim=1),F.softmax(soft_targets, dim=1),reduce=False)
if reduce:
... | Python | 1 |
angle_v: f32,
is_angle_violated_u: bool,
is_angle_violated_v: bool,
}
impl ConstraintConstantVelocityLimited {
pub fn new(config: ConstraintConfig, q0: Quat) -> Self {
Self {
config,
q0,
jacobian: MatMN::zero(),
cached_lambda: VecN::zero(),
... | Rust | 0 |
Traversal<TW>
where
TW: IntTbitWord + SpongosTbitWord + TritWord,
{
type PrngG = prp::troika::Troika;
type WotsParameters = wots::troika::Parameters<TW>;
/// Tbits needed to encode tree height part of SKN.
const SKN_TREE_HEIGHT_SIZE: usize = 4;
/// Tbits needed to encode key number part of SK... | Rust | 0 |
let (tx, rx) = oneshot::channel::<()>();
let (protocol_msg, message_id) = Message::new_payload(message);
let peer_id =
convert_account_address_to_peer_id(account_address).expect("Invalid account address");
self.libp2p_service
.lock()
.send_custom_message(&pe... | Rust | 0 |
y+11))
kx, ky = jpPos(ext_pos)
ext_pos += 1
img12.paste(crop, (kx, ky))
jp_strings = collectJpLetters()
for idx in jp_strings:
ix, iy = jpPos(idx)
crop = img_jp.crop((ix, iy, ix+12, iy+11))
kx, ky = jpPos(ext_pos)
ext_pos += 1
img12.paste(crop, (kx, ky))
... | Python | 1 |
![0.into(), 2.into(), 1.into()]),
vec![2.into(), 1.into(), 1.into()]);
}
#[test]
fn can_rewrite_network() {
let original: Network<_> = vec![
// Id(0) sends peers "Write(X)" and receives two acks.
Envelope { src: 0.into(), dst: 1.into(), msg: "Write(X)" },
... | Rust | 0 |
such a type. However, this was found to be too imprecise, especially
/// in the presence of `enum`s. If only a single variant of an enum has a certain qualification, we
/// needn't reject code unless it actually constructs and operates on the qualified variant.
///
/// To accomplish this, const-checking and promotion ... | Rust | 0 |
None => format!("{}:", username)
};
let encode_len = data_encoding::BASE64.encode_len(auth.as_bytes().len());
let header_value = unsafe {
let mut header_value = bytes::BytesMut::with_capacity(encode_len + BASIC.as_bytes().len());
header_value.put_slice(BASIC.as_by... | Rust | 0 |
size = int(input())
converter = size * 100
print("%d centimeters " % converter)
| Python | 1 |
struct.Control.html
pub fn new(
process: &Arc<ctx::Process>,
capacity: usize,
flush_interval: Duration,
) -> (Sensors, MakeControl) {
let (tx, rx) = futures_mpsc_lossy::channel(capacity);
let s = Sensors::new(tx);
let c = MakeControl::new(rx, flush_interval, process);
(s, c)
}
/// Tone map ... | Rust | 0 |
trained(pretrained, prefix='')
else:
checkpoint = torch.load(pretrained, map_location="cpu")
missing_keys, unexpected_keys = model.load_state_dict(checkpoint["model"], strict=False)
print('Load pretrained model from: ' + pretrained)
return model
def vit_base_patch16_22... | Python | 1 |
32_System_ParentalControls'*"]
pub const WPCEVENT_CONTENTUSAGE_value: u32 = 22u32;
#[doc = "*Required features: 'Win32_System_ParentalControls'*"]
pub const WPCEVENT_CUSTOM_value: u32 = 13u32;
#[doc = "*Required features: 'Win32_System_ParentalControls'*"]
pub const WPCEVENT_EMAIL_CONTACT_value: u32 = 14u32;
#[doc = "*... | Rust | 0 |
(StravaApiConfig, DatabaseConfig):
full: bool = False
@classmethod
def options(cls):
group = OptionGroup("Sync options")
return compose_decorators(
group.option(
'--full / --no-full', default=cls.full, show_default=True,
help="Perform full sync in... | Python | 1 |
ring Torrent hash
/// last_activity integer Last time (Unix Epoch) when a chunk was downloaded/uploaded
/// magnet_uri string Magnet URI corresponding to this torrent
/// max_ratio float Maximum share ratio until torrent is stopped from seeding/uploading
/// max_seeding_time integer Maximum seeding time (secon... | Rust | 0 |
0u32;
#[doc = "*Required features: `\"Win32_UI_Controls\"`*"]
pub const TTDT_AUTOPOP: u32 = 2u32;
#[doc = "*Required features: `\"Win32_UI_Controls\"`*"]
pub const TTDT_INITIAL: u32 = 3u32;
#[doc = "*Required features: `\"Win32_UI_Controls\"`*"]
pub const TTDT_RESHOW: u32 = 1u32;
#[doc = "*Required features: `\"Win32_... | Rust | 0 |
: &UUID,
parameters: LocalCharacteristicParameters,
) -> Result<LocalCharacteristic, WindowsError> {
Ok(LocalCharacteristic::from_inner(
self.0
.create_characteristic_async(uuid_to_guid(uuid), parameters.into_inner())?
.await?
.characterist... | Rust | 0 |
hs[0].text.strip().startswith(UPCAST_STARTING_TEXT):
upcast = paragraphs[0].text.strip(
UPCAST_STARTING_TEXT).strip().lstrip(".").lstrip(":")
self.upcast = upcast
self.has_upcast = True
def _set_classes(self, paragraphs: list[PageElement]):
"""
Se... | Python | 1 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'Przemek Anuszek <przemas75()gmail.com>'
__copyright__ = 'Copyright 2016 Przemek Anuszek'
__license__ = 'Eclipse Public License - v 1.0 (http://www.eclipse.org/legal/epl-v10.html)'
from fbchat import Client
from fbchat.models import *
def plugin(srv, i... | Python | 1 |
amount,
auction::ARG_PUBLIC_KEY => public_key,
auction::ARG_UNBOND_PURSE => unbond_purse,
};
runtime::call_contract(contract_hash, auction::METHOD_WITHDRAW_BID, args)
}
#[no_mangle]
pub extern "C" fn call() {
let amount: U512 = runtime::get_named_arg(ARG_AMOUNT);
let public_key = runtim... | Rust | 0 |
import argparse
import re
from collections import Counter
# 加载自定义工具函数
from seanmf.utils import *
# 设置命令行参数
parser = argparse.ArgumentParser()
parser.add_argument('--text_file', default='data/data.txt', help='input text file')
parser.add_argument('--corpus_file', default='data/doc_term_mat.txt', help='term document ma... | Python | 1 |
x1f00, 0x1e00, 0x1d00, 0x1c00, 0x1b00, 0x1a80, 0x1980, 0x1880, 0x1780, 0x1700, 0x1600,
0x1500, 0x1480, 0x1380, 0x1300, 0x1200, 0x1180, 0x1080, 0x1000, 0xf00, 0xe80, 0xe00, 0xd00,
0xc80, 0xc00, 0xb80, 0xa80, 0xa00, 0x980, 0x900, 0x880, 0x800, 0x780, 0x700, 0x680, 0x600, 0x580,
0x580, 0x500, 0x480, 0x400, 0x400, 0x... | Rust | 0 |
side effects), we will process them in the order they
/// were defined.
#[derive(Debug, PartialEq, Eq, Clone)]
pub enum RedirectOrCmdWord<R, W> {
/// A redirect defined before a command name.
Redirect(R),
/// A shell word, either command name or argument.
CmdWord(W),
}
/// An error which may arise when... | Rust | 0 |
# FastAPI backend
from fastapi import FastAPI, Request
from fastapi.middleware.cors import CORSMiddleware
from utils import get_optimized_route
from typing import Dict, List
app = FastAPI()
app.add_middleware(
CORSMiddleware,
allow_origins = ["chrome-extension://*"],
allow_methods = ["*"],
expose_he... | Python | 1 |
suSWB
MSWING: Mswing
MT: Mt
MTFLAG: MtFlag
MTORISU: MtoriSU
TRIANGULAR_PRISM_BLOCK: MtryB
TRIANGULAR_PRISM_BLOCK_TARGET_LOCATION: MtryBCr
MWTRSB: MwtrSB
MYGNSB: MygnSB
NBOX: NBOX
NBOX10: NBOX10
NH: Nh
NPCSO: NpcSo
NZ... | Rust | 0 |
DATA_OPTION => {
handle_all_data_option(src, split_input)
}
ACTION_TEST_PRESENT_OPTION => {
handle_test_preset_option(src, split_input)
}
x => {
bail!(std::io::Error::new(std::io::ErrorKind::Inval... | Rust | 0 |
module::*;
mod shader;
pub use shader::*;
mod queue;
pub use queue::*;
mod command_pool;
pub use command_pool::*;
mod command_buffer;
pub use command_buffer::*;
mod fence;
pub use fence::*;
mod semaphore;
pub use semaphore::*;
mod texture;
pub use texture::*;
mod buffer;
pub use buffer::*;
mod root_signature;
... | Rust | 0 |
.await
.map_err(Error::HttpClient)
{
Ok(response) => {
match response.text().await {
Ok(body) => {
let mut http_response = HttpResponse::Ok();
http_response.append_header((http::header::CONTENT_TYP... | Rust | 0 |
"""
Author: Wenru Dong
"""
from collections import deque
from itertools import filterfalse
class Graph:
def __init__(self, num_vertices: int):
self._num_vertices = num_vertices
self._adjacency = [[] for _ in range(num_vertices)]
def add_edge(self, s: int, t: int) -> None:
self... | Python | 1 |
o::AsyncWrite)
/// for a particular [format](FormatEncode).
pub trait Encode: Sized {
/// The concrete [format](FormatEncode) to encode with.
type Format: FormatEncode;
/// The concrete data structure to encode.
type Data: ?Sized;
/// Initialize the internal state of the encoder.
fn init(d... | Rust | 0 |
s(server)
register_tax_tools(server)
register_transaction_tools(server)
register_document_tools(server)
register_company_tools(server)
register_prompts(server)
register_resources(server)
return server
# Create the MCP server instance with default settings
# but don't run it yet - that ... | Python | 1 |
'''
Description:
Implement an iterator over a binary search tree (BST). Your iterator will be initialized with the root node of a BST.
Calling next() will return the next smallest number in the BST.
7
/ \
3 15
/ \
9 20
BSTIterator iterator = new BSTIterator(root)... | Python | 1 |
(Negative),
Bytes(ValueStream),
Text(ValueStream),
Array(ValueStream),
Map(ValueStream),
Tag(Value),
Constant(Constant),
Float(Float),
Byte(Byte),
Break,
}
impl Header {
/// get the type of next element
pub fn to_type(&self) -> Type {
match self {
Header:... | Rust | 0 |
warn("%s fileds are useless." % ",".join(memeber_set))
class DashboardNoticeMode(AbstractModel):
"""仪表盘订阅通知方式
"""
def __init__(self):
r"""
:param _ReceiverType: 仪表盘通知方式。<br>
<li/>Uin:腾讯云用户<br>
<li/>Group:腾讯云用户组<br>
<li/>Email:自定义Email<br>
<li/>WeCom: 企业微信回调
:type Receive... | Python | 1 |
# Copyright Materialize, Inc. and contributors. All rights reserved.
#
# Use of this software is governed by the Business Source License
# included in the LICENSE file at the root of this repository.
#
# As of the Change Date specified in that file, in accordance with
# the Business Source License, use of this software... | Python | 1 |
import os
def logoSenai():
os.system("cls||clear")
print("\t===========")
print("\t===SENAI===")
print("\t===========\n")
while True:
logoSenai()
print("\tCALCULADORA\n")
a = int(input("Digite o 1º número: "))
b = int(input("Digite o 2º número: "))
logoSenai()
operador = input... | Python | 1 |
# coding=utf-8
import os
import re
import time
from configobj import ConfigObj
def get_bcc(inputStr: str) -> str:
bcc = 0
for i in inputStr.split(' '):
bcc = bcc ^ int(i, 16)
return f'{bcc:x}'
def get_xor(data):
result = re.sub(r"(?<=\w)(?=(?:\w\w)+$)", " ", data)
return result
def char... | Python | 1 |
with open('txt-Krilov-2025/24var13-16.txt') as file:
st = file.readline()
st = st.replace('12', '1 2').replace('21', '2 1')
st = st.split()
print(len(max(st, key=len)))
| Python | 1 |
# Transcription/test_whisper.py
import re
from pathlib import Path
import whisper
from core.acronyms import expander # once-and-for-all expansion
# --- Regex for classic A-Z acronyms (kept) ---
_ARABIC_BLOCK = "\u0600-\u06FF\u0750-\u077F\u08A0-\u08FF"
ACRONYM_REGEX = rf"(?<![0-9A-Za-z_{_ARABIC_BLOCK}])[A-Z0-9]{{2,8}... | Python | 1 |
ng_utils").setLevel(logging.WARN) # Reduce model loading logs
# else:
# logger.info("Loading checkpoint %s for evaluation", args.model_name_or_path)
# checkpoints = [args.model_name_or_path]
# logger.info("Evaluate the following checkpoints: %s", checkpoints)
# for che... | Python | 1 |
(drop_out)
else:
self.drop_out = lambda x: x
#self.mlp_dim = 1024
#self.mlp_drop = 0.1
#self.mlp_head = nn.Sequential(
#nn.LayerNorm(self.emb_dim),
#nn.Linear(self.emb_dim, self.mlp_dim),
#nn.GELU(),
#nn.Dropout(self.mlp_drop),... | Python | 1 |
len() - i && !f[i + w.len()] {
let mut matched = true;
for j in 0..w.len() {
if s[i + j] != w[j] {
matched = false;
break;
}
}
if matche... | Rust | 0 |
#!/usr/bin/env python3
"""
ttf_to_binary.py
Loads a .ttf font and renders A–Z into 6×10 cells, outputting
each row as a 6-bit Python binary literal (0bxxxxxx).
"""
import sys
import string
from PIL import Image, ImageDraw, ImageFont
CELL_W, CELL_H = 6, 10
THRESHOLD = 128
def render_to_pixels(font_path, chars):
... | Python | 1 |
#[doc = ""]
#[doc = " @return ESP_ERR_INVALID_ARG if the combination of arguments is invalid."]
#[doc = " ESP_ERR_NOT_FOUND No free interrupt found with the specified flags"]
#[doc = " ESP_OK otherwise"]
pub fn esp_intr_alloc_intrstatus(source: crate::esp_idf::std::os::raw::c_int, f... | Rust | 0 |
io_io::{AsyncRead};
#[macro_use]
extern crate log;
extern crate env_logger;
use iptables_lib as lib;
#[derive(Default)]
pub struct IptablesActorServer {
pub socket: String,
}
impl Actor for IptablesActorServer {
type Context = Context<Self>;
fn started(&mut self, _: &mut Context<Self>) {
info!... | Rust | 0 |
// # #![feature(portable_simd)]
/// # #[cfg(feature = "std")] use core_simd::Simd;
/// # #[cfg(not(feature = "std"))] use core::simd::Simd;
/// let mut vec: Vec<i32> = vec![10, 11, 12, 13, 14, 15, 16, 17, 18];
/// let idxs = Simd::from_array([9, 3, 0, 0]);
/// let vals = Simd::from_array([-27, 82, -... | Rust | 0 |
new_h, new_w)
trans_feat = self.first_s_transformer(trans_feat, flow_patches, t, new_h, new_w, output_shape)
inputs_trans_feat = {'x': trans_feat, 'f': flow_patches, 't': t, 'h': new_h, 'w': new_w,
'output_size': output_shape}
trans_feat = self.transformer(inputs_tr... | Python | 1 |
;
let b: Matrix<f64> = Matrix::new_random(200, 200);
bench.bench_function("mat200_add_mat200", move |bh| bh.iter(|| &a + &b ));
}
fn mat500_add_mat500(bench: &mut Criterion)
{
let a: Matrix<f64> = Matrix::new_random(500, 500);
let b: Matrix<f64> = Matrix::new_random(500, 500);
bench.bench_functio... | Rust | 0 |
es = SystemConfigOper().get(SystemConfigKey.IndexerSites) or []
for indexer in await SitesHelper().async_get_indexers():
# 检查站点索引开关
if not sites or indexer.get("id") in sites:
indexer_sites.append(indexer)
if not indexer_sites:
logger.warn('未开启任何有效站点,... | Python | 1 |
# src/app.py
import streamlit as st
import torch
import pickle
from model import TransformerSeq2Seq
from vocab import Vocabulary, SPECIAL_TOKENS
from infer import greedy_decode
@st.cache_resource
def load_model_and_vocab():
with open("src/src_vocab.pkl", "rb") as f:
src_vocab = pickle.load(f)
with ope... | Python | 1 |
pub fn LLVMIsFunctionVarArg(FunctionTy: LLVMTypeRef) -> LLVMBool;
pub fn LLVMGetReturnType(FunctionTy: LLVMTypeRef) -> LLVMTypeRef;
pub fn LLVMCountParamTypes(FunctionTy: LLVMTypeRef) -> ::libc::c_uint;
pub fn LLVMGetParamTypes(FunctionTy: LLVMTypeRef, Dest: *mut LLVMTypeRef);
// Core->Types->Struct... | Rust | 0 |
field_phantom: PhantomData,
};
let (index_pk, index_vk) = MarlinInst::index(&universal_srs, circ.clone()).unwrap();
println!("Called index");
let proof = MarlinInst::prove(&index_pk, circ, rng).unwrap();
println!("Called prover");
let mut inputs = Vec::new();
f... | Rust | 0 |
ut $order, usize; $($val),*) }
};
(mut $order:path; $($val:expr),* $(,)?) => {
unsafe { $crate::bits!(mut $order, usize; $($val),*) }
};
// Default order and store.
(mut $($val:expr),* $(,)?) => {
unsafe { $crate::bits!(mut Lsb0, usize; $($val),*) }
};
// Repetition syntax `[bit ; count]`.
// NOTE: `... | Rust | 0 |
For a much more complete
specification, see the [white paper](https://www.xain.io/assets/XAIN-Whitepaper.pdf).
# Coordinator
The coordinator is configurable via various settings. The project contains
various ready-made configuration files that can be used, found under the
`configs` directory of the repository. Typic... | Rust | 0 |
"""
https://www.acwing.com/problem/content/190/
"""
from collections import deque
# 预处理
c, r = map(int, input().split(" "))
area = [input().strip() for _ in range(r)]
for i in range(r):
for j in range(c):
if area[i][j] == "K":
begin = [i, j]
if area[i][j] == "H":
end = [i, j... | Python | 1 |
import os
import matplotlib.pyplot as plt
from sklearn.metrics import confusion_matrix, ConfusionMatrixDisplay, classification_report
def evaluate_and_plot(model_name, model, X_test, y_test):
# Predict
y_pred = (model.predict(X_test) > 0.5).astype("int32")
# Metrics
report = classification_report(y_te... | Python | 1 |
abel classification, but keep in mind that the goal here
# is to treat each output label as an independent Bernoulli
# distribution
model.compile(loss="categorical_crossentropy", optimizer=opt,
metrics=["accuracy"])
print(model.summary())
# train the network
print("[INFO] training network...")
H = model.fit(x=trainX... | Python | 1 |
ut dyn_img = image::GrayImage::new(self.size() as u32, self.size() as u32);
for y in 0..self.size() {
for x in 0..self.size() {
let color = match self.bit(x, y) {
true => 0,
false => 255,
};
dyn_img.get_pixel_mut... | Rust | 0 |
(Clone, Copy)]
#[repr(C)]
pub struct CameraBuffer {
pub cam_position: Vector3,
pub cam_fov_radians: f32,
pub cam_direction: Vector4,
pub z_range: Vector4,
pub view_matrix: Matrix4,
pub proj_matrix: Matrix4,
pub view_proj_matrix: Matrix4,
pub last_matrix: Matrix4,
pub inv_view_matrix:... | Rust | 0 |
except Exception as e:
print_error(f"Metadata extraction failed: {str(e)}")
def parse_exiftool_output(output):
"""Parse exiftool output into structured data"""
metadata = {}
for line in output.split('\n'):
if ':' in line:
key, value = line.split(':', 1)
... | Python | 1 |
]
#[identifier(SQLUSMALLINT, 28)]
#[allow(non_camel_case_types)]
pub struct SQL_IDENTIFIER_CASE;
impl InfoType<SQL_IDENTIFIER_CASE, SQL_OV_ODBC3> for IdentifierCase {}
unsafe impl Attr<SQL_IDENTIFIER_CASE> for IdentifierCase {
type DefinedBy = OdbcDefined;
}
unsafe impl AttrGet<SQL_IDENTIFIER_CASE> for IdentifierCa... | Rust | 0 |
StateChanged(state));
}
Err(e) => {
log::error!("Failed to set TX power enable: {}", e);
crate::send_event!(
tx,
Event::SendStat... | Rust | 0 |
0;
const SI_REG_END: u32 = 0x048F_FFFF;
const CARTDOM1_ADDR1_START: u32 = 0x0600_0000;
const CARTDOM1_ADDR1_END: u32 = 0x07ff_ffff;
const CARTDOM1_ADDR2_START: u32 = 0x1000_0000;
const CARTDOM1_ADDR2_END: u32 = 0x1f39_ffff;
const PIF_START: u32 = 0x1fc0_0000;
const PIF_END: u32 = 0x1fc0_07ff;
pub enum Addr {
... | Rust | 0 |
rs = {"X-GEWE-TOKEN": token, "Content-Type": "application/json"}
payload = {"appId": app_id, "toWxid": to_wxid, "videoUrl": video_url, "videoDuration": video_duration, "thumbUrl": thumb_url}
_LOGGER.debug(f"Sending video message to {to_wxid} with video URL: {video_url}.")
return await self._api_... | Python | 1 |
# saved as "processor_class"
_processor_class = dictionary.pop("_processor_class", None)
if _processor_class is not None:
dictionary["processor_class"] = _processor_class
return json.dumps(dictionary, indent=2, sort_keys=True) + "\n"
def to_json_file(self, json_file_path: Un... | Python | 1 |
.pool.start_transaction(opts).await?;
for balance in balances {
let amount: i32 = balance.amount.try_into()?;
let user = user_id(&balance.user);
let (new_tx, results) = self.queries.select_balance(tx, &user).await?;
tx = match results {
None => ... | Rust | 0 |
/*
pub fn seed(&mut self, seed1: i32, seed2: i32) {
let mut x = seed1;
let mut y = seed2;
for i in 1..98 {
let mut s = 0.;
let mut t = 0.5;
for _ in 1..54 {
x = 6969i32.wrapping_mul(x) % 65543;
y = 8888i32.wrapping_mul... | Rust | 0 |
olean(false)), Rc::new(Object::Integer(6))),
]
.into_iter()
.collect::<HashMap<Rc<Object>, Rc<Object>>>(),
));
assert_eq!(evaluated, expected);
}
#[test]
fn test_hash_index_expressions() {
let test_case = [
(r#"{"foo": 5}["foo"]"#, "5... | Rust | 0 |
the future it wraps.
///
/// # Notes
///
/// This type can also be created using [`Timer::wrap`], this is useful when
/// dealing with lifetime issue, e.g. when calling
/// [`actor::Context::receive_next`] and wrapping that in a `Deadline`.
///
/// # Examples
///
/// Setting a timeout for a future.
///
/// ```
/// use... | Rust | 0 |
# Copyright 2019 The Matrix.org Foundation C.I.C.
#
# 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 or a... | Python | 1 |
("$ROOT/posts/1. 2018-01-08 16-52 My first venture into crocheting, and what I've learned/".to_string(),
root.join("posts").join("1. 2018-01-08 16-52 My first venture into crocheting, and what I've learned"));
let post = BloguePost::new(dir.clone()).unwrap();
let mut center_buf = vec![];
ass... | Rust | 0 |
bbbblbbnb
6-18 b: qbjxjbrqfrwgdrzldbt
14-16 v: sprsxwphvvbvcvkv
11-17 c: dpwlccccmclbqzcptrc
13-19 w: wwwwwkwwwwwmwwzmvww
8-14 m: mdfvmpmrskvqcmvmddv
4-13 v: vvvvvvvvvgkvvvvvwvv
1-3 g: lgwqgg
1-3 r: rrrrzrr
2-4 h: hkrh
3-6 h: gwhzvhv
16-19 x: xxxxxxxxxxlxvxxxnxt
2-3 t: tttq
9-13 w: zkmpkfwwpwwwcw
7-8 n: nnjxnnnnbnhnr
5... | Rust | 0 |
ckerInsertRequest, SegmentRequest},
packer_grpc::PackerClient,
};
use grpcio::{ChannelBuilder, EnvBuilder};
#[cfg(test)]
use mockall::{automock, predicate::*};
use std::sync::Arc;
#[cfg_attr(test, automock)]
pub trait CoordintatorClientWrapper {
fn discover() -> Vec<Node>;
fn register(node: &Node);
}
#[de... | Rust | 0 |
)
# Evaluate model
test_loss, test_mae, test_mse = self.model.evaluate(X_test, y_test)
return {
'test_loss': test_loss,
'test_mae': test_mae,
'test_mse': test_mse,
'history': history.history
}
def save_model(sel... | Python | 1 |
- /path/12314/?q=ddds#123
pub const HTTP_TARGET: Key = Key::from_static_str("http.target");
/// The value of the [HTTP host header](https://tools.ietf.org/html/rfc7230#section-5.4). When the header is empty or not present, this attribute should be the same.
///
/// # Examples
///
/// - www.example.org
pub const HTTP_... | Rust | 0 |
fn format_finite<F: Float>(&mut self, f: F) -> &str {
unsafe {
let n = f.write_to_ryu_buffer(self.bytes.as_mut_ptr() as *mut u8);
debug_assert!(n <= self.bytes.len());
let slice = slice::from_raw_parts(self.bytes.as_ptr() as *const u8, n);
str::from_utf8_unchecked... | Rust | 0 |
up = parser.add_argument_group("Development Options")
dev_group.add_argument(
"--debug", "-d",
action="store_true",
help="Enable debug mode with detailed logging"
)
dev_group.add_argument(
"--reload",
action="store_true",
help="Enable auto-reload on file chang... | Python | 1 |
}
impl ::core::marker::Copy for DSEFFECTDESC {}
impl ::core::clone::Clone for DSEFFECTDESC {
fn clone(&self) -> Self {
*self
}
}
#[doc = "*Required features: `\"Win32_Media_Audio_DirectSound\"`*"]
pub const DSFXCHORUS_DELAY_MAX: f32 = 20f32;
#[doc = "*Required features: `\"Win32_Media_Audio_DirectSound\... | Rust | 0 |
}
impl ArrowNativeType for f64 {}
impl private::Sealed for f64 {}
/// Allows conversion from supported Arrow types to a byte slice.
pub trait ToByteSlice {
/// Converts this instance into a byte slice
fn to_byte_slice(&self) -> &[u8];
}
impl<T: ArrowNativeType> ToByteSlice for [T] {
#[inline]
fn to_by... | Rust | 0 |
ing: Option<u8>,
}
// Private static, so only internal function can access it.
static CONFIG: Once<CacheConfig> = Once::new();
static INIT_CALLED: AtomicBool = AtomicBool::new(false);
/// Returns cache configuration.
///
/// If system has not been initialized, it disables it.
/// You mustn't call init() after it.
pub... | Rust | 0 |
import csmp
from csmp import CompressiveSensing, DCTBasis, MP, OMP, DFTBasis
import matplotlib.pyplot as plt
def main():
original_signal = csmp.generate_test_signal(
signal_type='sinusoid',
length=256,
freq1=97,
freq2=777,
)
# Создание экземпляра CS с ДКП базисом
cs = C... | Python | 1 |
_G_IO_BUF: opt_category_group = 524288;
pub const opt_category_group_FIO_OPT_G_TIOBENCH: opt_category_group = 1048576;
pub const opt_category_group_FIO_OPT_G_ERR: opt_category_group = 2097152;
pub const opt_category_group_FIO_OPT_G_E4DEFRAG: opt_category_group = 4194304;
pub const opt_category_group_FIO_OPT_G_NETIO: op... | Rust | 0 |
import os, sys
R = '\x1b[1;31m'
N = '\x1b[0m'
Y = '\x1b[1;33m'
G = '\x1b[1;37m'
print '%s+---------------------------------------------------+%s' % (R, N)
print '%s||[#]%s--------------%s[ VBug Maker ]%s---------------%s[#]||%s' % (Y, R, Y, R, Y, N)
print '%s||%s |___________%s[ Simple Virus Maker ]%s____________|%s ||... | Python | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.