text
string
label_name
string
labels
int64
import fractions import av import numpy as np import streamlit as st from streamlit_webrtc import WebRtcMode, create_audio_source_track, webrtc_streamer st.title("Audio Source Track Demo") st.write( "This demo shows how to programmatically generate audio using AudioSourceTrack." ) # Audio generation parameters f...
Python
1
h: PedersenCommitmentGadget<G, ConstraintF, GG>, } impl<G, I, ConstraintF, GG, IG, W> CommitmentGadget<PedersenCommCompressor<G, I, W>, ConstraintF> for PedersenCommitmentCompressorGadget<G, I, ConstraintF, GG, IG> where G: Group, I: InjectiveMap<G>, ConstraintF: PrimeField, GG: GroupGadget<G, Cons...
Rust
0
ep, rev: rev, done: false} } impl<A> Iterator for RangeStepInclusive<A> where A: CheckedAdd + PartialOrd + Clone + PartialEq { type Item = A; #[inline] fn next(&mut self) -> Option<A> { if !self.done && ((self.rev && self.state >= self.stop) || (!self.rev && self.stat...
Rust
0
createDeclareByte_9")] pub fn with_declare_byte_9(b0: u8, b1: u8, b2: u8, b3: u8, b4: u8, b5: u8, b6: u8, b7: u8, b8: u8) -> Result<Instruction, JsValue> { Ok(Self(iced_x86_rust::Instruction::try_with_declare_byte_9(b0, b1, b2, b3, b4, b5, b6, b7, b8).map_err(to_js_error)?)) } /// Creates a `db`/`.byte` asm direc...
Rust
0
# EpyNN/epynn/commons/plot.py # Standard library imports import os # Related third party imports from matplotlib import pyplot as plt # Local application/library specific imports from epynn.commons.logs import process_logs def pyplot_metrics(model, path): """Plot metrics/costs from training with matplotlib. ...
Python
1
cont = 1 while True: print(cont, '-> ', end='') cont += 1 print('Acabou')
Python
1
{ t.init(&vp, 0); }); } #[test] #[should_panic] fn lds_shared_host_panic() { static T: Lds<[u8; 1]> = unsafe { Lds::new() }; let mut t = unsafe { T.borrow() }; let vp = MaybeUninit::uninit(); let vp: VectorParams<Dim1D<Range<u32>>> = unsafe { vp.assume_init() }; // actually unus...
Rust
0
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
Python
1
flags_group) flags.add_preserve_acl_flag(acl_flags_group) parser.add_argument( '--event-based-hold', action=arg_parsers.StoreTrueFalseAction, help='Enables or disables an event-based hold on objects.') parser.add_argument( '-R', '-r', '--recursive', action='store_true', ...
Python
1
from Py4GWCoreLib import GLOBAL_CACHE from Py4GWCoreLib import ThrottledTimer from Py4GWCoreLib import ActionQueueNode from Py4GWCoreLib import ConsoleLog from Py4GWCoreLib import Map module_name = "Skip Cinematic" class config: def __init__(self): self.skipped = False self.is_map_ready = False ...
Python
1
from indentml.parser import QqParser, QqTag from flask import Flask, render_template import os import sys from io import StringIO import contextlib from subprocess import Popen, PIPE, STDOUT import itertools import mistune app = Flask(__name__, static_url_path='') app.debug = True DEFAULT_LANG = "en" allowed_tags = {'...
Python
1
String, #[serde(rename = "Category")] pub number: u8, } #[derive(Debug, Serialize, Deserialize)] struct Characteristic { #[serde(rename = "UUID")] pub id: String, #[serde(rename = "Name")] pub name: String, #[serde(rename = "Format")] pub format: String, #[serde(rename = "Unit")] ...
Rust
0
nregistered_options(options: T::Options) -> Self { Self { metric: Metric::new("unregistered", "unregistered", options), recorders: Default::default(), } } /// Retrieves a type that can be used to report observations for a given set of attributes /// /// The value...
Rust
0
h.linspace(xmin[0], xmax[0], n_points) y = torch.linspace(xmin[1], xmax[1], n_points) z = torch.linspace(xmin[2], xmax[2], n_points) xx, yy, zz = torch.meshgrid((x,y,z)) xyz = torch.cat((xx.reshape(-1,1), yy.reshape(-1,1), zz.reshape(-1,1),),1) return xyz def get_scene_grasps_image(Hs, scale=1.,...
Python
1
// //println!("r2a.page:{:X}", r2a.page as *mut Page as usize); // let three = r2a.new(3); // //println!("three:{:X}", three as *mut i32 as usize); // assert_eq!(*three, 3); // let four = r2a.new(4); // //println!("four:{:X}", four as *mut i32 as ...
Rust
0
124, 235, 210, 26, 95, 231, 90, 73, 206, 33, 216, 171, 15, 188, 181, 136, 7, ]), ] ); } #[test] fn test_serde_key_pair() { let kp = KeyPair::from_seed([42u8; 32].into()); assert_tokens( &kp, &[ Token...
Rust
0
ILING { let pixel: Vec2 = 2.0 / self.resolution.xy(); uv *= 2.0; let f: f32 = (self.time * 0.5).rem_euclid(2.0).floor(); // Flash value. let first: Vec2 = pixel.step(uv) * f; // Rule out first screen pixels and flash. uv = uv.gl_fract().step(pixel); // Add on...
Rust
0
Y, vtype=GRB.CONTINUOUS, name="temp") rho_F0_temp = model_robust.addVars(F0_t + 1, 1, lb=-GRB.INFINITY, ub=GRB.INFINITY, vtype=GRB.CONTINUOUS, name="rho_F0_temp") rho_F0 = model_robust.addVar(lb=-GRB.INFINITY, ub=GRB.INFINITY, vtype=GRB.CONTINUOUS, name="rho_F0") for i in range(F0_t + 1): model_robu...
Python
1
import mitsuba import pytest import enoki as ek import numpy as np from .utils import check_uniform_scalar_sampler, check_uniform_wavefront_sampler def test01_ldsampler_scalar(variant_scalar_rgb): from mitsuba.core import xml sampler = xml.load_dict({ "type" : "ldsampler", "sample_count" : 10...
Python
1
''' 该程序作用是使用外部中断控制按键输入 在线文档:https://docs.geeksman.com/esp32/MicroPython/20.esp32-micropython-request.html ''' import urequests # 定义请求参数字典 request_params = {'city': '上海', 'key': 'a702b975fa48a063b1a57c938bafb47a'} # 定义访问地址 url = f'http://apis.juhe.cn/simpleWeather/query?city={request_params["city"]}&key={request_param...
Python
1
le %s" % args.f) sys.exit() else: wordlist = sys.stdin for line in wordlist: # Skip blank lines and comments in the word list if re.match('^$', line): continue if re.match('^#.*$', line): continue # Strip the new line character and check the word for length requirements ...
Python
1
attributes[f"status_code"] = 200 if data.success else 500 data.resultCode = str(sd.attributes[f"status_code"]) predefined_props.add(key) continue elif key == f"{data.type}.target": data.target = sd.attrib...
Python
1
{ return Some(inventory_id); } } None } use crate::{config, environment}; pub mod default; pub mod alias_list; pub mod error; pub trait Handler { fn handle(&self, environment: &environment::Environment, configuration: &config::Configuration); } use fenri...
Rust
0
fib(500)` call. When it runs your code, `scaling` takes the return value and tricks the optimiser into thinking it's going to use it for something, before throwing it away. This is why `fib_1` is safe from having code accidentally eliminated. In the case of `fib_3`, we actually *do* use the return value: each iteratio...
Rust
0
ities=["IMAGE"]) response = client.models.generate_content( model="gemini-2.5-flash-image-preview", contents=[cover_prompt], config=generate_content_config, ) if response.candidates: for part in response.candidates[0].co...
Python
1
inputs = [ ({'level': 'Senior', 'lang': 'Java', 'tweets': 'no', 'phd': 'no'}, False), ({'level': 'Senior', 'lang': 'Java', 'tweets': 'no', 'phd': 'yes'}, False), ({'level': 'Mid', 'lang': 'Python', 'tweets': 'no', 'phd': 'no'}, True), ({'level': 'Junior', 'lang': 'Python', 'tweets': 'no', 'phd': 'no'}, ...
Python
1
eld `TX_CLKM_DIV_X`"] pub type TX_CLKM_DIV_X_R = crate::R<u16, u16>; #[doc = "Write proxy for field `TX_CLKM_DIV_X`"] pub struct TX_CLKM_DIV_X_W<'a> { w: &'a mut W, } impl<'a> TX_CLKM_DIV_X_W<'a> { #[doc = r"Writes raw bits to the field"] #[inline(always)] pub unsafe fn bits(self, value: u16) -> &'a mut...
Rust
0
rate serialize; use serialize::{Encodable, Decodable}; use serialize::json; #[deriving(Encodable, Decodable, PartialEq, Show)] struct UnitLikeStruct; pub fn main() { let obj = UnitLikeStruct; let json_str: String = json::encode(&obj); let json_object = json::from_str(json_str.as_slice()); let mut de...
Rust
0
ipNameServer = 44, NetBiosOverTcpipDatagramDistributionServer = 45, NetBiosOverTcpipNodeType = 46, NetBiosOverTcpipScope = 47, XWindowSystemFontServer = 48, XWindowSystemDisplayManager = 49, RequestedIpAddress = 50, IpAddressLeaseTime = 51, OptionOverload = 52, DhcpMessageType = 53, ...
Rust
0
#!/usr/bin/env python # # This file is part of the pebil project. # # Copyright (c) 2010, University of California Regents # All rights reserved. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation...
Python
1
#! /usr/bin/env python # Copyright 2016 Tom SF Haines # 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 agree...
Python
1
#!/usr/bin/env python import unittest import numpy as np from tinygrad.tensor import Tensor from models.rnnt import LSTM import torch class TestRNNT(unittest.TestCase): def test_lstm(self): BS, SQ, IS, HS, L = 2, 20, 40, 128, 2 # create in torch with torch.no_grad(): torch_layer = torch.nn.LSTM(IS...
Python
1
OnDrop(crate = "zeroize_"); T)] struct Test<T>(T); }, #[cfg(not(feature = "zeroize-on-drop"))] quote! { impl<T> ::core::ops::Drop for Test<T> where T: zeroize_::ZeroizeOnDrop { fn drop(&mut self) { zeroize_::Zeroize::zeroize(self); } } }, #[cfg(feature = "zeroize-on-drop")] quote...
Rust
0
# coding=UTF-8 # ex:ts=4:sw=4:et=on # Copyright (c) 2013, Mathijs Dumon # All rights reserved. # Complete license can be found in the LICENSE file. import csv class CSVMixin(object): """ Model mixin providing CSV export and import functionality """ @classmethod def save_as_csv(cls, filename,...
Python
1
# -*- coding: utf-8 -*- # Author: Andy Freeman # Date: 11/10/2024 # Description: Keep Hungry Keep Foolish import json import os # 设置报告的浏览器窗口标题 # 通过修改Allure报告目录下index.html中head.title字段来设置Allure报告的浏览器窗口名称 def set_windows_title(allure_report_path, new_title): old_title = 'Allure Report' report_title_filepath = ...
Python
1
_ => { for color_channel in &mut color { *color_channel = clamp_color(f32::from(*color_channel) * color_diff); } } } } colors.push(color); } color...
Rust
0
g zeros. rle = { "size": [1350, 1080], "counts": "000lg0Zb01O00001O00001O001O00001O00001O001O00001O01O2N3M3M3M2N3M3N2M3M2N1O1O1O1O2N1O1O1O2N1O1O101N1O1O1O2N1O1O1O2N3M2N1O2N1O2O0O2N1O1O2N1O2N1O2N1O2N1O2N1O2O0O2N1O3M2N1O2N2N2N2N2N1O2N2N2N2N1O2N2N2N2N2N1N3N2N00O1O1O1O100000000000000O1000000...
Python
1
# -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. { 'name': 'Salary Configurator - Holidays', 'category': 'Human Resources', 'summary': 'Automatically creates extra time-off on contract signature', 'depends': [ 'hr_contract_salary', 'hr_h...
Python
1
CDISC c-code based on search string - 1st pass to get exact CDISC matches (using MATCH) arr = np.array(range(0, len(df['search_term'])-1)) for row in arr: if pd.notna(df.iloc[row]['search_term']) & pd.isna(df.iloc[row]['concept_id']): print('1st pass %s',df.iloc[row]['search_term']) result=search_cd...
Python
1
x=False) return len(output_df) def create_input_for_mturk(cfg, df, method, output_path): """ Create input.csv for MTurk :param cfg: configuration file :param df: row input, see validate_inputs for details :param output_path: path to output file """ if method in ['acr', 'p835', 'echo_...
Python
1
"PART", Command::Quit => "QUIT", Command::Ping => "PING", Command::Mode => "MODE", Command::Pong => "PONG", Command::Pass => "PASS", Command::PrivMsg => "PRIVMSG", Command::Topic => "TOPIC", Command::Who => "WHO", ...
Rust
0
constraints=[cons] ) if not result.success: if verbose: print(f"[L={L}] Optimization failed: {result.message}") continue weights = result.x constraint_val = self.constraint(weights, H) entropy = -s...
Python
1
erisInMsgData) lambertProblemInMsgData = messaging.LambertProblemMsgPayload() lambertProblemInMsgData.r2_N = r0_BN_N # only info of LambertProblemMsg needed by module lambertProblemInMsg = messaging.LambertProblemMsg().write(lambertProblemInMsgData) # subscribe input messages to module module.lam...
Python
1
AGE_SIZE": 100, } CORS_ALLOW_HEADERS = [ "accept", "accept-encoding", "authorization", "content-type", "dnt", "origin", "user-agent", "x-csrftoken", "x-requested-with", "x-view-as", "access-control-allow-origin", ] MEDIA_URL = "/media/" MEDIA_ROOT = os.path.join(BASE_DIR, "...
Python
1
ays)] pub fn clksource(&self) -> CLKSOURCE_R { CLKSOURCE_R::new(((self.bits >> 2) & 0x01) != 0) } #[doc = "Bit 16 - Returns 1 if timer counted to 0 since last time this was read"] #[inline(always)] pub fn countflag(&self) -> COUNTFLAG_R { COUNTFLAG_R::new(((self.bits >> 16) & 0x01) !...
Rust
0
de with overlay because // `collect_rent` will be done on first call and destination contract and balance // cannot be changed before the first call // We do not allow 'calling' plain accounts. For transfering value // `seal_transfer` must be used. let contract = if let Some(ContractInfo::Alive(info)) = rent:...
Rust
0
: i32) -> __jni_bindgen::std::result::Result<i32, __jni_bindgen::Local<'env, crate::java::lang::Throwable>> { // // class.path == "android/icu/text/SearchIterator", java.flags == PROTECTED | ABSTRACT, .name == "handleNext", .descriptor == "(I)I" // unsafe { // let __jni_args = [_...
Rust
0
est_deactivation_time_constant(): """Unit test for deactivation_time_constant.""" efel.reset() traces = _load_voltage_clamp_traces("Deactivation") feats = efel.get_feature_values(traces, ["deactivation_time_constant"]) deact_tau = [feat_dict["deactivation_time_constant"][0] for feat_dict in feats] ...
Python
1
<B as hyper::body::HttpBody>::Error: std::error::Error + Send + Sync + 'static, { type Error = LambdaError; type Fut = Pin<Box<dyn Future<Output = Result<serde_json::Value, Self::Error>>>>; /// Lambda handler function /// Parse Lambda event as hyper request, /// serialize hyper response to Lam...
Rust
0
aults .iter() .map(|vid| get_vault_info(ledger, component, vid)) .collect::<Vec<(Address, Decimal)>>() }) .collect() } fn get_account_vaults<'a, L: SubstateStore>( ledger: &'a L, account: Address, ) -> HashMap<Address, Decimal> { let component...
Rust
0
import heapq T=int(raw_input()) for tt in range(1,T+1): R,C = [int(t) for t in raw_input().split()] grid = [[0 for y in range(C)] for x in range(R)] result = 0 q=[] seen = [[False for y in range(C)] for x in range(R)] minVal = [[0 for y in range(C)] for x in range(R)] for i in range(R): ...
Python
1
ul, VartimePrecomputedMultiscalarMul}; #[cfg(not(all( feature = "simd_backend", any(target_feature = "avx2", target_feature = "avx512ifma") )))] use backend::serial::scalar_mul; #[cfg(all( feature = "simd_backend", any(target_feature = "avx2", target_feature = "avx512ifma") ))] use backend::vector::sca...
Rust
0
# Define here the models for your scraped items # # See documentation in: # https://docs.scrapy.org/en/latest/topics/items.html import scrapy class FilmscraperItem(scrapy.Item): # define the fields for your item here like: # name = scrapy.Field() url = scrapy.Field() # URL du film title = scra...
Python
1
RNOTAVAIL, Error::EFSM => errno::EFSM, Error::ENOCOMPATPROTO => errno::ENOCOMPATPROTO, Error::ETERM => errno::ETERM, Error::EMTHREAD => errno::EMTHREAD, } } pub fn from_raw(raw: i32) -> Error { match raw { errno::EACCES => Error::EACC...
Rust
0
() -> SourceChainResult<()> { let test_env = test_cell_env(); let env = test_env.env(); let alice = fixt!(AgentPubKey, Predictable, 0); let zome = fixt!(Zome); let mut mock = MockHolochainP2pCellT::new(); mock.expect_authority_for_hash().returning(|_| Ok(false)); ...
Rust
0
:Return(Ok(()))); Issue::_execute_issue( origin, *issue_id, H256Le::zero(), 0, vec![0u8; 100], vec![0u8; 100], ) } fn execute_issue_ok(origin: AccountId, issue_id: &H256) { ext::security::ensure_parachain_status_running::<Test>.mock_safe(|| MockResult::Retur...
Rust
0
def tree(label, branches=[]): for branch in branches: assert is_tree(branch), 'branches must be trees' return [label] + list(branches) def label(tree): return tree[0] def branches(tree): return tree[1:] def is_leaf(tree): return not branches(tree) def is_tree(tree): if type(tree) != ...
Python
1
return item.get(field_expression, "") # on model items we support multi-term expressions parts = field_expression.split('.') count = 1 fieldvalue = getattr(item, parts[0]) while count < len(parts) and fieldvalue is not None: fieldvalue = getattr(fieldvalue, pa...
Python
1
#!/usr/bin/env python import code import logging import os import socket import sys from functools import partial # read about copy-on-write for Python processes - I feel like I've heard # this doesn't work well py2 = False if sys.version_info.major == 2: input = raw_input ConnectionRefusedError = socket.err...
Python
1
# Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. # # This work is licensed under a Creative Commons # Attribution-NonCommercial-ShareAlike 4.0 International License. # You should have received a copy of the license along with this # work. If not, see http://creativecommons.org/licenses/by-nc-...
Python
1
d have plugins loaded (use available methods) # Check if any plugins are available - use a different approach plugin_categories = manager.get_plugin_categories() # If no plugins are loaded, skip the detailed test if len(plugin_categories) == 0: # At least verify the manager ...
Python
1
pygame.event.get() pygame.display.flip() clock.tick(60) for event in pygame.event.get(): if event.type == pygame.KEYDOWN: if event.key == pygame.K_q: running = False ending = True ...
Python
1
expected_type = self.known_config_types.get(k, None) vtype = type(v) if expected_type and vtype != expected_type: warnings.warn(msg % (k, section, vtype.__name__, expected_type.__name__)) ...
Python
1
import openai import config openai.api_key = config.OPENAI_API_KEY # def openAIQuery(query): # response = openai.Completion.create( # # engine="davinci-instruct-beta-v3", # engine="text-davinci-003", # # prompt=query, # prompt="genere moi le texte pour un podcast sur le theme de {}...
Python
1
Debug, Deserialize)] struct Link { title: Option<String>, href: String, } #[derive(Debug, Deserialize)] pub struct Author { pub name: String, pub affiliation: Option<String>, } #[derive(Debug, Deserialize)] struct ArXivEntry { id: String, updated: DateTime<Utc>, published: DateTime<Utc>, ...
Rust
0
} // * mut os_stack_t => Out<[os_stack_t]> "* mut os_stack_t" => { wrap_type = "Out<[os_stack_t]>".to_string(); // e.g. stack_bottom.as_ptr() call_expr = format!("{}.as_ptr()", ident); } _ => {} } // Return the transformed arg. Transfo...
Rust
0
_name("baz")); } #[test] fn test_contains_unsafe_chars() { for c in &['{', '}', '|', '\\', '^', '~', '[', ']', '`', '<', '>', '"'] { assert!(contains_unsafe_chars(&format!("http://z/{}", c))); } assert_eq!(contains_unsafe_chars("http://z.zzz/"), false); } ...
Rust
0
ounter - self.current_start) % self.scale == 0; if go_to_next_bit { self.current_bit = match self.current_bit { None | Some(0) => None, Some(bit) => Some(bit - 1), }; } return bitmap & mask != 0; } else {...
Rust
0
#gauss_jordan.py def print_matrix(M, decimals = 3): for row in M: print([round(x, decimals) + 0 for x in row]) def zeros_matrix(rows, cols): M = [] while len(M) < rows: M.append([]) while len(M[-1]) < cols: M[-1].append(0.0) return M matriz_zeros = zeros_matrix(3, 3) print_ma...
Python
1
rows = set.rows().map(|elem| elem.copied()).collect::<Vec<_>>(); assert_eq!( rows, &[ Vec2 { x: -1, y: -2 }, Vec2 { x: 0, y: -2 }, Vec2 { x: 1, y: -2 }, Vec2 { x: 9, y: -2 }, Vec2 { x: 100, y: -2 }, Vec2 { x: 0, y: 2 }, ...
Rust
0
nput: &[u8]) -> IResult<&[u8], ProgramInstruction> { let (input, size) = be_u32(input)?; let (data, bump_seed) = take(1usize)(input)?; Ok(( data, ProgramInstruction::CreateBucket { data, size, bump_seed: bump_seed[0], }, )) } fn put_into_buck...
Rust
0
𝚞','v':'𝚟','w':'𝚠','x':'𝚡','y':'𝚢','z':'𝚣', 'A':'𝙰','B':'𝙱','C':'𝙲','D':'𝙳','E':'𝙴','F':'𝙵','G':'𝙶','H':'𝙷','I':'𝙸', 'J':'𝙹','K':'𝙺','L':'𝙻','M':'𝙼','N':'𝙽','O':'𝙾','P':'𝙿','Q':'𝚀','R':'𝚁', 'S':'𝚂','T':'𝚃','U':'𝚄','V':'𝚅','W':'𝚆','X':'𝚇','Y':'𝚈','Z':'𝚉' }, ...
Python
1
# Initially pulled from https://github.com/black-forest-labs/flux from dataclasses import dataclass from typing import Dict, Literal from invokeai.backend.flux.model import FluxParams from invokeai.backend.flux.modules.autoencoder import AutoEncoderParams @dataclass class ModelSpec: params: FluxParams ae_pa...
Python
1
# Copyright 2019 The ROBEL Authors. # # 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 in wr...
Python
1
diagnostics_relay_client_free() disconnects before execution and"] #[doc = " DIAGNOSTICS_RELAY_ACTION_FLAG_DISPLAY_FAIL to show a \"FAIL\" dialog"] #[doc = " or DIAGNOSTICS_RELAY_ACTION_FLAG_DISPLAY_PASS to show an \"OK\" dialog"] #[doc = ""] #[doc = " @return DIAGNOSTICS_RELAY_E_S...
Rust
0
import wx from wx.lib import sized_controls import wx.lib.agw.hyperlink as hl class ContributeDialog(sized_controls.SizedDialog): def __init__(self, *args, **kwargs): super(ContributeDialog, self).__init__(title="Contribute to PyCorrFit", *args, **kwargs) ...
Python
1
{ let stream = stream::iter((1..=3).flat_map(|_| vec![Ok(vec![]), Ok(vec![1, 2, 3, 4, 5])])); let mut reader = stream.interleave_pending().into_async_read(); let mut buf = vec![0; 3]; assert_read!(reader, &mut buf, 3); assert_eq!(&buf, &[1, 2, 3]); assert_read!(reader, &mut buf, 2); assert...
Rust
0
tch<RealRuntime>; type ProposalId = pallet_deip_proposal::proposal::ProposalId; type Call = node_template_runtime::Call; type BatchItem = pallet_deip_proposal::proposal::ProposalBatchItemOf<RealRuntime>; type ProposalState = pallet_deip_proposal::proposal::ProposalState; type WrappedBatch = Vec<pall...
Rust
0
# Generated by Django 2.2.6 on 2019-11-12 08:38 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('userprofile', '0003_introduce_organizations'), ] operations = [ migrations.AddField( model_name='userprofile', name=...
Python
1
e == 'pre': # plt.savefig('vis/nba/'+str(idx)+'pre.png') plt.savefig(vispath+str(idx)+'pre.png') else: # plt.savefig('vis/nba/'+str(idx)+'gt.png') plt.savefig(vispath+str(idx)+'gt.png') print('ok') return def vis_result(test_loader, args): total_num...
Python
1
# -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*- # # Copyright 2025 Canonical Ltd. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License version 3 as # published by the Free Software Foundation. # # This program is distributed in the hope...
Python
1
th_json_file (`str`): The path to the json file. """ with open(path_json_file, "r") as file: json_object = json.load(file) return json_object @dataclass class PeftConfig(PeftConfigMixin): """ This is the base configuration class to store the configuration o...
Python
1
# Copyright (C) 2022 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.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
Python
1
, 19) /// .and_hms_milli(14, 54, 23, 31), /// ); /// # assert_eq!(date_range.client_attributes(), &BTreeMap::new()); /// /// let mut attributes = BTreeMap::new(); /// attributes.insert("X-COM-EXAMPLE-FLOAT".to_string(), Value::Float(1.1)); /// /// date_range /// .client_a...
Rust
0
"""index time taken water usage Revision ID: 6cc71ed5d591 Revises: 068ab7462033 Create Date: 2024-06-24 22:09:38.494196 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = '6cc71ed5d591' down_revision = '068ab7462033' branch_labels = None depends_on = None def up...
Python
1
line[0..1]; let value: isize = line[1..].parse().unwrap(); match command { "N" => position = (position.0, position.1 + value), "S" => position = (position.0, position.1 - value), "E" => position = (position.0 + value, position.1), "W" => position = (positi...
Rust
0
) x1 = await Embedding( embedding_model=embedding_model, in_mask=["text"], )(i0) x2 = await UpdateKnowledge( knowledge_base=knowledge_base, )(x1) program = Program( inputs=i0, outputs=x2, name="test_update_...
Python
1
_params(post_config); let partitions = get_partitions_for_window_post(replicas.len(), post_config); let sector_count = vanilla_params.sector_count; let setup_params = compound_proof::SetupParams { vanilla_params, partitions, priority: post_config.priority, }; let pub_params...
Rust
0
_get_gases_hook() { with_mix(src, |mix| { let gases_list: List = List::new(); mix.for_each_gas(|idx, gas| { if gas > GAS_MIN_MOLES { gases_list.append(gas_idx_to_id(idx)?); } Ok(()) })?; Ok(Value::from(gases_list)) }) } /// Args: (temperature). Sets the temperature of the mixture. Will be set t...
Rust
0
hod def encode_int(val, value): try: if val >= 0: value.pos_int_value = val else: value.neg_int_value = -val except ValueError: value.double_value = val @staticmethod def encode_id(obj, id): if id is not None: ...
Python
1
# controllers/task_controller.py from db.database import Database from datetime import datetime from models.task import Task # 确保 Task 类放在 models/task.py 文件中 class TaskController: _instance = None def __new__(cls, *args, **kwargs): if cls._instance is None: cls._instance = super(TaskCont...
Python
1
_info(): username = "secret-user" password = "secret" client = SchemaRegistryClient( { "url": "https://user_url:secret_url@127.0.0.1:65534", "basic.auth.credentials.source": "user_info", "basic.auth.user.info": f"{username}:{password}", } ) userpa...
Python
1
reamlit.app/ height: 530px .. note:: To make the PyDeck chart's style consistent with Streamlit's theme, you can set ``map_style=None`` in the ``pydeck.Deck`` object. """ pydeck_proto = PydeckProto() marshall(pydeck_proto, pydeck_obj, use_container_widt...
Python
1
: u8 = (1 << SIZE) - 1; pub const OFFSET: usize = 0; pub const SIZE: usize = 2; } mod dscp { pub const MASK: u8 = (1 << SIZE) - 1; pub const OFFSET: usize = super::ecn::OFFSET + super::ecn::SIZE; pub const SIZE: usize = 6; } const TOTAL_LENGTH: Range<usize> = 2..4; const IDENTIFICATION: Range<usize...
Rust
0
"Attempted to use a StreamKey to decrypt a lockbox with a LockId recipient", )); } // Feed the lockbox's parts into the decryption algorithm use chacha20poly1305::aead::{Aead, NewAead}; use chacha20poly1305::*; let aead = XChaCha20Poly1305::new(Key::from_slice(&self....
Rust
0
her-password", ) api_client.force_authenticate(user=user) response = api_client.post( reverse("change-email"), { "new_email": "shared@example.com", # This email exists in different site "password": "a-super-strong-password-145338-@!#&", ...
Python
1
Some(Token { var: TokenType::Comment(..), .. }) = tok { } else { break tok; } } } } impl<T> Lexer<T> where T: Iterator<Item = char>, { pub fn new(iter: T) -> Lexer<T> { Lexer { iter:...
Rust
0
import random def choose_word(): words = ['aviation','debug','Discord','keyboard','cessna', 'piper','cherokee','coding','game','runway','Pharaoh','Exotic','Submerge','Python','Xylophone','Rubik','Mystique','Gazebo','Kaleidoscope','Flabbergasted'] return random.choice(words) def display_word(word, guessed_lett...
Python
1
b: int8x8_t) -> int8x8_t; #[cfg_attr(target_arch = "arm", link_name = "llvm.arm.neon.vpmins.v4i16")] #[cfg_attr( target_arch = "aarch64", link_name = "llvm.aarch64.neon.sminp.v4i16" )] fn vpmins_v4i16(a: int16x4_t, b: int16x4_t) -> int16x4_t; #[cfg_attr(target_arch = "arm", link_name = "llv...
Rust
0
from dynamiq.connections import E2B from dynamiq.nodes.agents import Agent from dynamiq.nodes.tools.e2b_sandbox import E2BInterpreterTool from dynamiq.nodes.types import InferenceMode from dynamiq.utils.logger import logger from examples.llm_setup import setup_llm AGENT_ROLE = ( "A helpful and general-purpose AI a...
Python
1