text
string
label_name
string
labels
int64
pub async fn create_game(title: &String) -> Result<GameInfo, Box<dyn Error>> { mongo_db::create_game(title).await } pub async fn update_game(id: &Uuid, command: &UpdateGameCommand) -> Result<(), Box<dyn Error>> { mongo_db::update_game(id, command).await } pub async fn get_game_info(id: Uuid) -> Result<GameInf...
Rust
0
AX".to_owned(), 32); let args = vec![eax.clone()]; let mut io_sets = vec![]; for &(res, dep) in &[(0x10, 0x11), (0xfff000, 0xfff001), (0x1001, 0x1002), (0xffff, 0x10000), (0xffFF_ffFFu32, 0x0)] { let mut io_name = Hash...
Rust
0
if value == HNil::new() { continue; } *HObject::lookup_property(heap, obj, HNumber::to_ptr(i as _), true) = value; } } else { for i in 0..original_size { let key = *(*map).get_slot_address(i); if key == HNil::new() { ...
Rust
0
expect("Failed to read the source file."); let res = pipeline::run_program(&source_file, pipeline::Backend::Term); println!("{:?}", res) } fn run_wasm_file() { let source_file = fs::read_to_string("wasm_prog.siml").expect("Failed to read the source file."); let res = pipeline::run_program(&sour...
Rust
0
=> cx_curve_e_CX_CURVE_Ed25519, Curve::Ed448 => cx_curve_e_CX_CURVE_Ed448, Curve::Curve25519 => cx_curve_e_CX_CURVE_Curve25519, Curve::Curve448 => cx_curve_e_CX_CURVE_Ed448, }; n as u8 } } impl Curve { pub fn is_weirstrass(&self) -> bool { match self ...
Rust
0
a d@sXddlZddlmZmZeZejddddeZejrJe en e edS)N)contentswherez-cz --contents store_true)action) argparsecertifirrArgumentParserparser add_argument parse_argsargsprintrre/home/tom/ab/renpy-build-fix/tmp/install....
Python
1
nwrap_or(OsStr::new("")).to_str().unwrap_or("") } <gh_stars>1-10 #![deny(warnings)] #![warn(unused_extern_crates)] #[macro_export] macro_rules! some_or { ($e:expr, $b:block) => { if let Some(x) = $e { x } else { $b } }; } #[macro_export] macro_rules! ok_or { ...
Rust
0
; use std::f64::consts::PI; const SIZE: usize = 100; const ALTITUDE_LIMIT: Scalar = 200.0; const HUMIDITY_LIMIT: Scalar = 0.25; const TEMPERATURE_LIMIT: Scalar = 100.0; const WATER_LIMIT: Scalar = 30.0; const VELOCITY_LIMIT: Scalar = 1.0; const DIVERGENCE_LIMIT: Scalar = 1.0; const PRESSURE_LIMIT: Scalar = 1.0; const ...
Rust
0
let valid = public_key.verify(&MESSAGE.trits(), &signature).unwrap(); assert!(valid); } } } // #[test] // fn wots_kerl_complete_test() { // wots_generic_complete_test::<Kerl>(); // } #[test] fn wots_curl27_complete_test() { wots_generic_...
Rust
0
from ed25519_blake2b import BadSignatureError __all__ = ( "InvalidBlock", "InvalidWork", "InvalidDifficulty", "InvalidMultiplier", "InvalidSignature", "InvalidBlockHash", "InvalidBalance", "InvalidSeed", "InvalidAccount", "InvalidPrivateKey", "InvalidPublicKey" ) class InvalidBlock(ValueError): """T...
Python
1
new(); let inputs: Vec<_> = inputs.into_iter().map(|input| input.unwrap()).collect(); let mut input_gadgets = Vec::new(); { let mut cs = cs.ns(|| "Allocate Input"); for (i, input) in inputs.into_iter().enumerate() { let mut input_...
Rust
0
); *consumed_ptr = (*consumed_ptr + adj) - i64::max_value(); } } } } unsafe impl TrapInfo for Store { fn as_any(&self) -> &dyn Any { self } fn is_wasm_trap(&self, addr: usize) -> bool { self.frame_info().borrow().lookup_trap_info(addr).is_some() ...
Rust
0
else { let d = [ (c1[0] as i16 - c0[0] as i16).max(-4).min(3), (c1[1] as i16 - c0[1] as i16).max(-4).min(3), (c1[2] as i16 - c0[2] as i16).max(-4).min(3), ]; writer.write_u8(8, c0[0] << 3 | (d[0] & 0b111) as u8); writer.write_u8(8, c0[1] << 3 | (d[1] ...
Rust
0
buffer /// /// Returns the number of bytes written to the buffer. /// /// # Panics /// /// Panics, if the buffer is less than 2 bytes long. If you believe that /// this behavior is inappropriate, please leave your feedback on the /// [issue tracker]. /// /// # Example /// ...
Rust
0
ercase(); match s.as_str() { "auto" => Ok(ColorOpt::Auto), "never" => Ok(ColorOpt::Never), "always" => Ok(ColorOpt::Always), _ => Err(format!("expected auto/never/always, found: {}", s)), } } } pub fn run(options: &Options) -> Result<()> { crate::...
Rust
0
from fastapi import FastAPI, HTTPException, Depends, Request from fastapi.responses import JSONResponse from fastapi_jwt_auth import AuthJWT from fastapi_jwt_auth.exceptions import AuthJWTException from pydantic import BaseModel """ Note: This is just a basic example how to enable cookies. This is vulnerable to CSRF a...
Python
1
""" Python module graphics.py for drawing basic shapes. Author: Joshua A. Marshall <joshua.marshall@queensu.ca> GitHub: https://github.com/botprof/agv-examples """ import numpy as np """SHAPE FUNCTIONS""" def draw_circle(x, y, radius, increment=10): """Finds points that approximate a circle as a regular polygon...
Python
1
), T::new(47), T::new(48), T::new(49)], [T::new(50), T::new(51), T::new(52), T::new(53), T::new(54), T::new(55), T::new(56), T::new(57), T::new(58), T::new(59)], [T::new(60), T::new(61), T::new(62), T::new(63), T::new(64), T::new(65), T::new(66), T::new(67), T::new(68), T::new(69)], [T::new(70),...
Rust
0
pub struct MultiByteChar { /// The absolute offset of the character in the CodeMap pub pos: u32, /// The number of bytes, >=2 pub bytes: usize, } /// Identifies an offset of a non-narrow character in a FileMap #[derive(Copy, Clone, Eq, PartialEq, Debug)] pub enum NonNarrowChar { /// Represents a z...
Rust
0
nt('-r','--remove_columns', \ help="Path to single-column file (no header) containing the names of the columns in SQ3's classification.txt file that are to be excluded during random forest training (optional).") ml.add_argument('-z', '--max_class_size', type=int , default=3000, \ ...
Python
1
k_name = "PyPy_OptimizeFlag")] pub static mut Py_OptimizeFlag: c_int; #[cfg_attr(PyPy, link_name = "PyPy_NoSiteFlag")] pub static mut Py_NoSiteFlag: c_int; #[cfg_attr(PyPy, link_name = "PyPy_BytesWarningFlag")] pub static mut Py_BytesWarningFlag: c_int; #[cfg_attr(PyPy, link_name = "PyPy_UseClas...
Rust
0
("127.0.0.1:{}", 123); Status::save_local_config( &mut status, "meta".parse().unwrap(), "meta_1.yaml".to_string(), &meta_config, ) .unwrap(); let mut query_config = LocalQueryConfig { config: QueryConfig::default(), ...
Rust
0
.next().is_none()); } #[test] fn walk_root() { let paths: Vec<_> = WalkDir::new("/") .max_depth(1) .sort(true) .into_iter() .filter_map(|each| Some(each.ok()?.path())) .collect(); assert!(paths.first().unwrap().to_str().unwrap() == "/"); } use crate::lru::raw::EntryNode;...
Rust
0
aw iteration for 100,000,000 times: "); block_on_future(run_program(raw_iter_program, vec![])); eprintln!("do FFI call for 100,000,000 times: "); block_on_future(run_program(program, vec![])); eprintln!("do FFI call for 10,000 * 10,000 times: "); block_on_future(run_program(program2, vec![])); } co...
Rust
0
properties # ---------------------------------- _v = arg.pop("end", None) _v = end if end is not None else _v if _v is not None: self["end"] = _v _v = arg.pop("size", None) _v = size if size is not None else _v if _v is not None: self["size...
Python
1
import os import argparse import asyncio from dotenv import load_dotenv from main import AiogramLlmBot # Default configuration file path DEFAULT_CONFIG_FILE_PATH = "configs/app_config.json" def run_server(token: str, config_file_path: str = DEFAULT_CONFIG_FILE_PATH): """ Run the Telegram bot server. Arg...
Python
1
# -*- coding: utf-8 -*- import os, sys, json, warnings import pandas as pd from typing import List # -------- 导入兜底:从根目录或 src 执行都能找到模块 -------- _CUR = os.path.abspath(os.path.dirname(__file__)) _PARENT = os.path.abspath(os.path.join(_CUR, "..")) if _PARENT not in sys.path: sys.path.insert(0, _PARENT) if _CUR not in...
Python
1
-would-be-attacker-9023180f6fb type XcmExecuteFilter = Nothing; type XcmExecutor = XcmExecutor<XcmConfig>; type XcmTeleportFilter = Everything; type XcmReserveTransferFilter = Everything; type LocationInverter = LocationInverter<Ancestry>; type Weigher = FixedWeightBounds<BaseXcmWeight, Call, MaxInstructions>; t...
Rust
0
-two case in to_base. This allows the compiler to unroll the inner // loop in the conversion, which is a sigificant speed increase. if base == 10 { base_impl!(Limb(10), s, rp, sz, nn); } else { base_impl!(base, s, rp, sz, nn); } let mut l = sz; // Output any leading zeros we ma...
Rust
0
elf.second_plot_widget) self.current_original_signal.plot_difference(self.third_plot_widget) print(f"sampling freq: {self.current_original_signal.sampling_frequency}") def clear_plots(self): self.first_plot_widget.clear() self.second_plot_widget.clear() self.third_plot_widg...
Python
1
cription="Flash AI Ops Toy", url="https://github.com/duanyzhi/flash-ops.git", author="duanyzhi", packages=find_packages(exclude=("release")), install_requires=[ 'torch==2.6.0', ], ext_modules = ext_modules, cmdclass={ 'build_ext': BuildExtension }, include_package_dat...
Python
1
"""Kerberos Source test utils""" import os from copy import deepcopy from time import sleep from k5test import realm from rest_framework.test import APITestCase class KerberosTestCase(APITestCase): """Kerberos Test Case""" @classmethod def setUpClass(cls): cls.realm = realm.K5Realm(start_kadmin...
Python
1
:new(CronDatePart::Hours, values); assert_eq!(true, test_object.is_match(&Utc::now())); } #[test] fn doesnt_match_when_no_values_match() { let values = vec![CronValue::Single(99)]; let test_object = CronField::new(CronDatePart::Hours, values); assert_eq!(false, test_object...
Rust
0
import sys def solve(): A = input().strip() B = input().strip() n = len(A) m = len(B) dp = [[[0 for _ in range(n+1)] for _ in range(m+1)] for _ in range(n+1)] max_similarities = 0 for i in range(1, n+1): for j in range(1, m+1): if A[i-1] == B[j-1]: dp...
Python
1
import numpy as np def myTradingSystem(DATE, OPEN, HIGH, LOW, CLOSE, VOL, OI, P, R, RINFO, exposure, equity, settings): def bollingerBands(a, n=20): sma = np.nansum(a[-n:]) / n std = np.std(a[-n:], ddof=1) return sma, sma + 2 * std, sma - 2 * std nMarkets = len(settings['markets']) ...
Python
1
sync::atomic::Ordering; //! static DELTA_TIME: AtomicF32 = AtomicF32::new(1.0); //! //! // In some main simulation loop: //! # fn compute_delta_time() -> f32 { 1.0 / 60.0 } //! DELTA_TIME.store(compute_delta_time(), Ordering::Release); //! //! // elsewhere, perhaps on other threads: //! let dt = DELTA_TIME.load(Orderin...
Rust
0
er_context().is_training: return None # this is the tower function, could be called for inference if isinstance(ret, tf.Tensor): # the preferred way assert ret.shape.ndims == 0, "Cost must be a scalar, but found a tensor of shape {}!".format(ret.shape) _check_unused_regu...
Python
1
lder"], hyperparams_to_save=hparams_file, overrides=overrides, ) # Tensorboard logging if hparams["use_tensorboard"]: from speechbrain.utils.train_logger import TensorboardLogger hparams["tensorboard_train_logger"] = TensorboardLogger( hparams["tensorboard_logs_...
Python
1
::call_site()) }; let opt = if let Some(_) = arg.optional { syn::Ident::new("true", Span::call_site()) } else if let Some(_) = spec.default_value(&arg.name) { syn::Ident::new("true", Span::call_site()) } else { syn::Ident::...
Rust
0
= 5, GGPO_ERRORCODE_NOT_SYNCHRONIZED = 6, GGPO_ERRORCODE_IN_ROLLBACK = 7, GGPO_ERRORCODE_INPUT_DROPPED = 8, GGPO_ERRORCODE_PLAYER_DISCONNECTED = 9, GGPO_ERRORCODE_TOO_MANY_SPECTATORS = 10, GGPO_ERRORCODE_INVALID_REQUEST = 11, } pub fn ggpo_succeeded(code: GGPOErrorCode) -> bool { match cod...
Rust
0
import os import sys try: os.path.dirname(os.path.realpath(__file__)) except Exception: err_msg = "your system does not properly handdle non-Ascii path" err_msg += "please move this Blen's directory to other location" exit(err_msg) from lib.core.data import root_path def check_environment(): from...
Python
1
# 6) WAP TO CALCULATE SQUARE OF A NUMBER a=input("enter a number: ") a=int(a) print(a) square=a**2 # square=a*a print(f"Square of {a} is:",square)
Python
1
exity: warnings.warn( f"{k_neighbors=} asked for, but {complexity=} was smaller. Increasing {complexity} to {k_neighbors}" ) complexity = k_neighbors num_queries, dim = _queries.shape neighbors, distances = self._index.batch_search( querie...
Python
1
# Copyright 2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. # SPDX-License-Identifier: Apache-2.0 """Track Firecracker memory overhead Because Firecracker is a static binary, and is copied before execution, no memory is shared across many different processes. It is thus important to track how much memor...
Python
1
import argparse def compare_files(file1, file2, chunk_size=1024): """ Compare two files byte by byte and calculate the percentage of error based on the number of differing bytes. """ total_bytes = 0 mismatched_bytes = 0 # we have to try catch the fils with open(file1, 'rb') as f1, open...
Python
1
': 'failed', 'error_message': str(error_message), 'detection_result': { 'detected': bool(False), 'peak_freq': None, 'peak_magnitude': None, 'prominence': None, 'snr': None } } def batch_verif...
Python
1
&'static MMTK<VM>, bucket: WorkBucketStage, packets: Vec<Box<dyn GCWork<VM>>>, ) { mmtk.scheduler.work_buckets[bucket].bulk_add(packets) } /// Add a callback to be notified after the transitive closure is finished. /// The callback should return true if it add more work packets to the closure bucket. pub ...
Rust
0
opaque_ref::new_message); rhai::set_exported_fn!(m, "new_os_message", mut_opaque_ref::new_os_message); rhai::set_exported_fn!(m, "write_out_message", mut_opaque_ref::write_out_message); engine.register_static_module("Host::Msg", m.into()); assert_eq!( engine.eval::<bool>( r#" ...
Rust
0
d to k """ return int(hashlib.sha256((salt + str(k)).encode()).hexdigest(), base=16) % m # This function is for use only within this module. def _swap_halves(x, w): """Swap the two w/2-bit halves of x and return the result. Arguments: x -- number whose halves are to be swapped w -- total num...
Python
1
pyautogui.screenshot() screenshot = cv2.cvtColor(np.array(screenshot), cv2.COLOR_RGB2BGR) self.target_color = screenshot[y, x] self.progress.emit(f">获取到BGR颜色值: {self.target_color}") self.current_step += 1 # Then get coordinates for step in self.steps[1:]: ...
Python
1
#!/usr/bin/env python # coding: utf-8 # Copyright (c) Jupyter Development Team. # Distributed under the terms of the Modified BSD License. from __future__ import print_function from glob import glob import os from os.path import join as pjoin from setuptools import setup, find_packages from jupyter_packaging import...
Python
1
class MinHeap: def __init__(self): self.arr = [] def insert(self, val): self.arr.append(val) self.bubble_up(len(self.arr) - 1) def bubble_up(self, idx): # Stop if reached root if not idx == 0: parent_idx = (idx - 1) // 2 # Only continue if cu...
Python
1
# Exemplo 1 vlCompra = float(input("insira o valor da compra: ")) # Constante se usa letra maiúscula e isso é uma constante LIMITE = 250 if vlCompra > LIMITE: desconto = vlCompra * 0.16 compraDesconto = vlCompra - desconto print("Valor da compra foi:", vlCompra, "e você obteve esse valor de d...
Python
1
_ptr(toty) { span_err!(v.tcx.sess, e.span, E0012, "can not cast to `{}` in a constant expression", ppaux::ty_to_string(v.tcx, toty)); } if ty::type_is_unsafe_ptr(fromty) && ty::type_is_numeric(toty) { span_err!(v...
Rust
0
cast_lossless)] #![allow(dead_code)] use std::ptr; use std::sync::mpsc::{self, Receiver, Sender}; use std::sync::Arc; use std::thread; use std::time::Duration; use libc::{ self, c_long, sched_param, time_t, timespec, CLOCK_MONOTONIC, PR_SET_TIMERSLACK, SCHED_RR, }; use super::{Error, GpioState, Result}; // Only...
Rust
0
#coding=utf-8 #import libs import sys import response_cmd import response_sty import Fun import EXUIControl EXUIControl.G_ExeDir = Fun.G_ExeDir EXUIControl.G_ResDir = Fun.G_ResDir import os import tkinter from tkinter import * import tkinter.ttk import tkinter.font from PIL import Image,ImageTk #Add your Varial H...
Python
1
"""Unit tests for calculating overlap of frustums. Author: Ren Liu """ import unittest import numpy as np from gtsam import Cal3_S2, PinholeCameraCal3_S2 from gtsam.examples import SFMdata import gtsfm.utils.overlap_frustums as overlap_frustums_utils CUBE_SIZE = 4 CUBE_RESOLUTION = 128 # set the dummy image size a...
Python
1
edvs  z8TestPublicKey.test_inequality_public_key_not_implementedcCsttttd}d}d}t|||}|t}t ||Wdn1s`0Y| dt |j dS)NrrDrEzGenerator point must have order) r PointJacobir rGr)r/rF assert...
Python
1
e, Error::EnvVar(ref e) => Some(e), Error::IO(ref e) => Some(e), Error::Send(_) => None, Error::ParseInt(ref e) => Some(e), Error::SyncPoison(_) => None, Error::Utf8(ref e) => Some(e), Error::UuidParse(_) => None, Error::Reg...
Rust
0
# This code is supporting material for the book # Building Machine Learning Systems with Python # by Willi Richert and Luis Pedro Coelho # published by PACKT Publishing # # It is made available under the MIT License import numpy as np from sklearn.datasets import load_boston from sklearn.linear_model import LinearRegr...
Python
1
[ (1, 2), (3, 4), (6, 7), (8, 9), (5, 11), (10, 18), (19, 20), (21, 22), (16, 17), (14, 15), (12, 13) ].iter().cloned().collect::<HashMap<_,_>>() ) } #[test] fn coronene_6_5() { let graph = DefaultGraph::try_from(vec![ ...
Rust
0
il_sen.coef_, w, 1) assert_array_almost_equal(theil_sen.intercept_, c, 1) def test_less_samples_than_features(): random_state = np.random.RandomState(0) n_samples, n_features = 10, 20 X = random_state.normal(size=(n_samples, n_features)) y = random_state.normal(size=n_samples) # Check that The...
Python
1
conta_normal = False conta_universitaria = False conta_especial = True saldo = 2000 saque = 1500 cheque_especial = 450 if(conta_normal): if(saldo>=saque): print("Saque realizado com sucesso!") elif(saque<=(saldo + cheque_especial)): print("Saque realizado com uso do cheque especial!") els...
Python
1
class Solution: def isPrime(self, n): if n <= 1: return False for i in range(2, int(n ** 0.5) + 1): # optimization: check up to √n if n % i == 0: return False return True
Python
1
ion::try_from(1006)?, Instruction::JumpIfFalse(Mode::Position, Mode::Immediate) ); assert_eq!( Instruction::try_from(1107)?, Instruction::LessThan(Mode::Immediate, Mode::Immediate, Mode::Position) ); assert_eq!( Instruction::try_from(1108)?...
Rust
0
x_2] x_adv2 = (1 + self.epsilon) * (batch - x_adv[batch_index_1:batch_index_2]) x_adv[batch_index_1:batch_index_2] = x_adv1 + x_adv2 if self.estimator.clip_values is not None: np.clip( x_adv[batch_index_1:batch_index_2], self.es...
Python
1
impl Backend { pub fn new(partial: bool, _shard: bool, reuse: &str) -> Backend { let mut cb = ControllerBuilder::default(); let log = noria::logger_pls(); let blender_log = log.clone(); if !partial { cb.disable_partial(); } match reuse.as_ref() { ...
Rust
0
paths(); if !pc.is_empty() { *current = pc[0].refc(); return; } } loop { if let Some(parent) = current.parent() { if let Ok(w) = s.widget(parent.refc()) { let pc = w.child_paths(); ...
Rust
0
ze, ), } } pub fn allocate_slot_at(&self, slot: usize) -> Option<CapSlot> { self.root_cn_block.alloc_at(slot) } pub fn allocate_slot(&self) -> Option<CapSlot> { self.root_cn_block.alloc() } pub fn free_slot(&self, slot: usize) { self.root_cn_block.f...
Rust
0
"""Provide the SavableMixin class.""" from typing import Optional from ....const import API_PATH from ....util import _deprecate_args class SavableMixin: """Interface for :class:`.RedditBase` classes that can be saved.""" @_deprecate_args("category") def save(self, *, category: Optional[str] = None): ...
Python
1
als(_, _, _, _) => unreachable!(), Goal(_, _, _) => unreachable!(), Unknown(_) => format!(""), } } } /// Escapes special characters like `&` or `<` to their XML equivalents `&amp;`, `&lt;`, etc. /// /// Currently, this only escapes those characters: /// - `&` → `&amp;` /// - `<` → `...
Rust
0
#! /usr/bin/env python # -*- coding: utf-8 -*- """Monster Hunter OPN server. Monster Hunter 3 Server Project Copyright (C) 2021 Sepalani This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Softwa...
Python
1
e License. // //////////////////////////////////////////////////////////////////////////////// use std::path::PathBuf; use tink_core::{registry::KmsClient, subtle::random::get_random_bytes, TinkError}; const KEY_ALIAS_URI: &str = "aws-kms://arn:aws:kms:us-east-2:235739564943:alias/unit-and-integration-testing"; c...
Rust
0
use presentation_interface::action::root::Root as RootAction; use presentation_interface::action::user::User as UserAction; use presentation_interface::state::root::Root; use crate::adapter::state_adapter::map_state; #[test] fn state_adapter_maps() { let serialized_root = [ ...
Rust
0
= lp_staking_addresses { config.lp_staking_addresses = convert_human_to_raw(deps.as_ref(), &lp_staking_addresses)?; } if let Some(stt_staking_addresses) = stt_staking_addresses { config.stt_staking_addresses = convert_human_to_raw(deps.as_ref(), &stt_staking_addresses)?; } if let Some...
Rust
0
"""Compat for Anki 2.1.54- This is copied verbatim from `qt/aqt/import_export/exporting.py` (in Anki 2.1.55). We need it for our tests, which still assume that we have Anki 2.1.26 and where the above module is missing. We can't upgrade our dependency to Anki 2.1.55 which has the module, because we're still using Pyt...
Python
1
import socket import threading import time # Network topology - define which processes are connected connections = { 0: [1, 2], # Process 0 is connected to Process 1 and 2 1: [0, 3], # Process 1 is connected to Process 0 and 3 2: [0, 4], # Process 2 is connected to Process 0 and 4 3: [1], # Proc...
Python
1
s/73809) for more details. Parameters ---------- ncells: ``int``. Number of cells. nfeatures: ``int``. Number of featuers (e.g. highly variable genes) pval: ``str``, optional (default: "0.05"). P value cutoff on the null distribution (random matrix), choosing from "0.01" a...
Python
1
default_app_config = 'API_ITEMS.apps.ApiItemsConfig'
Python
1
evel=0, optimize=False) else: img.save(image_bits, format='jpeg', quality=100) save_bytes(os.path.join(archive_root_dir, archive_fname), image_bits.getbuffer()) labels.append([archive_fname, image['label']] if image['label'] is not None else None) metadata = { 'labels': ...
Python
1
完美整合,苹果控必看" ], "descriptions": [ "Aqara+Eve+Nanoleaf,打造完美苹果生态", "Siri语音控制,iPhone一键管理全屋", "隐私安全,本地控制,苹果品质保证" ], "cta": "获取HomeKit方案" }, "keywords": ["HomeKit", "苹果智能家居", "Aq...
Python
1
S_label=N/A Partitions=p4 ' 'BootTime=01 Jan 2018 ' 'SlurmdStartTime=01 Jan 2018 ' 'CfgTRES=cpu=24,mem=32220M ' 'AllocTRES= CapWatts=n/a CurrentWatts=100 ' 'LowestJoules=100000000 ConsumedJoules=0 ' 'ExtSensorsJoules=n/s ExtSensorsWatts=0 ' 'ExtSensorsTemp=n/s Rea...
Python
1
\x97\xb1', # 棻 26876: b'\xe8\xfb', # 棼 26877: b'\x97\xb2', # 棽 26878: b'\x97\xb3', # 棾 26879: b'\x97\xb4', # 棿 26880: b'\x97\xb5', # 椀 26881: b'\xe9\xa4', # 椁 26882: b'\x97\xb6', # 椂 26883: b'\x97\xb7', # 椃 26884: b'\x97\xb8', # 椄 26885: b'\xd2\xce', # 椅 26886: b'\x97\xb9', # 椆 26887: b'\x97\xba', # 椇 26888: b'\x97\xbb...
Python
1
"Did not get expected course back after saving!") for key in [ "medal", "combo", "stage1", "stage2", "stage3", "stage4", "total", ]: if course[key] != scores["courses"]...
Python
1
import os from typing import Sequence from urllib.request import urlretrieve import cv2 from motpy import Detection, MultiObjectTracker, NpImage from motpy.core import setup_logger from motpy.detector import BaseObjectDetector from motpy.testing_viz import draw_detection, draw_track from motpy.utils import ensure_pack...
Python
1
spect to `nbunch2`. Examples -------- >>> G = nx.wheel_graph(6) When nbunch2=None: >>> list(nx.node_boundary(G, (3, 4))) [0, 2, 5] When nbunch2 is given: >>> list(nx.node_boundary(G, (3, 4), (0, 1, 5))) [0, 5] Notes ----- Any element of `nbunch` that is not in the g...
Python
1
r) -> c_int; #[cfg(any(feature = "v0_1_4", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v0_1_4")))] pub fn nice_agent_parse_remote_stream_sdp( agent: *mut NiceAgent, stream_id: c_uint, sdp: *const c_char, ufrag: *mut *mut c_char, pwd: *mut *mut c_char, ) -> *mut glib::ff...
Rust
0
reflected + *fuzziness * Vec3D::random_in_unit_sphere(), ); if scattered.direction().dot(&rec.normal()) > 0. { return Some((scattered, *albedo)); } else { None } } Material...
Rust
0
same primitive data type can have different types of /// measurement. For example, numeric data can represent quantitative, ordinal, or nominal /// data. /// - When using with [`bin`](https://vega.github.io/vega-lite/docs/bin.html), the `type` /// property can be either `"quantitative"` (for using a li...
Rust
0
/// The last two can be left off if both defaults. /// /// Example: /// /// ```rust /// # #[macro_use] /// # extern crate gong; /// # fn main() { /// // Without modes, empty option lists /// let _ = gong_option_set_fixed!([], []); /// // With modes, empty option lists /// let _ = gong_option_set_fixed!([], [], gong::o...
Rust
0
import matplotlib.pyplot as plt import numpy as np from exojax.utils.grids import wavenumber_grid from exojax.database.exomol.api import MdbExomol from exojax.opacity import OpaPremodit from exojax.plot.opaplot import plot_lbd from jax import config config.update("jax_enable_x64", True) def save_lbd( filename, ...
Python
1
# coding: utf-8 # ------------------------------------------------------------------- # 宝塔Linux面板 # ------------------------------------------------------------------- # Copyright (c) 2015-2099 宝塔软件(http://bt.cn) All rights reserved. # ------------------------------------------------------------------- # Author: sww <s...
Python
1
ner[0].get(1..).ok_or(OutOfBounds)?, split_inner.get(1).ok_or(OutOfBounds)?, split_inner.get(2).ok_or(OutOfBounds)?, in_interface.get(1).ok_or(OutOfBounds)?, )) } fn parse_line(line: &str) -> Result<HashMap<&str, &str>, OutOfBounds> { let line_arr = line.split(' '); let mut parsed =...
Rust
0
#[test] fn rclass_for_undef_root_class() { let mut interp = crate::interpreter().unwrap(); let spec = class::Spec::new("Foo", None, None).unwrap(); let rclass = unsafe { interp.with_ffi_boundary(|mrb| spec.rclass().resolve(mrb)) }.unwrap(); assert!(rclass.is_none()); } #[tes...
Rust
0
_pings_first_inserted() { let max_size = 20; let mut bucket = KBucket::new(max_size); for x in 0..max_size { let node = Node { id: BitKey(x as u128), udp_addr: "0.0.0.0:10".parse().unwrap(), }; bucket.insert(node); } ...
Rust
0
let target_row = 3010; let target_column = 3019; // The codes are generated in up-to-the-right diagnals, so all we need to store is // the first code in each row and the previously generated code. // The first code is 20151125. let mut first_column = Vec::new(); first_column.reserve(target...
Rust
0
Debug, Serialize, Deserialize)] #[serde(rename_all = "PascalCase")] pub struct DealInfo { #[serde(with = "cid_json")] pub proposal_cid: Cid, // pub state: storagemarket::StorageDealStatus, pub message: String, // more information about deal state, particularly errors pub provider: Address, #...
Rust
0
32>(0) as usize) .expect("Get pipeline count"); rows.next().map(|row| row.expect("SQLite to work")).unwrap() } } pub struct GithubProjectsConfig { conn: Mutex<Connection>, } impl GithubProjectsConfig { pub fn new(path: PathBuf) -> Resul...
Rust
0
B(u)) // 2. u ⇒ v & v ⇏ u ⟺ v ∈ F(u) \ B(u) // 3. u ⇏ v & v ⇒ u ⟺ v ∈ B(u) \ F(u) // 4. u ⇒ v & v ⇒ u ⟺ v ∈ F(u) ∩ B(u) // // In Case 2, `v` always appears before `u` in the postorder list (either be first enumerated, or // set in DFS), while in Case 3, `u` always appears before `v`. In Case 1, since ...
Rust
0
""" schema.py """ from typing import List, Literal from pydantic import BaseModel, Field class DialogueItem(BaseModel): """A single dialogue item.""" speaker: Literal["Host", "Guest"] text: str class ShortDialogue(BaseModel): """The conversation between the host and guest. Input arguments are scr...
Python
1