text string | label_name string | labels int64 |
|---|---|---|
to_respan,
respan_using: ident.span(),
})
}
val => Err(syn::Error::new_spanned(
val,
"expected None-delimited group",
)),
}
}
}
fn parse_pubkey(
id_literal: &LitStr,
pubkey_type: &proc_macro... | Rust | 0 |
ed in TagValue(TagValue rejects wrong format)
serde_json::from_str::<FixedTagList>(r#"["1234"]"#).unwrap();
}
#[test]
fn should_accept_update_user_tags() {
let payload = serde_json::from_str::<UpdateUserTags>(
r#"
{
"org_name":"A123",
"user":"muta1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqggfy0... | Rust | 0 |
# Desafio 19
"""
Para este desafio, crie um loop que peça ao usuário para digitar o nome de uma fruta. Se a fruta digita não for 'abacate', o loop deve continuar pedindo ao usuario para digitar o nome de uma fruta. Se a fruta for 'abacate', o loop deve terminar e o programa deve imprimir "Parabéns, voce acertou a... | Python | 1 |
accepted
}
fn epsilon_closure<A, P, V>(
initial: BitSet,
nfa: &Nfa<A, P, V>
) -> BitSet
where A: Eq + Hash,
P: PartialOrd,
{
let mut result = initial;
let mut new = result.iter().map(|x| x as u32).collect::<Vec<_>>();
while let Some(i) = new.pop() {
if let Some(nexts) = nfa.transitions.get(... | Rust | 0 |
:settings::toml::Target;
use crate::terminal::message;
use std::sync::mpsc::channel;
use std::thread;
use ws::{Sender, WebSocket};
// Using this instead of just `https://cloudflareworkers.com` returns just the worker response to the CLI
const PREVIEW_ADDRESS: &str = "https://00000000000000000000000000000000.cloudflar... | Rust | 0 |
s_head(arr: Vec<u8>) -> TestResult {
if arr.len() < 2 {
return TestResult::discard();
}
TestResult::from_bool(slice_contains(&arr, &arr[..(arr.len() - 1)]))
}
#[quickcheck]
fn empty_slice_contains(arr: Vec<u8>) -> bool {
!slice_contains(&[], &arr) || arr.len() =... | Rust | 0 |
#encoding:utf-8
from utils import weighted_random_subreddit
# Subreddit that will be a source of content
subreddit = weighted_random_subreddit({
'footballhighlights': 1.0,
# If we want get content from several subreddits
# please provide here 'subreddit': probability
# 'any_other_subreddit': 0.02
})
... | Python | 1 |
return cast(List[BaseException], self.args[1])
if TYPE_CHECKING:
_CleanupContextBase = FrozenList[Callable[[Application], AsyncIterator[None]]]
else:
_CleanupContextBase = FrozenList
class CleanupContext(_CleanupContextBase):
def __init__(self) -> None:
super().__init__()
self._exits... | Python | 1 |
ize
self.tab4 = QtWidgets.QWidget(self.centralwidget)
self.tab4.setObjectName("Optimize")
self.tabs.addTab(self.tab4, "Optimize")
self.tab4_layout = QVBoxLayout(self.tab4)
self.tab4_layout.setContentsMargins(5,5,5,5)
# Tạo menu bar
self.menu_bar = QFrame(self.tab4)
... | Python | 1 |
enum Error {
InvalidOpCode(u8),
Op0OutOfRange,
Op1OutOfRange,
AdditionOverflow(u32, u32),
}
// do-core1 register indexes range from 0 to 31.
const MAX_REGISTER_INDEX: u8 = 31;
impl Instruction {
// Instruction constructor, a.k.a. disassembler.
fn disassemble(insn: u32) -> Result<Instruction, E... | Rust | 0 |
import math
def f(x):
return -18 * math.sin(x) + 25 * math.cos(x) - x ** 3 - 2 * x ** 2 + 6 * x + 5
def Steps(a, b, eps):
x = a
delta = 2 * eps
while f(x) * f(x+delta) > 0 and x < b:
x += delta
#print(f(x), f(x+delta), x, x+delta)
f1, f2 = f(x), f(x+delta)
if f1 * f2 < 0:
... | Python | 1 |
conds_t = __darwin_useconds_t;
pub type suseconds_t = __darwin_suseconds_t;
pub type rsize_t = __darwin_size_t;
pub type errno_t = ::std::os::raw::c_int;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct fd_set {
pub fds_bits: [__int32_t; 32usize],
}
#[test]
fn bindgen_test_layout_fd_set() {
assert_eq!(
... | Rust | 0 |
de::Deserialize<'de> for StateHandle<T> {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
Ok(Signal::new(T::deserialize(deserializer)?).handle())
}
}
/// State that can be set.
///
/// # Example
/// ```
/// use maple_core::prelude::*;
//... | Rust | 0 |
# Questão 8. Calculadora de Bônus
#
# a. Descrição: Um rei deseja distribuir bônus aos seus cavaleiros com base em suas conquistas. Se
# um cavaleiro completou mais de 10 missões, ele recebe um bônus de 100 moedas de ouro. Se
# completou entre 5 e 10 missões, recebe 50 mo... | Python | 1 |
def __init__(self, n_src_vocab, n_tgt_vocab, len_max_seq, d_word_vec=512,
d_model=512, d_inner=2048, n_layers=6, n_head=8, d_k=64, d_v=64,
dropout=0.1, tgt_emb_prj_weight_sharing=True,
emb_src_tgt_weight_sharing=True):
super().__init__()
self.encoder = Encoder(n_src_vocab=n_src_vocab, len_max_seq=le... | Python | 1 |
es(dataset_root, sequences, split=split, sampling_distance=args.sampling_distance)
print('test sequences len: ', len(ds))
test_tuples = generate_training_tuples(ds, args.pos_threshold, args.neg_threshold, bev=args.bev, sph=args.sph)
print('test tuple length: ', len(test_tuples))
pickle_name = f'val{name... | Python | 1 |
= initial_value.get(32 + length as usize * 4..)
.ok_or(ParseError::InsufficientData)?;
Ok((result, remaining))
}
}
impl ListSubpictureTypesReply {
/// Get the value of the `num` field.
///
/// The `num` field is used as the length field of the `types` field.
/// This function co... | Rust | 0 |
}
impl std::str::FromStr for SigningAlg {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
Ok(SigningAlg::from(s))
}
}
impl SigningAlg {
/// Returns the `&str` value of the enum member.
pub fn as_str(&self) -> &str {
match self {
... | Rust | 0 |
x, prior_prob):
if self.children[action] is not None:
node = self.children[action]
else:
node = UCTnode(
action_n = self.action_n,
state = child_state,
checkpoint_idx = checkpoint_idx,
parent = self,
... | Python | 1 |
#
# QAPI parser test harness
#
# Copyright (c) 2013 Red Hat Inc.
#
# Authors:
# Markus Armbruster <armbru@redhat.com>
#
# This work is licensed under the terms of the GNU GPL, version 2 or later.
# See the COPYING file in the top-level directory.
#
from qapi import *
from pprint import pprint
import os
import sys
c... | Python | 1 |
",
stringify!(evbuffer_cb_info),
"::",
stringify!(orig_size)
)
);
assert_eq!(
unsafe { &(*(::std::ptr::null::<evbuffer_cb_info>())).n_added as *const _ as usize },
8usize,
concat!(
"Offset of field: ",
stringify!(evbuff... | Rust | 0 |
t_is_ready:
self.openGame()
self.client.sendMessage(MessageType.START_GAME)
@Slot()
def onReceivedNotReady(self) -> None:
self.server_is_ready = False
@Slot()
def onReceivedStartGame(self) -> None:
self.openGame()
@Slot()
def onReceivedSetupText(self, t... | Python | 1 |
let mask = 1 << i;
let val_bit_is_set = val & mask == mask;
let index =
if false { bit_width as usize - 1 - i } else { i };
self.set_bit(index + bit_offset, val_bit_is_set);
}
}
}
#[repr(C)]
pub struct _... | Rust | 0 |
= -2;
pub const SQL_STILL_EXECUTING: SQLRETURN = 2;
pub const SQL_NEED_DATA: SQLRETURN = 99;
pub const SQL_NTS: SQLSMALLINT = -3;
pub const SQL_MAX_MESSAGE_LENGTH: usize = 512;
pub const SQL_DATE_LEN: usize = 10;
pub const SQL_TIME_LEN: usize = 8;
pub const SQL_TIMESTAMP_LEN: usize = 19;
pub const SQL_HANDLE_ENV: SQLS... | Rust | 0 |
role="user",
content=[
CacheControlPart(type="cache_control", cache_type="ephemeral")
],
)
]
)
@patch(
"mirascope.core.openai._utils._convert_message_params._load_media",
return_value=b"audio_data",
)... | Python | 1 |
= {
# Options:
# FULL_SHARD, SHARD_GRAD_OP, NO_SHARD, HYBRID_SHARD, _HYBRID_SHARD_ZERO2
"sharding_strategy": ShardingStrategy.FULL_SHARD,
"device_id": torch.cuda.current_device(),
"use_orig_params": False,
#"auto_wrap_policy": wrap_policy,
"mixed_precision" : Mixe... | Python | 1 |
lambda_141C)
WaitForThreadExit(0x0000, 0x0002)
ChrTalk(
0x0102,
(
'#0020150511V#013F唉,又来了吗……',
TxtCtl.Enter,
),
)
CloseMessageWindow()
ChrSetPos(0x000D, -202010, 10, -26160, 180)
ChrSetChipByIndex(0x000D, 7)
ChrClearFlags(0x000D, 0x0008)
... | Python | 1 |
= 100;
let recipient = vec![99];
assert_ok!(Bridge::whitelist_chain(Origin::root(), dest_chain));
assert_ok!(BridgeTransfer::update_fee(Origin::root(), 2, 2, dest_chain));
// Register asset, id = 0
assert_ok!(AssetsWrapper::force_register_asset(
Origin::root(),
bridge_asset_location.clone().into(),
... | Rust | 0 |
alse, symlinks won't be followed.
r Nro r rW r[ r] ENODATAr\ getxattrsetxattrEPERMEACCES)r r r namesr rX values r3
_copyxattrr A LLFE
D
COCuN wwu}}emmU\\JJ
775;;
u}}#(<<#? ??
/ A *B
B... | Python | 1 |
in &[1, 2] {
let mut options = options.clone();
options.nthreads = n;
common::test_collapse(
Folder::from(options),
test_file,
expected_file,
strip_quotes,
)?;
}
Ok(())
}
fn test_collapse_perf_logs_with_options<F>(input_file: &str... | Rust | 0 |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import sys
import os
BASE_DIR = os.path.dirname(__file__)
sys.path.append(BASE_DIR)
import numpy as np
import pc_util
scene_name = 'scanne... | Python | 1 |
.
///
/// ```
/// use glam::{const_mat4, Mat4};
/// const ZERO: Mat4 = const_mat4!([0.0; 16]);
/// const IDENTITY: Mat4 = const_mat4!(
/// [1.0, 0.0, 0.0, 0.0],
/// [0.0, 1.0, 0.0, 0.0],
/// [0.0, 0.0, 1.0, 0.0],
/// [0.0, 0.0, 0.0, 1.0]
/// );
/// ```
#[macro_export]
macro_rules! const_mat4 {
($col... | Rust | 0 |
icular command.",
help: vec![
"A long form description of the various commands.",
"If a command name is supplied, provice the full help for that",
"command only."
],
}
}
<reponame>nephele-rs/nephele
#![forbid(unsafe_code)]
const MAX_HEADERS: usize... | Rust | 0 |
import time
# s = 'abc'
# s *= 2
# s = s.replace('c', 'x')
# print(s)
def fibonacci(n):
a, b = 0, 1
for _ in range(n):
print(a)
a, b = b, a + b
def countdown(n):
while n >= 0:
mins, secs = divmod(n, 60)
timer = '{:02d}:{:02d}'.format(mins, secs)
print(timer, end=... | Python | 1 |
et %inp[%c-4_i3_4] {sv.namehint = "inp__4"} : !hw.array<5xi1>, i3
# CHECK: %11 = comb.or bin %6, %7, %8, %9, %10 : i1
ports.inp.or_reduce()
# CHECK: %c0_i3_5 = hw.constant 0 : i3
# CHECK: %12 = hw.array_get %inp[%c0_i3_5] {sv.namehint = "inp__0"} : !hw.array<5xi1>, i3
# CHECK: %c1_i3_6 = hw.con... | Python | 1 |
2);
node.add_txns_via_client(TXN_2).await;
// No txns should be sent or ready
node.connect_self(other_peer_network_id.network_id(), other_metadata.clone());
node.assert_txns_not_in_mempool(ALL_TXNS);
node.wait_for_no_msg(
other_peer_network_id.network_id(),
Duration::from_millis(100... | Rust | 0 |
def is_bytes(b):
return isinstance(b, bytes)
def is_text(s):
return isinstance(s, str)
def is_integer(i):
return isinstance(i, int)
| Python | 1 |
import uuid
from django.db import models
class Alerta (models.Model):
# Create your models here.
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
fecha=models.DateField(auto_created=True)
descripcion=models.TextField()
def __str__(self):
return self.id
| Python | 1 |
"""
Pagination utilities for DZ Bus Tracker.
"""
from django.core.paginator import EmptyPage, PageNotAnInteger, Paginator
from rest_framework.response import Response
from rest_framework.pagination import PageNumberPagination
class StandardResultsSetPagination(PageNumberPagination):
"""
Standard pagination fo... | Python | 1 |
mut W {
self.variant(CRC_CHK_DIS_A::CRC_CHK_DIS_1)
}
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits ... | Rust | 0 |
cand fish 'Fish completion script'
cand zsh 'Zsh completion script'
cand powershell 'PowerShell completion script'
cand elvish 'Elvish completion script'
cand help 'Prints this message or the help of the given subcommand(s)'
}
&'kubelog;configuration;c... | Rust | 0 |
for line in f.readlines():
line = line.replace('\n','')
if line == '[Term]':
if 'id' in gene:
ontology[gene['id']] = gene
gene = {}
gene['parents'], gene['alt_ids'] = [], []
flag = True
elif line == '[Typedef]':
flag = False
else:
if ... | Python | 1 |
rt for the model')
fig.show()
def LoadModel(self):
# 감정 예측 모델
print('\n------ LOAD SAVED MODEL -----')
self.model = load_model(self.saved_model_dir)
def Softmax(self, x):
exp_x = np.exp(x)
sum_exp_x = np.sum(exp_x)
y = exp_x / sum_exp_x
return ... | Python | 1 |
x : torch.Tensor
y : torch.Tensor
Returns
-------
torch.Tensor
Cosine similarity matrix.
"""
similarity = torch.nn.CosineSimilarity(dim=-1)
# Reshape x: (2N, C) -> (2N, 1, C)
x = x.unsqueeze(1)
# Reshape y: (2N, C) -> (1, C, 2N)
... | Python | 1 |
'+mycaseid
#average seasonal cycle
output2.write(plotcmd+' --vars NEE,GPP,EFLX_LH_TOT,FSH,FPG,FPG_P,FPI,FPI_P,NPP,'+ \
'QOVER --seasonal --obs\n')
#seasonal diurnal cycles
diurnalvars='NEE,GPP,EFLX_LH_TOT,FSH'
... | Python | 1 |
&thread, screen_texture);
//
// d.clear_background(Color::BLACK);
//
// d.draw_circle(10, 10, 5.0, Color::RED);
// d.draw_text("RenderTexture", 20, 20, 20, Color::ORANGE);
//
// d.draw_rectangle_lines(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, Color::BLUE);
//
// for x in... | Rust | 0 |
itialise_camera(world);
}
// fn update(&mut self, data: StateData<'_, GameData<'_, '_>>) {
// println!("update")
// // Check if warrior is dead
// // if warrior.hp <= 0.0 {
// // data.world.delete_entity(warrior).expect("Failed to delete entity. Was it already removed?");
... | Rust | 0 |
("unexpected end of file, expecting {}", expected.join(", ")),
),
}
}
}
impl CairoLexerError {
pub fn parser_error(pos: Loc, message: String) -> Self {
Self::ParserError(pos.0, pos.1, message)
}
}
#[derive(Debug, PartialEq, Eq, Clone)]
pub enum CairoToken<'input> {
Identifi... | Rust | 0 |
ans.push(c);
}
}
}
push_buf(&mut buf, &mut ans);
// we won't support eqv aliasing for now, I might implement them whenever I feel like
// detecting some eqv cycles
ans
}
}
impl<I: Iterator<Item = String>> Iterator for... | Rust | 0 |
let mut computer = Computer::new(program);
computer.run();
let answer = computer.program;
assert_eq!(answer[&3], 1);
let program = vec![1108, 5, 4, 3, 99];
let mut computer = Computer::new(program);
computer.run();
let answer = computer.program;
asser... | Rust | 0 |
ize::from_str(loc0[1]).unwrap());
let xy1 = (isize::from_str(loc1[0]).unwrap(), isize::from_str(loc1[1]).unwrap());
// println!("({},{})-({},{})", xy0.0, xy0.1, xy1.0, xy1.1);
for x in xy0.0..(xy1.0 + 1) {
for y in xy0.1..(xy1.1 + 1) {
let loc = Loc::new(x, y);
... | Rust | 0 |
#! /usr/bin/env python3
'''
Gamma point post-HF calculation needs only real integrals.
Methods implemented in finite-size system can be directly used here without
any modification.
'''
import numpy
from pyscf.pbc import gto, scf, dft
from pyscf import gto as Mgto
from pyscf.pbc import df
from pyscf.pbc import ao2mo... | Python | 1 |
}
new_s.push(poped);
}
new_s.reverse();
let mut repo = String::new();
for c in new_s.into_iter() {
repo.push(c);
}
repo
... | Rust | 0 |
import sys
from io import StringIO
from pathlib import Path
from contextlib import redirect_stdout
def main():
path = Path(sys.argv[1])
f = StringIO()
with redirect_stdout(f):
print("// Code generated automatically; DO NOT EDIT")
print()
gencode(lambda s: s.upper(), "uppercase")
... | Python | 1 |
IT_EIGHT: u32 = 0x24fc;
/// 半角 JIS 記号 DOUBLE_CIRCLED_DIGIT_NINE
pub const NARROW_JIS_SYMBOL_DOUBLE_CIRCLED_DIGIT_NINE: u32 = 0x24fd;
/// 半角 JIS 記号 DOUBLE_CIRCLED_NUMBER_TEN
pub const NARROW_JIS_SYMBOL_DOUBLE_CIRCLED_NUMBER_TEN: u32 = 0x24fe;
/// 全角 JIS 記号 BOX_DRAWINGS_LIGHT_HORIZONTAL
pub const WIDE_JIS_SYMBOL_BO... | Rust | 0 |
the C pointer into the Rust Isolate object.
extern "C" fn pre_dispatch(
d: *const libdeno::isolate,
req_id: i32,
control_buf: libdeno::deno_buf,
data_buf: libdeno::deno_buf,
) {
// control_buf is only valid for the lifetime of this call, thus is
// interpretted as a slice.
let control_slice = unsafe {
... | Rust | 0 |
def front3(str):
s = str[:3]
return s + s + s
| Python | 1 |
# Copyright 2024 Google LLC 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 ag... | Python | 1 |
.queue(style::Print(&prompt))?
.queue(style::Print(&input_buf))?
.queue(cursor::MoveTo(cols - msgs.len() as u16, rows))?
.queue(style::SetForegroundColor(style::Color::Blue))?
.queue(style::Print(&msgs.trim()))?
.queue(style::ResetColor)?
.qu... | Rust | 0 |
import asyncio
from typing import List
import pytest
from chiabip158 import PyBIP158
from tests.setup_nodes import setup_simulators_and_wallets, bt
@pytest.fixture(scope="module")
def event_loop():
loop = asyncio.get_event_loop()
yield loop
class TestFilter:
@pytest.fixture(scope="function")
async... | Python | 1 |
|| buf.ends_with('\t') {
let end = buf.len() - 1;
buf.remove(end);
}
}
fn double_newline(buf: &mut String) {
trim_ending_whitespace(buf);
if !buf.ends_with("\n\n") {
if buf.ends_with('\n') {
buf.push('\n')
} else if !buf.is_empty() {
buf.push_str("... | Rust | 0 |
f,
"<{}:{}>",
escape_identifier(encoding),
escape_unencoded_data(unencoded_data)
)
}
Self::InvalidDataLiteralWithVerbatimCarriageReturn(invalid_data_literal) => write!(
f,
"<`{}`:{}>",
invalid_data_literal.encoding,
invalid_data_literal.unencoded_data // FIXME: Assert that at l... | Rust | 0 |
charge()
charge.confirmations = 64321
former_updated_at = charge.updated_at
self.db.save(charge)
updated_charge = self.db.get_charge_by_uid(charge.uid)
assert updated_charge.confirmations == 64321
assert former_updated_at < updated_charge.updated_at
def test_coins(se... | Python | 1 |
batch_size)[None, :, None], mx.arange(4)[None, None, :]]
if self.rm_detach and 'dec' in self.rm_detach:
reference_points = new_reference_points
else:
reference_points = mx.stop_gradient(new_reference_points)
if... | Python | 1 |
t s = angle.sin();
let c = angle.cos();
let a10 = a[4];
let a11 = a[5];
let a12 = a[6];
let a13 = a[7];
let a20 = a[8];
let a21 = a[9];
let a22 = a[10];
let a23 = a[11];
out[0] = a[0];
out[1] = a[1];
out[2] = a[2];
out[3] = a[3];
out[12] = a[12];
out[13] = a[... | Rust | 0 |
annot create a 32 bit register from a 64 bit value")}
#[cfg(target_pointer_width = "64")]
{Self(double)}
}
#[inline(always)]
fn zero_extended_double(double: [u8; 8]) -> Self {
#[cfg(target_pointer_width = "32")]
{panic!("Cannot create a 32 bit register from a 64 bit value")}
... | Rust | 0 |
eref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `SRAM_0A_TEST1` writer - Test pin to bypass self-timed circuit"]
pub struct SRAM_0A_TEST1_W<'a> {
w: &'a mut W,
}
impl<'a> SRAM_0A_TEST1_W<'a> {
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
... | Rust | 0 |
#!/usr/bin/env python3
import os
import sys
def get_lines(directory, file_ending_list):
line_count = 0
file_count = 0
for dirpath, dirnames, filenames in os.walk(directory):
for filename in filenames:
if any(filename.endswith(file_ending) for file_ending in file_ending_list):
... | Python | 1 |
import time
import sys
# Node class for Linked List
class Node:
def __init__(self, data):
self.data = data
self.next = None
# Linked List class
class LinkedList:
def __init__(self):
self.head = None
# Add node to the front of the list
def insert(self, data):
new_node =... | Python | 1 |
: i32,
pub log_vport: i32,
pub container_pipe_size: i32,
pub server_addr: String,
pub unified_cgroup_hierarchy: bool,
pub tracing: bool,
pub endpoints: AgentEndpoints,
}
#[derive(Debug, Deserialize)]
pub struct AgentConfigBuilder {
pub debug_console: Option<bool>,
pub dev_mode: Option<b... | Rust | 0 |
lfmodule: *const MI_Module_Self, context: *const MI_Context)>;
#[doc = "*Required features: 'Win32_System_Wmi'*"]
pub type MI_ProviderFT_ModifyInstance = ::core::option::Option<unsafe extern "system" fn(self_: *mut ::core::ffi::c_void, context: *mut MI_Context, namespace: *const u16, classname: *const u16, modifiedinst... | Rust | 0 |
a symbol of a particular node
:param node: the current node
:returns: the name of the node if it is of type ast.Name or ast.Attribute
"""
if self.is_classtype_member(node):
return None
if isinstance(node, ast.Name):
return node.id
if isinstance... | Python | 1 |
}
}
impl ::protobuf::reflect::ProtobufValue for DebugLinkMemoryRead {
fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef {
::protobuf::reflect::ReflectValueRef::Message(self)
}
}
#[derive(PartialEq,Clone,Default)]
pub struct DebugLinkMemory {
// message fields
memory: ::protobuf::Si... | Rust | 0 |
is full.
pub struct FreeInfoBlock<'a> {
id: BlockId,
buf_idx: usize,
data: Pinned<'a, BlockArea>,
}
impl<'a> FreeInfoBlock<'a> {
pub fn new(id: BlockId, buf_idx: usize, data: Pinned<'a, BlockArea>) -> Self {
FreeInfoBlock {
id,
buf_idx,
... | Rust | 0 |
be applied to each
* coordinate of the box to get a new coordinate from [-1,1]. */
#[no_mangle]
fn wlr_matrix_project_box(mat: *mut libc::c_float, box_0: *const wlr_box,
transform: wl_output_transform,
rotation: libc::c_float,
... | Rust | 0 |
"""
In code demo for borehole_constrained example.
-- kandasamy@cs.cmu.edu
"""
from __future__ import print_function
from dragonfly import load_config, maximise_function, maximise_multifidelity_function
# From current directory
from park1_constrained import objective
from park1_constrained_mf import objective as ... | Python | 1 |
ique())
# print(results['upscale'].unique())
# for sigma,sig_df in results.groupby("upscale"):
# print("-"*20)
# print("upscale: ",sigma)
# print("-"*20)
# # for dname,ddf in sig_df.groupby("dname"):
# # print("dname: ",dname)
# # # print(ddf.columns)
... | Python | 1 |
'''
Q1:
Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum.
For example:
Given the below binary tree and sum = 22,
5
/ \
4 8
/ / \
11 13 4
/ \ ... | Python | 1 |
special_names as sn;
use im::HashSet;
use oxidized::aast;
#[derive(Clone, Debug, Default)]
struct NamingEnv {
type_params: HashSet<String>,
}
fn hint_id(
env: &NamingEnv,
allow_retonly: bool,
cls: &aast::ClassName,
hl: &[aast::Hint],
) -> Option<aast::Hint_> {
use aast::Hint_::*;
use aast:... | Rust | 0 |
<< 24)) | (((value as u32) & 0x03) << 24);
self.w
}
}
#[doc = "Reader of field `SENSITIVE_CORE_X_DRAM0_PMS_CONSTRAIN_SRAM_WORLD_1_PMS_3`"]
pub type SENSITIVE_CORE_X_DRAM0_PMS_CONSTRAIN_SRAM_WORLD_1_PMS_3_R = crate::R<u8, u8>;
#[doc = "Write proxy for field `SENSITIVE_CORE_X_DRAM0_PMS_CONSTRAIN_SRAM_WORLD_1... | Rust | 0 |
B
K?
]z @ sD d dl mZmZ d dlmZmZ d dlmZmZ dd Z dd Z
dS ) )MNIST_LeNetMNIST_LeNet_Autoencoder)
CIFAR10_LeNetCIFAR10_LeNet_Autoencoder)CIFAR10_LeNet_ELUCIFAR10_LeNet_ELU_Autoencoderc C sB d}| |kst d}| dkr"t }| dkr0t }| dkr... | Python | 1 |
import click
import urlparse
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
@click.command()
@click.argument('base_url', type=str)
def main(base_url):
if not base_ur... | Python | 1 |
#!/usr/bin/env python3
"""
Quick setup verification script for Prospect Intelligence Tool
Run this after setup to verify everything is configured correctly
"""
import os
import sys
from dotenv import load_dotenv
# Load environment variables
load_dotenv()
def check_setup():
"""Check if the system is properly conf... | Python | 1 |
import pytest
from app.db.repositories.recurrence_repo import RecurrenceRepository
from tests.factories import RecurrenceFactory
@pytest.mark.asyncio
async def test_create_recurrence(db_session):
repo = RecurrenceRepository(db_session)
recurrence_factory = RecurrenceFactory.build()
created_recurrence = ... | Python | 1 |
ame,
// - list of failure orderings forbidden by the success order,
// - suggestion message)
type OrdLintInfo = (&'static str, &'static [&'static str], &'static str);
let relaxed: OrdLintInfo = ("Relaxed", &["SeqCst", "Acquire"], "ordering mode `Relaxed`");
le... | Rust | 0 |
kx_min = half_size - (x - x_min)
kx_max = half_size + (x_max - x)
ky_min = half_size - (y - y_min)
ky_max = half_size + (y_max - y)
saliency_maps[b, y_min:y_max, x_min:x_max] += kernel[
ky_min:ky_max, kx_min:kx_max
... | Python | 1 |
')
lon_p, lat_p = np.meshgrid(plon, plat)
extent = [-135, -56, 15.5, 52]
mean_obs= np.nanmean(np.nanmean(nP4Obser,axis = 1),axis = 1)
mean_cesm= np.nanmean(np.nanmean(nP4GCM,axis = 1),axis = 1)
mean_unet= np.nanmean(np.nanmean(preds,axis = 1),axis = 1)
mean_qm= np.nanmean(np.nanmean(qm,axis = 1),axis = 1)
fig = p... | Python | 1 |
<I2cdev>>,
y_zero_position: i32,
price_max: f64,
price_min: f64,
}
impl DisplayController {
#[cfg(not(target_arch = "arm"))]
pub fn new() -> DisplayController {
let output_settings = OutputSettingsBuilder::new()
.theme(BinaryColorTheme::OledWhite)
.build();
... | Rust | 0 |
{
let mut buffer: [u8; DEFAULT_BUF_SIZE] = [0; DEFAULT_BUF_SIZE];
let mut written = 0;
loop {
let len = match reader.read(&mut buffer) {
Ok(0) => return Ok(written),
Ok(len) => len,
Err(ref e) if e.kind() == ErrorKind::Interrupted... | Rust | 0 |
e
.raw
.queue_submit(*self.raw, &[*submit_info], vk::Fence::null())
.unwrap();
ssc.semaphore.0
};
let wait_semaphores = &[wait_semaphore];
let swapchains = &[ssc.swapchain.raw];
let image_indices = &[image.index];
let p... | Rust | 0 |
and complete
accomplishment of the action is not achievable due to unavailability of
Redis that the action is not to be attempted. This is irresepective of
whether or not the action would be achieved if/when Redis subsequently
becomes available.
The view class may override this method to incorpora... | Python | 1 |
name.to_string()).encode()[..],
NetworkDelivery::ReliableSequenced(Some(1)),
)
.expect("We failed to send our introduction message");
}
impl TestbedMessage {
pub fn encode(&self) -> Vec<u8> {
if SERIALIZE_JSON {
let encoded_json = serde_json::to_string(&self).unwrap();
... | Rust | 0 |
assert isinstance(signals, pd.DataFrame)
assert "signal" in signals.columns
def test_topic_sentiment_signals(self, sample_news_data):
"""測試主題情緒訊號"""
generator = SentimentSignalGenerator(news_data=sample_news_data)
signals = generator.generate_topic_sentiment_signals()
asser... | Python | 1 |
match font {
Font::Smallest => SANS_13.height,
Font::Small => SANS_16.height,
Font::Medium => SANS_20.height,
Font::Large => SANS_24.height,
}
}
}
pub struct ScreenLayoutRenderer<'a> {
screen: &'a mut dyn Screen,
base_render_mode: RenderMode,
render_mode: RenderMode,
}
impl<'a> ScreenLayoutRenderer<... | Rust | 0 |
from __future__ import annotations
import inspect
from dataclasses import dataclass
@dataclass
class FeedbackSurveyConfig:
has_feedback_survey: bool = False
is_feedback_survey_optional: bool = True
has_section_feedback: bool = False
is_section_feedback_optional: bool = True
has_research_survey: b... | Python | 1 |
ction file.
/// ## Parameters
/// * file: The path to the file.
/// * Rs: Output vector of 3x3 rotations of the camera
/// * Ts: Output vector of 3x1 translations of the camera.
/// * Ks: Output vector of 3x3 instrinsics of the camera.
/// * points3d: Output array with 3d points. Is 3 x N.
/// * file_format: The format... | Rust | 0 |
id: String,
#[serde(rename = "orderDate")]
order_date: String,
#[serde(rename = "deliveryDate")]
delivery_date: String,
#[serde(rename = "isDelayed")]
delayed: bool,
#[serde(rename = "trackingInfo")]
tracking_info: TrackingInfo,
#[serde(rename = "address")]
street: String,
... | Rust | 0 |
;
assert!(b.insert(1));
assert!(b.insert(5));
assert!(b.insert(9));
assert!(b.insert(13));
assert!(b.insert(19));
let expected = [1, 3, 5, 9, 11, 13, 19, 24, 160, 200];
let actual: Vec<_> = a.union(&b).collect();
assert_eq!(actual, expected);
}
... | Rust | 0 |
c", "0", TEN, EMPTY, ONE, THREE, TWO],
"tests/expected/all.c0.out",
)
}
#[test]
fn multiple_files_c3() -> TestResult {
run(
&["-c", "3", TEN, EMPTY, ONE, THREE, TWO],
"tests/expected/all.c3.out",
)
}
#[test]
fn multiple_files_c_minus_3() -> TestResult {
run(
&["-c=-3", ... | Rust | 0 |
assert_eq!(
unsafe { &(*(::std::ptr::null::<bpf_cgroup_dev_ctx>())).access_type as *const _ as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(bpf_cgroup_dev_ctx),
"::",
stringify!(access_type)
)
);
assert_eq!(
... | Rust | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.