index int64 0 1,000k | blob_id stringlengths 40 40 | code stringlengths 7 10.4M |
|---|---|---|
1,900 | 1219f7b7ac335f3a69e289d1ab2b6318a2aef23f | #!/usr/bin/env python3
import sys
import hashlib
# Usage
if len(sys.argv) != 2:
print("usage: part2.py puzzle_input")
exit(1)
# Get Secret
puzzle_input = sys.argv[1]
input_num = 0
# Calcuate
for i in range(sys.maxsize):
digest = hashlib.md5(puzzle_input.encode('utf-8')+str(i).encode('utf-8')).hexdigest()
if (d... |
1,901 | 6743a4f3c9118e790e52b586a36d71a735101702 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
from alipay.aop.api.domain.EpInfo import EpInfo
from alipay.aop.api.domain.EpInfo import EpInfo
from alipay.aop.api.domain.EpInfo import EpInfo
from alipay.aop.api.domain.EpInfo import EpInfo
from alipay.aop.... |
1,902 | 9e950f6fe895cfd497e94139397e8a0f19725dc0 | """lendbooks URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.10/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-... |
1,903 | b76b188dc77077ae70f320d01e9410d44b171974 | # Ömer Malik Kalembaşı 150180112
import numpy as np
import matplotlib.pyplot as plt
fig = plt.figure()
img = plt.imread("clown.bmp")
u, s, v = np.linalg.svd(img)
zeros = np.zeros((200, 320))
for i in range(200):
zeros[i, i] = s[i]
for n in range(1, 7):
r = 2**i
p = np.dot(u, zeros[:... |
1,904 | b68cc09347584dfc613b2e38d036b124c9af7952 | import csv
import tweepy
import pandas as pd
####input your credentials here
from tweepy.auth import OAuthHandler
auth = OAuthHandler('WNUpykrIjiGF0NKoV7qk7uiNj', 'Nhe0GjOkbaQKbPMLTqcAYQnqMnz3Edpdup28h2R2KqRLa6iBDN')
auth.set_access_token('956917059287375875-EThit80MxgQPTJlh7ZObqyHsoV8Q2D7', 'eLv893meGppqfX3xOr8SJ93kps... |
1,905 | 4ba722e685c7608fcfd5111131c96847c0408a02 | import wfdb as wf
import numpy as np
from scipy import signal as ss
from datasets import mitdb as dm
from matplotlib import pyplot as plt
def show_path(path):
""" As a plot """
# Read in the data
record = wf.rdsamp(path)
annotation = wf.rdann(path, 'atr')
data = record.p_signals
cha = data[:, 0... |
1,906 | efbfe95acbe0b97e863c8788bca4a71633da36b3 | from datetime import datetime
class Location:
def __init__(self, location_dict):
self.x = location_dict['x']
self.y = location_dict['y']
self.id = location_dict['id']
self.events = []
self.latest_average_value = 0
self.latest_event_count = 0
self.average_... |
1,907 | 6c2699ff8e739595a2648d53745dc3c788536d7b | # Q. In How many ways N stair can be climb if allowesd steps are 1, 2 or 3.
# triple Sort
def noOfSteps(n, k):
if n<0: return 0
if n == 0: return 1
t_steps = 0
for i in range(1, k+1):
t_steps += noOfSteps(n-i, k)
return t_steps
def noOfStepsDP(n,k):
dp = [0]*max((... |
1,908 | c7f26978333c7e6cccf7451ea5d10511a66b62c2 | import base64
code=b'CmltcG9ydCBweW1vbmdvCmltcG9ydCByYW5kb20KaW1wb3J0IHJlCmltcG9ydCBzdHJpbmcKaW1wb3J0IHN5cwppbXBvcnQgZ2V0b3B0CmltcG9ydCBwcHJpbnQKCiMgQ29weXJpZ2h0IDIwMTUKIyBNb25nb0RCLCBJbmMuCiMgQXV0aG9yOiBBbmRyZXcgRXJsaWNoc29uICAgYWplQDEwZ2VuLmNvbQojCiMgSWYgeW91IGFyZSBhIHN0dWRlbnQgYW5kIHJlYWRpbmcgdGhpcyBjb2RlLCB0dXJuIGJ... |
1,909 | fee2ddca5888c9db00d2d7a4fe11ba20c4e31685 | import random
import json
import os
from pico2d import *
import game_framework
import game_world
import menu_world
import game_state
from Start_menu import Menu
name = "MenuState"
boy = None
Start_menu = None
menu_time =None
def enter():
global Start_menu
Start_menu = Menu()
menu_world.add_object(Start... |
1,910 | 8ebf031cb294c69bf744d543b18783d6ac5ef257 | import sys
INF = sys.maxsize
def bellman_ford(graph,start):
distance = {}
predecessor = {}
# 거리 값, 이전 정점 초기화
for node in graph:
distance[node] = INF
predecessor[node] = None
distance[start] = 0
# V-1개마큼 반복
for _ in range(len(graph)-1):
for node in graph:
... |
1,911 | cda7595e46528739cad49a5d62a80bc7b2087157 | import math
class Point:
def __init__(self, x:int, y:int):
self.x = x
self.y = y
def create_point(self):
point = [self.x, self.y]
return point
@staticmethod
def calculate_distance(point_1:[], point_2:[]):
side_a = abs(point_1.x - point_2.x)
side_b = ab... |
1,912 | 1a78d9e0807824263fd46547d5b75c61610456d4 | import cv2
import numpy as np
LOWEST_MATCHES_NUMBER = 30
sift = cv2.xfeatures2d.SIFT_create()
bf = cv2.BFMatcher();
train_img = cv2.imread('Photo/demo2.jpg', 0)
train_kp, train_desc = sift.detectAndCompute(train_img, None);
camera = cv2.VideoCapture(0);
while (True):
det, frame_with_color = camera.read();
f... |
1,913 | 88f5aa56eca6b61ba2b428bff0efdf4ec7f5f5d9 | import io
import os
from setuptools import setup
setup(name='testcov-plugin',
version='1.0',
packages=['testcov'],
namespace_packages=['testcov'],
entry_points={
'plugins': ['testp = testcov.plugin:testp'],
},
description="Test for coverage bug")
|
1,914 | bcab83e0ae6ee4925393b50bdefdfeb85c42ad2c | import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from email.header import Header
class SENDMAIL(object):
def __init__(self):
self.smtpserver = 'smtp.qq.com'
self.username = 'wu_chang_hao@qq.com' # 比如QQ邮箱
self.password = 'xxxxxxxxx... |
1,915 | 393af07fa7a5c265dbdd3047ef33a77130edf259 | from tkinter import *
global P,M,G,en
P=0
M=0
G=0
en=1
def inicio():
global P,M,G,en
B1=Button(ventana,text="CAJAS PEQUEÑAS",command=A,state="normal",bg="yellow").grid(column=1,row=1)
B2=Button(ventana,text="CAJAS MEDIANAS",command=B,state="normal",bg="orange").grid(column=2,row=1)
B3=Bu... |
1,916 | 65b7a14c54cd988185bac54fd8a31330966f8ba9 | import configparser
# CONFIG
config = configparser.ConfigParser()
config.read('dwh.cfg')
# DISTRIBUTION SCHEMA
schema = ("""CREATE SCHEMA IF NOT EXISTS public;
SET search_path TO public;""")
# DROP TABLES
staging_events_table_drop = ("DROP TABLE IF EXISTS staging_events;")
staging_songs_table_drop = ... |
1,917 | 214aadb7b3fc125da12f098bde87fce295349fdf | #!/usr/bin/python2
#
# Author: Victor Ananjevsky, 2007 - 2010
# based on xdg-menu.py, written by Piotr Zielinski (http://www.cl.cam.ac.uk/~pz215/)
# License: GPL
#
# This script takes names of menu files conforming to the XDG Desktop
# Menu Specification, and outputs their FVWM equivalents to the
# standard output.
#
#... |
1,918 | 4437075901751adeaf3df63345e270a9b0090c14 | import thumt.utils.bleu as bleu
import argparse
parser = argparse.ArgumentParser("Compute sentence bleu.")
parser.add_argument("-pred_path", type=str, required=True)
parser.add_argument("-n_list_path", type=str, required=True)
parser.add_argument("-refer_path", type=str, required=True)
args = parser.parse_args()
n_l... |
1,919 | 07452795a677836b89eef85b6fb25b33eb464d91 | from unittest import mock
import pytest
from lms.models import GroupInfo
from lms.services.group_info import GroupInfoService
from tests import factories
class TestGroupInfoService:
AUTHORITY = "TEST_AUTHORITY_PROVIDED_ID"
def test_upsert_group_info_adds_a_new_if_none_exists(self, db_session, svc, params):... |
1,920 | 7726f8cc9adf15823cccdaa4ba316800bb134460 | """Class for better periodic call handling"""
import tornado
import tornado.gen
import logging
class YieldPeriodicCallback(object):
"""Class for better periodic call"""
def __init__(self, callback, callback_time, io_loop=None, faststart=False):
"""Init method it can be used like tornado periodic callb... |
1,921 | 0545aff80e19e47cb9e5b1941e92ff5cb109f9e6 | from ipyleaflet import Map, DrawControl, Marker, Rectangle
from sentinelhub import BBox, CRS
from ipywidgets import widgets as w
class BBoxSelector:
def __init__(self, bbox, zoom=8, resolution=10):
center = (bbox.min_y + bbox.max_y) / 2, (bbox.min_x + bbox.max_x) / 2
self.map = Map(center=center,... |
1,922 | 1c1673b5e54bafef9f36a2583115f8135c112ab4 | import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
from collections import OrderedDict
from functools import reduce
class ArcTan(nn.Module):
def __init__(self):
super(ArcTan,self).__init__()
def forward(self, x):
return torch.arctan(x) / 1.5708
class Pa... |
1,923 | 8a5ade450485f9114fa91c00c7588535ccbaf0e6 | '''Lab01 ex4
E/16/319 Rathnayake R.P.V.N'''
from dataclasses import asdict
from json import dumps
from dataclasses import dataclass
from typing import List, Dict
import json
import ex1 #import the ex1 to get the lord_course_registraion function
s1=ex1.load_course_registrations("data.txt") #lord the list of Student ... |
1,924 | 294229849dcfac8d4afeab79dae3c652c853fc47 | '''
'Daniel Moulton
'3/24/15
'Implementation of the mergesort sorting algorithm in python.
'Utilizes a series of random numbers as the initial input
'Uses a top down approach to recursively sort the original list and output the final result.
'''
from random import randrange
def mergeSort(original_list):
#initiali... |
1,925 | 2f193cb1eaf7b5e99d20025716a248144af90b92 | """ Classes and functions for generalized q-sampling """
import numpy as np
from dipy.reconst.odf import OdfModel, OdfFit, gfa
from dipy.reconst.cache import Cache
import warnings
from dipy.reconst.multi_voxel import multi_voxel_fit
from dipy.reconst.recspeed import local_maxima, remove_similar_vertices
class General... |
1,926 | 72b086e833ab3ee4ec3102869d74513ef3657675 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Oct 25 19:21:32 2019
@author: Nikos
"""
import torch
import torch.optim as optim
from utilities import *
from model import *
from torch.autograd import Variable
import numpy as np
import random
class A2C_agent(object):
def __init__(self, env, actor_h... |
1,927 | 7ccaa15f025b2c1ba560d07c1a30b06c9ebf9ad1 | r"""
Definition
----------
Calculates the scattering from a **body-centered cubic lattice** with
paracrystalline distortion. Thermal vibrations are considered to be negligible,
and the size of the paracrystal is infinitely large. Paracrystalline distortion
is assumed to be isotropic and characterized by a Gaussian dis... |
1,928 | dab9b58b08b562d902ee0ae1104198cb1ebbffe5 | """
-------------------------------------------------------
Stack utilities
-------------------------------------------------------
Author: Evan Attfield
ID: 180817010
Email: attf7010@mylaurier.ca
__updated__ = "Jan 22, 2019"
-------------------------------------------------------
"""
from Stack_array... |
1,929 | 0e05eed2d6bc723fd8379e436621a6eba4aa5ab2 | # python /Users/lawrie_6strings/be_professional_pythonist/control_string.py
# -*- coding: utf-8 -*-
# 文字列を3行で書いてみたい場合
"""
どないやねん。
最近の若いもんは、
ようやるやんけ。
"""
# 文字列の特定の文字を取得したい場合は,インデックスを指定してあげることでなんとかする。
word = "what's up"
print(word[0])
# 書式化
name = "lady gaga"
print("こんにちわ、私の名前は {} です。".format(name))
"複数の文字列を挿入することもできる... |
1,930 | 8d7697a0e49dc9e966b9657171c66ccda57279d6 | #coding=utf-8
import unittest,time,os
from time import sleep
from appium import webdriver
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
from HTMLTestRunner import HTMLTestRunner
from appium.webdriver.common.touch_action import TouchAction
from pub_Student import login,logout
# Returns ... |
1,931 | e92d770f9d2176b4943653b09ac1069fa3301e46 | import glob
from PIL import Image
from PIL.ExifTags import TAGS, GPSTAGS
from pyproj import Proj
from osgeo import gdal, osr
from PyQt4.QtCore import QFile, QFileInfo
import os
from os import walk
#slika="c:\slike\Zito\DJI_0060.jpg"
#georef_slika="c:\Slike\Zito\Georeferencirana.tif"
radni_dir = 'c:/slike/Zito... |
1,932 | 4e10bc876797d0939c91cff5eff497b36af35dcb | print ("hello")
print ("===================================================")
print ("Nama Lengkap : Agung Dharmawan")
print ("Kelas : Teknik Informatika 2018 A")
print ("Kampus : Universitas Nahdlatul Ulama Sidoarjo")
print ("===================================================")
|
1,933 | 7d9032b2426dbf3c285b99efa78be38d8f76ec24 | '''
filter_items = lambda a : a[0] == 'b'
fruits = ["apple", "banana", "pear", "orange"]
result = filter(filter_items, fruits)
print(list(result))
'''
'''
Given a list of integers, return the even integers in the list.
input = [11, 4, 5, 8, 9, 2, 12]
output = [4, 8, 2, 12]
input = [3, 5, 7]
output = []
'''
# even_... |
1,934 | 11d0e84767f7e9e4687962a3a5c58dc882cc4dd2 | from os import walk
from ccal import VERSION
from setuptools import setup
package_data = []
for directory_path, directory_names, file_names in walk("data"):
for file_name in file_names:
package_data.append("{}/{}".format(directory_path, file_name))
setup(
name="ccal",
version=VERSION,
desc... |
1,935 | 495d606304e07a097033366d1a7e1d856a4cf61f | from flask import render_template, flash, redirect, url_for, request
from flask_login import current_user, login_user, logout_user, login_required
from werkzeug.urls import url_parse
from app import db
# from app.main.forms import [list forms here]
from app.models import User
from app.main import bp
@bp.route('/')
@bp... |
1,936 | c15faf9df8fa2e1ad89ea2c922ab0551eaa69d3f | """
pyautogui 屏幕像素获取、屏幕像素匹配
@author : zhouhuajian
@version : v1.0
"""
from pyautogui import pixel, pixelMatchesColor, screenshot
"""
主要内容:
1. pixel() - 获取屏幕像素;
2. pixelMatchesColor() - 屏幕像素匹配颜色。
"""
def test_pixel_pixelMatchesColor():
"""屏幕像素获取、屏幕像素匹配"""
# img = screenshot()
# print(img)
# print(i... |
1,937 | 95f9e9a8f681679f56c3755199fba7d654af85e8 | import logging
from bson import ObjectId
from typing import Union
from app.helper import parseControllerResponse
from models.members import Member
from schema.members import (
CreateMemberSchema,
MemberInDBSchema,
UpdateMemberSchema,
memberHelper,
)
def getAllMembersFromDB(**kwargs):
"""Finds an... |
1,938 | 979a387e29867818ffad7291511ff0be40dee118 | from django.urls import path
from .views.home import Home
from .views.signup import Signup
from .views.login import Login
urlpatterns = [
path('', Home.as_view(), name='home'),
path('signup', Signup.as_view(), name='signup'),
path('login', Login.as_view(), name='login'),
]
|
1,939 | e7fa84dbc037253c7f852aa618e6ea88d1fda909 | import pytest
def test_template():
assert True
|
1,940 | b49696d6cac5fbf97172aa7cf16903d002262b5c | #!/bin/env python3
import os
##print(os.environ)
##print("**********************************************************************")
##print("**********************************************************************")
##print("**********************************************************************")
##print(str(os.environ.ge... |
1,941 | f41ab6813fb7067089abe223b9006adde40630cd | import pytest
from apistar import App, Route, TestClient, exceptions
from apistar_request_id import RequestId, RequestIdHooks
def index() -> dict:
return {}
def fail() -> dict:
raise exceptions.BadRequest("fail")
def fail_2() -> dict:
raise RuntimeError("fail")
routes = [
Route("/", method="GET... |
1,942 | bf2a827e9c314da2ce9ad9f8f61b82c9c798e2f9 | #! /usr/bin/env python
from nutils import *
@log.title
def makeplots( domain, geom, c, psi, index ):
force = c * psi.grad(geom)
xpnt, cpnt = domain.elem_eval( [ geom, c ], ischeme='bezier5', title='mesh', separate=True )
xy, uv = domain.elem_eval( [ geom, force ], ischeme='uniform1', title='quiver', separate=... |
1,943 | 174f5b04f02ec0c9651d5e34c8b04df8bfd4dff4 | #!/usr/bin/env python
import sys
def solve():
numEngines = int(sys.stdin.readline())
engines = []
for _ in range(numEngines):
engine = sys.stdin.readline()
engines.append(engine)
numQueries = int(sys.stdin.readline())
queries = []
for _ in range(numQueries):
query = sys.stdin.readline()
queries.append(... |
1,944 | 5b4651f37cdcbb13f8ddd03327ef65af0f9cf61d | import numpy as np
from datetime import date, timedelta, datetime
from pytz import timezone
import store
import psycopg2
import requests
import os
import filters
FIRST = 4
def prepareDate():
pc_tz = timezone('US/Pacific')
n = datetime.now(pc_tz)
nd = n.date()
store.updateStore(today=nd)
def getData():
toda... |
1,945 | 96210942b01c510300120913bed1bc6d497a39a9 | # -*- coding: utf-8 -*-
"""
Created on Sun Mar 5 02:39:55 2017
@author: sparsh
"""
"""
Crop Disease Classification Project for Code Fun Do 2017 - IIT Roorkee
"""
"""
File for predicting a test image.
"""
import os
os.environ['THEANO_FLAGS'] = "device=gpu1, floatX=float32"
import theano
import numpy as np
np.random... |
1,946 | e835e75f444e97ca948ce27504cc9149ea0092f6 | def multiply(num1, num2):
return num1 * num2
|
1,947 | bea7853d1f3eac50825bc6eb10438f3f656d6d04 | # Filename : var.py
#整数
i = 5
print(i)
i = i + 1
print(i)
#浮点数
i = 1.1
print(i)
#python的弱语言特性,可以随时改变变量的类型
i = 'change i to a string '
print(i)
s = 'hello'#单引号
print(s)
s = "hello"#双引号
print(s)
#三引号为多行字符串
s = '''This is a "multi-line" string.
This is the second line.'''
print(s)
s = '\''#斜杠用于转义
print(s)
#r或R开头的字符... |
1,948 | 093b2afef7cdfb7070eb5e94e84624afe495db66 | # -*- coding: utf-8 -*-
"""Part of speech mapping constants and functions for NLPIR/ICTCLAS.
This module is used by :mod:`pynlpir` to format segmented words for output.
"""
import logging
logger = logging.getLogger("pynlpir.pos_map")
#: A dictionary that maps part of speech codes returned by NLPIR to
#: human-read... |
1,949 | 47817d6cf58ac54e501ed24ae3ababc821bdd5c8 | from vkaudiotoken import get_vk_official_token
import requests
import json
import telebot
import urllib
import sys
#check start args
try:
if len(sys.argv) != 4:
raise Exception
botApiKey = sys.argv[1]
login = sys.argv[2]
password = sys.argv[3]
except:
print('Not enough arguments')
pr... |
1,950 | 60ca8b1d7307a9d8183e3617f238efcfb9d707dd | import json
from flask import Flask, request, jsonify
from lib.chess_utils import run_game
def create_app():
app = Flask(__name__)
@app.route('/')
def hello_world():
return 'Hello, World!'
@app.route('/process_game', methods=['POST'])
def process_game():
move_sequence = json.lo... |
1,951 | 929e6deeb017fd338c63439f689d05331b016d0f | class CUtil:
# Returns a dictionary containing the cell UID as they key and the data for the cell as the value
# Ex: 'AA': 2, 'AB': 4 ....
@staticmethod
def generate_board(initial_board, grid_size):
board_dictionary = dict()
iterator = 0
board_identifiers = CUtil.__generate_boar... |
1,952 | d1f0baa1ff87ece50aaded5e60908269e81b6734 | from SpritesClass import Sprite
from JogadorClass import Jogador
from OpenGL.GL import *
from OpenGL.GLUT import *
from OpenGL.GLU import *
class Tela:
def __init__(self,j,t0):
self.telas = ["jogo","game over"] #telas existentes
self.estagio = "jogo"
self.j = j
#sprites
se... |
1,953 | 8e22db940124f92d3048055cf72dcaa79564cdc6 | import pytest
from ansiblediscover.graph.node import Node
def test_build_identifier():
assert 'role:server_base' == Node.build_identifier('server_base', 'role')
def test_identifier():
node = Node('server_base', 'role', 'irrelevant')
assert 'role:server_base' == node.identifier()
def test_add_successo... |
1,954 | ed1df078ad2e8d770f3d8c41493b5537ed106e3a | ##############################
# SConscript for OgreOpcode #
##############################
#SCons scripts maintained by:
# Van Aarde "nanocell" Krynauw.
#TODO:
# - Add commandline options to specify include dirs, defines, compiler defs, libraries, etc.
# - Add Sconscripts for the samples.
# - Add a binary SConstruc... |
1,955 | 547926904f9a4b88a988e3b59c49b94fe0e30de4 | """
Merkle: Implementation of Merkle Trees over Blake2
"""
from typing import List, Any
from hashlib import blake2b
class Merkle:
"""
We consider the merkle tree as a commitment protocol implementing
the interface:
* commit_() : commits to a list by computing the merkle tree.
* open_() : opens the... |
1,956 | 30251b7c2ce30b7fa899a5885707c078788d0106 | import os
import sys
import json
from subprocess import Popen, PIPE, STDOUT
from twisted.internet.task import deferLater
from twisted.internet import reactor
from autobahn.twisted.websocket import WebSocketServerFactory, WebSocketServerProtocol, listenWS
from utils import rsync
# TODO: Add Twisted logger
# TODO: Cre... |
1,957 | 0a1d102075cebee13e25f3eb703811d1e22f53c2 | from test.demo_test_case import DemoTestCase
class UserTest(DemoTestCase):
def test_access_secure_area(self):
r = self.get('/api/user')
self.assertEqual(401, r.status_code)
def test_login_bad_password(self):
r = self.post(
'/api/connect',
{'user': 'admin', 'pas... |
1,958 | 1fbe9078748b00efad0211b29ad572df97cda921 | import traceback
from functools import partial
import json
import logging
from collections import defaultdict
from itertools import cycle as CycleIter
from datetime import datetime, date, timedelta
from decimal import Decimal
import random
from copy import deepcopy
from math import ceil
import boto3
import bottle
from... |
1,959 | c185a88332e39c561649f087f01fd3b704e7010b | """Add uri on identity provider
Revision ID: 52561c782d96
Revises: cdf9f34b764c
Create Date: 2022-03-11 10:16:39.583434
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '52561c782d96'
down_revision = 'cdf9f34b764c'
branch_labels = None
depends_on = None
def up... |
1,960 | 61cfc583cd87ac0528cb07f4e051392167414920 | x=1
while x<=24:
if x%5==0:
x=x+1
continue
print(x)
x=x+1
|
1,961 | cd4f22b8e2188e8019e7324e80d64a7b95f8f956 | __author__ = 'Administrator'
import unittest
class CouchTests2(unittest.TestCase):
def test_foo(self):
self.assertEqual(1,1)
def test_bar(self):
self.assertEqual(1,1) |
1,962 | 030bc0c7bdbbb09f722ffe4c82866726062f5317 | import sys
import random
import pygame
import pygame.locals
import time
# TODO high scores, difficulties
# Absolutes (in pixels where not otherwise stated)
CELL_SIDE_LENGTH = 40 # Side length of each cell
CELL_MARGIN = 2 # Gap between cells
GRID_HEIGHT = 10 # How many cells are in the grid
GRID_WIDTH = 10
X_... |
1,963 | 1844cfb3e174454e0e95d91e4e55679caddcd56e | from . import common_wizard
|
1,964 | f15ce7cec032ace65604771fa56e3d9969c98209 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.10 on 2018-08-03 10:25
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Proce... |
1,965 | 9eef202a42bfc10b2f52d1b9153d664c5046c13f | from emulator import Emulator
from device import Device
from devices.compactflash import CompactFlash
from devices.mc68681 import MC68681
from musashi import m68k
def add_arguments(parser):
parser.add_argument('--rom',
type=str,
help='ROM image')
parser.add_argu... |
1,966 | f9b53df799b3e6b71282c84a625ea5915ccb8014 | """
This is a big integer challenge. You are given an integer which is a **perfect
square**. It is composed of 40 or more digits. Compose a function which will
find the exact square root of this integer.
### Examples
square_root(152415787532388367501905199875019052100) ➞ 12345678901234567890
square_ro... |
1,967 | d21b89285d4b4c73a08bda746cea31b5a13d1050 | from django.urls import path
from . import views
urlpatterns = [
path('product', views.ProductCreateAndList.as_view()),
path('product/<int:pk>', views.ProductRetrieve.as_view()),
]
|
1,968 | 6f3de70267956a6c7c3c5b261cf591051de4c548 | #!/usr/bin/python3
"""
This module contains a Fabric function definition.
"""
from datetime import datetime, time
from fabric.api import *
from pathlib import Path
def do_pack():
timestamp = datetime.utcnow().strftime("%Y%m%d%H%M%S")
archive = "web_static_" + timestamp + ".tgz"
local("mkdir -p version... |
1,969 | 4791b210f328dff5d48ff5afc381a98a5a1a2b7b | from bs4 import BeautifulSoup
import requests
import pymongo
client = pymongo.MongoClient('localhost', 27017)
ku = client['ku']
url_list1 = ku['url_list_index']
start_url="http://news.ccsu.cn/index.htm"
url_host="http://news.ccsu.cn/"
def get_channel_urls(url):
wb_data = requests.get(url)
wb_data.encoding = 'ut... |
1,970 | f98120d191e9e4b92984a6b59b25b1331b5d8c3a | # -*- coding: utf-8 -*-
pessoas=int(input('Digite o numero de pessoas que passa pela esada rolante:'))
for i in range(1,n+1,1):
tempo=int(input('Digite o tempo:'))
if i==1:
tempo1=tempo
elif i==n:
f=tempo+10
X=f-tempo1
print(x) |
1,971 | b4787d65fb8adf5dc6a99c1a13922c8f9acc2087 | from rest_framework import serializers
from .models import Backend
class BackendSerializer(serializers.ModelSerializer):
class Meta:
model = Backend
fields = '__all__'
|
1,972 | e5cc556d4258ef5c85f7bc5149cdd33471493bdb | #!/usr/bin/env python
import os
import shutil
import glob
import re
import subprocess
list = glob.glob("*en.mrc")
for en in list:
ef = re.sub("en","ef",en)
efAli = re.sub("en","efAli",en)
cmd='proc2d %s %s_filt.mrc apix=1.501 lp=20' %(ef,ef[:-4])
subprocess.Popen(cmd,shell=True).wait()
cmd="alignhuge %s_fil... |
1,973 | f4d4be174bed2704c0ad12eea2f0cd64eaaa0aaa | #!/usr/bin/python
import argparse
import string
import numpy
def gen_ft_parser():
ft_parser = argparse.ArgumentParser(
description='Generate a Character-Feature Translation Table')
ft_parser.add_argument('alphabet_file', metavar='alphabet_file',
type=str, help='A file contianing all the char... |
1,974 | 93b712c60ba4bfa81d967ec59035b6fb7793ce87 | class User():
def __init__(self, first, last, gender, age):
self.first_name = first
self.last_name = last
self.gender = gender
self.age = age
self.full_name = self.first_name + " " + self.last_name
def describe_user(self):
print("The name of the user is " + self.... |
1,975 | 96e64b715dbfc1c59ba44d608ad2694b165017b5 | from paper_processor import PaperProcessor
import logging
logging.basicConfig(
level=logging.DEBUG,
format='%(asctime)s - %(levelname)s - %(message)s')
q = "levamisole inhibitor"
p = PaperProcessor(q)
|
1,976 | 1d5db3db319e67e050036e718bbe0c538365d229 | # -*- coding: utf-8 -*-
"""
:Author: Dominic Hunt
"""
import numpy as np
import logging
import itertools
import copy
import types
import utils
class FitSubsetError(Exception):
pass
class ActionError(Exception):
pass
class StimuliError(Exception):
pass
class FitSim(object)... |
1,977 | e32c73abdcd384ee7c369182527cca6495f067b3 | import datetime
from django.shortcuts import render
from lims.models import *
import os
import zipfile
def getpicture(word):
if word.split(".")[1] not in ["doc","docx"]:
return None
word_zip = word.split(".")[0] + ".zip"
path = ""
for i in word.split("/")[0:-1]:
path += i
... |
1,978 | 93c465f017542cfe9cbc55da0ae5a9e34663cf32 | # -*- coding: utf-8 -*-
#########################################################################
## This scaffolding model makes your app work on Google App Engine too
## File is released under public domain and you can use without limitations
#########################################################################
... |
1,979 | fcbbffe0682da9f2131fdddbef606dcae3303ce9 | # Create two integer variables and print their sum. What is the type of the
# result?
# Now, create a float variable and print its sum with an integer variable. What
# is the type of the result.
# Divide your smallest integer value by your largest integer value. Is the
# result what you expected? Now, do the same wit... |
1,980 | 40b3c403f99044eb61740d62eda15ddd08b0f739 | # ---------------------------------------------------------------------
# Iskratel.ESCOM.get_version
# ---------------------------------------------------------------------
# Copyright (C) 2007-2018 The NOC Project
# See LICENSE for details
# ---------------------------------------------------------------------
# Pyth... |
1,981 | b668945820abe893b92fdf26ccd8563ccff804ee | """
Class: Dataset
This class is responsible of loading datasets
After initializing using load method the class results two parameter:
train: contains train set
test: contains test set
It's able of returning data structure in form of three lists:
- users
- items
- values (which are ratings)
"""
... |
1,982 | 51711c9293f8b5d9dc4d299569da04e2d1bc0064 |
# Procedures for automatic COBD calculation.
# The useful ones are:
# - get_heuristic4_OBD() as a heuristic one [the only heuristic one here that does not miss-out solutions]
# - getOBD2plus4() as the fastest exhaustive one [uses two filtering techniques for early detection of graphs without an OBD]
import itertool... |
1,983 | 22b2ebdbb48caa593bece030d238089a0aa27053 | from django.shortcuts import render, redirect
# Create your views here.
from item.models import Item, Unit
def str_to_bool(s):
return True if s.lower() == 'true' else False
def item(request):
if not request.session.get('is_login', None):
return redirect('/item/item')
else:
item_list = ... |
1,984 | 532bcf8ae0ee40dc3eb4bd7170acfcb5d21cc4b9 | from __future__ import print_function
import os
from twisted.internet.task import react
from twisted.internet.defer import Deferred, inlineCallbacks
from twisted.internet.protocol import Factory
from twisted.internet.protocol import Protocol
from twisted.internet.endpoints import TCP4ClientEndpoint, connectProtocol
f... |
1,985 | 6670295241516664e30c7db5cd3b5e2fb6c4fb05 | # Generated by Django 3.2.7 on 2021-10-01 08:36
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('app', '0005_alter_users_is_active'),
]
operations = [
migrations.AlterModelManagers(
name='users',
managers=[
],... |
1,986 | 94e9d67095dde4d3bf7ddb207ac17a4c250a2bfc | from scrapy.contrib.spiders import CrawlSpider, Rule
from scrapy.contrib.linkextractors import LinkExtractor
from scrapy.contrib.linkextractors.sgml import SgmlLinkExtractor
from mp_data_scrapper.items import MpDataScrapperItem
class MininovaSpider(CrawlSpider):
name = 'mp'
allowed_domains = ['india.gov.in']
... |
1,987 | 037a02ff2c0699acdd1fefbe60098c93cd99e777 | """
help find Holly find dups in the PC's
Given a particular dir - report the dupset of each of the files so we can see
where the dups are
"""
import os, sys, re
from comms.dup_manager import DupManager
class DupFinder (DupManager):
base_archives_path = '/Volumes/archives/CommunicationsImageCollection/'
ba... |
1,988 | c2ba18062b8555c77b329718ec1f2ae7f326c78e | # -*- coding: utf-8 -*-
"""
@File : densenet_block.py
@Time : 12/11/20 9:59 PM
@Author : Mingqiang Ning
@Email : ningmq_cv@foxmail.com
@Modify Time @Version @Description
------------ -------- -----------
12/11/20 9:59 PM 1.0 None
# @Software: PyCharm
"""
import torch
from torch... |
1,989 | cae0aeea2ebd0a429cf6ecc9acab8f5f103e9669 | import cv2
def movemouse(event, x, y, flags, param):
global img
img2 = img.copy()
# img2 = cv2.cvtColor(img2, cv2.COLOR_BGR2HSV)
if event == cv2.EVENT_MOUSEMOVE:
font = cv2.FONT_HERSHEY_SIMPLEX
message = '{}'.format(img2[y, x])
cv2.putText(img2, message, (int(w / 2.5), int(h /... |
1,990 | cb2e2ef70935a22854c70fedf4f4a6715b089291 | class Person:
country = "INDIA"
def __init__(self):
print("its base constructor")
def takeBreath(self):
print("Yes Iam breathing.")
class Emp(Person): # inherits person
def takeBreath(self):
print("Yes Iam EMP and Iam also breathing.")
class Prog(Emp):
def ... |
1,991 | 94056e8920d265831da67bd1d999330a47a7ef0d | import math
print(dir(math))
# Prints a list of entities residing in the math module |
1,992 | 728af8b07bc391b496709e54926f3f1f49897176 | include_rules = [
"+apps",
"+components/live_caption",
"+services/device/public",
"+components/device_reauth",
# Enable remote assistance on Chrome OS
"+remoting/host",
]
specific_include_rules = {
".*test.*": [
"+chrome/browser/ui/views/frame",
"+components/captive_portal",
"+components/web... |
1,993 | ed35a9bc3dd267c9a5fe76ccbb1b4ac5261fc3c8 | import os, sys
import math
import argparse
import shutil
import numpy as np
import pandas as pd
from sklearn.preprocessing import StandardScaler
from sklearn.ensemble import RandomForestRegressor
from sklearn.model_selection import KFold
from keras.models import Sequential
from keras.layers import Dense, Dropout, Loc... |
1,994 | 4df9af863a857c3bbc3c266d745a49b6ef78ba9b | from PyQt5.QtWidgets import QApplication, QWidget
import sys
class Calculator(QWidget):
def __init__(self):
self.number_str = ""
self.version = "小树计算器 V1.0"
super().__init__()
self.resize(400,400)
from PyQt5.uic import loadUi # 需要导入的模块
#loadUi("record.ui", self) ... |
1,995 | be06a0ad22f4ae9ab4c0acea6a7c601c14a90fc4 | # -*- coding: utf-8 -*-
import random
from cocos.actions import MoveTo, CallFuncS
from cocos.sprite import Sprite
import define
def kill(spr):
spr.unschedule(spr.update)
arena = spr.parent.parent
if not spr.is_big:
arena.batch.add(Dot())
spr.killer.add_score()
else:
spr.killer... |
1,996 | 4bbfb35e4b03e2bfd46dd0fe5bfd54fb01ba11df | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.test import TestCase
from collections import Counter
import generator.resume_parser as resume_parser
import os
import json
class TestResumeParser(TestCase):
def load_resume(self, resume_name):
path_to_directory = "generator/fixtures/{... |
1,997 | 4e02edcf8a512060fa92ede11f33993978584147 |
#!/usr/bin/env python
"""
Author: Adam White, Matthew Schlegel, Mohammad M. Ajallooeian, Sina Ghiassian
Purpose: Skeleton code for Monte Carlo Exploring Starts Control Agent
for use on A3 of Reinforcement learning course University of Alberta Fall 2017
"""
"""
/*
* Copyright (c) HAOTIAN ZHU ,COMPUT301,... |
1,998 | 1133d3cf900e31278dc491565c99969a116e6c83 | import torch
import numpy as np
import h5py
from torch.utils.data import Dataset, DataLoader
from config import PARAS
"""
Be careful:
We use log mel-spectrogram for training,
while the mask generated is for power mel-spectrogram
"""
def create_gt_mask(vocal_spec, bg_spec):
"""
Take in log spectrogram and ret... |
1,999 | 41681a80807800efc06b3912533d739dab2cd085 | """
This file is part of the tractor library.
See LICENSE.txt for licensing, CONTRIBUTORS.txt for contributor information.
Created on Jan 06, 2012.
"""
from StringIO import StringIO
from datetime import datetime
from tractor.attachment import AttachmentWrapper
from tractor.attachment import Base64Converter
from tract... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.