text string | label_name string | labels int64 |
|---|---|---|
"""
Configuration module for the Finance Agent application.
"""
import os
from typing import Optional
from dotenv import load_dotenv
# Load environment variables
load_dotenv()
class Config:
"""Application configuration."""
# LLM Provider Selection
LLM_PROVIDER: str = os.getenv("LLM_PROVIDER", "google... | Python | 1 |
{
let game_rules = world.resource::<GameRules>();
let add_new_player = random::<bool>();
add_new_player && total_players < game_rules.max_players
};
// Randomly add a new player
if should_add_player {
world.spawn().insert_bundle((
Player {
name: fo... | Rust | 0 |
from collections import deque
INF = int(1e9)
# ์๋์ ๋์ฐฉ์ง๋ก ๋ฐ๋ ค๋ค ์ค ๋๋ง๋ค ์ฐ๋ฃ๊ฐ ์ถฉ์
# ์ฐ๋ฃ๊ฐ ๋ฐ๋ฅ๋๋ฉฐ ์
๋ฌด ์ข
๋ฃ
dx = [-1, 1, 0, 0]
dy = [0, 0, -1, 1]
# ํ์ฌ ์์น์์ ์ต๋จ๊ฑฐ๋ฆฌ๊ฐ ๊ฐ์ฅ ์งง์ ์น๊ฐ
# ์งง์ ์น๊ฐ์ด ์ฌ๋ฌ๋ช
์ด๋ฉด, ์ด ๋ฒํธ๊ฐ ๊ฐ์ฅ ์์ ์น๊ฐ
# ๋ชจ๋ ๋ค ๋ฐ๋ ค ๊ฐ์ ์์ผ๋ฉด, ๋จ์ ์ฐ๋ฃ์์ ์ถ๋ ฅ
# graph, ์น๊ฐ ์, ์ฐ๋ฃ ์
n, m, k = map(int, input().split())
graph = [list(map(int, input().split())) for ... | Python | 1 |
#!/usr/bin/env python
from __future__ import print_function
import argparse
import time
import twitter
TWITTER_CONSUMER_KEY = '<TWITTER_CONSUMER_KEY>'
TWITTER_CONSUMER_SECRET = '<TWITTER_CONSUMER_SECRET>'
TWITTER_ACCESS_TOKEN_KEY = '<TWITTER_ACCESS_TOKEN_KEY>'
TWITTER_ACCESS_TOKEN_SECRET = '<TWITTER_ACCESS_TOKEN_SE... | Python | 1 |
}
Err(_) => panic!(),
}
}
/// Returns the path exactly as specified in the config. Caller must free returned string.
#[no_mangle]
pub extern "C" fn processoptions_getRawPath(proc: *const ProcessOptions) -> *mut libc::c_char {
assert!(!proc.is_null());
le... | Rust | 0 |
st_ok=True)
# Process based on dataset
if args.dataset.lower() == 'food-101':
process_food101(
args.data_dir,
args.output,
args.split,
args.img_size,
args.num_classes,
args.max_samples,
args.workers
)
... | Python | 1 |
_map::UnorderedMap;
pub mod unordered_set;
pub use self::unordered_set::UnorderedSet;
pub mod tree_map;
pub use self::tree_map::TreeMap;
mod index_map;
pub(crate) use self::index_map::IndexMap;
pub(crate) mod free_list;
pub(crate) use self::free_list::FreeList;
/// Storage key hash function types and trait to over... | Rust | 0 |
https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [mii_phy_adr](index.html) module"]
pub struct MII_PHY_ADR_SPEC;
impl crate::RegisterSpec for MII_PHY_ADR_SPEC {
type Ux = u8;
}
#[doc = "`read()` method returns [mii_phy_adr::R](R) reader structure"]
impl crate::Readab... | Rust | 0 |
result of the integration.
///
/// Note that these are not the only options here--there are many, many ways you can deal with
/// concurrent access. But when in doubt, a plain old `Mutex` is often a good bet. For example,
/// this might look like a good situation for a `RwLock`--after all, there's no reason for a rea... | Rust | 0 |
authors = {
"J.K. Rowling": 15,
"Stephen King": 65,
"Agatha Christie": 85,
"George Orwell": 12,
"J.R.R. Tolkien": 20,
"Jane Austen": 6,
"Leo Tolstoy": 10,
"Mark Twain": 30,
"Charles Dickens": 25,
"F. Scott Fitzgerald": 5,
}
# Create an empty list
authors_below_twenty_five = []
... | Python | 1 |
from airflow import DAG
from airflow.operators.python import PythonOperator
from airflow.utils.dates import days_ago
from datetime import timedelta
from airflow.hooks.postgres_hook import PostgresHook
# PostgreSQL connection ID configured in Airflow
PG_CONN_ID = 'postgres_conn'
default_args = {
'owner': 'kiwilyti... | Python | 1 |
ir_size(&builder);
let unroll_size = builder.cst_size(n_chained);
let thread_size = builder.cst_size(wrap_size);
let d0 = builder.open_dim_ex(loop_size, DimKind::LOOP);
let d1 = builder.open_dim_ex(unroll_size, DimKind::UNROLL);
let d2 = builder.open_dim_ex(thread_size, DimKind::THREAD);
let _ ... | Rust | 0 |
'''
3
5 2 3 1 1
10 2 1 3 2 2 5 4 2 1
10 1 1 2 1 2 2 1 2 1
1
3 2 0 1
'''
def stepbystep(point, charge):
global min_cnt
# global cnt # ๋๋ฒ๊น
์ฉ
# ์ต์ ๊ฐ์ ๋์ด๊ฐ์ ๊ฒฝ์ฐ, ๊ทธ๊ฑด return
if charge > min_cnt: # ์ต์ ํ๋ฒ์ ๋๊ณ ๋์ ๋ฐฑํธ๋ํน์ด ๊ฐ๋ฅํ๋ค
return
# ์ด ๊ฒฝ์ฐ ์น ๋ค ๋์๋ฒ๋ฆฌ๋ ๊ฒ ๊ฐ์๋ฐ
# ์ธ๋ฑ์ค๊ฐ ๊ฐ์ ๋์ฐฉ ํน์ ๊ทธ๊ฒ์ ๋์ด ๊ฐ ๊ฒฝ์ฐ
i... | Python | 1 |
recursive(mass: u64) -> u64 {
let mut total = 0;
let mut cur = mass;
while cur > 0 {
cur = fuel_for_module(cur);
total += cur;
}
total
}
pub fn parse_file(f: Box<dyn io::BufRead>) -> Vec<u64> {
f.lines()
.map(|l| u64::from_str_radix(&l.unwrap(), 10).unwrap())
.co... | Rust | 0 |
#!/usr/bin/env python3
#
# Author: Panagiotis Chartas (t3l3machus)
#
# This script is part of the Villain framework:
# https://github.com/t3l3machus/Villain
import os
from .common import system_type
from .settings import Logging_Settings
main_meta_folder = Logging_Settings.main_meta_folder_unix if system_type in ['... | Python | 1 |
_sets_the_object_on_the_intersecion() {
let r = Ray::new(
Point3D::new(0.0, 0.0, -5.0),
Vector3D::new(0.0, 0.0, 1.0),
);
let s = Node::new(Box::new(Sphere::new()));
let xs = s.intersect(&r);
assert_eq!(2, xs.len());
// &Shape ๅๅฃซใงใฎๆฏ่ผใ ใจใใขใใฌในใๅใใงใ s... | Rust | 0 |
me_signature::TimeSignature::new(4, 8)
);
let (time, notes) = compo.get(0).get(0);
assert_eq!(time, &music_time::MusicTime::new(1, 1, 1));
assert_eq!(notes, &vec![62, 66, 69, 73]);
let (time, notes) = compo.get(0).get(1);
assert_eq!(time, &music_time::MusicTime::new(1, 3, 1));
assert_eq!(notes, &vec![62... | Rust | 0 |
()
.unwrap()
.unchecked_into::<HtmlInputElement>()
.value();
state.password = password;
});
html! {
<form onsubmit={handle_form_submit}>
<h1>{"Login"}</h1>
<div>
... | Rust | 0 |
Waterman {
fn fmt(&self, form:&mut Formatter) -> Result {
//nrows already has an extra over the sequence counts for the row of zeros
for row in 0..self.matrix.nrows()+1 {
for col in 0..self.matrix.ncols()+1 {
let _ = if col==0 && row>1{
write!(form, "{... | Rust | 0 |
:], device=self.device, dtype=torch.float32),
"ref_boxs":torch.tensor(ref_boxs_np[None, :], device=self.device, dtype=torch.float32),
"valid_mask":torch.tensor(valid_mask, device=self.device, dtype=torch.float32).unsqueeze(0),
"bbox_size":torch.tensor(bb... | Python | 1 |
or(0.0, -0.1, 0.0),
wind: Tuple::vector(-0.01, 0.0, 0.0),
};
let red = Color::red();
while proj.position.y > 0.0 {
tick(&env, &mut proj);
match Pixel::from_point_for_canvas(proj.position, &canvas) {
Pixel::Coordinate { x, y } => {
canvas.write_pixel(x, ... | Rust | 0 |
This method can be used for applications. When APIS are being developed
to serve over the web or when terminal applications are being written
to read from files and infer, this method comes in handy
Parameters
----------
lines : List[str]
List of text spans ... | Python | 1 |
s*?:\s*?album[\s_]musical
)").unwrap(),
actor_titles: Vec::new(),
actor: Regex::new(r"(?imsx)(?:
cat[รฉe]gor(y|ie)\s*?:\s*?act(eur|rice)
)").unwrap(),
}
}
}
fn write_titles(titles: &mut Vec<String>, output_directory: &str, output_file: &str) {... | Rust | 0 |
smit data
/// * `TxLength`: Length of this buffer.
/// * `RxBuffer`: Receive data.
/// * `RxLength`: Length of the response buffer.
/// * `pdwBytesReturned`: Length of response.
///
/// This function will be passed the length of the buffer `RxBuffer` in `RxLength` and it must set the length of the received da... | Rust | 0 |
mlr, monome }
};
let mut setup = |_context: &mut Context, _user_data: &mut MLRRenderer| -> Result<(), error::Error> {
println!("Setting up");
let task = BelaApp::create_auxiliary_task(&mut monome_task, 10, "monome_task");
BelaApp::schedule_auxiliary_task(&task)?;
println!("ok");... | Rust | 0 |
Script::from_slice(&[
0x40, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07,
0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07,
0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x0... | Rust | 0 |
(&shape, "ch05_shrink_x.ppm");
// shrink it and rotate it!
shape.transform = Transformation::new()
.scale(0.5, 1.0, 1.0)
.rotate_z(PI / 4.0)
.build();
draw_shape(&shape, "ch05_shrink_rotate.ppm");
// shrink it and skew it!
shape.transform = Transformation::new()
.sc... | Rust | 0 |
(name) => Function(name),
Deser::OnKeyDown(key) => OnKeyDown(key),
Deser::OnKeyUp(key) => OnKeyUp(key),
Deser::OnKeyPressed(key) => OnKeyPressed(key),
Deser::OnShoot => OnShoot,
Deser::OnJump => OnJump,
Deser::WhileJumping => WhileJumping,
... | Rust | 0 |
cmd = ' '.join(args)
info(cmd + "\n")
pid = None
with tempfile.NamedTemporaryFile() as f:
self.cmd(cmd + ' >' + self.log_file + ' 2>&1 & echo $! >> ' + f.name)
pid = int(f.read())
debug("P4 switch {} PID is {}.\n".format(self.name, pid))
if not s... | Python | 1 |
libc::c_ulong) -> *mut libc::c_void;
#[no_mangle]
fn strchr(_: *const libc::c_char, _: libc::c_int) -> *mut libc::c_char;
#[no_mangle]
fn strlen(_: *const libc::c_char) -> libc::c_ulong;
#[no_mangle]
fn strdup(_: *const libc::c_char) -> *mut libc::c_char;
#[no_mangle]
fn xpc_debugger_ap... | Rust | 0 |
"""
Update console
==============
Display one shapes layer on top of one image layer using the add_shapes and
add_image APIs.
.. tags:: historical
"""
import numpy as np
from skimage import data
import napari
# create the viewer and window
viewer = napari.Viewer()
# add the image
photographer = data.camera()
imag... | Python | 1 |
sizecode: u8, func: fn(&mut Self, u8) -> Result<(), ExecError>) -> Result<(), ExecError> { impl_string_repeat!(self, sizecode, func, true) }
fn exec_string_repe(&mut self, sizecode: u8, func: fn(&mut Self, u8) -> Result<(), ExecError>) -> Result<(), ExecError> { impl_string_repeat!(self, sizecode, func, self.flags... | Rust | 0 |
_index)),
String::from(format!("tests/results/{}.csv", file_index)),
file_index,
);
}
#[allow(dead_code)]
fn surf_test() {
let min_num_segments: usize = 3;
let target_step: usize = 7;
let x_size = 35;
let target_num_segments = 4;
let x_num_segments = target_num_segments
... | Rust | 0 |
from utils import youtube_authenticate, get_video_id_by_url, get_channel_id_by_url
def get_comments(youtube, **kwargs):
return youtube.commentThreads().list(
part="snippet",
**kwargs
).execute()
if __name__ == "__main__":
# authenticate to YouTube API
youtube = youtube_authe... | Python | 1 |
import numpy as np
def ackley(x):
return -20 * np.exp(-0.2 * np.sqrt(np.mean(np.power(x, 2)))) - np.exp(np.mean(np.cos(2 * np.pi * x))) + 20 + np.exp(1)
def sphere(x):
return np.sum(np.power(x, 2))
def griewank(x):
D = x.shape[0]
return np.sum(np.power(x, 2) / 4000) - np.prod(np.cos(x / np.sqrt(np.li... | Python | 1 |
och = 15724800_i64;
let mut current_slot = 16128499_i64;
// let d = Float::with_val(120, 0.32);
let mut d = Float::with_val(24, Float::parse("0.32").unwrap());
d.mul_assign_round(100, Round::Nearest);
let r: Rational = Rational::from((d.to_integer().unwrap(), 100));
assert_eq!(is_overlay_slot(&... | Rust | 0 |
rt::LazyV2<CPublishedFile_Unsubscribe_Request> = ::protobuf::rt::LazyV2::INIT;
instance.get(CPublishedFile_Unsubscribe_Request::new)
}
}
impl ::protobuf::Clear for CPublishedFile_Unsubscribe_Request {
fn clear(&mut self) {
self.publishedfileid = ::std::option::Option::None;
self.list_ty... | Rust | 0 |
r())?
.into_json()?;
Ok(json.key)
}
<filename>archive/commands/movie.rs
use crate::{
checks,
model::{MessageContext, Response, ResponseReaction, SettingRole},
reactions,
table::{primitive::Boolean, Movie, MovieVote},
};
use anyhow::{anyhow, Result};
use rand::seq::SliceRandom;
use std::fmt::... | Rust | 0 |
try:
dicionario = {'nome':'Bruno', 'Idade':30}
valor = dicionario['Endereco']
except KeyError:
print("deu erro") | Python | 1 |
#!/usr/bin/env python
import numpy as np
import sys
import os
import subprocess
import argparse
import random
def clean(input_cloud, output_cloud):
subprocess.run(['/BilateralFilter/build/bilateralfilter', input_cloud,
os.path.join(os.path.dirname(input_cloud),
'filtered_cl... | Python | 1 |
from datetime import datetime, timedelta
from apscheduler.schedulers.background import BackgroundScheduler
from apscheduler.triggers.cron import CronTrigger
from notifications.signals import notify
def cyclic_feedback_creation():
from pms.models import Feedback
feedbacks = Feedback.objects.filter(cyclic_ne... | Python | 1 |
er line
for i, (text, bg_color) in enumerate(text_lines):
line_rect = pygame.Rect(box_x, box_y + i * line_height, max_width, line_height)
pygame.draw.rect(screen, bg_color, line_rect)
# Split the text into words and process bold/italic tags
words = text.split(' ')
x_offset =... | Python | 1 |
ๅบ็ฐ๏ผ่พๅบๅฎๅฐstderr
if let Err(e) = serve_future.compat().await {
eprintln!("server error: {}", e);
}
}
fn main() {
// ่ฎพ็ฝฎๅฐๅไปฅ่ฟ่กๆไปฌ็ๅฅๆฅๅญ
let addr = SocketAddr::from(([127, 0, 0, 1], 3000));
// ่ฐ็จ run_server ๅฝๆฐ, ๅฐ่ฟๅไธไธชfuture
// ไธๆฏไธไธช`async fn`ไธๆ ท, ๅฏนไบ`run_server`ๅไปปไฝไบๆ
๏ผ
// ่ฟๅ็future้่ฆ่ฟ่ก
// ้ขๅคๅฐ... | Rust | 0 |
debug!("error index type, index:{}, error:{:?}", i, err);
return Err(err.into());
}
};
}
if input_amount >= output_amount {
return Err(Error::ErrAmount);
}
return Ok(());
}
use crate::StdQuestionBuilder;
use chrono::naive::NaiveDate;
use std::{error::Error, st... | Rust | 0 |
mesh.set_indices(Some(Indices::U32(vec![])));
}
let indices = mesh.indices_mut().unwrap();
let indices = match indices {
Indices::U32(v) => v,
_ => panic!("invalid index width"),
};
let mut indices_push: Vec<u32> = vec![
[0, 1, 2],
[0, 2, 3],
[5, 6, 4],... | Rust | 0 |
eponame>CS301-sustech-zmfl/xv6-rust<gh_stars>0
use crate::define::memlayout::{
PTE_V, PTE_R, PTE_W, PTE_X, PTE_U
};
use crate::memory::address::{ PhysicalAddress, Addr};
use super::page_table::PageTable;
#[derive(Debug, Copy, Clone)]
pub struct PageTableEntry(pub usize);
bitflags!{
pub struct PteFlags:usize ... | Rust | 0 |
for _row in zip(data_df, data_df.index, data_df['code']):
# print(_row)
_redis_name = 'stkRealTimeState:{}_14901'.format(_row[2][:6])
# print(_redis_name)
pipe.hget(name=_redis_name, key=_redis_key)
_index_list.append(_row[1])
... | Python | 1 |
import uuid
import logging
import ipaddress
import time
from aiohttp.web_request import Request
from aiohttp import web
from db.methods import (
get_marzban_profile_db,
get_yookassa_payment,
get_cryptomus_payment,
delete_payment
)
from keyboards import get_main_menu_keyboard
from utils import webhook_... | Python | 1 |
_key(cell, before=f"\n[{i+1}] {cell_e_name}")
for i, cell in enumerate(cells_n):
cell_n_name = cells_n_names[i]
cell_n_val = i + 8
if cells_n_links[i]:
project_data[cell]['link'] = row.get(cells_n_links[i], '')
value = row.... | Python | 1 |
());
return;
}
// this solution have a worse time complexity
for i in 0..nums.len() {
if used[i] == false {
used[i] = true;
path.push(nums[i]);
Self::backtrace(path, used, &nums, res);
path.pop();
... | Rust | 0 |
0, "56.31G");
check(1_456_312_357_123.0, "1.46T");
}
}
<filename>lib/macros/src/lib.rs
//! Proc macros for luao3
use std::fmt::Display;
use darling::FromMeta;
use func::LuaFunctionMeta;
use proc_macro::TokenStream as RawTokenStream;
use syn::parse_macro_input;
#[macro_use]
mod utils;
mod derive;
mod func;... | Rust | 0 |
"""
Subscribe to /ee_pose_commands , where it will find these points and orientations generated by the circular_motion_ee.py script.
Subscribe to the topic /end_effector_real_pose of type geometry_msgs.Vector3 returns the real
positions and chi angle of Frame 3 of the real robot (to be able to compare).
... | Python | 1 |
";
let ogroup_: GroupO<BString, _> =
GroupO::new("P1".into(), "36+ 53+ 53_38+ 38_13+ 13+ 14+ 50-".into(), ());
let fields = ogroup.split_terminator('\t');
let result = GroupO::parse_line(fields);
match result {
Err(why) => println!("Error {}", why),
... | Rust | 0 |
import math
from collections import deque
def solve(grid):
h,w=len(grid),len(grid[0])
vis=[[False]*w for _ in grid]
comps=[]
for i in range(h):
for j in range(w):
if grid[i][j]!=0 and not vis[i][j]:
c=grid[i][j]
q=deque([(i,j)])
vis[i][... | Python | 1 |
r;
use crate::section_0073::print_err;
use crate::section_0079::help1;
use crate::section_0210::if_test;
use crate::section_0289::other_token;
use crate::section_0297::chr_code_type;
use crate::section_0297::cur_tok_repr;
use crate::section_0298::print_cmd_chr;
use crate::section_0327::b... | Rust | 0 |
e) -> bool {
ncurses::is_term_resized(size.lines, size.columns)
}
/// Return `true` if the specified window was modified since the last call
/// to `refresh()`; otherwise return `false`.
pub fn is_wintouched(handle: WINDOW) -> bool {
unsafe { ncurses::is_wintouched(handle) }
}
/// Return `true` if `endwin()` ... | Rust | 0 |
after': after})
async def on_guild_channel_create(self, channel):
await self.engine.process_event('on_guild_channel_create', channel)
async def on_guild_channel_delete(self, channel):
await self.engine.process_event('on_guild_channel_delete', channel)
async def on_guild_role_create(self, ... | Python | 1 |
self.load_program_file(&path),
}?;
debug!("Loaded program: name={}, size={}B", program.name, program.size);
Ok(program)
}
pub fn load_built_in_program(&self, name: &str) -> Result<Program, String> {
let data = match name {
"15puzzle" => &include_bytes!("../../../p... | Rust | 0 |
0..4].copy_from_slice(b"asgn");
id
},
authority_discovery: old.authority_discovery,
}
}
parameter_types! {
pub const DisabledValidatorsThreshold: Perbill = Perbill::from_percent(17);
}
impl noble_session::Config for Runtime {
type Event = Event;
type ValidatorId = AccountId;
type ValidatorIdOf = noble_st... | Rust | 0 |
def next_state(x, y):
if (x, y) in ((0, 0), (0, len(grid) - 1), (len(grid[0]) - 1, 0), (len(grid[0]) - 1, len(grid) - 1)):
return "#"
neighbors_on = 0
for dy in range(-1, 2):
for dx in range(-1, 2):
if dx == 0 and dy == 0:
continue
if 0 <= x + dx < l... | Python | 1 |
from django.contrib import admin
from .models import databases
# Register your models here.
admin.site.register(databases.UserDB)
admin.site.register(databases.WebsiteBlockingDB)
admin.site.register(databases.PreferencesDB)
admin.site.register(databases.AuthenticationTokenDB)
admin.site.register(databases.LabelDB)
adm... | Python | 1 |
from images import Image
from functools import reduce
def blur(image):
def trippleSum(a,b):
(r1,g1,b1) = a
(r2,g2,b2) = b
return (r1+r2, g1+g2, b1+b2)
newImage=image.clone()
for y in range (1,image.getHeight()-1):
for x in range (1,image.getWidth()-1):
oldPixel = ... | Python | 1 |
, Hmap, E, K, V, CidCtr, Umeta, HB>,
_entries: usize,
_random: [usize; 2],
_generation: ::std::boxed::Box<counter::Generation>,
_cid_window: CidT,
_cid_probation: CidT,
_cid_protected: CidT,
_hmap: ::std::marker::PhantomData<Hmap>,
_cid: ::std::marker::PhantomData<CidT>,
_scan: ScanS... | Rust | 0 |
len() {
origl = Some(b2a.len());
} else {
origl = a2b[l];
}
origr = origl;
}
ret.push(match (origl, origr) {
(Some(l), Some(r)) => Some((l, r)),
(None, None) => None,
_ => unreachable!(
... | Rust | 0 |
"""Added local_path
Revision ID: 6d2ab85fff8e
Revises: fafc54af06f8
Create Date: 2024-06-16 01:11:23.252583
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '6d2ab85fff8e'
down_revision = 'fafc54af06f8'
branch_labels = None
depends_on = None
def upgrade() -> N... | Python | 1 |
type Event = Event;
type SendXcmOrigin = xcm_builder::EnsureXcmOrigin<Origin, LocalOriginToLocation>;
type XcmRouter = (TestSendXcmErrX8, TestSendXcm);
type ExecuteXcmOrigin = xcm_builder::EnsureXcmOrigin<Origin, LocalOriginToLocation>;
type XcmExecuteFilter = Everything;
type XcmExecutor = XcmExecutor<XcmConfig... | Rust | 0 |
b fn get<K: Into<Value<'gc>>>(&self, key: K) -> Value<'gc> {
self.0.read().get(key.into())
}
pub fn set<K: Into<Value<'gc>>, V: Into<Value<'gc>>>(
&self,
mc: MutationContext<'gc, '_>,
key: K,
value: V,
) -> Result<Value<'gc>, InvalidTableKey> {
self.0.write(m... | Rust | 0 |
red, tentative, deprecated)"]
#[doc = ""]
#[doc = " @return Pointer to link local IPv4 address, NULL if no proper IPv4 address"]
#[doc = " could be found."]
pub fn net_if_ipv4_get_ll(iface: *mut net_if, addr_state: net_addr_state) -> *mut in_addr;
}
extern "C" {
#[doc = " @brief Get a network interf... | Rust | 0 |
contextDirectory=[],
projectId=None,
forkedFrom=task_resp.taskId,
parentId=None,
inheritContext=False,
noPause=False,
)
fork_task_resp = bindings.post_CreateGenericTask(sess, body=req)
# Get fork task Config
command = ["det", "-m", conf.make_master_url()... | Python | 1 |
#!/usr/bin/python
from __future__ import print_function
from bcc import BPF
from bcc.utils import printb
from time import sleep
import psutil
import ctypes
import time
libcudart_list = [
"/root/miniconda3/envs/tangou101/lib/python3.10/site-packages/torch/lib/../../nvidia/cuda_runtime/lib/libcudart.so.12",
# ... | Python | 1 |
n cooldown backward passes.
###################################################################################################################
_logger.info("Cooldown phase")
if not forward_only:
for i in range(num_warmup_microbatches):
_logger.debug(f"cooldown iter: {i} / {num_warmup_mi... | Python | 1 |
and=lambda: reset_game(failure_window))
again_button.pack()
def reset_game(failure_window=None):
global count
global row_counter
global btn_check
global bull_label
global cow_label
global entry_guesses
global bull_labels
global cow_labels
count = 0
row_counter = 2
for e... | Python | 1 |
generator: Pin<Box<G>>,
}
impl<G> Iterator for FindFiles<G>
where
G: Generator<Yield = io::Result<PathBuf>, Return = ()>,
{
type Item = io::Result<PathBuf>;
fn next(&mut self) -> Option<Self::Item> {
let r = self.generator.as_mut().resume(());
match r {
GeneratorState::Yielde... | Rust | 0 |
print(f"[{i+1}/{len(TEST_CONFIGS)}] {config_name}: Using existing file ({file_size_mb:.2f} MB)")
print(f"\nBenchmark data ready in {data_dir}")
return data_dir
@pytest.mark.benchmark(group="parquet_writes")
@pytest.mark.parametrize("writer", ["native", "pyarrow"])
@pytest.mark.parametrize("target", ["loca... | Python | 1 |
: expr, $workunit_name: expr, $workunit_metadata: expr, |$workunit: ident| async move { $( $body:tt )* $(,)? }) => (
{
let (store_handle, mut $workunit) = $crate::_start_workunit($workunit_store, $workunit_name, $workunit_metadata);
$crate::scope_task_workunit_store_handle(Some(store_handle), asyn... | Rust | 0 |
_result = result;
break;
}
}
}
boosted_result
}
peg::parser! {
pub grammar reindeer() for str {
rule _() = [' ' | '\n']*
rule integer() -> usize
= n:$(['0'..='9']+) {? n.parse().or(Err("Invalid integer.")) }
rule attack_type() -> At... | Rust | 0 |
buffer
.into_iter()
.map(|(Key(key), (keyinfo, msg))| (key, (keyinfo, msg.0))),
DefaultMessageAction,
);
assert_eq!(
size_before + added_size,
node.size() as isize,
"size delta mismatch"
);
check_... | Rust | 0 |
",
k.value().x,
k.value().y,
k.time() * 2.0
),
font: None,
scale: Some(PxScale::from(14.0)),
..Default::default()
});
let p: Point2<f32> = [
(area[0] + k.value().x * area[2] - text.dimensions(ctx).w as f32 / 2.0).round(),
(area[1] + (1.0 - k.value().y) * area[3] - 20.0).rou... | Rust | 0 |
from lwe import Public, Secret
from pytest import fixture
@fixture
def keys() -> tuple[Secret, Public]:
secret = Secret()
public = secret.generate_public_key()
return secret, public
def test_keys() -> None:
secret = Secret()
public = secret.generate_public_key()
assert isinstance(public, Pub... | Python | 1 |
from sciapp.action import Table
import pandas as pd
class Statistic(Table):
title = 'Table Statistic'
note = ['auto_snap', 'num_only', 'auto_msk']
para = {'axis':'Column', 'sum':True, 'mean':True,'max':False,
'min':False,'var':False,'std':False,'skew':False,'kurt':False}
view = [(list, 'axis', ['Row', 'Colu... | Python | 1 |
emigrant_selector=ops.naive_cyclic_selection,
replacement_selector=ops.naive_cyclic_selection,
migration_gap=50)
# Generation 0
context['leap']['generation'] = 0
context['leap']['current_subpopulation'] = 0
pop0 = op(pop0)
assert(pop1[0].genome ==... | Python | 1 |
em,
use_global_map,
match mapping_type.as_str() {
"char-to-char" => true,
"no-reconstruct" => false,
_ => {
println!("Expected mapping type \"char-to-char\" or \"no-reconstruct\", received: {:?}. Proceeding with default (no-reconstruct)", mapping_type)... | Rust | 0 |
= 2
save_data(data)
elif len(referrals) >= 20 and bonus_level < 1:
await send_secret_channel(user_id, 1)
user_data["bonus_level"] = 1
save_data(data)
@dp.message_handler(commands=["start"])
@dp.message_handler(lambda msg: msg.text == "๐ Start โ
")
async def start_handler(message: t... | Python | 1 |
import json
import os
import time
import jieba
from langchain_core.documents import Document
def resolve_assets(relative_path):
"""
ๆ นๆฎ็ธๅฏน่ทฏๅพ่งฃๆๅบ็ปๅฏน่ทฏๅพ
"""
return os.path.join(os.path.dirname(__file__), relative_path)
# ๆฐๆฎ้่ทฏๅพ
data_path = resolve_assets("../data_full/dataset")
print(f'data_path is {data_pa... | Python | 1 |
is turned on for this
/// Session.
pub fn parse(role: Role, credit_based_flow: bool, buf: &[u8]) -> Result<Self, FrameParseError> {
if buf.len() < MIN_FRAME_SIZE {
return Err(FrameParseError::BufferTooSmall);
}
// Parse the Address Field of the frame.
let address_fie... | Rust | 0 |
epoch, 'valid')
self.valid_metrics.update('loss', loss.item(), len(target))
for met in self.metric_ftns:
self.valid_metrics.update(met.__name__, met(output, target), len(target))
# self.writer.add_image('input', make_grid(data.cpu(), nrow=8, normalize=... | Python | 1 |
(-4), rs1: A4 }),
reg_16("flw fa5,-4(a5)", Flw { frd: Fa5, imm: Immediate(-4), rs1: A5 }),
reg_17("flw fa6,-4(a6)", Flw { frd: Fa6, imm: Immediate(-4), rs1: A6 }),
reg_18("flw fa7,-4(a7)", Flw { frd: Fa7, imm: Immediate(-4), rs1: A7 }),
reg_19("flw fs2,-4(s2)", Flw { frd: Fs2, imm: Immed... | Rust | 0 |
10);
}
use spanner_rs::{Client, DatabaseId, Error, InstanceId, ProjectId, SpannerResource};
use ctor::ctor;
use std::ops::{Deref, DerefMut};
use testcontainers::{clients, core::WaitFor, Container, Image};
#[derive(Default, Debug, Clone)]
pub struct SpannerEmulator;
impl Image for SpannerEmulator {
type Args = ();... | Rust | 0 |
from typing import TYPE_CHECKING, TypeVar, Union, Dict, Any, List, Optional
from aiogram import Router, F
from aiogram.filters import Command
from aiogram.types import Message, CallbackQuery
from src.keyboards import get_cancel_button, get_reply_markup
from src.routes.booking.states import NewBookingState, CancelBook... | Python | 1 |
1)
if key == "nsnippet" and temp_dict:
json_data.append(temp_dict)
temp_dict = {}
temp_dict[key] = value
if temp_dict:
json_data.append(temp_dict)
# Restructuring the JSON data
parsed_response_text = {}
for index, item ... | Python | 1 |
:
"""Unit-test suite for `docx.document._Body`."""
@pytest.mark.parametrize(
("cxml", "expected_cxml"),
[
("w:body", "w:body"),
("w:body/w:p", "w:body"),
("w:body/w:sectPr", "w:body/w:sectPr"),
("w:body/(w:p, w:sectPr)", "w:body/w:sectPr"),
... | Python | 1 |
ator", ParameterKind::Fun)])
.with_stack();
// this may need a stack
const LIST_COLLECT: NativeMetaBuilder = NativeMetaBuilder::fun("collect", Arity::Fixed(1))
.with_params(&[ParameterBuilder::new("iter", ParameterKind::Enumerator)]);
pub fn declare_list_class(hooks: &GcHooks, module: Gc<Module>) -> StdResult<()>... | Rust | 0 |
edvits', 'crkedits', 'credkits', 'crehdits', 'cdedits',
'ceredits', 'ciedits', 'cbredits', 'credints', 'credtits', 'crxedits', 'cnredits', 'cmedits',
'credxits', 'cgredits', 'ctredits', 'credihs', 'creditsz', 'criedits', 'icredits', 'credxts',
... | Python | 1 |
// `receiver_account` must implement `PSP3156FlashBorrower`
///
/// Returns `AllowanceDoesNotAllowRefund` error if the contract does not have
/// enough allowance to transfer borrowed amount and fees from `receiver_account`
#[ink(message)]
fn flashloan(
&mut self,
receiver_account: A... | Rust | 0 |
'tcx>>,
) -> Canonical<'gcx, ty::ParamEnvAnd<'gcx, Goal<'gcx>>> {
let mut _orig_values = SmallVec::new();
self.infcx.canonicalize_query(value, &mut _orig_values)
}
fn canonicalize_ex_clause(
&mut self,
value: &ChalkExClause<'tcx>,
) -> Canonical<'gcx, ChalkExClause<'gcx>... | Rust | 0 |
{
#[allow(unused_parens, non_snake_case)]
impl<'a, $( $ty: ResourceSet<'a> ),*> ResourceSet<'a> for ($( $ty, )*)
{
type Result = ($( $ty::Result, )*);
unsafe fn fetch_unchecked(resources: &'a UnsafeResources) -> Self::Result {
($( $ty::fetch_unchecked(re... | Rust | 0 |
r'$r_{\rm max}$ = %.8e'%(soliton_r_max)+'\n'+
r'nbins = %d'%(soliton_nbins),
xy=(0.02,0.02), xycoords='axes fraction' )
# setting for the figure
ax.set_xscale('log')
ax.set_yscale('log')
ax.set_xlim( 0.5*np.min(soliton_densprof_radius), 2.0*np.max(soliton_densprof_radius) )
... | Python | 1 |
y = np.meshgrid(np.linspace(0, 10, 150), np.linspace(-5, 5, 100))
data = np.sin(x) + np.cos(y)
cs = plt.contour(data)
cs.set(path_effects=[
path_effects.PathPatchEffect(edgecolor='black', facecolor='none', linewidth=12),
path_effects.Stroke(linewidth=5)])
for text in plt.clabel(cs, colo... | Python | 1 |
confidence=min_confidence,
) as facemesh:
img_height, img_width, img_channels = img_rgb.shape
assert(img_channels == 3)
results = facemesh.process(img_rgb).multi_face_landmarks
if results is None:
print("No faces detected in controlnet image for Mediapipe face annotator... | Python | 1 |
to decide partition for the msg
pub partition_key: Option<String>,
/// Override namespace's replication
pub replicate_to: Vec<String>,
pub compression: Option<i32>,
pub uncompressed_size: Option<u32>,
/// Removed below checksum field from Metadata as
/// it should be part of send-command whi... | Rust | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.