text string | label_name string | labels int64 |
|---|---|---|
from codalab.lib.interactive_session import InteractiveSession
from codalab.worker.download_util import BundleTarget
import unittest
import re
class InteractiveSessionTest(unittest.TestCase):
def test_get_docker_run_command(self):
targets = [('key', BundleTarget('uuid1', '')), ('key2', BundleTarget('uuid... | Python | 1 |
::get_github_make_issue(github_url, title)),
);
data.insert(
"view_in_github".to_string(),
json!(markdown::get_view_in_github(from, github_url)),
);
data.insert(
"view_in_github_mobile".to_string(),
json!(markdown::get_view_in_github_mobile(from, github_url)),
);
... | Rust | 0 |
ice versa. To ensure that the
presence of HP, DEF, ATK, HP%, DEF% and ATK% units in the substats is accounted for
when one of these is also in the mainstat, a localized replacement must be performed.
"""
text = text[0:plus_indx].replace(mtch.group(), "") +... | Python | 1 |
#[test] struct_fails2 code! {
struct S {
#[spec] i: bool,
j: bool,
}
fn test(i: bool, j: bool) {
let s = S { i, j };
let ii = s.i;
}
} => Err(_) => ()
}
test_verify_one_file! {
#[test] struct_fails3 code! {
struct S {
... | Rust | 0 |
Loop(t, b) => {
let b = simplify_ast_node::<A>(cctx, *b).unwrap_or_default();
Some(Loop(t, Box::new(b)))
}
Break => Some(Break),
Switch(v, cases, default) => {
let cases: Vec<_> = cases
.into_iter()
.filter_map(|(vs, a)|... | Rust | 0 |
prop={'size': 10}, loc='upper right', fancybox=True)
legend.get_frame().set_boxstyle("round", pad=0.5)
# 整体标题装饰线
fig.suptitle('模型性能四维对比分析', fontsize=22, fontweight='bold', y=0.95,
bbox=dict(facecolor='#F0E68C', edgecolor='none', alpha=0.3, pad=12))
ax_title = fig.add_axes([0.15, 0.93, 0.7, 0.005]... | Python | 1 |
OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERW... | Rust | 0 |
ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='crm.Contact')),
('cperson', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='crm.Person', verbose_name='Person')),
('ref_call', models.ForeignKey(blank=True, null=True, on_delete=django.d... | Python | 1 |
{
Err(e) => panic!("Failed to read stdin: {}", e),
_ => match buf.pop() {
None => (),
Some(c) => {
if c != '\n' {
buf.push(c)
}
}
},
};
buf
}
/// Same functionality as `print!()` except that `stdout... | Rust | 0 |
<div class="metric-label">运行时间(秒)</div>
</div>
<button class="btn success" onclick="startSystem()">启动</button>
<button class="btn danger" onclick="stopSystem()">停止</button>
</div>
... | Python | 1 |
# Copyright (C) 2015-2023 Swift Navigation Inc.
# Contact: https://support.swiftnav.com
#
# This source is subject to the license found in the file 'LICENSE' which must
# be distributed together with this source. All other rights reserved.
#
# THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
... | Python | 1 |
: b"?o\0".as_ptr() as *const _,
wl_interface: std::ptr::null(),
},
WlMessage {
name: b"unset_fullscreen\0".as_ptr() as *const _,
signature: b"\0".as_ptr() as *const _,
wl_interface: std::ptr::null(),
},
WlMessage {
name: b"set_m... | Rust | 0 |
import copy
def recursive_dfs(lists, memory, vertice):
if not memory[vertice]:
memory[vertice] = True
selected_node = lists[vertice].first_node
while not selected_node is None:
memory = recursive_dfs(lists, memory, selected_node.value)
selected_node = selected_node.n... | Python | 1 |
}
}
object_125.finish();
}
if let Some(var_128) = &input.terminate_instance_on_failure {
object.key("terminateInstanceOnFailure").boolean(*var_128);
}
Ok(())
}
pub fn serialize_structure_crate_input_import_component_input(
object: &mut aws_smithy_json::serialize::Jso... | Rust | 0 |
import asyncio
import sys
from theHarvester import __main__
def main():
platform = sys.platform
if platform == 'win32':
# Required or things will break if trying to take screenshots
import multiprocessing
multiprocessing.freeze_support()
try:
# See if we have winl... | Python | 1 |
# -*- coding: utf-8 -*-
# vStream https://github.com/Kodi-vStream/venom-xbmc-addons
import re
from resources.lib.handler.requestHandler import cRequestHandler
from resources.hosters.hoster import iHoster
from resources.lib.comaddon import dialog
from resources.lib.util import urlEncode, Quote
class cHoster(iHoster):... | Python | 1 |
Endpoint<'a, Input, Output> = Handler<'a, Input, Output, Infallible>;
#[cfg(test)]
mod tests {
use super::*;
use crate::deps;
#[tokio::test]
async fn test_endpoint() {
let input = 123;
let output = 7;
let result = endpoint(move |num: i32| async move {
assert_eq!(nu... | Rust | 0 |
averagepooling + conv (+ relu)
# --------------------------------------------
def downsample_avgpool(
in_channels=64,
out_channels=64,
kernel_size=3,
stride=1,
padding=1,
bias=True,
mode="2R",
negative_slope=0.2,
):
assert len(mode) < 4 and mode[0] in ["2", "3"], "mode examples: 2, ... | Python | 1 |
-location");
result
}
}
#[cfg(test)]
mod test {
use crate::utils::etag_for_path;
#[cfg(feature = "with-async-std")]
use async_std::io::Cursor;
use std::fs::File;
use std::io::prelude::*;
#[cfg(any(feature = "with-tokio", feature = "sync"))]
use std::io::Cursor;
fn object(si... | Rust | 0 |
) => match config.resolver.resolve(s) {
Some(id) => visitor.visit_borrowed_str(id),
None => match config.failed_resolve_strategy {
FailedResolveStrategy::Error => Err(DeserializeError {
kind: DeserializeErrorKind::UnknownToken { token_id: s },
... | Rust | 0 |
_alloc_buf_host, &[k1_alloc_start as u32])
.unwrap();
let k1_code = include_bytes!("../shader/kernel1.spv");
let k1_pipeline = device.create_simple_compute_pipeline(k1_code, 3).unwrap();
let k1_ds = device
.create_descriptor_set(
&k1_pipeline,
... | Rust | 0 |
ures? \
You're in the right place!
The locks module allows you to lock away some common items in the \
telegram world; the bot will automatically delete them!
• `/locktypes`*:* Lists all possible locktypes
*Admins only:*
• `/lock <type>`*:* Lock items of a certain type (not available in private)
• `/unlock <type>`... | Python | 1 |
ver for the account
NotApproved,
/// Created by System
CreatedBySystem,
/// No value
NoneValue,
/// Insufficient balance
InSufficientBalance,
/// Pair already exists
PairExists,
/// Lp token id already exists
LptExists,
/// Invalid pair
InvalidPair,
/// Pair with identical identi... | Rust | 0 |
import pandas as pd
champDataLocation='champData.txt'
champions_dict = {}
with open(champDataLocation, 'r') as file:
# Read all lines into a list
for line in file:
# Split the line into key (champion) and value
champion, value_str = line.strip().split('\t') # Assuming tab-separated columns, adju... | Python | 1 |
eetNetwork!");
let gra = StreetNetwork::new(&map, vec![
"primary" , "secondary" , "tertiary",
"primary_link" , "secondary_link" , "tertiary_link",
"residential" , "service"
]);
let path: &Path = Path::new(&outpath);
let bytes = serde_json::to_string(&gra).unwrap();
... | Rust | 0 |
unused_imports,
non_snake_case,
non_camel_case_types,
non_upper_case_globals,
unused_parens,
non_shorthand_field_patterns,
dead_code,
overflowing_literals,
unreachable_patterns,
unused_variables,
clippy::unknown_clippy_lints,
clippy::missing_safety_doc,
clippy::match_sing... | Rust | 0 |
"""empty message
Revision ID: f565dde93553
Revises: 4585ce5147b8
Create Date: 2020-12-15 21:49:19.190893
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy import text
# revision identifiers, used by Alembic.
revision = 'f565dde93553'
down_revision = '4585ce5147b8'
branch_labels = None
depends_on = N... | Python | 1 |
from .parser import Gene2AccessionParser
import biothings.hub.dataload.uploader as uploader
class EntrezAccessionUploader(uploader.MergerSourceUploader):
name = "entrez_accession"
main_source = "entrez"
def load_data(self, data_folder):
self.parser = Gene2AccessionParser(data_folder)
self... | Python | 1 |
est"]
btype = branch.get("branch_type", "?")
src_mod = self.resolve_module(src)
dst_mod = self.resolve_module(dst)
# show module transition if different
if src_mod != dst_mod:
print(
f" {i:3}: {btype:4} 0x{src:08x} -> 0x{d... | Python | 1 |
let submissions = self.fetcher.fetch_submissions(&contest, page).await;
if submissions.is_empty() {
break;
}
let fetched_ids = submissions.iter().map(|s| s.id).collect::<Vec<_>>();
let stored_submissions = self.db.count_stored_submissi... | Rust | 0 |
the list of `bounded_models` of `self`.
pub fn append_bounded_model(&mut self, model: M) {
self.bounded_models.push(model);
}
/// Appends the value in `model` to the list of `open_models` or `bounded_models` of
/// `self` if `model` is respectively a left or a right value.
pub fn append(&m... | Rust | 0 |
for_user() {
let z = ZoteroInit::set_user("123456789", "abcdefgh");
match z.delete_collection("ABREZSE", "2050") {
Ok(_) => assert!(true),
Err(_) => assert!(true)
};
}
#[test]
fn delete_items_for_user() {
let z = ZoteroInit::set_user("123456789", "abc... | Rust | 0 |
# Copyright 2018 Datawire. 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 applicable law or agr... | Python | 1 |
(Env::GNU),
tier: Tier::One,
};
/// `x86_64-pc-windows-msvc`: 64-bit MSVC (Windows 7+)
pub const X86_64_PC_WINDOWS_MSVC: Platform = Platform {
target_triple: "x86_64-pc-windows-msvc",
target_arch: Arch::X86_64,
target_os: OS::Windows,
target_env: Some(Env::MSVC),
tier: Tier::One,
};
/// `x86_6... | Rust | 0 |
lock is a block of pixels measuring 16x16.) </p>
/// <ul>
/// <li> <p>1 - 396</p> </li>
/// <li> <p>1b - 396</p> </li>
/// <li> <p>1.1 - 900</p> </li>
/// <li> <p>1.2 - 2376</p> </li>
/// <li> <p>1.3 - 2376</p> </li>
/// <li> <p>2 - 2376</p> </li>
/// <li> <p>2.1 - 4752</p> </li>
///... | Rust | 0 |
in_executor(&mut executor, rcv.next()).unwrap(), 2);
}
#[test]
fn test_reschedule() {
set_logger_for_test();
let mut executor = fasync::TestExecutor::new_with_fake_time().unwrap();
let (mut t, mut rcv) = TestContext::new();
// timer 1 and 2 are scheduled.
// timer 1... | Rust | 0 |
# importando biblioteca
import math
num1 = int(input("Digite o primeiro valor: "))
num2 = int(input("Digite o segundo valor: "))
num3 = float(input("Digite o terceiro valor: "))
# Calculo
a = ((num1 * 2) * (num2/2))
b = ((num1 * 3)+ num3)
c = num3 ** 3
d = math.fabs(num1 - num2)
e = ((num2 ** 2) + (math.log(num3 * nu... | Python | 1 |
11
env['_MANIFEST_SOURCES'] = None # _windowsManifestSources
# Set-up ms tools paths
msvc_setup_env_once(env)
# Loadable modules are on Windows the same as shared libraries, but they
# are subject to different build parameters (LDMODULE* variables).
# Therefore LDMODULE* variables correspond ... | Python | 1 |
# 包含 SentimentAnalyzer 类,负责加载模型并提供一个 analyze(text) 方法,返回标准化的情感结果
# -*- coding: utf-8 -*-
"""
情感分析模块 (SentimentAnalyzer) - 【V4,最终健壮版】
- 动态确定标签索引,彻底解决硬编码带来的问题。
"""
import torch
from transformers import AutoTokenizer, AutoModelForSequenceClassification
import config
class SentimentAnalyzer:
"""封装情感分析功能的类"""
... | Python | 1 |
#
# Copyright (c) 2009-2016, Jack Poulson
# All rights reserved.
#
# This file is part of Elemental and is under the BSD 2-Clause License,
# which can be found in the LICENSE file in the root directory, or at
# http://opensource.org/licenses/BSD-2-Clause
#
import El
n = 400
worldRank = El.mpi.WorldRank()
worldSiz... | Python | 1 |
expr) => {{
while !$uart.sr.read().txe().bit() {}
$uart.dr.write(|w| w.dr().bits($c as u16));
}}
}
pub fn uart_putstr(uart: &::stm32f405::usart6::RegisterBlock, s: &str) {
for c in s.bytes() {
uart_putc!(uart, c);
}
}
pub fn uart_putu8(uart: &::stm32f405::usart6::RegisterBlock, x: ... | Rust | 0 |
import re
from sys import version_info
import requests
from requests.packages.urllib3.exceptions import InsecureRequestWarning
# 禁用安全请求警告
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
from queue import Queue
from urllib.parse import urlparse
from threading import Thread
# 友链爬取
class FriendChins:
... | Python | 1 |
class flashcard:
def __init__(self, word, meaning):
self.word = word
self.meaning = meaning
def __str__(self):
return self.word+' ( '+self.meaning+' )'
flash = []
print("welcome to flashcard application")
while(True):
word = input("enter the name you want to add to flashcard : ")
meaning = input("ente... | Python | 1 |
W: &str = "https://w3.org/ns/did/v1";
pub const W3ID_DID_V1_CONTEXT: &str = "https://w3id.org/did/v1";
pub const DID_RESOLUTION_V1_CONTEXT: &str = "https://w3id.org/did-resolution/v1";
pub const DIF_ESRS2020_CONTEXT: &str = "https://identity.foundation/EcdsaSecp256k1RecoverySignature2020/lds-ecdsa-secp256k1-recovery202... | Rust | 0 |
buf_reader.read_line(&mut header_row)?;
buf_reader.read_line(&mut data_row)?;
// read first line of csv file
let mut file_reader = std::io::BufReader::new(file);
file_reader.seek(std::io::SeekFrom::Start(0))?;
let mut first_line = String::new();
file_reader.read_line(&mut fir... | Rust | 0 |
="骨骼工具")
if context.scene.pipeline_show_rig_tools:
# 添加骨骼按钮
row = box.row()
row.operator("pipeline.add_metarig", text="Human Metarig").rig_type = 'METARIG'
row.operator("pipeline.add_metarig", text="Basic Human").rig_type = 'BASIC'
# 生成绑定按... | Python | 1 |
n, n, n, n, n),
))
}
/// Shift Left and Insert (immediate)
#[inline]
#[target_feature(enable = "neon,v7")]
#[cfg_attr(test, assert_instr("vsli.8", N = 1))]
#[rustc_legacy_const_generics(2)]
pub unsafe fn vsliq_n_u8<const N: i32>(a: uint8x16_t, b: uint8x16_t) -> uint8x16_t {
static_assert_imm3!(N);
let n = N... | Rust | 0 |
import gevent
from gevent import monkey
monkey.patch_all()
import json
from signal import signal, SIGTERM
from multiprocessing import Process
from leek.agent.logger import get_logger
from leek.agent.consumer import LeekConsumer
logger = get_logger(__name__)
class LeekAgent:
"""Main server object, which:
... | Python | 1 |
import streamlit as st
import os
from PIL import Image
def render():
st.title("K-Nearest Negihbour(KNN)-Theory")
st.write(
'''K - Nearest Neighbors(KNN) is a supervised machine learning algorithm generally used for classification but can also be used for regression tasks.It works by finding the "k" clos... | Python | 1 |
down tombstones in the handoff nodes
client.delete_object(self.url, self.token, container_name, object_name)
# Now a new GET should return 404 because the handoff nodes
# return a 404 with a Tombstone.
try:
client.get_object(self.url, self.token, container_name,
... | Python | 1 |
rue,
depth_compare: wgpu::CompareFunction::Less,
stencil_front: wgpu::StencilStateFaceDescriptor::IGNORE,
stencil_back: wgpu::StencilStateFaceDescriptor::IGNORE,
stencil_read_mask: 0,
stencil_write_mask: 0,
}),
//wha... | Rust | 0 |
fdSignaling").string(var_324.as_str());
}
if let Some(var_325) = &input.anti_alias {
object.key("antiAlias").string(var_325.as_str());
}
if let Some(var_326) = &input.codec_settings {
let mut object_327 = object.key("codecSettings").start_object();
crate::json_ser::serialize_stru... | Rust | 0 |
())
.map(|v| v.unwrap())
}
}
#[test]
fn test_badge_effect_values() {
let values = BadgeEffect::values().collect::<Vec<_>>();
assert_eq!(values[0], BadgeEffect::Left);
assert_eq!(values[values.len() - 1], BadgeEffect::Laser);
}
impl fmt::Display for BadgeEffect {
fn fmt(&self, f: &mut F... | Rust | 0 |
String,
pub value: i8
}
#[derive(Serialize, Deserialize, Clone)]
pub struct Gate {
#[serde(default)]
pub r#type: GateType,
pub label: String,
#[serde(default)]
pub qasm: String,
#[serde(default)]
pub qubits: Vec<Qubit>,
#[serde(alias = "cbits", default)]
pub c_bits: Vec<C... | Rust | 0 |
Gate + SGate + CXGate> SteaneLayer<L>
where
L : Layer + PauliGate + HGate + SGate + CXGate,
L::Operation: Operation<L> + PauliOperation<L> + HOperation<L> + SOperation<L> + CXOperation<L>,
L::Qubit : NumCast,
L::Slot : NumCast,
{
fn measure_ancilla(&self) -> u32 {
//self.sim.... | Rust | 0 |
try_serialize(&mut claim_count_data)?;
}
Ok(())
}
/// Claims NFTs by calling MintNewEditionFromMasterEditionViaToken
pub fn claim_edition(
ctx: Context<ClaimEdition>,
claim_bump: u8,
index: u64,
amount: u64,
edition: u64,
claimant_secret: Pub... | Rust | 0 |
,
MT,
MU,
MV,
MW,
MX,
MY,
MZ,
NA,
NC,
NE,
NF,
NG,
NI,
NL,
NO,
NP,
NR,
NU,
NZ,
OM,
PA,
PE,
PF,
PG,
PH,
PK,
PL,
PM,
PN,
PR,
PS,
PT,
PW,
PY,
QA,
RE,
RO,
RS,
RU,
RW,
SA,
SB,
SC,
SD,
SE,
SG,
SH,
SI,
SJ,
SK,
SL,
SM,
SN,
SO,
SR,
SS,
ST,
SV,
SX,
SY,
SZ,
TC,
TD,
TF... | Rust | 0 |
p(labels, f_labels)
for _, alphabet, character in characters:
filenames = glob.glob(os.path.join(self.root, name,
alphabet, character, '*.png'))
dataset = group.create_dataset('{0}/{1}'.format(alphabet,
character), ... | Python | 1 |
thm) has not gone undergone extensive cryptanalysis like SipHash (the default hashing algorithm in Rust), but according to the authors, HighwayHash output bits are uniformly distributed and should withstand differential and rotational attacks. Hence HighwayHash is referred to as a strong hash function, not a cryptograp... | Rust | 0 |
ExternalNoBypass)
.start_lfclk();
let port0 = gpio::p0::Parts::new(cx.device.P0);
let led = port0
.p0_16
.into_push_pull_output(gpio::Level::Low)
.degrade();
let handler = ClusterHandler::new(led, cx.device.PWM0);
// MAC (EUI-48) address... | Rust | 0 |
_KEY_AGREEMENT_KEY_P256_1.id],
&ALICE_VERIFICATION_METHOD_KEY_AGREEM_P256.id,
&ALICE_VERIFICATION_METHOD_KEY_AGREEM_P256.id,
AuthCryptAlg::A256cbcHs512Ecdh1puA256kw,
)
.await;
_unpack_works_authcrypted_2way(
&MESSAGE_SIMPLE,
&BOB_SECRE... | Rust | 0 |
__all__ = ["parallel_xsvm", "utils", "explanations"] | Python | 1 |
height();
f64::from(preview_max_scroll_top) * textarea_scroll_percentage
};
preview.set_scroll_top(new_preview_scroll_top as i32);
}
})
}
#[wasm_bindgen(start)]
pub fn render() {
App::builder(update, view).build_and_start();
}
```
"#
),
secti... | Rust | 0 |
[] # (page_index, chunk_index_within_page)
for i, ptxt in enumerate(pages):
cs = chunk_text(ptxt, args.chunk_size, args.chunk_overlap)
if not cs:
continue
for j, c in enumerate(cs):
chunks.append(c)
locs.append((i+1, j))
print(f'METRIC chunks {len(chu... | Python | 1 |
import numpy as np
import pytest
from schematics import models
from schematics import types
from spins.goos.optplan import schema_types
def test_complex_type():
class Model(models.Model):
x = schema_types.ComplexNumberType()
model = Model({"x": 1 + 2j})
model.validate()
assert model.to_prim... | Python | 1 |
Args {
applications: Vec<Spanned<String>>,
all: bool,
}
fn which_single(
application: Spanned<String>,
all: bool,
engine_state: &EngineState,
cwd: impl AsRef<Path>,
paths: impl AsRef<OsStr>,
) -> Vec<Value> {
let (external, prog_name) = if application.item.starts_with('^') {
(tr... | Rust | 0 |
import numpy as np
def ssd(desc1, desc2):
'''
Sum of squared differences
Inputs:
- desc1: - (q1, feature_dim) descriptor for the first image
- desc2: - (q2, feature_dim) descriptor for the first image
Returns:
- distances: - (q1, q2) numpy array storing the squared distance... | Python | 1 |
= Box::new(NavParentSwitch__Element1::new(self.stream, self, _root)?);
},
}
}
}
impl NavParentSwitch {
}
#[derive(Default)]
pub struct NavParentSwitch__Element1 {
pub foo: u8,
pub subelement: Box<NavParentSwitch__Subelement1>,
}
impl KaitaiStruct for NavParentSwitch__Element1 {
fn... | Rust | 0 |
import nltk
from nltk.stem import RSLPStemmer
nltk.download('rslp')
def radicalizar(texto):
stemmer = RSLPStemmer()
texto_formatado = [stemmer.stem(palavra) for palavra in texto]
return texto_formatado
def remover_stopwords(texto):
stopwords = ("a à aí agora ainda alguém algum alguma algumas algun... | Python | 1 |
# model settings
norm_cfg = dict(type='SyncBN', requires_grad=True)
model = dict(
type='EncoderDecoder',
pretrained=None,
backbone=dict(
type='MALA',
embed_dims=[64, 128, 256, 512],
depths=[2, 2, 6, 2],
num_heads=[1, 2, 4, 8],
mlp_ratios=[3.5, 3.5, 3.5, 3.5],
... | Python | 1 |
# a functioin with no name
# def addition(a,b):
# return a+b
# print(addition(2,3))
# we can use lambda function instead of this
addition = lambda a,b,c:a+b-c
print(addition(2,3,1))
evenornot = lambda num:num%2==0
print(evenornot(12)) | Python | 1 |
# type casting = convert the data type of a value to another data type.
x = 1 #int
y = 2.0 #float
z = "3" #str
x = str(x)
y = int(y)
z = float(z) # changed str to float
print(x)
print(y)
print(z*3) # cant do math with a str, this is a float
# why would you want to convert a int or float into a str? Cu... | Python | 1 |
// This file is part of Substrate.
// Copyright (C) 2017-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the ... | Rust | 0 |
token_start..token_stop], token_stop)
}
#[test]
fn test_grab_alnum_token() {
assert_eq!(grab_alnum_token(" \t hel$lo world ", 3, 18), ("hel", 8));
assert_eq!(grab_alnum_token(" \t ", 1, 7), ("", 7));
assert_eq!(grab_alnum_token("", 0, 0), ("", 0));
assert_eq!(grab_alnum_token(" test,;comment ",... | Rust | 0 |
in_conductor_api::FullStateDump;
use holochain_conductor_api::InstalledAppInfo;
use holochain_conductor_api::JsonDump;
use holochain_keystore::MetaLairClient;
use holochain_p2p::actor::HolochainP2pRefToDna;
use holochain_p2p::event::HolochainP2pEvent;
use holochain_p2p::event::HolochainP2pEvent::*;
use holochain_p2p::D... | Rust | 0 |
00, 35, 45)
>>> output = m(input)
"""
def _check_input_dim(self, input):
if input.dim() != 4:
raise ValueError('expected 4D input (got {}D input)'
.format(input.dim()))
class GroupNorm3d(_GroupNorm):
"""
Assume the data format is (B, C, D, ... | Python | 1 |
set_checked(strides, &self.into_dimension())
}
#[inline]
fn index_unchecked(&self, _strides: &$ix_n) -> isize {
$(
stride_offset(self[$index], get!(_strides, $index)) +
)*
0
}
}
// implement... | Rust | 0 |
was just too hard and too messy. Perhaps if Rust permits `async fn` in
// traits one day, and `AsyncRead` is defined in terms of `async fn`, we could restore the old
// implementation from the Git history, and sprinkle some `async`/`.await` keywords on it.
async fn next_entry<R>(reader: &mut R, is_start: ... | Rust | 0 |
from,
subject,
body,
body_type: body_type.unwrap_or(BodyType::Plain),
reply_to,
}
}
}
#[derive(Debug, Serialize)]
pub(crate) struct TemplateContext<'c> {
key: Vec<&'c str>,
value: Vec<&'c str>,
}
impl<'c> From<HashMap<&'c str, &'c str>> ... | Rust | 0 |
import click
from datahub.telemetry import telemetry as telemetry_lib
@click.group()
def telemetry() -> None:
"""Toggle telemetry."""
pass
@telemetry.command()
@telemetry_lib.with_telemetry()
def enable() -> None:
"""Enable telemetry for the current DataHub instance."""
telemetry_lib.telemetry_inst... | Python | 1 |
alt_PointPaddedLayout);
}
extern "C" {
pub fn alt_PointPaddedLayout_Create_5_CAPI_Heap() -> *mut alt_PointPaddedLayout;
}
extern "C" {
pub fn alt_PointPaddedLayout_Create_6(
x: f32,
y: f32,
z: f32,
_returnValue: *mut alt_PointPaddedLayout,
);
}
extern "C" {
pub fn alt_Po... | Rust | 0 |
, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
use ::game::objects::game::PlayerStartingDistance;
use ::game::objects::planet::Planet;
use ::game::objects::fleet::ShipDesign;
use ::game::objects::fl... | Rust | 0 |
g of a PEM or DER encoded certificate
format -- "PEM or "DER"
"""
cert_bytes = ""
if format == "PEM":
# validate?
cert_bytes = pem_to_der(cert_str)
elif format == "DER":
cert_bytes = cert_str
handshake_len_bytes = struct.pack(">H", len(cert_bytes) + 10)
handshake_len... | Python | 1 |
_linear_transform<T: RescueParameter>(
&mut self,
input_var: &RescueNonNativeStateVar<F>,
matrix: &RescueMatrix<T>,
constant: &RescueVector<T>,
) -> Result<RescueNonNativeStateVar<F>, PlonkError>;
/// Define a constraint such that y = x^(1/alpha).
/// It is implemented by se... | Rust | 0 |
import heapq
def solution(operations):
min_heap = []
max_heap = []
visited = [0] * len(operations)
for i, oper in enumerate(operations):
command, num = oper.split()
num = int(num)
if command == 'I':
heapq.heappush(min_heap, (num, i))
heapq.heappush(max_... | Python | 1 |
from django.utils.datastructures import SortedDict
from django.db.models import get_model
from fields import StoreField
from exceptions import StoreException
def get_object_from_identifier(identifier, valid=None):
""" Helper function to resolve an item identifier
into a model instance.
Raises Stor... | Python | 1 |
self.span_queue.finish_span(local_span_handle.span_handle);
}
}
#[inline]
pub fn register_local_collector(&mut self) -> Option<LocalCollector> {
// Only allow one local collector per thread
if self.local_collector_existing {
return None;
}
self.local_co... | Rust | 0 |
pub const INT32_MAX: u32 = 2147483647;
pub const UINT8_MAX: u32 = 255;
pub const UINT16_MAX: u32 = 65535;
pub const UINT32_MAX: u32 = 4294967295;
pub const INT_LEAST8_MIN: i32 = -128;
pub const INT_LEAST16_MIN: i32 = -32768;
pub const INT_LEAST32_MIN: i32 = -2147483648;
pub const INT_LEA... | Rust | 0 |
(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)]
#[test]
fn lr_fit_predict_multiclass() {
let blobs = make_blobs(15, 4, 3);
let x = DenseMatrix::from_vec(15, 4, &blobs.data);
let y = blobs.target;
let lr = LogisticRegression::fit(&x, &y, Default::default()).unwra... | Rust | 0 |
preprocess_img(
os.path.join(
args.input_directory,
subject,
subject + args.input_image_suffix
),
filedict["image"],
args.zooms
)
if args.label_suffix is not None:
... | Python | 1 |
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct obs_data {
_unused: [u8; 0],
}
pub type obs_hotkey_func = Option<
unsafe extern "C" fn(
data: *mut c_void,
id: obs_hotkey_id,
hotkey: *mut obs_hotkey_t,
pressed: bool,
),
>;
pub type size_t = usize;
pub type obs_hotkey_id... | Rust | 0 |
}
// Encode a circle. Currently this has a lot of limitations and is mostly used for debugging
// and performance analysis, but could be expanded to the real thing.
pub fn circle(&mut self, circle: &Circle) {
let piet_circle = PietCircle {
item_type: ItemType::Circle,
};
... | Rust | 0 |
].parse::<usize>()?,
to: caps[2].parse::<usize>()?,
chr: caps[3].chars().next().unwrap()
},
password: caps[4].to_string()
})
}
}
fn read_input<R: Read>(reader: BufReader<R>) -> io::Result<Input> {
Ok(reader.lines().map(|l| l.unwrap().parse::<Row>(... | Rust | 0 |
"\.rs:[0-9]+:[0-9]+(: [0-9]+:[0-9]+)?" => ".rs:LL:CC",
// erase alloc ids
"alloc[0-9]+" => "ALLOC",
// erase Stacked Borrows tags
"<[0-9]+>" => "<TAG>",
// erase whitespace that differs between platforms
r" +at (.*\.rs)" => " at $1",
/... | Rust | 0 |
from setuptools import setup, find_packages
setup(
name='fastapi_grpc_bridge',
version='0.1.2',
packages=find_packages(),
install_requires=[
'fastapi',
'grpcio',
'grpcio-tools',
'pydantic',
'protobuf',
'uvicorn'
],
entry_points={
'console_... | Python | 1 |
import pathlib
import torch
import os
from urllib.parse import urlparse
from deep_privacy import logger, torch_utils
from deep_privacy.config import Config
from deep_privacy.inference.infer import load_model_from_checkpoint
from deep_privacy.inference.deep_privacy_anonymizer import DeepPrivacyAnonymizer
available_mode... | Python | 1 |
on here?",
"Can't you see what's happened?",
"I've become George.",
"(losing patience) Alright--would you just put her on?",
"Okay.",
"I had to carry my skis, and my boots and my poles.",
"I think I pinched a nerve in my shoulder.",
"It's the Urban Sombrero.",
"I put it on the cover.",
"Kurt!",
"(gr... | Rust | 0 |
ts: bool,
}
fn main() {
let args = App::new("bobomb-debugger")
.arg(
Arg::with_name("host")
.short("h")
.long("host")
.help("Hostname/IP address of Bobomb remote debugger API")
.takes_value(true),
)
.arg(
... | Rust | 0 |
})
} else {
Err(ErrorKind::InvalidInput.into())
}
}
fn block_batch<'a, T: Iterator<Item = &'a u64>>(&self, heights: T) -> Result<Vec<Block>> {
heights.map(|height| self.block(*height)).collect()
}
fn block_results(&self, height: ... | Rust | 0 |
]
pub mod fsm_status;
#[doc = "POSPULSE register accessor: an alias for `Reg<POSPULSE_SPEC>`"]
pub type POSPULSE = crate::Reg<pospulse::POSPULSE_SPEC>;
#[doc = "Autobaud high pulse register"]
pub mod pospulse;
#[doc = "NEGPULSE register accessor: an alias for `Reg<NEGPULSE_SPEC>`"]
pub type NEGPULSE = crate::Reg<negpul... | Rust | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.