text string | label_name string | labels int64 |
|---|---|---|
expected = {
"nic0": "fa:16:3e:05:30:fe",
"enp0s1": "fa:16:3e:69:b0:58",
"enp0s2": "fa:16:3e:d4:57:ad",
}
assert expected == config_name2mac
# We should, however, warn the user that we don't recognise the type
assert (
"Unknown network_d... | Python | 1 |
# bambot/docker_utils.py
import os
import docker
from tqdm import tqdm
def build_image(container_dir):
"""Build a Docker image for an AI agent"""
docker_client = docker.from_env()
image, _ = docker_client.images.build(path=container_dir, tag=f"{os.path.basename(container_dir)}:latest", dockerfile="Dockerfi... | Python | 1 |
_embeddings,
src_embeddings,
tgt_emb_idx_map,
src_emb_idx_map,
alpha,
comparator_model,
symmetrize_comparator,
)
return best_blended_neighbor_x2y, best_blended_neighbor_y2x
def fastmax_retrieval(
neighbors_x2y: Neighbors,
neig... | Python | 1 |
erialize, Debug, Clone)]
#[doc = "Sends a simple network request to the Telegram servers via proxy; for testing only. Can be called before authorization"]
pub struct TestProxy {
#[doc = "Proxy server IP address"]
pub server: String,
#[doc = "Proxy server port"]
pub port: i32,
... | Rust | 0 |
json,
std::path::PathBuf,
};
#[derive(FromArgs, Debug, PartialEq)]
/// Various operations on packages, package repositories, and the package cache.
pub struct Args {
#[argh(subcommand)]
pub command: Command,
}
#[derive(FromArgs, Debug, PartialEq)]
#[argh(subcommand)]
pub enum Command {
Resolve(Resolve... | Rust | 0 |
Linux" => mapping.platform = Platform::Linux,
"platform" if value == "Mac OS X" => mapping.platform = Platform::Mac,
"platform" if value == "Android" => mapping.platform = Platform::Android,
"platform" if value == "iOS" => mapping.platform = Platform::IOS,
... | Rust | 0 |
yield BIN_INT32
yield key + BIN_NONE
yield int32.pack(value)
else:
raise TypeError("Unsupported type: %s" % type(value))
yield BIN_END if not alt_format else BIN_END_ALT
def vbkv_loads(s, mapper=dict, merge_duplicate_keys=True):
"""
Deserialize ``s`` (... | Python | 1 |
logit = resize(
input=seg_logit,
size=seg_label.shape[2:],
mode='bilinear',
align_corners=self.align_corners)
if self.sampler is not None:
seg_weight = self.sampler.sample(seg_logit, seg_label)
seg_label = seg_label.squeeze(1)
loss['los... | Python | 1 |
"""
Basic test for reference manager service
"""
import asyncio
from services.reference_manager_service import (
ReferenceManagerService,
BibliographicData,
AuthCredentials,
ReferenceManagerType
)
def test_basic_functionality():
"""Test basic service functionality"""
service = ReferenceManager... | Python | 1 |
from __future__ import annotations
from functools import wraps
from typing import Callable
from .spec import Table
def table_defaults(*, gap_x: int | None = None, gap_y: int | None = None):
"""Decorator to enforce/override default gaps on a Table factory.
Example:
@table_defaults(gap_x=16, gap_y=12)
... | Python | 1 |
ut cursor)?;
Ok((header, order))
}
/// Read without checking for endianness.
pub fn read<T: Read>(reader: &mut T) -> io::Result<Self> {
let mut header = Header::default();
reader.read_exact(header.magic.as_mut())?;
header.clock_rate = reader.read_u32::<BigEndian>()?;
... | Rust | 0 |
from llama_index.llms.replicate.base import Replicate
__all__ = ["Replicate"]
| Python | 1 |
Ok((s, (k, v)))
}
fn uint_range_parse(s: &str) -> IResult<&str, Node> {
let (s, _) = multispace0(s)?;
let (s, _) = tag("range")(s)?;
let (s, _) = multispace1(s)?;
let (s, v) = double_quoted_string(s)?;
let (_, r) = range_uint_parse(v)?;
let (s, _) = multispace0(s)?;
let (s, _) = char(';')(s... | Rust | 0 |
}}
"#,
email, password
))
.reply(&server);
let json: Value = serde_json::from_str(str::from_utf8(res.body()).unwrap()).unwrap();
let token = &json["data"]["login"].as_str().unwrap();
let claims = (tokeniser.verify)(token).unwrap();
assert_eq!(res.status(), 200);
assert_eq!(claims.... | Rust | 0 |
0 | 1 | 2 => {
enemy_kind = kindvec[0];
},
3 => {
enemy_kind = kindvec[1];
},
4 => {
enemy_kind = kindvec[2];
},
_ => {printl... | Rust | 0 |
}
else
{
Err("Exceeds maximum value")
}
}
#[inline(always)]
fn from_usize_or_none(value: usize) -> Result<Self, &'static str>
{
if value <= Self::Maximum as usize
{
Ok(value as Self)
}
else
{
Err("Exceeds maximum value")
}
}
}
}
}
unsig... | Rust | 0 |
)?)),
}
}
}
impl AscIndexId for Array<bool> {
const INDEX_ASC_TYPE_ID: IndexForAscTypeId = IndexForAscTypeId::ArrayBool;
}
impl AscIndexId for Array<Uint8Array> {
const INDEX_ASC_TYPE_ID: IndexForAscTypeId = IndexForAscTypeId::ArrayUint8Array;
}
impl AscIndexId for Array<AscPtr<AscEnum<EthereumV... | Rust | 0 |
}", "vse256.v v16, (t0)", in (reg) p);
}
512 => {
rvv_asm!("mv t0, {0}", "vse512.v v16, (t0)", in (reg) p);
}
1024 => {
rvv_asm!("mv t0, {0}", "vse1024.v v16, (t0)", in (reg) p);
}
_ => {
panic!("Inva... | Rust | 0 |
from __future__ import annotations
from dataclasses import dataclass
from typing import Literal, Optional
import numpy as np
from ngboost import NGBRegressor
from ngboost.distns import LogNormal, Gamma, Normal
from sklearn.tree import DecisionTreeRegressor
from ngboost.scores import CRPScore
SUPPORTED = {"lognormal": ... | Python | 1 |
from starlette.requests import Request
def get_ipaddr(request: Request) -> str:
"""
Returns the ip address for the current request (or 127.0.0.1 if none found)
based on the X-Forwarded-For headers.
Note that a more robust method for determining IP address of the client is
provided by uvicorn's ... | Python | 1 |
"""
Sets the ssl_secret_id of this ModifyPluggableDatabaseManagementDetails.
The `OCID`__ of the Oracle Cloud Infrastructure `secret`__.
__ https://docs.cloud.oracle.com/Content/General/Concepts/identifiers.htm
__ https://docs.cloud.oracle.com/Content/KeyManagement/Concepts/keyo... | Python | 1 |
ss), self.interpreter)
}
bir::PlaceData::Intrinsic(intrinsic) => op(
&mut Value::our(self.interpreter, *intrinsic),
self.interpreter,
),
bir::PlaceData::Dot(place, word) => self
.with_place_mut_box(*place, |value, interprete... | Rust | 0 |
#
# --repeat argument for py.test taken from:
# http://stackoverflow.com/questions/21764473/
# how-can-i-repeat-each-test-multiple-times-in-a-py-test-run
#
import pytest
import os
def pytest_addoption(parser):
parser.addoption(
'--repeat', action='store',
help='Number of times to repeat each te... | Python | 1 |
lt, JsonSchema)]
pub struct ScaledJobJobTargetRefTemplateSpecVolumeDevices {
/// devicePath is the path inside of the container that the device will be mapped to.
#[serde(rename = "devicePath")]
pub device_path: String,
/// name must match the name of a persistentVolumeClaim in the pod
#[serde(renam... | Rust | 0 |
from repositories.lojaRepository import LojaRepository
class LojaService:
def __init__(self):
self.lojaRepository = LojaRepository()
def salvarLoja(self, loja):
"""Salva uma loja no repositório"""
return self.lojaRepository.salvar(loja)
def buscarLojaPorNome(self, nome):
... | Python | 1 |
u(F.max_pool2d(self.ebn5(self.encoder5(out)),2,2))
t5 = out # b, c4, H/32, W/32
if self.bridge: t1, t2, t3, t4, t5 = self.scab(t1, t2, t3, t4, t5)
out = F.gelu(self.encoder6(out)) # b, c5, H/32, W/32
out5 = F.gelu(self.dbn1(self.decoder1(out))) # b, c4, H/32, W/32
... | Python | 1 |
/ Result of removing a key from a `Knot`.
enum KnotRemove<'a, K, V> {
/// Key not found; knot not modified.
None,
/// The removed leaf, which was the only leaf left in the knot node. Old knot
/// node left intact in case remove subsequently fails. Caller must drop old knot
/// node if remove fully s... | Rust | 0 |
ed = ARPInstance::<Fr, PerRegisterARP>::is_satisfied(&props, &witness, &worker);
assert!(is_satisfied.is_ok());
let arp = ARPInstance::<Fr, PerRegisterARP>::from_instance(props.clone(), &worker).expect("must work");
let witness_polys = arp.calculate_witness_polys(witness, &worker).expect("must work");
... | Rust | 0 |
w: self }
}
}
use polars::prelude::*;
use std::io::Cursor;
#[test]
fn test_vstack_empty_3220() -> Result<()> {
let df1 = df! {
"a" => ["1", "2"],
"b" => [1, 2]
}?;
let empty_df = df1.head(Some(0));
let mut stacked = df1.clone();
stacked.vstack_mut(&empty_df)?;
stacked.vstac... | Rust | 0 |
RaycastTermination::Miss
}
}
#[derive(Copy, Clone, Default, Debug)]
pub struct Raycast {
pub hit : bool,
pub dist : f32,
pub incidence : u32,
pub material : u32,
pub voxel_id : u32,
pub termination : RaycastTermination,
pub iterations : u32,
}
pub fn voxel_march(voxels : &[VChildDescri... | Rust | 0 |
ng_time;
}
}
<filename>src/fennel/mod.rs
//! Fennel RPC Connection
mod error;
use subxt::{sp_core::sr25519::Pair, ClientBuilder, DefaultConfig, DefaultExtra, PairSigner};
pub use self::error::Error;
/// To run this example, a local fennel node should be running.
///
/// ```bash
/// curl "https://github.com/pari... | Rust | 0 |
enum after mutation");
}
}
#[test]
#[cfg_attr(feature = "wasm", wasm_bindgen_test)]
fn recursive_structures() {
#[derive(Archive, Serialize, Deserialize, Debug, PartialEq)]
#[archive(compare(PartialEq))]
#[archive_attr(derive(Debug))]
// The derive macros don't a... | Rust | 0 |
flags: libc::c_int,
) -> libc::c_int;
}
extern "C" {
pub fn spng_decode_scanline(
ctx: *mut spng_ctx,
out: *mut libc::c_void,
len: usize,
) -> libc::c_int;
}
extern "C" {
pub fn spng_decode_row(ctx: *mut spng_ctx, out: *mut libc::c_void, len: usize) -> libc::c_int;
}
exte... | Rust | 0 |
\x12\x039\x04\n\n\x0c\n\x05\x04\n\x02\x01\x01\x12\x039\x0b\x0f\n\x0c\n\
\x05\x04\n\x02\x01\x03\x12\x039\x12\x13\n\n\n\x02\x04\x0b\x12\x04<\0>\
\x01\n\n\n\x03\x04\x0b\x01\x12\x03<\x08\x14\n\x0b\n\x04\x04\x0b\x02\0\
\x12\x03=\x04\x16\n\r\n\x05\x04\x0b\x02\0\x04\x12\x04=\x04<\x16\n\x0c\n\
\x05\x04\x0b\x02\... | Rust | 0 |
for inst in all_but_last(get_instructions(bb)).filter(|&i| needs_name(i)) {
instnames.push((
inst,
Name::name_or_num(unsafe { get_value_name(inst) }, ctr),
));
}
let term = unsafe { LLVMGetBasicBlockTerminator(bb) };
if term_needs_n... | Rust | 0 |
}
Err(e) => panic!("{}", e),
}
}
#[test]
fn test_point_convex_loop_interior() {
//let normal = Vector3D::new(0., 0., 1.);
let mut the_loop = Loop3D::new();
let l = 0.5;
the_loop.push(Point3D::new(-l, -l, 0.)).unwrap();
the_loop.push(Point3D::n... | Rust | 0 |
/{error_result['total_invalid_cases']}"
)
print(
f" ✓ Graceful degradation: {'✅' if error_result['graceful_degradation'] else '❌'}"
)
# Overall assessment
successful_tests = sum(
[
compatibility_result["success"],
convenience_result["success"],
s... | Python | 1 |
// This is rather arbitrary as based on experience
if dos.e_lfanew == 0 || dos.e_lfanew > 0x200 {
return Err(PeError::Insanity);
}
dos.e_lfanew as usize
};
//---------------- Read up to and including NT headers
let nt_bytes = e_lfanew + mem::size_of::<ImageNtHeaders>();
buf.resize(nt_bytes, 0)... | Rust | 0 |
رآگاه_زن:',
'id': ':detektif_wanita:',
'zh': ':女侦探:',
'ru': ':женщина-детектив:'
},
'\U0001F575\U0000200D\U00002640\U0000FE0F': { # 🕵♀️
'en': ':woman_detective:',
'status': unqualified,
'E': 4,
'alias': [':female_detective:'],
'de': ':detektivin... | Python | 1 |
def __getattr__(attr_name):
from numpy._core import umath
from ._utils import _raise_warning
ret = getattr(umath, attr_name, None)
if ret is None:
raise AttributeError(
f"module 'numpy.core.umath' has no attribute {attr_name}")
_raise_warning(attr_name, "umath")
return ret
| Python | 1 |
let mut h = im::HashMap::new();
for (key, value) in env.into_iter() {
h = h.update(key.to_string(), apply_sub_scheme(subs, value.clone()));
}
h
}
fn compose(subs: Subs, subs2: Subs) -> im::HashMap<String, Type> {
let mut h = im::HashMap::new();
for (key, value) in subs.into_iter() {
... | Rust | 0 |
ck is removed.
click_randomize(fitb)
# Put this before the assertions, since it will wait until the text appears (implying the problem has been updated).
check_description(selenium_utils_get, fitb, "What is 3 + 4?")
assert (
selenium_utils_get.driver.find_element_by_id(
"test_fitb_dy... | Python | 1 |
slide.shapes.title.text = section_title
content_shape = None
for shape in slide.shapes:
if shape.is_placeholder and shape.placeholder_format.idx == 1:
content_shape = shape
... | Python | 1 |
FO" => "Orlando",
"1KBB-US-SEFP" => "Tampa",
"1KBB-US-SEG" => "Georgia (US State)",
"1KBB-US-SEGS" => "Savannah",
"1KBB-US-SEGT" => "Atlanta",
"1KBB-US-SEM" => "Maryland",
"1KBB-US-SEMA" => "Annapolis",
"1KBB-US-SEMB" => "Baltimore",
"1KBB-US-SEN" => "North Carolina",
"1KBB-US-SENA" ... | Rust | 0 |
or> {
match *query {
Query::All => Ok(()),
Query::Keys(ref query_properties) => {
let err_key = query_properties.keys().map(|key| {
if let Some(property_schema) = self.properties.get(key) {
property_schema.validate_query(&query_properties.get(key).unwrap())
} else... | Rust | 0 |
``False`` values will be unchanged.
attn_mask = (attn_mask.sigmoid().flatten(2).unsqueeze(1).repeat(1, self.num_heads, 1, 1).flatten(0, 1) < 0.5).bool()
attn_mask = attn_mask.detach()
return outputs_class, outputs_mask, attn_mask
@torch.jit.unused
def _set_aux_loss(self, outputs_class... | Python | 1 |
{
"name": "Helpdesk Portal Reopen",
"version": "18.0.1.0.0",
"author": "Glo Networks",
"website": "https://github.com/GlodoUK/odoo-addons",
"depends": ["helpdesk"],
"data": [
"views/helpdesk_portal_templates.xml",
"views/helpdesk_team_views.xml",
],
"license": "Other prop... | Python | 1 |
# Copyright (c) 2021, NVIDIA CORPORATION. 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 required by appli... | Python | 1 |
# Copyright (c) 2023 PaddlePaddle Authors. 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 required by appli... | Python | 1 |
nb...", "a\nbc"));
assert!(match_vec_helper("a\nb...", "a\nbc"));
assert!(!match_vec_helper("a\nb...", "a\nb\nc"));
assert!(match_vec_helper("a\n...b...", "a\nb"));
assert!(match_vec_helper("a\n...b...", "a\nxbz"));
assert!(match_vec_helper("a\n...b...", "a\nbz"));
assert... | Rust | 0 |
import torch
import torch.nn as nn
import torch.optim as optim
import numpy as np
from sklearn.model_selection import train_test_split
from sklearn.metrics import accuracy_score
def discriminative_score_metric(critic, real_data, synthetic_data, device, test_size=0.3, batch_size=32, num_epochs=100):
real_data = rea... | Python | 1 |
A20BE, 0x4C42E38, 0x45157F0, 0x2AB1D00, 0xBB402EA, 0x101B4FA, 0xE38,
];
pub const CURVE_W: [[Chunk; NLEN]; 2] = [[0; NLEN]; 2];
pub const CURVE_SB: [[[Chunk; NLEN]; 2]; 2] = [[[0; NLEN]; 2]; 2];
pub const CURVE_WB: [[Chunk; NLEN]; 4] = [[0; NLEN]; 4];
pub const CURVE_BB: [[[Chunk; NLEN]; 4]; 4] = [[[0; NLEN]; 4]; 4];
... | Rust | 0 |
= config[1];
let server_min_ver = config[2];
let server_max_ver = config[3];
let exp_version = config[4];
if (client_max_ver < 3 || server_max_ver < 3) && !cfg!(feature="legacy_protocols") {
continue;
}
let (c, s) = create_tcp_pa... | Rust | 0 |
;
use foreign_types::ForeignType;
use foreign_types::ForeignTypeRef;
use libc::c_char;
use libc::{c_int, c_uchar, c_uint, c_void};
use std::ffi::CStr;
use std::mem;
use std::ptr;
use std::slice;
use std::str;
use std::sync::Arc;
use crate::error::ErrorStack;
use crate::ssl::AlpnError;
use crate::ssl::{ClientHello, Sel... | Rust | 0 |