text string | label_name string | labels int64 |
|---|---|---|
used_types=("ecog", "dbs", "seeg"),
target_keywords=("MOV_RIGHT",),
)
def test_reference_average_keyword(setup_databatch):
ch_names, ch_types, bads, data_batch = setup_databatch
channels = nm.utils.set_channels(
ch_names=ch_names,
ch_types=ch_types,
refer... | Python | 1 |
,
'Size': 127658,
'StorageClass': 'STANDARD'
},
{
'ETag': '"d41d8cd98f00b204e9800998ecf8427e"',
'Key': 'my_data/',
'LastModified': datetime.datetime(2017, 2, 7, 11, 11, 18),
'Owner': {
'DisplayName': 'amercad... | Python | 1 |
"""
Domain ports (interfaces) for adapters (Hexagonal Architecture)
"""
from abc import ABC, abstractmethod
from typing import Any, List
class StoragePort(ABC):
@abstractmethod
def read(self, *args, **kwargs) -> Any:
pass
@abstractmethod
def write(self, *args, **kwargs) -> None:
pass
... | Python | 1 |
Balance {
pub fn new(value: u64) -> Self {
Self { value }
}
pub fn type_(type_param: StructTag) -> StructTag {
StructTag {
address: SUI_FRAMEWORK_ADDRESS,
name: BALANCE_STRUCT_NAME.to_owned(),
module: BALANCE_MODULE_NAME.to_owned(),
type_para... | Rust | 0 |
and thumb is not None
and await aiopath.exists(thumb)
):
await aioremove(thumb)
except FloodWait as f:
LOGGER.warning(str(f))
await sleep(f.value)
except Exception as err:
if (
self.__thumb is None
... | Python | 1 |
# Copyright(C) 2013 Julien Veyssier
#
# This file is part of a woob module.
#
# This woob module 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
# (at your option) an... | Python | 1 |
def taxed_coin_exchange(coins, tax, total):
n = len(coins)
dp = [[0 for _ in range(total+1)] for _ in range(n+1)]
for i in range(total+1):
dp[0][i] = float('inf')
for i in range(1, n+1):
for j in range(1, total+1):
if j < coins[i-1] or (i > 1 and coins[i-1] < coins[i-2] and ... | Python | 1 |
tomicBool>,
wait_counter: Arc<AtomicU8>,
}
impl MyClientHelloHandler {
fn new(wait_counter: u8) -> Self {
MyClientHelloHandler {
done: Arc::new(AtomicBool::new(false)),
wait_counter: Arc::new(AtomicU8::new(wait_counter)),
}
}
}
#[cfg(any(test, all(s2n_quic_unstable,... | Rust | 0 |
)
return dtensor
else:
return value
def sharded_tensor_func(value: Any):
device = getattr(value, "device", None)
if device == torch.device("meta"):
raise RuntimeError(
f"Found unsupported type {type(value)} for meta device loading.... | Python | 1 |
from solution import *
import pytest
import numpy as np
def f(x, y):
return x + y
def test_runge_kutta_fehlberg_45():
y = runge_kutta_fehlberg_45(f, 0, 0, 0.1, 1)
expected_y = np.array([0.0, 0.1000000, 0.2050000, 0.3155000, 0.4322500, 0.5567850,
0.6893645, 0.8299954, 0.9787949,... | Python | 1 |
_ops_count_after_interval() {
let secs = 1_u64;
let mut pm = PerfMeter::new(secs);
while (Instant::now() - pm.start) < pm.interval {
pm.tick();
}
pm.tick();
assert_eq!(pm.ops_count, 0);
}
}
#![feature(rustc_private)]
extern crate rustc_driver;
extern crat... | Rust | 0 |
Quadrant::Three,
Quadrant::Zero,
Quadrant::Two,
];
assert_eq!(
expected_quadrants_xy,
index_full_depth_xy.cells().collect::<Vec<_>>()
);
assert_eq!(
expected_quadrants_yx,
index_full_depth_yx.cells().coll... | Rust | 0 |
# Usage: python script.py data/input.bin
import numpy as np
from datasets import load_dataset
from transformers import AutoTokenizer
# main function
if __name__ == "__main__":
print("Loading Huggingface Hellaswag dataset...")
dataset = load_dataset("Rowan/hellaswag")
print("Loading GPT-2 tokenizer...")
... | Python | 1 |
losses.SparseCategoricalCrossentropy(from_logits=True,
reduction='none')
encoder = Encoder(config.vocab_inp_size, config.embedding_dim, config.units, config.batch_size)
# sample input
sample_hidden = encoder.initialize_hidden_state()
... | Python | 1 |
pub mod v1 {
pub mod types {
tonic::include_proto!("containerd.v1.types");
}
}
pub mod services {
pub mod containers {
pub mod v1 {
tonic::include_proto!("containerd.services.containers.v1");
}
}
pub mod content {
... | Rust | 0 |
as usize;
let offset = ins[p];
if type2 && ins[pos as usize] >= 3 {
ins[p] -= 1;
} else {
ins[p] += 1;
}
pos += offset;
steps += 1;
}
steps
}
use crate::errors::ThearningResult;
use chrono::{Local, NaiveDateTime};
use diesel;
use diesel::pg::PgConnection;
use diesel::prelude::... | Rust | 0 |
class Solution:
def countPoints(self, rings: str) -> int:
rods = defaultdict(list)
for i in range(0,len(rings),2):
data = rings[i:i+2]
rods[data[1]].append(data[0])
return len([k for k,v in rods.items() if len(set(v)) == 3])
| Python | 1 |
mendarg.add_argument('-h2', '--ht_index_2', default="", metavar='\b',
help="A variable end anchor following anchor_end immediately in molecule, e.g. HT_index_2 or equivalent")
recommendarg.add_argument('-o', '--output_contig_file', default="anchor_guide_contig", required=False, metavar='\... | Python | 1 |
}
}
impl Formattable for u16 {
fn fmt_float(self) -> String {
self.fmt_signed()
}
}
impl Formattable for u32 {
fn fmt_float(self) -> String {
format!("{:.8}", f32::from_bits(self))
}
}
impl Formattable for u64 {
fn fmt_float(self) -> String {
format!("{:.16}", f64::from_bits... | Rust | 0 |
= Coin::decode(input)?;
let previous_block_time = Timespec::decode(input)?;
let unbonding_period = u32::decode(input)?;
Some(EnclaveRequest::VerifyTx {
tx,
inputs,
min_fee_computed: Fee::new(fee),
... | Rust | 0 |
The result is pushed onto the stack.
Optimizations:
* If 2nd operand is 0, do nothing
"""
op1, op2 = tuple(ins.quad[2:])
if is_int(op2):
output = _32bit_oper(op1)
if int(op2) == 0:
output.append('push de')
output.append('push hl')
ret... | Python | 1 |
T> {
/// Creates a new instance of the Iter.
pub fn new(token: &'a GhostToken<'brand>, list: &'a TripodList<'brand, T>) -> Self {
let head_tail = list.head_tail.as_ref().map(|head_tail| {
(&*head_tail.0, &*head_tail.1)
});
Self { token, head_tail, }
}
// Internal:... | Rust | 0 |
let device = context.get_default_device().await.context("Unable to get device instance")?;
let channel_infos = device
.get_supported_channels()
.await
.context("Unable to send get_supported_channels command")?;
println!("+-----------+------------+--------------+----... | Rust | 0 |
Map::new())
.await
}
/// This applies a command to an aggregate along with associated metadata. Executing a command
/// in this way to make any change to the state of an aggregate.
///
/// A `Hashmap<String,String>` is supplied with any contextual information that should be
/// asso... | Rust | 0 |
;
#[doc = "*Required features: `\"Win32_Graphics_OpenGL\"`*"]
pub const GL_DOUBLE_EXT: u32 = 5130u32;
#[doc = "*Required features: `\"Win32_Graphics_OpenGL\"`*"]
pub const GL_DRAW_BUFFER: u32 = 3073u32;
#[doc = "*Required features: `\"Win32_Graphics_OpenGL\"`*"]
pub const GL_DRAW_PIXEL_TOKEN: u32 = 1797u32;
#[doc = "*R... | Rust | 0 |
}
}
/// Masks gaps in frame-shifted regions of the peptide.
/// The frame-shifted region is likely misaligned, so the gaps added during peptide alignment don't make sense
/// and we cover them with `X`.
pub fn mask_peptide_frame_shifts_in_place(seq: &mut [Aa], frame_shifts: &[FrameShift]) {
for frame_shift in frame_... | Rust | 0 |
xp(i_t - m_t)
f = mx.exp(f_t + m_tm1 - m_t)
c_t = enlarge_as(f, c_tm1) * c_tm1 + enlarge_as(i, c_tm1) * mx.matmul(v[..., None], k[..., None, :])
n_t = enlarge_as(f, n_tm1) * n_tm1 + enlarge_as(i, k) * k
top = mx.matmul(c_t, q[..., None]).squeeze()
bot = clamp(n_t * q, min_value=... | Python | 1 |
aVar {
pub fn new(idx: usize) -> Self {
AlphaVar { idx }
}
pub fn idx(self) -> usize {
self.idx
}
}
impl<'cx> Hir<'cx> {
pub fn new(kind: HirKind<'cx>, span: Span) -> Self {
Hir {
kind: Box::new(kind),
span,
}
}
pub fn kind(&self) -> ... | Rust | 0 |
# 1456. 定长子串中元音的最大数目
# 给你字符串 s 和整数 k 。
# 请返回字符串 s 中长度为 k 的单个子字符串中可能包含的最大元音字母数。
# 英文中的 元音字母 为(a, e, i, o, u)。
# 示例 1:
# 输入:s = "abciiidef", k = 3
# 输出:3
# 解释:子字符串 "iii" 包含 3 个元音字母。
# 示例 2:
# 输入:s = "aeiou", k = 2
# 输出:2
# 解释:任意长度为 2 的子字符串都包含 2 个元音字母。
# 示例 3:
# 输入:s = "leetcode", k = 3
# 输出:2
# 解释:"lee"、"eet" 和 "ode" ... | Python | 1 |
in_core::global;
use crate::grin_keychain::BlindingFactor;
use crate::grin_keychain::ExtKeychain;
use crate::grin_util as util;
use crate::grin_util::secp::pedersen::{Commitment, RangeProof};
use crate::grin_util::secp::Signature;
use crate::grin_util::secp::{PublicKey, Secp256k1, SecretKey};
use crate::proof::p... | Rust | 0 |
_nil | ty_bot | ty_bool | ty_int(_) | ty_float(_) | ty_uint(_) |
ty_type | ty_ptr(_) => result = true,
// Boxed types
ty_box(_) | ty_uniq(_) | ty_fn(_) |
ty_estr(vstore_uniq) | ty_estr(vstore_box) |
ty_evec(_, vstore_uniq) | ty_evec(_, vstore_box) |
ty_trait(_, _, _) | ty_rptr(_,_) |... | Rust | 0 |
return
#There were not enough honest counterparties.
#Tumbler is aggressive in trying to complete; we tweak the schedule
#from this point in the mixdepth, then try again.
tumble_log.info("Transaction attempt failed, tweaking schedule"
... | Python | 1 |
Addr;
extern crate settings;
use settings::{NetworkSettings, RitaCommonSettings};
extern crate ipgen;
extern crate rand;
use rand::{thread_rng, Rng};
use std::str;
use failure::Error;
use althea_kernel_interface::KI;
extern crate althea_kernel_interface;
use regex::Regex;
use std::path::Path;
use std::sync::{Arc,... | Rust | 0 |
import cv2
img = cv2.imread("galaxy.jpg",0)
print(img.shape[0]/2)
print(img.shape[1]/2)
resized_img = cv2.resize(img,(int(img.shape[0]/2),img.shape[1]/2)))
cv2.imshow("galaxy", resized_img)
cv2.waitKey(0)
cv2.destroyAllWindows() | Python | 1 |
from unittest import mock
import pytest
from globus_sdk.transport import (
RequestCallerInfo,
RequestsTransport,
RetryCheckResult,
RetryCheckRunner,
RetryConfig,
RetryContext,
)
from globus_sdk.transport.default_retry_checks import (
DEFAULT_RETRY_CHECKS,
check_retry_after_header,
... | Python | 1 |
with open('./17_3_files/text.txt', encoding='utf-8') as i_file:
print(i_file.readline()[::-1])
| Python | 1 |
S) -> String {
path.as_ref().replace("\\", "/")
}
fn win32_path<S: AsRef<str>>(path: S) -> String {
path.as_ref().replace("/", "\\")
}
<gh_stars>0
// Copyright (c) 2022, Mysten Labs, Inc.
// SPDX-License-Identifier: Apache-2.0
use proc_macro::TokenStream;
use derive_syn_parse::Parse;
use itertools::Itertool... | Rust | 0 |
tatus(self, ApplyStatus):
self._ApplyStatus = ApplyStatus
@property
def ApplyMessage(self):
return self._ApplyMessage
@ApplyMessage.setter
def ApplyMessage(self, ApplyMessage):
self._ApplyMessage = ApplyMessage
@property
def FileUrlArray(self):
return self._Fil... | Python | 1 |
b use pstate::*;
pub use clock::*;
pub use thermal::*;
pub use gpu::*;
pub use info::*;
#[cfg(feature = "i2c")]
pub use i2c_impl::*;
pub use sys::{Status, Result};
<filename>src/y21/d07.rs<gh_stars>1-10
use crate::io::read_comma_separated_integers;
use itertools::{Itertools, MinMaxResult};
crate::test::test_part!(te... | Rust | 0 |
lude,
'frozen': frozen,
'metadata': metadata,
}
class _Definitions:
"""Keeps track of references and definitions."""
def __init__(self) -> None:
self.seen: set[str] = set()
self.definitions: dict[str, core_schema.CoreSchema] = {}
@contextmanager
def get_schema_or_... | Python | 1 |
p<(char, char), char>,
}
pub fn parse_input(input: &str) -> Instructions {
let mut iter = input.trim().lines().filter(|v| !v.is_empty()).map(String::from);
let template = iter.next().unwrap();
let insertions = iter
.map(|v| {
let mut parts = v.split(" -> ");
let mut key = parts.next().unwrap().chars();
... | Rust | 0 |
# How can we add the family pet, "Dino", to the following list?
flintstones = ["Fred", "Barney", "Wilma", "Betty", "Bambam", "Pebbles"]
flintstones.append("Dino")
print(flintstones)
| Python | 1 |
assert!(symbol.contains("/"));
assert_eq!(*symbol, symbol.to_uppercase());
}
}
#[test]
fn fetch_linear_swap_symbols() {
let symbols = fetch_symbols(EXCHANGE_NAME, MarketType::LinearSwap).unwrap();
assert!(!symbols.is_empty());
for symbol in symbols.iter() {
assert!(symbol.ends_wi... | Rust | 0 |
import pytest
from modules.common.database import Database
@pytest.mark.database
def test_database_connection():
db = Database()
db.test_connection()
@pytest.mark.database
def test_check_all_users():
db = Database()
users = db.get_all_users()
print(users)
@pytest.mark.database
def test_user_serg... | Python | 1 |
self.handler.span() =>
tail_rule!(#pat #handler)
}
}
fn gen(&self, err_name: &Ident) -> TokenStream {
let pat = Self::gen_pattern(&self.pattern, err_name);
let handler = &self.handler;
quote_spanned! { self.handler.span() =>
do_parse!(#pat #handler)
... | Rust | 0 |
# -*- coding: utf-8 -*- #
# Copyright 2023 Google LLC. 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 requir... | Python | 1 |
h e {
ParseError::RelativeUrlWithoutBase => {
let new_url = format!("https://{}", u);
match Url::parse(&new_url) {
Ok(p) => p,
Err(_) => return None,
}
}
_ => return None,
},
};
p... | Rust | 0 |
_
}
}
#[doc = "Reader of field `PWMX_EN`"]
pub type PWMX_EN_R = crate::R<u8, PWMX_EN_A>;
impl PWMX_EN_R {
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> crate::Variant<u8, PWMX_EN_A> {
use crate::Variant::*;
match self.bits {
0 => Val(PW... | Rust | 0 |
inner: secret_scalar,
}
}
}
impl<C> TryFrom<&[u8]> for SigningKey<C>
where
C: PrimeCurve + ProjectiveArithmetic,
Scalar<C>: Invert<Output = CtOption<Scalar<C>>> + Reduce<C::UInt> + SignPrimitive<C>,
SignatureSize<C>: ArrayLength<u8>,
{
type Error = Error;
fn try_from(bytes: &[u8... | Rust | 0 |
(mut entry) => {
BitXorAssign::bitxor_assign(entry.get_mut(), other_rb);
if entry.get().is_empty() {
entry.remove_entry();
}
}
}
}
}
}
impl BitXorAssign<&RoaringTreemap> for RoaringTreemap {
... | Rust | 0 |
};
result
}
impl DaemonRunner for Daemon {
fn run<F: 'static + FnOnce(Receiver<State>)>(&self, func: F) -> Result<(), Error> {
let (tx, rx) = channel();
tx.send(State::Start).unwrap();
let mut daemon = DaemonStatic {
holder: Box::new(DaemonFuncHolder {
tx: So... | Rust | 0 |
split70":
emb_train = torch.load('./checkpoints/CLEAN/70.pt', map_location=device)
elif train_data == "split100":
emb_train = torch.load('./checkpoints/CLEAN/100.pt', map_location=device)
else:
emb_train = model(esm_embedding(ec_id_dict_train, device, dtype))
emb_test = mode... | Python | 1 |
"""SCons.Tool.sgilink
Tool-specific initialization for the SGI MIPSPro linker on SGI.
There normally shouldn't be any need to import this module directly.
It will usually be imported through the generic SCons.Tool.Tool()
selection method.
"""
#
# __COPYRIGHT__
#
# Permission is hereby granted, free of charge, to an... | Python | 1 |
!("{}:{}: {:#?}", std::file!(), std::line!(), error);
}
let mut transport_responder = MaybeUninit::<NoiseTransportState>::zeroed();
let error = unsafe {
noise_ik_responder_respond(
NonNull::new_unchecked(ik_responder_next),
NonNull::new_unchecked(mess... | Rust | 0 |
from typing import Union
def examine_images_ollama(query: str, image_filepath: Union[str, list], **kwargs):
from agentmake.utils.images import is_valid_image_file, is_valid_image_url
from agentmake.utils.online import is_valid_url
from agentmake import OllamaAI
from ollama import Options
impor... | Python | 1 |
torch.save(Y, f'pretrained/OurGoogleDog28_trainset_duplicates_Y.pth')
# return
class Backbone(nn.Module):
def __init__(self, backbone):
super(Backbone, self).__init__()
self.backbone = backbone
def forward(self, x):
x = self.backbone.conv1(x)
x = self.backbone.bn1(x)
... | Python | 1 |
None => {}
Some(_) => {
panic!("I should not have found a drawn tile here!");
}
}
}
#[test]
fn tile_counting_with_kan() {
let mut hand = Hand::from_text("23m456s678p22z", true).unwrap();
let mut tile = Tile::from_id(1).unwrap();
... | Rust | 0 |
ights_vec_not_equal_size() {
new_test_ext().execute_with(|| {
assert_ok!(Subtensor::set_registeration_key(<<Test as Config>::Origin>::root(), 0));
let _neuron = register_ok_neuron(0, 0, 666, 77);
let weights_keys: Vec<u32> = vec![1, 2, 3, 4, 5, 6];
let weight_values: Vec<u32> = vec![1, 2, 3, 4, 5]; // Unev... | Rust | 0 |
#!/usr/bin/env python3
# MIT License
#
# Copyright (c) 2021 Eugenio Parodi <ceccopierangiolieugenio AT googlemail DOT com>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restricti... | Python | 1 |
{
use super::*;
#[test]
fn it_works() {
// Note: we should probably run this in a different process, since it
// loads a seccomp profile. However, since this is the only test in the
// repo at the moment, this should be OK for now.
unsafe {
let ctx = seccomp_ini... | Rust | 0 |
elif "llms" in path.lower() and path.endswith(".txt"):
# Get base domain name
display = domain
for tld in [".com", ".org", ".io", ".dev", ".net", ".ai", ".app"]:
if display.endswith(tld):
display = display[:... | Python | 1 |
c2<T>
where
T: Default,
{
fn default() -> Vec2<T> {
Vec2 {
x: T::default(),
y: T::default(),
}
}
}
impl<T> From<(T, T)> for Vec2<T> {
fn from(tuple: (T, T)) -> Vec2<T> {
Vec2 {
x: tuple.0,
y: tuple.1,
}
}
}
impl<T: Cop... | Rust | 0 |
of arguments of a function or task. This is
//! necessary since SystemVerilog allows for two distinct styles of declaring
//! the function arguments, which are similar to the ANSI and non-ANSI port list
//! styles for modules. Essentially, the arguments can be declared in the
//! function prototype directly, or as par... | Rust | 0 |
break;
// }
// }
// // println!("{:?}",buff);
// }
// }
// the stream is closed here
<gh_stars>0
use super::super::{
entity::{Tool, Warehouse},
use_case::{base::UseCase, create_tool},
};
use super::mock::{MockToolRepository, MockWarehouseRepository};
#[tokio::test]
async fn test... | Rust | 0 |
import numpy as np
from baselines.common.runners import AbstractEnvRunner
class Runner(AbstractEnvRunner):
def __init__(self, env, model, nsteps, nstack):
super().__init__(env=env, model=model, nsteps=nsteps)
self.nstack = nstack
nh, nw, nc = env.observation_space.shape
self.nc = n... | Python | 1 |
dar_path))):
if args.sim_num != -1 and idx >= args.sim_num:
break
pcd = o3d.io.read_point_cloud(os.path.join(lidar_path, pcd_file))
points = np.asarray(pcd.points)
points = points[points[:, 0] > 0]
points_h = np.vstack((points.T, np.ones(poin... | Python | 1 |
Some(output) = block_output.outputs.first() {
Ok(output.clone())
} else {
Err(Error::Node(api::Error::NotFound))
}
} else {
Err(Error::Node(api::Error::NotFound))
}
}
Err(e) => {
// if we got anything other than 200 back from server, don't attempt to refresh
// the wallet
// da... | Rust | 0 |
def __init__(self, base_lr=0.001, max_lr=0.006, step_size=2000.0, mode=
'triangular', gamma=1.0, scale_fn=None, scale_mode='cycle'):
super(CyclicLR, self).__init__()
if mode not in ['triangular', 'triangular2', 'exp_range']:
raise KeyError(
"mode must be one of 'triangular', 'triangular2... | Python | 1 |
<R:capnp::io::BufferedInputStream>(
inputStream : &mut R,
options : capnp::message::ReaderOptions) -> capnp::serialize::OwnedSpaceMessageReader {
capnp::serialize_packed::new_reader(inputStream, options).unwrap()
}
}
static SCRATCH_SIZE : uint = 128 * 1024;
pub struct NoScratch;
impl NoS... | Rust | 0 |
::chain::chain`.
#[macro_export]
#[cfg(feature = "nightly")]
macro_rules! chain_many {
($head:expr, $tail:expr) => {
$crate::unstable::chain($head, $tail)
};
($head:expr, $( $tail:expr ),+ $(,)?) => {
$crate::unstable::chain($head, $crate::chain_many!( $( $tail ),+ ))
};
}
/// Chains m... | Rust | 0 |
nch = int(cur_img.shape[0])
if nch == 1 or nch == 3:
img = image_from_nparray(
np.transpose(cur_img, (1, 2, 0)), caxis=caxis)
img_name = '%d_%s.png' % (bat_idx * n_batch_imgs + idx, key)
img.save(os.path.join(out_path, img_name))
... | Python | 1 |
turn (
self._start_time == other.start_time
and self._end_time == other.end_time
and self._word_index == other.word_index
and self._sentence_index == other.sentence_index
and self._text == other.text
)
def __ne__(self, other: object) -> bool:
... | Python | 1 |
nk,new_arivals,work_sheet):
for item in new_arivals:
title = item['title']
miles_age = item['mileage']
url = item['url']
price = item['price']
listing_id = item['listing_id']
self.discord_notify(title,miles_age,url,price)
work_s... | Python | 1 |
keeper: Keeper::phantom(PhantomData)};
aiocb
}
/// Constructs a new `AioCb`.
///
/// Unlike `from_mut_slice`, this method returns a structure suitable for
/// placement on the heap.
///
/// * `fd` File descriptor. Required for all aio functions.
//... | Rust | 0 |
ums[1])
} else if rule_nums.len() == 3 {
MessageRule::And3(rule_nums[0], rule_nums[1], rule_nums[2])
} else {
return Err(format!("Bad rule on line {}", i + 1));
}
}
6 => {
... | Rust | 0 |
e
assert msg.bit2_ready_for_shutdown is not None
assert msg.bit3_not_feasible is not None
assert msg.bit4_command_successfully_processed is not None
assert msg.bit5_command_received_toggle is not None
assert msg.bit6_warning is not None
assert msg.bit7_error is not None
... | Python | 1 |
=> false,
PER::ACTIVE => true,
}
}
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _from(value: bool) -> PER {
match value {
false => PER::INACTIVE,
true => PER::ACTIVE,
}
}
#[doc = "Checks if the value of the field is `INAC... | Rust | 0 |
`](::brotli2) based encoders.
#[cfg(feature = "brotli")]
#[cfg_attr(docsrs, doc(cfg(feature = "brotli")))]
pub mod brotli2 {
pub use brotli2::CompressParams;
}
mod unshared;
mod util;
pub mod le;
pub struct IconUnfoldLess {
props: crate::Props,
}
impl yew::Component for IconUnfoldLess {
type Properties = cra... | Rust | 0 |
for bit in 0..WORD_BITS {
if v == 0 {
break;
}
if v & 0x1 != 0 {
result.push(C::new(base * WORD_BITS + bit));
}
v >>= 1;
}
}
result
}
/// Add the bits from... | Rust | 0 |
SYS_REGLCTL register."]
pub struct POROFF_W<'a> {
w: &'a mut W,
}
impl<'a> POROFF_W<'a> {
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub unsafe fn bits(self, value: u16) -> &'a mut W {
self.w.bits = (self.w.bits & !0xffff) | (value as u32 & 0xffff);
self.w
}
}
impl R... | Rust | 0 |
def diHola(nombre,edad):
print("Hola,",nombre,"tienes",edad,"años y yo te saludo")
diHola("Jose Vicente",47)
diHola("Juan",48)
| Python | 1 |
t<DebugLines>,
) {
for path in query.iter() {
info!("path: {:?}", path);
for p in path.waypoints.windows(2) {
let start = waypoint_query.get(p[0]).unwrap();
let end = waypoint_query.get(p[1]).unwrap();
let offs = Vec3::new(0.0, 1.0, 0.0);
debug_draw_... | Rust | 0 |
Bme680Controller {
sensor,
calibration,
config,
delay,
ambient_temperature_provider,
profile_duration: config.profile_duration(),
}
.init()
}
/// Update the configuration of the controller.
pub fn update_configuration... | Rust | 0 |
s `NORMAL`"]
#[inline(always)]
pub fn is_normal(&self) -> bool {
*self == SOFT_RESET_A::NORMAL
}
#[doc = "Checks if the value of the field is `RESET`"]
#[inline(always)]
pub fn is_reset(&self) -> bool {
*self == SOFT_RESET_A::RESET
}
}
#[doc = "Field `soft_reset` writer - Sof... | Rust | 0 |
smithy_query::QueryWriter::new(
&mut out,
"DescribeReservedDBInstancesOfferings",
"2014-10-31",
);
#[allow(unused_mut)]
let mut scope_1151 = writer.prefix("ReservedDBInstancesOfferingId");
if let Some(var_1152) = &input.reserved_db_instances_offering_id {
scope_1151.strin... | Rust | 0 |
#!/usr/bin/env python
#
# MIT License
#
# Copyright The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to us... | Python | 1 |
tum_vec = mz_repr::DatumVec::new();
let mut sort_by = |left: &(_, Row), right: &(_, Row)| {
let left = &left.1;
let right = &right.1;
let left_datums = left_datum_vec.borrow_with(left);
let right_datums = right_datum_vec.borrow_with(right);
compare_columns(&order_by, &left_da... | Rust | 0 |
pub unsafe fn bits(self, value: u8) -> &'a mut W {
self.w.bits = value;
self.w
}
}
impl R {
#[doc = "Bits 0:7 - Priority of interrupt 187"]
#[inline(always)]
pub fn pri187(&self) -> PRI187_R {
PRI187_R::new(self.bits)
}
}
impl W {
#[doc = "Bits 0:7 - Priority of inte... | Rust | 0 |
): Frames to be downsampled, with shape (b, t, c, h, w).
kernel_size (int): Kernel size. Default: 13.
scale (int): Downsampling factor. Supported scale: (2, 3, 4).
Default: 4.
Returns:
Tensor: DUF downsampled frames.
"""
assert scale in (2, 3,
4), f'... | Python | 1 |
self.swap(context)
}
}
define_node_command!(SetNameCommand("Set Name", String) where fn swap(self, node) {
get_set_swap!(self, node, name_owned, set_name);
});
define_node_command!(SetTagCommand("Set Tag", String) where fn swap(self, node) {
get_set_swap!(self, node, tag_owned, set_tag);
});
define_node_... | Rust | 0 |
)> {
let touch_file = self
.get_touch_file()
.ok_or_else(|| anyhow!("Could not find touch file"))?;
if !touch_file.exists() {
return Err(anyhow!("Touch file does not exist"));
}
let contents = std::fs::read_to_string(&touch_file)
.with_cont... | Rust | 0 |
TMP1,
};
use crate::gc::Address;
use crate::masm::{MacroAssembler, Mem};
use crate::mem;
use crate::object::Obj;
use crate::os;
use crate::stack::DoraToNativeInfo;
use crate::threads::ThreadLocalData;
use crate::ty::{MachineMode, SourceType, SourceTypeArray};
use crate::vm::{
find_trait_impl, get_vm, AnalysisData, ... | Rust | 0 |
def __getattr__(attr_name):
from numpy._core import numeric
from ._utils import _raise_warning
sentinel = object()
ret = getattr(numeric, attr_name, sentinel)
if ret is sentinel:
raise AttributeError(
f"module 'numpy.core.numeric' has no attribute {attr_name}")
_raise_warnin... | Python | 1 |
);
assert!(!i.is_empty());
}
#[test]
fn upper_bounded_set() {
let s = (..2).union(3..4).union(5..);
let s2 = (..6).union(7..8);
let i = s.intersection(s2);
assert!(i.contains(0));
assert!(i.contains(1));
assert!(!i.contains(2));
assert!(i.contains(3));
assert!(!i.contains(4));
a... | Rust | 0 |
let res = execute(deps.as_mut(), env, info, msg).unwrap_err();
assert_eq!(res, StdError::generic_err("Send UST more than zero."));
let msg = ExecuteMsg::AutoStake {
token_amount: Uint128::from(1u64),
slippage_tolerance: None,
};
// check, ust+token -> LP -> staking.
let env = m... | Rust | 0 |
cts(workspace)
if not projects_meta:
print("❌ Error: No projects found in workspace.")
return 1
# Normalize project name across possible keys
for p in projects_meta:
p_name = p.get("projectName") or p.get("name")
if p_na... | Python | 1 |
strip_utf_bom(self) -> None:
"""Strip the UTF bom from the lines of the file."""
if not self.lines:
# If we have nothing to analyze quit early
return
# If the first byte of the file is a UTF-8 BOM, strip it
if self.lines[0][:1] == "\uFEFF":
self.line... | Python | 1 |
use failure::Fail;
#[test]
fn arm_sample_faulty() {
let xml = include_str!(concat!(
env!("CARGO_MANIFEST_DIR"),
"/tests/ARM_Sample_faulty.svd"
));
if let Err(e) = svd::parse(xml) {
for e in e.causes() {
println!("{}", e);
}
} else {
panic!()
}
}
<... | Rust | 0 |
]);
}
#[test_case(GeoCube::new(4) ; "Geometric Cube")]
#[test_case(FaceletCube::new(4) ; "Facelet Cube")]
fn lw2_move(cube: impl Cube) {
assert_eq!(cube.apply_move(Move::Lw(2, MoveVariant::Standard)).state(), vec![
B, B, U, U, B, B, U, U, B, B, U, U, B, B, U, U,
R, R, R, R, R, R, R, R, R, R, R, R,... | Rust | 0 |
corner_top_right: Sprite<Texture>,
corner_bottom_left: Sprite<Texture>,
corner_bottom_right: Sprite<Texture>,
}
fn take_sprite_at_pos(tex: &Rc<Texture>, x: u8, y: u8) -> Sprite<Texture> {
let mut s = Sprite::from_texture(tex.clone());
s.set_src_rect([f64::from(x) * STEP, f64::from(y) * STEP, STEP, STEP]);
... | Rust | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.