text string | label_name string | labels int64 |
|---|---|---|
{
return Err(Error::Unauthorized);
}
if authorized {
STORAGE.write().custodians.insert(principal);
} else {
STORAGE.write().custodians.remove(&principal);
}
Ok(())
}
#[derive(CandidType, Deserialize, Debug)]
enum DipError {
Unauthorized,
InvalidTokenId,
ZeroAddr... | Rust | 0 |
grad_scaler.step(optimizer)
grad_scaler.update()
optimizer.zero_grad(set_to_none=True)
losses.append(loss.item())
self.assertTrue(losses == sorted(losses, reverse=True))
common_utils.instantiate_parametrized_tests(NcclDistributedFusedLAMB)
class NcclDistributedFusedLAMB_p... | Python | 1 |
# Copyright (c) Facebook Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""isort:skip_file"""
from .transformer_config import (
TransformerConfig,
DEFAULT_MAX_SOURCE_POSITIONS,
DEFAULT_MAX_TARGET_POSITIO... | Python | 1 |
"""
Pytest configuration and fixtures for Secret's Garden tests.
This module provides shared fixtures and configuration for the test suite,
including temporary vaults, mock data, and test utilities.
"""
import os
import tempfile
from collections.abc import Generator
from pathlib import Path
import pytest
from secre... | Python | 1 |
_bound_lifetimes(&* it) };
_visitor.visit_path(&_i . trait_ref);
}
pub fn visit_qself<V: Visitor + ?Sized>(_visitor: &mut V, _i: &QSelf) {
// Skipped field _i . lt_token;
_visitor.visit_ty(&_i . ty);
// Skipped field _i . position;
// Skipped field _i . as_token;
// Skipped field _i . gt_token;... | Rust | 0 |
distance = distance_squared(point, &compare.1);
if distance < shortest_distance {
shortest_distance = distance;
index = compare.0;
}
}
return index;
}
return 0; // Should never hit this due to the assertion of the precondition
}
/*
Calcul... | Rust | 0 |
import os
import glob
from webdnn.optimization_pass import OptimizationPassResult
class OptimizationPassResultWasm(OptimizationPassResult):
def write_code(self, root_directory: str):
self.remove_code(root_directory)
directory = os.path.join(root_directory, "src/descriptor_runner/operators/wasm/oper... | Python | 1 |
# coding: utf-8
"""
Control-plane
API Documentation # noqa: E501
OpenAPI spec version: 1.0
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import unittest
import swagger_client
from swagger_client.models.vcs_account_update_request i... | Python | 1 |
y step, provide your answer and your confidence in this answer. Note: The confidence indicates how likely you think your answer is true.\nUse the following format to answer:\n```\nExplanation: [insert step-by-step analysis here]\nAnswer: [ONLY the answer as short as possible; not a complete sentence]\nConfidence: [Your... | Python | 1 |
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the Apache License, Version 2.0
# found in the LICENSE file in the root directory of this source tree.
import logging
import os
import sys
from dinov2.eval.linear import get_args_parser as get_linear_args_parser
from dinov2.lo... | Python | 1 |
ings) > 0 else 1536
self.index = faiss.IndexFlatL2(dimension)
self.index.add(self.embeddings.astype('float32'))
faiss.write_index(self.index, self.index_file)
except Exception as e:
print(f"Error creating index: {e}")
def preprocess_financial_data(self, text)... | Python | 1 |
::from(*last_block),
job_data,
).execute(self.0.conn()).await?;
Ok(())
}
pub async fn mark_stale_jobs_as_idle(&mut self) -> QueryResult<()> {
sqlx::query!(
"UPDATE prover_job_queue SET (job_status, updated_at, updated_by) = ($1, now(), 'server_clean_idle')
... | Rust | 0 |
ush(NewAccessLog::layer())
.instrument(|t: &T| debug_span!("http", v = %Param::<Version>::param(t)))
.push(http::NewServeHttp::layer(h2_settings, rt.drain.clone()))
.push_on_service(svc::BoxService::layer())
.push(svc::ArcNewService::layer())
})
... | Rust | 0 |
pub truncate_lsn: Lsn,
// Safekeeper starts receiving WAL from this LSN, zeros before it ought to
// be skipped during decoding.
pub wal_start_lsn: Lsn,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct SafeKeeperStateV4 {
#[serde(with = "hex")]
pub tenant_id: ZTenantId,
/// Zenith... | Rust | 0 |
}
tested += 1;
}
assert!(tested > 0);
}
<gh_stars>100-1000
#![feature(test)]
extern crate test;
use std::fs;
use test::Bencher;
#[bench]
fn bench_taplo_parse_validate(b: &mut Bencher) {
let src = fs::read_to_string("../test-data/example.toml").unwrap();
b.iter(|| taplo::parser::par... | Rust | 0 |
202),
]
}
}
impl service::cmif::IClientObject for ApplicationDisplayService {
fn new(session: sf::Session) -> Self {
Self { session }
}
}
impl IApplicationDisplayService for ApplicationDisplayService {
fn get_relay_service(&mut self) -> Result<mem::Shared<dyn sf::IObject>> {
ip... | Rust | 0 |
import numpy as np
import matplotlib.pyplot as plt
plt.rcParams["font.family"] = "Times New Roman"
if __name__ == '__main__':
SMALL_SIZE = 6
MEDIUM_SIZE = 14
BIGGER_SIZE = 14
LINE_OTHERS = 2.5
LINE_OURS = 4.5
plt.rc('font', size=SMALL_SIZE)
plt.rc('axes', titlesize=SMALL_SIZE)
plt.rc... | Python | 1 |
me + "]" + "准备分享任务成功,正在执行分享...")
url = "https://nebula.kuaishou.com/rest/n/nebula/daily/report?taskId=122"
request = urllib.request.Request(url=url, headers=headers)
response = urllib.request.urlopen(request)
str_result = response.read().decode('UTF-8')
json_a... | Python | 1 |
sume)
.or(patrons)
.or(jsonfeed.or(atom.or(sitemap)).or(rss))
.or(favicon.or(robots).or(sw))
.or(contact)
.map(|reply| {
warp::reply::with_header(
reply,
"Cache-Control",
"public, max-age=86400, stale-if-error=60",
... | Rust | 0 |
# Programa 10 List Membership
# Fecha: 2024/10/31
# Elaborado por: Evelyn Jocelyn León de Luna
nombres = ["Choto", "Emilio", "Luis"]
print("Luis" in nombres) #True
print("Emi" in nombres) #False
print("Javier" in nombres) #False
print("Jose" not in nombres) #True
| Python | 1 |
dgen::Builder::new()
.with_config(
cbindgen::Config::from_file(crate_dir.join("cbindgen.toml"))
.expect("Unable to read cbindgen config"),
)
.with_crate(crate_dir)
.generate()
.expect("Unable to generate bindings")
.write_to_file("nanorand.h");
}
<reponame>Darth-Knoppix/chit
use super::super::format;... | Rust | 0 |
::{log_init, Progress},
show::show_tree,
store::{parse_store, Store, StoreTags, StoreVersion, TempLoader, Version},
suretree::AttMap,
};
mod errors;
mod escape;
mod hashes;
pub mod node;
mod progress;
mod show;
mod store;
mod surefs;
mod suretree;
// Some common operations, abstracted here.
/// Perform a... | Rust | 0 |
fid = device_id & 0xFFF;
Ok((pn, mfid))
}
/// Get the chip ID
///
/// Returns the (revision, device, firmware) as a tuple
pub fn chip_id(&mut self) -> Result<(u8, u8, u8), Error<E>> {
let regs = self.read_registers()?;
let chip_id = regs[Register::CHIP_ID];
let rev =... | Rust | 0 |
izer: D) -> Result<T, D::Error>
where
T: FromStr,
T::Err: Display,
D: Deserializer<'de>,
{
let s = String::deserialize(deserializer)?;
T::from_str(&s).map_err(de::Error::custom)
}
pub fn split_serialize<S>(clusters: &Option<Vec<String>>, s: S) -> Result<S::Ok, S::Error>
where
S: Serializer,
{
... | Rust | 0 |
lign=\"center\">前</p></body></html>',
'English':'<html><head/><body><p align=\"center\">Front</p></body></html>'},
'label_servoR_7':{'Chinese':'<html><head/><body><p align=\"center\">后</p></body></html>',
'English':'<html><head/><body><p align=\"center\">B... | Python | 1 |
pub const GDK_KEY_Hangul_KkogjiDalrinIeung: c_int = 3827;
pub const GDK_KEY_Hangul_Mieum: c_int = 3761;
pub const GDK_KEY_Hangul_MultipleCandidate: c_int = 65341;
pub const GDK_KEY_Hangul_Nieun: c_int = 3748;
pub const GDK_KEY_Hangul_NieunHieuh: c_int = 3750;
pub const GDK_KEY_Hangul_NieunJieuj: c_int = 3749;
pub cons... | Rust | 0 |
stant in km/s/Mpc
Omega_m = 0.315 # Matter density parameter
Omega_r = 0.000092136 # Radiation density parameter
Omega_lambda = 1. - Omega_m - Omega_r # Dark energy density parameter
today = 13.842 # Age of the universe in Gyr
a0 = 1.0 # Scale factor today
ainit = 1e-10 # Initial scale fac... | Python | 1 |
}
if file_path.extension().is_none() {
println!("File {} isn't a pcap.", file);
continue;
}
println!("File {} found.", file);
let config_folder: PathBuf = get_app_dir();
let config = config::get_config(config_folder);
... | Rust | 0 |
# coding: utf-8
from __future__ import (
absolute_import,
print_function,
unicode_literals,
)
from pydocx.openxml.packaging.font_table_part import FontTablePart
from pydocx.openxml.packaging.footnotes_part import FootnotesPart
from pydocx.openxml.packaging.image_part import ImagePart
from pydocx.openxml.pa... | Python | 1 |
) == 0i32 {
return s.offset(length as isize);
}
ptr::null()
}
#[inline]
pub(crate) unsafe extern "C" fn streq_ptr(s1: *const i8, s2: *const i8) -> bool {
if !s1.is_null() && !s2.is_null() {
return libc::strcmp(s1, s2) == 0i32;
}
false
}
mod xetex_font_info;
mod xetex_font_manager;
... | Rust | 0 |
r supervisor
let event = supervisor::Event::RegisterReporters(node_registry, self.address.clone());
self.supervisor_tx.send(event).unwrap();
}
}
}
}
}
}
pub fn gen_node_id(address: &str) -> NodeId {
let addr... | Rust | 0 |
m-major
A = A.T.contiguous().T
avg_k = total_k / num_groups
B = torch.randn((total_k, n), device=device, dtype=input_dtype) / math.sqrt(avg_k)
out = torch.randn((num_groups, m, n), device=device, dtype=input_dtype)
if alpha_is_tensor:
alpha = torch.tensor(alpha, device=device, dtype=torch.f... | Python | 1 |
.iter()
.map(|v| Pt3::new(v.a_pos[0].into(), v.a_pos[1].into(), v.a_pos[2].into()))
.collect();
let indices: Vec<na::Point3<usize>> = index_data
.chunks(3)
.map(|slice| {
na::Point3::new(slice[0] as usize, sl... | Rust | 0 |
#kivymdscalebehavior test
# https://kivymd.readthedocs.io/en/1.1.1/behaviors/scale/index.html
from kivy.animation import Animation
from kivy.lang import Builder
from kivy.uix.behaviors import ButtonBehavior
from kivymd.app import MDApp
from kivymd.uix.behaviors import ScaleBehavior
from kivymd.uix.boxlayout import M... | Python | 1 |
nnections have one or more bus names associated with them.
/// A connection has exactly one bus name that is a unique connection name.
/// The unique connection name remains with the connection for its entire lifetime.
/// A bus name is of type STRING, meaning that it must be valid UTF-8.
#[derive(Clone, Debug, Partial... | Rust | 0 |
typed("a", json_dsl::string());
});
assert_str_eq(¶ms, r#"{"a":"1"}"#, r#"{"a":"1"}"#);
assert_str_eq(¶ms, r#"{"a":1}"#, r#"{"a":"1"}"#);
assert_str_eq(¶ms, r#"{"a":1.112}"#, r#"{"a":"1.112"}"#);
// error because "a" is object
assert_error::<errors::WrongType>(¶ms, r#"{"a": {}}... | Rust | 0 |
},
EvtVarTypeHexInt32 => {
let val: u32 = unsafe {
std::ptr::read(
&variant.u as *const _ as *const u32
)
};
VariantValue::UInt(
val as u64
)
... | Rust | 0 |
ids(&self, id: Id<[ElaborateTypeId]>) -> &[ElaborateTypeId] {
if id == Id::empty() {
&[]
} else if id.is_tree() {
self.tree.get_elaborate_type_ids(id)
} else {
self.registry.get_elaborate_type_ids(id)
}
}
fn get_names(&self, id: Id<[Identifier... | Rust | 0 |
&opts.minute {
check_auto_styling_set(opts)?;
match minute {
options::DisplaySize::Numeric => skel.push("m"),
options::DisplaySize::TwoDigit => skel.push("mm"),
}
}
if let Some(second) = &opts.second {
check_auto_styling_se... | Rust | 0 |
unwrap())
}
}
}
fn rust_main(msg: mpsc::Receiver<MainThreadMsg>) {
a_log("inside rust main".to_owned());
let instance = create_instance(
&InstanceCreateInfo::new()
.enabled_layer_name(&"VK_LAYER_KHRONOS_validation\0".as_ptr())
.enabled_extension_names(&[
... | Rust | 0 |
import smart_imports
smart_imports.all()
@utils_jinja2.jinjaglobal
def game_info_url(account=None, client_turns=None):
return utils_jinja2.Markup(logic.game_info_url(account_id=account.id if account is not None else None,
client_turns=client_turns))
@utils_jin... | Python | 1 |
}
}
<gh_stars>1-10
use crate::{
core::{
error::Error,
frame_buffer::{FrameBuffer, FrameBufferRef},
header::HeaderRef,
version::Version,
LevelMode, LevelRoundingMode,
},
multi_part::multi_part_input_file::MultiPartInputFile,
};
use imath_traits::Bound2;
use openex... | Rust | 0 |
P0,)>
where
P0: Pattern<'a> + 'static,
{
type Output = P0::Output;
fn try_match(&self, input: &'a Term) -> Result<'a, Self::Output> {
let l: &List = input.try_as_ref().ok_or_else(|| self.unmatched(input))?;
let e = &l.elements;
(e.len() == 1)
.as_option()
.ok_... | Rust | 0 |
import requests
import threading
# Cloudflare API参数
api_token = "" # Cloudflare API Token
zone_id = "" # Cloudflare Zone ID
domain = "" # 您的二级域名
# 定义需要筛选的线路和筛选IP的个数
line = "CU" # 可以根据需要修改的线路电信CT移动CM联通CU
num_ips_to_select = 2 # 修改此处以更改筛选IP的个数
# 请求优选IP接口
url = "https://api.345673.xyz/get_data"
payload = {
"ke... | Python | 1 |
pub use stream_framer::*;
#[cfg(not(target_os = "fuchsia"))]
pub use security_context::MemoryBuffers;
/// Utility trait to trace a variable to the log.
pub(crate) trait Trace {
/// Trace the caller - add `msg` as text to display, and `ctx` as some context
/// for the system that caused this value to be traced... | Rust | 0 |
_a = 1
_b = 2 | Python | 1 |
temp_count = 0
def new_temp():
global temp_count
temp = "t" + str(temp_count)
temp_count += 1
return temp
def generate_three_address_code(op, arg1, arg2, result):
print(f"{result} = {arg1} {op} {arg2}")
def main():
expr = input("Enter an arithmetic expression (e.g., a + b * c - d): ")
tok... | Python | 1 |
.current_dir("./")
.output()
.map_err(SnippextError::from)?;
if cone_patterns.is_some() {
Command::new("git")
.arg("sparse-checkout")
.arg("init")
.arg("--cone")
.current_dir(&checkout_directory)
.output()
.map_err(Sn... | Rust | 0 |
ransformer.h" in name:
from_name, l_idx = layer_template(name, 2)
to_name = weight_map[from_name]
to_name = to_name.format(l_idx)
else:
to_name = weight_map[name]
param = load_param(param, name, None)
if saver is not Non... | Python | 1 |
SINGULAR_DEFINITE_ARTICLES = ["a", "an", "la", "lan", "nan"]
PLURAL_DEFINITE_ARTICLE = "yo" | Python | 1 |
element(formatter),
Self::TsNonPrimitiveType(node) => node.to_format_element(formatter),
Self::TsThisType(node) => node.to_format_element(formatter),
Self::TsNumberLiteralType(node) => node.to_format_element(formatter),
Self::TsBigIntLiteralType(node) => node.to_format_el... | Rust | 0 |
fied guest memory.
fn debug_write_memory<T: VcpuArch>(
vcpu: &T,
guest_mem: &GuestMemory,
vaddr: GuestAddress,
buf: &[u8],
) -> Result<(), Self::Error>;
#[cfg(all(target_arch = "x86_64", feature = "gdb"))]
/// Make the next vCPU's run single-step.
fn debug_enable_sin... | Rust | 0 |
fn layer(self, inner: S) -> Self::Service {
ClientCertificateService { inner }
}
}
pub struct ClientCertificateService<S> {
inner: S,
}
impl<S, T, L> Service<NewConnection<SslStream<T>, L>> for ClientCertificateService<S>
where
S: Service<NewConnection<SslStream<T>, Stack<L, ClientCertificateReque... | Rust | 0 |
assert pipeline2.uid == loaded_pipeline2.uid
assert loaded_pipeline2.getStages()[0].getStages()[1].getMaxIter() == 200
pipeline2_model_local_path = os.path.join(tmp_dir, "pipeline2_model")
model2.saveToLocal(pipeline2_model_local_path)
loaded_model2 = Pipeline.loa... | Python | 1 |
from .stainless_steel import stainless_steel
from .aluminum import aluminum
from .copper import copper
from .teflon import teflon
from .stainless_steel import material_references as stainless_steel_material_references
from .aluminum import material_references as aluminum_material_references
from .copper import materia... | Python | 1 |
__version__ = "6.4.2"
| Python | 1 |
e: '2'
with_prototype:
- match: '1'
scope: '1'
- match: '1'
scope: digit1
- match: '2'
scope: digit2
context1:
- match: e
scope: e
pop: true
- match: '2'
scope: digit2
context2:
- match: d
scope: d
pop: true
- match: '2'
... | Rust | 0 |
="Not portable - not a bitmask on Windows.")]
pub struct Status: DWORD {
const UNKNOWN = ffi::SCARD_UNKNOWN;
const ABSENT = ffi::SCARD_ABSENT;
const PRESENT = ffi::SCARD_PRESENT;
const SWALLOWED = ffi::SCARD_SWALLOWED;
const POWERED = ffi::SCARD_POWERED;
const NEGOTIA... | Rust | 0 |
unique_elements = set()
for _ in range(int(input())):
for element in input().split():
unique_elements.add(element)
print(*unique_elements, sep='\n')
| Python | 1 |
"""
Unit test for near real-time video example
"""
import os
from pathlib import Path
import pytest
import requests
from ts.torch_handler.dali_image_classifier import DALIImageClassifier
from ts.torch_handler.unit_tests.test_utils.mock_context import MockContext
CURR_FILE_PATH = Path(__file__).parent
REPO_ROOT_DIR =... | Python | 1 |
];
// Get the number of iterations
let n = matches.value_of("n").unwrap().parse::<I>().unwrap();
// Get the time step
let h = matches.value_of("h").unwrap().parse::<F>().unwrap();
// Get path to the results directory
let output = PathBuf::from(matches.value_of("output").unwrap());
// Get the... | Rust | 0 |
nsed under both the MIT license found in the
* LICENSE-MIT file in the root directory of this source tree and the Apache
* License, Version 2.0 found in the LICENSE-APACHE file in the root directory
* of this source tree.
*/
use bytes::Bytes as BytesNew;
use bytes_old::Bytes as BytesOld;
/// Create a 0.4 copy of ... | Rust | 0 |
portant that we don't switch back to the greenlet,
# we leave it hanging there in an incomplete state. But we don't let it
# get collected, either. If we complete it now, while we're still
# in the scope of the initial trash can, things work out and we
... | Python | 1 |
# Purpose:
# This helper gets the database session for use in API endpoints cleanly.
from app.core.config import SessionLocal
def get_db():
db = SessionLocal()
try:
yield db
finally:
db.close() | Python | 1 |
, base_type:base_type, is_dev_field:false };
field_defs.push(field_def);
}
// Is there any developer information in this record?
if self.header_byte & RECORD_HDR_MSG_TYPE_SPECIFIC != 0 {
// Read the number of developer fields (1 byte).
let num_dev_fields = r... | Rust | 0 |
p2) => na::distance(p1, p2),
ClosestPoints::Intersecting => {
self.stop = true;
na::zero()
}
ClosestPoints::Disjoint => self.margin,
};
res = Some((dist, pts))
});
... | Rust | 0 |
from brats_4type_utils import get_all_data_loaders, prepare_sub_folder, write_loss, get_config, write_2images, Timer
import argparse
from torch.autograd import Variable
from brats_4type_trainer import MUNIT_Trainer
import torch.backends.cudnn as cudnn
import torch
try:
from itertools import izip as zip
except Impor... | Python | 1 |
",
"const blop = 123;",
"typedef opaque Ioaddr<>;",
];
for (i, spec) in specs.into_iter().enumerate() {
let name = format!("{}_{}", name, i);
if let Err(e) = build_test(&name, spec) {
panic!("test {} failed: {}", name, e);
}
}
}
#[test]
fn rfc4506() {
... | Rust | 0 |
>, D::Error>
where
D: serde::Deserializer<'de>,
{
let timestamp_nano = u64::deserialize(deserializer)?;
let timestamp = chrono::NaiveDateTime::from_timestamp(
(timestamp_nano / 1_000_000_000) as i64,
(timestamp_nano % 1_000_000_000) as u32,
);
Ok(DateTime::<Utc>::from_utc(timestamp, ... | Rust | 0 |
{},)+
_ => {}
}
}
};
};
($t:path: $($f:ident),+) => {
#[allow(unknown_lints, unneeded_field_pattern)]
const _: fn() = || {
$(let $t { $f: _, .. };)+
};
};
}
use crate::raytracing::Material;
use nalgebra_glm as glm;
... | Rust | 0 |
# # coding: utf-8
import os
from django.conf import settings
from django.test import TestCase
from django.utils.datastructures import SortedDict
from breadcrumbs.breadcrumbs import Breadcrumb, Breadcrumbs
class BreadcrumbsTest(TestCase):
urls = 'breadcrumbs.tests.urls'
def setUp(self):
self.old_MIDD... | Python | 1 |
r"""
i am winston wolfe, i solve problems
Usage:
wolfe (on | off)
wolfe (l | last)
wolfe [QUERY ...] [-g | --google]
Options:
-h --help Show this screen.
--version Show version.
"""
import requests
import subprocess
from docopt import docopt
import os
import shutil
import webbrowser
from api import st... | Python | 1 |
ompilationKind.NEGATIVE_CONDITIONS_REMOVING)
self.assertIn(f"Expression: {Not(Iff(x, y))} is not in NNF.", str(e.exception))
def test_ad_hoc_2(self):
x = Fluent("x")
y = Fluent("y")
t = GlobalStartTiming(5)
problem = Problem("ad_hoc")
problem.add_fluent(x)
pr... | Python | 1 |
().unwrap().rp.device
}
/// Converts `pos` into winit logical coordinates
///
/// Winit uses a dpi factor, but we usually want pixel coordinates.
/// Use this function to convert a logical position from winit into pixel coordinate values.
pub fn logic_to_real_position(&self, pos: vk::winit::dpi::LogicalPos... | Rust | 0 |
import subprocess
import re
from flask import Flask
from flask_pymongo import PyMongo
import requests
import json
vuln_list=[]
#设置数据库连接参数
app = Flask(__name__)
with app.app_context():
app.config['MONGO_URI'] = "mongodb://{host}:{port}/{database}".format(
host='localhost',
port=27017,
datab... | Python | 1 |
LINTEGER , crowRowset : SQLUSMALLINT) -> SQLRETURN ;
} extern "C" { pub fn TraceOpenLogFile (szFileName : LPWSTR , lpwszOutputMsg : LPWSTR , cbOutputMsg : DWORD) -> RETCODE ;
} extern "C" { pub fn TraceCloseLogFile () -> RETCODE ;
} extern "C" { pub fn TraceReturn (arg1 : RETCODE , arg2 : RETCODE) ;
} extern "C" { pub ... | Rust | 0 |
disable_lora (bool): Disable LoRA fine-tuning during inference.
debug (bool): Enable debug mode to log intermediate outputs.
Returns:
Tensor: Predicted reward values or loss if labels are provided.
"""
assert not (exists(prompt_mask) and exists(prompt_lengths))... | Python | 1 |
ype=torch.int64)
iscrowd = torch.as_tensor(iscrowd, dtype=torch.int64)
image_id = torch.tensor([idx])
area = (boxes[:, 3] - boxes[:, 1]) * (boxes[:, 2] - boxes[:, 0])
target = {}
target["boxes"] = boxes
target["labels"] = labels
target["image_id"] = image_id
... | Python | 1 |
nix)
(
"@rules_rust//rust/platform:x86_64-apple-darwin",
"@rules_rust//rust/platform:x86_64-unknown-linux-gnu",
): [
"@yetanother//:dep",
],
"//conditions:default": [],
}) + selects.with_or({
# x86_64-apple-darwin
(
"@ru... | Rust | 0 |
ile is None:
location = test_properties.get("location")
if location:
if location.startswith(("http://", "https://")):
assert get_location
expected_file = get_location(location)
else:
expected_file = locat... | Python | 1 |
inline(always)]
pub fn is_adcsht_5(&self) -> bool {
*self == ADCSHT_A::ADCSHT_5
}
#[doc = "Checks if the value of the field is `ADCSHT_6`"]
#[inline(always)]
pub fn is_adcsht_6(&self) -> bool {
*self == ADCSHT_A::ADCSHT_6
}
#[doc = "Checks if the value of the field is `ADCSHT... | Rust | 0 |
}
Err(e) => {
debug!("unable to create instance: {:?}", e);
return Err(e);
}
}
}
fn main() {
env_logger::init_from_env(env_logger::Env::new().filter_or(env_logger::DEFAULT_FILTER_ENV, "info"));
let instance = create_instance("example create_instance", &[]).unwrap();
let r = vkEnumera... | Rust | 0 |
'''String reversals at different levels.'''
# reversedCharacters :: String -> String
def reversedCharacters(s):
'''All characters in reversed sequence.'''
return reverse(s)
# wordsWithReversedCharacters :: String -> String
def wordsWithReversedCharacters(s):
'''Characters within each word in reversed se... | Python | 1 |
uct __0_INTEN;
#[doc = "`read()` method returns [_0_inten::R](_0_inten::R) reader structure"]
impl crate::Readable for _0_INTEN {}
#[doc = "`write(|w| ..)` method takes [_0_inten::W](_0_inten::W) writer structure"]
impl crate::Writable for _0_INTEN {}
#[doc = "PWM0 Interrupt and Trigger Enable"]
pub mod _0_inten;
#[doc... | Rust | 0 |
flatten)]
pub out_spec: OutSpec<C>,
}
#[derive(Deserialize, Serialize)]
#[serde(tag = "kind")]
pub enum FilterKind<C> {
Copy,
Pow3,
Clip {
limit: LfSource<C>,
},
/// Filter as described in https://en.wikipedia.org/wiki/Low-pass_filter#Discrete-time_realization.
LowPass {
cut... | Rust | 0 |
let (Ready, s) = recv_mpst_k_from_t(s)?;
let s = send_mpst_k_to_t(Value(values), s);
let s = send_mpst_k_to_s(Ready, s);
let (Value(values), s) = recv_mpst_k_from_s(s)?;
let (Ready, s) = recv_mpst_k_from_t(s)?;
let s = send_mpst_k_to_t(Value(values), s);
close_mpst(s)?;
Ok(())
}
fn sink(s... | Rust | 0 |
logical_operator="AND", slice_name="camera_a_high_conf"
)
assert len(camera_slice) == 4
for i in range(len(camera_slice)):
assert camera_slice.metadata_store.get_metadata(i, "source") == "camera_a"
score = camera_slice.metadata_store.get_metadata(i, "confidence_score")
assert 0.85 ... | Python | 1 |
from django.db import models
from django.contrib.auth.models import AbstractUser
from django.urls import reverse
from django.db.models.signals import post_migrate
from django.dispatch import receiver
from django_resized import ResizedImageField
import os
class CustomUser(AbstractUser):
# first_name inherited from... | Python | 1 |
ure = Some(cert_signature);
let mut extra: HashMap<String, serde_json::Value> = HashMap::new();
extra.insert("something extra".into(), json!("value extra"));
let mut simple_signing = sl.simple_signing;
let optional = Optional {
creator: Some("test".into(... | Rust | 0 |
extent: Some(
4096,
),
},
],
}"#;
#[test]
fn test_build_mvt() {
// https://github.com/mapbox/vector-tile-spec/tree/master/2.1#45-example
let mut mvt_tile = Tile::default();
let mut mvt_layer = tile::Layer::default();
mvt_layer.... | Rust | 0 |
// debug prints will appear in your console if you `wrangler dev`
debug_print_string("request_handler!");
// Get a list of all the keys
// (For some value of "all")
let key_list = TestDataKV::list().await.unwrap();
// Get the value for the last key in the list
let value = TestDataKV::get(&... | Rust | 0 |
"""
Tests inheritance rules for TypedDict classes.
"""
# Specification: https://typing.readthedocs.io/en/latest/spec/typeddict.html#typeddict
from typing import TypedDict
class Movie(TypedDict):
name: str
year: int
class BookBasedMovie(Movie):
based_on: str
class BookBasedMovieAlso(TypedDict):
nam... | Python | 1 |
ate: c_int,
#[cfg(not(osslconf = "OPENSSL_NO_SRP"))]
srp_ctx: ::SRP_CTX,
#[cfg(all(not(osslconf = "OPENSSL_NO_TLSEXT"), ossl102))]
alpn_client_proto_list: *mut c_uchar,
#[cfg(all(not(osslconf = "OPENSSL_NO_TLSEXT"), ossl102))]
alpn_client_proto_list_len: c_uint,
}
#[repr(C)]
pub struct SSL_CTX ... | Rust | 0 |
"""
photonic_transmission - A module for photonic data transmission.
This module provides classes and functions for implementing
photonic transmission systems, including waveguides, modulators,
photodetectors, and the main transmission layer.
Modules:
- waveguide: Implementation of waveguide for light transmissio... | Python | 1 |
,
_request: tonic::Request<tonic::Streaming<Header>>,
) -> Result<tonic::Response<PushHeadersResponse>, tonic::Status> {
info!(self.log,"Push headers method recieved";"method" => MethodType::PushHeaders.to_string());
Ok(Response::new(PushHeadersResponse::default()))
}
async fn upload... | Rust | 0 |
let message_hub_delegate = message::create_hub();
let results: Vec<i64> = (0..10).collect();
// Create a top-level receptor to receive job results from.
let mut receptor = message_hub_delegate
.create(MessengerType::Unbound)
.await
.expect("should create rec... | Rust | 0 |
a = int(input("Enter the first integer: "))
b = int(input("Enter the second integer: "))
c = int(input("Enter the third integer: "))
min_val = min(a, b, c)
max_val = max(a, b, c)
mid_val = (a + b + c) - min_val - max_val
print("The numbers in sorted order are:", min_val, mid_val, max_val)
| Python | 1 |
clblasUplo,
N: usize,
K: usize,
alpha: cl_float2,
A: cl_mem,
offa: usize,
lda: usize,
X: cl_mem,
offx: usize,
incx: ::libc::c_int,
beta: cl_float2,
Y: cl_mem,
offy: usize,
incy: ::libc::c_int,
numCommandQueue... | Rust | 0 |
forms" in page_content:
return page_content["forms"]
elif element_type == "buttons" and "buttons" in page_content:
return page_content["buttons"]
elif element_type == "inputs" and "inputs" in page_content:
return page_content["inputs"]
return elements
async def extract_text_fro... | Python | 1 |
cmd = [self._binary_path, *cmd_flags]
subprocess_utils.run(
cmd=cmd,
cmd_name='Nhmmer',
log_stdout=False,
log_stderr=True,
log_on_process_error=True,
)
with open(output_sto_path) as f:
sto_out = f.read()
if sto_out:
a3m_out = par... | Python | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.