text string | label_name string | labels int64 |
|---|---|---|
se_wigle, days_back=days_back)
if use_wigle:
print("🌐 WiGLE API queries ENABLED - this will consume API credits!")
else:
print("🔒 Local analysis only (use --wigle to enable API queries)")
analyzer.parse_all_logs()
results = analyzer.analyze_probes()
if not results:
... | Python | 1 |
dle: PVOID,
Flags: ULONG,
Size: SIZE_T,
) -> PVOID;
fn RtlFreeHeap(
HeapHandle: PVOID,
Flags: ULONG,
BaseAddress: PVOID,
) -> BOOLEAN;
fn RtlSizeHeap(
HeapHandle: PVOID,
Flags: ULONG,
BaseAddress: PVOID,
) -> SIZE_T;
fn RtlZeroHeap(... | Rust | 0 |
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
class OutputFormatter(object):
"""A formatter for PageTestResults.
An OutputFormatter takes PageTestResults, formats the results
(telemetry.value.Val... | Python | 1 |
deConfig<PathBuf>> = context_key!("node_config");
/// Configuration file path for this node. If set, `ConfigManager` will be created.
/// Set by `run` command.
pub const NODE_CONFIG_PATH: ContextKey<String> = context_key!("node_config_path");
/// Services configuration.
/// Set by `generate-config... | Rust | 0 |
#[serde(flatten)]
pub fields: HashMap<String, JsValue>,
}
impl_extra_props!(InvalidNode, fields);
#[cfg(target_os = "windows")]
#[allow(dead_code)]
pub mod bindings {
::windows::include_bindings!();
}
#[cfg(target_os = "windows")]
mod tts;
#[cfg(target_os = "windows")]
pub use tts::tts;
<filename>src/gui... | Rust | 0 |
_with_aux_rand(msg, seckey, &aux_rand)
})
}
#[test]
fn test_schnorrsig_sign_with_rng_verify() {
test_schnorrsig_sign_helper(|secp, msg, seckey, mut rng| {
secp.schnorrsig_sign_with_rng(msg, seckey, &mut rng)
})
}
#[test]
fn test_schnorrsig_sign_verify() {
... | Rust | 0 |
)):
top, left, bottom, right = top_boxes[i]
top = max(0, np.floor(top).astype('int32'))
left = max(0, np.floor(left).astype('int32'))
bottom = min(image.size[1], np.floor(bottom).astype('int32'))
right = min(image.size[0], np.floo... | Python | 1 |
;
use crate::http;
use crate::settings::global_user::GlobalUser;
use crate::settings::target::Target;
pub fn get(target: &Target, user: GlobalUser, id: &str, key: &str) -> Result<(), failure::Error> {
let api_endpoint = format!(
"https://api.cloudflare.com/client/v4/accounts/{}/storage/kv/namespaces/{}/val... | Rust | 0 |
for x in range(1, 111)[::-1]:
num1 = x * 111 ** 3 + 3 * 111 ** 2 + 2 * 111 + 1
num2 = 1 * 211 ** 3 + 7 * 211 ** 2 + x * 211 + 4
if (num1 + num2) % 111 == 0:
print((num1+num2)//111)
| Python | 1 |
: ArrowDataType) -> Expr {
Expr::Cast {
expr: Box::new(expr),
data_type,
}
}
// Arithmetic ops
impl Add for Expr {
type Output = Expr;
fn add(self, rhs: Self) -> Self::Output {
binary_expr(self, Operator::Plus, rhs)
}
}
impl Sub for Expr {
type Output = Expr;
fn s... | Rust | 0 |
"""
图表缓存服务 - 管理图表生成结果的缓存
"""
import hashlib
import json
import logging
from typing import Dict, Any, Optional, List
from datetime import datetime, timedelta
from sqlalchemy.orm import Session
from app.models.placeholder_chart_cache import PlaceholderChartCache
from app.models.template_placeholder import TemplatePlace... | Python | 1 |
"""remove primary autoinc id, now email is primary key
Revision ID: 5ba535d5cc6b
Revises: f5de643accda
Create Date: 2025-04-28 22:46:52.096709
"""
from collections.abc import Sequence
from typing import Union
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision: str = "... | Python | 1 |
unroll!(@$v, $a + 24, 24, $c);
};
(@$v:ident, $a:expr, 49, $c:block) => {
unroll!(@$v, $a, 48, $c);
{ const $v: usize = $a + 48; $c }
};
(@$v:ident, $a:expr, 50, $c:block) => {
unroll!(@$v, $a, 25, $c);
unroll!(@$v, $a + 25, 25, $c);
};
(@$v:ident, $a:expr, ... | Rust | 0 |
for num in range(770000, -1000000, -1):
summ_del = 0
cnt_del = 0
for delitel in range(1, num//2):
if num%delitel==0:
summ_del += delitel
cnt_del += 1
A = int(summ_del/cnt_del)
if str(A)[-2:]=='12':
print(num, A)
| Python | 1 |
come/attachment.txt").run(&handler);
let x_request_id_header = conn.inner().response_headers().get_str("x-request-id");
assert!(x_request_id_header.is_some());
}
#[test]
fn should_add_trailing_slash_for_posts() {
let handler = app();
let conn = get("/posts/welcome").run(&handler);
assert_status!(c... | Rust | 0 |
of = Zkp::from_bytes(&serialised_proof);
assert!(deseriliased_proof.is_some());
assert!(deseriliased_proof
.unwrap()
.verify(&ciphertext, &share, &keypair.public_key));
}
}
<gh_stars>0
//! # Bits Vector
//!
//! Plain Bits Vector [Wiki](https://en.wikipedia.org/wiki/Bit_array... | Rust | 0 |
me,
description: managed_device.description,
agent: crate::domain::ManagedDeviceAgent::Id(managed_device.agent_id),
snmp_protocol_attributes: crate::domain::SnmpProtocolAttributes::try_from(
managed_device.snmp_protocol_attributes,
)?,
})
}
}
... | Rust | 0 |
from typing import Tuple
import pykokkos as pk
from parse_args import parse_args
@pk.workload
class Workload:
def __init__(self, N: int, M: int, nrepeat: int, fill: bool):
self.N: int = N
self.M: int = M
self.nrepeat: int = nrepeat
self.y: pk.View1D[pk.double] = pk.View([N], pk.d... | Python | 1 |
, projection='3d')
ax2 = fig.add_subplot(222, projection='3d')
ax3 = fig.add_subplot(223)
ax4 = fig.add_subplot(224)
coils_initial.plot(ax=ax1, show=False)
tracing_initial.plot(ax=ax1, show=False)
for i, trajectory in enumerate(tracing_initial.trajectories):
ax3.plot(jnp.sqrt(trajectory[:,0]**2+trajectory[:,1]**2)... | Python | 1 |
_authorities.clone(),
next_authorities,
next_authority_accounts.clone(),
next_authority_accounts,
true,
);
// If there's a next key we immediately create a refresh proposal
// to sign our own key as a means of jumpstarting the mechanism.
if let Some(pub_key) = next_pub_key {
RefreshInPro... | Rust | 0 |
start + 1) {
if rng.end < m.start() {
break;
}
rng = m.range();
}
Some(rng)
}
pub fn partition_re<'a>(re: &Regex, text: &'a str) -> Option<(&'a str, &'a str, &'a str)> {
if let Some(caps) = re.captures(text) {
if let Some(elm) = caps.get(0) {
let star... | Rust | 0 |
import yaml # For config loading
from extractors import QualysExtractor, TenableExtractor, Rapid7Extractor
from normalizer import DataNormalizer
from pattern_engine import PatternDetectionEngine
from priority_adjuster import PriorityAdjuster
from dashboard import Dashboard
def load_config(file_path):
with open(fi... | Python | 1 |
tute the operator with this identifier and then patch
// it back *after* we generate the string.
// The problem is that someone, somewhere might have
// an identifer that is this... We hope and pray.
//
// This is also the reason we prefer !(x === y) to x !== y ..
// too much patching.
// no field names have anything ... | Rust | 0 |
(storage: &mut dyn Storage) -> Singleton<State> {
singleton(storage, CONFIG_KEY)
}
pub fn config_read(storage: &dyn Storage) -> ReadonlySingleton<State> {
singleton_read(storage, CONFIG_KEY)
}
pub fn join_proposals(storage: &mut dyn Storage) -> Bucket<JoinProposal> {
bucket(storage, JOIN_PROPOSAL_KEY)
}
... | Rust | 0 |
"天赋「袖火百景图」应用层数",
config: ItemConfigType::Float { min: 0.0, max: 10.0, default: 8.0 }
}
]);
#[cfg(not(target_family = "wasm"))]
const CONFIG_SKILL: Option<&'static [ItemConfig]> = Some(&[
ItemConfig {
name: "after_e",
title: "庭火焰硝",
config: Ite... | Rust | 0 |
t _ = fs::remove_file("flowtop.map");
}
#[test]
fn top() {
let packets = vec![
// TCP 192.168.0.123:200 -> 10.10.0.42:80
vec![
/*Dst MAC*/ 0x52, 0x54, 0x00, 0x02, 0x02, 0x02,
/*Src MAC*/ 0x52, 0x54, 0x00, 0x01, 0x01, 0x01,
... | Rust | 0 |
{
use rand_core::OsRng;
use scalar::Scalar;
use constants;
use edwards::CompressedEdwardsY;
use traits::{Identity};
use super::*;
}
use tui::{
backend::Backend,
layout::{Alignment, Constraint, Direction, Layout, Rect},
style::{Color, Modifier, Style},
text::{Span, Spans, Text}... | Rust | 0 |
_file_path4, edf_file_name4))
edf_file.load()
edf_file.calculate_signal_stats()
# Export to CSV
edf_file.edf_signals.output_dir = "./exports/edf_stats/"
edf_file.edf_signals.export_sig_stats_to_csv()
edf_file.edf_signals.export_sig_stats_to_csv(str(Path("signal_stats.csv")))
# Export to a ... | Python | 1 |
::ConnectOptionsBuilder::new();
conn_opts.user_name(args.user);
conn_opts.password(token.clone());
conn_opts.keep_alive_interval(Duration::from_secs(30));
conn_opts.automatic_reconnect(Duration::from_millis(100), Duration::from_secs(5));
if !args.disable_tls {
let ca = args
.ca_... | Rust | 0 |
<EcdsaDealing, MultiSignature<EcdsaDealing>>> for IDkgMultiSignedDealing {
fn from(signed: Signed<EcdsaDealing, MultiSignature<EcdsaDealing>>) -> Self {
// This drops any duplicates in the signers.
let signers: BTreeSet<NodeId> = signed.signature.signers.into_iter().collect();
Self {
... | Rust | 0 |
ine(always)]
pub(crate) fn new(bits: bool) -> Self {
FB_0_INTR_POL_R(crate::FieldReader::new(bits))
}
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> FB_0_INTR_POL_A {
match self.bits {
false => FB_0_INTR_POL_A::LOW_FALL,
t... | Rust | 0 |
unwrap().path();
// If not a dSYM dir, try next entry.
if dir.extension() != Some(std::ffi::OsStr::new("dSYM")) {
continue;
}
if let Some(debug_file_name) = try_match_dsym(&dir, uuid) {
return Some(debug_file_name);
}
}
None
}
fn try_match_dsym... | Rust | 0 |
-|2\xe2\x143\xe1_+\xf3_\xef\
g\xc9\xf0\xc7\xf3\x82\x9a\x9a\x91\xf28\xb5d\xb4\xf3\xfc\
\x94\xbf1\xe3\xf2\x9f\xefW\xca\xff\x00\xca7=\xf9\xc1\
^\x9aT\xc34\xf0\xfc\xbc\x1f%\x15N\x1f\xe7|\x95\
\x1d%\x1c\xdf3\xf2\xf5\x5cI\xf9\xca\x7f\xf2\xa6\xbc0\
\xda\xe9\xa5\xff\x00\x98\x92A\xfao\x9e\xf9\xbcZo\xf7\
\x9f\x9e\xfc\xe5{\xf2\xa... | Python | 1 |
The buffer is read-only with no checksum. This flag is intended for sending header information to the security package for computing the checksum.
/// The package can read this buffer, but cannot modify it.
ReadOnly = 0x8000_0000,
/// The buffer is read-only with a checksum.
ReadOnlyWithChecksum = 0x10... | Rust | 0 |
in zip([1, 2, 4, 8], outs):
self.assertEqual(out.shape,
(1, 96 * stride, 56 // stride, 56 // stride))
# test residual_pooling = False
cfg = deepcopy(self.cfg)
cfg['out_scales'] = (0, 1, 2, 3)
cfg['residual_pooling'] = False
model = MViT(... | Python | 1 |
Some(default_handler),
/* FPU */ Some(default_handler),
None,
None,
None,
None,
None,
None,
/* LCD_TFT */ Some(default_handler),
/* LCD_TFT_1 */ Some(default_handler),
];
extern "C" fn default_handler() {
asm::bkpt();
}use itertools::Itertools;
use num_intege... | Rust | 0 |
test)]
mod tests {
use crate::groups::G_1024;
use crate::utils::compute_k;
use sha1::Sha1;
#[test]
fn test_k_1024_sha1() {
let k = compute_k::<Sha1>(&G_1024).to_bytes_be();
assert_eq!(&k, include_bytes!("test/k_sha1_1024.bin"));
}
}
<filename>src/wire/framing.rs
//! A framing wr... | Rust | 0 |
do_compute' function in
//our wasm module.
//Because wasm function cannot take (point1, point2) as input args so
//we have to indirectly using call_stub
//call_stub takes the do_compute's args as its args, then returns whatever
//do_compute will return
let result: Rect/* It is very important t... | Rust | 0 |
from django.shortcuts import render
# Create your views here.
from django.http import HttpResponse, HttpResponseRedirect
import sys
from .forms import NameForm
class Entry(object):
def __init__(self, key, val):
self.key = key
self.val = val
def __unicode__(self):
return u'%s:%s' % (... | Python | 1 |
ls!(@single $rest)),*]));
($($key:expr => $value:expr,)+) => { labels!($($key => $value),+) };
($($key:expr => $value:expr),*) => {
{
let _cap = labels!(@count $($key),*);
let mut _map: ::std::collections::HashMap<String, ::std::sync::Arc<String>> = ::std::collections::HashMap::... | Rust | 0 |
__"])
saved_exit_vnums = set(x[0] for x in data["exits"])
if saved_exit_vnums != set(x.vnum for x in loc.exits.values()):
raise TaleError("exits mismatch for location vnum " + str(loc.vnum))
# we only set a few things from the saved game data for a location
# most importantly... | Python | 1 |
let mut resp = Response::new("1234567890".into());
*resp.status_mut() = StatusCode::PARTIAL_CONTENT;
resp.headers_mut().insert(
CONTENT_RANGE,
"bytes 157286390-157286399/157286400".parse().unwrap(),
);
... | Rust | 0 |
rence of genesis utxo.
let ref_utxo = <UnspentOutputsFinder<Test>>::get(root_key_pair.public());
assert!(ref_utxo.is_none());
// get new transaction.
let act_gen_out2 = <UnspentOutputs<Test>>::get((hash(new_signed_tx.payload().as_ref().unwrap()), 0));
assert!(act_gen_out2.is_some());
assert_eq!(new_signed_... | Rust | 0 |
, Manager},
};
#[derive(Error, Debug)]
pub enum StartCommandError {
#[error("Unable to load configuration file")]
ConfigFileError,
#[error("HTTP server error: {0}")]
HttpServerError(ServerError),
#[error("Persistence error: {0}")]
PersistenceError(PersistenceError),
}
#[derive(StructOpt)]
pub ... | Rust | 0 |
cess_sequences(
//! sequence_count: usize,
//! sequences: *const SequenceParameters,
//! ) -> SequenceResult {
//! // ...
//! # SequenceResult::Red
//! }
//! }
//!
//! /// Our abstraction of `libfoo::process_sequences()`, in which we only
//! /// ever work with `f32` data.
//! pu... | Rust | 0 |
import numpy as np
def greedy_dtw_path(x, y, warp, dist=lambda x, y: np.linalg.norm(x - y)):
if np.ndim(x) == 1:
x = x.reshape(-1, 1)
if np.ndim(y) == 1:
y = y.reshape(-1, 1)
nrows, ncols = x.shape[0], y.shape[0]
ridx, cidx, rpath, cpath = 0, 0, [0], [0]
while ridx < nrows - 1 and ... | Python | 1 |
from pydantic import BaseModel,ConfigDict
from typing import Optional
from datetime import date
class UserPageInfoBase(BaseModel):
full_name: Optional[str]
date_of_birth: Optional[date]
gender: Optional[bool]
smoking: Optional[bool]
pet: Optional[bool]
ppurl: Optional[str]
about: Optional[s... | Python | 1 |
(Some(self.scope.clone().into()));
child.as_scoped().resolved.set(false);
self.children
.borrow_mut()
.push(std::mem::transmute::<&Scoped, &'static Scoped>(
child.as_scoped(),
));
}
pub fn clear_scope(&self) {
self.scope.clear_vars();
... | Rust | 0 |
f watched_indicators == 1:
if from_playback == 'true' and trakt_official_status(media_type) == False: sleep(1000)
elif not trakt_watched_status_mark(action, media_type, tmdb_id, tvdb_id, season, episode): return notification(32574)
clear_trakt_collection_watchlist_data('watchlist', 'tvshow')
watched_status_mark(... | Python | 1 |
from dataclasses import dataclass, field
from typing import List, Optional
class ASTNode:
"""Base class for all AST nodes."""
pass
@dataclass
class Column(ASTNode):
name: str
def __str__(self):
if not isinstance(self.name, str) and self.name != "*":
raise ValueError(
... | Python | 1 |
def count_case(s):
return sum(1 for c in s if c.isupper()), sum(1 for c in s if c.islower())
print(count_case("HelloWorld"))
| Python | 1 |
= dtor_predicates.predicates.get_slice(subst::TypeSpace);
for predicate in predicates {
// (We do not need to worry about deep analysis of type
// expressions etc because the Drop impls are already forced
// to take on a structure that is roughly a alpha-renaming of
// the generic pa... | Rust | 0 |
# Generated by Django 5.1.9 on 2025-09-24 14:30
from django.db import migrations, models
from django.utils import timezone
def set_initial_modified_at(apps, schema_editor):
StationLink = apps.get_model('core', 'StationLink')
# Set all existing records to current time
StationLink.objects.update(modified_... | Python | 1 |
def getTrend(node):
data = node.getData()
slopes = []
print(node)
for i in range(0, len(data)-2):
p1 = data[i]
p2 = data[i+1]
slopes.append(p2 - p1)
return sum(slopes) / len(slopes)
| Python | 1 |
, axis=1)
w[idx] /= np.sum(w[idx])
# M-step: update p and lamb
w_sum = np.sum(w, axis=0) # shape: (10,)
lamb = w_sum / image_length
p = np.dot(w.T, images) / (w_sum.reshape(10, 1)) # shape: (10, 28*28)
# p[p == 0] = 1e-10
mapping = list(range(10))
... | Python | 1 |
<u64>) -> f64 {
let threads = thread_count(cores);
let mut children = vec![];
let iterations: u64 = samples / threads;
for _ in 0..threads {
children.push(thread::spawn(move || -> u64 {
(0..iterations).fold(0, |hits, _| hits + RFloats::new().in_circle())
}));
}
let m... | Rust | 0 |
) -> HRESULT,
fn GetPropertyDescriptionList(
keyType: REFPROPERTYKEY,
riid: REFIID,
ppv: *mut *mut c_void,
) -> HRESULT,
fn GetAttributes(
AttribFlags: SIATTRIBFLAGS,
sfgaoMask: SFGAOF,
psfgaoAttribs: *mut SFGAOF,
) -> HRESULT,
fn GetCount(
pdw... | Rust | 0 |
$)', labelpad=10)
ax.set_ylabel("Peak Count", labelpad=10)
def plot_peaks(peak_count, file_name, threshold, first, title=0, n_angles=72):
import matplotlib.pyplot as plt
fig = plt.figure(2, figsize=(5,4))
_plot_peaks(fig, peak_count, threshold, first, title, n_angles=n_angles)
plt.savefig(file_name)
plt.cl... | Python | 1 |
return 'PACKAGED_GSUTIL_INSTALLS_DO_NOT_HAVE_CHECKSUMS'
m = md5()
# Checksum gsutil and all .py files under gslib directory.
files_to_checksum = [gslib.GSUTIL_PATH]
for root, _, files in os.walk(gslib.GSLIB_DIR):
for filepath in files:
if filepath.endswith('.py'):
files_to_... | Python | 1 |
import json
import os
def split_data(data, percent_train, percent_valid, folder_out):
data_test = []
data_train = []
data_valid = []
num_vul, num_non_vul, total, data_vul, data_non_vul = count_data(data)
num_vul_train = int((percent_train / 100) * num_vul)
num_non_vul_train = int((percent_tra... | Python | 1 |
print("hey, ran posttest script");
| Python | 1 |
new()
.add_submessage(msg)
.add_attribute("action", "execute_rotate_user_key"))
}
pub fn execute_update_guardians(
deps: DepsMut,
env: Env,
info: MessageInfo,
guardians: Guardians,
new_multisig_code_id: Option<u64>,
) -> Result<Response, ContractError> {
// ensure this is either... | Rust | 0 |
print(e)
logging.exception("unikey: %s" % unikey)
logging.exception(unikey_json_data)
logging.exception(e)
like_count = 0
json_data[unikey] = {}
json_data[unikey][QzoneExporter.LIKE_COUNT_KEY] = unikey_json_data
if like_count <= 0:
... | Python | 1 |
class TreeNode:
def __init__(self, val=0, left=None, right=None):
self.val = val
self.left = left
self.right = right
def maxDepth(root):
if not root:
return 0
# Recursively calculate the depth of the left and right subtrees
left_depth = maxDepth(root.left)
right... | Python | 1 |
from __future__ import absolute_import, division, print_function
import os
import numpy as np
import PIL.Image as pil
from imageio import imread
from scipy.io import loadmat
import torch
import torch.utils.data as data
from torchvision import transforms
from .mono_dataset import MonoDataset
class PreprocessedDatas... | Python | 1 |
fn encrypt_point_return_r<R>(
&self,
message: &G,
rng: &mut R,
) -> (Ciphertext<G>, G::CorrespondingScalar)
where
R: RngCore + CryptoRng,
{
let r = G::CorrespondingScalar::random(rng);
(self.encrypt_point_with_r(message, &r), r)
}
// Given a `messag... | Rust | 0 |
_event(Event::DeviceEvent {
device_id,
event: Motion { axis: 1, value: y },
});
}
if x != 0.0 || y != 0.0 {
subclass_input.send_event(Event::DeviceEvent {
device_id,
event: MouseMotion { delta: (x, y) },
});
}
}
if util::has_fla... | Rust | 0 |
# (python /tmp/sploit.py; cat;) | /levels/lab04/lab4B
#
# PASS: fg3ts_d0e5n7_m4k3_y0u_1nv1nc1bl3
#
import struct
# lab4B@warzone:/levels/lab04$ readelf --relocs ./lab4B
# --snip--
# Relocation section '.rel.plt' at offset 0x4cc contains 6 entries:
# Offset Info Type Sym.Value Sym. Name
# 080499ac ... | Python | 1 |
*, SeekFrom }, mem::{ size_of, transmute }, path::{ Path }, sync::Arc };
use vulkano::{
buffer::{ BufferAccess, BufferUsage, CpuAccessibleBuffer, CpuBufferPool, ImmutableBuffer },
descriptor::descriptor_set::PersistentDescriptorSet,
device::{ Device, Queue },
sync::GpuFuture,
};
pub fn from_nice_model(
device: Ar... | Rust | 0 |
= DWORD(0)
_WTSEnumerateProcessesW(hServer, 0, 1, byref(pProcessInfo), byref(Count))
return pProcessInfo, Count.value
WTSEnumerateProcesses = DefaultStringType(WTSEnumerateProcessesA, WTSEnumerateProcessesW)
# BOOL WTSTerminateProcess(
# __in HANDLE hServer,
# __in DWORD ProcessId,
# __in DWORD Exit... | Python | 1 |
from fastapi import APIRouter, Depends
from fastapi_filter import FilterDepends
from fastapi_pagination import Page
from harbinger import crud, filters, models, schemas
from harbinger.config.dependencies import current_active_user, get_db
from sqlalchemy.ext.asyncio import AsyncSession
router = APIRouter()
@router.g... | Python | 1 |
0.1));
println!("Group: {}\n\t{}", str_at(refs.1.0), str_at(refs.1.1));
println!("Attributes:");
for i in 0..4 {
let attr = attr_str(i, attr_idx(i, cfi.attr(i), attrs), refs);
println!("\t{}", attr_header_str(i, refs));
println!("\t\t[... | Rust | 0 |
.next_value()?)
},
Field::InstanceType => {
if maybe_instance_type.is_some() {
return Err(DeError::duplicate_field(INSTANCE_TYPE));
}
maybe_instance_type= S... | Rust | 0 |
_bytes().to_owned()).hexdigest(),
~"331c9bf4d7dc8ad7e9bab2f566c8612042a9f4e2"
)
}
#[test]
fn test_hmac_sha256() {
assert_eq!(
hmac_sha256("my key".as_bytes().to_owned(), "some data to hmac".as_bytes().to_owned()).hexdigest(),
~"17764a8a2e8c23ae3b9e1781c5ebeb5754c7920806021032e9133051e10118be"
);
}
... | Rust | 0 |
let message = NetlinkMessage::read(&buf[offset..])?;
offset += align_to(message.header.nlmsg_len as usize, NLMSG_ALIGNTO as usize);
multipart = message.header.nlmsg_flags & NLM_F_MULTI as u16 != 0;
match message.header.nlmsg_type as i32 {
NLMSG_ERROR... | Rust | 0 |
: u32,
framebuffer: vk::Framebuffer,
pub position: FrameBufferAttachment,
pub normal: FrameBufferAttachment,
pub albedo: FrameBufferAttachment,
pub metallic_roughness: FrameBufferAttachment,
pub depth: FrameBufferAttachment,
render_pass: vk::RenderPass
}
pub struct DefferedRenderingSystem {... | Rust | 0 |
import os
import numpy as np
# —————————— Copy class Neural from snake_dqn.py ——————————
class Node:
def __init__(self, val):
self.val = val.astype(np.float32, copy=False)
self.grad = np.zeros_like(self.val, dtype=np.float32)
def zero_grad(self):
self.grad.fill(0.)
class Layer:
de... | Python | 1 |
import cirq
from cirq.contrib.svg import circuit_to_svg
a, b, c = cirq.LineQubit.range(3)
circuit = cirq.Circuit(
cirq.H(a),
cirq.CNOT(a, b),
cirq.CNOT(b, c),
cirq.X(a),
cirq.Y(b),
cirq.Z(c),
cirq.measure(a, b, c)
)
# Convertendo o circuito para SVG
svg_string = circuit_to_svg(circuit)
# ... | Python | 1 |
TED)
async def create_record(
payload: MedicalRecordCreate,
db: Session = Depends(get_db),
current_user=Depends(get_current_user_flexible),
):
"""Create a new medical record"""
try:
print(f"Creating medical record for patient {payload.patient_id}")
print(f"Record data: {payload.dict(... | Python | 1 |
]).spanned_unknown();
let path = ColumnPath::build(&raw_column_path);
match &values.get_data_by_column_path(&path, Box::new(move |_, _, error| error)) {
Ok(x) => {
row.insert_value(
rest.get(current_numbered_column)... | Rust | 0 |
.0, 4.0],
[5.0, 6.0, 7.0, 8.0],
[9.0, 10.0, 11.0, 12.0],
[13.0, 14.0, 15.0, 16.0],
]
};
let m1 = Mat4 {
m: [
[13.0, 14.0, 15.0, 16.0],
[9.0, 10.0, 11.0, 12.0],
[5.0, 6.0, 7... | Rust | 0 |
etter::FlipVertical(_) => 6,
PropertySetter::Layer(_) => 7,
};
if imgui::ComboBox::new(im_str!("Property Type")).build_simple_string(
ui,
&mut current_property_position,
&property_types,
) {
*property = match current_property_position {
0 => PropertySetter... | Rust | 0 |
"""Read component from a numpy.ndarray."""
from __future__ import annotations
from typing import Any, cast
import numpy as np
import numpy.typing as npt
import gdsfactory as gf
from gdsfactory.boolean import boolean
from gdsfactory.component import Component
from gdsfactory.typings import PathType
def compute_are... | Python | 1 |
f response.status_code == 204:
res = {"success": True}
return make_response(res, 200)
elif response.status_code == 404:
res = {"success": False, "message": "Policy not found"}
return make_response(res, 404)
except StoreApiResponseErrorList as error_list:
... | Python | 1 |
pub fn get_pixel(&self, position: Vec2<usize>) -> &Pixel where Pixel: Sync {
&self.pixels[self.compute_pixel_index(position)]
}
/// Update a pixel of a `PixelVec<T>` image.
/// Can usually be used as a function reference instead of calling it directly.
#[inline]
pub fn set_pixel(&mut self, ... | Rust | 0 |
regions.detach()
cap_words = cap_words.detach()
batch_t2i_relation, batch_i2t_relation, batch_t2i_mean, batch_i2t_mean = self.adj_learning(img_regions,
cap_words,
... | Python | 1 |
bled, initialise VTOR to the start of the vector table. This is normally initialised
// by a bootloader when the non-reset value is required, but some bootloaders do not set it,
// leading to frustrating issues where everything seems to work but interrupts are never
// handled. The VTOR register is optional... | Rust | 0 |
91889e+0],
[-7.50170246e+0, -1.05535011e+0],
[-7.11793828e+0, -9.34389912e-1],
[-6.73417410e+0, -8.15533185e-1],
[-6.35040992e+0, -6.99431372e-1],
[-5.96664573e+0, -5.86941458e-1],
[-5.58288155e+0, -4.79186280e-1],
[-5.19911737e+0, -3.77621880e-1],
[-4.81535319e+0, -2.84095996e-1],
[-4.43158901e+0, -2... | Rust | 0 |
nsfer knowledge
# form the previous solution.
if hnet is not None and config.init_with_prev_emb and j > 0:
last_emb = hnet.get_task_emb(j-1).detach().clone()
hnet.get_task_emb(j).data = last_emb
# Training from scratch -- create new network instance!
# -> No tran... | Python | 1 |
te, Failure, PolishStatus, PrimalInfeasibilityCertificate, Solution,
Status,
};
#[allow(non_camel_case_types)]
type float = f64;
// Ensure osqp_int is the same size as usize/isize.
#[allow(dead_code)]
fn assert_osqp_int_size() {
let _osqp_int_must_be_usize = ::std::mem::transmute::<ffi::osqp_int, usize>;
}
m... | Rust | 0 |
}
let timestamp = NaiveDateTime::from_timestamp(secs, 0);
data += &Row(timestamp, 0, total).to_string();
} else if prev == Some(value) {
continue;
}
data += &Row(timestamp, value, total).to_string();
prev = ... | Rust | 0 |
# -*- coding: utf-8 -*-
from django.db import models, migrations
import django.core.validators
class Migration(migrations.Migration):
dependencies = [
('userprofile', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='Course',
fields=[
... | Python | 1 |
[inline]
#[target_feature(enable = "msa")]
#[cfg_attr(test, assert_instr(subv.w))]
pub unsafe fn __msa_subv_w(a: v4i32, b: v4i32) -> v4i32 {
msa_subv_w(a, mem::transmute(b))
}
/// Vector Subtract
///
/// The elements in vector `b` (two signed 64-bit integer numbers)
/// are subtracted from the elements in vector `... | Rust | 0 |
, status, fmt="text"):
if fmt == 'text':
print " --> %s (%s): %s" % (kubsource.name, kubsource.kind, colorize(status))
dest = os.path.join(dest, self.name, self.version)
mkdir_p(dest)
table = []
results = []
if fmt == "text":
print "%s %s ... | Python | 1 |
(y_test, y_pred, average='macro'))
acc_l.append(metrics.accuracy_score(y_test, y_pred))
f1.append(metrics.f1_score(y_test, y_pred, average='macro' ))
rec.append(metrics.recall_score(y_test, y_pred, average='macro' ))
# dom2
y_pred_dom2 = y_pred_dom2.cpu().detach()
report_dom2 = metrics.classifi... | Python | 1 |
scope_3305.string(var_3306);
}
#[allow(unused_mut)]
let mut scope_3307 = writer.prefix("ScheduledInstanceId");
if let Some(var_3308) = &input.scheduled_instance_ids {
let mut list_3310 = scope_3307.start_list(true, Some("ScheduledInstanceId"));
for item_3309 in var_3308 {
#[a... | Rust | 0 |
or) -> Self {
match err {
HostError::Add(host_id, e) => {
tracing::error!("cannot add host '{}': {}", host_id, e);
HostHandlerError::CannotAddHost(host_id)
}
HostError::Find(host_id, e @ sqlx::Error::RowNotFound) => {
tracing::e... | Rust | 0 |
f.pos_config_id._update_access_token()
@api.depends('pos_self_ordering_mode')
def _compute_pos_pricelist_id(self):
super()._compute_pos_pricelist_id()
for res_config in self:
if res_config.pos_self_ordering_mode == 'kiosk':
currency_id = res_config.pos_journal_id.cur... | Python | 1 |
#!/usr/bin/env python3
from IdToName import *
from IdFromString import *
import numpy as np
def GetIds(ids):
"""GetIds - Output IDs from a given list of IDs, strings representing
MATLAB-like integer ranges, and test names
The test names can be any string or substring present in the test's name
(fi... | Python | 1 |
MAIN_COLOR, [1.0; 4]);
text_widget.set_color(CONFIG_TEXT_COLOR, [0.75, 0.25, 1.0, 1.0]);
self.pushrod.borrow_mut().add_widget_to_parent_by_name(
"MainContainerWidget",
"TextWidget",
Box::new(text_widget),
);
let mut timer = TimerWidget::new();
... | Rust | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.