text string | label_name string | labels int64 |
|---|---|---|
x) }
}
#[inline(always)]
pub fn asinh(x: f64) -> f64 {
unsafe { detail::asinh(x) }
}
#[inline(always)]
pub fn acosh(x: f64) -> f64 {
unsafe { detail::acosh(x) }
}
#[inline(always)]
pub fn atanh(x: f64) -> f64 {
unsafe { detail::atanh(x) }
}
#[inline(always)]
pub fn erf(x: f64) -> f64 {
unsafe { deta... | Rust | 0 |
//! [retdec.com](https://retdec.com) decompilation service through their public
//! [REST API](https://retdec.com/api/).
//!
//! You can either incorporate the library in your own tools:
//!
//! ```no_run
//! # use retdec::error::Result;
//! use retdec::{Decompiler, DecompilationArguments, File, Settings};
//!
//! # fn... | Rust | 0 |
gent_conf_extra, dic_traffic_env_conf_extra, dic_path_extra,
f'{template}-{road_net}', in_args.traffic_file.split(".")[0])
if in_args.multi_process:
i = 0
list_cur_p = []
for p in process_list:
if len(list_cur_p) < in_args.workers:
print(i... | Python | 1 |
r#"#[derive( Clone , Debug , Eq , PartialEq )] pub struct remote_nonnull_domain { pub name : remote_nonnull_string , pub uuid : remote_uuid , pub id : i32 , }"#,
r#"#[derive( Clone , Debug , Default, Eq , PartialEq )] pub struct remote_nonnull_domain { pub name : remote_nonnull_string , pub uuid : remote_uuid ,... | Rust | 0 |
UEUE}_{socks_task.socks_server_id}",
schedule_to_close_timeout=timedelta(hours=1),
)
result = socks_schemas.SocksTaskResult.model_validate(r)
await workflow.execute_activity(
activities.update_proxy_job_status,
schemas.ProxyJob(
id=str(socks_... | Python | 1 |
from .base_head import BaseHead
class MH110Head(BaseHead):
def set_pan(self, data, value): self.update_channel(data, 0, value)
def set_pan_fine(self, data, value): self.update_channel(data, 1, value)
def set_tilt(self, data, value): self.update_channel(data, 2, value)
def set_tilt_fine(self, data, valu... | Python | 1 |
ontrolFlow, DebruijnIndex, FnPointer, Interner, Visit, Visitor};
impl<I: Interner> Visit<I> for FnPointer<I> {
fn visit_with<'i, B>(
&self,
visitor: &mut dyn Visitor<'i, I, BreakTy = B>,
outer_binder: DebruijnIndex,
) -> ControlFlow<B>
where
I: 'i,
{
self.substit... | Rust | 0 |
Into<String>>(&mut self, directory: D) {
self.cwd = Some(directory.into());
}
}
impl Action for ExecAction {
fn execute<D: AsRef<Path>>(
&self,
archetect: &Archetect,
_archetype: &Archetype,
destination: D,
_rules_context: &mut RulesContext,
_answers: &L... | Rust | 0 |
2) -> i32 {
unsafe { abs(x) }
}
#[test]
fn test_get_abs() {
assert_eq!(get_abs(0), 0);
assert_eq!(get_abs(60), 60);
assert_eq!(get_abs(-60), 60);
}
}
use std::env;
use std::path::Path;
use git2::{ Repository, Status };
use colored::*;
pub fn vcs_status() -> Option<(colo... | Rust | 0 |
Required features: `\"Win32_Devices_ImageAcquisition\"`*"]
pub const WIA_PAGE_ISO_C0: u32 = 28u32;
#[doc = "*Required features: `\"Win32_Devices_ImageAcquisition\"`*"]
pub const WIA_PAGE_ISO_C1: u32 = 29u32;
#[doc = "*Required features: `\"Win32_Devices_ImageAcquisition\"`*"]
pub const WIA_PAGE_ISO_C10: u32 = 38u32;
#[... | Rust | 0 |
onal=1)
upper_sum = torch.cumsum(upper_sum, dim=1)
# 计算下三角部分和
lower_sum = torch.tril(R_expanded, diagonal=-1)
lower_sum = torch.flip(torch.cumsum(torch.flip(lower_sum, dims=[1]), dim=1), dims=[1])
# 两部分相加得到 Q 矩阵
Q_matrix = upper_sum + lower_sum
return Q_matrix
def select_indices(tensor1,... | Python | 1 |
:new();
let mut start = begin;
for i in begin .. end {
if input[i] == '\n' {
sources.push_str(" | ");
sources.push_str(&String::from_iter(&input[start .. i]));
sources.push('\n');
start = i + 1;
}
}
if start < end {
sources.push_st... | Rust | 0 |
l(level).finish();
set_global_default(collector).expect("Unable to set global default tracing collector.")
}
<reponame>u-03c9/sctp<gh_stars>0
use super::*;
use std::io;
use std::net::SocketAddr;
struct DumbConn;
#[async_trait]
impl Conn for DumbConn {
async fn connect(&self, _addr: SocketAddr) -> io::Result<... | Rust | 0 |
"""
3. Tasavvur qiling foydalanuvchi boshqa shahardan uchib kelmoq Lekin u shunday bir qiziq shartni aytadi:
- Men US davlatiga uchishim kerak. Meni har kuni soat 21:00da Zoomda meetingim bo'ladi.
Shunga menga shunday reys tanlab beringki, qo'nish vaqti meetingdan kamida 1 soat oldin bo'lsin.
Menga shu reyslarning ... | Python | 1 |
opt(self.fd.get_ref(), BT_SECURITY)?;
Security::try_from(bts)
}
/// Set socket security.
///
/// This corresponds to the `BT_SECURITY` socket option.
pub fn set_security(&self, security: Security) -> Result<()> {
let bts: bt_security = security.into();
setsockopt(self.fd.get... | Rust | 0 |
::super::super::device::*;
use super::super::super::super::linux_def::*;
use super::super::super::super::pagetable::*;
use super::super::super::super::qmsg::qcall::*;
use super::super::super::super::range::*;
use super::super::super::guestfdnotifier::*;
use super::super::super::kernel::async_wait::*;
use super::super::... | Rust | 0 |
utor.committed_block_id())
.expect("Failed to execute block!");
assert!(
output.has_reconfiguration(),
"Block execution is missing a reconfiguration!"
);
// Commit block
let ledger_info_with_sigs =
gen_ledger_info_with_sigs(block_id.into()... | Rust | 0 |
bits += (((i >> k * LOOKUP_BITS) & mask) as usize) << (LOOKUP_BITS + 2);
bits += (((j >> k * LOOKUP_BITS) & mask) as usize) << 2;
bits = LOOKUP_POS[bits] as usize;
n |= ((bits >> 2) as u64) << (k * 2 * LOOKUP_BITS);
bits &= SWAP_MASK | INVERT_MASK;
}
... | Rust | 0 |
in_state = None;
if let CoinState::InProgress(ref mut coin) = self.coin_state {
let res = coin.handle_message(msg.from(), *coin_msg.clone());
if let Ok(step) = res {
if let Some(coin) = step.output.into_iter().next() {
new_coin_stat... | Rust | 0 |
;
//return CashError::InvalidParameterCount(param_count, self.params.len())
// .boxed();
}
}
}
let value = self.node.eval(ctx)?;
if value.get_type_name() == "return" {
let value = value.downcast::<ReturnValue>().unwr... | Rust | 0 |
; n as usize]; m as usize];
for i in 1..dp.len() {
for j in 1..dp[0].len() {
dp[i][j] = dp[i - 1][j] + dp[i][j - 1];
}
}
dp[m as usize - 1][n as usize - 1]
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_62() {
assert_... | Rust | 0 |
unwrap()
};
let mut semaphore_type_info =
vk::SemaphoreTypeCreateInfo::builder().semaphore_type(vk::SemaphoreType::TIMELINE);
let semaphore_info = vk::SemaphoreCreateInfo::builder().push_next(&mut semaphore_type_info);
let semaphore = unsafe { device.create_semaphore(&semaphore_info, None).unwr... | Rust | 0 |
"""create_forge_api_key_provider_scope_association_table
Revision ID: 08cc005a4bc8
Revises: 6a92c2663fa5
Create Date: 2025-05-16 13:53:06.169215
"""
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision = "08cc005a4bc8"
down_revision = "6a92c2663fa5"
branch_labels = None
d... | Python | 1 |
tx.delay(seconds=3)
p1k_8.air_gap(10)
p1k_8.dispense(DMSO_VOL+10, end_loc.bottom(z=20))
p1k_8.blow_out()
p1k_8.return_tip()
hs.set_and_wait_for_shake_speed(rpm=2000)
ctx.delay(seconds=60)
hs.deactivate_shaker()
## transfer final product
hs.open_labware_latch()
ctx.... | Python | 1 |
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: sift/common/type/v1/channel_config.proto
# Protobuf Python Version: 5.26.1
"""Generated protocol buffer code."""
from google.protobuf import descriptor as _descriptor
from google.protobuf import descriptor_pool as _descriptor_p... | Python | 1 |
_state =
match node.handle_message(&Message::GetPerformanceState).await.unwrap() {
MessageReturn::GetPerformanceState(state) => state,
e => panic!("Unexpected return value: {:?}", e),
};
assert_eq!(commanded_perf_state, received_perf_state);
}
///... | Rust | 0 |
import json
import tensorflow as tf
from configs.hyperparameters import *
def parse_config(args, verbose=False):
# load basic configurations
config = eval(args.config)
# update configurations based on the command line arguments
if args.lr_scheduler is not None:
config["lr_scheduler"] = arg... | Python | 1 |
import sys
import traceback
from django.http import Http404
from django.views.debug import ExceptionReporter
from .utils import instantiate_error_log
class SaveLogsToDatabaseMiddleware:
def __init__(self, get_response):
self.get_response = get_response
self.error_log = None
def __call__(sel... | Python | 1 |
# -*- coding: utf-8 -*-
# Copyright (c) 2003 - 2010 Detlev Offenbach <detlev@die-offenbachs.de>
#
"""
Module implementing a dialog to enter the data for a switch operation.
"""
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from Ui_SvnSwitchDialog import Ui_SvnSwitchDialog
class SvnSwitchDialog(QDialog, Ui_S... | Python | 1 |
feature(test)]
extern crate blake2_rfc;
extern crate test;
use std::iter::repeat;
use std::vec::Vec;
use test::Bencher;
use blake2_rfc::blake2s::Blake2s;
use blake2_rfc::_selftest_seq as selftest_seq;
fn bench_blake2s(bytes: usize, b: &mut Bencher) {
let data: Vec<u8> = repeat(selftest_seq(1024))
.flat_... | Rust | 0 |
# Copyright 2009-2015 Eucalyptus Systems, Inc.
#
# Redistribution and use of this software in source and binary forms,
# with or without modification, are permitted provided that the following
# conditions are met:
#
# Redistributions of source code must retain the above copyright notice,
# this list of conditions ... | Python | 1 |
5764801, 11), 14897079);
}
}
<filename>tests/common.rs
use reqwest;
use std::sync::Once;
pub use reqwest::{Client, Error, Response, StatusCode};
pub const PORT: u16 = 2950;
pub const TLS_PORT: u16 = PORT + 1;
pub const ADDRESS: &str = "localhost";
pub fn server() {
static SERVER: Once = Once::new();
SERV... | Rust | 0 |
from policyengine_us.model_api import *
class slcsp_age_curve_amount_person(Variable):
value_type = float
entity = Person
label = (
"Second-lowest ACA silver-plan cost, for people in age curve states"
)
unit = USD
definition_period = MONTH
defined_for = "is_aca_ptc_eligible"
d... | Python | 1 |
4.95e-11,
146385.4375,
194289.25,
268365.6563,
342442.0625,
416518.4688,
490594.875,
522269.2188,
553943.5625,
585617.9063,
617292.25,
652557... | Python | 1 |
.push(SkillPlansResponsePlan {
source: plan,
levels,
ships: hulls,
});
}
Ok(SkillPlansResponse { plans: result })
}
lazy_static::lazy_static! {
static ref PLAN_DATA: SkillPlansResponse = build_data().unwrap();
}
#[get("/api/skills/plans")]
fn get_skill_plans(_a... | Rust | 0 |
bool {
let tree = self.open_tree(collection)?;
tree.contains_key(key)?
}
fn flush(&self) -> Box<dyn Future<Output = Result<usize, Error>> + Unpin> {
self.flush_async()
}
}
//! Module to process WordStar "overline" sequences (adding a bar above text)
// Note: utilises new "bool the... | Rust | 0 |
help("maximum proof depth to search")
.short("d")
.long("max_proof_depth")
.takes_value(true)
.default_value("8")
.required(true),
)
.arg(
Arg::with... | Rust | 0 |
#501 a 600
class pessoa:
def __init__(self,nome,idade,):
self.nome = nome
self.idade = idade
def apresentar(self):
print(f"Olá ,eu nome é {self.nome} e tenho {self.idade} anos.")
def fazer_aniversáio(self):
self.idade += 1
print(f"\n----Minha idade daqui 1 ano é ... | Python | 1 |
+ (pgrid / 1013.25 * mopt) - ((pgrid / 1013.25 * mopt) ** 1.01)))
TAUg = np.exp(-0.0127 * mopt ** 0.26)
k_aes = aesc2 * elvgrid + aesc1
k_aes[k_aes > 1.0] = 1.0 # Aerosol factor: cannot be > 1
TAUa = k_aes ** mopt
TAUaa = 1.0 - (1.0 - alphss) * (1 - pgrid / 1013.25 * mopt + (pgr... | Python | 1 |
# _*_ coding: utf-8 _*_
"""
Created by Allen7D on 2020/5/26.
"""
from app.models.article import Article
__author__ = 'Allen7D'
class ArticleDao():
# 查询文章
@staticmethod
def get_article(id):
article = Article.get_or_404(id=id, msg='该文章不存在')
article.update(views=article.views + 1)
... | Python | 1 |
syscalls.rs
// Copyright (c) 2021 Quark Container 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
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by app... | Rust | 0 |
00, 0x00, 0x08, 0x14, 0x77, 0x14, 0x94, 0x02, 0x04, 0x23, 0x52, 0x16, 0x38, 0x86,
0x13, 0x81, 0xFE, 0x64, 0xC7, 0x72, 0x43, 0x04, 0x08, 0x14, 0x77, 0x14, 0x94, 0x02, 0x04, 0x23,
0x52, 0x16, 0x38, 0x76, 0x43, 0x01, 0xFF, 0x46, 0xC7, 0x72, 0x43, 0x04, 0x08, 0x14, 0x77, 0x14,
0x94, 0x02, 0x04, 0x23, 0x52, 0x16... | Rust | 0 |
import numpy as np
import sys
import os
from ContactUtils import TopAccuracy
from ContactUtils import LoadContactMatrix
if __name__ == "__main__":
if len(sys.argv) != 4:
print 'python CalcContactPredAccuracy.py pred_matrix_file distcb_matrix_file target'
print ' Both matrix files are text format with L... | Python | 1 |
* │ GND
//! RESET │ * 15 16 * │ GND
//! J-Link RX │ * 17 18 * │ GND
//! 5V-Supply │ * 19 20 * │ GND
//! └───────────┘
//! ```
//!
//! # Reference
//!
//! Segger has released a PDF documenting the USB protocol: "Reference manual for J-Link USB
//! Protocol" (Document RM08001-R2).
//!
//! The archive.o... | Rust | 0 |
8(mut self, addr: u16, data: u8) {
self.ram[addr as usize] = data;
}
}
<filename>src/lib.rs
#[cfg(any(feature = "futures_io", feature = "tokio02_io", feature = "tokio_io"))]
pub use futures_x_io;
#[cfg(feature = "futures_io")]
#[path = "futures_io.rs"]
pub mod futures_io;
#[cfg(feature = "tokio02_io")]
#[... | Rust | 0 |
ipe_test() {
let params: CraftParams = CraftParams {
job_level: 90,
craftsmanship: 3216,
control: 3298,
cp: 548,
recipe_level: 570,
progress: 3700,
quality: 7400,
durability: 80,
};
let mut craft_s... | Rust | 0 |
xA7, 0x1F, 0x78, 0x89, 0x65, 0xBD, 0x44,
0x53, 0xF8, 0x60, 0x17, 0x8F, 0xC1, 0x91, 0x01,
]),
2 => Some([
0x88, 0xB2, 0xB2, 0x70, 0x6B, 0x10, 0x5E, 0x36,
0xB4, 0x46, 0xBB, 0x6D, 0x73, 0x1A, 0x1E, 0x88,
]),
3 => Some([
... | Rust | 0 |
п",
"Нау",
"Сәу",
"Мам",
"Мау",
"Шіл",
"Там",
"Қыр",
"Қаз",
"Қар",
"Жел",
]
day_names = [
"",
"Дүйсембі",
"Сейсенбі",
"Сәрсенбі",
"Бейсенбі",
"Жұма",
"Сенбі",
"Жексенб... | Python | 1 |
from django.conf import settings
from django.conf.urls import *
from pau.constants import USERNAME_RE, explore_slug_url_regex
user_patterns = patterns(
'',
# Because user detail has an optional trailing slash, it is below.
url(r'^post/(?P<post_id>\d+)$', 'pau.views.alpha.post_detail', name='post_detail_vi... | Python | 1 |
ageSubresourceLayers::builder()
.aspect_mask(vk::ImageAspectFlags::COLOR)
.mip_level(i)
.base_array_layer(0)
.layer_count(1)
.build();
let blit = [vk::ImageBlit::builder()
.src_offsets(src_offsets)
.src_subresource(src_subresource)
.dst_offsets(dst_o... | Rust | 0 |
0_ptr, temp0_minus_one
///
/// // Keep looping while temp0 is non-zero
/// temp0_eq_zero := eq temp0_minus_one, int 0
/// temp0_not_zero := not temp0_eq_zero
/// } while { temp0_not_zero }
/// }
///
/// // TODO: Use psi nodes to account for dif... | Rust | 0 |
strpool_str!("vrule"));
true
} else {
false
};
use crate::section_0063::print_esc;
use crate::section_0207::*;
use crate::section_0208::*;
use crate::section_0209::*;
use crate::section_0210::*;
processed
}}
<reponame>ktfleming/rhc<filename>src/environment.rs
use crate::k... | Rust | 0 |
ec())
}
});
let correct_bridge_lock_hash = test_params.bridge_lock_hash;
let correct_sudt_script = Script::new_builder()
.code_hash(packed::Byte32::from_slice(SUDT_CODE_HASH.as_ref()).unwrap())
.hash_type(SUDT_HASH_TYPE.into())
.args(Bytes::from(correct_bridge_lock_h... | Rust | 0 |
return Err(DnsParseError::InvalidLengthOctetInName);
}
}
Err(DnsParseError::UnexpectedEndOfData)
}
fn question_length(buf: &[u8]) -> Result<usize, DnsParseError> {
let name_len = try!(name_length(buf));
// skip QTYPE: u16 and QCLASS: u16
if buf.len() < name_len + 4 { return Err(DnsParseError::UnexpectedEndO... | Rust | 0 |
([0], frame_tag, [0])))
# start of each segment
seg_start = np.argwhere(seg_bound == 1)[:, 0]
# end of each segment
seg_end = np.argwhere(seg_bound == -1)[:, 0]
assert seg_start.shape[0] == seg_end.shape[0], \
"Fail to extract segment boundaries"
# le... | Python | 1 |
# raising an error is ok, num_from_2q_circuit does not support all 2-qubit gates
num_from_2q_circuit(qc)
# regression test for using the dense multiplication table
qc = QuantumCircuit(2)
qc.cz(1, 0)
num = num_from_2q_circuit(qc)
self.assertEqual(num, 368)... | Python | 1 |
tus calculations."""
# Test adequate coverage
coverage = NutrientCoverage(
nutrient_name="protein_g",
target_amount=100.0,
consumed_amount=90.0,
unit="g",
)
assert coverage.coverage_percent == 90.0
assert coverage.status == "adequa... | Python | 1 |
#[doc = " \\param [in] numBins The number of bins in the distribution."]
#[doc = " \\param [in] offset The start offset into the range value that marks the begining of the 1D Distribution."]
#[doc = " \\param [in] range The total number of the consecutive values of the distribution interval."]
#[doc = ... | Rust | 0 |
# Copyright (c) 2024 Intel Corporation
#
# 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 ... | Python | 1 |
borrow_raw_fd(fd),
slice::from_raw_parts(iov, iovcnt as usize),
)) {
Some(nwritten) => nwritten as isize,
None => -1,
}
}
#[inline(never)]
#[link_section = ".text.__mustang"]
#[no_mangle]
unsafe extern "C" fn read(fd: c_int, ptr: *mut c_void, len: usize) -> isize {
libc!(read(fd, pt... | Rust | 0 |
s(0, 5), Some(0));
assert_eq!(game.adjacent_mines(1, 5), Some(0));
assert_eq!(game.adjacent_mines(2, 5), Some(0));
assert_eq!(game.adjacent_mines(3, 5), Some(0));
assert_eq!(game.adjacent_mines(4, 5), Some(0));
// Check out of bounds access
assert_eq!(game.adjacent_mines... | Rust | 0 |
_segment(©, 96));
let y_c0 = FqRepr(copy_segment(©, 144));
Ok(G2Affine {
x: Fq2 {
c0: Fq::from_repr(x_c0).ok_or_else(|| {
GroupDecodingError::CoordinateDecodingError("x coordinate (c0)")
... | Rust | 0 |
from django.core.management.base import BaseCommand, CommandError
import yaml
from recipes.importers import RecipeImporter
from recipes.models import Recipe
from menus.models import Menu
class Command(BaseCommand):
help = "Display a shopping list for a menu. Provide a menu name or list the recipes"
def add_ar... | Python | 1 |
ss /docs for the API documentation."}
@app.post("/chat/")
async def chat(message: Message) -> dict[str, Any]:
"""
Process a chat message and return the response.
Args:
message: The user's message including text and metadata
Returns:
A dictionary containing the response sta... | Python | 1 |
output_projection, patch_projection,
patch_res, patch_res,
feathering=mask_blur,
mask=base_mask,
transform_matrix=rot_m
)
patch_mask = normalize_mask(patch_mask)
# patch_img: (1, P, P, C), patch_mask: (1, P, P)
# DEBUG: return patc... | Python | 1 |
exts["algorithm_setup"])
col3, col4 = st.columns(2)
with col3:
iterations = st.number_input(texts["iterations"], value=150, step=1)
pres_min = st.number_input(texts["prestressed_min"], value=None)
exc_min = st.number_input(texts["eccentricity_min"], value=None)
width_min = st.number_input(texts["width_... | Python | 1 |
attr) = x86_64_ty(rty, is_ret_bysret,
StructRetAttribute);
let sret = ret_attr.is_some();
if sret {
arg_tys = vec::append(~[ret_ty], arg_tys);
ret_ty = LLVMType {
cast: false,
ty: T_void()
};
a... | Rust | 0 |
ail;
use path_absolutize::*;
pub struct Cargo/*<'a>*/ {
path: String,
cfg: Option< Config >,
// ws: Option< Workspace<'a> >,
}
impl /*<'a>*/ Cargo/*<'a>*/ {
pub fn new( path: &str ) -> Self {
Self {
path: path.to_owned(),
cfg: None,
// ws: None,
}
}
pub fn open( &mut self ) -> anyhow::Result<()> {
... | Rust | 0 |
}
pub fn set_span(&mut self, span: Span) {
unsafe {
ident_set_span(self.0, span.0);
}
}
}
impl PartialEq for Ident {
fn eq(&self, other: &Ident) -> bool {
unsafe { ident_eq(self.0, other.0) }
}
}
impl<T> PartialEq<T> for Ident
where
T: ?Sized + AsRef<str>,
... | Rust | 0 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf
import tensorflow.contrib.slim as slim
from ray.rllib.models import Model
from ray.rllib.models.misc import normc_initializer
class MaskedActionsModel(Model):
"""Custom RLlib mode... | Python | 1 |
early
rng = check_random_state(0)
n_samples, n_features = (10, 8)
n_targets = 3
X = rng.randn(n_samples, n_features)
Y = rng.randn(n_samples, n_targets)
omp = OrthogonalMatchingPursuit(n_nonzero_coefs=n_features)
lstsq = LinearRegression()
omp.fit(X, Y)
lstsq.fit(X, Y)
assert_arr... | Python | 1 |
base = base.square();
} else {
expon = expon - Scalar::one();
res = res * base;
expon = expon.half();
base = base.square();
}
}
res
}
}
/// u64 * u64 = u128 inline func multiply helper
fn m(x: u64, y: u64) -... | Rust | 0 |
ac @ s d d l m Z m Z m Z m Z m Z d d l Td d l Z d d l Z d d l
Z d d l Z d d l j
Z
d d l Z d d l Z d d l Z d d l Z d d l Z d d l Z d d l Z e j a d Z d Z d Z d Z d Z d Z d S(
i ( t divisiont ab... | Python | 1 |
);
unwrap!(game_csv.zugeben(card_zugeben, epi)); // validated by analyze_sauspiel_html
}
rulestatecache.register_stich(stich, game_csv.rules.winner_index(stich));
debug_assert_eq!(
rulest... | Rust | 0 |
import torch
import torch.nn as nn
class NormalizeDB(nn.Module):
r"""Normalize the spectrogram with a minimum db value"""
def __init__(self, min_level_db, normalization):
super().__init__()
self.min_level_db = min_level_db
self.normalization = normalization
def forward(self, spec... | Python | 1 |
n required_snapshot_fields
if f not in availability_snapshot.columns
]
if missing_fields:
raise ValueError(
f"Availability snapshot for GW{target_gameweek} missing required fields: {missing_fields}. "
f"Data contract violati... | Python | 1 |
mmands.entity(entity).despawn_recursive();
player.entity = None;
}
}
}
if player.end.is_some() {
finished_count += 1;
}
}
if finished_count >= N_PLAYERS {
state.set(GameState::GameOver).ok();
}
}
fn despawn_level(mu... | Rust | 0 |
>legacy/cw3-dao/src/msg.rs
use crate::error::ContractError;
use crate::query::ThresholdResponse;
use crate::state::Config;
use cosmwasm_std::{CosmosMsg, Decimal, Empty, Uint128};
use cw20::{Cw20Coin, Cw20ReceiveMsg};
use cw20_base::msg::InstantiateMarketingInfo;
use cw3::Vote;
use cw_utils::{Duration, Expiration};
use ... | Rust | 0 |
filepath = "Difference between training data and model simulation (Velocity)"+ filePathSafe + ".png"
)
def plot_orbital_elements(t, training_data, model_data, plotInfo = None) -> None:
filePath = " (A:" + str(plotInfo[0]) + " I:" + str(plotInfo[1]) + " E:" + str(plotInfo[2]) + ") " + str(plotInfo... | Python | 1 |
"flac4" => Ok(TrackFileType::FLAC4),
"flac8" => Ok(TrackFileType::FLAC8),
"flac16" => Ok(TrackFileType::FLAC16),
"flac24" => Ok(TrackFileType::FLAC24),
"flac32" => Ok(TrackFileType::FLAC32),
"alac" => Ok(TrackFileType::ALAC),
"alac16" => Ok(TrackFi... | Rust | 0 |
)
}
// Param is passed by value, moved
pub fn set_amount(&mut self, v: u64) {
self.amount = ::std::option::Option::Some(v);
}
pub fn get_amount(&self) -> u64 {
self.amount.unwrap_or(0)
}
fn get_amount_for_reflect(&self) -> &::std::option::Option<u64> {
&self.amount... | Rust | 0 |
uperuser)
assert cruved_ds_filter(None, None, 3)
# Access to a dataset of its organism
assert cruved_ds_filter(datasets["associate_dataset"], users["self_user"], 2)
# Access to its own dataset
assert cruved_ds_filter(datasets["associate_dataset"], users["associate_user"], 1)
... | Python | 1 |
t ret = unsafe { sys::cv_cudacodec_EncoderParams_setPropNaluFramingType_int(self.as_raw_mut_EncoderParams(), val) };
ret
}
/// NVVE_DISABLE_SPS_PPS
#[inline]
fn set_disable_spspps(&mut self, val: i32) {
let ret = unsafe { sys::cv_cudacodec_EncoderParams_setPropDisableSPSPPS_int(self.as_raw_mut_EncoderParams()... | Rust | 0 |
nstall snapd.
self._run(["apt-get", "install", "snapd", "sudo", "--yes"])
self._run(["systemctl", "start", "snapd"], hide_output=True)
def _setup_snapcraft(self):
self._wait_for_network()
super()._setup_snapcraft()
def _ensure_container_running(self) -> None:
# Sanity c... | Python | 1 |
'''
Author : Thyssen Wen
Date : 2022-05-26 15:43:48
LastEditors : Thyssen Wen
LastEditTime : 2022-12-09 21:03:58
Description : feature dataset class
FilePath : /SVTAS/svtas/loader/dataset/item_base_dataset/feature_segmentation_dataset.py
'''
import copy
import os
import os.path as osp
import numpy ... | Python | 1 |
# Problem: Ways to Make a Fair Array - https://leetcode.com/problems/ways-to-make-a-fair-array/description/
class Solution:
def waysToMakeFair(self, nums: List[int]) -> int:
totalOdd, totalEven = 0, 0
for i in range(len(nums)):
if i % 2:
totalOdd += nums[i]
... | Python | 1 |
(x.into_bits(), c.into_bits()).into_bits()
}
}
FieldElement2625x4([
shuffle_lanes(self.0[0], control),
shuffle_lanes(self.0[1], control),
shuffle_lanes(self.0[2], control),
shuffle_lanes(self.0[3], control),
shuffle_lanes(self.0[4]... | Rust | 0 |
# Copyright 2024 The Orbit Authors. All Rights Reserved.
#
# 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 l... | Python | 1 |
**kwds):
"""
TESTS::
sage: from sage.features.latex import LaTeXPackage
sage: LaTeXPackage('graphics') is LaTeXPackage('graphics')
True
"""
return TeXFile.__classcall__(cls,
f'latex_package_{package_name}'.replace... | Python | 1 |
e, attempt=3, sleep=5):
''' Check if the ISSU state is in the expected state
Args:
device (`obj`): Device Object.
expected_state (`str`): Acceptable ISSU states are:
- active
- inactive
... | Python | 1 |
'''
Copyright (c) Microsoft. All rights reserved.
This code is licensed under the MIT License (MIT).
THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
Developed by Minigraph
... | Python | 1 |
govtsev_goltsev_mendes_graph(4)
H = nx.line_graph(G)
J = nx.inverse_line_graph(H)
assert nx.is_isomorphic(G, J)
def test_line_different_node_types(self):
G = nx.path_graph([1, 2, 3, "a", "b", "c"])
H = nx.line_graph(G)
J = nx.inverse_line_graph(H)
assert nx.i... | Python | 1 |
6, 6, 1, 2];
let hand = Dice::roll_fake(test_dice);
let scorecard = get_new_scorecard_data();
let score = (scorecard.get_line_by_id(L::ThreeKind).calc)(&hand, false);
assert_eq!(score, (6 * 3) + 1 + 2);
}
#[test]
fn test_3k_five_aces() {
let test_dice: Vec<DieFace>... | Rust | 0 |
LogLevel::from_str("D").unwrap(), LogLevel::Debug);
assert_eq!(LogLevel::from_str("I").unwrap(), LogLevel::Info);
assert_eq!(LogLevel::from_str("W").unwrap(), LogLevel::Warn);
assert_eq!(LogLevel::from_str("E").unwrap(), LogLevel::Error);
assert_eq!(LogLevel::from_str("A").unwrap(), LogL... | Rust | 0 |
o exit, "),
Span::styled("Enter", Style::default().add_modifier(Modifier::BOLD)),
Span::raw(" to send the message"),
]
};
let mut text = Text::from(Spans::from(msg));
text.patch_style(Style::default());
let help_message = Paragraph::new(text);
... | Rust | 0 |
umerate() {
let comma = i != xs.len() - 1;
json_to_lines_inner(Some(JVString::new(k)), x, indent + 2, out, comma);
}
push_line(None, LeafContent::ObjectEnd, indent, out, comma);
}
}
}
<filename>crates/pokedex-engine/src/gui/party/summary.rs
use core::{... | Rust | 0 |
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
self.as_any_object().fmt(f)
}
}
impl PartialEq for Encoding {
#[inline]
fn eq(&self, other: &Self) -> bool {
self._enc() == other._enc()
}
}
impl Eq for Encoding {}
impl TryFrom<&CStr> for Encoding {
type Error = EncodingL... | Rust | 0 |
ret
}
}
pub fn height(&self) -> usize {
self.stack.height()
}
}
#[derive(Debug)]
struct Branch {
cont_block: IrBlock,
ret: IrValue,
binds: HashMap<Ident, IrValue>,
}
/// Utility for performing a scope merge, as is
/// needed for case, if and receive branches.
/// This will ... | Rust | 0 |
state.exp_name,
dir=state.exp_dir,
storage_url=state.search_hp.storage,
seed=state.search_hp.seed,
)
infer_name = f"{state.exp_name}-best-infer"
infer_config = merge_configs(config, study.best_params)
infer_dir = None
if state.exp_dir is not None:
infer_dir = ... | Python | 1 |
dyn_call_dii.call(index, a1, a2).unwrap()
} else {
panic!("dyn_call_dii is set to None");
}
}
pub fn invoke_diiii(ctx: &mut Ctx, index: i32, a1: i32, a2: i32, a3: i32, a4: i32) -> f64 {
debug!("emscripten::invoke_diiii");
if let Some(dyn_call_diiii) = &get_emscripten_data(ctx).dyn_call_diiii... | Rust | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.