text string | label_name string | labels int64 |
|---|---|---|
atus!(
napi_sys::napi_call_function(
env,
napi_val,
then,
1,
[then_js_cb].as_ptr(),
&mut promise_after_then,
),
"Failed to call then method"
)?;
let mut catch = ptr::null_mut();
let catch_c_string = CStr::from_bytes_with_nul_unchecked(b"catch... | Rust | 0 |
cmp::min(best_reach, reach);
let mut known_wins = rw_known_wins.write().unwrap();
let mut known_draws = rw_known_draws.write().unwrap();
//println!("{:?} {:?}, hits: {}, T_kn: {}", game, outcome, khits0, known_wins.len() + known_draws.len());
match outcom... | Rust | 0 |
1578: 202, 1579: 203, 1580: 204, 1581: 205, 1582: 206, 1583: 207, 1584: 208, 1585: 209, 1586: 210, 1587: 211, 1588: 212, 1589: 213, 1590: 214, 1591: 215, 1592: 216, 1593: 217, 1594: 218, 1600: 224, 1601: 225, 1602: 226, 1603: 227, 1604: 228, 1605: 229, 1606: 230, 1607: 231, 1608: 232, 1609: 233, 1610: 234, 1611: 235, ... | Python | 1 |
X, X)> for PhysicalPosition<P> {
fn from((x, y): (X, X)) -> PhysicalPosition<P> {
PhysicalPosition::new(x.cast(), y.cast())
}
}
impl<P: Pixel, X: Pixel> Into<(X, X)> for PhysicalPosition<P> {
fn into(self) -> (X, X) {
(self.x.cast(), self.y.cast())
}
}
impl<P: Pixel, X: Pixel> From<[X; 2]> for PhysicalPositio... | Rust | 0 |
from ...symbols import NORM, ORTH
_exc = {}
_abbr_exc = [
{ORTH: "м", NORM: "метар"},
{ORTH: "мм", NORM: "милиметар"},
{ORTH: "цм", NORM: "центиметар"},
{ORTH: "см", NORM: "сантиметар"},
{ORTH: "дм", NORM: "дециметар"},
{ORTH: "км", NORM: "километар"},
{ORTH: "кг", NORM: "килограм"},
... | Python | 1 |
ension for GenerateCommonConfig {
fn args(&self) -> Vec<Argument> {
vec![
BTC_ANCHORING_NETWORK.to_argument(),
BTC_ANCHORING_INTERVAL.to_argument(),
BTC_ANCHORING_FEE.to_argument(),
BTC_ANCHORING_UTXO_CONFIRMATIONS.to_argument(),
]
}
fn execut... | Rust | 0 |
lon = y.atan2(x);
let lat = z.atan2(hyp);
// Convert to degrees and round to 6 digits
let lon = lon.to_degrees();
let lon = (lon * 10.0_f64.powi(6)).round() / 10.0_f64.powi(6);
let lat = lat.to_degrees();
let lat = (lat * 10.0_f64.powi(6)).round() / 10.0_f64.powi(6);
Location(lat, lon)
}... | Rust | 0 |
bound() {
Included(o) => Included(CharOffset(*o)),
Excluded(o) => Excluded(CharOffset(*o)),
Unbounded => Unbounded,
};
assert_eq!(
get_first_non_white_space_offset_in_range(
$line,
(start, ... | Rust | 0 |
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import re
import markupsafe
from odoo.tools import html_escape
from odoo.tools.mail import create_link, TEXT_URL_REGEX
def sms_content_to_rendered_html(text):
"""Transforms plaintext into html making urls clickable and preserving newlin... | Python | 1 |
wrap();
pub static ref STORE_ENGINE_LOCATE: EngineTickerMetrics =
auto_flush_from!(STORE_ENGINE_LOCATE_VEC, EngineTickerMetrics);
pub static ref STORE_ENGINE_FILE_STATUS_VEC: IntCounterVec = register_int_counter_vec!(
"edb_engine_file_status",
"Number of different status of files",
... | Rust | 0 |
_TIM_CONF_SPEC>`"]
pub type RD_TIM_CONF = crate::Reg<rd_tim_conf::RD_TIM_CONF_SPEC>;
#[doc = "Configures read timing parameters."]
pub mod rd_tim_conf;
#[doc = "WR_TIM_CONF1 register accessor: an alias for `Reg<WR_TIM_CONF1_SPEC>`"]
pub type WR_TIM_CONF1 = crate::Reg<wr_tim_conf1::WR_TIM_CONF1_SPEC>;
#[doc = "Configura... | Rust | 0 |
_to_ids(tokens)
inputs = torch.tensor([input_ids]).to(device)
with torch.no_grad():
outputs = qna_model(inputs)
answer_start_index = torch.argmax(outputs.start_logits)
answer_end_index = torch.argmax(outputs.end_logits)
predict_answer_tokens = input_ids[answer_start_index: answer_end_ind... | Python | 1 |
import asyncio
import json
import os
from datetime import datetime, time, timedelta
from telethon import TelegramClient, events
from telethon.tl.types import PeerChannel, PeerChat, PeerUser
import schedule
import threading
from typing import Dict, List, Union
from dotenv import load_dotenv
import time as sync_time
# 載... | Python | 1 |
5-turbo, text-davinci-003, text-davinci-002
prompt=prompt,
max_tokens=100,
)
generated_answer = ' '.join(response.choices[0].text.strip().split())
except Exception as e:
time.sleep(25)
return model_api(model, prompt)
return gene... | Python | 1 |
else:
question_response = []
for chunk in sentence_chunks:
formatted_input = get_formatted_input(messages, chunk)
greedy_generation_tok_prob = generate_response(model, tokenizer, formatted_input, terminators,
... | Python | 1 |
etup_for_orbbec),
SetRemap(src=['camera_0/color/camera_info'],
dst=['/camera/color/camera_info'],
condition=setup_for_orbbec),
# Remappings for zed
SetRemap(src=['depth/image'],
dst=['/zed2/zed_node/depth/depth_registered'],
cond... | Python | 1 |
1, &affine0, 1, 1));
}
#[test]
fn test_affine_mul_1() {
let affine0 = Affine([[1., 2.], [3., 4.]], [5., 6.]);
let affine1 = Affine([[1., 6.], [2., 5.]], [3., 4.]);
// https://www.wolframalpha.com/input/?i=%7B%7B1%2C2%2C5%7D%2C%7B3%2C4%2C6%7D%2C%7B0%2C0%2C1%7D%7D+*+%7B%7B1%2C6%2C3%7... | Rust | 0 |
doubleValue", "()D", &[])?.d()?)
} else {
return Err(runtime_error(format!(
"Could not convert argument {:?} to a WebAssembly value.",
jobject
)));
},
))
}
}
<reponame>XX/machinery
#![allow(dead_code)]
pub mod u... | Rust | 0 |
_base_ = [
'mmrazor::_base_/settings/imagenet_bs2048_AdamW.py',
'mmcls::_base_/default_runtime.py',
]
# data preprocessor
data_preprocessor = dict(
_scope_='mmcls',
type='ClsDataPreprocessor',
# RGB format normalization parameters
mean=[123.675, 116.28, 103.53],
std=[58.395, 57.12, 57.375],... | Python | 1 |
eduler = DDPMScheduler.from_config(prior_scheduler.config)
stable_unclip_model_id = "stabilityai/stable-diffusion-2-1-unclip-small"
pipe = StableUnCLIPPipeline.from_pretrained(
stable_unclip_model_id,
mindspore_dtype=ms_dtype,
prior_tokenizer=prior_tokenizer,
... | Python | 1 |
::*;
use std::path::{Path, PathBuf};
use java_locator;
use sha2::{Digest, Sha256};
// This is the version of the jar that should be used
const VERSION: &'static str = "0.13.1-SNAPSHOT";
fn main() -> Result<(), J4rsBuildError> {
let out_dir = env::var("OUT_DIR")?;
let source_jar_location = format!("../java/ta... | Rust | 0 |
[allow(clippy::many_single_char_names)]
pub fn convolution<M>(a: &[StaticModInt<M>], b: &[StaticModInt<M>]) -> Vec<StaticModInt<M>>
where
M: Modulus,
{
if a.is_empty() || b.is_empty() {
return vec![];
}
let (n, m) = (a.len(), b.len());
if cmp::min(n, m) <= 60 {
let (n, m, a, b) = if... | Rust | 0 |
_and_merge(opts.horust_config, &opts.config_path)?;
let mut horust = if !opts.command.is_empty() {
debug!("Running command: {:?}", opts.command);
Horust::from_command(
opts.command
.into_iter()
.fold(String::new(), |acc, w| format!("{} {}", acc, w)),
... | Rust | 0 |
version of that number.
fn human_size(size: f64) -> String {
let negative = if size.is_sign_positive() { "" } else { "-" };
let size = size.abs();
let units = ["B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"];
if size < 1_f64 {
return format!("{}{}{}", negative, size, "B");
}
let delimiter = 1024_f... | Rust | 0 |
abels)).astype('float32')
rmse = np.nan_to_num(rmse * mask)
return np.mean(rmse)
def masked_mae_np(preds, labels, null_val=np.nan):
with np.errstate(divide='ignore', invalid='ignore'):
if np.isnan(null_val):
mask = ~np.isnan(labels)
else:
mask = np.not_equal... | Python | 1 |
07', 'voc12'],
'imagenet_det': ['det', 'imagenet_det', 'ilsvrc_det'],
'imagenet_vid': ['vid', 'imagenet_vid', 'ilsvrc_vid'],
'coco': ['coco', 'mscoco', 'ms_coco'],
'wider_face': ['WIDERFaceDataset', 'wider_face', 'WDIERFace']
}
def get_classes(dataset):
"""Get class names of a dataset."""
alia... | Python | 1 |
READINESS_ANY,
/* new */ target,
Ordering::Relaxed,
Ordering::Relaxed,
) {
Ok(_) => Ok(()),
Err(x) if x == target => Ok(()),
Err(_) => Err(()),
}
}
/// Attempts to switch the threadiness to singlethreaded-only mode.
///... | Rust | 0 |
let code = WasmModule::<T>::from(ModuleDefinition {
memory: Some(ImportedMemory::max::<T>()),
imported_functions: vec![ImportedFunction {
name: "seal_deposit_event",
params: vec![ValueType::I32, ValueType::I32, ValueType::I32, ValueType::I32],
return_type: None,
}],
call_body: Some(body::repeate... | Rust | 0 |
izer::SExpr;
use crate::sql::plans::ComparisonExpr;
use crate::sql::plans::ComparisonOp;
use crate::sql::plans::Filter;
use crate::sql::plans::JoinType;
use crate::sql::plans::LogicalInnerJoin;
use crate::sql::plans::PatternPlan;
use crate::sql::plans::RelOp;
use crate::sql::plans::Scalar;
use crate::sql::plans::Scalar... | Rust | 0 |
e order of qualifying raw interrupt and enable of interrupt mask is indifferent for generating an OSC Interrupt. Set by HW. Cleared by writing to OSCICR.XOSCDLFC"]
#[inline(always)]
pub fn xoscdlfris(&mut self) -> XOSCDLFRIS_W {
XOSCDLFRIS_W { w: self }
}
#[doc = "Bit 4 - 4:4\\]
0: XOSCLF has no... | Rust | 0 |
# Copyright (C) 2019-2023 Intel Corporation
#
# SPDX-License-Identifier: MIT
import logging as log
import os
from pathlib import Path
from typing import List, Optional
from datumaro.components.dataset_base import DatasetItem, SubsetBase
from datumaro.components.exporter import Exporter
from datumaro.components.format... | Python | 1 |
r_env_cfg) for _ in range(collector_env_num)]
collector_env = create_env_manager(cfg.env.manager, collector_env_fns)
collector_env.seed(seed)
# create policy
policy = FakePolicy(cfg.policy)
# create collector and buffer
collector = SampleSerialCollector(cfg.policy.colle... | Python | 1 |
# This file is not meant for public use and will be removed in SciPy v2.0.0.
# Use the `scipy.interpolate` namespace for importing the functions
# included below.
from scipy._lib.deprecation import _sub_module_deprecation
__all__ = [ # noqa: F822
'BivariateSpline',
'InterpolatedUnivariateSpline',
'LSQBi... | Python | 1 |
from tensorflow.keras import layers, models
import tensorflow as tf
import matplotlib.pyplot as plt
#Loading Dataset
mnist = tf.keras.datasets.mnist #This is a dataset of handwritten digits
#Splitting the dataset into training and testing data
(x_train, y_train), (x_test,y_test) = mnist.load_data()
#Processing Da... | Python | 1 |
ts() as u32 | (self.class & self.perms),
PermissionOperator::Equal => {
((self.class & self.perms) ^ 0o777)
& ((mode.bits() as u32 & !self.class) ^ self.class)
}
};
to_mode(m)
}
}
fn to_mask_type(str: &str, fn_name: &str) -> Result<MaskTyp... | Rust | 0 |
d_rtt(&self) -> Duration {
self.smoothed_rtt
}
/// Gets the minimum round trip time
#[inline]
pub fn min_rtt(&self) -> Duration {
self.min_rtt
}
/// Gets the variance in observed round trip time samples
#[inline]
pub fn rttvar(&self) -> Duration {
self.rttvar
... | Rust | 0 |
gtk::Window {
title: "Settings",
gtk::Box {
orientation: gtk::Orientation::Horizontal,
#[name="stack_sidebar"]
gtk::StackSidebar {
},
gtk::Separator {
orientation: gtk::Orientation::Vertical,
... | Rust | 0 |
# =============================================================================
# Minet Twitter Tweet-date CLI Action
# =============================================================================
#
# Logic of the `tw tweet-date` action.
#
import re
from minet.cli.utils import with_enricher_and_loading_bar
from twitw... | Python | 1 |
re`], or manually
/// edited using [`Bot::edit_message_text`]. 0-4096 characters.
///
/// [`Bot::set_game_score`]: crate::Bot::set_game_score
///
/// [`Bot::edit_message_text`]: crate::Bot::edit_message_text
pub text: Option<String>,
/// Special entities that appear in text, such as usernam... | Rust | 0 |
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: QPhotonicOperation.proto
"""Generated protocol buffer code."""
from google.protobuf.internal import builder as _builder
from google.protobuf import descriptor as _descriptor
from google.protobuf import descriptor_pool as _descr... | Python | 1 |
_eq!(
elem.get_text().unwrap(),
Cow::from("hello world".to_owned())
);
let data = r##"
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<elem>hello <inner/><![CDATA[<world>]]></elem>
"##;
let elem = Element::parse(data.as_bytes()).unwrap();
assert_eq!(
... | Rust | 0 |
A');
}
let out = ecb_encryption_oracle(repeated_input.as_bytes());
// take 'i' size blocks from output and check for repetition.
if out[0..i] == out[i..(i + i)] {
return i;
}
}
panic!("block size not detected");
}
fn ecb_encryption_oracle(bytes: &[u8]) -> Ve... | Rust | 0 |
= "month")]
Month,
#[serde(rename = "monthdate")]
Monthdate,
#[serde(rename = "monthdatehours")]
Monthdatehours,
#[serde(rename = "quarter")]
Quarter,
#[serde(rename = "quartermonth")]
Quartermonth,
#[serde(rename = "seconds")]
Seconds,
#[serde(rename = "secondsmilliseco... | Rust | 0 |
)))
t=pd.DataFrame(np.dot(t,np.diag(1/data_column.sum())))
t.rename(index=dict(zip(range(R),index_list)),columns=dict(zip(range(C),columns_list)),inplace=True)
t[u'总体']=data_index.mean()
t.sort_values([u'总体'],ascending=False,inplace=True)
t1=t.copy()
result['fop']=t
... | Python | 1 |
_release,
arch,
installed_size,
package_format,
source,
})
}
}
#[derive(Debug)]
pub struct User {
name: String,
email: String,
}
impl<'a, 'd: 'a> TryFrom<Node<'a, 'd>> for User {
type Error = String;
fn try_from(node: Node) -> Result<Self, Se... | Rust | 0 |
import pytest
from pandas import (
Index,
MultiIndex,
Series,
)
import pandas._testing as tm
class TestSeriesRenameAxis:
def test_rename_axis_mapper(self):
# GH 19978
mi = MultiIndex.from_product([["a", "b", "c"], [1, 2]], names=["ll", "nn"])
ser = Series(list(range(len(mi))),... | Python | 1 |
464, 101, 1, 223, 223, 1108, 677, 226, 224, 102, 2, 223, 223, 1005, 224, 479,
101, 1, 223, 223, 1007, 226, 677, 224, 102, 2, 223, 223, 1006, 224, 494, 101, 1, 223, 223,
107, 677, 677, 224, 102, 2, 223, 223, 1005, 224, 509, 101, 1, 223, 223, 108, 677, 677, 224,
102, 2, 223, 223, 1006, 224, 524, ... | Rust | 0 |
trings, id_strings_source, id_usage)
check_results.append((loc, status, details))
if do_translate and loc != "en":
print_info(f"Trying automatic translation for locale {loc}...")
try:
translator = googletrans.Translator()
d... | Python | 1 |
),
CanonicalTyVarKind::Int => self.next_int_var(),
CanonicalTyVarKind::Float => self.next_float_var(),
};
ty.into()
}
CanonicalVarKind::PlaceholderTy(ty::PlaceholderType { universe, name }) => {
let univer... | Rust | 0 |
GL_GLYPH_ICON_PLUS: bagl_glyph_e = 16;
pub const BAGL_GLYPH_ICON_LESS: bagl_glyph_e = 17;
pub const BAGL_GLYPH_ICON_TOGGLE_ON: bagl_glyph_e = 18;
pub const BAGL_GLYPH_ICON_TOGGLE_OFF: bagl_glyph_e = 19;
pub const BAGL_GLYPH_ICON_LOADING_BADGE: bagl_glyph_e = 20;
pub const BAGL_GLYPH_ICON_COG_BADGE: bagl_glyph_e = 21;
p... | Rust | 0 |
cv2.putText(img_ex, show_str2, (10, int(array[3] / 9) * 2), font, array[3] / 450, show_color, 1, cv2.LINE_AA)
cv2.putText(img_ex, show_str3, (10, int(array[3] / 9) * 3), font, array[3] / 450, show_color, 1, cv2.LINE_AA)
cv2.putText(img_ex, show_str4, (10, int(array[3] / 9) * 4),... | Python | 1 |
x20 != 0x20
}
fn clear_sprite_hit(&mut self) {
self.ppu_status &= 0xbF;
}
fn set_sprite_hit(&mut self) {
self.ppu_status |= 0x40;
}
fn get_ppu_addr_increment_value(&self) -> usize {
if self.ppu_ctrl1 & 0x04 == 0x04 {
32
} else {
1
... | Rust | 0 |
::CtorType {
let (inner_int, inner_char, outer_char) = args;
ctor::FnCtor::new(
move |dest: crate::rust_std::pin::Pin<&mut crate::rust_std::mem::MaybeUninit<Self>>| unsafe {
crate::detail::__rust_thunk___ZN18FieldInTailPaddingC1Eicc(
crate::rust_std::pin::... | Rust | 0 |
pub attrib_mod: Vec<AttribMod>,
pub effect: Vec<Effects>,
}
#[derive(Debug, Deserialize, Serialize)]
pub struct AttribMod {
pub attrib: Vec<u32>,
pub aspect: u32,
pub application_type: u32,
#[serde(rename = "type")]
pub attrib_type: u32,
pub target: u32,
pub target_info: Vec<TargetInfo>... | Rust | 0 |
REE: Arc<TaskTree> = TaskTree::new();
}
pub fn add_reporter(reporter: Arc<dyn Reporter>) {
TASK_TREE.add_reporter(reporter);
}
#[derive(Default)]
pub struct TaskTree {
pub(crate) tree_internal: RwLock<TaskTreeInternal>,
/// If true, it will block the current thread untill all task events are
/// repo... | Rust | 0 |
fn secretstore_service_contract_address(&self) -> Result<Option<SecretStoreContractAddress>, String> {
into_secretstore_service_contract_address(self.args.arg_secretstore_contract.as_ref())
}
fn secretstore_service_contract_srv_gen_address(&self) -> Result<Option<SecretStoreContractAddress>, String> {
into_sec... | Rust | 0 |
<'a>),
Interpolation(SourceNode<'a>),
Comment(SourceNode<'a>),
}
pub struct SourceNode<'a> {
pub source: &'a str,
pub location: SourceLocation,
}
pub struct TextNode<'a> {
pub text: DecodedStr<'a>,
pub location: SourceLocation,
}
pub struct Element<'a> {
pub tag_name: Name<'a>,
pub na... | Rust | 0 |
self.name,
match self.run_at {
Some(v) => v.to_string(),
None => "N/A".to_string(),
},
)
}
}
use ncurses::cbreak;
use ncurses::constants::ALL_MOUSE_EVENTS;
use ncurses::constants::ERR;
use ncurses::constants::KEY_MOUSE;
use ncurses::consta... | Rust | 0 |
"C" fn run_javascript_in_world_trampoline<Q: FnOnce(Result<JavascriptResult, Error>) + Send + 'static>(_source_object: *mut gobject_sys::GObject, res: *mut gio_sys::GAsyncResult, user_data: glib_sys::gpointer) {
let mut error = ptr::null_mut();
let ret = webkit2_sys::webkit_web_view_run_javascr... | Rust | 0 |
tput types.
initial_input_dtype = initial_interpreter.get_input_details()[0]['dtype']
initial_output_dtype = initial_interpreter.get_output_details()[0]['dtype']
final_input_dtype = final_interpreter.get_input_details()[0]['dtype']
final_output_dtype = final_interpreter.get_output_details()[0]['dtype']
... | Python | 1 |
e-sensitive-2" => "X2",
"favicon.ico" => "",
"gemfile" => "",
"gruntfile.coffee" => "",
"gruntfile.js" => "",
"gruntfile.ls" => "",
"gulpfile.coffee" => "",
"gulpfile.js" => "",
"gulpfile.ls" => "",
"ini" => "",
"known_hosts" => "... | Rust | 0 |
# Scrapy settings for scraper project
#
# For simplicity, this file contains only settings considered important or
# commonly used. You can find more settings consulting the documentation:
#
# https://s.scrapy.org/en/latest/topics/settings.html
# https://docs.scrapy.org/en/latest/topics/downloader-middleware.ht... | Python | 1 |
Ok(Record::StartSegmentAddress {
cs: 0x1234,
ip: 0x3800
})
);
}
#[test]
fn test_record_from_record_string_parses_valid_extended_linear_address() {
assert_eq!(
Record::from_record_string(":02000004ABCD82"),
Ok(Record::ExtendedLinearAddress(0xABCD))
);
asse... | Rust | 0 |
lue
@pyqtProperty(int)
def rHeight(self):
return self._height
@rHeight.setter
def rHeight(self, value):
self._height = value
@pyqtProperty(QColor)
def bgColor(self):
return self._bgcolor
@bgColor.setter
def bgColor(self, color):
self._bgcolor = QColor(... | Python | 1 |
{}
results['Overall'] = {}
for task in TASKS:
results[f'{task}'] = {}
for subtask in SUBTASKS:
results[f'{task}'][f'{subtask}'] = {}
for i in range(len(data)):
question = data.iloc[i]
Task = question['category'].split('/')[0]
Subtask = question['category'... | Python | 1 |
future_values: Optional[torch.Tensor] = None,
output_hidden_states: Optional[bool] = None,
output_attentions: Optional[bool] = None,
channel_attention_mask: Optional[torch.Tensor] = None,
return_dict: Optional[bool] = None,
linear_attn: bool = False,
) -> Union[Tuple, Patc... | Python | 1 |
"""Neural embedding change point detection.
Implementation inspired by Dadi et al. (2021) "ADAF".
"""
from __future__ import annotations
import logging
from dataclasses import dataclass
import numpy as np
from ..utils.plotting import plot_change_points
logger = logging.getLogger(__name__)
@dataclass
class Embedd... | Python | 1 |
: usize = 48;
pub const SHA512: usize = 64;
/* Configure your PIN here */
pub const MAXPIN: i32 = 10000; /* PIN less than this */
pub const PBLEN: i32 = 14; /* Number of bits in PIN */
fn ceil(a: usize,b: usize) -> usize {
(a-1)/b+1
}
#[allow(non_snake_case)]
pub fn encode_to_curve(dst: &[u8],id: &[u8],hcid: &m... | Rust | 0 |
at needs
// to be processed further with this package
if slot_state.rx_data.is_none() {
let slot_queue_index =
slot_queue_index_from_pos(tx_pos as usize) as usize & VCHIQ_SLOT_QUEUE_MASK;
info!("slot_queue_index {}", slot_queue_index);
... | Rust | 0 |
let mut set: std::collections::BTreeSet<usize> = Default::default();
for number in numbers
{
debug!("add to set: {}", number);
set.insert(number);
for bingo in &bingos
{
if let Some(result) = bingo.check(&set)
{
return Ok(format!("{}", number*result));
}
}
}
bail!(Error::AocN... | Rust | 0 |
# BSD 3-Clause License
#
# This file is part of the PNEC project.
# https://github.com/tum-vision/pnec
#
# Copyright (c) 2022, Dominik Muhle.
# All rights reserved.
from matplotlib import pyplot as plt
from mpl_toolkits.mplot3d.art3d import Poly3DCollection
import numpy as np
import sophus as sp
def CameraBox(camera... | Python | 1 |
reeNode {
// val: 1,
// left: Some(Rc::new(RefCell::new(TreeNode {
// val: 4,
// left: Some(Rc::new(RefCell::new(TreeNode::new(2)))),
// right: Some(Rc::new(RefCell::new(TreeNode::new(4)))),
// }))),
// right: Some(Rc::new(RefCell::new(TreeNode {
/... | Rust | 0 |
ain_data,dev_data,vocab,dtype='CNN')
if args.do_avg:
avg_model = WordAVGModel(len(vocab.vocab),args.embed_size,len(label_map),dropout=args.dropout_rate)
avg_model.to(device)
train(args, avg_model, train_data, dev_data, vocab, dtype='AVG')
if args.do_rnn:
... | Python | 1 |
from django.core.management.base import BaseCommand
from core.models import Team, User, TeamMembership
from curriculum_tracking.models import AgileCard, ContentItem
from ..helpers import get_student_users
def get_ip_project_cards(user):
return AgileCard.objects.filter(
assignees__in=[user],
status... | Python | 1 |
, "you need to guess with {} digits" , exp),
ParseError::NoDuplicates => "no duplicates, please".fmt(f),
}
}
}
/// a well-formed guess string should be like
/// "1543", with NUMBER_OF_DIGITS digits, no repetitions,
/// no separators or other characters. Parse the guess string as a
/// Vec<usiz... | Rust | 0 |
_res.1);
}
}
#[test]
fn valid_exprs() {
// These are valid expressions and must produce the right results.
// Don't bother testing different numeric radices here, those are already covered
// by unit tests. Here we should focus on expression constructs rather than
// validating parsing of numbers.... | Rust | 0 |
import numpy as np
import matplotlib.pyplot as plt
def sigmoid(z):
return 1 / (1 + np.exp(-z))
def cost_function(h, y):
return (-y * np.log(h) - (1 - y) * np.log(1 - h)).mean()
def logistic_regression(X, y, num_iterations, learning_rate):
# Add intercept to X
intercept = np.ones((X.shape[0], 1))
... | Python | 1 |
loss1, 1 - loss1)
else:
outputs, y1, y2 = self.model.forward_weight(x, batch_x_mark, loss1, 1 - loss1)
loss = criterion(y1, true) + criterion(y2, true)
loss.backward()
self.opt.step()
self.model.store_grad()
self.opt.zero_grad()
... | Python | 1 |
").unwrap();
db_map.put_string("key3", "value3").unwrap();
db_map.put_string("key4", "value4").unwrap();
db_map.put_string("key5", "value5").unwrap();
// includes key
assert!(db_map.includes_key("key1").unwrap());
assert!(db_map.includes_key("key2").unwrap());
ass... | Rust | 0 |
, 20.0],
dk: vec![5.0, 10.0],
stress: 1.0,
cycle: cycle::Cycle {
min: tag::Tag::new(5.0, 0),
max: tag::Tag::new(10.0, 0),
},
beta: vec![0.1, 0.2],
da: vec![0.1, 0.3],
crack: grow::CrackState {
... | Rust | 0 |
e results folders
ids = [2, 3, 4, 5]
# results = calculate_mape_matrices(base_path, ids)
#
# for folder_id, metrics in results.items():
# print(f"Folder ID {folder_id}:")
# print(f" MAPE matrix for C saved as 'mape_C_matrix_{folder_id}.csv'")
# print(f" MAPE matrix for S saved... | Python | 1 |
"this is text"),
);
}
fn check_find_iter(text: &str, expected: Vec<Result<Attr, BadAttrError>>) {
let items: Vec<_> = Attr::find_iter(text).collect();
assert_eq!(items, expected);
}
#[test]
fn find_attr_1() {
check_find_iter(
r#"
// #[include_doc("abc", ... | Rust | 0 |
ssues_file.writerow([
'project',
'component',
'creationDate',
'updateDate',
'severity',
'status',
'key',
'langName',
'name',
'htmlDesc'])
for issue in issues:
vuln=get_rule(issue['rule'], base_key=args.key, url=args.h... | Python | 1 |
SLEEP = 223,
WAKE = 227,
WEBSEARCH = 229,
WEBFAVORITES = 230,
WEBREFRESH = 231,
WEBSTOP = 232,
WEBFORWARD = 233,
WEBBACK = 234,
MYCOMPUTER = 235,
MAIL = 236,
MEDIASELECT = 237,
}
impl Key {
pub fn write_to_out_protocol(&self, o_prot: &mut TOutputProtocol) -> thrift::Result<()> {
o_prot.wri... | Rust | 0 |
his is equivalent to
#
# act = jnp.einsum('abc,ade->dceb', left_act, right_act)
# act = jnp.einsum('dceb,cef->bdf', act, output_w) + output_b
#
# but faster. maybe for subbatch inference?
# [B, N_seq, N_res//dap_size, num_outer_channel] => [B, N_s... | Python | 1 |
[repr(u8)]
pub enum Priority {
Level0 = 0,
Level1 = 1,
Level2 = 2,
Level3 = 3,
Level4 = 4,
Level5 = 5,
Level6 = 6,
Level7 = 7,
}
impl Priority {
#[inline]
fn to_nvic(self) -> u8 {
(self as u8) << (8 - NVIC_PRIO_BITS)
}
#[inline]
fn from_nvic(priority: u8) ->... | Rust | 0 |
import pandas as pd
from datetime import datetime
from covid_updater.iso import merge_iso
source_file = "data/countries/Austria.csv"
replace = {
"Kärnten": "Karnten",
"Niederösterreich": "Niederosterreich",
"Oberösterreich": "Oberosterreich",
}
def main():
# Load current data
df_source = pd.read... | Python | 1 |
InvalidData => DownCastErrors::InvalidData,
ErrorKind::TimedOut => DownCastErrors::TimedOut,
ErrorKind::WriteZero => DownCastErrors::WriteZero,
ErrorKind::Interrupted => DownCastErrors::Interrupted,
ErrorKind::Other => DownCastErrors::Other,
ErrorKind::Unexpec... | Rust | 0 |
status, msg = source.authenticate(self.form)
if status:
self.set_current_source(source.get_source_name())
if msg is not None and 'username' in msg:
self.form._fields['email'].data = msg['username']
return status, msg
... | Python | 1 |
"order": 6
}
}
},
"activity_monitor_links": {
"type": "object",
"title": "activity_monitor_links",
"properties": {
"matches": {
"$ref": "#/definitions/resource_link",
"title": "Matches",
"description": "Matches",
"order": 2
... | Python | 1 |
class Solution:
def highestPeak(self, is_water):
dx = [0, 0, 1, -1] # Horizontal movement: right, left, down, up
dy = [1, -1, 0, 0] # Vertical movement corresponding to dx
rows = len(is_water)
columns = len(is_water[0])
# Initialize the height matrix with -1 (unprocessed ... | Python | 1 |
'Ellison Leão', 'manual'),
]
# -- Options for manual page output ------------------------------------------
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
(master_doc, 'pyshorteners', 'pyshorteners Documentation',
[author], 1)... | Python | 1 |
, null=True)
innodb_pages_distinct_min = models.FloatField(default=None, null=True)
innodb_pages_distinct_max = models.FloatField(default=None, null=True)
innodb_pages_distinct_pct_95 = models.FloatField(default=None, null=True)
innodb_pages_distinct_stddev = models.FloatField(default=None, null=True)
... | Python | 1 |
pallas::Base {
extract_p(self.0.into())
}
}
/// A homomorphic Pedersen commitment to the net value of a _note_, used in
/// Action descriptions.
///
/// https://zips.z.cash/protocol/nu5.pdf#concretehomomorphiccommit
#[derive(Clone, Copy, Deserialize, PartialEq, Serialize)]
pub struct ValueCommitment(#[serd... | Rust | 0 |
#! /usr/bin/env python
# This example shows how to solve a first simple PDE:
# - load the mesh,
# - perform initial refinements
# - create a H1 space over the mesh
# - define weak formulation
# - initialize matrix solver
# - assemble and solve the matrix system
# - visualize the solution
#
# PDE: Poisson... | Python | 1 |
feature = "Win32_System_Com"))]
pub fn OleLoadPicture(lpstream: super::Com::IStream, lsize: i32, frunmode: super::super::Foundation::BOOL, riid: *const ::windows_sys::core::GUID, lplpvobj: *mut *mut ::core::ffi::c_void) -> ::windows_sys::core::HRESULT;
#[doc = "*Required features: `\"Win32_System_Ole\"`, `\"Win... | Rust | 0 |
+00, 1.0365427939411784e+00,
1.0368595402854539e+00, 1.0365645405660555e+00, 1.0363938240707142e+00,
1.0367205578770746e+00, 1.0365239329446050e+00, 1.0361531226427443e+00,
1.0348785007827348e+00, 1.0042729660717318e+00, 8.4218486432354278e-01,
7.3759394894801567e-01, 6.5853154500294642e-01, 6.... | Rust | 0 |
{
while stack.len() > 0 {
let (index, depth) = stack.pop().unwrap();
let pos = graph[index].pos;
for next_pos in map.get_neighbors(pos, depth) {
let tile = map.get_tile(next_pos).unwrap();
// make the portal edge cost 2 because of the way
// we account ... | Rust | 0 |
# Copyright 2023 Google LLC
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | Python | 1 |
_map.get(&'A'));
assert_eq!(Some(&vec![]), prereq_map.get(&'C'));
}
#[test]
fn perform_step_no_steps() {
let mut steps = Steps::new(HashMap::new());
assert_eq!(None, steps.perform_step());
}
#[test]
fn part1_example() {
let input = fs::read_to_string("./src/day0... | Rust | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.