text string | label_name string | labels int64 |
|---|---|---|
should_encode_to_json() {
check_to_json(
Some(U256::zero()),
r#"{"cl_type":{"Option":"U256"},"parsed":"0"}"#,
);
check_to_json(
Some(U256::max_value()),
r#"{"cl_type":{"Option":"U256"},"parsed":"1157920892373161954235709... | Rust | 0 |
::read), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [tcd28_citer_elinkno](tcd... | Rust | 0 |
uct Link {
contrast: Contrast,
href: String,
text: String,
}
impl Link {
pub fn new(contrast: Contrast, href: String, text: String) -> Self {
Self {
contrast,
href,
text,
}
}
}
<reponame>stillonearth/BevyStein<filename>src/events.rs<gh_stars>1-10
... | Rust | 0 |
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# bu... | Python | 1 |
# Copyright 2024 Bytedance Ltd. and/or its affiliates
#
# 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 ... | Python | 1 |
n from_retself(Self::RetSelf) -> Self;
fn dot() -> unsafe extern fn(n: blasint, x: *const Self::Float, incx: blasint, y: *const Self::Float, incy: blasint) -> Self::RetSelf;
fn axpy() -> unsafe extern fn(n: blasint, alpha: Self, x: *const Self, incx: blasint, y: *mut Self, incy: blasint);
fn axpby() -> uns... | Rust | 0 |
10, 11, 12, 13, 14, 15,
-1, -1, 16, 17, 18])
self._mapping = np.array(range(-1, len(self._key) - 1)).astype('int32')
for value in values:
assert (value in self._mapping)
# ่ทๅmaskไธญๅๅ็ด ๅผๅฏนๅบไบ_mapping็็ดขๅผ
index = np.digitize... | Python | 1 |
mber: i32) -> i32 {
let id = x + 10;
let power = (id * y + serial_number) * id;
(power % 1_000) / 100 - 5
}
#[derive(Debug, Eq, PartialEq)]
struct Square(usize, usize, usize); // x, y, size
struct SummedAreaTable {
width: usize,
height: usize,
table: Vec<i32>,
}
impl SummedAreaTable {
fn ... | Rust | 0 |
assert_eq!(container.is_empty(), false);
container.reg_empty(run.unwrap());
assert_eq!(container.is_empty(), true);
osmem::munmap(ptr, 2*1024*1024);
}
#[test]
fn get_empty_run_1() {
let ptr = osmem::mmap(0, 2*1024*1024);
let mut container = SmallChunkContainer::... | Rust | 0 |
Uint {
let mut preimage = uint.to_bytes_le();
preimage.resize(32, 0_u8);
BigUint::from_bytes_le(&hash(&preimage))
}
fn private_key(validator_index: usize) -> BigUint {
let mut key = BigUint::from(validator_index);
loop {
key = hash_big_int_le(key);
if key.bits() <= CURVE_ORDER_BITS ... | Rust | 0 |
den = "\033[0;30m"
trang = "\033[0;37m"
do = "\033[0;31m"
xanh_la = "\033[0;32m"
nau = "\033[0;33m"
xanh_duong = "\033[0;34m"
tim = "\033[0;35m"
xanh_ngoc = "\033[0;36m"
xam_nhat = "\033[0;37m"
xam_dam = "\033[1;30m"
do_nhat = "\033[1;31m"
xanh_la_nhat = "\033[1;32m"
vang = "\033[1;33m"
xanh_duong_nhat = "\033[1;34m"
t... | Python | 1 |
esult<()> {
let lines = input_lines(INPUT)?;
anyhow::ensure!(lines.len() == 1);
let bits_message: BITSMessage = lines[0].parse()?;
let packet = Packet::read(&mut bits_message.into_iter())?;
println!("Part 1: {}", part01(&packet));
println!("Part 2: {}", part02(&packet));
Ok(())
}
<filename... | Rust | 0 |
from sqlalchemy.orm import Session
from app.models.competidorModel import Competitor
from app.schemas.competidorSchema import CompetitorCreate
def get_competitor(db: Session, competitor_id: int):
return db.query(Competitor).filter(Competitor.id == competitor_id).first()
def get_competitors(db: Session, skip: int ... | Python | 1 |
_model.calculate_radius(self.number_of_points),
);
}
#[inline]
fn merge_attributes(&mut self, other_aggregates: &HashMap<String, AttributeAggregate>) {
for (attribute, aggregate) in &mut self.attribute_aggregates {
if let Some(other_aggregate) = other_aggregates.get(attribute) {... | Rust | 0 |
import os
import re
import json
def extract_ts_code(
text,
item,
):
signature_escaped = re.escape(item['signature'])
code_block = re.search(
rf"```(?:[Tt](?:ypescript|s))?.*?(const\s+{signature_escaped}.*?)```",
text,
flags=re.DOTALL,
)
if code_block is None:
cod... | Python | 1 |
eration function
Ok(paramgen_from_alpha(
&hash_to_field_pointproofs(&seed),
ciphersuite,
n,
))
}
/// Internal logic for parameter generation.
/// Will always succeed.
/// Will not be called outside this module.
fn paramgen_from_alpha(
alpha: &Fr,
ciphersuite: Ciphersuite,
n:... | Rust | 0 |
":"2"},{"title":"3"}]}]}}"#
);
Ok(())
}
/// Mut return only distinct records for top record, and only for those the distinct relation records. Both orderings reversed.
#[connector_test]
async fn nested_distinct_reversed(runner: &Runner) -> TestResult<()> {
nested_dataset(runner... | Rust | 0 |
fd(), &mut vb_status)
};
if r < 0 {
bail!(ErrorKind::Ioctl("amstream_ioc_get_vb_status"));
};
Ok(unsafe {vb_status.union.status})
}
fn set_state(&mut self, state: State) -> Result<()> {
if self.state == state {
return Ok(())
};
mat... | Rust | 0 |
msg)
# classification related
tpr, tnr, precision, recall, f1_score = get_classification_scores(male_phq_binary_gt, male_phq_binary_pred)
msg = (' - Classification:\n'
' TPR/Sensitivity: {0:6.4f}\n'
' TNR/Specificity: {1:6... | Python | 1 |
] Pointer to the attributes for the specified secret."]
pub fn ockam_vault_secret_attributes_get(
vault: *mut ockam_vault_t,
secret: *mut ockam_vault_secret_t,
attributes: *mut ockam_vault_secret_attributes_t,
) -> ockam_error_t;
}
extern "C" {
#[doc = " @brief Set or change the t... | Rust | 0 |
"ed8b3ccbaf14970a402efd68f7bfa7db20a2543a"
def test_add_description_data(repo, wippolder_dir):
"""Can we add description of a single data entry?"""
repo.add("wippolder/wippolder.gpkg", pathspec=str(wippolder_dir / "wippolder.gpkg"))
df_old = deepcopy(repo.get_data(CaseSpec("wippolder", "wippolder.gpkg")))... | Python | 1 |
from collections import defaultdict
from typing import Optional
from mmengine.evaluator import BaseMetric
from opencompass.registry import METRICS
@METRICS.register_module()
class MMEMetric(BaseMetric):
"""Dump model's prediction to a file.
Args:
collect_device (str): Device name used for collectin... | Python | 1 |
os() as usize;
let to_skip = FieldElement::size_in_bits() - (log_max_pks + 1);
b_field.write_bits()[to_skip..].to_vec()
};
//Compute pks_threshold_hash
let mut h = FieldHash::init_constant_length(pks.len(), None);
pks.iter().for_each(|pk| {
h.update(pk.0.into_affine().x);
})... | Rust | 0 |
n + 1] / sum_ACC
d = d2 - d1
if d2 < d1:
print("\n Restore former clusters!")
train_k.k = copy.deepcopy(train_k.old_k)
train_k.x_c = copy.deepcopy(train_k.Center)
train_k.y_c = copy.deepcopy(train_k.old_yc)
kmean_pr... | Python | 1 |
pub psnr: Option<(f64, f64, f64)>,
}
impl From<Packet> for FrameSummary {
fn from(packet: Packet) -> Self {
Self {
size: packet.data.len(),
number: packet.number,
frame_type: packet.frame_type,
psnr: packet.psnr,
}
}
}
impl fmt::Display for FrameSummary {
fn fmt(&self, f: &mut fm... | Rust | 0 |
: Some("".to_string()),
help: false,
version: false,
encrypt: false,
decrypt: false,
passphrase: Some("password".to_string()),
max_work_factor: Some(0),
armor: false,
recipient: vec!["".to_string()],
recipients_file: vec!["".to_string()],
i... | Rust | 0 |
oard_input.pressed(KeyCode::Up) {
dir += Vec2::Y;
}
if keyboard_input.pressed(KeyCode::Down) {
dir += -Vec2::Y;
}
dir.normalize_or_zero() * 10.
};
let primary_window = if let Some(win) = windows.get_primary() {
win
} else {
error!("No... | Rust | 0 |
15FDA, 0xBFC3FAA9121B000A, 0x3FD78041D8808A6E, 0x3FF0274A396438F8, 0x3FFA1DA31B7D7EC9, 0x3FE74FAD0F07E910, 0x3FF2AAD0CC1CA255,
0xBFE89A03F957D34B, 0x3FE6C67B4CF2CA53, 0xBFD9B13BAD9F01BA, 0x3FEA77CAFBEF90AF, 0xBFF4E27A16E01558, 0x3FB4155DA4F72F44, 0xBFC326668AC17059, 0x3FCE12CEAEF10428,
];
// Copyright 2017 <NAME> <<EM... | Rust | 0 |
64), Error> {
Ok(guos(x_vec, y_vec)?)
}
/// Returns a value of gaussian function.
///
/// # Examples
/// Returns a value of gaussian function.
///
/// ```
/// use fitting::gaussian::val;
///
/// let (mu, sigma, a): (f64, f64, f64) = (5., 3., 1.);
/// let x = 5.;
/// let y = val(x, mu, sigma, a);
/// assert_eq!(y, ... | Rust | 0 |
bpy.ops.object.shade_smooth()
obj = bpy.context.view_layer.objects.active
obj.scale = [properties['scale'][0], properties['scale'][1], properties['scale'][2]]
obj.rotation_mode = 'QUATERNION' # blender quats are WXYZ
obj.rotation_quaternion = [properties['rotation'][3]... | Python | 1 |
addr, Network::Mainnet).is_err());
// Wrong version byte type
let cashaddr = encode_with_version_byte(
&[1; 20],
version_byte_flags::SIZE_160 | 0x09,
Network::Mainnet,
).unwrap();
assert!(cashaddr_decode(&cashaddr, Network::Mainnet).is_err());
}
}... | Rust | 0 |
ngis.net/citygml/transportation/2.0 http://schemas.opengis.net/citygml/transportation/2.0/transportation.xsd http://www.opengis.net/citygml/waterbody/2.0 http://schemas.opengis.net/citygml/waterbody/2.0/waterBody.xsd http://www.opengis.net/citygml/landuse/2.0 http://schemas.opengis.net/citygml/landuse/2.0/landUse.xsd h... | Python | 1 |
);
let into_currency_id = Self::to_currency_id(into_asset_id)?;
let pool_share_currency_id = Self::to_currency_id(from_pool_share_id)?;
T::Currency::withdraw(pool_share_currency_id, &from, amount)?;
T::Currency::transfer(into_currency_id, &Self::account_id(), &recipient, amount)?;
Self::deposit_event(E... | Rust | 0 |
let entry = entry.finalize()?;
self.push(entry)
}
pub fn finalize(self, author: &ed25519::SecretKey) -> Result<&'a mut Passport, PassportError> {
let Self {
passport,
mut block,
ledger: _,
} = self;
block.version(block::Version::CURRENT);
... | Rust | 0 |
pkgname = "emacs-pgtk"
pkgver = "30.1"
pkgrel = 4
build_style = "gnu_configure"
configure_args = [
"--with-gameuser=:_games",
"--with-gpm",
"--with-jpeg",
"--with-json",
"--with-pgtk",
"--with-webp",
"--with-x-toolkit=gtk3",
"--without-tiff",
]
hostmakedepends = [
"automake",
"ga... | Python | 1 |
# PUBLIC DOMAIN NOTICE
# National Center for Biotechnology Information
#
# This software is a "United States Government Work" under the
# terms of the United States Copyright Act. It was written as part of
# the authors' official duties as United States Government employees and... | Python | 1 |
eParameter)
float_curve_2 = nw.new_node(Nodes.FloatCurve, input_kwargs={'Value': spline_parameter_3.outputs["Factor"]})
node_utils.assign_curve(float_curve_2.mapping.curves[0], [(0.0568, 0.4062), (0.3886, 0.7719), (1.0000, 0.7000)])
instance_on_points_3 = nw.new_node(Nodes.InstanceOnPoints,
... | Python | 1 |
ight,
fields) = unpack('HHHHB', file)
local_color_table_flag = fields & 0x80
local_color_table_size = fields & 0x7
# 21. Local color table
if local_color_table_flag:
local_color_table = file.read(6 << local_color_table_size)
# 22. Table based image data
lzw_code_size = file.read(... | Python | 1 |
import neptune
from evidently.metric_preset import DataDriftPreset
from evidently.report import Report
from evidently.test_preset import DataStabilityTestPreset
from evidently.test_suite import TestSuite
from neptune.utils import stringify_unsupported
from sklearn import datasets
# Load sample data
iris_frame = datase... | Python | 1 |
stars:XXX..XXX
n..n โโโโ> upper
|
โโโโโโโโโ> lower
when [lower: 1000] [upper: 2000] => ok. search star range 1000..2000
when [lower: 500] [upper: *] => ok. search star range 500..*
when [lower: 1000] [upper: 1000] => error. 1000..1000
when [lower: 1000] [upper: ... | Rust | 0 |
get("annotationlib")) and isinstance(hint, annotationlib.ForwardRef):
return "ClassVar" in hint.__arg__
else:
_typing = sys.modules.get("typing")
if _typing:
_Annotated = _typing.Annotated
_get_origin = _typing.get_origin
if _Annotated and _get_origin(hin... | Python | 1 |
"""
Chain of Responsibility (COR) รฉ um padrรฃo comportamental
que tem a intenรงรฃo de evitar o acoplamento do remetente de
uma solicitaรงรฃo ao seu receptor, ao dar a mais de um objeto
a oportunidade de tratar a solicitaรงรฃo.
Encadear os objetos receptores passando a solicitaรงรฃo
ao longo da cadeia atรฉ que um objeto a trate.
... | Python | 1 |
import pygame
import pgzrun
# ่ฎพ็ฝฎไบบๅ
people = Actor('ๅๅบ')
# ่ฎพ็ฝฎ่ๆฏ
bg = Actor('่ๆฏ')
def draw():
screen.clear()
bg.draw()
people.draw()
def update():
if keyboard.s:
pygame.image.save(screen.surface, 'images/ๅๆ็ปๆ.png')
exit()
# =====ๆนๅ้ฎๆงๅถpeople่ง่ฒๅๅฏนๅบๆนๅ็งปๅจ=====
if keyboard.left:
... | Python | 1 |
dirty_mask &= !(1 << i);
}
}
#[derive(Clone)]
struct PipelineCache {
// Bound pipeline and root signature.
// Changed on bind pipeline calls.
pipeline: Option<(*mut d3d12::ID3D12PipelineState, *mut d3d12::ID3D12RootSignature)>,
// Paramter slots of the current root signature.
num_parameter_slot... | Rust | 0 |
import pytest
import pcobra # garantiza rutas para submรณdulos
from cobra.core import Lexer
from cobra.core import Parser
from core.interpreter import InterpretadorCobra
from core.ast_nodes import NodoLlamadaFuncion, NodoValor
from core.semantic_validators import PrimitivaPeligrosaError
def generar_ast(codigo: str):
... | Python | 1 |
od)
}
}
<filename>cli/eye_catchers.rs
use deno_runtime::colors;
use log::info;
pub fn check(message: &str) {
info!("{} {}", colors::green("Check"), message);
}
pub fn watcher(message: &str) {
info!("{} {}", colors::intense_blue("Watcher"), message);
}
pub fn emit(message: &str) {
info!("{} {}", colors::gr... | Rust | 0 |
import numpy as np
import pandas as pd
from interaction_times.collision_times import (
t_coll_disk,
t_coll_earth,
)
from helpers import get_base_dir
from disk_calcs.disk import DiskCalcs
AU_TO_M: float = 1.49597871e11
# https://www.doi.org/10.3847/2041-8213/aaae67 gives the
# number density of 'Oumuamua-like ... | Python | 1 |
as_slice());
assert_eq!(&lines[10..20], response_lines[1].as_slice());
assert_eq!(&lines[20..30], response_lines[2].as_slice());
}
#[tokio::test]
async fn s3_gzip() {
// Here, we're creating a bunch of events, approximately 3000, while setting our batch size
// to 1000, and ... | Rust | 0 |
let clip = clip.map(|clip| parse_r64(clip.as_ref())).transpose()?;
let only_forward = only_forward
.map(|text| parse_zero_one_bool(text.as_ref()))
.transpose()?
.unwrap_or(false);
let dont_update = dont_update
.map(|text| parse_zero_one_bool(text... | Rust | 0 |
it<u8>; MAX_READERNAME] = MaybeUninit::uninit_array();
let reader_name_pointer = reader_name.as_mut_ptr() as *mut c_char;
let mut read_name_length;
let mut state = MaybeUninit::uninit();
let state_pointer = state.as_mut_ptr();
let mut protocol = MaybeUninit::uninit();
let protocol_pointer = protocol.as_mut_... | Rust | 0 |
# Advent of Code 2024
# Dr Lee A. Christie
#
# GitHub: @leechristie
# Mastodon: @0x1ac@techhub.social
# Website: leechristie.com
import time
from grid import *
def day04() -> None:
start: float = time.perf_counter()
part1 = 0
part2 = 0
grid = CharacterGrid.read_character_grid('input04.txt')
... | Python | 1 |
>>> import narwhals as nw
>>> from narwhals.typing import IntoFrameT
>>> lf_native = pl.LazyFrame(
... {
... "a": ["a", "b", "a", "b", "c"],
... "b": [1, 2, 1, 3, 3],
... "c": [5, 4, 3, 2, 1],
...... | Python | 1 |
(rpc_caller): Extension<RpcCaller>,
);
req_trace = quote!(
tracing::info!("{:#?}", req_data);
tracing::info!("{:#?}", conf);
);
method_args = quote!(req_data, &conf.mode, rpc_caller);
} else {
req_input = quote!(
Extension(server_pid): Exte... | Rust | 0 |
rop_in_place(array);
}
array = array.add(1);
}
if heap {
let len_ptr = self.u.get() as usize as *mut usize;
*len_ptr -= removed;
} else {
self.set_stack_len(len - removed);
}
}
}
... | Rust | 0 |
e.null()?;
} else {
e.bytes(&party_u_nonce.unwrap())?;
}
if party_u_other == None {
e.null()?;
} else {
e.bytes(&party_u_other.unwrap())?;
}
e.array(PARTY_STRUCT_LEN)?;
if party_v_identity == None {
e.null()?;
} else {
e.bytes(&party_v_ide... | Rust | 0 |
e = ChunkState::MESH_UPDATED_ALL;
octree.update(
z_pos,
|state| *state = *state | MASK_ALL,
|_level, children, parent| {
let mask = if children.iter().all(|s| *s & MASK_ALL == MASK_ALL) {
MASK_ALL
} else {
MASK_SOME
};... | Rust | 0 |
from DreamAtlas import *
def make_noise_array(map_size, scale):
x_size, y_size = map_size
noise_array = np.zeros((x_size, y_size, 2), dtype=np.float32)
base_x, base_y = np.random.randint(1, 10000, size=2, dtype=np.int32)
for x in range(map_size[0]):
for y in range(map_size[1]):
v... | Python | 1 |
n for m in meta]
if self.cfg.metrics.text_consistency.use_gt:
y_pred = y
text_consistency.update(y_pred, texts, sizes, sample_rates)
if chroma_cosine is not None:
if self.cfg.metrics.chroma_cosine.use_gt:
... | Python | 1 |
atch index {
0 => 0,
1 => 0,
2 => 1,
3 => 2,
4 => 3,
_ => unreachable!()
},
|index| match index {
0 => 1,
1 => 4,
2 => 2,
3 => 3,
4 => 4,
_ => unreachable!()
... | Rust | 0 |
th args are now required,
# and a new optional arg "history" is both where and whether to print errors
# (both existing calls have been changed to pass it). [bruce 050913 hardcoded that arg to env.history.]
# This function only checks number of atoms, and assumes all atoms of the Part
# must be involved... | Python | 1 |
from abc import ABC, abstractmethod
from typing import List
from swarmauri_core.vectors.IVector import IVector # Assuming there's a base IVector interface for vector representations
class IDecompose(ABC):
"""
Interface for decomposing a vector into components along specified basis vectors.
This operation ... | Python | 1 |
atializer_name, "Android", source_dir_ARM_android, target_path_ARM_android)
copy_binary(constants.crossplatform_spatializer_name, "Android", source_dir_ARM64_android, target_path_ARM64_android)
copy_binary("HrtfDsp", "Windows", source_dir_x64_desktop, target_path_x64_desktop)
copy_binary("HrtfDsp", "Window... | Python | 1 |
ct(), best_model_file)
bestF = f
zerolog.logger.info('Training epoch %d finished.' % epoch)
torch.save(zerolog.model.state_dict(), last_model_file)
else:
if os.path.exists(last_model_file):
zerolog.logger.info('=== Final Model ===')
zerolog... | Python | 1 |
ain_graph=True)
grad, shape, has_grad = self._retrieve_grad()
grads.append(self._flatten_grad(grad, shape))
has_grads.append(self._flatten_grad(has_grad, shape))
shapes.append(shape)
return grads, shapes, has_grads
def _unflatten_grad(self, grads, shapes):
... | Python | 1 |
offset);
}
TypedVec::Integer(result)
}
fn to_raw(&self, elem: T) -> RawVal {
RawVal::Int(elem.to_i64().unwrap() + self.offset)
}
fn max_cardinality(&self) -> usize { self.maximum }
}
impl<'a, T: IntLike + IntVecType<T> + 'a> ColumnCodec for IntegerOffsetColumn<T> {
fn get_... | Rust | 0 |
1.polarity - op2.polarity).abs();
let trust_shift = -((dist as f64) / MAX_POS_TRUST_SHIFT_RANGE).powi(2) +
MAX_POS_TRUST_SHIFT;
trust_shift.round() as i32
}
}
#[derive(RustcDecodable, RustcEncodable, Debug, PartialEq, Clone)]
pub struct Media {
pub opinions: Vec<Opinio... | Rust | 0 |
qs.execute(query);
inner_buffer.clear();
}
};
RxCallback {
dst: dst,
inner: Box::new(inner),
}
},
};
Ok(cb)
}
/// A struct that functions as a callback for ticks in a generator.
pub struct ... | Rust | 0 |
st {
fn default() -> Self { unsafe { zeroed() } }
}
#[repr(C)]
#[derive(Copy)]
pub struct lcb_iovec_st {
pub iov_base: *mut c_void,
pub iov_len: size_t,
}
impl Clone for lcb_iovec_st {
fn clone(&self) -> Self { *self }
}
impl Default for lcb_iovec_st {
fn default() -> Self { unsafe { zeroed() } }
... | Rust | 0 |
(array, to_type),
(Float64, UInt16) => cast_numeric_arrays::<f64, u16>(array, to_type),
(Float64, UInt32) => cast_numeric_arrays::<f64, u32>(array, to_type),
(Float64, UInt64) => cast_numeric_arrays::<f64, u64>(array, to_type),
(Float64, Int8) => cast_numeric_arrays::<f64, i8>(array, to_... | Rust | 0 |
' "stop": false\n'
"}\n"
"Rules:\n"
"- Commands must be fully specified (no placeholders like TARGET).\n"
"- Return at most 3 commands per response.\n"
"- Set stop=true when no further autonomous action is appropriate.\n"
"- Keep analysis ... | Python | 1 |
illiM2",
/// `Square Millimetre Per Second`:
MilliM2_PER_SEC, "MilliM2-PER-SEC",
/// `Cubic Millimetre`:
MilliM3, "MilliM3",
/// `Cubic Millimetre Per Cubic Metre`:
MilliM3_PER_M3, "MilliM3-PER-M3",
/// `Quartic Millimetre`:
MilliM4, "MilliM4",
/// `Millimole`:
MilliMOL, "Mi... | Rust | 0 |
from client import DiffbotClient,DiffbotCrawl
from config import API_TOKEN
import pprint
import time
print("Calling article API endpoint on the url: http://shichuan.github.io/javascript-patterns/...\n")
diffbot = DiffbotClient()
token = API_TOKEN
url = "http://shichuan.github.io/javascript-patterns/"
api = "article"
r... | Python | 1 |
Data<&'a Field>,
}
impl<'a> ClassRef<'a> {
/// Returns if the type contains no fields
pub fn is_empty(self) -> bool {
self.fields.is_null()
}
/// Returns an iterator over the class' fields
pub fn field_iter(self) -> FieldIterator<'a> {
FieldIterator {
fields: self.field... | Rust | 0 |
from django.db import models
from django.db.models.query import QuerySet
from django.contrib.contenttypes.models import ContentType
class MarkedManager(models.Manager):
"Extra manager for objects that are marked"
def flagged(self):
ct = ContentType.objects.get_for_model(self.model)
return supe... | Python | 1 |
ata to predict.
Returns
-------
array-like of shape (n_samples, n_classes)
The predicted values.
"""
check_is_fitted(self, ["cfm_", "classes_", "estimator_"])
X = validate_data(self, X=X, dtype=FLOAT_DTYPES, reset=False)
preds = self.estimator_.predic... | Python | 1 |
le.TemporaryDirectory()
root_dir1 = root1.name
root_dir2 = root2.name
run_train(FLAGS.conf, root_dir1, FLAGS.rev1)
run_train(FLAGS.conf, root_dir2, FLAGS.rev2)
finally:
switch_branch(repo_root, current_branch)
cmd = ' '.join([
"diff", "-r", root_dir1 + "/train/al... | Python | 1 |
def my_gen1():
for i in range(5):
yield i
gen = my_gen1()
print(next(gen))
print(next(gen)) | Python | 1 |
st _ as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(_G_fpos_t),
"::",
stringify!(__pos)
)
);
assert_eq!(
unsafe { &(*(::std::ptr::null::<_G_fpos_t>())).__state as *const _ as usize },
8usize,
concat!(
... | Rust | 0 |
if torch.cuda.is_available() else 'cpu')
from settings import datasets_dir, models_dir, results_base_dir
args.results_base_dir = results_base_dir
args.datasets_dir = datasets_dir
if args.pretrained_model_path:
args.pretrained_model_path = os.path.join(models_dir, args.pretrained_model_path)
... | Python | 1 |
>, i64, Vec<QueryPlan<'b>>), QueryError> {
if exprs.len() == 1 {
QueryPlan::create_query_plan(&exprs[0], columns)
.map(|(gk_plan, gk_type)| {
let max_cardinality = QueryPlan::encoding_range(&gk_plan).map_or(1 << 63, |i| i.1);
let decoded_group_... | Rust | 0 |
struct JSONMessage {
pub timestamp: chrono::DateTime<chrono::Utc>,
pub peer: String,
pub address: Option<Multiaddr>,
pub received_entries: Option<Vec<JSONWantlistEntry>>,
pub full_want_list: Option<bool>,
pub peer_connected: Option<bool>,
pub peer_disconnected: Option<bool>,
pub connect_... | Rust | 0 |
0].shape[3], &inputs[2].shape[2])?; // hidden_size
}
if outputs.len() > 1 {
s.equals(&inputs[0].datum_type, &outputs[1].datum_type)?;
s.equals(&outputs[1].rank, 3)?;
s.equals(&outputs[1].shape[0], &inputs[1].shape[0])?; // num_directions
s.equals(&outputs[... | Rust | 0 |
from AllWhatsPy import AllWhatsPy, PseudoAWP
lista_ctt_numero = [21959061623, 219999999999987, 21959061623, 219999999999987, 21959061623]
# lista_ctt_numero = [21959061623]
texto = '''
Teste - {} - {}
endereco: {}
'''
AWP = AllWhatsPy()
AWP.conexao(server_host=True)
endereco = AWP.msg.endereco(24020110).retornar... | Python | 1 |
%s\tencountered: %d\tcurrent logloss: %f' % (
datetime.now(), t, loss/count))
print('Epoch %d finished, holdout logloss: %f, elapsed time: %s' % (
e, loss/count, str(datetime.now() - start)))
##############################################################################
# start... | Python | 1 |
#!/usr/bin/env python
'''
Leetcode: Implement strstr()
Returns a pointer to the first occurrence of needle in haystack, or null if needle is not part of haystack.
'''
from __future__ import division
import random
### KMP
def generate_overlap_table(P):
n = len(P)
overlap = {0:0}
for i in range(1,n): # consi... | Python | 1 |
# ๅธธ็จๆนๆณ
import json
from ctypes import windll
import numpy as np
import cv2
import sys
import os
import win32gui
from module.globals import GLOBALS
from module.log.TenchiLogger import logger
# ่ฏปๅๅพ็
def imread(filename, with_alpha=False):
"""ๅฐๅพ็่ฏปๅไธบnpๆฐ็ป"""
# ไฝฟ็จ np.fromfile ่ฏปๅๆฐๆฎ
data = np.fromfile(filename... | Python | 1 |
import numpy as np
from ml.plot.newer.column_strategy_sim.plotlatex_lib import plot_list_latex
from ml.plot.newer.column_strategy_sim.plotlatex_lib import plot_list
labels = [4, 14, 24, 34, 44, 54, 64, 74, 84, 94, 104, 114]
percent1 = [0.0, 0.013212257062751262, 0.05240922522078303, 0.048119029769886426, 0.1564231566... | Python | 1 |
: bool,
framework_name: String,
is_registered: bool, //TODO check if it is necessary
active_jobs: HashMap<usize, Job>,
active_job_queue: Vec<Job>,
taskid_to_jobid: HashMap<String, usize>,
taskid_to_slaveid: HashMap<String, String>,
job_tasks: HashMap<usize, HashSet<String>>,
slaves_with_... | Rust | 0 |
import pytest
import brownie
INITIAL_AMOUNTS = [24000 * 10**6, 10000 * 10**18, 10000 * 10**6, 10000 * 10**6]
@pytest.mark.parametrize("idx", range(4))
def test_add_single_coins(alice, crypto_zap, idx, token):
amounts = [0] * 4
amounts[idx] = INITIAL_AMOUNTS[idx]
calc_amount = crypto_zap.calc_token_amou... | Python | 1 |
from project.dark_wizard import DarkWizard
class SoulMaster(DarkWizard):
pass | Python | 1 |
'Actual')
plt.title('Confusion Matrix')
print(classification_report(y_true.argmax(axis=1), y_pred_labels.argmax(axis=1)))
plt.subplot(1, 4, 2)
for i in range(4):
fpr, tpr, _ = roc_curve(y_true[:, i], y_pred[:, i])
roc_auc = auc(fpr, tpr)
plt.plot(fpr, tpr, label=f'ROC ... | Python | 1 |
noqa: F722
time: float["b"] | float[""], # time step # noqa: F821 F722
drop_audio_cond, # cfg for cond audio
drop_text, # cfg for text
mask: bool["b n"] | None = None, # noqa: F722
):
batch, seq_len = x.shape[0], x.shape[1]
if time.ndim == 0:
time = ... | Python | 1 |
holidays::get_finados(year).into()
}
#[no_mangle]
pub unsafe extern "C" fn holiday_get_procration_of_the_republic(year: i32) -> Date {
holidays::get_procration_of_the_republic(year).into()
}
#[no_mangle]
pub unsafe extern "C" fn holiday_get_all(year: i32, holidays: *mut Vec<Holiday>) -> bool {
let holidays... | Rust | 0 |
different registers and comparing them
/// and then checking if we break at the right place.
#[test]
fn test_snevxvy() {
let (emu, tx, rx, _mockinput) = emulate(path::Path::new("testprograms/SNEVxVy/snevxvytest.bin"), false);
// Check that the PC is at the correct location
assert_p... | Rust | 0 |
: &CryptographicKey, parameters: &KeyDerivationParameters, desiredKeySize: u32) -> Result<Option<ComPtr<crate::windows::storage::streams::IBuffer>>> { unsafe {
let mut out = null_mut();
let hr = ((*self.lpVtbl).DeriveKeyMaterial)(self as *const _ as *mut _, key as *const _ as *mut _, parameters as *con... | Rust | 0 |
rence: &'a str) -> Option<&'a str> {
self.reference_regex()
.captures(reference)
.and_then(|c| c.get(1))
.map(|c| c.as_str())
}
fn cascade_delete(&self, reference: Option<&String>) -> DBResult<()> {
if let Some(id) = reference {
self.delete_by_ref... | Rust | 0 |
ine_low,threshLine_high,threshLeft,threshRight,failed+1)
def polyIntersect(poly1, poly2):
prevPoint = poly1[-1]
for point in poly1:
perpVec = np.array([ -(point[1]-prevPoint[1]), point[0]-prevPoint[0] ])
perpVec = perpVec/np.linalg.norm(perpVec)
maxPoly1=np.dot(perpVec,poly1[0... | Python | 1 |
_System_DesktopSharing\"`*"]
pub const RDPSRAPI_MOUSE_BUTTON_BUTTON1: RDPSRAPI_MOUSE_BUTTON_TYPE = 0i32;
#[doc = "*Required features: `\"Win32_System_DesktopSharing\"`*"]
pub const RDPSRAPI_MOUSE_BUTTON_BUTTON2: RDPSRAPI_MOUSE_BUTTON_TYPE = 1i32;
#[doc = "*Required features: `\"Win32_System_DesktopSharing\"`*"]
pub con... | Rust | 0 |
se super::tracker::Bind;
use super::handle::HandleAccess;
use super::context::{Context,RegistrationHandle,ContextEditingSupport};
use super::ShaderHandle;
use super::tracker::TrackerId;
pub use self::uniform::{SimpleUniformTypeFloat,SimpleUniformTypeI32,SimpleUniformTypeMatrix,SimpleUniformTypeU32};
pub use self::unif... | Rust | 0 |
num_params: NumParams::Any,
},
"in" => Operator {
symbol: "in",
operator: array::in_,
num_params: NumParams::Exactly(2),
},
"cat" => Operator {
symbol: "cat",
operator: string::cat,
num_params: NumParams::Any,
},
"substr" => Operator {
sy... | Rust | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.