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
2b1ce0f4690cbf4804c0319e464f415ae3c99063
MrDrDAVID/Python-practice-book
/dice.py
UTF-8
623
3.8125
4
[]
no_license
from random import randint class Die() : """Representation of a die""" def __init__(self, sides=6) : self.sides = sides def roll_die(self) : print('The number ' + str(randint(1, self.sides)) + ' has been rolled.') new_die = Die() new_die.roll_die() new_die.roll_die() new_di...
true
fc8812b6e3dff7ec21344bce52da82f9b6e167ef
nearih/ICPC-leuge
/485B(C).py
UTF-8
384
3.296875
3
[]
no_license
import math s1 = raw_input() x = [] y = [] for i in range(int(s1)): s2 = raw_input().split() x.append(int(s2[0])) y.append(int(s2[1])) disx= 0 disy=0 longest = 0 for i in range(len(x)): for j in range(len(y)): disx = abs(x[i]-x[j]) disy = abs(y[i]-y[j]) if(disy>disx): disx = disy if (disx>longest): lo...
true
43382bbe216d9aa2b456ae636806a2580449a45d
rmontique77/sweet-sensations
/Python_Programs/flashing_led_pi.py
UTF-8
235
2.640625
3
[]
no_license
# -*- coding: utf-8 -*- """ Spyder Editor This is a temporary script file. """ from gpiozero import LED from time import sleep led = LED(17) while True: led.on() sleep(1) led.off() sleep(1) print("Flashing LED")
true
0bf05709aa2d0487bdfd865be325583281ec671c
raindewGH/test
/20200409面试题61.扑克牌中的顺子.py
UTF-8
946
3.34375
3
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Date : 2020-04-09 10:31:39 # @Author : raind (848299610@qq.com) # @Link : http://raind.cc # @Version : $Id$ # 从扑克牌中随机抽5张牌,判断是不是一个顺子,即这5张牌是不是连续的。2~10为数字本身,A为1,J为11,Q为12,K为13,而大、小王为 0 ,可以看成任意数字。A 不能视为 14。 #   # 示例 1: # 输入: [1,2,3,4,5] # 输出: True #   # 示例 2: # ...
true
18e356f1994b94cfcaa153102c115f9ab0b1e6d8
rbshadow/Python_URI
/Beginner/URI_1018.py
UTF-8
960
4.0625
4
[ "MIT" ]
permissive
def math(): taka = int(input()) hundred = (taka / 100) hundred = int(hundred) fifty = ((taka % 100) / 50) fifty = int(fifty) twenty = (((taka % 100) % 50) / 20) twenty = int(twenty) ten = ((((taka % 100) % 50) % 20) / 10) ten = int(ten) five = (((((taka % 100) % 50) % 20) % ...
true
e599d37ce601f8728b881f9ca59b345e853c18d3
warrengalyen/PoetryAnalysis
/poetryanalysis/tests/test_poetics.py
UTF-8
2,998
2.671875
3
[ "MIT" ]
permissive
import os import unittest import poetryanalysis class TestPoems(unittest.TestCase): def open_poem(self, poem): with open(os.path.join('poetryanalysis/poems', poem)) as f: return poetryanalysis.tokenize(f.read()) def test_haiku(self): self.assertTrue(poetryanalysis.guess_form( ...
true
ccb2c97c5cacb55819daaf3ff1ae604f73240b7a
proydakov/inside-investment-banking
/solve.py
UTF-8
452
3.625
4
[]
no_license
import math # Квантиль # С какой вероятностью среди 60-ти реализаций случайной величины будет ровно 3 значения, превышающих 95-ю квантиль? Ответ дайте целым числом процентов. def soch(n, m): return math.factorial(n) / (math.factorial(n - m) * math.factorial(m)) res = 0.05 ** 3 * 0.95 ** 57 * soch(60, 3) print(re...
true
5924ea651cfc1269c8795ca2f4cd19626f9ed743
Iswar7892/touchreplay
/hex_to_dec.py
UTF-8
1,540
2.546875
3
[]
no_license
#!/usr/bin/env python # coding: utf-8 import sys import fileinput import subprocess prefix = "sendevent " inputline = "" complete = "" part1len = 0 part1 = "" part2 = "" num1 = 0 num2 = 0 num3 = 0 rawfile = "" outfile = "" filename = "" rawfile = sys.argv[-1] fo = open(rawfile, "r") filena...
true
b7ffe9312750ab6b8193dff414a12d1a9a67024b
GroupGO/Analysis
/fpkm_translator.py
UTF-8
6,681
2.8125
3
[]
no_license
""" author = Ronald de Jongh WUR #: 930323409080 [1] out_name: name of the file to be output (will add .fpkm_table) optional: [2] data_path: path to the genes.attr_table (cuffnorm output) [3] fpkm_path: path to the fpkm table (cuffnorm output) [4] genome_path_annotation: path to the gen...
true
ca94291e20559fd3371e0871e52fa545b1e8fc4b
czxxjtu/ACM_Conference_Paper_Crawler
/Conf Crawler/SQLConn.py
UTF-8
803
2.625
3
[]
no_license
import mysql.connector import time class QASQL(): # user = 'root' # pwd = 'autoqa' # host = '10.108.17.25' # db = 'autoqa' user = 'root' pwd = '30291912' host = 'localhost' db = 'crawler' conn = mysql.connector.connect(user=user, password=pwd, host=host, database=db) cursor = conn...
true
6f171e8739510a90f1664e631e856f2ea57111a2
msy53719/python-reptile
/util/testfile.py
UTF-8
987
3.265625
3
[]
no_license
str = 'abc1cd2df3' def getPos(str): for st in str: if st.isdigit(): sst = st if int(sst) == 1: pos1 = str.index(sst) str1 = str[0:pos1] * int(sst) elif int(sst) == 2: pos2 = str.index(sst) str2 = str[pos1 +...
true
7ce932eeeaa6db4e6b06886257f325a675f35d57
edu-athensoft/ceit4101python_student
/ceit_190910_zhuhaotian/py1003/decimal1.py
UTF-8
101
2.859375
3
[]
no_license
# python decimal a = 1.1 b = 2.2 c = 3.3 d = 3.3 print(a+b) print(c) print(a+b == c) print(c == d)
true
492721cd16a529de0a87eb5de4aab0aa36265520
bright-night-sky/algorithm_study
/CodeUp/파이썬 풀이/1205번 ; 최댓값.py
UTF-8
732
3.71875
4
[]
no_license
# https://codeup.kr/problem.php?id=1205 # readline을 사용하기 위해 import합니다. from sys import stdin # 실수 a, b를 공백으로 구분해 입력합니다. # 각각 float형으로 변환합니다. a, b = map(float, stdin.readline().split()) # a+b, a-b, a*b, a/b, a^b, b-a, b/a, b^a를 계산하고 리스트 변수에 넣어줍니다. # b+a, b*a는 각각 a+b, a*b와 같으므로 굳이 계산할 필요가 없습니다. operations = [a + b, a ...
true
2a30f1c1b6a904b9d7bd1bff3209a0743be7b5d1
zyhsna/Leetcode_practice
/problems/qian-zhui-he-by-tian-dao-yao-xing.py
UTF-8
484
2.859375
3
[]
no_license
# _*_ coding:UTF-8 _*_ # 开发人员:zyh # 开发时间:2020/8/7 17:47 # 文件名:qian-zhui-he-by-tian-dao-yao-xing.py # 开发工具:PyCharm def balancedStringSplit(self, s): """ :type s: str :rtype: int """ if not s: return 0 count = 0 res = 0 m = len(s) i = 0 while i < m: if count == 0: ...
true
de414627eda4ba8779b4819b389061e8facd016a
burnsnoss/Snackjack
/Table.py
UTF-8
1,304
4.09375
4
[]
no_license
import Player class Table: ''' Table - Like a container for players. Keeps track of minimum bet also ''' players = [] bet = 0 def __init__(self): # Ask for the minimum bet while True: min_bet = raw_input('\nWhat is the minimum bet? --> ') if self.checkMinBet(min_bet): break print 'Please enter ...
true
d17ab52b49c7e8d6c5a8b1da6dfcfbff016d5bba
Manjuguna/pythonpractice
/pow.py
UTF-8
63
2.984375
3
[]
no_license
import math a,b=map(int,input("").split()) x=pow(a,b) print(x)
true
2eaa11548605b4fdc928b8f45ea8ea16882f251f
Emmersynthies/CIT228
/Chapter9/user_class.py
UTF-8
1,307
3.640625
4
[]
no_license
class User: def __init__(self, first_name, last_name, username, phone, email): self.first_name = first_name self.last_name = last_name self.username = username self.phone = phone self.email = email self.login_attempts=0 def describe_user(self): pr...
true
0ac24e390657cc49c02e52b12ae0a63e9dc1e436
lmb-freiburg/contra-hand
/run_moco_qualitative_embedding.py
UTF-8
2,341
2.671875
3
[]
no_license
""" Script to produce the data for Figure 3 of the paper. """ import numpy as np import cv2, os import matplotlib.pyplot as plt from run_moco_fw import ModelWrap m = ModelWrap() data_path = m.base_path cossim = lambda x, y: np.sum(x*y)/np.linalg.norm(x, 2)/np.linalg.norm(y, 2) def show(path1, path2, save_to=None):...
true
dc0745f6078585a384b4c85556edfdbd7f8e8c26
lawfets/codewars
/K7_simpleBeadsCount.py
UTF-8
190
3.03125
3
[]
no_license
def count_red_beads(n): if n < 1: redBeads = 0 else: redBeads = (n - 1) * 2 return redBeads # def count_red_beads(n): # return (n - 1)*2 if n>1 else 0
true
401313f0453cf72e8a929f26ec6087f9d667f67d
SaiPrathekGitam/MyPythonCode
/inspired_again/product.py
UTF-8
316
4.1875
4
[]
no_license
# Program to illustrate classes class Product: def __init__(self, name, price): self.name = name self.price = price def print_details(self): print(self.name, self.price) # Creation of an object p1 = Product('Paper Clip', 10) p1.print_details() # print(p1.name)
true
713ada054dd86b8ea0b1488e1fa8fce0d88f27d6
mrblank1/as
/cryptography4.py
UTF-8
144
2.59375
3
[]
no_license
import hashlib a="" with open("first_logfile.txt","rb") as f: a=f.read() md5hash=hashlib.md5(a).hexdigest() f.close() print(md5hash)
true
03d821b4b6819b419991dd31e21e9ef9dc2f9713
judes77/museums-works-homework
/repositories/museum_repository.py
UTF-8
1,227
2.5625
3
[]
no_license
from re import S from db.run_sql import run_sql from models.work import Work from models.museum import Museum # Write your functions here def select_all(): museums = [] sql = "SELECT * FROM museums" results = run_sql(sql) for row in results: museum = Museum(row['name'], row['address'], row['id...
true
ad773c821aea77616bd32106da7245f24176e956
captainjack331089/captainjack33.LeetCode
/LeetCode_Array/830_Positions_Of_Large_Groups.py
UTF-8
1,272
4.0625
4
[]
no_license
""" 830. Positions of Large Groups Category: Array Difficulty: Easy """ """ In a string S of lowercase letters, these letters form consecutive groups of the same character. For example, a string like S = "abbxxxxzyy" has the groups "a", "bb", "xxxx", "z" and "yy". Call a group large if it has 3 or more characters. W...
true
233ae5422f7a7f49b457715812389902d354354d
mdcpablo/TOF
/src_old/TOF.py
UTF-8
24,790
2.8125
3
[]
no_license
import numpy as np import matplotlib.pyplot as plt from scipy import interpolate from numpy.polynomial.legendre import leggauss import os from operator import sub ''' def get_index(array, value): index = len(array) - 1 for i in range(len(array)): if array[i] >= value: index = i ...
true
bdba2a6d78b218d45d84e24c303646a2dcc12478
AdamZhouSE/pythonHomework
/Code/CodeRecords/2989/39200/303173.py
UTF-8
95
3.078125
3
[]
no_license
A = [] A.append(input()) A.append(input()) A.append(input()) A.sort() for x in A: print(x)
true
2c541d0b9e857a535fea05aae11307f0c79beea3
Saurabh4626/dsa
/BinarySearchTree/Make_BST_from_givenLIST.py
UTF-8
741
3.75
4
[]
no_license
class BinaryTreeNode: def __init__(self,data): self.data=data self.left=None self.right=None def makeBST(arr): if not arr: return None midelement=(len(arr))//2 root=BinaryTreeNode(arr[midelement]) root.left=makeBST(arr[:midelement]) root.right=makeBST...
true
ca6a53da2ebb9d425bd33332529a5de8cd9b9e5b
KrauserSan/CodeAbbey_SolutionSet
/src/modular_calculator.py
UTF-8
809
3.1875
3
[]
no_license
''' Created on Jun 7, 2017 Problem set: Codeabbey.com @author: vivpa ''' def func(init_val, usr_dat): ans = 0 for i in range(len(usr_dat)): if usr_dat[i][0] == '+': ans = ans + int(usr_dat[i][1]) elif usr_dat[i][0] == '*': ans = ans * int(usr_dat[i][1]) elif usr_d...
true
66077dd50cb70fdd88eef81cb04d06504c56f43a
juanesarango/cart-dht
/tests/test_api.py
UTF-8
3,082
3.109375
3
[]
no_license
import os import pytest from cart.api import app def test_api(): with app.test_client() as client: username = "jea265" upc_1 = "036000291459" upc_2 = "987243752377" checkout = False # flag to clean cart at the end # Initialize Empty Cart client.delete(f"/items/{u...
true
52da7dc2306bb535553e69d49a7888a22148bae0
jvictorhuguenin/pygames
/Space Invaders/main.py
UTF-8
1,254
3.140625
3
[]
no_license
import pygame import random #initialize pygame pygame.init() #create screen screen=pygame.display.set_mode((800 , 600)) #Title andd tools pygame.display.set_caption("space invaders") icon=pygame.image.load("space-invaders.png") pygame.display.set_icon(icon) #player player_img = pygame.image.load("space ship.png") p...
true
8aa3129a39f0ebaf8a816d50b9bbfc50dc251b40
mgallois/Robot-Poisson
/Outils/LilyPad (modifié)/Données/traitement.py
UTF-8
2,550
3.234375
3
[]
no_license
import numpy as np import matplotlib.pyplot as plt import math as m #fonction entre 0 et 1 def f (x,Amp=1): dilx=1 dily=2 Amp=Amp*dily x=x*dilx if x<=dilx/5: return 0 else : return (-m.cos(x)+m.cos(dilx/5))*Amp #^^^^^^^^^^^^^^^^^^^^^^^# # PROGRAMME ...
true
3a9f197c81385c9aa77dfe09b5f1808c12314fbc
Kwon-JH/gmvae-2
/scripts/vae.py
UTF-8
9,188
3.0625
3
[ "MIT" ]
permissive
from __future__ import absolute_import from __future__ import division from __future__ import print_function import tensorflow as tf import tensorflow_probability as tfp import base class VAE(object): """Implementation of a Variational Autoencoder (VAE).""" def __init__(self, prior, ...
true
8303f2eaa51a0150e6202daa6374409431e11de6
ZerethjiN/SweetNightmare
/Utils_Size.py
UTF-8
92
2.703125
3
[ "MIT" ]
permissive
class Size: def __init__(self, w = 16, h = 16): self.w = w self.h = h
true
bb2d3eb365797c3518657be81d85183e93b5fc6f
Roshini28/pythonpgm
/amst.py
UTF-8
161
3.375
3
[]
no_license
a,b=map(int,input().split()) for n in range(a+1,b): sum=0 tem=n while tem>0: dig=tem%10 sum+=dig**3 tem//=10 if n==sum: print(n,end=' ')
true
05a3955e755109f20a61dcd038140670cce4e40c
alvinooo/interview_2017
/algorithms/bit_magic/misc.py
UTF-8
232
3.15625
3
[]
no_license
def pair_bit_diff(l): diff = 0 for bit in xrange(32): num_set_bits = 0 for num in l: if num & (1 << bit): num_set_bits += 1 diff += 2 * num_set_bits * (len(l) - num_set_bits) return diff print pair_bit_diff([1,3,6])
true
150a615d094e9af0ba66d4f099a732759942b322
ckangyu/KancolleSetPicture
/KancolleSetPicture.py
UTF-8
2,135
2.953125
3
[]
no_license
import wx WIDTH = 240 HEIGHT = 240 class Drop(wx.FileDropTarget): def __init__(self, window): wx.FileDropTarget.__init__(self) self.window = window self.constrain = window.constrain def OnDropFiles(self, x, y, filenames): if self.constrain(x,y): return True ...
true
82c34caed152d5ac18bf27d69c921a55a7a91814
ALEGOVE03/Tarea1GomezPorras
/tarea1.py
UTF-8
1,997
4.15625
4
[]
no_license
# ----------------------------------------------------------------------- # -------------- Método para operaciones básicas ------------------------ # ----------------------------------------------------------------------- def basic_ops(op1, op2, sel): # Error cuando no se usa un entero if not(isinstance(...
true
bce72212d34f60b9ecbabce12ff11a404f8b2696
EJShim/vtkshader
/main.py
UTF-8
3,355
2.546875
3
[]
no_license
import vtk import os import random vertexShaderText = "" fragmentShaderText = "" #Get Shader Text with open("vertex.glsl", "r") as vertexShaderFile: vertexShaderText = vertexShaderFile.read() with open( "fragment.glsl", 'r') as shaderFile: fragmentShaderText = shaderFile.read() #Indicates Picked psoi...
true
f647f63bddc30df665bdd8b66cd117c5073d0d12
vaibhav950170/data-structure
/week2_algorithmic_warmup/2_last_digit_of_fibonacci_number/fibonacci_last_digit.py
UTF-8
214
3.421875
3
[]
no_license
# Uses python3 import sys def get_fibo_last_digit(n): a, b= 0,1 for i in range(2,n+1): c=a+b c=c%10 b, a=c, b return c n = int(input()) print(get_fibo_last_digit(n))
true
ad8ca3b635141c1112e921282b6d087d9bd19a64
ouyangyike/Inference-Algorithm
/logistic regression/softmax/soft_train_loss .py
UTF-8
744
2.65625
3
[ "MIT" ]
permissive
import numpy as np import tensorflow as tf import matplotlib.pyplot as plt from softmax import * #learing rate = 1,batch_size = 500, epoch=30, lamda = 0.01 logging = runSoftmax(1,500,30,0.01) plt.plot(logging[:,0],marker='h',label='learning rate = 1') #learing rate = 0.1,batch_size = 500, epoch=30, lamda = 0.01 log...
true
a42a9c55720280e1d5a817ef39c97018f2d3d454
athertahir/deep-learning-python
/chapter_09/06_zoom_augmentation.py
UTF-8
2,224
3.953125
4
[]
no_license
# %% ''' ## Random Zoom Augmentation A zoom augmentation randomly zooms the image and either adds new pixel values around the image or interpolates pixel values respectively. Image zooming can be configured by the zoom range argument to the ImageDataGenerator constructor. You can specify the percentage of the zoom as a...
true
03dd0e1991ae590b4de8984ec82337ced6c3f4f6
renanklehm/WM-Lages
/Tools.py
UTF-8
813
2.734375
3
[]
no_license
from PyQt5 import QtCore #SINGLETON# class ToolsMeta(type): _instances = {} def __call__(cls, *args, **kwargs): if cls not in cls._instances: instance = super().__call__(*args, **kwargs) cls._instances[cls] = instance return cls._instances[cls] class Tools(metaclass=To...
true
d0d1a0800b2777b67e232cdddfcba71d523eee30
libdwct/2019-KAKAO-BLIND-RECRUITMENT
/후보키(candidate key).py
UTF-8
1,599
3.578125
4
[]
no_license
''' name : ByeongJun Ahn nation : KOREA contact : 010-2736-5474 or ahnbj0@naver.com source : 2020 KAKAO BLIND RECRUITMENT "후보키" comment : index를 부여하는 알고리즘을 combination을 여러번 써서 구할 수도 있지만 powerset 알고리즘을 구현하여 로직을 작성하였다. ''' def check_min(v, candidate_key): for k in candidate_key: if all(i in v fo...
true
5313efc653ad16d1763fbb7a72afe6090bb5036d
Perlence/tyrannosaurus
/thesaurus/views.py
UTF-8
2,744
2.546875
3
[]
no_license
from collections import OrderedDict from django.db.models import Q from django.shortcuts import render from .models import Descriptor def query(request): q = request.GET.get('q') depth = get_param(request.GET, 'depth', default=1, type=int) if not q: return render(request, 'index.jinja.html') ...
true
13cd53d852ce0779d1fbfcd3ddf735fafc2c0635
mermora97/Chess-game-Project
/src/pdf.py
UTF-8
679
2.953125
3
[]
no_license
from fpdf import FPDF def createPdf(pdf): pdf.add_page() #Title pdf.set_font('Times',size=25) pdf.cell(200, 10, txt="Chess game report", ln=1, align="C") pdf.set_line_width(1) pdf.set_draw_color(0, 130, 0) pdf.line(20, 20, 200, 20) def addImagesToPdf(pdf): #Insert images imag...
true
d72698f7b6a4833586bcb833ac1929a882319138
landrea-velez/pyton-45
/listas_matrices/diccionarios.py
UTF-8
857
4.625
5
[]
no_license
# Teoria - Diccionarios # Definir un diccionario diccionario = {"rojo": "red", "azul": "blue", "amarillo": "yellow"} # Mostramos print("El color rojo en inglés es:", diccionario["rojo"]) print("El color azul en inglés es:", diccionario["azul"]) print("El color amarillo en inglés es:", diccionario["amarillo"]) # Agr...
true
41433a3818418c0dd90bfda4e508646eaf325de7
mackenzie4148/Titanic-example-data-analysis
/3. Statistic Analysis of Tickets.py
UTF-8
2,916
3.25
3
[]
no_license
# list fare_survivors stores the prices of some survivors' tickets, while list fare_victims stores the prices of some victims' tickets fare_survivors = [ 39.6, 79.65, 26.0, 49.5, 108.9, 211.34, 30.5, 63.36, 53.1, 16.7, 135.63, 49.5, 75.25, 83.16, 35.5, 53.1, 39.0, 57.98, 93.5, 26.39, 26.55, 39.4, 134.5, ...
true
d2833fd32bba4e7b13efcc40af40e9506d4f3953
Gompe/homemade-ANN
/trainingSets.py
UTF-8
3,672
2.921875
3
[]
no_license
import numpy as np from keras.datasets import mnist class mnistData: def __init__(self): (train_X, train_y), (test_X, test_y) = mnist.load_data() mnistData.train = clean(train_X, train_y) mnistData.test = clean(test_X, test_y) def clean(data_X, data_y): res = [] for X, y ...
true
5cdd7a3bdc2295619f0b8e6aaa6e16051c57cce3
antonioACR1/Python
/Using K-means clustering to predict location.py
UTF-8
3,716
3.703125
4
[]
no_license
#This code is to predict where a person lives using call records and k-means clustering #import pandas and matplotlib import pandas as pd import matplotlib.pyplot as plt import matplotlib matplotlib.style.use('ggplot') #read data df = pd.read_csv(r"C:\Users\Alcatraz\Documents\DAT210x-master\Module5\Datasets\CDR.cs...
true
0dd76e87d72d1586847e69c4debfbf170a10c495
aryoferdyan/Python-Projects-Protek
/Praktikum 08/PhytonProject13.py
UTF-8
786
3.21875
3
[]
no_license
nilaiMhs = [{'nim' : 'A01', 'nama' : 'Amir', 'mid' : 50, 'uas' : 80}, {'nim' : 'A02', 'nama' : 'Budi', 'mid' : 40, 'uas' : 90}, {'nim' : 'A03', 'nama' : 'Cici', 'mid' : 50, 'uas' : 50}, {'nim' : 'A04', 'nama' : 'Dedi', 'mid' : 20, 'uas' : 30}, {'nim' : 'A05', 'nama' : 'Fi...
true
6ee2f60e7d0d42d52fb3c7dc65d8708da4e887c7
Peanut2019/peanut
/peanut.v.2.0/peanut/core/resp.py
UTF-8
792
2.59375
3
[]
no_license
# 统一code回复 from flask import jsonify def success(data=None): """ 操作正确执行后的返回函数""" resp = dict(code=success_code, message=success_desc) if data: resp['data'] = data else: resp['data'] = None response = jsonify(resp) return response success_code = 200 success_desc = "success" e...
true
34740f90bb09f827722be4386b36582f084f6fcc
pollins/srl-tools
/srl_tools/aggregate.py
UTF-8
253
3.09375
3
[ "MIT" ]
permissive
from abc import ABC, abstractmethod class Aggregate(ABC): ''' Interface for containers in the iterator protocol https://docs.python.org/3/library/stdtypes.html#iterator-types ''' @abstractmethod def __iter__(self): pass
true
5df964450095784cf798297c9074a6ae4196930e
kamilczerwinski22/Advent-of-Code
/main_files/year_2016/day_4/year2016_day4_part2.py
UTF-8
1,845
3.8125
4
[]
no_license
# --- Part Two --- # With all the decoy data out of the way, it's time to decrypt this list and get moving. # # The room names are encrypted by a state-of-the-art shift cipher, which is nearly unbreakable without the right # software. However, the information kiosk designers at Easter Bunny HQ were not expecting to dea...
true
3e85e1562b494bebb0115e174c302fb383f0d79c
lairdm/python-google-nest-sdm
/google_nest_sdm/traits.py
UTF-8
1,724
2.65625
3
[ "Apache-2.0" ]
permissive
"""Base library for all traits.""" import aiohttp from .auth import AbstractAuth from .registry import Registry DEVICE_TRAITS = "traits" TRAIT_MAP = Registry() class Command: """Base class for executing commands.""" def __init__(self, device_id: str, auth: AbstractAuth): """Initialize Command."""...
true
5d0c4e6420226b511bbf0afbb8bdf9021b8e748f
mynamesunpower/hello-python
/a_datatype_class/Ex07_set.py
UTF-8
737
4.21875
4
[]
no_license
# ----------------------------------------------- # 집합 # - 집합에 관련된 자료형 # - 순서를 지정하지 않는다 # - 중복을 허용하지 않는다 s = set() # 빈 집합을 생성 s = set([1,2,3,1,1]) print(s) s2 = {3, 4, 5} s3 = {2, 3, 7, 1, 1} print(s2) print(s3) print(type(s)) print(type(s2)) print(type(s3)) print(s.intersection(s2))...
true
063088a29e54c8c99685470a51bba254d57e0e0b
travellerC/-
/DCL/code.py
UTF-8
3,321
2.5625
3
[]
no_license
#工具包/wxr import pandas as pd import matplotlib.pyplot as plt import seaborn as sns ''' data = pd.read_csv(r'D:/2020_summer/data/20200712-DCL/DCL/gse62254_linchuangcanshu.csv') data['DFS'] = pd.qcut(data['OS'], q=4, labels=[1, 2, 3, 4]) data['OS'] = pd.qcut(data['OS'], q=4, labels=[1, 2, 3, 4]) data.to_csv(r'D:/2020_su...
true
fef00161878977af1c36a6c1af5002cc5c5d7d28
Volosheniuk/Vychmat
/BSP/bsp.py
UTF-8
5,954
2.59375
3
[]
no_license
import numpy import matplotlib.pyplot as np import math import copy from functools import reduce SHOWN = { 'sine': False, 'table': True, 'poly': False, 'scmp': False, } def drange(start, stop=None, step=None): if stop is None: stop = start step = 1 start = 0 elif step...
true
0c37c78ea89da23878765120cdad99432279db18
ads-unigrade-2019-1/MWScanner
/databaseConfig/departmentDatabase.py
UTF-8
1,520
2.96875
3
[ "MIT" ]
permissive
from databaseConfig.dbConnection import Database class DepartmentDB(Database): # This class was created to save all the departments # present in UnB @staticmethod def savedepartment(departments): # This static method the department list and save # it in database Mongodb # Get...
true
5678b6493bbab0a70cf26d467a4b195c0e2081a2
noaOrMlnx/sonic-utilities
/pfc/main.py
UTF-8
4,647
2.59375
3
[ "LicenseRef-scancode-generic-cla", "Apache-2.0" ]
permissive
#!/usr/bin/env python3 import click from swsscommon.swsscommon import ConfigDBConnector from tabulate import tabulate from natsort import natsorted ALL_PRIORITIES = [str(x) for x in range(8)] PRIORITY_STATUS = ['on', 'off'] def configPfcAsym(interface, pfc_asym): """ PFC handler to configure asymmentric PFC....
true
a2d75a5b972570ddf107ecb16a31cf57ec15f8c9
nikolaystanishev/HackBulgaria_Python101
/snake/cell.py
UTF-8
1,024
3.03125
3
[]
no_license
from wall import Wall from black_hole import BlackHole from food import Food from python import Python import settings class Cell(Wall, BlackHole, Food, Python): def __init__(self, content=settings.EMPTY_CELL): self.content = content self.position = () self.isbody = 0 self.iswall =...
true
2576a1aceb45d5a0742e99ac50651b9b3c31f5f7
Hsuya1100/Semester-6
/Semester 5/Artificial Intelligence/Lab/Assignment2/Nqueens_DFS.py
UTF-8
965
3.453125
3
[]
no_license
global N N=8 sols=0 def printBoard(board): print("Solution :") for row in board: for ele in row: print(ele,end=' ') print() def isDangerous(board,row,col): # row on left side for i in range(col): if board[row][i] == 1: return 1 # upper diagonal on left side...
true
0daa124658e7726cada2c995172aba07224dfb0c
Shrman007658/ErrorCassifier
/Python Files/Project_GUI.py
UTF-8
9,576
2.6875
3
[]
no_license
import tkinter as tk from tkinter import * import pandas as pd import os import subprocess from pandas import ExcelWriter from sklearn.model_selection import train_test_split from sklearn.feature_extraction.text import TfidfTransformer from sklearn.feature_extraction.text import CountVectorizer from sklearn im...
true
243e426014d5d9b743713172fb12dbbb71762533
jedzej/tietopythontraining-basic
/students/BRACH_Jakub/lesson_03_Functions/collatz_validation.py
UTF-8
315
3.734375
4
[]
no_license
# Collatz Sequemce def Collatz(number): if number % 2 == 0: retval = number // 2 else: retval = 3 * number + 1 print(retval) return retval try: in_data = int(input()) while in_data != 1: in_data = Collatz(in_data) except ValueError: print("Error:Input must be intege...
true
882cb182f68ea56730d5df2b7c853f97b4f7ac96
cis-04/primitive-python
/16.py
UTF-8
158
3.15625
3
[]
no_license
def solution(height, k): number = 0 for h in height: if h > k: number += 1 return number print(solution([1,2,3,4,5], 3))
true
c41ee5320555fce51900da722712bdb559ccab89
pawelc/CodingTheMatrix
/week1/lecture.py
UTF-8
191
2.609375
3
[]
no_license
class Vec: def __init__(self,labels,function): self.D = labels self.f = function def zero_vec(D): return Vec(D, dict(zip(D,[0]*len(D)))) zv=zero_vec({'A','B'}) zv.D zv.f
true
3bcd78ee777264106229637553e5bce26b89fd94
anastasia21112/Python_Work
/Python Crash Course/Chapter 2/stripping_names.py
UTF-8
98
3.484375
3
[]
no_license
name = " \t\n Anna " print(name) print(name.lstrip()) print(name.rstrip()) print(name.strip())
true
9df1aa2734b0e83054d36b91a3f1fa941e58bfe6
marteo2/PineAppleTeamWebSci
/PineApple/btcdata/getbtcdata.py
UTF-8
2,409
2.59375
3
[]
no_license
import ast import datetime import json import time import django import requests import os from pymongo import * os.environ['DJANGO_SETTINGS_MODULE'] = 'PineApple.PineApple.settings' django.setup() def find_data(start_date, end_date): """ :type end_date: timestamp :type start_date: timestamp """ ...
true
757bd866800ded3df58adae47dd19d7951d05212
SRTInc/MyCritical-WGG
/word guessing game -Project.py
UTF-8
8,794
3.234375
3
[]
no_license
import random import Start import Leaderboard import game import random import datetime #Name = 'Safi' Testing i/p check=True #To emulate infinite loop def get_the_players():#this snippet is just checking whether the file functions work! get_players = open(r"C:\guessgame\Players.txt",'r+') gp ...
true
ead0e8c7bd685e50e3c19558d085e1f0f07e3504
lil-val/she-codes
/src/Ex14/2sets_of_radio_buttons.py
UTF-8
924
3.25
3
[]
no_license
from tkinter import * """only 1 radio button is enabled at a time""" root = Tk() """the values are used as indexes, individual button that only 1 will be selected at a given time if 2 buttons have the same value while choosing 1 of them the second will be selected also """ radio_1 = Radiobutton(root, text="option 1", ...
true
2a2933de308716dce7cc2d341a778d417caccd46
fcoba/recommendation_project
/recommendation-case-study/import_dat.py
UTF-8
1,074
3.171875
3
[ "MIT" ]
permissive
import pandas as pd df = pd.read_csv("data/users.dat", delimiter=":") df = df.drop(columns=["Unnamed: 1", "Unnamed: 3", "Unnamed: 5", "Unnamed: 7"]) df.columns=["id", "gender", "age", "occupation", "zipcode"] age_map = { 1: "Under 18", 18: "18-24", 25: "25-34", 35: "35-44", 45: "45-49", 50: "50-55", 56: "56+" ...
true
51f05a37bc01d061b679963389193dad6e0b2810
KevinMartinLankut/INF200-2019-Exersices
/exersices/ex02/message_entropy.py
UTF-8
756
3.875
4
[]
no_license
import collections as c import math as m def letter_freq(text): text = text.lower() cnt = c.Counter() for symbol in text: cnt[symbol] += 1 return cnt def entropy(message): N = len(message) #number of letters n_i = letter_freq(message) #number of occurences of letter i p_i = n_i/N ...
true
6494001f95102f1907fe81724d0ffdebbd66a2da
HankerZheng/LeetCode-Problems
/python/044_Wildcard_Matching_DP.py
UTF-8
2,155
3.921875
4
[]
no_license
# Implement wildcard pattern matching with support for '?' and '*'. # '?' Matches any single character. # '*' Matches any sequence of characters (including the empty sequence). # The matching should cover the entire input string (not partial). # The function prototype should be: # bool isMatch(const char *s, const c...
true
35e2935fbc16735379f718b3c55c9c73409411f2
thlautenschlaeger/reinforce
/run_reinforce.py
UTF-8
2,159
2.5625
3
[]
no_license
import gym import torch from src.reinforce import Reinforce import argparse import sys def run(args=None): parser = argparse.ArgumentParser(description='Running reinforce on gym environments') parser.add_argument('--env', type=str, default='CartPole-v1', help='Choose your gym environment') parser.add_argu...
true
e9e4ca53507e0a66321c08b6550f79fce9047a33
25tunez/wiki-animals
/animalScript.py
UTF-8
838
3.71875
4
[]
no_license
from bs4 import BeautifulSoup import urllib.request as ur #scrape a wikipedia page for a list of animals #parse the wiki page urlToScrape = "https://en.wikipedia.org/wiki/List_of_animal_names" r = ur.urlopen(urlToScrape).read() soup = BeautifulSoup(r, "lxml") #transform URL to HTML that can be parsed #extra step to ...
true
3487d36c4cf0cbefccf183f8a64c39266289378d
namratarane20/MachineLearning
/Prognos Project/Working/Piyush Jiwane Git/Python/map.py
UTF-8
242
3.359375
3
[]
no_license
# def square(x): # return x*x # lst=[1,2,3,4] # nlst=list(map(square,lst)) # # print("original list ",lst) # print("new list ",nlst) tpl=(10,20,30,40) ntpl=tuple(map(lambda x:x+2,tpl)) print("original list ",tpl) print("new list ",ntpl)
true
12ad9691a25caee3f70aafc7979e43cdc4f1dca2
falcon-33/PycharmProjects
/fourth_week/IsPointInSquare.py
UTF-8
219
3.140625
3
[]
no_license
x = float(input()) y = float(input()) answer = '' def function1(x, y): if abs(x) <= 1: if abs(y) <= 1: return True else: return False answer = function1(x, y)
true
8ee34d534064e44dea3150727e615dfe26bdd7d4
fspring/NeuralArgMining
/Graphs/nx_ged_from_dot.py
UTF-8
1,978
2.875
3
[]
no_license
import networkx as nx import matplotlib.pyplot as plt import os golden_path = 'Input_G/Pt' predict_path = 'Output_G/Pt' # golden_path = 'Input_G/En' # predict_path = 'Output_G/En' def node_subst_cost(n1, n2): text1 = n1['label'].lower() text2 = n2['label'].lower() text1 = text1.replace('\n', '') text2...
true
d18c9709a7a9bbf4b1097684c4f992ac441d302f
RamachandranArun/Python_Test
/oops.py
UTF-8
390
3.421875
3
[]
no_license
class calc(): a=100 print('hi') def add(a,b): c=a+b return c def sub(a,b): c=a-b return c print(calc.add(10,20)) print(calc.sub(15,25)) class incalc(calc): def mul(c,d): e=c*d return d def div(x,y): z=x/y return z ...
true
054b26ab97a2120ec003cacf6c62e56767eea75a
NoIf96/skill_learn_assistant
/backstage/algorithms/manager.py
UTF-8
1,958
2.5625
3
[]
no_license
# -*- coding:utf-8 -*- from algorithms.skill_learn_assistant import recommended_system class Manager(object): __instance = None __create = False _attr = {} def __init__(self): if self.__create is False: self._register_attr() def __new__(cls, *args, **kwargs): if cls._...
true
2338aaf1bc059fb2f4f8e290d138614647a56564
philemonmastewal/CodingDojoAssignments
/Python_Django/Python/Python_OOP/oop_stuff.py
UTF-8
4,278
4.1875
4
[]
no_license
#print dir(object) #class ClassName(object): # //attributes and methods here #Think of the class as a blueprint for creating something. Once, we've finished our blueprint we can create instances of this class. The Human class we defined above is a blueprint for creating humans. We create a new instance by using the c...
true
3a363e3197c3a0e2b4996f044029fdf662b56f97
VietAnh14/dataMining
/data/tesst.py
UTF-8
421
2.84375
3
[]
no_license
import argparse import pandas as pd parser = argparse.ArgumentParser(description="Example for store true & false") parser.add_argument("--set-false", "--s", "--sf", help="Set var_name to false", dest="var_name", action="store_false") parser.set_defaults(var_name=True) args = parser.parse_args() # print ("var_name is ...
true
221db200cd9069649299f3c07e6c091c37a32e75
meta-omega/formal-system-library
/interface/root.py
UTF-8
660
3.140625
3
[]
no_license
import time import keyboard def handle_root(games, params): keyboard.press_and_release('cmd+k') print('\nBienvenido, gilcito! Gracias por el audio! ¿Todo bien?\n') print('Escribí 1 para crear un juego.') print('Escribí 2 para acceder a un juego.') selection = 0 not_an_int = False try: ...
true
cf591a2ad0112724cd186e58f6975f5565df2ea5
Savzan/Cours_Modelisation
/TD7/TD7.py
UTF-8
2,171
2.9375
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Tue Mar 10 13:43:20 2020 @author: Mollier Yoann """ import numpy as np from matplotlib import pyplot as plt from scipy.optimize import fsolve #%% Déclaration des fonctions def p(v,t): '''Résoud les équations de Van Der Waals ''' a = 8./3 * t b = v...
true
a37383d3d08d06b52db57e7b3970bfc2ff6ce71c
ehrhardt98/Camada
/Projeto7/receive.py
UTF-8
3,217
2.546875
3
[]
no_license
from signalTeste import * import sounddevice as sd import numpy as np import matplotlib.pyplot as plt import peakutils import keyboard import heapq import math fs = 44100 tempo = 1 amplitude = 1000 channel = 2 sd.default.samplerate = fs sd.default.channels = channel signal = Signal() x1, s697 = signal.generateSin(69...
true
6da8e8299f9c6be9f525926d416aff2c63bc4eab
KrUtHi96/DNASequencing
/overlap_methods/suffix_tree_test.py
UTF-8
5,478
2.921875
3
[]
no_license
import random from graphviz import render import time from matplotlib import pyplot as plt import numpy as np from overlap_methods.suffix_tree import SuffixTree from overlap_methods.suffix_tree import SuffixTreeNode from generate_dataset import generate_dataset from read_dataset import read_dataset def naive_overl...
true
445345894271c41ceddee2f000ea78f7b4548e6f
bdugersuren/algorithmic-problems
/Others/easy/NonConstructibleChange.py
UTF-8
546
3.296875
3
[ "MIT" ]
permissive
def bsrch(arr, left, right, target): while left <= right: mid = (left + right) // 2 if arr[mid] == target: return True if arr[mid] > target: right = mid - 1 else: left = mid + 1 return False def nonConstructibleChange(coins): if not coi...
true
868dda71a290adf7c64acc5e52e49a8f9672cc60
mingzhao03/Recursion
/src_keras/cosface.py
UTF-8
3,154
2.578125
3
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sat Jul 13 23:18:05 2019 Adapted from https://github.com/4uiiurz1/keras-cosface/blob/master/metrics.py With ideas from @bestfitting https://www.kaggle.com/c/human-protein-atlas-image-classification/discussion/78109#latest-632983 @author: mzhao """ import te...
true
d64bba7305181a33c8f4da85fdbdae35cc2cf391
IgorEnergyOne/Asteroids
/Asteroids.py
UTF-8
3,226
3.25
3
[]
no_license
import numpy as np import math def lister(filename, amount): ast_arr = [] with open(filename, "r") as asteroid_file: data = asteroid_file.read().splitlines() # чтение данных из файла с разделением строк for n in range(amount + 1): row = data[n + 1].split(',') # разбиение строки на элем...
true
c3edab0d406219bd9941303836a24a4e6e78e4e7
shiblon/pytour
/tutorials/list_dir.py
UTF-8
1,542
3.890625
4
[ "Apache-2.0" ]
permissive
# vim:tw=50 """More on Files: Listing Directories Before we move on, let's do one more thing with files. Here, we will list all files in a directory and stick them into a list before outputting them. To do this, we import the |listdir| function from the |os| module. Heed the comment above the import, though - in th...
true
04a71f20c75f860f743042f11f8d2f6435bc525b
hugs/appium-old
/appium/robot/bitbeambot-d2/robot.py
UTF-8
5,977
3.046875
3
[ "Apache-2.0" ]
permissive
# Copyright 2012 Appium Committers # # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apach...
true
910c903b162418dcb10b2f25c3ab51b08cfd9e13
mertozzz/programlama
/stok.py
UTF-8
917
3.109375
3
[]
no_license
def stok(): koltuksayısı=int(input("koltuksay giriniz:")) x=koltuksayısı yataksayısı=int(input("yataksaygiriniz:")) y=yataksayısı dolapsayısı=int(input('dolapsayısınıgiriniz:')) z=dolapsayısı dönembaşıstok=print("dönembaşısto:",x,y,z) satılankoltuk=int(input("satılankoltuk:")) ...
true
959001896e1c9ff45eea08bf1a52876ea0114c98
KaappoRaivio/mycurse
/main.py
UTF-8
939
3.09375
3
[]
no_license
import time import _curses.curseswrapper # with _curses.curseswrapper.CursesWrapper(): # pass a = [ [0, 1, 0, 0, 0, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 1, 0], [0, 0, 1, 0, 0, 1, 0, 0], [0, 0, 0, 1, 1, 0, 0, 0], ] def converterFactory(pallette...
true
e08469c946314b2fb5fd5940d9e2b32c106f1624
faizansarfaraz/PIAIC-Projects.
/marksheet.py
UTF-8
903
3.546875
4
[]
no_license
print("Marksheet") print() name=input("Enter Student Name:") roll_num=input("Enter Roll Number:") phy_marks=int(input("Enter Physics Marks:")) chem_marks=int(input("Enter Chemistry Marks:")) math_marks=int(input("Enter Math Marks:")) urdu_marks=int(input("Enter Urdu Marks:")) eng_marks=int(input("Enter English Marks:")...
true
6e6b8b4e4a00fed7da36b06eafa5e30509a6ba03
icculp/holbertonschool-higher_level_programming
/0x0B-python-input_output/100-append_after.py
UTF-8
499
3.328125
3
[]
no_license
#!/usr/bin/python3 """ Task 100 Module """ def append_after(filename="", search_string="", new_string=""): """ appends after certain string """ with open(filename, 'r', encoding='UTF-8') as f: count = 0 rl = f.readlines() for i in range(len(rl)): if search_string in rl[...
true
9e931fb29145a013b509ef471964dd76d3140b35
alexroederer/moonstone
/log_recipe.py
UTF-8
7,217
3.171875
3
[]
no_license
''' log_recipe.py @author:Alexander Roederer @date: May 10, 2016 Creates data structure from multiple recipes for further analysis Initial approach: create simple count association matrix for food type Note that some cleanup of food types will likely be necessary as ingredient parsing is a non-trivial problem; more...
true
37981b6b52fdbe753ede7c25424f008e6b14d467
FlowerbeanAnsh/python_problems_2
/sort_hackrrranl.py
UTF-8
224
3.171875
3
[]
no_license
s=input() lst1=[] lst2=[] lst=[] c=0 for i in s: for j in range(1,i): if i%j==0: c+=1 lst1.append(i) else: lst2.append(i) lst=lst1 + lst2 print(lst1) print(''.join(lst))
true
c57fa2c8148add0f107ccfb6870269ea8ad80d48
stevenfriend/pyqt_paint
/tablet_paint.py
UTF-8
3,692
2.75
3
[]
no_license
import sys from functools import partial from pynput.mouse import Button, Controller from PyQt5.QtCore import Qt, QPoint from PyQt5.QtGui import QImage, QPainter, QPen, QTabletEvent from PyQt5.QtWidgets import QApplication, QMainWindow, QAction, QMenu, QMenuBar, QFileDialog class Window(QMainWindow): def __init__...
true
ffa7f895ecf2584badbfea9959e63501f6d69b63
nmessa/Dover-Girls-Coding-2018_2019
/Turtle Race/turtleRace version 1.py
UTF-8
868
3.796875
4
[]
no_license
##Turtle Race version 1 ##Author: nmessa ##This version creates 4 turtles and they race across the screen from turtle import * from random import randint window = Screen() mary = Turtle() mary.shape('turtle') mary.color('red') mary.penup() mary.goto(-360, 100) mary.pendown() fred = Turtle() fred.s...
true
ef0e7f89ded3a3aa19a9e9bbad02608e6b450751
miguelblaise/binance-hawksight-trader
/binance_api.py
UTF-8
2,672
2.8125
3
[]
no_license
import os from math import floor from binance.client import Client API_KEY = os.getenv("API_KEY") SECRET_KEY = os.getenv("SECRET_KEY") def get_symbol_price(coin): client = Client(API_KEY, SECRET_KEY) info = client.get_symbol_ticker() for symbol in info: if symbol["symbol"] == coin: pr...
true
dee269a9a16a39f6e851f7db4ce4142c8937302c
angelajiang/importance-sampling
/tests/test_reweighting.py
UTF-8
1,880
2.671875
3
[ "MIT" ]
permissive
# # Copyright (c) 2017 Idiap Research Institute, http://www.idiap.ch/ # Written by Angelos Katharopoulos <angelos.katharopoulos@idiap.ch> # import unittest from keras.layers import Input from keras.models import Model import numpy as np from importance_sampling.reweighting import BiasedReweightingPolicy, \ NoRew...
true
e2997569b02180828669d0137c2205778b330159
ramyamango123/test
/python/python/src/python_problems/other_python_prob/dictcopy.py
UTF-8
191
3.015625
3
[]
no_license
dict1 = {'ram':20, 'sam' :25, 'prim': 45} dict2 = dict1.copy() #print "new dictionary values are: %s" % str(dict2) print "new dict value is %s" % str(dict2) dict1['sow'] = 35 print dict1
true