text string | label_name string | labels int64 |
|---|---|---|
# -*- coding: utf-8 -*-
# Part of Softhealer Technologies.
from . import sh_customer_pos_analysis
| Python | 1 |
import os
import torch
import torch.nn as nn
from torch.nn.parallel import DistributedDataParallel as DDP
from torch.distributed.algorithms.ddp_comm_hooks.default_hooks import bf16_compress_hook, bf16_compress_wrapper
from torch.distributed.algorithms.ddp_comm_hooks.powerSGD_hook import PowerSGDState, powerSGD_hook
im... | Python | 1 |
*******************
# 8. Listas y Operaciones Básicas
# Ejemplo 1: Ordenar una lista de números
numeros = [5, 3, 8, 2, 1]
numeros.sort()
print(f"Lista ordenada: {numeros}") # Muestra: Lista ordenada: [1, 2, 3, 5, 8]
# Ejemplo 2: Multiplicar cada número de una lista por 2
lista = [1, 2, 3, 4, 5]
dobles = [x * 2 for x... | Python | 1 |
_W<'a> {
w: &'a mut W,
}
impl<'a> GPIO_FUNC83_IN_INV_SEL_W<'a> {
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
... | Rust | 0 |
{
node_id: 2,
handle: 1002,
owner: 123456789123456789,
lock: Shared {{
range: 0..1,
process_id: {pid},
}},
}}"#,
pid = lock_pid(3000)
);
if let Some(diff) = diff_str(&expect, &requests[0]) {
println!("{}", diff);
assert!(false);
}
}
#[test]
fn getlk_fcntl_read_unlocked_nega... | Rust | 0 |
from . import api_bp
from flask import request, jsonify
from flask_jwt_extended import jwt_required
from app.core.database import db
from app.models.user import TelegramUser
from app.models.Bot import Bot
@api_bp.route("/users", methods=["GET"])
@jwt_required()
def get_users():
users = db.session.query(TelegramU... | Python | 1 |
wallet_name);
match Wallet::get_wallets() {
Ok(old_list) => {
let mut new_list: Vec<String> = vec![];
for s in old_list {
if s.ne(wallet_name) {
new_list.push(s);
}
}
new_... | Rust | 0 |
tcx>,
param_env: ty::ParamEnv<'tcx>,
span: Span,
) -> Result<(), ErrorHandled> {
debug!("is_const_evaluatable({:?}, {:?})", def, substs);
if infcx.tcx.features().const_evaluatable_checked {
// FIXME(const_evaluatable_checked): Actually look into generic constants to
// implement const eq... | Rust | 0 |
T = int(input())
for tc in range(1,T+1):
X = input()
stack = []
what = True
for i in X:
if i == '(':
stack.append(i)
else:
if stack:
stack.pop()
else:
stack.append(i)
break
if len(stack) == 0:
... | Python | 1 |
x<USART1>,
Tx<USART2>,
Rx<USART2>,
Tx<USART3>,
Rx<USART3>,
) {
let p = Peripherals::take().unwrap();
let clocks = p.RCC.constrain().cfgr.sysclk(216.mhz()).freeze();
let gpioa = p.GPIOA.split();
let (tx1, rx1) = Serial::new(
p.USART1,
(
gpioa.pa9.into_alterna... | Rust | 0 |
'),
flags=module.params.get('flags'))
stored = None
if module.params.get('retrieve'):
index, stored = consul_api.kv.get(key)
module.exit_json(changed=changed,
index=index,
key=key,
data=stored)
def... | Python | 1 |
# -*- coding: utf-8 -*-
# Copyright 2025 Google LLC
#
# 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... | Python | 1 |
for f in formats:
subprocess.run(
[
str(new_python),
briefcase_exec,
"build",
briefcase_platform,
f,
"--no-input",
]
)
if is_windows:
# Cursed
for n i... | Python | 1 |
_Dsin(x, y): # see also .rhumb.ekx._Dsin
r = cos((x + y) * _0_5)
d = (x - y) * _0_5
if d:
r *= sin(d) / d
return r
def _Dsn(x, y):
# (sn(y) - sn(x)) / (y - x)
if x != y:
snx, sny = _sn(x), _sn(y)
if (x * y) > 0:
scx, scy = _sc(x), _sc(y)
r ... | Python | 1 |
# Copyright 2023 The Google Earth Engine Community Authors
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... | Python | 1 |
# 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 |
ldquo` not correctly closed.
# Ignore closing paragraphs, line breaks, and closing cells in case `ldquo` means `ditto mark`.
matches = source_file.findall(r"“[^‘”]+?“")
submessages: list[LintSubmessage] = LintSubmessage.from_matches([match for match in matches if "</p" not in match[0] and "<br/>" not in match[0] and... | Python | 1 |
async fn create_store_builder_single_conn(
mut conn: sqlx::PgConnection,
read_config: BasiliqStoreConfig,
) -> Result<BasiliqStoreBuilder, BasiliqError> {
info!("Scanning the database...");
let mut builder = BasiliqStoreBuilder::new(BasiliqDbScannedTable::scan_db(&mut conn).await?);
builder.basiliq... | Rust | 0 |
the end of 32-bit time_t
# and later is flaky on many systems.
break
s0 = (udt - datetime(1970, 1, 1)) // SEC
ss = shift // SEC # shift seconds
for x in [-40 * 3600, -20*3600, -1, 0,
ss - 1, ss + 20 * 360... | Python | 1 |
}
///
/// // We can also read the headers after iterating.
/// let headers = rdr.headers().await?;
/// assert_eq!(headers, vec!["city", "country", "pop"]);
/// Ok(())
/// }
/// ```
#[inline]
pub async fn headers(&mut self) -> Result<&StringRecord> {
self.... | Rust | 0 |
# TencentBlueKing is pleased to support the open source community by making
# 蓝鲸智云 - PaaS 平台 (BlueKing - PaaS System) available.
# Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved.
# Licensed under the MIT License (the "License"); you may not use this file except
# in compliance with the Licen... | Python | 1 |
length = len(stack)
top = stack[length - 1]
next_top = stack[length - 2]
v1 = [sorted_points[i][0] - next_top[0], sorted_points[i][1] - next_top[1]]
v2 = [top[0] - next_top[0], top[1] - next_top[1]]
while alg.cross(v1, v2) >= 0:
stack.pop()
length =... | Python | 1 |
# -*- coding: utf-8 -*-
# =============================================================================
# Ural Is Typo URL Unit Tests
# =============================================================================
from __future__ import unicode_literals
from ural import is_typo_url
TESTS = [
("http://nombreux.se",... | Python | 1 |
PixelUnpackData::Slice(texels.as_mem_bytes()),
);
}
_ => return Err(TextureError::unsupported_pixel_format(pf)),
},
None => return Err(TextureError::unsupported_pixel_format(pf)),
}
}
Ok(())
}
// Capacity of the dimension,... | Rust | 0 |
_id, claims) = self;
let key = store
.get(key_id)
.ok_or_else(|| Error::NoKeyWithKeyId(key_id.to_owned()))?;
let header = BorrowedKeyHeader {
algorithm: key.algorithm_type(),
key_id,
};
let token = Token::new(header, claims).sign_with_key... | Rust | 0 |
hs[i][1], truths[i][2], truths[i][3], truths[i][4], 1.0, 1.0, truths[i][0]]
best_iou = 0
best_j = -1
for j in pred_list: # ITERATE THROUGH ONLY CONFIDENT BOXES
iou = bbox_iou(box_gt, boxes[j], x1y1x2y2=False)
if iou > best_iou:
... | Python | 1 |
`read()` method returns [wdtclkdiv::R](wdtclkdiv::R) reader structure"]
impl crate::Readable for WDTCLKDIV {}
#[doc = "`write(|w| ..)` method takes [wdtclkdiv::W](wdtclkdiv::W) writer structure"]
impl crate::Writable for WDTCLKDIV {}
#[doc = "WDT clock divider"]
pub mod wdtclkdiv;
#[doc = "ADC clock divider\n\nThis reg... | Rust | 0 |
ng,
mode: socket_mode,
) -> libc::c_int;
pub fn pfring_mod_sysdig_set_poll_watermark(
ring: *mut pfring,
watermark: uint16_t,
) -> libc::c_int;
pub fn pfring_mod_sysdig_get_bound_device_ifindex(
ring: *mut pfring,
if_index: *mut libc::c_int,
) -> libc::c_int... | Rust | 0 |
.0;
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub struct HinduSolar {
pub year: i32,
pub month: i32,
pub day: i32
}
pub fn hindu_day_count(date: RD) -> i32 {
date - EPOCH
}
pub fn jovian_year(date: RD) -> i32 {
divide(divide_f(hindu_day_count(date) as f64, ARYA_JOVIAN_PERIOD / 12.0).0 as i32, ... | Rust | 0 |
pos: [-1, -1, -1] },
// right (1, 0, 0)
CubeVertex { pos: [ 1, -1, -1] },
CubeVertex { pos: [ 1, 1, -1] },
CubeVertex { pos: [ 1, 1, 1] },
CubeVertex { pos: [ 1, -1, 1] },
// left (-1, 0, 0)
CubeVertex { pos: [-1, -1, 1] },
... | Rust | 0 |
\\(l \ne i\\),
//! participant \\(P\_i\\) verifies \\(\sigma\_l = (s\_l, r\_l)\\), by checking:
//! \\(s\_l \stackrel{?}{=} \mathcal{H}(l, \Phi, \phi\_{l0}, g^{r\_l} \cdot \phi\_{l0}^{-s\_i})\\).
//! If any participants' proofs cannot be verified, return their participant indices.
//!
... | Rust | 0 |
fn client(&mut self) -> &mut Client<String> {
&mut self.client
}
async fn fetch_offsets(&mut self) -> Result<FetchOffsetPartitionResponse, ClientError> {
let response = self
.client
.send_receive(FlvFetchOffsetsRequest::new(
self.topic().to_owned(),
... | Rust | 0 |
len(),
initial_epoch.index,
num_validators,
);
let span = span!(Level::TRACE, "prove");
let _enter = span.enter();
let mut epochs = transitions
.iter()
.map(|transition| to_update(transition))
.collect::<Vec<_>>();
let num_epochs = epochs.len();
if num_... | Rust | 0 |
precise[1];
assert!(precise_res >= ef_res.lower_bound() as f64);
assert!(precise_res <= ef_res.upper_bound() as f64);
}
}
#[test]
fn div() {
for trial in 0..KE_FLOAT_ITERS {
let mut rng = RNG::new(trial as u64);
let ef = [get_efloat!(&mut rn... | Rust | 0 |
et mut fields = IndexMap::new();
fields.insert(String::from("id"), "u8");
fields.insert(String::from("vals"), "seq?");
builder.add_struct("struct", "MyStruct", &fields);
// unit struct
assert_fmt!(builder,
"unit_struct" => "struct Foo",
"u... | Rust | 0 |
i) % 8] >> 48) & 0xff) as usize]
^ C2[((k[(6 + i) % 8] >> 40) & 0xff) as usize]
^ C3[((k[(5 + i) % 8] >> 32) & 0xff) as usize]
^ C4[((k[(4 + i) % 8] >> 24) & 0xff) as usize]
^ C5[((k[(3 + i) % 8] >> 16) & 0xff) as usize]
^ C6[((k[(2 + i) %... | Rust | 0 |
"allauth.socialaccount.adapter.DefaultSocialAccountAdapter",
)
@property
def FORMS(self):
return self._setting("FORMS", {})
@property
def LOGIN_ON_GET(self):
return self._setting("LOGIN_ON_GET", False)
@property
def STORE_TOKENS(self):
return self._setting("... | Python | 1 |
fn to_native(&self) -> lsl_channel_format_t {
match self {
ChannelFormat::Float32 => lsl_channel_format_t_cft_float32,
ChannelFormat::Double64 => lsl_channel_format_t_cft_double64,
ChannelFormat::String => lsl_channel_format_t_cft_string,
ChannelFormat::Int32 => ... | Rust | 0 |
# Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
from vizseq.scorers import register_scorer, VizSeqScorer, VizSeqScore
import numpy as np
from typing import List, Option... | Python | 1 |
Frndint
0x01,// Normal_1
0xC7, 0x07,// 967 = "frndint"
// Fscale
0x01,// Normal_1
0xC9, 0x07,// 969 = "fscale"
// Fsin
0x01,// Normal_1
0xCB, 0x07,// 971 = "fsin"
// Fcos
0x01,// Normal_1
0xA2, 0x07,// 930 = "fcos"
// Fiadd_m32int
0x04,// Normal_2c
0xCD, 0x05,// 717 = "fiadd"
0x6C,// 'l'
// Fimul_... | Rust | 0 |
rustc_builtin_macro]
macro_rules! include {}
#[rustc_builtin_macro]
macro_rules! compile_error {}
#[rustc_builtin_macro]
macro_rules! format_args {
() => {}
}
fn f() {
// Test a handful of built-in (eager) macros:
include!(invalid);
//^^^^^^^^^^^^^^^^^ could not convert tokens
include!("does not e... | Rust | 0 |
(self):
return "{}({!r})".format(self.__class__.__name__, str(self))
def _remove_dots(self, segments):
if not segments or segments[0] != "":
return segments
empty = segments[0]
output = []
remove = 0
# Get reversed list with first (empty) element remov... | Python | 1 |
> {
self.reader.read_unary(&mut self.inner)
}
#[inline(always)]
fn read_huffman<H: huffman::HuffmanEntry>(
&mut self,
table: &huffman::HuffmanTable<H>,
lim_bits: u32,
) -> io::Result<(H::ValueType, u32)> {
self.reader.read_huffman(&mut self.inner, table, lim_bits... | Rust | 0 |
// TTL for the SOA is set internally...
// expire is for the SOA, minimum is default for records
if let RData::SOA(ref soa) = rdata {
// TODO, this looks wrong, get_expire() should be get_minimum(), right?
record.set_ttl(soa.expire() as u32)... | Rust | 0 |
for i in response])
return {
'accuracy': accuracy_score(answers, predicted),
'power': np.sum((predicted == True) & (answers == True)) / np.sum((answers == True)),
'false discovery rate': np.sum((predicted == True) & (answers == False)) / np.sum((answers == False)),
... | Python | 1 |
= MemFlags::host_coherent();
let dev = MemFlags::device_local();
let n_elements = scene.len() / piet_gpu_types::scene::Element::fixed_size();
println!("scene: {} elements, {} paths, {} path_segments", n_elements, n_paths, n_pathseg);
let scene_buf = device
.create_buffer(s... | Rust | 0 |
target.operation_names
elif supported_gates is None:
raise ValueError("One of ``supported_gates`` or ``target`` must be specified.")
self._supported_gates = supported_gates
self._target = target
self._translator = BasisTranslator(equivalence_library, supported_gates, target=... | Python | 1 |
from collections import deque
def bfs(matrix, start, end):
rows, cols = len(matrix), len(matrix[0])
visited = [[False]*cols for _ in range(rows)]
queue = deque([(start, [start])])
while queue:
(x, y), path = queue.popleft()
if (x, y) == end:
return path
for dx, dy i... | Python | 1 |
-> Result<(Self, ByteArray)> {
let split_idx = std::mem::size_of::<$T>();
let (left, right) = data.split(split_idx)?;
let mut array = [0; std::mem::size_of::<$T>()];
array.copy_from_slice(&left);
let value = $T::from_le... | Rust | 0 |
o, b.qty FROM td_receipt a, td_item_sale b WHERE a.receipt_no = b.receipt_no AND a.receipt_no={del_bill.receipt_no}"
query = f"SELECT receipt_no FROM td_receipt WHERE receipt_no={del_bill.receipt_no}"
cursor.execute(query)
record = cursor.fetchone()
# conn.close()
# cursor.close()
# print(list... | Python | 1 |
use Options;
pub fn install(workspace: &Workspace, config: &AndroidConfig, options: &Options)
-> Result<(), CargoError>
{
let build_result = build::build(workspace, config, options)?;
let adb = config.sdk_path.join("platform-tools/adb");
workspace.config().shell().say("Installing apk to th... | Rust | 0 |
n></td></tr></tbody>
# </table></td></tr></tbody>
# </table></div></td></tr> <tr><td width="100%" class="blk_container bmeHolder bmeBody" name="bmeBody" valign="top" align="center" style="color: rgb(56, 56, 56); border: 0px none transparent; background-color: rgb(255, 255... | Python | 1 |
<MessageExt>,
counter: Arc<Mutex<usize>>,
}
impl PushConsumer {
pub fn builder(ty: PushConsumerType, group: &str, property_keys: Vec<String>) -> PushConsumerBuilder {
PushConsumerBuilder::new(ty, group, property_keys)
}
fn from_ptr(ptr: *mut CPushConsumer, ty: PushConsumerType, receiver: Recei... | Rust | 0 |
ILABLE,
Pkcs12PasswordMismatch = ERR_PKCS12_PASSWORD_MISMATCH,
Pkcs12PbeInvalidFormat = ERR_PKCS12_PBE_INVALID_FORMAT,
Pkcs5BadInputData = ERR_PKCS5_BAD_INPUT_DATA,
Pkcs5FeatureUnavailable = ERR_PKCS5_FEATURE_UNAVAILABLE,
Pkcs5InvalidFormat = ERR_PKCS5_INVALID_FORMAT,
Pkc... | Rust | 0 |
from django.urls import path
from . import views
urlpatterns = [
path('spin-wheel/', views.spin_wheel, name='spin_wheel'),
] | Python | 1 |
CTRL,
#[doc = "0x14 - Command Register"]
pub cmd: CMD,
#[doc = "0x18 - Channel enable Register"]
pub chen: CHEN,
#[doc = "0x1c - Scan result register"]
pub scanres: SCANRES,
#[doc = "0x20 - Status Register"]
pub status: STATUS,
#[doc = "0x24 - Result buffer pointers"]
pub ptr: PT... | Rust | 0 |
#!/usr/bin/python3
"""Module for validUtf8 method"""
def validUTF8(data):
"""Determines if given data represents valid UTF-8 encoding
Args:
data: list of integers
Returns:
True if valid UTF-8 encoding, otherwise False
"""
# Number of bytes in the current UTF-8 character
n_bytes... | Python | 1 |
ipped_sd_psd_i[i]]
print "Conditional private reuse profile of core ", i, " basic block " , b_t_info[0], " is ", res_sd_psd_i[i]
#print "Probability of BasicBlock ",b_t_info[2]," is ", b_t_info[-1]
f_res_sd_psd_i[i] = get_final_prob_bb_i(res_sd_psd_i[i], float(b_t_info[-1])/core_coun... | Python | 1 |
"""
Tests for the plugins.i18n_api Django commands module.
"""
from unittest.mock import patch
from django.core.management import call_command
def test_pull_plugin_translations_command(settings, tmp_path):
"""
Test the `pull_plugin_translations` Django command.
"""
plugins_locale_root = tmp_path / 'c... | Python | 1 |
I: IntoIterator<Item = T>,
T: Into<OsString> + Clone,
{
let arg_matches = parse_arg_matches(arguments);
match run(arg_matches) {
Ok(()) => {}
Err(err) => {
eprintln!("{} {}", "error:".red().bold(), err);
process::exit(1);
}
}
}
fn main() {
run_app(s... | Rust | 0 |
rget = crate::FieldReader<u8, REV2NP_A>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `REV2NP` writer - Service Request Node Pointer Result Event i"]
pub struct REV2NP_W<'a> {
w: &'a mut W,
}
impl<'a> REV2NP_W<'a> {
#[doc = r"Writes `variant` to the field"]... | Rust | 0 |
- intersection_area
# Compute IoU
iou = intersection_area / union_area
return iou
def xywh2xyxy(x):
# Convert bounding box (x, y, w, h) to bounding box (x1, y1, x2, y2)
y = np.copy(x)
y[..., 0] = x[..., 0] - x[..., 2] / 2
y[..., 1] = x[..., 1] - x[..., 3] / 2
y[..., 2] = x[..., 0] + ... | Python | 1 |
AppState>,
hash_hex_with_prefix: web::Path<String>,
) -> ActixResult<HttpResponse> {
let hash =
try_parse_hash(&hash_hex_with_prefix).ok_or_else(|| HttpResponse::BadRequest().finish())?;
let storage = data.access_storage()?;
let mut res;
res = storage
.chain()
.operations_e... | Rust | 0 |
from prometheus_client import Counter, Gauge, Histogram, utils
# TODO: maybe these could live on GTFSDownloadConfig?
standard_labels = (
"record_name",
"record_uri",
"record_feed_type",
)
AIRTABLE_CONFIGURATION_AGE = Gauge(
name="airtable_configuration_age",
documentation="Airtable configuration ag... | Python | 1 |
::from(0x7fffu16));
let mut buf = [0u8; 2];
v1.to_be_bytes(&mut buf);
assert_eq!(&buf, &[0xff, 0xff]);
v2.to_be_bytes(&mut buf);
assert_eq!(&buf, &[0x80, 0x00]);
v3.to_be_bytes(&mut buf);
assert_eq!(&buf, &[0x7f, 0xff]);
v1.to_le_bytes(&mut buf);
... | Rust | 0 |
import gradio as gr
from .util import lib_wordcloud, lib_jieba
from .consts import *
def service_text2wc(
text_file,
text_lang,
text_dict: str,
background_color,
margin,
max_font_size,
min_font_size,
font_file,
width,
height,
ma... | Python | 1 |
(opt, train=True):
if train:
if opt.train_min_size_range[0] == -1:
min_size = opt.train_min_size
else:
min_size = list(
range(
opt.train_min_size_range[0], opt.train_min_size_range[1] + 1
)
)
max_size =... | Python | 1 |
int("Predictor not initialized. Cannot perform detection.")
return [], [], [], [], []
if isinstance(image, str):
image_path = image
image = cv2.imread(image)
if image is None:
print(f"Could not read image: {image_path}")
return [],... | Python | 1 |
run(elf: impl AsRef<Path>) -> Result<()> {
let output_file = PathBuf::from(env::var("OUT_DIR")?).join("binary.bin");
run_for_file(elf, &output_file)?;
println!("cargo:rustc-env={}={}", VAR_BIN_FILE, output_file.display());
Ok(())
}
pub fn run_for_file(elf: impl AsRef<Path>, output_file: impl AsRef<... | Rust | 0 |
latten!(FmtArg::DEBUG; ConstGenE<1> => ConstGenE::X(&[3])),
"X([3])"
);
assert_eq!(
fmt_flatten!(FmtArg::DEBUG; ConstGenE<2> => ConstGenE::X(&[3, 5])),
"X([3, 5])"
);
assert_eq!(
fmt_flatten!(FmtArg::DEBUG; ConstGenE<3> => ConstGenE::X(&[3, 5, 8])),
"X([3, 5, 8])"... | Rust | 0 |
#!/usr/bin/env python
# coding: utf-8
# In[1]:
import sys
sys.path.append('../scripts/')
from mcl import *
from scipy.stats import multivariate_normal
from matplotlib.patches import Ellipse
# In[2]:
def sigma_ellipse(p, cov, n):
eig_vals, eig_vec = np.linalg.eig(cov)
ang = math.atan2(eig_vec[:,0][1], eig... | Python | 1 |
ics_lock);
let texture_index_offset: usize;
match resource_manager.upgrade() {
Some(rm) => {
texture_index_offset = rm.read().get_texture_count();
let mut rm_lock = rm.write();
let textures_ptrs = textures
.into_iter()
... | Rust | 0 |
/// Mobilecoind Uri Scheme
#[derive(Debug, Hash, Ord, PartialOrd, Eq, PartialEq, Clone)]
pub struct MobilecoindScheme {}
impl UriScheme for MobilecoindScheme {
/// The part before the '://' of a URL.
const SCHEME_SECURE: &'static str = "mobilecoind";
const SCHEME_INSECURE: &'static str = "insecure-mobile... | Rust | 0 |
def test_full_loop_with_v_prediction(self):
sample = self.full_loop(prediction_type='v_prediction')
result_mean = torch.mean(torch.abs(sample))
assert abs(result_mean.item() - 0.0092) < 0.001
| Python | 1 |
from datetime import datetime
from typing import Optional, List
from sqlmodel import Session, select
from app.models.table import SMSCodeRecord
class SMSCodeRecordCRUD:
def __init__(self, session: Session):
self.session = session
def create_sms_code_record(
self,
phone_number: str,
... | Python | 1 |
pwm2(&self) -> bool {
*self == ADC_EMUX_EM1R::ADC_EMUX_EM1_PWM2
}
#[doc = "Checks if the value of the field is `ADC_EMUX_EM1_PWM3`"]
#[inline(always)]
pub fn is_adc_emux_em1_pwm3(&self) -> bool {
*self == ADC_EMUX_EM1R::ADC_EMUX_EM1_PWM3
}
#[doc = "Checks if the value of the fiel... | Rust | 0 |
Palette {
foreground: Self::NO_COLOR,
background: Self::NO_COLOR,
match_bg: Self::NO_COLOR,
match_lnum_fg: Self::YELLOW_COLOR_16,
region_fg: Self::BLACK_COLOR_16,
region_bg: Self::YELLOW_COLOR_16,
gutter_fg: Self::NO_COLOR,
};
fn new(theme: &Theme) -> Sel... | Rust | 0 |
ss_name: str = "AITProgram"):
import importlib.util
spec = importlib.util.spec_from_file_location("AITProgram", file_path)
module = importlib.util.module_from_spec(spec)
spec.loader.exec_module(module)
return getattr(module, class_name)()
def get_inputs_from_graph(file_path: str):
program = ... | Python | 1 |
}
#[doc = "Bits 24:26 - Pin Configuration"]
#[inline(always)]
pub fn pincfg(&mut self) -> PINCFG_W {
PINCFG_W { w: self }
}
#[doc = "Writes raw bits to the register."]
#[inline(always)]
pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
self.0.bits(bits);
self
... | Rust | 0 |
essType {
pub const AppEntriesReadWrite: Self = Self(0i32);
pub const AllEntriesLimitedReadWrite: Self = Self(1i32);
pub const AllEntriesReadWrite: Self = Self(2i32);
}
impl ::core::marker::Copy for PhoneCallHistoryStoreAccessType {}
impl ::core::clone::Clone for PhoneCallHistoryStoreAccessType {
fn clo... | Rust | 0 |
folder = self._hashmap_transfer(metadata)
layers = self._client.list_objects(
bucket_name=self.config.bucket_name,
prefix=f"{model_folder}/",
recursive=True,
)
logger.info("model with {} is loaded".format(str(metadata)))
return self._load_model(model... | Python | 1 |
)
monkeypatch.setenv("ARCADE_SERVER_TRANSPORT", "http")
monkeypatch.setenv("ARCADE_SERVER_HOST", "192.168.1.1")
host, port, transport = MCPApp._get_configuration_overrides("127.0.0.1", 8000, "http")
assert host == "192.168.1.1"
assert transport == "http"
monkeypatch.delen... | Python | 1 |
_script = notescript.delete_note_script
helpers.run_applescript(delete_note_script, "Sync", "testnote1")
@pytest.mark.skipif(TEST_ENV != 'local', reason="Requires local filesystem.")
def test_upsert_remote(self):
new_note = TestNote._create_note_from_remote()
new_note.attachments[0].sta... | Python | 1 |
BuildRequestError { source: http::Error },
#[error("Failed to execute request: {}", source)]
ExecuteRequestError { source: Box<dyn std::error::Error + Sync + Send> },
#[error("Failed to serialize request body: {}", source)]
SerializeError { source: Box<dyn std::error::Err... | Rust | 0 |
rintln!("Received signal SIGTERM");
break 'signal_loop;
}
_ => unreachable!(),
}
}
}
println!("Terminating program");
Ok(())
}#[cfg(unix)]
use libc as errno;
#[cfg(windows)]
use windows::errno;
const ZMQ_HAUSNUMERO: i32 = 156_384_712;
... | Rust | 0 |
'%s' refused" % args.access_key)
raise e
except pvrhino.RhinoActivationThrottledError as e:
print("AccessKey '%s' has been throttled" % args.access_key)
raise e
except pvrhino.RhinoError as e:
print("Failed to initialize Rhino")
raise e
audio = read_file(args.wav_pat... | Python | 1 |
ialized_start=1489
_CHARGEREQUEST._serialized_end=1590
_CHARGERESPONSE._serialized_start=1592
_CHARGERESPONSE._serialized_end=1632
_ORDERITEM._serialized_start=1634
_ORDERITEM._serialized_end=1716
_ORDERRESULT._serialized_start=1719
_ORDERRESULT._serialized_end=1910
_SENDORDERCONFIRMATIONREQUEST._serial... | Python | 1 |
articles['title'].unique())
if st.button("Recommend Articles"):
recs = recommend_articles(selected)
for _, row in recs.iterrows():
st.markdown(f"<div class='recommend-box'><a href='{row['url']}' target='_blank'>{row['title']}</a></div>", unsafe_allow_html=True)
with tab5:
st.header(... | Python | 1 |
# Eve W-Space
# Copyright 2014 Andrew Austin and contributors
#
# 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 requi... | Python | 1 |
# coding: utf-8
from django import forms
from widgets import UEditorWidget
from DjangoUeditor.models import UEditorField as ModelUEditorField
class UEditorField(forms.CharField):
def __init__(
self,
label,
width=600,
height=300,
toolbars="full",
... | Python | 1 |
ata};
use sc_service::ChainType;
use sc_telemetry::TelemetryEndpoints;
use sp_core::sr25519;
use sp_runtime::traits::Zero;
use tico_runtime::{
AuraConfig, AuraId, BalancesConfig, CollatorSelectionConfig, CouncilConfig, CurrenciesConfig, DemocracyConfig,
ElectionsConfig, GenesisConfig, ParachainInfoConfig, Perbill, Se... | Rust | 0 |
or<Self>;
/// The raw connection for this backend.
type RawConnection: RawConnection<Backend = Self>;
/// The type of raw values used to communicate with the backend.
///
/// See [`RawValue`] for more info.
type RawValue<'b>: RawValue<Self>;
}
/// Indicates that a sql type exists in the databas... | Rust | 0 |
Copy, Clone, PartialEq)]
//! # struct Point {
//! # x: i32,
//! # y: i32,
//! # }
//! #
//! # impl Add for Point {
//! # type Output = Self;
//! #
//! # fn add(self, rhs: Self) -> Self::Output {
//! # Self {x: self.x + rhs.x, y: self.y + rhs.y}
//! # }
//! # }
//! #
//! use forward_ref_gene... | Rust | 0 |
# library imports
# project imports
from algo.gene import Gene
class Population:
"""
A population of genes
"""
def __init__(self,
genes: list = None):
self.genes = genes if isinstance(genes, list) and len(genes) > 0 else []
def __getitem__(self, item):
return se... | Python | 1 |
} else if name.contains("{:02}") {
name.replace("{:02}", &format!("{:02}", i))
} else if name.contains("{:03}") {
name.replace("{:03}", &format!("{:03}", i))
} else if name.contains("{:04}") {
name.replace("{:04}", &format!("{:04}", i))
} else {
unreachable!()
}
}
use co... | Rust | 0 |
import time
import talib
# 在这个方法中编写任何的初始化逻辑。context对象将会在你的算法策略的任何方法之间做传递。
def init(context):
context.s1 = "000001.XSHE"
# 设置这个策略当中会用到的参数,在策略中可以随时调用,这个策略使用长短均线,我们在这里设定长线和短线的区间,在调试寻找最佳区间的时候只需要在这里进行数值改动
context.SHORTPERIOD = 20
context.LONGPERIOD = 120
context.count = 0
print("init")
def bef... | Python | 1 |
safe_allow_html=True)
st.markdown("#####")
draw_corr_pol_area(result)
st.markdown("###")
with stylable_container(
key = "mean",
css_styles = """
h6
{
float: left;
}
"""
... | Python | 1 |
});
write!(signature, "{} *const {}_ptr", ctype, name);
write!(
body,
" {} {NS}::Array<{}, {}, {}> {name} = {NS}::Array<{}, {}, {}>({name}_ptr",
prefix,
ctype,
free_ndims,
bounds_checking,
ctype,
ndims,
bounds_checking,
name = nam... | Rust | 0 |
o_sort&sort=downloads");
assert_eq!(json.meta.total, 3);
assert_eq!(json.crates[0].name, "foo_sort");
assert_eq!(json.crates[1].name, "baz_sort");
assert_eq!(json.crates[2].name, "bar_sort");
let json = anon.search("q=bar_sort&sort=downloads");
assert_eq!(json.meta.total, 3);
assert_eq!(jso... | Rust | 0 |
"""Class-based event handlers
A light-weight event-handler framework based on event classes.
Handlers are registered for event classes:
>>> import zope.event.classhandler
>>> class MyEvent(object):
... pass
>>> def handler1(event):
... print("handler1 %r" % event.__class__.__name__)
... | Python | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.