text string | label_name string | labels int64 |
|---|---|---|
from PySide6 import QtWidgets
from PySide6.QtCore import QEasingCurve, QPropertyAnimation
from PySide6.QtWidgets import QApplication, QDialog, QFileDialog
from uiStyleDialog import Ui_StyleDialog
class StyleDialog(QDialog):
def __init__(self,app:QApplication):
super().__init__()
self.uiDialog = Ui... | Python | 1 |
tensor(getWorld2View2(R, T, trans, scale)).transpose(0, 1)
projection_matrix = getProjectionMatrix_refine(torch.Tensor(K), image_height, image_width, znear, zfar).transpose(0, 1)
full_proj_transform = (world_view_transform.unsqueeze(0).bmm(projection_matrix.unsqueeze(0))).squeeze(0)
camera_center = world_vi... | Python | 1 |
prev = Some(i)
}
collapse_state_maps(&initial, 0);
}
#[test]
fn check_that_maps_match_returns_if_both_empty() {
check_that_maps_match(&BTreeMap::new(), &BTreeMap::new());
assert!(true);
}
#[test]
#[should_panic(expected = "Missing")]
fn check_th... | Rust | 0 |
cpu::read_opcode(test_cpu.memory, 0);
assert_eq!(test_cpu.opcode, 0b1111_0000_0000_1111);
}
#[test]
fn test_get2opbytes() {
let mut test_cpu = cpu::Cpu::new();
test_cpu.opcode = 0xF923;
let result = test_cpu.get2opbytes(0x00FF);
assert_eq!(0x0023, result);
}
... | Rust | 0 |
e<K, W>,
K, V, W,
CompoundKey<K>>
for AdjacencyGraph<K, V, W>
where K: Hash + Eq + Clone,
W: Add + Sub + Eq + Ord + Copy,
{
fn add_vertex(&mut self, vertex: SimpleVertex<K, V>) -> Option<SimpleVertex<K, V>> {
if let Some(
AdjacencyList{
vertex: old_verte... | Rust | 0 |
an additional struct
/// which will be used as an item for query iterators. The implementation also generates two other
/// structs that implement [`Fetch`] and [`FetchState`] and are used as [`WorldQuery::Fetch`](WorldQueryGats::Fetch) and
/// [`WorldQuery::State`] associated types respectively.
///
/// The derive ma... | Rust | 0 |
from mininet.net import Mininet
from mininet.node import OVSSwitch, Controller, RemoteController
from mininet.cli import CLI
from mininet.log import setLogLevel
from mininet.link import TCLink
def runIperf(net, src, dst, bw_limit, duration=10):
src_node = net.get(src)
dst_node = net.get(dst)
# Display info... | Python | 1 |
xcd\x90\x87\x97\xb2\xdc\xfc\xbe\x61\
\xf2\x56\xd3\xab\x14\x2a\x5d\x9e\x84\x3c\x39\x53\x47\x6d\x41\xa2\
\x1f\x2d\x43\xd8\xb7\x7b\xa4\x76\xc4\x17\x49\xec\x7f\x0c\x6f\xf6\
\x6c\xa1\x3b\x52\x29\x9d\x55\xaa\xfb\x60\x86\xb1\xbb\xcc\x3e\x5a\
\xcb\x59\x5f\xb0\x9c\xa9\xa0\x51\x0b\xf5\x16\xeb\x7a\x75\x2c\xd7\
\x4f\xae\xd5\xe9\xe... | Rust | 0 |
from gradio_client import Client
import json
def step1(user_query):
client = Client("kskkoushik135/coursecrafter" , hf_token ='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')
result = client.predict(
fn_name="step1",
query= user_query,
api_name="/predict"
)
j_str = result.... | Python | 1 |
ederect from/to `/dev/null`:
/// ubend!(echo "hello world" >Null);
///
/// // Explicitely capture a stream:
/// ubend!(echo "hello world" 0<Pipe 1>Pipe 2>Pipe);
///
/// // Other way to redirect stdout/stderr to stderr/stdout:
/// use ubend::Target;
/// ubend!(echo "hello world" >(Redirect(Target::Stderr)));
/// ubend... | Rust | 0 |
expected_output = {
"active_translations": {"dynamic": 3, "extended": 3, "static": 0, "total": 3},
"cef_punted_pkts": 0,
"cef_translated_pkts": 0,
"dynamic_mappings": {
"inside_source": {
"id": {
1: {
"access_list": "102",
"matc... | Python | 1 |
# Foremast - Pipeline Tooling
#
# Copyright 2018 Gogo, LLC
#
# 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... | Python | 1 |
wcpath_basename()
// basename to (cmd, detached)
.and_then(
// test if starts with DETACHED_PROC_PREFIX
|basename| match basename.chars().next()? == DETACHED_PROC_PREFIX {
// detached proc: remove prefix from the basename -> cmd
... | Rust | 0 |
als(9));
}
<gh_stars>0
use crate::year_2019::intcode_interpreter::IntcodeInterpreter;
use std::io;
use extended_io::pipe::{PipeRead, PipeWrite};
pub(super) fn run() -> io::Result<()> {
let prog = IntcodeInterpreter::<PipeRead, PipeWrite>::read_from_file("2019_5.txt")?;
{
println!("Day 5 Part 1");
... | Rust | 0 |
recipe_update: AttributeRecipeStep = _EMPTY_RECIPE_STEP,
) -> EntityRelationshipEdge:
return EntityRelationshipEdge(
tail_node=tail_node,
head_node=head_node,
_recipe_update=recipe_update,
)
@cached_property
@override
def comparison_key(self) -> Compa... | Python | 1 |
c = np.asarray(eigvec)
assert eigval.shape == (3,)
assert eigvec.shape == (3, 3)
self._init(locals())
def _get_augment_params(self, img):
assert img.shape[2] == 3
ret = self.rng.randn(3) * self.std
return ret.astype('float32')
def _augment(self, img, v):
... | Python | 1 |
for desired_path in file_paths:
match = next((f for f in archive_filenames if f.endswith(desired_path)), None)
if match:
matching_files.append(match)
else:
... | Python | 1 |
_idx = j
result[i] = ivs[min_idx]
return result
def _gpu_nearest(strikes_gpu, maturities_gpu, ivs_gpu, coords_gpu):
n_queries = coords_gpu.shape[0]
result = cp.empty(n_queries, dtype=cp.float64)
for i in range(n_queries):
dist = (strikes_gpu - coords_gpu[i, 0]) ** 2 + (
mat... | Python | 1 |
node_counter[0] += 1
new_node = {"node_id": curr_id}
if "leaf_value" in node:
new_node["leaf_value"] = float(node["leaf_value"])
else:
new_node["best_feature"] = float(node["feature"])
new_node["split_bin"] = float(node["bi... | Python | 1 |
from Bio import pairwise2
from Bio.Seq import Seq
import numpy as np
import pandas as pd
# === 1. Your sequence ===
seq = ("CATTTCCAGAAACAGATCATATTGGCTCAGTGGATAGCGCACTGGACTTGAGATCCAAAGGACGCGAGTTCAAGTCTTACAGCAGCAGATTTTTTTTTCGGAGGGGGGTCTCGTTTTTTTAACATTTATGTATTTAAAAATGTTTGTTCATTTATTTGTACTTTTTTCTTTACACTTGAATTTTTTTTCTATTTT... | Python | 1 |
let inspector = inspector_for_reader_test();
inspector.serve(&mut fs).expect("failed to serve inspector");
// Create a connection to the ServiceFs.
let (h0, h1) = zx::Channel::create().unwrap();
fs.serve_connection(h1).unwrap();
let ns = fdio::Namespace::installed().unwrap()... | Rust | 0 |
from django.shortcuts import render
from rest_framework import viewsets
from .models import Videojuegos
from .serializers import VideojuegoSerializer
class VideojuegosViewSet(viewsets.ModelViewSet):
queryset = Videojuegos.objects.all()
serializer_class = VideojuegoSerializer
| Python | 1 |
BaseTokenizer { vocab: Arc::new(vocab), lower_case, strip_accents }
}
pub fn from_existing_vocab(vocab: Arc<T>, lower_case: bool, strip_accents: bool) -> BaseTokenizer<T> {
BaseTokenizer { vocab, lower_case, strip_accents }
}
}
impl<T: Vocab + Sync + Send> Tokenizer<T> for BaseTokenizer<T... | Rust | 0 |
from .datasets_py.quadSDKDataset import QuadSDKDataset
from .graphParser import NormalRobotGraph
from pathlib import Path
import matplotlib.pyplot as plt
import numpy as np
import torch
import torch_geometric
from torch_geometric.data import Data, HeteroData
import networkx
from torchmetrics import ConfusionMatrix
def... | Python | 1 |
mode disabled."]
DISABLED,
#[doc = "The I 2C module will enter monitor mode. In this mode the SDA output will be forced high. This will prevent the I2C module from outputting data of any kind (including ACK) onto the I2C data bus. Depending on the state of the ENA_SCL bit, the output may be also forced high, p... | Rust | 0 |
false, true, false])), chunk(&[0x02]));
// bitvector TFTFFFTTFT
t(Compact(GenericArray::<bool, U10>::from([true, false, true, false, false, false, true, true, false, true])),
chunk(&[0xc5, 0x02]));
// bitvector TFTFFFTTFTFFFFTT
t(Compact(GenericArray::<bool, U16>::from([true, false, true, false, false, false, tr... | Rust | 0 |
],
});
write_stream.write_all(buffer.entry_slice()).unwrap();
write_stream.write_all(read_addr.bytes()).unwrap();
buffer.clear_data();
recv_packet(&mut buffer, &mut read_stream);
assert_eq!(buffer.contents(), EntryContents::Senti{
id: &id,
flags: &... | Rust | 0 |
])
}
fn builtin_help(args: &[&str], shell: &mut Shell) -> i32 {
let builtins = shell.builtins;
let stdout = io::stdout();
let mut stdout = stdout.lock();
if let Some(command) = args.get(1) {
if builtins.contains_key(command) {
if let Some(bltin) = builtins.get(command) {
... | Rust | 0 |
i.immediate_ui(|gui| {
let ctx = gui.context();
egui::TopBottomPanel::bottom("Debug")
.default_height(350.0)
.resizable(true)
.max_height(500.0)
.show(&ctx, |mut ui| {
self.debug_log_menu(&mut ui, time);
... | Rust | 0 |
arbons_automobiles_juries'
global g_aqeowmq94
'# shade_tissue_densities -> carbons_automobiles_juries'
from k_rrnhkr7iw import xawlc4b0oqg, x4gjqjsh_2g as vyyoui4c1f3, rajb7gg4u9u, jtil8729w7k as q_10eky346e
del qm7m8_5afqu
assert b'', iei7b6o1fvp
'# shade_tissue_densities -> carbons_automobiles... | Python | 1 |
import torch
from torch import nn
# Same as the SamVisionAttention forward method in the v4.51.3 transformers
def forward_fn():
def forward(self, hidden_states: torch.Tensor, output_attentions=False) -> torch.Tensor:
batch_size, height, width, _ = hidden_states.shape
# qkv with shape (3, batch_siz... | Python | 1 |
let _guard = lock();
let framework = make_framework();
let vector = framework.vector("test-vector", VECTOR_CONFIG).await?;
framework
.wait_for_rollout("test-vector", "daemonset/vector", vec!["--timeout=60s"])
.await?;
let test_namespace = framework.namespace("test-vector-test-pod")... | Rust | 0 |
, 300), Ok(()));
// println!("{:?}", cache);
// assert_eq!(cache.flush(), Ok(()));
// println!("{:?}", cache);
// assert_eq!(cache.get(&3), Some(300));
// assert_eq!(cache.get(&2), Some(200));
// assert_eq!(cache.get(&1), Some(100));
// }
// }
use float_eq::{
As... | Rust | 0 |
sabun:',
'zh': ':皂:',
'ru': ':мыло:'
},
'\U000026BD': { # ⚽
'en': ':soccer_ball:',
'status': fully_qualified,
'E': 0.6,
'alias': [':soccer:'],
'variant': True,
'de': ':fußball:',
'es': ':balón_de_fútbol:',
'fr': ':ballon_de_footbal... | Python | 1 |
pub y: i64,
pub z: i64,
}
#[derive(Copy, Clone, Debug, Eq, Hash, PartialEq)]
pub struct Vel {
pub x: i64,
pub y: i64,
pub z: i64,
}
#[derive(Copy, Clone, Debug, Eq, Hash, PartialEq)]
pub struct Moon {
pub pos: Pos,
pub vel: Vel,
}
impl Moon {
pub fn new(x: i64, y: i64, z: i64) -> Self {
... | Rust | 0 |
"""Superfluid action provider for streaming payments."""
| Python | 1 |
""" Crear una función es_par(numero) que devuelva True o False. / Crear una función area_rectangulo(ancho, alto) que calcule el área. / Importar math y usar sqrt, pow, pi. """
# Ejercicio 1: Crear una función es_par(numero) que devuelva True o False.
def es_par(numero):
return numero % 2 == 0
# Ejercicio 2: C... | Python | 1 |
random::<f32>() * 200.0 + 50.0,
0.0,
),
},
bunnies,
)
.with(transform, transforms)
.build();
self.count += 1;
}
}
impl<'s> System<'s> for SpawnBunniesSystem {
type SystemData = (
Ent... | Rust | 0 |
from rest_framework import serializers
class GetStrategyResultsRequestSerializer(serializers.Serializer):
symbols = serializers.CharField(max_length=16, required=True)
timeframe = serializers.CharField(max_length=8, required=True)
start = serializers.DateTimeField(required=False)
end = serializers.Date... | Python | 1 |
tests {
use super::is_hash;
#[test]
fn examples() {
let test_hashes = [
"4be1767e-fe51-4eba-9fe7-8118f4b1d888",
"VuhA1t8McNh8LMje7Y0MXoWqEgI",
"vFzxUN6mMuMFdYCJ9vZAZLBlYHJyJTQD2iI50oSZx",
"AU6CRgE6nMwqBIxZKzzZZ4-bGatF",
"7F9EC3B9-9450-49AE-... | Rust | 0 |
parsing_state: &mut ResponseParsingState<'message>) -> Result<usize, DnsProtocolError>
{
let (time_to_live, resource_data) = self.validate_class_is_internet_and_get_time_to_live_and_resource_data(end_of_name_pointer, end_of_message_pointer, DataType::URI, response_parsing_state)?;
const PrioritySize: usize = 2;
... | Rust | 0 |
static_init!(
stm32f412g::syscfg::Syscfg,
stm32f412g::syscfg::Syscfg::new(rcc)
);
let exti = static_init!(stm32f412g::exti::Exti, stm32f412g::exti::Exti::new(syscfg));
let dma1 = static_init!(stm32f412g::dma1::Dma1, stm32f412g::dma1::Dma1::new(rcc));
let peripherals = static_init!(
... | Rust | 0 |
_12(b: &mut Bencher) {
let decoded = decode_finite(f64::MAX);
let mut buf = [MaybeUninit::new(0); 12];
b.iter(|| {
format_exact(&decoded, &mut buf, i16::MIN);
});
}
#[bench]
fn bench_small_exact_inf(b: &mut Bencher) {
let decoded = decode_finite(3.141592f64);
let mut buf = [MaybeUninit:... | Rust | 0 |
false, true);
let s1 = SweepEvent::new_rc(0, xy(0, 0), true, Rc::downgrade(&other_s1), false, true);
let other_s2 = SweepEvent::new_rc(0, xy(0.0001, 1), false, Weak::new(), false, true);
let s2 = SweepEvent::new_rc(0, xy(0, 0), true, Rc::downgrade(&other_s2), false, true);
assert!(s1.i... | Rust | 0 |
25);
assert_eq!(input.scanners[1].beacons.len(), 25);
assert_eq!(input.scanners[2].beacons.len(), 26);
assert_eq!(input.scanners[3].beacons.len(), 25);
assert_eq!(input.scanners[4].beacons.len(), 26);
assert_eq!(input.scanners[4].beacons[25], arr1(&[30,-46,-14]));
}
#[te... | Rust | 0 |
import time
import rosfitting_parser_control_module as module
from model.product import Product
def parser(workbook):
sheet_name = "Фланцы12Х18Н10Т Россия Литье"
products = []
count_list = [6, 10, 16, 25, 40, 63, 160]
sheet = workbook[sheet_name]
category = 'Фланцы ГОСТ 33259-2015, ст. 12х18н1... | Python | 1 |
"""A COM Server which exposes the NT Performance monitor in a very rudimentary way
Usage from VB:
set ob = CreateObject("Python.PerfmonQuery")
freeBytes = ob.Query("Memory", "Available Bytes")
"""
import pythoncom
import win32pdhutil
import winerror
from win32com.server import register
from win32com.server.ex... | Python | 1 |
ter::Trace,
};
let mut logger = Logger::new(app.name).with_console(log_level);
if let Some(log_dir) = app.log_dir {
logger = logger.with_explicit_directory(log_dir);
}
if logger.get_directory().is_some() {
logger = logger.with_file("enumerate.log", log_level);
}
logger.ap... | Rust | 0 |
: HWND, lp_rect: *mut RECT) -> BOOL;
/// MSDN: [GetWindowRect](https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-getwindowrect)
pub fn GetWindowRect(hwnd: HWND, lp_rect: *mut RECT) -> BOOL;
/// MSDN: [ClientToScreen](https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-clien... | Rust | 0 |
max_time (`float`):
The maximum allowed time in seconds for the generation.
initial_time (`float`, *optional*, defaults to `time.time()`):
The start of the generation allowed time.
"""
def __init__(self, max_time: float, initial_timestamp: Optional[float] = None):
... | Python | 1 |
ts = render_settings_interface.GetSystemPresetList() or []
all_presets = project_presets + system_presets
logger.info(f"Found {len(project_presets)} project presets and {len(system_presets)} system presets")
if preset_name in project_presets:
logger.info(f"Found '{p... | Python | 1 |
.as_slice());
/// ```
///
/// [`GenericPolygon`]: struct.GenericPolygon.html
#[derive(Debug, Clone, PartialEq)]
pub enum PolygonRing<PointType> {
/// The outer ring of a polygon.
Outer(Vec<PointType>),
/// Defines a hole in a polygon
Inner(Vec<PointType>),
}
impl<PointType> PolygonRing<PointType> {
... | Rust | 0 |
.as_ref())
.expect("create file");
}
#[test]
#[tracing::instrument]
pub fn init_plain() {
let stall_exec = std::env::current_dir()
.unwrap()
.join("target/debug/stall");
let temp_dir = TempDir::new().expect("create temp dir");
let stall_path = temp_dir.path();
println!("{stal... | Rust | 0 |
Coord { x:-2, y: 2, vx: 2, vy: 0 },
Coord { x: 5, y:-2, vx: 1, vy: 2 },
Coord { x: 1, y: 4, vx: 2, vy: 1 },
Coord { x:-2, y: 7, vx: 2, vy:-2 },
Coord { x: 3, y: 6, vx:-1, vy:-1 },
Coord { x: 5, y: 0, vx: 1, vy: 0 },
Coord { x:-6, y: 0, vx: 2, vy: 0... | Rust | 0 |
import pytest
from monty.serialization import loadfn
from pymatgen.core import Composition
from emmet.core.structure_group import StructureGroupDoc, _get_id_lexi
@pytest.fixture(scope="session")
def entries_lto(test_dir):
"""
Recycle the test cases from pymatgen
"""
entries = loadfn(test_dir / "LiTiO... | Python | 1 |
essage) =
(REMOVE_IDENTITY, Message::Remove(Bytes::default()));
static ref TEST_CASE_7: (&'static str, Message) =
(REMOVE_ALL_IDENTITIES, Message::RemoveAll);
static ref TEST_CASE_8: (&'static str, Message) = (
ADD_IDENTITY_CONSTRAINED,
Message::AddConstra... | Rust | 0 |
ct(dsp_phase : usize) -> usize { dsp_phase & 0xffffffff }
/* Purpose:
* Takes the fractional part of the argument phase and
* calculates the corresponding position in the interpolation table.
* The fractional position of the playing pointer is calculated with a quite high
* resolution (32 bits). It would be unprac... | Rust | 0 |
singGUI with baseline file path
self.preproc_window = PreprocessingGUI(baseline_file_path=baseline_file_path)
# Connect preprocessing 'next' button to go to realtime PSD window
self.preproc_window.next_button.clicked.connect(self.go_to_realtime_psd)
self.stack.addWidget(self.preproc_wind... | Python | 1 |
import os
import sys
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from utiles.log_generator import generate_test_logs
from ai.predictor import LogPredictor
def minimal_test():
"""Минимальный тест базовой функциональности"""
print("🔧 Минимальный тест системы...")
# 1. Ге... | Python | 1 |
entity::prelude::*;
#[derive(DeriveIntoActiveModel)]
pub struct UpdateFruit {
pub cake_id: Option<Option<i32>>,
}
}
assert_eq!(
my_fruit::UpdateFruit {
cake_id: Some(Some(1)),
}
.into_active_model()... | Rust | 0 |
(crate::FieldReader::new(bits))
}
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> EDREQ_13_A {
match self.bits {
false => EDREQ_13_A::EDREQ_13_0,
true => EDREQ_13_A::EDREQ_13_1,
}
}
#[doc = "Checks if the value of the f... | Rust | 0 |
(e)),
}
}
}
impl CublasBlas1Ext<f32> for CublasHandle {
unsafe fn nrm2(&mut self,
n: i32,
x: *const f32, incx: i32,
result: *mut f32)
-> CublasResult<()>
{
let status = cublasSnrm2_v2(
self.as_mut_ptr(),
n,
x, incx,
result);
match status {
... | Rust | 0 |
import sys
import os
font_dir = sys.argv[1]
THRESHOLD=21
min_dist=99
with open(os.path.join(font_dir,'clear_fonts.csv'),'w') as out:
out.write('path,hasLower,hasNum\n')
for infile in sys.argv[2:]:
with open(infile) as f:
entries = f.readlines()
for line in entries:
da... | Python | 1 |
-wifi-lib/esp32");
//println!("cargo:rustc-link-lib=espnow");
// println!("cargo:rustc-link-lib=mesh");
println!("cargo:rustc-link-lib=net80211");
println!("cargo:rustc-link-lib=pp");
println!("cargo:rustc-link-lib=rtc");
// println!("cargo:rustc-link-lib=smartconfig");
println!("carg... | Rust | 0 |
marks = {
"Harry": 100,
"Shubam": 56,
"Rohan": 23,
0: "Harry"
}
marks1 = {
"Harshit": 100,
"Sanket": 78,
"Rohan": 67,
0: "Joker"
}
print(marks1.items())
print(marks.keys())
print(marks.values())
print(marks1.update({"Harshit": 99,"Renuka":90}))
print(marks1)
print(marks1.get('Harshit2')... | Python | 1 |
or * alpha);
// Opaque, height based on duration:
let mut short_rect = frame_rect;
short_rect.min.y = lerp(
frame_rect.bottom_up_range(),
duration as f32 / slowest_frame as f32,
);
painter.rect_filled(short_rect, 0.0, color);
... | Rust | 0 |
import numpy as np
import tensorflow as tf
from .pygkdtree import pygkdtree_filter
# @tf.numpy_function(Tout=tf.float32)
def spatial_filter(value: np.ndarray, theta_gamma):
h, w, n_valchannels = value.shape
pos = np.zeros((h, w, 2), dtype=np.float32)
spat_pos = np.mgrid[0:h, 0:w][::-1].transpose((1, 2, 0... | Python | 1 |
data_list = [13, 24, 'Karim', {'name': 'guru'}, 45, 17]
only_number = []
for num in data_list:
if type(num) == int:
only_number.append(num)
print(only_number) | Python | 1 |
"This is a test entry".into(),
[2u8; uuid::SIZE].into(),
);
let _ = entry_head.set_web_address("https://example.org".into());
entry_head
}
fn default_body() -> EntryBody {
let mut entry_body = EntryBody::new(
[1u8; uuid::SIZE].into(),
... | Rust | 0 |
_blake2b_expand_vec_four(
input_a: *const u8,
input_a_len: u32,
input_b: *const u8,
input_b_len: u32,
input_c: *const u8,
input_c_len: u32,
input_d: *const u8,
input_d_len: u32,
input_e: *const u8,
input_e_len: u32,
out: *mut u8,
... | Rust | 0 |
rs
// Copyright 2020 The Chromium OS Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
use std::error;
use std::fmt;
use std::num::ParseIntError;
use std::path::PathBuf;
use std::str::FromStr;
#[derive(Debug)]
pub enum Error {
GetO... | Rust | 0 |
rdcode the set of
/// pointer types supported.
///
/// Since we're hardcoding a set of pointer types above *anyway*, we just need
/// to keep the list of unpinnable types in sync with the list of "pointers to
/// transmutable things" above.
///
/// For similar coherence reasons, we must only have an `Unpin` constraint ... | Rust | 0 |
"""empty message
Revision ID: 0005_add_provider_stats
Revises: 0003_add_service_history
Create Date: 2016-04-20 15:13:42.229197
"""
# revision identifiers, used by Alembic.
revision = "0005_add_provider_stats"
down_revision = "0004_notification_stats_date"
import sqlalchemy as sa
from alembic import op
from sqlalch... | Python | 1 |
.map(|(_, x)| source_path.join(x))
.all(|x| x.exists())
};
let mut skip_build = already_built && !is_release_mode();
if has_env_var_with_value("FFDEV1", "1") {
skip_build = false;
}
// EXTRACT
if !source_path.exists() || !skip_build {
{
let result = ... | Rust | 0 |
CouncilInstance = pallet_collective::Instance1;
impl pallet_collective::Config<CouncilInstance> for Runtime {
type Origin = Origin;
type Proposal = Call;
type Event = Event;
type MotionDuration = CouncilMotionDuration;
type MaxProposals = CouncilMaxProposals;
type MaxMembers = CouncilMaxMember... | Rust | 0 |
while new.limbs.len() > n_limbs {
new.limbs.pop();
if let Some(limb_value) = new.limb_values.as_mut().map(|lvs| lvs.pop().unwrap()) {
*new.value.as_mut().unwrap() -=
f_to_nat(&limb_value) << (new.limbs.len() * new.params.limb_width) as u3... | Rust | 0 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@Time: 2024/6/26 22:00
@Author: zhengyu
@File: 自定义类对比方法
@Desc zhengyu 2024/6/26 22:00. + cause
"""
class MyClass:
def __init__(self, id: str, value: int):
self.id = id
self.value = value
def __eq__(self, other):
""" 定义相等性判断方式 """
... | Python | 1 |
0_SPEC;
impl crate::RegisterSpec for TIME_HIGH0_SPEC {
type Ux = u32;
}
#[doc = "`read()` method returns [time_high0::R](R) reader structure"]
impl crate::Readable for TIME_HIGH0_SPEC {
type Reader = R;
}
#[doc = "`reset()` method sets TIME_HIGH0 to value 0"]
impl crate::Resettable for TIME_HIGH0_SPEC {
#[i... | Rust | 0 |
is that the setting in the "enabled"
/// bit can not be changed by the debugger (i.e. it can
/// not enabled debugging by providing an appropriate Debug
/// Credential (DC)).
///
/// In their words:
/// "A bitmask that specifies which debug domains are predetermined
/// by device configurat... | Rust | 0 |
bad = true;
Key::Str(InternedString::new(""))
});
if !parser.eat(&FatArrow) {
cx.span_err(parser.span, "expected `=>`");
return None;
}
let value = parser.parse_expr();
entries.push(Entry {
key_contents: key_contents,
... | Rust | 0 |
_id),
Net => self.draw_network(f, app_state, *widget_draw_loc, widget.widget_id),
Temp => {
self.draw_temp_table(f, app_state, *widget_draw_loc, true, widget.widget_id)
}
Disk => {
self.draw_disk_table(f, app_state, ... | Rust | 0 |
import inflection
from jinja2.ext import Extension
from dslmodel.utils.str_tools import dasherize, pythonic_str, camelize_lower
class InflectionExtension(Extension):
def __init__(self, environment):
super(InflectionExtension, self).__init__(environment)
environment.filters["camelize"] = inflecti... | Python | 1 |
"""Provides Class for Trophy Summary."""
from __future__ import annotations
from dataclasses import dataclass
from typing import TYPE_CHECKING
from psnawp_api.core import PSNAWPForbiddenError
from psnawp_api.models.trophies.trophy_constants import TrophySet
from psnawp_api.utils import API_PATH, BASE_PATH
if TYPE_C... | Python | 1 |
afe? Just including chars that are not '&'
static ref PARAM_REGEX: Regex =
Regex::new(r"(?P<param>[^&]+)=(?P<value>[^&]+)").unwrap();
}
let mut query_params: HashMap<&'a str, &'a str> = HashMap::new();
for capture in PARAM_REGEX.captures_iter(query) {
query_params.insert(
... | Rust | 0 |
("L10").unwrap(),
"58",
RotateCW::One
));
assert!(map.place_tile(
coords.parse("K11").unwrap(),
"8",
RotateCW::Zero
));
assert!(map.place_tile(
coords.parse("K13").unwrap(),
"58",
RotateCW::Three
));
assert!(map.place_tile(
... | Rust | 0 |
Into<String> for SampleHash {
fn into(self) -> String {
match self {
SampleHash::Md5(x) => x,
SampleHash::Sha1(x) => x,
SampleHash::Sha256(x) => x,
}
}
}
impl AsRef<str> for SampleHash {
fn as_ref(&self) -> &str {
match self {
SampleH... | Rust | 0 |
import os
import sys
import time
import logging
import pymongo
import threading
from telegram import Update
import google.generativeai as genai
from telegram.ext import CallbackContext
from modules.configurator import get_env_var_from_db
from plugins.gemini.gemini import initialize_gemini_model, format_html
# Load env... | Python | 1 |
"------{:-<pw$}--------------{:-<rw$}---{:-<mw$}---{:-<bw$}",
"",
"",
"",
"",
rw = rw,
pw = pw,
mw = mw,
bw = bw
));
... | Rust | 0 |
acySleep = 0,
efficacyBurn = 20,
efficacyFreeze = 50,
efficacyPetrify = 20,
efficacyFaint = 20,
efficacyConfuse = 0,
efficacyCharm = 0,
efficacyDeathblow = 20,
efficacy... | Python | 1 |
#!/usr/bin/env python
"""
Module containing tests for the unitless property factory
"""
# IMPORTS ####################################################################
import pytest
from instruments.units import ureg as u
from instruments.util_fns import unitless_property
from . import MockInstrument
# TEST CASES #... | Python | 1 |
from(t:mix::Space<$tp>) -> Self {
<$via_tp>::from(t.value).into()
}
}
}
}
// === Impls ===
define_mix_impls! {
Lab => Lab;
Lch => Lab;
Rgb => LinearRgb;
}
/*
* @Author: BertKing
* @version:
* @Date: 2020-08-21 15:19:13
* @LastEditors: BertKing
* @LastEditTim... | Rust | 0 |
import streamlit as st
import numpy as np
import pandas as pd
import folium
import matplotlib.pyplot as plt
import seaborn as sns
from streamlit_folium import folium_static
from sklearn.cluster import KMeans
import plotly.express as px
import geopandas as gpd
from shapely.geometry import Point
# --------------- 1. Loa... | Python | 1 |
w::Cow;
use serde_json::Value;
fn deserialize_some<'de, T, D>(deserializer: D) -> Result<Option<T>, D::Error>
where
T: serde::Deserialize<'de>,
D: serde::Deserializer<'de>,
{
serde::Deserialize::deserialize(deserializer).map(Some)
}
#[derive(Clone, Debug, serde::Deserialize, serde::Serialize)]
#[serde(un... | Rust | 0 |
from decimal import Decimal, getcontext, ROUND_DOWN
#Enter the FXTS Rate for the Specific Currency Pair
def FXTS_Rate(sell_currency, buy_currency):
while(True):
try:
fxts_rate = float(input(f"Enter FXTS Rate for {sell_currency}-{buy_currency}: "))
return fxts_rate
except:
... | Python | 1 |
Network,
opt: &DeriveAddressOpts,
int_or_ext: u32,
) -> Result<GetAddressOutput> {
// checksum not supported at the moment, stripping out
let end = opt
.descriptor
.find('#')
.unwrap_or_else(|| opt.descriptor.len());
let descriptor: miniscript::Descriptor<DescriptorPublicKey... | Rust | 0 |
/ price(BTC, 1);
assert_eq!(limit, alice_capable_btc / DEFAULT_COLLATERAL_FACTOR);
let borrow_asset_deposit = 100000 * unit;
assert_eq!(Tokens::balance(BTC, &CHARLIE), 0);
assert_ok!(Tokens::mint_into(BTC, &CHARLIE, borrow_asset_deposit));
assert_eq!(Tokens::balance(BTC, &CHARLIE), borrow_asset_deposit);
a... | Rust | 0 |
import pprint
import re
def get_links_from_md_regex(file_path, p=re.compile(r'\[(.+?)\]\((.+?)\)')):
l = []
with open(file_path) as f:
for i, line in enumerate(f):
for result in p.findall(line):
l.append([file_path, i + 1, result[0], result[1]])
return l
pprint.pprint(g... | Python | 1 |
p.allclose(expected_var, obtained_var)
@pytest.mark.parametrize("N", range(2, 20, 2))
def test_is_symplectic(N):
"""Tests the is_symplectic function for different matrix sizes"""
S = random_symplectic(N)
assert is_symplectic(S)
def test_is_symplectic_rect():
"""Testing that rectangular matrices retu... | Python | 1 |
def f(num):
res = set()
for i in range(2, int(num**0.5)+1):
if num%i==0:
res |= {i, num//i}
res = sorted(res)
summ = sum(res)
comb = 1
for i in res:
comb *= i
if summ%2==1 and comb%2==1:
if len(res)>10:
return len(res)
return 0
cnt = 0
for... | Python | 1 |
i::RunTimeEndian> =
&|section| gimli::EndianSlice::new(&*section, endian);
let dwarf = dwarf_cow.borrow(&borrow_section);
// Create `EndianSlice`s for all of the sections.
let mut units = dwarf.units();
while let Some(header) = units.next()? {
let unit = dwarf.... | Rust | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.