text string | label_name string | labels int64 |
|---|---|---|
Mult):
return left * right
elif isinstance(operator, ast.Div):
return left / right
elif isinstance(operator, ast.FloorDiv):
return left // right
elif isinstance(operator, ast.Mod):
return left % right
elif isinstance(operator, ast.Pow):
... | Python | 1 |
}
pub const EMPTY_ROOT_HASH: [u8; 32] = [0u8; 32];
<filename>src/generate.rs
//! Provides methods to generate random polygons.
extern crate rand;
use super::*;
use self::rand::{thread_rng, sample};
use self::rand::distributions::{IndependentSample, Range};
use std::cmp::Ordering;
/// Describes the mode used to gen... | Rust | 0 |
\n.twocol {\
\n width: 14.364640884%;\
\n width: calc((100% - 5rem) / 6);\
\n}\
\n.threecol {\
\n width: 22.9281767956%;\
\n width: calc((100% - 3rem) / 4);\
\n}\
\n.fourcol {\
\n width: 31.4917127072%;\
\n width: calc((100% -... | Rust | 0 |
""" Real labels evaluator for ImageNet
Paper: `Are we done with ImageNet?` - https://arxiv.org/abs/2006.07159
Based on Numpy example at https://github.com/google-research/reassessed-imagenet
Hacked together by / Copyright 2020 Ross Wightman
"""
import os
import json
import numpy as np
class RealLabelsImagenet:
... | Python | 1 |
assert_eq!(&super::ENCODER_18.generator[..], &generator_poly(18)[..]);
assert_eq!(&super::ENCODER_19.generator[..], &generator_poly(19)[..]);
assert_eq!(&super::ENCODER_20.generator[..], &generator_poly(20)[..]);
assert_eq!(&super::ENCODER_21.generator[..], &generator_poly(21)[..]);
... | Rust | 0 |
};
use std::path::PathBuf;
#[derive(Default, Debug, Deserialize, Clone)]
#[serde(default)]
pub struct Source {
pub path: PathBuf,
pub enabled: bool,
pub excludes: HashSet<PathBuf>,
}
#[derive(Default, Debug, Deserialize, Clone)]
#[serde(default)]
pub struct Settings {
pub debug: bool,
pub excludes... | Rust | 0 |
acleKey,
Blake2_128Concat,
T::AccountId,
TimestampedValue<UnsignedFixedPoint<T>, T::Moment>,
>;
#[pallet::storage]
/// if a key is present, it means the values have been updated
pub type RawValuesUpdated<T: Config> = StorageMap<_, Blake2_128Concat, OracleKey, bool>;
/// Tim... | Rust | 0 |
()
}
fn case01_iter_all(bytes: &[u8]) {
bytes.iter().all(|b| b.is_ascii())
}
fn case02_align_to(bytes: &[u8]) {
is_ascii_align_to(bytes)
}
fn case03_align_to_unrolled(bytes: &[u8]) {
is_ascii_align_to_unrolled(bytes)
}
}
// These are separate since it's easier to ... | Rust | 0 |
8::new(2000));
let invest = query_investment(deps.as_ref()).unwrap();
assert_eq!(invest.token_supply, Uint128::new(3000));
assert_eq!(invest.staked_tokens, coin(4500, "ustake"));
assert_eq!(invest.nominal_value, ratio);
}
#[test]
fn bonding_fails_with_wrong_denom() {
... | Rust | 0 |
Config::default()
/// }
/// );
/// rustlet!("hello_world", {
/// response!("Hello World\n");
/// });
/// // maps the uri /hello to the rustlet "hello_world"
/// rustlet_mapping!("/hello", "hello_world");
/// Ok(())
/// }
/// ```
#[macro_export]
macro_rules! rustlet_mapping {
($a... | Rust | 0 |
import math
from typing import cast
import cairo
from gi.repository import Gtk
from fabric.widgets.image import Image
class CustomImage(Image):
def do_render_rectangle(
self, cr: cairo.Context, width: int, height: int, radius: int = 0
):
cr.move_to(radius, 0)
cr.line_to(width - radiu... | Python | 1 |
null()).status()?;
target_dir.push("klee-last/");
Ok(target_dir)
}
/// Builds the test harness.
fn build_test_harness(
input: &GenerateInput,
cargo_path: &mut PathBuf,
target_dir: &mut PathBuf,
project_name: &mut String,
) -> Result<ExitStatus, std::io::Error> {
let mut cargo = Command::n... | Rust | 0 |
box` crate.
/*
While this is not a direct copy of the `smallbox` crate, it is heavily based on the
smallbox source code, which is licensed MIT as follows:
The MIT License (MIT)
Copyright (c) 2015 <NAME>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated doc... | Rust | 0 |
render!(
MyTemplate { name: "World" },
include_str!("./templates/file.rendered")
);
}
use crate::migrate::migration::Migration;
pub fn to_sql_migrations(migrations: Vec<Migration>) -> Vec<SqlMigration> {
migrations.into_iter().map(SqlMigration::new).collect()
}
#[derive(Clone, Debug, PartialEq... | Rust | 0 |
always)]
pub fn variant(&self) -> crate::Variant<u8, DTOCVACK_A> {
use crate::Variant::*;
match self.bits {
0 => Val(DTOCVACK_A::_0000),
1 => Val(DTOCVACK_A::_0001),
2 => Val(DTOCVACK_A::_0010),
3 => Val(DTOCVACK_A::_0011),
4 => Val(DTOCVAC... | Rust | 0 |
import pandas as pd
SUBSET = "artifacts/viznet-subset.parquet"
subset = pd.read_parquet(SUBSET)
# shuffle the data
subset = subset.sample(frac=1.0, random_state=0)
import os
import openai
from openai import OpenAI
from ratelimiter import RateLimiter
import pandas as pd
import numpy as np
from tqdm import tqdm
impor... | Python | 1 |
# -*- coding: utf-8 -*-
# Copyright(C) 2013 Julien Veyssier
#
# This file is part of a weboob module.
#
# This weboob module is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the Lice... | Python | 1 |
# -*- coding: utf-8 -*-
#
# RERO ILS
# Copyright (C) 2022 RERO
# Copyright (C) 2022 UCLouvain
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# This program ... | Python | 1 |
+= len(objs)
self.assertEqual(obj_count, 6)
def test_update(self):
self.serializer_pop_related_fields_data_patcher.start()
expected_data = {"name": "John", "last_name": "Richards"}
instance = MockModel(name="John", last_name="Doe")
instance = self.mock_serializer.update(... | Python | 1 |
stars>1-10
use super::Dce;
use swc_common::{Fold, FoldWith, Spanned};
use swc_ecma_ast::*;
use swc_ecma_utils::{find_ids, ident::IdentLike};
impl Fold<FnDecl> for Dce<'_> {
fn fold(&mut self, mut f: FnDecl) -> FnDecl {
if self.is_marked(f.span()) {
return f;
}
if self.marking_p... | Rust | 0 |
import numpy as np
from simple_Rabbitmq import ACT
if __name__ == "__main__":
# Create a sample P array
P = np.array([[1, 2, 3],
[0, 0, 0],
[0, 0, 0]])
# Create an instance of the ACT class with the sample array and an array_ID
act_instance = ACT(P, "array_001")
... | Python | 1 |
e_or_series)
msg = r"take\(\) got an unexpected keyword argument 'foo'"
with pytest.raises(TypeError, match=msg):
obj.take(indices, foo=2)
msg = "the 'out' parameter is not supported"
with pytest.raises(ValueError, match=msg):
obj.take(indices, out=indices)
... | Python | 1 |
with the `sgx_get_key()` inside-the-enclave method.
#[derive(Default)]
pub struct KeyRequest(sgx_key_request_t);
impl_ffi_wrapper_base! {
KeyRequest, sgx_key_request_t, KEY_REQUEST_SIZE;
}
impl_serialize_to_x64! {
KeyRequest, KEY_REQUEST_SIZE;
}
impl KeyRequest {
/// Retrieve the name of the key containe... | Rust | 0 |
####################################################################################################
#
# PySpice - A Spice Package for Python
# Copyright (C) 2014 Fabrice Salvaire
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published... | Python | 1 |
def is_pandas_df(obj):
"""Check if an object is a Pandas DataFrame
Returns
-------
bool
Returns True if object is a Pandas DataFrame and False otherwise
"""
return obj.__class__.__module__ == "pandas.core.frame" and obj.to_records and obj.to_dict
def has_geo_interface(obj):
return... | Python | 1 |
from reportlab.pdfgen import canvas
import os
def save_pdf_with_qr_code(filedialog, entry_data, fill_color_var, bg_color_var, logo_path_var, transparent_bg_var, shape_var, error_correction_var, size_var, border_width_var, watermark_var, gradient_color_var, create_qr_code):
file_path = filedialog.asksaveasfilenam... | Python | 1 |
alpha: HidePH<A>,
beta: B,
gamma: HidePH<G>,
}
#[derive(Debug, Arbitrary)]
struct T4(T3<NotArbitrary, bool, NotArbitrary>);
*/
#[derive(Debug, Arbitrary)]
#[proptest(no_bound)]
struct T5<A, B, C>(HidePH<(A, B, C)>);
#[derive(Debug, Arbitrary)]
struct T6(T5<NotArbitrary, NotArbitrary, NotArbitrary>);
#[t... | Rust | 0 |
iptor {
static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy {
lock: ::protobuf::lazy::ONCE_INIT,
ptr: 0 as *const ::protobuf::reflect::MessageDescriptor,
};
unsafe {
descriptor.get(|| {
... | Rust | 0 |
dd_input(
var_name="cross_section_Ix",
var_type=float,
default_value=-1,
unit=None,
descr="Enter the second moment of area of the cross-section \
about the horizontal axis, in m⁴.",
xpath=FRAMAT_IX_XPATH,
gui=INCLUDE_GUI,
gui_name="Second moment of area Ix [m⁴]",
gui_grou... | Python | 1 |
with pl.SQLContext(frame=df) as ctx:
res1 = ctx.execute(
"""
SELECT
c,
SUM(b) AS total_b,
COUNT(b) AS count_b,
COUNT(*) AS count_star
FROM frame
GROUP BY 1
ORDER BY c
"""
)... | Python | 1 |
. current tab, scroll state of scorecard
pub struct UiState {
/// Selected tab
pub focused_tab: usize,
/// Stores current scroll value and max scroll value for each tab
pub scrd_scroll: Vec<(u16, u16)>,
}
impl UiState {
/// Return a new `UiState` struct
///
/// # Arguments
///
/// *... | Rust | 0 |
tionState.BAD_PASSWORD:
raise InvalidAuth
if self.authentication.state == AuthenticationState.REQUIRES_VALIDATION:
raise RequireValidation
if self.authentication.state != AuthenticationState.AUTHENTICATED:
_LOGGER.error("Unknown authentication state: %s", self.authe... | Python | 1 |
class Solution:
def makeLargestSpecial(self, s: str) -> str:
specials = []
count = 0
i = 0
for j, c in enumerate(s):
count += 1 if c == '1' else -1
if count == 0:
specials.append(
'1' + self.makeLargestSpecial(s[i + 1:j]) + '0')
i = j + 1
return ''.join(so... | Python | 1 |
alue::AnyOutputs(_) => f.write_str("Any Outputs"),
}
}
}
fn log_error<T>(req: DbKey, err: OutputManagerStorageError) -> Result<T, OutputManagerStorageError> {
error!(
target: LOG_TARGET,
"Database access error on request: {}: {}",
req,
err.to_string()
);
Err(err)... | Rust | 0 |
kend = BitMapBackend::new(path.as_ref(), self.size);
self.plot_with_backend(backend, targets, db, relative, transitive, start_date)
}
}
}
pub fn plot_with_backend<T, U>(
&self,
backend: T,
targets: &[U],
db: &Db,
relative: bool,
... | Rust | 0 |
ever have to worry about.
//
// The only reason alignment matters is that, in order to learn what data
// is bound, we would normally first load the type descriptors: but their
// location is ultimately depend on their content! There is, however, a
// workaround. We can load the tydesc from the rust_opaque_box, whic... | Rust | 0 |
: Res<Time>,
audio: Res<Audio>,
music: Res<AudioAssets>,
) {
for event in er_stats_change.iter() {
for (e, mut card) in query.iter_mut() {
if card.id == event.card_id {
if event.hp < 0 {
audio.play_in_channel(music.attack.clone(), &AudioChannel::new("S... | Rust | 0 |
import functools
import threading
from typing import (
Any,
Callable,
Set,
Tuple,
TypeVar,
cast,
)
import warnings
from web3.exceptions import (
Web3ValueError,
)
TFunc = TypeVar("TFunc", bound=Callable[..., Any])
def reject_recursive_repeats(to_wrap: Callable[..., Any]) -> Callable[...,... | Python | 1 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from erpnext.accounts.report.accounts_receivable.accounts_receivable import ReceivablePayableReport
def execute(filters=None):
args = {
"account_type": "Payable",
"naming_by": ["Buying... | Python | 1 |
v);
println!("vec 3 is {:?}", v[3]); // 访问动态数组里面的元素
println!("vec 5 is {:?}", v.get(5)); // 同上
vecShow(v);
// 双端队列
let mut vd: VecDeque<u32> = VecDeque::new();
let mut _vd: VecDeque<u32> = VecDeque::with_capacity(10);
vd.push_back(1);
vd.push_back(2);
vd.push_front(1);
vd.push_... | Rust | 0 |
backward_ops) so undo/redo remains correct.
"""
fwd, bwd = [], []
cur = getattr(node, "parent", None)
if toggled_to is False:
# any "not completed" child means parent can't be completed
while cur is not None:
before = bool(getattr(cur, "completed", False))
if bef... | Python | 1 |
import pyroute2
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.doctest',
'sphinx.ext.inheritance_diagram',
'aafigure.sphinxext',
'code_include.extension',
]
aafig_format = {'html': 'svg', 'man': None, '': None}
inheritance_graph_attrs = {'rankdir': 'LR', 'ratio': 'auto'}
source_suffix = '.rst'
... | Python | 1 |
from typing import Annotated, Literal
from langchain_ollama import ChatOllama
from langchain_tavily import TavilySearch
from langchain_core.messages import BaseMessage, AIMessage, ToolMessage
from langchain_core.prompts import ChatPromptTemplate, MessagesPlaceholder
from typing_extensions import TypedDict
from langgrap... | Python | 1 |
ble = "neon")]
unsafe fn test_vmulq_u8() {
let a: u8x16 = u8x16::new(1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2);
let b: u8x16 = u8x16::new(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16);
let e: u8x16 = u8x16::new(1, 4, 3, 8, 5, 12, 7, 16, 9, 20, 11, 24, 13, 28, 15, 32);
... | Rust | 0 |
-> Result<SpendInfo, TaprootErr> {
// The tree needs to consist of a single node to be considered complete.
// In this case, the first node needs to be some and the rest of the nodes array needs to be none.
let non_root_nodes = &self.nodes[1..];
if self.nodes[0].is_none() || !non_root_n... | Rust | 0 |
2,
tir.Evaluate(tir.IntImm("int32", 0)),
tir.Evaluate(tir.IntImm("int32", 1)),
)
# Check if the generated ir is expected
assert_structural_equal(ir_actual, ir_expected, map_free_vars=True)
def test_ir_builder_tir_buffer_store():
buffer_a = T.buffer_decl((10, 10), "float32")
i = T.... | Python | 1 |
for RandomStringGenerator {
type Item = String;
fn next(&mut self) -> Option<String> {
loop {
let n_words = self.rng.gen_range(1, self.max_words);
let generated_value = self
.vocabulary
.iter()
.choose_multiple(&mut self.rng, n_wo... | Rust | 0 |
df_indexes = []
columns = df.columns.tolist()
print("colunas", columns)
for i in range(len(columns)):
column = columns[i]
column_values = df[column].tolist()
print("ddd", column_values)
indexes = select_mean(i, column_values, columns, n_solutions)
df_indexes += i... | Python | 1 |
# Mantid Repository : https://github.com/mantidproject/mantid
#
# Copyright © 2020 ISIS Rutherford Appleton Laboratory UKRI,
# NScD Oak Ridge National Laboratory, European Spallation Source,
# Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
# SPDX - License - Identifier: GPL - 3.0 +
# T... | Python | 1 |
return {
"success": True,
"username": username,
"profile_data": profile_data,
"message": f"Successfully fetched profile for @{username}"
}
except HTTPException as e:
return {
"success": False,
"username": username,
... | Python | 1 |
# -*- coding: UTF-8 -*-
'''
bnwmovies scraper for Exodus forks.
Nov 9 2018 - Checked
Updated and refactored by someone.
Originally created by others.
'''
import re,traceback,urllib,urlparse,base64
import requests
from resources.lib.modules import cleantitle
from resources.lib.modules import client
fro... | Python | 1 |
:rtype: str
"""
return self._Remark
@Remark.setter
def Remark(self, Remark):
self._Remark = Remark
def _deserialize(self, params):
self._MiniAppID = params.get("MiniAppID")
self._MiniAppName = params.get("MiniAppName")
self._Mode = params.get("Mode")
... | Python | 1 |
Item number.
column : int
Column number.
"""
# check all / uncheck all state
show_all_item = self.filter_treewidget.topLevelItem(0)
level_items = [show_all_item.child(ii) for ii in range(show_all_item.childCount())]
if item is show_all_item:
... | Python | 1 |
# -*- coding: utf-8 -*-
#
# Copyright 2017, Rambler Digital Solutions
#
# 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 app... | Python | 1 |