text string | label_name string | labels int64 |
|---|---|---|
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from django.db import models, migrations
class Migration(migrations.Migration):
"""
Migration to alter email-related fields in the Queue, Ticket, and TicketCC models.
This migration modifies the following fields to allow null and blank valu... | Python | 1 |
#!/usr/bin/env python
from vtkmodules.vtkIOCore import (
vtkGlobFileNames,
vtkSortFileNames,
)
from vtkmodules.vtkIOImage import vtkImageReader2
from vtkmodules.vtkInteractionImage import vtkImageViewer
import vtkmodules.vtkInteractionStyle
import vtkmodules.vtkRenderingFreeType
import vtkmodules.vtkRenderingOp... | Python | 1 |
oreignState {
log: log.new(slog::o!("smithay_module" => "xdg_foreign_handler")),
exports: vec![],
shell: xdg_shell_state.clone(),
}));
// Borrow checking does not like us cloning the state inside the filter's closure so we clone
// now and pass the clones into the closure.
let e... | Rust | 0 |
lid age. Please return to the inventory
and change your response."""
# Save Data
if db:
responses = " ".join([str(i) for i in Q[1:121]])
db.execute('insert into RESULTS values(?, ?, ?, ?, ?, ?)',
(datetime.datetime.now(), Sex, Age, Nick, Country,
resp... | Python | 1 |
;
}
return steps;
}
#[cfg(test)]
mod tests {
#[test]
fn part1() {
assert_eq!(5, super::part1(&mut vec![0, 3, 0, 1, -3]));
}
#[test]
fn part2() {
assert_eq!(10, super::part2(&mut vec![0, 3, 0, 1, -3]));
}
}use std::str::FromStr;
use xml::{Element, Eleme... | Rust | 0 |
```Embedded(~BsonDocument)```, i.e. it is represented as a BSON):
// insert a document into bar_coll
let ins = ~"{ \"_id\":0, \"a\":0, \"msg\":\"first insert!\" }";
bar.insert(ins, None);
// no write concern specified---use default
// insert a big batch of documents into foo_coll
let mut i... | Rust | 0 |
# -*- coding: utf-8 -*-
# Copyright (C) 2024 BIRU
#
# This file is part of Tenzu.
#
# Tenzu is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the License, or (at your option) any later... | Python | 1 |
and(&mut snes.cpu, &mut snes.abus);
// Update cycle count to prevent warping
emulated_clock_ticks = time_source.elapsed_ticks();
}
DebugState::Step => {
// Go through steps
snes.run_steps(debugger.steps, |cpu, mut abus| {
... | Rust | 0 |
import pytest
from endoc.models.paginated_search import PaginatedSearchData, PaginatedSearchResponseBody, Content, AbstractParsedItem, Author, PublicationDate
@pytest.fixture
def mock_paginated_search_response():
"""Sample response for paginated_search wrapped in 'data'."""
return {
"data": {
... | Python | 1 |
T>
where
T: Ord + FromFlatBuffer<F::Inner>,
F: fbrt::Follow<'a> + 'a,
{
fn from_flatbuf(fb: fbrt::Vector<'a, F>) -> ::std::result::Result<Self, String> {
let mut vec = ddlog_std::Vec::with_capacity(fb.len());
for x in FBIter::from_vector(fb) {
vec.push(T::from_flatbuf(x)?);
... | Rust | 0 |
)
}
/// Returns the low-order `u32` of an `u64`.
pub const fn LODWORD(v: u64) -> u32 {
(v & 0xffff_ffff) as _
}
/// [`LOWORD`](https://docs.microsoft.com/en-us/previous-versions/windows/desktop/legacy/ms632659(v=vs.85))
/// function. Originally a macro.
pub const fn LOWORD(v: u32) -> u16 {
(v & 0xffff) ... | Rust | 0 |
tub {
dev: Box::new(devices::virtio::VideoDevice::new(
virtio::base_features(cfg.protected_vm),
typ,
backend,
Some(resource_bridge),
)),
jail,
})
}
#[cfg(any(feature = "video-decoder", feature = "video-encoder"))]
fn register_video_device(
... | Rust | 0 |
serializer, Error as DeserializeError, Visitor};
#[derive(Debug, PartialEq, Eq)]
pub(super) enum ExceptionType {
Added,
Removed,
}
impl<'de> Deserialize<'de> for ExceptionType {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
D: Deserializer<'de>,
{
struct Servic... | Rust | 0 |
SubCommand::Prove(o) => {
prove(o);
}
SubCommand::Verify(o) => {
verify(o);
}
SubCommand::Setup(o) => {
setup(o);
}
SubCommand::GenerateVerifier(o) => {
generate_verifier(o);
}
SubCommand::ExportKeys(o... | Rust | 0 |
use super::Parity::{Even, Odd};
use super::*;
#[test]
fn mul() {
assert_eq!(Even * Even, Even);
assert_eq!(Even * Odd, Odd);
assert_eq!(Odd * Even, Odd);
assert_eq!(Odd * Odd, Even);
}
#[test]
fn from_number() {
assert_eq!(Parity::from_number(0), Eve... | Rust | 0 |
fmt::Result {
f.debug_struct(&format!("GOnce @ {:p}", self)).finish()
}
}
#[repr(C)]
pub struct _GOptionContext {
_data: [u8; 0],
_marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>,
}
pub type GOptionContext = *mut _GOptionContext;
#[derive(Copy, Clone)]
#[repr(C)]
pub str... | Rust | 0 |
self.apply_gate(target, y());
#[cfg(feature = "decoherence")]
self.decohere();
}
/// Pauli Z Gate
/// Shorthand Method
///
/// Equivilent to `state.apply_gate(target, z());`
pub fn z(&mut self, target: i32) {
self.apply_gate(target, z());
#[cfg(feature = "decoher... | Rust | 0 |
r> {
let state = State {
callers: Vec::new(),
};
config(deps.storage).save(&state)?;
Ok(InitResponse::default())
}
// And declare a custom Error variant for the ones where you will want to make use of it
#[entry_point]
pub fn handle(
deps: DepsMut,
_env: Env,
info: MessageInfo,
... | Rust | 0 |
ain the current input format for `decoder` and write it into `format`.
/// This function can be called at any time since a decoder always have a valid
/// input format.
///
/// Returns 0 in case of success, -1 if an error occured, in which case `format`
/// is not overwritten.
///
/// # Safety
///
/// `decoder` must be... | Rust | 0 |
from PIL import Image
from src.handlers.classifiers_handler.classifier_handler import (
ResnetClassifierModelHandler,
)
from ..test_utils import mock_context
from ..fixture_utils import (
create_handler_instance,
req_input,
preprocessed_image,
inference_output,
create_parametrize_mock_context,
... | Python | 1 |
from mcp.server.fastmcp import FastMCP
mcp = FastMCP("ai-image-description-mcp") | Python | 1 |
cf().region().unwrap_or("unknown region".into())
);
}
#[event(fetch)]
pub async fn main(req: Request, env: Env) -> Result<Response> {
log_request(&req);
utils::set_panic_hook();
let router = Router::new();
router
.get("/", |req, ctx| {
let query_pairs: HashMap<_, _> = req.url()?... | Rust | 0 |
# Optional RestAPI end points
import datetime
import json
from flask import Blueprint, g, jsonify, request
from ansible_webx.app.ansible_run_command import run_ansible
from ansible_webx.prepare_data.get_data import find_servers, find_tags, find_values_extra_vars_sites, find_keys_extra_vars_sites
api_app = Blueprint('... | Python | 1 |
unwrap();
(i, *n)
}))
}
pub fn iter_bounded<'b, U: Sym>(
&'b self,
bound: usize,
) -> Box<dyn Iterator<Item=(U, usize)> + 'b> {
Box::new((0..bound)
.map(|i| U::cast(i as u32).unwrap())
.map(move |i| (i, self.get_bounded(i, bound)))... | Rust | 0 |
by the id.
fn name(&self, id: FileId) -> Option<&str>;
/// Returns the source of the file identified by the id.
fn source(&self, id: FileId) -> Option<SourceFile<'_>>;
}
/// A file database that contains only one file.
#[derive(Clone, Debug)]
pub struct SimpleFile {
name: String,
source: String,
... | Rust | 0 |
n_samples=n_rows,
n_features=n_cols,
centers=10,
cluster_std=1.0,
center_box=(-10.0, 10.0),
random_state=42,
)
X_host = X_host.astype(np.float32)
X_device = device_ndarray(X_host)
ivf_pq_params = None
nn_descent_params = None
if algo == "ivf_pq"... | Python | 1 |
dir_fd, wasi::RIGHTS_FD_READ, wasi::RIGHTS_FD_READ);
let (rbase, rinher) = fd_get_rights(dir_fd);
assert_eq!(
rbase & wasi::RIGHTS_FD_READ,
0,
"dir should not have base RIGHTS_FD_READ"
);
assert_eq!(
rinher & wasi::RIGHTS_FD_READ,
0,
"dir should not have ... | Rust | 0 |
{
pub fn new(parts: Vec<Element>) -> Document {
Document { parts: Rc::new(RefCell::new(parts)) }
}
pub fn accept<T: Visitor + 'static>(&mut self, visitor: &mut T) {
self.parts.borrow().iter().for_each(move |p| p.accept(visitor));
}
}
pub trait Visitor {
const END_LIN... | Rust | 0 |
from posthog.cdp.templates.hog_function_template import HogFunctionTemplateDC
template: HogFunctionTemplateDC = HogFunctionTemplateDC(
status="beta",
free=False,
type="destination",
id="template-gleap",
name="Gleap",
description="Updates a contact in Gleap",
icon_url="/static/services/gleap... | Python | 1 |
'processing_timestamp': self._get_timestamp()
},
quality_metrics=quality_metrics
)
# 记录聚合历史
self._record_aggregation_history(layer_results, result, context)
# 更新层级可靠性
self._update_layer_reliabilit... | Python | 1 |
from core.security.roles import Role
ROLE_PERMISSIONS = {
Role.SOFTWARE_ADMIN: ["create_organization", "manage_admins", "manage_users","list_organizations","ADMIN_ACCESS"],
Role.ORGANIZATION_ADMIN: ["update_user_status","ORG_ADMIN",
"create_user", "manage_organization","create_org... | Python | 1 |
>
where
W: Print + PrintHelper,
{
pub fn new(config: ConfigManager, printer: W) -> Self {
Sahih { config, printer }
}
pub fn generate(mut self) -> io::Result<()> {
debug!("Running with options: {:#?}", self.config);
self.printer.print_welcome()?;
self.printer.print_targ... | Rust | 0 |
print(str(self.optim.get_lr()))
iteration += 1
if self.distributed:
dist.barrier()
# 每一个Epoch结束保存模型
self.save_model(epoch)
# 模型验证测试,返回的val仅用于SCST训练过程
val = self.eval(epoch)
# 4(SCST... | Python | 1 |
"path")]
manifest_path: Option<String>,
/// Verbose mode
#[clap(short)]
verbose: bool,
#[clap(subcommand)]
subcommand: Subcommand,
}
#[derive(Debug, Clap)]
#[clap(
name = "cargo-workspaces",
bin_name = "cargo",
version,
global_setting(AppSettings::ColoredHelp)
)]
enum Cargo {... | Rust | 0 |
number of words in the width table;\cr
//! |nh|&number of words in the height table;\cr
//! |nd|&number of words in the depth table;\cr
//! |ni|&number of words in the italic correction table;\cr
//! |nl|&number of words in the lig/kern table;\cr
//! |nk|&number of words in the kern table;\cr
//! |ne|&number of words i... | Rust | 0 |
arseError<Span>> {
move |i: Span| {
let (i, _) = tag("open")(i)?;
let (i, _) = parse_space(i)?;
let (i, name) = parse_name(i)?;
let (i, _) = parse_space(i)?;
let (i, alias) = opt(terminated(parse_alias, parse_space))(i)?;
let alias = alias.unwrap_or(String::from(""));
let (i, with) = opt(t... | Rust | 0 |
cs()
metrics.update(knn_metrics)
trainer.log_metrics("eval", metrics)
trainer.save_metrics("eval", metrics)
self.knn_wrapper.break_out()
return perplexity
def run_eval_codegen_perplexity(self):
# Based on storage on train, we do eval on self.val_dataset... | Python | 1 |
import os
from bs4 import BeautifulSoup
import requests
import csv
# Target URL
url = "https://elvi.lv/elvi-vakances/" # Replace with the actual URL
# Send a GET request to the URL
response = requests.get(url)
# Check response status
if response.status_code == 200:
# Parse the HTML content
soup = BeautifulS... | Python | 1 |
ssoc::<Name, <Self::Mode as WalkMode>::Elt>::new())))
}
fn is_positive() -> bool { false }
}
pub trait NegativeWalkMode : WalkMode {
/// What happens if destructuring fails?
fn qlit_mismatch_error(l: Self::Elt, r: Self::Elt) -> Self::Err {
panic!("match failure unimplemented: {} vs. {}", l, r)
... | Rust | 0 |
::from_utf8_lossy(&data);
let mut next_peers = next_peers.split(',');
// we pop the first one and keep others
let next_peer = String::from(next_peers.next().unwrap());
(next_peer, next_peers.join(",").into_bytes())
} else {
(init_user_id.to_string(), ... | Rust | 0 |
self.body.tasks[0].reprcall(self.tasks),
chain(self.body.tasks[1:], app=self._app),
),
)
return '%' + remove_repeating_from_task(
self.body['task'], self.body.reprcall(self.tasks))
return f'<chord without body: {... | Python | 1 |
ount += 1 # the # is 'extreme'
# p-value was 0.062 => ~62 extreme values out of 1000
assert 59 < extreme_value_count < 65, f"{extreme_value_count}"
two_sided_p_value(531.5, mu_0, sigma_0) # 0.0463
tspv = two_sided_p_value(531.5, mu_0, sigma_0)
assert 0.0463 < tspv < 0.0464
upper_p_value =... | Python | 1 |
from typing import List
class ContextualRelevancyTemplate:
@staticmethod
def generate_reason(
input: str,
irrelevant_statements: List[str],
relevant_statements: List[str],
score: float,
):
return f"""Based on the given input, reasons for why the retrieval context is... | Python | 1 |
print_special(
". Stoesse: ",
vecstoss.iter()
.map(|stoss| stoss.epi)
.collect()
);
})
}
pub fn account_balance_string(an: &EnumMap<EPlayerIndex, isize>, n_stock: isize) -> String {
EPlayerIndex::values()
.map(|epi| format!("{}: {} | ... | Rust | 0 |
"""
В двумерном списке найти суммы элементов каждой строки и поместить их в новый массив.
Выполнить замену элементов третьего столбца исходной матрицы на полученные суммы.
"""
# Суммы строк матрицы и замена третьего столбца
try:
matrix = [[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12]] # Пример матрицы
print("Ис... | Python | 1 |
import os
from bs4 import BeautifulSoup
def check_xml():
base_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
xml_path = os.path.join(base_dir, 'data', 'momo_sms.xml')
try:
with open(xml_path, 'r') as file:
content = file.read()
soup = BeautifulSoup(co... | Python | 1 |
.take();
if let Some(mut stream) = inner {
loop {
match stream.poll() {
Ok(Async::Ready(Some(_))) => {}
Ok(Async::Ready(None)) => {
return Ok(Async::Ready(()));
}
Ok(Async::NotRead... | Rust | 0 |
import datetime
from flask import current_app
from flask_jwt_extended import current_user
from lin import db, manager
from lin.interface import InfoCrud as Base
from sqlalchemy import Column, Integer, String, Boolean, text, SmallInteger
from app.libs.enums import EmailStrategyEnum
from app.libs.init import scheduler
... | Python | 1 |