text string | label_name string | labels int64 |
|---|---|---|
from].concat()).arg(msg.stamp).query_async(&mut rc).await?;
redis::cmd("acl")
.arg("setuser")
.arg(["client:", &msg.from].concat())
.arg("on")
.arg("sanitize-payload")
.arg([">", &msg.data].concat())
.arg("nocommands")
.arg(["+p... | Rust | 0 |
:modint::{ModValue, ModTrait, ModInt};
///
/// #[derive(Debug, Copy, Clone)]
/// struct Mod13 {}
/// impl ModTrait for Mod13 {
/// const MOD: ModValue = 13;
/// }
/// type ModInt13 = ModInt<Mod13>;
///
/// assert_eq!(ModInt13::new(5), ModInt13::new(2) - ModInt13::new(10));
/// ```
pub trait ModTrait: Debug + Copy +... | Rust | 0 |
_metrics(group_name)
logger.info("Disabled metrics collection for group %s.", group_name)
print(
"You must terminate all instances in the group before you can delete the group."
)
print("Set minimum size to 0.")
as_wrapper.update_group(group_name, MinSize=0)
group = as_wrapper.descr... | Python | 1 |
def main():
print('Hello from main!')
if __name__ == '__main__':
main() | Python | 1 |
std::ptr::null(),
dli_fbase: std::ptr::null_mut(),
dli_saddr: std::ptr::null_mut(),
};
unsafe { libc::dladdr(init_stored_proc as *const c_void, &mut module_info) };
// extract name from library metadata
let module_abs_path = unsafe { CStr::from_ptr(module_info.dli_fname) }
.to_s... | Rust | 0 |
/* Clear the stack... */
// TODO: only pop what we put there
let size = self.state.get_top();
self.state.pop(size);
Ok(())
}
fn add_rum_libs(&mut self) {
self.state.new_table();
self.state.set_global("rum");
}
fn lua_func_wrapper(state: &mut lua::State... | Rust | 0 |
herSet().set_closing_type(user_info['level'])) * XiuConfig().closing_exp_upper_limit)) # 获取下个境界需要的修为 * 1.5为闭关上限
if int(get_exp + user_info['exp']) > max_exp_next:
get_exp = 1
msg = f"检测到修为将要到达上限!"
sect_stone = int(userstask[user_id]['任务内容']['sect'])
s... | Python | 1 |
import tkinter as tk
from gui import SignalAnalyzer
if __name__ == "__main__":
root = tk.Tk()
app = SignalAnalyzer(root)
root.mainloop()
| Python | 1 |
epr_compare hook. This sets up this custom
comparison for the test.
"""
ihook = item.ihook
def callbinrepr(op, left: object, right: object) -> str | None:
"""Call the pytest_assertrepr_compare hook and prepare the result.
This uses the first result from the hook and then ensures the
... | Python | 1 |
#!/usr/bin/python3
"""
This module contains the function is_same_class
"""
def is_same_class(obj, a_class):
"""return true if obj is the exact class a_class, otherwise false"""
return (type(obj) == a_class)
| Python | 1 |
)
gr2poly.Update()
dgraph = Mesh(gr2poly.GetOutput(0))
# dgraph.clean() # WRONG!!! dont uncomment
dgraph.flat().color(self._c).lw(2)
dgraph.name = "DirectedGraph"
diagsz = self.diagonal_size() / 1.42
if not diagsz:
return None
dgraph.scale(1... | Python | 1 |
_num(num: u16) -> Self {
match num {
1 => Self::A,
2 => Self::NS,
5 => Self::CNAME,
15 => Self::MX,
28 => Self::AAAA,
_ => Self::UNKNOWN(num),
}
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct Query {
pub qname: String,
... | Rust | 0 |
from .addressTypes import ValueList, ValueSingle, ValueRange
# generated from asar output
# A1 start: A1FA80
objectivesAddr = {
# --- objectives checker functions: A1FA80 ---
'objectivesList': ValueSingle(0xA1FA80),
'objectiveEventsArray': ValueRange(0xA1FB1A, length=2*5),
'objective[kraid_is_dead]': Va... | Python | 1 |
ve to remove them early in order to save rent.
#[pallet::constant]
type DepositPerContract: Get<BalanceOf<Self>>;
/// The balance a contract needs to deposit per storage byte to stay alive indefinitely.
///
/// Let's suppose the deposit is 1,000 BU (balance units)/byte and the rent is 1 BU/byte/day,
/// th... | Rust | 0 |
LINE_THICKNESS};
use ezgui::{Drawable, GeomBatch, GfxCtx, Prerender};
use geom::{Angle, Circle, Distance, Line, Polygon, Pt2D};
use map_model::{BusStop, BusStopID, Map};
const RADIUS: Distance = Distance::const_meters(1.0);
pub struct DrawBusStop {
pub id: BusStopID,
center: Pt2D,
zorder: isize,
draw... | Rust | 0 |
t));
}
// FILENAME
if path.len() == 2 {
// NO FILENAME IN URL
return Ok(root_link(fragment));
}
let last = *path.last().unwrap();
let (modules, filename) = if last.contains('.') {
(&path[2..path.len() - 1], last)
} else {
(&path[2..], "index.html")
};... | Rust | 0 |
from datetime import date
import os
CURRENT_DATE = str(date.today())
base_dir = os.path.dirname(os.path.abspath(__file__))
logs_dir = os.path.join(base_dir, "logs")
os.makedirs(logs_dir, exist_ok=True)
# Default queries for harvest
default_queries = {
"wos": "OG=(Ecole Polytechnique Federale de Lausanne)",
"... | Python | 1 |
"""
Main client for the Cloud189 SDK
"""
import time
import httpx
import uuid
import math
import hashlib
import base64
import json
import random
import logging
from urllib.parse import urlparse, parse_qs
from .constants import *
from .store import MemoryStore
from .utils import get_signature, rsa_encode, aes_encrypt, ... | Python | 1 |
vector_store=vector_store)
vector_index = load_index_from_storage(storage_context=storage_context)
return vector_index, all_nodes
sub_index,sub_nodes = create_subnodes_index(base_nodes)
sub_retriever = sub_index.as_retriever(similarity_top_k=2)
sub_nodes_dict = {n.no... | Python | 1 |
import torch
from torch_scatter import segment_csr
def purity_sampling(xt, x1, x1_probs, unmask_prob, mask_index, batch_size, batch_num_nodes, node_batch_idx, hc_thresh, device):
masked_nodes = xt == mask_index # mask of which nodes are currently unmasked
purities = x1_probs.max(-1)[0] # the highest probabili... | Python | 1 |
"""
A model for the disasters data with a changepoint
changepoint ~ U(0, 110)
early_mean ~ Exp(1.)
late_mean ~ Exp(1.)
disasters[t] ~ Po(early_mean if t <= switchpoint, late_mean otherwise)
"""
from pymc import *
from numpy import array, empty
from numpy.random import randint
__all__ = [
'disasters_array',
... | Python | 1 |
"ORD_OBJT_CBLC_DVSN_CD": ord_objt_cblc_dvsn_cd
}
if loan_dt:
params["LOAN_DT"] = loan_dt
if rsvn_ord_end_dt:
params["RSVN_ORD_END_DT"] = rsvn_ord_end_dt
if ldng_dt:
params["LDNG_DT"] = ldng_dt
res = ka._url_fetch(API_URL, tr_id, "", params, postFlag=True)
... | Python | 1 |
for mov in moves {
match *mov {
Move::Spin(ref x) => {
let len = dancers.len();
dancers.rotate_left(len - *x as usize);
}
Move::Exchange(ref x, ref y) => {
let first = dancers[*x as usize];
let second = dancers... | Rust | 0 |
); // check the right things are in the table now
// Inserting again replaces the existing entries
for i in 0..num {
map.insert(i, num-1-i);
}
assert_eq!(map.values().fold(0, |x, y| x+y), num*(num-1)/2);
// TODO: Test Entry API, Iterators, ...
}
fn main() {
if cfg!(target_os = "macos... | Rust | 0 |
},
}
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Getters)]
#[serde(deny_unknown_fields, rename_all = "kebab-case")]
#[get = "pub"]
pub struct VariableValues {
#[serde(rename = "_note")]
_note: String,
choices: HashMap<String, String>,
default: Option<String>,
values: HashMap<String, V... | Rust | 0 |
counter_1.clone();
let signal_value_sum_1 = Rc::new(Cell::new(0));
let signal_value_sum_2 = signal_value_sum_1.clone();
let update_signal_value = move |precedent_signal_value| {
let current_value = signal_value_sum_1.get();
signal_value_sum_1.set(current_value + precedent_signal_value);
};... | Rust | 0 |
import os
import yaml
import numpy as np
from box import Box
import geomstats.lie_group as lie_group
from geomstats.special_euclidean_group import SpecialEuclideanGroup
import liegroups
SE3_GROUP = SpecialEuclideanGroup(3, epsilon=np.finfo(np.float32).eps)
metric = SE3_GROUP.left_canonical_metric
def load_config(con... | Python | 1 |
indTracker)):
if mindTracker[i]['nodeID'] == nodeID:
mindTracker[i]['turns'] = 1
mindTracker[i]['secret_code'] = ''
mindTracker[i]['cmd'] = 'new'
else:
# increment turn count and keep playing
turn_count += 1
... | Python | 1 |
let comparator = CsvComparator {
old_sizes,
new_sizes,
old_gas_usage,
new_gas_usage,
};
// when
let res = comparator.get_diffs().expect("getting diffs failed");
// then
let mut iter = res.iter();
assert_eq!(
i... | Rust | 0 |
ationProperties(ref v) => encoded_size_application_properties_inner(v),
Section::Data(ref v) => encoded_size_data_inner(v),
Section::AmqpSequence(ref v) => encoded_size_amqp_sequence_inner(v),
Section::AmqpValue(ref v) => encoded_size_amqp_value_inner(v),
Section::Footer(... | Rust | 0 |
from DenseMatrix import DenseMatrix
from SparseMatrix import SparseMatrixCOO as Sp
import numpy as np
import scipy.linalg as sp
import matplotlib.pyplot as plt
# Class for recommending movies to users
"""
Chose a threshold of 0.3, so most people generally like the movies to simulate a real world scenario
"""
#Based o... | Python | 1 |
t empty we start to iterate.
while !bucket.is_empty() {
eccentricity += Distance::ONE;
// We compute the next bucket of nodes, i.e. the next step of the frontier.
bucket = bucket
.into_par_iter()
.flat_map_iter(|node_id| {
... | Rust | 0 |
import sys
import logging
import os
# 把当前文件所在文件夹的父文件夹路径加入到PYTHONPATH
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from DAGscheduling.model.Task import Task
from DAGscheduling.model.Processor import Processor
from DAGscheduling.model.Workflow import Workflow
from DAGscheduling.util.HEFT i... | Python | 1 |
"""
Print summary of all pytest results (saved to JSON files).
Without arguments -- ANSI-colored terminal,
with "md" argument -- Markdown,
with "msg" argument -- GitHub notice/warning message (only for skip/warn).
"""
import sys
from glob import glob
import json
from re import findall
# output type
if len(sys.argv) > ... | Python | 1 |
언어 설정 실패 시 기본 영어 메시지 사용
title = "OMG! Hii guys ✧(≧◡≦) ♡"
description = "Thank you for inviting me to hang with yall (*≧▽≦)\n\nType /help to view my slash commands ♡"
# 환영 메시지 embed 생성
embed = discord.Embed(
title=title, descrip... | Python | 1 |
ing(),
balance: output.wallet.balance().to_string(),
}),
})),
Err(_) => Err(Status::internal("error")),
}
}
fn delete(&self, request: Request<DeleteRequest>) -> Result<Response<DeleteResponse>, Status> {
let input = DeleteWalletInputDa... | Rust | 0 |
0(i32);
fn main() {
let f: Foo;
f = Foo(1);
}
"#,
expect![[r#"
Foo Struct FileId(0) 0..16 7..10
FileId(0) 54..57
"#]],
);
}
#[test]
fn test_struct_literal_for_union() {
check(
r#"
union Foo $0{
x: u32
}
fn ma... | Rust | 0 |
# ============================================================
# CLASE 46: PROYECTO INTEGRADOR
# ============================================================
# 🎯 Objetivo:
# Crear un pequeño sistema de gestión de tareas (ToDo list)
# que integre todo lo aprendido:
#
# - Funciones y clases
# - Manejo de archivos (guard... | Python | 1 |
from __future__ import annotations
from abqpy.decorators import abaqus_class_doc, abaqus_method_doc
from ..Part.Part import Part
from ..UtilityAndView.abaqusConstants import DEFAULT_MODEL, SymbolicConstant
from .Leaf import Leaf
@abaqus_class_doc
class LeafFromPartElementLabels(Leaf):
"""The LeafFromPartElement... | Python | 1 |
RowSlice::Big {
non_null_ids: read_ints_le(&mut data, non_null_cnt)?,
null_ids: read_ints_le(&mut data, null_cnt)?,
offsets: read_ints_le(&mut data, non_null_cnt)?,
values: data,
}
} else {
RowSlice::Small {
... | Rust | 0 |
let messages = gst::BusStream::new(&bus).for_each(|msg| {
use gst::MessageView;
let quit = match msg.view() {
MessageView::Eos(..) => true,
MessageView::Error(err) => {
println!(
"Error from {:?}: {} ({:?})",
msg.get_src().... | Rust | 0 |
my_list = [1,2,3, 'apple', 'lemon']
my_list.append(6)
print(my_list)
# instet
my_list.insert(1, 20)
print()
#remove
my_list.remove(2)
print(my_list)
print()
#pop
poped_element = my_list.pop()
print() | Python | 1 |
impl<'a, T: Scalar, P, Criterion> ConjugateGradient<'a, T, (), P, Criterion> {
pub fn with_operator<A>(self, operator: A) -> ConjugateGradient<'a, T, A, P, Criterion> {
ConjugateGradient {
workspace: self.workspace,
operator,
preconditioner: self.preconditioner,
... | Rust | 0 |
"chrome": "google-chrome",
# "firefox": "firefox",
# "terminal": "gnome-terminal",
# "files": "nautilus",
# "spotify": "spotify",
# "telegram": "telegram-desktop",
# "intellij": "idea"
# }
# command = apps.get(app_name.lower())
# return execute_command(comm... | Python | 1 |
ts below and related plumbing will be removed once support for WASM
// system contracts will be dropped.
#[doc(hidden)]
GasLimit = 40,
/// Too many frames on the runtime stack.
/// ```
/// # use casper_types::system::auction::Error;
/// assert_eq!(41, Error::RuntimeStackOverflow as u8);
... | Rust | 0 |
",
stringify!(zmq_poller_event_t),
"::",
stringify!(fd)
)
);
assert_eq!(
unsafe {
&(*(::std::ptr::null::<zmq_poller_event_t>())).user_data as *const _
as usize
},
16usize,
concat!(
"Offset of fiel... | Rust | 0 |
TF...")
train_hits_vector = 0
for idx, row in train_questions.iterrows():
true_doc_id = row['Answer ID']
if true_doc_id in train_similarity_results_vector[idx]:
train_hits_vector += 1
train_recall_at_3_vector = train_hits_vector / len(train_questions)
print(
f'Recall... | Python | 1 |
, &["subnets"], body, None)?;
debug!("Created subnet {:?}", root.subnet);
Ok(root.subnet)
}
/// Delete a floating IP.
pub fn delete_floating_ip<S: AsRef<str>>(session: &Session, id: S) -> Result<()> {
debug!("Deleting floating IP {}", id.as_ref());
let _ = session.delete(NETWORK, &["floatingips", id.as... | Rust | 0 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
@Time : 2023/5/11 17:46
@Author : alexanderwu
@File : test_run_code.py
@Modifiled By: mashenquan, 2023-12-6. According to RFC 135
"""
import pytest
from metagpt.actions.run_code import RunCode
from metagpt.schema import RunCodeContext
@pytest.mark.asyncio
asyn... | Python | 1 |
mx&ss=fuchsia%2Ffuchsia" ]
"/appmgr" -> "/appmgr/bar.cmx"
"/sys" [ label = "sys" href = "https://cs.opensource.google/search?q=f%3Asys.cml%7Csys.cml&ss=fuchsia%2Ffuchsia" ]
"/" -> "/sys"
"/sys/baz" [ label = "baz" style = "filled" fontcolor = "#ffffff" href = "https://cs.opensource.google/search?q=f%... | Rust | 0 |
),
(1, 2, 2, 0),
(1, 3, 2, 0),
(2, -1, 2, 0),
(2, 3, 2, 0),
(3, 0, 2, 0),
(3, 3, 2, 0),
(4, 0, 2, 0),
(4, 1, 2, 0),
(4, 2, 2, 0),
(2, 1, -2, 2),
... | Rust | 0 |