text string | label_name string | labels int64 |
|---|---|---|
s_left -= 1;
ptr::drop_in_place(raw.pair());
}
}
}
/// Sets the table tag.
pub fn set_tag(&mut self, value: bool) {
self.hashes.set_tag(value)
}
/// Gets the table tag.
pub fn tag(&self) -> bool {
self.hashes.tag()
}
}
/// A raw iterator... | Rust | 0 |
in -= 1;
continue;
}
let is_conjured = item.name.starts_with("Conjured");
let regular_quality_loss_amount = if item.sell_in == 0 { 2 } else { 1 };
let new_quality =
item.quality - regular_quality_loss_amount * if is_conjured { 2 } else { 1... | Rust | 0 |
# Copyright (c) 2020, NVIDIA CORPORATION. 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 by appli... | Python | 1 |
ired features: `\"Win32_Networking_WinSock\"`*"]
pub const BLLI_L3_PACKET_128: u32 = 7u32;
#[doc = "*Required features: `\"Win32_Networking_WinSock\"`*"]
pub const BLLI_L3_PACKET_16: u32 = 4u32;
#[doc = "*Required features: `\"Win32_Networking_WinSock\"`*"]
pub const BLLI_L3_PACKET_2048: u32 = 11u32;
#[doc = "*Required... | Rust | 0 |
specific volume unit_volume
e internal energy unit_energy
h enthalpy unit_energy
s entropy unit_energy / unit_temperature
"""
return 1. / self.d(*varg, **kwarg)
def fromigmix(source):
"""FROMIGMIX - create an IgtMix instance from and igmix... | Python | 1 |
if (not hasattr(self.owner, 'equipped_items') or not self.owner.equipped_items or
self._equipment_data is None):
return
logger.info(f"装備データ移行開始: {self.owner.name}")
for slot_id, item_id in self.owner.equipped_items.items():
if slot_id in self._equip... | Python | 1 |
yrian Pound
#[serde(rename = "760")]
N760,
/// <NAME>
#[serde(rename = "762")]
N762,
/// Taka
#[serde(rename = "050")]
N050,
/// Tala
#[serde(rename = "882")]
N882,
/// Tanzanian Shilling
#[serde(rename = "834")]
N834,
/// Tenge
#[serde(rename = "398")]
N398,
/// <NAME>
#[serde(rename = "626")]
N626... | Rust | 0 |
| SseOpcode::Psllw
| SseOpcode::Pslld
| SseOpcode::Psllq
| SseOpcode::Psraw
| SseOpcode::Psrad
| SseOpcode::Psrlw
| SseOpcode::Psrld
| SseOpcode::Psrlq
| SseOpcode::Psubb
| SseOpcode::Psubd
| SseOp... | Rust | 0 |
::Reg::write_with_zero), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [gpio_sigmadelta2](gpio_sigmadelta2) module"]
pub type GPIO_SIGMADELTA2 = crate::Reg<u32, _GPIO_SIGMADELTA2>;
#[allow(missing_docs)]
#[doc(hidden)... | Rust | 0 |
# src/config.py
import os
import torch
# --- Project Paths ---
SRC_DIR = os.path.dirname(os.path.abspath(__file__))
PROJECT_ROOT = os.path.dirname(SRC_DIR)
# --- Knowledge Base Paths ---
MODEL_DIR = os.path.join(PROJECT_ROOT, 'models')
FAISS_INDEX_PATH = os.path.join(MODEL_DIR, 'faq_index.faiss')
CONTEXTS_PATH = os.p... | Python | 1 |
to_json(&PactSpecification::V3)
})
}
}
}
impl Display for MatchResult {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
match self {
MatchResult::RequestMatch(request, _) => {
write!(f, "Request matched OK - {}", request)
},
MatchResult::RequestMismatc... | Rust | 0 |
is no Y-flip because eye buffers have 0,0 = left-bottom.
const ovrMatrix3f s = ovrMatrix3f_CreateScaling( 0.5, 0.5 );
const ovrMatrix3f t = ovrMatrix3f_CreateTranslation( 0.5, 0.5 );
const ovrMatrix3f r0 = ovrMatrix3f_Multiply( &s, &m );
const ovrMatrix3f r1 = ovrMatrix3f_Multiply( &t, ... | Rust | 0 |
99999999, TickUnit::Nanos);
let mut writer = shm_writer(&Path::new(Q_PATH), &metadata, EncoderHandler::default()).unwrap();
let msg_bytes = "There are 10 kinds of people: those who know binary and those who don't".as_bytes();
// let msgs: Vec<&str> = "There are 10 kinds of people: those who know binary and ... | Rust | 0 |
import unittest
from fundidora import Fundidora
class TestFundidora(unittest.TestCase):
def setUp(self):
"""Configura el entorno de prueba inicial."""
self.fundidora = Fundidora(capacidad=5000, temperatura_maxima=1800)
def test_seleccionar_metal_valido(self):
"""Prueba la selección de ... | Python | 1 |
std/vec/struct.Vec.html#examples-18
unsafe {
buf.set_len(bufsize);
}
self.read_into_slice(&mut buf[..], off, size)?;
Ok(Array2::from_shape_vec((size.1, size.0), buf)?)
}
/// Helper to read into slice from output of
/// [`ChunkConfig`] iterator
fn read_chunk_... | Rust | 0 |
'''
逻辑回归对工具类中的数据集进行分类
'''
import numpy as np
import sklearn # sklearn:免费软件机器学习库,具有各种分类,回归和聚类算法,包括支持向量机,随机森林,梯度提升,k均值和DBSCAN
from planar_utils import load_planar_dataset, plot_decision_boundary, sigmoid, tanh, back_sigmoid, back_tanh
import matplotlib.pyplot as plt # 用于创建各种数据可视化图表,提供了丰富的函数和方法,用于绘制折线图、柱状图等多种类型的图表... | Python | 1 |
, -3, -2],
[-3, -4, -4, -5, -5, -4, -4, -3],
[-3, -4, -4, -5, -5, -4, -4, -3],
[-3, -4, -4, -5, -5, -4, -4, -3],
[-3, -4, -4, -5, -5, -4, -4, -3],
];
pub fn get_values(pieces: &Pieces) -> i32 {
let mut total = 0;
let get_value_from_eval = |pieces: &Pieces, eval: &[[i32; 8]; 8], index: usize| {... | Rust | 0 |
,
backend: &mut B,
varmap: &mut VarMap<V>,
) -> i32 {
let repr = repr.unwrap_or_else(|| varmap.new_var());
let cond_repr = self
.cond
.encode_constraint_equals_repr(None, backend, varmap);
let then_repr = self
.then
.encode_con... | Rust | 0 |
tion")
print(" • Ctrl+U to clear line")
print(" • Ctrl+L to clear screen")
print("-" * 60)
continue
if task.lower() == "clear":
print("\033[2J\033[H") # Clear screen
continue
if task.lower() == "... | Python | 1 |
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use std::cell::{Cel... | Rust | 0 |
// Skip next instruction if key with the value of Vx is pressed.
// Checks the keyboard, and if the key corresponding to the value of Vx is currently in the down position, PC is increased by 2.
let x = (opcode & 0x0F00) >> 8;
format!("SKP V... | Rust | 0 |
# rag_core_enhanced.py
import os
import json
import pandas as pd
from typing import List, Optional, Dict, Any, Union
import numpy as np
from langchain_community.document_loaders import (
PyPDFLoader,
UnstructuredExcelLoader,
TextLoader,
UnstructuredWordDocumentLoader
)
from langchain.text_splitter impo... | Python | 1 |
counter).expect_int();
let i2 = b.to_z3_tree(ctx, sv_ctx, counter).expect_int();
Z3Tree::Int(i1.bvmul(&i2))
}
StackValue::Sub(a, b) => {
let i1 = a.to_z3_tree(ctx, sv_ctx, counter).expect_int();
let i2 = b.to_z3_tree(ctx, sv_ctx, c... | Rust | 0 |
assignment_pos];
let value = &cookie[assignment_pos + 1..];
result.push(CookieOfRequst { name, value })
}
} else {
// only name found "abc" or "abc="
let name = &cookie[..];
let value = "";
... | Rust | 0 |
0x71,// 'q'
// ReservedNop_rm16_r16_0F1E
0x02,// Normal_2a
0x01,// 1 = "reserved-nop"
0x77,// 'w'
// ReservedNop_rm32_r32_0F1E
0x02,// Normal_2a
0x01,// 1 = "reserved-nop"
0x6C,// 'l'
// ReservedNop_rm64_r64_0F1E
0x02,// Normal_2a
0x01,// 1 = "reserved-nop"
0x71,// 'q'
// ReservedNop_rm16_r16_0F1F
0... | Rust | 0 |
}
}
impl SignatoryRecordV2 {
/// Checks signatory hasn't signed off yet and is transaction signer
pub fn assert_can_sign_off(&self, signatory_info: &AccountInfo) -> Result<(), ProgramError> {
if self.signed_off {
return Err(GovernanceError::SignatoryAlreadySignedOff.into());
}
... | Rust | 0 |
from __future__ import absolute_import, print_function, division
import unittest
import numpy
import numpy.random
import theano
from theano.tests import unittest_tools as utt
'''
Different tests that are not connected to any particular Op, or
functionality of Theano. Here will go for example code that we will
... | Python | 1 |
std`] runtime in your
//! application
//! * `tokio_lib`:Use this if you are using [`tokio`] runtime for your application
//! * `static_output`: Use this if you only want to use `minus` for displaying static
//! output
//! * `search`: If you want searching capablities inside the feature
// When no feature is active thi... | Rust | 0 |
'''
Desenvolva um programa que leia quatro valores pelo teclado
e guarde-os em uma tupla.
No final, mostre:
a) quantas vezes apareceu o valor 9
b) em que posição foi digitado o primeiro valor 3
b) quais foram os números pares
'''
tup_num = ()
lis_num = []
for v in range(0,4):
valor = int(input('Digite um número: '... | Python | 1 |
# ===================================================================
#
# Copyright (c) 2021, Legrandin <helderijs@gmail.com>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributio... | Python | 1 |
0, 50)
},
Cuboid {
x: (0, 4),
y: (30, 30),
z: (40, 50)
},
Cuboid {
x: (5, 10),
y: (20, 29),
z: (40, 50)
},
... | Rust | 0 |
CFGB = crate::Reg<u32, _ALTPADCFGB>;
#[allow(missing_docs)]
#[doc(hidden)]
pub struct _ALTPADCFGB;
#[doc = "`read()` method returns [altpadcfgb::R](altpadcfgb::R) reader structure"]
impl crate::Readable for ALTPADCFGB {}
#[doc = "`write(|w| ..)` method takes [altpadcfgb::W](altpadcfgb::W) writer structure"]
impl crate:... | Rust | 0 |
import subprocess
import platform
from prettytable import PrettyTable
from termcolor import colored
# List of hostnames or IPs to ping
hosts = {
"kubemaster": "192.168.56.74",
"kubenode1": "192.168.56.221",
"kubenode2": "192.168.56.135",
"host-vm": "172.24.4.1"
}
# Detect ping count based on OS
param ... | Python | 1 |
# type: ignore
from django.shortcuts import render
from contact.models import Contact
from django.shortcuts import get_object_or_404, redirect
from django.db.models import Q
from django.core.paginator import Paginator
def index(request):
contacts = Contact.objects.filter(show=True).order_by('-id')
paginator ... | Python | 1 |
m");
let z = Scalar::<$curve>::from_repr(GenericArray::clone_from_slice(vector.m))
.expect("invalid vector.z");
let sig = d.try_sign_prehashed(&k, &z).unwrap();
assert_eq!(vector.r, sig.r().to_bytes().as_slice());
assert_eq!(vector.s... | Rust | 0 |
2DSTADDR_SPEC>;
#[doc = "DMA_C2DstAddr."]
pub mod dma_c2dst_addr;
#[doc = "DMA_C2LLI register accessor: an alias for `Reg<DMA_C2LLI_SPEC>`"]
pub type DMA_C2LLI = crate::Reg<dma_c2lli::DMA_C2LLI_SPEC>;
#[doc = "DMA_C2LLI."]
pub mod dma_c2lli;
#[doc = "DMA_C2Control register accessor: an alias for `Reg<DMA_C2CONTROL_SPEC... | Rust | 0 |
from __future__ import annotations
import pytest
from ridgeplot_examples import ALL_EXAMPLES
from ridgeplot_examples._base import (
round_fig_data,
round_nested_seq,
round_seq,
round_sig_figs,
)
def test_all_examples() -> None:
assert len(ALL_EXAMPLES) > 2
@pytest.mark.parametrize(
("sig",... | Python | 1 |
Than or Equal
#[llvm_variant(LLVMIntULE)]
ULE,
/// Signed Greater Than
#[llvm_variant(LLVMIntSGT)]
SGT,
/// Signed Greater Than or Equal
#[llvm_variant(LLVMIntSGE)]
SGE,
/// Signed Less Than
#[llvm_variant(LLVMIntSLT)]
SLT,
/// Signed Less Than or Equal
#[llvm_va... | Rust | 0 |
mul
relu
split_gm = split_by_tags(gm, tags)
Then we have:
split_gm:
red:
conv
blue:
mul
green:
relu
"""
tag_node = defaultdict(list)
gm: torc... | Python | 1 |
die_offset,
name,
}
}
}
/// The `DebugPubNames` struct represents the DWARF public names information
/// found in the `.debug_pubnames` section.
#[derive(Debug, Clone)]
pub struct DebugPubNames<R: Reader>(DebugLookup<R, PubStuffParser<R, PubNamesEntry<R>>>);
impl<'input, Endian> De... | Rust | 0 |
"""API routes for the Vector Store service."""
from fastapi import APIRouter
from utils.api_utils import api_route
from .schemas import (
AddDocumentRequest,
AddDocumentResponse,
VectorSearchRequest,
VectorSearchResponse,
EmbedRequest,
EmbedResponse,
)
from .service import VectorStoreService
... | Python | 1 |
grid = torch.stack(torch.meshgrid(torch.arange(0, res[0], delta[0]), torch.arange(0, res[1], delta[1])), dim=-1) % 1
angles = 2 * math.pi * torch.rand(res[0] + 1, res[1] + 1)
gradients = torch.stack((torch.cos(angles), torch.sin(angles)), dim=-1)
def tile_grads(slice1, slice2):
return (
... | Python | 1 |
+ Send>, // default: 0.0
pub bump_map: Option<Arc<dyn Texture<Float> + Send + Sync>>,
}
impl MatteMaterial {
pub fn new(
kd: Arc<dyn Texture<Spectrum> + Send + Sync>,
sigma: Arc<dyn Texture<Float> + Sync + Send>,
bump_map: Option<Arc<dyn Texture<Float> + Sync + Send>>,
) -> Self {
... | Rust | 0 |
paper size ('letterpaper' or 'a4paper').
#
# 'papersize': 'letterpaper',
# The font size ('10pt', '11pt' or '12pt').
#
# 'pointsize': '10pt',
# Additional stuff for the LaTeX preamble.
#
# 'preamble': '',
# Latex figure (float) alignment
#
# 'figure_align': 'htbp',
}
# G... | Python | 1 |
r(start_char)?;
if distance == 0 {
2
} else {
distance as usize + 1
}
}
// if only the end has a first char, compare it to our first possible symbol.
(None, Some(end_char)) => {
le... | Rust | 0 |
# Today we are learing about if and else statments
# the % gives a remainder like 7 % 2 it will print out 1
print("welcome to the rollercoster! ")
height = int(input("what is your height in cm? "))
bill = 0
if height >= 120:
print("you can ride the rollercoster!")
age = int(input("What is your age? "))
... | Python | 1 |
'Ant-v1',
'trials': 1,
'max_timesteps': 1000000,
},
{'env_id': 'Hopper-v1',
'trials': 1,
'max_timesteps': 1000000,
},
{'env_id': 'Humanoid-v1',
'trials': 1,
'max_timesteps': 1000000,
},
{'env_id': 'HumanoidStandup-v1',... | Python | 1 |
#!/usr/bin/env python3
"""
Quick Opportunity Check
Fast scan for immediate opportunities - perfect for regular checks
"""
import asyncio
from strategic_opportunity_finder import StrategicOpportunityFinder
async def quick_opportunity_check():
"""Quick scan for immediate opportunities"""
print("⚡ QUICK OPPO... | Python | 1 |
# Copyright (c) 2024 Microsoft Corporation.
# Licensed under the MIT License
"""A module containing 'PipelineStorage' model."""
import re
from abc import ABCMeta, abstractmethod
from collections.abc import Iterator
from typing import Any
from graphrag.index.progress import ProgressReporter
class PipelineStorage(me... | Python | 1 |
_model:
checkpoint_start_time = time.perf_counter()
save_model(
model if not train_config.distillation else model.student,
optimizer, ((steps_per_epoch*epoch)+step), train_config, distil_config, fsdp... | Python | 1 |
let file = std::fs::File::create(path).unwrap();
serde_yaml::to_writer(file, self);
}
}
impl LeaderboardEntry {
pub fn new(name: String, score: u32, difficulty: Difficulty) -> LeaderboardEntry {
LeaderboardEntry { name, score, difficulty }
}
pub fn cmp(&self, other: &Self) -> std::c... | Rust | 0 |
= serializer.serialize_tuple_variant("Attribute", 3, "Style", 1)?;
variant.serialize_field(style)?;
variant.end()
}
}
}
}
<filename>src/lib.rs
// Copyright 2020-Present (c) <NAME> & <NAME>
//
// Redistribution and use in source and binary forms, with or without
//... | Rust | 0 |
panic!("invalid parameter mode"),
}
}
}
#[derive(Debug, Eq, PartialEq)]
enum Opcode {
Add,
Mul,
In,
Out,
Jit,
Jif,
Lt,
Eq,
Arb,
Halt,
}
impl From<i64> for Opcode {
fn from(n: i64) -> Self {
match n {
1 => Opcode::Add,
2 => Opcode... | Rust | 0 |
{"overview": {"$regex": query, "$options": "i"}},
{"keywords": {"$regex": query, "$options": "i"}}
]
}
movies_data = await Movie.find(regex_filter).limit(limit).to_list()
# Converter para response
movies = []
for movie in ... | Python | 1 |
BACK: ::ULONG = 0x00001000;
pub const MSV1_0_ALLOW_FORCE_GUEST: ::ULONG = 0x00002000;
pub const MSV1_0_CLEARTEXT_PASSWORD_SUPPLIED: ::ULONG = 0x00004000;
pub const MSV1_0_USE_DOMAIN_FOR_ROUTING_ONLY: ::ULONG = 0x00008000;
pub const MSV1_0_SUBAUTHENTICATION_DLL_EX: ::ULONG = 0x00100000;
pub const MSV1_0_ALLOW_MSVCHAPV2:... | Rust | 0 |
"""
This module provides functions for justifying Unicode text in a monospaced
display such as a terminal.
We used to have our own implementation here, but now we mostly rely on
the 'wcwidth' library.
"""
from unicodedata import normalize
from wcwidth import wcswidth, wcwidth
from ftfy.fixes import remove_terminal_... | Python | 1 |
11 13 6 5
2 0 12 3 7";
#[test]
fn part1() {
assert_eq!(super::part1(SAMPLE), 4512);
}
#[test]
fn part2() {
assert_eq!(super::part2(SAMPLE), 1924);
}
}
// Based on smallpt, http://www.kevinbeason.com/smallpt/ which is also licensed under
// the MIT license.
extern crate a... | Rust | 0 |
# Ticket category IDs
report_category_id = 1005455062157512754
support_category_id = 1005455243959607366
apply_category_id = 1005455133804613682
# Filter Ids
log_keyword_channel_id = 1035396858022989934
# Join Channel & Role Ids
log_channel_id = 1028231110980804729
welcome_channel_id = 678607633552244756
join_role_i... | Python | 1 |
#!/usr/bin/env python
from PyPDF2 import PdfFileMerger
# By appending in the end
def by_appending():
merger = PdfFileMerger()
# Either provide file stream
f1 = open("samplePdf1.pdf", "rb")
merger.append(f1)
# Or direct file path
merger.append("samplePdf2.pdf")
merger.write("mergedPdf.pdf... | Python | 1 |
:Default for ff_rumble_effect {
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
}
ioctl!(read buf eviocgname with b'E', 0x06; u8);
ioctl!(read buf eviocgphys with b'E', 0x07; u8);
ioctl!(read buf eviocguniq with b'E', 0x08; u8);
ioctl!(read buf eviocgprop with b'E', 0x09; u8);
ioctl!(read buf eviocgmtslot... | Rust | 0 |
.shape[0]-1)
c2w = poses[curr_id]
# new_xyz = get_new_xyz(self, poses, optimize_c2c_tqs, localbatch_globalkf_id_mask, curr_id)
xyz_bias = get_xyz_bias_multi(self, poses, optimize_c2c_tqs, localbatch_globalkf_id_mask, self._xyz)
new_xyz = self._xyz + xyz_b... | Python | 1 |
m(0);
const fn ctl_dtsel(reg_val: u32) -> u32 {
bits(3, 5) & (reg_val << 3)
}
pub fn dac_enable(dac_periph: u32) {
if dac_periph == DAC0 {
set_bits(DAC_CTL, DAC_CTL_DEN0);
} else if dac_periph == DAC1 {
set_bits(DAC_CTL, DAC_CTL_DEN1);
}
}
pub fn dac_disable(dac_periph: u32) {
if ... | Rust | 0 |
"
active_btns = self._get_active_in_grid(self._month_specific_grid)
if len(active_btns) == 0:
self._month = "*"
else:
months = {
_("January"): 1,
_("February"): 2,
_("March"): 3,
... | Python | 1 |
= Vec::<u8>::with_capacity(vec_len);
result.set_len(vec_len);
let h_sm = StackMachine::<S>::build(&data.h);
let s_sm = StackMachine::<S>::build(&data.s);
let v_sm = StackMachine::<S>::build(&data.v);
let max_len = *[
h_sm.instructions.len(),
... | Rust | 0 |
# Copyright Amazon.com, Inc. or its affiliates. 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 by ... | Python | 1 |
1
else:
direction = 0
abs_number_of_steps = abs(number_of_steps)
data = [self.STEPPER_STEP, motor_speed & 0x7f, (motor_speed >> 7) & 0x7f, (motor_speed >> 14) & 0x7f,
abs_number_of_steps & 0x7f, (abs_number_of_steps >> 7) & 0x7f, direction]
self._command_handl... | Python | 1 |
let mut inner = self.inner.lock();
// if the commit is for a background round dispatch to round committer.
// that returns Some if there wasn't one.
if let Some(commit) = inner.past_rounds.import_commit(round_number, commit) {
// otherwise validate the commit and signal the finalized block
... | Rust | 0 |
and list(self._predecessors(jump)) == [branch]
):
assert jump.target.label
assert branch.target.label
inverted = self._invert_branch(
branch.instructions[-1], jump.target.label
)
# Check to see if th... | Python | 1 |
("solid", "dot", "dash", "longdash", "dashdot", or
"longdashdot") or a dash length list in px (eg
"5px,10px,2px,2px").
width
Sets the line width (in px).
"""
def __init__(self, arg=None, color=None, dash=None, width=None, **kwargs):
"""
Cons... | Python | 1 |
import jinja2
from config import Var
from TonyStark.bot import StreamBot
from TonyStark.utils.human_readable import humanbytes
from TonyStark.utils.file_properties import get_file_ids
from TonyStark.server.exceptions import InvalidHash
import urllib.parse
import logging
import aiohttp
async def render_page(id, secure... | Python | 1 |
(from, to)
});
self
}
fn check(self) {
let input = self.input.expect("input not set");
let expected_result = self.expected_result.expect("result not set");
check(&input, &expected_result, &self.expected_diagnostics);
}
}
/// Check whether the parser produces expect... | Rust | 0 |
ace, ControlPlaneProvider, Result};
pub struct NatsControlPlaneProvider {
control: Option<ControlInterface>,
}
impl NatsControlPlaneProvider {
pub fn new() -> NatsControlPlaneProvider {
NatsControlPlaneProvider { control: None }
}
}
impl ControlPlaneProvider for NatsControlPlaneProvider {
fn ... | Rust | 0 |
delta(seconds=int(total_time)))
print('Training time {}'.format(total_time_str))
def calculate_recall(outputs, targets):
# Assuming outputs and targets are tensors or numpy arrays
# Convert the outputs to predicted labels (e.g., by thresholding)
predicted_labels = (outputs > 0.5).astype(int)
# Ca... | Python | 1 |
acker.ietf.org/doc/html/rfc8628#section-3.5
ExpiredToken,
//
//
//
/// https://datatracker.ietf.org/doc/html/rfc6749#section-4.1.2.1
/// https://datatracker.ietf.org/doc/html/rfc6749#section-4.2.2.1
/// https://datatracker.ietf.org/doc/html/rfc8628#section-3.5
AccessDenied,
//
//... | Rust | 0 |
stogram>(recorder: Arc<Recorder<T>>) {
const THREAD_COUNT: usize = 10;
const NUM_VALS: usize = 1000000;
let mut total_value = 0_u64;
let ready_var = Arc::new(AtomicBool::new(false));
let mut values = Vec::<Arc<Vec<u32>>>::new();
let mut handles = Vec::<thread::JoinHandle<()>>::new();
let mut... | Rust | 0 |
#
# (C) Copyright 2014 lilydjwg <lilydjwg@gmail.com>
#
"""Message Delivery Receipts
Normative reference:
- `XEP-0184 <http://xmpp.org/extensions/xep-0184.html>`__
"""
from __future__ import absolute_import, division
__docformat__ = "restructuredtext en"
import platform
import logging
from pyxmpp2.etree import E... | Python | 1 |
TensorArrays
Raises:
TypeError: if initializer and fn() output structure do not match
ValueType: if initializer and fn() output lengths do not match
"""
packed_elems = input_pack([elem_ta.read(i) for elem_ta in elems_ta])
packed_a = output_pack(a_flat)
a_out = fn(packed_a,... | Python | 1 |
aauxiliaryhttpput()
elif scconsole80 == "show options":
print("""
OPTIONS | DISCREPTIONS
--------------|----------------------
URL | specify the taregt url.
you will specifiy these options when you run or exploit it!
""")
aauxiliaryhttpput()
elif scconsole80 == "run":
os... | Python | 1 |
DayKind::Holiday
} else if self_ord == next_holiday_ord - 1 || weekday == Weekday::Sat {
DayKind::DayBeforeHoliday
} else {
DayKind::Weekday
}
}
}
#[derive(Clone)]
struct SliceIterator {
// Stepped forward.
start: chrono::DateTime<Tz>,
end: Option... | Rust | 0 |
// arguments here. If `val` is out-of-range this macro uses `val == 255`:
constify_imm8!(val, call);
}
use std::{
fmt,
iter::{FromIterator, IntoIterator},
marker::PhantomData,
};
use necsim_core::{
impl_finalise, impl_report,
reporter::{
boolean::{Boolean, False, True},
Reporter... | Rust | 0 |
b const MAX_CHUNK: usize = 32768;
/// The maximum size of an MSZIP compressed block: 32KB + 12 bytes.
pub const MAX_BLOCK_SIZE: usize = MAX_CHUNK + 12;
fn run_compress<R: BufRead>(obj: &mut R, data: &mut Compress, mut dst: &mut [u8]) -> io::Result<(usize, usize)> {
// Cribbed from flate2-rs. Wish this was public A... | Rust | 0 |
code>RedrivePolicy</code> – The string that includes the parameters for the dead-letter queue functionality of the source queue as a JSON object. For more information about the redrive policy and dead-letter queues, see <a href="https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-dead-letter-... | Rust | 0 |
from random import randint
from PySide2.QtGui import QPixmap, QFont
from PySide2.QtWidgets import QLabel
class DartPositionLabel(QLabel):
def __init__(self, parent):
QLabel.__init__(self, parent)
self.DartPositionLocale = parent
self.setPixmap(QPixmap(u"Resources/x-circle.svg"))
@pr... | Python | 1 |
.0.0.1:8080")
.expect("Can not bind to 127.0.0.1:8080")
.start();
println!("Starting http server: 127.0.0.1:8080");
let _ = sys.run();
}
pub mod annotation;
pub mod book;
pub mod stor;
use actix_web::{HttpResponse, ResponseError};
use thiserror::Error;
pub type ServiceResult<T> = Result<T, Ser... | Rust | 0 |
def _register_parameter_hook_creator(self, func):
def hook(*args, **kwargs):
name = args[1]
parameter = args[2]
retval = func(*args, **kwargs)
if parameter is not None and parameter not in self._module_parameters:
self._module_parameters[parameter] = name, CallStack.from... | Python | 1 |
Self::Output;
}
macro_rules! shr_impl {
($t:ty, $f:ty) => (
#[stable(feature = "rust1", since = "1.0.0")]
impl Shr<$f> for $t {
type Output = $t;
#[inline]
#[rustc_inherit_overflow_checks]
fn shr(self, other: $f) -> $t {
self >> othe... | Rust | 0 |
>()
.map_err(|err| ComponentsParseError(err.to_string()))?;
Some((fp, deriv))
} else {
None
};
let key = bitcoin::PublicKey::from_str(
caps.name("pubkey")
.or_else(|| caps.name("pubkey_long"))
... | Rust | 0 |
};
/// Compress a [`JsString`].
///
#[wasm_bindgen]
pub fn compress(data: &JsValue) -> JsString {
let data: &JsString = data.dyn_ref::<JsString>().expect("Valid JsString");
let data: Vec<u16> = data.iter().collect();
let compressed = crate::compress(&data);
JsString::from_char_code(&compressed)
}
///... | Rust | 0 |
ted, comp = float, eps = 1e-15);
}
}
#[test]
fn householder_composition_first_k_columns() {
let storage = matrix![ 5.0, 3.0, 2.0;
2.0, 1.0, 3.0;
-2.0, 3.0, -2.0];
let tau = vec![2.0/9.0, 1.0 / 5.0, 2.0];
let c... | Rust | 0 |
tx.send(Some((index, stats)))
.expect("Could not send mid data!");
}
None => {
tx.send(None).expect("Could not send end data!");
break;
}
}
}... | Rust | 0 |
import os
from dotenv import load_dotenv
import asyncio
import json
from langchain_text_splitters import RecursiveCharacterTextSplitter
from langchain.chat_models import init_chat_model
from langchain_openai import OpenAIEmbeddings
from langchain_core.vectorstores import InMemoryVectorStore
from structures import Fac... | Python | 1 |
# tests/test_lexer.py
import unittest
from lexer import Lexer, TOKEN_PRINT, TOKEN_STRING
class TestLexer(unittest.TestCase):
def test_tokenize_print(self):
code = 'PRINT "Hello, World!"'
lexer = Lexer(code)
tokens = lexer.tokenize()
self.assertEqual(tokens[0][0], TOKEN_PRINT)
... | Python | 1 |
FileOutput { hash, file_path, file_name })
}
/// Read the content of this asset to a String.
pub async fn read_to_string(&self) -> Result<String> {
fs::read_to_string(&self.path)
.await
.with_context(|| format!("error reading file {:?} to string", self.path))
}
}
/// Th... | Rust | 0 |
.
#[derive(Copy, Clone, Debug)]
#[repr(C)]
pub struct xcb_xv_get_still_request_t {
pub major_opcode: u8,
pub minor_opcode: u8,
pub length: u16,
pub port: xcb_xv_port_t,
pub drawable: xcb_drawable_t,
pub gc: xcb_gcontext_t,
pub vid_x: i16,
pub vid_y: i16,
pub vid_w: u16,
pub vid_h... | Rust | 0 |
norm_cfg=norm_cfg)
self.conv1x1s = nn.ModuleList([
ConvModule(
cur_channel, cur_channel, 1, norm_cfg=norm_cfg, act_cfg=None)
for _ in range(num_stacks - 1)
])
self.out_convs = nn.ModuleList([
ConvModule(
cur_channel, feat_chan... | Python | 1 |
import bpy
class OBJECT_OT_SelectByMaterialName(bpy.types.Operator):
bl_idname = "object.select_by_material_name"
bl_label = "Select Objects by Material Name"
bl_options = {"REGISTER", "UNDO"}
material_name: bpy.props.StringProperty(
name="Material Name",
default="",
descripti... | Python | 1 |
from fastapi import FastAPI, HTTPException
import uuid
from .db.models import Artist
from sqlmodel import SQLModel, Session, create_engine, select
# create engine
engine = create_engine("sqlite:///music_store_app/data/music-store.db", echo=True)
# create all tables
SQLModel.metadata.create_all(engine)
#Open a session... | Python | 1 |
import sqlite3
import encodings.idna
from urllib.parse import urlsplit
import os, tempfile, shutil
import glob
import publicsuffix2 as ps2
def path_matches(cookie_path, req_path):
# https://dxr.mozilla.org/mozilla-central/source/netwerk/cookie/nsCookieService.cpp#3047
cookie_path = cookie_path.rstrip('/')
if n... | Python | 1 |
til", reason="psutil needed to run this test")
# We haven't yet directly identified the leaks so test with a memory growth
# threshold.
pause_time, acceptable_memory_leakage = time_mem
if env["MPLBACKEND"] == "wx":
pytest.skip("wx backend is deprecated; tests failed on appveyor")
if env["M... | Python | 1 |
_ => GoalSource::UnknownVariant(value),
}
}
}
impl convert::From<i64> for GoalSource {
fn from(value: i64) -> Self {
GoalSource::from(value as u8)
}
}
impl Serialize for GoalSource {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: Serializer,
... | Rust | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.