text
string
label_name
string
labels
int64
struct Test<T> where T: std::fmt::Display, { a: T, b: bool, } let fortified = fortify! { yield Test { a: 'x', b: true }; }; assert_eq!(fortified.borrow().a, 'x'); assert_eq!(fortified.borrow().b, true); } #[test] fn test_move() { // See https://github.com...
Rust
0
&self.context.zerotier, &self.network.id.clone().unwrap(), ), )?; Ok(()) } pub fn identity(&self) -> String { self.context.identity.clone() } pub fn central(&self) -> Configuration { self.context.central.clone() } pu...
Rust
0
import torch from learning.intrinsic_reward.abstract_intrinsic_reward import AbstractIntrinsicReward import transformations MIN_START_STOP_DIST_PX = 5.0 class VisitationReward(AbstractIntrinsicReward): def __init__(self, world_size_m, world_size_px): super(VisitationReward, self).__init__() self....
Python
1
-regions-one-is-struct-2.rs<gh_stars>1-10 struct Ref<'a, 'b> { a: &'a u32, b: &'b u32 } fn foo(mut x: Ref, y: &u32) { y = x.b; //~^ ERROR lifetime may not live long enough //~| ERROR cannot assign to immutable argument } fn main() { } use std::env; use anyhow::{anyhow, Result}; use dialoguer::{Input, Pas...
Rust
0
fn from_const<T, Downcasting>( ptr: &'a T, can_it_downcast: Downcasting, vtable_for: VTableDT<'borr, T, RRef<'a, ()>, RRef<'a, T>, I, Downcasting>, extra_value: EV, ) -> Self where T: 'borr, { // Must wrap can_it_downcast i...
Rust
0
# call tested function response = self.client.get(url) self.assertEqual(response.status_code, 200) def test_user_search_history_remove(self): history = UserSearchHistory.objects.create( search_query="lolipop", user=self.user ) UserEntryVisitHistory.visit...
Python
1
PartialEq)] pub struct Request { } #[allow(unused_variables)] #[allow(unused_mut)] impl StructDecode for Request { fn get_id() -> u32 { 78 } fn defaults() -> Request { Request { } } fn extract_from_storage(&mut self, mut st...
Rust
0
# Copyright (c) 2025 REDS institute of the HEIG-VD # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: redistributions of source code must retain the above copyright # notice, this list of conditions and the following dis...
Python
1
enses/MIT>) or the Apache License, Version 2.0 (see LICENSE of // <http://www.apache.org/licenses/LICENSE-2.0>), at your option. All // files in the project carrying such notice may not be copied, modified, // or distributed except according to those terms. #![deny(warnings)] #![recursion_limit = "128"] use macro_att...
Rust
0
} }; // Propagate the event to the handler. let res = handle_profile_event(evt, proxy, peers.clone(), controller_pool); run_to_stalled(&mut exec); assert_eq!(Ok(()), res.map_err(|e| format!("{:?}", e))); // At this point, a remote peer was found, but hasn't conn...
Rust
0
import tensorflow as tf def filter2d_v1(image, kernel, normalize_kernel=True, data_format=None): # image: NHWC or NCHW if normalize_kernel: kernel /= tf.reduce_sum(kernel) kernel = kernel[:, :, None, None] if data_format is None or data_format == "NHWC": kernel = tf.tile(kernel, [1, 1,...
Python
1
import subprocess, time from multiprocessing import Process # ===================== CONFIGS ===================== # configuraciones = [ { "nombre": "Quiero Musica", "entrada": "233.2.2.20:10220?ttl=64&localaddr=10.245.241.183", "prog_id": 40, # service_id / program_id ...
Python
1
get.is_ok()); fs::remove_dir("accounts"); fs::remove_dir("envelopes"); fs::remove_file("envelope_budget.conf"); } #[test] fn init_folders_exist() { fs::create_dir("accounts"); fs::create_dir("envelopes"); let budget = Budget::init(); assert!(budget....
Rust
0
# -*- coding: utf-8 -*- # Part of Softhealer Technologies. from odoo import models, fields class TopPOSCustomerReport(models.Model): _name = 'sh.top.pos.customers' _description = 'Top POS Customers' name = fields.Many2one('res.partner', string='Customer') company_id = fields.Many2one('res.company', s...
Python
1
error): html = f""" <!DOCTYPE html> <html lang="tr"> <head> <meta charset="UTF-8"> <title>Hata</title> <style> body {{ font-family: Arial, sans-serif; margin: 50px; }} h1 {{ color: #ff3333; }} </style> </head> <body> <h1>Hata Oluştu...
Python
1
"""This module lets you run widgets as an inline terminal prompt.""" from __future__ import annotations from typing import TypeVar from ..ansi_interface import ( clear, hide_cursor, print_to, report_cursor, restore_cursor, save_cursor, set_echo, show_cursor, unset_echo, ) from ..c...
Python
1
['T', 'EH', 'K', 'N', 'AA', 'L', 'AH', 'JH', 'IY'], 'ELECTRONIC': ['IH', 'L', 'EH', 'K', 'T', 'R', 'AA', 'N', 'IH', 'K'], 'DIGITAL': ['D', 'IH', 'JH', 'IH', 'T', 'AH', 'L'], 'INTERFACE': ['IH', 'N', 'T', 'ER', 'F', 'EY', 'S'], 'INFORMATION': ['IH', 'N', 'F', 'ER', 'M', 'E...
Python
1
t.is_empty() { let (mut left, right) = env.jump_point.pop().unwrap(); // If it a top-level call, return to the next bit of the top-level. Otherwise, return to the next bit of the branch if let Op::Branch(..) = env.get_parent().as_ref().unwrap()[left] { ...
Rust
0
target, &current); expr_count += 1; } Rule::doc_comment | Rule::doc_comment_and_new_line => { panic!("Comments inside expressions not supported yet.") } _ => Self::reformat_generic_token(target, &current), ...
Rust
0
import requests from base64 import b64decode email = "gcamargo221@alumnos.iua.edu.ar" challenge_url = f"https://cripto.iua.edu.ar/md5crypt/{email}/challenge" answer_url = f"https://cripto.iua.edu.ar/md5crypt/{email}/answer" response = requests.get(challenge_url) if response.status_code != 200: exit() try: c...
Python
1
!("cargo:rerun-if-changed=src/args.rs"); let manifest_dir = match env::var_os("CARGO_MANIFEST_DIR") { None => return, Some(outdir) => outdir, }; let out_dir = PathBuf::from(manifest_dir).join("completions"); let mut app = Args::into_app(); let name = app.get_name().to_string(); ...
Rust
0
method returns [ctl::R](ctl::R) reader structure"] impl crate::Readable for CTL {} #[doc = "`write(|w| ..)` method takes [ctl::W](ctl::W) writer structure"] impl crate::Writable for CTL {} #[doc = "CRC Control"] pub mod ctl; #[doc = "Input Data Word\n\nThis register you can [`reset`](crate::generic::Reg::reset), [`wri...
Rust
0
# Copyright Materialize, Inc. and contributors. All rights reserved. # # Use of this software is governed by the Business Source License # included in the LICENSE file at the root of this repository. # # As of the Change Date specified in that file, in accordance with # the Business Source License, use of this software...
Python
1
# ~~BGJobFinishedNotifiy:Consumer~~ from portality.util import url_for from portality.events.consumer import EventConsumer from portality import constants from portality import models from portality.lib import edges from portality.bll import DOAJ from portality.bll import exceptions class BGJobFinishedNotify(EventCo...
Python
1
0 } } pub const VK_FALSE: VkBool32 = VkBool32(0); pub const VK_TRUE: VkBool32 = VkBool32(1); use criterion::{criterion_group, BenchmarkId, Criterion}; use polar_core::*; use polar_core::{kb::Bindings, polar::Polar, terms::*}; use super::runner::{runner_from_query, Runner}; pub fn simple_queries(c: &mut Criterio...
Rust
0
left_padding)).clone(), ); widget_store .get_widget_for_name("RightButtonText") .borrow_mut() .set_config( CONFIG_DISPLAY_TEXT, Config::Text(format!("{}", self.right_padding)).clone(), ); widget_store ...
Rust
0
# # @lc app=leetcode id=102 lang=python3 # # [102] Binary Tree Level Order Traversal # # @lc code=start # Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = right class Solution: def...
Python
1
str(stackTrace[frameIndex]) print(e, errorMessage, file=sys.stderr, flush=True) curr_terminal.add_str_to_terminal(errorMessage) curr_terminal.add_str_to_terminal(CONSTANTS.CODE_FINISHED_MSG_CLUE) board.DISPLAY.show(None) user_code = threading.Thread(args=(sys.argv[1],), target=execut...
Python
1
protobuf::text_format::fmt(self, f) } } impl ::protobuf::reflect::ProtobufValue for CDeviceAuth_GetAuthorizedAsBorrower_Response_Lender { fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { ::protobuf::reflect::ReflectValueRef::Message(self) } } #[derive(PartialEq,Clone,Default)] #[cfg_attr...
Rust
0
entity_cells.iter_mut() { let mut result = match cell.get_status() { EntityResolveStatus::Achieved => cell.get_definitions().unwrap(), _ => { if let EntityResolveStatus::Finished = cell.get_status() { cell.achieve()? ...
Rust
0
on<usize>, }, /// `true` / `false` Bool, /// An algebraic data type Enum { /// The way enum should be serialized tag: Tag, /// All enum's variants variants: Vec<Variant>, }, /// A floating-point number Float, /// An integer number Integer, ...
Rust
0
Result<(), Error> { let mut memory = Memory::new(4096); assert!(memory.store(0x2000, 0xf).is_err()); Ok(()) } } //! Lock-free stack with batched pop. //! //! ## No memory relamation scheme //! //! Usually, lock-free data structures must be used with a memory reclamation scheme like //! ...
Rust
0
, Mutex}; use async_std::task; use futures::future::join_all; use isahc::http::Uri; use std::collections::hash_map::DefaultHasher; use std::convert::TryFrom; use std::hash::Hasher; pub fn install_from_source(url: Uri, flavor: Flavor) -> Result<()> { task::block_on(async { log::debug!("Fetching remote info...
Rust
0
&mut self, x: &FpElemVar<F>, y: &FpElemVar<F>, p: &FpElem<F>, ) -> Result<FpElemVar<F>, PlonkError> { let range_bit_len = self.range_bit_len()?; if x.m != p.m || y.m != p.m { return Err(ParameterError(format!( "field elements splitting parameter...
Rust
0
f str(token) in ignore_tokens: num_ignore_tokens += 1 # save the original tags and a 0/1 mask where the tags are tag_mask = [] original_tags = [] tag_field: SequenceLabelField = instance["tags"] # type: ignore for label in tag_field.labels: if label != "O": tag_mask...
Python
1
# Copyright 2024 The HuggingFace Team. 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 applicabl...
Python
1
github_token = os.getenv('GITHUB_ACCESS_TOKEN') or request.headers.get('X-GitHub-Token') if not github_token: return jsonify({'message': 'Missing GitHub access token'}), 400 github_url = os.getenv('GITHUB_URL') or 'https://github.com' github_url_slug = slugify_url(github_url) # 打印整个payload数据 ...
Python
1
# Copyright 2020 Ram Rachum and collaborators. # This program is distributed under the MIT license. from __future__ import annotations import abc import time import threading import os from typing import (Iterable, Union, Optional, Tuple, Any, Iterator, Type, Sequence, Callable, Hashable, Mapping,...
Python
1
DER: u32 = 2; pub const BGZF_ERR_IO: u32 = 4; pub const BGZF_ERR_MISUSE: u32 = 8; pub const BGZF_ERR_MT: u32 = 16; pub const BGZF_ERR_CRC: u32 = 32; pub const GT_HOM_RR: u32 = 0; pub const GT_HOM_AA: u32 = 1; pub const GT_HET_RA: u32 = 2; pub const GT_HET_AA: u32 = 3; pub const GT_HAPL_R: u32 = 4; pub const GT_HAPL_A: ...
Rust
0
in i..=node.len() { let res = t.query(Some(i), Some(j)); assert_eq!(res, node[i..j].iter().sum::<i32>()); } } } #[test] fn test_whole_query() { let node = [1, 2, -91, 20, 5, 10, 970]; let tree = SegmentTree::new( &node, |a, b| std::cmp::min(a, b), ||...
Rust
0
Pat::Ident(i) => Some(&mut i.id), Pat::Expr(v) => match &mut **v { Expr::Ident(i) => Some(i), _ => None, }, _ => None, }, } } pub(crate) fn is_valid_for_lhs(e: &Expr) -> bool { match e { Expr::Lit(..) => return false, ...
Rust
0
import pytest from unittest.mock import AsyncMock, MagicMock from fastmcp.testing import TestClient from mcp_hub.accuweather.main import mcp # --- Fixtures --- @pytest.fixture def mock_auth(mocker): """Mocks the authentication functions for the AccuWeather MCP.""" mocker.patch('mcp_hub.accuweather.auth.get_ac...
Python
1
.get(0) .unwrap_or(&0.into()) .coerce_to_number(activation)?; let y = args .get(1) .unwrap_or(&0.into()) .coerce_to_number(activation)?; set_coords(&mut this, activation, (x, y))?; } Ok(Value::Undefined) } /// Implements `subt...
Rust
0
{ fn load(&mut self, base_dir: &PathBuf, test_input: String) { let input_file = base_dir.join(test_input); let input = std::fs::read_to_string(input_file).expect("failed to read file"); // prepare input let mut lines = input.lines(); let mut parts = lines.next().unwrap().sp...
Rust
0
. and contributors. All rights reserved. // // Use of this software is governed by the Business Source License // included in the LICENSE file. // // As of the Change Date specified in that file, in accordance with // the Business Source License, use of this software will be governed // by the Apache License, Version 2...
Rust
0
;=>$ptype) }; (None$($(;)?$(::)?<$type:ty>)?) => { $crate::Vector$(::<$type>)?(None) }; (None$($(;)?::$type:ty)?) => { $crate::Vector$(::<$type>)?(None) }; (None$($(;)?:$type:ty)?) => { $crate::Vector$(::<$type>)?(None) }; ($($(;)?:$type:ty)?) => { $crate::Vector$(::<$type>)?(None) }; ($($(;)?$(::)?<$...
Rust
0
[] return stops_lookup, flexible_zone_lookup def get_naptan_stops_from_dynamo( stop_points: list[AnnotatedStopPointRef | TXCStopPoint], stop_point_client: NaptanStopPointDynamoDBClient, ) -> tuple[list[TXCStopPoint], list[str]]: """ Filter the TXC Stop Points for AnnotatedStopPointRef and query t...
Python
1
on_dismiss=self.dialog_close) self.page.overlay.append(dialog) self.page.update() def dialog_close(self, e: ft.ControlEvent): """弹窗关闭事件""" handle_control = e.control if isinstance(e.control, ft.AlertDialog) else e.control.parent if handle_control...
Python
1
import numpy as np import matplotlib.pyplot as plt # Result_1 - with same metric # Result_metric - with new metric # p_i = 1.602179e+33 # 1.0 MeV/fm^3 # p_f = 1.602179e+36 # 1000.0 MeV/fm^3 # step = 1000 file_name = './result_0821/relativistic.dat' # file_name1 = f'Result_20240815/{file_name}' # without metric #file_...
Python
1
import sys import random from enum import Enum from colorist import red class RPS(Enum): ROCK = 1 PAPER = 2 SCISSORS = 3 line01 = "*************************" # header / footer line02 = "* *" # re-use line03 = "* Welcome to RPS *" line04 = "* *" # start...
Python
1
""" This module provides some constants used by WHAD to communicate with the RFStorm firmware. """ from enum import IntEnum # RFStorm Internal states class RFStormInternalStates(IntEnum): """Internal state constants. """ NONE = 0 SNIFFING = 1 PROMIS...
Python
1
PException( status_code=status.HTTP_401_UNAUTHORIZED, detail="User associated with token not found", headers={"WWW-Authenticate": "Bearer"}, ) logger.debug(f"Successfully identified current developer: ID={developer.id}, Name={developer.name}") return developer # ---...
Python
1
""" A module to exploit Foscam Foscam FI9821W/P/HD816W/P camera. 2016-01-22 Python 3 update by https://github.com/markomanninen """ # Python 3 support. Also print -> print().
Python
1
self.sentence_idx += 1 async def on_llm_end(self, *args, **kwargs): first_sentence = self.sentence_idx == 0 if self.current_sentence.strip(): await self.text_to_speech.stream( text=self.current_sentence.strip(), websocket=self.websocket, ...
Python
1
# Copyright (c) LinkedIn Corporation. All rights reserved. Licensed under the BSD-2 Clause license. # See LICENSE in the project root for license information. from ... import db from .schedules import get_schedules from falcon import HTTPNotFound from oncall.bin.scheduler import load_scheduler import operator def on...
Python
1
} } } /// # 11. Container With Most Water /// /// Given n non-negative integers a1, a2, ..., an , where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpoints of line i is at (i, ai) and (i, 0). Find two lines, which together with x-axis forms a container, suc...
Rust
0
iles { type Config = (); type Request = ServiceRequest; type Response = ServiceResponse; type Error = Error; type Service = ResourceFilesService; type InitError = (); type Future = LocalBoxFuture<'static, Result<Self::Service, Self::InitError>>; fn new_service(&self, _: ()) -> Self::Fut...
Rust
0
------------------------------ if with_sata: from litex.build.generic_platform import Subsignal, Pins from litesata.phy import LiteSATAPHY # IOs _sata_io = [ # SFP 2 SATA Adapter / https://shop.trenz-electronic.de/en/TE0424-01-SFP-2-SATA-Adapter ...
Python
1
let result = decode_string(encoded); assert_eq!(result, Err(Error::DecodingFail)); } #[test] fn decode_string_without_time_cost_returns_error_result() { let encoded = "$argon2i$m=4096,p=1\ $c2FsdDEyMzQ=$MTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTI="; let resu...
Rust
0
to rustc println!("cargo:rustc-link-search=native={}", out_dir.display()); println!( "cargo:rustc-link-lib=static=kernel_bin-{}", kernel_file_name ); println!("cargo:rerun-if-env-changed=KERNEL"); println!("cargo:rerun-if-changed={}", kernel.display()); println!("cargo:rerun-if...
Rust
0
M_COST); assert_eq!(0x0fff_ffff, Params::MAX_M_COST); assert_eq!(1, Params::MIN_T_COST); assert_eq!(0xffff_ffff, Params::MAX_T_COST); assert_eq!(1, Params::MIN_P_COST); assert_eq!(0x00ff_ffff, Params::MAX_P_COST); } impl Argon2Params { /// Construct a new [`Argon2Params`], checking for correct integer ranges. /...
Rust
0
.into_iter().filter(|x| *x != index.clone()).collect(); FutureExpiredResource::<T>::insert(end_of_rent, new_resource); } //删除资源 Resources::<T>::remove(&index); Self::deposit_event(Event::RemoveSuccess(who, index)); Ok(()) ...
Rust
0
ontent=ft.Text(error_msg, color="white"), bgcolor="red") ft.SnackBar(ft.Text(f"Counter value at", color="white"), bgcolor="red") e.page.overlay.append(snack) # ✅ الطريقة الجديدة e.page.update() # 🔄 إعادة الزر الأصلي button_state.current.content = ft.ElevatedButton( ...
Python
1
atures = pd.DataFrame(ts_features_list) # Extract features based on functions for univariate signals in batch mode df_single_features = extract_single_series_features_batch(ts_list, batch_size=batch_size, pid=pid) # Create time series feature dataFrame and return df_features = pd.concat([df_single_fea...
Python
1
& 0b00_0010) != 0); self.busy_poll_status = Some((status_reg_poll & 0b00_0001) != 0); // 15th DWORD skipped: multiple I/O. // 16th DWORD let reset = bits!(dwords[15], 6, 8); self.reset_inst_f0 = Some((reset & 0b00_1000) != 0); self.reset_inst_66_99 = Some((reset & 0b01_...
Rust
0
# modules/compositor.py from moviepy import VideoFileClip, concatenate_videoclips, TextClip, CompositeVideoClip def assemble(segments, keylines, output_file, fps=24): clips = [VideoFileClip(seg["path"]).set_start(seg["start"]) for seg in segments] video = concatenate_videoclips(clips, method="compose") # a...
Python
1
import re from urllib.robotparser import RobotFileParser import logging logging.basicConfig(filename="db/backend.log", level=logging.INFO, format="%(asctime)s - %(levelname)s - %(message)s", datefmt="%Y-%m-%d %H:%M:%S" ) #get main page's url def get_main_url(url): """Returns main page's url www.example.com/ A...
Python
1
lf): return self.segments.keys() class SA1BSegmentLoader: def __init__( self, video_mask_path, mask_area_frac_thresh=1.1, video_frame_path=None, uncertain_iou=-1, ): with open(video_mask_path, "r") as f: self.frame_annots = json.load(f) ...
Python
1
} array_317.finish(); } Ok(()) } pub fn serialize_structure_crate_model_windows_audit_log_create_configuration( object: &mut aws_smithy_json::serialize::JsonObjectWriter, input: &crate::model::WindowsAuditLogCreateConfiguration, ) -> Result<(), aws_smithy_http::operation::SerializationError> { ...
Rust
0
from enum import Enum from dataclasses import dataclass class StatTypes(Enum): ATTACK = "attack" DEFENSE = "defense" FOCUS = "focus" MAX_HP = "max_hp" @dataclass class Stats: attack: int defense: int focus: int max_hp: int class Character: def __init__(self, name: str, descript...
Python
1
tags(&[]).expect("should not fail"); info!("Puppet starting"); let mut fs = ServiceFs::new_local(); fs.dir("svc").add_fidl_service(PuppetServices::StdioPuppet); fs.take_and_serve_directory_handle()?; // Although today, only one client is expected, use for_each_concurrent so that // multiple c...
Rust
0
fn java_public() -> JVisibility { JVisibility::Public } fn java_private() -> JVisibility { JVisibility::Private } fn java_protected() -> JVisibility { JVisibility::Protected } identifier = identifier_os spacing identifier_os = .. string_identifier_os > to_ident fn to_ident(span: Span, value: String) -> Id...
Rust
0
toms_permutation( pdb_atoms=ion_pdb_hierarchy.atoms(), xray_structure=ion_model.get_xray_structure()) nonbonded_types = ion_model.restraints_manager.geometry.nonbonded_types nonbonded_charges = ion_model.restraints_manager.geometry.nonbonded_charges ion_atoms = ion_atoms.select(perm) new_model.append_si...
Python
1
self } #[inline] fn as_boxed(&self) -> Box<dyn $crate::Message> { Box::new(self.clone()) } #[inline] fn redo(&self, events_rw: &$crate::MessageBox) { let mut events = events_rw.write().unwrap(); ...
Rust
0
|| read_raw((super::super::CAP_MAX + 1) as _).is_none() { // Either we have CAP_SETPCAP, or there are no unknown capabilities let orig_caps = probe(); clear_unknown().unwrap(); assert_eq!(probe(), orig_caps); clear_unknown().unwrap(); asse...
Rust
0
use wasm_bindgen::JsCast; use web_sys::window; use web_sys::{CanvasRenderingContext2d, HtmlCanvasElement}; use yew::Callback; use yew::ChangeData; use yew::services::DialogService; use yew::services::TimeoutService; use yew::services::timeout::TimeoutTask; use yew::services::{console::ConsoleService, RenderService, Tas...
Rust
0
'yw_t+5': {'locs': 1, 'RMSE': 0.003636741913448436, 'MAE': 0.0013513814743112392, 'MAPE': 0.08463087801733589, 'MSIS': 0.016210731930486864}, 'yw_t+30': {'locs': 1, 'RMSE': 0.011117666951260782, 'MAE': 0.004172394401537884, 'MAPE': 0.22663887681821063, 'MSIS': 0.051045120853219654}, 'ys_t+5': {'locs': 1, 'RMSE': 0.0406...
Python
1
# Copyright 2024 The swirl_jatmos 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 t...
Python
1
.help("path to operations file") .takes_value(true), ) .arg( Arg::with_name("balance") .short("b") .long("balance") .value_name("1") .help("if present program will monitor balance on accounts every x seconds") ...
Rust
0
import csv from datetime import datetime def read_watchlist(filename): """Read watchlist CSV file""" with open(filename, 'r', encoding='utf-8') as f: reader = csv.reader(f) rows = list(reader) return rows def calculate_percentage_change(prices): """Calculate percentage change for each ...
Python
1
= intermediate_output intermediate_output = intermediate_layer_model.predict(x_test) X_test = intermediate_output print X.shape print X_test.shape # img_dimension = 1568 # X = data # X_test = data_test # X = np.reshape(X,(len(X),img_dimension)) # X_test= np.reshape(X_test,(len(X_test),img_dimension)) # # print X.s...
Python
1
# Program to demonstrate Decision Tree Classifier # Importing necessary libraries import numpy as np import matplotlib.pyplot as plt from sklearn.datasets import make_classification from sklearn.model_selection import train_test_split from sklearn.tree import DecisionTreeClassifier from sklearn.metrics import accuracy...
Python
1
is no userinfo portion rest = authority if "@" in authority: userinfo, rest = authority.rsplit("@", 1) # Handle IPv6 host addresses if rest.startswith("["): host, rest = rest.split("]", 1) host += "]" if ":" in rest: extra_host, port = rest.split(":", 1) elif ...
Python
1
, value }); body = tail } if body.is_empty() { Ok(FrameParser { fields }) } else { Err(Error::UnexpectedData) } } /// Read field from frame. /// ``` /// # use yatlv::{FrameParser, FrameBuilder, FrameBuilderLike, Result}; /// # fn m...
Rust
0
# os module import os if os.path.exists(r"C:\Users\Ananya harish\Desktop\demo.txt"): os.remove(r"C:\Users\Ananya harish\Desktop\demo.txt") print("file deleted") else: print("file doesn't exit!")
Python
1
//.define("CMAKE_C_COMPILER", "clang") .define("CMAKE_CXX_COMPILER", compiler) .define("CMAKE_BUILD_TYPE", &target_env.mode) .profile(&target_env.mode) .build(); let lib_dir = locate_output_lib_dir(physx, &target_env.mode); println!("cargo:rustc-link-search=native={}", ...
Rust
0
# Copyright 2025 Canonical Ltd. This software is licensed under the # GNU Affero General Public License version 3 (see the file LICENSE). from typing import Any from pydantic import BaseModel, Field, root_validator from maascommon.enums.notifications import NotificationCategoryEnum from maasservicelayer.builders.no...
Python
1
from setuptools import * libTM = Extension('libTM', sources = ['pyTsetlinMachine/ConvolutionalTsetlinMachine.c', 'pyTsetlinMachine/EmbeddingTsetlinMachine.c', 'pyTsetlinMachine/MultiClassConvolutionalTsetlinMachine.c', 'pyTsetlinMachine/Tools.c', 'pyTsetlinMachine/IndexedTsetlinMachine.c'], ...
Python
1
import re from core.config import xsschecker from core.utils import stripper def jsContexter(script): broken = script.split(xsschecker) pre = broken[0] # remove everything that is between {..}, "..." or '...' pre = re.sub(r'(?s)\{.*?\}|\(.*?\)|".*?"|\'.*?\'', '', pre) breaker = '' num = 0 ...
Python
1
against # img_first = cv2.imread(os.path.join(data_path, image_list[0]), 0) # Get the starting pose T_wc_0 = get_pose_aprilgrid(os.path.join(data_path, image_list[0]), intrinsics, distortion, intrinsics_mtx) print(T_wc_0) T_0_I = np.array([[ 0.00336815, 0.99998156, -0.00505389, 0.41275847], [ 0.00131466...
Python
1
from pathlib import Path import re import fileinput links = {} def clean_up_key(key): new_key = key.replace("(", "").replace(")", "").replace(".", "_") if key[-1] == "_": new_key = new_key[0:-1] return new_key # Scan all of the files in the content_build folder to find any registered links # If found, each...
Python
1
.contains(expected_output); assert!( contains_output, "Output: `{}` does not contain expected output: `{}`", output, expected_output ); } // This file is part of ucx. It is subject to the license terms in the COPYRIGHT file found in the top-level directory of this distribution and at ht...
Rust
0
_body(handle_a); constraints.add_hinge_constraint( bodies, handle_a, handle_b, body_a.position, body_a.orientation.inverse() * Vec3::X, ); } #[allow(dead_code)] fn add_constant_velocity_constraint(bodies: &mut BodyArena, constraints: &mut ConstraintArena) { let cube_...
Rust
0
("source_node"))?; let to = Vec::load_from(path.join("target_node"))?; let mut num_queries = 0; for (from, to) in from.into_iter().zip(to.into_iter()).take(1000) { let _tdcch_query_ctxt = algo_runs_ctxt.push_collection_item(); report!("from", from); ...
Rust
0
import random as rn import time def game(l): a = rn.randint(1,l) for i in range(1,7): if i == 6: print(' ') print('This is your last chance \n do you want Hints ') h = int(input('1.Yes / 2.No : ')) if h == 1: if a % 2 == 0: print('The no. is closes to....',a-1) else: print('The n...
Python
1
i/Mistral-7B-Instruct-v0.2", device_map="auto", torch_dtype=torch.float16) else: self.tokenizer = AutoTokenizer.from_pretrained("mistralai/Mistral-7B-Instruct-v0.2", device_map="auto") self.model = AutoModelForCausalLM.from_pretrained("mistralai/Mistral-7B-Instruct-v0.2", device_map="aut...
Python
1
find("BatchNorm") != -1: nn.init.constant_(m.weight.data, 1.0) nn.init.constant_(m.bias.data, 0.0) elif classname.find("InstanceNorm") != -1: if m.weight is not None and m.bias is not None: nn.init.constant_(m.weight.data, 1.0) nn.init.constan...
Python
1
r_equal_works_() { assert!(init(CurveType::BLS12_381)); fr_equal_works::<Fr>(); } #[test] pub fn fr_negate_works_() { assert!(init(CurveType::BLS12_381)); fr_negate_works::<Fr>(); } #[test] pub fn fr_pow_works_() { assert!(init(CurveType::BLS12_381)); ...
Rust
0
cells, bombs_vec, players_vec, walls_vec, occupy_check, explosions_vec, } } pub fn render(&self) -> String { self.to_string() } } <reponame>tatsuya6502/shellmag-2020-02 use chrono::prelude::*; use clap::{App, Arg}; use ...
Rust
0
fmt(&self, f: &mut Formatter) -> fmt::Result { f.debug_set() .entries(self.0.iter().map(|entry| entry.key().clone())) .finish() } } #[cfg(test)] mod tests { use serde_json::json; use super::*; #[tokio::test(flavor = "current_thread")] async fn executes_server_requ...
Rust
0