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
55ed6d579cbcaf0fcce2797ae407f30dbea1ee1e
alexeyche/alexeyche-junk
/biomap/main.py
UTF-8
2,618
2.625
3
[]
no_license
import time from util import shl, shm, shs from sklearn.datasets import make_classification import numpy as np import tensorflow as tf def get_toy_data(n_features, size=2000, seed=2): x_values, y_values = make_classification( n_samples=size, n_features=n_features, random_state=...
true
9348d38f550362c9d7ee017ae6c6795ed485eb07
vaibhavpandey11/daily_coding_problem
/Problem 046.py
UTF-8
1,439
3.9375
4
[]
no_license
''' This problem was asked by Amazon. Given a string, find the longest palindromic contiguous substring. If there are more than one with the maximum length, return any one. For example, the longest palindromic substring of "aabcdcb" is "bcdcb". The longest palindromic substring of "bananas" is "anana". ''' #__...
true
5121566015453a3c911e5c92675f4783be33a3d6
Yhatoh/ProgramacionCompetitivaUSM
/soluciones/RPC/2020-6/K_long_long_long_is_too_long.cpp.py
UTF-8
760
2.671875
3
[ "MIT" ]
permissive
kb = { 'a': 'abjk', 'b': 'bacjkl', 'c': 'cbdklm', 'd': 'dcelmn', 'e': 'edfmno', 'f': 'fegnop', 'g': 'gfhopq', 'h': 'hgipqr', 'i': 'ihqr', 'j': 'jabkst', 'k': 'kabcjlstu', 'l': 'lbcdkmtuv', 'm': 'mcdelnuvw', 'n': 'ndefmovwx', 'o': 'oefgnpwxy', 'p': 'pfghoqxyz', 'q': 'qghipryz', 'r': '...
true
6155abb599d21b1e84d0af344b6b304a13f5542f
akhYalda/snippets
/tdt4110/2012k/t4.py
UTF-8
4,594
3.03125
3
[]
no_license
""" Oppgave 4 – Mer programmering (40 %) Vi har data fra en pulsklokke som er en vektor med hjertefrekvensen (antall pulsslag pr sekund) for hver sekund av en treningstur. Data for en treningstur på 20 sekunder kan for eksempel være: [110,118,125,127,127,130,129,131,132,134,134,135,145,157,165,172,173,178,179,178]...
true
9c4f20e5ea1bddfc64173c3e068ad9a6d824f4a7
sidmishraw/python-ds-suite
/example.py
UTF-8
448
2.8125
3
[]
no_license
''' Test suite for using my DS implementations suite ''' __author__ = 'sidmishraw' def build_linked_list(list_of_items): 'tests for linked lists' from lists.lists import LinkedList print('building linked list %s' % list_of_items) l = LinkedList() for item in list_of_items: l.insert(item) print('li...
true
7c3a82b5c61c8071d0ccbe4b4e73ded9438c7574
northwestjeff/Yoga_scraper
/yogatest.py
UTF-8
1,857
3.359375
3
[]
no_license
import csv directory_dict = {} file = open("yogafile.csv") filereader = csv.reader(file, delimiter=",") yoga_dir = [row for row in filereader] def remove_map(): """ Scraper brought in a "map" string. This removes it """ for i in yoga_dir: i[1] = i[1][:-5] def zip_strip(): """ Chec...
true
9b034a13f1bdec1ad4416c8107219626fcbcf595
seongwookchun/krtpy
/krt/utils/cstr.py
UTF-8
1,480
3.296875
3
[]
no_license
class Cstr(str): ord_upper = ord('天') ord_lower = ord('地') ord_const_upper = ord_upper - ord('A') ord_const_lower = ord_lower - ord('a') def __init__(self, obj): super().__init__() self.content = obj def to_specialChr(self): for idx, c in enumerate(self.content): ...
true
77eaa695f31b6611a1bb77867a130ce9fd59a25f
asymptotebag/candy-cabin
/Image_Artist.py
UTF-8
29,873
2.890625
3
[]
no_license
import PIL import os.path import PIL.ImageDraw import random import PIL.ImageFont import tkinter as tk from tkinter.filedialog import askopenfilename,askdirectory from PIL import ImageTk from PIL import ImageFilter ''' global variable: - filter - logo = (location, color) - text = (messag...
true
e2c781bfbaf9ce0ee9336c8143f4f7b904f3a2c5
koehlma/rigorous
/tests/python/programs/original/k-python/programs/testsetattr3.py
UTF-8
328
2.921875
3
[]
no_license
def a(): pass x = 5 y = "x" a.__module__ = x a.__name__ = y assert a.__module__ is x == 5 assert a.__name__ == y == "x" x = 6 y = "y" setattr(a, "__module__", x) setattr(a, "__name__", y) assert a.__module__ is x == 6 assert a.__name__ == y == "y" try: a.__name__ = 5 assert False except TypeError: z = 1 assert...
true
1fcb469db51709c552fa14f7c5e480453cd8acf5
jacobturjeman/turtle_crossing_game
/player.py
UTF-8
674
3.3125
3
[]
no_license
from turtle import Turtle STARTING_POSITION = (0, -280) MOVE_DISTANCE = 10 FINISH_LINE_Y = 280 class Player(Turtle): def __init__(self): super().__init__() self.penup() self.setheading(90) self.shape("turtle") self.goto(STARTING_POSITION) def move(self): """ ...
true
abb8a4880d5f78720ebb52506ec7faa8209c3265
dzervas/cython_go_sharelibs
/run.py
UTF-8
427
2.78125
3
[]
no_license
import os from ctypes import cdll for project in os.listdir("build"): for libfile in os.listdir("build/" + project): if not libfile.endswith(".so"): continue lib = cdll.LoadLibrary("build/" + project + "/" + libfile) try: print(f"{project}/{libfile}: {lib.Hello()}")...
true
a4833ae7ed86ddd033a2ab431a41a778fc1c8e13
jderiu/e2e_nlg
/src/data_processing/vectorize_data.py
UTF-8
5,312
2.609375
3
[]
no_license
import argparse import json import os import logging from typing import Dict, List, Set, Tuple import numpy as np import _pickle as cPickle from src.data_processing.utils import convert2indices, PREPROCESSED_DATA, _load_delex_data, _save_vectorized_data def _compute_vector_length(mr_ontology: Dict[str, Dict[str, int]...
true
b033e07efc6b2f41fa8dcc94a8f85d183ea818b5
bandiayyappa/pythonprograms
/timedifference.py
UTF-8
387
3.578125
4
[]
no_license
from datetime import datetime as dt time1 = input('Enter time in HH:MM:SS').strip() time2 = input('Enter time in HH:MM:SS').strip() format_ = '%H:%M:%S' def time_difference(time1,time2): try: tdelta = dt.strptime(time2, format_) - dt.strptime(time1, format_) return tdelta except Exception as e:...
true
f11e0b85445de0394a60a839a85b2d9dac30634e
ShreyanshJoshi/CS-F407---Artificial-Intelligence
/Programming Assignment 2/Source Code/driver.py
UTF-8
5,763
3.171875
3
[]
no_license
from Agent import * # See the Agent.py file import basic_func import perception_func import infer_func import clear_doubt_func import move_func from pysat.solvers import Glucose3 ag = Agent() safe = [[1,1], [4,4]] # Stores all states agent knows are sa...
true
74d6696178678e23eb47db6f5fae4a9e45dbb6f4
natoftheboonies/advent-of-code-2017
/day14.py
UTF-8
1,172
3.203125
3
[]
no_license
import day10 hexstuff = '0123456789abcdef' def hex2bin(hash): return ''.join(map('{0:04b}'.format,[hexstuff.index(x) for x in hash])) def sample(): sample = 'flqrgnkx' for x in range(8): hash = day10.part2(sample+'-'+str(x)) print(hex2bin(hash)[:8]) print('sample',part1(sample)) def part1(input): used = 0 ...
true
46fe172b21845c10204c42c8e3a1e12909a16212
matthew-kimm/RecSearch
/RecSearch/Tests/DataInterfaces/Neighborhoods/Test_grade_attribute_match.py
UTF-8
1,906
2.609375
3
[ "MIT" ]
permissive
import unittest import pandas as pd from RecSearch.DataInterfaces.Neighborhoods.grade_attribute_match import IXNeighborAttributesMatchOverlapGradeHistory class TestNeighborhoodGradeAttributesMatch(unittest.TestCase): def setUp(self): self.Interface = IXNeighborAttributesMatchOverlapGradeHistory() s...
true
b2a7e8cc6ba68195e8ffb7db61f81feadfa3375e
vickxxx/Wifi-sniffer
/approximate.py
UTF-8
2,051
2.890625
3
[]
no_license
import math import xml.etree.ElementTree as ET import pickle import glob, os import time import json #Eric Ohman 24/7 2015 #This script takes in all our points for each macAddress and returns our best estimate of where that person is #based on the signal strengths. iteration = "default" try: signals = pickle.load(ope...
true
f2ca25956b45e850cb50d78e56ca80fdf52bb1bf
andykmc/leetcode
/747-largest-number-at-least-twice-of-others/solution.py
UTF-8
454
3.171875
3
[]
no_license
''' Space: O(1) Time: O(n) ''' class Solution: def dominantIndex(self, nums: List[int]) -> int: largest = 0 larger = 0 index = 0 for i, num in enumerate(nums): if num > largest: index = i larger = largest largest = num ...
true
bda5e0210234ab65a61de0ae3febba9abe12f45d
reetamdutta1/TCS-Ninja-Coding-Qstns-Solutions-only-Python-
/Codes/TCS Python Fundamentals/3. Reading file.py
UTF-8
457
3.09375
3
[]
no_license
def create_doctors(): d_list=[] with open('doctors_list.txt','r+') as doctor: d=doctor.readlines() for i in d: j=i.split('|') d_list.append([j[0],j[1],int(j[2])]) return d_list if __name__=="__main__": doctors=create_doctors() #print (doctors) ...
true
b8cbc75c3de200087c0b74f9f5190a94767cc7cf
saeki1120cat/python_Flask
/static_folder/main.py
UTF-8
808
2.640625
3
[]
no_license
from flask import Flask app = Flask(__name__, static_url_path='/static', static_folder='./static') @app.route('/look_sakura') def look_sakura(): outStr = """ <link href="/static/css/mystyle.css" rel="stylesheet" type="text/css"> <head> <meta name="viewport" content="width=device-width, in...
true
a8848392c7a3c906dc9f220c872fb8f6d6322a6b
PranjalPandey/Talking-python
/ChatApplication/speech_rec/area_hs.py
UTF-8
527
3.6875
4
[]
no_license
from tp_pkg.mysay import print_say from tp_pkg.myscr import voice_to_text print_say('What is the length of the rectangle?') # Convert the voice input to a variable inp1 inp1 = voice_to_text() print_say(f'You just said {inp1}.') # Ask the width of the rectangle print_say('What is the width of the rectangle?') # Save th...
true
26b05042316466c7005b0d70fce004d69a5142a8
qwqw82000/streamlit
/image_editing_app_004.py
UTF-8
4,682
3.109375
3
[]
no_license
import streamlit as st import cv2 from PIL import Image, ImageEnhance import numpy as np import os face_cascade = cv2.CascadeClassifier("./haarcascade_frontalface_default.xml") eye_cascade = cv2.CascadeClassifier("./haarcascade_eye.xml") def detect_faces(our_image): new_img = np.array(our_image.convert("RGB")) ...
true
04dd968aba564f16089348e988d965e45deab62a
Shreya1771/python-flask
/example/server.py
UTF-8
993
2.671875
3
[]
permissive
from flask import Flask from flask_opentracing import FlaskTracer import lightstep.tracer import opentracing import urllib2 app = Flask(__name__) # one-time tracer initialization code ls_tracer = lightstep.tracer.init_tracer(group_name="example server", access_token="{your_lightstep_token}") # This tracer traces all ...
true
b9253f5888bf810c147e668ca6b82cd463233767
SachinMadhukar09/100-Days-Of-Code
/06.Sorting/Day 28/10 August 02 Daffodil Test.py
UTF-8
155
2.9375
3
[]
no_license
n=int(input()) l=list(map(int,input().split(" "))) t=int(input()) for i in range(n): for j in range(n): if l[i]+l[j]==t: print(i,j)
true
be2b36b834a9d4d2817d778e242f1b6b29a60195
cellhunter79/MDOT
/Reaction_Time_v1/reaction_time_v5.py
UTF-8
5,999
2.6875
3
[]
no_license
# Python code for measure reacation time in human subject # with computer monitor and keyboard import matplotlib.pyplot as plt import numpy as np import time from matplotlib.widgets import Button from PIL import Image #Z = np.random.uniform(1,100,100).reshape((10, 10)) road_im = Image.open("road2.png") image_raw =...
true
4eea7fa980cd1679ee3dcb992d4f4e65175de4aa
zebant2/missing_number
/missingnum.py
UTF-8
641
3.34375
3
[]
no_license
__author__ = 'HP' def convert(final_array): # list to an integer num = int(''.join(map(str, final_array))) return num def find_missing(first_array, second_array): # finding the missing number if len(first_array) > len(second_array): final_array = list(set(first_array) - set(second_array)) ...
true
e462b4894414d0d1f63dea7f833085b5cff0093e
Gerardo-Cabrera/eight_queens_puzzle
/eightQueensPuzzle/eightQueens.py
UTF-8
2,230
3.6875
4
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- import database as db class EightQueens: #def __init__(self, size): def __init__(self, size=None): self.min_option = 8 self.size = size self.solutions = 0 self.test = False self.solutions_puzzle() # Generar tablero con las reinas def board(sel...
true
edf0aacb8ff65787afe581b21a6aae7b2b502f26
jly-ml/manual_apriori_associationrule
/p1_a.py
UTF-8
3,392
3.015625
3
[]
no_license
#DATA MINING #project 1 # FUNCTION SET from fractions import Fraction from itertools import permutations def powerset(A): A = (list(filter(lambda a: a != 0, A))) if A == []: return [[]] a = A[0] incomplete_pset = powerset(A[1:]) rest = [] for set in incomplete_pse...
true
17a896e30631abaa9fdb1c0680c426e515125c94
Yasinaaa/AndroidViewAnalyserNeuralNetwork
/predict.py
UTF-8
477
2.546875
3
[]
no_license
import numpy as np from keras.preprocessing import image from keras.models import load_model test_image = image.load_img('dataset/single_prediction/test4.PNG', target_size = (24, 24)) test_image = image.img_to_array(test_image) test_image = np.expand_dims(test_image, axis = 0) classifier = load_model("android.h5") re...
true
d702f5313f4039f49a300ab92a32f9adb756e047
sarjunwadkar/real-python-test
/flask-blog/sql.py
UTF-8
427
2.765625
3
[]
no_license
import sqlite3 with sqlite3.connect("blog.db") as conn: cursor = conn.cursor() cursor.execute("""CREATE TABLE posts (title TEXT, post TEXT) """) cursor.execute('insert into posts values("Good", "I m good")') cursor.execute('insert into posts values("Well", "I m well")') cursor.execute('insert into posts va...
true
9431316c63a80332af751adba760f7c7603eca3b
solingenn/waspaAPI
/fraudFile.py
UTF-8
3,874
2.734375
3
[]
no_license
#!/usr/bin/env python3 import yaml import xml.dom.minidom as xmlDom import xml.etree.ElementTree as ET import requests import argparse def login(url, headers, action, version, wasp, password, trace): # XML string for login loginData = '''<?xml version="1.0" encoding="utf8"?> <loginrequest> <actio...
true
43aefc504c46783c45245da710225d1cab808858
ryee1/twittersearcherproject
/twitterscraper/scripts/combine_tweets.py
UTF-8
96
2.953125
3
[]
no_license
def combine_tweets(tweets): words = [] for t in tweets: words += t.split() return words
true
95c8d00752e4405f67f74ff053e3d9ac9f13a6e1
genewitch/cloud-scripts
/AWS/pywikiredis.py
UTF-8
2,643
2.90625
3
[]
no_license
import xml.sax import string import redis import re def injectPipe(rInstance, textString): """increments redis object's key for each word in textString Not going to bother fixing globals now. input: wiki article text (literally) output: a more full pipeline ...
true
281409b35bd74364e9a54cb3bcc1c4a49ff90383
sharondsza26/python-Technology
/Database/multiTuple.py
UTF-8
499
3.203125
3
[]
no_license
# stage5 import sqlite3 db = sqlite3.connect('Login.db') print("Connection Established"); Users = [("harry","potter"), ("tom","cat"), ("jon","snow")] cur = db.cursor() # cur.execute("DROP TABLE users") cur.execute("CREATE TABLE users(username TEXT,password TEXT)") cur.executeman...
true
46f5e395f90759f2ae73ad41e3cc53df091caded
NULLCT/LOMC
/src/data/66.py
UTF-8
589
3.109375
3
[ "MIT" ]
permissive
from collections import deque n, q = map(int, input().split()) g = [[] for i in range(n)] for i in range(n - 1): a, b = map(int, input().split()) g[b - 1].append(a - 1) g[a - 1].append(b - 1) dist = [-1] * n dist[0] = 0 queue = deque() queue.append(0) while len(queue) != 0: v = queue.popleft() f...
true
d0d9eb226d9f13c05c330e3809d20d85452dfab4
4doctorstrange/DS-and-Algorithms-in-Python
/solved/lcs/length of longest common substring.py
UTF-8
741
3.15625
3
[]
no_license
#lenght of longest common substring def lcs(): for i in range(m+1): #initialization for j in range(n+1): if i==0 or j==0: cache[i][j]=0 for i in range(1,m+1): for j in range(1,n+1): if x[i-1]==y[j-1]: cache[i][j]=cache[i-1]...
true
90b898d267c5cf530e13a6b2fb3df05a20ace365
SaiK95/Astro
/src/stacking/stacker.py
UTF-8
1,358
2.796875
3
[ "MIT" ]
permissive
from natsort import os_sorted import numpy as np import PIL import cv2 import os class Stacker(): def __init__(self, img_dir, sampling_rate=1, start_idx=0, end_idx=-1): self.img_dir = img_dir self.sampling_rate = sampling_rate self.start...
true
923b4ce477f966f7431cce01441091f9743e0db1
qspinat/Super_Resolution_DL2020
/Python/autoencoder/visu.py
UTF-8
1,426
2.546875
3
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sun Jan 24 12:42:37 2021 @author: quentin """ from skimage import transform import numpy as np import torch import matplotlib.pyplot as plt from .AE_preprocess import patch_decomp, patch_recomp def visu(model_CDA,test_dataset,num_images=5,device=torch.dev...
true
8a4a4fcdb638eb2cfd734ef7f62798c154ed6494
kyliewing/LeetCode
/009_PalindromeNumber.py
UTF-8
947
3.953125
4
[]
no_license
#Determine whether an integer is a palindrome. Do this without extra space. #Your runtime beats 29.83% of python submissions. class Solution(object): def isPalindrome(self, x): num_str=str(x) i=0 j=len(num_str)-1 while i<j: if num_str[i]!=num_str[j]: ...
true
d2dfb8f8e09f8f9db5389c14438ed61492d63acc
JosephLevinthal/Research-projects
/5 - Notebooks e Data/1 - Análises numéricas/Arquivos David/Atualizados/logDicas-master/data/2019-1/223/users/4501/codes/1807_2563.py
UTF-8
183
2.625
3
[]
no_license
from numpy import* a=array(eval(input("vetor: "))) while(size(a)>1): b=0 for i in range(size(a)): if(a[i]>=5 and a[i]<7): b=b+1 print(b) a=array(eval(input("vetor: ")))
true
67332539e7334e8baa91b514c9944643f8b06b36
alexj136/JRA
/minty-py/parser.py
UTF-8
15,648
3.734375
4
[]
no_license
from AST import * arithmetic_ops = ['+', '-', '*', '/', '%'] boolean_ops = ['=', '!=', '<', '>', '<=', '>='] class EPrime(object): """ Temporary store for the E' productions of the grammar that can be easily converted into ASTNodes. """ def __init__(self, op, exp, true_exp=None, false_exp=None): self.op = op ...
true
8bf1ae152c0d2ed91224b093074c280959049c3a
Team6Trapesium/kelompok6
/TEDUHSANUBARI_1164054/soal3.py
UTF-8
1,062
2.875
3
[]
no_license
import shapefile #Modul shapefile yang di ambil dari pyshp w=shapefile.Writer(shapeType=1) #Membuat shpfile baru w.shapeType=2 #Mengecek point, line atau polygon, jika () berarti tidak w.shapeType=3 #Mengecek point, line atau polygon, jika () b...
true
8a1a934e4d6a4ded798244a4ff5ed6d76af6f7f9
snasuddertale/Kody
/powtorzenie/losu losu losu losu losu losu.py
UTF-8
372
3.3125
3
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- import random def main(args): liczby =[] for i in range(1): liczby.append(random.sample(range(0, 31), 5)) print("A oto i pięć przecudownych oraz unikalnych liczb losowych (w zakresie od 1 do 30) ", liczby) return 0 if __name__ == '__main...
true
b4eaec8474bb20e0f2408d214ffd6cf5e3b71df6
wquc/misc
/scripts/18-make-unique-bib.py
UTF-8
479
3.0625
3
[]
no_license
inp_name = "reference-raw.bib" out_name = "reference-new.bib" entries = {} with open(inp_name, 'r') as inp_file: for each_line in inp_file: if each_line.startswith("@"): each_bib = "" each_entry = each_line.strip().split("{")[1][:-1] each_bib += each_line if each_l...
true
8f8032b6fd160f8655ccef1dc662b9fb9c397b7d
deb991/TopGear__Projects_n_Assignments
/Python L1 Assignments/data/ip__conv__netMask.py
UTF-8
241
2.8125
3
[ "MIT" ]
permissive
#!/usr/bin/env python import socket import struct cidr = int(input('Enter CIDR to convert into netmask :: ')) host_bits = 32 - int(cidr) netmask__1 = socket.inet_ntoa(struct.pack('!I', (1 << 32) - (1 << host_bits))) print(netmask__1)
true
d817bbde7788e5dcd62eb8a9cdd7f6e47570403d
jesuslosada/scrapy-xlsx
/scrapy_xlsx/exporters.py
UTF-8
3,910
3.09375
3
[ "MIT" ]
permissive
from openpyxl import Workbook from openpyxl.cell.cell import KNOWN_TYPES from scrapy.exporters import BaseItemExporter class XlsxItemExporter(BaseItemExporter): """XlsxItemExporter allows exporting the output items to a XLSX file.""" def __init__( self, file, include_header_row=True, ...
true
73b69d32f717ef6863f2e67b38f1149639b56040
dougstanish/TentsAndTrees
/Tents.py
UTF-8
4,790
3.328125
3
[]
no_license
import random import numpy as np def find_valid_tents(board, tree_location): valid_tent_location = [] board_size = len(board) y = tree_location[0] x = tree_location[1] # Up if y-1 >= 0: # If the location is empty if board[y-1, x] == '': up = np.clip((y-1) - 1, ...
true
2801398b1091dd205077462f4c4876d35afc7b55
jcjimenezb123/python
/edo_sistema10.py
UTF-8
1,028
3.109375
3
[]
no_license
import numpy as np from scipy.integrate import odeint import matplotlib.pyplot as plt def f(U, y): u1, u2 = U alfa = 0.01 Ta = 25 du1dy = u2 du2dy = alfa*(u1-Ta) return [du1dy, du2dy] def main(): L = 10 # Longitud de la barra Tx1 = 50 # temperatura en el extremo x1=...
true
94ba66a0f407cd4f10b7c4f5ad59c417d7b0f8ce
Aasthaengg/IBMdataset
/Python_codes/p02934/s571463008.py
UTF-8
91
2.96875
3
[]
no_license
n = int(input()) a = list(map(lambda x :int(x)**(-1),input().split())) print(sum(a)**(-1))
true
ac7be619ba7f8a07038cf8d03ea1ce06f07eb6b1
lucasrennok/Chat_Py
/v4/main_client.py
UTF-8
1,271
2.875
3
[ "MIT" ]
permissive
import socket import threading import time buffer = "" mesage = "" name = input("What's your name?\n> ") HOST_SERVER = input("Server: ") client_socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) print("\n--If you want to close the chat: Type \'0\' and Enter.--\n") def receiveMesage(): global client_socket ...
true
8d6ec08dafdfbc72550ab27582e9629091b124c2
Kaplun-Alex/Beetroot_Courses
/2021_05_26_CGI_I/cgi-bin/mp3.py
UTF-8
915
2.53125
3
[]
no_license
import glob import os print("Content-type: text/html") print() print() print(''' <!DOCTYPE html>' <html> <head> <meta charset="UTF-8"> <style> table { font-family: arial, sans-serif; border-collapse: collapse; width: 100%; } td, th { border: 1px solid #dddddd; text-align: left; padding: 8px;} tr:nth-child(even) { bac...
true
2f98bb7ee5ced75984d63052a5f97de3842c6d14
iShinta/MIS373MOB-LAB9PY
/mh47723/module1_mh47723.py
UTF-8
7,672
3.609375
4
[]
no_license
from random import randint from copy import deepcopy def beesnees(): res = "" for i in range(100): j = i + 1 if j%3==0 and j%5==0: res += " BEESNEES" elif j%3==0: res += " Bees" elif j%5==0: res += " Nees" else: res += " " + str(j) ...
true
d1f47ad26192ede511385a62f28c143ec60b7f3f
kerry456/lagouS
/Lagou/Lagou/pipelines.py
UTF-8
1,945
2.546875
3
[]
no_license
# -*- coding: utf-8 -*- # Define your item pipelines here # # Don't forget to add your pipeline to the ITEM_PIPELINES setting # See: https://doc.scrapy.org/en/latest/topics/item-pipeline.html import pymysql from Lagou.items import LagouItem class LagouPipeline(object): def process_item(self, item, spider): ...
true
da30be3495e6e6b953f326450d15c6b1f1084928
alexzanderr/ProgrammingProblems
/leetcode/longest_palindromic_substring/solution.py
UTF-8
678
3.453125
3
[]
no_license
class Solution: def longestPalindrome(self, s: str): if len(s) == 1 or s == "" or self.isPalindrome(s) or s == None: return s solutions = [] for start in range(len(s)): for stop in range(start + 1, len(s) + 1): s_cut = s[start : ...
true
5ca10f86a07f6e291730ee1ce4971b2d5fe115a1
Sraddheya/Bright-Network-2021
/python/src/video_playlist.py
UTF-8
524
3.09375
3
[]
no_license
"""A video playlist class.""" from typing import List class Playlist: """A class used to represent a Playlist.""" def __init__(self, playlist_title: str): """Playlist constructor.""" self._title = playlist_title self._video_ids = [] @property def title(self) -> str: ...
true
c6f0f9afdb15ae5870203e0dfae8254412b0f7c4
sudo-bin/algorithm_study
/solved/이것이코딩테스트다/이진탐색/떡볶이떡만들기.py
UTF-8
499
3.46875
3
[]
no_license
def binary_search(arr, start, end): ret = -1 while start <= end: remain_sum = 0 mid = (start + end ) // 2 for i in range(len(arr)): if mid < arr[i]: remain_sum += (arr[i] - mid) if remain_sum > m: start = mid + 1 else: r...
true
5b770b18306c5f13e75881f339269282fde2db9c
todd-sudo/hotline
/src/test_proxy.py
UTF-8
1,352
2.5625
3
[]
no_license
import json import requests from bs4 import BeautifulSoup from core.config import proxies from core.logger import logger from parser.utils import headers URL = "https://hotline.ua/computer-zvukovye-karty/" \ "creative-sound-blaster-x-ae-5-plus-70sb174000003/?tab=about" fail_proxy = list() def check_proxy():...
true
0eb03c67b2928aeeee4cc4da56c8469b6765610d
wasi0013/Python-CodeBase
/ACM-Solution/decimal.py
UTF-8
258
2.953125
3
[ "MIT" ]
permissive
from sys import stdin, stdout import decimal def main(): numOfTimes = int(stdin.readline()) for i in range(numOfTimes): d = decimal.toDecimal(int(stdin.readline())) print(d.sqrt()) if __name__ == '__main__': main()
true
1b89f98125ae268c15bccec1ea91cf809591986a
jecki/DHParser
/scratch/parser_Grammar_as_ebnf.py
UTF-8
1,768
2.515625
3
[ "LicenseRef-scancode-free-unknown", "Apache-2.0" ]
permissive
def as_ebnf(self) -> str: """ EXPERIMENTAL. Does not yet support serialization of DHParser- directives. Serializes the Grammar object as a grammar-description in the Extended Backus-Naur-Form. """ ebnf = [] # gather error, skip, resume and drop information resume_rules = self.resume_ru...
true
2ae7f0cbe83379930cd8c94fff58fd0e78450bd8
Rajadurai02/my_python_programs
/basic_programs/fib.py
UTF-8
408
3.40625
3
[]
no_license
def fibo(): terms = int(input("Enter how many sequence?:")) n1 = 0 n2 = 1 count = 0 if terms <= 0: print("please enter a positive number") elif terms == 1: print(n1) else: print("fibanocci series starts:\n") while count < terms: print(n1) ...
true
d93cc5563a710fcc7b06c1db7872f68ad87a51eb
dennysrocha/uri
/python/1221.py
UTF-8
426
3.578125
4
[]
no_license
def isPrime(n): # using that all primes greater than 3 are of form 6k+1 or 6k-1 if n==1 or n==2: return "Prime" if n%2==0 or n%3==0: return "Not Prime" i = 5 while i*i <= n: if n%i==0 or n%(i+2)==0: return "Not Prime" i += 6 return "Prime" if __name__ == ...
true
6da9b51016554d2034a6ac256e68584ec9cd2f61
herrickz/markdown-parser-python
/models/codeblock.py
UTF-8
1,396
3.0625
3
[]
no_license
supported_languages = [ 'javascript', 'json' ] language_to_mode_dict = { 'javascript': 'javascript', 'json': 'application/json' } class CodeBlock: def __init__(self, value, code_block_id): self.mode = '' self.code = self.parse(value) self.code_block_id = f'codeblock-{...
true
7312b82e27cc1db7b184eb2aed7c3dafea22effc
jiachin1995/CZ3004
/sensors_old.py
UTF-8
6,803
3.125
3
[]
no_license
import time import settings class Sensors: """ Sensors class. Reads sensors input. """ arduino = None robot=None instructions = { "getFront": "get front sensors", "getLeft": "get left sensors", "getAllexceptRight": "z", "getRight": "y" } che...
true
a6523646cf49430715063b3fe2f0469d7c2ff6ea
josh3255/Vision-Transformer-Pytorch
/dataset.py
UTF-8
2,104
2.96875
3
[ "MIT" ]
permissive
import torch from torch.utils.data import Dataset from torch.utils.data import DataLoader import os import numpy as np def unpickle(file): import pickle with open(file, 'rb') as fo: dict = pickle.load(fo, encoding='bytes') return dict[b'data'].reshape((-1, 3, 32, 32)).astype(np.float64), dict[b'la...
true
05d7fd7fab88f991788903a3a05960c1d774d629
MateuszPrzybyla/EMonopoly
/server/monopoly/ChanceCards.py
UTF-8
4,715
2.78125
3
[]
no_license
from server.ClientPlayer import ClientPlayer from server.monopoly.GameMove import GameMove __author__ = 'mateusz' def positionChange(targetPosition=None, change=None): def handler(card, game, playerId): playerData = game.playersData[playerId] if targetPosition is not None: playerData....
true
d57ce49dbf44cdbe54f70c16841bcc43c4ef3d0e
bingyihua/bing
/help/py/py/return.py
WINDOWS-1252
680
2.875
3
[]
no_license
#!/home/mcbadm/cuiyb/python27/bin/python27 # -*- coding: utf-8 -*- def work(): #庯 for i in range(5): print("i=", i) for j in range(5): print("--j=", j) for k in range(5): if k<2: print("------>k=", k)...
true
69b4d313a5fed72bb9d3aef802fcf51f0e4f64d3
fluffyowl/past-submissions
/atcoder/agc005/agc005_a.py
UTF-8
166
3.0625
3
[]
no_license
S = raw_input() left = 0 ans = 0 for s in S: if s == 'S': left += 1 elif s == 'T' and left > 0: left -= 1 ans += 2 print len(S) - ans
true
64516b19dabd358e45a4b2f87e85059d77af8624
coppolam/SI_framework
/plot/plot_nn.py
UTF-8
3,589
2.71875
3
[]
no_license
#!/usr/bin/env python3 """ Plot comparisons of the correlation between the trained NN and the validations sets @author: Mario Coppola, 2020 """ from tools import fileHandler as fh import argparse, os, sys import numpy as np import matplotlib import matplotlib.pyplot as plt from tools import prettyplot as pp def main(a...
true
7d67950633914747ac089fc17f57d0ee4ccaeb34
julian991/CMS-API-Manager
/link.py
UTF-8
717
2.5625
3
[]
no_license
from flask import Flask, request from Haze import Haze import json app = Flask(__name__) haze_api = Haze.HazeAPI() def readJson(jsonpath): with open(jsonpath) as json_file: return json.load(json_file) #Insert data path here, please double check this portion data_dengue_path = "./Dengue/dengue_json_data" ...
true
19ff6d0faf99f2e300f4f564af0bec37d6d52623
mas2020-python/flask-api
/src/internal/db.py
UTF-8
922
2.625
3
[]
no_license
""" SQLAlchemy main file to map the database. """ from flask_sqlalchemy import SQLAlchemy, get_debug_queries import logging from utils.config import API_SRV db = SQLAlchemy() def sql_debug(response): logger = logging.getLogger(API_SRV.config['log']['default_logger']) queries = list(get_debug_queries()) qu...
true
e29fb76c8c8abaa42c223ea166bdf5c0cab8f540
underseatravel/AlgorithmQIUZHAO
/Week_05/231_power_of_two.py
UTF-8
215
2.640625
3
[]
no_license
#!/usr/bin/python3 # -*- coding: utf-8 -*- # @Time : 2020/8/12 23:16 # @Author : weiyu # @File : 231_power_of_two.py class Solution: def isPowerOfTwo(self, n): return n > 0 and n & (n - 1) == 0
true
5aa72935cecd1fddc2de1b5706ad327f9cdfd162
sharmad-nachnolkar/movehack-freight
/efr8/utils.py
UTF-8
503
2.828125
3
[]
no_license
import json def write_to_file(write_data, file_name): prev_data = [] try: with open(file_name, 'r') as f: try: prev_data = json.load(f) except ValueError: prev_data = [] except IOError: prev_data = [] with open(file_name, 'w+') as f: data = prev_data + write_data json.dump(data, f) def rea...
true
439c78745c1661f0f0a8d5af0a98c1d898962dae
jordisr/cs289-project
/features/hydrophobicity.py
UTF-8
1,296
2.796875
3
[]
no_license
''' Kyte-Doolittle hydrophobicity scale ''' from Bio.PDB import * import sys, re def feature_names(): return ['hydrophobicity'] def feature(structure): # name of feature feature = 'hydrophobicity' # initialize dict of dicts output = dict() kyte_doolittle = { 'Ala': 1.800, ...
true
0c27083d0496e6c1ab04a5890195c454639bbdb8
Rast999/invader
/tests/test_sqlite.py
UTF-8
502
3
3
[]
no_license
#! /usr/bin/python3 import curses from curses.textpad import Textbox, rectangle def main(stdscr): stdscr.addstr(0, 0, 'Enter message: ') editwin = curses.newwin(1, 25, 2, 1) rectangle(stdscr, 1, 0, 3, 26) stdscr.nodelay(True) stdscr.refresh() box = Textbox(editwin) # box.edit() whil...
true
6f0af212345e64e9a563d0d5e0c00097fabd8a13
BioinformaticsBiophysicsUDE/PolyLibScan
/Tools/pdb2lmp.py
UTF-8
11,058
2.890625
3
[ "MIT" ]
permissive
import numpy as np import Bio.PDB as PDB import yaml from lmp_types import * from lmp_particlesAndInteractions import * from lmpObj import LmpObj from lmp_creator import LmpCreator class ProteinCreator(LmpCreator): ''' input: pdb_path: string | path to pdb file ...
true
7476f07fca4f9fd31141eb0c9342955f96a8a1e3
JosephLevinthal/Research-projects
/5 - Notebooks e Data/1 - Análises numéricas/Arquivos David/Atualizados/logDicas-master/data/2019-1/226/users/4149/codes/1785_1599.py
UTF-8
329
2.890625
3
[]
no_license
from numpy import* com=array(eval(input("entre com a lista de compras"))) a=size(com) i=0 z=zeros(a, dtype=float) while(i<size(com)): if(com[i]> 80): c= com[i]-((15*com[i])/100) z[i]=c i=i+1 j=0 c=zeros(a,dtype=float) while(j<size(com)): if(com[j]<80): c[j]=com[j] j=j+1 vetr=z+c print(round(sum(vetr),2)) ...
true
133ddc8f987874994d1153794e190b0f4d48802f
ducoquelicot/vvoj
/ws_vlaams/analysis.py
UTF-8
1,695
3.109375
3
[]
no_license
''' Analyse van de gescrapede data van het Vlaams parlement. Berekent hoeveel vragen er gesteld zijn, en welke politicus en partij de meeste vragen heeft gesteld. ''' from bs4 import BeautifulSoup import os, fnmatch, glob, re from collections import Counter def main(): questions = glob.glob('ws_vlaams/scraped...
true
daafffbabb25a4c5737c0912b6a172915d187127
najarvis/CSE-464-Packing-Algorithm
/main.py
UTF-8
5,634
2.6875
3
[]
no_license
# screen_size = (1920,1080) from OpenGL.GL import * from OpenGL.GLU import * from math import radians import random from matrix44 import * from Vector3 import Vector3 import pygame from pygame.locals import * pygame.init() screen_size = pygame.display.list_modes()[0] screen = pygame.display.set_mode(screen_size, FU...
true
4a9c35e2f0d3941c7d3c0726e1ee827b3604d1b3
muhark/dotas-design
/model/exps_export.py
UTF-8
2,799
2.578125
3
[]
no_license
import pandas as pd import sqlalchemy as sql import numpy as np import mysql.connector as mariadb from configparser import ConfigParser from os.path import expanduser from uuid import uuid4 """ The purpose of this script is to export the CHV20 dataset into MariaDB, in order to ensure compatibility during production ru...
true
12a341c25563114c99bea46979a80d487a8a475b
dwaltrip/project-euler
/solutions/p42.py
UTF-8
1,182
2.984375
3
[]
no_license
import timeit import cProfile letter_values = {'A':1,'B':2,'C':3,'D':4,'E':5,'F':6,'G':7,'H':8, 'I':9,'J':10,'K':11,'L':12,'M':13,'N':14,'O':15,'P':16,'Q':17, 'R':18,'S':19,'T':20,'U':21,'V':22,'W':23,'X':24,'Y':25,'Z':26} word_values = {} def main(): f = open('c:\pythonwork\project_euler\words.txt','r') ...
true
9f7a6239bcaf6bad9714cfb019868421e3d779b6
uncleguanghui/scrapy_project
/spider_project/spiders/spider.py
UTF-8
2,622
2.734375
3
[]
no_license
import scrapy from lxml import etree from spider_project.items import ProjectItem from spider_project import am, fm, make_item # 获得 API api = am.get_api('project') class XXXSpider(scrapy.Spider): name = 'project' search_keywords = ['xxx'] # 搜索关键字 def parse(self, response, **kwargs): pass d...
true
11567f4c69aeed969bbd3868c70897481c5619d6
r0mdau/hellanzb
/Hellanzb/NZBLeecher/DupeHandler.py
UTF-8
12,767
2.6875
3
[ "LicenseRef-scancode-warranty-disclaimer", "BSD-2-Clause" ]
permissive
""" DupeHandler - Functions for handling duplicate files in NZBs. Some NZBs contain multiple files with the exact same filename (due to a mistake during creation of the archive itself or the archive's NZB) Dupe files encountered during the download process (either in NZBFile or NZBSegment form) will be renamed Dupli...
true
ed3878fba36272028d311bff5bfc80421e74bdfb
morshedmasud/100_days_with_python
/Day-5/collections/company_logo.py
UTF-8
315
3.03125
3
[]
no_license
# Go to the link to know about the problem # https://www.hackerrank.com/challenges/most-commons/problem from collections import Counter s = input().strip() temp = Counter(s) for i in range(3): x= max(temp.values()) maxs = [k for k, v in temp.items() if v == x] l = sorted(maxs)[0] print(l, x) del temp[l]
true
75181e68ce69ad529972a98b2449dba656ea6862
BU-Computing/radar
/manage.py
UTF-8
1,242
2.546875
3
[]
no_license
#!flask/bin/python import sys try: from app import app, db from flask.ext.script import Manager, prompt_bool from config import SQLALCHEMY_DATABASE_URI from config import SQLALCHEMY_MIGRATE_REPO from shutil import copyfile import os.path import datetime, time except ImportError: print 'It looks like you don\'t...
true
032b40a509b205909461b59f6ea6033439cebca1
SuzuTakahiro/SampleProject
/mkFrameSample.py
UTF-8
312
2.9375
3
[]
no_license
from tkinter import * import tkinter.ttk as ttk class FrameSample: def __init__(self, master): frame = ttk.Frame(master) frame.pack() if __name__ == '__main__': master = Tk() master.title("FrameSample") master.geometry("300x50") FrameSample(master) master.mainloop()
true
9ca09d76a4ec0e65f788538738df734a6344c4b2
zhangkaiwoniu/python_ui_autoFrame
/pages/basepage.py
UTF-8
3,349
2.671875
3
[]
no_license
#!/usr/bin/env python # -*- coding:utf-8 -*- #====#====#====#==== #Author: #CreatDate: #Version: #====#====#====#==== from selenium import webdriver from selenium.webdriver.support.wait import WebDriverWait from selenium.common.exceptions import TimeoutException,NoSuchElementException from selenium.webdriver.supp...
true
56e994dfabca3bbd73d0ec386f703fab83364d34
gistable/gistable
/dockerized-gists/9361461/snippet.py
UTF-8
2,683
2.546875
3
[ "MIT" ]
permissive
#!/usr/bin/env python # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, softwar...
true
0abf46ac57f4d53850555b70fa652a3e2ab12783
Muenmac/data_science_basics
/dicts.py
UTF-8
338
3.34375
3
[]
no_license
# dicts.py # craeating some basic dictionary, acees to values via keys my_dict = { "oem":"audi", "model":"avant", "power":'123_bhp' } print(my_dict["oem"]) # change some value my_dict['power'] = "145bhp" print(my_dict) my_dict['condition'] = 'new' print(my_dict) # remove some value my_dict.pop('mode...
true
0e56567132e799c470cfdbf2b9bcd64118985ae6
davidhuangdw/leetcode
/python/745_PrefixAndSuffixSearch.py
UTF-8
3,051
3.578125
4
[]
no_license
from unittest import TestCase # https://leetcode.com/problems/prefix-and-suffix-search import collections class WordFilter: # by store all combinations directly def __init__(self, words: 'List[str]'): self.result = res = {} for pos, word in enumerate(words): for i in range(len(wor...
true
e1487eca5e77a954d369be98d9160386d886d147
46OkuMen/insiders
/dump.py
UTF-8
6,081
2.75
3
[]
no_license
""" Generic dumper of Shift-JIS text into an excel spreadsheet. Meant for quick estimations of how much text is in a game. """ import sys import os import xlsxwriter from rominfo import FILE_BLOCKS, FILES_TO_DUMP, UNCOMPRESSED_FILES, CONTROL_CODES from romtools.disk import Gamefile, Block COMPILER_MESSAGES = ...
true
aaf0f0e244a86b329882c89b0ef9ff9c425ff08d
gabriellaec/desoft-analise-exercicios
/backup/user_280/ch40_2020_03_25_11_25_14_306267.py
UTF-8
131
2.984375
3
[]
no_license
a = [3, 5, 2, 4, 9] a[0] = b a[1] = c a[2] = d a[3] = e a[4] = f def soma_valores(b, c, d, e, f): y = (b+c+d+e+f) return y
true
90ff8706aed73cca52630c05dc74b190890ba2bb
benmpeterson/PythonFundamentals
/practice.py
UTF-8
835
3.4375
3
[]
no_license
a = [1, 2, 3] x = [] print(a) s = [[-1, 1]] * 5 s[2].append(7) n = [1, 300, 3, 700, 302392, 10] (n.sort()) print(n) (n.sort(reverse=True)) print(n) g = dict(wheat='no', barley='yes') f = dict(g) for key, value in f.items(): print("{0},{1} okh".format(key, value)) print(f) t = [1, 4, 2, 1, 7, 9, 9] print...
true
7f311535416d3cad5741d4de8493ebb7cb6e136e
ahmtuguz/PythonProjects
/ŞekilÇizdirme.py
UTF-8
960
3.015625
3
[]
no_license
for i in range(0,11): if i==0 or i==10: for j in range(0,11): print("-",end="") if i==1 or i==9: for j in range(0,11): if j!=5: print("-",end="") else: print("+",end="") if i==2 or i==8: for j in range(0,1...
true
06a922cc596a8b5aef40f0ea58d98e90f368b4db
SymmetricChaos/ClassicCrypto
/Ciphers/CipherDisk.py
UTF-8
3,116
3.5625
4
[]
no_license
import random from Ciphers.UtilityFunctions import alphabetPermutation # This cipher is based on the Alberti Cipher Disk. Encryption works as a # simple substitution cipher. However the person encrypting can choose to shift # the key of the cipher by encrypting a digit indicating the size of the shift # they want. # ...
true
5035fe48f1d56e130b82556a66099a8b2879ab1c
MetinSa/AST5220
/milestone2/src/milestone2.py
UTF-8
1,871
3.09375
3
[]
no_license
import numpy as np import matplotlib.pyplot as plt from matplotlib import rc # Path for figures to be saved savepath = "../milestone2/figures/" # Reading in files x_rec, a_rec, z_rec, X_e, n_e, tau, tau2, tau22, g, g2, g22 = np.loadtxt("milestone2.dat", unpack = True) # Latex plotting format plt.rc("text", usetex = ...
true
92311456ff3f2fb341860e4b48e85735355dfa60
ianclarksmith/design-automation
/py2ecotect-project/branches/sandbox/py2ecotect/model/scan.py
UTF-8
14,511
2.59375
3
[]
no_license
import py2ecotect as p2e #=========================================================================== # Functions #=========================================================================== #------------------------------------------------------------------------------ def num_nodes(): """ Re...
true
32a26516b6088b4a304a45870ca2db1e0ed9ce37
920630yzx/pachong
/其他/3.面向对象简介.py
UTF-8
540
4.15625
4
[]
no_license
# -*- coding: utf-8 -*- """ @author: 肖 """ monkey = {'绰号':'星期五','公母':'公','毛色':'黄色','年龄':6} class Monkey(): def __init__(self,name,sex,color,age): self.name = name # 添加属性 self.sex = sex self.color = color self.age = age def suanshu(self,x,y): print(x+y) a = Monkey('星期...
true
c85fac026958b2aea9d988521a98380e8fc0a201
lurak/Coursework
/extra_modules/currency_converter.py
UTF-8
492
3.140625
3
[]
no_license
import requests import json def convert_currency(cur1, cur2, value): """ :param cur1: str :param cur2: str :param value: number :return: number Convert value of one currency to another """ url = "https://free.currencyconverterapi.com/api/v6/convert?q=currencies&compact=ultra&apiKey...
true
a619ea1e75b4b049cb1939ba3470f8017a284599
offamitkumar/HackerRank
/Python/Maximize It!.py
UTF-8
295
2.625
3
[]
no_license
k,m = map(int,input().split()) ans = 0 def sol(l , a , i): global ans if i == k: ans = max(ans , a%m) return for j in l[i]: a += j*j sol(l, a, i+1) a -= j*j l = [list(map(int,input().split()))[1:] for i in range(k)] sol(l,0,0) print(ans)
true
f02328413babb851a26810e4041926fd7d8c095b
Moon-Ji/EliceLibrary
/library/server/load_data.py
UTF-8
1,257
2.65625
3
[]
no_license
import csv from datetime import datetime from model.model import Book from app import create_app, db app = create_app() app.app_context().push() with app.app_context(): with open('library.csv', 'r', encoding='UTF-8') as f: reader = csv.DictReader(f) for row in reader: publication_date...
true