text string | label_name string | labels int64 |
|---|---|---|
c));
}
#[test]
fn line_6() {
let a = Point::new(1, 1);
let b = Point::new(1, 0);
let l = Line::from(a, b);
let c = Point::new(1, 2);
assert!(l.is_on_line(&c));
}
#[test]
fn segment_1() {
let a = Point::new(0, 0);
let b = Point::new(7, 7);
let l = Line::from(a, b);
let c =... | Rust | 0 |
# https://dmoj.ca/problem/coci13c3p1
# ํฐ ํ๋ฉด๊ณผ ํ ๊ฐ์ ๋ฒํผ์ด ์๋ ์ฌ๋ฏธ์๋ ๊ธฐ๊ณ๊ฐ ์์. ๋ฒํผ์ ๋๋ฅด๋ฉด A -> B, B->BA ๊ท์น ๋ฐ๊ฒฌ
# ์
๋ ฅ์๋ ๋ฒํผ์ ๋๋ฅธ ํ์ ์ถ๋ ฅ์๋ ๋๊ฐ์ ๊ณต๋ฐฑ์ ์ฌ์ด์ ๋๊ณ A and B์ ๊ธ์ ์
# ์ค์ํ ์ฌํญ์ A,B์ ๊ฐ์๋ง ํ์. ์ด์ A๋ B๋ก ๋ฐ๋๊ณ , B๋ BA๋ก ๋ฐ๋๋ ๊ฒ์ ๊ฐฏ์๋ก ์นํ
# ์ด๋ฒ A๋ ์ด์ ์ B์ ๊ฐ์, ์ด๋ฒ B๋ ์ด์ A์ B์ ํฉ
press_button = input()
if not press_button.isdigit() :exit(f"{press_button}... | Python | 1 |
'a, CS, DataLoaderWrapper<'a, CS>> {
pub fn new(consensus: &'a Consensus, store: &'a CS) -> Self {
let data_loader = DataLoaderWrapper::new(store);
DaoCalculator {
consensus,
store,
data_loader,
}
}
pub fn primary_block_reward(&self, target: &Head... | Rust | 0 |
::{PathAndQuery, Scheme, Uri},
Error as HttpError, Version,
};
use httparse::{
Response as ResponseParser,
Status::{Complete, Partial},
EMPTY_HEADER,
};
#[cfg(feature = "native-tls")]
use native_tls::TlsConnector;
#[cfg(feature = "tls")]
use rustls::ClientConfig;
#[cfg(feature = "json")]
use serde::{de:... | Rust | 0 |
"""Test suite for Theme API endpoint."""
import json
from formsflow_api_utils.utils import get_token
payload = {
"logoName": "logo 2",
"type": "url",
"logoData": "61ef7aa2555663dsef",
"applicationTitle": "Public Plandsfsdf",
"themeJson": {"sample": "test123sdfsfsdf"},
}
def test_create_theme(ap... | Python | 1 |
onfig_path = "{}/{}".format(os.getcwd(), config_path)
if os.path.exists(config_path):
with open(config_path, "r") as f:
try:
data = f.read()
except (OSError, IOError) as e:
print("\nAn error occured while loading the host configs: {}".format(e))
... | Python | 1 |
t = int(input().strip())
for i in range(1, t + 1):
n, p = map(int, input().strip().split())
l = list(map(int, input().strip().split()))
c = [0] * p
for j in l:
c[j % p] += 1
r = c[0]
if p == 2:
r += (c[1] + 1) // 2
elif p == 3:
m = min(c[1], c[2])
r += m
... | Python | 1 |
Box::into_raw(Box::new(e)),
},
result_ok: false,
}
}
#[no_mangle]
/// Frees any resources used by the CResult_ClosingSignedFeeRangeDecodeErrorZ.
pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res: CResult_ClosingSignedFeeRangeDecodeErrorZ) { }
impl Drop for CResult_ClosingSignedFeeRangeDecodeEr... | Rust | 0 |
# Databricks notebook source
# MAGIC %md
# MAGIC # Run Unit Tests
# MAGIC This notebook runs the unit tests for all submodules in this repository using [PyTest](https://docs.pytest.org/en/stable/), following [best practice recommendations from Databricks](https://docs.databricks.com/aws/en/notebooks/testing).
# MAGIC
#... | Python | 1 |
AIN_IC_REQUEST);
buf.extend_from_slice(request_id.as_bytes());
buf
};
let signature_bytes = ed25519_keypair.sign(&bytes_to_sign).to_bytes();
BasicSigOf::new(BasicSig(signature_bytes.to_vec()))
};
let public_key = UserPublicKey {
key: ed25519_keypair.public... | Rust | 0 |
ntil<F: Future>( &self, future: F ) -> <F as Future>::Output
{
self.pool.borrow_mut().run_until( future )
}
///
//
pub(crate) fn try_run_one( &self ) -> bool
{
self.pool.borrow_mut().try_run_one()
}
///
//
pub(crate) fn run_until_stalled( &self )
{
self.pool.borrow_mut().run_until_stalled()
}
... | Rust | 0 |
le_path(target_path)
commands = [ '-i', temp_file_path ]
if isinstance(trim_frame_start, int):
start_time = trim_frame_start / output_video_fps
commands.extend([ '-ss', str(start_time) ])
if isinstance(trim_frame_end, int):
end_time = trim_frame_end / output_video_fps
commands.extend([ '-to', str(end_time) ... | Python | 1 |
error,
)
})?)
} else {
None
};
let max_gas_amount = if space_delim_strings.len() > 6 {
Some(space_delim_strings[6].parse::<u64>().map_err(|error| {
format_parse_data_error(
"max_gas_amoun... | Rust | 0 |
nrx4(
&mut self.buffer.sound_1,
&mut Line1Mapper {
mapper: &mut self.mapper,
},
&self.frame_sequencer,
address,
v,
);
}
0xFF19 => {
... | Rust | 0 |
});
});
}
#[test]
fn cancel_replace_tokens_succeeds() {
run_test(|| {
let old_id = create_sample_vault();
let new_id = create_vault(OTHER_ID);
let new_id_copy = new_id.clone();
currency::Amount::<Test>::lock_on.mock_safe(move |amount, sender| {
assert_eq!(send... | Rust | 0 |
# โฑ 2 min
# 16. Use a chained comparison to check if x is greater than 3 and less than 10
# Input:
#x = 5
# Output:
#True
x = 5
if 3 < x <10:
print (True) | Python | 1 |
# List items are ordered, changeable, and allow duplicate values.
some_list = ['apple', 'banana', 'cherry']
print(some_list)
print(len(some_list))
# lists' data type
print(type(some_list))
# The list() Constructor
this_list = list(('apple', 'banana', 'cherry'))
print(this_list)
#ACCESS LIST ITEMS
some_list_1 = ... | Python | 1 |
_input):
"""Layers used during upsampling"""
u = UpSampling2D(size=2)(layer_input)
u = Conv2D(256, kernel_size=3, strides=1, padding='same')(u)
u = Activation('relu')(u)
return u
def res_mult_2x(layer_input):
l1 = Conv2D(64, kernel_size=4, ... | Python | 1 |
// https://github.com/rust-lang/rust/issues/47312
span: Span::call_site(),
}),
};
let span = field.span();
let doc = MetaItem::get_docs(&field.attrs);
let deprecated = MetaItem::get_deprecated(&field.attrs);
let flags = MetaItem::with_name(&field.attrs... | Rust | 0 |
.target(module_path!())
.file(Some(filename))
.line(Some(line))
.level(lvl)
.build(),
);
}
/// This function configures the logging format. The loglevel is also processed
/// here i.e `RUST_LOG=mayastor=TRACE` will print all trace!() and higher
/// messages ... | Rust | 0 |
ER_1)
_create_machine_account(supplier2, 'ldap/%s' % HOST_SUPPLIER_2)
# Set on the cn=replica config to accept the other suppliers princ mapping under mapping tree
_allow_machine_account(supplier1, 'ldap/%s' % HOST_SUPPLIER_2)
_allow_machine_account(supplier2, 'ldap/%s' % HOST_SUPPLIER_1)
#
# ... | Python | 1 |
self._DeleteParamSet = DeleteParamSet
def _deserialize(self, params):
self._TemplateId = params.get("TemplateId")
self._TemplateName = params.get("TemplateName")
self._TemplateDescription = params.get("TemplateDescription")
if params.get("ModifyParamEntrySet") is not None:
... | Python | 1 |
// use pyo3::wrap_pyfunction;
pub mod pygraph;
pub mod pyordgraph;
pub mod pydtfgraph;
mod vmap;
mod ducktype;
use pyo3::exceptions::*;
use pyo3::ToPyObject;
use pyo3::types::PyTuple;
use graphbench::graph::{Vertex, Graph};
use graphbench::iterators::*;
use crate::pygraph::*;
use crate::pyordgraph::*;
use crate::py... | Rust | 0 |
# THIS FILE IS PART OF THE CYLC WORKFLOW ENGINE.
# Copyright (C) NIWA & British Crown (Met Office) & Contributors.
#
# 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 Free Software Foundation, either version 3 of the Licen... | Python | 1 |
tcx, 'tcx>,
mir: &Mir<'tcx>,
ctxt: &MoveDataParamEnv<'tcx>,
mut callback: F)
where F: FnMut(MovePathIndex, DropFlagState)
{
let move_data = &ctxt.move_data;
for arg in mir.args_iter() {
let lvalue = mir::Lvalue::Local(arg);
let lookup_result = move_data.rev_lookup.find(&lvalue);
... | Rust | 0 |
from __future__ import annotations
import math
from collections.abc import Mapping
from functools import partial
from types import MappingProxyType
from typing import Any
import torch
import torch.nn as nn
from torchvision.ops.misc import FrozenBatchNorm2d
def _get_cosine_schedule_with_warmup_lr_lambda(
current... | Python | 1 |
position = index
# Select word around cursor on double click.
# Two MOUSE_UP events in a short timespan are considered a double click.
double_click = self._last_click_timestamp and time.time() - self._last_click_timestamp < .3
self._last_c... | Python | 1 |
#!/usr/bin/env python
#Copyright (c) 2006, Brian Gerkey
#All rights reserved.
#
#Redistribution and use in source and binary forms, with or without
#modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this ... | Python | 1 |
f32 {
1.0 / (1.0 + (input * -1.0f32 * response).exp())
}
///ใๆฑๆฟๆดปๅฝๆฐๅฏผๆฐ
pub fn back_propagation(activation: f32) -> f32 {
activation * (1.0f32 - activation)
}
/// ้ขๅค็่พๅ
ฅๅผ๏ผๆ ๅช้ณ๏ผ
pub fn prepare_inputs_no_noise(inputs: &[u8; IMAGE_SIZE]) -> Vec<f32> {
let mut output = Vec::with_capacity(IMAGE_SIZE);
for inde... | Rust | 0 |
64;
const NUM_BUCKETS: u32 = BUCKETS_X * BUCKETS_Y;
const BOUND_X: f32 = 16384.0;
const BOUND_Y: f32 = 8192.0;
const BUCKET_SIZE_X: f32 = 32768.0 / (BUCKETS_X - 1) as f32;
const BUCKET_SIZE_Y: f32 = 16384.0 / (BUCKETS_Y - 1) as f32;
const INV_BX: f32 = 1.0 / BUCKET_SIZE_X;
const INV_BY: f32 = 1.0 / BUCKET_SIZE_Y;
///... | Rust | 0 |
;
use circle_safe_ext::Circle;
mod circle_safe_int;
use circle_safe_int::Circle as C;
fn main() {
let mut circle: C<i32> = C::new();
circle.push_after(42);
circle.push_after(50);
circle.push_after(49);
circle.push_after(48);
circle.push_after(47);
circle.push_after(46);
circle.push_afte... | Rust | 0 |
Arg::with_name("service_ip")
.help("IP address of remote shell service")
.short("i")
.takes_value(true)
.default_value("0.0.0.0"),
)
.arg(
Arg::with_name("service_port")
.help("Port number of remote s... | Rust | 0 |
import copy
import random
import cv2
import time
import os
import tifffile
import pandas as pd
import numpy as np
import argparse
import logging
from data_toolbox import *
from yacs.config import CfgNode as CN
from scatter_detector import *
class ScatterDataForVideo:
def __init__(self, gts):
self.gts = s... | Python | 1 |
20news-bydate.tar.gz")
.unwrap();
{
let mut transfer = easy.transfer();
transfer
.write_function(|new_data| {
data.extend_from_slice(new_data);
Ok(new_data.len())
})
.unwrap();
transfer.perform().unwrap();
}
... | Rust | 0 |
EST_DIR")).join("languages");
for entry in fs::read_dir(path)? {
let entry = entry?;
let path = entry.path();
if !entry.file_type()?.is_dir() {
continue;
}
let dir = path.file_name().unwrap().to_str().unwrap().to_string();
// filter ignores
if ... | Rust | 0 |
tf.logging.info("***** Running evaluation *****")
tf.logging.info(" Num examples = %d", len(eval_examples))
tf.logging.info(" Batch size = %d", self.batch_size)
eval_input_fn = self.file_based_input_fn_builder(
input_file=eval_file,
seq_length=args.max_seq_len,
... | Python | 1 |
mbtc "OP_DUP OP_HASH160 [745e5b81fd30ca1e90311b012badabaa4411ae1a]'
' OP_EQUALVERIFY OP_CHECKSIG">')
def test_coinbase_tx(self):
tx = Tx.coinbase_tx(COINBASE_PUB_KEY_FROM_80971, int(50 * 1e8), COINBASE_BYTES_FROM_80971)
s = io.BytesIO()
tx.stream(s)
tx1 = s.getvalue()
... | Python | 1 |
let input = "Man is distinguished, not only by his reason, but by this singular passion from other animals, which is a lust of the mind, that by a perseverance of delight in the continued and indefatigable generation of knowledge, exceeds the short vehemence of any carnal pleasure.";
write!(bytes, "{}"... | Rust | 0 |
.unwrap();
ws.swap_remove(wi);
return false;
}
}
e.remove_entry();
true
}
Entry::Vacant(_) => unreachable!(),
}
}
#[cfg(test)]
mod test {
// Nothing really worth testing here
}
use std::syn... | Rust | 0 |
ples)).requires_grad_(True)
d_interpolates = D(interpolates)
fake = torch.ones(d_interpolates.size())
if torch.cuda.is_available():
fake = fake.cuda()
gradients = torch.autograd.grad(
outputs=d_interpolates,
inputs=interpolates,
grad_outputs=fake,
create_graph=True,
reta... | Python | 1 |
false }
));
assert_ok!(Staking::validate(
Origin::signed(10),
ValidatorPrefs { commission: Perbill::from_percent(15), blocked: false }
));
})
}
#[test]
fn change_of_max_nominations() {
use frame_election_provider_support::ElectionDataProvider;
ExtBuilder::default()
.add_staker(60, 61, 10, StakerStatu... | Rust | 0 |
composite.is_checked("Show heatmap") {
Some(HeatmapOptions::from_controls(&self.composite))
} else {
None
};
Options {
heatmap,
state: self.composite.dropdown_value("seir"),
}
}
}
// TODO This should live in sim
#[derive(Clone, Copy, P... | Rust | 0 |
commands = """
\"C:\Program Files\Windows Defender\MpCmdRun.exe\" -RemoveDefinitions -All
"""
await sliver_executor.cmd(session_id=sliver_sessionid,input_commands=commands)
print_finished_message()
confirm_action()
commands = """
reg add \"HKEY_CURRENT_USER\Software\Microsoft\Windows\C... | Python | 1 |
rt.new_assigned_tasks_cpus(&[&[
4, 4, 4, /* 12 */ 4, 4, 4, /* 12 */ 4, 4, 4, /* 12 */
]]);
rt.balance();
assert_eq!(rt.worker_load(100).get_n_cpus(), 12);
assert_eq!(rt.worker_load(101).get_n_cpus(), 12);
assert_eq!(rt.worker_load(102).get_n_cpus(), 12);
}
#[test]
fn test_resource_balancing... | Rust | 0 |
ame, 'se.pth')
# if os.path.isfile(se_path):
# se = torch.load(se_path).to(device)
# return se, audio_name
# if os.path.isdir(audio_path):
# wavs_folder = audio_path
# if vad:
# wavs_folder = split_audio_vad(audio_path, target_dir=target_dir, audio_name=audio_name)
... | Python | 1 |
///
/// Checks if path is static & valid
///
pub fn check(input: &str) -> Result<bool, String> {
let node = Parser::compile(input)?;
let mut visitor = NodeVisitorImpl {
valid: VisitStatus::PartialValid,
last_token: None,
};
visitor.visit(&node);
... | Rust | 0 |
_offsets.clone()], endian).into(),
EndianSlice::new(&[], endian),
)?;
Ok(Some(SymbolizeContext {
// See comments on `SymbolizeContext` for why we do this static
// lifetime promotion.
inner: unsafe {
std::mem::transmute::<Addr2LineContext<'... | Rust | 0 |
import re
import json
from pathlib import Path
from urllib import parse, request
from urllib.error import HTTPError
def read(fn: str):
return json.loads(Path(f"./{fn}").read_text(encoding="UTF-8"))
def write(fn: str, content):
Path(f"./{fn}").write_text(
json.dumps(content, ensure_ascii=False, inden... | Python | 1 |
import numpy as np
import pandas as pd
from sklearn.model_selection import KFold
from sklearn import tree
from sklearn.metrics import roc_auc_score
from sklearn.metrics import recall_score
from sklearn.metrics import precision_score
from sklearn.metrics import accuracy_score
from sklearn.metrics import f1_score
from sk... | Python | 1 |