text
string
label_name
string
labels
int64
let serialized_connector = serde_json::to_string(&actual).unwrap(); assert_eq!(serialized_input, serialized_connector); let deserialized_connector: super::Connector = serde_json::from_str(&serialized_connector).unwrap(); assert_eq!(*expected, deserialized_connecto...
Rust
0
ativeMediaType::Audio, uri: Some("alt-media-uri".into()), group_id: "group-id".into(), language: Some("language".into()), assoc_language: Some("assoc-language".into()), name: "Xmedia".into(), default: true, // Its absence indicates an implicit v...
Rust
0
ty(0), }; let group = randomize_string("vendor"); { let _ = db.users.add_user(&user).await?; let _ = db.groups.add_group(&group).await?; let group = db.groups.get_group_by_name(&group).await?; let groups = vec![group]; let _ = db .users_to_groups ...
Rust
0
import logging from io import BytesIO logger = logging.getLogger(__name__) def download_s3_object_to_memory( s3_client, bucket_name: str, object_key: str ) -> BytesIO: # Create an S3 client try: # Download the object into memory response = s3_client.get_object(Bucket=bucket_name, Key=obje...
Python
1
Ok(0) } }<gh_stars>0 use std::collections::{HashMap, HashSet}; lazy_static! { pub static ref SOURCE_FILE_EXTENSIONS: HashSet<&'static str> = { hashset! {".bs", ".src.html"} }; pub static ref SHORT_TO_LONG_STATUS: HashMap<&'static str, &'static str> = { hashmap! { "D...
Rust
0
import os import requests from bs4 import BeautifulSoup INPUT_FILE = "links_of_missing_images.txt" OUTPUT_DIR = "Textures/Item Models" LOG_FILE = "missing_items_log.txt" os.makedirs(OUTPUT_DIR, exist_ok=True) missing = [] with open(INPUT_FILE, encoding="utf-8") as f: lines = [line.strip() for line in f if line.s...
Python
1
write!(f, "Network Rpc error: {}", self.message) } } pub type Result<T, E = NetRpcError> = core::result::Result<T, E>; impl From<anyhow::Error> for NetRpcError { fn from(any_err: anyhow::Error) -> Self { match any_err.downcast::<NetRpcError>() { Ok(rpc_err) => rpc_err, Err(any_...
Rust
0
from streamlit_faker import get_streamlit_faker from .. import extra get_streamlit_faker = extra(get_streamlit_faker) def example(): fake = get_streamlit_faker(seed=42) fake.markdown() fake.info(icon="💡", body="You can also pass explicit parameters!") fake.selectbox() fake.slider() fake.met...
Python
1
= "N").dropna() normal_cmps.index = range(len(normal_cmps)) nasdaq_tickers = normal_cmps[["Symbol", "Security Name"]] nasdaq_tickers.loc[:, "Exchange"] = "NASDAQ" return nasdaq_tickers def main(): batch_size = 25 nasdaq_tickers = fetchTickers() m = len(list(nasdaq_tickers["Symbol"])) ...
Python
1
99.0.4844.51 Safari/537.36 Edg/99.0.1150.39", ); struct Progress { name: String, done: usize, total: usize, } impl Display for Progress { fn fmt(&self, f: &mut Formatter) -> FmtResult { write!(f, "{} => {}/{}", self.name, self.done, self.total) } } impl Progress { fn new(name: &str, t...
Rust
0
State::ScannedComment(read) => { bytes = &bytes[read..]; } State::ScannedCdata(read) => { bytes = &bytes[read..]; } } } assert_eq!(expected_state_iter.next(), None); } fn scanner_scan_2(bytes: &[u8]) { let mut bytes = bytes; le...
Rust
0
4: # Deactivate Skill label_target_probs = torch.zeros_like(action_target_probs) label_target_probs[0][int(label[0, 1].item())] = 1.0 action_target_loss = self.backbone_cross_entropy_function(action_target_probs, label_target_probs) loss = action_target_loss.item() ...
Python
1
inline=False) embed.set_footer(text='ID: ' + str(user.id)) await ctx.send(embed=embed) #botinfo @commands.command(pass_context=True) @commands.guild_only() async def botinfo(self, ctx): user = ctx.author embed = discord.Embed(color=0xdfa3ff, title="mr Monkey's Profile:") embed.set_author(n...
Python
1
"""Discovery module for Tuya devices. Entirely based on tuya-convert.py from tuya-convert: https://github.com/ct-Open-Source/tuya-convert/blob/master/scripts/tuya-discovery.py """ import asyncio import json import logging from hashlib import md5 from cryptography.hazmat.backends import default_backend from cryptogra...
Python
1
pub message_id: i64, #[doc = "0-based identifiers of answer options, chosen by the user. User can choose more than 1 answer option only is the poll allows multiple answers"] pub option_ids: Vec<i32>, } impl Method for SetPollAnswer { const TYPE: &'static str = "setPollAnswer"; ...
Rust
0
import numpy as np from mesh import Mesh from scipy.sparse import lil_matrix from scipy.sparse.linalg import lsmr m = Mesh("input-face.obj") # load mesh def nearest_axis(n): return np.argmax([np.abs(np.dot(n, a)) for a in [[1,0,0],[0,1,0],[0,0,1]]]) for dim in range(3): # the problem is separable in x,y,z ...
Python
1
), ]) .is_one(); end_timer!(pairing_time); end_timer!(check_time, || format!("Result: {}", result)); Ok(result) } // Functions for checking errors pub(crate) fn check_degree_is_within_bounds(num_coefficients: usize, num_powers: usize) -> Result<(), Error> { i...
Rust
0
def get_bucket_sizes(model: torch.nn.Module, cap_size: int) ->List[int]: """ Inputs: Pytorch model and a bucket size cap Outputs: list of bucket sizes in Megabytes. """ params = [p for p in model.parameters() if p.requires_grad] bucket_cap_mb = cap_size bucket_bytes_cap = int(bucket_cap_mb *...
Python
1
58363725152142129326129780047268409114441015993725554835256314039467401291", r: "115792089210356248762697446949407573529996955224135760342422259061068512044369", h: "1", gx: "48439561293906451759052585252797914202762949526041747995844080717082404635286", gy: "36134250956749795798585127919587881956611106...
Rust
0
from starlette.responses import Response, JSONResponse from backend.managers.DownloadsManager import DownloadsManager from backend.pagination import parse_pagination_params class DownloadsView: def __init__(self): self.manager = DownloadsManager() async def get(self): downloads = await self.ma...
Python
1
quivos_corrigidos}") print(f"🔧 Imports corrigidos: {corretor.imports_corrigidos}") print(f"💾 Backup: {corretor.backup_dir}") if corretor.erros_encontrados: print(f"\n⚠️ {len(corretor.erros_encontrados)} erros encontrados") print("Verifique o relatório para deta...
Python
1
'2009-01-01', ... 'form-1-title': 'blah', ... 'form-1-slug': 'Morning in Prague', ... 'form-1-subtitle': 'rawr', ... 'form-1-posted': '2009-08-02' ... } >>> formset = FormSet(data) >>> formset.is_valid() False >>> formset._non_form_errors [u'Please correct the duplicate data for slug which must be uniqu...
Python
1
.hidden_size)) for i in range(x.shape[1]): self.h_state_list.append(h) self.c_state_list.append(c) h, c, step_output = self.lstm_cell.forward(x[:, i, :], h, c) self.step_output_list.append(step_output) self.h_output = h return self.h_output de...
Python
1
emo_data'] st.dataframe(demo_data.head()) # 簡單圖表 fig = px.line(demo_data, x='Date', y='Close', title='股價走勢圖') st.plotly_chart(fig, use_container_width=True) if 'strategy_templates' in c...
Python
1
import pytest from plugins.letterboxd import Letterboxd # Test data as fixtures @pytest.fixture def test_lists(): return [ "jf_auto_collect/watchlist", "jf_auto_collect/likes/films", "jf_auto_collect/list/test_list/" ] @pytest.fixture def test_list_output(): return [ {'titl...
Python
1
import pandas as pd import matplotlib.pyplot as plt from scipy.integrate import quad import numpy as np from numpy import * c = 3.0e8 M = -19.26 H0 = 72.9 data = pd.read_csv("panth.csv") z = array(data.z) m = array(data.m) m_err = array(data.m_err) def dl_th(zlst,OmegaM,OmegaL): ln = len(zlst) dllst = zeros(...
Python
1
Plus => Ok(()), Sign::Minus => Err(CalcError::NotAPositive) } } /// Calculates the factorial of `num` pub fn factorial(num: BigDecimal, acc: Option<BigDecimal>, times: u8) -> Result<BigDecimal, CalcError> { if times == std::u8::MAX { return Err(CalcError::TooDeep); } require_whole(&num)?...
Rust
0
Box::new(location), } } } <reponame>peterdn/NebulaOS<filename>src/user.rs #![no_std] #![feature(intrinsics, lang_items)] extern crate libc; extern "rust-intrinsic" { fn transmute<T, U>(t: T) -> U; } extern { pub fn kprintf(fmt: *const u8, ...); } #[no_mangle] #[no_stack_check] pub unsafe fn rust_u...
Rust
0
if from_video: name_i = 1000 for grad_change in np.arange(0, 1, 0.02)*change_power: imgs = [] name_i += 1 styles += styles_direction*grad_change styles_idx = 0 x = img = None for k , res in en...
Python
1
# Copyright (c) 2023-2025 Arista Networks, Inc. # Use of this source code is governed by the Apache License 2.0 # that can be found in the LICENSE file. from __future__ import annotations from typing import TYPE_CHECKING, Protocol from pyavd._eos_cli_config_gen.schema import EosCliConfigGen from pyavd._eos_designs.st...
Python
1
#!/usr/bin/env python3 import argparse from os import path from platform import system import matplotlib.animation as animation import matplotlib.pyplot as plt import numpy as np from matplotlib import use from rplidar import RPLidar BAUDRATE: int = 115200 TIMEOUT: int = 1 DMAX: int = 4000 IMIN: int = 0 IMAX: int = ...
Python
1
ma: ```json {{{{ "query": string \\ text string to compare to document contents "filter": string \\ logical condition statement for filtering documents "limit": int \\ the number of documents to retrieve }}}} ``` The query string should contain only text that is expected to match the contents of documents...
Python
1
"""Load ResNet-18 saved to TorchScript and run inference with an example image.""" import os from math import isclose import numpy as np import torch from resnet18 import print_top_results def deploy(saved_model: str, device: str, batch_size: int = 1) -> torch.Tensor: """ Load TorchScript ResNet-18 and run ...
Python
1
: &mut String) { let mut array = JSONArrayWriter::new(output_buffer); let mut iter = self.iter(); while let Some(item) = iter.next() { array.value(item); } } } impl <Key: AsRef<str>, Item> JSONWriterValue for &std::collections::HashMap<Key, Item> where for<'b> &'b Item: JSONWriterValue { fn write_json(se...
Rust
0
) -> Result<()> { let mut inner = self.inner.lock().await; let index = inner .sealed_segments .partition_point(|x| x.max_timestamp() < ts); for segment in inner.sealed_segments.drain(..index) { fs::remove_file(segment.path()).await?; } Ok(()) ...
Rust
0
eDate提取年份: {medline_date.text}") else: logger.warning(f"文献 {pmid} 缺少PubDate标签") if not pub_year: logger.warning(f"文献 {pmid} 未能提取到发表年份") return None try: pub_year = int(pub_year) # logger.info(f"成功将年份转换为整数: {pub_yea...
Python
1
# Copyright (c) OpenMMLab. All rights reserved. import pytest import torch from mmseg.models.backbones import ResNeXt from mmseg.models.backbones.resnext import Bottleneck as BottleneckX from .utils import is_block def test_renext_bottleneck(): with pytest.raises(AssertionError): # Style must be in ['pyt...
Python
1
let exprs = ["[ab]b"]; let valids = ["ab", "bb"]; let invalids = ["", " ", "a", "b", "aa", "cb"]; run_tests!(&exprs, &valids, &invalids); let exprs = ["[a]]"]; let valids = ["a]"]; let invalids = ["", " ", "a", "]", "[a]", "[a]]", "b]"]; run_tests!(&exprs, &valids, &invalids); let expr...
Rust
0
hysicalConnectorType::SfpPlus => "SFP_PLUS", PhysicalConnectorType::Wifi => "WIFI", PhysicalConnectorType::Unknown(s) => s.as_ref(), } } /// Returns all the `&str` values of the enum members. pub fn values() -> &'static [&'static str] { &["QSFP", "RJ45", "RJ45_2", "SF...
Rust
0
from pudzu.pillar import * for country in ["poland", "belgium", "polishpolish", "hungary"]: if country == "polishpolish": title = "Polish-themed stamps from around the world" else: title = f"Jewish-themed stamps from {country}" data = {} lines = Path(f'stamps{country}.txt').read_text()...
Python
1
_logger(&config); init_global_genesis_info(&config); let miner_config = &config.miner; let rpc_urls = config.rpc_urls(); let miner = Miner::new(miner_config, rpc_urls); miner.generate_blocks(blocks); } CommandLine::BenchMode(config, skip_best_...
Rust
0
: CPF, CNPJ, RG, CNH, CEP and Credit Card Number. //! //! validbr also provides validation for CPJ, CNPJ, CNH and Credit Card Number and a builtin database //! of brazilian CEP, Cities and States. //! //! # Cpf //! //! Consist in 9 digits separated in partitions of 3 with `.` and two verifier digits separated by a `-` ...
Rust
0
ep, since not all schedulers have the same signature # eta (η) is only used with the DDIMScheduler, it will be ignored for other schedulers. # eta corresponds to η in DDIM paper: https://arxiv.org/abs/2010.02502 # and should be between [0, 1] accepts_eta = "eta" in set( inspe...
Python
1
IM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ use std::f32; pub use crate::error::{EvalError, EvalResult}; pub mod parse; use self::parse::{parse_single, Expression, InfixOp...
Rust
0
:?}", path.to_string_lossy(), self); Ok(()) } } use thiserror::Error; #[derive(Error, Debug, PartialEq)] pub enum Error { /// Wrong marshal size. #[error("Wrong marshal size")] WrongMarshalSize, /// Packet lost exceeds maximum amount of packets /// that can possibly be lost. #[error...
Rust
0
("T32_bat1.256", "A3k_pike.pl8"), ("T32_bat1.256", "A3k_psnt.pl8"), ("T32_bat1.256", "A3k_swor.pl8"), ("T32_bat1.256", "A3p_arch.pl8"), ("T32_bat1.256", "A3p_cros.pl8"), ("T32_bat1.256", "A3p_knig.pl8"), ("T32_bat1.256", "A3p_mace.pl8"), ("T32_bat1.256", "A3p_pike.pl8"), ("T32_bat1.2...
Rust
0
w( hittable::BVH_Node::new_from_hittable_list(objects, &0.0, &1.0), )); } fn cornell_box() -> hittable::HittableList { let red = std::rc::Rc::new(material::Lambertian::new(color::Color::new( 0.65, 0.05, 0.05, ))); let white = std::rc::Rc::new(material::Lambertian::new(color::Color::new(...
Rust
0
#!/usr/bin/env python3 import rclpy from rclpy.node import Node from drone_status.srv import CheckUSBDevices class USBClient(Node): def __init__(self): super().__init__('usb_client') self.cli = self.create_client(CheckUSBDevices, 'check_usb_devices') # 等待服務啟動 while not sel...
Python
1
import numpy as np import torch class Yolov4Matcher(object): def __init__(self, num_classes, num_anchors, anchor_size, iou_thresh): self.num_classes = num_classes self.num_anchors = num_anchors self.iou_thresh = iou_thresh self.anchor_boxes = np.array( [[0., 0., anchor[...
Python
1
_iterator_get_key(iterator: *mut librdf_iterator) -> *mut libc::c_void; #[no_mangle] fn librdf_iterator_get_value(iterator: *mut librdf_iterator) -> *mut libc::c_void; #[no_mangle] fn librdf_new_empty_iterator(world: *mut librdf_world) -> *mut librdf_iterator; /* -*- Mode: c; c-basic-offset: 2 -*- ...
Rust
0
lkim->ljim',FBp[...,uf],T2[...,ut]) #alpha = t1 * Fbt + t2 * Fbp # Nd x Nr x Nt x Nf alpha = alpha1 + alpha2 self.fGHz = t1.x[ut] H = Tchannel(x = self.fGHz, y = alpha, tau = self.tauk, dod = self.tang, ...
Python
1
skip_serializing_none] #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct InlineQueryResultVideo { /// Unique identifier for this result, 1-64 bytes. pub id: String, /// A valid URL for the embedded video player or video file. pub video_url: String, /// Mime type of the content ...
Rust
0
# Copyright 2020 Google LLC # # 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
Python
1
#!/usr/bin/env python3 # Copyright 2020 Google LLC # # 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...
Python
1
!(trustqual_nzttIdentityDesc) ) ); } impl Clone for nzttIdentityDesc { fn clone(&self) -> Self { *self } } extern "C" { pub fn nztwOpenWallet( arg1: *mut nzctx, arg2: ub4, arg3: *mut text, arg4: ub4, arg5: *mut text, arg6: *mut nzttWallet, ...
Rust
0
#!/usr/bin/env python # # Public Domain 2014-2018 MongoDB, Inc. # Public Domain 2008-2014 WiredTiger, Inc. # # This is free and unencumbered software released into the public domain. # # Anyone is free to copy, modify, publish, use, compile, sell, or # distribute this software, either in source code form or as a compil...
Python
1
twice should return error while it didn't", ); } let stake_pool_id = stake_pool.to_id(); // stake pool should be in collection if !delegation_state .stake_pool_ids() .any(|x| x == stake_pool_id) { return TestResult::error(format!...
Rust
0
!("Unsorted:"); println!("{:?}\n", first_arr); let vec_size = first_arr.len(); quick_sort(&mut first_arr, 0, vec_size - 1); println!("Sorted:"); println!("{:?}\n", first_arr); // Print second vec, sort vec, then print sorted println!("Second array of 100 random items\n"); println!("Un...
Rust
0
', b'9', b'M', b'A', b'M', b'B', b'M', b'C', b'M', b'D', b'M', b'E', b'M', b'F', b'M', b'G', b'M', b'H', b'M', b'I', b'M', b'J', b'M', b'K', b'M', b'L', b'M', b'M', b'M', b'N', b'M', b'O', b'M', b'P', b'M', b'Q', b'N', b'0', b'N', b'1', b'N', b'2', b'N', b'3', b'N', b'4', b'N', b'5', b'N', b'6', b'N', b'7',...
Rust
0
, jnp.result_type(x)), xs ) input_avals = (carry_avals, scan_avals) in_avals, in_tree = jax.tree_util.tree_flatten(input_avals) f_flat, out_tree = jax.api_util.flatten_fun_nokwargs( lu.wrap_init(broadcast_body), in_tree ) in_pvals = list(map(pe.PartialVal.unknown, in_avals)) _, out_pv...
Python
1
r8(&GB::get_b, &GB::bit_7, &GB::set_b) } (0xCB, 0x79) => { self.shift_r8(&GB::get_c, &GB::bit_7, &GB::set_c) } (0xCB, 0x7A) => { self.shift_r8(&GB::get_d, &GB::bit_7, &GB::set_d) } (0xCB, 0x7B) => { self.shift_r8(&GB::get_e, &GB::bit_7, &GB::set_e) } (0xCB, 0x7C) => { sel...
Rust
0
# Function to perform DFS to find a path from start to target def dfs(graph, start, target, path=None, visited=None): # Initialize the path and visited set if they are not provided if path is None: path = [] if visited is None: visited = set() # Add the current node to the path and visi...
Python
1
import torch from torch.autograd import Function import rod_align_api class RoDAlignFunction(Function): @staticmethod def forward(ctx, features, rois, aligned_width, aligned_height, spatial_scale): batch_size, num_channels, data_height, data_width = features.size() ctx.save_for_backward(rois, ...
Python
1
ted"), ): requested_files = get_files_from_session(request, filenames) individual_archives = [] for filename, file_content in requested_files.items(): individual_archive = convert_and_pack(filename, file_content, dpi) individual_archives.append(individual_archive) combined_archive = co...
Python
1
#!/usr/bin/env python2.7 # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the #...
Python
1
: src_hi, rm: amt, }); ctx.emit(Inst::AluRRR { alu_op: ALUOp::Lsr64, rd: tmp1, rn: tmp1.to_reg(), rm: inv_amt.to_reg(), }); ctx.emit(Inst::AluRRR { alu_op: ALUOp::Lsl64, rd: tmp3, rn: src_lo, rm: amt, }); ctx.emit(Inst::A...
Rust
0
nodes1.push(node_cloned); } else { node_cloned.style = removed_style.clone(); nodes1.push(node_cloned); } } let mut nodes2 = Vec::new(); for node in &d2.graph.nodes { let label = node.label.as_str(); let mut node_cloned = node.clone(); node_cl...
Rust
0
})", self.error_type) } } impl error::ResponseError for ServerError { fn error_response(&self) -> HttpResponse { log::debug!("error: {}", self); let res = ResBody { message_list: self.message_list.clone(), content: vec![String::from("not content")], }; Htt...
Rust
0
nused)] use std::collections::HashMap; use aries_backtrack::Trail; use aries_collections::ref_store::RefVec; use aries_collections::*; use aries_model::bounds::Bound; use aries_model::lang::{IVar, IntCst, VarRef}; use aries_model::WModel; pub mod learn; pub mod max; pub mod range_set; pub mod signed_literal; create...
Rust
0
deps } } #[cfg(test)] mod test { use super::*; use propagation::events::FDEvent::*; use interval::interval::*; use propagators::test::*; #[test] fn x_greater_y_plus_z_test() { let dom0_10 = (0,10).to_interval(); let dom10_20 = (10,20).to_interval(); let dom10_11 = (10,11).to_interval(); ...
Rust
0
arm_id), Error::<T>::FarmNotExists); let stored_twin = Twins::<T>::get(node.twin_id); ensure!(stored_twin.pub_key == pub_key, Error::<T>::CannotCreateNode); let stored_farm = Farms::get(node.farm_id); ensure!(stored_farm.twin_id == node.twin_id, Error::<T>::CannotCreateNode); let id = NodeID::get(); ...
Rust
0
{ false }; let is_stale = if (since_last_check_secs > recheck_threashold_secs) && self.enable_periodic_check { debug!( "{:?} {:?} is {}s since last updated; updating", self.source, chain, since_last_check_secs ...
Rust
0
ame, (left_kp, right_kp) in COCO_SKELETON_FLIP_PAIRS.items(): limb_error = np.linalg.norm(limb_lengths[left_kp] - limb_lengths[right_kp]) constraints_error += limb_error return reprojection_error + constraints_error ##----------------------------------------- # https://github.c...
Python
1
import torch import tools.utils as d2l torch.set_printoptions(2) # 精简输出精度 def main(): """锚框""" img = d2l.plt.imread("./1.jpg") h, w = img.shape[:2] print(h, w) X = torch.rand(size=(1, 3, h, w)) Y = d2l.multibox_prior(X, sizes=[0.75, 0.5, 0.25], ratios=[1, 2, 0.5, 0.1]) print(Y.shape) ...
Python
1
from shiny.express import input, render, ui ui.page_opts(title="Kitchen Sink: ui.input_numeric()", fillable=True) with ui.layout_columns(): with ui.card(): ui.h3("Default Numeric Input") ui.input_numeric("default", label="Default numeric input", value=10) @render.code def default_...
Python
1
x9d\xa4\x12I\ 9\xf4\xda@RnM\xb6\xb5\xe8\xf4\xd7M\xb4\xf5\xd3\ \xd5\xfa\xddyT\x92X)\xc8\x1b]G'q\x00d\ \x9f\x94e~@\x186\x01\xfb\xc7\x06\x86u.T\xe3\ *\x03\x87!B\x86\x19l0\x07\x00\x9e\x0ey&>\ \x0f9-\x96\xcd\xb4\x12\x98Tm\xe0u\x03f\xd0\x00\ #\xd4t'\x0c\x5c\xf2\x02\xed\x06\x9e$\xe9\x8cm\x1b\ \x1bw\x1b\x8a\x9c\x82\x00o\xbcw\x...
Python
1
received = Vec::new(); let mut buff = [0u8; 1024]; while data_received.len() < jet_proto::JET_MSG_HEADER_SIZE as usize { let bytes_read = transport.read(&mut buff).await?; if bytes_read == 0 { anyhow::bail!("Socket closed during Jet header receive, no JetPacket received.",); ...
Rust
0
from flask import Flask, request, jsonify import sqlite3 import logging app = Flask(__name__) DB_PATH = 'demo.db' # Cấu hình logging với mức độ có thể điều chỉnh logging.basicConfig(level=logging.WARNING) # Chỉ log WARNING và cao hơn, tắt INFO # Nếu muốn bật lại logging, đổi thành: logging.basicConfig(level=logging....
Python
1
from rest_framework.routers import DefaultRouter from django.urls import include, path from .api.v1 import views from .views import export_all_assessments router = DefaultRouter() router.register("", views.CcaApiModelViewset, basename="cca") urlpatterns = [ path( "export-all-asessments", export_all_asse...
Python
1
""" A demonstration of the numerous ways of "watching" the state. # Expected output .get_when_not_equal('flag1', False) -> None main: I set flag1: .get_when(lambda s: s.get("flag1") is True) -> {'flag1': True} .get_when_equal('flag1', True) -> True .get_when_change() -> {'flag1': True} main: I set flag2: .get_when_...
Python
1
t() .write_all(&chunk) .map_err(From::from) }) }); core.run(work).unwrap(); } pub fn get_json(address : &str) -> Result<&str, io::Error> { let mut core = Core::new().unwrap(); let client = Client::new(&core.handle()); // let uri = "http://httpbin.org/ip"...
Rust
0
# -*- coding: utf-8 -*- # # Copyright 2025 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
, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x1F 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x3F 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x5F 1, 1, 1, 1, 1, ...
Rust
0
Ok(ResolutionStrategy::CellRangerLikeEm), "parsimony-em" | "full" => Ok(ResolutionStrategy::ParsimonyEm), "parsimony" => Ok(ResolutionStrategy::Parsimony), "parsimony-gene" => Ok(ResolutionStrategy::ParsimonyGene), "parsimony-gene-em" => Ok(ResolutionStrategy::ParsimonyG...
Rust
0
age = image * lam + shuffledImage * (1 - lam) # Labels and lambda newGToneHot = [GToneHot, shuffledGToneHot, lam] return newImage, newGToneHot ######################################### Mixup loss ########################################### def mixupCriterion(criterion, predProbs, targets): ...
Python
1
ArrayPut(arr, idx, x) } } // independent alias : 書き込みがあったら該当キャッシュ消去 // dependent alias : 書き込みがあったら該当キャッシュ消去, move があったら disable にして該当キャッシュ消去 // unknown cache : 同じ型に対する書き込みがあった時点でキャッシュ消去 fn cleanse_cache<'a>( e: &Expr, params: &Parameters<'a>, disabled: &mut Set<Id>, indep_saved: &mut Saved, unk...
Rust
0
"purge covered: {:?}", entry); } } } } pub fn scan_all(db: &Db) { db.expiration_data.lock().retain(|entry| { let slot = db.get_slot_by_id(entry.slot); let mut lock = slot.share_status.lock(); let dict = match &mut *lock { Some(s) => &mut s.dict, ...
Rust
0
I: Iterator<Item = Item>, { if self.stop.load(Ordering::Relaxed) { self.identity() } else { let folded = try_fold( &mut iterator, self.identity().into_result().ok().unwrap(), |a, b| match b.into_result() { ...
Rust
0
, # 플래그 없음 args=[] ) context = await browser.new_context( # 기본 설정만 viewport={'width': 1920, 'height': 1080} ) page = await context.new_page() # 탐지 확인 ...
Python
1
= b' ') .next() .unwrap(); Some(String::from_utf8_lossy(id).into()) } else { None }; ErrorPosition { line: self.position.line + offset, id, } } #[inline] fn find_line(&self, search_start: usize) ...
Rust
0
r, the name of the resource to delete. Returns: Operation: the operation for deleting the conversion workspace. """ return self.cw_service.Delete( self.messages.DatamigrationProjectsLocationsConversionWorkspacesDeleteRequest( name=name, requestId=api_util.GenerateReque...
Python
1
match Regex::new(re_str) { Ok(re) => Ok(Value::String(re.replace_all(subject, repl).to_string())), Err(err) => Err(EvalexprError::invalid_regex( re_str.to_string(), format!("{}", err), )), ...
Rust
0
from enum import Enum class GeneralWorkflowParameter(Enum): VERBOSE = "TRAM_VERBOSE" class PebbleGameParameter(Enum): """Parameter for Pebble Game workflow""" K = "TRAM_PEBBLE_GAME_K" L = "TRAM_PEBBLE_GAME_L" THREADS = "TRAM_PEBBLE_GAME_THREADS" class XtcParameter(Enum): """Parameter for XTC...
Python
1
"remove" in missile_edits: rows_to_remove.append(missile_index) logger.info(f"Removed missile {missile_index} {missile_edits[1]} for {unit_name}") else: for member, new_value in missile_edits.ite...
Python
1
, lineObj.line) if m: has_start = True brace_stack = 1 cur_line_idx += 1 continue if not has_start: m = re.match(start_func_patter, lineObj.line) if m: has_start = True brace_stack = 1 ...
Python
1
ods.clone(); tokio::spawn(async move { background_task(socket, methods, id).await }); id += 1; } } } } async fn background_task(socket: tokio::net::TcpStream, methods: Arc<Methods>, id: ConnectionId) -> anyhow::Result<()> { // For each incoming background_task we perform a handshake. let mut server =...
Rust
0
from transformers import AutoModelForSpeechSeq2Seq, AutoProcessor from .base import VoiceAssistant from loguru import logger import torch class MERaLiONAssistant(VoiceAssistant): def __init__(self): repo_id = "MERaLiON/MERaLiON-AudioLLM-Whisper-SEA-LION" self.processor = AutoProcessor.from_pretrai...
Python
1
optimizer. Args: optimizer (:class:`~torch.optim.Optimizer`): The optimizer for which to schedule the learning rate. num_warmup_steps (:obj:`int`): The number of steps for the warmup phase. num_training_steps (:obj:`int`): The total number of training ste...
Python
1
} if os.path.exists(template_file): try: with open(template_file, "r", encoding="utf-8") as f: data = json.load(f) except json.JSONDecodeError: data = [] else: data = [] exists = any(item["name"] == use...
Python
1
emeber_set.remove(property_name) if len(memeber_set) > 0: warnings.warn("%s fileds are useless." % ",".join(memeber_set)) class CreateDisksRequest(AbstractModel): r"""CreateDisks请求参数结构体 """ def __init__(self): r""" :param _Placement: 实例所在的位置。通过该参数可以指定实例所属可用区,...
Python
1