text string | label_name string | labels int64 |
|---|---|---|
# SPDX-License-Identifier: CC-BY-NC-SA-4.0
# Author: Miriel (@mirielnet)
import discord
from discord.ext import commands
from discord import app_commands, ui
from core.connect import db
class InviteTracker(commands.Cog):
def __init__(self, bot: commands.Bot) -> None:
self.bot = bot
self.server_set... | Python | 1 |
ew::<square_meter>(1.0)
/// })
/// .validate("must be less than 0.0!!", |quantity| {
/// quantity < &Area::new::<square_meter>(0.0)
/// })
/// .into_result();
/// assert_eq!(
/// Err(Error {
/// label: "(mul)".to_string(),
/// msg: vec![
... | Rust | 0 |
from caskada import Flow
from nodes import ProcessChunkDocumentsNode, EmbedDocumentsNode, CreateIndexNode, EmbedQueryNode, ReduceChunksAndEmbeddingsNode, RetrieveDocumentNode, GenerateAnswerNode
from mapreduce import mapreduce
def get_document_flow():
# Create offline flow for document indexing
process_chunk_d... | Python | 1 |
# Problem: Write a Python function that takes an integer as input and returns the sum of its digits.
# Input: An integer n.
# Output: An integer representing the sum of the digits of n
def sum_of_digits(num):
sum = 0 # Initialize sum to 0
str_num = str(num) # Convert the integer to ... | Python | 1 |
);
check_console_index(CONSOLE_INDEX.ui, ui_console_index);
context.set_active_console(CONSOLE_INDEX.base);
context.with_post_scanlines(false);
context
}
fn add_console(&self, context: &mut Rltk, params: AddConsoleParameter) -> usize {
let tile_width = params.tile_wi... | Rust | 0 |
]
store_lib = Library("lib_id", "my_lib", "my_charm", 0, 2, "Lib contents", "hash")
path = fake_project_dir / utils.get_lib_path("my_charm", "my_lib", 0)
path.parent.mkdir(parents=True)
path.write_text("LIBID='id'\nLIBAPI=0\nLIBPATCH=1")
mock_store_anonymous_client.fetch_libraries_metadata.return_va... | Python | 1 |
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
from .batch_norm import FrozenBatchNorm2d, get_norm, NaiveSyncBatchNorm
# from .deformable.deform_conv import DeformConv, ModulatedDeformConv
# from .deformable.deform_conv_with_off import (DeformConvWithOff,
# ... | Python | 1 |
# Copyright 2017 The TensorFlow Authors. 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 applica... | Python | 1 |
connect_ipc_server().expect("failed to connect to server");
let (tx, rx) = channel.split().expect("failed to split channel");
let start = Instant::now();
let mut sum = 0.0;
while let Ok(msg) = rx.recv() {
let num = f64::from_le_bytes(<[u8; 8]>::try_from(&msg.data[..])?);
sum += num;
... | Rust | 0 |
get_or_init(Jieba::new);
let cutted = jieba.cut_all(match &sentence {
Either::A(s) => s.as_str(),
Either::B(b) => {
str::from_utf8(b.as_ref()).map_err(|_| Error::from_status(Status::InvalidArg))?
}
});
Array::from_vec(&env, cutted)
}
#[napi(ts_return_type = "string[]")]
pub fn cut_for_search(
... | Rust | 0 |
in_out_list]
tensors = check_tensors(tensors, "tensors")
assert len(tensors) == len(set(tensors)), (
"The argument 'tensors' of paddle.autograd.backward contains duplicate paddle.Tensor object."
)
if grad_tensors is not None:
if not isinstance(grad_tensors, (list, tuple)):
... | Python | 1 |
def Motif_search(Str, Motif=None):
"""Search a motif in a given Nuc string"""
Pos = []
if Motif is None:
Split_str = Str.split('\n')
Nuc_str = Split_str[0]
Motif = Split_str[1]
for i in range(0, len(Nuc_str) + 1):
if Motif == Nuc_str[i:i + len(Motif)]:
Pos.app... | Python | 1 |
e_confirm(&mut self, confirm2: ConfirmRx) -> Key {
Self::__internal_handle_confirm(&mut self.sta1, confirm2.msg())
}
fn sta2_handle_confirm(&mut self, confirm1: ConfirmRx) -> Key {
Self::__internal_handle_confirm(&mut self.sta2, confirm1.msg())
}
fn __internal_h... | Rust | 0 |
_high;
let lastblock: __m128i = $lastblock;
let lastnode: __m128i = $lastnode;
let mut v = [
h_vecs[0],
h_vecs[1],
h_vecs[2],
h_vecs[3],
h_vecs[4],
h_vecs[5],
h_vecs[6],
h_vecs[7],
set1(IV... | Rust | 0 |
);
Response::new(id.to_string().into())
},
(&Method::POST, Some(_)) => {
response_with_code(StatusCode::BAD_REQUEST)
},
(&Method::PUT, Some(id)) => {
if let Some(product) = products.get_mut(id) {
*product... | Rust | 0 |
R = crate::R<bool, bool>;
impl R {
#[doc = "Bit 20"]
#[inline(always)]
pub fn rtc_cntl_bbpll_cal_int_raw(&self) -> RTC_CNTL_BBPLL_CAL_INT_RAW_R {
RTC_CNTL_BBPLL_CAL_INT_RAW_R::new(((self.bits >> 20) & 0x01) != 0)
}
#[doc = "Bit 19"]
#[inline(always)]
pub fn rtc_cntl_glitch_det_int_ra... | Rust | 0 |
}
trait FooT {
fn bag(&self);
}
impl FooT for Foo {
fn bag(&self) {}
}
fn main() {
let f = Foo;
f.bat(1.0); //~ ERROR no method named
let s = "foo".to_string();
let _ = s.is_emtpy(); //~ ERROR no method named
// Generates a warning for `count_zeros()`. `count_ones()` is also a close
... | Rust | 0 |
::SegWit2x(_) => Some(Deployment {
name: "segwit",
bit: 1,
start_time: 1479168000,
timeout: 1510704000,
activation: Some(481824),
}),
ConsensusFork::BitcoinCash(_) => None,
},
fork: fork,
rule_change_activation_threshold: 1916, // 95%
miner_confirmation_window: 20... | Rust | 0 |
ate.flag_pypdf = False
# if 'flag_processed' not in st.session_state:
# st.session_state.flag_processed = False
# if uploaded_file:
# row0col1, row0col2, row0col3 = st.columns([1, 1, 1])
# with row0col1:
# if st.button(label='Run OCR'):
# with st.spinner("Please wait..."):
# ... | Python | 1 |
#!/usr/bin/env python3
"""
Simple example script to listen for Sonar 3D-15 data over multicast and store it to a file for later.
The "inspect_sonar_data.py" script can be used to read the data from the file and decode it.
REQUIREMENTS:
- Python 3
- Access to the multicast IP and port used by the Sonar 3D-15
- In... | Python | 1 |
import numpy as np
from opytimizer.optimizers.swarm import af
from opytimizer.spaces import search
def test_af_params():
params = {"c1": 0.75, "c2": 1.25, "m": 10, "Q": 0.75}
new_af = af.AF(params=params)
assert new_af.c1 == 0.75
assert new_af.c2 == 1.25
assert new_af.m == 10
assert new_... | Python | 1 |
from addons import get_message_tokens, txt2embeddings, search_results
from SETTINGS import SYSTEM_PROMPT, BOT_TOKEN, LINEBREAK_TOKEN, TABLE_NAME, DEVICE
from llama_cpp import Llama
def interact_manager(
model: Llama,
request: str,
content: str,
top_k: int = 30,
top_p: float = 0.9,
temperature: ... | Python | 1 |
_vm_group(
operation_config: &crate::OperationConfig,
subscription_id: &str,
resource_group_name: &str,
private_cloud_name: &str,
vm_group_id: &str,
workload_network_vm_group: &WorkloadNetworkVmGroup,
) -> std::result::Result<create_vm_group::Response, create_vm_group... | Rust | 0 |
from typing import Any, Dict
from qcengine.exceptions import InputError
def muster_modelchem(method: str, driver: "DriverEnum") -> Dict[str, Any]:
"""Converts the QC method into CFOUR keywords."""
method = method.lower()
opts = {}
if driver == "properties":
pass
else:
derint = d... | Python | 1 |
REV_R = crate::R<u32, u32>;
impl R {
#[doc = "Bits 0:31 - REV"]
#[inline(always)]
pub fn rev(&self) -> REV_R {
REV_R::new((self.bits & 0xffff_ffff) as u32)
}
}
use amethyst_assets::Format;
use amethyst_error::Error;
use serde::{Deserialize, Serialize};
use type_uuid::TypeUuid;
#[derive(Clone, ... | Rust | 0 |
bug(f'Pulse width: {pulse_width_us}, Duty cycle: {duty_cycle_value}')
wiringpi.pwmWrite(pin, duty_cycle_value)
def main(args=None):
rclpy.init(args=args)
gripper_driver_node = DriverGripper()
executor = MultiThreadedExecutor()
try:
rclpy.spin(gripper_driver_node, executor=executor)... | Python | 1 |
)]
plot_legend = ax.legend(handles=legend_handles, title=main_legend_title, bbox_to_anchor=(legend_x_pos, legend_y_pos), loc="center left",
fontsize=legend_fontsize, title_fontsize=legend_title_fontsize)
else:
ordered_unique_main_legend_values = list(final_color_map.k... | Python | 1 |
)
.field("protocol_record_iterator", &self.protocol_record_iterator())
.finish()
}
}
impl Serialize for SMBiosManagementControllerHostInterface<'_> {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: Serializer,
{
let mut state =
... | Rust | 0 |
import numpy as np
import gym
from gym import Env, spaces
import matplotlib as mpl
mpl.use('Agg')
import matplotlib.pyplot as plt
data_filename = "results/toyenv_samples.npz"
plot_filename = "toyenv_diffusion_samples.png"
# data_filename = "envs/toyenv/toyenv_dataset.npz"
# plot_filename = "toyenv_dataset.png"
steps... | Python | 1 |
)) # add the last named entity if it is not empty
#
# return named_entities
if __name__ == '__main__':
from AMR_utils import to_single_line_amr
from AMR_utils import noop_penman_decode
from AMRSimplifier import AMRSimplifier
from postprocess.postprocess_utils import amr_str_to_list
# from post... | Python | 1 |
G| GHd | | | | | | f GHq Wd S( Ns Value of '%s' issD Added '%s' on object '%s' (machine %s), instance %s(%d)-parent of %si ( R
t ParseCounterPathR& |