text string | label_name string | labels int64 |
|---|---|---|
cription": f"測試描述{eventId[-1]}"
}
)
# 模擬事件列表響應
mock_events.list.return_value.execute.return_value = {
"items": [
{
"id": "event_a",
"summary": "用戶A排班",
"start": {"dateTime": "2025-05-30T0... | Python | 1 |
mputed_modifier_multiple_args() {
let template = String::from(r#"{var|modifier:-32.09:"argument":var2:true}"#);
let template = parse(template);
assert!(template.is_ok(), "{:#?}", template);
let template = template.unwrap();
assert_eq!(
template,
Template {... | Rust | 0 |
\u{1ee59}'),
('\u{1ee5b}', '\u{1ee5b}'), ('\u{1ee5d}', '\u{1ee5d}'), ('\u{1ee5f}',
'\u{1ee5f}'), ('\u{1ee61}', '\u{1ee62}'), ('\u{1ee64}', '\u{1ee64}'),
('\u{1ee67}', '\u{1ee6a}'), ('\u{1ee6c}', '\u{1ee72}'), ('\u{1ee74}',
'\u{1ee77}'), ('\u{1ee79}', '\u{1ee7c}'), ('\u{1ee7e}', '\u{1ee7e... | Rust | 0 |
ids_to_text(tokens)
def tokenize(self, prompt):
return self.tokenizer.text_to_ids(prompt)
tokenizer = MCoreTokenizerWrappper(model.tokenizer)
inference_wrapped_model = GPTInferenceWrapper(model.model, args)
text_generation_controller = SimpleTextGenerationController(
inference... | Python | 1 |
me["metrics"][HD_PHONE_MODEL_NAME])
if model == '4K':
vmafScore.append(frame["metrics"][_4K_MODEL_NAME])
else:
with open(vmafpath) as jsonFile:
jsonData = json.load(jsonFile)
for frame in jsonData['frames']:
if m... | Python | 1 |
import argparse
import math
def arithmetic_intensity(M, N, K):
# Compute the number of floating-point operations
ops = 2 * M * N * K
bytes = 2 * (M * K + N * K + M * N)
ai = ops / bytes
print(f"gemm: {M}x{N}x{K} arithmetic intensity: {ai:.5f}")
return ai
if __name__ == "__main__":
... | Python | 1 |
SION")]
pub const NVX_IMAGE_VIEW_HANDLE_SPEC_VERSION: u32 = 2;
#[doc = "<s>Vulkan Manual Page</s> · Constant"]
#[doc(alias = "VK_NVX_IMAGE_VIEW_HANDLE_EXTENSION_NAME")]
pub const NVX_IMAGE_VIEW_HANDLE_EXTENSION_NAME: *const std::os::raw::c_char = crate::cstr!("VK_NVX_image_view_handle");
#[doc = "<s>Vulkan Manual Page<... | Rust | 0 |
# Copyright 2014 Google 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 writing,... | Python | 1 |
config(deps.storage)?;
let sender_addr_raw: CanonicalAddr = deps.api.addr_canonicalize(info.sender.as_str())?;
if sender_addr_raw != config.mint_contract {
return Err(StdError::generic_err("unauthorized"));
}
let current_balance: Uint128 = query_balance(
&deps.querier,
env.contr... | Rust | 0 |
rn _Undef(lhs); }
B(cx).or(lhs, rhs)
}
pub fn Xor(cx: &Block, lhs: ValueRef, rhs: ValueRef) -> ValueRef {
if cx.unreachable.get() { return _Undef(lhs); }
B(cx).xor(lhs, rhs)
}
pub fn BinOp(cx: &Block, op: Opcode, lhs: ValueRef, rhs: ValueRef)
-> ValueRef {
if cx.unreachable.get() { return _U... | Rust | 0 |
#block until cancelled(l) or confirmed (r)
self.dpad.update()
if self.dpad.l.fell:
self.details.hidden=True
if self.dpad.r.fell:
self.game.wipe_alibis()
self.det... | Python | 1 |
import torch
from einops import repeat
from jaxtyping import Int
from torch import Tensor
from typing import List, Dict, Set, Tuple
from typing import Union
Index = Int[Tensor, "n n-1"]
def generate_heterogeneous_index(
n: int,
device: torch.device = torch.device("cpu"),
) -> Tuple[Index, Index]:
"""Gene... | Python | 1 |
case "h":
return truncated.strftime("%Y-%m-%dT%H")
case "d":
return truncated.strftime("%Y-%m-%d")
case "w":
return truncated.strftime("%Y-%m-%d") # Week is special, keep the day
case "M":
return truncated.strftime("%Y-%m")
case "y"... | Python | 1 |
new::<Sqlite>().await?;
let record = sqlx::query!(r#"select text as `text?` from tweet"#)
.fetch_one(&mut conn)
.await?;
assert_eq!(record.text.as_deref(), Some("#sqlx is pretty cool!"));
Ok(())
}
#[derive(PartialEq, Eq, Debug, sqlx::Type)]
#[sqlx(transparent)]
struct MyInt(i64);
struc... | Rust | 0 |
_g2,
groth2_g1_y0,
groth1_g1_ipk,
groth1_y_ipk,
}
}
}
macro_rules! check_blindings_count {
( $self:ident, $i: ident, $link:ident, $unrevealed_attr_count:ident ) => {{
if $self.blindings_t[$i - 1].len() != $link.signature.T.len() {
Err(DelgError::G... | Rust | 0 |
,
};
assert_eq!(pb.tract().unwrap(), pb.reference());
Ok(())
}
#[test]
fn group_11() -> anyhow::Result<()> {
let pb = ConvProblem {
shape_in: DataFormat::HWC.from_n_c_hw(1, 2, &[1])?,
shape_out: DataFormat::HWC.from_n_c_hw(1, 8, &[1])?,
kernel_format: KernelFormat::OIHW,
... | Rust | 0 |
StoreTarget::Gpr(GPR_B),
), // mov b,[di]
0x46 => Instruction::Mov(
LoadSource::SprIndirect(SPR_DESTINATION_INDEX),
StoreTarget::Gpr(GPR_C),
), // mov c,[di]
0x47 => Instruction::Mov(
LoadSource::SprIndirect(SPR_DESTINATION_INDEX),
... | Rust | 0 |
class Solution:
def subarraysDivByK(self, nums: List[int], k: int) -> int:
pre = 0
pre_dict ={0 : 1}
count = 0
for n in nums:
pre += n
pre_mod = pre % k
if pre_mod in pre_dict:
count += pre_dict[pre_mod]
... | Python | 1 |
"Precision": precision,
"Recall": recall
}
best_thresholds_results = [
{
"Label": self._lab2cname[label],
"Threshold": best_thresholds[label]["Threshold"],
"Precision": best_thresholds[... | Python | 1 |
height']) == 256
assert int(reader['width']) == 512
# test resolution
path = os.path.join(output_dir, 'test_array_to_video_resolution.mp4')
array_to_video(img_arr, output_path=path, resolution=(128, 256))
reader = VideoInfoReader(path)
assert int(reader['height']) == 128
assert int(reader['w... | Python | 1 |
ld_mi = cont_bin_mi(loss_diff, -1, 1, masks, kde_s, f_kl)
bound_square = np.sqrt(2 * ld_mi) + Lt
# use both L0 and L1 to reduce variance
single_mi = cont_bin_mi(np.concatenate([L0, L1]), 0, 1, np.concatenate([masks, 1-masks]), kde_s, f_kl)
bound_fast = optimize_fast(single_mi, Lt)
# approximat... | Python | 1 |
{
if let Some(x) = self.x.intersect(&other.x) {
if let Some(y) = self.y.intersect(&other.y) {
if let Some(z) = self.z.intersect(&other.z) {
return Some(Cuboid {
on: true,
x,
y,
... | Rust | 0 |
is inspired from its renown painting [The Persistence of Memory](https://en.wikipedia.org/wiki/The_Persistence_of_Memory).
## Features
- **Pressure resolution:** DFSPH and IISPH.
- **Viscosity:** DFSPH viscosity, Artificial viscosity, and XSPH viscosity.
- **Surface tension:** WCSPH surface tension, and methods from ... | Rust | 0 |
let sleep_impl = conf.sleep_impl.clone();
let mut builder = aws_smithy_client::Builder::dyn_https()
.middleware(crate::middleware::DefaultMiddleware::new());
builder.set_retry_config(retry_config.into());
builder.set_timeout_config(timeout_config);
// the builder main... | Rust | 0 |
_RESOURCE {
DMA_Header: DMA_DES,
DMA_Data: [DMA_RANGE; ::ANYSIZE_ARRAY],
}}
pub type PDMA_RESOURCE = *mut DMA_RESOURCE;
pub const mIRQD_Share: ::ULONG = 0x1;
pub const fIRQD_Exclusive: ::ULONG = 0x0;
pub const fIRQD_Share: ::ULONG = 0x1;
pub const fIRQD_Share_Bit: ::ULONG = 0;
pub const fIRQD_Level_Bit: ::ULONG... | Rust | 0 |
word)
else:
# 如果单词不再缓存中,查询单词释义
word_meaning,word_freq = self.__get_word_freq(new_word)
# 存入缓存字典
cached_words[new_word] = {"meaning":word_meaning,"freq":word_freq}
... | Python | 1 |
"""
Écrire un programme en Python qui calcule les nombres de Fibonacci jusqu'à 50.
"""
a, b = 0, 1
print("Nombres de Fibonacci jusqu'à 50 : ")
while a <= 50:
print(a)
a, b = b, a + b | Python | 1 |
, PartialEq, Eq)]
pub enum ImportRule {
NsAs(Arc<str>), // ns
NsReferDef(Arc<str>, Arc<str>), // ns, def
NsDefault(Arc<str>), // ns, js only
}
// scope
pub type CalcitScope = rpds::HashTrieMapSync<Arc<str>, Calcit>;
pub type CalcitItems = TernaryTreeList<Calcit>;
/// special types wra... | Rust | 0 |
::Error) -> Error {
Error::Sengaka(e)
}
}
impl From<Box<StdError>> for Error {
fn from(e: Box<StdError>) -> Error {
Error::Misc(e)
}
}
impl From<io::IOIteratorError> for Error {
fn from(e: io::IOIteratorError) -> Self {
match e {
io::IOIteratorError::IO(err) => Erro... | Rust | 0 |
idxs, shells = gto_spec_from_pyscf(mol_py, max_n_gaussians=max_n_gaussians)
mo_coeff = jnp.asarray(coeff)
ao_overlap = jnp.asarray(overlap)
mo_coeff *= jnp.sqrt(jnp.diag(ao_overlap))[:, None]
conf_up, conf_down = [jnp.arange(n_el) for n_el in (mol.n_up, mol.n_down)]
... | Python | 1 |
orner_y = [1/4*img_width, 3/4*img_height]
#text_region是由4个列表组成,每个列表是一个顶点的坐标
text_top_left_x, text_top_left_y = text_region[0]
text_top_right_x, text_top_right_y = text_region[1]
text_bottom_right_x, text_bottom_right_y = text_region[2]
text_bottom_left_x, text_bottom_left_y = te... | Python | 1 |
"""Hooked Transformer Layer Norm Pre Component.
This module contains all the component :class:`LayerNormPre`.
"""
from typing import Dict, Union
import torch
import torch.nn as nn
from jaxtyping import Float
from transformer_lens.hook_points import HookPoint
from transformer_lens.HookedTransformerConfig import Hooke... | Python | 1 |
8 != 0
}
}
#[doc = "Reader of field `AXBS_P_M1_HIGH_PRIORITY`"]
pub type AXBS_P_M1_HIGH_PRIORITY_R = crate::R<bool, AXBS_P_M1_HIGH_PRIORITY_A>;
impl AXBS_P_M1_HIGH_PRIORITY_R {
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> AXBS_P_M1_HIGH_PRIORITY_A {
match ... | Rust | 0 |
azimuth_up_in = v_up.azimuth
polar_up_in = v_up.polar
azimuth_down_in = v_down.azimuth
polar_down_in = v_down.polar
sp_up = StereographicProjection()
sp_down = StereographicProjection(pole=1)
x_up, y_up = sp_up.spherical2xy(azimuth_up_in, polar_up_in)
x_down, y_... | Python | 1 |
# Copyright 2018 Google LLC
#
# 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 law or agreed to in writing, ... | Python | 1 |
import pytest
import sys
import numpy as np
import cloudvolume
# Basic test of sharded meshes
# The following test files are used from https://storage.googleapis.com:
# /neuroglancer-janelia-flyem-hemibrain/v1.0/segmentation/info
# /fafb-ffn1-20190805/segmentation/mesh/info
# /neuroglancer-janelia-flyem-hemib... | Python | 1 |
g(env, b.as_mut_ptr());
assert_eq!(status, napi::Status::Ok);
b.assume_init()
}
pub unsafe fn catch_error(env: Env, error: *mut Local) -> bool {
if !is_throwing(env) {
return false;
}
let status = napi::get_and_clear_last_exception(env, error);
assert_eq!(status, napi::Status::Ok);
... | Rust | 0 |
`rust,no_run
/// # let opcode = 0i16;
/// # let my_server_ip = "192.168.0.1";
/// # let my_server_port = 8080u16;
/// # use rusty_raft::rpc::client::Rpc;
/// let mut rpc = Rpc::new(opcode);
/// {
/// // We need to scope the creation of the parameters here
/// // because the parameter builder borrows a mutable r... | Rust | 0 |
#[test]
fn sign_and_verify_eddsa_jwt() -> Result<()> {
let input = b"abcde12345";
let alg = EddsaJwsAlgorithm::Eddsa;
let private_key = load_file("jwk/OKP_Ed25519_private.jwk")?;
let public_key = load_file("jwk/OKP_Ed25519_private.jwk")?;
let signer = alg.signer_from_j... | Rust | 0 |
"""The NFAndroidTV integration."""
from notifications_android_tv.notifications import ConnectError, Notifications
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_HOST, Platform
from homeassistant.core import HomeAssistant
from homeassistant.exceptions import ConfigEntryNotRead... | Python | 1 |
"""
Tests for the Balance command with hierarchy and total options combined.
Specifically tests the fix for double-counting issue.
"""
from tests.test_utils import run_bal_command, extract_table_data
def test_bal_with_hierarchy_and_total_no_double_counting():
"""Test that using --hierarchy and --total together d... | Python | 1 |
from django.utils.deprecation import MiddlewareMixin
class NoCacheMiddleware(MiddlewareMixin):
def process_response(self, request, response):
response['Cache-Control'] = 'no-cache, no-store, must-revalidate'
response['Pragma'] = 'no-cache'
response['Expires'] = '0'
return response | Python | 1 |
import unittest
import torch
from sglang.srt.utils import DynamicGradMode
from sglang.test.test_utils import CustomTestCase
class TestDynamicGradMode(CustomTestCase):
def test_inference(self):
# Test inference_mode
DynamicGradMode.set_inference_mode(True)
@DynamicGradMode()
def ... | Python | 1 |
y = (
mix_stft[..., None]
* (
targets_spectrograms
/ (
eps
+ torch.sum(targets_spectrograms, dim=-1, keepdim=True).to(
mix_stft.dtype
)
)
)[..., No... | Python | 1 |
#[test]
fn test_x64_ret_after_jne() {
let bin_ret_post_jmp = common::get_raw_bin("bin_ret_post_jmp", common::RET_AFTER_JNE_X64);
let bins = vec![bin_ret_post_jmp];
let gadgets =
xgadget::find_gadgets(&bins, common::MAX_LEN, xgadget::SearchConfig::DEFAULT).unwrap();
let gadget_strs = common::get_... | Rust | 0 |
\x87\xa1\x0c,,\x10=_\xe8\x04\xf3w\xc3f\xaa\xfc\
G\x08\x03\x8c[\x9c\xac\x11\xaa\xa7\xef^\xf9\xc2\xe4q\
\xcc\xab\x18\x10j\xd26$3\x84^\xb84\xdb\xc9\xa6\
\x7f\xdcH\x06\x85\x052y\xd5\xa6)\xe5\xbe\xca\x1a\x00\
BU\x8dF&\xa1\xc6\x92\xcf\x00\x83>R2\xd3\xf7\
\xca@\xd6s\xb6\xf7sk\xbe\x0c,\x22:\xa7\x98I\
\xcb)\x04\x08\x04$,\x90\x... | Python | 1 |
"^\sM."#], &["{print $2}"])
.unwrap_or_default();
let stage = git_status_files(
&["status", "--porcelain", "--untracked-files=all"],
&[r#"^[A|M|D|R]"#],
&["{print $2}"],
)
.unwrap_or_default();
filter_git_dirty_stage(dirty, stage)
}
/// Command exec git current branch
f... | Rust | 0 |
executable rather than a simple version string.
# We can then execute this program to obtain any info we need, such
# as the real sys.version string for the build.
cur_version = get_python_version()
# If the target version is *later* than us, then we assume they
# use what we u... | Python | 1 |
feature_without_bands = {
"type": "Feature",
"id": "ABC123",
"collection": "y",
"geometry": {
"type": "Polygon",
"coordinates": [
[
[-48.3106, -15.3637],
[-48.3106, -16.4178],
[-47.2492, -16.4178],
[-47.2492, -15... | Python | 1 |
度来确定连接的向前或向后
let new_depth = (self.neurons[self.get_element_pos(from)].split_y
+ self.neurons[self.get_element_pos(to)].split_y)
/ 2.0;
let new_width = (self.neurons[self.get_element_pos(from)].split_x
+ self.neurons[self.get_element_pos(to)].split_x)
/ 2.... | Rust | 0 |
T: 'a;
impl<'a, T> Drop for Wrapper<'a, T>
where
T: 'static,
//~^ error: `Drop` impl requires `T: 'static` but the struct it is implemented for does not
{
fn drop(&mut self) {}
}
fn main() {}
use crate::{polygon, CoordNum, Coordinate, Line, Polygon};
/// A bounded 2D area whose three vertices are def... | Rust | 0 |
u32) -> Option<HpetTimer> {
if index >= self.timer_count {
return None;
}
let mmio_base_address = self.inner as usize;
let timer_address = mmio_base_address + 0x100 + (0x20 * index) as usize;
Some(HpetTimer::new(timer_address as *mut HpetTimerRegister))
}
}
ass... | Rust | 0 |
For example, you might want to customize mouse wheel line scrolling amount:
//!
//! ```rust,no_run
//! # use imgui::ImGui;
//! # use winit::{EventsLoop, Event, WindowEvent, MouseScrollDelta, TouchPhase};
//! # fn main() {
//! # let mut events_loop = EventsLoop::new();
//! # let mut imgui = ImGui::init();
//! # let win... | Rust | 0 |
source code is governed by a BSD-style license that can be
// found in the LICENSE file.
use super::ping_tracker::Pong;
use crate::labels::NodeId;
use anyhow::{format_err, Error};
use byteorder::{ReadBytesExt, WriteBytesExt};
use rand::Rng;
/// Labels where a packet is going to
#[derive(Debug, Clone, Copy, PartialEq... | Rust | 0 |
esco dal ciclo for più interno e ritorno nel ciclo for esterno.
# Quando torno nel ciclo for più esterno, ho stampato in output tutta una riga r.
# per una corretta formattazione della matrice (pensata come una tabella), alla fine di ogni riga devo andare a capo
# quindi,
pri... | Python | 1 |
() {
let mut buffer = String::new();
let mut b_table_defs = Table::<BTableDefs>::default();
b_table_defs
.write_select(&mut buffer, SelectOrderBy::Ascending, SelectLimit::All, &mut |_| Ok(()))
.unwrap();
assert_eq!(
&buffer,
r#"SELECT "b0".id AS b0__id,"b0".name AS b0__name,"a1".id AS a1__id,"a1... | Rust | 0 |
# -*- coding: utf-8 -*-
# Copyright (C) 2012-2018 Red Hat, Inc.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions of
# the GNU General Public License v.2, or (at your option) any later version.
# This program is distributed ... | Python | 1 |
closure() {
let example_closure = |x| x;
let s = example_closure(String::from("hello"));
// The first time we call "example_closure" with the "String" value, the compiler infers
// the type of "x" and the return type of the closure to be "String". Those types are then
// locked in to the closure i... | Rust | 0 |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
#
# generated by wxGlade
#
import wx
# begin wxGlade: dependencies
# end wxGlade
# begin wxGlade: extracode
# end wxGlade
class MyFrame(wx.Frame):
def __init__(self, *args, **kwds):
# begin wxGlade: MyFrame.__init__
kwds["style"] = kwds.get("style",... | Python | 1 |
role": "user", "content": content}],
functions=[function],
function_call={"name": "match_keywords"},
)
args_str = r.choices[0].message.function_call.arguments
args = json.loads(args_str)
prediction = args['prediction']
if isinstance(prediction, str):
prediction = prediction.s... | Python | 1 |
pub fn execute_stsliceconst(engine: &mut Engine) -> Failure {
engine.load_instruction(
Instruction::new("STSLICECONST").set_opts(InstructionOptions::Bitstring(9, 2, 3, 0))
)
.and_then(|ctx| fetch_stack(ctx, 1))
.and_then(|ctx| {
let mut builder = ctx.engine.cmd.var_mut(0).as_builder_mut(... | Rust | 0 |
from pathlib import Path
from .api_setup import setup_apikeys
from .process import markdrop, MarkDropConfig, add_downloadable_tables, logging
from .parse import process_markdown, ProcessorConfig, AIProvider, logger
from .utils import extract_images, make_markdown, extract_tables_from_pdf
from .models.img_descriptions ... | Python | 1 |
),
r,
uncommitted(100, TimeStamp::zero(), false),
);
must_large_txn_locked(&engine, k, ts(300, 0), 100, TimeStamp::zero(), false);
must_rollback(&engine, k, ts(300, 0));
must_prewrite_put_for_large_txn(&engine, k, v, k, ts(310, 0), 100, 0);
must_large_txn... | Rust | 0 |
index = 0
print('testing:')
from random import randint as rn
duur = rn(2,3)
import time as __time__
duur = duur / 100
def chek(a):
b = __time__.time()
c = b - a
return c
def loading(duur):
a = __time__.time()
while chek(a) < duur:
print('|', end='')
... | Python | 1 |
IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
... | Rust | 0 |
a = int(input())
i=2
while i<=a:
if a%i == 0:
print(i)
break
i+=1 | Python | 1 |
"c")));
/// let (i, r) = take_text2dest_label2dest(i).unwrap();
/// assert_eq!(r, (Cow::from("d"), Cow::from("e"), Cow::from("")));
/// let (i, r) = take_text2dest_label2dest(i).unwrap();
/// assert_eq!(r, (Cow::from("f"), Cow::from("g"), Cow::from("h")));
/// let (i, r) = take_text2dest_label2dest(i).unwrap();
/// ass... | Rust | 0 |
nova conversa na barra lateral.")
def process_question(question, history):
return chatbot_interaction(question, history, documents, embeddings, llm)
if question := st.chat_input("Qual é a sua dúvida hoje?"):
question = question.strip().lower()
if question and is_valid_input(question):
if current_... | Python | 1 |
utine_create({name}_entry, &s);
return bdrv_poll_co(&s.poll_state);
}}
}}"""
def gen_wrappers(input_code: str) -> str:
res = ''
for func in func_decl_iter(input_code):
res += '\n\n\n'
res += gen_wrapper(func)
return res
if __name__ == '__main__':
if len(sys.argv) < 3:
... | Python | 1 |
dead_code)]
pub mod colors {
use super::Color;
pub const LIGHTGRAY: Color = Color([200, 200, 200, 255]);
pub const GRAY: Color = Color([130, 130, 130, 255]);
pub const DARKGRAY: Color = Color([80, 80, 80, 255]);
pub const YELLOW: Color = Color([253, 249, 0, 255]);
pub const GOLD: Color = Color([... | Rust | 0 |
use super::*;
#sub_messages
#sub_enums
}
}
} else {
quote! {}
};
Ok(quote! {
#main_struct
#encode_impl
#decode_impl
#sub_mod
})
}
fn gen_enum(e: &Enumeration) -> syn::Result<proc_macro2::TokenS... | Rust | 0 |
opaque_win32: false,
opaque_win32_kmt: false,
d3d12_fence: false,
sync_fd: false,
}
}
/// Builds an `ExternalSemaphoreHandleType` for a posix file descriptor.
///
/// # Example
///
/// ```rust
/// use vulkano::sync::ExternalSemaphoreHand... | Rust | 0 |
)> {
winit::platform::windows::EventLoopExtWindows::new_any_thread()
}
#[cfg(target_arch = "wasm32")]
pub fn new_event_loop() -> EventLoop<()> {
unimplemented!("multi-threaded event loop in wasm32 is not supported yet")
}
use serde::{
de::{DeserializeOwned, Deserializer},
ser::{SerializeSeq, Serializer... | Rust | 0 |
from typing import Optional
# Time: O(n)
# Space: O(n)
# 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 hasPathSum(self, root: Optional[TreeNode], targ... | Python | 1 |
#!/usr/bin/python3
# Copyright © 2020 Christian Gmeiner
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify,... | Python | 1 |
] extern crate lazy_static;
extern crate ndarray;
extern crate regex;
use std::{cmp, env, fs, mem};
use std::io::{self, BufRead, Write};
use std::str::FromStr;
use std::collections::{BTreeSet, BTreeMap, HashMap};
use regex::Regex;
/// All extractable data from a single micro-benchmark.
#[derive(Clone, Debug)]
pub str... | Rust | 0 |
doc = YDoc()
/// local_sv = encode_state_vector(local_doc)
///
/// # document on machine B
/// remote_doc = YDoc()
/// remote_delta = encode_state_as_update(remote_doc, local_sv)
///
/// apply_update(local_doc, remote_delta)
/// ```
#[pyfunction]
pub fn encode_state_vector(doc: &mut YDoc) -> Vec<u8> {
doc.begin_tra... | Rust | 0 |
rketRole.type",
"type": "Element",
"required": True,
}
)
created_date_time: str = field(
metadata={
"name": "createdDateTime",
"type": "Element",
"required": True,
"pattern": r"((([0-9]{4})[\-](0[13578]|1[02])[\-](0[1-9]|[12... | Python | 1 |
sult<bool>;
fn packed_value(&self) -> &[u8];
fn ord(&self) -> i64;
fn doc_id(&self) -> DocId;
fn mark_ords(&mut self, count: i64, ord_bit_set: &mut LongBitSet) -> Result<()> {
for _ in 0..count {
let result = self.next()?;
if !result {
bail!(IllegalState("... | Rust | 0 |
# event/__init__.py
# Copyright (C) 2005-2025 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: https://www.opensource.org/licenses/mit-license.php
from __future__ import annotations
from .api import CANCEL as CANCEL
from .api i... | Python | 1 |
udit'
rf2i9rkrcjg &= tiuxh2ltn7t
assert 0, n4ksn2xvlpz
raise None
r3zsnvvp_k2
def xfxu2q278t8(as3lzgsw1fh: hn1czsjhtx5, ujqp_tkd96b, qc59x5soxmi, ls4_1nup5mx: vrq7w90iuwa, vol3yr7prip, e5ktzjxx7m5: wf_tzas4dbw, ros8amql07d: d_fgih3s0sl):
"""# alloys_kites_grasp -> compressors_recruit_audit"""
re... | Python | 1 |
]
self.assertRaises(
gce.ExceededAttributeCountError, gce.GCE,
policy.ParsePolicy(
GOOD_HEADER_MAX_ATTRIBUTE_COUNT + GOOD_TERM + DEFAULT_DENY,
self.naming), EXP_INFO)
def testMaxAttribute(self):
self.naming.GetNetAddr.return_value = [nacaddr.IP('10.2.3.4/32')]
pol ... | Python | 1 |
ENT_MASK_BUTTON_RELEASE | xcb::EVENT_MASK_POINTER_MOTION) as u16,
xcb::GRAB_MODE_ASYNC as u8,
xcb::GRAB_MODE_ASYNC as u8,
default_root_window,
xcb::NONE,
xcb::BUTTON_INDEX_3 as u8,
xcb::MOD_MASK_1 as u16,
);
// flush to ensure grab requests are honored
conn.f... | Rust | 0 |
in cvpods's standard format
output_file: path of json file that will be saved to
allow_cached: if json file is already present then skip conversion
"""
# TODO: The dataset or the conversion script *may* change,
# a checksum would be useful for validating the cached data
ensure_dir(os.... | Python | 1 |
}
}
}
#[wasm_bindgen]
pub struct Universe {
phys: PhysicsSpace<f64, EuclideanSpace<f64>>,
}
#[wasm_bindgen]
impl Universe {
pub fn new() -> Universe {
//let mut rng = rand::thread_rng();
let mut rng = OsRng::new().unwrap();;
let mut elems = Vec::new();
let speed_range = 2.... | Rust | 0 |
s_result == 1 {
return "Advantage player1".to_owned();
} else if minus_result == -1i8 {
return "Advantage player2".to_owned();
} else if minus_result >= 2 {
return "Win for player1".to_owned();
}
... | Rust | 0 |
from sudoku_validator import validate_sudoku
def test_valid_sudoku():
board = [
[5,3,4,6,7,8,9,1,2],
[6,7,2,1,9,5,3,4,8],
[1,9,8,3,4,2,5,6,7],
[8,5,9,7,6,1,4,2,3],
[4,2,6,8,5,3,7,9,1],
[7,1,3,9,2,4,8,5,6],
[9,6,1,5,3,7,2,8,4],
[2,8,7,4,1,9,6,3,5],
... | Python | 1 |
o', 'DECIMAL(5,2)'),
('foreign_holding_shares', 'BIGINT'),
('broker_id', 'VARCHAR(10)'),
('broker_name', 'VARCHAR(100)'),
('buy_amount', 'DECIMAL(15,2)'),
('sell_amount', 'DECIMAL(15,2)'),
('net_amount', 'DECIMAL(15,2)')
... | Python | 1 |
momentum bajista
elif williams_r < -65:
williams_r_score = 25 # Momentum bajista
else:
williams_r_score = 50
scores['williams_r'] = williams_r_score
# 17. Money Flow Index (14 períodos) - Flujo de dinero
mfi = CoreProbabilisticPredictor3m.safe_f... | Python | 1 |
"""Faca umam funcao que receba a altura e o raio de um cilindro circular e retorne
o volume do cilindro. O volume de um cilindro circular e calculado por meio da
seguinte formula: V = π ∗ raio2 ∗ altura, onde π = 3.141592."""
def cilindo():
try:
pi = 3.141592
altura = float(input("digite a altura ... | Python | 1 |
#!/usr/bin/env python
# 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
# "Li... | Python | 1 |
00, 0x00, 0x00, 0x00, 0x00,
/// 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x01, 0x00,
/// 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/// 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/// ];
///
/// let symtab: Symtab<'_, LittleEndian, Elf64> =
/// Symtab::try_from(&SYMTAB[0..]).unwrap();
/// let sym = ... | Rust | 0 |
ics_Dxgi'*"]
pub const DXGI_ERROR_REMOTE_CLIENT_DISCONNECTED: ::windows_sys::core::HRESULT = -2005270493i32;
#[doc = "*Required features: 'Win32_Graphics_Dxgi'*"]
pub const DXGI_ERROR_REMOTE_OUTOFMEMORY: ::windows_sys::core::HRESULT = -2005270492i32;
#[doc = "*Required features: 'Win32_Graphics_Dxgi'*"]
pub const DXGI_... | Rust | 0 |
expect("Could not lock FFDS.");
ffds.remove(&(fd as u32));
}
#[no_mangle]
pub extern "C" fn __angora_io_remove_pfile(pfile: *mut libc::FILE) {
let fd = unsafe { libc::fileno(pfile) };
__angora_io_remove_fd(fd);
}
#[no_mangle]
pub extern "C" fn __angora_io_find_fd(fd: libc::c_int) -> u32 {
let ffds = F... | Rust | 0 |
import aiohttp
import feedparser
import ssl
# NOTE: Add RSS feeds and their sources here for crawling {source: feed_url}
RSS_FEEDS = {
"Canadian Mortgage Trends": "https://www.canadianmortgagetrends.com/feed/", # works
# "Government of Canada: Finance": "https://api.io.canada.ca/io-server/gc/news/en/v2?dept=d... | Python | 1 |
xt, images or an own provided embedding
if conditional_embeddings is None:
conditional_embeddings = self.get_conditional_embeddings(
batch_size=pixel_values.shape[0],
input_ids=input_ids,
attention_mask=attention_mask,
position_ids=posi... | Python | 1 |
x12\x04\
\xce\x01\x10\x11b\x06proto3\
";
/// `FileDescriptorProto` object which was a source for this generated file
pub fn file_descriptor_proto() -> &'static crate::descriptor::FileDescriptorProto {
static file_descriptor_proto_lazy: crate::rt::Lazy<crate::descriptor::FileDescriptorProto> = crate::rt::Lazy::... | Rust | 0 |
from .common import InfoExtractor
from ..utils import (
ExtractorError,
parse_duration,
)
class MojvideoIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?mojvideo\.com/video-(?P<display_id>[^/]+)/(?P<id>[a-f0-9]+)'
_TEST = {
'url': 'http://www.mojvideo.com/video-v-avtu-pred-mano-rdecelaska-... | Python | 1 |
crap", "spars", "toads",
"venom", "gizmo", "panic", "remix", "smogs", "humid",
]
.iter()
.map(|s| s.to_string())
.collect::<Vec<String>>();
// let wv = WordPool::new();
// let words = wv.read_pool().unwrap();
let universe = universe::Universe::new(5,... | Rust | 0 |
let mut y: f32 = frag_coord.y / 2.0;
if self.inputs.resolution.y >= 640.0 {
x /= 2.0;
y /= 2.0;
}
if self.inputs.resolution.y < 200.0 {
x *= 2.0;
y *= 2.0;
}
vec2(x, y)
}
fn get_level_bounds(&self) -> Vec2 {
... | Rust | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.