text string | label_name string | labels int64 |
|---|---|---|
# Source Attribution:
# The majority of the code is derived from the following source:
# - LLaMA-Factory GitHub Repository: https://github.com/hiyouga/LLaMA-Factory
# - Tag: v0.9.0
# - File: /src/llamafactory/webui/components/train.py
# - Reference Paper: LlamaFactory: Unified Efficient Fine-Tuning of 100+ Language Mod... | Python | 1 |
# file utilities
# tofraction utilities with global decimals
import fractions
import numpy as np
# global constants, mutable
# https://stackoverflow.com/questions/1977362/how-to-create-module-wide-variables-in-python
decimals = 4
deciDenom = 10**decimals
MAXDECIMALS = 20
# roundingwarn = False
def setdecimals(n):
... | Python | 1 |
s HashOutput>::Type>,
{
fn allocate_spread(ptr: &mut KeyPtr) -> Self {
Self {
keys: SpreadAllocate::allocate_spread(ptr),
values: SpreadAllocate::allocate_spread(ptr),
}
}
}
#![cfg(feature = "revocation")]
#[cfg(not(feature = "std"))]
#[test]
fn stapled_ocsp() {
use ... | Rust | 0 |
import numpy as np
import warnings
warnings.filterwarnings("ignore")
import tensorflow as tf
from tensorflow import keras
tf.compat.v1.enable_eager_execution()
import matplotlib.pyplot as plt
from model_utils import save_model
# construct TensorFlow model
model = keras.Sequential()
model.add(keras.layers.InputLayer(in... | Python | 1 |
service is expected to be
/// unavailable to the requesting client. This field MAY also be used with any
/// 3xx (Redirection) response to indicate the minimum time the user-agent is
/// asked wait before issuing the redirected request. The value of this field
/// can be either an HTTP-date or an integer number of seco... | Rust | 0 |
ow: DWORD,
dwNumberOfBytesToMap: SIZE_T,
) -> LPVOID;NULL}
make_func! {winapi::um::memoryapi,
pub fn MapViewOfFileEx(
hFileMappingObject: HANDLE,
dwDesiredAccess: DWORD,
dwFileOffsetHigh: DWORD,
dwFileOffsetLow: DWORD,
dwNumberOfBytesToMap: SIZE_T,
lpBaseAddress: LPVOID,
) -> LPVOID;NULL}
... | Rust | 0 |
}
}
#[derive(Deserialize, Copy, Clone)]
#[serde(from = "String")]
#[cfg_attr(debug_assertions, derive(Debug))]
/// This enum describes the vertical alignment of text. It has 3 variants:
/// - Center
/// - Bottom
/// - Top
///
/// to_string() can be called on this enum if required.
pub enum VAlign {
Center,
... | Rust | 0 |
"""
checksec command test module
"""
from tests.base import RemoteGefUnitTestGeneric
from tests.utils import debug_target
class ChecksecCommandNoCanary(RemoteGefUnitTestGeneric):
"""`checksec` command test module"""
def setUp(self) -> None:
self._target = debug_target("checksec-no-canary")
r... | Python | 1 |
tol=1e-9, atol=5e-3, rtol=1e-2,
err_msg="Function %d" % j)
self._check_accuracy(func, x=grid, tol=1e-9, atol=5e-3, rtol=1e-2,
err_msg="Function %d" % j, rescale=True)
def test_wrong_ndim(self):
x = np.random.randn(30, 3)
... | Python | 1 |
eserialize `input`.
pub fn deserialize(mut input: &[u8]) -> Result<Self> {
let value = deserialize_elem::<CS::Group>(&mut input)?;
Ok(Self(value))
}
}
fn deserialize_elem<G: Group>(input: &mut &[u8]) -> Result<G::Elem> {
let input = input
.take_ext(G::ElemLen::USIZE)
.ok_or... | Rust | 0 |
edKVList) -> StdResult<Self::Ok, Self::Err> {
self.drain1
.log(record, values)
.map_err(SplitDrainError::Drain1Error)
.and(
self.drain2
.log(record, values)
.map(|_| ())
.map_err(SplitDrainError::Drai... | Rust | 0 |
# -*- coding: utf-8 -*-
# ------------------------------------------------------------------------------
#
# Copyright 2018-2023 Fetch.AI Limited
#
# 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 ... | Python | 1 |
_linear(rgba[2]),
clamp(rgba[3] * 255.0, 0.0..=255.0).round() as u8,
])
}
}
fn linear_from_srgb_byte(s: u8) -> f32 {
if s <= 10 {
s as f32 / 3294.6
} else {
((s as f32 + 14.025) / 269.025).powf(2.4)
}
}
fn srgb_byte_from_linear(l: f32) -> u8 {
if l <= 0.0 {
... | Rust | 0 |
ero`](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 available fields see [pacrg](pacrg) module"]
pub type PACRG = crate::Reg<u32, _PACRG>;
#[allow(missing_docs)]
#[doc(hidden)]
pub struct _PACRG;
#[d... | Rust | 0 |
# f1_pipeline/data_transformer.py
"""
Transforms raw JSON API responses into structured pandas DataFrames.
"""
import logging
import pandas as pd
logger = logging.getLogger(__name__)
def transform_lap_data(json_data: dict, season: int, round_: int, max_laps: int | None = None) -> pd.DataFrame:
"""Transform neste... | Python | 1 |
(device)
optimizer = torch.optim.Adam(model.parameters(), args.lr)
print(model)
######## Training + Testing #######
EP = args.epoch
MAEh1, MAEh2, ACCh1, ACCh2, MAEl1, MAEl2, ACCl1, ACCl2 = np.zeros(EP), np.zeros(EP), np.zeros(EP), np.zeros(
EP), np.zeros(EP), np.zeros(EP), np.zeros(EP), np.zeros(EP)
model_dict = {... | Python | 1 |
#!/usr/bin/env vpython3
# Copyright (c) 2022 The WebRTC project authors. All Rights Reserved.
#
# Use of this source code is governed by a BSD-style license
# that can be found in the LICENSE file in the root of the source
# tree. An additional intellectual property rights grant can be found
# in the file PATENTS. Al... | Python | 1 |
cena.Code('func_0C_2D9F')
def func_0C_2D9F():
EventBegin(0x00)
FadeOut(0, 0, -1)
CameraMove(330, 200, 12720, 0)
OP_67(0, 3720, -10000, 0)
CameraSetDistance(2600, 0)
OP_6C(0, 0)
OP_6E(501, 0)
TerminateThread(0x0008, 0x01)
TerminateThread(0x0009, 0x01)
TerminateThread(0x000A, 0x01)... | Python | 1 |
-> Self {
JoystickEvent {
action: if event.value == 1 {
Action::Pressed
} else {
Action::Released
},
button: event.number,
}
}
}
<gh_stars>1-10
// Copyright (c) The Diem Core Contributors
// SPDX-License-Identifier: Apa... | Rust | 0 |
entry')
Sleep(0)
CreateThread(ChrTable['尤西斯'], 0x03, ScriptId.System, 'FC_chr_entry')
Sleep(0)
CreateThread(ChrTable['米莉亞姆'], 0x03, ScriptId.System, 'FC_chr_entry')
Sleep(0)
CreateThread(ChrTable['蓋烏斯'], 0x03, ScriptId.System, 'FC_chr_entry')
Sleep(0)
CreateThread(ChrTable['莎拉'], 0x0... | Python | 1 |
{} {}", op1, op2),
Operation::Reduce(op) => write!(f, "reduce {}", op),
Operation::Remainder(op1, op2) => write!(f, "remainder {} {}", op1, op2),
Operation::RemainderNear(op1, op2) => write!(f, "remaindernear {} {}", op1, op2),
Operation::Rescale(op1, op2) => write!(f, "r... | Rust | 0 |
.to_string();
let update_pkg = update_pkg.add_file("packages.json", packages).await;
assert_eq!(update_pkg.packages().await.unwrap(), pkg_urls(pkg_list));
}
#[fuchsia_async::run_singlethreaded(test)]
async fn expect_failure_json() {
let update_pkg = TestUpdatePackage::new()... | Rust | 0 |
6 = 0x14b;
pub const BTN_STYLUS2: u16 = 0x14c;
pub const BTN_TOOL_DOUBLETAP: u16 = 0x14d;
pub const BTN_TOOL_TRIPLETAP: u16 = 0x14e;
pub const BTN_TOOL_QUADTAP: u16 = 0x14f;
pub const BTN_WHEEL: u16 = 0x150;
pub const BTN_GEAR_DOWN: u16 = 0x150;
pub const BTN_GEAR_UP: u16 = 0x151;
pub const KEY_OK: u16 = 0x160;
pub c... | Rust | 0 |
pub static GLP_BT_DFS : c_int = 1; /* depth first search */
pub static GLP_BT_BFS : c_int = 2; /* breadth first search */
pub static GLP_BT_BLB : c_int = 3; /* best local bound */
pub static GLP_BT_BPH : c_int = 4; /* best projection heuristic */
pub static GLP_PP_NONE : c_int = 0; /* disable preprocessing */
pu... | Rust | 0 |
Eq, Eq, Hash, Serialize, Deserialize)]
pub enum MenuActionBinding {
None,
Quit,
MenuNext,
MenuPrev,
MenuSelect,
MenuDeleteSave,
}
impl Default for MenuActionBinding {
fn default() -> Self {
MenuActionBinding::None
}
}
impl BindingTypes for MenuBindings {
type Axis = MenuAxi... | Rust | 0 |
from twisted.internet import reactor, defer
import settings
import util
from mining.interfaces import Interfaces
import lib.logger
log = lib.logger.get_logger('block_updater')
class BlockUpdater(object):
'''
Polls upstream's getinfo() and detecting new block on the network.
This will call registr... | Python | 1 |
t kCTFontTableOptionsNoOptions: CTFontTableOptions = 0;
pub const kCTFontTableOptionsExcludeSynthetic: CTFontTableOptions = (1 << 0);
pub type CTFontOptions = CFOptionFlags;
pub const kCTFontOptionsDefault: CTFontOptions = 0;
pub const kCTFontOptionsPreventAutoActivation: CTFontOptions = (1 << 0);
pub const kCTFontOpt... | Rust | 0 |
Option<
extern "C" fn(
obj: *mut c_void,
loc_params: *const H5VL_loc_params_t,
args: *mut H5VL_optional_args_t,
dxpl_id: hid_t,
req: *mut *mut c_void,
) -> herr_t,
>,
}
#[repr(C)]
#[derive(Debug... | Rust | 0 |
"""从蚊香社-mgstage抓取数据"""
import os
import re
import sys
import logging
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
from web.base import Request, resp2html
from web.exceptions import *
from core.config import cfg
from core.datatype import MovieInfo
logger = logging.getLogger(__na... | Python | 1 |
"""A gradio app that renders a static leaderboard. This is used for Hugging Face Space."""
import ast
import argparse
import pickle
import gradio as gr
import numpy as np
notebook_url = "https://colab.research.google.com/drive/1RAWb22-PFNI-X1gPVzc927SGUdfr6nsR?usp=sharing"
basic_component_values = [None] * 6
leade... | Python | 1 |
match Command::new(p)
.arg(a)
.stdout(Stdio::null())
.stderr(Stdio::null())
.spawn()
{
Err(why) => println!("Failed running {} with {} as arg:\n{}", p, a, why),
Ok(_) => (),
}
}
<reponame>schickst/smithay
/*
* Steps of XWayland server creation
*
* Sockets to cr... | Rust | 0 |
# 프로그래머스 레벨2: 점프와 순간 이동
# https://school.programmers.co.kr/learn/courses/30/lessons/12980
def solution(n):
battery = 0
while n > 0:
if n % 2 == 0:
n //= 2
else:
n -= 1
battery += 1
return battery
print(solution(5000)) | Python | 1 |
PGE",
"PGEpB",
"PGF",
"PGH",
"PGL",
"PGLAF",
"PGM",
"PGN",
"PGNX",
"PGR",
"PGTV",
"PH",
"PHAR",
"PHC",
"PHCC",
"PHEL",
"PHF",
"PHFCP",
"PHG",
"PHGN",
"PHH",
"PHHM",
"PHI",
"PHIpA",
"PHK",
"PHLY",
"PHM",
"PHMD",
"PHRM",
"PHS",
"PHSB",
"PHTN",
"PHX",
"PHY"... | Rust | 0 |
`span` from the given memory slice. The result span will be
/// full, with both `len` and `cap` equal to the provided `data`'s size.
pub fn create(data: &[u8]) -> Span {
Span {
ptr: data.as_ptr() as *mut u8,
len: data.len(),
cap: data.len(),
}
}
/// C... | Rust | 0 |
eq!(result.copied().collect::<Vec<_>>(), &[1,4]);
}
}
use crate::Api;
use nsi_sys::*;
pub type ApiImpl = LinkedApi;
#[derive(Debug)]
pub struct LinkedApi {}
impl LinkedApi {
#[inline]
pub fn new() -> Result<Self, Box<dyn std::error::Error>> {
let api = LinkedApi {};
#[cfg(feature = "outp... | Rust | 0 |
.iter(|| {
black_box(&mut compressed).clear();
zopfli::compress(
&zopfli::Options::default(),
&zopfli::Format::Deflate,
black_box(&mut &uncompressed[..]),
black_box(&mut compressed)
).unwrap()
})
});
println!("zopfli: {} bytes", compressed.len());
// no dec... | Rust | 0 |
'offset': offset,
'search_scene': 'douyin_search',
'sort_type': '0',
'publish_time': '0',
'is_filter_search': '0',
'query_correct_type': '1',
'keyword': keyword,
'search_id': ''
}
search_item = request_instance.getJSON(url, params)
if search_i... | Python | 1 |
from VTK_Code import *
import webbrowser
import requests
import xml.etree.ElementTree as ET
def wolfram():
dbg = False
vtkWolframAppID = '&appid=H2VK7E-WLKUW5PTX3'
vtkWolframURL = "http://api.wolframalpha.com/v2/query?input="
#while 1:
print("Ask a question. Type control-c (ctrl and c at the same t... | Python | 1 |
"""キャラクター一覧パネル"""
import pygame
import pygame_gui
from typing import Dict, Any, Optional, List, cast
import logging
from ..service_panel import ServicePanel
from ...core.service_result import ServiceResult
logger = logging.getLogger(__name__)
class CharacterListPanel(ServicePanel):
"""キャラクター一覧パネル
登録されて... | Python | 1 |
}
};
execute(move || {
match create_agency_client_for_main_wallet(&agency_config) {
Ok(()) => {
info!("vcx_create_agency_client_for_main_wallet_cb >>> command_handle: {}, rc {}", command_handle, error::SUCCESS.code_num);
cb(command_handle, error::SUCCESS.cod... | Rust | 0 |
CvPose)
//!
//! ## opencv -> tch
//!
//! - [(&)Mat](opencv::core::Mat) ->? [Tensor](tch::Tensor)
//! - [Mat](opencv::core::Mat) ->? [TensorFromMat]
//!
//! ## tch -> opencv
//!
//! - [(&)Tensor](tch::Tensor) ->? [Mat](opencv::core::Mat)
//! - [(&)TensorAsImage](TensorAsImage) ->? [Mat](opencv::core::Mat)
//!
//! # Open... | Rust | 0 |
Foundation")]
pub struct XAUDIO2_EFFECT_DESCRIPTOR {
pub pEffect: ::windows_sys::core::IUnknown,
pub InitialState: super::super::super::Foundation::BOOL,
pub OutputChannels: u32,
}
#[cfg(feature = "Win32_Foundation")]
impl ::core::marker::Copy for XAUDIO2_EFFECT_DESCRIPTOR {}
#[cfg(feature = "Win32_Foundati... | Rust | 0 |
import time
import httpx
from pydantic import BaseModel
from arm.constants import FEISHU_APP_ID, FEISHU_APP_SECRET
class TenantAccessTokenCache(BaseModel):
expired_at: int
token: str
class JSSDKTicketCache(BaseModel):
expired_at: int
ticket: str
class FeishuAuth(object):
def __init__(self, a... | Python | 1 |
" box-shadow: inset 3px 3px 6px rgba(0, 0, 0, 0.4); /* Hiệu ứng bóng bên trong */\n"
" transform: scale(1); /* Giữ nguyên kích thước */\n"
"}\n"
"")
self.yes_btn.setObjectName("yes_btn")
self.horizontalLayout.addWidget(self.yes_btn)
spacerItem3 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSi... | Python | 1 |
};
let _g = observability::test_run().ok();
const NUM_CONDUCTORS: usize = 2;
let mut tuning =
kitsune_p2p_types::config::tuning_params_struct::KitsuneP2pTuningParams::default();
tuning.gossip_strategy = "sharded-gossip".to_string();
let mut network = KitsuneP2pConfig::default();
netwo... | Rust | 0 |
to send a new set of URLs back
// Updating the progress bar
needed_sends += 1;
visited_webpages += 1;
prog_bar.set_position(visited_webpages);
}
WorkerResult::Failed(url) => {
// URL fail... | Rust | 0 |
match self {
BasicColor::Black => Brightness::MIN,
BasicColor::White => Brightness::MAX,
BasicColor::DarkGray => Brightness::MIN,
BasicColor::LightGray => Brightness::MAX,
BasicColor::DarkRed => Brightness::MIN,
BasicColor::LightRed => Brig... | Rust | 0 |
return Some(w);
}
}
}
None
}
fn find_mut(&mut self, name: &str) -> Option<&mut Widget> {
if self.id == Some(name.to_string()) {
return Some(self);
}
if let Some(container) = self.widget.downcast_mut::<Container>() {
... | Rust | 0 |
# Copyright 2021 Secureworks
#
# 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 writing, ... | Python | 1 |
r: Tier::Two,
};
/// 32-bit Linux w/o SSE, MUSL
pub(crate) const I586_UNKNOWN_LINUX_MUSL: Platform = Platform {
target_triple: "i586-unknown-linux-musl",
target_arch: Arch::X86,
target_os: OS::Linux,
target_env: Env::Musl,
target_endian: Endian::Little,
target_pointer_width: PointerWidth::U32,
... | Rust | 0 |
upnp
use std::comm::SharedChan;
use std::hashmap::HashMap;
use std::io::Acceptor;
use std::io::Listener;
use std::io::net::tcp::TcpListener;
use std::io::net::tcp::TcpStream;
use std::str;
pub fn listen (addr: &str, server_chan: ~SharedChan<Request>) {
let address = addr.to_owned();
spawn(proc(){
let s... | Rust | 0 |
def solution(r1, r2):
answer=0
for i in range(1,r2+1):
r1_max = int((r1*r1-i*i-1)**0.5) if r1>i else -1
r2_max = int((r2*r2-i*i)**0.5)
answer+=r2_max-r1_max
return answer*4 | Python | 1 |
}", i)),
&crh_parameters,
&digest,
&comm,
&cw,
)
.unwrap();
if !cs.is_satisfied() {
println!(
"Unsatisfied constraints: {}",
cs.which_is_unsatisfied().unwrap()
... | Rust | 0 |
feature = "tmux_1_7")]
s.push("-a");
#[cfg(feature = "tmux_0_8")]
s.extend_from_slice(&["-t", "1"]);
let s = s.into_iter().map(|a| a.into()).collect();
assert_eq!(kill_pane.0.bin, Cow::Borrowed("tmux"));
assert_eq!(kill_pane.0.bin_args, None);
assert_eq!(kill_pane.0.cmd, Some(Cow::Borrowed(... | Rust | 0 |
ctl::SystemClock::UsePll(sysctl::PllOutputFrequency::_80_00mhz),
);
let clocks = sc.clock_setup.freeze();
let mut nvic = cp.NVIC;
nvic.enable(Interrupt::TIMER1A);
nvic.enable(Interrupt::TIMER1B);
nvic.enable(Interrupt::TIMER2A);
// Make Timer1A (start of line) lower priority than Timer1B (c... | Rust | 0 |
X, y
cumlModel = cumlKMeans(
init="k-means||",
n_clusters=nclusters,
random_state=10,
n_init="auto",
)
cumlModel.fit(X_train)
actual_score = cumlModel.score(X_train)
local_model = cumlModel.get_combined_model()
expected_score = local_model.score(X_train.compu... | Python | 1 |
# only count and index methods are available for tuple
# tuple is immutable
# tuple is ordered collection of items
# tuple allows duplicate values
# tuple is defined by using parenthesis()
t1=(1,2,3,4,5)
print(t1) | Python | 1 |
tage 3 passes if object is near goal (within 0.25m) - intermediate reward
is_obj_near = torch.logical_and(obj_to_goal_dist < 0.25, is_grasped)
# Stage 4: reuse same reward as stage 3 but stronger incentive
reward[is_obj_near] = 12 + 2 * stage_3_reward[is_obj_near]
# stage 4 passes if ob... | Python | 1 |
nnection (trio_websocket.WebSocketConnection, optional):
Initial websocket connection. Defaults to None.
"""
AbstractNeuroAPIComponent.__init__(self, component_name, game_title)
self.connect(connection)
async def read_message(self) -> None:
"""Read message from Neur... | Python | 1 |
from pyhanko.cli._root import cli_root
from pyhanko.cli.commands.crypt import *
from pyhanko.cli.commands.fields import *
from pyhanko.cli.commands.signing import *
from pyhanko.cli.commands.stamp import *
from pyhanko.cli.commands.validation import *
__all__ = ['launch', 'cli_root']
def launch():
cli_root(prog_... | Python | 1 |
import sys
# input = sys.stdin.readline
def dfs(plus, minus, times, div, val, cnt):
if sum([plus, minus, times, div]) == 0:
res.append(val)
return
if plus:
dfs(plus - 1, minus, times, div, val + nums[cnt], cnt + 1)
if minus:
dfs(plus, minus - 1, times, div, val - nums[cnt... | Python | 1 |
scale=rpageheight/imageheight
else:
scale=rpagewidth/imagewidth
rw=scale*imagewidth
rh=scale*imageheight
ox=pagewidth/2-rw/2
oy=pageheight/2-rh/2
objectpos.append(pdf.tell())
num = num+1
stream="q\n"+\
str(scale)+" 0 0 "+str(... | Python | 1 |
1.0), 0, 0, BodySweepData::new_invalid(), 0.05), Vec2::new(1.0, -1.0));
rea.coefficient = 0.0;
assert_eq!(rea.react(Vec2::new(1.0, -1.0), 0, 0, BodySweepData::new_invalid(), 0.05), Vec2::new(0.0, 0.0));
}
#[test]
fn deflect_reacter_test() {
let mut rea = DeflectReacter::default();
... | Rust | 0 |
::Exhausted) =>
None,
Err(e) =>
return Err(e),
}
};
if config.is_some() {
// Return a new config immediately so that addresses can
// be configured that are required by egress().
Ok(c... | Rust | 0 |
# Author: Michelle Loya
# GitHub username: michellealoya
# Date: 3/1/2023
# Description: This program decorates sort functions so that the time it takes the
# sort functions to run is recorded and creates a sort function that will plot the
# run times of two decorated sort functions
import time
import random
from matp... | Python | 1 |
asEObjTypeFlags_asOBJ_APP_ARRAY: asEObjTypeFlags = 32768;
pub const asEObjTypeFlags_asOBJ_APP_CLASS_ALLINTS: asEObjTypeFlags = 65536;
pub const asEObjTypeFlags_asOBJ_APP_CLASS_ALLFLOATS: asEObjTypeFlags = 131072;
pub const asEObjTypeFlags_asOBJ_NOCOUNT: asEObjTypeFlags = 262144;
pub const asEObjTypeFlags_asOBJ_APP_CLA... | Rust | 0 |
hir9 choffsetsignhrR sr r r _wrap_strftime sb
r} c C s | d u rd S t | ||S N)rm )tzinfoZmethnameZ tzinfoargr r r _call_tzinfo_method s r c... | Python | 1 |
self.viewWidget.setDisplayMode(DataViews.PLOT1D_MODE)
def _viewChanged(self, something):
_logger.debug("_viewChanged called", something)
if self.__data:
pass
def _dataChanged(self):
_logger.debug("_dataChanged called")
if __name__ == "__main__":
import... | Python | 1 |
max_wait_count: u64,
pub queue_max_wait_time: u64,
pub raid_data_io: u64,
pub raid_metadata_io: u64,
pub rdma_read: u64,
pub rdma_read_waitdone_time: u64,
pub remote_nv_transfers: u64,
pub total_receive_queue_waits: u64,
pub total_transfers: u64,
pub wafl_data_io: u64,
pub wafl_m... | Rust | 0 |
import numpy as np
import pandas as pd
from sklearn.model_selection import KFold
from sklearn import tree
from sklearn.metrics import roc_auc_score
from sklearn.metrics import recall_score
from sklearn.metrics import precision_score
from sklearn.metrics import accuracy_score
from sklearn.metrics import f1_score
from sk... | Python | 1 |
ons=None):
# # state: (batch*n_agent, state_dim)
# # obs: (batch*n_agent, obs_dim)
# # action: (batch*n_agent,1)
# # available_actions: (batch*n_agent, act_dim)
# assert obs.shape[0]%self.n_agent==0
# batch_size = obs.shape[0]//self.n_agent
# v_loc, obs_... | Python | 1 |
#this code is to produce the test image
import numpy as np
import cv2
import os
from library.library import *
from basic_module.basic_module import img_show
def sobel_v(img, threshold):
G_x = np.array([[-1, 0, 1], [-2, 0, 2], [-1, 0, 1]])
rows = np.size(img, 0)
columns = np.size(img, 1)
mag = np.zeros(i... | Python | 1 |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import json
import os.path
import time
import structlog
from code_review_bot.report.base import Reporter
logger = str... | Python | 1 |
mpl<S, F, R> SplitPrf<Split<S, R>> for Prf<F, R>
where S: SplitRng,
F: SplitPrf<S>,
R: Rand
{
fn call(&self, i: u32) -> Split<S, R> {
let mut rng = self.prf.call(i);
let seq = rng.gen();
Split {
rng: rng,
seq: seq
}
}
}
impl<... | Rust | 0 |
from __future__ import annotations
from typing import Callable, List
import numpy as np
import matplotlib.pyplot as plt
from sensor_modeling.models.nhpp_pelt import NHPPConfig, NHPPPELT
from sensor_modeling.models.nhpp_pelt.plotting import (
PlotConfig,
HistConfig,
plot_segments_and_intensities_with_hist... | Python | 1 |
![allow(non_snake_case)]
pub use libperl_sys::{SV, svtype};
use super::gv0::*;
use super::hek0::*;
use super::hv0::*;
pub struct VarName<'a> (pub &'a str);
impl<'a> std::fmt::Debug for VarName<'a> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.write_str(&self.0)
}
}
struct... | Rust | 0 |
'''
Given two strings needle and haystack, return the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.
Example 1:
Input: haystack = "sadbutsad", needle = "sad"
Output: 0
Explanation: "sad" occurs at index 0 and 6.
The first occurrence is at index 0, so we return 0.
'''
def ... | Python | 1 |
usernum = input("1: add 2: subtract 3:multiply 4:devide")
def add(usernum1,usernum2):
print(usernum1+usernum2)
def subtract(usernum1,usernum2):
print(usernum1-usernum2)
def multiply(usernum1,usernum2):
print(usernum1*usernum2)
def devide(usernum1,usernum2):
print(usernum1/usernum2)
usernum1 = int(inpu... | Python | 1 |
# Copyright (c) OpenMMLab. All rights reserved.
import platform
import pytest
import torch
from mmagic.models.editors.swinir.swinir_modules import (PatchEmbed,
PatchUnEmbed,
Upsample,
... | Python | 1 |
CephType::Mgr,
CephComponent::Mon => CephType::Mon,
CephComponent::Osd => CephType::Osd,
CephComponent::Mds => CephType::Mds,
CephComponent::Rgw => CephType::Rgw,
}
}
}
impl From<CephType> for CephComponent {
fn from(c: CephType) -> Self {
match ... | Rust | 0 |
append({
'id': entry['id'],
'seed': seed,
'response_score': extract_score(entry['response'])
})
df_responses = pd.DataFrame(records)
filtered_dataset_df = filtered_dataset.to_pandas()
# Merge with actual scores... | Python | 1 |
io;
use tokio::sync::mpsc;
use tokio::task;
#[derive(Parser)]
#[clap(author, version, about, long_about = None)]
struct Cli {
#[clap(subcommand)]
command: Commands,
#[clap(short, long)]
daemon_address: String,
}
#[derive(Subcommand)]
enum Commands {
#[clap(arg_required_else_help = true)]
Uplo... | Rust | 0 |
('[', '`'), ('{', '~')];
const SPACE: Class =
&[('\t', '\t'), ('\n', '\n'), ('\x0B', '\x0B'), ('\x0C', '\x0C'), ('\r', '\r'), (' ', ' ')];
const UPPER: Class = &[('A', 'Z')];
const WORD: Class = &[('0', '9'), ('A', 'Z'), ('_', '_'), ('a', 'z')];
const XDIGIT: Class = &[('0', '9'), ('A', 'F'), ('a', 'f')];
#[deriv... | Rust | 0 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.response.AlipayResponse import AlipayResponse
from alipay.aop.api.domain.BaseLoanApplyVO import BaseLoanApplyVO
class AlipayPcreditLoanLoanInfoQueryResponse(AlipayResponse):
def __init__(self):
super(AlipayPcreditLoanLoanInfoQ... | Python | 1 |
onkeyPatch.context>` instead.
"""
for obj, name, value in reversed(self._setattr):
if value is not notset:
setattr(obj, name, value)
else:
delattr(obj, name)
self._setattr[:] = []
for dictionary, key, value in reversed(self._setitem... | Python | 1 |
[..4]).is_err() {
return Ok(None);
}
u32::from_le_bytes(buf[..4].try_into().unwrap()) as usize
};
if reader.read_exact(&mut buf[..payload_len]).is_err() {
Ok(None)
} else {
Ok(Some(()))
}
}
async fn process_message... | Rust | 0 |
line = ""
for idx, nd in enumerate(route):
early = vrp.get_earliest_start(nd)
late = vrp.get_latest_start(nd)
start = max(arrive, early)
assert(start == sol.solution[data.start_time[nd]])
line += " {} (a = {}, t = {} <= {} <=... | Python | 1 |
::StrImm { .. } => unreachable!("Memory operand is expected here"),
};
Ok((address_expr, sideeffect))
}
#[must_use]
enum MemOperandSideeffect {
None,
Assign(&'static AArch64Register, il::Expression),
}
impl MemOperandSideeffect {
fn apply(self, block: &mut il::Block) {
if let MemOperandSi... | Rust | 0 |
: Vec<_> = part.iter().map(|(_, v)| &v[..]).collect();
let mut xs = slices.concat();
xs.sort();
xs.into_iter().eq(0..index_limit)
}
}
impl<L> IntoIterator for Part<L> {
type Item = (L, Vec<usize>);
type IntoIter = std::vec::IntoIter<(L, Vec<usize>)>;
fn into_iter(self) -> Self::... | Rust | 0 |
\s*[a-zA-Z]+)+'
matches = re.findall(comma_pattern, model_output)
if matches:
# 取最长的匹配
best_match = max(matches, key=len)
# 分割并清理
path = [word.strip().lower() for word in best_match.split(',')]
return path
# 5. 尝试匹配行分隔格式: 每行一个单词
... | Python | 1 |
ands(&[ValType::I32]);
let block_ty = builder.arbitrary_block_type(u, module)?;
let (params, results) = block_ty.params_results(module);
let height = builder.allocs.operands.len() - params.len();
builder.allocs.controls.push(Control {
kind: ControlKind::If,
params,
results,
... | Rust | 0 |
te internal database data
#[derive(Debug, clap::Parser)]
pub struct Config {
#[clap(subcommand)]
command: Command,
}
#[derive(Debug, clap::Parser)]
enum Command {
/// Prints what CPU features are used by the compiler by default.
PrintCpu,
/// Interrogate IOx namespaces
Namespace(namespace::Con... | Rust | 0 |
c = ' ';
}
if n < len {
ret.push(c);
} else {
break;
}
n += 1;
}
for _ in n..len {
ret.push('\0');
}
ret
}
fn browse_zip_archive<T, F, U>(buf: &mut T, browse_func: F) -> ZipResult<Vec<U>>
where
T: Read + Seek,
... | Rust | 0 |
,0x48,0xf5,0x9f,0xfd,
0x49,0x24,0xca,0x1c,0x60,0x90,0x2e,0x52,
0xf0,0xa0,0x89,0xbc,0x76,0x89,0x70,0x40,
0xe0,0x82,0xf9,0x37,0x76,0x38,0x48,0x64,
0x5e,0x07,0x05 ],
boxed: vec![
0xf3,0xff,0xc7,0x70,0x3f,0x9... | Rust | 0 |
(656, 662, 1024, 1034));
assert_eq!(rect_to_tuple(boxes[34].unwrap()), (656, 663, 1024, 1034));
assert_eq!(rect_to_tuple(boxes[57].unwrap()), (656, 662, 1024, 1035));
}
#[bench]
fn get_glyph_bitmap_box_subpixel_gudea(b: &mut test::Bencher) {
let font = FontInfo::new(&*GUDEA, 0).unwrap();
let indices:... | Rust | 0 |
# %%
import os
from pathlib import Path
import tempfile
import nest_asyncio
nest_asyncio.apply()
import datalad.api as dl # noqa E402
# %% define variables and paths
# URL to datalad dataset to clone in temporary directory to get file names
REPO_URL = 'ria+http://ukb.ds.inm7.de#~cat_m0wp1'
# RUN THINGS IN ROOT DIR... | Python | 1 |
# Copyright 2018 Creu Blanca
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
from . import wizard_stock_request_kanban_abstract
from . import wizard_stock_request_kanban
from . import wizard_stock_request_order_kanban
from . import wizard_stock_inventory_kanban
| Python | 1 |
# You have the following class hierarchy:
class A(object):
def foo(self):
print('hi')
class B(A):
def foo(self):
print('bye')
# Which of the following is correct?
# When a = A() we say that a is an instance of A [X]
# When b = B() we say that b is a subclass of A
# Both of the above... | Python | 1 |
6dQuaternion(handle: Handle, wxyz: *mut [f64; 4]) -> ErrorCode;
pub fn c_PigeonIMU_GetYawPitchRoll(handle: Handle, ypr: *mut [f64; 3]) -> ErrorCode;
pub fn c_PigeonIMU_GetAccumGyro(handle: Handle, xyz_deg: *mut [f64; 3]) -> ErrorCode;
pub fn c_PigeonIMU_GetAbsoluteCompassHeading(handle: Handle, value: *m... | Rust | 0 |
import pandas as pd
df = pd.read_csv('/Users/chenyaxin/Desktop/互联网旅游公约/extracted_complaints.csv') # 或者使用 pd.read_excel('your_file.xlsx')
df['发起投诉内容'] = df['发起投诉内容'].astype(str)
filtered_df = df[df['投诉对象'] == '美团客服小美']
keywords = '单车|自行车|充电宝'
contains_keywords = filtered_df['发起投诉内容'].str.contains(keywords, na=False, c... | Python | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.