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
e14cebd2ddf4342985a89a26be8e3e787b2a7cbf
fclm1316/mypy
/Algorithm/二分法.py
UTF-8
1,238
3.953125
4
[]
no_license
#!/usr/bin/python3 # coding:utf-8 # 二分排序 def binary_searcg(list, item): low = 0 # 获得列的长度,列是从 0 开始 high = len(list) - 1 # 9 while low <= high: print(list) # 如果(low + high)不是偶数,Python自动将mid向下取数 mid = int((low + high) / 2) # (0+9)/2=4 # 获得中间值 print('mid 数值是 {0:d}'....
true
5459d7ab0115bbc941952f0d20082d3a37ac200f
AdminAbhi/MyCodeLib
/CodeChef/2020/20.12/long/VACCINE2.py
UTF-8
1,356
2.53125
3
[]
no_license
#============================================================================= # @abhi_admin FB UserId: abhiavisekkr Email Id: abhiavisekkr@gmail.com #============================================================================= #------------------------------Dependencies----------------------------------- #impo...
true
ee2bb8e44fea32b7180e1c102522651dbf02669b
GINK03/atcoder-solvers
/arc003_c.py
UTF-8
1,427
2.71875
3
[]
no_license
N, M = map(int,input().split()) tape = [ [ {'bright':-1, 'passed':None, 'type':None } for m in range(M) ] for n in range(N)] cur = None for n in range(N): for m, c in enumerate(input().strip()): if c == 'g' or c == 's': tape[n][m]['type'] = c if c == 'g': cur = [n, m] else: tape[n][m]['bright'] = f...
true
050b88db9e90955973700fe94e5b7862d448fb55
nrohith55/Project3-Predicting-the-term-deposit-subscription
/Predicting the term deposit subscription.py
UTF-8
17,679
3.328125
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Tue Jun 23 01:45:40 2020 @author: Rohith """ import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sns from sklearn.metrics import cohen_kappa_score df=pd.read_csv("E:\\Data Science\\Data_Science_Projects\\Project_4\\Dataset\\bank...
true
abed64c116cab9697e9b78cea4d9eb97187eac23
awillbourn/CS909CW
/represent.py
UTF-8
1,710
2.828125
3
[]
no_license
import gensim, logging, bz2 import nltk #create the topic model def getTopicModel(text, NoTopics): #build dictionary diction = gensim.corpora.Dictionary(text) #get corpus cor = [diction.doc2bow(t) for t in text] #create tfidf model model = gensim.models.TfidfModel(cor) ...
true
13f5a830c315867da462c47bb4ea18f3a0248cd2
VargheseVibin/dabble-with-python
/Day27_01(TkinterIntro)/main.py
UTF-8
271
3.5
4
[]
no_license
import tkinter window = tkinter.Tk() window.title("My First GUI Program") window.minsize(width=500, height=300) # Label my_label = tkinter.Label(text="This is a Label", font=("Arial", 24, "bold")) my_label.pack(side="left") my_label.pack(expand=True) window.mainloop()
true
3f258a45e5784ce80aa75a50ab9efc132bbb5c62
Michael719/CECS-424-Sp2017-Assignment-2
/Part Two/PartTwo.py
UTF-8
1,307
4.21875
4
[]
no_license
from math import sqrt def is_prime(num): #2 and 3 are automatically primes if num == 2 or num == 3: return True #anything below 2 or any even number are automatically not primes elif num < 2 or num % 2 == 0: return False #anything that passes the above statement and is less than 9 i...
true
30694dd7d3c432e9be07ed337fa21ac8e0cc1662
Chialijuan/Avito
/models/phrase_2vec.py
UTF-8
1,066
2.59375
3
[]
no_license
import pandas as pd from gensim import models import timeit # Reading in cleaned data filepath = '~/Documents/Avito/' df = pd.read_csv(filepath+'ItemInfo_train2.csv', encoding='utf-8', converters={"description_clean": lambda x: x.strip("[]").split(", ")}, usecols=['description_clean']) # Convert to TaggedDocument def...
true
4d302784efe23d9bef4b2d491bf21b1c6b8987d7
confar/nand2tetris
/08/main.py
UTF-8
906
2.5625
3
[]
no_license
import argparse import os from parser import VMParser from parser import INIT_CODE if __name__ == '__main__': parser = argparse.ArgumentParser(description='Translate VM code to Hack machine language') parser.add_argument('infile', type=str, help='Input file for VM code') parser.add_argument('outfile', ty...
true
849a6a904f785f85a55f437ff3de77e22200b6f0
miaohf/flask-vue-book-library
/tests/functional/test_books.py
UTF-8
7,160
3.046875
3
[]
no_license
""" This file (test_books.py) contains functional tests for books endpoints """ from assertpy import assert_that from flask_jwt_extended import create_access_token from app.models import User from app.helpers import convert_to_dict base_route = '/api/books' def book_data(): return dict( isbn='978-1-449-3...
true
9948173dd716a734e0edfd0e919ed2004e3936b4
iotpuneet/pythoncodes
/bucky22.py
UTF-8
245
2.8125
3
[]
no_license
import random import urllib.request def download_image(url): name= random.randrange(1,1000) full_name= str(name)+".jpg" urllib.request.urlretrieve(url,full_name) download_image("https://www.talkenglish.com/images/1main_listen.jpg")
true
d31c62ddbdb79a702f71c870dc4c5b6e1bec7b82
greydanus/minirts
/nnpolicy.py
UTF-8
1,326
2.515625
3
[ "MIT" ]
permissive
import numpy as np import torch, time, os, glob import torch.nn as nn from torch.autograd import Variable import torch.nn.functional as F class NNPolicy(torch.nn.Module): # an actor-critic neural network def __init__(self, num_actions): super(NNPolicy, self).__init__() self.conv1 = nn.Conv2d(6, 16...
true
dad6e41e2380f22e6346a2c64fd87501066fd8d6
paramoshin/retailhero_uplift
/src/database/base.py
UTF-8
3,273
2.625
3
[]
no_license
import datetime from contextlib import contextmanager from functools import wraps from sqlalchemy import String, DateTime, Integer, event from sqlalchemy import create_engine from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import sessionmaker, Session Base = declarative_base() def valida...
true
378fc8a79698e250f9ec0c59ea354d288073708c
kamimi01/coding_practice
/AtCoder_Beginner_Contest_185/c_1.py
UTF-8
115
3.09375
3
[]
no_license
l = int(input()) ans = 1 for i in range(11): ans *= (l - 1) - i for j in range(1, 12): ans //= j print(ans)
true
70da0ad4ef197a576c4fd039046e46cdb6e89a98
gabriellaec/desoft-analise-exercicios
/backup/user_312/ch18_2019_03_11_17_03_34_239732.py
UTF-8
58
3.046875
3
[]
no_license
def encontra_cateto(c1, h): return (c1**2+h**2)**(1/2)
true
44993d1cae7ae0a7c285ac22e0c3245b379c3884
iamsharmaapoorv/food-ordering-service
/food_ordering_service.py
UTF-8
6,387
3.140625
3
[]
no_license
"""1. show ratings of user 2. update locationb 3. show user details """ from enum import Enum from collections import defaultdict class FoodServiceException(Exception): pass class Gender(Enum): MALE = 1 FEMALE = 2 class FoodService: def __init__(self): self.users = {} self.restaura...
true
122a003d7ccbb6dca4b0eb99fce8458fd6c9afc4
itsolutionscorp/AutoStyle-Clustering
/all_data/exercism_data/python/atbash-cipher/7d0d21c6c4384d7697979503638c2dba.py
UTF-8
629
3.359375
3
[]
no_license
__author__ = 'banarasitippa' from string import maketrans plain = 'abcdefghijklmnopqrstuvwxyz' cipher = 'zyxwvutsrqponmlkjihgfedcba' trantab = maketrans(plain, cipher) def decode(ciphertext): # remove space and translate return ciphertext.replace(' ','').translate(trantab) def encode(plaintext): #filte...
true
682d06959fb52fd9e5eef91296c935bcc28cf1f8
jpc0016/Python-Examples
/Crash Course/ch9-Classes/my_cars.py
UTF-8
388
3.375
3
[]
no_license
# CH9 Example # # my_cars.py # # Importing multiple classes from a separate file. # can use "from car import *" as well from car import Car, ElectricCar # create new car: beetle my_beetle = Car('volkswagen', 'beetle', 2016) print(my_beetle.get_descriptive_name()) # create new electric car: tesla my_tesla = ElectricC...
true
917260013ff313556910703971dcada8bc1a169a
program008/pylearn
/demo/demo7.py
UTF-8
272
2.578125
3
[]
no_license
#!/usr/bin/env python3 """ Created by tao.liu on 2018/8/1. 模块 """ import sys from demo import fibo print('命令行参数如下:') for i in sys.argv: print(i) # print('\n\nPython 路径为:', sys.path, '\n') fibo.fib(1000) fibo.fib2(100) fibo.__name__
true
e0e63edacfd67f5709e1238a9feaa96615333bb9
ItsSamarth/ds-python
/hrCalenderModule.py
UTF-8
298
3.203125
3
[]
no_license
#hacker rank calender module #calender module allows you to output calenders and provide aditional useful functions for them # class calender.TextCalender([firstweekday]) import calendar print(calendar.firstweekday()) m,d,y = 9,19,1995 ans =calendar.weekday(y,m,d) print(calendar.day_name[ans])
true
452b253dfdefd1b65cc62724b9b151c7932d08cb
rjoshi47/DSmax
/cookOff/arrays/+3WayPartitioning.py
UTF-8
555
3.84375
4
[]
no_license
''' Created on 07-Oct-2017 @author: rjoshi sort an array between range: ---> 9 >-----< 12 <--- ''' def threeWayPartition(arr, low, high): start = 0 i = 0 end = len(arr) - 1 while i < end: if arr[i] < low: arr[i], arr[start] = arr[start], arr[i] i += 1 star...
true
07fb31701f765487203b685943aee60ea0b1acde
hyesulim/study-ML-using-tensorflow-
/Lab 04-3 Loading Data from files using Queue Runner.py
UTF-8
2,382
2.984375
3
[]
no_license
import tensorflow as tf # 파일 하나로 파일 큐를 생성함. filename_queue = tf.train.string_input_producer( ['data-01-test-score.csv'], shuffle=False, name='filename_queue') # reader을 정의함. # binary를 읽는 reader가 될 수도 있는 등 다양함. 현재는 text를 읽도록 정의함. # 파일 큐에서 key와 value를 읽어오도록 하였음. reader = tf.TextLineReader() key, value= reader.read(f...
true
58108e7e4661aabb422ae0547b4c09d97cbf2675
miso-belica/sumy
/sumy/summarizers/reduction.py
UTF-8
1,748
2.859375
3
[ "Apache-2.0" ]
permissive
# -*- coding: utf-8 -*- from __future__ import absolute_import from __future__ import division, print_function, unicode_literals import math from itertools import combinations from collections import defaultdict from ._summarizer import AbstractSummarizer class ReductionSummarizer(AbstractSummarizer): """Sourc...
true
8ec951a0a90e577dc09338057adef4a52ce9e3b6
SaiPhani-Erlu/pyScript
/3_DeepDive/CaseStudy1/03_DayOrNight.py
UTF-8
621
3.921875
4
[]
no_license
import time ''' Q3. Weather forecasting organization wants to show is it day or night. So, write a program for such organization to find whether is it dark outside or not. Hint: Use time module. ''' def set_time(hour, mins, sec): t = time.localtime() return t.tm_year, t.tm_mon, t.tm_mday, hour, mins, sec, t....
true
24bfb2f0a57628ef8fbf65ed6889c0fa5e7baa06
mattiashem/weigth
/sensor/sensor.py
UTF-8
1,443
3.125
3
[]
no_license
import os import time import datetime from addToQue import * from alerty import * ##### # # detect a value and if it smaller then last time alert # #Values to send store = "ica-1" shell = "one" #Lets start with 0 current_weight =0 def sendData(weight): ''' Send data to the que and on to the database ''' d...
true
3732d3a295a093541a8d5fa4000e08502e9e96bd
acomze/CERP
/timers/plt_cost/get_time_avg.py
UTF-8
387
2.5625
3
[]
no_license
import matplotlib.pyplot as plt fr = open("./resultData_UCB/HRL_result.txt") times = [] time_avg = [] for t in fr.readlines(): if float(t) < 1: times.append(float(t)) count = 1 for t in times: tavg = sum(times[:count])/count time_avg.append(tavg) count += 1 tavg = sum(times)/count time_avg.ap...
true
2febc6cd792ef5118cf5289ae68f94cf85b19bc2
VinMelvin/cspp10
/Unit5/mmathew_scramble.py
UTF-8
749
3.921875
4
[]
no_license
import random # funcation to shuffles word def scramble_word(word): # split word by list # if len(word) >= 4: split = list(word) first = split[0] last = split[-1] firstlast_out = split[1:-1] #split = list(word) random.shuffle(firstlast_out) firstlast_out.insert(0,first) firstlas...
true
7b6392f8a4200ca13bdfb7946feaea21b63f2237
YooGunWook/coding_test
/백준/백준_14226번.py
UTF-8
2,039
3.640625
4
[]
no_license
""" 영선이는 매우 기쁘기 때문에, 효빈이에게 스마일 이모티콘을 S개 보내려고 한다. 영선이는 이미 화면에 이모티콘 1개를 입력했다. 이제, 다음과 같은 3가지 연산만 사용해서 이모티콘을 S개 만들어 보려고 한다. 1. 화면에 있는 이모티콘을 모두 복사해서 클립보드에 저장한다. 2. 클립보드에 있는 모든 이모티콘을 화면에 붙여넣기 한다. 3. 화면에 있는 이모티콘 중 하나를 삭제한다. 모든 연산은 1초가 걸린다. 또, 클립보드에 이모티콘을 복사하면 이전에 클립보드에 있던 내용은 덮어쓰기가 된다. 클립보드가 비어있는 상태에는 붙여넣기를 할 수 없으며, 일부만 클립보...
true
f876514d534e4802a34f139ac8c1b93c8574410f
romaniuknataliia/pyladies
/03/cykly.py
UTF-8
1,054
3.34375
3
[]
no_license
'''from math import pi, sin, cos, ceil x = sin(1) # v radianech print(x) a = cos(sin(1)) print(a) if sin(1) < 3: print('Je to mensi.') print(pi) y = 6 z = str(y) print(type(y)) #funkce co rika typ promene print(ceil(6.2)) #zaokruhli do 7''' '''import math help(math)''' '''from random import randrange, un...
true
a4d0b867476eefb9df125529d385d454e17f233a
Haz001/EnSim
/IDE/Python/IDE.py
UTF-8
494
2.625
3
[ "MIT" ]
permissive
import Interpriter import os directory = os.getcwd()+"\\" file_paths = [] for root, dirs, files in os.walk(directory): for file in files: if file.endswith('.es'): file_paths.append(file); ## print(file_paths) print(str(file_paths.index(file))+" - "+file) ...
true
98a69ac0aaac002faf55252f21b25e0b277b1172
zJoyceLee/Homework
/NumericalCalculation/Lab/02/lab02_5_2.py
UTF-8
822
3.171875
3
[]
no_license
import re def wordSplit(path): with open(path) as file_obj: all_the_text = file_obj.read().lower() all_the_text = re.sub('\"|,|\.|"|:|;|\?', " ", all_the_text) words = all_the_text.split() return words def wordCounter(path): result = {} words = wordSplit(path) for word ...
true
ffd03fcc5daca3ce7674866fb5327fe61abdf502
AshimUjjwal/practice
/qwerty.py
UTF-8
108
3.09375
3
[]
no_license
def add(): a=int(input('Enter:')) b =10 print(a+1,b) return a=10 b=5 add() print(a,b)
true
906b495c6f7e566cce83ef091fe960f93967d938
mwrazam/yolo-custom-implementation
/metrics.py
UTF-8
3,674
2.796875
3
[]
no_license
import cv2 import math import numpy as np import tensorflow as tf from tensorflow.keras import backend as K from sklearn.metrics import average_precision_score box_offset = 384 grid_cells = 7**2 # BoundBox class class BoundBox: def __init__(self, pc, xmin, ymin, xmax, ymax, c1, c2, c3): self.pc = pc ...
true
86737ac791e72ca6f2a382132e7ee0685f822dd7
tjksiazek/PythonLearns
/Celcius-to-Fahrenheit.py
UTF-8
352
4.03125
4
[]
no_license
temp = input("Enter Temp in Celsius") Celsius = float (temp) Fahrenheit = 1.8 * Celsius + 32 print ("Temperature:", Celsius, "Celsius = ", Fahrenheit, " Fahrenheit") ##### temp = input("Enter Temp in Fahrenheit") Fahrenheit = float (temp) Celsius = (Fahrenheit - 32) * 5/9 print ("Temperature:" , Fahrenheit, "Fahr...
true
d4deb6b9d5897569107cad58a44aeb5a85f1d0b0
usman-personal-home/projects
/Array/remove_duplicates_array_todo.py
UTF-8
1,315
3.625
4
[]
no_license
import os from os.path import basename import pprint import random def main(): mylist = [1, 1, 1, 6, 2, 3, 4, 4, 4] #new_list = remove_duplicates_sorted(mylist) new_list = remove_duplicates_with_set(mylist) print (new_list) def remove_duplicates_with_set(lst): seen = set() res = [] fo...
true
b8a65d4fca3ece2d437a446e03549c18de454acc
NIGHTMIGARE/algorithm-test
/leetcode123.py
UTF-8
429
3.234375
3
[]
no_license
class Solution: def maxProfit(self, prices: List[int]) -> int: firbuy=-9999 firsell=0 secbuy=-9999 secsell=0 for index in range(0,len(prices)): firbuy=max(firbuy ,-prices[index]) firsell=max(firsell,firbuy+prices[index]) secbuy=max(secbuy ,...
true
c823811bbcb31ab361defe250ba7cbda68e83c9e
maheeri/youtube-conversation-prediction
/data_collection/categories.py
UTF-8
1,210
3.015625
3
[]
no_license
"""Creates a dictionary of category IDs as keys with the category names as values""" #!/usr/bin/python import httplib2 import os import sys import datetime import json from apiclient.discovery import build from apiclient.errors import HttpError # Key and version data DEVELOPER_KEY = "AIzaSyBEuuLWPO0AJIIp7TVGIB1uM_...
true
8a20f37da5c53c30a36473203eab45d855f75043
2020668/python2019
/hm_00_python/zhengfangxing.py
UTF-8
111
3.515625
4
[]
no_license
n=int(input("正方形边长:\n")) print("*"*n) for i in range(n-2): print("*"+" "*(n-2)+"*") print("*"*n)
true
cebff514eacc1a0b7d8ff6e8ef3c1a5de6c587e8
ipaullly/flask-bcrypt
/project/users/models.py
UTF-8
713
3.03125
3
[]
no_license
from project import db, bcrypt class User(db.Model): __tablename__ = 'users' id = db.Column(db.Integer, primary_key=True) username = db.Column(db.Text, unique=True) password = db.Column(db.Text) def __init__(self, username, password): self.username = username self.password = bcryp...
true
8884545fdf0a7f0e13af73c598e24e727fac732b
runway7/signs.old
/api_tests/api.py
UTF-8
3,248
2.84375
3
[]
no_license
""" Signs Python Client. Author: Sudhir Jonathan License: MIT Does not currently work on Google App Engine because of it's dependency on the Requests egg. That should be fixed in future versions. """ import requests import json class Url: def __init__(self, base): self.base = base self.params =...
true
dfac645fc966441149d1fd50a79fd649487e6f92
ReallyMonk/16-332-579-Introduction-to-Deep-Learning
/Homework/Project/fcnn.py
UTF-8
3,312
2.734375
3
[]
no_license
#!/usr/bin/env python # coding=utf-8 ''' @Author: Jin X @Date: 2020-04-07 22:38:00 @LastEditTime: 2020-04-08 18:06:23 ''' import pickle import numpy as np def load(): with open( "F:\Rutgers\\2ndSemester\Intro to DL\Homework\Project\\mnist.pkl", 'rb') as f: mnist = pickle.load(f) ...
true
da83cdee6ffd901354308183baab0feeb66facac
Aasthaengg/IBMdataset
/Python_codes/p02258/s804934325.py
UTF-8
218
2.859375
3
[]
no_license
import sys n = input() minv = input() maxv = - 1000000000 nums = map(int, sys.stdin.readlines()) for num in nums: maxv = num - minv if num - minv > maxv else maxv minv = num if num < minv else minv print maxv
true
d188ba449c18c5d614dcacde323859ffac02db7a
burakdonmez/twitter_scraper
/twitter_scraper/infrastructure/tests/test_decorators.py
UTF-8
5,188
2.609375
3
[ "MIT" ]
permissive
from unittest import mock from django.test import TestCase from memoize import DEFAULT_CACHE_OBJECT from twitter_scraper.infrastructure.decorators import ( RateLimitDecorator, memoize_generator, ) memoizer_path = "twitter_scraper.infrastructure.decorators" class DummyClock: now = 0 def __call__(se...
true
a22d63000d18ef167d59a6662dff51db8c1f8e8d
kyrajeep/Practice
/sumlist.py
UTF-8
245
3.953125
4
[]
no_license
#input: list #output: sum of each element of the list def sumlist(list1): if len(list1) == 1: return list1[0] else: return (list1[0] + sumlist(list1[1:])) print(sumlist([1,2,3,9])) print(sumlist([1])) #print(sumlist())
true
70fab3442feb7c68b08020e8f6a9af81196570d9
H2DI/bandits_lab
/bandits_lab/algorithms/gen_algorithms.py
UTF-8
14,020
2.734375
3
[ "MIT" ]
permissive
import numpy as np class DAlg: def __init__(self, K, label=""): self.label = label self.K = K self.alg_time = 0 def choose_arm(self): pass def update(self, arm, reward): self.alg_time += 1 def play_once(self, bandit): arm = self.choose_arm() r...
true
f57242447343d5bbe478d595b99c4177fdf3ccd7
esqu1/subX
/sub10.py
UTF-8
2,130
2.765625
3
[]
no_license
import requests, zipfile, StringIO, os sub7, sub8, sub9, sub10 = {}, {}, {}, {} def log_time(time, name): if int(time) not in [0, -1, -2]: if int(time) < 700: sub7.setdefault(name, [0, 1000]) sub7[name][0] += 1 if int(time) < sub7[name][1]: sub7[name][1...
true
8c7f38c23ca0a614cb4a31345a373d30077715e5
ok97465/npzheader
/npzheader/viewer.py
UTF-8
6,519
2.71875
3
[ "MIT" ]
permissive
"""Viewer GUI.""" # ---- Import # Standard library imports import sys import os import os.path as osp from urllib.parse import unquote # Third party imports from qtpy import QtCore from qtpy.QtCore import Signal, QUrl, QMimeData from qtpy.QtGui import QDrag from qtpy.QtWidgets import (QApplication, QMainWindow, QVBoxL...
true
001783416eb2fe0b447771a873f23f9e4329dee7
shiqi0128/My_scripts
/python_study/Py28_0422_json_requests/lm_01_do_json.py
UTF-8
1,085
3.40625
3
[]
no_license
# -*- coding: utf-8 -*- """ ------------------------------------------------- @Time : 2020/4/22 20:28 @Auth : 可优 @File : lm_01_do_json.py @IDE : PyCharm @Motto: ABC(Always Be Coding) @Email: keyou100@qq.com @Company: 湖南省零檬信息技术有限公司 @Copyright: 柠檬班 ------------------------------------------------- """ i...
true
29573d79e152614779c93ce0741af63aaa9d56b2
rcchen/project-euler
/python/euler30.py
UTF-8
242
3.515625
4
[]
no_license
def digitSum(number,power): sum = 0 while (number > 0): sum = sum + pow((number % 10),power) number = number / 10 return sum total = 0 for i in range(2,10000000): if (i == digitSum(i,5)): print i total = total + i print total
true
c27b1c12fb6e48e27b6c5c6e071a15b7495d3ea0
klein1/Shipin
/utils/example/youget.py
UTF-8
797
2.609375
3
[]
no_license
import subprocess, time def download_by_url(url): # p = subprocess.Popen('you-get --itag=135 -x 127.0.0.1:1080 "' + url +'"', shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) p = subprocess.Popen('youtube-dl --proxy 127.0.0.1:1080 "' + url +'"', shell=True, stdout=subprocess.PIPE, stderr=subproce...
true
759f663cb4512b8e11d25cad04044a02984b025b
skeletorpower/python
/PythonTut/tuts/zad2.py
UTF-8
576
3.59375
4
[]
no_license
''' Created on Oct 30, 2017 @author: aleksandar.novic ''' import random # def guess(num): # while True: # if num != random.randrange(10): # print("Guess again looser") # # else: # print("U guessed it") # break # # guessNum = int(input("Enter a numb...
true
6bea57bff33dfad5b8ac8097b38fa54470904fa9
K4CZP3R/domoticz_rf_outlet
/RfOutletDb.py
UTF-8
939
2.859375
3
[]
no_license
from RfOutlet import RfOutlet from LogicResponse import LogicResponse class RfOutletDb(object): def __init__(self, predefined_outlets: [RfOutlet]): self.rf_outlets = predefined_outlets self.rf_outlets: [RfOutlet] def get_outlets(self) -> [RfOutlet]: return self.rf_outlets def count_...
true
75d1c9c2ea8188fe80bfe1c1564f81c8945fd9d7
MrHamdulay/csc3-capstone
/examples/data/Assignment_8/cxxrog002/question4.py
UTF-8
1,389
3.890625
4
[]
no_license
"""palindromic primes between two numbers Roger Cox 8 May 2014""" import math import sys sys.setrecursionlimit (30000) def if_pali(start) : # check if palinomial x=False if start == 2 or start == 3 or start ==5 or start ==7 : return True elif (len(str(start)))/2>=1 : #only if the ...
true
6f7e3efabb2cb25004ea972b4ddf4cbb2ebaed5d
cosmozhang-lab/syx-clustering
/data.py
UTF-8
533
2.765625
3
[]
no_license
import numpy as np class RandomBatchIndexes: def __init__(self, datasize): self.datasize = datasize self.indexes = np.arange(datasize) np.random.shuffle(self.indexes) self.start = 0 def next(self, batch_size): assert not batch_size > self.datasize start = self.start nextstart = (start +...
true
01a9684a45032c3f7d15fc397a9002b76e306251
WesleyVercoutere/STAnDa_Python
/example scripts/CTS/V0.1.1/src/service/impl/FileOutputService.py
UTF-8
1,848
2.875
3
[ "MIT" ]
permissive
from src.domain.Settings import Settings from src.service.OutputService import OutputService class FileOutputService(OutputService): def __init__(self, settings: Settings): super().__init__(settings=settings) self._fileName = r"d:\temp\CTS_output.txt" try: self._setHeader() ...
true
4f390da528a4b4061ebc3b14cc0ab86e6de9933f
smoens/kdg-project-reinforcement-learning
/be/kdg/rl/learning/approximate/deep_qlearning.py
UTF-8
3,581
3.015625
3
[]
no_license
from tensorflow.keras import Model import numpy as np import random from collections import deque from be.kdg.rl.agent.episode import Episode from be.kdg.rl.environment.environment import Environment from be.kdg.rl.learning.learningstrategy import LearningStrategy from be.kdg.rl.learning.model import model1 from be.kdg...
true
921ec89c7ad14d80d13a13fb01820299c7d80edf
mjshipp25/CS50x
/Week9/finance/application.py
UTF-8
9,535
2.5625
3
[]
no_license
import os from cs50 import SQL from flask import Flask, flash, redirect, render_template, request, session from flask_session import Session from tempfile import mkdtemp from werkzeug.exceptions import default_exceptions, HTTPException, InternalServerError from werkzeug.security import check_password_hash, generate_pa...
true
05bb993929bfbb1a638826a636a2a61d8c0454e2
valorayan/wechat
/project/__init__.py
UTF-8
1,863
2.578125
3
[]
no_license
# coding:utf-8 import logging import redis from flask import Flask from config import config_map from flask_sqlalchemy import SQLAlchemy from flask_session import Session from flask_wtf.csrf import CSRFProtect from logging.handlers import RotatingFileHandler # 数据库 db = SQLAlchemy() # 创建redis连接对象 redis_store = None #...
true
747359af9d8895c5b94b768a0294bc9d79389b94
ritik7jain/Machine-Learning
/hierarchical_classification.py
UTF-8
947
3
3
[]
no_license
import numpy as np import matplotlib.pyplot as plt import pandas as pd dataset = pd.read_csv("Mall_Customers.csv") x= dataset.iloc[: , [3,4]].values import scipy.cluster.hierarchy as sch dendrogram = sch.dendrogram(sch.linkage(x, method="ward")) plt.title("Dendrogram") plt.show() from sklearn.clust...
true
b3b38411aa2c847cb97cd703cd64a886aa25ca0f
GoingMyWay/LeetCode
/151-reverse-words-in-a-string/solution.py
UTF-8
1,588
3.625
4
[]
no_license
class Solution: def trim_spaces(self, s: str) -> list: left, right = 0, len(s) - 1 # remove leading spaces while left <= right and s[left] == ' ': left += 1 # remove trailing spaces while left <= right and s[right] == ' ': right -= 1 ...
true
b1b163e6a748057f4251ee5c41cb4bcb008791cf
devlulcas/solved-URI-algorithms
/RANDOM/1072.py
UTF-8
210
4.15625
4
[]
no_license
#URI 1072 - INTERVAL 2 n = int(input()) n_in = 0 n_out = 0 for i in range(n): x = int(input()) if x>=10 and x<=20: n_in += 1 else: n_out += 1 print(f"{n_in} in") print(f"{n_out} out")
true
964764be435539a206367fddf8e5cc213ae6b313
Audarya07/Daily-Flash-Codes
/Week10/Day1/Solutions/Python/prog5.py
UTF-8
734
4.09375
4
[]
no_license
n = int(input("Enter value n:")) print("Enter the numbers:",end=" ") nums = [int(i) for i in input().split()][:n] print("Choose operation:\n1. Calculate average\n2.Calculate variance\n3.Calculate standard deviation") conti = "y" part = 0 for i in nums: part += (i-(sum(nums)/n))**2 while conti == "y": choice...
true
8ea668d89d9b728d4730031ba7e3313dee3b32a5
sachinvarriar/ditk
/extraction/named_entity/gcn-ner/gcn_ner/__init__.py
UTF-8
4,653
2.765625
3
[]
no_license
#!/usr/bin/python # -*- coding: utf-8 -*- import numpy as np import pickle import random import sys import logging import gcn_ner.utils as utils from gcn_ner.ner_model import GCNNerModel class GCNNer: _logger = logging.getLogger(__name__) def __init__(self, ner_filename, trans_prob_file): self._ner...
true
f9b0ef00425f66e4e31060da49b93c65e734d382
werkaj/pythonLessons
/zadanie10_4.py
UTF-8
1,347
3.84375
4
[]
no_license
#10.4 class Queue: def __init__(self, size=5): self.n = size + 1 # faktyczny rozmiar tablicy self.items = self.n * [None] self.head = 0 # pierwszy do pobrania self.tail = 0 # pierwsze wolne def is_empty(self): return self.head == ...
true
ab706351b1b1baac09ac012fbce701b3bb95129d
LyricLy/Discord-Selfbot-Cogs
/tatsumaki.py
UTF-8
7,315
2.703125
3
[]
no_license
import discord, asyncio, re, random from discord.ext import commands from cogs.utils.checks import * from datetime import datetime, timedelta class tatsumaki: active = True text = ['To confirm, type `' , '➡ | Tippe `'] balancetext = ['balance of', '**, **dein Guthaben beträgt 💴 '] reptext = [', **yo...
true
6ed038bc93d154194238a33800b3bba70c0c0d97
XiaoxiaoWang87/sample_estimator
/sample_size_estimator.py
UTF-8
7,774
2.8125
3
[]
no_license
import sys import os import operator import copy import re import numpy as np import pandas as pd from scipy import stats import matplotlib.pyplot as plt import matplotlib.gridspec as gridspec from collections import defaultdict class Power_Estimator(object): def __init__(self, N, ctrl_frac, trt_frac, ctrl_ef...
true
7e818b4dd5f356738fd2fde092ce0676d6c2a7db
IamRiddhi/Competitve-Coding
/Greedy/Beautiful Pairs Hackerrank.py
UTF-8
401
3.03125
3
[]
no_license
n = int(input()) a = list(map(int,input().split())) b = list(map(int,input().split())) freqb = {} for i in range(n): x = b[i] if x not in freqb: freqb[x] = 1 else: freqb[x] += 1 ache = 0 count1 = -1 for i in range(n): x = a[i] if x in freqb and freqb[x]>0: ach...
true
a8262ff245fc52f768071bd08f4e83f5a1b909f8
arthurdouillard/distributed_memory_mpi
/distributed_memory/collector.py
UTF-8
5,539
2.671875
3
[]
no_license
"""This module implements a `Collector` which host a subset of the distributed memory.""" import time import logging from mpi4py import MPI import dill from .tags import Tags from .logger import log class Collector: def __init__(self): self.comm = MPI.COMM_WORLD self.rank = self.comm.Get_rank()...
true
e8d332f14aa009e4d9bfd63f0b95acc148e329e5
Naganandhinisri/python-beginner
/day-3 assignments/word wrap.py
UTF-8
160
3.296875
3
[]
no_license
def wrap_word(word): for i in range(0, len(word)): word = word[1:] + word[0] print(word) wrap_word("hello") wrap_word("") wrap_word(" ")
true
8b16d85101b28d0cdae284ad84f8841ff3acb57f
ssydyc/Leetcode_python
/Spiral_matrix_II.py
UTF-8
895
3.5
4
[]
no_license
class Solution: # @return a list of lists of integer def generateMatrix(self, n): matrix=[[0 for i in range(n)] for j in range(n)] # generate n*n matrix if n==0: return [] cur_x=0 #starting point cur_y=-1 value=0 while n>0: #go to right for...
true
3b22820da3f83d9c5414e88eee0f00a2b158a172
z47288/selfteaching-python-camp
/exercises/1901100305/1001S02E04_control_flow.py
UTF-8
527
3.953125
4
[]
no_license
#while循环九九乘法表 n = 1 while n<10: for i in range(1,n+1): print(n,'*',i,'=',i*n, sep='',end='\t') print() n=n+1 # for九九乘法表 for i in range(1, 10): for j in range(1, i + 1): if i % 2 == 0: print(i, '×', j, '=', i * j, end='\t', sep='') print() #while循环去偶数行 i = 1 while i <...
true
d0c407e9bdad7d91d1a8a34ed79f6abe25ef0467
breeze0908/codeTree
/Python/learn/momentum_wallpaper_down.py
UTF-8
2,569
2.765625
3
[]
no_license
#! /usr/bin/python # encoding=utf-8 """ @desc 下载momentum中的精美壁纸 @api https://d3cbihxaqsuq0s.cloudfront.net/ @author Tan <tandamailzone@gmail.com> """ import requests import re import os import urllib import xml.dom.minidom def download(url, path = ''): name = url.split('/')[-1:-2:-1] path = path if path...
true
1a1ccca0a89aef6bdcf079145dfad4b5e258b5f5
UKA-SHA/Python-problems-Practice
/10_pr_5_count_tuple.py
UTF-8
118
3.609375
4
[]
no_license
#write a program to count the numbers of zeros in the following tuple: tup1 = (7,0,8,0,0,9) print(tup1.count(0))
true
589936d933e7a89a849e8c8bbec97f29ec198e22
gorgoroth666/Projects
/CodeEval/Challenge Solutions/easy/Python/100_even_numbers.py
UTF-8
359
3.109375
3
[]
no_license
import sys import math def is_even(n): return 1 if n % 2 == 0 else 0 if len(sys.argv) <= 1: exit(0) test_cases = open(sys.argv[1], 'r') l = [] for test in test_cases: test = test.strip("\n") test = test.strip(" ") if test == "": continue l.append(test) test_cases.close() ...
true
467d57a292dca741cc320820a18365e385b87d88
D4id4los/Python-Graph-Grammar
/model_gen/grammar.py
UTF-8
8,097
2.9375
3
[]
no_license
import random from typing import List, TypeVar, Tuple from timeit import default_timer as timer from model_gen.utils import * from model_gen.graph import get_generations, copy_without_meta_elements from model_gen.productions import * log = get_logger('model_gen.' + __name__) T = TypeVar('T') class Grammar: """...
true
cdc4386b843e20672e2fd5d336b340a3adc06bfb
bvernot/freezing-archer
/bin/test_tables.py
UTF-8
673
3
3
[]
no_license
import sys, random import time start_time = time.time() check_time = start_time a = {} dim = 1000 print "setting up %d arrays" % (dim*dim) for i in range(dim): a[i] = {} for j in range(dim): a[i][j] = [] pass pass t = time.time() print t-start_time, t-check_time check_time = t print...
true
6c059d88ed21b814ee7a51c973f95bab738fbf73
AIndoria/Gooey
/gooey/tests/modules_unittest.py
UTF-8
267
2.5625
3
[ "MIT" ]
permissive
from gooey.python_bindings import modules module_source = \ ''' some_var = 1234 def fooey(): return 10 ''' def test_load_creates_and_imports_module_from_string_source(): module = modules.load(module_source) assert 10 == module.fooey()
true
7d65fc5b9ce1109b118325b85509969778a06728
kishorevasan/accidents-in-india
/accidents_india.py
UTF-8
1,333
3.40625
3
[ "MIT" ]
permissive
import csv as csv import numpy as np import matplotlib.pyplot as plt print '----DATA INCOMING---' f= open('timeofacc.csv','r') f_obj = csv.reader(f) header = f_obj.next() data = [] #downloading data from file for row in f_obj: data.append(row) #arranging the accidents count in ascending order ...
true
f77f048a61b176beaa32874280d966d8fb27e1e8
matejbasic/recommenders-playground
/recommenders/assoc_alt.py
UTF-8
9,074
2.921875
3
[]
no_license
from itertools import combinations from itertools import izip_longest from operator import itemgetter from recommender import RecommenderBase from pi import PopularItemsRecommender import numpy as np class AssociationRecommender(RecommenderBase): def __init__(self, orders = None, items = None, orders_items = Non...
true
cd9e9fde06ab91fdf21633253235d6e5f10d9d7a
harryli99/HW-13
/app.py
UTF-8
3,322
2.875
3
[]
no_license
# Import Dependencies from flask import (Flask, render_template, jsonify, request) import pandas as pd app = Flask(__name__) # Flask routes @app.route("/") def home(): return render_template('index.html') @app.route('/names') def get_name_list(): # Read from the metadata csv file bb_metadata_df = pd.read...
true
a52952aefc8dba5942978d0f0db0ff34febb210f
bijob89/TokenEditor
/StatusBar.py
UTF-8
1,024
2.890625
3
[ "MIT" ]
permissive
#!/usr/bin/python # -*- coding: utf-8 -*- from Tkinter import * class StatusBar(Frame): def __init__(self, parent, ProgressBar=1): Frame.__init__(self, parent) # Zweitgeteilt: links der Statustext, rechts der Inikatortext # und dann evtl. noch der ProgressBar self.status1 ...
true
ee075ad18079d53ca6309ba78b0c0df3b057092d
anjmhrjn/python-s-prgram
/python16.py
UTF-8
1,123
3.9375
4
[]
no_license
# info={'rollno':[1,2,3,4,5], 'name':['Shahil','Anuj','Saurav','Bishnu','Hari']} # info.update({'grade':['A','B','C','A','A']}) # print(info) # a={'Anuj':1,'Bishnu':2} # b={'Sanjay':3} # a.update(b) # print(a) #to merge multiple no. of dictionaries using loop # dic1={'no1':10,'no2':20} # dic2={'no3':10,'no4':20} # di...
true
80716702cfa8031d811f5654d83f6e10dc3958fb
fastlane-queue/fastlane
/tests/func/test_update_details.py
UTF-8
1,441
2.546875
3
[ "MIT" ]
permissive
# Standard Library import calendar from datetime import datetime from json import loads from uuid import uuid4 # 3rd Party from preggy import expect import tests.func.base # NOQA isort:skip pylint:disable=unused-import def test_update1(client): """ Given API and Worker are UP When I update a job's deta...
true
60531d25a29fbef1b77836c687870398d4fdfdd4
red010182/foody
/no_use/updateDB.py
UTF-8
3,390
2.765625
3
[]
no_license
#!/usr/bin/python # -*- coding: utf-8 -*- import requests import time import cPickle as pickle import sys import sqlite3 import MySQLdb from collections import OrderedDict from multiprocessing import Pool, Process, Queue import ConfigParser class Worker(Process): def __init__(self, queue,patchNumber): su...
true
37ca99b0636da88157baca4abc3f7b27b764d8f9
qhrong/Leetcode
/Max Pop.py
UTF-8
1,044
3.71875
4
[]
no_license
class MaxStack: def __init__(self): """ initialize your data structure here. """ self.stk = [] self.maxstk= [] def push(self, x: int) -> None: self.stk.append(x) if not self.maxstk: self.maxstk.append(x) else: self.maxs...
true
136ead6d7adf3739d99f0bc40fcd9e37e3975214
ivinu/CollegeWork
/Python and System Utillities Lab/Dictionaries/dictionary10.py
UTF-8
59
2.65625
3
[]
no_license
string = "{'1':1, '2':2, '3':3}" d = eval(string) print(d)
true
689603a832de82e5708086be3971ce6c21ccc0f6
hoppe93/latexpack
/latexpacker.py
UTF-8
1,699
2.859375
3
[]
no_license
#!/usr/bin/env python3 import argparse import pathlib import shutil import sys import time import parse def pack(root, output, copybbl): """ Pack the LaTeX document with root document 'root' into the directory 'output'. """ root = pathlib.Path(root).absolute().resolve() rootdir = pathli...
true
cd8cedbfce61836520d7087f2035112a2b77a7f6
hankeping/nn
/cnn_mnist.py
UTF-8
4,746
2.71875
3
[]
no_license
#coding=utf-8 '''简单的CNN''' from tensorflow.examples.tutorials.mnist import input_data import tensorflow as tf max_steps=20000 dropout=0.5 data_dir='./mnist_NN/input_data' log_dir='./mnist_NN/logs/mnist_with_summaries' mnist=input_data.read_data_sets(data_dir,one_hot=True) sess=tf.InteractiveSession() #初始化函数,以便重复使用 de...
true
996af23403444e105b463055f814439adc292c39
VeritasOS/krankshaft
/krankshaft/throttle.py
UTF-8
8,149
2.625
3
[ "MIT" ]
permissive
import time class Throttle(object): ''' Throttle requests based on authenticated client and a specified rate. The rate consists of the number of requests for a specific time period. rate = (number requests, time window/timedelta/seconds) ie: rate = (1000, timedelta(minutes=60)) ...
true
c11a53a015268cf9853612b7abef1b20390bafec
alexmooc2/emusic
/genius.py
UTF-8
2,445
2.546875
3
[]
no_license
import urllib, urllib2, json, webbrowser import keys import tone import re import jinja2 import os import logging from bs4 import BeautifulSoup import requests from requests.structures import CaseInsensitiveDict # from google.appengine.api import urlfetch import genius_key from difflib import SequenceMatcher class Tr...
true
6b9c85f8fad646b85aa0d0319331458264d5397a
LaureBerti/Learn2Clean
/python-package/learn2clean/loading/reader.py
UTF-8
24,977
2.859375
3
[ "BSD-3-Clause" ]
permissive
#!/usr/bin/env python3 # coding: utf-8 # Author:Laure Berti-Equille <laure.berti@ird.fr> import pickle import os import time import numpy as np import pandas as pd from sklearn.preprocessing import LabelEncoder from joblib import Parallel, delayed import seaborn as sns import matplotlib.pyplot as plt from scipy.stats ...
true
45a95844842556394010b909f9f35c53157f1b70
bszelag/breast-cancer-classification
/backend/src/classificators/naive_bayes.py
UTF-8
519
2.625
3
[]
no_license
from sklearn.naive_bayes import GaussianNB from sklearn.naive_bayes import MultinomialNB model = None mask_ = None def train_model(data, target, mask, **kwargs): global model global mask_ mask_ = mask if kwargs is not None and "dist" in kwargs and kwargs["dist"] == "MultinominalNB": model ...
true
3c902a865455c9c1a2ad52b691d3835f4c4d1c88
moisesgomez00/AED
/Unidad_1/CVSMain.py
UTF-8
335
2.96875
3
[]
no_license
#-*- coding: utf-8 -*- """ crear un programa en python que genere un contenido CSV. con un número de filas aleatorio donde cada fila tiene columas aleatorias. use TDA's """ from CVSRandom import * CSVInstance = CSV() content = CSVInstance.generateRandomCSV() print(content) f = open("csv.csv","w") f.write(cont...
true
8ab735ddf58be601536dcec036397ebf8d351152
SimonLammer/hackerrank
/Algorithms/02 Implementation/03 Kangaroo/Kangaroo.py
UTF-8
481
3.359375
3
[ "MIT" ]
permissive
#!/bin/python # https://www.hackerrank.com/challenges/kangaroo import sys x1,v1,x2,v2 = raw_input().strip().split(' ') x1,v1,x2,v2 = [int(x1),int(v1),int(x2),int(v2)] ''' x1 + t * v1 = x2 + t * v2 t * v1 - t * v2 = x2 - x1 t * (v1 - v2) = x2 - x1 t = (x2 - x1) / (v1 - v2) ''' if v1 == v2: if x1 == x2: p...
true
5b9511733c75e673b4393dec1ac6c0744c8922e0
logachev/custom-azure-data-encryption
/azure_encryption_helper/aeskeywrapper.py
UTF-8
2,861
2.75
3
[ "MIT", "LicenseRef-scancode-generic-cla" ]
permissive
from azure.keyvault import KeyVaultClient from cryptography.hazmat.backends import default_backend from cryptography.hazmat.primitives.asymmetric import padding from cryptography.hazmat.primitives.asymmetric.rsa import RSAPublicNumbers from cryptography.hazmat.primitives import hashes class AESKeyWrapper: """ Wra...
true
903b09b3d04af47fd45e6040997d248f67875251
amashhour1974/co2-emissions-calc
/src/extract_number.py
UTF-8
225
3.4375
3
[]
no_license
def extract_number(s): tmp = s.split(" ") # if the number exceeds 999, remove commas from number tmp2 = tmp[0].replace(",","") try: number = float(tmp2) except: return -1 return number
true
b3202ccb65cc1eeaa584f97f47407fa50e9ba8f3
ChenSun-YP/2048_NEAT
/game/utils.py
UTF-8
2,110
3.359375
3
[]
no_license
from enum import Enum # Enums to keep things persistence class State(Enum): MENU = "menu" IDLE = "idle" SHIFTING = "shifting" WIN = "win" LOSS = "loss" class Key(Enum): UP = "W" DOWN = "S" LEFT = "A" RIGHT = "D" RESTART = "R" BACK = "B" ENTER = "Enter" class Directio...
true
385e99b95a6efba1183e8696126936ca2fa0f163
podhmo/individual-sandbox
/daily/20201104/example_pydantic/00dict.py
UTF-8
389
2.578125
3
[]
no_license
from __future__ import annotations import typing as t import json from pydantic import BaseModel from pydantic.schema import schema class Person(BaseModel): name: str age: int data: t.Dict[str, str] nested_data: t.Dict[str, t.Dict[str, str]] count: t.Dict[int, int] toplevel_schema = schema([Perso...
true
4162059b5c05ea6b8b966a6721da1185f98a2bf4
PacktPublishing/Mastering-Python-for-Networking-and-Security-Second-Edition
/chapter6/dnspython/dns_python_records.py
UTF-8
644
3.03125
3
[ "MIT" ]
permissive
import dns.resolver def main(domain): records = ['A','AAAA','NS','SOA','MX','TXT'] for record in records: try: responses = dns.resolver.query(domain, record) print("\nRecord response ",record) print("-----------------------------------") for resp...
true
9f2548b7a1cd674f810c604cc1ed01207709692f
andresmao23/misionTIC-Uninorte
/reto5-CORRECTO100PORCIENTO.py
UTF-8
2,383
3.15625
3
[]
no_license
import operator matriz = [] def quitar_contador_cero(d): keys = [k for k, v in d.items() if v == 0] for x in keys: del d[x] return d with open('data.csv','rt',encoding='utf8') as f: f.readline() for linea in f: datos = linea.replace('\n','').split(',') matriz.a...
true