text
string
label_name
string
labels
int64
if response.status == 200: logger.info(f"Successfully added 'ai-fixed' label to issue #{issue_number}") return else: logger.warning(f"Failed to add 'ai-fixed' label to is...
Python
1
import _plotly_utils.basevalidators class StreamValidator(_plotly_utils.basevalidators.CompoundValidator): def __init__(self, plotly_name="stream", parent_name="scattermapbox", **kwargs): super(StreamValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, ...
Python
1
insert(&con, user.0)) .await .map_err(|e| { error!("{:?}", e); HttpResponse::InternalServerError().finish() }); match result { Ok(u) => { HttpResponse::Created().json(u) } Err(e) => e } } pub async fn update(req: HttpRequest, ...
Rust
0
# Bonsai - OpenBIM Blender Add-on # Copyright (C) 2021 Nathan Hild <nathan.hild@gmail.com> # # This file is part of Bonsai. # # Bonsai 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 Li...
Python
1
nsert into Fences query = "INSERT INTO Fences (Description, ListPricePerMeter) VALUES (%s, %s)" cur = mysql.connection.cursor() cur.execute(query, (description, listPricePerMeter)) mysql.connection.commit() query = "SELECT * FROM Fences;" cur = mysql.connection.cursor() cur....
Python
1
assert_eq!(label_break(false, true), 2); assert_eq!(label_break(false, false), 3); assert_eq!(break_value(true, false), 1); assert_eq!(break_value(false, true), 2); assert_eq!(break_value(false, false), 3); assert_eq!(label_break_mixed(0), 0); assert_eq!(label_break_mixed(1), 1); asse...
Rust
0
{ Self { xcoeff: Default::default(), ycoeff: Default::default() } } } impl std::fmt::Debug for ViewportWScalingNV { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { f.debug_struct("ViewportWScalingNV").field("xcoeff", &self.xcoeff).field("ycoeff", &self.ycoeff).finish() } } ...
Rust
0
def _sanitizeEnv(self, environ): """Ensure certain values are present, if required by WSGI.""" if 'SCRIPT_NAME' not in environ: environ['SCRIPT_NAME'] = '' if 'PATH_INFO' not in environ: environ['PATH_INFO'] = '' # If any of these are missing, it probably s...
Python
1
import psycopg2 import pandas as pd from datetime import datetime, timedelta from dateutil.relativedelta import relativedelta import matplotlib.pyplot as plt def calculate_metrics(current_date, db_host, db_user, db_password): conn = psycopg2.connect( dbname='courses' ,user=db_user ,password...
Python
1
return "array" def children(self): for i in range(self.size): yield "[{}]".format(i), (self.begin + i).dereference() if sys.version_info.major > 2: pp = gdb.printing.RegexpCollectionPrettyPrinter("MegEngine") # megdnn pp.add_printer( "megdnn::SmallVectorImpl", ...
Python
1
_changed( diesel::insert_into(schema::physical_volumes::table) .values(&PhysicalVolume { logical_id: logical_id.flip(), machine_id: machine_id.flip() }) .execute(&self.conn)? ) } pub fn create_physical_volumes(&self, logical_id: VolumeId, machine_ids: &[MachineId]) -> Result<()> { expect...
Rust
0
16::Mod::from_modbus_parameter_data(&param_data)?; Box::new(m) } ModuleType::UR20_4AO_UI_16_DIAG => { let m = ur20_4ao_ui_16_diag::Mod::from_modbus_parameter_data(&param_data)?; Box::new(m) } Modu...
Rust
0
dnorms_buffer) = fieldnorms_buffer_opt.as_mut() { fieldnorms_buffer.resize(max_doc as usize, 0u8); } } } /// Set the fieldnorm byte for the given document for the given field. /// /// Will internally convert the u32 `fieldnorm` value to the appropriate byte /// t...
Rust
0
std::ffi::CStr) -> *const c_void, { AmdExtension227Fn {} } } impl AmdShaderCoreProperties2Fn { pub fn name() -> &'static ::std::ffi::CStr { ::std::ffi::CStr::from_bytes_with_nul(b"VK_AMD_shader_core_properties2\0") .expect("Wrong extension string") } } pub struct AmdShaderCor...
Rust
0
match *self { OTG_CLK_ENR::DISABLE_THE_OTG_CLOC => false, OTG_CLK_ENR::ENABLE_THE_OTG_CLOCK => true, } } # [ allow ( missing_docs ) ] # [ doc ( hidden ) ] # [ inline ( always ) ] pub fn _from(value: bool) -> OTG_CLK_ENR { ...
Rust
0
sed", False): add_feature("Polygon", [points], layer) elif dxftype == "CIRCLE": center, radius = e.dxf.center, e.dxf.radius points = [[center.x + radius * cos(a), center.y + radius * sin(a)] for a in [i * 2 * pi / 36 for i in ran...
Python
1
::Frame(SlamFrame { jpeg: img.clone(), features: Vec::new(), })).ok(); tokio::time::sleep(tokio::time::Duration::from_secs(5)).await; } Ok(()) } #[doc = "Reader of register CMPRA2"] pub type R = crate::R<u32, super::CMPRA2>; #[doc = "Writer for register CMPRA2"] pub...
Rust
0
source: "Printnl([Const(1)], None)"; expect: Printnl { expr: Expr::Const(Const(1)), }; } test parse_assign { source: "Assign([AssName('x', 'OP_ASSIGN')], Const(1))"; expect: Assign { ...
Rust
0
name="dice", aliases=["d"], ) @commands.guild_only() async def dice(self, ctx: commands.Context[awbot], sides: int = 6) -> None: """ Roll a dice. Parameters ---------- ctx : commands.Context[awbot] The context object for the command. ...
Python
1
#!/usr/bin/env python3 # SPDX-FileCopyrightText: Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # SPDX-License-Identifier: GPL-3.0-or-later """Check if docs changed and output an error if so.""" import sys import subprocess import os import os.path sys.path.insert(0, os.path.join(os.path.dirname(__file__),...
Python
1
from torch import Tensor, distributions from torchmetrics.utilities.data import dim_zero_cat from torch_uncertainty.metrics import CategoricalNLL class DistributionNLL(CategoricalNLL): def update( self, dist: distributions.Distribution, target: Tensor, padding_mask: Tensor | None ...
Python
1
width: i32, height: i32, floor_number: i32, starting_point: Point, rng: StdRng, } impl MapGenerator { #[must_use] fn new(width: i32, height: i32, floor_number: i32, starting_point: Point) -> Self { Self { width, height, floor_number, star...
Rust
0
assert_eq!((ray3, aabb).intersection(), None); assert_eq!((ray4, aabb).intersection(), Some(Point2::new(5.0, 9.0))); } #[test] fn test_corners() { let corners = Aabb2::new(Point2::new(-5.0f32, 5.0), Point2::new(5.0, 10.0)) .to_corners(); assert!(corners.contains(&Point2::new(-5f3...
Rust
0
imensionName, debater_name: DebaterName, / ) -> str | None: return "After debate" if self.is_final else f"After speech {self.cur_speech_index}" class MergedPageUI(PageUI): def init_ui(self) -> None: with ui.grid(columns=1).classes("w-full h-full min-h-[64rem] md:min-h-[40rem]"): se...
Python
1
ooter, Velocity, }; use serde::{Deserialize, Serialize}; use specs::{ world::{Builder, Index}, World, }; use quicksilver::geom::{Rectangle, Shape, Vector}; use rand::{thread_rng, Rng}; const ENEMY_HEAD_HEIGHT: f32 = 10.; pub fn get_enemy_head_body_area(self_area: Rectangle, position: Vector)...
Rust
0
(log: &'log mut util::Log<'src>, toks: &'src Vec<Token<'src>>) -> ParseTree { let mut parser = Parser::new(log, toks); parse_file(&mut parser); parser.tree } <gh_stars>1-10 use std::{ thread, error::Error, fs::File, io::BufReader, sync::mpsc::{Sender, TryRecvError}, time::Duration, }...
Rust
0
''' Created on 21 oct. 2024 @author: rober ''' import os from trajectory.AdsBtrajectories.Aircrafts.FAAaircraftDatabaseFile import FaaAircraftDatabase from trajectory.AdsBtrajectories.utils import readChallengeSet from trajectory.AdsBtrajectories.utils import readSubmissionSet import pandas as pd if __name__ == '__m...
Python
1
rees.push(tree); } Ok(RandomForestRegressor { parameters: parameters, trees: trees, }) } /// Predict class for `x` /// * `x` - _KxM_ data where _K_ is number of observations and _M_ is number of features. pub fn predict<M: Matrix<T>>(&self, x: &M) -> Res...
Rust
0
Time: 任务结束时间,Unix时间戳。 :type EndTime: int :param _TemplateId: 截图模板ID。 :type TemplateId: int :param _Stopped: 调用 StopScreenshotTask 停止任务时间,Unix时间戳。值为0表示未曾调用接口停止任务。 :type Stopped: int """ self._TaskId = None self._DomainName = None self._AppName = Non...
Python
1
pub mod poly; pub mod utils; pub mod zero_poly; pub mod das; pub mod recover; pub mod fk20_proofs; pub mod kzg_types; pub(crate) trait Eq<T> { fn equals(&self, other: &T) -> bool; } pub(crate) trait Inverse<T> { fn inverse(&self) -> T; } pub(crate) trait Zero<T> { fn is_zero(&self) -> bool; } impl Eq<P...
Rust
0
u if self.reduction == 'none': loss = giou elif self.reduction == 'sum': loss = paddle.sum(giou * iou_weight) else: loss = paddle.mean(giou * iou_weight) return loss * self.loss_weight @register @serializable class DIouLoss(GIoULoss): """ Dis...
Python
1
builder.start_with(SimpleMapBuilder::new()), 2 => builder.start_with(BspDungeonBuilder::new()), _ => builder.start_with(BspInteriorBuilder::new()), } if build_roll != 3 { let sort_roll = rng.roll_dice(1, 5); match sort_roll { 1 => builder.with(RoomSorter::new(RoomSo...
Rust
0
(derived_pubkey, derive_seed) = find_derived_address(&base_pubkey.clone(), eth_public_key)?; Ok(AddressPair { base: Base { address: base_pubkey, seed: base_seed, }, derive: Derived { address: derived_pubkey, seed: derive_seed, }, }...
Rust
0
ap<DDValue> { Box::into_raw(Box::new(DeltaMap::new())) } #[no_mangle] pub unsafe extern "C" fn ddlog_delta_get_table( delta: *const DeltaMap<DDValue>, table: libc::size_t, ) -> *mut DeltaMap<DDValue> { let res = DeltaMap::singleton( table, (&*delta) .try_get_rel(table as Rel...
Rust
0
from enum import Enum from typing_extensions import Any from leafnode import LeafNode class TextType(Enum): TEXT = "normal" BOLD = "bold" ITALIC = "italic" CODE = "code" LINK = "link" IMAGE = "image" class TextNode(): url: str | None def __init__(self, text: str, text_type: TextType =...
Python
1
__bindgen_bitfield_unit } } impl Default for otRadioFrame__bindgen_ty_1 { fn default() -> Self { let mut s = ::std::mem::MaybeUninit::<Self>::uninit(); unsafe { ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); s.assume_init() } } } impl Default for otRadioFrame ...
Rust
0
.get("method", "GET") start_time = time.time() status = 200 # Track response info async def tracking_send(message): nonlocal status if message["type"] == "http.response.start": status = message["status"] ...
Python
1
u'縂'), (0x2F970, 'M', u'繅'), (0x2F971, 'M', u'䌴'), (0x2F972, 'M', u'𦈨'), (0x2F973, 'M', u'𦉇'), (0x2F974, 'M', u'䍙'), (0x2F975, 'M', u'𦋙'), (0x2F976, 'M', u'罺'), (0x2F977, 'M', u'𦌾'), (0x2F978, 'M', u'羕'), (0x2F979, 'M', u'翺'), (0x2F97A, 'M', u'者'), (0x2F97B, 'M', u'�...
Python
1
o save on computation. let a0 = 1.0 + alpha; coeffs.negative_a1 = 2.0 * cos_theta_c / a0; coeffs.negative_a2 = (alpha - 1.0) / a0; coeffs.b0 = (1.0 + cos_theta_c) / (2.0 * a0); coeffs.b1 = -(1.0 + cos_theta_c) / a0; coeffs.b2 = coeffs.b0; } // Copyright 2021 Vector 35 Inc. // // Licensed under...
Rust
0
except (EnvironmentError, UnboundLocalError): pass try: etc = os.listdir(_UNIXCONFDIR) except OSError: # Probably not a Unix system return distname, version, id etc.sort() for file in etc: m = _release_filename.match(fil...
Python
1
import os import argparse import cv2 import numpy as np from tqdm import tqdm from utils.pointcloud_format import FORMAT_XYZC from utils.io import FileFormat, write_pointcloud parser = argparse.ArgumentParser(prog='SZTAKI-Change3D - Point Cloud Creation') parser.add_argument('input_path', help='The root path of the d...
Python
1
"", false) { Ok(_) => 0, Err(_) => 1 } } else { match discord.send_message(message.channel_id, "Targeted pings not implemented yet :)", "", false) { Ok(_) => 0, Err(_) => 1 } } }<reponame>Eric-Arellano/rust // Test that the we point to the ...
Rust
0
4, 2] = 0 target_corners[:, 4:8, 2] = 1 # pred_corners = pred_corners.to('cpu') # target_corners = target_corners.to('cpu') if pred_corners.shape[0] == 0 or target_corners.shape[0] == 0: return torch.zeros((num_preds, num_targets), dtype=torch.float32).to(pred_bc_img.device), valid_targets_idx...
Python
1
store async fn get_store_bytes( location: &object_store::path::Path, store: &ObjectStore, ) -> Result<bytes::BytesMut> { let b = store .get(location) .await .context(StoreError)? .map_ok(|b| bytes::BytesMut::from(&b[..])) .try_concat() .await .context(...
Rust
0
text::Text; /// This struct represents a text analyzer pub struct TextAnalyzer { text: Text, linter: Vec<Box<dyn Linter>>, } impl TextAnalyzer { /// returns a new textanalyzer pub fn new(text: Text) -> Self { TextAnalyzer { text, linter: Vec::new(), } } ...
Rust
0
sition.1 as i16 + dir.1) as u16); } pub fn apply_action(size: u16, state: &Vec<u16>, current_pos: (u16, u16), new_pos: (u16, u16)) -> Result<Vec<u16>, ()> { let mut new_state: Vec<u16> = state.clone(); if (0..(size)).contains(&(new_pos.0)) && (0..(size)).contains(&(new_pos.1)) { let index_a: u16 = fdtos(current_po...
Rust
0
# common/utils_ak.py # 封装与akshare API相关的工具函数 import os import sys import pandas as pd # 将项目根目录添加到Python路径,以便跨目录调用模块 sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) # 导入申万行业获取模块 try: import akshare as ak except ImportError: print("未安装akshare库,无法使用申万行业功能") print("请执行: pip insta...
Python
1
e(), error, ).as_str())); } _ => {} } } } Ok(rowid_array.len() as u64) } } <gh_stars>1-10 /** * [781] Rabbits in Forest * * In a forest, each rabbit has some color....
Rust
0
= np.random.normal(0, 1, size = [100,6]) sensitivity = np.array([0.1,0.2,-0.2,-0.1, -0.1,-0.2,0.15,-0.15, 0.3,-0.3]) data4 = np.array([25*[1] + 75*[0], 25*[0] + 25*[1] + 50*[0], 50*[0] + 25*[1] + 25*[0], 75*[0] + 25*[1]]).T ret = 0.3 + np.dot(data4,sensitivity[:4]) + np.dot(factor_exposure,sensitivity[4:]...
Python
1
Temperature => "12".into(), HapType::HoldPosition => "6F".into(), HapType::Hue => "13".into(), HapType::Identify => "14".into(), HapType::InputSourceType => "DB".into(), HapType::InputDeviceType => "DC".into(), HapType::Identifier => "E6".into(), HapType::CurrentVisibilityState => "135".into(), ...
Rust
0
by calling StartArgs methods, or just use default constructed StartArgs. pub fn start_emulator(args: &mut ErlStartArgs) { if cfg!(feature = "r20") { println!("Erlang Runtime (compat OTP 20)"); } if cfg!(feature = "r21") { println!("Erlang Runtime (compat OTP 21)"); } if cfg!(feature = "r22") { println!("Erlang R...
Rust
0
for x, y in ref.items(): if id(y) == obj_id: ref[x] = rewrite_func elif isinstance(ref, MutableSequence): for i, v in enumerate(ref): if id(v) == obj_id: ref[i] = rewrite_func if isin...
Python
1
'a mut W, } impl<'a> ILSR16_W<'a> { #[doc = r"Writes raw bits to the field"] #[inline(always)] pub unsafe fn bits(self, value: u8) -> &'a mut W { self.w.bits = (self.w.bits & !0x03) | ((value as u16) & 0x03); self.w } } #[doc = "Reader of field `ILSR17`"] pub type ILSR17_R = crate::R<u8,...
Rust
0
""" Program to calculate and display a user's bonus based on sales. If sales are under $1,000, the user gets a 10% bonus. If sales are $1,000 or over, the bonus is 15%. """ sales = float(input("Enter sales: ")) while sales >= 0: if sales >= 1000: bonus = 0.15 else: bonus = 0.10 print(f"Bonu...
Python
1
, [10, 11, 12, 13], [0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 0x12, 0x13, 0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 0x16, 0x17], [0, 10, 1, 11]} test_vec_perm! {test_vec_perm_i32x4, i32x4, vector_signed_int, [0, 1, 2, 3], [10, 11, 12, 13], [0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 0x12, 0x13, ...
Rust
0
on let rvec: Vec<_> = right.into(); assert_eq!(lvec, [1, 11, 21]); assert_eq!(rvec, [1211, 111221, 312211]); } #[test] fn things_get_dropped() { use std::rc::Rc; // Idea: make one Rc, then clone it a bunch of times into the Vec let rc = Rc::new(()); let rcs = vec![rc.clone(); 20]; l...
Rust
0
rning permissions and // limitations under the License. use core::codec::{EmptyPostingIterator, PostingIterator}; use core::codec::{ EmptyTermIterator, IterWithSlice, MultiPostingsIterator, SeekStatus, TermIterator, Terms, }; use core::index::reader::ReaderSlice; use core::search::{DocIterator, Payload}; use core:...
Rust
0
er: MIT OR Apache-2.0 // // Copyright (c) 2019-2020 <NAME> <<EMAIL>> //! Fix for register-rs. //! //! Used temporarily until https://github.com/tock/tock/issues/1482 is resolved. #![no_std] /// A temporary overwrite for tock's register_structs! so that it does not emit `#[test]` attributes. #[macro_export] macro_rul...
Rust
0
from rest_framework import permissions class IsOwnerOrReadOnly(permissions.BasePermission): """ Custom permission to only allow owners of an object to edit it. """ def has_object_permission(self, request, view, obj): if request.method in permissions.SAFE_METHODS: return True ...
Python
1
if let Some(label_text) = fmt_label(&l) { x_labels.push((x, label_text)); } draw = x_mesh; } MeshLine::YMesh((_, y), _, _) => { if let Some(label_text) = fmt_label(&l) ...
Rust
0
} #[cfg(test)] mod test { use super::*; use crate::dns::mock; use trust_dns_client::{ op::Query, proto::{ rr::{rdata, Name, RData, RecordType}, xfer::DnsResponse, }, rr::Record, }; fn create_txt_record(contents: Vec<&str>) -> DnsResponse { ...
Rust
0
input_df.columns: input_df[col] = pd.to_numeric(input_df[col], errors='coerce') else: input_df[col] = 0 # Default to 0 if numerical feature is missing # For categorical features, ensure they are present or default to a value that OneHotEncoder can handle for...
Python
1
from peewee import Model, CharField, TextField, DateTimeField from ..conn import db from datetime import datetime import secrets class BaseModel(Model): class Meta: database = db() class OAuth2Client(BaseModel): """注册的三方客户端信息""" client_id = CharField(max_length=48, help_text='客户端ID') client...
Python
1
ul crowdfund ending when /// contributors are able to withdraw their funds. After this period, their funds are lost. type RetirementPeriod: Get<Self::BlockNumber>; /// What to do with funds that were not withdrawn. type OrphanedFunds: OnUnbalanced<NegativeImbalanceOf<Self>>; } /// Simple index for identifying a f...
Rust
0
self._NatGatewayId @NatGatewayId.setter def NatGatewayId(self, NatGatewayId): self._NatGatewayId = NatGatewayId @property def NatGatewayName(self): return self._NatGatewayName @NatGatewayName.setter def NatGatewayName(self, NatGatewayName): self._NatGatewayName = NatGa...
Python
1
, vec![], int(24..26, 42))); assert_eq!(parse_def("class Foo {} method bar 42! end"), Ok(class)); } #[test] fn parse_method2() { let mut class = class(18..23, "Foo", vec![]); class.add_method( MethodKind::Instance, method(90..96, "foo", vec![], unary(130..133, "bar", var(125..129, "self")))...
Rust
0
=$q1u:tt, q2u=$q2u:tt, Q1u=$Q1u:tt, Q2u=$Q2u:tt, p1a=$p1a:tt, p2a=$p2a:tt, P1a=$P1a:tt, P2a=$P2a:tt, fu=$fu:expr) => { scalar_methods_2units![ $ty, base, q1a=$q1a, q2a=$q2a, Q1a=$Q1a, Q2a=$Q2a, Ja=$Ja, q1u=...
Rust
0
)?; Ok(()) })?; let can_create_pid_ns = test_in_child_process(|| -> Result<()> { // We don't call prepare_pid_namespace() because it does too much // The following is sufficient to test what we need unshare(CloneFlags::CLONE_NEWUSER | CloneFlags::CLONE_NEWNS | CloneFlags::CLONE_...
Rust
0
, extract_func) if args.agg_func == "prod": aggfunc = agg_prod accuracy = evaluate(args.path, aggfunc, extract_func) if args.agg_func == "mean": aggfunc = agg_mean accuracy = evaluate(args.path, aggfunc, extract_func) if args.agg_func == "last": aggfunc = agg_last ...
Python
1
0000); for _ in (0..n) { js.clear(); js.encode_str3(STR); } }); } #[bench] fn bench_encode_str2(b: &mut test::Bencher) { let mut js = JsonEncoder::with_capacity(400); b.iter(|| { let n = test::black_box(100_0000); for _ in (0..n) { js.cle...
Rust
0
from rest_framework import serializers from .models import categoria class categoriaSerializer(serializers.ModelSerializer): class Meta: model = categoria fields = '__all__'
Python
1
otobufValueRef { ::protobuf::reflect::ProtobufValueRef::Message(self) } } #[derive(PartialEq,Clone,Default)] pub struct DeleteRangeResponse { // special fields unknown_fields: ::protobuf::UnknownFields, cached_size: ::protobuf::CachedSize, } impl DeleteRangeResponse { pub fn new() -> Delet...
Rust
0
i, try!(ascii::raw_to_str(&plainraw)))); plainraw.push(raw_char); prefix.pop(); dict_prefix = try!(util::shift_left_and_push(&dict_prefix, raw_char)); if (i + 1) % blocksize == 0 { prefix = vec![65 as u8; blocksize - 1]; block_no += 1; } } ...
Rust
0
import time import board import terminalio import displayio import digitalio import vectorio from adafruit_bitmap_font import bitmap_font from adafruit_display_text import label display = board.DISPLAY enable = board.ENABLE_DIO act = digitalio.DigitalInOut(board.USER_LED) act.direction = digitalio.Direction.OUTPUT ac...
Python
1
info!("START account.transfer_forever"); let mut cursor = 0; while let Ok(utxo) = utxo_receiver.recv() { input_total_capacity += utxo.capacity(); inputs.push(utxo); if input_total_capacity < min_input_total_capacity { continue; } ...
Rust
0
fn main() -> Result<(), core::convert::Infallible> { let mut display: SimulatorDisplay<BinaryColor> = SimulatorDisplay::new(Size::new(64, 48)); let output_settings = OutputSettingsBuilder::new() .theme(BinaryColorTheme::OledBlue) .build(); let display_area = display.bounding_box(); let...
Rust
0
ng_directory.into(); let mut attempts = 0; const MAX_DEPTH: u8 = 32; loop { let search_path = path.join(PROJ_CONF_FILE); if search_path.is_file() { return Some(search_path); } if attempts > MAX_DEPTH { return None; } path.push(".."); ...
Rust
0
ontinuous_ping()) elif self.continuous_running: self.stop_continuous_ping() else: self.query_one("#ping-results").update("⚠️ Select a device first (1-9) or enter IP (press 'i')") elif event.key == "r": # Ref...
Python
1
// instancia um usuário e modifica o username, mantendo o mesmo id let user = User { id, username: String::from("joselito"), }; // gera um HashMap que será mapeado pro json a ser enviado na requisição de atualização let mut map = HashMap::new(); map.insert("id", user.id.to_strin...
Rust
0
= "Status Register"] pub mod sr; #[doc = "FR register accessor: an alias for `Reg<FR_SPEC>`"] pub type FR = crate::Reg<fr::FR_SPEC>; #[doc = "Flag Register"] pub mod fr; #[doc = "RSER register accessor: an alias for `Reg<RSER_SPEC>`"] pub type RSER = crate::Reg<rser::RSER_SPEC>; #[doc = "Interrupt and DMA Request Sele...
Rust
0
eWeylGroup(['A',2,1], general_linear=True).family() # indirect doctest sage: fam Lazy family (<lambda>(i))_{i in Integer Ring} sage: fam[-3] -3 """ return LazyFamily(ZZ, lambda i: i) def _an_element_(self): r""" An element of ``self``....
Python
1
schedule = input().split(', ') command = input() while command != 'course start': command = command.split(':') cmd = command[0] lesson = command[1] exercise = f'{lesson}-Exercise' if cmd == 'Add': if lesson not in schedule: schedule.append(lesson) elif cmd == 'Insert': ...
Python
1
"""Supabase authentication provider for the core auth system.""" import logging from core.domains.auth import AuthProviderRegistry from core.logging import setup_logger from .config import SupabaseConfig, settings from .provider import SupabaseAuthProvider __all__ = [ "SupabaseAuthProvider", "SupabaseConfig...
Python
1
FnOnce(&mut Self::Value) -> Out; } impl<V> RwLockExt for RwLock<V> { type Value = V; fn with_read<Scope, Out>(&self, scope: Scope) -> Out where Scope: FnOnce(&Self::Value) -> Out, { let value = self.read().expect("lock poisoned"); scope(&*value) } fn with_write<Scope,...
Rust
0
#!/usr/bin/python # -*- coding:utf-8 -*- from PyQt6.QtCore import * from PyQt6.QtWidgets import * from components.raw_ui import Ui_HotkeysPage from components.line_edit.hotkeys_line_edit import HotkeyLineEdit from common.config import Config class HotkeysPage(QWidget, Ui_HotkeysPage): def __init__(self, parent=...
Python
1
from conans import ConanFile, CMake class SeleneConan(ConanFile): name = "selene" version = "0.3.1" license = "MIT" url = "https://github.com/kmhofmann/selene" description = "A C++17 image representation, processing and I/O library." settings = "os", "compiler", "build_type", "arch" optio...
Python
1
'origin': str, # 博客来源 'tags': [ # list, 博客标签 str, # 标签文字 ], 'title': str, # 博客标题 'url': str, # 博客链接 ...
Python
1
from jinja2 import PackageLoader, Environment, FileSystemLoader import pandas as pd import re # 过滤器简单理解是可以对渲染进的变量进行二次加工的函数,比如格式化时间,或者是格式化端口(下例) INTF_MAPPING = { 'eth': 'Ethernet', 'Eth': 'Ethernet', } def interface_name_filter(name): intf_re = re.compile('(.+?)(\d+[\d/]*)') match = intf_re.match(name...
Python
1
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // The GLSL Specification, ch 8.7, Vector Relational Functions use basenum::Primitive; use vec::traits::{ GenVec, GenBVec }; use vec::vec::{ Vect...
Rust
0
color: vk::ClearColorValue { float32: [0.0, 0.0, 0.0, 0.0], }, }, vk::ClearValue { depth_stencil: vk::ClearDepthStencilValue { depth: 1.0, stencil: 0, }, }, ]; ...
Rust
0
encode multiple attributes of /// a character in a single place. This way we increase the likelihood that the table is in the /// cache as it is used in multiple call sites. The reason why the table has (0 - 0) is so that I /// can remember what index is being modified -- much better than calculating by hand where an ...
Rust
0
9, LowercaseJ = 0x6A, LowercaseK = 0x6B, LowercaseL = 0x6C, LowercaseM = 0x6D, LowercaseN = 0x6E, LowercaseO = 0x6F, LowercaseP = 0x70, LowercaseQ = 0x71, LowercaseR = 0x72, LowercaseS = 0x73, LowercaseT = 0x74, LowercaseU = 0x75, LowercaseV = 0x76, LowercaseW = 0...
Rust
0
from CoolProp.CoolProp import AbstractState import CoolProp as CP import numpy as np libr = AbstractState("INCOMP", "LiBr") libr.set_mass_fractions([0.5]) libr.update(CP.QT_INPUTS, 0, 300) libr.p() libr.set_mass_fractions([0.2]) libr.update(CP.QT_INPUTS, 0, 300) libr.p() # saturation pressure by temperature and li...
Python
1
passage_field_separator) def process(self, shard_num=1, shard_idx=0): self.dataset = self.dataset.shard(shard_num, shard_idx) if self.preprocessor is not None: self.dataset = self.dataset.map( self.preprocessor(self.tokenizer, self.p_max_len, self.separator), ...
Python
1
(all1_l.tag(), ALLPASS_TUNING_L2).rack(rack, buffers); let all2_r = AllPassBuilder::new(all1_r.tag(), ALLPASS_TUNING_R2).rack(rack, buffers); let all3_l = AllPassBuilder::new(all2_l.tag(), ALLPASS_TUNING_L3).rack(rack, buffers); let all3_r = AllPassBuilder::new(all2_r.tag(), ALLPASS_TUNING_R3).r...
Rust
0
unit: ::libc::c_int, buf: *mut ::libc::c_char, n: ::libc::c_int) -> (); pub fn IDL_EzCall(argc: ::libc::c_int, argv: *mut IDL_VPTR, arg_struct: *mut IDL_EZ_ARG) -> (); pub fn IDL_EzCallCleanup(argc: ::libc::c_int, argv: *mut IDL_VPTR, arg...
Rust
0
alidationError("URL or bundle is required") rec.url = oca_data.get("url") rec.bundle = oca_data.get("bundle") await rec.save(session) self.logger.info(f"< update_oca_record({oca_id}) = {rec}") return rec async def delete_oca_record(self, issuer_profile: Profile...
Python
1
e(PackLocation { bundle_index, entry_index: idx, }); } } None } pub(crate) fn internal_get_packed_object_by_index<'a>( &self, pack_index: usize, object_index: u32, buffer: &'a mut Vec<u8>, ...
Rust
0
"""Support for Alpha2 heat control valve opening sensors.""" from homeassistant.components.sensor import SensorEntity from homeassistant.config_entries import ConfigEntry from homeassistant.const import PERCENTAGE from homeassistant.core import HomeAssistant from homeassistant.helpers.entity_platform import AddEntitie...
Python
1
t attr = HashMap::new(); let mut records: Vec<Record> = Vec::new(); let mut current_record: Option<Record> = None; let mut data_chars_: Vec<char> = data.chars().collect(); let mut data_chars = &data_chars_[..]; let mut next_new_line = 0; let mut ended = false; let...
Rust
0