text
string
label_name
string
labels
int64
pub fn new() -> Subject<T, E> { Subject { observers: Vec::new(), } } /// Returns a proxy object that exposes the observable part of a subject. /// /// This can be used to avoid exposing the observer methods while still /// allowing subscription. When a subject is use...
Rust
0
is file may not be copied, modified, or distributed * // except according to those terms. */ use std::fmt; use super::{ AccountKeyLinkNetworkProperties, AccountRestrictionNetworkProperties, AggregateNetworkProperties, HashLockNetworkProperties, MetadataNetworkProperties, MosaicNetworkProperties, MosaicR...
Rust
0
match sample_type { SampleType::F16 => Box::new(move || Ok(Sample::from(f16::read(&mut read)?))), SampleType::F32 => Box::new(move || Ok(Sample::from(f32::read(&mut read)?))), SampleType::U32 => Box::new(move || Ok(Sample...
Rust
0
# # Copyright (c) 2009 Red Hat, Inc. # # This software is licensed to you under the GNU General Public License, # version 2 (GPLv2). There is NO WARRANTY for this software, express or # implied, including the implied warranties of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. You should have received a copy of...
Python
1
""" [LintCode930] Connected Components in List Link: https://www.lintcode.com/problem/930/ [LeetCode817] Linked List Components Link: https://leetcode.com/problems/linked-list-components/ You are given the head of a linked list containing unique integer values and an integer array nums that is a subset of the linked ...
Python
1
("csurf_inst").as_ptr(), cpp_cs.as_ptr() as _); /// // Unregister /// reaper.plugin_register(c_str!("-csurf_inst").as_ptr(), cpp_cs.as_ptr() as _); /// delete_cpp_control_surface(cpp_cs); /// } /// ``` /// /// # Cleaning up /// /// If you register a control surface, you also must take care of unregistering ...
Rust
0
scenario_A_results = calculate_scenario(elasticity_A, pass_through_rate_A) scenario_B_results = calculate_scenario(elasticity_B, pass_through_rate_B) st.markdown(f"### Scenario A: Tariff Pass-Through to Consumer {pass_through_rate_A}%, Price-Demand Elasticity = {elasticity_A} ({'Inelastic' if elasticity_A > -1 else '...
Python
1
pretrained, **kwargs) @register_model def lambda_resnet26rpt_256(pretrained=False, **kwargs) -> ByobNet: """ Lambda-ResNet-26-R-T. Lambda layers w/ rel pos embed in last two stages. """ kwargs.setdefault('img_size', 256) return _create_byoanet('lambda_resnet26rpt_256', pretrained=pretrained, **kwargs)...
Python
1
from PyQt6.QtWidgets import QPushButton, QLabel from buzz.settings.shortcut import Shortcut from buzz.widgets.preferences_dialog.shortcuts_editor_preferences_widget import ( ShortcutsEditorPreferencesWidget, ) from buzz.widgets.sequence_edit import SequenceEdit class TestShortcutsEditorWidget: def test_shoul...
Python
1
X IF NOT EXISTS idx_signals_status ON signals(status)", "CREATE INDEX IF NOT EXISTS idx_signals_channel ON signals(channel_id)", "CREATE INDEX IF NOT EXISTS idx_signals_message ON signals(message_id)", "CREATE INDEX IF NOT EXISTS idx_signals_instrument ON signals(instrument)", "CREATE IN...
Python
1
# Downloaded from http://www.work.caltech.edu/~htlin/program/libsvm/doc/platt.py #!/usr/bin/env python from sys import argv #from svm import * from math import log, exp #from string import atof from random import randrange #--[Basic Function]--------------------------------------------------------------------- #input ...
Python
1
wReportId: WORD, }} pub type LPDIDEVICEOBJECTINSTANCEA = *mut DIDEVICEOBJECTINSTANCEA; STRUCT!{struct DIDEVICEOBJECTINSTANCEW { dwSize: DWORD, guidType: GUID, dwOfs: DWORD, dwType: DWORD, dwFlags: DWORD, tszName: [WCHAR; MAX_PATH], dwFFMaxForce: DWORD, dwFFForceResolution: DWORD, ...
Rust
0
import json from .oauth import OAuth2Test class OrbiOAuth2Test(OAuth2Test): backend_path = "social_core.backends.orbi.OrbiOAuth2" user_data_url = "https://login.orbi.kr/oauth/user/get" expected_username = "foobar" access_token_body = json.dumps( { "access_token": "foobar", ...
Python
1
aining: {:.3f}".format( iteration, len(waypoints), cost, elapsed_time(start_time), max_time - elapsed_time(start_time), ) ) # segment1, segment2 = choices(segments, weights=probabilit...
Python
1
"50", "proposer_priority": "-50" }, { "address": "026CC7B6F3E62F789DBECEC59766888B5464737D", "pub_key": { "type": "tendermint/PubKeyEd25519", ...
Rust
0
# ****************************************************************************** # Copyright 2017-2020 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.apa...
Python
1
"""Remove last_login field to User model Revision ID: ff5574abe59b Revises: 958df3747058 Create Date: 2025-04-24 20:42:23.537898 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = 'ff5574abe59b' down_revision = '958df3747058' branch_labels = None depends_on = None...
Python
1
def get_drugs_in_val(self): if np.isin('Drug', self.df_response.columns.values): val_drug_ids = list(set(self.df_response.loc[self.val_indexes[0]][ 'Drug'].values)) else: val_drug_ids = list(set(self.df_response.loc[self.val_indexes[0]][ 'Drug1'].values)) return val_d...
Python
1
#!/usr/bin/env python # This software is provided 'as-is', without any express or implied # warranty. In no event will the author be held liable for any damages # arising from the use of this software. # # Permission is granted to anyone to use this software for any purpose, # including commercial applications, and t...
Python
1
import numpy as np import os import pybullet as p import random from cliport.tasks import primitives from cliport.tasks.grippers import Spatula from cliport.tasks.task import Task from cliport.utils import utils import numpy as np from cliport.tasks.task import Task from cliport.utils import utils import pybullet as p ...
Python
1
of language ids """ lang = self.GetLanguage() self.filter, self.only = filter, only self.icons, self.choices, self.langs = CreateLanguagesResourceLists(filter, only) self.AssignImageList(self.icons, wx.IMAGE_LIST_SMALL) self.ClearAll() self.InsertColumn(0, '', ...
Python
1
pIterator<K, V, Hasher> { prefix: Vec<u8>, previous_key: Vec<u8>, drain: bool, _phantom: ::sp_std::marker::PhantomData<(K, V, Hasher)>, } impl< K: Decode + Sized, V: Decode + Sized, Hasher: ReversibleStorageHasher > Iterator for StorageMapIterator<K, V, Hasher> { type Item = (K, V); fn next(&mut self) -> Opt...
Rust
0
for provider in provided_by: if provider != primary_ks: source = { "resource_id": provider if provider.startswith('infores:') else f"infores:{provider}", "resource_role": "aggregator_knowledge_source" } ...
Python
1
import copy class SelfReferencingEntity: def __init__(self): self.parent = None def set_parent(self, parent): self.parent = parent class SomeComponent: def __init__(self, some_int, some_list, some_circular_ref): self.int = some_int self.list = some_list self.re...
Python
1
("OSDEFAULTAPPMODE".to_string())], } } pub fn shutdown(err: i64) -> Self { Self { name: "ShutdownOS", args: vec![Value::Num(err)], } } } impl Display for Call { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, "{}(", self.name...
Rust
0
os.makedirs(dir_save_path) crop_image = image.crop([left, top, right, bottom]) crop_image.save(os.path.join(dir_save_path, "crop_" + str(i) + ".png"), quality=95, subsampling=0) print("save crop_" + str(i) + ".png to " + dir_save_path) #-----------...
Python
1
: f64, winZ: f64, model: &[f64], proj: &[f64], view: &[i32], objX: &mut [f64], objY: &mut [f64], objZ: &mut [f64], ) -> i32 { unsafe { glu_sys::gluUnProject( winX, winY, winZ, model.as_ptr(), proj.as_ptr(), v...
Rust
0
ECT_UEVENT: u32 = 15; pub const NETLINK_GENERIC: u32 = 16; pub const NETLINK_SCSITRANSPORT: u32 = 18; pub const NETLINK_ECRYPTFS: u32 = 19; pub const NETLINK_RDMA: u32 = 20; pub const NETLINK_CRYPTO: u32 = 21; pub const NETLINK_SMC: u32 = 22; pub const NETLINK_INET_DIAG: u32 = 4; pub const MAX_LINKS: u32 = 32; pub cons...
Rust
0
} pub fn get_relative_mouse_state() -> (MouseState, i32, i32) { let x = 0; let y = 0; unsafe { let raw = ll::SDL_GetRelativeMouseState(&x, &y); return (MouseState::from_bits_truncate(raw), x as i32, y as i32); } } pub fn warp_mouse_in_window(window: &video::Window, x: i32, y: i32) { ...
Rust
0
from odoo import http from odoo.http import request from odoo.addons.http_routing.models.ir_http import slug from odoo.addons.website.models.ir_http import sitemap_qs2dom class Main(http.Controller): def sitemap_hostels(env, rule, qs): Hostels = env['hostel.hostel'] dom = sitemap_qs2dom(qs, '/hos...
Python
1
e); } <gh_stars>10-100 //! @ Of course we want to define macros that suppress the detail of how font //! information is actually packed, so that we don't have to write things like //! $$\hbox{|font_info[width_base[f]+font_info[char_base[f]+c].qqqq.b0].sc|}$$ //! too often. The \.{WEB} definitions here make |char_info(f...
Rust
0
import pandas as pd from math import cos, pi, sin, asin, acos, tan from datetime import datetime, timedelta # Constants P_opt = 20 # Optimal photoperiod P_Base_dict = {'Emergence_to_Double_Ridge': 0, 'Double_Ridge_to_Anthesis': 7} # Load stage timings and thermal temperature data stage_timings = pd.read_csv('Stage T...
Python
1
# Copyright 2020 Huawei Technologies Co., Ltd # 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 i...
Python
1
ize { #[inline(always)] pub fn byte_size(&self) -> usize { match self { &RegSize::Bit8 => 1, &RegSize::Bit16 => 2, &RegSize::Bit32 => 4, &RegSize::Bit64 => 8, &RegSize::Bit80 => 10, &RegSize::BitMMX => 8, &RegSize::Bit128 => 16, &RegSize::Bit256 => 32, &RegSiz...
Rust
0
ry for GLOBAL_CONFIG__SPAD_ENABLES_REF_1 { const INDEX: Index = Index::GLOBAL_CONFIG__SPAD_ENABLES_REF_1; type Array = [u8; 1]; fn into_array(self) -> Self::Array { self.0.to_be_bytes() } fn from_array(arr: Self::Array) -> Self { Self(u8::from_be_bytes(arr)) } } impl Entry for...
Rust
0
# -*- coding: utf-8 -*- # # Copyright 2020 Google LLC. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requir...
Python
1
| | x = ϕ(a,b) | +------> | return 0x1 | +----------------+ """ cfg = ControlFlowGraph() a = Variable("a") b = Variable("b") cfg.add_nodes_from( [ n0 := BasicBlock( 0, instructions=[ assign_...
Python
1
#blog/views.py from django.views.generic import ListView, DetailView from django.views.generic.edit import CreateView, UpdateView, DeleteView from .models import Post from django.urls import reverse_lazy class BlogListView(ListView): model = Post template_name = "home.html" #context_object_name = 'posts' ...
Python
1
error::{Error, ErrorKind}, protos::{Footer, Header, Index, MessageExt, Metadata, Tai64n}, uuid, }; use anomaly::{ensure, fail}; use std::{convert::TryInto, io}; /// File signature found at the beginning of sear archives which identifies /// the format. /// /// Version identifier which allows parsers to de...
Rust
0
rdisas pub mod mmx{ use crate::tables::*; pub const ALU_MMX_REG: [([&'static str;3],&'static str);8] = [ (["eax","ax","al"],"mm0"), (["ecx","cx","cl"],"mm1"), (["edx","dx","dl"],"mm2"), (["ebx","bx","bl"],"mm3"), (["esp","sp","ah"],"mm4"), (["ebp","bp","ch"],"mm5"), (["esi","si","dh"],"mm6"), (["ed...
Rust
0
USERNAME = "h_ars_a" PASSWORD = "harsh741334@" VIDEO_PATH = r"C:\Users\HARSH AGARWAL\OneDrive\Desktop\playwright\video.mkv" # Make sure this is the full file path CAPTION = "🎥 Uploaded via automation!"
Python
1
the height from active syncs when it's /// dropped. /// The priority function for state sync artifacts uses this information on /// to prioritize state fetches. active: Arc<parking_lot::RwLock<BTreeMap<Height, CryptoHashOfState>>>, /// A cache of chunks from a previously aborted IncompleteState. St...
Rust
0
# Copyright 2018 Jonas Fuhrmann. All rights reserved. # # This project is dual licensed under GNU General Public License version 3 # and a commercial license available on request. #------------------------------------------------------------------------- # For non commercial use only: # This file is part of tinyTPU. # ...
Python
1
raise ValueError("El nombre de usuario ya está registrado") kwargs["nombre_usuario"] = nombre_usuario.strip().lower() if "contraseña" in kwargs: contraseña = kwargs["contraseña"] es_valida, mensaje = PasswordManager.validate_password_strength(contraseña) ...
Python
1
template specialization: ", stringify!(std_allocator) ) ); assert_eq!( ::std::mem::align_of::<std_allocator>(), 1usize, concat!( "Alignment of template specialization: ", stringify!(std_allocator) ) ); } #[test] fn __bindgen_test_la...
Rust
0
#!/usr/bin/env python3 import os import sys import re import subprocess # === GET ENV VARS === contact_folder = os.environ["contact_folder"] file_template = os.environ["file_template"] ext = os.environ["file_extension"] add_fields = os.environ["add_fields"] open_file = os.environ["open_file"] title = os.environ["alfr...
Python
1
_1132) = &input.volume_size { scope_1131.number( #[allow(clippy::useless_conversion)] aws_smithy_types::Number::NegInt((*var_1132).into()), ); } #[allow(unused_mut)] let mut scope_1133 = writer.prefix("VolumeType"); if let Some(var_1134) = &input.volume_type { ...
Rust
0
# -*- coding: utf-8 -*- # @Time : 2023/3/9 16:45 # @Author : 蔍鸣霸霸 # @FileName: twitter.py # @Software: PyCharm # @Blog :只因你太美 import re import json import requests from urllib.parse import urlencode import urllib3 urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning) from loguru import logger p...
Python
1
e, "CapsLock" => Code::CapsLock, "ContextMenu" => Code::ContextMenu, "ControlLeft" => Code::ControlLeft, "ControlRight" => Code::ControlRight, "Enter" => Code::Enter, "MetaLeft" => Code::MetaLeft, "MetaRight" => Code::MetaRight, "ShiftLeft" => Code::ShiftL...
Rust
0
bypass_first_fwd = False microbatch_num_per_batch = 4 def get_model_idx_for_pp(seq_id, pass_agg=True): ''' pass_agg 标志了如何排序。 如果为真,则microbatch之间是类似于“fwd1-fwd2-fwd3-fwd4 - bkwd1-bkwd2-bkwd3-bkwd4”的形式排列 否则,microbatch之间是类似于“fwd1-bkwd1 - fwd2-bkwd2 - fwd3-bkwd3 - fwd4-bkwd4”的形式排列 ''' is_first_pass...
Python
1
an) .with_context(|_| ErrorKind::PrimaryStoreQuery("discovery settings")) })?; let mut names = vec![]; for name in cursor { let name = name.with_context(|_| ErrorKind::PrimaryStoreQuery("discovery settings"))?; names.push(name); } let response = DiscoverySettingsListRes...
Rust
0
/ TODO: Rethink overlay composability None } } <filename>s32k148-pac/src/sai1.rs #[doc = r"Register block"] #[repr(C)] pub struct RegisterBlock { #[doc = "0x00 - Version ID Register"] pub sai_verid: crate::Reg<sai_verid::SAI_VERID_SPEC>, #[doc = "0x04 - Parameter Register"] pub sai_param: cr...
Rust
0
paste! { fn store(result_type: &Type, index: & usize, stack: &mut Vec<StackItem>, register: &mut Vec<StackItem>) -> Result<(), String> { match result_type { $(Type::$long_type => { let a = [<pop_as_ $rust_type>](stack)?; ...
Rust
0
rds = match self.differentials { Some(rd) => format!("{}", rd), None => String::from("None"), }; write!( f, "Ray {{ o = {}, d = {}, t_max = {}, time = {}, differentials = {}}}", self.o, self.d, self.t_max, self.time, rds ) } } ///...
Rust
0
''.join(random.choices(string.ascii_letters + string.digits, k=16)) sign_data = { 'client_id': 'game', 'nonstr': nonce_str, 'timestamp': current_time, 'body': json.dumps(body) if body else '', 'query': '&'.join(parameter_strings) if parameter_strings else '', 'secret...
Python
1
fer[0] # compute weighted blend of current frame and inverted previous frame motion_frame = cv2.addWeighted( frame_bgr, self.weighted_params.alpha, cv2.bitwise_not(prev_frame), self.weighted_params.beta, 0, ...
Python
1
# This file was auto-generated by Fern from our API Definition. from ..core.unchecked_base_model import UncheckedBaseModel import pydantic import typing from .speech_to_text_word_response_model import SpeechToTextWordResponseModel from ..core.pydantic_utilities import IS_PYDANTIC_V2 class SpeechToTextChunkResponseMo...
Python
1
Making all following glyphs children of the `right_side` /// object will make the following glyphs animate while the selection is shrinking. #[derive(Clone, CloneRef, Debug)] pub struct Selection { logger: Logger, display_object: display::object::Instance, pub right_side: display::object::Instance...
Rust
0
# Copyright (c) 2022-2024 InterDigital Communications, Inc # All rights reserved. # Redistribution and use in source and binary forms, with or without # modification, are permitted (subject to the limitations in the disclaimer # below) provided that the following conditions are met: # * Redistributions of source code...
Python
1
if let Some(space_gateway) = maybe_space_gateway { let _ = space_gateway.publish( span.follower("TODO"), GatewayRequestToChild::Dht(DhtRequestToChild::HandleGossip(gossip)), ); ...
Rust
0
fn div(self, rhs: f64) -> Self::Output { (f64::from(1) / rhs) * self } } //- inline double dot(const vec3 &u, const vec3 &v) #[inline] pub fn dot(u: &Vec3, v: &Vec3) -> f64 { (u.e[0] * v.e[0]) + (u.e[1] * v.e[1]) + (u.e[2] * v.e[2]) } //- inline vec3 cross(const vec3 &u, const vec3 &v) #[inline] ...
Rust
0
endpoint.path.as_str(), Some( SetConfigurationRequest::builder() .max_versions(versions) .delete_version_after("768h"), ), ) .await; assert!(resp.is_ok()); } } #[derive(Debug)] pub struct SecretEndpoint { p...
Rust
0
vc_segments_label": "Mẫu tối đa", "vc_segments_info": "Mẫu tối đa: Là số lượng mẫu âm thanh sẽ được tạo ra cho quá trình, càng nhiều càng tốt nhưng có thể thêm tiếng ồn", "vc_dereverb_label": "Loại bỏ tiếng vang", "vc_dereverb_info": "Loại bỏ tiếng vang: Áp dụng loại bỏ tiếng vang vào các mẫu âm...
Python
1
class Solution: def largestIsland(self, grid): def explore(i, j): dic[(i, j)], count[curr] = curr, count[curr] + 1 if i > 0 and grid[i - 1][j] == 1 and (i - 1, j) not in dic: explore(i - 1, j) if j > 0 and grid[i][j - 1] == 1 and (i, j - 1) not in dic: explore(i, j - 1) ...
Python
1
use pow::*; use sp_api::TransactionFor; use sp_consensus::import_queue::BasicQueue; use sp_core::{Encode, U256}; pub use sc_basic_authorship::*; use std::thread; use std::{sync::Arc, time::Duration}; pub use sc_executor::NativeElseWasmExecutor; // Our native executor instance. pub struct ExecutorDispatch; // Out nat...
Rust
0
anyhow!("mem room_base missing"))?, ) .context("loading mem room_base")?, request_id: memory .string(MEM_REQUEST_ID) .context("loading mem request_id")? .map(|s| UniqId::from(s)), }; Ok(Self { creep_id: cree...
Rust
0
from __future__ import annotations import os from pathlib import Path from patchwork.common.context_strategy.languages import PythonLanguage from patchwork.step import Step from patchwork.steps.ExtractCodeContexts.ExtractCodeContexts import ExtractCodeContexts class ExtractCodeMethodForCommentContexts(Step): re...
Python
1
truct SMI_8_MASK_R(crate::FieldReader<bool, SMI_8_MASK_A>); impl SMI_8_MASK_R { pub(crate) fn new(bits: bool) -> Self { SMI_8_MASK_R(crate::FieldReader::new(bits)) } #[doc = r"Get enumerated values variant"] #[inline(always)] pub fn variant(&self) -> SMI_8_MASK_A { match self.bits { ...
Rust
0
rror; use wasmtime_environ::{ CompileError, DefinedFuncIndex, FuncIndex, FunctionInfo, InstanceSignature, InstanceTypeIndex, Module, ModuleSignature, ModuleTranslation, ModuleTypeIndex, PrimaryMap, SignatureIndex, StackMapInformation, Trampoline, Tunables, WasmFuncType, ELF_WASMTIME_ADDRMAP, ELF_WASMTIM...
Rust
0
# LCA (최소 공통 조상) 학습 먼저 해야 합니다 import sys input = sys.stdin.readline for _ in range(int(input())): N = int(input()) parents = [0]*(N+1) for _ in range(N-1): a,b = map(int,input().split()) parents[b]=a a,b = map(int,input().split()) arr,brr = [0,a],[0,b] while parents[a]: ...
Python
1
let mut fpu = FindPanicUnwrap { cx, typeck_results: cx.tcx.typeck(item.def_id), panic_span: None, }; fpu.visit_expr(&body.value); lint_for_missing_headers( cx, ...
Rust
0
#!/usr/bin/python3 copy_list = __import__('19-copy_list').copy_list my_list = [1, 2, 3] print(my_list) new_list = copy_list(my_list) print(my_list) print(new_list) print(new_list == my_list) print(new_list is my_list)
Python
1
n_on: Vec::new(), #[cfg(feature = "enable_server")] listen_cert: cfg_mesh.listen_certificate.clone(), #[cfg(feature = "enable_dns")] connect_to: None, #[cfg(not(feature = "enable_dns"))] connect_to: None, cfg_mesh: cfg_mesh, } ...
Rust
0
} link = Some(link_str); } link } fn parse_title(element: ElementRef) -> String { element.inner_html() } <reponame>mgrant34/libra // Copyright (c) The Libra Core Contributors // SPDX-License-Identifier: Apache-2.0 use crate::chained_bft::block_storage::BlockStore; use crate::chained_bft::chai...
Rust
0
writer.write_n(&ext_metadata_block.level().to_be_bytes(), 8); ext_metadata_block.write(writer)?; // ext_dm_alignment_zero_bit (0..remaining_bits).for_each(|_| writer.write(false)); } Ok(()) } } impl DmData { pub fn parse<T: WithExtMetadataBlocks + De...
Rust
0
[7, 5, 3, 11, 8, 2, 9, 10], [7, 5, 3, 11, 8, 2, 10, 9], [7, 5, 3, 11, 8, 9, 2, 10], [7, 5, 3, 11, 8, 9, 10, 2], [7, 5, 3, 11, 8, 10, 2, 9], [7, 5, 3, 11, 8, 10, 9, 2], [7, 5, 3, 11, 10, 2, 8, 9], [7, 5, 3, 11, 10, 8, 2, 9], ...
Python
1
(b'H', b'I', b'?') => Ok(Request::SayHi), (b'I' | b'i', 0x00, 0x00) => Ok(Request::Init), (b'D', _, b'S') | (b'd', _, b's') => Ok(Request::Dispense(core_data.1)), (b'H' | b'h', 0x00, 0x00) => Ok(Request::HaltAction), (b'H', b'C', b'?') | (b'h', b'c', b'?') => Ok(Request:...
Rust
0
self.provider.set(provider.clone_ref()); self.list_view.set_entries(provider); } /// Resize the column and update its position. fn resize_and_place(&self, size: Vector2, padding: f32) { let width = size.x / COLUMNS as f32; let bg_height = size.y; let height = self.len() as f...
Rust
0
import os import load as io class HicoConstants(io.JsonSerializableClass): def __init__( self, clean_dir=os.path.join(os.getcwd(),'data_symlinks/hico_clean'), #proc_dir=os.path.join(os.getcwd(),'data_symlinks/hico_processed')): proc_dir=os.path.join(os.getcwd(),'hi...
Python
1
from pydantic_settings import BaseSettings, SettingsConfigDict class Settings(BaseSettings): model_config = SettingsConfigDict(env_file=".env", env_ignore_empty=True) API_ID: int API_HASH: str MIN_AVAILABLE_ENERGY: int = 100 SLEEP_BY_MIN_ENERGY: int = 200 ADD_TAPS_ON_TURBO: int = 2500 ...
Python
1
se. * 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 writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ...
Rust
0
<Bird> = Schedule::new(); } else{ let mut schedule: Schedule<Bird> = Schedule::with_threads(n_thread); } } // assert!(schedule.events.is_empty()); let mut state = BoidsState::new(WIDTH, HEIGTH, DISCRETIZATION, TOROIDAL); for bird_id in 0..n_agent { l...
Rust
0
]; let res = super::find_homology(&test, 4); assert_eq!(res.0.len(), 4); assert_eq!(res[Idx(0)].get(&Idx(1)), Some(&vec![Match(3, 0, 6)])); assert_eq!(res[Idx(1)].get(&Idx(0)), Some(&vec![Match(0, 3, 6)])); assert_eq!(res[IdxRc(0)].get(&IdxRc(1)), Some(&vec![Match(4, 0, 6)])); ...
Rust
0
"""Base SQLAlchemy model.""" from sqlalchemy.ext.declarative import declarative_base Base = declarative_base()
Python
1
.parse::<ParsedSpiPin>().is_err() { return Err(format!( "Invalid DIO value {}, must be an unsigned 8-bit integer", dio )); } Ok(()) } fn is_zero_or_positive(val: String) -> Result<(), String> { if val.parse::<u32>().is_err() { return Err(String::from("Value ...
Rust
0
rysms_file = random.choice(microaneurysms_files) soft_exudates_file = random.choice(soft_exudates_files) hard_exudates_label = cv2.imread(os.path.join(hard_exudates_folder, hard_exudates_file), cv2.IMREAD_GRAYSCALE) hemorrhages_label = cv2.imread(os.path.join(hemorrhages_folder, hemorrhages_fil...
Python
1
e models for activities. mod activities; pub use self::activities::Activity; /// Database models for encountered actors and follow connections. mod actors; pub use self::actors::{Actor, Following}; /// Database models for objects. mod objects; pub use self::objects::Object; /// Helper function for retrieving ActivityP...
Rust
0
# Amazon Price Tracker import smtplib import requests from bs4 import BeautifulSoup import config # using the product suggested by the course PAGE_URL = "https://www.amazon.com/Instant-Pot-Duo-Evo-Plus/dp/B07W55DDFB/" # get a notification whenever the price falls below the following TARGET_PRICE = 100 CURRENCY = "$...
Python
1
rogram_t>(Self::ptr_filter(f(b"glIsProgram\0".as_ptr())).ok_or("glIsProgram")?); let glIsQuery_p = transmute::<nn_cv, glIsQuery_t>(Self::ptr_filter(f(b"glIsQuery\0".as_ptr())).ok_or("glIsQuery")?); let glIsRenderbuffer_p = transmute::<nn_cv, glIsRenderbuffer_t>(Self::ptr_filter(f(b"glIsRenderbuffer\0".as_ptr())...
Rust
0
= self.succ(f, l, level); r = self.succ(f, r, level); } x } /// 区間 [l, r) において k 番目に大きい要素. O(log σ) pub fn kth_largest(&self, l: usize, r: usize, k: usize) -> u64 { self.kth_smallest(l, r, r - l - k - 1) } pub fn _range_freq(&self, mut l: usize, mut r: usize, up...
Rust
0
/// The simplest example is deploying a contract without initializing it. /// /// /// This example deploys and initializes the contract. /// /// ``` /// # #[macro_use] extern crate near_sdk_sim; /// # lazy_static::lazy_static! { /// # static ref TOKEN_WASM_BYTES: &'static [u8] = include_bytes!("../../examples/fung...
Rust
0
bar_width # plt.xticks(bar_positions, group_labels, ha='center', fontsize=16) # # 设置y轴刻度,使0刻度卡在最下面 # plt.yticks(fontsize=20) # plt.ylim(bottom=0) # plt.savefig('fg_success.pdf', bbox_inches='tight') # # # 显示图表 # # plt.show() # # 函数用于读取 YAML 文件中的向量数据 # # YAML 文件路径 # data = np.array([ # [2.0, 3.0, 5.0], # [1.0...
Python
1
.ok_or(anyhow::anyhow!("missing wait_lsn_timeout"))?, wal_redo_timeout: self .wal_redo_timeout .ok_or(anyhow::anyhow!("missing wal_redo_timeout"))?, superuser: self.superuser.ok_or(anyhow::anyhow!("missing superuser"))?, page_cache_size...
Rust
0
dx, Q: MocQty<T>, U: Idx, R: MocQty<U>> RangeMOC2<T, Q, U, R> { pub fn new(depth_max_l: u8, depth_max_r: u8, elems: Vec<RangeMOC2Elem<T, Q, U, R>>) -> Self { Self { depth_max_l, depth_max_r, elems } } pub fn eq_without_depth(&self, rhs: &Self) -> bool { if self.elems.len() != rhs.elems.len() { ...
Rust
0
return Ok((result, bitcount)); } } return Err(Error::new(ErrorKind::InvalidData, "Too long protocol value")) } fn read_source_value(input: &mut Read, header: u8) -> Result<DataValue, Error> { match header & 3 { 1 => Ok(DataValue::U8(input.read_u8()?)), 2 => Ok(DataValue::U16(inp...
Rust
0
_feature = "fma")] use super::*; impl m128 { /// fused `(self * b) + c` #[inline(always)] #[must_use] pub fn fmadd(self, b: Self, c: Self) -> Self { Self(unsafe { _mm_fmadd_ps(self.0, b.0, c.0) }) } /// fused `-(self * b) + c` #[inline(always)] #[must_use] pub fn fnmadd(self, b: Self, c: Self) ...
Rust
0
#!/usr/bin/env python3 from utils.all import * poly = 'FSHBKOOPCFSFKONFNFBB' rules = dict([ ('FO', 'K'), ('FF', 'H'), ('SN', 'C'), ('CC', 'S'), ('BB', 'V'), ('FK', 'H'), ('PC', 'P'), ('PH', 'N'), ('OB', 'O'), ('PV', 'C'), ('BH', 'B'), ('HO', 'C'), ('VF', 'H'), ('HB', 'O'), ('VO', 'N'), ('HK', 'N'), ('OF', 'V'), ('P...
Python
1
= 1 << 27; pub const MS_NOSEC: i32 = 1 << 28; pub const MS_BORN: i32 = 1 << 29; pub const MS_ACTIVE: i32 = 1 << 30; pub const MS_NOUSER: i32 = 1 << 31; /// Superblock flags that can be altered by MS_REMOUNT pub const MS_RMT_MASK: i32 = MS_RDONLY | MS_SYNCHRONOUS | MS_MANDLOCK | MS_I_VERSION | MS_LAZYTIME; /// Old m...
Rust
0
from abc import ABC, abstractmethod # Abstract class class Vehicle(ABC): @abstractmethod def start(self): pass # Only declaration, no implementation @abstractmethod def stop(self): pass # Concrete class class Car(Vehicle): def start(self): print("Car engine started") ...
Python
1
Ok(SctpPacket { source_port, dest_port, verification_tag, chunks: &chunk_space[0..chunk_count], }) } #[derive(Debug)] pub enum SctpWriteError { BufferSize, NoChunks, OutOfRange, } impl fmt::Display for SctpWriteError { fn fmt(&self, f: &mut fmt::Formatter) -> ...
Rust
0