text string | label_name string | labels int64 |
|---|---|---|
mode='bilinear', align_corners=True) # (B, 128, 1, N)
init_pred = F.grid_sample(out_res2, point_coords_res1, mode='bilinear', align_corners=True) # (B, 4, 1, N)
feat_res1 = torch.cat([feat_res1, init_pred], dim=1) # (B, 128+4, 1, N)
# prediction (needed to compute loss)
... | Python | 1 |
ing = False
db.session.add(friend_request)
db.session.commit()
return {'message': 'Accepted friend request!'}
# DELETE FRIEND
@friends_routes.route('/<int:friend_id>/delete', methods=['DELETE'])
@login_required
def delete_friend(friend_id):
friend = Friends.query.filter(or_(and_(Friends.sender_id == fr... | Python | 1 |
dow") -> None:
search(qtbot, SearchType.SONGLIST, "key社", main_window)
def test_search_album(qtbot: QtBot, main_window: "MainWindow") -> None:
search(qtbot, SearchType.ALBUM, "アスタロア/青き此方/夏の砂時計", main_window)
def test_save_album_lyrics(qtbot: QtBot, main_window: "MainWindow") -> None:
assert main_window.... | Python | 1 |
f.msg_id.clone()
}
#[wasm_bindgen(setter)]
pub fn set_msg_id(&mut self, msg_id: String) {
self.msg_id = msg_id;
}
#[wasm_bindgen(static_method_of = Address)]
pub fn from_string(link: String) -> Self {
let link_vec: Vec<&str> = link
.strip_prefix("<")
.un... | Rust | 0 |
r, valid_y_data, mask_train, eval(args.topN))
if args.tst_w_val:
test_results = evaluate(test_twv_loader, test_y_data, mask_tv, eval(args.topN))
else:
test_results = evaluate(test_loader, test_y_data, mask_tv, eval(args.topN))
evaluate_utils.print_results(None, valid_resu... | Python | 1 |
f the note in the input list
- relevance_score: a float between 0 and 1
- snippet: a brief excerpt that matches the query
Only include notes with relevance_score > 0.1"""
notes_text = "\n\n".join([f"Note {i}: {content}" for i, content in enumerate(note_contents)])
... | Python | 1 |
x = 80 * scale - bus_position[0]
dy = 690 * scale - bus_position[1]
auto.mouse_drag(bus_position[0], bus_position[1], drag_time=1.5, dx=dx, dy=dy)
sleep(0.5)
auto.mouse_to_blank()
bus_position = auto.find_element("mirror/mybus_default_distance.png", take_scre... | Python | 1 |
# 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 |
"""Tests for sympy.physics.quantum.kind."""
from sympy.core.kind import NumberKind, UndefinedKind
from sympy.core.symbol import symbols
from sympy.physics.quantum.kind import (
OperatorKind, KetKind, BraKind
)
from sympy.physics.quantum.anticommutator import AntiCommutator
from sympy.physics.quantum.commutator im... | Python | 1 |
from easydict import EasyDict as edict
from pathlib import Path
import torch
from torch.nn import CrossEntropyLoss
from torchvision import transforms as trans
def get_config(training = True):
conf = edict()
conf.data_path = Path('data')
conf.work_path = Path('work_space/')
conf.model_path = conf.work_p... | Python | 1 |
annot perform AddTest query: {:?}", err);
}
});
spawn_local(response);
}
<filename>src/constants.rs
// sizes and coordinates relevant for the GUI
pub const SCREEN_WIDTH: i32 = 80;
pub const SCREEN_HEIGHT: i32 = 50;
pub const PANEL_HEIGHT: i32 = 7;
pub const BAR_WIDTH: i32 = 20;
pub const PANEL_Y: i32 =... | Rust | 0 |
### --- IMPORTS --- ###
#we want pprint to read the data better
from pprint import pprint
#import requests to read the destination data
import requests
#we want to import os and loadenv to load our env variables
import os
from dotenv import load_dotenv
### --- ENV VARS --- ###
#let's load our envs
load_dotenv()
#sh... | Python | 1 |
+ img_y_offset as isize;
if pixel_x > 0 && pixel_y > 0 {
imgbuf.put_pixel(pixel_x as u32, pixel_y as u32, Luma([0xFF]));
}
}
}
}
}
Ok(MonoFontData {
data: imgbuf,
... | Rust | 0 |
# holidays
# --------
# A fast, efficient Python library for generating country, province and state
# specific sets of holidays on the fly. It aims to make determining whether a
# specific date is a holiday as fast and flexible as possible.
#
# Authors: Vacanza Team and individual contributors (see CONTRIBUTORS f... | Python | 1 |
import threading
import unittest
from sleekxmpp.test import SleekTest
class TestStreamSet(SleekTest):
def tearDown(self):
self.stream_close()
def testHandleSoftwareVersionRequest(self):
self.stream_start(mode='client', plugins=['xep_0030', 'xep_0092'])
self.xmpp['xep_0092'].name = ... | Python | 1 |
\x96\x1f\xcd\xd5\xfe\xc06\x92\x04\xafG\xc3p\
\xad\xea\xb4\xd6\xb4\x9b\x05\xd7\xb3\x11[kYZi\xda\
%\xd9\x8d\x86Z9N\x07\xf8g\x7f\xf2\xca\xd4\xec\xd2\
\xbb\xd6\xd3\xd1\xb9\xe6J?\xf9\xcc\xd1\x97\xab\xc3\xf7\xdc\
j\xa8\xee\xd7\x06\xd6\xfa\xe5\xbe\x9e?\x8e\xebI\xd8\x1b\
I\xc4\x1b\xf1v\xb0\x11\xd7\xae\xa5\x11\xbfVD}\xbd\
\x04\... | Python | 1 |
mem::transmute::<RBoxError_<SyncSend>,SendRBoxError>(self)
}
}
}
impl RBoxError_<SyncSend> {
/// Constructs an RBoxError from an error.
///
/// # Example
///
/// ```
/// use abi_stable::std_types::RBoxError;
///
/// let str_err=String::from_utf8(vec![255]).unwrap_er... | Rust | 0 |
g@hq{ P S SK r S SKrS SKrS SKrS SKrS SKrS SKrS SKrS SKrS SK r S SK
r
S SKrS SKrS SK
rS SKJr S SKJrJr S SKJr S SKJr S SKJr S SKJrJr S SKJrJr S S KJ r J!r!J"r" S S
K#J$r$ S SK%J&r&J'r' S SK(J)r) S S
K*J+r+ S ... | Python | 1 |
);
processor.upload(&UploadContext {
org: &org,
project: Some(&project),
release: &release.version,
dist: Some(dist),
wait: matches.is_present("wait"),
})?;
}
Ok(())
}
<filename>problems/0062-unique-paths/src/main.rs
fn uniqu... | Rust | 0 |
d)
};
let v128 = {
let ptr = (&mut v32[0..]).as_mut_ptr() as *mut i64x4;
std::slice::from_raw_parts_mut(ptr, 8)
};
(v128[0], v128[0 + 4]) = unpack2!(v64_0, v64_4);
(v128[1], v128[1 + 4]) = unpack2!(v64_2, v64_6);
(v128[2], v128[2 + 4]) = unpack2!(... | Rust | 0 |
ken,
prompt_token_len,
prompt_feat,
prompt_feat_len,
embedding):
assert token.shape[0] == 1
# xvec projection
embedding = F.normalize(embedding, dim=1)
embedding = self.spk_embed_affine_layer(embedding)
# co... | Python | 1 |
Reason::ForfeitTimeslot);
assert_eq!(e.cpu.get_rax(), next - 16);
assert_eq!(get_malloc_walk(&e.memory, beg_ptr, end_ptr), &[(false, 224), (true, 192), (true, 240)]);
assert_eq!(e.memory.get(fourth, 192).unwrap(), &LONG_MESSAGE[150..150+192]);
assert_eq!(e.execute_cycles(u64::MAX).1, StopReason::Forfeit... | Rust | 0 |
"""empty message
Revision ID: 2309231745
Revises: 6d0d2c9e1919
Create Date: 2024-08-19 13:03:32.320669
"""
from alembic import op
# revision identifiers, used by Alembic.
revision = "2309231745"
down_revision = "6d0d2c9e1919"
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated ... | Python | 1 |
_application_trampoline<P>(this: *mut ffi::GtkWindow, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<Window> {
let f: &&(Fn(&P) + 'static) = transmute(f);
f(&Window::from_glib_borrow(this).downcast_unchecked())
}
unsafe extern "C" fn notify_attached_to_trampoline<P>(this: *mut ffi::GtkWin... | Rust | 0 |
Hash, Clone, Copy)]
pub enum VideoColorPrimaries {
Unknown,
Bt709,
Bt470m,
Bt470bg,
Smpte170m,
Smpte240m,
Film,
Bt2020,
Adobergb,
Smptest428,
Smpterp431,
Smpteeg432,
Ebu3213,
#[doc(hidden)]
__Unknown(i32),
}
#[doc(hidden)]
impl ToGlib for VideoColorPrimaries... | Rust | 0 |
ame": "将预设保存为txt文件"
}),
"保存为JSON": ([
"关", "开"
], {
"default": "关",
"display_name": "将预设保存为json文件"
}),
"提示词": ("STRING", {"forceInput": True, "multiline": True})
}
... | Python | 1 |
env::args().collect();
if let Some(arg) = args.into_iter().skip(1).take(1).next() {
let mut file = fs::File::open(&arg)?;
println!(
"================================= NBT Contents ================================="
);
let blob = Blob::from_reader(&mut file)?;
pri... | Rust | 0 |
<'c> {
/// A custom basic event.
Basic(&'c GlobalAccountDataEvent<CustomEventContent>),
/// A custom basic event.
EphemeralRoom(&'c SyncEphemeralRoomEvent<CustomEventContent>),
/// A custom room event.
Message(&'c SyncMessageEvent<CustomEventContent>),
/// A custom state event.
State(&'c... | Rust | 0 |
fn main() {
//! use frunk::labelled::Transmogrifier;
//!
//! #[derive(LabelledGeneric)]
//! struct InternalPhoneNumber {
//! emergency: Option<usize>,
//! main: usize,
//! secondary: Option<usize>,
//! }
//!
//! #[derive(LabelledGeneric)]
//! struct InternalAddress<'a> {
//! is_whitelisted: bool,
//! ... | Rust | 0 |
: &'a mut IntoDirectHelper<N, T>,
) -> DinoTree<'a, A, BBox<N, T>> {
let mut bots = &mut bots.0 as &'a mut [_];
let b = PMut::new(bots).as_ptr();
let nodes: Vec<_> = tree
.inner
.get_nodes()
.iter()
.map(move |node| {
let mut k... | Rust | 0 |
_type: state.instance_type.clone(),
addr: DnsTarget::A(state.ip_addr),
};
state.is_running = true;
Ok(running_state)
}
fn ensure_stopped(&self) -> Result<(), Error> {
let mut state = self.state.borrow_mut();
state.is_running = false;
Ok(())
}
}
//... | Rust | 0 |
mble
# filename = f"/content/drive/MyDrive/dividend-predictor-app/models/lightgbm_model_{industry.lower().replace(' ', '_')}.pkl"
# with open(filename, "wb") as f:
# pickle.dump(ensemble, f)
# print(f"✅ Saved {industry} model at: {filename}")
# from sklearn.metrics import classification_report, c... | Python | 1 |
import re
from enum import StrEnum
from base.Base import Base
from base.BaseLanguage import BaseLanguage
from module.Text.TextHelper import TextHelper
from module.Cache.CacheItem import CacheItem
from module.Config import Config
from module.Filter.RuleFilter import RuleFilter
from module.Filter.LanguageFilter import L... | Python | 1 |
# This file is MACHINE GENERATED! Do not edit.
# Generated by: tensorflow/python/tools/api/generator2/generator/generator.py script.
"""Public API for tf._api.v2.types namespace
"""
import sys as _sys
from tensorflow._api.v2.types import experimental
| Python | 1 |
"]
#[inline(always)]
pub fn variant(&self) -> HFXT_EN_A {
match self.bits {
false => HFXT_EN_A::HFXT_EN_0,
true => HFXT_EN_A::HFXT_EN_1,
}
}
#[doc = "Checks if the value of the field is `HFXT_EN_0`"]
#[inline(always)]
pub fn is_hfxt_en_0(&self) -> bool {
... | Rust | 0 |
SK_OVERRIDE_COVERAGE_EXTENSION_NAME: &'static [u8; 36usize] =
b"VK_NV_sample_mask_override_coverage\0";
pub const VK_NV_geometry_shader_passthrough: u32 = 1;
pub const VK_NV_GEOMETRY_SHADER_PASSTHROUGH_SPEC_VERSION: u32 = 1;
pub const VK_NV_GEOMETRY_SHADER_PASSTHROUGH_EXTENSION_NAME: &'static [u8; 34usize] =
b"... | Rust | 0 |
from pathlib import Path
import hashlib
import json
from pakgen.api import BuildOptions, build_pak
def _read_bytes(path: Path) -> bytes:
return path.read_bytes()
def _hexdigest(data: bytes) -> str:
return hashlib.sha256(data).hexdigest()
def test_binary_diff_regression(tmp_path: Path): # noqa: N802
"... | Python | 1 |
ObserverSubscriber {
inner: self.inner.clone(),
_type: PhantomData,
}
}
}
impl<T: Any + Send + Sync> Stream for ObserverStream<T> {
type Item = Arc<T>;
fn poll_next(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<Self::Item>> {
self.inner
... | Rust | 0 |
class Solution:
def merge(self, intervals: List[List[int]]) -> List[List[int]]:
ans = []
for interval in sorted(intervals):
if not ans or ans[-1][1] < interval[0]:
ans.append(interval)
else:
ans[-1][1] = max(ans[-1][1], interval[1])
return ans
| Python | 1 |
self.nonce = 0;
// 4. Set h and ck to protocol name
// 5. h = SHA256(h || prologue),
// prologue is empty
// mix_hash(xx, NULL, 0);
let mut h = [0u8; SHA256_SIZE];
h[..self.get_protocol_name().len()].copy_from_slice(self.get_protocol_name());
let attribu... | Rust | 0 |
key('o');
//! }
//! ```
//!
//! # PatternDefinition
//! The PatternDefinition provides functionality to retrieve symbols that are used in defining a pattern.
//!
//! Here is the list of symbols that identify a type of character:</br>
//! @ = unknown [Unknonw]</br>
//! C = upper case consonant [ConsonantUpper]</br>
//! ... | Rust | 0 |
# SPDX-FileCopyrightText: (C) 2024 - 2025 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
from django.core.management.base import BaseCommand, CommandError
from manager.kubeclient import KubeClient
class Command(BaseCommand):
def add_arguments(self, parser):
parser.add_argument("--broker", nargs="?",
... | Python | 1 |
red features: `\"Win32_Security_Cryptography\"`*"]
pub const CMSG_MAIL_LIST_ENCRYPT_FREE_PARA_FLAG: u32 = 1u32;
#[repr(C)]
#[doc = "*Required features: `\"Win32_Security_Cryptography\"`*"]
pub struct CMSG_MAIL_LIST_ENCRYPT_INFO {
pub cbSize: u32,
pub dwRecipientIndex: u32,
pub KeyEncryptionAlgorithm: CRYPT_... | Rust | 0 |
ots.push((t, users));
}
}
AvailabilityMatch { slots }
}
#![feature(proc_macro_hygiene)]
mod x11;
use std::sync::Arc;
#[derive(Copy, Clone)]
pub struct Color {
pub r: f64,
pub g: f64,
pub b: f64,
}
#[derive(Copy, Clone)]
pub struct Position {
pub x: i16,
pub y: i16,
}
pub enum Bac... | Rust | 0 |
import time
import math
import yaml
import cv2
import numpy as np
import pyrealsense2 as rs
# 假设的机械臂控制库
# 您需要根据实际使用的机械臂替换此部分
class RobotArm:
def __init__(self):
# 初始化机械臂连接
pass
def move_to(self, position):
# 根据位置字典移动机械臂
# position包含x, y, z, rx, ry, rz等信息
print(f"移动到位置:... | Python | 1 |
from ..model.produto_model import ProdutoModel
def listar_produtos():
"""retorna a lista de todos os produtos (dict)"""
model = ProdutoModel()
produtos= model.get_all_procucts()
model.close_connection()
return produtos
def cadastrar_produto(nome, preco):
"""cadastrar um produto no banco""... | Python | 1 |
it Kucheria)
- Merge tsens-common into the tsens driver (Amit Kucheria)
- Fix platform dependency for the Qoriq driver (<NAME>)
- Clean up the rcar_thermal_update_temp() function in the rcar thermal
driver (<NAME>lund)
- Fix the TMSAR register for the TMUv2 on the Qoriq platform (Yuantian
Tang)
- Export... | Rust | 0 |
adOnly<u32>, // 0x04
}
/// Public interface to the BCM System Timer
pub struct SysTmr;
impl ops::Deref for SysTmr {
type Target = RegisterBlock;
fn deref(&self) -> &Self::Target {
unsafe { &*Self::ptr() }
}
}
impl SysTmr {
pub fn new() -> SysTmr {
SysTmr
}
/// Returns a poin... | Rust | 0 |
, SynthesisError,
};
use ark_serialize::{CanonicalDeserialize, CanonicalSerialize, SerializationError};
use ark_std::ops::{AddAssign, Sub};
use ark_std::{
io::{Read, Write},
rand::{Rng, RngCore},
vec::Vec,
UniformRand,
};
use legogroth16::{
create_random_proof, generate_parameters, verify_link_proof... | Rust | 0 |
-> f64,
{
let x = get_value(freedom, eval);
assert_almost_eq!(expected, x, acc);
}
fn test_is_nan<F>(freedom: f64, eval: F)
where
F: Fn(Chi) -> f64,
{
let x = get_value(freedom, eval);
assert!(x.is_nan());
}
#[test]
fn test_create() {
cre... | Rust | 0 |
parallelism + 2,
store.clone(),
futures_timer_thread2.clone(),
)),
None => Box::new(process_execution::local::CommandRunner::new(
store.clone(),
fs_pool2.clone(),
work_dir.clone(),
process_execution_cleanup_local_dirs,
)),
};
... | Rust | 0 |
import torch.utils.data as data
import torchvision.transforms as transforms
import os
from PIL import Image
import random
import numpy as np
IMG_EXTENSIONS= [
'.jpg', '.JPG', '.jpeg', '.JPEG',
'.png', '.PNG', '.ppm', '.PPM', '.bmp', '.BMP'
]
def is_image_file(filename):
return any(filename.endswith(exte... | Python | 1 |
# Copyright 2024 Bytedance Ltd. and/or its affiliates
#
# 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 ... | Python | 1 |
#!/usr/bin/python3
# Standard imports
import cv2
import numpy as np
def empty(a):
pass
img = cv2.imread("tomato1.png")
while True:
img_cpy = img
imgHSV = cv2.cvtColor(img_cpy,cv2.COLOR_BGR2HSV)
#print(h_min,h_max,s_min,s_max,v_min,v_max)
lower = np.array([0,2,0])
upper = np.array([0,255... | Python | 1 |
lue| {
// let org = repo.get("org").unwrap();
// let name = repo.get("name").unwrap();
// let url = format!("<EMAIL>:{}/{}.git",
// org.as_str().unwrap(),
// name.as_str().unwrap());
// assert_eq!(u... | Rust | 0 |
subsurface: NewResource<wl_subsurface::WlSubsurface>,
surface: Resource<wl_surface::WlSurface>,
token: &DisplayToken,
) -> Resource<wl_subsurface::WlSubsurface>
where
U: 'static,
R: RoleType + Role<SubsurfaceRole> + 'static,
{
subsurface.implement_nonsend(
|request, subsurface| {
... | Rust | 0 |
argc = pop_argc(vm, 1, Some(3), "string->list")?;
let end = match argc {
3 => Some(pop_index(vm, "string->list")?),
_ => None,
};
let start = match argc {
2 | 3 => Some(pop_index(vm, "string->list")?),
_ => None,
};
let s = pop_string(vm, "string->list")?;
let... | Rust | 0 |
ation)
// corresponding to a particular module.
pub struct Database {
/* Self::db = Option<Pin<Box<Builder>>>,
* with
* Builder {
* addr: enum Addr {
* Tcp(String, u16),
* Unix(PathBuf)
* },
* user: String,
* password: <PASSWORD>,
... | Rust | 0 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
from itertools import groupby
def get_end_of_year_totals(db, team, year):
"""Gets the year end received and distributed for a team
Arguments:
team -- The Team object for the year end totals be... | Python | 1 |
和 y 对应的节点是堂兄弟节点时,才返回 true 。否则,返回 false。
示例 1:
输入:root = [1,2,3,4], x = 4, y = 3
输出:false
示例 2:
输入:root = [1,2,3,null,4,null,5], x = 5, y = 4
输出:true
示例 3:
输入:root = [1,2,3,null,4], x = 2, y = 3
输出:false
提示:
二叉树的节点数介于 2 到 100 之间。
每个节点的值都是唯一的、范围为 1 到 100 的整数。
来源:力扣(LeetCode)
链接:https://leetcode-cn.com/problems/cous... | Rust | 0 |
:Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
self.to_string().serialize(serializer)
}
}
impl<'de> Deserialize<'de> for BigInt {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use serde::de::Error;
let decimal_string = <String... | Rust | 0 |
, 0x5F99D04F5B163969),
(0x1F08260D1AC2465E, 0x6B056E18759F5CCA, 0x4A057A3B24D3977B),
(0x584023641ABA6176, 0x004BD6EF09176062, 0x452031C1E4FADA8E),
(0x025816164629B007, 0x480D39006EE762F2, 0x7555AE39F59B87BD),
(0x49793EBC79B3258F, 0x437540C8698F3CFA, 0x53C55F9CB49FC019),
... | Rust | 0 |
ghtedRangeGenerator<R> {
prefix_sum: Vec<usize>,
upper: usize,
rng: R,
}
impl<R> WeightedRangeGenerator<R>
where
R: Rng,
{
#[allow(dead_code)]
pub fn new(rng: R, weights: &[usize]) -> WeightedRangeGenerator<R> {
assert!(!weights.is_empty(), "Cannot sample from zero elements.");
... | Rust | 0 |
# jax2onnx/plugins/jax/lax/eq.py
from typing import TYPE_CHECKING
import jax
import numpy as np
from jax2onnx.plugins.plugin_system import PrimitiveLeafPlugin, register_primitive
if TYPE_CHECKING:
pass # type hints only
@register_primitive(
jaxpr_primitive=jax.lax.eq_p.name,
jax_doc="https://docs.jax... | Python | 1 |
import os
from os import path
from os import getenv
from dotenv import load_dotenv
if os.path.exists("local.env"):
load_dotenv("local.env")
que = {}
SESSION_NAME = getenv("SESSION_NAME", "session")
BOT_TOKEN = getenv("BOT_TOKEN")
BOT_NAME = getenv("BOT_NAME")
UPDATES_CHANNEL = getenv("UPDATES_CHANNEL", "tgbotproj... | Python | 1 |
if let Some(txt) = self.1 {
state.write(txt.as_bytes());
}
state.write_u8(0xff); // this is what <str as Hash>::hash() does
}
}
#[derive(Debug, Clone, Copy, Eq, PartialEq)]
enum Absolute {
No,
Maybe,
Yes,
}
#[inline]
fn str_absolute(txt: &str) -> Absolute {
if txt.i... | Rust | 0 |
)}
nativecall_test_with_params!{test_find_3, find, primative_text!("merhaba dünya"), [VmObject::native_convert(primative_text!("dünya"))], KaramelPrimative::Number(8.0)}
nativecall_test_with_params!{test_find_4, find, primative_text!("merhaba dünya"), [VmObject::native_convert(primative_text!(" "))], KaramelPri... | Rust | 0 |
}
#[test]
fn test_for_command_invalid_quoted() {
let cmds = [
(
"'for' var in one two three\ndo echo $var; done",
Unexpected(Token::SingleQuote, src(0, 1, 1)),
),
(
"for var 'in' one two three\ndo echo $var; done",
IncompleteCmd("for", src(0,... | Rust | 0 |
s="hello world"
print(s[1]) #e
print(s[-1]) #d
print(s[1:3]) # e l
print(s[1:-1]) # e l l o w o r o l
print(s[:3]) #
print(s[2:])
print(s[:-1])
print(s[::2])
print(s[1::2])
print(s[::-1]) | Python | 1 |
:.4f}")
# Generate classification report with dynamic labels
labels = list(range(len(disease)))
report = classification_report(y_test, y_pred, labels=labels, target_names=disease, zero_division=0)
logger.info("\nClassification Report:\n" + report)
return clf, accuracy
excep... | Python | 1 |
}
pub fn border(&mut self, gap: u32, color: u32) {
self.border = Some((gap, color));
}
}
pub enum Style {
Color(u32),
Tiled(Result<Image, Box<dyn std::error::Error>>),
Image(Result<Image, Box<dyn std::error::Error>>),
Directory(String),
None,
}
pub fn draw(buf: &mut Buffer, pap... | Rust | 0 |
if let Some(it) = &node.in_token {
tokens_helper(v, &it.span);
};
v.visit_path(&*node.path);
}
#[cfg(any(feature = "derive", feature = "full"))]
pub fn visit_visibility<'ast, V>(v: &mut V, node: &'ast Visibility)
where
V: Visit<'ast> + ?Sized,
{
match node {
Visibility::Public(_bindi... | Rust | 0 |
.into_interface();
let hr = (*self.native.get()).GetGlyphRunOutline(
em_size,
glyph_indices.as_ptr(),
glyph_advances,
glyph_offsets,
glyph_indices.len() as u32,
is_sideways,
is_right_to_left,
... | Rust | 0 |
from app.command_pattern.commands.Command import Command
from app import Globals
class CommandSET(Command):
"""
CommandSET is a command class that implements the SET operation for a key-value store.
Attributes:
receiver (object): The receiver object that will handle the response.
key (str): The ke... | Python | 1 |
{
// parsed fonts, in order, i.e. "Webly Sleeky UI", "monospace", etc.
pub(crate) fonts: Vec<FontId>
}
#[derive(Debug, PartialEq, Eq, Clone, Hash)]
pub enum FontId {
BuiltinFont(String),
ExternalFont(String),
}
#[derive(Debug, PartialEq, Copy, Clone)]
pub enum CssStyleFontFamilyParseError<'a> {
I... | Rust | 0 |
g),+);
};
}
#[macro_export]
macro_rules! nft_info {
($($msg: expr),+ $(,)?) => {
#[cfg(test)]
println!($($msg),+);
#[cfg(not(test))]
log::log!(target: "nftmart", log::Level::Info, $($msg),+);
};
}
#[macro_export]
macro_rules! nft_err {
($($msg: expr),+ $(,)?) => {
#[cfg(test)]
println!($($msg),+);
#... | Rust | 0 |
v: &str) -> Result<Self::Value, E> {
f32::from_str(v).map(Some).map_err(Error::custom)
}
fn visit_f64<E: Error>(self, v: f64) -> Result<Self::Value, E> {
Ok(Some(v as f32))
}
fn visit_some<D: Deserializer<'de>>(self, d: D) -> Result<Self::Value, D::Error> {
d.deserialize_any(S... | Rust | 0 |
#!/usr/bin/python3
import yaml
import tweepy
import re
from textgenrnn import textgenrnn
def process_tweet_text(text):
text = re.sub(r'http\S+', '', text) # Remove URLs
text = re.sub(r'@[a-zA-Z0-9_]+', '', text) # Remove @ mentions
text = text.strip(" ") # Remove whitespace resulting from above
... | Python | 1 |
+ simple_default_params.items()
+ blackbox_simple_default_params.items()
+ whitebox_simple_default_params.items())
for k, v in all_params.items():
parser.add_argument("--" + k, type=type(v() if callable(v) else v))
# unknown_args are passed d... | Python | 1 |
o IEEE"]
#[doc = "754 decimal 64. This struct only provides access to the 64 bit data, which can be accessed with a 64-bit decimal"]
#[doc = "library in order to perform arithmetic or convert to and from strings."]
#[doc = ""]
#[doc = "See also com::softwareag::connectivity::decimal_t which is how this should be referr... | Rust | 0 |
ce_selected(self, choice_tag, **kwargs):
if choice_tag is None:
for override_icon in self.icon_choices:
if override_icon.is_default:
icon_info = self.get_icon_info(override_icon)
choice_tag = None if icon_info is None else icon_info.icon_resour... | Python | 1 |
U, Op> ExecuteDsl<SqliteConnection>
for InsertStatement<T, OwnedBatchInsert<ValuesClause<U, T>>, Op>
where
InsertStatement<T, ValuesClause<U, T>, Op>: QueryFragment<Sqlite>,
T: Copy,
Op: Copy,
{
fn execute(query: Self, conn: &SqliteConnection) -> QueryResult<usize> {
use connection::Connect... | Rust | 0 |
rom .legacy import ( # pylint: disable=import-outside-toplevel
get_significant_states_with_session as _legacy_get_significant_states_with_session,
)
_target = _legacy_get_significant_states_with_session
else:
_target = _modern_get_significant_states_with_session
return _tar... | Python | 1 |
print('Hello, Git!')
| Python | 1 |
nt.
/// This is maximal currently observed temperature (within large megalopolises and urban areas).
/// Unit Default: Kelvin, Metric: Celsius, Imperial: Fahrenheit.
pub temp_max: f64,
/// Atmospheric pressure on the sea level, hPa
pub sea_level: Option<f64>,
/// Atmospheric pressure on the grou... | Rust | 0 |
update_state.state_info.pts = full_chat.pts
if update_state not in self._channel_polling:
self._channel_polling.add(update_state)
await update_state.reset_auto_fetch_timer()
async def remove_channel_polling(self: 'Telegram', entity: alias.LikeEntity):
"""Stops polli... | Python | 1 |
();
///
/// let edited = http::edit_webhook_with_token(id, token, map)
/// .expect("Error editing webhook");
/// ```
///
/// [`create_webhook`]: fn.create_webhook.html
/// [`edit_webhook_with_token`]: fn.edit_webhook_with_token.html
// The tests are ignored, rather than no_run'd, due to rustdoc tests with
// extern... | Rust | 0 |
::{Commitment, PublicKey, Secp256k1, SecretKey, SharedSecret};
use chacha20::cipher::{StreamCipher};
pub struct Hop {
pub pubkey: PublicKey,
pub payload: Payload,
}
/// Create an Onion for the Commitment, encrypting the payload for each hop
pub fn create_onion(commit... | Rust | 0 |
'''
controlador.py:
Modulo controlador, el cual funciona mendiante un Modelo y una Vista
mediando en su interaccion.
'''
from tkinter import Tk
from modelo import Modelo
from vista import Vista
import observador
class Controlador():
'''
Clase Controlador.
Controla la interaccion entre la vista y el model... | Python | 1 |
ANMETRIC, 1, PI / 2.);
metric!(MAX_ANGLE_SPANMETRIC, 1, 1.704897179199218452);
// The width of geometric figure is defined as the distance between two
// parallel bounding lines in a given direction. For cells, the minimum
// width is always attained between two opposite edges, and the maximum
// width is attained bet... | Rust | 0 |
(8, 7),
(9, 8),
(10, 9),
(11, 10),
(12, 11),
(13, 12),
]
.into_iter()
.collect();
for sg in 0i64..=13i64 {
assert_eq!(
expected_edges.get(&sg).cloned(),
new_state[&sg].prev_state_group,
"state group {} did not match exp... | Rust | 0 |
\x80\xb07\x11\xaec3\xc3\xe9Y\xfc\x82\x9f\
^\x82\xef\xf6\xf7\xb2n\xd9\xb2\xd3\xfc\x94\xff7\x8ey\
``\x04\xa9\xa9\x98\x9b|\xb0\x1e\xabhSV>\xf5\
R\x0bE$\xa28r\xbb\x8d\xd9z\x81\x1f\xe8\x04\x9b\
\xd7\xfdI\xc9\xbc\x9c\xb7<\xbb\xf3\x1f\xe0\xb2\xdcXd\
s\xd3\x01\x1c\x9d\x0a\xa9\xbc1e\xccPHH\xd2\xec\
\x92\x89\x89\x80\xa6\xf8U\x06... | Python | 1 |
or n in i..MAX_MEMORY {
mem[n] = crazy_op(mem[n - 1], mem[n - 2]);
}
Ok(MAX_MEMORY)
}
fn execute(mem: &mut Memory) {
let mut r_a = 0;
let mut r_c = 0;
let mut r_d = 0;
let mut input = std::io::stdin();
while is_printable(mem[r_c]) {
let index = (mem[r_c] - 33 + r_c) % 94;
... | Rust | 0 |
], axis=1)
self.verify(model.resid)
# 模型验证,针对残差
def verify(self, resid):
print(f'++++++++++++++++++++++++++开始模型验证+++++++++++++++++++++++++++++++')
t = sm.tsa.stattools.adfuller(resid, )
output = pd.DataFrame(
index=['Test Statistic Value',... | Python | 1 |
@mock.patch(
'deeplite_torch_zoo.api.datasets.classification.vww.VisualWakeWordsClassification'
)
@mock.patch('deeplite_torch_zoo.api.datasets.classification.vww.create_loader',
create_loader)
def test_unit_vww(*args):
get_vww('')
| Python | 1 |
shuffle=True):
super().__init__(dataset, num_replicas=num_replicas, rank=rank)
self.shuffle = shuffle
def __iter__(self):
if self.shuffle:
g = torch.Generator()
g.manual_seed(self.epoch)
indices = torch.randperm(len(self.dataset), generator=g... | Python | 1 |
from unittest.mock import patch
from django.test import TestCase
from posthog.models.action.action import Action
from posthog.models.hog_flow.hog_flow import HogFlow
from posthog.models.user import User
class TestHogFlow(TestCase):
def setUp(self):
super().setUp()
org, team, user = User.objects.... | Python | 1 |
te limit to ensure smooth functionality. We appreciate your patience during this process.
#### 5. **Tracking:**
- Download the updated Excel file and monitor email delivery status and potential errors via the Recording sheet.
- Note: The application will attempt up to five retries for failed de... | Python | 1 |
t.comment.id);
assert_eq!(test_comment.messages, fetched_comment.comment.messages);
assert_eq!(test_comment.timestamp, fetched_comment.comment.timestamp);
assert_eq!(
test_comment.user_properties,
fetched_comment.comment.user_properties
);
// Deleting one comment reduces the comment... | Rust | 0 |
INEY_BLOCK: u16 = 2786;
pub const VINEY_BLOCK_SEED: u16 = 2787;
pub const VINEY_WALLPAPER: u16 = 2788;
pub const VINEY_WALLPAPER_SEED: u16 = 2789;
pub const LEAF_BLOCK: u16 = 2790;
pub const LEAF_BLOCK_SEED: u16 = 2791;
pub const MISSION_BLOCK: u16 = 2792;
pub const MISSION_BLOCK_SEED: u16 = 2793;
pub const AIR_CONDITI... | Rust | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.