text
string
label_name
string
labels
int64
#Programa 4.6 "Programa que utilice una función para realizar operaciónes matematicas basicas" #Elaborado el 14/11/2024 #Elaborado por : Evelyn Jocelyn León de Luna def operaciones(num1,num2,digitos): suma = num1 + num2 resta = num1 - num2 multiplicación = num1 * num2 division = float(num1/num2) m...
Python
1
SerializationError> { if let Some(var_29) = &input.audio { let mut object_30 = object.key("Audio").start_object(); crate::json_ser::serialize_structure_crate_model_audio_artifacts_configuration( &mut object_30, var_29, )?; object_30.finish(); } if let ...
Rust
0
from elasticsearch import Elasticsearch from dotenv import load_dotenv import os import json load_dotenv() ELASTIC_PASSWORD = os.getenv("ELASTIC_PASSWORD") ELASTIC_USERNAME = os.getenv("ELASTIC_USERNAME") es = Elasticsearch( "http://localhost:9200", basic_auth=(ELASTIC_USERNAME, ELASTIC_PASSWORD) ) if not e...
Python
1
ert_eq!(FIELD_OFFSET!(PEB, u), 88); assert_eq!(FIELD_OFFSET!(PEB, SystemReserved), 96); assert_eq!(FIELD_OFFSET!(PEB, AtlThunkSListPtr32), 100); assert_eq!(FIELD_OFFSET!(PEB, ApiSetMap), 104); assert_eq!(FIELD_OFFSET!(PEB, TlsExpansionCounter), 112); assert_eq!(FIELD_OFFSET!(PEB, TlsBitmap), 120); ...
Rust
0
# Generated by Django 3.2.20 on 2023-09-01 14:51 import uuid import django.core.serializers.json import django.db.models.deletion import nautobot.extras.models.mixins import nautobot.extras.models.statuses import taggit.managers from django.db import migrations, models class Migration(migrations.Migration): dep...
Python
1
from scrapy.crawler import CrawlerProcess from scrapy.settings import Settings from betscraper.spiders import spider_betano, spider_betx, spider_forbet, spider_fortuna, spider_kingsbet, spider_merkur, spider_sazka, spider_synottip, spider_tipsport from betscraper.spiders import spider_betano_detail, spider_betx_detail,...
Python
1
(ops)).with_tags(tag) c_expected = cirq.Circuit( _wrap_in_cop([h_cz_y, cirq.Y(q[1])], '1'), cirq.Moment(cirq.X(q[0]).with_tags("ignore")), cirq.CircuitOperation(cirq.FrozenCircuit(h_cz_y)).repeat(6).with_tags("ignore"), _wrap_in_cop([cirq.CNOT(*q), cirq.CNOT(*q)], '2'), cirq...
Python
1
ynesis::passport::Passport, } struct Sims { rng: ChaChaRng, sims: BTreeMap<String, Sim>, } impl Sim { pub fn blocks(&self) -> PassportBlocks<Vec<u8>> { let mut blocks = PassportBlocks::new(); for block in self.passport.blocks() { blocks.p...
Rust
0
""" This code is for aggregating the results obtained over 3 runs. """ import os, json from collections import defaultdict import numpy as np final_results = defaultdict(list) for model_path in ["pretrain_data_paraphrase_comparative", "pretrain_data_paraphrase_comparative_seed33", "pretrain_data_paraphrase_comparative...
Python
1
# # Author: Jay Deiman # Email: admin@splitstreams.com # # This file is part of pylibgal3. # # pylibgal3 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 License, or # ...
Python
1
] * len(query) for dev_id in range(core.get_xpu_device_count()): utilization_xpu = core.get_xpu_device_utilization_rate(dev_id) mem_total = ( core.get_xpu_device_total_memory(dev_id) / 1024 / 1024 ) # with MB mem_used = ( core.get_xpu_device_used_memory(dev_...
Python
1
let mut scope = Scope::new(); scope.push_constant("x", 42 as INT); assert!(matches!( *engine.run_with_scope(&mut scope, "x = 1").expect_err("expects error"), EvalAltResult::ErrorAssignmentToConstant(x, _) if x == "x" )); Ok(()) } #[cfg(not(feature = "no_object"))] #[test] fn test_cons...
Rust
0
##修改部分为第七步模型结构#### { "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# 上分思路\n", "- 数据\n", "- 模型\n", "- 损失函数\n", "- 训练方式\n", "- 超参数" ] }, { "cell_type": "markdown", "metadata": { "jp-MarkdownHeadingCollapsed": true, "tags": [] }, "source":...
Python
1
] extern crate serde_json; mod ffi; pub mod mpz; pub mod mpq; pub mod mpf; pub mod rand; pub mod sign; #[cfg(test)] mod test; <filename>src/utils.rs use num::Float; use cpython::{FromPyObject, PyObject, PyResult, Python}; use ordered_float::{NotNaN, OrderedFloat}; #[inline] crate fn pylist_to_vec<T>(py: Python<'_>,...
Rust
0
trides[1] + 1 W = (W - ks[1] + 2*pd) // strides[1] + 1 ret.extend([[C, H, W]] * (2*n)) # Second block (only first layer may have stride). C = fs[2] H = (H - ks[0] + 2*pd) // strides[2] + 1 W = (W - ks[1] + 2*pd) // strides[2] + 1 ret.extend([[C, H, W]] * (2*n)) ...
Python
1
pub fn try_add_custom_storage<S: 'static + UnknownStorage + Send + Sync>( &self, storage_id: StorageId, storage: S, ) -> Result<(), error::Borrow> { let _ = self .all_storages .try_borrow()? .custom_storage_or_insert_by_id(storage_id, || storag...
Rust
0
#!/usr/bin/env python3 # Copyright 2004-present Facebook. All Rights Reserved. from typing import Set, Optional from collections import namedtuple # set is an OptionalSet as below NamedOptionalSet = namedtuple("NamedOptionalSet", ["name", "set"]) class OptionalSet: def __init__(self, set: Optional[Set] = None):...
Python
1
WlOutput, ()>, D: AsMut<DelegateToMe>, { fn bind( _state: &mut D, _handle: &DisplayHandle, _client: &Client, _resource: New<wl_output::WlOutput>, _global_data: &(), _data_init: &mut DataInit<'...
Rust
0
import openai from openai import OpenAI from tenacity import retry, stop_after_attempt, wait_exponential from common.settings import settings openai_client = OpenAI(api_key=settings.openai_api_key) @retry( stop=stop_after_attempt(0), wait=wait_exponential(multiplier=1, min=4, max=10) ) def response(messages: list...
Python
1
AppSettings, ErrorKind, }; /// let result = App::new("prog") /// .setting(AppSettings::ArgRequiredElseHelp) /// .subcommand(App::new("config") /// .about("Used for configuration") /// .arg(Arg::new("config_file") /// .help("The configuration file to use"))) ...
Rust
0
} fn increment_energy_level(&mut self) -> FlashOption { self.energy_level = self.energy_level + 1; if self.energy_level > FLASH_ENERGY_LEVEL { self.energy_level = RESET_ENERGY_LEVEL; return FlashOption::Flahsed; } return FlashOption::NotFlashed; } } i...
Rust
0
x5c\x13\xb7\xcc4\x99\x8a\xab5\x0f\xcaQ\xb7\xa9I\ \x9b\xe79\xf7\x1e\x8e\xb8w\xef\x1e\xf1tJUU\x94\ V\xd2U\xf8\xd6su}\xcd\xf3\x9b\xe7\xac\x8b\x82s\ s+\x88\x8a\x9d\xb2^\xafyy]\xb3X.\xb9\xdf\ \x1d\x93\xe79\xae[sss\xc3A\xd2I\x1e\xc0\x89\ X\xf9uTJ\xfe\xbf\xf1)i\x9a2\x8d\x0f\xa9\xeb\ \x9a\x8bE\x15\x04]\xc9z\xb5Fu\xa2\xbc\x98\x...
Python
1
# -*- coding: utf-8 -*- # Part of the PsychoPy library # Copyright (C) 2012-2020 iSolver Software Solutions (C) 2021 Open Science Tools Ltd. # Distributed under the terms of the GNU General Public License (GPL). import psychopy.logging as logging try: from psychopy_eyetracker_sr_research.sr_research.eyelink.eyetr...
Python
1
# Retrieve loss values for k in loss_keys: epoch_val_losses[k] += float(val_losses[k]) if val_step == 0: val_outs_summary = outputs # Write validation loss values in Tensorboard ...
Python
1
"""Tests for: Node for circular doubly linked list""" import pytest from robotpuzzle.node import Node @pytest.mark.initial @pytest.mark.node def test_initial_repr(new_node): """Test initial repr""" cur_count = f"{Node.count - 1:03d}" assert repr(new_node) == f"Node({cur_count}, False, None, {cur_count}, ...
Python
1
output.stdout); let stderr = String::from_utf8_lossy(&output.stderr); println!("Stdout:\n{}\nStderr:\n{}\n", stdout, stderr); panic!("Running C tests failed with non-zero return code"); } } #[test] fn c_tests_integration_run_console_logger() { c_tests_run("./integration", Some("console"...
Rust
0
_len == 0 { p } else { p / (min_len as u64) }; let mut start = 0; let mut end = min_len; let mut sum = ps.iter().take(min_len).sum::<u64>(); loop { let len = end - start; if sum > max_avg * (len as u64) { return None; } match sum.cmp...
Rust
0
data_points_1_1[0].start_time_unix_nano, ) self.assertNotEqual( data_points_0_1[1].start_time_unix_nano, data_points_1_1[1].start_time_unix_nano, ) self.assertEqual( data_points_0_0[0].time_unix_nano, data_points_1_0[0].start_time_uni...
Python
1
']) df = df.sort_values('Date').reset_index(drop=True) df['stage1_target'] = (df['FullTimeResult'] == 'D').astype(int) df['stage2_target'] = df['FullTimeResult'].map({'H': 0, 'A': 1}) # Temporal split cutoff_date = pd.to_datetime('2023-05-01') train_df = df[df['Date'] < cutoff_date].copy() ...
Python
1
class Settings(): """A class to store all settings for Alien invasion""" def __init__(self): """Initialize the game's static settings""" # Screen Settings self.screen_width = 1440 self.screen_height = 790 self.bg_color = (3, 10, 50) # Ship settings self.ship_limit = 2 # Bullet settings self.bulle...
Python
1
self.dir_text_label.setText(_translate("PDFdir", "目录文本")) self.space_level_box.setText(_translate("PDFdir", "以空格分层")) self.dir_text_edit.setHtml( _translate( "PDFdir", '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/s...
Python
1
pub biome_color: InnerColor, } impl BlockProps { pub fn new() -> Self { BlockProps { air: true, water: false, waterlogged: false, biome_color: InnerColor::None, } } pub fn new_from<'a, I: Iterator<Item = &'a str>>(name: &'a str, state: I)...
Rust
0
Address pub fn address(&self) -> Address { match self { KeyPair::Secp256k1(private_key) => private_key.address(), #[cfg(feature = "ed25519")] KeyPair::Ed25519(private_key) => private_key.address(), KeyPair::Sm2(private_key) => private_key.address(), ...
Rust
0
class Student: status = '쉬는 중' def __init__(self, kor, eng, math): self.kor = kor self.eng = eng self.math = math @staticmethod def print_start_time_of_study(): print("9시 땡") Student.status = '공부 중' han = Student(0, 0, 0) hong = Student(0, 0, 0) print(Student....
Python
1
Palette::new(&[ Rgb([0, 0, 0]), Rgb([187, 187, 0]), Rgb([255, 187, 0]), Rgb([255, 255, 0]), Rgb([255, 255, 136]), Rgb([255, 255, 255]), ]), Self::Snow => { Palette::new(&[Rgb([0, 0, ...
Rust
0
, c12: 25.0, c22: 27.0, }; assert_ulps_eq!(A + B, result); let mut mat = A.clone(); mat += B; assert_ulps_eq!(mat, result); } #[test] fn subtract() { let result = Matrix3x3 { c00: -9.0, c10: -9.0, c20: -9.0, c01: -9.0, c11: -9.0, c21: ...
Rust
0
('$\sigma/\sigma_{1}$', size=15) plt.xlabel('Modes', size=15) plt.xlim(0, 11) plt.legend(fontsize=12) plt.xticks(fontsize=15) plt.yticks(fontsize=15) plt.show() #%% POD MODES modes = pod.modes plt.figure(figsize=(6,4)) plt.plot(space, modes*-1) plt.ylabel('$f_{g}$(t)', size=15) plt.xlabel('x', size=15) plt.title('N...
Python
1
alice(), NATIVE_CURRENCY_ID, 100), (bob(), NATIVE_CURRENCY_ID, 100), (alice(), X_TOKEN_ID, 100), (bob(), X_TOKEN_ID, 100), ]) } pub fn build(self) -> sp_io::TestExternalities { let mut t = frame_system::GenesisConfig::default() .build_storage::<Ru...
Rust
0
# apps/core/search.py from django.db import models class SearchManager(models.Manager): """ Custom manager for ParadeDB BM25 search functionality. """ def search(self, query, fields=None): """ Perform a BM25 search on specified fields. :param query: The search query string ...
Python
1
nd_faults<BS, RT>( rt: &mut RT, sector_size: SectorSize, sectors: &[SectorOnChainInfo], ) -> Result<(), ActorError> where BS: BlockStore, RT: Runtime<BS>, { if sectors.is_empty() { return Ok(()); } let weights = sectors .iter() .map(|s| to_storage_weight_desc(sec...
Rust
0
class Solution: def distinctNames(self, ideas: List[str]) -> int: ans = 0 # Group strings by initials suffixes = [set() for _ in range(26)] for idea in ideas: suffixes[ord(idea[0]) - ord('a')].add(idea[1:]) for i in range(25): for j in range(i + 1, 26): count = len(suffixes[i...
Python
1
b37a307bbb66333164ec9e1b24ea0d6c3ffddcec4f68e744\ 3056193a03c810e11344ca06d8ed8a2bfb1e8d48cfa6bc0eb4e2464b74814240\ 7c9f431aee769960e15ba8b96890466ef2457599852385c661f752ce20f9da0c\ 09ab6b19df74e76a95967446f8d0fd415e7bee2a12a114c20eb5292ae7a349ae\ 577820d5520a1f3fb62a17ce6a7e68fa7c79111d8860920bc048ef43...
Rust
0
in( os.path.dirname(__file__), "workspace_did_change_configuration.json" ), "r", ) as f: self.server.notify.workspace_did_change_configuration( {"settings": json.load(f)} ) assert "capabilitie...
Python
1
WINDOW_KEY, &WindowSettings::from_display(&display), ); epi::set_value(storage.as_mut(), EGUI_MEMORY_KEY, &*ctx.memory()); app.save(storage.as_mut()); storage.flush(); } ...
Rust
0
ypes('test_ros', mode='.srv') for t in ['test_ros/RossrvA', 'test_ros/RossrvB']: assert t in l def test_get_srv_text(self): d = get_test_path() srv_d = os.path.join(d, 'srv') with open(os.path.join(srv_d, 'RossrvA.srv'), 'r') as f: text = f.read() sel...
Python
1
""" Copyright (c) 2019-2024 Intel Corporation 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 w...
Python
1
} #[test] fn semicolon() { let scanners: &mut Vec<&Scanner> = &mut vec![&DelimiterScanner]; lex_from_str(";", "Smcl", scanners); } <filename>src/format/pfs0.rs use byteorder::{LittleEndian, WriteBytesExt}; use crate::format::utils; use std; use std::fs::File; use std::io::Read; use std::io::Seek; use std::io:...
Rust
0
xb6\x0c\xc1FH\xc3k(z\xe1\xf0n\x93\x8f\xc5\x9c\ \xafi\x08\x92\x825(\x8e\x9c\x82\x14I8\x22\xa1\xb0\ r2\x09C&\x982\x8b\xf4\xbc\x0c\xa8\xbf\xe9e\xd0\ \xe4hk\xb1\x05\x8a>\x92r\x94\xa4v\xb3\xf8\xef\xcc\ \xecJ\x1b\x02*rJ\x22\x19\xaf\xe1\xf4\xb9!\x92|\ >\xd3p\xf8\xc5R\xb4\xc2A!R(N\xd7\xc2\xa8\ \xdd\x00Y_\xad+\x0f\x95I\xcf\x1d\...
Python
1
.mkdir(args.output) pass_filter = None target_tag = "" if args.tvm: pass_filter = tvm_pass_filter target_tag = "tvm_" elif args.ort: pass_filter = ort_pass_filter target_tag = "ort_" else: print(f"[WARNING] No pass filter is used (use --tvm or --ort)") a...
Python
1
# Copyright 2024 Matheus Vilano # SPDX-License-Identifier: Apache-2.0 from simplevent import RefEvent as _RefEvent from waapi import WaapiClient as _WaapiClient from pywwise.decorators import callback from pywwise.enums import ECaptureLogItemType, ECaptureLogSeverity from pywwise.primitives import GameObjectID, GUID,...
Python
1
import numpy as np import random def ransac_line_fit(stars, iterations=500, threshold=5): best_line = None best_inliers = [] for _ in range(iterations): sample = random.sample(stars, 2) (x1, y1) = sample[0][:2] (x2, y2) = sample[1][:2] if x1 == x2 and y1 == y2:...
Python
1
t, default=None, help='Number of patients per chunk (default: auto)') args = parser.parse_args() # Set parallel flag (default is True, unless --no-parallel is specified) args.parallel = not args.no_parallel # Print processing mode if args.parallel: n_wor...
Python
1
_eq!(8.0, mass.m, r2nd <= Magnitude::EPSILON); let mass = Mass::in_picograms(8.0_e15); assert_float_eq!(8.0, mass.m, r2nd <= Magnitude::EPSILON); let mass = Mass::in_fg(8.0_e18); assert_float_eq!(8.0, mass.m, r2nd <= Magnitude::EPSILON); let mass = Mass::in_femtograms(8.0_e18); assert_float_eq!(...
Rust
0
# Copyright (C) 2018-2025 Intel Corporation # SPDX-License-Identifier: Apache-2.0 from openvino_genai import GenerationResult, GenerationConfig def compare_generation_result(hf_result: GenerationResult, ov_result: GenerationResult, generation_config: Generat...
Python
1
rrri) rr_r;rZrkrZz2rr`r"r"r#&test_add_different_scale_points_statics(z1TestJacobi.test_add_different_scale_points_staticcCs&tt}||d|||dS)NrrPrr_r"r"r#...
Python
1
/// The macro is semantically similar to a `match` expression and so supports /// [pattern guards](https://doc.rust-lang.org/reference/expressions/match-expr.html#match-guards) too. /// /// # Examples /// /// ``` /// # use chumsky::{prelude::*, error::Cheap}; /// // The type of our parser's input (tokens like this migh...
Rust
0
: None, } placeholders_with_default = graph.get_op_nodes(op='PlaceholderWithDefault') for input in placeholders_with_default: inputs_desc[input.name] = {'shape': input.soft_get('shape', None), 'data_type': input.so...
Python
1
(self.fee.to_u128()?)? .checked_div(Cert::PRECISION)? .to_u64()?; let burnable = amount.checked_sub(chargeable)?; Some((burnable, chargeable)) } } <gh_stars>1-10 use serde::{ Deserialize, Serialize, }; use anyhow::Result; use crate::metadata::{ basic::Basic, coordinate::Coordinat...
Rust
0
pe::Any, 0)); assert_eq!(Balances::reserved_balance(5), 2); assert_noop!( Proxy::add_proxy(Origin::signed(5), 4, ProxyType::Any, 0), BalancesError::<Test, _>::InsufficientBalance ); }); } #[test] fn proxying_works() { new_test_ext().execute_with(|| { assert_ok!(Proxy::add_proxy(Origin::signed(1), 2, Pr...
Rust
0
d_mesh_entries.push(rand_mesh_entry); } } for entry in rand_mesh_entries { let mut reader = entry.to_sub_source(&mut file).unwrap(); dbg!(entry.id); dbg!(&entry.symbol_name); let bbm = Bbm::decode(&mut reader).unwrap(); println!(...
Rust
0
import asyncio import os import redis import streamlit as st import websockets class ExchangeWebSocket: def __init__( self, exchange_name: str, redis_host: str = "localhost", redis_port: int = 6379 ): self.exchange_name = exchange_name self.uri = None # To be defined in subclasses ...
Python
1
from funcoes.adiciona_carrinho import carrinho from funcoes.cont_nf import * diretorio = 'banco_de_dados\historico' def nota(): id = contar_arquivos(diretorio) with open(rf'banco_de_dados\historico\{str(id+1)}.csv', 'a+',encoding='utf-8') as arquivo: dados = [] total = 0 cabecalho = 'NO...
Python
1
]} ] }, { 'number': 2, 'batches': [ {'number': 1, 'line_numbers': [2]}, {'number': 2, 'line_numbers': [3]} ...
Python
1
(&mut self, sr: f32) { self.r *= sr; } /// Checks whether the `Rect` contains a `Point` pub fn contains(&self, pos: &Vec2) -> bool { pos.distance(vec2(self.x, self.y)) <= self.r } /// Checks whether the `Circle` overlaps a `Circle` pub fn overlaps(&self, other: &Circle) -> bool...
Rust
0
# -*- coding: utf-8 -*- # SPDX-License-Identifier: Apache-2.0 import unittest import numpy as np from sequential.seq2pat import Attribute from sequential.csp_global import is_satisfiable class TestSeq2Pat(unittest.TestCase): def test_csp_example(self): sequence = [1, 2, 3, 4] pattern = [1, 2, 3...
Python
1
/// let result = matrix * vector; /// /// assert_eq!(result, expected); /// ``` #[rustfmt::skip] #[inline] pub fn from_nonuniform_scale(scale_x: S, scale_y: S) -> Self { let zero = S::zero(); Self::new( scale_x, zero, zero, scale_y, ) ...
Rust
0
, "server", &private_key, &cert, )?; let der_bytes = openssl_pkcs12.to_der()?; let native_tls_pkcs12 = Pkcs12::from_der(&der_bytes, PKCS12_PASSWORD)?; // Save the cert and key let cert_pem = cert.to_pem()?; let key_pem = private_key.pu...
Rust
0
p_name: &str) -> Result<(), Box<dyn Error>> { return execute_command_with_flag_and_name("-s", clyp_name); } fn execute_read_command(clyp_name: &str) -> Result<(), Box<dyn Error>> { return execute_command_with_flag_and_name("-r", clyp_name); } fn execute_command_with_flag_and_name(flag: &str, name: &str) -> Result...
Rust
0
} ArrowDataType::Timestamp(TimeUnit::Nanosecond, _) => { with_conversion(field.is_nullable(), TimestampNsConversion) } ArrowDataType::FixedSizeBinary(length) => Box::new(FixedSizedBinary::new( field.is_nullable(), (*length).try_into().unwrap(), ...
Rust
0
ory assigning function category = password_category_assign(up, low, digit, special) # outputting accordingly if category == 'Medium' : print("Medium. Try making a password with a combination of speacial characters, uppercase letters, lowercase letters and numbers,\n...
Python
1
class Solution: def reverseList(self, head: Optional[ListNode]) -> Optional[ListNode]: if not head or not head.next: return head newHead = self.reverseList(head.next) head.next.next = head head.next = None return newHead
Python
1
# Copyright 2022 The HuggingFace Team. 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 applicabl...
Python
1
channel_gain = env.get_gain(server_associate, user) # w power = pow(10, (user.get_power - 30) / 10) # 20dbm to w - 0.1w self_gain = channel_gain * power white_noise_pow = pow(10, (-114 - 30) / 10) # -144 dbm to w # uplink rate # print(np.log2(1 + self_gain / white_noise...
Python
1
anch3x3_1(x) branch3x3 = [ self.branch3x3_2a(branch3x3), self.branch3x3_2b(branch3x3), ] branch3x3 = torch.cat(branch3x3, 1) branch3x3dbl = self.branch3x3dbl_1(x) branch3x3dbl = self.branch3x3dbl_2(branch3x3dbl) branch3x3dbl = [ self.b...
Python
1
# 790. Domino and Tromino Tiling class Solution: def numTilings(self, n: int) -> int: part, full, empty = 0, 1, 1 for _ in range(n - 1): part, full, empty = empty + part, part * 2 + empty + full, full return full % (10**9 + 7)
Python
1
# # Copyright (c) 2023 Airbyte, Inc., all rights reserved. # import sys from airbyte_cdk.entrypoint import launch from source_zendesk_talk import SourceZendeskTalk def run(): source = SourceZendeskTalk() launch(source, sys.argv[1:])
Python
1
m current_grads = (prims.full(o.shape, 1.0, device=o.device, dtype=o.dtype) for o in fw_result) for bsym, residuals in zip(reversed(original_trace.bound_symbols), reversed(all_residuals)): grad_fwd = bsym.sym.grad_fwd grad_bwd = bsym.sym.grad_bwd grad_defined = bsym.sym.grad_defined ...
Python
1
by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // Parity Ethereum is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU ...
Rust
0
compassbench_v1_reason_datasets = [ dict(path='data/compassbench_v1.1/reason/CN_Commonsense.jsonl', abbr='reasonbench_cn_commonsense_circular', data_type='circular-mcq', infer_method='gen'), dict(path='data/compassbench_v1.1/reason/CN_Abductive_Alphanlg_translated.jsonl', abbr='reasonbench_cn_...
Python
1
return: """ cursor = None conn = None try: dic = get_tencent_data()[0] # 0 是历史数据字典,1 最新详细数据列表 print(f"{time.asctime()}开始更新历史数据") conn, cursor = get_conn() sql = "insert into history values(%s,%s,%s,%s,%s,%s,%s,%s,%s)" sql_query = "select confirm from history whe...
Python
1
avoid-racy-if-preconditions //! [CoerceUnsized]: https://doc.rust-lang.org/std/ops/trait.CoerceUnsized.html //! [else branch]: https://docs.rs/tokio/1.0.1/tokio/macro.select.html //! [Fuse::new]: https://docs.rs/async-fuse/0/async_fuse/struct.Fuse.html#method.new //! [Fuse::pin]: https://docs.rs/async-fuse/0/async_fuse...
Rust
0
import logging from dvc.progress import Tqdm from dvc.utils import env2bool def test_quiet_logging(caplog, capsys): with caplog.at_level(logging.CRITICAL, logger="dvc"): for _ in Tqdm(range(10)): pass out_err = capsys.readouterr() assert not out_err.out assert not out_...
Python
1
= problem.alm_set_y.__class__.__name__ -%} Zero::new() {% endif -%} } {% endif %} // ---Main public API functions-------------------------------------------------------------------------- /// Initialisation of the solver pub fn initialize_solver() -> AlmCache { let panoc_cache = PANOCCache::new({{meta.op...
Rust
0
// Test Clone trait assert_eq!(pragma.clone(), pragma); // Test PartialEq trait let pragma_0 = PragmaSetStateVector::new(statevec.clone()); let pragma_1 = PragmaSetStateVector::new(statevec + 1.0); assert!(pragma_0 == pragma); assert!(pragma == pragma_0); assert!(pragma_1 != pragma); ...
Rust
0
::ListUsageRecordDailyResponse; pub mod list_usage_record_last_month_response; pub use self::list_usage_record_last_month_response::ListUsageRecordLastMonthResponse; pub mod list_usage_record_monthly_response; pub use self::list_usage_record_monthly_response::ListUsageRecordMonthlyResponse; pub mod list_usage_record_re...
Rust
0
return exported_data async def clear_target_database(self): """清空目标数据库""" logger.warning("⚠️ 准备清空目标数据库...") async with self.target_driver.session() as session: # 删除所有关系 await session.run("MATCH ()-[r]-() DELETE r") # 删除所有节点...
Python
1
ty)| RetOut(x + y, x + y) ); $meta.register_native( concat!("OperatorSubtract;", stringify!($ty), stringify!($ty), ';', stringify!($ty)), |x: to_native!($ty), y: to_native!($ty)| Ret(x - y) ); $meta.register_native( concat!("OperatorAssignSubtract;Out"...
Rust
0
b: 0xaf, a: 0xff, }, Color { r: 0xff, g: 0xff, b: 0xd7, a: 0xff, }, Color { r: 0xff, g: 0xff, b: 0xff, a: 0xff, }, Color { r: 0x08, g: 0x08, b: 0x08, a: 0xff, }, Color { r: 0x12, g: 0x12, b: 0x12, ...
Rust
0
import torch import torch.nn.functional as F import os import sys import cv2 import random import datetime import math import argparse import numpy as np import scipy.io as sio import zipfile from .net_s3fd import s3fd from .bbox import * def detect(net, img, device): img = img - np.array([104, 117, 123]) i...
Python
1
# Copyright 2024 Bytedance Ltd. and/or its affiliates # # 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 ...
Python
1
from src.rag_system import RAGSystem from src.rag_system_chroma import RAGSystemChroma # Initialize the RAG system #rag = RAGSystem() rag = RAGSystemChroma() # Ask a question question = "What was the answer to the guardian’s riddle, and how did it help Kai?" answer = rag.answer_question(question) print(answer)
Python
1
()) } { 0 => (), e => panic!("libusb_handle_events: {}", get_error(e)), }; } unsafe { ::ffi::libusb_hotplug_deregister_callback(context, callback_handle); ::ffi::libusb_exit(context); } } extern "C" fn callback_fn(_ctx: *mut ::ffi::libusb_context, device: *m...
Rust
0
.insert(S2(2)); resources.insert(S3(3)); resources.insert(S4(4)); resources.insert(S5(5)); let sum = fn_reses.iter().try_fold(0, |sum, fn_res| { fn_res.try_call(&resources).map(|ret| sum + ret) })?; assert_eq!(8, resources.borrow::<S0>().0); assert_e...
Rust
0
class Cardapio: def __init__(self, entradas: list, principais: list, sobremesas: list, bebidas: list): self.__entradas = None self.__principais = None self.__sobremesas = None self.__bebidas = None if isinstance(entradas, list): self.__entradas = entradas ...
Python
1
# -*- coding: utf-8 -*- # generated from catkin/cmake/template/__init__.py.in # keep symbol table as clean as possible by deleting all unnecessary symbols from os import path as os_path from pkgutil import extend_path from sys import path as sys_path __extended_path = '/home/wanghao/Desktop/projects/CP_TRT/github/Cen...
Python
1
parse_literal(":foo"), lit(sym_at(sp(0, 4), "foo"))); assert_eq!(p.parse_literal(":'bar'"), lit(sym_at(sp(0, 6), "bar"))); assert_eq!(p.parse_literal(":'~*&^%'"), lit(sym_at(sp(0, 8), "~*&^%"))); assert_eq!(p.parse_literal("\"foo\""), lit(str_at(sp(0, 5), "foo"))); assert_eq!( ...
Rust
0
lse_text']) # 添加可编辑字段的响应方法 def on_field_edited(self, text): sender = self.sender() field_name = sender.objectName() # 获取字段定义 field_def = self.EDITABLE_FIELDS.get(field_name, {}) try: # 数据类型转换 if field_def.get('type') == 'number': ...
Python
1
; assert_eq!(tool, expect); Ok(()) } #[test] fn test_tool_add_new_tool_version() -> Result<()> { let config = config::io::read_config("./tests/test_config_CWL_validated.yml")?; let mut tool = Tool::new(&config, "test_owner", "test_name")?; tool.add_new_tool_version(&...
Rust
0
continue else: read_flag = True continue cache_control.talent_data[i["cid"]] = i["name"] # print(f"debug cache_control.talent_data = {cache_control.talent_data}") with open(birthplace_path, encoding="utf-8") as now_file: now_rea...
Python
1
_mbox.exec() sys.exit(1) else: _mbox.show() def _addonText(self, error: str) -> str: matches = re.findall(r"addons21(/|\\)(.*?)(/|\\)", error) if not matches: return tr.errors_may_be_addon() # reverse to list most likely suspect first, dict to d...
Python
1