text
string
label_name
string
labels
int64
print("Hello my name is Adonis!")
Python
1
import math import numpy as np def inverse_kinematics(p: tuple[float, float, float], r: tuple[float, float, float]) -> tuple[float, float, float, float]: x_target, y_target, z_target = p roll, pitch, yaw = r cr, sr = (math.cos(roll), math.sin(roll)) cp, sp = (math.cos(pitch), math.sin(pitch)) cy, s...
Python
1
x = sucds::RsBitVector::from_bits(&bits, true, true); idx.size_in_bytes() }; print_memory("RsBitVector(true,true)", bytes); let bytes = { let idx = sucds::DArray::from_bits(&bits); idx.size_in_bytes() }; print_memory("DArray", bytes); let bytes = { let idx = suc...
Rust
0
dkg_runtime_primitives::offchain::crypto::OffchainAuthId; type NextSessionRotation = pallet_session::PeriodicSessions<Period, Offset>; type RefreshDelay = RefreshDelay; type KeygenJailSentence = Period; type SigningJailSentence = Period; type DecayPercentage = DecayPercentage; type Reputation = Reputation; type ...
Rust
0
target_feature = "ssse3" ))] fn scalar_and_sse_return_same_values() { let data: Vec<u8> = (0..=255).cycle().take(1024 * 30 + 3).collect(); let cap = (data.len() * 4 + 2) / 3; let mut buf1 = String::with_capacity(cap); let mut buf2 = String::with_capacity(cap); unsafe { ...
Rust
0
url = "http://127.0.0.1:3300/songlist?id=" + linkid async with session.get( url, timeout=ClientTimeout(total=5)) as r: resp_json = await r.json() songs = resp_json.get("data", ...
Python
1
FF + 1)] for jian in char_list: jian_jyutping = ToJyutping.get_jyutping_candidates(jian)[0] jian_jyutpingList = [x for x in jian_jyutping[1]] if jian_jyutpingList: default_pinyin[jian] = jian_jyutpingList fan = zhconv.convert(jian, "zh-hant") fan_jyutping = ToJyu...
Python
1
== value { lits.push(lit); } else { lits.push(!lit); } } } None => {} } } lits } } impl fmt::Display for Puzzle { fn fmt(&self...
Rust
0
[constants.JDBCTOJDBC_OUTPUT_CREATE_TABLE_OPTION] output_jdbc_mode: str = args[constants.JDBCTOJDBC_OUTPUT_MODE] output_jdbc_batch_size: int = args[constants.JDBCTOJDBC_OUTPUT_BATCH_SIZE] temp_view: str = args[constants.JDBCTOGCS_TEMP_VIEW_NAME] sql_query: str = args[constants.JDBCTOJDBC...
Python
1
essage is also used for replying to an RPC call. Rpc(Token, Vec<u8>), /// Completely shutdown the `Reactor` and event loop. All current listeners /// and connections will be dropped. Shutdown } /// Communication from the `Reactor` to outside components happens with a `Dispatch` message /// and normal R...
Rust
0
import faker import pandas as pd import pytest from typing_extensions import Generator from sdgx.data_connectors.generator_connector import GeneratorConnector from sdgx.data_loader import DataLoader from sdgx.data_models.metadata import Metadata from sdgx.data_processors.formatters.datetime import DatetimeFormatter C...
Python
1
""" Simulate diffraction from a given pattern displayed on the DMD. Do simulations both in "1D", i.e. considering only diffraction in the tx=-ty plane, and in "2D", i.e. considering the full output space. Unlike simulate_multicolor_sim_patterns_1d.py, this file simulates the same input angles for all wavelength consid...
Python
1
import numpy as np import pandas as pd import cloudpickle import matplotlib.pyplot as plt from sklearn.model_selection import train_test_split #Automcompletar rápido #%config IPCompleter.greedy=True from janitor import clean_names from sklearn.preprocessing import OneHotEncoder from sklearn.preprocessing import Ord...
Python
1
/5034 // For clippy lints see: https://rust-lang.github.io/rust-clippy/master // For rustc lints see: https://doc.rust-lang.org/rustc/lints/index.html #![cfg_attr(not(feature = "std"), no_std)] // #![forbid(unsafe_code)] #![warn( // Enable sets of warnings clippy::all, clippy::pedantic, clippy::cargo, ...
Rust
0
# ~ ROCK PAPER SCISSORS ~ # # This is a simple program I wrote to get warmed back up into programming after taking some time off. # It allows the user to play Rock, Paper, Scissors with a single opponent, track how many points they # have collected and tells the winner if they lose or win. # # Author: Bethany Grentz #...
Python
1
} unsafe { PICS.lock() .notify_end_of_interrupt(InterruptIndex::Keyboard.as_u8()); } } //end interrupt methods /// This function is called on panic. #[cfg(not(test))] #[panic_handler] fn panic(info: &PanicInfo) -> ! { println!("{}", info); hlt_loop(); } #[cfg(test)] #[panic_ha...
Rust
0
lt<T> = std::result::Result<T, error::Error>; const DB_POOL_MAX_OPEN: u64 = 32; const DB_POOL_MAX_IDLE: u64 = 8; const DB_POOL_TIMEOUT_SECONDS: u64 = 15; const TABLE: &str = "expense"; const LIMIT: &str = "25"; const OFFSET: &str = "0"; const SELECT_FIELDS: &str = "id, account_id, amount, category, merchant, notes, cr...
Rust
0
&[DeviceAddress] = &[INDOOR_SENSOR, OUTDOOR_SENSOR]; const NET_BUF_SIZE: usize = 1024; pub struct BeaconScanCallback; pub struct HomeDeviceFilter; #[rtic::app(device = crate::hal::pac, peripherals = true)] const APP: () = { struct Resources { #[init([0; MIN_PDU_BUF])] ble_tx_buf: PacketBuffer, ...
Rust
0
# -*- coding: utf-8 -*- """ Defines Scrapy Items for Document, Link, and Authority data. """ import re import unicodedata from scrapy.item import Field, Item from itemloaders.processors import TakeFirst, MapCompose # Compile a regex for control characters for efficiency all_chars = (chr(i) for i in range(0x110000)) CH...
Python
1
l}_{sampler}_{cnet_type}_{threading.current_thread().ident}_{i}.webp", quality=80, ) def swap_models(): while True: time.sleep(random.randint(30, 60)) # new models? newmodels = [ random.choice(SharedModelManager.manager.compvis.available_models), random....
Python
1
expected_output = { 'isakmp_stats': { 'IPv6':{ 1:{ 'c_id': 29610, 'local_ip': '100.0.10::2', 'remote_ip': '100.13.220::2', 'status': 'ACTIVE', 'encr_algo': 'aes', '...
Python
1
# utilitary functions from DUSt3R import torch def freeze_all_params(modules): for module in modules: try: for n, param in module.named_parameters(): param.requires_grad = False except AttributeError: # module is directly a parameter module.requi...
Python
1
RFC 3339). pub const CREATED: &str = "org.opencontainers.image.created"; /// The contact details of the people or organization responsible for the /// image (freeform string). pub const AUTHORS: &str = "org.opencontainers.image.authors"; /// The URL to find more information on the image. pub c...
Rust
0
uzz_targets/peepmatic_simple_automata.rs #![no_main] use libfuzzer_sys::fuzz_target; use peepmatic_fuzzing::automata::simple_automata; fuzz_target!(|input_output_pairs: Vec<Vec<(u8, Vec<u8>)>>| { simple_automata(input_output_pairs); }); <gh_stars>0 // a new module mod front_of_house { // public module pub ...
Rust
0
import tensorflow as tf import tensorflow.keras as keras from tensorflow.keras import layers def build_wgan_discriminator_local(filters = 32, image_size = 64): """ Discriminator for the WGAN-GP model Used to classify the input image as real or fake. Introduced in the WGAN paper: K. Gavriil, O.J.D. Barrowcloug...
Python
1
_safe() .global_position() .direction_to(wander_controller.target_position); velocity.velocity = velocity.move_toward( direction * acceleration.max_speed, acceleration.acceleration * delta.value, ); ...
Rust
0
import requests import re def get_pic(num): if not os.path.exists('pics'): os.makedirs('pics') cookies = { XXXXXX } 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',...
Python
1
try; /// A chain handle with support for caching. /// To be used for the passive relaying mode (i.e., `start` CLI). #[derive(Debug, Clone)] pub struct CachingChainHandle<Handle> { inner: Handle, cache: Cache, } impl<Handle> CachingChainHandle<Handle> { pub fn new(handle: Handle) -> Self { Self { ...
Rust
0
c", "ARC-Easy", split=split) arc_challenge = load_dataset("ai2_arc", "ARC-Challenge", split=split) return arc_easy, arc_challenge def process_arc_example(example, tokenizer, max_length=128): question = example['question'] choices = example['choices']['text'] answer_key = example.get('answerKey...
Python
1
= 1 )) rgb_points.fields.append(sensor_msgs.msg.PointField( name = "y",offset = 4,datatype = sensor_msgs.msg.PointField.FLOAT32,count = 1 )) rgb_points.fields.append(sensor_msgs.msg.PointField( name = "z",offset = 8,datatype = senso...
Python
1
from datetime import datetime from zlapi.models import * def handle_group(message, message_object, thread_id, thread_type, author_id, bot): def get_name(id): # print(bot.fetchUserInfo(id)) return bot.fetchUserInfo(id).changed_profiles[id].zaloName msg_error = f"Đã xảy ra lỗi🤧" key_trans...
Python
1
position] = 0 sendMessageToParent(finalBuffer) def sendDataEventToParent(event): encoded = json.dumps(event).encode() sendMessageToParent((1).to_bytes(1, 'big') + len(encoded).to_bytes(8, 'big') + encoded) async def processMessage(buf): parsed = json.loads(buf.decode('utf-8')) response = rpc...
Python
1
-----BEGIN RSA PRIVATE KEY----- Bad Key, though the cert should be OK -----END RSA PRIVATE KEY----- -----BEGIN CERTIFICATE----- MIICpzCCAhCgAwIBAgIJAP+qStv1cIGNMA0GCSqGSIb3DQEBBQUAMIGJMQswCQYD VQQGEwJVUzERMA8GA1UECBMIRGVsYXdhcmUxEzARBgNVBAcTCldpbG1pbmd0b24x IzAhBgNVBAoTGlB5dGhvbiBTb2Z0d2FyZSBGb3VuZGF0aW9uMQwwCgYDVQQLEw...
Python
1
self.edge_input } } impl ::protobuf::Message for OdpsGraphInput { fn is_initialized(&self) -> bool { for v in &self.edge_input { if !v.is_initialized() { return false; } }; true } fn merge_from(&mut self, is: &mut ::protobuf::CodedInputSt...
Rust
0
WriteStorage<'a, Transform>, WriteStorage<'a, RotationControl>, Read<'a, WindowFocus>, Read<'a, HideCursor>, ReadStorage<'a, Parent>, ); fn run( &mut self, ( entities, mut events, mut transforms, mut rotati...
Rust
0
/// variables, rather than only the dependent variable. This is done because it reduces the /// code size of the program as a whole. /// /// # Examples /// /// ``` /// let i = interpolate(10, 500.0, 14, 501.0); /// assert_eq!(i, [(10, 500.0), (11, 500.25), (12, 500.5), (13, 500.75), (14, 501.0)]); /// ``` ...
Rust
0
avm, context)?; this.set_attributes( context.gc_context, Some("target"), DontDelete | ReadOnly | DontEnum, EnumSet::empty(), ); Ok(Value::Undefined.into()) } pub fn create_proto<'gc>( gc_context: MutationContext<'gc, '_>, proto: Object<'gc>, fn_proto: Object<'g...
Rust
0
CUTED: bool = false; #[no_mangle] fn bf_debug_op_dump_page_pool_impl() { unsafe { EXECUTED = true; } } #[test] fn test_bf_debug_op_dump_page_pool() { super::bf_debug_op_dump_page_pool(); unsafe { assert!(EXECUTED); } } } /// <!--...
Rust
0
# This file is part of the faebryk project # SPDX-License-Identifier: MIT import logging import faebryk.library._F as F # noqa: F401 from faebryk.core.module import Module from faebryk.libs.library import L # noqa: F401 from faebryk.libs.picker.picker import DescriptiveProperties from faebryk.libs.units import P #...
Python
1
`foo` 494..504: invalid suffix `bar` 528..571: int literal is too large 590..596: literal out of range for `u8` 635..641: literal out of range for `i8` 680..698: literal out of range for `u32` 734..759: literal out of range for `i32` 9..298 '{ ...f64; }': () 15..18 '123': i32 24...
Rust
0
# ----------------------------------------------------------------------------- # © 2024 Boston Consulting Group. 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 # # ...
Python
1
class TaskFamily: @staticmethod def get_tasks() -> dict[str, dict]: return { "1": {"role": "Buyer", "context": "negotiating the price and terms for purchasing a piece of real estate", "constraints": "Budget limit of $500,000, must include a home inspection clause"}, "2": {"role":...
Python
1
import numpy as np # use nansum from bottleneck if it's installed, otherwise use the numpy one try: import bottleneck as bn nansum = bn.nansum except ImportError: nansum = np.nansum def mms_pgs_make_theta_spec(data_in, resolution=16, colatitude=False): """ Builds a theta (latitudinal) spectrogram...
Python
1
#[doc = "7: 256 samples for each conversion result"] X256 = 7, #[doc = "8: 512 samples for each conversion result"] X512 = 8, #[doc = "9: 1024 samples for each conversion result"] X1024 = 9, #[doc = "10: 2048 samples for each conversion result"] X2048 = 10, #[doc = "11: 4096 samples ...
Rust
0
-8ec4-d7a32b691b08"); let exercise_slide_c1p1_1 = Uuid::new_v5(&course_id, b"182c4128-c4e4-40c9-bc5a-1265bfd3654c"); let exercise_task_c1p1e1_1 = Uuid::new_v5(&course_id, b"f73dab3b-3549-422d-8377-ece1972e5576"); let spec_c1p1e1t1_1 = Uuid::new_v5(&course_id, b"5f6b7850-5034-4cef-9dcf-e3fd4831067f"); le...
Rust
0
# -*- coding: utf-8 -*- import csv import logging from typing import Any, Dict from bs4 import BeautifulSoup def save_csv(file_name, data): file = open(file_name, 'w') wr = csv.writer(file, delimiter=';') wr.writerows(data) file.close() doc = ''' <html><head><title>Меню</title></head><body> <!-- С...
Python
1
d; let mut writer = last_value.write().unwrap(); *writer = (*formatter)(new_id); let _ = tx.send(()); } } } } } else { retur...
Rust
0
} writeln!(&mut s).unwrap(); writeln!(&mut s, "Features prefixed with '-' will be disabled.").unwrap(); s }; } pub mod commands; <filename>src/libmeaning/src/meaning.rs // Copyright (c) 2019, Sabre developers // // Licensed under the Apache License, Version 2.0 (see LICENSE.Apache...
Rust
0
from typing_extensions import override import torch from comfy_api.latest import ComfyExtension, io # https://github.com/WeichenFan/CFG-Zero-star def optimized_scale(positive, negative): positive_flat = positive.reshape(positive.shape[0], -1) negative_flat = negative.reshape(negative.shape[0], -1) # Ca...
Python
1
n reset: 0"] #[derive(Clone, Copy, Debug, PartialEq)] pub enum IPP_USER_RESET_B_A { #[doc = "0: Reset is not a result of the ipp_user_reset_b qualified as COLD reset event."] IPP_USER_RESET_B_0 = 0, #[doc = "1: Reset is a result of the ipp_user_reset_b qualified as COLD reset event."] IPP_USER_RESET_B_1...
Rust
0
# Copyright (c) Facebook, Inc. and its affiliates. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. from typing import List, Optional from simuleval.data.segments import Segment from .agent import GenericAgent, AgentStates ...
Python
1
h.tanh(self.mlp_delta(torch.relu(K_curr))) / self.radius**self.i # (B, 3, N_prev * up_factor) pcd_child = self.up_sampler(pcd_prev) pcd_child = pcd_child + delta return pcd_child, K_curr class Decoder(nn.Module): def __init__(self, dim_feat=512, num_pc=256, num_p0=512, radius=1, up_facto...
Python
1
import flet as ft name = "Badges in NavigationRail example" def example(): rail = ft.NavigationRail( selected_index=0, label_type=ft.NavigationRailLabelType.ALL, min_width=100, min_extended_width=400, leading=ft.FloatingActionButton(icon=ft.Icons.CREATE, content="Add"), ...
Python
1
match &**self as *const _ { ral::gpt::GPT1 => GPT::GPT1, ral::gpt::GPT2 => GPT::GPT2, _ => unreachable!(), } } #[inline(always)] fn is_valid(gpt: GPT) -> bool { match gpt { GPT::GPT1 | GPT::GPT2 => true, } } } /// ```no_run /// us...
Rust
0
uxdata.com/influxdb/v1.7/tools/api/#query-http-endpoint). #[derive(PartialEq, Debug)] pub enum QueryType { ReadQuery, WriteQuery, } #[cfg(test)] mod tests { use crate::query::{Timestamp, ValidQuery}; #[test] fn test_equality_str() { assert_eq!(ValidQuery::from("hello"), "hello"); } ...
Rust
0
requests::QueryDocumentsBuilder::new(self) } fn with_stored_procedure<'c>( &'c self, stored_procedure_name: &'c dyn StoredProcedureName, ) -> StoredProcedureClient<'c, CUB> { StoredProcedureClient::new(&self, stored_procedure_name) } fn list_stored_procedures(&self...
Rust
0
print(f"{i["nombre"]}") print(f"Contacto: {i["contacto"]}") print(f"Dirección: {i["direccion"]}") print("˗ˏˋ ★ ˎˊ˗") print("") contador=contador+1 if opcion==5: system("cls") print("─── ⋆⋅☆⋅⋆ ──Pacientes─── ⋆⋅☆⋅⋆ ──") print("") contador=1 for i in pacientesjs...
Python
1
dir::CopyOptions::new(); options.content_only = true; options } impl InstallationResults { /// Gets whether the `InstallationResults` contains no templates. This /// indicates that no templates were found in the installation source. pub fn is_empty(&self) -> bool { self.installed.is_empty()...
Rust
0
# Copyright (c) 2021 Huawei Technologies Co.,Ltd. # # openGauss is licensed under Mulan PSL v2. # You can use this software according to the terms and conditions of the Mulan PSL v2. # You may obtain a copy of Mulan PSL v2 at: # # http://license.coscl.org.cn/MulanPSL2 # # THIS SOFTWARE IS PROVIDED ON AN "AS IS...
Python
1
Skip::from_millis((self.remaining_time_in_cycle() - 1u64) as u32) } } else { let tertiary_current = self.current_time_in_cycle() & (TERTIARY_LENGTH - 1u32); // just zero highest byte let rem = TERTI...
Rust
0
aths { if !cities.contains(&path[1]) { return path[1].clone(); } } "".to_string() } }use game::*; use frontends::ansi; const COMMON_BG: ansi::AnsiColour = ansi::colours::BLACK; pub fn resolve_tile(tile_type: TileType) -> ansi::ComplexTile { match tile_ty...
Rust
0
import xml.etree.ElementTree as ET from collections import defaultdict def analyze_xml_structure(file_path): try: tree = ET.parse(file_path) root = tree.getroot() structure = defaultdict(list) def recurse(element, depth): tag_name = element.tag.split('}')[-1] if '}' i...
Python
1
e(format!("0x{:0>4x}: ", offset).as_bytes()); out_writer.write(decoded_instruction.as_bytes()).unwrap(); out_writer.write(&new_line).unwrap(); out_writer.flush(); offset += n; }, Err(_) => { return Err(DissasembleError::InputError("...
Rust
0
(spaxel_ind+i)/out_spaxels; let in_n = &input[n_ind*in_size..][..in_size]; let output_ind = (spaxel_ind+i)%out_spaxels*output_channels; match filter_spatial.len() { 1 => unsafe_pack_specialised::<U1>(patch, in_n, input_channels, output_ind, &filter_spatial, &input_spatial, &output_spati...
Rust
0
""" Definition of the datamodel required for SA storage backend. """ from sqlalchemy import Table, Column, BigInteger, String, PickleType, DateTime from sqlalchemy.sql import func from coilmq.store.sa import meta __authors__ = ['"Hans Lellelid" <hans@xmpl.org>'] __copyright__ = "Copyright 2009 Hans Lellelid" __licen...
Python
1
aram is passed by value, moved pub fn set_bool_field(&mut self, v: bool) { self.bool_field = v; } // string string_field = 14; pub fn get_string_field(&self) -> &str { &self.string_field } pub fn clear_string_field(&mut self) { self.string_field.clear(); } // ...
Rust
0
-') if len(page_list) > 1: # 複数ページの場合 value = str(page_list[1]) elif page_list[0] == '': # ページなし value = '-' else: # 単一ページ value = str(page_list[0]) return value def first_page(self): """最初のページ(情報がなければ空欄)""" page_list = self...
Python
1
from pathlib import Path PARTIALS = Path(__file__).resolve().parents[1] / 'web' / 'templates' / 'partials' MOBILE_PARTIALS = Path(__file__).resolve().parents[1] / 'web' / 'templates' / 'mobile' / 'partials' def read(p): return p.read_text(encoding='utf-8') def test_lazy_preview_class_exists(): files = [ ...
Python
1
value = 'three, sir!'
Python
1
python" def test_aask_code_json_decode_error(self, json_decode_error): instance = OpenAILLM(mock_llm_config) code = instance.get_choice_function_arguments(json_decode_error) assert "code" in code assert "language" in code assert "hello world" in code["code"] logger.i...
Python
1
import os import argparse from utils.evaluation import Statistics, EvaluationConfig, compute_dataset_statistics parser = argparse.ArgumentParser(prog='NTU VIRAL - Dataset Statistics Computation') parser.add_argument('input_path', help='The folder with the extracted point clouds') parser.add_argument('--output_log', he...
Python
1
\x03\x13\0\x1f\n\x08\n\x01\x08\x12\x03\x14\0O\ \n\t\n\x02\x08\x0b\x12\x03\x14\0O\n\x08\n\x01\x08\x12\x03\x15\0\"\n\t\n\ \x02\x08\n\x12\x03\x15\0\"\n\x08\n\x01\x08\x12\x03\x16\0,\n\t\n\x02\x08\ \x08\x12\x03\x16\0,\n\x08\n\x01\x08\x12\x03\x17\0(\n\t\n\x02\x08\x01\x12\ \x03\x17\0(\n\x08\n\x01\x08\x12\x03\x...
Rust
0
self.cfg.in_dim.2; let in_len = self.cfg.in_dim.flat_len(); let out_len = self.cfg.out_dim().flat_len(); let out_space_len = self.cfg.out_dim().0 * self.cfg.out_dim().1; for idx in 0 .. batch_size { unsafe { neuralops_cuda_caffe_im2col( in_buf.as_ref().slice(idx * in_len, (idx+1) * in_l...
Rust
0
sim = sim_utils.SimulationContext(sim_cfg) # Set main camera sim.set_camera_view(eye=[3.5, 3.5, 3.5], target=[0.0, 0.0, 0.0]) # design scene scene_cfg = ImuSensorSceneCfg(num_envs=args_cli.num_envs, env_spacing=2.0) scene = InteractiveScene(scene_cfg) # Play the simulator sim.reset() # ...
Python
1
, 'L': 4, 'M': 7, 'N': 6, 'O': 6, 'P': 5, 'Q': 6, 'R': 5, 'S': 4, 'T': 4, 'U': 5, 'V': 5, 'W': 8, 'X': 5, 'Y': 5, 'Z': 4, ' ': 2, '!': 2, '"': 3, '#': 5, '$': 5, '%': 6, '&': 5, "'": 2, '(': 2, ')': 2, '*': 3, '+': 5, ',': 2, '-': 3, '.': 2, '/': 3, ':': 2, ';': 2, '<': 5, '=': 5, '>': 5, '?': 3, '@': 6, '[': 2, '\\': ...
Python
1
target: str, node: pending_xref, contnode: Element, ) -> Optional[Element]: nsname = node.get("lpy:namespace") maybe_obj: Union[FormEntry, NamespaceEntry, VarEntry, None] reftype = node.get("reftype") if reftype == "ns": maybe_obj = self.namespaces....
Python
1
lgorithm, &key_pair.private_key, &key_pair.public_key)?; // Because the Docker package type is pre-installed, we expect an attempt to add one to // produce a duplicate result. match metadata.create_package_type(&package_type)? { MetadataCreationStatus::Created => bail!("Docker packag...
Rust
0
avg_surface_distance(test=test[batch][1], reference=reference[batch][1]) disc_asds.append(disc_asd) cup_asds.append(cup_asd) return disc_asds, cup_asds def hd_compute(test, reference): batch_size = reference.shape[0] disc_hds, cup_hds = [], [] for batch in range...
Python
1
<&'a SessionInfo> for Config { fn from(s: &'a SessionInfo) -> Self { Config { assignment_keys: s.assignment_keys.clone(), validator_groups: s.validator_groups.clone(), n_cores: s.n_cores.clone(), zeroth_delay_tranche_width: s.zeroth_delay_tranche_width.clone(), relay_vrf_modulo_samples: s.relay_vrf_mo...
Rust
0
from llmebench.datasets import XGLUEPOSDataset from llmebench.models import RandomModel from llmebench.tasks import ArabicPOSTask, TaskType def metadata(): return { "author": "Arabic Language Technologies, QCRI, HBKU", "model": "Random", "description": "Random Baseline.", "scores":...
Python
1
ent message type or field is not `map`. pub fn get_map<'a>(&self, m: &'a dyn MessageDyn) -> ReflectMapRef<'a> { match self.get_reflect(m) { ReflectFieldRef::Map(m) => m, _ => panic!("not a map field"), } } /// Get a mutable reference to `map` field. /// /// #...
Rust
0
lfill_obligation: selection={:?}", selection); // Currently, we use a fulfillment context to completely resolve // all nested obligations. This is because they can inform the // inference of the impl's type parameters. let mut fulfill_cx = FulfillmentContext::new(); let vtable =...
Rust
0
e?" if is_english( [ans]) else "······\n由于长度的原因,回答被截断了,要继续吗?" yield ans else: yield ans + "\n**ERROR**: " + resp.message if str(resp.message).find( "Access") < 0 else "Out of credit. Please set the API key in **s...
Python
1
*v = x[i / self.up]; } upsampled = self.lpf.apply(&upsampled); } if self.down == 1 { upsampled } else { upsampled .into_iter() .enumerate() .filter(|&(i, _)| i % self.down == 0) ...
Rust
0
wait_container_log( &worker.pod, i, ContainerType::Container, ContainerStateType::Or, ) .await?; #[cfg(feature = "logging")] ...
Rust
0
fetch_add(1, Ordering::Relaxed); } } fn main() { const THREADS: usize = 8; const PER_THREAD_ALLOCATIONS: usize = 10_000_000 + 1_000; static COUNTERS: [ThreadCount; THREADS] = [ ThreadCount(AtomicUsize::new(0)), ThreadCount(AtomicUsize::new(0)), ThreadCount(AtomicUsize::new(0)), ...
Rust
0
ur::{ActorAssistant, Receive, Acteur}; /// /// #[derive(Debug)] /// struct SalaryChanged(u32); /// /// #[async_trait] /// impl Receive<SalaryChanged> for Employee { /// async fn handle(&mut self, message: SalaryChanged, _: &ActorAssistant<Employee>) { /// self.salary = message.0; /// } /// } /// /// fn ...
Rust
0
import numpy as np from ipywidgets import Widget, widget_serialization def array_to_binary(ar, obj=None, force_contiguous=True): if ar is None: return None if ar.dtype.kind not in ['u', 'i', 'f']: # ints and floats raise ValueError("unsupported dtype: %s" % (ar.dtype)) if ar.dtype == np....
Python
1
velocity let prev_w = delta_w.clone(); // Compute the difference in gradient using Nesterov momentum delta_w = Vector::new(vec_data) * self.mu + &delta_w * self.alpha; // Update the parameters optimizing_val = &optimizing_val - ...
Rust
0
ge = tf.image.resize_with_crop_or_pad(image, val_im_height, val_im_width) image = (image / 255. - 0.5) / 0.5 return image, label # Configure dataset for performance def configure_for_performance(ds, shuffle_size: int, shuffle: ...
Python
1
use rand::prelude::*; use std::{ error::Error, ops::Add, time::{Duration, SystemTime}, }; const WORK_STEPS_NEEDED_FOR_UNBOUNDED_TASK: u8 = 100; const UNITS: &[&str] = &["Mb", "kb", "items", "files"]; const REASONS: &[&str] = &["due to star alignment", "IO takes time", "仪表板演示", "just because"]; const WORK_...
Rust
0
# config.py import os from dotenv import load_dotenv # 加载环境变量 load_dotenv() class Config: """配置管理类""" def __init__(self): # 微信客服/企业微信配置 self.corp_id = os.getenv('WEWORK_CORP_ID') self.secret = os.getenv('WEWORK_SECRET') self.token = os.getenv('WEWORK_TOKEN') self.encod...
Python
1
tenant_id = DocumentService.get_tenant_id(req["doc_id"]) if not tenant_id: return get_data_error_result(retmsg="Tenant not found!") ELASTICSEARCH.deleteByQuery( Q("match", doc_id=doc.id), idxnm=search.index_name(tenant_id)) return get_json_result(data=T...
Python
1
let mut w = writer.lock().unwrap(); pages.into_iter().for_each(|page| { writeln!(w, "{}", serde_json::to_string/*_pretty*/(&page).unwrap()).unwrap(); }); } { let mut prog_bar = pbar.lock().unwrap(); prog_bar.inc(); } }); }...
Rust
0
assert_eq_with_tolerance(sut.get_range().1, 474); } #[test] fn test_bar_position_1920x1080_hud_50() { let sut = BarsPosition::new(1920, 1080, 0.5); assert_in_range(sut.get_health_height(), 1038, 1050); assert_in_range(sut.get_mana_height(), 1055, 1067); assert_eq_wi...
Rust
0
lue self.end_value = end_value self.switch_step = switch_step def __call__(self, step: int) -> float: if step < self.switch_step: return self.start_value elif step >= self.switch_step: return self.end_value class CosineAnnealingHPScheduler(HPScheduler): ...
Python
1
#!/usr/bin/python3 # -*-coding:utf-8-*- # @Time: 2020/4/23 21:25 # @Author: haiyong # @File: test_addcontact.py from time import sleep import pytest from appium import webdriver from appium.webdriver.common.mobileby import MobileBy class TestAdd(): def setup_class(self): desired_caps = { ...
Python
1
#!/usr/bin/env python2 from sys import argv, exit import struct def p32(x): return struct.pack("<I", x) def ins(dst, off, src): if type(src) is list: out = b"" for x in src: out += p32(x) else: out = src dst[off:off+len(out)] = out def main(): # ./gen.py fat.tpl payload.bin fat.out with open(argv[1]...
Python
1
capture_output=True, env=env ).returncode == 0 if not darwin_rebuild_exists: # 初回インストール self.logger.info("nix-darwinの初回インストールを実行...") # nix-darwin用の設定ディレクトリを作成 darwin_confi...
Python
1
import typing_extensions from oxford_dictionaries_python_sdk.apis.tags import TagValues from oxford_dictionaries_python_sdk.apis.tags.utility_api import UtilityApi from oxford_dictionaries_python_sdk.apis.tags.dictionary_entries_api import DictionaryEntriesApi from oxford_dictionaries_python_sdk.apis.tags.thesaurus_ap...
Python
1