text string | label_name string | labels int64 |
|---|---|---|
_field) => {
self.gather_param_refs_in_expr(&switch_field.expr)?;
for case in switch_field.cases.iter() {
for case_expr in case.exprs.iter() {
self.gather_param_refs_in_expr(case_expr)?;
}
for case_field ... | Rust | 0 |
yu2vm=0.0, f_tcznbx8pj=False):
swcdtbgkjx3 = h2jtp4gjskf = a3xw_h8_n6c = yl5u7gntr50 = md4jcvptx1a = qy9399vmn3v = 0.0
lck8v4u6vb2 **= False
import aim1uf8so4v, cvgq8fbn_xz, ae_dcoxwnkf as c3ybupe5yw9, fiuwr9qzbk5, q_h2hejr7uc as mh4s0hz6nm8, wtt7bvnfo7i, zyi37q9r3my as agdsds1c7w2
'# documentation_cont... | Python | 1 |
use parity_scale_codec::Decode;
/// Maximum number of iterations for balancing that will be executed in the embedded OCW
/// miner of election provider multi phase.
pub const MINER_MAX_ITERATIONS: u32 = 10;
/// A source of random balance for NposSolver, which is meant to be run by the OCW election miner.
pub struct ... | Rust | 0 |
#!/usr/bin/env python3
"""
WhisperEngine Main Bot Module - Modular Architecture Implementation
Discord Bot with AI capabilities and personality if "Failed to initialize memory system" in error_msg:
logger.error("💡 Memory system initialization failed")
# Multi-entity handlers ... | Python | 1 |
etic and treats its input as a set. That means it is okay to transact the
// same [e a v] twice in one transaction. However, we don't want to represent the transacted
// Causet twice. Therefore, the transactor unifies repeated causets, and in addition we add
// indices to the search inputs and search res... | Rust | 0 |
ot")]
Snapshot,
#[serde(rename = "ecr")]
Ecr,
#[serde(rename = "key")]
Key,
#[serde(rename = "script")]
Script,
#[serde(rename = "user")]
User,
#[serde(rename = "group")]
Group,
#[serde(rename = "access-key")]
AccessKey,
#[serde(rename = "route53")]
Route53,
... | Rust | 0 |
close_prices = df['close'].values
trading_costs = 0.003 # 0.3%
profitable_buys = 0
profitable_sells = 0
total_buys = 0
total_sells = 0
total_profit_buys = 0.0
total_profit_sells = 0.0
for i, label in enumerate(lab... | Python | 1 |
properties=pika.BasicProperties(
delivery_mode=2,
),
)
logger.info(
f"任务 {task.task_id} 结果已发布到 {self.result_queue_name},状态: {task.status}"
)
def start_consuming(self) -> None:
"""开始消费消息"""
if not self.connection or self.co... | Python | 1 |
ia, assume como confirmado.
confirmado = True
if confirmado:
self.ui_queue.put({"type": "voice_status", "message": f"Comando '{transcribed_text}' confirmado!"})
if self.active_assistant in self.command_queues:
self.command_queues[self.acti... | Python | 1 |
er(console_handler)
# ===== 版本历史信息 =====
VERSION_HISTORY = [
{
"version": "1.0.0",
"date": "2024-04-25",
"features": [
"优化俄罗斯方块游戏性能",
"移除俄罗斯方块游戏音效功能",
"优化游戏界面响应速度",
"修复若干已知bug"
]
},
{
"version": "0.95",
"date": ... | Python | 1 |
es_after_first_response(
channel, args, child_target)
@enum.unique
class TestCase(enum.Enum):
CONNECTIVITY_WATCH = 'connectivity_watch'
CLOSE_CHANNEL_BEFORE_FORK = 'close_channel_before_fork'
ASYNC_UNARY_SAME_CHANNEL = 'async_unary_same_channel'
ASYNC_UNARY_NEW_CHANNEL = 'async_unary_new_chan... | Python | 1 |
ield the window's current framebuffer size.
///
/// The size is in physical pixels and is meant to be used directly in the
/// swapchain extent.
fn framebuffer_size(&self) -> (u32, u32);
/// Get the raw surface handle.
///
/// Unsafe because the the WindowSurface itself is responsible for t... | Rust | 0 |
def toNumberArray(arr):
# The function 'toNumberArray' accepts one argument 'arr', which is a list of numbers represented as strings.
# We will use a list comprehension to process each element in the list 'arr'.
# The list comprehension iterates over every string 'i' in the list 'arr'.
# For each s... | Python | 1 |
fn send(&self, team_id: &str, channel_id: &str, blocks: &[Block]) -> Result<Rep> {
send_base(&self.base_url,
self.tokens.get(team_id),
self.client,
Some(channel_id),
None,
blocks)
}
fn send_thread(&self, team_id: &str, thread_parent: &Id,... | Rust | 0 |
} else {
crate::compile_error!("{}", msg)
}
}
}
}
}
impl<T> CompileError<T> for Option<T> {
fn expect_compile_error(self, msg: &str) -> T {
match self {
Some(t) => t,
None => crate::compile_error!("{}", msg)
}... | Rust | 0 |
8]) -> std::io::Result<usize> {
self.out.write(buf)
}
fn flush(&mut self) -> std::io::Result<()> {
self.out.flush()
}
}
<reponame>3cL1p5e7/ic
use libsigsegv_sys::{
sigsegv_area_handler_t, sigsegv_dispatch, sigsegv_dispatcher, sigsegv_handler_t, sigsegv_init,
sigsegv_install_handler,... | Rust | 0 |
py_5: "py-5",
py_52: "py-52",
py_56: "py-56",
py_6: "py-6",
py_60: "py-60",
py_64: "py-64",
py_7: "py-7",
py_72: "py-72",
py_8: "py-8",
py_80: "py-80",
py_9: "py-9",
py_96: "py-96",
py_px: "py-px",
};
#[derive(Clone, Copy)]
pub(crate) struct Svg {
pub(crate) fill_a... | Rust | 0 |
}
} else {
Err(format!("Invalid hex encoded string - cannot convert {} to pb", kind).into())
}
} else if let Some(Value::Bytes(json)) = data {
let data = json.to_vec();
if (allow_empty && data.is_empty()) || data.len() == len_bytes {
Ok(data)
} e... | Rust | 0 |
import asyncio
import random
import sys
import edge_tts
from edge_tts import VoicesManager
from langdetect import DetectorFactory, detect
DetectorFactory.seed = 0
TEXT = sys.argv[1]
LANG = detect(TEXT) if sys.argv[2] == "Auto" else sys.argv[2]
RATE = sys.argv[3]
VOLUME = sys.argv[4]
GENDER = sys.argv[5] if len(sys.a... | Python | 1 |
5Cbf%7B%7Bm2%7D%7D) are feature two selected points on the model (or scene),
//!  is the difference vector,  and  {
let mut rng: StdRng = SeedableRng::from_seed([123u8; 32]);
let db_test_context = test_utils::SqlRecoveryDbTestContext::new(logger);
let db = db_test_context.get_db_instance();
let ingress_key = CompressedRistrettoPublic::from(RistrettoPublic::from_random(&mut... | Rust | 0 |
mut input)?;
let bot = player.opponent();
let mut setup = GameSetup::new();
choose_placements(&mut rng, &mut setup, player, &mut input)?;
choose_random_placements(&mut rng, &mut setup, bot);
let mut game = setup.start().map_err(|_| ()).unwrap();
while game.winner().is_none() {
if game.... | Rust | 0 |
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0
import os
from constructs import Construct
from cdktf import App, TerraformStack
from imports.ucloud.provider import UcloudProvider
from imports.ucloud.data_ucloud_images import DataUcloudImages
from imports.ucloud.instance import Instance
class MySt... | Python | 1 |
# -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# 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... | Python | 1 |
correctly. If any of these checks fail, the simulation will exit immediately.
//!
//! ## Future works
//!
//! Presently all the beacon nodes and validator clients all log to stdout. Additionally, the
//! simulation uses `println` to communicate some info. It might be nice if the nodes logged to
//! easy-to-find files a... | Rust | 0 |
import numpy as np
# causal mask buat bikin model cuma bisa lihat token sebelumnya
class CausalMask:
@staticmethod
def create_mask(seq_len):
# lower triangular matrix
# biar token cuma bisa attend ke posisi sebelumnya
mask = np.tril(np.ones((seq_len, seq_len)))
return mask
... | Python | 1 |
from odoo import models, fields
class ProductTemplateInherit(models.Model):
_inherit = 'product.template'
fragile = fields.Boolean(default=False)
| Python | 1 |
from modules.model.ChromaModel import ChromaModel
from modules.modelLoader.BaseModelLoader import BaseModelLoader
from modules.modelLoader.chroma.ChromaEmbeddingLoader import ChromaEmbeddingLoader
from modules.modelLoader.chroma.ChromaModelLoader import ChromaModelLoader
from modules.modelLoader.mixin.InternalModelLoad... | Python | 1 |
.map(|(_f, i)| train_ticket_dossier.own_ticket[*i])
.product::<u64>();
return product;
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_d16_p1_proper() {
let input = generate_input(&std::fs::read_to_string("./input/2020/day16.txt").unwrap());
let result = solve_... | Rust | 0 |
_BREAK {
self.num_breaks = 0;
Some((LBREAK_LEN, TimePeriod::Break))
} else {
Some((BREAK_LEN, TimePeriod::Break))
}
}
}
}
/// Play a sound signifiying the change in time period.
/// Code inspired by https://github.com/RustAudio/cpal/bl... | Rust | 0 |
d_calculation(self):
"""測試停損監控器的高級計算"""
monitor = StopLossMonitor(self.mock_broker)
stop_info = {
"strategy": StopLossStrategy.TRAILING,
"params": {
"breakeven_trigger_percent": 0.02,
"breakeven_buffer_percent": 0.005,
... | Python | 1 |
opulated item and no more pages
// the only case where an item's length may be smaller than chunk_size
debug_assert!(decoded.len() <= chunk_size);
MaybeNext::Some(Ok(decoded))
} else {
MaybeNext::None
}
}
}
}
#[inline]
... | Rust | 0 |
ddress
[0, 0, 0, 0, 0, 0xffff, g, h] => write!(
fmt,
"::ffff:{}.{}.{}.{}",
(g >> 8) as u8,
g as u8,
(h >> 8) as u8,
h as u8
),
_ => {
fn find_zero_slice(segments: &[u16; 8]... | Rust | 0 |
(1, 3, 6, 1, 4, 1, 7800, 1, 129)
)
_UHon1010_ObjectIdentity = ObjectIdentity
uHon1010 = _UHon1010_ObjectIdentity(
(1, 3, 6, 1, 4, 1, 7800, 1, 130)
)
_E6300_ObjectIdentity = ObjectIdentity
e6300 = _E6300_ObjectIdentity(
(1, 3, 6, 1, 4, 1, 7800, 1, 133)
)
_USafe4010_ObjectIdentity = ObjectIdentity
uSafe4010 ... | Python | 1 |
match db.get::<MaxColors>() {
Some(MaxColors(8)) => Colors::standard(),
Some(MaxColors(256)) => Colors::ansi256(),
_ => Colors::none(),
}
} else {
Colors::none()
}
}
#[cfg(windows)]
pub fn from_env() -> Sel... | Rust | 0 |
&self,
conn: &mut Self::Conn,
name: &str,
project_id: i64,
) -> Result<bool, LightSpeedError>;
async fn save(&self, conn: &mut Self::Conn, model: NewModel<SchemaData>) -> Result<SchemaModel, LightSpeedError>;
async fn update(&self, conn: &mut Self::Conn, model: SchemaModel... | Rust | 0 |
# Part of Odoo. See LICENSE file for full copyright and licensing details.
{
'name': 'Stock Transport',
'summary': 'Stock Transport: Dispatch Management System',
'description': 'Transport Management: organize packs in your fleet, or carriers.',
'version': '1.0',
'depends': ['stock_picking_batch', '... | Python | 1 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright (c) 2021, Cisco Systems
# GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt)
DOCUMENTATION = r"""
---
module: administered_identities_me_info
short_description: Information module for administered _identities _me
description... | Python | 1 |
0), early_side),
pow(1./3.,4)/4. * pow(1./4.,5)/5. * 1./5.);
assert_approx(rmesh3x4x5x6.intg_facerel_mon_on_oshape_side(x*x*x*y*y*y*y, OShape(0), late_side),
pow(1./3.,4)/4. * pow(1./4.,5)/5. * 1./5.);
}
/*
#[test]
fn test_intg_facerel_mon_x_facerel_poly_on_oshape_int() -> () {
let ... | Rust | 0 |
ref t1) => Fed1::T1(t1),
}
}
pub fn as_mut(&mut self) -> Fed1<&mut A> {
match self {
&mut Fed1::T1(ref mut t1) => Fed1::T1(t1),
}
}
pub fn into_tuple(self) -> (Option<A>,... | Rust | 0 |
from django.db import models
# Create your models here.
get_status = {
("Current"),
("Completed"),
("Canceled"),
("Expired")
}
class task(models.Model):
name = models.CharField(("Name"), max_length=50)
open_date = models.DateField(("Open date"), auto_now=False, auto_now_add=False, null=True)
... | Python | 1 |
ml_sidebars = {}
# Additional templates that should be rendered to pages, maps page names to
# template names.
#html_additional_pages = {}
# If false, no module index is generated.
#html_domain_indices = True
# If false, no index is generated.
#html_use_index = True
# If true, the index is split into individual pag... | Python | 1 |
ith_loc()
node_different_loc = copy.copy(node)
node_different_loc.loc = definitions.make_source_location()
assert node != node_different_loc
assert eve.concepts.eq_nonlocated(node, node_different_loc)
node_different_value_and_loc = copy.copy(node_different_loc)
node_dif... | Python | 1 |
Evaluate on test set using model with best validation score
info(f'Model {model_idx} best validation {args.metric} = {best_score:.6f} on epoch {best_epoch}')
model = load_checkpoint(os.path.join(save_dir, 'model.pt'), cuda=args.cuda, logger=logger)
test_preds = predict(
mod... | Python | 1 |
import csv
import os
from semantic_model import SemanticEmojiModel
from semantic_trainer import TRAINING_DATA
def load_interactive_dataset(filename='data/interactive_dataset.csv'):
"""load dataset from interactive training"""
dataset = []
if os.path.exists(filename):
with open(filename, 'r', encodi... | Python | 1 |
date_secret(secret)
if not encoding:
encoding = cls.default_encoding
return to_native_str(secret, encoding, "secret")
@classmethod
def verify(cls, secret, hash, encoding=None):
if not encoding:
encoding = cls.default_encoding
hash = to_native_str(hash, en... | Python | 1 |
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.chrome.service import Service
import argparse
... | Python | 1 |
elf.balances.get(address).cloned().unwrap_or_default(),
};
SystemResult::Ok(ContractResult::Ok(to_binary(&bank_res).unwrap()))
}
_ => SystemResult::Ok(ContractResult::Ok(Binary::from(vec![0u8]))),
}
}
}
<reponame>andrebeat/rust-presentation
pub enum Li... | Rust | 0 |
tType::KeyboardButton(Key::Space)) {
player.events.push(PlayerEvent::Jump);
}
if input.key_hold(&InputType::KeyboardButton(Key::E)) {
player.events.push(PlayerEvent::Shoot);
}
if input.key_pressed(&InputType::KeyboardButton(Key::Q)) {
player.events.push(PlayerEvent::Pick);
}
... | Rust | 0 |
import optuna
import argparse
from bnn.train_speech import main
def objective(trial):
"""Objective function for Optuna."""
# Hyperparameter search space
model = trial.suggest_categorical("model", ["bnn", "shallow_bnn"])
seed = trial.suggest_int("seed", 0, 1000)
lr = trial.suggest_float("lr", 1e-4,... | Python | 1 |
< 1:
raise ValueError("maximum number of updates must be strictly positive")
self.power = pwr
self.base_lr_orig = self.base_lr
self.max_update = max_update
self.final_lr = final_lr
self.max_steps = self.max_update - self.warmup_steps
def __call__(self, num_updat... | Python | 1 |
ush(s);
return id;
}
}
<filename>src/pokeapi/locations.rs
use serde::{Deserialize, Serialize};
use super::utility::*;
use crate::{impl_id_and_named, set_endpoint};
#[cfg_attr(debug_assertions, serde(deny_unknown_fields))]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, Hash)]
pub struct Lo... | Rust | 0 |
from fastapi import APIRouter, HTTPException, status, Depends
from project.schemas.user import UserSchema
from project.schemas.price import PriceSchema, PriceCreateUpdateSchema
from project.core.exceptions.price import PriceNotFound, PriceBadPrice, PriceBadForeignKey, PriceBadDate
from project.api.depends import datab... | Python | 1 |
UniformValue::Texture2d(tex, Some(tile)),
);
}
}
}
pub struct GfxCtx<'a> {
pub(crate) target: &'a mut glium::Frame,
program: &'a glium::Program,
uniforms: Uniforms<'a>,
params: glium::DrawParameters<'a>,
screencap_mode: bool,
pub(crate) naming_hint: Option<String>,
... | Rust | 0 |
s = input().split()
max_word = max(s, key=len)
print(len(max_word)) | Python | 1 |
);
}
#[test]
fn test_by_ref_parameter_const_is_ok_does_not_modify_const() {
let program = "
DECLARE SUB Hello(N)
CONST A = 42
Hello A%
PRINT A
SUB Hello(N)
PRINT N
N = N + 1
PRINT N
END SUB
";
let in... | Rust | 0 |
in this package is the same
version included in the `ggridges` R package [1]_. The dataset
contains weather information from Lincoln, Nebraska (2016).
The original data was taken from a blogpost by Austin Wehrwein
in 2017 [2]_.
.. collapse:: <i>Details...</i>
.. list-table::
:st... | Python | 1 |
link >= Address::new(4) {
self.cur.link - 4
} else {
self.cur.link
};
Some(BacktraceItem::Link(link))
};
// Advance the iterator.
self.cur = previous;
ret
}
}
fn stack_frame_record_iterator<'a>() -> Option<StackF... | Rust | 0 |
e.g. ["", "1", "2", "3", "4", "5", "6", "7", "8", "9", "R", "H", "E"]
pub fn create_header_vec(played: u8) -> Vec<String> {
let mut header_row: Vec<String> = (0..10).map(|i| i.to_string()).collect();
header_row[0] = "".to_string();
// Add any extra innings
for i in 10..played + 1 {
... | Rust | 0 |
with open('./input.txt', 'r') as f:
input = f.read()
lines = input.split('\n')
dices = {
2: 'd2',
3: 'd3',
4: 'd4',
6: 'd6',
8: 'd8',
10: 'd10',
20: 'd20'
}
dice_sides = [20,10,8,6,4,3,2]
def calculate_wanted_num(a, b):
offset = a - 1
wanted = b - offset
return wanted
def find_optimal(num):
... | Python | 1 |
(crate) fn span_lo_for_param(param: &ast::Param) -> BytePos {
if param.attrs.is_empty() {
if is_named_param(param) {
param.pat.span.lo()
} else {
param.ty.span.lo()
}
} else {
param.attrs[0].span.lo()
}
}
pub(crate) fn span_hi_for_param(context: &Rewr... | Rust | 0 |
# Copyright (c) 2023-2025 Carnegie Mellon University.
# NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE
# ENGINEERING INSTITUTE MATERIAL IS FURNISHED ON AN "AS-IS" BASIS.
# CARNEGIE MELLON UNIVERSITY MAKES NO WARRANTIES OF ANY KIND,
# EITHER EXPRESSED OR IMPLIED, AS TO ANY MATTER INCLUDING, BUT
# NOT LI... | Python | 1 |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | Python | 1 |
query = String::new();
print!("cqlsh> ");
} else {
query.push(' ');
print!(" ... ");
}
}
}
}
Ok(())
}
pub fn ajouter_a_la_liste_attente() {}
<gh_stars>0
#[doc = "Reader of register UART_... | Rust | 0 |
let tokens = self.tokens.clone();
let source_key = source_key.clone();
let future = self.request_token(&source_key).map(move |token| {
let token = Arc::new(token);
tokens.lock().put(source_key, token.clone());
token
});
Box::new(future)
}... | Rust | 0 |
the path to the matched type
if let Some(segments) = path_to_matched_type(cx, ty_path);
let segments: Vec<&str> = segments.iter().map(|sym| &**sym).collect();
if let Some(ty_did) = path_to_res(cx, &segments[..]).opt_def_id();
// Check if the matched type is a diagnostic i... | Rust | 0 |
import re
import warnings
from numba.core import typing, sigutils
from numba.pycc.compiler import ExportEntry
# Registry is okay to be a global because we are using pycc as a standalone
# commandline tool.
export_registry = []
def export(prototype):
warnings.warn("export() is deprecated, use the numba.pycc.CC A... | Python | 1 |
.iter()
.filter(|(_, item)| matches!(item.kind, mmd_map::ItemKind::Key(_)))
.for_each(|(_, item)| {
key_states.insert(item.kind.as_key().unwrap(), false);
});
let mut folds = vec![];
let mut unfolds = vec![];
mmd_map
.i... | Rust | 0 |
# Copyright 2016 Cloudbase Solutions Srl
# All Rights Reserved.
import sys
from oslo_concurrency import processutils
from oslo_config import cfg
from coriolis.conductor.rpc import server as rpc_server
from coriolis import constants
from coriolis import service
from coriolis import utils
conductor_opts = [
cfg.I... | Python | 1 |
}
Ok(Tag::Spilled(array))
}
}
}
pub mod tools;
#[cfg(test)]
mod tests {
use std::collections::HashSet;
use super::*;
#[test]
fn tag_test() {
let tag1 = Tag::One(3);
assert_eq!(tag1.len(), 1);
let tag2 = Tag::Two(3, 2);
assert_eq!(t... | Rust | 0 |
admin_keys: '[\"<KEY>'
peer_services: '[\"a000\"]'
persistence: Any
durability: NoDurability
routes: Any
circuit_management_type: gameroom
circuit_status: Active";
const PROPOSAL_STATE: &[u8] = b"---
proposals:
WBKLF-BBBBB:
proposal_ty... | Rust | 0 |
let user_input = get_input().trim().parse::<i8>().unwrap();
match user_input {
1 => user_add(con),
_ => return,
}
}
fn application() -> redis::RedisResult<()> {
let client = redis::Client::open("redis://127.0.0.1/")?;
let mut con = client.get_connection()?;
// let _ = redis_cli... | Rust | 0 |
created at: {}", gfa_file);
// Gets a value for config if supplied by user
let fasta_file = sub_m.value_of("fasta").unwrap();
info!("Path for reference FASTA: {}", fasta_file);
let reader = fasta::Reader::from_file(fasta_file).unwrap();
let mut seqs = Vec::new();
let mut seq_names = Vec::new... | Rust | 0 |
return Err(io::Error::new(
io::ErrorKind::Other,
format!("Spawn failed: {}", e),
))
}
});
}
let child = proc.spawn()?;
self.close_peer_fd().unwrap();
Ok(child.id())
... | Rust | 0 |
e_u64")]
dealer_hedging_buy: u64,
#[serde(deserialize_with = "parse_u64")]
dealer_hedging_sell: u64,
#[serde(deserialize_with = "parse_i64")]
dealer_difference: i64,
#[serde(deserialize_with = "parse_i64")]
total_difference: i64,
}
const TWSE_DATETIME_FORMAT: &'static str = "%Y%m%d";
fn pa... | Rust | 0 |
'normal' or 'special' !!!! ")
return proxies
def get_yy_mm_dd_hh(self, time_stamp):
time_stamp = pd.to_datetime(time_stamp)
print(time_stamp)
yy = str(time_stamp.year).zfill(4)
mm = str(time_stamp.month).zfill(2)
dd = str(time_stamp.day).zfill(2)
hh... | Python | 1 |
std_log_evalues = std_estimator.log_evalue(scores, SEQ_LENGTH, SEQ_LENGTH)
scaled_matrix = align.SubstitutionMatrix(
seq.ProteinSequence.alphabet,
seq.ProteinSequence.alphabet,
matrix.score_matrix() * SCALING_FACTOR,
)
scaled_gap_penalty = (
GAP_PENALTY[0] * SCALING_FACTOR,
... | Python | 1 |
output_dir=script_args.sudoku_output_dir,
board_size=script_args.sudoku_board_size
)
# Extract the three component reward functions
sudoku_format_reward_func, sudoku_given_numbers_reward_func, sudoku_rules_reward_func = reward_funcs_tuple
... | Python | 1 |
# If NWBWidgets is installed, create a custom widget for the TetrodeSeries
# neurodata type.
#
# You will also need to update the `vis_spec` dictionary in `__init__.py` so
# that nwbwidgets can find your custom visualizations.
#
# Example usage:
# from nwbwidgets import nwb2widget, load_extension_widgets_into_spec
# ... | Python | 1 |
(),
}
}
}<reponame>JojiiOfficial/igo-rs-fork<filename>src/tagger.rs
use std::io;
use std::path::Path;
use std::rc::Rc;
use log::debug;
use crate::dictionary::{self, Matrix, Unknown, ViterbiNode, WordDic};
use crate::morpheme::Morpheme;
use crate::{Utf16String, Utf16Str};
use crate::util::DirLike;
type ViterbiNode... | Rust | 0 |
_backends above, but those are all listed in _ufuncs.__all__,
# so there is no need to consider _support_alternative_backends.__all__ here.
__all__ = _ufuncs.__all__ + _basic.__all__ + _orthogonal.__all__ + _multiufuncs.__all__
__all__ += [
'SpecialFunctionWarning',
'SpecialFunctionError',
'logsumexp',
... | Python | 1 |
t expand $TARGET
# and $SOURCE later, when (and if) the Action is invoked to build
# the target(s). We do this with the subst=1 argument, which creates
# a DefaultEnvironmentCall instance that wraps up a normal default
# construction environment that performs variable substitution, not a
# proxy that doesn't.
#
# Ther... | Python | 1 |
resolution::ReachedFixedPoint,
BuiltinShadowMode, DefMap, ModuleData, ModuleOrigin, ResolveMode,
},
path::{ImportAlias, ModPath, PathKind},
per_ns::PerNs,
visibility::{RawVisibility, Visibility},
AdtId, AstId, AstIdWithPath, ConstLoc, EnumLoc, EnumVariantId, FunctionLoc, ImplLoc, Intern,
... | Rust | 0 |
"""
Saves each worker's model state dict directly to a checkpoint, which enables a
fast load path for large tensor-parallel models where each worker only needs to
read its own shard rather than the entire checkpoint.
Example usage:
python save_sharded_state.py \
--model /path/to/load \
--quantization deepspeedf... | Python | 1 |
n
return lap_edge_idx, lap_edge_weights, (v_plus_batch == 1)
def forward(self, data):
x, edge_index, batch = data.x, data.edge_index, data.batch
for i, layer in enumerate(self.layers):
# TODO should lap_edge_index[0] be equal to edge_idx?
lap_edge_idx, lap_edge_weig... | Python | 1 |
# Ghép số
'''Gần đây Anton tìm thấy một hộp có chữ số trong phòng của mình. Có k2 chữ số 2, k3 chữ số 3,
k5 chữ số 5 và k6 chữ số 6. Số nguyên yêu thích của Anton là 32 và 256. Anh quyết định soạn số
nguyên này từ các chữ số anh có. Anh ta muốn làm cho tổng của các số nguyên này càng lớn càng tốt.
Giúp anh ta giải qu... | Python | 1 |
}', SC_Upper), ('\u{2119}', '\u{211d}',
SC_Upper), ('\u{2124}', '\u{2124}', SC_Upper), ('\u{2126}', '\u{2126}', SC_Upper),
('\u{2128}', '\u{2128}', SC_Upper), ('\u{212a}', '\u{212d}', SC_Upper), ('\u{212f}',
'\u{212f}', SC_Lower), ('\u{2130}', '\u{2133}', SC_Upper), ('\u{2134}', '\u{2134}',
... | Rust | 0 |
class Solution:
# def nextPermutation(self, N, arr):
def get_next_number(self, nums, start_index):
i = len(nums)-1
while i > start_index:
if(nums[i] > nums[start_index]):
return i
i-=1
def reverse(self,nums,start_index):
i= start_index
... | Python | 1 |
ER_SORBIAN: WORD = 0x2e;
pub const LANG_URDU: WORD = 0x20;
pub const LANG_UZBEK: WORD = 0x43;
pub const LANG_VALENCIAN: WORD = 0x03;
pub const LANG_VIETNAMESE: WORD = 0x2a;
pub const LANG_WELSH: WORD = 0x52;
pub const LANG_WOLOF: WORD = 0x88;
pub const LANG_XHOSA: WORD = 0x34;
pub const LANG_YAKUT: WORD = 0x85;
pub con... | Rust | 0 |
letters = ["a", "b", "c"]
# Add
letters.append("d")
letters.insert(0, "-")
# Remove
# letters.pop()
# letters.pop(0)
# letters.remove("b") # first occurence of the letter b
# del letters[0:3]
letters.clear()
print(letters) | Python | 1 |
= polymer.chars().into_iter().enumerate()
.map(|(i, ch)| {
if ch == '\n' {
text_vec.remove(i);
} else {
if text_vec.len() > i+1 {
let current = text_vec[i];
let next = text_vec[i+1];
... | Rust | 0 |
if self.aborting_ss && !self.ss {
// `aborting_ss` makes no sense without `ss`
return Err("aborting-ss requires cfi-ss");
}
if self.accel_raise_pri && !self.ctx {
// `TCRaisePrivilege` is a Secure function, so each thread needs its own
// Secure stack
... | Rust | 0 |
unsafe { BUILD_SUCCESS = true }
return;
}
let mut cmd = Command::new(env!("CARGO"));
cmd.args(&["build", "--bin", "stored"]);
if env!("CARGO_BIN_EXE_stored").contains("release") {
cmd.arg("--release");
}
let output = cmd.output().expect("unable... | Rust | 0 |
import matplotlib.pyplot as plt
# Sample data
x = [1, 2, 3, 4, 5]
y1 = [2, 3, 5, 7, 11]
y2 = [1, 4, 6, 8, 10]
# Create a figure and a set of subplots (2 plots stacked)
fig, (ax1, ax2) = plt.subplots(2, 1, figsize=(5, 10))
# First subplot
ax1.scatter(x, y1, color='green', marker='o')
ax1.set_title('Scatter Plot 1')
a... | Python | 1 |
"""Module for integrating functions by the Midpoint rule."""
from math import *
import sys
def integrate(f, a, b, n):
"""Return the integral of f from a to b with n intervals."""
h = float(b-a)/n
s = 0
for i in range(1, n+1):
s += f(a + (i-0.5)*h)
return s*h
def verify():
"""Check that... | Python | 1 |
_all(&mut self)
{
self.gicc_pmr.w32(0xFF);
}
pub fn unmask_all(&mut self)
{
self.gicc_pmr.w32(0);
}
pub fn set_bpr(&mut self, val: u32)
{
self.gicc_bpr.w32(val);
}
}
impl GICHRegs
{
pub fn new() -> Self {
let mut retval: GICHRegs = GICHRegs ... | Rust | 0 |
quantized_input, quantize_bit, min, step, shape, dtype
)
p_base_dequantized = true_uniform_quantization_decompress(
p_base[0], 8, shape_p, min_p, scale_p, torch.float
)
q_base_dequantized = true_uniform_quantization_decompress(
q_base[0], 8, shape_q, min_q, scale_q, torch.float
)... | Python | 1 |
import cv2 as cv
# Setting confidence and non-maximum suppression thresholds
CONFIDENCE_THRESHOLD = 0.5
NMS_THRESHOLD = 0.5
# Colors for bounding boxes
COLORS = [(0, 255, 255), (255, 255, 0), (0, 255, 0), (255, 0, 0)]
PINK = (147, 20, 255)
# Font style for displaying text
fonts = cv.FONT_HERSHEY_COMPLEX
# Reading o... | Python | 1 |
repo = open_repository_from_id(req, id)?;
let content = repo.get_blob_content(&sha)
.map_err(error::server_error)?
.map(|content| base64::encode(&content))
.ok_or_else(|| error::not_found(""))?;
response::ok(json!({
"sha": sha,
"encoding": "base64",
"content": c... | Rust | 0 |
import torch
import torch.nn as nn
class MeanMLP(nn.Module):
def __init__(self,
input_dim: int,
n_genes: int,
means_ctrl: torch.tensor, # (n_genes,)
pred_mode: str = "delta",
hidden_dims: list[int] = [1024, 512, 256],
... | Python | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.