text string | label_name string | labels int64 |
|---|---|---|
random_global_init=args.random_global_init,
global_positional_stride=args.global_positional_stride,
keep_first_global_token=args.keep_first_global_token,
resize_lsg=args.resize_lsg,
model_kwargs=args.model_kwargs,
use_token_ids=args.use_token_ids,
... | Python | 1 |
// Other BMP
assert_eq!(is_emoji_modifier_base('\u{061b}'), false);
assert_eq!(is_emoji_modifier_base('\u{061c}'), false);
assert_eq!(is_emoji_modifier_base('\u{061d}'), false);
assert_eq!(is_emoji_modifier_base('\u{200d}'), false);
assert_eq!(is_emoji_modifier_base('\u{... | Rust | 0 |
import heapq
from typing import List
class Solution:
def minimumCost(self, start: List[int], target: List[int], specialRoads: List[List[int]]) -> int:
def manhattan(x1, y1, x2, y2):
return abs(x2 - x1) + abs(y2 - y1)
nodes = [(start[0], start[1]), (target[0], target[1])]
for x1... | Python | 1 |
n euclid_transform2d_f32_load_identity(transform: &mut Transform2D) {
transform.clone_from(&Transform2D::identity());
}
#[no_mangle]
pub fn euclid_transform2d_f32_post_transform(transform: &mut Transform2D, matrix: &mut Transform2D) {
transform.clone_from(&transform.post_transform(matrix));
}
#[no_mangle]
pub... | Rust | 0 |
.unwrap(),
&Name::from_str("localhost").unwrap().append_domain(domain),
"{}",
path.path().display(),
);
let mut accounted = vec!["islay.localdomain", "islay"]
.into_iter()
.map(|s| Name::from_str(s)... | Rust | 0 |
{self.unicode_filename(): {}},
prefix=self.site_dir,
)
list(distributions())
class PackagesDistributionsPrebuiltTest(fixtures.ZipFixtures, unittest.TestCase):
def test_packages_distributions_example(self):
self._fixture_on_path('example-21.12-py3-none-any.whl')
as... | Python | 1 |
8593, 0x039624d5, 0x24c816ac, 0xda2c9183,
0xbd917cb9,
],
[0xa3944b95, 0xca0b5204, 0x3584ef02, 0x151926a8],
),
(
[
0x797f8b3d, 0x176dac5b, 0x7e34a2d5, 0x39c4ef36, 0x7a16f863, 0x5f626473, 0x7591c5c0,
0x7bf57a3e,
],
[0xa74289fe, 0x73a4c123... | Rust | 0 |
import curses
import math
from lismi import struct, util
def report_printer(
stdscr: curses.window,
cc: int,
ic: int,
minutes: float,
layout: struct.SupportedLayout,
) -> None:
stdscr.clear()
curses.curs_set(0)
y, x = stdscr.getmaxyx()
outp = []
gwpm = math.ceil((cc / 5) / min... | Python | 1 |
// https://github.com/mstange/msvc-demangler-rust/issues/21
let var_sc = if self.consume(b"?") {
self.read_storage_class()
} else {
StorageClass::empty()
};
let return_type = self.read_var_type(var_sc)?;
let params = self.read_func_params()?;
... | Rust | 0 |
await page.wait_for_timeout(15000)
except Exception as e:
print(f"\n[ERROR] {str(e)}")
import traceback
traceback.print_exc()
finally:
await browser.close()
print("\n[COMPLETE] Test finished")
if __name__ == "_... | Python | 1 |
io::piped())
.spawn()
.expect("Couldn't run `mpc -f`");
BufReader::new(mpc.stdout.unwrap())
.lines()
.next()
.and_then(|result| result.ok())
}
fn get_playback_info() -> Option<PlaybackInfo> {
let mpc = Command::new("mpc")
.stdout(Stdio::piped())
.spawn()... | Rust | 0 |
s::BPREFIXSTRLEN;
// Does not include a '\0' (xxxx.xxU)
pub const IPREFIXSTRLEN: u32 = crate::bindings::IPREFIXSTRLEN;
// TODO:?
// WCHAR_MAX_UTF8BYTES
use std::cmp::Ordering;
use std::ops::{Add, Mul};
use serde::{Deserialize, Serialize};
#[derive(Copy, Clone, Serialize, Deserialize)]
#[must_use]
pub struct Confide... | Rust | 0 |
# Copyright 2021-2025 Avaiga Private Limited
#
# 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 agree... | Python | 1 |
8] edition:2018
//[e2021] edition:2021
//[e2018] check-pass
#![crate_type = "lib"]
#![stable(feature = "foo", since = "1.0.0")]
#![feature(staged_api)]
#[stable(feature = "foo", since = "1.0.0")]
#[rustc_const_stable(feature = "foo", since = "1.0.0")]
const fn foo() {
assert!(false);
assert!(false, "foo");
... | Rust | 0 |
# Code generated by Lark OpenAPI.
import lark_oapi as lark
from lark_oapi.api.calendar.v4 import *
def main():
# 创建client
client = lark.Client.builder() \
.app_id(lark.APP_ID) \
.app_secret(lark.APP_SECRET) \
.log_level(lark.LogLevel.DEBUG) \
.build()
# 构造请求对象
request... | Python | 1 |
,
0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8,
0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1,
0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe,
0xf762575d, 0x806567cb, 0x196c3671, 0x6e6b06e7,
0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc,
0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5,
0xd6d6a3e8, 0xa1d1937e,... | Rust | 0 |
produces a strategy that generates values
/// that are all out of bounds.
///
/// More precisely, generates values (r, c) such that r >= rows || c >= cols.
fn out_of_bounds_strategy(rows: usize, cols: usize) -> impl Strategy<Value = (usize, usize)> {
let max_row_idx = 3 * rows + 1;
let max_col_idx = 3 * cols +... | Rust | 0 |
::new(|h| {
h.invalidate();
});
(&*scan_ptr).scan(&mut scanner);
}
// We know this method can only be called if `scan_ptr` doesn't alias
// And we know `finalize_ptr` ~= `scan_ptr`
// So we c... | Rust | 0 |
for verbose in 0..(verbose_max + 1) {
get_frequency(&mut port, chans + 1, verbose).unwrap_err();
}
}
#[test]
pub fn get_frequency_hertz_ok() {
let mut port = SerialPortType::new("", true, 0).unwrap();
let verbose_max = 1;
let chans = 2;
for verbose in 0..(verbose_max + 1) {
for chan in 1..(chans + 1) {
g... | Rust | 0 |
ndPacket> {
Ok(ServerboundPacket::PlayerDigging(PlayerDigging {
status: read_varint(r)?,
location: read_position(r)?,
face: read_u8(r)?,
}))
}
fn to_u8(&self) -> Result<Vec<u8>> {
let mut ret = Vec::new();
write_varint(&Self::PACKET_ID, &mut r... | Rust | 0 |
', 'never', 'notrace', 'proctype', 'show', 'trace',
'typedef', 'xr', 'xs'), suffix=r'\b'),
Keyword.Declaration),
# Declarators (suffixes)
(words((
'priority', 'provided'), suffix=r'\b'),
Keyword),
# MetaTerms (declarators)
... | Python | 1 |
import socket
class MalformedResponse(Exception):
pass
class API:
def __init__(self, url: str, port: int = 80, token: str = ""):
self.url = url
self.port = port
self.token = token
def get(self, data_type: int) -> bytes:
token = self.token.encode()
s = socket.socket... | Python | 1 |
fn get_height(&self) -> usize {
return self.props.height as usize;
}
}
unsafe extern "system" fn win32_handle_proc(
window: HWND,
message: UINT,
wparam: WPARAM,
lparam: LPARAM,
) -> LRESULT {
match message {
WM_CLOSE => {
0
}
_ => {
return... | Rust | 0 |
ised_nodes": [[], [], [], [], [], [],
["n2"], ["n2"], ["n2", "n12"], ["n2", "n12"], ["n2", "n12", "n4"],
["n2", "n12", "n4"], ["n2", "n12", "n4", "n17"],
["n2", "n12", "n4", "n17"... | Python | 1 |
sbc.set_brightness(max(sbc.get_brightness(display=0)[0] - 10, 0), display=0)
elif handedness.classification[0].label == "Left":
if is_index_middle_fingers_together(hand_landmarks):
if is_two_fingers_up(hand_landmarks):
mouse.scroll(0, 0.5... | Python | 1 |
= "I2S0_S"]
pub I2S0_S: I2S0_S,
#[doc = "IPC_NS"]
pub IPC_NS: IPC_NS,
#[doc = "IPC_S"]
pub IPC_S: IPC_S,
#[doc = "QSPI_NS"]
pub QSPI_NS: QSPI_NS,
#[doc = "QSPI_S"]
pub QSPI_S: QSPI_S,
#[doc = "NFCT_NS"]
pub NFCT_NS: NFCT_NS,
#[doc = "NFCT_S"]
pub NFCT_S: NFCT_S,
... | Rust | 0 |
fn readFourIntsAndLong(requestBody: &[u8]) -> (u32, u32, u32, u32, u64) {
let mut requestDataReader = Cursor::new(requestBody);
return (
requestDataReader.read_u32::<BigEndian>().unwrap(),
requestDataReader.read_u32::<BigEndian>().unwrap(),
requestDataReader.read_u32::<BigEndian>().unwr... | Rust | 0 |
w(src: &VkSurfaceProtectedCapabilities, dst: &mut RawVkSurfaceProtectedCapabilities) {
dst.s_type = vk_to_raw_value(&VkStructureType::SurfaceProtectedCapabilitiesKhr);
dst.next = ptr::null_mut();
dst.supports_protected = vk_to_raw_value(&src.supports_protected);
}
}
impl VkRawType<VkSurface... | Rust | 0 |
import math
import torch
import torch.nn as nn
from torch.nn import functional as F
class KLRegression(nn.Module):
"""KL-divergence loss for probabilistic regression.
It is computed using Monte Carlo (MC) samples from an arbitrary distribution."""
def __init__(self, eps=0.0):
super().__init__()
... | Python | 1 |
,
},
)
else:
model = tf.keras.models.load_model(
filepath, custom_objects={main_layer_class.__name__: main_layer_class}
)
assert isinstance(model, tf.keras.Model)
a... | Python | 1 |
from select import select
from selenium import webdriver
#from selenium.webdriver.common.by import By
import time
from selenium.webdriver.common.by import By
from selenium.webdriver.support.select import Select
driver= webdriver.Chrome()
#driver.get("https://rahulshettyacademy.com/client")
#driver.maximize_window()
#... | Python | 1 |
header = expected_delim.join(expected_header) + '\n'
with io.open(path + expected_suffix, 'r', encoding='utf-8-sig') as f:
header = f.readline()
assert header == expected_header
def test_output_csv_and_semicolon(self):
_, path = mkstemp(dir=self.temp_dir, suffix='.csv')
... | Python | 1 |
?\n\n#datascience #dsa...",
"RT @charlyingsparks: This is so spot on. \n@DataCamp @hugobowne #DataFramedchallenge @hmason #empathy\n#datascience #datacamp ...",
"RT @gastronomy: [DataCamp] Naive Bayes Classification using Scikit-learn --> Learn how to build and evaluate a Naive Bayes Classifier using...",
... | Python | 1 |
"""
Module for custom admin configurations for the ArchitectSpeciality model.
This module contains the ArchitectSpecialityAdmin class for customizing
the Django admin interface for the ArchitectSpeciality model.
"""
from django.contrib import admin
from app.core.models.ArchitectSpeciality import ArchitectSpeciality
... | Python | 1 |
.push(toks[0].clone());
toks = self.push_while(&toks[1..], TK::Whitespace, params);
if toks[0].kind == TK::LBracket {
let (vtoks, next_toks) =
Self::token_split_balanced_parens(toks, TK::LBracket, TK::RBracket).unwrap();
self.push_tokens(vtoks, params);
... | Rust | 0 |
ange(9)]
range_cond = [And(rs[i] >= 0, rs[i] <= 2) for i in range(9)]
# Exactly one room contains a lady
one_lady = Sum([If(rs[i] == 1, 1, 0) for i in range(9)]) == 1
# Define the signs
# Note: Sign3 and Sign5 use other signs which are defined later. Use placeholder variables for now.
sign1 = ... | Python | 1 |
{
let core = Core::new().unwrap();
let datasource = system_datasource();
let connector = JsonHttpConnector::new(datasource, &core.handle()).unwrap();
let arango = ArangoSession::new(connector, core);
let database = arango.use_database_with_name("the_social_network");
assert_that!(&database.... | Rust | 0 |
ve_listeners`.
port (int): The port to listen on. Use 0 to let the kernel pick
an open port. Ultimately passed to :func:`open_tcp_listeners`.
ssl_context (~ssl.SSLContext): The SSL context to use for all incoming
connections. Passed to :func:`open_ssl_over_tcp_listeners`.
host (... | Python | 1 |
= Matrix::new(2, 2, vec![1.0, -3.0, 1.0, 1.0]);
// characteristic polynomial is λ² − λ + 4 = 0
// Decomposition will fail
assert!(a.eigenvalues().is_err());
}
#[test]
fn test_2_by_2_matrix_eigendecomp() {
let a = Matrix::new(2, 2, vec![20., 4., 20., 16.]);
let (eig... | Rust | 0 |
.map(|x|
{
let mut number = 0;
for (code, n) in &display_data
{
// println!(" data {} {}", x, code);
if contains(code, x) && code.len() == x.len()
... | Rust | 0 |
Suite { id, name } in test_helper::get_valid_mangas() {
for page in test_helper::get_pages() {
let mock = server.mock(|when, then| {
when.path(Reviews::get_url_path(id, page));
then
.status(200)
.body(utils_test_helper::file_to_string(&format!(
"sr... | Rust | 0 |
# -*- coding: utf-8 -*-
import os
import codecs
import sys
from shutil import rmtree
from setuptools import setup, find_packages, Command
here = os.path.abspath(os.path.dirname(__file__))
with open("README.md", "r") as fh:
long_description = fh.read()
class UploadCommand(Command):
"""Support setup.py publ... | Python | 1 |
import pandas as pd
from rdflib import Graph, Literal, Namespace, RDF, URIRef
from rdflib.namespace import XSD
import sys
def main(inputpath):
g = Graph()
ex = Namespace("http://schema.org/eicu")
eicu = Namespace("http://www.eicu.org/ontologies#")
g.bind("ex", ex)
g.bind("eicu", eicu)
# carePla... | Python | 1 |
log::debug!("Selected locale: '{}'", &locale.0);
log::debug!("Files: {:#?}", &locale.1);
let mut modes = crate::models::Modes::default();
let xml_map: Vec<Keyboard> = locale
.1
.into_iter()
.map(|(key, mut v)| {
v.sort();
let last = v.last().unwrap();
... | Rust | 0 |
String>()
)
}
fn get_client(http_port: u16) -> Client {
let s3_config = Config::builder()
.credentials_provider(Credentials::new(
"KEY_NOT_REQD",
"KEY_NOT_REQD",
None,
None,
"Environment",
))
.region(Region::new("ap-south-1"))
... | Rust | 0 |
import matplotlib
matplotlib.use('Agg') # or 'PS', 'PDF', 'SVG'
import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns
def plot_five_number_summary(data, title, ylabel="Values", xlabel="Epochs", export_pdf=False, show=False):
n_series = len(data)
sns.set_style("white")
sns.set_palett... | Python | 1 |
import antlr3
import testbase
import unittest
class t035ruleLabelPropertyRef(testbase.ANTLRTest):
def setUp(self):
self.compileGrammar()
def lexerClass(self, base):
class TLexer(base):
def recover(self, input, re):
# no error recovery yet, just crash!
... | Python | 1 |
r.")
(options, args) = parser.parse_args()
#check to see if the pdbstr.exe exists
if options.srcsrv:
pdbstr = os.environ.get("PDBSTR_PATH")
if not os.path.exists(pdbstr):
print("Invalid path to pdbstr.exe - please set/check PDBSTR_PATH.\n", file=sys.stderr)
sys.exit(... | Python | 1 |
name": "University of Bristol Jiu Jitsu Club",
"weekday": "Wed"
}, {
"link": "https://www.facebook.com/groups/2204517862/",
"name": "University of Bristol Jiu Jitsu Club",
"weekday": "Fri"
}, {
"link": "https://www.facebook.com/groups/UniversitiesBrightonJitsu/",
"name": "Uni... | Rust | 0 |
/! actually has no idea that more than one thread is involved (hidden in the C library’s
//! implementation), you can safely get away with using `Rc`.
//!
//! [standard mainloop]: mod@standard
//! [threaded mainloop]: mod@self::threaded
//! [`lock()`]: self::threaded::Mainloop::lock
//! [`in_thread()`]: self::threaded:... | Rust | 0 |
!(other "Unexpected s/e Packet/{:?}", ev)) / goto S::End(bwt.decons())),
(S::ResponseWait(bws, _), ev) =>
pfsm!(return error(app_error!(other "Unexpected s/e ResponseWait/{:?}", ev)) / goto S::End(bws)),
(S::End(bws), ev) =>
pfsm!(return error(app_error!(other "Un... | Rust | 0 |
connection_id=connection_id,
stream_id=stream_id,
error=str(e),
exc_info=True
)
finally:
logger.info(
"Preview stream ended",
connection_id=connection_id,
stream_id=stream_id,
... | Python | 1 |
46373437263, -2.83025703359666192;
-3.30895752093770579, -0.04979044289857298, 3.03248594516832792, 3.85962479743330977];
let (b, u, v) = mat.clone().svd().unwrap();
let expected_values = vec![8.0, 6.0, 4.0, 2.0];
validate_svd(&mat, &b, &u, &v);
// Assert the singular values a... | Rust | 0 |
"""対局結果の補正処理。
"""
# -*- coding:utf-8 -*-
from concurrent.futures import ThreadPoolExecutor
import glob
import os
import math
import multiprocessing
import subprocess
from typing import List
import click
WORKER_THREAD = multiprocessing.cpu_count()
def get_gnugo_judgment(filename: str, is_japanese_rule: bool) -> str:
... | Python | 1 |
"""
Debug lists and forms for all models
"""
from __future__ import annotations
from typing import TYPE_CHECKING
from django.apps import apps
from django.conf import settings
from django.contrib import admin
from treebeard.admin import TreeAdmin
from treebeard.forms import movenodeform_factory
from treebeard.ns_tree... | Python | 1 |
from file_encryptor import encrypt_file
key = b'@\x11\xe6\x9c\xe5!\xa0\xf5\x03\xb4sK\x91\xaf\x95\xd6' # Replace with your generated key
encrypt_file('test.txt', key)
| Python | 1 |
ytes.splice(26..27 + seg_count, seg_table);
p_bytes.splice(22..26, ogg_pager::crc32(&*p_bytes).to_le_bytes().to_vec());
writer.write_all(&*p_bytes)?;
if let Some(mut page) = page {
page.serial = ser;
page.gen_crc();
writer.write_all(&*page.as_bytes())?;
}
break;
}
p.gen_crc();
writ... | Rust | 0 |
[Enclave] rsgx_verify_report failed. {:?}", x);
return Err(x);
}
}
// Check if the qe_report is produced on the same platform
if ti.mr_enclave.m != qe_report.body.mr_enclave.m
|| ti.attributes.flags != qe_report.body.attributes.flags
|| ti.attributes.xfrm != qe_repor... | Rust | 0 |
# create a grid of samples and save it
reses = [str(int(np.power(2, dep))) + "_x_"
+ str(int(np.power(2, dep)))
for dep in range(2, self.depth + 2)]
gen_img_files = [os.path.join(sample_dir, res, "gen_" ... | Python | 1 |
choices=['absent', 'present', 'latest']),
no_dependencies=dict(type='bool', default=False),
executable=dict(type='path', default='flatpak')
),
supports_check_mode=True,
)
name = module.params['name']
state = module.params['state']
remote = ... | Python | 1 |
"""Tests for LLM client context size handling."""
import pytest
from app.llm.client import Client, chunk_prompt
@pytest.mark.parametrize("value", [0, -1])
def test_ctx_must_be_positive(value):
"""Client should reject non-positive context values."""
with pytest.raises(ValueError):
Client(ctx=value)
... | Python | 1 |
import requests
import json
class GrafanaScraper:
def __init__(self, grafana_url, api_key):
self.grafana_url = grafana_url
self.headers = {
"Authorization": f"Bearer {api_key}",
"Content-Type": "application/json"
}
def get_dashboards(self):
"""Fetch all... | Python | 1 |
"),
Scalar::Null => out.extend_from_slice(b"\\0"),
Scalar::Decimal(c) => {
for b in c.escape_unicode() {
if b != 'u' {
out.push(b as u8);
}
}
}
}
}
}
#[derive(Debug)]
pub stru... | Rust | 0 |
(&mut self, data: Pointer) {
unsafe { ffi::wrenSetUserData(self.raw, data) }
}
}
impl Drop for VM {
fn drop(&mut self) {
if self.owned {
unsafe { ffi::wrenFreeVM(self.raw) }
}
}
}
use thiserror::Error;
#[derive(Debug, Error)]
pub enum Sram22Error {
#[error("io error... | Rust | 0 |
from fastapi import APIRouter, Depends, HTTPException
from starlette import status
from pydantic import BaseModel
router = APIRouter()
class PingResponse(BaseModel):
message: str = "PROOOOOOOOOOOOOOOOOD"
status: str = "ok"
@router.get("/ping", status_code=status.HTTP_200_OK)
async def ping():
"""
... | Python | 1 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
import hashlib
import base64
import urllib
import re
import time
from Library import toolClass
from Library import errMsgClass
class ChaseYouku :
def __init__ (self) :
self.videoLink = ''
self.infoUrl = 'https://ups.youku.com/ups/get.json?&ccode... | Python | 1 |
ermark_borders(
100,
100,
10,
10,
&Point {
x: HorizontalPosition::Left(95),
y: VerticalPosition::Top(95)
}
),
(90, 90, 0, 0)
);
}
#[test]
f... | Rust | 0 |
await bot.edit_message_media(chat_id=call.message.chat.id,
message_id=call.message.message_id,
media=InputMediaPhoto(info[6], caption=text),
reply_m... | Python | 1 |
.sum(dim=1) / mask.sum(dim=1)[..., None]
return sentence_embeddings
def calculate_score(query, passages):
# calculate the score between query and passages
query_text = llama_tokenizer.decode(query)
query = contriever_tokenizer(query_text, return_tensors="pt", max_length=512, truncat... | Python | 1 |
ppend("发行日期: " + song_data[i]["time"] + "\n\n")
self.song_playlist.append(
str(song_data[i]["id"]) + "." + song_data[i]["name"] + "-" + song_data[i]["singer"])
else:
QMessageBox.critical(self, f"错误", "音乐未找到,请到酷我音乐搜索试试!!!")
... | Python | 1 |
"""
Django's support for templates.
The django.template namespace contains two independent subsystems:
1. Multiple Template Engines: support for pluggable template backends,
built-in backends and backend-independent APIs
2. Django Template Language: Django's own template engine, including its
built-in loaders, ... | Python | 1 |