text string | label_name string | labels int64 |
|---|---|---|
_HEADER_SIZE + data_len..BLOB_SIZE {
w.data[i] = thread_rng().gen();
}
blobs.push(b_);
}
{
// Make some dummy slots
let slot_tick_heights: Vec<(&SharedBlob, u64)> =
blobs.iter().zip(vec![slot; blobs.len()]).collect();
... | Rust | 0 |
.get_unchecked_mut(index) })
}
}
}
impl<'a, A: 'a, N: ChunkLength<A> + 'a> SliceMut<'a, A, N> {
/// Downgrade this slice into a non-mutable slice.
#[inline]
#[must_use]
pub fn unmut(self) -> Slice<'a, A, N> {
Slice {
buffer: self.buffer,
range: self.range,
... | Rust | 0 |
import logging
import os
import subprocess
import sys
# Set up logging
logging.basicConfig(
level=logging.INFO, format="[%(asctime)s:%(levelname)s]: %(message)s"
)
def setup_environment():
logging.info("Setting up development environment...")
# Create virtual environment
subprocess.run([sys.executab... | Python | 1 |
# Copyright 2019 Omkar Prabhu
#
# 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 agreed to in writing,... | Python | 1 |
let mut s = df_b
.column("foo")
.unwrap()
.cast::<Utf8Type>()
.unwrap()
.utf8()
.unwrap()
+ df_b.column("bar").unwrap().utf8().unwrap();
s.rename("dummy");
let df_b = df_b.with_column(s).unwrap();
let j... | Rust | 0 |
|connector, mut core| {
let arango = ArangoSession::new(connector);
let database =
core.run(arango.create_database::<Empty>(NewDatabase::new(
"the_social_network",
vec![NewUser::with_name("an_user", "a_pass")],
))).unwrap()... | Rust | 0 |
ons_Y.append(emotion_label_softmax)
detected_cnt += 1
print("Saving final data to file")
# Save remaining data
save_preprocessed_data(
all_face_land_dists_depths_X,
all_face_images_X,
all_face_emotions_Y,
output_path=output_path,
save_name_suffix="_defau... | Python | 1 |
nt
"""
try:
logging.info(f"*** handling request to {action} postgres")
if action == 'create':
msg = create(owner)
operator_util.patch_operator_status(status,'postgres','on')
else:
msg = delete(owner)
operator_util... | Python | 1 |
_string(),
column_type: "int8",
default_value: None,
is_nullable: true,
is_foreign_key: true,
foreign_key_table: Some("company".to_string()),
... | Rust | 0 |
ge = []
nets = []
global current_generation
current_generation += 1
genome(genomes,config)
run = True
while run:
for event in pygame.event.get():
if event.type == pygame.QUIT:
pygame.quit()
sys.exit()
SCREEN.blit(TR... | Python | 1 |
# Copyright (C) 2022 Google Inc.
#
# 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 agreed to in writ... | Python | 1 |
.prim(name);
let mut writer = writer_from_schema(&schema, Codec::Null);
writer.serialize(1024).unwrap();
writer.flush().unwrap();
let buf = writer.into_inner().unwrap();
let reader_schema = MockSchema.prim(reader_schema);
let reader = Reader::with_schema(buf.as_slice(),... | Rust | 0 |
rng.gen_range(1, num_of_keys + 1) as u8;
MultiEd25519PrivateKey {
private_keys,
threshold,
}
}
}
impl TryFrom<&[u8]> for MultiEd25519PrivateKey {
type Error = CryptoMaterialError;
/// Deserialize an Ed25519PrivateKey. This method will also check for key and threshol... | Rust | 0 |
W_2
0x6D,// YMM0
0xC1, 0x11,// VEX_Vpaddq_ymm_ymm_ymmm256
0x00,// Invalid
0x00,// Invalid
// 213 = 0xD5
0x0B,// MandatoryPrefix2_4
0x00,// Invalid
0x0E,// VectorLength
0x29,// VHW_2
0x4D,// XMM0
0xC7, 0x11,// VEX_Vpmullw_xmm_xmm_xmmm128
0x29,// VHW_2
0x6D,// YMM0
0xC8, 0x11,// V... | Rust | 0 |
j = 2*i;
while j < n+1{
ret[j as usize]=false;
j +=i;
}
}
}
ret
}
fn main(){
let n : usize = 100009;
let board = prime_board(n as i64);
let mut total = 0;
let mut arr = vec![0 as i32;n/2];
// for i in 0..100 {
// ... | Rust | 0 |
class Arabic:
strings = {
"admin_only": "هذا الأمر للمسؤولين فقط.",
"invalid_command": "تنسيق الأمر غير صالح. استخدم /user [ID] أو /premium [ID].",
"user_not_found": "لم يتم العثور على المستخدم بالمعرف `{user_id}`.",
"user_added": "تم تسجيل المستخدم `{user_id}`.",
"user_remov... | Python | 1 |
(eobj)
return episodes
async def delete_episodic_memory(
self,
agent_id: str,
task_query: Optional[str] = None,
start_time: Optional[datetime] = None,
end_time: Optional[datetime] = None
) -> int:
loop = asyncio.get_event_loop()
return await loop... | Python | 1 |
_SXS_ASSEMBLY_NOT_FOUND = 0xc0150004
STATUS_SXS_MANIFEST_FORMAT_ERROR = 0xc0150005
STATUS_SXS_MANIFEST_PARSE_ERROR = 0xc0150006
STATUS_SXS_ACTIVATION_CONTEXT_DISABLED = 0xc0150007
STATUS_SXS_KEY_NOT_FOUND = 0xc0150008
STATUS_SXS_VERSION_CONFLICT = 0xc0150009
STATUS_SXS_WRONG_SECTION_TYPE = 0xc015000a
STATUS_SXS_THREAD_... | Python | 1 |
Create an array by two ways (array, NumPy) and multiply it by 2 and write the difference between the outputs.
import array as arr
import numpy as np
my_list = [7,7,7]
first_array = np.array(my_list)
second_array = arr.array('i',my_list)
print(first_array * 2)
print(second_array * 2)
#first array is a numpy array w... | Python | 1 |
2 => {
let x1 = read(src, 0);
let x2 = read(src, 1);
let y1 = read(charset, (x1 >> 2) as usize);
let y2 = read(charset, (((x1 << 6) >> 2) | (x2 >> 4)) as usize);
let y3 = read(charset, ((x2 << 4) >> 2) as usize);
write(dst, 0, y1);
... | Rust | 0 |
pub fn ragequit(origin, dao_account: T::AccountId, shares_to_burn: u128) -> DispatchResult {
let who = ensure_signed(origin)?;
ensure!(shares_to_burn > Zero::zero(), Error::<T>::BurnSharesShouldLargeThanZero);
ensure!(DAOs::<T>::contains_key(&dao_account), Error::<T>::DAONot... | Rust | 0 |
from .. import Provider as CompanyProvider
class Provider(CompanyProvider):
formats = (
"{{last_name}} {{company_suffix}}",
"{{last_name}}-{{last_name}}",
"{{last_name}}-{{last_name}} {{company_suffix}}",
"{{last_name}}, {{last_name}} και {{last_name}}",
)
company_suffixes ... | Python | 1 |
avg_train_loss,
"val_loss": avg_val_loss,
"lr": scheduler.get_last_lr()[0]
})
if avg_val_loss < best_val_loss:
best_val_loss = avg_val_loss
torch.save(model.state_dict(), os.path.join(output_dir, f"{output_prefix}_best.pt"))
torch.save(model.sta... | Python | 1 |
"""
Шаблон акта выполненных работ
"""
from openpyxl.worksheet.worksheet import Worksheet
from openpyxl.worksheet.page import PageMargins
from paymentmaker.core.models import ActData, CompanyDetails
from paymentmaker.templates.styles import DocumentStyles
class ActTemplate:
"""Шаблон для создания акта выполненны... | Python | 1 |
n::NewLine(token::test_helper::new_test_result_span(0, 1, "\n")))))]
#[test_case("\r"=> Ok((token::test_helper::new_test_result_span(1, 2, ""),ParsedToken::NewLine(token::test_helper::new_test_result_span(0, 1, "\r")))))]
#[test_case("\rhoge"=> Ok((token::test_helper::new_test_result_span(1, 2, "hoge"),ParsedTo... | Rust | 0 |
import streamlit as st
import pandas as pd
from pages.functions.model_train import get_data, stationary_check, get_rolling_mean, get_differencing_order, fit_model, evaluate_model, scaling, get_forecast, inverse_scaling
from pages.functions.plotly_figure import plotly_table, Moving_avarage_forecast
st.set_page_config(
... | Python | 1 |
import copy
import torch
from io import BytesIO
from openbabel import openbabel
from torch_geometric.utils import to_networkx
from torch_geometric.data import Data
from torch_scatter import scatter
from rdkit import Chem
from rdkit.Chem.rdchem import Mol, HybridizationType, BondType
from rdkit.Chem.rdchem import BondTy... | Python | 1 |
url = f"https://picsum.photos/{width}/{height}"
r = rq.get(url)
if self.name_entry.get() == "":
savename = "new" + self.formats_box.get()
else:
savename = self.name_entry.get() + self.formats_box.get()
with open(savename, "wb") as f:... | Python | 1 |
rror {
OutOfRange(u8),
}
impl Error for RollError {}
impl fmt::Display for RollError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match self {
RollError::OutOfRange(v) => write!(f, "val {:?} out of range", v),
}
}
}
#[derive(Serialize, Deserialize, PartialEq, Copy, ... | Rust | 0 |
M1 = scio.loadmat(filename)
# D1 = M1['E']
# NE[count,:,:] = D1[64:-64, 64:-64]
# GTB[count,:] = M1['labels']
#
# df[count, 0] = count
# df[count, 1] = i
# df[count, 2] = j
#
# count = count + 1
#
#NE = NE/np.max(NE)
#
#img_size = (Npix, Npix)
##img_size = resiz... | Python | 1 |
class Solution:
def minimumSteps(self, s: str) -> int:
rnd, ans = 0, 0
for i, c in enumerate(s):
if c == "0":
ans += (i - rnd)
rnd += 1
return ans
# Two Pointer
# l = 0
# ans = 0
# while s[l] == "0":
... | Python | 1 |
d is None else record.positive_prompts
neg = '' if record is None else record.negative_prompts
isCheckPoint = False
flname = os.path.basename(record.location)
if (record.model_type == ModelType.CHECKPOINT):
isCheckPoint = True
pos = flname
elif(recor... | Python | 1 |
import ipaddress
from django.core.exceptions import ValidationError
from django.utils.translation import gettext_lazy as _
MAX_IPV6_ADDRESS_LENGTH = 39
def _ipv6_address_from_str(ip_str, max_length=MAX_IPV6_ADDRESS_LENGTH):
if len(ip_str) > max_length:
raise ValueError(
f"Unable to convert {... | Python | 1 |
, yy, true);
diff += 1;
set = true;
new_boundary.push(PointI32 { x: xx, y: yy });
}
}
if !set {
new_boundary.push(*p);
}
}
self.boundary = new_boundary;
self.counter +=... | Rust | 0 |
"""
There are n different online courses numbered from 1 to n. You are given an array courses where courses[i] = [durationi, lastDayi] indicate that the ith course should be taken continuously for durationi days and must be finished before or on lastDayi.
You will start on the 1st day and you cannot take two or more c... | Python | 1 |
elf, mol=None):
self.with_df.reset(mol)
return mp2.MP2.reset(self, mol)
def loop_ao2mo(self, mo_coeff, nocc):
mo_coeff = cupy.asarray(mo_coeff, order='C')
Lov = None
with_df = self.with_df
mo_coeff = with_df.intopt.sort_orbitals(mo_coeff, axis=[0])
orbo = mo_... | Python | 1 |
| {
acc.push_str(&x.generate_code());
acc
})
}
}
#![doc = include_str!("../README.md")]
mod message_types;
mod serial_driver;
pub use message_types::*;
use serial_driver::{FramedDriver, FramedSerialDriver, LssCommand};
use std::str;
/// ID used to talk to all motors on a bus at on... | Rust | 0 |
Ok(if let Some(u) = args {
let mut cnst = true;
let mut vec = Vec::with_capacity(u.len());
let len = self.dummies.len();
for (e, (_, arg)) in u.zip(&*term.args) {
match *arg {
EType::Bound(_) => {
let a = e.as_atom().ok_or_else(||
... | Rust | 0 |
return False
self.users[username].sites = sites
logger.info(f"Updated user {username} site access")
return True
def has_permission(self, username: str, permission: Permission, site_id: str = None) -> bool:
"""Check if a user has a specific permission.
... | Python | 1 |
,
v_i64,
v_i32,
v_i16,
v_i8,
v_u128,
v_u64,
v_usize,
v_u32,
v_u66,
v_u8,
v_bool,
v_str,
..Obj::default()
}
}
}
proptest! {
#![proptes... | Rust | 0 |
moving_avg(model.module, we_model, args.mv_avg_decay)
elif args.we:
merge_we(model.module, we_model, we_n)
else:
wise_we(model.module, we_model, we_n, model_fix, args.we_wise_alpha)
elif args.dump and iteration % args.avg_freq == 0:
... | Python | 1 |
pass
elif type_ == "写入参数":
# 中键激活的内容
parameter_dic = get_parameters()
# 将命令写入数据库
func_info_dic = self.get_func_info()
self.writes_commands_to_the_database(
instruction_=func_info_dic.get("指令类型"),
repeat_numb... | Python | 1 |
closing the remaining window
c.close_window().await?;
c.windows().await.expect_err("Session should be closed.");
Ok(())
}
async fn close_window_twice_errors(mut c: Client) -> Result<(), error::CmdError> {
c.close_window().await?;
c.close_window()
.await
.expect_err("Should get a n... | Rust | 0 |
Ok(())
}
#[inline]
fn intents() -> GatewayIntents {
GatewayIntents::all()
& !GatewayIntents::GUILD_BANS
& !GatewayIntents::GUILD_EMOJIS
& !GatewayIntents::GUILD_INTEGRATIONS
& !GatewayIntents::GUILD_WEBHOOKS
& !GatewayIntents::GUILD_INVITES
& !GatewayIntents::G... | Rust | 0 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright (C) Saeed Rasooli <saeed.gnu@gmail.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
... | Python | 1 |
# -*- coding: utf-8 -*-
#
# test_poisson_ps_intervals.py
#
# This file is part of NEST.
#
# Copyright (C) 2004 The NEST Initiative
#
# NEST is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of t... | Python | 1 |
tempdir().unwrap();
let path = tempdir.path().join("abc").join("def").join("ghi");
std::fs::create_dir_all(path).unwrap();
let request = Request {
path: tempdir.path().to_path_buf(),
};
let mut session = session::test::Fake::new();
assert!(handle(&mut sessi... | Rust | 0 |
import re
pattern = "^a...s$"
test_string="abyss"
result=re.match(pattern,test_string)
if result:
print("success")
else:
print("no match") | Python | 1 |
.execute(
delete_query_cohort_people, {"team_id": team_id, "limit": batch_size, "person_ids": person_ids}
)
logger.info(f"Deleted {cursor.rowcount} cohort people")
cursor.execute(delete_query_person, {"team_id": team_id, "limit": batch_size, "person_ids": person_ids}... | Python | 1 |
1046 10.8953 21 11.9999 21H12.0954C12.5949 21 12.9999 20.595 12.9999 20.0955C12.9999 19.3812 13.2113 18.6828 13.6076 18.0885L16.9999 13V4M9.99991 14H11.9999M16.9999 4H18.9999C20.1045 4 20.9999 4.89543 20.9999 6V12C20.9999 13.1046 20.1045 14 18.9999 14H16.4999",
},
},
Shape::Thumb... | Rust | 0 |
n_value = [objective(d) for d in decoded] # for all the decoded values (corresponding to the bit strings of the agents), the fitness is being evaluated
for i in range(n_agents): # for all the agents
if float(fitness_function_value[i]) > float(best_obj): # if the value has been better than the best ev... | Python | 1 |
f, a: Mod_e521_1) -> Mod_e521_1 {
&self + &a
}
}
impl<'a> Add<&'a Mod_e521_1> for i32 {
type Output = Mod_e521_1;
fn add(self, a: &'a Mod_e521_1) -> Mod_e521_1 {
a.small_add(self)
}
}
impl<'a> Add<&'a Mod_e521_1> for i16 {
type Output = Mod_e521_1;
fn add(self, a: &'a Mod_e52... | Rust | 0 |
", thousands_separate(self.expansion_contention_events.load(Ordering::Relaxed))));
s
}
}
impl<Spec: MCTS> SearchTree<Spec> where Move<Spec>: Debug {
pub fn debug_moves(&self) {
let mut moves: Vec<MoveInfoHandle<Spec>> = self.root_node.moves().collect();
moves.sort_by_key(|x| -(x.visits(... | Rust | 0 |
pl MoveResource for FreezingBit {}
//! Mayastor grpc methods implementation.
//!
//! The Mayastor gRPC methods serve as a higher abstraction for provisioning
//! replicas and targets to be used with CSI.
//!
//! We want to keep the code here to a minimal, for example grpc/pool.rs
//! contains all the conversions and ma... | Rust | 0 |
()
metrics['actor_ent'] = dist.entropy().sum(dim=-1).mean().item()
return metrics
def update(self, replay_loader: ReplayBuffer, step: int) -> tp.Dict[str, float]:
metrics: tp.Dict[str, float] = {}
if step % self.cfg.update_every_steps != 0:
return metrics
... | Python | 1 |
z: self * rhs.z,
}
}
}
// Scalar division
impl std::ops::Div<f64> for Vec3 {
type Output = Vec3;
fn div(self, rhs: f64) -> Self::Output {
Vec3 {
x: self.x / rhs,
y: self.y / rhs,
z: self.z / rhs,
}
}
}
impl std::ops::DivAssign<f64> for Vec... | Rust | 0 |
0+-+-----+
# + | +
# + | +
# 6+-+-----+
# 8+-+-----+
x_edges = np.array([0, 2, 8])
y_edges = np.array([0, 6, 8])
relative_areas = np.array([
[3, 9],
[1, 3]])
# ensure the number of points in each region is propo... | Python | 1 |
ef glfwTerminate before returning. If it"]
#[doc = " succeeds, you should call @ref glfwTerminate before the application exits."]
#[doc = ""]
#[doc = " Additional calls to this function after successful initialization but before"]
#[doc = " termination will return `GLFW_TRUE` immediately."]
#[do... | Rust | 0 |
super::{SubmenuEntries, SubmenuSelection};
pub struct Submenu {
title: String,
subtitle: String,
event_emitter: EventEmitter<Self>,
entries: SubmenuEntries,
selection: Rc<RwLock<SubmenuSelection>>
}
impl Submenu {
pub fn new(title: String, subtitle: String, build_fn: impl Fn(&mut Su... | Rust | 0 |
"Arial", 8, "bold"))
label_formati.pack(side=LEFT, padx=(0, 2))
# Frame per i checkbox
frame_checkbox = Frame(frame_superiore, bg="#5a5e59")
frame_checkbox.pack(side=LEFT, fill=X)
# Creazione dei checkbox in modalità compatta
for formato in formati_var:
cb = Checkbutton(frame_checkbox, text=formato, variable=form... | Python | 1 |
Drop for Sem {
fn drop(&mut self) {
unsafe {
self.close();
}
}
}
unsafe impl Send for Sem {}
unsafe impl Sync for Sem {}
<gh_stars>0
// Copyright 2020-2021 <NAME>
// SPDX-License-Identifier: Apache-2.0
use futures::channel::oneshot;
use log::warn;
pub(crate) type ShutdownTx = one... | Rust | 0 |
o / np.max(np.abs(audio)) * 0.8
# 保存音频
audio_tensor = torch.from_numpy(audio.astype(np.float32)).unsqueeze(0)
torchaudio.save(file_path, audio_tensor, sample_rate)
logger.info(f"✅ 创建默认语音样本: {file_path}")
except Exception as e... | Python | 1 |
does not exist.", id)
}
SelfRecursiveAlias(id: Symbol) {
description("undefined type")
display("Tried to remove self recursive alias `{}`.", id)
}
}
}
#[derive(Debug, Default)]
pub struct AliasRemover {
reduced_aliases: Vec<Symbol>,
}
impl AliasRemover {
pub... | Rust | 0 |
_ => false,
}
}
}
//! Adaptively schedule blocking work
//!
//! The `adaptive` module defines types that help you schedule *blocking work* (namely, not
//! `async`) adaptively. If the work is cheap, we save on the overhead of things like
//! [`spawn_blocking`](tokio::task::spawn_blocking) by skipping ... | Rust | 0 |
# exp1/gpt-4o_1.py
# GPT-4o 1번 실험 실행 스크립트
import os
from dotenv import load_dotenv
from ..utils import run_experiment
from ..config import MODEL_CONFIGS
load_dotenv()
os.environ["OPENAI_API_KEY"] = os.getenv("OPENAI_API_KEY")
if __name__ == "__main__":
config = MODEL_CONFIGS["gpt-4o_1"]
input_file_path = con... | Python | 1 |
TableDeserializer<D> where D: Deserializer {
/// The deserializer used for entries in the table.
deserializer: D,
}
impl<'a, D> Deserializer for TableDeserializer<D> where D: Deserializer, D::Target: FormatInTable {
type Target = Table<D::Target>;
fn read<R: Read + Seek>(&self, inp: &mut R) -> Result<S... | Rust | 0 |
umerate(include_ids):
max_redundancy = 0.0
if redundancy.shape[0] > 0:
max_redundancy = redundancy[index].max()
candidate = _Candidate(
id=candidate_id,
similarity=similarity[index][0],
weighted_similarity=self.lambda_mu... | Python | 1 |
# -*- coding:utf-8 -*-
# Author: lishiyun19
# Mail: lishiyun19@163.com
# Created Time: Tue Sep 19 14:20:55 2017
import matplotlib.pyplot as plt
import numpy as np
def drawLine(thpList, cpuList):
# plot the origin line
x = range(0, len(thpList))
plt.plot(x, thpList, label='origin throughput', linewidth=2... | Python | 1 |
the tool
if callback:
# for the sake of seeing the progress bar do its thing,
# we take longer than we need to...
# ACK - for some bizarre reason this screws up the XP
# cleanup manager - clues welcome!!... | Python | 1 |
e), is_owned: true } }).into() };
local_ret
}
#[must_use]
extern "C" fn NetGraphMsgHandler_RoutingMessageHandler_handle_channel_announcement(this_arg: *const c_void, msg: &crate::lightning::ln::msgs::ChannelAnnouncement) -> crate::c_types::derived::CResult_boolLightningErrorZ {
let mut ret = <nativeNetGraphMsgHandler... | Rust | 0 |
.height),
Stretch::X { x_margin } => (screen_dim.width() - x_margin * 2.0, transform.height),
Stretch::Y { y_margin } => (transform.width, screen_dim.height() - y_margin * 2.0),
Stretch::XY { x_margin, y_margin } => (
screen_dim.width() - x_margin * 2.0,
... | Rust | 0 |
201020102010201, 0x7f047f047f047f04, ascii) {
Some(d) => d % 10 == 0,
None => false,
}
}
/// Validate a check digit using Luhn algorithm with input given as an array
///
/// Takes a slice of ASCII bytes and checks if the last byte is a valid Luhn checksum digit.
/// ... | Rust | 0 |
# BSD 3-Clause License; see https://github.com/scikit-hep/uproot5/blob/main/LICENSE
import os
import numpy as np
import pytest
import uproot
import uproot.writing
ROOT = pytest.importorskip("ROOT")
def test_deep_mkdir(tmp_path):
filename = os.path.join(tmp_path, "whatever.root")
with uproot.recreate(file... | Python | 1 |
?
mov %rax, $3; // save mulv_lo
mov %rdx, $2; // save mulv_hi (partial)
jz .no_hi${:uid};
mov $0, %rax; // prep for high multiply
mulq $8; add %rax, $2;
.align 16;
.no_hi${:uid}:
"
/* 0 1 ... | Rust | 0 |
r item in os.listdir(test_abnormal)]))
# test normal subjects
test_normal = os.path.join(root, "eval", "normal", channel_std)
test_n_sub = list(set([item.split("_")[0] for item in os.listdir(test_normal)]))
# create the train, val, test sample folder
if not os.path.exists(os.path.join(root, "proce... | Python | 1 |
} derived from the supplied private key using
/// derivation path from that input
PubkeyMismatch {
provided: PublicKey,
derived: PublicKey,
},
/// spent transaction does not match input prevout reference
#[from]
Match(InputMatchError),
/// unable to sign future witness vers... | Rust | 0 |
tal_share": float, # 总股本 (万股)
"float_share": float, # 流通股本 (万股)
"free_share": float, # 自由流通股本 (万)
"total_mv": float, # 总市值 (万元)
"circ_mv": float, # 流通市值(万元)
}
@pin_memory(is_obj=True, obj_fields=('stock_code', 'start_date', 'end_date',))
def get_dail... | Python | 1 |
import pprint
import re
from typing import List
from docutils import nodes
from docutils.nodes import Element, Node
from docutils.parsers.rst import directives
from sphinx.directives.code import LiteralIncludeReader, dedent_lines
from sphinx.util.docutils import SphinxDirective
class approved(nodes.General, nodes.Ele... | Python | 1 |
test!(fixed: Fixed(100); "hi" => "\x1B[38;5;100mhi\x1B[0m");
test!(fixed_on_purple: Fixed(100).on(Purple); "hi" => "\x1B[45;38;5;100mhi\x1B[0m");
test!(fixed_on_fixed: Fixed(100).on(Fixed(200)); "hi" => "\x1B[48;5;200;38;5;100mhi\x1B[0m... | Rust | 0 |
e if src.channel(c) == 0.0 {
0.0
} else {
1.0 - 1.0f32.min((1.0 - dst.channel(c)) / src.channel(c))
}
},
Self::HardLight => |c, dst, src| hard_light(dst.channel(c), src.channel(c)),
Self::SoftLight => |c, dst, sr... | Rust | 0 |
(
&mut self, lineSpacingMethod: *mut DWRITE_LINE_SPACING_METHOD, lineSpacing: *mut ::FLOAT,
baseline: *mut ::FLOAT
) -> ::HRESULT,
fn GetFontCollection(&mut self, fontCollection: *mut *mut IDWriteFontCollection) -> ::HRESULT,
fn GetFontFamilyNameLength(&mut self) -> ::UINT32,
fn GetFontF... | Rust | 0 |
("foo.rs"),
/// LineNum::from_iter([0..5, 10..20].iter().cloned())
/// );
///
/// // Filters the coverage information.
/// report.sections.filter_map(|(key, mut value)| {
/// filter.get(&key.source_file).and_then(|filter| {
/// filter.apply(&mut value);
/// if val... | Rust | 0 |
root.overrideredirect(True)
# root.geometry('0x0+0+0')
# root.deiconify()
# root.lift()
# root.focus_force()
# f = filedialog.asksaveasfile(initialfile='dataset',
# defaultextension=".txt",
# filetypes=... | Python | 1 |
{ self.muncher.peek_char() }
fn current_location(&mut self) -> Location { self.muncher.current_location() }
}
#[derive(Debug, Copy, Clone)]
enum StringQuotes { Single, Double }
#[derive(Debug, Copy, Clone)]
enum StringHereness { HereString, Normal }
fn can_start_word(c: char) -> bool { c == '_' || c.is_alph... | Rust | 0 |
_storage(&self, storage: &mut sp_runtime::Storage) -> Result<(), String> {
<Self as GenesisBuild<T>>::assimilate_storage(self, storage)
}
}
<gh_stars>0
#[cfg(feature = "techblox")]
use libfj::techblox;
#[cfg(feature = "techblox")]
use libfj::techblox::{SerializedEntityDescriptor, Parsable, blocks, EntityHea... | Rust | 0 |
views"].append(
{
"dimensions": {
"metric": "chick_culling_status",
"animal": EMPTY_DIMENSION_LABEL,
"per_capita": "False",
"estimate": EMPTY_DIMENSION_LABEL,
},
"indicators": {
"y": [
... | Python | 1 |
ect and error so that the action is not cached.
failed_write = (
_FILE_WRITE_FAILURE_MARKER in result.stdout
or _FILE_WRITE_FAILURE_MARKER in result.stderr
)
if failed_write:
print(
"Detected Swift compiler file write error but compiler exited ... | Python | 1 |
REGISTRY_CREDENTIALS"] = json.dumps(
{
"registry": f"http://{registry_host}",
"username": username,
"password": password,
}
)
r2d.start()
# CONTAINER_ENGINE_REGISTRY_CREDENTIALS unfortunately doesn't propagate to docker man... | Python | 1 |
class Node:
def __init__(self,value=None,kids=[]):
self.value = value
self.kids = kids
def rdfs(n, previsit, postvisit):
'''Recursive depth-first traversal'''
previsit(n)
for k in n.kids:
rdfs(k, previsit, postvisit)
postvisit(n)
def dfs(startnode, previsit, postvisit):
... | Python | 1 |
&'a Value,
instance_path: &InstancePath,
) -> ErrorIterator<'a> {
error(ValidationError::false_schema(
instance_path.into(),
instance,
))
}
}
impl ToString for FalseValidator {
fn to_string(&self) -> String {
"false".to_string()
}
}
<reponame>ket... | Rust | 0 |
_tata', line_id='line_toto', stop_id='stop_tutu')
with mock.patch('requests.get', mock_requests.get):
passages = synthese.next_passage_for_route_point(route_point)
assert len(passages) == 3
assert passages[0].datetime == datetime.datetime(2016, 3, 29, 13, 37, tzinfo=pytz.UTC)
asse... | Python | 1 |
}
}
<gh_stars>10-100
use futures::io::Cursor;
use serde::{Deserialize, Serialize};
use slimchain_common::error::{ensure, Error, Result};
use slimchain_utils::{
bytes::Bytes,
serde::{binary_decode, binary_encode},
};
use warp::{
http::{self, HeaderValue, Response, StatusCode},
hyper,
reject::Rej... | Rust | 0 |
_of_the_period(0, window));
assert_eq!(0, first_of_the_period(1, window));
assert_eq!(0, first_of_the_period(2014, window));
assert_eq!(2015, first_of_the_period(2015, window));
assert_eq!(2015, first_of_the_period(2016, window));
assert_eq!(8063, first_of_the_period(8063, window));
assert_eq!(8063, first_o... | Rust | 0 |
for the Decaf
/// compiler, which is available [here](https://github.com/hawkw/decaf/blob/master/src/main/scala/com/meteorcode/common/ForkTable.scala).
#[derive(Debug, Clone)]
pub struct ForkTable<'a, K, V>
where K: Eq + Hash
, K: 'a
, V: 'a
{
table: HashMap<K, V>
, whiteouts: HashSet<K>
, parent: Optio... | Rust | 0 |
for i in range(3):
print('d')
for j in range(3):
print('edge')
print(120) | Python | 1 |
(3, 1, 1) in stage 4.
stage_conv_a_kernel_sizes = (
(
(1, 1, 1),
(1, 1, 1),
((3, 1, 1),) * 6 + ((1, 1, 1),) * (23 - 6),
(3, 1, 1),
),
(
(3, 1, 1),
(3, 1, 1),
((3, 1, 1),) * 6 + ((1, 1, 1),) * (23 - 6),
... | Python | 1 |
"""HTML templates."""
html = """
<!doctype html>
<html lang='en'>
<head>
<meta charset='utf-8'>
<title>{name}</title>
<link rel=stylesheet href='../style.css'>
</head>
<body>
<div class=first>
<a href=#pg0>FIRST</a>
</div>
<div class=last>
<a href=#pg{last_page}>LAST</a>
</d... | Python | 1 |
elf_kcal = []
sum_kcal = []
with open("input.txt") as file:
for line in file:
try:
elf_kcal.append(int(line.rstrip()))
except(ValueError):
sum_kcal.append(sum(elf_kcal))
elf_kcal.clear()
continue
print(max(elf_kcal))
top_3 = sorted(sum_kcal)[-3:]
pr... | Python | 1 |
) as f:
args_dict = json.load(f)
args = SimpleNamespace(**args_dict)
args.exp_id = full_exp_id
else:
# create dir for saving
print('TEST HERE')
date = datetime.now().strftime('%Y-%m-%d')
if args.b_partition is None:
full_exp_id... | Python | 1 |
len = buf.len() as size_t;
let ret = unsafe {
((*self.raw).write)(self.raw, buf.as_ptr() as *const c_void, 1, in_len)
};
Ok(ret as usize)
}
fn flush(&mut self) -> io::Result<()> {
Ok(())
}
}
impl<'a> io::Seek for RWops<'a> {
fn seek(&mut self, pos: io::SeekF... | Rust | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.