text string | label_name string | labels int64 |
|---|---|---|
o_license_msg(cfg)
from .tx import OnlineSignedTX
async def main():
global cfg
if (cfg.status or cfg.receipt) and cfg.autosign:
tx = await si.get_last_created()
else:
tx = await OnlineSignedTX(
cfg = cfg,
filename = infile,
automount = cfg.autosign,
quiet_open = True)
cfg = Config({'_... | Python | 1 |
4().to_hyphenated().to_string())
}
#[pyfn(m, "simple")]
// generate a new random UUID in simple format
fn simple(_py: Python) -> PyResult<String> {
Ok(Uuid::new_v4().to_simple().to_string())
}
Ok(())
}
<filename>bright-lang-parser/src/op.rs
#[derive(Debug, PartialEq, Clone, Copy)]
pub (c... | Rust | 0 |
}
// https://github.com/ethereum/go-ethereum/blob/v1.9.25/consensus/ethash/consensus.go#L267
// https://eips.ethereum.org/EIPS/eip-1985
if header.gas_limit > i64::MAX.try_into().unwrap() {
return Err(ValidationError::InvalidGasLimit.into());
}
if header.ext... | Rust | 0 |
C" fn(*mut GtkEditable, *const c_char, c_int, *mut c_int)>,
pub delete_text: Option<unsafe extern "C" fn(*mut GtkEditable, c_int, c_int)>,
pub changed: Option<unsafe extern "C" fn(*mut GtkEditable)>,
pub do_insert_text: Option<unsafe extern "C" fn(*mut GtkEditable, *const c_char, c_int, *mut c_int)>,
pu... | Rust | 0 |
ars(), "PYTHONSTARTUP": startup}
self.run_embedded_interpreter("test_audit_run_interactivehook", timeout=5,
returncode=10, env=env)
finally:
os.unlink(startup)
def test_audit_run_startup(self):
startup = os.path.join(self.oldcwd, sup... | Python | 1 |
regate_metric_list": [
{"metric": "acc", "aggregation": "mean", "weight_by_size": True},
{"metric": "acc_norm", "aggregation": "mean", "weight_by_size": True},
],
"metadata": {"version": 0.0},
}
file_save_path = "_" + args.save_prefix_path + ".yaml"
with open(file_s... | Python | 1 |
white #63
];
<filename>src/bin/packman.rs
use chrono::prelude::*;
use packman::fs::PackFile;
use std::path::Path;
fn main() -> Result<(), Box<dyn std::error::Error>> {
let args: Vec<String> = std::env::args().collect();
let mut need_json = true;
let mut need_bytes = false;
let mut need_inodes = false;... | Rust | 0 |
import argparse
import os
import gradio as gr
import yaml
from common.log import logger
from common.subprocess_utils import run_script_with_log
from modelscope.pipelines import pipeline
from modelscope.utils.constant import Tasks
from videoclipper import VideoClipper
import librosa
import soundfile as sf
import nump... | Python | 1 |
tic> {
Box::new(|| println!("Hi, B!"))
}
fn main_b() {
let callback: Box<dyn Fn() + Send + 'static> = returns_long_type_b();
takes_long_type_b(callback);
}
type Thunk = Box<dyn Fn() + Send + 'static>;
fn takes_long_type_c(f: Thunk) {
print!("Callback C: ");
f();
}
fn returns_long_type_c() -> Thunk {
Box... | Rust | 0 |
import os
import sys
sys.path.append(os.getcwd())
os.environ['ATTN_BACKEND'] = 'xformers' # Can be 'flash-attn' or 'xformers', default is 'flash-attn'
os.environ['SPCONV_ALGO'] = 'native' # Can be 'native' or 'auto', default is 'auto'.
# 'auto' is faster but will do... | Python | 1 |
t, Variables, ID};
use juniper_from_schema::graphql_schema_from_file;
use serde_json::{self, json, Value};
// The query that GraphiQL runs to inspect the schema
static SCHEMA_INTROSPECTION_QUERY: &str = r#"
query IntrospectionQuery {
__schema {
queryType {
name
}
mutationTyp... | Rust | 0 |
import numpy as np
import torch as th
from ddcfr.cfr.cfr_env import make_cfr_vec_env
from ddcfr.game import KuhnPoker
from ddcfr.rl.ppo import A2CPolicy, ACNetwork, RolloutBuffer
from ddcfr.utils.utils import set_seed
def test_ac_network():
set_seed(0)
input_dim = 1
abg_dim = 3
tau_dim = 5
ac_net... | Python | 1 |
eturn
if doIdle:
ws.boxStatus("IDLE", None, None, None)
def initPlaylistData():
global playlistMap, playlistLastSongMap
if not os.path.exists("audios"):
os.makedirs("audios")
# playlistStr = files.readFileOrDef("./data/song_map.json", json.dumps(testPlaylistMap, indent=4))
playli... | Python | 1 |
(
1 - self.sim.model.site_rgba[vis_g_id][3]
)
def _setup_camera(self, mujoco_arena):
"""Configure the camera as the workspace observation."""
mujoco_arena.set_camera(
camera_name="agentview",
pos=[0.6586131746834771, 0.0, 1.610350... | Python | 1 |
{
return
}
assert!(<Authorities<T>>::get().is_empty(), "Authorities are already initialized!");
<Authorities<T>>::put(authorities);
<AuthoritySetId<T>>::put(0);
// Like `pallet_session`, initialize the next validator set as well.
<NextAuthorities<T>>::put(authorities);
CurrentAuthoritiesAccounts::<T... | Rust | 0 |
}
extern "C" {
pub fn asEngine_SetModuleUserDataCleanupCallback(
e: *mut asIScriptEngine,
callback: asCLEANMODULEFUNC_t,
);
}
extern "C" {
pub fn asEngine_SetContextUserDataCleanupCallback(
e: *mut asIScriptEngine,
callback: asCLEANCONTEXTFUNC_t,
);
}
extern "C" {
pu... | Rust | 0 |
because this is just not a legal place to put a macro call.
//
// Instead we will implement a way for the caller to designate a specific part
// of the macro input to be repeated, so that anything outside that part does
// not get repeated. The repeated part will be written surrounded by #(...)*.
//
// The invocation ... | Rust | 0 |
assert!(fits_additional_rule(112_233))
}
#[test]
fn additional_criterion_rejects_123444() {
assert!(!fits_additional_rule(123_444))
}
}
<gh_stars>1000+
//! Getting and configuring wasm-pack's binary cache.
use binary_install::Cache;
use std::env;
use std::path::Path;
/// Get wasm-pac... | Rust | 0 |
;
//g.sample(4, 0, &mut gv, &mut rng, 10);
//g.sample(5, 0, &mut gv, &mut rng, 10);
let mut nchanged = 0;
g.sample_all(&mut gv, &mut rng, 10, &mut nchanged);
println!(
"{} {}",
g.cached_value_of(4, 0, &gv),
g.cached_value_of(5, 0, &gv)
);
println!("{}", nchanged);
}
... | Rust | 0 |
A_MED_PBX_SS](https://developer.android.com/reference/android/media/ToneGenerator.html#TONE_CDMA_MED_PBX_SS)
pub const TONE_CDMA_MED_PBX_SS : i32 = 75;
/// public static final [TONE_CDMA_MED_PBX_SSL](https://developer.android.com/reference/android/media/ToneGenerator.html#TONE_CDMA_MED_PBX_SSL)
... | Rust | 0 |
tsInv': unpack(MAX_CAN_VIEW * 'H', f.read(MAX_CAN_VIEW * 2)), # Inv : inverting input
'HiPass_Filter': unpack(MAX_CAN_VIEW * 'I', f.read(MAX_CAN_VIEW * 4)),
'LowPass_Filter': unpack(MAX_CAN_VIEW * 'I', f.read(MAX_CAN_VIEW * 4)),
'reference': unpack(MAX_CAN_VIEW * 'I', f.read(MAX_CA... | Python | 1 |
number = [0, 1, 2, 3, 4, 5]
def reverse(list):
emptyList = []
for i in range(len(list)):
lastValue = list.pop()
emptyList.append(lastValue)
return emptyList
print(reverse(number)) | Python | 1 |
_price: &MinMax<i32>,
plus_value: i32,
) {
if i == 0 {
return rand_float(arr, start.min, start.max, &base_price, plus_value);
}
let verification: MinMax<f32> = MinMax {
min: base_price.min as f32 * (start.min + delta.min * i as f32),
max: base_price.max as f32 * (start.max + delta.max * i as f32),
... | Rust | 0 |
x08 - Status Register"]
pub status: STATUS,
#[doc = "0x0c - Interrupt Flag Register"]
pub if_: IF,
#[doc = "0x10 - Interrupt Flag Set Register"]
pub ifs: IFS,
#[doc = "0x14 - Interrupt Flag Clear Register"]
pub ifc: IFC,
#[doc = "0x18 - Interrupt Enable Register"]
pub ien: IEN,
_... | Rust | 0 |
g-{{row}}")
– do *not* use any prefix like "input.". Decide the inputs dynamically based on the user's
goal.
4. Quote all placeholder values to ensure the JSON parser treats them as
strings.
5. In the events you will find all the selectors relative to a particular action, replicate all of them in the workflow.... | Python | 1 |
aci_rn="tn-{0}".format(tenant),
module_object=tenant,
target_filter={"name": tenant},
),
subclass_1=dict(
aci_class="l3extOut",
aci_rn="out-{0}".format(l3out),
module_object=l3out,
target_filter={"name": l3out},
),... | Python | 1 |
None,
},
None,
))
.unwrap();
let texture_format = wgpu::TextureFormat::Bgra8UnormSrgb;
let surface_config = wgpu::SurfaceConfiguration {
usage: wgpu::TextureUsages::RENDER_ATTACHMENT,
format: texture_format,
width: window.width() as u32,
height: window.h... | Rust | 0 |
== 'mismatched keys: bio.birthplace.postcode'
def test_empty_dictionary():
# Empty data
empty_data = {}
state, error = validate(empty_data, template)
assert state == False
assert error == 'mismatched keys: user_id'
def test_none_value():
# Data with None as value
carol = {
'user_id... | Python | 1 |
"""🔢 1. Convert Between Binary and Decimal
Task Code
Convert int to binary string bin(n) → '0b1010'
Get binary without '0b' prefix bin(n)[2:]
Convert binary string to int int('1010', 2) → 10
"""
def int_to_binary(n: int) -> str:
"""Convert an integer to a binary string."""
return bin(n)[2:] # Remove the '0b'... | Python | 1 |
"""
Rudimentary screenshot testing done with the amazing
https://github.com/whtsky/pixelmatch-py library.
On failure, it spits out a "diff" image.
Screenshot testing can be a bit flaky, especially on complex
apps. I don't necessarily recommend it for all use cases.
This flakiness can happen because of:
* Playwright... | Python | 1 |
episode:' + str(episode) + ' steps:' + str(total_steps) +
' reward0:' + str(rwd) )
#rewards.append(rwd)
break
#return RL.q
q_natural = train(natural_DQN)
q_double = train(double_DQN)
'''
plt.plot(np.array(q_natural), c='r', la... | Python | 1 |
│
// └ ┘
const L: f64 = 6.0;
let mut pad = gen_pad_lin2(L);
// solution
let cf = L / 6.0;
let (xa, xb) = (pad.xxt[0][0], pad.xxt[0][1]);
let a_correct = &[cf * (2.0 * xa + xb), cf * (xa + 2.0 * xb)];
// integration points
let cla... | Rust | 0 |
}
pub fn sign(&self) -> bool { self.0 }
}
impl std::ops::Not for TermLit {
type Output = Self;
fn not(self) -> Self { TermLit(!self.0, self.1, self.2) }
}
impl BoolLit for TermLit {
fn abs(&self) -> Self { TermLit(true, self.1, self.2) }
}
}
#[derive(Copy,Clone,De... | Rust | 0 |
' ', "Medium Mathematical Space", ' '),
(' ', "Ideographic Space", ' '),
('ߺ', "Nko Lajanyalan", '_'),
('﹍', "Dashed Low Line", '_'),
('﹎', "Centreline Low Line", '_'),
('﹏', "Wavy Low Line", '_'),
('‐', "Hyphen", '-'),
('‑', "Non-Breaking Hyphen", '-'),
('‒', "Figure Dash", '-'),
('... | Rust | 0 |
ER, page_id=1)
def render_staff_puzzle(lever_angle_index):
def extra_render(pdf):
pdf.image('assets/runes.png', x=0, y=0)
x, y, _ = LEVER_STAFF_POS[lever_angle_index]
pdf.image(f'assets/lever-staff-{lever_angle_index}.png', x=x, y=y)
return extra_render
RENDER_STAFF_PUZZLE = tuple(rend... | Python | 1 |
#!/usr/bin/python3
# Check that specifying a quality causes a pre-existing bitrate to be overwritten,
# but that it stays the same when no quality is given.
import time
from picamera2 import Picamera2
from picamera2.encoders import H264Encoder, Quality
picam2 = Picamera2()
video_config = picam2.create_video_configu... | Python | 1 |
import numpy as np
import argparse
import json
import re
def extract_score(line):
score_json = json.loads(line)
f1 = score_json['f1']
em = score_json['exact_match']
return float(f1), float(em)
if __name__ == '__main__':
parser = argparse.ArgumentParser(
description='Calculate macro average fo... | Python | 1 |
#![allow(dead_code)]
struct Opaque<P>(P);
pub trait Abstracted {}
impl<P> Abstracted for Opaque<P> {}
fn build<P>(p: P) -> Opaque<P>
where
P: AsRef<str>,
{
Opaque(p)
}
// Should not lint.
fn test_str(s: &str) -> Box<dyn Abstracted> {
Box::new(build(s.... | Rust | 0 |
# coding=utf-8
# Copyright (c) 2001-2022, Hove and/or its affiliates. All rights reserved.
#
# This file is part of Navitia,
# the software to build cool stuff with public transport.
#
# Hope you'll enjoy and contribute to this project,
# powered by Hove (www.hove.com).
# Help us simplify mobility and open pub... | Python | 1 |
(ivector[None, :, None] ** 2) * (jvector[None, None, :] ** 2)),
(1, 2),
)
/ Nz
)
def getSmallAreaHighGrayLevelEmphasisFeatureValue(self):
r"""
**14. Small Area High Gray Level Emphasis (SAHGLE)**
.. math::
\textit{SAHGLE} = \frac{\s... | Python | 1 |
#config:utf-8
from tkinter import *
from random import randrange
# Définir les fonctions
def draw_line():
"Tracer une ligne dans le canevas can1"
global x1, y1, x2, y2, coul
can1.create_rectangle(x1, y1, x2, y2, width=5, fill=coul)
"Modification des coordonnée de chaque ligne suivante"
y2, y1 = y2... | Python | 1 |
xist'] = 1
anls_distance = anls_compute(action_gt['text'], action_pred['text'])
ret['anls_distance'] = anls_distance
if anls_distance > self.MAX_ANLS:
ret['match'] = 0
ret['question'] = self.build_prompt_text(line)
ret[... | Python | 1 |
F>(
mut bytes: &mut [u8],
i: usize,
b: u8,
f: F,
) -> Result<Vec<Vec<u8>>, BlobError>
where
F: FnOnce(&[u8]) -> Result<Vec<Vec<u8>>, BlobError>,
{
{
bytes[i] ^= b;
}
let res = f(&bytes);
{
bytes[i] ^= b;
... | Rust | 0 |
class time_dutch:
"""
This class returns a given time as a range of LED-indices.
Illuminating these LEDs represents the current time on a dutch WCA 11x10
range(0,3) + range(4,6): HET IS
range(7,11) + range(40,44): VIJF OVER
range(11,15) + range(40,44): TIEN OVER
range(28,33) + range(40,4... | Python | 1 |
);
gl::Uniform1i(self.gui_res.program.loc.tex_sampler, 0);
}
for draw_list in data.draw_lists() {
let vtx_buffer = draw_list.vtx_buffer();
let idx_buffer = draw_list.idx_buffer();
self.gui_res.mesh_res.vao.bind();
self.gui_res.me... | Rust | 0 |
ATION ControlFlags: DWORD [
OptimizedSave set_OptimizedSave[0..1],
CompactionEnabled set_CompactionEnabled[1..2],
]}
pub type PXSTATE_CONFIGURATION = *mut XSTATE_CONFIGURATION;
STRUCT! {struct MEMORY_BASIC_INFORMATION {
BaseAddress: PVOID,
AllocationBase: PVOID,
AllocationProtect: DWORD,
RegionS... | Rust | 0 |
from django.shortcuts import render
from .models import Sakila
from datetime import datetime
# Create your views here.
def index(request):
# 讀取透過 GET 傳過來的 ?id=10 資料
id = request.GET.get('id', 1)
country = ''
if request.method == 'POST':
# 讀取透過 POST 傳過來的表單資料
country = request.POST.get('c... | Python | 1 |
from typing import List
import pytest
from tests.factories import product_data
from fastapi import status
async def test_controller_create_should_return_success(client, products_url):
response = await client.post(products_url, json=product_data())
content = response.json()
del content["created_at"]
... | Python | 1 |
# ******************************************************************************
# Copyright 2017-2018 Intel Corporation
#
# 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.apa... | Python | 1 |
Count will generate IRQs.
const DISPLAY_SETTINGS: DisplayStatus = DisplayStatus::new()
.with_vblank_irq_enabled(true)
.with_hblank_irq_enabled(true)
.with_vcount_irq_enabled(true);
DISPSTAT.write(DISPLAY_SETTINGS);
// Start two timers with overflow IRQ generation.
start_timers();
loop {
let ... | Rust | 0 |
import pytest
from climpred.comparisons import HINDCAST_COMPARISONS
from climpred.metrics import PM_METRICS
kw = dict(dim="init", alignment="same_inits")
@pytest.mark.parametrize("comparison", HINDCAST_COMPARISONS)
def test_eff_sample_size_smaller_than_n_hindcast_hist_obs_1d(
hindcast_hist_obs_1d, comparison
):... | Python | 1 |
fn draw_elements(&self, mode: GLEnum, count: i32, type_: GLEnum, offset: GLintptr) {
self.context.draw_elements(mode, count, type_, offset);
}
fn flush(&self) {
self.context.flush();
}
fn viewport(&self, x: i32, y: i32, width: i32, height: i32) {
self.context.viewport(x, y... | Rust | 0 |
}
}
fn needs_flush() -> bool {
true
}
}
// LCOV_EXCL_START
#[cfg(test)]
mod t {
use crate::idml::IDML;
use pretty_assertions::assert_eq;
use super::*;
// pet kcov
#[test]
fn debug() {
assert_eq!("DirEntry(0)", format!("{:?}", ObjKey::DirEntry(0)));
assert_eq!("Extent(0)", format!("{:?}",... | Rust | 0 |
self.0, atom, string_ptr, size) } {
return Err(ClingoError::new_internal(
"Call to clingo_theory_atoms_atom_to_string() failed",
));
}
let c_str: &CStr = unsafe { CStr::from_ptr(string_ptr) };
let str_slice: &str = c_str.to_str()?;
Ok(str_slice.to_... | Rust | 0 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
from .base_mpl_plot import BaseMplPlot
from .. import image_utils
from .. import utils
import numpy as np
class Histogram(BaseMplPlot):
def init_stream_plot(self, stream_vis,
xtitle='', ytitle='', ztitle='', colormap=None, color... | Python | 1 |
the ADD-Gate in scope
// let and_gate = TrigonometricGate::new(and.clone(), ADD_GATE_OPERATION);
// assert_ne!(0, and_gate.handle_id);
//
// and.set(PROPERTY_NAME_NUMBER_1.to_string(), json!(1));
// and.set(PROPERTY_NAME_NUMBER_2.to_string(), json!(1));
// assert_eq!(2, and.as_i... | Rust | 0 |
import os
import torch
import modules.core as core
from ldm_patched.pfn.architecture.RRDB import RRDBNet as ESRGAN
from ldm_patched.contrib.external_upscale_model import ImageUpscaleWithModel
from collections import OrderedDict
from modules.config import path_upscale_models
model_filename = os.path.join(path_upscale_... | Python | 1 |
EditableColor::Float3(value)
// }
// }
// impl<'a> From<&'a mut [f32; 4]> for EditableColor<'a> {
// #[inline]
// fn from(value: &'a mut [f32; 4]) -> EditableColor<'a> {
// EditableColor::Float4(value)
// }
// }
/// Color editor input mode.
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
pub e... | Rust | 0 |
,
};
#[cfg(any(target_os = "android", target_os = "linux"))]
use {
super::fs::MemfdFlags,
super::io::{EventfdFlags, UserfaultfdFlags},
};
#[cfg(not(target_os = "wasi"))]
use {
super::io::{DupFlags, MapFlags, MprotectFlags, ProtFlags, Termios, Winsize},
super::time::{ClockId, DynamicClockId},
};
pub(cra... | Rust | 0 |
Format::Canonical
}
}
}
impl FromStr for MacAddress {
type Err = ParseError;
/// Create a MacAddress from String
fn from_str(us: &str) -> Result<MacAddress, ParseError> {
MacAddress::parse_str(us)
}
}
impl Default for MacAddress {
/// Create a Default MacAddress (00-00-00-00-00... | Rust | 0 |
: u32, mipmap_levels: NonZeroU32, array_layers_base: u32 } => {
ImageSubresourceSlice {
view_type: vk::ImageViewType::TYPE_2D,
mipmap_levels_base,
mipmap_levels,
array_layers_base,
array_layers: NonZeroU32::new(1).unwrap()
}
},
pub Type2DArray { mipmap_levels_base: u32, mipmap_levels: NonZ... | Rust | 0 |
from evaluator import *
DESCRIPTION = "Test if the model can solve a rather hard dynamic programming problem"
TAGS = ['code', 'c']
question = "A binary 8x8 matrix is 'unholy' if there are no isolated 1s. A 1 is isolated if there isn't another 1 in any of the 4 direct cardinal directions. Write a C program that count... | Python | 1 |
prompt = """
Provide me with all atomic assertions from the following text, and add the assertion main topic as described in the example.
Be explicit on the names (do not use pronouns like 'he', 'his', 'her', ...).
Give me as much assertions as possible.
Do not repeat yourself, in any kind of manner.
Dates should have ... | Python | 1 |
nse
with patch("UM.TaskManagement.HttpRequestManager.HttpRequestManager.getInstance", MagicMock(return_value = http_mock)):
authorization_service._onAuthStateChanged(SUCCESSFUL_AUTH_RESPONSE)
# Ensure that the error signal was not triggered
assert authorization_service.onAuthenticationError.emit.ca... | Python | 1 |
es_overlay(image, patch_groups, patch_size=14, alpha=0.4):
"""
Draws colored overlays on image for different patch groups.
"""
image = image.convert("RGBA")
overlay = Image.new("RGBA", image.size, (0, 0, 0, 0))
draw = ImageDraw.Draw(overlay)
width = image.size[0]
num_patches = width // ... | Python | 1 |
assert!(output.status.success());
assert!(String::from_utf8_lossy(&output.stderr).is_empty());
output
}
pub fn display_outputs(output: &Output) {
io::stdout().write_all(&output.stdout).unwrap();
io::stderr().write_all(&output.stderr).unwrap();
}
pub fn run_git_command<I, T, P: AsRef<Path>>(curr... | Rust | 0 |
_thicknesses_contempt'
del olwrxqsl09h
def zft7v2t1r_1(bpktw87ohmz: wrayopvl4yi=False, jj1ejpv1a6f: jbv12kf8qap=0.0, b0g17rzhir0=0):
import ic62bzsom6o, xd9eqleumqr, vdjtn6unssp as pi66fmnwkow, ewlsiq_fsa7
global h5iwnei_gy3
'# kites_gallows_deputies -> wiggles_thicknesses_contempt'
'# kites_gallows... | Python | 1 |
salario = int(input("Ingrese salario: "))
horas_trabajadas = float(input("Horas trabajadas: "))
valor_final = salario / 30 /8 * horas_trabajadas
pendientes = int(input("Tareas pendientes: "))
proceso = int(input("Tareas en proceso: "))
hechas = int(input("Tareas hechas: "))
devueltas = int(input("Devueltas: "))
tota... | Python | 1 |
parser.add_argument("--flow-loss-weight", type=float, default=0.25, help="Weight of flow loss")
parser.add_argument("--warp-loss-weight", type=float, default=0.01, help="Weight of warp loss")
# NOTE: Depth completion
parser.add_argument("--depth-loss-weight", type=float, default=1.0, help="Weight of de... | Python | 1 |
""#).unwrap(), b"");
assert_eq!(yass_aux::parse_byte_string(r#""123""#).unwrap(), b"123");
assert_eq!(yass_aux::parse_byte_string(r#"" \\ ""#).unwrap(), b" \\ ");
assert_eq!(yass_aux::parse_byte_string(r#"" \" ""#).unwrap(), b" \" ");
assert_eq!(yass_aux::parse_byte_string(r#"" \r\n\t ""#).unwrap(), b" ... | Rust | 0 |
tional;
/// A foreign class, such as a Core Foundation class.
FOREIGN_CLASS = 3 | NON_HEAP_FLAG;
/// Returns `true` if `self` is a foreign class, such as a Core Foundation
/// class.
is_foreign_class;
/// A type whose value is not exposed in the metadata system.
OPAQUE = RUNTIME_PRIVATE_F... | Rust | 0 |
), "" if ea is None else _gen_expr_code(ea),
"" if eb is None else _gen_expr_code(eb)))
if expr.op == "call_array.method":
e, method, expr_list = expr.arg
assert e.type.is_array
return "(%s).%s(%s)" % (_gen_expr_code(e), _gen_method_name_code(method), _gen_expr_list_code(ex... | Python | 1 |
# Generated by Django 4.2.4 on 2023-11-07 11:48
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('main_app', '0004_eventregistration'),
]
operations = [
migrations.CreateModel(
name='Movie',
fields=[
... | Python | 1 |
break;
}
}
}
}
fn has_pending_interrupts(&self) -> bool {
unsafe { nvic::has_pending() || deferred_call::has_tasks() }
}
fn sleep(&self) {
unsafe {
cortexm4::support::wfi();
}
}
unsafe fn atomic<F, R>(&self, f: F) -> R
... | Rust | 0 |
//! println!("P/L status: {:?}", pl_status);
//! let int_status = sensor.interrupt_status();
//! println!("Interrupt status: {:?}", int_status);
//! }
//! ```
//!
//! ### Enable self-test
//!
//! ```no_run
//! # use linux_embedded_hal::I2cdev;
//! # use mma8x5x::Mma8x5x;
//! #
//! # let dev = I2cdev::new("/... | Rust | 0 |
for old_key, new_key in zip(old_keys, new_keys):
state_dict[new_key] = state_dict.pop(old_key)
return state_dict
def budget_to_huggingface(state_dict):
old_keys = []
new_keys = []
for key in state_dict.keys():
if 'embeddings.LayerNorm' in key:
if 'weight' in key:
... | Python | 1 |
)
| Token::LiteralBoolean(_)
| Token::TemplateOpenning => {
let expr = self.parse_expression(token, expr_precedence)?;
Ok(Statement::Expression(self.alloc(expr)))
},
Token::Identifier(ident) => {
// NOTE: 可以是 ident 也可以是 Labe... | Rust | 0 |
ge = real_image[:,:,self.mask_x[0]:self.mask_x[1],\
# self.mask_y[0]:self.mask_y[1]]
fake_concat = torch.cat([input_semantics, fake_image], dim=1)
real_concat = torch.cat([input_semantics, real_image], dim=1)
# In Batch Normalization, the fa... | Python | 1 |
ieve an access token and refresh token from this endpoint
* * Use refresh token to retrieve new access tokens from this endpoint (without having to go through authorization process again)
*
* For Client Credentials:
* * Call token endpoint with client credentials to retrieve access token
*
... | Rust | 0 |
import cv2
import matplotlib.pyplot as plt
from imageai.Detection import VideoObjectDetection
import os
camera = "newinput_Trim.mp4"
# execution = os.getcwd()
color_index = {'motorbike' : 'red'}
resized = True
count = 0
import FinalTriple
import FinalHelmet
def bikedetect(frame_number,output_array,output_count,returned... | Python | 1 |
, tenant: &str) -> Result<()> {
let params = [("dataId", data_id), ("group", group), ("tenant", tenant)];
self.client.simple_delete("/v1/cs/configs", ¶ms).await
}
pub async fn listen_config(&self, args: &ListenConfig) -> Result<String> {
let url = self.make_url("/v1/cs/configs/liste... | Rust | 0 |
, 2),
"volume": np.random.randint(10, 100)
})
# 计算趋势指标
prices = [item["price"] for item in trend_data]
price_change = prices[-1] - prices[0]
price_change_percentage = (price_change / prices[0]) * 100
return {
"status": "success",
... | Python | 1 |
},
}
}
/// Converts a string slice to an IP address.
///
/// This macro requires the feature `std`.
///
/// # Examples
/// ```
/// use std::net::{IpAddr, Ipv4Addr, Ipv6Addr};
/// use const_str::ip_addr;
///
/// const LOCALHOST_V4: Ipv4Addr = ip_addr!(v4, "127.0.0.1");
/// const LOCALHOST_V6: Ipv6Addr = ip_... | Rust | 0 |
# web_demo/glm_edge_1.5b_chat.py
import os
import gradio as gr
from transformers import AutoTokenizer, AutoModelForCausalLM
import torch
from peft import PeftModel
device = "cuda"
# 获取项目根目录
ROOT_DIR = os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
LORA_PATH = os.path.jo... | Python | 1 |
for the 'text' key in the input
dictionary will result in its associated bounding box being ignored.
"""
from unstructured_inference.inference.elements import TextRegions
from unstructured.partition.pdf_image.inference_utils import build_text_region_from_coords
text_regions:... | Python | 1 |
)]
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 to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits = (self.w.b... | Rust | 0 |
CSV = result.unwrap();
let stmt = conn.prepare(
"INSERT INTO stop\
(
uid,
id,
code,
name,
description,
position,
zone_id,
... | Rust | 0 |
gamepad_id = bindings[event.instance_id]
#Rebind bound controllers
if event.type == pygame.JOYBUTTONDOWN:
if event.button == 6:
bindings[event.instance_id] = 0
elif event.button == 7:
... | Python | 1 |
rate_input_delete_service_template_version_input(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::input::DeleteServiceTemplateVersionInput,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
if let Some(var_107) = &input.template_name {
object.key("templateNa... | Rust | 0 |
unsafe impl TriviallyTransmutable for ScrambledFriendCode {}
impl ScrambledFriendCode {
pub fn new(friend_code: u64, xor_key: u16) -> Self {
Self {
friend_code: Self::xor_friend_code(friend_code, xor_key),
xor_key,
unk: 0,
}
}
fn expand_xor_key(xor_key: ... | Rust | 0 |
ata from POST
serializer = CommentSerializer(data=request.data)
if serializer.is_valid():
serializer.save()
return Response(serializer.data, status=status.HTTP_201_CREATED)
return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)
@api_view(['GET', 'PUT', 'DELETE'])
def comment(re... | Python | 1 |
self.Tab_T_learner.append(T_learner)
current_avg_episode_length = sum(self.episode_length_buffer) / len(
self.episode_length_buffer
)
self.Tab_mean_length_episode.append(current_avg_episode_length)
indice_longest_episode = np.argmax(self.episode_length_buffer)
... | Python | 1 |
for default in [
DefaultAllow::Deny,
DefaultAllow::AllAuthenticated,
DefaultAllow::AllUnauthenticated,
DefaultAllow::ClusterAuthenticated,
DefaultAllow::ClusterUnauthenticated,
] {
assert_eq!(
default.to_string().par... | Rust | 0 |
t):
lr_scheduler1.step()
if idx % 10 == 0:
et = time.time()
strs = f"epoch: [{epoch}/{EPOCH}], iter: [{idx}/{data_num}], "
strs += f"loss: {float(avg_loss)}, loss1: {float(avg_loss1)}"
strs += f", acc_topk1: {float(acc['top1'])... | Python | 1 |
]y\xd0\xa5cS\xb8\xcb\x1cuX\x9d4\xaec\xba\
%\x96\xcb\xe4#y7\xe0\xd29\xea\x9f\xc1\xe3\xe5\xc4\
\xcfvC2*\xd1\xd35\xc8\x85\xca\xfd\x85\x1d\x9b\xba\
!\x0eJ\xc8\xdbb\xee,\x17-yQ\x1b\xf8\x0cD\
E\xd6\x1d\xb3p\xa8/\xacR\xd1G\xd72\xef\x960\
_\x82\xb8n\xbaM\x13\x87\x22\x18\xd0w'\xe8i\x15\
\x8e\xcc\xca\x89QZ\xf5qO\xab0'\xd5\x93\xb... | Python | 1 |
least_significant_one.html).
pub trait MaskTrailingZerosAndLeastSignificantOne {
#[inline]
fn mask_trailing_zeros_and_least_significant_one(self) -> Self;
}
impl<T: Word> MaskTrailingZerosAndLeastSignificantOne for T {
#[inline]
fn mask_trailing_zeros_and_least_significant_one(self) -> Self {
m... | Rust | 0 |
_page_obj': vehicle_page_obj,
}
return render(request, 'dashboard/dashboard.html', context)
@login_required
def delete_vehicle(request, vehicle_id):
vehicle = get_object_or_404(Vehicle, vid=vehicle_id, user_id=request.COOKIES.get('user_id'))
vehicle.is_published = False
vehicle.save()
user_pho... | Python | 1 |
plit = tl.cdiv(cur_batch_seq_len, NUM_KV_SPLITS)
split_kv_start = kv_len_per_split * split_kv_id
split_kv_end = tl.minimum(split_kv_start + kv_len_per_split,
cur_batch_seq_len)
if split_kv_end > split_kv_start:
tv = tl.load(Mid_O + offs_v + split_kv... | Python | 1 |
", lines).unwrap();
}
pub fn generate_offline_nuxvm(model: &TransitionSystemModel, initial: &Predicate) {
let lines = create_offline_nuxmv_problem(&model, initial);
//let datetime: DateTime<Local> = SystemTime::now().into();
// todo: use non platform way of getting temporary folder
// or maybe just ou... | Rust | 0 |
import os, sys, whois
from colorama import Fore
def show_whois_banner():
print(f"""
_ {Fore.CYAN}v{Fore.WHITE}[1.0] _ __ {Fore.CYAN} v{Fore.WHITE}[1.0]{Fore.CYAN} _
__ _| |__ ___ (_)___ / _| ___ ___ _ __ (_)_ __
\ \ /\ / / '_ \ / _ \| / __| | |_ / _ \/ _ \| '_ \| \ \/ /... | Python | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.