text
string
label_name
string
labels
int64
x01) != 0) } #[doc = "Bit 5 - 5:5\\] Internal. Only to be used through TI provided API."] #[inline(always)] pub fn pgm_sec_cof_en(&self) -> PGM_SEC_COF_EN_R { PGM_SEC_COF_EN_R::new(((self.bits >> 5) & 0x01) != 0) } #[doc = "Bit 4 - 4:4\\] Internal. Only to be used through TI provided API...
Rust
0
it 26"] #[inline(always)] pub fn rtc_cntl_xtl_force_noiso(&self) -> RTC_CNTL_XTL_FORCE_NOISO_R { RTC_CNTL_XTL_FORCE_NOISO_R::new(((self.bits >> 26) & 0x01) != 0) } #[doc = "Bit 25"] #[inline(always)] pub fn rtc_cntl_analog_force_iso(&self) -> RTC_CNTL_ANALOG_FORCE_ISO_R { RTC_CNT...
Rust
0
f.avaliable_target_page}') # for i in range(self.avaliable_target_page-self.current_page): # self.next_page() # self.current_page+=1 single_target = None for i in self.targets_cords: single_target = SingleTarget(i) if single_target.avaliable: ...
Python
1
# Copyright (C) 2019-2021 The Authors # # Licensed under the Raphielscape Public License, Version 1.d (the "License"); # you may not use this file except in compliance with the License. # """ Userbot module for muting chats. """ from userbot import ( BOTLOG, BOTLOG_CHATID, CMD_HELP, MONGO, is_mongo...
Python
1
# We test that the api can be imported as expected import awesome_streamlit as ast # from awesome_streamlit import database # import awesome_streamlit.database # from awesome_streamlit.database import models # from awesome_streamlit.database import authors # from awesome_streamlit.database import tags # from awesome_s...
Python
1
e(ref pointer_data) = self.pointer_data { pointer_data.borrow_mut().is_valid = false; } if diff < (IcedConstants::MAX_INSTRUCTION_LENGTH as i64) * (i8::MIN as i64) || diff > (IcedConstants::MAX_INSTRUCTION_LENGTH as i64) * (i8::MAX as i64) { base.done = true; } self.instr_kind = InstrKind::Ne...
Rust
0
.tiles.iter().enumerate().for_each(|(idx, t)| match *t { TileType::Floor => output[idx] = '.', TileType::Wall => output[idx] = '#', TileType::Exit => output[idx] = '>', }); output[map.point2d_to_index(*player_start)] = '@'; output[map.point2d_to_index(*amulet_start)] = 'A'; mons...
Rust
0
import numpy as np import brotli import os SOURCE_FILE = "brotli/__init__.py" def _load_long_description(): current_dir = os.path.dirname(os.path.abspath(__file__)) md_path = os.path.join(current_dir, "brotli.md") with open(md_path, "r", encoding="utf-8") as f: return f.read() LONG_DESCRIPTION...
Python
1
usize, block); Ok(was_successful as u32) } use std::convert::TryFrom; use std::io::ErrorKind; use super::*; use crate::errors::StorageError; use crate::utils::Path; pub async fn reliable_mkdir_all(path: impl AsRef<Path>, mode: u32) -> anyhow::Result<()> { let _ = check_path_length(path.as_ref().as_str())?; ...
Rust
0
::Unique(_) => true, //! _ => false //! }; //! assert!(unique); //! ``` //! //! ## Defining a difficulty //! //! The above example removes digits as long as the resulting Sudoku is still //! uniquely solveable. This may result in some very difficult Sudoku, since it //! provides no guarantees as to *how* the Sudoku...
Rust
0
from yandex_music import Playlist class TestPlaylist: uid = 503646255 kind = 69814820 title = 'Плейлист дня' track_count = 57 tags = [] revision = 0 snapshot = 1 visibility = 'public' collective = False url_part = 'daily' created = '2018-04-29T21:00:00+00:00' modified =...
Python
1
import logging import json import pytest import aiosqlite import lotus_bot.cogs.champion.cog as champion_cog_mod from lotus_bot.cogs.champion.cog import ChampionCog from lotus_bot.cogs.champion.data import ChampionData import lotus_bot.log_setup as log_setup class DummyBot: def __init__(self): self.data ...
Python
1
from .. import IconBase class IconFolderKey(IconBase): class_name = "lucide lucide-folder-key" svg_data = { "attrs": { "width": "24", "height": "24", "view_box": "0 0 24 24", "fill": "none", "stroke": "currentColor", "stroke_width": "2", "stroke_line...
Python
1
assert captured.out == " indented \n more \n most \n" @staticmethod def test_stream_recorded_llm_response_handles_empty_input(capsys): """ Tests that the `stream_recorded_llm_response` function handles complex whitespace formatting. This test verifies that the function...
Python
1
from celery import Celery from django.conf import settings import os from django.db.models import F,Q # Set the default Django settings module for the 'celery' program. os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'tgwebapp.settings') app = Celery('project') # Using a string here means the worker doesn't have to s...
Python
1
# -*- coding: utf-8 -*- # # Copyright 2019 Google LLC. 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 requir...
Python
1
try: info = self._communicate_bytes(_REQ_GET_FIRMWARE_INFO).firmware_info return FirmwareVersion(info.major_version, info.minor_version) except InferenceException: return FirmwareVersion(1, 0) # Request is not supported by firmware, default to 1.0 def get_system_i...
Python
1
rt.ok(subject); }}); }});", application_name, class_name, file_name, file_name, class_name, class_name); } <filename>vga/src/lib.rs<gh_stars>0 #![no_std] #![feature(custom_test_frameworks)] /// Color module mod color; pub use color::*; /// Buffer module mod buffer; pub use buffer::*; /// Macros module pub mod macr...
Rust
0
} criterion_group!(benches, combinations_basic_benchmark, combinations_benchmark, combinations_basic_benchmark_large_t, combinations_benchmark_large_t); criterion_main!(benches);<filename>components/sup/src/sys/unix/abilities.rs // Copyright (c) 2018 Chef Software Inc. and/or applicable contributors // // Li...
Rust
0
- self.eps) x = x - x.detach() + clamped_x.detach() return x def sample(self, clip=None, sample_shape=torch.Size()): shape = self._extended_shape(sample_shape) eps = _standard_normal(shape, dtype=self.loc.dtype, device=s...
Python
1
art_tx_producer.enqueue(data).unwrap(); } else { break; } } }); (&mut c.shared.uart_writer, &mut c.shared.uart_tx_consumer).lock(|uart, uart_tx_consumer| { let uart = uart.as_mut().unwrap(); ...
Rust
0
32, Py_hash_t); wrapping_cast!(usize, Py_hash_t); wrapping_cast!(u64, Py_hash_t); wrapping_cast!(i8, Py_hash_t); wrapping_cast!(i16, Py_hash_t); wrapping_cast!(i32, Py_hash_t); wrapping_cast!(isize, Py_hash_t); wrapping_cast!(i64, Py_hash_t); pub struct HashCallbackOutput<T>(pub T); impl<T> IntoPyCallbackOutput<Py_ha...
Rust
0
6".to_string(), false)), VirtualKeyCode::Key7 => Some(("7".to_string(), false)), VirtualKeyCode::Key8 => Some(("8".to_string(), false)), VirtualKeyCode::Key9 => Some(("9".to_string(), false)), VirtualKeyCode::Key0 => Some(("0".to_string(), false)), VirtualKeyCode::A => Some(("a"....
Rust
0
"MSO44: Set acquisition mode to {mode}.") def get_acquisition_mode(self) -> str: """ Get the acquisition mode of the target channel. Returns ------- mode : str {'SAM', 'PEAK', 'HIR', 'AVE', 'ENV'} """ return self.query("ACQuire:MODE?")[:-...
Python
1
RY_EXTRA_OFFSET: usize = 0x15; const EXTRA_SIZE: usize = 9; const ENTRY_FILE_SIZE_OFFSET: usize = 0x1E; /// Different file storage schemes use the nine directory entry bytes /// 0x15..0x1E differently, hence the need for this enum to encapsulate the /// different interpretations. /// /// NOTE: Technically, the two byt...
Rust
0
ction, process_name) in open_sockets { local_socket_to_procs.insert(connection.local_socket, process_name); connections.push(connection); } OpenSockets { sockets_to_procs: local_socket_to_procs, connections, } } pub fn get_interfaces() -> Vec<NetworkInterface> { vec![Ne...
Rust
0
the model. All side effects deriving from such change have to be /// implemented in the space rules `alter_space` method. pub type SpaceAlteration<R> = <<R as BattleRules>::SR as SpaceRules<R>>::SpaceAlteration; /// Represents an entity's claim to a given position. pub enum PositionClaim<'a, R: BattleRules> { ///...
Rust
0
Vec, bidivec, BidiRect}; //! //! let mut bvec = bidivec!{ //! [1, 2, 3], //! [4, 5, 6], //! [7, 8, 9], //! }; //! //! for item in bvec //! .iter_mut() //! .on_rect(&BidiRect::new(1, 1, 2, 2,)) //! { //! *item = -(*item); //! } //! //! let v = bvec.iter().copied().collect::<Vec<i32>>(); //! //! a...
Rust
0
s_eos(&self) -> bool; #[doc(alias = "gst_aggregator_pad_peek_buffer")] fn peek_buffer(&self) -> Option<gst::Buffer>; #[doc(alias = "gst_aggregator_pad_pop_buffer")] fn pop_buffer(&self) -> Option<gst::Buffer>; #[cfg(any(feature = "v1_16", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg...
Rust
0
import heapq import math def a_star(): # Define the city map as a 2D list city_map = [[0, 7, 0, 13, 8, 2, 15, 2, 5, 15, 6, 4, 7, 0], [0, 6, 19, 17, 5, 13, 15, 2, 11, 5, 0, 0, 9, 8], [16, 12, 10, 7, 8, 19, 19, 9, 5, 10, 2, 0, 0, 12], [0, 1, 19, 20, 0, 3, 4, 18, 0...
Python
1
print("------------------------------------------------------------") #生成空的e_truss来存放peeling了的边 e_truss = torch.tensor([], dtype=torch.int32, device=graph.device) ptr_truss = torch.zeros(1, dtype=torch.int32, device = graph.device) #计算边映射序号 l = 0 edges = torch.arange(graph.colu...
Python
1
password es el cuarto elemento password = input("Enter new password (or press Enter to keep current): ") or current_password Database.update("users", user_id, password=password) print("Password updated successfully.") #user_management() def delete_user_ui(): user_id = input("Enter user ID to ...
Python
1
extend( [0x41u8, 0x53u8, 0x45u8, 0x46u8] .iter() .cloned() .chain(version.to_bytes()) .chain((1u32).to_be_bytes().iter().cloned()) .chain(block.to_bytes()), ); let bytes: Vec<u8> = ase.to_bytes().collect(); ...
Rust
0
24); assert_eq!(powmod(2, 20, 127), 64); } #[test] fn test_trial_division() { assert_eq!(trial_division(2), Some(true)); assert_eq!(trial_division(3), Some(true)); assert_eq!(trial_division(4), Some(false)); assert_eq!(trial_division(6), Some(false)); assert_...
Rust
0
gory assigned', getattr(team, 'nspeakers_%s' % sc.slug, 0), ) % {'nspeakers': getattr(team, 'nspeakers_%s' % sc.slug, 'N/A'), 'category': escape(sc.name)}, } for team in teams]) return table def get_context_data(self, **kwargs): break_categories = se...
Python
1
able!("{} less than {}", l, r), }, } } /// Element-wise less-than comparison. pub fn lt_const(&self, other: Number) -> Array { use number_general::Complex; match (self, other) { (Self::Bool(l), Number::Bool(r)) => Self::Bool(l.lt(&bool::from(r))), ...
Rust
0
xp) -> None: q = cirq.LineQubit(0) test_circuit = cirq.Circuit() test_circuit.append(cirq.H(q)) test_circuit.append(DelegatingAncillaZ(exp).on(q)) control_circuit = cirq.Circuit(cirq.H(q)) control_circuit.append(cirq.ZPowGate(exponent=exp).on(q)) assert_test_circuit_for_dm_simulator(test_...
Python
1
ume self.packs_are_on = reader.read(&self.packs_1_supply_id) || reader.read(&self.packs_2_supply_id); } } pub struct PressurizationOverheadPanel { mode_sel: AutoManFaultPushButton, man_vs_ctl_switch: SpringLoadedSwitch, ldg_elev_knob: ValueKnob, ditching: NormalOnPushButton, } ...
Rust
0
s(self): # GH#20911 df1 = DataFrame( np.random.default_rng(2).standard_normal((1000, 4)), columns=["A", "B", "C", "D"], ) df2 = DataFrame( np.random.default_rng(2).standard_normal((1000, 4)), columns=["D", "A", "B", "C"], ) ...
Python
1
import random # Life Points lifepoints = 100 # Places def leftside(): print('\nYou see a brown bear... What you do?') print('Attack or Run?') answer = input(':').lower() if answer == 'attack': attack = random.randint(100, 100) new_lpoints = lifepoints - attack print(f'Are you...
Python
1
# Copyright (c) 2025 Arne Deutsch, itemis AG, MIT License """Tests for LoRA adapter helpers.""" from __future__ import annotations import sys from pathlib import Path from peft import LoraConfig, PeftModel, get_peft_model from transformers import AutoModelForCausalLM, PreTrainedModel from hippo_mem.adapters.lora im...
Python
1
bip32::secp256k1::ecdsa::{ signature::{Signer, Verifier}, Signature }; let example_msg = b"REKT"; let signature: Signature = signing_key.sign(example_msg); println!("{:?}", signature); let some_magic_byte_that_i_dont_understand = 31; // I reverse-engineered this. WTF is it all ab...
Rust
0
, D: U32, AccountId, I, > EnsureOrigin<O> for EnsureProportionAtLeast<N, D, AccountId, I> { type Success = (); fn try_origin(o: O) -> Result<Self::Success, O> { o.into().and_then(|o| match o { RawOrigin::Members(n, m) if n * D::VALUE >= N::VALUE * m => Ok(()), r => Err(O::from(r)), }) } #[cfg(feature ...
Rust
0
assert_approx_eq!(var1, 3.15, 1e-2); let distr2 = Binomial::new(70, 0.5); let data2 = distr2.sample_n(1e6 as usize); let mean2 = mean(&data2); let var2 = var(&data2); assert_approx_eq!(mean2, 35., 1e-2); assert_approx_eq!(var2, 17.5, 1e-2); } } #![allow(dead...
Rust
0
ndomness::random(&b"dna"[..]).0, <frame_system::Pallet<T>>::block_number()); payload.using_encoded(blake2_128) } } } // This file is auto-generated by rute_gen. DO NOT EDIT. use rute_ffi_base::*; #[allow(unused_imports)] use auto::layout_ffi::RULayout; #[allow(unused_imports)] use auto::size_ffi::RUSize; #[allow...
Rust
0
incx, result, ); match status { CUBLAS_STATUS_SUCCESS => Ok(()), _ => Err(CublasError(status)), } } unsafe fn scal(&mut self, num: i32, alpha: *const f32, x: *mut f32, incx: i32, ) -> CublasResult { let status = cublasSscal_v2( self.ptr, ...
Rust
0
()) # elif ctx.functionCall(): # return self.visit(ctx.functionCall()) # elif ctx.structInit(): # return self.visitStructInit(ctx.structInit()) # elif ctx.fieldAccess(): # return self.visitFieldAccess(ctx.fieldAccess()) def visitValue(sel...
Python
1
img_filepath: String, width: u32, height: u32, } // Command-line arguments for the tool. #[derive(StructOpt)] struct Cli { /// Log level #[structopt(short, long, case_insensitive = true, default_value = "INFO")] log_level: LevelFilter, /// Twitch credential files. #[structopt(short, long...
Rust
0
# SPDX-FileCopyrightText: © 2022-2025 Wojciech Trybus <wojtryb@gmail.com> # SPDX-License-Identifier: GPL-3.0-or-later from typing import TypeVar, Generic from PyQt5.QtCore import Qt from PyQt5.QtGui import QPaintEvent from api_krita.pyqt import Painter, AnimatedWidget, BaseWidget from composer_utils import Config fr...
Python
1
&Self) -> cmp::Ordering { self.next_request_at() .cmp(&other.next_request_at()) .reverse() } } impl PartialOrd for UnknownTxHashPriority { fn partial_cmp(&self, other: &Self) -> Option<cmp::Ordering> { Some(self.cmp(other)) } } pub struct SyncState { n_sync_sta...
Rust
0
ait.unwrap(); buf.clear(); continue; } } { let mut rng = rand::thread_rng(); let mut rand: u8; 'outer: loop { rand = rng.gen_range(1..=100); for rep in rep_str.iter() { if ...
Rust
0
'rest_api_url'), rest_api_url, self._repr_opt_name('username'), username)) def _repr_opt_name(self, config_opt_name): return '`{}.{}`'.format( ascii_str(self._config_sect_name), config_opt_name) def _try_logout(self, rt): try: logged_out ...
Python
1
ttributes { problem_mut[i as usize] = i as f32; } move || (&svm).predict_value(&mut problem).expect("This should work") } // RBF #[bench] fn predict_rbf_sv128_attr16(b: &mut Bencher) { b.iter(produce_testcase("c_svc", "rbf", 128, 16)); } #[bench] fn predict_rbf_sv...
Rust
0
me vector. fn pdf_value(&self, _origin: &Vec3, _v: &Vec3) -> f32 { 0.0 } /// Get a random vector for PDF use. fn random(&self, _origin: &Vec3) -> Vec3 { Vec3::new(1.0, 0.0, 0.0) } } impl Clone for Box<dyn Hittable> { fn clone(&self) -> Self { self.box_clone() } } <r...
Rust
0
caption_videos: logger.warning(f"警告: caption目录中没有找到视频文件,预处理可能会失败") if hasattr(status, 'update'): current_status = status.value if hasattr(status, 'value') else "" status.update(value=current_status + "\n警告: 没有找到视频文件,请确保将视频放入数据集目录或raw_videos目录") # 清理分辨率字符串,提取数字部分 cle...
Python
1
SizeInBytes: VERTEX_DATA_SIZE as u32, StrideInBytes: STANDARD_VERTEX_STRIDE, }, index_buffer_view: D3D12_INDEX_BUFFER_VIEW { BufferLocation: geometry_va + VERTEX_DATA_SIZE as u64, SizeInBytes: INDEX_DATA_SIZE as u32, Format...
Rust
0
def calcular_volumen(largo, ancho, altura): return largo * ancho * altura def calcular_precio(volumen): if volumen < 1000000: return 100 elif 1000000 <= volumen <= 5000000: return 300 else: return 500 def operacion(): print("Servicio de paquetería.\n") print("In...
Python
1
* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. ...
Rust
0
0,unit_nums): condition_i=unit_np[:,0]==i+1#找出对应编号的数据下标集合 unit_index_i=np.where(condition_i) unit_number_i_index=unit_index_i[0] unit_number_i=unit_np[unit_number_i_index,:] if(isCut): unit_number_i=unit_number_i[:,5:unit_number_i.shape[1]] unit_number_list.ap...
Python
1
prev_range = Some(range); } } } if let Some(prev) = prev_range { line_ranges.push(prev); } line_ranges } <reponame>MeteorGX/aqara_rs use crate::session::{Multicast, Broadcast, Unicast}; /// /// 心跳反馈的字节长度: 16 /// pub const AES_KEY_SIZE:usize = 16; /// /// ...
Rust
0
def usuario(nombre): if len(nombre) < 7 or len(nombre)>12: return "El nombre de usuario tiene que tener entre 7 a 12 caracteres." if (not nombre.isalnum()): return "El nombre de usuario puede contener solo letras y números" return True
Python
1
ok() .unwrap_or_else(|| { error!("Failed to parse socket address!"); eprintln!("Usage: network_echo_client <ip>:<port>"); std::process::exit(1); }) } /// A worker who isn't always available. It registers itself with the /// hub forwarding service to never miss a mes...
Rust
0
/// DIFF NOTE: Returns the start addr to the new created mmap instead of reference to Mapping /// Note that this is not necessarily the same as `k.start()` as mappings could have /// been coalesced. pub fn recreate_shared_mmap( &mut self, k: MemoryRangeKey, maybe_option_preserve...
Rust
0
} #[inline] /// Returns `true` if the provided address can have `map` called on without needing memory allocation // Used in physical memory allocation to avoid recursion pub fn can_map_without_alloc(a: *mut ()) -> bool { imp::can_map_without_alloc(a) } #[inline] pub unsafe fn map(a: *mut (), p: ::m...
Rust
0
, df, iflag, tf, sf, zf, af, pf, cf ); } } #[allow(unused_variables)] fn __action2<'input, 's>( vm: &VM, input: &'input str, (_, __0, _): (usize, &'input str, usize), (_, __1, _): (usize, &'input str, usize), ) -> () { { println!("AX : 0x{:04X}\t\tSP : 0x{:04X}", vm.arch.ax, vm....
Rust
0
import base64 import hashlib import random import string import time import uuid import requests class HaiboTvSpider: def __init__(self): self.api_key = "fe9fc289c3ff0af142b6d3bead98a923" self.sha1_salt = "RzhGSFhlZFBnbDRpN3NBMnJmVUlTeGZhQjBOQjVXSkM=" self.version = "3.2.6" def calc_...
Python
1
_descriptor_proto_data).unwrap() } pub fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto { file_descriptor_proto_lazy.get(|| { parse_descriptor_proto() }) } <filename>src/common/middleware/mod.rs pub mod auth_middleware; pub mod rejection_handler;<gh_stars>0 //! Errors ...
Rust
0
/// Information about a shard, including its latency, current session sequence, /// and connection stage. #[derive(Clone, Debug, Deserialize, Serialize)] pub struct Information { id: u64, latency: Latency, session_id: Option<Box<str>>, seq: u64, stage: Stage, } impl Information { /// Return t...
Rust
0
import paho.mqtt.client as mqtt import json import time # MQTT Broker Information broker_address = "test.mosquitto.org" broker_port = 1883 client_id = "vehicle_tracker" # Vehicle information vehicle_id = "vehicle_001" # Callback function for when the client receives a CONNACK response from the server. def on_connect...
Python
1
import cv2 import numpy as np from .base_matcher import BaseMatcher class CV2SIFTMather(BaseMatcher): def __init__(self, args=None): super().__init__() self.sift = cv2.SIFT_create() def match_np(self, img0, img1): # Convert images to grayscale gray0 = cv2.cvtColor(img0, cv2.CO...
Python
1
", ], ); #[cfg(feature = "decoder")] compile_and_add_openh264_static_lib( "decoder", "upstream/codec/decoder", &["upstream/codec/decoder/core/inc/", "upstream/codec/decoder/plus/inc/"], ); #[cfg(feature = "encoder")] compile_and_add_openh264_static_lib( ...
Rust
0
_RoleName: 角色名称 :type RoleName: str """ self._RoleId = None self._RoleName = None @property def RoleId(self): r"""角色id :rtype: str """ return self._RoleId @RoleId.setter def RoleId(self, RoleId): self._RoleId = RoleId @prope...
Python
1
ribution('wheel') except pkg_resources.DistributionNotFound: dist.announce('WARNING: The wheel package is not available.', log.WARN) class _DeprecatedInstaller(SetuptoolsDeprecationWarning): @classmethod def warn(cls, stacklevel=1): warnings.warn( "setuptools.installer and fetc...
Python
1
params, crypt_info_file) print( f"{'Encrypted' if encrypt else 'Decrypted'}" f" {num_bytes} bytes in {timer.elapsed:.6f} seconds" f" {timer.rate(num_bytes / mebibyte)} MiB/s" ) def run_tests( message: bytearray, chunk_size: int, threads: int, automatic_verification: bo...
Python
1
nsert(d_index, 'd3') orbital_list.insert(d_index, 'd2') orbital_list.insert(d_index, 'd1') if 'f' in orbital_list: f_index = orbital_list.index('f') orbital_list.remove('f') orbital_list.insert(f_index, 'f7') orb...
Python
1
import pytest from django.utils import timezone from landifys.services import interactions, BusinessLogicError from landifys.models import User, Property, Listing, Appointment # Sử dụng fixture của pytest để tạo dữ liệu dùng chung cho nhiều test @pytest.fixture def appointment_setup(): owner = User.objects.create...
Python
1
fn parse_nullable(string: &str) -> (bool, &str) { if string.starts_with(literals::NULLABLE) { (true, string[literals::NULLABLE.len()..].trim_left()) } else { (false, string.trim_left()) } } pub fn parse(string: &str) -> Result<(Column, &str), KbtError> { ...
Rust
0
Indentation(n)); } } } impl<L> Default for Tokens<L> where L: Lang, { fn default() -> Self { Self::new() } } impl<L> Tokens<L> where L: LangSupportsEval, { /// Helper function to determine if the token stream supports evaluation at compile time. #[doc(hidden)] #[inline]...
Rust
0
("\n{}", disk); assert_eq!(regions, 1242); } } const PUZZLE: &'static str = "Disk Defragmentation"; const INPUT: &'static str = "ffayrhll"; #![allow(dead_code)] pub struct Solution {} impl Solution { pub fn is_ugly(num: i32) -> bool { if num <= 0 { return false; } l...
Rust
0
457, 0xFF785272, 0xFF7B697E, 0xFF472429, 0xFF43649F, 0xFF682D44, 0xFF61AEE9, 0xFF9387AA, 0xFF9D4A60, 0xFF822E37, 0xFFB98377, 0xFF87A0D1, 0xFFAA6E81, 0xFFC5737A, 0xFFB69EB0, 0xFF8D5658, 0xFF907070, 0xFFD69D9E, 0xFFF5BC9F, 0xFFB87BA0, 0xFFFFFCE1, 0xFFFCDCC5, 0xFF73D3F6, 0xF...
Rust
0
# Copyright Materialize, Inc. and contributors. 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 in the LICENSE file at the # root of this repository, or online at # # ht...
Python
1
keyserver.ubuntu.com', '--recv-keys', 'CE7709D068DB5E88']) cls.run_shell_script(cmd) @classmethod def update_apt_update_dependencies(cls): cmd = compose_cmd(['apt', 'list', '--upgradable']) logger.info("Getting list of upgradable packages ...") upgradable_packages = cls.run_shel...
Python
1
"""Plugin for NOS: Nederlandse Omroep Stichting Supports: MP$: http://nos.nl/uitzending/nieuwsuur.html Live: http://www.nos.nl/livestream/* Tour: http://nos.nl/tour/live """ import re import json from livestreamer.plugin import Plugin from livestreamer.plugin.api import http from livestreamer.plugin.api.uti...
Python
1
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. import torch import torch.nn as nn def detach_variable(inputs): """ Detach variables Parameters ---------- inputs : pytorch tensors pytorch tensors """ if isinstance(inputs, tuple): return tuple([deta...
Python
1
(), description: ticket_type.description.clone(), status: ticket_type.status(false, conn)?, start_date: ticket_type .start_date .and_then(|sd| if sd <= times::zero() { None } else { Some(sd) }), parent_id: ticket_type.parent_id, ...
Rust
0
} else { let initial_bidder = self.initial_bidder.next(); Either::Left(Active { initial_bidder: initial_bidder, hands: hands_to_option(shuffle()), bids: self.bids, scores: self.scores, state: BiddingState(ini...
Rust
0
Signal::BrightnessDown, [S,S,S,S,S,S,S,S,L,L,L,L,L,L,L,L,S,S,L,L,L,S,L,S,L,L,S,S,S,L,S,L] => Signal::BrightnessUp, [S,S,S,S,S,S,S,S,L,L,L,L,L,L,L,L,S,S,L,S,S,S,L,S,L,L,S,L,L,L,S,L] => Signal::White, [S,S,S,S,S,S,S,S,L,L,L,L,L,L,L,L,S,S,S,L,L,S,L,S,L,L,L,S,S,L,S,L] => Signal::Red, ...
Rust
0
_OnSkillTierChanged(self.addr()); } } fn replicate_skill_tier(&self, new_tier: i32) { unsafe { PRI_TA_ReplicateSkillTier(self.addr(), new_tier); } } fn on_title_changed(&self) { unsafe { PRI_TA_OnTitleChanged(self.addr()); } } fn sy...
Rust
0
-a {@extend %-a}\ \n" ) .unwrap(), "-a :foo.baz, -a :foo:foo(2n+1) {\ \n a: b;\ \n}\ \n" ); } // From "sass-spec/spec/non_conformant/extend-tests/071_test_pseudo_unification.hrx" #[test] #[ignore] // unexepected error fn t071_test_pseudo_unification() {...
Rust
0
lpr3(xouts[2]).permute(0,2,3,1)).permute(0,3,1,2),self.mca3t(self.lpt3(thermalouts[2]).permute(0,2,3,1)).permute(0,3,1,2) x4_1a,x4_1b = self.mca4(self.lpr4(xouts[3]).permute(0,2,3,1)).permute(0,3,1,2),self.mca4t(self.lpt4(thermalouts[3]).permute(0,2,3,1)).permute(0,3,1,2) x1_1lp=torch.nn.Sigmoid()(self...
Python
1
eval_results except Exception as e: logger.error(f"Error using RAGAS: {e}") # Fallback to mock return await self._evaluate_with_mock_ragas(test_cases, metrics) async def _evaluate_with_mock_ragas(self, test_cases: List[EvalTestCase], ...
Python
1
if n == 0 { println!( "{}[ x ] : Speed cannot be 0 (just use normal print?){}", RED, RESET ); process::exit(1); } else { ...
Rust
0
import summary import hydra import omegaconf import glob config = "/home/user/src/configs/basemae.yaml" cfg = omegaconf.OmegaConf.load(config) cfg.model.encoder.maskingfunction.masking_ratio = 0 cfg.dataset.numChannels= 4 model = hydra.utils.instantiate(cfg.model) batchsize = 16...
Python
1
import heapq def shortest_path(matrix, start, end): rows, cols = len(matrix), len(matrix[0]) directions = [(0, 1), (0, -1), (1, 0), (-1, 0)] # right, left, down, up # Convert the matrix into a graph graph = {(i, j): {} for i in range(rows) for j in range(cols) if matrix[i][j] != 'x'} for i in ra...
Python
1
import os from pytest_shutil import cmdline def test_umask(workspace): f = workspace.workspace / 'foo' with cmdline.umask(0o202): f.touch() assert (f.stat().st_mode & 0o777) == 0o464 def test_pretty_formatter(monkeypatch): monkeypatch.setenv("FORCE_COLOR", "1") f = cmdline.PrettyFormatte...
Python
1
ne, mem_manager) = Self::new_engine()?; // Deserialize already compiled WASM let module = unsafe { Module::deserialize(&engine, s.code)? }; // Link and instantiate let mut this = Self::new(module, engine, mem_manager)?; { puffin::profile_scope!("deserialize_write_m...
Rust
0
# # A pair of directives for inserting content that will only appear in # either html or latex. # from __future__ import (absolute_import, division, print_function, unicode_literals) import six from docutils.nodes import Body, Element class only_base(Body, Element): def dont_traverse(se...
Python
1
d=r_[Epsd[0],Epsd] Npsd=r_[Npsd[0],Npsd] Zpsd=r_[Zpsd[0],Zpsd] if return_as_db ==False: #Un-decibelize (not a word I know) Epsd=10**(Epsd/10) Npsd=10**(Npsd/10) Zpsd=10**(Zpsd/10) return periods, Epsd, Npsd, Zpsd # Ep1= def...
Python
1
rhsk u%A %% + 2 25 9; ; GGIE #e*+ E % )EE %<rcnt}|r*|dtvrt|\}}|j||r/|dtvr$t j dj|t...
Python
1
_boxed()) }) .unwrap() } fn commit(&mut self, root: Box<Node>) -> io::Result<(Box<Node>)> { let (root_index, root_pos) = root.get_storage_location(); let is_leaf = root.is_leaf(); // Add the meta root // Adding padding boundaries to the meta if needed ...
Rust
0