text
string
label_name
string
labels
int64
_no: usize, ) -> Result<(usize, usize), crate::ApiError> { let py_lines = self.content().python_source.lines(); let line_count = py_lines.count(); // Check that the file has at least this many lines if line_no > line_count { return Err(crate::error::TraceError::LineParam...
Rust
0
car = "subaru" print("Is car == 'subaru'? I predict True.") print(car == 'subaru') print("\nIs car == 'audi'? I predict False.") print(car == 'audi') #1 car = 'toyota' print('Is car == "toyota"? I predict True.') print(car == 'toyota') #2 car = 'toyota' print('Is car == "toyota"? I predict True.') print(car == ...
Python
1
import hashlib from django.http import JsonResponse, HttpResponseRedirect from django.views.decorators.csrf import csrf_exempt # Dummy data for demonstration purposes users = { "908484157": { "sub_status": "trial", "first_name": "Haitham", "is_subscribed": False } } link_mapping = {} ...
Python
1
from moviepy import VideoFileClip import os cvt_video = VideoFileClip("input.mp4") ext_audio = cvt_video.audio save_path = os.path.join(os.path.expanduser('~'), 'Downloads', "output.mp3") ext_audio.write_audiofile(os.path.join(save_path)) ext_audio.close() cvt_video.close()
Python
1
wFileVersionMS), HIWORD(self.dwFileVersionLS), LOWORD(self.dwFileVersionLS)] } /// Sets the `dwFileVersionMS` and `dwFileVersionLS` fields. pub fn set_dwFileVersion(&mut self, val: [u16; 4]) { self.dwFileVersionMS = MAKEDWORD(val[1], val[0]); self.dwFileVersionLS = MAKEDWORD(val[3], val[2]); } /...
Rust
0
""" NCL User Guide Python Example: PyNGL_xy_plot_simple.py - marker - different line colors - legend - title - x-labels - y-labels 09.10.15 kmf """ import numpy as np import Ngl, Nio #-- create x-values x2 = np.arange(100) #-- create y-values data = np.arange(1,40,5) linear = ...
Python
1
if op.as_str() == "file" { match exprs.len() { 1 => { let file_name = get_str(exprs.get(0).unwrap()); file_list.insert(0, file_name) } 2 => { let offset = get_n...
Rust
0
imestamp { if self.start_time.is_none() { self.start_time.set_default(); } self.start_time.as_mut().unwrap() } // Take field pub fn take_start_time(&mut self) -> ::protobuf::well_known_types::Timestamp { self.start_time.take().unwrap_or_else(|| ::protobuf::well_k...
Rust
0
pub const DBPOINTER: u8 = 0x0C; pub const JAVASCRIPT_CODE: u8 = 0x0D; pub const SYMBOL: u8 = 0x0E; pub const JAVASCRIPT_CODE_WITH_SCOPE: u8 = 0x0F; pub const INT_32BIT: u8 = 0x10; pub const TIMESTAMP: u8 = 0x11; pub const INT_64BIT: u8 ...
Rust
0
from abc import ABC, abstractmethod # Step 1: Define the Component Interface class Component(ABC): """The Component interface sets the common method for all components""" @abstractmethod def operation(self): """The operation method needs to be implemented by Leaf and Composite classes""" ...
Python
1
_export_xlsx_purchase(self): # Test onchange date range self.assertEqual( self.tax_purchase_report_wizard.date_from, self.date_range.date_start ) self.assertEqual( self.tax_purchase_report_wizard.date_to, self.date_range.date_end ) with Form(self.t...
Python
1
mage and constant c, apply log transformation to the image /// on domain [0, 255] and return the resulting image. /// /// ## Parameters /// * input: input bgr or grayscale image. /// * output: resulting image of log transformations. pub fn log_transform(input: core::Mat, output: &mut core::Mat) -> Result<()> { unsafe...
Rust
0
from django.urls import path from django.urls import re_path from .views import ( DownloadAnalyticsAsCsv, JobOfferAdminView, JobOfferAnalyticsView, JobOfferApproveView, JobOfferCreateView, JobOfferDeactivateView, JobOfferDetailView, JobOfferHistoryView, JobOfferListView, JobOfferUpdateView, JobOfferRejectVi...
Python
1
import json from dbclient import * class LibraryClient(dbclient): def get_cluster_list(self, alive=True): """ Returns an array of json objects for the running clusters. Grab the cluster_name or cluster_id """ cl = self.get("/clusters/list", print_json=False) if alive: running ...
Python
1
, { self.at(index)?.as_val() } pub fn list_at<T>(&self, index: usize) -> Result<Vec<T>, DecoderError> where T: Decodable, { self.at(index)?.as_list() } pub fn decoder(&self) -> BasicDecoder { BasicDecoder::new(self.bytes) } /// consumes first found prefix fn consume_list_payload(&self) -> Result<(&...
Rust
0
t['adc'] = (buf[L+1] << 8) | buf[L] L += 2 if (ctl & 0x0800) != 0: result['GPIO1'] = { 'M': (buf[L] >> 4) & 0x0f, 'N': buf[L] & 0x0f } L += 1 return result return None device =...
Python
1
: proc.f.b, i: proc.g }; proc.f = proc.f.d; } } } function _Process_sleep(time) { return _Scheduler_binding(function(callback) { var id = setTimeout(function() { callback(_Scheduler_succeed(_Utils_Tuple0)); }, time); return function() { clearTimeout(id); }; }); } // PROGRAMS var _Platf...
Rust
0
n.objects.filter(access_token__expires__lt=expiry_threshold).exclude( application_id__in=excluded_application_ids) self.clear_table_data(query_set, batch_size, RefreshToken, sleep_time) if options['revoked-tokens']: logger.info("Removing revoked RefreshTokens") ...
Python
1
//! Often it is useful to record the SARIF file for machine processing but also //! print the nicely formatted results to stdout at the same time. This can be done //! using the `tee` command: //! //! ```shell //! $ clang-tidy -checks=cert-* cpp.cpp -- | clang-tidy-sarif | tee clang-tidy.sarif | sarif-fmt //! $ 2 warni...
Rust
0
gisterError { /// No username was provided. EmptyDisplayName, /// Another user with the provided email already exists. TakenEmail, /// Another user with the provided firebase-id already exis.ts TakenId, /// Another user with the provided username already exists. TakenUsername, //...
Rust
0
.len() as u16; } let name_cell = Cell::from(name) .style(*cur_style); let value_txt = wave_slice.formatted_value(row_i, state.cur_wave_col) .unwrap_or("⁇".to_string()); if value_txt.len() as u16 > max_value_width { max_value_width = value_txt.len() as...
Rust
0
, SwitchbotModel.RELAY_SWITCH_1PM, SwitchbotModel.LOCK, SwitchbotModel.LOCK_PRO, SwitchbotModel.LOCK_LITE, SwitchbotModel.LOCK_ULTRA, SwitchbotModel.AIR_PURIFIER, SwitchbotModel.AIR_PURIFIER_TABLE, SwitchbotModel.EVAPORATIVE_HUMIDIFIER, SwitchbotModel.FLOOR_LAMP, SwitchbotModel.S...
Python
1
g<4>, gp64-vreg<5>, gp64-vreg<6>, gp64-vreg<8> Avail regs: gp64-vreg<10>, gp64-vreg<11>, gp64-vreg<12>, gp64-vreg<13>, gp64-vreg<14>, gp64-vreg<15>, gp64-vreg<1>, gp64-vreg<2>, gp64-vreg<3>, gp64-vreg<4>, gp64-vreg<5>, gp64-vreg<6>, gp64-vreg<7>, gp64-vreg<8>, gp64-vreg<9> per_edge_loop.end: SUB gp64-vreg<4>, 1 ...
Python
1
shutil.copy(source, bdir) generated_sources = [ Path(f"{mname}module.c"), Path(f"{mname}-f2pywrappers2.f90"), Path(f"{mname}-f2pywrappers.f"), ] bdir = Path(bdir) for generated_source in generated_sources: if generated_source.exists(): shutil.copy(generated_...
Python
1
chain,result = self.method_converter( backbone_model=backbone_model, openai_key=args.openai_key, method=method, env=env, process_id=process_id, single_chain_max_step=12, max_query_count=200, callbacks=callbacks ) ...
Python
1
#[cfg(feature = "alloc")] fn many0_test() { fn multi(i: &[u8]) -> IResult<&[u8], Vec<&[u8]>> { many0(tag("abcd"))(i) } fn multi_empty(i: &[u8]) -> IResult<&[u8], Vec<&[u8]>> { many0(tag(""))(i) } assert_eq!(multi(&b"abcdef"[..]), Ok((&b"ef"[..], vec![&b"abcd"[..]]))); assert_eq!( multi(&b"abcda...
Rust
0
seed(rng.gen())).unwrap(); let (mut state, nbins, _, _) = self.bucketize_data(table, payloads, channel, rng)?; channel.flush()?; self.send_data(&mut state, nbins, channel, rng)?; channel.flush()?; let (aggregate, sum_weights) = state.build_and_compute_circuit(&mut gb).unwrap()...
Rust
0
from __future__ import annotations from typing import Literal, TypedDict class ServerExistence(TypedDict): exist: bool openTime: int closeTime: int class Existence(TypedDict): CN: ServerExistence JP: ServerExistence KR: ServerExistence US: ServerExistence class Item(TypedDict): alia...
Python
1
mod ifunctions; pub mod attributes; pub mod answer_validators; <reponame>msaaltink/saw-script<gh_stars>100-1000 extern crate crucible; use crucible::*; use crucible::method_spec::{MethodSpec, MethodSpecBuilder, clobber_globals}; fn f(x: &mut [u8; 2]) { x.swap(0, 1); } #[crux_test] fn f_test() { clobber_globa...
Rust
0
pl DirentBuf { pub fn with_size(length: usize) -> Self { libc::c_uint::try_from(length).expect("Buffer size invalid for `getdent` syscall."); DirentBuf { inner: vec![0; length].into(), start: 0, last: 0, } } pub fn iter(&self) -> Entries<'_> { ...
Rust
0
is_required = b; } None => { break 'field_loop; } } // if let IsRequired::NA = is_required { field_cnt = field_index + 1; } } Subject::Type => { variant = Field::variant_from_datatype(dt)?; ignore_optio...
Rust
0
))); // Invalid yuv_format _RS_ASSERT(!rsIsObject(rsCreateType(I32_3, 3, 4, 5, false, false, 1024))); // yuv_format with 1D or 3D is invalid _RS_ASSERT(!rsIsObject(rsCreateType(I32_3, 3, 0, 0, false, false, RS_YUV_YV12))); _RS_ASSERT(!rsIsObject(rsCreateType(I32_3, 3, 4, 5, fals...
Rust
0
import os BASE_PATH = os.path.realpath(os.path.join(__file__, "..", "..")) def relative(*parts): return os.path.join(BASE_PATH, *parts)
Python
1
l(p.1)); rec(&x_sort, &y_sort) } /// Is line a-b and line c-d intersected ? #[snippet("is_intersected")] pub fn is_intersected(a: Vector2D, b: Vector2D, c: Vector2D, d: Vector2D) -> bool { let ta = (c.0 - d.0) * (a.1 - c.1) + (c.1 - d.1) * (c.0 - a.0); let tb = (c.0 - d.0) * (b.1 - c.1) + (c.1 - d.1) * (c....
Rust
0
CompressionCodec::Uncompressed, Encoding::Plain, ) } #[test] fn test_list_bool_optional_v1() -> Result<()> { round_trip( 4, true, true, Version::V1, CompressionCodec::Uncompressed, Encoding::Plain, ...
Rust
0
from google.cloud import vision from google.oauth2 import service_account # Path to your service account JSON key file key_path = "cred.json" # Load credentials from the service account file credentials = service_account.Credentials.from_service_account_file(key_path) # Initialize the Vision API client with the cred...
Python
1
e_arg(x: u32) { let _ = x; } pub fn fun_one_arg_with_ret(x: u32) -> u32 { x + 1 } pub fn fun_generic<T>(x: T) -> T { x } pub fn fun_generic_where<T>(x: T) -> T where T: Sized, { x } // constant function pub const fn fun_constant(x: u32) -> u32 { x + 1 } // variadic extern "C" { pub fn r...
Rust
0
_row = new_inner_row; } tile[inner_row][inner_col] }).collect() }).collect(); let sea_monster = [ " #", "# ## ## ###", " # # # # # #", ]; let sea_monster_height = sea_monster.len(); let sea_monster_width = sea_...
Rust
0
Level::INFO, // env!("CARGO_PKG_NAME"), // "otel.kind" = "server" // ) // }) .trace_fn(|_header_map| { tracing::span!(Level::INFO, env!("CARGO_PKG_NAME"), "otel.kind" = "server") }) .add_serv...
Rust
0
T = int(input()) for test_case in range(1, T + 1): n, m = map(int, input().split()) A = list(map(int, input().split())) B = list(map(int, input().split())) if n > m: A, B = B, A max_total = 0 for j in range(len(B)-len(A)+1): total = 0 for i in range(len(A)): ...
Python
1
"share" => command.share(), "container" => command.container(), _ => Err(UnknownSubcommand(command_name.to_owned()).into()), } } } #[cfg(test)] mod tests { use super::*; use backends::DummyDefaultBackend; #[test] fn dummy_default_backend() { cons...
Rust
0
import logging import os import argparse from pathlib import Path from transopt.ResultAnalysis.AnalysisPipeline import analysis_pipeline def run_analysis(Exper_folder:Path, tasks, methods, seeds, args): logger = logging.getLogger(__name__) analysis_pipeline(Exper_folder, tasks=tasks, methods=methods, seeds=s...
Python
1
::Deserializer<'de>, { let str = String::deserialize(deserializer)?; channel_mode_from_str(str).map_err(serde::de::Error::custom) } fn deserialize_initiator_delay<'de, D>(deserializer: D) -> Result<zx::Duration, D::Error> where D: serde::Deserializer<'de>, { let num = u32::deserialize(deserializer)?; ...
Rust
0
stringify ! ( ulTimeLow ) )); assert_eq! (unsafe { & ( * ( 0 as * const tdTSS_UUID ) ) . usTimeMid as * const _ as usize } , 4usize , concat ! ( "Alignment of field: " , stringify ! ( tdTSS_UUID ) , "::" , stringify ! ( usTimeMid ) )); ...
Rust
0
ations:", e) with open(self.jsonName+".json", 'w') as f: json.dump(vulnerabilitiesData, f, indent=4) self.clearJson() def clearJson(self): try: os.remove(self.tempJson) print(f"File '{self.tempJson}' deleted successfully.") except File...
Python
1
# -*- coding: utf-8 -*- # # co_co_convolve_cond_correctly_built.py # # This file is part of NEST. # # Copyright (C) 2004 The NEST Initiative # # NEST 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, either vers...
Python
1
isPublic: false, /// tags: String::from(""), /// pasties: pasties, /// }; /// let paste = paste::create_paste_async(data).await?; /// println!("{:?}", paste._id); /// Ok(()) /// } /// ``` pub async fn create_paste_async(contents: CreateObject) -> Result<PasteObject, reqwest::Error> { ...
Rust
0
scipy.constants import find, physical_constants Which keys in the ``physical_constants`` dictionary contain 'boltzmann'? >>> find('boltzmann') ['Boltzmann constant', 'Boltzmann constant in Hz/K', 'Boltzmann constant in eV/K', 'Boltzmann constant in inverse meter per kelvin', 'Stefan-Bo...
Python
1
one + Debug + Eq, { fn from_bitstring( chip: SinsemillaChip, mut layouter: impl Layouter<C::Base>, bitstring: Vec<Option<bool>>, ) -> Result<Self, Error> { // Message must be composed of `K`-bit words. assert_eq!(bitstring.len() % K, 0); // Message must have at m...
Rust
0
######## BACKTESTING with backtrader 2024 from datetime import datetime import backtrader as bt import backtrader.analyzers as btanalyzers # THIS IS WHERE WE DEFINE OUR STRATEGY class SmaCross(bt.SignalStrategy): def __init__(self): # when simple moving average crosses the price, can change the number...
Python
1
while True: cato = float(input('Digite o cateto oposto: ')) cata = float(input('Digite o cateto adjacente: ')) calc = (cato**2 + cata**2) hipo = calc**(1/2) print(f'A hipotenusa é {hipo:.2f}')
Python
1
nel_input_feature_dimension = rhs_spec.index('I') dimension_numbers.kernel_spatial_dimensions.extend( i for i, c in enumerate(rhs_spec) if c not in {'I', 'O'} ) dimension_numbers.input_spatial_dimensions.extend( sorted( (i for i, c in enumerate(lhs_spec) if c not in {'N', 'C'}),...
Python
1
i in xrange(newLen): if i in newVals: yield newVals[i] else: yield self._get_single_internal(i) self._rebuild(newLen, newItems()) def _assign_extended_slice(self, start, stop, step, valueList): 'Assign an extended slice by re-...
Python
1
import os import json import os.path from datetime import datetime DATA_PATH = os.path.join(os.getenv("HOME"), ".searchor-history.json") tmp = {"searches": []} def update(engine, query, url): search_data = { "url": url, "engine": engine, "query": query, "time": str(datetime.today(...
Python
1
# Form implementation generated from reading ui file 'message_dialog.ui' # # Created by: PyQt6 UI code generator 6.4.2 # # WARNING: Any manual changes made to this file will be lost when pyuic6 is # run again. Do not edit this file unless you know what you are doing. from PyQt6 import QtCore, QtGui, QtWidgets clas...
Python
1
FieldReader<u16, u16>; #[inline(always)] fn deref(&self) -> &Self::Target { &self.0 } } #[doc = "Field `CS_HOLD_TIME` writer - delay cycles of cs pin by spi clock this bits are combined with SPI_CS_HOLD bit. Can be configured in CONF state."] pub struct CS_HOLD_TIME_W<'a> { w: &'a mut W, } impl<...
Rust
0
from django.urls import path from django.shortcuts import redirect from . import views urlpatterns = [ path('pets/', views.pet_list, name='pet_list'), path('pets/<int:pk>/', views.pet_detail, name='pet_detail'), path('pets/new/', views.pet_create, name='pet_create'), path('pets/<int:pk>/edit/', views.p...
Python
1
/ Wheels on curve. might want to expand this into side/back/top/bottom/corner/etc curves CurveWall, /// Wheels not touching arena Air, */ } pub fn find_prediction_category(_current: &PlayerState) -> PredictionCategory { // hard-coded the only thing we can handle right now PredictionCategory::Gr...
Rust
0
raise Exception("invalid RawSocket URL: non-empty fragment '{}'".format(parsed.fragment)) if parsed.hostname == "unix": # Unix domain sockets sockets # rs://unix:/tmp/file.sock => unix:/tmp/file.sock => /tmp/file.sock fp = parsed.netloc + parsed.path uds_path = fp.split(':')[1] ...
Python
1
`")] InvalidConfig(String), #[error("Unknown client")] UnknownClient, #[error("Solver error: `{0}`")] SolverOther(String), #[error("Job:`{0}` is not stalling")] JobNotStalling(Pid), #[error("Database error: `{0}`")] Database(String), } <filename>src/config.rs<gh_stars>0 #[derive(Clon...
Rust
0
stant.lossy, expected) def AssertInEquality(self, X): order_seq = order(X) modes = [ mode_constant.lossy, mode_constant.normal, mode_constant.redundant, mode_constant.cycle, ] for b in [binding_constant.start, binding_constant.end]: ...
Python
1
o ig[@s ddZdS)cCsHddlm}ddlm}t||d}|durtd|||d|S)N) einsumfunc)_raise_warningz0module 'numpy.core.einsumfunc' has no attribute r) numpy._corer_utilsrgetattrAttributeError) attr_namerr...
Python
1
# Copyright (C) 2016-2021 Alibaba Group Holding 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 l...
Python
1
, Aead, NewAead, Payload}, consts::{U13, U8}, Ccm, }; use coap_lite::{CoapOption, MessageClass, Packet, RequestType, ResponseType}; use core::convert::TryFrom; use super::{ error::Error, util::{self, ProxyUri}, Result, }; /// The common context part of the security context. struct CommonContext { ...
Rust
0
( "design \n", fmt( lmfit.design[-4:,:], max=None ) ) if self.doplot : xx = numpy.linspace( -1, +1, 1001 ) plt.plot( x, y, 'k+' ) plt.plot( xx, modl1.result( xx ), 'k-' ) plt.plot( xx, modl2.result( xx ), 'r-' ) plt.show() def test6( self ) : ...
Python
1
browse_time = task.get('browseTime') if task_type == 1: self.g_applet_todo_task_by_browse_page(task_name, task_id, activity_id, task_type) time.sleep(browse_time + 1) self.g_applet_receive_reward(task_name, task_id, activity_id) else: ...
Python
1
ab#propertiesattributes) #[derive(Debug, Properties, Clone)] pub struct FabProps { #[prop_or_default] pub icon: Cow<'static, str>, #[prop_or_default] pub label: Cow<'static, str>, #[prop_or_default] pub mini: bool, #[prop_or_default] pub reduced_touch_target: bool, #[prop_or_default]...
Rust
0
rize(("window_size"), [(50, 10), (-1, 5), (5, -1), (-1, -1), (10, 50), (50, 50)]) def test_invalid_window_size(window_size): """ Check for various invalid window_size sizes (note: assumes small dataset is used) """ da_fcst = sd.continuous_forecast(large_size=False, lead_days=True) da_obs = sd.contin...
Python
1
.map(|_| ()) } } #[cfg(test)] mod test { use std::vec; use probe_rs::flashing::Format; use super::{ Channel, ChannelKind, Config, Configs, Flashing, Gdb, General, ItmMode, LinkKind, Logging, Probe, Reset, }; #[test] fn default_config() { // Ensure the default conf...
Rust
0
import time import mpos.config from mpos.timezones import TIMEZONE_MAP import localPTZtime timezone_preference = None def epoch_seconds(): import sys if sys.platform == "esp32": # on esp32, it needs this correction: return time.time() + 946684800 else: return round(time.time()) d...
Python
1
f64, f64) { match n / 6 { 0 => { let offset = f64::from(n) * 2.0; (offset, offset + 2.0) } 1 => { let offset = 12. + f64::from(n - 6) * 1.0; (offset, offset + 1.0) } _ => { let offset = 18. + f64::from(n - 12) * 0.5;...
Rust
0
import copy import numpy as np def compare_rl_vs_round_robin(agent, env, num_episodes=20, max_steps=200): rl_rewards = [] rr_rewards = [] node_count = env.action_space.n for ep in range(num_episodes): # Reset environment and add nodes env.reset() env.add_nodes_to_cluster() ...
Python
1
s is a comment").unwrap(), vec!()); } #[test] fn multiple_comment_test() { assert_eq!(tokenize("; this is a comment\n; this is another comment").unwrap(), vec!()); } #[test] fn identifier_and_comment_test() { assert_eq!(tokenize("test; this is a comment").unwrap(), vec!( Token::Ident("test".to_string...
Rust
0
This is currently the 'ata5791'**. #[cfg(all(target_arch = "avr", avr_mcu_ata5791))] pub mod current { pub use super::ata5791::*; } /// The module containing the values for the 'ata5702m322' microcontroller #[cfg(any(avr_mcu_ata5702m322, feature = "all-mcus"))] pub mod ata5702m322; /// Contains definitions for the cur...
Rust
0
URv URbURv URbURv gg7f)NrrKr|)r1s rr Decl.__iter__D 99 ))O 99 ))O << #,,  $AAr5rxryrzr{ ryr|rYr{rKr5rxrz...
Python
1
, gval.SUCCESSOR_LIST_NORMAL_LEN - 1): if idx < list_len: self.existing_node.node_info.successor_info_list.append( succ_list_of_succ[idx].get_partial_deepcopy()) # successorから自身が担当することになるID範囲のデータの委譲を受け、格納する # TODO: delegat...
Rust
0
fn default_ctx() -> ParseContext { ParseContext::new(Arc::new(BTreeMap::new())) } #[test_case("|漢字$かんじ$"=> Ok((token::test_helper::new_test_result_span(18, 1, ""), ParsedToken::Annotation{ body: token::test_helper::new_test_result_span(1, 1, "漢字"), description: iterator::TextIterato...
Rust
0
({:?} zatoshis)", amount) } Error::InvalidAmount => write!(f, "Invalid amount"), Error::NoChangeAddress => write!(f, "No change address specified or discoverable"), Error::TransparentBuild(err) => err.fmt(f), Error::SaplingBuild(err) => err.fmt(f), ...
Rust
0
_ => syslog_debug!("parse_int: unknown: {:02X}", b), } } return 0; } pub fn parse_package(bytes: &[u8], i: &mut usize) { let end = *i + parse_length(bytes, i); let elements = parse_num::<u8>(bytes, i); syslog_debug!(" Package ({})", elements); syslog_debug!(" {{"); ...
Rust
0
e circuit: add zero gates to reach the domain size. let d1_size = domain.d1.size(); let mut padding = (gates.len()..d1_size) .map(|i| { CircuitGate::<F>::zero(array_init(|j| Wire { col: WIRES[j], row: i, })) ...
Rust
0
[ { "dsl": "1 SHAS contain 1 SmartHome", "score": 0.5, "counterpart": "1 SHAS contain * SmartHome", }, { "dsl": "1 SmartHome contain 1..* Room", "score": 0.5, "counterpart": "1 SmartHome contain * Room", }, {"dsl": "1 SHAS contain 1 ActivityLog", "...
Python
1
ent>, } fn main() { let v = Arc::new(5); let b = { let mut f = Foo { foo: Arc::clone(&v), bar: Arc::clone(&v), }; f.bar = f.foo.clone(); println!("Foo {} {}", f.foo, f.bar); Bar { foo: Arc::downgrade(&v), bar: Arc::downgrade(&v) } }; println!("Bar {} {}", b.foo.upgrade().unwrap(), b.bar.upgra...
Rust
0
:ImplItemMethod, ) -> Result<syn::ImplItemMethod, Vec<syn::Error>> { let mut errors = Vec::new(); for attr in &impl_method.attrs { if let Some(attr_name) = attr.path.segments.last() { if attr_name.ident == "no_mangle" { errors.push(syn::Error::new_spanned( ...
Rust
0
::<NativeEndian>()?; ensure!( actual_crc == expect_crc, "read_manifest failed. path={} expect_crc={} actual_crc={}", path, expect_crc, actual_crc ); cursor.seek(SeekFrom::Start(0))?; let ver = cursor.read_u32::<NativeEndian>()?; ensure!( ver == MANIFE...
Rust
0
"Expressions of type `{}` cannot be applied to {} argument{}.", func_type, num_args, plural(*num_args) ), Self::BadRecordProj { record_type, field } => write!( f, "Expression of type `{}` do not contain a field named...
Rust
0
) != minor_clean(source) and minor_clean(target) != minor_clean( neg_target) and minor_clean(neg_source) != minor_clean(neg_target): random_negative_examples.append([minor_clean(source), minor_clean(neg_target)]) break except Ex...
Python
1
/// stringly-typed keys, **it is recommended to implement the much simpler /// [`StrKeyMap`] convenience trait instead**. /// /// [Refer to the module documentation for examples.][crate::de] pub trait Map { fn val_with_key( &mut self, with_key: &mut dyn FnMut(Result<&mut dyn Visitor>) -> Result<()>,...
Rust
0
""" 测试 BacktestCodeChecker 类的功能 本测试文件测试了 BacktestCodeChecker 的 complete_check 方法以及相关的子检查方法。 测试覆盖了以下方面: 1. 语法错误检查 2. 危险代码检查(如 os.system, eval 等) 3. 非法导入检查(根据 backtest_code_rules 的白名单) 4. 必要函数检查(initialize, handle_data) 5. 关键对象使用检查(context, order 对象) 6. 关键方法参数检查(order_shares 等回测 API) 7. 日志方法检查(禁用 print,推荐 SRLogger) ""...
Python
1
t. //! //! ## Safety and Lifetimes //! //! I'm aiming to make as much of the API safe as is possible, but unfortunately //! not 100% of the interface can be safe. Things are only as safe as they can //! get, I don't want to ever over promise. //! //! Much of the static safety is done with lifetime tracking, which can m...
Rust
0
oduct.find('img') if image_tag and 'src' in image_tag.attrs: image_url = "https://www.dzrt.com" + image_tag['src'] else: image_url = "https://assets.dzrt.com/media/wysiwyg/Home-New/dzrt-hand-product-can-ar.png" product_statuses[name] = {'available': i...
Python
1
ister.Iff.LeftElimination` function. fn __theorem_register_iff_left_elimination( theorem_handle: RawHandle, result: *mut RawHandle, ) -> i32; /// Raw ABI binding to the `Theorem.Register.Forall.Introduction` function. fn __theorem_register_forall_introduction( theorem_handle: Raw...
Rust
0
i/wrapper.h") .clang_arg(inc_arg.as_str()) .generate() .expect("Unable to generate bindings"); bindings .write_to_file(out_path.join("bindings.rs")) .expect("Couldn't write bindings!"); } fn macos(mut renew: bool) { let out_path = PathBuf::from(env::var("OUT_DIR").unwra...
Rust
0
operations. # MPIIO_F_*_RANK_TIME: fastest and slowest I/O time for a single rank (for shared files). # MPIIO_F_VARIANCE_RANK_*: variance of total I/O time and bytes moved for all ranks (for shared files). # WARNING: MPIIO module log format version <=2 does not support the following counters: # - MPIIO_F_CLOSE_STA...
Python
1
starting the monitoring monitoring_config = worker.get('monitor', None) yield self._controller.call('crossbar.worker.{}.start_monitoring'.format(worker_id), monitoring_config, options=CallOptions()) @inlineCallbacks def _configure_native_worker_xbrmm(self, worker_logname, worker_id, worker): ...
Python
1
( pose: (f32, f32, f32), color: &'a C, agent: AT, sensor: OS, noise_per_meter: f32, noise_std: f32, bias_rate_stds: (f32, f32), expected_stuck_time: f32, expected_escape_time: f32, expected_kidnap_time: f32, kidnap_range_x: (f32, f3...
Rust
0
2+row.Vt**2+row.Vx**2) row.M = row.V/np.sqrt(row.gamma*row.R*row.T) row.Vm = np.sqrt(row.Vx**2+row.Vr**2) row.T0 = row.T + row.V**2/(2*row.Cp) row.P0 = row.P*(row.T0/row.T)**(row.gamma/(row.gamma-1)) row.alpha2 = np.arctan2(row.Vt,row.Vm) else: # We know Vm, P0, T0 ro...
Python
1
Ok(InitializationToken) } } /// Finalize the Yara library impl Drop for InitializationToken { fn drop(&mut self) { internals::finalize().expect("Expect correct Yara finalization"); } } <reponame>dimfeld/roam-note-exporter use edn_rs::{Edn, EdnError}; use fxhash::FxHashMap; use smallvec::SmallVec; u...
Rust
0
"model": body["model"], "choices": [{"index": 0, "message": {"role": "assistant", "content": response_text}, "logprobs": None, "finish_reason": "stop"}], "usage": {"prompt_tokens": len(body["messages"][-1]["content"]), "completion_tokens": len(response_text), "to...
Python
1
} #[cfg(test)] #[path = "./state_test.rs"] mod tests; table! { use diesel::sql_types::*; communities (id) { id -> Int4, tag -> Int4, description -> Int4, data_use_case -> Int4, contact_email -> Varchar, date_created -> Timestamp, open -> Bool, co...
Rust
0
# Copyright 2024 Marimo. All rights reserved. import marimo __generated_with = "0.11.0" app = marimo.App() @app.cell def _(mo): mo.md( r""" # Visualization: Box Plot with Violin Layer in Altair Create layered box and violin plots with Altair. Box plots display quartiles via `mark_boxplo...
Python
1