text string | label_name string | labels int64 |
|---|---|---|
rename_all = "PascalCase")]
struct MyData {
first_data: u32,
second_data: String,
third_data: f32,
}
fn main() {
let json = r#"{
"FirstData": 56,
"SecondData": "hello, world",
"ThirdData": -1.23
}"#;
let in_rust: MyData = serde_json::from_str(json).expect("JSON parsing ... | Rust | 0 |
&[u8;
libsodium_sys::crypto_box_curve25519xchacha20poly1305_NONCEBYTES
as usize],
message: &[u8],
dest_pub_key: &[u8;
libsodium_sys::crypto_box_curve25519xchacha20poly1305_PUBLICKEYBYTES
as usize],
src_sec_key: &[u8;
libsodium_sys::crypto_box_curve25519x... | Rust | 0 |
se*. See `"paper" <https://arxiv.org/pdf/1707.06990.pdf>`_.
"""
return _densenet("densenet169", 32, (6, 12, 32, 32), 64, pretrained, progress, **kwargs)
def densenet201(pretrained: bool = False, progress: bool = True, **kwargs: Any) -> DenseNet:
r"""Densenet-201 model from
`"Densely Connected Convolut... | Python | 1 |
math_ops.range(0,
math_ops.cast(outerdim, dtypes.int64) * in_lastdim,
in_lastdim), -1), dtypes.int32), [-1])
# Substitute grad to appropriate locations and fill the rest with zeros,
# finally reshaping it to the original input shape.
return [
... | Python | 1 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
import os
from pathlib import Path
from unittest.mock import patch
import pytest
# Import functions to test from local application files
from pyrit.common.download_hf_model import download_specific_files
# Define constants for testing
MODEL_ID... | Python | 1 |
#WAP that demonstrate the use of the 'the type()' function to display different basic data types.
integer_var=10
print("Type of integer_var:",type(integer_var))
float_var=3.14
print("Type of float_var:",type(float_var))
string_var="Hello, world!"
print("Type of string_var:",type(string_var))
bool_var=True
print("Type o... | Python | 1 |
dd(
0.015_854_344_243_815_501_891_425_9,
-1.046_932_722_806_315_219_088_45_e-18,
)
} else {
dd(
-0.080_745_512_188_280_785_248_473_1,
3.618_524_750_670_371_048_499_87_e-18,
)
});
x = s2 * x
... | Rust | 0 |
),
}
};
let id_str = match bson_doc.find(~"id_str") {
None => None,
Some(d) => match d {
&UString(ref i) => Some(i.clone()),
_ => return Err(~"not Person struct (id_str field not UString)"),
}
};
let val = ... | Rust | 0 |
room_id = get_room_id();
let mut response = EventBuilder::default()
.add_state_event(EventsJson::Alias)
.build_sync_response();
client.receive_sync_response(&mut response).await.unwrap();
let room = client.get_joined_room(&room_id).await.unwrap();
let room = r... | Rust | 0 |
54b1c29718841e219b7e4db7a409769d3badf10664e4710be353b414912bc5e5ed887cf61c8b27a809655fbd6ec64a9a644ba",
"edc4ee4ccefc0a621131c994afceba4bfb81d86c9fa0a2f45d8cc572ca3e19fa"
),
];
impl_short_msg_kat!(blake2, Blake2s, SHORT_MSG_KAT, Blake2s::default());
<gh_stars>1-10
fn factorial(n: u64) -> u64 {
if n == 0 {
... | Rust | 0 |
CheckExpensePermissionTool(),
GenerateBillByExpenseIdTool(),
# 报销单相关工具
GetMyRectificationBillListTool(),
GetUnfinishedDebtBillTool(),
GetAreaFieldByBillDefineIdTool(),
GetBillDataAndTemplateTool(),
CollectExpenseRecordInfoTool(),
QueryTravel... | Python | 1 |
allowed parameters
def test_heat_hcl_allowed_kwargs_unnamed():
# Test settings
settings = {"h1": 11, "h2": 12, "c1": 13, "c2": 14,
"l1": 15, "l2": 16, "p1": 17, "p2": 18}
# Ensure I test all allowed parameters
for k in heat_hcl._allowed_parameters:
# Skipping 'cmax', only testin... | Python | 1 |
#!/usr/bin/env python3
# Software License Agreement (BSD License)
#
# Copyright (c) 2019, UFACTORY, Inc.
# All rights reserved.
#
# Author: Vinman <vinman.wen@ufactory.cc> <vinman.cub@gmail.com>
"""
Description: Move Joint
"""
import os
import sys
import time
import math
sys.path.append(os.path.join(os.path.dirname(... | Python | 1 |
import os, json, torch
from datasets import load_dataset
from transformers import (
AutoTokenizer,
AutoModelForCausalLM,
TrainingArguments,
DataCollatorForLanguageModeling,
BitsAndBytesConfig,
Trainer,
)
from peft import (
LoraConfig,
PeftModel,
prepare_model_for_kbit_training,
)
MO... | Python | 1 |
back to the mini-batch
y.contiguous().view(raw_int_fs)
offsets = torch.cat(offsets, dim=0)
offsets = offsets.view([int_bs[0]] + [2] + int_bs[2:])
# case1: visualize optical flow: minus current position
h_add = Variable(torch.arange(0,float(bs[2]))).cuda().view([1, 1, bs[2], 1])... | Python | 1 |
y_status: bool = false;
let (wait_cert, wait_cert_sign) = poet2_util::get_cert_and_sig_from(&block);
debug!("Serialized wait_cert : {:?}", &wait_cert);
let deser_wait_cert: WaitCertificate = serde_json::from_str(&wait_cert).unwrap();
debug!("Deserialized wait cert : {:?}", deser_wait_ce... | Rust | 0 |
)."]
pub n: *mut ncplane,
#[doc = " the scaling is ignored if no ncplane is provided (it ought be NCSCALE_NONE"]
#[doc = " in this case). otherwise, the source is stretched/scaled relative to the"]
#[doc = " provided ncplane."]
pub scaling: ncscale_e,
#[doc = " if an ncplane is provided, y and x... | Rust | 0 |
def scroll_to_address(self, address):
line_num = address // self.bytes_per_line
visible_lines = self.height
new_start_line = max(0, line_num - visible_lines // 2)
self.start_address = new_start_line * self.bytes_per_line
self.update_view()
def highlight_range(self, start... | Python | 1 |
#!/usr/bin/env python
from distutils.log import warn as printf
from os.path import dirname
from random import randrange as rand
from sqlobject import *
from ushuffle_dbU import DBNAME, NAMELEN, randName, FIELDS, tformat, cformat, setup
DSNs = {
'mysql': 'mysql://root@localhost/%s' % DBNAME,
'sqlite': 'sqlite... | Python | 1 |
# from LIPM import func_LIPM_3D as func
import LIPM.func_LIPM_3D as func
import numpy as np
from ikine import ikineLeft, ikineRight
# from ikine import ikineLeft
# from ikine import ikineRight
def Calculate(time=6):
total_time = time
(
COM_pos_x,
COM_pos_y,
left_foot_pos_x,
left_foot_pos_y,
... | Python | 1 |
let app = App::new().service(test_app().await);
let mut app = test::init_service(app).await;
let creator = Soa::from(&basic_user(1, true)).creator().aal_medium();
let res = post(
&mut app,
"/groups/api/v1/groups",
json!({ "name": "some", "description": "some group" }),
... | Rust | 0 |
s are between 0.5 and 5.0, with increments of 0.5.
rating: f32,
/// Set to true if the member likes the film (via the ‘heart’ icon).
like: bool,
}
#[derive(Deserialize, Debug, Clone)]
#[serde(rename_all = "camelCase")]
struct LogEntryCreationRequestDiaryDetails {
/// The date the film was watched, if s... | Rust | 0 |
wMessage(status_text) # 使用 self.status_bar
except Exception as e:
QMessageBox.critical(self, "错误", f"加载目标目录失败: {str(e)}")
def save_changes(self):
"""保存更改"""
if not self.current_file_path:
return
try:
tree = ET.parse(self.current_file_path)
... | Python | 1 |
measure_name)
}
}
}
}
fn add_value_by_name(&mut self, name: String, value: u32) {
let measure_handle;
{
match self.measures_by_name.get(&name) {
Some(handle) => measure_handle = *handle,
None => {
... | Rust | 0 |
) - inters)
overlaps = inters / uni
ovmax = np.max(overlaps)
jmax = np.argmax(overlaps)
if ovmax > ovthresh:
if not R['difficult'][jmax]:
if not R['det'][jmax]:
tp[d] = 1.
R['det'][jmax] = 1
... | Python | 1 |
"""Admin texts"""
STATS = '''
📊 Статистика:
· Всего - <code>%s</code>
· Живы - <code>%s</code>
· Мертвы - <code>%s</code>
· Подписались на ОП - <code>%s</code>
· Чаты - <code>%s</code>
· Диалоги - <code>%s</code>
👤 Статистика по времени:
· За сегодня - <code>%s</code>
· За неделю - <code>%s</code>
· За месяц - <c... | Python | 1 |
static values: &'static [ChecksumTypeProto] = &[
ChecksumTypeProto::CHECKSUM_NULL,
ChecksumTypeProto::CHECKSUM_CRC32,
ChecksumTypeProto::CHECKSUM_CRC32C,
];
values
}
fn enum_descriptor_static() -> &'static ::protobuf::reflect::EnumDescriptor {
... | Rust | 0 |
="Define at least one molecule", icon='ERROR')
def draw_panel ( self, context, panel ):
""" Create a layout from the panel and draw into it """
layout = panel.layout
self.draw_layout ( context, layout )
classes = (
MCELL_OT_update_data_layout,
MCELL_OT_read_viz_d... | Python | 1 |
from sqlmodel import Field, SQLModel
from arista.db.repositories import BaseRepository
class FundingRate(SQLModel, table=True):
"""Database model for OHLC funding rate history
of multiple symbols, mutiple exchanges."""
__tablename__ = "funding_rate"
id: int = Field(default=None, primary_key=True)
... | Python | 1 |
t(src) == ['`', 'ls "', '$php', '" ls ',
'$sdf->fsdf', '`']
def test_backtick_8(self):
r = self.lex('`ls "$php" ls \'asdasd\' \'asdasd\'`')
assert r == ['`', 'T_ENCAPSED_AND_WHITESPACE',
'T_VARIABLE', 'T_ENCAPSED_AND_WHITESPACE', '`']
... | Python | 1 |
# Generated by Ollama Llama 3
# Task: queue_mda_conversion_rich
# Attempt: 5
# Success: False
# Overall Score: 0.538
# Import pyverilog and other libraries
import sys
import re
from pyverilog.ast import *
# Define classes for visitors
class FixedArrayToQueueVisitor(ASTVisitor):
def __init__(self, signal_name):
... | Python | 1 |
# n!=n X n X n X
# 5!=5*4*3*2*1
num=int(input("Enter a number : "))
fact=1
# yaha +1 iske liye use kiya he quki hue main value tak cahiye
for i in range(1,num+1):
fact=fact*i
print(f"Factorial of {num} is {fact} ") | Python | 1 |
"""
Tests for msvc support module (msvc14 unit tests).
"""
import os
from distutils.errors import DistutilsPlatformError
import pytest
import sys
@pytest.mark.skipif(sys.platform != "win32", reason="These tests are only for win32")
class TestMSVC14:
"""Python 3.8 "distutils/tests/test_msvccompiler.py" backport""... | Python | 1 |
.0, 28.0,
/// 35.0, 36.0, 37.0, 38.0,
/// 45.0, 46.0, 47.0, 48.0,
/// );
/// let b = Mat4::new(
/// vec4!(15.0, 16.0, 17.0, 18.0),
/// vec4!(25.0, 26.0, 27.0, 28.0),
/// vec4!(35.0, 36.0, 37.0, 38.0),
/// vec4!(45.0, 46.0, 47.0, 48.0),
/// );
/// assert_eq!(a, b);
/// # }
/// ```
#[macro_export]... | Rust | 0 |
ycle)
.map_err(|err| format!("Verify script error: {:?}", err))
}
}
#[cfg(test)]
mod test {
use super::*;
use ckb_crypto::secp::SECP256K1;
use ckb_hash::blake2b_256;
use ckb_jsonrpc_types as json_types;
use ckb_types::{
core::{capacity_bytes, BlockView, Capacity, HeaderView}... | Rust | 0 |
MediumDepth::new(value)
}
}
impl fmt::Display for MediumDepth {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.value())
}
}
/// Small depth (0~7).
#[derive(Debug, Clone, Copy)]
pub struct SmallDepth(u8);
impl SmallDepth {
fn range() -> Wrapper<u8> {
... | Rust | 0 |
ks if the accelerator has performed an optimization step behind the scenes
if accelerator.sync_gradients:
progress_bar.update(1)
global_step += 1
if global_step % args.save_steps == 0:
if accelerator.is_main_process:
... | Python | 1 |
let mut object_746 = object.key("AwsApiGatewayStage").start_object();
crate::json_ser::serialize_structure_crate_model_aws_api_gateway_stage_details(
&mut object_746,
var_745,
);
object_746.finish();
}
if let Some(var_747) = &input.aws_api_gateway_rest_api {
... | Rust | 0 |
#!/usr/bin/env python
# ckwg +28
# Copyright 2012-2020 by Kitware, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice... | Python | 1 |
_from_call(ok_html_input_element_or_error)?;
Process::call_code(arc_process)
}
Err(exception) => result_from_exception(arc_process, exception),
}
}
fn frame() -> Frame {
Frame::new(module_function_arity(), code)
}
fn function() -> Atom {
Atom::try_from_str("element").unwrap()
... | Rust | 0 |
g << 8) | b
}
<reponame>hug-dev/rust-spiffe<filename>spiffe/tests/uri_test.rs
extern crate spiffe;
use spiffe::uri::URI;
#[test]
fn valid_spiffe_id() {
"spiffe://example.org/path".parse::<URI>().unwrap();
}
#[test]
fn valid_spiffe_id_no_domain() {
"spiffe://example/path".parse::<URI>().unwrap();
}
#[test]
f... | Rust | 0 |
"""
Words with Functions
====================
Collect article text data and metadata, using a function oriented approach.
"""
###################################################################################################
# Function Approach: collect_words
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# The function for c... | Python | 1 |
min, f0_max):
f0, t = pyworld.harvest(
x.astype(np.double),
fs=self.sr,
f0_ceil=f0_max,
f0_floor=f0_min,
frame_period=10,
)
f0 = pyworld.stonemask(x.astype(np.double), f0, t, self.sr)
f0 = signal.medfilt(f0, 3)
return f0... | Python | 1 |
Null, run_query, ConnectorCapability};
use query_tests_setup::Runner;
#[connector_test(schema(json_opt))]
async fn basic(runner: Runner) -> TestResult<()> {
create_row(&runner, r#"{ id: 1, json: "{}" }"#).await?;
create_row(&runner, r#"{ id: 2, json: "{\"a\":\"b\"}" }"#).await?;
cre... | Rust | 0 |
#
# This file is part of pysnmp software.
#
# Copyright (c) 2005-2016, Ilya Etingof <ilya@glas.net>
# License: http://pysnmp.sf.net/license.html
#
import socket
from pysnmp.carrier.base import AbstractTransportAddress
from pysnmp.carrier.asyncio.dgram.base import DgramAsyncioProtocol
try:
import asyncio
except Impo... | Python | 1 |
import sys
from get_html_website_with_playwright import get_html_website_with_playwright
from get_website_url import *
from scrape_ads import scrape_ads
from save_ads_to_excel import save_ads_to_excel
from scrape_whitepapers import scrape_whitepapers
from save_whitepapers_to_excel import save_whitepapers_to_excel
def ... | Python | 1 |
///
/// # Arguments
///
/// * `instructions` - a list of Instructions to execute
/// * `store` - the Collection's store to operate on
/// * `indices` - mapping of the collection's Index structs to their field name.
///
/// # Example
///
/// ```rust
/// let ops = vec![
/// Instructions::Equal(
/// String::fro... | Rust | 0 |
many Option<Cow> values
/// which are a bit tricky to handle. We never turn them into Option<Cow::Owned> so we can safely
/// use these.
pub(crate) trait UnwrapBorrowedExt<'a> {
/// Does not default but requires there to be an borrowed inner value.
fn unwrap_borrowed(self) -> &'a [u8];
/// Unwraps the Cow... | Rust | 0 |
vec![vec![1, 3], vec![1, 4], vec![2, 3], vec![2, 4], vec![4, 3]]
),
3
);
}
use std::error::Error;
use std::fs;
use std::path::Path;
use heed::types::*;
use heed::{Database, EnvOpenOptions};
// In this test we are checking that we can append ordered entries in one
// database even if there i... | Rust | 0 |
x20to\x20an\x20RPC\x20error.\n\n\x0b\
\n\x03\x04\x08\x01\x12\x04\xbf\x01\x08\x18\n\x9e\x01\n\x04\x04\x08\x02\0\
\x12\x04\xc3\x01\x02\x14\x1a\x8f\x01\x20The\x20locale\x20used\x20followi\
ng\x20the\x20specification\x20defined\x20at\n\x20http://www.rfc-editor.o\
rg/rfc/bcp/bcp47.txt.\n\x20Examples\x20are:\... | Rust | 0 |
import pdb
from typing import List, Tuple
import numpy as np
import re
import tensorflow as tf
from t5x.examples.unified_io.data.data_utils import load_class_name, denormalize_boxes, \
OTHER_INSTANCE_COLORS, BK_COLORS, FIRST_OBJ_COLOR, get_default_vocabulary
VOCAB = get_default_vocabulary()
bbox_regex = re.compi... | Python | 1 |
stpair_pre() {
assert_eq!(Instruction::LDPSW_64_ldstpair_pre { imm7: 127, Rt2: 31, Rn: 31, Rt: 31, }.encode().decode(),
Instruction::LDPSW_64_ldstpair_pre { imm7: 127, Rt2: 31, Rn: 31, Rt: 31, })
}
#[test]
fn roundtrip_STNP_D_ldstnapair_offs() {
assert_eq!(Instruction::STNP_D_ldstnapair_offs { ... | Rust | 0 |
select_utxo_list: vec![],
utxo_fee_amount: 0,
}
}
}
/// A container that stores transaction fee.
#[derive(Debug, PartialEq, Eq, Clone)]
pub struct FeeData {
/// tx outputs and tx base fee.
pub txout_fee: i64,
/// utxo (tx inputs) fee.
pub utxo_fee: i64,
}
impl FeeData {
pub fn new(txout_fee: i6... | Rust | 0 |
orm_layer(dim)
mlp_hidden_dim = int(dim * mlp_ratio)
self.mlp = Mlp(in_features=dim, hidden_features=mlp_hidden_dim, act_layer=act_layer)
def forward(self, feats, xyz, batch):
# feats: [N, c]
# xyz: [N, 3]
# batch: [N]
short_cut = feats
feats = self.norm1(fe... | Python | 1 |
_step(&mut self, step: StepType) -> Result<()> {
writeln!(&mut self.writer, "{}", step)?;
let mut r = self.recorder.lock().await;
r.add_content(DOCTOR_OUTPUT_FILENAME, format!("{}\n", step));
Ok(())
}
// This represents the result of a `step`.
async fn result(&mut self, resu... | Rust | 0 |
s.sqlite3',
'NAME': BASE_DIR / 'db.sqlite3',
}
}
else:
DATABASES = {
'default': dj_database_url.parse(os.environ.get("DATABASE_URL"))
}
# Password validation
# https://docs.djangoproject.com/en/3.2/ref/settings/#auth-password-validators
AUTH_PASSWORD_VALIDATORS = [
{... | Python | 1 |
out vec4 color;
void main() {
color = v_color;
}
"
}).unwrap(),
cache_tex: Texture2d::with_format(
display,
RawImage2d {
data: Cow::Owned(... | Rust | 0 |
f.patch_embed.DW)
if self.use_abs_pos_embed:
x = x + self.absolute_pos_embed
x = self.drop_after_pos(x)
outs = []
for i, stage in enumerate(self.stages):
x, hw_shape, out, out_hw_shape = stage(x, hw_shape)
if i == 0 and self.return_stereo_feat:
... | Python | 1 |
em', models.CharField(blank=True, max_length=32, null=True, verbose_name='系统版本')),
('kernel', models.CharField(blank=True, max_length=32, null=True, verbose_name='系统内核')),
('status', models.CharField(choices=[('1', '在线'), ('2', '下线')], default='1', max_length=32, verbose_name='状态')),
... | Python | 1 |
1 _F",K@IF",KCDDTD]D]C^_F )0?K.. ) 4 4 6
"4SVH<OP] _
"M599 s$ B)B, , C,5+C' C,&C''C,N)r T)rs rt ru rv rw r& |