text string | label_name string | labels int64 |
|---|---|---|
ReadStorage<'a, Blob>,
WriteStorage<'a, Position>,
WriteStorage<'a, WantsToMelee>,
);
/// Scans through the entities looking for blobs
/// Blobs in attacking range will hit the player
/// Blobs in visual range will move toward the player
fn run(&mut self, data: Self::SystemData) {
... | Rust | 0 |
for k in range(len(self.dvfe_mlps)):
x = self.dvfe_mlps[k](x)
x_max = torch_scatter.scatter_max(x, inverse_indices, dim=0)[0]
if k == len(self.dvfe_mlps) - 1:
x = x_max
else:
x = torch.cat([x, x_max[inverse... | Python | 1 |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Tests for the angles module.
"""
import math
import numpy as np
def sector_area(a, eps, phi, r):
aux = r * np.cos(phi) / a
saux = aux / abs(aux)
if abs(aux) >= 1.0:
aux = saux
return abs(a**2 * (1.0 - eps) / 2.0 * math.acos(... | Python | 1 |
sides(tile_1, &tile_1_sides, &tile_2);
if let Some((side_1, _kind, mutated_tile_2)) = maybe_match {
let pos_2 = *pos_1 + side_1.point_delta();
matched_tiles_to_add.push((pos_2, mutated_tile_2));
break;
} else {
... | Rust | 0 |
lver_filename)
style_solver.net.copy_from(style_weights)
scratch_style_solver_filename = solver(end_to_end_net, base_lr=base_lr)
scratch_style_solver = caffe.get_solver(scratch_style_solver_filename)
scratch_style_solver.net.copy_from(scratch_style_weights)
print 'Running solvers for %d iterations...' % niter
solvers... | Python | 1 |
= aws_smithy_query::QueryWriter::new(&mut out, "ImportKeyPair", "2016-11-15");
#[allow(unused_mut)]
let mut scope_4572 = writer.prefix("DryRun");
if let Some(var_4573) = &input.dry_run {
scope_4572.boolean(*var_4573);
}
#[allow(unused_mut)]
let mut scope_4574 = writer.prefix("KeyName");
... | Rust | 0 |
}
}
pub fn complex(&mut self) -> Result<()> {
let top = self.entry(0)?;
if let Value::Complex(value) = top {
// If a complex number is on the top of the stack, break it into
// real and imaginary parts.
let mut items = Vec::new();
items.push(store(Value::Number(value.real_part().clone()))?);
items... | Rust | 0 |
access: &A,
) -> SyncResult<Self::Accumulator, A> {
let dapp_contract_address = initial_state;
let contract = access
.build_sync_contract(
*dapp_contract_address,
block.number,
OutputFacet::new,
)
.await;
... | Rust | 0 |
rogram_id);
token::set_authority(
ctx.accounts.into_set_authority_context(),
AuthorityType::AccountOwner,
Some(vault_authority),
)?;
token::transfer(
ctx.accounts.into_transfer_to_pda_context(),
ctx.accounts.escrow_account.initializer... | Rust | 0 |
return Ok(p);
},
Err(_)=>{
return Err("failed-parse_response");
}
}
}
#[derive(Debug)]
pub struct READ {
pub result:bool,
pub code:u16,
pub message:String,
pub features:Vec<Feature>
}
#[derive(Debug)]
pub struct Feature {
pub result:bool,
pub c... | Rust | 0 |
rial(test_mat(
stripe_pattern(RGB::white(), RGB::black()),
identity(),
));
let c1 = s.material_colour_at(point(1.5, 0.0, 0.0));
let c2 = s.material_colour_at(point(2.5, 0.0, 0.0));
assert_eq!(c1, RGB::white());
assert_eq!(c2, RGB::black());
}
#[test]
fn stripes_with_a_pattern_trans... | Rust | 0 |
import json
import re
import pandas as pd
def parse_json_from_response(row):
"""
Parse the JSON object from the model's response.
Use this function with a pandas DataFrame and the apply method.
"""
text = row["promptllm_answer"]
# Between <|start_header_id|>assistant<|end_header_id|> and <|eo... | Python | 1 |
class Board:
def __init__(self):
self.list = [str(i) for i in range(1, 10)]
def DisplayBoard(self):
for i in range (0,9,3):
print(" | ".join(self.list[i:i+3]))
if i<6:
print("__"*5)
def resetBoard(self):
self.list=[str(i) for i in range(1,10)... | Python | 1 |
JLink.exe",
r"C:\Program Files (x86)\SEGGER\JLink_V862\JLink.exe"
]
jlink_exe = None
for path in jlink_paths:
if Path(path).exists():
jlink_exe = path
break
if not jlink_exe:
print("未找到 J-Link 可执行文件,请确保已安装 J-Link 软件")
print("尝试的路径:")
for ... | Python | 1 |
# SPDX-License-Identifier: MPL-2.0
# Copyright 2020-2025 John Mille <john@compose-x.io>
from __future__ import annotations
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from ecs_composex.ecs.ecs_family import ComposeFamily
from ecs_composex.common.settings import ComposeXSettings
from troposphere imp... | Python | 1 |
VkBufferUsageFlagBits_VK_BUFFER_USAGE_CONDITIONAL_RENDERING_BIT_EXT:
VkBufferUsageFlagBits = 512;
pub const VkBufferUsageFlagBits_VK_BUFFER_USAGE_ACCELERATION_STRUCTURE_BUILD_INPUT_READ_ONLY_BIT_KHR : VkBufferUsageFlagBits = 524288 ;
pub const VkBufferUsageFlagBits_VK_BUFFER_USAGE_ACCELERATION_STRUCTURE_STORAGE_BI... | Rust | 0 |
#################################################################
#
# File Name : A3Q4.py
# Description : problems on N Numbers -> Find Minimum
# Name : Pradhumnya Changdev Kalsait
# Date : 09/06/2025
#
#################################################################
"""
Input : Number of elem... | Python | 1 |
from kybra import blob, nat, null, Opt, Principal, Record, Variant, Vec
# TODO type aliases do not work yet
# TODO many canister_id fields need to be changed to use this alias
# CanisterId = Principal
# WasmModule = blob
class CreateCanisterArgs(Record):
settings: Opt["CanisterSettings"]
class CanisterSettings... | Python | 1 |
#!/usr/bin/env python
"""Runs lint over the given files in exercises.
The khan-linter looks for the magic file tools/runlint.py at
pre-commit time (using a git or hg pre-commit hook), and passes in the
files-to-be-committed to runlint.py. If it fails, it aborts the
commit.
We use this to make sure that only lint-cl... | Python | 1 |
fabric.barrier()
data_module.set_epoch(epoch)
with fabric.rank_zero_first():
data_module.setup()
train_dataloader = data_module.train_dataloader()
train_dataloader = fabric.setup_dataloaders(
train_dataloader,
use_distributed_sampler=False,
move_to_de... | Python | 1 |
loudness.into()),
speechiness: Range::new(None, None, self.speechiness.into()),
valence: Range::new(None, None, self.valence.into()),
}
}
}
#[derive(Clone, Copy, Debug, Default, Data, Lens)]
pub struct Toggled<T> {
pub enabled: bool,
pub value: T,
}
impl From<Toggled<u64>> ... | Rust | 0 |
#[inline]
fn default() -> Self {
MutableVec::new()
}
}
pub struct MutableSignalVec<A> {
receiver: mpsc::UnboundedReceiver<VecChange<A>>,
}
impl<A> SignalVec for MutableSignalVec<A> {
type Item = A;
#[inline]
fn poll(&mut self) -> As... | Rust | 0 |
bind to a websocket using some remote SOCKS server
websocat -v -t ws-u:socks5-bind:tcp:172.16.58.3:14124 - --socks5-destination 255.255.255.255:65535
Note that port is typically unpredictable. Use --socks5-bind-script option to know the port.
See an example in moreexamples.md for more thorough example.
"#
);
typ... | Rust | 0 |
# -*- coding: utf-8 -*-
import pygcb
def CreateDBObject():
dbObj=pygcb.tcWeaponDamage()
dbObj.databaseClass='BlastFrag0.2kg'
dbObj.maxRange_m=100.586266
dbObj.probDetonate=0.850000
dbObj.blastCharge_kg=0.072000
dbObj.fragCharge_kg=0.062000
dbObj.radCharge_kg=0.007200
dbObj.fragMetal_kg=0... | Python | 1 |
callback: Callback<Self::Output>) -> Box<dyn Bridge<Self>> {
Self::Reach::spawn_or_join(Some(callback))
}
}
use cargotest::support::{execs, project};
use cargotest::support::paths::CargoPathExt;
use hamcrest::assert_that;
use std::env;
#[test]
fn rustc_info_cache() {
let p = project("foo")
.fil... | Rust | 0 |
ts);
let mut contains_self_type = false;
let input_len = inputs.len();
for index in 0..input_len {
let ty_ = &inputs[index];
if is_param_self_type(ty_) {
contains_self_type = true;
l... | Rust | 0 |
让『埃尔赛尤』\n',
'暂时返回柏斯。',
TxtCtl.Enter,
),
)
CloseMessageWindow()
FadeOut(2000, 0, -1)
OP_0D()
OP_23(0x007A)
OP_23(0x0129)
Sleep(1000)
SetScenaFlags(ScenaFlag(0x0344, 4, 0x1A24))
MapClearFlags(0x02000000)
SetScenaFlags(ScenaFlag(0x021E, 2, 0x10F2))
... | Python | 1 |
nimplemented!()
}
/// Compile a switch statement
fn compile_switch(&'a self, _:&Expr, Vec<(Expr, Vec<Expr>)>, Option<Box<Expr>>) -> Compiled {
unimplemented!()
}
/// Compile an object declaration
fn compile_object_decl(&'a self, &BTreeMap<String, Expr>) -> Compiled {
unimplemente... | Rust | 0 |
CAP_SEED: u16 = 4503;
pub const CHEF_S_PANTS: u16 = 4504;
pub const CHEF_S_PANTS_SEED: u16 = 4505;
pub const BUTCHER_KNIFE: u16 = 4506;
pub const BUTCHER_KNIFE_SEED: u16 = 4507;
pub const UNEARTHLY_SYNTHOID: u16 = 4508;
pub const UNEARTHLY_SYNTHOID_SEED: u16 = 4509;
pub const RADIOACTIVE_SYNTHOID: u16 = 4510;
pub const... | Rust | 0 |
#
# SPDX-License-Identifier: MIT
#
# Copyright (c) 2025 Carsten Igel.
#
# This file is part of simplepycons
# (see https://github.com/carstencodes/simplepycons).
#
# This file is published using the MIT license.
# Refer to LICENSE for more information
#
""""""
# pylint: disable=C0302
# Justification: Code is generated
... | Python | 1 |
PED: u16 = 0x0001;
pub const IMAGE_FILE_EXECUTABLE_IMAGE: u16 = 0x0002;
pub const IMAGE_FILE_LINE_NUMS_STRIPPED: u16 = 0x0004;
pub const IMAGE_FILE_LOCAL_SYMS_STRIPPED: u16 = 0x0008;
pub const IMAGE_FILE_AGGRESSIVE_WS_TRIM: u16 = 0x0010;
pub const IMAGE_FILE_LARGE_ADDRESS_AWARE: u16 = 0x0020;
pub const RESERVED: u16 = ... | Rust | 0 |
ld<CStore_GetLocalizedNameForTags_Response_Tag>,
// special fields
#[cfg_attr(feature = "with-serde", serde(skip))]
pub unknown_fields: ::protobuf::UnknownFields,
#[cfg_attr(feature = "with-serde", serde(skip))]
pub cached_size: ::protobuf::CachedSize,
}
impl<'a> ::std::default::Default for &'a CSt... | Rust | 0 |
#本代码大部分基于助教实验课提供的代码完成,在此感谢张瑞松老师提供的代码
import argparse
import h5py
import torch
import torch.nn as nn
import numpy as np
import matplotlib.pyplot as plt
import torchvision
from torchvision import transforms
from torch.optim import lr_scheduler
from torch.utils.data import Dataset, DataLoader
#由于本人是第一次接触pytorch平台,所以对以上的库的... | Python | 1 |
RM_A::WARM_0,
true => WARM_A::WARM_1,
}
}
#[doc = "Checks if the value of the field is `WARM_0`"]
#[inline(always)]
pub fn is_warm_0(&self) -> bool {
*self == WARM_A::WARM_0
}
#[doc = "Checks if the value of the field is `WARM_1`"]
#[inline(always)]
pub fn is_warm_1(&self) -> bool {
*s... | Rust | 0 |
0, -7);
assert!(result0.Y.num == 2015);
assert!(result0.M.num == 2);
assert!(result0.D.0 == 8);
let case0 = Date::new(2015, 2, 15);
let result0 = date_calculation(case0, -16);
assert!(result0.Y.num == 2015);
assert!(result0.M.num == 1);
assert!(result0.D.0 == 30);
}
//! Button control w... | Rust | 0 |
gates = transpiler.num_gates();
result.constraint_stats = transpiler.constraint_stats.clone();
let hints = transpiler.into_hints();
result.num_hints = hints.len();
Ok(result)
}
impl<E: Engine> SetupForProver<E> {
pub fn prepare_setup_for_prover<C: Circuit<E> + Clone>(
circuit: C,
ke... | Rust | 0 |
014, 42001];
#[derive(Debug, Clone)]
pub struct APIClient<T: SessionStore> {
pub appid: String,
pub secret: String,
pub session: T,
}
impl<T: SessionStore> APIClient<T> {
#[inline]
pub fn new<S: Into<String>>(appid: S, secret: S, session: T) -> APIClient<T> {
APIClient {
appi... | Rust | 0 |
Error;
use crate::settings::start::{Cors as CorsConfig, Rest, Tls as TlsConfig};
use actix_cors::Cors;
use actix_rt::System;
use actix_web::{dev::Server as ActixServer, web::ServiceConfig, App, HttpServer};
use futures::sync::oneshot::{self, Receiver};
use futures::{Async, Future, Poll};
use rustls::{internal::pemfile... | Rust | 0 |
ng.gen_range(990930.5, 3912521.5)))
});
}
fn vsop87a_mars(c: &mut Criterion) {
let mut rng = thread_rng();
c.bench_function("VSOP87a Mars", move |b| {
b.iter(|| vsop87a::mars(rng.gen_range(990930.5, 3912521.5)))
});
}
fn vsop87a_jupiter(c: &mut Criterion) {
let mut rng = thread_rng();
... | Rust | 0 |
/// same logic applies to background colors. The modifier sets are unioned.
///
/// This operation is associative (i.e., `foo.combine(bar.combine(baz)) ==
/// (foo.combine(bar)).combine(baz)` but not commutative (i.e.,
/// `foo.combine(bar) != bar.combine(foo)`), and
/// `foo.combine(Style::default(... | Rust | 0 |
c_name=npc_name, npc_variant=variant_str, chathead_image=chathead_image, main_image=main_image
)
# Type annotation for DSPy result (has age_category, build_type, etc. attributes)
visual_result = cast("VisualAnalysisSignature", visual_result)
except Exception as e:
... | Python | 1 |
s in ", "Paris is in France"]]
with self.assertRaises(ValueError):
text_classifier(invalid_input)
# This used to be valid for doing text pairs
# We're keeping it working because of backward compatibility
outputs = text_classifier([[["HuggingFace is in ", "Paris is in France"... | Python | 1 |
2)
t = ps*qs*ps*qs*ps*qs
r = gamma_trace(t)
assert _is_tensor_eq(r, -12*p2*pq*q2 + 16*pq*pq*pq)
t = ps*qs*ps*qs*ps*qs*ps*qs
r = gamma_trace(t)
assert _is_tensor_eq(r, -32*pq*pq*p2*q2 + 32*pq*pq*pq*pq + 4*p2*p2*q2*q2)
t = 4*p(m1)*p(m0)*p(-m0)*q(-m1)*q(m2)*q(-m2)
assert _is_tensor_eq(gamm... | Python | 1 |
layout.addWidget(cb, iy, 1)
state_bind_combobox(self, state, 'cpt', cb)
iy += 1
cb = qw.QCheckBox('Smooth')
layout.addWidget(cb, iy, 0)
state_bind_checkbox(self, state, 'smooth', cb)
cb = common.string_choices_to_combobox(vstate.ShadingC... | Python | 1 |
An error that can occur when encoding/decoding JWTs
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct Error(Box<ErrorKind>);
impl Error {
/// Return the specific type of this error.
pub fn kind(&self) -> &ErrorKind {
&self.0
}
/// Unwrap this error into its underlying type.
pub fn into_ki... | Rust | 0 |
"random_digit")
def test_pwz_doctor(self, mock_random_digit):
mock_random_digit.side_effect = [6, 9, 1, 9, 6, 5, 2, 7, 9, 9, 1, 5]
assert self.fake.pwz_doctor() == "2691965"
assert self.fake.pwz_doctor() == "4279915"
@mock.patch.object(PlPLProvider, "random_digit")
def test_pwz_doct... | Python | 1 |
[derive(PartialEq, Eq, Serialize, Deserialize, Debug, Clone, Default)]
pub struct InnerClassAttribute {
attribute_name: String,
attribute_length: u32,
class_references: Vec<ClassReference>
}
impl AttributeInfo for InnerClassAttribute {
fn name(&self) -> &str { &self.attribute_name }
fn attr_length(&self) -> &u32... | Rust | 0 |
if s.run_state not in dont_fail_states or \
s.run_state == IteratingStates.RESCUE and s.fail_state & FailedStates.RESCUE != 0:
self._tqm._failed_hosts[host.name] = True
result |= self._tqm.RUN_FAILED_BREAK_PLAY
disp... | Python | 1 |
of ports
_n_in_max = 1
_n_out_max = 1
#maps for input and output port labels
_port_map_in = {"in": 0}
_port_map_out = {"out": 0}
def __init__(self, Fc=[50, 100], n=2):
#filter parameters
self.Fc = np.asarray(Fc)
self.n = n
if len(Fc) != 2:
raise Va... | Python | 1 |
import sst
# Define SST core options
#sst.setProgramOption("stop-at", "25us")
# Define the simulation components
comp_c0_0 = sst.Component("c0_0", "coreTestElement.coreTestComponent")
comp_c0_0.addParams({
"workPerCycle" : "100",
"commSize" : "100",
"commFreq" : "1000",
"clockFrequency" : "60s"
})
co... | Python | 1 |
_KEY: [u8; 32] = [0xff; 32];
/* Registry key flag */
pub const REGISTRY_KEY_PREFIX: &[u8; 3] = b"reg";
pub const REGISTRY_KEY_FLAG_SCRIPT_HASH_TO_NATIVE: u8 = 1;
pub const REGISTRY_KEY_FLAG_NATIVE_TO_SCRIPT_HASH: u8 = 2;
/* Generate a SMT key
* raw_key: blake2b(id | type | key)
*
* We use raw key in the underlying... | Rust | 0 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from __future__ import (division, print_function)
from setuptools import setup, find_packages
setup(
name='kflash',
py_modules=['kflash'],
version='0.8.3',
description=(
'Kendryte UART ISP Utility - programming code to k210'
),
long_descr... | Python | 1 |
url = catalog["Products"][product]["Distributions"]["en"]
if url is None:
continue
net_obj = network_handler.NetworkUtilities().get(url)
if net_obj is None:
continue
contents = net_obj.content
... | Python | 1 |
# REQUIRES: bindings_python
# RUN: %PYTHON% %s | FileCheck %s
import circt
from circt.support import connect
from circt.dialects import hw
def build(mod, dummy_mod):
i32 = circt.ir.IntegerType.get_signless(32)
# CHECK: %[[C0:.+]] = hw.constant 0
const = hw.ConstantOp.create(i32, 0)
inst = dummy_mod.instantia... | Python | 1 |
n = int(input().strip())
a = list(map(int, input().split()))
dp = [1] * n
s = a[:]
for i in range(n):
for j in range(i + 1, n):
if s[i] >= a[j]:
if dp[i] + 1 > dp[j]:
dp[j] = dp[i] + 1
s[j] = s[i] + a[j]
elif dp[i] + 1 == dp[j]:
s[j] ... | Python | 1 |
assert_eq!(decided.get_outcome(), true);
}
/// state channel
#[test]
fn test_state_channel() {
let raw_key_alice =
hex::decode("c87509a1c067bbde78beb793e6fa76530b6382a4c0241e5e4a9ec0a0f44dc0d3")
.unwrap();
let raw_key_bob =
hex::decode("<... | Rust | 0 |
}
ans.push_str(&bit_s.to_string()[..]);
}
ans = ans.chars().rev().collect::<String>();
if can_display_process {
println!("─────────────────");
println!("\t{} ({})\t[carry: {}]", ans, bin_to_dec(&ans), carry);
}
let maybe_overflow =
(a[..1].parse::<i8>().unwrap(... | Rust | 0 |
calculate image_seq_len (i.e., number of images) based on the list of image encodings stored in the image field
for rec in processed:
if rec.get("category", "").lower() in ["oc-cnt", "pc-cnt"]:
try:
rec["image_seq_len"] = len(rec["image"])
except ... | Python | 1 |
on_at_least(major, minor, 10, 12),
read_write_texture_tier: if os_is_mac {
if Self::version_at_least(major, minor, 10, 13) {
device.read_write_texture_support()
} else {
mtl::MTLReadWriteTextureTier::TierNone
}
... | Rust | 0 |
expected_pd_shape",
[
(0, (3, 10)),
(iris.feature_names[0], (3, 10)),
([0, 2], (3, 10, 10)),
([iris.feature_names[i] for i in (0, 2)], (3, 10, 10)),
([True, False, True, False], (3, 10, 10)),
],
ids=["scalar-int", "scalar-str", "list-int", "list-str", "mask"],
)
def ... | Python | 1 |
})
},
build: Some({
Box::new(move |args| {
// TODO
unimplemented!();
})
}),
tangent: Some({
let w_ = w_.clone();
let y_ = y_.clone();
Box::new(move |_: Pass, _state: RefMut<_>, _feedfwd: &mut FeedFwd| {
// TODO
... | Rust | 0 |
#[test]
fn verify_dijkstra() {
verify::<AojGrl1A>();
}
#[test]
fn verify_parallel_bisect() {
verify::<Aoj0575<UnionFind>>();
}
#[test]
fn verify_scc() {
verify::<AojGrl3C>();
}
#[test]
fn verify_dinic() {
verify::<AojGrl6A>();
}
#[t... | Rust | 0 |
I2C 4"]
I2C4 = 70,
#[doc = "71 - I2C 5"]
I2C5 = 71,
#[doc = "72 - GPIO Port M"]
GPIOM = 72,
#[doc = "73 - GPIO Port N"]
GPION = 73,
#[doc = "75 - Tamper"]
TAMPER0 = 75,
#[doc = "76 - GPIO Port P (Summary or P0)"]
GPIOP0 = 76,
#[doc = "77 - GPIO Port P1"]
GPIOP1 = 77,
... | Rust | 0 |
Some(std::mem::take(v)),
PipelineData::ListStream(stream, ..) => stream.next(),
PipelineData::ExternalStream { stdout: None, .. } => None,
PipelineData::ExternalStream {
stdout: Some(stream),
..
} => stream.next().map(|x| match x {
... | Rust | 0 |
(url, app, cookies=cookies)
assert r.status_code == get_status
# try submitting the form with the same inputs
accept_url = public_url(app) + "hub/accept-share"
r = await async_requests.post(
accept_url,
cookies=cookies,
data=form_data,
allow_redirects=False,
)
as... | Python | 1 |
self.critic_optim.load_state_dict(checkpoint["critic_optim"])
# load coarse model
def load_coarse_model(self, filename, action_res):
print('Loading coarse models from {}...'.format(filename))
self.coarse_policy = GaussianPolicy(self.num_inputs, action_res,\
self.upsampl... | Python | 1 |
(*num, unsafe {
map.read(idx as u32).expect("Failed to read value from map")
});
}
}
// Tests a trying to read an element from outside the bounds of the array
#[test]
fn test_map_array_bad_index() {
let array_size: u64 = 10;
let map: ArrayMap = unsafe... | Rust | 0 |
;
api.create_migration("0-init", dm, &dir).send().await?;
api.apply_migrations(&dir).send().await?;
api.assert_schema()
.await?
.assert_tables_count(2)?
.assert_has_table("Cat")?
.assert_has_table("_prisma_migrations")?;
api.insert("Cat")
.value("id", 1)
... | Rust | 0 |
from __future__ import annotations
import glob
import sys
import tarfile
import py.path
import pytest
from . import project_setup_py_test
from .pytest_helpers import check_sdist_content
@pytest.mark.nosetuptoolsscm
@pytest.mark.skipif(sys.platform == "win32", reason="Symlinks not supported on Windows")
@project_se... | Python | 1 |
object as gobject,
object::{Cast, IsA},
signal::{connect_raw, SignalHandlerId},
translate::*,
value::SetValueOptional,
GString, StaticType, Value,
};
// crate Scriptable
use crate::{
Action, ActorAlign, ActorBox, ActorFlags, AllocationFlags, Animatable, AnimationMode,
ButtonEvent, Color, ... | Rust | 0 |
right_border.to_array(),
c.transform,
g);
self.paddle.render(c, g);
self.ball.render(c, g);
for brick in self.bricks.iter() {
brick.render(c, g);
}
}
pub fn update(&mut self, dt: f64) {
// update paddle first, we allow pa... | Rust | 0 |
surface_config: &SurfaceConfiguration,
) {
self.platform
.update_time(self.start_time.elapsed().as_secs_f64());
self.platform.begin_frame();
// Begin to draw the UI frame.
let egui_start = Instant::now();
let mut app_output = epi::backend::AppOutput::def... | Rust | 0 |
# Copyright 2015 OpenStack Foundation
#
# 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 ... | Python | 1 |
price: f64, quantity: u32) -> Item {
Item {
description: description.into(),
unit_price,
quantity,
}
}
fn ammount(&self) -> f64 {
self.unit_price * self.quantity as f64
}
}
struct Invoice {
date: String,
invoice_no: String,
company_na... | Rust | 0 |
q!(Some(Error::NetworkError), r.err());
let target = include_bytes!("../../tests/examples/ocsp_tests/2.der");
let target_cert = parse_cert(target, "../../tests/examples/ocsp_tests/2.der").unwrap();
let issuer = include_bytes!("../../tests/examples/ocsp_tests/1.der");
let issuer_cert = Certificate::from... | Rust | 0 |
portion of the BLOB after the `start` position is modified.
///
/// * If number of bytes in `range` < length of `string`, extra bytes in `string` are not written.
/// * If number of bytes in `range` > length of `string`, extra bytes in `range` are not modified.
///
/// ```ignore
/// let b = blob... | Rust | 0 |
, 'jpeg', 'png'], accept_multiple_files=True)
# 添加标签
tags = st.multiselect(
"添加标签",
["育种", "栽培", "生理", "基因", "环境胁迫", "其他"],
default=["其他"]
)
submitted = st.form_submit_button("提交案例")
if submitted and title and description: # ... | Python | 1 |
or_default();
let pos = kf.pos.get();
(pos, kf.rot.get().to_quat(pos))
} else if frame_idx >= self.timeline.len() {
let pos = self.get_pos_at_frame(frame_idx - 1);
(pos, self.get_rot_at_frame(frame_idx - 1).to_quat(pos))
} else {
let kf1 = &se... | Rust | 0 |
# Copyright (C) 2018-2025 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import paddle
import numpy as np
import os
import sys
from save_model import saveModel
if paddle.__version__ >= '2.6.0':
import paddle.base as fluid
else:
from paddle import fluid
paddle.enable_static()
inp_blob1 = np.random... | Python | 1 |
"application/json")
.body(req_body)
.send()
.context(ErrorKind::YNABSaveTransactions.clone())?;
if !res.status().is_success() {
let res_body = res
.text()
.context(ErrorKind::YNABSaveTransactions.clone())?;
let http_er... | Rust | 0 |
[`str.title`](https://docs.python.org/3/library/stdtypes.html#str.title).
We can observe the difference with the string `"with123numbers"`:
- non-**alphanumeric** -> `"With123numbers"`
- notice lowercase **n** after the digits
- non-**alphabetic** -> `"... | Python | 1 |
import sys
from PyQt5.QtWidgets import QApplication, QWidget, QPushButton, QVBoxLayout, QLabel
from PyQt5.QtCore import pyqtSlot
class Example(QWidget):
def __init__(self):
super().__init__()
self.initUI()
def initUI(self):
# 创建一个标签和按钮
self.label = QLabel('未点击按钮', self)
... | Python | 1 |
_dependencies() {
statements.push(AST::Expression(Expression::new_wrapped(AST::Call(
Call::new_wrapped(
AST::Attribute(Attribute::new_wrapped(
self.get_task_val(),
"set_upstream".into(),
false,
... | Rust | 0 |
@tag(Tag.PILLOW)
def test_cr_y_3(self) -> None:
result = self._render(StepAndRepeatAssets.cr_y_3, dpmm=100)
self._save(result)
@tag(Tag.PILLOW)
def test_cr_y_6(self) -> None:
result = self._render(StepAndRepeatAssets.cr_y_6, dpmm=100)
self._save(result)
@tag(Tag.PILLOW)... | Python | 1 |
from MDSplus import Device, Data, Range, Dimension, Window, Signal, Int16Array
from ctypes import CDLL,c_char_p,c_short,byref, c_int
import socket
class RGA(Device):
"""Residual Gas Analizer"""
parts = [
{'path':':COMMENT','type':'text'},
{'path':':FILE','type':'text'},
{'path':':SERVE... | Python | 1 |
extra_compile_args=openmp_args,
extra_link_args=extra_link_args)
filt_geom_pyx = Extension('pynbody.filt.geometry_selection',
sources=['pynbody/filt/geometry_selection.pyx'],
include_dirs=incdir,
extra_compile_args=openmp_ar... | Python | 1 |
es(Some(cur))?;
}
let mut addr2list = HashMap::new();
for list in &lists {
if addr2list
.insert((list.address.clone(), list.priority), list)
.is_some()
{
bail!(
"duplicate address: {} (with priority {})",
list.address,
... | Rust | 0 |
(Right(v1), Right(v2)) => Right(v1.$method(v2)),
})
}
}
};
}
forward_binops_right!(impl Add, add);
forward_binops_right!(impl Sub, sub);
forward_binops_right!(impl Mul, mul);
impl<T: Integer + Clone, R: Reducer<T>> Div for Mint<T, R>
{
type Output = Self;
#[inline]
... | Rust | 0 |
return lighting_recon
# Example: Visualize SH reconstruction
# from utils.sh_rotate_utils import sh_recon, render_sphere_nm
# import numpy as np
# import matplotlib.pyplot as plt
# img_sh = np.array([
# [2.5, 2.3, 2.5],
# [0.0, 0.0, 0.0],
# [0.0, 0.0, 0.0],
# [0.0, 0.0, 0.0],
# [0.0, 0.0, 0.0],... | Python | 1 |
"""Freebox component constants."""
from __future__ import annotations
import enum
import socket
from homeassistant.const import Platform
DOMAIN = "freebox"
SERVICE_REBOOT = "reboot"
APP_DESC = {
"app_id": "hass",
"app_name": "Home Assistant",
"app_version": "0.106",
"device_name": socket.gethostname... | Python | 1 |
fn visit_seq<A>(self, mut seq: A) -> Result<Self::Value, A::Error>
where
A: SeqAccess<'de>,
{
let mut key = [0u8; $inner_size];
for elem in key.iter_mut() {
... | Rust | 0 |
import tensorflow as tf
from tensorflow.contrib import learn
width=640
height=160
learning_rate=0.0001
def gta_v_driver_model(features, mode):
speed = features[:,0]
input_layer = features[:,1:]
#Input Layer
input_layer = tf.reshape(input_layer, [-1, height, width, 3])
#minimap = tf.image.... | Python | 1 |
from wagtail.embeds import format
from wagtail.embeds.embeds import get_embed
from wagtail.embeds.models import Embed
from wagtail.rich_text import EmbedHandler
# Front-end conversion
class MediaEmbedHandler(EmbedHandler):
identifier = "media"
@staticmethod
def get_model():
return Embed
@st... | Python | 1 |
, Clone)]
pub struct GstAudioBaseSrcClass {
pub parent_class: gst_base::GstPushSrcClass,
pub create_ringbuffer:
Option<unsafe extern "C" fn(*mut GstAudioBaseSrc) -> *mut GstAudioRingBuffer>,
pub _gst_reserved: [gpointer; 4],
}
impl ::std::fmt::Debug for GstAudioBaseSrcClass {
fn fmt(&self, f: &... | Rust | 0 |
se::SegFault,
MemFaultCause::BusError => TermCause::BusError,
}
}
}
impl TermCause {
/// Prints any messages related to the exit cause, and returns the exit code.
pub fn handle_exit<F: ArchFamily<S>, S: DataWidth>(
self,
program_state: &mut ProgramState<F, S>,
) -> u... | Rust | 0 |
,
strides: *const npy_intp,
slice: Box<[T]>,
) -> &'py Self
where
ID: IntoDimension<Dim = D>,
{
let dims = dims.into_dimension();
let container = SliceBox::new(slice);
let data_ptr = container.data;
let cell = pyo3::PyClassInitializer::from(container)
... | Rust | 0 |
ct::Bool(a), Object::Bool(b)) => Ok(Object::Bool(a || b)),
(Operator::Eq, Object::Bool(a), Object::Bool(b)) => Ok(Object::Bool(a == b)),
(Operator::Ne, Object::Bool(a), Object::Bool(b)) => Ok(Object::Bool(a != b)),
(op, lhs, rhs) => Err(EvalError::InfixOp(op, lhs, rhs)),
}
}
fn eval_fn_exp... | Rust | 0 |
p.cookies
html_entitieshtmlentitydefsz
html.entitieshtml_parser
HTMLParserzhtml.parserhttp_clienthttplibzhttp.clientemail_mime_basezemail.MIMEBasezemail.mime.baseemail_mime_imagezemail.MIMEImagezemail.mime.imageemail_mime_multipartzemail.MIMEMultipartzemail.mime.multipartemail_mime_nonmultipartzemail.M... | Python | 1 |
:new("t")
.with_id(1)
.with_time_column()
.with_tag_column("tag1")
.with_i64_field_column("field_int")
.with_one_row_of_data(),
);
let batches = raw_data(&[chunk1]).await;
// Make sure all data in one record batch
assert_eq!(batches.len(), 1);... | Rust | 0 |
from django.urls import path
from django.conf.urls.static import static
from setup import settings
from playlist.views import FilmeCreateView, FilmeDeleteView, FilmeDetailView, FilmeListView, FilmeUpdateView, PlaylistCreateView, PlaylistDeleteView, PlaylistDetailView, PlaylistListView, PlaylistUpdateView
urlpatterns ... | Python | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.