text
string
label_name
string
labels
int64
# Copyright 2013 VMware, 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 required by a...
Python
1
v::R](R) reader structure"] impl crate::Readable for CHECONINV_SPEC { type Reader = R; } #[doc = "`write(|w| ..)` method takes [checoninv::W](W) writer structure"] impl crate::Writable for CHECONINV_SPEC { type Writer = W; } #[doc = "`reset()` method sets CHECONINV to value 0"] impl crate::Resettable for CHECON...
Rust
0
"""Here are example RSA keys that will be used with the autologing feature. Please generate your own keys and put them in your ENV""" PASSWORDLESS_PUBLIC_KEY_EXAMPLE = """-----BEGIN PUBLIC KEY----- MIGdMA0GCSqGSIb3DQEBAQUAA4GLADCBhwKBgQC2V1IguOhowyU+zB9mq9LnZ9ve ifPiODSeDhDQ7/njRoEJIvKm8TqVJUda7pFv3QrRLTkNBOlVICtVNC1Z...
Python
1
rer.compile_program(&shaders)?; state.borrow_mut().program_id = Some(program_id); let texture_id = webgl_renderer.create_texture()?; state.borrow_mut().texture_id = Some(texture_id); let future = async move { let mut webgl_renderer =...
Rust
0
gaits = {} not_all_ground_indices = np.where(np.sum(swing, axis=1) != 0)[0] contacts_gait = swing[not_all_ground_indices, :] gaits['Stand'] = np.mean(np.sum(swing, axis=1) == 0) gaits['Trotting'] = np.mean( ( np.logical_and(contacts_gait[:, 0], contacts_ga...
Python
1
clearance_triggered = True elif profit_pct >= 50: messages.append( f"🎯 **{symbol}** hit GAIN threshold: {profit_pct:.1f}% " f"(Cost: {avg_cost:.2f} | Current: {market_price:.2f})" ...
Python
1
consts = [] vars_ = [] signs = [] for param in params: param = param.strip() try: consts.append(float(param)) except ValueError: if param.startswith('-'): vars_.append(param[1:]) si...
Python
1
ignore it return; } error!("set panicked inside generator"); ContextStack::current().top().err = Some(cause); } // we can't panic inside the generator context // need to propagate the panic to the main thread if let Err(cause) = panic::catch_unwind(clo) { ch...
Rust
0
SRC OFFSET(14) NUMBITS(2) [ /// Select the 24MHz oscillator as source. SelectThe24MHzOscillatorAsSource = 0, /// Select the CLK1_N / CLK1_P as source. SelectTheCLK1_NCLK1_PAsSource = 1 ], /// Bypass the PLL. BYPASS OFFSET(16) NUMBITS(1) [], ...
Rust
0
import numpy as np import networkx as nx import numpy.typing as npt from scipy.sparse import csr_array def rowsum_mat(n): r"""Construct row-sum matrix for a symmetric zero-diagonal matrix. For a symmetric matrix :math:`\mathbf{A} \in \mathbb{R}^{n \\times n}`, let :math:`\mathbf{a} \in \mathbb{R}^{n(n-1)...
Python
1
test_vector::<U16, [u8; 32]>( hex!("314a202f836f9f257e22d8c11757832ae5131d357a72df88f3eff0ffcee0da4e"), hex!("a544218dadd3c10583db49cf39"), &hex!("3c0e2815d37d844f7ac240ba9d6e3a0b2a86f706e885959e09a1005e024f6907"), &hex!("e8de970f6ee8e80ede933581b5bcf4d837e2b72baa8b00...
Rust
0
buffer, 0); seph::handle_event(&mut self.apdu_buffer, &spi_buffer); } match unsafe { G_io_app.apdu_state } { APDU_USB_HID => unsafe { io_usb_hid_send( io_usb_send_apdu_data, self.tx as u16, self.apdu_buf...
Rust
0
or::Unknown) } } } impl Multihash for Sha3256 { type Digester = digester::Sha3_256; fn name(&self) -> &'static str { "sha3-256" } fn code(&self) -> Uvar { Uvar::from(0x16) } fn length(&self) -> u8 { 32 } fn digest_primitive(&self, tag: Tag, bytes:...
Rust
0
Some(c) => return Ok(c), None => { c -= 1; } } } } } impl Arbitrary for AtomicBool { fn arbitrary<U: Unstructured + ?Sized>(u: &mut U) -> Result<Self, U::Error> { Arbitrary::arbitrary(u).map(AtomicBool::new) } } impl Arbitrary for AtomicIsize { fn...
Rust
0
й связи # Пока убрали их из функционала #def click_checkbox_radio_button(self): #self.click_element(checkbox_radio_button) def text_popup_form_feedback(self): return self.remove_newline(popup_form_feedback) # Вводит данные в поле "Введите Ваш комментарий" в форме обратной связи def...
Python
1
for textures. ''' self.runTextureTest('absolute', withEnvVar=False) def testExportAutomaticTexture(self): ''' Test that texture can be exported with automatic reltive or absolute paths for textures. ''' self.runTextureTest('automatic', withEnvVar=False) ...
Python
1
dergraph::juniper::InputValue<wundergraph::scalar::WundergraphScalarValue>>, ) -> std::option::Option<#filter> { use wundergraph::query_builder::selection::filter::InnerFilter; std::option::Option::Some( wundergraph::query_builder::selection::filter::Filte...
Rust
0
htmost // depends on lr, either being 1 (left) or 2 (right) fn addside(pair: Tree, val: u8, lr: u8) -> Tree { if pair.cont.is_left() { return Tree { cont: Left(pair.cont.unwrap_left() + val) }; } let (sp1, sp2) = *(pair.cont.unwrap_right()); let newpair = if lr == 2 { (sp1, addside(sp2, val, lr)...
Rust
0
Display}; use std::path::PathBuf; pub use crate::pattern::*; pub use crate::xform::*; use serde::{Deserialize, Serialize}; fn default_format() -> OutputFormat { OutputFormat::Simple } fn default_verbosity() -> Verbosity { Verbosity::NotVerbose } fn default_number() -> u32 { 15 } fn default_pretty() -> b...
Rust
0
ine.chars().count() > 100) // .collect(); // sentences.par_iter().for_each(|sentence| { // cls.predict(sentence); // }); // } // } // } // } // // parallel on records // fn pipeline_wet_seq_rec_par_sen_seq() { // let la...
Rust
0
#!/usr/bin/env python """ This is a stress test for the fastevents module. *Fast events does not appear faster!* So far it looks like normal pygame.event is faster by up to two times. So maybe fastevent isn't fast at all. Tested on windowsXP sp2 athlon, and freebsd. However... on my debian duron 850 machine fastev...
Python
1
from django.urls import path from .views import ProductsApiView, ProductsListCreateApiView app_name = 'api' urlpatterns = [ path('products_with_generic_view/', ProductsListCreateApiView.as_view()), # Первый вариант решения path('products_with_base_view/', ProductsApiView.as_view()), # Второй вариант решени...
Python
1
return Vec::new(); } if size < 4 { return helper_random_array_uniform_u64(size); } let limit = (size as f64 / ((size as f64).log2() * 1.1)) as u64; (0..size) .into_par_iter() .map(|i| (size - 1 - i) as u64 % limit) .collect::<Vec<u64>>() } // Pipe Organ pub...
Rust
0
into(), &in_scheme.into(), &label.into(), &mut message, ) }; let ret = Error::from_tss_rc(ret); if ret.is_success() { let data = unsafe { PublicKeyRsa::try_from(*message)? }; Ok(data) } else { ...
Rust
0
from rest_framework import serializers from .models import Car,User,Booking from django.contrib.auth.hashers import make_password class CarSerializer(serializers.ModelSerializer): class Meta: model=Car fields=['id','name','brand','description','price','is_available','created_at','rating','image','v...
Python
1
`." ) if snntorch.__version__ < "0.9.0": raise ValueError("Exporting to NIR requires snntorch version >= 0.9.0") if snntorch.__version__ >= "0.9.0": from snntorch.export_nir import export_to_nir nir_graph = export_to_nir(self.model.__net__(), dummy_input, **...
Python
1
AT_WRITE_PMP_ENTRY") self.mAssemblyHelper.addLabel("NOT_INSTR") self.mAssemblyHelper.genMoveImmediate(scratch_reg_index, 5) # set R bit self.mAssemblyHelper.genConditionalBranchToLabel( ec_code_reg_index, scratch_reg_index, 6, "NE", "NOT_LOAD" ) self.mAssemblyHelper....
Python
1
Self::Address, AddressError> { TronAddress::from_private_key(self, _format) } } impl<N: TronNetwork> TronPrivateKey<N> { /// Returns a private key given a secp256k1 secret key. pub fn from_secp256k1_secret_key(secret_key: &secp256k1::SecretKey) -> Self { Self{secret_key: secret_key.clone(),...
Rust
0
) -> fmt::Result { match self { FileType::Regular => write!(f, "regular file"), FileType::Directory => write!(f, "directory"), FileType::Symlink => write!(f, "symbolic link"), #[cfg(unix)] FileType::BlockDevice => write!(f, "block device"), #[cfg(unix)...
Rust
0
: xcb_timestamp_t, pub size_id: u16, pub rotation: u16, pub rate: u16, pub pad0: [u8; 2], } impl Default for xcb_randr_set_screen_config_request_t { fn default() -> Self { unsafe { std::mem::MaybeUninit::zeroed().assume_init() } } } /// The `RandR::SetScreenConfig` reply. #[derive(Copy...
Rust
0
ster you can [`read`](crate::generic::Reg::read), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about avail...
Rust
0
#[inline] fn cache_line_size() -> u64 { CTR_EL0.read(cache_line_size!($cache)) } } }; } define_cache_op!(ICache, Invalidate, PoU); define_cache_op!(DCache, Clean, PoU); define_cache_op!(DCache, Clean, PoC); define_cache_op!(DCache, Invalidate, PoC); define_cache...
Rust
0
use common::utils::mount_template_var; use controllers::upload::{create_upload_folder, run_clean_temp_task}; fn main() { log4rs::init_file("log4rs.yaml", Default::default()).unwrap(); let mut chain = Chain::new(routes::gen_router()); chain.link_before(FlowControl); let mut hbs_engine = HandlebarsEn...
Rust
0
[doc(hidden)] pub struct _DIEP0_INT; #[doc = "`read()` method returns [diep0_int::R](diep0_int::R) reader structure"] impl crate::Readable for DIEP0_INT {} #[doc = "`write(|w| ..)` method takes [diep0_int::W](diep0_int::W) writer structure"] impl crate::Writable for DIEP0_INT {} #[doc = "Device IN Endpoint x+1 Interrup...
Rust
0
\w.])', Keyword.Declaration), # Reserved Words (r'(for|in)(?![\w.])', Keyword.Reserved), # Builtins # Need to use lookahead because . is a valid char (r'({})(?=\s*\()'.format(r'|'.join(_FUNCTIONS + _DISTRIBUTIONS ...
Python
1
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright 2013 Communications Engineering Lab (CEL) / Karlsruhe Institute of Technology (KIT) # # This 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...
Python
1
#!/usr/bin/python -i # # ps_test.py # # This source file is part of the FoundationDB open source project # # Copyright 2013-2024 Apple Inc. and the FoundationDB project authors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You ma...
Python
1
data] z_fr = [p[5] for p in plotdata] x_bl = [p[6] for p in plotdata] y_bl = [p[7] for p in plotdata] z_bl = [p[8] for p in plotdata] x_br = [p[9] for p in plotdata] y_br = [p[10] for p in plotdata] z_br = [p[11] for p in plotdata] # logger.save_log('trajectory_generators', 'traj_data',...
Python
1
import os from tqdm import tqdm import openai from evaluators.evaluator import Evaluator from time import sleep import re from openai import OpenAI class ChatGPT_Evaluator(Evaluator): def __init__(self, choices, k, api_key,model_name,base_url): super(ChatGPT_Evaluator, self).__init__(choices, model_name, ...
Python
1
ADAPTERS_LEN: usize = 15 * 1024; use crate::ifaces::{Interface, Kind, NextHop}; #[link(name = "Iphlpapi")] extern "system" { pub fn GetAdaptersAddresses( family: ULONG, flags: ULONG, reserved: PVOID, addresses: *mut u8, size: PULONG, ) -> ULONG; } #[repr(C)] pub struct...
Rust
0
https://my-service.endpoint.net").unwrap()).is_ok()); } #[test] fn test_service_endpoint_invalid_query() { let did_url = did(); assert!(matches!( service_endpoint_ctor( did_url.clone().join("?query=this").unwrap(), &Url::parse("https://my-service.endpoint.net?query=this").unwrap() ...
Rust
0
#!/usr/bin/env python3 import subprocess import json import os import tqdm params = list(range(100, 14101, 500)) # exe_files = ['./build/particle_sim_device'] exe_files = ['./build/particle_sim', './build/particle_sim_device'] def calculating(): for exe_file in exe_files: results = {} for param i...
Python
1
import logging import pcapi.core.offers.factories as offers_factories from pcapi.sandboxes.scripts.creators.industrial.create_industrial_event_occurrences import EventOccurrence from pcapi.sandboxes.scripts.utils.helpers import log_func_duration from pcapi.sandboxes.scripts.utils.select import remove_every from pcapi....
Python
1
import numpy as np def box2cs(box, aspect_ratio, enlarge_factor=1.0): """ box( x y w h ) convert to center and scale """ x, y, w, h = box[:4] return xywh2cs(x, y, w, h, aspect_ratio, enlarge_factor) def cs2box(center, scale, pixel_std=200, pattern="xywh"): """ center, scale conv...
Python
1
""" The pretty (i.e. indented) JSON representation of this progress. """ assert self._jdict is not None or self._jprogress is not None if self._jprogress: return self._jprogress.prettyJson() else: return json.dumps(self._jdict, indent=4) def __...
Python
1
c<LogicalDevice>, status: FenceStatus) -> VulkanResult<Self> { let flags = Self::create_flags(status); let create_info = vk::FenceCreateInfo::builder() .flags(flags); let vk_fence = unsafe { logical_device.create_fence(&create_info, None) }.map_err(|result| Vulka...
Rust
0
ly #[test] fn anchors_properly_emitted() -> Result<(), KytheError> { // Create an emitter that writes to the ArrayWriter. This makes it easier to // look at the emitted Entry protobufs. let mut array_writer = ArrayWriter::new(); let mut emitter = EntryEmitter::new(&mut array_writer); // Create anch...
Rust
0
mbol::new("d") => Value::Number(NumberValue::Int(4)) ])) ); test_file!(float, Ok(Value::Number(NumberValue::Float(0.0002124)))); test_file!(add_coerce, Ok(Value::Number(NumberValue::Float(3.5)))); test_file!(add_float, Ok(Value::Number(NumberValue::Float(3.5)))); test_file!(sub_coerce, Ok(Value::Number(NumberValue:...
Rust
0
status_eq() { assert_eq!(Status::OK, Status::OK); assert_eq!(Status::OK, "OK"); assert_eq!(&Status::OK, "OK"); assert_eq!(Status::OK, 200); assert_eq!("OK", Status::OK); assert_eq!("OK", &Status::OK); assert_eq!(200, Status::OK); } #[test] fn status_from() { assert!(Status::from_code(2...
Rust
0
em partition check_call('virt-make-fs --partition=gpt --size=+1M --type=vfat %s %s' % (mnt_point, image_path), shell=True) check_call('sgdisk %s -A 1:set:0 -t 1:C12A7328-F81F-11D2-BA4B-00A0C93EC93B' % image_path, shell=True) except CalledProcessError as excepti...
Python
1
execjs.compile(scriptStr) fun_res = ctx.call(fun_str, param) cookies = fun_res.replace("document.cookie='", "") cookies = cookies.replace("'; window.document.location=document.URL", "") header = {"cookie": cookies} # print("get 到了cookies") return header def cookie2session(cookies): if cook...
Python
1
e/Research", "License :: OSI Approved :: GNU General Public License (GPL)", "Operating System :: MacOS :: MacOS X", "Operating System :: Microsoft :: Windows", "Operating System :: POSIX", "Operating System :: Unix", "Programming Language :: Python...
Python
1
advanced bit manipulation } pub mod edx { pub const PDPE1GB_BITINDEX: u32 = 26; // 1-GByte pages are available if 1. } } pub mod leaf_0x80000008 { pub const LEAF_NUM: u32 = 0x8000_0008; pub mod ecx { use crate::bit_helper::BitRange; // The number of bits in the initial Ap...
Rust
0
+ struct.pack("<I", height) request_id = hash256(request_id_buf)[::-1].hex() message_hash = block.hash quorum_member = None for mn in self.mninfo: res = mn.node.quorum('sign', 100, request_id, message_hash) if res and quorum_member is None: quoru...
Python
1
anister_test_id(42); let cb_id = CallbackId::from(1); let cc_id = ccm.new_call_context(CallOrigin::CanisterUpdate(id, cb_id), Cycles::from(30)); assert_eq!( ccm.call_context_mut(cc_id) .unwrap() .withdraw_cycles(Cycles::from(40)), Err(Call...
Rust
0
# coding=utf-8 # Copyright 2020 The Google AI Language Team Authors, Facebook AI Research authors and The HuggingFace Inc. team. # Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the L...
Python
1
+\.\d{9}$") batch = generate_batch(schema, num_rows, rng) assert len(batch) == num_rows for row in batch: assert isinstance(row["c_bool"], bool) assert isinstance(row["c_int64"], int) assert isinstance(row["c_float64"], float) assert isinstance(row["c_numeric"], str) ...
Python
1
#[error( r#"No private key has been attached to that device. Missing file: {path:?} Run `tedge cert create` to generate a new key and certificate. "# )] KeyNotFound { path: FilePath }, #[error( r#"A private key already exists and would be overwritten. Existing fi...
Rust
0
import pandas._testing as tm def test_head_tail(string_series): tm.assert_series_equal(string_series.head(), string_series[:5]) tm.assert_series_equal(string_series.head(0), string_series[0:0]) tm.assert_series_equal(string_series.tail(), string_series[-5:]) tm.assert_series_equal(string_series.tail(0...
Python
1
luded in the learnable parameters of this layer. cropping : None or [crop] Cropping for each input axis. Cropping is described in the docstring for :func:`autocrop` Notes ----- Depending on your architecture, this can be used to avoid the more costly :class:`ConcatLayer`. For examp...
Python
1
_memory() < self.size >> 1_i32 { self.restart_model(); } else { while (*self.max_context).suffix != 0 { self.max_context = self.base.offset((*self.max_context).suffix as isize) as *mut libc::c_void as *mut CPpmd8Context } ...
Rust
0
uring application close: {e}") # Still save window state and allow closing even if other operations fail try: from monstim_gui.core.ui_config import ui_config ui_config.save_window_state(self) except Exception as e2: logging.error(f"Er...
Python
1
filtered_df_display = filter_data_efficiently(df_master, filter_dict, limit=2000) # Filter data LENGKAP untuk export (tanpa limit) filtered_df_full = filter_data_efficiently(df_master, filter_dict, limit=None) # Export button dengan data LENGKAP (tidak di-...
Python
1
25, Some("75101".to_string()), ), Index::new( NaiveDate::from_ymd_opt(today.year(), today.month(), today.day()).unwrap(), None, vec!["pm10".to_string()], 50, Some("75101".to_string())...
Rust
0
import argparse import json import requests from llava.conversation import default_conversation def main(): if args.worker_address: worker_addr = args.worker_address else: controller_addr = args.controller_address ret = requests.post(controller_addr + "/refresh_all_workers") ...
Python
1
("<b>ʏᴏᴜʀ ᴍᴇꜱꜱᴀɢᴇ ɪꜱ ᴅᴇʟᴇᴛᴇᴅ !\nᴋɪɴᴅʟʏ ꜱᴇᴀʀᴄʜ ᴀɢᴀɪɴ.</b>") return elif data.startswith("all"): protect_content=True user_id = message.from_user.id files = temp.GETALL.get(file_id) if not files: return await message.reply('<b><i>ɴᴏ ꜱᴜᴄʜ ꜰɪʟᴇ ᴇxɪꜱᴛꜱ !</b></...
Python
1
, xa))); // Taylor expansion of sin and cos, valid for -pi/4 <= x <= pi/4 let x2 = x * x; let x4 = x2 * x2; let mut s = x2.poly_p::<P>(&[ -1.66666666666666307295E-1, 8.33333333332211858878E-3, -1.98412698295895385996E-4, 2.755731362138572...
Rust
0
u64, pub max: u64, pub slot_pubkeys: HashMap<Slot, SlotRepairs>, } impl RepairStatsGroup { pub fn update(&mut self, repair_peer_id: &Pubkey, slot: Slot, shred_index: u64) { self.count += 1; let slot_repairs = self.slot_pubkeys.entry(slot).or_default(); // Increment total number of ...
Rust
0
return 7; } //Jumping from decode to last byte if state.column == dimensions.decoded.0 && Direction::Left == direction { return 7; } //Jumping between bytes if state.column >= dimensions.bytes.0 && state.column <= dimensions.bytes.1 { return 5; } 1 } // Implements ...
Rust
0
from constructs import Construct from aws_cdk import ( aws_lambda as _lambda ) class Boto3(Construct): def __init__(self, scope: Construct, construct_id: str, **kwargs) -> None: super().__init__(scope, construct_id, **kwargs) boto3_layer = _lambda.LayerVersion( self, "boto3", ...
Python
1
lections(schema: &mut Schematic) -> Result<(), Error> { schema.define_collection::<database::Database>()?; #[cfg(feature = "multiuser")] { schema.define_collection::<group::PermissionGroup>()?; schema.define_collection::<role::Role>()?; schema.define_collecti...
Rust
0
test_type(-12123127i64); test_type(2147483647i64); test_type(-10170482028482i64); } #[test] fn test_float() { test_type(0.2313f32); test_type(0f32); test_type(123123213f32); test_type(-123123f32); } #[test] fn test_double() { test_typ...
Rust
0
"}"), TermData::RecordElim(head_term, label) => (alloc.nil()) .append(from_term_prec(alloc, head_term, Prec::Atomic)) .append(".") .append(alloc.text(label)), TermData::ArrayTerm(term_entries) | TermData::ListTerm(term_entries) => (alloc.nil()) .append("[...
Rust
0
UINT32, ); /* Ssiz_i */ l_current_ptr = l_current_ptr.offset(1); /* XRsiz_i */ opj_write_bytes_LE( l_current_ptr, (*l_img_comp).dx, 1 as libc::c_int as OPJ_UINT32, ); /* YRsiz_i */ l_current_ptr = l_current_ptr.offset(1); opj_write_bytes_LE( l_current_ptr, (*l_img_c...
Rust
0
archive. link Links the file from alternative paths. cat Reads files from the PAK archive and writes to stdout. rm Removes paths from the PAK archive. mv Moves files in the PAK archive. fsck File system consistency check. gc Collects garbage left behind by removed ...
Rust
0
SelectNode, "DevToolsLoadAnimatedImageTest": LoadAnimatedImageTest, "DevToolsNodeWithValidation": NodeWithValidation, "DevToolsNodeWithV2ComboInput": NodeWithV2ComboInput, } NODE_DISPLAY_NAME_MAPPINGS = { "DevToolsErrorRaiseNode": "Raise Error", "DevToolsErrorRaiseNodeWithMessage": "Raise Error wit...
Python
1
View.__init__(self, plotter) if namespace is None: namespace = f'{plotter._id_name}' if interactive_ratio is None: interactive_ratio = plotter._theme.trame.interactive_ratio if still_ratio is None: still_ratio = plotter._theme.trame.still_ratio VtkRemo...
Python
1
shLong, 0xD), Expr.Equ, Expr.Return, ), 'loc_57E', ) OP_99(0x00FE, 0x06, 0x07, 1355) def _loc_57E(): pass label('loc_57E') If( ( (Expr.PushLong, 0x1), Expr.Return, ), 'loc_593', ) OP_99(0x00FE, 0x00,...
Python
1
import os root_data_dir = '../../' dataset = 'Dataset/MIND-large' behaviors = 'mind_60w_users.tsv' news = 'mind_60w_items.tsv' logging_num = 4 testing_num = 1 bert_model_load = 'bert_base_uncased' freeze_paras_before = 0 news_attributes = 'title' mode = 'train' item_tower = 'modal' epoch = 300 load_ckpt_name = 'No...
Python
1
e in i) for num in &mut numbers { *num += 100; dbg!(num); } dbg!(&numbers); } //@ Collections // data stored in the heap, can grow or shrink // length no need to be known at compile time // Vector, String, Hashmapuse bincode::config; use criterion::{black_box, criterion_group, criterion_ma...
Rust
0
", "perpetual") .send() .await; let text = match hibp { Ok(res) => res.text().await, Err(_) => return false, }; match text { Ok(body) => body .split("\r\n") .map(|s| Some(s.split(':').next()?)) .find(|pw| pw.map(|s| format!("{}{}", ...
Rust
0
# Multiples of 2 and 3: # -------------------- start = 1 end = 20 start = 6 while start<=20: print(start, end= " ") start+=6 # Other Method: # ------------ while start <= end : if start % 2 == 0 and start % 3 == 0: print(start, end =" ") start += 1
Python
1
# Python sets # Mutability: # Tuples: Immutable, meaning you cannot modify their elements once created. # Sets: Mutable, meaning you can add or remove elements. # Order: # Tuples: Ordered, meaning the elements maintain their original insertion order. # Sets: Unordered, meaning the elements do not have a specific orde...
Python
1
try '{a}={DEFAULT_CFG_DICT[a]}'\n{CLI_HELP_MSG}" ) else: check_dict_alignment(full_args_dict, {a: ""}) # Check keys check_dict_alignment(full_args_dict, overrides) # Mode mode = overrides.get("mode") if mode is None: mode = DEFAULT_CFG.mode or "predict" ...
Python
1
# products/serializers/unitConversionSerializer.py from rest_framework import serializers from products.models.unitConversion import UnitConversion from products.models.unit import Unit from company.models.company import Company from company.models.business_type import BusinessType from company.models.factory import Fa...
Python
1
from flask.views import MethodView from flask_smorest import Blueprint, abort from sqlalchemy.exc import SQLAlchemyError, IntegrityError from db import db from models import StoreModel from schemas import StoreSchema, ItemSchema blp = Blueprint("Stores", __name__, description="Operations on stores") @blp.route("/s...
Python
1
import pandas as pd import numpy as np from sklearn.metrics import accuracy_score,classification_report,confusion_matrix from sklearn.utils.class_weight import compute_class_weight import joblib import xgboost as xgb def load_data(file_path): """ Load the preprocessed data from a CSV file. """ print(f"...
Python
1
a21; out[8] = x * a02 + y * a12 + a22; *out } /// Rotates a mat3 by the given angle. /// /// [glMatrix Documentation](http://glmatrix.net/docs/module-mat3.html) pub fn rotate(out: &mut Mat3, a: &Mat3, rad: f32) -> Mat3 { let a00 = a[0]; let a01 = a[1]; let a02 = a[2]; let a10 = a[3]; let...
Rust
0
from django.contrib import admin from .models import PlayerSearchHistory, UserProfile class PlayerSearchHistoryAdmin(admin.ModelAdmin): list_display = ['user', 'player_name', 'position', 'team', 'search_timestamp'] list_filter = ['user', 'position', 'team'] search_fields = ['user__username', 'first_name', ...
Python
1
# -*- coding: utf-8 -*- # This program 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. # # This program is distributed ...
Python
1
unlinkat( resolved.dirfd().as_raw_fd(), resolved.path(), AtFlag::empty(), )? }; Ok(()) } pub(crate) fn symlink(old_path: &str, resolved: PathGet) -> Result<()> { use yanix::file::symlinkat; log::debug!("path_symlink old_path = {:?}", old_path); ...
Rust
0
_OUT_OF_HOST_MEMORY, CL_PROFILING_INFO_NOT_AVAILABLE, CL_MEM_COPY_OVERLAP, CL_IMAGE_FORMAT_MISMATCH, CL_IMAGE_FORMAT_NOT_SUPPORTED, CL_BUILD_PROGRAM_FAILURE, CL_MAP_FAILURE, CL_MISALIGNED_SUB_BUFFER_OFFSET, CL_EXEC_S...
Rust
0
ody_in_root_list.isLightBulbOn = (body_in_root_list.entityToken == target_body_for_export.entityToken) adsk.doEvents() if task["type"] == "support": if support_param and support_param.isValid: support_param.expression = str(task["units"]) ...
Python
1
let mut bytes = [255; 20]; super::change_base(bytes.as_mut(), out.as_mut(), 256, 62); }) } #[bench] fn bench_change_base_from_62(b: &mut test::Bencher) { let mut out = vec![0; 20]; let mut bytes = vec![0; 27]; let mut max_id = [0xff; 20]; super::cha...
Rust
0
# 在一条环路上有 n 个加油站,其中第 i 个加油站有汽油 gas[i] 升。 # 你有一辆油箱容量无限的的汽车,从第 i 个加油站开往第 i+1 个加油站需要消耗汽油 cost[i] 升。你从其中的一个加油站出发,开始时油箱为空。 # 给定两个整数数组 gas 和 cost ,如果你可以按顺序绕环路行驶一周,则返回出发时加油站的编号,否则返回 -1 。如果存在解,则 保证 它是 唯一 的。 def canCompleteCircuit(gas, cost): """ :type gas: List[int] :type cost: List[int] :rtype: int """ ...
Python
1
self.memory.get(ptr, self.scratch_buf.as_mut_slice()).map_err(|_| sp_sandbox::HostError)?; Ok(()) } /// Read designated chunk from the sandbox memory into the supplied buffer, consuming /// an appropriate amount of gas. /// /// Returns `Err` if one of the following conditions occurs: /// /// - calculating ...
Rust
0
convert_base(l, self.n, self.m) .iter() .map(|&l_j| { let mut l_ji = vec![Scalar::zero(); self.n - 1]; l_ji.insert(l_j, Scalar::one()); l_ji }) .collect() ...
Rust
0
__version__ = "0.9.0" from ._types import ExportType, RequestAction from .actions import action from .base import BaseAdmin from .fields import ( ArrowField, BaseField, BooleanField, CollectionField, ColorField, CountryField, CurrencyField, DateField, DateTimeField, DecimalField...
Python
1
let plen = plaintext.len(); let mut ciphertext_and_tag = plaintext.clone(); ciphertext_and_tag.resize(plen + Aes128CcmNLen13TagLen10::TAG_LEN, 0); let cipher = Aes128CcmNLen13TagLen10::new(&key); cipher.encrypt_slice(&nonce, &aad, &mut ciphertext_and_tag); assert_eq!( &ciphertext_and_tag...
Rust
0
import numpy as np import cv2 from landmark import util class ARUCO_DICT(): def __init__(self): self.DICT_4X4_50 = cv2.aruco.DICT_4X4_50 self.DICT_4X4_100 = cv2.aruco.DICT_4X4_100 self.DICT_4X4_250 = cv2.aruco.DICT_4X4_250 self.DICT_4X4_1000 = cv2.aruco.DICT_4X4_1000 self.DI...
Python
1