text
string
label_name
string
labels
int64
import os import torch import tqdm import numpy as np from audio_io import wav_read, wav_write from DTLN_model import Pytorch_DTLN_stateful if __name__ == '__main__': import argparse parser = argparse.ArgumentParser() parser.add_argument("--model_path", type=str, ...
Python
1
if request ip address is allowed to access from. /// /// Returns true if accessible ip is one that is stored in user's "acl_allow_ips". pub fn is_ip_allowed(&self, origin_ip: &str) -> bool { self.acl_allow_ips .iter() .any(|ip| ip.eq(origin_ip) || ip.eq("*")) } /// G...
Rust
0
azy_static! { static ref DIRECTIONS: BTreeSet<&'static str> = ["n", "s", "e", "w", "ne", "nw", "se", "sw", "north", "south", "east", "west", "northeast", "northwest", "southeast", "southwest"].iter().copied().collect(); } lazy_static::lazy_static! { static ref STREET_NAMES: BTreeSet<&'static str> = [ ...
Rust
0
SS, operand1: Some(Direct(XMM2)), operand2: Some(Indirect(EDI, Some(OperandSize::Dword), None)), operand3: Some(Literal8(64)), operand4: None, lock: false, rounding_mode: None, merge_mode: None, sae: false, mask:...
Rust
0
import numpy as np from numpy.linalg import svd from parameters import * def jacobian_linear(q): """ Computes the 3x7 linear Jacobian for a 7-DOF serial manipulator. Uses DH params and your forward_kinematics(q). """ T = np.eye(4) origins = [T[:3, 3].copy()] # o_0 (base) zs = [T[:3, 2].c...
Python
1
copy_nonoverlapping_backwards(self.tmp.get_unchecked(self.second_pos as usize), self.list.get_unchecked_mut(self.dest_pos as usize), self.second_pos as usize + 1); } // The temporary storage is now full of nothing but uninitialized. // We want to deallocate the space...
Rust
0
percent = ((new - old) / old * 100) percentages.append(float(percent)) if percentages: avg_change_percent = sum(percentages) / len(percentages) summary = { 'period_days': days, 'total_changes': total_changes, ...
Python
1
ot in char: char["dialogues"] = [] char["dialogues"].extend(char_dialogues) for char in tqdm(chars): topics = char["topics"] # GPT-4 for the first topic first_topic = topics[0] key = get_dialogue_key(char, first_topic) if key not in existing_keys...
Python
1
# coding=utf-8 # Copyright 2019 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to ...
Python
1
import rasa.core.training from rasa.core.policies.rule_policy import RulePolicy from rasa.engine.graph import ExecutionContext from rasa.engine.storage.resource import Resource from rasa.engine.storage.storage import ModelStorage from rasa.graph_components.providers.rule_only_provider import RuleOnlyDataProvider from r...
Python
1
) B_ = B__ @ M A = np.eye(12) + dt * A_ B = dt * B_ Q = np.diag(np.array([0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 100, 1, 100, 1, 100, 1])) R = np.eye(4) * 10 Pf = Q Ex = np.eye(12) Ef = Ex dx = np.ones((12,)) * np.inf cx = - np.ones((12,)) * np.inf df = dx cf = cx Eu = ...
Python
1
"""贪吃蛇""" import random import sys import time import pygame from pygame.locals import * from collections import deque SCREEN_WIDTH = 600 # 屏幕宽度 SCREEN_HEIGHT = 480 # 屏幕高度 SIZE = 20 # 小方格大小 LINE_WIDTH = 1 # 网格线宽度 # 游戏区域的坐标范围 SCOPE_X = (0, SCREEN_WIDTH // SIZE - 1) SCOPE_Y = (2, SCREEN...
Python
1
from aiogram.types import ReplyKeyboardMarkup # Импортируем класс ReplyKeyboardMarkup из библиотеки aiogram.types from aiogram.utils.keyboard import ReplyKeyboardBuilder # Импортируем класс ReplyKeyboardBuilder из библиотеки aiogram.utils.keyboard def get_yes_no_kb() -> ReplyKeyboardMarkup: # Создаем экземпляр к...
Python
1
; pub use common::*; mod addr; pub use addr::{PhysAddr, VirtAddr}; pub mod arch; mod error; pub use error::*; pub mod permission; pub mod mmu; mod page_table; pub use page_table::{Table, Entry}; mod vspace; pub use vspace::VSpace; #[macro_use] extern crate bitflags; /* * Copyright (c) Meta Platforms, Inc. and ...
Rust
0
>); type ChordStore = SmallVec<[u8; 2]>; #[derive(Clone, Debug, Ord, PartialOrd, PartialEq, Eq)] pub struct Chord(pub ChordStore); pub type CostCache = [[f64; Layout::KEYS_NUM]; Layout::KEYS_NUM]; impl CharMap { pub fn new(chars: &[char]) -> CharMap { CharMap(chars.iter().enumerate().map(|(i, c)| (*c, i...
Rust
0
(((self.bits >> 23) & 0x01) != 0) } #[doc = "Bit 24 - UART 2 power/clock control bit."] #[inline(always)] pub fn pcuart2(&self) -> PCUART2_R { PCUART2_R::new(((self.bits >> 24) & 0x01) != 0) } #[doc = "Bit 25 - UART 3 power/clock control bit."] #[inline(always)] pub fn pcuart3(&s...
Rust
0
= f"{user_id}:{timestamp}:{secret}" auth_token = hashlib.sha256(token_data.encode()).hexdigest()[:32] # שמירת הטוקן ב-DB (תוקף 5 דקות) try: mongo_db = getattr(db, 'db', None) if mongo_db is not None: mongo_db.webapp_tokens.insert_o...
Python
1
riable set: /// /// RUST_TEST_THREADS=1 /// /// This way cargo test run every test sequentially and there is no data race. use super::*; use std::fs::{create_dir, File, OpenOptions, read_to_string}; use std::env; use test_common::fs::ops::{copy_files}; use test_common::fs::tmp::TestE...
Rust
0
| b.iter(|| v1 == v2)); // } // ~~~~~~~~~~~~~~~~~~~~~~~~~~ // f64 3D Vectors // ~~~~~~~~~~~~~~~~~~~~~~~~~~ // fn criterion_benchmark(c: &mut Criterion) { // let v1: Vector<f64, 3> = Vector::from([1.0, 2.0, 3.0]); // let v2: Vector<f64, 3> = Vector::from([1.0, 2.0, 3.0]); // c.bench_function("PartialEq tes...
Rust
0
VMAP[&0] }; let two = if (self.bits & (1 << 1)) > 0 { TRACKING_ARG_REVMAP[&(1 << 1)] } else { TRACKING_ARG_REVMAP[&0] }; let three = if (self.bits & (1 << 2)) > 0 { TRACKING_ARG_REVMAP[&(1 << 2)] } else { TRACKING_ARG_REVMAP[&0] }; let four = if (self.bits & (1 << 3)) > 0 { TRACKING_AR...
Rust
0
: 4) } // 8 bytes pub type DrawDataPushConstant = DrawDataStd430; pub type DrawDataBuffer = DrawDataStd430; #[derive(Copy, Clone, Debug)] #[repr(C)] pub struct BoundingSphereStd140 { pub position: [f32; 3], // +0 (size: 12) pub radius: f32, // +12 (size: 4) } // 16 bytes impl Default for BoundingSphe...
Rust
0
.get_mut::<DefaultLoader>().unwrap(); let prefab_handle: Handle<Prefab> = loader.load("prefab/test.prefab"); self.prefab_handle = Some(prefab_handle); } fn update(&mut self, data: &mut StateData<'_, GameData>) -> SimpleTrans { let StateData { world, resources, .. } = ...
Rust
0
eckUncompleteUsers(self): cnt = 0 for uname in self.Users: if type(uname) is not str: continue user = self.Users[uname] if user.NickName == '': cnt += 1 qDebug('uncomplete users cnt/total: %s/%s' % (str(cnt), str(len(self.Users)))) ret...
Python
1
import random # Lista corrigida palavras = ["márcia", "python", "desenvolvimento", "sistemas", "tecnologia"] palavra = random.choice(palavras).lower() # Transforma tudo em minúsculo letras_erradas = [] letras_certas = [] tentativas = 6 print("***** Bem-vindo ao Jogo da Forca *****") print("_ " * len(palavra)) # ...
Python
1
 c@s2dddddddddd d d d d dddddddgZdZddlZddlZddlZdefdYZyddlmZWne k reZnXd e fdYZ dZ defdYZ e ZZidZed Zed!ZeZd efd"Y...
Python
1
ind_element(By.NAME, "password") pw.send_keys(password, Keys.ENTER) await asyncio.sleep(5) # Now that we're logged in, try claiming await claim_spinpals_bonus(ctx, driver, channel) except TimeoutException as e: screenshot = "spinpals_login_error.png" driver.save_scr...
Python
1
| c == '\n'); } fn consume_line(chars: &mut Peekable<Chars>) -> String { chars.take_while(|&c| c != '\n').collect() } fn consume_until_whitespace(chars: &mut Peekable<Chars>) -> String { chars.take_while(|&c| !c.is_whitespace()).collect() } fn signed_smallest_le_bytes<S: AsRef<str>>(string: S) -> Result<Ve...
Rust
0
pose_msg.pose.orientation.w = 1.0 pose_msg.pose.orientation.x = 0.0 pose_msg.pose.orientation.y = 0.0 pose_msg.pose.orientation.z = 0.0 self.pose_pub.publish(pose_msg) except Exception as e: self.get_logger()....
Python
1
SYNC1_W { w: self } } #[doc = "Bit 2 - Synchronous Channel 2"] #[inline(always)] pub fn sync2(&mut self) -> SYNC2_W { SYNC2_W { w: self } } #[doc = "Bit 3 - Synchronous Channel 3"] #[inline(always)] pub fn sync3(&mut self) -> SYNC3_W { SYNC3_W { w: self } } ...
Rust
0
in quantization_results[quant]["failures"]: quantization_results[quant]["failures"][artifact_path["gpu"]] = [] quantization_results[quant]["failures"][artifact_path["gpu"]].append( {"line": line, "trace": stacktraces.pop(0)} ...
Python
1
"""Ufora scores processing package.""" __version__ = "0.1.0"
Python
1
root, leave_edge[1], get_blossom_edges(v, w, parent) ) i = path.index(leave_edge_match) # improve the matching by injecting the lifted path if i - 1 >= 0 and root in path[i]: ...
Python
1
l { hub: self.hub, _request: request, _parent: parent.to_string(), _delegate: Default::default(), _additional_params: Default::default(), } } } // ################### // CallBuilders ### // ################# /// Gets the latest state of a l...
Rust
0
en() { ms[i] *= 2; } assert_eq!(ms, vec![2, 4, 6, 8, 10, 12]); let mut ms = vec![1, 2, 3, 4, 5, 6]; for i in 0..ms.len() { let x = &mut ms[i]; *x *= 2; } assert_eq!(ms, vec![2, 4, 6, 8, 10, 12]); let g = vec![1, 2, 3, 4, 5, 6]; let glen = g.len(); for i in 0...
Rust
0
unc = create_single_element_elastic_force_vector_function(&quad, &quad_indices, &material, &quadrature); let a_approx = -approximate_jacobian(func, &u, &h); let diff = a - a_approx; assert!(diff.norm() < 1e-5); } #[test] fn element_stiffness_matrix_is_negative_derivative_of_forces_for_stvk_material_probl...
Rust
0
#!/usr/bin/env python3 # coding: utf-8 import sys, os import json import argparse import requests import hashlib import tarfile import zipfile def param_parser(): parser = argparse.ArgumentParser(description="") parser.add_argument('--pkg', dest="pkg", required=True, help='Available packages', choices=PACKAG...
Python
1
== 36 bytes //! //! assert_eq!(36, smth.size_hint()?); //! # Ok(()) //! # } //! //! # fn main() { run().unwrap(); } //! ``` //! //! Alternatively, `MtProtoSized` can be `#[derive]`d: //! //! ``` //! #[macro_use] //! extern crate serde_mtproto_derive; //! //! #[derive(MtProtoSized)] //! struct Something { //! n...
Rust
0
metadata.package_data_name(), operations, )?; let state_c = state_p.clone(); let global_progression_c = global_progression.clone(); let commit_stream = future::lazy(move |_| { debug!("end update package"); let mut state = &mut *state_c.borrow_mut(); ...
Rust
0
if list.is_null() { let empty = String::new(); return allocate_and_copy_string(&empty); } // Dereference of raw pointer requires an unsafe block. The pointer is // checked above to ensure it is not null. let data: Vec<String> = unsafe { (*list).get_list() }; let hold: usize = ...
Rust
0
# backend/llm/services/prompt_builder.py import re from datetime import datetime from pathlib import Path from typing import Dict from backend.utils.prompt_utils import extract_variables, apply_variables from backend.db.mcp_db import get_prompt_templates_by_ids def load_default_prompt() -> str: return Path("backen...
Python
1
from django.shortcuts import render, redirect, get_object_or_404 from django.db.models import Sum from .models import Expense, Category from .forms import ExpenseForm, CategoryForm from django.contrib.auth.decorators import login_required from django.contrib import messages from django.http import JsonResponse import ...
Python
1
; /// Looks "near" an existing solution. /// /// The user may wish to use information from the other solutions to build /// a variant of a given solution. So, rather than simply providing the /// solution to be varied, `explore` receives a slice of solution refs /// that give information on the...
Rust
0
types::PyModule; use std::hash::Hash; #[derive(Hash, PartialEq, Eq, Clone, Debug)] pub struct StringLiteral { value: AString, is_sql: bool, ancestors: AOption<AVec<AncestorRecord>>, } impl StringLiteral { pub fn new(value: AString, is_sql: bool) -> Self { assert!(value.len() > 0 || !is_sql); ...
Rust
0
ize"] pub struct XFERSIZE_W<'a> { w: &'a mut W, } impl<'a> XFERSIZE_W<'a> { #[doc = r"Writes raw bits to the field"] #[inline(always)] pub unsafe fn bits(self, value: u32) -> &'a mut W { self.w.bits = (self.w.bits & !0x0007_ffff) | (value as u32 & 0x0007_ffff); self.w } } #[doc = "Fi...
Rust
0
ad::spawn(t); let t1 = move | | { (* (r1.p)).x = 5; }; let handle1 = thread::spawn(t1); (& handle1).join(); let z = v; (& handle).join(); } <filename>src/test/debuginfo/generic-struct-style-enum.rs // ignore-tidy-linelength // min-lldb-version: 310 // Require LLVM with...
Rust
0
import datetime import pytest from openfisca_core import periods from openfisca_core.periods import DateUnit, Instant, Period @pytest.mark.parametrize( ("arg", "expected"), [ (None, None), (Instant((1, 1, 1)), datetime.date(1, 1, 1)), (Instant((4, 2, 29)), datetime.date(4, 2, 29)), ...
Python
1
# This file is part of django-ca (https://github.com/mathiasertl/django-ca). # # django-ca is free software: you can redistribute it and/or modify it under the terms of the GNU General # Public License as published by the Free Software Foundation, either version 3 of the License, or (at your # option) any later version...
Python
1
buf.buffer_size() as _, id_or_pos.mf_flag().0, ) } { 0 => return Err(GetLastError()), n => n, }; if (nchars as usize) + 1 < buf_sz { // to break, must have at least 1 char gap break; } buf_sz += BLOCK; // increase buffer size to try again } Ok(buf.to_string()...
Rust
0
self, path: &Path) -> Option<BufferId> { self.open_files.get(path).map(|id| *id) } /// Returns `true` if this file is open and has changed on disk. /// This state is stashed. pub fn check_file(&mut self, path: &Path, id: BufferId) -> bool { if let Some(info) = self.file_info.get_mut(&id...
Rust
0
to-IDLab/bTracked extern crate nalgebra as na; extern crate nalgebra_glm as glm; extern crate ncollide2d; extern crate particle_filter; extern crate probability; extern crate rand; extern crate rayon; extern crate serde; #[macro_use] extern crate serde_derive; extern crate serde_json; extern crate stats; pub mod filte...
Rust
0
# # 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 "License"); you may not us...
Python
1
self, v: String) -> Result<Self::Value, E> where E: serde::de::Error, { Ok(v) } fn visit_str<E>(self, v: &str) -> Result<Self::Value, E> where E: serde::de::Error, { Ok(v.to_string()) } fn visit_none<E>(self) -> Result<Self::Value, E> where E...
Rust
0
{} #[doc = "`write(|w| ..)` method takes [fmppe5::W](fmppe5::W) writer structure"] impl crate::Writable for FMPPE5 {} #[doc = "Flash Memory Protection Program Enable 5"] pub mod fmppe5; #[doc = "Flash Memory Protection Program Enable 6\n\nThis register you can [`read`](crate::generic::Reg::read), [`reset`](crate::gene...
Rust
0
ling APL. APL can # // change the contents of a, b, c, and d, but it # // can't change the values of x, y, z. # // BEFORE CALLING APL # x = & a; # y = & b; # z = & c; # // Brute force: spill all. # tc = *z; // spill *z to named storage for c # td = d; // spill d to named stor...
Python
1
} } access_with_defaults! { let code = module.sections[self.code_idx] (Code); let types = module.sections[self.types_idx] (Type); let functions = module.sections[self.functions_idx] (Function); let elements = module.sections[self.elements_idx] (Element); ...
Rust
0
from crewai.utilities.printer import Printer class Logger: _printer = Printer() def __init__(self, verbose_level=0): verbose_level = ( 2 if isinstance(verbose_level, bool) and verbose_level else verbose_level ) self.verbose_level = verbose_level def log(self, level, m...
Python
1
CheckReturn(ret) return msg @ensure_byte_strings() def dcgmProfPause(dcgmHandle): fn = dcgmFP("dcgmProfPause") ret = fn(dcgmHandle) dcgm_structs._dcgmCheckReturn(ret) return ret @ensure_byte_strings() def dcgmProfResume(dcgmHandle): fn = dcgmFP("dcgmProfResume") ret = fn(dcgmHandle) ...
Python
1
elf, reg: &mut Handlebars) -> Result<(), SourceError> { for (name, tpl) in self.0.iter() { reg.register_template_string(name, tpl.clone())? } Ok(()) } } #![doc(test(attr(deny(warnings))))] #![warn(missing_docs)] //! Library to parse and iterate over weather soundings retrieved fr...
Rust
0
= {}, used = {}\n", state.tip.as_ptr(), state.tip.capacity_bytes(), state.tip.len_bytes())?; for slab in state.used_slabs.iter().rev() { write!(f, " {:p}: size = {}, used = {}\n", slab.as_ptr(), slab.capacit...
Rust
0
""" client """ import socket import random import sys HOST = sys.argv[1] # 服务端地址 PORT = int(sys.argv[2]) # 服务端端口 lmin = int(sys.argv[3]) lmax = int(sys.argv[4]) if lmin > lmax or lmax > 1024: print("min 大于 max, 或者max 大于1024,请修改后重新尝试") sys.exit() FILE_PATH = 'ASCII.txt' # 需要发送的文本文件路径 segment_s...
Python
1
#[doc = " Get the flags of the theme"] #[doc = " Return: the flags"] pub fn lv_theme_get_flags() -> u32; } #[lvgl_macros::safe_wrap(attr)] extern "C" { #[doc = " Initialize the default"] #[doc = " - __`color_primary`__: the primary color of the theme"] #[doc = " - __`color_secondary`__: the secondar...
Rust
0
train_words = set() test_words = set() test_words_list = [] line_lists = [] train_all = [] test_all = [] train_tag = [] test_tag = [] with open("train.words.txt",'r',encoding="utf8") as f: for line in f.readlines(): train_all.extend(line.strip().split()) with open("train.tags.txt",'r',encoding="utf8") as f:...
Python
1
get_unknown_list_by_page(data): """ 查询所有未识别记录 """ PageNum = data.get("pagenum") if not PageNum: PageNum = 30 SearchStr = data.get("keyword") CurrentPage = data.get("page") if not CurrentPage: CurrentPage = 1 else: ...
Python
1
import json from .models import Event class EventFileManager: def __init__(self): # Intial FILE_PATH with the event file self.FILE_PATH = "event.json" def read_events_from_file(self) -> list[Event]: # Creat event list event_list = [] # Read event JSON file wit...
Python
1
orrow() .as_ref() .unwrap_ji() .iter() .map(clone!(state => move |style| { html!("image-search-style-option", { .property("slot", "style-options") .property("label", &style.display_name) ...
Rust
0
from stereo_matchers.matching_steps_handler import get_matching_steps_handler def get_report_log(args): rl = ReportLog(args) return rl class ReportLog: def __init__(self,args): self.matching_steps_handler = get_matching_steps_handler(args) self.root_mean_squared_log = {} self.bad_p...
Python
1
for s in style: #get index from value, working around possible gradio bug k = 0; while styles.styles_list[k][0] != s: k += 1 if "{prompt}" in styles.styles_list[k][1]: subprompt = styles.styles_list[k][1...
Python
1
"mpnews": { "articles": [ { "title": title, "thumb_media_id": media_id, "author": "Author", "content_source_url": "", "content": message.replace("\n", "<br...
Python
1
_const_PointX_int_const_ScalarR_int_int" => "-", "cv_fillPoly_MatR_const_PointXX_const_intX_int_const_ScalarR_int_int_Point" => "-", // 3.2 "cv_fillPoly_const__InputOutputArrayR_const_PointXX_const_intX_int_const_ScalarR_int_int_Point" => "-", "cv_polylines_MatR_const_PointXX_const_intX_int_bool_const_ScalarR_int_in...
Rust
0
_action = torch.tanh(acts) log_prob = dist.log_prob(acts).sum(dim=-1, keepdim=True) log_prob = log_prob - torch.log((1 - squashed_action.pow(2)) + self.__eps).sum(-1, keepdim=True) return Batch(logits=(mean,std), act=squashed_action, log_prob=log_prob, di...
Python
1
_budget = weight_limit .saturating_sub(base_weight) .saturating_sub(decoding_weight) .checked_div(weight_per_key) .unwrap_or(0) as u32; (weight_per_key, key_budget) } /// Delete as many items from the deletion queue possible within the supplied weight li...
Rust
0
ъилба ндебеле', 'chr': 'ᏧᎦᎾᏮ ᏂᏕᏇᎴ', 'ckb': 'ئندێبێلێی باشوور', 'cs': 'ndebele (Jižní Afrika)', 'cy': 'Ndebele Deheuol', 'da': 'sydndebele', 'de': 'Süd-Ndebele', 'dsb': 'pódpołdnjowa ndebelšćina', 'el': 'Νότια Ντεμπέλε', 'el-polyton': 'Νότια Ντεμπέλε', 'en': 'South Ndebele', 'es': 'ndebele meridional', 'et': 'lõunandebe...
Python
1
_details_46edcebd)] pub struct VrrpVrDetails { pub context : u32, pub config : VrrpVrConf, pub runtime : VrrpVrRuntime, pub n_addrs : u8, pub addrs : VariableSizeArray<Address>, } #[derive(Debug, Clone, Serialize, Deserialize, VppMessage)] #[message_name_and_crc(vrrp_vr_start_stop_0662a3b7)] pub struct V...
Rust
0
<'static> { debug_assert!(num <= 10, "This would overflow the instruction"); PartialInstruction::Complete(instruction, 0x7000 | (0x0800 >> num)) } fn io(instruction: Span, num: usize) -> PartialInstruction<'static> { debug_assert!(num <= 10, "This would overflow the instruction"); ...
Rust
0
(3) must grab this mutex. pub static ref PTSNAME_MTX: Mutex<()> = Mutex::new(()); /// Any test that alters signal handling must grab this mutex. pub static ref SIGNAL_MTX: Mutex<()> = Mutex::new(()); } use tests_build::tokio; #[tokio::main] fn main_is_not_async() {} #[tokio::main(foo)] async fn main_attr_...
Rust
0
) .unwrap() .is_claimed ); let res = handle(&mut deps, env.clone(), msg.clone()); match res { Err(StdError::GenericErr { msg, .. }) => assert_eq!(msg, "Already claimed"), _ => panic!("DO NOT ENTER HERE"), } // Claim next airdrop let msg = HandleMsg::Claim { ...
Rust
0
[0, 0, 0, 0, 90, -90] pers_dist = [] K = torch.eye(4).to(device) K[0,0] = K[0,2] = K[1,1] = K[1,2] = skybox_size/2 K = K.unsqueeze(0) for i in range(6): ### get skybox depths ### pers_depth = e2p(erp_dist, [90, 90], u_degs[i], v_degs[i], 0, [h, w]) ### convert ...
Python
1
.is_empty() { let len = buf.len(); Ok(Some(buf.split_to(len))) } else { Ok(None) } } } impl Encoder<Bytes> for BytesCodec { type Error = io::Error; fn encode(&mut self, data: Bytes, buf: &mut BytesMut) -> Result<(), io::Error> { buf.reserve(data....
Rust
0
ax is utilized to find the class label with largest probability for every pixel in the image classMap = np.argmax(pred[0], axis=0) # classes are mapped to their respective colours mask = COLORS[classMap] # resizing the mask and class map to match its dimensions with the input image mask = cv2.resize( mask, ...
Python
1
Ok(usize::from_be_bytes(output_array)) } // Computes I2OSP(len(input), max_bytes) || input pub(crate) fn serialize(input: &[u8], max_bytes: usize) -> Result<Vec<u8>, ProtocolError> { Ok([&i2osp(input.len(), max_bytes)?, input].concat()) } // Tokenizes an input of the format I2OSP(len(input), max_bytes) || inpu...
Rust
0
execute(OpCode::Swap4, OpHint::None); stack.execute(OpCode::Roll4, OpHint::None); stack.execute(OpCode::AssertEq, OpHint::None); stack.execute(OpCode::AssertEq, OpHint::None); stack.execute(OpCode::Dup, OpHint::None); stack.execute(OpCode::Drop4, OpHint::None); } fn gt_finale(stack: &mut Stack) { ...
Rust
0
"cpmCPUTotal5minRev": U32(4), "cpmCPUTotal1minRev": U32(4)}"##, r##"[2017-04-18 22:15:52.230092 +02:00] INFO [src/poller.rs:147] Polling result for host 10.12.1.5 {"cpmCPUTotal1minRev": U32(28), "cpmCPUTotal5minRev": U32(28), "cpmCPUTotal5secRev": U32(28)}"##, r##"[2017-04-18 22:15:52.590393 +02:00] INFO [src/p...
Rust
0
import pandas as pd df = pd.read_excel("dane.xlsx") print(df) print(df.head()) # pierwsze 5 df = pd.read_excel("dane.xlsx", usecols=["Imię", "Wiek"]) print(df) # Imię Wiek # 0 Anna 25.0 # 1 Jan 30.0 # 2 Maria 35.0 # 3 Piotr 40.0 # 4 Kasia NaN df = pd.read_excel("dane.xlsx", sheet_name="Produkty")...
Python
1
import numpy as np import json def load_RT(path): """ 0.9705157 0.035186626 0.2384557 -270.26154 -0.1084007 0.9473142 0.30140525 -291.6677 -0.21528703 -0.3183673 0.92319757 121.37361 """ extrin = [] with open(path, "r") as f: extrin = [[float(x) for x in f.readline().split()] ...
Python
1
ine <- expression ";"; fn expression_line(input: &str) -> IResult<&str, ast::Expression> { map(terminated(expression, tag(";")), |exp| exp)(input) } /// 式 /// /// expression <- comparative; fn expression(input: &str) -> IResult<&str, ast::Expression> { let (input, _) = multispace0(input)?; let (input, exp)...
Rust
0
pub async fn read(path: impl AsRef<Path>) -> anyhow::Result<Self> { let bytes = fs::read(path).await.context("read file")?; serde_json::from_slice(&bytes).context("parse secrets") } } <filename>src/native/java_lang_String.rs use crate::{ model::{JavaValue, RuntimeResult}, Classpath, JniEnv,...
Rust
0
# # # 数据去重 # # 界定去重的标准 # 年龄,姓名,什么的可以重复 # 通过身份证号,id,用户名(该用户名已存在)之类的来判断是否重复 # # 去重的时机 # 即将存储到数据库前 # 爬虫:数据获取的阶段(比如新闻的标题,时间等) from pymongo import MongoClient client = MongoClient("localhost", 27017) SPIDER_DB = client["spider"] studentDB = SPIDER_DB["student"] # # 模拟数据 # studentDB.insert_many( # [ # {"name"...
Python
1
2; pub const NRMASK: u32 = (1 << NRBITS) - 1; pub const TYPEMASK: u32 = (1 << TYPEBITS) - 1; pub const SIZEMASK: u32 = (1 << SIZEBITS) - 1; pub const DIRMASK: u32 = (1 << DIRBITS) - 1; /// Encode an ioctl command. #[macro_export] macro_rules! ioc { ($dir:expr, $ty:expr, $nr:expr, $sz:expr) => ( (($dir as ...
Rust
0
&self, ) -> SENSITIVE_DMA_APBPERI_ADC_DAC_PMS_CONSTRAIN_SRAM_WORLD_0_PMS_2_R { SENSITIVE_DMA_APBPERI_ADC_DAC_PMS_CONSTRAIN_SRAM_WORLD_0_PMS_2_R::new( ((self.bits >> 4) & 0x03) as u8, ) } #[doc = "Bits 2:3"] #[inline(always)] pub fn sensitive_dma_apbperi_adc_dac_pm...
Rust
0
is_null()); assert_eq!(tasks.len, 0); assert_eq!(tasks._capacity, 0); } #[test] fn free_sets_null_pointer() { let mut tasks = unsafe { TCTaskList::return_val(Vec::new()) }; // SAFETY: testing expected behavior unsafe { tc_task_list_free(&mut tasks) }; assert!...
Rust
0
le_size= 1, processing_res = processing_res, match_input_res = match_input_res, batch_size = batch_size, show_progress_bar = True, text_embed="to left") rendered_left_left = rendered_left_left * 255 ...
Python
1
""" URL configuration for tvshows_project project. The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/5.2/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: path('', views.home, na...
Python
1
update_obj = GroupedLightPut() if on is not None: update_obj.on = OnFeature(on=on) if brightness is not None: update_obj.dimming = DimmingFeaturePut(brightness=brightness) if color_xy is not None: update_obj.color = ColorFeaturePut(xy=ColorPoint(*color_xy)) ...
Python
1
use std::fs; use serde::{Deserialize, Serialize}; use std::time::Duration; pub mod vendor; pub const VERSION: &'static str = env!("CARGO_PKG_VERSION"); #[derive(Default, Serialize, Deserialize)] #[serde(default = "example_configuration")] pub struct Configuration { pub concentratord: Concentratord, pub gat...
Rust
0
, ) -> t.List[str]: """Simulate Unix shell expansion with Python functions. See :func:`glob.glob`, :func:`os.path.expanduser`, and :func:`os.path.expandvars`. This intended for use on Windows, where the shell does not do any expansion. It may not exactly match what a Unix shell would do. :par...
Python
1
pub fn desc_dma(&mut self) -> DESCDMA_W { DESCDMA_W { w: self } } #[doc = "Bits 24:25 - Periodic Scheduling Interval"] #[inline(always)] pub fn per_sch_intvl(&mut self) -> PERSCHINTVL_W { PERSCHINTVL_W { w: self } } #[doc = "Writes raw bits to the register."] #[inline(alw...
Rust
0
0 fn main() { println!("Learning DSL "); let code = "graph { graph [bgcolor="yellow"] a [color="red"] b [color="blue"] a -- b [color="green"] }"; }fn main() { let s = String::from("hello"); let len1 = String::len(&s); let len2 = s.len(); // shorthand for the abov...
Rust
0
s detection. :rtype: smqtk.representation.AxisAlignedBoundingBox :raises NoDetectionError: No detection AxisAlignedBoundingBox set yet. """ @abc.abstractmethod def get_classification(self): """ :return: The classification element of this detection. :rtype: smqtk...
Python
1
ix_l-1, S_pos[1])] = run_through_matrix_from(matrix, matrix_l-1, S_pos[1], REST) DP[(0, matrix_h-1)] = run_through_matrix_from(matrix, 0, matrix_h-1, REST) DP[(S_pos[0], matrix_h-1)] = run_through_matrix_from(matrix, S_pos[0], matrix_h-1, REST) DP[(matrix_l-1, matrix_h-1)] = run_through_matrix_from(matrix, matrix_l-1, ...
Python
1
from typing import Optional, Dict from .json_conversion import as_json from .Comorphism import Comorphism from .Signature import Signature from .HsWrapper import HsWrapper, HsHierarchyElement from .haskell import comorphismNameOfGMorphism, comorphismDescriptionOfGMorphism, signatureOfGMorphism, comorphismOfGMorphism,...
Python
1