text string | label_name string | labels int64 |
|---|---|---|
rnalVersionInfo {
type Err = VersionParseError;
fn from_str(vs: &str) -> Result<Self, Self::Err> {
let versions: Vec<u32> = vs.split('.').map(|s| s.parse::<u32>().unwrap()).collect();
if versions.len() != 3 {
return Err(VersionParseError::IncorrectFormat(vs.to_string()));
}
... | Rust | 0 |
ool {
*self == SRAM_CTRL2_A::DISABLE
}
#[doc = "Checks if the value of the field is `ENABLE`"]
#[inline(always)]
pub fn is_enable(&self) -> bool {
*self == SRAM_CTRL2_A::ENABLE
}
}
#[doc = "Write proxy for field `SRAM_CTRL2`"]
pub struct SRAM_CTRL2_W<'a> {
w: &'a mut W,
}
impl<'a... | Rust | 0 |
self.multiply(&o)
}
}
impl MulAssign<Quat> for Quat {
fn mul_assign(&mut self, o: Quat) {
*self = self.multiply(&o)
}
}
impl MulAssign<&Quat> for Quat {
fn mul_assign(&mut self, o: &Quat) {
*self = self.multiply(&o)
}
}
//#######################################################... | Rust | 0 |
_____
// | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
// | Command Class = COMMAND_CLASS_METER(0x32) |
// | Command = METER_GET(0x01) |
// | Meter Type |
... | Rust | 0 |
ext = self._sanitize_file_paths(text)
# 清理系统信息
text = self._sanitize_system_info_in_text(text)
return text
def _sanitize_stack_trace(self, stack_trace: str) -> str:
"""清理堆栈跟踪"""
if not isinstance(stack_trace, str):
stack_trace = str(stack_trace)
# 截断过长... | Python | 1 |
if total > 0:
print("Pass rate: {}{:.1f}%{}".format(
GREEN if passed == total else RED,
(passed/total)*100,
RESET
))
print(f"Total time: {total_time:.3f}s")
print(f"Average time: {total_time/total:.3f}s")
print(f"Average CPU usage: {total_cpu/t... | Python | 1 |
stable_sorted(temp_dir.to_string()), // Stable sort, else the token_ids will be reorderer in the wrong order
}))
} else {
None
};
let parent_to_text_id = if field_config.is_index_enabled(IndexCreationType::ParentToTextID) {
Some(Box::new(BufferedIndexWriter::new_for_sorted_id_inserti... | Rust | 0 |
_derive;
extern crate chrono;
extern crate serde;
extern crate serde_json;
use chrono::prelude::*;
use std::{
cmp::{max, min},
collections::BTreeMap,
error,
fmt::{self, Display},
fs::{self, File},
io,
path::Path,
};
#[derive(Clone)]
pub struct CheckpointDbError {
error_kind: ErrorKind,... | Rust | 0 |
w(hwnd)
time.sleep(0.5) # 等待窗口聚焦
parts = x['param'].split(',')
click_x = int(parts[0])
click_y = int(parts[1])
long_position = win32api.MAKELONG(click_x, click_y) # 模拟鼠标指针 传送到指定坐... | Python | 1 |
NodeId(unsafe { NonZeroU64::new_unchecked(2) });
const NODE_ID_3: NodeId = NodeId(unsafe { NonZeroU64::new_unchecked(3) });
const NODE_ID_4: NodeId = NodeId(unsafe { NonZeroU64::new_unchecked(4) });
const NODE_ID_5: NodeId = NodeId(unsafe { NonZeroU64::new_unchecked(5) });
#[test]
fn parent_and_in... | Rust | 0 |
_xmm_m32
0x4222_0010,// EVEX_Vmovss_xmm_k1z_xmm_xmm
0x4222_0010,// EVEX_Vmovss_xmm_k1z_m32
0x4032_0010,// Movsd_xmm_xmmm64
0x42B2_0010,// VEX_Vmovsd_xmm_xmm_xmm
0x42B2_0010,// VEX_Vmovsd_xmm_m64
0x4272_0010,// EVEX_Vmovsd_xmm_k1z_xmm_xmm
0x4272_0010,// EVEX_Vmovsd_xmm_k1z_m64
0x4002_0011,// Movups_xmmm128_xmm
... | Rust | 0 |
e.g. enums like `VMPublishingOption`)
// In the override, we can reuse this default logic via this function
// Note: we cannot directly call the default `deserialize_into_config` implementation
// in its override - this will just refer to the override implementation itself
fn deserialize_default_impl(by... | Rust | 0 |
// s_8 comes into scope
takes_ownership(s_8); // s_8's value move into the function ..
// ... and so is no longer valid herr
// println!("{}", s_8);
let x_3 = 5; // x_3 comes into scope
make_copy(x_3); // x_3 would move into the function
... | Rust | 0 |
from thoth.app.analyzer.abstract_analyzer import (
AbstractAnalyzer,
CategoryClassification,
ImpactClassification,
PrecisionClassification,
)
class ERC721Analyzer(AbstractAnalyzer):
"""
Detect if a contract is an ERC20 Token and analyze its properties where applicable
"""
NAME = "ERC7... | Python | 1 |
col1:
days_back = st.selectbox("Analysis Period", [30, 60, 90], index=0)
with col2:
analyze_button = st.button("Analyze Historical Returns", type="primary")
if analyze_button:
with st.spinner(f"Analyzing last {days_back} days of 2-4 PM performance..."):
analysis = premiu... | Python | 1 |
import pyarts3 as pyarts
import numpy as np
ws = pyarts.workspace.Workspace()
# %% Sampled frequency range
line_f0 = 118750348044.712
ws.frequency_grid = [line_f0]
# %% Species and line absorption
ws.absorption_speciesSet(species=["O2-66"])
ws.ReadCatalogData()
ws.absorption_bandsSelectFrequencyByLine(fmin=40e9, f... | Python | 1 |
"""搜索工具
提供搜索功能(当前为模拟实现,未来可集成真实搜索API)
"""
import random
from typing import List
from ..base import BaseTool, ToolResult, register_tool
from ...utils.logger import get_logger
logger = get_logger(__name__)
@register_tool
class SearchTool(BaseTool):
"""搜索工具
提供搜索功能,当前为演示版本,返回模拟搜索结果
"""
def __init__(s... | Python | 1 |
h is False
assert FLAGS.start is None
assert FLAGS.end is None
calendars = FLAGS.calendars.split(',')
multi_cal = MultiCalendar(FLAGS.start,FLAGS.end,calendars,FLAGS.today,FLAGS.this_week,FLAGS.this_month,FLAGS.print_details,not FLAGS.remove_grid) # for one day: set start date, end date + 1
... | Python | 1 |
(
sock,
opt,
value_ptr as *mut c_void,
&mut size)
});
Ok(value as $ty)
}
}
)
);
getsockopt_num!(c_int, i32);
getsockopt_num!(c_uint, u32);
getsockopt_num!(int64_t, i64... | Rust | 0 |
'''
Escribe un programa que pregunte al usuario su peso en kg y
lo almacene en una variable. El programa debe mostrar al final
el peso introducido por el usuario.
'''
peso = float (input ("Indique su peso en kg: "))
print (f"Su peso es de {peso} kg.") | Python | 1 |
GE_BONUS_PER_UPGRADE.get(&self.type_id());
let extract_weapon_stats = |w: &Weapon| {
let damage_bonus_per_upgrade = damage_bonus_per_upgrade.and_then(|bonus| bonus.get(&w.target));
let mut damage = w.damage
+ (self.attack_upgrade_level()
* damage_bonus_per_upgrade.and_then(|bonus| bonus.0).unwrap_or(1... | Rust | 0 |
queue.
/// NOTE: It is OK for `on_task` to enqueue more tasks. In this case they're left in the queue
/// and will be processed by the *next* call to `dequeue_all`, *not* the current one.
pub(crate) fn dequeue_all(&self, on_task: impl Fn(NonNull<TaskHeader>)) {
// Atomically empty the queue.
... | Rust | 0 |
.0,b=0):
if b==0:
return saw_ker_conv0(x,K,s)
else:
return saw_ker_conv0(x,K,s)+const_ker_conv_valid(x,K,b)# 3N次乘法
if True:
S=0.3
B=3
N=10
K=3
x=np.random.randint(-10,10,N).astype(float) # 测试随机信号
#x=np.zeros(N).astype(float) # 测试冲击响应
#x... | Python | 1 |
residue(rr,true);
}
let (mut md_envset,mut md_varset):(charmm_based_energy::CharmmEnv,charmm_based_energy::CharmmVars) = charmm_based_energy::MDAtom::chain_to_atoms(&mut chain,&parr,true);
let mut aligned_atoms:HashSet<usize> = HashSet::new();
for (aii,aa) in md_envset.atoms.iter().enumerate(){
... | Rust | 0 |
let mut rng: StdRng = SeedableRng::from_seed(SEED);
let vec: Vec<_> = (0..n).map(move |_| [rng.gen::<i64>(); 3]).collect();
vec.into()
}
#[inline]
fn make_random_vec_dyn(n: usize) -> VecDyn<DynCloneVTable> {
let mut rng: StdRng = SeedableRng::from_seed(SEED);
let vec: Vec<_> = (0..n).map(move |_| [... | Rust | 0 |
r_sender_clone = radpar_sender.clone(); // SENDER CLONE
&entrypar.widget.connect_changed(move|_| {
let new_val: Result<f64, std::num::ParseFloatError> =
buffer
.get_text() // from buffer
.as_str() // parse as string
... | Rust | 0 |
# -----------------------------------------------------------------------------
# Copyright © 2009- The Spyder Development Team
#
# Licensed under the terms of the MIT License
# (see LICENSE.txt for details)
# -----------------------------------------------------------------------------
"""Provides QtNetworkAuth class... | Python | 1 |
code="NOERROR")
resp.check_count(1, "RRSIG")
resp = master.dig("cataloged2.", "SOA")
resp.check(rcode="NOERROR")
resp = slave.dig("cataloged2.", "SOA", dnssec=True)
resp.check(rcode="NOERROR")
resp.check_count(1, "RRSIG")
# Check adding and removing duplicate
up = master.update(zone[1])
up.add("bar3.zones.catalog1.", ... | Python | 1 |
t)?.to_string();
messages.truncate(42);
assert_eq!(
messages,
"\
Please input your awaited date: \
Thank you!\
"
.to_string()
);
Ok(())
}
<filename>src/analyses/mod.rs
pub mod call_analyzer;
pub mod heap_analyzer;
pub mod jump_analyzer;
pub mod r... | Rust | 0 |
"< device"]
pub const ZE_RESULT_ERROR_INVALID_GLOBAL_WIDTH_DIMENSION: _ze_result_t =
_ze_result_t(2013265940);
}
impl _ze_result_t {
#[doc = "< [Validation] kernel argument index is not valid for kernel"]
pub const ZE_RESULT_ERROR_INVALID_KERNEL_ARGUMENT_INDEX: _ze_result_t =
_ze_result_t(2... | Rust | 0 |
inline(always)]
pub fn adc_dcctl7_cim(&self) -> ADC_DCCTL7_CIMR {
ADC_DCCTL7_CIMR::_from(((self.bits >> 0) & 3) as u8)
}
#[doc = "Bits 2:3 - Comparison Interrupt Condition"]
#[inline(always)]
pub fn adc_dcctl7_cic(&self) -> ADC_DCCTL7_CICR {
ADC_DCCTL7_CICR::_from(((self.bits >> 2) &... | Rust | 0 |
Server that provides application-specific
information. The URL uses the internal hostname, and requires a proxy
server for resolution and, possibly, access.
"""
class StateValueValuesEnum(_messages.Enum):
r"""Required. The application state.
Values:
STATE_UNSPECIFIED: Status is unspecifi... | Python | 1 |
from rest_framework import serializers
from .models import User
class UserSearilizer(serializers.ModelSerializer):
class Meta:
model = User
fields = '__all__' | Python | 1 |
_string,
'info': all_info}
# Optional: save features somewhere if needed
all_visual_feature = all_visual_feature.cpu().numpy()
all_text_feature = all_text_feature.cpu().numpy()
sim = np.dot(all_text_feature, all_visual_feature.T)
metrics = compute_metrics(sim)
print(metrics... | Python | 1 |
rint!("M-^{}", (x + 64) as char);
}
else {
print!("M-{}", (*b - 128) as char);
}
}
}
}
}
}
fn print_tab() {
print!("^I");
}
#[cfg(test)]
mod tests {
use super::is_empty;
use super::c... | Rust | 0 |
ruct Day8 {}
impl Solver<'_> for Day8 {
type Generated = Image;
type Output = usize;
fn generator(input: &str) -> Self::Generated {
parse_image(input, 25, 6)
}
fn part1(image: Self::Generated) -> Self::Output {
let layer = image
.iter()
.min_by_key(|layer| ... | Rust | 0 |
/ let mut crc = CRC::crc6cdma2000_b();
/// crc.digest(b"123456789");
/// # #[cfg(features = "alloc")]
/// assert_eq!("0x3B", &crc.to_string());
/// ```
#[inline]
pub fn crc6cdma2000_b() -> CRC {
CRC::CRCu8(CRCu8::crc6cdma2000_b())
}
/// |Check|Poly|Init|Ref|XorOut|
/// |---|... | Rust | 0 |
"""
Method to verify POST data.
<HEX VALUE>...<HEX VALUE>
Example:
AA BB 00 01 EF 0A 0E EA
...
...
"""
option = " --get_post_code"
self.regex = r"^.+[a-fA-F0-9]+.+\s*"
self.set_bic_cmd()
self.bic_cmd += option
self.ge... | Python | 1 |
0.2",
"1.1.1.1",
443,
12345,
b"Well, I heard 1.1.1.1 is all the rage",
)),
None, // sleep
Some(build_tcp_packet(
"10.0.0.2",
"3.3.3.3",
4435,
1337,
b"Wait for me!",
)),
Som... | Rust | 0 |
.to_string());
99
} else {
let id = match args.value_of("GID") {
Some(id) => {
let id = id.parse::<usize>().unwrap_or_exit(1);
if let Some(_group) = sys_groups.get_by_id(id) {
eprintln!("useradd: group already exists with gid: {}", id);... | Rust | 0 |
] = &[
"*.tar.gz",
".directory",
".dropbox",
".dropbox.cache",
".git",
".mypy_cache",
"_rendered",
"target",
];
impl Default for SyncConfig {
fn default() -> Self {
let home_dir = dirs::home_dir().unwrap();
let mut ignore = GlobSetBuilder::new();
for glob in... | Rust | 0 |
x31, 0xa1, 0x18, 0x6a, 0xc0, 0xdf, 0xc1, 0x7c,
0x98, 0xdc, 0xe8, 0x7b, 0x4d, 0xa7, 0xf0, 0x11, 0xec, 0x48, 0xc9, 0x72,
0x71, 0xd2, 0xc2, 0x0f, 0x9b, 0x92, 0x8f, 0xe2, 0x27, 0x0d, 0x6f, 0xb8,
0x63, 0xd5, 0x17, 0x38, 0xb4, 0x8e, 0xee, 0xe3, 0x14, ... | Rust | 0 |
turn "未知"
for keyword in keywords:
if not keyword: # 跳过空关键词
continue
try:
if use_regex:
# 使用正则表达式匹配(忽略大小写)
if re.search(keyword, message_text, re.IGNORECASE):
return keyword
else:
... | Python | 1 |
assert_eq!(r0.0, Some(ClosedZone{pba: PBA::new(0, 10), freed_blocks: 5,
total_blocks: 10, txgs: TxgT::from(0)..TxgT::from(1), zid: 1}));
let (clust, zid) = r0.1.unwrap();
let r1 = pool.find_closed_zone(clust, zid);
assert_eq!(r1.0, Some(ClosedZone{pba: PBA::new(0, 30), freed_b... | Rust | 0 |
r, major - 0x60)?;
r.seek(SeekFrom::Current(len as _))?;
}
// Major type 4: an array of data items
0x80..=0x9b => {
let len = read_len(r, major - 0x80)?;
for _ in 0..len {
self.skip(r)?;
}
... | Rust | 0 |
# -*- coding: utf-8 -*-
import numpy as np
import geatpy as ea
class Pathological(ea.Problem): # 继承Problem父类
def __init__(self, Dim=30): # Dim : 决策变量维数
name = 'Pathological' # 初始化name(函数名称,可以随意设置)
M = 1 # 初始化M(目标维数)
maxormins = [1] * M # 初始化maxormins(目标最小最大化标记列表,1:最小化该目标;-1:最大化该目标)
... | Python | 1 |
# ----------------------------------------------------------------------------
# - Open3D: www.open3d.org -
# ----------------------------------------------------------------------------
# Copyright (c) 2018-2024 www.open3d.org
# SPDX-License-Identifier: MIT
# ---------... | Python | 1 |
HashSet<(i64, i64, i64, i64)>) -> u64 {
let mut cubes = cubes.clone();
for _ in 0..6 {
let mut tmp = cubes.clone();
for cube in &cubes {
let neighbors = count_active_neighbors_3d(&cubes, cube);
if neighbors != 2 && neighbors != 3 {
tmp.remove(cube);
... | Rust | 0 |
-> __jni_bindgen::std::option::Option<__jni_bindgen::Local<'env, crate::android::icu::lang::UCharacter_UnicodeBlock>> {
unsafe {
let (class, field) = env.require_class_static_field("android/icu/lang/UCharacter$UnicodeBlock\0", "COMBINING_DIACRITICAL_MARKS\0", "Landroid/icu/lang/UCharacter$U... | Rust | 0 |
ed_value['volatility'].iloc[-1] = volatility # Chained assignment is not allowed soon
looped_value.at[looped_value.index[-1], 'volatility'] = volatility # use .at to avoid chained assignment
return volatility
def eval_info_ratio(looped_value, reference_value, reference_data):
""" 信息比率。衡量超额风险带来的超... | Python | 1 |
_str().unwrap())
{
return val_error!(errors::Format {
path: path.to_string(),
detail: "".to_string(),
});
}
}
super::ValidationState::new()
}
}
use std::io::Read;
use std::fs::File;
pub struct Rom {
... | Rust | 0 |
map
}
pub struct RequestData<'a>
{
cookie: HashMap<&'a str, &'a str>,
header: HashMap<&'a str, &'a str>,
data: HashMap<&'a str, &'a str>
}
pub unsafe fn dict_to_map(dict:*const Dictionary, map: &mut HashMap<&str, &str>)
{
if (*dict).map != std::ptr::null()
{
for i in 0..(*dict).cap {
... | Rust | 0 |
Corrupt(String),
// This error case is disabled, as git allows extra garbage in the extra edges list?
// #[error("The last entry in commit-graph's extended edges list does is not marked as being terminal")]
// ExtraEdgesOverflow,
#[error("Could not open commit-graph file at '{}'", .path.display())]
... | Rust | 0 |
1ui64ARB(&self, index: GLuint, x: GLuint64EXT) {
match self.glVertexAttribL1ui64ARB_p {
Some(f) => f(index, x),
None => Self::not_loaded("glVertexAttribL1ui64ARB"),
}
}
#[doc(hidden)]
pub fn VertexAttribL1ui64ARB_is_loaded(&self) -> bool {
self.glVertexAttribL1ui64ARB_p.is_some()
}
///... | Rust | 0 |
> {
match load_sk_file(filepath) {
Ok(key) => generate_pk_rsa_pkcs1_der_from_rsa_sk(key),
Err(err) => Err(Errs::strs("load_sk_file", err)),
}
}
/// 生成RSA公钥
fn generate_pk_rsa_pkcs8_der_from_sk_file<P: AsRef<Path>>(filepath: P) -> Results<Vec<u8>> {
match load_sk_file(filepath) {
Ok(... | Rust | 0 |
#! -*- coding: utf-8 -*-
# 简单的线性变换(白化)操作,就可以达到BERT-flow的效果。
# 测试环境:tensorflow 1.14 + keras 2.3.1 + bert4keras 0.9.7
# 测试任务:GLUE的STS-B。
import numpy as np
import scipy.stats
from bert4keras.backend import keras, K
from bert4keras.tokenizers import Tokenizer
from bert4keras.models import build_transformer_model
from ber... | Python | 1 |
from drf_yasg.views import get_schema_view
from drf_yasg import openapi
schema_view = get_schema_view(
openapi.Info(
title="API de Recrutement",
default_version='1',
description="Documentation de l'API de gestion des candidats et recruteurs",
terms_of_service="https://www.google.com... | Python | 1 |
python")).unwrap(),
vec!["Python"]
);
}
#[test]
fn test_shebang_get_languages_env() {
assert_eq!(
get_languages_from_shebang(Cursor::new("#!/usr/bin/env node")).unwrap(),
vec!["JavaScript"]
);
}
#[test]
fn test_shebang_get_languages_mu... | Rust | 0 |
e_stamps}, "
f"and number of predicting days: {num_of_predicting_days}")
return html.Div(main(meld_na_scores, time_stamps, num_of_predicting_days), style=styles['info'])
return html.Div("The predicted MELD scores will be displayed here.", style=styles['info'])
# Add CSS for button hover effe... | Python | 1 |
Ace),
Card::new(Suite::Hearts, Value::Ace),
Card::new(Suite::Clubs, Value::Two),
Card::new(Suite::Diamonds, Value::Two),
];
assert_eq!(Hand::FullHouse, determine_high_hand(&cards));
}
}
<gh_stars>1-10
use serde::Deserialize;
use std::{fs, path::Path};
#[derive(Debug, Deserialize, PartialEq)]
#[serde(def... | Rust | 0 |
ion, unreal_scale
def clear_level_selection():
"""
Clears the selection of the current opened level.
"""
unreal.EditorLevelLibrary().select_nothing()
def get_unreal_python_interpreter_path():
"""
Returns path where Unreal Python interpreter is located.
:return: Unreal Python interprete... | Python | 1 |
c", "difficulty"]
)
# Implement retry logic with maximum attempts
max_attempts = 3
for attempt in range(max_attempts):
try:
# Generate response using LLM
response = self.llm.invoke(prompt.format(topic=topic, difficulty=difficulty))
... | Python | 1 |
// Note that the compiler may still treat some of these specially
// when possible, e.g. replacing an `=` call with the `Eq` instruction.
"+" => ADD = 0,
"-" => SUB = 1,
"*" => MUL = 2,
"^" => POW = 3,
"/" => DIV = 4,
"//" => FLOOR_DIV = 5,
"rem" => REM = 6,
"<<" => SHL = 7,
... | Rust | 0 |
import random
import matplotlib.pyplot as plt
import numpy as np
from sklearn.datasets import make_blobs
def k_means(k: int, num_samples: int):
# generate 3 clusters
X, y_true = make_blobs(n_samples=num_samples, centers=k, cluster_std=0.60, random_state=0)
# step 1 get random k numbers as initial cent... | Python | 1 |
# If escape is pressed, kill everything.
if args[0] == ESCAPE:
glutDestroyWindow(window)
sys.exit()
def main():
global window
# For now we just pass glutInit one empty argument. I wasn't sure what should or could be passed in (tuple, list, ...)
# Once I find out the right stuff based on reading the Py... | Python | 1 |
import random
from time import sleep
print('=-' * 20)
print('Adivinhe qual número eu estou pensando')
print('Dica: è de 0 a 5')
print('=-' * 20)
ns = random.randint(0, 5)
resp = int(input('E ai? Qual é o número?'))
print('Conferindo...')
sleep(3)
if resp == ns:
print('Droga você acertou!')
else:
print('HAHAHA v... | Python | 1 |
mut was_off: i32,
mut start_off: i32,
mut sx: i32,
mut sy: i32,
mut scx: i32,
mut scy: i32,
mut cx: i32,
mut cy: i32,
) -> i32 {
if (start_off) != 0 {
if (was_off) != 0 {
stbtt_setvertex(
((&mut *vertices.offset((c_runtime::postInc(&mut num_vertices))... | Rust | 0 |
# Log to tensorboard if available
if hasattr(self.model, 'logger') and self.model.logger:
for key, value in log_data.items():
self.model.logger.record(key, value)
def get_recent_insights(self, limit: int = 5) -> List[Dict[str, Any]]:
"""Get recent LCM insights about... | Python | 1 |
-automate<gh_stars>0
pub mod filter_type;
<reponame>RalfJung/crossbeam<filename>src/seg_queue.rs<gh_stars>0
use std::cell::UnsafeCell;
use std::cmp;
use std::fmt;
use std::mem::{self, ManuallyDrop};
use std::ptr;
use std::sync::atomic::Ordering::{Acquire, Relaxed, Release};
use std::sync::atomic::{AtomicBool, AtomicUsi... | Rust | 0 |