text
string
label_name
string
labels
int64
n.dumps(obj)) @classmethod def from_json(cls, json_str: str) -> Self: """Returns the object represented by the json string""" instance = cls.model_construct() error_messages = [] match = 0 # deserialize data into CheckPasswordWithDefaultSignInExperience200ResponseOneOf ...
Python
1
== 1 { pending::<Result<(), ()>>().await } else { Ok(()) } }; let now = Instant::now(); let result = retry(create_fut, attempts(interval(Duration::from_millis(50))...
Rust
0
-> HdkResult<ElementVec> { Ok(host_call::<QueryInput, QueryOutput>(__query, &QueryInput::new(filter))?.into_inner()) } use std::collections::HashMap; pub struct Storage { pub id: String, pub states: Vec<StorageState>, } pub struct StorageState { pub capacity: Option<u64>, pub dfs_used: Option<u64...
Rust
0
_status(&content, "CONFIG_UTS_NS", FeatureDisplay::new("uts")); print_feature_status(&content, "CONFIG_IPC_NS", FeatureDisplay::new("ipc")); let user_display = match rootless::unprivileged_user_ns_enabled() { Ok(false) => FeatureDisplay::with_status("user", "enabled (root only)", "disabled"...
Rust
0
_point_obj_funcs(); let (obj_source_region_3, _funcs) = source_region.get_region_obj_funcs(); let enum_render_flags_4 = render_flags.bits(); let (obj_data, funcs) = self.get_widget_obj_funcs(); unsafe { ((*funcs).render)( obj_data, obj_target_...
Rust
0
# self parameter class Employee: language = "Python" salary = 12000 def getInfo(self): print(f"The language is {self.language}. The salary is {self.salary}") @staticmethod # to avoid giving self in args def greet(): print("Good morning") harry = Employee() # harry.language = "Javascript" harr...
Python
1
import pytest from django.contrib.auth import get_user_model from products.models import Comment, Product from products.serializers.comment_serializer import CommentSerializer, CommentCreateSerializer User = get_user_model() @pytest.mark.django_db def test_comment_serializer_with_masked_name(mocker): # Create a ...
Python
1
}).collect::<HashSet<(i32, i32, i32)>>(); Self { id, pos: None, beacons } } fn find_overlap(&self, ref_scanner: &Scanner, rot_mats: &[Matrix]) -> (u32, (usize, (i32, i32, i32))) { let mut max_overlap: u32 = 0; let mut best_pos = (0, (0, 0, 0)); for (mat_id, &mat) in...
Rust
0
(task) { let required = task.required_forest_size(); self.forest_usage += required; Ok(()) } else { Err(TownError::NotEnoughSupply) } } pub fn register_task_end(&mut self, task: TaskType) -> Result<(), TownError> { let required = task.requi...
Rust
0
''' 92) Create a logic that reads an integer and passes it to a procedure called EvenOrOdd() which will check and display on the screen whether the value passed as a parameter is EVEN or ODD. ''' def even_or_odd(value: int) -> None: if value % 2 == 0: print(f"{value} is EVEN.") else: ...
Python
1
eval))] // pub fn main(args: Vec<String>) -> isize { // println!("Error: the \"rq_eval\" cfg option must be enabled!"); // -1 // } // #[cfg(rq_eval)] pub fn main(args: Vec<String>) -> isize { let mut opts = Options::new(); opts.optflag("h", "help", "print this help menu"); opts.optopt("w", "whole"...
Rust
0
RevolutedCurve { curve: self.curve.clone(), origin: self.origin, axis: -self.axis, } } } fn sub_include<C0, C1>( surface: &RevolutedCurve<C0>, curve: &C1, knots: &[f64], degree: usize, ) -> bool where C0: ParametricCurve3D, C1: Parametric...
Rust
0
from abc import ABC, abstractmethod from typing import BinaryIO class S3Storage(ABC): base_url = "/media/" @abstractmethod async def exists(self, image_id: str) -> bool: ... @abstractmethod async def upload( self, filename: str, file: BinaryIO, size: int | None = None ) -> str: ...
Python
1
of `derive_index` start from 1. fn test_split_impl(derive_index: usize, seq: &[usize]) { let mut c = RegionCollector::new(); let init_regions = &[ new_region(1, b"", b"k1", 1), new_region(2, b"k1", b"k9", 1), new_region(3, b"k9", b"", 1), ]; must_...
Rust
0
from patterns.plans.tree.node.node import Node from objects.match import Match import typing import os class TreeInstanceStorage: """ This class represents the storage of all the relevant instances created during the evaluation of the pattern. Creation and deletion of objects is dynamic. """ ...
Python
1
ch_op.alter_column('shipping_address', existing_type=sa.String(length=200), type_=sa.TEXT(), nullable=False) batch_op.drop_column('shipping_phone') batch_op.drop_column('shipping_zip') batch_op.drop_column('shipping_state') batch_op.drop_colum...
Python
1
al[str] = Field(None, description="租户ID") id: Optional[str] = Field(None, description="业务ID") class Config: schema_extra = { "example": { "model": "virtualmodel-v2", "base_image_url": "https://example.com/model_photo.jpg", "prompt": "A woman s...
Python
1
ter will have split the write request by database name. // Target 1 will have received only the "cpu" table. // Target 2 will have received only the "disk" table. // Target 3 won't get any writes. let mut query_results = target_1 .flight_client() .perform_query(&db_name_1, "select * fro...
Rust
0
tz': 'UTC', }) self.assertEqual(recurrence.name, 'Every 2 Months day 27 until 2024-11-15') def test_monthly_none_by_date(self): recurrence = self.env['calendar.recurrence'].create({ 'rrule_type': 'monthly', 'interval': 2, 'month_by': 'date', '...
Python
1
NCEDATA, '__module__' : 'geofence.geofence_pb2' # @@protoc_insertion_point(class_scope:mavsdk.rpc.geofence.GeofenceData) }) _sym_db.RegisterMessage(GeofenceData) UploadGeofenceRequest = _reflection.GeneratedProtocolMessageType('UploadGeofenceRequest', (_message.Message,), { 'DESCRIPTOR' : _UPLOADGEOFENCEREQUES...
Python
1
stream of numbers, starting at 0. /// let mut it = unfold(0, |i| Some((i, i + 1))); /// /// // Make a list out of its first five elements. /// let numbers = Vector::from_iter(it.take(5)); /// assert_eq!(numbers, vector![0, 1, 2, 3, 4]); /// ``` /// /// [std::option::Option]: https://doc.rust-lang.org/std/option/enum.Op...
Rust
0
(): messages.error(request, "You are not a member of this event.") return redirect('chipin:group_detail', group_id=group.id) # Remove the user from the event event.members.remove(request.user) messages.success(request, f"You have successfully left the event '{event.name}'.") # Optionally...
Python
1
ror::ErrorKind::PduInvalidVector(vector))); } if length < E131_UNIVERSE_DISCOVERY_FRAMING_LAYER_MIN_LENGTH { bail!(ErrorKind::SacnParsePackError(sacn_parse_pack_error::ErrorKind::PduInvalidLength(length))); } // Source Name ...
Rust
0
Error::Internal(InternalError::CreateCert(Box::new(err))) })?; Ok(x509) } } CertIssuanceMethod::LocalCa => { // Indirect reference to the local CA. Look it up. let (issuer_c...
Rust
0
xfcc\x00\xf76\x9b\xcd\x93\xc6\x18\x14E\x01\x0e!\ \x98\xe5ry\xdfZ+Z\xeb\xb2\xef\xfb\x17\x8c1\xef\ 2\xf3\xfd\xa2(\xde\x9a\xcf\xe7o*\xa5\x06k\xed;\ \xce\xb9\x17\x99\xf9\x09km\xea\xfb\xfe\xd7\xedv\xfb,\ \xf7}\x7fn6\x9b](\xcb\x12\xde\xfb\xf7\xb3,\xfb\ \x1d\xc0\xb9\xedv\xbbUJ\x1dh\xad\x0f\x9cs\xab\x18\ \xe3r\xb1X\xfc\xe2\xbd...
Python
1
_TABLE>(), 8); assert_eq!(size_of::<RTLP_CURDIR_REF>(), 16); assert_eq!(align_of::<RTLP_CURDIR_REF>(), 8); assert_eq!(size_of::<RTL_RELATIVE_NAME_U>(), 32); assert_eq!(align_of::<RTL_RELATIVE_NAME_U>(), 8); assert_eq!(size_of::<GENERATE_NAME_CONTEXT>(), 36); assert_eq!(align_of::<GENERATE_NAME_C...
Rust
0
import logging import torch.optim def build_lr_scheduler(cfg, optimizer, **kwargs): if cfg.TRAIN.LR_SCHEDULER == 'MultiStepLR': last_epoch = kwargs["last_epoch"] if 'last_epoch' in kwargs else -1 if not isinstance(optimizer, list): lr_scheduler = torch.optim.lr_scheduler.MultiStepLR...
Python
1
end); if max_end == 0 { log!("ERROR!!! Kernel reported zero loadable size"); loop {} } max_end } #[no_mangle] /// Returns program entry point pub extern "C" fn elf_load_segments(file_base: &ElfFile, output_base: *mut u8) -> usize { log!("elf_load_segments(file_base={:p}, output_base={:p})", file_base, output_b...
Rust
0
= self.inner.read(); let controller = inner_guard .controller .as_ref() .ok_or(format_err!("client controller has not been initialized"))?; let req_status = controller.start_client_connections().await?; if fidl_common::RequestStatus::Acknowledged == req_stat...
Rust
0
(',', '.')) the_company = Company.objects.get(id=company_id) latest_inc = the_company.inc_statements.latest() latest_margin = the_company.margins.latest() last_revenue = latest_inc.revenue average_shares_out = latest_inc.weighted_average_shares_outstanding net_income_mar...
Python
1
} pub fn add_var(&mut self, var_id: VarId, value: Value) { self.vars.insert(var_id, value); } pub fn add_env_var(&mut self, var: String, value: String) { self.env_vars.insert(var, value); } pub fn collect_captures(&self, captures: &[VarId]) -> Stack { let mut output = Stac...
Rust
0
sponse))) column_names = { x: x.strip().lower() for x in df.columns } df.rename(columns = column_names, inplace = True) records = df.to_dict('records') samples = [] timestamp = utcnow() for idx, value in enumerate(records): total_memory_in_bytes = int(valu...
Python
1
# -*- coding: utf-8 -*- # # Copyright 2021 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
from math_verify import parse, verify from sympy import * import math from post_process import parse_math_answer, remove_not, cal_not,parse_not def equiv( model_output, # 模型输出的字符串 answer, # 标准答案的字符串 rel_tol # 相对误差容忍度(默认0.05, 即5%误差范围) ): print('\n====>:equiv判别') model_output=model_out...
Python
1
3C (<) [0x00, 0x00, 0x3F, 0x00, 0x00, 0x3F, 0x00, 0x00], // U+003D (=) [0x06, 0x0C, 0x18, 0x30, 0x18, 0x0C, 0x06, 0x00], // U+003E (>) [0x1E, 0x33, 0x30, 0x18, 0x0C, 0x00, 0x0C, 0x00], // U+003F (?) [0x3E, 0x63, 0x7B, 0x7B, 0x7B, 0x03, 0x1E, 0x00], // U+0040 (@) [0x0C, 0x1E, 0x33, 0x33, 0x3F, 0x33, ...
Rust
0
_req: sbxsvc::OpenExecutionRequest, ) -> rpc::Call<sbxsvc::OpenExecutionReply> { unimplemented!(); } fn close_execution( &self, _req: sbxsvc::CloseExecutionRequest, ) -> rpc::Call<sbxsvc::CloseExecutionReply> { unimplemented!(); } fn create_execution_sta...
Rust
0
Result { write!(f, "{}", self.as_ref()) } } impl<T: PartialEq + AsRef<str>> PartialOrd for RoomVersionId<T> { fn partial_cmp(&self, other: &RoomVersionId<T>) -> Option<Ordering> { self.as_ref().partial_cmp(other.as_ref()) } } impl<T: Eq + AsRef<str>> Ord for RoomVersionId<T> { fn cmp(&...
Rust
0
import mypackage.mymodule as m from mypackage.mymodule import Employee print(m.runs) print(m.sports) m.greet("George") emp1 = Employee('Kenedy', 25000) print(emp1)
Python
1
) or BLAKE2. //! //! It is not secure, nor does it aim to be. It aims to have high quality pseudorandom output and //! few collisions, as well as being fast. //! //! # Benchmark //! //! On normal hardware, it is expected to run with a rate around 5.9-6.7 GB/S on a 2.5 GHz CPU. //! Further improvement can be seen when h...
Rust
0
let data = par_search(masks); println!("{} solutions found", data.nb); print_sol(&data.min); print_sol(&data.max); println!(""); } <reponame>sk2sat/rasp extern crate rasp; #[test] fn a8() { let tc_str = r#"; Estes A8 RASP.ENG file made from NAR published data ; File produced March 3, 2011 ; The to...
Rust
0
"ır_", "yap", "ma_", "len", "iler", "_me", "_yap", "fa", "aya", "dü", "a_b", "n_k", "alı", "şt", "nin", "anl", "yl", "ok", "iye", "hi", "ac", "ine", "e_y", "ro", "nin_", "ağ", "lý", "dir", "lara", "rak_", "e_d", "_n", "ü_", "rý", "n_s", "_ar", "ız", "nı_", "lg...
Rust
0
import pytest from sqlalchemy import create_engine from sqlalchemy.orm import sessionmaker from bcm_spectra.db import init_db, get_session def test_init_db(): engine = init_db("sqlite:///:memory:") assert engine is not None def test_get_session(): engine = create_engine("sqlite:///:memory:") sessio...
Python
1
#!/usr/bin/python # -*- coding: utf-8 -*- ''' Roles in this namespace are meant to provide SSH keygen utilities for Debian distributions. ''' from os.path import join from Crypto.PublicKey import RSA from provy.core import Role class SSHRole(Role): ''' This role provides SSH keygen utilities for Debian di...
Python
1
def recall(scores, labels, k): scores = scores labels = labels rank = (-scores).argsort(dim=1) cut = rank[:, :k] hit = labels.gather(1, cut) return (hit.sum(1).float() / torch.min(torch.Tensor([k]).to(hit.device), labels.sum(1).float())).mean().cpu().item()
Python
1
#!/usr/bin/env python3 # used to generate model: onnx-tests/tests/reduce_prod/reduce_prod.onnx import torch import torch.nn as nn class Model(nn.Module): def __init__(self): super(Model, self).__init__() def forward(self, x): return ( # ReduceProd, keepdims=0, axes=None ...
Python
1
# Crie um algoritmo que leia dois números, multiplique o menor por 10, e divida # o maior por 2, some os seus valores e verifique se o resultado e par, em caso # afirmativo exiba a mensagem, o resultado é par, caso contrario, exiba a # mensagem, o resultado é impar. ''' n1 = int(input('Digite um numero: ')) n2 = int(...
Python
1
min_scale=min_scale, max_scale=max_scale, ) @registry.register_processor("blip_image_eval") class BlipImageEvalProcessor(BlipImageBaseProcessor): def __init__(self, image_size=384, mean=None, std=None): super().__init__(mean=mean, std=std) self.transform = transforms...
Python
1
{ let mut input = input.to_vec(); let mut output = Vec::new(); // successful run DecompressReader::new(BufReader::new(&*input)) .unwrap() .read_to_end(&mut output) .unwrap(); // add trailing garbage, make sure we notice input.push(0)...
Rust
0
import modules.scripts from modules.processing import StableDiffusionProcessingImg2Img from yandere_inpaint.inpaint import yandereInpaint from yandere_inpaint.options import getResolution, getYandereInpaintUpscaler INPAINTING_FILL_ELEMENTS = ['img2img_inpainting_fill', 'replacer_inpainting_fill'] colorfix = None try:...
Python
1
ients", type=int, default=num_users-5, help="number of private clients") parser.add_argument("--num_public_clients", type=int, default=5, help="number of public clients") parser.add_argument("--classes-per-client", type=int, default=26, help="number of classes each client experience") #####################...
Python
1
>, /// current_chunk_offset is the offset of current chunk in the buffer. current_chunk_offset: usize, /// current_chunk_min_start_ts is the min ts of the current chunk. current_chunk_min_start_ts: u64, /// current_chunk_max_start_ts is the max ts of the current chunk. current_chunk_max_start_ts...
Rust
0
ttached pickling_check(coulomb) def test_pppm_energy(simulation_factory, two_charged_particle_snapshot_factory): """Test that md.long_range.pppm.Coulomb computes the correct energy.""" nlist = hoomd.md.nlist.Cell(buffer=0.4) ewald, coulomb = hoomd.md.long_range.pppm.make_pppm_coulomb_forces( ...
Python
1
#!/usr/bin/env python # -*- coding: utf-8 -*- """ @Time : 2024/7/14 21:13 @Author : yusingh @File : main.py Homework of Chapter 3(https://www.feishu.cn/community/article/wiki?id=7382188504203132929) """ from metagpt.actions import Action from metagpt.roles.role import Role, RoleReactMode from metagpt.schema impo...
Python
1
from collections import OrderedDict class AttribDict(OrderedDict): """ AttrDict extends OrderedDict to provide attribute-style access. Items starting with __ or _OrderedDict__ can't be accessed as attributes. """ __exclude_keys__ = set() def __getattr__(self, name): if (name.startswit...
Python
1
::default::Default, std::clone::Clone, std::cmp::PartialEq, std::fmt::Debug)] pub struct Builder { pub(crate) message: std::option::Option<std::string::String>, } impl Builder { pub fn message(mut self, input: impl Into<std::string::String>) -> Self { self.message = Some(input.in...
Rust
0
#this is single comment print("simgle line comment") '''This is multyiple line comment''' print("multiple line comment") # Backslash Character print("Habibur Rahman \n 01608410224") print("Habibur Rahman \t 01608410224") print("\"HABIB\"")
Python
1
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sun Apr 19 16:16:04 2020 @author: Alexei """ import networkx as nx import matplotlib.pyplot as plt if __name__ == '__main__': """Simple test.""" G = nx.DiGraph() G.add_edges_from( [('A', 'B'), ('A', 'C'), ('D', 'B'), ('E', 'C'), ('E',...
Python
1
rg("4").spawn().unwrap(); let _result2 = child2.wait().unwrap(); println!("reached end of main"); } <reponame>dkozma/wasm-bindgen #![allow(unused_imports)] use super::*; use wasm_bindgen::prelude::*; #[wasm_bindgen] extern "C" { # [wasm_bindgen (extends = EventTarget , extends = :: js_sys :: Object , js_nam...
Rust
0
chainer.reporter.report({'main/loss': loss}) for loss in losses: loss.backward() for model in six.itervalues(models_others): # self._logging("before adding grads") model_main.addgrads(model) # self._logging("after adding grads") optimizer....
Python
1
#!/usr/bin/env python3 # # Copyright (c) 2015-2017 Nest Labs, 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.or...
Python
1
shielded in prop::collection::hash_set(arb_shielded_receiver(), 1..2), transparent in prop::option::of(arb_transparent_receiver()), ) -> Address { Address(shielded.into_iter().chain(transparent).collect()) } } proptest! { #[test] fn ua_roundt...
Rust
0
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import os import time import numpy as np import pdb import faiss from datasets import load_sift1M, evaluate print("load data") xb, xq, xt,...
Python
1
import pytest import tensorflow as tf import QGOpt.manifolds as manifolds import QGOpt.optimizers as optimizers import math #---------------------------------------------------------------------------------# ham_dim = 20 # dimension of a hamiltonian renorm_ham_dim = 10 # dimension of a renormalized hamiltonian numbe...
Python
1
b auth: AuthenticatedNodeId, pub nonce: Box<[u8]>, } <gh_stars>1-10 //! Assertions for testing. mod traits; pub use traits::{Float, Floats}; /// Assert that the absolute difference between two quantities is small. /// /// In case of vectors, the assertion is elementwise. pub fn close<F, F1, F2>(x: F1, y: F2, delt...
Rust
0
`prove_key` has to be consistent (with the same evaluation /// domain etc.), otherwise return error. fn prove<C, R, T>( prng: &mut R, circuit: &C, prove_key: &Self::ProvingKey, extra_transcript_init_msg: Option<Vec<u8>>, ) -> Result<Self::Proof, PlonkError> where ...
Rust
0
anslation=pose[:3, 3], mat3x3=pose[:3, :3], ), ) rr.log( f"{base_name}/pinhole", rr.Pinhole( image_from_camera=intrinsics, height=height, ...
Python
1
__author__ = "chris" import os import tempfile from django.conf import settings from django.utils.translation import gettext_lazy as _ from celery import app celery_app = app.app_or_default() def get(key, default): return getattr(settings, key, default) IS_WINDOWS = os.name == "nt" # AUTH based settings WO...
Python
1
let py = gil.python(); let val = 123 as $t1; let obj = val.to_py_object(py).into_object(); assert_eq!(obj.extract::<$t2>().unwrap(), val as $t2); } ) ); num_to_py_object_and_back!(to_from_f64, f64, f64); num_to_py_object_and_back!(to_fro...
Rust
0
::BASE_ADDRESS + 0x27C ); assert_eq!(&icd.ICDICPR as *const _ as usize, icd::BASE_ADDRESS + 0x280); assert_eq!( icd.ICDICPR.last().unwrap() as *const _ as usize, icd::BASE_ADDRESS + 0x2FC ); assert_eq!(&icd.ICDABR as *const _ as usize, icd::BASE_ADDRESS ...
Rust
0
# Copyright (c) 2019 Ultimaker B.V. # Cura is released under the terms of the LGPLv3 or higher. from .WelcomePagesModel import WelcomePagesModel # # This Qt ListModel is more or less the same the WelcomePagesModel, except that this model is only for adding a printer, # so only the steps for adding a printer is inclu...
Python
1
## 11/60 Range Data Type (used in foreloop conjunction) my_range = range(4) print(my_range) my_range = range(4, 10, 2) print(list(my_range)) print(len(my_range)) print(sum(my_range)) for i in range(10): print(i) ## 11/61 Loops Introduction ## 11/62 Loops While counter = 0 # Create Variable while counter <= 5: # ...
Python
1
olumn=1, row=0, sticky="W", padx=3, pady=3) path_label.grid(column=0, row=1, sticky="W") path_box.grid(column=1, row=1, sticky="EW", padx=3, pady=3) save_box.grid(column=0, row=2, sticky="W", columnspan=2) debug_frame.grid(column=0, row=0, stick="NSEW") debug_frame.columnconfigu...
Python
1
Block::Plaintext(_) => Ok(block), Block::UnencryptedCryptBlock(_) => Ok(block), Block::EncryptedCryptBlock(ref mut crypt_block) => { let decrypted_text = decrypt(password, &crypt_block)?; Ok(Block::UnencryptedCryptBlock(decrypted_text)) } ...
Rust
0
pub DataRange: KSDATAFORMAT, pub bFixedSizeSamples: super::super::Foundation::BOOL, pub bTemporalCompression: super::super::Foundation::BOOL, pub StreamDescriptionFlags: u32, pub MemoryAllocationFlags: u32, pub ConfigCaps: KS_VIDEO_STREAM_CONFIG_CAPS, pub VideoInfoHeader: KS_VIDEOINFOHEADER, } #...
Rust
0
gineOptions, Resolution, VanillaVersion}; use crate::fs::canonicalize; #[cfg(not(windows))] static GAME_DIR_OPTION_EXAMPLE: &str = "/opt/ja2"; #[cfg(windows)] static GAME_DIR_OPTION_EXAMPLE: &str = "C:\\JA2"; /// Handles command line parameters for executables /// /// Encapsulates the Cli arguments definition and th...
Rust
0
""" @Author: Haoxi Ran @Date: 01/03/2024 @Citation: Towards Realistic Scene Generation with LiDAR Diffusion Models """ import os import torch import yaml from lidm.utils.misc_utils import dict2namespace from ..modules.rangenet.model import Model as rangenet try: from ..modules.minkowskinet.model import Model a...
Python
1
from pydantic import BaseModel, Field from datetime import datetime from typing import List, Optional import uuid from src.report.enums import ReportProgress # Schema for creating a follow-up report class Follow_Up_Create_Model(BaseModel): description: str = Field(..., example="This is a follow-up description.") ...
Python
1
parse(buf: &[u8]) -> Self; /// Marshal a message into a `u8` buffer. fn marshal(Self, &mut Vec<u8>); } pub struct Mask<T> { pub value: T, pub mask: Option<T>, } /// Fields to match against flows. pub struct Pattern { pub dl_src: Option<u64>, pub dl_dst: Option<u64>, pub dl_typ: Option<u16...
Rust
0
Result<Option<RawSeal>, Error<B>> { // Get a randomness source from the environment and fail if one isn't available let mut rng = SmallRng::from_rng(&mut thread_rng()) .map_err(|e| Error::Environment(format!("Initialize RNG failed for mining: {:?}", e)))?; // Loop the specified number of times for _ in 0.....
Rust
0
"""Create lobby table. Revision ID: 23a589a1785c Revises: 56dd21b994fe Create Date: 2017-12-04 22:19:12.612743 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = '23a589a1785c' down_revision = '56dd21b994fe' branch_labels = None depends_on = None def upgrade(): ...
Python
1
, [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about avaliable fields see [txfuncaddr3](txfuncaddr3) module"] pub type TXFUNCADDR3 = crate::Reg<u...
Rust
0
instance = cast(PersistentLocalHnswSegment, instance) instance.open_persistent_index() self._vector_instances_file_handle_cache.set(collection_id, instance) def _cls(self, segment: Segment) -> Type[SegmentImplementation]: classname = SEGMENT_TYPE_IMPLS[SegmentType(se...
Python
1
} # 根据同义词中的产品添加特定上下文 for synonym in synonyms: if synonym in product_context_map: context_words.update(product_context_map[synonym][:4]) # 每个产品取4个词 break # 避免重复添加相似产品的上下文 # 根据查询关键词特征添加上下文 query_lower = query.lower() ...
Python
1
ef926e1f, 0x3ee7, 0x32bc, 0x8b, 0x01, 0xc6, 0xe9, 0x8c, 0x24, 0xbc, 0x19)] interface _InternalMessageWrapper(_InternalMessageWrapperVtbl): IDispatch(IDispatchVtbl) {}} RIDL!{#[uuid(0xc9614d78, 0x10ea, 0x3310, 0x87, 0xea, 0x82, 0x1b, 0x70, 0x63, 0x28, 0x98)] interface _MethodCallMessageWrapper(_MethodCallMessageWrapp...
Rust
0
J_WRITE201_AN": 604, "DATA_OBJ_CLOSE201_AN": 605, "DATA_OBJ_LSEEK201_AN": 612, "RM_COLL_OLD201_AN": 617, "REG_COLL201_AN": 618, "MOD_COLL201_AN": 646, "COLL_REPL201_AN": 662, "RM_COLL201_AN": 663, "OPEN_COLLECTION201_AN": 712, "GET_LIBRARY_FEATURES_AN": 801, "REPLICA_TRUNCATE_AN"...
Python
1
ín"), ('苡', "yǐ"), ('苢', "yǐ"), ('苣', "jù,qǔ"), ('苤', "piě,pī"), ('若', "ruò,ré,rè,rě"), ('苦', "kǔ,gǔ,hù"), ('苧', "níng,zhù"), ('苨', "nǐ"), ('苩', "bó,pā"), ('苪', "bǐng"), ('苫', "shān,shàn,tiān,chān"), ('苬', "xiú"), ('苭', "yǎo"), ('苮', "xiān"), ('苯', "běn"), ...
Rust
0
etag_values(field.value()))?; return Ok(Expect::IfMatch(versions)); } } else if field.name().eq_ignore_ascii_case("if-none-match") { if field.value() == "*" { return Ok(Expect::None); } else { let versions = track!(parse_etag_va...
Rust
0
name.encode(e); self.type_.encode(e); } } impl<'a> Encode for Variant<'a> { fn encode(&self, e: &mut Vec<u8>) { e.push(0x70); self.cases.encode(e); } } impl<'a> Encode for Case<'a> { fn encode(&self, e: &mut Vec<u8>) { self.name.encode(e); self.type_.encode(e); ...
Rust
0
9d62c74, 0x5bf352dd42e52286, 0x7a1856b54000d807, 0x841f46a6fab64ce5, 0x36461e91efe997e9, 0x8968face6fde0be8, 0xbf17a0f773aac5c1, 0x1262c70255bf5827, 0x27e97bf612940af7, 0xaf5a3...
Rust
0
_shift| is_frame_shift_ignored(frame_shift, config)); let total_frame_shifts = frame_shifts.len(); let total_frame_shifts_ignored = frame_shifts_ignored.len(); let score = total_frame_shifts as f64 * config.score_weight; let status = QcStatus::from_score(score); Some(QcResultFrameShifts { score, st...
Rust
0
from typing import Dict, List, Tuple, Set, Any, Optional import math from collections import defaultdict def f_beta(pred_list: list[str], true_list: list[str], beta=0.5, eps=1e-8) -> float: pred_set = set(pred_list) true_set = set(true_list) tp = len(pred_set & true_set) P = tp / (len(pred_list) + eps...
Python
1
al, %dx" :: "{dx}"(port), "{al}"(val)); } #[inline(always)] pub unsafe fn inb(port: u16) -> u8 { let ret: u8; asm!("inb %dx, %al" : "={ax}"(ret) : "{dx}"(port) :: "volatile"); ret } } #[no_mangle] pub extern "C" fn bootmain() { hello(); let buffer = unsafe { core::slice...
Rust
0
reserved BitField("reserved1", 0, 1), # bit 4 is reserved BitField("receiver_on_when_idle", 0, 1), # Receiver On When Idle BitField("power_source", 0, 1), # Power Source BitField("device_type", 0, 1), # Device Type BitField("alternate_pan_coordinator", 0, 1), # Alternate PA...
Python
1
v1/XmlPullParser;Landroid/util/AttributeSet;)V\0"); __jni_env.call_void_method_a(self.0.object, __jni_method, __jni_args.as_ptr()) } } /// [inflate](https://developer.android.com/reference/android/graphics/drawable/Drawable.html#inflate(android.content.res.Resources,%20org.x...
Rust
0
/ Processor-specific flags. /// /// A combination of the `EF_*` constants. pub e_flags: U32<E>, /// Size in bytes of this header. pub e_ehsize: U16<E>, /// Program header table entry size. pub e_phentsize: U16<E>, /// Program header table entry count. /// /// If the count is grea...
Rust
0
train // // All columns have multiple possibilities, but it can be seen that 'class' only appears once, for // column 0, and 'train' for column 2. Thus, a solution can be found. The following code could be // enhanced to perform this check before giving up and panicking. fn map_all_ticket_fields(data: &ChallengeData) -...
Rust
0
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
Python
1
t_labels = label[test_idx] accs = [] # Step 5: Linear evaluation ========================================================== # for _ in range(5): model = LogReg(args.hid_dim, n_classes) opt = th.optim.Adam(model.parameters(), lr=args.lr2, weight_decay=args.wd2) model = model.to(arg...
Python
1
UU SSS2S4'UU SSS2S4'UU SSS2S4'[ R8"[:R<[:R>/U5n![;U U!5n"URAUU"URC5U-U5 GM URE5 g) rF c...
Python
1
# Based on https://github.com/1j01/jspaint/blob/4a9163fb6dbb321ef07ed85bb5d5ce980e1a4866/localization/parse-rc-file.js # Originally based on https://github.com/evernote/serge/blob/master/lib/Serge/Engine/Plugin/parse_rc.pm import re def parse_rc_file(rc_file_text: str) -> list[str]: """ Parses a Windows RC f...
Python
1