text string | label_name string | labels int64 |
|---|---|---|
from yogi import tokens
c = 1
for n in tokens(int):
if n%2==0:
print(c)
break
else:
c = c + 1 | Python | 1 |
r_id:
try:
history = vk.messages.getHistory(peer_id=peer_id, count=10, offset=0)
if isinstance(history, dict):
items = history.get('items') or history.get('messages') or []
if items:
... | Python | 1 |
"""this function will serve as an introduction to opencv,
a framework designed for computer vision technologies. THis can
capture video and images, draw overlays and process frames.
in the concept of pose estimation, which we will discuss soon, this
is good for capturing webcam, manipulating frames, render skeletal
o... | Python | 1 |
#!/usr/bin/env python3
"""
Log stats - New version
"""
from pymongo import MongoClient
if __name__ == '__main__':
"""
provide some stats about nginx logs
"""
client = MongoClient('mongodb://localhost:27017/')
db = client.logs
collection = db.nginx
total_logs = collection.count_documents({}... | Python | 1 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, models
class AccountMove(models.Model):
_inherit = 'account.move'
@api.onchange('purchase_vendor_bill_id', 'purchase_id')
def _onchange_purchase_auto_complete(self):
purchase_... | Python | 1 |
arget>
server = self._server_socket(keyfile=SERVER_KEY, certfile=SERVER_CERT, ssl_version=ssl.PROTOCOL_TLSv1_1)
self._assert_connection_success(server, ca_certs=SERVER_CERT, ssl_version=ssl.PROTOCOL_TLSv1_1)
</target>
if not hasattr(ssl, 'PROTOCOL_TLSv1_1') or not hasattr(ssl, 'PROTOCOL... | Python | 1 |
status::PullRequestStatus,
summary::SummaryTextGenerator,
LogicError, Result as LogicResult,
};
async fn arrange(
conf: &Config,
db_adapter: &dyn IDatabaseAdapter,
) -> (RepositoryModel, PullRequestModel) {
// Create a repository and a pull request
let repo = RepositoryModel::builder(conf, "me"... | Rust | 0 |
annel();
tokio::task::spawn(rx.forward(user_ws_tx).map(|result| {
if let Err(e) = result {
eprintln!("websocket send error: {}", e);
}
}));
// Save the sender in our list of connected users.
info!("users.insert: {}", my_ws_uid);
unwrap!(users.lock()).insert(my_ws_uid, tx)... | Rust | 0 |
The default rdd if no more in rdds
"""
if default and not isinstance(default, RDD):
default = self._sc.parallelize(default)
if not rdds and default:
rdds = [rdds]
if rdds and not isinstance(rdds[0], RDD):
rdds = [self._sc.parallelize(input) for inpu... | Python | 1 |
from typing import AsyncGenerator, Generator, Iterable, List, Union
import polars as pl
from mage_ai.data.models.generator import DataGenerator
from mage_ai.data.models.pyarrow.record_batch import RecordBatch, TaggedRecordBatch
from mage_ai.data_preparation.models.variables.constants import VariableType
from mage_ai.... | Python | 1 |
from ..report import Report
from ..table import Table
from advisornotes.models import AdvisorVisit
from coredata.models import Unit
from datetime import datetime, timedelta
class FASAdvisorVisitsWeeklyReport(Report):
title = "FAS Advisor Visit Weekly Report"
description = "A report of all advisor visits for th... | Python | 1 |
if let Some(local) = place.as_local() {
trans.remove(local);
}
});
}
fn apply_yield_resume_effect(
&self,
trans: &mut Self::Domain,
_resume_block: mir::BasicBlock,
resume_place: mir::Place<'tcx>,
) {
if let Some(local) =... | Rust | 0 |
hapes.append(create_obstacle_shape(self.cr_obstacle, obstacle_state.position,
obstacle_state.orientation))
else:
# We could not get the states for all time steps and thus return False
return False
# We could ge... | Python | 1 |
ll_arithmetic_operators, ser.iloc[0], exc=None)
else:
# ... but not the rest.
super().test_arith_series_with_scalar(data, all_arithmetic_operators)
def test_divmod_series_array(self):
# GH 23287
# skipping because it is not implemented
pass
class TestCastin... | Python | 1 |
).unwrap_or_default(),)* ps,),
_ => return Err(Error::arity(args.len())),
};
let $range = range.start + count!($($p)*)..range.end;
let Bind(api, _) = self;
api($($r,)* $(replace!($t, $thread),)? $($e,)? $($p,)* $($rest)?).into_result()
}
}
} }
... | Rust | 0 |
here {
center,
radius: 0.2,
material: Box::new(Lambertian {
albedo: Vec3::new(rand() * rand(), rand() * rand(), rand() * rand()),
}),
}))
} else if material_cho... | Rust | 0 |
, path: &str) -> Box<ProgressReporter> {
let progress_bar = self.multi_progress.add(indicatif::ProgressBar::new(100));
Box::new(ProgressBarReporter::new(progress_bar, path))
}
fn join(&self) {
self.multi_progress.join().ok();
}
}
fn colored_score(quality: &CheckResultQuality) -> AN... | Rust | 0 |
iteratortest").expect("");
let db = DB::open_default(path.path().to_str().unwrap()).unwrap();
for i in 1..8000 {
db.put(format!("{:04}", i).as_bytes(),
format!("{:04}", i).as_bytes())
.expect("");
}
db.flush(true).expect("");
asser... | Rust | 0 |
Signal the thread to stop.
"""
logging.debug("QueueWorker received stop signal.")
self.stop_event.set()
def spawn_periodic_worker(worker_fn, interval, *args, **kwargs):
"""
Factory function to spawn a periodic worker thread.
Args:
worker_fn (callable): Function to ex... | Python | 1 |
}
#[doc = "Bits 8:12 - Active Channel ID"]
#[inline(always)]
pub fn id(&self) -> ID_R {
ID_R::new(((self.bits >> 8) & 0x1f) as u8)
}
#[doc = "Bit 15 - Active Channel Busy"]
#[inline(always)]
pub fn abusy(&self) -> ABUSY_R {
ABUSY_R::new(((self.bits >> 15) & 0x01) != 0)
... | Rust | 0 |
in([str(i) for i in input_args])}": {
"fast_bitblas_top20_tune_time": fast_tune_time,
"fast_bitblas_top1_latency": cpresults[0].latency,
"fast_bitblas_top20_latency": best.latency,
"default_bitblas_tune_time": default_tune_time,
"default_bitblas_latency": t * ... | Python | 1 |
t(vec![value]))
}
}
/// DEPRECATED: See `NewSubfileType`
#[derive(Debug, Eq, PartialEq)]
pub enum SubfileType {
FullResolutionImage,
ReducedResolutionImage,
SinglePageImage,
}
impl Field for SubfileType {
fn tag() -> Tag {
Tag::SubfileType
}
fn decode_from_value(value: &TIFFValue)... | Rust | 0 |
)
val_loss /= (batch_idx+1)
y, y_pred = np.array(y), np.array(y_pred)
stats_dict = eval_stat(y_pred, y, haze_thresh)
stats_dict.update({'val_loss': round(val_loss, 4)})
return stats_dict
def train(config=None):
with wandb.init(config=config):
config = wandb.config
train_... | Python | 1 |
# This file is part of Indico.
# Copyright (C) 2002 - 2025 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
import pytz
def test_serialize_room_api(dummy_room):
from indico.modules.rb.schemas import RoomLegac... | Python | 1 |
SHA256_BITS as f64).ceil() as usize;
format!(
"#define N ({})
#define K ({})
#define LOG2_K ({})
#define DEGREE_EXPANDER ({})
#define DEGREE_BUTTERFLY ({})
#define LOG2_DEGREE_BUTTERFLY ({})
#define NUM_EXPANDER_LAYERS ({})
#define NUM_BUTTERF... | Rust | 0 |
import pytest
from starlette.testclient import TestClient
from sqlalchemy.orm import Session
import app.main
from wps_shared.db.models.hfi_calc import PlanningWeatherStation, FireCentre, FuelType, PlanningArea
import app.routers.hfi_calc
def mock_get_fire_weather_stations(_: Session):
fire_centre = FireCentre(id=... | Python | 1 |
# database_operations.py
import psycopg2
# Создаем соединение с базой данных
conn = psycopg2.connect(
host="localhost",
database="postgres",
user="postgres",
password="210506kz"
)
cur = conn.cursor()
def insert_user(username):
cur.execute("INSERT INTO public.user (username) VALUES (%s) ON CONFLIC... | Python | 1 |
<i32>, costs: Vec<i32>) -> i32 {
// dp[day]: 第day天所花费的最小票价
// dp[day] = min(dp[day-1]+costs[0], dp[day-7]+costs[1], dp[day-30]+costs[2])
let mut travel = [false; 366];
let mut dp = [0; 366];
let (first, last) = (*days.first().unwrap(), *days.last().unwrap());
for day in d... | Rust | 0 |
__ = ['id', 'node_id', 'status', 'subscriber_email', 'update_time']
def __init__(self, node_dict: typing.Dict):
self.id = 0
self.node_id = 0
self.status = self.STATUS_WAITING
self.subscriber_email = ''
for k in self.__slots__:
if k not in node_dict:
... | Python | 1 |
:CheckCaseInsensitiveStr(&query))
} else {
Ok(PathCheck::CheckStr(&query))
}
}
}
} else {
Ok(PathCheck::Allow)
}
}
}
#[cfg(test)]
mod tests {
use super::*;
use std::path::Path;
#[tes... | Rust | 0 |
unsafe fn stat(path: *c_char, buf: *mut stat) -> c_int;
#[cfg(target_os = "macos")]
#[link_name = "stat64"]
unsafe fn stat(path: *c_char, buf: *mut stat) -> c_int;
}
}
#[nolink]
#[abi = "cdecl"]
pub mod stdio {
... | Rust | 0 |
NL80211_BSS_SELECT_ATTR_MAX: nl80211_bss_select_attr = 3;
pub type nl80211_bss_select_attr = ::std::os::raw::c_uint;
pub const NL80211_NAN_FUNC_PUBLISH: nl80211_nan_function_type = 0;
pub const NL80211_NAN_FUNC_SUBSCRIBE: nl80211_nan_function_type = 1;
pub const NL80211_NAN_FUNC_FOLLOW_UP: nl80211_nan_function_type = ... | Rust | 0 |
ew)
.push(Target { p: *p, d: dist });
}
let mut cnt = 0;
let ans2 = 'outer: loop {
let mut keys_to_be_deleted: Vec<Angle> = Vec::new();
for (&k, ts) in targets.iter_mut() {
if let Some(t) = ts.pop() {
cnt += 1;
if cnt == 200 {
... | Rust | 0 |
) -> bool {
self.bounds.is_empty()
}
/// Clears all bound requirements
pub fn clear_bounds(&mut self) -> &mut Self {
self.bounds.clear();
self
}
/// Pushes a single bound requirement
pub fn push_bound<T>(&mut self, bound: T) -> &mut Self
where
T: Into<Type>
... | Rust | 0 |