text string | label_name string | labels int64 |
|---|---|---|
C sh t j j d | j } t j j d | j } t j j d | j } t j j d | j } t j j | | | | g | _ | j r t j j d | j
} t j j | j | g | _ n | j rg t j D] } t j j
| j | ^ q } t j | j t j } t t | t j } g | D]( \ ... | Python | 1 |
try:
book.set_cover('cover.jpg', cover_data)
except Exception as e:
print(f"封面添加失败: {str(e)}")
# 创建章节内容
spine = ['nav']
chapters_epub = []
for idx, content_info in enumerate(chapter_contents):
if not content_info or not con... | Python | 1 |
fn serialize_operation_crate_operation_describe_alarms_for_metric(
input: &crate::input::DescribeAlarmsForMetricInput,
) -> Result<aws_smithy_http::body::SdkBody, aws_smithy_http::operation::SerializationError> {
let mut out = String::new();
#[allow(unused_mut)]
let mut writer =
aws_smithy_query... | Rust | 0 |
impl Count {
pub fn from_json(json: &[u8]) -> Result<Self> {
let value: Value = serde_json::from_slice(json)?;
let map = value
.as_object()
.ok_or_else(|| anyhow!("Expected Object"))?;
let row_count = map
.get("row_count")
.ok_or_else(|| anyhow... | Rust | 0 |
:L[c @ s5 d Z d d l Td d l Z d d l Z d Z d S( s ----------------------------------------------------------------------------
engine.py
----------------------------------------------------------------------------i( t *Nc C s g } x | D] } | j d k r ... | Python | 1 |
.
///
/// If a joined thread returns an error, the error is returned and no other threads are joined.
fn join_background_tasks(&mut self) {
while !self.background_tasks.is_empty() {
let _ = self.background_tasks.remove(self.background_tasks.len() - 1).join();
}
}
}
impl<'a> From<&'a SdlRect> for Rectangle {... | Rust | 0 |
import asyncio
from aiohttp import web
from tt_web import log
from tt_web import postgresql
async def initialize(config):
await postgresql.initialize(config['database'])
async def deinitialize(config):
await postgresql.deinitialize()
async def on_startup(app):
await initialize(app['config'])
asyn... | Python | 1 |
class Japanese:
strings = {
"restart_requested": "🔄 **再起動要求** {user_full_name} (@{username})より\nPID: `{process_id}`",
"restart_canceled": "🔄 再起動はキャンセルされました。",
"restart_aborted": "❌ 再起動は中止されました。",
"restart_awaiting": "⏳ アクティブなタスクの終了を待機中...\n経過時間: {time_elapsed}",
"restart_in... | Python | 1 |
ure_partial_challenges(mix);
let mut partial_challenges = self.partial_challenges.clone().unwrap();
if partial_challenges.is_empty() {
None
} else {
let partial_challenge = partial_challenges.remove(0);
self.partial_challenges = Some(partial_challenges);
... | Rust | 0 |
j.Vertex([150,650],'h'),
]
edges = [gobj.Edge(vertices[0], vertices[1], label = r.randint(1,MAX_WEIGHT)),
gobj.Edge(vertices[1], vertices[2], label = r.randint(1,MAX_WEIGHT)),
gobj.Edge(vertices[2], vertices[3], label = r.randint(1,MAX_WEIGHT)),
gobj.Edge(vertices[3]... | Python | 1 |
# Code generated by Lark OpenAPI.
from typing import Any, Optional, Union, Dict, List, Set, IO, Callable, Type
from lark_oapi.core.model import BaseRequest
from lark_oapi.core.enum import HttpMethod, AccessTokenType
class ListUserMailboxFolderRequest(BaseRequest):
def __init__(self) -> None:
super().__in... | Python | 1 |
#!/usr/bin/env python3
"""
Week 5 GUI Demo for Privatus-chat
Demonstrates the complete GUI implementation with all Week 5 features:
- PyQt6-based user interface
- Security status indicators
- Contact management system
- Privacy control panel
- Real-time chat interface
- Integration with backend systems
"""
import s... | Python | 1 |
pub sai_assoc_id: sctp_assoc_t
}
#[repr(C)]
#[derive(Debug, Clone, Copy)]
pub struct sctp_pdapi_event {
pub pdapi_type: u16,
pub pdapi_flags: u16,
pub pdapi_length: u32,
pub pdapi_indication: u32,
pub pdapi_assoc_id: sctp_assoc_t
}
pub const SCTP_PARTIAL_DELIVERY_ABORTED: u32 = 0;
#[repr(C)]
#[d... | Rust | 0 |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | Python | 1 |
_4back_data_wo_lures(data_path_4back_bin = "5-back data/training_5back_data_wo_lures.csv")
data_preprocessor.prep_4back_data_w_lures(data_path_4back_mc = "5-back data/training_5back_data_w_lures.csv")
# Create sequences and split data
X_test_5back_wo_lures, y_test_5back_wo_lures = data_preprocessor.create_... | Python | 1 |
match = re.match(r"(\d+)(\s+)?(days|months)", value, re.I)
if match:
num, _, unit = match.groups()
num = int(num)
if unit.lower() == "days":
compare_date = datetime.utcnow() - timedelta(days=num)
elif unit.lower() ==... | Python | 1 |
"""Brute-force substring search using the alternate brute-force implementation.
i points to end of sequence of already-matched chars in text
j stores # of already-matched chars (end of sequence in pattern
# i j i+j 0 1 2 3 4 5 6 7 8 9 10
# -|-|---|----------------------
# | | |A B A C A D A B R A C
# 7|3| 7| ... | Python | 1 |
dels.Deck.id == deck_id).join(models.UserDeck).filter(models.UserDeck.user_id == current_user.id).first()
if deck == None:
raise HTTPException(status_code=status.HTTP_403_FORBIDDEN,
detail="Not allow to change flashcards in this deck")
cards = db.query(models.Card).filte... | Python | 1 |
import tkinter as tk
class SimpleMenu:
def __init__(self, root):
"""Initialize the GUI menu."""
self.root = root
self.root.title("Simple GUI Menu")
# Create a label to display the last button pressed
self.label = tk.Label(root, text="Press a button", font=("Arial", 14))
... | Python | 1 |
>;
fn deref(&self) -> &Self::Target {
self.as_slice()
}
}
impl<T: RawEncodingBuf> DerefMut for TritBuf<T> {
fn deref_mut(&mut self) -> &mut Self::Target {
self.as_slice_mut()
}
}
impl<T: RawEncodingBuf> FromIterator<<T::Slice as RawEncoding>::Trit> for TritBuf<T> {
fn from_iter<I:... | Rust | 0 |
2016-11-15");
#[allow(unused_mut)]
let mut scope_1961 = writer.prefix("DryRun");
if let Some(var_1962) = &input.dry_run {
scope_1961.boolean(*var_1962);
}
#[allow(unused_mut)]
let mut scope_1963 = writer.prefix("VpcPeeringConnectionId");
if let Some(var_1964) = &input.vpc_peering_con... | Rust | 0 |
_key.insert(Rand::new_random(rng), Rand::new_random(rng));
}
for _ in 0..(2 + rng.gen::<u8>() / 32) {
simple.insert(Rand::new_random(rng), Rand::new_random(rng));
}
for _ in 0..(2 + rng.gen::<u8>() / 32) {
map.insert(new_string_random(rng), Rand::new_random(rng));... | Rust | 0 |
a, 'tcx> {
TypeSkolemizer {
infcx: infcx,
skolemization_count: 0,
skolemization_map: hash_map::HashMap::new(),
}
}
fn skolemize(&mut self,
opt_ty: Option<ty::t>,
key: ty::InferTy,
skolemizer: |uint| -> ty::In... | Rust | 0 |
);
// first block in the second group
assert_eq!(
calc_mwc_block_overage(MIMBLE_BLOCKS_PER_GROUP + 1, true),
genesis_reward
+ MIMBLE_FIRST_GROUP_REWARD * MIMBLE_BLOCKS_PER_GROUP
+ MIMBLE_SECOND_GROUP_REWARD
);
// 60th bl... | Rust | 0 |
st: VariableList<u64, typenum::U8>,
//! fixed_vector: FixedVector<u64, typenum::U8>,
//! }
//!
//! let mut example = Example {
//! bit_vector: Bitfield::new(),
//! bit_list: Bitfield::with_capacity(4).unwrap(),
//! variable_list: <_>::from(vec![0, 1]),
//! fixed_vector: <_>::from(vec![2, 3]),
//! };... | Rust | 0 |
.keys() {
if &src_addr != client_address { // DUPLEX, only send to other server
socket.send_to(serialize(&client_rect).unwrap().as_slice(), client_address).expect("couldn't send message");
}
} // end sending for loop
} // close server fn
/* pub fn wait(seconds: u64) {
let tim... | Rust | 0 |
import os
import numpy as np
import nibabel as nib
inputPathWT = 'postProcessing/outputWT'
inputPath3L = 'postProcessing/output3L'
outputPath = 'postProcessing/relabeled'
filesWT = [f.name for f in os.scandir(inputPathWT) if f.name.endswith('.nii.gz')]
files3L = [f.name for f in os.scandir(inputPath3L) if f.name.en... | Python | 1 |
\x08s\xee\xd9 =h\
\xef\xe0`\xdd\xca\xf6\x03\xc2\xd4\xc1\xc7\xefU\xc1f\x8c\
\xcd\xc2\x94\xe0\x22\xe6\x06\x06eN\xe8p\xef\xa0\x83\xc9\
4\xde\x18\xd2\xb3\xa0cE\x0f\x8dS\xd6#\x7fg\xe1\
?/\x09\xf4\x93A\xc6\xb3\xb5`T\xfb\x7fsW\xe5\
\x1a\x0dh)\xabU8}41\xc6\x82\xa9840\
\xd0\xf5\xe9\x803+P\x97&UF\xab\xf8lmd\
\xbb\xf2\xd7\xbc\xf0... | Python | 1 |
# Control Structures in Python
# Control structures allow you to direct the flow of execution in your code.
# if statement
x = 10
if x > 5:
# This block executes if the condition is True
print("x is greater than 5")
elif x == 5:
# This block executes if the previous condition is False and this condition is... | Python | 1 |
8\xe5\x94\xb4?\x88u\xc8f\x03\x98\x98`\
V\x91\xc4\x0f\xe0\xb6E39\xb1\xf74\xee\xb8\x12r\
S\xc7s\xffm\xb5Ey\x1b\xeb\x0fB\xdc\x87\xa6.\
\xean\xaf\xc5s\x0b\xf3\xb8\x8d[\x0e\x80\xb5\xc4\xe6\xd4\
\x14\x9d\xbc\xfd\xb8X\x19\x805\xa8\x9f\xda\xe3\x92\xed\xae\
'f\xf2i\x8b\x11lW\x86p\x98\xca\xdf{d9\
\x7f\xff\xa5\x85\x84\xa1\xc58\x8... | Python | 1 |
# Mathematics > Number Theory > Divisor Exploration
# Find and print the number of divisors for each dataset.
#
# https://www.hackerrank.com/challenges/divisor-exploration/problem
# https://www.hackerrank.com/contests/infinitum16/challenges/divisor-exploration
# challenge id: 11996
#
#!/bin/python3
import os
import s... | Python | 1 |
-SHA512");
h2.update(message_hash);
h2.update(R.compress().as_bytes());
Scalar::from_hash(h2)
}
/// Calculate using Lagrange's method the interpolation of a polynomial.
///
/// # Note
///
/// isis stole some of this from Chelsea and Ian, but they stole it from
/// Lagrange, so who can really say.
fn calcu... | Rust | 0 |
Uri;
pub(crate) fn parse_or_build_grpc_endpoint(input: &str) -> Result<String, http::Error> {
let mut uri = input.parse::<Uri>()?;
if uri.port().is_none() {
return Ok("".to_string());
}
if uri.scheme().is_none() {
let builder = Uri::builder();
uri = builder
.scheme... | Rust | 0 |
(self.im * x).round()/x,
)
}
}
#[cfg(test)]
mod tests
{
use super::*;
use num::Complex;
use std::ops::Div;
use assert_approx_eq::assert_approx_eq;
pub fn de_moivre(element_deg: f64, iter_deg: f64, deg_bound: f64) -> Complex<f64>
{
let pi = std::f64::consts... | Rust | 0 |
import sqlite3
import json
def trim_json(json_string):
try:
# Parse the JSON string
data = json.loads(json_string)
# Check if it's in the old format (list with one dict with "_" key)
if isinstance(data, list) and len(data) == 1 and "_" in data[0]:
# Extract and ... | Python | 1 |
"""ESPHome constants."""
from awesomeversion import AwesomeVersion
DOMAIN = "esphome"
CONF_ALLOW_SERVICE_CALLS = "allow_service_calls"
CONF_DEVICE_NAME = "device_name"
CONF_NOISE_PSK = "noise_psk"
DEFAULT_ALLOW_SERVICE_CALLS = True
DEFAULT_NEW_CONFIG_ALLOW_ALLOW_SERVICE_CALLS = False
STABLE_BLE_VERSION_STR = "2023... | Python | 1 |
= Quaternion::new(
(rotmat[(2, 1)] - rotmat[(1, 2)]) / denom,
_0_25 * denom,
(rotmat[(0, 1)] + rotmat[(1, 0)]) / denom,
(rotmat[(0, 2)] + rotmat[(2, 0)]) / denom,
);
} else if rotmat[(1, 1)] > rotmat[(2, 2)] {
let denom = (... | Rust | 0 |
m(pid: Pid) -> io::Result<Self> {
Ok(Self(task_for_pid(pid)?))
}
}
/// On Darwin, process handle is a mach port name.
impl TryFrom<mach_port_name_t> for ProcessHandle {
type Error = io::Error;
fn try_from(mach_port_name: mach_port_name_t) -> io::Result<Self> {
... | Rust | 0 |
m_idp);
if found_match {
break;
}
}
}
}
}
//if no DP matches then return false
if !found_match {
return Err(Error::CrlIncompatible);
}
}
if le... | Rust | 0 |
from matplotlib import _api
import mpl_toolkits.axes_grid1.axes_grid as axes_grid_orig
from .axislines import Axes
_api.warn_deprecated(
"3.8", name=__name__, obj_type="module", alternative="axes_grid1.axes_grid")
@_api.deprecated("3.8", alternative=(
"axes_grid1.axes_grid.Grid(..., axes_class=axislines.Ax... | Python | 1 |
_with_u16(x).sub_bytes();
un_bit_slice_4x1_with_u16(&bs)
}
enum KeyType {
Encryption,
Decryption
}
// This array is not accessed in any key-dependant way, so there are no timing problems inherent in
// using it.
static RCON: [u32; 10] = [0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36];
// The... | Rust | 0 |
ning sets in both
"""
steps = splits_steps(a, b)
n = sum(tf.num_triples for tf in a)
return 1 - steps / n
AnyTriples = tuple[str, str, str] | Sequence[tuple[str, str, str]] | LabeledTriples | MappedTriples | CoreTriplesFactory
def get_mapped_triples(
x: AnyTriples | None = None,
*,
mappe... | Python | 1 |
MatchFn) -> Vec<f64>
where Point: Coordinate,
MatchFn: Fn(Point, Point) -> bool {
// Helper function to determine if a bounding box is below the minimum size
let min_size_squared = min_size * min_size;
let is_valid_match = |p1: Point, p2: Point| {
let diff = p1... | Rust | 0 |
e|fi|endif)\b', Keyword),
include('function_call'),
include('variable_name'),
include('operator'),
include('number'),
(r'[()]', Text),
(r',', Punctuation),
],
'old_arguments': [
(r'\n', Whitespace, '#pop'),
... | Python | 1 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from . import test_edi_ewaybill_json
from . import test_edi_ewaybill_distance
| Python | 1 |
(value) => value,
Err(_) => return Err(format!("Could not parse world key: {}", &world_parts[0]))
};
let world_key = WorldKey::new(world_key_value);
let gate_parts: Vec<&str> = world_parts[1].trim_matches(|c| c == '(' || c == ')' ).split(',').collect();
f... | Rust | 0 |
import zmq
from datetime import datetime,date
class ProgramaAcademico:
# Atributos de la clase
nombre:str
semestre:date
num_salones:int
num_laboratorios:int
ip_puerto_facultad:str
context:zmq.Context # Crea sockets para el proceso actual.
socket_facultad:zmq.Socket # Socket para comunicarse con las facu... | Python | 1 |
stringify!(oldmask)
)
);
assert_eq!(
unsafe { &(*(::std::ptr::null::<sigcontext>())).cr2 as *const _ as usize },
176usize,
concat!(
"Offset of field: ",
stringify!(sigcontext),
"::",
stringify!(cr2)
)
);
... | Rust | 0 |
TL_PAD_GPIO_SPI_B1_07,
#[doc = "0x70c - ENET2_IPG_CLK_RMII_SELECT_INPUT DAISY Register"]
pub enet2_ipg_clk_rmii_select_input: ENET2_IPG_CLK_RMII_SELECT_INPUT,
#[doc = "0x710 - ENET2_IPP_IND_MAC0_MDIO_SELECT_INPUT DAISY Register"]
pub enet2_ipp_ind_mac0_mdio_select_input: ENET2_IPP_IND_MAC0_MDIO_SELECT_I... | Rust | 0 |
y 10 actions
.dropsave(false) // save the account state on drop
.milestone(4) // save a snapshot every 4 actions
.storage(AccountStorage::Memory) // use the default in-memory storage adapter
.build()
.await?;
println!("[Example] Account = {:#?}", account);
Ok(())
}
<gh_stars>0
//! Configuratio... | Rust | 0 |
=> MetricValue::Int(int),
None => super::missing("Non-numeric division result"),
}
}
MathFunction::Greater => return MetricValue::Bool(operands[0] > operands[1]),
MathFunction::Less => return MetricValue::Bool(operands[0] < operands[1]),
... | Rust | 0 |
if baseline_key == OURMETHOD:
handles.append(ax.plot([], [], label="{} (Without Post-Processing)".format(baseline_key), color='black', linestyle='', marker='o')[0])
labels.append("{} (Without Post-Processing)".format(baseline_key))
... | Python | 1 |
5, 'F': 5, 'G': 7, 'H': 7, 'I': 3, 'J': 4, 'K': 6, 'L': 5, 'M': 9, 'N': 7, 'O': 8, 'P': 6, 'Q': 8, 'R': 6, 'S': 5, 'T': 6, 'U': 7, 'V': 6, 'W': 10, 'X': 6, 'Y': 6, 'Z': 6, ' ': 2, '!': 3, '"': 4, '#': 6, '$': 6, '%': 8, '&': 7, "'": 2, '(': 3, ')': 3, '*': 4, '+': 6, ',': 2, '-': 3, '.': 2, '/': 4, ':': 3, ';': 3, '<':... | Python | 1 |
flag: tcflag_t,
pub c_line: cc_t,
pub c_cc: [cc_t; 17usize],
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct termios2 {
pub c_iflag: tcflag_t,
pub c_oflag: tcflag_t,
pub c_cflag: tcflag_t,
pub c_lflag: tcflag_t,
pub c_line: cc_t,
pub c_cc: [cc_t; 19usize],
pub c_ispeed: speed_t,
pub c_ospeed: speed_t,
}
#[repr(C)... | Rust | 0 |
from django.urls import include, path
from . import urlconf_inner
urlpatterns = [
path("test/me/", urlconf_inner.inner_view, name="outer"),
path("inner_urlconf/", include(urlconf_inner.__name__)),
]
| Python | 1 |
ector3::new(x[0], x[1], x[2])),
loc: Vector3::new(x[3], x[4], x[5]),
intrin: Vector3::new(x[6], x[7], x[8]),
}
}
/// Parse a camera to a vector of parameters. Order is rotation as a 3 element Rodrigues vector, translation, intrinsics.
pub fn to_vec(&self) -> Vec<f64> {
... | Rust | 0 |
x1c_\xacGT\x8c\xf9\
\xc7,\xbfN\x93+\xe9\x9dn-1\xea\x92\xc3\x84s\
S\xce-\xbb\xaa\xfbj\xb6\x03\x9d>J\x1e8\xe5x\
K\xab\xe4n'P3|\x88\xc2\xe9\x85.\x1a\xe0\xbe\
\xe2S\xb8KkR\x96\x8b\xf9\x05\x109o\x87\xfe+\
\xf6\x96\xe2\xe7\x10\xa4\xce\xaaD\xaf\xd4`\xc1B\x22J\
n\x97L\xaeG\xa5\xc5\x89\x12C\x851\x8b\x92\x94\x95\
\xa9o,Ydi\x09BH... | Python | 1 |
,
mut,
offsetof,
override,
priv,
proc,
pub,
pure,
ref,
return,
self,
sizeof,
sta... | Rust | 0 |
Message::AddVarF32(AddVar::<f32> { label, value: self })
}
fn add_ranged_var_message(self, label: String, min_max: (f32, f32)) -> ToGuiLoopMessage {
ToGuiLoopMessage::AddRangedVarF32(AddRangedVar::<f32> {
label,
min_max,
value: self,
})
}
fn update_r... | Rust | 0 |
_variable_id(&ir_module.types, &ir_module.global_variables, handle);
}
for (handle, _) in ir_module.constants.iter() {
self.get_constant_id(handle, &ir_module);
}
for annotation in self.annotations.iter() {
annotation.to_words(&mut self.logical_layout.annotation... | Rust | 0 |
from __future__ import absolute_import
from __future__ import division
import argparse
import string
import sys
import pwnlib.args
pwnlib.args.free_form = False
from pwn import *
from pwnlib.commandline import common
parser = common.parser_commands.add_parser(
'cyclic',
help = "Cyclic pattern creator/finder... | Python | 1 |
e='cuda') + C_.T @ D2invC
# Sigma_inv = ( torch.diag(1/d_**2)
# - D2invC @ torch.inverse( inv_kernal ) @ D2invC.T )
Sigma_inv = torch.diag(1/d_**2) - D2invC @ torch.linalg.solve(inv_kernal, D2invC.T)
# compute logq
log_Sigma_deter = torch.sum(torch.log(d_**2)) + t... | Python | 1 |
[i].as_ref());
}
}
}
#[derive(Debug, PartialEq, Eq)]
struct Payment {
customer_id: i32,
amount: i32,
account_name: Option<String>,
}
pub fn mysql() -> std::result::Result<String, mysql::error::Error> {
use mysql::prelude::*;
use mysql::*;
let url = "mysql://isucon:isucon@localhost:33... | Rust | 0 |
.");
println!();
println!("Running artemis_nano tests...");
artemis_nano_c_hello().unwrap_or_else(|e| panic!("artemis_nano job failed with {}", e));
artemis_nano_blink().unwrap_or_else(|e| panic!("artemis_nano job failed with {}", e));
// Doesn't work
// artemis_nano_sensors().unwrap_or_else(|e|... | Rust | 0 |
g", ChanNameRef::new("chan"));
tui.set_topic(
"This is channel topic",
time::now(),
SERV,
ChanNameRef::new(CHAN),
);
tui.draw();
{
let mut text = String::new();
let mut file = File::open("test/lipsum.txt").unwrap();... | Rust | 0 |
mutate.rs
use couchbase::subdoc::MutateInSpec;
use couchbase::Cluster;
use futures::executor::block_on;
fn main() {
env_logger::init();
let mut cluster = Cluster::connect("couchbase://127.0.0.1", "Administrator", "password")
.expect("Could not create Cluster reference!");
let bucket = cluster
... | Rust | 0 |
from datetime import datetime, timedelta, timezone
import pytz
import reflex as rx
# Comun
def lang() -> rx.Component:
return rx.script("document.documentElement.lang='es'")
preview = "avatar.png"
_meta = [
{"name": "og:type", "content": "website"},
{"name": "og:image", "content": preview},
... | Python | 1 |
(tx), PilotReceiver(rx))
}
pub struct PilotAddHubMsg {
pub hub: HubSender,
pub ix: usize,
}
#[derive(Clone, Debug)]
pub enum Hub2PilotMsg {
BizMsg(PilotServiceBizMsg),
EncodingMsg(&'static str),
}
#[derive(Debug, Clone)]
pub struct PilotServiceBizMsg {
pub service: String,
pub data: Bytes,
}
... | Rust | 0 |
ger=risk_manager,
initial_capital=actual_capital or config.get('initial_capital', 10000.0),
max_active_positions=config.get('max_active_positions', 3)
)
# Subscribe to market data
for symbol in symbols:
logging.info(f"Subscribing to market data for {s... | Python | 1 |
render_graph::{AssetRenderResourcesNode, RenderGraph, RenderResourcesNode},
shader::{Shader, ShaderStage, ShaderStages},
texture::TextureFormat,
};
pub const SHADED_SHEET_PIPELINE_HANDLE: Handle<PipelineDescriptor> =
Handle::from_u128(91168858051802816124217444474933884151);
pub fn build_shaded_sheet_... | Rust | 0 |
Pool2d(kernel_size=2, stride=2)
self.pool2 = nn.MaxPool2d(kernel_size=4, stride=4)
self.conv = nn.Sequential(
nn.Conv2d(3*channels, channels, kernel_size=1),
nn.ReLU(inplace=True)
)
def forward(self, x):
x1 = nn.functional.interpolate(self.pool1(x), x.shape[... | Python | 1 |
�', "xū"),
('䱭', "gèng"),
('䱮', "é"),
('䱯', "mú"),
('䱰', "zhòng"),
('䱱', "tí,dì"),
('䱲', "yuán"),
('䱳', "zhān"),
('䱴', "gèng"),
('䱵', "wēng"),
('䱶', "láng"),
('䱷', "yú"),
('䱸', "sōu,qiū"),
('䱹', "zhǎ"),
('䱺', "hái"),
('䱻', "huá"),
('䱼', "zhǎn"),
('䱾', ... | Rust | 0 |
distances.append(im_data)
# Check data from tiled cameras are different, assumes >1 tiled cameras
for i in range(1, num_tiled_cameras):
assert torch.abs(rgbs[0] - rgbs[i]).mean() > 0.05 # images of same color should be below 0.001
assert torch.abs(distances[0] - d... | Python | 1 |
hannel_id = "sound_blanket_channel"
channel_name = "Sound Blanket"
channel = NotificationChannel(channel_id, channel_name, NotificationManager.IMPORTANCE_LOW)
notification_manager = Context.getSystemService(Context.NOTIFICATION_SERVICE)
notification_manage... | Python | 1 |
ch == '(' {
tks.push("(".to_string());
} else if ch == ')' {
tks.push(")".to_string());
} else if ch.is_numeric() {
let mut nums: Vec<char> = Vec::new();
nums.push(ch);
loop {
if let Some(d) = i... | Rust | 0 |
1
mode = get_mode()
stop2 = True
time.sleep(0.05)
if mode:
try:
current_val = plc_client.read_area(area, dbNo, start, 1)
clear = clear_bit(current_val[0], 3)
plc_client.write_area(area, dbNo, start, clear.to_bytes(1, 'big'))
except:
pass
... | Python | 1 |
mber of sample:', nsamples)
return all_good
def flip(data):
y_4 = np.zeros_like(data)
y_1 = y_4
y_2 = y_4
first = np.concatenate((y_1, y_2, y_1), axis=1)
second = np.concatenate((y_4, data, y_4), axis=1)
third = first
Data = np.concatenate((first, second, third), axis=0)
return Data... | Python | 1 |
import os
import bpy
import sys
from bpy.props import *
from . utils import module_util
from . operators import module_installer
addonName = os.path.basename(os.path.dirname(__file__))
class AnimationNodesPreferences(bpy.types.AddonPreferences):
bl_idname = addonName
def draw(self, context):
layout =... | Python | 1 |
IntoIterator<Item = u8>,
{
let iter = iter.into_iter();
let (lower, upper) = iter.size_hint();
// Avoid possible conversion into mut if there's nothing to add
if let Some(0) = upper {
return;
}
let mut bytes_mut = match mem::replace(self, LocalBytes::n... | Rust | 0 |
/// Basic Usage:
///
/// ```
/// icyHot(120, -1) → true
/// icyHot(-1, 120) → true
/// icyHot(2, 120) → false
/// ```
pub fn icy_hot(a: i32, b: i32) -> bool {return false;}
/// Given 2 int values, return true if either of them
/// is in the range 10..20 inclusive.
///
/// # Example
///
/// Basic Usage:
///
/// ```
... | Rust | 0 |
//
// A mapper between module and repository ID, for recursive types.
struct IdMapper {
enum_offset: i64,
extension_offset: i64,
function_offset: i64,
implementation_offset: i64,
interface_offset: i64,
record_offset: i64,
}
impl IdMapper {
fn new(
enum_offset: i64,
extensio... | Rust | 0 |
consume();
} else {
CurrentThread::current().schedule(consume, Duration::new(0, 0));
}
}
}
type MutexState<C, S> = Arc<Mutex<Option<(C, S)>>>;
type SharedItem<T> = Arc<Atom<Box<(Instant, T)>>>;
struct DebounceState<C, S, T> {
delay: Duration,
mutex: MutexState<C, S>... | Rust | 0 |
if "YOUR_ATTACKER_IP" in args.command or "YOUR_ATTACKER_PORT" in args.command:
print("\n[!!! WARNING !!!] You have provided a reverse shell command.")
print(" Please ensure 'YOUR_ATTACKER_IP' and 'YOUR_ATTACKER_PORT'")
print(" are replaced with your actual att... | Python | 1 |
assert_eq!(
unsafe { &(*(::std::ptr::null::<gameserveritem_t>())).m_szGameTags as *const _ as usize },
236usize,
concat!(
"Offset of field: ",
stringify!(gameserveritem_t),
"::",
stringify!(m_szGameTags)
)
);
assert_eq!(
unsafe { &(*(::std::ptr::null::<gameserveritem_t>())).m_steamID as *const _... | Rust | 0 |
ize,
/// Leaf content.
pub leaf: Vec<u8>,
}
#[derive(Debug, Default, BorshDeserialize, BorshSerialize)]
pub struct InProcessState {
pub position: usize,
commitment_hash: Hash,
signed_commitment: SignedCommitment,
validator_proofs: Vec<ValidatorMerkleProof>,
validator_set: BeefyNextAuthoritySet,
}
#[derive(Debu... | Rust | 0 |
reachable!()
}
}
impl ser::SerializeStructVariant for StringKeySerializer {
type Ok = String;
type Error = ConfigError;
fn serialize_field<T>(&mut self, key: &'static str, value: &T) -> Result<()>
where
T: ?Sized + ser::Serialize,
{
unreachable!()
}
fn end(self) -> Res... | Rust | 0 |
# This file was auto-generated by Fern from our API Definition.
import typing
ReasoningEffort = typing.Union[typing.Literal["low", "medium", "high"], typing.Any]
| Python | 1 |
SLV_RD_DMA_DONE_INT_RAW_R(crate::FieldReader::new(bits))
}
}
impl core::ops::Deref for SLV_RD_DMA_DONE_INT_RAW_R {
type Target = crate::FieldReader<bool, bool>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `SLV_RD_DMA_DONE_INT_RAW` writer - The raw... | Rust | 0 |
from . import database, models, schemas
| Python | 1 |
# id 37160 ([Elodin] Ruenna's Feathered Nuisance), field 101082000
sm.setSpeakerID(1501001) # Ruenna the Fairy
sm.setParam(4)
sm.setInnerOverrideSpeakerTemplateID(1501013) # Ruenna the Fairy
sm.sendNext("You fainted. Clearly you scare easily.")
sm.setParam(2)
sm.sendSay("Don't blame me! You're the one gliding around in... | Python | 1 |
import sys
from textwrap import dedent
from redmail import EmailSender
from convert import remove_email_content_id, prune_generated_headers
IS_PY37 = sys.version_info < (3, 8)
def test_distributions():
class DistrSender(EmailSender):
"Send email using pre-defined distribution lists"
def __init__... | Python | 1 |
ratio(frame_height: Coord, content_height: Coord) -> Coord {
let ratio = frame_height / content_height;
Coord::min(Coord::max(MINIMUM_THUMB_RATIO, ratio), MAXIMUM_THUMB_RATIO)
}
#[inline]
fn pixel_space_to_content_space_conversion_factor(&self) -> Coord {
// this method is different... | Rust | 0 |
else:
raise ValueError(f"Unknown dataset: {args.dataset}")
hg = data[0].to(device)
num_rels = len(hg.canonical_etypes)
category = data.predict_category
labels = hg.nodes[category].data.pop("labels")
train_mask = hg.nodes[category].data.pop("train_mask")
test_mask = hg.nodes[category].... | Python | 1 |
import pickle
import numpy as np
import pytest
from ngboost import NGBClassifier, NGBRegressor, NGBSurvival
from ngboost.distns import MultivariateNormal
# name = learners_data to avoid pylint redefined-outer-name
@pytest.fixture(name="learners_data")
def fixture_learners_data(
breast_cancer_data, california_ho... | Python | 1 |
"Error, part {} does't match \n{:?}\n{:?}\nnext start: line: {}, column: {}",
i, item, part, pos.start.line, pos.start.column
)
}
}
i += 1;
}
// only one default export is allowed so these must be run ad-hoc
let js_list = v... | Rust | 0 |
feat_resnet = data[self.input1_field]
data[self.output_field] = update
if self.non_linearity:
if not self.non_linearity_after_resnet:
data = self.gate(data)
data[self.output_field] += feat_resnet
else:
... | Python | 1 |
:cmp::Ordering::{Equal, Less, Greater};
match r.binary_search_by(|&(lo, hi, _)| {
if lo <= c && c <= hi { Equal }
else if hi < c { Less }
else { Greater }
}) {
Ok(idx) => {
let (lower, upper, cat) = r[idx];
(lower as u32, up... | Rust | 0 |
(\tR\x12graphInputNodeName\x123\n\x16g\
raph_output_node_name\x18\x03\x20\x03(\tR\x13graphOutputNodeName\x12#\n\
\rexecutor_name\x18\x04\x20\x01(\tR\x0cexecutorName\x12D\n\x1eserialized\
_executor_parameters\x18\x05\x20\x01(\x0cR\x1cserializedExecutorParamete\
rs\x12\x84\x01\n\x20default_graph_input_ten... | Rust | 0 |
]
#[inline]
pub fn is_10(&self) -> bool {
*self == WUPE17R::_10
}
#[doc = "Checks if the value of the field is `_11`"]
#[inline]
pub fn is_11(&self) -> bool {
*self == WUPE17R::_11
}
}
#[doc = "Possible values of the field `WUPE18`"]
#[derive(Clone, Copy, Debug, PartialEq)]
p... | Rust | 0 |
#!/usr/bin/env python3
"""
測試 GUI 模組
"""
import unittest
import sys
from pathlib import Path
from unittest.mock import patch, MagicMock
# 添加 src 目錄到 Python 路徑
project_root = Path(__file__).parent.parent
sys.path.insert(0, str(project_root / 'src'))
class TestGUI(unittest.TestCase):
"""GUI 模組測試"""
def se... | Python | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.