text
string
label_name
string
labels
int64
# ๋ฐฑ์ค€ 31885 Yunny's Trip ๊ณจ3 import sys input = sys.stdin.readline # N(1~2*10^5), K(1~5) N, K = map(int, input().split()) # -10^12~10^12 items = [list(map(int, input().split())) for _ in range(N)] # -10^12~10^12 end_x, end_y = map(int, input().split()) # ๋ชฉ์ ์ง€๊นŒ์ง€ ๊ธฐ๋ณธ์ด๋™ ์‹œ ๊ธฐ๋ ฅ๋Ÿ‰ ans = abs(end_x) + abs(end_y) # ๋‘๋ฒˆ์งธ ์•„์ดํ…œ์„ ์ผ์„ ๋•Œ ๋ชฉ...
Python
1
import time import geocoder import ipinfo # Set up your IPInfo access token access_token = 'YOUR_IPINFO_ACCESS_TOKEN' handler = ipinfo.getHandler(access_token) def get_location(): # Get IP-based location g = geocoder.ip('me') if g.latlng: print(f"Latitude: {g.latlng[0]}, Longitude: {g.latlng[...
Python
1
ith_system(setup_countdown) .with_system(show_ui::<CountdownUITag>), ) .add_system_set(SystemSet::on_update(GameState::Countdown).with_system(track_countdown)) .add_system_set( SystemSet::on_exit(GameState::Countdown).with_system(hide_ui::<CountdownUITag>), ) ...
Rust
0
uttonStyle( bgcolor={ ft.ControlState.HOVERED: ft.Colors.GREY_100 } ), on_click=handle_alignment_click, ), ...
Python
1
import unittest import numpy as np from open_room_climate import ClimateDataGenerator, ClimatePlotter class TestClimateDataGenerator(unittest.TestCase): def test_generate_data(self): num_points = 100 generator = ClimateDataGenerator(num_points) data = generator.generate_data() self...
Python
1
# Copyright (c) 2022-2025, The Isaac Lab Project Developers. # All rights reserved. # # SPDX-License-Identifier: BSD-3-Clause from isaaclab.utils import configclass from isaaclab_rl.rsl_rl import RslRlOnPolicyRunnerCfg, RslRlPpoActorCriticCfg, RslRlPpoAlgorithmCfg @configclass class LeftLegReachPPORunnerCfg(RslRlOn...
Python
1
el = logging.getLevelName(logLevelString) else: level = logging.INFO return level def main(): #configure logging logging.basicConfig( format='%(asctime)s,%(msecs)d %(name)s %(levelname)s %(message)s', datefmt='%Y-%m-%d %H:%M:%S', level=getL...
Python
1
# Show error briefly return splash = cv2.resize(splash, (UIConstants.WINDOW_WIDTH, UIConstants.WINDOW_HEIGHT)) # Add instructions to the splash screen cv2.putText( splash, "Click or press Esc to continue", (50, UIConstants.WINDOW_HEIGHT - 50), cv2.FONT_HERSHEY_SIMP...
Python
1
#[global_allocator] static ALLOC: wee_alloc::WeeAlloc = wee_alloc::WeeAlloc::INIT; /// Structure that is used to hold thin rows by stanza: #[derive(Serialize, Deserialize)] pub struct Thin { pub by_stanza: BTreeMap<String, Vec<Vec<String>>>, } /// Sends back a serialised version of an empty Thin struct. #[wasm_bi...
Rust
0
, run_id: str, step_id: str, ) -> RunStepObject: ... def get_thread( self, thread_id: str, ) -> ThreadObject: ... def list_assistant_files( self, assistant_id: str, limit: int, order: str, after: str, bef...
Python
1
ys().map(|p| p.1).max().unwrap(); let mut grid: Grid = vec![vec![0; max_y + 2]; max_x + 2]; for x in 0..max_x + 2 { for y in 0..max_y + 2 { let mut set = false; let mut min_d = 0; let mut closest = 0; for (&p, &k) in points.iter() { let d ...
Rust
0
evalute forward for tok in tail.iter() { match tok { Token::Number(n) => { net = last_op(net, *n); } Token::Plus => last_op = &mut add_n, Token::Mult => last_op = &mut mult_n, _ => {} } ...
Rust
0
DOUT): name = publisher publisher_list = Low_IF_publications[name] One_key_download(Key_words_fun2, Screen_words_fun2, publisher_list, API_key, year_start, year_end, name, only_high_IF=only_High_if_fun2, only_second_third=only_low_if_fun2,...
Python
1
(D5, 1, 4, 90), (A5, 1, 4, 90), (B5, 1, 8, 90), (A5, 1, 8, 90), (A5, 1, 4, 90), (G5, 1, 8, 90), (B5, 1, 8, 90), (B5, 1, 8, 90), (B5, 1, 8, 90), (B5, 1, 4, 90), (B5, 1, 4, 90), (B5, 1, 8, 90), (D6, 1, 8, 90), (C6, 1, 8, 90), (B5, 1, 8, 90), (A5, 1, 8, 90), ...
Rust
0
del = torch.load(best_model_path) model.load_state_dict(best_model) logger.info("Loading evaluation tasks") seeds = [0, DEFAULT_SEED, 84] eval_task_list: List[EvalTask] = [ *[ CropHarvestEval(country=country, ignore_dynamic_world=idw, seed=seed) for country in ["Kenya", ...
Python
1
# Generated by Django 4.2.1 on 2024-05-10 16:41 import datetime from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('courses', '0001_initial'), ('metrics', '0001_initial'), ] operations = [ migrations...
Python
1
# -*- coding: utf-8 -*- """ Created on Sun Jun 21 13:47:05 2020 MURAT KARAKAYA AKADEMฤฐ NASIL SUNSAM @author: kmkarakaya """ # %% # LOAD MODEL from joblib import load filename="myFirstSavedModel.joblib" clfUploaded = load(filename) # %% from sklearn.datasets import load_iris dataSet = load_iris() labelsNames = list(...
Python
1
ub struct UnorderedParMap<'pool, 'a, T: 'a + Send> { rx: mpsc::Receiver<Packet<T>>, _guard: JobHandle<'pool, 'a>, } impl<'pool, 'a,T: 'a + Send> Iterator for UnorderedParMap<'pool , 'a, T> { type Item = (usize, T); fn next(&mut self) -> Option<(usize, T)> { match self.rx.recv() { Ok...
Rust
0
st OVR_KEY_NECK_TO_EYE_DISTANCE: &'static [u8] = b"NeckEyeDistance\0"; // float[2] meters pub const OVR_DEFAULT_NECK_TO_EYE_HORIZONTAL: f32 = 0.0805; pub const OVR_DEFAULT_NECK_TO_EYE_VERTICAL: f32 = 0.075; pub const OVR_KEY_EYE_TO_NOSE_DISTANCE: &'static [u...
Rust
0
tomer-close-tx &ctx ), Ok(()) ); } // Verify tx_e (merch-spend-tx spending from merch-close-tx) { let ctx = Context::v1(150, &tx_e); assert_eq!( programs.verify( &tx_c.wtp...
Rust
0
t Vec<(TremorURL, pipeline::Addr)>, metrics_reporter: &mut RampReporter, ) -> Result<PipeHandlerResult> { if pipelines.is_empty() { match msg { onramp::Msg::Connect(ps) => { for p in &ps { if p.0 == *METRICS_PIPELINE { metrics_repor...
Rust
0
task_score[result["subset"]] = 0 task_num[result["subset"]] = 0 if result["answers"] in ["A", "B", "C", "D", "E"]: # MCQ tasks correct = eval_multi_choice(result["answers"], result["pred_answer"]) task_score[result["subset"]] += correct score += correct ...
Python
1
# Tic-Tac-Toe Program using # random number in Python # importing all necessary libraries import numpy as np import random from time import sleep # Creates an empty board def create_board(): return np.array([[0, 0, 0], [0, 0, 0], [0, 0, 0]]) # Check for empty places on board def possibilities(board): l = []...
Python
1
insert(TypeOrLanguage::Type, "@none"); } insert(TypeOrLanguage::Language, &lang_dir); } } } result } pub(crate) fn select_term<'a, T>( active_context: &'a Context<T>, var: &str, containers: Vec<Container>, type_language: TypeOrLanguage, preferred_values: Vec<&str> ) -> Option<&'a str> where ...
Rust
0
e result of this iteration value = 4.0 * float(num_true) / float(num_send) delta = (value - math.pi) / math.pi if count % 512 == 0: print(f"{count}: pi={value}, error={delta}") sys.stdout.flush() count += 1 print(f"Final value after {count} iterations: pi={...
Python
1
Button(label: *const c_char, size: ImVec2) -> u8; pub fn igSmallButton(label: *const c_char) -> u8; pub fn igInvisibleButton(str_id: *const c_char, size: ImVec2) -> u8; pub fn igImage(user_texture_id: ImTextureID, size: ImVec2, uv0: ImVec2, uv1: ImVec2, tint_col: ImVec4, border_col: ImVec4) -> (); pub f...
Rust
0
; let result = f(self); self.scope = scope; result } } impl Reader for UperReader { type Error = UperError; #[inline] fn read_sequence< C: sequence::Constraint, S: Sized, F: Fn(&mut Self) -> Result<S, Self::Error>, >( &mut self, f: F,...
Rust
0
MAX_SATURATING_ADD_ONE, MAX); const ZERO_SATURATING_SUB_ONE : Duration = ZERO.saturating_sub(ONE); assert_eq!(ZERO_SATURATING_SUB_ONE, ZERO); const MAX_SATURATING_MUL_TWO : Duration = MAX.saturating_mul(2); assert_eq!(MAX_SATURATING_MUL_TWO, MAX); } fn main() { duration(); } /* Break repeating-k...
Rust
0
""" Write a python function to interchange the first and last elements in a list. assert swap_List([12, 35, 9, 56, 24]) == [24, 35, 9, 56, 12] """ def swap_list(input_list): """ This function takes a list as an argument and returns a new list with the first and last elements interchanged. """ if len(inp...
Python
1
tree_index_map = HashMap::<u64, u64>::new(); let mut tree_index_to_node_id_map = HashMap::<u64, u64>::new(); let contents = match &sector.sector_contents { Some(x) => x, None => { return Sector { faces, node_id_to_tree_index_map, tree_i...
Rust
0
y assumptions about the order of the feeds if feeds[0].key != "feed key": feeds.reverse() assert feeds[0].key == "feed key" assert feeds[0].title == "feed title" assert feeds[0].description == "feed description" assert feeds[0].link == "feed link" assert feeds[0].last_build_date == "fee...
Python
1
4= {}", 15 / 4); println!("18%4= {}", 18 % 4); } fn scientific_calc() { let neg_4 = -4i32; println!("abs(-4)= {}", neg_4.abs()); println!("2^6 = {}", 2i32.pow(6)); println!("sqrt 9 = {}", 9f64.sqrt()); println!("27 cbrt 9 = {}", 27f64.cbrt()); println!("Round 1.45 = {}", 1.45f64.round()); ...
Rust
0
} #[no_mangle] pub extern "C" fn virtio_dma_dealloc(pa: PhysAddr, pages: usize) -> i32 { // not dropping queue??? mulit drop??? let mut ppn_base: PhysPageNum = pa.into(); for _ in 0..pages { free_frame(ppn_base); ppn_base.step(); } 0 } #[no_mangle] pub extern "C" fn virtio_phys_to...
Rust
0
reUnit); /// glActiveVaryingNV /// * `program` class: program /// * `name` len: COMPSIZE(name) pub type glActiveVaryingNV_t = unsafe extern "system" fn(program: GLuint, name: *const GLchar); /// glAlphaFragmentOp1ATI /// * `op` group: FragmentOpATI pub type glAlphaFragmentOp1ATI_t = unsafe extern "system" fn(op: Frag...
Rust
0
import unittest from selenium import webdriver from selenium.webdriver.common.by import By class Typos(unittest.TestCase): def setUp(self): self.driver = webdriver.Chrome() driver = self.driver driver.get('https://the-internet.herokuapp.com/') driver.find_element(By.LINK_TEXT,...
Python
1
g a lot of these then maybe we are not cleaning // banned peers up correctly? if adapter.is_banned(self.peer_info.addr) { debug!( "handler: consume: peer {:?} banned, received: {}, dropping.", self.peer_info.addr, message, ); return Ok(Consumed::Disconnect); } let consumed = match message { ...
Rust
0
Deprecated' // @has - '//span' 'sync' pub use tag::Portability; } // @has foo/mod3/index.html pub mod mod3 { // @has - '//code' 'pub use tag::Both;' // @has - '//span' 'Deprecated' // @has - '//span' 'sync' pub use tag::Both; } // @has foo/mod4/index.html pub mod mod4 { // @has - '//code' ...
Rust
0
extract_ps(V, 2); } #[cfg(all(_XM_SSE_INTRINSICS_, not(_XM_SSE4_INTRINSICS_)))] unsafe { let pDestination: *mut XMFLOAT3 = mem::transmute(pDestination); _mm_store_sd(mem::transmute::<_, *mut f64>(pDestination), _mm_castps_pd(V)); let z: __m128 = XM_PERMUTE_PS!(V, _MM_SHUFFLE(2, 2, 2...
Rust
0
let x_coordinates = Array::linspace(screen_coordinates.x0, screen_coordinates.x1, width); let x_coordinates_chunks = x_coordinates.iter().cloned().enumerate().chunks((width as f64 / threads as f64).ceil() as usize); for x_coordinates_chunk in x_coordinates_chunks.into_iter() { let img_thread = img_sco...
Rust
0
= ::std::option::Option< unsafe extern "C" fn(c: *const grib_context, stream: *mut ::std::os::raw::c_void) -> off_t, >; #[doc = " Grib data seek, format of a procedure referenced in the context that is used to seek the current position in a stream"] #[doc = ""] #[doc = " @param c : the context where th...
Rust
0
thought[:100]}...") try: agent = self._get_agent() prompt = COMPLEXITY_ANALYSIS_PROMPT.format(thought=thought_data.thought) # Get AI analysis result = await agent.arun(input=prompt) # Extract JSON response response_text = self._extract_r...
Python
1
force_crc.unwrap_or_else(|| self.crc()).to_be_bytes(), b"\x50\xA0", ]) } /// Create a frame to be sent trough serial port /// /// This converts message to binary and adds header, footer and CRC pub fn to_control_frame(&self) -> Vec<u8> { self.to_control_frame_with(None) ...
Rust
0
# https://leetcode.com/problems/maximum-product-subarray/ class Solution: def maxProduct(self, nums: List[int]) -> int: mp = nums[0] # max product cp = 1 # current product for i in nums: cp *= i mp = max(cp, mp) if cp == 0: cp = 1 ...
Python
1
import pytest from pydantic import BaseModel, Field from flask_openapi3 import OpenAPI app = OpenAPI(__name__) app.config["TESTING"] = True @pytest.fixture def client(): client = app.test_client() return client class LoginRequest(BaseModel): email: str = Field(..., description="User email") passwo...
Python
1
"PureKeyword", "TypeKeyword", "ViewKeyword", "ConstructorKeyword", "FallbackKeyword", "ReceiveKeyword", "Identifier", "IdentifierStart", "IdentifierPart", "StringLiteralFragment", "DoubleQuotedStringCharacter", "SingleQuotedStringCharacter", "Vers...
Python
1
s, and how to apply and follow the GNU GPL, see <https://www.gnu.org/licenses/>. The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. ...
Python
1
z3.foldl_exps(0, |acc, e| acc + *e), 6); } #[test] fn test_foldl_exps_4d() { let xy2z3t4 = Mon4d { exps: [Deg(1), Deg(2), Deg(3), Deg(4)] }; assert_eq!(xy2z3t4.foldl_exps(0, |acc, e| acc + *e), 10); } #[test] fn test_num_mons_with_deg_lim() { assert_eq!(monomial::num_mons_with_deg_lim(MaxMonDeg(2), 2), 6); ...
Rust
0
ids, pending_peg_outs): (Vec<minimint_api::OutPoint>, Vec<PendingPegOut>) = self.pending_peg_outs().into_iter().unzip(); let urgency = pending_peg_outs .iter() .map(|peg_out| round_consensus.block_height - peg_out.pending_since_block) .sum::<u32>(); trace...
Rust
0
re.match(slogger.REGEX_MATCH, line) level: Optional[str] = match.group(1) if match else None else: level = None # remove level prefix line = re.sub(slogger.REGEX_MATCH, '', line) self._log_monitored_stream(line, stre...
Python
1
f64 = if res_use_deg { rad2deg(ops_fn(rad)) } else { ops_fn(rad) }; Number::Float(res) } } } /// Calculate cosine of a `Number` /// /// # Example /// ```rust /// use calculator_util::{operations::cos, number::Number}; /// /// let n: Num...
Rust
0
data["l"], "Close": filterdata["c"], "Volume": filterdata["v"], "close_time": filterdata["T"], "quote_av": filterdata["q"], "trades": filterdata["n"], "tb_base_av": filterdata["V"], "tb_quote_av": filterdata[...
Python
1
01 = coords1 - coords0 H, W = depth1.shape coords1 = reproject(depth1, data["T1"], data["T0"], data["K1"], data["K0"]) x, y = np.meshgrid(np.arange(W), np.arange(H), indexing="xy") coords0 = np.stack([x, y], axis=-1) flow_10 = coords1 - coords0 return flow_01, flow_10 def check_cycle_consist...
Python
1
#!/usr/bin/env python # # SPDX-FileCopyrightText: 2014-2022 Fredrik Ahlberg, Angus Gratton, # Espressif Systems (Shanghai) CO LTD, other contributors as noted. # # SPDX-License-Identifier: GPL-2.0-or-later from __future__ import division, print_function import sys # Compare the esptool stub loaders to freshly built ...
Python
1
); // Assert assert_eq!(order_history.len(), 1); assert_eq!(order_history[0].order_uuid, "fd97d393-e9b9-4dd1-9dbf-f288fc72a185"); } #[test] fn should_get_withdrawal_history_successfully() { // Arrange let _mock = mock("GET", Matcher::Regex(r"^/account/getwithdrawalhistory\?&apikey=(.*)$".to_string...
Rust
0
kshop, UploadWorkshop, } pub fn get_single_achievement(client: Arc<Client>, ach: ManualAchievements) { wrap(move || get_single_achievement_impl(client, ach)); } fn get_single_achievement_impl(client: Arc<Client>, ach_type: ManualAchievements) { let stats = client.user_stats(); let ach = stats.achievem...
Rust
0
tas ringan seperti jalan kaki selama 30 menit setiap hari.\n" "- Tambahkan aktivitas peregangan atau yoga untuk meningkatkan fleksibilitas." ) elif activity_level == "lightly active": exercise_plan = ( "Dengan aktivitas ringan:\n" "- Lakukan latihan aerobik modera...
Python
1
expected, parse_gst(input)); } } // Copyright 2017 <NAME> // // Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or http://apache.org/licenses/LICENSE-2.0> or the // MIT license <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your option. This file may not be copied, // modified, or distribut...
Rust
0
:math::Mat4::from_axis_angle(Vec3::X, -pih) * tx_offset; let tx_down = bevy::math::Mat4::from_axis_angle(Vec3::X, pih) * tx_offset; let tx_front = bevy::math::Mat4::from_axis_angle(Vec3::Z, pih) * tx_offset; let tx_back = bevy::math::Mat4::from_axis_angle(Vec3::Z, -pih) * tx_offset; /* ...
Rust
0
mut B: Vec<f64> = vec![]; for i in 0..p.len() { let block_comp_time = compute_times[p[i].0 as usize][p[i].1 as usize] / p[i].2 as f64 / rp as f64 / m_batch as f64; F.push(block_comp_time / 2.0); B.push(block_comp_time / 2.0); if i != p.len() - 1 {...
Rust
0
import base64 from concurrent.futures import ThreadPoolExecutor import sys import time import pathlib sys.path.append(str(pathlib.Path(__file__).resolve().parents[2] / 'lib')) from key import Key from argparse import ArgumentParser, Action from urllib.parse import urlparse from configured_logger import logger from tr...
Python
1
() )) } } Err(_err) => Err(format!("Failed to access API for {}", self.path)), } } } use crate::gpio_handler::GpioHandler; use std::thread; pub struct ComplexMovementHandler{ movements : i32 } impl ComplexMovementHandler{ pub fn new()->Self{ Self{ movemen...
Rust
0
๏ฟฝ', '๐“‡ค', '๐‘ดฌ', '\u{11950}', '๐Ÿข—', '๊‰„', '๐Ÿงช', '๐›‹ฎ', 'โพ™', '๊“น', 'แฃ˜', '\u{ad}', '๊—ฑ', 'โŸ•', '\u{1e2f5}', 'โธ', '\u{18b99}', '๊›‘', '๐”ฅ', '๊งƒ', '\u{e0072}', '๊›Œ', 'ใˆ„', '๐ˆ–', 'โตž', 'ํžน', '๊†ข', 'โ…ช', 'เถ‘', '๊ƒ™', 'ใ…ณ', 'แŽง', '\u{615}', 'แŠน', '๊’›', '\u{1ed17}', '๏ฟ‡', '\u{e005c}', 'แฟจ', 'โพบ', 'ำจ', 'โฌฌ', '๐จต', '๐™˜', '\u{aa35}', '...
Rust
0
ConstraintJobSkills { all_of: skills.all_of.as_ref().map(|all_of| all_of.iter().cloned().collect()), one_of: skills.one_of.as_ref().map(|any_of| any_of.iter().cloned().collect()), none_of: skills.none_of.as_ref().map(|none_of| none_of.iter().cloned().collect(...
Rust
0
#!/usr/bin/env python # -*- coding: utf-8 -*- import json from alipay.aop.api.constant.ParamConstants import * from alipay.aop.api.domain.ReferenceId import ReferenceId class AnttechBlockchainDefinSaasAgreementQueryModel(object): def __init__(self): self._out_member_id = None self._platform_memb...
Python
1
yError` will be raised if the plugin type or plugin does not exist. Parent types are always included. Child plugins will only be included if a valid, non-blacklisted plugin is available. """ if not self.loaded: self.load_modules() # pylint: disable=protected-access...
Python
1
"json_field2" => Value::Bytes("value3".into()) })), ), // ignore non-map root-level fields ( "%{notSpace:standalone_field} %{data::integer}", r#"value1 1"#, Ok(Value::from(btreemap! { "standalone_fiel...
Rust
0
char; answer[1] = (b'1' + (square / 10 - 2)) as char; answer } pub fn update_pieces (cboard: &mut chessboard) { unsafe { for index in &chocolate[..playable_size] { let piece = cboard.layout[*index as usize]; if piece != piece::Empty as u8 { cboard.piece_lis...
Rust
0
"https://mail.google.com/".to_string(), )) // This example will be running its own server at localhost:8080. // See below for the server implementation. .set_redirect_url(RedirectUrl::new( Url::parse("http://localhost:8080").expect("Invalid redirect URL"), )); // Generate the authoriz...
Rust
0
from django.conf import settings from django_telethon.importer import import_attribute def get_telethon_config(key, default=None): """Fetch configuration from DJANGO_TELETHON in Django settings.""" return getattr(settings, 'DJANGO_TELETHON', {}).get(key, default) # Retrieve configuration values RABBITMQ_AC...
Python
1
'train', **kwargs): B_l = len(coords_large) if mode=='train': if H < 0: H_l = int(np.sqrt(B_l)) W_l = B_l // H_l assert H_l * W_l == B_l else: H_l = H W_l = W else: H_l = B_l ...
Python
1
import nltk from nltk.corpus import stopwords from nltk.tokenize import word_tokenize from nltk.stem.snowball import SnowballStemmer class TextParser: def __init__(self): nltk.download('punkt') nltk.download('stopwords') self.stemmers = { 'english': SnowballStemmer('english'), ...
Python
1
fn from(err: E) -> Self { GroupUserAddFailed::InternalError(ate::utils::obscure_error(err)) } } <reponame>pixunil/tiny-transport<filename>import/src/service/importer.rs use std::collections::HashMap; use std::error::Error; use std::rc::Rc; use super::{Service, ServiceExceptionRecord, ServiceId, Service...
Rust
0
pub fn join_components(&mut self, j: usize) { let Lambda: HashSet<_> = (0..self.M.count()) .filter(|l| { self.M_star.borrow().get(*l, j).unwrap() == 1 && self.M_star.borrow().get(j, *l).unwrap() == 1 }) .collect(); let lambda ...
Rust
0
o cg/@sddlZddlZddZdS)Ncs(tddtfdd}|S)ze Wrap a method such that when it is called, the args and kwargs are saved on the method. args_and_kwargsz args kwargscs6dj}||}t|...
Python
1
:var("SLEPC_DIR").unwrap(), String::from("include")] .iter() .collect(); let slepc_arch_include_dir: PathBuf = [ env::var("SLEPC_DIR").unwrap(), env::var("PETSC_ARCH").unwrap(), String::from("include"), ] .iter() .collect(); let slepc_lib_dir: PathBuf = [ ...
Rust
0
u{00C0}' && c <= '\u{00D6}') || (c >= '\u{00D8}' && c <= '\u{00F6}') || (c >= '\u{00F8}' && c <= '\u{02FF}') || (c >= '\u{0370}' && c <= '\u{037D}') || (c >= '\u{037F}' && c <= '\u{01FFF}') || (c >= '\u{200C}' && c <= '\u{200D}') || (c >= '\u{2070}...
Rust
0
') => DoubleQuoted, Some(c @ '$') | Some(c @ '`') | Some(c @ '"') | Some(c @ '\\') => { word.push(c); DoubleQuoted } Some(c) => { word.push('\\'); word.push(c); DoubleQuote...
Rust
0
let request = tonic::Request::new(GetTracksByIDsRequest { ids }); let response = client.get_tracks_by_ids(request).await?.into_inner(); for p in response.tracks { map.insert(p.id, p.into()); } Ok(()) } pub struct TrackBatcher { channel: Channel, } impl TrackBatcher { pub fn new(chann...
Rust
0
import heapq def make_graph(): # tuple = (cost, n1, n2) return { 'A': [(3, 'D', 'A'), (4, 'B', 'A'), (5, 'E', 'A')], 'B': [(4, 'A', 'B'), (2, 'C', 'B')], 'C': [(2, 'B', 'C'),(1, 'D', 'C')], 'D': [(3, 'A', 'D'), (1, 'C', 'D')], 'E': [(5, 'A', 'E')], } def prim...
Python
1
conn = pool.clone().get().unwrap(); let stops = conn.query(query, &[&p1.lat, &p1.lng, &p2.lat, &p2.lng]); let mut stops_result: Vec<Stop> = Vec::new(); for row in stops.expect("Query failed").iter() { let stop = parse_stop_row(&row); stops_result.push(stop); } stops_result } fn ...
Rust
0
# coding=utf-8 # Copyright 2018 The Microsoft Research Asia LayoutLM Team 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 # # Unles...
Python
1
# src/tests/test_statistics.py from statistics import mean, median def test_mean(): assert mean([1, 2, 3]) == 2 assert mean([]) == 0 def test_median(): assert median([1, 2, 3]) == 2 assert median([1, 2, 3, 4]) == 2.5
Python
1
x) # print_recursive_shape('first', first) # print_recursive_shape('state', state) return module(x, first, state) def _banded_repeat(x, t): """ Repeats x with a shift. For example (ignoring the batch dimension): _banded_repeat([A B C D E], 4) = [D E 0 0 0] [C D E 0...
Python
1
ts = "K" elif args.target_variable == "sftlf": pass else: clim_ac.units = d.units # Rewrite variable attributes print(args.target_variable) print(clim_ac.shape) clim_ac.id = args.target_variable clim_ac.name = args.target_variable clim_ac.source_name = args.file_variable att_keys = list(d.attributes.keys()) for...
Python
1
ollection_idx", collection_idx = collection_idx, ); let conn = self.pool.get().await?; let x: Option<(i32,)> = query.fetch_opt(&conn).await?; Ok(x.map(|(x,)| x)) } pub async fn remove_from_queue_by_path(&self, path: &str) -> Result<(), Error> { let mc = Movie...
Rust
0
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # This file is referred and derived from project NetworkX # # which has the following license: # # Copyright (C) 2004-2020, NetworkX Developers # Aric Hagberg <hagberg@lanl.gov> # Dan Schult <dschult@colgate.edu> # Pieter Swart <swart@lanl.gov> # All rights reserved. # #...
Python
1
.clone()) } pub(crate) fn set(&mut self, key: &str, value: T) { self.inner.insert( key.to_string(), CacheItem { valid_until: SystemTime::now() + Duration::from_secs(60 * 30), value, }, ); } } #[derive(Clone)] pub(crate) st...
Rust
0
from django.core.exceptions import ImproperlyConfigured import environ env = environ.Env() BASE_DIR = environ.Path(__file__) - 2 def env_to_enum(enum_cls, value): for x in enum_cls: if x.value == value: return x raise ImproperlyConfigured(f"Env value {repr(value)} could not be found in...
Python
1
/// Represents the contents of the original request that was passed to /// the `[Streaming]DetectIntent` call. #[derive(Clone, PartialEq, ::prost::Message)] pub struct OriginalDetectIntentRequest { /// The source of this request, e.g., `google`, `facebook`, `slack`. It is set /// by Dialogflow-owned servers. ...
Rust
0
three-dimensional affine rotation matrix rotating a vector around the /// **x-axis** by an angle `angle` radians/degrees. /// /// # Example /// /// ``` /// # use cglinalg::{ /// # Matrix4x4, /// # Vector4, /// # Radians, /// # Angle, /// # }; /// # use...
Rust
0
from django.contrib import admin from django.utils.translation import gettext_lazy as _ from solo.admin import SingletonModelAdmin from .models import EmailConfig @admin.register(EmailConfig) class EmailConfigAdmin(SingletonModelAdmin): fieldsets = [ ( _("Template review request"), ...
Python
1
_alive()).collect::<Vec<&Unit>>()); println!("rest_unit_hp={}, rnd={}", rest_unit_hp, rnd); } return rnd * rest_unit_hp; } } 0 // Non reachable } fn main() -> Result<(), Box<Error>> { measure_exec(|| { let result = part1(&input()?); println!("...
Rust
0
Arc<Body>> { db.body_hir(self.def_id) } pub(crate) fn module(&self, db: &impl HirDatabase) -> Cancelable<Module> { self.def_id.module(db) } /// The containing impl block, if this is a method. pub(crate) fn impl_block(&self, db: &impl HirDatabase) -> Cancelable<Option<ImplBlock>> { ...
Rust
0
R5$) Return the figure's background patch visibility, i.e. whether the figure background will be drawn. Equivalent to ``Figure.patch.get_visible()``. r get_visible)r0s r3 get_frameonFigureBase.get_frameon zz%%''r6c:UR...
Python
1
], answer: false, }, ]; for (i, solution) in solutions.into_iter().enumerate() { for (j, test_case) in test_cases.iter().cloned().enumerate() { let test_answer = solution.is_valid_sudoku(test_case.input); assert_eq!(test_answer, test_case.answer,...
Rust
0
from fasthtml.common import * from claudette import * import asyncio # Set up the app, including daisyui and tailwind for the chat component tlink = Script(src="https://cdn.tailwindcss.com"), dlink = Link(rel="stylesheet", href="https://cdn.jsdelivr.net/npm/daisyui@4.11.1/dist/full.min.css") app = FastHTML(hdrs=(tlink...
Python
1
get extended later or pushed on at // the end. cur_loc = loc; cur_offset = offset; cur_len = len; } ret.push(InstructionAddressMap { srcloc: cvt(cur_loc), code_offset: cur_offset, }); if cur_offset + cur_len != code_size { ret.push(InstructionAddr...
Rust
0
om) -> io::Result<u64> { match pos { SeekFrom::Start(0) => Ok(0), SeekFrom::Start(_) => unimplemented!(), SeekFrom::Current(_) => unimplemented!(), SeekFrom::End(0) => Ok(self.max_size as u64), SeekFrom::End(_) => unimplemented!(), } } }//!...
Rust
0
name = storage.module_name(filename); storage.set_file(filename, s.to_string()); let _root = storage.look_up_definitions(&module_name)?; let root_entity = *storage .path_to_entity .get(&module_name) .expect("Expected an entity for the program"); Inter...
Rust
0
#Check if a number is even or odd i= int (input("enter a number")) if (i%2==0): print ("no is even") else : print ("no is odd") #Print first 10 natural numbers for i in range (1,11): print (i) #Sum of numbers in a list list = [1,10,20,15] total= 0 for list in list : total += list print (total) ...
Python
1