text string | label_name string | labels int64 |
|---|---|---|
programs that explicitly check for [`read_closed`],
/// [`write_closed`], or [`error`] readiness should be doing so as an
/// **optimization** and always be able to handle an error or close situation
/// when performing the actual read operation.
///
/// [`readable`]: ./event/struct.Event.html#method.is_readable
/// [`... | Rust | 0 |
"""Chapter 22: Online Belief State Planning""" | Python | 1 |
q6::one());
assert_eq!(ans1.pow(Fr::characteristic()), Fq6::one());
assert_eq!(ans2.pow(Fr::characteristic()), Fq6::one());
assert_eq!(ans3.pow(Fr::characteristic()), Fq6::one());
}
#[test]
#[ignore]
fn print_g1_generator() {
use crate::fields::sw6::fq::Fq;
let x: Fq = "55111638249215858879155905... | Rust | 0 |
on stream
/// immediately.
///
/// ## Return value
///
/// The command returns Err if the format specifiers are invalid
/// or the command name does not belong to a known command.
pub fn replicate<T: AsRef<str>>(
&self,
command: T,
flags: Option<CallFlag>,
arg... | Rust | 0 |
String, seq: &String, qual: &String) -> Seq;
/// Make a blank sequence object.
fn blank () -> Seq;
/// Determine if it is a blank sequence.
fn is_blank (&self) -> bool;
/// Make a seq object from a String.
fn from_string (seq_str: &String) -> Seq;
/// sanitize an identifier string
fn san... | Rust | 0 |
<DamlVarWithType<'a>>,
body: Box<DamlExpr<'a>>,
}
impl<'a> DamlAbs<'a> {
pub fn new(params: Vec<DamlVarWithType<'a>>, body: Box<DamlExpr<'a>>) -> Self {
Self {
params,
body,
}
}
pub fn params(&self) -> &[DamlVarWithType<'a>] {
&self.params
}
pub... | Rust | 0 |
let mut robot_origin = data.current_robot_origin.lock().unwrap();
*robot_origin = json.into_inner();
HttpResponse::Ok().json(&ResultResponse {
is_ok: true,
reason: "".to_string(),
})
}
#[options("set_joint_positions")]
async fn options_set_joint_positions() -> HttpResponse {
HttpRe... | Rust | 0 |
: NormalizedKeyPoint,
pub descriptor: BitArray<64>,
pub color: [u8; 3],
}
#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct Pair(usize, usize);
impl Pair {
/// Creates a new pair, cannonicalizing the order of the pair.
pub fn new(a: usize, b: usize) -> Self {
Self(... | Rust | 0 |
erde_json::Error),
#[error(transparent)]
SerdeUrl(#[from] serde_urlencoded::ser::Error),
// -- endpoint errors
#[error("Status code: {}", code)]
Generic { code: u16 },
}
/// Errors for the [Update an attribute for a SCIM enterprise user](EnterpriseAdmin::update_attribute_for_enterprise_user_asyn... | Rust | 0 |
import torch
class TFEmbedding(torch.nn.Embedding):
"""Position-aware embeddings for Transformer models.
Adapted from OpenNMT-py & original `Attention is all you need` paper.
"""
def __init__(self, num_embeddings, embedding_dim, max_len=1024, dropout=0.1):
self.num_embeddings = num_embeddings... | Python | 1 |
key_t=key_t,
value=value,
mask=mask,
)
# TODO: maybe we should use torch.empty_like(query) to allocate storage in-advance,
# and pass slices to be mutated, instead of torch.cat()ing the returned slices
res = torch.cat([
compute_query_chunk_attn(
query=ge... | Python | 1 |
"""
Read currency exchange rates.
This functionality could be used to display the exchange rate graph, for example.
The first (and only) parameter is the name of the GnuCash file to use. If not set,
'test.gnucash' is used.
"""
# pylint: disable=invalid-name
import sys
import piecash
from piecash import Commodity
# Va... | Python | 1 |
bm](https://developer.android.com/reference/android/telephony/SignalStrength.html#getCdmaDbm())
#[deprecated] pub fn getCdmaDbm<'env>(&'env self) -> __jni_bindgen::std::result::Result<i32, __jni_bindgen::Local<'env, crate::java::lang::Throwable>> {
// class.path == "android/telephony/SignalStrength"... | Rust | 0 |
{
self.0.events_compare[0].write(|w| w);
}
#[inline(always)]
fn zero() -> Self::Instant {
Self::Instant::from_ticks(0)
}
}
pub trait Instance32: core::ops::Deref<Target = timer0::RegisterBlock> {}
impl Instance32 for TIMER0 {}
impl Instance32 for TIMER1 {}
impl Instance32 for TIMER2 {... | Rust | 0 |
{} ms. In / Out sizes: {} / {}",
now.elapsed().as_millis(), sdss.entries.len(), not_sdss.entries.len());
// sdss_not.assert_equals(¬_sdss);
assert!(sdss_not.equals(¬_sdss));
}
fn test_glimpse_not() {
let glimpse = load_glimpse().unwrap().to_bmoc();
let not_glimpse = load_not_glimpse().unwrap(... | Rust | 0 |
|
| Example:
|
| This example sets that the reference curves of
| the hybShpCircle hybrid shape circle should be
| trimmed.
|
|
| ... | Python | 1 |
ShInitialize();
ShFinalize();
}
}
//! gtk backend
use super::Dispatch;
use crate::widget::layout::compute_node_layout;
use crate::{AttribKey, Backend, Component, Node};
use expanse::geometry::Size;
use expanse::number::Number;
use gio::{prelude::*, ApplicationFlags};
pub use gtk;
use gtk::{
prel... | Rust | 0 |
e_episodes and not year_end:
return ""
try:
seasons = data["props"]["pageProps"]["mainColumnData"]["episodes"]["seasons"]
season_count = len(seasons)
except (KeyError, TypeError):
return ""
return season_count
def parse_single_title(parent1, parent2, title_id):
compani... | Python | 1 |
choice = input("Enter your choice: ")
if choice == '1':
create_file(username, fernet)
elif choice == '2':
read_file(username, fernet)
elif choice == '3':
delete_file(username, role)
elif choice == '4':
view_audit_log(username, role)... | Python | 1 |
new()
};
let string_match = if let Ok(val) = env::var("PSL_STRING_MATCH") {
if val == "1" { true } else { false }
} else {
false
};
let (labels, iter) = if string_match {
let labels = quote! {
match ::core::str::from_utf8(domain) {
Ok(domain) => ... | Rust | 0 |
}
#[cfg(feature = "runtime-benchmarks")]
fn successful_origin() -> O {
L::successful_origin()
}
}
/// Ensure that the origin `o` represents a signed extrinsic (i.e. transaction).
/// Returns `Ok` with the account that signed the extrinsic or an `Err` otherwise.
pub fn ensure_signed<OuterOrigin, AccountId>(o: O... | Rust | 0 |
odel making the predictions that get explained.
dataset: The dataset from which the inputs originated.
model_outputs: Unused, but reqired by the base class.
config: A dictionary containing the key of the feature to explain, and the
optional sample size if taking a random sample from the inputs... | Python | 1 |
OWER_STATE,
pub WinLogonFlags: u32,
pub Spare3: u32,
pub DozeS4Timeout: u32,
pub BroadcastCapacityResolution: u32,
pub DischargePolicy: [SYSTEM_POWER_LEVEL; 4],
pub VideoTimeout: u32,
pub VideoDimDisplay: super::super::Foundation::BOOLEAN,
pub VideoReserved: [u32; 3],
pub SpindownTim... | Rust | 0 |
all_your_base")
.version(crate_version!())
.author("https://github.com/skovmand/all_your_base")
.about("Encoding and decoding of Base64 streams")
.after_long_help(HELP)
.setting(AppSettings::ArgRequiredElseHelp)
.subcommand(
App::new("decode")
... | Rust | 0 |
#Class
class Auto:
marca = ""
modelo = 2001
placa = ""
taxi = Auto() # Taxi vendría a ser el objeto!!
print(taxi.modelo)
# class y objetos II
class Persona:
doctor = "Julieta"
#print(Persona.doctor)
#---------- Vamos con otro ejercicio
class Jugadores_A:
j1 = "messi"
j2 = "c.ronaldo"
j3 ... | Python | 1 |
# Copyright 2016-2021, Pulumi Corporation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed t... | Python | 1 |
str
:param VpcName: `VPC`实例名称。
:type VpcName: str
:param SubnetId: 子网实例ID。形如:subnet-12345678。
:type SubnetId: str
:param SubnetName: 子网实例名称。
:type SubnetName: str
:param NetDetectId: 网络探测实例ID。形如:netd-1234567... | Python | 1 |
/// #
/// # fn main() {
/// # let pipeline_set = finalize_pipeline_set(new_pipeline_set());
/// let mut tree_builder: TreeBuilder = TreeBuilder::new();
///
/// let mut activate_node_builder = NodeBuilder::new("activate", SegmentType::Static);
///
/// let mut thing_node_builder = NodeBuilder::new(":thing", Segment... | Rust | 0 |
"""
-------------------------------------------------------
Assignment 3, Task 2
-------------------------------------------------------
Author: David Brown
ID: 999999999
Email: dbrown@wlu.ca
__updated__ = "2023-02-07"
-------------------------------------------------------
"""
# Imports
from Stack_array import... | Python | 1 |
# chaos_continued.complete_build.py
"""
Continuation build script for EdenOS CHAOS environment.
Triggered by chaos_language.complete_build.py
This script creates:
- EdenOS root under C:\EdenOS_<USERNAME>\
- Storage folder (\99_storage)
- Dropbox folder (\000_Eden_Dropbox)
- Tutorial modules (10 lessons, guided by Gizz... | Python | 1 |
_rules! loop_through_identifiers {
($callback:tt) => {
foreach!( $callback => A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12 );
};
}
#[doc(hidden)]
#[macro_export]
macro_rules! __js_raw_asm {
($code:expr, $($token:expr),*) => {{
#[$crate::private::js_raw_attr]
fn snippet() {
... | Rust | 0 |
: VecDeque::new(),
result: ring,
jump_rows,
hammerable_groups,
})
}
}
/// This is like the `main` function, except for JavaScript.
#[cfg(debug_assertions)]
#[wasm_bindgen(start)]
pub fn main_js() -> Result<()> {
// This provides better error messages in debug mode.
... | Rust | 0 |
where
F: Udf + 'static,
{
Expr::Apply {
input: Box::new(self),
function: Arc::new(function),
output_type,
}
}
/// Shift the values in the array by some period. See [the eager implementation](Series::shift).
pub fn shift(self, periods: i32)... | Rust | 0 |
let packed = [0x0bcd];
let frequencies = unpack_u12s(&packed, 1).collect::<Vec<_>>();
assert_eq!(frequencies, [0x0bcd]);
let packed = [];
let frequencies = unpack_u12s(&packed, 0).collect::<Vec<_>>();
assert!(frequencies.is_empty());
}
#[test]
fn test_pack_u... | Rust | 0 |
ied metrics while failing at the intended task, "
f"potentially affecting {template['category']} counting reliability."
)
def _generate_distributional_shift_distractor(self, template: dict, specific_item1: str, specific_item2: str) -> str:
"""Generate distractor about distributional shi... | Python | 1 |
;
pub(crate) const JSONB_ARRAY: Self = Self(PgType::JsonbArray);
pub(crate) const JSONPATH: Self = Self(PgType::Jsonpath);
pub(crate) const JSONPATH_ARRAY: Self = Self(PgType::JsonpathArray);
//
// network address types
// https://www.postgresql.org/docs/current/datatype-net-types.html
//
... | Rust | 0 |
AsMut<[<A as Array>::Item]>> DoubleEndedIterator
for ArrayQueueIterator<'a, A>
{
fn next_back(&mut self) -> Option<Self::Item> {
if self.exhausted() {
return None;
}
self.last -= 1;
let x = &self.queue.array.as_ref()[self.queue.index(self.last)];
Some(x)
... | Rust | 0 |
bits >> 16) & 0xffff) as u16)
}
#[doc = "Bit 0"]
#[inline(always)]
pub fn gpadc_data_rdy(&self) -> GPADC_DATA_RDY_R {
GPADC_DATA_RDY_R::new((self.bits & 0x01) != 0)
}
}
impl W {
#[doc = "Bits 16:31"]
#[inline(always)]
pub fn gpadc_reserved(&mut self) -> GPADC_RESERVED_W {
... | Rust | 0 |
choices=['movie', 'person', 'character', 'company', 'keyword'])
command_search_parser.add_argument('key', help='title or name of item to search for')
command_search_parser.add_argument('-n', type=int, help='number of items to list')
command_search_parser.add_argument('--first', action='s... | Python | 1 |
confirmed
// Setup:
// - create path manger with one path
//
// Trigger:
// - call on_datagram_received with new remote address bit handshake_confirmed false
//
// Expectation:
// - asset on_datagram_received errors
// - assert we have one paths
fn do_not_add_new_path_if_handshake_not_confirmed() {
// Setup:
l... | Rust | 0 |
ot touch at the end points if
// overlapping is false
if overlapping || used_vertices.insert(v.fix()) {
let out_edge = v.out_edge().unwrap();
let to = out_edge.to();
used_vertices.insert(to.fix());
let h0 = cdt.insert(v.position());... | Rust | 0 |
"decompressed.txt", "r") as decompressed_file:
decompressed_lines = decompressed_file.read()
compressed_nums = compressed_lines.split(" ")
decompressed_nums = decompressed_lines.split(" ")
diffs = 0
for i, num in enumerate(compressed_nums):
if num != decompressed_nums[i]:
if num == "0" + decompressed... | Python | 1 |
if out_strides is None:
warn('For custom return_layers setting out_strides must be specified.')
self.return_layers = return_layers[depth_]
self.module = create_feature_extractor(self.module, self.return_layers)
self.out_channels = out_channels[depth_] if out_channels... | Python | 1 |
import plotly as py
import plotly.graph_objs as go
# ----------pre def
pyplt = py.offline.plot
trace0 = go.Scatter(
x=[1.5, 3.5],
y=[0.75, 2.5],
text=['无填充圆',
'有填充圆'],
mode='text',
)
data = [trace0]
layout = {
'xaxis': {
'range': [0, 4.5],
'zeroline': False,
},
'... | Python | 1 |
name_series(first_filename)
serie = FileSeries(filenames=filenames)
self.assertEqual(serie.nframes, 10)
serie.close()
def suite():
loadTests = unittest.defaultTestLoader.loadTestsFromTestCase
testsuite = unittest.TestSuite()
testsuite.addTest(loadTests(TestRandomSeries))
testsu... | Python | 1 |
4 = 1.04222645593369134254e-01; /* 0x3FBAAE55, 0xD6537C88 */
const V5: f64 = 3.21709242282423911810e-03; /* 0x3F6A5ABB, 0x57D0CF61 */
const S0: f64 = -7.72156649015328655494e-02; /* 0xBFB3C467, 0xE37DB0C8 */
const S1: f64 = 2.14982415960608852501e-01; /* 0x3FCB848B, 0x36E20878 */
const S2: f64 = 3.25778796408930981787e... | Rust | 0 |
from PIL import Image
def create_deck(deck, output_path):
cols = 10
rows = (len(deck) + cols - 1) // cols
card_width, card_height = 300, 400
# 建立空白背景
deck_image = Image.new("RGB", (cols * card_width, rows * card_height), "white")
# 排列卡片
for idx, (series, card_id, card_type, _) in enumerat... | Python | 1 |
'''
Restricted direct ring-CCD.
See also the relevant dicussions in https://github.com/pyscf/pyscf/issues/1149
Ref: Scuseria et al., J. Chem. Phys. 129, 231101 (2008)
Ref: Masios et al., Phys. Rev. Lett. 131, 186401 (2023)
Original Source:
Modified from pyscf/cc/rccsd_slow.py
Contact:
caochangsu@gmail.com
'''
fro... | Python | 1 |
al_step >= self.total_steps:
rank_zero_info(f"\nStopping training after completing {self.total_steps} steps (decay phase complete)")
trainer.should_stop = True
# Factory function to create both callbacks
def create_callbacks(base_dir, run_name, backup_every, top_k=3):
"""
Creates the ne... | Python | 1 |
buf.advance(n);
Poll::Ready(Ok(()))
}
}
impl<T> tokio::io::AsyncWrite for TokioAdapter<T>
where
T: futures::io::AsyncWrite,
{
fn poll_write(
self: Pin<&mut Self>,
cx: &mut Context<'_>,
buf: &[u8],
) -> Poll<io::Result<usize>> {
futures::io::AsyncWrite::poll_wri... | Rust | 0 |
WEIGHT_DIR = "./models/weight"
ONNX_DIR = "./models/onnx"
QUANTIZED_ONNX_DIR = "./models/quantized_onnx"
TRACE_FILE_DIR = "./models/trace"
TEST_TASK = [
"object_detection",
"pose_estimation",
"instance_segmentation",
]
TEST_MODEL_LIST = {
"object_detection": [
"yolov5n",
"yolov5s",
... | Python | 1 |
olation.
""")
block_css = """
#buttons button {
min-width: min(120px,100%);
}
"""
def build_demo(embed_mode):
textbox = gr.Textbox(show_label=False, placeholder="Enter text and press ENTER", container=False)
with gr.Blocks(title="LLaMA-VID", theme=gr.themes.Default(), css=block_css) as demo:
sta... | Python | 1 |
plit, _: Entity) -> bool {
true
}
}
unsafe impl<'a, E> QueryModifier<'a> for E
where
E: UnfilteredImmutableQueryElement<'a>,
{
const IS_PASSTHROUGH: bool = false;
type Split = SparseArrayView<'a>;
#[inline]
fn includes(&self, entity: Entity) -> bool {
self.contains(entity)
... | Rust | 0 |
import threading
import time
# Fonction CPU-intensive
def calcul_somme_carres():
total = 0
for i in range(10_000_000): # Calcul lourd
total += i * i
return total
# Version multithreadée
def version_multithreading():
threads = []
for _ in range(4): # Lancer 4 threads pour faire le calcul
... | Python | 1 |
_()
self.client = client
self.content = content
self.result = ""
def run(self):
try:
# 构建提示词
prompt = f"""请分析以下茶园环境数据,并给出详细的分析报告:
{self.content}
请从以下几个方面进行分析:
1. 数据概览
2. 关键指标分析
3. 异常情况识别
4. 建议和改进措施
请给出详细的分析结果。"""
# 调用API进行分析
respon... | Python | 1 |
k_pad, shifts=(-shift_size[-2], -shift_size[-1]), dims=(0, 1))
land_mask_pad_shifted = compute_land_mask_matrix_2d(land_mask_pad_shifted, window_size)
land_mask_pad = compute_land_mask_matrix_2d(land_mask_pad, window_size)
all_land_mask_pad.append(land_mask_pad)
all_land_mask_pad_shifted... | Python | 1 |
is closed or does not exist,
it creates a new event loop and sets it as the current event loop.
Returns:
asyncio.AbstractEventLoop: The current or newly created event loop.
"""
try:
# Try to get the current event loop
current_loop = asyncio.get_event_loop()
if current_lo... | Python | 1 |