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
17ebd003517f673443743d5b472ace179f3be6b0
tienshen/CS589
/hw3/Submission/Code/Template_Stacking.py
UTF-8
1,604
3.28125
3
[]
no_license
# -*- coding: utf-8 -*- import numpy as np import matplotlib.pyplot as plt from sklearn.ensemble import RandomForestClassifier from sklearn.ensemble import StackingClassifier from sklearn.ensemble import AdaBoostClassifier from sklearn.tree import DecisionTreeClassifier import pandas as pd from sklearn import metrics ...
true
ab8252a9719d647a50ba68fe211b8f4d7b9acc44
Lehcs-py/guppe
/Seção_05/Exercício_29.py
UTF-8
1,694
4.375
4
[]
no_license
print(""" 29. Faça uma prova de matemática para crianças que estão aprendendo A somar números inteiros menores do que 100. Escolha números aleatórios entre 1 e 100, e mostre na tela A pergunta: Qual é A soma de A + B, onde A e B são números aleatórios entre 1 e 100, e mostre na tela A pergunta: qual é A soma de A + ...
true
a3ed36e4bdedfb614019876ac85e1071883a9625
grayreaper/pythonProgrammingTextbook
/feetToMilesConvert.py
UTF-8
333
4.1875
4
[]
no_license
# feetToMilesConvert.py # This program converts feet to miles # BY: Gray Reaper def main(): print("This Program converts a distance in feet to miles") feet = eval(input("Enter the distance in feet: ")) miles = feet / 5280 print("The distance in miles is", miles) input("Press ENTER to e...
true
57d6fb2b961686eae6b905d38e515dbf1a7e6d45
Aasthaengg/IBMdataset
/Python_codes/p03078/s630230423.py
UTF-8
844
3.265625
3
[]
no_license
# Python3 (3.4.3) import sys input = sys.stdin.readline # ------------------------------------------------------------- # function # ------------------------------------------------------------- # ------------------------------------------------------------- # main # -------------------------------------------------...
true
816380bb0d5da23ab5597fd52728cad2843f4428
mpucci92/NewsDiscoveryOld
/GenerateDataset.py
UTF-8
2,364
2.828125
3
[]
no_license
# FINAL # import pandas as pd class GenerateDataset: """ Class used to generate dataframe based on a particular ElasticSearch Query """ def __init__(self, index): self.index = index.lower() self.tweetColumns = [ 'name', 'tweet', 'c...
true
c6af9aebda5f5e0b9f659037083d77838363da56
befallenStar/python
/demo/sjh_logging/demo58.py
UTF-8
1,183
2.765625
3
[]
no_license
# -*- encoding: utf-8 -*- import getpass import logging class TextLoggingHandler(object): def __init__(self): self.filename = "loghandler.txt" self.format = logging.Formatter( "%(asctime)-12s %(levelname)-8s %(name)-10s %(message)-12s") # 获取logger对象 self.logger = loggin...
true
229117e36abc7c6f26635f43727b51dc4a2b1871
debsankha/piecewise-smooth
/pws/ins100.py
UTF-8
112
2.8125
3
[]
no_license
i=0 while True: try: line=raw_input() i+=1 print line if i==100: i=0 print except: break
true
3fc1ff02f41c3d6b5946a3ca4b8b639a0d242945
thiagofernandocosta/automated-access-management
/tools/aws/_ses.py
UTF-8
973
2.546875
3
[]
no_license
import os import boto3 import sys import logging logging.basicConfig(level=logging.DEBUG) def verify_ses(): logging.debug('Send email to verify on SES') # is still in the sandbox, this address must be verified. recipient = os.environ.get('EMAIL') # AWS Region you're using for Amazon SES. aws_regio...
true
e04e0d3d4be587107727d6c1387d04ff43922145
SirajChokshi/investor-sentiment-analysis
/StockPricePuller/puller.py
UTF-8
688
3.046875
3
[]
no_license
import http.client import json def stockPrice(symbol): conn = http.client.HTTPSConnection("apidojo-yahoo-finance-v1.p.rapidapi.com") headers = { 'x-rapidapi-host': "apidojo-yahoo-finance-v1.p.rapidapi.com", 'x-rapidapi-key': "8c5526adc2msh39597ddd562bfbbp123143jsn6a803ee93095" } u...
true
78e1234202cfc763fbc41edb78f345b734a711c3
jieming514/py_workspace
/socket_server.py
UTF-8
501
2.828125
3
[]
no_license
# 导入模块 import socket # 创建实例 sk = socket.socket() # 定义IP和端口 ip_port = ('127.0.0.1', 8888) sk.bind(ip_port) # 设置最大监听数 sk.listen(5) while True: print("runing...") conn, address = sk.accept() msg = "你好" conn.send(msg.encode()) while True: data = conn.recv(1024) print(data.decode()) ...
true
ee4254baa0e2424c54dc266bc92ed94acffae4e7
ananya/HackerSkills
/Solutions/AK-007/Task3/web.py
UTF-8
395
2.796875
3
[]
no_license
from urllib.request import urlopen from bs4 import BeautifulSoup web="https://scirate.com/" page=urlopen(web) soup=BeautifulSoup(page,"html.parser") all_names=soup.find_all('div',attrs={'class' : 'title'}) all_links=soup.find_all('a',attrs={'title':'Download PDF'}) i=0 for name in all_names: print('Name = '+name.t...
true
069f7e11a590c3808c01e6a1f68a64186d1744de
Zaka/muia-tfm-neuralnet
/wrapper-fss-over-rnn.py
UTF-8
6,221
2.625
3
[]
no_license
import sys import pdb import time import numpy as np np.random.seed(9000) import pandas as pd from keras.models import Sequential from keras.layers import Dense, Activation, Reshape from keras.layers.recurrent import SimpleRNN, LSTM from keras.wrappers.scikit_learn import KerasRegressor from keras.regularizers import...
true
ee653eecdeb86ec60e8b4c746151b4550dbd5502
twardoch/markdown-steroids
/mdx_steroids/comments.py
UTF-8
3,456
3.09375
3
[ "BSD-3-Clause" ]
permissive
#!/usr/bin/env python # -*- coding: utf-8 -*- """ # mdx_steroids.comments The `mdx_steroids.comments` ignores HTML comments opened by three dashes and any whitespace prior to them. I believe pandoc has similar functionality. Based on code © 2015 by ryneeverett (https://github.com/ryneeverett/python-markdown-comments...
true
c68fefa69a0a20c4198d53832e1c224b840ad079
zhangboyang/PAL3patch
/extra/common/musicpatch/compare.py
UTF-8
1,866
2.625
3
[]
no_license
import librosa from numpy.linalg import norm #import dtw import fastdtw import numpy import pickle SAMPLE_OFFSET = 10.0 SAMPLE_LEN = 10.0 SAMPLE_RATE = 44100 # use these shell command to generate file list # find candidate/ -type f | sort > candidate.txt # find original/ -type f | sort > original...
true
be0eddce9f728a603e14cbeabfe9577e0c128efb
fenglihanxiao/Python
/Module01_CZ/day5_inheritance/04-代码/day5/91_多态.py
UTF-8
560
3.6875
4
[ "MIT" ]
permissive
""" 演示多态 """ class Teacher: def teach(self): print("教授知识") class Driver: def drive(self): print("开车") class Man(Teacher,Driver): def teach(self): print("教授Python知识") def drive(self): print("开小轿车") class Demo: def play(self,driver): driver.drive() def s...
true
18b26a739d0c7847f8d34954ad849f4ab12b1d49
EconomistGrant/2021_Spring
/6.006 Algo/ass/ass4/PatientDatabase.py
UTF-8
17,080
3.78125
4
[]
no_license
##################################### ##### PLEASE DO NOT MODIFY THIS CODE ##################################### class BST: def __init__(self, item = None, parent = None): "Initialize a BST node" self.item = item self.parent = parent self.left = None self.right ...
true
c8e30dc43818e530910b5a39b49a452fc71c5d08
Ritesh-FSD/Notepad
/Notepad.py
UTF-8
3,473
2.84375
3
[]
no_license
from tkinter import * from tkinter.messagebox import showinfo from tkinter.filedialog import askopenfilename,asksaveasfilename import os if __name__ == '__main__': root= Tk() root.title("Notpad") root.geometry("600x799") def newFile(): global file root.title("Untitled - Not...
true
b39f86841fb0f73461f3f33c0cc3adfba9628a49
RohanBhirangi/Sensor-Unit-Testing
/Accelerometer/code/ut_accelerometer.py
UTF-8
5,931
2.609375
3
[]
no_license
""" This python script performs all necessary seash commands required to run a repy script on the smartphone.. The main goal is to automate the entire seash process (loadkeys, browse, add, upload, execute) using this python script. So that the user just has to run this single program to test the sensor api calls. If ...
true
75f1cd40da6bf8c670bfac760d1555a017bdc13c
Pingul/cern
/verify_cmotors/coll_funcs.py
UTF-8
7,972
2.9375
3
[]
no_license
import numpy as np import pytimber import os import pickle from collections import namedtuple from scipy import interpolate class CollTrimVMap: """ Maps a variable from Timber to a Trim variable """ fillVars = np.array([ "t", "MEAS_MOTOR_LD", "MEAS_MOTOR_RD", "MEAS_MOTOR_LU", ...
true
7b71fc83a2d76ca90f5d421e965a4596be88dadf
hayleymathews/data_structures_and_algorithms
/Deques/array_deque.py
UTF-8
1,186
4.125
4
[]
no_license
"""python implementation of ADT Deque with python list (which is really a dynamic array)""" from Deques._deque_abstract import Deque class ArrayDeque(Deque): """ implementing ADT Deque """ def __init__(self): self.items = [] def __len__(self): return len(self.items) def __ite...
true
b656cc6cb09639d281de51c26b73435f77b524c7
o-aleoli/nma_presentation
/floats/vacuum_tf/potential_plotter.py
UTF-8
1,918
2.53125
3
[]
no_license
#!/usr/bin/env python3 import pandas as pd import numpy as np import matplotlib.pyplot as plt from matplotlib.lines import Line2D from matplotlib.backends.backend_pgf import PdfPages output_file = 'x_potential' width = (160 - 15) - 10 height = 55 potential_x = pd.read_csv( 'pot_x.dat', sep = ' ', header =...
true
abf1985a3c8550b6066f9b60955153f4a9594c70
ananya-samal/optimal-sequence-generator
/Task_1_a_seriesgeneration_userinput_v_1_0.py
UTF-8
1,942
4.5
4
[]
no_license
''' @AUTHOR: Ananya Samal @NAME: Task_1_a_seriesgeneration_userinput_v_1_0.py Task a :- a) Implement a program to calculate the number of steps to reach 1 thefirst time for any given m€N. Description: 1- Generate a math sequence which ends with 1,4,2 for any given number taken as a input from user. 2- Find the ...
true
8030c1c14e97acbc9f56618df28cfd67cf06fa8c
JKobyP/perm
/src/perm.py
UTF-8
3,147
2.8125
3
[]
no_license
#!/bin/python3 import graph import kinase import analysis import disease import modularity from optparse import OptionParser def readPPI(filename, thresh): f = open(filename, 'r') o = f.readlines() return parsePPI(o, thresh), o def parsePPI(o, thresh): g = graph.Graph() for line1 in o: li...
true
28187f1b238ff65ddadb9a825ca4eefbe3101065
ishaaniwani/SpeechProcessor
/JESPY-DOA/test_vad.py
UTF-8
1,909
2.859375
3
[]
no_license
import numpy as np from scipy.io import wavfile from vad import VoiceActivityDetector from pydub import AudioSegment from xcorr import xcorr import math import speech_recognition as sr # Returns the start of speech of a wav file. If no speech is detected, then returns -1 def getSpeechStartTime(soundFileName): v ...
true
e69b804a2f1d9fe14e97fd9c549d5305a40d06fc
hagarnegm/Arabic-OCR
/src/LineSegmentation.py
UTF-8
477
2.609375
3
[]
no_license
from allimports import * def lineSegmentation(image): segments = [] indices=[] start = 0 end = 0 state = 0 for i in range(image.shape[0]): if sum(image[i, :]) > 0 and state == 0: start = i state = 1 elif sum(image[i, :]) == 0 and state == 1: ...
true
53a5705c9feb5734fe5f78e9cd6a8a7fbf847e4e
frederico-prog/python
/exerciciospython/EstruturaDeDecisao/atividade18.py
UTF-8
1,001
3.96875
4
[]
no_license
''' 18 - Faça um Programa que peça uma data no formato dd/mm/aaaa e determine se a mesma é uma data válida. ''' import time data = str(input('Digite a data desejada no formato dd/mm/aaaa: ')).strip() dia = int(data[0:2]) mes = int(data[3:5]) ano = int(data[6:]) validade = True i = 0 print('Analisando....') time.slee...
true
a2c60e98d09cd0b69aae5c2218e1acc6e5aab7c8
guilhermebaos/Curso-em-Video-Python
/1_Python/Desafios/057_Sexo.py
UTF-8
376
3.671875
4
[ "MIT" ]
permissive
from termcolor import cprint, colored r = 'y' while r != 'M' and r != 'F': r = str(input(colored('Escreva o seu sexo (M/F): ', 'blue'))).upper() if r != 'M'and r != 'F': cprint('Por favor, escreva apenas "M" ou "F"', 'red', attrs=['underline']) if r == 'M': s = 'masculino' elif r == 'F': s = 'fe...
true
484245d131ab9b331fc1d234ea29664c13aaf500
charles-stan/learn_python_Stanier
/E1a_hello_world.py
UTF-8
675
3.125
3
[ "MIT" ]
permissive
""" Hello World Python Script Learning Example for Dr. Stanier's classes File: E1a_hello_world.py Author: Charles Stanier, charles-stanier@uiowa.edu Date: August 9, 2019 Written/Tested In: Python 3.7.3 Program Objective: Get students to open a python editor, write and save a script, choose a location for sa...
true
58ed8b133021f36eda1b1d1f816b26259fe773e5
xmichelleyang/MoeSearch
/classify.py
UTF-8
1,928
3.140625
3
[]
no_license
# import libraries import urllib2 from bs4 import BeautifulSoup from clarifai.rest import ClarifaiApp from clarifai.rest import Image as ClImage from pprint import pprint import numpy as np import pickle # specify the url quote_page = "http://www.crunchyroll.com/comics/manga" # query the website and return the html t...
true
458c075612116ccd42e5fd93246b701319befb70
uburuntu/rfdlife_bot
/utils/vacation.py
UTF-8
2,768
2.59375
3
[]
no_license
from datetime import datetime import requests from dateutil.relativedelta import relativedelta from pandas import DataFrame, read_html import tokens from utils.common_utils import TimeMemoize, bold, code, my_bot def _make_vacation_request(date): vacation_url = 'https://corp.rfdyn.ru/index.php/site/team-calendar...
true
6f041f8e20ad7ab9e37753d7df89e97333e7cb0d
leyuxuan1230/python
/Adapted-game-snake/game.py
UTF-8
6,128
2.96875
3
[]
no_license
from snake import * from map import * from hud import * from menu import * from chat import * from scene import * class Game: """ 游戏主题,一共有六个阶段:主菜单,关卡选择,对话场景,关卡显示场景,关卡进行,关卡结果场景 可以根据current_level来改变当前关卡,用于继续上次游戏 """ def __init__(self, current_level=0): self.snake_move_cycle = C...
true
cde04383bb8968994b8652ae2ff8a3e032735765
AnnapurnaThakur/python_code
/String/anustr5.py
UTF-8
98
2.984375
3
[]
no_license
# (vatical) a="My name is : Anu \v " b="My name is souvik " print(a) print(a) print(b) print(b)
true
bdbd0e01fe61768f76dd517761d1b65d67309da2
DDinCA/Byte-of-Python
/ds_reference.py
UTF-8
527
4.0625
4
[]
no_license
print('Simple Assignment') shoplist = ['apple', 'mango', 'carrot', 'banana'] mylist = shoplist #不论删除mylist还是shoplist,实际上两个是同一个序列,因此删掉之后两者输出的是一样的 del mylist[0] print('Shoplist is', shoplist) print('mylist is', mylist) print('Copy by making a full slice') mylist = shoplist[:] #因为是切片形成的列表,所以删掉拷贝出来的项不会影响原始...
true
1d2c34a5bdf0610043b86d59f12e996f785f64c4
xirdneh/imagify
/license/tests/models/test_plan.py
UTF-8
2,392
2.640625
3
[]
no_license
""" .. module: license.tests.models.test_plan :synopsis: Plan model tests. """ from __future__ import unicode_literals import unittest from license.models.plan import Plan from license.exceptions.plan import ( PlanTypeError, PlanUpgradeError, PlanDowngradeError, ) class TestPlanModel(unittest.TestCas...
true
1e449d75b5d9e9b22340cb08130f6a8a5a292eb9
chrissmiller/propaganda_analysis
/scripts/vectorization.py
UTF-8
5,557
2.859375
3
[]
no_license
''' Attempting more complex analysis on categories which are not prone to phrase detection Using Spacy's en_core_web_lg model for vector embeddings ''' import spacy import pickle import pandas as pd import numpy as np import xgboost as xgb import matplotlib.pyplot as plt from sklearn.preprocessing import StandardS...
true
0c1f4cd9cda9f2763cd1ce923073a024db113dc9
ZhiwenYang92/slicer-1
/slicer.py
UTF-8
7,510
3.234375
3
[]
no_license
#!/usr/bin/python from shapes import * from contour_fill import * from collections import defaultdict import copy import numpy as np # # begin file parsing into points and eventually triangles and then line segments # triangles = [] # this is the dict of perimeter lines; each key corresponds to a z-axis plane # and t...
true
87b7b4cd1d18b419edac620582a664ce1b28f582
ajaysgowda/adventofcode2020
/day_6/day_6.py
UTF-8
1,990
3.65625
4
[]
no_license
#%% from itertools import groupby def sep_to_grouped_list(lst: list, sep: str): """ seperate list to smaller groups based on separator :param lst: :param sep: :return: """ grouped_list = [] for k, g in groupby(lst, key=lambda x: x == sep): if not k: grouped_list.app...
true
0ab1e4ed42748547bf2a1fda73de381bb38e594e
Psrhiasrcoinlla/python
/set4.py
UTF-8
224
3.5625
4
[]
no_license
food=set(["ice cream","juice","chocolate","chips"]) print("\nprint the original set") print(food) print("\nupdating the original set") food.update(["juice","chocolate","chips"]) print("\nprint the modified set") print(food)
true
4fd15cf7975c9254cc9891e9fe3d53a4b70f307f
alkiviada/passe_feed
/populate_passe.py
UTF-8
3,676
2.671875
3
[]
no_license
#!/usr/bin/env python import os import sys import django import re os.environ.setdefault("DJANGO_SETTINGS_MODULE", "passefeed.settings") django.setup() from pdb_store import models from pdb_store.models import * from bs4 import BeautifulSoup, NavigableString import glob path = "../pdbs/dorothy_wordsworth/OEBPS/*.htm...
true
0f0a149ea3409baa663c4cdc4ed5646498cc022c
juyi212/Algorithm_study
/0825/회문2.py
UTF-8
1,180
3.078125
3
[]
no_license
import sys sys.stdin = open("s_input.txt", "r") def circle(li): count_li=[] for i in range(100): count = 0 for j in range(100): # 고정 r_new ='' for z in range(j,100): r_new += li[i][z] if r_new[0]==r_new[-1]: if r_new ==...
true
12bdf73f5b4b71c0c489f2f22eb01c42994e3c30
poojitha2002/The-Complete-FAANG-Preparation
/3]. Competitive Programming/08]. LeetCode/1]. Problems/Python/0007)_Reverse_Integer.py
UTF-8
330
3.25
3
[ "MIT" ]
permissive
class Solution: def reverse(self, x: int) -> int: negative = x<0 x = abs(x) reversed = 0 while x!= 0: reversed = reversed*10 + x%10 x //= 10 if reversed > 2**31-1: return 0 return reversed if not negative else...
true
ca03e9ffcde22370b58e0d56dcd5c706094b92fe
avanwinkle/masseffect2
/modes/mainmenu/code/mainmenu.py
UTF-8
7,178
2.890625
3
[]
no_license
import os, json from datetime import datetime from operator import itemgetter from mpf.modes.game.code.game import Game from mpf.modes.carousel.code.carousel import Carousel class MainMenu(Carousel): """ Mode which allows the player to select a profile and start/resume a game. """ def mode_init(self): super(...
true
3880c64f4e03691cd114223974e390ac7a32183b
jang010505/Algorithm
/BOJ/8718.py
UTF-8
129
2.921875
3
[]
no_license
a, b=map(int, input().split()) if a>=7*b: print(7000*b) elif 2*a>=7*b: print(3500*b) elif 4*a>=7*b: print(1750*b) else: print(0)
true
daf2e795b8b8259432fbe9a68f39071c87f0ebb6
nathan-heskia/bradfield-computer-networking
/pcapture_the_flag.py
UTF-8
2,943
2.75
3
[]
no_license
import pyshark from struct import unpack f = open('net.cap', 'rb') cap = pyshark.FileCapture('net.cap') per_file_header = f.read(24) num_packets = 0 tcp_data = {} packet_header = f.read(16) output_f = open('out', 'wb') while len(packet_header) != 0: packet_header = unpack('<IIII', packet_header) num_packets += ...
true
dac251feeb53b2a82fe1a843c925468c75f87f33
Abhishekkapoor007/assignment2-3
/assignment 3.py
UTF-8
611
3.203125
3
[]
no_license
#ques1 skrillex=['EDM','LEGEND','DUBSTEP','LEVEL'] print(skrillex) #ques2 Avicii=['google','apple','facebook','microsoft','tesla'] print(skrillex+Avicii) #ques3 number=[1,1,1,2,3,4] print(number.count(1)) #ques4 numbers=[1,2,3,6,5,4,7] numbers.sort() print(numbers) #ques5 list6=[] list1=[1,2,5,6,7] list2=[8,7,9,4] list...
true
63b69290bc62acba983068e6380ebb011ff5e313
gschen/where2go-python-test
/1200-常用算法/回溯算法/N皇后.py
UTF-8
973
3.40625
3
[]
no_license
N = 4 board = [['.' for i in range(N)] for j in range(N)] result = [] def is_valid(board, row, col): n = len(board) # 检查列 for i in range(n): if board[i][col] == 'Q': return False # 检查左上方 i = row - 1 j = col - 1 while i >= 0 and j >= 0: if board[i][j] == '...
true
ca56f9bd8b14ba9e8b304ccc3826921cffd2aaf1
Leonid-SV/LP
/LP_HomeWork/homework-1/ephem_bot.py
UTF-8
3,090
3.203125
3
[]
no_license
""" Домашнее задание №1 Использование библиотек: ephem * Установите модуль ephem + * Добавьте в бота команду /planet, которая будет принимать на вход название планеты на английском, например /planet Mars * В функции-обработчике команды из update.message.text получите название планеты (подсказка: используйте .sp...
true
db1d9ba57fd3fb7dd75367ee3f06d1751a617f43
LucasSantus/finances
/movimentacoes/models.py
UTF-8
2,511
2.59375
3
[]
no_license
from django.db import models, transaction class Tipo(models.IntegerChoices): RECEITA = 1, "Receita" DESPESA = 2, "Despesa" class Categoria(models.Model): nome = models.CharField( verbose_name = "Nome da categoria", max_length = 80, ) tipo = models.IntegerField( choices...
true
3f548ba0ec5a3f1d3b0f28b13104417f44946508
jefesaurus/hex_ai
/proto/proto_file_py_test.py
UTF-8
1,128
2.546875
3
[]
no_license
import unittest import tempfile from proto import proto_file from proto import test_pb2 class BinaryProtoTest(unittest.TestCase): def test_write(self): message = test_pb2.HelloProto() message.number = 5 message.vals.append(0) message.vals.append(1) message.vals.append(2) message.vals.append...
true
f33af1a15d9c4011e7496ff416052d7840fdc17b
yuannanchuan/yuannanchuan
/day13/多态(了解一下就行).py
UTF-8
574
4
4
[]
no_license
""" """ class People: def run(self): print("人类再跑") class Dog(People): def run(self): print("狗在跑") class Cat(People): def run(self): print("猫在跑") mycat = Cat() # 判断某一个对象,是否为类的一个实例 print(isinstance(mycat, Cat)) print(isinstance(mycat, People)) # 多态:父类类型 - 接受字类对象 # python没...
true
409cb886e805de7dbd93b68eb9297766444fe9ae
tmichaletzky/References
/Python/Games/guessMyNumber3short.py
UTF-8
345
3.90625
4
[]
no_license
import random print('Hello') name = input() print('Hello ' + name) sN = random.randint(1,20) for taken in range(1,7): print('Guess') guess = int(input()) if guess < sN: print('Low') elif guess > sN: print('High') else: break if guess == sN: print('Nice') else: pr...
true
75d04145f1a5c1965a16c18e3d79a0bc8baadf83
nagaatoo/NetGraph
/NetGraph.py
UTF-8
15,755
2.78125
3
[]
no_license
__author__ = 'nagatoo' import State, Work, FullPath, Optimizition, sys # Класс сетевого графика class NetGraph(): def __init__(self, StateCount): # StateCount - count состояний self.States = [] # Состояния сетевого графика self.Works = [] # Работы с.г. self.FullPaths = [] # ...
true
6c449a58508f91ee698e380db614c0e6f679faad
fstinner/linguee
/linguee2.py
UTF-8
3,856
2.859375
3
[]
no_license
# FR-EN translator using multiple methods import sys import os try: from urllib.request import urlopen except ImportError: from urllib2 import urlopen try: import simplejson as json except (ImportError): import json from urllib.parse import quote from bs4 import BeautifulSoup import string # from wikt...
true
92fbfc68cbcba2c80a82b503131f9ecc09938434
adwulet88/spotifypoem
/spotify.py
UTF-8
4,698
2.65625
3
[]
no_license
import urllib import urllib2 import threading as th import Queue import json import sys import redis import pdb server = redis.Redis() CACHE_EXPIRE = 60 * 10 SEARCH_API = r'http://ws.spotify.com/search/1/track.json' MAX_PAGES = 2 PARALLELIZATION = 5 def gen_queries(line): words = line.split() ...
true
059e606362f4421aa067a227d342b3eba9b6729d
kevinnjagi44/medicalOpenset
/Loss.py
UTF-8
867
2.6875
3
[]
no_license
import torch import torch.nn.functional as F import torch.nn as nn import pdb def _assert_no_grad(tensor): assert not tensor.requires_grad, \ "nn criterions don't compute the gradient w.r.t. targets - please " \ "mark these tensors as not requiring gradients" class GradLoss(nn.Module): def ...
true
c7d1e9ede08ae3fb093207e0cf1ca28eafb93a8e
djrobstep/schemainspect
/tests/test_triggers.py
UTF-8
1,751
2.625
3
[ "Unlicense" ]
permissive
from sqlbag import S from schemainspect import get_inspector BASE = """ CREATE TABLE "my_table" ( "some_text" text, "some_count" int ); CREATE VIEW "view_on_table" AS SELECT some_text, some_count FROM my_table; CREATE OR REPLACE FUNCTION my_function() RETURNS trigger LANGUAGE plpgsql AS $function$ ...
true
02250f395a72c91336bee7f642ba75b6161263f4
D0L0S/Analize
/ReportLine.py
UTF-8
2,295
2.828125
3
[]
no_license
#! /usr/bin/python # -*- coding: utf-8 -*- import datetime from datetime import date import pygal from pygal.style import DarkStyle year = date.today().year monthinteger = datetime.datetime.now().strftime("%m") month = datetime.date(1900, int(monthinteger), 1).strftime('%B') def chart1(fromDate, toDate, ffNumbers, c...
true
771861f979110ae57b1c620818c1001dd17fd1f9
dkhroad/fictional-barnacle
/p3/queue.py
UTF-8
416
3.390625
3
[]
no_license
from collections import deque class Queue: def __init__(self,size=None): if size == None: self.q = deque() else: self.q = deque(maxlen=size) def size(self): return self.q.maxlen def enq(self,value): self.q.appendleft(value) def deq(self): ...
true
b8d00d61c91e3c7e43ec79bdb92fb92c72b8578b
GIS90/python_base_use
/SortDemo/sort/xuanze.py
UTF-8
481
2.625
3
[]
no_license
# -*- coding: utf-8 -*- """ ------------------------------------------------ describe: 选择排序 ------------------------------------------------ """ __version__ = "v.10" __author__ = "PyGo" __time__ = "2017/3/1" def xuanze(l): count = len(l) for i in range(0, count): minloc = i ...
true
20d00a6b8d580dd631a2027f21c4b47021a834c8
alvinwang922/Data-Structures-and-Algorithms
/Arrays/Tree-Distribution.py
UTF-8
1,091
4.21875
4
[]
no_license
""" You want your island to have an equal distribution of all different types of trees, so your plan is to focus on planting trees with the smallest population first. Each specific type of tree will be given an int ID. For example, 1→ apples, 2→ pears, 3 → cherries, etc. Given an array of ints that represent the t...
true
ee809e394d42e2e36f10b18c6a92e6b66b363af4
oaken-source/noobcraft
/noobcraft/actors/actor.py
UTF-8
1,258
3.046875
3
[]
no_license
''' This module contains the abstract actor in the world of noobcraft. ''' class Actor(object): ''' This is the abstract actor class. All actors should inherit from it. ''' @property def name(self): ''' each actor needs a name - this property should produce it ''' ...
true
92f30ea96389a728c39b1d4a1a01c131aeca1024
ForeverQ/AUV_anaysis
/two_derivatives_PRI.py
UTF-8
10,557
2.625
3
[]
no_license
import numpy as np from my_regression import PolynomialRegressionInterval import pre_process as p_p import linear_regression as l_r import util as t_l import polynomial_regression_interval as p_r_i DEGREE_NOW = 6 DISPLAYED_CROSS_ZERO_NUM_1=10 DISPLAYED_CROSS_ZERO_NUM_2=10 NEAR_DISTANCE=0.01 def draw_d_and_d_interva...
true
c69163075924211a4fc14d23cac38ec78f832478
markschmidt42/nn-test
/tf-complex-model.py
UTF-8
3,003
2.625
3
[]
no_license
from __future__ import absolute_import, division, print_function, unicode_literals import sys import os.path import pathlib import matplotlib.pyplot as plt import seaborn as sns import pandas as pd import tensorflow as tf from tensorflow import keras from tensorflow.keras import layers import utils.pymark as pymark #...
true
dd4c0185c81e631e6abbd8957af9dce6846a95dc
leoriazuddin/python
/react-microservice/flask-app/consumer.py
UTF-8
1,378
2.53125
3
[]
no_license
import json from main import Product, db import pika params = pika.URLParameters('amqps://cgmvablb:dD6bpmk8AkEeox7FbwYCGqGp-9gaajL7@shark.rmq.cloudamqp.com/cgmvablb') connection = pika.BlockingConnection(params) channel = connection.channel() channel.queue_declare(queue='main') def main_callback(ch, method, prop...
true
9d687955b6fc0757a6af0741b9d06178b01fde5c
caef/MusicManagementTools
/MusicCatalogCreation/AlbumFileProcessor.py
UTF-8
2,084
3.109375
3
[]
no_license
""" Manager providing methods for for files containing albums and tracks """ from os import walk from GlobalClass import GlobalClass from DB.Album import Album class AlbumFileProcessor(): """ Provides methods to manage files and directories containg album songs """ def __init__(self): self.a...
true
e4952d1825b7aba5d1eaa54d482c29794145423e
abhaybd/discord-bot
/bot.py
UTF-8
9,771
3.015625
3
[ "MIT" ]
permissive
# Main Bot module # Import libraries import discord from datetime import datetime import sys from os.path import exists from os import makedirs # Redirect stderr to error log if not exists('error_logs'): makedirs('error_logs') sys.stderr = open('error_logs/{}.log'.format(datetime.now().strftime('%m-%d-%y_%I-%M'))...
true
9cb172df5d0560677243182b5b044fe09f1ef969
YuFu1998/Yu-Fu
/Test.py
UTF-8
9,344
2.765625
3
[]
no_license
import tkinter as tk from tkinter import ttk import urllib.request import ssl from lark import Lark from lark import Tree, Transformer, Visitor import operator from random import choice import random import numpy as np import matplotlib as mpl import matplotlib.pyplot as plt import networkx as nx number_Of_Net...
true
fd2e64efac2f51d79c6238a805629fe78afae59e
gauravaror/programming
/combinationSum_3rdOct.py
UTF-8
650
2.734375
3
[]
no_license
class Solution: def combinationSum(self, candidates: List[int], target: int) -> List[List[int]]: output = [] def backtrack(index, current, sum_): if index >= len(candidates): return if sum_ == target: output.append(current) ret...
true
8f9db713b27314fa4e11cbdf05fb5aab6ec99abc
hyunbeen/python--training
/tuple/sample1.py
UTF-8
278
3.625
4
[]
no_license
#tuple/sample1.py #튜플은 요소를 변경이 되지 않는다 t0 = (1,); print(type(t0)); #,가 들어가야 튜플 t1 = (1,2,'a','b') print(type(t1)); print(t1[0]); print(t1[0:2]); print(t1*2); print(len(t1)); print(1 in t1); print(t1[-1]); def add(a,b): return a+b;
true
4be8ee7306aa41eac8b1bd63ef36835effe4f779
Josuex09/spreads
/spreadsplug/autorotate.py
UTF-8
3,161
2.5625
3
[ "MIT" ]
permissive
# -*- coding: utf-8 -*- from __future__ import division import logging import os import wand.image from concurrent import futures from pexif import JpegFile from spreads.plugin import HookPlugin logger = logging.getLogger('spreadsplug.autorotate') def rotate_image(path, rotation): with wand.image.Image(filen...
true
af6603ee206595d0646690abdfcac5758bfbe30a
oostin623/FoodLog
/foodlog/resources/food_record_api.py
UTF-8
3,309
2.9375
3
[ "MIT" ]
permissive
""" food_record_api.py -api for food record resources """ from flask_restful import Resource, reqparse, fields, marshal from foodlog.common import data from foodlog.common.err import MyException class FoodRecordAPI(Resource): """ -api for interaction with food dictionary on an individual record ...
true
efe98976f86f8751167574b9277167e0868b6d99
aniruddhchandwankar/GITHUB
/CodeWithHarry/exercise7.py
UTF-8
2,005
3.328125
3
[]
no_license
# #Healthy programmer # # # 3.5 ltr water # # Water - play water.mp3,remind user to drink 200ml water each time. He should input drank # # a log will be generated in a text file # # 3.5 ltrs water in a day between 9AM to 5PM # # Eyes - eyes.mp3 # every 30 minutes, he should do eye exercise and input eyedone, generate...
true
9db42e5269b23928f12d1913cb6847b974b886ac
MIDHUnRaj647/DJANGO_PYTHON
/pythondatastrctr/listprgrms/listprgrm2.py
UTF-8
289
3.296875
3
[]
no_license
# limit=int(input('enter the limit')) # lst=lst() # for i in range(1,limit+1): # lst.append(i) # print(lst) limit=int(input('enter the limit')) lst1=list() lst2=list() for i in range(1,limit+1): if (i%2==0): lst1.append(i) else: lst2.append(i) print(lst1,lst2)
true
ae87ee07c5548101fc5270f638d1838c8d3b8c57
cyrustabatab/SpaceInvadersClassic
/potion.py
UTF-8
551
2.609375
3
[]
no_license
import pygame,os,random from item import Item class InvincibilityPotion(Item): name = 'potion' time_last = 10 @property def image_path(self): return os.path.join('assets','potion.png') @property def text(self): text = "PREVENT DAMAGE FOR 10 SECONDS" WHITE ...
true
4a550663ac9495c023b09fe8d97eff8bb1df64fc
lwxSTCX/leetcode
/数组/268_缺失数字(7.11).py
UTF-8
1,746
3.515625
4
[]
no_license
# class Solution(object): # def missingNumber(self, nums): # for i in range(len(nums)): # temp=sorted(nums) # if int(int(temp[i])+1) == int(temp[i+1]): # continue # else: # return temp[i]+1 # break # nums=[9,6,4,2,3...
true
e0823ff6f11f17008585fad54838a501822a0633
dr-dos-ok/Code_Jam_Webscraper
/solutions_python/Problem_84/314.py
UTF-8
1,287
2.859375
3
[]
no_license
import sys fin=open(sys.argv[1],'r') fout=open(sys.argv[2],'w') def solve(floor): for i in xrange(len(floor)): for j in xrange(len(floor[i])): if floor[i][j]=='#': if j+1 < len(floor[i]) and floor[i][j+1]=='#': if i+1 < len(floor): ...
true
0b4f96bce88ae2f90ce0bb6c0805e2e494456f36
JadeHayes/data-structures
/Basic-Data-Structures/discussion-questions.py
UTF-8
2,648
3.96875
4
[]
no_license
from binary import base_converter from Expressions import postfixEval # Convert the following values to binary using “divide by 2.” Show the stack of remainders. print(base_converter(17, 2)) print(base_converter(45, 2)) print(base_converter(96, 2)) """Convert the following infix expressions to prefix (use full paren...
true
56bea052c937ce96c58f989cd992062d3e028b8e
guangylegend/project-euler
/p65.py
UTF-8
577
3.0625
3
[]
no_license
import math p1 = [0 for i in range(1,105)] p2 = [0 for i in range(1,105)] def dsum(x): tsum=0 for c in str(x): tsum+=int(c) return tsum def cnt(x): tmp=(x-1)%3 if tmp==2: p1[1]=int((x/3)*2) else: p1[1]=1 p2[1]=1 for i in range(2,x): tmp1=p2[i-1] ...
true
4c6ec17aa70a1411c82a4cc1ddff3d0142eb02e0
Timothy-W-Hilton/STEMPyTools
/stem_pytools/domain.py
UTF-8
13,136
3.09375
3
[ "MIT" ]
permissive
"""a set of tools useful for parsing and returning descriptions of the STEM domain (grid cell longitude and latitude coordinates, grid cell vertical coordinates), and also for some domain-oriented calculations (is a point inside or outside of the domain, etc.) """ import os import os.path import matplotlib import nump...
true
23e7777785edc5c9d33769e48d8cb2550b7c18c8
AdminSDA/Lab212
/problem10.py
UTF-8
13,138
3.1875
3
[]
no_license
from problem import Problem import random from itertools import chain, combinations import collections class Problem10(Problem): def __init__(self): n = random.randint(8, 12) datagen = random.sample(range(12), n) nrPasiUnu = random.randint(2,4) nrPasiDoi = random.randint(2,4) ...
true
9dcaa92343a41ccd987d6f5a200990fd545fd9a1
zopefoundation/zope.index
/src/zope/index/interfaces.py
UTF-8
5,188
3.125
3
[ "ZPL-2.1" ]
permissive
############################################################################## # # Copyright (c) 2002 Zope Foundation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. # THIS SOF...
true
84d167c8859bb98c28459573cd3c531ae9188ae8
awinecki/python-bootcamp
/basic_data_structure_manipulation/data_structure.py
UTF-8
1,758
3.65625
4
[]
no_license
from random import randint from loops_and_conditional_statements.loops import loop_random_values, loop_range # 2.1: function that sorts the numbers generated in loops.loop_random_values in ascending order. def sort_random_values(): values = loop_random_values() values.sort() # in-place sorting ...
true
557b29a44b3e16c87ca7811f47b694282d16e544
luyuliu/transfer
/scr/mongodb/find_real_time.py
UTF-8
6,082
2.875
3
[]
no_license
''' This script will find the real-time arrival/departure time from the GTFS real-time feed. ''' import pymongo from datetime import timedelta, date import time import multiprocessing def convertSeconds(BTimeString): time = BTimeString.split(":") hours = int(time[0]) minutes = int(time[1]) seconds ...
true
5d1b2c43e1a60f2d1667291627e1c29e1517a030
crypto-code/Machine-Translation
/train.py
UTF-8
5,911
2.71875
3
[ "MIT" ]
permissive
# Making the necessary imports import tensorflow as tf import model import json import numpy as np import glob import argparse import os from keras.preprocessing.text import tokenizer_from_json # This will force execute tensorflow in eager execution mode tf.enable_eager_execution() parser = argparse.Argum...
true
1480a40562dcb772bc020318b3552ef885aeb430
anthonywritescode/aoc2019
/day12/part2.py
UTF-8
2,435
2.890625
3
[]
no_license
import argparse import math import re from typing import Dict from typing import List from typing import NamedTuple from typing import Tuple from support import timing INT_RE = re.compile(r'-?\d+') class Vector(NamedTuple): x: int y: int z: int def add(self, other: 'Vector') -> 'Vector': re...
true
d16e782c09f40e41f553ba031ce7d319c0d4031a
signegrau/imada-bot
/modules/testmodule.py
UTF-8
1,043
2.796875
3
[]
no_license
import asyncio from typing import Any import discord from command import Command from module import Module class TestModule(Module): def __init__(self): super(TestModule, self).__init__('test', 'Module for testing that stuff works', [], [ Command('test', 'getting number of messages sent by a...
true
cc43ea1fa1423d877aa3306521d7c43765da7229
philipchang/python
/tools/test/input.py
UTF-8
721
3.015625
3
[]
no_license
#! coding=utf-8 __date__ = '20160205' __author__ = 'changgy' ''' define add function ''' class Cpython(object): cnt = 0 def __init__(self, name): self.name = name def __input(self): list = [] print "please input interger" while True : a = raw_input() if a == '.': break list.appe...
true
0a0d0aa7466e2c3ab828e1e570815c280f8e28a0
greenfox-zerda-lasers/brigittaforrai
/week-04/day-04/05.py
UTF-8
507
4.125
4
[]
no_license
# 5. We have a number of bunnies and each bunny has two big floppy ears. # We want to compute the total number of ears across all the bunnies # recursively (without loops or multiplication). sum = 0 def bunnies(num): global sum ears = 2 if num < 1: print("there's no bunny, there's no ear") else:...
true
cec5291e2df199039d8ecdf442ec001dc391cfac
christopher-burke/warmups
/python/misc/intro_to_map_reduce_pattern.py
UTF-8
978
4.125
4
[ "MIT" ]
permissive
# !/usr/bin/env python3 """An Introduction to the Map-Reduce Pattern You will be implementing a basic case of the map-reduce pattern in programming. Given a vector stored as a list of integers, find the magnitude of the vector. Use the standard distance formula for n-dimensional Cartesian coordinates. Source: https:...
true
2fb5758f993b5ac58a506013f0d2da294caac665
Neil-Chakravarty/Phishing-Detection
/FIRST TRY.py
UTF-8
1,421
2.734375
3
[]
no_license
#!/usr/bin/env python # coding: utf-8 # In[1]: print("Hello") # In[2]: import pandas as pd import numpy as np # In[3]: df = pd.read_csv("C:/Users/chakr/Downloads/dataset_phishing.csv") df.head() # In[4]: df.describe() # In[5]: from sklearn.model_selection import train_test_split # In[6]: df.isnul...
true
e6d13aff9550235583a25b3d2135dcd0666f04f7
garg10may/hackerrank
/Search/icecream-parlor.py
UTF-8
2,696
3.59375
4
[]
no_license
''' Each time Sunny and Johnny take a trip to the Ice Cream Parlor, they pool together dollars for ice cream. On any given day, the parlor offers a line of flavors. Each flavor, , is numbered sequentially with a unique ID number from to and has a cost, , associated with it. Given the value of and the cost of each...
true
f87286ee2d55e9e271d9d1769381db8747b249b3
Sleentex/hebb_network
/lab5.py
UTF-8
2,066
3.5625
4
[]
no_license
# letter М X1 = ( 1, -1, -1, -1, -1, -1, 1, 1, 1, -1, -1, -1, 1, 1, 1, -1, 1, -1, 1, -1, 1, 1, -1, -1, 1, -1, -1, 1, 1, -1, -1, -1, -1, -1, 1, 1, -1, -1, -1, -1, -1, 1, 1, -1, -1, -1, -1, -1, 1, ) # letter К X2 = ( 1, -1, -1, -1, -1, 1, -1, 1, -1, -1, -1, 1, -1...
true
5f10fd16625c8972be87595f6119d953a6032e82
hozier/final.cmpsci383
/ttt_stable/main.py
UTF-8
1,850
2.796875
3
[ "MIT" ]
permissive
import sys import position import stewie def parse_command(instruction, bot, pos): if instruction.startswith('action move'): time = int(instruction.split(' ')[-1]) x, y = bot.get_move(pos, time) return 'place_move %d %d\n' % (x, y) elif instruction.startswith('update game field'): ...
true
bb6830125a61f329090c573beb13c47e6c0fb7fd
zhangchungame/crawler
/src/python/commonUtil.py
UTF-8
830
2.609375
3
[]
no_license
#coding:UTF-8 import time import threading class ThreadTimeOut(threading.Thread): threads=[] def run(self): # 定义每个线程要运行的函数 try: self.threadTimeOut() except Exception,e: print "commonUtil run "+e.message def __init__(self, threads): threading.Thread.__init_...
true
ffb68e8d9f333980869f0a323787ba3a6004ae21
dave31415/corona
/corona/fit_func.py
UTF-8
363
2.828125
3
[]
no_license
import numpy as np from scipy import stats def fit_func(x, y): xx = np.array(x) yy = np.array(y) y_log = np.log2(yy) slope, intercept, r_value, p_value, std_err = stats.linregress(xx, y_log) doubling_time = 1.0 / slope amplitude = 2.0 ** intercept y_fit = amplitude * 2**(xx/doubling_time) ...
true
1c6d6a445199f22fec4a49d3b9b64989c74f1e14
Aasthaengg/IBMdataset
/Python_codes/p03407/s023447647.py
UTF-8
72
2.90625
3
[]
no_license
a,b,c=map(int,input().split()) if c<=(a+b):print('Yes') else:print('No')
true
787f224b5254af979b6d26c291ae77b0c7d27438
arthurpoiffaut/Projet_3_epitaxial_NaCl_eq4
/code_jo_seaweed/Question-5.py
UTF-8
3,013
2.953125
3
[]
no_license
import numpy as np import matplotlib.pyplot as plt import time as time TempsI=time.clock()#Temps initial tabM=[5000]#Tableau pour différents nombre de marcheur plt.figure(4,figsize=(20,10)) for i in tabM:#Boucle pour tracer figure avec différent nombres de marcheurs plt.figure(1,figsize=(10,5)) N=256 #...
true
f53c9357d9f5cb48d108abb36b16d9094f3f9803
u98106/Python-learning-notebooks
/Classes-2.py
UTF-8
1,867
3.734375
4
[]
no_license
# coding: utf-8 # In[1]: def sayHello(greeting, name): print '%s, %s!' % (greeting, name) # In[2]: sayHello('Hi', 'Mickey') # In[3]: sayHello('Heil', 'Hitler') # In[16]: class Hello: def __init__(self, greeting, name): self.greeting = greeting self.name = name def sayHello(self):...
true
72624f409cef275f7a2d18886ad1b2058a445fe1
jayanti-prasad/Covid-19
/project1/archive/driver_epidemiology.py
UTF-8
2,081
2.734375
3
[]
no_license
import numpy as np import matplotlib.pyplot as plt from epidemiology import Epidemology import argparse if __name__ == "__main__": """ This is the driver program """ parser = argparse.ArgumentParser() parser.add_argument('-m','--model',help='Model name [sir, seir]', default='sir') parser.add_argum...
true
8d175dd827bdaa8a7a5496cef1ab86ea21637de5
rpicatoste/dlndf-project5-drl-quadcopter-2
/ddpg.py
UTF-8
8,410
2.515625
3
[]
no_license
import numpy as np import tensorflow as tf import json import os from task import Task from ReplayBuffer import ReplayBuffer from ActorNetwork import ActorNetwork from CriticNetwork import CriticNetwork from OU import OU def verify_folder_for_file(file_path): folder = os.path.dirname(file_path) if not os....
true