text string | label_name string | labels int64 |
|---|---|---|
import random
import time
from characters import Character
from collections import defaultdict
# 保持原BattleSystem类的方法不变
# 包括 basic_attack, trigger_skill, select_ally_target,
# determine_order, print_combatant_status, auto_ai_action, battle_loop
# (由于篇幅限制,具体方法实现此处省略,保持原样即可)
class BattleSystem:
def... | Python | 1 |
(value).map(Self::PublicKeyMultibase),
DiffMethodData::PublicKeyMultibase(None) => Ok(Self::PublicKeyMultibase(Default::default())),
DiffMethodData::PublicKeyBase58(Some(value)) => Diff::from_diff(value).map(Self::PublicKeyBase58),
DiffMethodData::PublicKeyBase58(None) => Ok(Self::PublicKeyBase58(Defa... | Rust | 0 |
_digital() {
let expr = QuakeActionNode::action_from_text("todo.update(12)").unwrap();
assert_eq!(expr.object, "todo");
assert_eq!(expr.action, "update");
assert_eq!(expr.parameters[0], "12");
assert_eq!(12, expr.index_from_parameter());
}
#[test]
fn should_parse_chi... | Rust | 0 |
nfo.to_csv("../data/ASSIST/graph/K_Directed-liu.txt",sep='\t',index=None)
# 以上程序中,我们首先定义了一个函数`calculate_duplicate_values`,用于计算每条边的重复值。
# 具体来说,我们遍历所有环,对于每个环中的每条边,都将它的重复值加1。
# 最后,我们得到了每条边的重复值,存储在一个字典`duplicate_values`中。
# 接着,我们定义了一个函数`get_max_duplicate_value_edge`,用于找到重复值最大的边。
# 如果存在多条重复值相等的边,则找到父结点编号减去子结点编号差值最大的那... | Python | 1 |
type ECC_PR9 = crate::Reg<u32, _ECC_PR9>;
#[allow(missing_docs)]
#[doc(hidden)]
pub struct _ECC_PR9;
#[doc = "`read()` method returns [ecc_pr9::R](ecc_pr9::R) reader structure"]
impl crate::Readable for ECC_PR9 {}
#[doc = "SMC ECC parity 9 Register"]
pub mod ecc_pr9;
#[doc = "SMC ECC parity 10 Register\n\nThis reg... | Rust | 0 |
(socket, message_loop) = WebRtcSocket::new(room_url);
(
Self {
socket,
fake_socket_addrs: Default::default(),
fake_socket_addrs_reverse: Default::default(),
},
message_loop,
)
}
pub async fn wait_for_peers(&mut... | Rust | 0 |
)
}
/// Leaps the clock current value to the given value.
pub(crate) fn leap(&mut self, value: u64) {
self.0.swap(value, atomic::Ordering::SeqCst);
}
}
#[cfg(test)]
mod tests {
use crate::internal::clock::LocalClock;
/// Simple test to verify all operations available.
#[test]
... | Rust | 0 |
start_index = ".".join([str(line_number), str(start)])
end_index = ".".join([str(line_number), str(end)])
self.main_text.tag_add("findmatch", start_index, end_index)
self.match_coordinates.append((start_index, end_index))
def next_match(self, event=None):
... | Python | 1 |
# SPDX-License-Identifier: AGPL-3.0-or-later
"""`Alpine Linux binary packages`_. `Alpine Linux`_ is a Linux-based operation
system designed to be small, simple and secure. Contrary to many other Linux
distributions, it uses musl, BusyBox and OpenRC. Alpine is mostly used on
servers and for Docker images.
.. _Alpine... | Python | 1 |
import pandas as pd
import geopandas as gpd
from shapely.geometry import Point
import networkx as nx
#************* CREATE ***************
# create nodes and edges datasets
def create_nodes_and_edges_gdf(gpd_lines):
# create lines
# get starting and ending points
gpd_lines['nd_st_coords'] = gpd_lines.app... | Python | 1 |
);
loop {
for x in xs {
if seen.contains(&cur) {
return cur;
}
seen.insert(cur);
cur += x;
}
}
}
#[cfg(test)]
mod test {
use super::*;
use lazy_static::lazy_static;
use std::fs;
lazy_static! {
static ref IN... | Rust | 0 |
#User function Template for python3
class Solution:
# Function to find maximum
# product subarray
def maxProduct(self,a, n):
# variation of kaden's algorithm
if len(a) ==1:
return a[0]
max_prod = a[0]
curr_max = a[0]
curr_min = a[0]
# need to maintain... | Python | 1 |
).unwrap();
}
#[macro_export]
macro_rules! user_print {
($fmt: literal $(, $($arg: tt)+)?) => {
$crate::console::print(format_args!(concat!($fmt, "\n") $(, $($arg)+)?));
}
}
#[macro_export]
macro_rules! error {
($fmt: literal $(, $($arg: tt)+)?) => {
$crate::console::print(format_args!(concat!("\x1b[31m[ERROR]... | Rust | 0 |
# -*- coding: utf-8 -*-
"""
Created on Thu May 15 16:34:04 2025
@author: jwang
"""
def isValidParenthesis(s):
"""
:type s: str
:rtype: bool
"""
if len(s) % 2 == 1: #all braces, brackets, and parenthesis must go in pairs, where each pair has 2 characters
return False
theStack =... | Python | 1 |
t) module"]
pub type LEDC_LSCH0_HPOINT = crate::Reg<u32, _LEDC_LSCH0_HPOINT>;
#[allow(missing_docs)]
#[doc(hidden)]
pub struct _LEDC_LSCH0_HPOINT;
#[doc = "`read()` method returns [ledc_lsch0_hpoint::R](ledc_lsch0_hpoint::R) reader structure"]
impl crate::Readable for LEDC_LSCH0_HPOINT {}
#[doc = "`write(|w| ..)` metho... | Rust | 0 |
nt("Output generated:", output)
# print("Expected caption:", caption_raw[j])
batch_data[j]["Expected Caption"] = (
caption_raw[j].replace("<s>", "").replace("</s>", "")
)
batch_data[j]["Generated Caption"] = (
output.split(pred_label_string... | Python | 1 |
DotLabel::MultiRow(strs) => {
f.write_str("{ ")?;
f.write_str(&format!(
"{}",
separated("| ", strs.into_iter().map(|str| DotLabelEscapedString(str)))
))?;
f.write_str(" }")
}
}?;
... | Rust | 0 |
{} X25 {}",
self.domain_name, self.ttl, self.class, self.psdn_address,
)
}
}
#[derive(Debug, Clone, PartialEq, Eq, Hash, Error)]
pub enum ISDNError {
#[error("Address contains illegal character: {0}")]
IllegalChar(char),
#[error("SA contains illegal character: {0}")]
IllegalCha... | Rust | 0 |
dict(pp: *mut *const i8, endptr: *const i8, pf: *mut pdf_file) -> *mut pdf_obj;
#[no_mangle]
fn parse_pdf_object(pp: *mut *const i8, endptr: *const i8, pf: *mut pdf_file) -> *mut pdf_obj;
#[no_mangle]
fn parse_pdf_tainted_dict(pp: *mut *const i8, endptr: *const i8) -> *mut pdf_obj;
#[no_mangle]
... | Rust | 0 |
{
let mut path_arr = file.to_str().unwrap().split("/");
let widget_name = path_arr.next().unwrap();
let file = PathBuf::from(path_arr.as_str());
let path = get_widgets_path().join(widget_name).join("ui").join(&file);
println!(
"{} {}",
"Path converted:".gr... | Rust | 0 |
import json
def all(raw):
raw = raw.strip()
# proxy = kwargs.get("proxy", None)
# real_host = kwargs.get("real_host", None)
# ssl = kwargs.get("ssl", False)
# location = kwargs.get("location", True)
scheme = 'http'
port = 80
if any(raws in raw for raws in ["https","sec-"]) :
sc... | Python | 1 |
import heapq
def restricted_sorting(stacks, costs):
# Initialize the dictionary to keep track of the blocks in each stack
blocks = {i: [] for i in range(8)}
# Initialize the priority queue to keep track of the stacks with the minimum cost
queue = []
# Initialize the dictionary to keep track of the... | Python | 1 |
, self.handle_default)
if handler:
result = handler()
if result == "Back":
break
elif result == "Exit":
self.clear_terminal()
sys.exit()
else:
print("Invalid option selecte... | Python | 1 |
"type": "string",
"description": "任务 ID",
"example": "1234567890abcdef"
},
"status": {
"type": "string",
"description": "任务状态",
... | Python | 1 |
163, 75, 4, 184, 204, 106,
108, 22, 220, 87, 14, 62, 190, 224, 173, 26, 213, 169, 67, 166, 182, 6,
99, 159, 157, 101, 111, 93, 96, 145, 150, 139, 212, 44, 174, 124, 219, 52,
109, 103, 12, 89, 202, 186, 61, 49, 88, 19, 104, 20... | Rust | 0 |
nsert", b"remove").unwrap();
x.insert(b"pirate", b"aargh!").unwrap();
x.insert(b"yo ho ho", b"and a bottle of rum").unwrap();
}
let trie = RefTrieDB::new(&db, &root).unwrap();
let mut recorder = Recorder::new();
trie.get_with(b"pirate", &mut recorder).unwrap().unwrap();
let nodes: Vec<_> = recorder.drain().... | Rust | 0 |
# Copyright 2016 WiseDoge
# 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 agreed to ... | Python | 1 |
t { target, value } in graph.out_neighbors_with_values(node) {
let new_distance = cost.0 + value;
if new_distance < distances[target.index()].0 {
let new_distance = FloatOrd(new_distance);
distances[target.index()] = new_distance;
... | Rust | 0 |
desc,
blob_keys,
shard_id,
_blob: blob,
_phantom: PhantomData,
}
}
/// The `shard_id` of this [Batch].
pub fn shard_id(&self) -> ShardId {
self.shard_id
}
/// The `upper` of this [Batch].
pub fn upper(&self) -> &Antichain<T>... | Rust | 0 |
t");
fs::write(
&config,
b"\
[req]\n\
distinguished_name=dn\n\
[dn]\n\
CN=my.ca\n\
[ext]\n\
basicConstraints=CA:TRUE,pathlen:0\n\
subjectAltName = @alt_names\n\
extendedKe... | Rust | 0 |
import cv2
import pyautogui
import numpy as np
import os
class Detector:
def __init__(self, threshold=0.8):
self.threshold = threshold
self.nodes_path = "assets/nodes/iron"
def find_node(self):
# Captura de pantalla en escala de grises
screenshot = pyautogui.screenshot()
... | Python | 1 |
<gh_stars>1-10
use armrest::ml::LanguageModel;
use std::collections::BTreeSet;
#[derive(Debug, Clone)]
pub struct Dict(pub BTreeSet<String>);
const PUNCTUATION: &str = " .,\"";
impl Dict {
const VALID: f32 = 1.0;
// Tradeoff: you want this to be small, since any plausible input
// is likely to do someth... | Rust | 0 |
from pymtl import *
from lizard.util.rtl.interface import UseInterface
from lizard.util.rtl.method import MethodSpec
from lizard.core.rtl.pipeline_splitter import PipelineSplitterInterface, PipelineSplitterControllerInterface, PipelineSplitter
from lizard.core.rtl.messages import DispatchMsg, PipelineMsgStatus, OpClass... | Python | 1 |
import nose
import idiot
import datetime
import time
def setup():
idiot.init()
def teardown():
pass
def test_snooze_intervals():
p = idiot.CheckPlugin()
assert p.snooze_intervals == idiot.config.snooze_intervals
class TestPlugin(idiot.CheckPlugin):
snooze_intervals = [1, 2, 3, 4]
... | Python | 1 |
graph::NodeIndex>)> {
let start = graph.node_indices().find(|x| if let map::Cell::START = graph[*x] { true } else { false }).unwrap();
let finish = graph.node_indices().find(|x| if let map::Cell::FINISH = graph[*x] { true } else { false}).unwrap();
let path = astar(&graph, start, |node| node == finish, |e| *e.wei... | Rust | 0 |
u32),
}
use ExpNode::*;
impl fmt::Display for ExpNode {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
match &self {
Sym(it) => write!(fmt, "{}", it),
Val(it) => write!(fmt, "{}", it),
Add(it) => write!(fmt, "{}", it.iter().map(|x| format!("{}", x)).join("+"))... | Rust | 0 |
# Copyright: Multiple Authors
#
# This file is part of sigmf-python. https://github.com/sigmf/sigmf-python
#
# SPDX-License-Identifier: LGPL-3.0-or-later
"""Tests for Utilities"""
from datetime import datetime, timezone
import pytest
from sigmf import utils
# fmt: off
@pytest.mark.parametrize("time_str, expected"... | Python | 1 |
mac0_rxerr_select_input::W](enet2_ipp_ind_mac0_rxerr_select_input::W) writer structure"]
impl crate::Writable for ENET2_IPP_IND_MAC0_RXERR_SELECT_INPUT {}
#[doc = "ENET2_IPP_IND_MAC0_RXERR_SELECT_INPUT DAISY Register"]
pub mod enet2_ipp_ind_mac0_rxerr_select_input;
#[doc = "ENET2_IPP_IND_MAC0_TIMER_SELECT_INPUT_0 DAISY... | Rust | 0 |
ding
`assert_body_anfs_as_expected_`.
"""
def assert_body_anfs_as_expected(self, expected_fn, test_fn):
# Testing the code bodies only. Wrapping them in functions so the
# syntax highlights nicely, but Python doesn't try to execute the
# statements.
node, _ = parser.parse_entity(test_fn, future_... | Python | 1 |
import numpy as np
def gradient_descent(A, b, tolerance):
n = len(b)
E = np.identity(n)
At = A.transpose() # находим Аt
A = np.dot(At, A) # перемножаем А на Аt, теперь А - симметрическая
b = np.dot(At, b) # то же самое с b
xk = b # начальное приближение
x = np.zeros(n)
k = 0
while T... | Python | 1 |
this either returns a panic or a cancelled,
// it's a programming error on our side.
// Therefore using unwrap() here is the correct way of handling it.
// (this and the fact that unreachable code would decrease our test coverage)
(&mut self.outer_joinhandle).await.unwrap()
}
p... | Rust | 0 |
= self.level_hashes.len();
if len > 0 {
// Flush the remaining hashes.
self.output_levels(len);
self.level_hashes.clear();
self.out_buffer.reverse();
} else {
return None;
... | Rust | 0 |
import random
def monotoneStack(nums):
print(str(nums))
stack = []
for num in nums:
while stack and num <= stack[-1]:
top = stack[-1]
stack.pop()
print(str(top) + " 出栈 " + str(stack))
stack.append(num)
print(str(num) + " 入栈 " + str(stack))
... | Python | 1 |
::STUNT,
LeaderboardGameMode::Challenge => official_level_names::CHALLENGE,
}
}
/// Returns an iterator that yields the leaderboard name of all official levels for the given game
/// mode.
///
/// The returned name is used in the Steamworks API as a key to fetch a level's leaderboard.
///
/// # Example
///... | Rust | 0 |
'''
Bài 48: Với số nguyên n cho trước, tìm ước số lẻ lớn nhất của n và ước số lớn nhất
của n là lũy thừa của 2.
'''
def tim_so(n):
so_le_max = 1
for i in range(n-1, 0, -1):
if n % i == 0 and i % 2 == 1:
so_le_max = i
break
uoc_max_luy_2 = 1
while n % 2 == 0:
n //... | Python | 1 |
if newmode != oldmode:
log.info("changing mode of %s from %o to %o", file, oldmode, newmode)
os.chmod(file, newmode)
@staticmethod
def _validate_shebang(shebang, encoding):
# Python parser starts to read a script using UTF-8 until
# it gets a #coding:xxx cookie.... | Python | 1 |
# This is an auto-generated Django model module.
# You'll have to do the following manually to clean this up:
# * Rearrange models' order
# * Make sure each model has one field with primary_key=True
# * Make sure each ForeignKey has `on_delete` set to the desired behavior.
# * Remove `managed = False` lines if ... | Python | 1 |
.num_hidden_layers)])
# self.mix_at = [10,11]
self.mix_one_hop_after = 8
self.mix_two_hop_after = 9
self.one_hop_mixer = ZeroCandicateKnowBERTLayer(config.hidden_size,100) # Careful! There is a hardcode num(e_dim asserted to be 100).
self.two_hop_mixer = InfusionLimitKnowBERTLaye... | Python | 1 |
from llm_helper import llm
from few_short import FewShotPost
few_shot = FewShotPost()
def get_length_str(length):
if length == "Short":
return "1 to 5 lines"
if length == "Medium":
return "6 to 10 lines"
if length == "Long":
return "11 to 20 lines"
def generate_post(length, lang... | Python | 1 |
third_order_delta)
for id in range(value.shape[0]):
i_at_sparse.append(iat)
i_coord_sparse.append(icoord)
jat_sparse.append(jat)
j_coord_sparse.append(jcoord)
... | Python | 1 |
xml.characters(smart_str(error))
xml.endElement('error')
xml.endElement('byte-size')
if data.get('created', False):
xml.startElement('created-on', {})
for error in data['address']:
xml.startElement('error', {})
xml.char... | Python | 1 |
_" + score] == 1].copy()
# get score_fivenum for rank-1 scandidates
metric_fivenum_.update({similarity_metric + "_" + score: results_top1_score[similarity_metric].describe()})
metric_fivenum = pd.DataFrame(metric_fivenum_).transpose()
metrics_fivenum_[similarity_metric] = metric_fivenum
met... | Python | 1 |
cls.clean_csrf_token(csrf_token, payload)
additional_payload = {}
if audience := payload.get("aud"):
additional_payload["aud"] = audience
user = get_user(payload)
token = create_access_token(user, additional_payload=additional_payload)
if user and not user.is_anonymo... | Python | 1 |
it for the lock
(in blocking mode)
"""
self._flock(fcntl.LOCK_EX, blocking, timeout,
"Failed to lock %s in exclusive mode" % self.filename)
def Shared(self, blocking=False, timeout=None):
"""Locks the file in shared mode.
@type blocking: boolean
@param blocking: whether ... | Python | 1 |
bdir}")
else:
subdir_path.mkdir(parents=True, exist_ok=True)
self._log(f"Clientsサブディレクトリ作成: {subdir}")
return True
def _migrate_configuration_files(self) -> bool:
"""設定ファイル移行"""
self._log("設定ファイル移行中...")
# .mirralismディレクトリの確認・作成
... | Python | 1 |
command {
let mut method = None;
let mut uri = None;
let mut data = None;
let mut iter = args.into_iter();
while let Some(arg) = iter.next() {
match arg.as_ref() {
"-X" | "-m" | "--method" => {
method = Some(
iter.next()
... | Rust | 0 |
}
}
/// A client that interacts with TUF repositories.
pub struct Client<D, L, R, T>
where
D: DataInterchange + Sync,
L: Repository<D>,
R: Repository<D>,
T: PathTranslator,
{
tuf: Tuf<D>,
config: Config<T>,
local: L,
remote: R,
}
impl<D, L, R, T> Client<D, L, R, T>
where
D: Da... | Rust | 0 |
e, 3,
"incorrect value for obs[13].sid.code, expected 3, is {}",
msg.obs[13].sid.code
);
assert_eq!(
msg.obs[13].sid.sat, 18,
"incorrect value for obs[13].sid.sat, expected 18, is {}",
msg... | Rust | 0 |
as_ptr();
#[allow(clippy::cast_possible_truncation)]
let len = self.len() as u32;
unsafe { prints_l(ptr, len) }
}
}
impl<'a> Print for String {
#[inline]
fn print(&self) {
self.as_str().print()
}
}
impl Print for bool {
#[inline]
fn print(&self) {
let ou... | Rust | 0 |
from_vec, bytes_null, bytes_to_boxed_slice, convert_chain_ctx, convert_vmctx,
wasmjit_bytes_new, wasmjit_bytes_t, wasmjit_chain_context_get_exec_step,
wasmjit_chain_context_get_gas, wasmjit_chain_context_set_calloutput,
wasmjit_chain_context_set_exec_step, wasmjit_chain_context_set_gas, wasmjit_chain_contex... | Rust | 0 |
import torch
import triton
import triton.language as tl
@triton.jit
def _fwd_rmsnorm(
input_and_output: torch.Tensor, # [num_tokens, hidden_size], contiguous
weight: torch.Tensor, # [hidden_size]
eps: float,
hidden_size: tl.constexpr
):
# grid shape: [num_tokens]
my_token_id = tl.program_id(0)
input_and_outp... | Python | 1 |
z_xmm_xmmm32_er
Mnemonic::Divsd,// Divsd_xmm_xmmm64
Mnemonic::Vdivsd,// VEX_Vdivsd_xmm_xmm_xmmm64
Mnemonic::Vdivsd,// EVEX_Vdivsd_xmm_k1z_xmm_xmmm64_er
Mnemonic::Maxps,// Maxps_xmm_xmmm128
Mnemonic::Vmaxps,// VEX_Vmaxps_xmm_xmm_xmmm128
Mnemonic::Vmaxps,// VEX_Vmaxps_ymm_ymm_ymmm256
Mnemonic::Vmaxps,// EVEX_Vmaxp... | Rust | 0 |
(Horse, true) => "\u{E0DA}",
(Eel, false) => "\u{E0CB}",
(Eel, true) => "\u{E0DB}",
(Rabbit, false) => "\u{E0CC}",
(Rabbit, true) => "\u{E0DC}",
(Rooster, false) => "\u{E0CD}",
(Rooster, true) => "\u{E0DD}",
(Ox, false) => "... | Rust | 0 |
:Error,
"SECURITY_WARNING" => ValidatePolicyFindingType::SecurityWarning,
"SUGGESTION" => ValidatePolicyFindingType::Suggestion,
"WARNING" => ValidatePolicyFindingType::Warning,
other => ValidatePolicyFindingType::Unknown(other.to_owned()),
}
}
}
impl std::str... | Rust | 0 |
::new(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16);
let e: u8x16 = u8x16::new(41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26);
let r: u8x16 = transmute(vqsubq_u8(transmute(a), transmute(b)));
assert_eq!(r, e);
}
#[simd_test(enable = "neon")]
unsafe fn test_... | Rust | 0 |
&mut bytes[..],
s.use_base_2_indexing,
) {
Ok(x) => x,
Err(_) => return,
};
for op in s.ops.into_iter() {
match op {
Op::Push(x) => {
if !x.is_prefix() {
let _ = frb.push(x);
}
}
Op::Push... | Rust | 0 |
rendered depth image.
"""
# Update the OpenGL program.
program = self.depth_programs[obj_id]
program['u_mv'] = _calc_model_view(mat_model, mat_view)
program['u_mvp'] = _calc_model_view_proj(mat_model, mat_view, mat_proj)
# OpenGL setup.
gl.glEnable(gl.GL_DEPTH_TEST)
gl.glClearColor(0.0... | Python | 1 |
ab(|mut contents| {
contents.as_mut_slice().copy_from_slice(secret_vec);
});
let mime_type_str = proto.get_mime_type();
let mime_type = if mime_type_str.is_empty() {
JsNull::new().as_value(scope)
} else {
JsString::new_or_throw(scope, mime_type_str)?.as_value(scope)
};
... | Rust | 0 |
# Copyright (C) 2024 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
"""Mappers to aid in rendering of console output."""
from __future__ import annotations
from typing import TYPE_CHECKING
from ..models import RemoteToSMetadata
if TYPE_CHECKING:
from datetime import datetime
from pathlib import Path
... | Python | 1 |
use clap::{App, Arg, ArgMatches};
use std::io;
use diesel::prelude::*;
use crate::common::{inputs::get_state_input, storage::get_task};
use crate::domain::{Status, SuaideError, Task, TaskChangeSet};
use crate::state::State;
pub fn app<'a>() -> App<'a, 'static> {
App::new("status")
.about("Change the sta... | Rust | 0 |
data = self.dashboard.display_node_data(result_name, click_data)
self.assertTrue(all([isinstance(v, dict) for v in columns]))
self.assertTrue(all([isinstance(v, dict) for v in data]))
### Test Flowbased methods
def test_update_domain_dropdown(self):
result_name = "opf_market"
op... | Python | 1 |
ddr::from_hash(source.1, source.0)?;
Ok(addr.base58())
}
pub fn is(&self, json: &serde_json::Map<std::string::String, serde_json::Value>) {
let (len, source_base58) = self
.source_base58()
.expect("couldn't compute source base58");
let expected_source_base58 = j... | Rust | 0 |
or node in &(tree.nodes) {
let active = find_active_node(node);
if active.is_some() {
println!("{}", node.id);
let node = active.unwrap();
return Some(node.id);
}
}
None
}
fn main() {
let args: Vec<String> = env::args().collect();
match arg... | Rust | 0 |
t_real (bool): If ``True``, uses the real label as target, otherwise
uses the fake label as target.
Returns:
target (tensor): Target tensor vector.
"""
if t_real:
if self.real_label_tensor is None:
self.real_label_tensor = dis_... | Python | 1 |
int,
pub cmp_map: *mut cmp_map,
}
pub type sharedmem_t = sharedmem;
/*
american fuzzy lop++ - forkserver header
----------------------------------------
Originally written by <NAME>
Forkserver design by <NAME> <<EMAIL>>
Now maintained by <NAME> <<EMAIL>>,
<NAME> <<EMAIL>>,
... | Rust | 0 |
class Configuration:
TOKEN = "YOUR BOT TOKEN"
TOKEN_CONTRACT = "YOUR TOKEN CONTRACT"
ANIMATION_PATH = "https://iroh22zbyhnsd6p4n2xjoh3h3jokn3crsl6tf2poovear4ukkwaa.arweave.net/RFx9ayHB2yH5_G6ulx9n2lym7FGS_TLp7nVICPKKVYA"
MIN_TOKEN_VALUE_FILTER = 5
| Python | 1 |
fn read_sql<'a>(
py: Python<'a>,
conn: &str,
return_type: &str,
protocol: Option<&str>,
queries: Option<Vec<String>>,
partition_query: Option<read_sql::PartitionQuery>,
) -> PyResult<&'a PyAny> {
read_sql::read_sql(py, conn, return_type, protocol, queries, partition_query)
}
<reponame>inspi... | Rust | 0 |
by_shift(shift, targets & !END_ROWS, Move::new_push);
}
fn add_pawn_captures(&mut self, shift: usize, targets: BB) {
self.insert_promos_by_shift(shift, targets & END_ROWS, Move::new_capture_promotion);
self.insert_moves_by_shift(shift, targets & !END_ROWS, Move::new_capture);
}
}
impl Defa... | Rust | 0 |
from dataclasses import dataclass
from .mediastreams import MediaStreamTrack
from .rtcrtpreceiver import RTCRtpReceiver
from .rtcrtptransceiver import RTCRtpTransceiver
@dataclass
class RTCTrackEvent:
"""
This event is fired on :class:`RTCPeerConnection` when a new
:class:`MediaStreamTrack` is added by t... | Python | 1 |
from .colors import Rgb
class Skin:
class DefaultButton:
On = Rgb.RED
Off = Rgb.BLACK
class StepButton:
# StepButton.[Active][Step][Acc]
ActiveStep = Rgb.WHITE_w
ActiveStepAcc = Rgb.WHITE
InactiveStep = Rgb.CYAN_w
InactiveStepAcc = Rgb.CYAN
Acti... | Python | 1 |
from django.contrib import admin
from django.urls import path, include
from myapp import views
from django.contrib.auth import views as auth_views
from .views import CustomLoginView
urlpatterns = [
path('admin/', admin.site.urls),
path('search/', views.search, name='search'),
path('', views.home, name='hom... | Python | 1 |
rootAssembly=RootAssembly(
... instances=[...],
... patterns=[...],
... features=[...],
... occurrences=[...],
... fullConfiguration="default",
... configuration="default",
... documentId="a1c1addf75444f54b50... | Python | 1 |
rt(path.to_os_string(), ino);
self.inode_to_path.insert(ino, path.to_os_string());
ino
}
pub fn add_or_create_inode(&mut self, path: impl AsRef<Path>) -> u64 {
if let Some(x) = self.path_to_inode.get(path.as_ref().as_os_str()) {
return *x;
}
self.add_inode(p... | Rust | 0 |
), I (Invalid).
//! Effectively RTM attempts to ensure that all the
//! writes/reads you will perform are on E/F values
//! (Exclusive/Forward). This means you either own the
//! the only copy of this in Cache OR another thread may
//! read this data, but not write to it.
//!
//! If another thread attempts to write to ... | Rust | 0 |
ment).unwrap();
env::remove_var("BOOL_VAL_1");
config.try_into::<TestBoolEnum>().unwrap();
}
#[test]
#[should_panic(expected = "invalid type: string \"not an int\", expected i32")]
fn test_parse_int_fail() {
// using a struct in an enum here to make serde use `deserialize_any`
#[derive(Deserialize, D... | Rust | 0 |
bbox_min_xyz,
bbox_max_xyz,
center, S, R)
gaussian_volume = gaussian_volume + bone_volume
is_parent_joint = True
if not is_parent_joint:
if joint_idx == SMPL_JOINT_IDX['head']:
... | Python | 1 |
_conf, &task_conf, &benchmark_conf);
if let Some(time) = benchmark_conf.time {
sleep(time).await;
} else {
for worker in workers {
let _ = worker.await;
}
}
stop_token.store(true, Ordering::Relaxed);
if let Err(e) = stat_thread.await {
eprintln!("error aw... | Rust | 0 |
nces.set_account_balance(&sender_address, account_balance);
} else {
return Err(StdError::generic_err(format!(
"insufficient funds to burn: balance={}, required={}",
account_balance, amount_raw
)));
}
let mut config = Config::from_storage(&mut deps.storage);
let ... | Rust | 0 |
_name: str, api_key: str, secret_key: str, passphrase: str = None) -> bool:
"""设置交易所配置"""
try:
config = {
'api_key': api_key,
'secret_key': secret_key
}
if passphrase:
config['passphrase'] = passphrase
... | Python | 1 |
omical object's orbit. Dimensionless
/// * `as_degrees`:Interprets input and returns output in (deg) if `true` or (rad) if `false`
///
/// # Returns
///
/// * `anm_true`:true anomaly. Units: (rad) or (deg)
///
/// # Examples
/// ```
/// use rastro::orbits::anomaly_eccentric_to_true;
/// let ecc_anm = anomaly_eccentric_... | Rust | 0 |
self.char_map) + list(self.char_map.values()) + (excl_columns or []))
keep_columns(self.data, columns)
self.clean_memory()
def save(self, fname=None, fdir=None, other_columns='all'):
"""Save this object to a file.
The ``data`` attribute is saved to a ``config.file_format`` file and... | Python | 1 |
/**
* Update an existing project card.
*
* This function performs a `PATCH` to the `/projects/columns/cards/{card_id}` endpoint.
*
*
*
* FROM: <https://docs.github.com/rest/reference/projects#update-a-project-card>
*
* **Parameters:**
*
* * `card_id: i64` -- card_i... | Rust | 0 |
_dim {
for p in 0 .. src_w * src_h {
let u = src_buf[p + src_w * src_h * c] as f64;
let mut v: f64 = (u + noise[c] + 0.5);
if v < 0.0 {
v = 0.0;
} else if v > 255.0 {
v = 255.0;
}
buf.push(v as u8);
}
}
Array3d::from_storage((src_w,... | Rust | 0 |
e::U64,
left_bound: map_bound(&left_bound, &make_term_val),
right_bound: map_bound(&right_bound, &make_term_val),
}
}
/// Create a new `RangeQuery` over a `u64` field.
///
/// If the field is not of the type `u64`, tantivy
/// will panic when the `Weight` object is c... | Rust | 0 |
proposal_deposit: legacy_config.proposal_deposit,
voting_period: legacy_config.voting_period,
quorum: legacy_config.quorum,
threshold: legacy_config.threshold,
},
migration_poll_config,
auth_admin_poll_config,
admin_manager: deps.api.addr_... | Rust | 0 |
LedgerInfo for epoch {}.", epoch)))?;
ensure!(
li.ledger_info().version() == version,
"Epoch {} didn't end at version {}",
epoch,
version,
);
li.ledger_info()
.next_epoch_state()
.ok_or_else(|| format_err!("Not an epoch chan... | Rust | 0 |
]
#[doc = " \\return 0 on success, or -1 if gamma ramps are unsupported."]
#[doc = ""]
#[doc = " \\sa SDL_SetWindowGammaRamp()"]
pub fn SDL_GetWindowGammaRamp(
window: *mut SDL_Window, red: *mut Uint16, green: *mut Uint16, blue: *mut Uint16,
) -> libc::c_int;
}
pub mod SDL_HitTestResult {
#[doc = " \... | Rust | 0 |
h: lv_coord_t,
cf: lv_img_cf_t,
);
}
#[lvgl_macros::safe_wrap(attr)] extern "C" {
#[doc = " Set the color of a pixel on the canvas"]
#[doc = " @param canvas"]
#[doc = " - __`x`__: x coordinate of the point to set"]
#[doc = " - __`y`__: x coordinate of the point to set"]
#[doc = " - ... | Rust | 0 |
sad8x8_sse2, u8),
(rav1e_sad8x16_sse2, u8),
(rav1e_sad8x32_sse2, u8),
(rav1e_sad16x16_sse2, u8),
(rav1e_sad32x32_sse2, u8),
(rav1e_sad64x64_sse2, u8),
(rav1e_sad128x128_sse2, u8),
// AVX
(rav1e_sad16x4_avx2, u8),
(rav1e_sad16x8_avx2, u8),
(rav1e_sad16x16_avx2, u8),
(rav1e_sad... | Rust | 0 |
# -*- coding: utf-8 -*-
from urllib.parse import urljoin, urlsplit, parse_qsl
import getopt
import re
from core.scan.base_scanner import BaseScanner, ScannerThread
from core.scan.fuzzers.sqli_blind import Sqli_blind
from core.scan.fuzzers.sqli_error import Sqli_error
from core.scan.fuzzers.xss_reflected import XssRef... | Python | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.