text
string
label_name
string
labels
int64
from globus_cli.parsing import group @group( "endpoint", lazy_subcommands={ "activate": ("_removal_stub", "removal_stub_command"), "create": ("_removal_stub", "removal_stub_command"), "deactivate": ("_removal_stub", "removal_stub_command"), "delete": (".delete", "endpoint_delet...
Python
1
rust_print("RUST: rust_tos_sem_destroy return K_ERR_OBJ_PTR_NULL\r\n\0".as_ptr()); return ; } rust_print("RUST: rust_test_tos_sem_destroy pass\r\n\0".as_ptr()); } } unsafe extern "C" fn test_sem_pend_task_entry(arg : *mut c_void) { let mut sem = arg as *mut _ as *mut k_...
Rust
0
self.spell_school = school break for _class in class_list: if _class in self.spell_subline: self.spell_classes.append(_class) if "邪术师" in self.spell_subline: self.spell_classes.append("魔契师") if len(self.spell_classes) == 0: # 如果没有匹...
Python
1
#Sectionquiz3.2.17.py #Section quiz 3.2.17 #Question 1: Create a for loop that counts from 0 to 10, and prints odd numbers to the screen. Use the skeleton below: # for i in range(1, 11): # if i % 2 == 1: # print(i) # continue #Question 2: Create a while loop that counts from 0 to 10, and prints o...
Python
1
ction_data dictionary to recreate action" } } for category, details in parameters_needed.items(): print(f"\n{category}:") for key, value in details.items(): if isinstance(value, list): print(f" {key}:") for item in value: ...
Python
1
heck_run_end_encode_decode() check_run_end_encode_decode(pc.RunEndEncodeOptions(pa.int16())) check_run_end_encode_decode(pc.RunEndEncodeOptions('int32')) check_run_end_encode_decode(pc.RunEndEncodeOptions(pa.int64())) def test_pairwise_diff(): arr = pa.array([1, 2, 3, None, 4, 5]) expected = pa.ar...
Python
1
ue('P')), Qwery::LSqBracket => Some(Character::Value('{')), Qwery::RSqBracket => Some(Character::Value('}')), Qwery::Backslash => Some(Character::Value('|')), Qwery::Caps => None, Qwery::A => Some(Character::Value('A')), Qwery::S => Some(Character::Value('S')), Qwery::D => Some(Charac...
Rust
0
, this method checks if there is a /// provided value and if there is none, sets a default value. Default /// values are: /// /// * `path`: `"/"` /// * `SameSite`: `Strict` /// fn set_defaults(cookie: &mut Cookie<'static>) { if cookie.path().is_none() { cookie.set_p...
Rust
0
ndregion # region "听说练习" with listening_tabs[1]: st.subheader("听说练习", divider="rainbow", anchor="听说练习") st.markdown( """ 您可以通过反复播放和跟读每条对话样例来提升您的听力和口语技能。点击 '全文[🎞️]' 可以一次性收听整个对话。另外,您可以通过点击左侧的按钮调整合成语音的风格,以更好地适应您的听力习惯。 """ ) st.warning( "请注意,练习过程中会使用喇...
Python
1
Templ_free::<crate::ln::msgs::NetAddress, u8>; #[no_mangle] pub static CResult_NetAddressu8Z_ok: extern "C" fn (crate::ln::msgs::NetAddress) -> CResult_NetAddressu8Z = crate::c_types::CResultTempl::<crate::ln::msgs::NetAddress, u8>::ok; #[no_mangle] pub static CResult_NetAddressu8Z_err: extern "C" fn (u8) -> CResult_...
Rust
0
# Generated by Django 5.0.12 on 2025-03-09 02:39 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('exchanges', '0001_initial'), ] operations = [ migrations.CreateModel( name='SwapTransaction', fields=[ ...
Python
1
NCP's MCU can enter low-power"] #[doc = "* (energy-saving) state. When the NCP's desired power state is set to"] #[doc = "* `LOW_POWER`, host is expected to \"poke\" the NCP (e.g., an external trigger"] #[doc = "* like an interrupt) before it can communicate with the NCP (send a message"] #[doc = "* to the NCP...
Rust
0
in_button_adj.set_value(adj.get_value()); }); window.connect_delete_event(|_, _| { gtk::main_quit(); Inhibit(false) }); gtk::main(); } <reponame>cgwalters/gtk-rs // Take a look at the license at the top of the repository in the LICENSE file. //! GObject bindings pub mod auto; mod bin...
Rust
0
from .balance_navigator.agent import balance_navigator_agent from .scheduler.agent import scheduler_agent __all__ = ["balance_navigator_agent", "scheduler_agent"]
Python
1
15(); fn error0(); fn error1(); fn error2(); fn error3(); fn error4(); fn error5(); fn error6(); fn error7(); fn error8(); fn error9(); fn error10(); fn error11(); fn error12(); fn error13(); fn error14(); fn error15(); fn error16(); fn error17(); fn error18(); fn error19(); fn error20(); fn erro...
Rust
0
# # Copyright (c) 2024 10X Genomics, Inc. All rights reserved. # """Stage checking if cell annotation is viable but not requested in a multi run.""" import martian import cellranger.cell_typing.common as ct_common import cellranger.matrix as cr_matrix __MRO__ = """ stage CELL_ANNOTATION_VIABLE_BUT_NOT_REQUESTED( ...
Python
1
ng] # pad the domain if input is non-periodic x = x.permute(0, 2, 1) x = self.fc1(x) x = F.gelu(x) x = self.fc2(x) return x def get_grid(self, shape, device): batchsize, size_x = shape[0], shape[1] gridx = torch.tensor(np.linspace(0, 1, size_x), dtype=torch.f...
Python
1
#!/usr/bin/python """ Utilities for cleaning the text data """ import unicodedata def clean_word(word): word = word.strip('\n') word = word.strip('\r') word = word.lower() word = word.replace('%', '') #99 and 44/100% dead word = word.strip() word = word.replace(',', '') word = word.replace('.', '') wo...
Python
1
= args['train.patience']: mult = args['train.decay_coef'] print('Decaying lr by the factor of {}'.format(mult)) # loading the best model so far and optimizing from that point checkpointer.restore_model(ckpt='best', model=True) for param_g...
Python
1
{ let result: Object = match literal { Literal::Null => Object::Null, Literal::Integer(integer) => Object::Integer(integer), Literal::Float(float) => Object::Float(float), Literal::Boolean(boolean) => Object::Boolean(boolean), Literal::String(string) => Object::String(string), Literal::Vec(vector) ...
Rust
0
#!/usr/bin/env python ''' This script stops, and then starts all the nodes in the sandbox using the VIRL APIs. ''' from time import sleep from virlutils import * from builtins import input import sys if __name__ == "__main__": # Get simulation list nx_os_simulation = get_simulations() nx_os_simu...
Python
1
pic, options, sdepth, ); } // Remove indirect predecessors to generate unique DAG and compute // costs accurately for n in nodes.values() { remove_indirect_predecessors(n.clone()); } // Compute DAG costs root.borrow_mut().compute_dag_cost(); // Sort branches for topological sort (default is to sort...
Rust
0
ta().unwrap().len().try_into().expect("file is too large"); DocumentTermsReader { reader: BufReader::new(input), next_document_id: 0, bytes_read: 0, eof: false, log_interval: status_log_interval(file_bytes, 20), total_bytes: file_bytes, ...
Rust
0
'''You have a long flowerbed in which some of the plots are planted, and some are not. However, flowers cannot be planted in adjacent plots. Given an integer array flowerbed containing 0's and 1's, where 0 means empty and 1 means not empty, and an integer n, return true if n new flowers can be planted in the flower...
Python
1
import torch from sentence_transformers import SentenceTransformer, util from PIL import Image device = "cuda" if torch.cuda.is_available() else "cpu" sentence_bert_model = None def check_text_similarity(text, check_list=None, check_embeddings=None): global sentence_bert_model if sentence_bert_model is None: ...
Python
1
ndpoints'] }) if self.results['exposed_information']: recommendations.append({ 'severity': 'HIGH', 'issue': 'Sensitive admin information exposed', 'recommendation': 'Restrict access to admin API endpoints and logs' }) ...
Python
1
_in_step_and_z_: Vec<usize> = Vec::new(); let len_lastStep_lastZ: usize = self.navigation_on_separate_lines[this_step - 1].len(); for i in 0..len_lastStep_lastZ { let len_s: usize = self.navigation_on_separate_lines[this_step - 1][i].len(); for k in 0..len_s { let z_: usize = self.navigation_on_sepa...
Rust
0
@contextmanager def sync_workers(): """ Yields distributed rank and synchronizes all workers on exit. """ rank = get_rank() yield rank barrier()
Python
1
import requests class Searching: def __init__(self): self.api = 'https://swapi.dev/api/' def personages(self,name:str): people = requests.get(self.api+f'people/?search={name}').json()['results'][0] films = ', '.join([requests.get(i).json()['title'] for i in people['films']]) re...
Python
1
PeerMessage> for RaftMpackCodec { type Transport = Framed<S, RaftMpackCodec>; fn into_transport(self, stream: S) -> Self::Transport { RaftMpackCodec.framed(stream) } } */ #[derive(Clone, Debug)] pub struct RaftCapnpCodec; pub struct CapnpTransport<S> { inner: capnp_futures::serialize::Transp...
Rust
0
#!/usr/bin/env python # # Copyright (c) 2016, The OpenThread Authors. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # 1. Redistributions of source code must retain the above copyright # notic...
Python
1
import tweepy import os from dotenv import load_dotenv # 환경 변수 로드 load_dotenv() # 트위터 API 인증 정보 설정 api_key = os.getenv('X_API_KEY') api_secret_key = os.getenv('X_API_KEY_SECRET') access_token = os.getenv('X_API_ACCESS_TOKEN') access_token_secret = os.getenv('X_API_ACCESS_TOKEN_SECRET') bearer_token = os.getenv('X_API...
Python
1
ype(&space, &i_like_music, &AtomType::Specific(expr!("Pron", "Verb", "Noun")))); assert!(check_type(&space, &i_like_music, &AtomType::Specific(sym!("Statement")))); assert!(check_type(&space, &expr!("do", "you", "like", "music"), &AtomType::Specific(sym!("Quest")))); } #[test] fn nested_ty...
Rust
0
class Solution: def totalNQueens(self, n: int) -> int: # https://leetcode.com/problems/n-queens-ii/?envType=study-plan-v2&envId=top-interview-150 # there must only be one queen per row and 1 queen per line # exp: n = 4 column=[0, 1, 2, 3] row=[1, 3, 0, 2] where the index represent that spe...
Python
1
= 48 instShiftAmt = 2 class ex5_big(DerivO3CPU): LQEntries = 16 SQEntries = 16 LSQDepCheckShift = 0 LFSTSize = 1024 SSITSize = 1024 decodeToFetchDelay = 1 renameToFetchDelay = 1 iewToFetchDelay = 1 commitToFetchDelay = 1 renameToDecodeDelay = 1 iewToDecodeDelay = 1 ...
Python
1
#Pascals Triangle N=int(input("Enter n :")) for i in range(N+1): num=1 print(' '*(N-i),end='') for j in range(i+1): print(num,end=' ') num=num*(i-j)//(j+1) print()
Python
1
is => ptr::null()); (&**this).as_ptr() } #[no_mangle] pub unsafe extern "C" fn rs_bitvec_bs_l16_as_ptr(this: *const *const BitSlice<LittleEndian, u16>) -> *const u16 { nullck!(this => ptr::null()); (&**this).as_ptr() } #[no_mangle] pub unsafe extern "C" fn rs_bitvec_bs_b32_as_ptr(this: *const *const BitSlice<BigEndi...
Rust
0
from datetime import datetime, timezone from fsrs import FSRS, Card, Rating class QuizScheduler (): def __init__ ( self, datetime_now = None, user_id = None, course_id = None, Topic_id = None, quiz_id = None, ): pass # fix this soon def test_ev...
Python
1
config = node::NodeConfig { network, use_official_peers, custom_peers, listen_addr, vote_weights, }; current_thread::block_on_all(future::lazy(|| node::run(node_config))) .expect("failed to run node"); } use dev_utils::impl_short_msg_kat; #[rustfmt::skip] const S...
Rust
0
} fn footer(&self) -> Html { match &self.props.footer { Some(f) => html! { <div class="pf-c-card__footer"> { f.clone() } </div> }, None => html! {}, } } } <reponame>silvio/rust-coreutils<filename>mkuutils....
Rust
0
# # # Copyright 2009 HPGL Team # # This file is part of HPGL (High Perfomance Geostatistics Library). # # HPGL 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, version 2 of the License. # # HPGL is distribu...
Python
1
# Modeli yükleme ve tahmin yapma örneği import torch from PIL import Image from torchvision import transforms # Model dosyasını yükle model = torch.jit.load('turkish_lira_classifier_pytorch.pt') model.eval() # Görüntü dönüşümü transform = transforms.Compose([ transforms.Resize((224, 224)), transforms.ToTensor...
Python
1
from turtle import Turtle, Screen timmy = Turtle() for x in range(15): timmy.forward(10) timmy.penup() timmy.forward(10) timmy.pendown() timmy.color("red") screen = Screen() screen.exitonclick()
Python
1
import matplotlib.pyplot as plt import numpy as np from ipex_llm.transformers import AutoModelForCausalLM import time model_paths = ["/home/llm/models/Llama-2-7b-chat-hf", "/home/llm/models/Llama-2-13b-chat-hf"] models_labels = ['Llama-2-7b', 'Llama-2-13b'] def timer(low_bit, model_path, num_runs=5): times = [] ...
Python
1
import base64 from pathlib import Path from typing import Literal import logging import playwright.sync_api import re import time from importlib import resources from . import _get_global_playwright, chat_files CHATBOX_DIR = resources.files(chat_files) logger = logging.getLogger(__name__) class Chat: def __i...
Python
1
Of(langs)) } CHARSET_SUPPORTED => { let charsets = vec![IppValue::Charset("utf-8".to_string())]; IppAttribute::new(attr, IppValue::ListOf(charsets)) } OPERATIONS_SUPPORTED => { let operations = vec![ IppV...
Rust
0
debug_assert!(_remove_res == Some(0)); } } pub fn default_global_env() -> GcRef<Namespace> { *DEFAULT_GLOBAL_ENV } pub fn set_global_env(env: GcRef<Namespace>) { ENV_STACK.with(|s| { let stack: &mut Vec<GcRef<Namespace>> = &mut s.borrow_mut(); stack[0] = env; }) } pub fn current_env()...
Rust
0
#[doc = r" Sets the field bit"] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r" Clears the field bit"] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r" Writes raw bits to the field"] #[inline] pub fn bit(self, value: bool) -> &'a mut ...
Rust
0
_GPIO_4_FUNC_SEL_R { REAL_GPIO_4_FUNC_SEL_R::new(((self.bits >> 12) & 0x0f) as u8) } #[doc = "Bits 8:11 - Function select for GPIO4."] #[inline(always)] pub fn reg_gpio_4_func_sel(&self) -> REG_GPIO_4_FUNC_SEL_R { REG_GPIO_4_FUNC_SEL_R::new(((self.bits >> 8) & 0x0f) as u8) } #[do...
Rust
0
, window::{Fullscreen, WindowBuilder}, }; #[derive(Clone, Copy, Zeroable, Pod)] #[repr(C)] struct TraceData { dims: UVec2, dims_rcp: Vec2, pass_index: u32, } descriptor_set!(TraceDescriptorSet { trace: UniformData<TraceData>, result: [StorageImage; 3], samples: StorageImage, }); #[derive(...
Rust
0
#[allow(missing_docs)] #[doc(hidden)] pub struct _STATUS; #[doc = "`read()` method returns [status::R](status::R) reader structure"] impl crate::Readable for STATUS {} #[doc = "`write(|w| ..)` method takes [status::W](status::W) writer structure"] impl crate::Writable for STATUS {} #[doc = "Status"] pub mod status; #[d...
Rust
0
: *mut KmerMinHash, other: *const KmerMinHash) -> Result<()> { let mh = { assert!(!ptr.is_null()); &mut *ptr }; let other_mh = { assert!(!other.is_null()); &*other }; mh.merge(other_mh)?; Ok(()) } } ffi_fn! { unsafe fn kmerminhash_add_from(ptr: *mut KmerMinHash, o...
Rust
0
### torch.set_float32_matmul_precision('high') fabric = Fabric(accelerator="cuda", devices=4, strategy="ddp") fabric.launch() model = AutoModelForSequenceClassification.from_pretrained( "google/bigbird-roberta-base", num_labels=2) optimizer = torch.optim.Adam(model.parameters(), lr=5e-5)...
Python
1
mode(1); } } } } orig(*ctrl); tooltip::set_text_hook_mode(0); HALF_SUPPLY_POS.store(0, Ordering::Relaxed); MAIN_TEXT_POS.store(0, Ordering::Relaxed); NEXT_UPGRADE_LEVEL.store(0, Ordering::Relaxed); true } unsafe fn tooltip_text_count(game: Game, string: &...
Rust
0
date", True) self._set_property("array", arg, array) self._set_property("arrayminus", arg, arrayminus) self._set_property("arrayminussrc", arg, arrayminussrc) self._set_property("arraysrc", arg, arraysrc) self._set_property("color", arg, color) self._set_property("symmet...
Python
1
import torch import re import numpy as np from collections import defaultdict from home_loader import load_data class Evaluator: def __init__(self, config, model, logger): self.config = config self.model = model self.logger = logger self.valid_data = load_data(config["valid_data_pa...
Python
1
document(&content); let table_select = Selector::parse("h2 + table tbody").unwrap(); let row_select = Selector::parse("tr").unwrap(); let cell_select = Selector::parse("th a[title]:first-child, td").unwrap(); let table = document.select(&table_select).next().unwrap(); let rows = table.select(&row_...
Rust
0
TemporalSample(self.src_len), WindowCreate(self.src_len), ]) self.train_pin_memory = True self.test_pin_memory = False self.val_pin_me...
Python
1
def is_prime_original(n): """Return true if a given number is prime, and false otherwise. >>> is_prime(6) False >>> is_prime(101) True >>> is_prime(11) True >>> is_prime(13441) True >>> is_prime(61) True >>> is_prime(4) False >>> is_prime(1) False """ ...
Python
1
from rdkit import Chem def mol_prop(mol, prop): try: mol = Chem.MolFromSmiles(mol) except Exception as e: return 'Chem.MolFromSmiles ERROR :{}'.format(e) if mol is None: return 'SMILES ERROR' # Remove the "num_" prefix, if present if prop.startswith("num_"): ...
Python
1
Stmt), #[tag("DoWhileStatement")] DoWhile(DoWhileStmt), #[tag("ForStatement")] For(ForStmt), #[tag("ForInStatement")] ForIn(ForInStmt), #[tag("ForOfStatement")] ForOf(ForOfStmt), #[tag("ClassDeclaration")] #[tag("FunctionDeclaration")] #[tag("VariableDeclaration")] #...
Rust
0
hale::query::anchor::query_withdrawable_unbonded( deps, bluna_hub_address, unbond_handler, )?) } /// Queries unbond requests for the unbond handler associated with the given address pub fn query_unbond_requests(deps: Deps, address: String) -> VaultResult<UnbondRequestsResponse> { let ad...
Rust
0
n = int(input()) array = [0] * (n + 1) for i in range(1, n + 1): array[i] = int(input()) dp = [0] * (n + 1) dp[1] = array[1] if n > 1: dp[2] = max(array[2], array[1] + array[2]) # 시작이랑 끝이 자유로움 for i in range(3, n + 1): dp[i] = max( dp[i - 1], # 마시지 않는 경우 dp[i - 2] + array[i], # 두칸 전꺼 ...
Python
1
fn default() -> Self { ServerHandlers { handlers: HashMap::new(), on_missing_method: Box::new(|name, req| Box::new(on_missing_method(name, req))), } } } /// Helper method that returns an error response indicating a missing method. pub async fn on_missing_method(_: String...
Rust
0
i in range(4): self.assertEqual(summary[i]["value"], expected_summary_values[i]) def get_expected_data_for_test_employees(self): emp1_data = frappe.get_doc("Employee", self.test_emp1) emp2_data = frappe.get_doc("Employee", self.test_emp2) return [ { "employee": self.test_emp2, "employee_name": "...
Python
1
# django imports from django import forms # lfs imports from lfs.addresses.models import Address from lfs.addresses import settings class AddressBaseForm(forms.ModelForm): """ Base class for all address forms. **Attributes:** fields_before_postal List of field names which are supposed to be...
Python
1
write!(w, " {}\n", message)?; } } Ok(()) } fn as_write(&mut self) -> &mut Write { match *self { ShellOut::Stream(ref mut err, _) => err, ShellOut::Write(ref mut w) => w, } } } impl ColorChoice { fn to_termcolor_color_...
Rust
0
size_of::<B>()) } const fn union_align_of<A, B>() -> usize { max_usize(mem::align_of::<A>(), mem::align_of::<B>()) } const fn union_size_of<A, B>() -> usize { align_to(packed_union_size_of::<A, B>(), union_align_of::<A, B>()) } macro_rules! fake_union { ($name:ident { $a:ty, $b:ty }) => ( struct ...
Rust
0
{ sync::{mpsc, RwLock}, task, }; pub(super) async fn setup_service<T: GreetingRpc>( service_impl: T, num_concurrent_sessions: usize, ) -> ( mpsc::Sender<ProtocolNotification<MemorySocket>>, task::JoinHandle<()>, RpcCommsBackend, Shutdown, ) { let (notif_tx, notif_rx) = mpsc::channel...
Rust
0
_default(" (3,4)"); assert_eq!(range.show(), "(2, 7]"); } #[test] fn should_2_7_and_3_7_return_2_7() { let mut range = Range::init("(2,7)"); range.and_default(" (3,7)"); assert_eq!(range.show(), "(2, 7)"); } #[test] fn should_2_e7_and_3_7_return_2_e7() { let mut range = Range::init("(2,7]"); r...
Rust
0
𐒣', '🂆', 'ᱭ', '\u{1a17}', 'ጉ', 'ᛎ', '𛈜', 'ꏨ', 'ꏪ', '⅌', '𐂕', 'ዦ', '✥', 'ꐇ', 'ℴ', '𔖩', 'ꪄ', '💒', 'ꩳ', '𐲲', '𖹾', '𐇴', '⾠', '🍈', '𐧌', 'ꗐ', '𓃕', 'Ҡ', '\u{1fa28}', '⥇', '𐬙', 'Ჱ', '🧴', '🗭', '𝖻', '𖧸', '⤈', '𖡣', 'b', 'ᝮ', '𔕥', '┎', '𑜠', '𔖌', '𘣶', '𝦨', 'ⱹ', '𒌰', '𝚾', '꧘', 'ს', '𝡎', ...
Rust
0
SDM3_CNVTIMR { pub use super::DFSDM0_CNVTIMR::CNVCNT; } #[repr(C)] pub struct RegisterBlock { /// DFSDM channel configuration 0 register 1 pub DFSDM_CHCFG0R1: RWRegister<u32>, /// DFSDM channel configuration 1 register 1 pub DFSDM_CHCFG1R1: RWRegister<u32>, /// DFSDM channel configuration 2 re...
Rust
0
import csv if __name__=="__main__": input_list_file = "../swissport/gitdata/SSAlign/SVD1280/100filenames.txt" dim = 512 cosine_threshold = 0.3 # dim = 256 cosine_threshold = 0.45 # dim = 128 cosine_threshold = 0.6 # dim = 64 cosine_threshold = 0.7 # # ...
Python
1
csr, self.vertices(), self.interface_connectivity(), material_model, u, &|i| { &self .stiffness_quadrature .as_ref() .expect(&error_msg) .interface_quadra...
Rust
0
# -*- coding: utf-8 -*- """ Tencent is pleased to support the open source community by making BK-LOG 蓝鲸日志平台 available. Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved. BK-LOG 蓝鲸日志平台 is licensed under the MIT License. License for BK-LOG 蓝鲸日志平台: ------------------------------------------------...
Python
1
manager = VotePlanManager::new(vote_plan.clone()); let vote_cast = VoteCast::new(vote_plan.to_id(), 0, VoteTestGen::vote_cast_payload()); assert!(vote_plan_manager .vote( BlockDate::from_epoch_slot_id(1, 1), TestGen::unspecified_account_identifier(), ...
Rust
0
import json import os import pandas as pd USERS_FILE = "users.json" DATA_FILE = "student_data.json" # --- Helper functions --- def load_json(file_path, default): if not os.path.exists(file_path): return default try: with open(file_path, "r", encoding="utf-8") as f: return json.load...
Python
1
header_text_content) - num_spaces_in_header if padding_dashes_total < 0: padding_dashes_total = 0 dashes_left = padding_dashes_total // 2 dashes_right = padding_dashes_total - dashes_left header_line = f"{'-' * dashes_left} {header_text_content} {'-' * dashes_right}" lines = [] if titl...
Python
1
681_327_160_493_827_160_473_958_490 } else if o0 { 0.169_750_914_0 } else { 0.289_159_943_3_e-2 }, ) .mul_add( t, if o2 { 0.003_472_222_222_222_222_222_175_164_840 } else if o0 { -0.207_245_454_2 } else { ...
Rust
0
'{}/{}'.format( image.docker_repo.repo, # AR repo name is the gcr_host image.docker_repo.project, ), ), ) project = image.project docker_html_str_digest = 'https://{}'.format(version.GetDockerString()) updated_uri = re.su...
Python
1
let address = field!(validator.address, "Validator", "address")?; let validator = block::Validator { address: protocol_primitive::Address::try_from(address)?, propose_weight: validator.propose_weight, vote_weight: validator.vote_weight, }; ...
Rust
0
right_zeros(vec: &[u32]) -> Vec<u32> { vec .to_vec() .into_iter() .rev() .skip_while(|x| *x == 0) .collect::<Vec<u32>>() .into_iter() .rev() .collect() } // Check ...
Rust
0
a=5 b=2.5 c="Edison" d='Meneses' e=True print(a,"tipo de dato:",type(a)) print(b,"tipo de dato:",type(b)) print(c,"tipo de dato:",type(c)) print(d,"tipo de dato:",type(d)) print(e,"tipo de dato:",type(e))
Python
1
h: TOP_LEFT.width, height: TOP_LEFT.height, }; const CONTENT_BACKGROUND: Rectangle<u16> = Rectangle { x: TOP_LEFT.width, y: TOP_LEFT.height, width: 1, height: 1, }; const LEFT_BORDER: Rectangle<u16> = Rectangle { x: TOP_LEFT.x, y: TOP_LEFT.height, width: TOP_LEFT.width, height: 1, ...
Rust
0
he argument vector. Args: a: n-tuple of floats Returns: float: the 2-norm of a """ s = 0.0 for v in a: s += v * v return math.sqrt(s) def Newell(poly, points): """Use Newell method to find polygon normal. Assume poly has length at least 3 and points are 3d. ...
Python
1
# coding: utf-8 # 😬 class RowHandler: def handle_row(self, row): """ handle_row(row) should return False to return to the base handler """ raise NotImplementedError("RowHandler.handle_row" " must be overridden by subclass") class BaseHandler(Ro...
Python
1
""" The PyLD module is used to process JSON-LD. """ from . import jsonld from .context_resolver import ContextResolver __all__ = ['jsonld', 'ContextResolver']
Python
1
al_locs(locs, drop_head, drop_tail) def _get_interval_locs_by_period(self, period_ref, period_freq, clip_period, drop_head, drop_tail): p = get_period(period_ref, freq=period_freq) locs = [self._locate(p.start_time, by_ref='after'), self._locate(...
Python
1
import time from enum import Enum from mongoengine import Document, StringField, ListField, FloatField, DictField, IntField from kairon.shared.data.audit.data_objects import Auditlog class MailChannelStateData(Document): event_id = StringField() last_email_uid = IntField(default=0) bot = StringField(req...
Python
1
pload file.") # URL publik file yang diupload public_url_response = supabase.storage.from_(bucket_name).get_public_url(unique_filename) print(f"Public URL response: {public_url_response}") if isinstance(public_url_response, str): public_url = public_url_response els...
Python
1
// TODO: check that l[i + 1] is integer? if len_li == 4 { // -0300 hour_offset = Some(l[i + 1][..2].parse::<i32>()?); min_offset = Some(l[i + 1][2..4].parse::<i32>()?); } else if i + 2 < len_l && l[i + 2] == ":" { ...
Rust
0
s, _, idx| { if this.key(idx).overlaps(&search) { expected.push(this.key(idx).clone()); } false }); assert_eq!(output, expected, "range={:?}, tree={}", &range, &tree); } #[test] fn query_range_prebuilt() { test_prebuilt(&[1], 1..1...
Rust
0
# Copyright 2019 Uber Technologies, 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 required by applica...
Python
1
# This is an auto-generated Django model module. # You'll have to do the following manually to clean this up: # * Rearrange models' order # * Make sure each model has one field with primary_key=True # * Make sure each ForeignKey and OneToOneField has `on_delete` set to the desired behavior # * Remove `managed =...
Python
1
on,n_to_sample) for i_image,im in enumerate(images_this_location): fn_relative = im['file_name'] source_fn_abs = os.path.join(input_base,fn_relative) assert os.path.isfile(source_fn_abs) ext = os.path.splitext(fn_relative)[1] target_fn_abs = os.path....
Python
1
10)) { let T2::V0(x) = v; assert!(!x); } #[test] fn t3_test(v in any_with::<T3>(4)) { let T3::V0 { field: x } = v; assert_eq!(x, 16); } #[test] fn t4_test(v in any_with::<T4>(4)) { assert_eq!(v.field, 1); } #[test] fn t5_test(v in any_with::...
Rust
0
_def_json) = // anoncreds::multi_steps_issuer_preparation( // issuer_wallet_handle, // ISSUER_DID, // GVT_SCHEMA_NAME, // GVT_SCHEMA_ATTRIBUTES, // ); // //4. Prover creates Master Secret // anoncreds::prover_create_master_secret(prover_wallet_han...
Rust
0
# © 2016 Therp BV <http://therp.nl> # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). { "name": "Pdf watermark", "version": "15.0.1.0.0", "author": "Therp BV, " "Odoo Community Association (OCA)" "Serincloud", "license": "AGPL-3", "category": "Technical Settings", "development...
Python
1
_buf().join("blocks")).await, random_access_disk(dir.to_path_buf().join("merkle")).await, keypair.public, Some(keypair.secret)) .await.unwrap(); let mut replica = Core::new( random_access_disk(dir2.to_path_buf().join("data")).await, random_access_disk(dir2.to_path_buf().join(...
Rust
0
response_body = json.loads(response.get("body").read()) embeddings = response_body.get("embedding") except Exception as e: raise ValueError(f"Error raised by inference endpoint: {e}") return embeddings def embed_documents( self, texts: List[str], chunk_size: int =...
Python
1