text string | label_name string | labels int64 |
|---|---|---|
)
}
);
out.push_str(" ");
out.push_str(&var.name);
out.push_str(";\n")
};
out.push_str("};\n\n");
out
}
pub fn mtl_assemble_texture_slots(textures:&Vec<ShVar>)->String{
let mut out = String::new();
out.push_... | Rust | 0 |
ckbone_opt = self.opt['backbone']
meta_dict = {
'EPOCH': epoch,
'BACKBONE_OPT': backbone_opt.state_dict(),
}
else:
meta_dict = {
'EPOCH': epoch,
'OPTIMIZER': self.opt.state_dict(),
}
if self.a... | Python | 1 |
from copy import copy
import os
import subprocess
import sys
import pty
import psutil
from ..systems.docker import get_docker_env
from ..log import log_to_client, streaming_to_client
from ..subprocess import demote_to_user
from ..config import get_config_value
from .. import constants
def _executable_path(executable... | Python | 1 |
rustfmt::skip]
let args = vec!["--long4=val1"];
//
#[repr(u8)]
#[derive(Debug, PartialEq)]
enum CmdOP {
Long1 = 1,
}
impl CmdOP {
pub const fn to(self) -> OptNum {
self as OptNum
}
}
//
#[... | Rust | 0 |
iter().map(|param| param.into()).collect();
let ret = func.ret.name();
let ret_size = func.ret.size();
let lf_type = match ret_size {
0 => "lf_void_t".to_owned(),
1 => "lf_uint8_t".to_owned(),
2 => "lf_uint16_t".to_owned(),
4 => "lf_uint32_t".to_... | Rust | 0 |
SystemData) {
amethyst_imgui::with(|ui| {
ui.show_demo_window(&mut true);
});
}
}
struct Example;
impl SimpleState for Example {}
fn main() -> amethyst::Result<()> {
amethyst::start_logger(Default::default());
let app_root = application_root_dir()?;
let config_dir = app_roo... | Rust | 0 |
import os
import sys
import subprocess
import threading
testProjectsDir = './gerbv_example'
testProjects = [os.path.join(testProjectsDir, subdir)
for subdir in os.listdir(testProjectsDir)]
class Builder(threading.Thread):
def __init__(self, project_dir, output_dir_name ):
threading.Thread... | Python | 1 |
"""
報表相關的 Pydantic 模型
此模組定義了報表查詢與視覺化 API 的請求和響應模型。
"""
from datetime import datetime
from typing import Dict, List, Optional, Any, Union
from enum import Enum
from pydantic import BaseModel, Field, validator
class TimeRangeEnum(str, Enum):
"""時間範圍枚舉"""
DAILY = "daily"
WEEKLY = "weekly"
MONTHLY = "... | Python | 1 |
::types::TypeTable;
/// Unit id
#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)]
pub struct UnitId(NonZeroU32);
// Only to be used in unit testing & unit creation
impl UnitId {
pub fn new(id: u32) -> Self {
Self(NonZeroU32::new(id).expect("passing in id 0"))
}
}
#[derive(Debug)]
pub struct CodeUnit... | Rust | 0 |
(), Default::default())]);
}
#[test]
fn document_key_shadow_common_retrieval_failure_reported_when_no_server_key() {
let contract = Arc::new(DummyServiceContract::default());
let listener = make_service_contract_listener(Some(contract.clone()), None, None, None, None);
ServiceContractListener::process_service... | Rust | 0 |
capacity(self.size);
for _ in 0..self.size {
if let Some(item) = self.iter.next() {
batch.push(item);
}
}
if !batch.is_empty() {
(self.f)(&batch)
} else {
None
}
}
}
<filename>src/year2018/day03/mod.rs
//! # Da... | Rust | 0 |
isLedBlinkPatterns_NISysCfgPxiChassisLedBlinkPattern_Chassis_Controlled : NISysCfgPxiChassisLedBlinkPatterns = 1 ;
pub const NISysCfgPxiChassisLedBlinkPatterns_NISysCfgPxiChassisLedBlinkPattern_One_Blink:
NISysCfgPxiChassisLedBlinkPatterns = 2;
pub const NISysCfgPxiChassisLedBlinkPatterns_NISysCfgPxiChassisLedBlink... | Rust | 0 |
nnel_losses, crossLink_channel_losses)
sr_bl = np.mean(np.sum(rates_bl,axis=1))
print('baseline:',sr_bl)
_, norm_test_dists = normalize_data(1/train_dists,1/test_dists)
norm_train_losses, norm_test_losses = normalize_data(np.sqrt(train_channel_losses),np.sqrt(test_channel_losses) )
test_data_list = ... | Python | 1 |
have any symbols reexported form shared objects
build.flag("-fvisibility=hidden");
if target.contains("darwin") {
build.file("src/libbacktrace/macho.c");
} else if target.contains("windows") {
build.file("src/libbacktrace/pecoff.c");
} else {
build.file("src/libbacktrace/elf.c"... | Rust | 0 |
ion<T, D>
where
T: Scalar + SimdValue,
T::Element: Scalar,
{
type Element = Rotation<T::Element, D>;
type SimdBool = T::SimdBool;
#[inline]
fn lanes() -> usize {
T::lanes()
}
#[inline]
fn splat(val: Self::Element) -> Self {
Rotation::from_matrix_unchecked(OMatrix::s... | Rust | 0 |
on) as cm:
factory.GetMessages([f.name])
self.assertIn(str(cm.exception),
['Extensions '
'"google.protobuf.python.internal.Duplicate.extension_field" and'
' "google.protobuf.python.internal.Extension.extension_field"'
' both try to ex... | Python | 1 |
_path] = config
return configs_to_save
def main(args):
job_type = args.jobtype if args.jobtype else None
# parse multiple pipelines.
pipelines = [Pipeline(fn) for fn in args.yamls.split(",")]
for pipe_id, pipeline in enumerate(pipelines):
if not hasattr(pipeline, "project_dir"):
... | Python | 1 |
::PrivateTest);
}
#[test]
fn test_should_print_the_address_in_pretty_format() {
let address = Address::from_public_key(PUBLIC_KEY, NetworkType::PrivateTest).unwrap();
assert_eq!(
address.prettify(),
"VATNE7-Q5BITM-UTRRN6-IB4I7F-LSDRDW-ZA35C4-KNQ"
);
}
... | Rust | 0 |
rules! assert_same {
($($id:ident)*) => ({$(
assert_eq!(u16::from(Subclockflags::$id), u16::from(types_new::Subclockflags::$id));
)*});
}
assert_same! {
SUBSCRIPTION_CLOCK_ABSTIME
}
u16::from(e).try_into().unwrap()
}
}
impl From<ty... | Rust | 0 |
"""
## GAMSSOURCE: https://www.gams.com/latest/finlib_ml/libhtml/finlib_Sharpe.html
## LICENSETYPE: Demo
## MODELTYPE: NLP
## DATAFILES: Sharpe.gdx
Sharpe model
Sharpe.gms: Sharpe model.
Consiglio, Nielsen and Zenios.
PRACTICAL FINANCIAL OPTIMIZATION: A Library of GAMS Models, Section 3.3
Last modified: Apr 2008.
""... | Python | 1 |
from notification_manager import NotificationManager
def main():
recipient = "someone@example.com"
manager = NotificationManager()
manager.send_notification("email", "Hello via Email!", recipient)
sms_recipient = "+1234567890"
manager.send_notification("sms", "Hello via SMS!", sms_recipient)
... | Python | 1 |
import gmsh
import sys
gmsh.initialize(sys.argv)
v0 = gmsh.model.occ.addSphere(0,0,0, 2)
# create wires in the parametric plane of the spherical surface [-pi,pi]x[-pi/2,pi/2]
c1 = gmsh.model.occ.addCircle(0,0,0, 0.4)
w1 = gmsh.model.occ.addWire([c1])
c2 = gmsh.model.occ.addCircle(0,0,0, 0.2)
w2 = gmsh.model.occ.add... | Python | 1 |
channel.close()
if stop_response.success:
logging.info(f"已成功通知節點 {assigned_node} 停止任務 {task_id}")
# 記錄成功通知日誌
success_log = f"任務 {task_id} 停止請求已發送到節點 {... | Python | 1 |
# -*- coding: utf-8 -*-
# 版权所有 2019 深圳米筐科技有限公司(下称“米筐科技”)
#
# 除非遵守当前许可,否则不得使用本软件。
#
# * 非商业用途(非商业用途指个人出于非商业目的使用本软件,或者高校、研究所等非营利机构出于教育、科研等目的使用本软件):
# 遵守 Apache License 2.0(下称“Apache 2.0 许可”),
# 您可以在以下位置获得 Apache 2.0 许可的副本:http://www.apache.org/licenses/LICENSE-2.0。
# 除非法律有要求或以书面形式达成协议,否则本软件分发时... | Python | 1 |
import requests
import endpoints
import json
import helpers
albums = ''
def get_song(id):
song_details = endpoints.song_details_base_url+id
song = requests.get(song_details).text.encode().decode('unicode-escape')
song_response = json.loads(song)
#helpers.json_creaters(id, song_response)
song_data... | Python | 1 |
from urllib import request
from django.views.generic import ListView, DetailView
from blog.models import Post
class PostListView(ListView):
"""Для просмотра списка опубликованных статей"""
model = Post
template_name = 'blog/post/post_list.html'
context_object_name = 'posts'
queryset = Post.publi... | Python | 1 |
chievink/nrf-pacs
#[doc = "Register `PDMCLKCTRL` reader"]
pub struct R(crate::R<PDMCLKCTRL_SPEC>);
impl core::ops::Deref for R {
type Target = crate::R<PDMCLKCTRL_SPEC>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl From<crate::R<PDMCLKCTRL_SPEC>> for R {
#[inline(alw... | Rust | 0 |
keywords: &[
"lapání po dechu",
"oddechnutí",
"pískání",
"vydechnutí",
"vydechující obličej",
"výdech",
"úleva",
"šepot",
],
},
#[cfg(feature = "cy")]
cra... | Rust | 0 |
me}")
.to_frame()
)
def postprocess_artifacts_secondary(
self,
primary_artifacts: pd.DataFrame,
secondary_artifacts: list[Artifact],
original_artifact: Artifact,
) -> pd.DataFrame:
return original_artifact
def get_children_primary(self, only_trav... | Python | 1 |
type Item = &'m MatchGame;
fn next(&mut self) -> Option<Self::Item> {
loop {
if let MatchEvent::Game { game, .. } = self.iter.next()? {
return Some(game);
}
}
}
}
impl<'m> DoubleEndedIterator for MatchGameIter<'m> {
fn next_back(&mut self) -> Op... | Rust | 0 |
fy: WbemPrivilegeEnum = 22i32;
#[doc = "*Required features: 'Win32_System_Wmi'*"]
pub const wbemPrivilegeRemoteShutdown: WbemPrivilegeEnum = 23i32;
#[doc = "*Required features: 'Win32_System_Wmi'*"]
pub const wbemPrivilegeUndock: WbemPrivilegeEnum = 24i32;
#[doc = "*Required features: 'Win32_System_Wmi'*"]
pub const wb... | Rust | 0 |
a: __m512i,
b: __m512i,
) -> __m512i {
let r = _mm512_dpbusd_epi32(src, a, b).as_i32x16();
transmute(simd_select_bitmask(k, r, src.as_i32x16()))
}
/// Multiply groups of 4 adjacent pairs of unsigned 8-bit integers in a with corresponding signed 8-bit integers in b, producing 4 intermediate signed 16-bit re... | Rust | 0 |
nalize(components::gpio_component_buf!(nrf52840::gpio::GPIOPin));
//! ```
use capsules::gpio::GPIO;
use core::mem::MaybeUninit;
use kernel::capabilities;
use kernel::component::Component;
use kernel::create_capability;
use kernel::hil::gpio;
use kernel::hil::gpio::InterruptWithValue;
use kernel::static_init_half;
#[m... | Rust | 0 |
Result<
crate::error::db_cluster_role_quota_exceeded_fault::Builder,
aws_smithy_xml::decode::XmlError,
> {
if inp.is_empty() {
return Ok(builder);
}
use std::convert::TryFrom;
let mut document = aws_smithy_xml::decode::Document::try_from(inp)?;
#[allow(unused_mut)]
let mut error... | Rust | 0 |
from toolz import compose
from toolz.curried import do
from toolz.dicttoolz import merge
from pydash import py_
def merge_dict(d1, d2):
"""Merge dict.
https://stackoverflow.com/a/29847323/13452951
Args:
d1 (dict): Source Dict
d2 (dict): Merge Dict
"""
d1 = d1 if d1 else {}
d2 ... | Python | 1 |
n new_hr() -> HtmlHrElement;
}
#[wasm_bindgen_test]
fn test_hr_element() {
let hr = new_hr();
hr.set_color("blue");
assert_eq!(hr.color(), "blue");
hr.set_width("128");
assert_eq!(hr.width(), "128");
hr.set_width("256");
assert_eq!(hr.width(), "256");
hr.set_no_shade(true);
asser... | Rust | 0 |
# -*- coding: utf-8 -*-
"""
Created on Fri Oct 16 17:38:11 2020
@author: giamp
"""
import numpy as np
name = 'cb3(30)'
n = 30
startp = 2.0*np.ones(n)
lb = startp - 10.0
ub = startp + 10.0
nint = 15
ncont = n-nint
lbmix = np.zeros(n); lbmix[:ncont] = lb[:ncont]
ubmix = 100*np.ones(n); ubmix[:nc... | Python | 1 |
, then: &P<Expr>, otherwise: &Option<P<Expr>>) -> Option<Constant> {
if let Some(Constant::Bool(b)) = self.expr(cond) {
if b {
self.expr(&**then)
} else {
otherwise.as_ref().and_then(|expr| self.expr(expr))
}
} else {
None
... | Rust | 0 |
>> del xm['tenji']
>>> print_xmap(xm)
[ (joel, apple) (kim, kiwi) (mariel, grape) (tutit, banana) ]
>>> del xm['tutit']
>>> print_xmap(xm)
[ (joel, apple) (kim, kiwi) (mariel, grape) ]
#####################################################################
# Show that the references are still valid
####################... | Python | 1 |
}
#[doc = "Reader of field `DP_PULLDN_TRIM`"]
pub type DP_PULLDN_TRIM_R = crate::R<u8, u8>;
#[doc = "Write proxy for field `DP_PULLDN_TRIM`"]
pub struct DP_PULLDN_TRIM_W<'a> {
w: &'a mut W,
}
impl<'a> DP_PULLDN_TRIM_W<'a> {
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub unsafe fn bits(s... | Rust | 0 |
, 0.98534 + 0.17055j))
def test_czt_math(impulse, m, w, a):
# z-transform of an impulse is 1 everywhere
xp_assert_close(czt(impulse[2:], m=m, w=w, a=a),
np.ones(m, dtype=np.complex128), rtol=1e-10)
# z-transform of a delayed impulse is z**-1
xp_assert_close(czt(impulse[1:], m=m, w=w... | Python | 1 |
Successfully verified the master key {} from {}", key_id, sender);
verified_identities.push(identity.clone())
} else {
return Err(CancelCode::KeyMismatch);
}
}
} else {
warn!(
"Key ID {} in MAC event ... | Rust | 0 |
#!/usr/bin/env python
# Copyright (c) 2012 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
Verifies that Makefiles get rebuilt when a source gyp file changes.
"""
import TestGyp
# Regenerating build files when a gyp file chan... | Python | 1 |
ys.executable, sys.executable, *sys.argv)
def restart(update, context):
restart_msg = update.message.reply_text(load._text[load._lang]["is_restarting"])
restart_chat_id = restart_msg.chat_id
restart_msg_id = restart_msg.message_id
load.db_counters.update_one(
{"_id": "is... | Python | 1 |
p/") {
println!("native peer: {}", line);
peer.replace(line);
break;
}
}
let mut cmd = Command::new("wasm-pack");
cmd.args(&["test", "--headless", "--chrome", "--", "--", "interop"])
.current_dir("../libp2p-webrtc")
.stdout(Stdio::inherit())
... | Rust | 0 |
));
events.push(KeyCode::Backspace);
events.push(KeyCode::Backspace);
events.push(KeyCode::Backspace);
events.push(KeyCode::Backspace);
events.append(&mut text_to_events!("normal input").collect());
events.push(KeyCode::Enter);
events
... | Rust | 0 |
group();
let mut importer = assimp::Importer::new();
importer.pre_transform_vertices(|x| x.enable = true);
importer.collada_ignore_up_direction(true);
let (meshes, textures, colors) =
convert_assimp_scene_to_kiss3d_mesh(&importer.read_file(file_string)?);
info!(
"num mesh, texture, c... | Rust | 0 |
)
} else if len <= 0.75 {
// 0201
(
vec![0.12, 0.1, 0.08][i], // Toe
vec![-0.01, -0.02, -0.03][i], // Heel
vec![-0.01, -0.02, -0.03][i], // Side
vec![0.... | Rust | 0 |
t::Result<(), CacheWriteErr> {
let GpuCache { cache, buf, img } = self;
cache.cache_queued(|rect, data| {
let cmd = match cmd_result.as_mut() {
Ok(cmd) => cmd,
Err(_) => return,
};
if let Err(error) = upload(rect, data, queue, cmd, img,... | Rust | 0 |
) as tmp_shelf:
for uuid, recording in recording_shelf.items():
new_works = {}
for i, work in recording.works.items():
props_dict = dict(work.props)
if add_prop not in props_dict: # should happen always
props_di... | Python | 1 |
# Copyright (c) 2022-present, Kakao Brain Corp.
#
# 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 agr... | Python | 1 |
import sys
sys.path.append("tacotron2")
import torch
from layers import STFT
class Denoiser(torch.nn.Module):
"""Removes model bias from audio produced with waveglow"""
def __init__(
self, waveglow, filter_length=1024, n_overlap=4, win_length=1024, mode="zeros"
):
super(Denoiser, self)._... | Python | 1 |
0, 7_500, 4_000, 1);
assert_stake_vesting(deps.as_ref(), 12_000, 7_500, 4_000);
// The slasher we added can slash
let res1 = slash(deps.as_mut(), &slasher, USER1, Decimal::percent(20)).unwrap();
let res2 = slash(deps.as_mut(), &slasher, USER3, Decimal::percent(50)).unwra... | Rust | 0 |
Version0 as u8,
"ProductBuild" => U16::LE(6002),
"Reserved" => trame![U16::LE(0), 0 as u8],
"NTLMRevisionCurrent" => NTLMRevision::NtlmSspRevisionW2K3 as u8
)
}
/// This is the negotiate (first) message use by NTLMv2 protocol
/// It used to announce capability to the peer
fn negotiate_messa... | Rust | 0 |
// Carbonado Botkiller Medi Gun Mk.I
912 => Weapon::MediGun, // Diamond Botkiller Medi Gun Mk.I
961 => Weapon::MediGun, // Silver Botkiller Medi Gun Mk.II
970 => Weapon::MediGun, // Gold Botkiller Medi Gun Mk.II
998 => Weapon::Vaccinator,
15008 => Weapon::MediGun, // Masked Mende... | Rust | 0 |
QTIMER2_TMR_CNTS_FREEZE_1`"]
#[inline(always)]
pub fn is_qtimer2_tmr_cnts_freeze_1(&self) -> bool {
*self == QTIMER2_TMR_CNTS_FREEZE_A::QTIMER2_TMR_CNTS_FREEZE_1
}
}
#[doc = "Write proxy for field `QTIMER2_TMR_CNTS_FREEZE`"]
pub struct QTIMER2_TMR_CNTS_FREEZE_W<'a> {
w: &'a mut W,
}
impl<'a> QTI... | Rust | 0 |
compression,
wait_for_ready,
timeout,
metadata,
)
@staticmethod
def Status(
request,
target,
options=(),
channel_credentials=None,
call_credentials=None,
insecure=False,
compression=None,
wait... | Python | 1 |
st_for_payload!(Binary<Bytes>);
impl_apirequest_for_payload!(Binary<Body>);
use bitflags::bitflags;
use crate::error::{errcode_to_result, Result};
use ffi::BLRuntimeBuildType::*;
bl_enum! {
/// Blend2D runtime build type.
pub enum BuildType {
/// Describes a Blend2D debug build.
Debug = BL_R... | Rust | 0 |
_coro_done(&self, handle: Value) -> Value {
self.build_call_with_name("llvm.coro.done", &[handle])
}
pub fn build_coro_promise(&self, handle: Value) -> Value {
self.build_call_with_name(
"llvm.coro.promise",
&[handle, const_int(Type::i32(), 8), const_int(Type::i1(), 0)],... | Rust | 0 |
import numpy as np
from cortex.freesurfer import _remove_disconnected_polys
def test_remove_disconnected_polys_examples():
polys = np.array([[0, 1, 2],
[0, 1, 3],
[1, 2, 4],
[5, 6, 7]])
expected_result = np.array([[0, 1, 2],
... | Python | 1 |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | Python | 1 |
mut tickets = self.tickets.lock().unwrap();
tickets.append(&mut new_tickets);
self.cv.notify_one();
}
fn pop(&self) -> usize {
let mut tickets = self.tickets.lock().unwrap();
while tickets.is_empty() {
tickets = self.cv.wait(tickets).unwrap();
}
tick... | Rust | 0 |
def dijkstra(graph, start, end):
unvisited = {node: float('inf') for node in graph}
unvisited[start] = 0
visited = {}
previous_nodes = {node: None for node in graph}
while unvisited:
current_node = min(unvisited, key=unvisited.get)
current_distance = unvisited[current_node]
... | Python | 1 |
hes!(
server.next_event().unwrap(),
ConnectionEvent::Datagram(data) if data == DATA_MTU
));
}
fn send_datagram(sender: &mut Connection, receiver: &mut Connection, data: &[u8]) {
let dgram_sent = sender.stats().frame_tx.datagram;
assert_eq!(sender.send_datagram(data, Some(1)), Ok(()));
l... | Rust | 0 |
types::{
GovernancePayloadGuardianSetChange,
GovernancePayloadSetMessageFee,
GovernancePayloadTransferFees,
},
BridgeConfig,
BridgeData,
GuardianSetData,
Initialize,
MessageData,
PostVAA,
PostVAAData,
PostedVAAData,
SequenceTracker,
SerializePaylo... | Rust | 0 |
writer.writerow(vals)
logger.log(
ALERT,
"Saved %s cuts over %d flows as CSV." % (len(cuts), len(flows)),
)
except OSError as e:
logger.error(str(e))
@command.command("cut.clip")
def clip(
s... | Python | 1 |
"""Define the utility functions related to the audio
"""
from dataclasses import dataclass
import math
from typing import List
import librosa
import numpy as np
import torch
import torchaudio
@dataclass
class FittedWaveform:
"""Fitted waveform using the window"""
waveform: torch.FloatTensor
window_size: ... | Python | 1 |
riptor_type).into()
)
}
};
// IEEE Std 802.11-2016, 12.7.2 b.1)
let frame_key_descriptor_version =
frame.key_frame_fields.key_info().key_descriptor_version();
let expected_version = derive_key_descriptor_version(key_descriptor, protection);
... | Rust | 0 |
class Solution:
def islandPerimeter(self, grid: List[List[int]]) -> int:
def find_water_neighbor(grid, row, col):
ret = 0
if row == 0:
ret += 1
if col == 0:
ret += 1
if row == len(grid) - 1:
ret += 1
... | Python | 1 |
import jwt
import json
from typing import Dict, Any
import base64
from ..utils.common import print_info, print_success, print_error, print_warning
def decode_jwt_without_verification(token: str) -> Dict[str, Any]:
"""
Decode JWT token without verification to inspect its contents
"""
try:
# Spli... | Python | 1 |
= Product
entangled_fields = {'properties': ['unit']}
@pytest.mark.django_db
def test_multiple_inheritance_unsorted():
product_form = QuantifiedUnsortedProductForm()
assert product_form.is_bound is False
expected = BeautifulSoup(strip_spaces_between_tags("""
<li><label for="id_name">Name:... | Python | 1 |
# coding=utf-8
# *** WARNING: this file was generated by pulumigen. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import copy
import warnings
import sys
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload, Awaitable
if sys.vers... | Python | 1 |
# -*- coding: utf-8 -*-
'''
Copyright © 2021 Bartłomiej Duda
License: GPL-3.0 License
'''
# Program tested on Python 3.7.0
# It should be used with BLOB files from UJAM Beatmaker
# Ver Date Author Comment
# v0.1 06.03.2021 Bartlomiej Duda -
import os
import sys
import struct
impor... | Python | 1 |
import allure
import pytest
from url import URL, LOGIN, HISTORY
class TestPersonalAccount:
@allure.title('Переход по клику на «Личный кабинет»')
def test_personal_cabinet_navigation(self, browser, prepare_for_personal_account):
_, _, _, personal_account, _ = prepare_for_personal_account
with... | Python | 1 |
据块号获取在 `FAT1` 中的扇区号
pub fn fat_sector(&self, cluster: u32) -> u32 {
self.base + cluster * 4 / self.bytes_per_sector as u32
}
/// 根据块号获取在 `FAT1` 中的扇区偏移
pub fn fat_sector_offset(&self, cluster: u32) -> usize {
(cluster as usize * 4) % self.bytes_per_sector as usize
}
/// 找到第一个空的 ... | Rust | 0 |
H$躨H H$H|$H$HT$H H H HD$HH[SH HHH HG]H[SH HHHƠ HG9H[SHx HHHƀ HGH[SH HHHƐ HGH[SH HHHư HGͧH[Ð q USH1Hw H H1Ht~? 4(H8 X[]SH
HHH
HGeH[H' AUATUSHHHHH Hu%1 HCHHC0HC HCPHC@ Lx H|$I$LhDD HT$LHAH|$襦L$$H}I$LhXT( HLAH4$H|$HP0@l$H|$ ... | Python | 1 |
wardingDetail.from_dict(
{"type": "ForwardedIntoVxlanTunnel", "vni": 5, "vtep": "1.1.1.1"}
) == ForwardedIntoVxlanTunnel(5, "1.1.1.1")
assert ForwardedIntoVxlanTunnel.from_dict(
{"type": "ForwardedIntoVxlanTunnel", "vni": 5, "vtep": "1.1.1.1"}
) == ForwardedIntoVxlanTunnel(5, "1.1.1.1")
de... | Python | 1 |
x2 += dis_NEWORIGIN[0]
#create the line that mark the 99.5% percent area
hline = Line([-5,y,0],[7,y,0],color = RED)
introduce1 = TextMobject("为了直观 我们取图像中间百分之99.5的区域")
introduce1.shift(3*UP)
self.play(Write(introduce1),run_time = 1.5)
self.play(ShowCreation(hline)... | Python | 1 |
-> impl Parser<I, Output = &'a str>
where
I: RangeStream<Token = char, Range = &'a str>,
I::Error: ParseError<I::Token, I::Range, I::Position>,
{
let start = move |ch: char| rest(ch) && !('0'..='9').contains(&ch);
recognize((satisfy(start), take_while(rest))).expected("identifier")
}
pub(crate) fn keyw... | Rust | 0 |
{
None
};
if let Some(mob) = mob {
lazy.insert(entity, mob);
}
}
}
}
<gh_stars>10-100
fn main() {
let varname: &f32;
{
let x = 3.14f32;
varname = &x;
}
println!("varname = {}", varname);
}
#![allow(unused_im... | Rust | 0 |
s)
assert new_nodes[0].node.get_content() == "これは別のテストです。"
assert len(new_nodes) == 1
# test exclude keywords
postprocessor = KeywordNodePostprocessor(exclude_keywords=["別の"], lang="ja")
new_nodes = postprocessor.postprocess_nodes(node_with_scores)
assert new_nodes[1].node.get_content() == "これは... | Python | 1 |
pub driver_version: u32,
pub vendor_id: u32,
pub device_id: u32,
pub device_type: vk_sys::PhysicalDeviceType,
pub device_name: String,
pub pipeline_cache_uuid: Vec<u8>,
pub nothing1: Option<bool>,
pub nothing2: Option<bool>
}
#[derive(NifRecord)]
#[tag="vk_extent_3d"]
struct ErlVkExten... | Rust | 0 |
).unwrap());
let mut cert = openssl::x509::X509::builder().unwrap();
cert.set_subject_name(csr.subject_name()).unwrap();
cert.set_issuer_name(&issuer_name).unwrap();
cert.set_pubkey(&csr_pubkey).unwrap();
for extension in csr_extensions.iter() {
cert.append_extensio... | Rust | 0 |
path_of_reflection_vector() {
let m = Material::default();
let position = point!(0, 0, 0);
let eye_vector = vector!(0, -FRAC_1_SQRT_2, -FRAC_1_SQRT_2);
let surface_normal = vector!(0, 0, -1);
let light = PointLight::new(point!(0, 10, -10), white());
let result = phong_lig... | Rust | 0 |
def crc_check(data, div):
l = len(div)
ct = 0
data = [int(i) for i in data]
div = [int(i) for i in div]
zero = [0 for i in range(l)]
temp_data = [data[i] for i in range(l)]
result = []
for j in range(len(data) - len(div) + 1):
print("Temp_dividend", temp_data)
msb = temp_... | Python | 1 |
#!/usr/bin/python3
import sys
import binascii
def power_of_two(target):
if target > 1:
for i in range(1, int(target)):
if (2 ** i >= target):
return 2 ** i
else:
return 1
filename = sys.argv[1]
payloadjs = "var payload=["
size = 0
with open(filename, 'rb') as f:
... | Python | 1 |
32 representing a IEEE754 FP32
//
// FP16:
// sign (1 bit), exponent (5 bits), fraction (10 bits)
//
// FP32:
// sign (1 bit), exponent (8 bits), fraction (23 bits)
fn ieee754_u16_to_u32(v: u16) -> u32 {
const F32_EXPONENT: usize = 23;
const F16_EXPONENT: usize = 10;
const F32_EXP_BIAS: u32 = 127;
const... | Rust | 0 |
().to_string())
.ok()?
.into_raw(),
)
})()
.unwrap_or(std::ptr::null_mut())
}
)+
};
}
gen!(
audio_dir
cache_dir
config_dir
data_dir
data_local_dir
desktop_dir
document_dir
download_dir
executable_dir
font_dir
ho... | Rust | 0 |
Patch;
mod serves;
mod filter;
mod util;
mod serialize;
mod solidity;
use error::Error;
use super::miner::MinerState;
use self::serialize::*;
#[derive(Serialize, Deserialize, Debug, Clone)]
#[serde(untagged)]
pub enum Either<T, U> {
Left(T),
Right(U),
}
#[derive(Serialize, Deserialize, Debug, Clone)]
#[serd... | Rust | 0 |
xdf\
\x22\xadM]2\xc9\xa2@4\x17\x85\xbbb\xa8/<\
\xba\xd8\xf6\x11!J\x96/\xb8\x83^\xdbi\x7f\xc3&\
\xf0ul\x89R\xc9\x11\x8c\xfd\xcd\x19\x8cVs\xb2U\
\x90V\x17J\xbf\xfd\x8b\x16\x9a`\xea\xac\x8eBY\x16\
\x80\xd2\xb3Vq}f.[\xac\xf4\x09\xa6\xa5ck\
Eo&\x1d\xec%\xe3\xd7_\x13\xe5\x86\xce\x22\x8bd\
\xf9o\x94\xba\xf5\x09\xf6\x9d\xdb\xb... | Python | 1 |
class Solution:
def kClosest(self, points: List[List[int]], k: int) -> List[List[int]]:
result = []
for point in points:
distance = sqrt(point[0]**2 + point[1]**2)
result.append((distance, point))
heapq.heapify(result)
return [heapq.heappop(result)[1] for _ ... | Python | 1 |
_Media_MediaFoundation'*"]
pub const MEStreamSinkPrerolled: MF_EVENT_TYPE = 307i32;
#[doc = "*Required features: 'Win32_Media_MediaFoundation'*"]
pub const MEStreamSinkScrubSampleComplete: MF_EVENT_TYPE = 308i32;
#[doc = "*Required features: 'Win32_Media_MediaFoundation'*"]
pub const MEStreamSinkFormatChanged: MF_EVENT... | Rust | 0 |
import logging
from asyncio import Event
from typing import Generator
from server.modules.base_handler import BaseHandler
from server.modules.chat import Chat
from openai import OpenAI
from server.modules.tts_handler import TTSMessage, TTSMessageType
class LLMHandler(BaseHandler):
def __init__(self, stop_event:... | Python | 1 |
all_goats_value) = tuple_result?;
let favorites: Vec<GoatId> = favorites_value.into_serde().ok_or_js_err()?;
let all_goats: Vec<Goat> = all_goats_value.into_serde().ok_or_js_err()?;
#[derive(Serialize)]
struct Data {
title: &'static str,
parent: &'static str,
... | Rust | 0 |
ng of the stream"]
#[doc = " to seek to."]
#[doc = " \\param client_data The callee\'s client data set through"]
#[doc = " FLAC__stream_decoder_init_*()."]
#[doc = " \\retval FLAC__StreamDecoderSeekStatus"]
#[doc = " The callee\'s return status."]
pub type FLAC__S... | Rust | 0 |
from flask import Flask
from config import Config
from extensions import db, migrate, login_manager, bcrypt
def create_app(config_class=Config):
app = Flask(__name__)
app.config.from_object(config_class)
# Initialize extensions
db.init_app(app)
migrate.init_app(app, db)
login_manager.init_app... | Python | 1 |
its_4h) / len(sell_profits_4h)
win_rate_sell_4h = (
len([p for p in sell_profits_4h if p > 0])
/ len(sell_profits_4h)
* 100
)
print(
f"売り - 4時間後: 平均{avg_sell_4h:.2f... | Python | 1 |
rrule.all_between(before, after, inc).unwrap());
}
#[test]
fn test_between_inclusive_lower_miss() {
let rrule: RRuleSet = "DTSTART:20120201T093000Z\nRRULE:FREQ=DAILY;COUNT=5"
.parse()
.unwrap();
let before = ymd_hms(2012, 2, 2, 10, 0, 0);
let middle = ymd_hms(2012, 2, 3, 9, 30, 0);
le... | Rust | 0 |
write-api).\n\nFor information about available fields see [acalctr](acalctr) module"]
pub type ACALCTR = crate::Reg<u32, _ACALCTR>;
#[allow(missing_docs)]
#[doc(hidden)]
pub struct _ACALCTR;
#[doc = "`read()` method returns [acalctr::R](acalctr::R) reader structure"]
impl crate::Readable for ACALCTR {}
#[doc = "`write(... | Rust | 0 |
= NodeIndex;
type AmbiguousNodes = HashSet<NodeIndex>;
fn get_ambiguous_nodes(&self) -> Self::AmbiguousNodes {
self.node_indices()
.filter(|n| {
let in_degree = self.in_degree(*n);
let out_degree = self.out_degree(*n);
(in_degree > 1 || out_deg... | Rust | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.