text string | label_name string | labels int64 |
|---|---|---|
#!/usr/bin/env python3
"""
Expand D&D Monster Database
Quick script to add more monsters from the D&D 5e API
"""
import requests
import os
import sys
from dotenv import load_dotenv
# Add sql_schema to path
sys.path.append('sql_schema')
from monsters_schema import insert_monster_data
load_dotenv()
def get_monsters_f... | Python | 1 |
hOldLocal.destroy()
self.Qs.destroy()
self.rhs.destroy()
self.newH.destroy()
self.tmpL.destroy()
self.tmp.destroy()
self.Qs.destroy()
self.QsL.destroy()
self.nQs.destroy()
self.tmp1.destroy()
self.stepED.destroy()
self.Eb.destroy()
... | Python | 1 |
_PROPERTY;
const ENUMERATE = sys::ZX_RIGHT_ENUMERATE;
const DESTROY = sys::ZX_RIGHT_DESTROY;
const SET_POLICY = sys::ZX_RIGHT_SET_POLICY;
const GET_POLICY = sys::ZX_RIGHT_GET_POLICY;
const SIGNAL = sys::ZX_RIGHT_SIGNAL;
const SIGNAL_PEER = s... | Rust | 0 |
TerminatorKind::GeneratorDrop => {
// When we return from the function, then all `ReScope`-style regions
// are guaranteed to have ended.
// Normally, there would be `EndRegion` statements that come before,
// and hence most of these loans will already be ... | Rust | 0 |
aligned_offset_tree,
main_tree,
length_tree,
} => decode_element(
bitstream,
r,
DecodeInfo {
aligned_offset_tree: Some(aligned_offset_tree),
main_tree,
le... | Rust | 0 |
field_{swap_channels[1]}"],
datum[f"field_{swap_channels[0]}"],
)
candidates.append(data_ground_truth_copy)
channel_map = {"x": "x", "y": "y", "classify": "classify"}
channel_map[swap_channels[0]], channel_map[swap_channels[1]] = (
... | Python | 1 |
from typing import List
class Solution:
def vowelStrings(self, words: List[str], queries: List[List[int]]) -> List[int]:
vowls = set("aeiou")
prefix = [0]*(len(words)+1)
prev = 0
for i, word in enumerate(words):
if word[0] in vowls and word[-1] in vowls:
... | Python | 1 |
})
.1
}
fn main() {
let text = "WWWWWWWWWWWWBWWWWWWWWWWWWBBBWWWWWWWWWWWWWWWWWWWWWWWWBWWWWWWWWWWWWWW";
let encoded = encode(text);
let decoded = decode(&encoded);
println!("original: {}\n encoded: {}\n decoded: {}", text, encoded, decoded);
assert_eq!(text, decoded);
}
use nom::{... | Rust | 0 |
r1['detail'] = "选择的大模型不存在"
return [500, PromptNameEditError1]
if type(model_para["icon"]) != str:
PromptNameEditError1['description'] = "icon参数错误"
PromptNameEditError1['detail'] = "当前参数仅支持字符串类型"
return [400, PromptNameEditError1]
icon = int(model_para["icon"])
if icon not in ... | Python | 1 |
_PER_WORD * word_buf_len {
dec.int_cnt += 1;
} else {
dec = Res::Overflow(dec.unwrap());
}
}
} else {
while dec.word_buf[to_idx] == 0 {
if to_idx == 0 {
let idx = frac_word_to + 1;... | Rust | 0 |
import numpy as np
import skimage as sk
import skimage.io as skio
from scipy import signal
import cv2
from scipy import ndimage
def sharpen(im, sigma, alpha):
height, width = im.shape[0], im.shape[1]
R = np.dsplit(im, im.shape[2])[0].reshape((height, width))
G = np.dsplit(im, im.shape[2])[1].reshape((... | Python | 1 |
caribbean = {}
while True:
command = input()
if command == "Sail":
break
town, people, gold = command.split("||")
if town not in caribbean:
caribbean[town] = caribbean.get(town, {'people': int(people), 'gold': int(gold)})
else:
caribbean[town]['people'] += int(people)
... | Python | 1 |
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, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the ... | Rust | 0 |
import tkinter
from ttkbootstrap import Style
style = Style(theme='sandstone')
login = tkinter.Tk()
login.title("login")
login.geometry("300x400+20+20")
def czmm():
def czmm1():
pw_rt = pw_r.get()
login.destroy()
czm = tkinter.Tk()
czm.title("重置密码")
czm.geometry("300x400+20+20")
c... | Python | 1 |
# Copyright (c) 2010 Sven Kreiss, Kyle Cranmer
import re
from .data import REPLACEMENTS, COMBININGMARKS, SUBSUPERSCRIPTS
def replace(f: str):
# Catch cases like \not\subset and \not\in and convert them to
# use the combining character slash as in \slash{\subset}
f = re.sub(r'\\not(\\[A-z]+)', r'\\slash{\... | Python | 1 |
"""
Script to print all the available environments in the extension.
The script iterates over all registered environments and stores the details in a table.
It prints the name of the environment, the entry point and the config file.
"""
"""Launch Isaac Sim Simulator first."""
from omni.isaac.lab.app import AppLaunch... | Python | 1 |
Game{total: rng.gen_range(100i, 999i),
values: values}
}
fn solve_game(game: Game) -> Solution {
best_sub_solution(game.total, Solution{total: 0, calcul: format!("0")}, game.values)
}
fn best_sub_solution(total: int, solution : Solution, left_values : Vec<int>) -> Solution {
if solution.total == tot... | Rust | 0 |
"""倒计时器工具管理器.
负责倒计时器工具的初始化、配置和MCP工具注册
"""
from typing import Any, Dict
from loguru import logger
from .tools import (
cancel_countdown_timer,
get_active_countdown_timers,
start_countdown_timer,
)
class TimerToolsManager:
"""
倒计时器工具管理器.
"""
def __init__(self):
"""
初始化... | Python | 1 |
System"}</button>
<button class="dropdown-item" type="button" onclick=self.link.callback(|_|{Msg::UpdateOperatingMode(OperatingMode::User)})>{"User"}</button>
<button class="dropdown-item" type="button" onclick=self.link.callback(|_|{Msg::UpdateOperatingMode(OperatingMode... | Rust | 0 |
f this extrinsic.
/// - `market_id` : Market index from which `borrower` has taken borrow.
/// - `borrowers` : Vector of borrowers accounts' ids.
#[pallet::weight(<T as Config>::WeightInfo::liquidate(borrowers.len() as u32))]
#[transactional]
pub fn liquidate(
origin: OriginFor<T>,
market_id: MarketInde... | Rust | 0 |
EntryVec>;
impl MockBlockstream {
pub fn new(_: &Path) -> Self {
Blockstream {
output: EntryVec::new(),
}
}
pub fn entries(&self) -> Vec<String> {
self.output.entries()
}
}
fn serialize_transactions(entry: &Entry) -> Vec<Vec<u8>> {
entry
.transactions
... | Rust | 0 |
print(f"Retrieved docs: {len(shared.get('retrieved_docs', []))}")
print(f"\nResponse:\n{response.get('text', 'No response')}")
finally:
# Restore original mode
if original_mode:
os.environ["CHROMADB_MODE"] = original_mode
else:
os.environ.pop("CHROMA... | Python | 1 |
2");
} else {
println!("cargo:rustc-cfg=vec3a_f32");
}
if target_feature_sse2 && !force_scalar_math {
println!("cargo:rustc-cfg=vec4_sse2");
} else {
if !force_scalar_math {
// simd not available but not explicitly disabled so maintain 16 byte alignment
p... | Rust | 0 |
retval.gp != 0
}
}
impl UntypedRetVal {
pub fn as_bool(&self) -> bool {
self.gp != 0
}
pub fn as_ptr<T>(&self) -> *const T {
self.gp as *const T
}
pub fn as_mut<T>(&self) -> *mut T {
self.gp as *mut T
}
}
impl Default for UntypedRetVal {
fn default() -... | Rust | 0 |
nfirm that the visibility of the original type is not changed.
pub use crate::pub_::{Default, Replace};
}
pub mod pub_use2 {
// Ok
#[allow(unused_imports)]
pub(crate) use crate::pub_::{
__DefaultProjection, __DefaultProjectionRef, __ReplaceProjection, __ReplaceProjectionOwned,
__ReplaceP... | 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wri... | Python | 1 |
essures
def combine_frequency_pressures(self, frequencies, amplitudes=None):
"""Combine pressure distributions from multiple frequencies using the matrix"""
if amplitudes is None:
amplitudes = np.ones(len(frequencies))
# Check if we have a valid pressure matrix
... | Python | 1 |
#[doc = "ADC AIN16 Pin"]
PIN16,
#[doc = "ADC AIN17 Pin"]
PIN17,
#[doc = "ADC AIN18 Pin"]
PIN18,
#[doc = "ADC AIN19 Pin"]
PIN19,
#[doc = "Temperature Reference"]
TEMP,
#[doc = "Bandgap Voltage"]
BANDGAP,
#[doc = "1/4 Scaled Core Supply"]
SCALEDCOREVCC,
#[doc = "1/... | Rust | 0 |
Assign};
// TODO: Separate types for non-linear sRGB and linear sRGB, with conversions between
// see comment on bevy issue #688 https://github.com/bevyengine/bevy/pull/688#issuecomment-711414011
/// RGBA color in the Linear sRGB colorspace (often colloquially referred to as "linear", "RGB", or
/// "linear RGB").
#[re... | Rust | 0 |
gl.bind_texture(GL::TEXTURE_2D, Some(&state.assets.tex_boiler));
let sx = if self.progress.is_some()
&& Self::COMBUSTION_EPSILON < self.combustion_rate()
{
(((state.sim_time * 5.) as isize) % 2 + 1) as f32
} else {
... | Rust | 0 |
rns(s1, double_hyphens)
s1 = delete_custom_patterns(s1, multiple_spaces)
s1 = delete_custom_patterns_fullstop(s1, multi_fullstops)
s1 = re.split(document_splitter_regex, s1)
# s1 = [i.strip().replace('"',"") for i in s1 if i.strip() != '']
s1 = [i.strip() for i in s1 if i.strip() != '']
s1 = [i... | Python | 1 |
[commands(clean, ban, kick, soft_ban, soft_ban_init)]
struct Admin;
#[command]
#[aliases("cleanall")]
#[required_permissions(MANAGE_MESSAGES)]
#[description = "Clean at most X latest messages from the current channel (only clean Youmu's messages in DMs). Defaults to 10."]
#[usage = "clean 50"]
#[min_args(0)]
#[max_arg... | Rust | 0 |
# backend/sql_app/dataobject/TaskConfigDO.py
from sqlalchemy import Column, Integer, String, Text, Index
from ai_analytics.sql_app.dataobject.BaseDO import BaseDO
class TaskConfigDO(BaseDO):
__tablename__ = 'task_config'
prompt_config_id = Column(Integer, nullable=False, comment='评论配置表 id')
status = Column(String... | Python | 1 |
iou_aware = True
iou_aware_factor = 0.5
test = ApiBase(
func=paddle.vision.ops.yolo_box,
feed_names=["x", "img_size"],
feed_shapes=[x_shape, imgsize_shape],
feed_dtypes=["float32", "int32"],
input_is_list=False,
is_train=False,
)
np.random.seed(1)
... | Python | 1 |
self.sources.1.next() {
Some(b) => b,
x => return x
};
// TODO buffers must be the same length. Should either document that requirement
// or make it handle irregular buffers.
for i in 0..a_buf.len() {
a_buf[i] = a_buf[i].mix(b_buf[i]);
}
... | Rust | 0 |
import _plotly_utils.basevalidators
class YaxisValidator(_plotly_utils.basevalidators.SubplotidValidator):
def __init__(self, plotly_name="yaxis", parent_name="violin", **kwargs):
super(YaxisValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
df... | Python | 1 |
is done (partly?) to prevent *double free* errors where memory from a heap is freed twice
// The clone method lets us deep copy heap data
let s1 = String::from("hello");
let s2 = s1.clone();
println!("s1 = {}, s2 = {}", s1, s2);
// Types with a known size at compile time are stored entirely on t... | Rust | 0 |
a
d+ @ s` d dgZ ddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddl
mZ ddl
mZm
Z
ddlmZ dZd Zd
ZdZe Zdd
Zdd ZG dd deZG dd dZdd ZG dd deZd*ddZdd ZG dd deZ G d d d e!Z"G d!d" d"e!Z#e#Z$G d#d$ d$e#Z... | Python | 1 |
(&mz, 0));
}
#[test]
#[ignore]
fn test3() {
let input = "#################
#i.G..c...e..H.p#
########.########
#j.A..b...f..D.o#
########@########
#k.E..a...g..B.n#
########.########
#l.F..d...h..C.m#
#################";
let mz = Maze::from_str(input);
assert_eq!(136, dfs_map(&mz, ... | Rust | 0 |
}
impl Zero for u32 {
fn zero() -> Self {
0u32
}
}
impl Zero for u8 {
fn zero() -> Self {
0u8
}
}
impl Zero for i8 {
fn zero() -> Self {
0i8
}
}
<filename>src/cli.rs
use clap::{Parser, Subcommand};
#[derive(Parser)]
#[clap(version)]
pub struct Cli {
#[clap(subcommand... | Rust | 0 |
not unsafe in and of itself, but dereferencing it certainly *is*,
//! but they don't do that (see [here](https://github.com/nabijaczleweli/safe-transmute-rs/issues/1)
//! for extended discussion).
//!
//! Other functions in this crate, on the other hand, provide enough safety measures to ensure safety in
//! all circum... | Rust | 0 |
rlying symbols for the option contracts to be returned. (e.g. ["AAPL", "SPY"])
status (Optional[AssetStatus]): The status of the asset.
expiration_date (Optional[Union[date, str]]): The expiration date of the option contract. (YYYY-MM-DD)
expiration_date_gte (Optional[Union[date, str]]): The exp... | Python | 1 |
#
# Copyright (c) 2020 LA EPFL.
#
# This file is part of MPOPT
# (see http://github.com/mpopt).
#
# This program 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 Foundation, either version 3 of the License, or
# (at... | Python | 1 |
assert_eq!(
"thread_num: 3, path: /root, includes: [/user, /home], excludes: [/ect, /mnt], debug: true",
format!(
"{}",
Commands {
thread_num: 3,
path: PathBuf::from("/root"),
includes: vec![PathBuf::f... | Rust | 0 |
EZ,EU,GK,G9,H8,SU,S9],[GO,HO,E7,GZ,G8,HK,HU,S7],[SO,EA,EK,GA,G7,HA,SA,SZ],[E9,E8,GU,HZ,H9,H7,SK,S8],],
vec![],
vec![],
&[(EPI0, [H8,HU,HA,H7]),(EPI2, [SO,SK,EO,HO]),(EPI0, [S9,S7,SA,S8]),(EPI2, [SZ,E8,SU,GO]),(EPI1, [GZ,GA,GU,G9]),(EPI2, [EA,E9,EU,E7]),(EPI2, [G7,H9,GK,G8]),(EPI0, [EZ,HK,EK,HZ])... | Rust | 0 |
}
impl Arch {
#[spec(checked)]
pub fn inv(&self) -> bool {
forall(|i:nat| with_triggers!([self.layers.index(i).entry_size], [self.layers.index(i).num_entries] => i < self.layers.len() >>= (
true
&& self.layers.index(i).entry_size > 0
&& self.layers.index(i).num_entr... | Rust | 0 |
class Solution:
def numSteps(self, s: str) -> int:
num = int(s,2)
print(num)
ret = 0
while num != 1:
if num %2 == 1:
num += 1
else:
num //= 2
ret += 1
return ret
| Python | 1 |
"""
Python量化实战框架-okx版
这个框架是我们python量化行动家的内容,欢迎大家加入我们的量化行动家,一起玩量化,一起进步
所有将加入行动家社群的同学,框架会定期更新,并且后面会有更多框架上架
微信: coder_v5 (微信联系务必备注来意)
本程序作者: 菜哥
# 框架内容
okx u本位择时策略实盘框架
本框架程序是菜哥原创,并且仅供量化行动家社群的同学使用和阅读,
发现侵权行为,作者将依法追究相关责任,并委托维权骑士进行维权处理,以维护自身合法权益。
若发现有抄袭、篡改、未经授权传播等侵权情况,作者将采取法律手段进行维权
"""
"""
交易信号类型定义
扩展的信号系统,提供更灵活的交易操作支持
""... | Python | 1 |
) # Test if 4 is successfully appended to the list
# Section 9: Skipping Tests
# You can skip tests that are not applicable or ready using `@unittest.skip`, `skipIf`, and `skipUnless`.
class TestSkipping(unittest.TestCase):
@unittest.skip("This test is skipped unconditionally.")
def test_skipped(sel... | Python | 1 |
# Copyright (c) 2010 Advanced Micro Devices, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met: redistributions of source code must retain the above copyright
# notice, this list of conditions... | Python | 1 |
c::c_void,
_size: usize,
_n: usize,
arg3: *mut FILE,
) -> usize;
}
extern "C" {
pub fn _fscanf_r(
arg1: *mut _reent,
arg2: *mut FILE,
arg3: *const libc::c_char,
...
) -> libc::c_int;
}
extern "C" {
pub fn _fseek_r(
arg1: *mu... | Rust | 0 |
const CTRL_MREG2_HYB: u8 = 1 << 5; // HYBRID MODE
const ACCEL_MG_RANGE_2G: i16 = 4; // 4.0984 or 0.244
const ACCEL_MG_RANGE_4G: i16 = 2; // 2.0492 or 0.488
const ACCEL_MG_RANGE_8G: i16 = 1; // 1.0246 or 0.976
const _MAG_UT_LSB: i16 = 10; // 10 or .1 uT
const SEVEN... | Rust | 0 |
# Code generated by Lark OpenAPI.
from typing import Any, Optional, Union, Dict, List, Set, IO, Callable, Type
from lark_oapi.core.construct import init
from .room_status import RoomStatus
from .device import Device
class Room(object):
_types = {
"room_id": str,
"name": str,
"capacity": i... | Python | 1 |
from PIL import Image, ImageTk
import json
import os
from pynput import keyboard
CONFIG_FILE = 'config.json'
def resize_image(filename, width, height):
img = Image.open(filename)
img = img.resize((width, height), resample=Image.BILINEAR)
return ImageTk.PhotoImage(img)
def load_key(key_var):
default_... | Python | 1 |
a, desc="Inserting outcomes", total=len(outcome_data)
):
db.execute(outcome.insert().values(chunk))
# Create fake choices
choice_data = [
{
"description": fake.sentence(),
"outcome_id": fake.random_int(min=1, max=100),
"question_id": fake.random_int(min=1... | Python | 1 |
osix);
let mut support_wasapi = false;
let mut support_dsound = false;
let mut support_winmm = false;
let mut support_alsa = false;
let mut support_jack = false;
let mut support_pulseaudio = false;
let mut support_aaudio = false;
let mut support_opensl = false;
let mut support_sndio... | Rust | 0 |
de-4-node-6", bfs_links[9])
self.assertEqual("node-2-node-3", bfs_links[10])
self.assertEqual("node-8-node-9", bfs_links[11])
self.assertEqual("node-10-node-11", bfs_links[12])
# 4 hops: 10, 8
self.assertEqual("node-10-node-4", bfs_links[13])
self.assertEqual("node-2-node... | Python | 1 |
import logging
from aiogram import Bot, Dispatcher, executor
from aiogram.contrib.middlewares.logging import LoggingMiddleware
from aiogram.types import BotCommand
from aiogram.contrib.fsm_storage.memory import MemoryStorage
from config import API_TOKEN
from handlers.common import register_handlers_common
from handl... | Python | 1 |
################################################################################
# Creme is a free/open-source Customer Relationship Management software
# Copyright (C) 2015-2022 Hybird
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General P... | Python | 1 |
notifier.send(Err(MessageSubmitterError("message already received".to_string())))
{
error!("failed to send error: {:?}.", e);
}
}
metrics.known_messages_inc();
if... | Rust | 0 |
class Employee:
raise_amount = 1.04 # 4% raise
def __init__(self, first_name, last_name, salary):
self.first_name = first_name
self.last_name = last_name
self.salary = salary
print("Employee created: ", self.first_name, self.last_name)
def display(self):
print("Emp... | Python | 1 |
phy_id, e);
return Err(PhyManagerError::IfaceCreateFailure);
}
};
Ok(create_iface_response.iface_id)
}
/// Destroys the specified interface.
async fn destroy_iface(
proxy: &fidl_service::DeviceMonitorProxy,
iface_id: u16,
) -> Result<(), PhyManagerError> {
let mut request = fid... | Rust | 0 |
from ast import AsyncFunctionDef
import os,sys,getopt
def main(argv):
parameters="sfr"
parameters_long = ["start","finish", "remote"]
do_start = False
do_finish = False
do_test = False
do_remote = False
try:
opts, args = getopt.getopt(argv,parameters,parameters_long)
except:
... | Python | 1 |
// Continue after exponent
if let Some((_, c)) = iter.peek() {
if *c == 'e' || *c == 'E' {
iter.next();
if let Some((_, c)) = iter.peek() {
if *c == '-' || *c == '+' {
iter.next();
}
}
skip_digits(10, &mut ... | Rust | 0 |
trim_start_bp_adj = trim_start_bp - full_start_bp + 1
trim_end_bp_adj = trim_end_bp - full_start_bp + 1
else:
trim_start_bp_adj = trim_start_bp
trim_end_bp_adj = trim_end_bp
if (trim_start_ind == ... | Python | 1 |
from dbt.constants import DBT_CONSTANTS
from dbt.adapters.factory import DBT_ADAPTERS_FACTORY
DBT_ADAPTERS_POSTGRES_IMPL = 0
| Python | 1 |
it'
if type(value) == type(True):
# usage_key is the flag for boolean type value
return '--%s' % usage_key
if key != usage_key:
apDisplay.printDebug('using %s instead of %s' % (usage_key, key))
# value conversion
if type(value) == type(all):
output = '--%s=%s' % (usage_key, value.__name__)
elif type(value)... | Python | 1 |
#!/usr/bin/env python
# Usage: ``python setup.py build_ext --inplace``
from distutils.core import setup, Extension
import numpy
setup(name='_tifffile',
ext_modules=[Extension('_tifffile', ['tifffile.c'],
include_dirs=[numpy.get_include()])],
version='2013.11.05',
... | Python | 1 |
from __future__ import annotations
from collections import defaultdict
from emmet.core.dois import DOIDoc
from mp_api.client.core import BaseRester
from mp_api.client.core.utils import validate_ids
class DOIRester(BaseRester[DOIDoc]):
suffix = "doi"
document_model = DOIDoc # type: ignore
primary_key =... | Python | 1 |
pub slot: Slot,
pub set_specs: Vec<ErasureSpec>,
}
#[test]
fn test_coding() {
const N_DATA: usize = 4;
const N_CODING: usize = 2;
let session = Session::new(N_DATA, N_CODING).unwrap();
let mut vs: Vec<Vec<u8>> = (0..N_DATA as u8).map(|i| (i..(16 + i)).colle... | Rust | 0 |
def test_init_state(axolotl_a, axolotl_b, exchange):
axolotl_a.initState(other_name=axolotl_b.name,
other_identityKey=axolotl_b.state['DHIs'],
other_handshakeKey=axolotl_b.handshakePKey,
other_ratchetKey=axolotl_b.state['DHRs'],
... | Python | 1 |
# -*- coding: utf-8 -*-
# Copyright 2025 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... | Python | 1 |
#!/usr/bin/env python3
"""
Module for zooming an array.
"""
from typing import List, Tuple
def zoom_array(lst: Tuple, factor: int = 2) -> List:
'''Creates multiple copies of items in a tuple.
'''
zoomed_in: List = [
item for item in lst
for i in range(int(factor))
]
return zoomed... | Python | 1 |
# Copyright (c) 2009 The Hewlett-Packard Development Company
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met: redistributions of source code must retain the above copyright
# notice, this list of... | Python | 1 |
}
};
}
_ => {}
}
}
let d: f64 = distance(lat1, lon1, lat2, lon2); // mod function (src/distance/mod.rs)
info!(
"json object: Distance from {} to {}: {:.1} mi ",
from_state, to_state, d
);
let dt = format!("{}", Local::now().format(... | Rust | 0 |
class Solution:
def onesMinusZeros(self, grid: List[List[int]]) -> List[List[int]]:
rows = len(grid)
cols = len(grid[0])
#
# diff[i][j] = onesRowi + onesColj - zerosRowi - zerosColj
# = onesRowi + onesColj - (len_row - onesRowi) - (len_cols - onesColj)
... | Python | 1 |
ages_latent[2](y, x)
for blk in fast_blk[3 * n_blks:]:
if self.training:
y=checkpoint(
blk.__call__,
y,
None,
None
)[0]
else:
y = blk(y, None, None)[0]
... | Python | 1 |
quired(false))
.arg(Arg::with_name("he_auth_usr").short('u').long("hubitat_auth_usr").env("HE_AUTH_USR").required(false))
.arg(Arg::with_name("he_auth_pwd").short('p').long("hubitat_auth_pwd").env("HE_AUTH_PWD").requires("he_auth_usr").required(false))
... | Rust | 0 |
(tile_size.0 * 3.0, tile_size.0),
Vec2::new(tile_size.0 * 3.0, tile_size.0),
);
for path in vec![
"assets/images/player_1.png".to_string(),
"assets/images/player_2.png".to_string(),
"assets/images/player_3.png".to_string(),
] {
let handle: Handle<Texture> = asset_ser... | Rust | 0 |
': {'id': '12', 'title': 'Anarchism'}, 'id': '331307'},
{'contributor': {'username': 'Lir', 'id': '4369'}, 'timestamp': '2002-10-02T15:48:04Z', 'page': {'id': '12', 'title': 'Anarchism'}, 'id': '331331'},
{'contributor': {'username': 'Lir', 'id': '4369'}, 'timestamp': '2002-10-02T15:48:46Z', 'pa... | Python | 1 |
from .agent import gr_ua
def headers():
return {
"Accept": "application/json, text/plain, */*",
"Accept-Encoding": "gzip, deflate, br",
"Accept-Language": "en-US,en;q=0.9",
"Referer": "https://fintopio-tg.fintopio.com/",
"Sec-Ch-Ua": '"Not/A)Brand";v="99"... | Python | 1 |
unicast_cipher_list: vec![unicast_cipher],
akm_list: vec![akm::Akm { oui: Oui::MSFT, suite_type: akm::PSK }],
}
}
#[cfg(test)]
mod tests {
use super::*;
use crate::test_utils::{fake_device_info, make_wpa1_ie};
use wlan_common::fake_bss;
const CLIENT_ADDR: [u8; 6] = [0x7A, 0xE7, 0x... | Rust | 0 |
("c", json::json!({ "d": 1 })),
("collect(a, 3)", json::json!([3, 3, 3])),
("repeat(2)", json::json!([null, null])),
("true && false", false.into()),
("((true || false))", true.into()),
("c2[0].d", json::json!(1)),
("(c2[0].d)", json::js... | Rust | 0 |
import pandas as pd
from fold.loop.utils import _set_metadata
from ..base import (
Artifact,
BlockMetadata,
OutOfSamplePredictions,
TrainedPipelineCard,
get_last_trained_pipeline,
get_maximum_memory_size,
)
from .backend import get_backend
from .common import recursively_transform
from .types ... | Python | 1 |
0xA,
0xBC,
])];
let mut dev = new_ad9833(&transitions);
dev.set_phase(PhaseReg::P1, 0xABC).unwrap();
destroy(dev);
}
#[test]
fn can_select_phase0() {
let transitions = [SpiTrans::write(vec![BF::RESET, 0])];
let mut dev = new_ad9833(&transitions);
dev.select_phase(PhaseReg::P0).unwr... | Rust | 0 |
thMaterialTracksP5PtFilter_*_*',
'drop *_MEtoEDMConverter_*_*'
),
SelectEvents = cms.untracked.PSet(SelectEvents = cms.vstring('cosmictrackfinderP5Path',
'globalC... | Python | 1 |
name
(pp, ssize, fields) = d.describeStruct(code)
offset = fields[2].offset()
def children(p):
while True:
val, pad, p = d.split(code, p - offset)
yield val
p = d.extractPointer(buckets + bucketCount * d.ptrSize())
d.putItems(size, children(p)... | Python | 1 |
lse {
Err(TryFromError {
source: source.into_owned(),
})
}
}
}
impl<'a> TryFrom<&'a str> for VersionGroupURI<'a> {
type Error = TryFromError;
fn try_from(source: &'a str) -> Result<Self, Self::Error> {
VersionGroupURI::try_from(Cow::Borrowed(source))
... | Rust | 0 |
x.resources.beat_timer.lock(|timer: &mut BeatTimer| {
timer.start();
});
cx.resources.frame_timer.lock(|timer: &mut FrameTimer| {
timer.start();
});
cx.resources.adc.lock(|adc: &mut Adc| {
adc.start();
});
loop {
cortex_m::a... | Rust | 0 |
Left,
Right,
}
#[derive(Debug, Copy, Clone, Eq)]
pub struct Point {
pub num_line: usize,
pub point_val: usize,
pub line_side: LineSide,
}
impl PartialOrd for Point {
fn partial_cmp(&self, other: &Point) -> Option<Ordering> {
Some(self.cmp(other))
}
}
impl Ord for Point {
fn c... | Rust | 0 |
count: Some(8),
groups: Some(vec![Group {
color: Some("#FFFFFF".to_owned()),
description: Some("epic group".to_owned()),
has_modes: true,
id: 1,
identifier: String::new(),
is_probationary: true,
modes: Some(vec![GameMode::STD, G... | Rust | 0 |
ogin/device-based/validate-password/?shbl=0',data=dataa,cookies={'cookie': koki},headers=heade,allow_redirects=False,proxies=proxs)
if "checkpoint" in po.cookies.get_dict().keys():
if 'ya' in oprek:
akun.append(idf+'|'+pw)
ceker(idf,pw)
elif 'ya' in princp:
print('\n')
statuscp = f'[•] ID... | Python | 1 |
pub type Generator = XoroShiro128StarStar;
// Xoroshiro128** PRNG, by <NAME> and <NAME> <<EMAIL>>.
// ref. <http://xoshiro.di.unimi.it/xoroshiro128starstar.c>
pub struct XoroShiro128StarStar {
s0: cell::Cell<u64>,
s1: cell::Cell<u64>,
}
impl XoroShiro128StarStar {
pub fn new() -> Self {
Self {
... | Rust | 0 |
# -*- coding: utf-8 -*-
###############################################################################
#
# Copyright (C) 2004-today OpenERP SA (<http://www.openerp.com>)
# Copyright (C) 2016-today Geminate Consultancy Services (<http://geminatecs.com>).
#
# This program is free software: you can redistribute it ... | Python | 1 |
# Inverse of softplus: https://github.com/pytorch/pytorch/issues/72759
inv_dt = dt + torch.log(-torch.expm1(-dt))
with torch.no_grad():
dt_proj.bias.copy_(inv_dt)
# Our initialization would set all Linear.bias to zero, need to mark this one as _no_reinit
# dt_proj.bias.... | Python | 1 |
s = 155
Sample_Num = 6307
Rate = [1.2, 0.7687800313360855, 0.2, 0.2, 1.2, 1.2, 0.8474862468452808, 1.2, 0.2, 0.2, 0.6721599889400984, 0.8671683827594867, 0.2, 0.2, 0.7934336157353554, 1.2, 0.2, 0.2, 1.2, 1.2, 0.2, 0.2]
final_score = Cal_Score(File, Rate, Sample_Num, Numclass)
true_label ... | Python | 1 |
#!/usr/bin/env python3
"""
Exemplo de uso do Sistema de Biblioteca Digital
Este arquivo demonstra como utilizar as funcionalidades do sistema programaticamente
"""
from livro import Livro
from usuario import Usuario
from fila import Fila
from pilha import Pilha
from bst import BST
from grafo import Grafo
def exemplo_... | Python | 1 |
tcp_keepalive_cnt:
// ::std::os::raw::c_int);
// pub fn zsock_tcp_keepalive_intvl(_self: *mut ::std::os::raw::c_void)
// -> ::std::os::raw::c_int;
// pub fn zsock_set_tcp_keepalive_intvl(_self: *mut ::std::os::raw::c_void,
// ... | Rust | 0 |
stributions::{Range, Distribution};
let mut rng = rand::thread_rng();
let range = Range::new(0.1, 1.0);
let power = 1.0;
let scale = 1.0 + range.sample(&mut rng);
let mult = range.sample(&mut rng);
let mut g = GraphDef::new();
let node1 = g.new_node(shape![7, 5, 16], "input1", tag![])?;
let node2 = g.new_nod... | Rust | 0 |
# ------------------------------------------------------------------
# Copyright (c) 2023 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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.