text string | label_name string | labels int64 |
|---|---|---|
t="kitty %command%")
"""
exec_string = re.sub(r"%\S*", "", self.exec_string)
custom_env = os.environ.copy()
# Disable Python virtual environment
custom_env.pop("VIRTUAL_ENV", None)
custom_env.pop("PYTHONHOME", None)
custom_env.pop("PYTHONPATH", None)
cmd... | Python | 1 |
failed
if query_id in monitor.current_query_data:
monitor.current_query_data[query_id]["response_validation_passed"] = False
raise
finally:
if query_id in monitor.current_query_data:
monitor.finish_query_tracking(query_id)
@contextmanager
def track_component_opera... | Python | 1 |
cator('form:invalid')).to_have_count(0)
expect(placeholder_field).to_have_text("")
formset.locator('input[value="d"]').check()
spy = mocker.spy(FormView, 'post')
formset.evaluate('elem => elem.submit()')
request = json.loads(spy.call_args.args[1].body)
assert request['formset_data']['choices'] =... | Python | 1 |
validate_opcode!(program, 19, "muli");
validate_opcode!(program, 20, "gtrr");
validate_opcode!(program, 21, "addr");
validate_opcode!(program, 22, "addi");
validate_opcode!(program, 23, "seti");
validate_opcode!(program, 24, "addi");
validate_opcode!(program, 25, "seti");
validate_opcode... | Rust | 0 |
ndimension() == 3
assert source_control_points.size(1) == self.num_points
assert source_control_points.size(2) == 2
target_height= x.shape[2]
target_width = x.shape[3]
# create target cordinate matrix
HW = target_height * target_width
target_coordinate = list(iter... | Python | 1 |
"""
问题描述:给定一个无序单链表的头结点head,实现单链表的选择排序
要求:额外空间复杂度为O(1)
思路:选择排序是从未排序的部分找到最小值,放到排好序部分的末尾
(区分选择和冒泡排序,冒泡是比较并交换,而选择是移动指针,每次指
针都是指向最小值,一趟过程后把当前指针指向的值放到排好序的尾部)
"""
from linkedlist.toolcls import Node, PrintMixin
class SortList(PrintMixin):
@classmethod
def sort_list(cls, head):
cur = head
new_head =... | Python | 1 |
nPool>(&auction_pool_pubkey)
.await
.unwrap();
assert_eq!(
auction_pool.pool.len(),
INITIAL_AUCTION_POOL_LEN as usize + 1
);
assert_eq!(auction_pool.max_len, new_max_len);
assert_eq!(auction_pool.pool, vec![[0; 32], [1; 32], [2; 32], [3; 32]]);
// Invalid use case
... | Rust | 0 |
else if result == base {
return Ok(E::Fr::one());
}
let mut cur_guess = base;
for exponent in 2..2_u64.pow(SAVER_BLOCK_SIZE) {
cur_guess += &base;
if result == cur_guess {
return Ok(<E::Fr as From<u64>>::from(exponent));
}
}... | Rust | 0 |
hex_digit(),
skip_many((
optional(char('_')),
skip_many1(hex_digit()),
)),
).map(|t| t.0)
)).and_then(|s: &str| i64::from_str_radix(&s.replace("_", ""), 16))
.message("While parsing a hexadecimal Integer")
});
// oct-int = "0o" digit0-7 *( digi... | Rust | 0 |
=======*/
gl.bind_vertex_array(&state.vao);
if gl.is_webgl2 {
if let Some(_) = self.bound_prog.borrow().upgrade() {
return Ok(());
}
}
// Bind vertex buffer object
// "aVertexPosition"
bind_buffer(
gl,
... | Rust | 0 |
{
type Target = crate::FieldReader<bool, bool>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `pu_fbdv_buf_lotx` writer - "]
pub struct PU_FBDV_BUF_LOTX_W<'a> {
w: &'a mut W,
}
impl<'a> PU_FBDV_BUF_LOTX_W<'a> {
#[doc = r"Sets the field bit"]
#[inlin... | Rust | 0 |
teslac", mqtt_config.host, mqtt_config.port);
if let (Some(username), Some(password)) = (mqtt_config.username, mqtt_config.password) {
options.set_credentials(username, password);
}
options.set_keep_alive(Duration::from_secs(10));
let (client, mut connection) = Client::new(o... | Rust | 0 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
完整测试支撑位价格问题修复方案
验证后端计算逻辑和前端验证逻辑
"""
import sys
import os
sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'backend_api'))
from stock.stock_analysis import KeyLevels
import logging
# 设置日志
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger... | Python | 1 |
import os
from launch import LaunchDescription
from launch_ros.actions import Node
from launch.actions import IncludeLaunchDescription
from launch.launch_description_sources import PythonLaunchDescriptionSource
from ament_index_python.packages import get_package_share_directory
from launch_ros.substitutions import Find... | Python | 1 |
if path.is_some() {
return Err(syn::Error::new_spanned(
attr,
"`typed_path` specified more than once",
));
} else {
path = Some(attr.parse_args()?);
}
}
}
Ok(Attrs {
path: path.ok_or_... | Rust | 0 |
self) -> &str {
match self {
&InitError::Io(..) => "IO error while initializing",
&InitError::SetLoggerError(..) => "global logger already initialized",
}
}
fn cause(&self) -> Option<&error::Error> {
match self {
&InitError::Io(ref e) => Some(e),
... | Rust | 0 |
import os.path
import urllib.request
import zipfile
BASE_URL = 'https://figshare.com/collections/Aerial_imagery_object_identification_dataset_for_building_and_road_detection_and_building_height_estimation/3290519'
FILE_URL_FORMAT = "https://ndownloader.figshare.com/articles/{}/versions/1"
FILE_METADATA_LIST = [
{
... | Python | 1 |
out_custom = custom_fuc(*inputs_gpu)
t_forward_custom += get_end_time(t0)
loss = torch.sum((1.0 - out_custom)**2)
t0 = get_start_time()
loss.backward()
t_backward_custom += get_end_time(t0)
# forward only
with torch.no_grad():
t0 = get_start_t... | Python | 1 |
ne):
return func(self, request, queryset_or_obj, form_data)
wrapper.modal_header = modal_header
wrapper.modal_description = modal_description
wrapper.permissions = permissions
wrapper.form_class = form_class
wrapper.skip_confirmation = skip_confirmation
retur... | Python | 1 |
import pyb
import upcd8544
from machine import SPI,Pin
from pyb import UART
leds = [pyb.LED(i) for i in range(1,5)]
SPI = pyb.SPI(1) #DIN=>X8-MOSI/CLK=>X6-SCK
#DIN =>SPI(1).MOSI 'X8' data flow (Master out, Slave in)
#CLK =>SPI(1).SCK 'X6' SPI clock
RST = pyb.Pin('X20')
CE = pyb.Pin('X19')
DC = pyb.Pin('X1... | Python | 1 |
}
// }
/// Creates a Response containing an error, with the Response variant corresponding to the
/// Request variant.
pub fn error(&self, error: Error) -> CmdError {
CmdError::Auth(error)
}
/// Returns the type of authorisation needed for the request.
pub fn authorisation_kin... | Rust | 0 |
from swampdragon.testing.dragon_testcase import DragonTestCase
from .models import TextModel, ParentModel, ChildModel
from swampdragon import model_tools
class TestModelTools(DragonTestCase):
def test_get_property(self):
text_model = TextModel.objects.create(text='test')
val = model_tools.get_prop... | Python | 1 |
'left' - decrease wavelength delay by 0.05λ
'right' - increase wavelength delay by 0.05λ
'up' - increase frequency by 10 Hz
'down' - decrease frequency by 10 Hz
'q' - quit
frequency: {:.2}Hz
phase shift: {:.2... | Rust | 0 |
nonce[..].as_ptr(), // nonce
nonce.len(), // nonce_len
buf.as_ptr(), // inp
in_len, // in_len
extra_in_ptr, // extra_in
extra_in_len, // extra_in_... | Rust | 0 |
ecked(1)) * ClearFloat::from(0.5);
ans
}
#[inline(always)]
pub fn sinh(self) -> Self {
let e2 = self.exp_2();
let ans = (&*e2.get_unchecked(0) - &*e2.get_unchecked(1)) * ClearFloat::from(0.5);
ans
}
#[inline(always)]
pub fn tanh(self) -> Self {
let e2 = se... | Rust | 0 |
fire)
# try to submit weekly without specifying days of week
self.assertUpdateSubmit(
update_url,
{"start_datetime": datepicker_fmt(today), "repeat_period": "W"},
form_errors={"repeat_days_of_week": "Must specify at least one day of the week."},
object_un... | Python | 1 |
dataOut.Check_Output()
if count>1:
subset = dataOut.Create_NC_file(ofile,primary='SIT')
df = Functions.Append_to_NC(df, subset)
else:
df = dataOut.Create_NC_file(ofile,primary='SIT', datasource='Airborne E... | Python | 1 |
try:
import cupy as cp
except ImportError:
import numpy as cp
import copy
from numtorch.autograd import Tensor
from typing import Union, List
from numtorch.nn.relu import ReLU
from numtorch.nn.sequential import Sequential
from numtorch.nn.linear import Linear
from numtorch.nn.base import Module
class MLP(Modu... | Python | 1 |
CE_SIZE.is_power_of_two());
// Must adhere to architectural restrictions.
assert!(AS_SIZE >= arch_mmu::MIN_ADDR_SPACE_SIZE);
assert!(AS_SIZE <= arch_mmu::MAX_ADDR_SPACE_SIZE);
assert!((AS_SIZE % arch_mmu::AddrSpaceSizeGranule::SIZE) == 0);
AS_SIZE
}
}
/// Raw mapping of vi... | Rust | 0 |
from fir_artifacts.artifacts import AbstractArtifact
import re
class Phone(AbstractArtifact):
key = "phone"
display_name = "Phone Numbers"
regex = r"""(?P<search>
\+\d{1,3} # country code
[ \t.\-()]* # optional separators (no ... | Python | 1 |
find_fn = True
break
if(find_fn ==False):
print ("!!!ERROR: cannot find the connection layer fn")
self.connection_layer_fn_lst_dec = []
for layer_name in self.connection_layer_lst_dec:
layer_name = "_"+layer_... | Python | 1 |
sick" library.
TODO:
- use pickle and unpickle support for `self.autom`
"""
def __init__(self, ignore_case=True, titles=None, extra_titles=None):
"""
:param ignore_case if True, lower case job titles are also added
:param titles: if given, overrides default `load_titles()` valu... | Python | 1 |
olidated: bool
durationFrom: datetime
durationTo: datetime
unit: str
roleType: str
docId: str
docType: Literal["Annual", "Quarterly", "SemiAnnual"]
docSubmissionDate: datetime
class PLConcept(FinancialStatementConcept):
def __init__(
self,
root_concepts: list[ModelConce... | Python | 1 |
"""Provides a version of the Distutils "build_py" command that knows about
PTL files.
"""
import os
from glob import glob
from distutils.command.build_py import build_py
class qx_build_py(build_py):
def find_package_modules(self, package, package_dir):
self.check_package(package, package_dir)
mod... | Python | 1 |
"Dormant Users": (0.8, 1.0),
}
response_data = []
for category, (lower_bound, upper_bound) in churn_categories.items():
# Count users in each category
user_count = (
db.query(func.count(ResultsDB.id))
.filter(
ResultsDB.churn_probability > lower_bo... | Python | 1 |
annel {
Channel{period: 0, sample_number: 0, effect: 0}
}
pub fn is_empty(&self) -> bool {
self.period == 0 && self.sample_number == 0 && self.effect == 0
}
}
/// A single row in a Pattern.
/// Normally there are 4 channels per Row.
#[derive(Debug, PartialEq, Clone, Serialize, Deserialize)]
pub struct Row {
/... | Rust | 0 |
inline]
fn add_round_key(state: &mut State, rkey: &[u32]) {
debug_assert_eq!(rkey.len(), 8);
for (a, b) in state.iter_mut().zip(rkey) {
*a ^= b;
}
}
#[inline(always)]
fn add_round_constant_bit(state: &mut [u32], bit: usize) {
state[bit] ^= 0x0000c000;
}
#[inline(always)]
fn ror(x: u32, y: u32)... | Rust | 0 |
"""Functions for calculating steps in exchaning currency."""
def exchange_money(budget, exchange_rate):
return budget / exchange_rate
def get_change(budget, exchanging_value):
return budget - exchanging_value
def get_value_of_bills(denomination, number_of_bills):
return denomination * number_of_bills
... | Python | 1 |
"""
Sources:
Irish Counties: http://en.wikipedia.org/wiki/Counties_of_Ireland
"""
from django.utils.translation import ugettext_lazy as _
IE_COUNTY_CHOICES = (
('antrim', _('Antrim')),
('armagh', _('Armagh')),
('carlow', _('Carlow')),
('cavan', _('Cavan')),
('clare', _('Clare')),
('cork... | Python | 1 |
t.P_OUTPUT_TRANSFORMER: self.filename('transformer.pkl'),
}
self.runalg(algFit, parametersFit)
# forward transform
alg1 = TransformRasterAlgorithm()
alg1.initAlgorithm()
parameters = {
alg1.P_RASTER: enmap_potsdam,
alg1.P_TRANSFORMER: parametersFi... | Python | 1 |
self.matcher_vo = VersionOrder(vspec_str)
matcher = self.operator_match
is_exact = True
else:
matcher = self.exact_match
is_exact = True
return vspec_str, matcher, is_exact
def merge(self, other):
assert isinstance(other, self.__class__)
... | Python | 1 |
"n_agents": 4,
"n_enemies": 18,
"limit": 200,
"a_race": "P",
"b_race": "Z",
"unit_type_bits": 2,
"map_type": "stalkers_and_zealots_vs_zergling",
},
"3s1z_vs_zg_easy": {
"n_agents": 4,
"n_enemies": 18,
"limit": 200,
"a_race":... | Python | 1 |
&'a mut W,
}
impl<'a> EXTMEM_ICACHE_TAG_MEM_FORCE_ON_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 |
izePolicy.Policy.Maximum, QSizePolicy.Policy.Minimum)
self.bottom_horizontalLayout.addItem(self.horizontalSpacer_3)
self.verticalLayout.addLayout(self.bottom_horizontalLayout)
self.retranslateUi(search_base)
QMetaObject.connectSlotsByName(search_base)
# setupUi
def retransl... | Python | 1 |
from flask import Blueprint, jsonify, current_app
import psutil, shutil, time
ov_bp = Blueprint("overview", __name__)
# Global buffer to simulate real-time traffic history
traffic_data = []
@ov_bp.route("/stats", methods=["GET"])
def stats():
cpu = psutil.cpu_percent(interval=0.5)
mem = psutil.virtual_memory... | Python | 1 |
from distutils.core import setup
from setuptools import find_packages
import os
# User-friendly description from README.md
current_directory = os.path.dirname(os.path.abspath(__file__))
try:
with open(os.path.join(current_directory, 'README.md'), encoding='utf-8') as f:
long_description = f.read()
except E... | Python | 1 |
create_device(&device);
let gbm_surface = gbm::surface_create(
gbm_device,
mode_info.hdisplay as u32,
mode_info.vdisplay as u32,
GBM_FORMAT,
gbm_bo_flags::GBM_BO_USE_SCANOUT | gbm_bo_flags::GBM_BO_USE_RENDERING,
);
let egl_display = egl::get_display(gbm_device as *mut c_void).... | Rust | 0 |
description=input_description,
num_res=num_res)
msa_features = make_msa_features(
msas=parsed_msas, deletion_matrices=parsed_delmat)
return {**sequence_features, **msa_features}
##################MAIN#######################
#Parse args
args = parser.parse_args()
#Data
input_fasta_path ... | Python | 1 |
rn self.forward_pre(output, memory, segms, #query, key, value, segms,
pos=pos)
return self.forward_post(output, memory, segms, #query, key, value, segms,
pos=pos)#output:分别为形状同quries的0向量;memory:backbone出来的特征;tgt_mask:None;memory_mask:手物query数量的mask([4,... | Python | 1 |
'prefix': 'D',
'weight': 0,
'is_hot': 0,
},
{
'id': 318,
'pid': 25,
'name': '文昌',
'level': 2,
'pinyin': 'wenchang',
'prefix': 'W',
'weight': 0,
'is_hot': 0,
},
{
... | Python | 1 |
elled},
tags::Plicit,
vec1::Vec1,
};
use crate::syntax::pat::{Copat, Pat};
/// Surface syntax: Parameter.
///
/// It's a part of a pi-type expression.
#[derive(Debug, Clone, Eq, PartialEq)]
pub struct Param {
pub licit: Plicit,
/// This field can be empty -- which indicates the parameter to be
///... | Rust | 0 |