text string | label_name string | labels int64 |
|---|---|---|
# WIKILINKS AND EMBEDDED FILES: regex that includes any aliases
# group 0 captures embedded link; group 1 is everything inside [[]]
WIKILINK_REGEX = r'(!)?\[{2}([^\]\]]+)\]{2}'
# TAGS
TAG_INCLUDE_NESTED_REGEX = r'(?<!\()(?<!\\)#{1}([A-z]+[0-9_\-]*[A-Z0-9]?[^\s]+(?![^\[\[]*\]\]))\/?'
TAG_MAIN_ONLY_REGEX = r'(?<!\()#{1}... | Python | 1 |
import os
for person_id in os.listdir(image_dir):
person_image_dir = os.path.join(image_dir, person_id, "SPO")
person_landmark_dir = os.path.join(landmark_dir, person_id, "SPO")
person_meta_dir = os.path.join(meta_dir, person_id, "SPO")
if not (os.path.isdir(person_image_dir) and os.path.isdir(person_... | Python | 1 |
[macro_use]
extern crate nom;
use std::str;
use std::collections::HashMap;
use std::fmt;
use nom::{Offset, space, Needed, IResult, Err};
/// The WArc `Record` struct
#[derive(Clone)]
pub struct Record {
// lazy design should not use pub
/// WArc headers
pub headers: HashMap<String, String>,
/// Content... | Rust | 0 |
c fn connect(&self) -> Result<Connection, anyhow::Error> {
let params = self.params.as_ref().map_err(Clone::clone)?;
Ok(params.connect()
.race(self.print_warning(params))
.await?)
}
pub async fn connect_with_cert_verifier(
&self, verifier: Arc<dyn ServerCertVerif... | Rust | 0 |
lse));
let handle = thread::spawn({
let stop = stop_spinner.clone();
move || {
let spinner = ProgressBar::new(10000);
spinner.set_style(
ProgressStyle::default_spinner()
.tick_chars("⠁... | Rust | 0 |
stardust::payload::milestone::MilestoneId {
type Error = Error;
fn try_from(value: proto::MilestoneId) -> Result<Self, Self::Error> {
let bytes: [u8; stardust::payload::milestone::MilestoneId::LENGTH] =
value.id.try_into().map_err(|_| Error::InvalidBufferLength)?;
Ok(stardust::payl... | Rust | 0 |
nt.list_tools()
if tools_result and hasattr(tools_result, "tools"):
for tool in tools_result.tools:
if tool.name == tool_name:
# Check if the tool description mentions images or screenshots
if hasattr(tool, "description") an... | Python | 1 |
while wallet.get_balance()? < 100_000 {
std::thread::sleep(Duration::from_millis(1_000));
wallet.sync(noop_progress(), None)?;
println!("syncing done on party {} -- checking balance", id);
}
let wallet = GunWallet::new(wallet, gun_db);
Ok((wallet, keychain))
}
macro_rules! setup_te... | Rust | 0 |
}
v
}
}
/// The same as `upgrade_all`, except it clears the list before return.
pub fn take_all(&self) -> Vec<Handle<T>> {
let v = self.upgrade_all();
v.iter().for_each(|h| Handle::detach(&h));
v
}
}
impl<T> Default for WeakList<T> {
fn default() -> Self... | Rust | 0 |
PxVehicleClutchData() { assert_eq!(std::mem::size_of::<PxVehicleClutchData>(), 16); }
#[derive(Clone, Copy)]
#[repr(C)]
pub struct PxVehicleTireLoadFilterData {
pub mMinNormalisedLoad: f32,
pub mMinFilteredNormalisedLoad: f32,
pub mMaxNormalisedLoad: f32,
pub mMaxFilteredNormalisedLoad: f32,
... | Rust | 0 |
: i64,
#[serde(rename = "badgeColor")]
pub badge_color: String,
pub views: i64,
pub follows: i64,
}
//////////////
// 240P 极速 仅mp4方式支持
pub const VIDEO_QUALITY_240P: VideoQuality = VideoQuality { code: 6 };
// 360P 流畅
pub const VIDEO_QUALITY_360P: VideoQuality = VideoQuality { code: 16 };
// 480P 清晰
... | Rust | 0 |
: &js_sys::Uint8Array) -> Vec<u8> {
let mut v = a.to_vec();
heapsort(&mut v);
v
}
#[wasm_bindgen]
pub fn heapsort_float64array(a: &js_sys::Float64Array) -> Vec<f64> {
let mut v = a.to_vec();
heapsort(&mut v);
v
}
#[wasm_bindgen]
pub fn heapsort_float32array(a: &js_sys::Float32Array) -> Vec<f32... | Rust | 0 |
ion, SimulateSwapOperationsResponse};
use crate::test_constants::campaign_manager::CAMPAIGN_MANAGER;
use crate::test_constants::governance::GOVERNANCE;
use crate::test_constants::TERRASWAP_ROUTER;
pub type CustomDeps = OwnedDeps<MockStorage, MockApi, WasmMockQuerier>;
/// mock_dependencies is a drop-in replacement fo... | Rust | 0 |
doc = "*Required features: `\"Win32_Media_Multimedia\"`*"]
pub const WAVE_FORMAT_MPEG: u32 = 80u32;
#[doc = "*Required features: `\"Win32_Media_Multimedia\"`*"]
pub const WAVE_FORMAT_MPEG4_AAC: u32 = 41222u32;
#[doc = "*Required features: `\"Win32_Media_Multimedia\"`*"]
pub const WAVE_FORMAT_MPEGLAYER3: u32 = 85u32;
#[... | Rust | 0 |
v.lower() in ('yes', 'true', 't', 'y', '1'):
return True
elif v.lower() in ('no', 'false', 'f', 'n', '0'):
return False
else:
raise argparse.ArgumentTypeError('Boolean value expected.')
def import_class(name):
components = name.split('.')
mod = __import__(components[0]) # impo... | Python | 1 |
ize)>,
bed_path_list: Vec<String>,
file_snp_indexer: FileSnpIndexer,
}
impl PlinkColChunkIter {
pub fn new(
file_num_snps: Vec<(usize, PlinkSnpType)>,
range: OrderedIntegerSet<usize>,
num_snps_per_iter: usize,
num_people: usize,
bed_path_list: Vec<String>,
) -> P... | Rust | 0 |
.iter()
.map(|it| match it {
GenericParam::Type(tp) => {
let mut tp = tp.clone();
tp.bounds.push(parse_quote!( 'a ));
GenericParam::Type(tp)
}
_ => it.clone(),
... | Rust | 0 |
import requests
from django.core.management.base import BaseCommand
from io import BytesIO
from PIL import Image
import logging
import sys
logger = logging.getLogger(__name__)
handler = logging.StreamHandler(sys.stdout)
handler.setLevel(logging.DEBUG)
formatter = logging.Formatter('%(levelname)s - %(message)s')
handle... | Python | 1 |
on
dtype: Data type for tensors
include_boundary_points: If True, create points both inside and outside the grid
expand: Number of times to replicate points when creating boundary samples
Returns:
tuple: (primal_grid_batch, dual_grid_batch, jagged_points)
"""
grid, grid_d, p... | Python | 1 |
import logging
from telethon import TelegramClient, events
from telegram import Bot
from telegram.ext import Updater, CommandHandler
import asyncio
# Set up logging
logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - %(message)s', level=logging.INFO)
# Telegram API credentials
API_ID = '24158657'
API... | Python | 1 |
DockerManager::destroy_node(&node)?;
}
Ok(())
}
}
impl fmt::Display for Topology {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "\n Topo -")?;
write!(f, "\n Hosts:")?;
for host in &self.hosts {
write!(f, " {}", &host)?;
}
... | Rust | 0 |
"""
Funções com Parâmetro (de entrada)
- Funções que recebem dados para serem processados dentro da mesma;
se a gente pensar em um programa qualquer, geralmente temos:
entrada -> processamento -> saída
Se a gente pensar em uma função, já sabemmos que temos funções que:
- Não possuem entrada;
- Não possuem s... | Python | 1 |
/// Future type for use in client calls.
pub type ClientFuture<T> = Box<FutureExtra<Item = T, Error = Error> + Send>;
/// Future trait with extra helper methods.
pub trait FutureExtra: Future {
fn wait(self) -> Result<Self::Item, Self::Error>
where
Self: Sized;
}
impl<F: Future> FutureExtra for F {
... | Rust | 0 |
// Problem: First Unique Character in a String
// Difficulty: EASY
// LeetCode URL: https://leetcode.com/problems/first-unique-character-in-a-string/
// Date: 2024-09-29
class Solution:
def firstUniqChar(self, s: str) -> int:
if len(s)==1:
return 0
d={}
for i in range(len(s)):
... | Python | 1 |
borrowed_fd(fd),
out(&mut storage),
by_mut(&mut addrlen),
]),
))?;
Ok(decode_sockaddr(&storage.assume_init(), addrlen))
}
}
#[inline]
pub(crate) fn bind_v4(fd: BorrowedFd<'_>, addr: &SocketAddrV4) -> io::Result<()> {
#[cfg(not(target_... | Rust | 0 |
h-Hans': '亚洲', 'zh-Hant': '亞洲', 'zu': 'i-Asia'},
'143': {'af': 'Sentraal-Asië', 'am': 'መካከለኛው እሲያ', 'ar': 'وسط آسيا', 'as': 'মধ্য এছিয়া', 'ast': 'Asia Central', 'az': 'Mərkəzi Asiya', 'az-Cyrl': 'Мәркәзи Асија', 'az-Latn': 'Mərkəzi Asiya', 'be': 'Цэнтральная Азія', 'be-tarask': 'Цэнтральная Азія', 'bg': 'Централна... | Python | 1 |
f {
Self::Any => None,
Self::V4(c) => Some(c.network_length()),
Self::V6(c) => Some(c.network_length()),
}
}
/// IP family of the contained address ([`Ipv4`] or [`Ipv6`]).
///
/// returns [`None`] for [`Any`]
///
/// [`Any`]: Self::Any
/// [`Ipv4`]: Family::Ipv4
/// [`Ipv6`]: Family::Ipv6
pub fn fa... | Rust | 0 |
let rdiag_exp = Vector3::new(-44.068129073061407, 29.147349299100057, 0.);
let rdiag_out =
Vector3::from_iterator(lls.upper_r.slice_range(..3, ..3).diagonal().iter().copied());
assert_relative_eq!(rdiag_out, rdiag_exp);
let diag = Vector3::new(2.772724292099739, 0.536656314599949, 0.089442719... | Rust | 0 |
WordFontColor(self):
"""文字水印的颜色,值为HEX颜色代码
注意:此字段可能返回 null,表示取不到有效值。
:rtype: str
"""
return self._MarkWordFontColor
@MarkWordFontColor.setter
def MarkWordFontColor(self, MarkWordFontColor):
self._MarkWordFontColor = MarkWordFontColor
@property
def MarkWordFontTyp... | Python | 1 |
import tempfile
from urllib.request import urlretrieve
import chromadb
from llama_index.core import Settings, SimpleDirectoryReader, StorageContext, VectorStoreIndex
from llama_index.llms.openai import OpenAI
from llama_index.vector_stores.chroma import ChromaVectorStore
from opentelemetry.exporter.otlp.proto.http.tra... | Python | 1 |
$$ |__/ /$$__ $$ | $$
// | $$ \ $$ /$$$$$$ /$$$$$$ /$$ /$$$$$$$ | $$ \__//$$ /$$ /$$$$$$$| $$ /$$
// | $$$$$$$ /$$__ $$|____ $$| $$| $$__ $$| $$$$ | $$ | $$ /$$_____/| $$ /$$/
// | $$__ $$| $$ \__/ /$$$$$$$| $$| $$ \ $$| $$_/ | $$ | $$| $$ | $$... | Rust | 0 |
else {
first_num = y;
second_num = x;
}
remainder = first_num % second_num;
while remainder != 0{
first_num = second_num;
second_num = remainder;
remainder = first_num % second_num;
}
second_num
}//see: https://github.com/rust-lang/cargo/issues/8010
#![cfg_attr(feature = "quiet", allow(war... | Rust | 0 |
stum_arc::{ViewFrustumArc, ViewFrustumObject};
use crate::visibility::visibility_object_arc::{CullModel, VisibilityObject, VisibilityObjectArc};
use crate::visibility::ObjectId;
use parking_lot::{RwLock, RwLockReadGuard};
use rafx_visibility::{ModelHandle, VisibilityWorldArc, ZoneHandle};
use slotmap::SlotMap;
use slot... | Rust | 0 |
t((index * 3)..(index * 3 + 3))
.unwrap_or(&[0.0; 3]);
let tex_coord: &[f32] = model
.mesh
.texcoords
.get((index * 2)..(index * 2 + 2))
.unwrap_or(&[0.0; 3]);
Vertex {
... | Rust | 0 |
s=False,dereference=True)
parentid = parentimage.dbid
if parentid not in newimages.keys():
newimagedata = self.copyImage(parentimage)
newimages[parentid] = newimagedata
else:
newimagedata = newimages[parentid]
newtarget = leginondata.AcquisitionImageTargetData(initializer=target)
... | Python | 1 |
tise l2vpn evpn",
"vrf site-2",
"address-family ipv4 unicast",
"no advertise l2vpn evpn",
]
result = self.execute_module(changed=True)
self.assertEqual(set(result["commands"]), set(commands))
def test_nxos_bgp_vrf_af_advertise_l2vpn_evpn_replaced(self):
... | Python | 1 |
/fix = -1 ??
let mut message: *mut DmtxMessage = dmtxDecodeMatrixRegion(decoded, region, -1);
if !message.is_null() {
let ptr = (*message).output;
let len = (*message).outputIdx;
output = Vec::with_capacity(len as usize);
for... | Rust | 0 |
xt: &str) {
use clipboard::{ClipboardContext, ClipboardProvider};
let mut clip: ClipboardContext = ClipboardProvider::new().unwrap();
clip.set_contents(solution).unwrap();
}
<filename>compiler/src/ast/module.rs
use super::definition::Definition;
use super::expression::Expression;
use crate::types::Type;
use... | Rust | 0 |
pty, but it inherits brand, model, and move() from Vehicle.
The Boat and Plane classes also inherit brand, model, and move() from Vehicle,
but they both override the move() method.
Because of polymorphism we can execute the same method for all classes.
----------------------------------------------------------------... | Python | 1 |
from django.urls import path
from polls.views import home
urlpatterns = [
path('', home, name='home'),
]
| Python | 1 |
r_agent1)
assert fingerprint1 == fingerprint1_repeat
def test_risk_level_calculation(self, anomaly_service):
"""測試風險等級計算"""
# 測試不同風險分數對應的等級
test_cases = [
(1.0, RiskLevel.LOW),
(4.0, RiskLevel.MEDIUM),
(7.0, RiskLevel.HIGH),
(9.5, ... | Python | 1 |
not(target_os = "macos")))]
pub fn required_extension_names() -> Vec<*const i8> {
use ash::extensions::khr::XlibSurface;
vec![Surface::name().as_ptr(), XlibSurface::name().as_ptr()]
}
/// Get required instance extensions.
/// This is macos specific.
#[cfg(target_os = "macos")]
pub fn required_extension_names()... | Rust | 0 |
# (C) Copyright 2005-2021 Enthought, Inc., Austin, TX
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD
# license included in LICENSE.txt and may be redistributed only under
# the conditions described in the aforementioned license. The license
# is also available online at... | Python | 1 |
::ToolOptions;
use crate::Color;
use serde::{Deserialize, Serialize};
#[derive(PartialEq, Clone, Deserialize, Serialize, Debug)]
pub struct FrontendDocumentDetails {
pub is_saved: bool,
pub name: String,
pub id: u64,
}
#[impl_message(Message, Frontend)]
#[derive(PartialEq, Clone, Deserialize, Serialize, Debug)]
pu... | Rust | 0 |
# from https://github.com/openai/guided-diffusion/blob/8fb3ad9197f16bbc40620447b2742e13458d2831/guided_diffusion/image_datasets.py
import math
import random
import numpy as np
from PIL import Image
def center_crop_arr(pil_image, image_size):
"""
Center cropping implementation from ADM.
https://github.com/... | Python | 1 |