text string | label_name string | labels int64 |
|---|---|---|
(0, Junctions::X6(ref a, ..)) => a,
(0, Junctions::X7(ref a, ..)) => a,
(0, Junctions::X8(ref a, ..)) => a,
(1, Junctions::X2(_, ref a)) => a,
(1, Junctions::X3(_, ref a, ..)) => a,
(1, Junctions::X4(_, ref a, ..)) => a,
(1, Junctions::X5(_, ref a, ..)) => a,
(1, Junctions::X6(_, ref a, ..)) => ... | Rust | 0 |
import numpy as np
arr = np.arange(10, 50)
print(arr)
| Python | 1 |
ock:
# print(subsample_initial_block, maxpool_initial_block)
x = BatchNormalization(axis=concat_axis, epsilon=1.1e-5)(x)
x = Activation('relu')(x)
x = MaxPooling3D((3, 3, 3), strides=(2, 2, 2), padding='same')(x)
# Add dense blocks
for block_idx in range(nb_dense_block - 1):
... | Python | 1 |
.
# The middle rows are for IterVars, the higher the outer, the lower the inner.
# An IterVar row contains its index, name, type, and other optional information.
# Let's use the W.shared stage as an example. The top row tells
# its name, "W.shared", and memory scope, "Shared". Its compute is
# :code:`W(ax0, ax1, ax2,... | Python | 1 |
exp = 1
tmp = 0
for point in setpoints:
if points.count(point) == 3:
pt += point * (100**4)
name.append(f"三条 {poker_point[point]}")
break
if points.count(point) =... | Python | 1 |
clamped(120), 120);
assert_eq!((0u64, 7u64 ).to_0n_clamped( 0), 0);
assert_eq!((7u64, 7u64 ).to_0n_clamped(120), 120);
assert_eq!((0usize, 7usize ).to_0n_clamped( 0), 0);
assert_eq!((7usize, 7usize ).to_0n_clamped(120), 120);
}
#[test] fn ratios_8_120() {
assert_eq!((0u8, 8u8 ... | Rust | 0 |
email \
<EMAIL>.<EMAIL>son@<EMAIL>@-> {:?}",
new_doc
);
let old_doc = replace_doc_response.old_doc();
eprintln!(
"<NAME> was called <NAME> because he did not remember who he was -> {:?}",
old_doc
);
// remove a document
let remove_doc_response: DocumentRespon... | Rust | 0 |
ame of the current block.
in_channels: number of input channels
out_channels: number of output channels
pool_stride: factor to reduce the spatial dimensionality in the first bottleneck of the block.
Returns: a Module consisting of n sequential bottlenecks.
"""
... | Python | 1 |
from netmiko.paloalto.paloalto_panos import PaloAltoPanosSSH, PaloAltoPanosTelnet
__all__ = ["PaloAltoPanosSSH", "PaloAltoPanosTelnet"]
| Python | 1 |
pattern: &Field<bool>) {
let matches = self.field.find_pattern(pattern);
for (r, c) in matches {
for rr in 0..pattern.rows {
for cc in 0..pattern.columns {
let rrr = wrap(r, rr as i32, self.field.rows);
let ccc = wrap(c, cc as i32, se... | Rust | 0 |
import os
################## LOCAL PATHS #####################
HOME = os.path.expanduser("~")
LOCAL_PROJ_PATH = "/local/dfs-test-tools"
LOCAL_FILES = [
f'{LOCAL_PROJ_PATH}/target/release/main',
f'{LOCAL_PROJ_PATH}/conf/dir_contention_test.toml',
f'{LOCAL_PROJ_PATH}/traces/1.log',
]
################## REM... | Python | 1 |
uting_endpoints_input(
object: &mut aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::input::AddCustomRoutingEndpointsInput,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
if let Some(var_1) = &input.endpoint_configurations {
let mut array_2 = object.key("EndpointConfig... | Rust | 0 |
const OFFSET: u8 = 30;
((self.bits >> OFFSET) & MASK as u32) != 0
};
EPRST30R { bits }
}
#[doc = "Bit 31 - Endpoint xx (2 <= xx <= 31) DMA request. 0 = DMA not requested by endpoint xx. 1 = DMA requested by endpoint xx."]
#[inline]
pub fn eprst31(&self) -> EPRST31R {
... | Rust | 0 |
!([10, 4, 5, 6, 5, 11, 2], m.dump());
assert_eq!(4, m.counter);
}
#[test]
fn it_prevents_divide_by_zero_errors_when_running_opcode_10() {
// M[A] <- M[B] / M[C]
let mut m = Computer::new();
m.load_from_slice(&[10, 4, 5, 6, 1, 11, 0]);
assert_eq!(0, m.counter);
... | Rust | 0 |
et mut manager_config = Config::new();
manager_step.apply(&mut ctx, &mut manager_config);
let mut stakeholder_step = stakeholder::DefineManagerXpubs::new();
stakeholder_step.load_context(&Context {
network: bitcoin::Network::Bitcoin,
cosigners_enabled: true,
... | Rust | 0 |
import scipy.io as sio
import mat73
import numpy as np
# fmripath = '/data/3/human/Human_Visual_Experiments/video_fmri_dataset/subject1/fmri/training_fmri.mat'
fmripath = '/data/3/human/Human_Visual_Experiments/video_fmri_dataset/subject1/fmri/testing_fmri.mat'
# fmri = sio.loadmat(fmripath)
fmri = mat73.loadmat(fmrip... | Python | 1 |
vec![
Token(Location::from(2, 0), Integer, "1".to_string()),
Token(Location::from(2, 1), EOF, "".to_string()),
]
)
}
// Copyright (c) 2021 The Lutino Projects
//
// Use of this source code is governed by an MIT-style
// license that can be found in the LICENSE file or at
// ht... | Rust | 0 |
($0, (function(){", $code, "})());"
)]
[RESULT $($args)*]
[(&mut result as *mut _) a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15]
);
result.deserialize()
}}
... | Rust | 0 |
.registration()
.async_io(Interest::READABLE, || self.io.peek(buf))
.await
}
/// Shuts down the read, write, or both halves of this connection.
///
/// This function will cause all pending and future I/O on the specified
/// portions to return immediately with an appropriate... | Rust | 0 |
= nn.LayerNorm(dim_feedforward)
def forward(self, inputs, key_padding_mask):
if self.m in "VA":
tf_last_hidden_state, tf_hidden_state_list = self.tfencoder(inputs, src_key_padding_mask=key_padding_mask)
# TransformerEncoder提取的领域知识
spci_know = self.layernorm(tf_last_hidd... | Python | 1 |
YPEr s rI )dlopen)sizeofbyref addressof alignmentresize) get_errno set_errno)_SimpleCDatac C sJ ddl m} |d u r| j}t| || }}||krFtd| ||f d S )Nr r z"sizeof(%s) wrong: %d instead of %d)structr _type_rK SystemError)... | Python | 1 |
>( base:T, power:usize ) -> T
where T: fixed::traits::Fixed
{
let mut temp:T = base;
for _i in 0..power-1 {
temp = temp*base;
}
return temp;
}
/// Numerical square root of a fixed point scalar.
/// Slow but acurate method.
///
/// ## Argument
/// * `error` - The gratest allowed error in th... | Rust | 0 |
-> *mut mi_block_t {
return (page_start as *mut u8).offset((i * page.block_size)) as
*mut mi_block_t;
}
// Start of the page available memory
//mi_assert_internal(start + page->capacity*page->block_size == page->top);
#[no_mangle]
pub unsafe extern "C" fn _mi_page_use_delayed_free(mut page: &mut mi_p... | Rust | 0 |
Ok(context.person_repo.find_one(&*id).await?.map(Into::into))
}
pub async fn list(context: &Context) -> FieldResult<Vec<Person>> {
Ok(context
.person_repo
.find(Default::default())
.await?
.map_ok(Into::into)
.try_collect()
.await?)
}
pub async fn create(contex... | Rust | 0 |
a83\xc1\xcf6\xc8\xd6\xb7\x9e\
\x9d\xda\xb3\x12\xcfuJt7\x9b\xb1x~\xb6?l\
\x82\xf1-\xfa\x94\x08\xaea\xca\x04\xe9.I\x0a\xf7\xee\
\xd78q\x5c>\x19\x09\x18\xce\x16\x94w\xef\xdb\x8e\xf7\
\xfc23YX\xc1SQQU\x99H\xe1\xe6\xaa\xf0\
\x83\xdf\xbe\xc3\xdb_\xde\xa1\xb8\x81\xc3\xba\xa2\x9d\x0b\xab\
\x92x\xf0\xda@(\x99N*V7\x85\x7f\xfd;\x... | Python | 1 |
i32>::new();
for idigit in 0..digits {
// let looplen = (4 * (idigit + 1)) / (digits % 4);
let looplen = 0;
println!("step {} looplen {}", idigit, looplen);
let mut totsum_guess = 0;
let mut totsum_rest = 0;
... | Rust | 0 |
ainer::create()),
12);
virtual_alarm1.set_client(timer);
let temp = static_init!(
capsules::temp_nrf51dk::Temperature<'static, nrf51::temperature::Temperature>,
capsules::temp_nrf51dk::Temperature::new(&mut nrf51::temperature::TEMP,
... | Rust | 0 |
ict['configurations'].values():
if config.get('xcode_settings', {}).get('IPHONEOS_DEPLOYMENT_TARGET'):
return True
return False
def _AddIOSDeviceConfigurations(targets):
"""Clone all targets and append -iphoneos to the name. Configure these targets
to build for iOS devices and use correct architec... | Python | 1 |
zero_copy: Option<ZeroCopyBuf>,
) -> Result<JsonOp, OpError> {
let run_args: RunArgs = serde_json::from_value(args)?;
state.check_run()?;
let state_ = state.clone();
let args = run_args.args;
let env = run_args.env;
let cwd = run_args.cwd;
let mut c = Command::new(args.get(0).unwrap());
(1..args.len(... | Rust | 0 |
Event;
use ::sdl2::keyboard::Keycode::*;
match event {
Event::Quit { .. } => {
running = false;
},
Event::KeyDown { keycode: Some(Escape), .. } => {
running = false;
},
_ => (... | Rust | 0 |
import glob
from pylab import *
# import colors
from palettable.colorbrewer.qualitative import Set2_7
colors = Set2_7.mpl_colors
params = {
'axes.labelsize': 8,
'font.size': 8,
'legend.fontsize': 10,
'xtick.labelsize': 10,
'ytick.labelsize': 10,
'text.usetex': False,
'figure.figsize': [4.5... | Python | 1 |
w)
}
}
#[doc = "Possible values of the field `CLKOUTSEL`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum CLKOUTSELR {
#[doc = "SCG SLOW Clock"]
_0000,
#[doc = "System OSC (SOSC_CLK)"]
_0001,
#[doc = "Slow IRC (SIRC_CLK)"]
_0010,
#[doc = "Fast IRC (FIRC_CLK)"]
_0011,
#[doc = "... | Rust | 0 |
blocks in the Recipe
pub fn len(&self) -> usize {
self.blocks.len()
}
}
#[cfg(test)]
mod tests {
use super::*;
use crate::blocks::Boolean;
#[test]
fn init() {
let r = Recipe::new();
match r.entry() {
Some(_) => assert!(false),
_ => (),
... | Rust | 0 |
# Generated by Django 5.1.4 on 2025-01-01 18:18
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('accounts', '0002_rename_role_socialrole_alter_account_options_and_more'),
('tunes', '0002_alter_wikiadmin_options_al... | Python | 1 |
from transformers import BertTokenizer, BertModel
import torch
from scipy.spatial.distance import cosine
from gensim.models import KeyedVectors
import re
class Word2Bert:
def __init__(self, sentence1, sentence2):
self.sentence1 = sentence1
self.sentence2 = sentence2
self.model_path = "C:/U... | Python | 1 |
<P: AsRef<Path>>(msg: String, pk_filepath: P, der: &[u8]) -> Results<bool> {
verify(
msg.as_bytes(),
load_key_from_file(pk_filepath)?.as_slice(),
der,
)
}
}
impl SKVerifyPath<String, Vec<u8>> for SM2 {
fn verify<P: AsRef<Path>>(msg: String, pk_filepath: P, de... | Rust | 0 |
_stream! {
let mut children = this.client.run(this.val());
while let Some(child) = children.next().await {
let child = child.context(StorkError::ClientError)?;
if !this.filters.matches(&child) {
continue;
}
//... | Rust | 0 |
eMsg {
admin: None,
name: "DAO DAO".to_string(),
description: "A DAO that builds DAOs.".to_string(),
image_url: None,
automatically_add_cw20s: true,
automatically_add_cw721s: true,
voting_module_instantiate_info: ModuleInstantiateInfo {
code_id: voting... | Rust | 0 |
sm exports from
/// the general store state `T`.
pub fn instantiate(
mut store: impl wasmtime::AsContextMut<Data = T>,
module: &wasmtime::Module,
linker: &mut wasmtime::Linker<T>,
get_state: impl Fn(&mut T) -> &mut MathData + Send + Sync + Copy + 'static,
) -> anyhow::Result<(Self, wasmtime:... | Rust | 0 |
import logging
from config.bazel_trivy_periodic import REPOS_TO_SCAN
from data_source.jira_finding_data_source import JiraFindingDataSource
from data_source.slack_findings_failover_data_store import SlackFindingsFailoverDataStore
from integration.slack.slack_default_notification_handler import SlackDefaultNotification... | Python | 1 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vi:ts=4:et
import pycurl
c = pycurl.Curl()
c.setopt(c.URL, 'https://httpbin.org/post')
c.setopt(c.HTTPPOST, [
('fileupload', (
# upload the contents of this file
c.FORM_FILE, __file__,
# specify a different file name for the upload
... | Python | 1 |
Buffer Data high Register"]
pub buf_16_datah: crate::Reg<buf_16_datah::BUF_16_DATAH_SPEC>,
#[doc = "0x310 - CAN Buffer ID Register"]
pub buf_17_id: crate::Reg<buf_17_id::BUF_17_ID_SPEC>,
#[doc = "0x314 - CAN Buffer DLC Register"]
pub buf_17_dlc: crate::Reg<buf_17_dlc::BUF_17_DLC_SPEC>,
#[doc = "... | Rust | 0 |
oken))
token_ids += ([0] * (pad_size - len(token)))
else:
mask = [1] * pad_size
token_ids = token_ids[:pad_size]
tokens.append(token_ids)
masks.append(mask)
tokens = torch.LongTensor(tokens).to(device)
masks = torch.LongTen... | Python | 1 |
ArgumentDetail {
name: format!("{}.{}", #name, "{name}"),
required: false,
description: "".to_owned(),
});
},
FieldValue::SubCategory => {
let ty = ... | Rust | 0 |
.is_normal())
.collect();
let max = ioc.iter().copied().fold(0.0, f32::max);
let total_width = width.clamp(20, 100);
let bar_width = (total_width - 11) as f32;
// 00 0.00000 ---------------
if !ioc.is_empty() {
println!... | Rust | 0 |
// ""
("cljs", "\u{e76a}"), // ""
("cls", "\u{e600}"), // ""
("coffee", "\u{f0f4}"), // ""
("conf", "\u{e615}"), // ""
("cp", "\u{e61d}"), // ""
("cpp", "\u{e61d}"), ... | Rust | 0 |
author <NAME> (density matrix, doc)"]
pub fn pauliZ(qureg: Qureg, targetQubit: ::std::os::raw::c_int);
}
extern "C" {
#[doc = " Apply the single-qubit Hadamard gate."]
#[doc = " This takes \\f$|0\\rangle\\f$ to \\f$|+\\rangle\\f$ and \\f$|1\\rangle\\f$ to \\f$|-\\rangle\\f$, and is equivalent to a rotation ... | Rust | 0 |
_item("ammo_text", color=[255, 255, 255, 255])
# Обрабатываем стрельбу
if mouse_pressed and not reloading:
# Обработка мода, влияющего на скорострельность
fire_rate = get_total_fire_rate()
if fire_rate > 0:
time_between_shots = 60.0 / fire_rate
else:
tim... | Python | 1 |
st::Token::loopback]. It is therefore very
//! important that all nodes in the cluster allocate their broadcast receiver
//! and periodically drain it of messages; otherwise, the network buffer will
//! fill up, and the transmitter will be unable to broadcast new messages.
//!
//! A relatively contrived example of broa... | Rust | 0 |
E_DAEMONS);
if daemon_manager.kill_all()? {
writeln!(writer, "{}", ZOMBIE_KILLED).unwrap();
} else {
writeln!(writer, "{}", NONE_RUNNING).unwrap();
}
print_status_line(writer, SPAWNING_DAEMON);
daemon_manager.spawn().await?;
... | Rust | 0 |
, y) condition是条件,满足条件就返回x,不满足就返回y
alpha_denom = torch.where(alpha_denom != 0.0, alpha_denom, torch.ones_like(alpha_denom))
alpha = alpha_num.div(alpha_denom + 1e-7)
positive_gradients = F.relu(score.exp() * gradients) # ReLU(dY/dA) == ReLU(exp(S)*dS/dA))
weights = (alp... | Python | 1 |
rename = "HIP")]
Hip,
#[serde(rename = "ISPC")]
Ispc,
#[serde(rename = "ASM")]
Assembly,
}
pub use target::Target;
/// Codemodel target cmake file API object.
pub mod target {
use std::path::{Path, PathBuf};
use anyhow::*;
use serde::Deserialize;
use super::Language;
/// A t... | Rust | 0 |
import cv2
# PROPS
WIN_WIDTH=1080
WIN_HEIGHT=720
PARENT_WIN_NAME="MAIN"
ROI_WIN_NAME="ROI"
# create an instance
cam = cv2.VideoCapture(0)
# set window props
cam.set(cv2.CAP_PROP_FRAME_WIDTH, WIN_WIDTH)
cam.set(cv2.CAP_PROP_FRAME_HEIGHT, WIN_HEIGHT)
# check camera
if not cam.isOpened():
print('Camera not found')... | Python | 1 |
"""
CivitAIAPI: Interface for interacting with the CivitAI REST API.
See: https://github.com/civitai/civitai/wiki/REST-API-Reference
"""
import re
import requests
from typing import Any, Dict, Optional
class CivitAIAPI:
"""CivitAI API client for model info and downloads."""
BASE_API_URL = "https://civitai.... | Python | 1 |
# NOTE:
# Modifying abbreviations for teams might require you to update or create colors/teams.json.
# Each abbreviation in the teams list needs to have a corresponding entry in colors/teams.json
# in order to render colors correctly.
# These are special teams in the league and not present in the api/v1/teams en... | Python | 1 |
{
#![cfg(all(target_feature="popcnt",target_feature="avx2",target_feature="bmi2"))]
assert!(false);
let convert = _pext_u64(0x0706050403020100, _pdep_u64(mask as u64, 0x0101010101010101)*0xFF);
let permute = _mm256_cvtepu8_epi32(_mm_cvtsi64_si128(convert as i64));
let compress = _mm256_permutevar8x... | Rust | 0 |
SqlTimestamp};
use odbc::{Connection, Statement};
use crate::column_type::ColumnType;
use crate::sql_data_type::SqlDataType;
mod column_type;
mod errors;
mod sql_data_type;
const GET_COLUMN_DEFINITIONS_QUERY: &str = include_str!("sql/get_column_definitions.sql");
const SELECT_ALL_QUERY: &str = include_str!("sql/sel... | Rust | 0 |
"""
2.2-kW IM, diode bridge, V/Hz control
=====================================
This example simulates pure open-loop V/Hz control of a 2.2-kW induction machine (IM)
drive. A diode bridge, stiff three-phase grid, and a DC link is modeled.
"""
# %%
from math import inf, pi
import motulator.drive.control.im as contro... | Python | 1 |
overage_list[idx_start:])
new_bins.append((ref, new_start, end_list[idx], coverage))
bins_to_merge.append(list(range(idx_start, idx + 1)))
hic.matrix = reduce_matrix(hic.matrix, bins_to_merge, diagonal=True)
hic.matrix.eliminate_zeros()
hic.setCutIntervals(new_bins)
hic.nan_bins = np.flatnonzer... | Python | 1 |
rotocoloadm/protocolar-mat',
ProtocoloMateriaView.as_view(), name='protocolar_mat'),
url(r'^protocoloadm/(?P<pk>\d+)/comprovante$',
ComprovanteProtocoloView.as_view(), name='comprovante_protocolo'),
url(r'^protocoloadm/(?P<pk>\d+)/criar-documento$',
CriarDocumentoProtocolo.as_view(), na... | Python | 1 |
l "+str(lvl)+' '+shv+' '+name+'**')
@commands.command()
async def givecrate(self,ctx,arg:disnake.Member,arg2,amount:int):
if ctx.author.id not in self.owners:
return
arg2 = arg2.lower()
if await setcrates(arg.id,arg2,amount) == False:
await ctx.send('Please enter a valid crate name')
... | Python | 1 |
", name)?;
let var = leaf_term(Op::Var(name, sort));
writeln!(f, "{})", substitute_cache(&t, &mut print_as))?;
print_as.insert(t, var);
}
}
writeln!(f, ") {})", substitute_cache(&self.0, &mut print_as))
}
}
/// Rewrites `t`, applying the ... | Rust | 0 |
# etabs_connection.py - Simple ETABS Connection Module
import comtypes.client
# Global variables
etabs = None
model = None
def connect_to_existing():
"""Connect to existing ETABS instance"""
global etabs, model
try:
helper = comtypes.client.CreateObject('ETABSv1.Helper')
helper = helper... | Python | 1 |
break
else: #* If not found in escape dict and length of key is 1, assume regular character
if len(input_key) == 1:
clean_key = input_key
if clean_key:
... | Python | 1 |
_if(dst: u32, mask: u32, gw: u32, if_index: u32) -> Result<()> {
log::trace!(
"route add {} mask {} {} metric 1 if {}",
Ipv4Addr::from(dst),
Ipv4Addr::from(mask),
Ipv4Addr::from(gw),
if_index
);
let mut forward = MIB_IPFORWARDROW {
dwForwardDest: dst.to_be(),
... | Rust | 0 |
# 1a
jobs = [[None, None] for i in range(100)]
numberOfJobs = 0
# 1b
def Initialise():
for item in jobs:
item[0] = -1
item[1] = -1
numberOfJobs = 0
# 1c
def AddJob(job, priority):
i = 0
flag = False
while i < len(jobs):
if jobs[i][0] == -1:
flag = True
... | Python | 1 |
)]
pub enum Progress {
Started,
Processing,
Uploading,
Done,
Unknown,
}
#[deno_bindgen]
#[serde(rename_all = "camelCase")]
pub struct File {
path: String,
size: usize,
author_name: String,
module_name: String,
version_name: String,
id: String,
mime_type: String,
}
#[den... | Rust | 0 |
#!/usr/bin/env python
# Created by "Thieu" at 16:50, 05/10/2023 ----------%
# Email: nguyenthieu2102@gmail.com %
# Github: https://github.com/thieu1995 % ... | Python | 1 |
lf::Sparse(sparse) => sparse.read_value(txn, coord).await,
}
}
async fn write_value(&self, txn_id: TxnId, bounds: Bounds, value: Number) -> TCResult<()> {
debug!("Tensor::write_value {} {}", bounds, value);
match self {
Self::Dense(dense) => dense.write_value(txn_id, bounds... | Rust | 0 |
:gpointer,
f: glib_sys::gpointer,
) where
P: IsA<SettingMacvlan>,
{
let f: &F = &*(f as *const F);
f(&SettingMacvlan::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
... | Rust | 0 |
rap();
let _ = stdin.read(&mut [0u8]).unwrap();
}
fn enumerate_audio() {
println!("Default Input Device:\n {:?}", cpal::default_input_device().map(|e| e.name()));
println!("Default Output Device:\n {:?}", cpal::default_output_device().map(|e| e.name()));
let devices = cpal::devices();
println!(... | Rust | 0 |
# ------------------------------------------------------------------
# Copyright (c) 2020 PyInstaller Development Team.
#
# This file is distributed under the terms of the GNU General Public
# License (version 2.0 or later).
#
# The full license is available in LICENSE, distributed with
# this software.
#
# SPDX-Licens... | Python | 1 |
from fractions import Fraction
print(Fraction(1, 3))
# 1/3
print(Fraction(2, 6))
# 1/3
print(Fraction(3))
# 3
print(Fraction(0.25))
# 1/4
print(Fraction(0.3333333333333333))
# 6004799503160661/18014398509481984
print(Fraction(0.3333333333333333).limit_denominator())
# 1/3
print(Fraction('2/5'))
# 2/5
print(Frac... | Python | 1 |
in Sonarr/Radarr: {found_count}\n")
f.write(f"Not found in Sonarr/Radarr: {not_found_count}\n")
logger.info(f"Updated report written to {output_file}")
return output_file
def main():
parser = argparse.ArgumentParser(description='Look up official paths for duplicate folders in ... | Python | 1 |
}
_ => panic!("expected a referral"),
}
}
// With process_referrals == false, we expect lookups to enter
// non-authoritative data.
match zone.lookup_raw(&ns, Type::A, false) {
LookupResult::Found(a_rrset) => check_rrset(a_rrset, Type::... | Rust | 0 |
from setuptools import setup
setup(
name = 'gestion_biblioteca',
version = '1.0',
description = 'Paquete de gestión de biblioteca',
autor = 'Domingo',
mail = 'Domingo-Marchan@hotmail.com',
url = 'http://www.web.com',
packages = ['modulos'],
scripts = []
) | Python | 1 |
}
as_op!();
}
<reponame>AThilenius/filament-rs
/// Demos creating a window (with `winit`), getting a native window handle then passing that off to
/// a Filament `Engine` `SwapChain` as well as creating a renderer. The Engine will be shut down
/// when all references to the internal unmanaged `::filament::Eng... | Rust | 0 |
fig_accel_profiles().contains(&AccelProfile::Flat) {
h.config_accel_set_profile(AccelProfile::Flat)
.expect("Error setting acceleration profile to flat");
h.config_accel_set_speed(self.machine.light_mouse_speed)
... | Rust | 0 |
c<Coord> = vec![low_point];
while let Some(curr) = to_visit.pop() {
visited.insert(curr);
let (cx, cy) = (curr.0 as i32, curr.1 as i32);
let adjacent_coords = [(cx - 1, cy), (cx + 1, cy), (cx, cy - 1), (cx, cy + 1)]
.into_iter()
.filter(|&(nx, ny)| {
... | Rust | 0 |
lock),
locker_process: None,
})
}
/// Helper to take out a new inhibitor lock. Called at startup and on when resuming from sleep.
fn take_lock(logind: &Logind<'_>) -> AnyResult<InhibitorLock> {
let events = InhibitEventSet::with_event(InhibitEvent::Sleep);
let lock = log... | Rust | 0 |
s not implemented.".format(key))
if len(gttogetpsets)>0:
self.GTtoGet = cms.VPSet()
for ps in gttogetpsets:
insertPSetToVPSet(ps,self.GTtoGet)
def doCheckOptions(self,optstocheck):
# First check option consistencies overall
if (hasattr(self,"TBDconstraint") and hasa... | Python | 1 |
NestedMeta};
/// Parse a list of nested meta items.
///
/// Useful for passing through attributes intended for other macros.
#[derive(Debug)]
pub struct NestedMetaList {
pub metas: Vec<NestedMeta>,
}
impl FromMeta for NestedMetaList {
fn from_list(items: &[NestedMeta]) -> Result<Self, Error> {
Ok(Sel... | Rust | 0 |
if self.activation is None:
raise NotImplementedError(f"Activation {activation} not implemented")
# Residual blocks.
self.layers = nn.ModuleList(
[
self._make_basic_block(
g,
block,
hidden_channels,
... | Python | 1 |
#!/usr/bin/env python
from vtkmodules.vtkCommonCore import (
vtkFloatArray,
vtkMath,
)
from vtkmodules.vtkFiltersProgrammable import vtkProgrammableAttributeDataFilter
from vtkmodules.vtkFiltersSources import vtkSphereSource
from vtkmodules.vtkRenderingCore import (
vtkActor,
vtkPolyDataMapper,
vtkR... | Python | 1 |
isfiable = 416,
k_EHTTPStatusCode417ExpectationFailed = 417,
k_EHTTPStatusCode4xxUnknown = 418,
k_EHTTPStatusCode429TooManyRequests = 429,
k_EHTTPStatusCode444ConnectionClosed = 444,
k_EHTTPStatusCode500InternalServerError = 500,
k_EHTTPStatusCode501NotImplemented = 501,
k_EHTTPStatusCode502BadGateway = 502,
k_... | Rust | 0 |
import logging
import os
from enum import Enum
from shared.config import get_config as shared_get_config
class SettingsModule(Enum):
DEV = "codecov.settings_dev"
STAGING = "codecov.settings_staging"
TESTING = "codecov.settings_test"
ENTERPRISE = "codecov.settings_enterprise"
PRODUCTION = "codecov... | Python | 1 |
e last two dimensions
Values should be in the range of [0,255]
Output:
DCT(Image): [B, C, D, N_Blocks, Block_H, Block_W]
"""
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
image = image.to(device)
image = image - 128 # zero centering of pixels... | Python | 1 |
: Rule::json_mapping,
tokens: [
json_mapping(0, 22, [
json_name(7, 10),
omit_empty(10, 20),
]),
]
};
parses_to! {
parser: AwsGoEventsParser,
in... | Rust | 0 |
"""Amenity model module for the HBnB application."""
from app.models.base_model import BaseModel
class Amenity(BaseModel):
"""Amenity Model"""
def __init__(self, *args, **kwargs):
"""Initialize amenity"""
super().__init__(*args, **kwargs)
self.name = kwargs.get('name', '')
... | Python | 1 |
from Crypto.Util.number import long_to_bytes
# First 10 outputs
outputs = [
10275910798653121436396833379154598008161,
2068591239728841545706452127889450693176,
26350147429806384823786121899280661716493,
25358475244916002220884659082517978530071,
12563752780567442975545946639227178025296,
19642... | Python | 1 |
"""Enhanced Pygame module for loading and rendering computer fonts"""
from pygame._freetype import *
from pygame.sysfont import match_font, get_fonts, SysFont as _SysFont
def SysFont(name, size, bold=0, italic=0, constructor=None):
"""pygame.ftfont.SysFont(name, size, bold=False, italic=False, constructor=None) -... | Python | 1 |
# Generated by Django 3.2.12 on 2023-08-31 10:00
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("maasserver", "0305_add_temporal_schema"),
]
operations = [
# Set the ephemeral_deploy flag to True if the machine is diskless or the ephemeral_deplo... | Python | 1 |
"""
feathers.py
Smoothly scroll mirrored rainbow colored random curves across the display.
"""
import random
import math
import time
from machine import Pin, SPI
import st7789py as st7789
import vga1_8x8 as font
def center_on(display, font, text, y, fg, bg):
'''
Center the text on the display
'''
... | Python | 1 |
.snapshot() {
assert_eq!((&1, &false), kv);
}
}
}
<reponame>lorrin/ockam<gh_stars>0
#[allow(unused)]
//pub mod commands {
use ockam_message::message::*;
use ockam_vault::types::SecretKeyContext;
#[derive(Debug)]
pub enum OckamCommand {
Transport(TransportCommand),
Router(RouterCommand),
Channe... | Rust | 0 |
ned!("__UINTPTR_FMTo__", "\"lo\""),
defined!("__UINTPTR_FMTu__", "\"lu\""),
defined!("__UINTPTR_FMTx__", "\"lx\""),
defined!("__UINTPTR_MAX__", "18446744073709551615UL"),
defined!("__UINTPTR_TYPE__", "long unsigned int"),
defined!("__UINTPTR_WIDTH__", "64"),
defined!("__U... | Rust | 0 |
,
// concat!(
// "Offset of field: ",
// stringify!(_xmlSchemaElement),
// "::",
// stringify!(substGroup)
// )
// );
// assert_eq!(
// unsafe { &(*(::std::ptr::null::<_xmlSchemaElement>())).substGroupNs as *const _ as usize },
// 128usize,
// concat!(
// "Offset of... | Rust | 0 |
[{}] * level) + d[level:]
if method == InterpolateEnumType.DEEP_NO_BACKTRACK
else d
)
resolved[variable] = interpolate_deep(
attr,
d[level][variable],
new_d,
resolved,
levels,
method,
)
return te... | Python | 1 |
ck)
if show_label:
bbox_mess = '%s: %.2f' % (classes[class_ind], score)
t_size = cv2.getTextSize(bbox_mess,
0,
fontScale,
thickness=bbox_thick // 2)[0]
cv2.rectangl... | Python | 1 |
from pygments.token import Token
from nubia import statusbar
from pandas import DataFrame
from suzieq.version import SUZIEQ_VERSION
class NubiaSuzieqStatusBar(statusbar.StatusBar):
'''Process CLI statusbar updates'''
def __init__(self, ctxt):
self._last_status = None
self.ctxt = ctxt
d... | Python | 1 |
"""Command line interface."""
# --- START imports and globals ---
import argparse
import logging
import re
from pathlib import Path
from .plugins import FileInfoHandlerFunction, find_all_functions
LOG = logging.getLogger(__name__)
# --- END imports and globals ---
# --- START CLI ---
def _get_command_line() -> arg... | Python | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.