text string | label_name string | labels int64 |
|---|---|---|
al_coordinates(vehicle.position)[0]
>= vehicle.lane.length - 4 * vehicle.LENGTH
)
self.road.vehicles = [
vehicle
for vehicle in self.road.vehicles
if vehicle in self.controlled_vehicles
or not (is_leaving(vehicle) or vehicle.route is None)
... | Python | 1 |
:with((content_type, iron::status::Ok, reply)))
}
}
pub fn serve(prefix: &str, router: &mut Router, quadtree_directory: PathBuf) {
let meta = Arc::new(Meta::from_disk(quadtree_directory.join("meta.pb")));
router.get(
format!("{}/meta", prefix),
HandleMeta {
meta: Arc::clone(&met... | Rust | 0 |
:key_schedule(k),
})
}
}
impl BlockCipher for Serpent {
type BlockSize = U16;
type ParBlocks = U1;
}
impl BlockEncrypt for Serpent {
fn encrypt_block(&self, block: &mut GenericArray<u8, Self::BlockSize>) {
let mut b = [0u8; 16];
for (i, v) in block.iter().enumerate() {
... | Rust | 0 |
โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
"""
chap_2_page_2 = """ โญโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ โ
โ โญโโโฎโ โโโ ... | Python | 1 |
ner_as_raw() }
}
impl crate::cudaimgproc::CUDA_TemplateMatching for PtrOfCUDA_TemplateMatching {
#[inline] fn as_raw_mut_CUDA_TemplateMatching(&mut self) -> *mut c_void { self.inner_as_raw_mut() }
}
impl core::AlgorithmTraitConst for PtrOfCUDA_TemplateMatching {
#[inline] fn as_raw_Algorithm(&self) -> *cons... | Rust | 0 |
50, 42910, 5000, 0x00)
ChrSetChipByIndex(0x0031, 3)
PlaySE(214, 0x00, 0x64)
PlayEffect(0x00, 0x02, 0x003D, 0, 0, 0, 0, 0, 0, 1000, 1000, 1000, 0x00FF, 0, 0, 0, 0)
OP_99(0x0031, 0x00, 0x07, 3000)
@scena.Lambda('lambda_8CA4')
def lambda_8CA4():
OP_9E(0x003D, 30, 0, 2000, 4000)
Ex... | Python | 1 |
_file = EditableFile(path)
await editable_file.read()
text = extract_or_none(document, ["text"])
if text is not None:
# didOpen and didSave may provide text within the document
changes = [{"text": text}]
else:
# didChange is the only one which can a... | Python | 1 |
class CollisionGrid:
# Grid to track object locations
grid = {}
# Register an object in the spatial grid
def register(self, obj):
"""Register all squares of an object in the grid by their (x, y) positions."""
if not obj.collidable:
return # Exempted objects are not register... | Python | 1 |
-> Option<&str> {
if let Some(g) = self.standard_genre().and_then(stanard_genre) {
return Some(g);
}
self.custom_genre()
}
/// Removes all custom genres (`ยฉgen`) and returns all genres, first standard genres (`gnre`)
/// then custom ones (`ยฉgen`).
pub fn take_genre... | Rust | 0 |
# Python bytecode 2.7 (decompiled from Python 2.7)
# Embedded file name: scripts/client/messenger/gui/Scaleform/view/lobby/LobbyChannelWindow.py
from constants import PREBATTLE_TYPE
from gui.Scaleform.daapi.view.meta.LobbyChannelWindowMeta import LobbyChannelWindowMeta
from gui.Scaleform.managers.windows_stored_data im... | Python | 1 |
from typing import Optional, Type, Union
from gymnasium import Env as GymEnv
from openrl.envs.vec_env.async_venv import AsyncVectorEnv
from openrl.envs.vec_env.base_venv import BaseVecEnv
from openrl.envs.vec_env.sync_venv import SyncVectorEnv
from openrl.envs.vec_env.wrappers.base_wrapper import VecEnvWrapper
from o... | Python | 1 |
e)
# XC
print("")
print("## DF SCF Energy with */def2-tzvpp")
print("")
source_path = os.path.join(source_dir, 'organic', 'xc')
target_path = os.path.join(target_dir, 'organic', 'xc')
df_xc_diff = pd.DataFrame({'mol': molecules})
df_xc_speedup = pd.DataFrame({'mol': molecules})
for ... | Python | 1 |
::de::Error::custom(
"Bikes allowed must be between 0 and 2",
)),
},
}
}
}
/// Trip
#[derive(Debug, Deserialize)]
pub struct Trip {
pub route_id: String,
pub service_id: String,
pub trip_id: String,
pub trip_headsign: Option<String>,
pub t... | Rust | 0 |
.legend(Legend::default().position(Corner::RightBottom))
.show_x(false)
.show_y(false)
.data_aspect(1.0);
plot.show(ui, |plot_ui| {
plot_ui.hline(HLine::new(9.0).name("Lines horizontal"));
plot_ui.hline(HLine::new(-9.0).name("Lines horizontal"... | Rust | 0 |
# coding=utf-8
# Copyright 2020 Huggingface
#
# 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 required by applicable law or agreed ... | Python | 1 |
ad
///
/// Another option for sharing the client between threads is just to clone
/// client itself. Clones of the client are relatively cheap, typically only
/// requiring a single heap allocation (of a `String`). While this cost isn't
/// nothing, it's not too bad. An example of this is given below.
///
/// ``` no_ru... | Rust | 0 |
_request_without_body(
&Request::builder()
.typed_header(Range::bytes(0..md.len() + 1).unwrap())
.finish(),
)
.await
.unwrap();
let err = static_file
.create_response(Path::new("Cargo.toml"), false)
.unwrap_err();
... | Rust | 0 |
visit::walk_stmt(self, s, ());
}
fn visit_pat(&mut self, p: &Pat, _: ()) {
add_pat_to_id_range(self, p);
}
fn visit_local(&mut self, l: &Local, _: ()) {
gather_loans_in_local(self, l);
}
// #7740: Do not visit items here, not even fn items nor methods
// of impl ite... | Rust | 0 |
def all_variants(text):
for i in range(len(text)):
for j in range(len(text)-i):
yield text[j:j+i+1]
a = all_variants("abc")
for i in a:
print(i)
| Python | 1 |
(u8),
KeyRelease(u8),
MousePress(isize_2,u8),
MouseRelease(isize_2,u8),
MouseMove(isize_2),
MouseWheel(isize_2),
Geometry(isize_r),
Close,
}
use crate::codegen::settings::Settings;
use crate::compiler;
use crate::runtime::Runtime;
use crate::ssa::isa;
use std::borrow::Borrow;
pub trait Jit... | Rust | 0 |
file (relative to this directory) to place at the top
# of the sidebar.
# html_logo = None
# The name of an image file (within the static path) to use as favicon of the
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
# pixels large.
# html_favicon = None
# Add any paths that contain custo... | Python | 1 |
# -*- coding: utf-8 -*- #
# Copyright 2014 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 |
search options for Phi3
search_options = {
"max_length": max_length,
"top_k": 40,
"top_p": 0.95,
"temperature": 0.8,
"repetition_penalty": 1.0,
}
params.set_search_options(**search_options)
params.input_ids = input_tokens
generator = og.Generator(model, params... | Python | 1 |
.long("placement-strategy")
.takes_value(true)
.value_name("STRATEGY")
.possible_values(&["pinned", "random"])
.requires_if("pinned", "pinned-group")
.requires_if("random", "random-group")
.display_order(402)... | Rust | 0 |
anel_callback):
if len(self.circle_points) < 2:
img_x, img_y = self.get_image_coordinates(event)
self.circle_points.append((img_x, img_y))
if len(self.circle_points) == 2:
self.finish_circle(img_cont, update_side_panel_callback)
def preview_circle_motion(... | Python | 1 |
2[1] - cp2[0])
} else {
// For a cubic Bezier, if the first three control points (say) are
// coincident, then the derivative of the curve is legitimately (0,0,0)
// at u=0. This is problematic for us, though, since we'd like to be
// able to compute a surface normal there. In that c... | Rust | 0 |
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
class Solution:
def buildTree(self, preorder: List[int], inorder: List[int]) -> Optional[TreeNode]:
"""
Intu... | Python | 1 |
_crate_model_aws_service<'a, I>(
tokens: &mut std::iter::Peekable<I>,
) -> Result<Option<crate::model::AwsService>, aws_smithy_json::deserialize::Error>
where
I: Iterator<
Item = Result<aws_smithy_json::deserialize::Token<'a>, aws_smithy_json::deserialize::Error>,
>,
{
match tokens.next().transp... | Rust | 0 |
import numpy as np
class MorseUtils:
# ๆฉๅฐๆฏ็ ๅฎไน
MORSE_CODE = {
'A': '.-', 'B': '-...', 'C': '-.-.', 'D': '-..', 'E': '.', 'F': '..-.',
'G': '--.', 'H': '....', 'I': '..', 'J': '.---', 'K': '-.-', 'L': '.-..',
'M': '--', 'N': '-.', 'O': '---', 'P': '.--.', 'Q': '--.-', 'R': '.-.',
... | Python | 1 |
d)]
pub enum State {
Idle,
// if request payload data is larger than one packet
Receiving((Request, MessageState)),
// Processing(Request),
// // the request message is ready, need to dispatch to authenticator
// Dispatching((Request, Ctap2Request)),
// waiting for response from authenti... | Rust | 0 |
{
let tuple_items = tuple_items.iter().zip(labels)
.map(|(par, label)| if let Some(label) = label { format!("{label}: {par:?}") } else { format!("{par:?}") } )
.collect::<Vec<_>>()
.join(", ");
... | Rust | 0 |
pub fn VarR4FromI1(cIn: CHAR, pfltOut: *mut FLOAT);
pub fn VarR4FromUI2(uiIn: USHORT, pfltOut: *mut FLOAT);
pub fn VarR4FromUI4(ulIn: ULONG, pfltOut: *mut FLOAT);
pub fn VarR4FromUI8(ui64In: ULONG64, pfltOut: *mut FLOAT);
pub fn VarR4FromDec(pdecIn: *const DECIMAL, pfltOut: *mut FLOAT);
pub fn V... | Rust | 0 |
me.split())
# ่ฝฌๆข็ถๆๆพ็คบ
status_map = {
"Out": "็ผบ้ต",
"Questionable": "ๅพ
ๅฎ(50%)",
"Doubtful": "ไธๅคชๅฏ่ฝๅบๆ(25%)",
"Probable": "ๅฏ่ฝๅบๆ(75%)",
}
return {
"name": full_name,
"status": status_map.get(player_status, player_status),
"reason": reason_part,
}
d... | Python | 1 |
age: &mut dyn Storage,
collateral_token: &CanonicalAddr,
whitelist_elem: &WhitelistElem,
) -> StdResult<()> {
let mut whitelist_bucket: Bucket<WhitelistElem> = Bucket::new(storage, PREFIX_WHITELIST);
whitelist_bucket.save(collateral_token.as_slice(), whitelist_elem)?;
Ok(())
}
pub fn read_whitelis... | Rust | 0 |
stats = self.post(h) * x_mask
if not self.mean_only:
m, logs = torch.split(stats, [self.half_channels] * 2, 1)
else:
m = stats
logs = torch.zeros_like(m)
if not reverse:
x1 = m + x1 * torch.exp(logs) * x_mask
x = torch.cat([x0, x... | Python | 1 |
#
# This file is part of the Chemical Data Processing Toolkit
#
# Copyright (C) Thomas Seidel <thomas.seidel@univie.ac.at>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# versi... | Python | 1 |
"""Container package for Python modules related to Adblock Plus.
- abp.filters - Tools for working with Adblock Plus filter lists.
"""
__path__ = __import__('pkgutil').extend_path(__path__, __name__)
| Python | 1 |
# Licensed to the Software Freedom Conservancy (SFC) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The SFC licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | Python | 1 |
_2022๋
12์31์ผ๊ธฐ์ค.csv', encoding='cp949')
# ์๋๋ช
๊ณผ ์๊ตฐ๊ตฌ๋ช
์ ๋ถ๋ฆฌํ์ฌ ์๋ก์ด ์ปฌ๋ผ ์์ฑ
school['CTPRVN_NM'] = school['๋๋ก๋ช
์ฃผ์'].str.split().str[0]
school['SIGNGU_NM'] = school['๋๋ก๋ช
์ฃผ์'].str.split().str[1]
# ์๋๋ณ, ์๊ตฐ๊ตฌ๋ณ ์ด๋ฑํ๊ต ์ ๊ณ์ฐ
school_cnt = school.groupby(['CTPRVN_NM', 'SIGNGU_NM']).size().reset_index(name='์ด๋ฑํ๊ต ์(์ด๋ฆฐ์ด ๋ฌธํ์์ค ์ ๊ทผ์ฑ ์ง์)')
school_c... | Python | 1 |
"markov-model v{}: {}",
env!("CARGO_PKG_VERSION"),
env!("GIT_HASH")
);
} else {
let pm_arc = Arc::new(matrix(c.probability.clone(), 3, 3, Row));
let init_v: Arc<Matrix> = Arc::new(zeros(1, 3));
let rewards: Arc<Matrix> = Arc::new(matrix(c.rewards.clone(), 1,... | Rust | 0 |
);
(cm, specs)
});
let filtered = match regex {
Some(r) => ::table::filter(cm_specs, r),
None => cm_specs.collect(),
};
::table::print_table(&mut table, &filtered, writer);
let final_rss = filtered.into_iter().map(|cm_spec| cm_spec.0).collect();
ConfigMapList { items: ... | Rust | 0 |
for sitelink in data["results"]["bindings"]:
results_items[sitelink["item"]["value"].replace("http://www.wikidata.org/entity/","")]["label_en"]=sitelink["itemLabel_en"]["value"]
results_items[sitelink["item"]["value"].replace("http://www.wikidata.org/entity/","")]["label_es"]=sitelink["itemLabel_es"]["value"]
... | Python | 1 |
s gjmbsp16a6p, rbx91t2ogw2, hpssejp31sv, n89m7yurnvl as kd1d2w2k6ov, qdkkbty70j9 as tyn6vf0u7fd, lbxzy_g_sil, lfm0nvs4kx2 as mdns9fi3acf
0.0[''] += azkpcnp9i97
'# hospitals_repairs_hoses -> difficulties_rain_pitches'
from vhmkuxxc90h import carp7ov6zkr, esd5f4qo2js as sxnwdpgr0tx, cn46gedsdoe, f_5bb5gniuy a... | Python | 1 |
dySet>,
ships: Query<&RigidBodyHandleComponent, With<Ship>>,
rocks: Query<&RigidBodyHandleComponent, With<Rock>>,
) {
let mut ships = ships.iter();
let body = ships.next().unwrap();
let body = bodies.get(body.handle()).unwrap();
let ship_position = body.position().tra... | Rust | 0 |
.write_all(&nonce_bytes)
.map_err(EncryptError::write)?;
let sealed = aead::seal(bytes, None, &nonce, &key);
output.write_all(&sealed).map_err(EncryptError::write)?;
Ok(output)
}
/// Decrypt a byte slice with this password.
///
/// # Example
/// Here is a know... | Rust | 0 |
mut usize,
) -> anyhow::Result<u32> {
if *y == 0 {
*z = data.gread_with::<u32>(off, LE)?;
*y = 32;
}
*y -= 1;
let temp = *z;
*z >>= 1;
Ok(if temp & 1 == 0 {
EncryptionData::zero_transform(8, data, y, z, off)?
} else {
... | Rust | 0 |
from cProfile import label
from simple_model_mm_q_learning import linear_decreasing, exponential_decreasing
import matplotlib.pyplot as plt
import numpy as np
"""
Plots the hyperparameter schemes for Q-learning
"""
epsilon_start = 1
epsilon_end = 0.05
epsilon_cutoff = 0.5
alpha_start = 0.5
alpha_end = 1e-5
beta_sta... | Python | 1 |
jjccr", 18.776503642, -5.663203586},
{0xd33b6e5ae585e3cc, "udxqwqr5hrjw", 60.239964034, 32.979773753},
{0x04c471e3508d629c, "0m273suhjpj9", -59.870643932, -168.32680424},
{0x95f74b8a00878e35, "krvnr2h0hy73", -0.307583339, 18.605554896},
{0x566a65af81726edb, "btp6ccw1f9re", 73.616945866, ... | Rust | 0 |
_download(module_class: str, module_type: str) -> None:
"""Tracks number of downloads via Llamahub proxy.
Args:
module_class: The name of the llama module being downloaded, e.g.,`GmailOpenAIAgentPack`.
module_type: Can be "loader", "tool", "llamapack", or "datasets"
"""
try:
req... | Python | 1 |
_const<C: Config>(
u: &mut Unstructured,
_: &ConfiguredModule<C>,
builder: &mut CodeBuilder<C>,
) -> Result<Instruction> {
builder.push_operands(&[ValType::V128]);
let c = i128::from_le_bytes(u.arbitrary()?);
Ok(Instruction::V128Const(c))
}
fn i8x16_shuffle<C: Config>(
u: &mut Unstructured,... | Rust | 0 |
", id, pos.line()));
for pos in self.0.iter().rev() {
self.1.push(format!(" in a ty on line {}", pos.line()));
}
}
}
let b = &bumpalo::Bump::new();
let pos = |line| Pos::from_line_cols_offset(b, RelativePath::empty(), line, 10..50... | Rust | 0 |
_assert_eq!(OpKind::Register as u32, 0);
//instruction.set_op2_kind(OpKind::Register);
instruction.set_op2_register(register3);
instruction.set_op3_kind(OpKind::Memory);
Instruction::init_memory_operand(&mut instruction, &memory);
instruction_internal::initialize_unsigned_immediate(&mut instruction, 4, imme... | Rust | 0 |
ores: torch.FloatTensor,
negative_scores: torch.FloatTensor,
_label_smoothing=None,
) -> torch.FloatTensor:
"""Compute self adversarial negative sampling loss."""
return self.model.compute_self_adversarial_negative_sampling_loss(
positive_scores=positive_scores,
... | Python | 1 |
ks if the value of the field is `LCDIF_PODF_0`"]
#[inline(always)]
pub fn is_lcdif_podf_0(&self) -> bool {
*self == LCDIF_PODF_A::LCDIF_PODF_0
}
#[doc = "Checks if the value of the field is `LCDIF_PODF_1`"]
#[inline(always)]
pub fn is_lcdif_podf_1(&self) -> bool {
*self == LCDIF_... | Rust | 0 |
lf):
'''
Gets the properties of the specified Batch Account
:return: deserialized Batch Account instance state dictionary
'''
self.log("Checking if the Batch Account instance {0} is present".format(self.name))
try:
response = self.batch_account_client.batch_ac... | Python | 1 |
ransposed());
}
#[test]
fn is_identity() {
let t = Transform::new_m(Matrix4x4::<f32>::identity());
assert!(t.is_identity());
let t = Transform::new([
[1.0, 0.0, 0.0, 0.0],
[0.0, 0.0, 1.0, 0.0],
[0.0, 1.0, 0.0, 0.0],
[0.0, 0.0, 0.0, 1.... | Rust | 0 |
bel="Height", style=mystyle)
Result_worksheet.write(0, 5, label="x_position", style=mystyle)
Result_worksheet.write(0, 6, label="y_position", style=mystyle)
for m in range(0, len(self.ProcessList)):
if self.ProcessList[m].Graphical is None:
raise ValueError(
... | Python | 1 |
let (master_secret_key, master_chain_code) = master_key_from_seed(&seed_bytes);
let mut secret_key = master_secret_key;
let mut chain_code = master_chain_code;
for mut val in iterator {
let mut hardened = false;
if val.contains('\'') {
hardened = true;... | Rust | 0 |
ttfp_face) -> i16 {
face_from_ptr(face).vertical_ascender().unwrap_or(0)
}
/// @brief Returns a vertical face descender.
///
/// This function is affected by variation axes.
///
/// @return `0` when `vhea` table is not present.
#[no_mangle]
pub extern "C" fn ttfp_get_vertical_descender(face: *const ttfp_face) -> i... | Rust | 0 |
from pythongame.core.common import Millis, NpcType, Sprite, Direction, SoundId, LootTableId
from pythongame.core.game_data import NpcData
from pythongame.core.npc_behaviors import MeleeEnemyNpcMind
from pythongame.core.pathfinding.grid_astar_pathfinder import GlobalPathFinder
from pythongame.game_data.enemies.register_... | Python | 1 |
#coding=utf-8
import xml.etree.ElementTree as ET
import numpy as np
import glob
def iou(box, clusters):
"""
่ฎก็ฎไธไธช ground truth ่พน็็ๅ k ไธชๅ
้ชๆก(Anchor)็ไบคๅนถๆฏ(IOU)ๅผใ
ๅๆฐbox: ๅ
็ปๆ่
ๆฐๆฎ๏ผไปฃ่กจ ground truth ็้ฟๅฎฝใ
ๅๆฐclusters: ๅฝขๅฆ(k,2)็numpyๆฐ็ป๏ผๅ
ถไธญkๆฏ่็ฑปAnchorๆก็ไธชๆฐ
่ฟๅ๏ผground truthๅๆฏไธชAnchorๆก็ไบคๅนถๆฏใ
"""
x = np.minimum(clu... | Python | 1 |
rmat!("{}", HRef::new(did, &last.name)),
}
} else {
format!("{}", HRef::new(did, &last.name))
};
write!(w, "{}{}", path, last.params)?;
}
Ok(())
}
fn primitive_link(f: &mut fmt::Formatter,
prim: clean::PrimitiveType,
name: &str... | Rust | 0 |
atan2_except_at_the_origin(
#[strategy(not_nan())] x: f64,
#[strategy(not_nan())] y: f64,
) {
if x.classify() != Zero || y.classify() != Zero {
assert_ulps_eq!(
sinatan2(x, y),
x.atan2(y).sin(),
epsilon = 2f64 * f64::EPSILON
... | Rust | 0 |
shred = Arc::new(bad_last_data_shred);
// Store the good shred so that blockstore will signal ClusterSlots
// that the slot is complete
blockstore_sender.send((good_last_data_shred, None))?;
loop {
// Wait for slot to be complete
if blockst... | Rust | 0 |
.db_dir = f"{db_name}_data"
self.load_db()
def create_table(self, table_name: str):
if table_name not in self.tables:
self.tables[table_name] = BPlusTree(self.order)
return f"Table '{table_name}' created successfully"
return f"Error: Table '{table_name}' already exis... | Python | 1 |
#!/usr/bin/env python3
"""
secuenvia-listo.py
Presenta una secuencia que se puede usar
para indicar que un sistema esta listo
para ser utilizado
"""
import time
import os
"""
Una funciรณn que abre un archivo cualquiera para leer, lee el contenido y cierra el archivo,
devuelve su contenido.
"""
def Lee... | Python | 1 |
tool_call = result.tool_calls[0]
await toggle_mute_tool.arun(tool_call["args"])
async def initialize_vectorstore(self):
"""
Initialize the vector store for chat history and context data.
TODO: Implement ChromaDB initialization and configuration
"""
pass
... | Python | 1 |
n = int(input()) #ๅฐๆๅ็ๆฐ้
heights = list(map(int, input().split())) #ๅฐๆๅ็่บซ้ซๅ่กจ
unhappiness = 0 #ๅๅงๅไธ้ซๅ
ดๅผ
change=0 #็ป่ฎกไบคๆขๆฌกๆฐ
for i in rang... | Python | 1 |
_RBRACK, Cow::Owned("]".into())), tokens[2]);
assert_eq!(
Token::new(TOKEN_PATH, Cow::Owned("/some/absolute/path".into())),
tokens[3]
);
assert_eq!(
Token::new(TOKEN_PATH, Cow::Owned("/another/absolute/path".into())),
tokens[4]
);
}
... | Rust | 0 |
#!python3
import sys
from cx_Freeze import setup, Executable
import os.path
PYTHON_INSTALL_DIR = os.path.dirname(os.path.dirname(os.__file__))
os.environ['TCL_LIBRARY'] = os.path.join(PYTHON_INSTALL_DIR, 'tcl', 'tcl8.6')
os.environ['TK_LIBRARY'] = os.path.join(PYTHON_INSTALL_DIR, 'tcl', 'tk8.6')
file_includes = []
... | Python | 1 |
from django.contrib import admin
from core.models import Post, Tag
@admin.register(Post)
class PostAdmin(admin.ModelAdmin):
...
@admin.register(Tag)
class TagAdmin(admin.ModelAdmin):
... | Python | 1 |
inetuning_args) if is_trainable else model
model = init_adapter(model, model_args, finetuning_args, is_trainable)
model = model.train() if is_trainable else model.eval()
# Prepare model with valuehead for RLHF
if stage in ["rm", "ppo"]:
model: "AutoModelForCausalLMWithValueHead" = AutoModelForC... | Python | 1 |
vec_vec_string};
#[test]
fn test_increasing_triplet() {
assert_eq!(Solution::increasing_triplet(vec![1, 2, 3, 4, 5]), true);
}
#[test]
fn test_increasing_triplet2() {
assert_eq!(Solution::increasing_triplet(vec![5, 4, 3, 2, 1]), false);
}
#[test]
fn test_increasing_tr... | Rust | 0 |
import scrapy
import random
import time
import copy
from urllib.parse import urlencode
from datetime import datetime
from scrapy.utils.project import get_project_settings
class MexcSpider(scrapy.Spider):
name = "mexc"
settings = get_project_settings()
headers = {
"accept": "text/html,application... | Python | 1 |
t = -1/Yxs * mu * X - ms * X + D * (Sin - S)
dPdt = Ypx * mu * X - D * P
dOdt = Kla * (Cs - O2) - 1/Yxo * mu * X - mo * X - D * O2
return [dXdt, dSdt, dPdt, dOdt]
y0 = [X0, S0, P0, O0]
sol = solve_ivp(modelo_continuo, [0, t_final], y0, t_eval=t_eval, atol=atol, rtol=rtol)
st.subhea... | Python | 1 |
mode2, ParameterMode::Immediate);
self.0[op3 as usize] = op1 * op2;
4
}
Opcode::Input(_mode) => {
// not sure what to do if mode is not immediate?
let op = self.operand(ip + 1, ParameterMode::Immediate) as u... | Rust | 0 |
{
if bytes[i] % multiple == 0 {
sequence_length += 1;
} else {
if sequence_length > 1 {
let start = i - sequence_length;
let end = start + sequence_length - 1;
for i in 0..sequence_length / 2 {
... | Rust | 0 |
tat = list(base_stat_total)[5]
second_lowest_stat = list(base_stat_total)[4]
for pokemon_type in read_pokemon_data['types']:
pokemon_types.append(pokemon_type["type"]["name"])
given_write_file.write(f"Stats: {pokemon_types} \n")
given_write_file.write(f"Highest Stat: {highest_stat} \n")
given_write_file.... | Python | 1 |
id
})
return res.message_id
except Exception as e:
self.log_remotely("ERROR", f"ๅ้ไธป้ขๆถๆฏๅคฑ่ดฅ: {e}", {
"article_id": message_content.get('article_id', 'unknown'),
"exception_type": type(e).__name__,
"exc_inf... | Python | 1 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2011 Deepin, Inc.
# 2011 Wang Yong
#
# Author: Wang Yong <lazycat.manatee@gmail.com>
# Maintainer: Wang Yong <lazycat.manatee@gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the ... | Python | 1 |
# Slicing = create a substring by extraction element from another string
# indexing[] or slicing()
# [start:stop:steps]
website = "http://google.com"
website2 = "http://github.com"
name = "Kevin Kimanzi"
first_name = name[0:5]
last_name = name[6:13]
print(first_name)
print(last_name)
slice = slice(7,-4)
print(we... | Python | 1 |
from django.db import models
class StripeSubscription(models.Model):
class Status(models.TextChoices):
# Ref: The complete list is in https://docs.stripe.com/api/subscriptions/object#subscription_object-status
INCOMPLETE = "incomplete"
INCOMPLETE_EXPIRED = "incomplete_expired"
TRIA... | Python | 1 |
: f"{ffmpeg_video_path}"}
os.unlink(save_video_path)
print(f"removed raw video: {save_video_path}")
else:
final_result = {"status": True, "message": f"{save_video_path}"}
except Exception as e:
print(f"Error: {e}")
final_result ... | Python | 1 |
import abc
from dataclasses import dataclass
from typing import Dict
from ray.train.v2._internal.execution.callback import ControllerCallback
from ray.train.v2._internal.execution.worker_group import (
WorkerGroupPollStatus,
WorkerGroupState,
)
from ray.train.v2.api.config import ScalingConfig
@dataclass
cla... | Python | 1 |
ter().map(|&s| s.to_string()).collect::<Vec<_>>(),
id.clone(),
data.to_vec(),
)
})
.collect::<HashSet<_>>();
for st in &mut [b_msgs.by_ref(), a_msgs.by_ref()] {
let actual = st
.take(2)
// Arc::try_unwrap will fail sometime... | Rust | 0 |
Text(QCoreApplication.translate("MainWindow", u"\u6d4f\u89c8", None))
self.btn_pause.setText(QCoreApplication.translate("MainWindow", u"\u6682\u505c\u4e0b\u8f7d", None))
self.btn_stop.setText(QCoreApplication.translate("MainWindow", u"\u505c\u6b62\u4e0b\u8f7d", None))
self.btn_selectALL.setText(... | Python | 1 |
).reshape((-1, 3))
# save data to a sequence
vertices.append(c_vertices)
faces.append(c_faces)
colors.append(np.tile(diffuse, (len(c_faces), 1)))
normals.append(c_normals)
# compile the results into clean numpy arrays
result = {}
result["ver... | Python | 1 |
}
/// Mutation for chromosomes of Vec<G>, where G - type of single gene.
pub struct VecMutation<G> {
probability: f64,
random: rngs::ThreadRng,
single_mutation: Box<dyn Mutation<G>>,
}
impl BitwiseMutation {
/// Constructor
///
/// # Parameters
/// * `change_gene_count` - how many bits wi... | Rust | 0 |
points=[0, 1],
bounds=[[0, 1], [1, 2]],
units="days since 1970-01-01",
climatological=True,
)
coord.climatological = False
assert not coord.climatological
def test_remove_bounds(self):
coord = AuxCoord(
points=[0, 1],
... | Python | 1 |
_date = datetime.strptime(start_date, '%Y-%m-%d')
end_date = datetime.strptime(
end_date, '%Y-%m-%d') + timedelta(days=1)
filtered_data = [
row for row in reshaped_data
if row['Date/Time'] != 'Total/Average' and
... | Python | 1 |
unused_port().unwrap();
let server: RpcServer = RpcServer::with_tcp_port::<TwoInts, OneInt>(
"test",
port,
Box::new(|_| Ok(OneInt { num: 0 })),
);
assert!(server.is_running());
let addr = SocketAddr::new(IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)), port)... | Rust | 0 |
assert_eq!(
vec![6, 16, 26],
(froms)(&tx, address).await.iter().collect::<Vec<_>>()
);
assert_eq!(
vec![1, 11, 21],
(tos)(&tx, address).await.iter().collect::<Vec<_>>()
);
}
}
use ansi_term::Style;
use glob;
use crate::fs::File;
use crate::op... | Rust | 0 |
self) -> _AnonymousValueParser {
let func: fn(&str) -> Result<FromStr, <FromStr as std::str::FromStr>::Err> =
FromStr::from_str;
_AnonymousValueParser(ValueParser::new(func))
}
}
}
/// Select a [`ValueParser`] implementation from the intended type
///
/// To register... | Rust | 0 |
renpy-build/tmp/install.linux-x86_64/lib/python2.7/encodings/zlib_codec.pyR X s c C s: t j d d d t d t d t d t d t d t d t S(
Nt nameR R R
t incrementalencodert incrementaldecodert streamreadert streamwritert _is_text_encoding( t codecst ... | Python | 1 |
// used for generating error messages
self.item.ne(&other.item)
}
}
impl<'input> Eq for Item<'input> {}
impl<'input> Item<'input> {
///
/// A custom eq implementation that performs a full equality check, including comparing the
/// `position` field which is ignored in the `PartialEq` i... | Rust | 0 |
first called [`Unlinker::forget`].
struct Unlinker {
/// The location of the file to remove, or None if we shouldn't
/// remove it.
p: Option<PathBuf>,
}
impl Unlinker {
/// Make a new Unlinker for a given filename.
fn new<P: AsRef<Path>>(p: P) -> Self {
Unlinker {
p: Some(p.as_... | Rust | 0 |
n()
}
fn write_buf<B>(&mut self, buf: &mut B) -> Poll<usize, io::Error>
where
B: Buf,
{
self.0.write_buf(buf)
}
}
impl TlsStream for SslStream {
fn tls_unique(&self) -> Option<Vec<u8>> {
let f = if self.0.get_ref().ssl().session_reused() {
SslRef::peer_finis... | Rust | 0 |
"""
/*
* Escribe un programa que muestre cรณmo transcurre un juego de tenis y quiรฉn lo ha ganado.
* El programa recibirรก una secuencia formada por "P1" (Player 1) o "P2" (Player 2), segรบn quien
* gane cada punto del juego.
*
* - Las puntuaciones de un juego son "Love" (cero), 15, 30, 40, "Deuce" (empate), ventaja.... | Python | 1 |
system::RawOrigin;
use rand::{prelude::SliceRandom, rngs::SmallRng, SeedableRng};
use sp_arithmetic::{per_things::Percent, traits::One};
use sp_npos_elections::IndexAssignment;
use sp_runtime::InnerOf;
use sp_std::convert::{TryFrom, TryInto};
const SEED: u32 = 999;
/// Creates a **valid** solution with exactly the gi... | Rust | 0 |
able({})", addr),
}
}
}
pub mod evtree;
pub mod network;
pub mod evenv;
<filename>tests/tests.rs
#![deny(unsafe_code)]
#![deny(warnings)]
#![deny(clippy::all)]
use rocket::{
catchers, get,
http::{Accept, ContentType, Header, Status},
launch,
local::blocking::Client,
routes,
};
use rocke... | Rust | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.