text string | label_name string | labels int64 |
|---|---|---|
"""运行实时控制"""
if not self.connected or self.active_servo is None:
print("请先连接并设置舵机")
return
print("开始实时速度控制...")
print("💡 按 'h' 查看控制帮助,按 'q' 安全退出,按 'e' 紧急停止")
try:
self.setup_terminal()
self.running = True
se... | Python | 1 |
# Copyright 2016 Google Inc. All Rights Reserved.
#
# 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 or agree... | Python | 1 |
Audio>,
music: Res<AudioAssets>,
) {
let window = windows.get_primary().unwrap();
if let Some(cursor) = cursor_pos(window, main_camera.single().unwrap()) {
let mut player_data = player_data.single_mut().unwrap();
let transform = queries.q1().single().unwrap();
if overlap(cursor.xyz(... | Rust | 0 |
h help of any async timer
/// (for accuracy recommended delay should be at least 100 ms),
/// call this method once again and subtract former [`CpuUsage`] from the new one.
///
/// Same to any *nix system, calculated CPU usage might exceed 100 %
/// if the process is running multiple threads on diff... | Rust | 0 |
struct DateLimitExceeded;
// OpeningHours
#[derive(Clone, Debug)]
pub struct OpeningHours {
/// Rules describing opening hours
rules: Vec<RuleSequence>,
/// The sorted list of holidays
holidays: &'static UniqueSortedVec<NaiveDate>,
}
impl OpeningHours {
/// Init a new TimeDomain with the given s... | Rust | 0 |
box("Unusual Fatigue",
options=["None", "Mild", "Moderate", "Severe"])
with col2:
nausea = st.selectbox("Nausea", options=["No", "Yes"])
sweating = st.selectbox("Unexplained Sweating",
options=["No", "Mild", "Moderate", "Severe"])
... | Python | 1 |
)
def create_spot_check_sessions_for_strong_learners(df_self_report):
needs = {}
for card_title, pod_skill_name in card_name_skill_name_mapping.items():
nice_skill_name = get_skill_name_from_pod_column_name(pod_skill_name)
needs[nice_skill_name] = {}
strong_learners ... | Python | 1 |
result += size_of_val(&self.near_clipping_plane);
result += size_of_val(&self.target_position);
if self.translation.is_some() {
result += 4;
result += self.translation.as_ref().unwrap().total_bytes_size();
}
if self.rotation.is_some() {
result += 4;
... | Rust | 0 |
nccontext: *const WS_ASYNC_CONTEXT, error: *const WS_ERROR) -> ::windows_sys::core::HRESULT>;
#[doc = "*Required features: `\"Win32_Networking_WindowsWebServices\"`*"]
pub type WS_SET_CHANNEL_PROPERTY_CALLBACK = ::core::option::Option<unsafe extern "system" fn(channelinstance: *const ::core::ffi::c_void, id: WS_CHANNEL... | Rust | 0 |
VotePromise:
amount: int
unlock_block: int
def gen_all_vote_promises():
amount_list = [100 * BASE, 200 * BASE, 300 * BASE, 400 * BASE]
unlock_block_list = [
ONE_QUARTER_BLOCKS,
2 * ONE_QUARTER_BLOCKS,
3 * ONE_QUARTER_BLOCKS,
4 * ONE_QUARTER_BLOCKS,
]
return [Vote... | Python | 1 |
r.get("/lines/{chapter_id}", response_model=Res[List[LineResponseDTO]],
summary="查询章节下的所有台词",
description="根据章节id查询章节下的所有台词信息")
def get_all_lines(chapter_id: int, line_service: LineService = Depends(get_line_service)):
entities = line_service.get_all_lines(chapter_id)
if entities:
... | Python | 1 |
64Dp3Src {
Ra: 31,
Rd: 8,
Rm: 0,
Rn: 2
}
);
// umulh x9, x9, x11
assert_eq!(
decode_root_unwrap(0x9BCB7D29),
InstructionKind::UMULH64Dp3Src {
Ra: 31,
Rd: 9,
Rm: 11,
Rn: 9
}
);
... | Rust | 0 |
DRAM Address bit (A8)"]
#[inline(always)]
pub fn mux_a8_0(self) -> &'a mut W {
self.variant(MUX_A8_A::MUX_A8_0)
}
#[doc = "NAND CE#"]
#[inline(always)]
pub fn mux_a8_1(self) -> &'a mut W {
self.variant(MUX_A8_A::MUX_A8_1)
}
#[doc = "NOR CE#"]
#[inline(always)]
pub... | Rust | 0 |
stages = [r'''
+---+
| |
O |
/|\ |
/ \ |
|
=========
''', r'''
+---+
| |
O |
/|\ |
/ |
|
=========
''', r'''
+---+
| |
O |
/|\ |
|
|
=========
''', r'''
+---+
| |
O |
/| |
|
|
=========''', r'''
+---+
| |
O |
| |
... | Python | 1 |
## Utility function
data = [20,30,40]
other_longer_data = [1,2,3,4,5,6,7,8,4]
# -----
# | 20 |
# -----
# | 30 |
# -----
# | 40 |
## DEFINITION
#####################
def printDataTable(data):
for i in range(len(data)):
print("------")
print(f"|{data[i]:^4}|")
print("-----")
printDataTabl... | Python | 1 |
# Print Longest Common Subsequence
# https://www.geeksforgeeks.org/printing-longest-common-subsequence/
x = "abcdaf"
y = "acbcf"
x = "AGGTAB"
y = "GXTXAYB"
x = "ABCDGH"
y = "AEDFHR"
n = len(x)
m = len(y)
dp = []
"""
# More Time Consumed
for i in range(n+1):
a = []
for j in range(m+1):
if(i==0 or j==0... | Python | 1 |
{
return match lex_4_25::next_token(input, current_ptr) {
lex_4_25::Token::Identifier(name) => NonTerminal::Identifier(name),
_ => NonTerminal::Identifier("".to_string()).to_invalid()
}
}
pub fn next_token(input: &Vec<char>, current_ptr: &mut usize) -> NonTerminal {
... | Rust | 0 |
) -> io::Result<Config> {
let file = File::open(path)?;
let mut buf_reader = BufReader::new(file);
let mut contents = String::new();
buf_reader.read_to_string(&mut contents)?;
Ok(toml::from_str(&contents).expect("Given configuration file contains errors."))
}
}
<filename>src/... | Rust | 0 |
scent: ArenaRef<dyn Ascent>) -> Self {
Self {
ascent,
}
}
}
impl Ascent for AscentOption {
fn ascent(&self, parse: &mut Parse, nodes: Vec<CNode>) -> Option<Vec<CNode>> {
parse.ascent(self.ascent, nodes.clone()).or(Some(nodes))
}
}
pub struct AscentElement {
element:... | Rust | 0 |
import numpy as np
import matplotlib.pyplot as plt
data = np.array([2.0, 3.0, 1.5,
3.0, 3.5, 2.0,
3.5, 3.0, 2.5,
8.0, 8.0, 7.5,
8.5, 8.5, 8.0,
9.0, 8.0, 8.5,
1.0, 2.0, 1.0,
1.5, 2.5, 1.5])
data = np.... | Python | 1 |
# Copyright 2021 The Couler Authors. All rights reserved.
# 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 or... | Python | 1 |
se pinwheel::prelude::*;
#[derive(builder, children, Default, new)]
#[new(default)]
pub struct Document {
#[builder]
pub client: Option<&'static str>,
pub children: Vec<Node>,
}
impl Component for Document {
fn into_node(self) -> Node {
let head = head()
.child(meta().attribute("charset", "utf-8"))
.child... | Rust | 0 |
value, low, high
),
Self::DHGenRetry => write!(f, "the generation of DH parameters should be retried"),
Self::DHGenFail => write!(f, "the generation of DH parameters failed"),
Self::InvalidNonceHash { got, expected } => write!(
f,
"i... | Rust | 0 |
};
assert_eq!(b.validate(), Err(Error::from("timestamp 5 is greater than the batch since: Description { lower: Antichain { elements: [1] }, upper: Antichain { elements: [2] }, since: Antichain { elements: [4] } }")));
// Invalid update
let b: BlobTraceBatchPart = BlobTraceBatchPart {
... | Rust | 0 |
_size.x / 2. + 0.1,
ball_pos.y,
));
}
// Right Paddle
let (ball_pos, paddle_pos) = (ball.position(), right_paddle.position());
if ball_pos.x + ball_radius > paddle_pos.x - paddle_size.x / 2.
&& ball_pos.x + ball_radius ... | Rust | 0 |
nsionsLessThan1,
/// The product of `width` and `height` exceeds `std::i32::MAX`.
DimensionsTooLarge,
}
impl std::error::Error for ErrorKind {}
impl std::fmt::Display for ErrorKind {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match &self {
ErrorKind::Dimension... | Rust | 0 |
from sklearn.cluster import KMeans
import numpy as np
def get_image_dominant_color(image, k=3, color_ranges=None):
"""
Finds the dominant color in an image, excluding specified colors.
:param image: Image from which to extract the dominant color.
:param k: Number of clusters for KMeans.
:param colo... | Python | 1 |
cont = 0
soma = 0
while soma < 100:
cont += 1
soma += cont
print(cont)
cont += 1
print(soma) | Python | 1 |
"""Helper module to factorize the conditional multiprocessing import logic
We use a distinct module to simplify import statements and avoid introducing
circular dependencies (for instance for the assert_spawning name).
"""
import os
import warnings
# Obtain possible configuration from the environment, assuming 1 (on... | Python | 1 |
# PROGRAM OF CONTACT BOOK
contact={}
def display_contact():
print("Name\t\tContact Number")
for key in contact:
print("{}\t\t{}".format(key,contact.get(key)))
while True:
choice=int(input("1. Add New Contact \n 2. Search Contact \n 3. Display Contact\n 4. Edit Contact \n 5. Delete Contact \n... | Python | 1 |
DbWeight::get().reads(12 as Weight))
.saturating_add(RocksDbWeight::get().reads((1 as Weight).saturating_mul(n as Weight)))
.saturating_add(RocksDbWeight::get().writes(6 as Weight))
}
// Storage: Staking Ledger (r:1 w:0)
// Storage: Staking Validators (r:1 w:0)
// Storage: Staking Nominators (r:1 w:1)
// Sto... | Rust | 0 |
, Result<(), TunnelError>>;
}
pub trait Sided {
fn side(&self) -> TunnelSide;
}
impl<T: std::ops::Deref> Sided for T
where
T::Target: Sided,
{
fn side(&self) -> TunnelSide {
self.deref().side()
}
}
pub trait TunnelUplink: Sided {
fn addr(&self) -> TunnelAddressInfo {
TunnelAddressInfo::Unidentified... | Rust | 0 |
#[repr(C)]
#[derive(Debug, Clone, PartialEq)]
pub struct Vector3 {
pub x: f32,
pub y: f32,
pub z: f32,
}
impl Default for Vector3 {
fn default() -> Self {
Self {
x: 0.,
y: 0.,
z: 0.,
}
}
}
impl Vector3 {
pub fn new() -> Self {
Self::d... | Rust | 0 |
Closure::wrap(Box::new(move |_| this.run()) as Box<dyn FnMut(JsValue)>)
};
*this.inner.borrow_mut() = Some(Inner { future, closure });
// Queue up the Future's work to happen on the next microtask tick.
crate::queue::QUEUE.with(move |queue| queue.schedule_task(this));
}
... | Rust | 0 |
ormalize_rewards == True:
env = NormalizeVecRewardWrapper(env)
if normalize_obs == True:
env = NormalizeVecObsWrapper(env)
env_suite["BernoulliBandit-misc"] = EnvSuiteParams(
name="BernoulliBandit-misc",
env=env
)
if "GaussianB... | Python | 1 |
import numpy as np
import matplotlib.pyplot as plt
from scipy.integrate import odeint
import tclab
import time
n = 300 # Number of second time points (5 min)
# collect data if TCLab is connected
try:
lab = tclab.TCLab()
T1 = [lab.T1]
lab.Q1(75)
for i in range(n):
time.sleep(1)
print(... | Python | 1 |
c\xc2\x0eBS\x1cT\x06^!\x00`\
\xa1\xaau\x86\xb4R%S\x90\xd9\xf1\x85ES\x94\xe7\
f\xef;\xc7\xec\x18\xdat0\x1e\x92v\xce6\xa0\xfd\
\x80|`Z\x0d\xe8\x8c\x98/\xd0G/\x18\x1f=\x8f\
O\xbf\xc9w\xda\xdf>\xb0r\xbc=\x90\xa7\xf3rq\
y\x8f\xfe\xc3\xaa\xfe\xd9\xceu_\xf1+\xfft\xf8Y\
\x8d\x1c\xae\x88\xaf\xdc\xd8?\xd6=\x9e\x1e\xc9\xf7\x7f\xb... | Python | 1 |
channel_mlp_dropout=channel_mlp_dropout,
channel_mlp_expansion=channel_mlp_expansion,
norm=norm,
skip=skip,
separable=separable,
preactivation=preactivation,
factorization=factorization,
rank=rank,
fixed_rank_mo... | Python | 1 |
ple_part2() {
let input_string = "abc\n\na\nb\nc\n\nab\nac\n\na\na\na\na\n\nb";
// this time, with bit fiddling!
let mut group_answers_bitwise_and = Vec::<u32>::new();
for group_str in input_string.split("\n\n") {
println!("checking grp:\n{}", group_str);
let mut answers_binary = Vec::... | Rust | 0 |
` window loop, using
//! `glium` to render the `conrod_core::render::Primitives` to screen.
#[macro_use] extern crate conrod_core;
extern crate conrod_glium;
extern crate conrod_winit;
extern crate find_folder;
extern crate glium;
mod support;
use conrod_core::{widget, Colorable, Positionable, Widget};
use glium::Su... | Rust | 0 |
}
}
}
unreachable!()
}
fn part2(input: (Vec<u32>, Vec<Board>)) -> u32 {
let (numbers, mut boards) = input;
let mut boards_won = vec![false; boards.len()];
for num in numbers {
for (i, board) in boards.iter_mut().enumerate() {
if boards_won[i] {
... | Rust | 0 |
mal::{BigDecimal, ToPrimitive};
use chrono::{NaiveDate, NaiveDateTime};
use serde::ser::{SerializeStruct, Serializer};
use serde::Serialize;
pub mod schema;
use schema::{auth_user, budgets_budget, records_record};
#[derive(Queryable, Serialize, Debug, Clone, PartialEq, Insertable)]
#[table_name = "auth_user"]
pub str... | Rust | 0 |
# Copyright 2023 Google LLC
#
# 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 or agreed to in writing, s... | Python | 1 |
nt_1_key = Key::Account(ACCOUNT_1_ADDR);
let account_2_key = Key::Account(ACCOUNT_2_ADDR);
let global_state = InMemoryGlobalState::empty().unwrap();
let engine_state = EngineState::new(global_state);
// Run genesis
let (genesis_request, contracts) =
test_support::create_genesis_request(GE... | Rust | 0 |
violet-600", "typography"),
("text-violet-700", "typography"),
("text-violet-800", "typography"),
("text-violet-900", "typography"),
("text-white", "typography"),
("text-xl", "typography"),
("text-xs", "typography"),
("text-yellow-100", "typography"),
("te... | Rust | 0 |
d {
name: msg.name.clone(),
participant_type: msg.participant_type.clone(),
});
}
for elem in self.directors.read().unwrap().values() {
if let Some(addr) = &elem.addr {
addr.do_send(game_to_director::Disconnected {
name: msg.name.clone(),
participant_type: msg.participant_type.clone(),
... | Rust | 0 |
produce the compressed data.",
JPEGInterchangeFormat | 0x201 => "This Field indicates whether a JPEG interchange format bitstream is present in the TIFF file",
JPEGInterchangeFormatLength | 0x202 => "This Field indicates the length in bytes of the JPEG interchange format bitstream.",
JPEGRestartInterval | ... | Rust | 0 |
"Həmd (şükür və tə\'rif) olsun Allaha (və ya: Həmd məxsusdur Allaha) - aləmlərin Rəbbinə,",
Language::Azerbaijani
);
}
#[test]
fn test_azerbaijani_3() {
test_expected_language(
Lingo::new(),
" (Bu dünyada hamıya) mərhəmətli, (axirətdə isə anca... | Rust | 0 |
import sys
sys.stdin = open("input.txt", "r")
T = int(input())
for test_case in range(1, T + 1):
sum_buffer = 0
sum_list = []
N, M = map(int, input().split())
ballon_list = []
for _ in range(N):
ballon_list.append(list(map(int, input().split())))
dx = [0, 0, 1, -1] # 우 좌 하 상
dy =... | Python | 1 |
def _build_prompt(self, prompts, tgt_subjects, prompt_strength=1.0,
prompt_reps=20):
rv = []
for prompt, tgt_subject in zip(prompts, tgt_subjects):
prompt = f'a {tgt_subject} {prompt.strip()}'
rv.append(', '.join([prompt] * int(prompt_strength * prompt_reps)))
return rv
| Python | 1 |
import streamlit as st
import datetime
from snowflake.snowpark import Session
import sys
from commons import CommonObjects
# import _snowflake
import pandas as pd
from snowflake.snowpark.context import get_active_session
import json
import snowflake.snowpark.exceptions
st.set_page_config(
page_title="Capi-AP... | Python | 1 |
ete(&self, user: &User) -> Result<User, DataStoreError> {
let user = user.delete()?;
Ok(user)
}
fn update_password(&self, user: &User) -> Result<User, DataStoreError> {
let user = user.update_password()?;
Ok(user)
}
fn folders(&self, user: &User) -> Result<Vec<Folder>... | Rust | 0 |
import threading
from typing import TYPE_CHECKING
import pandas as pd
from hummingbot.client.ui.interface_utils import format_df_for_printout
from hummingbot.core.data_type.common import PriceType
from hummingbot.core.utils.async_utils import safe_ensure_future
if TYPE_CHECKING:
from hummingbot.client.hummingbot... | Python | 1 |
group=pg)
else:
pg.broadcast_obj(handle, writer_rank)
else:
if isinstance(pg, ProcessGroup):
recv = [None]
dist.broadcast_object_list(recv,
src=global_ranks[writer_rank],
... | Python | 1 |
"""風險管理面板組件
此模組提供風險管理相關的面板組件,包括:
- 風險概覽面板
- 控制面板組件
- 警報面板
- 狀態指示面板
Author: AI Trading System
Version: 1.0.0
"""
from typing import Dict, Any, List, Optional
import streamlit as st
from datetime import datetime
def risk_overview_panel(metrics: Dict[str, Any], title: str = "風險概覽") -> None:
"""風險概覽面板
Args:
... | Python | 1 |
self.num_sectors
}
/// Processes the `request` execution result, writes its status in memory and returns the used
/// length (i.e. the total number of bytes written into the memory buffer, including the status
/// byte).
///
/// # Arguments
/// * `mem` - A reference to the guest mem... | Rust | 0 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from fastapi import APIRouter
from backend.app.admin.api.v1.auth import router as auth_router
from backend.app.admin.api.v1.log import router as log_router
from backend.app.admin.api.v1.monitor import router as monitor_router
from backend.app.admin.api.v1.sys import route... | Python | 1 |
;
let year = 1999;
let res = "Sunday".to_string();
assert_eq!(Solution::day_of_the_week(day, month, year), res);
let day = 15;
let month = 8;
let year = 1993;
let res = "Sunday".to_string();
assert_eq!(Solution::day_of_the_week(day, month, year), res);
}
<reponame>xkr47/pcm-bit-detect
us... | Rust | 0 |
2021 TiKV Project Authors. Licensed under Apache-2.0.
#![feature(test)]
use concurrency_manager::ConcurrencyManager;
use criterion::*;
use futures::executor::block_on;
use rand::prelude::*;
use std::{borrow::Cow, hint::black_box, mem::forget};
use txn_types::{Key, Lock, LockType, TsSet};
const KEY_LEN: usize = 64;
... | Rust | 0 |
for i in range(0, tgt_pil_image_list.size()[0] - stride, stride):
frame1 = tgt_pil_image_list[i]
frame2 = tgt_pil_image_list[i + stride]
frame1_flat = frame1.contiguous().view(-1)
frame2_flat = frame2.contiguous().view(-1)
cos_sim = F.cosine_similarity(fram... | Python | 1 |
tb0cctl2::W) writer structure"]
impl crate::Writable for TB0CCTL2 {}
#[doc = "Timer_B Capture/Compare Control Register"]
pub mod tb0cctl2;
#[doc = "Timer_B Capture/Compare Control Register\n\nThis register you can [`read`](crate::generic::Reg::read), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::... | Rust | 0 |
fn If(props: IfProps) {
if props.condition {
rsx! {
<>
{children}
</>
}
}
}
<reponame>Eric-Arellano/rust
// issue 7327
use std::sync::Arc;
struct A { y: Arc<isize>, x: Arc<isize> }
impl Drop for A {
fn drop(&mut self) { println!("x={}", *self.x); }... | Rust | 0 |
= Value::read(&mut buffer.as_slice()).await?;
assert_eq!(ex, value);
Ok(())
}
<reponame>0x75960/cid-rs
extern crate crypto;
use std::fs::File;
use std::io::Result;
use std::io::prelude::*;
use self::crypto::digest::Digest;
use self::crypto::md5::Md5;
use self::crypto::sha1::Sha1;
use self::crypto::sha2::Sha2... | Rust | 0 |
# IfcOpenShell - IFC toolkit and geometry engine
# Copyright (C) 2021 Dion Moult <dion@thinkmoult.com>
#
# This file is part of IfcOpenShell.
#
# IfcOpenShell is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundat... | Python | 1 |
.unsafe_cast()
}
}
}
pub trait UnixSocketAddressExtManual {
fn get_path(&self) -> Option<UnixSocketAddressPath>;
}
impl<O: IsA<UnixSocketAddress>> UnixSocketAddressExtManual for O {
fn get_path(&self) -> Option<UnixSocketAddressPath> {
use self::UnixSocketAddressPath::*;
... | Rust | 0 |
g(yscrollcommand=vscrollbar.set)
# ==================== 7行目
if self.mode == "add":
btn_add = ttk.Button(self.sub_window, text="追加")
btn_add.grid(row=6, column=1, padx=5, pady=5, sticky=tk.E)
btn_add.config(command=self.add)
else:
btn_update = ttk.... | Python | 1 |
gers
def process_batch_projects(self):
"""Delegate to batch creation manager"""
return self.batch_manager.process_batch_projects()
def _handle_enhanced_batch_creation(self, project_names):
"""Delegate to batch creation manager"""
return self.batch_manager.handle_enhanced_bat... | Python | 1 |
}
test!(b'a', b'A');
test!(b'A', b'A');
test!(b'!', b'!');
test!('a', 'A');
test!('à', 'à');
test!('A', 'A');
test!('!', '!');
test!(b"h\xc3\xa9".to_vec(), b"H\xc3\xa9");
test!("hıKß".to_string(), "HıKß");
let mut x = "Hello".to_st... | Rust | 0 |
onic::Pha
| Mnemonic::Cli
| Mnemonic::Pla
| Mnemonic::Sei
| Mnemonic::Txa
| Mnemonic::Txs
| Mnemonic::Tya
| Mnemonic::Tay
| Mnemonic::Clv
| Mnemonic::Cld
| Mnemonic::Sed
| Mnemonic::Nop =>... | Rust | 0 |
natomicalFormCode_WHOLE_MUSCLE_STEAK_CHOPCUT, "AnatomicalFormCode-WHOLE_MUSCLE_STEAK_CHOPCUT",
/// `Whole Muscle Subprimal`:
AnatomicalFormCode_WHOLE_MUSCLE_SUBPRIMAL, "AnatomicalFormCode-WHOLE_MUSCLE_SUBPRIMAL",
/// `Award Prize`: Describes a prize or award won by a product or organization.
AwardPrize... | Rust | 0 |
def process_sequence_item(self, sequence: Any):
is_batched = isinstance(sequence, np.ndarray) and len(sequence.shape) == 4
if is_batched:
updated_states = self.update(sequence)
else:
updated_states = [self.update(sequence)]
for updated_state in updated_states:
self.check_updated_... | Python | 1 |
Graph::new(first_out, head, weight)
}
}
impl<G: LinkIterable<Link>> BuildReversed<G> for OwnedGraph {
fn reversed(graph: &G) -> Self {
// vector of adjacency lists for the reverse graph
let mut reversed: Vec<Vec<Link>> = (0..graph.num_nodes()).map(|_| Vec::<Link>::new()).collect();
// ... | Rust | 0 |
import numpy as np
from core.generatebase import ChunkandGenerate
from core.embedding_model import EmbeddingModel
from core.logger import setup_logger
logger = setup_logger('chunk_embed_rank', 'log/chunk_embed_rank.log')
class ChunkEmbedRank(ChunkandGenerate):
"""
Inherits text chunking and provides embedding... | Python | 1 |
self, value: u8) -> &'a mut W {
self.w.bits = (self.w.bits & !0x3f) | ((value as u32) & 0x3f);
self.w
}
}
impl R {
#[doc = "Bits 0:5 - 0: Default to 0 1: Default to 1"]
#[inline(always)]
pub fn iomux_main_default_in_1(&self) -> IOMUX_MAIN_DEFAULT_IN_1_R {
IOMUX_MAIN_DEFAULT_IN_1_... | Rust | 0 |
struct Vibration {
pub w_left_motor_speed: u16,
pub w_right_motor_speed: u16,
}
impl Into<winapi::XINPUT_VIBRATION> for Vibration {
fn into(self) -> winapi::XINPUT_VIBRATION {
winapi::XINPUT_VIBRATION {
wLeftMotorSpeed: self.w_left_motor_speed,
wRightMotorSpeed: self.w_righ... | Rust | 0 |
32 => "WRIT-2110",
65196u32 => "WRIT-2110",
65371u32 => "WRIT-2110",
65393u32 => "WRIT-2110",
65394u32 => "WRIT-2110",
63521u32 => "WRIT-2310",
63636u32 => "WRIT-2320",
63522u32 => "WRIT-2330",
64514u32 => "WRIT-2340",
64515u32 => "WRIT-2340",
65050u32 => "WRIT-4170",
};<filename>src/system_time.rs
// http://... | Rust | 0 |
_extras:
line = re.sub(r"\[.+?\]", "", line)
if not self.annotate:
return line
# Annotate what packages or reqs-ins this package is required by
required_by = set()
if hasattr(ireq, "_source_ireqs"):
required_by |= {
_comes_from_as_str... | Python | 1 |
t
def ouiParse(self):
"""
generate a oui to company lookup dict
"""
HexOui= {}
Hex = re.compile('.*(hex).*')
#matches the following example "00-00-00 (hex)\t\tXEROX CORPORATION"
ouiLines = self.ouiRaw
for line in ouiLines:
if Hex.s... | Python | 1 |
all axes
bbox = rot_axes_1.get_position()
x_center = (bbox.x0 + bbox.x1) / 2
kitti_fig.suptitle("Per-frame Motion Error on KITTI $00$", x=x_center, ha='center')
bbox = rot_axes_2.get_position()
x_center = (bbox.x0 + bbox.x1) / 2
omd_fig.suptitle("Per-frame Motion Error on OMD (S4U)", x=x_center, ha='center')
# ro... | Python | 1 |
required for txn: {}, gas submitted: {}",
min_txn_fee.get(),
txn.max_gas_amount()
);
warn!(
"[VM] Gas unit error; min {}, submitted {}",
min_txn_fee.get(),
txn.max_gas_amount()
);
return Err(... | Rust | 0 |
xpool0)
maxpool1 = self.maxpool1(X_10)
X_20 = self.conv20(maxpool1)
maxpool2 = self.maxpool2(X_20)
X_30 = self.conv30(maxpool2)
maxpool3 = self.maxpool3(X_30)
X_40 = self.conv40(maxpool3)
# column : 1
X_01 = self.up_concat01(X_10, X_00)
X_11 = sel... | Python | 1 |
mask_pred_list = []
for mix_x in mix_x_list:
mask_feats = self.mask_roi_extractor(
mix_x[:len(self.mask_roi_extractor.featmap_strides)], mask_rois)
mask_pred = self.mask_head(mask_feats)
mask_pred_list.append(mask_pred)
... | Python | 1 |
"{2, 3, 2} -> 22, {2, 3, 3} -> 23, {2, 3, 4} -> 24" \
"}, {2, 3, 4}]"
def test_Integral():
assert mcode(Integral(sin(sin(x)), x)) == "Hold[Integrate[Sin[Sin[x]], x]]"
assert mcode(Integral(exp(-x**2 - y**2),
(x, -oo, oo),
(y, -oo, oo))) == \
... | Python | 1 |
print("Pierwsza linijka")
print("druga linijkaaaa")
print("druga linijka")
| Python | 1 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = '古溪'
import numpy as np
from shapely.geometry import Polygon
"""
:param det_x: [1, N] Xs of detection's vertices
:param det_y: [1, N] Ys of detection's vertices
:param gt_x: [1, N] Xs of groundtruth's vertices
:param gt_y: [1, N] Ys of groundtruth's vertices... | Python | 1 |
()
)),
}
}
pub(crate) fn error_from_strmessage(message: &str) -> Option<OfferError> {
let index_start = message.find(|c: char| c == '(')?;
let index_end = message.find(|c: char| c == ')')?;
let number = message
.chars()
.skip(index_start + 1)
.take(index_end - index_sta... | Rust | 0 |
finition});"
cursor.execute(create_table_query)
conn.commit()
print(f"Table '{table_name}' created successfully.")
except sqlite3.Error as e:
print(f"Error: {e}")
conn.rollback()
finally:
conn.close()
def delete_database(database_path):
try:
... | Python | 1 |
@kernel_method
def connect_stdin(self, kernel_id, identity=None):
"""Return a zmq Socket connected to the stdin channel.
Parameters
==========
kernel_id : uuid
The id of the kernel
identity : bytes (optional)
The zmq identity of the socket
... | Python | 1 |
M = circuit.find("./comp/[@name='ROM']")
ROM[2].text = "addr/data: 14 32\n" + rom_instructions
constant = circuit.find("./comp/[@name='Constant']")
constant[1].attrib["val"] = hex(test_num_cycles)
cpu_lib = root.find("./lib/[@desc='file#cpu.circ']")
cpu_lib.attrib["desc"] = "file#../../.... | Python | 1 |
# -*- coding: utf8 -*-
# Copyright (c) 2017-2021 THL A29 Limited, a Tencent company. All Rights Reserved.
#
# 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... | Python | 1 |
omps[1])
if secret_id not in secret_id_lookup:
skipped_attachments.append(full_path)
logging.warning('Secret ID [%d] does not exist in %s', secret_id, CSV_FILENAME)
continue
title = secret_id_lookup[secret_id].casefold()
record = None
if title in dupl... | Python | 1 |
w=1, column=0, padx=5, pady=5, sticky="w")
prefix_menu = tk.Entry(frame_settings, textvariable=prefix_var, width=25, relief="flat", highlightthickness=1, highlightbackground="#536d6c", highlightcolor="#536d6c")
prefix_menu.grid(row=1, column=1, padx=5, pady=5)
prefix_hint_label = tk.Label(frame_settings, text="SS, man... | Python | 1 |
# swift_build_support/products/xctest.py -------------------------*- python -*-
#
# This source file is part of the Swift.org open source project
#
# Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
# Licensed under Apache License v2.0 with Runtime Library Exception
#
# See https://swift.org/LICENSE.t... | Python | 1 |
te(create) => {
create.process(fluvio).await?;
}
Self::Delete(delete) => {
delete.process(fluvio).await?;
}
Self::List(list) => {
list.process(out, fluvio).await?;
}
}
Ok(())
}
}
#[derive(Deb... | Rust | 0 |
This gives an effective key size of 56 bits
Des = 0xA0000011,
/// 128 or 192 bits including the parity bits. This gives effective key sizes of 112 or 168 bits
Des3 = 0xA0000013,
/// Between 64 and 512 bits, multiple of 8 bits
HmacMd5 = 0xA0000001,
/// Between 80 and 512 bits, multiple of 8 bits... | Rust | 0 |
import torch
import matplotlib.pyplot as plt
import numpy as np
"""
Dynamical system excitation
response of two tank system to step and PRBS input signals
"""
# Define system parameters
A = 1.0 # Cross-sectional area of tanks
a1 = 0.1 # Valve coefficient between tanks
a2 = 0.1 # Valve coefficient for tank 2 ou... | Python | 1 |
,
D3DSIO_EXPP = 78,
D3DSIO_LOGP = 79,
D3DSIO_CND = 80,
D3DSIO_DEF = 81,
D3DSIO_TEXREG2RGB = 82,
D3DSIO_TEXDP3TEX = 83,
D3DSIO_TEXM3x2DEPTH = 84,
D3DSIO_TEXDP3 = 85,
D3DSIO_TEXM3x3 = 86,
D3DSIO_TEXDEPTH = 87,
D3DSIO_CMP = 88,
D3DSIO_BEM = 89,
D3DSIO_DP2ADD = 90,
D3... | Rust | 0 |
:c_uint {
unsafe { ::std::mem::transmute(self._bitfield_1.get(4usize, 1u8) as u32) }
}
#[inline]
pub fn set_report_delay(&mut self, val: ::std::os::raw::c_uint) {
unsafe {
let val: u32 = ::std::mem::transmute(val);
self._bitfield_1.set(4usize, 1u8, val as u64)
... | Rust | 0 |
or CommitmentPrefix {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
format!("{:?}", self).serialize(serializer)
}
}
use crate::commands::WholeStreamCommand;
use crate::context::CommandRegistry;
use crate::prelude::*;
use nu_errors::ShellEr... | Rust | 0 |
return which;
}
unsafe extern "C" fn find_biggest_volume(mut boxlist: boxptr, mut numboxes: libc::c_int) -> boxptr
/* Find the splittable box with the largest (scaled) volume */
/* Returns NULL if no splittable boxes remain */ {
let mut boxp: boxptr = 0 as *mut box_0;
let mut i: libc::c_int = 0;
let mut m... | Rust | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.