text string | label_name string | labels int64 |
|---|---|---|
import re
import html
import json
import unicodedata
from bs4 import BeautifulSoup
from typing import List, Union
from langchain_text_splitters import RecursiveCharacterTextSplitter
def extract_content_from_json(data: str) -> str:
"""
If raw input is a JSON blob, extract the 'content' field only.
"""
... | Python | 1 |
) -> i32 {
unsafe { sse2_ucomile_sd(a, b) }
}
/// ucomisd
#[inline]
pub fn _mm_ucomilt_sd(a: __m128d, b: __m128d) -> i32 {
unsafe { sse2_ucomilt_sd(a, b) }
}
/// ucomisd
#[inline]
pub fn _mm_ucomineq_sd(a: __m128d, b: __m128d) -> i32 {
unsafe { sse2_ucomineq_sd(a, b) }
}
/// punpckhwd
#[inline]
pub fn _mm_u... | Rust | 0 |
#-*- coding: utf-8 -*-
# Author: Bob
# Date: 2016.11.24
import numpy as np
from matplotlib import pyplot as plt
from scipy import io as spio
from sklearn.decomposition import pca
'''
主成分分析_2维数据降维1维演示函数
'''
def PCA_2D():
data_2d = spio.loadmat("data.mat")
X = data_2d['X']
m = X.shape[0]
plt = plot_dat... | Python | 1 |
Get(DatasetGetCommand),
Set(DatasetSetCommand),
}
#[derive(PartialEq, Debug)]
enum DatasetFormat {
RawTlvs,
Rust,
}
impl std::str::FromStr for DatasetFormat {
type Err = anyhow::Error;
fn from_str(s: &str) -> Result<Self, Self::Err> {
if s == "raw" || s == "tlv" || s == "tlvs" {
... | Rust | 0 |
odulo in which the
// value fell (`j` and `k`, this is the quadrant for `j`).
#[inline]
#[allow(clippy::many_single_char_names)]
fn reduce(a: Double) -> (i32, i32, Double) {
// reduce modulo 2π
let z = (a / Double::TAU).round();
let r = a - z * Double::TAU;
// reduce modulo π/2
let mut q = (r.0 / D... | Rust | 0 |
xbf, 0x33, 0x46, 0xf,
0xd, 0x58, 0x86, 0xc5, 0x0, 0xf1, 0x75, 0x1, 0xa7, 0x7f, 0x7f, 0xe4, 0x9b, 0x1, 0xfd, 0xd3,
0x1c, 0xda, 0xc5, 0x9a, 0xff, 0x3f, 0x17, 0x5a, 0xb0, 0xd9, 0xa7, 0xe7, 0xc5, 0x97, 0x99,
0x87, 0x79, 0xb1, 0x81, 0x2a, 0xbb, 0xc2, 0xc6, 0x6b, 0xd7, 0x9d, 0xcb, 0xed, 0x2f, 0x79,
... | Rust | 0 |
expected_output = {
"GigabitEthernet0/2/0/1":{
"interface":"GigabitEthernet0/2/0/1",
"address_family":{
"ipv4":{
"version":{
1:{
"groups":{
1:{
"group_number":1,
"hsrp_router_state":... | Python | 1 |
from fastapi import Request, status
from fastapi.encoders import jsonable_encoder
from fastapi.exceptions import RequestValidationError
from fastapi.responses import JSONResponse
class AppException(Exception):
def __init__(
self,
details: str | None = None,
status_code: int = status.HTTP_5... | Python | 1 |
string()))
}
#[cfg_attr(not(feature = "library"), entry_point)]
pub fn execute(
deps: DepsMut,
env: Env,
info: MessageInfo,
msg: ExecuteMsg,
) -> Result<Response, ContractError> {
match msg {
ExecuteMsg::CreatePoll {
poll_id,
question,
options,
} ... | Rust | 0 |
const GICR_PROPBASER_RaWaWt:usize = GIC_BASER_CACHEABILITY(GICR_PROPBASER, INNER, RaWaWt);
// const GICR_PROPBASER_RaWaWb:usize = GIC_BASER_CACHEABILITY(GICR_PROPBASER, INNER, RaWaWb);
// const GICR_PROPBASER_IDBITS_MASK:usize = (0x1f);
// const GICR_PROPBASER_ADDRESS:usize =(x) ((x) & GENMASK_ULL(51, 12));
// cons... | Rust | 0 |
r'(?P<abort>\d+)\s+(?P<pack_count>\S+)'
)
current_card = None
current_section = None
for line in output.splitlines():
line = line.strip()
# ------------------------------- FLEX VOICE CARD 1/0 -------------------------------------
match = p0.mat... | Python | 1 |
ect::<String>())
.fold("xibt_gen".to_string(), |acc, chunk| acc + "-" + &chunk)
}
#[test]
fn id_folding() {
assert_eq!(
fold_into_id("abcdefghi".chars().collect()),
"xibt_gen-abc-def-ghi"
)
}
// This file is part of security-keys-rust. It is subject to the license terms in the COPYRIGHT file found in t... | Rust | 0 |
bc_test_7() {
let test_eq = "y = -x^2 - -7x - 2";
let tokens = get_tokens(test_eq).unwrap();
assert_eq!(detect_quad(&tokens), true);
assert_eq!(get_abc(&tokens), (-1_f32, 7_f32, -2_f32));
}
#[test]
fn get_abc_test_8() {
let test_eq = "y = 2 + x^2 + 3x";
let t... | Rust | 0 |
, Decode)]
#[cbor(map)]
pub struct Account {
#[n(0)]
pub description: Option<String>,
#[n(1)]
pub roles: BTreeMap<Identity, BTreeSet<Role>>,
#[n(2)]
pub features: features::FeatureSet,
}
impl Account {
pub fn create(
sender: &Identity,
CreateArgs {
description,... | Rust | 0 |
geotransforms)
///
#[derive(Clone, PartialEq, Debug)]
pub struct Transform {
a: f64,
b: f64,
c: f64,
d: f64,
e: f64,
f: f64,
}
impl Transform {
#![allow(clippy::many_single_char_names)]
pub const fn new(a: f64, b: f64, c: f64, d: f64, e: f64, f: f64) -> Self {
Self { a, b, c, d,... | Rust | 0 |
import matplotlib.pyplot as plt
import numpy as np
def plot_sine_cosine(amplitude, frequency, phase):
"""
Plots sine and cosine waves based on user-defined parameters.
Parameters:
amplitude (float): Amplitude of the waves
frequency (float): Frequency of the waves
... | Python | 1 |
# /// script
# requires-python = ">=3.12"
# dependencies = [
# "anywidget==0.9.18",
# "numpy==2.3.3",
# "polars==1.33.1",
# "traitlets==5.14.3",
# "uchimata==0.3.0",
# ]
# ///
import marimo
__generated_with = "0.16.2"
app = marimo.App(width="medium")
@app.cell
def _():
import anywidget
i... | Python | 1 |
hNissan", "<NAME>");
m.insert("RoshChodeshIyar1", "<NAME>");
m.insert("RoshChodeshIyar2", "<NAME>");
m.insert("RoshChodeshSivan", "<NAME>");
m.insert("RoshChodeshTammuz1", "<NAME>");
m.insert("RoshChodeshTammuz2", "<NAME>");
m.insert("RoshChodeshAv", "<NAME>");
m.insert("RoshChodeshElul1", "... | Rust | 0 |
reference option
fn option_ref<T: AsRef<R>, R: ?Sized>(option: &Option<T>) -> Option<&R> {
option.as_ref().map(|s| s.as_ref())
}
/// Use a fallback reference if option is not set
fn option_fallback<'t, T: AsRef<R>, R: ?Sized>(option: &'t Option<T>, fallback: &'t R) -> &'t R {
option_ref(option).unwrap_or(fallb... | Rust | 0 |
ut temp: i64 = 0;
unsafe {
let err_val = af_join(
&mut temp as MutAfArray,
dim as c_int,
first.get() as AfArray,
second.get() as AfArray,
);
HANDLE_ERROR(AfError::from(err_val));
}
temp.into()
}
/// Join multiple arrays
///
/// # Param... | Rust | 0 |
ss_id' : [filtered_gobs['class_id'][idx]],
# 'class_label' : det.class_label,
'mask' : filtered_gobs['mask'][idx],
'mask_area' : filtered_gobs['mask'][idx].sum(),
'clip_ft' : filtered_gobs['image_feats'][idx],
'image_crops' : filtered_gobs['image_crops'][idx],... | Python | 1 |
# /// script
# requires-python = ">=3.11"
# dependencies = [
# "kitchenai-whisk",
# "llama-index",
# ]
# ///
from whisk.kitchenai_sdk.kitchenai import KitchenAIApp
from whisk.kitchenai_sdk.schema import (
WhiskQuerySchema,
WhiskQueryBaseResponseSchema,
WhiskStorageSchema,
WhiskStorageResponseSchema... | Python | 1 |
"""
summary: add a custom microcode block optimization rule
description:
Installs a custom microcode block optimization rule,
to transform:
goto L1
...
L1:
goto L2
into
goto L2
In other words we fix a goto target if it points to a chain of gotos.
This improves the de... | Python | 1 |
yType_t {
MAJOR_VERSION = 0,
MINOR_VERSION = 1,
PATCH_LEVEL = 2,
}
pub use self::libraryPropertyType_t as libraryPropertyType;
pub type __int32_t = ::std::os::raw::c_int;
pub type __uint32_t = ::std::os::raw::c_uint;
pub type __int64_t = ::std::os::raw::c_long;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub s... | Rust | 0 |
elf.on_logits, self.on_vf, self.on_lstm_state_out, self.regression],
feeder
)
logits = logits[0, ...]
if self.ac_space.is_discrete:
# Use multinomial to get sample (discrete):
sample = np.random.multinomial(1, softmax(logits))
sample = self.ac_spac... | Python | 1 |
rgs["top_k"],
repetition_penalty=repetition_penalty or generating_args["repetition_penalty"],
eos_token_id=[self.tokenizer.eos_token_id] + self.tokenizer.additional_special_tokens_ids,
pad_token_id=self.tokenizer.pad_token_id
))
gen_kwargs = dict(
input_i... | Python | 1 |
class Solution:
def searchMatrix(self, mat, x):
# code here
for row in mat:
for val in row:
if val==x:
return True
return False
| Python | 1 |
sa.Column('skin_color', sa.VARCHAR(), autoincrement=False, nullable=False),
sa.Column('created', postgresql.TIMESTAMP(), autoincrement=False, nullable=False),
sa.Column('edited', postgresql.TIMESTAMP(), autoincrement=False, nullable=False),
sa.Column('species', postgresql.ARRAY(sa.VARCHAR(... | Python | 1 |
pmax = self.recover_pitch(pmax, pmean, pstd)
pitch = self.recover_pitch(pitch, pmean, pstd)
def add_axis(fig, old_axis):
axis = fig.add_axes(old_axis.get_position(), anchor='W')
axis.set_facecolor('None')
return axis
axis.imshow(mel, origin='l... | Python | 1 |
from __future__ import annotations
from typing import Union
import ctypes
from rustfst.ffi_utils import (
lib,
check_ffi_error,
)
from rustfst.fst.vector_fst import VectorFst
KSHORTESTDELTA = 1e-6
class ShortestPathConfig:
"""
Configuration for shortest-path operation.
Args:
nshortest: Nu... | Python | 1 |
import json
import re
from datetime import datetime, timedelta
from typing import List, Tuple
def json_opener(json_file_name: str) -> List[dict]:
try:
with open(json_file_name, "r", encoding="utf-8") as json_file:
data = json.load(json_file)
return data
except FileNotFoundError... | Python | 1 |
"""
database schema, it's structure of tables, columns and so on
"""
import databases
import sqlalchemy
# reads the config file and gets the appropriate config setup and environment
from main.config import config
# info about db
metadata = sqlalchemy.MetaData()
# db schemas / table name, metadata object, columns
p... | Python | 1 |
en-US/docs/Web/API/WebGL2RenderingContext/copyBufferSubData)"]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `WebGl2RenderingContext`*"]
pub fn copy_buffer_sub_data_with_i32_and_i32_and_i32(
this: &WebGl2RenderingContext,
read_target: u32,
writ... | Rust | 0 |
undefined character code'.
*/
#[no_mangle]
fn FT_Get_Name_Index(face: FT_Face, glyph_name: *const FT_String) -> FT_UInt;
/* *************************************************************************
*
* @section:
* glyph_variants
*
* @title:
* Unicode Variation Sequence... | Rust | 0 |
9e\x8d\
\xa4\xc4!\x93S\xd6\xae\xac/$\xbe\xd3,\xf4\xcd\x22\
;k\xedF\x0d6\x13>\x95ygc\xbd|s\xfd\
\xee\x12\x82\xf6\xaa\x95ITU-i8(\xc5\xc6\xe9\
=\x12PMY\xdf[{\xc6\xf5\xeaBi\xc9]I\
Z\xdb\xab\xbb%\xd6\xeb\xbb[\xea\xb5\xb7OQ\xf0\xe7\
\x87\xf4A\xac\xd8xN\xf3J\xd1|\x1dm\xa5]x\
'Cq\xe1}K\xc3\xde%\xb7\xd4\xe6\xd3<A5\
\xc40\xe9\x9... | Python | 1 |
written),
Ok(len) => len,
Err(ref e) if e.kind() == ErrorKind::Interrupted => continue,
Err(e) => return Err(e),
};
writer.write_all(&buf[..len])?;
written += len as u64;
callback(total, written, len, print_status_context);
}
}
pub fn print_status... | Rust | 0 |
d to obtain lock");
assert!(test_mempool.pending().is_empty());
assert_eq!(test_mempool.known_valid().len(), operations_from_1325.len());
for op in &operations_from_1325 {
assert!(test_mempool.known_valid().contains(op));
}
}
// generate merkle stats
let merkle_s... | Rust | 0 |
92) / 8192 * 8192) - current) as usize;
let written = file.write(&zeros[..to_do]).map_err(fatfs_error_to_status)? as u64;
if written == 0 {
return Err(Status::NO_SPACE);
}
current += written;
}
Ok(())
}
fn seek_for_write(file: &mut File<'_>, offset: u64) -> Result<()... | Rust | 0 |
import cv2 as cv
from geometry_msgs.msg import Pose2D
from vision_msgs.msg import (BoundingBox2D, Detection2D, Detection2DArray,
ObjectHypothesisWithPose)
THRESHOLD_MAX = 255
THRESHOLD = 240
class BlobDetector:
def __init__(self):
pass
def detect_multi(self, images):
... | Python | 1 |
data: bool,
}
impl<'a> IntoIterator for &'a LasFile {
type Item = &'a PointData;
type IntoIter = slice::Iter<'a, PointData>;
fn into_iter(self) -> slice::Iter<'a, PointData> {
self.point_data.iter()
}
}
impl Index<usize> for LasFile {
type Output = PointData;
fn index<'a>(&'a self, i... | Rust | 0 |
l();
if !part_two {
input_sender.send(1).ok();
} else {
input_sender.send(5).ok();
};
intcode_computer::run_program(input_receiver, output_sender, &mut program);
return output_receiver.recv().unwrap().to_string();
}
}
#[cfg(test)]
... | Rust | 0 |
ddcc9",
"abcd",
),
(
"de8322b46e78b67d4431997070703e9764e03a1237b896fd8b379ed4576e8363",
"abcde",
),
(
"e4fdcb11d1ac14e698743acd8805174cea5ddc0d312e3e47f6372032571bad84",
"abcdef",
),
(
"<KEY>",
... | Rust | 0 |
* `Unknown`, on any unexpected error
# Device Support
For S-class products.
*/
// Checked against local
// Tested (for an error)
#[inline]
pub fn unit_by_index(&self, index: u32) -> Result<Unit> {
unsafe {
let mut unit: nvmlUnit_t = mem::zeroed();
nvml_t... | Rust | 0 |
ted_value {
// these ones Display as their simple scalar selves
Value::Bool(b) => b.to_string(),
Value::Number(n) => n.to_string(),
Value::String(s) => s.to_string(),
// If no value is set, use the given default.
Value::Null => default.to_string(),
// composite ty... | Rust | 0 |
aram_bad_wrong_key_length = CipherParam {
key: Some(vec![0x00; ATCA_AES_DATA_SIZE + 1]),
iv: Some([0x00; ATCA_AES_KEY_SIZE]),
..Default::default()
};
let param_bad_no_key = CipherParam {
iv: Some([0x00; ATCA_AES_KEY_SIZE]),
..Default::default()
};
let param_bad_no... | Rust | 0 |
p];
while p < self.stats.get_phase() {
if self.count[p] < min {
min = self.count[p];
p += 2;
}
}
self.print_value(min);
}
fn print_max(&self, mutator: bool) {
let mut p = if mutator { 0 } else { 1 };
let mut max = s... | Rust | 0 |
}
// Copyright 2019 Twitter, Inc.
// Licensed under the Apache License, Version 2.0
// http://www.apache.org/licenses/LICENSE-2.0
use crate::metrics::*;
use serde_derive::{Deserialize, Serialize};
use strum_macros::{EnumIter, EnumString, IntoStaticStr};
#[derive(
Clone,
Copy,
Debug,
Deserialize,
E... | Rust | 0 |
controlAccentColor]);
let color_space: *mut Object = msg_send![&OBJC_CLASS__NSColorSpace, genericRGBColorSpace];
let accent: *mut Object = msg_send![*accent, colorUsingColorSpace: color_space];
let mut r: f64 = 0.0;
let mut g: f64 = 0.0;
let mut b: f64 = 0.0;
let _: () =... | Rust | 0 |
= 1808,
BroodLordHangar_10 = 1809,
BroodLordHangar_11 = 1810,
BroodLordHangar_12 = 1811,
BroodLordHangar_13 = 1812,
BroodLordHangar_14 = 1813,
BroodLordHangar_15 = 1814,
BroodLordHangar_16 = 1815,
BroodLordHangar_17 = 1816,
BroodLordHangar_18 = 1817,
BroodLordHangar_19 = 1818,
... | Rust | 0 |
data['discardedFrames'].append(time)
if nSkipped > 0: print(f'Skipped {nSkipped} lines')
diagnoseCamera(data, output)
diagnoseAccelerometer(data, output)
diagnoseGyroscope(data, output)
diagnoseMagnetometer(data, output)
diagnoseBarometer(data, output)
diagnoseGNSS(data, output)
d... | Python | 1 |
"""
Text Compaction Mode (TC)
Can encode: ASCII 9, 10, 13 and 32-126
Rate compaction: 2 bytes per code word
"""
from typing import Iterable, Tuple
from pdf417gen.data import CHARACTERS_LOOKUP, SWITCH_CODES
from pdf417gen.types import Codeword, Submode
from pdf417gen.util import chunks
def _exists_in_submode(char: i... | Python | 1 |
es) > 0:
# 의미 있는 가격 정보만 필터링
valid_prices = []
for price in prices:
if isinstance(price, str) and price.strip():
# "정보가 없습니다" 같은 키워드가 포함되지 않은 경우만 추가
if not any(keyword in price for keyword in ['해당 작물에 대한 정보는 현재 없습니다.']):
... | Python | 1 |
er fail");
let lang_code = CStr::from_bytes_with_nul(b"ja\0").expect("Should never fail");
trace!("Im::register(): Calling `fcitx_sys::FcitxInstanceRegisterIMv2`");
unsafe {
fcitx_sys::FcitxInstanceRegisterIMv2(
this.fcitx_instance.raw_ptr(),
this as ... | Rust | 0 |
][:N, :N, :, :]
# update each node i
i = 0 # ego
# for i in range(x.shape[0]):
# # imgFeature = torch.sum(x[i,:,:,:], dim = 0, keepdim=True)
# # imgFeatureMin = torch.min(imgFeature)
# # imgFeatureMax = torch.max(imgFeature)... | Python | 1 |
namespace(
&mut self,
n: &mut crate::parser::ast::Namespace,
) -> crate::compiler::VResult {
self.identifiers.exit_namespace(n)
}
};
}
pub(crate) use delegate_scope_tracking;
}
#[derive(Debug, Clone, Eq, PartialEq)]
pub struct Mem... | Rust | 0 |
e rotation
/// and offset it by pi radians
fn rotation(&self) -> f32 {
let rotation: f64 = if self.last_x == 0. || self.last_y == 0. {
0.
} else {
self.last_y.atan2(self.last_x) as f64
};
(rotation - PI) as f32
}
fn update(&mut self, transform: &m... | Rust | 0 |
let dt = pst.ymd(2018, 1, 11).and_hms_nano(10, 5, 13, 84_660_000);
assert_eq!(dt.to_rfc3339_opts(Secs, false), "2018-01-11T10:05:13+08:00");
assert_eq!(dt.to_rfc3339_opts(Secs, true), "2018-01-11T10:05:13+08:00");
assert_eq!(dt.to_rfc3339_opts(Millis, false), "2018-01-11T10:05:13.084+08:00");
asser... | Rust | 0 |
switch_state,
signal_led,
decis,
} = cx.local;
// decimal counter for LED pattern
// assuming 100ms between calls cycle takes 20 * 0.1 = 2.0 s
*decis = (*decis + 1) % 20;
// signals in tenths of seconds, start times
const TRACK_PATTERN: [u32; 3] = [0b1, 0b1001, 0b1001001];
... | Rust | 0 |
values based on the squared smallest singular value)
lambda_ell = s_ell[-1] ** 2
s_ell = np.sqrt(s_ell ** 2 - lambda_ell)
return np.dot(H_ell, np.diag(s_ell))
def __boosted_sparse_shrink(self, A, ell, p_failure):
al = (6 / 41) * ell
sq_norm_A = ln.norm(A, ord="fro") ** 2
... | Python | 1 |
mates => "RESC\0",
}.to_string()
}
}
#[derive(Debug,PartialEq,Eq,Clone)]
pub enum SecType {
Stock,
Option,
Future,
OptionOnFuture,
Index,
Forex,
Combo,
Warrant,
Bond,
Commodity,
News,
MutualFund,
}
impl Encodable for SecType {
fn encode(&self) -> String {... | Rust | 0 |
#Escribir un programa que realice la devolución de una cantidad dada por el usuario en monedas. El programa debe cumplir los siguientes requisitos:
# Solo se disponen de tres tipos de monedas: 5, 2 y 1 €. Crear una lista que contenga estos tres tipos de moneda y usar la lista en la solución.
# El programa debe pregunt... | Python | 1 |
_opt.cuts
.map(|cs| {
cs.iter().map(|c| c.parse()).collect()
})
.unwrap_or(Ok(vec![]));
let measures: Result<Vec<_>, _> = agg_query_opt.measures
.map(|ms| {
ms.iter().map(|m| m.parse()).collect()
})
.unwrap_... | Rust | 0 |
T,
) -> str | bool:
"""Run a command-line program."""
if success_codes is None:
success_codes = [0]
cmd, args = args[0], args[1:]
full_cmd = f"{cmd} {_shlex_join(args)}"
cmd_path = which(os.fspath(cmd), paths)
str_args = [os.fspath(arg) for arg in args]
if log:
logger.inf... | Python | 1 |
AND c2.verified=True
AND c1.category_id=$2
ORDER BY score ASC
"#,
)
.bind(map_id)
.bind(cat_id)
.fetch_all(pool)
.await;
match res {
Ok(mut res) => {
res.truncate(limit as usize);
... | Rust | 0 |
import asyncio
import logging
import time
import exchangelayer as el
import genconfig as gc
import genutils as gu
import strategies as st
import trader as trd
FreshOrder = False
LastOrder = {}
logger = logging.getLogger('trader')
def GetTradeAmount(order, volume):
if order == 'buy':
ta = gu.RoundIfGreaterTha... | Python | 1 |
u32, freq: u32) -> (u8, u8, u8) {
// finding a set of (nr, od, nf) which minify abs(freq * nr * od - freq_in * nf)
// nr, od is in [0b1, 0b10_000], nr * od is in [0b1, 0b100_000_000]
// nf is in [0b1, 0b1_000_000]
// for archiving a higher accuracy, we want the nr * od as large as possible
... | Rust | 0 |
ead> = if let Some(file) = matches.value_of("file") {
// read entries from the file
Box::new(BufReader::new(std::fs::File::open(file).unwrap()))
} else {
// read from stdin
log::info!("Waiting on stdin...");
Box::new(BufReader::new(io::stdin()))
... | Rust | 0 |
ng = thread_rng();
let dist = WeightedIndex::new(w).unwrap();
Self { dist, rng }
}
fn pick_index(&mut self) -> i32 {
self.rng.sample(&self.dist) as i32
}
}
/**
* Your Solution object will be instantiated and called as such:
* let obj = Solution::new(w);
* let ret_1: i32 = obj.pic... | Rust | 0 |
title=req.title,
description=req.description,
status=req.status,
tool_config=req.tool_config,
expire_time=req.expire_time,
teams=req.teams,
),
)
# 定时任务处理
if req.status == schemas.task.TaskStatus.OPEN:
scheduler.add_job(
... | Python | 1 |
ry.as_os_str().to_str().unwrap().ends_with(".def") {
continue;
}
let mut file = File::open(entry).await?;
let mut input = String::new();
file.read_to_string(&mut input).await?;
let token_tree = parse::parse_str(&input)?;
let defs = compile::compile_tree(&tok... | Rust | 0 |
be called using `WinConsole::output()` or a valid output handle.
///
/// # Example
/// ```
/// use win32console::console::WinConsole;
/// use win32console::structs::console_color::ConsoleColor;
/// let fg = WinConsole::output().get_foreground_color().unwrap();
/// let bg = WinConsole::outpu... | Rust | 0 |
0.0], Condition::FirstUseEver)
.flags(WindowFlags::NO_RESIZE)
.build(&ui, || {
if ui.button(
im_str!("Load rule from clipboard"),
[ui.window_content_region_width(), 60.0],
) {
... | Rust | 0 |
),
(r"icons\a\tx_shield_auriel.dds", 0x4151_2E06, 0xEC6B_F5E7),
(r"icons\a\tx_shield_glass.dds", 0x4151_4706, 0x2F19_0FB7),
(r"icons\a\tx_shield_steel.dds", 0x4151_4706, 0xABA0_C39A),
(r"icons\a\tx_shield_iron.dds", 0x4151_4706, 0xE29B_3D64),
(r"icons\a\tx_shield_ebony.dds", 0x4151_4706, 0xEDB6... | Rust | 0 |
ion is the
/// inverse of `vapor_pressure_liquid_water`.
///
/// Returns: The dew point.
#[inline]
pub fn dew_point_from_vapor_pressure_water<P>(vp: P) -> Option<Celsius>
where
P: Pressure,
HectoPascal: From<P>,
{
debug_validate!(vp);
let HectoPascal(vp) = HectoPascal::from(vp);
let a = f64::ln(vp ... | Rust | 0 |
import unittest
from tkreload.app_event_handler import AppFileEventHandler
from tkreload.auto_reload import AutoReloadManager
from unittest.mock import Mock, MagicMock
from watchdog.events import FileModifiedEvent
from rich.console import Console
class TestAppFileEventHandler(unittest.TestCase):
def setUp(self):
... | Python | 1 |
13
ODFINDITEM Self::FIRST.0 - 79
ITEMACTIVATE Self::FIRST.0 - 14
ODSTATECHANGED Self::FIRST.0 - 15
HOTTRACK Self::FIRST.0 - 21
GETDISPINFO Self::FIRST.0 - 77
SETDISPINFO Self::FIRST.0 - 78
KEYDOWN Self::FIRST.0 - 55
MARQUEEBEGIN Self::FIRST.0 - 56
GETINFOTIP Self::FIRST.0 - 58
INCREMENTALSEARCH Sel... | Rust | 0 |
/// match foo {
/// Bar => bar(),
/// Quz => quz(),
/// Baz => baz(), // <= fixed
/// }
/// ```
///
/// or if the original code was not a typo:
/// ```rust,ignore
/// match foo {
/// Bar | Baz => bar(), // <= shows the intent better
/// Quz => quz(),
... | Rust | 0 |
betas: (0.9, 0.999)
correct_bias: True
eps: 1e-08
initial_lr: 5e-05
lr: 5e-05
weight_decay: 0.0
Parameter Group 1
betas: (0.9, 0.999)
correct_bias: True
eps: 1e-08
initial_lr: 5e-05
lr: 5e-05
weight_decay: 0.0
)
'... | Python | 1 |
import socket
import time
from f310 import F310
HOST = "127.0.0.1" # The server's hostname or IP address
# HOST = "romi.local" # The server's hostname or IP address
PORT = 12345 # The port used by the server
def map(
val: float, in_min: float, in_max: float, out_min: float, out_max: float
) -> float:
ret... | Python | 1 |
# id 101073201 (Mandraky Field : Kidnapping Site), field 101073201
sm.lockInGameUI(True, True)
sm.hideUser(True)
sm.spawnNpc(1500026, -322, 228)
sm.showNpcSpecialActionByTemplateId(1500026, "summon", 0)
sm.spawnNpc(1500031, 40, 228)
sm.showNpcSpecialActionByTemplateId(1500031, "summon", 0)
sm.spawnNpc(1500032, 180, 228... | Python | 1 |
from flask import abort, current_app, redirect, render_template
from apply.default.data import determine_round_status, get_default_round_for_fund, get_ttl_hash
from apply.helpers import get_all_fund_short_names, get_fund_and_round
from common.blueprints import Blueprint
from config import Config
default_bp = Blueprin... | Python | 1 |
import os
from glob import glob
from setuptools import setup
package_name = 'my_environment_pkg'
setup(
name=package_name,
version='0.0.0',
packages=[package_name],
data_files=[
('share/ament_index/resource_index/packages',
['resource/' + package_name]),
('share/' + packag... | Python | 1 |
= r"Value of the register as raw bits"]
#[inline(always)]
pub fn bits(&self) -> u32 {
self.bits
}
#[doc = "Bits 0:1 - GPTM Timer B Mode"]
#[inline(always)]
pub fn timer_tbmr_tbmr(&self) -> TIMER_TBMR_TBMRR {
TIMER_TBMR_TBMRR::_from(((self.bits >> 0) & 3) as u8)
}
#[doc =... | Rust | 0 |
256SUM')).readlines()
print "writing LIST"
newlistfile = open(os.path.join(options.targetdir, "LIST"), 'wb')
# walk the original LIST file and write lines for the files for which there are no archives
for f in filelist:
unpacks = f.strip().split()
filename = unpacks[2]
if filena... | Python | 1 |
ition name string")
}
fn visit_str<E>(self, v: &str) -> Result<Self::Value, E>
where
E: de::Error,
{
SUPPORTED_CONDITIONS
.iter()
.find(|&k| k.0 == v)
.cloned()
... | Rust | 0 |
COLUMN_FAMILIES {
info!("starting {} compaction", name);
let cf = self.db.cf_handle(name).expect("missing CF");
self.db.compact_range_cf(cf, None::<&[u8]>, None::<&[u8]>);
}
config.compacted = true;
self.set_config(config);
... | Rust | 0 |
from .. import IconBase
class IconDelete(IconBase):
class_name = "lucide lucide-delete"
svg_data = {
"attrs": {
"width": "24",
"height": "24",
"view_box": "0 0 24 24",
"fill": "none",
"stroke": "currentColor",
"stroke_width": "2",
"stroke_linecap": "... | Python | 1 |
#[cfg(not(target_os = "linux"))]
fn get_listener(addr: SocketAddr, _interface: &InterfaceName) -> Result<TcpListener, Error> {
let listener = TcpListener::bind(&addr)?;
listener.set_nonblocking(true)?;
Ok(listener)
}
pub fn routes(
context: Context,
) -> impl Filter<Extract = impl warp::Reply, Error = ... | Rust | 0 |
print(f"JSON decode error: {e}")
except Exception as e:
print(f"Unexpected error in message handler: {e}")
def _on_error(self, ws, error):
'''
Websocket error handler
'''
print(f'Websocket Error: {error}')
async def ask(self, query, model='r1-1776', str... | Python | 1 |
from datetime import datetime, timedelta
from airflow import DAG
from airflow.operators.python_operator import PythonOperator
import subprocess
def read_kafka():
# Path to your producer.py script
path_to_script = '/consumer.py'
# Command to execute the Python script
command = ['python', path_to_sc... | Python | 1 |
OST, PUT, DELETE, OPTIONS')
self.send_header('Access-Control-Allow-Headers', 'Content-Type, Authorization, Cookie')
self.end_headers()
response_data = {
'success': True,
'message': '笔记二创成功',
'dat... | Python | 1 |
4;
}
false
}
fn create_filter(&self, keys: Vec<&[u8]>, dst: &mut Vec<u8>, n: usize) {
for i in 0..n {
let h = hash(keys[i], keys[i].len(), 1);
put_fixed_32(dst, h);
}
}
}
#[test]
fn test_empty_builder(... | Rust | 0 |
ust be called in the context of a transaction.
///
/// `prefix` contains is the prefix to be added to JSON table names, e.g, `OVN_Southbound_` or
/// `OVN_Northbound_` for OVN southbound and northbound database updates.
///
/// `updates` is the JSON string, e.g.:
///
/// {"Logical_Switch":{"ffe8d84e-b4a0-419e-b865-19f1... | Rust | 0 |
match evt {
EpEvent::IncomingData(EpIncomingData { con, mut data, .. }) => {
if expect_err {
panic!("got response, expected err");
}
if data.as_ref() == b"" {
... | Rust | 0 |
summarizer = Node.agent(
name="GPT Summarizer",
prompt="Create a concise 2-sentence summary of this analysis: {input}",
agent_id="gpt_summarizer",
llm_config=LlmConfig.openrouter(api_key=os.getenv("OPENROUTER_API_KEY"), model="openai/gpt-4o-mini"),
)
... | Python | 1 |
# -*- coding: utf-8 -*-
from odoo import api, fields, models, _
class AccountChartTemplate(models.Model):
_inherit = 'account.chart.template'
def _create_bank_journals(self, company, acc_template_ref):
res = super(AccountChartTemplate, self)._create_bank_journals(company, acc_template_ref)
... | Python | 1 |
а")
elif chat_id is not None and message_id is not None and account_id is not None:
current_chat_id = chat_id
current_message_id = message_id
# account_id уже передан
logger.info(f"[CALLBACK] Called cb_login_settings programmatically for accoun... | Python | 1 |
vtbl = comptr.ptr as *const *const __IFoo_AutomationVtbl;
#[allow(unused_unsafe)]
let result: Result<(), ::intercom::ComError> =
(||
unsafe {
let __result =
((**vtbl).trait_method_Automation)(comptr.ptr);... | Rust | 0 |
read: Arc<AtomicU64>) -> Self {
WsJetStream {
stream,
nb_bytes_read,
packet_interceptor: None,
}
}
}
impl Stream for WsJetStream {
type Item = Vec<u8>;
type Error = io::Error;
fn poll(&mut self) -> Result<Async<Option<<Self as Stream>::Item>>, <Self ... | Rust | 0 |
0]:
for coll_1 in self.link_to_colls[link_1]:
if coll_0 == -1 or coll_1 == -1:
continue
dist = collide(coll[coll_0], coll[coll_1]).dist
min_dist = min_dist.at[..., idx].set(
... | Python | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.