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
c3a7563393d25fd03495e5067d3f2a8781a7d051
aglaiawong/AnalyticsVidhya_projects
/AmExpert/LightGBM_FE_ME.py
UTF-8
9,273
2.546875
3
[]
no_license
#[144] training's auc: 0.615285 valid_1's auc: 0.610407 PL 0.5701 #Import modules import numpy as np import pandas as pd import seaborn as sns import matplotlib.pyplot as plt import lightgbm as lgb from sklearn.model_selection import GridSearchCV, RandomizedSearchCV from sklearn.model_selection import train_test_split...
true
da4d4d90d8574cefd538d5d447d8f08a0964bdd1
arthurperng/euler
/euler6.py
UTF-8
94
3.390625
3
[]
no_license
s=range(1, 101) a = sum(s)**2 #Square of sum b = sum([i**2 for i in range(1, 101)]) print a-b
true
902fb5493b9b082ec77faa9b5800e2d58a989c58
nikpaa/ot-harjoitustyo
/src/tests/calculator_test.py
UTF-8
2,552
3.140625
3
[]
no_license
import unittest import math import parse from operation import BinaryOperation, UnaryOperation from errors import CalculatorError from history import create_table, add_operation_to_db, clear_table class TestOperation(unittest.TestCase): def test_plus(self): operaatio = BinaryOperation("+") self.as...
true
2d052b4e0f63aac3a1fb23457f13810f4eeb007a
famaxth/Way-to-Coding
/MCA Exam Preparations/Python/LAB/3 exer_1_swap_two_numbers_without_temp_variable.py
UTF-8
310
3.6875
4
[]
no_license
number_1 = int(input("Enter first no : ")) number_2 = int(input("Enter second no : ")) print("Before Swapping ") print("A = ",number_1," B = ",number_2) number_1 = number_1 + number_2 number_2 = number_1 - number_2 number_1 = number_1 - number_2 print("After Swapping") print("A = ",number_1," B = ",number_2)
true
aecfb0dc5774d600d426f64c5cf70daaeeeae432
xvopes/django
/mysite/learn/views.py
UTF-8
618
2.625
3
[]
no_license
#coding:utf-8 from django.shortcuts import render from django.http import HttpResponse def home(request): string = u"hello,i'm neo!" TutorialList = ['HTML', 'CSS', 'JQuery', 'Python', 'Django'] info_dict = {'site':u'hello', 'content':u'bye' } List = map(str, range(100)) return render(request, 'lear...
true
ef365f8e30850182c15d384a18d7072a654be1fd
coolboygym/leetcode-python
/problems/951_翻转等价二叉树.py
UTF-8
849
3.578125
4
[]
no_license
# Definition for a binary tree node. # class TreeNode(object): # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution(object): def flipEquiv(self, root1, root2): """ :type root1: TreeNode :type root2: TreeNode :rtype...
true
0c20363819c20fe766632083e0348e6989a8a356
nsortur/book-counter
/img_houghp.py
UTF-8
1,415
2.96875
3
[]
no_license
import cv2 import numpy as np path = './assets/IMG_8393.JPG' img = cv2.imread(path) img = cv2.resize(img, (0, 0), fx=0.2, fy=0.2) img_gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) img_blur = cv2.GaussianBlur(img_gray, (15, 15), 0) edges = cv2.Canny(img_blur, 30, 40, apertureSize=3) im_draw = img.copy() inits_so_far =...
true
be8093d7ba8d63b68786f051d597975aa2b516f4
dfarache/hackerrank
/maximizeXor/maximizeXOR.py
UTF-8
164
3.03125
3
[]
no_license
L = int(input()) R = int(input()) maximum = 0 for A in range(L, R+1): for B in range(L,R+1): if A^B > maximum: maximum = A^B print(maximum)
true
3190d8ca6400db6a8e459e9e10d7d9ea70d7d267
ConanKeaveney/JobHub-Scrapers
/companies/SIG/test.py
UTF-8
216
2.890625
3
[]
no_license
from scraper import Scraper sig = Scraper('sig', 'https://careers.sig.com/search-results?keywords=dublin') data = sig.scrape() for i in range(len(data)): print(data[i]['title']) print(data[i]['location'])
true
305c1dd13c0ef10ac8b9e341fecf4157831b91eb
alexrayperry/Python-Challenge
/PyBank/main.py
UTF-8
2,419
3.765625
4
[]
no_license
#Call Dependencies import os import csv #Create csvfile path location csvpath = os.path.join('budget_data.csv') #Lists for holding data values months = [] profit_loss = [] revenue_change = [] #Create csv reader to read in csv file with open(csvpath) as csvfile: csvreader = csv.reader(csvfile, delimiter=',') ...
true
cd0f66f6fb66799799badfd8efdb8eac0e3405c3
YeWR/robosuite
/robosuite/models/grippers/gripper_factory.py
UTF-8
1,082
2.953125
3
[ "MIT" ]
permissive
""" Defines a string based method of initializing grippers """ from .two_finger_gripper import TwoFingerGripper, LeftTwoFingerGripper from .pr2_gripper import PR2Gripper from .robotiq_gripper import RobotiqGripper from .pushing_gripper import PushingGripper from .robotiq_three_finger_gripper import RobotiqThreeFingerGr...
true
a351200323fc11a6a1129f0fcddacdd293704400
basile-henry/projecteuler
/Python/problem89.py
UTF-8
883
3.296875
3
[]
no_license
letters = "IVXLCDM" values = [1,5,10,50,100,500,1000] def fromIntToRoman(n): index = 6 out = "" while n > 0: if n < values[index]: index -= 1 else: if n/values[index-1] == 9 and letters[index-1] in "IXC": out += letters[index - 1] + letters[index + 1] index -= 1 elif n/values[index] == 4 and ...
true
393cfd774cdd988ec4b1ee0c5c958decf64c7939
OlgaBukharova/Python_projects
/черепашка 1/черепашка 11.py
UTF-8
279
3.625
4
[]
no_license
import turtle from math import pi turtle. shape ('turtle') def circle (r): l=2*pi*r for i in range (360): turtle.forward (l/360) turtle.left (1) for r in range (10,100,10): for i in range (2): circle (r) turtle.left (180)
true
bd3d1fe31a5bcd77d3382921275f9a5559970387
aionliao/atool-weixin
/app/utils/RequestUtil.py
UTF-8
657
2.53125
3
[]
no_license
# -*- coding: utf-8 -*- ''' Created on 2015年8月21日 @author: hustcc ''' from flask.globals import request, session # 获得参数,post或者get def get_parameter(key, default=None): ''' info:获得请求参数,包括get和post,其他类型的访问不管 ''' # post参数 if request.method == 'POST': param = request.form.get(key, default) ...
true
c308cf58f525a55117620b1051b04316f64d60b2
pHgon/TrabFinal-CNC
/e1.py
UTF-8
2,004
4
4
[]
no_license
import math def ourFunction(x): return math.pow(math.e, 4 - math.pow(x, 2)) def analytical(a, b): # e^4 * -1/2x * e^(-x^2) e1 = math.pow(math.e, 4) * (-1.0 / (2.0*b)) * math.pow(math.e, -1 * math.pow(b, 2)) e2 = math.pow(math.e, 4) * (-1.0 / (2.0*a)) * math.pow(math.e, -1 * math.pow(a, 2)) return ...
true
88594800bfecde4ed07e69936425924ea1404e8b
dhurataK/python
/stars.py
UTF-8
476
3.875
4
[]
no_license
# PART ONE def draw_stars(x): for i in range(0,len(x)): for val in range(0, x[i]): print "*", print "\n" # q = [4, 6, 1, 3, 5, 7, 25] # draw_stars(q) # PART TWO def draw_stars(x): for i in range(0,len(x)): if isinstance(x[i],str): letter = x[i][0]....
true
5a536231e01fc54eaa446c87fdc49c11710cd52a
davidsmiles/learningpython
/basics/destructuring.py
UTF-8
701
4.15625
4
[]
no_license
x, y = 5, 11 example_list = ["A", "B", "C"] for counter, letter in enumerate(example_list): print(counter, letter) people = [ ("Bob", 42, "Mechanic"), ("James", 24, "Artist"), ("Harry", 32, "Lecturer") ] for name, age, profession in people: print(f"Name: {name}, Age: {age}, Profession: {professi...
true
13a821cce34614ea6a171d2ba9c8607103ee8a54
GabrielRocha/desafio-back-end
/crawler_xml/tests/model/test_item.py
UTF-8
599
2.640625
3
[]
no_license
import ast import os from crawler_xml.model.description import Description BASE_DIR = os.path.dirname(os.path.abspath(__file__)) def test_item_title(item): assert item.title == "TITLE" def test_item_link(item): link = "LINK_FEED.html" assert item.link == link def test_item_description(item): ass...
true
b041b65d8d08065b883ea1acf82139ed073abfa0
prachi1210/hangman-python
/main.py
UTF-8
3,116
3.390625
3
[]
no_license
import os, random, turtle stage=[0] def get_random_word(file_name): total_bytes = os.stat(file_name).st_size random_point = random.randint(0, total_bytes) file = open(file_name) file.seek(random_point) file.readline() return file.readline() #line= get_random_word(r"C:\hangman-python\wordlist...
true
7ccb007ba44d6ccb4a442c2dcebe28e29c86cafb
ronistone/ReconhecimentoFacial
/run.py
UTF-8
477
3.015625
3
[]
no_license
from register import RegisterUser from recognition import Recognition import os path = 'training-data' try: os.mkdir(path) except Exception: pass while True: os.system("clear") print("1 - Cadastrar novo usuário") print("2 - Iniciar Reconhecimento") print("0 - Sair") o = input("Opção: ") ...
true
65ac5ec4297fd5d21359553e81ecb19f00be4096
SugashiniSappani/SANA
/pos.py
UTF-8
179
3.71875
4
[]
no_license
n = float(input("Enter a number:")) if n>0: print "The given is a positive value" elif n<0: print "The given is a negetive value" else: print "The given is a zero value"
true
0a5e16775042bc67fe32b3b766561250586abf74
kanishkarj/vehicle-detection
/model.py
UTF-8
873
2.578125
3
[]
no_license
import torch import torch.nn as nn import torch.nn.functional as F class ConvNet(nn.Module): def __init__(self): super(ConvNet,self).__init__() self.conv1=nn.Conv2d(in_channels=3,out_channels=10,kernel_size=3,padding=1) self.conv2=nn.Conv2d(in_channels=10,out_channels=10,kernel_size=3,p...
true
7b17a52e0823c4fbdd95f642d9856ceb86b7a68e
leifoo/ml
/dl_python/code/ex02numpy.py
UTF-8
1,155
3.5625
4
[]
no_license
import numpy as np # scalar (0D tensor) x = np.array(12) print('x = ', x) print('# of dimensions=', x.ndim) # vector (1D tensor) y = np.array([12, 3, 6, 14]) print('y = ', y) print('y.ndim = ', y.ndim) # matrices (2D tensor) z = np.array([[5, 78, 2, 34, 0], [6, 79, 3, 35, 1], [7, 80, 4, 3...
true
f095c874dfc80b04fe8a6b332d7a68c82a83b793
prakobpo/Text-Analytic
/TextPrep_Py.py
UTF-8
11,412
4.0625
4
[]
no_license
# coding: utf-8 # # Applications of Data Science # # Lab 3-Py # # Preparing Text Data with Python # # ## Overview # # This lab introduces you to the basics of text mining and text data preparation. In this lab you will work with a set of 160,000 tweets, which include sentiment labels. # # Social media sentiment i...
true
5b965a68f4b211d6a9a3e033b5856b2383c5f2d1
vardis/python-algorithms
/src/topological_sort.py
UTF-8
2,118
3.75
4
[]
no_license
""" Computes the topological sort for a DAG. Run a DFS on G. As each vertex is visited, at post-order time, it is pushed to a stack. At the end of the DFS the stack contains the ordering of the vertices. Runs in O(n + m) time where n is the number of vertices and m is the number of edges. """ import grap...
true
094998e24674f2cb80d3da35fbeabdc9248978c9
MichaelJWest/Project-Euler
/problem1.py
UTF-8
297
3.984375
4
[]
no_license
#If we list all the natural numbers below 10 that are #multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23. #Find the sum of all the multiples of 3 or 5 below 1000. list1=[] for i in range(1, 1000): if (i%5.0) == 0 or (i%3.0) == 0: list1.append(i) print sum(list1)
true
9189b51a8b1f72285c7100ad249a369630784c6f
Aasthaengg/IBMdataset
/Python_codes/p02797/s794462223.py
UTF-8
174
2.765625
3
[]
no_license
n,k,s=map(int,input().split()) a=[] for i in range(k): a.append(s) for i in range(k,n): if s!=10**9: a.append(10**9) else: a.append(1) print(*a)
true
b31eba2970fbfcefbd5900eadbc157177afcb13f
bbreddy123/cs595-f14
/A5/twitter/searchFriends.py
UTF-8
1,222
2.625
3
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- import os, sys import tweepy import unicodedata from tweepy import Stream from tweepy import OAuthHandler from tweepy.streaming import StreamListener consumer_key = 'fpTauqKqCRj4Gp8m9jb9WCilk' consumer_secret = 'OrDd7NssqrvLgOXnzuDkGcS8UbTNoY1jFY...
true
372c05a1a96689bf87ced41d28db846f9fe0a245
babish006/Neural-Networks
/neuralNetwork.py
UTF-8
1,515
2.96875
3
[]
no_license
import pandas as pd from sklearn.preprocessing import StandardScaler from sklearn.neural_network import MLPClassifier from sklearn.metrics import classification_report,confusion_matrix from sklearn.metrics import mean_squared_error from sklearn.neighbors import KNeighborsClassifier trainFile = input("Please enter the ...
true
586f9e207ac2b1ac45c789fe06598f72804579c7
ezhang887/PathPlanning
/PathFollower/unit_test.py
UTF-8
4,059
2.890625
3
[]
no_license
from __future__ import print_function import unittest import math import sys sys.path.append("../Math/") from generator import Waypoint from generator import Line from generator import Arc from generator import Generator from segment import Type from translation import Translation class UnitTest(unittest.TestCase): ...
true
72e905f1c19878214cb3768a73d4b4dde7a59a14
mattdennewitz/lshhdc
/tests/test_cluster.py
UTF-8
1,498
2.84375
3
[ "MIT" ]
permissive
from lsh import Cluster, jaccard_sim from .utils import * def test_same_set(): """A set should be clustered with itself""" s = randset() cluster = Cluster() cluster.add_set(s) cluster.add_set(s) assert len(cluster.get_sets()) == 1 def test_similar_sets(): """Two similar sets should be cl...
true
57bf185f8125aa9900df6629753bee7869efa7b4
RyanSampana/smallbackendproject
/reports/tasks.py
UTF-8
1,650
2.671875
3
[]
no_license
""" This is where we place all celery async scheduled tasks. In our case we are getting the fan_counts for all companies. We place an hourly cronjob to fetch the data If we would like to execute the task every 10minutes, change the crontab to: @periodic_task(run_every=crontab(minute='*/10')) """ from time import sleep...
true
dc59d414bf8b37186e4f3cbc3635222d7848436c
OCsource/clustering_scenery_tags
/trainWords/wordsToNumber.py
UTF-8
432
2.5625
3
[]
no_license
from gensim.models import word2vec def getWordsNumber(seg_path, model_path): sentences = word2vec.LineSentence(seg_path) model = word2vec.Word2Vec(sentences, size=250, min_count=5) # size 用来设置神经网络的层数 model.save(model_path) if __name__ == "__main__": seg_path = '../saveFile/wiki_seg.txt' model_pat...
true
bd8d3ef69e3bd62f7df6b58f7a170725fba548fb
pyrosmiley/photoframe
/config.py
UTF-8
1,486
2.640625
3
[]
no_license
#!/usr/bin/env python import gpiozero import os import sys file_dir = os.path.dirname(os.path.abspath(__file__)) sys.path.append(file_dir) ### GPIO PIN LOCATIONS: ### power_button = gpiozero.Button(3, bounce_time=0.1) slideshow_button = gpiozero.Button(7, bounce_time=0.1) update_button = gpiozero.Button(25, bounce_...
true
3725b66c142dece6d0192de11e620e5288fa8c6e
abhic55555/Python
/Assignments/Assignment1/Assignment1_10.py
UTF-8
178
3.875
4
[]
no_license
def getlength(value): print("Length of {} is {}".format(value, len(value))) def main(): value=input("Enter name : ") getlength(value) if __name__ == "__main__": main()
true
1ac38b3eedb029f4d22441c594ae3040c463b045
SmayanaReddy/auto_anki
/code/ui.py
UTF-8
2,981
2.515625
3
[ "MIT" ]
permissive
from tkinter import * # import filedialog module from tkinter import filedialog from user_cli import * from PIL import Image, ImageTk import os def process_(file): lect_name = file.split("/")[-1].split(".")[0] if file.split("/")[-1].split(".")[1] == "pdf": pass elif file.split("/")[-1].split(...
true
988e2edef2af8428ad3144e2ff1456284b46b481
moyuan5989/python_data_-structure_and_algorithm
/stack1.py
UTF-8
387
3.59375
4
[]
no_license
#!/usr/bin/env/python #-*-coding:utf-8-*- class Stack(object): ''' Implement stack with Python. ''' def __init__(self): self.items = [] def push(self, item): self.items.append(item) def pop(self): return self.items.pop() def empty(self): return self.size() == 0 def size(self): return len(self.i...
true
48253bc7e52d88290f101573c26132a59ae6e5ec
changrif/CIS4930_PPA1
/console/console.py
UTF-8
2,893
3.65625
4
[]
no_license
from main import bmi, shortestDistance, email, tab, db def run(): choice = -1 while(choice != "5"): choice = raw_input( "**********************" "\nFunction Menu: " "\n (1) Body Mass Index" "\n (2) Shortest Distance" "\n (3) Ema...
true
0a36c817a7664fafa80e3dd8715037a51c8b4b3d
ParkChoroong/python1102
/DemoDict2.py
UTF-8
201
3.296875
3
[]
no_license
# DemoDict2.py tel = {"kim":"1111", "lee":"2222"} phone = tel print(tel) print(phone) print(tel) #불린(bool) isRight = True print(type(isRight)) x = 5 y = 5 print( x == y ) print( x != y )
true
575d57a94ca3fb01a064167efad6f597bda714e3
ltfafei/py_Leetcode_study
/magical_DataQueue/41.binarySum_andAverageValue.py
UTF-8
3,304
4.25
4
[]
no_license
#!/usr/bin/python3 #-*- coding: UTF-8 -*- #Author: afei00123 ''' 41.1、计算二叉树路径的和 树路径的和是指从树的根节点开始一直到某个叶子结点为止所经过的所有结点值的和。现在输入一个二叉树的 根节点和一个目标数值,需要检查输入的二叉树中是否有某个路径的和等于输入的目标数值,如果存在这样的路径 ,则返回True,否则返回False。 解题思路: (1)定义一个递归函数,其参数为树节点,返回值为其中所有路径和组成的列表; (2)如果递归函数输入的树节点为空结点,则返回空列表; (3)如果递归函数输入的树节点为叶子结点,则将当前结点的值放入列表返回; (4)如果递...
true
dbe5db1d0f13e2f89ac9e07dde02704beb266460
neapps/Python-3-Tutorial
/1. Basic Concepts/variables.py
UTF-8
1,293
4.65625
5
[]
no_license
# ================================================== # # Materi 1 : Variables #1 x = 7 print(7) # 7 print(x + 3) # 10 print(7) # 7 # Soal 1 : What is the output of this code? spam = "eggs" print(spam * 3) # Jawaban 1 : # eggseggseggs # ================================================== # # Materi 2 : Variables #2 ...
true
4a14a242797ebebfe38593009fc7e6a0503e18ef
AlexisDongMariano/leetcode
/1309 - Decrypt String from Alphabet to Integer Mapping.py
UTF-8
2,392
4.375
4
[]
no_license
# ============================== # Information # ============================== # Title: 1309 - Decrypt String from Alphabet to Integer Mapping # Link: https://leetcode.com/problems/decrypt-string-from-alphabet-to-integer-mapping/ # Difficulty: Easy # Language: Python # Problem: # Given a string s formed by d...
true
c4146da1d023143bb1063119f5a22dc53547ee54
AxelMorain/Kaggle-Titanic-Machine-Learning-from-Disaster
/Data Exploration.py
UTF-8
14,588
3.625
4
[]
no_license
# -*- coding: utf-8 -*- """ Created on Wed Jul 29 16:44:32 2020 Axel Morain Titanic Project File name: Data Exploration.py File Order: Data Exploration <= Function to Test Different ANN and Save the Best One Testing Different Neural Networks Runing models on Kaggle's test dataset •S...
true
cb507b508aecb4aded61a6d2385a981549127408
GabrielRomanoo/Python
/Aula 7/ex2.py
UTF-8
1,682
4.5
4
[]
no_license
# Crie um programa para calcular as 4 # operações básicas (usando funções). # As opções são 1-somar, 2-subtrair, # 3-multiplar, 4-dividir, 5-sair def soma(a,b): # a e b são parametros formais return a + b #Se não tivesse feito a conversão para int no while # essa função usaria do polimorfismo (dados ou sub...
true
36fd888b268c19785f1e4961066f77d4f470ec88
crazcalm/Crypto_textbook
/Classic_Cryptosystems/cryptoMath.py
UTF-8
1,235
4.4375
4
[]
no_license
""" "Problem Solving with Algorithims and data structures unsing python" - modexp : Modular Exponentiation - gcd : Greatest common divisor - ext_gcd : extended euclidian algorithm - (used to find multiplicable inverse) """ def modexp(x, n, p): """ Recursive definition for x^n (mod p) "...
true
e64fb1ef1c826bf0b0b94ae34f44d28bd4e0b347
toritsejuFO/final-year-project-backend-api
/api/schema/admins_schema.py
UTF-8
1,787
2.703125
3
[]
no_license
from collections import namedtuple import re from marshmallow import Schema, fields, ValidationError, validates, post_load from api.model import Admin def is_school_email(email): return True if re.match(r'[^@]+@futo.edu.ng', email) else False NewAdmin = namedtuple('NewAdmin', [ 'name', 'email', 'pas...
true
91a997b02212763b96f97c5ac4bcd6fb785a9db0
TommyTram/AdventOfCode
/bootstrap.py
UTF-8
1,547
3.140625
3
[]
no_license
#!/usr/bin/env python3 """ Credit: code taken and modified from https://github.com/amrit110/aoc """ import argparse import os from os.path import join from shutil import copytree from aocd import get_data def download_data(year, day, dst ): try: data = get_data(year=year,day=day) print(f'Fetched input year {...
true
f0790cd316834fcf794336fd00e9b6451f7e15cd
DrBugKiller/offer
/剑指offer/第六章面试中的各项能力/53-在排序数组中查找数字.py
UTF-8
2,518
3.125
3
[]
no_license
# -*- coding: utf-8 -*- # @Time : 2019/9/18 19:22 # @Author : DrMa class Solution:#我自己的写法,但是时间复杂度较高 def get_count2(self,nums,target): def get_first_target(nums,target,length,start,end):#拿到target的第一个index if start>end: return -1 mid_index=(start+end)//2 if nums[mid_ind...
true
36a383a1dda12e2e89332b22780c27d6692934a6
karlamagueta/pablito
/pablito.py
UTF-8
650
4.21875
4
[]
no_license
musics = [] continuar = 'sim' while continuar == 'sim': add_music = input('Pablo qual é a musica?').strip() musics.append(add_music) continuar = input("Quer mais !sr?").strip() for music in musics : print(music) idade = input("Pablo, qual a sua idade") idade = idade.strip() if idade.isnumeric():...
true
c1dcf62bc01ca0d40c18432a2935a079cd434467
andersonberg/SOM-dissimilarity-tables
/trunk/code/Cluster.py
UTF-8
957
2.828125
3
[]
no_license
#!/usr/bin/env python # *-* coding: utf-8 *-* from Point import * import numpy as np class Cluster: def __init__(self, _indice): self.indice = _indice self.prototipos = [] # self.prototipo = _prototipo self.objetos = [] self.pesos = [] self.deltas = {} def definir_ponto(self, x, y): self.point = Poin...
true
166f3c26867b06c1a2267c30ac9a129c7fb65e1b
MarkoSavija/projekat_Soft_Computing
/Projekat Soft (final)/gui.py
UTF-8
1,228
2.859375
3
[]
no_license
# -*- coding: utf-8 -*- from Tkinter import * from tkFileDialog import askopenfilename from PIL import Image, ImageTk import cv2 import main #================================================================ #funcionalnosti def load_file(): filename = askopenfilename(parent = root) img, pozadina, marka_automobila ...
true
792c4c148a2f17f84b8dc972fb21d33b6474346e
Kawser-nerd/CLCDSA
/Source Codes/CodeJamData/15/54/6.py
UTF-8
629
2.703125
3
[]
no_license
from collections import defaultdict from math import log def solve(): n = int(raw_input()) e = map(int, raw_input().split()) f = map(int, raw_input().split()) zeroes = int(log(f[0], 2)) res = [0] * zeroes sums = defaultdict(int) for i in xrange(1, n): a = e[i] freq = f[i] / (2 ** zeroes) for ...
true
d37666a63bb8d7fe185e4147e181a7299f8f5dae
planset/samples
/python/pytest/hoge.py
UTF-8
448
2.734375
3
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- import pytest from person import Person class TestPerson(object): @pytest.fixture def p(self): return Person('hoge', 11) def test_create(self, p): assert p.name == 'hoge' assert p.age == 11 def test_birthday(self, p): p = ...
true
c4e4282693fe2c281d7be2f227967a3d39fb5748
Pratyush2703/TCP-IP-Python
/client.py
UTF-8
536
3.0625
3
[ "Unlicense" ]
permissive
import socket import sys from thread import * HOST = '' PORT = 8888 s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) print 'Socket created' #Bind socket to local host and port try: s.connect((HOST, PORT)) except socket.error as msg: print 'Bind failed. Error Code : ' + str(msg[0]) + ' Message ' + ...
true
dec23211bb3e8e7430ef9498b5c9a531ce567866
ultimabugger/python_basic_training_homework
/num_list_gen.py
UTF-8
222
3.828125
4
[]
no_license
my_list = [100, 50, 63, 79, 7, 19, 39, 543, 67, 97] new_list = [num for num in my_list if num > my_list[my_list.index(num) - 1]] print(f"Старый список {my_list}") print(f"Новый список {new_list}")
true
a3ba90244373e12452c9947122195c22e43a6eac
balthaszar/cryptography
/wordpattern.py
UTF-8
2,441
3.5625
4
[]
no_license
#ascii a a = 97 #creating list for characters llist = [] while a < 123: llist.append(chr(a)) a +=1 #getting string from user keyword = input("Enter the string you would like to search: ") keyword = keyword.lower() #entering the file name and reading it, then adding it to a file wordlist = input("Enter the f...
true
6d7150976b3112a7c3fdb7e9ad3a7b0fbabb1c8a
RishiVaya/Sudoku-Solver
/base.py
UTF-8
2,008
3.890625
4
[]
no_license
# Sudoku solver which uses backtracking algorithm. def find_empty(board): for row in range(len(board)): for col in range(len(board[0])): if board[row][col] == 0: return [row, col] return None def printer(board): for row in range(len(board)): if row % ...
true
50ecd1b4a80b1c6d0201db525bfd1b2ce3605c62
ICFI/ADS18f_Alpha
/supporting_tools/find_side_effects_in_medguide/find_effects_in_medguide.py
UTF-8
3,154
2.703125
3
[]
no_license
import requests, json import re import os query_term = os.environ["fda_query_term"] env_field_term = os.environ["field"] fda_key = os.environ["fda_key"] def main(): print("<h1>Query term: " + query_term + "</h1>") url = "https://api.fda.gov/drug/label.json?api_key=" + fda_key + "&search=" + query_...
true
c97486bcf3f904622ea7fc2be9d8b4cb40e6cecf
cs2be/VisualDL
/visualdl/python/cache.py
UTF-8
1,512
3.46875
3
[ "Apache-2.0" ]
permissive
import time class MemCache(object): class Record: def __init__(self, value): self.time = time.time() self.value = value def clear(self): self.value = None def expired(self, timeout): return timeout > 0 and time.time() - self.time >= timeout...
true
84739450c30c7092234cf40c25ada2cd725ba3ab
github653224/GitProjects_PythonLearning
/PythonLearningFiles/麦子学院Python学习笔记/for_test.py
UTF-8
465
3.625
4
[]
no_license
number=59 num_chaces=3 print("your chances is "+ str(num_chaces)+"\ttimes") for i in (1,(num_chaces+1)): print("chance "+str(i)) guess=int(input("enter your luck NO.:")) if guess==number: print("you guessed it rightly !") break elif guess<number: print("your NO. is small "+"you...
true
7279ff0f3308cba918982e38828acf9bea506827
anirudhr95/Quadcopter_final_year_project
/Pi Server/Server/CustomLogger.py
UTF-8
5,205
2.84375
3
[]
no_license
""" Logs each kind of input differently """ import logging import logging.config import os from logging.handlers import RotatingFileHandler import Constants class arduino_logger: def __init__(self): self.logger = logging.getLogger("ARDUINO") formatter = logging.Formatter( Constants.LO...
true
4bbcdf19694a2dc07c9a702d6c17151d6fe2b446
p-smaxh/pp1
/03-FileHandling/24.py
UTF-8
352
2.734375
3
[]
no_license
tab = [['Marek','Zelnik','zelnik@sed.pl'],['Ewa','Maj','maje@wp.pl' ],['Piotr','Wyga','wygap@gop.pl']] with open('tabdwu24.csv','w') as plik: plik.write('imie\t') plik.write('nazwisko\t') plik.write('email\n') for x in range (0,3): for y in range(0,3): plik.write(tab[x][y]) ...
true
084cd6aba1c2a75db761210c0564741b9e769181
twam/matplotlib-XKCDify
/XKCDify.py
UTF-8
10,022
2.875
3
[]
no_license
# XKCD plot generator # # Licensed under CC-BY-SA 3.0 (http://creativecommons.org/licenses/by-sa/3.0/) # # based on work by # Jake Vanderplas (http://jakevdp.github.com/blog/2012/10/07/xkcd-style-plots-in-matplotlib) # Damon McDougall (http://www.mail-archive.com/matplotlib-users@lists.sourceforge.net/msg25499.ht...
true
d82848c159375b4ff0d02afbff2852663e664446
damascopaul/PD_ZD_RedEye
/slee.py
UTF-8
3,848
2.578125
3
[]
no_license
#!/usr/bin/env python import requests import datetime import json import requests.exceptions import sys TIME=datetime.datetime.utcnow() #PagerDuty Specific Variables PD_SUBDOMAIN='' PD_USER='' PD_PWD='' #ZenDesk Specific Variables ZD_SUBDOMAIN='' ZD_USER='' ZD_PWD='' ZD_REQUESTER='' ZD_GROUP='' ZD_ASSIGNEE='' #Gets...
true
1a318f90d4b4e7e1939e11ddb21ee31fda1c093e
guilmeister/holbertonschool-higher_level_programming
/0x04-python-more_data_structures/9-multiply_by_2.py
UTF-8
230
3.21875
3
[]
no_license
#!/usr/bin/python3 def multiply_by_2(a_dictionary): new_dictionary = a_dictionary.copy() for x in new_dictionary: double = new_dictionary[x] * 2 new_dictionary.update({x: double}) return new_dictionary
true
ce6ed2548f03cf0b30f32c98feee202cef2c053c
pako535/flashcards
/cards/models.py
UTF-8
909
2.703125
3
[]
no_license
from django.db import models # Create your models here. class MyUser(models.Model): class Meta: verbose_name = 'Użytkownik' verbose_name_plural = 'Użytkownicy' login = models.CharField(max_length=100, unique=True, verbose_name="Login") password = models.CharField(max_length=100, verb...
true
b59b1e893a0a31c69aeaa1ec6b60a141883092ae
emilianoNM/Clase2018Tecnicas
/Clase1402018/testbibliotecaBCS.py
UTF-8
2,308
3.484375
3
[]
no_license
#Benjamin Cruz Sarmiento import BibliotecaBCS #Definiendo a los libros y sus atributos Libro1=BibliotecaBCS.BibliotecaUNAM("Mi padre","Sri Kahan Freud",60) print("Nombre del libro: ",Libro1.Titulo) print("El autor es: ",Libro1.Autor) print("Costo del libro es: ",Libro1.Precio,"pesos") print("") print("") Libro2=Bi...
true
c2d50734cb8c2fa1e4cd070fc04daacec201d1cb
brandontrabucco/mineral
/mineral/core/samplers/sampler.py
UTF-8
2,185
2.828125
3
[ "MIT" ]
permissive
"""Author: Brandon Trabucco, Copyright 2019""" import time from abc import ABC, abstractmethod class Sampler(ABC): def __init__( self, max_path_length=100, num_warm_up_paths=20, num_exploration_paths=20, num_evaluation_paths=20, selector=None, ...
true
a904851634e516a7c0c7a007f60aee63787da8a9
abelcarreras/PyQchem
/examples/rasci_srdft.py
UTF-8
2,940
2.6875
3
[ "MIT" ]
permissive
# Example of the use of srDFT method in RASCI from pyqchem.qchem_core import get_output_from_qchem from pyqchem.qc_input import QchemInput from pyqchem.parsers.parser_rasci import parser_rasci from pyqchem.structure import Structure from pyqchem.tools import rotate_coordinates import numpy as np import matplotlib.pypl...
true
97ed81298fee2594dfa6c0a6d7d48efcdc273a36
Rohit555-ui/learn-git
/DF.py
UTF-8
764
2.953125
3
[]
no_license
from flask1 import * import sys import pandas as pd name = sys.argv[1] address = sys.argv[2] marks = sys.argv[3] myConnection = get_connection_from_pool() curr_diff = myConnection.cursor() check = {} insert_query = "insert into student(name,address,marks) values(%s,%s,%s)" val = (name, address, marks) check['query']...
true
12e1b0305f9f375f4d3a828ce81f489621199b50
linbirg/tools
/tuntap/mock_udp.py
UTF-8
491
2.90625
3
[]
no_license
import socket import time def mock_send_to(ip='192.168.2.82', port=7878): # 创建套接字 udp_socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) # 读取输入的数据 send_data = 'hello, i m mock udp!' # 发送数据 send_addr = (ip, port) udp_socket.sendto(send_data.encode('utf-8'), send_addr) # 关闭 ...
true
022ff0d81da8d6fb59eeee1a48046e356b0e1845
azinit/pydoodle
/core/controls/input.py
UTF-8
2,605
2.609375
3
[]
no_license
from core.controls import Control, Label class Input(Control): def __init__(self, x, y, width, height, screen, **props): Control.__init__(self, x, y, width, height, screen, **props) self.label = Label("ZZZ", x, y, self.screen, **props) self.max_length = props.get("maxlength", 16) s...
true
ee390cf112b843ac22b8b0ab1f561e98669f3583
GreXLin85/lyricvideo
/LyricFileParser.py
UTF-8
1,177
3.125
3
[]
no_license
from operator import itemgetter class LyricsParser: def __init__(self, text_path, separator='`'): self.lines_list = LyricsParser.parse_lyric_text(text_path, separator) def find_lyrics_time(self, timecode_seconds): ret_lines = [] for sec_start, sec_end, lyric_line in self.lines_list: ...
true
133e8a0bcac8fe5850e4769ed77b726741d1dcf8
panggggg/workshop2
/set/access_set.py
UTF-8
127
2.890625
3
[]
no_license
# EX2 fruits = {"apple", "banana", "cherry"} if "apple" in fruits: print("Yes,apple is fruits!") # Yes,apple is fruits!
true
dcf968905c60a2b0d56cd24457ae39459cba9d5e
AaronDonaldson74/Python-Notes
/function_syntax_basics.py
UTF-8
411
3.859375
4
[]
no_license
def full_name(first, last): print(f'{first} {last}') full_name('Aaron', 'Donaldson') def auth(email, password): if email == "aaron.donaldson74@gmail.com" and password == "secret": print('Authorized') else: print('Not authorized') auth('aaron.donaldson74@gmail.com', 'secret') def hundred(): for num i...
true
6f7468d1051f2825ceb0e4d1b904ef1df4385d37
maandree/pipes-are-slow
/plot
UTF-8
1,207
2.90625
3
[ "FSFAP" ]
permissive
#!/usr/bin/env python3 import sys, math import matplotlib.pyplot as plot #plot.xkcd() fig = plot.figure(figsize = (3 * 2, 4 * 2)) data = sys.stdin.read().split('\n') graphs = {} points = set() values = set() for line in data: if line == '': continue while ' ' in line: line = line.replace(' ...
true
40dfc2181ed9f383b827771e3a2a6e2e75dda944
btschu/CodingDojoAlgorithmsBook
/Chapter9-RECURSION/rBin.py
UTF-8
626
3.53125
4
[]
no_license
def rBin(arr, val): low = 0 high = len(arr)-1 def helper(low, high): mid = (low + high)//2 print("low:", low, "high:", high, "mid:", mid, "current:", arr[mid], "val:", val) if low == high: if arr[mid] == val: return mid else: ...
true
63d2913142a7c91fe4d7c83797ec8140e705a6b5
dr-dos-ok/Code_Jam_Webscraper
/solutions_python/Problem_210/235.py
UTF-8
1,507
2.703125
3
[]
no_license
import numpy as np import math #------------------------------------ # Read inputs t = int(raw_input()) for i in xrange(1, t + 1): Ac,Aj = [int(s) for s in raw_input().split(" ")] TA = [] tc = 0 tj = 0 for j in range(0,Ac): tp = [int(s) for s in raw_input().split(" ")] TA.append((...
true
500c888ac5cdc830c44fc63794769bebd331e951
itsyashshah/dataone-challenge
/program.py
UTF-8
876
3.546875
4
[]
no_license
import csv with open('data.csv') as csvfile: readCSV = csv.reader(csvfile, delimiter=',') shopid = [] price = [] product = [] for row in readCSV: for the_product in row[2::]: shopid.append(row[0].strip()) price.append(float(row[1].strip())) produ...
true
c566d15b15319f57ecaf38a9d175f2b24550ad89
fmoo/gamedata
/src/ffrk/ffrk_utils.py
UTF-8
674
2.515625
3
[]
no_license
import urllib import os.path import requests import html5lib def enum_names(cls): return [e.name for e in cls] def enum_values(cls): return [e.value for e in cls] def requests_get(url): cachefile = os.path.join('cache', urllib.quote(url, '')) if os.path.exists(cachefile): with open(cachefile,...
true
081950d00528a0c0ac19deb6c1a8b3115af3ab79
Aasthaengg/IBMdataset
/Python_codes/p02928/s294189106.py
UTF-8
372
2.78125
3
[]
no_license
N, K = map(int, input().split(" ")) mod = 10 ** 9 + 7 A = list(map(int, input().split(" "))) num = [0 for i in range(N)] trip = 0 for i in range(N): for j in range(N): if A[i] < A[j]: num[j] += 1 if i < j and A[i] > A[j]: trip += 1 ans = (trip * K) % mod for n in num: a...
true
09f3d0add69c27448930a2f466b7191e1273bf21
asdf2014/algorithm
/Codes/gracekoo/85_maximal-rectangle.py
UTF-8
1,241
3.53125
4
[ "Apache-2.0" ]
permissive
# -*- coding: utf-8 -*- # @Time: 2020/3/30 22:22 # @Author: GraceKoo # @File: 85_maximal-rectangle.py # @Desc:https://leetcode-cn.com/problems/maximal-rectangle/ from typing import List class Solution: def maximalRectangle(self, matrix: List[List[str]]) -> int: max_area = 0 dp = [0] * len(matrix[0...
true
0da74876e1a5a1f525889345353f469a11942a68
ken0105/competitive-programming
/procon-archive/atcoder.jp/abc143/abc143_b/Main.py
UTF-8
201
2.890625
3
[]
no_license
import itertools if __name__ == '__main__': n = int(input()) d = list(map(int,input().split())) ans = 0 for i in itertools.combinations(d,2): ans += i[0] * i[1] print(ans)
true
4725c0a4d31152a65eb1a67e22a61025eb8c65a2
CaptainJi/Hogwarts
/web/test_cookie.py
UTF-8
1,764
2.71875
3
[]
no_license
import shelve from time import sleep from selenium import webdriver from selenium.webdriver.chrome.options import Options from selenium.webdriver.common.by import By # 使用cookie方式操作 class TestCookies(): def setup(self): # 复用浏览器获取cookie chrome_options = Options() # chrome_options.debugger_a...
true
80e0a63488234c69001fa71e11652ce02cbc70a2
thevarunnayak/pythonprograms
/basicprograms/Pyramid Pattern.py
UTF-8
264
4.0625
4
[]
no_license
""" 1 212 32123 4321234 Program to print this in a single loop Time complexity is O(n) If there are 2 loops, time complexity is O(n^2) """ n = int(input()) for i in range(1,n+1): print(" "*(n-i),*range(i,1,-1),*range(1,i+1,1),sep="")
true
8796efd0974c7c9e9a5dc89c33a3f8a9e57c67b8
tst2005/lua-mimetypes
/generate.py
UTF-8
360
2.59375
3
[ "MIT", "Apache-2.0" ]
permissive
# This Python script was used to generate most of the MIME types. # The original run was on Python 2.7.1. import mimetypes from operator import itemgetter list = mimetypes.types_map.items() def sortkey(pair): return pair[1].split("/")[0], pair[0] list.sort(key=sortkey) for (ext, mt) in list: print ('extens...
true
46ee4b48194c58b019ef595a1cf4dcec8e9613e6
semicloud/simplenetwork
/python/plot_3d.py
UTF-8
583
2.953125
3
[]
no_license
import numpy as np import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import axes3d from matplotlib import cm x = np.arange(-10, 10, 0.1) y = np.arange(-10, 10, 0.1) X, Y = np.meshgrid(x, y) Z = 1/20*(X**2) + Y**2 # plt.subplot(121) fig = plt.figure(figsize=(8,4)) fig.add_subplot(121, projection='3d') ax = f...
true
276c70889922ba9669b01840677dcce57ef3b4a2
svmfbs/AnalyzeMe
/ep_utils.py
UTF-8
588
3.046875
3
[]
no_license
""" This is time for EPower """ #!/usr/bin/env python # -*- coding: utf-8 -*- import os import sys sys.dont_write_bytecode = True # dont make .pyc files def padding_zero(num2): if len(num2) == 1: return '0' + num2 return num2 def get_key_from_value(dict, val): keys = [k for k, v in dict.items...
true
386482cca02dc909e743852bf9ed82105f5bb17e
PacktPublishing/Python-GUI-Programming-with-Tkinter
/Chapter13/sample_http_server.py
UTF-8
1,001
2.953125
3
[ "MIT" ]
permissive
from http.server import HTTPServer, BaseHTTPRequestHandler from time import sleep class TestHandler(BaseHTTPRequestHandler): def _print_request_data(self): content_length = self.headers['Content-Length'] print("Content-length: {}".format(content_length)) data = self.rfile.read(int(content_...
true
076f76867725e898bd83d4489cc94e664ca1c25d
dockerizeme/dockerizeme
/hard-gists/6af6a8478561aa8a0121/snippet.py
UTF-8
3,785
2.859375
3
[ "Apache-2.0" ]
permissive
__author__ = 'Eslam Hamouda | eslamx.com' import configparser import os.path import json import io # get the required files paths to access Firefox AppData win_user_profile = os.getenv('USERPROFILE') ff_path = r'{0}\AppData\Roaming\Mozilla\Firefox'.format(win_user_profile) ini_path = "{0}\\profiles.ini".format(ff_pa...
true
469d6953d6cdd4bc10689ee1f8a1349503018497
NathHuch/PFE_CNN
/CNN.py
UTF-8
2,399
2.671875
3
[]
no_license
# Plot ad hoc mnist instances import os import numpy as np from keras.models import Sequential from keras.callbacks import TensorBoard from keras.layers import Dense from keras.layers import Dropout from keras.layers import Flatten from keras.layers.convolutional import Conv2D from keras.layers.convolutional import Max...
true
ab2fdffdaab4ccac0c7105d7930a5485a84222eb
khelwood/advent-of-code
/2017/09_stream.py
UTF-8
1,439
3.4375
3
[]
no_license
#!/usr/bin/env python3 import sys def remove_junk(text): output = [] j = 0 i = text.find('<') while i >= 0: if i>j: output.append(text[j:i]) j = find_junk_end(text, i)+1 i = text.find('<', j) if j < len(text): output.append(text[j:]) return ''.join(o...
true
2f31706c7ad2c307c3d4f16f4994d9bd9e51ef49
huazhige/EART119_Lab
/hw4/submissions/sheridanzachary_33570_1302672_Problem_2.py
UTF-8
2,217
3.875
4
[]
no_license
# -*- coding: utf-8 -*- """ -Trying secant method first """ import numpy as np import matplotlib.pyplot as plt #===================function definitions====================================== def f_fct(t): #f(t) return 1.1*(t-2.5)**2 def g_fct(t): #g(t) return 5*t+2.5 def main_fct(t): #f(t)...
true
81105af112b0bb9db8e1ab287c7a76e00471b503
volprjir/Geocoder
/tests/test_scripts.py
UTF-8
673
2.609375
3
[]
no_license
import pytest import glob import os import scripts as s @pytest.fixture() def set_test_folder(): s.temporary_file_paths = ["tempfile/*"] [os.remove(f) for f in glob.glob("tempfile/*")] @pytest.fixture() def create_tmp_file(): with open("tempfile/test.txt", "w"): pass def test_empty_count_temp_...
true
ba2bf23989eaa4835ea4537cc01bafb50d12aac0
LChanger/LeetCode
/LeetCode/LeetCode48.py
UTF-8
763
3.734375
4
[]
no_license
class Solution: def rotate(self, matrix) -> None: """ Do not return anything, modify matrix in-place instead. """ n=len(matrix) for layer in range(int(n/2)): for j in range(layer,n-layer-1): x,y=layer,j temp=matrix[x][y] ...
true
eccd52b484a768b67f660b5909f397979299bf11
Kalior/clustering-genomic-signatures
/src/util/draw_clusters.py
UTF-8
6,889
2.609375
3
[]
no_license
import os import matplotlib.pyplot as plt from matplotlib.lines import Line2D import matplotlib.colors as colors import matplotlib.cm as cmx import networkx as nx from networkx.drawing.nx_agraph import graphviz_layout import random from collections import Counter def draw_graph(clustering_metrics, meta_name, meta_ke...
true
3fa3c6214310864ab78bbad2d12e79a11c4b4f6c
tomMoulard/python-projetcs
/scripts3/harry.py
UTF-8
1,480
3.34375
3
[ "Apache-2.0" ]
permissive
#made by moular_b import random def printMat(m): s = "|{:2d}" for x in m: for y in x: print (s.format(y), end='') print("|") def makeARoom(h, w): res = [] for x in range(h): tmp = [] for y in range(w): tmp.append(random.randint(1...
true
569d2204d8f284e5a0e7799c1882d64a4f096c37
doziej84/useful_script
/strong_motion/read_V12SAC.py
UTF-8
12,236
2.5625
3
[]
no_license
import numpy as np import matplotlib.pyplot as plt import glob import math import shutil from matplotlib.widgets import Button import os from obspy.sac import SacIO from obspy import UTCDateTime from obspy.core.util.geodetics import gps2DistAzimuth ''' This script is to read in the V1 files from the strong motion cen...
true
2420c24a9f8fbf800eb78183a53b6415cf585ed2
lcthoIFI/processingDialog
/proces_dialog.py
UTF-8
5,023
2.53125
3
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- import time from dateutil.parser import parse import os import re def removeSpecificCharacters(text): return re.sub('[!@#$\n<>]', '', text) def isTimeFormat(input): try: try: parse(input) return True except Exception as e: ...
true
4a32bfde4d9852acf8c3bccec835bc0661f50da5
Q1an/ProjectEuler
/p15.py
UTF-8
164
3
3
[]
no_license
n = 20 + 1 grid = [[1 for x in range(n)] for x in range(n)] for a in range(1,n): for b in range(1,n): grid[a][b]=grid[a-1][b]+grid[a][b-1] print(grid[n-1][n-1])
true