text string | label_name string | labels int64 |
|---|---|---|
#!/usr/bin/env python3
# -*- coding:utf-8 -*-
#############################################################
# File: pixelshuffle.py
# Created Date: Friday July 1st 2022
# Author: Chen Xuanhong
# Email: chenxuanhongzju@outlook.com
# Last Modified: Friday, 1st July 2022 10:18:39 am
# Modified By: Chen Xuanhong
# Copyrig... | Python | 1 |
tag="🚀 手动切换1",
type="selector",
regex=r".*"
),
User_config_outbound(
tag="🚀 手动切换2",
type="selector",
regex=r".*"
),
# outbounds for rules
User_config_outbound(
tag="✔ ZJU-INTL",
type="se... | Python | 1 |
from highrise import *
from highrise.models import *
import asyncio
from asyncio import Task
async def follow(self: BaseBot, user: User, message: str) -> None:
async def following_loop(self: BaseBot, user: User, message: str) -> None:
if message.startswith("/following_loop"):
await self.highris... | Python | 1 |
# Decay the first and second moment running average coefficient
exp_avg.mul_(beta1).add_(grad, alpha=1 - beta1)
exp_avg_sq.mul_(beta2).addcmul_(grad, grad, value=1 - beta2)
if amsgrad:
# Maintains the maximum of all 2nd moment running avg. til... | Python | 1 |
rr(|s| {
// TODO we shouldn't really care if its utf-8 or not. probably
anyhow::anyhow!("string contains invalid utf-8, '{}'", s.to_string_lossy())
})?,
0 => exit_with_error("ERROR: a channel must be provded"),
_ => exit_with_error("ERROR: only a singl... | Rust | 0 |
Subworker(SubworkerDefinition),
GetOverview,
Stop,
}
#[derive(Deserialize, Serialize, Debug)]
pub struct TaskFinishedMsg {
pub id: TaskId,
pub size: u64,
/*#[serde(with = "serde_bytes")]
pub r#type: Vec<u8>,*/
}
#[derive(Deserialize, Serialize, Debug)]
pub struct TaskFailedMsg {
pub id: Ta... | Rust | 0 |
ax2.set_title('Final Distribution')
ax2.set_xlabel('')
ax2.set_xticklabels([])
# Set legend colors for ax2
legend2 = ax2.legend()
for text in legend2.get_texts():
text.set_color(text_color)
... | Python | 1 |
eshold())
# Input state
input_state = BasicState([1] * num_photons + [0] * (random_loc.m - num_photons))
processor.with_input(input_state)
# Sampler
sampler = Sampler(processor)
return sampler.probs()['results']
@retry(AssertionError, 3)
def test_mitigation_over_postselect_tvd():
ideal... | Python | 1 |
ature = tokenizer([caption]).to(device)
# text_feature = model.encode_text(text_feature, normalize=True)
text_feature_list.append(text_feature)
text_embeds = torch.cat(text_feature_list, dim=0)
text_embeds /= text_embeds.norm(dim=-1, keepdim=True)
for i, (uid, image, ca... | Python | 1 |
Default {
type Output;
fn digest(buf: &[u8]) -> Self::Output {
let this = Self::default();
todo!()
}
}
#[derive(Clone, Copy, Debug)]
pub struct Sha256Digest([u8; 32]);
#[derive(Default)]
pub struct Sha256Hasher {
}
pub struct Digest32([u8; 32]);
pub struct Digest<T: 'static, D = Sha25... | Rust | 0 |
VERSE + cv.DFT_SCALE + cv.DFT_REAL_OUTPUT
cv.dft(tempZ, self.Z, flags)
z_norm = cv.normalize(self.Z, None, 0, 255, cv.NORM_MINMAX, cv.CV_8U)
if self.display:
cv.imshow('z_norm', z_norm)
# np.save("z_norm.npy",z_norm)
cv.waitKey(0)
cv.destroyAllWind... | Python | 1 |
) }
}
pub fn scroll(win: WINDOW) -> i32 {
unsafe { sys::scroll(win) }
}
pub fn scrollok(win: WINDOW, flag: bool) -> i32 {
unsafe { sys::scrollok(win, flag) }
}
pub fn set_term(new: SCREEN) -> SCREEN {
unsafe { sys::set_term(new) }
}
pub fn setscrreg(top: i32, bot: i32) -> i32 {
unsafe { sys::setscrr... | Rust | 0 |
nnel 19 Software Flush Request Bit"]
#[inline(always)]
pub fn swf19(&mut self) -> SWF19_W {
SWF19_W { w: self }
}
#[doc = "Bit 20 - XDMAC Channel 20 Software Flush Request Bit"]
#[inline(always)]
pub fn swf20(&mut self) -> SWF20_W {
SWF20_W { w: self }
}
#[doc = "Bit 21 -... | Rust | 0 |
u8) = (0, 109, 50);
const L3: (u8, u8, u8) = (38, 166, 65);
const L4: (u8, u8, u8) = (57, 211, 83);
enum FillChars {
FullBlock,
}
impl From<FillChars> for &str {
fn from(char: FillChars) -> Self {
match char {
FillChars::FullBlock => "█",
}
}
}
fn main() {
let mut args = e... | Rust | 0 |
#Credits:
#M. Attene. A lightweight approach to repairing digitized polygon meshes.
#The Visual Computer, 2010. (c) Springer. DOI: 10.1007/s00371-010-0416-3
#http://pymeshfix.pyvista.org
#TetGen, a Delaunay-Based Quality Tetrahedral Mesh Generator
#https://github.com/pyvista/tetgen
#
# pip install pymeshfix
# pip insta... | Python | 1 |
"--proxy",
f"http://{green(ip, True)}:{green(port, True)}",
"-f",
f"bv*[width>{green(width, True)}]"
+ f"[height>{green(height, True)}]"
+ f"[fps>{green(fps, True)}]"
+ f"[ext={green('mp4', True)}]",
f"https://www.youtube.com/watch?v={green(yt_id, True)}"... | Python | 1 |
l, [], anchor=center)
alternate = seq_extractor.extract(interval, [variant], anchor=center)
#print(reference)
#print(alternate)
# reference = reference.replace("\n", "")
# alternate = alternate.replace("\n", "")
if rev_seq:
reference = kipoiseq.transforms.functional.rc_dna(reference)
... | Python | 1 |
{
stbtt_ScaleForPixelHeight(((&mut info) as *mut stbtt_fontinfo), size)
} else {
stbtt_ScaleForMappingEmToPixels(((&mut info) as *mut stbtt_fontinfo), -size)
});
stbtt_GetFontVMetrics(
((&mut info) as *mut stbtt_fontinfo),
((&mut i_ascent) as *mut i32),
((&mut i_desc... | Rust | 0 |
},
]
# Internationalization
# https://docs.djangoproject.com/en/5.1/topics/i18n/
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/5.1/howto/static-files/
STATIC_URL = 'static/'
# Default primary key field ty... | Python | 1 |
}
}
}
impl<T: Float> Eq for InternalNeighbour<T> {}
impl<T: Float> Ord for InternalNeighbour<T> {
fn cmp(&self, other: &Self) -> Ordering {
self.dist2
.cmp(&other.dist2)
.then_with(|| self.index.cmp(&other.index))
}
}
impl<T: Float> PartialOrd for InternalNeighbour<... | Rust | 0 |
6_address := self.node_config.inband_mgmt_ipv6_address:
return inband_mgmt_ipv6_address
if not self.node_config.inband_mgmt_ipv6_subnet:
return None
if self.id is None:
msg = "'id' is required to set inband_mgmt_ipv6_address from inband_mgmt_ipv6_subnet"
... | Python | 1 |
(b2, b1) = den.split_at(n);
let a12 = &mut num[n..];
let (mut nquot, _) = if crate::ubig::cmp::lt(&a12[n..], b1)
{
div_big_bz_2n_n(a12, b1, quot, work)
}
else
{
quot.fill(T::MAX);
let _ = crate::ubig::sub::sub_assign_big(&mut a12[n..], b1);
... | Rust | 0 |
ZU = RuleImage(roi_front=(43,608,73,67), roi_back=(43,608,73,67), threshold=0.8, method="Template matching", file="./tasks/SixRealms/gate1/gate1_mshouzu.png")
# 开启
I_MSTART = RuleImage(roi_front=(1136,575,100,100), roi_back=(1043,527,215,167), threshold=0.8, method="Template matching", file="./tasks/SixRealms/gate1/... | Python | 1 |
its parent. Fixtures hold additional non-geometric data
/// such as friction, collision filters, etc.
/// Fixtures are created via b2_body::create_fixture.
/// @warning you cannot reuse fixtures.
#[derive(Default, Clone)]
pub struct B2fixture<D: UserDataType> {
pub(crate) m_density: f32,
pub(crate) m_next: Option<F... | Rust | 0 |
e annotations.
* Functions bounded to class object or class.
* Properties bounded to class object.
Args:
key: The class member name.
value: The class member value.
hints: The type hints for the class. Defaults to None, in which case, the
members existence in type hints a... | Python | 1 |
rite() -> io::Result<()> {
// Make sure we create the directory with unique entropy in it (so no clashes)
// and clean up after ourselves (so we don't leak files)
let temp = std::env::temp_dir();
let temp = temp.join("gazebo");
let temp = temp.join(random_part());
// We d... | Rust | 0 |
_averaged(roll_dice, samples_count)
res = average_roll_dice(i,dice)
if res > max_average:
ans = i
max_average = res
return ans
# END PROBLEM 9
def winner(strategy0, strategy1):
"""Return 0 if strategy0 wins against strategy1, and 1 otherwise."""
score0, sco... | Python | 1 |
w
from community_posts cp
join user_info ui on cp.user_email = ui.email
left join community_posts cp2 on cp2.user_email = cp.user_email
left join community_posts_reactions cpr on cp2.id = cpr.post_id
left join user_follows uf
... | Python | 1 |
contact")
sheet.update_cell(1,1, "Applicant name")
sheet.update_cell(1,3, "Applicant email address")
sheet.update_cell(1,4, "Applicant linkedin profile")
sheet.update_cell(1,5, "Applicant github profile")
sheet.update_cell(1,6, "Applicant edycation")
... | Python | 1 |
ertex {
position: [-1.0, -1.0],
},
Vertex {
position: [1.0, 1.0],
},
Vertex {
position: [1.0, -1.0],
},
];
fn main() {
nannou::app(model).update(update).run();
}
fn model(app: &App) -> Model {
// Load the images.
let sequence_path = app
.assets_path()
... | Rust | 0 |
# coding: utf-8
"""
traQ v3
traQ v3 API
The version of the OpenAPI document: 3.0
Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
""" # noqa: E501
import unittest
from openapi_client.models.post_clip_folder_request import PostClipFolderRequest
... | Python | 1 |
#!/usr/bin/env python3
"""
Sync Xournal++ Lua API file from GitHub with documentation header
Usage: python sync_luapi.py
"""
import json
import urllib.request
import textwrap
from datetime import datetime
from pathlib import Path
REPO = "xournalpp/xournalpp"
FILE_PATH = "plugins/luapi_application.def.lua"
def get_... | Python | 1 |
Vowel = ['a', 'e', 'i', 'o', 'u']
for _ in range(5):
w1, w2 = input().split()
w1_f = [0] * len(w1)
w2_f = [0] * len(w2)
for i in range(len(w1)):
if w1[i] in Vowel:
w1_f[i] += 1
for i in range(len(w2)):
if w2[i] in Vowel:
w2_f[i] += 1
if w1_f == w2_f:
... | Python | 1 |
cannot keep gradients
return
@unittest.skip("The model doesn't support fast init from base")
def test_save_load_fast_init_from_base(self):
pass
@unittest.skip(
"Duplicated test with WhisperModelTest + the FA2 testing suite needs to be refactored to be compatible with WhisperDecode... | Python | 1 |
) = _rest.split_at(32);
let id = cast_slice_as_array(id);
let service_type = cast_slice_as_array(service_type);
let subject = Pubkey::new(subject);
let issuance_date = cast_slice_as_array(issuance_date);
Self::CreateLicense {
... | Rust | 0 |
#소프트맥스 함수 구현 시 주의점
'''
소프트맥스는 컴퓨터로 계산할 떄 결함(오버플로우)이 있다.
소프트맥스 함수는 지수 함수를 사용하는데, 지수 함수는 계산의 괒ㅇ에서 아주 큰 값을 출력한다.
큰 값끼리 나눗셈을 하면 결과 수치가 '불안정'하다.
*오버플로우overflow
-> 컴퓨터 수를 4바이트나 8바이트와 같이 크기가 유한한 데이터를 다루는 것이 아니라\
표현할 수 있는 수의 범위를 넘어설 때 발생하는 문제점.
문제 해결을 위한 소프트맥스 함수 구현을 개선한다.
y_k=C*exp(a_k)/C*sigma exp(a_i)
={exp(a_k)+log... | Python | 1 |
from src.app.database.database import DBConnectionHandler
db_handler = DBConnectionHandler()
| Python | 1 |
cfg(feature = "radix")] {
// PRIME (EXCEPT 2)
pub(super) const POW3: [u32; 21] = [1, 3, 9, 27, 81, 243, 729, 2187, 6561, 19683, 59049, 177147, 531441, 1594323, 4782969, 14348907, 43046721, 129140163, 387420489, 1162261467, 3486784401];
pub(super) const POW7: [u32; 12] = [1, 7, 49, 343, 2401, 16807, 117649, 823543, 57... | Rust | 0 |
rfaceDesc])
///
/// ### Example
///
/// ```rust
/// # use dev::d3d9::*; let device = safe_device_pure();
/// let texture = device.create_cube_texture(128, 8, Usage::None, Format::A8R8G8B8, Pool::Default, ()).unwrap();
/// let desc : SurfaceDesc = texture.get_level_desc(0).unwrap();
/// a... | Rust | 0 |
0x0500_0000,// Bound_r32_m3232
0x266D_C035, 0x0300_0000,// Arpl_rm16_r16
0x266D_C035, 0x0500_0000,// Arpl_r32m16_r32
0x0000_0037, 0x0C00_0000,// Movsxd_r16_rm16
0x0000_0037, 0x0C00_0000,// Movsxd_r32_rm32
0x0000_0037, 0x0C00_0000,// Movsxd_r64_rm32
0x12E0_0004, 0x0200_0000,// Push_imm16
0x1300_0004, 0x0500_0000... | Rust | 0 |
:#?}",
expected_errors.len(),
actual_errors.len(),
actual_errors
);
}
// Turn each vector into an iterator.
let mut iter_expected_errors = expected_errors.iter().peekable();
let mut iter_actual_errors = actual_errors.into_iter();
// For each error re... | Rust | 0 |
to_string()
}
}
}
/// Wrapper for `Targets` so that a `Targets` role can be given a name
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq)]
pub struct DelegatedTargets {
/// The name of the role
#[serde(skip)]
pub name: String,
/// The targets representing the role metadata
#[se... | Rust | 0 |
>().unwrap(),
"due_date": due});
Runtime::new().expect("Could not update task.")
.block_on(coto::update_task(token, &task.id, json_data.to_string()))
.unwrap();
}
}
sect_and_task_overview(project_name, token, id);
... | Rust | 0 |
from PySide6 import QtWidgets
from PySide6.QtCore import QThread, Signal
from videotrans import tts
from videotrans.configure import config
from videotrans.util import tools
def openwin():
class TestTTS(QThread):
uito = Signal(str)
def __init__(self, *, parent=None, text=None, language=None, rol... | Python | 1 |
import numpy as np
import math
def best_line(x, y, grau=1):
n = len(x)
# soma das coordenadas x
sum_x = sum(x)
# soma das coordenadas x**2
sum_x2 = sum(xi ** 2 for xi in x)
# soma das coordenadas y
sum_y = sum(y)
#soma das coordenadas x*y
sum_xy = sum(xi * yi for xi, yi in zip(x, y)... | Python | 1 |
nova_instancia = [[79,47,39,23.689332,82.272822,6.425471,236.181114]] # Rice
# nova_instancia = [[101,28,29,25.540477,58.869846,6.790308,158.066295]] # Coffe
# Normalizar a nova instância
# Abrir o modelo normalizador salvo antes do treinamento
from pickle import load
normalizador = load(open('classificador/crop_norma... | Python | 1 |
// [d; -c]
Self { rep: add_ru(x, y) }
}
}
impl Mul for Interval {
type Output = Self;
#[allow(clippy::many_single_char_names)]
fn mul(self, rhs: Self) -> Self {
// [a, b] * [c, d] =
//
// | M | N | P | Z
// ---+------------+------... | Rust | 0 |
import torch
from torch import nn
from transformers import BertPreTrainedModel, BertModel
class MRCModel_Poly_CE(BertPreTrainedModel):
def __init__(self, config):
super(MRCModel_Poly_CE, self).__init__(config)
self.bert = BertModel(config)
self.start_fc = nn.Linear(config.hidden_size, 2)
... | Python | 1 |
o, table)
.await
.map(|r| HttpResponse::Ok().body(r.to_string()))
}
#[get("/table_list")]
pub async fn table_list(
dyn_conn: web::Data<MutexUaStore>,
req: web::Query<DatabaseIdRequest>,
) -> Result<HttpResponse, ServiceError> {
let conn = dyn_conn.lock().unwrap();
let key = UaUtil::str_... | Rust | 0 |
...")
day1_sim.bring_up_interfaces()
print(" ⏳ Running 60-second network stabilization...")
day1_sim.wait_stabilization(60)
print(" 🔍 Populating ARP tables and discovering neighbors...")
day1_sim.populate_arp()
day1_sim.trigger_ospf()
day1_sim.trigger_bgp()
day1_sim.valida... | Python | 1 |
= (101 + scores[4]) // 2
code, role = parsing([energy_value, mind_value, nature_value, tactics_value, identity_value])
return code, role, [energy_value, mind_value, nature_value, tactics_value, identity_value]
def get_model_examing_result(client_qw):
client = client_qw
for mbti_item in prompt_temp... | Python | 1 |
+ '&matches={"010180-0008":' + str(matches) + '}'
).json()
scan_url = response["reference"]
scan = {
"scan_name": seed, "scan_url": scan_url,
"matches": matches, "sub_files": sub_files}
return scan
def start_scan(self, scan, source_params=Non... | Python | 1 |
ess the integer digits.
'integer: loop {
// Parse a digit at a time, until we reach step.
while counter < step && count < max_digits {
if let Some(&c) = integer.next() {
add_digit!(c, value, counter, count);
} else {
break 'integer;
... | Rust | 0 |
cannot be used for the .. image:: tag, instead we need to use the raw option!
img_folder_os = os.path.normpath(os.path.join(source_dir, self.options["image_folder"]))
img_folder = self.options["image_folder"]
rawtext = parse_examples(path, img_folder, img_folder_os)
include_lin... | Python | 1 |
.put(&b"\r\n"[..]);
buf.put(boundary);
buf.put(&b"--\r\n"[..]);
buf.put(&b"\r\n"[..]);
buf
}
// multipart post code based on the example at https://github.com/SergioBenitez/Rocket/issues/1591
#[test]
fn test_post_simulation() {
let client = Client::untracked(rocket()).expect("valid rocket instance"... | Rust | 0 |
len..].to_vec(),
))
}
#[cfg(test)]
pub fn as_byte_ptrs(&self) -> Vec<(*const u8, usize)> {
vec![
/* Cannot easily get raw pointer of enum value, otherwise would do self.mode.as_ptr() */
(self.nonce.as_ptr(), self.nonce.len()),
(self.ciphertext.as_ptr(), s... | Rust | 0 |
routing_key=routing_key,
# 发送的消息的内容
body=body,
# 发现的消息的类型
properties=properties
# pika.BasicProperties中的delivery_mode=2指明message为持久的,1 的话 表示不是持久化 2:表示持久化
... | Python | 1 |
# open template in Aimsun
print('[load.py] Loading template ' + template_path)
model = AimsunTemplate(GKSystem, GKGUISystem)
model.load(template_path)
# HACK: Store port in author
model.setAuthor(port_string)
# collect the simulation parameters
params_file = 'flow/core/kernel/network/data_%s.json' % port_string
para... | Python | 1 |
Metadata| {
if metadata.initialized {
return Err(MetaEntityError::ErrorCode(
MetaEntityErrorCode::AlreadyInitialized,
))?;
}
metadata.entity = entity;
metadata.authority = authority;
metadata.initialized = tr... | Rust | 0 |
1, vec![(4500001, 2250000), (73801, 36870)]);
testing(90000001, vec![(45000001, 22500000), (6428575, 3214284), (3461545, 1730766), (494551, 247230)]);
testing(90002, vec![]);
testing(9004, vec![(2252, 1125)]);
testing(9000004, vec![(2250002, 1125000), (173090, 86532), (132370, 66168), (10402, 4980)]);... | Rust | 0 |
1 => {
if modrm_byte < 0xC0 {
let addr = ::modrm::decode(ctx.cpu, modrm_byte);
let imm = ctx.cpu.read_imm8() as u32;
::jit_instructions::instr_F6_1_mem_jit(ctx, addr, imm);
}
else {
let imm =... | Rust | 0 |
assert (
changelog.broker_config.num_partitions
== repartition.broker_config.num_partitions
)
assert (
changelog.broker_config.replication_factor
== repartition.broker_config.replication_factor
)
def test_stream_id_from_topics_multiple_t... | Python | 1 |
import numpy as np
from numpy import ndarray
from .knn import knn
def mutual_select(src_feats: ndarray, tgt_feats: ndarray, mutual: bool = False, bidirectional: bool = False):
"""Extract correspondence indices from features.
Args:
tgt_feats (array): (N, C)
src_feats (array): (M, C)
m... | Python | 1 |
)
self.cmbantibiyotik.setItemText(21, _translate("MainWindow", "Piperasilin/Tazobaktam"))
self.cmbantibiyotik.setItemText(22, _translate("MainWindow", "Sefolotin"))
self.cmbantibiyotik.setItemText(23, _translate("MainWindow", "Sefaperazon"))
self.cmbantibiyotik.setItemText(24, _translate... | Python | 1 |
#[inline]
fn visit_seq<V>(self, mut visitor: V) -> Result<Self::Value, V::Error>
where
V: SeqAccess<'de>,
{
let mut vec = vec_maybe_size(visitor.size_hint());
while let Some(elem) = visitor.next_element_seed(self)? {
vec.push(elem);
}
Ok(vec.encode(sel... | Rust | 0 |
col
Subplot column for shape. If 'all', addresses all
columns in the specified row(s).
secondary_y
Whether to add shape to secondary y-axis
exclude_empty_subplots
If True, shape will not be added to subplots without
traces.
Re... | Python | 1 |
p_counters: *mut PerformanceCounterKHR,
p_counter_descriptions: *mut PerformanceCounterDescriptionKHR,
) -> Result {
(self.enumerate_physical_device_queue_family_performance_query_counters_khr)(
physical_device,
queue_family_index,
p_counter_count,
... | Rust | 0 |
from PIL import Image
import os
import torch
import numpy as np
from numpy.fft import fft2, fftshift
import matplotlib.pyplot as plt
from scipy.ndimage import gaussian_filter
def cal_freqgain(gt, pred, ita = 1e-6):
img_fft = fft2(pred)
img_fft = fftshift(img_fft)
img_power = np.power(np.absolute(img_fft),... | Python | 1 |
a: ScalarCow<'_> = "alpha".into();
let beta: ScalarCow<'_> = "beta".into();
let empty: ScalarCow<'_> = "".into();
assert_eq!(alpha, alpha);
assert_eq!(empty, empty);
assert!(alpha != beta);
assert!(beta != alpha);
}
#[test]
fn strings_have_ruby_truthiness() {... | Rust | 0 |
// Untransform another layer - this won't quite match the original due
// to the case changing
record.apply(Action::buffer_untransform("buffer"))?;
assert_eq!(b"NGE0YjRjNGQ0ZQ==".to_vec(), record.target().get_buffer("buffer")?.data);
// Undo the first layer
record.undo()?;
... | Rust | 0 |
struct Process {
pid: PID,
}
#[repr(C)]
#[derive(Copy, Clone, Debug, Default)]
/// Everything required to keep track of a single thread of execution.
pub struct Thread {
/// Storage for all RISC-V registers, minus $zero
pub registers: [usize; 31],
/// The return address. Note that if this thread was... | Rust | 0 |
ase. Client implementations MUST interact with any
/// of these. If a server implementation interprets non-INBOX mailbox
/// names as case-insensitive, it MUST treat names using the
/// international naming convention specially as described in section 5.1.3.
///
/// There are certain client considerations when creati... | Rust | 0 |
(always)]
pub(crate) fn new(bits: bool) -> Self {
HOST_SLC0_TOKEN0_0TO1_INT_ST_R(crate::FieldReader::new(bits))
}
}
impl core::ops::Deref for HOST_SLC0_TOKEN0_0TO1_INT_ST_R {
type Target = crate::FieldReader<bool, bool>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
... | Rust | 0 |
(
"""
value
1
2
13
"""
)
result = table.with_columns(value_inc=inc(table.value))
pw.debug.compute_and_print(result)
# %% [markdown]
# While `inc` returns `list[int]`, the type of the `value_inc` column is inferred to be the type wrapped inside `list` - in this case `int`.
# %%
print(result.s... | Python | 1 |
1) % 4];
let a = x_next - x_curr;
let b = x_prev - x_curr;
// perp gives "2d cross product", which when negative means that the interior angle
// is creater than 180 degrees, and so the corner must be concave
if a.perp(&b) < T::zero() {
retur... | Rust | 0 |
from django.db import models
from django.db.models.signals import post_delete
from django.dispatch import receiver
from django.utils.safestring import mark_safe
from wagtail.admin.panels import FieldPanel, HelpPanel, MultiFieldPanel
from wagtail.models import Page
from foundation_cms.core.models.home_page import HomeP... | Python | 1 |
d;
// Shortest path for fixed tree This one should give the shortest possible
// result for fixed tree, no repeated runs are needed since the tree is known.
lz77_optimal_run(s, in_, instart, inend, &mut path, &mut length_array, &FixedCostModel, store);
}
use crate::{AgentID, CarID, ParkingSpot, PedestrianI... | Rust | 0 |
# -*- coding: utf-8 -*-
# Part of Softhealer Technologies.
from odoo import models, fields
class PosConfig(models.Model):
_inherit = 'pos.config'
sh_search_product = fields.Boolean(string='Enable Product Search By Tag')
| Python | 1 |
text_renderer.clone());
page_buttons.push(button);
}
let layout_pages = ui::GridLayout::new(1, PAGE_END as usize,
page_buttons.iter().cloned().map(|m|->Rc<RefCell<dyn ui::UIElement>>{m}).collect(),
0.02, 0.02, 0.02, 0.02, 0.01, 0.01, rect_renderer.clone());
l... | Rust | 0 |
def plot(density_map, name):
"""
@brief density map contour and heat map
"""
print(np.amax(density_map))
print(np.mean(density_map))
fig = plt.figure(figsize=(4, 3))
ax = fig.gca(projection='3d')
x = np.arange(density_map.shape[0])
y = np.arange(density_map.shape[1])
x, y = np... | Python | 1 |
("{:#?}", parsed);
//! // println!("{}", parsed);
//!
//! // Access a specific field
//! println!("Title -> {}", parsed["title"]);
//!
//! // Iterate over structure
//! println!("\nHosts:");
//! if let GuraType::Array(hosts) = &parsed["hosts"] {
//! for host in hosts.iter() {
//! println!("Host -> {}", *hos... | Rust | 0 |
f new_free_blocks[-1].starting_position + new_free_blocks[-1].size == current_block.starting_position:
new_free_blocks[-1].size += current_block.size
else:
new_free_blocks.append(DiskBlock(
starting_position=next_block.starting_position,
size=next_block.si... | Python | 1 |
if resp != 0x1AA {
log::error!("wrong resp {}", resp);
false
} else {
true
}
} else {
log::warn!("err");
false
};
log::warn!("version 2 {}", version2);
let orc = if version2 {
... | Rust | 0 |
, 0.5f32, 0.5f32], red),
Vertex::new([ 0.5f32, -0.5f32, 0.5f32], green),
Vertex::new([ 0.5f32, 0.5f32, 0.5f32], blue),
Vertex::new([-0.5f32, 0.5f32, -0.5f32], blue),
... | Rust | 0 |
lue.into_deserializer())?,
VariantAccess::new(variant),
)),
None => Err(de::Error::custom("expected an enum variant")),
}
}
}
struct VariantAccess {
value: Value,
}
impl VariantAccess {
fn new(value: Value) -> Self {
VariantAccess { value }
}
}
... | Rust | 0 |
from gws_core import BaseTestCase, TaskRunner
from gws_gaia import (DecisionTreeRegressorPredictor,
DecisionTreeRegressorTrainer)
from tests.gws_gaia_test_helper import GWSGaiaTestHelper
class TestTrainer(BaseTestCase):
def test_process(self):
self.print("Decision Tree Regressor")
... | Python | 1 |
Parser;
pub use self::grammar::DeclarationParser;// Copyright (c) Facebook, Inc. and its affiliates.
//
// This source code is licensed under the MIT license found in the
// LICENSE file in the root directory of this source tree.
//
// A test that uses built-in contracts for the Vec struct.
#[macro_use]
extern crate... | Rust | 0 |
u64;
type BlockNumber = BlockNumber;
type Call = Call;
type Hash = H256;
type Hashing = ::sp_runtime::traits::BlakeTwo256;
type AccountId = AccountId;
type Lookup = IdentityLookup<Self::AccountId>;
type Header = Header;
type Event = Event;
type BlockHashCount = BlockHashCount;
type BlockWeights = ();
type B... | Rust | 0 |
# with open("my_file.txt") as file:
# contents = file.read()
# print(contents)
# with open("new_file.txt", mode="w") as file:
# file.write("\nNew text.")
#########################################
# with open("/Users/robin/OneDrive/Desktop/my_file.txt") as file:
# contents = file.read()
# print(co... | Python | 1 |
ect_name = Name(vec![String::new(), project.project.name.clone()]);
let project_tests_name = Name(vec![String::new(), project.project.name.clone(), "tests".to_string()]);
let mut modules = HashMap::new();
let features = project.features(variant).into_iter().map(|(n,(e,_))|(n,e)).collect();
if... | Rust | 0 |
_bakedchar,
mut pw: i32,
mut ph: i32,
mut char_index: i32,
mut xpos: *mut f32,
mut ypos: *mut f32,
mut q: *mut stbtt_aligned_quad,
mut opengl_fillrule: i32,
) {
let mut d3d_bias: f32 = if (opengl_fillrule) != 0 {
((0) as f32)
} else {
-0.5f32
};
let mut ipw: f... | Rust | 0 |
import re
from datetime import datetime
class Task:
def __init__(self, id, description):
self.id = id
self.description = description
self.status = "pending"
self.result = None
self.created_at = datetime.now()
self.completed_at = None
self.failed_at = None
... | Python | 1 |
ataType::Float64, true),
Field::new("LOWER60SECAPCFLAG", DataType::Int16, true),
Field::new("LOWER5MINRRP", DataType::Float64, true),
Field::new("LOWER5MINROP", DataType::Float64, true),
Field::new("LOWER5MINAPCFLAG", DataType::Int16, true),
Field::new("LOWERR... | Rust | 0 |
lishes telemetry to honeycomb.io using the provided honeycomb config.
///
/// Specialized to the honeycomb.io-specific SpanId and TraceId provided by this crate.
pub fn new_honeycomb_telemetry_layer(
service_name: &'static str,
honeycomb_config: libhoney::Config,
) -> (
TelemetryLayer<HoneycombTelemetry<Lib... | Rust | 0 |
import discord
class URLView(discord.ui.View):
def __init__(self, label: str, jump_url: str) -> None:
super().__init__(timeout=None)
self.label: str = label
self.jump: str = jump_url
button: discord.ui.Button = discord.ui.Button(
label=str(self.label), style=discord.Bu... | Python | 1 |
ub enum Origin for Test {}
}
// For testing the module, we construct most of a mock runtime. This means
// first constructing a configuration type (`Test`) which `impl`s each of the
// configuration traits of modules we want to use.
#[derive(Clone, Eq, PartialEq)]
pub struct Test;
parameter_types! {
pub const... | Rust | 0 |
pub const GLX_DRAWABLE_TYPE: libc::c_int = 0x8010 as libc::c_int;
pub const GLX_WINDOW_BIT: libc::c_int = 0x1 as libc::c_int;
pub const GLX_RED_SIZE: libc::c_int = 8 as libc::c_int;
pub const GLX_GREEN_SIZE: libc::c_int = 9 as libc::c_int;
pub const GLX_BLUE_SIZE: libc::c_int = 10 as libc::c_int;
pub const GLX_ALPHA_SI... | Rust | 0 |
rds such as 'if' or 'else'
Keyword(Keyword),
/// // Lorem Ipsum
Comment,
/// "+"
Plus,
/// "-"
Minus,
/// "*"
Star,
/// "/"
Slash,
/// "%"
Percent,
/// ":"
Colon,
/// ";"
SemiColon,
/// "."
Dot,
/// "!"
Exclamation,
/// ","
Comm... | Rust | 0 |
)
};
( disable_minify $cm:expr, $etag_if_none_match:expr, $name:expr ) => {
{
use ::std::collections::HashMap;
let map: HashMap<u8, u8> = HashMap::new();
$crate::tera_response!(disable_minify $cm, $etag_if_none_match, $name, map)
}
};
( disab... | Rust | 0 |
Ok(Self::from(msp))
}
}
impl<I1: From<i32>> From<&MonotoneSpanProgram<i32>> for MonotoneSpanProgram<I1> {
fn from(msp: &MonotoneSpanProgram<i32>) -> Self {
Self {
nb_row: msp.nb_row,
nb_col: msp.nb_col,
attr_to_row: msp.attr_to_row.clone(),
row_t... | Rust | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.