text string | label_name string | labels int64 |
|---|---|---|
"""
Type-annotation related support for the referencing library.
"""
from __future__ import annotations
from typing import TYPE_CHECKING, Protocol, TypeVar
try:
from collections.abc import Mapping as Mapping
Mapping[str, str]
except TypeError: # pragma: no cover
from typing import Mapping as Mapping
... | Python | 1 |
Error(e) => write!(f, "PublicKeyError error: {}", e),
DeserializeFailure::SignatureError(e) => write!(f, "Signature error: {}", e),
DeserializeFailure::TagMismatch{ found, expected } => write!(f, "Expected tag {}, found {}", expected, found),
DeserializeFailure::UnknownKey(key) => wr... | Rust | 0 |
";
//! return Err(anyhow!("missing attribute: {}", missing));
//! # Ok(())
//! # }
//! ```
//!
//! <br>
//!
//! # Acknowledgements
//!
//! The implementation of the `anyhow::Error` type is forked from
//! `fehler::Exception` ([https://github.com/withoutboats/fehler][fehler]). This
//! library just exposes i... | Rust | 0 |
acpi_hest_generic {
fn clone(&self) -> Self { *self }
}
impl ::core::default::Default for Struct_acpi_hest_generic {
fn default() -> Self { unsafe { ::core::mem::zeroed() } }
}
pub type ACPI_HEST_GENERIC = Struct_acpi_hest_generic;
#[repr(C, packed)]
#[derive(Copy)]
pub struct Struct_acpi_hest_generic_v2 {
... | Rust | 0 |
import sys
import os
BASE_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), os.pardir)
sys.path.append(BASE_DIR)
from prompts.task_relative.env_description import env_wo_desc_prompt
from prompts.task_relative.task_objective import desc_dict, objectives
from prompts.task_relative.env_description import des... | Python | 1 |
ongmaojinfu.com', 'company2': '北京顺信益信息技术有限公司', 'type': 1}, {'cid': '4114', 'company': 'www.mbachina.com', 'company2': '慧学教育科技北京有限公司', 'type': 1}, {'cid': '4119', 'company': 'www.weidian.com', 'company2': '无线生活北京信息技术有限公司', 'type': 1}, {'cid': '4132', 'company': 'www.analysys.cn', 'company2': '北京易观智库网络科技有限公司', 'type': 1}... | Python | 1 |
///
/// Unlinks the given third-party user from your smart home Action.
/// All data related to this user will be deleted.
///
/// For more details on how users link their accounts, see
/// [fulfillment and
/// authentication](https://developers.google.com/assistant/smarthome/concepts/fulfill... | Rust | 0 |
# return 角度一律 radians
import math
from rclpy.node import Node
from pros_car_py.car_models import DeviceDataTypeEnum
import numpy as np
import time
import sys
from scipy.spatial.transform import Rotation as R
import pybullet as p
import numpy as np
import threading
class ArmController:
def __init__(self, ros_commu... | Python | 1 |
#!/usr/bin/env python3
# This file is covered by the LICENSE file in the root of this project.
import sys
import numpy as np
class iouEval:
def __init__(self, n_classes, ignore=None):
# classes
self.n_classes = n_classes
# What to include and ignore from the means
self.ignore = n... | Python | 1 |
#!/usr/bin/env python3
# pylint: disable=C0301,C0116,C0103,R0903
"""
This script was created by Coopydood as part of the ultimate-macOS-KVM project.
https://github.com/user/Coopydood
https://github.com/Coopydood/ultimate-macOS-KVM
Signature: 4CD28348A3DD016F
"""
import os
import time
import subprocess
import re... | Python | 1 |
import pytest
import pytest_asyncio
from fastapi import FastAPI, Depends
from httpx import AsyncClient
from httpx._transports.asgi import ASGITransport
from starlette.status import HTTP_401_UNAUTHORIZED
import time
from backend.db.session import get_db_session
from backend.services.auth import get_token_from_cookie, v... | Python | 1 |
message, GetLastError());
}};
}
macro_rules! println {
($($tokens:tt)*) => {{
#[cfg(debug_assertions)]
std::println!($($tokens)*);
}};
}
extern "system" fn wnd_proc(hwnd: HWND, msg: u32, wparam: WPARAM, lparam: LPARAM) -> LRESULT {
unsafe {
match msg {
WM_DESTROY =>... | Rust | 0 |
_ar_rib_01a.dds", 0x5865_633C, 0x3B45_F63A),
(r"textures\tx_ac_rock_01.dds", 0x5865_633C, 0x48D5_7E81),
(r"textures\tx_ai_grass_01.dds", 0x5865_633C, 0x4B8A_9FD6),
(r"textures\tx_ashmask_01.dds", 0x5865_633C, 0x50DB_7CFD),
(r"textures\tx_a_clavicus.dds", 0x5865_633C, 0x5EDD_DDAF),
(r"textures\t... | Rust | 0 |
from dash import html, dcc, callback, Input, Output
import plotly.express as px
import pandas as pd
from server import collisions
layout = html.Div(
[
html.H1("Page 4: collisions over time"),
html.P("A line chart showing the number of collisions over time."),
dcc.Graph(id="collisions-plot")... | Python | 1 |
bufs: Vec::with_capacity(capacity),
stride: stride,
capacity: Some(capacity),
batch_sz: 0,
}
}
pub fn stride(&self) -> usize {
self.stride
}
pub fn batch_capacity(&self) -> Option<usize> {
self.capacity
}
pub fn batch_size(&self) -> usize {
self.batch_sz
}
pub ... | Rust | 0 |
exceptions don't break the pipeline."""
clear_enrichers()
def failing_enricher(logger, method_name, event_dict):
raise RuntimeError("This enricher fails")
def working_enricher(logger, method_name, event_dict):
event_dict["working_field"] = "working_value"
return event_dict
re... | Python | 1 |
using Bech32
pub fn bech32_address_from_ed25519_address(ed25519_address: &str, hrp: &str) -> String {
let address = Address::Ed25519(Ed25519Address::from_str(ed25519_address).unwrap());
address.to_bech32(hrp)
}
use std::{
collections::HashSet,
fmt::{self, Display, Write},
hash::{Hash, Hasher},
... | Rust | 0 |
ObjectBasicProcessIdList,
JobObjectBasicUIRestrictions,
JobObjectSecurityLimitInformation,
JobObjectEndOfJobTimeInformation,
JobObjectAssociateCompletionPortInformation,
JobObjectBasicAndIoAccountingInformation,
JobObjectExtendedLimitInformation,
JobObjectJobSetInformation,
JobObjectGrou... | Rust | 0 |
FsType => "--rootfstype",
Self::RootFlags => "--rootflags",
Self::RootFlagRo => "--ro",
Self::RootFlagRw => "--rw",
}
}
}
#[derive(Debug, StructOpt, PartialEq)]
#[structopt(name = "kernel-cmdline", setting(AppSettings::NoBinaryName))]
pub struct MetalosCmdline {
#[st... | Rust | 0 |
white
];
const VGACOLOR256: [RGB;256] = [
// System color 0-15
RGB{red:0x00, green: 0x00, blue: 0x00}, // 0 black
RGB{red:0x00, green: 0x00, blue: 0xaa}, // 1 dark blue
RGB{red:0x00, green: 0xaa, blue: 0x00}, // 2 dark green
RGB{red:0x00, green: 0xaa, blue: 0xaa}, // 3 dark cyan
RGB{re... | Rust | 0 |
cache_config.cache_hits(), 0);
assert_eq!(engine.config().cache_config.cache_misses(), 1);
Module::new(&engine, "(module (func))")?;
assert_eq!(engine.config().cache_config.cache_hits(), 1);
assert_eq!(engine.config().cache_config.cache_misses(), 1);
}
Ok... | Rust | 0 |
run_tests::<TestItemType, TestXOR128>(root_xor128);
let root_sha256 = TestItemType::from_slice(&[
252, 61, 163, 229, 140, 223, 198, 165, 200, 137, 59, 43, 83, 136, 197, 63,
]);
run_tests::<TestItemType, TestSha256Hasher>(root_sha256);
}
#[test]
fn test_base_levelcache_trees_iterable_hashable_and_s... | Rust | 0 |
om(e: std::str::Utf8Error) -> Self {
ContextError::StringError(e)
}
}
pub struct Context(*mut sys::ChromaprintContext);
macro_rules! chroma_call {
($f: expr, $err: path) => {{
if unsafe { $f } != 1 {
return Err($err);
}
}};
}
impl Context {
/// Allocate and initial... | Rust | 0 |
.iter().cloned(),
Dimensions::Dim2d { width: 256, height: 128 },
Format::R8Unorm,
queue.clone()
).unwrap()
}
fn get_descriptor_set(
pipeline: PatternTableGraphicsPipeline,
texture: Arc<ImmutableImage<Format>>,
sampler: Arc<Sampler>
) -> Pa... | Rust | 0 |
# SPDX-FileCopyrightText: Copyright 2024 Automat Authors
# SPDX-License-Identifier: MIT
import string
byte_to_c_string_table = {c: chr(c) for c in range(32, 127)}
byte_to_c_string_table[0x22] = '\\"'
byte_to_c_string_table[0x5c] = '\\\\'
byte_to_c_string_table[0x07] = '\\a'
byte_to_c_string_table[0x08] = '\\b'
byte_to... | Python | 1 |
DLEQ
/// proof though, meaning call `*dleq*` methods with `kusama: false`.
///
/// see: https://github.com/w3f/schnorrkel/issues/53
// We currently lack tests for the case when this is false, but you can
// rerun cargo test with this set to false for that.
pub const KUSAMA_VRF : bool = true;
/// Length of VRF output.... | Rust | 0 |
type Block = Blk;
const KEY_LEN: usize = KEY_LEN;
const ROUNDS: usize = ROUNDS;
#[inline(always)]
fn encrypt_interleaved<B: BatchMut<Block = Blk>, F: FnMut(usize)>(
&self,
block: &mut B,
f: F,
) {
aes256::EncryptionKey::encrypt_i... | Rust | 0 |
monitor::get_primary_monitor()
}
pub fn window_target(&self) -> &RootWindowTarget<T> {
&self.window_target
}
pub fn run<F>(self, callback: F) -> !
where F: 'static + FnMut(Event<T>, &RootWindowTarget<T>, &mut ControlFlow),
{
unsafe {
let _pool = NSAutorele... | Rust | 0 |
import networkx as nx
import csv
from transformers import BertModel, BertTokenizer
import torch
from scipy.spatial.distance import cosine
data_path = '../concept_data/'
concept_path = data_path + '322topics_final.tsv'
label_path = data_path + 'final_new_annotation.csv'
# load concept
concept_data = {} # Initialize... | Python | 1 |
# Try giving an input of "7 21", it would give an output like this below.
# ---------.|.---------
# ------.|..|..|.------
# ---.|..|..|..|..|.---
# -------WELCOME-------
# ---.|..|..|..|..|.---
# ------.|..|..|.------
# ---------.|.---------
def vinc():
while True:... | Python | 1 |
Ok(source) => sink.append(source.repeat_infinite()),
Err(err) => warn!("{:?}", err),
}
}
} else if self.port3.contains(Port3::UFO_LOW_PITCH) {
// Sin... | Rust | 0 |
from pwn import *
import sys
HOST = '127.0.0.1'
PORT = 8181
context(os = "linux", arch = "i386")
#context.log_level = 'DEBUG'
elf = ELF("./babypwn")
libc = ELF("/lib/i386-linux-gnu/libc.so.6")
def screen_clean():
sys.stdout.write("\033[F")
sys.stdout.write("\033[K")
def canary_bruteforce(offset):
junk =... | Python | 1 |
import cv2
print(cv2.__version__)
# 4.6.0
img = cv2.imread('data/src/qrcode.png')
qcd = cv2.QRCodeDetector()
retval, decoded_info, points, straight_qrcode = qcd.detectAndDecodeMulti(img)
print(retval)
# True
print(decoded_info)
# ('QR Code Two', '', 'QR Code One')
print(type(points))
# <class 'numpy.ndarray'>
p... | Python | 1 |
StateSynchronizer};
mod coordinator;
mod counters;
mod executor_proxy;
mod peer_manager;
mod synchronizer;
type PeerId = AccountAddress;
#[derive(Clone, Debug, Eq, PartialEq)]
/// The state distinguishes between the following fields:
/// * highest_local_li is keeping the latest certified ledger info
/// * highest_c... | Rust | 0 |
axis
transform.rotation = transform.rotation * pitch; // rotate around local x axis
} else if pan.length_squared() > 0.0 {
any = true;
// make panning distance independent of resolution and FOV,
let window = get_primary_window_size(&windows);
... | Rust | 0 |
n(task_id) != 24:
del params['task_id']
if not ip:
del params['ip']
if not port:
del params['port']
if not subject_dn:
del params['cert.subject_dn']
if not serial_number:
del params['cert.serial_number']
if not star... | Python | 1 |
clock pre-divider."]
#[inline]
pub fn _4_clocks(self) -> &'a mut W {
self.variant(MSTSCLHIGHW::_4_CLOCKS)
}
#[doc = "5 clocks. Minimum SCL high time is 5 clock of the I2C clock pre-divider."]
#[inline]
pub fn _5_clocks(self) -> &'a mut W {
self.variant(MSTSCLHIGHW::_5_CLOCKS)
... | Rust | 0 |
llocator/src/test.rs
use super::*;
use std::boxed::Box;
use std::prelude::v1::*;
use std::mem::{size_of, align_of};
use alloc::allocator::Layout;
fn get_allocator() -> BitmapAllocator {
const HEAP_SIZE: usize = 1000;
let heap_space = Box::into_raw(Box::new([0u8; HEAP_SIZE]));
let mut allocator = BitmapAllo... | Rust | 0 |
for _ in 0..self.secret_length {
verify_token.push(buf.get_u8());
}
self.verify_token = verify_token;
Ok(())
}
fn write_to(&self, buf: &mut BytesMut) {
buf.push_var_int(self.secret.len() as i32);
buf.put(self.secret.as_slice());
buf.push_var_... | Rust | 0 |
ty: Handle<Type>,
name: String,
init: Option<Handle<Constant>>,
meta: Span,
) -> Result<Handle<Expression>> {
let decl = VarDeclaration {
qualifiers: &mut self.qualifiers,
ty,
name: Some(name),
init,
meta,
};
... | Rust | 0 |
arseError> {
self.parse_string_with_encoding(input, None)
}
///Parses the XML/HTML bytes `input` with a manually-specified
///encoding to generate a new `Document`
pub fn parse_string_with_encoding<Bytes: AsRef<[u8]>>(
&self,
input: Bytes,
encoding: Option<&str>,
) -> Result<Document, XmlPars... | Rust | 0 |
::Add,
toc_syntax::InfixOp::Sub => expr::BinaryOp::Sub,
toc_syntax::InfixOp::Mul => expr::BinaryOp::Mul,
toc_syntax::InfixOp::Div => expr::BinaryOp::Div,
toc_syntax::InfixOp::RealDiv => expr::BinaryOp::RealDiv,
toc_syntax::InfixOp::Mod => expr::BinaryOp::Mod,
toc_syntax::... | Rust | 0 |
}
impl R {
#[doc = "Bit 31"]
#[inline(always)]
pub fn reg_en_platform_wakeup(&self) -> REG_EN_PLATFORM_WAKEUP_R {
REG_EN_PLATFORM_WAKEUP_R::new(((self.bits >> 31) & 0x01) != 0)
}
#[doc = "Bit 28"]
#[inline(always)]
pub fn dig_clk_src_sel(&self) -> DIG_CLK_SRC_SEL_R {
DIG_CLK_... | Rust | 0 |
L_N;
let mut delta = 0;
let mut bias = INITIAL_BIAS;
let mut output : String = input.iter().filter(|&&c| c.is_ascii()).cloned().collect();
let mut h = output.len() as u32;
let b = h;
if b > 0 {
output.push(DELIMITER)
}
while h < input.len() as u32 {
let m = *input.iter... | Rust | 0 |
let second = row[j];
// Check if values divide evenly into one another - if one is a factor of the other
if first % second == 0 {
sum += first / second;
break;
} else if second % first == 0 {
sum... | Rust | 0 |
{
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("PhysicalDeviceDiagnosticsConfigFeaturesNV").field("s_type", &self.s_type).field("p_next", &self.p_next).field("diagnostics_config", &(self.diagnostics_config != 0)).finish()
}
}
impl PhysicalDeviceDiagnosticsConfigFeatur... | Rust | 0 |
"(partner.{phone_field} IS NOT NULL AND REGEXP_REPLACE(partner.{phone_field}, %s, '', 'g') {sql_operator} %s)"
for phone_field in phone_fields
)
query = f"SELECT partner.id FROM {self._table} partner WHERE {where_str};"
term = re.sub(pattern, '', number)
i... | Python | 1 |
, file_exists);
}
let file_exists = PgAccess::pg_version_file_exists(&db_path).await?;
assert_eq!(false, file_exists);
Ok(())
}
#[tokio::test]
#[serial]
async fn postgres_server_timeout() -> Result<(), PgEmbedError> {
let database_dir = PathBuf::from("data_test/db");
let _ = env_logger::Builde... | Rust | 0 |
ute(43usize);
fun(skb, len, flags)
}
pub unsafe fn bpf_xdp_adjust_head(
xdp_md: *mut xdp_md,
delta: ::aya_bpf_cty::c_int,
) -> ::aya_bpf_cty::c_long {
let fun: unsafe extern "C" fn(
xdp_md: *mut xdp_md,
delta: ::aya_bpf_cty::c_int,
) -> ::aya_bpf_cty::c_long = ::core::mem::transmute(... | Rust | 0 |
oBase32::write_base32(&prog, &mut bech32_writer)
}
}
}
}
/// Extract the bech32 prefix.
/// Returns the same slice when no prefix is found.
fn find_bech32_prefix(bech32: &str) -> &str {
// Split at the last occurrence of the separator character '1'.
match bech32.rfind('1') {
Non... | Rust | 0 |
et min_old_limit = if config.min_heap_size > young_size {
config.min_heap_size - young_size
} else {
0
};
let old_limit = align_gen(config.max_heap_size / INIT_HEAP_SIZE_RATIO);
let old_limit = min(old_limit, max_old_limit);
let old_limit = max(old_limit, min_old_limit);
config... | Rust | 0 |
json_list = [p for p in seed.rglob("*.json") if p.stem.startswith("result") \
and "seed" not in p.stem
and "512" not in p.stem
]
n = 0
for p in json_list:
with open(str(p), "r") as json_file:
res... | Python | 1 |
zation of weights
assert not (
version == "gemv" and (use_exllama or use_exllama_v2 or use_ipex)
), "Exllama kernels only support GEMM version."
# Get blocks of model
layers = self.get_model_layers(model)
for i in tqdm(range(len(layers)), desc="Replacing layers...")... | Python | 1 |
in 0..5 {
let n = ((self.0[i*3+0] as usize) << 16) |
((self.0[i*3+1] as usize) << 8) |
(self.0[i*3+2] as usize) ;
buf[i*4+0] = CHARS[(n >> 18) & 63];
buf[i*4+1] = CHARS[(n >> 12) & 63];
buf[i*4+2] = CHARS[(n >> 6) & 63];
... | Rust | 0 |
3.0 * (x[2].powi(3) - x[1].powi(2)) + 2.0 * (x[3].powi(3) - x[2].powi(2)),
3.0 * (x[3].powi(3) - x[2].powi(2)) + 2.0 * (x[4].powi(3) - x[3].powi(2)),
3.0 * (x[4].powi(3) - x[3].powi(2)) + 2.0 * (x[5].powi(3) - x[4].powi(2)),
3.0 * (x[5].powi(3) - x[4].powi(2)),
]
}
... | Rust | 0 |
gap B will increase.
%air_gap_flux_density_B=', air_gap_flux_density_B, 'T', '变得比0.8T大了,是因为你减少了匝数取整,反之亦然。'
''', file=fname) # 2nd ed.@(6.12)
print('\nSince voltage is%s plenty, the suggested N is %g---modify this manually, if necessary.' \
% (' NOT' if not bo... | Python | 1 |
md.md.methods.OverdampedViscous(
filter=hoomd.filter.All()
)
simulation.operations.integrator.methods = [overdamped_viscous]
{inherited}
----------
**Members defined in** `OverdampedViscous`:
Attributes:
filter (hoomd.filter.filter_like): Subset of particles to ap... | Python | 1 |
+ typo.typo.len();
buffer.splice(start..end, fix.as_bytes().iter().copied());
offset += (fix.len() as isize) - (typo.typo.len() as isize);
}
buffer
}
pub fn walk_path(
walk: ignore::Walk,
checks: &dyn FileChecker,
engine: &crate::policy::ConfigEngine,
reporter: &dyn report::Re... | Rust | 0 |
if send_email(receiver_address, subject, message):
speak("I've sent the email sir.")
else:
speak("Something went wrong while I was sending the mail. Please check the error logs sir.")
elif 'joke' in query:
speak(f"Hope you like this one sir")
... | Python | 1 |
("a", 10.into()), Property::new("b", 20.into())].into();
assert_eq!(refval, lhs + rhs);
}
#[test]
#[allow(clippy::eq_op)]
fn test_ops_sub() {
// Null as lhs
assert_eq!(Json::Null, Json::Null - Json::Null);
let refval: Json = true.into();
assert_eq!(refval, Json::Null - true.into());
let refval:... | Rust | 0 |
} for Invocation {
fn target_arg(_this, single, cap) {
let target = cap.get(if single { 1 } else { 0 }).unwrap().as_str();
if target != "wasm32-unknown-unknown" && target != "wasm32-unknown-unknown-wasm" {
Err("unknown target triple")?;
}
}
});
argument!(impl INCLUDE_DIR where { Some(r... | Rust | 0 |
, PartialEq, Eq, Hash, Clone, Copy)]
enum DaysOfWeekKind {
/// An expression over a set of values, ranges, or steps
Pattern,
/// A '*' expression
Star,
/// A 'L' expression for the last day. One day is paired with this making it easier to access
Last,
/// A '#' expression for an nth day of t... | Rust | 0 |
, "-denote"]
renameCommands = ["rename", "-rename", "rn"]
helpCommands = ["help", "-help", "-h"]
reportCommands = ["-r", "report", "-report", "r"]
command = (exitCommands + addCommands + listCommands + versionCommands + modifyCommands + removeCommands + noteCommands
+ denoteCommands + renameCommands + helpCo... | Python | 1 |
X_ERROR_FILE_CLOSE_FAILED => "fclose operation failed.",
}
}
pub fn as_str(&self) -> &str {
match *self {
sgx_status_t::SGX_SUCCESS => "SGX_SUCCESS.",
sgx_status_t::SGX_ERROR_UNEXPECTED => "SGX_ERROR_UNEXPECTED",
sgx_status_t::SGX_ERROR_INVALID_PARAMETER => "... | Rust | 0 |
g.startswith('--') and not arg.endswith('.py'):
script_args.append(arg)
if script_args:
config_name = script_args[0]
if not config_name.endswith('.yaml'):
config_name += '.yaml'
config_path = os.path.join(os.path.dirname(__file__), "configs", config_name)
... | Python | 1 |
import tempfile
from pathlib import Path
import pytest
from agno.agent.agent import Agent
from agno.media import File, Image
from agno.models.aws import AwsBedrock
from agno.utils.media import download_file
@pytest.mark.asyncio
async def test_async_image_input_bytes():
"""Test async image input using bytes with... | Python | 1 |
::*;
use crate::{
Apps, Config, Docker, Flag, Merge, NamedMap, PlatformId, Project, ProjectId, Sel4Architecture,
Setting, Type, VariationId,
};
use anyhow::{bail, Result};
use regex::Regex;
use serde::{Deserialize, Serialize};
use std::collections::BTreeSet;
use std::env::current_dir;
use std::fs::{create_dir_a... | Rust | 0 |
Size::Qword)
}
#[test]
fn setna_7() {
run_test(&Instruction { mnemonic: Mnemonic::SETNA, operand1: Some(Direct(BL)), operand2: None, operand3: None, operand4: None, lock: false, rounding_mode: None, merge_mode: None, sae: false, mask: None, broadcast: None }, &[15, 150, 195], OperandSize::Qword)
}
#[test]
fn setn... | Rust | 0 |
ta de la carpeta 'static/uploads'
uploads_folder = os.path.join(current_app.root_path, 'static', 'uploads')
# Obtener todas las imágenes en la carpeta 'static/uploads'
image_files = [file for file in os.listdir(uploads_folder) if file.endswith(('.png', '.jpg', '.jpeg', '.gif'))]
# Crear las rutas comp... | Python | 1 |
# -*- coding: utf-8 -*-
from __future__ import annotations
from typing import TYPE_CHECKING
from pyglossary.compression import (
# compressionOpen,
stdCompressions,
)
if TYPE_CHECKING:
from collections.abc import Generator
from pyglossary.glossary_types import EntryType, WriterGlossaryType
__all__ = ["Writer"]... | Python | 1 |
p_null(c: &mut Criterion) {
bench_from_file(c, "benches/quickstop-null.avro", "quickstop null file");
}
criterion_group!(
benches,
bench_small_schema_write_1_record,
bench_small_schema_write_100_record,
bench_small_schema_read_1_record,
bench_small_schema_read_100_record,
bench_big_schema_w... | Rust | 0 |
Modifiers::ALT => b"\x1b[[5;3~".to_vec(),
_ => b"".to_vec(),
},
KeyCode::PageDown => match key_event.modifiers {
KeyModifiers::NONE => b"\x1b[[6~".to_vec(),
KeyModifiers::CONTROL => b"\x1b[[6;5~".to_vec(),
KeyModifiers::ALT => b"\x1b[[6;3~".to_vec(),
... | Rust | 0 |
stopped receiving data
#[error("Peer stopped receiving data: code {0}")]
Stopped(quinn_proto::VarInt),
/// Connection was prematurely closed
#[error("Connection was prematurely closed")]
ConnectionLost,
/// Error making the connection.
#[error("Connection failure: {0}")]
ConnectError(#[f... | Rust | 0 |
d_keypair, sk_eph)
}
// def Decap(enc, skR):
// pkE = Deserialize(enc)
// dh = DH(skR, pkE)
//
// pkRm = Serialize(pk(skR))
// kem_context = concat(enc, pkRm)
//
// shared_secret = ExtractAndExpand(dh, kem_context)
// return shared_secret
//
// def AuthDecap(enc, skR, pkS):
// pkE = Deserialize(enc)
// ... | Rust | 0 |
ame = document[0].metadata['name']
url = document[0].metadata['url']
content = document[0].page_content
relevant_docs.append(
Document(
page_content=content,
metadata={
'name': name,
... | Python | 1 |
r a string constant.
///
/// Returns [`None`] also if the constant is not of the specified type.
#[inline(always)]
#[must_use]
pub fn get_string_value(&self) -> Option<&str> {
match self.0 {
Expr::Variable(_, _, x) if x.1.is_none() => Some(x.2.as_str()),
Expr::StringC... | Rust | 0 |
fidl::endpoints::create_proxy,
fidl_fidl_test_components as ftest, fidl_fuchsia_sys2 as fsys, fuchsia_async as fasync,
fuchsia_component::client::connect_to_service,
};
#[fasync::run_singlethreaded]
async fn main() -> Result<(), Error> {
// Create the dynamic child
let realm = connect_to_service::<... | Rust | 0 |
"THB" => Symbol::Thb,
"CHF" => Symbol::Chf,
"EUR" => Symbol::Eur,
"MYR" => Symbol::Myr,
"BGN" => Symbol::Bgn,
"TRY" => Symbol::Try,
"CNY" => Symbol::Cny,
"NOK" => Symbol::Nok,
"NZD" => Symbol::Nzd,
"ZAR" => Symbol::Zar,
"USD" => Symbol::Usd... | Rust | 0 |
ure_handle = asset_server.load("door.png");
let portal_texture_atlas =
TextureAtlas::from_grid(portal_texture_handle, Vec2::new(16.0, 16.0), 2, 1);
commands
// cameras
.spawn(Camera2dBundle {
transform: Transform {
translation: Vec3::new(
... | Rust | 0 |
node_basedirpath)
src_var_dir = PConfigHelper._chroot_if_needed(config.GENESIS_DIR,
node_basedirpath)
trg_etc_dir = PConfigHelper._chroot_if_needed(config.GENERAL_CONFIG_DIR,
replay_dir)
trg_var_dir = PC... | Python | 1 |
.field("timeout_duration", &self.timeout_duration)
.finish()
}
}
<gh_stars>1-10
use hash_rings::{carp, consistent, jump, maglev, mpc, rendezvous, weighted_rendezvous};
use rand::{Rng, XorShiftRng};
use std::collections::HashMap;
use std::time::{Duration, Instant};
const HASH_COUNT: u64 = 21;
c... | Rust | 0 |
}
}
}
#[derive(Debug, Clone, Eq, PartialEq, Hash, Copy)]
pub enum UncertainFloatTy {
Unknown,
Known(FloatTy),
}
impl UncertainFloatTy {
pub fn from_name(name: &Name) -> Option<UncertainFloatTy> {
if let Some(ty) = FloatTy::from_name(name) {
Some(UncertainFloatTy::Known(ty))
... | Rust | 0 |
wrap_or_revert_with(Error::MissingArgument)
.unwrap_or_revert_with(Error::InvalidArgument);
let main_purse: PurseId = account::get_main_purse();
let pos_pointer = system::get_proof_of_stake();
let payment_purse: PurseId =
runtime::call_contract(pos_pointer, &(GET_PAYMENT_PURSE,), &vec![])... | Rust | 0 |
(self) -> Result<View> {
View::from_sourcemap(self.index.flatten()?)
}
pub fn can_flatten(&self) -> bool {
for section in self.index.sections() {
if let None = section.get_sourcemap() {
return false;
}
}
true
}
}
<reponame>andersonvc/t... | Rust | 0 |
T: CpuRegister>(operand: Word, register: &mut T) {
let computed = register.get_A() as i16 - operand as i16;
register
.update_status_negative_by(computed as Data)
.update_status_zero_by(computed as Data)
.set_status_carry(computed >= 0);
}
pub fn cmp<T: CpuRegister, U: CpuBus>(operand: Word, register: &... | Rust | 0 |
= Transfer::init(
rx_stream,
usart,
static_buf,
None,
DmaConfig::default()
.transfer_complete_interrupt(true)
.memory_increment(true)
.double_buffer(false),
);
... | Rust | 0 |
def project_to_2d(X, camera_params):
"""
Project 3D points to 2D using the Human3.6M camera projection function.
This is a differentiable and batched reimplementation of the original MATLAB script.
Arguments:
X -- 3D points in *camera space* to transform (N, *, 3)
camera_params -- intrinsic p... | Python | 1 |
import sys
import os
import shutil
from typing import Union
class FontManager:
linux_font_path = "~/.fonts/"
@classmethod
def init_font_manager(cls):
# Linux
if sys.platform.startswith("linux"):
try:
if not os.path.isdir(os.path.expanduser(cls.linux_font_path)... | Python | 1 |
# Gets the users weight inputted and error checks
userInput = input("Enter Weight of the item in Kg: ")
try:
weight = float(userInput)
except ValueError:
print("Enter as a number e.g 1.9, no need to put in kg or lb")
input("Press any button to close!")
exit()
# Base values, ground_shipping and drone_sh... | Python | 1 |
unsafe { *c }).to_owned()
}
}
impl CStruct for Vec<&str>{
fn free(&mut self) {
}
}
impl CStruct for Vec<String>{
fn free(&mut self) {
}
}
pub fn d_ptr_alloc<T>() -> *mut *mut T {
Box::into_raw(Box::new(null_mut()))
}
pub fn ptr_alloc<T: Default>() -> *mut T {
Box::into_raw(Box::new(T::... | Rust | 0 |
del_three_stream_%d.h5' % (k))
siamese_net = load_model(f1, custom_objects=customs_func)
test_report('test_three_stream_%d' % (k),siamese_net, tstGen2)
elif type1 == 'predict':
results = []
data = json.load(open(argv[2]))
alpha_dict = {i.upper():j/35 for j,i in enumerate(string.ascii_uppercase +... | Python | 1 |
# file_name2 = f"{file_prefix2}{hypes['comm_range']}{file_suffix}"
# file_path2 = os.path.join(directory_path, file_name2)
# json_str2 = json.dumps(commsVolume, indent=4)
# with open(file_path2, 'w') as file:
# file.write(json_str2)
#
... | Python | 1 |
0x07 => Ok(Range::Step7),
0x08 => Ok(Range::Step8),
b => Err(ErrorKind::UnknownMeasurementRange(b).into()),
}
}
pub(crate) fn to_bin(self) -> u8 {
match self {
Range::Auto => 0x00,
Range::Step1 => 0x01,
Range::Step2 => 0x02... | Rust | 0 |
}
#[doc = r" Writes raw bits to the register"]
#[inline]
pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
self.bits = bits;
self
}
#[doc = "Bit 0 - Bit order"]
#[inline]
pub fn order(&mut self) -> _ORDERW {
_ORDERW { w: self }
}
#[doc = "Bit 1 - Se... | Rust | 0 |
, in case of simultaneous access requests."]
#[inline(always)]
pub fn prio(&self) -> PRIO_R {
PRIO_R::new(((self.bits >> 1) & 0x01) != 0)
}
#[doc = "Bit 0 - 0:0\\] Channel enable 0: Disabled 1: Enable Note: Disabling an active channel interrupts the DMA operation. The ongoing block transfer comp... | Rust | 0 |
import pandas as pd
import os
# Define the base path for the project
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
RAW_DATA_DIR = os.path.join(BASE_DIR, '00_data_raw')
INPUT_CSV_PATH = os.path.join(RAW_DATA_DIR, 'mushrooms.csv')
''''
Importing original dataser
'''
df_original = None
try:
df_original = pd... | Python | 1 |
Combo::Rectangle(s) => s.rasterize(w, h),
Combo::RotatedRectangle(s) => s.rasterize(w, h),
Combo::Circle(s) => s.rasterize(w, h),
Combo::Quadratic(s) => s.rasterize(w, h),
Combo::RotatedEllipse(s) => s.rasterize(w, h),
Combo::Polygon(s) => s.rasterize(w, ... | Rust | 0 |
import psycopg2
import pandas as pd
import matplotlib.pyplot as plt
# PostgreSQL connection setup
conn = psycopg2.connect(
host="localhost", # change if remote
database="StockImpacts",
user="your_username",
password="your_password"
)
# SQL query to fetch stock price data
query = """
SELECT date,... | Python | 1 |
"""Compare the outputs of HF and distributed vLLM when using greedy sampling.
Run:
```sh
pytest test_chunked_prefill_distributed.py
```
"""
import pytest
from vllm.utils import cuda_device_count_stateless
from ..models.utils import check_outputs_equal
from ..utils import fork_new_process_for_each_test
@pytest.mar... | Python | 1 |
allInd {
link: WritableReg,
info: BoxCallIndInfo,
},
Ret {
link: Reg,
},
EpiloguePlaceholder,
Jump {
dest: MachLabel,
},
CondBr {
taken: MachLabel,
not_taken: MachLabel,
cond: Cond,
},
TrapIf {
cond: Cond,
trap_c... | Rust | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.