text string | label_name string | labels int64 |
|---|---|---|
}
}
doc_comment! {
concat!("Get ", $descr, " bytes."),
pub fn $get_slice(&mut self) -> RnResult<[u8; $bytes], E> {
let hex = self.$get_hex()?;
let mut buf = [0; $bytes];
base16::decode_slice(hex, &mut buf).map_err(|_| Error::... | Rust | 0 |
token_amount: 100,
fee: 1,
};
let mut mock = MockAdapter::new();
mock.expect_load_output_data()
.times(1)
.returning(move || Some(data.clone()));
mock.expect_load_script_args()
.times(1)
.returning(|| Bytes::from([0u8; 20].to... | Rust | 0 |
u16,
modify: i16,
}
fn random_in(within : Range<u16>) -> u16 {
let dx = within.end - within.start;
let mx = (0xff_ff / dx) * dx;
let mut r : u16;
loop {
let mut x = [0; 2];
getrandom::getrandom(&mut x).expect("Error obtaining random bits");
r = (x[0] as u16) << 8 | x[1] as ... | Rust | 0 |
ation")]
pub struct STORAGE_FIRMWARE_SLOT_INFO_V2 {
pub SlotNumber: u8,
pub ReadOnly: super::super::Foundation::BOOLEAN,
pub Reserved: [u8; 6],
pub Revision: [u8; 16],
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::marker::Copy for STORAGE_FIRMWARE_SLOT_INFO_V2 {}
#[cfg(feature = "Win32_Foundation"... | Rust | 0 |
class Solution:
def findErrorNums(self, nums: List[int]) -> List[int]:
count = {}
for num in nums:
if num not in count:
count[num] = 1
else:
count[num] += 1
duplicate = None
missing = None
for i in range(1, len(nums) + 1... | Python | 1 |
;
use crate::error::Error;
use crate::function_manifest::{write_function_manifest, FUNCTION_MANIFEST_SYM};
use crate::name::Name;
use crate::stack_probe;
use crate::table::{link_tables, TABLE_SYM};
use crate::traps::write_trap_tables;
use byteorder::{LittleEndian, WriteBytesExt};
use cranelift_codegen::{ir, isa};
use c... | Rust | 0 |
lse,
eq=None,
order=None,
on_setattr=None,
):
"""
Identical to `attr.ib`, except keyword-only and with some arguments
removed.
.. versionadded:: 20.1.0
"""
return attrib(
default=default,
validator=validator,
repr=repr,
hash=hash,
init=init,
... | Python | 1 |
tance<F> for FriSpecificBlake2sTree<F> {
type Commitment = [u8; 32];
type Params = FriSpecificBlake2sTreeParams;
type Query = CosetCombinedQuery<F>;
fn size(&self) -> usize {
self.size
}
fn create(values: &[F], params: &Self::Params) -> Self {
assert!(params.values_per_leaf.is_... | Rust | 0 |
class Solution:
def prefixesDivBy5(self, nums: List[int]) -> List[bool]:
ans = []
curr = 0
for num in nums:
curr = (curr * 2 + num) % 5
ans.append(curr % 5 == 0)
return ans
| Python | 1 |
or typically `g.op(x1, .. xN)?` for fallible operations).
//!
//! * Because of a current [limitation](https://github.com/rust-lang/rust/issues/49434) of
//! the Rust borrow checker, expressions cannot be nested: `g.add(&x, &g.mul(&y, &z)?)?` must
//! be written `let v = g.mul(&y, &z)?; g.add(&x, &v)?`.
//!
//! We belie... | Rust | 0 |
*out_count = cpuid_count as u32;
to_crosvm_rc(ret)
}
#[no_mangle]
pub unsafe extern "C" fn crosvm_get_msr_index_list(
this: *mut crosvm,
entry_count: u32,
msr_indices: *mut u32,
out_count: *mut u32,
) -> c_int {
let _u = record(Stat::GetMsrIndexList);
let this = &mut *this;
let msr_ind... | Rust | 0 |
# -*- coding: utf-8 -*-
"""
Created on Thu Apr 10 22:24:06 2025
@author: hp
"""
import dtale
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
from sklearn.model_selection import train_test_split
from sklearn.linear_model import LinearRegression, LogisticRegression
from sklea... | Python | 1 |
,
pub repeat: uint8_t,
pub padding2: uint8_t,
pub padding3: uint8_t,
pub keysym: SDL_Keysym,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct SDL_TextEditingEvent {
pub type_: uint32_t,
pub timestamp: uint32_t,
pub windowID: uint32_t,
pub text: [c_char; 32],
pub start: int32_t,
pu... | Rust | 0 |
e_t() {
assert_eq!(
::core::mem::size_of::<ble_gap_cfg_device_name_t>(),
12usize,
concat!("Size of: ", stringify!(ble_gap_cfg_device_name_t))
);
assert_eq!(
::core::mem::align_of::<ble_gap_cfg_device_name_t>(),
4usize,
concat!("Alignment of ", stringify!(ble_g... | Rust | 0 |
arn(missing_docs)]
#[macro_use]
extern crate trackable;
macro_rules! track_io {
($e:expr) => {
$e.map_err(|e| {
use trackable::error::{ErrorKindExt, Failed};
Failed.cause(e)
})
};
}
pub use decoder::{Decoder, HeaderBlockDecoder};
pub use encoder::{Encoder, HeaderBlockEn... | Rust | 0 |
, 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, software
// distributed under the License is distributed on an "... | Rust | 0 |
import numpy as np
import pytest
import rustynum as rnp
# Helper function to generate random vectors
def setup_vector(dtype, size=1000):
a = np.random.rand(size * size).astype(dtype)
b = np.random.rand(size * size).astype(dtype)
return a.tolist(), b.tolist()
# Function to perform gemm using rustynum
de... | Python | 1 |
cellation',
'invoice_from',
'invoice_from_name',
'invoice_from_zipcode',
'invoice_from_city',
'invoice_from_country',
'invoice_from_tax_id',
'invoice_from_vat_id',
'invoice_to',
'invoice_to_company',
... | Python | 1 |
een detected."]
VFEDG_DET_0,
#[doc = "1: VREGIN falling edge interrupt has been detected."]
VFEDG_DET_1,
}
impl From<VFEDG_DET_A> for bool {
#[inline(always)]
fn from(variant: VFEDG_DET_A) -> Self {
match variant {
VFEDG_DET_A::VFEDG_DET_0 => false,
VFEDG_DET_A::VFEDG_DET_1 => true,
}
}
... | Rust | 0 |
}
}
use adventlib::grid::{Point, SparseGrid};
pub fn solve() {
println!("Day 24");
let input_lines = adventlib::read_input_lines("day24input.txt");
let mut grid: SparseGrid<char> = SparseGrid::new();
for line in &input_lines {
let mut chars: Vec<_> = line.chars().collect();
let mut ... | Rust | 0 |
{ wrapped: json!(100.6), data_type: DataType::INTEGER })).to(be_ok().value(100));
expect!(f64::try_from(DataValue { wrapped: json!("100"), data_type: DataType::RAW })).to(be_ok().value(100.0));
expect!(f64::try_from(DataValue { wrapped: json!("100"), data_type: DataType::INTEGER })).to(be_ok().value(100.0));
... | Rust | 0 |
tion_with_dkg_id(DkgId::IDkgId(I_DKG_1));
}
#[test]
fn should_contain_individual_public_keys_after_insertion_with_nidkg_id() {
should_contain_individual_public_keys_after_insertion_with_dkg_id(DkgId::NiDkgId(NI_DKG_ID));
}
fn should_contain_individual_public_keys_after_insertion_with_dkg_id(dkg_id: DkgId) {
l... | Rust | 0 |
ump_label(),
cycle = gen.jump_label(),
copy = gen.jump_label(),
temp = gen.var_label()
))
.unwrap(),
}
}
// Util: Compare Str
fn get_util_compare_str<T: Gen>(gen: &mut T, id: Id) -> Src {
// GR1 .. adr of s_buf (lhs)
// GR2 .. s_len (lhs)
// GR3 .. ad... | Rust | 0 |
pub fn is_lpi2c4_stop_req_0(&self) -> bool {
*self == LPI2C4_STOP_REQ_A::LPI2C4_STOP_REQ_0
}
#[doc = "Checks if the value of the field is `LPI2C4_STOP_REQ_1`"]
#[inline(always)]
pub fn is_lpi2c4_stop_req_1(&self) -> bool {
*self == LPI2C4_STOP_REQ_A::LPI2C4_STOP_REQ_1
}
}
#[doc = ... | Rust | 0 |
retty(&json).unwrap();
println!("{}", json_string);
File::create(&InitCommand::get_tendermint_filename())
})
.map(|mut file| file.write_all(json_string.as_bytes()))
.map(|_e| {
println!(
"writing tendermint genesis ... | Rust | 0 |
\xa84\xd6\xfcU\xe8f\xb4\x10\xd4V\xb3\x0a\x1f\
\xcc\xcc\xfar\xe5M\xc8>5\x80\xc9\x8c]O\x85\x92\
<@\x87\xcb\xde\xd9i\x84\xce\x98\x1f\x98\x7f\xfcJ\x8a\
\x05\xe4\xda\x0d\xa6/\x83=\x1b\xaa\xc03\xdaU\xa9\xaf\
\xf3fDX;\x16\x9cb\xd0\x8dY\xa9. \xa4\xb9\
7\x06\xa9' \xfa9R\x84\xbc2\x19Z\xb3J\x04\
=I\x91\xf8\x8a\xd9H\x9a\xf2\x19\x9... | Python | 1 |
scales[i]),
bboxes=[{
'facecolor': 'black',
'alpha': 0.8,
'pad': 0.7,
'edgecolor': 'none'
}])
if 'masks' in instances:
labels = instances.labels
masks ... | Python | 1 |
ptr_b < self.end {
unsafe {
let a = ptr_a.as_ref().unwrap();
let b = ptr_b.as_ref().unwrap();
self.ptr_a = ptr_a;
self.ptr_b = ptr_b.offset(1);
Some((a, b))
}
} else {
... | Rust | 0 |
(error!(TreeConstructionFail, tokens.as_slice()));
}
idx = idx.wrapping_add(1);
}
Ok(())
}
use httpmock::prelude::*;
use rstest::*;
use rusty_slackbot::playground::{PlaygroundRequest, PlaygroundResponse, ShareResponse};
use serde_json::json;
use serde_json::Value;
use std::fs;
#[fixture]
fn good_eval_response()... | Rust | 0 |
None => PathBuf::from("/")
};
if env::set_current_dir(init_dir).is_err() {
panic!("Couldn't establish initial working directory!");
}
};
// Use that initial directory to begin the directory stack
let init_dir = env::current_dir().unwrap();
let mut directory_stac... | Rust | 0 |
,
};
/// Don't limit the frame rate -- run as fast as possible.
pub const FRAME_RATE_NO_LIMIT: FrameRateLimitConfig = FrameRateLimitConfig {
strategy: FrameRateLimitStrategy::Yield,
fps: FPS_NO_LIMIT,
};
// === FPS numeric constants === //
/// Default number of frames per second to limit the game to.
pub con... | Rust | 0 |
import hashlib
import base64
import six
from . import pyaes
from .pkcs7 import PKCS7Encoder
import os
def evpKDF(
passwd,
salt,
key_size=8,
iv_size=4,
iterations=1,
hash_algorithm="md5"):
target_key_size = key_size + iv_size
derived_bytes = six.ensure_binary("")... | Python | 1 |
("\n{:─<80}\n", "");
return Err(anyhow!("Command `{:?}` exited with {}", cmd, status)).with_context(|| {
"Test case minimization failed.\n\
\n\
Usually this isn't a hard error, and just means that libfuzzer\n\
doesn't know how to minimize th... | Rust | 0 |
. If no other players have send a draw offer on this move,
/// then this initiates a draw offer to all players
DrawOffer,
/// This engine rejects the pending draw offer from another player.
/// If there is no pending draw offer, sending this message is a nop
RejectDrawOffer,
/// Asks the moder... | Rust | 0 |
18);
self.w
}
}
#[doc = "Schmitt trigger enabled for GPIO17.\n\nValue on reset: 1"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum REG_GPIO_17_SMT_A {
#[doc = "0: `0`"]
DISABLED = 0,
#[doc = "1: `1`"]
ENABLED = 1,
}
impl From<REG_GPIO_17_SMT_A> for bool {
#[inline(always)]
fn fro... | Rust | 0 |
import os
import tempfile
from datetime import datetime
import httpx
import pytest
from crawlab.actions.login import login
from crawlab.actions.upload import upload_dir
from crawlab.utils.config import config
from crawlab.utils.request import get_api_address
@pytest.fixture
def setup_test_dir():
name = "test_sp... | Python | 1 |
_RETRIES:
log.error("Max retries reached. Exiting.")
raise
sleep_time = MAX_RETRIES**retry_count
log.info(f"Retrying in {sleep_time} seconds...")
time.sleep(sleep_time)
# Parse API response
response_page = response.... | Python | 1 |
import sys
from awsglue.transforms import *
from awsglue.utils import getResolvedOptions
from pyspark.context import SparkContext
from awsglue.context import GlueContext
from awsglue.job import Job
from awsglue import DynamicFrame
def sparkSqlQuery(glueContext, query, mapping, transformation_ctx) -> DynamicFrame:
... | Python | 1 |
def exec5():
num= int(input("Insira um número positivo: "))
lista= []
lista.append(num)
contador= 0
while num!=0:
num= int(input("Insira outro número inteiro: "))
lista.append(num)
contador= contador+1
print(f"Sua lista possue: {contador} element... | Python | 1 |
from __future__ import annotations
from typing import TYPE_CHECKING
from uvicorn.supervisors.basereload import BaseReload
from uvicorn.supervisors.multiprocess import Multiprocess
if TYPE_CHECKING:
ChangeReload: type[BaseReload]
else:
try:
from uvicorn.supervisors.watchfilesreload import (
... | Python | 1 |
"""Get all tracked WordPress posts for all sites of a user."""
with sqlite3.connect(self.db_path) as conn:
cursor = conn.cursor()
cursor.execute('''
SELECT wp.id, wp.wordpress_post_id, wp.title, wp.status, wp.published_at, wp.last_updated_at,
... | Python | 1 |
/// Its SQL type is `Nullable<Text>`.
///
/// (Automatically generated by Diesel.)
last_name -> Nullable<Text>,
/// The `email` column of the `users` table.
///
/// Its SQL type is `Nullable<Varchar>`.
///
/// (Automatically generated by Diesel.)
... | Rust | 0 |
#" "6" ["." uint] "(" S type S ")"
/// / "#" DIGIT ["." uint]
/// / "#"
/// ```
#[derive(Debug, PartialEq)]
#[allow(missing_docs)]
pub enum Type2 {
Value(Value),
Typename(NameGeneric),
Parethesized(Type),
Map(Group),
Array(Group),
Unwrap(NameGeneric),
ChoiceifyInline(Group),
... | Rust | 0 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Copyright 2012 Nebula, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# no... | Python | 1 |
"Failed to create a bug for signature %s: %s",
signature.signature_term,
err.response.text,
)
continue
bug_id = str(bug["id"])
# TODO: log the created bugs info somewhere (e.g., DB,
... | Python | 1 |
.
binary_name: Binary to search for, e.g., 'objdump'
Returns:
Full path to binary or None if the binary was not found.
"""
# Mapping from ELF machine identifiers to GNU toolchain names.
toolchain_configs = {
'x86': 'i686-linux-android',
'MIPS': 'mipsel-linux-android',
'ARM': 'arm-linux-andro... | Python | 1 |
index('idx_chat_user', 'chat_messages', ['user_id'])
op.create_index('idx_chat_flagged', 'chat_messages', ['is_flagged'])
op.create_index('idx_chat_deleted', 'chat_messages', ['is_deleted'])
# Create indexes for stream_recordings
op.create_index('idx_recording_stream', 'stream_recordings', ['stream... | Python | 1 |
self.device),
task_labels=torch.tensor([t_idx] * len(index)).to(self.device),
)
assert len(mem_buffer.examples) <= mem_buffer.buffer_size
self.net.train(mode)
@torch.no_grad()
def update(self, classifier, task_size):
old_weight_norm = torch.norm(classifier.... | Python | 1 |
= target.len();
let m = pattern.len();
while index + m < n {
let next = index + 1;
match find_first_with_table(&target[next..], pattern, table) {
Some(result) => {
results.push(next + result);
index = next + result;
}
None => ... | Rust | 0 |
edModule::new("simple")
//! .lib_path("src/")
//! .link();
//! }
//!
//! fn main() {
//! link_ispc();
//! }
//! ```
//!
//! Running `cargo build --features ispc` will now build your ISPC files into a library
//! and generate bindings for your exported ISPC functions. The compiled library and
//! gen... | Rust | 0 |
from parse import *
import sys
def makeLambda(rfn, arglist):
args = []
usedargs = {}
for a in arglist:
aname = a["name"]
if not a["name"] in usedargs:
usedargs[a["name"]] = 0
if usedargs[a["name"]] != 0:
aname += "_" + str(usedargs[aname... | Python | 1 |
97,
VRNDSCALEPD = 1498,
VRNDSCALEPS = 1499,
VRNDSCALESD = 1500,
VRNDSCALESS = 1501,
VROUNDPD = 1502,
VROUNDPS = 1503,
VROUNDSD = 1504,
VROUNDSS = 1505,
VRSQRT14PD = 1506,
VRSQRT14PS = 1507,
VRSQRT14SD = 1508,
VRSQRT14SS = 1509,
VRSQRT23PS = 1510,
VRSQRT28PD = 1511... | Rust | 0 |
(&mut self) -> _SYSCTL_RCGCTIMER_R1W {
_SYSCTL_RCGCTIMER_R1W { w: self }
}
#[doc = "Bit 2 - 16/32-Bit General-Purpose Timer 2 Run Mode Clock Gating Control"]
#[inline(always)]
pub fn sysctl_rcgctimer_r2(&mut self) -> _SYSCTL_RCGCTIMER_R2W {
_SYSCTL_RCGCTIMER_R2W { w: self }
}
#[d... | Rust | 0 |
teln!(f, " Base Type: {}", base_type)?;
}
if let Some(base_id) = self.base_id {
writeln!(f, " Base ID: {:#04x}", base_id)?;
}
if let Some(latch_status) = self.latch_status {
writeln!(f, " Latch Status: {}", latch_status)?;
}
write... | Rust | 0 |
crate geo;
use std::vec::Vec;
use open_location_code::{is_valid, is_short, is_full};
use open_location_code::{encode, decode};
use open_location_code::{shorten, recover_nearest};
use geo::Point;
mod csv_reader;
use csv_reader::CSVReader;
/// CSVReader is written to swallow errors; as such, we might "pass" tests ... | Rust | 0 |
fn check_block_post(a: &$hir hir::Block);
fn check_stmt(a: &$hir hir::Stmt);
fn check_arm(a: &$hir hir::Arm);
fn check_pat(a: &$hir hir::Pat);
fn check_expr(a: &$hir hir::Expr);
fn check_expr_post(a: &$hir hir::Expr);
fn check_ty(a: &$hir hir::Ty);... | Rust | 0 |
Pos::from_s84(58.643889, -5.714722);
let p2 = HorizontalPos::from_s84(50.066389, -5.714722);
assert_eq!(
Ok(Angle::from_decimal_degrees(180.0)),
p1.final_bearing_to(p2)
);
}
#[test]
fn at_equator_final_bearing_to_east() {
let p1 = HorizontalPos::from_s84(0.0, 0.0);
let p2 = Horizont... | Rust | 0 |
or_x * msg.value * self.length_coeff
new_y = self.curr_y + direction_sign * curr_dir_vector_y * msg.value * self.length_coeff
self.curr_x = new_x
self.curr_y = new_y
else:
# rotate to the left or to the right
direction_sign = 1. if msg.direction == 2 ... | Python | 1 |
STRACT, .name == "stop", .descriptor == "(Ljava/io/OutputStream;Ljava/util/concurrent/Executor;)Z"
unsafe {
let __jni_args = [__jni_bindgen::AsJValue::as_jvalue(&arg0.into()), __jni_bindgen::AsJValue::as_jvalue(&arg1.into())];
let __jni_env = __jni_bindgen::Env::from_ptr(self... | Rust | 0 |
.map(|idx| idx + 2)
.ok_or("Unclosed multiline comment")
} else {
Ok(0)
}
}
/// Removes whitespaces at the beginning of a string.
///
/// Whitespace follows the definition of unicode whitespace.
///
/// If `input` does not start with a whitespace, then an error is returned.
fn whitespaces(m... | Rust | 0 |
from drawBot import *
import pathlib
# <include> ----------------------------------------
from drawBotGrid import Grid, imageBox
newPage("A4Landscape")
grid = Grid.from_margins((-50, -50, -50, -50), column_subdivisions=10, row_subdivisions=6)
grid.draw()
img_path = "https://raw.githubusercontent.com/mathieureguer/... | Python | 1 |
Reloader, ctx: Context) {
const POLL_PERIOD: Duration = Duration::from_millis(100);
const PORT_WAIT_TIMEOUT: Duration = Duration::from_secs(30);
if let Some(proxy) = reloader.proxy {
verbose!(- [ctx]["reload"] "About to reload, but waiting for proxy to get ready");
let port_ready = tokio:... | Rust | 0 |
working_dir(templates_dir, "common")
logger.info("Prepare common regional files")
templates_dir = path.realpath(path.join(COOKIECUTTER_TEMPLATES_DIR, "terragrunt-common-layer/region"))
copy_to_working_dir(templates_dir, path.join(source_dir_name, region))
logger.info("Prepare root dir")
templates_... | Python | 1 |
y for WebhookId {
fn fmt(&self, f: &mut Formatter<'_>) -> FmtResult {
Display::fmt(&self.0, f)
}
}
impl From<u64> for WebhookId {
fn from(id: u64) -> Self {
WebhookId(id)
}
}
#[cfg(test)]
mod tests {
use super::{
ApplicationId, AttachmentId, AuditLogEntryId, ChannelId, Comm... | Rust | 0 |
import os, sys
import shutil
import pandas as pd
import numpy as np
import pyemu
from pymarthe import MartheModel
from pymarthe.utils import marthe_utils, shp_utils, pest_utils, pp_utils
from pymarthe.mfield import MartheField, MartheFieldSeries
from pymarthe.helpers.postprocessing import PestPostProcessing
import matp... | Python | 1 |
CommandWrapper<T>
where
T: DropSourceCommand,
T::Error: 'static,
{
type Error = BoxedError;
fn create_stream(&self, file_name: AimpString) -> Result<Stream, Self::Error> {
self.0.create_stream(file_name).map_err(BoxedError::new)
}
}
pub struct FileAttributes {
// pub attributes: // TO... | Rust | 0 |
message: None,
time: None,
}),
};
let smartrest_message = serialize_event(event)?;
let mut reader = csv::ReaderBuilder::new()
.has_headers(false)
.from_reader(smartrest_message.as_bytes());
let mut iter = reader.deserializ... | Rust | 0 |
Gpio, InEndpointInterruptMask,
Interrupt, OutEndpointInterruptMask, Registers,
Reset, UsbConfiguration};
use self::types::{ConfigurationDescriptor, DeviceDescriptor,
EndpointAttributes, EndpointDescriptor,
EndpointSynchronizationType, Endp... | Rust | 0 |
..len2 - 1).rev() {
ans.insert(0, 0);
ans.insert(0, 0);
if n2[i] > 0 {
let tmp = &vn[(n2[i] - 1) as usize];
let mut index_b = tmp.len();
let mut flag = 0;
for j in (0..ans.len() - cnt).rev() {
let a = ans[j] + flag;
... | Rust | 0 |
Copy, Debug, PartialEq)]
pub enum ADC12IFG20_A {
#[doc = "0: No interrupt pending"]
ADC12IFG20_0 = 0,
#[doc = "1: Interrupt pending"]
ADC12IFG20_1 = 1,
}
impl From<ADC12IFG20_A> for bool {
#[inline(always)]
fn from(variant: ADC12IFG20_A) -> Self {
variant as u8 != 0
}
}
#[doc = "Rea... | Rust | 0 |
application for the Tiva-C Launchpad
//!
//! See README.md for more details.
//!
//! ## SPI pins
//!
//! This chip has 4 SPI devices. They are on the following pins:
//!
//! 1.02 PB5 SSI2Fss
//! 1.07 PB4 SSI2Clk
//! 1.08 PA5 SSI0Tx
//! 2.04 PF0 SSI1Rx
//! 2.04 PF... | Rust | 0 |
ism().unwrap().to_string(), "192.168.127.12/24");
assert_eq!(m.to_string(), input);
}
#[test]
fn basic_fail_ip_str() {
let input = "-ip4:192.168.127.12/24";
let m: Mechanism<IpNetwork> = input.parse().unwrap();
assert_eq!(m.kind().is_ip_v4(), true);
assert_eq!(m.qual... | Rust | 0 |
alue}")
else:
print("\nInventory is empty")
elif command[0] == "take" and len(command) >= 2:
item_name = " ".join(command[1:])
result = await game_manager.add_item(item_name)
print(f"\n{result}")
... | Python | 1 |
[serde(rename = "creationTime", default, skip_serializing_if = "Option::is_none")]
pub creation_time: Option<String>,
#[serde(rename = "createdBy", default, skip_serializing_if = "Option::is_none")]
pub created_by: Option<String>,
#[serde(rename = "lastModifiedTime", default, skip_serializing_if = "Opti... | Rust | 0 |
) << 1), (((3 << 3) + 1) << 2) - 1, (((7 << 2) - 1) << 2), ((((3 << 2) + 1)) << 3) + 1, (7 << 4), (3 << 5) + (1 << 1), (7 << 4) - 1, (3 << 5) + 1, (7 << 4) + (1 << 1), (((3 << 3) + 1) << 2), (5 << 4) + (1 << 1), (((3 << 3) + 1) << 2) + 1, (3 << 5) + 1, (((3 << 3) + 1) << 2), (((1 << 4) + 1) << 1), (((3 << 3) - 1) << 2)... | Python | 1 |
from django.contrib.auth.decorators import permission_required
from django.shortcuts import render, redirect
from .models import CustomUser
from .models import Book
from django.shortcuts import render
from .forms import ExampleForm
@permission_required('bookshelf.can_view', raise_exception=True)
def view_item(reques... | Python | 1 |
/// # use std::borrow::Cow;
/// // Suppose we store a list of active service IDs in a block.
/// // We can do this by defining a corresponding BlockHeaderKey implementation.
/// struct ActiveServices {
/// service_ids: Vec<u32>,
/// }
///
/// # impl BinaryValue for ActiveServices {
... | Rust | 0 |
#!/usr/bin/env python
import os
import pathlib
from setuptools import find_namespace_packages, setup
# The directory containing this file
HERE = pathlib.Path(__file__).parent
# The text of the README file
with open(os.path.join(HERE, "README.md"), "r", encoding="utf-8") as fh:
long_description = fh.read()
# lis... | Python | 1 |
neighbor.make_open()
draw()
if current != start:
current.make_closed()
return False
def make_grid(rows, width):
grid = []
gap = width // rows # integer division: gap b/w each of these rows
for i in range(rows):
grid.append([])
for j in range(rows):
... | Python | 1 |
n__':
import sys
import time
fd = UltraLightFaceDetecion(
"pretrained/version-RFB-320_without_postprocessing.tflite",
conf_threshold=0.88)
cap = cv2.VideoCapture(sys.argv[1])
color = (125, 255, 125)
while True:
ret, frame = cap.read()
if not ret:
b... | Python | 1 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This setup script build a frozen distribution of the application (with the
python interpreter and 3rd party libraries embedded) for Windows.
Run the following command to freeze the app (the frozen executable can be
found in the bin folder::
python freeze_setup.py ... | Python | 1 |
::hashset! {
common::Package {
id: 3,
name: "py-cpuinfo".to_string(),
version: "5.0.0".to_string(),
registries: registries.clone(),
artifact_hash: "4a42aafca3d68e4feee71fde2779c6b30be37370aa6deb3e88356bbec266d017".to_string()
... | Rust | 0 |
# min_coords[2]:max_coords[2]].mean()
new_predictions[y, x] = f_pred["scan_predictions"][min_coords[1]:max_coords[1],
min_coords[0]:max_coords[0],
min_coords[2]:max_coords[2]].mean()
plt.imshow(... | Python | 1 |
systemd/system/guppybot.service");
}
println!(" {}", bot_path.display());
println!(" {}", sysroot.base_dir.display());
println!();
Ok(())
}
pub fn register_ci_group_machine() -> Maybe {
Ok(())
}
pub fn register_ci_group_repo() -> Maybe {
Ok(())
}
pub fn register_ci_machine(repo_url: Option<&str>)... | Rust | 0 |
ros)]
macro_rules! console_log {
($fmt:expr) => {
println!($fmt);
};
($fmt:expr, $($arg:tt)*) => {
println!($fmt, $($arg)*);
}
}
#[allow(unused_macros)]
macro_rules! dbg_assert {
($($arg:tt)*) => {
debug_assert!($($arg)*);
};
}
#[cfg(target_arch = "wasm32")]
#[allow(unu... | Rust | 0 |
assert_eq!(remotes.get(0), Some("origin"));
assert_eq!(remotes.iter().count(), 1);
assert_eq!(remotes.iter().next().unwrap(), Some("origin"));
}
origin.connect(::DirPush).unwrap();
assert!(origin.connected());
origin.disconnect();
origin.connect(::D... | Rust | 0 |
#Sonar Plotter
from matplotlib import pyplot as plt
plotfile = open("SONAR_Experiment-Results", 'r')
plotfile = plotfile.read()
x_axis = ""
y_axis = ""
data = []
number_list = ['1','2','3','4','5','6','7','8','9','0','.']
letter_list = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','... | Python | 1 |
.as_u64().to_owned(),
None => {
msg.channel_id
.say(&ctx.http, "You aren't in a server.")
.await?;
return Ok(());
}
};
let webtoon_id = args.single::<String>()?;
let webtoon_url = args.rest();
lazy_static! {
// Unsure how ... | Rust | 0 |
"""
分析组件管理器模块 - 重构为协调器
采用门面模式,协调各个专门的子管理器:
- AnalysisUpdateManager: 智能更新逻辑
- AnalysisWidgetManager: UI组件管理
- AnalysisDataProcessor: 数据处理协调
职责:作为统一的入口点,保持向后兼容的接口,协调各子管理器工作。
"""
import logging
from typing import Set, Optional, Dict, Any
from PyQt6.QtCore import QObject, pyqtSlot
# 移除核心层直接导入,通过桥接适配器访问
# from app.core.... | Python | 1 |
print('----- Analise de clientes -----')
cliente = input('Digite o seu nome: ')
print('Digite seu modelo: ')
if | Python | 1 |
10X6R10X6_422_UNORM_4PACK16 : i32 = 1000156010;
pub const FORMAT_B10X6G10X6R10X6G10X6_422_UNORM_4PACK16 : i32 = 1000156011;
pub const FORMAT_G10X6_B10X6_R10X6_3PLANE_420_UNORM_3PACK16 : i32 = 1000156012;
pub const FORMAT_G10X6_B10X6R10X6_2PLANE_420_UNORM_3PACK16 : i32 = 1000156013;
pub const FORMAT_G10X6_B10X6_R10X6_3P... | Rust | 0 |
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
b"notify::vspace\0".as_ptr() as *const _,
Some(transmute::<_, unsafe extern "C" fn()>(
notify_vspace_trampoline::<Self, F> as *const (),
... | Rust | 0 |
itives(primitives: Vec<Arc<dyn Primitive + Sync + Send>>) -> Self {
let mut accel = BVHAccel::new(BVHConstructionAlgorithm::SAH, primitives);
let (total, node) = accel.construct().expect("Could not construct BVHTree");
let flat_bvh = accel.flatten(Box::new(node), total);
Self { tree: fl... | Rust | 0 |
IO).unwrap(), format_args!("{}", info));
// Halt the system
loop {
unsafe { asm!("") };
}
}
_ => loop {},
}
}
mod cal;
mod seq;
mod seq_date;
pub use cal::Cal;
pub use seq::Seq;
pub use seq_date::SeqDate;
use crate::span::Span;
// use blake3;
us... | Rust | 0 |
55'))
assert elliprj(-1+j,-2-j,-j,-1+j).ae(mpc('1.8249027393703805304622013339009022294368078659619988943515764258335975852685224202567854526307030593012768954',
'-1.2218475784827035854568450371590419833166777535029296025352291308244564398645467465067845461070602841312456831'))
assert ellip... | Python | 1 |
= torch.where(z == 0, logp_z0, logp_z1)
logpz = torch.where(mask, logpz, logpz.new_zeros([1]))
# sparsity regularization
zsum = z.sum(1) # [B]
zdiff = z[:, 1:] - z[:, :-1]
zdiff = zdiff.abs().sum(1) # [B]
zsum_cost = sparsity * zsum.mean(0)
optional["zsum_cos... | Python | 1 |
}
}
}
}
#![cfg_attr(not(feature = "std"), no_std)]
mod event;
pub use event::{
assert_emitted_event_len,
encoded_into_hash,
PrefixedValue,
};
use crate::{error::Error, Result};
use blister_format::{values::Sha1, Map, Value};
use chrono::{DateTime, TimeZone, Utc};
use num_enum::{In... | Rust | 0 |
&self.outer {
Some(outer) => outer.get(name),
None => None,
},
}
}
pub fn set(&mut self, name: &str, obj: Object) -> Object {
self.store.insert(name.to_string(), obj.clone());
obj
}
}
// Copyright 2018 The Fuchsia Authors. All rights rese... | Rust | 0 |
import torch
import torch.nn as nn
import math
class TokenEmbedding(nn.Embedding):
def __init__(self, vocab_size, embed_size=512):
super().__init__(vocab_size, embed_size, padding_idx=0)
class PositionalEmbedding(nn.Module):
def __init__(self, d_model, max_len=512):
super().__init__()
... | Python | 1 |
} | KTy2::Unknown | KTy2::Never => None,
KTy2::Ptr { .. } | KTy2::Fn { .. } => Some(align_of::<*const ()>()),
KTy2::Unit => Some(1),
KTy2::Number(number_ty) => number_ty.size_of(),
KTy2::ConstEnum(const_enum) => const_enum
.of(&mod_outline.const_enums)
... | Rust | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.