text string | label_name string | labels int64 |
|---|---|---|
class Solution:
def permuteUnique(self, nums: List[int]) -> List[List[int]]:
counter = Counter(nums)
result =[]
def dfs(path):
if len(path) == len(nums):
result.append(path[:])
return
for x in counter:
... | Python | 1 |
# These tests used to be in test_exclude_include but they're mostly about
# formatting results when files are skipped.
import pytest
from tests.fixtures import RunSemgrep
from semgrep.constants import OutputFormat
# Test output formatting in verbose mode.
#
# Exclude all the files with '--exclude' patterns resulting... | Python | 1 |
aranteed that all impls of
// BitFieldSpecifier come from within this crate.
pub trait Sealed {}
}
// Instantiated by the generated code to prove that the total size of fields is
// a multiple of 8 bits.
#[doc(hidden)]
pub struct Check<T: checks::TotalSizeIsMultipleOfEightBits> {
marker: std::marker::Phant... | Rust | 0 |
from indra.statements import *
from indra.assemblers.pysb import PysbAssembler
from indra.assemblers.pysb.bmi_wrapper import BMIModel
stmts = [Influence(Event(Concept('rainfall')),
Event(Concept('flood'))),
Influence(Event(Concept('flood')),
Event(Concept('displacement'))... | Python | 1 |
from django import forms
from django.core.exceptions import ValidationError
from shop.models import ProductModel,ProductImages
class ProductForm(forms.ModelForm):
class Meta:
model = ProductModel
fields=[
'category',
'title',
'slug',
'im... | Python | 1 |
g()?;
test.heap()?;
test.drivers_only_instantiable_once()?;
#[cfg(not(feature = "__internal_disable_timer_in_integration_test"))]
test.callbacks(timer).await?;
#[cfg(not(feature = "__internal_disable_gpio_in_integration_test"))]
test.gpio(gpio)?;
Ok(())
}
struct LibtockTest {
success: b... | Rust | 0 |
from rest_framework import permissions
class IsOwnerOrReadOnly(permissions.BasePermission):
"""
Custom permission to only allow owners of an object to edit it.
"""
def has_object_permission(self, request, view, obj):
# Read-only permissions are allowed for any request
if request.method... | Python | 1 |
a, 'tcx> HashStable<StableHashingContext<'a, 'tcx>> for ty::adjustment::Adjust<'tcx> {
fn hash_stable<W: StableHasherResult>(&self,
hcx: &mut StableHashingContext<'a, 'tcx>,
hasher: &mut StableHasher<W>) {
mem::discriminant(... | Rust | 0 |
# Periodically generate proofs
if i % 100 == 0 and i > 0:
for j in range(0, i, 100):
proof = tree.get_inclusion_proof(j, i+1)
leaf_hash = tree._hash_leaf(f"leaf-{j}".encode())
assert tree.verify_in... | Python | 1 |
atches.push(m);
// Remove all blocks until wrap and maybe one more, to ensure that remove
// the block with the detected syncword.
first.len() + blocks_before
}
else {
// Remove all items until wrap (there i... | Rust | 0 |
::args().collect();
if args.len() != 2 {
eprintln!("Expected usage: <{}> <configuration file>", args[0]);
std::process::exit(1);
}
let path = std::path::PathBuf::from(&args[1]);
Configuration::load(&path)
}
// TODO: replace with bitcoin example once bitc... | Rust | 0 |
ster/examples/adc.rs
let mut adc = p.ADC.adc(&mut rcc);
adc.set_precision(Precision::B_12);
let adcs: Adcs<Adc> = Adcs { ad_1st: adc };
// no channel one-shot conversion
//There is no MCU temperature sensor (I think).
let mcutemp: Sensor<Option<PB1<Analog>>> = Sensor { ch: None }; // intern... | Rust | 0 |
0:
continue
frame = self._process_frame(frame, landmarker, calc_ts, fps)
if self.display:
cv2.imshow("Frame", frame)
# Press Q on keyboard to exit
if cv2.waitKey(1) & 0xFF == ord("q"):
... | Python | 1 |
l')),
('create_at', models.DateTimeField(auto_now_add=True)),
('cadastro', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='imagens', to='efetivo.cadastro')),
('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.A... | Python | 1 |
# ------------------------------------------------------------------
# Tensorflow implementation of
# "Learning Dynamic Memory Networks for Object Tracking", ECCV,2018
# Licensed under The MIT License [see LICENSE for details]
# Written by Tianyu Yang (tianyu-yang.com)
# -----------------------------------------------... | Python | 1 |
nitializing user.")
uid = get_init_user()
if uid:
# 更新请求数据
request_data = {"videoUrl": url, "version": 202, "uid": uid}
# 打印 curl 命令
curl_command = f"curl -X POST http://xvideoget.com/twitter/resolutionVideo -H 'Content-Type: appli... | Python | 1 |
event.
///
/// The triple `(project_id, event_id, id)` identifies an attachment uniquely.
id: String,
/// File name of the attachment file.
name: String,
/// Content type of the attachment payload.
content_type: Option<String>,
/// The Sentry-internal attachment type used in the proc... | Rust | 0 |
));
}
pub fn test_tx<D: Database>(mut tree: D) {
let hex_tx = Vec::<u8>::from_hex("0100000001a15d57094aa7a21a28cb20b59aab8fc7d1149a3bdbcddba9c622e4f5f6a99ece010000006c493046022100f93bb0e7d8db7bd46e40132d1f8242026e045f03a0efe71bbb8e3f475e970d790221009337cd7f1f929f00cc6ff01f03729b069a7c21b59b1736ddfee5db... | Rust | 0 |
offset_x: int,
offset_y: int,
blur_radius: float,
SSAA: int,
method: str,
watermark = None,
mask = None,
):
try:
print("Starting mockup creation...")
# 1. 初始化图像
overlay = tensor_to_image(overlay_image[0])
... | Python | 1 |
2C Address Mask Bit 5"]
#[inline(always)]
pub fn ucaddmask5(&self) -> UCADDMASK5_R {
UCADDMASK5_R::new(((self.bits >> 5) & 0x01) != 0)
}
#[doc = "Bit 6 - I2C Address Mask Bit 6"]
#[inline(always)]
pub fn ucaddmask6(&self) -> UCADDMASK6_R {
UCADDMASK6_R::new(((self.bits >> 6) & 0x... | Rust | 0 |
regions",
"1QMT" => "Tropics",
"1QR" => "Groupings linked by seas",
"1QRM" => "Mediterranean countries",
"1QRP" => "Pacific Rim countries",
"1QS" => "Oceans & seas",
"1QSA" => "Atlantic Ocean",
"1QSAN" => "North Atlantic",
"1QSAS" => "South Atlantic",
"1QSB" => "Baltic Sea",
"1Q... | Rust | 0 |
ameters
let sign_params = SignParams {
digest_algorithm: digest_algorithm.to_owned(),
certificate_thumbprint: certificate_thumbprint.to_owned(),
timestamp_url: match timestamp_url {
Some(v) => Some(v.to_owned()),
None => None
},
};
let mut error_count... | Rust | 0 |
4
0x11,// HkWIb_3b
0x8D,// ZMM0
0x86, 0x0D,// EVEX_Vpsrld_zmm_k1z_zmmm512b32_imm8
0x0A,// N64b4
0x00,// Invalid
0x00,// Invalid
0x00,// Invalid
// 3 = 0x03
0x00,// Invalid
// 4 = 0x04
0x08,// MandatoryPrefix2
0x00,// Invalid
0x07,// W
0x09,// VectorLength
0x11,// HkWIb_3b
... | Rust | 0 |
ri = format!("/v1/client/add-snapshot/{}", version_id);
let req = test::TestRequest::post()
.uri(&uri)
.header(
"Content-Type",
"application/vnd.taskchampion.history-segment",
)
.header("X-Client-Key", client_key.to_string())
... | Rust | 0 |
try to load checkpoint from
# TEST.CHECKPOINT_FILE_PATH and test it.
load_checkpoint(
cfg.TEST.CHECKPOINT_FILE_PATH,
model,
None,
cfg.NUM_GPUS > 1,
None,
inflation=False,
convert_from_caffe2=cfg.TEST.CHECKPOINT_TYPE == "... | Python | 1 |
0.0.0.0/32".parse().unwrap();
/// assert_eq!(tinynet.size(), 1);
/// ```
pub fn size(self) -> u32 {
let host_bits = u32::from(IPV4_BITS - self.prefix);
(2 as u32).pow(host_bits)
}
/// Returns the `n`:th address within this network.
/// The adresses are indexed from 0 and `n` mus... | Rust | 0 |
[doc = "`write(|w| ..)` method takes [otg_hs_hcint2::W](otg_hs_hcint2::W) writer structure"]
impl crate::Writable for OTG_HS_HCINT2 {}
#[doc = "OTG_HS host channel-2 interrupt register"]
pub mod otg_hs_hcint2;
#[doc = "OTG_HS host channel-3 interrupt register\n\nThis register you can [`read`](crate::generic::Reg::read)... | Rust | 0 |
leware'
)
ROOT_URLCONF = 'desktop.core.urls'
# Python dotted path to the WSGI application used by Django's runserver.
WSGI_APPLICATION = 'desktop.core.wsgi.application'
TEMPLATE_DIRS = (
os.path.join(DESKTOP_CORE_ROOT, 'templates'),
)
LOCALE_PATHS = (
os.path.join(DESKTOP_CORE_ROOT, 'locale' ),
)
AUTHEN... | Python | 1 |
import base64
import sys
from types import ModuleType, SimpleNamespace
from application.tts.elevenlabs import ElevenlabsTTS
def test_elevenlabs_text_to_speech_monkeypatched_client(monkeypatch):
monkeypatch.setattr(
"application.tts.elevenlabs.settings",
SimpleNamespace(ELEVENLABS_API_KEY="api-key... | Python | 1 |
by applicable law or agreed to 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.
//! Errors for th... | Rust | 0 |
// upward-sloping linear: the domain's lower bound if it is finite, otherwise nan
if lower.is_finite() {
lower
} else {
f64::NAN
}
} else if utils::lt_ep(b, 0.) {
// downward sloping linear: see above logic for upward-sloping linear... | Rust | 0 |
) = &input.r#type {
object.key("Type").string(var_2291);
}
}
pub fn serialize_structure_crate_model_aws_ecs_task_definition_volumes_details(
object: &mut smithy_json::serialize::JsonObjectWriter,
input: &crate::model::AwsEcsTaskDefinitionVolumesDetails,
) {
if let Some(var_2292) = &input.docker... | Rust | 0 |
:Zzt => {}
WorldType::SuperZzt => {
let camera_x = self.meta_data.camera_x.ok_or_else(|| format!("Can't write camera X: not set"))?;
stream.write_i16::<LittleEndian>(camera_x).map_err(|e| format!("Failed to write camera X: {}", e))?;
}
};
match world_type {
WorldType::Zzt => {}
WorldType::Super... | Rust | 0 |
exist_table(&conn, "book") {
conn.execute(INIT_BOOK_TABLE, [])?;
}
if !chk_exist_table(&conn, "word") {
conn.execute(INIT_WORD_TABLE ,[])?;
}
Ok(0)
}
#[cfg(test)]
mod tests {
use rusqlite;
use rusqlite::{Connection};
#[test]
fn test_init() -> rusqlite::Result<()> ... | Rust | 0 |
#[inline(always)]
pub fn usbsusp_msk(&mut self) -> USBSUSPMSK_W {
USBSUSPMSK_W { w: self }
}
#[doc = "Bit 12 - USB Reset Mask"]
#[inline(always)]
pub fn usbrst_msk(&mut self) -> USBRSTMSK_W {
USBRSTMSK_W { w: self }
}
#[doc = "Bit 13 - Enumeration Done Mask"]
#[inlin... | Rust | 0 |
pub const SIO_GPIO_HI_OUT_OFFSET: u32 = 48;
pub const SIO_GPIO_HI_OUT_BITS: u32 = 63;
pub const SIO_GPIO_HI_OUT_RESET: u32 = 0;
pub const SIO_GPIO_HI_OUT_MSB: u32 = 5;
pub const SIO_GPIO_HI_OUT_LSB: u32 = 0;
pub const SIO_GPIO_HI_OUT_ACCESS: &'static [u8; 3usize] = b"RW\0";
pub const SIO_GPIO_HI_OUT_SET_OFFSET: u32 = ... | Rust | 0 |
valorp = float(input("Digite o valor do salário atual: "))
aumento = int(25)
total1 = (valorp*aumento)/100
total2 = valorp + total1
print("O funcionario recebeu o aumento de 25%, aumentando o salario atual para: ", total2) | Python | 1 |
with gravity vector. We pick the face with lower height (y-value).
# The parallel to face 0 is 1, face 2 is 3, and face 4 is 5.
parallel_face_id = ground_plane_id + 1
parallel_face = FACES[parallel_face_id]
parallel_face_center = get_face_center(parallel_face)
parallel_face_normal = get_face_normal(... | Python | 1 |
{}", e),
/// };
///
/// println!("byte size: {}", info.size);
/// # }
/// ```
#[deriving(Hash)]
pub struct FileStat {
/// The size of the file, in bytes
pub size: u64,
/// The kind of file this path points to (directory, file, pipe, etc.)
pub kind: FileType,
/// The file permissions currently on th... | Rust | 0 |
vec!["1".to_string()]);
manager.screen_create_handler(Screen::default());
manager.screen_create_handler(Screen::default());
manager.focus_tag(&"1".to_owned());
let actual = manager.focused_workspace().unwrap();
let expected = Some(0);
assert_eq!(actual.id, expected);
... | Rust | 0 |
the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* Libgcrypt is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or ... | Rust | 0 |
continue;
}
// Ensure new file doesn't exist.
if fs::metadata(&new_filename).is_ok() {
if !matches.is_present("force") {
if matches.is_present("no-trim") {
error!("already exists: ... | Rust | 0 |
)| {
let cache = cache::Cache::with_capacity(1_000_000_000);
let arc_cache = Arc::new(Mutex::new(cache));
let ddml = Arc::new(ddml::DDML::open(pool, arc_cache.clone()));
let (idml, label_reader) = idml::IDML::open(ddml, arc_cache,
... | Rust | 0 |
conn.send(&mut out).expect("initial send failed");
println!("6/ CONN.SEND {} bytes", write);
while let Err(e) = socket.send(&out[..write]) {
if e.kind() == std::io::ErrorKind::WouldBlock {
println!("EE 6/ send() would block");
continue;
}
panic!("EE-PANIC 6/ sen... | Rust | 0 |
nic]
fn test_set_panics_overflow() {
set_bit(0, 8);
}
#[test]
fn test_reset() {
let register = 0b1100_0010u8;
assert_eq!(0b1100_0010u8, reset_bit(register, 0));
assert_eq!(0b0100_0010u8, reset_bit(register, 7));
assert_eq!(0b1000_0010u8, reset_bit(register, 6));
assert_eq!(0b1100_0010u8, reset... | Rust | 0 |
one_type[2] / 3
show = map_show * 0.8 + img_ori * 0.2
show = show.astype(np.uint8)
map_show = map_show.astype(np.uint8)
cv2.imshow(f"all_{SHOW_NAME[idx]}", show)
cv2.imwrite('./cam_results/head_cont'+str(idx)+SHOW_NAME[... | Python | 1 |
type_: lex::Type,
pub data_arr: Vec<Data>,
}
#[derive(Debug, Clone)]
pub enum Data {
StringLiteral(String),
BoolValue(bool),
Identifier(Identifier),
IntNum(i64),
// FloatNum(f64),
}
#[derive(Debug, Clone, Eq, Ord, PartialEq, PartialOrd, Hash)]
pub struct Identifier(pub String);
use position:... | Rust | 0 |
RegistryPallet::get_required_collateral_for_wrapped(DEFAULT_VAULT_ISSUED).unwrap();
CoreVaultData::force_to(
VAULT,
CoreVaultData {
backing_collateral: required_collateral,
..CoreVaultData::vault(VAULT)
},
);
let redeem_id = set... | Rust | 0 |
: usize = 31;
#[cfg(target_arch = "aix")]
pub const HEAP_ADDRESS_BITS: usize = 60;
// maxAlloc is the maximum size of an allocation. On 64-bit,
// it's theoretically possible to allocate 1<<heapAddrBits bytes. On
// 32-bit, however, this is one less than 1<<32 because the
// number of bytes in the address space doesn... | Rust | 0 |
let phash = st.read::<String>(0)?;
return Ok(bcrypt::verify(p_word,&phash)?);
}
Ok(false)
}
pub fn pay(&self,u_from:&str,u_to:&str,amount:i64)->Result<(),UBaseErr>{
let conn = sqlite::open(&self.fname)?;
let mut st = conn.prepare(r#"insert into transacti... | Rust | 0 |
.help("Format output for usage with bot"))
.get_matches();
let mut b = false;
if matches.is_present("bot output"){b = true};
let val = matches.value_of("INPUT").unwrap();
let fname = matches.value_of("NAME").unwrap();
if !b { println!("{} {}...", "Opening ".color(TermColor::Cyan).bold(), val)}
let file = File:... | Rust | 0 |
target = target.to(device=device).view(-1)
predict = model(data, feature)
loss = criterion(predict, target)
_, predict_index = torch.max(predict.detach().to(device='cpu'), dim=1)
valid_predict_labels.append(predict_index)
v... | Python | 1 |
repo: &Repository, m: &ArgMatches) -> Result<()> {
let mut internals = Internals::read(repo)?;
let (working_cover_id, working_cover_content) = match internals.working.get("cover")? {
None => (Oid::zero(), String::new()),
Some(entry) => (entry.id(), std::str::from_utf8(repo.find_blob(entry.id())... | Rust | 0 |
align: Align {fx: 0.0, fy: 0.5},
walk: Walk {
width: Width::Computed,
height: Height::Fixed(40.0),
},
padding: Padding {
l: 10.0,
t: 2.0,
r: 15.0,
b: 0.0,
},
}... | Rust | 0 |
import numpy as np
from numba import cuda, float64, void
from numba.cuda.testing import unittest, CUDATestCase
from numba.core import config
# NOTE: CUDA kernel does not return any value
if config.ENABLE_CUDASIM:
tpb = 4
else:
tpb = 16
SM_SIZE = tpb, tpb
class TestCudaLaplace(CUDATestCase):
def test_lap... | Python | 1 |
argument_list.append({"opts": ("-gui", "--gui"),
"action": "store_true",
"dest": "redirect_gui",
"default": False,
"help": argparse.SUPPRESS})
return argument_list
class GuiArgs(FaceSwap... | Python | 1 |
&[ColumnStatsOutput],
config: &config::Config,
) -> Vec<GridItem> {
let autogrid = &config.train.autogrid;
let (train_linear, train_tree) = match autogrid {
Some(ag) => match &ag.model_types {
Some(vec) => (
vec.contains(&config::ModelType::Linear),
vec.contains(&config::ModelType::Tree),
),
None... | Rust | 0 |
o_endpoint().map_to_response().boxed(),
)?;
Ok(self)
}
}
#[async_trait::async_trait]
impl Endpoint for RouteDomain {
type Output = Response;
async fn call(&self, req: Request) -> Result<Self::Output> {
let host = req
.headers()
.get(header::HOST)
... | Rust | 0 |
_pow;
use crate::util::MoreNumCast;
pub trait PrimeTester<T>
where
T: Eq + Clone + Zero + One,
{
fn is_prime(&self, x: &T) -> bool;
fn is_composite(&self, x: &T) -> bool {
if x == &Zero::zero() || x == &One::one() {
false
} else {
!self.is_prime(x)
}
}
}... | Rust | 0 |
import os
import pickle
import time
import json
from nonebot import get_driver
from typing import Any, Optional, Set, Dict, List, Tuple, overload
from typing_extensions import Self, override
from dataclasses import dataclass, field
from .logger import logger
from .singleton import Singleton
from .config import config... | Python | 1 |
from_be_bytes(buf[1..3].try_into().unwrap());
let body = buf[3..].to_vec();
if parameter_length as usize != body.len() {
return Err(Error::InvalidMessage);
}
Ok(Self { pdu_id, parameter_length, body })
}
}
impl Encodable for BrowsePreamble {
fn encoded_len(&self) -... | Rust | 0 |
t;
use anyhow::{Context, Result};
use lambda_runtime::{handler_fn, Context as LambdaContext, Error};
use log::{debug, info};
type Response = Result<SuccessResponse>;
#[tokio::main]
async fn main() -> Result<(), Error> {
setup_logging();
system_a::do_stuff_from_system_a();
system_b::do_stuff_from_system_... | Rust | 0 |
ag, None).unwrap();
main_loop(&mut events_loop, &program, &display);
}
#[cfg_attr(feature="cargo-clippy", allow(clippy::single_match))]
fn main_loop(
events_loop: &mut glium::glutin::EventsLoop,
program: &glium::Program,
display: &glium::Display)
{
use glium::glutin::{ Event, WindowEvent, dp... | Rust | 0 |
import ssl
import socket
import argparse
def detect_ssl_verification_bypass(target_host, target_port):
"""
檢測目標 Apache HTTP Server 是否存在 CVE-2024-40898 (SSL 驗證繞過) 漏洞
:param target_host: 目標伺服器的主機名或 IP 地址
:param target_port: 目標伺服器的端口號
"""
context = ssl.create_default_context(ssl.Purpose.CLIENT_AU... | Python | 1 |
///
/// let map: BpMap<u32, u64> = BpMap::new("example_bp_map_is_empty", 4, 8)?;
/// assert!(map.is_empty());
/// # fs::remove_file("example_bp_map_is_empty")?;
/// # Ok(())
/// # }
/// # foo().unwrap();
/// ```
pub fn is_empty(&self) -> bool {
self.pager.get_len() == 0
... | Rust | 0 |
nput: Vec<Pair<'a>>,
result: i64,
}
fn fuel_to_ore(formulae: &Formulae<'_>, fuel: i64) -> i64 {
let mut need = HashMap::new();
need.insert("FUEL", fuel);
loop {
let mut updates = HashMap::<&str, i64>::new();
for (chem, amount) in need.iter().filter(|&(_, &a)| a > 0) {
if let... | Rust | 0 |
s=[0, 1],
)
],
)
elif fork < Prague:
# Feed blob transaction, type 3
tx_2 = Transaction(
to=code_account_2,
data=b"",
nonce=1,
secret_key=TestPrivateKey,
protected=fork >= Byzantium,
gas_limit... | Python | 1 |
quire().await.expect("Semaphore to be operating");
let res = tracker_check::check_udp_candidate(candidate.clone()).await;
drop(permit);
match &res {
Ok(profile) => { println!("Success: {:?}", profile) }
Err(err) => { println!("Failu... | Rust | 0 |
from django.shortcuts import render
from rest_framework import generics
from .models import Order, OrderItem
from .serializers import OrdersListSerializer, OrderDetailSerializer, OrderItemSerializer, UpdateOrdersSerializer
# Create your views here.
# ORDERS LIST
class OrdersListGenericApiView(generics.ListAPIView):
... | Python | 1 |
n blocks
pub blocks: u64,
/// Time of last access
pub atime: SerializableTimespec,
/// Time of last modification
pub mtime: SerializableTimespec,
/// Time of last metadata change
pub ctime: SerializableTimespec,
/// Time of creation (macOS only)
pub crtime: SerializableTimespec,
... | Rust | 0 |
"""
개발 환경 설정
"""
from .base import *
from decouple import config
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
ALLOWED_HOSTS = ['localhost', '127.0.0.1']
# Database - 개발 환경에서는 SQLite 사용
DATABASES = {
"default": {
"ENGINE": "django.db.backends.sqlite3",
"NAME": BAS... | Python | 1 |
!("The Simple parameter set for '{}' has not been set.", name));
}
}
let parameters = ordered
.iter()
.map(move |&x| {
let s: String = x.into();
let v = self.parameters[&s].clone();
(s, v)
... | Rust | 0 |
900000002".to_string());
assert_eq!(aff_tsv_content[3], "1\t3\tleo@dee.com\tLeo\t+886900000003".to_string());
}
assert_eq!(
DiskInterface::get_num_rows("crazyguy", "BookerDB", "Affiliates", Some(file_base_path)).unwrap(),
3
);
let rows: Vec<Row> =
... | Rust | 0 |
comments.user_comments {
utils::match_ignore_case! {
match key {
"TITLE" => tags.title = Some(value),
"ALBUM" => tags.album = Some(value),
"ARTIST" => tags.artist = Some(value),
"ALBUMARTIST" => tags.album_artist = Some(value),
"TRACKNUMBER" => tags.track_number = value.parse::<u32>().ok(),
... | Rust | 0 |
nt(TMRB2TRIG_A::A6OUT2DUAL)
}
#[doc = "Trigger source is CTIMERA7 OUT2, dual edge."]
#[inline(always)]
pub fn a7out2dual(self) -> &'a mut W {
self.variant(TMRB2TRIG_A::A7OUT2DUAL)
}
#[doc = "Trigger source is CTIMERB4 OUT2, dual edge."]
#[inline(always)]
pub fn b4out2dual(self) -... | Rust | 0 |
return TermCall {
// fun: self.make_term(fun, reads[0]),
// args: vec![Term::Binary(bin.into()).into()],
// };
//}
OpKind::MapPut { action } => {
let map_term = self.make_term(fun, reads[2]);
println!("{:#?}", m... | Rust | 0 |
n, m, sn = input().split()
# n = int(input())
# m = int(input())
# sp = int(input())
n = int(n)
m = int(m)
sn = int(sn)
dfs_node = [[] for _ in range(1001)]
bfs_node = [[] for _ in range(1001)]
dfs_vis = [False for _ in range(1001)]
bfs_vis = [False for _ in range(1001)]
while m > 0:
x, y = input().split()
x... | Python | 1 |
-> VirtualMachine {
flame_guard!("new VirtualMachine");
let ctx = Context::default();
// make a new module without access to the vm; doesn't
// set __spec__, __loader__, etc. attributes
let new_module = || {
PyRef::new_ref(
PyModule {},
... | Rust | 0 |
nary of hyperparameters to tune."""
return {
"learning_rate": [loguniform(0.01, 0.2).rvs()],
"n_estimators": [np.random.randint(100, 500)],
"max_depth": [np.random.randint(3, 8)],
"min_samples_split": [np.random.randint(2, 20)],
"min_samples_leaf": [np... | Python | 1 |
import os
import subprocess
import random
import re
import time
from appium.webdriver.common.appiumby import AppiumBy
from appium.options.android import UiAutomator2Options
from appium import webdriver
from auto_app_page import click_element
# 启动PCAPDroid会话
def start_pcapdroid_session(device_name):
options = UiA... | Python | 1 |
) {
if game.status == GameStatus::Ending && query_say.is_empty() {
if let Ok(entity) = query_title.get_single() {
if keys.just_pressed(KeyCode::R) {
// R was pressed
commands.entity(entity).despawn();
game.opponent = 0;
game.status ... | Rust | 0 |
PARCEL_DIRECTORY as PARCEL_DIR};
/// A struct containing paths to all of the key components of a standalone bundle
pub struct StandaloneRead {
pub invoice_file: PathBuf,
pub parcel_dir: PathBuf,
pub parcels: Vec<PathBuf>,
}
impl StandaloneRead {
/// Returns a new StandaloneRead constructed using the ... | Rust | 0 |
None;
self.target_chroma_fg_rgb = RGB::BLACK;
}
}
fn attr_target_value(&self) -> Option<F> {
self.target_chroma
}
fn attr_target_value_fg_rgb(&self) -> RGB<F> {
self.target_chroma_fg_rgb
}
fn label_colour(&self) -> RGB<F> {
RGB::WHITE
}
fn... | Rust | 0 |
assert!(slim.len() > 0);
}
#[test]
fn iterate_cgroup_mount_points() {
let mut found = false;
for c in cgroup_mount_points_iter() {
found = match c {
Ok(_) => true,
Err(err) => panic!("{}", err.description),
}
}
assert!(found);
}
#[test]
fn test_cgroup_mount_poin... | Rust | 0 |
# Copyright 2012-2018 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Tests for the setup-dns command."""
from argparse import ArgumentParser
import io
import os
from maastesting.factory import factory
from maastesting.testcase import MAAST... | Python | 1 |
from colorama import Fore, init
from litellm import completion
# Initialize colorama for colored terminal output
init(autoreset=True)
class Agent:
"""
@title AI Agent Class
@notice This class defines a simple AI agent with no function calling capabilities
"""
def __init__(self, name, model, syst... | Python | 1 |
panic!("in tx_uart_signal"); }
}
periph.ioc_sel.store_reg(|r, v| {
r.pad_sel().write(v, selval);
});
}
// Configure TX pin for the output enable.
fn tx_output_enable<T: IocPadMap + IocPadOverBits>(periph: &mut IocPadPeriph<T>) {
periph.ioc_over.modify_reg(|r, v| {
r.pad_over_bits().writ... | Rust | 0 |
of3)
.is_ok());
// We can construct signatures from 32 single signatures.
let sigs_32 = vec![single_signature.clone(); 32];
let indices: Vec<u8> = (0..32).collect();
let sig32_tuple = sigs_32.into_iter().zip(indices.into_iter()).collect();
let multi_sig32 = MultiEd25519Signature::new(sig32... | Rust | 0 |
ule = RProduction::<i32,i32>::new_skeleton("F");
rule.Ruleaction = |parser|{ let n:i32=parser.stack.pop().unwrap().value; return n; };
parser1.Rules.push(rule);
rule = RProduction::<i32,i32>::new_skeleton("START");
rule.Ruleaction = |parser|{ parser.stack.pop(); return i32::default();};
parser1.Rules.push(rul... | Rust | 0 |
# id 10 (CaravanP2_chk10), field 867200550
sm.createQuestWithQRValue(64006, "WC=4;k1=0;k2=0;k3=0;k5=0;speed=20;k6=0;k7=0;man=199;prog=0;Pt=CaravanP2_chk9;Ec=10;max=20;weather=1;food=329")
sm.createQuestWithQRValue(64006, "WC=5;k1=0;k2=0;k3=0;k5=0;speed=20;k6=0;k7=0;man=199;prog=0;Pt=CaravanP2_chk9;Ec=10;max=20;weather=... | Python | 1 |
from pelicula import *
def obtener_opcion_valida():
while True:
try:
opcion = int(input('Escriba una opción del menú (del 1 al 4): '))
if 1 <= opcion <= 4:
return opcion
else:
print("Por favor, ingrese un número entre 1 y 4.")
exce... | Python | 1 |
y(i) for i, a in enumerate(self.adversaries)}
obs.update(
{a: _good(i + self.num_adversaries) for i, a in enumerate(self.good_agents)}
)
return obs
def rewards(self, state: State) -> Dict[str, float]:
@partial(jax.vmap, in_axes=(0, None))
def _collisions(agent_id... | Python | 1 |
🚀 Starting GPU-Optimized Text Generation Model Training")
# GPU-Optimized Configuration
config = Config()
# Override config for maximum GPU utilization
config.sequence_length = 150 # Longer sequences
config.embedding_dim = 512 # Larger embeddings
config.hidden_dim = 1024 # La... | Python | 1 |
import pytest
from evalml.model_family import ModelFamily, handle_model_family
@pytest.fixture
def correct_model_families():
correct_model_families = [
ModelFamily.LINEAR_MODEL,
ModelFamily.LIGHTGBM,
ModelFamily.RANDOM_FOREST,
ModelFamily.XGBOOST,
ModelFamily.CATBOOST,
... | Python | 1 |
from test.integration.terrareg import TerraregIntegrationTest
from test import client, app_context, test_request_context
class TestApiProviderCategories(TerraregIntegrationTest):
"""Test ApiProviderCategories get endpoint"""
def test_endpoint_with_namespace(self, client):
"""Test endpoint with name... | Python | 1 |
match form.get(name) {
Some(FormEntry::Field(value)) => {
return Response::from_json(&json!({ name: value }))
}
Some(FormEntry::File(_)) => {
return Response::error("`field` param in form shouldn't be a File", 42... | Rust | 0 |
,
BSEC_OTP_DATA89: 0x00000000,
BSEC_OTP_DATA90: 0x00000000,
BSEC_OTP_DATA91: 0x00000000,
BSEC_OTP_DATA92: 0x00000000,
BSEC_OTP_DATA93: 0x00000000,
BSEC_OTP_DATA94: 0x00000000,
BSEC_OTP_DATA95: 0x00000000,
BSEC_HWCFGR: 0x00000014,
BSEC_VERR: 0x00000... | Rust | 0 |
}
fn from_error(e: Self::Error) -> Self {
Combined3(Err(e))
}
fn from_ok(t: Self::Ok) -> Self {
Combined3(Ok(t))
}
}
impl<A, B, C, D, ERR> Try for Combined4<A, B, C, D, ERR> {
type Ok = (A, B, C, D);
type Error = Vec<ERR>;
... | Rust | 0 |
fn from_iter<T: IntoIterator<Item = LTerm<U, E>>>(iter: T) -> Self {
let mut list_head = LTerm::empty_list();
let mut list_tail = &mut list_head;
for elem in iter {
let _ = std::mem::replace(
list_tail.as_mut(),
LTermInner::Cons(elem, LTerm::empty_list... | Rust | 0 |
key_strings.push(b32.clone());
address_index_recorders.push(InputIndexRecorder {
address_index: i as usize,
bip32_index: input_bip32_index,
input,
bech32: b32.clone(),
});
}
let mut output_recorder: Vec<OutputIndexRecorder> = Vec::new();
... | Rust | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.