text string | label_name string | labels int64 |
|---|---|---|
of upsampling scales.
nonlinear_activation (str): Activation function name.
nonlinear_activation_params (dict): Arguments for specified activation function.
mode (str): Interpolation mode.
freq_axis_kernel_size (int): Kernel size in the direction of frequency axis.
... | Python | 1 |
# -*- coding: utf-8 -*-
import matplotlib
matplotlib.use('WXAgg') # do this before importing pylab
import matplotlib.pyplot as pl
from double_pendulum_odeint import double_pendulum_odeint, DoublePendulum
fig = pl.figure(figsize=(4,4))
line1, = pl.plot([0,0], [0,0], "-o")
line2, = pl.plot([0,0], [0,0], "-o")
pl.axis("e... | Python | 1 |
json.dump(json_data, fp)
def main():
articles_path = os.path.abspath("comm_use_subset_100") + "/"
#articles_path = os.path.abspath("gold_standard_subset_10") + "/"
articles = [f for f in listdir(articles_path) if isfile(join(articles_path, f))]
metaf = "meta_subset_100.csv"
#... | Python | 1 |
um0 - 1) * variance0 + (num1 - 1) * variance1
d_tmp_11 = exe.run(feed={'x': d_tmp_9[0], 'y': d_tmp_10[0]}, fetch_list=[math_add]) # (num0 - 1) * variance0 + (num1 - 1) * variance1 + (num2 - 1) * variance2
d_tmp_12 = exe.run(feed={'x': d_tmp_2[0], 'y': d_tmp_4[0]}, fetch_list=[math_add]) # num0 * (avg0... | Python | 1 |
# run.py - 项目唯一启动入口
import os
import sys
import logging
import argparse
import json
# 将src目录添加到Python路径中,确保可以导入tonypy包
src_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'src')
sys.path.insert(0, src_path)
from tonypy.engines.main_engine import MainEngine
from tonypy.engines.strategy_engine import S... | Python | 1 |
always)]
pub fn variant(self, variant: PIO1_PIN10_SEC_MASK_A) -> &'a mut W {
self.bit(variant.into())
}
#[doc = "Pin state is blocked to non-secure world."]
#[inline(always)]
pub fn blocked(self) -> &'a mut W {
self.variant(PIO1_PIN10_SEC_MASK_A::BLOCKED)
}
#[doc = "Pin state... | Rust | 0 |
er4' not in name:
parameter.requires_grad_(False)
if return_interm_layers:
# return_layers = {"layer1": "0", "layer2": "1", "layer3": "2", "layer4": "3"}
return_layers = {"layer2": "0", "layer3": "1", "layer4": "2"}
self.strides = [8, 16, 32]
self.... | Python | 1 |
#!/usr/bin/env python
from PIL import Image
def set_LSB(value, bit):
if bit == '0':
value = value & 254
else:
value = value | 1
return value
def get_LSB(value):
if value & 1 == 0:
return '0'
else:
return '1'
def get_pixel_pairs(iterable):
a = iter(iterable)
... | Python | 1 |
Reader of field `KEY0_DATA3`"]
pub type KEY0_DATA3_R = crate::R<u32, u32>;
impl R {
#[doc = "Bits 0:31"]
#[inline(always)]
pub fn key0_data3(&self) -> KEY0_DATA3_R {
KEY0_DATA3_R::new((self.bits & 0xffff_ffff) as u32)
}
}
<reponame>JoshiDhima/Bathbot
use std::sync::Arc;
use chrono::{Datelike, U... | Rust | 0 |
() {
init_corvus_class!("Script", |class| {
class.def_self("new", corvus_script_disallow_new);
class.def("corvus_call", corvus_script_private_corvus_call);
class.def("call_interpreted", corvus_script_interpret);
class.def("input_types", corvus_script_input_types);
class.def("return_type", corvus_... | Rust | 0 |
, false, false, true, true, true],
vec![false, true, false, false, true, false, false, true, false, false, true, false, false, true, false, false, true, false, false, false]
]
}
fn is_seamonster(tile: &Tile, x: usize, y: usize, sm_pixels: &Vec<Vec<bool>>) -> bool {
for (j, sm_row) in sm_pixels... | Rust | 0 |
rent, x);
}
pub fn remove(&mut self) -> Option<T> {
if self.current >= self.tabs.len() {
None
} else {
if self.current > 0 {
self.current -= 1;
}
Some(self.tabs.remove(self.current))
}
}
pub fn current(&self) -> Op... | Rust | 0 |
self._api_response = self._call_zapi('user.update', user_object)
self.parse_zabbix_update_result(self._api_response, 'userids')
def _prepare_media(self):
media = []
for media_type in ZabbixMediaContainer.MEDIA_TYPES:
user_media_sendto = ZabbixMediaContainer.extract_sendto_from... | Python | 1 |
[serde(rename = "EQ")]
Eq,
#[serde(rename = "OPTN")]
Optn,
#[serde(rename = "SPREADS")]
Spreads,
#[serde(rename = "BUY_WRITES")]
BuyWrites,
#[serde(rename = "BUTTERFLY")]
Butterfly,
#[serde(rename = "IRON_BUTTERFLY")]
IronButterfly,
#[serde(rename = "CONDOR")]
Condor,
#[serde(rename = "IRON_... | Rust | 0 |
class CounterBtn():
def __init__(self):
self.cnt = 0
#
# Create a button with a label and react on click event.
#
btn = lv.btn(lv.scr_act()) # Add a button the current screen
btn.set_pos(10, 10) # Set... | Python | 1 |
from corehq.util.urlvalidate.test.mockipinfo import unresolvable_hostname
from corehq.util.urlvalidate.ip_resolver import CannotResolveHost
from random import sample
from corehq.util.validation import is_url_or_host_banned
from django.test import SimpleTestCase
def sample_range(start, stop):
yield start
num_... | Python | 1 |
from pptx import Presentation
from pptx.util import Inches, Pt
from pptx.dml.color import RGBColor
from pptx.enum.text import PP_ALIGN
from pptx.enum.shapes import MSO_SHAPE
def create_title_slide(prs, title, subtitle):
slide = prs.slides.add_slide(prs.slide_layouts[0])
title_shape = slide.shapes.title
sub... | Python | 1 |
", &self._clutter_behaviour2)
.field("_clutter_behaviour3", &self._clutter_behaviour3)
.field("_clutter_behaviour4", &self._clutter_behaviour4)
.field("_clutter_behaviour5", &self._clutter_behaviour5)
.field("_clutter_behaviour6", &self._clutter_behaviour6)
.f... | Rust | 0 |
ons = core.concrete_or_error(
int, max_iterations, 'The `max_iterations` argument must be statically '
'specified to use `qdwh` within JAX transformations.')
M, N = x.shape
if M < N:
raise ValueError('The input matrix of shape M x N must have M >= N.')
if dynamic_shape is not None:
m, n =... | Python | 1 |
lencoded::de::Error) -> Self {
SmithyRejection::Deserialize(Deserialize::from_err(err))
}
}
impl From<nom::Err<nom::error::Error<&str>>> for SmithyRejection {
fn from(err: nom::Err<nom::error::Error<&str>>) -> Self {
SmithyRejection::Deserialize(Deserialize::from_err(err.to_owned()))
}
}
//... | Rust | 0 |
@return: DescribeCloudRecordStatusResponse
"""
runtime = util_models.RuntimeOptions()
return self.describe_cloud_record_status_with_options(request, runtime)
async def describe_cloud_record_status_async(
self,
request: rtc_20180111_models.DescribeCloudRecordStatusReque... | Python | 1 |
_derive;
extern crate capabilities;
extern crate libc;
use std::convert::From;
use std::ffi::{CString, OsString};
use std::fs;
use std::io::Write;
use std::os::unix::io::AsRawFd;
use std::process::exit;
// The "prctl" library depends on nix, which itself depends on some other stuff. We only need these
// few defines,... | Rust | 0 |
"yao": "ヤオ語",
"yap": "ヤップ語",
"yid": "イディッシュ語",
"yor": "ヨルバ語",
"zap": "ザポテック語",
"zbl": "Blissymbols",
"zen": "ゼナガ語",
"zha": "Zhuang",
"zho": "中国語",
"zul": "ズールー語",
"zun": "ズニ語",
"zxx": "No linguistic content",
"zza": "Zaza"... | Python | 1 |
#!/usr/bin/python3
def lookup(obj):
self.attribute1 = "value1"
def method1(self):
pass
obj = ExampleClass()
print(lookup(obj))
| Python | 1 |
import time
import tensorflow as tf
import numpy as np
class AsyncThreadHost:
def __init__(self, network, log_dir):
self.learning_rate_annealer = None
self.thread_fns = None
self.log_dir = log_dir
self.network = network
# create a summary writer
self.summary_write... | Python | 1 |
Drop for MessageStream {
fn drop(&mut self) {
self.requests.write().remove(&self.id);
}
}
impl Environment {
pub fn sample_direction(&self, dir: &Vec3) -> Vec3 {
let u = 0.5 + f32::atan2(dir.z, dir.x) / glm::two_pi::<f32>();
let v = 0.5 - f32::asin(dir.y) / glm::pi::<f32>();
... | Rust | 0 |
| "|" | "^" .
/// ```
/// use go_parser_rs::expression::add_op;
/// assert_eq!(add_op("+1"), Ok(("1", "+")));
/// assert_eq!(add_op("-1"), Ok(("1", "-")));
/// assert_eq!(add_op("|3"), Ok(("3", "|")));
/// assert_eq!(add_op("^a"), Ok(("a", "^")));
/// assert!(add_op("*a").is_err());
/// ```
pub fn add_op(s: &str) -> IR... | Rust | 0 |
"""
Copyright (c) 2022 Hocheol Lim.
"""
from typing import Any, Dict, Optional, Tuple, Type
import torch
from torch_geometric.nn import GraphConv, global_mean_pool
from .abstract_explainer import AbstractExplainer
class GraphConvNetworkV2(AbstractExplainer):
def __init__(
self,
input_size: int,... | Python | 1 |
ld: Vmcs, flags: ShadowFlags) -> Result<(), Error> {
call!(sys::hv_vmx_vcpu_set_shadow_access(
self.id,
field as u32,
flags.bits() as u64
))
}
}
/// Virtual Machine Control Structure (VMCS) Field IDs.
/// Identify the fields of the virtual machine control structu... | Rust | 0 |
>> (length - DECODE_BITS))];
match long_code {
Code::Empty => *long_code = Code::Long(smallvec![code_index]),
Code::Long(lits) => lits.push(code_index),
_ => { return Err(Error::invalid(INVALID_TABLE_ENTRY)); }
}
}
else if length ... | Rust | 0 |
};
let computed = matrix * identity_matrix();
assert_eq!(desired, &computed);
}
#[then(regex = r"^inverse\((A)\) is the following 4x4 matrix:$")]
async fn inverse_matrix(world: &mut MyWorld, matrix: String, step: &Step) {
let matrix = match world.matrices.get(&matrix).unwrap() {
Matrix::M4x4(m)... | Rust | 0 |
'lineNo': ' 1'},
{'error': '> neighbor '
'1.1.1.1 remote-bs '
'111% Invalid input '
'(at to... | Python | 1 |
import PIL.Image
import numpy as np
# import cv2
from matlab_functions import rgb2gray
from metrics import getGlobalContrastFactor, blurMetric, sharpnessMetric, exposure
# from matlab_functions import im2double, rgb2gray, imgaborfilt
def GetQualityMetric(rgb_array, mask_img):
# data_type=type(gray_array[0,0]... | Python | 1 |
from .. import Provider as PhoneNumberProvider
class Provider(PhoneNumberProvider):
# Sourse: https://en.wikipedia.org/wiki/Telephone_numbers_in_Georgia_(country)
formats = (
"+995 ### ### ###",
"+995 (###) ### ###",
"+995#########",
"0 ### ### ###",
"+995 32 ### ## ##"... | Python | 1 |
# Volatility
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or (at
# your option) any later version.
#
# This program is distributed in the hope that it will ... | Python | 1 |
4 + 8 + 20 + 1 + 1+ 2" fixed-lengths of the frame.
pub const CITA_FRAME_HEADER_LEN: usize = 4 + 4 + 8 + 20 + 1 + 1 + 2;
pub const HEAD_VERSION_OFFSET: usize = 4 + 4;
pub const HEAD_ADDRESS_OFFSET: usize = 4 + 4 + 8;
pub const HEAD_KEY_LEN_OFFSET: usize = 4 + 4 + 8 + 20;
pub const HEAD_TTL_OFFSET: usize = 4 + 4 + 8 + 2... | Rust | 0 |
"{} ({} UTC)",
chrono::Local::now().format("%Y-%m-%d %H:%M:%S"),
chrono::Utc::now().format("%Y-%m-%d %H:%M:%S")
).unwrap();
writeln!(file, "{}\n", program_data.camera.as_ref().unwrap().name()).unwrap();
for ctrl_widgets in &program_data.gui.as_ref().unwrap().control_widgets {
if !(c... | Rust | 0 |
odate different boot
/// protocols like Linux boot and PVH. In Linux boot, the e820 map could be considered as
/// `sections`, but it's already encapsulated in the `boot_params` and thus all the boot
/// parameters are passed through a single struct. In PVH, the memory map table is separated
/// from th... | Rust | 0 |
try:
latest_version = get_latest_pdm_version_from_pypi(project)
except Exception as e:
project.core.ui.warn(f"Failed to get latest version: {e}", verbosity=termui.Verbosity.NORMAL)
latest_version = None
if latest_version is None:
return None
state.update({"latest-version":... | Python | 1 |
s
test_session.add_all([user1, user2, prayer, mark1, mark2, mark3])
test_session.commit()
# Count total marks for prayer
from sqlmodel import func
stmt = select(func.count(PrayerMark.id)).where(PrayerMark.prayer_id == prayer.id)
total_marks = test_sessio... | Python | 1 |
# run.py
# !/usr/bin/env python3
"""
LLM Firewall - Main entry point
This script runs the LLM Firewall API server with command-line options.
"""
import os
import sys
import argparse
import logging
from src.api.api import FirewallAPI
def main():
"""Main entry point for the LLM Firewall"""
parser = argparse.... | Python | 1 |
'Failover Test IP': failover_test_ip_config.get('StaticIp', ''),
'Failover Test Subnet': failover_test_ip_config.get('SubnetMask', ''),
'Failover Test Gateway': failover_test_ip_config.get('Gateway', ''),
'Failover Test DNS1': failover_test... | Python | 1 |
brot magnifier ( color = (magnifier * escape_value)^power )
pub magnifier: f64,
}
impl Default for Environment {
fn default() -> Environment {
Environment {
image_data: ImageData::<f64>::default(),
magnifier: 1.0,
power: 0.8,
}
}
}
<reponame>larryng/primg
... | Rust | 0 |
(stream, read_buf0)| {
assert_eq!(String::from_utf8(read_buf0).unwrap(), auth_response);
trace!(target: "stratum", "Received authorization confirmation");
Timeout::new(future::ok(stream), ::std::time::Duration::from_millis(100))
})
.map_err(|err: timeout::Error<()>| panic!("Timeout: {:?}", err))
.a... | Rust | 0 |
import torch
import torch.nn as nn
import torch.nn.functional as F
from models.layer import Embedding, FullyConnectedLayer
class autodis(torch.nn.Module):
def __init__(self, input_dim, embed_dims, dropout, number, temperature, output_layer=True):
# input (1*16)->MLP->softmax->(number,1),multiply meta-em... | Python | 1 |
log::Message::parse(msg) {
// Ok(msg) => msg,
// Err(e) => {
// tracing::error!("syslog parse error: {}", e);
// return;
// }
//};
//tracing::warn!("recieved syslog: {}", msg);
index_interface
.save_doc(Document {
fields: vec![Field {
... | Rust | 0 |
stringify!(__darwin_mcontext32),
"::",
stringify!(__es)
)
);
assert_eq!(
unsafe { &(*(::std::ptr::null::<__darwin_mcontext32>())).__ss as *const _ as usize },
12usize,
concat!(
"Offset of field: ",
stringify!(__darwin_mcontext32),... | Rust | 0 |
";
const LOGFILE_ARG: &str = "logfile";
const FILTER_ARG: &str = "filter";
const DEFAULT_PORT: &str = "53";
const DEFAULT_ADDRESS: &str = "0.0.0.0";
const DEFAULT_LOGFILE: &str = "queries.log";
/// Args struct for all options
#[derive(Debug)]
struct Args {
pub flag_verbose_num: u64,
pub flag_port: Option<u16>... | Rust | 0 |
assert_eq!(qual_trim.remaining(&vec![3, 2, 4, 11, 7, 8, 27, 26, 40, 42]), 6);
}
}
<reponame>Ykstort/irc_daemon
/* rusty-ircd - an IRC daemon written in Rust
* Copyright (C) 2020 <NAME> <<EMAIL>>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the ... | Rust | 0 |
_element_fingerprint(element)
if fingerprint:
# 전략 생성 및 저장
strategies = self.generate_selector_strategies(fingerprint)
self.selector_cache[identifier] = strategies
self.element_fingerprints[identifier] = fingerprint
self.save_ca... | Python | 1 |
10, 3, 2, 12, 12, 16, 12, 1, 9, 19,
2, 10, 0, 1, 16, 12, 9, 13, 15, 13,
16, 19, 2, 4, 6, 19, 5, 5, 8, 19,
18, 1, 2, 15, 6, 0, 17, 8, 14, 13])
alternative_mat = torch.zeros(se... | Python | 1 |
= 0f32;
let mut height = 0f32;
let ret = unsafe {
bind::SDL_GL_BindTexture(self.as_ptr(), &mut width as *mut _, &mut height as *mut _)
};
if ret != 0 {
Err(SdlError::Others { msg: Sdl::error() })
} else {
Ok((width, height))
}
}
... | Rust | 0 |
brs_victim_type': marshmallow_schemas.NibrsVictimTypeSchema,
'nibrs_weapon_type': marshmallow_schemas.NibrsWeaponTypeSchema,
'offense_classification': marshmallow_schemas.OffenseClassificationSchema,
'ref_agency_type': marshmallow_schemas.RefAgencyTypeSchema,
'ref_continent': marshmallow_schemas.RefCont... | Python | 1 |
import os
# Variables
# 2.1 OS Android
Branch = "V2.1Live"
Revision = 6689754
MajorVersion = 2
MinorVersion = 1
PatchVersion = 0
AssetBundleMajorVersion = 0
AssetBundleMinorVersion = 0
AssetBundlePatchVersion = 6689754
DesignDataBundleMajorVersion = 0
DesignDataBundleMinorVersion = 0
DesignDataBundlePatchVersion = 668... | Python | 1 |
V_SOURCE_PATH);
println!("cargo:rerun-if-env-changed={}", ENV_SOURCE_VERSION);
println!("cargo:rerun-if-env-changed={}", ENV_VMLINUX_PATH);
if get_custom_vmlinux_path().is_some() {
debug!("Generating bindings with BTF of vmlinux");
generate_bindings_vmlinux().unwrap();
} else if get_cus... | Rust | 0 |
import logging
import argparse
import json
import tensorflow as tf
from kite.model.model import Model
from kite.utils.save import save_model, save_frozen_model
from model.model import LexicalModel
from model.prefix_suffix_lm import Model as PrefixSuffixLM
from model.config import Config
logging.basicConfig(level=l... | Python | 1 |
text format and use `wasmer::wat2wasm` to compile
// it into a WebAssembly binary.
//
// Most WebAssembly programs come from compiling source code in a high level
// language and will already be in the binary format.
let wasm_bytes = wat2wasm(
br#"
(module
;; First we define a type with n... | Rust | 0 |
# Test the vtkIntegrateAttributes filter.
from paraview import smtesting
import os
import os.path
import sys
import paraview
paraview.compatibility.major = 3
paraview.compatibility.minor = 4
from paraview import *
smtesting.ProcessCommandLineArguments()
servermanager.Connect()
file1 = os.path.join(smtesting.DataD... | Python | 1 |
}
match self.source.peek() {
Some('`') => {
self.source.consume_peeked();
emit_token!(DelimitedIdentifier on span)
}
Some(_) => emit_error!(
self,
UnexpectedChar,
"'\\r' or '\\n' cannot be a part... | Rust | 0 |
insert("'''".to_string());
for prefix in VALID_STRING_PREFIXES {
set.insert([*prefix, "\"\"\""].concat());
set.insert([*prefix, "'''"].concat());
}
set
}
/// STRINGPREFIX = group(VALID_STRING_PREFIXES)
pub fn get_stringprefix_pattern() -> String {
[&group(VALID_STRING_PREFIXES), "?"].c... | Rust | 0 |
# autogen_bookflow/agents/scene_composer.py
from autogen import AssistantAgent
from config import llm_config # Import the new llm_config dictionary
def create_scene_composer(genre: str):
"""Returns a configured Scene Composer AutoGen agent."""
backstory = (
f"You are a skilled storyteller special... | Python | 1 |
: `\"Win32_NetworkManagement_IpHelper\"`*"]
pub const MAX_MIB_OFFSET: u32 = 8u32;
#[doc = "*Required features: `\"Win32_NetworkManagement_IpHelper\"`*"]
pub const MAX_OPT_SIZE: u32 = 40u32;
#[doc = "*Required features: `\"Win32_NetworkManagement_IpHelper\"`*"]
pub const MAX_SCOPE_ID_LEN: u32 = 256u32;
#[doc = "*Require... | Rust | 0 |
rawdown should be positive
assert 0 <= start_idx < len(sample_returns)
assert 0 <= end_idx < len(sample_returns)
assert start_idx <= end_idx
# Test as list
drawdowns_list, max_dd_list, start_idx_list, end_idx_list = drawdown(sample_returns, as_list=True)
assert i... | Python | 1 |
):
url = reverse('subscription:payment-list')
data = {
'plan': plan.id,
'transaction_id': 'new-transaction-123',
'payment_method': 'ESEWA',
'amount': plan.price,
'currency': 'NPR'
}
response = authenticated_client.post(url, data... | Python | 1 |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from marionette.marionette_test import MarionetteTestCase, skip_if_b2g
class TestElementSize(MarionetteTestCase):
... | Python | 1 |
import matplotlib.pyplot as plt
import numpy as np
logs = ['logu_FTUNetFormer_sam_v1', 'logu_FTUNetFormer_sam_v1']
for log in logs[1:]:
with open("logs/unetformer/"+log, 'r') as f, open("logs/unetformer/"+log+"_loss", "w") as fin:
lines = f.readlines()
for line in lines:
if 'Loss' in li... | Python | 1 |
",
comm.Get_rank(), args.tmpfile[0], args.ports if args.ports is not None else "")
np.random.seed(int(args.rng_seed[comm.Get_rank()]))
if args.ports is not None and len(args.ports) > comm.Get_rank():
p = args.ports[comm.Get_rank()]
if is_port_open(p):
port = server.a... | Python | 1 |
k', 'Car Sharing 3', 'SMS']
sub_trips_columns = ['trip_id', 'sequence_num', 'travel_mode', 'pt_line_id', 'cbd_traverse_type', 'origin_type', 'destination_type', 'origin_id', 'destination_id']
sub_trips = read_csv('sub_trips.csv', names=sub_trips_columns, index_col='trip_id')
sub_trips_summary = sub_trips.groupby('trav... | Python | 1 |
class products:
oran = 10
all = []
def __init__(self,name, quantity, price):
assert quantity > 0, f"miktar {quantity} 0 dan büyük olmalı"
assert price > 0, f"fiyat {quantity} 0 dan büyük olmalı"
self.name = name
self.quantity = quantity
self.price = price
... | Python | 1 |
u8]>,
}
impl<'a> Frame<'a> {
pub fn new<T: Into<Cow<'a, [u8]>>>(bytes: T) -> Self {
Self {
bytes: bytes.into(),
}
}
pub fn next_layer(&self) -> Option<FrameLayer<'_>> {
match self.type_() {
FrameType::Management => {
Some(FrameLayer::Managemen... | Rust | 0 |
ssage);
//! ```
//!
//! [1]: https://tools.ietf.org/html/rfc3261
//! [2]: https://tools.ietf.org/html/rfc2806
//! [3]: https://tools.ietf.org/html/rfc2234
mod parser;
mod message;
/// contains request-related code
pub mod request;
mod response;
/// contains header-related code
pub mod header;
/// Generic data structur... | Rust | 0 |
# Create a placeholder for each value
placeholders = ', '.join(['?' for _ in row])
# Create the INSERT INTO SQL statement
columns = ', '.join([f'"{col}"' for col in df.columns])
insert_sql = f"INSERT INTO {table_name} ({columns... | Python | 1 |
import numpy as np
from pyquil.experiment import plusX
from pyquil.experiment._result import (
ExperimentResult,
ExperimentSetting,
bitstrings_to_expectations,
correct_experiment_result,
ratio_variance,
)
from pyquil.paulis import sZ
def test_bitstrings_to_expectations():
bitstrings = np.arra... | Python | 1 |
/// Only produced by `libclang` 8.0 and later.
NSConsumesSelf = 423,
/// `__attribute__((ns_consumed))`
///
/// Only produced by `libclang` 8.0 and later.
NSConsumed = 424,
/// `__attribute__((objc_exception))`
///
/// Only produced by `libclang` 8.0 and later.
ObjCException = 42... | Rust | 0 |
Ok(Response::new()
.add_message(send_funds_msg)
.add_attribute("action", "license")
.add_attribute("token_id", token_id)
.add_attribute("price", info.funds[0].amount)
.add_attribute("licensee", info.sender))
}
#[cfg_attr(not(feature = "library"), entry_point)]
pub fn query(deps:... | Rust | 0 |
ny
for name_domain in name_domains:
for extra_domain in (
[*self.env['res.partner']._check_company_domain(company), ('company_id', '!=', False)],
[('company_id', '=', False)],
):
product = self.env['product.product'].search(
... | Python | 1 |
to_string();
RTDGetSupergroupFullInfoBuilder { inner }
}
pub fn supergroup_id(&self) -> i64 { self.supergroup_id }
}
#[doc(hidden)]
pub struct RTDGetSupergroupFullInfoBuilder {
inner: GetSupergroupFullInfo
}
impl RTDGetSupergroupFullInfoBuilder {
pub fn build(&self) -> GetSupergroupFullInfo { self.inner... | Rust | 0 |
() // Override #0 or base proc
// world << "Hello"
//
// /hello() // Override #1
// ..() // Calls override #0
// world << "World"
//
// /hello() // Override #2
// ..() // Calls override #1
// world << "!!!"
// ```
//
// To get the nth override, use [get_proc_override]: `let hello = get_proc_override("/proc/hello",... | Rust | 0 |
import tkinter as tk
from tkinter import ttk
import requests
from tkinter import messagebox
tokens = {
"access": None,
"refresh": None
}
# Função para buscar os dados do backend Django
def login():
global tokens
login_url = "http://127.0.0.1:8000/login/"
data = {"username": "seu_usuario", "passwo... | Python | 1 |
game.play(XOPos::row_col(0, 2)?),
/// Ok(Some(XOTokenWinState::X))
/// );
///
/// // try to play after ended
/// assert_eq!(
/// game.play(XOPos::row_col(2, 2)?),
/// Err(XOGameError::GameEndedError)
/// );
///
/// # Ok(())
/// # }
/// ```
///
/// [... | Rust | 0 |
import numpy as np
import matplotlib.pyplot as plt
#### generate random numbers u~U(0,1) and Z~N(0,1)
N = 12000
M = 1000
def ran1(N):
global u,s,w
x = np.zeros(N+1)
y = np.zeros(N+1)
z = np.zeros(N+1)
u = np.zeros(N)
v = np.zeros(N)
w = np.zeros(N)
s = np.zeros(N)
a = 117
b = 113
c = 211
... | Python | 1 |
# Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution(object):
def getTargetCopy(self, original, cloned, target):
"""
:type original: TreeNode
:type cloned: Tre... | Python | 1 |
EMORY_HANDLE_TYPE_D3D12_HEAP_BIT;
pub const EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_RESOURCE_BIT_KHR : i32 = EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_RESOURCE_BIT;
pub const EXTERNAL_MEMORY_HANDLE_TYPE_FLAG_BITS_MAX_ENUM : i32 = 0x7FFFFFF;
pub type ExternalMemoryHandleTypeFlags = i32;
pub type ExternalMemoryFeatureFlagBits = i32;
p... | Rust | 0 |
s=headers) as resp:
return await resp.text()
async def check_queue():
while 1:
while not sender_queue.empty():
await sender(sender_queue.get())
await asyncio.sleep(0.1)
load_plugins()
bot = telepot.aio.Bot(config['token'])
answerer = telepot.aio.helper.Answerer(bot)
loop... | Python | 1 |
d)
.sample_iter(Standard)
.filter(|&n| n < DECIMAL_RADIX as u128 * DECIMAL_RADIX as u128)
.take(100_000)
.collect();
eprintln!("{:?}", test_div_base(mul_inv_base, &nums));
eprintln!("{:?}", test_div_base(mul_inv_base_2, &nums));
eprintln!("{:?}", test_div_base(div_op_base, &... | Rust | 0 |
let mut latest = 0;
let mut driver = DriverCore::new(instance, votes.clone());
for r in 0..1000 {
let i = r % (keys_vec.len() - 1);
driver
.add_response(i as u16, &states_vec[i].current_round_data)
.unwrap();
if let Some(cert_message) ... | Rust | 0 |
import resend
import requests
import json
from langchain_core.tools import tool
from .config import config
from .prompt.prompt import prompt_all
smtp_config = config.get("send_email", {})
resend_api_key = smtp_config.get("resend_api_key")
from_email = smtp_config.get("from_email")
openai_api_key = smtp_config.get("ope... | Python | 1 |
JV::from(i.as_u64().unwrap()),
(_, true) => JV::from(i.as_i64().unwrap()),
_ => JV::from(0u64),
},
RV::Map(vkv) => JV::Object(
vkv.into_iter()
.map(|(k, v)| {
(
k.as_str().unwrap_or_default().to_string(),
... | Rust | 0 |
ormance_plot(
pre_performance_list, post_performance_list, model)
def _create_performance_plot(self, pre_performance_list, post_performance_list, model):
"""创建性能对比图"""
category = ['Math', 'NLU', 'Reasoning', 'Knowledge', 'Safety']
bar_width = 0.4
r1 = np.arange(len(categ... | Python | 1 |
class Solution:
def delNodes(self, root: TreeNode, to_delete: List[int]) -> List[TreeNode]:
ans = []
toDeleteSet = set(to_delete)
def dfs(root: TreeNode, isRoot: bool) -> TreeNode:
if not root:
return None
deleted = root.val in toDeleteSet
if isRoot and not deleted:
ans... | Python | 1 |
# sqli_tester.py
#!/usr/bin/env python3
import requests
import argparse
import time
from urllib.parse import quote_plus
# danh sách payloads (cơ bản, có thể mở rộng)
PAYLOADS = [
# Error-based / syntax
"'",
"\"",
"')",
"')--",
"\"'--",
"' OR '1'='1",
"' OR '1'='1' -- ",
"' OR '1'='1... | Python | 1 |
let v = cpu.get_D_reg();
cpu.set_L_reg(v);
}
fn ld_L_E(cpu: &mut Cpu) {
let v = cpu.get_E_reg();
cpu.set_L_reg(v);
}
fn ld_L_H(cpu: &mut Cpu) {
let v = cpu.get_H_reg();
cpu.set_L_reg(v);
}
fn ld_L_HL(cpu: &mut Cpu) {
let v = cpu.deref_HL();
cpu.set_L_reg(v);
}
fn ld_HL_B(cpu: &mut Cp... | Rust | 0 |
feature = "dxgi1_2")]
impl From<DXGI_ADAPTER_DESC2> for AdapterDesc2 {
fn from(src: DXGI_ADAPTER_DESC2) -> AdapterDesc2 {
AdapterDesc2 {
description: String::from_utf16(&src.Description).unwrap(),
vendor_id: src.VendorId,
device_id: src.DeviceId,
sub_sys_id: s... | Rust | 0 |
*kw_args)
def check_arguments(self, args):
for check in self.checks:
check(args)
def parse(self):
args = self.parser.parse_args()
self.check_arguments(args)
args.input_arguments = copy.deepcopy(args)
args.nranks, args.distributed = distributed.init(args.ra... | Python | 1 |
import gdown
import os
import shutil
import urllib.request
cambridge_scenes = {
'OldHospital': 'https://www.repository.cam.ac.uk/bitstreams/ae577bfb-bdce-488c-8ce6-3765eabe420e/download',
'KingsCollege': 'https://www.repository.cam.ac.uk/bitstreams/1cd2b04b-ada9-4841-8023-8207f1f3519b/download',
'StMarysC... | Python | 1 |
ast::LitInt(i, ast::TyI64) => Some(KeyI64(i as i64)),
ast::LitUint(i, ast::TyU8) => Some(KeyU8(i as u8)),
ast::LitUint(i, ast::TyU16) => Some(KeyU16(i as u16)),
ast::LitUint(i, ast::TyU32) => Some(KeyU32(i as u32)),
ast::LitUint(i, ast::Ty... | Rust | 0 |
``json
/// {
/// "id": 47,
/// "user_id": 7,
/// "created": "2019-11-01T14:30:30",
/// "option_id": 23
/// }
/// ```
#[get("/answers/{id}")]
pub async fn get(pool: Data<DbPool>, data: Path<i32>) -> Result<HttpResponse, Error> {
let answer_id = data.into_inner();
let connection = pool.get().expect("c... | Rust | 0 |
4::default() );
s.mat_prec.resize( num_sources, Mat4::default() );
// calculate covariance and precision matrices
for i in 0..num_sources {
for j in 0..data_vector_length {
for k in j..data_vector_length {
let mut a = 0.;
for data_... | Rust | 0 |
pub fn severity(&self) -> Severity {
self.severity
}
}
impl Severity {
pub const MIN: Self = Self::Warning;
pub const MAX: Self = Self::Bug;
pub fn into_codespan_severity(self) -> codespan_reporting::diagnostic::Severity {
use codespan_reporting::diagnostic::Severity as CSRSeveri... | Rust | 0 |
;
pub mod tokens;
pub mod update;
pub mod voting;
use std::{collections::HashSet, net::SocketAddr, string::String, time::Duration};
use zebra_chain::parameters::Network;
use crate::BoxError;
/// The number of times Zebra will retry each initial peer, before checking if
/// any other initial peers have returned addre... | Rust | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.