text string | label_name string | labels int64 |
|---|---|---|
import sys
from pylearn2.utils.string_utils import number_aware_alphabetical_key
ignore, model_path = sys.argv
from pylearn2.utils import serial
model = serial.load(model_path)
keys = model.monitor.channels.keys()
kls = [ key for key in keys if key.startswith('trunc_KL_') ]
kls.sort(key = number_aware_alphabetica... | Python | 1 |
);
//!
//! // Test the api as necessary.
//! }
//! ```
//!
//! This will build the example and return the path to the compiled library.
//!
//! The second way is to build a file as a cdylib, e.g.
//!
//! ```rust
//! #[test]
//! fn api_gen_test() {
//! let dylib_path = test_cdylib::build_path("tests/cdylib/api_t... | Rust | 0 |
16),
/// The label type was invalid.
#[fail(display="{}", _0)]
BadType(LabelTypeError),
/// The bytes slice was too short.
#[fail(display="unexpected end of input")]
ShortBuf,
}
impl From<LabelTypeError> for SplitLabelError {
fn from(err: LabelTypeError) -> SplitLabelError {
Split... | Rust | 0 |
#%%
#kütüphanelerin yüklenmesi
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import StandardScaler
from sklearn.linear_model import LinearRegression
from sklearn import preprocessing
from sklearn.impute import Simpl... | Python | 1 |
from odoo import models, fields, api
class PurchaseOrder(models.Model):
_inherit = 'purchase.order'
| Python | 1 |
une_pending_deploys(
deploys: &mut HashMap<DeployHash, (DeployInfo, Timestamp)>,
current_instant: Timestamp,
) -> Vec<DeployHash> {
hashmap_drain_filter_in_place(deploys, |(deploy_info, _)| {
deploy_info.header.expired(current_instant)
})
}
#[cfg(test)]
mod tests {
use crate::{testing, test... | Rust | 0 |
re_projection(pair.mix.features)
scores_c = self.score_projection(feats_c)
feats_gnn_norm = torch.nn.functional.normalize(feats_c, p=2, dim=1).squeeze(0).transpose(0, 1) # [N, C]
feats_gnn_raw = feats_c.squeeze(0).transpose(0, 1)
scores_c_raw = scores_c.squeeze(0).transpose(0, 1) # [N,... | Python | 1 |
if z >= m { self.reduce(z - m) }
else { FieldElem { limbs: z } }
} else { FieldElem { limbs: z } }
}
fn unserialize(&self, s: &Vec<uint>) -> FieldElem<P192> {
self.reduce(unserialize(s))
}
}
#[deriving(Clone, Default)]
pub struct R192;
impl Field for R192 {
fn... | Rust | 0 |
e if `nodes` is the shortest path and will need to play the challenge
/// game again to determine to determine this.
#[pallet::weight(T::WeightInfo::missed_in_hashs())]
#[transactional]
pub fn missed_in_hashs(
origin: OriginFor<T>,
target: T::AccountId,
... | Rust | 0 |
Check the model values, as they get convolved through the
# response, and then filtered and grouped (since using the
# modelplot from a fit rather than from get_model_plot, which is
# ungrouped).
#
assert len(mp.y) == NBINS
# Values from XSPEC:
#
assert mp.y[0] == pytest.approx(7.780754... | Python | 1 |
2)
# If the targets are too close, repel each other
#
if distance < self.r + other_target.r:
self.vx += dist_x * 0.01 # Adjust the repulsion force as needed
self.vy += dist_y * 0.01
other_target.vx -= dist_x * 0.01
other_target.vy -= dist_y * 0.01
def hit(self, points=1):
canv.co... | Python | 1 |
import contextlib
class Config:
enable_backprop = True
train = True
@contextlib.contextmanager
def using_config(name, value):
old_value = getattr(Config, name)
setattr(Config, name, value)
try:
yield
finally:
setattr(Config, name, old_value)
def no_grad():
return using_... | Python | 1 |
Vec<String> = env::args().collect();
let program = args[0].clone();
match args.len() {
2 => {
let input: String = args[1].to_string();
solver::solve(input)?;
Ok(())
}
_ => {
usage(&program);
Err("program need ONE argument!")
... | Rust | 0 |
lifetime(
"t1, t2, self.x -> (0)"
)]
fn demo7t_0(&self, t1: &T, t2: &T) -> &T {
&[t1, t2].iter().min().unwrap()
}
}
#[lifetime(
// "x -> Output![Demo7T,0].new/x, Output![Demo7T,1].new/x"
)]
fn demo7c<T, U1: Demo7T<T>, U2: Demo7T<T>>(x: &T, y: &T) -> (U1, U2)
where
T: Ord,
{
(U1:... | Rust | 0 |
esses paths relative to `self`.
///
/// XXX: This function is not yet implemented.
///
/// [`async_std::os::unix::net::UnixDatagram::connect`]: https://docs.rs/async-std/latest/async_std/os/unix/net/struct.UnixDatagram.html#method.connect
#[cfg(unix)]
#[inline]
pub fn connect_unix_datagram<P... | Rust | 0 |
# one token at a time. This makes more sense than truncating an equal percent
# of tokens from each, since if one sequence is very short then each token
# that's truncated likely contains more information than a longer sequence.
while True:
total_length = len(tokens_a) + len(tokens_b)
if to... | Python | 1 |
self.focus = Some(FocusTarget::Id(id));
}
/// Clears the focus for the next frame.
pub fn clear_focus(&mut self) {
self.focus = Some(FocusTarget::NoFocus);
}
}/*!
Example on how to use custom types directly with native windows derive
`cargo run --example subclassing_d --features "fl... | Rust | 0 |
ould be joined and the index of the levels in the resulting
/// joined `Bdd` that compose the dependency.
fn pick_best_dep<T: Dependency>(deps: &[T]) -> (usize, usize) {
deps.iter()
.enumerate()
.fold((0, std::usize::MAX), |(id_dep, min_distance), (i, dep)| {
if d... | Rust | 0 |
# Conatenar strings
first_name = "Asabeneh"
last_name = " Yetayeh"
language = "Python"
full_name = first_name + last_name
print(full_name)
"""
SECUENCIAS DE ESCAPE
\n -> Saltos de línea.
\t -> Tabulador.
\\ -> Barra invertida.
\' -> Comillas simples.
\" -> Comillas dobles.
"""
"""
FORMATEAR TEXTO -> MANERA ANTIGUA
%s... | Python | 1 |
True # 标记获取失败,后续不再尝试
time.sleep(0.01)
def run(self) -> None:
logger.info(f"[{self.account_name}] Waiting for start time: {self.start_time}")
seckill_threads: List[threading.Thread] = []
for _ in range(self.thread_count):
t = threading.Thread(target=self.start_seck... | Python | 1 |
to the pool, so that it
/// # // can receive packets.
/// # pool.spawner().spawn_local(local_endpoint
/// # .clone()
/// # .receive_loop_arc(null_receiver!())
/// # .map(|err| panic!("Receive loop terminated: {}", err))
/// # );
/// #
/// # let future = async move {
/// // Create a remote endpoint instance ... | Rust | 0 |
import streamlit as st
from templates.sidebar import initialize_page_config
initialize_page_config(sidebar="collapsed")
st.image("sources/Logo.png")
st.markdown("""
<style>
div[data-testid="collapsedControl"] {
display: none;
}
... | Python | 1 |
write!(f, "q") }
Piece::BK => { write!(f, "k") }
Piece::Empty => { write!(f, ".") }
_ => { Err(fmt::Error) }
}
}
}
pub fn init_move_tables() {
lazy_static::initialize(&KING_MOVES);
lazy_static::initialize(&KNIGHT_MOVES);
lazy_static::initialize(&WHITE_PAWN_M... | Rust | 0 |
);
builder
}
}
<reponame>kpreid/all-is-cubes<gh_stars>10-100
// Copyright 2020-2021 <NAME> under the terms of the MIT License as detailed
// in the accompanying file README.md or <https://opensource.org/licenses/MIT>.
//! Axis-aligned integer-coordinate box volumes ([`Grid`]), arrays bounded by them
//! (... | Rust | 0 |
0, 0, 0,
31, 32, 33, 34, 35);
assert_eq!(m.insert_fixed_rows::<U2>(0, 0), expected1);
assert_eq!(m.insert_fixed_rows::<U2>(3, 0), expected2);
assert_eq!(m.insert_fixed_rows::<U2>(2, 0), expected3);
// The following is just to verify that the return type dimensions is correctly inferred.
... | Rust | 0 |
D1(): pass
label('loc_42D1')
If(
(
(Expr.TestScenaFlags, ScenaFlag(0x0380, 1, 0x1C01)),
Expr.Return,
),
'loc_4397',
)
If(
(
(Expr.TestScenaFlags, ScenaFlag(0x0001, 0, 0x8)),
Expr.Return,
),
'loc_4305',
... | Python | 1 |
<MultiSpan>,
F: FnOnce(&mut DiagnosticBuilder<'_>),
{
cx.struct_span_lint(lint, sp, |diag| {
let mut diag = diag.build(msg);
f(&mut diag);
docs_link(&mut diag, lint);
diag.emit();
});
}
pub fn span_lint_hir(cx: &LateContext<'_>, lint: &'static Lint, hir_id: HirId, sp: Span, ... | Rust | 0 |
bsc_it = {
"fyit": {
"sem1": {
"sub1": "dbms",
"sub2": "cpp",
"sub3": "greenit"
},
"sem2": {
"sub1": "history",
"sub2": "hindi",
"sub3": "english"
}
},
"syit": {
"sem3": {
"sub1": "pyt... | Python | 1 |
eme: &Theme,
writer_mng: &mut WriterManager<W>,
) -> Result<(), XlsxError> {
let mut writer = Writer::new(io::Cursor::new(Vec::new()));
// XML header
let _ = writer.write_event(Event::Decl(BytesDecl::new(
b"1.0",
Some(b"UTF-8"),
Some(b"yes"),
)));
write_new_line(&mut writ... | Rust | 0 |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | Python | 1 |
1800..=0x1FFF => self.read_ram(addr - 0x1800),
0x2000..=0x2007 => nes.ppu_register_bus.cpu_read(addr),
0x2008..=0x401F => { warn!("Reading CPU address 0x2008-0x401F is not implemented"); 0 },
0x4020..=0x7FFF => { warn!("Reading CPU address 0x4020-0x7FFF is not implemented"); 0 }, // ... | Rust | 0 |
128, 200_000_000u128)
);
assert_eq!(
<Runtime as crate::Config>::Currency::total_balance(BHO, &ALICE),
800_000_000u128
);
assert_eq!(
<Runtime as crate::Config>::Currency::total_balance(BNB, &ALICE),
794_736_842u128
);
// A... | Rust | 0 |
nv0,
1,
line_vec,
color
)
# Look at the first env
cam_pos = gymapi.Vec3(3, 0, 1.5)
cam_target = gymapi.Vec3(0, 0, 1)
gym.viewer_camera_look_at(viewer, None, cam_pos, cam_target)
# 构造goal_pos
with open("../../../Datasets/door_datasets/99650089960001/handle_bounding.json", "r") as f:
bo... | Python | 1 |
0x3333 | ((value as u32) << 16);
unreachable!()
}
}
impl SavedRegisters {
pub fn get(&self, reg: u32) -> u64 {
match reg {
0 => 0,
1 | 3..=31 => self.registers[reg as u64 * 8],
2 => csrr!(sscratch),
_ => unreachable!(),
}
}
pub fn... | Rust | 0 |
pool.execute(move || {
let t = bracket::run_public_tournament();
t_tourneys.send(t).unwrap()
});
}
drop(t_tourneys);
r_tourneys.into_iter().collect()
}
fn run_a_bunch_of_tournaments(num_tourneys: u32) -> Vec<Tournament> {
let pool = ThreadPool::new(6);
let (t_tour... | Rust | 0 |
OF_ART', 'PERCENT', 'GPE', 'EVENT', 'PRODUCT'])
def processNERLine(line):
ret = []
words = line.split(' ')
words2 = line.split(']')
if len(words2)>len(words):
words = words2
spaced=False
else:
spaced=True
for w in words:
if len(w)==0:
continue
... | Python | 1 |
4, key: &[u8]) -> Result<Option<M>> {
match self.get(region_id, key)? {
Some(value) => {
let mut m = M::new();
m.merge_from_bytes(&value)?;
Ok(Some(m))
}
None => Ok(None),
}
}
fn get_entry(&self, region_id: u64,... | Rust | 0 |
_678 = object.key("Attributes").start_object();
for (key_679, value_680) in var_677 {
{
object_678.key(key_679).string(value_680);
}
}
object_678.finish();
}
if let Some(var_681) = &input.client_sdk_version {
object.key("ClientSdkVersion").... | Rust | 0 |
_nodes: vec![]
},
TestTree {
id: 3,
child_nodes: vec![
TestTree {
id: 4,
child_nodes: vec![]
},
TestTree {
... | Rust | 0 |
;
execute_n(&mut emu, 1);
assert_eq!(emu.cpu.b, 6);
emu.cpu.a = 7;
execute_n(&mut emu, 1);
assert_eq!(emu.cpu.b, 7);
emu.cpu.b = 20;
execute_n(&mut emu, 1);
assert_eq!(emu.cpu.a, 20);
emu.cpu.b = 21;
execute_n(&mut emu, 1);
asser... | Rust | 0 |
textFormat='plainText'
# )
# response = request.execute()
# for item in response.get('items', []):
# comment_id = item['id']
# if comment_id in seen_comment_ids:
# continue # Skip already seen comment
# comment_text = item['snippet']['topLevelComment']['snippet'... | Python | 1 |
fn from_env() -> Result<Self> {
let name = env::var(Self::ENV_VAR)?;
match Self::by_name(&name) {
Some(target) => Ok(target),
None => bail!("Unknown fuzz target '{}'", name),
}
}
/// Get a fuzz target by name.
pub fn by_name(name: &str) -> Option<Self> {
... | Rust | 0 |
: Vec<Point2<F>>,
axis: Dim3,
coord: fsd,
satisfies_constraints: &S,
) -> Vec<Point3<fsd>>
where
F: BFloat,
S: Fn(&Point2<F>) -> bool + Sync,
{
match axis {
X => slice_points
.into_par_iter()
.filter_map(|point| {
... | Rust | 0 |
12345;
let funding_rates = &parse_funding_rate(
EXCHANGE_NAME,
MarketType::InverseSwap,
raw_msg,
Some(received_at),
)
.unwrap();
assert_eq!(funding_rates.len(), 1);
for rate in funding_rates.iter() {
crate::utils::chec... | Rust | 0 |
= y as f32 / 3.0 + 0.1234;
let center_z = z as f32 / 3.0 + 0.1234;
let center_w = w as f32 / 3.0 + 0.1234;
println!("({}, {}, {}, {})", center_x, center_y, center_z, center_w);
const H: f32 = 0.005;
... | Rust | 0 |
ionData {
total: total as u64,
data: to_detail_list(d).await?,
})
}
pub async fn new_post() -> Result<i64> {
let id = snowflake::gen_id() as i64;
let last_insert_rowid =
sqlx::query("INSERT INTO posts(id, title, title_image, markdown_content, rendered_content, created_at)VALUES(?,?,... | Rust | 0 |
for i8 { fn type_name() -> &'static str { "i8" } }
impl TypeName for u8 { fn type_name() -> &'static str { "u8" } }
impl TypeName for i16 { fn type_name() -> &'static str { "i16" } }
impl TypeName for u16 { fn type_name() -> &'static str { "u16" } }
impl TypeName for i32 { fn type_name() -> &'static str { "i32" } }
im... | Rust | 0 |
class Solution:
def subsets(self, nums: List[int]) -> List[List[int]]:
'''
├── Include 1
│ ├── Include 2
│ │ ├── Include 3 (Subset: [1, 2, 3])
│ │ └── Exclude 3 (Subset: [1, 2])
│ └── Exclude 2
│ ├── Include 3 (Subset: [1, 3])
│ └── Exclude 3 (Subset: [1])
└── Exclude 1
├── In... | Python | 1 |
> 0:
warnings.warn("%s fileds are useless." % ",".join(memeber_set))
class IndexOptionsField(AbstractModel):
"""索引自治字段
"""
def __init__(self):
r"""
:param _ExpireMaxAge: 过期时间
注意:此字段可能返回 null,表示取不到有效值。
:type ExpireMaxAge: str
:param _ExpireMaxSize: 过期... | Python | 1 |
')
context.write(nsp_path_list_bytes)
return cached_titles
def poll_commands(context, work_dir_path):
log.info('Entering command loop')
cmd_cache = None
while True:
cmd_header = bytes(context.read(16, timeout=0))
magic = cmd_header[:4]
if magic != b'DBI0': # Tinfoil USB... | Python | 1 |
, help="Result Output Path", required=True)
args = parser.parse_args(argv)
return args
def main(argv):
args = parse_args(argv)
device = "cuda" if args.cuda and torch.cuda.is_available() else "cpu"
if args.mode == TEST_MODES[0]:
ImageCompressor = GainedMSHyperprior().to(device)
elif ar... | Python | 1 |
.solar_constant_input.value()}' + \
f'<li>Latitude [°]: {self.latitude_input.value()}' + \
'</ul>'
shortName = f"{self.plotType} [W/m2]"
serieDict = {
'Id': generate_Id(),
'Type': 'Serie',
'Name': '',
... | Python | 1 |
fractional_presence(label):
return lambda x, y:\
abs(((1.0 / len(x)) - (1.0 / len(y)))) * (label in x and label in y) \
or 0.0 * (label not in x and label not in y) \
or abs((1.0 / len(x))) * (label in x and label not in y) \
or ((1.0 / len(y))) * (label not in x and label in y)
d... | Python | 1 |
let private_key = RsaPrivateKey::try_from(&jwk).unwrap();
let public_key = RsaPublicKey::try_from(&jwk).unwrap();
assert_eq!(public_key, private_key.to_public_key());
let jwk_from_key = JsonWebKey::from(&private_key);
// `jwk_from_key` won't be equal to `jwk`, but we can still check tha... | Rust | 0 |
import requests
from bs4 import BeautifulSoup
def fetch_quotes(url):
response = requests.get(url)
soup = BeautifulSoup(response.text, 'html.parser')
quotes = soup.find_all('div', class_='quote')
data = []
for quote in quotes:
text = quote.find('span', class_='text').text
author = q... | Python | 1 |
_hex(NOTIFICATION_TX)).unwrap();
let bob_seed: Vec<u8> = bitcoin::hashes::hex::FromHex::from_hex(BOB_BIP32_SEED).unwrap();
let bob_private = PrivateCode::from_seed(&bob_seed, 0, Network::Bitcoin).unwrap();
let alice_public = PublicCode::from_notification(&bob_private, None, &tx).unwrap();
... | Rust | 0 |
/// assert_eq!(m[&KEY_A], 30);
/// m[&KEY_A] = 35;
/// assert_eq!(m[&KEY_A], 35);
/// });
/// assert_eq!(m[&KEY_A], 25);
/// ```
pub fn with_mut<T: ?Sized + 'static, U, const MUT: bool>(
&mut self,
key: &'static Key<S, T, MUT>,
value: &mut T,
f: impl F... | Rust | 0 |
from django.test.testcases import SimpleTestCase
from corehq.apps.es import CaseSearchES
class TestESSort(SimpleTestCase):
def test_regular_sort(self):
field_name = "foo"
expected = [{field_name: {'order': 'asc'}}]
self.assertEqual(expected, CaseSearchES().sort(field_name).raw_query['sort... | Python | 1 |
map_dataframe_deprecation():
if PANDAS_GE_210:
with warnings.catch_warnings():
warnings.filterwarnings(
"ignore",
message="DataFrame.applymap has been deprecated",
category=FutureWarning,
)
yield
else:
yield
@c... | Python | 1 |
lcolor;
}
cout
}
fn sample_env_light(&self, ldir: Vec3, lcolor: Vec3, surf: SurfaceData) -> Vec3 {
let vdir: Vec3 = (self.cam_origin - surf.point).normalize();
// The half vector of a microfacet model
let hdir: Vec3 = (ldir + vdir).normalize();
// cos(theta_h... | Rust | 0 |
V6_ADDR_LINKLOCAL
elif in6_issladdr(addr):
scope = IPV6_ADDR_SITELOCAL
elif in6_ismaddr(addr):
if in6_ismgladdr(addr):
scope = IPV6_ADDR_GLOBAL
elif in6_ismlladdr(addr):
scope = IPV6_ADDR_LINKLOCAL
elif in6_ismsladdr(addr):
scope = IPV6_ADDR_SI... | Python | 1 |
lotIndex) -> bool {
self.node.has_externalized_values(slot_index)
}
fn process_timeouts(&mut self) -> Vec<Msg<V>> {
let out_msgs = self.node.process_timeouts();
if !out_msgs.is_empty() {
self.write(LoggedMsg::ProcessTimeouts(out_msgs.clone()))
.expect("faile... | Rust | 0 |
name: name,
security_group_ids: security_group_ids.ok_or(::serde::de::Error::missing_field("SecurityGroupIds"))?,
tags: tags,
})
}
}
d.deserialize_map(Visitor)
}
}
impl ::Resource for ResolverEndpoint {
type Prop... | Rust | 0 |
import csv
from itertools import cycle
from eth_account import Account
def get_accounts(path: str) -> dict:
accounts = {}
with open(path, "r", encoding="utf8") as input_file:
reader = csv.DictReader(input_file)
for row in reader:
try:
accounts[row["account_name"]]... | Python | 1 |
) struct SelectBuilder {
alias: Option<&'static str>,
count: usize,
select: String,
}
impl SelectBuilder {
pub fn with_alias(alias: &'static str) -> Self {
Self {
alias: Some(alias),
count: 0,
select: String::new(),
}
}
pub fn add_field(&mut ... | Rust | 0 |
from fastapi import Depends, HTTPException, status
from app.core.error.classroom_exception import ClassroomNotFoundError, ClassroomIsDeleted
from app.features.classroom.dependencies import get_delete_classroom_use_case
from app.features.classroom.domain.usecase.delete_classroom import DeleteClassroomUseCase
from app.f... | Python | 1 |
d_and_loss_jitted = jit(forward_and_loss, executors=("sdpa", "torchcompile", "nvfuser", "torch"))
config = Config(block_size=2, n_layer=2, n_embd=8, n_head=4, padded_vocab_size=8)
with torch.device("cuda"):
model = GPT(config)
input_ids = torch.zeros(1, 2, dtype=torch.int64, device="cuda")
ou... | Python | 1 |
t data have been read, this contains the packets buffer.
segments_or_packets_buf :Vec<u8>,
}
impl PageParser {
/// Creates a new Page parser
///
/// The `header_buf` param contains the first 27 bytes of a new OGG page.
/// Determining when one begins is your responsibility. Usually they
/// begin directly after ... | Rust | 0 |
F>(source: &str, expected: (&str, &[&str]), actual: Result<String, Errors>, ignore: F)
where
F: Fn(&str) -> bool,
{
if !expected.1.is_empty() {
if !expected.1.iter().copied().any(ignore) {
let res = actual.ok();
assert_eq!(
res.clone(),
None,
... | Rust | 0 |
srq_attr>(),
12usize,
concat!("Size of: ", stringify!(ibv_srq_attr))
);
assert_eq!(
::std::mem::align_of::<ibv_srq_attr>(),
4usize,
concat!("Alignment of ", stringify!(ibv_srq_attr))
);
assert_eq!(
unsafe { &(*(::std::ptr::null::<ibv_srq_attr>())).max_wr a... | Rust | 0 |
>0
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0 OR MIT
// @expect verified
pub fn main() {
let a = rmc::nondet();
let b = rmc::nondet();
if 4 < a && a < 8 {
// a in [5,7]
if 5 < b && b < 9 {
// b in [6,8]
... | Rust | 0 |
import os
import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import StandardScaler, OneHotEncoder
from sklearn.impute import SimpleImputer
from sklearn.compose import ColumnTransformer
from sklearn.pipeline import Pipeline
# Define base directory as the root of the proj... | Python | 1 |
fn unwrap_string_literal(lit: &proc_macro::Literal) -> String {
let mut repr = lit.to_string();
if !repr.starts_with('"') || !repr.ends_with('"') {
panic!("This macro only accepts a single, non-empty string argument")
}
repr.remove(0);
repr.pop();
repr
}
extern crate numpy;
extern cra... | Rust | 0 |
_all = "PascalCase")]
#[allow(missing_docs)]
pub struct TaskSpecNetworkAttachmentSpec<T>
where
T: AsRef<str> + Eq + Hash,
{
/// ID of the container represented by this task
#[serde(rename = "ContainerID")]
pub container_id: Option<T>,
}
/// Resource requirements which apply to each individual container... | Rust | 0 |
e[ToolCall, bool, Union[str, dict]]] = Field(
default=[], description="完成的节点状态"
)
"""完成的函数响应"""
# tool_calls_completed: List[ToolCall] = Field([], description="完成的函数快照")
snapshot_credential: Optional[str] = Field(
None, description="认证链的UUID,根据此UUID和 Map 可以确定哪个需要执行"
)
"""当前待处理的函... | Python | 1 |
class Solution:
def longestIncreasingPath(self, matrix: List[List[int]]) -> int:
# https://leetcode.com/problems/longest-increasing-path-in-a-matrix/
# Bottom up approach. The idea is using a dp table and iterate starting from the smallest cells to the largest. For eavery cell, we look at its neight... | Python | 1 |
row(&local, control_addr);
let local_broadcast_rpc_address =
build_node_broadcast_rpc_address(&local, local_broadcast_rpc_address, control_addr);
let mut node_infos = vec![build_node_info(&local, local_broadcast_rpc_address)?];
let peers = self.query_peers(control_transport.as_ref(... | Rust | 0 |
String,
kind: std::io::ErrorKind,
},
Ips {
id: i64,
ips: trust_dns_resolver::lookup_ip::LookupIp,
},
Metadata {
id: i64,
md: fs::Metadata,
},
FileRef {
id: i64,
fd: usize,
},
Written {
id: i64,
len: usize,
},
... | Rust | 0 |
# This file is part of the NssMPClib project.
# Copyright (c) 2024 XDU NSS lab,
# Licensed under the MIT license. See LICENSE in the project root for license information.
from NssMPC.common.ring.ring_tensor import RingTensor
from NssMPC.config.runtime import PartyRuntime
from NssMPC.crypto.primitives.oblivious_tran... | Python | 1 |
from flask import Flask, request, jsonify
from web3 import Web3
import json
import os
app = Flask(__name__)
# Connect to Ethereum node
ETH_NODE_URL = os.getenv('ETH_NODE_URL', 'https://your.ethereum.node')
w3 = Web3(Web3.HTTPProvider(ETH_NODE_URL))
# Load smart contract ABI and address
CONTRACT_ADDRESS = os.getenv('... | Python | 1 |
#!/usr/bin/env python
"""
Highlight paths
===============
"""
import matplotlib.pyplot as plt
import networkx as nx
from netgraph import Graph
# create a random geometric graph and plot it
g = nx.random_geometric_graph(100, 0.15, seed=42)
node_positions = nx.get_node_attributes(g, 'pos')
plot_instance = Graph(g,
... | Python | 1 |
Regex = regex::Regex::new(r#"--.*"#).unwrap();
}
async fn load_sql(path: PathBuf) -> Result<String, MigrationError> {
let mut sql = tokio::fs::read_to_string(path).await?;
sql = SQL_COMMENT.replace_all(&sql, "").into_owned();
Ok(sql)
}
async fn load_migration(path: PathBuf) -> Result<Migration, Migratio... | Rust | 0 |
essage,
to=[ticket_holder_email],
from_email=SMTP2GO_FROM_EMAIL,
)
email.content_subtype = EMAIL_CONTENT_TYPE
try:
email.send()
logger.info(
'`Ticket sold` email has been successfully sent to {}',
ticket_holder_email,
)
except Exception as ... | Python | 1 |
DMIN_LIST_PATH: PathBuf = CONFIG_DIR.join("server-adminlist.json");
static ref BAN_LIST_PATH: PathBuf = CONFIG_DIR.join("server-banlist.json");
static ref SERVER_SETTINGS_PATH: PathBuf = CONFIG_DIR.join("server-settings.json");
static ref SECRETS_PATH: PathBuf = CONFIG_DIR.join("secrets.toml");
static r... | Rust | 0 |
truction trap controls.
* File: AArch64-hfgitr_el2.xml
*/
/*
* ================================================================================================
* Register Read/Write Functions
* ================================================================================================
*/
/// rea... | Rust | 0 |
a\xed\xf5m\xbb\xed\xae[\
\xec\x96\x93\xb7\x0d1\xc2\xd6x\xaeK\x11\xd8q\x1e\x18\
\x94\x08\xad%j\x8b \xb0?\xf1\xee\x1a\xd9\xc2\xf6\xbd\
\x95{\x15No\x18\x9c\xba\xb7E\x15=\x92\xc6\xbd\x80\
\x9b1\xb66iv\xf0\x9c\xfb\xb4d\xa2)b\xa6\xe2\
\xa7\xb3\xe9\x81\xb7\xc3\xbd\xe9\xe6\x1b\x87\xff\xda\xb7g|\
\xed\xd7\xbf\xe1\x87_\xf1\xacg=... | Python | 1 |
#!/usr/bin/python3
"""
Docstyle for class Rectangle
"""
class Rectangle:
"""
Class Rectangle
"""
def __init__(self, width=0, height=0):
"""
__init__ used to initialize objects/instances
Note:
self should not be ritten ithin the Args
Args:
width: ... | Python | 1 |
R R} t postR ( R# ( ( s renpy/display/core.pyt post_time_eventJ s c C s, t | _ t j j j d d d d t d S( NiRQ ( Ra R R R RT t
mouse_handlerR' RH ( R# ( ( s renpy/display/core.pyt after_longpressT s ... | Python | 1 |
l!("<{}> doesn't look like a valid HTTP request", first_line);
}
let method = tokens[0];
if method != "GET" {
bail!("Invalid HTTP method: {}", method);
}
let http_version = tokens[2];
if http_version != "HTTP/1.1" && http_version != "HTTP/1.0" {
bail!("Invalid HTTP version: {}", ... | Rust | 0 |
def process(client, edit, invitation):
journal = openreview.journal.Journal()
submission = client.get_note(edit.note.id)
submission_edits = client.get_note_edits(note_id=submission.id, sort='tcdate:asc')
# run post-process only if this is the first edit of the submission
if edit.id != submission_... | Python | 1 |
d\xc1\xdf\x97e\xf5\xe2\xe1s/<\xdf)\xb5\x8e\
H\xa6\x8d\xb06\x8f:^\x8b\x8b\xcc(\x00\x01\x0b\x94\
e-\x0f\xb1n<\xf7\x87\xf8\xfb:\xd7\xf3$\xc5\xdc\
\xc8\xc1iQ\x5c@\xda\x847\x02\xf0|\xfc4\x07\xb8\
2dN\x01\x00\xf8\xf1\x01\xbb_\x05\xcfqB\xaf\xdf\
O;$.Pq\x89\x08\xbc\xec\x5c\x16\xad>M*\
\xe6\x01\x82\x82-\xa1\xe0)AeO\x8f\xd5z\xb2... | Python | 1 |
continue;
}
// Verify if stash was active in set
let exposure = api
.storage()
.staking()
.eras_stakers(era_index, stash.clone(), None)
.await?... | Rust | 0 |
full" style="width: 60%"></div>
</div>
<span class="ml-2 text-warning font-semibold">60%</span>
</div>
</td>
<td class="px-6 py-4">2024-09-0... | Python | 1 |
_ => unreachable!("Union array's data type is not a union!"),
}
}
/// Returns whether the `UnionArray` is dense (or sparse if `false`).
fn is_dense(&self) -> bool {
match self.data.data_type() {
DataType::Union(_, mode) => mode == &UnionMode::Dense,
_ => unre... | Rust | 0 |
ast_node!(TupleType, [items]);
impl<'a> TupleType<'a> {
pub fn items(&self) -> Vec<Type> {
let mut cursor = self.node.walk();
self.node
.named_children(&mut cursor)
.map(|node| Type::new(self.source, node))
.collect()
}
}
define_ast_node!(FunctionType, [para... | Rust | 0 |
expect("parse multiaddr"),
score: row.get(2)?,
status: u8_to_status(row.get::<_, u8>(3)?),
session_type: bool_to_endpoint(row.get::<_, bool>(4)?),
ban_time_ms: secs_to_millis(row.get(5)?),
last_connected_at_ms: secs_to_millis(row.get(6)?),
... | Rust | 0 |
b.iter(|| cumsum_f32_unrolled(&mut random_vec));
}
#![cfg_attr(not(feature = "std"), no_std)]
use frame_support::{Parameter, decl_module, decl_event, decl_storage, decl_error, ensure, dispatch, debug};
use frame_support::{
weights::{Weight, GetDispatchInfo, Pays},
traits::{UnfilteredDispatchable, Currency, Reserv... | Rust | 0 |
one::Clone for Struct___darwin_i386_avx_state {
fn clone(&self) -> Self { *self }
}
impl ::std::default::Default for Struct___darwin_i386_avx_state {
fn default() -> Self { unsafe { ::std::mem::zeroed() } }
}
#[repr(C)]
#[derive(Copy)]
pub struct Struct___darwin_i386_exception_state {
pub __trapno: __uint16... | Rust | 0 |
static str,
/// If this is an edition fixing lint, the edition in which
/// this lint becomes obsolete
pub edition: Option<Edition>,
}
impl Lint {
pub const fn default_fields_for_macro() -> Self {
Lint {
name: "",
default_level: Level::Forbid,
desc: "",
... | Rust | 0 |
security::{self, SecurityLevel};
pub(crate) use delicate_utils::consensus_message::service_binding;
pub(crate) use delicate_utils::consensus_message::{
executor_processor as delicate_utils_executor_processor,
health_check as delicate_utils_health_check, task as delicate_utils_task,
task_log as delicate_util... | Rust | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.