text string | label_name string | labels int64 |
|---|---|---|
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = "ipetrash"
from playwright.sync_api import sync_playwright
with sync_playwright() as p:
for browser_type in [p.chromium, p.firefox, p.webkit]:
browser = browser_type.launch()
page = browser.new_page()
print(browser_type.name.u... | Python | 1 |
alculate the posterior belief of three type of nodes
:return: u_post: users posterior beliefs, p_post: products posterior beliefs,
r_post: reviews posterior beliefs.
"""
u_post = {}
p_post = {}
r_post = {}
pu_post = self.res_pu_spam_post_vector
no_prod = len(self.p_priors)
# extract the posterior beli... | Python | 1 |
ss,
vec!["pathname", "mode"],
vec![AV::CString(In), AV::AccessMode(In)],
AV::Int(Out),
);
inp.add(
Ident::Getcwd,
vec!["buf", "size"],
vec![AV::CString(Out), AV::Int(In)],
AV::Int(Out),
);
inp.add(Ident::Close, vec!["fd"], vec![AV::Int(In)], AV::... | Rust | 0 |
outgoing.push(CMD_INDICATOR);
outgoing.extend_from_slice(data);
}
OutgoingPacket::Acl(data) => {
outgoing.push(ACL_INDICATOR);
outgoing.extend_from_slice(data);
}
}
}
#[cfg(test)]
mod tests {
use super::*;
use std::iter::FromIterator;
... | Rust | 0 |
pub enum Error<T> {
/// kittyId错误
InvalidKittyId,
/// 性别相同
SameGender,
/// 不是Kitty的主任
NotOwner,
/// 不可出售状态
NotForSale,
/// 出售中,不可赠送
NotForTransfer,
/// 价格太低
PriceTooLow,
/// 无需购买自己的Kitty
BuyFromSelf,
... | Rust | 0 |
import hypothesis.strategies as st
from .base import (
BaseTest,
commands,
values,
keys,
common_commands,
counts,
zero_or_more,
ints,
expires_seconds,
expires_ms,
)
from .test_string import TestString
class TestTransaction(BaseTest):
transaction_commands = (
comman... | Python | 1 |
let ck = self.ck.take();
self.vault.secret_destroy(ck.unwrap()).await?;
self.ck = Some(hkdf_output.pop().unwrap());
Ok(())
}
}
<filename>src/materialiconsround/image/icon_motion_photos_pause.rs<gh_stars>0
pub struct IconMotionPhotosPause {
props: crate::Props,
}
impl yew::Compo... | Rust | 0 |
'1960',
'0.6167005703199'],
['Arab World',
'ARB',
'Hospital beds (per 1,000 people)',
'SH.MED.BEDS.ZS',
'1960',
'1.9296220724398703'],
['Arab World',
'ARB',
'International migrant sto... | Python | 1 |
_operation_reset_db_parameter_group(
input: &crate::input::ResetDbParameterGroupInput,
) -> Result<aws_smithy_http::body::SdkBody, aws_smithy_http::operation::SerializationError> {
let mut out = String::new();
#[allow(unused_mut)]
let mut writer =
aws_smithy_query::QueryWriter::new(&mut out, "Re... | Rust | 0 |
::num::NonZeroI32,
#[field(default = 3.0)]
float: f64,
#[field(default = "wow")]
str_ref: &'a str,
#[field(default = "wowie")]
string: String,
#[field(default = [192u8, 168, 1, 0])]
ip: IpAddr,
#[field(default = ([192u8, 168, 1, 0], 20))]
a... | Rust | 0 |
hes: MapxOrd<BlockHeight, H256>,
// Oneshot values for each evm transaction.
pub vicinity: OvrVicinity,
}
impl State {
pub fn call_contract(
&self,
branch_name: BranchName,
req: CallRequest,
bn: Option<BlockNumber>,
) -> Result<CallContractResp> {
let caller = r... | Rust | 0 |
import pandas as pd
import re
# define input and output of the program
input_file = "zurich.xlsx" # Change this to the city you want to process, can be the raw .xlsx file
output_file = "zurich_cleaned.csv" # Change to what the output should be (needs to be csv file)
# Read file
df = pd.read_excel(input_file)
# Pr... | Python | 1 |
"eagerload",
"eagerload_all",
"EXT_CONTINUE",
"EXT_SKIP",
"EXT_STOP",
"foreign",
"immediateload",
"join",
"joinedload",
"joinedload_all",
"lazyload",
"lazyload_all",
"Load",
"load_only",
"make_transient",
"make_transient_to_detached",
"Mapper",
"map... | Python | 1 |
_ap:
num_gt_instances = np.sum(self.num_gt_instances_per_class)
precision, recall = compute_precision_recall(all_scores, all_tp_fp_labels, num_gt_instances)
recall_within_bound_indices = [
index for index, value in enumerate(recall) if
value >= self.re... | Python | 1 |
"""Add use_gov_uk_search_api, enable_web_browsing properties
Revision ID: a4abacd8cee5
Revises: e357a42a4565
Create Date: 2025-01-27 12:15:16.305017
"""
from typing import Sequence, Union
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision: str = "a4abacd8cee5"
down_rev... | Python | 1 |
# do we do a comparison?
if comp_bench:
compare_file = f"{bench_dir}/{bench}"
msg.warning("comparing to: %s " % (compare_file))
bench = io.read(compare_file)
result = compare.compare(my_data, bench, rtol)
if result == 0:
msg.success(f"results match benchmar... | Python | 1 |
bycsfo-mkxni-oxqsxoobsxq-198[oxbsm]
kyelcrga-zsllw-kypicrgle-730[nvjmt]
rdggdhxkt-uadltg-stktadebtci-713[btson]
dpssptjwf-qmbtujd-hsbtt-usbjojoh-623[miqos]
tcfkqcevkxg-dcumgv-vgejpqnqia-336[cgqve]
fodvvlilhg-gbh-orjlvwlfv-699[eykml]
bxaxipgn-vgpst-eaphixr-vgphh-ejgrwphxcv-817[rsizj]
pualyuhapvuhs-ibuuf-jvuahputlua-305[... | Rust | 0 |
import importlib
import os
import sys
import hf_transfer
from loguru import logger
os.environ["HF_HUB_ENABLE_HF_TRANSFER"] = "1"
logger.remove()
logger.add(sys.stdout, level="WARNING")
AVAILABLE_MODELS = {
"auroracap": "AuroraCap",
"batch_gpt4": "BatchGPT4",
"claude": "Claude",
"cogvlm2": "CogVLM2",... | Python | 1 |
(path);
}
}
pub fn path_to_mime(path: &str) -> Option<&'static str>{
let extension = path::Path::new(path).extension().map(|x| x.to_str().unwrap()).unwrap_or("");
let mime = match extension {
"wbg" => "application/x-ccp-wbg",
"red" => "application/x-ccp-red",
"obj" => "application/x-wavefront-obj",
... | Rust | 0 |
doc = "Bit 1 - NACK received after sending the address (write '1' to clear)"]
#[inline]
pub fn anack(&mut self) -> _ANACKW {
_ANACKW { w: self }
}
#[doc = "Bit 2 - NACK received after sending a data byte (write '1' to clear)"]
#[inline]
pub fn dnack(&mut self) -> _DNACKW {
_DNACK... | Rust | 0 |
def section_exit( self, section ):
pass
def section_dump( self, section, section_filename = None ):
output = None
if section_filename:
output = open_output( section_filename )
self.section_enter( section )
for name in section.block_names:
skip_e... | Python | 1 |
= &mut pgss[idx];
make_game_state_view(cgs, &gs, idx);
let mv = bots[idx].do_move(cgs);
moves.push(mv);
step(gs.borrow_mut(), idx, mv);
}
if moves.iter().all(|m| *m == Move::Stop) {
progressing = false;
}
}
gs
}
<reponame>otreb... | Rust | 0 |
GL_DEPTH_COMPONENT16)
pub const GL_DEPTH_COMPONENT16 : i32 = 33189;
/// public static final [GL_DEPTH_COMPONENT24](https://developer.android.com/reference/javax/microedition/khronos/opengles/GL11ExtensionPack.html#GL_DEPTH_COMPONENT24)
pub const GL_DEPTH_COMPONENT24 : i32 = 33190;
/// ... | Rust | 0 |
new(&mut web_browser.1, &WebBrowser::ALL[..], Some(web_browser.2), DefaultAppMsg::WebBrowserChanged).width(Length::Fill).style(CustomSelect::Default)).width(Length::Fill))
.push(Button::new(&mut web_browser.3, Text::new(" Search ")).on_press(DefaultAppMsg::BtnSearchClicked).style(CustomButton::Default));
... | Rust | 0 |
ne, child_doc=None, merge_within_sections=False):
""" Merge two numpy-style docstrings into a single docstring, according to napoleon docstring sections.
Given the numpy-style docstrings from a parent and child's attributes, merge the docstring
sections such that the child's section is used, wherever prese... | Python | 1 |
pub unsafe fn bits(self, value: u32) -> &'a mut W {
self.w.bits = (self.w.bits & !0xffff_ffff) | ((value as u32) & 0xffff_ffff);
self.w
}
}
impl R {
#[doc = "Bits 0:31"]
#[inline(always)]
pub fn send_q2_word0(&self) -> SEND_Q2_WORD0_R {
SEND_Q2_WORD0_R::new((self.bits & 0xff... | Rust | 0 |
name = _create_ha_id(
name=device.NAME, channel=channel, param=param, count=len(channels)
)
unique_id = _create_ha_id(
name=key, channel=channel, param=param, count=len(channels)
)
device_dict = {
... | Python | 1 |
)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl core::ops::DerefMut for W {
#[inline(always)]
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.0
}
}
impl core::convert::From<crate::W<ADC14CTL1_SPEC>> for W {
fn from(writer: crate::W<ADC14CTL1_SPEC>) -> Self {
... | Rust | 0 |
(ctx: &Ctx, boids: &Boids) {
for predator in &boids.predators {
ctx.begin_path();
ctx.set_stroke_style(&JsValue::from_str(PREDATOR_RADIUS_COLOR));
let angst_radius = boids.angst_radius_squared.sqrt();
ctx.arc(
predator.x,
predator.y,
angst_radius,
... | Rust | 0 |
let inner_result = {
if RPCCodedResponse::<TSpec>::is_response(response_code) {
// decode an actual response and mutates the buffer if enough bytes have been read
// returning the result.
self.inner
.decode(src)
.map(|r|... | Rust | 0 |
macro_rules! handle_state {
([ $key_pos:expr, $key_neg:expr, $var:ident, $val:expr ]; $($tt:tt)*) => {
handle_state!([$key_pos, $key_neg, $var = $val, $var = - $val]; $($tt)*);
};
([ $key_pos:expr, $key_neg:expr, $pos_do:expr, $neg_do:expr ]; $($tt:tt)*) => {
... | Rust | 0 |
eNS")
print(rateS)
print(rateNS)
moniNsRateDict[sample].append(rateNS)
moniSRateDict[sample].append(rateS)
moniNORateDict[sample].ap... | Python | 1 |
}, tile_bounds),
clip_tiles: match clip_path_id {
Some(_) => {
Some(DenseTileMap::from_builder(|_| {
Clip {
dest_tile_id: AlphaTileId(!0),
... | Rust | 0 |
all_docs,
# lambda doc: doc.page_content,
# ),
# reverse=True,
# key=lambda doc: rrf_score[doc.page_content],
# )
# # Docs are deduplicated by their contents then sorted by their scores
# # all_docs = chain.from_iterable(doc_lists)
# # sorted_docs... | Python | 1 |
: TempDir,
phantom: PhantomData<T>,
}
impl<T> ExtSorter<T>
where
T: Sortable<BufWriter<File>, BufReader<File>>,
T::Error: From<io::Error>,
{
/// Create an `ExtSorter` to sort your data.
///
/// It will buffer `buffer_n_items` items in memory and sort them, and then write them serialized
/// into temp... | Rust | 0 |
import torch
import numpy as np
def discount_rewards(rewards, gamma):
discounted_rewards = torch.empty_like(rewards, dtype=torch.float32)
R = 0
for t in reversed(range(0, len(rewards))):
R = R * gamma + rewards[t]
discounted_rewards[t] = R * (gamma**t)
return discounted_rewards
def dis... | Python | 1 |
import torch
import torchsort
def pearson(tensor: torch.Tensor):
"""
Compute pairwise correlation between columns of a 2D tensor.
Args:
tensor (torch.Tensor): A 2D tensor of shape (n_samples, n_features).
Returns:
torch.Tensor: A 2D tensor of shape (n_features, n_features) representi... | Python | 1 |
>,
{
self.bin_oper(BinOper::SmallerThan, SimpleExpr::Value(v.into()))
}
/// Express a less than or equal (`<=`) expression.
///
/// # Examples
///
/// ```
/// use sea_query::{*, tests_cfg::*};
///
/// let query = Query::select()
/// .columns(vec![Char::Character,... | Rust | 0 |
to store `ValidationErrors` within the scope of the request
#[derive(Clone)]
pub struct CachedValidationErrors(pub Option<ValidationErrors>);
/// Implementation of `Validated` for `Json`
//
/// An example with `Json`
/// ```rust
/// # #[macro_use] extern crate rocket;
/// use rocket::serde::{json::Json, Deserial... | Rust | 0 |
num1 = float(input("Digite o primeiro número: "))
num2 = float(input("Digite o segundo número: "))
soma = num1 + num2
print("A soma é", soma)
| Python | 1 |
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 to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, ... | Rust | 0 |
fn is_3(&self) -> bool {
**self == SAINC_A::_3
}
}
impl core::ops::Deref for SAINC_R {
type Target = crate::FieldReader<u8, SAINC_A>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `SAINC` writer - Source Address Increment\nThis field is used to set ... | Rust | 0 |
it matches.
if name_string.len() == variable_name.len() {
// We can now assume they match and keep going until they don't.
match_priority = Some(Self::MATCH_PRIORITY_EXACT);
// Grab the characters and start walking them...
let mut left_chars = name_string.chars();
let mut... | Rust | 0 |
import pandas as pd
import matplotlib.pyplot as plt
# Se les pregunta a los empleados de un restaurante de lujo que día de la semana prefieren tomarse libre,
# sabiendo que deben trabajar todos los domingos. Los resultados de las respuestas son los siguientes:
dias = ['L', 'S', 'S', 'S', 'M', 'MI', 'J', 'J', 'L', 'V',... | Python | 1 |
"""
Copyright (c) Cutleast
"""
from dataclasses import dataclass
from io import BufferedReader
from .datatypes import Flags, Integer, String
@dataclass
class Header:
"""
Class for archive header.
"""
data_stream: BufferedReader
ARCHIVE_FLAGS = {
0x1: "Include Directory Names",
... | Python | 1 |
self.cur_token {
Token::LPAREN => {
self.next_token()?;
let group = self.parse_group()?;
Ok(Type2::ChoiceFromInlineGroup {
group,
span: (
begin_type2_range,
self.parser_position.range.1,
begin_typ... | Rust | 0 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
""" Created on
@author: fran
"""
import numpy as np
import matplotlib.pyplot as plt
np.set_printoptions(suppress=True, precision=4, linewidth=250)
plt.rcParams['text.usetex'] = False
plt.rcParams['pdf.fonttype'] = 42
plt.rcParams['ps.fonttype'] = 42
plt.rcParams['mathtext... | Python | 1 |
-> impl Send + Sync + Fn(Vec<F>) -> Vec<F>
where
F: 'static + FiniteField + Clone + Send + Sync,
BA: BilinearAlgorithm<F>,
{
let p: Int = F::characteristic();
assert_eq!(cyclotomic_cosets.len(), conv_bilinear_algos.len());
assert_eq!(cyclotomic_cosets.len(), normal_basis.len());
let convs: Vec<... | Rust | 0 |
for ServiceWrapper<T, R>
where
T: Service<R, Response = Res, Error = Err>,
T::Future: 'static,
{
type Response = Res;
type Error = Err;
type Future = BoxFuture<Res, Err>;
#[inline]
fn poll_ready(&self, ctx: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {
self.0.poll_ready(ctx)... | Rust | 0 |
#!/usr/bin/env python3
import os, sys, asyncio, pytest
_BACKEND_PATH = os.path.abspath(os.path.join(os.path.dirname(__file__), "..", ".."))
if _BACKEND_PATH not in sys.path:
sys.path.insert(0, _BACKEND_PATH)
class _SM:
def __init__(self, total_cost):
self._total = total_cost
async def track_cost(... | Python | 1 |
chedule) -> Schedule:
if callable(scalar_or_schedule):
return scalar_or_schedule
elif jnp.ndim(scalar_or_schedule) == 0:
return constant(scalar_or_schedule)
else:
raise TypeError(type(scalar_or_schedule))
### utilities
def l2_norm(tree):
"""Compute the l2 norm of a pytree of arrays. Useful for we... | Python | 1 |
# External imports
import os
import re
import pytest
def _collect_set_cookie_headers(resp):
try:
# httpx.Headers supports get_list
return resp.headers.get_list('set-cookie')
except Exception:
raw = resp.headers.get('set-cookie') or ''
return [h.strip() for h in raw.split(',') i... | Python | 1 |
:
hstr - the current contained string for the parameter to handle
parameter - any parameters passed to the tag (may be None)
Returns
-------
The handled string
Raises
------
KeyError
if a id is not present in the handlers ... | Python | 1 |
8ffffffffffffffff;
let ciphertext = 0x11b57e6e49d55493602bb7d633404066;
assert_eq!(ciphertext, cipher.encrypt(plaintext, &round_keys));
}
#[test]
fn decryption_test() {
let cipher = cipher::name_to_cipher("aes").unwrap();
let key = [
0x0f, 0x0e, 0x0d, 0x0c, 0x0b... | Rust | 0 |
)
dexhand = DexHandFactory.create_hand(_parser.dexhand, _parser.side)
def run(parser, data_idx):
# data_idx 파싱 (예: "20aed@0")
if "@" in data_idx:
seq_id, frame_offset = data_idx.split("@")
frame_offset = int(frame_offset)
else:
seq_id = data_idx
... | Python | 1 |
# Check deliverables
deliverables = await get_deliverables(workspace_id)
if deliverables:
logger.info(f"✅ AUTONOMOUS TRIGGER SUCCESS! Found {len(deliverables)} deliverables")
for d in deliverables[:3]:
logger.info(f" 📋 {d.get('title', 'Unknown'... | Python | 1 |
8>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct BtcRequest {
#[prost(oneof="btc_request::Request", tags="1, 2, 3, 4, 5, 6, 7")]
pub request: ::core::option::Option<btc_request::Request>,
}
/// Nested message and enum types in `BTCRequest`.
pub mod btc_request {
#[derive(Clone, PartialEq, ::pr... | Rust | 0 |
######################################################## README #############################################################
# This file generates rate based spike train from the potential map.
###########################################################################################################################... | Python | 1 |
: "android-graphics-Paint", "android-graphics-RectF"
#[cfg(any(feature = "all", all(feature = "android-graphics-Paint", feature = "android-graphics-RectF")))]
#[deprecated] pub fn saveLayer_RectF_Paint_int<'env>(&'env self, arg0: impl __jni_bindgen::std::convert::Into<__jni_bindgen::std::option::Option<... | Rust | 0 |
. This file may not be copied, modified, or distributed
// except according to those terms.
use std::cell::UnsafeCell;
const A: UnsafeCell<usize> = UnsafeCell::new(1);
const B: &'static UnsafeCell<usize> = &A;
//~^ ERROR: cannot borrow a constant which contains interior mutability
struct C { a: UnsafeCell<usize> }
c... | Rust | 0 |
l.restoration_test_head(Ls[i]) for i in range(4)]
else:
Es = [self.test_split_fn(model, Ls[i], refield=refield, min_size=min_size, sf=sf, modulo=modulo) for i in range(4)]
b, c = Es[0].size()[:2]
E = torch.zeros(b, c, sf * h, sf * w).type_as(L)
E[..., :h... | Python | 1 |
import re
import json
import sqlite3
from contextlib import closing
import httpx
from lxml import html
from assets import res
from utils import ori_path, temp_p, conf
BASE_URL = "https://hitomi.la/all{category}-{letter}.html"
CATEGORIES = ['tags', 'artists', 'series', 'characters']
LETTERS = [*[chr(i) for i in range... | Python | 1 |
(
0x1CF30,
0x1CF46,
), # Znamenny Combining Tonal..Znamenny Priznak Modifie
(
0x1D165,
0x1D169,
), # Musical Symbol Combining..Musical Symbol Combining
(
0x1D16D,
0x1D182,
), # Musical Symbol Combining... | Python | 1 |
#
# Copyright (c) 2023 Airbyte, Inc., all rights reserved.
#
from .source import SourceRecruitee
__all__ = ["SourceRecruitee"]
| Python | 1 |
),
ForeignLang::Cpp,
)
.unwrap();
println!("c/c++: {}", cpp_code.foreign_code);
assert!(cpp_code.foreign_code.contains("BooRef get_boo() const"));
assert!(cpp_code
.foreign_code
.contains("void Moo_update_boo(MooOpaque * const self, const BooOp... | Rust | 0 |
# Copyright (c) 2024 PaddlePaddle Authors. 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 required by appli... | Python | 1 |
safeBox::new("some text".to_string());
let r = b.create_ref();
let _m = unsafe { r.unsafe_deref() };
let _m2 = unsafe { b.unsafe_deref_mut() };
}
#[test]
fn unchecked_refs() {
// Ensure that `RefMut` and `Ref` resets the borrow count when consumed
// via `into_unchec... | Rust | 0 |
<usize>() {
Ok(res) => res * 1000,
Err(why) => {
eprintln!("{:?}", why);
return None;
}
};
let power: u32 = match contents[1].parse() {
Ok(res) => res,
Err(why) => {
eprintln!("{:?}", why);
... | Rust | 0 |
crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about avaliable fields see [events_usbremoved](events_usbremoved) module"]
pub type EVENTS_USBREMOVED = crate::Reg<u32, _EVENTS_USBREMOVED>;
#[allow(missing_docs)]
#[doc(hidden)]
pub struct _EVENTS_USBREMOVED;... | Rust | 0 |
t field of the relation a.k.a. `references`
pub references: Vec<String>,
/// The name of the relation. Internally, an empty string signals no name.
pub name: String,
/// Foreign Key Constraint Name if there is one
pub fk_name: Option<String>,
/// A strategy indicating what happens when
/// a... | Rust | 0 |
_mem.sp_rx1 = 0x0
_mem.sp_rx2 = 0x0
_mem.icon = 12 # file cabinet icon
if mem.empty and _flg.used and not _flg.visible:
_flg.used = False
return
_flg.visible = not mem.empty
if mem.empty:
self._wipe_memory_banks(mem)
re... | Python | 1 |
fn fmt(&self, fmt: &mut Formatter<'_>) -> Result<(), Error> {
write!(fmt, "?{}", self.index)
}
}
impl<I: Interner> Debug for Fn<I> {
fn fmt(&self, fmt: &mut Formatter<'_>) -> Result<(), Error> {
// FIXME -- we should introduce some names or something here
let Fn {
num_b... | Rust | 0 |
on::Github => '\u{f3b6}',
Icon::Globe => '\u{f3b7}',
Icon::Globe2 => '\u{f3b8}',
Icon::Google => '\u{f3b9}',
Icon::GraphDown => '\u{f3ba}',
Icon::GraphUp => '\u{f3bb}',
Icon::Grid => '\u{f3c5}',
Icon::Grid1X2 => '\u{f3bd}',
Icon::Grid1X2Fill => '\u{f3bc}',
Icon::Grid3X2 => '\u{f3c0}',
Icon::Grid3X2G... | Rust | 0 |
= out.sample_rate();
println!("Sample rate: {}", sample_rate);
out.set_latency(sample_rate as f64 / BUF_SIZE as f64);
match out.latency() {
Ok(latency) => println!("SW latency: {:4.2}ms", latency * 1000.0),
Err(err) => println!("err: {}", err),
}
let layout = out.layout();
prin... | Rust | 0 |
import ctypes
import platform
import re
import shutil
import subprocess
import time
import progress
import psutil
import win32gui
from tqdm import tqdm
import os
from lib.config_read import *
def start_print():
print(r'''
___ ___ ___ ___ ________ _________
|\ \ / /|\ \ / /... | Python | 1 |
ng,
}
cardinalities = {
'SayHello': cardinality.Cardinality.UNARY_UNARY,
'SayHelloStrict': cardinality.Cardinality.UNARY_UNARY,
}
stub_options = beta_implementations.stub_options(host=host, metadata_transformer=metadata_transformer, request_serializers=request_serializers, response_deseriali... | Python | 1 |
"""Tests for neurodsp.utils.data."""
from numpy.testing import assert_equal, assert_almost_equal
from neurodsp.tests.tsettings import N_SECONDS, FS, N_SECONDS_ODD, FS_ODD
from neurodsp.utils.data import *
###################################################################################################
###########... | Python | 1 |
create_aes_gcm_siv_key_template(16, OutputPrefixType::Tink)
}
/// Return a [`KeyTemplate`] that generates an AES-GCM-SIV key with the following parameters:
/// - Key size: 32 bytes
/// - Output prefix type: TINK
pub fn aes256_gcm_siv_key_template() -> KeyTemplate {
create_aes_gcm_siv_key_template(32, OutputPre... | Rust | 0 |
_triangle_type(self.a, self.b, self.c)
}
fn write_points(&self, builder: &mut SvgBuilder) -> std::fmt::Result {
write!(
builder.content,
"{},{} {},{} {},{} {},{}",
scale_float(self.a.0),
scale_float(self.a.1),
scale_float(self.b.0),
... | Rust | 0 |
lambda d: d,
"wow",
post=True)
ju_read_url_post.assert_called_once_with('http://localhost/wow')
@patch("allensdk.core.json_utilities.read_url_get", return_value=_msg)
def test_do_query_get(ju_read_url_get, api):
api.do_query(lambda *a, **k: 'http://localhost/%s' % (a[0... | Python | 1 |
0<DMA> {
_dma: PhantomData<DMA>,
}
/// Stream 1 on DMA
pub struct Stream1<DMA> {
_dma: PhantomData<DMA>,
}
/// Stream 2 on DMA
pub struct Stream2<DMA> {
_dma: PhantomData<DMA>,
}
/// Stream 3 on DMA
pub struct Stream3<DMA> {
_dma: PhantomData<DMA>,
}
/// Stream 4 on DMA
pub struct Stream4<DMA> {
_dm... | Rust | 0 |
,
"N": 722,
"O": 722,
"P": 768,
"Q": 741,
"R": 556,
"S": 592,
"T": 611,
"U": 690,
"V": 439,
"W": 768,
"X": 645,
"Y": 795,
"Z": 611,
"[": 333,
"\\": 863,
"]": 333,
"^": 658,
"_": 500,
"`": 500,
"a": 631,
"b": 549,
"c": 549,
"d": ... | Python | 1 |
k()
board_show()
if wincheck_x()==True or wincheck_o()==True:
break
p2()
mark()
board_show()
if wincheck_x()==True or wincheck_o()==True:
break
if chance>=8:
print("THE MATCH IS A DRAW")
playagain()
'''-------------... | Python | 1 |
will try to find checkpoints with names checkpoint_ee_xx.pt in the path specified by input, '
'and average last this many of them.')
parser.add_argument('--checkpoint-upper-bound', type=int,
help='when using --num-epoch-checkpoints, this will set an upper boun... | Python | 1 |
l,
adv_example_file_type=DatasetType.ADVERSARIAL_EXAMPLE_IMG.value):
sql = "SELECT inference_test_data.*, ori_img_log.ori_img_label, ori_img_log.ori_img_id, " \
"attack_info_log.atk_name, attack_info_log.base_model " \
"FROM inference_test_data, adv_... | Python | 1 |
from gtts import gTTS
from PyPDF2 import PdfReader
# Open the PDF file using context manager to ensure proper closure
with open('name.pdf', 'rb') as pdf_file:
# Create PDF reader object
pdf_reader = PdfReader(pdf_file)
count = len(pdf_reader.pages) # Counts the number of pages in the PDF
textList = [... | Python | 1 |
R_P256TO511_SPEC>,
#[doc = "0x2b8 - Rx 512- to 1023-Byte Packets Statistic Register"]
pub rmon_r_p512to1023: crate::Reg<rmon_r_p512to1023::RMON_R_P512TO1023_SPEC>,
#[doc = "0x2bc - Rx 1024- to 2047-Byte Packets Statistic Register"]
pub rmon_r_p1024to2047: crate::Reg<rmon_r_p1024to2047::RMON_R_P1024TO204... | Rust | 0 |
Writes raw bits to the register"]
#[inline]
pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
self.bits = bits;
self
}
#[doc = "Bit 0 - 0 = No effect. 1 = Sets the corresponding bit in USBEpIntSt."]
#[inline]
pub fn epset0(&mut self) -> _EPSET0W {
_EPSET0W { w: sel... | Rust | 0 |
from PIL import Image
import cv2
import numpy as np
import torch
import torch.nn as nn
from torchvision import transforms
from glob import glob
import os
from models import *
# change device to GPU if available
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
# Loading the cascades
face_classif... | Python | 1 |
*mut u8,
) -> *const c_char {
let res = outputs_retrieve(&cstr_to_str(json_cfg), Some(tx_id));
unsafe { result_to_cstr(res, error) }
}
#[no_mangle]
pub extern "C" fn grin_outputs_retrieve(
json_cfg: *const c_char,
error: *mut u8,
) -> *const c_char {
let res = outputs_retrieve(&cstr_to_str(json_cf... | Rust | 0 |
ush_pos_ += num_bytes_to_write_uncompressed as u64;
bytes -= num_bytes_to_write_uncompressed as u32;
(*s).last_processed_pos_ += num_bytes_to_write_uncompressed as u64;
if num_bytes_to_write_uncompressed >= 2 {
s.is_first_mb = IsFirst::BothCatableBytesWritten;
} else if num_bytes_to_write_uncompre... | Rust | 0 |
-0.5 * q0 * u2 + 0.5 * q1 * u3 - 0.5 * q3 * u1 + q2d,
-0.5 * q0 * u3 - 0.5 * q1 * u2 + 0.5 * q2 * u1 + q3d,
0.5 * q1 * u1 + 0.5 * q2 * u2 + 0.5 * q3 * u3 + q0d]
raises(ValueError, lambda: kinematic_equations([u1, u2, u3], [q0, q1, q2], 'quaternion'))
raises(ValueError, lambda: kin... | Python | 1 |
check_njit = check_run_under_njit(p0, per_player)
except:
check_njit = False
load_agent(level, *args)
if check_njit:
return n_games_numba(
p0,
num_game,
per_player,
list_other,
_list_per_level_[0],
_list_per_level_[1... | Python | 1 |
Cdf.append(float(n) / float(nboot))
plt.plot(Percs, Taus, 'k')
plt.xlabel('% Untilting')
plt.ylabel('tau_1 (red), CDF (green)')
Untilt.sort() # now for CDF of tilt of maximum tau
plt.plot(Untilt, Cdf, 'g')
lower = int(.025*nboot)
upper = int(.975*nboot)
plt.axvline(x=Untilt[lower], ... | Python | 1 |
}
fn cover(layer_id: u32, cover_type: CoverType) -> CoverCarry {
let cover = match cover_type {
CoverType::Partial => Cover { covers: [i8x16::splat(1); TILE_HEIGHT / i8x16::LANES] },
CoverType::Full => {
Cover { covers: [i8x16::splat(PIXEL_WIDTH as i8); TILE_HEI... | Rust | 0 |
= 0x02;
pub const SUBLANG_CHINESE_HONGKONG: USHORT = 0x03;
pub const SUBLANG_CHINESE_SINGAPORE: USHORT = 0x04;
pub const SUBLANG_CHINESE_MACAU: USHORT = 0x05;
pub const SUBLANG_CORSICAN_FRANCE: USHORT = 0x01;
pub const SUBLANG_CZECH_CZECH_REPUBLIC: USHORT = 0x01;
pub const SUBLANG_CROATIAN_CROATIA: USHORT = 0x01;
pub c... | Rust | 0 |
mut Delay,
led: &mut gpioc::PC13<Output<OpenDrain>>,
) -> Result<(), u8> {
#[cfg(feature = "debug")]
hprintln!("Move: {}", command).map_err(|_| ERRNO_GPIO_DEBUG)?;
match command.get_direction() {
Direction::Up => gpio_up.set_high().map_err(|_| ERRNO_GPIO_UPDN)?,
Direction::Down => gpio_d... | Rust | 0 |
ssage_hash,
aggregate_pk: aggregated_public_key,
index: epoch_data.index,
epoch_entropy: epoch_data.epoch_entropy,
parent_entropy: epoch_data.parent_entropy,
combined_first_epoch_bits: epoch_data.combined_first_epoch_bits,
combined_last_epoch_bits:... | Rust | 0 |
dd_task(text)
if self._spinner_task_id is None:
self._spinner_task_id = task_id
else:
task_id = self._spinner_task_id
self._spinner_progress.update(task_id, description=text)
return task_id
def __rich_console__(
self, console: "Console", o... | Python | 1 |
from ipaddress import ip_network
net = ip_network('172.16.192.0/255.255.192.0')
ans = 0
for ip in net:
ip = f'{int(ip):032b}'
if ip.count('1') % 5 != 0:
ans += 1
print(ans)
| Python | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.