text string | label_name string | labels int64 |
|---|---|---|
it()
# Calculate time instances for these smartly detected peaks
smart_peak_times = smart_peaks / sample_rate
# Initialize array to store smart BPM values
smart_bpm_values = []
# Calculate BPM for each time window using smart peaks
for start_time in time_windows:
end_time = start_time + 5
peaks_in_window = s... | Python | 1 |
as SPWN code")
.visible_alias("e")
.args(&[
arg!(-c --"console-output" "Makes the script print the created level into the console instead of writing it to your save file"),
arg!(-l --"no-level" "Only compiles the script, no level creation at all")... | Rust | 0 |
content
def generate_line_timestamp(line: Line) -> str:
timestamp = f'[{format_time(line["begin"])}]'
if line['agent']:
timestamp += line['agent'] + ':'
return timestamp
def generate(data: Data) -> str:
content = ''
last_line_end = 0
timing = data['timing']
for line in data['lyr... | Python | 1 |
ization primitives that have both synchronous and asynchronous variants under the same
//! interface.
#[cfg(feature = "__sync")]
mod blocking;
#[cfg(feature = "__async")]
mod futures;
#[cfg(feature = "__sync")]
use self::blocking as imp;
#[cfg(feature = "__async")]
use self::futures as imp;
/// A type alias for eith... | Rust | 0 |
);
}
}
array_383.finish();
}
if let Some(var_386) = &input.configuration {
let mut object_387 = object.key("configuration").start_object();
crate::json_ser::serialize_structure_crate_model_cluster_configuration(
&mut object_387,
var_386,
... | Rust | 0 |
_len: count }])?.into())
}
pub fn sys_write(
ctx: &SyscallContext<'_>,
fd: FdNumber,
buffer: UserAddress,
count: usize,
) -> Result<SyscallResult, Errno> {
let file = ctx.task.files.get(fd)?;
Ok(file.ops().write(&file, &ctx.task, &[iovec_t { iov_base: buffer, iov_len: count }])?.into())
}
pub ... | Rust | 0 |
import pandas as pd
file_path = "DS Internship - EDA - Data.xlsx"
data_df = pd.read_excel(file_path, sheet_name="Data")
remodelled_stores = data_df[data_df["Store Modification"].notna() & (data_df["Store Modification"].str.lower() != "no modifications")]["Store"].nunique()
print("The number of stores remodelled durin... | Python | 1 |
import sys
import E8_Vinicultores as interfaz
from PyQt5 import uic, QtWidgets, QtGui
class MyDialog(QtWidgets.QDialog, interfaz.Ui_Dialog):
def __init__(self):
QtWidgets.QDialog.__init__(self)
interfaz.Ui_Dialog.__init__(self)
self.setupUi(self)
# Área de los Signals
self... | Python | 1 |
write(&mut self, buf: &[u8]) -> io::Result<usize> {
if let Ok(mut inner) = self.inner.lock() {
inner.extend_from_slice(buf);
}
Ok(buf.len())
}
fn flush(&mut self) -> io::Result<()> {
Ok(())
}
}
impl thrift::transport::TIoChannel for TBufferChannel {
fn spli... | Rust | 0 |
e))]
pub struct ValueStateKey(pub Vec<u8>, pub u64);
/// The state of the value for a given key, starting at a particular epoch.
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
#[cfg_attr(feature = "serde", serde(bound = ""))]
pub struct ValueSt... | Rust | 0 |
rwardMsg:
"""
When we are here, the message queue is cleared from non-lifecycle messages
before they were flushed to the browser.
If there were no non-lifecycle messages in the queue, changing the type here
should not matter for the frontend anyways, so we optimistically change the
`script_fini... | Python | 1 |
pd = np.mean(negative_log_predictive_density(y=Y_t,
post_mean=posterior_mean,
post_cov=posterior_var,
lik_cov=noise_var))
rmse = np.sqrt(np.nanmean((np.squeeze(Y_t) - np.squeeze(p... | Python | 1 |
import sys
from hpo.experiments import bo, soo, bamsoo, sampling
if len(sys.argv) < 2:
print("No argument provided")
sys.exit(1)
arg = sys.argv[1]
print(f"Received argument: {arg}")
if arg == "sampling" :
sampling.main()
elif arg == "bo" :
bo.main()
elif arg == "soo" :
soo.main()
elif arg == ... | Python | 1 |
bro_mesa",
"organismo_estado": miembro_row.organismo_estado
})
# Verificar si es agente policial
query_agente = text("""
SELECT ap.comisaria, ap.id_establecimiento, e.nombre as establecimiento_nombre
FROM agente_policial ap
LEFT JOIN establecimiento e ON ap.id_es... | Python | 1 |
discount_amount == "":
discount_amount = "0"
except Exception as e:
discount_amount = "No discount"
print(f"Amount discount: {discount_amount}")
return discount_amount
from selenium.webdriver.common.by import By
from selenium.common.exceptions import NoSuchElementException
def check_st... | Python | 1 |
convert::TryFrom;
use std::ffi::{CStr, CString};
use std::fmt;
use std::marker::PhantomData;
use std::mem::MaybeUninit;
use std::str::FromStr;
use libc::c_char;
use crate::context::Context;
use crate::decimal::Decimal;
use crate::decimal64::Decimal64;
use crate::error::ParseDecimalError;
/// A 32-bit decimal floatin... | Rust | 0 |
features
}
fn acked_features(&self) -> u64 {
self.acked_features
}
fn set_acked_features(&mut self, acked_features: u64) {
self.acked_features = acked_features;
}
fn read_config(&self, offset: u64, mut data: &mut [u8]) {
let config_space_bytes = self.config_space.as_sl... | Rust | 0 |
with_version();
let longs = longs_and_visible_aliases(&cmd);
assert_eq!(longs.len(), 2);
assert_eq!(longs[0], "help");
assert_eq!(longs[1], "version");
let sc_longs = longs_and_visible_aliases(find_subcommand_with_path(&cmd, vec!["test"]));
assert_eq!(sc_longs.len(), 3... | Rust | 0 |
PairingCurve, PairingEngine,
},
fields::bls12_377::{Fq, Fq12, Fq12Parameters, Fq2Parameters, Fq6Parameters},
};
pub mod g1;
pub mod g2;
#[cfg(test)]
mod tests;
use self::{g1::Bls12_377G1Parameters, g2::Bls12_377G2Parameters};
pub struct Bls12_377Parameters;
impl Bls12Parameters for Bls12_377Paramet... | Rust | 0 |
deprecated(since = "0.1.0", reason = "use unsigned indices instead") )]
impl<T> Index<i64> for List<T> {
#[cfg_attr(feature = "unstable",
stable(feature = "list", since = "0.1.0") )]
#[cfg_attr(feature = "unstable",
deprecated(since = "0.1.0", reason = "use unsigned indices instead") )]
... | Rust | 0 |
Gradient4" cx="50%" cy="50%" fx="50%" fy="50%" r=".5">
<animate attributeName="fx" dur="23s" values="0%;5%;0%" repeatCount="indefinite"></animate>
<stop offset="0%" stop-color="rgba(0, 255, 0, 1)"></stop>
<stop offset="100%" stop-color="rgba(0, 255, 0, 0)"></stop>
</radialgra... | Python | 1 |
: {}", count_2);
}
fn parse_input(path: &str) -> Vec<usize>{
let lines = read_file::get_lines(&path);
lines.map(|line| {
line
.unwrap()
.parse()
.unwrap()
})
.collect()
}
fn solve_part_1(values: Vec<usize>) -> usize{
let mut values = values.into_iter();
... | Rust | 0 |
from pirates.pirate.PAvatarHandle import PAvatarHandle
class PTalkHandle(PAvatarHandle):
def __init__(self, doId, message):
self.avatarId = doId
self.avatarName = None
self.accountId = None
self.accountName = None
self.addMessageInfo(message)
self.bandId = (0, 0)
... | Python | 1 |
failed to duplicate view_ref");
}
}
//
//
// This file is a part of Aleph
//
// https://github.com/nathanvoglsam/aleph
//
// MIT License
//
// Copyright (c) 2020 Aleph Engine
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (th... | Rust | 0 |
elds.next().unwrap().parse().unwrap(),
name: read_u25(fields.next().unwrap()),
address: AbomonationWrapper { element: ArrayString::from(fields.next().unwrap()).unwrap() },
nation_key: fields.next().unwrap().parse().unwrap(),
phone: read_u15(fields.next().unwrap()),
... | Rust | 0 |
. If you want a mathematical
// justification for choosing this value, observe that the graph of
// `f(x) = a/x` for positive `a` approaches infinity as `x` goes to `0` and
// it continues to do so as `a` approaches `0` as well. A pragmatic
// justification for this value is that `0.0... | Rust | 0 |
<K, V>> {
// This implementation is actually unsafe since we don't check if the
// index is in-bounds. But this is fine since this is only used internally.
unsafe { self.pointers.get_unchecked(index) }
}
}
/// Tower at the head of a skip list.
///
/// This is located in the `SkipList` struc... | Rust | 0 |
panic::catch_unwind(move || test(&testpath));
std::fs::remove_file(dbpath).unwrap();
match result {
Ok(res) => res,
Err(err) => {
std::panic::resume_unwind(err);
}
}
}
fn temp_db_path() -> String {
let mut temp_dir = std::env::temp_dir();
let thread_id = GLOBA... | Rust | 0 |
: usize = $crate::count![@COUNT; $($element),*];
#[allow(unused_mut)]
let mut vs = Vec::with_capacity($crate::count![@COUNT; $($element),*]);
$(vs.push($element);)*
vs
}};
($($element:expr),*) => {{
$crate::avec![$($element),*]
}};
($element:expr; $count:expr) =>... | Rust | 0 |
thumb;
}
}
}
}
fn calculate_size(&self, _: Size) -> Size {
self.size
}
}
use chrono::{DateTime, FixedOffset};
use common::{
geo,
model::{
opportunity::{
Cost, Descriptor, EntityType, OpportunityQuery, OpportunityQueryOrdering,
... | Rust | 0 |
import os
import time
import subprocess
from mobile_safety.utils import file as file_lib
from mobile_safety.utils import utils as utils_lib
from mobile_safety.utils import bluetooth as bluetooth_lib
def task_init(init_params):
"""_summary_
Args:
console_port (str, optional): _description_. Defaults ... | Python | 1 |
c_meta_data:
func_name = meta_data[0]
w_shape = list(meta_data[1])
layout_shape = ()
dump_point = meta_data[2]
func_type = meta_data[3]
data_index = meta_data[6]
if '{}-{}'.format(func_name, func_type) not in logged_func:
logged_func.append('{}-{}'.for... | Python | 1 |
#!/usr/bin/python3
"""
This script defines a City class
to work with MySQLAlchemy ORM.
"""
from relationship_state import Base, State
from sqlalchemy import Column, Integer, String, ForeignKey
class City(Base):
"""City class
Attributes:
__tablename__ (str): The table name of the class
id (int... | Python | 1 |
aker.similarity.model1Score = 0.8
skill_matchmaker.similarity.model2Score = 0.6
skill_matchmaker.similarity.ensembleScore = 0.7
skill_matchmaker.model1 = MagicMock()
skill_matchmaker.model2 = MagicMock()
skill_matchmaker.reset()
assert skill_matchmaker.similarity.model1Score is None
assert s... | Python | 1 |
, "{}{}{}", from, to, if promote { "+" } else { "" })
}
Move::Drop { to, piece_type } => {
write!(f, "{}*{}", piece_type.to_string().to_uppercase(), to)
}
}
}
}
impl str::FromStr for Move {
type Err = ParseMoveError;
fn from_str(s: &str) -> Resul... | Rust | 0 |
"""
Script to create a simple sample model for testing.
"""
import os
import pickle
import json
import numpy as np
from sklearn.ensemble import RandomForestClassifier
# Create model directory if it doesn't exist
os.makedirs('./model', exist_ok=True)
# Create a simple random forest model
model = RandomForestClassifier... | Python | 1 |
step = 0
# Explicit iterator lets us call next() manually
train_iter = iter(train_loader)
for epoch in range(EPOCHS):
running_loss = 0.0
running_acc = 0.0
for i in range(len(train_loader)):
# Dataloader fetch (measures wait time of GPU if available)
print(... | Python | 1 |
result = {}
for attr, _ in self.swagger_types.items():
value = getattr(self, attr)
if isinstance(value, list):
result[attr] = list(map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value))
elif hasattr(value, "to_dict"):
resul... | Python | 1 |
"Command".cell().bold(true),
program_def
.args
.iter()
.map(|x| x.to_string())
.collect::<Vec<String>>()
.join("\n")
.cell(),
]);
rows.push(vec![
"Stdout".cell().bold(true),
stdio_to_cell(&program_def.stdout),
])... | Rust | 0 |
3, Vector3};
use ncollide3d::shape::{Cuboid, ShapeHandle};
use nphysics3d::object::{ColliderDesc, RigidBodyDesc};
use nphysics3d::material::{BasicMaterial, MaterialHandle};
use nphysics3d::world::World;
use nphysics_testbed3d::Testbed;
fn main() {
/*
* World
*/
let mut world = World::new();
world... | Rust | 0 |
: false,
can_present: false,
max_layers: 0
}
}
}
use std::fmt;
/// VN error kinds.
///
/// Low-level error kinds.
/// As a general rule, these should not be matched against.
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
#[non_exhaustive]
pub enum VnErrorKind {
/// Bad payload co... | Rust | 0 |
::ErrorKind::Interrupted),
AddrInUse => io::Error::from(io::ErrorKind::AddrInUse),
AddrNotAvailable => {
io::Error::from(io::ErrorKind::AddrNotAvailable)
}
NotFound(msg) => io::Error::new(io::ErrorKind::NotFound, msg),
SocketLimit => {
... | Rust | 0 |
"""
这实际上是一个第三方库,并不是我们自己写的。
https://github.com/mherrmann/gitignore_parser
但由于报错。需要对文件进行更改。
"""
import collections
import os
import re
from os.path import abspath, dirname
from pathlib import Path
from typing import Reversible, Union
def handle_negation(file_path, rules: Reversible["IgnoreRule"]):
for rule in rev... | Python | 1 |
Return:
val: generated np.ndarray based on ratio of timestamp difference
'''
timestamp = [total_timestamp[idx] for idx in range(start_idx, end_idx + 1)]
timestamp_diff = np.diff(timestamp)
total_timestamp_diff = max(timestamp) - min(timestamp)
timestamp_diff_cumsum = np.cumsum(timestam... | Python | 1 |
"""Basic functionality tests that actually work."""
from unittest.mock import patch
from src.registry import register_all_tools
from src.server import mcp
from src.tools.get_all_pages import get_all_pages
class TestBasicFunctionality:
"""Basic tests that verify core functionality works."""
def test_import... | Python | 1 |
addr: Some(Subnet {
addr: IpAddress::Ipv6(Ipv6Address {
addr: [254, 128, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],
}),
prefix_len: 2,
}),
..Address::EMPTY
};
let ipv4_address = Address {
... | Rust | 0 |
[`write_with_zero`](crate::generic::Reg::write_with_zero), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [fc0_ref_khz](fc0_ref_khz) module"]
pub type FC0_REF_KHZ = crate::Reg<u32, _FC0_REF_KHZ>;
#[allow(missing_docs)... | Rust | 0 |
(
unsafe { &(*(::std::ptr::null::<uv_dir_s>())).nentries as *const _ as usize },
8usize,
concat!(
"Offset of field: ",
stringify!(uv_dir_s),
"::",
stringify!(nentries)
)
);
assert_eq!(
unsafe { &(*(::std::ptr::null::<uv_dir_... | Rust | 0 |
# Import QRCode from pyqrcode
import pyqrcode
from pyqrcode import QRCode
import png as png
# String which represents the QR code
s = input(" Enter the site you want to search >> ")
# Generate QR code
url = pyqrcode.create(s)
# Create and save the svg file naming "myqr.svg"
url.svg("myqr.svg", scale... | Python | 1 |
const NCALPHA_FG_RGB_MASK: u64 = crate::bindings::ffi::NC_FG_RGB_MASK;
// NcChannels
//
/// 64 bits containing a foreground and background [`NcChannel`]
///
/// At render time, both 24-bit [`NcRgb`] values are quantized down to terminal
/// capabilities, if necessary. There's a clear path to 10-bit support should
/// ... | Rust | 0 |
import paho.mqtt.client as mqtt
import psycopg2
import sqlite3
import json
import os
from dotenv import load_dotenv
load_dotenv()
#POSTGRES
POSTGRES_HOST = os.getenv('POSTGRES_HOST')
POSTGRES_PORT = os.getenv('POSTGRES_PORT')
POSTGRES_DATABASE = os.getenv('POSTGRES_DATABASE')
POSTGRES_USER = os.getenv('POSTGRES_USER')... | Python | 1 |
v::temp_dir();
tmp_dir.push("urandom");
let tmp_dir_str = tmp_dir.to_str().unwrap();
let tmp_dir_c_str = CString::new(tmp_dir_str).unwrap();
let ptr = tmp_dir_c_str.as_ptr() as *const i8;
let mut urandom_file = File::create(tmp_dir).unwrap();
// cr... | Rust | 0 |