text string | label_name string | labels int64 |
|---|---|---|
hir_ty.hir_id);
walk_ty(self, hir_ty);
}
}
fn span_lint(cx: &LateContext<'_>, span: Span) {
span_lint_and_sugg(
cx,
USE_SELF,
span,
"unnecessary structure name repetition",
"use the applicable keyword",
"Self".to_owned(),
Applicability::MachineAp... | Rust | 0 |
m.lookup_char_pos(self.where_inner.lo());
if outer.file.start_pos == inner.file.start_pos {
// mod foo { ... }
where_outer
} else {
// mod foo; (and a separate SourceFile for the contents)
self.where_inner
}
});
... | Rust | 0 |
import pickle
import sys
sys.path.append("/home/sky/바탕화면/2025 MAS/CoELA_P/virtualhome/simulation")
from unity_simulator import comm_unity
#---------
# 1. Load Action Logs
#---------
with open("/home/sky/바탕화면/2025 MAS/CoELA_P/test_results/LLMs_comm_mistral-7b/logs_agent_10_put_dishwasher_0.pik", "rb") as f:
data =... | Python | 1 |
lib3h_protocol::{
network_engine::NetworkEngine, protocol_server::Lib3hServerProtocol, Address,
};
use std::collections::{HashMap, HashSet};
use url::Url;
static TIMEOUT_MS: usize = 5000;
pub type EngineFactory =
fn(config: &RealEngineConfig, name: &str) -> Lib3hResult<Box<dyn NetworkEngine>>;
/// Mock of a ... | Rust | 0 |
TAP_ENABLE_W {
TEST_TAP_ENABLE_W { w: self }
}
}
<gh_stars>0
use std::io;
use trackable::error::TrackableError;
use trackable::error::{ErrorKind as TrackableErrorKind, ErrorKindExt};
/// The error type for this crate.
#[derive(Debug, Clone, TrackableError)]
pub struct Error(TrackableError<ErrorKind>);
impl... | Rust | 0 |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
"""
Date: 2024/4/25 17:00
Desc: 新闻联播文字稿
https://tv.cctv.com/lm/xwlb
"""
import re
import pandas as pd
import requests
from bs4 import BeautifulSoup
from tqdm import tqdm
def news_cctv(date: str = "20240424") -> pd.DataFrame:
"""
新闻联播文字稿
https://tv.cctv.com/lm... | Python | 1 |
def arr_dfs_recur(i, j, cut=False, s=0, visited=None):
# i j좌표, cut 깎았다면 True 안깎았다면 False, S 이전칸까지 등산로 길이
global maxV
if visited == None : visited = [[False]*N for _ in range(N)]
if maxV < s+1: # 등산로 길이 갱신
maxV = s+1
# 현재 위치 방문 표시
visited[i][j] = True
for di, dj in [(0, 1), (1,... | Python | 1 |
d(mem_first, {addr}) & 0xFF) != {mem.value[i]})\n")
main.write(f'\tprintf(" [!] Memory at 0x{addr:08X}: expected {mem.value[i]}, got %d\\n", memory_map_read(mem_first, {addr}) & 0xFF);\n')
def test_flag(expected: bool | None, flag_const: str):
if expected is not N... | Python | 1 |
],
true,
)
},
// Bootnodes
vec![],
// Telemetry
None,
// Protocol ID
None,
// Properties
None,
// Extensions
None,
))
}
/// Configure initial storage state for FRAME modules.
fn testnet_genesis(
wasm_binary: &[u8],
initial_authorities: Vec<(AuraId, GrandpaId)>,
root_key: AccountId... | Rust | 0 |
#!/usr/bin/env python
# coding: utf-8
# # Signal Generation
# *by Luke Chang*
#
# Measuring in-vivo brain activity from humans is an extraordinary feat. How do scanners work? and what exactly are we measuring? In this course, we will be learning how to analyze functional magnetic resonance imaging (fMRI) data. Before... | Python | 1 |
pub fn to_index(self) -> usize { self.0 as usize - 1 }
}
impl fmt::Display for AtomType {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt::Display::fmt(&self.0, f)
}
}
}
/*
* EVE Swagger Interface
*
* An OpenAPI for EVE Online
*
* OpenAPI spec version: 1.... | Rust | 0 |
layer(self.inner))
}
}
#[cfg(feature = "std")]
impl<R: Recorder + 'static> Stack<R> {
/// Installs this stack as the global recorder.
///
/// An error will be returned if there's an issue with installing the stack as the global recorder.
pub fn install(self) -> Result<(), SetRecorderError> {
... | Rust | 0 |
f.non_exhaustive.enum_info_(),
};
let x=UnwrapEnumError::new(x);
RBoxError::new(x)
}
}
impl<N> UnwrapEnumError<N>{
#[inline]
const fn new(non_exhaustive:N)->Self{
Self{
non_exhaustive,
_priv:(),
}
}
}
impl<N> Display for UnwrapEnumError<... | Rust | 0 |
(), formatter.format_node(node)?]
} else {
empty_element()
};
Ok(format_elements![
formatter.format_node(self.member()?)?,
formatter.format_token(&self.colon_token()?)?,
space_token(),
formatter.format_node(self.pattern()?)?,
init_node,
])
}
}
impl ToFormatElement for JsObjectAssignmentPatte... | Rust | 0 |
DesktopLayoutOrientation {
self.0.orientation
}
pub fn columns(&self) -> u32 {
self.0.columns
}
pub fn rows(&self) -> u32 {
self.0.rows
}
pub fn starting_corner(&self) -> DesktopLayoutStartingCorner {
self.0.starting_corner
}
}
pub fn set_desktop_layout(c: &Connection, screen: i32, orientation: Desk... | Rust | 0 |
)),
crate::params::validate_signature(array_without_type)
);
let invalid_chars = "!!§$%&(i)a";
assert_eq!(
Err(crate::message::Error::InvalidSignature(
crate::signature::Error::InvalidSignature
)),
crate::params::validate_signature(invalid_chars)
);
// TO... | Rust | 0 |
) as usize] = Some(index as u8);
}
Self {
view: view_packet_size.view.clone(),
view_frame_index,
per_view_submit_data: AtomicOnceCell::new(),
render_object_instances_submit_data: AtomicOnceCellArray::with_capacity(
view_packet_size.num_ren... | Rust | 0 |
, args: Args) -> CommandResult {
let value = args.rest();
let ban_user_on_join: bool;
if value == "true" {
ban_user_on_join = true;
} else if value == "false" {
ban_user_on_join = false;
} else {
return Err(CommandError::from("Value must be true or false"));
}
{
... | Rust | 0 |
///
/// create_meshedchannels!(MeshedChannels, 3);
///
/// create_send_mpst_http_bundle!(
/// send_http_d_to_a,
/// RoleA,
/// 1 |
/// send_http_d_to_b,
/// RoleB,
/// 2 | =>
/// RoleD,
/// MeshedChannels,
/// 3
/// );
/// ```
///
/// *This macro is available only if mp-anon is built with
///... | Rust | 0 |
import qrcode
import base64
# Example image and text data
image_paths = ["certificate-template.jpg", "certificate-template.jpg", "certificate-template.jpg"]
text_data_list = ["Text Data 1", "Text Data 2", "Text Data 3"]
qr_code_data_list = []
# Encode image data as base64 strings and add to the list
for i in range(l... | Python | 1 |
}
}
};
(fn $name:ident($($arg:ident: $arg_ty:ty),*,) $body:block) => {
ffi_fn!(fn $name($($arg: $arg_ty),*) -> () $body);
};
(fn $name:ident($($arg:ident: $arg_ty:ty),*) $body:block) => {
ffi_fn!(fn $name($($arg: $arg_ty),*) -> () $body);
};
}
macro_rules! sign_d... | Rust | 0 |
# Message type.
type: Literal["reply"] = "reply"
@dataclass(frozen=True)
class ChatThreadMetadata:
"""
Chat thread item.
"""
thread_id: ThreadID
name: str
creation_ts: float
last_interaction_ts: float
@dataclass(frozen=True)
class StartNewChatReply:
"""
Message sent from... | Python | 1 |
);
}
}
print_run_result(dbg.call(func_index, &args_parsed)?, dbg)
}
fn cmd_reset(dbg: &mut Debugger, _args: &[CmdArg]) -> CmdResult {
dbg.reset_vm()?;
Ok(())
}
fn cmd_break(dbg: &mut Debugger, args: &[CmdArg]) -> CmdResult {
let func_index = args[0].as_u32();
let instr_index = args.ge... | Rust | 0 |
import tkinter as tk
import subprocess
def center_window(window, width, height):
screen_width = window.winfo_screenwidth()
screen_height = window.winfo_screenheight()
x_coordinate = (screen_width - width) // 2
y_coordinate = (screen_height - height) // 2
window.geometry(f"{width}x{height}+{x_coor... | Python | 1 |
std::os::raw::c_ushort;
pub type GLvdpauSurfaceNV = GLintptr;
extern "C" {
pub static mut GLAD_GL_VERSION_1_0: ::std::os::raw::c_int;
}
pub type PFNGLCULLFACEPROC = ::std::option::Option<unsafe extern "C" fn(mode: GLenum)>;
extern "C" {
pub static mut glad_glCullFace: PFNGLCULLFACEPROC;
}
pub type PFNGLFRONTFAC... | Rust | 0 |
isk_size: u8, num_disks: u8) -> TestResult {
let disk_size = Block(disk_size as u32);
let vdev = try_ret!(build_parity_vdev(disk_size, num_disks));
TestResult::from_bool(vdev.size() == Block::<u64>::from(disk_size) * num_disks as u64)
}
#[quickcheck]
fn effective_free_size(disk_size... | Rust | 0 |
ODE!(FILE_DEVICE_USB, USB_REQ_GLOBAL_RESUME, METHOD_NEITHER, FILE_ANY_ACCESS);
STRUCT!{struct USB_START_FAILDATA {
LengthInBytes: ULONG,
NtStatus: NTSTATUS,
UsbdStatus: USBD_STATUS,
ConnectStatus: ULONG,
DriverData: [UCHAR; 4],
}}
pub type PUSB_START_FAILDATA = *mut USB_START_FAILDATA;
pub const IOC... | Rust | 0 |
# Code generated by Lark OpenAPI.
from typing import Any, Optional, Union, Dict, List, Set, IO, Callable, Type
from lark_oapi.core.construct import init
from .audit_log_es_field import AuditLogEsField
class AuditLogListApplicationAuditLogResponseBody(object):
_types = {
"items": List[AuditLogEsField],
... | Python | 1 |
= U256::new(100);
assert!(x <= y);
assert_eq!(x.cmp(&y), Ordering::Equal);
}
}
<gh_stars>100-1000
use dotrix_core::{ Id, Renderer, Transform };
use dotrix_core::assets::{ Assets, Mesh };
use dotrix_core::renderer::UniformBuffer;
/// Model component
#[derive(Default)]
pub struct Model {
/// [`I... | Rust | 0 |
put::Device::from_ptr(device),
pad
})
},
_ => None
}
}
/// Gets the wlr_input_device associated with this TabletPad.
pub fn input_device(&self) -> &input::Device {
&self.device
}
}
impl Drop for TabletPad {
fn drop(&mut se... | Rust | 0 |
valid Attachment Json".to_string()))?
}
serde_json::Value::String(str) => str,
val => return Err(VcxError::from_msg(VcxErrorKind::InvalidJson, format!("Unsupported Json value: {:?}", val)))
}
... | Rust | 0 |
_digit(10).unwrap() as i32));
}
// Simulate
let mut n_flashes: usize = 0;
for _ in 0..*steps {
n_flashes += simulate_step(&m, &n, &mut octopuses);
}
return n_flashes;
}
/// Calculate the step when the flashes synchronize.
pub fn all_flash(filename: &String) -> usize {
let contents =
fs::read_to... | Rust | 0 |
0.820, 0.800, 1.000];
pub const DARK_TURQUOISE: [f32; 4] = [0.000, 0.808, 0.820, 1.000];
pub const CADET_BLUE: [f32; 4] = [0.373, 0.620, 0.627, 1.000];
pub const STEEL_BLUE: [f32; 4] = [0.275, 0.510, 0.706, 1.000];
pub const LIGHT_STEEL_BLUE: [f32; 4] = [0.690, 0.769, 0.871, 1.000];
pub const POWDER_BLUE: [f32; 4] = [0... | Rust | 0 |
rice_range:
for num_paths in num_paths_range:
option = EquityFixedLookbackOption(expiry_dt, opt_type, k)
stock_min = stock_price - 10.0
value = option.value(
value_dt,
stock_price,
discount_curve,
dividend_curve,... | Python | 1 |
<Shader<B>>,
name: Option<String>,
}
impl<B: Backend> ShaderModule<B> {
fn new(context: Arc<Context<B>>, module: &Module) -> DeviceResult<Self> {
let name = module.name().map(Into::into);
// Hack because DX12 doesn't like parallel shader compiliation.
#[cfg(windows)]
let s = if ... | Rust | 0 |
mpare to region from 0.5*zmax to 0.9*zmax
z_idx = (z_vec >= 0.5 * zmax) & (z_vec < 0.9 * zmax)
Ex_dat = Ex[...]
Ey_dat = Ey[...]
Ex_mean = Ex_dat[:, :, z_idx].mean(axis=2).T
Ey_mean = Ey_dat[:, :, z_idx].mean(axis=2).T
Ex_nodal = Ex_mean
Ey_nodal = Ey_mean
XM, YM = np.meshgrid(x_vec, y_vec, indexing="xy")
RM = np.s... | Python | 1 |
ort.comment,
&report.date,
&report.category_id,
&report.user_id
])
.await;
match result {
Ok(report_vec) => {
report_vec.iter()
.map(|row| Report::from_row_ref(row).unwrap())
... | Rust | 0 |
select a from b;"#,
r#"describe a;"#,
r#"describe a; describe b"#,
r#"create table if not exists a.b (c integer not null default 1, b varchar);"#,
r#"create table if not exists a.b (c integer default 1 not null, b varchar) as select * from t;"#,
r#"create table a.b like c.d;"#,
... | Rust | 0 |
);
}
fn paint_job(&mut self, ctx: &mut Context, vertices: &[Vertex], indices: &[u16]) {
let screen_size_in_pixels = ctx.screen_size();
let pixels_per_point = ctx.dpi_scale();
let vertices_size_bytes = vertices.len() * std::mem::size_of::<Vertex>();
if self.bindings.ver... | Rust | 0 |
#!/usr/bin/env python
from tools.load import LoadMatrix
import shogun as sg
lm=LoadMatrix()
traindat = lm.load_dna('../data/fm_train_dna.dat')
testdat = lm.load_dna('../data/fm_test_dna.dat')
parameter_list = [[traindat,testdat, 3,1.4,10,3,0,False],[
traindat,testdat, 3,1.4,10,3,0,False]]
def kernel_match_word_strin... | Python | 1 |
essage(bincode::Error),
#[error("can not send message to socket: {0}")]
SendMessage(std::io::Error),
}
pub const fn new(socket_path: PathBuf) -> Client {
Client { socket_path }
}
impl Client {
pub fn send(&self, message: &Message) -> Result<(), Error> {
let socket = UnixDatagram::unbound().ma... | Rust | 0 |
m.data_chunk },
));
::protobuf::reflect::MessageDescriptor::new_pb_name::<EosTxActionAck_EosActionUnknown>(
"EosTxActionAck.EosActionUnknown",
fields,
file_descriptor_proto()
)
})
}
fn default_instance() -> &'static Eo... | Rust | 0 |
import numpy as np
f1, f2, f3 = 1.5251, -1.1568, 0.1292
q1, q2, q3 = 0.7000, 1.4187, -0.4990
def F_of_a(a):
return f1 + f2*(1.0-a)**f3
def Q_of_a(a):
return q1 + q2*(1.0-a)**q3
def scale_slopes(kf0, kt0, a, p_f=1.0, p_tau=1.0):
Fa = F_of_a(a); F0 = F_of_a(0.0)
Qa = Q_of_a(a); Q0 = Q_of_a(0.0)
... | Python | 1 |
**UID:** 1.2.840.10008.5.1.1.33
/// - **UID Type:** SOP Class
pub static MediaCreationManagementSOPClassUID: UID = UID {
ident: "MediaCreationManagementSOPClassUID",
uid: "1.2.840.10008.5.1.1.33",
name: "Media Creation Management SOP Class UID",
};
/// Display System SOP Class
///
/// - **UID:** 1.2.840.10... | Rust | 0 |
db7, 227),
crc32(0x04c11db7, 228),
crc32(0x04c11db7, 229),
crc32(0x04c11db7, 230),
crc32(0x04c11db7, 231),
crc32(0x04c11db7, 232),
crc32(0x04c11db7, 233),
crc32(0x04c11db7, 234),
crc32(0x04c11db7, 235),
crc32(0x04c11db7, 236),
crc32(0x04c11db7, 237),
crc32(0x04c11db7, 238),
... | Rust | 0 |
{
let mut args = exact_args!(2, args)?;
let index = args.pop().unwrap();
let smpl_index = irmatch!(index; Value::Int(i) => i) as i64;
let vec_struct = args.pop().unwrap();
let vec_struct = irmatch!(vec_struct; Value::Struct(s) => s);
let data = vec_struct.ref_field(VEC_DATA_KEY).unwrap();
... | Rust | 0 |
#b'r1b3k1/pp3p1p/2pp2p1/8/2P2q2/2N4R/PP1QBPP1/R4K2 b - - 0 18 2 Limit(time=30, depth=50, nodes=25000000)'
[{'string': 'NNUE evaluation using nn-37f18f62d772.nnue (6MiB, (22528, 128, 15, 32, 1))', 'depth': 29, 'seldepth': 45, 'multipv': 1, 'score': PovScore(Cp(+416), BLACK), 'nodes': 25005397, 'nps': 1847598, 'hashfull'... | Python | 1 |
one)]
/// enum MyError {
/// TooManyRedirects,
/// // ...
/// }
///
/// let policy = Limited::default().or::<_, (), _>(Err(MyError::TooManyRedirects));
/// ```
fn or<P, B, E>(self, other: P) -> Or<Self, P>
where
Self: Policy<B, E> + Sized,
P: Policy<B, E>;
}
... | Rust | 0 |
where
M: MapAccess<'de>,
{
visit_versioned(map, SERIALIZE_KEY_EVENT, |version, event| VersionedEvent {
version,
event,
})
}
}
impl<'de, A, E> Deserialize<'de> for VersionedEvent<A>
where
A: Aggregate<Event = E>,
E: Event<A> + Deserialize<'de>,
{
... | Rust | 0 |
ection(self.appengine_manager, url)
def clear(self):
pass
class _AppEngineConnection(object):
"""Implements urllib3's HTTPConnectionPool API's urlopen().
This Connection's urlopen() is called with a host-relative path,
so in order to properly support opening the URL, we need to store
the... | Python | 1 |
#method.raw_path_segment_iter
pub unsafe fn unsafe_path_segment_iter(&mut self) -> impl Iterator<Item = &str> {
let path = self.path_as_rel_ref_mut();
let is_empty = path.is_empty();
let starts_with_slash = path.starts_with('/');
let mut_bytes = path.as_mut_str().as_bytes_mut();
... | Rust | 0 |
from fastapi import APIRouter
router = APIRouter()
@router.get("/test")
def read_root():
return {"Hello": "test"}
| Python | 1 |
are the best\nbenoit,34,The crepes are really good\n"[..];
let mut builder = IndexDocuments::new(&mut wtxn, &index, 0);
builder.enable_autogenerate_docids();
builder.update_format(UpdateFormat::Csv);
builder.execute(content, |_, _| ()).unwrap();
// In the same transaction provi... | Rust | 0 |
),
}
}
/// Gets the size of the buffer
///
/// # Returns
/// The number of elements in the buffer.
///
/// # Examples
///
/// ```
/// # use queues::*;
/// let mut buf: Buffer<isize> = Buffer::new(3);
/// assert_eq!(buf.size(), 0);
/// buf.add(42);
/// ass... | Rust | 0 |
let fn_doc = format!("set the value of the sort key ({})", ident);
tokens.extend(quote_spanned! { ident.span() =>
impl #impl_generics #builder_p #ty_generics #where_clause {
#[doc = #fn_doc]
#vis fn #ident(self) -> ::nitroglyc... | Rust | 0 |
, match="Received sentinel value, stopping loop"):
collate_requests(api, request_queue)
class BatchSizeMismatchAPI(SimpleBatchLitAPI):
def predict(self, x):
assert len(x) == 2, "Expected two concurrent inputs to be batched"
return self.model(x) # returns a list of length same as len(x)
... | Python | 1 |
png".format(frame_id))), dtype = np.float32)
)
colors_list = np.stack(colors_list, axis = 0)
depths_list = np.stack(depths_list, axis = 0)
# point clouds - 处理点云图像
clouds = []
for i, frame_id in enumerate(obs_frame_ids):
points, colors = self.load_point_cl... | Python | 1 |
_chars['v'])
bot_line = array('u', box_chars['bl'] + label_border_bottom + box_chars['br'])
textpad[y][x - 1:x + w] = top_line
textpad[y + 1][x - 1:x + w] = lab_line
textpad[y + 2][x - 1:x + w] = crn_line
textpad[y + 3][x:x + w] = mid_line
textpad[y + 4][x:x + w] = mid_line
textpad[y + 5][x... | Python | 1 |
ed_fmt = '%b %d, %Y'
# If true, SmartyPants will be used to convert quotes and dashes to
# typographically correct entities.
#html_use_smartypants = True
# Custom sidebar templates, maps document names to template names.
#html_sidebars = {}
# Additional templates that should be rendered to pages, maps page names to
... | Python | 1 |
n line_cap(&self) -> LineCap {
self.state.line_cap
}
pub fn line_join(&self) -> LineJoin {
self.state.line_join
}
pub fn set_line_join(&mut self, join: LineJoin) {
self.state.line_join = join;
self.state.paint.stroke_paint_mut().set_stroke_join(join.into());
}
... | Rust | 0 |
Hex = NtHex::parse_rule_map("MAPFgFoF2gXgH5oF4B+gH4A6A")?;
assert_eq!(rule1, rule2);
Ok(())
}
}
<filename>src/lib.rs
pub mod arduino;
pub mod headunit;
pub mod spi;
use anyhow::*;
use evdev_rs::Device;
use std::cmp::Ordering;
use std::path::PathBuf;
#[derive(Debug, Clone)]
pub struct DeviceInfo {
... | Rust | 0 |
}
impl<'a> _OSPEEDR15W<'a> {
#[doc = r" Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: OSPEEDR15W) -> &'a mut W {
unsafe { self.bits(variant._bits()) }
}
#[doc = "Low Speed"]
#[inline(always)]
pub fn low_speed(self) -> &'a mut W {
self.varian... | Rust | 0 |
from django.db import models
from django.utils import timezone
from django.contrib.auth.models import User
from ckeditor.fields import RichTextField
from core.models import CommonInfo
# Create your models here.
class Category(models.Model):
name = models.CharField(max_length=200, verbose_name='Nombre de la categorí... | Python | 1 |
import os
from dotenv import load_dotenv
load_dotenv()
class BaseConfig:
SECRET_KEY = os.getenv('SECRET_KEY')
BOT_TOKEN = os.getenv('BOT_TOKEN')
MAIN_CHANNEL_ID = os.getenv('MAIN_CHANNEL_ID')
DB_NAME = os.getenv('DB_NAME')
DB_USER = os.getenv('DB_USER')
DB_PASSWORD = os.getenv('DB_PASSWORD')
... | Python | 1 |
("3cb25f25faacd57a90434f64d0362f2a2d2d0a90cf1a5a4c5db02d56ecc4c5bf34007208d5b887185865")
.unwrap()
);
}
#[test]
#[cfg(ossl111)]
fn hkdf_expand() {
let mut ctx = PkeyCtx::new_id(Id::HKDF).unwrap();
ctx.derive_init().unwrap();
ctx.set_hkdf_mode(HkdfMode::EX... | Rust | 0 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright (C) 2022 F4PGA Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unle... | Python | 1 |
::RESTART.into(), 31415u32.into())
});
assert_eq!(exit_call, ExitCall::Restart(31415));
}
#[test]
fn exit_terminate() {
let exit_call = exit_test("fake::syscalls::exit_impl_tests::exit_terminate", || {
exit(libtock_platform::exit_id::TERMINATE.into(), 9265u32.into())
});
assert_eq!(exit_cal... | Rust | 0 |
Hopefully) get a book element from a descriptor line with a specified
/// [separator](https://nabijaczleweli.xyz/content/gen-epub-book/programmer.html#features-custom-separator)
/// with the specified
/// [rigidness](https://nabijaczleweli.xyz/content/gen-epub-book/programmer.html#features-free-date-format)... | Rust | 0 |
>>();
assert_eq!(regions.len(), 5);
assert_eq!(regions[0].base_address, 0x1000);
assert_eq!(regions[0].size, 0x1000);
assert_eq!(regions[1].base_address, 0x1000);
assert_eq!(regions[1].size, 0x1000);
assert_eq!(regions[2].base_address, 0x1001);
assert_eq!(regions[... | Rust | 0 |
}
}
pub fn is_recv_stream(&self, stream_id: u64) -> bool {
match self.remote_stream_id {
Some(id) => id == stream_id,
None => false,
}
}
pub fn add_send_stream(&mut self, stream_id: u64) {
if self.local_stream_id.is_some() {
panic!("... | Rust | 0 |
he exact procedure.
:param x: Training data.
:param y: Labels for the training data.
:param validation_data: Validation data.
:param batch_size: Size of batches. Overwrites batch_size defined in __init__ if not None.
:param nb_epochs: Number of epochs to use for trainings. Overw... | Python | 1 |
this contract:\nResponse: `{}`\nDetails: `{}`",
resp.message,
resp.result
);
}
} else {
println!(
r#"Submitted contract for verification:
Response: `{}`
GUID: `{}`
url: {}#code"#,
resp.message,
... | Rust | 0 |
serializer_coords.save()
instance = Level.objects.get(pereval=pk)
serilizer_level = LevelSerializer(data=request_level, instance=instance, partial=True)
serilizer_level.is_valid()
serilizer_level.save()
instance = Images.objects.filter(pereval=pk)
if request.data.get... | Python | 1 |
'
<FILE> 'FTL file to parse'",
)
.get_matches();
let input = matches.value_of("FILE").unwrap();
let source = read_file(&input).expect("Read file failed");
let res = parse(&source);
match res {
Ok(res) => print_entries_resource(&res),
Err((res, errors)) =>... | Rust | 0 |
'宋', '黑', '楷', '仿', '微软', '华文', 'SimSun', 'SimHei', 'KaiTi', 'FangSong', 'Microsoft YaHei']
# 记录详细信息
app_logger.debug(f"加载系统字体成功,共 {len(self.system_fonts)} 个字体")
app_logger.debug(f"识别中文字体 {len(self.chinese_fonts)} 个")
# 如果字体数量仍然异常少,记录所有字体并添加基本字体
... | Python | 1 |
#
# Copyright (c) 2023 Airbyte, Inc., all rights reserved.
#
from setuptools import find_packages, setup
MAIN_REQUIREMENTS = [
"airbyte-cdk",
]
TEST_REQUIREMENTS = [
"pytest~=6.1",
"pytest-mock~=3.6.1",
"requests-mock",
]
setup(
entry_points={
"console_scripts": [
"source-ch... | Python | 1 |
import turtle
import math
# Set up the turtle screen
screen = turtle.Screen()
screen.bgcolor("white")
# Create a turtle instance
t = turtle.Turtle()
t.speed(1) # Set the drawing speed (1 is slowest, 10 is fastest)
t.pensize(2) # Set the pen size
# Define a function to draw a rectangle
def draw_rectangle(x, y, widt... | Python | 1 |
blocking_postbox: self.blocking_postbox.clone(),
_payload_type: PhantomData,
_unblocker: PhantomData,
}
}
}
impl<U, P, PB> Errors for AsyncPostbox<U, P, PB>
where
PB: Errors,
{
type Error = PB::Error;
}
impl<U, P, PB> Sender for AsyncPostbox<U, P, PB>
where
U: Unb... | Rust | 0 |
80dd);
ethertype!(INTEGRATED_SOLUTIONS_TRFS = [0x80de, 0x80df]);
ethertype!(ALLEN_BRADLEY = [0x80e0, 0x80e3]);
ethertype!(RETIX = 0x80f2);
ethertype!(APPLETALK_AARP_KINETICS = 0x80f3);
ethertype!(KINETICS = [0x80f4, 0x80f5]);
ethertype!(APOLLO_COMPUTER = 0x80f7);
ethertype!(WELLFLEET_COMMUNI... | Rust | 0 |
core::mem::MaybeUninit;
use core::cell::UnsafeCell;
const HAS_WAKER_FLAG: u8 = 0b0000_0001;
const LOCKED_FLAG: u8 = 0b0000_0010;
const WAKE_REQUESTED: u8 = 0b0000_0100;
/// Marker struct for IRQ context functions
pub struct IrqCtx;
/// Marker struct for application context functions
pub struct AppCtx;
/// An interr... | Rust | 0 |
# dataset settings
_base_ = './mapillary_v1.py'
metainfo = dict(
classes=('Bird', 'Ground Animal', 'Curb', 'Fence', 'Guard Rail', 'Barrier',
'Wall', 'Bike Lane', 'Crosswalk - Plain', 'Curb Cut', 'Parking',
'Pedestrian Area', 'Rail Track', 'Road', 'Service Lane',
'Sidewalk', 'B... | Python | 1 |
(self.x2)
s1.sum().backward()
s2.sum().backward()
print()
print_distance(self.x1, self.x2, ' x')
print_distance(s1, s2, ' s')
print_distance(self.x1.grad, self.x2.grad, 'dx')
print_distance(tn.tau.grad, cn.tau.grad, 'dtau')
def testmParametricLIF(self):
... | Python | 1 |
co2 = v.clone();
let mut n:usize = 0;
while oxygen.len() > 1 {
oxygen = filter_oxygen(oxygen, n);
n += 1;
}
n = 0;
while co2.len() > 1 {
co2 = filter_co2(co2, n);
n += 1;
}
let oxygen_int:usize = usize::from_str_radix(&oxygen[0], 2).unwrap();
let co2_int:... | Rust | 0 |
ToString` imported, and I call `to_string()` on a value of
type `T`, then we will go off to find out whether there is an impl of
`ToString` for `T`. These kinds of method calls are called "extension
methods". They can be defined in any module, not only the one that
defined `T`. Furthermore, you must import the trait... | Rust | 0 |
ssions<Period, Offset>;
type NextSessionRotation = pallet_session::PeriodicSessions<Period, Offset>;
type SessionManager = MockSessionManager;
type SessionHandler = <MockSessionKeys as OpaqueKeys>::KeyTypeIdProviders;
type Keys = MockSessionKeys;
type WeightInfo = ();
}
pub struct MockSessionManager;
impl pallet... | Rust | 0 |
es.h
static const fe d = """)
buf.write(to_literal(d))
buf.write(""";
static const fe sqrtm1 = """)
buf.write(to_literal(modp_sqrt_m1))
buf.write(""";
static const fe d2 = """)
buf.write(to_literal(d2))
buf.write(""";
#if defined(OPENSSL_SMALL)
// This block of code replaces the standard b... | Python | 1 |
)
if not raw:
return queue.put(dict())
parsed = self.json_parse(raw)
if not parsed:
return queue.put(dict())
data = fetch_data(raw_data=parsed, metrics=HEALTH_STATS)
dummy = {
'status_green': 0,
'status_red': 0,
'statu... | Python | 1 |
import os
import boto3
import json
import base64
from io import BytesIO
from random import randint
#get a BytesIO object from file bytes
def get_bytesio_from_bytes(image_bytes):
image_io = BytesIO(image_bytes)
return image_io
#get a base64-encoded string from file bytes
def get_base64_from_bytes(image_bytes... | Python | 1 |
o::FieldInfo;
use crate::entities::method_info::MethodInfo;
use crate::entities::read_bytes::ReadBytes;
#[derive(Default, PartialEq, Eq, Serialize, Deserialize, Debug, Clone)]
pub struct ClassStruct {
magic: u32,
minor_version: u16,
major_version: u16,
constant_pool: Vec<ConstantContainer>,
access_flags: u16,
th... | Rust | 0 |
o devices only: the rate at which synchronization feedback
* is provided. */
pub bRefresh: uint8_t,
/** For audio devices only: the address if the synch endpoint */
pub bSynchAddress: uint8_t,
/** Extra descriptors. If libusbx encounters unknown endpodescriptors: c_int,
* it will store them here, should you w... | Rust | 0 |
)]
mod tests {
use super::*;
#[test]
fn accept_valid_tracking_status_message() {
let bytes = [b'#', b'K', 0];
let tracking_status = TrackingStatus::parse_from_bytes(bytes.as_ref()).unwrap().1;
assert_eq!(tracking_status, TrackingStatus::Disabled);
}
}
// Workaround rustfmt bug:
... | Rust | 0 |
bool, SharedKeys, LocalSig), Error> {
let shared_keys_for_positive =
Sign::verify_vss_and_construct_key(&shared_block_secrets.for_positive(), &index)?;
let local_sig_for_positive = Sign::sign(
&shared_keys_for_positive,
&priv_shared_keys,
block.sighash(),
... | Rust | 0 |
in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//! Information schema for the runtime dispatch... | Rust | 0 |
new empty Queue-Entry with the Cycle and Index set to 0
pub fn new() -> Self {
Self(atomic::AtomicU64::new(0))
}
pub fn load(&self, order: atomic::Ordering) -> u64 {
self.0.load(order)
}
pub fn cas(
&self,
previous: u64,
cycle: u32,
index: u32,
... | Rust | 0 |
# -*- coding: utf-8 -*-
# File: __init__.py
from .tower import get_current_tower_context, TowerContext
# https://github.com/celery/kombu/blob/7d13f9b95d0b50c94393b962e6def928511bfda6/kombu/__init__.py#L34-L36
STATICA_HACK = True
globals()['kcah_acitats'[::-1].upper()] = False
if STATICA_HACK:
from .common impo... | Python | 1 |
String::new())
}
pub fn get_src(&self) -> &str {
match self.src.as_ref() {
Some(v) => &v,
None => "",
}
}
fn get_src_for_reflect(&self) -> &::protobuf::SingularField<::std::string::String> {
&self.src
}
fn mut_src_for_reflect(&mut self) -> &mut ... | Rust | 0 |
pari] (cypari2 and libpari) dependency."
)
mx = mult_by_n_own(curve, n)
if x_only:
return mx, None
xs, ys = symbols("x y")
K = FF(curve.prime)
x = Poly(xs, xs, domain=K)
y = Poly(ys, ys, domain=K)
Kxy = lambda r: Poly(r, xs, ys, domain=K) # noqa
a1, a2, a3, a4... | Python | 1 |
ong enough.")
# Get intent history
history = intent_system.get_intent_history(3)
print(f"\nIntent history (last {len(history)} entries):")
for i, entry in enumerate(history):
print(f" #{i+1}: Norm: {entry['intent_norm']:.2f}, Stimuli: {', '.join(entry['stimuli_keys'])}")
# Print o... | Python | 1 |
>AoC2021_day12/src/main.rs<gh_stars>0
use std::collections::HashMap;
use std::io::BufRead;
fn main() {
part_two();
}
fn part_one() {
let stdin = std::io::stdin();
let lines = stdin.lock().lines().map(|l|l.unwrap());
let mut connection_map: HashMap<String, Vec<String>> = HashMap::new();
for line ... | Rust | 0 |
fn(DomRef<&'_ T>)>>) -> Node<'a, ThreadBound>, depth_limit: usize, binding_count: isize) {
unsafe {
if !LOG_INITIALIZED {
//TODO: Fail on Warnig or Error.
tracing_wasm::set_as_global_default();
LOG_INITIALIZED = true;
}
}
let body = window().unwrap().document().unwrap().body().unwrap().dyn_into::<Html... | Rust | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.