text string | label_name string | labels int64 |
|---|---|---|
import librosa
import numpy as np
import pretty_midi
import mir_eval.melody
def get_highest_pitches_from_piano_roll(pr):
"""
params:
pr : (128, time(frame))
return:
highest_pitches : (time(frame), )
"""
highest_pitches = []
for i in range(pr.shape[1]):
ps = np.nonzero(... | Python | 1 |
linking directly between entries within the same DNA or in
* remote DNAs, as identities are treated as tuples of `(DnaHash, EntryHash)`.
*
* @see ../README.md
* @package HDK Graph Helpers
* @since 2019-05-16
*/
use hdk::prelude::*;
use crate::{
RevisionHash, DnaAddressable,
RecordAPIResult,
re... | Rust | 0 |
interval: Option<u16>,
pub is_admin: bool,
pub is_disabled: bool,
pub is_redeemed: bool,
}
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq)]
pub struct Peer {
pub id: i64,
#[serde(flatten)]
pub contents: PeerContents,
}
impl Deref for Peer {
type Target = PeerContents;
fn de... | Rust | 0 |
/// This has the nice benefit of getting our automatic rewind
/// capability from the point and the grammar logic can stay clean.
pub(crate) struct TokenPoint<'s, T: 's> {
pub offset: usize,
pub sub_offset: Option<u8>,
pub s: &'s [T],
}
impl<'s, T: 's> fmt::Debug for TokenPoint<'s, T> {
fn fmt(&self, f... | Rust | 0 |
await?;
let f = async move {
let sleep = rand::thread_rng().gen_range(0, 25);
time::sleep(Duration::from_millis(sleep)).await;
let (len, uri) = gen_uri(&authority);
let req = Request::get(&uri[..])
.header("Content-Length", len)
.... | Rust | 0 |
"""
@author: Khera
"""
import time
from binance.client import Client
import csv
import pandas as pd
import numpy as np
def emaPoints(data, dataPoints):
ema1 = []
for i in range(len(data)):
ema = 0
if i > 0:
prevEma = ema1[i-1]
multiplyer = 2/(dataPoints+1)
... | Python | 1 |
match &self {
ZcashPrivateKey::<N>::P2PKH(p2pkh) => write!(f, "{}", p2pkh.to_string()),
ZcashPrivateKey::<N>::Sprout(sprout) => write!(f, "{}", sprout.to_string()),
ZcashPrivateKey::<N>::Sapling(sapling) => write!(f, "{}", sapling.to_string()),
_ => write!(f, ""),
... | Rust | 0 |
_cmp!(Rev<T>; |a, b| b.0.partial_cmp(&a.0).unwrap(); where T: PartialOrd);
mod ids;
mod node;
mod state;
#[cfg(test)]
mod unit_tests;
use crate::{error::client::Result, ports::Client};
use async_std::task;
use futures::executor::block_on;
use ids::Ids;
use node::{Node, NodeId};
use state::State;
#[derive(Debug)]
pub ... | Rust | 0 |
# -*- coding: utf-8 -*-
from django.contrib import admin
from article.models import *
@admin.register(OwnerMessage)
class OwnerMessageAdmin(admin.ModelAdmin):
list_display = ('id', 'summary', 'created_at')
list_per_page = 10
class Media:
css = {
'all': ('/static/css/manager.css',)
... | Python | 1 |
pler", &glIsSampler_p, sampler);
#[cfg(all(debug_assertions, feature = "debug_automatic_glGetError"))]
{
global_automatic_glGetError("glIsSampler");
}
out
}
static glIsSampler_p: APcv = ap_null();
/// Tries to load [`glIsSampler`], returns if a non-null pointer was obtained.
#[doc(hidden)]... | Rust | 0 |
import networktables as networkTablesCore
import keyboard
import time
from threading import Timer
def main():
def release_key(key_name: str) -> None:
print(f"Sending: {key_name} -> {False}")
table.putBoolean(key_name, False)
def timed_keypress(key_name: str, press_time: float) -> None:
... | Python | 1 |
# Load modules
from __future__ import print_function
import os
import pandas as pd
import numpy as np
from matplotlib import pyplot as plt
# Change working Directory
os.chdir('C:/Users/pp9596/Documents/02 ZSP/00 PACKT/Book - Practical Time-Series Analysis/Avishek')
#Read dataset into a pandas.DataFrame
beer_df = pd.r... | Python | 1 |
from selenium.webdriver.common.by import By
# from utilities.selenium_utils import Utils
from selenium.webdriver.remote.webdriver import WebDriver
from base.base_driver import BaseDriver
from selenium.webdriver.remote.webelement import WebElement
class TmHomePage(BaseDriver):
def __init__(self, driver: WebDriver)... | Python | 1 |
###############################################################################
#
# Tests for XlsxWriter.
#
# SPDX-License-Identifier: BSD-2-Clause
#
# Copyright (c), 2013-2025, John McNamara, jmcnamara@cpan.org
#
from xlsxwriter.workbook import Workbook
from ..excel_comparison_test import ExcelComparisonTest
class... | Python | 1 |
;
Ok(address.required_signers())
}
/// Returns public key of current signer
pub fn public_key(&self, name: &str, root_hash: &H256, enckey: &SecKey) -> Result<PublicKey> {
let address = self.get_multi_sig_address_from_root_hash(name, root_hash, enckey)?;
Ok(address.self_public_key(... | Rust | 0 |
imal value
#[inline]
pub fn get_color(hex_value: i32) -> Color {
unsafe { ffi::GetColor(hex_value).into() }
}
/// Color fade-in or fade-out, alpha goes from 0.0f to 1.0f
#[inline]
pub fn fade(&self, alpha: f32) -> Color {
unsafe { ffi::Fade(self.into(), alpha).into() }
}
... | Rust | 0 |
import re
from collections import defaultdict
class Uniswap:
def __init__(self):
self.token_balances = defaultdict(lambda : 0)
def process(self, tx):
tx = tx.replace(';', '')
if 'adds' in tx:
self.add_liquidity(tx)
elif 'removes' in tx:
self.r... | Python | 1 |
self["title"] = _v
_v = arg.pop("uid", None)
_v = uid if uid is not None else _v
if _v is not None:
self["uid"] = _v
_v = arg.pop("uirevision", None)
_v = uirevision if uirevision is not None else _v
if _v is not None:
self["uirevision"] = _v
... | Python | 1 |
#[pallet::weight((<T as Config>::WeightInfo::get_price(), DispatchClass::Operational))]
pub fn get_price(origin: OriginFor<T>,currency_id1: CurrencyId, currency_id2: CurrencyId) -> DispatchResultWithPostInfo {
let price = <Self as PriceData<CurrencyId>>::get_price(currency_id1,currency_id2).ok_or(Error::<T>::Overf... | Rust | 0 |
) * (total_original_frames - total_processed_frames) if total_processed_frames > 0 and total_processed_frames < total_original_frames else 0
status_text.info(f"Procesando frame {total_processed_frames}/{total_original_frames}... ETA: {eta:.0f}s")
# --- Limpieza Final ---
cap.release(); tfil... | Python | 1 |
:IntTy::I64)
| (ty::IntTy::I128, chalk_ir::IntTy::I128)
),
(ty::Uint(ty1), Scalar(Uint(ty2))) => matches!(
(ty1, ty2),
(ty::UintTy::Usize, chalk_ir::UintTy::Usize)
| (ty::UintTy::U8, chalk_ir::UintTy:... | Rust | 0 |
start_height: u32) -> DBIterator {
// [height u32] -> [blockhash U256]
let key = big_endian_from_u32(start_height);
// include_start = true
self.block_index
.iterator(IteratorMode::From(&key, Direction::Forward))
}
pub fn read_tx(&self, hash: &U256) -> Result<Option... | Rust | 0 |
p.file_name()
.unwrap_or(OsStr::new(""))
.to_str()
.unwrap_or("")
)
}
use cargo_snippet::snippet;
#[snippet("Modulo")]
#[snippet("ncr")]
pub struct Modulo {
fact: Vec<usize>,
inv_fact: Vec<usize>,
modulo: usize
}
#[snippet("Modulo")]
#[snippet("ncr")]
impl Modulo {
pub fn new(n: ... | Rust | 0 |
#if self.prefix=='face':
# #print('fg-bg', self.stride, n_fg, num_bg)
# STAT[0]+=1
# STAT[self.stride][0] += config.TRAIN.RPN_BATCH_SIZE
# STAT[self.stride][1] += n_fg
# STAT[self.stride][2] += np.sum(fg_score[fg_inds]>=0)
# #_sta... | Python | 1 |
from ipaddress import ip_network
from ..schema import schema
from .base import OpenWrtConverter
class Rules(OpenWrtConverter):
netjson_key = "ip_rules"
intermediate_key = "network"
_uci_types = ["rule", "rule6"]
_schema = schema["properties"]["ip_rules"]["items"]
def to_intermediate_loop(self, b... | Python | 1 |
none().0)
}
}
#[cfg(any(feature = "v2_8", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2_8")))]
fn user_data(&self) -> Option<glib::Variant> {
unsafe {
from_glib_none(ffi::webkit_context_menu_get_user_data(self.as_ref().to_glib_none().0))
}
... | Rust | 0 |
# Copyright 2023 The Google Earth Engine Community Authors
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... | Python | 1 |
rgb, gt_images).mean().double()
psnr_test = psnr(rgb.squeeze(), gt_images.squeeze()).mean().double()
ssims_test = ssim(rgb, gt_images, size_average=True).mean().item()
lpips_vgg_test = self.lpips_func(rgb, gt_images).mean().item()
metric_dict = {"L1_loss": L1_loss,
... | Python | 1 |
;
use std::env;
extern crate muses_driver;
use std::io::stdin;
pub fn main() {
let args: Vec<String> = env::args().collect();
let mut opts = Options::new();
opts.optflag("", "sensel-only", "Only run sensel driver not full muses instrument");
opts.optflag("h", "help", "print this help menu");
le... | Rust | 0 |
bj = _parse_date(date_str).date()
days_ahead = (date_obj - today).days
return [
days_ahead,
date_obj.weekday(), # Segunda=0, Domingo=6
date_obj.month,
1 if _is_holiday(date_str) else 0
]
# Features para... | Python | 1 |
}
}
/// Change max size of payload. By default max size is 256Kb
pub fn limit(mut self, limit: usize) -> Self {
self.limit = limit;
self
}
}
impl<U> Future for XmlBody<U>
where
U: DeserializeOwned + 'static,
{
type Output = Result<U, XMLPayloadError>;
fn poll(mut ... | Rust | 0 |
, // Accept
0x00, // MBZ
0xbb, 0x80, // Port
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, // SID, 16 octet
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, // MBZ, 12 octets
0x00, 0x00, 0x00... | Rust | 0 |
_rules! bad_request_display {
($t: ty) => {
impl Reply for $t {
#[inline]
fn into_response(self) -> Response {
hyper::Response::builder()
.status(StatusCode::BAD_REQUEST)
.body(format!("{}", self).into())
.un... | Rust | 0 |
store.as_context_mut().0;
// Should be safe since `T` is connecting the linker and store
Some(unsafe { self._get(module, name)?.to_extern(store) })
}
fn _get(&self, module: &str, name: &str) -> Option<&Definition> {
let key = ImportKey {
module: *self.string2idx.get(module)... | Rust | 0 |
[u16; 16],
/// A pointer, pointing to the current position in the stack.
stack_pointer: u8,
/// A helper variable to properly implement the timer resolution.
cycles_since_timer_dec: u8,
/// A flag that indicates whether the output pins changed since it
/// was last set to false.
draw: bo... | Rust | 0 |
writeln!(out, "#version {}\n", options.version)?;
if es {
writeln!(out, "precision highp float;\n")?;
}
let mut counter = 0;
let mut names = FastHashMap::default();
let mut namer = |name: Option<&'a String>| {
if let Some(name) = name {
if !is_valid_ident(name) || ... | Rust | 0 |
# Python bytecode 2.7 (decompiled from Python 2.7)
# Embedded file name: scripts/client/gui/Scaleform/genConsts/STORE_CONSTANTS.py
class STORE_CONSTANTS(object):
SHOP = 'shop'
INVENTORY = 'inventory'
STORE_ACTIONS = 'storeActions'
STORE = 'store'
ACTION_EMPTY_LINKAGE = 'StoreActionsEmptyUI'
AC... | Python | 1 |
Parser<T: Clone> {
fn parse_endpoint(&self, input: String) -> T;
}
impl<T: Clone> EndpointSelector<T> {
pub fn new<P: EndpointParser<T>>(endpoints: Vec<String>, parser: P, strategy: Box<dyn EndpointStrategy<T> + Send + Sync>) -> Self {
EndpointSelector {
endpoints: endpoints
... | Rust | 0 |
import ctypes
import uuid
"""
le == little endian
"""
def _read8(mm, le=True):
x = mm.read(8)
if le:
n = x[0] | x[1] << 8 | x[2] << 16 | x[3] << 24 | x[4] << 32 | x[5] << 40 | x[6] << 48 | x[7] << 56
else:
n = x[7] | x[6] << 8 | x[5] << 16 | x[4] << 24 | x[3] << 32 | x[2] << 40 | x[1] << ... | Python | 1 |
s not elegant since it bloats the binary, but the fonts are
//! actually quite small (couple hundred K) and Rust-binaries are
//! already huge (> 50M at time of writing), so I'd say its a good
//! tradeoff for not having to deal with fonts missing and most
//! importantly, trying to figure out where the fuck the fonts ... | Rust | 0 |
#!/usr/bin/env python3
# coding=utf-8
import requests as r
from .yblogin import BASEURL
class feed:
def __init__(self, token):
self.token = token
'''
发起动态
'''
def add(self, content, privacy_level):
payload = {
'content': content,
'privacy': privacy_leve... | Python | 1 |
col_offsets = col_block_start + tl.arange(0, BLOCK_SIZE_COLS)
col_mask = col_offsets < num_cols
grad_to_add = tl.load(
grad_output_row_ptr + col_offsets,
mask=col_mask, other=0.0
)
tl.atomic_add(
grad_input_row_ptr + col_off... | Python | 1 |
the supplied record would cause the file to exceed
the size limit we have.
i s %s
i i N( R R R& |