text string | label_name string | labels int64 |
|---|---|---|
CreateTableStmt<'a> {
pub if_not_exists: bool,
pub catalog: Option<Identifier<'a>>,
pub database: Option<Identifier<'a>>,
pub table: Identifier<'a>,
pub source: Option<CreateTableSource<'a>>,
pub table_options: Vec<TableOption>,
pub cluster_by: Vec<Expr<'a>>,
pub as_query: Option<Box<Qu... | Rust | 0 |
(Some(&resources::load_svg(resources::ToolbarIcon::ZoomIn, icon_size).unwrap()), None);
btn_zoom_in.set_tooltip_text(Some("Zoom in"));
btn_zoom_in.connect_clicked(clone!(@weak program_data_rc => @default-panic, move |_| {
program_data_rc.borrow_mut().gui.as_mut().unwrap().preview_area.change_zoom(ZOOM_C... | Rust | 0 |
| None = Field( # type: ignore
default=None,
alias="reason",
title="State change reason",
description=(
"The reason for the state change. If coded it should follow the formal"
" subject state model."
),
json_schema_extra={
"element_pr... | Python | 1 |
API_KEYS = {
'BINANCE': {
'api_key': 'bfVNWlyXlddsA4oZiePZncsMZMCt5Vw4TDvmPnTnNClS2LkcGww7M5PMvWv9iJ8l',
'secret': 'qtad8o3t7gXXt800ZNgfW8Xh8ZPIkFWVIuTox61QgbfL1pmob36545wwcptHpuxZ'
},
'BITGET': {
'api_key': 'bg_11d24e8803df95306a4abdccf920a1a5',
'secret': 'f5ebd4b031c6ee14b1... | Python | 1 |
&'timeline self, timeline: &'timeline DataTimelineCell<T>, query: &Q)-> DataTimelineCellReadGuard<'timeline, T::QueryResult> {
Ref::map(timeline.data.borrow(), |timeline| DataTimelineQueryRefableWith::<Q>::query_ref (timeline, query, self.extended_now()))
}
}
impl <B: Basics> Accessor for SnapshotHandle <B> {
t... | Rust | 0 |
t_eq!(move_info.promo_piece(), PieceType::R);
let move_flag = MoveFlag::Promotion {
capture: false,
prom: PieceType::K,
};
let pre_move_info = PreMoveInfo {
src: SQ(9),
dst: SQ(42),
flags: move_flag,
};
let move_info = BitMove::init(pre_move_info);
assert... | Rust | 0 |
Record::default();
if object.hit(ray, t_min, closest, &mut iter_record) {
hit_anything = true;
closest = iter_record.t;
record.t = iter_record.t;
record.point = iter_record.point;
record.normal = iter_record.normal;
... | Rust | 0 |
from django.db import models
from django.contrib.auth.models import User
import random
import string
# Create your models here.
class ShortenedURL(models.Model):
user = models.ForeignKey(User, on_delete=models.CASCADE)
original_url = models.URLField(max_length=2048)
short_code = models.CharField(max_length... | Python | 1 |
else {
println!("socket option is required!");
}
}
fn print_usage(program: &str, opts: &Options) {
let brief = format!("Usage: {} [options]", program);
print!("{}", opts.usage(&brief));
}
//! `graphalgs` is a graph algorithms library based on the Rust
//! [petgraph](https://docs.rs/petgraph/0.5.1/... | Rust | 0 |
());
b.resize(coeffs_a + coeffs_b, E::Fr::zero());
let mut a = EvaluationDomain::<E>::from_coeffs(a).unwrap();
let mut b = EvaluationDomain::<E>::from_coeffs(b).unwrap();
a.fft(&worker, &mut None).unwrap();
b.fft(&work... | Rust | 0 |
crate::repo::file::FileRepo
/// [`FileRepo::archive`]: crate::repo::file::FileRepo::archive
/// [`FileRepo::extract`]: crate::repo::file::FileRepo::extract
#[derive(Debug, PartialEq, Eq, Clone, Serialize, Deserialize)]
pub struct Entry<S, M> {
/// The type of file this entry represents.
pub kind: EntryType<S>,
... | Rust | 0 |
#!/usr/bin/env python
from Numeric import *
from FFT import *
def make_random(len):
import random
res=[]
for i in range(int(len)):
r=random.uniform(-1,1)
i=random.uniform(-1,1)
res.append( complex(r,i) )
return res
def slowfilter(sig,h):
translen = len(h)-1
return conv... | Python | 1 |
compile-flags:--test
// ignore-emscripten
// ignore-sgx no thread sleep support
use std::sync::mpsc::channel;
use std::sync::mpsc::TryRecvError;
use std::sync::mpsc::RecvError;
use std::sync::mpsc::RecvTimeoutError;
use std::sync::Arc;
use std::sync::atomic::AtomicUsize;
use std::sync::atomic::Ordering;
use std::thr... | Rust | 0 |
nary_cases, test_equal};
fn test_generic_string_equal<O: Offset>() {
let cases = binary_cases();
for (lhs, rhs, expected) in cases {
let lhs = lhs.iter().map(|x| x.as_deref()).collect::<Vec<_>>();
let rhs = rhs.iter().map(|x| x.as_deref()).collect::<Vec<_>>();
let lhs = Utf8Array::<O>:... | Rust | 0 |
};
old_nout = nout;
};
steps += 1;
};
};
panic!("no solution found");
}
// Copyright (c) Meta Platforms, Inc. and affiliates.
//
// This source code is licensed under the MIT license found in the
// LICENSE file in the "hack" directory of this source tree.
#[deri... | Rust | 0 |
00"/>
<a:shade val="99000"/>
<a:satMod val="350000"/>
</a:schemeClr>
</a:gs>
<a:gs pos="100000">
<a:schemeClr val="phClr">
<a:shade val="20000"/>
<a:satMod val="255000"/>
</a:schemeClr>
... | Python | 1 |
zip_container.c")
.file("lib/sfnt2woff-zopfli/hash.c")
.file("lib/sfnt2woff-zopfli/katajainen.c")
.file("lib/sfnt2woff-zopfli/lz77.c")
.file("lib/sfnt2woff-zopfli/squeeze.c")
.file("lib/sfnt2woff-zopfli/tree.c")
.file("lib/sfnt2woff-zopfli/util.c")
.file("lib/sfnt... | Rust | 0 |
"pd_op.full",
)
self.assertEqual(len(main_program.global_block().ops), 5)
def test_mean_vjp2(self):
main_program, start_program = (
paddle.static.Program(),
paddle.static.Program(),
)
with paddle.static.program_guard(main_program... | Python | 1 |
ere
I: Iterator<Item = Point>,
{
line.skip_while(|p| get_seat(p, grid) == '.').next()
}
fn get_in_line_of_sight(grid: &[Row], point: &Point) -> Vec<Point> {
let (max_x, max_y) = get_bounds(grid);
let (px, py) = point.to_owned();
macro_rules! fs {
($i:expr) => {
first_seat($i, g... | Rust | 0 |
} else {
assert!(false);
}
}
{
println!(
"<======================= Test with (\"a\": 1, \"b\": [2,3]) =====================>"
);
let it = SequenceBuffer::new(&[0xa2, 0x61, 0x61, 0x01, 0x61, 0x62, 0x82, 0x02, 0x03])
.into_iter();
... | Rust | 0 |
mmy(zero=True, finite=False))
pytest.raises(InconsistentAssumptions, lambda: Dummy(zero=True, infinite=True))
def test_sympyissue_8642():
x = Symbol('x', extended_real=True, integer=False)
assert (x*2).is_integer is None
def test_sympyissue_10024():
x = Dummy('x')
assert Mod(x, 2*pi).is_zero is ... | Python | 1 |
weight, delay, "all_to_all")
def test_connect_arrays_nonunique(self):
"""Connecting NumPy arrays with non-unique node IDs with MPI"""
n = 10
nest.Create("iaf_psc_alpha", n)
sources = np.arange(1, n + 1, dtype=np.uint64)
targets = self.non_unique
weights = np.ones(n)
... | Python | 1 |
1818c93fe7f250" \
"5252d9176958b64cc5a7a6c2b99b6adebc3a66e3c07d2343ec0072fc32645100" \
"95b34ebe7f09870e34e155ef3c2c542bfff412c7d6b6f6fc90b0a95a635eed0f" \
"a50a126a5d24b78c915c210dbf5e92633f83f282d0b9e4e0a47f49f... | Python | 1 |
# Copyright (c) 2020, NVIDIA CORPORATION. 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 |
1 => ssr.repeat_bound = value as u16,
2..=5 => *ssr.bound.get_unchecked_mut(addr - 2) = value,
6..=9 => *ssr.stride.get_unchecked_mut(addr - 6) = value,
10 => ssr.idx_size = value,
11 => ssr.idx_base = value,
12 => ssr.idx_shift = value,
// Indirection supports 1 lo... | Rust | 0 |
from collections import deque
def solution(n, wires):
answer = -1
'''
송전탑 선 하나를 없앨거임
bfs 할꺼임
set으로 진행하면 어떨까?
배열로 하면 find해서 삭제하는데 o(n)이니까 set에 저장?
그러면 노드 배열 안에 set 저장?
'''
minn = 100000
graph = [set() for _ in range(n+1)]
for wa, wb in wires:
graph[wa].a... | Python | 1 |
ILE|CREATE_TEST_SOURCELIST|'
# r'ELSE|ELSEIF|ENABLE_LANGUAGE|ENABLE_TESTING|ENDFOREACH|'
# r'ENDFUNCTION|ENDIF|ENDMACRO|ENDWHILE|EXEC_PROGRAM|'
# r'EXECUTE_PROCESS|EXPORT_LIBRARY_DEPENDENCIES|FILE|FIND_FILE|'
# r'FIND_LIBRARY|FIND_PACKAGE|FIND_PATH|FIND_PROGRAM|FLTK_WRAP_... | Python | 1 |
from .modeling import *
from ._deeplab import convert_to_separable_conv | Python | 1 |
import nltk
from nltk.translate.meteor_score import meteor_score
import sacrebleu
import json
import numpy as np
from rdkit import Chem
import selfies as sf
import math
import os
import logging
def calculate_accuracy(gold_label_list, pred_label_list):
# 断言保证预测和金标列表长度相同
assert len(pred_label_list) == len(
... | Python | 1 |
prelude::{Cube, Face::*, Move, MoveVariant};
/// use cubesim::FaceletCube;
///
/// let solved_cube = FaceletCube::new(3);
/// let turned_cube = solved_cube.apply_move(Move::U(MoveVariant::Standard));
/// assert_eq!(turned_cube.state(), vec![
/// U, U, U, U, U, U, U, U, U,
/// B, B, B... | Rust | 0 |
= euler(derivative_fn, input_state, step_size=step_size)
rk4_output = rk4(derivative_fn, input_state, step_size=step_size)
heun_output = heun(derivative_fn, input_state, step_size=step_size)
# All methods should give same result for constant derivative
assert torch.allclose(euler_output... | Python | 1 |
e) -> Result<()> {
/// subsys.request_shutdown();
/// Ok(())
/// }
///
/// #[tokio::main]
/// async fn main() -> Result<()> {
/// // Create toplevel
/// Toplevel::new()
/// .start("MySubsystem", my_subsystem)
/// .catch_signals()
/// .handle_shutdown_requests(Duration::from_milli... | Rust | 0 |
import math
number = 25
square_root = math.sqrt(number)
print(f"Square root of {number} is:", square_root)
angle = math.radians(45)
sin_value = math.sin(angle)
cos_value = math.cos(angle)
print("Sine of 45 degrees:", sin_value)
print("Cosine of 45 degrees:", cos_value) | Python | 1 |
PCA9544A is a quad bidirectional translating switch controlled via the
//! > I2C bus. The SCL/SDA upstream pair fans out to four downstream pairs, or
//! > channels. One SCL/SDA pair can be selected at a time, and this is
//! > determined by the contents of the programmable control register. Four
//! > interrupt input... | Rust | 0 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright (C) 2013-2016 DNAnexus, Inc.
#
# This file is part of dx-toolkit (DNAnexus platform client libraries).
#
# 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 ... | Python | 1 |
, "1/2"),
("1/3", "2/1", "2/3"),
("3/8", "2/5", "3/20")
};
for &(ref l, ref r, ref a) in cases.iter() {
assert_mp_eq!(l * r, *a);
}
}
#[test]
fn div() {
let cases = binop_cases! {
("0/1", "1/1", "0/1"),
("1/1", "1/... | Rust | 0 |
|| c == ']'
}
fn is_combined(c: char) -> bool {
is_global(c) || is_non_ascii(c)
}
#[cfg(test)]
mod test {
use super::*;
#[test]
fn is_label_correct() {
for l in &["a", "ab", "a-b", "a--b", "0Z"] {
assert!(is_label(l));
}
}
#[test]
fn is_label_incorrect() {
... | Rust | 0 |
ailure)?;
// Continue tracking interface IDs for which deletion fails.
let mut lingering_ifaces = HashSet::new();
for iface_id in phy_container.ap_ifaces.drain() {
match destroy_iface(&self.device_monitor, iface_id).await {
Ok(()) => {}
... | Rust | 0 |
std::time::Instant;
/// let data = [1, 2, 3, 4, 5];
/// let mut result : Vec<&i32> = vec![&data[0]; 3];
/// let shared = Rc::new(RefCell::new(result.as_mut_slice()));
/// let mut permutator = KPermutationCellIter::new(&data, 3, Rc::clone(&shared));
/// let mut counter = 0;
/// let timer = Instant::no... | Rust | 0 |
ttr/satellite_observation_point_longitude": "21.44",
}
data = self._get_data(num_scans, num_cols)
test_content = {}
test_content.update(global_attrs)
test_content.update(data)
return test_content
class TestMSUGSABReader:
"""Test MSU GS/A L1B Reader."""
yaml_f... | Python | 1 |
#[inline]
fn bitor_assign(&mut self, rhs: ibv_wc_flags) {
self.0 |= rhs.0;
}
}
impl ::std::ops::BitAnd<ibv_wc_flags> for ibv_wc_flags {
type Output = Self;
#[inline]
fn bitand(self, other: Self) -> Self {
ibv_wc_flags(self.0 & other.0)
}
}
impl ::std::ops::BitAndAssign for i... | Rust | 0 |
as 0.
let inputx = inputx - 0.5;
let mut ws = Vec::with_capacity((right - left) as usize);
let mut sum = 0.0;
for i in left..right {
let w = (filter.kernel)((i as f32 - inputx) / sratio);
ws.push(w);
sum += w;
... | Rust | 0 |
}
}
}
derive_ops!(Add, add);
derive_ops!(Sub, sub);
derive_ops!(Mul, mul);
derive_ops!(Div, div);
impl Zero for HwFloat {
#[inline]
fn zero() -> HwFloat {
HwFloat(0.0)
}
#[inline]
fn is_zero(&self) -> bool {
self.0 == 0.0
}
}
impl One for HwFloat {
#[inline]
... | Rust | 0 |
o remain in the ObserverList after one of
/// the FdEvents that the waiter is waiting for occurs.
persistent: bool,
}
/// A list of waiters waiting for FdEvents.
///
/// For FdEvents that are generated inside Starnix, we walk the observer list
/// on the thread that triggered the event to notify the waiters th... | Rust | 0 |
rocess_name
}
}
}
impl fmt::Debug for HLECodeSetImpl {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "CodeSetImpl({:?})", self.process_name)
}
}
impl KCodeSet for HLECodeSetImpl {
fn create_process(&self, kctx: &mut kernel::Kernel) {
let (pid, _) = kctx.new_p... | Rust | 0 |
mat for TypeNameFormat {}
impl <T> Format<T> for TypeNameFormat {
fn to_string(_: &T) -> String {
type_name::<T>().to_string()
}
}<gh_stars>10-100
use colored::*;
use kataru::*;
use linear_map::LinearMap;
use regex::{Captures, Regex};
use std::{
borrow::Cow,
io::{stdin, stdout, Write},
};
#[mac... | Rust | 0 |
'''
Fishsauce
'''
def min_cost_to_reach_any_point(T, games):
from math import gcd
from collections import defaultdict
import sys
results = []
for game in games:
n, a, c = game
gcd_cost_map = {0: 0} # Dictionary to store minimum cost for each GCD
for i in ... | Python | 1 |
tq.expect(&TokenKind::Colon)?;
let parse_match_case = |tq: &mut TokenQueue, indent_level: usize, target: &Target| {
let pattern = parse_pattern(tq, indent_level, target)?;
let tok = tq.expect(&TokenKind::FatArrow)?;
let t = parse_block(tq, &tok.span.file, indent_level, target)?;
... | Rust | 0 |
let extra = if !descriptors.is_empty() {
let ty = syn::parse_str(&cls.to_string()).expect("no name");
let desc_impls = impl_descriptors(&ty, descriptors);
quote! {
#desc_impls
#extra
}
} else {
extra
};
// insert space for weak ref
l... | Rust | 0 |
== table_name,
TableSchema.is_active == True
)
).first()
if table_schema:
table_schema.columns_info = schema_info.get("columns", [])
... | Python | 1 |
x"]
_011,
#[doc = r" Reserved"]
_Reserved(u8),
}
impl LLSMR {
#[doc = r" Value of the field as raw bits"]
#[inline]
pub fn bits(&self) -> u8 {
match *self {
LLSMR::_000 => 0,
LLSMR::_001 => 1,
LLSMR::_010 => 2,
LLSMR::_011 => 3,
... | Rust | 0 |
# -*- coding: utf-8 -*-
"""
Parse commandline options.
Note that none of these are advertised as they solely exist for testing and
development purposes.
"""
import sys
# Use only ascii? (DON'T)
ascii = "--ascii" in sys.argv[1:]
# Debug level (default: 0 = off). >= 1 prints debug messages
if "-d2" in sys.argv[1:] ... | Python | 1 |
ve been replaced with entities)::
unicode \\[0-9a-f]{1,4}
latin1 [¡-ÿ]
escape {unicode}|\\[ -~¡-ÿ]
nmchar [-a-z0-9]|{latin1}|{escape}
name {nmchar}+
The CSS1 "nmchar" rule does not include underscores ("_"), colons (... | Python | 1 |
full_path = base_path / filepath
if full_path.exists():
total_lines += len(full_path.read_text().splitlines())
print(f" • Total lines of code: {total_lines:,}")
print(f" • Core modules: {implemented}")
print(f" • Documentation files: {doc_count}")
print(f" • Test ... | Python | 1 |
from ultralytics import YOLO
model = YOLO("yolo11x.pt")
results = model.val(data="data.yaml", batch=1, device="0")
print(f'P: {results.box.mp:.4f}')
print(f'R: {results.box.mp:.4f}')
print(f'mAP50: {results.box.map50:.4f}')
print(f'mAP50-95: {results.box.map:.4f}')
| Python | 1 |
objPoints, imgPoints = self.charuco_board.matchImagePoints(charuco_corners, charuco_ids)
if paint:
cv2.aruco.drawDetectedCornersCharuco(ret_img, charuco_corners, charuco_ids, cornerColor=(0, 255, 0))
cv2.aruco.drawDetectedMarkers(ret_img, src_markerCorners, src_markerIds, bor... | Python | 1 |
PI;
}
let sin_phi: Float = phi.sin();
let cos_phi: Float = phi.cos();
let alpha_x2: Float = self.alpha_x * self.alpha_x;
let alpha_y2: Float = self.alpha_y * self.alpha_y;
tan_2_theta =
-log_sample / (co... | Rust | 0 |
lf.scrapeops_api_key}
if self.scrapeops_num_results is not None:
payload['num_results'] = self.scrapeops_num_results
response = requests.get(self.scrapeops_endpoint, params=urlencode(payload))
json_response = response.json()
self.headers_list = json_response.get('result', [])... | Python | 1 |
counter should be at least 3 bits!",
Self::debug()
);
assert!(
Self::USED_BITS <= WIDTH,
"invalid Config: {:#?}\ntotal number of bits per index is too large to fit in a word!",
Self::debug()
);
assert!(
WIDTH - Self::USED_BIT... | Rust | 0 |
from django.utils.version import get_version
VERSION = (4, 2, 21, "final", 0)
__version__ = get_version(VERSION)
def setup(set_prefix=True):
"""
Configure the settings (this happens as a side effect of accessing the
first setting), configure logging and populate the app registry.
Set the thread-loca... | Python | 1 |
.to_vec();
constants_for_partial_rounds.push([E::Fr::zero(); WIDTH]);
// in order to reduce gate number we merge two consecutive iteration
// which costs 2 gates per each
for (round_constant, sparse_matrix) in constants_for_partial_rounds
[..constants_for_partial_rounds.len() - 1]
.chun... | Rust | 0 |
color: yellow;\r\
\n}"
)
.unwrap_err(),
"Error: expected \"{\".\
\n ,\
\n3 | color: red;\
\n | ^\
\n \'\
\n input.scss 3:13 root stylesheet",
);
}
<filename>website/website/src/components/date_picker.rs
use calendar... | Rust | 0 |
__(self, *exc_info):
self.disable()
# ____________________________________________________________
def label(code):
if isinstance(code, str):
return ('~', 0, code) # built-in functions ('~' sorts at the end)
else:
return (code.co_filename, code.co_firstlineno, code.co_name)
# _____... | Python | 1 |
("both", [[0.99, 0.01], [1, 0], [0.97, 0.03], [0.18, 0.82]]),
],
)
def test_predict_proba(mocker, evidence_type, expected_probas):
subjective_model = SubjectiveClassifier(
estimator=RandomForestClassifier(), prior={0: 0.8, 1: 0.2}, evidence=evidence_type
)
def mock_confusion_matrix(y, ... | Python | 1 |
Reader = R;
}
#[doc = "`reset()` method sets DAINT to value 0"]
impl crate::Resettable for DAINT_SPEC {
#[inline(always)]
fn reset_value() -> Self::Ux {
0
}
}
<reponame>Guilucand/genome-assembly<gh_stars>0
pub mod cn_nthash;
pub mod cn_seqhash;
pub mod fw_nthash;
pub mod fw_seqhash;
mod nthash_base;... | Rust | 0 |
BytePosition => "bytes",
SizeBytes => "size_bytes",
SizeBits => "size_bits",
ElementSizeBytes => "element_size_bytes",
ElementSizeBits => "element_size_bits",
Ty => "ty"
}
}
}
pub enum PackFieldAttribute {
IntEndiannes(IntegerEndia... | Rust | 0 |
be_knowledge_base(), lines=8, label="📚 你的知识库")
status_box = gr.Textbox(label="🛠️ 状态提示", interactive=False)
update_btn = gr.Button("🔁 重新构建知识库")
def run_ingest_and_refresh():
msg = run_ingest()
return list_books_from_folder(), describe_knowledge_base... | Python | 1 |
import torch
import torch.nn as nn
from ..utils.anchors import Anchors
class SiamMask(nn.Module):
def __init__(self, anchors=None, o_sz=127, g_sz=127):
super(SiamMask, self).__init__()
self.anchors = anchors # anchor_cfg
self.anchor_num = len(self.anchors["ratios"]) * len(self.anchors["sc... | Python | 1 |
/// Returns the `&str` value of the enum member.
pub fn as_str(&self) -> &str {
match self {
ScheduledAutoTuneSeverityType::High => "HIGH",
ScheduledAutoTuneSeverityType::Low => "LOW",
ScheduledAutoTuneSeverityType::Medium => "MEDIUM",
ScheduledAutoTuneSev... | Rust | 0 |
sensus instance in a relevant era, but caching it
/// here is the easiest way of achieving the desired effect.
next_block_height: u64,
#[data_size(skip)]
metrics: ConsensusMetrics,
// TODO: discuss this quick fix
finished_joining: bool,
/// The path to the folder where unit hash files will b... | Rust | 0 |
.AID_RID[aid[:5]]
if aid[:5] == (0xA0, 0x00, 0x00, 0x00, 0x03):
inter += ' - %s' % self.AID_Visa_PIX
elif aid[:5] in ((0xA0, 0x00, 0x00, 0x00, 0x04), \
(0xA0, 0x00, 0x00, 0x00, 0x05)):
inter += ' - %s' % self.AID_MasterCard_PIX
... | Python | 1 |
HASH_TAG))?;
writer
.write(XmlEvent::characters(&self.content.0))
.map_err(to_xml_write_error(HASH_TAG))?;
writer
.write(XmlEvent::end_element())
.map_err(to_xml_write_error(HASH_TAG))?;
Ok(())
}
}
#[derive(Debug, Deserialize, Serialize, Par... | Rust | 0 |
# coding: utf-8
import types
import six
from huaweicloudsdkcore.region.region import Region
from huaweicloudsdkcore.region.provider import RegionProviderChain
class VpcRegion:
_PROVIDER = RegionProviderChain.get_default_region_provider_chain("VPC")
AF_SOUTH_1 = Region(id="af-south-1", endpoint="https://vpc... | Python | 1 |
lf.pool.startswith("spatial"):
results.append(h.type(x.dtype).mean(dim=(2, 3)))
h = self.middle_block(h, emb)
if self.pool.startswith("spatial"):
results.append(h.type(x.dtype).mean(dim=(2, 3)))
h = th.cat(results, axis=-1)
return self.out(h)
e... | Python | 1 |
et mut max_output: i64 = std::i64::MIN;
for p in phases {
let mut amps: Vec<IntCodeComputer> = vec![IntCodeComputer::new(v.clone(), false); 5];
amps[0].inputq.push_front(0);
let d = p.chars().flat_map(|c| c.to_digit(10)).collect::<Vec<u32>>();
for i in 0..=4 {
amps[i].inp... | Rust | 0 |
with open(meta_save_path, "w", encoding="utf-8") as f:
for p in file_paths:
f.write(f"{p[0]}|{p[1]}\n")
print(f" >> Metafile created: {meta_save_path}")
return True
def main(args):
if args.speaker == 'all':
meta_file_train="metadata_train.csv"
... | Python | 1 |
()
return args
if __name__ == '__main__':
args = parse_args()
dataset_dir = args.coco_path
for s in ['val2017', 'train2017']:
separate_coco_semantic_from_panoptic(
os.path.join(dataset_dir,
'annotations/panoptic_{}.json'.format(s)),
os.path.join... | Python | 1 |
import sklearn
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.metrics.pairwise import cosine_similarity
class Calculate_cosine_similarity:
def __init__(self):
"""
Initializes the CosineSimilarityCalculator with a CountVectorizer instance.
"""
self.vectorize... | Python | 1 |
mod dispatcher;
mod logger;
// For crate-type="cdylib".
#[cfg(not(wasi_exec_model_reactor))]
#[macro_export]
macro_rules! main {
($code:block) => {
#[cfg(target_os = "wasi")]
extern "C" {
fn __wasm_call_ctors();
}
#[no_mangle]
pub extern "C" fn _initialize() {
... | Rust | 0 |
import torch
def power(x):
"""Compute power spectra of input fields
Each field should have batch and channel dimensions followed by spatial
dimensions. Powers are summed over channels, and averaged over batches.
Power is not normalized. Wavevectors are in unit of the fundamental
frequency of the... | Python | 1 |
_reader.readuntil(
telnetlib3.IAC + telnetlib3.SE
)
)[:-2]
)
buf_after = b""
else:
... | Python | 1 |
7048e-03,
4.749554e-03,4.792063e-03,4.834573e-03,4.877084e-03,4.919598e-03,4.962113e-03,5.004630e-03,5.047149e-03,
5.089670e-03,5.132193e-03,5.174717e-03,5.217243e-03,5.259771e-03,5.302301e-03,5.344833e-03,5.387366e-03,
];
/// Returns 2 to the x where x is an integer [-126,127]
fn pow2_int(x: i32) -> f32 {
... | Rust | 0 |
#create a folder and put model checkpoints there
saver.save(sess, checkpoint_path + "/epoch_{}".format(i), global_step=total_batches)
print("Finishing epoch "+"{:d}".format(i)+", took "+\
"{:.3f}".format(time()-epoch_start))
###... | Python | 1 |
(_, _, _, Err(t)) => Err(t),
*/
(Ok(a), Ok(c), Ok(g), Ok(t)) => {
let mut result = HashMap::new();
result.insert('A', a);
result.insert('C', c);
result.insert('G', g);
result.insert('T', t);
Ok(result)
}
_ =... | Rust | 0 |
import pandas as pd
import pprint as pp
import json
from line_breaker import line_breaker as lb
lb.lineBreaker()
# Dados
dados_series = {
'series':[
{
'titulo':'Stranger Things',
'genero':'Ficção Científica',
'ano_lançamento':'2016',
'temporadas':[
... | Python | 1 |
herDB<E>,
txn: &'txn RwTransaction<'txn>,
) -> Result<mdbx::Database<'txn>, Error> {
db.min_targets_db(txn)
}
}
impl TargetArrayChunk for MaxTargetChunk {
fn name() -> &'static str {
"max"
}
fn empty(config: &Config) -> Self {
MaxTargetChunk {
chunk: Chu... | Rust | 0 |
#!/usr/bin/env python
#
# Copyright 2016 Cisco Systems, Inc.
#
# 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 applicab... | Python | 1 |
value: HandleUntyped) -> Self {
value.id
}
}
impl From<&str> for HandleId {
fn from(value: &str) -> Self {
AssetPathId::from(value).into()
}
}
impl<T: Asset> From<&Handle<T>> for HandleId {
fn from(value: &Handle<T>) -> Self {
value.id
}
}
impl<T: Asset> Hash for Handle<T>... | Rust | 0 |
slot = 0;
range_vars!(mr0, mp0, mi0, lr0, lp0, li0, sr0, sp0, si0);
range_vars!(mr1, mp1, mi1, lr1, lp1, li1, sr1, sp1, si1);
range_vars!(mr2, mp2, mi2, lr2, lp2, li2, sr2, sp2, si2);
range_vars!(mr3, mp3, mi3, lr3, lp3, li3, sr3, sp3, si3);
range_vars!(mr4, m... | Rust | 0 |
address` will be set to Alice and `path` will be set to "/a/b/mymap/Bob".
//!
//! On the other hand, if you want to query only <Alice>/a/*, `address` will be set to Alice and
//! `path` will be set to "/a" and use the `get_prefix()` method from statedb
use crate::account_address::AccountAddress;
use crate::identifier:... | Rust | 0 |
0");
s.update_rollover_count(0);
let roc = s.next_rollover_count(65530);
assert_eq!(
roc, 0,
"rolloverCounter was not updated when it rolled back, failed to handle out of order"
);
s.update_rollover_count(65530);
let roc = s.next_rollover_count(5);
assert_eq!(
roc,... | Rust | 0 |
_mangle]
/// Gets a room count in room
///
/// # Safety
///
/// Home gets from smart_home_get_home()
///
/// * `handle`: home handle
pub unsafe extern "C" fn smart_home_get_room_size(handle: *mut Home) -> usize {
let home = &mut *handle;
home.room_iter().count()
}
#[no_mangle]
/// Gets a room iterator
///
///... | Rust | 0 |
# Task 5
name = input("What's your name? ")
food = input("What's your favorite food? ")
birth_year = input("What is your birth year? ")
fav_number = input("What's your favorite number? ")
fav_language = input("Your favorite programming language? ")
print("\n--- Survey Summary ---")
print(f"Hello {name}, you love eatin... | Python | 1 |
import os
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'mysite.settings')
import django
django.setup()
import random
from django.contrib.auth.models import User
from new_novel_review.models import Post, Like
from collections import defaultdict
def add_likes():
sets = defaultdict(list)
other_sets = defaultd... | Python | 1 |
XK_racute: libc::c_uint = 0x1e0;
pub const XK_abreve: libc::c_uint = 0x1e3;
pub const XK_lacute: libc::c_uint = 0x1e5;
pub const XK_cacute: libc::c_uint = 0x1e6;
pub const XK_ccaron: libc::c_uint = 0x1e8;
pub const XK_eogonek: libc::c_uint = 0x1ea;
pub const XK_ecaron: libc::c_uint = 0x1ec;
pub const XK_dcaron: libc::... | Rust | 0 |
$solve_into:ident,
) => {
$({
let $a_ident: Array2<$elem_type> = $a;
let $x_ident: Array1<$elem_type> = $x;
let b: Array1<$elem_type> = $b;
let a = $a_ident;
let x = $x_ident;
let rtol = $rtol;
assert_close_l2!(&a.$s... | Rust | 0 |
""
print("\nCreating comparison animations (Training vs Randomized)...")
# Animate training environment
print("\n--- Training Environment Animation ---")
training_anim, training_result = animate_evaluation(
agent=agent,
env=env,
starting_position=starting_position,
t... | Python | 1 |
magnitude() {
let v = Tuple4::vector(1.0, 2.0, 3.0);
let mag = v.magnitude();
assert_eq!(mag * mag, 14.0);
}
#[test]
fn test_vector_normalize() {
let v = Tuple4::vector(1.0, 2.0, 3.0);
let normalized_v = v.normalize();
assert_eq!(equal(normalized_v.x, 0.2... | Rust | 0 |
# Configuration file for the Sphinx documentation builder.
#
# For the full list of built-in configuration values, see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master... | Python | 1 |
1 == ON
// # AES_CRYPTO[0] INBOUND 0 == Decrypt, 1 == Encrypt
// # bitfields
// AES_CRYPTO_MODE = 0xF0
// AES_CRYPTO_OUT = 0x0C
// AES_CRYPTO_OUT_ENABLE = 0x08
// AES_CRYPTO_OUT_ON = (0x01 << 3)
// AES_CRYPTO_OUT_OFF = (0x00 << 3)
// AES_CRYPTO_OUT_TYPE = 0x04
// AE... | Rust | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.