content stringlengths 0 1.05M | origin stringclasses 2
values | type stringclasses 2
values |
|---|---|---|
# Import required library
import os # To access environment variables
from dotenv import load_dotenv # To load environment variables from .env file
import serial # To connect via the serial port
import time # To sleep for a few seconds
# The thing ID and acc... | nilq/baby-python | python |
from py2neo import Graph,Node,Relationship,Subgraph
graph = Graph('http://localhost:7474',username='neo4j',password='123456')
tx = graph.begin()
# ### 增加
# # 可以一个一个创建
# a = Node('Person',name='bubu')
# graph.create(a)
# b = Node('Person',name='kaka')
# graph.create(b)
# r = Relationship(a,'KNOWS',b)
# graph.create(r... | nilq/baby-python | python |
from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
from SocketServer import ThreadingMixIn
import threading
import SocketServer
from tools.tools import is_unsigned_integer
import re
import simplejson
import cgi
# urls:
# - https://docs.python.org/3/glossary.html#term-global-interpreter-lock
# - http://stac... | nilq/baby-python | python |
def formatString(input):
input = re.sub("\s+", " ", input)
if " " == input[0]:
input = input[1:]
if " " == input[-1]:
input = input[:-1]
return input
| nilq/baby-python | python |
# Copyright 2015 The Oppia 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 applicable ... | nilq/baby-python | python |
import scrapy.http.response
class CacheResponse(scrapy.http.response.Response):
is_cache = False
def mark_cache(self):
self.is_cache = True
return self
def judge_cache(self):
if not hasattr(self, 'is_cache'):
return False
return self.is_cache
| nilq/baby-python | python |
from django.core.management.base import BaseCommand, CommandError
from coinhub import pullData as myModel
# Run via cron job similar to the form shown below
# * * * * * python manage.py data_grabber --url https://api.coinmarketcap.com/v1/ticker/
class Command(BaseCommand):
help = 'Collects data from an exchange'
... | nilq/baby-python | python |
import settings
import shutil
def make_cbz():
shutil.make_archive('comic','zip',root_dir=settings.IMAGES_PATH)
shutil.move('comic.zip','comic.cbz')
if __name__ == "__main__":
make_cbz() | nilq/baby-python | python |
from __future__ import absolute_import
import string
from struct import unpack
from vertica_python.vertica.messages.message import BackendMessage
class ParameterStatus(BackendMessage):
def __init__(self, data):
null_byte = string.find(data, '\x00')
unpacked = unpack('{0}sx{1}sx'.format(null_by... | nilq/baby-python | python |
import torch as to
from torch.distributions.uniform import Uniform
from pyrado.policies.base import Policy
from pyrado.policies.base_recurrent import RecurrentPolicy
from pyrado.utils.data_types import EnvSpec
class IdlePolicy(Policy):
""" The most simple policy which simply does nothing """
name: str = 'id... | nilq/baby-python | python |
#!/usr/bin/env python
# Title : XGB_BostonHousing.py
# Description : After using LinearRegression and GradientBoostingRegressor, we
# can further improve the predicitions with state-of-the-art
# algorithms, like XGBReegressor. It can use regularization and
# bet... | nilq/baby-python | python |
import pytest
from pandas import Timedelta
@pytest.mark.parametrize('td, expected_repr', [
(Timedelta(10, unit='d'), "Timedelta('10 days 00:00:00')"),
(Timedelta(10, unit='s'), "Timedelta('0 days 00:00:10')"),
(Timedelta(10, unit='ms'), "Timedelta('0 days 00:00:00.010000')"),
(Timedelta(-10, unit='ms... | nilq/baby-python | python |
from flask import Blueprint, jsonify, request
from threading import Thread, Lock, Event
from copy import deepcopy
from node import Node
import pickle
import config
import random
import time
node = Node()
rest_api = Blueprint('rest_api', __name__)
# ------------------------------------------
# ------------- Node endpo... | nilq/baby-python | python |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2016-06-24 10:45
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("timeline_logger", "0001_initial"),
]
operations = [
migrations.AlterModelOptions(
... | nilq/baby-python | python |
#!/usr/bin/python3
import fitz, shutil
from fitz.utils import getColor
from os import listdir
from os.path import isdir, isfile, join
import PySimpleGUI as sg
print = sg.EasyPrint
help_lisc_input = "Ce logiciel est soumis à la licence GPL v2, (c) Jodobear 2019.\n\nMentionner uniquement le dossier compr... | nilq/baby-python | python |
from torch.optim.lr_scheduler import LambdaLR
class Scheduler(object):
"""Simple container for warmup and normal scheduler."""
def __init__(self, normal_schededuler, warmup_scheduler=None):
self.warmup = warmup_scheduler
self.sched = normal_schededuler
def get_last_lr(self):
""" R... | nilq/baby-python | python |
"""
Pyncette ships with an optional Prometheus instrumentation based on the official prometheus_client
Python package. It includes the following metrics:
- Tick duration [Histogram]
- Tick volume [Counter]
- Tick failures [Counter]
- Number of currently executing ticks [Gauge]
- Task duration [Histogram]
- Task volum... | nilq/baby-python | python |
from alc import dyn
# example of metadata to be added in VSD WAN Service:
# "rd=3:3,vprnAS=65000,vprnRD=65000:1,vprnRT=target:65000:1,vprnLo=1.1.1.1"
# example of tools cli to test this script: tools perform service vsd evaluate-script domain-name "l3dom1" type vrf-vxlan action setup policy "py-vrf-vxlan" vni 12... | nilq/baby-python | python |
from abaqusConstants import *
from .GeometricRestriction import GeometricRestriction
from ..Region.Region import Region
class SlideRegionControl(GeometricRestriction):
"""The SlideRegionControl object defines a slide region control geometric restriction.
The SlideRegionControl object is derived from the Geome... | nilq/baby-python | python |
# -*- coding: utf-8 -*-
"""
-------------------------------------------------
@File : test_RPSprepare.py
Description :
@Author : pchaos
tradedate: 18-5-16
-------------------------------------------------
Change Activity:
18-5-16:
@Contact : p19992003#gmail.com
--... | nilq/baby-python | python |
from amigocloud import AmigoCloud
# Use amigocloud version 1.0.5 or higher to login with tokens
# This will raise an AmigoCloudError if the token is invalid or has expired
ac = AmigoCloud(token='<token>')
query = ({
"author": "",
"extra": "",
"layer_name": "0",
"name": "My first basela... | nilq/baby-python | python |
#!/usr/bin/env python3
from bank.user import User
from bank.account import Account
carter = User("Carter", 123, 1)
account = Account(123, 1000, "checking")
print("{} has account number {} with a pin number {}".format(carter.name, carter.account, carter.pin_number))
print("{} account with account number {} has balanc... | nilq/baby-python | python |
from setuptools import setup, find_packages
setup(
name='s3filesmanager',
version='0.5.3',
description='AWS S3 files manager',
#long_description=open('docs/index.rst').read(),
author='Jeffrey Hu',
author_email='zhiwehu@gmail.com',
url='https://github.com/zhiwehu/s3filesmanager',
instal... | nilq/baby-python | python |
import sys
sys.path.insert(0, "/work/ml_pipeline/regression_models/")
import regression_models
import numpy as np
from sklearn.model_selection import train_test_split
import pipeline
from processing.data_management import load_dataset, save_pipeline
from config import config
from regression_models import __version__ as... | nilq/baby-python | python |
# Generated by Django 2.1.7 on 2019-03-06 19:18
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('project', '0005_auto_20190220_1112'),
]
operations = [
migrations.AlterField(
model_name='activeproject',
name='proj... | nilq/baby-python | python |
import numpy as np
from .vice import VICE
from .sac_classifier import SACClassifier
from softlearning.misc.utils import mixup
class VICEGoalConditioned(VICE):
def _timestep_before_hook(self, *args, **kwargs):
# TODO(hartikainen): implement goal setting, something like
# goal = self.pool.get_goal.... | nilq/baby-python | python |
# (C) Copyright 2015 Hewlett Packard Enterprise Development LP
# 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/LICEN... | nilq/baby-python | python |
from pybithumb.core import *
from pandas import DataFrame
import pandas as pd
import datetime
import math
class Bithumb:
@staticmethod
def _convert_unit(unit):
try:
unit = math.floor(unit * 10000) / 10000
return unit
except:
return 0
... | nilq/baby-python | python |
from django import forms
from django.forms.widgets import RadioSelect, CheckboxSelectMultiple
from django.forms import TypedChoiceField
from django.forms.models import inlineformset_factory
from django.utils.translation import ugettext_lazy as _
from keyform.models import Request, KeyData, Contact, KeyType
cl... | nilq/baby-python | python |
#!/usr/bin/python
# module_check: supported
# Avi Version: 17.1.1
# Copyright 2021 VMware, Inc. All rights reserved. VMware Confidential
# SPDX-License-Identifier: Apache License 2.0
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'commun... | nilq/baby-python | python |
from .api import NasapiError, Nasapi #noqa | nilq/baby-python | python |
import sys
from people_flow import YOLO
from people_flow import detect_video
if __name__ == '__main__':
video_path = 'test1.MP4'
output_path='human_counter-master'
detect_video(YOLO(), video_path, output_path)
print('sun')
| nilq/baby-python | python |
from .routes import Tesseract_OCR_BLUEPRINT
from .routes import Tesseract_OCR_BLUEPRINT_WF
#from .documentstructure import DOCUMENTSTRUCTURE_BLUEPRINT | nilq/baby-python | python |
# Copyright 2009-2013 Eucalyptus Systems, Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# b... | nilq/baby-python | python |
import json5
from django.shortcuts import render, redirect
from django.contrib.auth.decorators import login_required
from django.utils import timezone
from home.models import SiparisKayitlari, Masa
from kullanici.models import Profil
from menu.models import Menu
import datetime
@login_required(login_url="/l... | nilq/baby-python | python |
from django.shortcuts import render
from rest_framework.views import APIView
from rest_framework.response import Response
from .models import Product,Denomination, Order, OrderItem
from end_users import serializers
# Create your views here.
""" All Product related APIs here"""
class ProductApiView(APIView):
seriali... | nilq/baby-python | python |
"""
Contains some helper functions and classes.
"""
import os
import shutil
import typing as t
class attrdict(dict):
"""
Sub-class like python dict with support for I/O like attr.
>>> profile = attrdict({
'languages': ['python', 'cpp', 'javascript', 'c'],
'nickname': 'doge gui',
... | nilq/baby-python | python |
"""
In this module are stored the main Neural Networks Architectures.
"""
from .base_architectures import (BaseDecoder, BaseDiscriminator, BaseEncoder,
BaseMetric)
__all__ = ["BaseDecoder", "BaseEncoder", "BaseMetric", "BaseDiscriminator"]
| nilq/baby-python | python |
"""kernels tests."""
| nilq/baby-python | python |
nome = str(input('Digite seu nome completo: ')).strip()
n = nome.split()
print(f"Seu primeiro nome é: {n[0]}")
print(f"Seu último nome é {n[len(n)-1]}")
| nilq/baby-python | python |
#!/usr/bin/env python3
from matplotlib import pyplot as plt
from nltk.tokenize import word_tokenize
from classify import load_data
from features import FeatureExtractor
import pandas as pd
import numpy as np
def visualize_class_balance(data_path, classes):
class_counts = {c: 0 for c in classes}
for c in clas... | nilq/baby-python | python |
from lib.userInterface import userInterface
if __name__ == '__main__':
ui = userInterface()
if ui.yesNoQuery("Input from file? [y/n]"):
path = input("Please input path of your file: ")
ui.fileInput(path)
else:
ui.userInput()
ui.quantize().predict()
print ("The predicted pr... | nilq/baby-python | python |
from django.core.urlresolvers import reverse
from nose.tools import eq_
from mozillians.common.tests import TestCase
from mozillians.groups.tests import GroupFactory
from mozillians.users.tests import UserFactory
class OldGroupRedirectionMiddlewareTests(TestCase):
def setUp(self):
self.user = UserFactor... | nilq/baby-python | python |
import os
hosturl = os.environ.get('HOSTURL')
from lightserv import create_app
from lightserv.config import DevConfig,ProdConfig
import socket
flask_mode = os.environ['FLASK_MODE']
if flask_mode == 'PROD':
app = create_app(ProdConfig)
elif flask_mode == 'DEV':
app = create_app(DevConfig)
if __name__ == '__main__':
... | nilq/baby-python | python |
from dataclasses import dataclass
from expungeservice.models.charge import ChargeType
from expungeservice.models.charge import ChargeUtil
from expungeservice.models.expungement_result import TypeEligibility, EligibilityStatus
@dataclass(frozen=True)
class SevereCharge(ChargeType):
type_name: str = "Severe Charge... | nilq/baby-python | python |
# coding=utf-8
# Copyright 2021 The TensorFlow Datasets Authors.
#
# 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 appl... | nilq/baby-python | python |
# coding: utf-8
"""
Wavefront REST API Documentation
<p>The Wavefront REST API enables you to interact with Wavefront servers using standard REST API tools. You can use the REST API to automate commonly executed operations such as automatically tagging sources.</p><p>When you make REST API calls outside the W... | nilq/baby-python | python |
"""
Rewrite spec/functional_specs/email_accounts_spec.rb
Creates account and checks, if the emails informing about the
new service subscription, new application sign-up to service and application
subscription to an app plan have been sent.
"""
import os
import re
import pytest
import yaml
import backoff
from testsuit... | nilq/baby-python | python |
a, b, x, y = (int(input()) for _ in range(4))
p, q = (x - 1) * a + x, (x + 1) * a + x
e, r = (y - 1) * b + y, (y + 1) * b + y
print(-1 if q < e or r < p else str(max(p, e)) + ' ' + str(min(q, r)))
| nilq/baby-python | python |
#!/usr/bin/python
"""
This is the most simple example to showcase Containernet.
"""
from containernet.net import Containernet
from containernet.node import DockerSta
from containernet.cli import CLI
from containernet.term import makeTerm
from mininet.log import info, setLogLevel
from mn_wifi.link import wmediumd
from m... | nilq/baby-python | python |
from ErnosCube.mutation_node import MutationNode
from ErnosCube.cube_mutation import CubeMutation
from pytest import mark
class TestMutationNode:
"""Collection of all tests run on instances of the MutationNode."""
@mark.dependency(name="construction_1")
def test_construction_1(self):
MutationNode... | nilq/baby-python | python |
import numpy
from SLIX import toolbox, io, visualization
import matplotlib
from matplotlib import pyplot as plt
import pytest
import shutil
import os
matplotlib.use('agg')
class TestVisualization:
def test_visualize_unit_vectors(self):
example = io.imread('tests/files/demo.nii')
peaks = toolbox.s... | nilq/baby-python | python |
# Copyright 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from __future__ import absolute_import
import argparse
import logging
import shutil
import sys
import tempfile
import six
from telemetry import benchmark
fr... | nilq/baby-python | python |
"""Kata url: https://www.codewars.com/kata/61123a6f2446320021db987d."""
from typing import Optional
def prev_mult_of_three(n: int) -> Optional[int]:
while n % 3:
n //= 10
return n or None
| nilq/baby-python | python |
import numpy as np, json
import pickle, sys, argparse
from keras.models import Model
from keras import backend as K
from keras import initializers
from keras.optimizers import RMSprop
from keras.utils import to_categorical
from keras.callbacks import EarlyStopping, Callback, ModelCheckpoint
from keras.layers import *
f... | nilq/baby-python | python |
import mne
import mne_bids
import numpy as np
from config import fname, n_jobs
report = mne.open_report(fname.report)
# Load raw data (tSSS already applied)
raw = mne_bids.read_raw_bids(fname.raw, fname.bids_root)
raw.load_data()
report.add_figs_to_section(raw.plot_psd(), 'PSD of unfiltered raw', 'Raw', replace=True... | nilq/baby-python | python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import os
import itertools
import time
import datetime
import threading
import traceback
import shutil
import re
import math
import wx
import pygame
from pygame.locals import MOUSEBUTTONDOWN, MOUSEBUTTONUP, KEYDOWN, KEYUP, USEREVENT
import cw
... | nilq/baby-python | python |
from lib.config.config import cfg, pth
import torch
import torchvision
from torchvision import transforms, datasets
import os
import sys
sys.path.append('..')
sys.path.append('../..')
dataset_save_pth = pth.DATA_DIR
# 画像ファイルを読み込むための準備(channels x H x W)
transform = transforms.Compose([
transforms.ToTensor()
])
... | nilq/baby-python | python |
from decimal import Decimal
while True:
a = input('Number: ').replace('0.', '')
b = Decimal('0')
for i, c in zip(a, range(-1, -1 - len(a), -1)):
b += Decimal(str(i)) * Decimal('2') ** Decimal(str(c))
print(b) | nilq/baby-python | python |
class Color:
WHITE = (255, 255, 255)
BLACK = (0, 0, 0)
LIGHT_GRAY = (200, 200, 200)
GRAY = (127, 127, 127)
DARK_GRAY = (50, 50, 50)
RED = (0,0, 255)
GREEN = (0, 255, 0)
BLUE = (255, 0, 0)
YELLOW = (0, 255, 255)
CYAN = (255, 255, 0)
MAGENTA = (255, 0, 255)
| nilq/baby-python | python |
#%%
import os
import pickle
import time
from pathlib import Path
import colorcet as cc
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
from sklearn.decomposition import PCA
from sklearn.feature_selection import VarianceThreshold
from sklearn.model_selection import train_tes... | nilq/baby-python | python |
class Final(type):
def _new_(meta,name,bases,attrs):
if issubclass():
raise TypeError
return super()._new_(meta,name,bases,attrs)
class Sealed(metaclass=Final):pass
class ShouldFail(Sealed):pass
| nilq/baby-python | python |
"""COUNTER 5 test suite"""
| nilq/baby-python | python |
# -*- coding: utf-8 -*-
#
# tborg/tborg.py
#
"""
The TunderBorg API
by Carl J. Nobile
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS ... | nilq/baby-python | python |
# Generated by Django 3.2.3 on 2021-05-24 21:11
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Author',
fields=[
('id', models.BigAutoField... | nilq/baby-python | python |
#-------------------------------------------------------------------------------
# Author: Lukasz Janyst <lukasz@jany.st>
# Date: 26.11.2017
#
# Licensed under the 3-Clause BSD License, see the LICENSE file for details.
#-------------------------------------------------------------------------------
import logging
i... | nilq/baby-python | python |
from setuptools import setup, find_packages
setup(
name='sixfab-tool',
version='0.0.3',
author='Ensar Karabudak',
author_email='ensarkarabudak@gmail.com',
description='Sixfab Diagnostic Tool',
license='MIT',
url='https://github.com/sixfab/setup-and-diagnostic-tool.git',
dependency_links... | nilq/baby-python | python |
import json
import numpy
import torch
#intrinsics_dict = None
def load_intrinsics_repository(filename, stream='Depth'):
#global intrinsics_dict
with open(filename, 'r') as json_file:
intrinsics_repository = json.load(json_file)
if (stream == 'Depth'):
intrinsics_dict = dict((i... | nilq/baby-python | python |
from adjudicator.base import Season, Phase
from adjudicator.decisions import Outcomes
from adjudicator.paradoxes import find_circular_movements
def process(state):
"""
Processes all orders in a turn.
"""
orders = state.orders
pieces = state.pieces
for order in orders:
order.check_legal... | nilq/baby-python | python |
import petl
import simpleeval
from ..step import Step
from ..field import Field
class field_add(Step):
code = "field-add"
def __init__(
self,
descriptor=None,
*,
name=None,
value=None,
position=None,
incremental=False,
**options,
):
... | nilq/baby-python | python |
import math
import random
from simulator.constants import BYTES_PER_PACKET
from simulator.trace import Trace
class Link():
def __init__(self, trace: Trace):
self.trace = trace
self.queue_delay = 0.0
self.queue_delay_update_time = 0.0
self.queue_size = self.trace.get_queue_size()
... | nilq/baby-python | python |
import numpy as np
import torch
def covariance(m, rowvar=False):
'''Estimate a covariance matrix given data.
Covariance indicates the level to which two variables vary together.
If we examine N-dimensional samples, `X = [x_1, x_2, ... x_N]^T`,
then the covariance matrix element `C_{ij}` is the covar... | nilq/baby-python | python |
import tweepy
import networkx as nx
class Utils():
"""
Utility functions for rundown.
"""
def __init__(self):
"""Constructor. Nothing to see here."""
self.rundown = self.init_rundown()
def init_rundown(self):
"""
Authenticates API, etc.
Parameters
-... | nilq/baby-python | python |
'''Crie as classes necessárias para um sistema de gerenciamento de uma biblioteca. Os
bibliotecários deverão preencher o sistema com o título do livro, os autores, o ano, a editora, a
edição e o volume. A biblioteca também terá um sistema de pesquisa (outro software), portanto
será necessário conseguir acessar os atrib... | nilq/baby-python | python |
#!/usr/bin/env python
# coding=utf8
import logging
from logging import NullHandler
logging.getLogger(__name__).addHandler(NullHandler())
| nilq/baby-python | python |
class Solution:
def minCostClimbingStairs(self, cost: List[int]) -> int:
n = len(cost)
dp = [0 for _ in range(n)]
dp[-1] = cost[-1]
dp[-2] = cost[-2]
for i in range(n - 3, -1, -1):
dp[i] = cost[i] + min(dp[i + 1], dp[i + 2])
return min(dp[0], dp[1])
| nilq/baby-python | python |
from zipfile import ZipFile
import zipfile
import wget
import os
import subprocess
import pycountry
# define variables
path = '/path/ipvanish/'
url = 'https://www.ipvanish.com/software/configs/configs.zip'
filename = path + '/' + os.path.basename(url)
best_ping = 99999
# get user's choice
def get_choice():
print(... | nilq/baby-python | python |
from django.contrib import admin
from .models import (
Payment,
PaymentChoice
)
admin.site.register(Payment)
admin.site.register(PaymentChoice)
| nilq/baby-python | python |
from gym_connect_four.envs.connect_four_env import ConnectFourEnv, ResultType
| nilq/baby-python | python |
import requests
def coords_to_divisions(lat, lng):
url = f"https://v3.openstates.org/divisions.geo?lat={lat}&lng={lng}"
try:
data = requests.get(url).json()
return [d["id"] for d in data["divisions"]]
except Exception:
# be very resilient
return []
| nilq/baby-python | python |
# Generated by Django 2.0.7 on 2018-10-25 11:18
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('hivs_cd', '0011_add_field_condomdistribution_purpose'),
]
operations = [
migrations.AlterField(
... | nilq/baby-python | python |
#!/home/bryanfeeney/anaconda3/bin/python3.6
#
# Simple script that uses the Microsoft Light Gradient-Boosted Machine-Learnign
# toolkit to make predictions *separately* for each value.
#
from datetime import date, timedelta, datetime
import pandas as pd
import numpy as np
from sklearn.metrics import mean_squared_err... | nilq/baby-python | python |
__source__ = 'https://leetcode.com/problems/intersection-of-two-linked-lists/'
# https://github.com/kamyu104/LeetCode/blob/master/Python/intersection-of-two-linked-lists.py
# Time: O(m + n)
# Space: O(1)
# LinkedList
#
# Description: Leetcode # 160. Intersection of Two Linked Lists
#
# Write a program to find the node... | nilq/baby-python | python |
# Generated by Django 2.2.10 on 2020-08-23 11:08
from django.db import migrations, models
import django.db.models.deletion
import event.enums
class Migration(migrations.Migration):
dependencies = [("event", "0016_attachment_type")]
operations = [
migrations.CreateModel(
name="Schedule",... | nilq/baby-python | python |
#!/usr/bin/env python
#-*- coding:utf-8 -*-
"""
Created on Mar 1, 2020
@author: Chengning Zhang
"""
import warnings
warnings.filterwarnings("ignore")
def get_cv(cls,X,Y,M,n_splits=10,cv_type = "StratifiedKFold",verbose = True):
""" Cross validation to get CLL and accuracy and training time and precision and recall... | nilq/baby-python | python |
#!/usr/bin/env python
#
# Public Domain 2014-2016 MongoDB, Inc.
# Public Domain 2008-2014 WiredTiger, Inc.
#
# This is free and unencumbered software released into the public domain.
#
# Anyone is free to copy, modify, publish, use, compile, sell, or
# distribute this software, either in source code form or as ... | nilq/baby-python | python |
from time import sleep
from progress.bar import Bar
with Bar('Processing...') as bar:
for i in range(100):
sleep(0.02)
bar.next()
| nilq/baby-python | python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import (
absolute_import, division, print_function, with_statement,
unicode_literals
)
class DataObj:
def __init__(self, str, *args, **kwargs):
self.docs = None
self.span = None
str = self.preprocess(str)
def prep... | nilq/baby-python | python |
import pygame
import time
class Clock:
def __init__(self, profile: int, turbo: bool):
self.cycle = 0
self.frame = 0
self.pyclock = pygame.time.Clock()
self.start = time.time()
self.profile = profile
self.turbo = turbo
def tick(self) -> bool:
self.cycle ... | nilq/baby-python | python |
from cascade_at.core.log import get_loggers
LOG = get_loggers(__name__)
class InputDataError(Exception):
"""These are errors that result from faults in the input data."""
class SettingsError(InputDataError):
def __init__(self, message, form_errors=None, form_data=None):
super().__init__(message)
... | nilq/baby-python | python |
import logging
from pipelines.plugin.base_plugin import BasePlugin
from pipelines.plugin.exceptions import PluginError
from pipelines.plugin.utils import class_name
log = logging.getLogger('pipelines')
class PluginManager():
def __init__(self):
self.plugins = {}
def get_plugin(self, name):
... | nilq/baby-python | python |
import json
import os
from typing import List, Optional
from dkron_python.api import Dkron, DkronException
import typer
app = typer.Typer()
get = typer.Typer(help="Fetch information about a resource")
apply = typer.Typer(help="Apply a resource")
delete = typer.Typer(help="Delete a resource")
app.add_typer(get, name="g... | nilq/baby-python | python |
class ServiceProvider():
wsgi = True
def __init__(self):
self.app = None
def boot(self):
pass
def register(self):
self.app.bind('Request', object)
def load_app(self, app):
self.app = app
return self
| nilq/baby-python | python |
from dynabuffers.api.ISerializable import ISerializable, ByteBuffer
from dynabuffers.ast.ClassType import ClassType
from dynabuffers.ast.EnumType import EnumType
from dynabuffers.ast.UnionType import UnionType
from dynabuffers.ast.annotation.GreaterEquals import GreaterEquals
from dynabuffers.ast.annotation.GreaterThan... | nilq/baby-python | python |
# uncompyle6 version 3.7.4
# Python bytecode 3.7 (3394)
# Decompiled from: Python 3.7.9 (tags/v3.7.9:13c94747c7, Aug 17 2020, 18:58:18) [MSC v.1900 64 bit (AMD64)]
# Embedded file name: T:\InGame\Gameplay\Scripts\Server\sims\suntan\suntan_ops.py
# Compiled at: 2019-05-09 01:16:48
# Size of source mod 2**32: 1473 bytes
... | nilq/baby-python | python |
from avatar2 import QemuTarget
from avatar2 import MemoryRange
from avatar2 import Avatar
from avatar2.archs import ARM
from avatar2.targets import Target, TargetStates
from avatar2.message import *
import tempfile
import os
import time
import intervaltree
import logging
from nose.tools import *
QEMU_EXECUTABLE = ... | nilq/baby-python | python |
"""
This module contains our unit and functional tests for the "think_aloud" application.
"""
# Create your tests here.
| nilq/baby-python | python |
"""Database objects."""
import sqlalchemy
from collections import Mapping
from sqlalchemy.engine.url import make_url
from sqlalchemy.event import listen
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import scoped_session
from sqlalchemy.orm.session import sessionmaker
from .exceptions im... | nilq/baby-python | python |
def find_next_square(sq):
| nilq/baby-python | python |
#!/usr/bin/python3.7
########################################################################################
# pvt_collector/tedlar.py - Represents an tedlar layer within a PVT panel.
#
# Author: Ben Winchester
# Copyright: Ben Winchester, 2021
##########################################################################... | nilq/baby-python | python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.