text string | label_name string | labels int64 |
|---|---|---|
tourTransactionCommit, DetourUpdateThread,
};
use wchar::wch;
use winapi::um::processthreadsapi::GetCurrentThread;
use winapi::um::winnt::{DLL_PROCESS_ATTACH, DLL_PROCESS_DETACH, HANDLE, LPCWSTR};
use winapi::{
shared::minwindef::{DWORD, FALSE, HMODULE, TRUE},
um::{libloaderapi::LoadLibraryExA, winnt::LPCSTR},
... | Rust | 0 |
scene: &Vec<(SnoozyRef<TriangleMesh>, Vec3, Quat)>,
) -> Result<ShaderUniformBundle> {
Ok(scene
.iter()
.map(|(mesh, position, rotation)| {
shader_uniform_bundle!(
instance_transform: raster_mesh_transform(*position, *rotation),
:upload_raster_mesh(ma... | Rust | 0 |
uniforms(canvas)
.with_color([1.0, 0.0, 0.0, 0.5])
.draw();
})
}
<filename>Client/src/lualibfpkg.rs
// Copyright (c) 2021, BlockProject 3D
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the foll... | Rust | 0 |
from langchain import PromptTemplate, LLMChain
from langchain.document_loaders import TextLoader
from langchain.embeddings import LlamaCppEmbeddings
from langchain.llms import GPT4All
from langchain.text_splitter import RecursiveCharacterTextSplitter
from langchain.callbacks.base import CallbackManager
from langchain.c... | Python | 1 |
.2
share 1, label: 000002
close, open, high, low
2020-01-01 1.1, 1.2, 1.3, 1.4
2020-01-02 1.5, 1.6, 1.7, 1.8
2020-01-03 1.9, 2.0, 2.1, 2.2
share 2, label: 000003
close, open, high, low
2020-01... | Python | 1 |
::new(100),
},
Cw20Coin {
address: ADDR2.to_string(),
amount: Uint128::new(50),
},
Cw20Coin {
address: ADDR3.to_string(),
amount: Uint128::new(50),
},
];
let denom = "utest".to_str... | Rust | 0 |
(ref e))))
| Err(Error::Txn(TxnError::Mvcc(MvccError::Engine(EngineError::Request(ref e))))) => {
Some(e.to_owned())
}
Err(Error::SchedTooBusy) => {
let mut err = RegionError::new();
let mut server_is_busy_err = ServerIsBusy::new();
server_is_busy_... | Rust | 0 |
},
8usize,
concat!(
"Offset of field: ",
stringify!(rte_tcp_hdr),
"::",
stringify!(recv_ack)
)
);
assert_eq!(
unsafe { &(*(::std::ptr::null::<rte_tcp_hdr>())).data_off as *const _ as usize },
12usize,
concat!(
... | Rust | 0 |
(vec![col("salary")]))
.and_then(|plan| plan.build())
.map_err(BallistaError::DataFusionError)?;
roundtrip_test!(plan);
Ok(())
}
#[test]
fn roundtrip_empty_relation() -> Result<()> {
let plan_false = LogicalPlanBuilder::empty(false)
.build()
... | Rust | 0 |
l);
}
let e = hir_to_expr(cx, hir, opts, env);
if l.is_some() {
env.remove_mut();
}
e
});
match e {
ExprKind::Lam(_, t, e) if opts.alpha => {
ExprKind::Lam("_"... | Rust | 0 |
pc_module!(crescent);
static USAGE: &'static str = "
Usage:
crescent <objfile> [OPTIONS]
crescent (-h | --help)
Options:
-o <path> Specify the output file or directory to save the image or frames.
Supported formats are PNG, JPG and PPM.
--eye=<x,y,z> Specify the eye pos... | Rust | 0 |
= {}
filters = [{"operator": "is", "field": "title", "value": title}]
if not media_type or media_type == "tvshow":
kodi_items = self._mutils.kodidb.tvshows(filters=filters, limits=(0, 1))
if kodi_items:
details = kodi_items[0]
details["media_type"]... | Python | 1 |
ntryData, dataStart)
dataStart += consumed
tags.append((tag, None, value, valuesPerEntry))
else:
tags.append((tag, 1, None, valuesPerEntry))
else:
# Shift bits to get the masked value.
while mask & 0x... | Python | 1 |
},
Range {
lower_mid: usize,
upper_mid: usize,
mid: usize,
range_start: Box<ImutExprInt<'script>>,
range_end: Box<ImutExprInt<'script>>,
},
}
#[derive(Clone, Debug, Serialize)]
pub(crate) struct LocalPath<'script> {
//pub id: Cow<'script, str>,
pub idx: usize,
... | Rust | 0 |
class Solution:
def maxScoreSightseeingPair(self, values: List[int]) -> int:
maxi= values[0]
maxj = -10000000000
for j in range(1, len(values)):
maxj = max(maxj, maxi + values[j] - j)
maxi = max(maxi, values[j] + j)
return maxj
# TIME COMPLEXITY : ... | Python | 1 |
>Plecra/gl46<filename>src/gl_groups.rs
use super::*;
/// AtomicCounterBufferPName
/// * [`GL_ATOMIC_COUNTER_BUFFER_ACTIVE_ATOMIC_COUNTERS`]
/// * [`GL_ATOMIC_COUNTER_BUFFER_ACTIVE_ATOMIC_COUNTER_INDICES`]
/// * [`GL_ATOMIC_COUNTER_BUFFER_BINDING`]
/// * [`GL_ATOMIC_COUNTER_BUFFER_DATA_SIZE`]
/// * [`GL_ATOMIC_COUNTER_... | Rust | 0 |
# Copyright 2024 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 writing, ... | Python | 1 |
nput)
}
pub fn parse_square(input: &str) -> IResult<&str, Square> {
map(pair(parse_file, parse_rank), |(f, r)| {
Square::make_square(r, f)
})(input)
}
pub fn parse_promotion_piece(input: &str) -> IResult<&str, Option<Piece>> {
opt(alt((
complete(value(Piece::Knight, tag("n"))),
com... | Rust | 0 |
e in TOOLTIP_ARGS."""
super().init_arguments_visible(arguments_visible)
#
# Modify the visibility of any arguments from the defaults here.
#
# Make all arguments invisible by default.
#
for key in iter(arguments_visible):
arguments_visible[key] = False... | Python | 1 |
random integers between 1 and n-1 and
/// testing each as follows:
/// x is primitive if and only if x^{phi(n)/p} != 1 (mod n)
/// for all prime factors p of phi(n), where phi(n) is Euler's
/// totient function.
///
/// Since n / phi(n-1) is O(log(log(n))), it should not take too ma... | Rust | 0 |
() -> Self {
CayleyDicksonPair::new((T::zero(), T::zero()))
}
}
impl<T> NumAddSemigroup for CayleyDicksonPair<T> where T: CayleyDicksonAlgebra {
}
impl<T> NumAddMagma for CayleyDicksonPair<T> where T: CayleyDicksonAlgebra {
fn add(&self, other: &Self) -> Self {
BiFunctor::fmap(&self, &other, T... | Rust | 0 |
env::var("TEST_PG_DB").unwrap(),
);
let url = Url::parse(&conn_string).unwrap();
let params = PostgresParams::try_from(url).unwrap();
let pool = r2d2::Pool::try_from(params).unwrap();
assert_eq!(10, pool.max_size());
}
#[test]
fn test_custom_search_path... | Rust | 0 |
。
///
/// # Examples
///
/// ```
/// use kanaria::utils::CharsUtils;
///
/// assert_eq!(CharsUtils::is_narrow('a'), true);
/// assert_eq!(CharsUtils::is_narrow('A'), true);
/// assert_eq!(CharsUtils::is_narrow('@'), true);
/// assert_eq!(CharsUtils::is_narrow('0'), true);
///... | Rust | 0 |
<T as module::Config>::Currency::transfer(from, to, token_info.data.deposit, AllowDeath)?;
<T as module::Config>::Currency::reserve_named(&RESERVE_ID, to, token_info.data.deposit)?;
Self::deposit_event(Event::TransferredToken(from.clone(), to.clone(), token.0, token.1));
Ok(())
}
#[require_transactional]
... | Rust | 0 |
c<&str> = val.split(SEPARATOR).collect();
let json = arr[1..arr.len()].join(SEPARATOR);
Ok((arr[0].to_string(), json))
}
}
impl KeyfileStorage for DbStorage {
fn put(&self, kf: &KeyFile) -> Result<(), KeystoreError> {
let json = serde_json::to_string(&kf)?;
let val = generate_f... | Rust | 0 |
from typing import List, Dict
import copy
from lgp.env.alfred.alfred_action import AlfredAction
from lgp.env.alfred.alfred_subgoal import AlfredSubgoal
class AlfredHLPreproc:
def __init__(self):
...
def process_sample(self, sample):
try:
del sample["observation"].privileged_info... | Python | 1 |
max: u32,
pub symbol_rate_tolerance: u32,
pub caps: caps::FrontendCaps,
}
#[derive(Copy,Clone,Debug)]
pub struct FrontendStatus {
pub has_signal: bool,
pub has_carrier: bool,
pub has_viterbi: bool,
pub has_sync: bool,
pub has_lock: bool,
pub timedout: bool,
pub reinit: bool
}
#[der... | Rust | 0 |
_ | _ | SWn% t j k
rO} t j | n Xd S( s
unpack serialized message in str into this message instance
:param str: byte array of serialized message, ``str``
i i i s utf-8i N( R R R R
R R t unpackR R R R t _struct_IR t deco... | Python | 1 |
import pytest
import torchvision
import torch
import cv2
import psutil
from pytorch_grad_cam import GradCAM, \
ScoreCAM, \
GradCAMPlusPlus, \
AblationCAM, \
XGradCAM, \
EigenCAM, \
EigenGradCAM, \
LayerCAM, \
FullGrad
from pytorch_grad_cam.utils.image import show_cam_on_image, \
prep... | Python | 1 |
a = 6
b = 3
a /= 2 * b
print(a)
| Python | 1 |
# convert Diffusers v1.x/v2.0 model to original Stable Diffusion
import argparse
import os
import torch
from diffusers import StableDiffusionXLPipeline, AutoencoderKL, UNet2DConditionModel
from transformers import CLIPTextModel, CLIPTextModelWithProjection
import library.sdxl_model_util as model_util
def convert(ar... | Python | 1 |
flow = ControlFlow::Exit,
event => {
io.handle_event(&mut context, &event);
}
})
}
```
*/
pub struct WinitIo {
scale_factor: f32,
display_size: Point,
}
impl IO for WinitIo {
fn scale_factor(&self) -> f32 { self.scale_factor }
fn display_size(&self) -> P... | Rust | 0 |
equest[0..1000].as_bytes()
));
}
#[test]
fn max_message_size_checked_for_headers() {
let mut request = Request::new();
request.max_message_size = Some(150);
let small_request = concat!(
"GET /hello.txt HTTP/1.1\r\n",
"User-Agent: curl/7.16.3 libcurl/7... | Rust | 0 |
from .otBase import BaseTTXConverter
# https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6bsln.html
class table__b_s_l_n(BaseTTXConverter):
"""Baseline table
The AAT ``bsln`` table is similar in purpose to the OpenType ``BASE``
table; it stores per-script baselines to support automatic... | Python | 1 |
from selenium import webdriver
from selenium.webdriver.common.by import By
from alive_progress import alive_bar
from time import sleep
# periodo = input('Pesquisar por periodo? [S] ou [N]\n').upper()
# inicio = '01/{}/{}'.format(date.month, date.year)
# fim = '30/{}/{}'.format(date.month, date.year)
# if periodo == "... | Python | 1 |
#!/usr/bin/env python3
import os
from subprocess import call
import argparse
import multiprocessing
def run_unit_tests(octopus_build_dir, use_verbose_output):
octopus_test_dir = octopus_build_dir + "/test"
os.chdir(octopus_test_dir)
ctest_options = []
if use_verbose_output:
ctest_options.appen... | Python | 1 |
if table_name:
entities.append(table_name)
entity_descriptions[table_name] = entity.get("business_purpose", "")
confidence_scores[table_name] = entity.get("relevance_score", 0.0)
# Process entities_list as fallback
if not entit... | Python | 1 |
"""
pixel8 - Generate pixel art from images.
"""
__version__ = "1.0.0"
__author__ = "Mehul Arora"
__email__ = "aroramehul8@gmail.com"
from .core import create_pixel_line_art, pixelate_bool
from .edges import (
conv_fast, gaussian_kernel_fast, partial_x_fast, partial_y_fast,
gradient_fast, non_maximum_suppres... | Python | 1 |
es in the following way:
Run ``map_fun`` on all ranks
Gather results on rank 0
Call ``reduce_fun`` on all those values
Broadcast the reduced value to all ranks.
Nr r r r{ r\ r- rI r r6 r! r[ r rq r r" )
r] r r r r r r r} r final_results
... | Python | 1 |
\x9c\xc4\xcc\xcc\xc2\x9f\
\x1cV\x03l\xf3\x15\x0c\x06q\xf3\xde\xbdh\xd1\x80u\
\x14=\xbb\xb8\xc7\xa8\xaa\x8aH\x7f?\xce\xbct\x06\x17\
/^\x00Wy\xcd\xa1\xed\xaa\xd5\xabq\xd7\xddwc\
\xcb\xd6-\x04\xe9\xe8\x5c\xa8\xfd\xeb\xe4sb\xd1\x18N\
\x9e\x9c\x85\xb4\xc7\x10\xe9\xaf\x0fH\x0b\x00\x82 \xcc\xc1\
\xdaR\x80\xd6Rp\xcb\xf0\xc5\xc... | Python | 1 |
_vector_clock();
// TODO: Do something other than Vec<_> here.
let time_ranges = self.get_time_spans_since::<Vec<_>>(&clock);
for txn in self.iter_remote_txns(time_ranges.iter()) {
dest.apply_remote_txn(&txn);
}
}
/// This is a simplified API for exporting txns to re... | Rust | 0 |
from source_code.utils.widgets import *
from source_code.utils.color_settings import *
def display_lose(root, new_balance):
clear_widgets(root)
from source_code.logic.menu_logic.navigation import switch_to_hub
from source_code.logic.game_logic.game_logic import counter, max_attempts, secret_number
fro... | Python | 1 |
ges: i32,
}
#[derive(Deserialize)]
struct DnsRecordMeta {
pub auto_added: bool,
pub managed_by_apps: bool,
pub managed_by_argo_tunnel: bool,
pub source: Option<String>,
}
impl HasSuccessField for Reply {
fn success(&self) -> bool {
self.reply_data.success
}
}
impl HasSuccessField for ... | Rust | 0 |
import os
import shutil
from typing import Generator
import pytest
from langchain_community.retrievers import NeuralDBRetriever
@pytest.fixture(scope="session")
def test_csv() -> Generator[str, None, None]:
csv = "thirdai-test.csv"
with open(csv, "w") as o:
o.write("column_1,column_2\n")
o.w... | Python | 1 |
s_high(), &r1s, Choice::from(0u8));
let r2_signs = static_map(|r| r.is_high(), &r2s, Choice::from(0u8));
let r1s_c = static_zip_map(
|r, r_sign| Scalar::conditional_select(&r, &-r, r_sign),
&r1s,
&r1_signs,
Scalar::default(),
);
let r2s_c = static_zip_map(
|r, r_... | Rust | 0 |
# 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 https://mozilla.org/MPL/2.0/.
# SPDX-License-Identifier: MPL-2.0
from VeraGridEngine.IO.base.units import UnitMultiplier, UnitSymbol
from VeraGridE... | Python | 1 |
per.mozilla.org/en-US/docs/Web/API/SVGPathSegCurvetoQuadraticSmoothAbs/y)"]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `SvgPathSegCurvetoQuadraticSmoothAbs`*"]
pub fn set_y(this: &SvgPathSegCurvetoQuadraticSmoothAbs, value: f32);
}
<gh_stars>0
use rubysys::{encodin... | Rust | 0 |
threshold_list, recall_list = e.getThresholds(e.scores, e.num_gt)
for threshold_tmp, recall_tmp in zip(threshold_list, recall_list):
data_tmp = dict()
e.reset()
e.compute3rdPartyMetrics(threshold_tmp, recall_tmp)
data_tmp['mota'], data_tmp['motp'], data_tmp['moda... | Python | 1 |
Copy, Clone, Debug)]
#[repr(C)]
pub struct xcb_glx_pixmap_iterator_t {
/// The value of the current iteration.
pub data: *mut xcb_glx_pixmap_t,
/// The number of elements remaining including this one.
pub rem: c_int,
/// The offset of `data`, in bytes, from the start of the containing object.
pu... | Rust | 0 |
# cobroadcast.py
#
# An example of broadcasting a data stream onto multiple coroutine targets.
from coroutine import coroutine
# A data source. This is not a coroutine, but it sends
# data into one (target)
import time
def follow(thefile, target):
thefile.seek(0,2) # Go to the end of the file
while Tru... | Python | 1 |
"""
Faster RCNN model with the MobileNetV3 backbone from
Torchvision classification models.
Reference: https://pytorch.org/tutorials/intermediate/torchvision_tutorial.html
"""
import torchvision
from torchvision.models.detection import FasterRCNN
from torchvision.models.detection.rpn import AnchorGenerator
def cre... | Python | 1 |
::RegexMatcher::new(&options.patterns) {
Ok(matcher) => matcher,
Err(err) => {
eprintln!("error: {}", err);
std::process::exit(1)
}
};
let mut files: Vec<patch::Patch> = vec![];
for patched_file in patches {
let mut hunks_per_file = vec![];
fo... | Rust | 0 |
'''
This file is part of PM4Py (More Info: https://pm4py.fit.fraunhofer.de).
PM4Py 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 3 of the License, or
(at your option) any late... | Python | 1 |
def change_case(s, mode):
if mode == "1":
return s.upper()
elif mode == "2":
return s.lower()
elif mode == "3":
return s.swapcase()
else:
return "Невірний вибір!"
s = input("Введіть рядок: ")
print("1: Перетворити всі маленькі літери на великі")
print("2: Перетворити всі... | Python | 1 |
iles). These sources will be listed on the Help
# menu. The pattern, and two examples, are
#
# <sequence_number = menu item;/path/to/help/source>
# 1 = edit;C:/Programs/Python36/Lib/edit/help.html
# 2 = Pillow;https://pillow.readthedocs.io/en/latest/
#
# You can't use a semi-colon in a menu item or path. The path wil... | Python | 1 |
(n_chunks):
chunk = valid_data[j*lag:(j+1)*lag]
if len(chunk) < 2:
continue
chunk_mean = np.mean(chunk)
chunk_std = np.std(chunk, ddof=1)
if chunk_std == 0:
continue
... | Python | 1 |
FX_TEXTURE_RT_WRITE_ONLY as _;
}
}
bitflags! {
/// Sampler flags.
pub struct SamplerUFlags : u32 {
/// Wrap U mode: Mirror
const MIRROR = bgfx_sys::BGFX_SAMPLER_U_MIRROR as _;
/// Wrap U mode: Clamp
const CLAMP = bgfx_sys::BGFX_SAMPLER_U_CLAMP as _;
/// Wrap U mode: Bord... | Rust | 0 |
from heapq import heappop, heappush
from collections import defaultdict, Counter, deque
from functools import reduce, lru_cache
import math
import sys
fin = open(sys.argv[1]) if len(sys.argv) > 1 else sys.stdin
def bfs(sx, sy):
queue = deque()
queue.append((sx, sy))
type = field[sy][sx]
seen = set()
seen.add... | Python | 1 |
#!/usr/bin/env python
# jwt-any-to-hs256.py
# Generate a signed JWT by HS256 algorithm based on a different JWT.
# If it's accepted, then the application should be vulnerable to replay-attacks.
import jwt
import sys
def main():
if len(sys.argv) <= 1:
sys.stdout.write("\t-::: jwt-mimicker.py :::-\n")
... | Python | 1 |
(long, default_value = "512")]
pub memory_mib: u64,
/// The number of CPUs that the enclave will receive.
#[structopt(long, conflicts_with("cpu_ids"))]
pub cpu_count: usize,
/// Set the enclave log server port
#[structopt(long, default_value = "6050")]
pub log_server_port: u32,
/// Set t... | Rust | 0 |
Option<usize> {
None
}
}
// You'll only need this one if you want to be able to access the methods in
// your collection by index in a way that doesn't fit in with the iterator API.
impl <A: NextNode + IntOpAtLevel> IntOpAtLevel for Composite<A> {
fn execute_at_level(&self, input: usize, level: usize)... | Rust | 0 |
{
let expr = NumExpr::Divz(Box::new(NumExpr::Const(1.0)), Box::new(NumExpr::Const(0.0)));
assert_eq!(Ok(0.0), expr.evaluate(&NO_VARS));
}
#[test]
fn test_expr_recipz() {
let expr = NumExpr::Recipz(Box::new(NumExpr::Const(0.0)));
assert_eq!(Ok(0.0), expr.evaluate(&NO_VARS));
let expr = NumExpr::Re... | Rust | 0 |
)
}
ExecuteMsg::ProposeNewOwner { owner, expires_in } => {
let config: Config = CONFIG.load(deps.storage)?;
propose_new_owner(
deps,
info,
env,
owner,
expires_in,
config.owner,
... | Rust | 0 |
st VIRTIO_FPGA_DEVICE_TYPE: u32 = 100;
pub const VIRTIO_FPGA_F_VFME: u32 = 0;
pub const VIRTIO_FPGA_UNDEFINED: u32 = 0;
/* fme command */
pub const VIRTIO_FPGA_CMD_FME_PORT_PR: u32 = 0x0100;
/* afu command */
pub const VIRTIO_FPGA_CMD_GET_PORT_INFO: u32 = 0x0200;
pub const VIRTIO_FPGA_CMD_GET_PORT_REGION_INFO: u32 ... | Rust | 0 |
);
map.insert(Predator, PRED_HC);
map.insert(Goliath, GOLI_HC);
map.insert(Mohawk, MOHAWK_HC);
map.insert(Tornado, TORNADO_HC);
map.insert(Prowler, PROWLER_HC);
map
};
}
<reponame>curly60e/xous-core
#![cfg_attr(target_os = "none", no_std)]
pub mod api;
use api::*;
use xous::{CID, send_message};
pub fn... | Rust | 0 |
match frame::Frame::read(&frame_bytes) {
Some(frame::Frame::AckFrame(ack_frame)) => ack_frame,
_ => panic!(),
}
}).collect::<Vec<_>>();
}
#[test]
fn data_max_frame_size() {
let frames = max_datagram_test(2 * MAX_FRAME_SIZE as isize, MA... | Rust | 0 |
from __future__ import annotations
import gdb
import pwndbg
import tests
USE_FDS_BINARY = tests.binaries.get("use-fds.out")
def test_mmap_executes_properly(start_binary):
"""
Tests the mmap command
"""
start_binary(USE_FDS_BINARY)
pc = pwndbg.gdblib.regs.pc
page_size = pwndbg.lib.memory.PA... | Python | 1 |
// let max_bar_height: f32 = barchart.height as f32 - 2.0 * (barchart.height as f32 / 10.0);
// let num_bars: u32 = barchart.data.len() as u32;
// let bar_width: u32 = ((barchart.width / num_bars) as f32 * 0.8) as u32;
// let white = Rgb {r: 255, g: 255, b: 255};
// let bar_gap = match chart_type {... | Rust | 0 |
n\n")
def main_run():
for itr in range(10):
get_multi_model_examing_result(itr + 1)
get_model_examing_result(itr + 1)
directory = f'our_method/single_result_iteration_{itr + 1}'
directory2 = f'our_method/multi_result_iteration_{itr + 1}'
output_file = f'our_method/resul... | Python | 1 |
}
}
#[derive(foonetic_macros::From, Debug)]
enum MyError {
A(i8),
B(String),
C(some_sub_module::Thing),
}
fn my_fail() -> Result<i8, i8> {
Err(1)
}
fn my_flaky_function(good: bool) -> Result<i8, MyError> {
if good {
return Ok(0);
}
Ok(my_fail()?)
}
#[test]
fn method_generatio... | Rust | 0 |
t_attr(&file_io, "name", name)?;
vm.set_attr(&file_io, "mode", vm.ctx.new_str(mode))?;
vm.set_attr(&file_io, "__fileno", vm.ctx.new_int(file_no))?;
vm.set_attr(&file_io, "closefd", vm.ctx.new_bool(args.closefd))?;
vm.set_attr(&file_io, "__closed", vm.ctx.new_bool(false))?;
Ok(vm.... | Rust | 0 |
from turtle import Screen, Turtle
import random
import time
screen = Screen()
screen.setup(width=600, height=600)
screen.bgcolor("black")
screen.title("My Snake Game")
screen.tracer(0) # Turn off screen updates to improve performance
# Snake
starting_positions = [(0, 0), (-20, 0), (-40, 0)]
snake = []
for position... | Python | 1 |
nImcmKo7ls5mExb6skfK2Tw+u54aeDr0OP1ITsC/50CIA8M5nm\
DBnmDM/gZ//4AAAAAAAAAAAAAAAAAAAAZRzOI").unwrap();
let private_key_as_pub = private_key.to_pub();
let offset = algs::hash_cash(&private_key_as_pub, 8);
// Create clientinit packet
let offset = offset.to_string();
let mut packet =
OutCommand::new(Direction::C... | Rust | 0 |
of flags returned from `CPUID_GET_FEATURES`. This is combined into
/// a `u64` from the two `u32`s returned by the CPUID command.
///
/// Documentation of these opcodes can be found in:
/// - (AMD CPUID Spec)[https://www.amd.com/system/files/TechDocs/25481.pdf]
/// - (Intel CPUID Spec)[http://boc... | Rust | 0 |
Moderators",
match moderators {
Some(mods) if !mods.is_empty() => mods
.iter()
.map(|user_id| user_id.mention().to_string())
.collect::<Vec<_>>()
... | Rust | 0 |
.filter_map(|(content, use_it)| if use_it { Some(content) } else { None }),
);
}
pub fn count_keys(&self) -> usize {
self.keyring.len()
}
}
impl PartialEq for Content {
fn eq(&self, other: &Self) -> bool {
self.steps == other.steps && self.keyring == other.keyring
}
}
impl... | Rust | 0 |
text
pub trait IntoConstValue: ContextType {
fn gen_const(self, context: &Context) -> LLVMValueRef;
}
macro_rules! impl_const_value {
// TODO: this `tt` should be a `ty`, for some reason this causes
// the macro to fail, we should file a bug report
(UINT: $t: tt) => {
impl IntoConstValue for $t... | Rust | 0 |
/// Returns true if a binding of [k] exists in the topmost scope.
/// False if [k] is not binded in the topmost scope (regardless of whether
/// or not [k] exists in the entire Smoosher).
/// ```
/// # Example
/// ```
/// use interp::stk_env::Smoosher;
/// let mut a = Smoosher::new();
//... | Rust | 0 |
());
assert_eq!(Opcode::OP_PUSHBYTES_68, Opcode::from_u8(Opcode::OP_PUSHBYTES_68 as u8).unwrap());
assert_eq!(Opcode::OP_PUSHBYTES_69, Opcode::from_u8(Opcode::OP_PUSHBYTES_69 as u8).unwrap());
assert_eq!(Opcode::OP_PUSHBYTES_70, Opcode::from_u8(Opcode::OP_PUSHBYTES_70 as u8).unwrap());
assert_eq!(Opcode::OP_PUS... | Rust | 0 |
t.rglob("*"):
if not p.is_file():
continue
if p.suffix.lower() not in SCAN_EXTS:
continue
rel = p.as_posix()
try:
lines = _find_ellipsis_in_file(p)
except Exception:
lines = []
if not lines:
continue
if... | Python | 1 |
# Copyright 2022 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 writing, ... | Python | 1 |
# -*- coding: utf-8 -*-
from django.db import migrations
add_missing_primary_keys = """
CREATE VIEW primary_keys
AS
SELECT a.attname AS column_name, i.indrelid AS rel
FROM pg_index i
JOIN pg_attribute a ON a.attrelid = i.indrelid
AND a.attnum = ANY(i.... | Python | 1 |
ERA6 OUT2, dual edge. value."]
A6OUT2DUAL,
#[doc = "Trigger source is CTIMERA7 OUT2, dual edge. value."]
A7OUT2DUAL,
#[doc = "Trigger source is CTIMERB4 OUT2, dual edge. value."]
B4OUT2DUAL,
#[doc = "Trigger source is CTIMERA4 OUT2, dual edge. value."]
A4OUT2DUAL,
}
impl TMRB2TRIGR {
#[d... | Rust | 0 |
atatype_cache(
egraph: &EGraph<TokomakLogicalPlan, Self>,
dt: DataType,
) -> RefCount<DataType> {
match egraph.analysis.datatype_cache.get(&dt) {
Some(s) => s.clone(),
None => RefCount::new(dt),
}
}
fn check_schema_cache(
egraph: &EGraph<Tokom... | Rust | 0 |
#!/usr/bin/python3
"""
Define a class Square
"""
class Square:
"""
This is the docstring of class Suare
It is the simplest form of a class and
in this case it is empty
"""
pass
| Python | 1 |
.0, config.color.1, config.color.2),
alpha: config.alpha
});
}
}<reponame>KaiJewson/completion
use core::future::Future;
use core::pin::Pin;
use core::task::{Context, Poll};
use completion_core::{CompletionFuture, CompletionStream};
use futures_core::Stream;
use pin_project_lite::pin_pr... | Rust | 0 |
} else {
Row {
char_name: char_string,
statuses: Vec::new(),
}
}
}
}
}
}
}
pub fn highes... | Rust | 0 |
def tampilkan_instruksi(jenis_roti, ukuran_double, manual):
"""Menampilkan instruksi untuk proses pembuatan roti."""
waktu_roti = {
'W': {'kneading': 15, 'rising': 60, 'second_kneading': 18, 'second_rising': 20, 'shaping': 2, 'final_rising': 75, 'baking': 45, 'cooling': 30},
'S': {'kneading': 20... | Python | 1 |
# Task
# You are given a date. Your task is to find what the day is on that date.
# Input Format
# A single line of input containing the space separated month, day and year, respectively, in MM DD YYYY format.
# import datetime
# date_input = input ("Enter the date in MM DD YYYY format: ")
# month, day, year ... | Python | 1 |
> Smi<'eth, 'pins, Mdio, Mdc>
where
Mdio: MdioPin,
Mdc: MdcPin,
{
/// Create the temporary `Smi` instance.
///
/// Temporarily take exclusive access to the MDIO and MDC pins to ensure they are not used
/// elsewhere for the duration of SMI communication.
pub fn new(
macmiiar: &'eth M... | Rust | 0 |
(projectComboBox.currentText), projectNameToDisplay,
"The right project must be selected")
fileExistedBefore = False
if template == "C++ Class":
fileExistedBefore = (os.path.exists(os.path.join(basePath, name.lower() + ".cpp"))
or os.path.exists(os.path.join... | Python | 1 |
taFrame(all_metrics)
summary_metrics = df_metrics.agg(['mean', 'std']).transpose()
summary_metrics.columns = ['mean', 'std']
summary_metrics["metrics"] = summary_metrics.index
summary_metrics["mean-std"] = (summary_metrics["mean"].round(4).astype(str) + "±" +
summary_m... | Python | 1 |
)
self.momentum_fun = lambda x: (1 - self.momentum) * math.exp(-(
1 + x) / total_iter) + self.momentum
@HOOKS.register_module()
class LinearMomentumEMAHook(BaseEMAHook):
"""EMAHook using linear momentum strategy.
Args:
warm_up (int): During first warm_up steps, we may use smaller ... | Python | 1 |
result=0
map =[]
f = open("day14.txt", "r")
for rowOri in f:
if rowOri != "\n" and rowOri != '':
map.append(list(rowOri[:-1]))
for j in range(len(map[0])):
for i in range(1,len(map)):
if map[i][j]=='O':
k=i
while k>0 and map[k-1][j]=='.':
k = k-1
... | Python | 1 |
Type::MsgPropose, vec![entry]);
let result = nt.dispatch(vec![long_msg].to_vec());
assert!(!result.is_ok());
// entry with empty size should still be accepted
let entry = Entry::default();
let empty_msg = new_message_with_entries(1, 1, MessageType::MsgPropose, vec![entry]);
let result = nt.disp... | Rust | 0 |
ammo.
fn can_shoot(ecs: &World, ent: Entity) -> bool {
let active_wpn = ecs.read_storage::<ActiveWeapon>();
let missile_wpn = ecs.read_storage::<MissileWeapon>();
let wpn = get_weapon(ecs, ent, EquipSlot::Weapon2);
match wpn {
Some(w) => {
if let Some(_t) = active_wpn.get(w) {
... | Rust | 0 |
from django.utils import timezone
import datetime
import uuid
from django.conf import settings
from django.template.loader import render_to_string
from rest_framework import status
from rest_framework.response import Response
from App.settings import TEMPLATES_BASE_URL
from Auth.models import ForgetOTP
from django.core... | Python | 1 |
{
let account_buyer: u64 = 1;
let kitty_id = 0;
let price: u128 = 100;
assert_ok!(KittiesModule::create(Origin::signed(account_buyer)));
assert_ok!(KittiesModule::sell(Origin::signed(account_buyer), kitty_id, Some(price)));
assert_noop!(KittiesModule::buy(Origin::signed(account_buyer), kitty_id),Error::<Te... | Rust | 0 |
idx);
self.vec.push(d);
idx
}
}
impl<I, T> Default for IndexVec<I, T>
where
I: U32Index,
{
fn default() -> Self {
IndexVec::from(vec![])
}
}
impl<I, T> From<Vec<T>> for IndexVec<I, T>
where
I: U32Index,
{
fn from(vec: Vec<T>) -> Self {
IndexVec {
vec... | Rust | 0 |
&unit_field_val as *const _ as *const u8,
&mut self._bitfield_1 as *mut _ as *mut u8,
::std::mem::size_of::<u64>(),
);
}
}
#[inline]
pub fn tag(&self) -> JSValueTag {
let mut unit_field_val: u64 = unsafe { ::std::mem::uninitialized() };
uns... | Rust | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.