text string | label_name string | labels int64 |
|---|---|---|
'''
输入各种风格的日期和时间
QDateTimeEdit
'''
import sys,math
from PyQt5.QtWidgets import *
from PyQt5.QtGui import *
from PyQt5.QtCore import *
class DateTimeEdit(QWidget):
def __init__(self):
super(DateTimeEdit, self).__init__()
self.initUI()
def initUI(self):
vlayout = QVBoxLayout()
... | Python | 1 |
MPLETE_SIZE: usize = 3;
const SHELL_PROMPT: &str = "#> ";
const CR: &str = "\r\n";
const HELP: &str = "\r\n\
\x1b[31mWindSock Shell\x1b[0m\r\n\r\n\
USAGE:\r\n\
\tcommand [arg]\r\n\r\n\
COMMANDS:\r\n\
\ton Switch led on\r\n\
\toff Switch led off\r\n\
\tstatus Get led status\r\n\
\tclear Clear screen... | Rust | 0 |
self.queue.retain(|x| x.id != id.id);
self.handle_interrupt();
}
}
impl<'a, TIMER: TimerWithInterrupt> Drop for TimerFactoryImpl<'a, TIMER> {
fn drop(&mut self) {
unsafe {
if let Some(timer) = &mut self.timer {
timer.enable_alarm(false);
timer.e... | Rust | 0 |
except Exception as exc:
gs.message(_("generated an exception: {0}").format(exc))
else:
continue
gs.message(_("Averaging: {0} Rasters").format(len(TMP_SMOOTH_RASTERS)))
if len(TMP_SMOOTH_RASTERS) > 0:
# 1024 is the soft limit for most operating systems for number o... | Python | 1 |
from flask import Flask, request
import threading
import os
import socket
import random
app = Flask(__name__)
stop_flag = threading.Event()
current_target = {"ip": None, "port": None}
def flood_udp(ip, port):
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
while not stop_flag.is_set():
try:
... | Python | 1 |
if verifier is None or verifier == '':
verifier = actor
return verifier
def get_custom_fields(self):
""" Returns a dictionary with custom fields to be rendered after
header_table with this structure:
{<fieldid>:{title:<title>, value:<html>}
"""
... | Python | 1 |
spawn(move || {
loop {
match up_in_r.recv() {
Ok(BinUpdateIn {
bin,
scale,
extent,
}) => {
bin.do_update([extent[0] as f32, extent[1] as f32], scale);
let inst = bin.last_update();
let data = bin.verts_cp();
if let Err(_) = up_out_s.send(BinUpdateOu... | Rust | 0 |
.clone();
let mut sum = a.clone();
for _ in 1..(n - 1) {
let vi = Matrix::randsn(m, 1);
a = a.hcat(&vi);
sum = sum + vi;
}
// specify last column based on method chosen
match method {
SingularMethod::Zeros => { a.hcat(&Matrix:... | Rust | 0 |
"""
OWASP ML01: Input Manipulation Attack Lab.
This lab demonstrates adversarial input manipulation attacks and defenses using
the Fast Gradient Sign Method (FGSM) on MNIST digit classification, following
OWASP ML01 guidelines.
Components:
- model: SimpleCNN architecture optimized for adversarial analysis
- attack_f... | Python | 1 |
# This script generates a Python interface for an Apple Macintosh Manager.
# It uses the "bgen" package to generate C code.
# The function specifications are generated by scanning the mamager's header file,
# using the "scantools" package (customized for this particular manager).
import string
# Declarations that cha... | Python | 1 |
ng(), "two".to_string()],
r#"pub fn go() { 1 }"#
),
r#"import one/two
pub fn go() { two.go() }"#,
r#""use strict";
import * as two from "./one/two.js";
export function go() {
return two.go();
}
"#
);
}
#[test]
fn nested_nested_fn_call() {
assert_js!(
(
... | Rust | 0 |
T = int(input())
for _ in range(T):
x, p = input().split()
x = float(x)
p = int(p)
print('%.2f'%(x**p)) | Python | 1 |
#
# Copyright (c) 2023 Airbyte, Inc., all rights reserved.
#
from setuptools import find_packages, setup
MAIN_REQUIREMENTS = [
"airbyte-cdk~=0.1",
]
TEST_REQUIREMENTS = [
"requests-mock~=1.9.3",
"pytest~=6.1",
"pytest-mock~=3.6.1",
]
setup(
entry_points={
"console_scripts": [
... | Python | 1 |
activation=activation,
do_bn=False,
padding='valid')(layer)
flat = klayers.Flatten()(to_flatten)
if conf.dropout_rate_value > 0:
flat = klayers.Dropout(conf.dropout_rate_value)(flat)
hidden = klayers.Dense(conf.value_hidd... | Python | 1 |
{
Ok(WorkComplete::Incomplete) => trigger_self.trigger(),
Err(err) => handle_workflow_error(err)?,
_ => (),
};
}
Ok(())
});
(tx, handle)
}
<reponame>austin-millan/WAVE-Steganography
// Copyright © 2018 <NAME>
// [This software is... | Rust | 0 |
_from_id here for efficiency.
idx = state_key.find(":")
if idx == -1:
return False
return state_key[idx + 1 :] == server_name
event_map = await storage.main.get_events(
[
e_id
for e_id, (_, state_key) in event_id_to_state_key.items()
i... | Python | 1 |
["አካል", "እጅ", "ክፍት", "የተከፈቱ ሁለት እጆች"],
},
#[cfg(feature = "ar")]
crate::Annotation {
lang: "ar",
tts: Some("يدان مفتوحتان"),
keywords: &["علامة", "علامة فتح اليدين", "مفتوحة", "يد", "يدان مفتوحتان"],
},
#[cfg(feature = "as")]
crate::Ann... | Rust | 0 |
class Test:
def __str__(self):
print('hello')
def __eq__(self, value):
print('hello')
print(Test.__str__) | Python | 1 |
id, amount, griefing_collateral));
// assert request event
let _request_id = assert_replace_request_event();
assert_eq!(
ParachainTwoVaultState::get(&old_vault_id, &new_vault_id),
ParachainTwoVaultState::get_default(&old_vault_id, &new_vault_id).with... | Rust | 0 |
&Lang::new()), Some(false));
assert_eq!(pattern.matches('2', &Lang::new()), Some(false));
assert_eq!(pattern.matches('\0', &Lang::new()), Some(false));
}
#[test]
fn pattern_matches_vowel_no_lang() {
assert_eq!(Vowel.matches('2', &Lang::new()), None);
assert_eq!(Vowel.mat... | Rust | 0 |
# 1. Creating a list
fruits = ["apple", "banana", "cherry"]
print("🍎 Original list:", fruits)
# 2. Indexing and Slicing
print("📍 First fruit:", fruits[0])
print("📍 Last fruit:", fruits[-1])
print("🔪 Slice [0:2]:", fruits[0:2])
# 3. Modifying list elements
fruits[1] = "blueberry"
print("✏️ After modifying second i... | Python | 1 |
}
// Would be used to hold pairs of clients,
// expand to store game state etc.?
struct Pairing<'a> {
first_client: &'a Client,
second_client: &'a Client,
}
fn main() -> io::Result<()> {
let mut clients: Vec<Client> = Vec::new();
println!("Binding to port 1234");
let listener = TcpListener::bind... | Rust | 0 |
import bpy
import bgl
import blf
def draw_callback_px(self, context):
print("mouse points", len(self.mouse_path))
font_id = 0 # XXX, need to find out how best to get this.
# draw some text
blf.position(font_id, 15, 30, 0)
blf.size(font_id, 20, 72)
blf.draw(font_id, "Hello Word " + str(len(s... | Python | 1 |
reward += rewards
scores += score
total += 1
acc = scores / total
accs.append(acc)
rewardss.append(reward)
if must_show==True:
print('\nPrompt : \n',prompt)
print('-------------------') ... | Python | 1 |
import numpy as np
from benderopt.rng import RNG
from .utils import ValidationError
def validate_categorical(search_space):
# error = "Expected a dict with mandatory key 'values' (list) and optional key 'probabilities' (list)"
if type(search_space) != dict:
raise ValidationError(message_key="search_... | Python | 1 |
class AplikasiMahasiswa: # Materi Class
def __init__(self): # Materi Function
self.data_mahasiswa = {
'A710230111': {'nama': 'Allison', 'jurusan': 'PTI', 'semester': 1, 'asal': 'Brazil', 'tgl lahir': '10 Mei 2004'},
'B710340056': {'nama': 'Bella', 'jurusan': 'Sasta Inggris', 'semeste... | Python | 1 |
painted state
let mut image_data: Vec<u8> = vec![];
for y_loc in 0..grid_dimensions.height {
for x_loc in 0..grid_dimensions.width {
// Calculate the adjusted location as it would have been seen by robot
let x_adj = x_loc as i32 + grid_dimensions.x_min;
let y_adj = y... | Rust | 0 |
u1: [u32; 9] = [0; 9];
let mut u2: [u32; 9] = [0; 9];
let mut z22: [u32; 9] = [0; 9];
let mut z12: [u32; 9] = [0; 9];
let mut z23: [u32; 9] = [0; 9];
let mut z13: [u32; 9] = [0; 9];
let mut s1: [u32; 9] = [0; 9];
let mut s2: [u32; 9] = [0; 9];
let mut h: [u32; 9] = [0; 9];
let mut h2... | Rust | 0 |
# -*- coding: utf-8 -*-
#
# RERO ILS
# Copyright (C) 2019-2023 RERO
# Copyright (C) 2019-2023 UCLouvain
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# Thi... | Python | 1 |
6_neg_one).invert().unwrap();
let c = Fp12::new(self.0, Fp6::from(1)) * t;
let g = Gt(c);
if g.is_in_subgroup() {
return Some(g);
}
None
}
}
impl Compress for Gt {
fn write_compressed<W: std::io::Write>(self, mut out: W) -> std::io::Result<()> {
let... | Rust | 0 |
from pyautogui import click, moveTo, hotkey, hotkey, write, position, doubleClick
from time import sleep
from image_automation.components.helper.find_image import find_image
from image_automation.components.helper.play_audio import play_audio
from image_automation.components.helper.constants_vars import IMAGES_BASE_PAT... | Python | 1 |
return Err(io::Error::new(
io::ErrorKind::Other,
"Version mismatch",
));
}
let mut registrar = PluginRegistrar::new(Rc::clone(&library));
(decl.register)(&mut registrar);
// add all loaded plugins to the functions map
sel... | Rust | 0 |
}
}
}
};
}
impl_try_from_term!(bool, |TermData::Global(name)| match name.as_str() {
"true" => Ok(true),
"false" => Ok(false),
_ => Err(()),
});
impl_try_from_term!(u8, |TermData::Constant(Constant::U8(value))| Ok(*value));
impl_try_from_term!(u16, |TermData::Constant(Constant... | Rust | 0 |
part of) the current state using `f`.
///
/// Panics if there is no state.
pub fn mutate_state<F, R>(f: F) -> R
where
F: FnOnce(&mut CkBtcMinterState) -> R,
{
__STATE.with(|s| f(s.borrow_mut().as_mut().expect("State not initialized!")))
}
/// Read (part of) the current state using `f`.
///
/// Panics if there ... | Rust | 0 |
x3c0f03c0, 0xfc3f0f3f, 0x0fc00000,
// [472]: 64 'd'
0x000c1206, 0xf00f00f0, 0x0f00ffcf, 0xfcf0ff0f, 0xf0ff0ff0, 0xff0ff0ff, 0x0ff0ff0f, 0xffcffc00,
// [480]: 65 'e'
0x000c0e0a, 0x3fc3fcf0, 0xff0ff0ff, 0x0fffffff, 0x00f00fc0, 0xfc0f3fc3, 0xfc000000,
// [487]: 66 'f'
0x000a1206, 0xfc3f00f0, 0x3c3f... | Rust | 0 |
# Firestore Upload Script
# This script shows how to upload your dream symbols data to Firestore
# Make sure you have your Firebase credentials configured
import firebase_admin
from firebase_admin import credentials, firestore
import json
def initialize_firestore():
"""
Initialize Firestore connection using ... | Python | 1 |
rv64um_p_rem() {
assert_eq!(1, instruction_test("rv64um-p-rem"));
}
#[test]
fn rv64um_p_remu() {
assert_eq!(1, instruction_test("rv64um-p-remu"));
}
#[test]
fn rv64um_p_remuw() {
assert_eq!(1, instruction_test("rv64um-p-remuw"));
}
#[test]
fn rv64um_p_remw() {
assert_eq!(1, instruction_test("rv64um-... | Rust | 0 |
ut)]
let mut scope_849 = writer.prefix("Monitoring");
if let Some(var_850) = &input.monitoring {
crate::query_ser::serialize_structure_crate_model_run_instances_monitoring_enabled(
scope_849, var_850,
)?;
}
#[allow(unused_mut)]
let mut scope_851 = writer.prefix("NetworkIn... | Rust | 0 |
pf_prog_type_BPF_PROG_TYPE_PERF_EVENT: bpf_prog_type = 7;
pub const bpf_prog_type_BPF_PROG_TYPE_CGROUP_SKB: bpf_prog_type = 8;
pub const bpf_prog_type_BPF_PROG_TYPE_CGROUP_SOCK: bpf_prog_type = 9;
pub const bpf_prog_type_BPF_PROG_TYPE_LWT_IN: bpf_prog_type = 10;
pub const bpf_prog_type_BPF_PROG_TYPE_LWT_OUT: bpf_prog_t... | Rust | 0 |
_CONFIG)
}
pub fn decode_to_slice_with_config<R: AsRef<[u8]>, W: AsMut<[u8]>>(
input: R,
output: &mut W,
config: Config,
) -> Result<usize, Error> {
decode_to_slice_inner(&STANDARD_DECODE_TABLE, input, output, config)
}
pub fn urlsafe_decode_to_slice_with_config<R: AsRef<[u8]>, W: AsMut<[u8]>>(
in... | Rust | 0 |
value::<u64>();
let test = build_op_test!(asm_op, &[c, a as u64, b as u64]);
test.expect_stack(&[expected, c]);
}
#[test]
fn u32eq_fail() {
let asm_op = "u32eq";
// should fail if either one of 2 inputs is out of bounds
test_inputs_out_of_bounds(asm_op, 2);
}
#[test]
fn u32eq_b() {
let build... | Rust | 0 |
configuration = configuration.vault_key_storage(
S3VaultKeyStorage::new(bucket)
.endpoint(Endpoint::immutable(Uri::try_from(env::var(
"VAULT_S3_ENDPOINT",
)?)?))
.path(env::var("VAULT_S3_PATH")?),
);
}
let storage = Async... | Rust | 0 |
MATCHABLE_TOKEN,
/* 3 */ UNMATCHABLE_TOKEN,
/* 4 */ UNMATCHABLE_TOKEN,
/* 5 */ r###"\{"###,
/* 6 */ r###"\}"###,
/* 7 */ r###","###,
/* 8 */ r###":"###,
/* 9 */ r###"\["###,
/* 10 */ r###"\]"###,
/* 11 */ r###"true"###,
/* 12 */ r###"false"###,
/* 13 */ r###"null"###,
... | Rust | 0 |
OP_99(0x00FE, 0x00, 0x07, 1500)
Yield()
Jump('lambda_1A5D')
DispatchAsync2(0x0009, 0x0002, lambda_1A5D)
PlaySE(571, 0x00, 0x64)
ChrJumpTo(0x00FE, 108500, 300, -6100, 1000, 6000)
PlaySE(164, 0x00, 0x64)
Return()
# id: 0x000A offset: 0x1A8C
@scena.Code('func_0A_1A8C')
def func_0A... | Python | 1 |
from cryptography.fernet import Fernet
import os
def load_key():
with open("key.key", "rb") as key_file:
return key_file.read()
def set_master_password():
mas_pwd = input("Enter a MASTER password: ")
with open("master_password.txt", 'w') as f:
f.write(mas_pwd) # Store the master passwor... | Python | 1 |
# Copyright (c) 2023, RTE (https://www.rte-france.com)
# See AUTHORS.txt
# This Source Code Form is subject to the terms of the Mozilla Public License, version 2.0.
# If a copy of the Mozilla Public License, version 2.0 was not distributed with this file,
# you can obtain one at http://mozilla.org/MPL/2.0/.
# SPDX-Lice... | Python | 1 |
re ergonomic in the future.
//
pool.spawn( mb.start_fut( sum ) ).expect( "Spawning failed" );
let sender_thread = thread::spawn( move ||
{
let thread_program = async move
{
for _i in 0..100usize
{
addr.call( Add( 10 ) ).await.expect( "Call failed" );
}
let res = addr.call( Show{} ).... | Rust | 0 |
dynamic = {
r"-:model\.layers\.0\..*": {}, # skip 0 layers
}
model = GPTQModel.load(
self.NATIVE_MODEL_ID,
quantize_config=QuantizeConfig(dynamic=dynamic),
)
model.quantize(self.calibration, batch_size=2)
for name, submodule in model.named_m... | Python | 1 |
t): the number of foreground pixels in gt
BG (int): the number of background pixels in gt
Returns:
dict: TP, FP, TN, FN
"""
adaptive_threshold = get_adaptive_threshold(pred, max_value=1)
binary = pred >= adaptive_threshold
return self.get_statistics(binar... | Python | 1 |
class LinkElementId(object):
"""
LinkElementId represents an element in a linked document.
LinkElementId(linkInstanceId: ElementId,elementId: ElementId)
LinkElementId(elementId: ElementId)
"""
def Equals(self,obj):
"""
Equals(self: LinkElementId,obj: object) -> bool
Determines whether the specifi... | Python | 1 |
32.into(), 1.234f64.into()]) {}
Node1_1: [&[1u8, 2, 4, 8, 16][..], "Hello, world"] {}
},
};
let mut writer = Writer::new(Cursor::new(Vec::new()), FbxVersion::V7_5)?;
writer.write_tree(&tree1)?;
let bin = writer.finalize_and_flush(&Default::default())?.into_inner();
let mut pars... | Rust | 0 |
conversion asked from energy value to power value (without time dimension).");
}
}
/// Helper func to compute the multiplicative factor needed for a conversion
fn get_mult(pos_source: usize, pos_dest: usize) -> f64 {
let mut mult: f64 = 1.0;
match pos_dest.cmp(&pos_source) {
... | Rust | 0 |
lpha) + alpha * color[c] * 255,
image[:, :, c])
return image
@classmethod
def apply_point(cls, image, points):
r""" Apply mask to the given image. """
draw = ImageDraw.Draw(image)
if points.shape[0]==0:
return image
else:... | Python | 1 |
from src.deeplchain import (log,countdown_timer,_clear,log_line,read_config,
hju,pth,kng,htm,mrh,bru,reset,_banner, log_error) | Python | 1 |
_quick_sort()
{
let mut data = vec![5, 2, 12, 14, 7, 1, 5, 11, 5, 99, 25, 0, 9];
let expected = vec![0, 1, 2, 5, 5, 5, 7, 9, 11, 12, 14, 25, 99];
quick_sort(&mut data);
println!("{:?}", data);
for index in 0 .. data.len()
{
assert_eq!(expected[index], data... | Rust | 0 |
import socket
import threading
from Crypto.PublicKey import RSA
from Crypto.Cipher import PKCS1_OAEP
import time
from Crypto.Random import get_random_bytes
def lisner(pk,key) :
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.setblocking(1)
sock.setsockopt(socket.SOL_SOCKET,socket.SO_R... | Python | 1 |
utra::sha512::DIGEST61,
utra::sha512::DIGEST70,
utra::sha512::DIGEST71,
];
let mut i = 0;
for ® in digest_regs.iter() {
hash[i..i+4].clone_from_slice(&self.csr.r(reg).to_le_bytes());
i += 4;
}
self.csr.wo(utra::sha512... | Rust | 0 |
os.getcwd(), ini_file="omnetpp.ini", config="General", run_number=0, sim_time_limit=None, itervars="$repetition==0"):
# assert test_result == "ERROR" or sim_time_limit is not None
self.get_entries().append({"working_directory": working_directory,
"ini_file": ini_file,
... | Python | 1 |
limite = 500
a, b = 0, 1
serie_fibonacci = [a, b]
while b <= limite:
a, b = b, a + b
serie_fibonacci.append(b)
print(f"Série de Fibonacci até o valor maior que 500: {serie_fibonacci}")
| Python | 1 |
kspace.joinpath("venv"), virtualenv, environ=environ)
if (
keyring_provider not in [None, "auto"]
or keyring_provider_implementation != "subprocess"
):
script.pip(
"install",
"keyring",
)
if keyring_provider_implementation != "subprocess":
ke... | Python | 1 |
alignment)]
let shader_info = vk::ShaderModuleCreateInfo::builder().code(unsafe {
assert_eq!(ps.len() % 4, 0);
std::slice::from_raw_parts(ps.as_ptr() as *const u32, ps.len() / 4)
});
unsafe { device.create_shader_module(&shader_info, None) }?
}... | Rust | 0 |
.115,
'3': 0.119,
'4': 0.115,
'5': 0.173,
'6': 0.173,
'7': 0.135,
'8': 0.173,
'9': 0.154,
':': 0.176,
... | Python | 1 |
"""
Unit tests for WROM algorithm generator in generators/nonisomorphic_trees.py
"""
import pytest
import networkx as nx
from networkx.utils import edges_equal
class TestGeneratorNonIsomorphicTrees:
def test_tree_structure(self):
# test for tree structure for nx.nonisomorphic_trees()
def f(x):
... | Python | 1 |
th | None = None) -> None:
"""Save analysis results to file."""
if output_file is None:
output_file = self.experiment_dir / "analysis_report.txt"
report = self.generate_report()
with open(output_file, "w") as f:
f.write(report)
logging.info(f"Analysis r... | Python | 1 |
17111
//! 1319128137
//! 1359912421
//! 3125421639
//! 1293138521
//! 2311944581
//! ```
//!
//! The total risk of this path is `40` (the starting position is never entered,
//! so its risk is not counted).
//!
//! **What is the lowest total risk of any path from the top left to the bottom right?**
//!
//! # Part Two
/... | Rust | 0 |
.spawn(|_| {
let async_reader = self.async_readers.get();
let mut executor = F::new_executor(&self.global_extra_data);
let mut reads_buffer = Vec::new();
let mut reads_list = Vec::with_capacity(1024 * 32);
... | Rust | 0 |
&v)));
}
}
query.order((sort.desc(), created_at.desc()))
});
paginator()
}
pub fn delete(connection: &Conn, target: u32) -> Result<usize> {
use schema::push_messages::dsl::*;
let count = delete_by_id!(connection => (
push_m... | Rust | 0 |
# Import dependencies
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import yfinance as yf
import datetime as dt
yf.pdr_override()
# input
symbol = "AAPL"
start = dt.date.today() - dt.timedelta(days=365 * 4)
end = dt.date.today()
# Read data
df = yf.download(symbol, start, end)
n = 15
df["EMA... | Python | 1 |
let sub_device_id = DeviceInfoId {
product_key: "<KEY>".to_string(),
device_name: "subDevice".to_string(),
};
let sub_device_id2 = DeviceInfoId {
product_key: "gbgmHl8l0ee".to_string(),
device_name: "abcd".to_string(),
};
let sub_device_with_secret = DeviceInfoWithSecret {
product_key: sub_device_id.pro... | Rust | 0 |
KEY);
INSERT INTO temp.sub_segments(segment_id)
SELECT segment_id FROM {s}gfa1_connectivity WHERE component_id IN
(SELECT DISTINCT component_id FROM {s}gfa1_connectivity
WHERE segment_id IN temp.start_segments)
... | Rust | 0 |
rrently we only implemented zero-shot and three-shot!")
goal_function = create_goal_function(args, inference_model)
attack = create_attack(args, goal_function)
run_list = [
TASK_ORIENTED_PROMPT_SET[args.dataset],
ROLE_ORIENTED_PROMPT_SET[args.dataset],
]... | Python | 1 |
# Copyright 2019-2022 The ASReview Authors. 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 required by appl... | Python | 1 |
s in the unit_keys_dict
for keys_dict in unit_keys_dicts:
# keys dict validation
keys_dict_set = set(keys_dict)
extra_keys = keys_dict_set.difference(key_fields_set)
if extra_keys:
keys_errors.append(extra_keys_msg % {'a': ','.join(extra_keys),
... | Python | 1 |
, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#![allow(unused_macros)]
macro_rules! assert_matches {
... | Rust | 0 |
// lets keep a holding area for all the snapshot structs
let mut memspaces: Vec<Snapshot> = Vec::new();
// We have the maps contents of the process in a string, lets parse it
// First we go line by line
for line in map.lines() {
// Then for each line lets collect all the columns
let columns: Vec... | Rust | 0 |
########################################################################
# File name: oob.py
# This file is part of: aioxmpp
#
# LICENSE
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation, ... | Python | 1 |
) == 0:
query.message.delete()
sendMessage("No Photo to Show ! Add by /addpic", context.bot, update.message)
return
ind = int(data[3])+1
ind = len(config_dict['PICS']) - abs(ind) if ind < 0 else ind
pic_info = f'🌄 <b>Picture No. : {ind+1} / {len(config_dict["... | Python | 1 |
or toolset(self.env)
@conf
def __boost_get_libs_path(self, *k, **kw):
''' return the lib path and all the files in it '''
if 'files' in kw:
return self.root.find_dir('.'), Utils.to_list(kw['files'])
libs = k and k[0] or kw.get('libs', None)
if libs:
path = self.root.find_dir(libs)
files = path.ant_glob('*bo... | Python | 1 |
from secrets import token_hex
from bot import LOGGER, task_dict, task_dict_lock
from bot.helper.ext_utils.task_manager import (
check_running_tasks,
stop_duplicate_check,
)
from bot.helper.listeners.direct_listener import DirectListener
from bot.helper.mirror_leech_utils.status_utils.direct_status import Direc... | Python | 1 |
ort an error page for.");
return 1;
}
};
// Get the output to write to from the second argument
let output = match args.get(2) {
Some(output) => output,
None => {
eprintln!("You must provide an output location for the exported error page.");
return... | Rust | 0 |
from django.contrib import admin
from .models import (
Advisor,
Album,
Band,
Bee,
Car,
CarTire,
Event,
Inventory,
Member,
Profile,
ReleaseEvent,
School,
Student,
User,
VideoStream,
)
class WidgetAdmin(admin.AdminSite):
pass
class CarAdmin(admin.ModelA... | Python | 1 |
d'))
user_id = Column(Integer, ForeignKey('user.id'), default=None)
@validates('permission_id')
def validate_permission_id(self, key, value):
if value is None:
raise ValidationError(f'{key} cannot be empty.', metadata=dict(
key=key,
value=value,
... | Python | 1 |
ofs: usize, data: &[u32], callback: &mut vfs::node::ReadDirCallback) -> Option<usize>
{
for ent in DirEnts(&data[cur_ofs / 4..])
{
log_debug!("ent = {:?}", ent);
if ent.d_rec_len == 0 {
return Some(cur_ofs);
}
// Zero-length names should be ignored
if ent.d_inode == 0 || ent.d_name.len... | Rust | 0 |
| |_ _ ___ _ __( |_)_ _
* / _` | '_/ _ \ '_ \/| | ' \
* \__,_|_| \___/ .__/ |_|_||_| dropin-compiler - WebAssembly
* |_|
* Copyright © 2019-2022 Blue Forest
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as publi... | Rust | 0 |
ectors_left().is_none());
assert!(eigen.eigenvectors_right().is_none());
}
}
Ok(eigen)
}
Err(e) => { Err(e) }
}
}
#[test]
fn test_eigen_both_eigenvectors() {
let (m, n) = (8, 6);
le... | Rust | 0 |
from opencompass.openicl.icl_prompt_template import PromptTemplate
from opencompass.openicl.icl_retriever import ZeroRetriever
from opencompass.openicl.icl_inferencer import PPLOnlyInferencer
from opencompass.openicl.icl_evaluator import AveragePPLEvaluator
from opencompass.datasets import SanitizedMBPPDataset, JsonlDa... | Python | 1 |
# Prompt the user for student marks
marks = int(input("Enter the student's marks (0-100): "))
# Grading system based on the marks
if marks > 70:
print("Grade: Distinction 🏆")
elif marks >= 60:
print("Grade: Credit 🎖️")
elif marks >= 50:
print("Grade: Pass 👍")
else:
print("Grade: Fail ❌") | Python | 1 |
(d..RFS).rev() {
f[i]=f[i-d];
}
for i in (0..d).rev() {
f[i]=0;
}
return true;
}
/* OAEP Message Decoding for Decryption */
pub fn oaep_decode(sha: usize,p: Option<&[u8]>,f: &mut [u8]) -> usize {
let olen=RFS-1;
let hlen=sha;
let mut seed:[u8;64]=[0;64];
let seedlen=hlen;
let mut chash:[u8;64]=[0;64];
... | Rust | 0 |
&GlobalState,
) -> CrushResult<Option<String>> {
match prompt {
None => Ok(None),
Some(prompt) => {
let cmd = CommandInvocation::new(
ValueDefinition::Value(Value::Command(prompt), Location::new(0, 0)),
vec![]);
let (snd, recv) = pipe();
... | Rust | 0 |
leftrightarrow;" => "\u{027F7}",
"longmapsto;" => "\u{027FC}",
"LongRightArrow;" => "\u{027F6}",
"Longrightarrow;" => "\u{027F9}",
"longrightarrow;" => "\u{027F6}",
"looparrowleft;" => "\u{021AB}",
"looparrowright;" => "\u{021AC}",
"lopar;" => "\u{02985}",
... | Rust | 0 |
from dataclasses import dataclass
@dataclass
class ModelConfig:
vocab_size: int = 50257
embed_size: int = 256
hidden_size: int = 256
transformer_depth: int = 5
# MoE
intermediate_size: int = 256+64
n_experts: int = 8
n_shared_experts: int = 2
n_routed_experts: int = n_experts - n_... | Python | 1 |
2.0
// 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 writing, software
// distribute... | Rust | 0 |
EHOSTUNREACH = __WASI_ERRNO_HOSTUNREACH,
EIDRM = __WASI_ERRNO_IDRM,
EILSEQ = __WASI_ERRNO_ILSEQ,
EINPROGRESS = __WASI_ERRNO_INPROGRESS,
EINTR = __WASI_ERRNO_INTR,
EINVAL = __WASI_ERRNO_INVAL,
EIO = __WASI_ERRNO_IO,
EISCONN = __WASI_ERRNO_ISCONN,
EISDIR = __WASI_ERRNO_ISDIR,
ELOO... | Rust | 0 |
self) -> _SOC_SLPCK_OTG_ENW {
_SOC_SLPCK_OTG_ENW { w: self }
}
#[doc = "Bit 4"]
#[inline]
pub fn soc_actck_otg_en(&mut self) -> _SOC_ACTCK_OTG_ENW {
_SOC_ACTCK_OTG_ENW { w: self }
}
#[doc = "Bit 3"]
#[inline]
pub fn soc_slpck_sdio_hst_en(&mut self) -> _SOC_SLPCK_SDIO_HST... | Rust | 0 |
[i, 0, 2] = 0
elif i < 153:
colormap[i, 0, 0] = 0
colormap[i, 0, 1] = 255
colormap[i, 0, 2] = (i - 102) * 5
elif i < 204:
colormap[i, 0, 0] = 0
colormap[i, 0, 1] = 255 - (i - 153) * 5
colormap[i, 0, 2... | Python | 1 |
parser.add_argument("--duration", type=int, default=5, help="录音时长(秒)")
parser.add_argument(
"--output_folder", type=str, default="./audio", help="录音输出文件夹"
)
# 移除模型路径参数,因为使用ModelScope的预训练模型
args = parser.parse_args()
# 创建录音器实例,使用ModelScope AEC
recorder = DualRecorder()
if args... | Python | 1 |
t
if disp:
if not isfinite(errest) or errest >= errtol:
print("signm result may be inaccurate, approximate err =", errest)
return S0
else:
return S0, errest
def khatri_rao(a, b):
r"""
Khatri-rao product
A column-wise Kronecker product of two matrices
Param... | Python | 1 |
# _build_config.py.in is converted into _build_config.py during the meson build process.
from __future__ import annotations
def build_config() -> dict[str, str]:
"""
Return a dictionary containing build configuration settings.
All dictionary keys and values are strings, for example ``False`` is
retu... | Python | 1 |
ecimal {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
D: Deserializer<'de>,
{
if deserializer.is_human_readable() {
let v = f32::deserialize(deserializer)?.to_string();
let value = v.replace('.', "");
let value = value.parse::<i128>()... | Rust | 0 |
# -*- coding: utf-8 -*-
# Copyright (c) 2005 - 2010 Detlev Offenbach <detlev@die-offenbachs.de>
#
"""
Module implementing a Ruby lexer with some additional methods.
"""
from PyQt4.Qsci import QsciLexerRuby
from PyQt4.QtCore import QString, QStringList
from Lexer import Lexer
class LexerRuby(QsciLexerRuby, Lexer):
... | Python | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.