text string | label_name string | labels int64 |
|---|---|---|
: The process name of the application to stop.
Returns:
AppOperationResult: Result object containing success status and error message if any.
"""
from agentbay.application import ApplicationManager
app_manager = ApplicationManager(self.session)
return app_manager.sto... | Python | 1 |
mem_index.index()), val);
}
#[test]
fn test_read_mem() {
let mut cpu = Cpu::new(1024, 0);
let val = MemReg::U8(100);
let tests = [
(false, true), // write to 0, read from 0
(true, false), // write to reg 0, read from reg 0
(true, true), ... | Rust | 0 |
'device': device
}
})
self.badges.print_empty("")
self.badges.print_information(
f"Type {self.colors.GREEN}devices{self.colors.END} to list all connected devi... | Python | 1 |
51Kk1EyjjICp+nl4tIXoqT0YoqXzEYDCISicDn
88Hn88Hv9yefE0Lg9/uTZX6/P1lGCEnWYY/sOYDkexTjJV1ODc83plMfYp0ZYI8shFlnZFgZex4M
BlOSBCvSEPf48eO8nby1EZyeW8tkr1nLGOyErQNpUVk2r3uJ9PfiNE3z8FAK1wg8IuG9/GxGioP8
fj8qKio8OyDFC/x+f0oZ2b179z8BhLw6CFG4Svfotq4oJGXzWOjwBuDfAUrp7wGMePmpxRLKMqUA
IW/WB+BDAN96/cmKtHwL4KeEUopdu3bVAjgD4CCADYU9rrLnHw... | Python | 1 |
/// }
/// }
/// }
/// # fn do_something_with(_: i16) { }
/// ```
pub fn sample<T: Sample>(&self, channel: usize, frame: usize) -> T {
assert!(self.read_started);
assert!(channel < self.channel_count(), "Channel out of range");
assert!(frame < self.frame_coun... | Rust | 0 |
g unit "
"has been defined as self-balanced at company "
"level."
)
)
@api.constrains("operating_unit_id", "journal_id")
def _check_journal_operating_unit(self):
for move in self:
if (
... | Python | 1 |
.iter().collect::<String>().as_str())
.expect(format!("Rules didn't include pattern {:?}", pattern.iter().collect::<String>().as_str()).as_str());
next_state.push(result);
if index < *index_offset {
*index_offset = index;
}
index += 1;
}
while next_stat... | Rust | 0 |
Args {
blobfs_layout: BlobFSLayout::Compact,
budgets: test_fs.path("size_budgets.json"),
blob_sizes: [test_fs.path("blobs.json")].to_vec(),
gerrit_output: Some(test_fs.path("output.json")),
},
Box::new(FakeToolProvider::default()),
... | Rust | 0 |
p.bump();
exp(p);
p.eat(SK::OfKw);
matcher(p);
p.exit(ent, SK::CaseExp)
} else if p.at(SK::FnKw) {
p.bump();
matcher(p);
p.exit(ent, SK::FnExp)
} else {
p.abandon(ent);
let mut ex = at_exp(p)?;
loop {
let op_info = p.peek().and_then(|tok| {
if tok.kind == SK... | Rust | 0 |
spawn().expect("couldnt start ganache-cli");
// wait a couple of seconds for ganache to boot up
sleep(Duration::from_secs(5));
ganache_pid
}
use interledger_settlement_engines::engines::ethereum_ledger::run_ethereum_engine;
#[derive(serde::Deserialize)]
struct DeliveryData {
delivered_amount: u64,
}
#... | Rust | 0 |
# %%
import pandas as pd
import numpy as np
from collections import Counter
import sys
# %%
#inPath = "/shared/3/projects/benlitterer/podcastData/hostIdentification/hostGuestPredictions/10000LongPredictions.json"
df = pd.read_json(sys.argv[1], orient="records", lines=True)
df = df.dropna()
# %%
def getMode(inList):
... | Python | 1 |
import random
def choose_word():
word_list = ["python", "hangman", "challenge", "random", "function", "developer", "software"]
return random.choice(word_list).lower()
def display_word_state(word, guessed_letters):
return ''.join([letter if letter in guessed_letters else '_' for letter in word])
def hangm... | Python | 1 |
#!/usr/bin/env python3
# Copyright (c) 2025 HomomorphicEncryption.org
# All rights reserved.
#
# This software is licensed under the terms of the Apache v2 License.
# See the LICENSE.md file for details.
"""
verify_result.py - correctness oracle for add-two-ints
"""
import sys
from pathlib import Path
def main():
... | Python | 1 |
error if the database operation fails
fn update(&self, instance: Self::ManagedType) -> Result<(), Self::Error>;
/// Delete the matching instance of `ManagedType` from the `Repository`
///
/// # Errors
///
/// This function will return an error if the database operation fails
fn delete(&sel... | Rust | 0 |
_base_ = './yolov6_s_syncbn_fast_8xb32-300e_coco.py'
# ======================= Possible modified parameters =======================
# -----model related-----
# The scaling factor that controls the depth of the network structure
deepen_factor = 0.6
# The scaling factor that controls the width of the network structure
w... | Python | 1 |
.update_n(result);
self.update_z(result);
}
}
}
pub fn load(&mut self, address: u16) -> u8 {
// 0x0000 - 0x07FF: 2KB internal RAM
// 0x0800 - 0x1FFF: Mirrors of 0x0000 - 0x07FF (repeats every 0x800 bytes)
if address < 0x2000 {
return self.ram.load((address & 0x07FF) as u32);
}
/... | Rust | 0 |
ate: Option<String>,
) -> Result<ResourceCheckResult> {
let mut items: HashMap<&'static str, CheckResult> = HashMap::new();
for verb in constants::ALL_VERBS
.iter()
.filter(|v| resource.verbs.contains(&v.to_ascii_lowercase()))
{
items.insert(
verb,
check_resou... | Rust | 0 |
import numpy as np
def spline_curvature(f, x):
return f.derivative(2)(x) / ((1 + np.square(f.derivative(1)(x)))**(1.5))
def curvature(y):
y_prime = y[1:] - y[:-1]
y_pp = y_prime[1:] - y_prime[:-1]
return y_pp / ((1 + np.square(y_prime[:-1]))**(1.5)) | Python | 1 |
from telegram.ext import ContextTypes, Application
TOKEN = '8402834860:AAFlpWErSZwabKcg3BrC5HXRj7usJhn-v4o'
async def callback_30(context: ContextTypes.DEFAULT_TYPE):
await context.bot.send_message(chat_id=5102936741, text='SERVER STARTED AND RUNNING ...')
application = Application.builder().token(TOKEN).build(... | Python | 1 |
0x0103,
(
'#0030290666V#524F呵呵……\n',
'你终于明白过来了啊。',
TxtCtl.Enter,
),
)
CloseMessageWindow()
Fade(250)
ChrClearFlags(0x0101, 0x0080)
ChrClearFlags(0x0103, 0x0002)
ChrSetChipByIndex(0x0103, 65535)
ChrSetSubChip(0x0103, 0)
ChrSetC... | Python | 1 |
ntsize=12)
# remove border
plt.gca().spines["left"].set_visible(False)
plt.gca().spines["top"].set_visible(False)
plt.gca().spines["right"].set_visible(False)
# set title and labels
plt.title(title, fontsize = 14, loc="left", pad=24, fontweight="bold")
plt.xlabel(x_label, fontsize=14)
... | Python | 1 |
, args).await,
Self::UpdateForever { interval } => {
Self::update_forever(client, args, Duration::from_secs(interval)).await
}
}
}
async fn list(client: &Client, args: &Args) -> Result<(), Box<dyn std::error::Error>> {
let public_ips = client
... | Rust | 0 |
",
"count": {"$sum": 1},
"last_occurrence": {
"$max": {
"$cond": [
{"$eq": ["$type", "url_access"]},
"$accessed_at",... | Python | 1 |
h" in images_dict:
del images_dict["depth"]
if not position and "position" in images_dict:
del images_dict["position"]
if not segmentation and "segmentation" in images_dict:
del images_dict["segmentation"]
if not normal and "normal" in images_dict:
... | Python | 1 |
크 조회 성공 테스트"""
user_ids = [user_weekly_trend.user.id]
mock_trends = [
{
"user_id": user_weekly_trend.user.id,
"insight": user_weekly_trend.insight,
}
]
with patch.object(UserWeeklyTrend.objects, "filter") as mock_filter:
... | Python | 1 |
t = match c {
// this character, when confronted, will start a tag
'<' => "<",
// in an unquoted attribute, will end the attribute value
'>' => ">",
// in an attribute surrounded by double quotes, this character will end the attribute value
'... | Rust | 0 |
ressbar(fenetre, orient="horizontal", length=400, mode="determinate")
progress_bar.pack(pady=5)
# Boutons sur la même ligne
boutons_frame = tk.Frame(fenetre, bg="#1e1e2e")
boutons_frame.pack(pady=10)
ttk.Button(boutons_frame, text="Générer l'EXE", command=generer_exe).pack(side="left", padx=5)
ttk.Button(boutons_fram... | Python | 1 |
f, enable_dce: bool) -> Self {
Self {
enable_dce: Some(enable_dce),
..self
}
}
}
fn test_frontend(
source_name: String,
source_code: &str,
forbidden_permutations: ForbiddenPermutations,
check: fn(IRModule),
) {
let code = typecheck(source_name.clone(), so... | Rust | 0 |
Win32_Security_Cryptography_Certificates\"`*"]
pub const FR_PROP_STATUSSTRING: FULL_RESPONSE_PROPERTY_ID = 5u32;
#[doc = "*Required features: `\"Win32_Security_Cryptography_Certificates\"`*"]
pub const FR_PROP_OTHERINFOCHOICE: FULL_RESPONSE_PROPERTY_ID = 6u32;
#[doc = "*Required features: `\"Win32_Security_Cryptography... | Rust | 0 |
import requests
import os
import zipfile
import shutil
# Configuration
GITHUB_API_URL = "https://api.github.com/repos/TerenceRiss/SeahawksNester/releases/latest"
DOWNLOAD_PATH = "update.zip"
INSTALL_DIR = "C:/path/to/your/app" # Remplacez par le chemin de votre application
def get_latest_release():
"""Récupérer ... | Python | 1 |
n\
f_k_name = get_K_blocks_POLY_RBF6dof_no_subs\n\
[LK_POLY_vel_RBF]\n\
LK_model_name = m_GP_LK_POLY_RBF\n\
f_k_name = get_K_blocks_POLY_vel_RBF6dof_no_subs\n\
[LK_GIP_sum]\n\
lk_model_name = m_GP_LK_GIP_sum\n\
f_k_name = get_K_blocks_GIP_sum_PANDA_6dof_no_subs\n\
[LK_RBF_M]\n\
LK_model_name = m_GP_LK_RBF_M\n\
f_k_name... | Python | 1 |
"""
super() e a sobreposição de membros - Python Orientado a Objetos
Classe principal (Pessoa)
-> super class, base class, parent class
Classes filhas (Cliente)
-> sub class, child class, derived class
"""
# class MinhaString(str):
# def upper(self):
# print('CHAMOU UPPER')
# retorno = super(... | Python | 1 |
Word {
if shift == 0 {
return 0;
}
lhs.iter_mut().fold(0, |carry, word| {
let (w, c) = split_dual(extend_word(*word) << shift);
*word = w | carry;
c
})
}
#[inline]
fn carrying_shr_word(lhs: &mut [Word], shift: u32) -> Word {
if shift == 0 {
return 0;
}
lhs.iter_mut().rev().fold(0, |c... | Rust | 0 |
ses affect the loss calculation")
return masked_labels
if __name__ == "__main__":
test_response_masking()
print("\n" + "="*60)
print("IMPACT ON EXPERIMENT 1")
print("="*60)
print("🔄 Before: Loss calculated on entire sequence (questions + answers)")
print("🎯 After: Loss calculate... | Python | 1 |
s = """hello, world
welcome to here!
"""
def uppercase_decorator(func):
def wrapper(text):
return func(text).upper()
return wrapper
@uppercase_decorator
def display_text(text):
return text
print(display_text(s))
'''
HELLO, WORLD
WELCOME TO HERE!
''' | Python | 1 |
oc = ""]
pub type bgfx_attrib_type = ::std::os::raw::c_uint;
#[doc = " Vertex attribute type enum."]
#[doc = ""]
pub use self::bgfx_attrib_type as bgfx_attrib_type_t;
pub const BGFX_TEXTURE_FORMAT_BC1: bgfx_texture_format = 0;
#[doc = " ( 0) DXT1 R5G6B5A1"]
pub const BGFX_TEXTURE_FORMAT_BC2: bgfx_texture_format = 1;
#[... | Rust | 0 |
poname>dangrabcad/rust-lexical
#![no_main]
#[macro_use] extern crate libfuzzer_sys;
extern crate lexical_core;
fuzz_target!(|data: &[u8]| {
let _ = lexical_core::try_atousize_slice(data);
});
#[doc = "Reader of register ALTPADCFGD"]
pub type R = crate::R<u32, super::ALTPADCFGD>;
#[doc = "Writer for register ALTPAD... | Rust | 0 |
""Update the learning rate after each update."""
stage, steps_in_stage = self._decide_stage(num_updates)
if stage == 0:
self.lr = self.init_lr + self.warmup_rate * steps_in_stage
elif stage == 1:
self.lr = self.peak_lr
elif stage == 2:
self.lr = self.p... | Python | 1 |
INTERFONTSTYLE = 0x1048,
PRINTERINDEXLEADCHAR = 0x1049,
PRINTERINDEXMAXVALUE = 0x104A,
PRINTERINDEXNUMDIGITS = 0x104B,
PRINTERINDEXSTEP = 0x104C,
PRINTERINDEXTRIGGER = 0x104D,
PRINTERSTRINGPREVIEW = 0x104E,
SHEETCOUNT = 0x104F,
CLEARBUFFERS = 0x101d,
SUPPORTEDCAPSEXT = 0x100c,
//... | Rust | 0 |
assert_eq!(month, 1);
assert_eq!(date, 1);
}
#[test]
fn round_trip_date_via_ymd() {
// roughly from 1970 to 2120
for i in 588..(588 + 150 * 365) {
// create a date from a julian and from the equivalent year,
// month and date, and validate that they ... | Rust | 0 |
> + Path<HERE>,
HERE: Path<THERE>,
{
type Here;
type There;
type Out;
fn collapse(self) -> Self::Out;
}
impl<WAVE, HERE: Default, THERE, PATH> Wave<WAVE, HERE, THERE> for PATH
where
WAVE: Path<HERE>,
PATH: Path<HERE> + Path<WAVE>,
HERE: Path<THERE>,
{
type Here = HERE;
type Ther... | Rust | 0 |
ub fn ScriptGetFontScriptTags(
hdc: HDC,
psc: *mut SCRIPT_CACHE,
psa: *mut SCRIPT_ANALYSIS,
cMaxTags: c_int,
pScriptTags: *mut OPENTYPE_TAG,
pcTags: *mut c_int,
) -> HRESULT;
pub fn ScriptGetFontLanguageTags(
hdc: HDC,
psc: *mut SCRIPT_CACHE,
... | Rust | 0 |
from_val(val: usize) -> RemoteCodePtr {
RemoteCodePtr { ptr: val }
}
pub fn as_usize(&self) -> usize {
self.ptr
}
/// As the name indicates this is just a cast. No try_into().unwrap() here!
pub fn as_isize(&self) -> isize {
self.ptr as isize
}
pub fn is_null(&self... | Rust | 0 |
import tkinter as tk
from tkinter import font as tkfont
from pynput import mouse, keyboard
# 计算新的窗口宽度(原宽度 300 像素增加 15%)
original_width = 300
new_width = int(original_width * 1.15)
# 创建主窗口
root = tk.Tk()
root.title("鼠标坐标显示")
root.geometry(f"{new_width}x120") # 调整窗口宽度
root.attributes("-topmost", True) # 窗口始终在最上层
# 设... | Python | 1 |
# -*- coding: utf-8 -*-
from numpy import isnan
from pandas import DataFrame, Series
from atklip.controls.pandas_ta._typing import DictLike, Int, IntFloat
from atklip.controls.pandas_ta.ma import ma
from atklip.controls.pandas_ta.maps import Imports
from atklip.controls.pandas_ta.utils import (
tal_ma,
v_mamode... | Python | 1 |
ound truth / target optical / scene flow
:param the mask, the mask has value 0 for all areas that are invalid
"""
invalid = None
if mask is not None:
invalid = 1.-mask
epe_map = torch.norm(target_flow-input_flow,p=2,dim=1)
B = epe_map.shape[0]
invalid_flow = (target_flow != target_... | Python | 1 |
}
}
fn decode_meta_chunk<R: Read>(mut reader: R) -> DecodedChunk {
let num_entries = reader.read_u32::<LittleEndian>().unwrap();
let mut entries = Vec::with_capacity(num_entries as usize);
for _ in 0..num_entries {
let key = reader.read_string().unwrap();
let value = reader.read_string... | Rust | 0 |
performing a tail call in `(recur)`
struct TailCallCtx {
self_abi: PolymorphAbi,
captures_reg: Option<BuiltReg>,
}
struct RecurSelf<'af> {
arret_fun: &'af value::ArretFun,
/// Return ABI type of expected by tail calls, if they're allowed
tail_call_ctx: Option<TailCallCtx>,
}
pub struct FunCtx<'rs... | Rust | 0 |
DMAADDRESS1_SPEC>`"]
pub type DEVDMAADDRESS1 = crate::Reg<devdmaaddress1::DEVDMAADDRESS1_SPEC>;
#[doc = "Device DMA Channel Address Register (n = 1)"]
pub mod devdmaaddress1;
#[doc = "DEVDMACONTROL1 register accessor: an alias for `Reg<DEVDMACONTROL1_SPEC>`"]
pub type DEVDMACONTROL1 = crate::Reg<devdmacontrol1::DEVDMAC... | Rust | 0 |
try:
if self.Token: # Если аутентификация успешна
INFO = self.Get_Info()
Tickets = INFO['Tickets'] # Баланс билетов
WP = INFO['WP'] # Баланс WP
COIN = INFO['COIN'] # Баланс COIN
Dollars = INFO... | Python | 1 |
(g)),
// Range 2^64-1 to -2^64
2 => {
let sgn = bool::arbitrary(g);
let v = u64::arbitrary(g) as i128;
Value::Integer(if sgn { v } else { -v })
}
3 => Value::Float(f64::arbitrary(g)),
4 => Value::Bytes(Arbitrary::arbitrary(g)),
5 => Val... | Rust | 0 |
64 {
0.0
}
}
#[derive(Default)]
pub struct NoMaterial;
impl Material for NoMaterial {}
pub struct Lamertian {
pub albedo: Arc<dyn Texture>,
}
impl Lamertian {
pub fn new(albedo: Vec3) -> Self {
Self {
albedo: Arc::new(SolidColor::new(albedo)),
}
}
pub fn newa(albe... | Rust | 0 |
# Copyright 2023 The Google Earth Engine Community Authors
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... | Python | 1 |
import numpy as np
from scipy.integrate import odeint
import matplotlib.pyplot as plt
u = 0.1 # social distancing (0-1)
# 0 = no social distancing
# 0.1 = masks
# 0.2 = masks and hybrid classes
# 0.3 = masks, hybrid, and online classes
t_incubation = 5.1
t_infective = 3.3
R0 =... | Python | 1 |
ad_config = Ad_Config(_cap)
ad_config.adjust_color_threshold()
def ad_circle(_cap: cv2.VideoCapture | Cap | ReceiveImg):
ad_config = Ad_Config(_cap)
ad_config.adjust_circle()
def ad_area(_cap: cv2.VideoCapture | Cap | ReceiveImg):
ad_area_config = Ad_Area_config(_cap)
ad_area_config.main()
def ad... | Python | 1 |
(opts.contract_address, client);
let mut tx_futs = Vec::new();
for addr in opts.address {
let tx = contract
.allowlist(addr)
.block(BlockNumber::Pending)
.send()
.await?;
println!("Sent `allow` tx for {:?} (hash: {:?})", addr, tx);
tx_futs... | Rust | 0 |
fn empty_evidence() {
let ev = Evidence { sum: None };
let ev_json = serde_json::to_string(&ev).unwrap();
let ev_deserialized = serde_json::from_str::<Evidence>(&ev_json).unwrap();
assert_eq!(ev, ev_deserialized);
}
}
use ash::vk;
use std::hash::Hasher;
use serde::{Deserialize,... | Rust | 0 |
(Into::into)
}
}
/// # Summary
///
/// ## SET_NMAS_RECOVERY
/// _SET_NMAS_RECOVERY sets out the NSCAS recovery data for payments other than testing._
///
/// * Data Set Name: Settlements
/// * File Name: Nmas Recovery
/// * Data Version: 2
///
///
///
/// # Notes
/// * (Visibility) Data in this table is: Private
... | Rust | 0 |
// Increments and Decrements
0xE6 => "INC d", 0xEE => "INC a", 0xF6 => "INC d,x", 0xFE => "INC a,x",
0xE8 => "INX", 0xC8 => "INY",
0xC6 => "DEC d", 0xCE => "DEC a", 0xD6 => "DEC d,x", 0xDE => "DEC a,x",
0xCA => "DEX", 0x88 => "DEY",
// Loads
... | Rust | 0 |
#!/usr/bin/env python3
"""
快速启动脚本
"""
import os
import sys
import asyncio
from loguru import logger
def check_dependencies():
"""检查依赖"""
try:
import pydantic
import dotenv
from loguru import logger as test_logger
logger.info("✅ 核心依赖已安装")
return True
except ImportErr... | Python | 1 |
ec![DEFAULT_METHOD.to_owned()]
}
/// default extensions to ignore while auto-collecting
pub(super) fn ignored_extensions() -> Vec<String> {
DEFAULT_IGNORED_EXTENSIONS
.iter()
.map(|s| s.to_string())
.collect()
}
/// default wordlist
pub(super) fn wordlist() -> String {
String::from(DEF... | Rust | 0 |
Config>,
hyper_client: HC,
runtime: &DockerModuleRuntime,
key_store: &DerivedKeyStore<K>,
workload_config: W,
root_key: K,
shutdown_signal: F,
crypto: &C,
mut tokio_runtime: tokio::runtime::Runtime,
) -> Result<(), Error>
where
F: Future<Item = (), Error = ()> + Send + 'static,
H... | Rust | 0 |
#!/usr/bin/env python3
# Copyright 2017 Google Inc. 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... | Python | 1 |
aster)| x).max().unwrap();
let max_y = *heightmaps.iter().map(|((_x, y), _raster)| y).max().unwrap();
let (width, height) = (heightmaps[0].1.width, heightmaps[0].1.height);
// Just to make the output prettier :)
heightmaps.sort_by_key(|((x, y), _)| -((x + y * height) as i32));
let cap = ((max_x +... | Rust | 0 |
}
fn update(&mut self, msg: Self::Message) {
match msg {
Msg::NewToast(toast) => {
for id in self.bridged_components.iter() {
self.link.respond(*id, Msg::NewToast(toast.clone()));
}
}
}
}
fn handle_input(&mut se... | Rust | 0 |
from django import forms
from .models import User
from django.contrib.auth.forms import AuthenticationForm
from django.core.exceptions import ValidationError
from django.contrib.auth import authenticate
# ---------------- Registration Form ----------------
class RegisterForm(forms.ModelForm):
password = forms.Char... | Python | 1 |
:Event::from_sdl2_event(event));
}
#[cfg(build = "debug")]
unsafe {
let render = self as *const RenderPipeline;
let imgui = self.imgui.as_mut().unwrap() as *mut ImGui;
let delta_s = delta.as_secs_f32();
... | Rust | 0 |
<u32>>();
verify::<TypedHandle<*const u32>>();
verify::<TypedHandle<core::cell::UnsafeCell<u32>>>();
verify::<TypedHandle<alloc::vec::Vec<u32>>>();
}
// Note: fails to compile if we have the variance wrong.
#[allow(dead_code, unused_assignments, unused_variables)]
fn check_handl... | Rust | 0 |
# Problem link - https://www.geeksforgeeks.org/problems/kadanes-algorithm-1587115620/1
def max_subarray_sum(arr):
"""
Time complexity is O(n) and space complexity is O(1).
"""
max_sum = -1e6
curr = 0
for i in range(len(arr)):
curr += arr[i]
max_sum = max(max_sum, curr)
... | Python | 1 |
class Solution(object):
def isMonotonic(self, nums):
"""
:type nums: List[int]
:rtype: bool
"""
increasing = decreasing = True
for i in range(1, len(nums)):
if nums[i] > nums[i - 1]:
decreasing = False
if nums[i] < nums... | Python | 1 |
#!/usr/bin/env python2.7
# autogenerate sample versions of rules from Chromium browser's HSTS
# preload list (in the from-preloads/ directory)
import urllib.request, urllib.error, urllib.parse, re, glob, os
from lxml import etree
preloads = urllib.request.urlopen("https://src.chromium.org/viewvc/chrome/trunk/src/net... | Python | 1 |
ue,
"reordering_algorithm": algo,
},
) as s:
s.add_assertion(self.big_tree)
self.assertTrue(s.solve())
self.assertEqual(algo, s.ddmanager.ReorderingStatus()[1])
@skipIfSolverNotAvailable("bdd")
def test_fixed_orderi... | Python | 1 |
W {
self.w.bits = (self.w.bits & !(0x01 << 2)) | (((value as u32) & 0x01) << 2);
self.w
}
}
#[doc = "Reader of field `COUNTFLAG`"]
pub type COUNTFLAG_R = crate::R<bool, bool>;
#[doc = "Write proxy for field `COUNTFLAG`"]
pub struct COUNTFLAG_W<'a> {
w: &'a mut W,
}
impl<'a> COUNTFLAG_W<'a> {
... | Rust | 0 |
wrap_err();
let expectation = expect![[r#"
[1;91merror[0m: [1mError parsing attribute "@@index": The SpGist index type does not support the type of the field `a`.[0m
[1;94m-->[0m [4mschema.prisma:15[0m
[1;94m | [0m
[1;94m14 | [0m
[1;94m15 | [0m @@[1;91mi... | Rust | 0 |
import FWCore.ParameterSet.Config as cms
generator = cms.EDFilter("Pythia8GeneratorFilter",
pythiaPylistVerbosity = cms.untracked.int32(1),
filterEfficiency = cms.untracked.double(1.0),
pythiaHepMCVerbosity = cms.untracked.bool(False),
comEnergy = cms.double(7000.0),
maxEventsToPrint = cms.untracked... | Python | 1 |
::new(data))
//! # }
//! # }
//! #
//! # type Env = PyGymEnv<Obs, Act, ObsFilter, ActFilter>;
//! # type ObsBuffer = TchTensorBuffer<f32, ObsShape, Obs>;
//! # type ActBuffer = TchTensorBuffer<i64, ActShape, Act>;
//!
//! const DIM_ACT: i64 = 2;
//! const LR_CRITIC: f64 = 0.001;
//! const DISCOUNT_FACTOR: f64 = 0.9... | Rust | 0 |
import os
import re
import logging
from .comicbook import ComicBook
logger = logging.getLogger(__name__)
def migrate_image_name_format(comicbook_dir):
"""
迁移脚本 将文件夹内的图片名从 1.jpg 2.jpg ...
重命名为 001.jpg 002.jpg ...
"""
for crawler_cls in ComicBook.CRAWLER_CLS_MAP.values():
# 站点目录
di... | Python | 1 |
RangeSpec {
/// Get all bytes between x and y ("x-y")
FromTo(u64, u64),
/// Get all bytes starting from x ("x-")
AllFrom(u64),
/// Get last x bytes ("-x")
Last(u64)
}
impl Range {
/// Get the most common byte range header ("bytes=from-to")
pub fn bytes(from: u64, to: u64) -> Range {
... | Rust | 0 |
_throttle_0, 0), (self.qtgui_const_sink_x_0, 0))
self.connect((self.blocks_wavfile_source_0, 0), (self.blocks_float_to_complex_0, 0))
self.connect((self.blocks_wavfile_source_0, 1), (self.blocks_float_to_complex_0, 1))
def closeEvent(self, event):
self.settings = Qt.QSettings("GNU Radio", ... | Python | 1 |
ta_seed,
eval_every=eval_every,
save_name=model_id,
wandb_project_name=wandb_project_name,
results_dir=results_dir,
only_ft=only_ft,
ft_model_path="",
n... | Python | 1 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
'''
@desc 基于物品的协同过滤算法,方法为ItemCF-IUF
@author cheng.cheng
@email cc@iamcc.me
@date 2012-06-19
'''
import sys
import random
import math
from operator import itemgetter
def ReadData(file,data):
''' 读取评分数据
@param file 评分数据文件
@param data 储存评分数据的List
... | Python | 1 |
-350.0;
self.state = MovementState::Jumping;
}
}
}
struct Floor {
// The floor does not move and therefore it always has the same
// axis-aligned bounding box used for intersection testing.
bounding_box: AABBf,
}
impl Floor {
fn draw(&self, ctx: &mut Context) -> Result<(), Str... | Rust | 0 |
= r" # Safety"]
#[doc = r""]
#[doc = r" `instance` must be a valid instance handle."]
pub unsafe fn load(entry: &Entry, instance: sys::Instance) -> Result<Self> {
Ok(Self {
create_swapchain_android_surface: mem::transmute(entry.get_instance_proc_addr(
... | Rust | 0 |
K RU~ VTYYDOOSWScSc jG NX ag hc4H% dii-Jm\sC@ diif;Z_hmt }D MQ MU MU VcSB? !@_dmry BI RV R] R] ^s#bA !@_dmry BI RV R] R] ^s#bA >]bkpw @G ... | Python | 1 |
keypair for host authentication
pub fn generate_auth_keypair() -> Result<([u8; KEY_LEN],[u8; KEY_LEN]), OssuaryError> {
let mut rng = OsRng::new()?;
let keypair: Keypair = Keypair::generate(&mut rng);
Ok((keypair.secret.to_bytes(), keypair.public.to_bytes()))
}
fn increment_nonce(nonce: &mut [u8]) -> bool... | Rust | 0 |
&num) if num <= c + 3 => {
// debug!(num);
num_arrangements += r(num, index, input);
}
Some(_) => return num_arrangements,
None => return 1, // we have reached the end, thus this path represents one valid arrangement
}
}
num_arrangemen... | Rust | 0 |
::<BigEndian>(data, len),
}
}
pub fn read_target_uint(endianness: layout::Endian, mut source: &[u8]) -> Result<u128, io::Error> {
match endianness {
layout::Endian::Little => source.read_uint128::<LittleEndian>(source.len()),
layout::Endian::Big => source.read_uint128::<BigEndian>(source.len())... | Rust | 0 |
logger.warning(f"Timeout while trying to connect to {MCP_SERVER_URL}.")
sleep(10) # Wait for a while before retrying
ec = check_server_health()
if ec:
logger.error("MCP server is not healthy after retry. Exiting.")
sys.exit(1)
elif ec:
logger.error("MCP... | Python | 1 |
_port),
))
}
linux_raw_sys::general::AF_INET6 => {
assert!(len >= size_of::<linux_raw_sys::general::sockaddr_in6>());
let decode = *storage.cast::<linux_raw_sys::general::sockaddr_in6>();
SocketAddr::V6(SocketAddrV6::new(
Ipv6Addr::from(dec... | Rust | 0 |
>,
) {
let symbol_opt = stmt
.name_opt()
.and_then(|name| self.name_symbols.get(&name).cloned());
let loc = Loc::new(self.doc, PLoc::Stmt(stmt_id));
match stmt {
AStmt::Attr => {}
AStmt::Expr(expr) => {
*term_opt = Some(self.co... | Rust | 0 |
}
#[doc = "Checks if the value of the field is `AUX_ADC_DONE`"]
#[inline]
pub fn is_aux_adc_done(&self) -> bool {
*self == EVR::AUX_ADC_DONE
}
#[doc = "Checks if the value of the field is `AUX_SMPH_AUTOTAKE_DONE`"]
#[inline]
pub fn is_aux_smph_autotake_done(&self) -> bool {
*... | Rust | 0 |
= 0:
tk.messagebox.showerror('Error', "Transaction reverted. Access not granted.")
return
tx_hash = self.audit_contract.functions.logDoctorAccessGrant(self.web3.account, doctor_address).transact({'from': self.web3.account})
receipt = self.web3.eth.wait_for_transac... | Python | 1 |
. Thus, set this field to 1 to enable the behavior locally for this contact and leave CNTCO as 0 to disable this behavior for all contacts without this field set to 1.
EQ.0: The setting of CNTO on *CONTROL_SHELL determines the contact reference plane.
EQ.1:The contact reference plance coincides with she... | Python | 1 |
// assert_eq!(DoubleUIntStruct{x:5, y:6} * 10, DoubleUIntStruct{x:50, y:60});
let mut myint = MyInt(5);
assert_eq!(5, *myint);
*myint = 7;
assert_eq!(MyInt(7), myint);
let mut my_vec = MyVec(vec![5, 8]);
assert_eq!(5, my_vec[0]);
assert_eq!(8, my_vec[1]);
my_vec[0] = 20;
assert_eq... | Rust | 0 |
ize(), i.into());
},
Game::ClChangeInfo(i) => {
infos.insert(msg.cid.assert_usize(), i.into());
},
_ => {},
}
}
}
_ => {},
}
... | Rust | 0 |
import os
import random
import re
import time
import json
import base64
from datetime import datetime
import cv2
import numpy as np
from moviepy import VideoFileClip, AudioFileClip, CompositeVideoClip, ImageClip, concatenate_videoclips
import oss2
import nls # 新的阿里云智能语音交互SDK
import requests
from dotenv import load_dot... | Python | 1 |
tupla_01 = (1, 2, 3, 4) #sintaxis
tupla_02 = 2.0, 5, 0.25, 0.3
print(tupla_01)
print(tupla_02)
#Tipos de secuencias:
# Un tipo de secuencia es un tipo de dato en Python el cual es capaz de
# almacecnar más de un valor (o ninguno si la secuencia está vacía),
# los cuales pueden ser secuencialmente (de ahí el nombre... | Python | 1 |
false => WATCHDOG_RESET_FLAG_A::WATCHDOG_RESET_NOT_SET,
true => WATCHDOG_RESET_FLAG_A::WATCHDOG_RESET_SET,
}
}
#[doc = "Checks if the value of the field is `WATCHDOG_RESET_NOT_SET`"]
#[inline(always)]
pub fn is_watchdog_reset_not_set(&self) -> bool {
*self == WATCHDOG_... | Rust | 0 |
class Solution:
def pairSum(self, head):
# Step 1: Find the middle of the list
slow = head
fast = head
prev = None
while fast and fast.next:
prev = slow
slow = slow.next
fast = fast.next.next
# Step 2: Bre... | Python | 1 |
pub use mssip::*;
pub use ncrypt::*;
pub use ntdef::*;
pub use ntstatus::*;
pub use objbase::*;
pub use objidl::*;
pub use objidlbase::*;
pub use olectl::*;
pub use processsnapshot::*;
pub use processthreadsapi::*;
pub use propsys::*;
pub use psapi::*;
pub use qos::*;
pub use reason::*;
pub use rpcdce::*;
pub use schan... | Rust | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.