text string | label_name string | labels int64 |
|---|---|---|
sion, current API (built specifically for our Python):
for abi in abis:
for arch in platforms:
supported.append(('%s%s' % (impl, versions[0]), abi, arch))
# abi3 modules compatible with older version of Python
for version in versions[1:]:
# abi3 was introduced in Python 3.2
... | Python | 1 |
points = np.stack([p1, p2])
print(points.shape)
x = points[:, 0]
y = points[:, 1]
z = points[:, 2]
# draw lines from the first vertex to second
lines = [[0, 1]]
ipv.plot_trisurf(x, y, z, lines=lines, color=color)
def plot_box(corner1=(0.1, 0.1, 0.1), corner2=(0.5, 0.5, 0.5), color='red'... | Python | 1 |
ock_size = f['loadfs_block_size']
# This should be done better
expected_text = 'FPGA loaded successfully'
output = u_boot_console.run_command('fpga loadfs %x %x %x %x %s && echo %s' % (dev, addr, bit_size, block_size, bit, expected_text))
assert expected_text in output
@pytest.mark.buildconfigspec('cm... | Python | 1 |
amespace_info.slug == "test-slug"
assert namespace_info.owner_id == "user-123"
assert namespace_info.description == "Test description"
assert namespace_info.is_active is True
# Test with minimal required fields
minimal_namespace = NamespaceInfo(
id="minimal",
... | Python | 1 |
hunk)
step = size // subchunks_per_chunk
if size % subchunks_per_chunk != 0:
step += 1
for start in range(0, step * subchunks_per_chunk, step):
yield PolarsColumn(
chunk[start : start + step], allow_copy=self... | Python | 1 |
he [`GetFieldOffset`] trait.
//!
//! # Cargo features
//!
//! These are the cargo features in `repr_offset`:
//!
//! - `derive` (disabled by default):
//! Re-exports the `ReprOffset` derive macro from the `repr_offset_derive` crate.
//!
//! - `"for_examples"` (disabled by default):
//! Enables the `for_examples` module... | Rust | 0 |
serde_json::Value {
// announce sender's pubkey to recipient with throwaway keypair
let secp = Secp256k1::new();
let (throwaway_privkey, throwaway_pubkey) = generate_key();
let throwaway_keypair = secp256k1::KeyPair::from_secret_key(&secp, throwaway_privkey);
let recipient_schnorr_pub = secp256k1... | Rust | 0 |
import re
INPUT_FILE = "hashes_raw.txt"
SHA256_FILE = "hashes_sha256.txt"
SHA1_FILE = "hashes_sha1.txt"
MD5_FILE = "hashes_md5.txt"
sha256_re = re.compile(r"^[0-9a-f]{64}$", re.IGNORECASE)
sha1_re = re.compile(r"^[0-9a-f]{40}$", re.IGNORECASE)
md5_re = re.compile(r"^[0-9a-f]{32}$", re.IGNORECASE)
hash_sets... | Python | 1 |
r).abs() <= 2.0 * f64::EPSILON);
});
}
#[tokio::test]
async fn csv_between_expr() -> Result<()> {
let mut ctx = ExecutionContext::new();
register_aggregate_csv(&mut ctx)?;
let sql = "SELECT c4 FROM aggregate_test_100 WHERE c12 BETWEEN 0.995 AND 1.0";
let mut actual = execute(&mut ctx, sql).awa... | Rust | 0 |
n, k = map(int, input().split())
count = 0
for _ in range(n):
x = int(input())
if x % k == 0:
count += 1
print(count)
| Python | 1 |
n['prerenderStatus']) if 'prerenderStatus' in json else None
)
@event_class('Preload.preloadingAttemptSourcesUpdated')
@dataclass
class PreloadingAttemptSourcesUpdated:
'''
Send a list of sources for all preloading attempts in a document.
'''
loader_id: network.LoaderId
preloading_attempt_... | Python | 1 |
le.contains_snapshots() {
let tmpl = RepopulateSnapshotDerivedTmpl {
contract_schema: &contract_id.name,
table: &table.name,
columns: &columns,
};
tx.simple_query(&tmpl.render()?)?;
} else {
let tmpl = RepopulateChan... | Rust | 0 |
nt buffer
#w.prnt('', '%s: Not closing buffer: %s: it is in currently active' %(SCRIPT_NAME, name))
continue
if len(w.buffer_get_string(buffer, 'input')):
# Don't close buffers with text on input line
#w.prnt('', '%s: Not closing buffer: %s: it... | Python | 1 |
# utils for pose transformation
import numpy as np
import torch
def trans2hom(R, t):
# Get 4x4 transformation matrix from rotation matrix and translation vector
T = np.eye(4)
T[:3, :3] = R
T[:3, 3] = t
return T
def m2ypr(m):
# Get yaw, pitch, roll angles from 4x4 transformation matrix
#... | Python | 1 |
t_time as f64 / 1000_f64;
service_duration.with_label_values(&["all", "all"]).observe(dur_sec);
service_duration.with_label_values(&[log.domain.as_str(), "127.0.0.1"]).observe(dur_sec);
});
}
}
}
}
#[derive(Serialize, Deserialize, Debug)]
... | Rust | 0 |
ef ProduceTime(self):
return self._ProduceTime
@ProduceTime.setter
def ProduceTime(self, ProduceTime):
self._ProduceTime = ProduceTime
@property
def Offset(self):
return self._Offset
@Offset.setter
def Offset(self, Offset):
self._Offset = Offset
@property
... | Python | 1 |
# Ultralytics YOLO 🚀, AGPL-3.0 license
import torch
from ultralytics.engine.results import Results
from ultralytics.models.fastsam.utils import bbox_iou
from ultralytics.models.yolo.detect.predict import DetectionPredictor
from ultralytics.utils import DEFAULT_CFG, ops
class FastSAMPredictor(DetectionPredictor):
... | Python | 1 |
)."]
pub ch_map: [u8; 5usize],
}
#[test]
fn bindgen_test_layout_ble_gap_opt_ch_map_t() {
assert_eq!(
::core::mem::size_of::<ble_gap_opt_ch_map_t>(),
8usize,
concat!("Size of: ", stringify!(ble_gap_opt_ch_map_t))
);
assert_eq!(
::core::mem::align_of::<ble_gap_opt_ch_map_t>... | Rust | 0 |
"""Common get functions for DHCPv6"""
# Python
import logging
# Unicon
from unicon.core.errors import SubCommandFailure
from genie.metaparser.util.exceptions import SchemaEmptyParserError
log = logging.getLogger(__name__)
def get_dhcpv6_server_stats(device):
"""Get the dhcpv6 server statistics on device
... | Python | 1 |
# Copyright (C) 2022-2025 Intel Corporation
# LIMITED EDGE SOFTWARE DISTRIBUTION LICENSE
import http
from geti_fastapi_tools.exceptions import GetiBaseException
class InferenceMediaNotFound(GetiBaseException):
"""
Exception raised when attempting to run inference, but the media (image or video frame) is not... | Python | 1 |
ral of constant one monomial on a triangle interior should give its area.
@test isapprox(Mesh.integral_face_rel_on_oshape_face(onemon, oshapenum(1), fefacenum(0), tmsh),
0.5*2*1.5, atol=1e-15, rtol=1e-15)
@test isapprox(Mesh.integral_face_rel_on_oshape_face(onemon, oshapenum(2), fefacenum(0), tmsh),
... | Rust | 0 |
skip_if: !skip_if,
left,
right,
}
}
},
}
}
pub fn comparison_binop_const_fold<'gc>(
comparison_binop: ComparisonBinOp,
left: Constant<'gc>,
right: Constant<'gc>,
) -> Option<Constant<'gc>> {
match comparison_binop {
... | Rust | 0 |
viderOidcWebSsoConfigResponseTypeEnum%s" % resource
)
@classmethod
def from_proto(self, resource):
if not resource:
return resource
return workforce_pool_provider_pb2.IamWorkforcePoolProviderOidcWebSsoConfigResponseTypeEnum.Name(
resource
)[
l... | Python | 1 |
Self {
h_box: gtk::Box::new(gtk::Orientation::Horizontal, 0),
entry: gtk::Entry::new(),
});
let label = gtk::Label::new(Some(label));
lte.h_box.pack_start(&label, false, false, 0);
lte.h_box.pack_start(<e.entry, true, true, 0);
lte
}
pub fn en... | Rust | 0 |
"""
Oxford Vocabulary Trainer - Main Entry Point
AI-powered vocabulary learning game using Oxford 5000 words
Author: Rafi Project
Version: 1.0.0
"""
import os
import sys
from pathlib import Path
# Add src directory to path
current_dir = Path(__file__).parent
src_dir = current_dir / 'src'
sys.path.insert(0, str(src_di... | Python | 1 |
= new_collateral;
T::OnUpdateLoan::happened(&(who.clone(), currency_id, debit_adjustment, p.debit));
p.debit = new_debit;
if p.collateral.is_zero() && p.debit.is_zero() {
// decrease account ref if zero position
system::Module::<T>::dec_ref(who);
// remove position storage if zero posi... | Rust | 0 |
bbox.y_range()
}
fn m_range(&self) -> [f64; 2] {
self.bbox.m_range()
}
}
/*
* PolylineZ
*/
/// Specialization of the `GenericPolyline` struct to represent a `PolylineZ` shape
/// ( collection of [PointZ](../point/struct.PointZ.html))
pub type PolylineZ = GenericPolyline<PointZ>;
impl PolylineZ... | Rust | 0 |
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.chrome.options import Options
import pandas as... | Python | 1 |
import json
from pathlib import Path
from typing import Literal
from pydantic import BaseModel, Field
from .color_range import ColorRange
PREFERENCES_FILE = Path(__file__).parent / "color_squares_preferences.json"
"設定ファイルのパス"
type ColorName = Literal["Red", "Blue", "Yellow"]
COLORS: tuple[ColorName, ...] = ("Red",... | Python | 1 |
on, CFString, kAXDescriptionAttribute),
(element_busy, CFBoolean, kAXElementBusyAttribute),
(enabled, CFBoolean, kAXEnabledAttribute),
(focused, CFBoolean, kAXFocusedAttribute),
(help, CFString, kAXHelpAttribute),
(identifier, CFString, kAXIdentifierAttribute),
(label_value, CFString, kAXLabelVa... | Rust | 0 |
"""
Classifies: CHEBI:84948 11,12-saturated fatty acyl-CoA(4-)
"""
"""
Classifies: CHEBI:84948 11,12-saturated fatty acyl-CoA(4-)
"""
from rdkit import Chem
from rdkit.Chem import AllChem
from rdkit.Chem import rdMolDescriptors
def is_11_12_saturated_fatty_acyl_CoA_4__(smiles: str):
"""
Determines if a molecul... | Python | 1 |
ait.unwrap();
assert_eq!(result.as_ref(), Some(&value));
});
}
}
}
extern crate lapin_async as lapin;
extern crate amq_protocol;
use std::net::TcpStream;
use std::{thread,time};
use amq_protocol::types::*;
use lapin::connection::*;
use lapin::buffer::Buffer;
use lapin::generat... | Rust | 0 |
size: size_of::<GstWebRTCFECType>(),
alignment: align_of::<GstWebRTCFECType>(),
},
),
(
"GstWebRTCICEComponent",
Layout {
size: size_of::<GstWebRTCICEComponent>(),
alignment: align_of::<GstWebRTCICEComponent>(),
},
),
(
... | Rust | 0 |
/licenses/BSD-3-Clause-No-Nuclear-License"),
),
(
"BSD-3-Clause-No-Nuclear-License-2014",
include!("text/licenses/BSD-3-Clause-No-Nuclear-License-2014"),
),
(
"BSD-3-Clause-No-Nuclear-Warranty",
include!("text/licenses/BSD-3-Clause-No-Nuclear-Warranty"),
),
(
... | Rust | 0 |
ject_mask = get_segmentation(
segmented_img, idx, detections, img, label_detected, score, color=(255, 0, 0)
)
score_list.append(score)
object_masks_list.append(object_mask)
label_list.append(0)
elif label_detected in dino_l... | Python | 1 |
String,
pub cert: String,
// TODO: better security
pub priv_key: String,
#[serde(default)]
// https://github.com/alexcrichton/toml-rs/issues/258
#[serde(skip_serializing_if = "Vec::is_empty")]
pub peers: Vec<PeerConfig>,
}
// a wrapper
#[derive(Serialize, Deserialize, Debug, Clone)]
stru... | Rust | 0 |
ross - (1.0 / crossProductMag**2) * np.dot(np.outer(crossProduct, crossProduct), hCross))
term2 = -(term21 + term22)
factor = -mu / hMag
dvde = factor * (term1 + term2)
return dvde
def dVelocityVectordTA(self, x, mu):
"""
derivatives of Velocity vector wrt true ano... | Python | 1 |
]
pub fn length(&self) -> f64 {
return self.length_sqr().sqrt();
}
#[inline]
pub fn distance(gp1: GPoint, gp2: GPoint) -> f64 {
return (gp1 - gp2).length();
}
#[inline]
pub fn distance_sqr(gp1: GPoint, gp2: GPoint) -> f64 {
return (gp1 - gp2).length_sqr();
}
}
... | Rust | 0 |
pub fn new(fat_type: FatType, first_block: u32, block_count: u32, block_size: u32) -> Self {
FatTable { fat_type, first_block, block_count, block_size }
}
#[cfg(not(feature = "fat32_disable"))]
fn fat_32_get<T: StorageRead>(&self, io: &mut T, cluster: u32) -> Result<FatValue, bool> {
l... | Rust | 0 |
use std::path::PathBuf;
macro_rules! get(($name:expr) => (ok!(env::var($name))));
macro_rules! ok(($result:expr) => ($result.unwrap()));
fn main() {
if pkg_config::find_library("out123").is_ok() {
return;
}
let dynamic = env::var("CARGO_FEATURE_STATIC").is_err();
let output = PathBuf::from(ge... | Rust | 0 |
from nodes.extractor import extract_query_elements, query_rewrite, query_reinforce
from nodes.merge_responder import merge_context, generate_answer
from nodes.search import wiki_tool, ddg_tool
from langgraph.graph import END, StateGraph
from langchain_core.runnables import RunnableLambda
from typing_extensions import T... | Python | 1 |
::TypeScriptPreProcessor::new();
let rt_builder = QuickJsRuntimeBuilder::new()
.js_script_module_loader(fsl)
.js_script_module_loader(wsl)
.js_script_pre_processor(ts_pp);
// todo greco should add a httpsecurity module to the builder
// or a httpclientfactory, used for modules an f... | Rust | 0 |
_neighbors=n_neighbors, random_state=random_state, metric=metric
)[0]
ref_embedding = ref_simplicial_set_embedding(
X,
graph=ref_fss_graph,
n_components=n_components,
initial_alpha=initial_alpha,
a=a,
b=b,
gamma=gamma,
negative_sample_rate=negative... | Python | 1 |
n (last, best):
if f.exists():
strip_optimizer(f)
if f is best:
LOGGER.info(f'\nValidating {f}...')
ckpt = torch.load(f, map_location=device)
model = ckpt['ema' if ckpt.get('ema') else 'model']
mo... | Python | 1 |
r_color", "N/A"))
# ###############
# print('-' * 13)
# # Use a for loop to iterate over the squirrels in Tompkins Square Park:
for squirrel in squirrels_by_park["Tompkins Square Park"]:
# Safely print the activities of each squirrel or 'None' (default 2nd arg is None)
print(squirrel.get("activities"))
# pr... | Python | 1 |
ident;) => {};
($lhs_type:ty, $lhs_f1:ident, $lhs_f2:ident, $lhs_f3:ident, $lhs_f4:ident;
$rhs_type:ty, $rhs_f1:ident, $rhs_f2:ident, $rhs_f3:ident, $rhs_f4:ident;
$op_trait:ident, $op_fn:ident, $op:tt;
$($op_trait_next:ident, $op_fn_next:ident, $op_next:tt;)*) => {
impl<T: Number, U: Basic>... | Rust | 0 |
# Copyright (c) 2024 pandas-gbq Authors All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
from google.cloud import bigquery
import pyarrow
import pytest
from pandas_gbq.schema import pyarrow_to_bigquery
@pytest.mark.parametrize(
(
... | Python | 1 |
END;
const X_CYLINDER_VERTEX_ONE_PAST_END: shaders::Index = X_CYLINDER_VERTEX_START + math::geom::CYLINDER_POINT_COUNT as shaders::Index;
const VERTEX_LEN: usize = X_CYLINDER_VERTEX_ONE_PAST_END as usize;
struct IndexedMesh {
pub vertices: [basic::Vertex; VERTEX_LEN],
pub indices: [shaders::Index; INDEX_LEN],
}... | Rust | 0 |
import os
import torch
import numpy as np
from src.crowd_count import CrowdCounter
from src import network
from src.data_loader import ImageDataLoader
from src import utils
import cv2
torch.backends.cudnn.enabled = True
torch.backends.cudnn.benchmark = False
vis = False
save_output = True
data_path = 'F:/SJTU_Vide... | Python | 1 |
import logging
import random
from typing import List, Union
import pytest
from .helper import NetpalmTestHelper
from .test_getconfig_cisgo import CisgoHelper
log = logging.getLogger(__name__)
helper = NetpalmTestHelper()
CISGO_DEFAULT_HOSTNAME = "cisshgo1000v"
CISGO_NEW_HOSTNAME = CISGO_DEFAULT_HOSTNAME.upper() + s... | Python | 1 |
iction is >= 0.5,
# and the overlap between the prediction and the ground truth >= 0.5,
# the prediction is a match and considered a true positive.
# If multiple matches exist, the match with the highest pair of overlaps is taken.
joined['overlap1'] = joined['overlaps'].apply(lambda x: eval(str(x))[0])
... | Python | 1 |
with open("this.txt") as f:
content1 = f.read()
with open("this_copy.txt") as f:
content2 = f.read()
if(content1==content2):
print("Yes these file are identical")
else:
print("N0 this file are not identical")
| Python | 1 |
ully created before loading
if icon_file_path.is_file() {
// Assign the icon to the main window
icon_file = Pixbuf::from_file(icon_file_path).unwrap();
gtk::Window::set_default_icon(&icon_file);
}
}
fn get_default_applications() -> DefaultApplications {
let mut result:Result<Output, Error>;
let mut... | Rust | 0 |
// 5
DWRITE_PANOSE_STROKE_VARIATION_GRADUAL_HORIZONTAL = 0x6, // 6
DWRITE_PANOSE_STROKE_VARIATION_RAPID_VERTICAL = 0x7, // 7
DWRITE_PANOSE_STROKE_VARIATION_RAPID_HORIZONTAL = 0x8, // 8
DWRITE_PANOSE_STROKE_VARIATION_INSTANT_VERTICAL = 0x9, // 9
DWRITE_PANOSE_STROKE_VARIATION_INSTANT_HORIZONTAL = 0x... | Rust | 0 |
tate_dict)
val_col = []
for i in range(test_rep):
val_col.append(
trainer.validate(model, datamodule=data_module, verbose=False)[0]
)
val_res = dict_res_summary(val_col)
for met in val_res:
val_mean = np.mean(val_res[met])
val_std = np.std(val_res[met])
... | Python | 1 |
}
let cookie = m.value_of("cookie").map(|s| s.to_owned());
let electrum_banner = m.value_of("electrum_banner").map_or_else(
|| format!("Welcome to electrs-esplora {}", ELECTRS_VERSION),
|s| s.into(),
);
let electrum_public_hosts = m
.value_of(... | Rust | 0 |
Dma;
/// See the [module documentation](super::board)
pub trait Board {
/// The type of Cartridge that this Game Boy can handle.
type CMem: Cartridge;
/// Cpu event logger for debugging purposes
type CpuDbgEvtSrc: DbgEvtSrc<CpuEvt>;
/// Ppu event logger for debugging purposes
type PpuDbgEvtSr... | Rust | 0 |
i::glfwJoystickIsGamepad(joystick as i32) })
}
/// [GLFW Reference][glfw]
///
/// [glfw]: http://www.glfw.org/docs/3.3/group__input.html#gaed5104612f2fa8e66aa6e846652ad00f
pub fn update_gamepad_mappings(&self, mapping: &str) -> Result<()> {
let cstr = CString::new(mapping).unwrap();
... | Rust | 0 |
an array containing the UUID to request
/// `entry_handle`: Entry Handle (0x00 to access first entries in table)
/// `buf`: A mutable buffer to store the request bytes.
///
/// Returns the length of the query on success.
pub fn resolve_uuid(
&self,
dest_addr: u8,
uuid: &[u8;... | Rust | 0 |
TreeNode {
kids: data.map_reference_array("Kids", pdf, NumberTreeNode::from)
.unwrap_or(vec![]),
nums,
upper_limit,
lower_limit,
})
}
}
<filename>src/setting.rs
//设置程序
use std::{cell::RefCell, env::current_exe, process::Command, rc::Rc};
... | Rust | 0 |
128)
} else {
None
}
}
#[inline]
fn from_i16(n: i16) -> Option<Self> {
if n >= 0 {
Some(n as u128)
} else {
None
}
}
#[inline]
fn from_i32(n: i32) -> Option<Self> {... | Rust | 0 |
XED_IFORM_VRSQRT28PD_ZMMf64_MASKmskw_ZMMf64_AVX512ER = 5764,
XED_IFORM_VRSQRT28PS_ZMMf32_MASKmskw_MEMf32_AVX512ER = 5765,
XED_IFORM_VRSQRT28PS_ZMMf32_MASKmskw_ZMMf32_AVX512ER = 5766,
XED_IFORM_VRSQRT28SD_XMMf64_MASKmskw_XMMf64_MEMf64_AVX512ER = 5767,
XED_IFORM_VRSQRT28SD_XMMf64_MASKmskw_XMMf64_XMMf... | Rust | 0 |
,
reference_id: new_record.reference_id,
affected_service: new_record.affected_service,
date: record_date,
summary: new_record.summary,
reporter: new_record.reporter,
reporter_handle: new_record.reporter_handle
};
formed_record.generate_anchor();
let encoded... | Rust | 0 |
, R> DoubleEndedIterator for UncertainChainIter<'a, Octets, R>
where
Octets: AsRef<[u8]>,
R: ToLabelIter<'a>,
{
fn next_back(&mut self) -> Option<Self::Item> {
match *self {
UncertainChainIter::Absolute(ref mut inner) => inner.next_back(),
UncertainChainIter::Relative(ref mut... | Rust | 0 |
import pytest
from ididi import Graph
class B1:
...
class B2:
...
class B3:
...
class B:
def __init__(self, b1: B1, b2: B2, b3: B3):
...
class C1:
...
class C2:
...
class C3:
...
class C:
def __init__(self, c1: C1, c2: C2, c3: C3):
...
class D1:
...... | Python | 1 |
4"
]
for i, cmd in enumerate(commands):
progress.update(task, description=f"Installing PostgreSQL... ({i+1}/{len(commands)})")
self._run_command(cmd, f"PostgreSQL install step {i+1}")
# Create Postg... | Python | 1 |
MediaType::ContentDescriptor => "application/vnd.oci.descriptor.v1+json",
MediaType::OciLayout => "application/vnd.oci.layout.header.v1+json",
MediaType::ImageIndex => "application/vnd.oci.image.index.v1+json",
MediaType::ImageManifest => "application/vnd.oci.image.manifest.v1... | Rust | 0 |
(feature = "stm32f7xx")]
type I2cBmeInstance = BlockingI2c<
I2CInstance,
<I2CInstance as I2cConfig<I2CInstance>>::SclPin,
<I2CInstance as I2cConfig<I2CInstance>>::SdaPin,
>;
#[rtic::app(device = crate::device, peripherals = true, monotonic = rtic::cyccnt::CYCCNT)]
const APP: () = {
struct Resources {
... | Rust | 0 |
., n_k)
batch_size = latent_embed.shape[0]
# permute to (b, n_1, n_2, ...n_k, c)
# then reshape to (b, n_1 * n_2 * ...n_k, out_channels)
latent_embed = latent_embed.permute(0, *self.in_coord_dim_reverse_order, 1).reshape(batch_size, -1, self.fno_hidden_channels)
if self.... | Python | 1 |
#!/usr/bin/env PYTHONHASHSEED=1234 python3
# ------------------------------------------------------------------------------
# animation with move and pause
# ------------------------------------------------------------------------------
def move(period, speed):
for _ in range(period):
yield speed
def pa... | Python | 1 |
def c(o1, o2):
u_cmp = -1 * cmp(o1.get('up', False), o2.get('up', False))
if u_cmp != 0:
return u_cmp
d_cmp = -1 * cmp(o1.get('is_dir', False), o2.get('is_dir', False))
if d_cmp == 0:
return cmp(o1.get('path', '').lower(), o2.get('path', '').lower())
return d_cmp
items.sort(cmp=c)
self.table... | Python | 1 |
one, Serialize, Deserialize)]
pub struct LatLongValue {
pub latitude: i64,
pub longitude: i64,
}
pub trait MfgBatchStore {
/// Adds a mfg_batch to the underlying storage
///
/// # Arguments
///
/// * `mfg_batch` - The mfg_batch to be added
fn add_mfg_batch(&self, mfg_batch: MfgBatch) -... | Rust | 0 |
p_df["qfq_factor"]
temp_df["close"] = temp_df["close"] / temp_df["qfq_factor"]
temp_df["low"] = temp_df["low"] / temp_df["qfq_factor"]
temp_df = temp_df.iloc[:, :-1]
temp_df = temp_df[start_date:end_date]
temp_df["open"] = round(temp_df["open"], 2)
temp_df["high"] = round... | Python | 1 |
print ('MLSA TOGO')
counter = 0
while counter <= 100:
counter +99 | Python | 1 |
mode = quote!(alloc_counter::AllocMode::CountAll);
}
NestedMeta::Meta(meta) if meta.path().is_ident("allow") => {
mode = quote!(alloc_counter::AllocMode::Ignore);
}
NestedMeta::Meta(meta) => {
panic!("Invalid meta argument for... | Rust | 0 |
['live_status'] == 1:
print(f"开播时间: {room_info['live_time']}")
if room_info['description']:
print(f"\n房间简介: {room_info['description']}")
# 显示认证信息
if room_info['new_pendants']['badge']:
... | Python | 1 |
import os
import json
from dotenv import load_dotenv
from spider import HyperliquidSpider
from data_processor import DataProcessor
from notification import NotificationManager
from storage import Storage
# 加载环境变量
load_dotenv()
def main():
print("=== 测试新增的异常检测功能 ===")
# 初始化组件
spider = HyperliquidSpid... | Python | 1 |
on_function_name}")
activation_function = activation_functions[activation_function_name]
# Compute the dot product between X and omega
X_omega = torch.mm(X, omega.t())
# Apply the specified activation function
activation_function = activation_functions[activation_function_name]
Phi = activati... | Python | 1 |
/// Props for [`Indexed`].
#[derive(Prop)]
pub struct IndexedProps<'a, G: GenericNode, T, F>
where
F: Fn(BoundedScopeRef<'_, 'a>, T) -> View<G> + 'a,
{
pub iterable: &'a ReadSignal<Vec<T>>,
pub view: F,
}
/// Non keyed iteration (or keyed by index). Use this instead of directly
/// rendering an array of [... | Rust | 0 |
$(
{
let $d = $d.bin($d.index(&coord.$dimnum).unwrap()).unwrap();
$d
},
)*
),
)
... | Rust | 0 |
81, 0x0000_8080,
];
#[rustfmt::skip]
pub(crate) const RC400: [u16; 20] = [
0x0001, 0x8082, 0x808A, 0x8000,
0x808B, 0x0001, 0x8081, 0x8009,
0x008A, 0x0088, 0x8009, 0x000A,
0x808B, 0x008B, 0x8089, 0x8003,
0x8002, 0x0080, 0x800A, 0x000A,
];
#[rustfmt::skip]
pub(crate) const RC200: [u8; 18] = [
0x01... | Rust | 0 |
# Pizza Order Verification System
# Follow these TODO steps to complete the exercise!
# Problem Description:
# You are working as a developer for "Python Pizza Palace". They need a system
# to verify customer orders against receipt numbers. The system should take two inputs
# from the customer (number of slices and pr... | Python | 1 |
&Config) -> Result<()> {
run_setup_or_teardown("teardown", config).await
}
fn get_stdio() -> Stdio {
match env::var("SIRUN_NO_STDIO") {
Ok(_) => Stdio::null(),
Err(_) => Stdio::inherit(),
}
}
pub(crate) async fn run_cmd(
command_arr: &[String],
env: &HashMap<String, String>,
) -> R... | Rust | 0 |
egl_context: EGLContext,
context_id: ContextID,
context_attributes: &ContextAttributes,
size: &Size2D<i32>)
-> EGLBackedSurface {
let egl_image_attribs = [
EGL... | Rust | 0 |
after() -> TimeSpecifier
= x:number() _ spec:(
minute_suffix() _ { AfterTimeSpecifier::with_minute(x, None) }
/ second_suffix() _ { AfterTimeSpecifier::Second(x) }
/ hour_suffix() _ m:(m:number() _ minute_suffix() _ { m })? { AfterTimeSpecifier::with_hour(x, m) }
) { TimeSpecif... | Rust | 0 |
= "DMA_ENACLR register accessor: an alias for `Reg<DMA_ENACLR_SPEC>`"]
pub type DMA_ENACLR = crate::Reg<dma_enaclr::DMA_ENACLR_SPEC>;
#[doc = "Channel Enable Clear Register"]
pub mod dma_enaclr;
#[doc = "DMA_ALTSET register accessor: an alias for `Reg<DMA_ALTSET_SPEC>`"]
pub type DMA_ALTSET = crate::Reg<dma_altset::DM... | Rust | 0 |
"""
MLP regression on Kin40k data.
Attains about 0.14 RMSE within 150 epochs.
Reference: https://arxiv.org/abs/1511.02222
"""
from __future__ import print_function
import numpy as np
np.random.seed(42)
# Keras
from keras.models import Model
from keras.layers import Input, Dense, Dropout
from keras.optimizers import R... | Python | 1 |
action(turn);
match last_action {
Some(Action::GiveUp) => message!(name, "Give up"),
Some(Action::Pass) => message!(name, "Pass"),
Some(Action::Move(pos)) => message!(name, "Move {}", pos),
None => (),
}
}
fn operation_at(&self, board: &UiBoard, ... | Rust | 0 |
|| other.into_num_set(other_universe, universe).is_failed()
}
}
impl NumDomain for NumericSet {
fn new_gt<D: NumSet>(universe: &[u32],
min: D, min_universe: &D::Universe) -> Self {
let start = universe.binary_search(&min.min_value... | Rust | 0 |
# SPDX-FileCopyrightText: 2019 Dan Halbert for Adafruit Industries
# SPDX-FileCopyrightText: 2019 Scott Shawcroft for Adafruit Industries
#
# SPDX-License-Identifier: MIT
"""
`adafruit_ble_berrymed_pulse_oximeter.adafruit_ble_transparent_uart`
===========================================================================... | Python | 1 |
# Copyright 2024 The Lynx Authors. All rights reserved.
# Licensed under the Apache License Version 2.0 that can be found in the
# LICENSE file in the root directory of this source tree.
from core.utils.log import Log
from plugins.android_ut_plugin import AndroidUTPlugin
from plugins.coverage_check_plugin import Covera... | Python | 1 |
c/opts.rs
/// Options for creating `Engine`
#[derive(Debug, Copy, Clone)]
pub struct EngineOptions {
/// Delimiter of csv
pub delimiter: u8,
/// Indexing buffer, only used at creation. Number of bytes.
pub buf_capacity: usize,
}
impl Default for EngineOptions {
#[inline]
fn default() -> Self {
... | Rust | 0 |
node/fail_if_passed_param_is_wrong_type.rs
// This test checks that #[ockam_node_test_attribute::node] causes a compile time error
// if the function is passed a param that is not of type `ockam::Context`
#[ockam_node_test_attribute::node]
async fn main(ctx: std::string::String) {}
use std::io::Read;
use crate::{read... | Rust | 0 |
s.create(tId=int(user.get("player_id")))
new_player = True
print("[view.yata.login] update player")
player.addKey(p.get("key"))
# player.key = p.get('key')
player.active = True
player.lastActionTS = tsnow()
updatePlayer(player)
... | Python | 1 |
"""empty message
Revision ID: 295e44c2202b
Revises: ec00fcbb3994
Create Date: 2020-12-10 05:14:25.106881
"""
from alembic import op
import sqlalchemy as sa
import sqlalchemy_utils
# revision identifiers, used by Alembic.
revision = '295e44c2202b'
down_revision = '447e39dd5fc2'
def upgrade():
# ### commands a... | Python | 1 |
class Persona:
def __init__(self, nombre, edad):
self.nombre = nombre
self.edad = edad
def imprimir(self):
print(f"Soy {self.nombre} y tengo {self.edad} años.")
class Estudiante(Persona):
def __init__(self, nombre, edad, grado):
super ().__init__(nombre, edad)
... | Python | 1 |
import time
import board
import busio
from analogio import AnalogIn
import adafruit_ds1841
# WIRING:
# 1 Wire connecting VCC to RH to make a voltage divider using the
# internal resistor between RH and RW
# 2 Wire connecting RW to A0
def wiper_voltage(_wiper_pin):
raw_value = _wiper_pin.value
return raw_val... | Python | 1 |
unsafe {
alt_IVehicle_LoadScriptDataFromBase64(
self.0.load(Ordering::Relaxed),
Box::into_raw(Box::new(StringView::new(base64).into())),
)
}
}
pub fn is_destroyed(&self) -> bool {
unsafe { alt_IVehicle_IsDestroyed(self.0.load(Orde... | Rust | 0 |
import threading
import time
def func_1():
while True:
print(f"[{threading.current_thread().name}] Printing this message every 2 seconds")
time.sleep(2)
# initiate the thread with daemon set to True
daemon_thread = threading.Thread(target=func_1, name="daemon-thread", daemon=True)
# or
# daemon_th... | Python | 1 |
# Copyright (C) 2020 FireEye, Inc. All Rights Reserved.
import sys
import inspect
import speakeasy.winenv.arch as _arch
from speakeasy.errors import ApiEmuError
from speakeasy.winenv.api import api
from speakeasy.winenv.api.kernelmode import * # noqa
from speakeasy.winenv.api.usermode import * # noqa
def autoload_a... | Python | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.