text string | label_name string | labels int64 |
|---|---|---|
(0, 0),
min_cluster_size,
max_cluster_size,
min_scaling_step,
max_scaling_step,
custom: Default::default(),
};
tracing::info!(?context, "pushing test context...");
assert_ok!(flow.push_context(context).await);
let event = &*assert_ok!(flow.recv_policy_event().awa... | Rust | 0 |
next_nonce >> 17;
next_nonce ^= next_nonce << 5;
self.random_nonce = next_nonce.0;
self.random_nonce
}
// Set the next alarm for this app using the period and provided start time.
fn set_next_alarm<F: Frequency>(&mut self, now: u32) {
self.alarm_data.t0 = now;
let no... | Rust | 0 |
from collections import namedtuple
from urllib.request import urlretrieve
import csv
# this script retrieves a csv of UN population data and prints the countries with the highest absolute growth 1950-2015
# number of countries to list
MAX_COUNTRIES = 10
# retrieves the csv
Country = namedtuple('Country', 'population... | Python | 1 |
1441)
self.assertEqual(ts_result.aggregation_statistics, 'Average')
# test for CV lookup tables
# there should be 23 CV_VariableType records
self.assertEqual(logical_file.metadata.cv_variable_types.all().count(), 23)
# there should be 805 CV_VariableName records
self.assertEqual(logical_file.m... | Python | 1 |
STOP_WORDS = set(
"""
a abo ale ani
dokelž
hdyž
jeli jelizo
kaž
pak potom
tež tohodla
zo zoby
""".split()
)
| Python | 1 |
pub _unk106: u8,
pub _unk107: u8,
pub collision_points: [u16; 0x4],
pub death_timer: u16,
pub defensive_matrix_dmg: u16,
pub matrix_timer: u8,
pub stim_timer: u8,
pub ensnare_timer: u8,
pub lockdown_timer: u8,
pub irradiate_timer: u8,
pub stasis_timer: u8,
pub plague_tim... | Rust | 0 |
in Clock or Pwm mode
//
// Param freq should be in range 4688Hz - 19.2MHz to prevent unexpected behavior,
// however output frequency of Pwm pins can be further adjusted with SetDutyCycle.
// So for smaller frequencies use Pwm pin with large cycle range. (Or implement custom software clock using output pin and sleep.)
... | Rust | 0 |
"""auth: add refresh_token_expires_at
Revision ID: 7fe1319250c5
Revises: 72a9b8f3f863
Create Date: 2025-10-02 10:50:21.169065
"""
from collections.abc import Sequence
from datetime import datetime, timedelta
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision: str = "7f... | Python | 1 |
PageTableEntry::from_address(pdpt.address()),
)
.unwrap();
asm::reload_cr3();
old_pml4e
}
use std::ffi::c_void;
use crate::cvreturn::CVReturn;
use crate::cvbase::{CVTimeStamp, CVOptionFlags};
use std::ops::{DerefMut, Deref};
use coregraphicsr::CGDirectDisplayID;
///Use pointers to this like ... | Rust | 0 |
type Subscriber = Subscriber;
type Error = core::convert::Infallible;
fn start(self) -> Result<Self::Subscriber, Self::Error> {
Ok(Subscriber::default())
}
}
/* SPDX-License-Identifier: MIT */
use zram_generator::{config, generator};
use anyhow::Result;
use fs_extra::dir::{copy, CopyOptions}... | Rust | 0 |
Get the user from the database
:param db: Session: Get the database session from the dependency injection container
:return: A streamingresponse object, which is a subclass of response
:doc-author: Trelent
"""
image = await ImagesRepo(user, db).get_single(image_id)
if image is None:
rai... | Python | 1 |
except RuntimeError:
self.init_ui
core.showWindow(self.window)
core.window(self.window, edit=True, w=self.width, h=self.height)
def close(self, value):
"""closes the UI"""
core.deleteUI(self.window_name, window=True)
### learning Scene Version
def set... | Python | 1 |
let mut lu = LU {
lu_size: lu_size,
lu_nz: vec![S::zero(); lu_size],
lu_row_ind: vec![0; lu_size],
u_col_ptr: vec![0; ncol + 1],
l_col_ptr: vec![0; ncol],
row_perm: vec![0; nrow],
col_perm: vec![0; ncol],
n: n,
};
let (mut rmatch, mut cmatch) = m... | Rust | 0 |
forge_optional_xml_element(name: &str, content: Option<&String>) -> XMLElement {
if content.is_some() {
return forge_xml_element(name, content.unwrap().to_string());
}
return XMLElement::new(name);
}
fn forge_url_element(name: &str, content: Option<&String>, node_type: &Nodetypes) -> XMLElement {
... | Rust | 0 |
lf):
m = Prophet()
m.fit(self.__df)
# Calculate the number of cutoff points(k)
horizon = pd.Timedelta('4 days')
period = pd.Timedelta('10 days')
k = 5
df_cv = diagnostics.cross_validation(
m, horizon='4 days', period='10 days', initial='90 days')
... | Python | 1 |
pend(f"{str(key_l)}_{str(new_fid)}")
i_min, j_min = closest_i_j(line_obj.xy, dict_of_line_objects[new_fid].xy)
pp.create_switch(net, bus=line_obj.buses[i_min],
element=dict_of_line_objects[new_fid].buses[j_min],
... | Python | 1 |
ender_label("q_0", inits) != ""
def test_cluster_gates():
"""Test clustering gates"""
pgates = [
("MEASURE", "q_0"),
("GFF", "q_0", "q_1"),
("U1", "q_0", "q_2"),
("U1", "q_0", "q_3"),
("U1", "q_0", "q_4"),
("H", "q_1"),
("U1", "q_1", "q_2"),
("U1... | Python | 1 |
[cfg_attr(test, assert_instr(vpcmpeqd))]
#[stable(feature = "simd_x86", since = "1.27.0")]
pub unsafe fn _mm256_cmpeq_epi32(a: __m256i, b: __m256i) -> __m256i {
transmute::<i32x8, _>(simd_eq(a.as_i32x8(), b.as_i32x8()))
}
/// Compares packed 16-bit integers in `a` and `b` for equality.
///
/// [Intel's documentati... | Rust | 0 |
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
class Solution:
def pathSum(self, root: Optional[TreeNode], target: int) -> int:
if root == None:
return... | Python | 1 |
().or_else(|| cache.prefix.clone()),
version: self.backend.clone().or_else(|| cache.version.clone()),
}
}
}
<reponame>SyaOS/smeargle<gh_stars>0
mod locate;
mod normalize;
mod serve;
mod state;
use std::convert::TryFrom;
use std::env;
use async_std::path::PathBuf;
use crate::locate::locate;
us... | Rust | 0 |
A period 2 oscillator that is the smallest and most common oscillator.
#C www.conwaylife.com/wiki/index.php?title=Blinker
x = 3, y = 1, rule = B3/S23
3o!").unwrap())
}
pub fn get_r_pentomino() -> RuleLengthEncoded {
RuleLengthEncoded::new_from_rle(
Rle::new(r"#N R-pentomino
#C A methuselah with lifespan 1... | Rust | 0 |
# =============================================================================
#
# Copyright (c) Kitware, Inc.
# All rights reserved.
# See LICENSE.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even
# the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
# PURPOSE.... | Python | 1 |
.step_adjustments
.get(&num_decks)
.copied()
.unwrap_or_default();
if step_size == 0 || step_size > total_points {
bail!(
"Step size of {} must be between 5 and {}",
step_size,
total_points
... | Rust | 0 |
MD_FORMAT_UNDERLINED: &str = "\u{e2bd}";
pub const MD_FORUM: &str = "\u{e2be}";
pub const MD_FORWARD: &str = "\u{e2c0}";
pub const MD_FORWARD_10: &str = "\u{e2c2}";
pub const MD_FORWARD_30: &str = "\u{e2c3}";
pub const MD_FORWARD_5: &str = "\u{e2c4}";
pub const MD_FREE_BREAKFAST: &str = "\u{e2c5}";
pub const MD_FULLSC... | Rust | 0 |
s:%(process)d:%(name)s:%(levelname)s %(message)s")
)
inner_logger.propagate = False
parser = ArgumentParser()
parser.add_arguments(TrainContext(), dest="context")
args = parser.parse_args()
context: TrainContext = args.context
if not context.output_dir:
current_time = datetime.now(... | Python | 1 |
e_num && inode_num <= self.inode_count);
unsafe {
let inode = (Buffer::read(inode_num).get_data().as_ptr() as *const Inode).read();
INODES.assume_init_mut().insert(inode_num, Arc::new(inode));
Arc::clone(INODES.assume_init_ref().get(&inode_num).unwrap())
}
}
}
pu... | Rust | 0 |
write!(f, "[{}]", lane)?;
}
}
Ok(())
}
Self::SysReg(sr) => write!(f, "{}", sr),
Self::MemReg(mr) => write!(f, "[{}]", mr),
Self::MemPreIdx { reg, imm } => write!(f, "[{}, #{}]!", reg, imm),
Self::MemPostIdxI... | Rust | 0 |
class Solution:
def destroyTargets(self, nums: List[int], space: int) -> int:
count = collections.Counter([num % space for num in nums])
maxCount = max(count.values())
return min(num for num in nums if count[num % space] == maxCount)
| Python | 1 |
(GameMode::TKO, ctx, msg, args).await
}
#[command]
#[description = "Display statistics of ctb user"]
#[usage = "[username]"]
#[example = "badewanne3"]
#[aliases("ctb", "ctbprofile", "profilec")]
pub async fn profilectb(ctx: &Context, msg: &Message, args: Args) -> CommandResult {
profile_send(GameMode::CTB, ctx, ms... | Rust | 0 |
# Copyright 2024-2025 IBM Corporation
import pytest
from aiu_trace_analyzer.pipeline.be_pair import AbstractHashQueueContext, EventPairDetectionContext
# helper list to test input
_event_list = [
{'name': 'eventA', 'ph': 'B', 'ts': 0, 'pid': 0},
{'name': 'eventA', 'ph': 'E', 'ts': 5, 'pid': 0},
... | Python | 1 |
REproduce".to_string())?;
}
self.seq_no += 1;
if converter.convert(self.event_id(), &line, &mut msg).is_err() {
// TODO: error handling for conversion failure
report.skip(line.len());
}
... | Rust | 0 |
}
let xx = x_num / x_den;
let yy = y * (y_num / y_den);
self.e1.new_point(xx, yy)
}
}
<gh_stars>1-10
use mq::{
camera::{set_camera, Camera2D},
color::{RED, WHITE},
math::Rect,
};
use zgui as ui;
mod common;
#[derive(Clone, Copy, Debug)]
enum Message {
Command,
}
... | Rust | 0 |
ueError("step 不能为 0")
except Exception as e:
raise HTTPException(status_code=400, detail=f"范围参数错误: {e}")
# 生成包含端点的范围
if step > 0:
rng = range(start, end + 1, step)
else:
rng = range(start, end - 1, step)
max_pages = 1000
count = len(list(rng))
if count > max_pages:
... | Python | 1 |
his PKGBUILD was generated by `cargo aur`: https://crates.io/crates/cargo-aur"
)?;
writeln!(file)?;
writeln!(file, "pkgname={}-bin", package.name)?;
writeln!(file, "pkgver={}", package.version)?;
writeln!(file, "pkgrel=1")?;
writeln!(file, "pkgdesc=\"{}\"", package.description)?;
writeln!(fi... | Rust | 0 |
text = numsButton[x][y].textEntered.get()
numsButton[x][y].textEntered.set(numsButton[newX][y].textEntered.get())
numsButton[newX][y].textEntered.set(text)
checkWin()
break
for j in range(-1, 2):
ne... | Python | 1 |
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serialize(&self.0, serializer)
}
}
impl<'de, T: Deserialize + ?Sized + 'static> serde::de::Deserialize<'de> for Arc<T> {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
D: serde::Deserializer<'... | Rust | 0 |
#!/usr/bin/env python3
# Copyright (C) 2019 Checkmk GmbH - License: GNU General Public License v2
# This file is part of Checkmk (https://checkmk.com). It is subject to the terms and
# conditions defined in the file COPYING, which is part of this source code package.
from collections.abc import Mapping
from cmk.agen... | Python | 1 |
from datetime import datetime as DateTime, timezone as TimeZone
import vampytest
from ....utils import datetime_to_timestamp
from ..fields import put_clip_created_at
def _iter_options():
clip_created_at = DateTime(2016, 5, 14, tzinfo = TimeZone.utc)
yield None, False, {}
yield None, True, {'clip_c... | Python | 1 |
pioResponse {
let result = unsafe { gpioGetPWMrange(user_gpio) };
match result {
BAD_USER_GPIO => Err("Bad user gpio".to_string()),
_ => Ok(result as u32),
}
}
/// Returns the real range used for the GPIO.
///
/// If a hardware clock is active on the GPIO the reported real range will be 100... | Rust | 0 |
1,
i,
dynamic.load_bias
+ dynamic.rela_read(i, "r_offset")
+ dynamic.rela_read(i, "r_addend"),
)
if dynamic.has_jmprel:
for i in range(dynamic.jmprel_entry_count()):
if dynamic.jmprel_read(i, "... | Python | 1 |
/ Don't rotate or mirror anything
capabilities.current_transform,
// Opaque window
CompositeAlpha::Opaque,
presentation_mode,
// Don't really care
FullscreenExclusive::Default,
// Don't render parts of the viewport out of the screen
... | Rust | 0 |
erver_name, &nameservers, WhatToFetch::Keys, format, sni);
}
_ => panic!("Unrecognized subcommand.")
}
}
_ => panic!("Unrecognized subcommand.")
}
}
<gh_stars>1-10
use wasm_bindgen::prelude::*;
use parser::Parser;
mod dic;
mod parser;
mod tokenizer;
#[w... | Rust | 0 |
err_msg=f"Local values mismatch when {case_info}.",
)
def run_test_case_backward(self, test_case: SoftmaxGradTestCase):
a = paddle.rand(test_case.input_shape, "float32")
a.stop_gradient = False
input_placements = [dist.Replicate() for _ in range(self.mesh.ndim)]
inpu... | Python | 1 |
) -> JsResult<JsFunction> {
JsFunction::new(call.scope, add1)
}
pub fn call_js_function(call: Call) -> JsResult<JsNumber> {
let scope = call.scope;
let f = try!(try!(call.arguments.require(scope, 0)).check::<JsFunction>());
let args: Vec<Handle<JsNumber>> = vec![JsNumber::new(scope, 16.0)];
try!(f.... | Rust | 0 |
from fastapi import FastAPI, Depends, HTTPException
from sqlalchemy.orm import Session
import time
from sqlalchemy.exc import OperationalError
from app import database, models, schemas, redis_client
import warnings
warnings.filterwarnings('ignore')
# MySQL bağlantısı hazır olana kadar bekle
# bu bekleme olmadan f... | Python | 1 |
dd\x11\x98\xc8\xb9\x1bS\
)woZ\xda\x04\x07\x80\xa8S\xff*\x08\x9c\x5cN\
S\xc0\x87z\xab\x05P\xeb\x16\xc7\xc4\xeec\x00\xee\x01\
0=C\x80\xaf\xe2\xadP\xc0\xb7n\x09\xa8[<\xbd\
\xc2:\x82\xf6\x8f\x03@\x84m\xccd\x16\x03\xfa\x16\xeb\
\x8e\xa0\x04\xf2\xa5\x5c\xb9|\x87u\x87kbz\xb7\x1c\
\xc7\xf7\xd4T\x83\xa5\xd2VO\xf4\x9f\xac;\x82\x... | Python | 1 |
None]
UC_HOOK_CALLBACK_TYPE = Union[
UC_HOOK_CODE_TYPE,
UC_HOOK_INSN_INVALID_TYPE,
UC_HOOK_MEM_INVALID_TYPE,
UC_HOOK_MEM_ACCESS_TYPE,
UC_HOOK_INSN_IN_TYPE,
UC_HOOK_INSN_OUT_TYPE,
UC_HOOK_INSN_SYSCALL_TYPE,
UC_HOOK_INSN_SYS_TYPE,
UC_HOOK_INSN_CPUID_TYPE,
UC_HOOK_EDGE_GEN_TYP... | Python | 1 |
r (i, asteroid) in self.asteriods.iter_mut().enumerate() {
match self.map.check_collision(bullet, asteroid) {
None => continue,
Some(collision_position) => {
collision_result = asteroid.process_collision(&collision_position, &self.map);
... | Rust | 0 |
a non-rooted path.
//!
//! If the result of this process is an empty string, return the string `"."`, representing the current directory.
//!
//! It performs this transform lexically, without touching the filesystem. Therefore it doesn't do
//! any symlink resolution or absolute path resolution. For more information yo... | Rust | 0 |
from django.urls import path,include
from . views import *
urlpatterns = [
path('get-tasks/<str:id>/',display_tasks,name='get_tasks'),
path('post-task',post_task,name='post_task'),
path('change-task/<str:id>/',change_task,name='change_task'),
]
| Python | 1 |
import numpy as np
import cv2
def zmMinFilterGray(src, r=5):
'''最小值滤波,r是滤波器半径'''
return cv2.erode(src, np.ones((2 * r + 1, 2 * r + 1))) # 使用opencv的erode函数更高效
def guidedfilter(I, p, r, eps):
'''引导滤波,直接参考网上的matlab代码'''
height, width = I.shape
m_I = cv2.boxFilter(I, -1, (r, r))
m_p = cv2.boxFil... | Python | 1 |
from dataclasses import dataclass, field
import tyro
import numpy as np
import jax.numpy as jnp
import navix as nx
from navix import observations
from navix.agents import PPO, PPOHparams, ActorCritic
from navix.environments.environment import Environment
# set persistent compilation cache directory
# jax.config.update... | Python | 1 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
import re
import time
from colorama import Fore, init
# Initialize colorama
init(autoreset=True)
# Links
YOUTUBE_LINK = "https://youtube.com/@hackers_colony_tech?si=pvdCWZggTIuGb0ya"
BGMI_SUPPORT_LINK = "https://bgmi.krafton.com/en/support"
# Countdown helper... | Python | 1 |