text
string
label_name
string
labels
int64
#Code https://github.com/Duff89/wb_smart_review import json import requests import re from g4f.client import Client HEADERS = { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36', } class WbReview: def __init__(self, string: str): ...
Python
1
""" Understand: Palindrome starts and ends with the same letter three - only one letter is not start/end Subsequence counted only once - first and last occurences needed only. s.length >> 10**5. Solution MUST be less than O(n-squared) Match: Hash set, table. Plan. Get first and last indices of unique chars in s. 0 1...
Python
1
import random import yaml from tqdm import trange from PIL import Image as IMG def drawcards(): with open(r'./drawcards.yml', 'r', encoding='utf-8') as f: config = yaml.safe_load(f) lottery = config['lottery'] up_person = config['up']['person'] up_decoration = config['up']['decorat...
Python
1
expected_output = { 'asic_0_mcid_oid': 6161, 'fset_mcidgid': 10131, 'fset_urid': '0x300000000002f4fc', 'interfaces': { 1: { 'adjid': '0xf80055d1', 'flags': 'InHw', 'iftype': 'svi_if', 'interface': 'Vl103', 'physicalif': '-----------', ...
Python
1
leConfigDelete(RequestHandler): @has_permission('admin') def get(self, ID): it = self.db.query(SiteLocaleConfig).get(ID) if it: self.db.delete(it) self.db.commit() self.redirect_next( self.reverse_url('admin:site:localeconfig') ) else: se...
Python
1
tf.Session() as sess: trace_dir = cfg.trace_dirs[args.trace] video_size_dir = cfg.video_size_dirs[args.video] all_cooked_time ,all_cooked_bw ,all_file_names, all_mahimahi_ptrs = load_traces(trace_dir) trace_num = min(args.trace_num, len(all_file_names)) if trace_num == -1: ...
Python
1
(&self) -> usize { self.name().len() + 2 } } #[derive(Debug, Clone, Eq, PartialEq)] pub enum Request { AuthNext {}, AuthNg {}, AuthReply {}, AuthRequired {}, AuthSetup {}, Close { input_method_id: u16, }, CloseReply { input_method_id: u16, }, Commit { ...
Rust
0
" uxBits = xEventGroupWaitBits("] #[doc = " xEventGroup, // The event group being tested."] #[doc = " BIT_0 | BIT_4, // The bits within the event group to wait for."] #[doc = " pdTRUE, // BIT_0 and BIT_4 should be cleared before returning....
Rust
0
r label in sample_labels: # assert label in id2label.keys(), print(label) # sample_gold.append(id2label[label]) # epoch_gold_label.append(sample_gold) epoch_gold = epoch_labels ## acc acc_right = 0 acc_total = 0 for sample_predict_id_list, sample_gold in zip(epoch_p...
Python
1
/// message, using the client's long-term key or another key selected via /// pre-authentication mechanisms. In a TgsRep message, the key usage value /// is 8 if the TGS session key is used, or 9 if a TGS authenticator subkey /// is used. #[rasn(tag(6))] pub enc_part: EncryptedData, } /// The ...
Rust
0
contains the sources of the official OpenGL repository. /// Content of the official `gl.xml` file. pub static GL_XML: &'static [u8] = include_bin!("../../../deps/khronos-api/gl.xml"); /// Content of the official `egl.xml` file. pub static EGL_XML: &'static [u8] = include_bin!("../../../deps/khronos-api/egl.xml"); /...
Rust
0
atch_size, nparams, vae.z_dim).transpose(1, 2).data n += batch_size # In[12]: qz_params = Variable(qz_params.view(3, 6, 40, 32, 32, K, nparams).cuda()) # if model_name.lower() != 'factvae': qz_params[:,:,:,:,:,:,1] = qz_params[:,:,:,:,:,:,1]/2 ## added by shao qz_samples = q_dist.sample(params=qz_params) #...
Python
1
# convert color from HSV to BGR img = mmcv.hsv2bgr(img) # random contrast if mode == 0: if np.random.randint(2): alpha = np.random.uniform(self.contrast_lower, self.contrast_upper) img *...
Python
1
/// let mday_fixed_len: &[u8; 2] = date.mday_bytes_fixed_len(); /// assert_eq!(mday_fixed_len, b"31"); /// # Ok::<_, datetime_string::Error>(()) /// ``` #[inline] #[must_use] pub fn mday_bytes_fixed_len(&self) -> &[u8; 2] { unsafe { // This is safe because `MDAY_RANGE` fits i...
Rust
0
et_prelude::*; use sp_std::vec::Vec; // Step 3.1 will include this in `Cargo.toml` cargo clean /// Configure the pallet by specifying the parameters and types on which it depends. #[pallet::config] pub trait Config: frame_system::Config { /// Because this pallet emits events, it depends on the ...
Rust
0
TODO: Redo how relative paths are handled. // assert_eq!(path_to_name("file", Path::new("./foo")).unwrap(), "./foo"); // assert_eq!( // path_to_name("file", // OsStr::from_bytes(b"f\xffoo").as_ref()).unwrap(), "\"./f\\ // u{fffd}oo\"" //); } //! # AML //! //! Code to parse and execute ACP...
Rust
0
e_requirements("default_config"), *gather_recursive_requirements("mqtt"), }, key=str.lower, ) + [""] ) + CONSTRAINT_BASE ) def diff_file(filename: str, content: str) -> list[str]: """Diff a file.""" return list( ...
Python
1
tely_by_hour_and_minute_and_second() { let rrule = RRule { freq: Frequency::Minutely, count: Some(5), by_hour: vec![6, 18], by_minute: vec![6, 18], by_second: vec![6, 18], ..Default::default() }; test_recurring_rrule( rrule, ymd_hms(1997, 9, 2,...
Rust
0
if p >= 1.0 { return f64::INFINITY; } if p <= 0.0 { return f64::NEG_INFINITY; } let u = p - 0.5; -beta * u.signum() * (1.0 - 2.0 * u.abs()).ln() } pub struct PrivateMetricsExtension<L: OakLogger> { metrics_proxy: Option<PrivateMetricsProxy>, logger: L, } impl<L> Private...
Rust
0
AVE FG", config.theme.octave_fg); theme_page.add_rgb("OCTAVE BG", config.theme.octave_bg); theme_page.add_empty(); theme_page.add_action2("RESET", "SAVE"); let mut app_page = Page::new("CONFIG", 'C'); app_page.add_bool("FULLSCREEN", config.app.fullscreen); app_page.add_int("ZOOM", config.app.zoom as usize, 1, 9,...
Rust
0
import numpy as np import mogp_emulator from mogp_emulator.Kernel import UniformSqExp from mogp_emulator.demos.projectile import print_predictions # additional GP examples using different Kernels # define some common variables n_samples = 20 n_preds = 10 # define target function def f(x): return 4.*np.exp(-0.5...
Python
1
Res<Diagnostics>, time: Res<Time>, mut query: Query<&mut Timer>) { if let Some(fps) = diagnostics.get(FrameTimeDiagnosticsPlugin::FPS) { for mut timer in query.iter_mut() { timer.tick(time.delta_seconds()); if !timer.finished() { return; } if ...
Rust
0
sion, # version check: github repository type="github_release", user="sethvoltz", repo="OctoPrint-DisplayPanel", current=self._plugin_version, # update method: pip pip="https://github.com/sethvoltz/OctoPrint-DisplayPanel/archive/{target_version}.zip" ) ) __plugin_name__ = "OctoPrint ...
Python
1
self.w.bits = (self.w.bits & !(0x01 << 12)) | (((value as u32) & 0x01) << 12); self.w } } #[doc = "Baseband DRAM1 access configuration\n\nValue on reset: 0"] #[derive(Clone, Copy, Debug, PartialEq)] pub enum BB_DRAM1_ACCESS_A { #[doc = "0: Baseband DRAM1 access disabled"] BB_DRAM1_ACCESS_DISAB...
Rust
0
import asyncio async def long_running_task(): try: print("Task started") await asyncio.sleep(5) print("Task finished") except asyncio.CancelledError: print("Task was cancelled") raise async def main(): task = asyncio.create_task(long_running_task()) await asy...
Python
1
// connect to cockroachdb let pool = PgPool::builder().max_size(5).build(&database_url).await?; let cursor_store: CursorStore = match cursor_store_value { CursorStoreType::CockroachDB => Arc::new(CrdbCursorStore::new(pool.clone()).await?), }; // begin processing cockroachdb changefeeds let...
Rust
0
# -*- coding: utf-8 -*- # Generated by Django 1.11 on 2018-11-11 19:19 from __future__ import unicode_literals from django.conf import settings import django.contrib.auth.models import django.contrib.auth.validators from django.db import migrations, models import django.db.models.deletion import django.utils.timezone ...
Python
1
default_initial_settings = { "name": "Signal Pro 500 v1", "manufacturer": "ATMAT sp. z o.o.", "start_gcode": "G21 ; set units to millimeters\nG90 ; use absolute positioning\nM82 ; absolute extrusion mode\nG28 ; home all without mesh bed level\nM420 S1\nG92 E0.0 ; reset extruder distance position\nG1 Z0.25\n...
Python
1
[doc = "Bit 0 - Interrupt for Counter=0"] #[inline(always)] pub fn pwm_0_inten_intcntzero(&mut self) -> _PWM_0_INTEN_INTCNTZEROW { _PWM_0_INTEN_INTCNTZEROW { w: self } } #[doc = "Bit 1 - Interrupt for Counter=PWMnLOAD"] #[inline(always)] pub fn pwm_0_inten_intcntload(&mut self) -> _PWM_0...
Rust
0
r", "party": d.customer, }, ) je.append( "accounts", { "account": self.accounts_receivable_unpaid, "debit_in_account_currency": flt(outstanding_amount), "cost_center": erpnext.get_default_cost_center(self.company), "reference_type": "Invoice Discounting", ...
Python
1
// } else { // return Ok(forbidden()); // } // } } None => Ok(not_found()), }; } }; } //! An example of [`deop::Manager`] usage. The dropped files metadata and content is printed to //! the console. #![recursion_limit = "1024"] // === Featur...
Rust
0
from typing import List def sortColors(nums: List[int]) -> None: l = 0 while l < len(nums): min_val = nums[l] min_index = l for i in range(l, len(nums)): num = nums[i] if num < min_val: min_val = num min_index = i nums[min_...
Python
1
import rclpy from rclpy.node import Node from sensor_msgs.msg import LaserScan import math class LaserScanListener(Node): def __init__(self): super().__init__('laser_scan_listener') self.subscription = self.create_subscription( LaserScan, '/scan', self.listener_...
Python
1
et_name.clone(), permission: permission.clone(), }; ensure!(!Self::do_add_role(role), Error::<T>::RoleAlreadyExists); // Added a role for a Member Permission::<T>::insert( (new_member.clone(), Role { pallet_name: pallet_name.clone(), permission: permission.clone(), } ), true)...
Rust
0
( (Expr.PushLong, 0x1), Expr.Return, ), 'loc_701', ) OP_99(0x00FE, 0x00, 0x07, 1500) Jump('func_02_6EC') def _loc_701(): pass label('loc_701') Return() # id: 0x0003 offset: 0x702 @scena.Code('func_03_702') def func_03_702(): If( ( ...
Python
1
note_data.note_tags if note_data.note_tags and len(note_data.note_tags) > 0 else None ), "note_liked": ( bool(note_data.note_liked) if note_data.note_liked is not None else Fals...
Python
1
ase=callback) layout.add_widget(button) def show_add_task_popup(self) -> None: """ 显示添加任务的弹窗。 """ show_add_task_popup(self) def show_edit_task_popup(self) -> None: """ 显示编辑任务的弹窗。 """ show_edit_task_popup(self) def show_delete_tas...
Python
1
dyn Error>> { let config_contents = fs::read_to_string(&config_path)?; let cfgfile: ConfigFile = serde_json::from_str(&config_contents)?; Ok(cfgfile) } fn main() -> Result<(), Box<dyn Error>> { let args: Vec<String> = env::args().collect(); let progname = args[0].clone(); let mut opts = Opti...
Rust
0
# Python 3 Spelling Corrector # # Copyright 2014 Jonas McCallum. # Updated for Python 3, based on Peter Norvig's # 2007 version: http://norvig.com/spell-correct.html """ Word based methods and functions Author: Jonas McCallum https://github.com/foobarmus/autocorrect Optimized by: Filip Sondej https://github.com/fifim...
Python
1
_img=None): """ Parameters ---------- x: torch.Tensor (batch, seqlen1, hidden_dim) (where hidden_dim = num_heads * head_dim) y: torch.Tensor (batch, seqlen2, hidden_dim2) freqs_cis_img: torch.Tensor (batch, hidden_dim // num_heads), RoP...
Python
1
def solve(grid): H = len(grid) W = len(grid[0]) seen = [[False]*W for _ in range(H)] for i in range(H): for j in range(W): if grid[i][j] != 0 and not seen[i][j]: col = grid[i][j] pts = [] stack = [(i,j)] seen[i][j] = Tru...
Python
1
SYMBOL, BAD_SYMBOL, BAD_SYMBOL, BAD_SYMBOL, BAD_SYMBOL, BAD_SYMBOL, BAD_SYMBOL, BAD_SYMBOL, BAD_SYMBOL, BAD_SYMBOL, BAD_SYMBOL, BAD_SYMBOL, BAD_SYMBOL, BAD_SYMBOL, BAD_SYMBOL, BAD_SYMBOL, BAD_SYMBOL, BAD_SYMBOL, BAD_SYMBOL, BAD_SYMBOL, BAD_SYMBOL, BAD_SYMBOL, BAD_SYMBOL, BAD_SYMBOL, BAD_SYMBOL, BAD_SYMBOL, ...
Rust
0
.programiz.com/python-programming/statement-indentation-comments for dot in dots ]) return labels def get_dot_numbers(self,dots): numbers = VGroup(*[ TextMobject(f"{n}",height=0.2).next_to(dot,DOWN,buff=SMALL_BUFF) for n,dot in zip(range(1,len(dots)+1...
Python
1
# Copyright 2021 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
Python
1
fn bits(&mut self, bits: u32) -> &mut Self { self.0.bits(bits); self } } #[doc = "Touch pad %s configuration register\n\nThis register you can [`read`](crate::generic::Reg::read), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`reset`](crate::generic::Reg::reset), [`write`](crate::gene...
Rust
0
onst _ as usize }, 0usize, concat!( "Offset of field: ", stringify!(SteamNetworkingIdentity__bindgen_ty_2), "::", stringify!(m_szUnknownRawString) ) ); assert_eq!( unsafe { &(*(::std::ptr::null::<SteamNetworkingIdentity__bindgen_ty_2>())).m_ip as *const _ as usize }, 0usize, concat!...
Rust
0
erna wysokoarabšćina', 'hu': 'modern szabványos arab', 'hy': 'արդի ընդհանուր արաբերեն', 'ia': 'arabe standard moderne', 'id': 'Arab Standar Modern', 'ig': 'Ụdị Arabiikị nke oge a', 'is': 'stöðluð nútímaarabíska', 'it': 'arabo moderno standard', 'ja': '現代標準アラビア語', 'jv': 'Arab Standar Anyar', 'ka': 'თანამედროვე სტანდარტუ...
Python
1
, obstacles_stream) time_to_decision_loop_stream.set(time_to_decision_stream) return (camera_streams, pose_stream, route_stream, global_trajectory_stream, open_drive_stream, point_cloud_stream, imu_stream, gnss_stream, extract_control_stream, control_display_stream, perfect_...
Python
1
from celery import shared_task from posthog.exceptions_capture import capture_exception @shared_task(ignore_result=True, rate_limit="5/s") def sync_members_to_billing(organization_id: str) -> None: from posthog.models import Organization, OrganizationMembership organization = Organization.objects.get(id=org...
Python
1
er.update_loss(s_e_loss, epoch_i, 's_e_loss_epoch') self.writer.update_loss(d_loss, epoch_i, 'd_loss_epoch') self.writer.update_loss(c_loss, epoch_i, 'c_loss_epoch') # Save parameters at checkpoint for last epoch if (self.n_epoch_trained + epoch_i)%5 == 4: ...
Python
1
.lock(); process.load(&exec).map_err(|_| ExecLoadError)?; process.set_args(argv).map_err(|_| SetArgsError)?; process.run(); } scheduler::push(process); Ok(process_id) } } <filename>migrations/src/lib.rs mod migrations; pub use self::migrations::{pg, ...
Rust
0
sync: bool, prioritized: bool, } impl<'a> DeviceRequest<'a> { pub(crate) fn new(device: &'a DeviceThreadHandle) -> Self { DeviceRequest { device, deadline: None, max_queue_len: None, wait_for_running: false, enforce_journal_sync: false, ...
Rust
0
V1_10, V1_20, V1_30, V1_40, V1_50, V3_30, V4_00, V4_10, V4_20, V4_30, V4_40, V4_50, V4_60, V1_00Es, V3_00Es, ]; for &version in versions.iter() { if ast .set_compiler_options(&glsl::CompilerOptions { version, vertex: glsl::CompilerVertexOptions::de...
Rust
0
tx_class: TxClass ) -> usize { // May version. // Note: AOMMIN(level, 3) is useless for decoder since level < 3. let mut mag = clip_max3(levels[1]); // { 0, 1 } mag += clip_max3(levels[(1 << bwl) + TX_PAD_HOR]); // { 1, 0 } if tx_class == TX_CLASS_2D { mag += clip_max3(levels[(1 << bwl) + ...
Rust
0
. See the COPYRIGHT file in the top-level directory of this distribution and at https://raw.githubusercontent.com/lemonrock/message-dispatch/master/COPYRIGHT. use super::*; include!("DropInPlaceFunctionPointer.rs"); include!("TaggedNonNullPointer.rs"); include!("VirtualMethodTablePointer.rs"); // Copyright (c) 2021...
Rust
0
if DUMP: sect.dumpsectionsinfo() return def usage(progname): print("") print("Description:") print(" Unpacks an unencrypted Kindle/MobiPocket ebook to html and images") print(" or an unencrypted Kindle/Print Replica ebook to PDF and images") print(" into the specified output fol...
Python
1
elf.ypos-=3 #update posistion self.xpos+=self.vx self.ypos+=self.vy if self.vx < 0 or self.vx > 0: #left animation self.ticker+=1 if self.ticker%10==0: #only change frames every 10 ticks self.frameNum+=1 if self.frameNum>7: self.fra...
Python
1
et Some(rx_inlet) = merge_inlets.pop() { /// if let Some(mut inlet) = merge.inlets().get(idx).await { /// inlet.attach("src_channel", rx_inlet).await; /// } /// } /// } /// /// let (tx_merge, mut rx_merge) = mpsc::channel(8); /// merge.outlet().attach("merge_c...
Rust
0
(*__cache).num += 1; let ref mut fresh9 = *(*__cache).cmaps.offset(id as isize); *fresh9 = CMap_new(); if CMap_parse(*(*__cache).cmaps.offset(id as isize), handle) < 0i32 { panic!("{}: Parsing CMap file failed.", "CMap",); } ttstub_input_close(handle); if __verbose != 0 { in...
Rust
0
let mut unquantized = [0; 96]; let plane_scale = if params.is_dual_plane { 2 } else { 1 }; let unquantized_range = &mut unquantized[0..params.get_num_weight_values() as usize]; let encoding = ENCODING_MAP[params.max_weight as usize]; match encoding.encoding { IntegerEncodingType::JustBit...
Rust
0
return { "campaigns": [], "adGroups": [], "keywords": [{"field": "keywordType", "values": ["BROAD", "PHRASE", "EXACT"]}], "targets": [{"field": "keywordType", "values": ["TARGETING_EXPRESSION", "TARGETING_EXPRESSION_PREDEFINED"]}], "productAds": [], ...
Python
1
String> = config.validators_registry_contract.map(|s| s.into()); Ok(ConfigResponse { owner: config.creator.to_string(), reward_dispatcher_contract: reward_dispatcher, validators_registry_contract: validators_contract, statom_token_contract: statom_token, }) } fn query_state(dep...
Rust
0
Generates the extrinsic's call field for a given module and call passed as &str /// # Arguments /// /// * 'node_metadata' - This crate's parsed node metadata as field of the API. /// * 'module' - Module name as &str for which the call is composed. /// * 'call' - Call name as &str /// * 'args' - Optional sequence of ar...
Rust
0
bind("127.0.0.1:8080")? .run() .await } //! Cryptographic test vectors for use in integration tests /// AES-CCM (Counter with CBC-MAC) test vectors mod aesccm; /// Ed25519 digital signature test vectors mod ed25519; /// HMAC-SHA-256 test vectors mod hmac; pub use self::aesccm::AESCCM_TEST_VECTORS; pub use s...
Rust
0
#!/usr/bin/env python3 # Copyright (C) 2021-2025 IGM authors # Published under the GNU GPL (Version 3), check at the LICENSE file import numpy as np import tensorflow as tf from igm.utils.math.getmag import getmag from igm.processes.iceflow.utils import get_velsurf, get_velbase, get_velbar from igm.processes.icef...
Python
1
import pytest import torch from compressed_tensors.quantization import ( QuantizationArgs, QuantizationScheme, QuantizationStrategy, QuantizationType, ) from torch.nn import Linear, Module, ReLU from llmcompressor.pytorch.utils import ModuleSparsificationInfo class FakeQuantizedModel(Module): def...
Python
1
se: assert 'layer type: %s cannot be P' % (layer.type) elif len(layer.top)>1: if layer.type == 'Slice': param=layer.slice_param out =Slice (blob_dict[layer.bottom[0]], name = layer.name,slice_point=param.slice_point,axis=param.axis) if out:...
Python
1
------ fn append_row_help() -> HelpMessage { variadic_help( "append-row", "append a row to the table the row is populated with the expression results", vec![HelpExample { desc: "append the row 1 2 3 to the table", code: "append-row 1 2 3", }], ) } fn appe...
Rust
0
),*) }; } #[macro_export] macro_rules! heap_struct_base { { pub struct $name:ident : $base:ty { $($field_names:ident : $field_types:ty),* } const SIZING: $crate::object_model::Sizing = $sizing:expr; } => { #[repr(C)] pub struct $name { base: $base, $($field_names : $fi...
Rust
0
from __future__ import print_function import os.path def fix_source_eol(path, is_dry_run = True, verbose = True, eol = '\n'): """Makes sure that all sources have the specified eol sequence (default: unix).""" if not os.path.isfile(path): raise ValueError('Path "%s" is not a file' % path) try: ...
Python
1
fn blit_tile(&self, pixels: &mut PixelData, vram_index: usize) { let tile = self.bg_tile_data(self.vram[vram_index]); let mapx = (vram_index - 0x1800) % 32; let mapy = (vram_index - 0x1800) / 32; Tile::write(self.bgrdpal, pixels, (mapx, mapy), &self.vram[tile]); } fn blit_to...
Rust
0
<String>`] which is the base denom /// for all operations, supposedly UST. /// /// - **owner** is an object of type [`Option<String>`] which is an owner address to update. /// /// ## Executor /// Only the owner can execute this. pub fn update_config( deps: DepsMut, info: MessageInfo, distribution_contra...
Rust
0
v.__code__.co_varnames if len(conames) == 0: continue arg_name = conames[0] if arg_name not in args: continue new_k = k+"_" if hasattr(Var, new_k): continue def inplace_wrapper(new_k, prev_func): setattr(Var, new_k, lambda x, *args, **kw: x.assign(prev_func(x, *args, **kw)))...
Python
1
dt[text()='CPU核数']/following-sibling::*[1]/text()") if cpu_num: item['cpu_num'] = cpu_num[0] sim_num = tree.xpath( "//dt[text()='双卡机类型']/following-sibling::*[1]/text()|//dt[text()='双卡机类型']/following-sibling::*[1]/text()") if sim_num: item['sim_num'] = sim_num[...
Python
1
account::domain_value::AccountInformation; use crate::modules::account::dto::Failure; use crate::modules::account::guard::Authenticate; use crate::modules::account::material::{Account, APIToken}; use crate::modules::account::tools::Update; #[openapi] #[post("/update/password", format = "application/json", data = "<con...
Rust
0
dot(theta) lamb = 0 theta = trainLinReg(X_poly, Y, lamb) x_simu, y_simu = plotFit(np.min(X), np.max(X), mu, sigma, p) fig1 = plt.figure(1) ax = fig1.add_subplot(111) ax.plot(X, Y, 'rx', ms=10, mew=1.5) ax.plot(x_simu, y_simu, '--', lw=2) ax.set_xlabel('Change in water level (x)') ax.set_ylabel('Water flowing out of t...
Python
1
acc, j| { acc[j] = ret[i-1][j-1] + ret[i-1][j]; acc })); } ret } } #[cfg(test)] mod tests { use super::*; #[test] fn test_example1() { assert_eq!( vec![ vec![1], vec![1, 1], ...
Rust
0
lf.keys[k]).cuda() if self.half: knns_vecs = knns_vecs.half() q_vecs = q.view(qsize[0], 1, qsize[1]) if function == 'cos': q_vecs = F.normalize(q_vecs, p=2, dim=-1) d = (knns_vecs * q_vecs).sum(dim=-1) return d if f...
Python
1
::Reg<maca2lr::MACA2LR_SPEC>, #[doc = "0x58 - Ethernet MAC address 3 high register"] pub maca3hr: crate::Reg<maca3hr::MACA3HR_SPEC>, #[doc = "0x5c - Ethernet MAC address 3 low register"] pub maca3lr: crate::Reg<maca3lr::MACA3LR_SPEC>, } #[doc = "MACCR register accessor: an alias for `Reg<MACCR_SPEC>`"] ...
Rust
0
id, comp_mask, area, centroid)) return merged_components def preserve_structure_components(self, components, original_mask, mode): """ 尝试保持图形结构的完整性 新增函数:用于处理非文字但属于同一结构的情况 """ if len(components) <= 1: return components # 统一组件格...
Python
1
, args.password) ctx.server_task = asyncio.create_task(server_loop(ctx), name="ServerLoop") if gui_enabled: ctx.run_gui() ctx.run_cli() ctx.atari_sync_task = asyncio.create_task(atari_sync_task(ctx), name="Adventure Sync") if args.patch_file: ext = args.p...
Python
1
_imports)] use self::u32_soft::U32x4; #[allow(unused_imports)] use self::u64_soft::U64x2; #[cfg(not(all( target_feature = "pclmulqdq", target_feature = "sse2", target_feature = "sse4.1", any(target_arch = "x86", target_arch = "x86_64") )))] cfg_if! { if #[cfg(target_pointer_width = "64")] { ...
Rust
0
Origin: u16, pub viWidth: u16, pub viHeight: u16, pub xfbMode: u32, pub field_rendering: u8, pub aa: u8, pub sample_pattern: [[u8; 2usize]; 12usize], pub vfilter: [u8; 7usize], } pub type GXRModeObj = _gx_rmodeobj; extern "C" { #[doc = " \\fn CON_Init(void *framebuffer,int xstart,int yst...
Rust
0
import sys import re """ PIPER script to extract elements from a SPA (Single Page Applicatin) html files and main JS bundles that can be interesting from security point of view. Target tool: Message viewers Require that HTTP headers NOT been passed Filters needed via matching of the case insensitive regex for the heade...
Python
1
#! /usr/bin/env python """ Created on Tue Jul 25 13:30:57 CDT 2023 @author: wellsjeremy """ import pytest from ifxdevsim.calculator import resolve_expressions def test_resolve_expression_simple(): test_data = dict( device='nshort', definitions=dict( device_type = 'nmos', ...
Python
1
shasa', 'xnr': 'कांगो - किंशासा', 'xog': 'Kongo - Zayire', 'yav': 'kitɔŋ kí kongó', 'yi': 'קאנגא־קינשאַזע', 'yo': 'Kóńgò – Kinshasa', 'yrl': 'Kũgu - Kĩxasa', 'yue': '剛果(金夏沙)', 'yue-Hans': '刚果(金夏沙)', 'yue-Hant': '剛果(金夏沙)', 'zgh': 'ⵜⴰⴳⴷⵓⴷⴰⵏⵜ ⵜⴰⴷⵉⵎⵓⵇⵔⴰⵜⵉⵜ ⵏ ⴽⵓⵏⴳⵓ', 'zh': '刚果(金)', 'zh-Hans': '刚果(金)', 'zh-Hant': '剛果(金夏沙)', ...
Python
1
collectors .get(&id) .map(|c| c.borrow().target.name.clone()) .as_ref() .unwrap_or(&id) )); }); let collector = collectors.remove(&id); drop(collector); ...
Rust
0
utableReference(Box<Type>), TyParam(usize), } impl Type { pub fn subst(&self, ty_args: &[Type]) -> VMResult<Type> { let res = match self { Type::TyParam(idx) => match ty_args.get(*idx) { Some(ty) => ty.clone(), None => { return Err(VMStatu...
Rust
0
(1), Idx(0), 0.0), Err("Target connects to source")); } #[test] fn bias() { let mut brain = Brain { nodes: Digraph::from(vec![ Node::Bias, Node::Output( 0, Neuron { activation: Function::...
Rust
0
eding max_load.""" groups = 1 current_sum = 0 for duration in tasks: if current_sum + duration > max_load: groups += 1 current_sum = 0 current_sum += duration return groups <= x def find_optimal_partition(tasks, x): """Find the optimal way to partit...
Python
1
capRecords<'a> { pub fn len(&self) -> usize { self.inner.len() } pub fn into_inner(self) -> Vec<PcapRecord<'a>> { self.inner } /// /// Parse a slice of bytes that correspond to a set of records, without libcap file format /// header (https://wiki.wireshark.org/Development/LibpcapFileFormat). Endian...
Rust
0
_color(self.props.colors.fg_compl_l, self.props.colors.bg_compl_l); for i in 0..self.props.height { let chars = if index >= 8 { "█" } else { match index % 8 { 0 => " ", 1 => "▁", 2 => "▂", 3 => "▃", ...
Rust
0
ce_dir_a, &target_dir).unwrap(); let file = dir_has_file(&subdir, "myimg.jpg"); assert_eq!(204636, get_file_size(&file).unwrap()); } #[test] fn test_dont_replace_same_file2() { let td = get_target_dir(); let copier = Copier::new(0, false); let source_dir_a = td.clon...
Rust
0
"""Test passing structs to Objective-C methods.""" import lldb from lldbsuite.test.decorators import * from lldbsuite.test.lldbtest import * from lldbsuite.test import lldbutil class TestObjCStructArgument(TestBase): mydir = TestBase.compute_mydir(__file__) def setUp(self): # Call super's setUp()...
Python
1
la(max(1), 2%, 3%);\ \n max-2: hsla(1, max(2%), 3%);\ \n max-3: hsla(1, 2%, max(3%));\ \n clamp-1: hsla(clamp(1, 2, 3), 2%, 3%);\ \n clamp-2: hsla(1, clamp(2%, 3%, 4%), 3%);\ \n clamp-3: hsla(1, 2%, clamp(3%, 4%, 5%));\ \n}\ \n" ); } <reponame>jasonkur/sh...
Rust
0
from typing import List, Optional from src.constants import PR_FILES from src.data.github.graphql.models import RawCommit from src.data.github.graphql.template import ( GraphQLError, GraphQLErrorMissingNode, GraphQLErrorRateLimit, GraphQLErrorTimeout, get_template, ) def get_commits( node_ids...
Python
1
config["FLEXMEASURES_FALLBACK_REDIRECT"] = False @pytest.mark.parametrize( "charging_eff, discharging_eff, storage_eff, expected_avg_power", [ ("100%", "100%", "100%", 0.009), ("95%", "100%", "100%", 0.009 / 0.95), ("95%", "100%", "95%", 0.009 / 0.95), ("125%", "100%", "95%", 0...
Python
1
technical::Module::<Runtime>::tech_account_id_to_account_id(&tech_account_id) .expect("Failed to get ordinary account id for technical account id."); account_id }; pub GetMbcPoolRewardsTechAccountId: TechAccountId = { let tech_account_id = TechAccountId::from_generic_...
Rust
0
import sys def _stack(stack, v, num=0): if v == 1: stack.append(num) if v == 2: if stack: out = stack.pop() print(out) else: print(-1) if v == 3: print(len(stack)) if v == 4: if stack: print(0) else: ...
Python
1
PathBuf::from(path_str); let mut parent_dir = proto_file.to_path_buf(); parent_dir.pop(); let include = format!("-I{}", parent_dir.to_string_lossy()); let mut cmd = Command::new(&self.protoc_path); cmd.arg(output.as_str()) .arg(include.as_str()) .arg("--include_imports") .arg(pr...
Rust
0