text string | label_name string | labels int64 |
|---|---|---|
urrency as MultiCurrency<<T as system::Trait>::AccountId>>::CurrencyId;
type BalanceOf<T> = <<T as Trait>::Currency as MultiCurrency<<T as system::Trait>::AccountId>>::Balance;
type DebitBalanceOf<T> = <<T as Trait>::DebitCurrency as MultiCurrency<<T as system::Trait>::AccountId>>::Balance;
type AmountOf<T> = <<T as ... | Rust | 0 |
4:
print("🙏🙏🙏 Enter a username that contains a minimum of 5 characters 🙏🙏🙏")
username = input("Enter a username:\n")
USER_name = username
with open(f'{USER_name}.txt', 'x') as file1:
file1.write("---Your data---")
except FileExistsError:
print("Use... | Python | 1 |
V_SEL, when set, the register value in USBPHY_PLL_SIC\\[1:0\\] will be used."]
#[inline]
pub fn trim_div_sel_override(&self) -> TRIM_DIV_SEL_OVERRIDER {
let bits = {
const MASK: bool = true;
const OFFSET: u8 = 0;
((self.bits >> OFFSET) & MASK as u32) != 0
};
... | Rust | 0 |
edge(node, n, ()).unwrap();
} else {
self.dag.add_child(node, (), Resource::new(explored));
}
}
}
Stage::Store => storage::store_resource(&mut self.dag[node]),
Stage::Done => panic!("Cannot dispatch task ... | Rust | 0 |
ializes the entity key from the row array and saves its array index.
///
/// The trait is implemented by the Toql derive for structs that can be deserialize from rows
/// R is a database row type , E the database error
pub trait TreeIndex<R, E> {
fn index<'a, I>(
descendents: I,
rows: &[R],
... | Rust | 0 |
_bar, radio,
scrollable, slider, text_input, Column, Row, Space, Text,
};
#[cfg(any(feature = "canvas", feature = "glow_canvas"))]
#[cfg_attr(
docsrs,
doc(cfg(any(feature = "canvas", feature = "glow_canvas")))
)]
pub use crate::renderer::widget::canvas;
#[cfg_attr(docsr... | Rust | 0 |
0..array.len())
.map(|i| array.get(i) == DataValue::Null)
.collect(),
))
}
BoundExpr::ExprWithAlias(expr_with_alias) => expr_with_alias.expr.eval_array(chunk),
_ => panic!("{:?} should not be evaluated in `eval_array`", ... | Rust | 0 |
pub mod allocator_metrics;
pub use self::metrics_reader::HistogramReader;
mod metrics_reader;
pub type RecordPairVec = Vec<pdpb::RecordPair>;
pub fn dump(should_simplify: bool) -> String {
let mut buffer = vec![];
dump_to(&mut buffer, should_simplify);
String::from_utf8(buffer).unwrap()
}
pub fn dump_t... | Rust | 0 |
(), 'k+', markersize=15)
plt.title('%s = %.3g' % (k, mu), fontdict={'size': 9}) # limit to 40 characters
if i % 5 != 0:
plt.yticks([])
print('%15s: %.3g' % (k, mu))
f = evolve_csv.with_suffix('.png') # filename
plt.savefig(f, dpi=200)
plt.close()
print(f'Saved {f}')... | Python | 1 |
=> return interaction.reply(&ctx, replies::EMPTY_QUEUE).await,
};
interaction
.embed(&ctx, replies::track_embed_position(&handle, "Now Playing").await)
.await
}
use clap::{App, AppSettings, Arg, SubCommand};
use std::process::exit;
fn main() {
let matches = App::new(env!("CARGO_PKG_NAME"))
.version(... | Rust | 0 |
import argparse
import sys
from model.lexer import tokenize, build_symbol_table, pretty_print
def main():
parser = argparse.ArgumentParser(description="Simple C-like lexer: outputs tokens and a symbol table or runs GUI.")
parser.add_argument("file", nargs="?", help="Path to C source file. If omitted, reads s... | Python | 1 |
return True
def is_finite(self):
"""
Return ``True`` because ``self`` is not finite.
EXAMPLES::
sage: CartanType(['A', NN]).is_finite()
False
sage: CartanType(['A', ZZ]).is_finite()
False
"""
return False
def is_affine... | Python | 1 |
from fastapi import APIRouter, Request, HTTPException
from fastapi.responses import JSONResponse
from utils.logger import logger
from utils.helpers import handle_errors
from models import storage
from utils.config import config
from typing import Dict, Any
router = APIRouter()
@router.get("/stats")
@handle_errors
asy... | Python | 1 |
oat,
_bindgen_padding_0_: [u8; 4usize],
}
impl ::std::clone::Clone for aiCamera {
fn clone(&self) -> Self {
*self
}
}
impl ::std::default::Default for aiCamera {
fn default() -> Self {
unsafe { ::std::mem::zeroed() }
}
}
#[derive(Copy, Clone)]
#[repr(u32)]
#[derive(Debug)]
pub enum a... | Rust | 0 |
or::Rgb(r, g, b)) =>
small_vec![48, 2, r as u32, g as u32, b as u32],
Background(Color::Cmy(c, m, y)) =>
small_vec![48, 3, c as u32, m as u32, y as u32],
Background(Color::Cmyk(c, m, y, k)) =>
small_vec![48, 4, c as u32, m as u32, y as u32, k as u32],
}
}
}
macro_rules! pop {
($args:ident, $n:e... | Rust | 0 |
o/crates/async-graphql">
//! <img src="https://img.shields.io/crates/v/async-graphql.svg?style=flat-square"
//! alt="Crates.io version" />
//! </a>
//! <!-- Downloads -->
//! <a href="https://crates.io/crates/async-graphql">
//! <img src="https://img.shields.io/crates/d/async-graphql.svg?style=flat-square"
//! alt="Dow... | Rust | 0 |
} else {
println!("*** ECIES Decryption Failed");
return;
}
} else {
println!("*** ECIES Encryption Failed");
return;
}
println!("Testing ECDSA");
if ecdh::ecpsp_dsa(sha, &mut rng, &s0, &m[0..17], &mut cs, &m... | Rust | 0 |
from dndme.commands import Command
class ShowSun(Command):
keywords = ["sun", "times"]
help_text = """{keyword}
{divider}
Summary: show the times of the day's notable solar events,
on the current date, at the current latitude.
Usage: {keyword}
"""
def do_command(self, *args):
almanac = self... | Python | 1 |
undation::IAsyncOperation<SecondaryAuthenticationFactorDevicePresenceMonitoringRegistrationStatus>>> {
<Self as RtActivatable<ISecondaryAuthenticationFactorDevicePresenceMonitoringRegistrationStatics>>::get_activation_factory().register_device_presence_monitoring_with_new_device_async(deviceId, deviceInstancePa... | Rust | 0 |
}
#[bench]
fn vector_get_seq_100000(b: &mut Bencher) { vector_get_seq(b, 100_000) }
fn vector_get_seq_focus(b: &mut Bencher, count: usize) {
let vec: Vector<i32> = rando().take(count).collect();
let mut focus = vec.focus();
b.iter(|| {
for i in 0..count {
let _ = focus.get(i);
}
})
}
#[bench]
... | Rust | 0 |
// lhs argument inferred from rhs
let pairs = [
(ITP::NumberLike, ITP::UInt8),
(ITP::IntegerLike, ITP::SInt32),
(ITP::Unknown, ITP::UInt64),
(ITP::Unknown, ITP::Bool)
];
for (lhs, rhs) in pairs.iter() {
// Using infer-both
... | Rust | 0 |
# This is DMOJ problem coci16c1p1
# https://dmoj.ca/problem/coci16c1p1
# Input Specification
# The first line of input contains the integer X ( 1 ≤ X ≤ 100 ) .
# The second line of input contains the integer N ( 1 ≤ N ≤ 100 ) .
# Each of the following N lines contains an integer P i ( 0 ≤ P i ≤ 10 000 ) , the number ... | Python | 1 |
Msg::Send { to_address: order.shipper.into_string(), amount: vec![order.shipping_fee] })))
}
pub fn try_dispute_broken(deps: DepsMut, info: MessageInfo, id: u32) -> Result<Response, ContractError> {
let mut order = ORDER_LIST.load(deps.storage, &id.to_string())?;
if order.status != Shipping {
return Er... | Rust | 0 |
Mode::Ccm`] for more information.
///
/// [`EncryptContext::initialize()`]: struct.EncryptContext.html#method.initialize
/// [`SealContext::initialize()`]: struct.SealContext.html#method.initialize
/// [`EncryptContext::update()`]: struct.EncryptContext.html#method.update
/// [`SealContext::update()... | Rust | 0 |
# -*- coding:utf-8 -*-
# !/usr/bin/env python
"""
Date: 2023/11/27 18:00
Desc: 东方财富网-数据中心-股东分析
https://data.eastmoney.com/gdfx/
"""
import pandas as pd
import requests
from tqdm import tqdm
def stock_gdfx_free_holding_statistics_em(
date: str = "20210630",
) -> pd.DataFrame:
"""
东方财富网-数据中心-股东分析-股东持股统计... | Python | 1 |
ror("service '{0}' not available")]
ServiceUnavailable(&'static str),
/// HTTP error.
#[error("HTTP error: {0}")]
Http(#[from] http::Error),
/// Git backend error.
#[error("backend error")]
Backend,
/// Project has no default branch.
#[error("project has no default branch")]
N... | Rust | 0 |
),
)
CloseMessageWindow()
OP_56(0x00)
FadeIn(300, 0)
SetMessageWindowPos(72, 320, 56, 3)
TalkEnd(0x00FF)
Return()
# id: 0x0004 offset: 0x2FA
@scena.Code('func_04_2FA')
def func_04_2FA():
EventBegin(0x01)
ExecExpressionWithValue(
0x0000,
0x0B,
(
... | Python | 1 |
ed temporarly and will be reverted on restart. Add MongoDb to make this permanant.")
elif query.data.startswith("close"):
if "sudo" in query.data:
if query.from_user.id in Config.SUDO:
await query.message.delete()
else:
await qu... | Python | 1 |
users_data = [
{
"id": 111,
"username": "test_user"
}
]
| Python | 1 |
# Copyright 2024 Black Forest Labs and The HuggingFace Team. 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... | Python | 1 |
color::RGB::BLUE,
color::RGB::RED,
color::RGB::GREEN,
color::RGB::CYAN,
color::RGB::MAGENTA,
color::RGB::YELLOW,
color::RGB::PINK,
color::RGB::PURPLE,
];
let color_buffer_len = COLOR_BUFFER.len();
let delta_between_ranges = (u32::MAX as usize) / color_buffer_len;
for y in 0..height {... | Rust | 0 |
import telebot
from telebot.storage import StateMemoryStorage
from telebot import custom_filters
from telebot.types import InlineKeyboardMarkup, InlineKeyboardButton
from config import (BOT_TOKEN, LINK_TO_BOT, SHORT_RULES, FULL_RULES, COMMANDS, MIN_NUM_PLAYERS, ROLES, CONTENT_TYPES,
MyStates, START... | Python | 1 |
vec.push(feature.clone());
}
}
}
vec
};
if features.is_empty() {
break;
}
let mut trial = enter_value;
while 0 < trial {
for fea... | Rust | 0 |
tokens[3]
units_info[unit_name] = {
"name": unit_name,
"loadstate": loadstate,
"activestate": activestate,
"substate": substate,
}
property_cache = {}
extra_properties = module.params['extra_properties']
if module.params['unitname']:
... | Python | 1 |
key },
bitcoin_key_2: if were_node_one { bs_bitcoin_key } else { as_bitcoin_key },
excess_data: Vec::new(),
};
}
}
macro_rules! sign_msg {
($unsigned_msg: expr) => {
let msghash = Message::from_slice(&Sha256dHash::hash(&$unsigned_msg.encode()[..])[..]).unwrap();
let as_bitcoin_sig = secp_ctx.sig... | Rust | 0 |
!(a.union(&UpTo(3)), [UpTo(3)]);
assert_eq_u!(a.union(&UpFrom(3)), [Open(0, 3), UpFrom(3)]);
assert_eq_u!(a.union(&To(3)), [To(3)]);
assert_eq_u!(a.union(&From(3)), [UpFrom(0)]);
assert_eq_u!(a.union(&Full), [Full]);
}
#[test]
fn open_left() {
le... | Rust | 0 |
::Arc<Option<crate::prelude::DataSourceContext>> {
todo!()
}
fn creation_block(&self) -> Option<crate::components::store::BlockNumber> {
todo!()
}
fn api_version(&self) -> semver::Version {
todo!()
}
fn runtime(&self) -> &[u8] {
todo!()
}
fn match_and_... | Rust | 0 |
[], &[barrier]);
end_single_time_commands(device, command_buffer)
}
fn copy_buffer_to_image(device: &Device, command_pool: &CommandPool, buffer: &Buffer,
image: &Image, width: u32, height: u32) -> VdResult<()> {
let command_buffer = begin_single_time_commands(command_pool)?;
let image_subresourc... | Rust | 0 |
_matches('l').parse::<i32>().unwrap();
continue;
}
if argument.starts_with("-findprior") {
params.prior_bitmask_detection = 1;
continue;
}
if argument.starts_with("-findspeed=") {
params.cdf_adaptation_detection = argument.trim_matches('-').trim_matches('f... | Rust | 0 |
fn another_type() {
let mut list = List::new();
list.push("hi");
list.push("there");
assert_eq!("there", list.pop().unwrap());
assert_eq!("hi", list.pop().unwrap());
}
#[test]
fn iteration_into_iter() {
let mut list = List::new();
list.push("hi");
... | Rust | 0 |
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from typing_extensions import TypedDict
from unstructured_client.types import BaseModel
class QdrantCloudDestinationConnectorConfigTypedDict(TypedDict):
api_key: str
batch_size: int
collection_name:... | Python | 1 |
import types
import pandas as pd
import pytest
from datetime import datetime, timedelta
from lumibot.entities import Asset
from lumibot.data_sources.projectx_data import ProjectXData
class DummyClient:
def history_retrieve_bars(self, contract_id, start_datetime, end_datetime, unit, unit_number, limit, include_par... | Python | 1 |
csv::ReaderBuilder::new()
.has_headers(false)
.delimiter(b'|')
.from_reader(dmp);
let mut stmts: Vec<String> = vec![String::from("BEGIN;")];
for (i, result) in tsv_rdr.records().enumerate() {
if i > 1 && i % 1000 == 0 {
stmts.push(String::... | Rust | 0 |
# -*- coding: utf-8 -*-
import pygcb
def CreateDBObject():
dbObj=pygcb.tcAcousticModel()
dbObj.databaseClass='BK165'
dbObj.xSpeed_kts=[0.000000,3.656000,12.796000,18.280001]
dbObj.ySL_dB=[89.720001,94.144348,125.114784,133.963486]
dbObj.speedMinNL_kts=8.540000
dbObj.NL_min=49.720001
dbObj.sp... | Python | 1 |
l_inspect_dir(
root_local_path=tmp_path,
storage_path=run_config.storage_path,
storage_filesystem=storage_filesystem,
)
# First, inspect that the result object returns the correct paths.
print(result)
run_path = result.path
assert run_path.startswith(storage_... | Python | 1 |
Some(res) => res,
None => {
invalid_input();
return 0;
}
};
idx += i;
let overflow = if CHECK_SIGN {
overflow || (num as c_long).is_negative()
} else {
overflow
};
// account for the... | Rust | 0 |
Repr::EchoReply { seq_no, data, .. } = icmp_repr {
if buf.len() < mem::size_of::<u16>() + data.len() {
return Err(SyscallError::new(syscall::EINVAL));
}
NetworkEndian::write_u16(&mut buf[0..2], seq_no);
for i in 0..data.len() {
... | Rust | 0 |
class Solution:
def minTaps(self, n: int, ranges: List[int]) -> int:
nums = [0] * (n + 1)
for i, range_ in enumerate(ranges):
l = max(0, i - range_)
r = min(n, range_ + i)
nums[l] = max(nums[l], r - l)
ans = 0
end = 0
farthest = 0
for i in range(n):
farthest = max(fa... | Python | 1 |
io::Result<()> {
let data = b"\
@fqlib:1/1
ACGT
+
FQLB
";
let mut reader = Reader::new(&data[..]);
let mut record = Record::default();
reader.read_record(&mut record)?;
assert_eq!(record.name(), b"@fqlib:1/1");
assert_eq!(record.sequence(), b"ACGT");
assert_eq!... | Rust | 0 |
Quoted(i),
c if c.is_whitespace() => State::Whitespace,
_ => State::Identifier(istart),
},
State::Quoted(istart) => match c {
'"' => State::Whitespace,
_ => State::Quoted(istart),
},
};
match (state, new... | Rust | 0 |
from fastapi import FastAPI
from pydantic import BaseModel, root_validator, Field
app = FastAPI()
class User(BaseModel):
username: str = Field(..., title='姓名', description='姓名字段需要长度大于6且小于等于12', max_length=12, min_length=6, example="Foo")
age: int = Field(..., title='年龄', description='年龄需要大于18岁', ge=18, examp... | Python | 1 |
ignore_level = 0
if level == 1:
current_dir = os.path.join(tmp_dir, name)
if self.fix_garbled:
current_dir = self.replace_special_chars(current_dir)
pre_level = level
pre_item_type = 'dir'
... | Python | 1 |
from pathlib import Path
from ConfigSpace import ConfigurationSpace
from smac import Scenario
from dataclasses import dataclass
@dataclass
class OptimizationProblemParameters:
name: str = "water_model"
output_directory: str = "outputs"
deterministic: bool = True
termination_cost_threshold: float = ... | Python | 1 |
None, ptr::null_mut(),
ptr::null_mut()) {
SQLITE_OK => assert!(false),
_ => assert_eq!(c_str!(sqlite3_errmsg(database)),
&c_string!(r#"unrecognized token: ":""#)[..]),
}
}
unsafe fn test_workflow(database: *mut sqlite3) {
{
let query = c_s... | Rust | 0 |
from maya import cmds
def delete_blendshape(morph_mesh, blendshape):
if morph_mesh and cmds.getAttr(f"{morph_mesh}.visibility") == 0:
cmds.showHidden(morph_mesh)
if cmds.objExists(blendshape):
cmds.delete(blendshape)
def create_blendshape(base_mesh, morph_mesh, name, alias):
blendshape ... | Python | 1 |
type parameter for `gen_spec_t`, it is not generic.
fn gen_spec_t(_s: SGen<A>) {}
// Because `i32` is not a generic type, this function is also not generic.
fn gen_spec_i32(_s: SGen<i32>) {}
// This function is generic over `T`.
fn generic<T>(_s: SGen<T>) {}
pub fn functions() {
//
}
use colorful::Colorful;... | Rust | 0 |
KeyCode::KeyN,
"O" => KeyCode::KeyO,
"P" => KeyCode::KeyP,
"Q" => KeyCode::KeyQ,
"R" => KeyCode::KeyR,
"S" => KeyCode::KeyS,
"T" => KeyCode::KeyT,
"U" => KeyCode::KeyU,
"V" => KeyCode::KeyV,
"W" => KeyCode::KeyW,
"X" => KeyCode::KeyX,
"Y" => KeyCode::KeyY,
"Z" => KeyCode::KeyZ,
... | Rust | 0 |
l/{msg3.id}_message.txt") == "hello"
assert (await helper.stat(f"tmtc/all/{msg3.id}_message.txt")).st_size == 5
msg3 = await client.edit_message(
TESTING_CHANNEL, message=msg3.id, text="hello hello", file=files.Hummingbird
)
assert (await helper.stat(f"tmtc/all/{msg3.id}_m... | Python | 1 |
input_socket_addr,
mut archive,
mut video,
chat,
} = config;
let mut handles = Vec::with_capacity(4);
let (archive_tx, archive_rx) = unbounded_channel();
archive.archive_live_chat = false;
let mut archivist = Archivist::new(ipfs.clone(), archive_rx);
let archive_han... | Rust | 0 |
#
# This file is part of CasADi.
#
# CasADi -- A symbolic framework for dynamic optimization.
# Copyright (C) 2010-2014 Joel Andersson, Joris Gillis, Moritz Diehl,
# K.U. Leuven. All rights reserved.
# Copyright (C) 2011-2014 Greg Horn
#
# CasADi is free software; you can... | Python | 1 |
from dataclasses import dataclass
from enum import Enum
from functools import partial, wraps
from typing import Any, Callable, Coroutine
HANDLER = Callable[..., Coroutine | Any] | partial
@dataclass
class Endpoint:
name: str
handler: HANDLER
postroute: Callable | None = None
class Router:
def __ini... | Python | 1 |
en_clip))[0])
+ "\n\n"
)
f.write("Histogram of GT - Pred per action:\n")
for i in range(len(np.unique(gt))):
f.write("{}: {} - {}\n".format(i, (gt == i).sum(), (pred == i).sum()))
f.write("Confusion matrix:\n")
f.write(
np.array2string(confmat,... | Python | 1 |
() {
let mut arr = [0u8; 17];
arr[0] = 1;
let expected = Fr::from_be_bytes_mod_order(&arr);
assert_eq!(TWO_POW_128, expected)
}
}
<reponame>dustinknopoff/bashdoc<gh_stars>10-100
//!# BashDoc
//!
//!A tool for generating documentation/help menu for ~~user defined bash functions~~ any ... | Rust | 0 |
import sys
import struct
Import("env")
# Parse input and create UF2 file
def create_uf2(source, target, env):
# source_hex = target[0].get_abspath()
source_hex = target[0].get_string(False)
source_hex = '.\\'+source_hex
print("#########################################################")
print("Crea... | Python | 1 |
rom<Gene> for String {
fn from(gene: Gene) -> String {
gene.markers
.iter()
.map(|m| String::from(*m))
.collect::<String>()
}
}
/// Convert string to Gene
///
/// # Examples
///
/// ```
/// use genome::Gene;
///
/// let gene1 = Gene::new(2);
///
/// let gene_str = St... | Rust | 0 |
ns_mem, dest_uuid, &dest_user, Currency::CHEESE, cheese_delta);
db::incr_user_currency(&mut server_state.db, trans_mem, dest_uuid, &dest_user, Currency::GEMS, gem_delta);
com::cheese_award(&mut server_state.db, trans_mem, dest_id, Some(src_id), cheese_delta, gem_delta)?;
}
} else {
db::incr_u... | Rust | 0 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
comment: 椭球参数类
@author: GanAH 2020/7/25.
@version 1.0.
@contact: dinggan@whu.edu.cn
"""
class Ellipsoid(object):
def __init__(self, WGS84=None, CGCS2000=None, internationalEllipsoid_1975=None, krasovskiEllipsoid=None,
userPrivateEllipsoid=None):... | Python | 1 |
import os
import shutil
from conan import ConanFile
from conan.tools.build import can_run
from conan.tools.files import *
from conan.tools.layout import basic_layout
class TestPackageConan(ConanFile):
settings = "os", "arch", "compiler", "build_type"
_targets = ("c64", "apple2")
def build_requirements(... | Python | 1 |
, ptr::null_mut::<c_void>()) }
}
fn run_javascript_with_callback<F: Fn(Result<JavascriptResult, error::Error>) + 'static>(&self, script: &str, callback: F) {
let trampoline: AsyncCallback = unsafe { transmute(async_ready_trampoline as usize) };
let f: Box_<Box_<Fn(Result<JavascriptResult, error... | Rust | 0 |
"expected {:?}, found {:?}",
std::any::type_name::<Self>(),
c
))),
}
}
}
impl<T: TryExtractFrom<Value> + StoreWrapped, const N: usize> TryExtractFrom<Value> for [T; N] {
fn try_extract_from(c: Value) -> Result<Self, TryExtractFromError> {
match c ... | Rust | 0 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
DOCUMENTATION = '''
---
module: ibm_is_instance_network_interfaces_info
for_more_info: refer - https://registry.terraform.io/providers/IB... | Python | 1 |
///
/// let mut root = Root::initializer().size(80, 50).init();
///
/// root.print_ex(1, 1, BackgroundFlag::None, TextAlignment::Left,
/// "Text aligned to left.");
///
/// root.print_ex(78, 1, BackgroundFlag::None, TextAlignment::Right,
/// "Text aligned to right.");
///
/// root.print_ex(... | Rust | 0 |
24_bytes(v:[u8;3]) -> SampleT {
(i32::from_le_bytes([v[0],v[1],v[2],0]) as SampleT) / ((1 << 23) as SampleT - 1.0)
}
/// Converts a `SampleT` to an `i24`.
pub fn sample_to_i24(s: SampleT) -> i32 {
(s * ((1<<23) as SampleT - 1.0)).round() as i32
}
/// Converts a `SampleT` to raw little-endian bytes.
pub fn samp... | Rust | 0 |
wait::waitpid(Some(child), None);
match result {
Ok(wait_status) => {
if let wait::WaitStatus::Exited(_pid, r) = wait_status {
final_return.get_or_insert(r);
};
}
Err(e) => {
... | Rust | 0 |
size, desc_list)
def free(self) -> None:
"""Free this virtual address range."""
if not self._is_freed and self._ptr is not None:
try:
cuMemAddressFree(self._ptr, self._size)
except Exception:
# If free fails, still mark as freed to avoid r... | Python | 1 |
(count)
}
}
pub trait TLVWireItemReader
where
Self: Sized,
{
fn decode<R: Read>(r: &mut R, len: usize) -> std::io::Result<Self>;
fn decode_tlv<'a, R: Read>(
reader: &mut PeekReader<'a, R>,
tlv_type: u64,
) -> std::io::Result<Option<Self>> {
loop {
use std::cmp::Or... | Rust | 0 |
LE_W, XM_SWIZZLE_Z, XM_SWIZZLE_W)>::XMVectorSwizzle(MT.r[1]);
V1[2] = <(XM_PERMUTE_0Y, XM_PERMUTE_0W, XM_PERMUTE_1Y, XM_PERMUTE_1W)>::XMVectorPermute(MT.r[3], MT.r[1]);
V0[2] = <(XM_PERMUTE_0X, XM_PERMUTE_0Z, XM_PERMUTE_1X, XM_PERMUTE_1Z)>::XMVectorPermute(MT.r[2], MT.r[0]);
let mut D0: XMVECTO... | Rust | 0 |
h), dtype=np.float32)
x = np.arange(width)
delta = 10
gamma = 3
for y in range(height):
A = 1.0
y0 = 0.05 + 0.01 * np.random.randn()
offset = curvature * ((y - height / 2) ** 2) / height**2 # courbure quadratique
rayleigh_pos = width // 2 + offset
signal = (
... | Python | 1 |
_CTL_W<'a> {
w: &'a mut W,
}
impl<'a> OCRAM_CTL_W<'a> {
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub unsafe fn bits(self, value: u8) -> &'a mut W {
self.w.bits = (self.w.bits & !0x0f) | ((value as u32) & 0x0f);
self.w
}
}
#[doc = "Select 128-bit dcp key from 256-bit... | Rust | 0 |
]
);
set_move_name_test!(
set_move_name_75,
75,
"ABCDEFGHIJ",
0xB02A4,
vec![0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89]
);
set_move_name_test!(
set_move_name_76,
76,
"ABCDEFGHI",
0xB02AF,
vec![0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88]
);
set_move_name_... | Rust | 0 |
let target: Result<Artifact> = "de.kinch:my-artifact:1.2.3".parse();
assert_eq!(
target,
MavenError::invalid_input(
"Sorry, parsing of artifact specification with version number is not yet supported. Input: 'de.kinch:my-artifact:1.2.3'. Only supported: <GROUP>:<V... | Rust | 0 |
Character {
fn from(item: char) -> Self {
let code: usize = get_font_code(item as usize);
Character {
code: code,
encoding: FONT_FACE[code],
matrix: util::to_bit_matrix(&FONT_FACE[code]),
}
}
}
impl fmt::Display for Characters {
fn fmt(&self, f:... | Rust | 0 |
ield("wait_until", &self.wait_until)
.field("wait_async", &self.wait_async)
.field("wait_finish", &self.wait_finish)
.field("map", &self.map)
.field("light_map", &self.light_map)
.field("light_map_broken", &self.light_map_broken)
.field("zip", &self.zip)
.f... | Rust | 0 |
Ice_Cliff_Chasms = [
(2806.4, -24738.7), (642.3, -21087.6), (-2704.9, -18797.3),
(-5422.0, -15837.4), (-5356, -16526), (-2625, -16987),
(-5556.3, -11772.9), (-5356, -16526), (-4496, -10822),
(-5556.3, -11772.9), (-5356, -16526), (-4496, -10822),
(-1637.8, -12665.2), (1870.... | Python | 1 |
ub fn is_agc_lut_1_agc_level_2_lo_default(&self) -> bool {
*self == AGC_LUT_1_AGC_LEVEL_2_LO_A::AGC_LUT_1_AGC_LEVEL_2_LO_DEFAULT
}
}
#[doc = "Write proxy for field `AGC_LUT_1_AGC_LEVEL_2_LO`"]
pub struct AGC_LUT_1_AGC_LEVEL_2_LO_W<'a> {
w: &'a mut W,
}
impl<'a> AGC_LUT_1_AGC_LEVEL_2_LO_W<'a> {
#[doc... | Rust | 0 |
ef where(self, ctx): # Output: <Nothing>
await ctx.send('on Discord')
@commands.command()
async def why(self, ctx): # Output: <Nothing>
await ctx.send('because someone made me')
bot.add_cog(What())
"""
def decorator(func: Command | CoroFunc) -> ... | Python | 1 |
, ADDR1),
Uint128::from(40u128)
);
assert_eq!(
query_total_staked(&app, &staking_addr),
Uint128::from(40u128)
);
assert_eq!(get_balance(&app, &cw20_addr, ADDR1), Uint128::from(50u128));
// Cannot claim when nothing is available
let inf... | Rust | 0 |
from fastapi import HTTPException, status
from panda_plugins.base.work_node_registery import ALL_WORK_NODES
from panda_server.models.all_plugins_response import AllPluginsResponse, PluginInfo, PluginGroup
import traceback
import logging
# 定义 collection 名称
COLLECTION_NAME = "plugins"
# 获取 logger
logger = logging.getLo... | Python | 1 |
tton
xRect = pygame.draw.rect(gameWindow, SCOREBOARD_GREEN, (WIDTH_MIDDLE + 217, HEIGHT_MIDDLE - 137, 20, 20), 0, 5)
drawText("Bold", "X", 30, X_RED, (WIDTH_MIDDLE + 220, HEIGHT_MIDDLE - 135))
# Drawing the menu button
menuRect = pygame.draw.rect(gameWindow, BLUE2, (WIDTH_MIDDLE - 180, ... | Python | 1 |
/ use derived::Ctor;
///
/// #[derive(Ctor)]
/// struct MyStruct {
/// int: u32,
/// unsigned_int: i32,
/// }
///
/// let ms = MyStruct::new(1, -1);
/// assert_eq!(ms.int, 1);
/// assert_eq!(ms.unsigned_int, -1);
/// ```
///
/// # Attributes
///
/// The following attributes are available:
/// - `#[ctor_const]`:... | Rust | 0 |
# Copyright (C) 2025 Matthew Jennings
# 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 agreed to in wri... | Python | 1 |
"/ax"));
/// # let _ = remove_file(format!("{}{}", DATABASE_LOCATION, "/key1_2"));
/// # let _ = remove_file(format!("{}{}", DATABASE_LOCATION, "/key2_3"));
/// // Create a database with a maximum capacity of `[2, 5, 3, 2]`
/// cql_db::create_db::<U64>(
/// DATABASE_LOCATION,
/// &[2, 5, 6]
/// )?;
///... | Rust | 0 |
)
fn index_mut(&mut self, (x, y): (usize, usize)) -> &mut RGB {
&mut self.pixels[x + y * self.width]
}
}
impl core::ops::Index<usize> for Bitmap {
type Output = [RGB];
// index by row to get a whole line of pixels (origin at top)
fn index(&self, row: usize) -> &[RGB] {
&self.pixels[(row * self.width).... | Rust | 0 |
= "wasm32")]
pub extern "C" fn wasm_decode_call(offset: i32) -> i32 {
wasm_func_call!(decode_call, offset)
}
/// ## WASM Buffer Allocation
///
/// Allocates a new WASM Buffer holding data of `length` bytes.
///
/// For more info read: `api::wasm::alloc`
#[no_mangle]
#[cfg(target_arch = "wasm32")]
pub extern "C" f... | Rust | 0 |
TECHNO': u'1', 'GWALCHEM': u'1', 'VARUNSHIP': u'1', 'BATAINDIA': u'1', 'GOLDENTOBC': u'1', 'HDFCBANK': u'1', 'RICOAUTO': u'1', 'BALMLAWRIE': u'1', 'POLARIND': u'1', 'PANORAMUNI': u'1', 'KALSTEELS': u'1', 'MAYTASINFR': u'1', 'NAVINFLUOR': u'1', 'SMSPHARMA': u'1', 'PITTILAM': u'1', 'THOMASCOOK': u'1', 'GSFC': u'1', 'GDL'... | Python | 1 |
from os import path as ospath
import subprocess
import shutil
## @class USBDevice
# @brief A class used to simulate a USB device.
class USBDevice():
## @brief Constructor for the USBDevice class.
# @param img_path Path to the image file.
# @param mount_point Mount point for the image.
# @param ima... | Python | 1 |
(town, -ctx.truehp(t));
ctx.remove(t);
ctx.setWeapon(town, t);
}
Self::lobotomize => {
ctx.fx(t, Fx::Sfx(Sfx::lobo));
ctx.fx(t, Fx::Lobotomize);
ctx.lobo(t);
ctx.set(t, Flag::psionic, false);
}
Self::locket => {
if ctx.get(c, Stat::frozen) == 0 {
let mode = ctx.get(c, Stat::... | Rust | 0 |
://www.reddit.com{}/{}/.json?{}",
subreddit_string, sorting, query_string
);
let data_header = format!(
"Authorization: Basic {}",
self.client_credentials.client_secret
);
let answer = get(&url, &... | Rust | 0 |
import my
import tp
def tp_init(name):
text_long_name = "cursor"
self = tp.Tp(name, text_long_name)
# begin sort marker
my.gfx_ascii_shown(self, True)
my.gfx_pixelart_animated(self, True)
my.gfx_pixelart_reflection(self, True)
my.gfx_pixelart_shadow(self, True)
my.gfx_pixelart_show_out... | Python | 1 |
idx_this = idx_unshuffle.view(num_gpus, -1)[gpu_idx]
return x_gather[idx_this]
def forward(self, im_q, im_k, testing=False):
"""
Input:
im_q: a batch of query images
im_k: a batch of key images
Output:
logits, targets
"""
# compu... | Python | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.