text string | label_name string | labels int64 |
|---|---|---|
# --------------------------------------------------------
# Fast R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ross Girshick and Xinlei Chen
# --------------------------------------------------------
"""Compute minibatch blobs for training a Fast R-CNN ne... | Python | 1 |
returns_expected() {
assert_eq!(23, multiple_3_5_sum(10));
assert_eq!(233_168, multiple_3_5_sum(1000));
}
}
1 3.8140129484800003 0
2 0.9124092712944445 17
3 1.2698485852666666 49
4 0.9545705173444444 19
5 0.9501827369333332 51
6 1.0811151932444445 101
7 0.839028358208 74
8 1.1334789215444445 29
9 0... | Rust | 0 |
867,
195909455108318710,
10527070038778509320,
16605710222187477118,
10442518358308209073,
7776589986153052354,
16034091384000651523,
17429232381273855185,
512853344493546034,
7982076214836075255,
3601416800138513610,
399028695285184
]));
#[rustfmt::skip]
pub const G2_GENERA... | Rust | 0 |
672
const RCODE_YXDOMAIN = 0b_0000_0000_0000_0110;
/// YXRRSet RR Set Exists when it should not RFC2136
const RCODE_YXRRSET = 0b_0000_0000_0000_0111;
/// NXRRSet RR Set that should exist does not RFC2136
const RCODE_NXRRSET = 0b_000... | Rust | 0 |
_float(f: f32) -> Self {
f as f64
}
}
// Inherent methods are preferred over traits, so this won't be used in newer rust
trait OldRustWorkaround<T> {
unsafe fn to_int_unchecked(self) -> T;
}
impl OldRustWorkaround<u16> for f32 {
unsafe fn to_int_unchecked(self) ... | Rust | 0 |
from __future__ import annotations
import os
from typing import IO
import bokeh.command.util
from bokeh.application.handlers.code import CodeHandler
from bokeh.command.util import (
build_single_handler_application as _build_application,
)
def extract_code(
filehandle: IO, supported_syntax: tuple[str, ...... | Python | 1 |
from Classes.Instances.Classes.Alliance import Alliance
from Classes.Messaging import Messaging
from Classes.ClientsManager import ClientsManager
from Classes.Packets.PiranhaMessage import PiranhaMessage
from Classes.Utility import Utility
from Database.DatabaseHandler import DatabaseHandler, ClubDatabaseHandler
from ... | Python | 1 |
::encode_payload(v, payload), Encoding::from_str(v))
},
None => {
(payload, None)
}
};
if let Some(prefix) = payload_args.value_of("body-prefix") {
payload.insert_prefix(String::from(prefix).into_bytes());
}
if encoding_type.is_some() {
cfg.option(Re... | Rust | 0 |
cO*\xac\xa2\xf4\x90\xfd\
\x10\x08\xff\xa4\x82\x98v\xd1 \x80\xe83iJ\x97\xec\
a0r\xfaH\xd6_\xa9\x00\xa2\xcf\x0c)]\xaa\xfc\
\x16\xcc{\xe8#Y\x7f\xa5\x02\x88>3\xf4\xde\xe6\xfd\
+\x80\xb9\xfaH\xd6_\xa9\x00\xa2\xcf\x0c=@\xc6\x00\
\xa4\xf4\x91\xac\xbfR\x0f\x10\xfd\xbb\xd0\xaf\x03\x83qg\
\xb5`^\xe8G\xb9\xf79\xc8\x9f\x00\xde\xd5... | Python | 1 |
#[inline]
pub fn reset_value() -> W {
W { bits: 0 }
}
#[doc = r" Writes raw bits to the register"]
#[inline]
pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
self.bits = bits;
self
}
#[doc = "Bits 0:2 - Prescale Factor Selection"]
#[inline]
pub fn ... | Rust | 0 |
]
fn test_rune_count() {
let runestr1 = RuneString::from_str_lossy("\u{0041}\u{0341}\u{304B}\u{3099}\u{9508}");
assert_eq!(3, runestr1.runes().count());
assert_eq!(3, runestr1.chars().count());
let runestr2 = RuneString::from_str_lossy("\r\r\n\n");
assert_eq!(3, runestr2.run... | Rust | 0 |
def img2label_paths(img_paths):
sa, sb = os.sep + 'images' + os.sep, os.sep + 'labels' + os.sep
return ['txt'.join(x.replace(sa, sb, 1).rsplit(x.split('.')[-1], 1)) for
x in img_paths]
| Python | 1 |
Feature {
feature_type: FeatureType::Gaussian,
name: "email.n_words".to_owned(),
value: "10".to_owned(),
},
],
);
println!("{:?}\n", result);
assert!(result.get("not spam").unwrap().abs() > 0.9);
// result will be:
// {"not spam": ... | Rust | 0 |
in the original image will be returned.
"""
# On GPU, paste all masks together (up to chunk size)
# by using the entire image to sample the masks
# Compared to pasting them one by one,
# this has more operations but is faster on COCO-scale dataset.
device = masks.device
if skip_em... | Python | 1 |
SignalFilter};
#[test]
fn anomaly_sample_data() {
let input = vec![
1.0, 1.0, 1.1, 1.0, 0.9, 1.0, 1.0, 1.1, 1.0, 0.9, 1.0, 1.1, 1.0, 1.0, 0.9, 1.0, 1.0, 1.1, 1.0, 1.0, 1.0,
1.0, 1.1, 0.9, 1.0, 1.1, 1.0, 1.0, 0.9, 1.0, 1.1, 1.0, 1.0, 1.1, 1.0, 0.8, 0.9, 1.0, 1.2, 0.9, 1.0, 1.0,
... | Rust | 0 |
rie: Default::default()
}
}
/** Adds a word into the data structure. */
pub fn add_word(&mut self, word: String) {
let mut node = &mut self.trie.next;
for idx in word.bytes().map(|b| (b - b'a') as usize) {
let nodes = &mut node.0;
let next = unsafe { nodes.ge... | Rust | 0 |
# -*- coding: utf-8 -*- #
# Copyright 2021 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 |
from pathlib import Path
from mythril.mythril import MythrilDisassembler
from mythril.solidity.soliditycontract import SolidityContract
from tests import BaseTestCase
TEST_FILES = Path(__file__).parent / "testdata/input_contracts"
solc_binary = MythrilDisassembler._init_solc_binary("v0.5.0")
class SolidityContractT... | Python | 1 |
modify_reg!(stm32ral::gpio, gpio, AFRH, AFRH15: AF5);
//set alternate function mode for pin b15 (SPI2 MOSI)
modify_reg!(stm32ral::gpio, gpio, MODER, MODER15: Alternate);
//select alternate function number AF5 for pin PB13 (SPI2_SCK)
modify_reg!(stm32ral::gpio, gpio, AFRH, AFRH13: AF5);
//set al... | Rust | 0 |
# 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 u... | Python | 1 |
b6_\x06\xa5$~\x1a\xe2\x9am\x1ck\xf1\xbd\
VR2\x8b|\x0ca\xd6V\xb9\xfd4\x11\xd0\xe9\x5c\
\xae\xad\xba\x92\x82y\x12\xd2\xb1\x5c\xec\x9a\xbe\xc3\x0a\xc5\
$\xf0\xd1\x85q)a\xc9J\x0ar-\xe3\xe6\xed]\
\xda\x0b\xaa\xa1\xaf\x83\xf9<\xe2\xee+cl\xe1\x5c\xea\
\xb4\x88\xab\x14M\x83\xaeU/\xc1\xb67Sh\x05Z\
\x1bv\xba\x97K\x8a\xc7y\x82\xd... | Python | 1 |
import numpy as np
from gptcache.embedding.base import BaseEmbedding
from gptcache.utils import (
import_onnxruntime,
import_huggingface_hub,
import_huggingface,
)
import_huggingface()
import_onnxruntime()
import_huggingface_hub()
from transformers import AutoTokenizer, AutoConfig # pylint: disable=C041... | Python | 1 |
<cint::CINT_SPEC>;
#[doc = "Clear Interrupt Request Register"]
pub mod cint;
#[doc = "INT register accessor: an alias for `Reg<INT_SPEC>`"]
pub type INT = crate::Reg<int::INT_SPEC>;
#[doc = "Interrupt Request Register"]
pub mod int;
#[doc = "ERR register accessor: an alias for `Reg<ERR_SPEC>`"]
pub type ERR = crate::Re... | Rust | 0 |
import torch
from torch_geometric.utils import to_dense_batch
class GraphormerLayer(torch.nn.Module):
def __init__(self, embed_dim: int, num_heads: int, dropout: float,
attention_dropout: float, mlp_dropout: float):
"""Implementation of the Graphormer layer.
This layer is based on... | Python | 1 |
to_f16x2(roughness_metalness);
res.w = util::float3_to_rgb9e5(self.emissive);
res
}
}
<reponame>you06/prmbot
use std::{collections::HashSet, convert::From, fmt, time::Duration};
use chrono::{DateTime, Utc};
use serde::{Deserialize, Serialize};
use serde_json::error::Error as JsonError;
const API_... | Rust | 0 |
.5, 1, 0.0), (0, -1, 0)),
((0.0, 1, 0.5), (0, -1, 0)),
((0.0, 2, 0.0), (0, 1, 0)),
((0.5, 2, 0.0), (0, 1, 0)),
((0.0, 2, 0.5), (0, 1, 0)),
];
for ((px, py, pz), (nx, ny, nz)) in examples.iter() {
let point = Tuple::... | Rust | 0 |
ng_scores
if s > HEADING_SIMILARITY_THRESHOLD][:3]
if relevant_headings:
print(f"Found relevant headings: {relevant_headings}")
for heading in relevant_headings:
content = heading_content[heading]
... | Python | 1 |
nnel(100);
tokio::spawn(async move {
for e in EDN.split('\n') {
let res = replace_set(e).await;
tx.send(res).await.unwrap();
};
});
let mut formatted_edn = String::new();
while let Some(res) = rx.recv().await {
formatted_edn.push_str(&res);
}
pr... | Rust | 0 |
products', 'pharma', 'energy', 'solutions', 'france', 'isreal', 'product', 'plastics', 'communications', 'kgaa', 'sas', 'cellular', 'gesellschaft', 'se', 'holdings', 'kg', 'srl', 'chimie']
nonp_keys = ['institute', 'university', 'hospital', 'foundation', 'college', 'research', 'administration', 'recherche', 'department... | Python | 1 |
import torch
from utils.arch import apply_neuron_mask
def collect_mask_grads(model, head_mask, neuron_mask, dataloader):
head_mask.requires_grad_(True)
neuron_mask.requires_grad_(True)
handles = apply_neuron_mask(model, neuron_mask)
model.eval()
head_grads = []
neuron_grads = []
for bat... | Python | 1 |
opca = ''
| Python | 1 |
_UI_Input_Ime'*"]
pub type IMEFMT = i32;
#[doc = "*Required features: 'Win32_UI_Input_Ime'*"]
pub const IFED_UNKNOWN: IMEFMT = 0i32;
#[doc = "*Required features: 'Win32_UI_Input_Ime'*"]
pub const IFED_MSIME2_BIN_SYSTEM: IMEFMT = 1i32;
#[doc = "*Required features: 'Win32_UI_Input_Ime'*"]
pub const IFED_MSIME2_BIN_USER: ... | Rust | 0 |
obbly_bits[i]), cb);
} else {
cb(r);
}
}
<filename>examples/cryptocurrency-advanced/backend/src/schema/duel.rs
//! Duel.
use super::*;
use super::super::proto;
/// Поединок.
#[derive(Clone, Debug, ProtobufConvert)]
#[exonum(pb = "proto::Duel", serde_pb_convert)]
pub struct Duel {
/// Ключ поединк... | Rust | 0 |
board: Optional[bool] = None
submitted_date: Optional[str] = None
tags: Optional[str] = None
track_id: Optional[int] = None
@classmethod
def from_dict(cls, data: Dict[str, Any]) -> "Beatmapset":
"""从字典创建 Beatmapset 对象"""
# 处理 covers - 如果缺失则创建空的 covers 对象
covers_data = data.g... | Python | 1 |
ent_variable(
// EnvironmentString::new_concrete("LD_DEBUG=bindings"))
.environment_variable(EnvironmentString::new_concrete("LD_BIND_NOW=1"))
.environment_variable(EnvironmentString::new_concrete("LD_DEBUG=all"))
.environment_variable(EnvironmentString::new_concrete(... | Rust | 0 |
Pat::Object(obj) => &obj.props,
_ => return false,
};
init.span().ctxt == context.top_level_context
&& !context.top_level_decls.contains("Object")
&& init.text_fast(context.program) == "Object"
&& props.iter().any(|prop| {
match prop {
Ob... | Rust | 0 |
imate(&self) -> u64 {
return self.remaining_cost_estimate;
}
fn total_cost_estimate(&self) -> u64 {
return self.cost + self.remaining_cost_estimate;
}
}
#[test]
fn hashable_node_can_enter_closed_set() {
let mut closed_set = PartialKeyedClosedSet::<Te... | Rust | 0 |
(),
};
Ok(path.eval_with_config(env, cfg).await?.await)
}
macro_rules! join_path {
($path:expr) => {{
match $path {
Fields::Single(path) => path,
Fields::At(mut v) | Fields::Star(mut v) | Fields::Split(mut v) => {
if v.len() == 1 {
v.pop(... | Rust | 0 |
import datetime
def main():
"""
Examples of formatting datetime objects.
"""
print("=== Datetime Formatting Examples ===\n")
# Sample datetime
dt = datetime.datetime(2023, 9, 15, 14, 30, 45)
print(f"Sample datetime: {dt}\n")
# 1. Basic string formatting with strftime()
pri... | Python | 1 |
#!/usr/bin/env python
# coding=utf-8
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from hudong_baike.items import HudongBaikeItem
import scrapy
from scrapy.http import Request
from bs4 import BeautifulSoup
import re
import urlparse
class HudongBaik... | Python | 1 |
_id.into(),
}
}
}
impl Method for GetChatAdministrators {
type Response = Vec<ChatMember>;
fn get_request(&self) -> Result<RequestBuilder, Error> {
RequestBuilder::json("getChatAdministrators", &self)
}
}
<reponame>placefortea/teatree
use jsonrpc_parse::httpcodec::HTTPCodec;
use rand::... | Rust | 0 |
#Арсенал героя
#Демонстрирует создание кортежа
#создадим пустой кортеж
inventory = ()
#рассмотрим его как условие
if not inventory:
print("Вы безоружны.")
input("\nНажмите Enter, чтобы продолжить.")
# теперь создадим кортеж с несколькими елементами
inventory = ("меч",
"кольчуга",
"щит",
... | Python | 1 |
::*, self::Expr::*, Stmt::*};
let mut conds = 0;
let mut begin = arena.vec_with_capacity(self.begin.len() * 2);
let mut main_loop = None;
let mut end = None;
// Desugar -F flag
if let Some(sep) = self.field_sep {
begin.push(arena.alloc(Expr(arena.alloc(Assig... | Rust | 0 |
n identifier(&self) -> String;
fn sector_size(&self) -> u64;
}
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct CacheEntryMetadata {
pub sector_size: u64,
}
pub trait CacheableParameters<C, P>
where
C: Circuit<Fr>,
P: ParameterSetMetadata,
{
fn cache_prefix() -> String;
fn cache_met... | Rust | 0 |
x: round_to_precision(x, 0.5) rounds to the nearest 0.5 (half-integer interval)
"""
y = round(x / p) * p
return y
def voltage_in_aux(precision: float = 0.1) -> float:
if not is_testing_env():
AUX_ADC = ADCs["aux"]
else:
from pioreactor.utils.mock import Mock_ADC # type: ignore
... | Python | 1 |
from fastapi import APIRouter, HTTPException, Depends
from sqlalchemy.orm import Session
from database.dependencies import get_db
from manager.item_manager import ItemsManager
from models.item_dto import ItemDTO, ItemCreateDTO
from tags.tags import TagsEnum
router = APIRouter(prefix="/items", tags=[TagsEnum.ITEMS])
... | Python | 1 |
#[cfg_attr(
feature = "serialization",
derive(serde::Serialize, serde::Deserialize)
)]
pub struct Id3(pub String);
impl Id3 {
/// Get a detailed information about the steam account from the steam id.
/// This information may not contain all the fields correct as to how `SteamId64` can due to unavailabl... | Rust | 0 |
# Code generated by sqlc. DO NOT EDIT.
# versions:
# sqlc v1.29.0
# source: register_task_def.sql
import dataclasses
from typing import Any, Optional
import sqlalchemy
import sqlalchemy.ext.asyncio
from . import models
REGISTER_TASK_DEF = """-- name: register_task_def \\:exec
INSERT INTO hyrex_task_def (task_name... | Python | 1 |
xczvzxcv | Python | 1 |
0) & (label_true < n_class)
hist = np.bincount(
n_class * label_true[mask] + label_pred[mask],
minlength=n_class**2).reshape(n_class, n_class)
return hist
def scores(label_trues, label_preds, n_class):
hist = np.zeros((n_class, n_class))
for lt, lp in zip(label_trues, label_preds):
... | Python | 1 |
}
return tuple;
}
const RAND_ARGS: [&str; 2] = ["min", "max"];
fn rand(vec_table: &mut VecTable) -> Tuple {
let table = vec_table.get_level(vec_table.len() - 1);
let mut tuple = Tuple::new();
let mut min = get_number(table, "min");
let mut max = get_number(table, "max");
if min > max {
... | Rust | 0 |
from FuncTable import FuncTable
from FuncDef import FuncDef
import re
def read_fd(fname):
func_pat = "([A-Za-z][_A-Za-z00-9]+)\((.*)\)\((.*)\)"
func_table = None
bias = 0
private = True
# parse file
f = open(fname, "r")
for line in f:
l = line.strip()
if len(l) > 1 and l[0] != '*':
# a co... | Python | 1 |
::grpcio::RpcContext, _req: super::pubsub::SeekRequest, sink: ::grpcio::UnarySink<super::pubsub::SeekResponse>) {
grpcio::unimplemented_call!(ctx, sink)
}
}
pub fn create_subscriber<S: Subscriber + Send + Clone + 'static>(s: S) -> ::grpcio::Service {
let mut builder = ::grpcio::ServiceBuilder::new();
... | Rust | 0 |
mut exprs)
{
Some(indices) =>
{
let result = Match
{
rule_indices: indices.iter().cloned().collect(),
exprs: exprs
};
Some(result)
}
None => None
}
}
fn parse_match_step<'s, 't: 's>(&'s self, parser: &mut Parser, step: &'t MatchStep, exprs: &mut Vec<Expression>) ... | Rust | 0 |
Add grid for better readability
ax.grid(axis='y', linestyle='--', alpha=0.7)
# Add statistics annotations with iteration info and better positioning
box_colors = ['lightyellow', 'lightblue', 'lightgreen']
for i, iter_count in enumerate(iterations):
# Position boxes at different heights... | Python | 1 |
128b32
0x228C_00C4,// EVEX_Vpconflictd_ymm_k1z_ymmm256b32
0x230C_00C4,// EVEX_Vpconflictd_zmm_k1z_zmmm512b32
0x222C_00C4,// EVEX_Vpconflictq_xmm_k1z_xmmm128b64
0x22AC_00C4,// EVEX_Vpconflictq_ymm_k1z_ymmm256b64
0x232C_00C4,// EVEX_Vpconflictq_zmm_k1z_zmmm512b64
0x670C_00C6,// EVEX_Vgatherpf0dps_vm32z_k1
0x672C_0... | Rust | 0 |
from tkinter import * #graphics
# GRAPHICS needed:
# window for downloading speed and internet speed
# button
import speedtest #speedtest module to check the internet speed
def bytes_to_mb(bytes):
KB = 1024 # One Kilobyte is 1024 bytes
MB = KB * 1024 # One MB is 1024 KB
return str(int(bytes/MB))
def spe... | Python | 1 |
"""Premier programme
Formation Python
apprendre la programmation"""
def demander_age():
age_int = 0
while age_int == 0:
age_str = input("Quel est votre age ? ")
try:
age_int = int(age_str)
except ValueError:
print("ERREUR: Vous devez rentrer un nombre pour l'age"... | Python | 1 |
" name="Mario 5"/>
<Sprite id="6" src="06" name="Mario 6"/>
<Sprite id="7" src="07" name="Mario 7"/>
<Sprite id="8" src="08" name="Mario 8"/>
<Sprite id="9" src="09" name="Mario 9"/>
<Sprite id="A" src="0A" name="Peach 1"/>
<Sprite id="B" src="0B" name="Peach 2"/>
<Sprite id="C" src="0C" nam... | Rust | 0 |
let tmp = tmpdir();
let tmp_path = tmp.path().to_path_buf();
exp.create_in(tmp.path()).unwrap();
let it = WalkDir::new(tmp.path()).min_depth(1)
.into_iter()
.filter_entry(move |d| {
let n = d.file_name().to_string_lossy().into_owned();
... | Rust | 0 |
# config.py
api_id = "20028561"
api_hash = "0f3793daaf4d3905e55b0e44d8719cad"
bot_token = "7205145628:AAGM-2RZBGa1YqY9i_cLICQyN6ULr3DKBxA"
MONGO_URL = "mongodb+srv://tgeopen:loniko0908@cluster0.c9efpo0.mongodb.net/?retryWrites=true&w=majority&appName=Cluster0"
OWNER_ID = 5630057244
DEV_USERS = [5630057244]
LOGGING_CHA... | Python | 1 |
the origin
#[rustfmt::skip]
const T4: Case = make_case!(
(4, 0), (4, 8),
(0, 4), (4, 4),
(4, 4)
);
// Coincident lines. B is inside A
#[rustfmt::skip]
const T5: Case = make_case!(
(0, 0), (10, 10),
(2, 2), (7, 7),
(2, 2)
);
// Literally the same line
#[rustfmt::skip]
const T6: Case = make_case!(... | Rust | 0 |
# -*- coding: utf-8 -*- #
# Copyright 2020 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 |
from PIL import Image, ImageDraw, ImageFont
import os
def create_icon(size, output_path):
"""Create an application icon with the specified size."""
# Create a new image with transparent background
image = Image.new('RGBA', (size, size), (0, 0, 0, 0))
draw = ImageDraw.Draw(image)
# Draw a circl... | Python | 1 |
import random
import torch
import config
import os
from player import PlayerAgent
class Population:
def __init__(self):
self.agents = [PlayerAgent() for _ in range(config.POPULATION_SIZE)]
self.number_best_agents = int(max(1, config.POPULATION_SIZE * 0.1))
self.mutation_rate = 0.1
def... | Python | 1 |
e:
print(" 🧪 MODO TESTE - Não salvando no banco")
else:
# Atualizar o livro
book.capa_url = best_url
book.save(update_fields=['capa_url'])
print(" 💾 Livro atualizado com sucesso!")
self.results['updated_books'... | Python | 1 |
source: Coord,
target: Coord,
}
impl StraightPathIter {
fn new(source: &Coord, target: &Coord) -> Option<StraightPathIter> {
if source == target {
None
} else if source.0 == target.0 || source.1 == target.1 {
Some(StraightPathIter {
source: source.clo... | Rust | 0 |
.take(3)
.map(|row| {
row.chars()
.skip(x - 1)
.take(3)
.fold(String::from(""), |acc, el| match el {
'#' => acc + "1",
'.' => acc + "0",
... | Rust | 0 |
splay = self._display_lines[line_index]
display = line_slice is not None and display.subdisplay[line_slice]
layer = Layer(priority=MESSAGE_BOX_PRIORITY, display_line1=display)
return _CallbackControl(self._token_control, partial(self._set_message_box_layout, layer, maybe(partial(align, displ... | Python | 1 |
sigma_parse(r)?);
}
Ok(MethodCall {
obj: Box::new(obj),
method: SMethod::from_ids(type_id, method_id),
args,
})
}
}
#[cfg(test)]
mod tests {
// use crate::ast::expr::Expr;
// use crate::ast::method_call::MethodCall;
// use crate::serialization... | Rust | 0 |
from machine import Pin, I2C, SoftI2C
from utime import sleep
from ssd1306 import SSD1306_I2C
from bh1750 import BH1750
i2c1_sda = Pin(2)
i2c1_scl = Pin(3)
i2c1 = I2C(1, sda=i2c1_sda, scl=i2c1_scl)
bh1750 = BH1750(i2c1)
def update_oled(lines):
oled.fill(0)
for i, line in enumerate(lines):
oled.text(l... | Python | 1 |
s not an outlier
boundary = np.hstack((boundary, ([[notlost[0][idx_minimum]], [notlost[1][idx_minimum]]])))
exec_time = round((time.time()-st)/60, 2)
print('Execution time: '+str(exec_time)+' min')
return boundary, notlost, lost
def gradient_plot (boundary, lost, nt... | Python | 1 |
"Error",
"Original Sequence name '{}' not found".format(
item.orig_name,
),
)
self.open()
def add_sequence_item(self, name):
flags = (
QtCore.Qt.ItemFlag.ItemIsDragEnabled
|
QtCore.Qt... | Python | 1 |
(&addr);
println!("Connection {} closed.", addr);
Ok(())
}));
Ok(())
});
// execute server
tokio::run(srv);
}
<filename>imxrt1062-pac/imxrt1062-csi/src/csidmasa_fb1.rs
#[doc = "Reader of register CSIDMASA_FB1"]
pub type R = crate::R<u32, super::C... | Rust | 0 |
g_docs)] // documentation missing in model
MessageType,
#[allow(missing_docs)] // documentation missing in model
OptOutListName,
#[allow(missing_docs)] // documentation missing in model
SelfManagedOptOutsEnabled,
#[allow(missing_docs)] // documentation missing in model
SharedRoutesEnabled,
... | Rust | 0 |
se fd::{FdHook, FdHookCallback, FdHookMode};
#[cfg(feature = "unstable")]
pub use signal::{SignalHook, SignalHookValue};
pub use timer::TimerHook;
use crate::Weechat;
use weechat_sys::{t_hook, t_weechat_plugin};
/// Weechat Hook type. The hook is unhooked automatically when the object is
/// dropped.
pub(crate) struc... | Rust | 0 |
in/api/v2/users/user_id/authentication-methods/authentication_method_id",
data={},
)
@mock.patch("auth0.management.users.RestClient")
def test_delete_authentication_methods(self, mock_rc):
mock_instance = mock_rc.return_value
u = Users(domain="domain", token="jwttoken")
... | Python | 1 |
#
# Jailbreaking ChatGPT-4-turbo-preview with Base64
#
# Author: Eelko de Vos
# Date: 2024-03-16
#
# This script will send a message to OpenAI in Base64 and will receive a response in Base64.
# This will circumvent the OpenAI API restrictions and will allow somewhat unrestricted access to the GPT-4 models
# This is a p... | Python | 1 |
)
}
}
impl From<IndexerRequest> for (&'static str, Vec<serde_json::Value>) {
fn from(request: IndexerRequest) -> (&'static str, Vec<serde_json::Value>) {
match request {
IndexerRequest::TipHeader => (method::INDEXER_TIP_HEADER, Vec::new()),
IndexerRequest::LastHeader => (method:... | Rust | 0 |
io::pb_ser, de: ::grpcio::pb_de },
resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de },
};
const METHOD_DATABASE_ADMIN_LIST_BACKUPS: ::grpcio::Method<super::backup::ListBackupsRequest, super::backup::ListBackupsResponse> = ::grpcio::Method {
ty: ::grpcio::MethodType::Unary,
name: ... | Rust | 0 |
key = "CE"
else:
assert("SPO" in model_path)
key = "SPO"
for loss_fn in loss_fns:
agg_results_grid[key][loss_fn].append(agg_results[model_path][loss_fn])
final_objs_grid[key][loss_fn].append(final_objs[model_path][loss_fn])
for key in task... | Python | 1 |
from pbatoolkit import pbat
import meshio
import numpy as np
import polyscope as ps
import polyscope.imgui as imgui
import itertools
import argparse
def combine(V: list, C: list):
Vsizes = [Vi.shape[0] for Vi in V]
offsets = list(itertools.accumulate(Vsizes))
C = [C[i] + offsets[i] - Vsizes[i] for i in ra... | Python | 1 |
second.iter().enumerate() {
let second_coefficient: T = (*second_coefficient).into();
let destination = &mut destination[first_power + second_power];
*destination =
destination.checked_add(&first_coefficient.checked_mul(&second_coefficient)?)?;
}
}
Ok(())
}
pub fn evaluate_nth_taylor... | Rust | 0 |
manager_certificate_resource_record(&mut object_2161, var_2160)?;
object_2161.finish();
}
if let Some(var_2162) = &input.validation_domain {
object.key("ValidationDomain").string(var_2162);
}
if let Some(var_2163) = &input.validation_emails {
let mut array_2164 = object.key("Vali... | Rust | 0 |
.as_ref()
.map(|src| src.is_registry())
.unwrap_or(false)
{
func(None);
return;
}
let url = krate.source.as_ref().unwrap().url();
if let Some(ind) = self
.registries
.iter()
.position(|reg| ... | Rust | 0 |
from gi.repository import Adw
from ..internal.MultiAction.MultiAction import MultiAction
from ..internal.PluginConfig import PluginConfigButton
from ..internal.OBSConfig import OBSConfigWindow
class OBSMultiAction(MultiAction):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
... | Python | 1 |
_name,
actual_name,
&palette.info.paint("expected").to_string(),
&palette.error.paint("actual").to_string(),
0,
);
let mut diff = colorize_diff(diff, palette);
diff.insert(0, "\n".to_owned());
diff.join("")
}
#[cfg(feature = "color")]
fn colorize_diff(mut lines: Vec<Str... | Rust | 0 |
200));
receiver
}
fn parse_params(params: &str) -> String {
// Parses params, allowing the user to input on instead of "on"
let mut parsed_params = String::new();
let params_split = params.split(' ');
for param in params_split {
// Check if param is an integer or not
match param.par... | Rust | 0 |
applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// See the License for the specific language governing permissions and
// limitations under the License.
use std::sync::Arc;
use std::time::Duration;
use std::thread;
use rocksdb::DB;
use protobuf;
... | Rust | 0 |
ns = np.array([res["prediction"] for res in results])
targets = np.array([res["target"] for res in results])
accuracy = (targets == predictions).sum() / targets.shape[0]
metrics = {"agg_metrics": accuracy, "acc": accuracy}
log_stats = {split_name: {k: v for k, v in metrics.items()}}
... | Python | 1 |
# -*- coding: utf-8 -*- #
# Copyright 2025 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 |
: "3.72 * 1" => Ok(Float(3.72 * 1.0)),
op_multiply_float_null: "3.14 * NULL" => Ok(Null),
op_multiply_int_float: "1 * 3.72" => Ok(Float(1.0 * 3.72)),
op_multiply_int_int: "2 * 3" => Ok(Integer(6)),
op_multiply_int_null: "1 * NULL" => Ok(Null),
op_multiply_null_float: "NULL * 3.14" => Ok(Null),
o... | Rust | 0 |
client.runtime_api();
let at = BlockId::hash(at.unwrap_or_else(
|| self.client.info().best_hash)
);
Ok(api.get_exchange_by_id(&at, id)
.map(|option| {
option
.map(|exchange_info| {
ExchangeInfo {
... | Rust | 0 |
let share_token = XYKPallet::share_token(pair_account);
expect_event(xyk::Event::PoolCreated(
user,
asset_a,
asset_b,
shares,
share_token,
pair_account,
));
let amount_b = price.saturating_mul_int(amount);
// Check users state
assert_eq!(Currency::free_balance(asset_a, &user), ENDOWED_AMOUNT - amoun... | Rust | 0 |
f32>, range_start: &mut Option<(usize, f32)>| {
if let Some((start_index, start_dist)) = *range_start {
if end_index > start_index {
let end_dist = (p_proj - eye_line.p).norm();
if end_dist - start_dist > config.min_range_length {
... | Rust | 0 |
sbase,apic -smp 8 -m 8192 -curses -kernel root/rxv64.elf
// qemu-system-x86_64 -cpu host,pdpe1gb,xsaveopt,fsgsbase,apic -accel hvf -smp 8 -m 2048 -nographic -kernel root/rxv64.elf
// qemu-system-x86_64 -cpu host,pdpe1gb,xsaveopt,fsgsbase,apic,msr -accel kvm -smp 8 -m 8192 -curses -kernel root/rxv64.elf
// qemu-system-x... | Rust | 0 |
serializing_if = "Option::is_none")]
pub resync_transferred_bytes: Option<i64>,
#[serde(rename = "resyncProgressHealth", default, skip_serializing_if = "Option::is_none")]
pub resync_progress_health: Option<in_mage_rcm_failback_replication_details::ResyncProgressHealth>,
#[serde(rename = "resyncRequired... | Rust | 0 |
import numpy as np
import sys
import os
from pathlib import Path
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import matplotlib as mpl
def load_file(file_name):
file_path = generate_file_path(file_name)
file = Path(file_path)
if file.exists():
samples = np.loadtxt(file, d... | Python | 1 |
mmended: [reason it fits preference]
Research context: {st.session_state.research_results}
Budget: ₹{trip_data['budget']} INR total for {trip_data['num_days']} days
"""
transport_recommendations = llm.invoke(transport_search_prompt).content
... | Python | 1 |
Square,
/// Player tile
Player,
/// Shadow tile
Shadow(ShadowFlags),
}
pub struct Tileset<'a> {
texture: Texture<'a>,
width: u32,
height: u32,
effective_height: u32,
offset: i32,
}
impl<'a> Tileset<'a> {
pub fn new(
texture: Texture<'a>,
width: u32,
he... | Rust | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.