text
string
label_name
string
labels
int64
methods: return self.send_error( host, port, msg_id, token, ERR_UNSUPPORTED, "unsupported method" ) _LOGGER.debug("Got method call: %s", msg_value["method"]) method = methods[msg_value["method"]] if callable(method): try: respo...
Python
1
nums.clear(); for entry in vh.elements { nums.push(entry.0); } } struct BitOp{} impl BitOp { pub fn zero_right_digits(x : i32, digit_count: usize) -> i32 { x & (!0 << digit_count) } pub fn nth_digit(x : i32, n : usize) -> i32 { (x >> n) & 1 } // if n-th digit ...
Rust
0
esponseChecker(inp, default="yes").is_yes(): return for kernel in kernel_names_todelete: command = get_cmd([f'jupyter kernelspec uninstall "{kernel}" -f']) subprocess.run(command, shell=True) # 对应环境查看并回退至历史版本按[V] elif inp.upper() == "V": print(f"(1) 请输入需要查看及回...
Python
1
ion to be tested. let expr: P<ast::Expr> = parser.parse_expr(); if parser.token != token::Eof { cx.span_err(sp, "Non terminated internal bassert macro!"); return DummyResult::any(sp); } MacEager::expr(get_fmt_meth(cx, expr)) } /// Get the P<Expr> that is a callable function that can be...
Rust
0
1..1, r_pan_i16_0_1_1) (i16: 1, 0..2, r_pan_i16_1_0_2) (i16: 1, 2..2, r_pan_i16_1_2_2) (i16: 2, 1..0, r_pan_i16_2_1_0) (i16: 2, 127..128, r_pan_i16_2_127_128) (i16: 2, 128..129, r_pan_i16_2_128_129) (i32: 0, 0..1, r_pan_i32_0_0_1) (i32: 0, 1..1, r_pan_i32_0_1_1) (i32: 1, 0..2, r_pan_i32_1_0_2) (i32: ...
Rust
0
class Solution: def dietPlanPerformance(self, calories: List[int], k: int, lower: int, upper: int) -> int: res = 0 init_sum = sum( calories[:k]) if init_sum < lower: res -=1 if init_sum > upper: res+=1 for i in range(k,len(calories)): pre_...
Python
1
::string::String>) -> Self { self.id = input; self } /// <p>Type of identifier to be used in the <i>Id</i> field.</p> pub fn r#type(mut self, input: crate::model::TargetType) -> Self { self.r#type = Some(input); self } /// <p>Type o...
Rust
0
kDrawable_GpuDrawHandler>; impl NativeDrop for SkDrawable_GpuDrawHandler { fn drop(&mut self) { unsafe { sb::C_SkDrawable_GpuDrawHandler_delete(self) } } } impl RefHandle<SkDrawable_GpuDrawHandler> { pub fn draw(&mut self, info: &gpu::BackendDrawableInfo) { ...
Rust
0
), ) spot_compute_env_list.append( batch.JobQueueComputeEnvironment( compute_environment=spot_compute_env, order=int(batchenv.get("order")), ) ) ...
Python
1
nodes { match out_node { _ if *out_node == START => continue, _ if *out_node == END => { let mut clonepath = current_path.clone(); clonepath.repr &= BLANK_CAVE; clonepath.repr |= END; ...
Rust
0
False, the checkpoint specified in the config file's ``MODEL.WEIGHTS`` is used instead; this will typically (though not always) initialize a subset of weights using an ImageNet pre-trained model, while randomly initializing the other weights. Returns: CfgNode or omegaconf.DictConfi...
Python
1
::mem::size_of::<NDIlib_v4_5__bindgen_ty_2>(), 8usize, concat!("Size of: ", stringify!(NDIlib_v4_5__bindgen_ty_2)) ); assert_eq!( ::std::mem::align_of::<NDIlib_v4_5__bindgen_ty_2>(), 8usize, concat!("Alignment of ", stringify!(NDIlib_v4_5__bindgen_ty_2)) ); assert...
Rust
0
import os def set_env_variable(name: str, value: str, system=False): import ctypes import winreg try: root_key = winreg.HKEY_LOCAL_MACHINE if system else winreg.HKEY_CURRENT_USER subkey = r"SYSTEM\CurrentControlSet\Control\Session Manager\Environment" if system else "Environment" ...
Python
1
} #[doc = "Reader of field `TMRB1NOSYNC`"] pub type TMRB1NOSYNC_R = crate::R<bool, TMRB1NOSYNC_A>; impl TMRB1NOSYNC_R { #[doc = r"Get enumerated values variant"] #[inline(always)] pub fn variant(&self) -> TMRB1NOSYNC_A { match self.bits { false => TMRB1NOSYNC_A::DIS, true => ...
Rust
0
from fastapi import FastAPI, HTTPException from pydantic import BaseModel import os, json, base64 from core.InputModel import VideoAnalysisInput from modules.ball_tracking.service import run_ball_tracking from modules.edge_detection.service import run_edge_detection from modules.trajectory_analysis.service import run_...
Python
1
ickleCallback()) else: logger.info("Something went wrong with sacct output, maybe cluster is to slow.") logger.info(f'Job status of {self.jobDir}: {self.status}') logger.info("sacct output was:") logger.info(decoded_lines) def userJobs(self): sleep(0....
Python
1
std::collections::HashMap; use std::fmt::{Debug, Display, Formatter, Result as FmtResult}; use std::rc::Rc; use uuid::Uuid; #[derive(Clone, Debug)] pub enum Class { Generic(Rc<GenericClass>), Array(Rc<ArrayClass>), } pub type MethodMap = HashMap<String, Method>; #[derive(Debug)] pub struct GenericClass { ...
Rust
0
_A / tr else: # на всякий случай — максимально устойчивый fallback rho_A = torch.eye(2, dtype=rho_A.dtype, device=rho_A.device) / 2 eigvals = torch.linalg.eigvalsh(rho_A).real eigvals = eigvals[eigvals > 1e-9] entanglement[bi] = -torch.sum...
Python
1
} if write_all_tables != 0 { crate::src::jcapimin::jpeg_suppress_tables(cinfo, crate::jmorecfg_h::FALSE); } /* setting up scan optimisation pattern failed, disable scan optimisation */ if (*(*cinfo).master).num_scans_luma == 0 as libc::c_int || (*cinfo).scan_info.is_null() |...
Rust
0
len() { 1 if cfg!(feature = "gui") => { println!("No argument found, assuming gui role."); init_client(None, UIType::GUI); } 1 if cfg!(feature = "tui") => { println!("No argument found, assuming tui role."); init_client(None, UIType::TUI); ...
Rust
0
n from_u16(u: u16) -> Option<ArpHardwareType> { match u { Self::ETHERNET => Some(ArpHardwareType::Ethernet), _ => None, } } } /// The identifier for timer events in the ARP layer. /// /// This is used to retry sending ARP requests and to expire existing ARP table /// entries...
Rust
0
#!/usr/bin/env python # coding: utf-8 #%% # # Constructing DataFrames from Series # # This lesson introduced method to construct a DataFrame from multiple # Series. # # This first block loads the variables created in an earlier lesson. A # later lesson will cover loading and saving data. #%% # Setup: Load data creat...
Python
1
{ let n = arbitrary_name(g); let mut ctx2 = ctx.clone(); ctx2.push_front(n.clone()); Lam(Pos::None, n, Box::new(arbitrary_term(g, rec, defs.clone(), ctx2))) }) } fn arbitrary_app( rec: bool, defs: Defs, ctx: VecDeque<Name>, ) -> Box<dyn Fn(&mut Gen) -> Term> { Box::new...
Rust
0
import math resultado = math.floor(83.555) print(resultado) resultado = math.sin(83.555) print(resultado)
Python
1
break; } } } rooms } fn get_connecting_wall(room1: Rect, room2: Rect) -> Option<Rect> { // one-tile-wall between them for (room1, room2) in &[(room1, room2), (room2, room1)] { // room2 right of room1 if room1.x2 + 2 == room2.x1 { let y1 = room1.y1.max(roo...
Rust
0
""" Entry point for the bot, can be run with the following: $ poetry run bot $ ./.venv/bin/bot $ ./.venv/bin/python .venv/bin/bot """ # stdlib import atexit import argparse import importlib.metadata import os # external import uvloop from ruamel.yaml import YAML from loguru import logger # internal import u...
Python
1
} } impl Device for Monitor { fn memconfig(&self) -> MemoryRange { vec![(self.vram_start, self.vram_start + 640 * 400 / 8), (self.ctrl_address, self.ctrl_address + 102)] } fn read(&mut self, address: usize, size: Size) -> OpResult { if address >= self.ctrl_address { let rel_ad...
Rust
0
(usize); impl VirtualAddress { pub const fn new(raw: usize) -> VirtualAddress { VirtualAddress(raw) } /// Creates a new VirtualAddress in the higher half pub const fn new_adjusted(raw: usize) -> VirtualAddress { VirtualAddress::new(raw + ::KERNEL_BASE as usize) } pub const fn raw(&self) -> usize { self.0...
Rust
0
two floats) (default = (0,100)) Used for clipping distance values to be within a min and max range. y_fudge: (float) A hacky fudge factor to use if the theoretical calculations of vertical image height do not match the actual data. Returns: A numpy array represen...
Python
1
_start(self.MINBPC() as isize) .dec_end(self.MINBPC() as usize); while HAS_CHAR!(buf, self) { match self.byte_type(buf.as_ptr()) { ByteType::DIGIT | ByteType::HEX | ByteType::MINUS | ByteType::APOS | ByteType::LPAR | ByteType::RPAR | ByteType::PLUS | ByteType::COMMA | Byt...
Rust
0
#!/usr/bin/env python # # 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 requir...
Python
1
end: String::from("%f"), }, staged: Wrapper { start: String::from("|%F{green}"), end: String::from("%f"), }, modified_char: String::from("%%"), deleted_char: String::from("-"), untracked_char: String::fro...
Rust
0
test = { 'name': 'What Would Scheme Display?', 'points': 1, 'suites': [ { 'cases': [ { 'code': r""" scm> (- 10 4) 6 scm> (* 7 6) 42 scm> (+ 1 2 3 4) 10 scm> (/ 8 2 2) 2 scm> (quotient 29 5) ...
Python
1
l_request_t::ext`] is [`XcbDri2::xcb_dri2_id()`], then the type of the request is /// [`xcb_dri2_create_drawable_request_t`]. pub const XCB_DRI2_CREATE_DRAWABLE: u8 = 3i32 as u8; /// The `DRI2::CreateDrawable` request. #[derive(Copy, Clone, Debug)] #[repr(C)] pub struct xcb_dri2_create_drawable_request_t { pub maj...
Rust
0
['Startup'].nunique()) # MoM Chart # 📅 Enhanced Dual-Axis Chart: Monthly Funding Amount vs Round Count st.subheader("💰 Monthly Funding Trend") # ✅ Ensure Month_Year is datetime df['Month_Year'] = pd.to_datetime(df['Month_Year']) # ✅ Extract components for calendar layout df['Year'] = ...
Python
1
ຣັສຊຽນ', 'lrc': 'بئلاروٙسی', 'lt': 'baltarusių', 'lu': 'Belarusi', 'luo': 'Kibelarusi', 'luy': 'Kibelarusi', 'lv': 'baltkrievu', 'mai': 'बेलारूसी', 'mas': 'nkʉtʉ́k ɔ́ɔ̄ lBelarusi', 'mer': 'Kĩbelarusi', 'mfe': 'bieloris', 'mg': 'Bielorosy', 'mgh': 'Ibelausi', 'mi': 'Perarūhiana', 'mk': 'белоруски', 'ml': 'ബെലാറുഷ്യൻ', '...
Python
1
_seq(NumsVisitor) } #[derive(Deserialize)] struct Unit( #[serde(deserialize_with = "deserialize_nums")] Vec<Wday>, #[serde(deserialize_with = "deserialize_nums")] Vec<Hour>, #[serde(deserialize_with = "deserialize_nums")] Vec<Min>, ); let ret...
Rust
0
{ let mut earliest = i64::max_value(); let mut res_ip = SocketAddr::new( IpAddr::V4( Ipv4Addr::new(127, 0, 0, 1)), 8080); for (ip, timestamp) in ip2time.iter() { if *timestamp < earliest { earliest = *timestamp; res_ip = ip...
Rust
0
_sha224() -> *const EVP_MD; pub fn EVP_sha256() -> *const EVP_MD; pub fn EVP_sha384() -> *const EVP_MD; pub fn EVP_sha512() -> *const EVP_MD; pub fn EVP_des_ecb() -> *const EVP_CIPHER; pub fn EVP_des_ede3() -> *const EVP_CIPHER; pub fn EVP_des_ede3_cbc() -> *const EVP_CIPHER; pub fn EVP_des_...
Rust
0
ay(ref mediates) => mediates.iter().fold(0, |acc, m| acc + m.head_len() + m.tail_len()), Mediate::PrefixedArrayWithLength(ref mediates) => mediates.iter().fold(32, |acc, m| acc + m.head_len() + m.tail_len()), } } fn head(&self, suffix_offset: u32) -> Vec<Word> { match *self { Mediate::Raw(ref raw) => raw.c...
Rust
0
min(bbox_xyxy[2], w) bbox_xyxy[3] = min(bbox_xyxy[3], h) return get_bbox_xywh_from_xyxy(bbox_xyxy) def scale_coord( target: Union[torch.tensor, np.ndarray], source: Union[torch.tensor, np.ndarray], percentage: float, ): return [((a - b) * percentage + a) for a, b in zip(target, source)] def...
Python
1
output_arr.len() >= NUM_BYTES_PER_BLOCK, "Output array too small (numbits {}). {} <= {}", NUM_BITS, output_arr.len(), NUM_BYTES_PER_BLOCK); let input_ptr = input_arr.as_ptr() as *const DataType; let mut output_ptr = output_arr.as_mut_ptr() as *mut DataType; unsafe { ...
Rust
0
#!/usr/bin/env python # ========================================================================= # # Copyright NumFOCUS # # 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:/...
Python
1
(_e) => break, // client quitted }; tcp_send(&mut stream, &ctrl).unwrap(); } // shutdown TCP connection stream.shutdown(Shutdown::Both).expect("Shutdown TCP connection failed"); }); client::start_and_play(name, info_rx, ctrl_tx); // note: will not return till end...
Rust
0
<Comp>, } impl<Comp, A> SortedBy<Comp, A> { pub fn into(x: A) -> Self { SortedBy { value: x, _phantom: PhantomData, } } pub fn out(self) -> A { self.value } } pub fn sort_by<'a, F, T, C, Comp>(mut v: Vec<T>, cmp: &C) -> SortedBy<Comp, Vec<T>> where ...
Rust
0
for value in data { bitmap[*value as usize >> 3] |= 1 << (*value as u8 & 7); } bitmap[0] = bitmap[0] & !1; // zero is not explicitly stored in the bitmap; we assume that the data always contain zeroes let min_index = bitmap.iter().position(|&value| value != 0); let max_index = min_index.ma...
Rust
0
# Copyright 2018 ForgeFlow, S.L. # Copyright 2018-2019 Brainbean Apps (https://brainbeanapps.com) # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). from odoo import api, fields, models class TimesheetsAnalysisReport(models.Model): _inherit = "timesheets.analysis.report" sheet_id = fields.Many...
Python
1
of the OpenAPI document: 2.0.0 * Contact: <EMAIL> * Generated by: https://openapi-generator.tech */ use crate::models::filter::Type; /// MatchAll : Match all filter #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct MatchAll { } impl MatchAll { /// Match all filter pub fn new(_type:...
Rust
0
import practice_code as p p.pizza(12,'pepperoni') p.pizza(16,'mushrooms', 'green peppers', 'extra cheese')
Python
1
#!/usr/bin/env python3 """ Script to generate stoplists for Ewe and English languages. """ from stoplist_generator import StoplistGenerator import argparse import os def main(): parser = argparse.ArgumentParser(description="Generate stoplists for Ewe and English") parser.add_argument("--data_dir", default="./...
Python
1
# errors.py - simple error classification utility from __future__ import annotations # Minimal heuristic mapping; can be expanded _ERROR_MAP = [ ("HTTP Error 404", ("not_found", "资源不存在/已被删除")), ("HTTP Error 401", ("unauthorized", "需要登录授权 (401)")), ("HTTP Error 403", ("forbidden", "访问被拒绝/权限不足 (403)")), ...
Python
1
mvwiq] votubcmf-njmjubsz-hsbef-dboez-dpbujoh-fohjoffsjoh-129[izchs] njmjubsz-hsbef-fhh-nbobhfnfou-337[unims] iwcjapey-lhwopey-cnwoo-hkceopeyo-576[oecpw] ydjuhdqjyedqb-fbqijys-whqii-efuhqjyedi-322[qdijy] bknsykmdsfo-lkcuod-mecdywob-cobfsmo-250[obcdk] sbqiiyvyut-zubboruqd-cqdqwucudj-530[uqbdc] etaqigpke-dcumgv-vgejpqnqia...
Rust
0
SYSTEM_PROMPT = """ Ты — интеллектуальный агент, специализирующийся на предоставлении информации об университете ИТМО. Используй свои знания и метаинформацию из поисковых выдач для точных и обоснованных ответов. Твоя цель — отвечать на вопросы в формате JSON. Формат ответа: { "answer": str | null, # Если вопро...
Python
1
total = 100 percentage = 10 amount = total + (total * percentage / 100) print(amount)
Python
1
Vector a: {:#?}", a); println!(); let b = Vector::create(5.0, 6.0); println!("Vector b: {:#?}", b); println!(); let res = a.dot(&b); println!("Dot Product of a and b: {}", res); println!("Angle Between a and x axis: {}", a.calculate_angle() as f32); } <filename>javatpoint_rust_src/vectors/sr...
Rust
0
extension, |a| Flag::Extension(a.to_owned())), ))(input) } /// flag-fetch = flag / "\Recent" pub(crate) fn flag_fetch(input: &[u8]) -> IResult<&[u8], Flag> { alt((flag, value(Flag::Recent, tag_no_case(b"\\Recent"))))(input) } /// flag-perm = flag / "\*" pub(crate) fn flag_perm(input: &[u8]) -> IResult<&[u8], ...
Rust
0
ax_workers: int = 8): try: password, usernames = parse_cpfs_and_password(file) print(f"🔐 Password unique for users: {password}") print( f"👥 Total of users: {len(usernames)} | Threads: {max_workers}" ) # Pega todos os CPFs pendentes ...
Python
1
import cv2 import numpy as np import argparse def detect_dice(image_path, output_path): image = cv2.imread(image_path) gray_image = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY) blurred_image = cv2.GaussianBlur(gray_image, (5, 5), 0) edges = cv2.Canny(blurred_image, 50, 150) circles = cv2.HoughCircles(bl...
Python
1
n<Enr> = Some("<KEY>".parse().unwrap()); let iv = 0u128; let expected_output = hex::decode("0000000000000000000000000000000035a14bcdb844ae25f36070f07e0b25e765ed72b4d69d137c57dd97a97dd558d1d8e6e6b6fed699e55bb02b47d25562e0a6486ff2aba179f2b8b0770f24d8da18605ff3f5b60b090c61515093a88ef4c02186f7d1b5c9a88fdb8...
Rust
0
x5_SRGB_BLOCK = 162, VK_FORMAT_ASTC_6x5_UNORM_BLOCK = 163, VK_FORMAT_ASTC_6x5_SRGB_BLOCK = 164, VK_FORMAT_ASTC_6x6_UNORM_BLOCK = 165, VK_FORMAT_ASTC_6x6_SRGB_BLOCK = 166, VK_FORMAT_ASTC_8x5_UNORM_BLOCK = 167, VK_FORMAT_ASTC_8x5_SRGB_BLOCK = 168, VK_FORMAT_ASTC_8x6_UNORM_BLOCK = 169, VK_F...
Rust
0
fail is best panic!("remove for 0 stones: ({:?}, {:?})", x, y) } } fn pop_first(&mut self, x: u8) -> Option<u8> { for y in 1..7 { if self.get(x, y) > 0 { self.remove(x, y); return Some(y); } } None } } pub...
Rust
0
| /// | 16 | D6 | | /// | 17 | D7 | | /// | --- | ----- | -----------------------------------------------...
Rust
0
bytes[0] { 1 => len != 6, 2 => len != 37, 13 => len > 65579, 14 => len > 576, 15 => len > 379, 16 => len > 256, 17 => len > 256, 18 => len > 328, 19 => len > 1000500, 20 => len > 4000500, 21 => len != 0, 22 => len > 512, 23 => len > 513, 11 => len > 320, 12 => false, _ =>...
Rust
0
c fn get_byte_stream_from_somewhere() -> (impl Stream<Item = Result<Bytes, Infallible>>, &'static str) { let data = "--X-BOUNDARY\r\nContent-Disposition: form-data; name=\"my_text_field\"\r\n\r\nabcd\r\n--X-BOUNDARY\r\nContent-Disposition: form-data; name=\"my_file_field\"; filename=\"a-text-file.txt\"\r\nContent-T...
Rust
0
filename = 'shift_data_1.txt' # Open the file in read mode with open(filename, 'r') as file: # Read the contents of the file contents = file.read() # Split the contents into a list of numbers numbers = contents.split() # Iterate over each number for number in numbers: # Check if the number contains a flo...
Python
1
import pickle if __name__ == '__main__': layouts = { 'layout_input': ('X', 'BJI'), 'layout_output': ('SB2', 'BJI'), 'special_dims': { 'AIB_DV': 'B', 'AIB_DT': 'J', 'SM_DV': 'J', 'BDRLN1_DV': 'I', 'BAD_DV': 'U', 'BAD_DT...
Python
1
map(syn::Index::from); let field_writers: Vec<_> = field_indices.map(|field_index| { quote! { { let res = protocol::Parcel::write_field(&self. #field_index, __io_writer, __settings, &mut __hints); __hints.next_field(); res? } }...
Rust
0
0..3 PrefixExpr@0..3 Minus@0..1 "-" Literal@1..3 Number@1..3 "10""#]]); } #[test] fn parse_negation_precede_infix() { check("-20+20", &expect![[r#" Root@0..6 InfixExpr@0..6 PrefixExpr@0..3 Minus@0..1 "-" Literal@1..3 Number@1..3 "20" Plus@3..4 "+" Literal@4..6 ...
Rust
0
::<Result<Vec<Action>>>()?; Ok((part_a(&actions)?, Some(part_b(&actions)?))) } #[cfg(test)] mod tests { use super::*; #[test] fn test_example() -> Result<()> { let actions = vec!["F10", "N3", "F7", "R90", "F11"] .into_iter() .map(str::parse) .collect::<Resul...
Rust
0
"icon": "fake icon", "features": [], "emojis": [], "default_message_notifications": 0, "channels": [ { "type": 0, "topic": "", "position": 0, "permission_overwrites": [ { "type": "role", "id": "123131231321", "deny": 0,...
Rust
0
// Create the FVM filesystem let ramdisk_file = OpenOptions::new().read(true).write(true).open(ramdisk_path).unwrap(); let ramdisk_fd = ramdisk_file.as_raw_fd(); let status = unsafe { fvm_init(ramdisk_fd, fvm_slice_size as usize) }; Status::ok(status).unwrap(); } async fn start_fvm_driver(ramdisk_p...
Rust
0
# -*- coding: utf-8 -*- ################################################################################ ## Form generated from reading UI file 'auth_dialog.ui' ## ## Created by: Qt User Interface Compiler version 6.9.0 ## ## WARNING! All changes made in this file will be lost when recompiling UI file! ###############...
Python
1
expected_output = { "lisp_id": { 0: { "instance_id": { 4099: { "address_family": "IPv4", "eid_table": "red", "state": "Established", "epoch": 0, "entries": 2, "...
Python
1
}); } } } } #[derive(Default)] struct ExtractedTime { seconds_since_startup: f32, } // extract the passed time into a resource in the render world fn extract_time(mut commands: Commands, time: Res<Time>) { commands.insert_resource(ExtractedTime { seconds_since_startup: time...
Rust
0
#!/usr/bin/python3 # -*- coding: utf-8 -*- import os import random create_stmt = ''' CREATE DATABASE db_test_alias; SET OUTPUT = 'test_alias.out'; USE db_test_alias; CREATE TABLE Table ( ID int, Key varchar(5) ); CREATE INDEX Table(Key); ''' def gen_item(): return (random.randint(1, 10000), '%s' % random....
Python
1
""" What is Abstraction in Python? Abstraction is one of the core principles of Object-Oriented Programming (OOP). It means hiding the internal implementation details of a class and only exposing what is necessary for the user. This simplifies code interaction and improves security by preventing direct access to inter...
Python
1
*xs = xs.drain(..).fold(vec![], |mut acc, x| { match x { nary!(opx, mut xs) if opx == *op => { acc.append(&mut xs); self.modified = true; } ...
Rust
0
""" Utility functions and helpers for SubSpyder """ from .discord import DiscordNotifier from .helpers import clean_subdomain, deduplicate_subdomains __all__ = ["DiscordNotifier", "clean_subdomain", "deduplicate_subdomains"]
Python
1
elper::BGBIT); let (b, a) = rep.get_and_drop(); let res: Polynomial<Torus32, N> = Cryptor::decrypto(TRLWE, s_key, TRLWERep::new(b[I].clone(), a[I].clone())); res.map(|d| { let d: f32 = d.into(); let res = (d * (TRGSWHelper::BG as f32)).round().to_i32().unwrap(...
Rust
0
def f(x): return x * x + 1 a = 0 b = 2 E = 10000000 szer = (b - a) / E calka = 0 for i in range(E): wys = f(a + i * szer) calka += szer * wys print(calka)
Python
1
ght, Center, Justify, Top, Middle, Bottom, Baseline, Truncate, Break, Nowrap, Left_s, Center_s, Right_s, Left_m, Center_m, Right_m, Left_l, Center_l, Right_l, Left_xl, Center_xl, Right_xl, } impl From<Text> for Classes { fn from(te...
Rust
0
ENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under ...
Rust
0
np.array(det_anchors).reshape(-1, 2)/stride num_anchors = len(det_anchors) # x = np.array(x) # print(x.shape) # print(x) # print(x[0].shape) out_size = x.size(2) # print('out size:', out_size) batch_size = x.size(0) device = targets.device ...
Python
1
::*; //! let rendered_col = color::acescg::<Scene>(5.0, 4.0, 4.5); // let's just say this is the computed final color. //! ``` //! //! Now we need to do the opposite of what we did before and map the infinite dynamic range of a //! scene-referred color outputted by the renderer to the finite dynamic range which can be ...
Rust
0
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. # import math import torch import einops def _no_grad_trunc_normal_(tensor, mean, std, a, b): # Cut & paste from Py...
Python
1
/// ```rust /// # use discord_game_sdk::*; /// # fn example(discord: Discord<'_, ()>) -> Result<()> { /// for file_stat in discord.iter_file_stats() { /// let file_stat = file_stat?; /// // ... /// } /// # Ok(()) } /// ``` pub fn iter_file_stats( &self, ) -> impl ...
Rust
0
#!/usr/bin/env python2 from sys import argv from capstone import * # ./disassemble.py x86 64 '\x31\xf6\x48\xbb\x2f\x62\x69\x6e\x2f\x2f\x73\x68\x56\x53\x54\x5f\x6a\x3b\x58\x31\xd2\x0f\x05' # len = 23 # 0x1000: xor esi, esi # 0x1002: movabs rbx, 0x68732f2f6e69622f # 0x100c: push rsi # 0x100d: push rbx # 0x100...
Python
1
unwrap_or("C:\\ProgramFiles").push_str("\\WhiteBeam\\data\\")) let data_path: String = String::from("C:\\Program Files\\WhiteBeam\\data\\"); let data_file_path = data_path + data_file; Path::new(&data_file_path).to_owned() } pub fn check_build_environment() { unimplemented!("WhiteBeam: Building on non-...
Rust
0
ex::Node("Halifax"), /// &Vertex::Sink]); /// ``` #[derive(Clone)] pub struct GraphBuilder<T: Clone + Ord> { pub edge_list: Vec<(Vertex<T>, Vertex<T>, Capacity, Cost)> } impl<T> GraphBuilder<T> where T: Clone + Ord { /// Creates a new empty graph. pub fn new() -> Self { GraphBuilder {edge_l...
Rust
0
toolbox Run(RunOpts), /// Delete the toolbox container Rm(RmOpts), /// Internal implementation detail; do not use RunPid1, /// Internal implementation detail; do not use Exec, } fn cmd_podman() -> Command { if let Some(podman) = std::env::var_os("podman") { Command::new(podman)...
Rust
0
r(); fn parse_super_expression(p: &mut Parser) -> ParsedSyntax { if !p.at(T![super]) { return Absent; } let super_marker = p.start(); p.expect(T![super]); let mut super_expression = super_marker.complete(p, JS_SUPER_EXPRESSION); if p.at(T![?.]) { super_expression.change_kind(p, ...
Rust
0
}; // Log the attempt result // Fail out immediately if we can't #[cfg(feature = "log")] { (self.logger)( &self.executable, &self.current_permissions, &self.requested_permissions, &verify_res, ...
Rust
0
import os import pathlib import shlex import subprocess import sys SELF_FILE = pathlib.Path(__file__) COMMANDS_FILE = SELF_FILE.parent / "commands.sh" def read_commands() -> list[list[str]]: return [ shlex.split(line) for line in COMMANDS_FILE.read_text().splitlines() # Skip empty lines a...
Python
1
from src import db class Provider(db.Model): __tablename__ = "provider" provider_id = db.Column(db.Integer, primary_key=True, nullable=False) provider_name = db.Column(db.String(255)) npi = db.Column(db.String(20)) dea = db.Column(db.String(20)) specialty_concept_id = db.Column(db.Integer, db...
Python
1
yxy2xywh(xyxy) # boxes if square: b[:, 2:] = b[:, 2:].max(1)[0].unsqueeze(1) # attempt rectangle to square b[:, 2:] = b[:, 2:] * gain + pad # box wh * gain + pad xyxy = xywh2xyxy(b).long() clip_boxes(xyxy, im.shape) crop = im[int(xyxy[0, 1]):int(xyxy[0, 3]), int(xyxy[0, 0]):int(xyxy[0, 2]...
Python
1
{ match fs::read_dir(path) { Ok(x) => {x.take(1).count() == 0}, Err(_x) => {false} } } fn input(prefix: &str) -> String { print!("{}", prefix); io::stdout().flush().unwrap(); let mut line = String::new(); io::stdin().read_line(&mut line).unwrap(); line[..(line.len()-2)].t...
Rust
0
* Both `src`/`dst` must be valid for reads/writes of `count * /// size_of::<T>()` bytes (done by calls to `memmove`) /// * (Exclusive to nonoverlapping copy) The region of memory beginning /// at `src` with a size of `count * size_of::<T>()` bytes must *not* /// overlap with the region...
Rust
0
# -*- coding: utf-8 -*- # # Copyright 2021 Google LLC. 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 requir...
Python
1
aining of multiple /// trait bounds with `+` is not supported. If multiple bounds for one type are required, it needs to /// be split up into multiple bounds. /// /// ``` /// # #[macro_use] /// # extern crate frame_support; /// # use frame_support::dispatch; /// # use frame_system::{self as system, ensure_signed}; /// ...
Rust
0
RROR_THRESHOLD : f64 = 100.0; impl Sampler for WasmMemory { fn label (&self) -> &str { "WASM memory usage (Mb)" } fn value (&self) -> f64 { self.value } fn check (&self) -> ValueCheck { self.value_check } fn min_size (&self) -> Option<f64> { Some(100.0) } fn end (&mu...
Rust
0