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
c3b55819cfce085360544bc156c0fe858c72af36
venkatachiranjeevi/algorithms
/interview_bit/binarySearch/find_ele_rotated_2.py
UTF-8
1,553
3.203125
3
[]
no_license
__author__ = 'customfurnish' class Solution: # @param A : tuple of integers # @param B : integer # @return an integer def search(self, A, B): n = len(A) l = 0 h = n - 1 mid = -1 while l <= h: mid = (l+h)/2 next = (mid+1)%n pre...
true
a8d0ebbb0e558c0030705220182a49a71ee29488
LeeJuhae/Algorithm-Python
/DP/Problem32.py
UTF-8
755
3
3
[]
no_license
import sys from heapq import heappush, heappop read = sys.stdin.readline n, k = map(int, read().strip().split()) max_len = 2 * 100000 sys.setrecursionlimit(max_len + 1) visit = [float('inf') for _ in range(max_len + 1)] q = [] q.append((0, n)) visit[n] = 0 while q: cost, cur = heappop(q) if visit[cur] < cost:...
true
35d72faae0e7a3461ba913c32a94c85fcdf8ffce
hayparking/Raspberry
/GPIOS.py
UTF-8
352
2.6875
3
[]
no_license
import RPi.GPIO as gpio class controller(): pins states def __init__(self): self.state = [False, False, False] self.pins = [2, 3, 4] gpio.setmode(gpio.BCM) def changeState(pin, state): gpio.setup(pins[pin], gpio.OUT) gpio.output(pins[pin], state) def cle...
true
49af52b275442377a1ba8e116182257f67349b56
habibutsu/tapl-py
/rcdsubbot/lexer.py
UTF-8
2,656
2.859375
3
[ "MIT" ]
permissive
import ply.lex as lex import re class Lexer: _unescape_tokens = [ # Symbols ("_", "USCORE"), # ("'", "APOSTROPHE"), # ("\"", "DQUOTE"), # ("!", "BANG"), # ("#", "HASH"), # ("$", "TRIANGLE"), # ("*", "STAR"), # ("|", "VBAR"), (".", "DO...
true
8adf861db560927a521d42d0ced0178c0bdacf1e
maksna/albert
/model/transformer.py
UTF-8
3,030
2.59375
3
[]
no_license
import tensorflow as tf from tensorflow.keras import layers from tensorflow.keras import initializers from .attention import Attention from .feed_forward import FeedForward from .util import LayerStore, to_2d class Transformer(layers.Layer, LayerStore): def __init__( self, feedforward_config, ...
true
2a31f9ee52cb682a541c01e21b9e6e459ea10bf4
ediaz/toto-stuff
/Statistics/hw04/qqplot.py
UTF-8
551
2.953125
3
[]
no_license
''' QQ plots ''' def qqplots(res): from scipy import stats import matplotlib.pyplot as plt import numpy as np res.sort() n = len(res) p = np.linspace(0 + 1./(n-1), 1-1./(n-1), n) quants = np.zeros_like(res) for i in range(n): quants[i] = stats.scoreatpercentile(res, p[i]*100) mu = res.mean() ...
true
bec3458d51e3ed3eafac58f41c0952e973206848
Keith-Howard/Chessboard-Validator
/chess_dictionary_validator.py
UTF-8
2,258
3.921875
4
[]
no_license
def is_valid_chess_board(board): rules = {'br': 2, 'bn': 2, 'bb': 2, 'bk': 1, 'bq': 1, 'bp': 8, 'wp': 8, 'wr': 2, 'wn': 2, 'wb': 2, 'wq': 1, 'wk': 1} counter = {} # counting each piece on the board for piece in board.values(): if piece != ' ': counter.setdefault(piece, 0) ...
true
2d33f0f56cec0446205ed449174d6dc55fd3b1da
RunningJimmy/HMS
/app_interface/i_djd.py
UTF-8
1,310
2.96875
3
[]
no_license
from docx import Document from docx.shared import Inches class WordHandle(object): def __init__(self): self.doc_obj = Document() # 保存 def close(self,filename): self.doc_obj.save(filename) # 添加标题 def add_title(self,title,level= 1): ''' :param title: 标题名 :pa...
true
ddbf2df1996256f0c63ced3c2be5235c553b322c
dannima/pae_probe_experiments
/bin/compute_spectra.py
UTF-8
8,073
2.984375
3
[ "BSD-2-Clause" ]
permissive
#!/usr/bin/env python """Compute spectra of features. For each combination of TIMIT variant and feature compute a truncated randomized SVD using scikit-learn's ``TruncatedSVD`` module. For instance, python compute_spectra.py /path/to/feats spectra.tsv where ``feats/`` is the directory containing the extracted fe...
true
9ca8816d714e7df1b37751205d57c2d54da4e200
PhelanWang/JXTransformer
/scripts/data_load.py
UTF-8
3,475
2.640625
3
[ "Apache-2.0" ]
permissive
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from hyperparams_2 import Hyperparams as hp import tensorflow as tf import numpy as np import codecs import regex def load_zh_vocab(): vocab = [line.split()[0] for line in codecs.open('vocab/vocab.zh','r','utf-8').read().splitlines() if int(line.split()[...
true
49c60992a029bde6f534456fa6c283b7ad24c2ab
KodeWorker/MyPythonPlayground
/AutomateTheBoringStuffWithPython/Ch12_WorkingWithExcelSpreadsheets/basic_openpyxl_examples.py
UTF-8
1,420
3.609375
4
[]
no_license
import openpyxl import datetime # Getting Sheets from Workbook ================================================ print('*** Sec.1 ***') wb = openpyxl.load_workbook('example.xlsx') print('Sheets: %s' %wb.get_sheet_names()) sheet = wb.get_sheet_by_name('Sheet3') activeSheet = wb.active print('Selected Sheet: %s' %(she...
true
286ff6883485f5f20eedd6d1da5848d9c4d045f3
Sage-Bionetworks/EHR-challenge
/simple_model/train.py
UTF-8
725
3.09375
3
[]
no_license
''' Simple train model that just reads in person and writes out the person ids to model ''' import csv def main(): ''' Main function ''' with open("/train/person.csv", "r") as person: csv_reader = csv.reader(person, delimiter=',') line_count = 0 personids = [] for row i...
true
91ed5c041f8ec3814480f3cf3be14d5efae81cbc
chrismarkella/CAMCOS-fall-2019
/hash_nonce.py
UTF-8
690
3.703125
4
[]
no_license
import hashlib def looking_for_leading_zeros(text, zeros = 1): """ Proof of Work concept. Iterating from NONCE 0, one by one until TEXT + str(NONCE) will hash to a specified number of zeros. """ text = text + '0' zeros_str = '0'*zeros hash = hashlib.sha256(str.encode(text)).hexdigest() nonce = 1 ...
true
9315d0c9cea761af46b4a506573c47963d2c0a53
Zhang-O/small
/tensor__cpu/Pillow_Image/get_started.py
UTF-8
403
3.078125
3
[ "MIT" ]
permissive
from PIL import Image im = Image.open('6164.png') ''' The mode attribute defines the number and names of the bands in the image, and also the pixel type and depth. Common modes are “L” (luminance) for greyscale images, “RGB” for true color images, and “CMYK” for pre-press images. ''' print(im.size, im.format, im.m...
true
c2f3922fba844f92484fd3f125475d359a89cf79
goranpaues/pythonmorsels
/count_words/count_original.py
UTF-8
202
3.46875
3
[]
no_license
def count_words(input_string): word_list = input_string.split() word_count = dict() for word in word_list: word_count[word.lower()] = word_count.get(word,0) + 1 return word_count
true
86622cc674601d4b4150c52bb5b01ae032edeed2
ARUNYAJAYAN/user_logs
/app/exceptions.py
UTF-8
364
2.625
3
[]
no_license
from .response import Response class UserAlreadyExist(Exception): def __init__(self, message="User already exists"): self.message = message super().__init__(self.message) class InvalidUser(Exception): def __init__(self, message="Invalid username or password"): self.message = messa...
true
93d94a5fbc074463ae61a5021107a8b447455806
ViZDoomBot/stable-baselines-agent
/cig_map3_lv1_larger/reward_shaper.py
UTF-8
6,442
2.53125
3
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- # @File : reward_shaper.py # @Author: harry # @Date : 2/7/21 5:58 PM # @Desc : Reward shaper import sys import os PACKAGE_PARENT = '..' SCRIPT_DIR = os.path.dirname(os.path.realpath(os.path.join(os.getcwd(), os.path.expanduser(__file__)))) sys.path.append(os.path.normp...
true
05a47c602f473bd4d8d7106519de0c4879ac6a01
myPyQuest/100
/19_number_names.py
UTF-8
5,100
4.09375
4
[]
no_license
""" **Number Names** Show how to spell out a number in English. You can use a preexisting implementation or roll your own, but you should support inputs up to at least one million (or the maximum value of your language's default bounded integer type, if that's less). ################################...
true
d368928d2e1f596b37da9ffe2a2ed1f5462bb8e8
KeepCodeing/ScrapyProject
/GetIps/IP_TEST.py
UTF-8
1,175
2.609375
3
[]
no_license
import requests import json import pymysql def main(): conn = pymysql.connect(user='root', password='123456', host='localhost', charset='utf8', database='ips', port=3306) cur = conn.cursor() cur.execute('select * from ip_table') file = open('ip.json', 'r', encoding='utf-8') ip_data = json.load(...
true
33bf8dcc0c82597ec37511362c2879595ef1a708
horseshoe477/NecX
/Code/Python/RealTime/Util.py
UTF-8
2,929
2.90625
3
[]
no_license
import numpy as np from scipy import interpolate from scipy import fftpack # DFT # =================================== # Moving average # =================================== def movingAvg(values,window): values = myResample(values, len(values)+window-1) weigths = np.repeat(1.0, window)/window smas = np.c...
true
3191c51b69a8d3ca33274ac8f2b0b1322b0f6ec7
MorozovIV/1
/0.1/backup_ver1.py
UTF-8
1,234
2.703125
3
[]
no_license
import os import time source_dir = "C:\\users\\Пользователь\\PycharmProjects\\" target_dir = "F:\\backup" target = target_dir + os.sep + time.strftime('%Y%m%d%H%M%S') + '.zip' # print('StartPath') # print(source_dir) # print(type(source_dir)) # print(target_dir) # print(type(target_dir)) # print(target) # print(type(t...
true
e6dec22c3d004c08c69df015ff25eebc2b32fc51
omar19-meet/meet2017y1lab5
/fun1.py
UTF-8
717
4.09375
4
[ "MIT" ]
permissive
#### ##def add_numbers(): #This function adds all numbers from 1 to 100 and gives us the sum at the end ## c=0 ## for number in range(1,100+1): ## print(number) ## c=c+number ## return (c) ##answer= add_numbers() ##print(answer) ##start=int(input("What is your starting number? ")) ##end= int(...
true
520c257eb9fcbe13da273d7957dbb181005ea0f2
bao1981105/decode-bengali
/EfficientNet/utils.py
UTF-8
986
2.953125
3
[ "MIT" ]
permissive
import numpy as np import pandas as pd from matplotlib import pyplot as plt def plot_summaries(history, plot_name1): # Plot loss and Accuracy fig, ax = plt.subplots(1, 2, figsize = (16, 8)) df = pd.DataFrame(history) ax[0].plot(df[['root_loss','vowel_loss','consonant_loss', 'val_root_loss','val_vowel...
true
900b06b0836575bd9b4536823c59ef0fec2e47fc
ohjerm/initiative-tracker
/tracker.py
UTF-8
2,292
3
3
[]
no_license
# !/usr/bin/python3 import tkinter as tk from tkinter import * from initiative_entry import Initiative_entry initiative_list = [] top = tk.Tk() frame = Frame(top) frame.pack(side=BOTTOM) def update_grid(): global initiative_list for label in frame.grid_slaves(): label.grid_forget() for i i...
true
ea33f2c16ab64a541b669e985a1c2d8e587361b2
AhmadSci/InstagramKit
/Instagram Username Checker (no proxy).py
UTF-8
4,862
2.65625
3
[ "Apache-2.0" ]
permissive
try: import requests import uuid import random import time import os from os import system system("title " + "@c9zd - UserChecker V1") import colorama from colorama import Fore , Back colorama.init(autoreset=True) except Exception as m: print("Something Went...
true
5e45a1c061bb93317523d7a39e9ea85d793bf7e3
Theramas/xpath_generator
/generator.py
UTF-8
2,152
3.171875
3
[]
no_license
import textract import xml.etree.ElementTree as ET def _check_unique_xpath(root, element, previous_xpath): """ @description - Forms list of xpaths with every non-empty attribute Checks if one of these xpaths can be used to uniquely identify given element in tree @param [in] root|xml.etr...
true
5d3baeb6cc07e4d9ed59fb61d2e7438289a18eb5
mimirblockchainsolutions/w3aio
/src/w3json.py
UTF-8
390
2.640625
3
[ "MIT" ]
permissive
import json from json import JSONEncoder class StructEncoder(JSONEncoder): def default(self, o): try: return o.as_dict() except: return str(o) class w3json(object): @staticmethod def dumps(obj): return json.dumps(obj,cls=StructEncoder) ...
true
2c840db1e9df885433d99440a9b4356f6be8aff8
siphera/temperature-converter
/attemp2.py
UTF-8
2,198
3.65625
4
[]
no_license
from tkinter import * from tkinter import messagebox window = Tk() window.geometry("280x320") window.title("Temperature Conversion") window.configure(bg="skyblue") # My conversion functions def to_celsius(): try: f = float(temp_input.get()) celsius = (f - 32) * (5 / 9) output_label.config...
true
0055522743027b76cc235a501a00bcb5d2f6b2a6
jason11489/crypto
/이상협/CRT.py
UTF-8
503
2.65625
3
[]
no_license
import EEA #x : x = a1 (mod n1), x = a2(mod n2)... #x : list [(a1, n1),(a2, n2), ... ] def crt(x): Nj = [] n = 1 for i in range(0, len(x)): n = n*(x[i][1]) for i in range(0, len(x)): Nj.append(n//x[i][1]) xj = [] for i in range(0,len(Nj)): xj.a...
true
5ff64460eb202040e7146655830dffa762a01864
cutefish/util
/pytest/testfio.py
UTF-8
2,600
2.640625
3
[]
no_license
import unittest from pyutil.fio import FileUtil, FileWriter from pyutil.string import StringUtil, NLinesStringWriter class TestFileUtil(unittest.TestCase): def testTailStream(self): FileUtil.mkdirp('/tmp') FileUtil.rmf('/tmp/t') with open('/tmp/t', 'w+') as fh: fh.wri...
true
11837771f2fbba5661e2de898964db7031ab1d4c
AspirinCode/biotite
/src/biotite/sequence/__init__.py
UTF-8
2,534
2.953125
3
[ "BSD-3-Clause" ]
permissive
# This source code is part of the Biotite package and is distributed # under the 3-Clause BSD License. Please see 'LICENSE.rst' for further # information. """ A subpackage for handling sequences. A `Sequence` can be seen as a succession of symbols. The set of symbols, that can occur in a sequence, is defined by an `A...
true
e3912b868d5625207ade64188f9509726fbe63be
fbkarsdorp/storypy
/storypy/utils.py
UTF-8
427
3.125
3
[]
no_license
from collections import defaultdict from itertools import combinations class Encoder(defaultdict): def __init__(self, items=[]): defaultdict.__init__(self, None) self.default_factory = self.__len__ self.update(items) def add(self, item): self[item] def update(self, items)...
true
d9d5686490579282ee323d788791afeace129d5e
lixiang2017/leetcode
/leetcode-cn/0559.0_Maximum_Depth_of_N-ary_Tree.py
UTF-8
1,967
3.609375
4
[]
no_license
''' DFS 执行用时:52 ms, 在所有 Python3 提交中击败了28.79% 的用户 内存消耗:16.6 MB, 在所有 Python3 提交中击败了83.43% 的用户 通过测试用例:38 / 38 ''' """ # Definition for a Node. class Node: def __init__(self, val=None, children=None): self.val = val self.children = children """ class Solution: def maxDepth(self, root: 'Node') -> i...
true
808d62bcbbc3017d8f9e79b1902e7f8c64789cd0
joelsunny98/Simple-Programmes
/adding and subtracting list.py
UTF-8
743
3.5625
4
[]
no_license
mat1= [] mat2 = [] r = int(input("enter")) c = int(input("enter Second" )) print("Enter elements for mat1") for i in range(0, r): elements = [] for j in range(0, c): elements.append(int(input("enter the element"))) mat1.append(elements) print("enter elements for mat2") for i...
true
a56b15c2d80f51ff33f1ccbfd9a25c12aed606d4
shenhaiyu0923/resful
/z_python-stu1/tpytest/p7/tc/test_tmp.py
UTF-8
490
3.109375
3
[]
no_license
import pytest import xlrd def get_data(): xls = xlrd.open_workbook('p7/数据表/data.xlsx') sheet = xls.sheet_by_name('Sheet1') inputData = [] for x in range(sheet.nrows): row = sheet.row_values(x) print(row) inputData.append((row[0].strip(),int(row[1]))) print(inputData) ...
true
4228ea300845c526dbd8cf2469d9a7778014b51f
syedaunhashmi/chatbot
/wpbot.py
UTF-8
3,064
2.78125
3
[]
no_license
from bs4 import BeautifulSoup import requests from time import sleep from selenium import webdriver browser = webdriver.Chrome() browser.get('https://web.whatsapp.com') from chatterbot import ChatBot from selenium.webdriver.common.keys import Keys bot=ChatBot( name='GUI Bot', storage_adapter='chatterbot.storag...
true
ddbfe9b112c77dc61b75b8cecae899d451c4b92a
haruspring-jokt/practice-udemy-python3
/sec_14/test_calculation.py
UTF-8
903
3.140625
3
[]
no_license
import unittest import sec_14.calculation as calculation release_name = 'lesson' class CalTest(unittest.TestCase): # テスト開始前 def setUp(self): print('setup') self.cal = calculation.Cal() # テスト終了後 def tearDown(self): print('clean up') del self.cal #...
true
d46487fcb27feb0e96319df8ec2c6aabd96a1dbb
stevenwongso/Python_Fundamental_DataScience
/9 ML Sklearn/12a_oneHotEncoder.py
UTF-8
2,173
3.625
4
[]
no_license
# one hot encoding = membuat 1 dummy var kolom dg val = boolean (0 atau 1) import pandas as pd import numpy as np data = [ {'luas':2600, 'harga':550000, 'kota':'Bekasi'}, {'luas':3000, 'harga':565000, 'kota':'Bekasi'}, {'luas':3200, 'harga':610000, 'kota':'Bekasi'}, {'luas':3600, 'harga':680000, 'kota...
true
7bd3518b511d416b097504399555aa38170f273e
dhitalsangharsha/Djangp
/practice1/CreateFileManually.py
UTF-8
213
2.765625
3
[]
no_license
'''Create a file manually: data.csv name, age, Gender ram, 30, M ...... so on Create a program that rads data.csv and prints the name and age of person with highest age.''' fp=open("file.csv")
true
507132cf5445a4ab036684696b25c70c6ef1c412
crazynoodle/static_html
/mini-web-app/commons/lib.py
UTF-8
3,086
2.578125
3
[]
no_license
#!/usr/bin/python # Filename:lib.py ''' This module provides functions:RedisSession,Logging ...etc ''' from config import REDIS_CONF import cPickle as pickle import random import string import jinja2 import redis def make_signed_cookie(id, password, max_age): # build cookie string by: id-expires...
true
7c6515c6626faabd33508f2b6e3a0788d9dae77b
i67655685/270201016
/lab9/example4.py
UTF-8
148
3.453125
3
[]
no_license
def countdown(n): if n == 0 : print("Alert!") else: print(n) countdown(n-1) n = eval(input("How many seconds left ?")) countdown(n)
true
46ae3925ac934939c6ac37d62a79f57fba50f3f1
KathyReid/rescuetime-skill
/__init__.py
UTF-8
6,495
2.53125
3
[]
no_license
# B63Xvi5l2Ky90cBhEu8U2PDwAcy39AuUosX6OOfJ # https://www.rescuetime.com/anapi/data?key=B63Xvi5l2Ky90cBhEu8U2PDwAcy39AuUosX6OOfJ&restrict_kind=efficiency&resolution_time=day&restrict_begin=2019-02-22&restrict_end=2019-02-22&format=json&perspective=interval # https://realpython.com/python-json/ # @TODO what is the "stan...
true
e46d727019db36373aedb7bae295715015190b25
gmontoya2483/curso_python
/Section_01_Intro to python/13_advanced_set_operations.py
UTF-8
412
3.984375
4
[]
no_license
set_one = {1, 2, 3, 4, 5} set_two = {1, 3, 5, 7, 9, 11} print (f'set_one: {set_one}') print (f'set_two: {set_two}') print(f'Intersección: {set_one.intersection(set_two)}') print(f'Intersección (&): {set_one & set_two}') print(f'Unión: {set_one.union(set_two)}') print(f'Unión (|): {set_one | set_two}') print(f'Dife...
true
67a817536c685e6ab9a69eaed91b1628723bb3af
TigiGln/INLO
/TP5/test_linkedlist.py
UTF-8
2,012
3.53125
4
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sat Feb 6 10:43:02 2021 @author: thierry Used to test the methods of the Linkedlist class """ #import sys import unittest import linkedList #sys.path.append("..") class TestLinkList(unittest.TestCase): """ Test_linklist Object Parameters ---...
true
7f9f5283f81388d8e90922b1f69a37700ba8caca
snishal/MCA
/MCA 101/sumList.py
UTF-8
354
4.03125
4
[]
no_license
def sumList(list): ''' objective: computer sum of elements of a list. input: list: a list whose sum is to be computed output: sum of the elements of a list ''' #Approach: sumList(list) = firstElementOfList + sumList(list with remaining elements) if list == []: return 0 r...
true
e5ac8e3ef9c3d514e94f18422fd2207ad990d1f7
DenisFuryaev/PythonProjects
/papacode/no3ones.py
UTF-8
321
3.09375
3
[]
no_license
n = eval(input()) if n == 3: print('1') exit() ones = [0, 0, 1] #alls = [2, 4, 8] for i in range(3, n): ones.append(2**(i-2) + ones[i-1] + ones[i-2] + ones[i-3]) # alls.append(2**(i+1)) #for i in range(n): # print(i, ' : ', alls[i], '-', ones[i], ' = ', alls[i] - ones[i]) print(2**(n) - ones[n-1])...
true
bfea04bf90277df68f91b883de23a56bb3deb326
rafaelperazzo/programacao-web
/moodledata/vpl_data/309/usersdata/296/74096/submittedfiles/atm.py
UTF-8
352
3.4375
3
[]
no_license
# -*- coding: utf-8 -*- from __future__ import division import math #COMECE SEU CODIGO AQUI a = int(input("Digite o valor que deseja sacar: ") n20 = (a//20) n10 = ((a-(n20*20))//10) n5= ((a-(n20*20)-(n10*10))//5) n2=((a-(n20*20)-(n10*10)-(n5*5))//2) n1=((a-(n20*20)-(n10*10)-(n5*5)-(n2*2))//1) print(n20) print(n10) pri...
true
e9e0e6ea5be115c80a245a304a1887acdf762aad
Akselsundal/Regnskapp
/budget/models.py
UTF-8
1,445
2.578125
3
[]
no_license
"""Db models""" from django.urls import reverse from django.db import models from transactions.models import Account class Budget(models.Model): """Objekt for å oppbevare eit budsjett""" name = models.CharField(max_length=30) start_date = models.DateField() end_date = models.DateField() timestamp ...
true
ebb72e3a24404bf328dd9b09b8879d8f7cfaaced
gxdxx-new/algorithm_study
/구현_1009.py
UTF-8
227
3.171875
3
[]
no_license
T = int(input()) for _ in range(T): a, b = map(int, input().split()) if(b > 4): b = b%4 if(b == 0): b = 4 if((a ** b) % 10 == 0): print(10) else: print((a ** b) % 10)
true
f4fba2bd36d5c6c4f192dca1f905c0ab524fa929
kute/purepythontest
/com/kute/gui/tkinter/test_menu.py
UTF-8
2,781
2.78125
3
[]
no_license
#! /usr/bin/env python # -*- coding: utf-8 -*- # __author__ = 'kute' # __mtime__ = '16/9/12 22:35' """ """ import tkinter from tkinter import Menu, Label, Entry, StringVar from tkinter.messagebox import askokcancel, askquestion, askyesno, showwarning, showerror, showinfo, askretrycancel class TestMenu(Menu): ...
true
44e40a88ebebfdaf68ea46f619ea7060fbe661d6
thunderbird27/sentencereverse
/code.py
UTF-8
469
3.515625
4
[]
no_license
def reverse_words(arr): pass # your code goes here lenarr = len(arr) print(lenarr) i = lenarr -1 newarr=[] while i > 0: if (arr[i] == ' '): newarr.extend(arr[i+1:lenarr]) newarr.extend(' ') print (arr[i:lenarr]) lenarr = i i-=1 newarr.extend(arr[0:lenarr]) pr...
true
d583ec425a26185744c0832ea805666187957df6
caseypastella/python
/miilestronep1.py
UTF-8
4,012
3.765625
4
[]
no_license
from IPython.display import clear_output import random def display_board(board): print(' ') print(' ' + board[1] + ' | '+ board[2] + ' | ' + board[3]) print() print(' ' '-----------------') print() print(' ' + board[4] + ' | ' +board[5] + ' | ' + board[6]) print() ...
true
89dd0bdf4b7c026ddcbaf0ff658f77bdfd6bacc5
brandoncossin/Jumble
/jumble.py
UTF-8
940
3.5
4
[]
no_license
#function definition #jumble header file ...
true
44a63e071d1bffda8f10959e99b2800a062c1181
xlyang0211/learngit
/find_peak_element.py
UTF-8
1,110
3.515625
4
[]
no_license
class Solution: # @param num, a list of integer # @return an integer def findPeakElement(self, num): length = len(num) if length == 0: return None elif length == 1: return 0 i = length / 2 if i == 0: if num[i] > num[i+1]: ...
true
baf5f6e1b3a5793b104d122b5b077df1bf551898
blacklp/ProjectEulerPython
/non_abundant_sum.py
UTF-8
990
3.484375
3
[]
no_license
import math cache = set() def get_non_abundant_sums(): min_number = 24 max_number = 28123 result = 0 for num in xrange(min_number, max_number+1): if is_sum_of_two_abundant(num) == False: result += num print "non ab. num:", num return result def is_sum_of_two_abundant(num): min_abundant = 12 max_abund...
true
1bb6a745192a27f2fbc8b0938946f58d95249a34
mariadiaz-lpsr/class-samples
/teamManager.py
UTF-8
1,479
4.53125
5
[]
no_license
class Player(object): # we are defining the objects def __init__(self, player_name, player_age, number_goals): self.player_name = player_name self.player_age = player_age self.number_goals = number_goals # this adds each players name def printStats(self): print("Name: " + str(self.player_name)) prin...
true
ac197c7dc549fd1b6ec63ef4593d95599b19afb9
razaali11110/PythonPrograms
/Simple triangle with while.py
UTF-8
90
3
3
[]
no_license
s="1234" while s: print(s) s=s[1:] l=list(range(1,10)) print(l) del l[2] print(l)
true
97d14e639162146b084aa19e039f3c5e24f55ef7
GabrielSuzuki/Daily-Interview-Question
/2021-01-26-Interview.py
UTF-8
1,127
4.40625
4
[]
no_license
#Hi, here's your problem today. This problem was recently asked by Facebook: #Two words can be 'chained' if the last character of the first word is the same as the first character of the second word. #Given a list of words, determine if there is a way to 'chain' all the words in a circle. #Example: #Input: ['eggs',...
true
5c482160e41bd8d43f09c87b7d02af3318fc2865
anshjoseph/problems_hackerrank
/Diagonal_Difference.py
UTF-8
1,134
4.15625
4
[]
no_license
""" Given a square matrix, calculate the absolute difference between the sums of its diagonals. For example, the square matrix is shown below: 1 2 3 4 5 6 9 8 9 The left-to-right diagonal = . The right to left diagonal = . Their absolute difference is . Function description Complete the function in the editor b...
true
6ef8afc5bcd6735a5d76df5b3660e00d828cc0bb
smtamh/oop_python_ex
/study_ex/05_sequence/06_list.py
UTF-8
546
3.75
4
[]
no_license
""" Title 시퀀스 타입 | sequence type | list 06 Author kadragon Date 2018.09.02 """ # mutable / immutable my_str_1 = "Hi! SASA" my_str_2 = "Hi! SASA" print(my_str_1 is my_str_2) # 결과: True my_list_1 = [1, 2, 3, 4, 5] my_list_2 = my_list_1 # 결과: True print(my_list_1 is my_list_2) my_list_2 = my_list_2 + [77] prin...
true
fc1a6eb9ee7f53bb1cf73aab3328d73a016085c5
matt-desmarais/slack-acbot
/ac-bot.py
UTF-8
4,296
2.796875
3
[ "MIT" ]
permissive
import os import time import re from slackclient import SlackClient from subprocess import check_output import Adafruit_DHT import pyowm owm = pyowm.OWM('openweathermapskeyhere') # instantiate Slack client slack_client = SlackClient(os.environ.get('SLACK_BOT_TOKEN')) # starterbot's user ID in Slack: value is assigned...
true
db0d63ab698e60bae2710dce32490155d902bf50
ldotlopez/voicehat
/in-out.py
UTF-8
2,906
2.640625
3
[]
no_license
import asyncio import random import itertools import sys import abc class Message(str): pass class UserMessage(Message): pass class AgentMessage(Message): pass class Context: def __init__(self, user_channel, handler): self.user_channel = user_channel self.handler = handler ...
true
6c6d597ae349d6ba7754b75807f848fe1adbc7e6
karthikdodo/python
/icps/icp-3/Customer.py
UTF-8
751
3.6875
4
[]
no_license
class Employee: ct=0 def __init__(self,n,a,s,d): self.name=n self.age=a self.salary=s self.department=d def increment(self): self.__class__. ct+=1 def get_average(list): x=sum(list) n=len(list) print(x/n) class FullTimeEmployee(Employee): def __in...
true
b0bb8ebae34a71131cbb63d8f07533f4c25b6a25
ouriso/task-creator
/tests/test_plugins.py
UTF-8
1,269
2.65625
3
[]
no_license
from datetime import datetime as dt from datetime import timedelta from unittest import TestCase from src.plugins.plugin_filter_day import plugin_filter_day from src.plugins.plugin_filter_date import plugin_filter_date class TestPlugins(TestCase): def test_plugin_repeat(self): today = dt.today() ...
true
8844f3a76754f6924c7b2f3d9b0257478f66b627
jackrosetti/code-wars-solutions2018
/src/prob02.py
UTF-8
233
3.03125
3
[]
no_license
inpoot = input() while(inpoot != "0 0 0"): inpoot = inpoot.split(" ") v = float(inpoot[0]) q = float(inpoot[1]) t = float(inpoot[2]) dist = v*t dist += .5 * (q*t**2) print(dist) inpoot = input()
true
dfe3b3bd796a0444c41cb70889eba644798d65fc
falsetru/lunchbot
/burgerking.py
UTF-8
611
2.75
3
[]
no_license
# coding: utf-8 import contextlib import json import urllib def get_menus(): url = 'https://delivery.burgerking.co.kr/getMenuList' post_data = urllib.urlencode({ 'class_id': '00000', 'base_id': '', 'more_count': '0', }) with contextlib.closing(urllib.urlopen(url, post_data)) a...
true
a82ebc72c2219521e061f449a73a3298c160dbba
ivan-yosifov88/python_basics
/More For Loop/01. Back To The Past.py
UTF-8
522
3.9375
4
[]
no_license
inherited_money = float(input()) year_to_the_past = int(input()) years_in_one_century = year_to_the_past - 1800 age = 18 for years_in_one_century in range(years_in_one_century + 1): if years_in_one_century % 2 == 0: inherited_money -= 12000 else: inherited_money -= 12000 + 50 * age age += 1 ...
true
d8ad7f93c4695cd9dfada8959cfaac5f4a7cd5d2
gavinyf/MNWeeklyCategory
/tools/Erase404.py
UTF-8
2,289
2.578125
3
[]
no_license
#! /usr/local/bin/python3 # coding:utf-8 import requests from urllib import parse import os import click from threading import Thread import time import fake_useragent from random import randint def get_header(): location = os.getcwd() + '/agent.json' ua = fake_useragent.UserAgent(path=location) return u...
true
ebcf5a0710218e5265e3af569e2c84a5b4510698
nimra/module_gen
/nodes/Bisong19Building/E_PartIV/G_Chapter24/B_ResamplingMethods/B_LeaveOneOutCrossValidation/index.py
UTF-8
2,173
2.78125
3
[]
no_license
# Lawrence McAfee # ~~~~~~~~ import ~~~~~~~~ from modules.node.HierNode import HierNode from modules.node.LeafNode import LeafNode from modules.node.Stage import Stage from modules.node.block.CodeBlock import CodeBlock as cbk from modules.node.block.ImageBlock import ImageBlock as ibk from modules.node.block.MarkdownB...
true
cff57fca2fec2721ecf8f9f1bbd68e940fd78a5b
dannycruz34/Text
/TareaCorpus4.py
UTF-8
8,946
3.3125
3
[]
no_license
# -*- coding: utf-8 -*- # --------DANIEL CRUZ PAZ---------- import nltk from nltk import FreqDist from nltk.stem import PorterStemmer from nltk.tokenize import sent_tokenize, word_tokenize from nltk import bigrams import numpy as np import matplotlib.pyplot as plt import math #Se calcula el coseno entre el documento...
true
ff0e2b177b412b40a7000e85a6573a30c6b7ce31
shindesharad71/Data-Structures
/00.LeetCode/7_reverse_integer.py
UTF-8
757
4
4
[]
no_license
# 7. Reverse Integer # https://leetcode.com/problems/reverse-integer/ class Solution: def reverse(self, x: int) -> int: if 0 < x < 10: return x elif x < 0: less_than_zero = True x = abs(x) else: less_than_zero = False x = str(x) ...
true
4765c9c0e10a17d418ed4af8ee6445a96946a826
dalong12/off_nitrogens
/off_nitrogens/tests/test_perturb.py
UTF-8
1,518
3.109375
3
[ "MIT" ]
permissive
from off_nitrogens.calc_improper import * from off_nitrogens.perturb_angle import * import numpy as np def test_move_valence(): """Test a (changed valence, same improper) move on simple coordinates.""" # atom0 is central, atom3 is being moved atom0 = np.asarray([0,0,0]) atom1 = np.asarray([0,1,-1]) ...
true
ed0fcc9bce82c22007b0da8389a510c0860458a6
LauraCornei/ProiectIP_Modulul_Recomandari
/Iteratia1/Others/Project_Andrei_Avram/KMeans.py
UTF-8
608
2.890625
3
[]
no_license
import pandas as pd import time import matplotlib.pyplot as plt from sklearn.cluster import KMeans startTime = time.time() data_df = pd.read_csv('Reviews.csv') values = data_df.iloc[:, [3, 4]].values model = KMeans(n_clusters=3) model = model.fit(values) endTime = time.time() clusterList = list(model.labels_) pri...
true
de3b2fb8e62110b090135d35a7998374c999b587
bundai223/playground
/lang/python/fizzbuzz.py
UTF-8
263
3.65625
4
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- def fizzbuzz(n): if n % 15 == 0: return "fizz buzz" elif n % 3 == 0: return "fizz" elif n % 5 == 0: return "buzz" return str(n) for n in range(1, 101): print fizzbuzz(n)
true
b0d8073534df553a3aa58c7695bdcf4c6517f529
Ulitochka/MorphoRuEval2017
/tools/test/test_feature_extractor.py
UTF-8
17,169
2.5625
3
[]
no_license
import unittest import pprint from collections import OrderedDict from tools.workers.Feature_extractor import FeatureExtractor from tools.workers.Config_worker import Config import pandas from pandas.util.testing import assert_frame_equal from scipy import sparse class TestFeatureExtractor(unittest.TestCase): d...
true
de4ad969a235b09777077108d0261570b31a82bc
tanjo3/HackerRank
/Python/Strings/Capitalize!.py
UTF-8
107
3.6875
4
[]
no_license
def capitalize(string): words = string.split(" ") return " ".join([x.capitalize() for x in words])
true
267cdbfb28d9c8d6cb858b93fb73e037ee153a9d
lucasbflopes/codewars-solutions
/6-kyu/cramer,-thanks-for-your-contribution!/python/solution.py
UTF-8
704
3.015625
3
[]
no_license
import numpy as np from numpy.linalg import det as determinant def cramer_solver(matrix, vector): matrix, vector = np.array(matrix), np.array(vector) nRows, nCols = matrix.shape vectorDim = vector.size if nRows != nCols or vectorDim != nRows: return "Check entries" det = round...
true
3336861bc4679ffad2bf72f9809fcf285a16f0d5
qianlongzju/project_euler
/python/PE041.py
UTF-8
290
2.84375
3
[]
no_license
#!/usr/bin/env python from PE007 import isPrime def main(): i = 9876543 while True: if isPrime(i): if set(str(i)) == set(str(j+1) for j in range(len(str(i)))): print i return i -= 2 if __name__ == '__main__': main()
true
e6e3290a415abac212cc58b58b4ebc8fcbb60caa
kubrakosee/python-
/Döngüler/fibonacci_serisi.py
UTF-8
234
3.546875
4
[]
no_license
""" fibonecci serisi yeni bir sayıyı önceki iki syaının toplamı şeklinde oluşturur 1,1,2,3,5,8,13,21,34...... """ a=1 b=1 fibonacci=[a,b] for i in range(20): a,b=b,a+b fibonacci.append(b) print(fibonacci)
true
2a3e7fdc21b3ef8481901aac76265c395236d71c
jackleland/SuperSecretSantaScript
/SecretSantaScript.py
UTF-8
4,405
3.3125
3
[]
no_license
#!/usr/bin/python # -*- coding: utf-8 -*- import random import smtplib import glob import csv import os def check_duplicate_pos(a, b): # Checks two lists a and b position-wise for whether any items are the same assert len(a) == len(b) for j in range(len(a)): if a[j] == b[j]: ...
true
5a9e3afae1210aab5431274d8817be978c5c5d2f
taylarmouton/qbb2019-answers
/day1-homework/day1-exercise-6.py
UTF-8
253
2.84375
3
[]
no_license
#!/usr/bin/env python3 import sys in_file = open(sys.argv[1]) count = 0 for line in in_file: fields = line.strip().split("\t") if fields[2] == "2L": if 20000 >= int(fields[3]) >= 10000: count += 1 print(count)
true
118fdb91acd82bd2990ab2cc95a5fcad5e00ba79
edxiang/Scrapy_Python
/SimulateLogin/testClick.py
UTF-8
401
2.546875
3
[]
no_license
# -*- coding: utf-8 -*- from selenium import webdriver import time chromePath = r'D:\webDriver\chromedriver.exe' browser = webdriver.Chrome(executable_path=chromePath) url = "https://www.zhihu.com" browser.get(url) time.sleep(20) browser.find_element_by_class_name("VoteButton--up").click() print(browser.find_element_b...
true
0d1adea5e90e38145ee88711d3d0823815bc5705
bongsuyeon/MultiCampus
/day5/funcLab10.py
UTF-8
468
3.265625
3
[]
no_license
def sumAll(*p): CheckNotInt = True for check in p: if str(type(check)) == "<class 'int'>": CheckNotInt = False if p == () or CheckNotInt == True: return None sum = 0 for data in p: if str(type(data)) != "<class 'int'>": continue sum ...
true
083645d3478592e12e74d7b1847ff60f22ebdc4a
bernardito-luis/slack_trivia_bot
/utils.py
UTF-8
1,291
3.046875
3
[]
no_license
"""Utility module """ import os from sqlalchemy import create_engine from sqlalchemy.exc import IntegrityError from sqlalchemy.orm import sessionmaker from models import Question engine = create_engine('sqlite:///trivia.sqlite3') def fill_db_with_questions_from_txt(): """ Fills Database with question fro...
true
64e0cbb727d9368f6efbd73677a383e2dacf811b
sentukoves/student
/convert/main.py
UTF-8
2,535
2.578125
3
[]
no_license
import xml.etree.ElementTree as ET my_xml=""" <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="urn:nornik.ru:sbox:po:sentukov" targetNamespace="urn:nornik.ru:sbox:po:sentukov"> <xsd:complexType name="ListUrls"> <xsd:sequence> <xsd:element name="response"> <xsd:complexType>...
true
653b6415053e1f1af52335c5a0bb45070b66d0bb
sods/gpss
/server.py
UTF-8
843
2.875
3
[]
no_license
from flask import Flask app = Flask(__name__) import os import glob import shutil from flask import request @app.route('/generate') def data(): # here we want to get the value of user (i.e. ?user=some-value) username = request.args.get('user') if not username.isalpha(): return "You need to enter a u...
true
266c5a47cb7cb5040912707222d8d06275d13582
abrahamgkidan/klesun.github.io
/htbin/text_service.py
UTF-8
1,537
2.5625
3
[]
no_license
#!/usr/bin/env python3.5 # -*- coding: UTF-8 -*- # this entry point should be used when response is clean text not wrapped inside json # using this cuz i want to see nice rendered pages in chrome developer tools import cgitb cgitb.enable() import json import os import urllib import urllib.parse import locale import ...
true
7382dcc9237db1981c1a87d910eafb83379c8686
jeyabalajis/py-flask-graphql-autogen
/core/GraphQLServer.py
UTF-8
2,684
2.75
3
[]
no_license
from core.GraphQLTable import GraphQLTable from utils.TemplateUtil import TemplateUtil from utils.file_util import create_dir, copy_file, copy_dir_tree, get_fq_path from static.config import ( DB_MODELS_FOLDER, GRAPHQL_SCHEMA_FOLDER, GRAPHQL_SERVER_FOLDER, BLIND_COPY_FILES, BLIND_COPY_FOLDERS ) cl...
true
bc1070f16dde59d02c875b80b8034ae31188464f
vgangal101/CTCI_practice
/CTCI_exercises/ch1/q2.py
UTF-8
1,309
3.734375
4
[]
no_license
from collections import Counter def isPermutation(s1,s2): s1_counter = Counter(s1) s2_counter = Counter(s2) return s1_counter == s2_counter def isPermutation2(s1,s2): s1_dict = {} s2_dict = {} for s in s1: if s not in s1_dict.keys(): s1_dict[s] = 1 else: ...
true
8b1f0fc5b588363306a3c1a311353f106109a43b
S0U1SB4N3/beagle
/test.py
UTF-8
2,852
2.5625
3
[]
no_license
import unittest from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver.common.keys import Keys from selenium.webdriver.common.action_chains import ActionChains from selenium.common.exceptions import NoAlertPresentException class XssExploit(unittest.TestCase): def setUp(...
true
805380d6318dfe206d2e250c02bd0a73976a9767
madrigaljose/Mouseomate
/src/image_handler.py
UTF-8
1,440
3.078125
3
[ "CC0-1.0" ]
permissive
from PIL import Image, ImageFilter, ImageOps import numpy as np from easygui import fileopenbox class Image_handler(object): def __init__(self,image): self.im = Image.open(image) @staticmethod def get_image() -> str: """ Ask's users the name of the file to be used :return: a string of the file name """...
true
f3a6961aa58fa1d60b64d8c2bf58f75869b28830
Johnsonnyaanga/python-time
/pythonenum.py
UTF-8
226
3.703125
4
[]
no_license
from enum import Enum class Color(Enum): red = 1 green = 2 blue = 3 print(Color.red) # Color.red print(Color(1)) # Color.red print(Color['red']) # Color.red print(Color("red"))
true
8dc357643d7e489d7359dc0fb0ef1022d299cb8c
daniel10012/python-onsite
/week_03/03_testing/test_returnwords.py
UTF-8
725
3.28125
3
[]
no_license
import unittest from returnwords import return_word class TestReturnWords(unittest.TestCase): def test_returns_false_if_empty_string_as_char(self): self.assertIs(return_word("abcde",""), False) def test_returns_false_if_empty_string_as_word(self): self.assertIs(return_word("","e"), False) ...
true
e71b5ed984a4448298dcf76ed6d2293792ab0e62
davidbistolas/X18_Controller
/behringerbridge.py
UTF-8
2,017
2.625
3
[ "BSD-2-Clause" ]
permissive
import controller import midireceiver import rumps __appname__ = "OSC Bridge" class Bridge(rumps.App): def __init__(self, driver_name="XAir OSC Bridge", ip='0.0.0.0'): """q midi->OSC bridge :param driver_name: The midi name of the bridge. This will show up in Logic...
true
397ad443e4d68b8a3ecb1b29f6665fa243d4a9be
mathi98/madhu
/consecutive.py
UTF-8
176
3.125
3
[]
no_license
k=int(input()) a=[int(x) for x in input().split()] b=[] for i in range(0,len(a)-1): if a[i]>a[i+1]: b.append(a[i]) else: b.append(a[i+1]) print(sum(b))
true
b251af0017ef5bb1310d0198c8a8b1af3632fa9d
robbyboparai/sturdy-couscous
/sturdycouscous/Garbanzo/Checker.py
UTF-8
3,398
2.984375
3
[]
no_license
# Class with methods defined that ` # 1) Check certificate validity # 2) Check TLS versions supported # 3) Look for open ports # 4) Get all ciphers supported (?) import socket, ssl from datetime import datetime class connection_checker(): # Returns a boolean checking whether a specified port for a given domain is o...
true
2f3f8fd88141f24b4e441a3d8a35b3ca3294268e
royels/BeyondHelloWorld
/pythonsnippets/tileCost.py
UTF-8
301
3.484375
3
[]
no_license
from sys import argv print "Keep consistent units!" width = int(raw_input("Width of the room (in meters) : ")) height = int(raw_input("Height of the room (in meters) : ")) cost = float(raw_input("Cost per square unit in $ : ")) print "Total cost: $%.2f" % (cost * float(width * height))
true
b3dc10e220abaa0f5bc4a8cd7e39e33e0bb75d5c
nixonsparrow/adventofcode2020
/day8.py
UTF-8
2,466
3.5
4
[]
no_license
from day8i import day8 from itertools import * from copy import deepcopy import time test_input = r'''nop +0 acc +1 jmp +4 acc +3 jmp -3 acc -99 acc +1 jmp -4 acc +6''' def clean_input(some_input): # returns input as list of lists (each contains [command, value]) input_to_return = [] for row in some_input.s...
true
6e126d67076d0ddf962c51ff67e7f96dc485192c
sorXCode/Euler-Problems
/Euler_5/e5.py
UTF-8
310
3.15625
3
[]
no_license
def all_divisible(): X, FACTORS, NUM = 1, list(range(1, 11)), 0 while NUM == 0: for factor in FACTORS: mul = X/factor if not mul.is_integer(): X += 1 break elif factor == FACTORS[-1]: NUM = X return NUM
true
3db7a86bd8d112a387fad9151b6e7c2b752ce30c
collinstechwrite/MULTI-PARADIGM-PROGRAMMING
/python/menu.py
UTF-8
3,245
4.40625
4
[ "MIT" ]
permissive
def display_menu(): #this funtion is used to display the menu print("Iris Data Set") print("--------") print("MENU") print("====") print("1 – Introduction To Iris Data Set") print("2 - View Image Of Iris Varieties") print("-----------------------------------") print("3 – View Averag...
true