text
string
label_name
string
labels
int64
star = """ <svg width="20" height="20"> <polygon points="10,0 13,7 20,7 14,12 16,19 10,15 4,19 6,12 0,7 7,7" style="fill:gold; stroke:gold; stroke-width:1px;" /> </svg> """ template_drop = """ <tr> <td class="short-column"> <img src="{{ icon }}"></img> </td> <td class="short-column" style="colo...
Python
1
DOWN | KERN_CODESIGN_ERROR | KERN_POLICY_STATIC => io::ErrorKind::InvalidData, KERN_OPERATION_TIMED_OUT => io::ErrorKind::TimedOut, _ => io::ErrorKind::Other, } } ...
Rust
0
/// This method will block the thread with `spawn_local` /// /// # Example /// /// ```rust, ignore /// fn main() { /// dioxus_web::launch_with_props( /// App, /// RootProps { name: String::from("joe") }, /// |config| config /// ); /// } /// /// #[derive(ParitalEq, Props)] /// struct Roo...
Rust
0
result.push(bitmask.chars().nth(idx).unwrap()); } } let floating_bits = result.matches('X').count(); let positions: Vec<usize> = result .match_indices('X') .collect::<Vec<(usize, &str)>>() .iter() .map(|c| c.0) .collect(); let combinations = ...
Rust
0
(1, 2)); let target = (2, 2); let normalized = normalize_direction(&source, &target); assert_eq!(normalized, (-1, -2)); } #[test] fn test_angle() { let source = (3, 4); let target = (3, 0); let angle = calculate_angle(&source, &target); assert!(an...
Rust
0
MemoryKeywords::xmmword_ptr => &ac.xmmword_ptr, MemoryKeywords::ymmword_ptr => &ac.ymmword_ptr, MemoryKeywords::zmmword_ptr => &ac.zmmword_ptr, }; let bcst_kind: BroadcastToKind = unsafe { mem::transmute(d >> BROADCAST_TO_KIND_SHIFT) }; let bcst_to = match bcst_kind { BroadcastToKind::None => ...
Rust
0
# Code generated by Lark OpenAPI. from typing import Any, Optional, Union, Dict, List, Set, IO, Callable, Type from lark_oapi.core.construct import init from .follower import Follower class ListTaskFollowerResponseBody(object): _types = { "items": List[Follower], "page_token": str, "has_m...
Python
1
t, z_norm, timesteps): # determine noise alpha hat sqrt_alpha_t = torch.sqrt(self.alphas[timesteps])[:, None] # determine noise betas betas_t = self.betas[timesteps][:, None] # determine noise one minius alpha hat sqrt_one_minus_alpha_hat_t = torch.sqrt(1 - self.alphas...
Python
1
None; self.signature = None; self.active = None; } } <reponame>datashape/nps<gh_stars>0 // Copyright 2015 <NAME> <<EMAIL>> // // 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 Licens...
Rust
0
.check_read(&[0x99, 0x98], 10) .check_read(&[0x97], 10) .verify(); } #[test] fn test_tlsstreamwrapper_read_tls_buffer_shorter_than_header() { let stream = MockTcpStream::default() .add_golden_read([ 0x12, 0x01, 0x00, 0x0b, 0x00, 0x00, ...
Rust
0
cts" : updated_contracts } } print(f"{options_chain_identifier=}") # Publish the update to all within the group async_to_sync(get_channel_layer().group_send)( options_chain_identifier, group_update ...
Python
1
import os import sys import re from setuptools import setup, find_packages import pkg_resources __pkg_name__ = 'duplex_tools' __dist_name__ = 'duplex_tools' __author__ = 'ont-research' __description__ = 'Range of tools to support operations on Duplex Sequencing read pairs.' # Use readme as long description and say...
Python
1
#!/usr/bin/python3 """ UTF-8 Validation """ # Define the function validUTF8 that takes a list of integers (data) as input def validUTF8(data): """ Data: a list of integers Return: True if data is a valid UTF-8 encoding, else return False """ # Initialize byte_count to 0 byte_count = 0 ...
Python
1
# BOJ_11123 : 양 한마리... 양 두마리 ... import sys from collections import deque # input = sys.stdin.readline sys.stdin = open('input.txt') # bfs 방식으로 양 탐색 def find_sheep(x, y): q = deque() q.append([x, y]) while q: nx, ny = q.popleft() for di, dj in [[0, 1], [1, 0], [0, -1], [-1, 0]]: ...
Python
1
: f32 = 15./41.; const ATOM_ATOM_RADIUS_SQUARED: f32 = (ATOM_RADIUS*2.)*(ATOM_RADIUS*2.); const ATOM_ARM_RADIUS_SQUARED: f32 = (ATOM_RADIUS+ARM_RADIUS)*(ATOM_RADIUS+ARM_RADIUS); const ATOM_SPAWN_RADIUS_SQUARED: f32 = (ATOM_RADIUS+SPAWNING_ATOM_RADIUS)*(ATOM_RADIUS+SPAWNING_ATOM_RADIUS); ...
Rust
0
y contiguous ranges in /// the vector. /// * `ordered_prims_offset - Index in `ordered_prims` for start of this node. /// * `bit_index` - The bit index. fn emit_lbvh( arena: &SharedArena<BVHBuildNode>, primitives: &[ArcPrimitive], max_prims_in_node: usize, primitiv...
Rust
0
#!/usr/local/bin/python3 import json from Crypto.Util.number import getPrime from Crypto.Cipher import AES from Crypto.Util.Padding import pad from secrets import randbelow, token_bytes from hashlib import sha256 with open('flag.txt') as f: flag = f.read() p = getPrime(512) q = getPrime(512) n = p * q e = 65537 d...
Python
1
T NULL, ReporterOrganisation VARCHAR(50) DEFAULT NULL, EquipmentType VARCHAR(100) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=COMPACT;", ()).expect("Failed to create table: friction_data"); pool.prep_exec(r"CREATE TABLE IF NOT EXISTS ca...
Rust
0
FormattedItems}; /// let items_short = vec![ /// Item::new("/home/tkadur/.dotfiles/file1", "/home/tkadur/.file1"), /// Item::new("/home/tkadur/.dotfiles/file2", "/home/tkadur/.file2"), /// ]; /// /// # let str_short_expected = [ /// # "/home/tkadur/.dotfiles/file1 -> /home/tk...
Rust
0
mediates), Mediate::PrefixedArray(ref mediates) => encode_head_tail(mediates), Mediate::PrefixedArrayWithLength(ref mediates) => { // + `WORD_SIZE` added to offset represents len of the array prepanded to tail let mut result = [u32_to_word(mediates.len() as u32)]....
Rust
0
# Copyright (c) 2024 PaddlePaddle 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 appli...
Python
1
import unittest from datetime import date from Fake_data_app.Sensor import Sensor class TestVisitSensor(unittest.TestCase): """ Unit tests for the Sensor class. """ def test_sensor_initialization(self) -> None: """ Test that the Sensor object is initialized with the correct attribute...
Python
1
zxdg_shell_v6 protocol, its earlier version mod zxdgv6_handlers; /// The role of an XDG toplevel surface. /// /// If you are checking if the surface role is an xdg_toplevel, you should also check if the surface /// is an [zxdg_toplevel] since the zxdg toplevel role is equivalent. /// /// [zxdg_toplevel]: self::ZXDG_TO...
Rust
0
{ match self.display_string() { Ok(s) => write!(f, "{}", s), Err(e) => write!(f, "<Cannot display value: {}>", e), } } } impl<'scope, T: Wrapper<'scope, 'static>> WrapperPriv<'scope, '_> for SimpleVector<'scope, T> { type Wraps = jl_svec_t; const NAME: &'static str ...
Rust
0
self.chain_id = chain_id; check_canary!(); self.update_remainder(next_data); Ok(()) } #[inline(never)] fn read_auth(&mut self) -> Result<(), ParserError> { let (next_data, auth) = TransactionAuth::from_bytes(self.remainder) .map_err(|_| ParserError::par...
Rust
0
[doc = " Using this action on non-matching traffic will result in"] #[doc = " undefined behavior."] pub const rte_flow_action_type_RTE_FLOW_ACTION_TYPE_DEC_TCP_SEQ: rte_flow_action_type = 46; #[doc = " Increase acknowledgment number in the outermost TCP header."] #[doc = ""] #[doc = " Action configuration specifies the...
Rust
0
Parentheses 1", exevalator.eval("(1.2 + 3.4)"), 1.2 + 3.4 ); check( "Test of Parentheses 2", exevalator.eval("(1.2 + 3.4) + 5.6"), (1.2 + 3.4) + 5.6 ); check( "Test of Parentheses 3", exevalator.eval("1.2 + (3.4 + 5.6)"), 1.2 + (3.4 + 5....
Rust
0
size: Some(1<<10), port: None, hash_result: Err(curl::Error::new(22).to_string()), //CURLE_HTTP_RETURNED_ERROR }, FilePortHashResultPair { file: String::from( "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources...
Rust
0
################################################################### # [국내주식] 종목정보 > 종합 시황/공시(제목) [국내주식-141] ############################################################################################## df = news_title(fid_news_ofer_entp_code="", fid_cond_mrkt_cls_code="", fid_input_iscd="", fid_titl_cntt="", ...
Python
1
""" Inferring a binomial proportion using PyMC. """ import matplotlib.pyplot as plt plt.style.use('seaborn-darkgrid') import numpy as np import pymc3 as pm # Generate the data y = np.array([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0]) # 11 heads and 3 tails with pm.Model() as model: # define the prior theta =...
Python
1
# Mercury: 37.6% MERCURY: float = 37.6 # Venus: 88.9% VENUS: float = 88.9 # Mars: 37.8% MARS: float = 37.8 # Jupiter: 236.0% JUPITER: int = 236.0 # Saturn: 108.1% SATURN: float = 108.1 # Uranus: 81.5% URANUS: float = 81.5 # Neptune: 114.0% NEPTUNE: float = 114.0 def main(): earth_weight: float = float(input("Ent...
Python
1
m: self.dim, length: self.length, quadrants: self.quadrants.iter().enumerate().map(|(ix, quadrant)| { if (ix == quadrant_ix) { quadrant.orient(&top_corner, &spin, &self.length) } else { quadrant.clone() } ...
Rust
0
#[derive(Clone, Debug, PartialEq)] pub enum OpCode { Add(Mode, Mode, Mode), Multiply(Mode, Mode, Mode), Halt, Input(Mode), Output(Mode), JumpIfTrue(Mode, Mode), JumpIfFalse(Mode, Mode), LessThan(Mode, Mode, Mode), Equals(Mode, Mode, Mode), AdjustBase(Mode), Noop } impl Inter...
Rust
0
= swarm_position; for i in 0..swarm_count { let ship_mesh_handle = asset_server.load("models/ship/player/PlayerShip01_AA.gltf#Mesh0/Primitive0"); let ship_material_handle = asset_server.load("models/ship/player/PlayerShip01_AA.gltf#Material0"); ...
Rust
0
# Generated by Django 3.2.18 on 2023-03-04 07:21 import InvenTree.fields from django.db import migrations import djmoney.models.fields import djmoney.models.validators class Migration(migrations.Migration): dependencies = [ ('order', '0077_auto_20230129_0154'), ] operations = [ migratio...
Python
1
permit2 = cdp.openapi_client.models.create_swap_quote_response_all_of_permit2.CreateSwapQuoteResponse_allOf_permit2( hash = '0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef', eip712 = {"domain":{"name":"Permit2","chainId":1,"verifyingContract":"0x000000000022D...
Python
1
o_run #[macro_use] extern crate dlopen_derive; extern crate dlopen; use dlopen::wrapper::{Container, WrapperApi, WrapperMultiApi}; //Define 3 APIs: #[derive(WrapperApi)] struct Obligatory{ some_fun: unsafe extern "C" fn() } #[derive(WrapperApi)] struct Optional1<'a>{ static_val: &'a i32 } #[derive(WrapperAp...
Rust
0
_(self, message=None, innerException=None): """ __new__(cls: type) __new__(cls: type, message: str) __new__(cls: type, message: str, innerException: Exception) __new__(cls: type, info: SerializationInfo, context: StreamingContext) """ pass def __reduce_ex_...
Python
1
o not call any comparing function if any type is supported DataType::Log => Box::new(stream.filter(|event| match event { Event::Log(_) => true, _ => false, })), DataType::Metric => Box::new(stream.filter(|event| match event { Event::Metric(_) => true, ...
Rust
0
import loguru import requests import re import execjs headers = { "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7", "Accept-Language": "zh-CN,zh;q=0.9", "Cache-Control": "no-cache", "Connection": "keep-ali...
Python
1
from collections import deque def solve(grid): h, w = len(grid), len(grid[0]) dirs = [(1,0),(-1,0),(0,1),(0,-1)] def find_comps(cond): seen = [[False]*w for _ in range(h)] comps = [] for i in range(h): for j in range(w): if not seen[i][j] and cond(grid[i]...
Python
1
system" { } // // FUSE arguments (see fuse_opt.h for details) // pub struct fuse_args { argc: c_int, argv: **c_char, allocated: c_int, } // // FUSE common (see fuse_common_compat.h for details) // extern "system" { pub fn fuse_mount_compat25 (mountpoint: *c_char, args: *fuse_args) -> c_int; #[cfg(not(target_os...
Rust
0
dices = {v: k for k, v in self.class_indices.items()} labels = [inv_class_indices[label] for label in labels] if self.data_format == "channels_first": imgs = np.array([np.swapaxes(img, 0, 2) for img in imgs]) if not 'figsize' in plt_kwargs: plt_kwargs['figsize'] = (...
Python
1
i32, y: i32); #[doc = "*Required features: `\"Win32_Graphics_OpenGL\"`*"] pub fn glVertex2iv(v: *const i32); #[doc = "*Required features: `\"Win32_Graphics_OpenGL\"`*"] pub fn glVertex2s(x: i16, y: i16); #[doc = "*Required features: `\"Win32_Graphics_OpenGL\"`*"] pub fn glVertex2sv(v: *const i1...
Rust
0
# Code generated by Lark OpenAPI. from typing import Any, Optional, Union, Dict, List, Set, IO, Callable, Type from lark_oapi.core.model import BaseRequest from lark_oapi.core.enum import HttpMethod, AccessTokenType from .batch_query_external_background_check_request_body import BatchQueryExternalBackgroundCheckReques...
Python
1
sh(Transition::observe(0, state.plan.time_to_play, state.plan.max_z)); Self::try_add_push_robot(&state.plan.simulator, &state.plan, &mut result); Self::try_add_take_nitro_pack(&state.plan, &mut result); result } } pub fn try_add_push_robot<'c, 'a, G>(simulator: &Si...
Rust
0
nt, details, m, sts) sts.add('total_files') await asyncio.sleep(sleep) except Exception as e: await msg_edit(m, f'<b>Error :</b>\n<code>{e}</code>', wait=True) temp.IS_FRWD_CHAT.remove(sts.TO) return await stop(client, user) temp...
Python
1
# 本文が空または短すぎる場合は除外 if not body or len(body) <= self.min_body_length: continue # 本文がURLのみかチェック if self._is_url_only_body(body): continue filtered_news.append(news) return filtered_news def...
Python
1
import socket import time from picamera2 import Picamera2 from picamera2.encoders import H264Encoder from picamera2.outputs import FileOutput # Configure the camera cam = Picamera2() vid_config = cam.create_video_configuration({"size": (1280, 720)}) cam.configure(vid_config) encoder = H264Encoder(1000000) cam.encoder...
Python
1
"{config_file} does not exist") with open(config_file, "r") as f: config = json.load(f) config["_class_name"] = cls.__name__ config["down_block_types"] = [ "CrossAttnDownBlock3D", "CrossAttnDownBlock3D", "CrossAttnDownBlock3D", "DownBlo...
Python
1
failure::err_msg)?; if elf.header.pt2.type_().as_type() != header::Type::Relocatable { bail!("object file is not relocatable") } // shndx -> (address -> [symbol-name]) let mut is_64_bit = false; let (shndx2names, symtab2shndx) = match elf .find_section_by_name(".symtab") .o...
Rust
0
ClearValue { vk::ClearValue { depth_stencil: vk::ClearDepthStencilValue { depth: self.depth, stencil: self.stencil, }, } } } <gh_stars>0 #![feature(collections)] #![feature(convert)] #![feature(time)] #![feature(duration)] #![feature(wait_t...
Rust
0
动平均 point_error = original - reconstructed point_error_s = pd.Series(point_error) error_ma = point_error_s.rolling(window=cfg['ma_window'], center=cfg['center_window'], min_periods=1).mean() # 计算移动RMSE (右轴数据) moving_rmse = calculate_moving_rmse(original, reconstructed, window=cfg['ma_window'], cent...
Python
1
loops. Continue, } /// Identifiers, e.g. var names. #[derive(Debug, Clone, PartialEq)] pub struct Identifier { pub file_position: FilePosition, pub identifier: String, pub type_params: Vec<Box<SahaType>> } /// Expressions. #[derive(Debug, Clone, PartialEq)] pub struct Expression { pub file_positi...
Rust
0
(shard, ipfs_hash.clone()); <WorkerForShard>::insert(shard, sender_index); log::debug!("block confirmed with shard {:?}, block hash {:?}, ipfs_hash {:?}", shard, block_hash, ipfs_hash); Self::deposit_event(RawEvent::BlockConfirmed(sender, block_hash)); Self::deposit_event...
Rust
0
ct2a, color2) # assign junk color table ds2, err = gdalattachpct.doit(src_filename=src_filename, pct_filename=ct2a) ct2b = color_table.get_color_table(ds2) assert ( err == 0 and ds2 is not None and color_table.are_equal_color_table(ct2a, ct2b) ) ds2 = None # pct from gdal.ColorTabl...
Python
1
new(ucd); let mut gc_gen = GeneralCategoryGen::new(); let mut script_gen: UnicodeGen<Script> = UnicodeGen::new(); let mut djt_gen: UnicodeGen<DerivedJoiningType> = UnicodeGen::new(); gc_gen.add(Box::new(ViramaTableGen::new("virama"))); script_gen.add(Box::new(UcdTableGen::new("Greek", "Greek"))); ...
Rust
0
..] { let count: u8 = count.parse()?; return match command { "up" => Ok(MoveCmd::Up(count)), "down" => Ok(MoveCmd::Down(count)), "forward" => Ok(MoveCmd::Forward(count)), _ => Err(anyhow::anyhow!("Parse error: Invalid command")), ...
Rust
0
cheese = [62.170522479538235, 62.352262846998556, 68.09748860518283, 70.0, 70.0, 70.0, 62.76138396661784, 69.58151600226324, 68.81223920005392, 67.53182096460327, 68.63125152350973, 57.38940915936472, 65.41989294808599, 57.972700552089584, 57.8973555643291, 57.89845166207431, 64.58626238765275, 62.54212025741045, 59.05...
Python
1
l: [ to_limb(0x531221a410efc95b), to_limb(0x72819306027e9717), to_limb(0x5ecefb937068b746), to_limb(0x97de59cd6feaefd7), to_limb(0xdc35c51158644588), to_limb(0xb2d176c04f2100), ], ...
Rust
0
.height() - 1) } else { Err(anyhow!("xlsx parse error")) } } /// 上交所 科创板 68 开头(目前 350 只,只需一次请求) => stockType=8, pagesize=400 /// A 股 60 开头(目前 1650 只,只需一次请求) => stockType=1, pagesize=1700 pub async fn get_sh_stocks(set: Arc<StockList>, stocktype: &str, pagesize: &str) -> Result<usize> { let c...
Rust
0
ms_private_key, &mut None)); } Ok(authentication_path) } pub fn sign_fast_verify( lms_private_key: &mut LmsPrivateKey<H>, message: &mut [u8], ) -> Result<LmsSignature<H>, ()> { let lm_ots_private_key = lms_private_key.use_lmots_private_key()?; let ots_signa...
Rust
0
mc_mint_auditor_api::Counters::new(); dst.set_num_blocks_synced(src.num_blocks_synced); dst.set_num_burns_exceeding_balance(src.num_burns_exceeding_balance); dst.set_num_mint_txs_without_matching_mint_config( src.num_mint_txs_without_matching_mint_config, ); dst ...
Rust
0
type Labels = transport::labels::Key; fn transport_labels(&self, proto: &proxy::server::Protocol) -> Self::Labels { transport::labels::Key::accept("outbound", proto.tls.peer_identity.as_ref()) } } pub fn trace_labels() -> HashMap<String, String> { let mut l = HashMap::new(); l.insert("dir...
Rust
0
mut header) { eprintln!("ignore invalid file '{}'", p); continue; } if &header[..7] != MAGIC_NUM { eprintln!("ignore invalid file '{}'", p); continue; } let random = header[7]; let mut original_name_len = 0u8.to_le_bytes(); ...
Rust
0
import numpy as np import pytest from akuire.acquisition import Acquisition, AcquisitionResult from akuire.compilers.default import compile_events from akuire.config import SystemConfig from akuire.engine import AcquisitionEngine from akuire.events import AcquireZStackEvent, DataEvent, ImageDataEvent, MoveEvent from a...
Python
1
import numpy as np def dynamic_window_approach(state, goal, obstacles, max_speed=1.0, max_turn=1.0, dt=0.1): x, y, theta = state dx, dtheta = 0.0, 0.0 best_cost = float('inf') best_trajectory = None for linear_speed in np.linspace(-max_speed, max_speed, 5): for angular_speed in np.linspa...
Python
1
correct + 1 end end "#, ) .exec() .unwrap(); let correct = globals.get::<_, usize>("correct").unwrap(); assert_eq!(correct, 6); }); } #![allow(clippy::module_inception)] #![allow(clippy::too_many_arguments)] #![allow(clippy::ptr...
Rust
0
primary_key(ownership_id)] pub struct Ownership { pub ownership_id: String, pub token_id: String, pub owner: String, pub amount: i64, pub updated_at: chrono::NaiveDateTime, pub inserted_at: chrono::NaiveDateTime, } impl Ownership { pub fn new( token_id: String, owner: String...
Rust
0
"] MODE2, #[doc = "WINLT < RESULT < WINUT"] MODE3, #[doc = "!(WINLT < RESULT < WINUT)"] MODE4, #[doc = r" Reserved"] _Reserved(u8), } impl WINMODER { #[doc = r" Value of the field as raw bits"] #[inline] pub fn bits(&self) -> u8 { match *self { WINMODER::DISAB...
Rust
0
from django.contrib.auth import get_user_model from django.contrib.auth.models import AbstractUser from django.db import models class CustomUser(AbstractUser): email = models.EmailField(unique=True) birth_date = models.DateField(null=True, blank=True) organization = models.CharField(max_length=255, null=T...
Python
1
from typing import List from collections import deque def solve(grid: List[List[int]]) -> List[List[int]]: h, w = len(grid), len(grid[0]) comp_id = [[-1]*w for _ in range(h)] dirs = [(1,0),(-1,0),(0,1),(0,-1)] comps = {} cid = 0 for i in range(h): for j in range(w): if grid[...
Python
1
"""test_cmd_version.py: Test the command version with basic integration tests. """ from enum import Enum from fprime_gds.common.testing_fw import predicates from fprime_gds.common.utils.event_severity import EventSeverity """ This enum is includes the values of EventSeverity that can be filtered by the ActiveLogge...
Python
1
', "jí"), ('䐖', "xī"), ('䐗', "zhū,dǔ"), ('䐘', "jué"), ('䐙', "gé"), ('䐚', "jī"), ('䐛', "dā"), ('䐜', "chēn"), ('䐝', "suò"), ('䐞', "ruò"), ('䐟', "xiǎng,gōu"), ('䐠', "huǎng"), ('䐡', "qí"), ('䐢', "zhù,zhòu,chù"), ('䐣', "sǔn"), ('䐤', "chāi,cuó"), ('䐥', "wěng"), ...
Rust
0
def _default_valid_step(self, batch): if isinstance(batch, dict): output = self.model(**batch) elif isinstance(batch, list) and isinstance(batch[0], dict): output = self.model(batch) else: input, target = batch output = self.model(input) if not...
Python
1
, 4, true), /* 0x1E */ (Operation::ASL, AddressingMode::ABX, 7, false), /* 0x1F */ (Operation::SLO, AddressingMode::ABX, 7, false), /* 0x20 */ (Operation::JSR, AddressingMode::ABS, 6, false), /* 0x21 */ (Operation::AND, AddressingMode::IZX, 6, false), /* 0x22 */ (Operation::KIL, AddressingMode::IMP, 9, false)...
Rust
0
or for setup, this is the main entry function that registers the plugin. /// /// Currently, the one dissector that's handed in is stored in a global static. During setup we use it as a mutable /// after setup it will be immutable and multiple threads from wireshark may interact with it. pub fn setup<T: 'static + Dissec...
Rust
0
RT5$U$[S[[U55-S-5e)N#Unexpected type when broadcasting: ! rEr#r)utilsis_cpu_scalar_tensor same_shaper_r RuntimeErrorstrr:)rQr_rkr}s r<__maybe_broadcast+_maybe_broadcast.<locals>.__maybe_...
Python
1
e", -20.4427778, -54.6463890, 602.0), City::new(1487, "Brazil", "Jaboatao", -8.1802778, -35.0013885, 62.0), City::new(1488, "Brazil", "Osasco", -23.5325000, -46.7916679, 633.0), City::new(1489, "Brazil", "<NAME>", -23.6638889, -46.5383339, 765.0), City::new(1490, "Brazil", "<NAME>", -7.1150000, -34.8630562, 3.0), ...
Rust
0
_json_value(&formatted_message).unwrap(), json!({ "body": "Testing **bold** and _italic_!", "formatted_body": "<p>Testing <strong>bold</strong> and <em>italic</em>!</p>\n", "format": "org.matrix.custom.html", "msgtype": "m.text" }) ); let plain_me...
Rust
0
from download_ucd import download_ucd_data OUTPUT_PATH = "src/data.rs" GCB_DEPR = ["EB","EBG","EM","GAZ"] ENUM_MAP = { ("XX", "None", "Y"): "EP", ("XX", "Consonant", "N"): "IN_CO", ("EX", "Extend", "N"): "IN_EX", ("EX", "Linker", "N"): "IN_LI", ("ZWJ", "Extend", "N"): "ZWJ", } for gcb in ["XX", "LF","CR","CN", "...
Python
1
_printf; use wasmer_runtime_core::vm::Ctx; /// putchar pub fn putchar(ctx: &mut Ctx, chr: i32) { unsafe { libc::putchar(chr) }; } /// printf pub fn printf(ctx: &mut Ctx, memory_offset: i32, extra: i32) -> i32 { debug!("emscripten::printf {}, {}", memory_offset, extra); unsafe { let addr = emscrip...
Rust
0
# MIT License # Copyright 2020 Toyota Research Institute. All rights reserved. # Adapted from SfmLearner # https://github.com/ClementPinard/SfmLearner-Pytorch/blob/master/models/PoseExpNet.py import torch import torch.nn as nn #########################################################################################...
Python
1
_layout = SplitLayoutController::new(split_layout_settings); let show_min_size = false; let margin = 10.0; let mut gl = GlGraphics::new(opengl); let mut events = Events::new(EventSettings::new()); while let Some(e) = events.next(&mut window) { let window_size = window.size(); let sp...
Rust
0
ps """ return batch_norm_template(inputs, is_training, scope, [0,1,2], bn_decay) def batch_norm_for_conv3d(inputs, is_training, bn_decay, scope): """ Batch normalization on 3D convolutional maps. Args: inputs: Tensor, 5D BDHWC input maps is_training: boolean tf.Varialbe, true indicates trai...
Python
1
import numpy as np import pickle import logging import chess from raspberryturk import RaspberryTurkError, opt_path from raspberryturk.core.data.raw_pixels_extractor import RawPixelsExtractor from raspberryturk.core.data.class_encoding import empty_or_not def _convert_to_32bit_pca(pca): pca.components_ = pca.compo...
Python
1
from sklearn.metrics import roc_curve import matplotlib.pyplot as plt y_true = [0, 0, 0, 0, 1, 1, 1, 1] y_score = [0.2, 0.3, 0.6, 0.8, 0.4, 0.5, 0.7, 0.9] roc = roc_curve(y_true, y_score) print(type(roc)) # <class 'tuple'> print(len(roc)) # 3 fpr, tpr, thresholds = roc_curve(y_true, y_score) print(fpr) # [0. 0....
Python
1
// we're exiting with an error code anyway. let _ignored = writeln!(io::stderr(), "{}", err); process::exit(2); } }; let mut stderr = StandardStream::stderr(ColorChoice::Auto); match ruby::run(args, io::stdin(), &mut stderr) { Ok(Ok(())) => {} Ok(Err(())...
Rust
0
import re from vyper.exceptions import StructureException def validate_identifier(attr, ast_node=None): if not re.match("^[_a-zA-Z][a-zA-Z0-9_]*$", attr): raise StructureException(f"'{attr}' contains invalid character(s)", ast_node) if attr.lower() in RESERVED_KEYWORDS: raise StructureExcepti...
Python
1
# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the Apache License, Version 2.0 # found in the LICENSE file in the root directory of this source tree. import itertools import math import torch import torch.nn as nn import torch.nn.functional as F _DINOV2_BASE_URL = "https...
Python
1
word = 0b000101 << 26; buffer[0..4].clone_from_slice(&u32::to_le_bytes(insn_word)); (veneer_offset, LabelUse::Branch26) } // This is promoting a 26-bit call/jump to a 32-bit call/jump to // get a further range. This jump translates to a jump to a ...
Rust
0
.QotMarketState,沪市状态 #[prost(int32, required, tag="3")] pub market_sh: i32, ///Qot_Common.QotMarketState,深市状态 #[prost(int32, required, tag="4")] pub market_sz: i32, ///Qot_Common.QotMarketState,港股期货市场状态 #[prost(int32, required, tag="5")] pub market_hk_future: i32, ///Qot_Common.Qo...
Rust
0
(test)] pub(crate) fn parse_single_event(buf: &[u8]) -> Event { let fst = buf[0]; let parse_fn = if (fst < 32 && fst != 13) || fst == 127 { parse_key_comb } else { parse_chars }; let (ev, used) = match parse_fn(buf) { Some((ev, used)) => (ev, used), None => (Event::U...
Rust
0
our_eth_address, bytes_to_hex_str(&eth_signature.to_bytes()), bytes_to_hex_str(&message), ); let confirm = proto::ContractCallTxConfirmation { ethereum_signer: our_eth_address.to_string(), signature: eth_signature.to_bytes().to_vec(), ...
Rust
0
import csv from nodo import Nodo from conexion import Conexion class LecturaArchivos: def __init__(self): self.nodos = {} self.conexiones = [] def leer_nodos(self, ruta_archivo): with open(ruta_archivo, newline='') as archivo: lector = csv.DictReader(archivo) fo...
Python
1
ove<N, P>(mut mutation: N, ab: ArcKey) -> Result<Arc<Data<P::Graph>>, GraphError> where N: AsMut<Mutation<P>>, P: Mode, P::Graph: Mutable, { // TODO: Is is probably more correct to disconnect the source vertex // from its leading arc. However, this interacts poorly ...
Rust
0
# Copyright (c), Mysten Labs, Inc. # SPDX-License-Identifier: Apache-2.0 """ A bidirectional network traffic forwarder that bridges TCP/IP and VSOCK sockets, enabling communication between host machines and enclaves. Referenced from https://github.com/aws-samples/aws-nitro-enclaves-workshop/blob/main/resources/code/my...
Python
1
: -9223372036854775808, "increment": 1}, ) eq_(type(col["identity"]["start"]), int) eq_(type(col["identity"]["increment"]), int) elif col["name"] == "id4": eq_(col["identity"], {"start": 1, "increment": 1}) eq_(type(col["identit...
Python
1
import numpy as np def gaussian_filter(image, k_size, sigma): """ Applies a Gaussian filter to the input grayscale image. Parameters: image (np.ndarray): Input grayscale image as a 2D NumPy array. k_size (int): Size of the kernel. Must be an odd integer. sigma (float): Standard deviation for G...
Python
1
2 { use std::convert::TryInto; unsafe { ffi::sfRectangleShape_getPointCount(self.rectangle_shape) .try_into() .unwrap() } } fn point(&self, index: u32) -> Vector2f { unsafe { Vector2f::from_raw(ffi::sfRectangleShape_getPoint...
Rust
0