text string | label_name string | labels int64 |
|---|---|---|
te::java::lang::Throwable>> {
// class.path == "android/content/SharedPreferences$OnSharedPreferenceChangeListener", java.flags == PUBLIC | ABSTRACT, .name == "onSharedPreferenceChanged", .descriptor == "(Landroid/content/SharedPreferences;Ljava/lang/String;)V"
unsafe {
let __jni... | Rust | 0 |
import openturns as ot
from openturns.viewer import View
f = ot.SymbolicFunction(["x"], ["sin(x)"])
a = -2.5
b = 4.5
# Graph
g = f.draw(a, b, 512)
# Fejer type 1
algo = ot.FejerAlgorithm([20], ot.FejerAlgorithm.FEJERTYPE1)
value, nodes = algo.integrateWithNodes(f, ot.Interval(a, b))
lower = ot.Cloud(nodes, ot.Sample... | Python | 1 |
b, a = signal.butter(4, [low, high], btype='band')
filtered_data = np.zeros_like(data)
# Aplica filtro em cada canal
for i in range(data.shape[1]):
filtered_data[:, i] = signal.filtfilt(b, a, data[:, i])
return filtered_data
def _normalize_da... | Python | 1 |
}", err);
std::process::exit(1);
}
}
}
}
struct EnterFunction;
impl<Term: Terminal> Function<Term> for EnterFunction {
fn execute(&self, prompter: &mut Prompter<Term>, count: i32, _ch: char) -> io::Result<()> {
if prompter.buffer().ends_with('.') {
promp... | Rust | 0 |
#!/usr/bin/env python
# Copyright (c) 2018 Pilz GmbH & Co. KG
#
# 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 your option) any later version.
#... | Python | 1 |
# -*- coding: utf-8 -*-
"""
Created on Tue Dec 24 15:30:41 2019
@author: zixing.mei
"""
import numpy as np
from scipy.linalg.misc import norm
from scipy.sparse.linalg import eigs
def JDA(Xs,Xt,Ys,Yt,k=100,lamda=0.1,ker='primal',gamma=1.0,data='default'):
X = np.hstack((Xs , Xt))
X = np.diag(1/np.... | Python | 1 |
, worst quality"
image = pipe(
prompt=prompt_final[0][0],
negative_prompt=n_prompt,
control_image=control_image,
controlnet_conditioning_scale=controlnet_conditioning_scale,
control_guidance_end=control_guidance_end,
guidance_scale=7.0,
generator=torch.Genera... | Python | 1 |
layer_norm=True, # Whether to use layer normalization.
discount=0.99, # Discount factor.
tau=0.005, # Target network update rate.
expectile=0.7, # IQL expectile.
low_alpha=3.0, # Low-level AWR temperature.
high_alpha=3.0, # High-level AWR temperature.
... | Python | 1 |
ock, &mut msgs[0])?;
return Ok(1);
}
let mut vec_msg_name = Vec::with_capacity(msgs.len());
let mut vec_msg_hdr = Vec::with_capacity(msgs.len());
for msg in msgs.iter_mut() {
let mut hdr: libc::mmsghdr = unsafe { mem::zeroed() };
if let Some(addr) = msg.addr {
vec_... | Rust | 0 |
tity"))
.select(pl.col("ps_suppkey").unique())
.join(q3, left_on="ps_suppkey", right_on="s_suppkey")
.select("s_name", "s_address")
.sort("s_name")
)
q_final.collect()
def test_pdsh_q21(
lineitem: pl.LazyFrame,
nation: pl.LazyFrame,
orders: pl.LazyFrame,
supplie... | Python | 1 |
import pygame
from sys import exit
pygame.init()
def scorepage(WINDOW_WIDTH, WINDOW_HEIGHT, pontuacao, highscore, highscore_name):
tela = pygame.display.set_mode((WINDOW_WIDTH, WINDOW_HEIGHT))
tela.fill((0, 0, 0,))
texto_do_usuario = ""
entrada_concluida= False
fontebase = pygame.font.Font('Oxan... | Python | 1 |
head_obj = self._other_heads[head_name]
prediction = self._predict_head(
head_name=head_name,
head_obj=head_obj,
image_feature=image_feature,
box_tower_feature=box_tower_feature,
feature_index=feature_index,
... | Python | 1 |
group = Value::Number(1.0);
let args = vec![®ex, &full_match];
let result = super::match_modifier(&input, args);
assert_eq!(result, Ok(Value::String(String::from("2test2 string"))));
let args = vec![®ex];
let result = super::match_modifier(&input, args);
assert_... | Rust | 0 |
#encoding: utf-8
import sys
from numpy import array as np_array, float32 as np_float32, int32 as np_int32
# import batch_padder of the corresponding model for different padding indices.
from utils.fmt.plm.roberta.dual_reg import batch_padder
from utils.h5serial import h5File
from cnfg.ihyp import *
def handle(finp... | Python | 1 |
mework.permissions.IsAuthenticated',
],
'DEFAULT_AUTHENTICATION_CLASSES':(
'rest_framework_simplejwt.authentication.JWTAuthentication',
),
# 'DEFAULT_RENDERER_CLASSES':(
# 'rest_framework.renderers.JSONRenderer'
# )
}
from datetime import timedelta
SIMPLE_JWT = {
"ACCESS_TOKE... | Python | 1 |
) != 0)
}
#[doc = "Bit 5 - Port Data Output Value Clear 5"]
#[inline(always)]
pub fn outclr5(&self) -> OUTCLR5_R {
OUTCLR5_R::new(((self.bits >> 5) & 0x01) != 0)
}
#[doc = "Bit 6 - Port Data Output Value Clear 6"]
#[inline(always)]
pub fn outclr6(&self) -> OUTCLR6_R {
OUT... | Rust | 0 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
常见的内建模块练习之collections
author: gxcuizy
date: 2018-10-30
"""
import collections
# 程序主入口
if __name__ == '__main__':
# collections提供了很多的集合类
# 使用nametuple()可以定义一个tuple对象,并且规定了tuple的个数
point = collections.namedtuple('point', ['x', 'y'])
p = point(1, 2)
... | Python | 1 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Python Gmond Module for Memcached
This module declares a "memcached" collection group. For more information,
including installation instructions, see:
http://sourceforge.net/apps/trac/ganglia/wiki/ganglia_gmond_python_modules
When invoked as a sta... | Python | 1 |
# node1 should have quorum now and accept requests
keeper_utils.wait_until_connected(cluster, nodes[0])
node_zks.append(get_fake_zk(nodes[CLUSTER_SIZE].name))
# add rest of the nodes
for i in range(CLUSTER_SIZE + 1, len(nodes)):
node = nodes[i]
node.copy_file_to... | Python | 1 |
j = 0;
let mut party_shares: Vec<FE> = Vec::new();
for i in 1..=PARTIES {
if i == party_num_int {
party_shares.push(secret_shares[(i - 1) as usize]);
} else {
let aead_pack: AEAD = serde_json::from_str(&round3_ans_vec[j]).unwrap();
let key_i = BigInt::to_vec(... | Rust | 0 |
es) - log_pis
return self.f(states, actions, next_states, dones) - log_pis
def calculate_reward(self, states, actions, log_pis, next_states, dones):
with torch.no_grad():
# logits = self.forward(states, actions, log_pis, next_states, dones)
logits = self.f(states, actions, n... | Python | 1 |
# The open() function will return a file object which has reading and writing –related methods.
# Pass ‘r' (or nothing) to open() to open the file in read mode. Pass ‘w' for write mode. Pass ‘a' for append mode.
# Opening a nonexistent filename in write or append mode will create that file.
# Call read() or write() to ... | Python | 1 |
# ========= Copyright 2023-2024 @ CAMEL-AI.org. 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 requ... | Python | 1 |
s:
key: The API key that hit rate limit
retry_after: Seconds to wait before retrying (from API response)
"""
with self.lock:
current_time = time.time()
# Set rate limit duration (default to 60 seconds if not specified)
wait_time = ... | Python | 1 |
eLayout::from_std::<Self>(
shared_vars,
MONO_TYPE_LAYOUT,
Self::S_ABI_CONSTS,
GenericTLData::Enum(GenericTLEnum::exhaustive(
TLDiscriminants::from_u8_slice(rslice![])
)),
)
};
}
/////////////
/// The layout of `extern "C" fn(... | Rust | 0 |
f.write(f"## 检查点 {check_point_index+1}: {check_point}\n\n")
f.write(f"{check_result}\n\n")
logger.info(f"已将检查点 {check_point_index+1} 的结果保存到 {self.output_file_path}")
except Exception as e:
logger.error(f"保存检查点结果到文件时出错: {e}")
# 返回... | Python | 1 |
_result == 0
services_status["dovecot"] = {
"process_running": dovecot_running,
"imap_port_accessible": imap_accessible,
"status": "healthy" if dovecot_running and imap_accessible else "unhealthy"
}
except Exception as e:
services_status["dovecot"... | Python | 1 |
VirtualKeyCode::PageUp => KeyCode::PgUp,
VirtualKeyCode::PageDown => KeyCode::PgDown,
VirtualKeyCode::End => KeyCode::End,
VirtualKeyCode::Home => KeyCode::Home,
VirtualKeyCode::Left => KeyCode::Left,
VirtualKeyCode::Up => KeyCode::Up,
VirtualKeyCode::Right => KeyCode::Ri... | Rust | 0 |
Win32_Data_Xml_MsXml'*"]
pub const DISPID_XMLDOM_NODE_NAMESPACE: u32 = 32u32;
#[doc = "*Required features: 'Win32_Data_Xml_MsXml'*"]
pub const DISPID_XMLDOM_NODE_NODETYPEDVALUE: u32 = 25u32;
#[doc = "*Required features: 'Win32_Data_Xml_MsXml'*"]
pub const DISPID_XMLDOM_NODE_PARSED: u32 = 31u32;
#[doc = "*Required featu... | Rust | 0 |
then(end_of_input()))
.parse_str(text)
{
Ok(v) => println!("{}", v),
Err(e) => println!("{}", e),
}
}
}
//! DMA on the GBA is very different from most embedded devices. It does not run
//! in parallel to the CPU, but rather stops the CPU to preform the memory
//! ... | Rust | 0 |
#[derive(Clone, Default)]
pub(crate) struct AuthInterceptor {
token_provider: Option<Arc<TokenProvider>>,
}
impl fmt::Debug for AuthInterceptor {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("AuthInterceptor")
.field("configured", &self.token_provider.is_some(... | Rust | 0 |
(), &from_glib_borrow(request)).to_glib()
}
unsafe extern "C" fn close_trampoline<P, F: Fn(&P) + 'static>(this: *mut webkit2_sys::WebKitWebView, f: glib_sys::gpointer)
where P: IsA<WebView> {
let f: &F = &*(f as *const F);
f(&WebView::from_glib_borrow(this).unsafe_cast())
}
unsafe extern "C" fn context_menu_t... | Rust | 0 |
urrent_day_iterator, datetime.time.min)
day_end = datetime.datetime.combine(current_day_iterator, datetime.time.max)
timestamps = [
ts
for ts in utils.generate_timestamps(
MakerSettings(day_start, day_end, settings.time_step, settings.jitter)
)
... | Python | 1 |
from flask import Flask, jsonify, request
from flask_sqlalchemy import SQLAlchemy
app = Flask(__name__)
#Set up the SQLite database URI
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///users.db'
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
db = SQLAlchemy(app)
#Define the User model
class User(db.Model):
... | Python | 1 |
"lots": float(lots),
"reason": reason,
"L95": float(rec.L95),
"E_R": float(rec.E_R),
"bounds": rec.bounds,
"p_eff": float(p_eff),
"R_hat": float(R_hat),
"n_eff": int(n_eff),
"alpha_speed": float(alpha_speed),
"consec_losses": int(consec_loss... | Python | 1 |
import time
import re
import urllib
import pymysql
"""
业务逻辑的拆分,和服务器分开,框架进行中间人
读取模板信息,返回自定义的前段模板
open在没有指明参数的话,默认模式是r
"""
#
# url_func_dict = {
# # 字典的方式,比较好一点,但是使用装饰器的话会更简洁
# "/index.html": index,
# "/center.html": center,
# "/login.html": login
# }
url_func_dict = dict()
def route(url... | Python | 1 |
pace_action
irreps = list(space.fibergroup.irreps())
S = 3
xs = np.arange(S) - (S // 2)
if space.dimensionality > 0:
grid = np.stack(np.meshgrid(*[xs]*space.dimensionality))
grid = grid.reshape(space.dimensionality, -1)
else:
grid = np... | Python | 1 |
self.ensure_one()
production = self.raw_material_production_id or self.production_id
if production and (self.state != 'draft' or production.state != 'draft'):
return True
elif production:
return False
else:
return super()._show_details_in_draft(... | Python | 1 |
', 'zh'
#
# html_search_language = 'en'
# A dictionary with options for the search language support, empty by default.
# 'ja' uses this config value.
# 'zh' user can custom change `jieba` dictionary path.
#
# html_search_options = {'type': 'default'}
# The name of a javascript file (relative to the configuration dire... | Python | 1 |
l, b, distance)
})
.map(|h| h >> ((depth_start - self.depth) << 1)) // h_to_lower_depth
.collect();
neigs.sort_unstable(); // sort the array (unstable is ok since we remove duplicates)
neigs.dedup(); // remove duplicates (vector must be sorted first)
let mut bmoc_builde... | Rust | 0 |
message(¬e_off_ch3).unwrap()
);
}
#[test]
fn parses_control_change() {
let cc_ch0 = [0b1011_0000u8, 20u8, 120u8];
let cc_ch15 = [0b1011_1111u8, 48u8, 24u8];
assert_eq!(
MidiMessage::ControlChange { channel: 0, control: 20, value: 120 },
parse_mess... | Rust | 0 |
nderingContext2d as RenderingContext,
HtmlCanvasElement,
},
yew::{
format::{
Bincode,
Json,
Nothing,
Toml,
},
html,
prelude::*,
services::{
fetch::{
FetchService,
FetchTask... | Rust | 0 |
>,
}
impl MidiIoThread {
pub fn new(
config: &MidiConfig,
audio_config: &AudioConfig,
midi_in_tx: Sender<Protocol>,
studio_tx: Sender<StudioProtocol>,
) -> MidiIoThread {
let (driver, endpoints_out, endpoints_in) = Self::init_endpoints(config, midi_in_tx);
drop(studio_tx.send(StudioProtoco... | Rust | 0 |
let indices_loc = builder.indices.as_ptr() as u32 / 2;
let index_array = Uint16Array::new(&memory_buffer)
.subarray(indices_loc, indices_loc + builder.indices.len() as u32);
self.context.inner.buffer_data_with_array_buffer_view(
WebGl2::ELEMENT_ARRAY_BUFFER,
&... | Rust | 0 |
/tables/GPOS.rs
use crate::layout::common::{FeatureList, FeatureVariations, LookupFlags, ScriptList};
use crate::layout::contextual::{
deserialize_gpos7, deserialize_gpos8, ChainedSequenceContextFormat1,
ChainedSequenceContextFormat2, ChainedSequenceContextFormat3, SequenceContextFormat1,
SequenceContextFor... | Rust | 0 |
let part_one = part_one(&template, &rules);
let part_two = part_two(&template, &rules);
Ok((part_one, part_two))
}
fn part_one(template: &str, rules: &Rules) -> PartAnswer {
let start = SystemTime::now();
let polymer = react(template, rules, 10);
let max_count = polymer.most_common_character_c... | Rust | 0 |
"""
.. _read_dolfin_example:
Read FEniCS/Dolfin Meshes
~~~~~~~~~~~~~~~~~~~~~~~~~
PyVista leverages `meshio`_ to read many mesh formats not natively supported
by VTK including the `FEniCS/Dolfin`_ XML format.
This example uses :func:`pyvista.read`.
.. _meshio: https://github.com/nschloe/meshio
.. _FEniCS/Dolfin: http... | Python | 1 |
import re
import matplotlib.pyplot as plt
from model_qt_dsnn_config import *
#this script compares test loss for the same N, same layer number, different C values
N=10
#layer-1
step_num_after_S1=5
decrease_over = 50
decrease_rate = 0.6
num_epochs = 1000
C_vec=[10,20,30,40]
decrease_overStr=format_using_decimal(de... | Python | 1 |
import requests
import sys
from urllib.parse import urlparse
headers = {
'User-Agent' : 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4512.0 Safari/537.36',
'Content-Type' : 'application/x-www-form-urlencoded'
}
poc_payload = "/api/get-organizations?p=123&pageSiz... | Python | 1 |
# Each element in the array is a separate RosChannel.
elif node_type == Nodetype.ARRAY:
sub_node_type = field[1][1][0]
size = field[1][1][1]
channels = []
for i in range(size):
sub_field = (field_name, sub_node_type)
channels.exte... | Python | 1 |
0x4d, 0xed, 0x00, 0x85,
0xdc, 0xa5, 0xbd, 0x68, 0x8d, 0xdf, 0x72, 0x2e, 0x2c, 0x0f, 0xaf, 0x9d, 0x0f, 0xb2, 0xce, 0x7a,
0x0c, 0x3f, 0x2c, 0xee, 0x19, 0xca, 0x0f, 0xfb, 0xa4, 0x61, 0xca, 0x8d, 0xc5, 0xd2, 0xc8, 0x17,
0x8b, 0x07, 0x62, 0xcf, 0x67, 0x13, 0x55, 0x58, 0x49, 0x4d, 0x2a, 0x96, 0xf1, 0xa1, 0x39, 0... | Rust | 0 |
let cargo_init = std::process::Command::new("cargo")
.current_dir(&project_dir)
.arg("init")
.stdout(std::process::Stdio::null())
.stderr(std::process::Stdio::null())
.status()
.expect("failed to execute process");
if !cargo_init.success() {
error("Failed to ... | Rust | 0 |
import os
import asyncio
from dotenv import load_dotenv
load_dotenv()
from swarms.structs import Agent
from swarm_models import Anthropic
from swarms.structs.rearrange import AgentRearrange
llm = Anthropic(
anthropic_api_key=os.getenv("ANTHROPIC_API_KEY"), streaming=True
)
async def sequential():
agent1 =... | Python | 1 |
# Copyright 2011-2012 Canonical Ltd.
#
# This file is part of u1db.
#
# u1db is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License version 3
# as published by the Free Software Foundation.
#
# u1db is distributed in the hope that it will be useful,
# but W... | Python | 1 |
filter.bias.data = biases[i]
nets.append(filter)
if i != len(weights) - 1:
nets.append(torch.nn.ReLU())
return torch.nn.Sequential(*nets)
def _run_spconvs(self, x, filters):
y = filters(x)
return y.dense(channels_first=False)
def _ru... | Python | 1 |
import numpy as np
def setmask(md):
"""
SETHYDROSTATICMASK - establish ocean_levelset field
Determines grounded and floating ice position based on
md.geometry.bed and md.geometry.thickness
Usage:
md = sethydrostaticmask(md)
Examples:
md = sethydrostaticmask(md)
"""
if np.siz... | Python | 1 |
Data::new(header_text),
true => TextData::new(header_text).without_text(),
};
license.headers = vec![header_data];
}
}
Ok(())
}
}
use crate::{
accounts_db::SnapshotStorages,
bank::{Bank, BankSlotDelta},
};
use crate::{
snap... | Rust | 0 |
def add(x, y):
return x + y
def subtract(x, y):
return x - y
def multiply(x, y):
return x * y
def divide(x, y):
if y != 0:
return x / y
else:
return "Error! Division by zero."
if __name__ == "__main__":
print("Select operation:")
print("1.Add")
print("2.Subtract")
... | Python | 1 |
__ = ('__isFirstEntrance',)
def __init__(self):
self.__isFirstEntrance = True
def clear(self):
self.__isFirstEntrance = True
def onSoundModeChanged(self, isRankedSoundMode, initialProgressionState=None):
if isRankedSoundMode:
if self.__isFirstEntrance:
... | Python | 1 |
: *const ::std::os::raw::c_char,
value: float64,
) -> int32;
}
extern "C" {
pub fn DAQmxGet9269CalAdjustPoints(
calHandle: CalHandle,
adjustmentPoints: *mut int32,
bufferSize: uInt32,
) -> int32;
}
extern "C" {
pub fn DAQmxSetup9269Cal(
calHandle: CalHandle,
... | Rust | 0 |
nst CVoid, tick: i32) -> isize {
unsafe { rt_mutex_take(handle, tick) }
}
#[inline]
pub(crate) fn rttbase_mutex_release(handle: *const CVoid) {
unsafe {
rt_mutex_release(handle);
}
}
const RT_WAITING_FOREVER: i32 = -1;
unsafe impl<T: Send> Send for Mutex<T> {}
unsafe impl<T: Send> Sync for Mutex<... | Rust | 0 |
#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct IndexBufferID(pub u64);
#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct TextureID(pub u64);
#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct FramebufferID(pub u64);
// For debu... | Rust | 0 |
const i8;
#[cfg(not(any(target_arch = "armv7l", target_arch = "i686")))]
let egc_ptr = cstring![egc];
unsafe {
c_api::ffi::ncplane_gradient(
plane,
y.unwrap_or(u32::MAX) as i32,
x.unwrap_or(u32::MAX) as i32,
len_y.unwrap_or(0),
len_x.unwra... | Rust | 0 |