text
string
label_name
string
labels
int64
c)); } #[test] fn line_6() { let a = Point::new(1, 1); let b = Point::new(1, 0); let l = Line::from(a, b); let c = Point::new(1, 2); assert!(l.is_on_line(&c)); } #[test] fn segment_1() { let a = Point::new(0, 0); let b = Point::new(7, 7); let l = Line::from(a, b); let c =...
Rust
0
# https://dmoj.ca/problem/coci13c3p1 # ํฐ ํ™”๋ฉด๊ณผ ํ•œ ๊ฐœ์˜ ๋ฒ„ํŠผ์ด ์žˆ๋Š” ์žฌ๋ฏธ์žˆ๋Š” ๊ธฐ๊ณ„๊ฐ€ ์žˆ์Œ. ๋ฒ„ํŠผ์„ ๋ˆ„๋ฅด๋ฉด A -> B, B->BA ๊ทœ์น™ ๋ฐœ๊ฒฌ # ์ž…๋ ฅ์—๋Š” ๋ฒ„ํŠผ์„ ๋ˆ„๋ฅธ ํšŸ์ˆ˜ ์ถœ๋ ฅ์—๋Š” ๋‘๊ฐœ์˜ ๊ณต๋ฐฑ์„ ์‚ฌ์ด์— ๋‘๊ณ  A and B์˜ ๊ธ€์ž ์ˆ˜ # ์ค‘์š”ํ•œ ์‚ฌํ•ญ์€ A,B์˜ ๊ฐœ์ˆ˜๋งŒ ํ•„์š”. ์ด์ „ A๋Š” B๋กœ ๋ฐ”๋€Œ๊ณ , B๋Š” BA๋กœ ๋ฐ”๋€Œ๋Š” ๊ฒƒ์„ ๊ฐฏ์ˆ˜๋กœ ์น˜ํ™˜ # ์ด๋ฒˆ A๋Š” ์ด์ „์˜ B์˜ ๊ฐœ์ˆ˜, ์ด๋ฒˆ B๋Š” ์ด์ „ A์™€ B์˜ ํ•ฉ press_button = input() if not press_button.isdigit() :exit(f"{press_button}...
Python
1
'a, CS, DataLoaderWrapper<'a, CS>> { pub fn new(consensus: &'a Consensus, store: &'a CS) -> Self { let data_loader = DataLoaderWrapper::new(store); DaoCalculator { consensus, store, data_loader, } } pub fn primary_block_reward(&self, target: &Head...
Rust
0
::{PathAndQuery, Scheme, Uri}, Error as HttpError, Version, }; use httparse::{ Response as ResponseParser, Status::{Complete, Partial}, EMPTY_HEADER, }; #[cfg(feature = "native-tls")] use native_tls::TlsConnector; #[cfg(feature = "tls")] use rustls::ClientConfig; #[cfg(feature = "json")] use serde::{de:...
Rust
0
"""Test suite for Theme API endpoint.""" import json from formsflow_api_utils.utils import get_token payload = { "logoName": "logo 2", "type": "url", "logoData": "61ef7aa2555663dsef", "applicationTitle": "Public Plandsfsdf", "themeJson": {"sample": "test123sdfsfsdf"}, } def test_create_theme(ap...
Python
1
onfig_path = "{}/{}".format(os.getcwd(), config_path) if os.path.exists(config_path): with open(config_path, "r") as f: try: data = f.read() except (OSError, IOError) as e: print("\nAn error occured while loading the host configs: {}".format(e)) ...
Python
1
t = int(input().strip()) for i in range(1, t + 1): n, p = map(int, input().strip().split()) l = list(map(int, input().strip().split())) c = [0] * p for j in l: c[j % p] += 1 r = c[0] if p == 2: r += (c[1] + 1) // 2 elif p == 3: m = min(c[1], c[2]) r += m ...
Python
1
Box::into_raw(Box::new(e)), }, result_ok: false, } } #[no_mangle] /// Frees any resources used by the CResult_ClosingSignedFeeRangeDecodeErrorZ. pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res: CResult_ClosingSignedFeeRangeDecodeErrorZ) { } impl Drop for CResult_ClosingSignedFeeRangeDecodeEr...
Rust
0
# Databricks notebook source # MAGIC %md # MAGIC # Run Unit Tests # MAGIC This notebook runs the unit tests for all submodules in this repository using [PyTest](https://docs.pytest.org/en/stable/), following [best practice recommendations from Databricks](https://docs.databricks.com/aws/en/notebooks/testing). # MAGIC #...
Python
1
AIN_IC_REQUEST); buf.extend_from_slice(request_id.as_bytes()); buf }; let signature_bytes = ed25519_keypair.sign(&bytes_to_sign).to_bytes(); BasicSigOf::new(BasicSig(signature_bytes.to_vec())) }; let public_key = UserPublicKey { key: ed25519_keypair.public...
Rust
0
ntil<F: Future>( &self, future: F ) -> <F as Future>::Output { self.pool.borrow_mut().run_until( future ) } /// // pub(crate) fn try_run_one( &self ) -> bool { self.pool.borrow_mut().try_run_one() } /// // pub(crate) fn run_until_stalled( &self ) { self.pool.borrow_mut().run_until_stalled() } ...
Rust
0
le_path(target_path) commands = [ '-i', temp_file_path ] if isinstance(trim_frame_start, int): start_time = trim_frame_start / output_video_fps commands.extend([ '-ss', str(start_time) ]) if isinstance(trim_frame_end, int): end_time = trim_frame_end / output_video_fps commands.extend([ '-to', str(end_time) ...
Python
1
error, ) })?) } else { None }; let max_gas_amount = if space_delim_strings.len() > 6 { Some(space_delim_strings[6].parse::<u64>().map_err(|error| { format_parse_data_error( "max_gas_amoun...
Rust
0
nrx4( &mut self.buffer.sound_1, &mut Line1Mapper { mapper: &mut self.mapper, }, &self.frame_sequencer, address, v, ); } 0xFF19 => { ...
Rust
0
}); }); } #[test] fn cancel_replace_tokens_succeeds() { run_test(|| { let old_id = create_sample_vault(); let new_id = create_vault(OTHER_ID); let new_id_copy = new_id.clone(); currency::Amount::<Test>::lock_on.mock_safe(move |amount, sender| { assert_eq!(send...
Rust
0
# โฑ 2 min # 16. Use a chained comparison to check if x is greater than 3 and less than 10 # Input: #x = 5 # Output: #True x = 5 if 3 < x <10: print (True)
Python
1
# List items are ordered, changeable, and allow duplicate values. some_list = ['apple', 'banana', 'cherry'] print(some_list) print(len(some_list)) # lists' data type print(type(some_list)) # The list() Constructor this_list = list(('apple', 'banana', 'cherry')) print(this_list) #ACCESS LIST ITEMS some_list_1 = ...
Python
1
_input): """Layers used during upsampling""" u = UpSampling2D(size=2)(layer_input) u = Conv2D(256, kernel_size=3, strides=1, padding='same')(u) u = Activation('relu')(u) return u def res_mult_2x(layer_input): l1 = Conv2D(64, kernel_size=4, ...
Python
1
// https://github.com/rust-lang/rust/issues/47312 span: Span::call_site(), }), }; let span = field.span(); let doc = MetaItem::get_docs(&field.attrs); let deprecated = MetaItem::get_deprecated(&field.attrs); let flags = MetaItem::with_name(&field.attrs...
Rust
0
.target(module_path!()) .file(Some(filename)) .line(Some(line)) .level(lvl) .build(), ); } /// This function configures the logging format. The loglevel is also processed /// here i.e `RUST_LOG=mayastor=TRACE` will print all trace!() and higher /// messages ...
Rust
0
ER_1) _create_machine_account(supplier2, 'ldap/%s' % HOST_SUPPLIER_2) # Set on the cn=replica config to accept the other suppliers princ mapping under mapping tree _allow_machine_account(supplier1, 'ldap/%s' % HOST_SUPPLIER_2) _allow_machine_account(supplier2, 'ldap/%s' % HOST_SUPPLIER_1) # # ...
Python
1
self._DeleteParamSet = DeleteParamSet def _deserialize(self, params): self._TemplateId = params.get("TemplateId") self._TemplateName = params.get("TemplateName") self._TemplateDescription = params.get("TemplateDescription") if params.get("ModifyParamEntrySet") is not None: ...
Python
1
// use pyo3::wrap_pyfunction; pub mod pygraph; pub mod pyordgraph; pub mod pydtfgraph; mod vmap; mod ducktype; use pyo3::exceptions::*; use pyo3::ToPyObject; use pyo3::types::PyTuple; use graphbench::graph::{Vertex, Graph}; use graphbench::iterators::*; use crate::pygraph::*; use crate::pyordgraph::*; use crate::py...
Rust
0
# THIS FILE IS PART OF THE CYLC WORKFLOW ENGINE. # Copyright (C) NIWA & British Crown (Met Office) & Contributors. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the Licen...
Python
1
tcx, 'tcx>, mir: &Mir<'tcx>, ctxt: &MoveDataParamEnv<'tcx>, mut callback: F) where F: FnMut(MovePathIndex, DropFlagState) { let move_data = &ctxt.move_data; for arg in mir.args_iter() { let lvalue = mir::Lvalue::Local(arg); let lookup_result = move_data.rev_lookup.find(&lvalue); ...
Rust
0
from __future__ import annotations import math from collections.abc import Mapping from functools import partial from types import MappingProxyType from typing import Any import torch import torch.nn as nn from torchvision.ops.misc import FrozenBatchNorm2d def _get_cosine_schedule_with_warmup_lr_lambda( current...
Python
1
position = index # Select word around cursor on double click. # Two MOUSE_UP events in a short timespan are considered a double click. double_click = self._last_click_timestamp and time.time() - self._last_click_timestamp < .3 self._last_c...
Python
1
#!/usr/bin/env python #Copyright (c) 2006, Brian Gerkey #All rights reserved. # #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 ...
Python
1
f32 { 1.0 / (1.0 + (input * -1.0f32 * response).exp()) } ///ใ€€ๆฑ‚ๆฟ€ๆดปๅ‡ฝๆ•ฐๅฏผๆ•ฐ pub fn back_propagation(activation: f32) -> f32 { activation * (1.0f32 - activation) } /// ้ข„ๅค„็†่พ“ๅ…ฅๅ€ผ๏ผˆๆ— ๅ™ช้Ÿณ๏ผ‰ pub fn prepare_inputs_no_noise(inputs: &[u8; IMAGE_SIZE]) -> Vec<f32> { let mut output = Vec::with_capacity(IMAGE_SIZE); for inde...
Rust
0
64; const NUM_BUCKETS: u32 = BUCKETS_X * BUCKETS_Y; const BOUND_X: f32 = 16384.0; const BOUND_Y: f32 = 8192.0; const BUCKET_SIZE_X: f32 = 32768.0 / (BUCKETS_X - 1) as f32; const BUCKET_SIZE_Y: f32 = 16384.0 / (BUCKETS_Y - 1) as f32; const INV_BX: f32 = 1.0 / BUCKET_SIZE_X; const INV_BY: f32 = 1.0 / BUCKET_SIZE_Y; ///...
Rust
0
; use circle_safe_ext::Circle; mod circle_safe_int; use circle_safe_int::Circle as C; fn main() { let mut circle: C<i32> = C::new(); circle.push_after(42); circle.push_after(50); circle.push_after(49); circle.push_after(48); circle.push_after(47); circle.push_after(46); circle.push_afte...
Rust
0
Arg::with_name("service_ip") .help("IP address of remote shell service") .short("i") .takes_value(true) .default_value("0.0.0.0"), ) .arg( Arg::with_name("service_port") .help("Port number of remote s...
Rust
0
import copy import random import cv2 import time import os import tifffile import pandas as pd import numpy as np import argparse import logging from data_toolbox import * from yacs.config import CfgNode as CN from scatter_detector import * class ScatterDataForVideo: def __init__(self, gts): self.gts = s...
Python
1
20news-bydate.tar.gz") .unwrap(); { let mut transfer = easy.transfer(); transfer .write_function(|new_data| { data.extend_from_slice(new_data); Ok(new_data.len()) }) .unwrap(); transfer.perform().unwrap(); } ...
Rust
0
EST_DIR")).join("languages"); for entry in fs::read_dir(path)? { let entry = entry?; let path = entry.path(); if !entry.file_type()?.is_dir() { continue; } let dir = path.file_name().unwrap().to_str().unwrap().to_string(); // filter ignores if ...
Rust
0
tf.logging.info("***** Running evaluation *****") tf.logging.info(" Num examples = %d", len(eval_examples)) tf.logging.info(" Batch size = %d", self.batch_size) eval_input_fn = self.file_based_input_fn_builder( input_file=eval_file, seq_length=args.max_seq_len, ...
Python
1
mbtc "OP_DUP OP_HASH160 [745e5b81fd30ca1e90311b012badabaa4411ae1a]' ' OP_EQUALVERIFY OP_CHECKSIG">') def test_coinbase_tx(self): tx = Tx.coinbase_tx(COINBASE_PUB_KEY_FROM_80971, int(50 * 1e8), COINBASE_BYTES_FROM_80971) s = io.BytesIO() tx.stream(s) tx1 = s.getvalue() ...
Python
1
let input = "Man is distinguished, not only by his reason, but by this singular passion from other animals, which is a lust of the mind, that by a perseverance of delight in the continued and indefatigable generation of knowledge, exceeds the short vehemence of any carnal pleasure."; write!(bytes, "{}"...
Rust
0
.unwrap(); ws.swap_remove(wi); return false; } } e.remove_entry(); true } Entry::Vacant(_) => unreachable!(), } } #[cfg(test)] mod test { // Nothing really worth testing here } use std::syn...
Rust
0
ples)).requires_grad_(True) d_interpolates = D(interpolates) fake = torch.ones(d_interpolates.size()) if torch.cuda.is_available(): fake = fake.cuda() gradients = torch.autograd.grad( outputs=d_interpolates, inputs=interpolates, grad_outputs=fake, create_graph=True, reta...
Python
1
false } )); assert_ok!(Staking::validate( Origin::signed(10), ValidatorPrefs { commission: Perbill::from_percent(15), blocked: false } )); }) } #[test] fn change_of_max_nominations() { use frame_election_provider_support::ElectionDataProvider; ExtBuilder::default() .add_staker(60, 61, 10, StakerStatu...
Rust
0
composite.is_checked("Show heatmap") { Some(HeatmapOptions::from_controls(&self.composite)) } else { None }; Options { heatmap, state: self.composite.dropdown_value("seir"), } } } // TODO This should live in sim #[derive(Clone, Copy, P...
Rust
0
commands = """ \"C:\Program Files\Windows Defender\MpCmdRun.exe\" -RemoveDefinitions -All """ await sliver_executor.cmd(session_id=sliver_sessionid,input_commands=commands) print_finished_message() confirm_action() commands = """ reg add \"HKEY_CURRENT_USER\Software\Microsoft\Windows\C...
Python
1
rt.new_assigned_tasks_cpus(&[&[ 4, 4, 4, /* 12 */ 4, 4, 4, /* 12 */ 4, 4, 4, /* 12 */ ]]); rt.balance(); assert_eq!(rt.worker_load(100).get_n_cpus(), 12); assert_eq!(rt.worker_load(101).get_n_cpus(), 12); assert_eq!(rt.worker_load(102).get_n_cpus(), 12); } #[test] fn test_resource_balancing...
Rust
0
ame, 'se.pth') # if os.path.isfile(se_path): # se = torch.load(se_path).to(device) # return se, audio_name # if os.path.isdir(audio_path): # wavs_folder = audio_path # if vad: # wavs_folder = split_audio_vad(audio_path, target_dir=target_dir, audio_name=audio_name) ...
Python
1
/// /// Checks if path is static & valid /// pub fn check(input: &str) -> Result<bool, String> { let node = Parser::compile(input)?; let mut visitor = NodeVisitorImpl { valid: VisitStatus::PartialValid, last_token: None, }; visitor.visit(&node); ...
Rust
0
_offsets.clone()], endian).into(), EndianSlice::new(&[], endian), )?; Ok(Some(SymbolizeContext { // See comments on `SymbolizeContext` for why we do this static // lifetime promotion. inner: unsafe { std::mem::transmute::<Addr2LineContext<'...
Rust
0
import re import json from pathlib import Path from urllib import parse, request from urllib.error import HTTPError def read(fn: str): return json.loads(Path(f"./{fn}").read_text(encoding="UTF-8")) def write(fn: str, content): Path(f"./{fn}").write_text( json.dumps(content, ensure_ascii=False, inden...
Python
1
import numpy as np import pandas as pd from sklearn.model_selection import KFold from sklearn import tree from sklearn.metrics import roc_auc_score from sklearn.metrics import recall_score from sklearn.metrics import precision_score from sklearn.metrics import accuracy_score from sklearn.metrics import f1_score from sk...
Python
1
j r||jkrd }||_q||jks||jks|jr|j ||_ q|jj||jdkrdGHnd|_|j s|j r|rPqqqqW|j }d|_ |j rJ| rJ|dkrJd}n|jdkry|rqdt|GHqydGHn|S(NRis isshlex:...
Python
1
from re import match def main(): print("Python program for working with the Vigenere Cipher. (Encrypter and Decrypter)\n") # Declaring data to be used for encryption and decryption. alphabets = [ 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q...
Python
1
_ident(Handle { node: _node, forest, _marker: PhantomData, })) } else { let fields_ident = v.fields.keys().map(Src::ident); let fields_expr = v .fields .values(...
Rust
0
0_0_3 { pub to: AscPtr<AscAddress>, pub from: AscPtr<AscAddress>, pub block: AscPtr<AscEthereumBlock>, pub transaction: AscPtr<AscEthereumTransaction_0_0_2>, pub inputs: AscPtr<AscLogParamArray>, pub outputs: AscPtr<AscLogParamArray>, } impl AscIndexId for AscEthereumCall_0_0_3 { const INDE...
Rust
0
ices_for_sampling[n_train_interactions:]] URM_train_builder.add_data_lists(URM_train.row[indices_for_train], URM_train.col[indices_for_train], URM_train.data[indices_for_train]) URM_validation_builder.add_data_lists(URM_train.row[indic...
Python
1
STDOUT') self.user.assert_icommand(['imeta', 'ls', '-C', self.user.session_collection], 'STDOUT', [ f'attribute: {avu_prefix}_0\nvalue: 4\n', f'attribute: {avu_prefix}_1\nvalue: *A\n', f'attribute: {avu_prefix}_2\nvalue: INT_PI\n', ...
Python
1
lista_frutas = ["maca", "kiwi", "pessego", "laranja", "melancia", "abacaxi"] tupla_frutas = tuple(lista_frutas) print("Frutas armazenadas na tupla:") print(tupla_frutas)
Python
1
p() a = s.pop() s.append(a - b) case "*": b = s.pop() a = s.pop() s.append(a * b) case "/": b = s.pop() a = s.pop() s.append(a // b) case "~": ...
Python
1
''' Realizar un programa que simule un dado de 6 caras (6 nรบmeros) sea lanzado 3 veces y al final muestre la sumatoria de cada uno de los lanzamientos ''' #Importamos el modulo random import random #Definimos las variables a emplear en nuetro ejercicio resultados = [] sumatoria = 0 #Definimos un ciclo for para hac...
Python
1
") for i in id0List: prinfo(i) print() if id0Count != 1: prbad(f"Error 07: You don't have 1 ID0 in your Nintendo 3DS folder, you have {id0Count}!") prinfo("Consult: https://3ds.hacks.guide/troubleshooting#installing-boot9strap-mset9 for help!") exitOnEnter() if id1Count != 1: prbad(f"Error 12: You don't have 1 ID...
Python
1
[doc = "Peripheral ID 1"] pub mod pidr1; #[doc = "Peripheral ID 2\n\nThis register you can [`read`](crate::generic::Reg::read). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about avaliable fields see [pidr2](pidr2) module"] pub type PIDR2 = crate::Reg<u32, _PIDR2>; #[allow(missing_do...
Rust
0
.about("Set the status codes you're not interested in.")) .arg(Arg::new("threads") .short('t') .long("threads") .takes_value(true) .required(false) .env("RINZLER_THREADS") .default_value("50") .about("Set the maximu...
Rust
0
a: Some(Bytes(vec![0x07, 0x23])) } ] => "parity_call", vec![ r#"[{"to":"0x0000000000000000000000000000000000000123","value":"0x1"},{"data":"0x0493","from":"0x0000000000000000000000000000000000000321","to":"0x0000000000000000000000000000000000000123"},{"data":"0x0723","to":"0x000000000000...
Rust
0
ๅ‡บ SQR ๅ‡ฝๆ•ฐ็š„ๅฎšไน‰ๅŸŸใ€‚ๅ‚ๆ•ฐๅ€ผๆ˜ฏ๏ผš-52",), ExecInput::None )] )); } #[test] fn str() { assert_snapshot!(run( r#" 10 print str$(-0.003765e-1); str$(0); str$(1741579.23); "# .trim(), vec![(ExecResult::End, ExecInput::None)] )); } ...
Rust
0
buffer.set_text(""); buffer.insert_at_cursor(&results); }); gtk::main(); } <gh_stars>10-100 use clap::ArgEnum; use clap::{IntoApp, Parser}; use clap_generate::generate; use clap_generate::generators::{Bash, Elvish, Fish, PowerShell, Zsh}; #[derive(Debug, Parser)] struct Cli { #[clap(arg_en...
Rust
0
); prog.run( &mut TestInput::new(vec![String::from("8")]), &mut test_output, ) .unwrap(); assert_eq!(ProgState::Halt, prog.state); assert_eq!(vec!["1"], test_output.output); assert_eq!(vec![3, 3, 1108, 1, 8, 3, 4, 3, 99], prog.mem_state); } ...
Rust
0
"""Nile accounts module.""" import json import os from nile.common import ACCOUNTS_FILENAME from nile.utils import hex_address, normalize_number def register(pubkey, address, index, alias, network): """Register a new account.""" file = f"{network}.{ACCOUNTS_FILENAME}" if exists(pubkey, network): ...
Python
1
Type"))] pub fn SHORT_STANDARD<'env>(env: &'env __jni_bindgen::Env) -> __jni_bindgen::std::option::Option<__jni_bindgen::Local<'env, crate::android::icu::text::TimeZoneNames_NameType>> { unsafe { let (class, field) = env.require_class_static_field("android/icu/text/TimeZoneNames$Name...
Rust
0
BB_DRAM0_POWER_ENABLE = 1, } impl From<BB_DRAM0_POWER_A> for bool { #[inline(always)] fn from(variant: BB_DRAM0_POWER_A) -> Self { variant as u8 != 0 } } #[doc = "Reader of field `BB_DRAM0_POWER`"] pub type BB_DRAM0_POWER_R = crate::R<bool, BB_DRAM0_POWER_A>; impl BB_DRAM0_POWER_R { #[doc = r"Ge...
Rust
0
:with_capacity(self.mesh.cubes.len() * 8); let mut curves = IdxVec::with_capacity(self.mesh.curves.len()); mem::swap(&mut self.mesh.lines, &mut lines); mem::swap(&mut self.mesh.squares, &mut squares); mem::swap(&mut self.mesh.cubes, &mut cubes); mem::swap(&mut self.mesh.curves, &...
Rust
0
/{}/providers/{}/policyAssignments/{}/providers/Microsoft.PolicyInsights/policyStates/{}/summarize" , operation_config . base_path () , subscription_id , resource_group_name , authorization_namespace , policy_assignment_name , policy_states_summary_resource) ; let mut url = url::Url::parse(url_str).map_err(summ...
Rust
0
{ 'name': 'Budget Management', 'category': 'Accounting/Accounting', 'description': """ Use budgets to compare actual with expected revenues and costs """, 'depends': ['account'], 'data': [ 'security/account_budget_security.xml', 'security/ir.model.access.csv', 'views/account_...
Python
1
details * * @return * TRUE on success otherwise FALSE * */ pub fn OCI_QueueTableMigrate(con: *mut OCI_Connection, queue_table: *const otext, compatible: *const otext) -> ::std::os::raw::c_int; } extern "C" { /** * @brief * Register a...
Rust
0
import os import shutil import subprocess import tarfile import os import pandas as pd import numpy as np from PIL import Image print("Preparing dataset..") with tarfile.open("fer2013.tar.gz", "r") as tar: tar.extractall("fer2013") output_folder_path = "FER2013" # Load the CSV file into a Pandas DataFrame df = p...
Python
1
from socket import * import sys # Get command line arguments server_host = sys.argv[1] server_port = int(sys.argv[2]) filename = sys.argv[3] # Create a client socket clientSocket = socket(AF_INET, SOCK_STREAM) # Connect to the server clientSocket.connect((server_host, server_port)) # Send the HTTP GET request reque...
Python
1
/// Returns the name of a `XAtom`. /// # Errors /// /// Errors if `XAtom` is not valid. // `XGetAtomName`: https://tronche.com/gui/x/xlib/window-information/XGetAtomName.html pub fn get_xatom_name(&self, atom: xlib::Atom) -> Result<String, XlibError> { unsafe { let cstring = ...
Rust
0
ok!(NomineesElectionModule::rebond(Origin::signed(ALICE), 150)); assert_eq!(NomineesElectionModule::ledger(&ALICE).total, 1000); assert_eq!(NomineesElectionModule::ledger(&ALICE).active, 850); assert_eq!(NomineesElectionModule::ledger(&ALICE).unlocking.len(), 2); assert_eq!(NomineesElectionModule::ledger(&A...
Rust
0
.unknown_fields } fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { &mut self.unknown_fields } fn as_any(&self) -> &dyn (::std::any::Any) { self as &dyn (::std::any::Any) } fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { self as &mut dyn (::s...
Rust
0
or_type != 'variable_declarator' and check_edge(cpg, current_node, _cur_successor) in ['100']: if _cur_successor_type == 'type_identifier': identified_type = cpg.nodes[_cur_successor]['cpg_node'].node_token elif _cur_successor_type in ['integral_type', 'fl...
Python
1
# Copyright 2024 Garena Online Private 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 agr...
Python
1
0.filter_mask_id_high = u32::from(OSCC_STEERING_DISABLE_CAN_ID << 5); f0.filter_id_high = u32::from(OSCC_FAULT_REPORT_CAN_ID << 5); // Filter 1, bound to FIFO_1 // - control command IDs for brake, throttle, and steering let mut f1 = CanFilterConfig::default(); f1.filter_number = 1; f1.enabled =...
Rust
0
, self.parsed_url["port"] ) aia = self.return_cert_aia(ssl_certificate) if aia is not None and not self.return_cert_aia(ssl_certificate): logging.error( "Could not find AIA, possible decryption taking place upstream?" ) sys.exit(1) s...
Python
1
pe: oci.database_migration.models.HostDumpTransferDetails """ self._source = source @property def target(self): """ Gets the target of this OracleNfsDataTransferMediumDetails. :return: The target of this OracleNfsDataTransferMediumDetails. :rtype: oci.database_m...
Python
1
None, realloc: None, } } } /// Possible encodings of strings within the component model. // // Note that the `repr(u8)` is load-bearing here since this is used in an // `extern "C" fn()` function argument which is called from cranelift-compiled // code so we must know the representation of thi...
Rust
0
text_value != value: return False return True # ุงู„ุชุนุงู…ู„ ู…ุน ุงู„ุดุฑูˆุท ุงู„ู…ุฑูƒุจุฉ if "operator" in conditions and "conditions" in conditions: operator = conditions["operator"].upper() sub_conditions = conditions["conditions"] if operator == "A...
Python
1
256, 1, 0), (1, 56, 56, 128, 3, 3, 256, 1, 1), (1, 56, 56, 192, 1, 1, 128, 1, 0), (1, 112, 112, 64, 3, 3, 192, 1, 1), (1, 448, 448, 3, 7, 7, 64, 2, 3) ] names = [ "yolo24_b1", # "yolo24_b8", # "yolo24_b64", # "yolo24_b256", "yolo19_b1", ...
Python
1
ce.currency if checkout_price.amount is None or checkout_price.amount > 0: logger.debug( f"Skipping course '{course_name}' as it now costs {_price}" ) self.stats.expired += 1 course_is_free = False # Get the listed...
Python
1
# Code generated by Lark OpenAPI. from typing import Any, Optional, Union, Dict, List, Set, IO, Callable, Type from lark_oapi.core.model import BaseRequest from lark_oapi.core.enum import HttpMethod, AccessTokenType from .batch_delete_mailgroup_member_request_body import BatchDeleteMailgroupMemberRequestBody class B...
Python
1
from telegram import Update from telegram.ext import ContextTypes, MessageHandler, filters from handlers.base_handler import BaseHandler class LocationHandler(BaseHandler): @classmethod def register(cls, app): location_handler = MessageHandler(filters.LOCATION, cls.callback) app.add_handler(l...
Python
1
ec> for DagPbCodec { fn from(_: Multicodec) -> Self { Self } } impl Codec for Multicodec {} impl Encode<Multicodec> for Ipld { fn encode<W: Write>(&self, c: Multicodec, w: &mut W) -> Result<()> { match c { Multicodec::Raw => self.encode(RawCodec, w)?, #[cfg(feature ...
Rust
0
# Part of Odoo. See LICENSE file for full copyright and licensing details. from odoo import models, fields class L10nLatamIdentificationType(models.Model): _inherit = "l10n_latam.identification.type" l10n_pe_vat_code = fields.Char()
Python
1
# Copyright 2025 The KServe Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wr...
Python
1
import pymongo, csv client = pymongo.MongoClient() db = client.chinamovies collections = db.movies collections_detail = db.moviesdetail col_casts = db.casts col_directors = db.directors # ๅฐ†ๆฏไธชๅฝฑไบบ2018ๅนดๅ‚ๆผ”็”ตๅฝฑ็š„็ฅจๆˆฟๆ€ปๅ’Œๅฏผๅ‡บๆ•ฐๆฎๅบ“๏ผŒๅญ˜ๅ…ฅ cast_data.csv with open('cast_data.csv','w',newline='',encoding='utf-8') as file: cast_list = ['ๆผ”ๅ‘˜...
Python
1
# -*- coding: utf-8 -*- # @Time : 2023/3/9 16:35 # @Author : ่”้ธฃ้œธ้œธ # @FileName: qizhidao.py # @Software: PyCharm # @Blog ๏ผšๅชๅ› ไฝ ๅคช็พŽ import base64 # from Crypto.Cipher import AES from Cryptodome.Cipher import AES from Cryptodome.Util.Padding import unpad import requests, execjs def decrypt(data): html = base64....
Python
1
value = 1.0 value = value*gradients[i] dims = [i for i in range(len(value.shape))] dims = tuple(dims) value = ops.norm(value,p=2,axis=dims) test.append(value) test = stack(test) test = ops.norm(test,p=2,axis=0) return test class SharpLoss(nn.Cell): def __i...
Python
1
# # Copyright (c) 2021, NVIDIA CORPORATION. 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 appl...
Python
1
[inline(always)] fn from_MuBool(cbool: CMuBool) -> bool { cbool != 0 } // APIHandle is immutable when used. #[inline(always)] fn from_handle<'a>(cmuvalue: CMuValue) -> &'a APIHandle { debug_assert!(!cmuvalue.is_null()); unsafe { &*(cmuvalue as *const APIHandle) } } #[inline(always)] fn from_handle_optiona...
Rust
0
self.stemmed_word_to_equiv_word_count[_stemmed_word][_word] = count_yet + 1 # += 1 else: self.stemmed_word_to_equiv_word_count[_stemmed_word][_word] = 1 else: self.stemmed_word_to_equiv_word_count[_stemmed_word] = {_w...
Python
1
impl $ty { vector_methods![$ty, qa=$q, Qa=$Q, pa="Y", Pa="yotta", f=1e24, fu="10ยฒโด"]; vector_methods![$ty, qa=$q, Qa=$Q, pa="Z", Pa="zetta", f=1e21, fu="10ยฒยน"]; vector_methods![$ty, qa=$q, Qa=$Q, pa="E", Pa="exa", f=1e18, fu="10ยนโธ"]; vector_met...
Rust
0
move || { for stream in socket.incoming() { match stream { Ok(stream) => { let server_clone = server.clone(); spawn(|| handle_client(stream, server_clone)); } Err(_) => { break; ...
Rust
0
#!/usr/bin/python # # Copyright 2018 Google LLC # # 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 ag...
Python
1