text string | label_name string | labels int64 |
|---|---|---|
=self.stop_deploy_camera,
expand=True, height=50)
self.deploy_settings_upload_button = ft.ElevatedButton("Upload image for predict", icon=ft.icons.UPLOAD,
on_click=lambda _: self.image_pic... | Python | 1 |
USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/5.2/howto/static-files/
STATIC_URL = 'static/'
# Default primary key field type
# https://docs.djangoproject.com/en/5.2/ref/settings/#default-auto-field
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
REST_FRAMEWORK = ... | Python | 1 |
AL_OF_READONLY
}
}
}
// Open parameters
#[derive(Debug, Default)]
pub struct DatasetOptions<'a> {
pub open_flags: GdalOpenFlags,
pub allowed_drivers: Option<&'a [&'a str]>,
pub open_options: Option<&'a [&'a str]>,
pub sibling_files: Option<&'a [&'a str]>,
}
/// Parameters for [`Dataset::cr... | Rust | 0 |
Cap::Flat => piston_graphics::Line::new(color, thickness / 2.0),
Cap::Round => piston_graphics::Line::new_round(color, thickness / 2.0),
};
let mut start = first;
for end in points {
let coords = [start[0], start[1],... | Rust | 0 |
to load sound: {:?}", location);
}
}
pub fn play(&mut self, name: String) {
if self.music.contains_key(&name) {
self.music.get_mut(&name).unwrap().play();
} else {
println!("Error: Sound {:?} not loaded", name);
}
}
pub fn pause(&mut self, name: String) {
if self.music.con... | Rust | 0 |
ingify!(_xmlNode),
// "::",
// stringify!(content)
// )
// );
// assert_eq!(
// unsafe { &(*(::std::ptr::null::<_xmlNode>())).properties as *const _ as usize },
// 88usize,
// concat!(
// "Offset of field: ",
// stringify!(_xmlNode),
// "::",
// stringify!(propert... | Rust | 0 |
expected_output = {
"interface":{
"if_id":"2a",
"clock_mode":"BOUNDARY CLOCK",
"delay_mechanism":"End-to-End",
"delay_req_seq_num":0,
"domain_value":0,
"log_mean_delay_interval":0,
"log_mean_sync_interval":0,
"num_info":{
"num_delay_requests_received":0,
"num_d... | Python | 1 |
drive collisions
agents_array = [agent for _, agent in self.agents.items()]
for i, _ in enumerate(agents_array):
for j in range(i + 1, len(agents_array)):
d1 = agents_array[i]
d2 = agents_array[j]
pos1 = np.array(d1.center)
pos2... | Python | 1 |
8);
diff!(u16);
diff!(u32);
diff!(u64);
diff!(u8);
diff!(uuid::Uuid);
#[cfg(feature = "dec19x5")]
diff!(dec19x5::Decimal);
<filename>crates/file_storage_types/src/error.rs<gh_stars>1-10
use hdk::prelude::{SerializedBytesError, WasmError};
use thiserror::Error;
#[derive(Error, Debug)]
pub enum FileStorageError {
#... | Rust | 0 |
results = []
for p in percentiles:
threshold = self.calibrate_threshold(prompts, max_new_tokens, percentile=p)
stats = self.evaluate(threshold, prompts, max_new_tokens)
results.append(stats)
print(f" - P{p:2}: acc={stats['accuracy']:.2%}, routed={stats['rout... | Python | 1 |
diffusion rate.
#[inline]
fn diffuse(
input: &Input,
voxel_size_sq: &Vec3,
dt: f64,
mut values: Array4<f64>,
rates: Mutex<Array4<f64>>,
) -> Result<(Array4<f64>, Mutex<Array4<f64>>), Error> {
debug_assert!(dt > 0.0);
// Calculate diffusion rates.
let spb = Arc::new(Mutex::new(ProgressB... | Rust | 0 |
LT_TABLELOG, test_data.len(), max_symbol_value);
let norm_counts = get_normalized_counts(&counts, table_log, test_data.len(), max_symbol_value);
for _ in 0..10 {
// dbg!(&out.get_compressed_data());
// dbg!("out.get_compressed_data().len() {:?}", out.get_compressed_data().len());
let dec... | Rust | 0 |
n_layers=5, n_runs=10, no_attn_dst=True, plot_curves=False, save='log/kd-L5-DP0.75-H256-20210620-044728-d9034b17-88b2-45fb-bfd2-bdc7d6de3313', save_pred=False, seed=0, temp=1.0, use_labels=True, use_norm=True, wd=0)
# Runned 10 times
# Val Accs:
# [0.7505620993993087, 0.7485150508406322, 0.7487835162253766, 0.74989... | Python | 1 |
!(signature_bytes, &empty_signature);
signature_bytes[..].copy_from_slice(&signature.to_bytes());
module
};
Ok(module)
}
<filename>ext/crates/query/src/lib.rs
//! This library gives various functions that are used to query a user. Each function performs the
//! following:
//!
//! - Read the ne... | Rust | 0 |
position: PositionType::Absolute;
left: 420.;
top: 300.;
width: 120.;
height: 120.;
set_loader(resource.image(head));
};
Empty {
position: PositionType::Absolute;
left:... | Rust | 0 |
error!(target: TAG, "Failed to monitor adb devices: {}", err);
Self::repair_adb_daemon();
}
}
}
fn track_devices(&mut self) -> io::Result<()> {
let adbd_addr = SocketAddr::from(([127, 0, 0, 1], 5037));
let mut stream = TcpStream::connect(adbd_addr)?;
... | Rust | 0 |
Mop,
/// Peso Uruguayo
#[serde(rename = "UYU")]
Uyu,
/// Philippine Peso
#[serde(rename = "PHP")]
Php,
/// Portuguese Escudo
#[serde(rename = "PTE")]
Pte,
/// Pound Sterling
#[serde(rename = "GBP")]
Gbp,
/// Pula
#[serde(rename = "BWP")]
Bwp,
/// Qatari Rial
#[serde(rename = "QAR")]
Qar,
/// Quetza... | Rust | 0 |
r.
# (Can return `NotImplemented`.)
handler = event.app.renderer.mouse_handlers.mouse_handlers[y][x]
return handler(
MouseEvent(
position=Point(x=x, y=y),
event_type=event_type,
b... | Python | 1 |
ipeline)
pairs = pipeline.shortlist_generator(scene)
print(f"# of pairs: {len(pairs)}")
storage1 = InMemoryMatchedKeypointStorage()
matcher = pipeline.matcher
run_detector_free_matching(
matcher, pairs, scene, matched_keypoint_storage=storage1
)
path... | Python | 1 |
from fvcore.common.param_scheduler import MultiStepParamScheduler
from detectron2.config import LazyCall as L
from detectron2.solver import WarmupParamScheduler
def default_X_scheduler(num_X):
"""
Returns the config for a default multi-step LR scheduler such as "1x", "3x",
commonly referred to in papers,... | Python | 1 |
wrong.append((i['guid'], slot, i['slot_groundtruth_'+slot], i['slot_prediction_'+slot]))
break
no_cross += right
if i['guid'][2] == last[i['guid'][1]]:
cur = []
for slot in slot_list:
if i['slot_prediction_'+sl... | Python | 1 |
date_l7rule_flow():
return L7_RULES_FLOWS.get_update_l7rule_flow()
def get_create_listener_flow(flavor_dict=None):
return LISTENER_FLOWS.get_create_listener_flow(flavor_dict=flavor_dict)
def get_create_all_listeners_flow(flavor_dict=None):
return LISTENER_FLOWS.get_create_all_listeners_flow(
fla... | Python | 1 |
rx.recv().unwrap();
// Futures can still be run
tx.spawn(lazy(move || {
complete_tx.send(()).unwrap();
Ok(())
})).unwrap();
complete_rx.recv().unwrap();
pool.shutdown().wait().unwrap();
}
#[test]
fn many_oneshot_futures() {
const NUM: usize = 10_000;
let _ = ::env_logger... | Rust | 0 |
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
];
unsafe {
entry2(BUFFER_SIZE as u32, buffer.as_mut_ptr());
rust_entry2(BUFFER_SIZE as u32, rust_buffer.as_mut_ptr());
}
for index in 0..BUFFER_SIZE {
assert_eq!(buffer[index], rust_buffer[index]);
assert_eq!(buffer[index], expect... | Rust | 0 |
r.
# **`replace()`** – String içinde belirtilen değeri başka bir değerle değiştirir.
# **`rfind()`** – String içinde belirtilen değerin son geçtiği konumu döndürür.
# **`rindex()`** – String içinde belirtilen değerin son geçtiği konumu döndürür.
# **`rjust()`** – String’in sağa yaslanmış bir versiyonunu döndürü... | Python | 1 |
# -*- coding: utf-8 -*- #
# Copyright 2015 Google LLC. All Rights Reserved.
#
# 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 requir... | Python | 1 |
);
render_pass.set_pipeline(&pipeline.render_pipeline);
render_pass.set_bind_group(0, &bind_group, &[]);
render_pass.draw(0..6, 0..6);
}
roughness += roughness_delta;
}
for mip_id in 0..mip_levels {
let res = (self.spe... | Rust | 0 |
such states: unknown, dead and quit states.
///
/// Unknown states are states that haven't been computed yet. They indicate
/// that a transition should be filled in that points to either an existing
/// cached state or a new state altogether. In general, an unknown state means
/// "follow the NFA's epsilon transition... | Rust | 0 |
es locally gravityfree conditions, akin to floating in deep space. Conversely, an accelerating observer in space perceives forces indistinguishable from gravity. This equivalence underpins the geometric interpretation of gravity as spacetime curvature."
revised_mnemonic_topic_10 = revise_prompt_with_control_flow... | Python | 1 |
import matplotlib.pyplot as plt
import torch
from torch_uncertainty.metrics import AUSE
class TestAUSE:
"""Testing the AUSE metric class."""
def test_compute_zero(self) -> None:
values = torch.as_tensor([0.1, 0.2, 0.3, 0.4, 0.5])
metric = AUSE()
metric.update(values, values)
... | Python | 1 |
"""
Dagster job for CoinGecko price data collection.
"""
from dagster import job, op, ScheduleDefinition
from op_analytics.coreutils.path import repo_path
from op_analytics.datasources.coingecko.execute import execute_pull
@op
def collect_coingecko_prices():
"""
Collect daily price data from CoinGecko.
... | Python | 1 |
draw_to_window(&window2, &context2, (0.0, 0.0, 1.0, 1.0));
draw_to_window(&window3, &context3, (1.0, 0.0, 0.0, 1.0));
});
}
extern crate http;
extern crate iron;
extern crate "iron-test" as iron_test;
extern crate "static_file" as static_file;
use http::method::Get;
use iron::{Error, Url, Handler};
... | Rust | 0 |
#[proc_macro_hack(fake_call_site)]
pub use const_random_macro::const_random;
#[proc_macro_hack(fake_call_site)]
pub use const_random_macro::const_random_unique;
<filename>src/connectivity/wlan/wlancfg/src/client/mod.rs
// Copyright 2019 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed b... | Rust | 0 |
"""ksjefilfsilfe"""
def main():
"""ekafesjf"""
sec_mutiverse = int(input())
sec_to_min = int(input())
min_to_hour = int(input())
hour_to_day = int(input())
sec_mutiverse %= sec_to_min * min_to_hour * hour_to_day
hour = sec_mutiverse // (sec_to_min * min_to_hour)
sec_mutiverse %= sec_to... | Python | 1 |
()
}
// initialise a single validator and state. All blocks will reference this state root.
fn setup_inital_state(
fork_choice_algo: &ForkChoiceAlgorithm,
num_validators: usize,
) -> (Box<ForkChoice>, Arc<BeaconBlockStore<MemoryDB>>, Hash256) {
let db = Arc::new(MemoryDB::open());
let block_store = Arc... | Rust | 0 |
if the value of the field is `_0000`"]
#[inline]
pub fn is_0000(&self) -> bool {
*self == CLKOUTSELR::_0000
}
#[doc = "Checks if the value of the field is `_0010`"]
#[inline]
pub fn is_0010(&self) -> bool {
*self == CLKOUTSELR::_0010
}
#[doc = "Checks if the value of the... | Rust | 0 |
rite`](crate::generic::Reg::write), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [ledc_int_sts](index.html) module"]
pub struct LEDC_INT_STS_SPEC;
impl crate::RegisterSpec for LEDC_INT_STS_SPEC {
type Ux = u32;
}... | Rust | 0 |
config_for_ctx(ctx), Some(request)).await?;
Ok(response)
}
}
<reponame>BenStigsen/RustTwitchChatbot
pub const PREFIX: char = '!';
pub const MAX_RESPONSE_QUEUE: usize = 10;
pub const DELAY_BETWEEN_REQUESTS: u64 = 2000; // Milliseconds
<reponame>electricjones/kaylee
// #[macro_use]
extern crate nom;
pub mo... | Rust | 0 |
// }
// stroke(c);
// point(Point3::new(
// 4.0 * (x as f32 - 0.5 * (WIDTH / 4) as f32),
// 4.0 * (y as f32 - 0.5 * (HEIGHT / 4) as f32),
// 0.0,
// ));
// }
// }
// 2D + time with perlin and thresholding
//... | Rust | 0 |
ation.
#[derive(Clone, Debug, PartialEq)]
pub struct ListStyle {
pub id: String,
pub bg_color: String,
pub max_snippet_lines: u32,
pub list_item_type: ListItemType,
}
impl Default for ListStyle {
fn default() -> ListStyle {
ListStyle {
id: "".to_string(),
bg_color: "... | Rust | 0 |
yper);
let dc = gpiob
.pb1
.into_push_pull_output(&mut gpiob.moder, &mut gpiob.otyper);
let sck = gpioa.pa5.into_af5(&mut gpioa.moder, &mut gpioa.afrl);
let miso = gpioa.pa6.into_af5(&mut gpioa.moder, &mut gpioa.afrl);
let mosi = gpioa.pa7.into_af5(&mut gpioa.moder, &mut gpioa.afrl);
... | Rust | 0 |
or area, count in weak_areas[:3]:
content += f" • {area.replace('_', ' ').title()}: No projects yet\n"
content += "\n"
# Recommendations
content += "🎯 RECOMMENDATIONS:\n"
content += " • Focus on your strongest technology areas\n"
content += " • Build on s... | Python | 1 |
import _plotly_utils.basevalidators
class ShapeValidator(_plotly_utils.basevalidators.EnumeratedValidator):
def __init__(self, plotly_name="shape", parent_name="indicator.gauge", **kwargs):
super(ShapeValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
... | Python | 1 |
let p2: B2vec2 = b_b.m_sweep.c + r_b;
let d: B2vec2 = p2 - p1;
let axis: B2vec2 = b2_mul_rot_by_vec2(b_a.m_xf.q, this.m_local_xaxis_a);
let v_a: B2vec2 = b_a.m_linear_velocity;
let v_b: B2vec2 = b_b.m_linear_velocity;
let w_a: f32 = b_a.m_angular_velocity;
let w_b: f32 = b_b.m_angular_velocity;
let speed: f32 ... | Rust | 0 |
# 1. Recursive (Brute Force)
def frog_jump_recursive(i, heights):
if i == 0:
return 0
jumpOne = frog_jump_recursive(i - 1, heights) + abs(heights[i] - heights[i-1])
if(i>1):
jumpTwo = frog_jump_recursive(i - 2, heights) + abs(heights[i] - heights[i - 2])
return min(jumpOne, jumpTwo)... | Python | 1 |
import uuid
from datetime import datetime
from typing import Optional
from sqlmodel import Column, DateTime, Field, SQLModel, func
class Base_Entity(SQLModel):
id: Optional[uuid.UUID] = Field(primary_key=True)
created_at: datetime = Field(sa_type=DateTime(timezone=True), default=func.now())
updated_at: dat... | Python | 1 |
]
}
#[inline(always)]
pub fn add_array1x1_array1x1<S>(arr1: &[[S; 1]; 1], arr2: &[[S; 1]; 1], c: usize, r: usize) -> S
where
S: Copy + ops::Add<S, Output = S>
{
arr1[c][r] + arr2[c][r]
}
#[inline(always)]
pub fn sub_array1x1_array1x1<S>(arr1: &[[S; 1]; 1], arr2: &[[S; 1]; 1], c: usize, r: usize) -> S
where
... | Rust | 0 |
#
# Copyright (c) 2023 Airbyte, Inc., all rights reserved.
#
from .source import SourceOutbrainAmplify
__all__ = ["SourceOutbrainAmplify"]
| Python | 1 |
""" lec_pd_numpy.py
Companion codes for the lecture on Numpy
"""
import numpy as np
import pandas as pd
# ----------------------------------------------------------------------------
# The dates and prices lists
# ----------------------------------------------------------------------------
dates = [
'2020-01-02... | Python | 1 |
from flask import Flask, jsonify
app = Flask(__name__)
@app.route('/')
def home():
return jsonify({"message": "Backend is running successfully!"})
@app.route('/health')
def health():
return jsonify({"status": "healthy"}), 200
if __name__ == '__main__':
app.run(host='0.0.0.0', port=8000)
| Python | 1 |
(16 bits)"]
#[inline(always)]
pub fn epi_rsize0_size_16bit(self) -> &'a mut W {
self.variant(EPI_RSIZE0_SIZEW::EPI_RSIZE0_SIZE_16BIT)
}
#[doc = "Word (32 bits)"]
#[inline(always)]
pub fn epi_rsize0_size_32bit(self) -> &'a mut W {
self.variant(EPI_RSIZE0_SIZEW::EPI_RSIZE0_SIZE_32... | Rust | 0 |
txt_header() -> Header {
Header {
artist: String::from("Testartist"),
title: String::from("Testsong"),
bpm: 123.0,
audio_path: Source::parse("Testfile.mp3"),
gap: Some(666.0),
relative: Some(false),
video_path: Some(Source::parse("DLzxrzFCyOs.mp4")),
c... | Rust | 0 |
import numpy as np
import matplotlib.pyplot as plt
from tensorflow.keras.datasets import cifar10
from tensorflow.keras.utils import to_categorical
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Conv2D, MaxPooling2D, Flatten, Dense, Dropout
# Load the dataset
(X_train, y_train), (X_t... | Python | 1 |
oord_file0
elif "protein crdfile0" in params:
coord_file0 = params["crdfile0"]
else:
coord_file0 = "complex0.crd"
params["crdfile0"] = coord_file0
if args.coordinate_file1:
coord_file1 = args.coordinate_file1
params["crdfile1"] = coord_file1
elif "protein crdfile1" in params:
coord_file1 = para... | Python | 1 |
}
}
// keylen < blocklen, with truncated tag
#[test]
#[ignore] // not implemented yet
fn test_hmac_sha512_truncated() {
let message = "Sample message for keylen<blocklen, with truncated tag";
let key: &[u32] = &[
0x00, 0x01020304, 0x05060708, 0x090A0B0C, 0x0D0E... | Rust | 0 |
&mut [u32], count: usize) {
for i in 0..count {
dest[i] = self.gradient.eval(x as u16, y as u16, self.spread);
x += 1;
}
}
}
pub struct LinearGradientShader {
gradient: Box<GradientSource>,
spread: Spread,
}
impl LinearGradientShader {
pub fn new(gradient: &Gra... | Rust | 0 |
h_vnet(&v, a0test_config, a1test_config).await?;
tokio::time::sleep(Duration::from_secs(1)).await;
log::debug!("Closing...");
v.close().await?;
Ok(())
}
async fn block_until_state_seen(
expected_state: ConnectionState,
state_queue: &mut mpsc::Receiver<ConnectionState>,
) {
while let Some... | Rust | 0 |
from PyQt6 import QtGui, QtWidgets
from core.files import path
def font_set(app: QtWidgets.QApplication, font: str, font_size: int):
"""
Sets the font for the application.
"""
font_family = font_load(font)
if not font_family:
raise Exception(f"Font was not found: \"{font}\"")
... | Python | 1 |
P nn; CALL NZ,nn; PUSH BC; ADD A,n; RST 0x00;
/* C8 */ RET Z; RET; JP Z,nn; CB; CALL Z,nn; CALL nn; ADC A,n; RST 0x08;
/* D0 */ RET NC; POP DE; JP NC,nn; UNK; CALL NC,nn; PUSH DE; SUB n; RST 0x10;
/* D8 */ RET C; RETI; JP C,nn; ... | Rust | 0 |
88;
pub const EM_MN10300: u16 = 89;
pub const EM_MN10200: u16 = 90;
pub const EM_PJ: u16 = 91;
pub const EM_OPENRISC: u16 = 92;
pub const EM_ARC_A5: u16 = 93;
pub const EM_XTENSA: u16 = 94;
pub const EM_AARCH64: u16 = 183;
pub const EM_TILEPRO: u16 = 188;
pub const EM_MICROBLAZE: u16 = 189;
pub const EM_TILEGX: u16 = 1... | Rust | 0 |
_eq!(u8::from(January), 1);
assert_eq!(u8::from(February), 2);
assert_eq!(u8::from(March), 3);
assert_eq!(u8::from(April), 4);
assert_eq!(u8::from(May), 5);
assert_eq!(u8::from(June), 6);
assert_eq!(u8::from(July), 7);
assert_eq!(u8::from(August), 8);
assert_eq!(u8::from(September), 9);
... | Rust | 0 |
", feature = "llvm10-0", feature = "llvm11-0", feature = "llvm12-0"))]
assert!(function.verify(false));
let basic_block = context.append_basic_block(function, "entry");
builder.position_at_end(basic_block);
builder.build_return(None);
assert!(function.verify(false));
// TODO: Verify other ve... | Rust | 0 |
C>) -> Self {
let size = to_merge.iter().map(|c| c.remains()).fold(0, |acc, x| acc + x);
let heap = create_heap(to_merge);
Merge{
current_ptr: None,
frontier: heap,
size: size,
}
}
}
impl<C: PostingsCursor> PostingsCursor for Merge<C> {
type D... | Rust | 0 |
d) -> Result<(), APIError> {
let monitors = self.monitors.read().unwrap();
let monitor_data = if let Some(mon) = monitors.get(&funding_txo) { mon } else {
return Err(APIError::APIMisuseError { err: format!("No ChannelMonitor matching funding outpoint {:?} found", funding_txo) });
};
let mut pending_monitor_u... | Rust | 0 |
import pytest
import rpy2.rinterface as ri
ri.initr()
def test_init_from_seqr():
seq = ['foo', 'bar', 'baz']
v = ri.StrSexpVector(seq)
assert len(v) == 3
for x, y in zip(seq, v):
assert x == y
def test_init_from_seq_invalid_item():
seq = ['foo', 0, 'baz']
with pytest.raises(Exceptio... | Python | 1 |
codigo, quantidade = input("Insira o código do produto e a sua quantia: ").split(",")
if codigo == "100":
produto = "Hot Dog"
preco = 12.00
elif codigo == "102":
produto = "X-Salada"
preco = 18.50
elif codigo == "103":
produto = "X-BACON"
preco = 25.50
elif codigo == "104":
produto = "X-Burguer"
pre... | Python | 1 |
coding = ContentCoding::BROTLI;
/// assert_eq!(coding.to_static(), "br");
/// ```
#[inline]
pub fn to_static(&self) -> &'static str {
match *self {
$(ContentCoding::$coding => $str,)+
}
}
/// Gi... | Rust | 0 |
import pytest
from keras_contrib.losses import jaccard_distance
from keras_contrib.utils.test_utils import is_tf_keras
from keras import backend as K
import numpy as np
@pytest.mark.xfail(is_tf_keras,
reason='TODO fix this.',
strict=True)
def test_jaccard_distance():
# all_r... | Python | 1 |
"dihedral", Dihedral(val=val, mesh_shape=mesh_shape, symmetry=symmetry), promotes_inputs=promotes
)
# 8. Shear Z
val = np.zeros(ny)
if "zshear_cp" in surface:
promotes = ["zshear"]
else:
promotes = []
self.add_subsystem("shear_z", ShearZ... | Python | 1 |
{} channels", ids.len());
let unreads = ids
.into_iter()
.map(|id| {
let response = self
.client
.get("https://slack.com/api/conversations.info")
.query(&[("token", token), ("channel", &id)])
... | Rust | 0 |
"""
RLHF package for implementing Reinforcement Learning from Human Feedback.
"""
from rlhf.feedback_collector import FeedbackCollector
from rlhf.reward_model import RewardModel
from rlhf.fine_tuning import FineTuning
__all__ = ['FeedbackCollector', 'RewardModel', 'FineTuning'] | Python | 1 |
ub(crate) use rsa::RSAPrivateKey;
pub(crate) use serde::de::DeserializeOwned;
pub(crate) use serde::{Deserialize, Serialize};
pub(crate) use serde_json::{from_str as from_json_str, to_string as to_json_string};
pub(crate) use strum::IntoEnumIterator;
pub(crate) use strum_macros::{AsRefStr, EnumIter, IntoStaticStr, ToSt... | Rust | 0 |
loop {
let dent = match self.walker.next() {
None => return None,
Some(result) => match result {
Ok(v) => v,
Err(err) => return Some(Err(err.to_string())),
},
};
//Skip the .gud directory... | Rust | 0 |
n(user_mentions)}")
else:
response_parts.append(f"{date_str}: *No participants*")
return "\n".join(response_parts)
@staticmethod
def validate_date_range(start_date: datetime, end_date: datetime) -> None:
"""
Validate that the date range is reason... | Python | 1 |
te_with_zero`](crate::generic::Reg::write_with_zero), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about avaliable fields see [gptalarm0](gptalarm0) module"]
pub type GPTALARM0 = crate::Reg<u32, _GPTALARM0>;
#[allow(missing_docs)]
#[doc(hidden... | Rust | 0 |
class LocalSubclass(self._local):
"""To test that subclasses behave properly."""
self._test_one_class(LocalSubclass)
def _test_dict_attribute(self, cls):
obj = cls()
obj.x = 5
self.assertEqual(obj.__dict__, {'x': 5})
with self.assertRaises(AttributeError):
... | Python | 1 |
import numpy as np
import pandas as pd
from gtime.feature_extraction import Detrender
def test_polynomial_detrend():
time_index = pd.date_range(start="2020-01-01", end="2020-01-20")
ts = pd.DataFrame(range(0, 20), index=time_index)
detrend_feature = Detrender(trend="polynomial", trend_x0=np.zeros(3))
... | Python | 1 |
UXPER6R {
#[doc = r" Value of the field as raw bits"]
#[inline]
pub fn bits(&self) -> u8 {
match *self {
DMAMUXPER6R::TIMER2_MATCH_1 => 0,
DMAMUXPER6R::USART2_RECEIVE => 1,
DMAMUXPER6R::SSP1_RECEIVE => 2,
DMAMUXPER6R::SGPIO14 => 3,
}
}
... | Rust | 0 |
import numpy as np
from auxiliary_functions import joints_to_cartesian, joints_to_rot
class Evaluator:
def __init__(self, acc_func, torque_func, desired_joints, max_torques):
acc_functions = {"euclidean": a_euclidean_distance}
torque_functions = {
"squared_derivative": t_mean_squared_d... | Python | 1 |
'EXAMPLES':
"""\
The following command creates a Filestore instance named NAME with a single volume.
$ {command} NAME \
--description=DESCRIPTION --tier=TIER \
--file-share=name=VOLUME_NAME,capacity=CAPACITY \
--network=name=NETWORK_NAME,reserved-ip-range=RESERVED_IP_RANGE,connect... | Python | 1 |
// Keep this in sync with `GFp_BN_free()`.
// In particular, this doesn't work for `BN_FLG_STATIC_DATA`.
assert_eq!(self.flags, 0);
unsafe {
let d: *mut limb::Limb = self.d;
libc::free(d as *mut libc::c_void)
}
}
}
impl... | Rust | 0 |
ggregator.ethereum.transactions_decoder,
)
pools, gauges = read_curve_pools_and_gauges(chain_id=ChainID.ETHEREUM)
for pool in CURVE_EXPECTED_LP_TOKENS_TO_POOLS.values():
assert pool in pools
for pool, pool_coins in CURVE_EXPECTED_POOL_COINS.items():
assert pools.get(pool) == pool_co... | Python | 1 |
class GalxePageObject:
CONNECT_GLAXE_BTN="//button[@class='main' and text()='Connect Galxe']"
GALXE_LOGIN_BTN_XPATH="//div[text()='Log in']"
#GLAXE
AUTHENTICATE_BTN_XPATH='//*[@id="react-root"]/div/div/div[2]/main/div/div/div[2]/div/div/div[1]/div[3]/button'
INPUT_USERNAME_XPATH="//input[@place... | Python | 1 |
_RGBx:
UnormShort565 = ffi::CL_UNORM_SHORT_565 as isize,
// Represents a normalized x-5-5-5 4-channel xRGB image. The channel order must be CL_RGB or CL_RGBx:
UnormShort555 = ffi::CL_UNORM_SHORT_555 as isize,
// Represents a normalized x-10-10-10 4-channel xRGB image. The channel order m... | Rust | 0 |
import torch
import torch.nn as nn
import torchvision.transforms as T
import torchvision.transforms.functional as TF
import clip
class CLIP(nn.Module):
def __init__(self, device, **kwargs):
super().__init__()
self.device = device
self.clip_model, self.clip_preprocess = clip.load("ViT-B/1... | Python | 1 |
from django.utils import timezone
from .models import BaseConfig
def get_excluded_rows() -> list[str]:
subclasses = set(BaseConfig.__subclasses__())
excluded_config_rows = []
for config_cls in subclasses:
if isinstance(config_cls.__exported__, list):
for config_row_name in config_cls.... | Python | 1 |
_B0_01,
#[doc = "0x664 - SW_MUX_CTL_PAD_GPIO_SPI_B0_02 SW MUX Control Register"]
pub sw_mux_ctl_pad_gpio_spi_b0_02: SW_MUX_CTL_PAD_GPIO_SPI_B0_02,
#[doc = "0x668 - SW_MUX_CTL_PAD_GPIO_SPI_B0_03 SW MUX Control Register"]
pub sw_mux_ctl_pad_gpio_spi_b0_03: SW_MUX_CTL_PAD_GPIO_SPI_B0_03,
#[doc = "0x66c... | Rust | 0 |
'c_': 'CUSTOMER', 'o_': 'ORDERS', 'l_': 'LINEITEM'}
with open(file_path, 'w') as f:
for column in columns:
if column[0].split('_')[0] + "_" in table_columns_dict and column[1].split('_')[0] + "_" in table_columns_dict:
table1 = table_columns_dict[column[0].split('_')[0] + "_"]... | Python | 1 |
!(
unsafe { &(*(::std::ptr::null::<matd_t>())).ncols as *const _ as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(matd_t),
"::",
stringify!(ncols)
)
);
assert_eq!(
unsafe { &(*(::std::ptr::null::<matd_t>())).data... | Rust | 0 |
b::from_mut_slice( f.as_raw_fd(),
0, //offset
&mut wbuf,
0, //priority
SigevNotify::SigevNone,
LioOpcode::LIO_NOP);
aio_write(&mut aiocb).unwrap();
let err = aio_error(... | Rust | 0 |
cpu.delay = 0x76;
cpu.cycle();
assert_eq!(cpu.registers.v1, 0x76);
}
#[test]
fn set_delay_to_vx() {
let mut memory: Memory = Memory::new();
let display: Display = Display::new();
memory.write_u16(0x200, 0xF115);
let mut cpu = Cpu::new(memory, displ... | Rust | 0 |
te order
/// 5 64-bit floats (IEEE double), little endian byte order
/// 10 Steim-1 integer compression, big endian byte order
/// 11 Steim-2 integer compression, big endian byte order
/// 19 Steim-3 integer compression, big endian (not in common use in archives)
/// 100 Opaque data - only for use in special scena... | Rust | 0 |
# MIT License
#
# Copyright (c) 2020 Gabriel Nogueira (Talendar)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy,... | Python | 1 |
from typing import List
class Solution:
def search(self, nums: List[int], target: int) -> int:
left, right = 0, len(nums) - 1
while left <= right:
mid = (left + right) // 2
if nums[mid] == target:
return mid
if nums[left] <= nums[mid]:
... | Python | 1 |
import geopandas as gpd
import random
from src.Charging.infrastructure.config.config import config
class GeoDataProcessor:
"""Handles geospatial data operations."""
@staticmethod
def sort_by_plz_add_geometry(dfr, dfg):
dframe = dfr.copy()
df_geo = dfg.copy()
sorted_df = dframe.... | Python | 1 |
#
# 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 us... | Python | 1 |
UES_SURFACE:[Surface; 7] = [
Surface::None,
Surface::Asphalt,
Surface::Grass,
Surface::Gravel,
Surface::Kerb,
Surface::Sand,
Surface::Tyre
];
#[allow(non_camel_case_types)]
pub const ENUM_NAMES_SURFACE:[&'static str; 7] = [
"None",
"Asphalt",
"Grass",
"Gravel",
"Kerb",
"Sand",
... | Rust | 0 |
alse,
"readBufferSize": 2,
"writeBufferSize": 2,
"header": {
"type": "none"
}
}
""")
mux_enable = json.loads("""
{
"enabled": true
}
""")
mux_disable = json.loads("""
{
"enabled"... | Python | 1 |
/// \\]
///
/// \\( {\rm vec}(X) = (X_{11}\ \sqrt2 X_{12}\ X_{22}\ \sqrt2 X_{13}\ \sqrt2 X_{23}\ X_{33}\ \cdots)^T \\)
/// which extracts and scales the upper-triangular part of a symmetric matrix X in column-wise.
/// [`ConePSD`] is used for \\( {\rm vec}(\mathcal{S}_+^k) \\).
pub struct ProbSDP<L, F>
where L... | Rust | 0 |
ignal(());
}
}
}
}
}
}
pub struct PortInputFuture<'a, T> {
gpiote: &'a Gpiote,
pin: &'a Pin<Input<T>>,
polarity: PortInputPolarity,
}
impl<'a, T> Drop for PortInputFuture<'a, T> {
fn drop(&mut self) {
pin_conf(&self.pin).modify(|_, w|... | Rust | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.