text string | label_name string | labels int64 |
|---|---|---|
# -*- coding: utf-8 -*-
"""
Created on Sat Oct 10 17:28:01 2015
@author: Steve Elston
Code for visualization of the residuals (errors) of the
regression model.
"""
def azureml_main(BikeShare):
import matplotlib
matplotlib.use('agg') # Set backend
matplotlib.rcParams.update({'font.size': 20})
i... | Python | 1 |
tree: OCamlRef<DynBox<WorkingTreeFFI>>,
) -> OCaml<Option<OCamlBytes>> {
let ocaml_tree = rt.get(tree);
let tree: &WorkingTreeFFI = ocaml_tree.borrow();
let result = tree.get_value();
result.to_ocaml(rt)
}
// OCaml = val of_value : context -> value -> tree Lwt.t
fn ... | Rust | 0 |
.csv";
let mut file = match File::create(&path) {
Err(why) => panic!("couldn't create {}: {}", path, why.description()),
Ok(file) => file,
};
match file.write_all(header.as_bytes()) {
Err(why) => {
pani... | Rust | 0 |
);
//let mut topic_filter = subscribe.topic_filter.clone();
//topic_filter.insert(0, Level::Normal("PPP".into()));
//return (true, Some(HookResult::TopicFilter(Some(topic_filter))))
}
Parameter::ClientUnsubscribe(_session, c, unsubscribe) => {
... | Rust | 0 |
e:
assert not response.is_closed
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
tool = await response.parse()
assert_matches_type(ToolListResponse, tool, path=["response"])
assert cast(Any, response.is_closed) is True
@parametrize
... | Python | 1 |
import logging
import os
from datetime import datetime
from pathlib import Path
from typing import Any, Callable
import torchrunx
import torchrunx.utils.environment
__all__ = ["distribute"]
def build_logging_handlers(hostnames):
log_dir = os.environ["TORCHRUNX_LOG_DIR"]
Path(log_dir).mkdir(parents=True, exi... | Python | 1 |
from Screens.Screen import Screen
from Components.ActionMap import ActionMap
from Components.ScrollLabel import ScrollLabel
class TextBox(Screen):
def __init__(self, session, text="", title=None, pigless=False):
Screen.__init__(self, session)
if pigless:
self.skinName=["TextBoxPigLess", "TextBox"]
self.text ... | Python | 1 |
;
}
}
false
}
fn update_speed(&self) -> f64 {
let update_speed = if self.soft_drop {
// TODO remove magic number
// this is the constant soft drop number
0.05
} else {
let level = (self.level as f64) - 1.0;
... | Rust | 0 |
0] = 0;
fishes.rotate_left(1);
fishes[8] = ready;
fishes[6] += ready;
}
fishes.iter().sum()
}
pub fn part1() {
println!("Day 6, part 1: {}", solve(80));
}
pub fn part2() {
println!("Day 6, part 2: {}", solve(256));
}
<reponame>paulalesius/seed
//! The Response interface of the... | Rust | 0 |
lf) -> &mut dyn (::std::any::Any) {
self as &mut dyn (::std::any::Any)
}
fn into_any(self: ::std::boxed::Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
self
}
fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor {
Self::descriptor_static()
}
... | Rust | 0 |
# SPDX-FileCopyrightText: Florian Bruhin (The Compiler) <mail@qutebrowser.org>
#
# SPDX-License-Identifier: GPL-3.0-or-later
"""Code for :undo --window."""
import collections
import dataclasses
from typing import cast, TYPE_CHECKING
from collections.abc import MutableSequence
from qutebrowser.qt.core import QObject,... | Python | 1 |
mock_changelog.rst = ('^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n'
'Changelog for package fake_pkg\n'
'^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n'
'\n'
'Forthcoming\n'
'-----------\n'... | Python | 1 |
## Bu program, Viola ve Jones algoritmasına dayalı Haar Cascade sınıflandırıcısını kullanır
## Gerçek zamanlı olarak algılanan yüzlerin veritabanını oluşturur
## Kullanılan mikrodenetleyici kartı: "Arduino Uno"
import numpy as np
import cv2
import serial
# Seri iletişim ayarları
ser = serial.Serial(port='COM5', baudr... | Python | 1 |
# Any copyright is dedicated to the Public Domain.
# http://creativecommons.org/publicdomain/zero/1.0/
"""
A variation of example 1 where client handling is performed in a
separate function that in theory can be forked.
"""
from nagini_contracts.contracts import (
Assert,
ContractOnly,
Ensures,
Impli... | Python | 1 |
# SPDX-FileCopyrightText: 2022 Linh Hoang for NVIDIA
# SPDX-FileCopyrightText: 2022 Melissa LeBlanc-Williams for Adafruit Industries
#
# SPDX-License-Identifier: MIT
"""Tegra T234 pin names"""
import atexit
from Jetson import GPIO
GPIO.setmode(GPIO.TEGRA_SOC)
GPIO.setwarnings(False) # shh!
class Pin:
"""Pins d... | Python | 1 |
.ok_or_else(|| invalid_data_error("unknown context ID"))?;
let resp = GetDeviceTypeId_Return::new(ReturnCode::SCARD_S_SUCCESS);
debug!("sending {:?}", resp);
Ok(Some(resp.encode()?))
}
fn handle_read_cache(&mut self, input: &mut Payload) -> RdpResult<Option<Vec<u8>>> {
l... | Rust | 0 |
ab_keypress(self, event):
"""Handles key presses specifically bound when the Map Tab is active."""
key = event.keysym.lower()
if key == 'c':
# Only cycle color if the key is 'c' (this handler is only active on map tab)
# print("Map Tab Key: 'c' pressed. Cycling grid colo... | Python | 1 |
ol is overloaded with work.
fn grow_pool(&'static self, mut inner: MutexGuard<'static, Inner>) {
// If runnable tasks greatly outnumber idle threads and there aren't too many threads
// already, then be aggressive: wake all idle threads and spawn one more thread.
while inner.queue.len() > in... | Rust | 0 |
)*) => (
impl<'a $(,const $N: usize)*> fmt::Debug for $ty {
#[inline]
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
self.as_str().fmt(f)
}
}
impl<'a $(,const $N: usize)*> fmt::Display for $ty {
#[inline]
fn fmt... | Rust | 0 |
#!/usr/bin/env python
# Copyright (c) 2012 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
Verifies that the global xcode_settings processing doesn't throw.
Regression test for http://crbug.com/109163
"""
import TestGyp
impor... | Python | 1 |
import os
import requests
from langchain.tools import tool
from langchain.text_splitter import CharacterTextSplitter
from langchain_community.embeddings import OpenAIEmbeddings
from langchain_community.vectorstores import FAISS
from sec_api import QueryApi
from unstructured.partition.html import partition_html
clas... | Python | 1 |
ize, Serialize, Debug)]
pub struct Volume {
/// Volume level.
pub level: Option<f32>,
/// Mute/unmute state.
pub muted: Option<bool>,
}
#[derive(Deserialize, Debug)]
pub struct LaunchErrorReply {
#[serde(rename = "requestId")]
pub request_id: i32,
... | Rust | 0 |
InfiniteContinuedFraction] represents a infinite simple continued fraction on an iterator
//! 3. [GeneralContinuedFraction][GeneralContinuedFraction] is a trait that provides method to operate on a general continued fraction.
//!
//! # References:
//! - <https://pi.math.cornell.edu/~gautam/ContinuedFractions.pdf>
//! -... | Rust | 0 |
import pytest
from spacy import registry
FUNCTIONS = [
("loggers", "spacy.WandbLogger.v1"),
("loggers", "spacy.WandbLogger.v2"),
("loggers", "spacy.WandbLogger.v3"),
("loggers", "spacy.WandbLogger.v4"),
("loggers", "spacy.WandbLogger.v5"),
("loggers", "spacy.MLflowLogger.v1"),
("loggers", "... | Python | 1 |
ension, AllocatedExtension};
use std::convert::AsRef;
use std::error::Error;
use std::str::FromStr;
use std::convert::TryFrom;
use std::{fmt, str};
/// The Request Method (VERB)
///
/// This type also contains constants for a number of common HTTP methods such
/// as GET, POST, etc.
///
/// Currently includes 8 varia... | Rust | 0 |
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under both the MIT license found in the
# LICENSE-MIT file in the root directory of this source tree and the Apache
# License, Version 2.0 found in the LICENSE-APACHE file in the root directory
# of this source tree.
# pyre-strict
i... | Python | 1 |
reset index
Columns
- Date (pandas.Timestamp): observation date
- ISO3 (str): country names
- Province (str): province/state/prefecture names
- City (str): city names
- Confirmed (numpy.float64): the ... | Python | 1 |
ause BSD license.
* See LICENSE.md for terms of use.
*/
use crate::vm::funcs::*;
use crate::arm::threading::*;
use crate::hos::smc::*;
use crate::hos::kernel::*;
use crate::arm::exceptions::*;
use crate::vm::vmmu::*;
use crate::util::*;
use crate::arm::mmu::*;
use crate::exception_handler::*;
use crate::io::smmu::*;... | Rust | 0 |
ow_data: list[NetflixShow]) -> list[str]:
"""
Returns a sorted list of only the show titles from show_data
that are acted in by the 'most popular' actors
where the 'most popular' is defined as the actors in the most shows.
>>> l_unique_casts = [\
('Movie', "Viceroy's House", ['Gurinder Chadha']... | Python | 1 |
ain_label,test_label = train_test_split(data,label,test_size=0.2,random_state=42)
#尝试分段标准化结束
svm = SVC() #C在0-10之间 gamam在0到1之间
#十折交叉调参,此过程会自动划分验证集
parameters = {'kernel':('linear', 'rbf'), 'C':np.linspace(1e-5,10,10),'gamma':np.linspace(1e-4,1,10)}
# clf = GridSearchCV(svm,parameters)
clf = RandomizedSearchCV(svm,pa... | Python | 1 |
ive };
use crate::{
assets::Id,
ecs::{ Const, Mut, Context },
services::{ Assets, Camera, World },
};
/// Service providing an interface to `WGPU` and `WINIT`
///
/// Renderer is the only service added by default by the engine. It may change in future.
pub struct Renderer {
/// `WINIT` window instance... | Rust | 0 |
# 通过界面与 Gemini 进行连续文字聊天
# 需配置 API 密钥
# 需配置代理
# 需安装 gradio 库
import os
import google.generativeai as genai
import gradio as gr
import logging
import time
import requests
from bs4 import BeautifulSoup
from googleapiclient.discovery import build
import webbrowser
import threading
from datetime import datetime
# 配置日志
lo... | 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | Python | 1 |
/lines.insert(0, format!("│{}│", pad));
//lines.push(format!("│{}│", pad));
lines
}
}
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
struct Term {
const_mult: i32,
/// Says location of term to multiply by.
var_mult: Option<[usize; 2]>,
det: Determinant,
}
impl Term {
fn new(const... | Rust | 0 |
define_number("sq_ft", sq_ft, nullable=True)
if increases is not None:
self.increases = self._define_str("increases", increases, nullable=True)
if lease_expiry is not None:
self.lease_expiry = self._define_str(
"lease_expiry", lease_expiry, nullable=True
... | Python | 1 |
new();
'ma:
loop {
input.clear();
top1_menu();
if io::stdin().read_line(&mut input).is_err() {
println!("you input error!!! ");
continue;
}
match input.as_str().trim() { // .trim 去空白符
"1" => {
open_account();
... | Rust | 0 |
terId: Number, const STRENGTH: usize>(
mut sut: SUT<ValueId, ParameterId>, output_path: PathBuf,
) -> Result<(), String> where [(); STRENGTH - 1]:, [(); STRENGTH - 2]: {
let mca = time_it!(
unconstrained::UnconstrainedIPOG::<
ValueId,
ParameterId,
u128,
un... | Rust | 0 |
) => left.or(&[&right]),
(mir::BinOp::BitOr, _) => left.bvor(&right),
(mir::BinOp::Mul, _) => left.bvmul(&right),
(mir::BinOp::Shl, _) => left.bvshl(&right),
(mir::BinOp::Shr, kind) if kind.is_signed_int() => left.bvashr(&right),
(mir::BinOp::Shr, _) => left... | Rust | 0 |
class Solution:
def uniquePathsWithObstacles(self, obstacleGrid: list[list[int]]) -> int:
# Get the dimensions of the grid (m rows and n columns)
m, n = len(obstacleGrid), len(obstacleGrid[0])
# If the start or end point has an obstacle, no path is possible.
if obstacleGrid[... | Python | 1 |
ymmetry['rotations']),
msg=("%s" % fname))
for r, t in zip(dataset['rotations'], dataset['translations']):
found = False
for r_, t_ in zip(symmetry['rotations'],
symmetry['translations']):
if ... | Python | 1 |
, ×),
iqr = percentile(0.75, ×) - percentile(0.25, ×),
);
}
egraph
}
/// Utility to make a test proving expressions equivalent
///
/// # Example
///
/// ```
/// # use egg::*;
/// egg::test_fn! {
/// // name of the generated test function
/// my_test_name,
/// // ... | Rust | 0 |
c/include",
"aac/libSBRdec/include",
"aac/libSBRenc/include",
"aac/libArithCoding/include",
"aac/libDRCdec/include",
"aac/libSACdec/include",
"aac/libSACenc/include",
];
fn main() {
for src in SOURCES {
// Tell cargo to invalidate the built crate whenever the wrapper changes
... | Rust | 0 |
RNS.log(f"Decryption with ratchets failed on {self}, reloading ratchets from storage and retrying", RNS.LOG_ERROR)
self._reload_ratchets(self.ratchets_path)
decrypted = self.identity.decrypt(ciphertext, ratchets=self.ratchets, enforce_ratchets=self.__enforce_ra... | Python | 1 |
reponame>linianhui/div
// https://docs.oracle.com/javase/specs/jvms/se12/html/jvms-4.html#jvms-4.5
/*
field_info {
u2 access_flags;
u2 name_index;
u2 descriptor_index;
u2 attributes_count;
attribute_info attributes[attributes_count];
}
*/
use crate::... | Rust | 0 |
aster {
fn drop(&mut self) {
// Errors when closing are ignored because we don't actually know if the file descriptor
// was closed. If we retried, it's possible that descriptor was reallocated in the mean
// time and the wrong file descriptor could be closed.
let _ = ::unistd::close... | Rust | 0 |
lized = y_normalized.reshape(N, C, -1) # (N, C, H*W)
# consine similarity
cosine_sim = torch.bmm(x_normalized.transpose(1, 2),
y_normalized) # (N, H*W, H*W)
# convert to distance
dist = 1 - cosine_sim
return dist
# TODO: Considering avoiding OOM.
def compute_l1_dist... | Python | 1 |
//
/// # Arguments
///
/// * `input_path` - The input file path contianing the points and fold instructions.
/// * `num_folds` - The number of fold instructions to perform.
///
/// # Returns
///
/// The number of dots visible after N folds.
fn solution(input_path: &str, num_folds: usize) -> usize {
let reader = get... | Rust | 0 |
Bfull = cp_block_diag(B, Nhor)
constr = [cvx_x[0:nx] == cvx_x0] # Initial condition
constr += [cvx_x[nx:] == Afull @ cvx_x[:-nx] + Bfull @ cvx_u] # Dynamics
constr += [cvx_u >= -u_max, cvx_u <= u_max] # Input constraints
# Build problem
prob = cp.Problem(obj, constr)
# Functions to generate... | Python | 1 |
from flask import Flask, request, jsonify
import tweepy
import praw
import json
import os
app = Flask(__name__)
def twitter_post(auth_details, post):
# Initialize Tweepy Client with bearer token
client = tweepy.Client(bearer_token=auth_details['bearer_token'],
consumer_key=auth_deta... | Python | 1 |
nder the Apache License, Version 2.0,
// found in the LICENSE-APACHE file in the root directory of this source tree.
// You may not use this file except in compliance with the License.
//! Managing [GPU shaders](https://en.wikipedia.org/wiki/Shader).
use crate::*;
use std::sync::atomic::{AtomicUsize, Ordering};
use w... | Rust | 0 |