text string | label_name string | labels int64 |
|---|---|---|
import time
import dgl
import dgl.function as fn
import numpy as np
import torch
from .. import utils
@utils.benchmark("time", timeout=600)
@utils.parametrize("graph_name", ["pubmed", "ogbn-arxiv"])
@utils.parametrize("format", ["coo"]) # only coo supports udf
@utils.parametrize("feat_size", [8, 64, 512])
@utils.... | Python | 1 |
new position from start of file.
fn seek(&self, pos: SeekFrom) -> Result<usize>;
}
pub type Result<T> = core::result::Result<T, Error>;
/// Definition of errors that might be returned by filesystem functionality.
#[derive(Clone,Copy,Debug,PartialEq)]
pub enum Error {
/// Error code was >=0, operation was suc... | Rust | 0 |
item_progress_new() -> *mut PkItemProgress;
pub fn pk_item_progress_get_package_id(item_progress: *mut PkItemProgress) -> *const c_char;
pub fn pk_item_progress_get_percentage(item_progress: *mut PkItemProgress) -> c_uint;
pub fn pk_item_progress_get_status(item_progress: *mut PkItemProgress) -> PkStatusEnu... | Rust | 0 |
2_PORT_PROPS_PREFIX: &'static [u8; 37usize] = b"http://lv2plug.in/ns/ext/port-props#\0";
pub const LV2_PORT_PROPS__causesArtifacts: &'static [u8; 52usize] =
b"http://lv2plug.in/ns/ext/port-props#causesArtifacts\0";
pub const LV2_PORT_PROPS__continuousCV: &'static [u8; 49usize] =
b"http://lv2plug.in/ns/ext/port-... | Rust | 0 |
return None
# Extract the values for both indicators
x_values = country.data.loc[indicator_x].dropna()
y_values = country.data.loc[indicator_y].dropna()
# Only keep years that are available in both indicators
common_years = x_values.index.intersection(y_values.ind... | Python | 1 |
.as_nanos() as u64
}
/// Events received by `Request` instances as pending dispatches are resolved
#[derive(Debug)]
pub enum RequestEvent {
Received(
String, // node alias
String, // message
Message, // parsed
),
Timeout(
String, // node_alias
),
}
/// Extende... | Rust | 0 |
it/537.36 (KHTML, like Gecko) Version/4.0 Chrome/92.0.4515.115 Mobile Safari/537.36',
'x-requested-with':'XMLHttpRequest',
'sec-fetch-site':'same-origin',
'sec-fetch-mode':'cors',
'sec-fetch-dest':'empty',
'referer':'https://traodoisub.com/ex/reaction/',
'accept-encoding':'gzip, deflate',
'accept-language':'vi-VN,vi;q=... | Python | 1 |
emory_utilization": 0.7,
"max_num_batched_tokens": 2048,
})
self.model = LLM(**vllm_kwargs)
logging.info("VLLM model initialized with conservative settings")
self.sampling_params = SamplingParams(
temperature=self.worker_config.temperature... | Python | 1 |
", "NQ6)YWV",
"4K3)WFZ", "4VT)SZH", "7C7)JKB", "FJJ)WP9", "FBZ)QRQ", "88W)RD6", "GPH)5VZ", "F17)7FJ",
"VWY)TWJ", "BRN)95K", "R55)LP8", "9K3)M4B", "NWD)JSX", "4NS)783", "6VH)D6T", "XYQ)BHN",
"3RY)MFX", "KGR)QGX", "1XH)MNS", "1TY)15L", "XWV)WJC", "JJN)8B3", "Y8L)Y7B", "FFQ)3SG",
"F77)Z5Z",... | Rust | 0 |
::ExchangeFromTo)
})
};
// 选择日期
let onselectdate: Callback<DateTime<Local>> = {
let dispatch = dispatch.clone();
Callback::from(move |day: DateTime<Local>|{
dispatch(Action::SelectDate(day));
dispatch(Action::ToggleDateSelect... | Rust | 0 |
import inspect
import re
# *********************************************************
# *********** THIS FILE IS FOR FACULTY USE ONLY ***********
# *********************************************************
def run_a_test(func, expected_result, *args):
actual_result = func(*args)
assert actual_result == expected... | Python | 1 |
PPP/RNBQKBNR b KQkq e3 0 1";
assert_eq!(fen, Fen::pos_to_str(&pos));
assert_eq!(
pos,
Fen::str_to_pos(&fen).unwrap(),
"\nExpected Position as FEN: {}\nActual Position as FEN: {}\n",
fen,
Fen::pos_to_str(&Fen::str_to_pos(&fen).unwrap())
... | Rust | 0 |
vals:
assert not torch.any((samples >= low.min()) & (samples <= high.max()))
def test_excised_categorical_all_excised_error_category_indices():
torch.manual_seed(0)
# Batch of 3 elements, 4 categories each
logits = torch.tensor(
[
[0.1, 0.2, 0.3, 0.4], # partial excision
... | Python | 1 |
single_twiddle(3, 11, inverse);
let twiddle4: Complex<T> = twiddles::single_twiddle(4, 11, inverse);
let twiddle5: Complex<T> = twiddles::single_twiddle(5, 11, inverse);
Butterfly11 {
twiddle1,
twiddle2,
twiddle3,
twiddle4,
twiddle5,
... | Rust | 0 |
= int(data['id'])
try:
return self._users[user_id]
except KeyError:
user = User(state=self, data=data)
self._users[user_id] = user
user._stored = True
return user
def deref_user(self, user_id: int) -> None:
self._users.pop(user_id... | Python | 1 |
pub fn FileSaveRestoreOnINFA(hwnd: super::super::Foundation::HWND, psztitle: ::windows_sys::core::PCSTR, pszinf: ::windows_sys::core::PCSTR, pszsection: ::windows_sys::core::PCSTR, pszbackupdir: ::windows_sys::core::PCSTR, pszbasebackupfile: ::windows_sys::core::PCSTR, dwflags: u32) -> ::windows_sys::core::HRESULT;
... | Rust | 0 |
::<GetAuthSessionTicketResponse_t>(),
4usize,
concat!("Alignment of ", stringify!(GetAuthSessionTicketResponse_t))
);
assert_eq!(
unsafe {
&(*(::std::ptr::null::<GetAuthSessionTicketResponse_t>())).m_hAuthTicket as *const _
as usize
},
0usize,
concat!(
"Offset of field: ",
stringify!(GetAuthS... | Rust | 0 |
rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [apb_saradc_sar1_status](apb_saradc_sar1_status) module"]
pub type APB_SARADC_SAR1_STATUS = crate::Reg<u32, _APB_SARADC_SAR1_STATUS>;
#[allow(missing_docs)]
#[doc(hidden)]
pub struct _APB_SARADC_SAR1_STATUS;
#[doc = "`read()` method re... | Rust | 0 |
OUNT_HASH_LENGTH},
key::KEY_HASH_LENGTH,
AccessRights, DeployHash, Key, PublicKey, TransferAddr, URef, DEPLOY_HASH_LENGTH,
TRANSFER_ADDR_LENGTH, U128, U256, U512, UREF_ADDR_LENGTH,
};
#[cfg(feature = "std")]
#[test]
fn json_schema() {
let json_clvalue_schema = schema_for... | Rust | 0 |
oc = "*Required features: `\"Win32_Security_WinTrust\"`, `\"Win32_Foundation\"`, `\"Win32_Security_Cryptography_Catalog\"`, `\"Win32_Security_Cryptography_Sip\"`*"]
#[cfg(all(feature = "Win32_Foundation", feature = "Win32_Security_Cryptography_Catalog", feature = "Win32_Security_Cryptography_Sip"))]
pub fn Wint... | Rust | 0 |
from typing import Any, TypeVar, Union
from attrs import define as _attrs_define
from attrs import field as _attrs_field
from ..types import UNSET, Unset
T = TypeVar("T", bound="Userv2AddtorpmResponse200BodyUserHeight")
@_attrs_define
class Userv2AddtorpmResponse200BodyUserHeight:
"""
Attributes:
t... | Python | 1 |
).min(max.z);
if t_min <= t_max {
Some((t_min, t_max))
} else {
None
}
*/
}
#[cfg_attr(rustfmt, rustfmt_skip)]
pub fn fast_hit(
&self,
origin: &Vct,
inv_direct: &Vct,
neg_index: &[bool; 3],
) -> Option<(Flt, Flt)> {... | Rust | 0 |
~[MeshCoord(3), MeshCoord(4)]);
let left_side = lesser_side_face_perp_to_axis(Dim(0));
let right_side = greater_side_face_perp_to_axis(Dim(0));
let bottom_side = lesser_side_face_perp_to_axis(Dim(1));
let top_side = greater_side_face_perp_to_axis(Dim(1));
as... | Rust | 0 |
5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,
0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,
0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,
0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7,... | Rust | 0 |
, 5, 8, 8, 8, 1, 7, 8, 4, 1, 9, 7, 0, 0, 1, 2, 5, 2, 3, 2, 3, 3,
8, 9, 0, 5, 3, 3, 4, 4, 7, 2, 6, 5, 6, 2, 5, 4, 4, 4, 0, 8, 9, 2, 0, 9, 8, 5, 0, 0, 6, 2,
6, 1, 6, 1, 6, 9, 4, 5, 2, 6, 6, 7, 2, 3, 6, 3, 2, 8, 1, 2, 5, 2, 2, 2, 0, 4, 4, 6, 0, 4,
9, 2, 5, 0, 3, 1, 3, 0, 8, 0, 8, 4, 7, 2, 6, 3, 3, ... | Rust | 0 |
_base_ = './cascade_mask_rcnn_hrnetv2p_w32_20e_coco.py'
# model settings
model = dict(
pretrained='open-mmlab://msra/hrnetv2_w18',
backbone=dict(
extra=dict(
stage2=dict(num_channels=(18, 36)),
stage3=dict(num_channels=(18, 36, 72)),
stage4=dict(num_channels=(18, 36, ... | Python | 1 |
from swgpy.object import *
from swgpy.command import BaseSwgCommand
from swgpy import ACTION
class PeaceCommand(BaseSwgCommand):
def getCommandName(self):
return 'peace'
def run(self):
actor = self.getActor()
target = self.getTarget()
if actor.hasState(ACTION.COMBAT):
... | Python | 1 |
ELECT_CARD_CMD: Command<CmdR1R6, NoFlag> = Command {
number: 7,
response: CmdR1R6,
flag: NoFlag,
};
// MMC Cmd8(adtc, R1): Send EXT_CSD register as a block of data
pub const MMC_CMD8_SEND_EXT_CSD: Command<CmdR1R6, SingleBlock> = Command {
number: 7,
response: CmdR1R6,
flag: SingleBlock,
};
// S... | Rust | 0 |
mReflect for #name {
// fn mz_enum_reflect() ->
// std::collections::HashMap<
// &'static str,
// (Vec<&'static str>, Vec<&'static str>)
// >
// {
// use std::collections::HashMap;
// let mut result = HashMap::new();
// // repeat line below... | Rust | 0 |
# -*- coding: utf-8 -*-
"""Backtrader 整合模組
此模組提供與 Backtrader 回測框架的整合功能,包括:
- 資料饋送轉換
- 策略包裝
- 回測執行
- 結果分析
"""
import json
import logging
import os
from datetime import datetime
from typing import Any, Dict, Optional, Union
import backtrader as bt
import backtrader.analyzers as btanalyzers
import backtrader.feeds as b... | Python | 1 |
::Default, ())?); }
panic!("expected overflow_allocs::index_loop_alloc_size(0x{:08x}) to fail before collecting 1000 allocs", alloc);
}
fn vertex_loop_alloc_size(alloc: u32) -> Result<(), MethodError> {
let device = device_pure();
let mut vbs = Vec::new();
... | Rust | 0 |
KSUKI => Self::Bhaiksuki,
ffi::G_UNICODE_SCRIPT_MARCHEN => Self::Marchen,
ffi::G_UNICODE_SCRIPT_NEWA => Self::Newa,
ffi::G_UNICODE_SCRIPT_OSAGE => Self::Osage,
ffi::G_UNICODE_SCRIPT_TANGUT => Self::Tangut,
ffi::G_UNICODE_SCRIPT_MASARAM_GONDI => Self::MasaramGo... | Rust | 0 |
let d =
match edge.direction {
Direction::X => Vector3::new(1, 0, 0),
Direction::Y => Vector3::new(0, 1, 0),
Direction::Z => Vector3::new(0, 0, 1),
};
let p1 = p0 + d;
[
voxel_data::bounds::new(p0.x, p0.y, p0.z, edge.lg_size),
voxel_data::bounds::new(p1.x, p1... | Rust | 0 |
s.iter().map(|index| tuple[*index].clone()).collect::<Vec<_>>(),
tuple
.into_iter()
.enumerate()
.filter(|(index,_value)| !keys.contains(index))
.map(|(_index,value)| value)
... | Rust | 0 |
for name in names {
self.register_local_var(name.clone());
}
}
fn compile_branch_condition(&mut self, mut reg: usize, expr: &ExprNode,
thenlabel: i32, elselabel: i32, hasnextcond: bool) {
let startline = start_line(expr);
let (flip, j... | Rust | 0 |
p = &p[16..];
}
}
h32 = acc1
.rotate_left(1)
.wrapping_add(acc2.rotate_left(7))
.wrapping_add(acc3.rotate_left(12))
.wrapping_add(acc4.rotate_left(18));
} else {
h32 = seed.wr... | Rust | 0 |
#
# file: sentiment_train.npy
#
# Train a model using the sentiment embeddings
#
# RTK, 27-Feb-2024
# Last update: 28-Feb-2024
#
# Results (nomic-embed-text) (64 mb 30 ep)
# Test set accuracy: 0.8085, MCC: 0.6167
# [[782 194]
# [189 835]]
#
################################################################
... | Python | 1 |
from django.urls import path
from . import views
urlpatterns = [
path('', views.patient_list, name='patient_list'),
path('add/', views.add_patient, name='add_patient'),
path('edit/<int:pk>/', views.edit_patient, name='edit_patient'),
path('delete/<int:pk>/', views.delete_patient, name='delete_patient')... | Python | 1 |
ntent".to_string(), format!("{}{}{}", '"', model.content.to_string(), '"'));
h.insert("post_id".to_string(), model.post_id.to_string());
h
}
fn name() -> &'static str {
"comments"
}
}
impl RelationName for Comment {
fn relation_name() -> &'static str {
"comments"
... | Rust | 0 |
main
Custom network format: chain_name:chain_id
Such as:
my_chain:123 will init a new chain with id `123`.
Custom network first start should also set the `genesis-config` option.
Use starcoin_generator command to generate a genesis config."#;
#[derive(Clone, Debug, StructOpt, Default, Serialize,... | Rust | 0 |
from module import myFunc
# check module.py as it is connected to it .. | Python | 1 |
# cook your dish here
n=int(input())
if n%3==0:
print(0)
else:
print(1)
| Python | 1 |
))
.and(data.lanes_mut(axis))
.for_each(|mut results, mut data| {
let index_map =
get_many_from_sorted_mut_unchecked(&mut data, &searched_indexes);
for (result, &q) in results.iter_mut().zip(qs) {
let... | Rust | 0 |
icU64; 0, 1];
let _: BitBox<Msb0, AtomicU64> = bitbox![Msb0, AtomicU64; 0, 1];
let _: BitBox<LocalBits, AtomicU64> = bitbox![LocalBits, AtomicU64; 1; 100];
let _: BitBox<Lsb0, AtomicU64> = bitbox![Lsb0, AtomicU64; 1; 100];
let _: BitBox<Msb0, AtomicU64> = bitbox![Msb0, AtomicU64; 1; 100];
}
}
}
#[test]
... | Rust | 0 |
retchRectEx = 0x22de03aa,
NvAPI_D3D9_ClearRT = 0x332d3942,
NvAPI_D3D_CreateQuery = 0x5d19bca4,
NvAPI_D3D_DestroyQuery = 0x0c8ff7258,
NvAPI_D3D_Query_Begin = 0x0e5a9aae0,
NvAPI_D3D_Query_End = 0x2ac084fa,
NvAPI_D3D_Query_GetData = 0x0f8b53c69,
NvAPI_D3D_Query_GetDataSize = 0x0f2a54796,
NvAPI_D3D_Query_GetType = 0x4aceea... | Rust | 0 |
s[: len(true_refs)])
# rouge2_incorrect = np.nanmax(rouge2_scores[len(true_refs) :])
# rouge2_max = rouge2_correct
# rouge2_diff = rouge2_correct - rouge2_incorrect
# rouge2_acc = int(rouge2_correct > rouge2_incorrect)
# # ROUGE-L
# rougeL_scores = [score["rougeLsum"] for score in rouge_scores]
... | Python | 1 |
always)]
pub fn bits(self, value: u8) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x03 << 8)) | ((value as u32 & 0x03) << 8);
self.w
}
}
#[doc = "Address space: 0x4010_3000 - 0x4010_3FFF\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
#[repr(u8)]
pub enum SRAM_SECT_3_RULE_A {
... | Rust | 0 |
::Debug for GESEffectClip {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GESEffectClip @ {:?}", self as *const _))
.finish()
}
}
#[repr(C)]
#[derive(Copy, Clone)]
pub struct GESFormatter {
pub parent: gobject::GInitiallyUnowned,
pub priv... | Rust | 0 |
gate_short"] = bool(short_mask[i])
row["gate_any"] = row["gate_long"] or row["gate_short"]
row["bar_idx"] = int(i)
rows.append(row)
if len(rows) >= 100000:
df_chunk = pd.DataFrame(rows)
chunk_name = f"{file_prefix}_part{chunk_id}.csv"
path = os.pa... | Python | 1 |
patch_size=14,
image_size=336,
num_hidden_layers=24,
num_attention_heads=16,
vocab_size=32000,
projection_dim=768,
)
if isinstance(text_config, dict):
text_config["model_type"] = text_config["... | Python | 1 |
rmation.
#[inline]
pub fn from_seed(seed: u64) -> Random<$ty> {
SeedRng::from_seed(seed)
}
}
}
}
//----------------------------------------------------------------
// Random number generators
mod splitmix64;
pub use self::splitmix64::SplitMix64;
mod xoshiro256;
pub use self::xoshiro256::Xoshiro256;
... | Rust | 0 |
use Error;
use StringExt;
pub struct ArrayIter<'a>{
array_iter:std::iter::Filter<std::str::Split<'a,char>, fn(&& str) -> bool>,
name:&'static str,
}
impl<'a> ArrayIter<'a> {
pub fn new(text:&'a String, size:usize, name:&'static str) -> Self {
fn is_not_empty(s:&&str) -> bool {
*s!=""
... | Rust | 0 |
er at the end
@property
def screen_count(self):
return len(self.tile_data) // WORLD_MAP_SCREEN_SIZE
@screen_count.setter
def screen_count(self, new_screen_count):
diff = new_screen_count - self.screen_count
if new_screen_count > self.screen_count:
new_tile_data = W... | Python | 1 |
id"
class SwitchFontStyle(enum.Enum):
NORMAL = "normal"
ITALIC = "italic"
class SwitchFontWeight(enum.Enum):
NORMAL = "normal"
BOLD = "bold"
class SwitchLabelSide(enum.Enum):
TOP = "top"
LEFT = "left"
CENTER = "center"
BOTTOM = "bottom"
RIGHT = "right"
class SwitchSwitchStyle(enum.Enum):
TOG... | Python | 1 |
import psycopg2
dbconnect = psycopg2.connect()
cursor = dbconnect.cursor()
cursor.execute(запрос)
cursor.fetchone() | Python | 1 |
agent_name}/start")
async def start_agent(agent_name: str, username: str):
"""Start an agent"""
return await manager.start_agent(agent_name, username)
@app.post("/agents/{agent_name}/stop")
async def stop_agent(agent_name: str, username: str):
"""Stop an agent"""
return await manager.stop_agent(agent_n... | Python | 1 |
you cannot use
/// [`mem::replace`] on data wrapped inside a [`Pin<P>`] because you cannot get the
/// `&mut T` you need for that, and *that* is what makes this system work.
///
/// So this, for example, can only be done on types implementing `Unpin`:
///
/// ```rust
/// use std::mem;
/// use std::pin::Pin;
///
/// le... | Rust | 0 |
);
pub const CYAN: crate::Color = crate::Color::Idx(6);
pub const LIGHTGREY: crate::Color = crate::Color::Idx(7);
pub const DARKGREY: crate::Color = crate::Color::Idx(8);
pub const LIGHTRED: crate::Color = crate::Color::Idx(9);
pub const LIGHTGREEN: crate::Color = crate::Color::Idx(10);
pub const LIGHTYELLOW: crate::Co... | Rust | 0 |
1b,0x1b,0x1b,0x1b,0x1b,0x1b,],
pt: [0xc2,0x0f,0x81,0x4a,0xc3,0xdc,0x42,0x1b,0x98,0x48,0xcf,0x77,0x10,0xd5,0xfe,0xd5,],
ct: [0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,0x1b,]
},
Aes256Test {
key: [0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,... | Rust | 0 |
from .activations import get_activations
DEFAULT_FIXED_HP = {
# SCMPrior
"mix_probs": (0.7, 0.3),
# TreeSCM
"tree_model": "xgboost",
"tree_depth_lambda": 0.5,
"tree_n_estimators_lambda": 0.5,
# Reg2Cls
"balanced": False,
"multiclass_ordered_prob": 0.0,
"cat_prob": 0.2,
"max... | Python | 1 |
"int32": dtype(int32),
"int64": dtype(int64),
"uint8": dtype(uint8),
"uint16": dtype(uint16),
"uint32": dtype(uint32),
"uint64": dtype(uint64),
"float32": dtype(float32),
"float64": dtype(float64),
... | Python | 1 |
tval: libc::c_int = 0;
let mut optlen = mem::size_of::<libc::c_int>() as libc::socklen_t;
syscall!(getsockopt(
socket,
libc::SOL_SOCKET,
libc::SO_REUSEADDR,
&mut optval as *mut _ as *mut _,
&mut optlen,
))?;
Ok(optval != 0)
}
#[cfg(all(unix, not(any(target_os =... | Rust | 0 |
for ξ_ in gauss_integral_points:
for η_ in gauss_integral_points:
K_e += integrand.subs({ξ: ξ_, η: η_})
K_e = K_e * t
print("K_e")
# pprint(sp.simplify(K_e / E / t * (1 - ν**2)))
# TODO: This produces a matrix of matrices rather than a list that then gets summed
# K_e: sp.M... | Python | 1 |
from src.adjustment.backdoor_adjustment import BackdoorAdjustment as BD
from src.inference.utils.graph_utils import GraphUtils as gu
from src.inference.utils.set_utils import SetUtils as su
from src.inference.utils.probability_utils import ProbabilityUtils as pu
from src.inference.utils.expression_utils import Express... | Python | 1 |
a,b,c,d = map(int, input().split())
xarea = a*b
yarea=c*d
print(max(xarea,yarea))
| Python | 1 |
soid
R = E.a
s = sin(radians(y))
y = atanh(s) # == log(tand((90 + lat) / 2)) == log(tanPI_2_2(radians(lat)))
if E.es:
y -= E.es_atanh(s) # strictly, WGS84 only
y *= R
x = R * radians(x)
r = EasNorRadius3Tuple(x, y, R, name=n) if Wm is None else \
Wm(x, y,... | Python | 1 |
rng: &mut T,
blind_rng: Option<&mut S>,
priv_key: &SK,
hashed: &[u8],
salt_len: Option<usize>,
digest: &mut dyn DynDigest,
) -> Result<Vec<u8>> {
let salt_len = salt_len.unwrap_or_else(|| priv_key.size() - 2 - digest.output_size());
let mut salt = vec![0; salt_len];
rng.fill(&mut sal... | Rust | 0 |
}
} else {
false
}
}
fn convert_item(tcx: TyCtxt<'_>, item_id: hir::HirId) {
let it = tcx.hir().expect_item(item_id);
debug!("convert: item {} with id {}", it.ident, it.hir_id);
let def_id = tcx.hir().local_def_id(item_id);
match it.kind {
// These don't define types.
hi... | Rust | 0 |
new(vec![9; 6]));
}
#[test]
fn test_u8_vec_bit_input_capacity(){
test_input_capacity_1(&mut U8VecBitInput::new(vec![10; 1]));
test_input_capacity_2(&mut U8VecBitInput::new(vec![2; 5]));
test_input_capacity_3(&mut U8VecBitInput::new(vec![9; 6]));
}
#[test]
fn test_u8_vec... | Rust | 0 |
bins : int | None, optional
Number of bins in the histogram, by default None which uses Sturge's
Rule to determine the number bins
Returns
-------
dict[str, Axes]
"""
if isinstance(data, list):
data = concat(data, axis=1)
df = data.dropna(how="any")
columns = d... | Python | 1 |
ensure_ascii=False,
)
# 2. 处理 nonebot 环境变量
if load_to_nonebot_env:
try:
driver = nonebot.get_driver()
# 获取 nonebot 环境变量名
nb_env_name = schema_extra.get("load_nbenv_as", field_name)
... | Python | 1 |
according to the terms contained in the COPYRIGHT file.
// Copyright © 2019 The developers of linux-epoll. See the COPYRIGHT file in the top-level directory of this distribution and at https://raw.githubusercontent.com/lemonrock/linux-epoll/master/COPYRIGHT.
use super::*;
/// HTTP CONNECT proxy wrapping factories.
... | Rust | 0 |
Elapsed time: {}.{}", elapsed.as_secs(), elapsed.subsec_millis());
}
<gh_stars>100-1000
// run-pass
#![allow(const_err)]
// compile-flags: -O
fn main() {
let x = &(0u32 - 1);
assert_eq!(*x, u32::max_value())
}
<filename>protocols/ping/src/protocol.rs
// Copyright 2018 Parity Technologies (UK) Ltd.
//
// Permi... | Rust | 0 |
_text
ax.text(*label_location, label, fontsize=fontsize, color=colors[-1])
def plot_errorbar(ax, x, x_err, y, y_err, offset, log):
if log:
y *= offset
y_err *= offset
else:
y += offset
p = ax.errorbar(
x,
y,
yerr=y_err,
xerr=x_err,
mark... | Python | 1 |
assert!(build_and_roundtrip(50).is_ok());
assert!(build_and_roundtrip(51).is_err());
}
#[test]
fn test_deep_nesting_repeated() {
fn build_and_roundtrip(depth: usize) -> Result<(), prost::DecodeError> {
use crate::nesting::C;
let mut c = C::default();
f... | Rust | 0 |
Array").as_callee(),
args: vec![expr.as_arg()],
type_args: Default::default(),
})
.as_arg(),
);
}
None => tmp_arr.push(Some(expr.as_arg())),
}
}... | Rust | 0 |
=> Ok(SecModOps::FLAGS),
"sh_addr" => Ok(SecModOps::ADDR),
"sh_offset" => Ok(SecModOps::OFFSET),
"sh_size" => Ok(SecModOps::SIZE),
"sh_link" => Ok(SecModOps::LINK),
"sh_info" => Ok(SecModOps::INFO),
"sh_addralign" => Ok(SecModOps::ADDRALIGN),
"sh_entsize" => Ok(S... | Rust | 0 |
"""
If an update/delete request is marked as expecting an async callback, we fire the initial requests
then raise an AwaitingAsyncTask exception
"""
# Build proper erasure tasks
connector: SaaSConnector = get_connector(saas_async_example_connection_config)
# Mock ... | Python | 1 |
}
}
}
impl VEOffloadArgument<i32> for VEOffload {
unsafe fn args_set(args: VeoArgsRef, argnum: isize, val: i32) {
let ret = veo_args_set_i32(args, argnum as c_int, val as i32);
if ret < -1 {
panic!("cannot set veo args");
}
}
}
impl VEOffloadArgument<u32> for VEOff... | Rust | 0 |
));
let flags = PageTableFlags::PRESENT | PageTableFlags::WRITABLE;
unsafe {
page_table
.map_to(page, frame, flags, frame_allocator)
.expect("Failed to map physical memory")
.flush();
}
}
}
/// Map ELF file
///
/// for each segment... | Rust | 0 |
ata.clamp_(-0.01, 0.01)
return losses
def compute_gradient_penalty(self, D, real_samples, fake_samples, face_features):
"""Calculates the gradient penalty loss for WGAN GP"""
# Random weight term for interpolation between real and fake samples
alpha = torch.Tensor(torch.rand(real_s... | Python | 1 |
last_exon_ids:
nodes_ab_status[gi][ni]['cap'] = node['in_aboundance']+node['through_aboundance']
else:
nodes_ab_status[gi][ni]['cap'] = node['out_aboundance']+node['through_aboundance']
return nodes_ab_status
def merge_data(input_file_path, graphx):
# 使用defau... | Python | 1 |
class Solution(object):
def equalFrequency(self, word):
# making a dictionary of frequency count of each character
dict = {}
for ch in word:
if ch not in dict:
dict[ch] = 1
else:
dict[ch] += 1
# dictionary converted to list and... | Python | 1 |
import numpy as np
import argparse
import rust_bpe
from ecg_byte.utils.tokenizer_utils import normalize_all, load_vocab_and_merges, track_encoding
from ecg_byte.utils.viz_utils import generate_distinct_colors, visualize_bpe_encoding
def get_args():
parser = argparse.ArgumentParser(description=None)
parser.add... | Python | 1 |
;
return tx;
}
fn create_transaction2(opt: &Opt) -> Tx2 {
let mut address: Address = Default::default();
let decoded_address = hex::decode(&opt.sender().out_address()).unwrap();
address.copy_from_slice(&decoded_address);
Tx2 {
nonce: 2u128,
gas_price: opt.sender().gas_price(),
... | Rust | 0 |
#[structopt(name = "validate")]
/// validate that one or more cmx files are valid
Validate {
#[structopt(name = "FILE", parse(from_os_str))]
/// files to process
files: Vec<PathBuf>,
#[structopt(long = "extra_schema", parse(from_str = "parse_extra_schema_arg"))]
/// ... | Rust | 0 |
=W> + Send>) -> Result<(), Error>
where W: Write + Sized
{
let color = match record.level() {
Level::Error => color::RED,
Level::Warn => color::YELLOW,
Level::Info => color::BLUE,
Level::Debug => color::CYAN,
Level::Trace => color::WHITE
... | Rust | 0 |
None => nil(),
Some(s) => " as ".to_doc().append(s.clone()),
})
}
}
fn label(label: &Option<String>) -> Document {
match label {
Some(s) => s.clone().to_doc().append(": "),
None => nil(),
}
}
impl Documentable for &BinOp {
fn to_doc(self) -> Document {
matc... | Rust | 0 |
);
mat!(match_basic_45, r"aba|bab|bba", r"baaabbbaba", Some((5, 8)));
mat!(match_basic_46, r"aba|bab", r"baaabbbaba", Some((6, 9)));
mat!(match_basic_47, r"(aa|aaa)*|(a|aaaaa)", r"aa", Some((0, 2)), Some((0, 2)));
mat!(match_basic_48, r"(a.|.a.)*|(a|.a...)", r"aa", Some((0, 2)), Some((0, 2)));
mat!(match_basic_49, r"ab... | Rust | 0 |
(f"回到上一层递归,当前访问节点为 {curr_node},开始判断步骤(6)")
if n < k or np.abs(curr_node.data[cmp_dim] - point[cmp_dim]) < \
self.distance(point, k_nearest_nodes[-1].data, self.p):
logging.info(
f"** 被搜索点到当前节点划分维度的距离小于列表中最后一个元素到被搜索点的距离,即 "
f"|{curr_... | Python | 1 |
append(ip4.group("ip4"))
continue
ip6 = self.ip6_re.match(line)
if ip6:
data.setdefault(cur_iface, {}).setdefault("ip6", []).append(ip6.group("ip6"))
continue
return data
def _check_blacklist(self, string, blacklist):
for ign... | Python | 1 |
pub enum ADC_DCCTL5_CTMR {
#[doc = "Always"]
ADC_DCCTL5_CTM_ALWAYS,
#[doc = "Once"]
ADC_DCCTL5_CTM_ONCE,
#[doc = "Hysteresis Always"]
ADC_DCCTL5_CTM_HALWAYS,
#[doc = "Hysteresis Once"]
ADC_DCCTL5_CTM_HONCE,
}
impl ADC_DCCTL5_CTMR {
#[doc = r"Value of the field as raw bits"]
#[in... | Rust | 0 |
import numpy as np
from PIL import Image
from simple_lama_inpainting import SimpleLama
from layerd.models.inpaint.base import BaseInpaint
class LamaInpaint(BaseInpaint):
"""LaMa inpainting model wrapper following the BaseInpaint interface."""
def __init__(self, device: str = "cpu") -> None:
super().... | Python | 1 |
fastapi.responses import PlainTextResponse
# Получаем платеж
payment = db.query(Payment).filter(Payment.id == payment_id).first()
if not payment:
raise HTTPException(
status_code=status.HTTP_404_NOT_FOUND,
detail="Платеж не найден"
... | Python | 1 |
(OPCODE_LENGTH) as i8
} else {
0
} as u32;
emu.eip = (Wrapping(emu.eip + OPCODE_LENGTH + IMM8_LENGTH) + Wrapping(diff)).0;
}
/// 7F cb : jg rel8
pub fn jg_rel8(emu: &mut emulator::Emulator) {
let diff = if emu.is_zero() || emu.is_sign() != emu.is_overflow() {
0
} else {
emu.... | Rust | 0 |
0);
}
pub fn run_search(&mut self, lines: Vec<String>, initial_query: Option<String>) -> Option<String> {
let height = min(20, self.height);
let mut search = Search::blank(&lines, initial_query, height);
self.clear(height);
while !search.is_done() {
self.print(&se... | Rust | 0 |
up_cfg(args)
default_setup(cfg, args)
model = build_model(cfg)
if cfg.SYNC_BN:
model = torch.nn.SyncBatchNorm.convert_sync_batchnorm(model)
logger.info("Model:\n{}".format(model))
distributed = comm.get_world_size() > 1
if distributed:
model = DDP(model,
devi... | Python | 1 |
# -*- coding: utf-8 -*-
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright (C) 2014-2025 GEM Foundation
#
# OpenQuake 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 Licen... | Python | 1 |
let entropy = (name, index).using_encoded(blake2_256);
T::AccountId::decode(&mut &entropy[..]).unwrap_or_default()
}
// Adds `r` registrars to the Identity Pallet. These registrars will have set fees and fields.
fn add_registrars<T: Trait>(r: u32) -> Result<(), &'static str> {
for i in 0..r {
let _ = T::Currency... | Rust | 0 |
import numpy as np
from numpy.testing import assert_equal
from rdkit.Chem import MolFromSmiles
from rdkit.Chem.rdMolDescriptors import GetMACCSKeysFingerprint
from scipy.sparse import csr_array
from skfp.fingerprints import MACCSFingerprint
def test_maccs_bit_fingerprint(smiles_list, mols_list):
maccs_fp = MACCS... | Python | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.