text string | label_name string | labels int64 |
|---|---|---|
fn create_rust_thing() -> RustThing {
RustThing::default()
}
#[wasm_bindgen]
#[derive(Clone, Default)]
pub struct RustThing {
things: usize,
list: Observable<Vec<String>>,
}
#[wasm_bindgen]
impl RustThing {
pub fn do_something(&mut self) {
self.things += 1;
self.list.push(format!("Thi... | Rust | 0 |
.abs();
if filled {
self.inner_line(x0, radius + y0, x0, -radius + y0, color);
self.inner_line(radius + x0, y0, -radius + x0, y0, color);
} else {
self.inner_pixel(x0, radius + y0, color);
self.inner_pixel(x0, -radius + y0, color);
self.inner_... | Rust | 0 |
_EPOCH).expect("date should be after Unix Epoch");
datalog::ConstraintKind::Date(datalog::DateConstraint::Before(dur.as_secs()))
},
ConstraintKind::Date(DateConstraint::After(date)) => {
let dur = date.duration_since(UNIX_EPOCH).expect("date should be after Unix Epoch");
da... | Rust | 0 |
)?;
let a = ast_argv(t);
let n = a.len();
let mut i = 0;
while i < n {
if a[i+1].symbol_type == SymbolType::None {
self.compile_ast(bv, &id)?;
if a[i].symbol_type == SymbolType::Identifier {
self.compile_string(bv, &a[i])?;
... | Rust | 0 |
ssures[i-1]
else: # Exhaust stroke
if theta <= exhaust_start + blowdown_duration:
if i > 0:
progress = (theta - exhaust_start) / blowdown_duration
decay = 1 / (1 + np.exp(6 * (progress - 0.5)))
... | Python | 1 |
an codes into key events.
fn advance_state(state: &mut DecodeState, code: u8) -> Result<Option<KeyEvent>, Error>;
/// Convert a Scan Code set X byte to our 'KeyCode' enum
fn map_scancode(code: u8) -> Result<KeyCode, Error>;
/// Convert a Scan Code Set X extended byte (prefixed E0) to our `KeyCode`
... | Rust | 0 |
:
evaluator = _create_evaluator_with_supported_channel_signals()
await _trigger_callback_with_data_and_assert_note(evaluator, data={
services_constants.CONFIG_IS_CHANNEL_MESSAGE: True,
services_constants.CONFIG_MESSAGE_SENDER: "TEST-CHAN-1",
services_constants.CONFIG_MESSAGE_CONTENT: """... | Python | 1 |
import pytest
from pandas import IntervalIndex
import pandas._testing as tm
class TestPickle:
@pytest.mark.parametrize("closed", ["left", "right", "both"])
def test_pickle_round_trip_closed(self, closed):
# https://github.com/pandas-dev/pandas/issues/35658
idx = IntervalIndex.from_tuples([(1,... | Python | 1 |
import torch, time
import chamfer2D.dist_chamfer_2D
import chamfer3D.dist_chamfer_3D
import chamfer5D.dist_chamfer_5D
import chamfer_python
cham2D = chamfer2D.dist_chamfer_2D.chamfer_2DDist()
cham3D = chamfer3D.dist_chamfer_3D.chamfer_3DDist()
cham5D = chamfer5D.dist_chamfer_5D.chamfer_5DDist()
from torch.autograd im... | Python | 1 |
from rest_framework import serializers
from restaurants.models import Restaurant, RestaurantRating
from django.db.models import Avg
class RestaurantSerializer(serializers.ModelSerializer):
category_name = serializers.CharField(source='category.name', required=False)
manager_id = serializers.Char... | Python | 1 |
32,
32,
64,
LLVMDIFlags::LLVMDIFlagArtificial,
map[&ClassId::PRIMITIVE_INT]
);
let vtable_field = di_builder.create_member_type(
unknown_file,
"__vtable",
unknown_file,
0,
64,
64,
0,
LLVMDIFlags::LLVMDIFlagArtificial... | Rust | 0 |
>
/// <p>You can use IAM policies to control this action's access to Amazon SWF resources as
/// follows:</p>
/// <ul>
/// <li>
/// <p>Use a <code>Resource</code> element with the domain name to limit the action to
/// only specified domains.</p>
/// </li>
/// <li>
/// <p>Use an <code>Action</code> element to allow or ... | Rust | 0 |
NO_WIN_PROMPT,
Less => EVIL_WIN_PROMPT,
}
}
#[cfg(test)]
mod tests {
#[test]
fn returns_expected() {
use super::good_vs_evil;
assert_eq!(good_vs_evil("0 0 0 0 0 10", "0 0 0 0 0 0 0"), "Battle Result: Good triumphs over Evil");
assert_eq!(good_vs_evil("0 0 0 0 0 0", "0 0 0 0... | Rust | 0 |
x *= 10;
x += (it.next().unwrap() as u8 - b'0') as i32;
} else {
break;
}
}
res.push(Tok::Num(-x));
}
'0'..='9' => {
le... | Rust | 0 |
(class_marker).into_conditional(class_is_valid)
}
fn implements_clause(p: &mut Parser) -> ParsedSyntax<ConditionalSyntax> {
if p.cur_src() != "implements" {
return Absent;
}
let mut is_valid = true;
let implements_clause = p.start();
let start = p.cur_tok().range.start;
p.bump_remap(T![implements]);
let li... | Rust | 0 |
"""
Dictionaries with names of common elements, like hardware types. Just for display purposes.
"""
# A dictionary of hardware types, for display purposes
hardware_types = {
0: "Reserved",
1: "Ethernet",
2: "Experimental Ethernet",
3: "Amateur Radio AX.25",
4: "Proteon ProNET Token Ring",
5: "C... | Python | 1 |
# Copyright (c) 2025 Joseph Agrane
# Licensed under the MIT License. See LICENSE file in the project root for full license information.
from ndshapecheck.shape_check import ShapeCheck
def test_single_shape_h1() -> None:
def f(a, b):
sc = ShapeCheck()
return sc(a).check(b)
assert f('1,2,3', (1,2... | Python | 1 |
Cursor;
///
/// let lzss10: [u8; 11] = [ 0x10, 0x14, 0x00, 0x00, 0x08, 0x61, 0x62, 0x63, 0x64, 0xD0, 0x03, ]; // abcdabcdabcdabcdabcdabcd
/// let decoded = decompress(&mut Cursor::new(lzss10));
/// ```
pub fn decompress<T: Read + Seek>(data: &mut T) -> Result<Vec<u8>, Error> {
let lz_type = data.read_u8()?;
let... | Rust | 0 |
ailure_reason).into()),
}
}
fn create_output_file(
&mut self,
user_id_hash: &str,
name: &str,
removable_media: Option<&str>,
) -> Result<std::fs::File, Box<dyn Error>> {
let path = match removable_media {
Some(media_path) => Path::new(REMOVABLE_ME... | Rust | 0 |
#入力値を取得
# Coin_kind = コインの種類
# Totalfee = 支払う合計金額
# coin_list = [a円, b円, c円, ...]
# or
Totalfee, Coin_kind = map(int,input().split())
coin_list = list(map(int,input().split()))
#入力値を取得
Coin_kind = 7
Totalfee = 1499
coin_list = [2, 3, 5, 10, 15, 30, 100]
def coin_list_check_problem(Coin_kind, Totalfee, coin_list):... | Python | 1 |
import gstaichi as ti
from .base import Base
@ti.data_oriented
class Smoke(Base):
def __init__(self):
super().__init__()
@property
def sampler(self):
return "regular"
| Python | 1 |
extern crate chrono;
mod config;
#[derive(Debug)]
struct ReportEntry<'a> {
activity: &'a str,
duration: &'a str,
from: &'a str,
to: &'a str,
comment: &'a str,
}
impl<'a> ReportEntry<'_> {
pub fn new(
activity: &'a str,
duration: &'a str,
from: &'a str,
to: &'... | Rust | 0 |
# Copyright 2017 F5 Networks Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writi... | Python | 1 |
t_data, sentiment, use_memory)
# Display prediction
if "BULLISH" in prediction['direction']:
st.success(f"**{prediction['direction']}** - Confidence: {prediction['confidence']:.1f}%")
elif "BEARISH" in prediction['d... | Python | 1 |
, y_center, width, height = label
x_min, y_min, x_max, y_max = denormalize_bbox(
[x_center, y_center, width, height], img_width, img_height
)
# 绘制边界框
rect = patches.Rectangle(
(x_min, y_min), x_max - x_min, y_max - y_min,
... | Python | 1 |
::Mat)
//! - [(&)Point2<T>](nalgebra::Point2) -> [Point_<T>](opencv::core::Point_)
//! - [(&)Point3<T>](nalgebra::Point3) -> [Point3_<T>](opencv::core::Point3_)
//! - [(&)Translation<N, D>](nalgebra::Translation) ->? [Mat](opencv::core::Mat)
//! - [(&)Isometry3<T>](nalgebra::Isometry3) ->? [OpenCvPose<Point3_<T>>](Open... | Rust | 0 |
import pygame
import sys
from Shared_Resources import (
SCREEN_WIDTH, SCREEN_HEIGHT,
BUTTON_COLOR, BUTTON_HOVER_COLOR,
font, small_font, TEXT_COLOR_WHITE,
RANK_COLORS, draw_text
)
pygame.init()
screen = pygame.display.set_mode((SCREEN_WIDTH, SCREEN_HEIGHT))
pygame.display.set_captio... | Python | 1 |
#🔒 Password Strength Meter with Streamlit
import streamlit as st
import re
# Streamlit App Title
st.title("🔐 Password Strength Meter")
# User input for password
password = st.text_input("Enter your password", type="password")
# Password strength evaluation function
def evaluate_password_strength(password):
st... | Python | 1 |
F_W5_SPEC>`"]
pub type HOST_SLCHOST_CONF_W5 = crate::Reg<host_slchost_conf_w5::HOST_SLCHOST_CONF_W5_SPEC>;
#[doc = ""]
pub mod host_slchost_conf_w5;
#[doc = "HOST_SLCHOST_WIN_CMD register accessor: an alias for `Reg<HOST_SLCHOST_WIN_CMD_SPEC>`"]
pub type HOST_SLCHOST_WIN_CMD = crate::Reg<host_slchost_win_cmd::HOST_SLCH... | 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 isSameTree(self, p: Optional[TreeNode], q: Optional[TreeNode]) -> bool:
# has to just be an O(n)... | Python | 1 |
rs
// rustfmt-binop_separator: Back
fn main() {
let value = abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ ^
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ;
let value = abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ &
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ;
... | Rust | 0 |
662c99d750f60d3"),
plaintext: b"",
aad: b"",
ciphertext: b"",
tag: &hex!("aec7ece66b7344afd6f6cc7419cf6027"),
},
TestVector {
key: &hex!("f30b5942faf57d4c13e7a82495aedf1b4e603539b2e1599317cc6e53225a2493"),
nonce: &hex!("336c388e18e6abf92bb739a9"),
plaintex... | Rust | 0 |
# -*- coding: utf-8 -*-
from django.test import TestCase
from functools import partial
from mock import patch
from tools.gis import donde_queda
from preciosa.precios.tests.factories import CityFactory, SucursalFactory
from tools.gis import punto_destino
def mock_reverse_geocode(lat, lon, formatted=True,
... | Python | 1 |
let timeout = Timeout::new(reactor.now() + timeout);
match select_3(handler, timeout.elapsed(), token.cancelled()).await {
Select3::R1(ret) => ret?,
Select3::R2(_) => return Err(ServerError::Timeout),
Select3::R3(_) => return Err(ServerError::St... | Rust | 0 |
th,
&segment_config,
&optimizers_config,
);
let collection = construct_collection(
segment_holder,
segment_config,
wal,
search_runtime,
optimizers,
optimizers_config.flush_interval_sec,
);
Ok(collection)
}
use crate::interpreter::Value;
... | Rust | 0 |
"]
#[inline(always)]
pub unsafe fn bits(self, value: u16) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x03ff << 16)) | ((value as u32 & 0x03ff) << 16);
self.w
}
}
#[doc = "Field `rx_adc_os_i` reader - "]
pub struct RX_ADC_OS_I_R(crate::FieldReader<u16, u16>);
impl RX_ADC_OS_I_R {
pub(c... | Rust | 0 |
setting_type: SettingType::Usize,
comment: Some("The port the MM web GUI will listen on. Deprecated."),
},
SettingRow {
id: "node_binary_path",
name: "NodeJS Binary Path",
default: None,
setting_type: SettingType::String,
... | Rust | 0 |
_add_vector_mut() {
let mut large_vector: LargeVector<u8, 4> = LargeVector {
data: vec![1, 2, 3, 4],
};
let large_vector_2: LargeVector<u8, 4> = LargeVector {
data: vec![5, 6, 7, 8],
};
large_vector += large_vector_2;
let added_large_vector: Lar... | Rust | 0 |
import pygame
from pygame.locals import *
from sys import exit
from random import randint, randrange, choice
import os
pygame.init()
pygame.mixer.init()
pygame.display.set_caption("UTF Killed me!")
largura = 640
altura = 480
nivel = 0
diretorio_principal = os.path.dirname(__file__)
diretorio_imagens = os.path.joi... | Python | 1 |
self.__update_board(board_copy, position)
new_node = Node(board_copy)
temp_value = self.minimax(new_node, depth - 1, human_score, agent_score,
alpha, beta, False)[1]
if (temp_value > value):
... | Python | 1 |
task_type: 0,
task_for: "".to_string(),
task_state: 0,
data: "".to_string(),
create_time: Local::now().naive_local(),
execute_time: Local::now().naive_local(),
retried_times: 0,
}
}
}
impl RawTask {
pub fn new<T: Serialize +... | Rust | 0 |
import os
import cv2
import time
import torch
import pickle
import numpy as np
from tqdm import tqdm
from alisuretool.Tools import Tools
from torch.nn import functional as F
from torch.utils.data import Dataset
from torch.utils.data import DataLoader
from src.my_data.utils_rle import rle_to_mask
from src.my_transforms ... | Python | 1 |
ple number: ", idx_nb)
ext_loop = int(np.floor(idx_nb / num_batches_per_global))
int_loop = int(idx_nb % num_batches_per_global)
temp = ar.get_layer(ds_att, batch = ext_loop, layer = rf_dict["layer"])
nheads = len(temp["heads"].keys())
nbatch = temp["datetime"].shape[0]
nlevel = temp.ml.shape[0]... | Python | 1 |
Console(record=True)
console.log(
"JSONRPC [i]request[/i]",
5,
1.3,
True,
False,
None,
{
"jsonrpc": "2.0",
"method": "subtract",
"params": {"minuend": 42, "subtrahend": 23},
"id": 3,
},
)
conso... | Python | 1 |
"{} failed with error number '{}' ('{}')", stringify!($function), errno.0, errno);
}
pointer
}
}
}
use crate::error::*;
use crate::manifest::add_pallet_to_manifest;
use crate::registry::registry_path;
use crate::runtime::add_pallet_to_runtime;
use cargo_edit::{get_latest_dependency, registry_url, update_regis... | Rust | 0 |
mapped group {} for volume {}",
opt.group, mp_str))?;
set_file_owner(&dir, user, group)
.map_err(|e| format_err!("Error chowning \
persistent volume: {}", e))?;
set_file_mode(&dir, opt.mode)
... | Rust | 0 |
Box::new(Expr::Sexp(
Op::Sub,
Box::new(Expr::Atom(Prim::Num(26))),
Box::new(Expr::Atom(Prim::Num(20))),
)),
))
),]
);
}
#[test]
fn whitespace() {
let foo = b"
... | Rust | 0 |
.get_value(0, ctx.schema_1.clone())
.unwrap()
.unwrap()
.get_inner();
assert_eq!(value, InnerValue::Int(12345));
let value = record.get_value(1, ctx.schema_1.clone()).unwrap();
assert!(value.is_none());
let value = record
.get_value(2, ctx.schema_1.clone())
... | Rust | 0 |
import ssl
def load_ssl_context(cert_file, pkey_file):
context = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)
context.load_cert_chain(cert_file, pkey_file)
return context
def save_ssl_files(cert, pkey):
import atexit
import os
import tempfile
from cryptography.hazmat.primitives import seriali... | Python | 1 |
::fmt::Result {
write!(formatter, "a 40 character long hash")
}
fn visit_str<E: serde::de::Error>(self, v: &str) -> Result<Self::Value, E> {
if v.len() != 40 {
return Err(serde::de::Error::invalid_value(
serde::de::Unexpected::Str(v),
&"expected a 40 ... | Rust | 0 |
# BSD 3-Clause License
#
# Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyrig... | Python | 1 |
queries = {}
qrels = {}
for row_id, row in enumerate(query_list):
queries[str(row_id)] = row["query"]
qrels[str(row_id)] = {str(row["relevant_docs"]): 1}
corpus_list = datasets.load_dataset(
name="nlp_journal_abs_article-corpus",
split="corp... | Python | 1 |
impl RTCBuildFlags {
pub const DYNAMIC: RTCBuildFlags = RTCBuildFlags(1);
}
impl ::std::ops::BitOr<RTCBuildFlags> for RTCBuildFlags {
type Output = Self;
#[inline]
fn bitor(self, other: Self) -> Self {
RTCBuildFlags(self.0 | other.0)
}
}
impl ::std::ops::BitOrAssign for RTCBuildFlags {
... | Rust | 0 |
new())),
"binaryerror" | "binary_error" => Some(Box::new(BinaryError::new())),
"binaryerror01" | "binary_error01" => Some(Box::new(BinaryError01::new())),
_ => None
}
}
pub fn metrics_from_names(names: &[String]) -> Option<Vec<Box<dyn Metric>>> {
let mut metrics = Vec::new();
for na... | Rust | 0 |
torage'
WHITENOISE_USE_FINDERS = True
# After login/logout, redirect to project
LOGIN_URL = "/login"
LOGIN_REDIRECT_URL = "../"
LOGOUT_REDIRECT_URL = "../"
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
CORS_ALLOWED_ORIGINS = [
"http://localhost:5173",
"http://127.0.0.1:5173",
"http://127.0.0.1:8000... | Python | 1 |
ing::ToString;
let address: Address = random();
let _route = route!["str", "STR2", "STR3".to_string(), address];
}
}
<filename>Chapter08/feruscore/src/instruction.rs
use rand::{thread_rng, Rng};
use std::io;
use std::io::Write;
#[derive(PartialEq, Eq, Copy, Clone, Debug)]
pub enum OpCode {
Dat,... | Rust | 0 |
import cv2
import numpy as np
from tqdm import tqdm
from scipy.interpolate import interp1d
from srcs.Phaser import Phaser
from config import *
def get_world_points(pattern_size):
world_point = np.zeros((np.prod(pattern_size), 3), np.float32)
world_point[:, :2] = np.indices(pattern_size).T.reshape(-1, 2)
... | Python | 1 |
def _global_pool(self, x: torch.Tensor) -> Tuple[torch.Tensor, torch.Tensor]:
if self.pool_type == 'avg':
pooled, tokens = x[:, 1:].mean(dim=1), x[:, 1:]
elif self.pool_type == 'tok':
pooled, tokens = x[:, 0], x[:, 1:]
else:
pooled = tokens = x
ret... | Python | 1 |
UrlID;
use crate::db::models::Url;
use crate::Config;
use anyhow::{anyhow, Result};
use std::convert::TryInto;
use tantivy::{
collector::TopDocs,
directory::MmapDirectory,
doc,
query::Query,
query::{BooleanQuery, FuzzyTermQuery},
schema::{Field, Schema},
Index, IndexReader, Term,
};
use toki... | Rust | 0 |
p S r SSKrSSKrSSKrSSKrSSKJs Jr " S S5 r S r
\S:X a \
" 5 gg)AExample of Timer and Compare APIs:
$ python -m examples.compare
Nc < |