text
string
label_name
string
labels
int64
.\n", "Nesting information must be given in LV (level) and PS (parent snarl) tags." )) .arg( Arg::with_name("input") .short("i") .long("input") .value_name("FILE") .help("Filter this input VCF file.") ...
Rust
0
} // } pub type SpinMutex<T> = lock_api::Mutex<RawSpinMutex, T>; pub type SpinMutexGuard<'a, T> = lock_api::MutexGuard<'a, RawSpinMutex, T>; <reponame>arloherrine/fith extern crate itertools; extern crate termion; mod interpreter; mod interactive; fn main() { let interp = interpreter::Interpreter::new(); ...
Rust
0
def count_frequency(list0): count = {} # Creating an empty dictionary for i in list0: count[i] = count.get(i, 0) + 1 return count if __name__ == '__main__': list1 = [1, 1, 1, 5, 5, 3, 1, 3, 3, 1, 4, 4, 4, 2, 2, 2, 2] print(count_frequency(list1))
Python
1
hs { let file_stem = path.file_stem().unwrap(); pb_filter_name.set_message(&format!( "{} 過濾名稱 : {:#?}", style("[4/6]").bold().dim(), file_stem )); pb_filter_name.inc(1); for filter in filters { let filter = filter.as_str(); ...
Rust
0
remote_call(port, message_buf)?; Ok(Value::String(base64::encode(&response_buf))) }); let allow_replace_conductor = args.allow_replace_conductor; io.add_method("replace_conductor", move |params: Params| { /// very dangerous, runs whatever strings come in from the internet directly in bash ...
Rust
0
double /// quotes. fn string_token_handler(code: &str, char_index: usize) -> Option<(TokenType, usize)> { let mut chars = code.chars().skip(char_index); let string_char = chars.next(); if string_char != Some('"') && string_char != Some('\'') { return None; } let mut skip_next = false; ...
Rust
0
#!/usr/bin/env python3 import dragon import multiprocessing as mp import time import argparse def numAcq(nlock, acquisitions): for _ in range(acquisitions): is_locked = nlock.acquire(block=True) if is_locked: nlock.release() class LockPerformance: def workerAcquisition(self, min_...
Python
1
from __future__ import absolute_import import pytest from kafka import KafkaConsumer, TopicPartition from kafka.errors import KafkaConfigurationError, IllegalStateError def test_session_timeout_larger_than_request_timeout_raises(): with pytest.raises(KafkaConfigurationError): KafkaConsumer(bootstrap_ser...
Python
1
ensor_ = torch.cat((cav_box_tensor, gt_box_tensor), dim=0) # pred_score_ = torch.cat((torch.ones(N, device=pred_score.device), pred_score)) # gt_score_ = torch.ones(gt_box_tensor_.shape[0], device=pred_box_tensor.device) # gt_score_[N:] = 0.5 # keep_index = nms_rotated(pred_box_tensor_, # ...
Python
1
import pytest import os import hashlib import random from src.reproducibility.protocol import ReproducibilityProtocol from src.reproducibility.tamper_evidence import TamperEvidence import logging # Suppress logging during tests to avoid clutter logging.getLogger().setLevel(logging.CRITICAL) @pytest.fixture def repro_...
Python
1
quantity = int(input()) # Quantity of Decorations days = int(input()) # Days to Christmas ornament = 2 # Ornament Set Price ornament_points = 5 # Ornament St Happiness skirt = 5 # Tree Skirt Price skirt_points = 3 # Tree Skirt Happiness garland = 3 # Tree G...
Python
1
0); lock } #[allow(unreachable_code, unused_variables)] fn lock_pid(pid: u32) -> u32 { #[cfg(target_os = "linux")] return 0; pid } #[test] fn getlk_fcntl_read_unlocked() { let requests = getlk_test(|root| { let path = root.join("getlk_u.txt"); let got_lock = fcntl_getlk( path, libc::flock { l_ty...
Rust
0
::<_, unsafe extern "C" fn()>( open_trampoline::<Self, F> as *const (), )), Box_::into_raw(f), ) } } fn hold(&self) -> ApplicationHoldGuard { unsafe { ffi::g_application_hold(self.as_ref().to_glib_none().0); } ...
Rust
0
or_type": type(e).__name__, "context": context } ) recovered_result = await self.handle_error(e, context, operation) if recovered_result is not None: # In async context managers, we should raise the exceptio...
Python
1
pub MPCBB2_VCTR22: u32, pub MPCBB2_VCTR23: u32, pub MPCBB2_VCTR24: u32, pub MPCBB2_VCTR25: u32, pub MPCBB2_VCTR26: u32, pub MPCBB2_VCTR27: u32, pub MPCBB2_VCTR28: u32, pub MPCBB2_VCTR29: u32, pub MPCBB2_VCTR30: u32, pub MPCBB2_VCTR31: u32, pub MPCBB2_VCTR32: u32, pub MPCBB...
Rust
0
a d^;@sjdZddlZddlZddlZddlZzddlZdZWneyJdZYn0ddgZGddde Z dZ d Z d Z d Ze eZd ZGd ddZerGdddeZededkrfddlZeejdZeeeejdeejdee\ZZededD]BZ e!e \Z"Z#Z$e...
Python
1
or(func_name) return repl, mod, func_name # Python 2.7 to 3.4 msvc9 = functools.partial(patch_params, 'distutils.msvc9compiler') # Python 3.5+ msvc14 = functools.partial(patch_params, 'distutils._msvccompiler') try: # Patch distutils.msvc9compiler patch_func(*msvc9('find_v...
Python
1
; url.set_path(&repo); return Ok(url); } }; Ok(Url::parse(&repo)?) } #[test] fn test_parse_repo_url() { assert_eq!( normalize_repo_url("user@host:hoge/fuga").unwrap(), Url::parse("ssh://user@host/hoge/fuga").unwrap() ); assert_eq!( normalize_...
Rust
0
numbers[0] + numbers[1] + numbers[2]; for i in 1..(numbers.len() - 2) { let new_sum = sum + numbers[i + 2] - numbers[i - 1]; if new_sum > sum { inc += 1; } sum = new_sum; } println!("{}", inc); } fn parsefile(filename: &str) -> Vec<i32> { let lines = fs::rea...
Rust
0
Field( builder.id("x"), ast::Inherited, ), id: ast::DUMMY_NODE_ID, ty: builder.ty().isize(), attrs: vec![ respan( ...
Rust
0
# CHPC Summer School 2025 # Probability & Statistics: Categorical Data & Probability # Example: Jerusalema # Import packages and functions import numpy as np from scipy.stats import chi2_contingency # Give the contingency table with observed counts ctJerusalema = np.array([[28, 12], [16, 24]]) # Do the test for...
Python
1
# Based on https://github.com/ruotianluo/self-critical.pytorch import sys from collections import OrderedDict import torch import torch.nn as nn import numpy as np sys.path.append("coco-caption") from pycocoevalcap.cider.cider import Cider CiderD_scorer = Cider(df='corpus') def init_scorer(cached_tokens): glob...
Python
1
numbers = [float(x) for x in input("Enter a list of numbers separated by spaces: ").split()] sorted_numbers = sorted(numbers) print(f"Sorted list: {sorted_numbers}")
Python
1
from rest_framework.permissions import BasePermission class IsObjectOwnerPermission(BasePermission): def has_object_permission(self, request, view, obj): """ Return `True` if permission is granted, `False` otherwise. """ return request.user == obj.user class IsUserObjectPermissio...
Python
1
= " Number of past frames sent through the link."] pub frame_count_out: i64, #[doc = " A pointer to a FFFramePool struct."] pub frame_pool: *mut ::std::os::raw::c_void, #[doc = " True if a frame is currently wanted on the output of this filter."] #[doc = " Set when ff_request_frame() is called by t...
Rust
0
std::os::unix::fs::symlink(store_path.as_path(), &path) .map_err(|e| AddRootError::symlink(e, store_path.as_path(), &path))?; // the reverse GC root that points from nix to our cache gc_roots dir let mut root = if let Ok(path) = env::var("NIX_STATE_DIR") { PathBuf::from(...
Rust
0
uter.at("/a").get(async move |_| "/b/a"); router.at("/b").get(async move |_| "/b/b"); router.at("/c").nest(|router| { router.at("/a").get(async move |_| "/b/c/a"); router.at("/b").get(async move |_| "/b/c/b"); }); router.at("/d").get(async ...
Rust
0
import json import math def calc_average_normalized_loglikelihood(models, keys=None) -> float: keys = keys or models.keys() accum_normalized_logloss = 0. for key in keys: if key not in models: accum_normalized_logloss += math.log(0.5) continue model = models[key] ...
Python
1
} } bevy_app.update(); }); } <filename>src/compiler/tests.rs /// What an empty program should look like. const ALLOCATE_AND_EXIT: &str = include_str!("alloc_exit.asm"); const NEWLINE: &str = include_str!("newline.asm"); use super::compile; use super::BrainfuckInstr; use BrainfuckInstr:...
Rust
0
![0, 4, 5, 0], vec![0, 3, 1, 0], ], ); } } <filename>lexical-core/src/lib.rs //! Fast lexical conversion routines for a no_std environment. //! //! lexical-core is a low-level API for number-to-string and //! string-to-number conversions, without requiring a system //! allocator....
Rust
0
_17>())).send_get_tally as *const _ as usize }, 0usize, concat!( "Offset of field: ", stringify!(NDIlib_v4__bindgen_ty_17), "::", stringify!(send_get_tally) ) ); assert_eq!( unsafe { &(*(::std::ptr::null::<NDIlib...
Rust
0
import os from .parser_image_folder import ParserImageFolder from .parser_image_tar import ParserImageTar from .parser_image_in_tar import ParserImageInTar def create_parser(name, root, split='train', **kwargs): name = name.lower() name = name.split('/', 2) prefix = '' if len(name) > 1: prefi...
Python
1
# -*- coding: utf-8 -*- """ Tree Regression (California Housing) ========================================= """ #%% # Experiment initialization and data preparation from piml import Experiment from piml.models import TreeRegressor exp = Experiment() exp.data_loader(data="CaliforniaHousing_trim2", silent=True) exp.data_...
Python
1
from initialize import * from scripts.load_env import * from scripts.constants import * from scripts.initialize import ( excel_manager, value_validator, folder_checker, folder_path_handler, folder_processor, file_validator, folder_mover, ) def move_folder(): required_files = [ ...
Python
1
ema/mds.rs //! MDS系RPCのスキーマ定義。 use bytecodec::bincode_codec::{BincodeDecoder, BincodeEncoder}; use fibers_rpc::{Call, Cast, ProcedureId}; use std::ops::Range; use std::time::Duration; use entity::node::{LocalNodeId, RemoteNodeId}; use entity::object::{ DeleteObjectsByPrefixSummary, Metadata, ObjectId, ObjectPrefix...
Rust
0
ormation/latest/UserGuide/aws-properties-globalaccelerator-listener-portrange.html#cfn-globalaccelerator-listener-portrange-fromport). /// /// Update type: _Mutable_. /// AWS CloudFormation doesn't replace the resource when you change this property. pub from_port: ::Value<u32>, /...
Rust
0
# # -------------------------------------------------------------------------- # Gurux Ltd # # # # Filename: $HeadURL$ # # Version: $Revision$, # $Date$ # $Author$ # # Copyright (c) Gurux Ltd # # --------------------------------------------------------------------------- # # ...
Python
1
# model_predictor.py import random # 导入random库,用于生成随机数(模拟预测结果和延迟) import asyncio # 导入asyncio库,用于异步操作(模拟处理时间) from typing import Dict, Any # 导入类型提示,Dict表示字典,Any表示任意类型 import logging # 导入logging库,用于记录日志 import time # 导入time库,用于计算处理时间 # 获取名为__name__(即当前模块名'model_predictor')的日志记录器实例 logger = logging.getLogger(__name__...
Python
1
from rest_framework import serializers from .models import Group class GroupSerializer(serializers.ModelSerializer): class Meta: model = Group fields = ('id', 'name', 'description', 'members', 'created_at', 'updated_at')
Python
1
for x in range(1,21): if x==13: continue else: print(x)
Python
1
} sum } } <reponame>im-kulikov/rust-webecho #![feature(test)] extern crate test; extern crate rand; const RAND_BENCH_N: u64 = 1000; mod distributions; use std::mem::size_of; use test::{black_box, Bencher}; use rand::{XorShiftRng, StdRng, IsaacRng, Isaac64Rng, Rng}; use rand::{OsRng, sample, we...
Rust
0
4] with torch.no_grad(): test_image_outputs = trainer.test_sample_user_input(images_a, images_b, pose_a, pose_b, caps_a, caps_len_a, caps_b, caps_len_b, ixtoword_test, wordtoix_test) result_a = test_image_outputs[2] result_b = test_image_...
Python
1
import os import json from bson.json_util import dumps from bson.objectid import ObjectId from jsonschema import validate, ValidationError from dotenv import load_dotenv from app.database_handler.mongodb_handler import mongodb_handler load_dotenv('app/.env') DB_URI = os.getenv('DB_URI') DB_NAME = os.getenv('TODO_DB_N...
Python
1
from _hermes2d import ScalarView self._glut_view = ScalarView(self._name) self._glut_view.show(sln) elif lib == "mpl": plot_sln_mpl(sln, **options) import pylab if show: if notebook: pylab.savefig(filename)...
Python
1
ritten. /// /// # Examples /// /// Creating a header for a file that will be written: /// /// ``` /// use openexr::{Header, PixelType}; /// /// Header::new() /// .set_resolution(1920, 1080) /// .add_channel("R", PixelType::FLOAT) /// .add_channel("G", PixelType::FLOAT) /// .add_channel("B", PixelType::F...
Rust
0
cher; use toshi_server::index::{IndexCatalog, SharedCatalog}; use toshi_server::router::router_with_catalog; use toshi_server::settings::{Settings, HEADER, RPC_HEADER}; use toshi_server::{shutdown, support}; #[cfg_attr(tarpaulin, skip)] pub fn main() -> Result<(), ()> { let settings = support::settings(); setu...
Rust
0
alue { 0 => ENVADJR::_000, 1 => ENVADJR::_001, 2 => ENVADJR::_010, 3 => ENVADJR::_011, i => ENVADJR::_Reserved(i), } } #[doc = "Checks if the value of the field is `_000`"] #[inline] pub fn is_000(&self) -> bool { *self == ENVAD...
Rust
0
rs='coerce') enriched = enriched.sort_values(["departure_time", "route_short_name", "trip_long_name"]) enriched['departure_time'] = enriched['departure_time'].dt.strftime('%H:%M') if enriched.empty: st.warning("Selle peatuse jaoks ei leitud väljumisi valitud nädala jooksul.") ...
Python
1
not it throws error. // To change preemtion between approx/exact, change line 114 to "exact" or "approx", as well as on line 92 fn response(task: &Task, ip: &IdPrio, tasks: &Vec<Task>, mut used_tasks: &mut UsedTasks, tr: &TaskResources, tt: &TaskTimes) -> f32 { let b = blocking(&task, &ip, &tr); let p = preemt...
Rust
0
)] pub fn bit(self, value: bool) -> &'a mut W { self.w.bits = (self.w.bits & !(0x01 << 5)) | (((value as u32) & 0x01) << 5); self.w } } #[doc = "UART0 RxD Filter Select\n\nValue on reset: 0"] #[derive(Clone, Copy, Debug, PartialEq)] #[repr(u8)] pub enum RXDFE_A { #[doc = "0: RXD0 input signa...
Rust
0
CRYPTCFB = 1496, X86_INS_XCRYPTCTR = 1497, X86_INS_XCRYPTECB = 1498, X86_INS_XCRYPTOFB = 1499, X86_INS_XEND = 1500, X86_INS_XGETBV = 1501, X86_INS_XLATB = 1502, X86_INS_XOR = 1503, X86_INS_XORPD = 1504, X86_INS_XORPS = 1505, X86_INS_XRELEASE = 1506, X86_INS_XRSTOR = 1507, ...
Rust
0
# the initial solution vector for the mvp here 0, a linear problem if len(x_0) == 0: x_0 = np.zeros((self.num_dofs_mvp, )) # compute the source fields # we only need to compute them in the iron domains quad_points = self.curl_curl_factory.get_quadrature_points(self.quad_o...
Python
1
l like the main useful ones. # Use get_source_transform to see the full list def set_source_transform(self, scene_name, source_name, new_transform): response = self.ws.call(requests.GetSceneItemId(sceneName=scene_name, sourceName=source_name)) myItemID = response.datain['sceneItemId'] se...
Python
1
plicationCommandMessageInteractionMetadata, MessageComponentMessageInteractionMetadata, ModalSubmitMessageInteractionMetadata, ] class InteractionCallbackResponse(TypedDict): id: Snowflake type: InteractionType activity_instance_id: NotRequired[str] response_message_id: NotRequired[Snowflake] ...
Python
1
(always)] pub fn from_any<T: 'static>() -> Self { let mut fake: T = unsafe_uninitialized(); let this = { let fat_pointer: &mut dyn Any = &mut fake; let trait_object: TraitObject = unsafe { transmute(fat_pointer) }; Self(new_non_null(trait_object.vtable)) }; forget(fake); this } /// The fun...
Rust
0
vec![ vec![1, 2, 3], vec![4, 5, 6], vec![7, 8, 9], ]) == vec![1, 2, 3, 6, 9, 8, 7, 4, 5]); println!("{}", Solution::spiral_order(vec![ vec![1, 2, 3, 4], vec![5, 6, 7, 8], vec![9, 10, 11, 12], ]) == vec![1, 2, 3, 4, 8, 12, 11, 10, 9, 5, 6, 7]); println!("{}...
Rust
0
import heapq class Solution: def kSmallestPairs(self, nums1: List[int], nums2: List[int], k: int) -> List[List[int]]: if not nums1 or not nums2 or k <= 0: return [] n1, n2 = len(nums1), len(nums2) min_heap = [] result = [] visited = set() ...
Python
1
import pytest import pandas._testing as tm class TestCategoricalWarnings: def test_tab_complete_warning(self, ip): # https://github.com/pandas-dev/pandas/issues/16409 pytest.importorskip("IPython", minversion="6.0.0") from IPython.core.completer import provisionalcompleter code =...
Python
1
import math class Solution: def isPerfect(self, n): # code here c=1 if n==1: return False # 1 is not a Perfect Number for i in range(2,int(math.sqrt(n))+1): if n%i==0: c+=i if i!=n//i: c+=n//i # Avoiding squ...
Python
1
(i, quiver)) applied_forces.append([i, input_x_value, input_y_value, input_z_value]) break elif event.mouseevent.button == 3: # 右クリック for i in range(len(nodes)): if node_scatter[i] == artist: # 指定されたノードのベクトルを削除 ...
Python
1
bGet(GRB.Callback.BARRIER_PRIMINF) dualinf = model.cbGet(GRB.Callback.BARRIER_DUALINF) cmpl = model.cbGet(GRB.Callback.BARRIER_COMPL) print(f"{itcnt:.0f} {primobj:g} {dualobj:g} {priminf:g} {dualinf:g} {cmpl:g}") elif where == GRB.Callback.MESSAGE: # Message callback msg = mo...
Python
1
pu::common_defs::address_mode; #[derive(Debug)] pub enum OpcodeLoadError { Io(io::Error), CSV(csv::Error), ParseInt(num::ParseIntError), ParseOpcodeClass(opcode_class::ParseError), ParseAddressMode(address_mode::ParseError), DuplicateOpcode(String), IncorrectOpcodeCount(String), NonCont...
Rust
0
rate genco; use genco::prelude::*; use crate::atom::*; use crate::code::lang::common::CommonLang; use crate::spec::rel::RelOp; use super::lir::*; use super::lir_code::*; #[derive(Debug, Clone)] pub struct Cpp; impl CodeLang for Cpp {} impl Code<Cpp> for LSpec<Cpp> { fn code_into(self: &Self, _lang: &Cpp, toke...
Rust
0
et Html::VList(mut list) = self.html { self.html = list.children.remove(0); } self } } impl MdcWidget for List { const NAME: &'static str = stringify!(List); fn html(&self) -> &Html { &self.html } fn html_mut(&mut self) -> &mut Html { &mut self.html ...
Rust
0
*mut AVCodecContext) -> ::std::os::raw::c_int>, pub uninit: ::std::option::Option<unsafe extern "C" fn(avctx: *mut AVCodecContext) -> ::std::os::raw::c_int>, pub priv...
Rust
0
or("missing header: Sg-Worker-ID")? .to_str()?, )?; let kind = headers .get("Sg-Worker-Kind") .ok_or("missing header: Sg-Worker-Kind")? .to_str()? .to_string(); Ok(Self { id, kind }) } } impl AppImpl { /// Create a new appl...
Rust
0
) -> Cow<str> { let cow_str = Cow::Borrowed(s); let no_multilines = remove_multiline_comments(cow_str); remove_single_line_comments(no_multilines) } ///Takes the entire source code and removes the rest of the line for each line with a `//`. fn remove_single_line_comments(mut s: Cow<str>) -> Cow<str> { //Could be s...
Rust
0
RefCell<Copying>, scopes: RefCell<Vec<LocalScopeData>>, walker: Box<GcWalker> } impl GcHeap { pub fn new(walker: Box<GcWalker>, opts: GcOpts) -> GcHeap { if opts.fast_growth_factor <= 1.0 { panic!("fast_growth_factor must be more than 1"); } if opts.slow_growth...
Rust
0
output if ``pyyaml`` is installed """ if mode == DisplayModes.stdout.value: try: # Non-standard library, check import yaml = _check_pyyaml() print(yaml.dump(CONFIG)) except ModuleNotFoundError: import warnings import json wa...
Python
1
import glob import subprocess import torch from os import path as osp from torch.serialization import _is_zipfile, _open_file_like def update_sha(paths): print('# Update sha ...') for idx, path in enumerate(paths): print(f'{idx+1:03d}: Processing {path}') net = torch.load(path, map_location=to...
Python
1
import sys param1 = sys.argv[1] param2 = sys.argv[2] def main(me1, me2): print("-------------- changePasswordSingle has run --------------") print(f"Received parameters: {me1}, {me2}") main(param1, param2)
Python
1
# copyright (c) 2021 PaddlePaddle Authors. All Rights Reserve. # # 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
unknown = set() # keep track of which items are in the wrong version wrong_version = set() for i in self.metadata_to_mandatory[metadata_version]: if self.strict_check: check_condition(i in headers, f'{i} missing') for i in headers: if n...
Python
1
# Copyright (c) Jupyter Development Team. # Distributed under the terms of the Modified BSD License. """Color class. Represents an HTML Color . """ from .widget_description import DescriptionWidget from .valuewidget import ValueWidget from .widget import register from .widget_core import CoreWidget from .trait_types...
Python
1
# Copyright 2020 Google # # 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, soft...
Python
1
""" Ordinal probit model ==================== Example of an ordinal probit model. This is just to illustrate the syntax, as the data are not ordered. But the example assume, for the sake of it, that the alternatives are ordered as 1->2->3 :author: Michel Bierlaire, EPFL :date: Mon Apr 10 12:15:28 2023 """ import...
Python
1
import os import logging from binance_sdk_derivatives_trading_portfolio_margin.derivatives_trading_portfolio_margin import ( DerivativesTradingPortfolioMargin, ConfigurationRestAPI, DERIVATIVES_TRADING_PORTFOLIO_MARGIN_REST_API_PROD_URL, ) # Configure logging logging.basicConfig(level=logging.INFO) # Cr...
Python
1
<[u8]>>(hash: &HashFn, key: &[u8], default_value: F) -> T { unhashed::take_or_else(&hash(key).as_ref(), default_value) } /// Check to see if `key` has an explicit entry in storage. pub fn exists<HashFn: Fn(&[u8]) -> R, R: AsRef<[u8]>>(hash: &HashFn, key: &[u8]) -> bool { unhashed::exists(&hash(key).as_ref()) } /// ...
Rust
0
_DEFAULT: Level = Level::Info; /// Log level with `-v` const PKG_LOG_LEVEL_VERBOSE_1: Level = Level::Debug; /// Log level with `-vv` and beyond const PKG_LOG_LEVEL_VERBOSE_2: Level = Level::Trace; /// Program version (from `Cargo.toml`) const PKG_VERSION: &str = env!("CARGO_PKG_VERSION"); /// Program description (from ...
Rust
0
e_factor1 = max(0, 1.0 - (age1 / persistence_time)) fade_factor2 = max(0, 1.0 - (age2 / persistence_time)) avg_fade = (fade_factor1 + fade_factor2) / 2 # 根据衰减和辉光层级计算透明度和颜色 if glow_width == 6: # 外层辉光 base_alpha = int(40 * avg_fade) ...
Python
1
t: &VPattern, branch: VExpr, env: &mut Environment, ) -> Result<Value, RuntimeError> { unpack_pattern(expr, pat) .ok_or(RuntimeError::NonExhaustivePatternsInMatch) .and_then(move |new_env| env.with_bindings(new_env, move |e| evaluate_inner(branch, e))) } fn unpack_pattern(expr: &Value, pat:...
Rust
0
""" ======================================================================== SinkRTL ======================================================================== Network test sinks with RTL interfaces. Author : Yanghui Ou Date : Jan 13, 2022 """ from pymtl3 import * from pymtl3.stdlib.stream.ifcs import RecvIfcRTL cla...
Python
1
# Write a Python function to merge two lists into a list of tuples. def merge_lists(list1, list2): return list(zip(list1, list2)) print(merge_lists([1, 2, 3], ["a", "b", "c"]))
Python
1
relude::*; use tsuga::prelude::*; // Expects the unpacked CIFAR-10 binary data to be located in the // ./data/cifar-10-batches-bin directory // The dataset can be downloaded here: https://www.cs.toronto.edu/~kriz/cifar.html const LABELS: &[&'static str] = &[ "Airplane", "Automobile", "Bird", "Cat", ...
Rust
0
# Copyright (c) 2022-2024, The Isaac Lab Project Developers. # All rights reserved. # # SPDX-License-Identifier: BSD-3-Clause import gymnasium as gym from . import agents, joint_pos_env_cfg ## # Register Gym environments. ## gym.register( id="Isaac-Reach-UR10-v0", entry_point="omni.isaac.lab.envs:ManagerBas...
Python
1
mar); pub use ast::{Clause, Lit, Rules, Term}; #[cfg(feature = "parser")] pub use errors::LoadError; pub use errors::ResolutionError; pub use eval::Env; pub use unify::Subst; <reponame>arkworks-rs/accumulation use crate::hp_as::constraints::{ InputInstanceVar as HPInputInstanceVar, ProofVar as HPProofVar, Veri...
Rust
0
TIME_VERSION: &str = env!("CARGO_PKG_VERSION"); pub const WINDOW_ICON_WIDTH: u32 = 512; pub const WINDOW_ICON_HEIGHT: u32 = 512; pub const DISPLAY_WINDOW_SIZE_WIDTH: u32 = 800; pub const DISPLAY_WINDOW_SIZE_HEIGHT: u32 = 480; pub const DISPLAY_FRAMERATE_SMOOTH_HEAVY: u64 = 30; pub const DISPLAY_FRAMERATE_MODERATE_FAS...
Rust
0
Seat { fn seat_id(&self) -> usize { (self.row as usize) * 8 + (self.column as usize) } } fn find_seat<'a>(direction: &Day05Entry<'a>) -> Seat { let direction = &direction.0; /* 0 32 40 47 63 127 |-------------------------------...
Rust
0
-> TwimlResult<()> { w.write(XmlEvent::start_element("Message"))?; // .attr("loop", &self.count.to_string()) w.write(XmlEvent::start_element("Body"))?; w.write(self.body)?; w.write(XmlEvent::end_element())?; w.write(XmlEvent::end_element())?; Ok(()) } fn build(&...
Rust
0
if len(gt_boxes) == 0 or len(pred_info) == 0: continue ignore = np.zeros(gt_boxes.shape[0]) if len(keep_index) != 0: ignore[keep_index-1] = 1 pred_info = np_round(pred_info,1) pred_sort_idx= np....
Python
1
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # ===================================================================================== # === SCRIPT TO CHECK AND UPDATE EXTERNAL IP ADDRESS === # === SKRYPT DO SPRAWDZANIA I AKTUALIZACJI ZEWNĘTRZNEGO ADRESU IP === # =======================================================...
Python
1
import csv from alkali.peekorator import Peekorator from .file import FileStorage import logging logger = logging.getLogger(__name__) class CSVStorage(FileStorage): """ load models in csv format first line assumed to be column headers (aka: field names) use `remap_fieldnames` to change column head...
Python
1
pub(crate) const AF_INET: u8 = 2; pub(crate) const AF_INET6: u8 = 10; pub(crate) fn fill_ip_addr( iface_states: &mut HashMap<String, Iface>, nl_msg: &AddressMessage, ) -> Result<(), NisporError> { match nl_msg.header.family { AF_INET => { let (iface_index, addr) = parse_ipv4_nlas(nl_msg...
Rust
0
rsion) This was tested in Firefox and Chrome, on Linux. It should also work on other operating systems, and may or may not work in other browsers. If there's any problems, please file an issue at " } <a href="https://github.com/nstoddard/lambda-calculus/">{"the GitHub repository"}</a> {"."} </div> } } //! The read...
Rust
0
ner::AsyncTcpListener; thread_local! { /// The global reactor. static REACTOR: Handle = Reactor::new().expect("failed to initialize thread local reactor"); } /// Reactor for futures. #[derive(Debug)] pub struct Reactor { poll: mio::Poll, counter: RefCell<usize>, } /// Handle of `Reactor`. /// /// Can...
Rust
0
layout = self.layout layout.use_property_split = True cam = context.camera layout.prop(cam, "show_composition_thirds") col = layout.column(heading="Center", align=True) col.prop(cam, "show_composition_center") col.prop(cam, "show_composition_center_diagonal", text="Dia...
Python
1
_BITS_BCOND_BC => self.psw_carry, OPCODE_BITS_BCOND_BZ => self.psw_zero, OPCODE_BITS_BCOND_BNH => self.psw_carry || self.psw_zero, OPCODE_BITS_BCOND_BN => self.psw_sign, OPCODE_BITS_BCOND_BR => true, OPCODE_BITS_BCOND_BLT => self.psw_sign !...
Rust
0
pub struct Cc; impl Cond for Cc { const CC: ConditionCode = ConditionCode::Cc; } pub struct Mi; impl Cond for Mi { const CC: ConditionCode = ConditionCode::Mi; } pub struct Pl; impl Cond for Pl { const CC: ConditionCode = ConditionCode::Pl; } pub struct Vs; impl Cond for Vs { const CC: ConditionCode = C...
Rust
0
import _plotly_utils.basevalidators class SpikedashValidator(_plotly_utils.basevalidators.DashValidator): def __init__(self, plotly_name="spikedash", parent_name="layout.xaxis", **kwargs): super(SpikedashValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, ...
Python
1
e = Service::new(rpc_handler.clone(), meta); let codec = codecs::StreamCodec::new(incoming_separator.clone(), outgoing_separator.clone()); let framed = tokio_util::codec::Decoder::framed(codec, io_stream); let (writer, reader) = futures::StreamExt::split(framed); let responses = reader .map_ok(mov...
Rust
0