index int64 0 1,000k | blob_id stringlengths 40 40 | code stringlengths 7 10.4M |
|---|---|---|
992,200 | 42d01edb896166a9e1819b41c978effa1b45eb49 | import sys
from collections import deque
dx=[-1,1,0,0]
dy=[0,0,-1,1]
q=deque()
def bfs(x, y):
q.append((x,y))
visit[x][y]=1
while q:
front_x, front_y = q[0]
q.popleft()
for i in range(0, 4):
nx=dx[i]+front_x
ny=dy[i]+front_y
if nx >= 0 and nx < ... |
992,201 | 649813e8dc97d5b1ec7ff9d4126f4c610f009b08 | from gpiozero import Button, LED
from datetime import datetime
pins = [
{
'buttonPin': 17 ,
'ledPin': 13 ,
},
{
'buttonPin': 22 ,
'ledPin': 26 ,
}
]
class Paddle:
def __init__(self, paddleId, buttonPressCb):
self.id = paddleId
self.button = Button(pins[paddleId]['buttonPin'])
self.led = ... |
992,202 | 9fbf4cae7678b3eebe0c8266d52002b0f03811f6 | from django.contrib.auth.models import User
from django.core.exceptions import (
FieldError,
MultipleObjectsReturned,
ObjectDoesNotExist,
)
from django_celery_results.models import TaskResult
from rest_framework.exceptions import ValidationError
from rest_framework.serializers import ModelSerializer
from j... |
992,203 | ed52f854ff91c22896cfd7cf59ed2817ebdfe51e | import tempfile
from PIL import Image
from django.contrib.auth import get_user_model
from django.test import TestCase
from django.urls import reverse
from rest_framework import status
from rest_framework.test import APIClient
from core import models
from staff import serializer
PROCEDURE_URL = reverse("staff:proced... |
992,204 | f94c3f9f9020d80bd169972e8eebe1dd8fa4c7d5 | import pandas as pd
import sys
df = pd.read_csv(sys.argv[1],names=["comment_text"])
#remove all the tagged user, along with the hashtag symbol and quotes
df["comment_text"]=df["comment_text"].replace({"(@\w+)":""},regex=True)
#replace also the @ symbol
df["comment_text"]=df["comment_text"].replace({"@":""},regex=True... |
992,205 | 0c7b05dbb38965194763ce7446be07cf3655b0c0 | # EVERYTHING IN ONE SINGLE ARRAY
# TRIANGULAR NOISE
# ~6 TIMES SLOWER THAN 1 :(
import numpy as np
import matplotlib.pyplot as plt
class Network:
def __init__(self, time_constant=20, error_pairs=2, normalize_weights=(0,), pos_error_to_head=(2, 0), neg_error_to_head=(0.3, 0),
learning_rate=0.01, ... |
992,206 | 1c77a7297417ba15739f4807ce53d7486dcebb81 | # -*- coding: utf-8 -*-
# @Author: Mr.Jhonson
# @Date: 2017-08-20 11:22:24
# @Last Modified by: Mr.Jhonson
# @Last Modified time: 2017-08-22 23:45:00
def get_number(s):#用异常去处理,这是传入参数的异常
try:
float(s)
except ValueError:
return False
else:
return True
s = "+ 1"
print(get_number(s... |
992,207 | 2008a41d93b650d87436b40b7202f5e87a83de6f | import cv2
import numpy as np
Video = cv2.VideoCapture('wild.mkv')
x, f1 = Video.read()
x, f2 = Video.read()
while Video.isOpened():
differenceOfFrames = cv2.absdiff(f1, f2)
grayFrame = cv2.cvtColor(differenceOfFrames, cv2.COLOR_BGR2GRAY)
blur = cv2.GaussianBlur(grayFrame, (5, 5), 0)
_, thresh = c... |
992,208 | 99e39f979c637027c54b1991a5f6555964d125e7 | def parse_selector(selector):
rpl = selector & 0b11 # requested privileges level
ti = (selector >> 2) & 1 # table indicator
index = selector >> 3 # descriptor index
print(hex(selector) + ': ' + privileges(rpl) + ', ' + table(ti))
def privileges(flags):
privs = {
0: 'ring 0',
1: 'ring 1',
... |
992,209 | 4ce10cbf8f1f8687640a86f6f2f56ab910a1b429 | # -*- coding: utf-8 -*-
from flask import request, redirect, session, jsonify
from database import clouddb
import pandas as pd
import hashlib
import time
import os
import datetime
# import minisql
def add_api_rouer(app):
@app.route('/api/minisql', methods=['GET'])
def minisql():
sql = request.args.get... |
992,210 | 5d4099a38a5048c001d82bef590974dbc1d76841 | #!/usr/bin/env python3
import sys
import time
output_path = sys.argv[2]
input_path = sys.argv[3]
if "I001" in input_path:
print("I crash on example I001!", file=sys.stderr)
exit(1)
if "I002" in input_path:
print("I don't produce output on example I001!", file=sys.stderr)
exit(0)
|
992,211 | 3b92b021d37c501d6126040893620335c792633b | from apispec import APISpec as API_Spec
from apispec.ext.marshmallow import MarshmallowPlugin as Marshmallow_Plugin
from falcon_apispec import FalconPlugin as Falcon_Plugin
from json import dumps
from pathlib import Path
from resource import tags as rc_tags
from utils.string import is_str
__all__ = [
'Spec'
]
cl... |
992,212 | 5aa8521e90f8c747d06b41abfdd4b583c7e192b5 | # Generated by Django 2.2.3 on 2019-08-09 05:46
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('userprofile', '0024_auto_20190804_0155'),
]
operations = [
migrations.RemoveField(
model_name='annotation',
name='annotation... |
992,213 | 809e42ee942c848bb3cdbb11d0aa55aa3230bcb2 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Feb 11 15:53:27 2019
@author: mirjamheinemans
Individual traces of the animals during the whole test
TRAINING columns:
0.
1.MH33,
2.MH33_in_shelter
3.MH33_doorway
4.MH33_with_pellet
5.MH33_eat_pellet
6.MH33_freeze
7.MH... |
992,214 | 2ce8bc334f47e5d88661320175515438c411b929 | from django.contrib import admin
from .models import Varient
admin.site.register(Varient) |
992,215 | d438f139f783c52a6cf74f53c96f73a064f0866b | import struct
from crc import compute
from crc import check
from consts import Consts
class Packet:
def __init__(self, seq_num,is_ack = False,is_valid = True):
self.seq_num = seq_num
self.is_ack = is_ack
self.is_valid = is_valid
self.data_length = 0
@classmethod
def from_b... |
992,216 | 2c4db94d759d42ca712ec8a42ca17d9fcfc2ec8c | #!/usr/bin/env python
# by Samuel Huckins
def main():
"""
Print the ASCII codes for the passed text.
"""
import sys
plain = raw_input("Please enter the plaintext string you want to encode: ")
print "Here are the ASCII codes for that text, space-separated:"
for e in plain:
print ord(... |
992,217 | 70e1a4219ba60bea1226209d8664acf1cd6e6eeb | import math
import os
import random
import re
import sys
debug = True
def swap(s):
k = s.copy()
for ind, v in enumerate(k):
if v == s[0] and ind > 0:
break
k.pop(ind)
k.pop(0)
return k, ind - 1
def MinSwap(s):
if len(s) % 2 != 0:
return "Error"
elif len(s)... |
992,218 | ca5417c3f2c299c69bb5a1b0bd8db0337560faad | ####### this is the first project of cv#######
################### VIRTUAL PAINT ##################
import cv2
import numpy as np
frameWidth = 640
frameHeight = 480
cap = cv2.VideoCapture(0)
cap.set(3,640)
cap.set(4,480)
cap.set(10,100)
myColors = [[0,53,51,255,0,255],
[133,56,0,159,156,255],
... |
992,219 | fdc090133da4b769acc75af4860cda5bdb95b94b | # -*- coding: utf-8 -*-
# Generated by Django 1.11.10 on 2018-03-27 07:38
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('pis_retailer', '0001_initial'),
]
... |
992,220 | da8074eb94f3a29e996dd77fe02e89d977b4a909 | from __future__ import unicode_literals
from django.db import models
from django.utils import timezone
from django.contrib.auth.models import User
# Create your models here.
class Post(models.Model):
author=models.ForeignKey(User)
title=models.CharField(max_length=120,blank=True,null=True)
text=models.T... |
992,221 | 9bcaf2f5ca2dfa0881ffe9f1eec814d2bf69b390 | import pymysql
import os, sys
from datetime import date
import queries
# table prefix permits script to be run repeatedly with results confined to namespace
if 'TBLPREFIX' in os.environ.keys():
tbl_prefix = str(os.environ['TBLPREFIX']) + "_"
else:
today = date.today()
tt = today.timetuple()
tbl_prefix... |
992,222 | 85a5da167fdc01a2286f082b92b892daac4ef4ec | # -*- coding:utf-8 -*-
"""
Handle the image
"""
from scipy import misc
import numpy as np
def zip_block(block_img):
"""Zip the image block to a vector."""
rows = block_img.shape[0]
cols = block_img.shape[1]
zip_vector = []
for i in range(cols):
zip_vector = zip_vector + block_img[:, i].tol... |
992,223 | 165d280cc4c2396ed18885b7169894749746eec2 | # Generated by Django 2.2.14 on 2020-07-14 09:55
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('mainapp', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='entity',
name='doc_delivered',
... |
992,224 | 5351a735b2fce76575130d7a1ed09a5dc7bca97f | from django.shortcuts import render,redirect
from .models import *
from .forms import *
from .filters import *
# Create your views here.
def index(request):
tasks = Task.objects.all()
taskform = TaskForm()
search = SearchForm(request.GET,queryset=tasks)
tasks = search.qs
if request.method =="POST"... |
992,225 | 0c1aa592d5d982634f9c8971e14be28e136053e9 | import torchvision.models as models
print(models.) |
992,226 | 1b19dda061a5321edb4dbbf0eb2a9b74476151c5 | import pandas as pd
if __name__ == '__main__':
df = pd.read_csv('segment.dat', sep=' ', header=None)
df.columns = [
'region-centroid-col',
'region-centroid-row',
'region-pixel-count',
'short-line-density-5',
'short-line-density-2',
'vedge-mean',
'vegde-s... |
992,227 | d982ea6af68a3b3df03eb4884d902422687ea13c | def utasok():
a = [1, 2, 3]
for ertek in a:
yield ertek
yield ertek * 2
x = utasok()
for utas in x:
print(utas)
def kipakol():
hozott_termek = {"udito": 12, "torta": 4, "kave": 20, "harcsa": 50}
for key in hozott_termek:
yield key, hozott_termek[key]
for termek, darab ... |
992,228 | 1fea94822a33d589a6b598e49ee3f6642ade7543 | # We need to import `request` to access the details of the POST request
# and `render_template`, to render our templates (form and response).
# We'll use `url_for` to get some URLs for the app in the templates.
from flask import Flask, render_template, request, url_for
import unicodecsv
import random
import os
import ... |
992,229 | 7e79d10586fc5d4283f3c288cb6543d79100e4ca | """
模糊操作:均值模糊,中值模糊,自定义模糊
基于离散卷积,定义好每个卷积核,不同卷积核得到不同的卷积效果,模糊是卷积的一种表象
"""
from numpy import *
import cv2 as cv
import numpy as np
#定义添加椒盐噪声的函数
def SaltAndPepper(src,percetage):
SP_NoiseImg=src
SP_NoiseNum=int(percetage*src.shape[0]*src.shape[1])
for i in range(SP_NoiseNum):
randX=random... |
992,230 | abd3c73b67fab91cffff4a6242243624a012da34 | '''
>>> userList = createUserList()
>>> movieList = createMovieList()
>>> numUsers = len(userList)
>>> numMovies = len(movieList)
>>> [rLu, rLm] = createRatingsList(numUsers, numMovies)
>>> [0.99 < similarity(i, i, rLu) < 1.01 for i in range(1, numUsers+1)].count(True) == numUsers
True
>>> [-1.01 < similarity(1, i, rLu... |
992,231 | ade77569afd0dba1decff56dbcb6785f13b600f1 | num1 = int(input('Digite um número:'))
num2 = int(input('Digite outro número:'))
num3 = float(input('Digite mais um número:'))
a = (2*num1)*(num2/2)
b = (3*num1) + (num3)
c = num3**3
print("O produto do dobro do primeiro com metade do segundo: ", a)
print("A soma do triplo do primeiro com metade do segundo: ... |
992,232 | 44c18e15203286bc9ebe753f26c06155ddc7ce7b | import os
import numpy as np
from sklearn.cluster import KMeans
from scipy.stats import norm
import pickle as pkl
class NDB:
def __init__(self, training_data=None, number_of_bins=100, significance_level=0.05, z_threshold=None,
whitening=False, max_dims=None, cache_folder=None, stage=-1):
... |
992,233 | 06f69784f98af46a8c2706f9040c8db2df577ae2 | """
Function:getRatioUnstruct - creates statistics of the occurence of Pfam domains
in the ChEMBL database as well as the entire human genome
--------------------
Author:
Felix Kruger
momo.sander@googlemail.com
"""
def getRatio(pfamDict,humanTargets, release... |
992,234 | 4ba94a218e24607572cc4519597fbc45403a5a26 | def ndigits(integer):
'''
Given an integer, it calculates finds out how many digits
the integer have.
'''
assert integer%1 == 0 #Confirms it is integer
integer = abs(integer) #sign is not relevant
if int(integer/10) == 0: #if it is a single number
return 1
else:
reducedInteger = ... |
992,235 | 6afa2324a06c88fc520edc0b732f70344e63979f | toDecode = list(input())
k = int(input())
asciiNums = list()
codedList = list()
el = []
for i in toDecode:
el.append(toDecode)
for x in el:
if [el] % 2 == 0:
asciiNums.append(ord(x))
decodedList = [el+k for el in asciiNums]
for nums in decodedList:
codedList.append(chr(nums))
codedString = ''.j... |
992,236 | 2653bbe6931cd6aae72cda96cbf7aa319cfc884d | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""This example script demonstrates the Gulliver suite's ability to
reconstruct events with gradient based minimizers.
"""
from __future__ import print_function
import os
import icecube.icetray
import icecube.dataclasses
import icecube.dataio
import icecube.gulliver
impo... |
992,237 | c2cc10e6986d23244b37b830524fae9a35dd1656 | # -*- coding: UTF-8 -*-
"""
Created on 2017年11月10日
@author: Leo
"""
class DataValidate:
# 校验是否为数字
@staticmethod
def is_int(data):
if isinstance(data, int):
return {"status": True, "data": data}
else:
return {"status": False, "data": data}
# 校验是否为字符串
@stati... |
992,238 | afaa665c415289a922b187cbe243ecde1a587af1 | from yelp.client import Client
from yelp.oauth1_authenticator import Oauth1Authenticator
import os
from dotenv import load_dotenv, find_dotenv
load_dotenv(find_dotenv())
auth = Oauth1Authenticator(
consumer_key=os.environ['YELP_CONSUMER_KEY'],
consumer_secret=os.environ['YELP_CONSUMER_SECRET'],
token=os.e... |
992,239 | e99888527ec3d892224102abe115e93908694462 | from pylab import *
import pyqtgraph.opengl as gl
from pyqtgraph.Qt import QtCore, QtGui
import pyqtgraph as pg
from matplotlib import cm
from scipy.signal import butter, lfilter
print('load_data')
## Surface
verts = np.load('pyqt_data/verts.npy')
faces = np.load('pyqt_data/faces.npy')
centres = np.loadtxt('pyqt_dat... |
992,240 | 6c70ec5800b2d376aa6606e30cd53c5d898c8670 | def findOri (text):
skew = [0]
genome = text
minimum = []
#print (skew[0])
for i in (range(0, len(text)+1)):
#print(skew[i])
if genome[i] == ("A" or "T"):
skew.append(skew[i])
elif genome[i] == "G":
skew.append(skew[i]+1)
#skew += 1
elif genome[i] == "C":
skew.append(skew[i]-1)
#skew -= 1
... |
992,241 | 7bfed937bea33492b6e11f944c027eba4947a867 | from __future__ import print_function
import sys
import numpy as np
import matplotlib.pyplot as plt
from robolearn.old_utils.iit.iit_robots_params import *
from robolearn.old_envs import BigmanEnv
from robolearn.old_agents import GPSAgent
from robolearn.old_policies.policy_opt.policy_opt_tf import PolicyOptTf
from r... |
992,242 | 2ee3cdaadd60b750c3a3ad48fdf91b09e777b76d | from torch.utils.data import DataLoader
from data.datasets import uwdataset, collate_fn, mmvaldataset, uiebvaldataset
from utils.visual import get_summary_writer, visualize_boxes
from tqdm import tqdm
from mscv import write_meters_loss, write_image
from models.det.faster_rcnn import Model as det_Model
from models.resto... |
992,243 | d4034f94ca7da18de430a4008b6c88866c5ec43c | '''
Write a Python program to delete the smallest element from the given Heap and then inserts a new item.
'''
import heapq
l=[4,3,6,2,1,6,7,4,10,93,21,34]
heapq.heapify(l)
heapq.heapreplace(l,0)
print(l) |
992,244 | dc9e476910288c122adb5e6a255aadd6fc2f28ee | """
Patterns for identifying green technologies in text descriptions such as patent abstracts.
Follows Shapira et al. (2014) p.102 http://dx.doi.org/10.1016/j.techfore.2013.10.023
"""
import re
def pattern01_general(text):
if re.search(re.compile(r"\bsustainab\w*\b", flags=re.I), text):
return True
i... |
992,245 | a213bc74d490f62f20286dd8dd6c6d666636cf03 | times=('Corinthians','São paulo', 'Flamengo','Cruzeiro', 'ATLÉTICO MINEIRO','Inter',
'Grêmio','Santos','Palmeiras','Goias','Curitiba')
print("=x"*10)
print('TABELA')
print("=x"*10)
for t in times:
print(t)
print("=x"*10)
print('4 PRIMEIROS ')
print("=x"*10)
for t in times[0:4]:
print(t)
print("=x"*1... |
992,246 | 51e221493ada278e7d8203c1a5a691519405e4c0 | def print_name():
age = 33
first_name = "Simcha"
#Comment
#print and str and built in fun
print(first_name + " is " + str(age))
print_name()
|
992,247 | 891abe0a82ba61bbdf58c6a7703b6cad5e8178a8 | import sys
import numpy as np
def main():
script = sys.argv[0]
action = sys.argv[1]
filenames = sys.argv[2:]
assert action in ['--min', '--mean', '--max', '--sum'], \
'Action is not one of --min, --mean, --sum or --max: ' + action
if len(filenames) == 0:
process(sys.stdin, actio... |
992,248 | 59f66ce6e51e96b8b0ae5cf8cad550504d867011 | #!/usr/local/bin/python3
import cgi
print("Content-type: text/html")
print('''
<!DOCTYPE html>
<html>
<head>
<title>Resources</title>
</head>
<body>
<h1>Resources</h1>
<ul><a href="python.py">Python</ul>
<ul><a href="linux.py">Linux</ul>
</body>
</html>
''')
|
992,249 | 74cb44d04109699974271599445f217f229902f9 | import tkinter as tk
def builder(page, cid):
cache = page.components[cid]
master = cache["master"]
padding = cache["padding"]
config = cache["config"]
# container
frame = tk.Frame(master)
frame.pack(side=config["side"], anchor=config["anchor"],
padx=padding[0], pady=padding[... |
992,250 | a5e0e39003b9f696da37726ca05332c2ed7b2aa7 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Read temperature and humidity from living room"""
from kavalkilu import LogWithInflux
from pitools import Sensor
from pitools.peripherals import PiGarage
logg = LogWithInflux('garage_temp', log_dir='weather')
sensor = Sensor('DALLAS', serial=PiGarage.dallas.sn)
# Tak... |
992,251 | f09bedafdd65c3fd4c5be88e3f0e1585d32cdcfb | #!/usr/bin/env python
from distutils.core import setup
import py2exe
setup(
options = {
'py2exe': {
'dll_excludes' : ['msvcr71.dll', 'w9xpopen.exe'],
'compressed' : 1,
'optimize' : 2,
'ascii' : 1,
'bundle_files' : 1,... |
992,252 | 457c31a16d08bafe0d3ce4c97f0c83a333ea30a1 | import webbrowser
from time import sleep
while True: # This keeps the program going until you press 'q'
user = input('''
~~~~~~WEBSITES~~~~~~
[G]oogle
[Gi]thub
[F]lat.io
[O]ffice 365
[C]anvas
[S]kyward
[T]eams
[Q]uit
>>> ''') # This is what the user gets prompted. This is in charge of what website will open
''' This... |
992,253 | 09135321567ca71d147730f0b47897ab90d113e6 | import curses, time
''' more text animation
>>> stdscr = curses.initscr()
>>> dims = stdscr.getmaxyx() 'return a tuple (height,width) of the window'
row = 0,1,2,...,24
col = 0,1,2,...,79
>>> stdscr.addstr(row,col,'text',curse.A_REVERSE)
>>> stdscr.nodelay(1) 'If yes is 1, getch() will be non-blocking.'
'''
f... |
992,254 | dfa6683c93c08d21cdd45c98ba6d384b4da1b27a | """
Given an integer array nums of unique elements, return all possible subsets (the power set).
The solution set must not contain duplicate subsets. Return the solution in any order.
"""
n = list(map(int, input().split(',')))
res = [[]]
for i in n:
res += [x + [i] for x in res]
print(res)
|
992,255 | 800177dd16111bce3504687a0634c2917445818b |
import argparse
from PIL import Image
def asci(text):
ntext = []
for char in text:
ntext.append(format(ord(char), '08b'))
return ntext
def pixelgen(pic, text):
lentext = len(text)
piciter = iter(pic)
bintext = asci(text)
for i in range(lentext):
pixels = [ value for... |
992,256 | 2f5a6ca7e418b9aa391f3683eac446293e412fe2 | from src.main.backend.models.Kingdom import Kingdom
from typing import List
class Ruler(Kingdom):
""" A class to model a ruler.
"""
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.__allies = list()
def add_ally(self, ally: Kingdom):
self.__allies.a... |
992,257 | 70b9586dfd114bfc00deff2bfea390973e39e0b9 | from django.conf.urls import patterns, include, url
from django.contrib import admin
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'simplesite.views.home', name='home'),
# url(r'^blog/', include('blog.urls')),
url(r'^admin/', include(admin.site.urls)),
url(r'^$', 'simplesite.views.home', nam... |
992,258 | 38a56dd394ae4e418f0aeb3276c0effc412da612 | """
Various column classes
@author: Martin Kuemmel, Jonas Haase
@organization: Space Telescope - European Coordinating Facility (ST-ECF)
@license: Gnu Public Licence
@contact: mkuemmel@eso.org
$LastChangedBy: mkuemmel $
$LastChangedDate: 2008-07-03 10:27:47 +0200 (Thu, 03 Jul 2008) $
$HeadURL: http://astropy.scipy.org... |
992,259 | bfb013a43669791a35b729e95de17319bc443c36 | # -*- coding: utf-8 -*-
# 455139656:AAE9id16VLNGI8gz4dBtCSs2WE8Jp1zsu1k
import threading
import telebot
from telebot import types
from event.EventStorage import read_all_events
from event.EventStorage import save_events
from user.User import User
from user.UserStorage import read_all_users, save_user
bot = telebot.Tel... |
992,260 | d65e0a180f7a67ac9ceb831aafec7a251d23b59f | from turtle import *
def hinhvuong(solan, dodai):
right(90)
for i in range (solan*4):
forward(dodai)
left(90)
dodai = dodai +2
speed(-1)
bgcolor("green")
color("blue")
hinhvuong(20,10)
|
992,261 | 48f9cc4932f4ca05f9c73990f68f569f000c3aaa | #!/usr/bin/env python
from check_splunk import CheckSplunk
import sys
SPLUNK_SERVER = sys.argv[1]
SPLUNK_USERNAME = sys.argv[2]
SPLUNK_PASSWORD = sys.argv[3]
try:
SPLUNK_POOL = sys.argv[4]
except:
SPLUNK_POOL = 'auto_generated_pool_enterprise'
WARN_PERCENT = 75
CRIT_PERCENT = 90
args = [
"-H", SPLUNK_SERVER... |
992,262 | 264c7c0db070ade8eb70290b9e476d012191c6b2 | from django.urls import path
from . import views
urlpatterns = [
path('', views.home, name='home'),
path('about/', views.about, name='about'),
path('accounts/signup/', views.signup, name='signup'),
path('accounts/signup/vintner', views.VintnerSignUpView.as_view(), name='vintner_signup'),
path('acco... |
992,263 | 74d7afb000f5b4e5827dcd2ee79301d7c211a547 | #!/usr/bin/env python
import os
import sys
from six.moves import input
from vimapt import Extract
class Make(object):
def __init__(self, work_dir):
current_file_dir = os.path.dirname(os.path.abspath(__file__))
self.tpl_file = os.path.join(current_file_dir, 'data', 'vimapt.vpb')
self.wor... |
992,264 | 386b4e1f0ed9ac52ebee78d9387e583db9677750 | '''
세로로 잘리는 위치, 가로로 잘리는 위치 저장을 위한 리스트 생성, 0(시작점)을 미리 넣어둠
가로인지 세로인지에 따라서 가로리스트, 세로리스트에 저장
마지막 점을 리스트에 추가.
가로, 세로 리스트 정렬.(sort)
가로/세로 리스트의 두 점의 거리 (절대값(첫번째-두번째))를 구함.
그 중에서 최대값을 구하고 각각 곱하면 정답.
'''
# N,M=map(int,input().split()) #가로,세로 크기
# dot=int(input()) #점선 개수=자르는 횟수
# Narr=[0]
# Marr=[0]
# for x in range(dot): #세번째줄부... |
992,265 | 6481bde185e5f13f47d8790dd789cc0229463a8a | """ Load David Khatami's model """
import numpy as np
def load():
modeldir = "/Users/annaho/Dropbox/Projects/Research/ZTF18abukavn/data"
model = np.loadtxt(modeldir + "/2018gep_csm_model.dat")
mod_dt = model[:,0]
mod_lum = model[:,1]
mod_rad = model[:,2]
mod_temp = model[:,3]
return mod_dt... |
992,266 | 3d92325d698e68f984d112df2ad6c7eacdd82c14 | #!/usr/bin/python3
from __future__ import print_function
import argparse
import requests
from requests_kerberos import HTTPKerberosAuth
from requests import conf
TEMPLATE = """
On {freshmaker_date}, Freshmaker rebuilt {original_nvr} container image [1] as a result of Important/Critical RHSA advisory [2].
It seems th... |
992,267 | f1172defa62805334990d0c51405e1f3ee5a1bb1 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
#Calculamos el precio de la reserva y de la limpieza en función del número de huéspedes, de habitaciones y de noches:
def get_booking_price(personas, habitaciones, noches):
if personas == 1 and habitaciones == 1:
... |
992,268 | 1c8814e9e4157537c492ae61821f494df6d96bf4 | #-*- coding: utf-8 -*-
import json
import socket
import os
import logging
import logging.handlers as ih
from redis import StrictRedis
from img.imagesaver import ImageSaver
from sqlalchemy import engine, MetaData, create_engine
root_dir = os.path.dirname(os.path.realpath(__file__))
if socket.gethostname() == "spider... |
992,269 | 68ce07e0d0487501b756d16f509359df843d5de5 |
def fib(max):
a,b,n = 0,1,0
while True:
if n<max :
a, b = b, a + b
yield a
n += 1
else:
break
f = fib(10)
for i in range(10):
print(f.__next__()) |
992,270 | 612d48d10c2bd7dac653bbc79cd032db4f5eac0b | '''
Created on 26/09/2018
@author: ernesto
'''
# XXX: http://codeforces.com/contest/1040/problem/B
if __name__ == '__main__':
n, k = [int(x) for x in input().strip().split(" ")]
tam_seccion = min((k << 1) + 1, n)
num_secciones = n // tam_seccion
sobrante_secciones = n % tam_seccion
puntos_de_volte... |
992,271 | 0dc55006bb8a6a672a4b0bab7f121e60a3d7b8a7 | from selenium.webdriver.common.by import By
class MainPageLocators():
LOGIN_LINK = (By.CSS_SELECTOR, "#login_link")
class LoginPageLocators:
LOGIN_FORM = (By.CSS_SELECTOR, ".login_form")
REGISTER_FORM = (By.CSS_SELECTOR, ".register_form")
INPUT_EMAIL = (By.CSS_SELECTOR, "#id_registration-email")
... |
992,272 | 599d9a36c2a89436c8cdc9c82720e0bae6f5a282 | from json import JSONDecoder, dumps
with open("example_pretty.json", "r") as f:
z = JSONDecoder().decode(f.read())
#for k, v in z.iteritems():
# print k, "::", v
output = []
results = z['feed']['entry']
for result in results:
output.append({})
z = output[-1]
z['vidname'] = result['title']['$t']#.en... |
992,273 | 63076920c0461a56ec71d91b704cb1f9856a82ec | from subprocess import Popen
import time
from sys import argv
sources = ["galsim_bright", "galsim_dimmer", "pts_bright", "pts_dimmer"]
filters = ["sex2_1.5", "sex2_2", "sex2_4", "sex4_1.5", "sex4_2", "sex4_4"]
for ss in sources:
for ff in filters:
print("-------------------------------------------------... |
992,274 | 73986a9b8e80c0df10b5a6522ccc0278561f7a9b | def test():
print("this is a item module") |
992,275 | 75dc66b3a858dc13112d75e398bb6f3f0e39b2ff | def inicio():
opcion = 0
personas = []
id = 1
while opcion < 5:
print(" ------------------------------------")
print(" -Que acción deseas realizar -")
print(" -1. Agregar nuevo usuario -")
print(" -2. Editar un usuario -"... |
992,276 | 70ce59992d045c6e32d43ceae7cd804258c4e0ea | # -*- coding: utf-8 -*-
'这是数据对象的学习'
#type(parm) 判断对象,变量的类型
#import types 使用types模块
#isinstance(),判断class对象继承与那个类,同样适用于普通变量
#dir()函数,获得一个对象的所有属性和方法
#len(),获取一个对象的长度
#str.lower() 返回小写的字符串 |
992,277 | 76314c1f38ac29ab916b2da29cd7b18176136f62 | __author__ = 'Cjj'
from scrapy.cmdline import execute
execute() |
992,278 | bd7e53c337079d3b671402f0b7d49e8428ab2701 | temp = n = int(input())
check = 0
while(True):
ten = temp//10
one = temp%10
res = ten + one
check += 1
temp = int(str(temp%10)+str(res%10))
if(n == temp):
break
print(check) |
992,279 | ae2b16e0093d9de821923fb52f4c11aa082cf084 | #
#Test branch
##
#
#
# This is a sample Python script.
# Press Shift+F10 to execute it or replace it with your code.
# Press Double Shift to search everywhere for classes, files, tool windows, actions, and settings.
# import MAC_01
# import Search_SN
import Input_SN_BOX
# import PLC
# import Mail_send_Test
# import ... |
992,280 | 1c9154c8db4a80397eb95294a8a71b01270574b7 | from flask import Flask
app = Flask(__name__)
# Add any other Flask app configurations here . . .
from getting_started import views |
992,281 | a1eb77d6e9d7bfcfe1d86f3fdc87298c5c318b17 | from fivePro import *
import pygame as pg
class FivePlay():
def __init__(self, sd, addr):
self.sd = sd
self.addr = addr
self.isRecv = False
def quit(self, e):
if e.type == pg.QUIT or e.type == pg.KEYDOWN and e.key == pg.K_ESCAPE:
self.sd.sendto("quit".encode(), sel... |
992,282 | f1222646a47e45abc65f65e0080912480df850cc | a=int(input())
for i in range(2,a+1):
while(a!=i):
if(a%i==0):
print(i)
a=a/i
else:
break
print(a)
|
992,283 | 0aae9319d66cd29bd7e3e53a2e9a66e6aa78b0da | #----------------------------------------------------------------------------------------
# Process RefSeq data files
#----------------------------------------------------------------------------------------
import os
import numpy as np
from pathlib import Path
from text_tools import parse_refSeq_fasta, merge_refSeq_s... |
992,284 | 686a3e42bfd497d73ad5b941053b7b0f562e0eda | import unittest
import requests
import sys
sys.path.append("..")
from commen.assertions import JsonResonseValidate
from commen.generate_data import Data
class ApiTest(unittest.TestCase):
def setUp(self):
self.data = Data()
# self.url = 'http://qa-no-services.thebump.com/core/v1/hbib'
# self... |
992,285 | 253261e6687cc4eb4140aff7e6126c04552d10be | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#dict使用的小demo
#通过学号查找姓名
d = {1:'zhou', 2:'bart', 3:'gemini', 4:'minami'}
n =int(input('请输入学号:'))
if n in d:
print('%d号对应的学生姓名为%s:'%(n,d[n]))
else:
print('查无此号')
|
992,286 | 9b90c7e439886a93c24187a2ba6e3e82a7d3c86c | # -*- coding: utf-8 -*-
"""Wide Residual Network models for Keras.
# Reference
- [Wide Residual Networks](https://arxiv.org/abs/1605.07146)
"""
from __future__ import print_function
from __future__ import absolute_import
from __future__ import division
import warnings
from keras.models import Model
from keras.laye... |
992,287 | 70c9d6c5893a02aed589f0cc752aee464b6b281d | import functools
import json
import multiprocessing
import sys
import threading
import traceback
import ansimarkup
class StrRecord(str):
__slots__ = ("record",)
class Handler:
def __init__(
self,
*,
writer,
stopper,
levelno,
formatter,
is_formatter_dy... |
992,288 | f3780c984f6907e5e5ae62e25e91b7c7bdce35c0 | import random
import pygame
from pygame.locals import *
import copy
board = [[7, 8, 0, 4, 0, 0, 1, 2, 0],
[6, 0, 0, 0, 7, 5, 0, 0, 9],
[0, 0, 0, 6, 0, 1, 0, 7, 8],
[0, 0, 7, 0, 4, 0, 2, 6, 0],
[0, 0, 1, 0, 5, 0, 9, 3, 0],
[9, 0, 4, 0, 6, 0, 0, 0, 5],
[0, 7, 0, 3, ... |
992,289 | 73b674f6d07d4ef58d4e36ef3d93172155c38903 | from django.urls import path
from . import views
app_name = 'account'
urlpatterns=[
path('',views.user_login,name='login') , #由主程的映射引导进来,所以,这里为空就可以了
path('logout/',views.user_logout,name='logout'),
path('register/',views.register,name='register'),
path('my-information',views.Myself,name='my-informatio... |
992,290 | e75e4950eef3f3dcd38ef5e444bc41d6fa196a51 | def on_gesture_shake():
basic.show_icon(IconNames.YES)
music.play_melody("G A B C5 C5 B A G ", 120)
input.on_gesture(Gesture.SHAKE, on_gesture_shake)
|
992,291 | a47a105b1e163da8e4079c63e0ed9d3959ee1e93 | from brownie import Contract
from cachetools.func import ttl_cache
from yearn.cache import memory
from yearn.multicall2 import fetch_multicall
from yearn.prices import magic
@memory.cache()
def is_balancer_pool(address):
pool = Contract(address)
required = {"getCurrentTokens", "getBalance", "totalSupply"}
... |
992,292 | ea07d2ee7cd00bb061aff912c4edf380a226eaa2 | from django.forms import ModelForm
from django import forms
from .models import Data
class DateInput(forms.DateInput):
input_type = 'date'
class Form(ModelForm):
class Meta:
model = Data
fields = ['name','reports', 'team_lead','hours', 'today_progress','today_doc', 'concern', 'next_plan', 'ne... |
992,293 | 21b60b38f049f070824867340c569165fd4e0cc1 | """ Contains the reward functions used to compute the instant and terminal rewards for an EV Trip Scheduler.
"""
class SimpleRewards:
def ComputeTimeReward(self, currentTime, expectedTime):
""" Computes a reward for a given time step.
The reward is negative if the current time step is... |
992,294 | e2a5670462444a05419042b14c4a9a78789073f7 | import random
import string
from dataclasses import is_dataclass
from haproxy.collections import Collection
from haproxy.dataclasses import Proxy, Frontend
class TimeSeries(Collection):
def __aggregate__(self, field):
if not self._items:
return None
else:
values = (getattr... |
992,295 | 732c9ae54ed2cf2caf65dade6f45af3d9317e60a | ## Class Living Thing Factory
# Uses reflection to create instances of living things
# Requires that classes have the same name as the import they
# come from
class LivingThingFactory():
def __init__(self):
pass
##Create life method
#@param name name of the class to create.
#@param ret... |
992,296 | ddc5a651bf9b0a61c74396db282b7e21b39fbf78 | import string
import random
import requests
class GameFlask:
def __init__(self):
self.grid = self.random_grid()
def random_grid(self):
return ''.join(random.choice(string.ascii_uppercase) for i in range(3))
def is_valid(self, word):
if self.grid == word:
return True
... |
992,297 | 79806d5cc1c6685745bb7f866452c2cba49b75ee | # -*- coding: utf-8 -*-
import pymysql
import scrapy
from hongkong.items import HongKongHtmlFileItem
class DocumentFileDownloadSpiderSpider(scrapy.Spider):
'''document type 类型文件的下载'''
name = 'HKEX_document_file_download_spider'
allowed_domains = ['hkex.com']
start_urls = ['http://hkex.com/']
def... |
992,298 | f68a56f66d13cb4fac56f0d0818428c1ceb2d759 | from bson.json_util import dumps
from flask_pymongo import PyMongo
from bson.objectid import ObjectId
from bson import json_util
import logging
from flask import jsonify, Blueprint, request, current_app, Response, jsonify
from werkzeug.security import generate_password_hash, check_password_hash
from ..Database.CRUD imp... |
992,299 | bcd316fd8d4a8e6d4b72f2b5c73a3ee9003683dd | import PySimpleGUI as sg
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import time
from tqdm import tqdm
sg.theme('TealMono')
layout =[ [sg.Image(r'C:\Users\Irina\Desktop\practice\Intuit.png')],
[ sg.Text('Программа для закачки курса INTUIT')],
[ sg.Button('Ввод ссылки и... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.