text string | label_name string | labels int64 |
|---|---|---|
import torch
import clip
import sys
sys.path.append('..')
from PIL import Image
from ppad_clip.datasets.chexpert import CheXpert
import numpy as np
import sklearn.metrics as metrics
device = "cuda" if torch.cuda.is_available() else "cpu"
model, preprocess = clip.load("ViT-B/32", device=device)
# pre-trained model pa... | Python | 1 |
icon_url,
'source_site': self.site_name,
'category': 'ui',
'asset_type': '2d',
'is_free': True,
'license_info': 'CC BY 3.0',
'scraped_at': time.time()
}
assets.append(... | Python | 1 |
_5x3();
let width = v.width();
let mut slice = v.into_boxed_slice();
let mut v = BidiMutSlice::new(&mut slice, width).unwrap();
v.rotate180();
assert_layout::<T>(
v,
5,
3,
vec![35, 34, 33, 32, 31, 25, 24, 23, 22, 21, 15, 14, 13, 12, 11],
);
}
run_test_on_types!(r... | Rust | 0 |
'.join(lst))
super(FunctionPrototype, self).__init__(name)
@property
def key(self):
return self.name
class WrapperAddressProtocol(ABC):
"""Base class for Wrapper Address Protocol.
Objects that inherit from the WrapperAddressProtocol can be passed
as arguments to Numba jit compi... | Python | 1 |
self.visit_item_recur(item)
}
}
}
enum PreprocessingError {
/// User error: `[std#x#y]` is not valid
MultipleAnchors,
Disambiguator(Range<usize>, String),
MalformedGenerics(MalformedGenerics, String),
}
impl PreprocessingError {
fn report(&self, cx: &DocContext<'_>, diag_info:... | Rust | 0 |
mut libc::c_void);
return 0 as *mut opj_tgt_tree_t;
}
(*tree).nodes = opj_calloc(
(*tree).numnodes as size_t,
::std::mem::size_of::<opj_tgt_node_t>() as libc::c_ulong,
) as *mut opj_tgt_node_t;
if (*tree).nodes.is_null() {
opj_event_msg(
p_manager,
1 as libc::c_int,
b"Not enoug... | Rust | 0 |
::thread;
use std::str::{from_utf8};
use std::sync::{Arc};
#[derive(Clone, Debug)]
pub enum Dir {
Path(PathBuf),
Temp(Arc<TempDir>),
}
impl Dir {
pub fn path(&self) -> &Path {
match self {
&Dir::Path(ref path) => path,
&Dir::Temp(ref tmp_dir) => tmp_dir.path(),
}
}
}
#[derive(Clone, Debug... | Rust | 0 |
code = input.read_uleb128()?;
if code == 0 {
return Ok(None);
}
let tag = Self::parse_tag(input)?;
let has_children = Self::parse_has_children(input)?;
let attributes = Self::parse_attributes(input)?;
let abbrev = Abbreviation::new(code, tag, has_children, a... | Rust | 0 |
}
fn device_name(&self) -> String {
self.get_device_name()
}
fn source(&self) -> Source {
if self.bpf_table().is_some() {
Source::Distribution
} else {
Source::Counter
}
}
}
// error-pattern:explicit failure
fn f() -> ! { fail }
fn g() -... | Rust | 0 |
from injector import inject, singleton
from logging import getLogger
from domain.entity.movie import Movie
from usecase import Usecase
from usecase.interface.i_movie_repo import IMovieRepo
LOGGER = getLogger(__name__)
@singleton
class QueryMovieListUsecase(Usecase):
@inject
def __init__(
self,
... | Python | 1 |
self.lv(&self.lv5, || vec![Alt])
}
fn lv6(&self) -> Redirect {
self.lv(&self.lv6, || vec![Alt, Shift])
}
fn lv7(&self) -> Redirect {
self.lv(&self.lv7, || vec![Control, Alt])
}
fn lv8(&self) -> Redirect {
self.lv(&self.lv8, || vec![Control, Alt, Shift])
}
}
impl Display for EightLevel... | Rust | 0 |
sts, Subst};
use rustc::hir;
use rustc::hir::def_id::DefId;
use crate::lowering::Lower;
use crate::generic_types;
/// Returns a predicate of the form
/// `Implemented(ty: Trait) :- Implemented(nested: Trait)...`
/// where `Trait` is specified by `trait_def_id`.
fn builtin_impl_clause(
tcx: TyCtxt<'tcx>,
ty: Ty... | Rust | 0 |
expected: "object" }))
}
};
($json:expr => $($path:expr)=>+; as array) => {
{
let _x = json_nav!{ $json => $($path)=>+ };
_x.and_then(|x| x.as_array().ok_or($crate::JsonNavError::TypeMismatch { expected: "array" }))
}
};
($json:expr => $($path:expr)=>+; as str) => {
{
... | Rust | 0 |
from django.urls import path, include
from . import views
app_name = "api.department"
# app_name will help us do a reverse look-up latter.
urlpatterns = [
path('department/', views.DepartmentList.as_view()),
]
| Python | 1 |
Clock::Pll,
}
}
}
impl From<TimClock> for U1 {
fn from(other: TimClock) -> U1 {
match other {
TimClock::Pclk => U1::B0,
TimClock::Pll => U1::B1,
}
}
}
macro_rules! impl_tim_clocksource {
($periph:path, $getter:ident, $setter:ident) => {
impl Cloc... | Rust | 0 |
otImplementedError)
)
])
def test_compressed_roundtrip(compression):
if not Codec.is_available(compression):
pytest.skip("{} support is not built".format(compression))
data = b"some test data\n" * 10 + b"eof\n"
raw = pa.BufferOutputStream()
with pa.CompressedOutputStream(raw, compression) a... | Python | 1 |
bfda706bd4919a71, "rze70uynk6e7", -2.257976852, 173.361697995},
{0xbf4ff3ccbddbd24f, "rx7z7m5xvg94", -2.915520485, 162.921314678},
{0x93bb3aa4f54eafa3, "kfxmp97p9uru", -30.050416291, 44.279107831},
{0xdbf38e68c6226ca2, "vgtswu6649qb", 65.502211626, 86.784212219},
{0xa884bfde7c826187, "p2... | Rust | 0 |
_some(),
},
);
let between = map(
rule! {
NOT? ~ BETWEEN ~ ^#subexpr(BETWEEN_PREC) ~ ^AND ~ ^#subexpr(BETWEEN_PREC)
},
|(opt_not, _, low, _, high)| ExprElement::Between {
low: Box::new(low),
high: Box::new(high),
not: opt_not.is_som... | Rust | 0 |
import sys
input = sys.stdin.readline
INF = int(1e9)
from collections import deque
def Bellman_ford(start):
xx=0
global flag
dist[start] = 0
for i in range(V):
for j in range(E): ## a->b
node_a = edge[j][0]
node_b = edge[j][1]
cost = edge[j][2]
i... | Python | 1 |
capitals = {
"Afghanistan": ["Кабул", "AF"],
"Åland Islands": ["Мариехамн", "AX"],
"Albania": ["Тирана", "AL"],
"Algeria": ["Алжир", "DZ"],
"American Samoa": ["Паго-Паго", "AS"],
"Andorra": ["Андорра-ла-Велья", "AD"],
"Angola": ["Луанда", "AO"],
"Anguilla": ["Валли", "AI"],
"Antarcti... | Python | 1 |
= !m // TODO: check that the data does match between template and entry?
}
let size: usize = mask.count_ones() as usize * std::mem::size_of::<u32>();
let dest = &mut dest[..size];
let offset = &mut 0;
if (mask & (1 << 0)) != 0 {
dest.gwrite_with::<u32>(self.resource... | Rust | 0 |
[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x01 << 5)) | (((value as u32) & 0x01) << 5);
self.w
}
}
impl R {
#[doc = "Bit 0 - Shortcut between event FIELDDETECTED and task ACTIVATE"]
#[inline(always)]
pub fn fielddetected_activate(&se... | Rust | 0 |
else:
await helpers_ot3.move_to_arched_ot3(
api, OT3Mount.LEFT, fixture_pos._replace(z=fixture_pos.z + 50)
)
ui.get_user_ready("Ready for moving to sealed fixture")
if USE_SEALED_FIXTURE:
await calibrate_to_p... | Python | 1 |
tched,
lengths=lengths,
memory_key_padding_mask=key_padding_masks_batched,
pos=pos_batched,
ref_points_unsigmoid=query)
for i in range(intermediate_results.shape[0]):
ouptut_i = intermediate_results[i]
pred_labels, pred_scores, pred_bboxes... | Python | 1 |
> COMMAND0_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 & !0x3fff) | (value as u32 & 0x3fff);
self.w
}
}
#[doc = "Field `COMMAND0_DONE` reader - When command 0 is done in I2C Master mode,... | Rust | 0 |
t x = { someProp: 1, undefinedProp: undefined, nullProp: null };
"#;
eprintln!("{}", forward(&mut engine, init));
assert_eq!(forward(&mut engine, "x.hasOwnProperty('someProp')"), "true");
assert_eq!(
forward(&mut engine, "x.hasOwnProperty('undefinedProp')"),
"true"
);
assert_eq!... | Rust | 0 |
"""Utilities for WOW action provider."""
from ...wallet_providers import EvmWalletProvider
from .constants import WOW_ABI, WOW_FACTORY_CONTRACT_ADDRESSES
from .uniswap.utils import get_has_graduated, get_uniswap_quote
def get_factory_address(chain_id: str) -> str:
"""Get the Zora Wow ERC20 Factory contract addre... | Python | 1 |
# WARNING: Please don't edit this file. It was generated by Python/WinRT v0.9.210202.1
import typing, winrt
import enum
_ns_module = winrt._import_ns_module("Windows.ApplicationModel.Store.Preview.InstallControl")
try:
import winrt.windows.foundation
except:
pass
try:
import winrt.windows.foundation.col... | Python | 1 |
from uds.uds_config_tool.UtilityFunctions import getSdgsDataItem, getParamWithSemantic, getServiceIdFromDiagService, \
getLongName, getShortName, getSdgsData, getPositiveResponse
if __name__ == "__main__":
import xml.etree.ElementTree as ET
filename = "Bootloa... | Python | 1 |
funny.",
"Well, it was slightly used...",
"(hurriedly leaves Rudy's) They had plans, They had plans!",
"Well it's tough to get a good read but I think if I brought him a chair, he'd sit.",
"You know, about the uh, two of us getting together.",
"And I know that I said I was engaged, but (laughs) uh, you know,... | Rust | 0 |
}
extern "C" {
pub fn fskmod_print(_q: fskmod);
}
extern "C" {
pub fn fskmod_reset(_q: fskmod);
}
extern "C" {
pub fn fskmod_modulate(_q: fskmod, _s: ::std::os::raw::c_uint, _y: *mut liquid_float_complex);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct fskdem_s {
_unused: [u8; 0],
}
pub type fskd... | Rust | 0 |
DataType::Bytes => Ok(protos::schema_state::PropertyDefinition_DataType::BYTES),
DataType::Boolean => Ok(protos::schema_state::PropertyDefinition_DataType::BOOLEAN),
DataType::Number => Ok(protos::schema_state::PropertyDefinition_DataType::NUMBER),
DataType::String => Ok(... | Rust | 0 |
onPowers {
small: &BASE17_SMALL_MANTISSA,
large: &BASE17_LARGE_MANTISSA,
small_int: &BASE17_SMALL_INT_POWERS,
step: BASE17_STEP,
bias: BASE17_BIAS,
log2: BASE17_LOG2_MULT,
log2_shift: BASE17_LOG2_SHIFT,
};
pub const BASE18_POWERS: BellerophonPowers = BellerophonPowers {
small: &BASE18_S... | Rust | 0 |
else:
raise
# MODELS
model_info = openai_client.models.retrieve(base_model)
assert model_info.base_model == base_model
model_list = openai_client.models.list()
assert model_list.data[0] == base_model
def test_chat(chat, openai_client, async_client, system_prompt, chat_conversation, a... | Python | 1 |
c.force_teddy(true).match_kind(MatchKind::LeftmostLongest);
if is_x86_feature_detected!("avx2") {
c.force_avx(Some(true));
}
}
);
#[cfg(target_arch = "x86_64")]
testconfig!(
search_teddy_fat_leftmost_first,
PACKED_LEFTMOST_FIRST,
|c: &mut Config| {
c.force_teddy(true... | Rust | 0 |
sched RecvBlock machine {}", key);
let machine = self.machines.get(key).unwrap();
if machine
.compare_and_exchange_state(MachineState::RecvBlock, MachineState::Ready)
.is_ok()
{
schedule_machine(Arc::clone(machine), &self.run_queue);
}
}
}
#[cfg(t... | Rust | 0 |
C_0
}
#[doc = "Checks if the value of the field is `PIC_1`"]
#[inline(always)]
pub fn is_pic_1(&self) -> bool {
*self == PIC_A::PIC_1
}
#[doc = "Checks if the value of the field is `PIC_2`"]
#[inline(always)]
pub fn is_pic_2(&self) -> bool {
*self == PIC_A::PIC_2
}
... | Rust | 0 |
"""
Write a python function to count minimum number of swaps required to convert one binary number represented as a string to another.
assert min_Swaps("1101","1110") == 1
"""
def min_Swaps(s1,s2):
count = 0
for i in range(len(s1)):
if s1[i]!= s2[i]:
count += 1
return count
print(min_S... | Python | 1 |
if !fixed_rate {
fixed_rate = bs.get()?;
}
if fixed_rate {
bs.get_ue()?;
} else {
low_delay = bs.get()?;
}
if !low_delay {
nb_cpb = bs.get_ue()? + 1;
}
if ... | Rust | 0 |
IsSaved(self, IsSaved):
self._IsSaved = IsSaved
@property
def ModelSignature(self):
r"""SAVED_MODEL保存时配置的签名
注意:此字段可能返回 null,表示取不到有效值。
:rtype: str
"""
return self._ModelSignature
@ModelSignature.setter
def ModelSignature(self, ModelSignature):
self._Model... | Python | 1 |
_eq!(
env::var("TEST_LIB_SET_OPTIONAL_SOME").unwrap(),
"OPTIONAL VALUE".to_string()
);
}
#[test]
fn set_or_remove_none() {
let output = set_or_remove::<&str, &str>("TEST_LIB_SET_OR_REMOVE_NONE", &None);
assert!(!output);
}
#[test]
fn set_or_remove_some() {
let mut output = set_or_remo... | Rust | 0 |
_)
| (_, Token::RParen)
| (Token::Identifier, Token::LBracket)
| (Token::Sharp, Token::Number)
| (Token::LBracket, _)
| (Token::LBraces, _)
| (_, Token::RBraces)
| (_, Token::RBracket)
| (Tok... | Rust | 0 |
def calculate_net_salary(
gross_salary,
tax_class=1,
has_children=False,
health_insurance_percent=13.6,
additional_health_insurance=1.3,
church_tax=False
):
# Социальные отчисления
pension = gross_salary * 0.093 # Пенсионное
unemployment = gross_salary * 0.012 # По безработице
... | Python | 1 |
def yaml_load():
with open('baseline.yaml') as stream:
param = yaml.safe_load(stream)
return param
| Python | 1 |
x::new(e)),
)(i)
}
#[cfg(test)]
mod tests {
use super::{factor, AtomicExpression, Factor, UnaryOperator};
use crate::syntax::types::Atom;
#[test]
fn test_atom_factor() {
let (rest, f) = factor(" 48").unwrap();
assert_eq!(rest, "");
assert_eq!(
f,
Fac... | Rust | 0 |
# Get total GPU hours
gpu_hours_stmt = select(fine_tuned_models_table.c.gpu_hours_consumed).where(
fine_tuned_models_table.c.gpu_hours_consumed.isnot(None)
)
gpu_hours_result = await db.execute(gpu_hours_stmt)
total_gpu_hours = sum(row[0] for row in gpu_hour... | Python | 1 |
# otherwise the track's height value is fine.
# We are assuming this title is some weird aspect ratio so most
# likely a movie or HD source, so it's most likely widescreen so
# 16:9 canvas makes the most sense.
resolution = int(primary_video_track... | Python | 1 |
"--train-mode=whole",
"--eval-datasets=" + eval_dataset,
"--devices", str(config["devices"][0])
]
subprocess.run(cmd)
# evaluate
if config['evaluate']:
# not useful now
stop_task = len(dataset)
if "exclude_sun397" in config and config[... | Python | 1 |
(move |_| Msg::ToggleModalFormDisplay(true, Some(contribution.clone())))
>
{ EDIT_BUTTON }
</a>
</div>
<div class="control">
<a
... | Rust | 0 |
}
}
}
}
}
}
/// 处理用户脚本
fn process_user_script(&mut self, script: String) {
if let Err(e) = self.exec_script(&script) {
let err_lines = Lines::fmt_err(e.to_string());
for err_line in err_lines.into_vec() {
... | Rust | 0 |
&str) -> Result<Option<Circuit>, CircuitStoreError>;
}
/// An iterator over circuits, with a well-known count of values.
pub struct CircuitIter {
inner: Box<dyn Iterator<Item = Circuit> + Send>,
total: u64,
}
impl CircuitIter {
/// Construct the new iterator with the given total and an inner iterator.
... | Rust | 0 |
);
let ref_cpu = &mut cpu;
c.bench_function("test_Cpu_ora_zero_page", |b| b.iter(|| test_cpu_ora_zero_page(ref_cpu)));
c.bench_function("test_Cpu_ora_zero_page2", |b| b.iter(|| test_cpu_ora_zero_page2(ref_cpu)));
}
criterion_group!(benches, criterion_benchmark, criterion_benchmark2, criterion_benchmark3);
... | Rust | 0 |
].attrib_desc),
descriptors[0].attrib_desc.align,
)
}
/// Set the vertex component OpenGL pointers regarding the index of the component and the vertex
/// stride.
fn set_component_format(
ctx: &mut glow::Context,
stride: usize,
off: usize,
desc: &VertexBufferDesc,
) {
unsafe {
l... | Rust | 0 |
usize;
// Clear data
fn clear(&mut self);
// Export analysis info - needed inputs
fn info(width : usize) -> String;
// Brief info for analysis
fn brief_info() -> String;
// export form for summary file (explaination of each column in summary file)
fn export_form(width : usize) -> St... | Rust | 0 |
oft_block_indent(),
FormatBodyStatement::new(&body?)
]
)
}
}
<filename>research/gaia/gremlin/gremlin_core/src/structure/filter/codec.rs
//
//! Copyright 2020 Alibaba Group Holding Limited.
//!
//! Licensed under the Apache License, Version 2.0 (the "License");
//! you may not us... | Rust | 0 |
import numpy as np
import torch
from hiss.tasks.task import Task
class VectorTask(Task):
def __init__(self, filter_input=False, filter_cutoff=0.03) -> None:
super().__init__("VectorTask")
self.filter_input = filter_input
self.metrics = [
"mse",
"err",
"... | Python | 1 |
= vec![VkSurfaceFormatKHR {
format: 0,
colorSpace: 0,
}; count as usize];
unsafe { vkGetPhysicalDeviceSurfaceFormatsKHR(self.gpu.vk_physical_device,window.vk_surface,&mut count,formats.as_mut_ptr()) };
let mut format_supported = false;
for i in 0..formats.len() {... | Rust | 0 |
to_its_capacity_before_splitting() {
let mut tree: KdTree<f64, i32, 2> = KdTree::new();
let capacity = 2_usize.pow(4);
for _ in 0..capacity {
let (pos, data) = random_point();
tree.add(&pos, data).unwrap();
}
assert_eq!(tree.size, capacity);
assert... | Rust | 0 |
ub', # 0xe5
'ssyubs', # 0xe6
'ssyus', # 0xe7
'ssyuss', # 0xe8
'ssyung', # 0xe9
'ssyuj', # 0xea
'ssyuc', # 0xeb
'ssyuk', # 0xec
'ssyut', # 0xed
'ssyup', # 0xee
'ssyuh', # 0xef
'sseu', # 0xf0
'sseug', # 0xf1
'sseugg', # 0xf2
'sseugs', # 0xf3
'sseun', # 0xf4
'sseunj', # 0... | Python | 1 |
t {
boost: opt.boost_fields.as_ref().and_then(|boost| boost.get(field_name).map(|el| OrderedFloat(*el))),
levenshtein_distance,
path: field_name.to_string(),
terms: vec![term],
starts_with,
is_regex,
ignore_c... | Rust | 0 |
from pathlib import Path
from typing import List, Union
from langchain_core.documents import Document
from langchain_community.document_loaders.base import BaseLoader
class SRTLoader(BaseLoader):
"""Load `.srt` (subtitle) files."""
def __init__(self, file_path: Union[str, Path]):
"""Initialize with... | Python | 1 |
'''
@author Maurice Amon
'''
import pickle
from commands.Command import Command
from commands.requests.FetchGameStateRequest import FetchGameStateRequest
from commands.responses.GameStateResponse import GameStateResponse
from model.GameHandler import GameHandler
from model.board.BattleshipMatrix import BattleshipMatri... | Python | 1 |
x_samples, read_condition)?;
let mut result = Vec::with_capacity(values.len());
for ks in values {
if let Some(s) = DataSample::<D>::from_with_key(ks) {
result.push(s);
}
}
Ok(result)
}
/// Reads next unread sample
///
/// # Examples
///
/// ```
/// # use serde::{Seria... | Rust | 0 |
ts {
ProofError(ProofErr),
PermissionStart(PermStart),
PermissionEnd(Perm),
RangeMarkupElements(RangeMarkupElements),
Insert(RunTrackChange),
Delete(RunTrackChange),
MoveFrom(RunTrackChange),
MoveTo(RunTrackChange),
MathContent(MathContent),
}
impl RunLevelElts {
pub fn is_choic... | Rust | 0 |
"""
Plot a 2D array of data
=======================
Dispose a two dimensional array of data into a grid.
In this example, we generate a dataset of EEG signals composed with 125 trials
of 4000 time points each.
After opening the interface, you should notice two layouts :
* The first one, on the left composed with a g... | Python | 1 |
Command::GetDevices => client::get_devices().await,
Command::GetHrTimeSeries => client::heart_rate::get_time_series().await,
Command::GetHrIntradayTimeSeries => client::heart_rate::get_intraday_time_series().await,
Command::GetProfile => client::get_profile().await,
Command::GetSl... | Rust | 0 |
not live long enough
//let y: &'a i32 = &_x;
// Attempting to use the lifetime `'a` as an explicit type annotation
// inside the function will fail because the lifetime of `&_x` is shorter
// than that of `y`. A short lifetime cannot be coerced into a longer one.
}
pub fn explicit_annotation() {
// Create v... | Rust | 0 |
let (tx, rx) = channel(MESSAGES);
let consumer = thread::spawn(move || {
future::block_on(async move {
// recieve one message
let msg = rx.recv().await;
test_println!("recv {:?}", msg);
assert_dbg!(msg.is_some());
... | Rust | 0 |
# Copyright 2023 The JAX Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wri... | Python | 1 |
;93mCP:%s\x1b[1;90m]-[\x1b[1;94m%s%s\x1b[1;90m]%s ✓'%(bi,loop,len(id2),ok,cp,int(pers),str(fff),x));sys.stdout.flush()
ua = random.choice(hEROn)
ses = requests.Session()
for pw in pwv:
try:
nip=random.choice(prox)
proxs= {'http': 'socks5://'+nip}
ses.headers.update({"Host":"m.facebook.com","upgrade-insecu... | Python | 1 |
rror_msg=None):
"""@see L{RpcResultsBuilder}
@param node: @see L{RpcResultsBuilder}.
@type error_msg: string
@param error_msg: the error message as returned by the RPC
@rtype: L{rpc.RpcResult}
"""
return rpc.RpcResult(data=(False, error_msg), node=self._GetNodeId(node))
def AddSuccessful... | Python | 1 |
);
from_pointer_impl! (BigFraction);
from_pointer_impl! (link BigFraction);
from_pointer_impl! (u8);
from_pointer_impl! (i8);
from_pointer_impl! (u16);
from_pointer_impl! (i16);
from_pointer_impl! (u32);
from_pointer_impl! (i32);
from_pointer_impl! (u64);
from_pointer_impl! (i64);
from_pointer_impl! (usize);
from_poi... | Rust | 0 |
_element);
let value = parser.consume_value().unwrap().0;
let expected = crate::IonValue::Decimal(
BigDecimal::from_str(&"0.000000000000000000000000000000000000000000025149515645911129")
.unwrap(),
);
assert_eq!(expected, value);
let value = parser.consume_value().unwrap_err();
... | Rust | 0 |
import optuna
import warnings
from lightning.pytorch import Callback
from typing import TYPE_CHECKING
if TYPE_CHECKING:
import lightning.pytorch as pl
class PyTorchLightningPruningCallback(Callback):
"""PyTorch Lightning callback to prune unpromising trials.
See `the example <https://github.com/optuna... | Python | 1 |
LIMIT).collect();
let prof = get_profiler(file!());
test_heap(&prof, |stats| {
dhat::assert_eq!(stats.total_blocks, 0);
dhat::assert_eq!(stats.total_bytes, 0);
});
{
let mut keys = keys.into_iter();
let mut current_root =
NodePtr::allocate_node(LeafNode::ne... | Rust | 0 |
"""
@FileName: Algorithm.py
@Description: Implement Algorithm
@Author: Ryuk
@CreateDate: 2020/11/03
@LastEditTime: 2020/11/03
@LastEditors: Please set LastEditors
@Version: v0.1
"""
import numpy as np
import math
from scipy import signal
def DirectInterpolation(x, L, M):
N = len(x)
K = int((M / L) * N)
fa... | Python | 1 |
ize = COUNT;
fn setup() -> (String, String, String, String) {
unsafe {
INDEX = INDEX + 1;
(_type(INDEX), _id(INDEX), _value(INDEX), _tags(INDEX))
}
}
fn add_record(wallet_handle: WalletHandle, type_: &str, id: &str, value: &str, tags: &str) {
NonSecretsUtils... | Rust | 0 |
let err = unsafe { ogc_sys::ASND_PauseVoice(voice as _, pause as _) };
if_not!(SND_OK => "Asnd::pause_voice() failed with error {}", err)
}
/// Returns the state of the selected voice.
pub fn status_voice(voice: u32) -> Result<()> {
assert!(voice < 16, "Voice index {} is >= 16", voice);... | Rust | 0 |
tt, $indent:expr) => {
let $result: u8;
{
let bytes = $reader.read_1u()?;
print_bytes($indent, bytes);
$result = bytes[0];
}
};
}
macro_rules! read_u16 {
($result: ident, $reader: tt, $indent:expr) => {
let $result: u16;
{
let bytes = $reader.read_2u()?;
print_bytes($in... | Rust | 0 |
import os
import sys
sys.path.append(os.path.dirname(os.path.dirname(__file__)))
from HumanAir.Vn_Diagrams.gust_diagram import calculate_gust_diagram_loads
def test_calculate_gust_diagram_loads():
# Mock aircraft data
aircraft_data = {
"Performance": {
"W/S_N/m2": 300,
},
... | Python | 1 |
import torch
import torch.nn as nn
import torch.nn.functional as F
from mmcv.cnn import ConvModule, caffe2_xavier_init
from torch.utils.checkpoint import checkpoint
from ..builder import NECKS
@NECKS.register_module()
class HRFPN(nn.Module):
"""HRFPN (High Resolution Feature Pyrmamids)
paper: `High-Resoluti... | Python | 1 |
# Copyright 2017 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Chromium presubmit script to check that BadMessage enums in histograms.xml
match the corresponding bad_message.h file.
"""
USE_PYTHON3 = True
def CheckC... | Python | 1 |
# special case for Integral and Real since they are abstract classes
return 1
return constraint.type()
if isinstance(constraint, _Booleans):
return True
if isinstance(constraint, _VerboseHelper):
return 1
if isinstance(constraint, MissingValues) and const... | Python | 1 |
=> decrypt(opt)?,
Command::Encrypt(opt) => encrypt(opt)?,
}
Ok(())
}
use crate::{events::AllRuntimeEvents, match_event};
use polkadot_primitives::v1::UpgradeGoAhead;
use sc_client_api::{CallExecutor, ExecutorProvider};
use sc_executor::NativeElseWasmExecutor;
use sc_service::TFullCallExecutor;
use sim... | Rust | 0 |
self.range_set.insert_range(0xe000..=(end as u32));
} else {
self.range_set.insert_range((start as u32)..=(end as u32));
}
}
pub fn remove_range(&mut self, range: RangeInclusive<char>) {
let (start, end) = range.into_inner();
self.range_set.remove_range((start as u32... | Rust | 0 |
from airflow import DAG, Dataset # type: ignore
from airflow.decorators import task # type: ignore
from datetime import datetime
file = Dataset("/tmp/file.txt")
with DAG(
dag_id = "producer_astro",
schedule = "@daily",
start_date = datetime(2025, 1, 1),
catchup = False
) as dag:
@task(outl... | Python | 1 |
iter.next(); // move iterator and create data_array from second element
let data_array: DFInt64Array = NewDataArray::new_from_opt_iter(iter);
let mut iter = data_array.into_iter();
assert_eq!(Some(Some(&1)), iter.next());
assert_eq!(Some(Some(&2)), iter.next());
assert_eq!(Some(None), iter.nex... | Rust | 0 |
ps = &mut INTERNAL;
}
if s.is_null() {
let xs: [c_char; 1] = [0];
utf8::mbrtowc(pwc, &xs[0] as *const c_char, 1, ps)
} else {
utf8::mbrtowc(pwc, s, n, ps)
}
}
//Convert a multibyte string to a wide string with a limited amount of bytes
//Required for in POSIX.1-2008
#[no_mangle... | Rust | 0 |
view = OnlinePlayersView()
await ctx.send(embed=embed, view=view)
@bot.command()
async def config_canal(ctx):
"""Define este canal para receber mensagens automáticas"""
global channel_id
channel_id = ctx.channel.id
await ctx.send(f'✅ Canal configurado! Mensagens automáticas serão envi... | Python | 1 |
span.name = 'tt'
elif style == 'font-weight:bold':
span.name = 'b'
elif style == 'font-size:small':
span.name = 'small'
# elif style == 'font-family:sans-serif':
# span.name = 'u'
else:
# print(style) fon... | Python | 1 |
import os
from concurrent.futures import ThreadPoolExecutor, as_completed
from datetime import datetime
from Utils.QwenAgents import Cardiologist, Psychologist, Pulmonologist, MultidisciplinaryTeam
# read the medical report
with open("Medical Reports\Medical Rerort - Michael Johnson - Panic Attack Disorder.txt", "r") ... | Python | 1 |
# Copyright (c) 2018 SBCloud
#
# 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, soft... | Python | 1 |
use elasticsearch::{Elasticsearch, auth::Credentials, SearchParts, http::transport::{TransportBuilder, SingleNodeConnectionPool, Transport}};
#[cfg(all(feature = "systemd-integration", target_os = "linux"))]
mod systemd;
mod easy_git;
// mod test;
use crate::index::{Config, GitIndex};
use helper::{Crate, CrateReq};
us... | Rust | 0 |
ового метода: добавление в сообщение extra параметров
(если они были переданы)
"""
msg = super().getMessage()
extra = getattr(self, _EXTRA_ARGS_NAME, None)
if extra:
if msg[-1:] != "\n":
msg += "\n"
msg += "Extra args (YAML):\n"
... | Python | 1 |
nineth_day(),
10 => tenth_day(),
11 => eleventh_day(),
12 => twelfth_day(),
13 => thirteenth_day(),
14 => fourteenth_day(),
15 => fifteenth_day(),
16 => sixteenth_day(),
17 => seventeenth_day(),
18 => eighteenth_day(),
19 => nineteenth_day(),
_ => println!("Option {} not fou... | Rust | 0 |
!(saturating_cast(src_m09), dst_z0);
assert_eq!(saturating_cast(src_m08), dst_z0);
assert_eq!(saturating_cast(src_m01), dst_z0);
assert_eq!(saturating_cast(src_z00), dst_z0);
assert_eq!(saturating_cast(src_p01), dst_p1);
assert_eq!(saturating_cast(src_p07), dst_p7);
assert_eq!(saturating_cast(sr... | Rust | 0 |
) -> crate::Result<TestIamPermission> {
self.0.runtime.block_on(
self.0
.client
.bucket()
.test_iam_permission(bucket, permission),
)
}
}
<reponame>tedbyron/dex<gh_stars>0
#![warn(
clippy::all,
clippy::cargo,
clippy::nursery,
... | Rust | 0 |
&str,
sec_type: &str,
listing_exch: &str,
service_data_type: &str,
agg_group: i32,
) -> Self {
DepthMktDataDescription {
exchange: exchange.to_string(),
sec_type: sec_type.to_string(),
listing_exch: listing_exch.to_string(),
ser... | Rust | 0 |
_event(
&mut self,
_: PeerId,
_: ConnectionId,
_: <Self::ProtocolsHandler as ProtocolsHandler>::OutEvent,
) {
}
fn poll(
&mut self,
cx: &mut Context,
_: &mut impl PollParameters,
) -> Poll<
NetworkBehaviourAction<
<Self::Protoc... | Rust | 0 |
# /// script
# requires-python = ">=3.11"
# dependencies = [
# "marimo",
# "openai==1.60.2",
# ]
# ///
import marimo
__generated_with = "0.15.5"
app = marimo.App(width="medium")
@app.cell
def _():
import marimo as mo
return (mo,)
@app.cell(hide_code=True)
def _(mo):
mo.md(
r"""
... | Python | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.