index int64 0 1,000k | blob_id stringlengths 40 40 | code stringlengths 7 10.4M |
|---|---|---|
988,200 | 228bd2388acbdc6a7d4b04c6bdc20278ca93861c | import numpy as np
import pandas as pd
from scipy.stats import ranksums
from sklearn.metrics import roc_curve
from statsmodels.stats.multitest import multipletests
def _get_optimal_threshold(scores, labels):
pos_scores = scores > 0
_labels = labels[pos_scores]
_scores = scores[pos_scores]
fpr, tpr, th... |
988,201 | bba45e3c3c8208de356521bf5b57ed2b92e2c87a | import numpy as np
import torch as t
import pyqtgraph as pg
import pyqtgraph.opengl as gl
import argparse as ap
from model import *
from copy import deepcopy
from time import time
parser = ap.ArgumentParser()
parser.add_argument("filename",
help="Name of the file of the PyTorch neural net to be visualized",
... |
988,202 | ab287c0caf66d44156942059af5f9ffdd5f81ff4 | import xlrd
path = "denemeExcel.xlsx"
import firebase_admin
from firebase_admin import credentials
from firebase_admin import firestore
cred = credentials.Certificate("seracker-cd8df-firebase-adminsdk-c5wua-8f94ae24d2.json")
firebase_admin.initialize_app(cred)
dosyaAc = xlrd.open_workbook(path)
dataSheet =dosyaAc.... |
988,203 | ab459bdbbbd51db64c2049f7da4624e4c64b84e4 | # a simple movie renamer:
# Python3 only
import sys
import os
import re
import glob
import argparse
# function to rename movie
def rename_movie(fn: str, debug: bool) -> str:
# save path name of the original file
file_path = os.path.dirname(fn)
# split file name to get the base name
file_name = os.pa... |
988,204 | 36b93362d57b3aea9a8e8a251f0f34c968d0f1bc | from timeit import Timer
import matplotlib.pyplot as plt
tz = []
te = []
x = range(10000,1000001,10000)
for i in x:
print i
l = list(range(i))
##Create Timer object with Statement and Setup
t1 = Timer(stmt="l.pop(0)", setup="from __main__ import l")
l = list(range(i))
t2 = Timer("l.pop()", "fro... |
988,205 | 14cf2ca151faebb6e0ed635efa6e51446b24c8e6 | from rest_framework import serializers
from .models import MoviesList
class MoviesListSerializer(serializers.ModelSerializer):
class Meta:
model = MoviesList
fields = ('movie_name','hero_name','heroin_name','music_director_name','director_name')
|
988,206 | c853a3737592a5dbb5caca7696fb0027b335daca | # Generated by Django 3.0.3 on 2020-08-05 02:57
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('importDB', '0009_master_ranking_university_name_color'),
]
operations = [
migrations.CreateModel(
name='HRMIS_V_AW_FOR_RANKING',... |
988,207 | fd3e9ed0263ebd6bad72b4e39ce2fe989bc4712b | # -*- coding: utf-8 -*-
__author__ = 'Renan Cakirerk <renan@cakirerk.org>'
import json
from mongoengine import *
from datetime import datetime
from django.core.mail import send_mail
from django.db import models
from django.db.models import ForeignKey
from django.utils import timezone
from django.contrib.auth.models... |
988,208 | b1fbef88006022e7e1dbf4acda97440a7210954d | from django.shortcuts import render, HttpResponse, redirect
from django.utils.crypto import get_random_string
# Create your views here.
def index(request):
try:
request.session['count']
except KeyError:
request.session['count'] = 0
return render(request, 'index.html')
def generator(reques... |
988,209 | 7503b8385b45e899d19f19b153a09de3a67cc62c | '''
'''
# This solution handles non-duplicate characters
class Solution:
def minWindow(self, s: str, t: str) -> str:
characterIndexMap = {}
characterSetMap = set()
currentBestLength, currentBestString = float('inf'), ""
# Building our comparison set
comparisonSet =... |
988,210 | b2993204a31ebe870268f01de34d934b6725aa58 | print("hello python")
print("how are you?")
print("I'm fine")
print("what do you call a fish without an eye?")
print("fsh")
print("I'm cold")
print("I'm very hungry")
print("I like coffee")
print("I love python")
print("A watched pot never boils")
|
988,211 | 6f2be5b7f11a1656ad04f24bc82436f7d340e87c | from urllib.request import urlopen
import urllib.parse
import requests
from requests.exceptions import HTTPError
from django.conf import settings
from django.core.files import File
from django.core.files.temp import NamedTemporaryFile
from django.core.management import BaseCommand
from django.template.defaultfilters i... |
988,212 | dff8c9a23e9baef4a47bf0f69081f2a4dd10dfc9 | # https://api.spoonacular.com/recipes/random?apiKey=40b4dc4ae9fe4482b9d5633dd6ff2738&number=1&tags=glutenfree,dinner
import models
import requests
from flask import Blueprint, jsonify, request, Response
from playhouse.shortcuts import model_to_dict
glutenFreeRecipe = Blueprint('glutenFreeRecipes', 'glutenFreeRecipe... |
988,213 | c8af933cb3ef4cf2ec33ab2e8cac2f43c726fec1 | import time
import VL53L0X
import subprocess
import RPi.GPIO as GPIO
#box sizes
diameter = 120
totalDist = 150
#GPIO Mode (BOARD / BCM)
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
#GPIO and Setup for Pressuare Pad
pressurePad = 4
GPIO.setup(pressurePad,GPIO.IN)
#GPIO and Setup for LEDs
red = 6
green = 5
GPIO.s... |
988,214 | 49112b644e355128dceeda533b9a25b4294b40d8 | from gitgud.levels.intro import level as intro_level
from gitgud.levels.rampup import level as rampup_level
from gitgud.levels.extras import level as extras_level
from gitgud.levels.util import AllLevels
all_levels = AllLevels([
intro_level,
rampup_level,
extras_level
])
|
988,215 | e11e223a4e1055031d9527916d20b90156e48c7f | # -*- coding: utf-8 -*-
# Copyright (c) 2010 'Quadra Informatique'
# Copyright (c) 2010 'ENS Lyon - UNIS'
# 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; either version 2 of the License, or
# (... |
988,216 | 29dc73d18002f43dd96cc3b7ac058f8753a6f8a5 | tin_code = {
"hc" : "Học",
"ng" : "Người",
"pt" : "Phát Triển",
"any" : "Anh người yêu"
}
while True:
for key in tin_code:
print(key , end = "\t")
print()
n = input("Enter: ")
if n in tin_code:
print(tin_code[n])
else:
print("Not found, you want(Y / N)??")
... |
988,217 | 1c52db3691c8e808f9831971fe2b36e939ab8ff2 | # -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'User'
db.create_table(u'movies_user', (
(u'id... |
988,218 | 59624bf4eb328b6d4eba9ac42803f14704213032 | """
This examples trains a CrossEncoder for the NLI task. A CrossEncoder takes a sentence pair
as input and outputs a label. Here, it learns to predict the labels: "contradiction": 0, "entailment": 1, "neutral": 2.
It does NOT produce a sentence embedding and does NOT work for individual sentences.
Usage:
python traini... |
988,219 | e5b1bad365ad465bf36e5e05a4358a2352425555 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.1 on 2017-06-16 06:40
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('checkout_app', '0003_auto_20170615_1355'),
]
operations = [
migrations.Crea... |
988,220 | 0a7d9453d07dc86d2955c49787783a8342833394 | from torchvision import models
import torch.nn as nn
import torch
import torch.nn.functional as F
import math
import time
class Graph_Layer(nn.Module):
def __init__(self,in_size, n_out = None, method = 'cos', k = None):
super(Graph_Layer, self).__init__()
self.in_size = in_size
sel... |
988,221 | d1098dbf2ee7f66b3ce8c7f4dd2c14833769ab3d | import pandas as pd
import streamlit as st
import plotly.express as px
@st.cache
def get_data():
url = "http://data.insideairbnb.com/united-states/ny/new-york-city/2019-09-12/visualisations/listings.csv"
return pd.read_csv(url)
df = get_data()
cols = ["name", "host_name", "neighbourhood", "room_type", "price"]... |
988,222 | 5a116da5be1ca55030caddba5883d3688f00a5bf | from halo_api.constants import build_url
import requests
class Auth(object):
_access_token: str
_refresh_token: str
def _request_proxy(self, method, *args, **kwargs) -> dict:
if not self._access_token:
raise Exception("you aren't logged in!")
default_headers = {
"... |
988,223 | b93f3287013ae873ba663b2e015d5d58c00a0653 | from django.db import models
# Chart of Accounts
class COA(models.Model):
is_active = models.BooleanField(verbose_name='active', default=True)
name = models.CharField(verbose_name="name", max_length=30, null=True)
number = models.CharField(verbose_name="number", max_length=30, unique=True, null=True)
d... |
988,224 | 101b45d3f8906eeba4d79dc47ef0bf50c2b21456 | d = {'name': 'xc', 'age': 18}
print(d['name'])
dd = dict(name='xc',age=16)
print(dd) |
988,225 | 5a087e8d9df87e7b9744b22dd1783c99693f193e | import random
import elote as elo
import constructs.Food
class Initializer:
def __init__(self, foods, mu=500, sigma=40):
for food in foods:
food.elo_competitor = elo.EloCompetitor(initial_rating=random.gauss(mu, sigma))
food.rating = food.elo_competitor.rating
self.foods ... |
988,226 | 6ccadd3c30b9ce8bf404b58b663e9d5142766768 | from django.db import models
from mezzanine.pages.models import Page
from mezzanine.core.models import RichText
# Create your models here.
class Registration(Page,RichText):
def __unicode__(self):
return self.title
class RegisterInfo(models.Model):
form = models.ForeignKey("Registration")
date ... |
988,227 | 8ffd5fc2d3a09a52fc83ec7d39806a062ee3aad9 | from django.shortcuts import render, redirect, get_object_or_404
from django.core.urlresolvers import reverse
from django.core.exceptions import ObjectDoesNotExist
from django.db import transaction
# Decorator to use built-in authentication system
from django.contrib.auth.decorators import login_required
# Used to cre... |
988,228 | 258564184bc5d138fe4fa9e4db9bd41ed462ec65 | # with open('./ErQiaoCrawler/ErQiaoCrawler/anthology.bib','r', encoding='utf-8') as f:
# content_list = f.readlines()
# contents = [x.strip() for x in content_list]
# url_list = []
# for content in contents:
# if content.startswith('url ='):
# url_list.append(content[7:-2])
# ... |
988,229 | 7b1a3eaaa18003c59f0c4c6dc6558a9f4228bf15 | class Solution:
def searchMatrix(self, matrix: List[List[int]], target: int) -> bool:
if not matrix:
return False
m = len(matrix)
n = len(matrix[0])
left = 0
right = m*n-1
while left <= right:
mid = (left + right)//2
mid_ele = mat... |
988,230 | c44e131eba8d3f62e4f1062231b8895432058280 | import matplotlib.pyplot as plt
import numpy as np
import re
def draw(plt, values, type, line_style, color, label):
plt.plot(np.arange(len(values)), values, type, linestyle=line_style, color=color, label=label)
if __name__ == '__main__':
file_names = ['vgg_16_reduced.log', 'inception_bn.log']
types = ['... |
988,231 | ba994f23e21dc43b01faff434d694f62f1927529 | num_int = 123
num_str = "456"
print("Data type of num_int:",type(num_int))
print("Data type of num_str:",type(num_str))
print(num_int+num_str)
|
988,232 | f99e443d0466488b3713e09c4610f2d3f7e52c6c | from .table import Table
from .database import Database
class View(Table):
def __init__(self, db: Database, schema: str, name: str, view_def: str) -> None:
self.view_definition = None
super().__init__(db, schema, name)
self.set_view_definition(view_def)
def set_view_definition(self, v... |
988,233 | b289c184c70b195f8f5053be9b319556b4033894 | # -*- encoding: utf-8 -*-
"""
@File : models.py
@Time : 2020/3/12 20:07
@Author : Flack
@Email : opencoding@hotmail.com
@ide : PyCharm
@project : stockapi
@description : 描述
"""
import time
import random
from typing import List
from pydantic import BaseModel, Fie... |
988,234 | c99416300683e8c718feeba278d098a2c1eec120 | # Am Anfang müssen wir ein paar Sachen importieren
from BeautifulSoup import BeautifulSoup
import urllib
import urllib2
import re
import json
import scraperwiki
# define the order our columns are displayed in the datastore
scraperwiki.metadata.save('data_columns', ['id', 'title'])
# Webseite herunterladen
# (Das »"u... |
988,235 | 9cc69980e18d63be98d701e2484f20c2c30d4be7 |
nama = input("Masukkan Nama : ")
nilaiKeatifan = int(input("nilai Keatifan : "))
nilaiTugas = int(input("nilai Tugas : "))
nilaiUjian = int(input("nilai Ujian : "))
nilaMurniK = nilaiKeatifan * 20/100
nilaMurniT = nilaiTugas * 30/100
nilaMurniU = nilaiUjian * 50/100
nilaiAkhir = nilaMurniK + nilaMurniU + nilaMur... |
988,236 | 005f4132dc31ac3ed9d9f352eb8aa4cce392153d | from Configuration.AlCa.GlobalTag import GlobalTag
from CondCore.CondDB.CondDB_cfi import *
#----------------------------------------------------------------------------------------------------
lhcInfoDefined = False
def UseLHCInfoLocal(process):
global lhcInfoDefined
lhcInfoDefined = True
def UseLHCInfoGT(pr... |
988,237 | 3a9894adb41324ec3581ce1335745fb1257e1aa3 | import sys
import math
input = sys.stdin.readline
def sum_diff(array, i):
result = []
for num in array:
if num > i:
result.append(num - i)
else:
result.append(0)
return sum(result)
n, m = input().split()
m = int(m)
array = [int(x) for x in input().split()]
max_num =... |
988,238 | 40c25f0d983b62f4c7c99747f17803f863cab425 | from kafka import KafkaConsumer
from json import loads
import psycopg2
connection = psycopg2.connect(user="postgres",
password="123456789",
host="209.188.7.148",
port="5432",
database="data")... |
988,239 | 074245b42de0703d7a4e5e896fa07bef318e5c89 | #!/usr/bin/env python
dictonary ={}
def find(alist):
for i in xrange(len(alist)):
if alist[i] not in dictonary.keys():
dictonary[alist[i]] = 1
else:
dictonary[alist[i]] +=1
output =[]
for i in dictonary.keys():
temp = [i]*dictonary[i]
output.extend(temp)
print output
Input = [0, 1, 1, 0, ... |
988,240 | f0b2c32d6f43c09e48cf863a868ee0b3e235c0e4 | from marshmallow import Schema, fields, EXCLUDE
class UserSchema(Schema):
id = fields.Int()
phone = fields.Int()
telegram = fields.Int()
name = fields.Str(allow_none=True, missing=False)
email = fields.Str(allow_none=True, missing=False)
registration = fields.Date()
password = fields.Str()... |
988,241 | 69b48fe831830fc6a24be3e800f5075e5f3d09ac |
import matplotlib.pyplot as plt
import numpy as np
from pylab import mpl
mpl.rcParams["font.sans-serif"] = ["SimHei"]
mpl.rcParams["axes.unicode_minus"] = False
def barChart():
x_data = ['2012', '2013', '2014', '2015', '2016', '2017', '2018', '2019', '2020']
y_data_1 = np.array([1, 2, 3, 4, 5, 6, 7, 8, 9] )
... |
988,242 | 717e28239689bb1ef578e21ddc26fabbedb7b6af | import tkinter
canvas=tkinter.Canvas()
canvas.pack()
canvas.config(width= 1500, height=900)
# HOSPITAL
canvas.create_rectangle(30,70, 190,300, fill="blue4"); #stvorec
canvas.create_text(110,175, text="H", font="Arial 100 bold", fill="white"); #H
canvas.create_text(110,230, text="NEMOCNICA", font="... |
988,243 | c181a00b53d2a77719c10c64fa328858cb765c7b | class FGraph:
def __init__(self, data):
self.data = data
def findFriends(self, user):
return user.friends
def findFriendsFriends(self, user):
allSecondFriends = []
friends = self.findFriends(user)
for friend in friends:
for user in self.data:
if user.id == friend:
allSecondFrie... |
988,244 | 841f81e981af8ad64d2da89b78a1f41c9c884963 | x = float(input("Enter the first number: "))
y = float(input("Enter the second number: "))
z = float(input("Enter the third number: "))
a = float(input("Enter the last number: "))
b = (x+y+z)/3
c = a*b
print("The average of x , y and z multiplied by a is: ", c)
|
988,245 | 2b0fdf598311f85597d04727f6d33815a43fe54c | #coding = utf-8
import pytest
from selenium import webdriver
from time import sleep, ctime
import os
options = webdriver.ChromeOptions()
options.binary_location = "C:/Program Files/Google/Chrome/Application/chrome.exe"
chrome_driver_binary = "D:/Google/chromedriver.exe"
driver = webdriver.Chrome(chrome_driver_binary, ... |
988,246 | cbf7579847a348e8ae9c6f445469d82c685efb29 | import pygame
from pygame.locals import *
from .EventSE import EventSound
class MenuDetectIcon():
def __init__(self, point:tuple):
self.point = (point[0], point[1], point[2], point[3])#x,y,w,h
class MainMenu():
def __init__(self, menu_list:list, color:tuple, size:tuple, font_size:int):
... |
988,247 | d594f52e0268cb32963015216203ea4829e6d639 | import numpy
import math
import random
import matplotlib.pyplot
import sklearn.discriminant_analysis
# create data from a multivariate normal distribution
mean1 = [-5, -4, -3, -2, -1, 0, 1, 2, 3, 4]
mean2 = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
cov = [[3, 1, 1, 1, 0, 0, 0, 0, 0, 0],
[1, 4, 0, 0, 0, 0, 0, 0,... |
988,248 | 825bb8b62e1305c0a71a2bb12278d52c54db3a06 | # Code Festival - Python Practice 003
# Author : ㄱㄱㅊ
# Title : Variable type
# Date : 20-01-16
l = [100, 200, 300]
print(type(l))
# 3) class 'list'
|
988,249 | f2359a212cc4db5955cb71e885a210818bc8332d | import numpy as np
_Lx = 64
_Ly = 64
_base = 2**(_Lx-1)
_mask = 2**(_Lx) - 1
def lshift(k):
return ( (k<<1) + (k//_base) ) & _mask
def rshift(k):
return ( (k>>1) + (k%2)*_base) & _mask
def compare(a,b=0,kind=0):
"""
return bit fields in 'a' that can move to
empty bit fields in 'b'
'kind' s... |
988,250 | 32baa34f99480708251df01e082b51814677d430 | nums = (i*i for i in range(5))
for x in nums: print x
for x in nums: print x
''' Output
0
1
4
9
16
'''
|
988,251 | a08b7c3336d7dc69fd5dfcd89ecd8df8eedad829 | from argparse import ArgumentParser
def parse_args():
parser = ArgumentParser(description='list directory contents')
parser.add_argument('path', help='path to directory')
parser.add_argument('-a', action='store_true', help='include hidden files')
parser.add_argument('-R', action='store_true', help='recursivel... |
988,252 | 129acdca8f6195d2c101352913a38ee44b6bc497 | #!/usr/bin/env python3
from RubikEncryption import RubikEncryption
ct = input('[>] Ciphertext : ').strip()
key = input('[>] Key : ').split()
re = RubikEncryption()
pt = re.decrypt(ct, key)
print('[+] Plaintext : {}'.format(pt))
|
988,253 | 6253b2114646a6153b78992dd5869a13c267cf8b | from lp.tools.scriptloader import ScriptLoader
from config import *
sl = ScriptLoader()
sl.dbname = ONTEST_DB_NAME
sl.user = ONTEST_USER
sl.host = ONTEST_HOST
sl.password = ONTEST_PASSWORD
sl.script_file = "dbscripts/schema.sql"
# sl.delete_old()
sl.execute()
|
988,254 | 52f84ef53f240b7d128b73538026f7c0631ec36c | n = int(input())
a = [int(input()) for _ in range(n)]
maxa = max(a)
# print(maxa)
if a.count(maxa) == 1:
b = sorted(a, reverse=True)
maxa2 = b[1]
for i in range(n):
if a[i] == maxa:
print(maxa2)
else:
print(maxa)
else:
for i in range(n):
print(maxa)
|
988,255 | 4ca781aeed2a30992ba0a89e2529fa00bfc5e762 | #!/usr/bin/python
import sys
import Adafruit_DHT
import time
import datetime
import paho.mqtt.publish as publish
channelID = "1136666"
apiKey = "3GXSCUY59YQ3M7YZ"
topic = "channels/" + channelID + "/publish/" + apiKey
mqttHost = "mqtt.thingspeak.com"
tTransport = "tcp"
tPort = 1883
tTLS = None
print("[INFO] Data prep... |
988,256 | 95319efc4b4e1ead27fb3ed70db4b743def53722 | #model list=[Encoder,Discriminator_z, Discriminator_x,Generator,Phi,InvPhi]
import torch
from torch import nn,optim
import itertools
from functional.functional import noise_vector
from .loss import *
def joint_train(model_list,train_load,num_epochs=30,device=None):
for epoch in range(num_epochs):
t_sta... |
988,257 | 2dab6861e0bc503926964c519956769f3b7c35dc | # this function calculates the flow rate in the Bernoulli Table
def calc_gpm(kfactor, psi, emitterexponent):
return kfactor * psi ** emitterexponent
|
988,258 | 9efe39f0b44f61f3de4063e0c6ea47f43ce12318 | from pyquat import Quaternion
from math_helper import norm, skew
import numpy as np
# for i in range(100):
q = Quaternion.random()
# q = Quaternion.from_axis_angle(np.array([[0, 0, 1]]).T, np.pi/2.)
yaw_true = q.yaw
v = np.array([[0, 0, 1]]).T
beta = q.elements[1:]
beta /= norm(beta)
alpha = 2.*np.arccos(q.elements[0,... |
988,259 | 3b6af96b356a98c374caf92ec6d8241a8924365c | import pymongo
# connect with a client or create a new one
myclient = pymongo.MongoClient()#"mongodb://localhost:27017/")
myclient.list_database_names()
# look for table or create a new one
mydb = myclient["orderbook"]
mydb.list_collection_names()
# look for collection or create a new one
mycol = mydb["BTCUSDbitfinex"... |
988,260 | b817a5e35694df78d99306ab195f5fa3bd60c4c9 | from .packages import os, Cipher, algorithms, modes
from .default_config import generator_name_list
def generator_import(generator_name, current_file_size, seed_length=None):
if generator_name == "basic_randint":
from .generator_classes.basic_randint_functions import CurrentGenerator
generator = C... |
988,261 | f35b30b73ed8c222f21207946c42f6bc606ee963 | #!/usr/bin/env python
from distutils.core import setup
from setuptools import find_packages
from glob import glob
setup(
name="dynmen_scripts",
version="0.1.0",
url="https://github.com/frostidaho/dynmen_scripts",
author="Idaho Frost",
author_email="frostidaho@gmail.com",
description="A collec... |
988,262 | 3872e5c5c3cd6b092372b62bb254ed347cae24b6 | from flask import Flask
import settings
import os
#initialize Flask
app = Flask(__name__)
# redundant
@app.route('/')
def home():
return
#shutdown Raspberry Pi
@app.route('/shutdown')
def shutdown():
os.system("sudo shutdown -h now")
#parse the settings and colors to the set
@app.route('/<method>/<color>/<... |
988,263 | 36a491c3c8f5ca6e80cd26ae05b8e50b306b30ca | def soltion():
T = int(input())
#1부터 최대값까지의 세제곱들의 해시맵을 만들어놓음
mDict = {}
for i in range(pow(10, 6) + 1):
mDict[pow(i, 3)] = i
keys = mDict.keys()
for test_case in range(1, T + 1):
printString ="#"+ str(test_case)
n = int(input())
if n in keys:
print(pri... |
988,264 | 2884d66689a5cb0a6e66204a72d485c569e36717 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright (C) 2016 Canonical
#
# Authors:
# Didier Roche
#
# 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.
#
# This program is distri... |
988,265 | 8de84162abbe1656b3abadfa39007074e6314b0a | # U06_Ex13_toNumbers.py
#
# Author: Grace Ritter
# Course: Coding for OOP
# Section: A2
# Date: 29 Jan 2019
# IDE: PyCharm
#
# Assignment Info
# Exercise: 13
# Source: Python Programming
# Chapter: 6
#
# Program Description
#
# This program allows the user to enter numbers into a list where the numbers a... |
988,266 | 0a450bcb0bdfe7ba5da0be0b19c81c43c5820128 | from torch.utils.data import Dataset, DataLoader
import numpy as np
import scipy.io as sio
from PIL import Image
import os
import matplotlib.pyplot as plt
import torch
import torchvision.transforms as transforms
ipm_params = {
'FRONT_LEFT':
{
'quaternions' : [ 0.6... |
988,267 | 35e2182427da309f4d31631b20127c84c02812d9 | from weapon import Weapon
import unittest
class TestWeapon(unittest.TestCase):
def test_weapon_init(self):
test_weapon = Weapon("axe", 20, 0.2)
self.assertEqual(test_weapon.type, "axe")
self.assertEqual(test_weapon.damage, 20)
self.assertEqual(test_weapon.critical_strike_percent, 0... |
988,268 | fd5e896cff96406596a15301ef802470d9e3a965 | import time
import math
import copy
p=[]
pyhz={}
def load_pyhz():
file=open('pyhz')
for l in file.readlines():
line=l.split()
k=line.pop(0)
pyhz[k]=line
def veterbi_level(py):
lvl={'all':0.0}
for hz in pyhz[py]:
lvl[hz]={'p':0.0,'str':hz}
f=open(hz+'.txt')
... |
988,269 | c5bf699240f81845811a50ee3ea64faa0f667b56 | from string import ascii_lowercase
def read_file(file):
dependencies = []
with open(file,'r') as read_lines:
for line in read_lines:
dependency_step = line[5]
_, current_step = line.split('step ')
current_step = current_step[0]
dependencies.app... |
988,270 | 1eb0db6ed9abc5ac1a1f7e14eda392c6ad9fc974 | # from sklearn.feature_extraction.text import TfidfVectorizer
# tfidf_vectorizer = TfidfVectorizer(max_df=0.8, max_features=200000,
# min_df=0.2, stop_words='english',
# use_idf=True, tokenizer=tokenize_and_stem, ngram_range=(1,3))
# tfidf_matrix = tfi... |
988,271 | aca01265859016b0830ea8c5a27f0eea2ce5d399 | import oauth2 as oauth
from tweepy import OAuthHandler
import pickle
import os
import requests
from config import *
class Utils:
# CONSUMER_KEY = "2WT1TSU4IlVNUgX9hUB2hkEwp"
# CONSUMER_SECRET = "Bfh9WFZA4jUlGZj3DqgzhD8ecJ7zL78PDUYKQcM45WQofPoGUM"
# OAUTH_TOKEN = "767206872-duSzf95K69mSe0QvKXZRJtx0M... |
988,272 | 0350a323064d76d630d4f00b886c50c23800fc42 | class Solution(object):
def listCombinations(self, list1, list2):
rLst = []
for i in list1:
for j in list2:
rLst.append(i+j)
return rLst
def letterCombinations(self, digits):
"""
:type digits: str
:rtype: List[str]
... |
988,273 | 11e6763447211882b06237338c31173cd660dd81 | def num(a,b):
for i in range(1,(b+1)):
print(i,end='')
a=int(input())
num(a)
|
988,274 | 03b6e13dfc75c8c9ce7df4d70f1a724cd2d34c0d | import re
var_dict = {}
# write your code here
def calculation(list_of_operations):
subtraction = False
result = 0
for operation in list_of_operations:
if operation.lstrip("+-").isnumeric():
if subtraction:
result -= int(operation)
else:
res... |
988,275 | f5fa75117f7c2a8d0ec23b630c4170c570d5078b | #!/usr/bin/env python
# coding: utf-8
'''
File Name: direct_arID_trSc.py
Edit Time: 20180422 1926
Content:
match the trackID in di_arID_trID to score from user_track
func:
match_ID_score(file_ID, file_score, file_out)
change the ID in file_in1 to score in file_in2
num1
Version:
1.0
'''
... |
988,276 | 485e7db3ffc571aa2a4c5631e9feb8914887e155 | # coding: utf8
from __future__ import unicode_literals, print_function, division
from collections import Counter
from clldutils.path import Path
from pylexibank import util
def test_aligned():
assert util.aligned([('a', 'b'), ('xxx', 'yyy')]) == ' a b\n xxx yyy'
def test_jsondump(tmpdir):
fname = str(... |
988,277 | 43a23c59a0bcacfb56af433a75856a14127b2f6e | from Parser import get_sorted_data
import json
"""
The data is now parsed as a JSON file that can be ingested
by a higher level entity. This issue now, however, is that we
wish to decrease the amount of data we are sending to reduce traffic. One method is
to apply a moving average filter.
Modify `get_sorted... |
988,278 | e71e47b473c6b3b3757c6b486cbb450ca494623c | # put your python code here
length = int(input())
width = int(input())
height = int(input())
def sum_of_edges(l, w, h):
s = 4 * (l + w + h)
return s
def surface_area(l, w, h):
S = 2 * (l * w + w * h + l * h)
return S
def volume(l, w, h):
V = l * w * h
return V
print(sum_of_edges(length, ... |
988,279 | 56712cfbf9dbdde1d2af8ec03a495beb07d5d956 | from .base_reconstructor import BaseReconstructor
from .raw_reconstructor import RawReconstructor
from .model_reconstructor import ModelReconstructor
|
988,280 | 9805fa8e4d37a54080974bc791671eecb66cbb8c | # Author: Aniketh S Deshpande
# API-name: StudentDashboard
# Flask-Server
# Database: MongoDB
from flask import Flask, request, jsonify
from flask_restful import Resource, Api
from flask_pymongo import PyMongo
from flask_cors import CORS
from random import randint
from hashlib import sha1
from config import get_ip
fro... |
988,281 | 7411f4a27867bb1d2e15cb69c03c7462b0dc461e | import os
class Config(object):
SECRET_KEY=os.environ.get("SECRET_KEY") or "secret_string"
MONGODB_SETTINGS = { 'db' : 'MY_BANK' ,'host' : os.environ["DB_PORT_27017_TCP_ADDR"] , 'port': 27017}
|
988,282 | d246134bc8457297e33e3494f64a2a3f977b8a1f | # coding=utf-8
from __future__ import print_function
import sys
# if len(sys.argv) != 4:
# print('Usage:')
# print('python train.py datacfg cfgfile weightfile')
# exit()
import time
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import torch.backends.cudnn a... |
988,283 | 63c36d352f0ec6d1449f6a092926616aa3ae2b5f | from __future__ import annotations
from iotbx.detectors.hamamatsu import HamamatsuImage
from dxtbx.format.FormatSMVADSC import FormatSMVADSC
class FormatSMVHamamatsu(FormatSMVADSC):
@staticmethod
def understand(image_file):
size, header = FormatSMVHamamatsu.get_smv_header(image_file)
wante... |
988,284 | d1619e8d8c34b4aee40dbea7c0b5fdfc01c209d3 | """Unit testing."""
import unittest
from unittest.mock import patch
import dice_hand
from dice_hand import Dicehand
from dice import Dice
class TestingDiceHand(unittest.TestCase):
"""Tests dice hand class."""
def test_init(self):
"""Tests initializer and its properties."""
hand = Dicehand()
... |
988,285 | 595579eb45c4db2af52c180c83b3133dac7227f0 | import pdb
import numpy as np
np.random.seed(211)
import pandas as pd
from toposort import toposort_flatten
from collections import defaultdict
import multiprocessing
from pgmpy.readwrite import BIFReader
from pgmpy.factors.discrete import TabularCPD
from pgmpy.sampling import BayesianModelSampling
class BnNetwork():... |
988,286 | 194579d5a1d415fbaa3d3382d0513b1c0a10c4a6 | #maximum number of skeleton
nMax = 2
#Correcting location of skeleton
offset={'x':-5, 'y':-55}
connecting_joint = [1, 0, 20, 2, 20, 4, 5, 6, 20, 8, 9, 10, 0, 12, 13, 14, 0, 16, 17, 18, 1, 7, 7, 11, 11]
body_colors = [(255, 0, 0), (0, 230, 0)]
joint_colors = [(0, 0, 160), (64, 0, 128), (255, 128, 64), (64, 128, 128)... |
988,287 | b50c41db95a156a331ceda7cd8e6ee362c1f1198 | ../../../../../../share/pyshared/nova/openstack/common/excutils.py |
988,288 | cbab68d568c58f07cdcd8383aaa5cea9fd226194 | import filecmp
def loop_check(j):
# Compare every <pair>_strategy_j-1.txt to <pair>_strategy_p.txt (p<j-1) to make sure we aren't in a loop
global output
if j < 2: return True
for p in range(1, j-1):
print(p)
all_clear = False
for pair in pairs:
if not filecmp.cmp(ou... |
988,289 | ea2ba4012023678a4ec729c6112c5b1cd283b5bd | #coding=utf-8
import setting
import browser as bo
from db.SQLModel import Record2DB
from logs.log import Logger
Log = Logger(__file__)
Rdb = Record2DB()
class Actions(object):
def __init__(self, driver, conf):
self.d = driver
self.conf = conf
def select_size_color(self):
... |
988,290 | f6640aa2f28190a2cef00ea060ec5d7bfa98b986 | """Definitions for Mikrotik Router binary sensor entities."""
from dataclasses import dataclass, field
from typing import List
from homeassistant.helpers.device_registry import CONNECTION_NETWORK_MAC
from homeassistant.helpers.entity import EntityCategory
from homeassistant.components.binary_sensor import (
BinaryS... |
988,291 | 32ce0cff87b2b86f6c30a530b0149dd1cbc989e4 | '''
Paweł Kruczkiewicz
Problemem przy wykasowaniu jednego klucza z tablicy z haszowaniem z adresowaniem otwartym jest przerwany ciąg liczb o tym samym kluczu.
Element o kluczu k1 mogł zostać wstawiony w miejsce T[k1+c], gdzie w bardzo pesymistycznym przypadku (bardzo bardzo pesymistycznym) c jest niemal równe bądź rów... |
988,292 | eb11e0dac892079ea84b8f89b1018024fbf22742 | from abc import ABCMeta, abstractmethod
from future.utils import with_metaclass
class CodeDriver(with_metaclass(ABCMeta, object)):
"""CodeDriver is the parent of all code drivers. Any child must implement the methods below
Methods
-------
create_ref()
add remaining files, make a commit and ad... |
988,293 | 83a1eafdec66d4601d335b9b3009f953d6759c35 | #!/usr/bin/python3
'''
Defines the Place class
'''
from models.base_model import BaseModel
class Place(BaseModel):
'''Places for Hbnb application
Attributes:
city_id (str): will be the City.id
user_id (str): will be the User.id
name (str): name of the Place
description (str): ... |
988,294 | e626af480990905be1124e36f445b9b969c9c34d | config = {
'host': 'http://www.dm5.com',
'get_news_path': '/manhua-new/dm5.ashx?action=getupdatecomics&d=',
}
|
988,295 | 9008cf6a5e828f2f8716be0ab5d879833916b4c2 | print ('hello, django girls!')
participant = {'name': 'Lindy', 'city': 'Groningen'}
if 3>2:
print (participant)
|
988,296 | 53eb26eb7de4718dbd3e43f49b230ba5f6fc14a0 | import time
import sys
import ibmiotf.application
import ibmiotf.device
import random
#Provide your IBM Watson Device Credentials
organization = "1o823s"
deviceType = "raspberrypi"
deviceId = "123456"
authMethod = "token"
authToken = "123456789"
# Initialize GPIO
def myCommandCallback(cmd):
pri... |
988,297 | 99202022fadef66ffd76ced06d703e96133887cd | import re
from rest_framework import serializers
from apps.NetBanking.models import Users, Account, Transactions , AccountTransaction
from django.core.validators import RegexValidator
from django.utils.translation import ugettext_lazy as _
from django.contrib.auth.models import User
from datetime import datetime
clas... |
988,298 | 7280af1e7bebd8a21e91c0707167e07bf244811a | import os
from iris.command import Command
from iris.logger import Logger
from iris.type import Email
class EmailHintCommand(Command):
name = 'emailhint'
description = 'Guess domain of censored email'
@Command.execute
def run(self, email: Email):
email_name, email_domain = email.split('@')
... |
988,299 | 01774c08e2031a5116d4e7bc4ca808944b03599b | from copy import deepcopy
from flask import Flask
from flask import jsonify
from flask import request
import urllib.request
import json
import threading
threadLock = threading.Lock()
UNIQUE_GAME_ID = 0
app = Flask(__name__)
@app.route('/api/')
def hello():
return jsonify("test")
@app.route('/api/get_message',... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.