blob_id
large_string
repo_name
large_string
path
large_string
src_encoding
large_string
length_bytes
int64
score
float64
int_score
int64
detected_licenses
large list
license_type
large_string
text
string
download_success
bool
6c3f6777bbf0cc8429ff8ec8ca8c48bb5e16946e
Harsh1347/Flask
/FlaskML/app.py
UTF-8
791
3.015625
3
[]
no_license
from flask import Flask,render_template,request import pandas as pd from sklearn.linear_model import LinearRegression import numpy as np app = Flask(__name__) @app.route('/') def index(): return render_template('index.html',val = {"pred":""}) @app.route('/predict',methods = ['POST','GET']) def predict(): da...
true
895be2d6afd001487c0d563f3976c475b2000507
kojitaniguchi/isucon-summer
/usr/lib/python3/dist-packages/glances/plugins/glances_hddtemp.py
UTF-8
3,805
2.609375
3
[]
no_license
# -*- coding: utf-8 -*- # # This file is part of Glances. # # Copyright (C) 2015 Nicolargo <nicolas@nicolargo.com> # # Glances is free software; you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation, either version 3 of the Lic...
true
0562bf0ec01715a6ae66e576f698fdcbe0d4da90
bakedmacaroni/fatamorganaplaythroughbot
/main.py
UTF-8
20,647
2.578125
3
[]
no_license
import discord import random from discord.ext import commands from discord.utils import get bot = commands.Bot(command_prefix='/') @bot.event async def on_message(message): if message.author == bot.user: return if message.content.lower().startswith('hello'): await message.channel.send('Hi The...
true
257226986d3280ccc019e12b72ffbb2381ae43ed
kraft99/Simple-Django-Blog
/apps/follow/models.py
UTF-8
2,943
2.578125
3
[]
no_license
from django.core.exceptions import PermissionDenied from django.http import Http404 from django.conf import settings from django.contrib.auth import get_user_model from django.db import models User = get_user_model() class Follow(models.Model): """ Model - Follow Model """ to_user = models.ForeignKey(settings....
true
cf68ed4dab92ae0516f4f7e4bc5119f5ddc47986
zittoooo/Algorithm
/python/14503.py
UTF-8
1,098
3.203125
3
[]
no_license
dx = [-1, 0, 1, 0] dy = [0, 1, 0, -1] def turn_left(): global d d -= 1 if d == -1: d = 3 n, m = map(int, input().split()) # 행, 열 크기 입력 r, c, d = map(int, input().split()) # 처음 x, y, 방향 좌표 board =[list(map(int, input().split())) for _ in range(n)] vis = [[0] * m for _ in range(n)] # ...
true
b6ff1c4d5c2c5a5f11d53738172824738729f341
hoanguyentat/AlgorithmHust
/week2b/virtualfriends.py
UTF-8
1,252
2.6875
3
[]
no_license
# Doc du lieu dau vao theo tung dong va luu vao mot list da duoc khai bao # Doi voi moi mot lan co them mot cap ban se luu ket qua vao mot mang khac # Cap ban thu i se kiem tra tung nguoi mot xem co trong cac cap ket qua tu 0 -> i-1 k # Neu co thi them vao ket qua thu i, kiem tra trung lap # (Noi hai mang ma chua hai...
true
2a68626afd334c2a647b26df5f177747e3c946a2
Abulala10/turn_on_led
/server_side_buzzer.py
UTF-8
1,195
3.359375
3
[]
no_license
import socket import RPi.GPIO as gpio from time import sleep print('>>> Welcome Abulala Shaikh.\n>>> Simple program to turn the lights on and off from another computer.' '\n>>> Developer : ABULALA SHAIKH.\n') try: gpio.setwarnings(False) gpio.setmode(gpio.BCM) LED_PIN = 27 # Pin Number 27 on Raspberry pi. ...
true
c17feaace3d00d0ab7152ac45787b3b5722768f8
DiNAi/RandomWalk
/randomwalker.py
UTF-8
2,251
3.3125
3
[]
no_license
#!/usr/bin/python # # Escape time of a random walker from a cylinder with reflecting # boundaries on the left and open boundaries on the right. # PNG output of a single trajectory. # Habib Rehmann and Gunnar Pruessner # # $Header: /home/ma/p/pruess/.cvsroot/misc/randomwalkv4.py,v 1.1 2015/06/19 13:30:11 pruess ...
true
265ea9b7fef24c68ce7f370e9570552830cece49
L-dongkyung/ml_nlp
/toji/konlpy-basic.py
UTF-8
248
2.578125
3
[]
no_license
from konlpy.tag import Okt okt = Okt() malist = okt.pos("아버지 가방에 들어가신다.", norm=True, stem=True) print(malist) # 5가지 형태소 분석기가 있지만 Kkma 와 Oky 사용. 이중 Okt 가 품사를 잘 읽어 이것 사용.
true
51e292273a3289790f8ab47b191dc668e1458bb3
amirassov/spellchecker
/src/spellchecker.py
UTF-8
5,647
3.75
4
[]
no_license
from collections import defaultdict, Counter import re import numpy as np class Trie: def __init__(self): self.word = None self.probability = None self.children = defaultdict(Trie) def insert(self, word, probability): node = self for letter in word: ...
true
9ea29c359be6447494ed593873424b00b4242482
csbio-njust-edu/maresnet
/train_test_api/test_api.py
UTF-8
3,605
2.71875
3
[ "MIT" ]
permissive
""" test_api author Long-Chen Shen """ import time import numpy as np import pandas as pd import torch from sklearn.metrics import roc_curve, auc @torch.no_grad() def eval_training(net, dna_valid_loader, dna_test_loader, loss_function, softmax_output, args, epoch=0, df_file=None, log_dic=None, train...
true
62f92dbba0de850682a6f6e356b745d4e5be15fe
narmour/ravi_tic_tac_toe
/toe.py
UTF-8
14,261
3.453125
3
[]
no_license
import itertools import math import copy import random import heapq import numpy as np from sklearn.naive_bayes import GaussianNB ''' prints out the board ''' def printBoard(board): for i in range(len(board)): for j in range(len(board[i])): print(str(board[i][j]) + " ",end='') print...
true
ab46d992aed265c92945a62214bd2705a526b0f4
calebe-takehisa/repository_Python
/procedural_programming/ex012.py
UTF-8
508
4.375
4
[]
no_license
""" Faça um algoritmo que leia o preço de um produto e mostre seu novo preço, com 5% de desconto. SAÍDA: Qual é o preço do produto? R$XX.XX O produto que custava R$XX.XX, na promoção com desconto de 5% vai custar R$YY.YY """ # Minha solução: preco = float(input('Qual é o preço do produto? R$')) desconto = 5 ...
true
a9aaccd19d0bb8a66bd0c047e665030dbfdf2fce
sebastian-borg/object-area
/main.py
UTF-8
6,548
2.734375
3
[]
no_license
import cv2 import cv2.aruco as aruco import numpy as np def closest_point(point, point_list): point_list = np.asarray(point_list) deltas = point_list - point dist_2 = np.einsum('ij,ij->i', deltas, deltas) return np.argmin(dist_2) def mark_point(point, frame): return cv2.circle(frame, (int(point[0...
true
77c4f521570f8570ff699d9edf1c9ab08bbffad7
pedromarchenaz/taller_uno_python
/secuenciales.py
UTF-8
4,832
3.984375
4
[]
no_license
# -*- coding: utf-8 -*- """ Created on Wed Feb 24 08:51:55 2021 @author: PedroLuis """ # Ejercicio 1 *********************** vp1 = float(input('Digite el valor de la persona 1: $')) vp2 = float(input('Digite el valor de la persona 2: $')) vp3 = float(input('Digite el valor de la persona 3: $')) total = vp1 + vp2 + vp...
true
d3c4c3a3a4d45aafda47d623dc1b1718efc06a35
pik94/coursera_machine_learning_and_data_analysis
/course_3/week_1/banners/preprocessing_data.py
UTF-8
1,989
3.21875
3
[]
no_license
import re import numpy as np import pandas as pd from sklearn.cluster import MeanShift def write_to_csv(data, file): """ Метод пишет данные в csv-файл. Входные данные подаются в виде списка. В файле будет строка вида: text1,text2,text3,text4,text5\n :param data: список :param file: файл, куда надо...
true
728285642a7d41144b8f322b72aa53c972195d5a
molybdaen/Sentiment
/main/Main.py
UTF-8
565
2.578125
3
[]
no_license
__author__ = 'Johannes' import preprocessing.DictionaryImporter as dictio #amazonReader = dataio.AmazonReader('../../data') #amazonReader.importAll() #amazonReader.createCleanedDatasets() #amazonReader.createDictionaries(3) dictimporter = dictio.DictionaryImporter('../../data/dictionaries/DICT_Office_Products.txt', 4...
true
06a5eef34d2355288f115e7056f786cfcc7f3b4c
NurbekSakiev/Algorithms
/LeetCode/414_Third_Maximum_Number.py
UTF-8
958
2.875
3
[]
no_license
class Solution(object): def thirdMax(self, nums): first, second, third = None, None, None for i in nums: if first == None or second == None or third == None: if first == None: first = i elif second == None and i != first: ...
true
613190a95706b046d2f48c853e4f5e57a6929f25
kaspersky43/pente
/Player.py
UTF-8
501
3.140625
3
[]
no_license
class Player: """Abstract base class for a Pente player.""" def __init__(self, playerID, visualizer=None): """Initialize the player. playerID is either 0 or 1 with 0 first to move.""" self._playerID = playerID def playerID(self): """Return which position the player is in.""" return self._playerID d...
true
62a46649e446c1f1a6599bf396c4379dcd49128e
lsrigueira/TFG_StaticServer
/src/server.py
UTF-8
2,364
2.5625
3
[]
no_license
from http.server import HTTPServer, BaseHTTPRequestHandler from io import BytesIO import logging from basededatos import mybd url = "http://192.168.0.5:8000" myobj = {'somekey': 'somevalue'} prueba = mybd() class SimpleHTTPRequestHandler(BaseHTTPRequestHandler): def do_GET(self): print(self.headers) ...
true
235c3c5a39c23253ed26f7d4d636fbd24506f129
qq1512050510/pythonTensorflow
/src/linearRegression/linearRegression3_2.py
UTF-8
1,369
2.734375
3
[]
no_license
#-*- coding:utf-8 -*- ''' Created on 2019年1月21日 @author: adp ''' import tensorflow as tf import numpy as np # import matplotlib.pyplot as plt #from tensorflow.core.framework import cost_graph_pb2 import matplotlib # compatibility mac matplotlib.use("TkAgg") from matplotlib import pyplot as plt learni...
true
75f3cc1b670c16994fa6044c844657c0f8ecf1f2
tricahyoedi/digital-talent
/Buku/00. A Practical Introduction to Python Programming/1.3 second program.py
UTF-8
165
3.796875
4
[]
no_license
num1=eval (input ('Enter the first number:')) num2=eval (input ('Enter the second number:')) print ('The average of the numbers you have entered is', (num1+num2)/2)
true
239a32bab0dbd641e7674e437201ee89a4c668b7
mouseman09/python-session1
/MY-CODE/PROJECT1/main.py
UTF-8
1,094
4.03125
4
[]
no_license
print("Thank you Lord") print(f"Test Add {200 + 300}") print(f"Test Multiply {200 * 300}") addMe = 30 + 60 print(f"Test Add thro variable: {addMe}") addMe_Multiply = 2 print(f"Test the add and multiply: {addMe * addMe_Multiply}") calculation_to_units = 24 name_of_unit = "hours" def days_to_units(): print(f"20 d...
true
2be9c9751b88d2a8d0dbf69312ecaf43630a58c4
MarynaOhorodnik/Colloquium_AP
/57.py
UTF-8
4,335
3.421875
3
[]
no_license
''' Відомість на зарплату представлена як дві таблиці. Одна містить прізвища працівників цеху, а друга - їх зарплату за поточний місяць. Знайдіть прізвище працівника, зарплата якого найменш відхиляється від середньої зарплати всіх працівників за поточний місяць. Знайдіть прізвища двох працівників з найбільшою заробі...
true
cadbc08703e640e5cd953838c1badeb5383ea472
dashlers/toolgasm
/emails/query_vt.py
UTF-8
2,888
2.75
3
[]
no_license
import requests import csv import time def query_vt_hash(hash): time.sleep(15) url = 'https://www.virustotal.com/vtapi/v2/file/report' params = {'apikey': 'VT API KEY HERE', 'resource': hash} retry_on_exceptions = ( requests.exceptions.Timeout, requests.exceptions.ConnectionError, ...
true
53bbdcd51b8f10682e75001be6138c46f04f72db
UWPCE-PythonCert-ClassRepos/Self_Paced-Online
/students/AleGuardia/Lesson02/series.py
UTF-8
1,456
4.75
5
[]
no_license
"""Function that returns the fibonacci and Lucas Numbers""" def fibonacci(n): """Takes n parameter and returns the nth fibonacci number""" return sum_series(n) def lucas(n): """Takes n parameter and returns the nth lucas number""" return sum_series(n,2,1) def sum_series(element,first=0,second=1): ...
true
e936f00be80c52888d261b4cbb1e9df69e33b9a7
jimmyyyeh/screen-master
/utils/utils.py
UTF-8
1,623
3.0625
3
[]
no_license
# -*- coding: utf-8 -* """ ┏┓ ┏┓ ┏━┛┻━━━━━━━┛┻━┓ ┃ ☃ ┃ ┃ ┳┛ ┗┳ ┃ ┃ ┻ ┃ ┗━┓ ┏━┛ ┗┳ ┗━┓ ┃ ┣┓ ┃ ┏┛ ┗┓┓┏━━━━┳┓┏┛ ┃┫┫ ┃┫┫ ┗┻┛ ┗┻┛ God Bless,Never Bug """ import os import sys cla...
true
7f39ffa7cb1c4ff0ff1fafaf46837e1640201d82
feipeixuan/pynote
/14asyncio/sample.py
UTF-8
3,388
3.109375
3
[]
no_license
import types import select import time import socket import functools class Future: def __init__(self, *, loop=None): self._result = None self._callbacks = [] self._loop = loop def set_result(self, result): self._result = result callbacks = self._callbacks[:] ...
true
89640fb0c11ea15a2a43fe96e6afc75e18a463a6
Charlie-kun/Python3-fundation
/DayStudy/DrawTree.py
UTF-8
294
3.53125
4
[]
no_license
#Use Recursive calls, draw a tree import turtle as t def tree(br_len): if br_len <=5: return new_len=br_len*0.7 t.forward(br_len) t.right(20) tree(new_len) t.left(40) tree(new_len) t.right(20) t.backward(br_len) t.speed(0) t.left(90) tree(70) t.hideturtle() t.done()
true
888142f6b66a6657f4283db6bd8580cd889a4831
IPeev1/HU-python-A
/3-tuples.py
UTF-8
212
3.1875
3
[]
no_license
letters = ('A', 'C', 'B', 'B', 'C', 'A', 'C', 'C', 'B') occurrences = list() occurrences.append(letters.count('A')) occurrences.append(letters.count('B')) occurrences.append(letters.count('C')) print(occurrences)
true
b9bad14b28630fc5c4fa03d9ca95017ba28b71db
sujoy98/Python
/qudratic.py
UTF-8
253
3.390625
3
[]
no_license
# cmath is for importing complex math module import cmath a = int(input('Enter a ')) b = int(input('Enter b ')) c = int(input('Enter c ')) d = (b**2) - (4*a*c) sol1 = (-b+ cmath.sqrt(d)) / (2*a) sol2 = (-b- cmath.sqrt(d)) / (2*a) print(sol1) print(sol2)
true
03999a1adaaa81398da316b77b3dca0292ee2102
Melissarobgar/Actividades_SEMANATEC
/Convolución_A01637961.py
UTF-8
1,764
3.359375
3
[]
no_license
""" By Benjamin Valdes code taken from https://github.com/benjaminva/semena-tec-tools-vision/blob/master/Scripts/Ejemplos/simple_conv.py Modified by Melissa Robles García A01637961 """ import numpy as np import cv2 import matplotlib.pyplot as plt def processImage(image): image = cv2.imread(image) ...
true
c53d8c4274a2d45e68ee86af744da38c9f794c3f
bwz3891923/LearningLog
/前8章/3.(1,2,3,4,5,6,7,9).py
UTF-8
1,130
3.140625
3
[]
no_license
my_friends=['Amy','Shark','Smug','Kat'] for name in my_friends: print(name) #3.1 print("How good day is it "+str(name)) #3.2 my_list=['Mura','Mati','Sukima'] #3.3 for Mise in my_list: print ("I want to visit "+ Mise) for inv in my_friends: #3.4 print("Hey, I invite you to my par...
true
0ed6e6544bd29f8511e5e74130190cbb2cb57cbe
andysai/python
/风变编程/python基础-山脚班/fb_14.py
UTF-8
451
3.40625
3
[]
no_license
import random import time def lucyly(luckylist): # 提示:将以下部分封装进函数 a = random.choice(luckylist) print('开奖倒计时',3) time.sleep(1) print('开奖倒计时',2) time.sleep(1) print('开奖倒计时',1) time.sleep(1) image = ''' /\_)o< | \\ | O . O| \_____/ ''' print(image) prin...
true
8fe81c3e2d08ce76a1ba1bdf0d142386903a955f
camicodina/CodingInterview-PythonExcercises
/Completed Exercises/string_reversal.py
UTF-8
546
4.78125
5
[]
no_license
# --- Directions # Given a string, return a new string with the reversed # order of characters # --- Examples # reverse('apple') === 'elppa' # reverse('hello') === 'olleh' # reverse('Greetings!') === '!sgniteerG' def reversal(string): list =[] list[:0]=string list = list[::-1] reversed = ''.joi...
true
aafffe74a4a64a6b0db8db2585dfeafdf0dae94e
menard-noe/LeetCode
/Add to Array-Form of Integer.py
UTF-8
673
3.203125
3
[]
no_license
import math from typing import List class Solution: def addToArrayForm(self, A: List[int], K: int) -> List[int]: A_integer = 0 index = 1 for i in reversed(A): A_integer += i * index index *= 10 res = A_integer + K res_array = [] if res == ...
true
79104295642a3a1c7a002a488821e5083b4ba54b
laurencefloriani/simulation
/chi_squarred.py
UTF-8
1,292
3
3
[]
no_license
import scipy.stats as stat import numpy as np def chi_squarred(observed, theorical): kr = np.sum(((observed - theorical) ** 2) / theorical) critical = stat.chi2.ppf(q=0.95, df=len(observed) - 1) return kr <= critical, kr, critical def chi_squared_uniform(observed): proba = 1 / len(observed) N =...
true
0a7adbce1dde4efc9440cde3c6b2147bbb6c709f
FSXAC/CPSC259
/Lab 5/CPSC259_Lab5/CPSC259_Lab5/generate.py
UTF-8
486
3.546875
4
[]
no_license
# generates a random series of webpages # -- square matrix # -- main diagonal is all 0s # -- output as .txt file import random N = int(input("Enter number of links: ")) # write to file file = open("web.txt", "w") for i in range(N): for j in range(N): if i == j: file.write("0") else: ...
true
ee33b143c28cbce4345dab44752dbb0d0c7887e5
xqterry/lightweight-human-pose-estimation.pytorch
/augment_test.py
UTF-8
1,286
2.578125
3
[ "Apache-2.0" ]
permissive
import os import torch import torchvision.transforms as T from PIL import Image import math import numpy as np from operator import itemgetter import cv2 def get_motion_blur_kernel(kernel_size, angle): M = cv2.getRotationMatrix2D((kernel_size / 2, kernel_size / 2) , angle, 1) motion_kernel = np.diag(np.ones...
true
080a71c118b8513b81e1d9fa2f47b6dacd0bc067
MrHamdulay/csc3-capstone
/examples/data/Assignment_7/chwmuf001/question1.py
UTF-8
307
3.46875
3
[]
no_license
#Mufaro Chiwara - 27 April 2014 # Get Input lis = input("Enter strings (end with DONE):\n") words =[] while lis!='DONE': words.append(lis) lis = input() print() print('Unique list:') newwords=[] #Find repeats for i in words: if i not in newwords: newwords.append(i) print(i)
true
87ce7e45ae05c47c7c62e57d2f4442d0a76b6768
LalithaRajesh/Test-Automation-Project-Using-Python-and-Selenium
/3_Click on the Image of the person.py
UTF-8
1,155
3.203125
3
[]
no_license
""" Test Case -3: Click on the Image of the person """ from selenium import webdriver import time import unittest from pages.aboutus import aboutUs """ The page searches for 'Chris Hulatt' and clicks his image. """ class Click_image(unittest.TestCase): @classmethod def setUpClass(cls): # Setting up h...
true
65e95f0aa6ab9115d1370da8aea3cf107ddbc82e
mGalarnyk/DataScienceInterview
/ToBreakDown/template.py
UTF-8
364
2.703125
3
[]
no_license
''' EDA * What are the feature names and types? * Are there missing values? * Are the data types correct? * Are there outliers? * Which features are continuous and which are categorical? * What is the distribution of the features? * What is the distrubiton of the target? * How do the variables relate to one another? '...
true
4b0a0fa841bb0ef4041af774e160a4d30ee6dc3f
LandRegistry/login-api
/tests/test_security.py
UTF-8
1,141
2.625
3
[ "MIT" ]
permissive
import pytest from service import security class TestSecurity: def test_get_user_password_hash_returns_same_hash_for_same_data(self): hash1 = security.get_user_password_hash('user1', 'password1', 'salt1') hash2 = security.get_user_password_hash('user1', 'password1', 'salt1') assert hash1 ...
true
821efb409889900bdfb69cf303f4e304c861a778
AngelCabrera/curso-python-intermedio
/dict_comprehensions_challenge.py
UTF-8
128
2.65625
3
[]
no_license
def run(): dict = {i : round(pow(i, 1 / 2), 2) for i in range(1, 101)} print(dict) if __name__ == '__main__': run()
true
7607cb44173c060b169ad6b3efdb46fcb102e900
Maram-Ankir/data-structures-and-algorithms
/python/code_challenges/array-binary-search/array-binary-search.py
UTF-8
554
3.421875
3
[]
no_license
def BinarySearch(arr,val): for i in arr : midVal =int((0+len(arr)-1)/2) if val==arr[midVal] : print('val found in index',midVal) break if val>arr[midVal]: midVal=int((midVal+len(arr)-1)/2) elif val==arr[midVal] : print('val found in index',midVal) break if va...
true
1a54bfae1f8512e3ec152e3877cb9b9725571cae
Elliott7/100days_of_code_projects
/Intermediate Plus Project - 34 - Quizzler app - 9-8.py
UTF-8
3,940
3.5625
4
[]
no_license
""" Project Thirty-Four - Quizzler App API driven quiz app using Tkinter GUI """ import requests as rq import html from tkinter import * THEME_COLOR = "#375362" NUMBER_OF_QUESTIONS = 10 class Question: def __init__(self, q_text, q_answer): self.text = q_text self.answer = q_answer class QuizB...
true
ec348e5adf271aa025b3cb1004e0eab4ddeb3c20
Aasthaengg/IBMdataset
/Python_codes/p03695/s025386054.py
UTF-8
553
2.8125
3
[]
no_license
N = int(input()) A = list(map(int,input().split())) check = [] every = 0 for a in A: if a < 400: check.append(1) elif a < 800: check.append(2) elif a < 1200: check.append(3) elif a < 1600: check.append(4) elif a < 2000: check.append(5) elif a < 2400: ...
true
10da6ef95569e684b71527aaf4526b627df15823
creightonr/feedcomp
/feedstore_ladot.py
UTF-8
2,045
2.59375
3
[]
no_license
import json import requests import csv import time city = 'lametro' stinfo = 'https://gbfs.bcycle.com/bcycle_%s/station_information.json' % (city) stdata = requests.get(stinfo) stationdata = json.loads(stdata.text) stations = stationdata["data"]["stations"] numst = int(len(stations)) i = 0 outputFile...
true
66b1d20012a03e72a4c9ce5b19a7217e86be3c0e
oseppala/roman
/tests/utils/test_importing.py
UTF-8
478
2.828125
3
[ "MIT" ]
permissive
import unittest from apluslms_roman.utils.importing import import_string TEST_DATA = "foobar" class TestImportString(unittest.TestCase): def test_invalid_import_string_raises_exception(self): with self.assertRaises(ImportError): import_string('tests.utils.test_importing.INVALID') def ...
true
2226ed8ffa57369de5b7c38fffdf056fb30eba69
atm98/Python
/fhg.py
UTF-8
123
2.953125
3
[]
no_license
nums=[4,5,6] msg="Numbers:{0}{1}{2}".format(nums[0],nums[1],nums[2]) print(msg) a="{x},{y}".format(x=5,y=12) print(a)
true
77fbe46adae97902d0e7e42e7f767005d45a6ced
kirkBurleson/BlackJack_Python
/blackjack.py
UTF-8
6,891
3.125
3
[]
no_license
import random class Player: hands = [] bets = [0,0,0,0] split_aces = [False, False, False, False] bet = 0 money = 50.0 class Game: DECKS = 4 SUITS = 4 cards = [2,3,4,5,6,7,8,9,10,'J','Q','K','A'] shoe = (cards * SUITS) * DECKS mark = len(shoe) - 12 pos = 0 playing = True def next_card(...
true
39fe0e5c621065f13545662d22f6b89bd1f77576
ncweinhold/nwurls
/templates/__init__.py
UTF-8
6,992
2.828125
3
[]
no_license
from web.template import CompiledTemplate, ForLoop def index(): loop = ForLoop() _dummy = CompiledTemplate(lambda: None, "dummy") join_ = _dummy._join escape_ = _dummy._escape def __template__ (error_msg=None, url=None, short_url=None): yield '', join_('<h1>Enter the URL you want to shor...
true
084be2fc3f5c6b7a7a29b96398bee4058538564d
TiagoMAntunes/AIOps2020
/submission/lib/test_trace_build.py
UTF-8
1,357
2.640625
3
[]
no_license
import pandas as pd import time import sys import random from utils.data_types import * from utils.trace import * if __name__ == '__main__': print(f'Testing {__file__}') if len(sys.argv) >= 2: nrows = sys.argv[1] else: nrows = 300000 print(f'Load test will have {nrows} spans') if...
true
6d1d6eab2fbf1a847f6a2aa24be626453d3b47ca
johnzhao96/johnzhao_projects
/cubic_splines/main.py
UTF-8
2,773
3.75
4
[]
no_license
""" main.py Runs and tests the Hermite Cubic Spline generator """ from math import sin, pi from hermite import smoothCubic_DEC, not_a_knot def poly(x): """ f(x) = x^3 + 2x^2 + 3x + 5 q = HermiteCubic([0,1,5,7], [5, 11, 195, 467], [3, 10, 98, 178]) """ x = float(x) return x*x*x + 2*x*x + 3*x + 5 def test_smoot...
true
2a85538abd42716813aed247c16282ead6519ac4
SmartCambridge/timetable_matching
/scripts/get_trips.py
UTF-8
9,199
2.71875
3
[]
no_license
#!/usr/bin/env python3 ''' Retrieve trip information Given a date, process SIRI-VM data in JSON for that day and spit out all unique vehicle trips (based on OriginRef, DestinationRef, OriginAimedDepartureTime, LineRef, OperatorRef, DirectionRef, and VehicleRef) where at least one of the origin or destination in a lis...
true
1b3e379f34d5396e13aa8f1194d550e7899d3f39
harshpreet130945/new-file
/DAY 1 TASK.py
UTF-8
107
2.609375
3
[]
no_license
#!/usr/bin/env python # coding: utf-8 # # DAY1 # In[4]: str="Python Intrnship Task 1." print(str[1:])
true
e69cf2371ef6febe8ca4abc016064128ae86b138
Sooho-Kim/Python_algorithm
/02.Codility/Codility_5_2.GenomicRangeQuery.py
UTF-8
1,100
2.90625
3
[]
no_license
# Task Score : 62, Correctness : 100, Performance : 0, 시간복잡도 N*M # def solution(S,P,Q): # result = [] # min_num = 5 # for i in range(len(P)): # for j in range(P[i],Q[i]+1): # if S[j] == 'A': # num = 1 # if S[j] == 'C': # num = 2 # i...
true
76da5c9c4d5c1a6d82fe7d44eff0abb37f7f68af
rubenwo/ml3
/streamlit_app.py
UTF-8
1,242
2.984375
3
[ "MIT" ]
permissive
import numpy as np import pandas as pd import streamlit as st from PIL import Image from tensorflow.keras.models import load_model from tensorflow.keras.preprocessing import image st.write(""" # Favorite Object detection CNN """ ) st.write("This is a simple web app to classify images...
true
c225db14e533c7d95477e7eea48c0293c20691b0
dailycal-projects/grades
/ucbgradedists/core/management/commands/import_all.py
UTF-8
1,207
2.65625
3
[ "MIT" ]
permissive
import glob from django.conf import settings from django.core.management.base import BaseCommand from core.models import * from import_csv import create_objects class Command(BaseCommand): help = """ Imports grade distribution data from the DATA_DIR. File names should be of the form '[season][year].csv', ...
true
04dfb3ce58c310bc310bedaf8a2c1ec0fbfe13b6
jackfischer/hackerrank
/datastructures/stacks/balancedbrackets.py
UTF-8
693
3.328125
3
[]
no_license
#!/bin/python3 import sys t = int(input().strip()) corresponds = {'(': ')', '{': '}', '[': ']'} for _ in range(t): s = input().strip() #print(s) stack = list() for c in s: if c in corresponds: #left bracket stack.append(c) elif len(stack) != 0: #right bracket ...
true
d181a7dbbc67e8091e3023f4e7e849d639a86caf
Forkeep/USYD-python
/q_food-menu.py
UTF-8
225
3.125
3
[]
no_license
f = open('food.txt', 'r') while True: line = f.readline() if line =='': print(line+'line shizheli') break else: arr = line.split(' ') print(arr[0]) print(arr[1]) f.close()
true
7885d68721ca1b76b658febfddca90889f2323e4
xiaoyangren6514/python_imooc
/re_study/test_python_re_other_method.py
UTF-8
532
3.328125
3
[]
no_license
""" match 从头开始查找 search 匹配查找指定的子串 """ import re str = 'imooc video num = 1000 and users = 1200' info = re.search(r'\d+', str) print(info.group()) infolist = re.findall(r'\d+', str) print(infolist) print(sum([int(x) for x in infolist])) def add_one(match): val = match.group() result = int(val)+1 return ...
true
70ded848988cfab8b4cb7f385b93e11268ad5144
codruby/AdminPanel
/adminPanel/account/auth_backend.py
UTF-8
803
2.609375
3
[]
no_license
'''Defines which authentication backend for registration app.''' from django.contrib.auth.backends import ModelBackend from .models import RabbitUser class RabbitUserModelBackend(ModelBackend): '''Authenticate AppUser''' def authenticate(self, login_id=None, password=None): ''' Method for a...
true
1803876882519801539c6ee70c5c13e5ce80cca2
YeabinMoonEcon/SafeGraphR
/code/aaa.py
UTF-8
8,116
2.6875
3
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Jul 30 22:02:33 2020 @author: yeabinmoon """ import pandas as pd import time import json WorshipPlace = pd.read_csv('/Users/yeabinmoon/Dropbox (UH-ECON)/Thesis/data/WorshipPlace.csv', index_col = 0) HolyPois = pd.read_csv('/Users/yeabinmoon/Dropbox (...
true
dec9102bc66a1698be0d095cdb6bbda6fb026dfa
andytrandaoanh/extract-sentences
/pdf_read.py
UTF-8
615
2.515625
3
[]
no_license
#!/usr/bin/env python import tika tika.initVM() from tika import parser import json file_path = "E:/FULLTEXT/ORIGINAL/BOOK 001_[BELKER Loren 2012] The First Time Manager 6th Edition.pdf" file_path2 = "E:/FULLTEXT/ORIGINAL/BOOK 003 [COVEY Stephen 2004] The-7-habits-of-highly-effective-people.epub" parsed = parser.f...
true
723716766a455745d2d407cbc1f34a04b7ef736b
SupakornNetsuwan/Prepro64
/test116.py
UTF-8
865
4.1875
4
[]
no_license
"""Func""" def func(): """Empire state""" levellist = [] err = False while True: level = input() if level == "-": break elif int(level) < 1 or int(level) > 5: print("Error! Not have this floor.") err = True break else: ...
true
a1b53ea2836af54daad7327f5d7e1bcf6ba2c27b
ana-mariatambur/07.10.20
/problema10.py
UTF-8
262
3.40625
3
[]
no_license
"""Afişaţi tabla înmulţirii cu numărul n.""" n=int(input("introduceti numarul n=:")) print(n,"*",1,"=",n*1) print(n,"*",2,"=",n*2) print(n,"*",3,"=",n*3) print(n,"*",4,"=",n*4) print(n,"*",5,"=",n*5) print(n,"*",6,"=",n*6) print(n,"*",7,"=",n*7)
true
cbbb13f845a6d96b1d635e5d0c71ce7c94964cc7
RaghavGirgaonkar/Pulsar-Profile-Comparison
/profilecomparison.py
UTF-8
7,461
2.78125
3
[]
no_license
#!env python3 import numpy as np import scipy.fft as fft import lmfit import statsmodels.stats.diagnostic as smdiag import os import pandas as pd import seaborn as sns # sns.set() def fft_shift(prf, Δ): """ Circularly shift a profile prf by fractional rotation Δ. Δ ∈ [0,1] This u...
true
2e85538eaefebe4fd60b804947cddc6dfea15630
ben-haim/investpy
/investpy/bonds.py
UTF-8
28,816
2.8125
3
[ "MIT" ]
permissive
#!/usr/bin/python3 # Copyright 2018-2019 Alvaro Bartolome @ alvarob96 in GitHub # See LICENSE for details. from datetime import datetime, date import json from random import randint import pandas as pd import pkg_resources import requests import unidecode from lxml.html import fromstring from investpy.utils.user_ag...
true
16c8221e33b3f8be9e7768d932026c078fe9fa99
ld-ing/ImageNet-edge-cases
/imgnet-val-resnet50.py
UTF-8
3,531
2.5625
3
[ "MIT" ]
permissive
#!/usr/bin/env python2.7 from __future__ import division # --- # Keras implementation of testing ResNet-50 on ImageNet 2012 Val. # Li Ding, Oct. 20, 2017 # --- import numpy as np import os import tensorflow as tf from keras.applications.resnet50 import ResNet50, preprocess_input, decode_predictions import xmltodict i...
true
6afd4a3d78d84a7106fa1832acf2c3fd16d1776d
Groupe05B/groupe05btd2
/tests/test_operators.py
UTF-8
440
2.546875
3
[]
no_license
"""doc""" from unittest import TestCase import operators import logic class OperatorsTests(TestCase): """-10""" def test_add(self): self.assertEquals(operators.add(2,3), 5) def test_mul(self): self.assertEquals(operators.mul(2,3), 6) def test_and(self): self.asser...
true
9b8ab36f89f74e7019ac285596b12c2603a22bfb
kelele67/Unix-Network
/FTP/ftpserver.py
UTF-8
3,293
2.828125
3
[]
no_license
# -*- coding:utf-8 -*- """ 使用SocketServer编写FTP服务功能 """ import SocketServer from SocketServer import ThreadingMixIn from SocketServer import TCPServer import os import time class MYTCPHandler(SocketServer.BaseRequestHandler): def confirm(self, username, password): if username == 'root' and password == 'pas...
true
5751c1d0487f6468d3a8d74221774fbde3bf5b9b
nomura-takahiro/study
/function.py
UTF-8
1,340
4.09375
4
[]
no_license
################################# ##### define function ##### ################################# def add(x): return x + 2 def point(x): x + 2 return # この場合やreturnがない場合はNoneを返す def total(x, y, z): return x + y + z ################################# ##### coding ##### #######################...
true
425c7cbc478f0633029eac46c6bd4492071d9cbb
thoughteer/edera
/edera/storages/inmemory.py
UTF-8
1,285
2.921875
3
[ "MIT" ]
permissive
import collections import threading from edera.storage import Storage class InMemoryStorage(Storage): """ A simple in-memory storage. This implementation is both thread-safe and fork-safe. """ def __init__(self): self.__records = collections.defaultdict(list) self.__offsets = co...
true
806f443f10a7c7dbcd398ea6840b23f1bac56944
lillami/fruit_store_backend
/run.py
UTF-8
1,538
2.921875
3
[]
no_license
#! /usr/bin/env python3 ''' To add fruit images and their descriptions from the supplier on the fruit catalog web-server, create a new Python script that will automatically POST the fruit images and their respective description in JSON format. To process the text files (001.txt, 003.txt ...) from the supplier-data/de...
true
705d4ecde96a7495da4b2fdf736e6768fd43672f
empresshu/python
/0131_2.py
UTF-8
82
2.96875
3
[]
no_license
c = int(input("섭씨온도를 입력해주세요 :")) F = 9/5*c + 32 print(F)
true
824224320855e2e094062703a67a6c23dde5d060
boyko11/ABAGAIL
/src/plotting_service.py
UTF-8
2,614
2.90625
3
[]
no_license
import numpy as np import matplotlib.pyplot as plt import sys import os.path def plot_learning_curve(title, x_label, results_file, dots, fill): if os.path.isfile(results_file): data = np.genfromtxt(results_file, delimiter=',') else: print("File {0} not found. Did not generate learning plot for...
true
14cf5c7bd7f7640725337ddea7086e32a1d78113
TBlauwe/COCOMA-FairDivision
/src/Database.py
UTF-8
1,087
3.109375
3
[]
no_license
# coding: utf8 import random class Database(object): AGENTS_NAMES_FILE = "resources/AgentsName.txt" ITEMS_NAMES_FILE = "resources/ItemsName.txt" def __init__(self, path_to_resources='../../'): self.agent_names_file = path_to_resources + Database.AGENTS_NAMES_FILE self.items_names_file =...
true
957914921684536cc8e74d04e84dab2e46aee541
PriyanshiPanchal/python
/Python Programs/offensive_words.py
UTF-8
1,195
3.25
3
[]
no_license
import re string = open('text.txt', 'r').read() string = string.lower(); mystring= re.sub('-.,;', ' ', string) # print(mystring) input_text=mystring.split(' ') # print(input_text) # lines=['python', 'is', 'an', 'interpreted,', # 'high-level,', 'general-purpose', 'programming', 'language.', # ...
true
f1e10f5ef3268dd52ff5ba4bf8dc06e2fd37d4a7
JulianBesems/PlaceBuildingsAI
/puzzle.py
UTF-8
13,796
2.796875
3
[]
no_license
import numpy as np from typing import Tuple, Optional, Union, Set, Dict, Any, List from fractions import Fraction import random from collections import deque import sys import os import json import itertools import copy, pickle, math from misc import * from genetic_algorithm.individual import Individual from settings...
true
9793e27761e8590cb00fc48d3b1cf46acfcb09d4
vdovychenko99/self-driving-car
/signal.py
UTF-8
436
2.609375
3
[]
no_license
def sig(mas): an=int((mas[3]+mas[2])/2) if (an<=5 and an>=-5): print("0") a=0 return a elif (an<=-5 and an>=-30): print("-1") a=-1 return a elif (an<=-30 and an>=-90): print("-2") a=-2 return a elif (an<=30 and an>=5): p...
true
168d794f69dfda4d6c69af3d858bd9ad47eea9ec
JulianThijssen/MySQL
/to_insert.py
UTF-8
430
2.828125
3
[]
no_license
in_file = open("KVR.csv", 'r') out_file = open("inserts.txt", 'w') added = 0; for line in in_file: cols = line.split("\t") if (len(cols) < 6): continue; insert = "INSERT INTO kamervragen (url,jaar, partij,titel,vraag,antwoord) VALUES ('{0}', '{1}', '{2}', '{3}', '{4}', '{5}');".format(cols[0], cols[1], cols[2], c...
true
19225b61896d28b7d725d671eb2151aa458b5d9b
khieu/rsa_referring_expression
/rsa.py
UTF-8
12,388
2.515625
3
[]
no_license
import numpy as np import math from collections import defaultdict BOUND=0.1 #0.6730116670092565 BASE=math.e NON_ZERO=0.0000000000000001 theta_type = 0.0007 theta_att = 0.0025 beta = 0.5 alpha = 1 RelationBetween = ['next to'] RelationAmong = ['the left', 'the right', 'the middle', 'the biggest', 'the bigger', 'the s...
true
b7740276ddff8e4543b7dfdfd614dd3565401b28
shlvd/Leetcode_Hackerrank
/Easy/factorial_trailing_zeroes.py
UTF-8
163
2.859375
3
[]
no_license
def trailingZeroes(n): assert n >= 0, n zeros = 0 q = n while q: q //= 5 zeros += q return zeros
true
286fbd76c4fe8a3265cdc68b173b7464096c1177
ICC3103-202110/proyecto-01-cortes_vicente
/cards.py
UTF-8
823
3.421875
3
[]
no_license
## Código creado por Juan Pablo Cortés y Gonzalo Vicente # --------------- Creación de clase Cards class Cards(): # -------------------- Atributos -------------------- def __init__(self, character, playable): self.character = character # character (str) self.playable = playable # playable ...
true
e4f801f294af2064b34303907a1818a3cce6b3f3
Aniezka/Python_2017-18
/hw11/hw11.py
UTF-8
2,133
3.5
4
[]
no_license
import re def read_file(): file_str = '' while file_str == '': filename = input('Введите имя файла: ') try: with open(filename) as html_file: file_str = html_file.read() # считываем файл в строку return file_str # и возвращаем ее except: ...
true
970971413f418e5bfdf1640c18271504f7ce5b28
jroivas/python-xmltreenode
/xmltreenode/xmlparser.py
UTF-8
8,281
3.25
3
[ "MIT" ]
permissive
"""@package xmlparser Primary XML parsing interface as well some other misc support functionality """ from __future__ import print_function from xmltreenode import XMLTreeNode from xml.etree.ElementTree import Comment from xml.etree.ElementTree import XMLParser class CommentParser(XMLParser): """Special class to...
true
75c6d45e49c3caffd078283b7927cb45812192b7
bright-night-sky/algorithm_study
/프로그래머스/level 1/최소직사각형.py
UTF-8
1,686
3.609375
4
[]
no_license
# https://programmers.co.kr/learn/courses/30/lessons/86491 # 각 명함의 가로 길이, 세로 길이가 들어있는 2차원 리스트 sizes가 매개변수로 주어집니다. def solution(sizes): # 모든 명함을 수납할 수 있는 가장 작은 지갑의 크기를 저장할 변수를 선언합니다. answer = 0 # 각 명함들의 사이즈를 [긴 길이, 짧은 길이] 형태로 저장할 리스트 변수를 선언합니다. long_width_sizes = [] # sizes에서 각 명함들을 하나씩 반복해봅니다. ...
true
c8e0bb5521ba0a2fd80df826672b8719e8a7f15b
nitslaszlo/Python
/03_Vezerlesi_szerkezetek/02_Elagazasok/01_Mfegy/main.py
UTF-8
1,369
3.5
4
[]
no_license
import math def main() -> None: # Másodfokú egyenlet gyökei (folyamatábrát (MFEGY_feladat.pdf) követve): print('Másodfokú egyenlet (a*x*x + b*x + c = 0) gyöke') print('Kérem az együtthatókat') a: float = float(input('a= ')) b: float = float(input('b= ')) c: float = float(input('c= ')) if a...
true
822fbf00d655dbfb822fdd84db7d6fef33e067f6
aewhite100/FV-Benchmark
/lib/convert_c_numpy/opencv-ndarray-conversion/test.py
UTF-8
1,713
2.984375
3
[ "MIT" ]
permissive
#!/usr/bin/env python import unittest import numpy as np try: import examples except ImportError: raise ImportError('Could not import the examples module. Did you run make?') class TestExamples(unittest.TestCase): ''' Tests for the examples module. ''' def test_vector_multiplication(self): ...
true
0b19e22643ebc76603aae0195d4223290e3e4394
mrdrozdov/detecting-linguistic-adjustments
/diora_utils.py
UTF-8
5,410
2.859375
3
[]
no_license
import collections import torch def build_chart(batch_size, length, size, repeat=1, init={}, dtype=torch.float, device=None): ncells = int(length * (1 + length) / 2) chart = {} chart['inside_h'] = torch.full((batch_size, repeat, ncells, size), 0, dtype=dtype, device=device) chart['inside_s'] = torch...
true
2cd37f112896a95861659a921a3cba192997a0cc
seongjaelee/ProjectEuler
/problem037.py
UTF-8
925
3.65625
4
[]
no_license
import problem import math from utility import * class Problem(problem.Problem): def __init__(self): number = 37 question = 'Find the sum of all eleven primes that are both truncatable from left to right and right to left.' problem.Problem.__init__(self, number, question) def getAnswer(self): def isTruncata...
true
123aac68b6da26874687eef13db72e193a936c5a
kschmidtdev/project404
/tools/classgen.py
UTF-8
1,330
3.21875
3
[]
no_license
classTemplateTxt = """/** * A one line description of the class. * * #include "XX.h" * * A longer description. * * @see something * * Project 404 2007 * * Authors: * Name, Date (Month Day Year), What was done */ #ifndef XX_h #define XX_h // SYSTEM INCLUDES // // PROJECT INCL...
true
a6be22fd5127b36cb45bb70fc4a369b3bdefeeff
cha63506/767_information_retrieval_project
/_1_parser.py
UTF-8
3,831
2.828125
3
[]
no_license
# Author: Young Liu # Purpose: Parse and Strip HTML/Javascript from HTML document collection '0.HTML/' from bs4 import BeautifulSoup as bsoup from html.parser import HTMLParser import os import pickle import re #------------------------------------------------------------------------------------------ # Cr...
true
94158287ad3fb51fd3ffe8bfa4548f4793086908
tuxfux-hlp-notes/Django-notes
/Batch-201/src/address/models.py
UTF-8
4,511
2.625
3
[]
no_license
from django.db import models # Create your models here. # https://docs.djangoproject.com/en/1.8/topics/db/models/#field-types # https://docs.djangoproject.com/en/1.8/ref/models/fields/ # If you dont define a primary key by default, you will get an autoincremented key value. # Day 5 - Modifying a field and adding a ne...
true
6cd156ebb9b5c9f5be543a1d2a490c7e115bcbb1
jettbui/JettBot-py
/cogs/moderation.py
UTF-8
3,187
2.796875
3
[ "MIT" ]
permissive
import discord from discord.ext import commands class Moderation(commands.Cog): def __init__(self, client): self.client = client @commands.Cog.listener() async def on_ready(self): print("Moderation commands loaded.") @commands.command() @commands.has_permissions(ban_members=True)...
true
39c58e06fb8430bd9cb57cad80b0d310c5023789
syuuuuukun/my_utils
/my_utils/net_utils.py
UTF-8
1,940
2.578125
3
[]
no_license
import random import os import numpy as np import torch from torch.nn import init def to_tensor(x): return torch.from_numpy(x) def to_numpy(x): return x.detach().cpu().numpy() def set_seed(seed=42,isgpu=False): random.seed(seed) os.environ["PYTHONHASHSEED"] = str(seed) np.random.seed(seed) ...
true
7d66cc7501560f9f33c882214018dcbecaadf7ca
secjoe88/pyqgfield
/pyqgfield/items/GLArrowItem.py
UTF-8
8,231
2.546875
3
[]
no_license
from pyqtgraph.opengl import GLLinePlotItem, GLMeshItem from numpy import * import time import logging import pyqgfield __all__=['GLArrowItem'] log=logging.getLogger(__name__) class GLArrowItem(GLMeshItem): def __init__(self,**kwds): """ ============== ============================================...
true
c25c88fb221a7f369ffdb1497f3412d236f3842e
popadrianc/learning_python
/Game/mods/registration.py
UTF-8
1,156
3.578125
4
[]
no_license
check = ["X", "admin", "Q"] def data(): input("This is a registration form. Press Enter to continue") username = str(input("Set a Username: ")) if (username in check) == True: print("Invalid username") data() else: password = input("Set a Passowrd: ") input("Pr...
true
c9864d6683541d94ed219da7eb4436523f858e4e
NeilWangziyu/Leetcode_py
/snakesAndLadders.py
UTF-8
4,838
2.796875
3
[]
no_license
# https://blog.csdn.net/XX_123_1_RJ/article/details/82901861 class Solution: def snakesAndLadders(self, board): """ :type board: List[List[int]] :rtype: int DFS wrong!!!!!!!!!!!! """ print("it is wrong method") row = len(board) col = len(board[...
true