text
string
label_name
string
labels
int64
import pandas as pd import pandas.io.formats.format as pf from cPickle import load from code import interact from sys import argv class IntArrayFormatter(pf.GenericArrayFormatter): def _format_strings(self): fmt_values = [ '0x{:016x}'.format(x) for x in self.values ] retur...
Python
1
// // Add expected request. // state.write().expect_request(testing::PendingRequest { // method: "GET".into(), // uri: EXPECTED_URL.into(), // response: None, // sent: true, // ..Default::default() // }); // t.execute_with(||...
Rust
0
rn('Note: the "to_float" is True, you need to ' 'ensure that the behavior is reasonable.') flatten_tensor = torch.cat( [py_dict[k].flatten().float() for k in py_key]) else: flatten_tensor = torch.cat([py_dict[k].flatten() for k in py_key]) dist.all_reduce(flatt...
Python
1
gparser.add_argument('--dropout', type=float, default=0.5) argparser.add_argument("--weight-decay", type=float, default=5e-4, help="Weight for L2 loss") argparser.add_argument("--eval", action='store_true', help='If not set, we will only do the training part.') argparser.add_argument('--num-workers', t...
Python
1
35, 83, 168, 202, 23, 231, 195, 6, 115, 123, 255, 191, 43, 255, 229, 67, 98, 137, 190, 144, 108, 174, 108, 161, 250, 15, 170, 67, 142, 10, 102, 230, ]; let c2 = [ 208, 1, 211, 152, 131, 216, 216, 233, 134, 111, 193, 40, 199, 147, 160, 146, 106, 253, 28, 52,...
Rust
0
nals let mut last_pos = (0, 0); let mut last_size = (0, 0); while !window.should_close() { glfw.poll_events(); for (_, event) in glfw::flush_messages(&events) { match event { glfw::WindowEvent::Key(Key::Escape, _, Action::Press, _) => { window...
Rust
0
_W { w: self } } #[doc = "Bit 16"] #[inline(always)] pub fn reg_gpio_13_ie(&mut self) -> REG_GPIO_13_IE_W { REG_GPIO_13_IE_W { w: self } } #[doc = "Bits 8:12"] #[inline(always)] pub fn reg_gpio_12_func_sel(&mut self) -> REG_GPIO_12_FUNC_SEL_W { REG_GPIO_12_FUNC_SEL_W { w:...
Rust
0
rt.x][start.y] = 0; let mut unchecked = BinaryHeap::<State>::new(); unchecked.push(State::new(start, 0)); let mut count = 0; while !unchecked.is_empty() { // let State { point, cost: _ } = unchecked.pop().unwrap(); let State { point, cost } = unchecked.pop().unwrap(); count += 1;...
Rust
0
.chunks_exact_mut(8).zip(ns) { LE::write_u64(c, *n); } } #[rustfmt::skip] #[cfg(not(feature = "no_unroll"))] macro_rules! unroll8 { ($var:ident, $body:block) => { { const $var: usize = 0; $body; } { const $var: usize = 1; $body; } { const $var: usize = 2; $body; } { cons...
Rust
0
# -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. { 'name': 'DIN 5008 - Sale', 'category': 'Accounting/Localizations', 'depends': [ 'l10n_din5008', 'sale', ], 'data': [ 'report/din5008_sale_templates.xml', 'report/din5...
Python
1
import numpy as np import os from model import MLModel def main(): # 获取当前脚本所在目录的绝对路径 current_dir = os.path.dirname(os.path.abspath(__file__)) # 加载模型 model = MLModel() model.load_model( os.path.join(current_dir, "data/best_model.joblib"), os.path.join(current_dir, "data/best_sca...
Python
1
, Node::FloatLit(n) => !n.base.comments.is_empty(), Node::StringLit(n) => !n.base.comments.is_empty(), Node::DurationLit(n) => !n.base.comments.is_empty(), Node::UintLit(n) => !n.base.comments.is_empty(), Node::BooleanLit(n) => !n.base.comments.is_empty(), Node::DateTimeL...
Rust
0
rs - total bot.send_message(message.chat.id, f"<b>✅ Ваше сообщение успешно отправлено: {total} пользователям из: {all_users} </b>", parse_mode="html", reply_markup=None) bot.send_message(message.chat.id, f"<b>❌ Заблокировавшие пользователи: {blocked_users} </b>", parse_mode="html", reply_markup...
Python
1
YK$D/aMV+<VdL': b'Space compr: ', b'rr': b'\xff', b's8N': b'\xff'*2, b's8W*': b'\xff'*3, b's8W-!': b'\xff'*4, } for data, res in tests.items(): eq(base64.a85decode(data), res, data) eq(base64.a85decode(data, adobe=False), re...
Python
1
} let base = top + 1; let mut pre_abs = PreAbsorbRec::new(base.clone(), involved.clone()); pre_abs.record_swaps(swaps); (base, involved, pre_abs) } } panic!("For some reason, all the LHS's in this linear dependency ar...
Rust
0
commands::connection::handle_command(&conf, subargv) } (commands::fuse::COMMAND_STR, Some(subargv)) => { commands::fuse::handle_command(&conf, subargv) } (commands::proc::COMMAND_STR, Some(subargv)) => { commands::proc::handle_command(&conf, subargv) ...
Rust
0
- PrimeCell identification 3"] #[inline(always)] pub fn pcell_id_3(&self) -> &crate::Reg<pcell_id_3::PCELL_ID_3_SPEC> { unsafe { &*(((self as *const Self) as *const u8).add(4080usize) as *const crate::Reg<pcell_id_3::PCELL_ID_3_SPEC>) } } #[doc = "0xff0 - Pri...
Rust
0
columns=[df.A, df.B], margins=True, margins_name="margin", normalize=True, ) expected = DataFrame( [ [0.111111, 0.111111, 0.222222, 0.000000, 0.444444], [0.111111, 0.111111, 0.111111, 0.222222, 0.555556], [0....
Python
1
""" Created on 2024-10-02 @author: wf """ from tests.basetest import Basetest from tests.example_testcases import NominaExample class Test_GnuCash(Basetest): """ test GnuCash handling """ def setUp(self, debug=True, profile=True): Basetest.setUp(self, debug=debug, profile=profile) s...
Python
1
boxes, classes, eval_configs, eval_version='detection_cvpr_2019'): """Convert the box from global to camera coordinate. Args: info (dict): Info for a specific sample data, including the calibrat...
Python
1
# SPDX-License-Identifier: BSD-2-Clause # Copyright Sphinx Confluence Builder Contributors (AUTHORS) from docutils import nodes from sphinxcontrib.confluencebuilder.compat import docutils_findall as findall from sphinxcontrib.confluencebuilder.logger import ConfluenceLogger # #########################################...
Python
1
ortb_req::*; use serde_json; #[test] fn req_instream_pre_roll() { let exp = "e5411942-39a1-4019-afdd-82955584124e"; let jd = &mut serde_json::Deserializer::from_str(&INSTREAM_PRE_ROLL); let ortb_req_result: Result<BidRequest, serde_path_to_error::Error<serde_json::Error>> = serde_path_to_error::des...
Rust
0
otFoundBodyResponse}, }, response_model_exclude_none=True, status_code=200, dependencies=[ Depends(check_permissions(required_roles={UserRole.ADMIN})) ], ) async def update_rack( self, rack_id: int, rack_request: RackRequest, re...
Python
1
0000_0080, vec![0xcc, 0x80])); test_cases.push((0x0000_00ff, vec![0xcc, 0xff])); test_cases.push((0x0000_0100, vec![0xcd, 0x00, 0x01])); test_cases.push((0x0000_ffff, vec![0xcd, 0xff, 0xff])); test_cases.push((0x0001_0000, vec![0xce, 0x00, 0x00, 0x01, 0x00])); test_cases.push((-1...
Rust
0
ge(length_percentage)) }) }) } } impl<LP: ToCss, N: ToCss> ToCss for GenericLengthPercentageNumberOrAuto<LP, N> { fn to_css<W>(&self, dest: &mut W) -> std::fmt::Result where W: std::fmt::Write, { match self { GenericLengthPercentageNumberOrAuto::LengthPercentage(value) => value.to_css(dest), Gene...
Rust
0
{ continue; } if input_numbers[i] + input_numbers[j] + input_numbers[k] == 2020 { return Some(input_numbers[i] * input_numbers[j] * input_numbers[k]).into(); } } } } None.into() } #[cfg(test)] #[test] ...
Rust
0
ame="dropout", batch_size=10, max_epochs=10, train_split=None, ) X = X.astype(np.float32) X_test = X_test.astype(np.float32) # without dict estimator.fit(X, y, sample_domain=sample_domain) estimator.predict(X_test, sample_domain=sample_domain_test, allow_source=True) ...
Python
1
""" utils functions """ import os from dotenv import load_dotenv, find_dotenv def load_env(): _ = load_dotenv(find_dotenv) def get_open_ai_key(): load_env() openai_api_key = os.getenv("OPENAI_API_KEY") return openai_api_key def llm_config(): return {"model": "gpt-3.5-turbo"}
Python
1
e(VecDeque::new())), }); MpmcDeque { inner, } } //构建指定初始容量的自旋锁双端队列 pub fn with_capacity(capacity: usize) -> Self { let inner = Arc::new(InnerDeque { tail_status: AtomicU8::new(UNLOCK_EMPTY), tail: UnsafeCell::new(Some(Vec::wit...
Rust
0
# Copyright 2018 ARM Limited # # 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 writin...
Python
1
est_morpho_withdraw_zero_amount(): """Test morpho withdraw with zero amount.""" mock_wallet = MagicMock() result = morpho_action_provider().withdraw( mock_wallet, {"vault_address": MOCK_VAULT_ADDRESS, "assets": "0.0", "receiver": MOCK_RECEIVER}, ) assert "Error: Assets amount must ...
Python
1
#[cfg(not(windows))] { nix::unistd::getuid().is_root() } } // check if there is a internet connection pub async fn is_internet_connected() -> bool { online::check(None).await.is_ok() } // get the current operating system pub fn get_os() -> String { std::env::consts::OS.to_string() } // ge...
Rust
0
me, (x, y), (x + w, y + h), (0, 255, 0), 2) cv2.putText(result_frame, "GO SIGN", (x, y - 10), cv2.FONT_HERSHEY_SIMPLEX, 0.7, (0, 255, 0), 2) detected_sign = "go" # Check for yield sign (yellow) for contour in yield_contour...
Python
1
coder> TurboDecoder<B> { /// Create a new Turbo decoder with a given trellis defined by the `bcjr` algorithm. pub fn new(bcjr: B) -> Self { Self { bcjr, l_app_deinterleaved: vec![], la_second: vec![], } } /// Produce an iterator for the Turbo decoder....
Rust
0
_base_ = 'regnetx-8.0gf_8xb32_in1k.py' _deprecation_ = dict( expected='regnetx-8.0gf_8xb32_in1k.py', reference='https://github.com/open-mmlab/mmclassification/pull/508', )
Python
1
0040 != 0 {hex_gillham |= 0x0800;} // Bit 6 = X or M if id13_field & 0x0020 != 0 { hex_gillham |= 0x0100; } // Bit 5 = B1 if id13_field & 0x0010 != 0 { hex_gillham |= 0x0001; } // Bit 4 = D1 or Q if id13_field & 0x0008 != 0 { hex_gillham |= 0x0200; } // Bit 3 = B2 ...
Rust
0
the LANGUAGES array, guard the new element with the // new feature. // // const LANGUAGES: &[Settings] = &[ // // ... // #[cfg(feature = "lang-foo")] // Setting{ // id: LapceLanguage::Foo, // language: tree_sitter_foo::language, // highlight: tree_sitter_foo:...
Rust
0
else: logger.info(f"All model checkpoint weights were used when initializing {model.__class__.__name__}.\n") if len(missing_keys) > 0: logger.warning( f"Some weights of {model.__class__.__name__} were not initialized from the model checkpoint at" f...
Python
1
r of gradient boosted trees. More trees generally improve performance.") max_depth = st.number_input("Max depth", min_value=1, value=10, help="Maximum depth of each tree. Deeper trees can model more complex patterns but may overfit.") return { ...
Python
1
from __future__ import absolute_import import logging from subprocess import CalledProcessError import time from ... import constants from ..virtualbox import get_host_ip, check_output_on_vm, check_call_on_vm, call_on_vm from ...log import log_to_client from ...subprocess import call_demoted, check_call_demoted, chec...
Python
1
from elevenlabs import generate, save, set_api_key set_api_key("sk_dfc921baa43500bf001c7fe224e07cc90877a7cbfdf9eca3") audio = generate( text="Hi... I’m Amicabot. I’ve been waiting to talk to you again.", voice="Sarah", model="eleven_monolingual_v1" ) save(audio, "amicabot_voice_line_soft_fixed.mp3") prin...
Python
1
lf.tp): self.tp = tp else: expr_list_start_token.syntax_err( "无法确定泛型参数'%s'的类型,存在不兼容的推导结果:'%s', '%s'……" % (self.gtp_name, self.tp, tp)) #将类型确定下来 assert self.tp is not None self.is_freezed = True d...
Python
1
""" Test AlabamaStateParks Provider """ import os import pathlib from unittest import mock from pytest import MonkeyPatch from camply.providers import ( AlabamaStateParks, ) from tests.conftest import CamplyRunner, cli_status_checker, vcr_cassette @vcr_cassette @mock.patch.dict(os.environ, {"CAMPLY_PROVIDER": ...
Python
1
ERROR: type should be string, got " https://github.com/rbgirshick/py-faster-rcnn/blob/master/lib/nms/py_cpu_nms.py\n '''\n sigma = 0.5\n\n x1 = bboxes[:,0]\n y1 = bboxes[:,1]\n x2 = bboxes[:,2]\n y2 = bboxes[:,3]\n\n areas = (x2-x1+1) * (y2-y1+1)\n ordered_score, ordered_idx = scores.sort(0, descending=True)\n\n keep = []\n while ordered_idx.numel() > 0:\n '''soft NMS'''\n if ordered_score[0] < threshold:\n break\n\n max_idx = ordered_idx[0]\n keep.append(max_idx)\n\n if ordered_idx.numel() == 1:\n break\n\n xx1 = x1[ordered_idx[1:]].clamp(min=x1[max_idx])\n yy1 = y1[ordered_idx[1:]].clamp(min=y1[max_idx])\n xx2 = x2[ordered_idx[1:]].clamp(max=x2[max_idx])\n yy2 = y2[ordered_idx[1:]].clamp(max=y2[max_idx])\n\n w = (xx2-xx1+1).clamp(min=0)\n h = (yy2-yy1+1).clamp(min=0)\n inter = w*h\n\n if mode == 'union':\n ovr = inter / (areas[max_idx] + areas[ordered_idx[1:]] - inter)\n elif mode == 'min':\n ovr = inter / areas[ordered_idx[1:]].clamp(max=areas[max_idx])\n else:\n raise TypeError('Unknown nms mode: %s.' % mode)\n\n '''soft NMS'''\n weights = torch.exp(-1. * (torch.pow(ovr, 2) / sigma))\n ordered_idx = ordered_idx[1:]\n ordered_score = weights * ordered_score[1:]\n sort_with_indices(ordered_score, ordered_idx)\n\n '''NMS'''\n # ids = (ovr<=threshold).nonzero().squeeze()\n # if ids.numel() == 0:\n # break\n # ordered_idx = ordered_idx[ids+1]\n return torch.LongTensor(keep)\n\ndef softmax(x):\n '''Softmax along a specific dimension.\n\n Args:\n x: (tensor) input tensor, sized [N,D].\n\n Returns:\n (tensor) softmaxed tensor, sized [N,D].\n '''\n xmax, _ = x.max(1)\n x_shift = x - xmax.view(-1,1)\n x_exp = x_shift.exp()\n return x_exp / x_exp.sum(1).view(-1,1)\n\ndef one_hot_embedding(labels, num_classes):\n '''Embedding labels to one-hot form.\n\n Args:\n labels: (LongTensor) class labels, sized [N,].\n num_classes: (int) number of classes.\n\n Returns:\n (tensor) encoded labels, sized [N,#classes].\n '''\n N = labels.size(0)\n D = num_classes\n y = torch.zeros(N,D)\n y[torch.arange(0,N).long(),labels] = 1\n\n return y"
Python
1
NativeState::from_column_set( &self.all_behavior_col_names, &self.schema.agent.arrow, &agent_batch, )?; Ok(GroupState { schema: &self.schema, all_behavior_col_names: &self.all_behavior_col_names, col_map: &self.col_map, ...
Rust
0
, the bare metal stack for rust. // Copyright 2014 Vladimir "farcaller" Pouzanov <<EMAIL>> // // 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...
Rust
0
play_data.csv' if not os.path.exists(filename): df.to_csv(filename, mode='w', index=False, quoting=csv.QUOTE_ALL, encoding='gbk') else: df.to_csv(filename, mode='a', header=False, index=False, quoting=csv.QUOTE_ALL, encoding='gbk') #保证历史数据的时间要小于当前时间 def check_history(chart_dict1,chartname,star...
Python
1
import torch from solvers.diffusion_solver_hybrid import DiffusionHybridSolver def ckpt_to_pt(): ckpt = '/ssd3/doyo/diffusion_v2/diffusion_v2/hybrid_wo_disc_hb1/last.ckpt' model = DiffusionHybridSolver.load_from_checkpoint(ckpt) print('loaded') ckpt_to_pt()
Python
1
type Bytes<'a> = & 'a [u8] ; /// Special macro to create parsers. /// /// Typically used to pass an offset as parameter and returned a `Spnd` /// thing. #[macro_export] macro_rules! mk_parser { ( $(#[$attr:meta])* pub fn $id:ident( $bytes:ident $(, $param:ident : $param_ty:ty)* $(,)* ) -> $out:ty ...
Rust
0
import json import os from abc import ABCMeta from modules.model.BaseModel import BaseModel import torch class InternalModelSaverMixin(metaclass=ABCMeta): def __init__(self): super().__init__() def _save_internal_data( self, model: BaseModel, destination: str, ...
Python
1
"1 + true" } parse_expr! { math_precedence, "1 + 2 * -3 < 0" } parse_expr! { call_0, "print_num(1);" } parse_expr! { call_1, "({print_num})(1);" } pub const SUCCESS: u8 = 0; pub const MAX_ACCOUNTS_REACHED: u8 = 1; pub const RANDOM_ERROR: u8 = 2; pub const CODE_BITS: usize = 2; <filename>tests/spec/libsass_closed...
Rust
0
#[inline] fn clear(&mut self) { self.clear(); } #[inline] fn truncate(&mut self, new_len: usize) { self.truncate(new_len); } #[inline] fn len(&self) -> usize { self.len() } #[inline] fn as_str(&self) -> &str { self.as_str() } } struct Parse...
Rust
0
iter_mut() { let c: Result<i64, _> = name.parse(); let value: json::object::Object = match *value { json::JsonValue::Object(ref mut data) => data.clone(), _ => { continue; } }; if c.is_ok() { intraday_hours.insert(&name, j...
Rust
0
0] if period == "1": url = "https://push2his.eastmoney.com/api/qt/stock/trends2/get" params = { "fields1": "f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,f13", "fields2": "f51,f52,f53,f54,f55,f56,f57,f58", "iscr": "0", "ndays": "1", "secid": f"90....
Python
1
.into_inner() > Self::Inner::zero() } /// Returns `true` if `self` is negative and `false` if the number is zero or positive. fn is_negative(self) -> bool { self.into_inner() < Self::Inner::zero() } /// Returns the integer part. fn trunc(self) -> Self { self.into_inner().checked_div(&Self::DIV) .expect("...
Rust
0
overlays.get(&overlay_id).unwrap(); let device = &self.pipelines.device; let clear_values = { let bg = background_color; [ vk::ClearValue { color: vk::ClearColorValue { float32: [bg.r, bg.g, bg.b, 1.0], ...
Rust
0
input, Token { token_type: TokenType::Char, span: SourceSpan::new(begin, content, end), value, }, )) } else { Err(nom::Err::<LangError>::Error(LangError::from( LangErrorType::ParserError { ...
Rust
0
from itertools import combinations def read_file(filename): alphabet = [] with open(filename, 'r') as f: lines = f.read().split('\n') alphabet = lines[0].split() n = int(lines[1]) return alphabet, n def permutation(alphabet, n): result = [] alphabet = al...
Python
1
_commit_decoration_style_empty_string() { _do_test_commit_style_no_decoration(&[ "--commit-style", "blue", "--commit-decoration-style", "", ]); } fn _do_test_commit_style_no_decoration(args: &[&str]) { let config = integration_test_utils::...
Rust
0
import sys if sys.version_info < (3, 7): import typing def is_generic(klass): """ Determine whether klass is a generic class """ return type(klass) == typing.GenericMeta def is_dict(klass): """ Determine whether klass is a Dict """ return klass.__extra__ == dict def i...
Python
1
from flask import Flask, Response, request import requests app = Flask(__name__) @app.route("/path/<path:subpath>") def handle_path(subpath): include_content_type = request.args.get("ct", "false").lower() == "true" include_content_disposition = request.args.get("cd", "false").lower() == "true" if subpat...
Python
1
::GstWebRTCRTPTransceiver, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_<F> = Box_::new(f); connect_raw( self.a...
Rust
0
KSIZE]; const CT_EXP: [u8; AES_BLOCKSIZE] = [ 0x7e, 0xce, 0x9a, 0xad, 0x4c, 0x56, 0xc1, 0x9, 0xca, 0xfa, 0xeb, 0xb8, 0x1d, 0x31, 0x8f, 0x65, ]; let ct = match crate::skcipher::encrypt("xts(aes)", key, pt, iv) { Ok(ct) => ct, Err(e) => { ...
Rust
0
import webbrowser class Websites: @staticmethod def open_website(url=""): """ Opens a website in the default web browser. Args: - url: The URL of the website to open. Returns: - 'opened' if successful. - Error message if unsuccessful. """ ...
Python
1
ело да я /// изтриете. /// fn from_components(digits: Vec<u8>, sign: i8) -> Self { let digits_vector = Bigint::trim_leading_zeros(&digits); let sign_value = Bigint::get_sign_value(&digits, sign); Self{sign: sign_value, digits:digits_vector} } fn get_sign_value(v: &Vec<u8>, s...
Rust
0
", &format_args!("0x{:x}", self.flags)) .field("reserved", &format_args!("0x{:x}", self.reserved)) .finish() } } impl From<Header32> for Header { fn from (header: Header32) -> Self { Header { magic: header.magic, cputype: header.cputype, ...
Rust
0
t("/").collect(); for (i, e) in vdan.iter().enumerate() { match extractdan(e) { Ok(ret) => { res = format!( "{}|{}|{}\n", res, ret.iter() .map(|koma| koma.to_string...
Rust
0
') with open(image_path, 'wb') as f: f.write(base64.b64decode(image_data)) return jsonify({"status": "success", "file": image_path}) return jsonify({"status": "error", "message": "No image data received"}) @app.route('/process_vision', methods=['POST']) def process_vision(): user_...
Python
1
"""See https://github.com/numpy/numpy/pull/10676. """ from __future__ import division, absolute_import, print_function import sys from importlib import import_module import pytest from numpy.testing import assert_equal from . import util class TestQuotedCharacter(util.F2PyTest): code = """ SUBROUTINE FOO...
Python
1
# WARNING: Please don't edit this file. It was generated by Python/WinRT v0.9.210202.1 import typing, winrt import enum _ns_module = winrt._import_ns_module("Windows.ApplicationModel.Calls.Background") class PhoneCallBlockedReason(enum.IntEnum): IN_CALL_BLOCKING_LIST = 0 PRIVATE_NUMBER = 1 UNKNOWN_NUMBER...
Python
1
# Copyright 2016 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agree...
Python
1
ue: String }, Remove { key: String }, } impl Command { fn set(key: String, value: String) -> Command { Command::Set { key, value } } fn remove(key: String) -> Command { Command::Remove { key } } } impl KvStore { pub fn new(file_path: PathBuf) -> KvStore { let read_map ...
Rust
0
// Enables the scissor test scissor: gfx::Scissor = (), // This makes the BlendMode part of the pipeline, which is fine for the simple case out: gfx::RenderTarget<ColorFormat> = "Target0", } pipeline gui_pipe { vbuf: gfx::VertexBuffer<Vertex> = (), // Simple texture sa...
Rust
0
f.values[j * self.rows + i] } } impl<T: Element> Deref for Conventional<T> { type Target = [T]; #[inline] fn deref(&self) -> &Self::Target { self.values.deref() } } impl<T: Element> DerefMut for Conventional<T> { #[inline] fn deref_mut(&mut self) -> &mut Self::Target { sel...
Rust
0
pair { raw.extend(leaf.id.as_bytes()); // The reason we include the path in the signature is to prevent mangling in the registry, // For example, you may mangle the registry, causing this leaf to be addressed by a different reg_entry // The path of that reg_entry + The data, when used to validate t...
Rust
0
] = self.bytes[offset + 1]; i16::from_le_bytes(raw) } pub fn read_le_u16(&self, offset: usize) -> u16 { let mut raw : [u8;2] = [0;2]; raw[0] = self.bytes[offset]; raw[1] = self.bytes[offset + 1]; u16::from_le_bytes(raw) } pub fn read_le_i32(&self, offset: usize) -> i32 { let mut r...
Rust
0
s_norm(layer, exclude=(_BatchNorm, )) layer = nn.Conv2d(3, 8, 1) assert not is_norm(layer) with pytest.raises(TypeError): layer = nn.BatchNorm1d(3) is_norm(layer, exclude='BN') with pytest.raises(TypeError): layer = nn.BatchNorm1d(3) is_norm(layer, exclude=('BN', )) ...
Python
1
h}' is valid.") return # Check if required API keys are set if args.verbose: print("Checking required API keys...") required_providers = set() for model_string in config.get("models", []): if "~" in model_string: provider = model_string.split("~", 1)[0] ...
Python
1
from langchain_ollama import OllamaLLM, OllamaEmbeddings from langchain.text_splitter import RecursiveCharacterTextSplitter from langchain_community.vectorstores import Chroma from langchain.chains import RetrievalQA from langchain_community.document_loaders import TextLoader # Initialize Ollama models llm = OllamaLLM...
Python
1
# Generated by Django 5.1.4 on 2025-01-03 16:01 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('product', '0021_alter_product_sale_price'), ] operations = [ migrations.AlterField( model_name='product', name='sale...
Python
1
*const u32, overflow: *const atomic::AtomicU32, pub(crate) cqes: *const sys::io_uring_cqe, #[allow(dead_code)] flags: *const atomic::AtomicU32, } impl Default for CompletionQueue { fn default() -> Self { return Self { head: 0 as *const atomic::AtomicU32, tail: 0 ...
Rust
0
) .map_err(|e| wrap_err("EncryptThenAuthenticate", e))?; let plaintext = self .ind_cpa_cipher .decrypt(payload) .map_err(|e| wrap_err("EncryptThenAuthenticate", e))?; Ok(plaintext) } } <gh_stars>1-10 mod nifti; mod trackvis; extern crate getopts; u...
Rust
0
(banks.len() as i32); if size_diff > 0 { // Add the extra banks first let arr = vec![Bank { objects: vec![] }; size_diff as usize]; banks.extend_from_slice(&arr); } banks[(area.1.bank - 1) as usize].objects.push...
Rust
0
_packets: __u64, pub tx_packets: __u64, pub rx_bytes: __u64, pub tx_bytes: __u64, pub rx_errors: __u64, pub tx_errors: __u64, pub rx_dropped: __u64, pub tx_dropped: __u64, pub multicast: __u64, pub collisions: __u64, pub rx_length_errors: __u64, pub rx_over_errors: __u64, pub rx_crc_errors: __u64, pub rx_frame_errors: ...
Rust
0
import numpy as np class DummyModel: def __init__(self, target_values, nb_sig=3): self.target_values = target_values self.nb_sig = nb_sig self.lower, self.upper = self._compute_bounds() def _compute_bounds(self): max_val = max(self.target_values) min_val = min(self.tar...
Python
1
f: None) """Reports if the analytical model has regenerated in a document with reaction loads. Get: ReactionsAreUpToDate(self: Document) -> bool """ Settings=property(lambda self: object(),lambda self,v: None,lambda self: None) """Provides access to general application settings,such as Categories. Get: Set...
Python
1
ui.separator(); ui.horizontal(|ui| { ui.hyperlink_to("Password:", super::password::url_to_file_source_code()) .on_hover_text("See the example code for how to use egui to store UI state"); ui.add(super::password::password(password)); }); ui.separator()...
Rust
0
bits = (self.w.bits & !(0x01 << 9)) | (((value as u32) & 0x01) << 9); self.w } } #[doc = "Reader of field `SCC_PSI_FEATURE_EN`"] pub type SCC_PSI_FEATURE_EN_R = crate::R<bool, bool>; #[doc = "Write proxy for field `SCC_PSI_FEATURE_EN`"] pub struct SCC_PSI_FEATURE_EN_W<'a> { w: &'a mut W, } impl<'a> SCC_...
Rust
0
from data.exercise_dictionaries import exercises target_muscles = {} for exercise in exercises: if exercises[exercise] in target_muscles: target_muscles[exercises[exercise]].append(exercise) else: target_muscles[exercises[exercise]] = [exercise] print(target_muscles)
Python
1
src, session); } let stmtstart = match scopes::find_stmt_start(msrc, m.point) { Some(s) => s, None => { warn!( "[get_type_of_fnarg] start of statement was not found for {:?}", m ); return None; } }; let block = ...
Rust
0
as u16) << 8u32) & (256usize as u16); } #[inline] pub fn alternate_scan(&self) -> ::std::os::raw::c_uint { unsafe { ::std::mem::transmute(((self._bitfield_1 & (512usize as u16)) >> 9u32) as u32) } } #[inline] pub fn set_alternat...
Rust
0
from datetime import datetime from random import randint # Emoji variables to use in your project world = '🌍🌎🌏' python = 'Python 🐍' fire = '🔥' smile = '😊' money = '💰' # Emojis to copy and paste into your code: # 🎊 🙌 🙌🏼 🙌🏽 🙌🏾 🙌🏿 # 😃 🕒 🎨 🎮 🔬 🎉 🕶️ 🎲 😊 # 👩‍🦽 👩🏼‍🦽 👩🏽‍🦽 👩🏾‍🦽 👩🏿‍🦽🧘 �...
Python
1
value to the register"] #[inline] pub fn reset(&self) { self.write(|w| w) } } #[doc = "Possible values of the field `LRSWAP`"] #[derive(Clone, Copy, Debug, PartialEq)] pub enum LRSWAPR { #[doc = "Swap left and right channels (FIFO Read RIGHT_LEFT). value."] EN, #[doc = "No channel swapp...
Rust
0
fn test_ancestor_iterator() { let ledger_path = get_tmp_ledger_path_auto_delete!(); let blockstore = setup_forks(ledger_path.path()); // Test correctness assert!(AncestorIterator::new(0, &blockstore).next().is_none()); assert_eq!( AncestorIterator::new(4, &block...
Rust
0
pub const WTS_SESSION_CREATE: WPARAM = 0xa; pub const WTS_SESSION_TERMINATE: WPARAM = 0xb; pub const MSGF_DIALOGBOX: c_int = 0; pub const MSGF_MESSAGEBOX: c_int = 1; pub const MSGF_MENU: c_int = 2; pub const MSGF_SCROLLBAR: c_int = 5; pub const MSGF_NEXTWINDOW: c_int = 6; pub const MSGF_MAX: c_int = 8; pub const MSGF_...
Rust
0
#!/usr/bin/env python\n # -*- coding: utf-8 -*- import webbrowser import sublime import sublime_plugin from . import mw_utils as utils class MediawikerPreviewSandboxCommand(sublime_plugin.WindowCommand): ''' alias to Preview page command ''' def run(self): self.window.run_command(utils.cmd('page'), ...
Python
1
from android import filtered_csv_generator_android, data_generator_added_python_library, filter_code_android_app if __name__ == '__main__': base_csv_path_android = "data/filtered_android_gh_final.csv" readme_path = "/DATA/nadian/android_gh/data/readme/" code_path = "/DATA/nadian/android_gh/new_code/" a...
Python
1
4_domaincount_40_then_dclm_16b-merge_nl_tp1_pp1_mb4_gb128_gas2" wandb.init(project="Pretrain-Eval-smooth",name=f"{args.run_name}") All_loss = [] id2ckpt = {"1": "iter_0001000", "2": "iter_0002000", "3": "iter_0003000", "4": "iter_0004000", "5": "iter_0005000", "6": "iter_0006000", "7": "iter_0007000",...
Python
1
Option<i16>, role: Roles, event_ids: Vec<Uuid>, connection: &'a PgConnection, } impl<'a> OrgInviteBuilder<'a> { pub fn new(connection: &PgConnection) -> OrgInviteBuilder { OrgInviteBuilder { organization_id: None, invitee_id: None, inviter_id: None, ...
Rust
0
ConstVarTail::InitExpr(init_expr) => Some(init_expr), ConstVarTail::Both(_, init_expr) => Some(init_expr), } } } #[derive(Debug, PartialEq, Eq)] pub struct Module { pub as_monitor: bool, pub declares: Vec<ItemId>, // not handling exports yet //exports: Vec<ExportItem>, ...
Rust
0