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
dad8eeeb22e5e74a7cd653eef097dd90c6cce71c
davidstap/sat_ml_sudoku
/main.py
UTF-8
1,882
3.015625
3
[]
no_license
import subprocess import numpy as np from pprint import pprint from sudoku import load_data def clean_output(output): statistics_list = [] output = [a.split() for a in out.split('*'*80)] for line in output: statistics = [] for item in line: try: statistics.append...
true
1628288bfb99be033a79a212cc10f9701ab39e85
sahiljethani/Sorting-Searching-Algorithms
/Algorithms in Python/sentinal search.py
UTF-8
834
4.4375
4
[]
no_license
def sentinal_search(array,value): #function for searching n=len(array) last=array[n-1] array[n-1]=value i=0 while(array[i]!=value): i+=1 array[n-1]=last if(i!=n-1 or array[n-1]==value): return i return -1 def input_array(): #function for t...
true
0d1efb955e58c2b12456bb18080ca732acf40ca9
MuharremOkutan/lagom
/lagom/core/es/test_functions/base_test_function.py
UTF-8
373
3.125
3
[ "MIT" ]
permissive
class BaseTestFunction(object): """ Base class for test function in optimization. For more details, please refer to https://en.wikipedia.org/wiki/Test_functions_for_optimization All inherited subclasses should at least implement the following functions: 1. __call__(self, x) """ def ...
true
bdad3622b1ecb9059a30f47207abf0cf3c75591c
miguel71011/parcia_finalMiguelFajardo
/src/controllers/slots.py
UTF-8
2,940
2.59375
3
[]
no_license
from src.controllers import students from flask import request,jsonify from src import app from src.models.slots import SlotsModel from src.models.students import StudentsModel from src.models.sessions import SessionsModel sessionsModel = SessionsModel() studentsModel = StudentsModel() slotsModel = SlotsModel() @app...
true
8ae2dab6155eff5d12fef824ac4111dfbde86f20
poppy-project/rosa
/api/python/rosa/led.py
UTF-8
610
3.515625
4
[]
no_license
class LED(object): def __init__(self, side, remote_io): self._io = remote_io self._side = side self._on = False def __repr__(self): return 'LED(side="{}", status="{}")'.format( self._side, 'on' if self.is_on() else 'off' ) def is_on(self): ...
true
6c16ed321df34832f166a1c530e2051c6fd0e5d1
SUSE/salt-formulas
/prometheus-exporters-formula/scripts/migrate_formula_data.py
UTF-8
2,913
2.703125
3
[ "Apache-2.0" ]
permissive
#!/usr/bin/python3 from collections import MutableMapping import json from pathlib import Path import shutil pillar_paths = [Path('/srv/susemanager/formula_data/pillar'), Path('/srv/susemanager/formula_data/group_pillar')] v05_keys = {'proxy_enabled', 'proxy_port'} v1_keys = {'node_exporter', 'apache...
true
18764f7bb1a683e7190cc53a9d346e13875c8509
zyfra/ebonite
/tests/test_mock.py
UTF-8
1,159
2.96875
3
[ "Apache-2.0" ]
permissive
import pytest from tests.conftest import MockMixin class A: def method(self): """aaaa""" def method2(self): return 2 class B(A, MockMixin): def method(self): return 1 def test_mock_mixin(): b = B() assert b.method() == 1 b.method.assert_called() assert b.metho...
true
0f9f075e7fe10e0357a707a04c32c1e508de06e7
1274085042/Algorithm
/Offer/HUAWEI/整数与IP地址间的转换.py
UTF-8
1,683
3.65625
4
[]
no_license
#coding=utf-8 ''' 题目描述 原理:ip地址的每段可以看成是一个0-255的整数,把每段拆分成一个二进制形式组合起来, 然后把这个二进制数转变成一个长整数。 举例:一个ip地址为10.0.3.193 每段数字 相对应的二进制数 10 00001010 0 00000000 3 00000011 193 11000001 组合起来即为:00001010 00000000 00000011 11000001,转换为10进制数就是:167773121,即...
true
96f6982dc7f0fba2fdd1d4f39d88812839f2dc32
Holzpferd/Driving-Scene-Understanding
/src/videoToImage.py
UTF-8
1,422
2.828125
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Mon Oct 21 18:03:16 2019 @author: wangning """ import cv2 import glob import os from datetime import datetime def video_to_frames(path): videoCapture = cv2.VideoCapture() videoCapture.open(path) # 帧率 fps = videoCapture.get(cv2.CAP_PROP_FPS) # 总帧数 frames =...
true
5d5ce8203f48aeaf1e2a3dd415b9b8fbd3e02344
kalemsalie/Error-File-Handling
/error handling/Flight.py
UTF-8
1,471
3.34375
3
[]
no_license
from tkinter import * from tkinter import filedialog from tkinter import simpledialog ,messagebox window=Tk() window.title("File Handling") window.configure(background="Red", relief="solid") window.geometry("700x500") def qualify(): try: amount = int(entry1.get()) if amount < 3000: ...
true
42c5165fe848b74455b3a3ce4bc37c4760db2795
Shwaubh/HackerrankSolutions
/easy/Game Theory/A ChessBoard Game.py
UTF-8
108
3.4375
3
[ "Apache-2.0" ]
permissive
for _ in range(int(input())): x , y = input().split() x = int(x) y = int(y) print(x + y)
true
daf17668a8146e41f07c5568c4f589ee74034267
neurotoxin78/oled_meteo
/lib/st7735s.py
UTF-8
5,333
2.546875
3
[]
no_license
import framebuf import time from machine import Pin, SPI, I2C ''' import m5stickc_lcd lcd = m5stickc_lcd.ST7735() lcd.text('hello', 10, 10, 0xffff) lcd.show() ''' class ST7735(framebuf.FrameBuffer): # command definitions CMD_NOP = const(0x00) # No Operation CMD_SWRESET = const(0x01) # Software reset ...
true
2cd88c8098b03ae2f0b1370cf9e75e5d36d3f293
CandaceMcCall/fullstack-nanodegree-blog
/handlers/ShowPost.py
UTF-8
890
2.609375
3
[]
no_license
#!/usr/bin/env python # # ShowPost Handler # # Blog project for Udacity Full Stack NanoDegree # Student: Candace McCall # Date: 02/05/2017 # from handlers import BlogHandler from models import Post, Comment from google.appengine.ext import db from blogsutil import blog_key # # Show Post Class for Blog # class S...
true
06bfe4ae40cf39521e3ea794f428a22b0a63efa4
theone8250/pythonpractice
/python66/random-statistics.py
UTF-8
1,084
4.4375
4
[]
no_license
# 1. 亂數模組 random # 1.1 隨機選取:choice()、sample() # 1.2 隨機調換順序:shuffle() # 1.3 取得隨機亂數:random()、uniform() # 1.4 取得常態分配亂數:normalvariate() # 2. 統計模組 statistics # 2.1 計算平均數:mean() # 2.2 計算中位數:median() # 2.3 計算標準差:stdev() # 隨機模組 import random # 隨機選取 # data=random.sample([1,5,6,10,20],2) # print(data) # 隨機調換順...
true
4010f28a2b9c01fcbdb8611251f9117da21aa69b
spreadmesh/fastcampus_wps2
/DAY_10/DAY_10_handle_string.py
UTF-8
2,207
4.09375
4
[]
no_license
# coding: utf-8 # In[1]: # "패스트캠퍼스 스쿨 과정은 참 좋다" # => ["패스트캠퍼스", "스쿨", "과정은", "참", "좋다"] # In[26]: def word_split(sentence): output = [] buf="" for i in sentence: if i != ' ': buf += i else: output.append(buf) buf="" return outp...
true
f6e5b44fc67e767a7300b620a998a108498223d8
SeunghoHan1/port
/macaron_2/src/FSMachine.py
UTF-8
7,941
2.625
3
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Created on Sun Aug 9 19:45:50 2020 @author: JHPark ^^; """ import numpy as np import enum #import sensor_data_communication class CarStateE(enum.Enum) : Estop = -1 Ready_Start = 0 Start = 1 Cruise = 2 Ready_Light = 3 Stop_Red_Light = 4 Re...
true
7073acb69db2c2e02bbb4045dbd55843bc429a18
LaraCherry/PyAuto
/test_footer.py
UTF-8
609
2.765625
3
[]
no_license
import unittest from selenium import webdriver from link import Link from login_page import LoginPage class TestFooter(unittest.TestCase): @classmethod def setUpClass(cls): cls.browser = webdriver.Chrome() def test_footer_links(self): links = ( # COMPANY 'About Us'...
true
4a03680e3b93bfe608404b3ecfa9bbc5df3f30ff
sxhsxhsxh/Edict
/电子辞典/insert_word.py
UTF-8
560
2.796875
3
[]
no_license
import pymysql #连接数据库 db = pymysql.connect('localhost','root', '123456','project_all') #创建游标对象 cursor = db.cursor() #打开dict文件 f = open('dict.txt') for line in f: tmp = line.split(' ') word = tmp[0] mean = ' '.join(tmp[1:]).strip() #执行sql语句 sql = "insert into edict_project(wor...
true
6d6d29079b01145928bf70052df2e9fc0186ba71
yanhualei/about_python
/python_learning/python_base/python操作数据库/dbredis.py
UTF-8
182
2.5625
3
[]
no_license
from redis import Redis redis_conn = Redis(host='127.0.0.1', port=6379) add_data = redis_conn.sadd("test","werqwrqewrq") # 添加成功返回1,添加失败返回0 print(add_data)
true
013ebbe026cd966199cdbc428addabbc88760c94
cbautista1002/random-python
/questions.py
UTF-8
13,665
4.0625
4
[]
no_license
# Writing programming interview questions hasn't made me rich. Maybe trading Apple stocks will. Suppose we could access yesterday's stock prices as a list, where: # The indices are the time in minutes past trade opening time, which was 9:30am local time. # The values are the price in dollars of Apple stock at that tim...
true
4beab7b8c9a552931712acaf34c1fedad901cc49
JustNETOrgani/cryptoCoursePlayground
/SSSusingXOR.py
UTF-8
3,637
3.6875
4
[]
no_license
# A simple implementation of Secret Sharing Scheme using XOR and Random number generation. # Three executives out of which any two can reconstruct the secret. import secrets # Helper functions def prng(): print('Generating randomness...') rand_1 = bin(secrets.randbits(128)) rand_2 = bin(secrets.randbits(...
true
7465b1c4e4886f0115e7b921ddd09f32fbd6c3b7
reebear63/Technologies
/list_tuple.py
UTF-8
148
2.671875
3
[]
no_license
import timeit print (timeit.timeit(stmt="[0, 1, 2, 3, 4, 5]", number=1000000)) print (timeit.timeit(stmt="(0, 1, 2, 3, 4, 5)", number=1000000))
true
b0e0b8fe8e938e4bfc714ab63e79db6ef4deb200
vijayML2002/genetic-algorithm-part2
/main.py
UTF-8
6,240
3.203125
3
[]
no_license
#importing the req lib %tensorflow_version 2.x import tensorflow as tf import numpy as np from keras.callbacks import History #creating a simple dataset no_game = 1000 def create(): data1 = [] data2 = [] for x in range(no_game): y = x+10 data1.append(x) data2.append(y) prin...
true
8d0e7c57c96d9249dce5cfc23e52d22ad1354731
YvanDavidHerChar/HernandezYvan_Ejercicio07
/MCMH.py
UTF-8
3,008
3.078125
3
[]
no_license
import numpy as np import matplotlib.pyplot as plt #Definimos el prior con las regiones en las que han de estar los parametros def logprior(v): for i in range(len(v)): if v[i] > 0 and v[i] < 100: p = 1.0 else: p= 0 break return p #El modelo matematico que si...
true
bad310ba9c34b17ec1337fdf5c450bff4ef518d4
shubhamjante/python-fundamental-questions
/Programming Fundamentals using Python - Part 02/Assignment Set - 07/Assignment on list - Level 1 (puzzle).py
UTF-8
1,147
4.5625
5
[]
no_license
""" Write a python function to check whether the given number is a perfect number or not. The function should returns true if the number is a perfect number, else it should returns false. Hint: Perfect number is a positive whole number that is equal to the sum of its proper divisors. The first perfect number is 6 as t...
true
fb39d5e9afe480de73b5fa150ece2f32de2136e0
dan144/aoc-2018
/2018/day2.py
UTF-8
1,173
3.25
3
[ "MIT" ]
permissive
#!/usr/bin/python3 import sys print('Running:',sys.argv[0]) n = sys.argv[0][2:].index('.') filen = sys.argv[0][5:n+1+len(str(n))] input_file = 'input' + str(filen) print('Reading:',input_file) ids = [] with open(input_file, 'r') as f: for line in f: ids.append(line[:-1]) print() print('PART ONE') twos ...
true
f57cac4d92d6a748bfcd211a13f30d9ad84b2eb8
TaiPham25/PhamPhuTai---Fundamentals---C4E16
/Session3/guess_my_number.py
UTF-8
525
3.765625
4
[]
no_license
# from random import randint # # # n = randint(0,100) # n= 71 # count = 0 # # playing = True # while playing: # a = int(input('Guess a number(0-100)? ')) # # if a < n: # print('too small') # elif a == n: # print('bingo') # break # else: # print('to large') # # # count...
true
83c5f9305f54f25d67e2010fca32671b91fd874e
cxong/Slappa
/animation.py
UTF-8
2,322
3.046875
3
[ "MIT" ]
permissive
from config import * class Animation(object): def __init__(self, game, frames, duration=1, loop=False): self.game = game self.frames = frames[:] self.duration = duration self.loop = loop self.is_playing = False self.on_complete = [] self.counter = 0 ...
true
f177bd0773b2d57afb014e77865c687f1648d339
bhusalashish/DSA-1
/Data/Binary Trees/Check if Binary tree is Sum tree or NOT/Naive.py
UTF-8
831
3.859375
4
[]
no_license
''' #### Name: Check if Binary tree is Sum tree or NOT Link: [link]() #### Sub_question_name: Naive Link: [link]() **O(n^2) for skewed tree** ''' class node: def __init__(self, data): self.data = data self.left = None self.right = None def tree_sum(root): if root == None: ...
true
978205ecf30ca337d758f6e518df4826a0e89c45
nullptr365/projectNull
/_cmpt145_pyStack.py
UTF-8
9,878
3.421875
3
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Feb 6 02:20:05 2018 @author: null @Module :-> PyStack -> L.I.F.0 """ #import sys import matplotlib.pyplot as plt ## ConsT _LIST = 0 _DICT = 1 _BACK = -1 # create a new data structure; Stack that performs the stack-(ing) operation(s) # In thi...
true
0ddc596dcd23d7e60807312872f2065edbb3ed24
gmehta24/git-github
/Bug_fix_7_1.py
UTF-8
144
3.25
3
[]
no_license
temperatures = [10, 12, 14] temp_str = [str(i) +'\n' for i in temperatures] file = open("filename1.txt", 'w') file.writelines(temp_str)
true
7489fdce72eb965077f9bc8e9b08f90c6825cfe8
BIOSBrothers/IS-105_2016_Gruppe1
/ICA01/oppg1.2.3final copy.py
UTF-8
399
2.78125
3
[]
no_license
def encode(string): pass def decode(): with open("sourcecode.txt") as f: linearray = f.readlines() for line in linearray: splitbytes = [line[i:i+8] for i in range(0, len(line), 8)] decodedmessage = "" for byte in splitbytes: decodedmessage += str(chr(int(byt...
true
319d7a64cd8900d628a27c53acc1d776b0d39fa1
ybsdegit/Life_Process_Study
/StudyPacticePython/WebCrawler/小说抓取_语音合成/speechSynthesis.py
UTF-8
1,685
2.828125
3
[]
no_license
#!/practice/Study_Test python # -*- coding: utf-8 -*- # @Time : 2018/12/30 21:19 # @Author : yb.w # @File : speechSynthesis.py 语音合成 百度API from aip import AipSpeech class Speech(object): # # 读取文件 def get_file_content(self,filePath): with open(filePath, 'rb') as fp: return fp.read(...
true
44e8224feb5c6a1fb209656a17776fcbd5ff6c0d
DomPedrotti/python_checkbook_exercises
/checkbook_functions.py
UTF-8
10,159
3.0625
3
[]
no_license
#no longer used in checkbook app def CSV_check_balance(): ''' check_balance() takes no arguments and returns the sum of transactions.csv ''' import csv with open("transactions.csv") as file: balance = 0 for row in csv.reader(file): balance += float(row[0]) return bala...
true
f1c86d88c4a47e935692f999495d57db026ce7c9
jwf-ai/algorithm
/qita/3数和.py
UTF-8
1,089
3.921875
4
[]
no_license
# encoding: utf-8 """ 给你一个数组以及一个数K, 从这个数组里面选择三个数,使得三个数的和小于等于K, 问有多少种选择的方法? """ def sum_num_least(arr,k): res = set() for i in range(len(arr)): j = i + 1 t = len(arr) - 1 while j < t: s = arr[i] + arr[j] + arr[t] if s <= k: tmp = [arr[i], arr[j], ...
true
3d50e14f08b7f7f931544f76d57647310485d92b
Karthikksamy/devops-nuggets
/scripts/generator.py
UTF-8
3,322
2.9375
3
[]
no_license
''' Generator - This module generates C code, based on time_resp.json as input. The generated C code is used to unpack and pack 8/4 Byte streams References: https://docs.python.org/3/library/dataclasses.html https://docs.python.org/3/tutorial/errors.html ''' from dataclasses import dataclass from bottle import ...
true
d8972733829d68e9021b99d197af9a21cf7d9f3a
daniel-reich/ubiquitous-fiesta
/72KukSssxk2eHrWqx_12.py
UTF-8
570
3.25
3
[]
no_license
def char_at_pos(r, s): def is_even(n): return n%2==0 tr = [] if s == 'even': for n in range(len(r)): if is_even(n) == True and is_even(len(r)) == True: tr.append(r[n]) if is_even(n) == False and is_even(len(r)) == False: tr.append(r[n]) else: for n in range(len(r)...
true
fe9b16ab633a66215c9f7c67aa845200c19ca5b4
Aabid-Hussain/PythonLearningProg
/57Challenge/1_challenge.py
UTF-8
376
3.984375
4
[]
no_license
# Calculate the tip as per user input from __future__ import print_function bill= raw_input("What is the bill? ") tip = input("What is the tip percentage? ") if bill.startswith('$'): bill = int(bill.replace('$','')) tip_cal_amt = (float(bill)*tip)/100 print("The tip is ${0:.2f}".format(tip_cal_amt)) print("Th...
true
f9c12946af88e7ff3231ea93548c63c1709a3acf
barack98/Python-Practice
/Mathematic_operators.py
UTF-8
861
4.21875
4
[]
no_license
#prompt user to enter two numbers num1, num2 = input('Enter 2 Number: ').split() #convert string to integer num1 = int(num1) num2 = int(num2) #Sum Sum = (num1 + num2) #Difference difference = (num1 - num2) #Multiplication product = (num1 * num2) #Division quotient= (num1 / num2) #modulus reminder = (num1 % num2) ...
true
afdc1e070a011abf34f9b908c7b604b00dea4d11
zxy199803/fluent_python_exercise
/part5-控制流程/chapter17-使用future处理并发/17.1示例:网络下载的三种风格.py
UTF-8
3,766
3.25
3
[]
no_license
""" future指一种对象,表示异步执行的操作 依序下载,下载完一个图像将其保存在硬盘后才请求下一个图像 并发下载,几乎同时请求所有图像,每下载完一个文件就保存一个 编写并发代码经常这样重构:把依序执行的for循环体改成函数,以便并发调用 标准库有两个名为Future的类,concurrent.futures.Future和asyncio.Future,两个Future类的实例都表示可能已经完成或尚未完成的延迟计算 future封装待完成的操作,可以放入队列,完成的状态可以查询,得到结果后可以获取结果 通常情况下不应自己创建future,只能由并发框架实例化 future表示终将发生的事,确定某件事会发生的唯一方式是执行时...
true
b72474b1833cb29896fdcb278025e40f11dc76ce
xCAMELZx/CSE512
/Lab Week 2/question9_hw.py
UTF-8
329
3.34375
3
[]
no_license
#question 9 # HomeWork - 0 #Dr.Voigt - Yousef Jarrar, Nicholas Chiodini class Book: def __init__(self, title, year, page): self.title = title self.year = year self.page = page book = Book("Intro To Artificial Intelligence", 2009, 756) print("Title: ",book.title) print("Year: ",book.year) ...
true
c8218d11d59838517be20957b98db94c88861f34
AukeB/NN-2019
/Assignment_01/NN_ass_01_03v2.py
UTF-8
7,396
2.8125
3
[]
no_license
import numpy as np import matplotlib.pyplot as plt from scipy.spatial import distance import os, sys, random # Paths and filenames. PATH = "/vol/home/s1594443/Desktop/NN/NN_ass_1/" # Change this to the directory where the code is located. train_in_path = "data/train_in.csv" # Put all the .csv files in a folder called ...
true
1ca9a46da1581a5b090b4f8ecc0fd690eb2ff066
neeraj-lad/connect-4
/src/player.py
UTF-8
6,103
3.359375
3
[]
no_license
import random import board import time NUM_ROWS = board.NUM_ROWS NUM_COLS = board.NUM_COLS class Player: def __init__(self): self.board = board.Board() pass def name(self): return 'N' def make_move(self, move): inserted = False for j in range(board.NUM_COLS): if self.board.board[move][j] == 0: ...
true
730011e48de8dca6ad50851a00282fdb6625f456
aanzum7/Python-For-access-Web-Data
/parsingXMLexmpl.py
UTF-8
607
2.96875
3
[]
no_license
import xml.etree.ElementTree as ET input = '''<person> <per> <entity x='11'> <name> Veer </name> <phone> +880168715352 </phone> </entity> <entity x='15'> <name> zara </name> <phone> +880168715000 </phone...
true
a0d162bb1196e60085dafe9d52d313462a274a29
irfan87/flask_microblog
/app/routes.py
UTF-8
1,074
2.609375
3
[]
no_license
# define routes from flask import render_template, flash, redirect, url_for from app import app from app.forms import LoginForm @app.route("/") @app.route("/index") def index(): # try call user's list user = {"username": "irfan shukri"} # fake post posts = [ {"author": {"username": "John"}, "...
true
2d6cb0b9fedf1e981e833f59d5301df88774813d
3dimaging/deep_pipe
/dpipe/medim/tests/test_shape_ops.py
UTF-8
2,027
2.828125
3
[ "MIT" ]
permissive
import unittest from functools import partial import numpy as np from dpipe.medim.shape_ops import * assert_eq = np.testing.assert_array_equal class TestPad(unittest.TestCase): def test_broadcasting(self): x = np.random.randint(0, 100, (3, 20, 23)) main = pad(x, [[3, 3], [3, 3], [3, 3]]) ...
true
33b7247cf41dc8a021a2cf2658eaccf804e7bf22
madrisan/saltstack-mattermost
/mattermost.py
UTF-8
4,317
2.671875
3
[ "Apache-2.0" ]
permissive
# -*- coding: utf-8 -*- ''' A simple SaltStack extension module for interacting with Mattermost Incoming Webhooks Copyright (C) 2019 Davide Madrisan <davide.madrisan@gmail.com> This module requires a configuration profile to be configured in either the minion or, as in our implementation, in the master configuration f...
true
9e37cfa6d51dea6dfebd4f28e7d4216d973173f4
hungngo97/capture-rdt
/record.py
UTF-8
6,901
2.609375
3
[]
no_license
import numpy from pygame import mixer import time import cv2 from tkinter import * import tkinter.messagebox root = Tk() root.geometry('500x570') frame = Frame(root, relief=RIDGE, borderwidth=2) frame.pack(fill=BOTH, expand=1) root.title('Detect RDT') frame.config(background='light blue') label = Label(frame, text="Det...
true
ccfbc6828a9d361beb5e9f1c0daaa86a4ba56403
sgeller98/project_euler
/Solved/Problem_026.py
UTF-8
421
3.59375
4
[]
no_license
# Project Euler Problem 26 from fractions import gcd def sieve(limit): primes = [] multiples = set() for i in range(2, limit+1): if i not in multiples: primes.append(i) multiples.update(range(i*i, limit+1, i)) return primes for d in sieve(1000)[::-1]: period = 1 ...
true
19775010a4702699635d7cdde7e11a97ccbc8fb3
armijoalb/CRIP
/Práctica 2/Geffe.py
UTF-8
994
4.125
4
[]
no_license
""" Implementación de un Generador de Geffe Un Generador de Geffe crea una cadena de 0s y 1s a través de tres cadenas generadas por LFSR. A dichas cadenas las llamaremos L1, L2 y L3 respectivamente. A partir de dichas cadenas el Generador de Geffe crea la cadena con la siguiente operación: cad_solucion = (L1*L2)+(L2*L...
true
fc81f583393a7bb6602ff168ec7ba058de57c285
brianfdo/stock-market-LRM
/lrm.py
UTF-8
1,331
2.9375
3
[]
no_license
import quandl import pandas as pd import numpy as np import datetime import matplotlib.pyplot as plt from sklearn.linear_model import LinearRegression from sklearn.model_selection import train_test_split from sklearn import preprocessing def linearReg(ticker, days): quandl.ApiConfig.api_key = 'ekUM3Ut18s6GyHRFqxV...
true
1533a1698b3f5b53984a1fc0f537838f68f45c65
d101tm/tmstats
/makecontestpage.py
UTF-8
6,850
2.546875
3
[]
no_license
#!/usr/bin/env python3 """ Make Contest Page: Use the information from The Events Calendar to create a page with a complete listing of all contests in the District. """ import dbconn, tmutil, sys, os from datetime import datetime import re import tmglobals import EventsCalendar myglobals = tmglobals.tmglobal...
true
18d0f2eb01a213185e46a671e671fc00952d0428
wxh001qq/IPIC_top
/Model_define_pytorch.py
UTF-8
11,306
2.625
3
[]
no_license
#!/usr/bin/env python3 """An Implement of an autoencoder with pytorch. This is the template code for 2020 NIAC https://naic.pcl.ac.cn/. The code is based on the sample code with tensorflow for 2020 NIAC and it can only run with GPUS. Note: 1.This file is used for designing the structure of encoder and decoder. ...
true
6824a0382cc136b8444e79c7e82008d9836f900f
srilekha-gopisetti/100-days-python
/sum of digits.py
UTF-8
305
3.828125
4
[]
no_license
code 1 def sum_digits(n): sum=0 while n>0: rem=n%10 sum+=rem n//=10 return sum n=int(input("enter a number:")) print(sum_digits(n)) code 2 n=input("enter n value:") sum=0 for i in n: sum+=int(i) print(sum)
true
feea2f4ce013e50f0bd2e80a20fd7a0da1dc7a20
nborggren/confmap
/confmap/mapping.py
UTF-8
1,390
2.59375
3
[ "MIT" ]
permissive
import matplotlib.pyplot as plt import numpy as np from .functions import somme class ComplexMapping: """Abstract class meant to be used with HyperbolicTiling and ImageTransform""" def __init__(self,name,suffix=0,prefix='',output_width=900, output_height=900,data=None): "...
true
920dc90b89adfc7e3c2f3b9bb664bdbba2683b9f
InnoFang/algo-set
/LeetCode/0560. Subarray Sum Equals K/solution.py
UTF-8
407
2.875
3
[ "Apache-2.0" ]
permissive
""" 92 / 92 test cases passed. Runtime: 120 ms Memory Usage: 17.3 MB """ class Solution: def subarraySum(self, nums: List[int], k: int) -> int: rec = collections.defaultdict(int) rec[0] = 1 ans = psum = 0 for num in nums: psum += num if (psum - k) in rec: ...
true
a679a7dbd7cc43e991518d5ee155adda99eb104c
realmhamdy/WLWCrawler
/WLWCrawler/wlw_crawler/lib/support.py
UTF-8
1,087
2.578125
3
[]
no_license
''' Created on Nov 23, 2014 @author: Mohammed Hamdy ''' class WLWURLGenerator(object): """ Tells the spider about the urls to crawl. This is a singleton for easy sharing between the spider and client protocol """ _instance = None @classmethod def getInstance(cls): if cls._instance is None: ...
true
59a152a69d2775592b4e45f7b43f2558c82487e2
ewanlee/cs294-hw
/hw1/bc/bc_model.py
UTF-8
2,594
2.71875
3
[]
no_license
import tensorflow as tf class BC(object): def __init__(self, optimizer, lr): self.obs = tf.placeholder(tf.float32, [None, 11]) self.actions = tf.placeholder(tf.float32, [None, 3]) self.pred, self.parameters = self.network() self.loss = self.get_loss() self.optimizer = self...
true
5917a03c755b51c878f128a579f59f27fa0192d5
hasadna/OpenCaptcha
/tests/fake_template.py
UTF-8
825
2.828125
3
[ "MIT" ]
permissive
from open_captcha.common_types import Challenge from open_captcha.challenge_templates import ChallengeTemplate class QuestTemplate(ChallengeTemplate): config_name = 'quest' def __init__(self, quest: str = 'the holy grail', error_msg: str = None): self.question = 'What is your quest?' self.ans...
true
b36713563247ee7816ed3a54ac90d7a47f94455f
seanlane/Exercism
/python/word-count/wordcount.py
UTF-8
262
3.03125
3
[]
no_license
from collections import defaultdict import re def word_count(sentence): lower = sentence.lower() words = re.split("[\W_]+", lower, flags=re.UNICODE) counts = defaultdict(int) for word in words: if word == '': continue counts[word] += 1 return counts
true
1d4c781db41aba19642b5f57aaac582154f86a0a
puppycodes/LO-PHI
/lophi-automation/bin/lophi-logger
UTF-8
7,712
2.6875
3
[]
no_license
#!/usr/bin/python """ Open a GUI listener. This will open a RabbitMQ server and consume output from the sensors and display it in a nice gui. (c) 2015 Massachusetts Institute of Technology """ # Native import sys import os import multiprocessing import optparse import copy import logging import datetim...
true
52944f3a5f0d34236abfe1531db236fd455a1aef
hugochan/KDDCUP2016
/analysis/clouds.py
UTF-8
9,153
2.609375
3
[]
no_license
''' Created on Jun 8, 2014 @author: luamct ''' import os import re from _collections import defaultdict import nltk from sklearn.feature_extraction.text import TfidfVectorizer import numpy as np from collections import Counter from itertools import izip from scipy.spatial.distance import cosine #from utils import plo...
true
1e87b5e89acbd5c3b6b990dec676940af0ef45a8
Christine1225/Leetcode_py3
/22generateParenthesis.py
UTF-8
839
4.21875
4
[]
no_license
# -*- coding: utf-8 -*- """ Created on Thu Sep 27 13:37:17 2018 给出 n 代表生成括号的对数,请你写出一个函数,使其能够生成所有可能的并且有效的括号组合。 n=1 () n=2 ()(),(()) 例如,给出 n = 3,生成结果为: [ "((()))", "(()())", "(())()", "()(())", "()()()" ] @author: Abigail """ class Solution: def generateParenthesis(self, n): """ :type n: i...
true
bef6a9a0b159742c03f3ddbaed6c71ccc40e50b7
klgentle/lc_python
/leet_code/labuladong/tree/P0114_Flatten_Binary_Tree_to_Linked_List.py
UTF-8
1,087
4.28125
4
[]
no_license
""" Given the root of a binary tree, flatten the tree into a "linked list": The "linked list" should use the same TreeNode class where the right child pointer points to the next node in the list and the left child pointer is always null. The "linked list" should be in the same order as a pre-order traversal of...
true
5c6271a99dc3256718e5d3d6c6941534ae605325
dbogs425/data_structures
/assignment4/main.py
UTF-8
7,145
3.671875
4
[]
no_license
#$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ # $ # Assignment 4 -- Daniel Bolognino -- CISC 3130 $ # $ #$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ #--------------------------------------------- #--------------- ...
true
16adb9f6e79dd7517d1281a571fec8cb65d2def9
yoda-vid/jinn
/resources/ArchiveResource.py
UTF-8
1,821
2.546875
3
[]
no_license
from FileResource import FileResource from feedback.LogLevels import LogLevels import g class ArchiveResource(FileResource): def getType(self): return "Jinn::Resource::Archive" def doInstall(self, path = None, name = None): # Set up a tmpname to download to, if name is provided ...
true
7154cccc1d84b626700d8563f1f49db518a0e496
msaad1311/Flask-Tutorial
/Template Basics/app.py
UTF-8
746
2.8125
3
[]
no_license
from flask import Flask,render_template,request app = Flask(__name__) @app.route('/') def index(): return render_template('index.html') def upperLevel(name): return any(x.isupper() for x in name) def lowerLevel(name): return any(x.islower() for x in name) def numberEnd(name): return name[-1].isdigit(...
true
3eeca4289f6f6ff442ae26cffaef89e5f34ba3f0
raghesh/OpenMP-Code-Generation-In-Polly
/thesis/final_thesis/plot/plot2core64bit.py
UTF-8
1,042
2.75
3
[]
no_license
#/usr/bin/env python # a bar plot with errorbars import numpy as np import matplotlib.pyplot as plt N = 8 ind = np.arange(N) # the x locations for the groups width = 0.15 # the width of the bars fig = plt.figure() ax = fig.add_subplot(111) gcc = (1.976261, 0.418657, 0.338003, 0.336355, 0.560561, 0.809508, 0.23...
true
2e59ac1c9c94d7792375903aa9fb33ec399b678d
Ajitesh13/Python-OOP
/inheritance/2_inheritance.py
UTF-8
975
4.125
4
[]
no_license
#example showing multiple inheritance and parent-constructer invoking in child class class Base1: def __init__(self,i): print("Base1 constructer called") self.x = i def get_x(self): print("x = " + str(self.x)) class Base2: def __init__(self,j): print("Base2 constructer ...
true
6bc7c7301635d38f5e20006b208998bbe917c209
alex9269/ECE351_Code
/lab1.py
UTF-8
7,741
3.515625
4
[]
no_license
# ============================================================================= # #t=1 # #print(t) # #print("t =",t) # #print('t =',t,"seconds") # #print('t is now=',t/3,'\n...and can be rounded using `round()`',round(t/3,4)) # ============================================================================= # ===...
true
e803df0eb162d13cddecbf788948dd7489a57781
sam-lb/CarAI
/old/main.py
UTF-8
1,572
3.4375
3
[ "MIT" ]
permissive
import sklearn import pygame import csv from Car import Car WIDTH = 500 HEIGHT = 500 pygame.init() screen = pygame.display.set_mode((WIDTH, HEIGHT), pygame.RESIZABLE) pygame.display.set_caption("Genetic algorithm drives a car") pygame.key.set_repeat(100, 50) clock = pygame.time.Clock() car = Car(WIDTH/2, HEIGHT/2, 5...
true
f84853a9f8dca998af498bf8d8529b304ab63b30
ghyaolong/pyDemo
/base/urilib/demo2.py
UTF-8
259
2.71875
3
[]
no_license
#!/usr/bin/python3 ''' post 请求带参数 ''' import urllib.parse import urllib.request data = bytes(urllib.parse.urlencode({'world':'hello'}),'utf-8') response = urllib.request.urlopen('http://httpbin.org/post',data) print(response.read().decode('utf-8'))
true
c9691d113cc77595661a97b229cd2666f249cc7a
nvnnv/Leetcode
/385. Mini Parser.py
UTF-8
2,359
3.609375
4
[]
no_license
# """ # This is the interface that allows for creating nested lists. # You should not implement it, or speculate about its implementation # """ #class NestedInteger: # def __init__(self, value=None): # """ # If value is not specified, initializes an empty list. # Otherwise initializes a single i...
true
4566ba2fd6a3b8e5e609ca361daf93fbebb0ff06
AteroConfigs/deal
/network/topology.py
UTF-8
2,590
2.9375
3
[]
no_license
import math, random from itertools import chain class FullyConnectedNode(StandardError): pass def valid_node_choices(G, node): # discount self and neighbors nodes = G.nodes() nodes.remove(node) for n in node.neighbors: nodes.remove(n) return nodes def generative_link(G, node, p_local,...
true
948f138df8ce9463a74224085adaa45414262050
balasubramnya/CPL_4.0
/tkinter_ui.py
UTF-8
1,857
3.046875
3
[]
no_license
from tkinter import * from tkinter import ttk from tkinter.filedialog import askopenfilename from tkinter.filedialog import askdirectory from functools import partial def OpenFile(textField,flag=0): if flag == 1 : name=askdirectory() else: name = askopenfilename(initialdir="C:/Users/Batman/Doc...
true
cb453ce10bc0ca44469e4bac287cfceaf927f077
ragnartrades/algotrading-18
/backtesting/helpers/StoreHelper.py
UTF-8
905
2.84375
3
[]
no_license
import os import glob import pandas as pd class StoreHelper: def __init__(self, store_path): self.store_path = store_path self.temp_dir = 'temp/' self.results_dir = 'results/' def remove_temp_files(self): # Clean the store by removing any temp files files = glob.glob(s...
true
6d491c660bb2fd9d438f2549113fab46c9557524
har790/Personal-Projects
/simple website security checker.py
UTF-8
250
3.171875
3
[]
no_license
z = (input("enter the website :")) x: int = len(z) while x >= 13: x = x + 1 if z.startswith('https://'): print("fully secured") break else: print("not secure at all") break #print('this is not a website ')
true
452be2f5dfb3651abc233e002ba9b7934121f39a
staftermath/prestest
/tests/test_db.py
UTF-8
1,283
2.53125
3
[ "BSD-3-Clause" ]
permissive
from pathlib import Path import pytest from pandas.testing import assert_frame_equal import pandas as pd from sqlalchemy.exc import DatabaseError from prestest.db import DBManager from tests.test_container import container, start_container, DOCKER_FOLDER resource_folder = Path(".").resolve() / "resources" @pytest.f...
true
bc13e48585412517abca582526d56f943e546098
Nermin-Ghith/ihme-modeling
/gbd_2017/nonfatal_code/clinical_team/Formatting/001_pre_format_BRA_SIH_15_16.py
UTF-8
2,566
2.625
3
[]
no_license
# coding: utf-8 import pandas as pd from simpledbf import Dbf5 import glob import os import sys sys.path.append("FILEPATH/Functions") import hosp_prep # get a list of all the 2016 files fdir = "FILEPATH" files = glob.glob(fdir + "*.dbf") # set directory to write to out_dir = "FILEPATH" def get_cols_to_keep(file_pa...
true
0beedccc3aaa28b6cae21f09e328e4c9061f8dc1
LauraRuusmann/AA-evolving-images
/scripts/voronoi-de.py
UTF-8
10,211
2.90625
3
[]
no_license
from random import randint, choice, random, sample import numpy as np import matplotlib.pyplot as plt from scipy.spatial import Voronoi import PIL.ImageDraw as ImageDraw import PIL.Image as Image import math from datetime import datetime # Calculate the bounds for voronoi DNA def get_bounds_voronoi(nr_points, size, ...
true
4644504896e7100a94e4f13aac2e054a9d642c6c
amangarg8279/PythonL
/Day 3/love calc.py
UTF-8
385
3.4375
3
[]
no_license
name_first=input("Please enter your name \n") name_sec =input("Please enter their name \n") com_string=(name_first+name_sec).lower() t=com_string.count("t") r=com_string.count("r") u=com_string.count("u") e=com_string.count("e") true=t+r+u+e l=com_string.count("l") o=com_string.count("o") v=com_string.count("v") e=co...
true
e3ae054720c7157124134a184d1f4842f557ddbf
heildever/ict4h
/ict4Hex6.py
UTF-8
2,084
3.03125
3
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sun Nov 27 22:03:11 2016 @author: heildever """ import scipy.io as scio import numpy as np import tensorflow as tf import matplotlib.pyplot as plt mat_file=scio.loadmat('parkinsonnew.mat') data = mat_file.get('parkinsonnew') # initial steps (rows,cols) = n...
true
d02c8ac0db9ce1f08dac45006f8479c7247b6491
bihealth/NeatMS
/NeatMS/data.py
UTF-8
14,969
2.859375
3
[ "MIT" ]
permissive
import pymzml import numpy as np from .peak import Chromatogram, Peak class RawData(): """ Representation of raw data file. Links sample class to its reader backend. """ def __init__(self, sample, file_path, reader): self.sample = sample self.file = file_path self.reader...
true
e38d10be62b7095f2521455d71a584d54619f558
a-phillips/ProjectEuler
/P183.py
UTF-8
939
3.515625
4
[]
no_license
"""Not solved!""" import math import time def make_terms(N): terminal_denoms = [] for exp_2 in xrange(int(math.log(N)/math.log(2))+1): for exp_5 in xrange(int(math.log(N)/math.log(5))+1): num = (2**exp_2) * (5**exp_5) if num <= N: terminal_denoms.append(num) ...
true
eb0feb0a100fe3be9d4a4e3440b811f58c087269
tonyduan/retinanet-detection
/examples/visualize_data.py
UTF-8
983
2.59375
3
[]
no_license
from argparse import ArgumentParser from matplotlib import patches as patches from matplotlib import pyplot as plt from src.datasets import * if __name__ == "__main__": argparser = ArgumentParser() argparser.add_argument("--idx", default=0, type=int) argparser.add_argument("--dataset", default="coco"...
true
43e688fb03ca61bcd3ee42406b10e81a16c4adda
rwjohnson1414/Project-PERU
/ProjectPERU_DataCollection/ProjectPERU_DataCollection/republican_data_processing.py
UTF-8
589
2.640625
3
[]
no_license
import io import re lines = [] with io.open('labeled_republican_data.txt', 'r', encoding='ascii', errors='ignore') as infile: for line in infile: lines.append(line.split(',')) count = 0 for line in lines: if len(line[1].split(' ')) <= 2 and not "honk" in line[1].lower() and not "imigra" in line[1].lo...
true
6802ce8d945804e358fd81b9cb2a59c9472c6fe9
yashjaiswal1/CTCI-DSA
/ds/stringcompressions.py
UTF-8
845
3.828125
4
[]
no_license
def stringCompression(string): compressed_string = [] counter = 0 for i in range(len(string)): counter += 1 if i == len(string) - 1 or string[i] != string[i + 1]: compressed_string.append(string[i]) compressed_string.append(str(counter)) counter = 0 i...
true
7152251d4d3b5efc6feff3cbf3f18ff093de5588
Aasthaengg/IBMdataset
/Python_codes/p02574/s827059338.py
UTF-8
750
2.890625
3
[]
no_license
def gen_d_prim(n): D = [0,0] + [-1] * (n-1) for i in range(2, n+1): if D[i] > 0: continue for j in range(i, n+1, i): D[j] = i return D def is_pairwise(A): D = gen_d_prim(10**6) past = set() for a in A: now = set() while a != 1: if not D[a] in now and ...
true
7ac14251691c83ec23fb605e650e93f6a35029b0
rbunge-nsc/MLTV-Demo
/PythonWebApp-6-10-20/myproject/MLTVSQL.py
UTF-8
1,630
2.734375
3
[]
no_license
from flask import Flask, request, render_template import mysql.connector mydb = mysql.connector.connect( host="localhost", user="test", passwd="test", database="MLTV" ) mycursor = mydb.cursor() #initialize a list for the output output = [] # converts tuple to string def convertTuple(tup): ...
true
a2c81d93038b6c1a715e03632e6ae3b62946bacc
HungChun-Wang/AI_Snake
/GUI.py
UTF-8
7,656
2.734375
3
[]
no_license
import time import pygame from enum import IntEnum import numpy as np from CommonDefine import EDirection from pygame.locals import KEYDOWN from pygame.locals import QUIT from pygame.locals import K_UP from pygame.locals import K_DOWN from pygame.locals import K_LEFT from pygame.locals import K_RIGHT from pygame.locals...
true
f15b594706bbcb246f0674a527e3b193d1e500a5
Atlasias/Algorithm
/acmicpc/1110.py
UTF-8
149
3.078125
3
[]
no_license
n = int(input()) i = 0 k = n while True: n = (n % 10) * 10 + (int(n / 10) + (n % 10)) % 10 i = i + 1 if n == k: break print(i)
true
d4489a97e64ca1e9c81bc988f4fd38b53df181ac
myc9799/Online-Time-series-Stock-Price-Trading-Algorithm
/RollingMean/plot.py
UTF-8
2,553
3.03125
3
[]
no_license
import time import datetime import matplotlib.pyplot as plt import warnings warnings.filterwarnings('ignore') def plot_data(data, highlight=False, checklist=None): with plt.style.context('seaborn-dark'): plt.figure(figsize=(8, 4)) plt.plot(data.close_price.values, label='open_price', linewidth = ...
true
c4a1534134f8ab532f26fba379d6058741065191
ianagbip1oti/keith
/tests/test_parser.py
UTF-8
298
2.640625
3
[ "MIT" ]
permissive
from keith.parser import parse from lark.lexer import Token from lark.tree import Tree def test_parse_hello_world(): p = 'print("hello world")' assert parse(p) == Tree('start', [ Token('IDENTIFIER', 'print'), Tree('arguments', [Token('STRING', '"hello world"')]) ])
true
f70e62a6399a0f0387368b8eaf34cfb0c6a409ef
imnisen/pybtcd
/wire/blockheader.py
UTF-8
4,234
2.640625
3
[]
no_license
import io import time import pyutil from chainhash.hashfuncs import * from .common import * # MaxBlockHeaderPayload is the maximum number of bytes a block header can be. # Version 4 bytes + Timestamp 4 bytes + Bits 4 bytes + Nonce 4 bytes + # PrevBlock and MerkleRoot hashes. MaxBlockHeaderPayload = 16 + (HashSize * 2)...
true
aea0e2dd37eb5f0a63bf6ade903d58fd2557731e
xzk-seu/MushroomClassfy
/decision_tree.py
UTF-8
8,583
3.15625
3
[]
no_license
import json import os from math import log2 class DecisionTree(object): def __init__(self, train_set, feature_index_set): """ 根据训练集构建决策树 :param train_set:全量训练数据集 :param feature_index_set: 所选取的特征的集合 """ print('construct tree, index:') train_index_set = [x['id...
true
d78db0dadf516cd6882403268fc45f6e7397c5c1
pointtonull/python-kanbanize
/python_kanbanize/kanbanize.py
UTF-8
1,960
2.75
3
[]
no_license
#!/usr/bin/env python #-*- coding: UTF-8 -*- import csv from argparse import ArgumentParser from wrapper import Kanbanize def get_options(): argparser = ArgumentParser() argparser.add_argument("csvfile", help=("The file with the tasks"), nargs='*') options = argparser.parse_args() return ...
true
faa6186aa715b28b0cb5298218ccd11e4e618214
Richardyu114/CS231N-notes-and-assignments
/assignment1/cs231n/classifiers/softmax.py
UTF-8
4,210
3.390625
3
[]
no_license
from builtins import range import numpy as np from random import shuffle from past.builtins import xrange def softmax_loss_naive(W, X, y, reg): """ Softmax loss function, naive implementation (with loops) Inputs have dimension D, there are C classes, and we operate on minibatches of N examples. I...
true
ef911833447a11536ba7f927b250d7a288e2fa03
Schiggebam/WarOfShapes3D
/test/test1.py
UTF-8
5,010
2.71875
3
[]
no_license
import direct.directbase.DirectStart from pandac.PandaModules import * from direct.task import Task from direct.showbase.DirectObject import DirectObject # TO USE # # import hlview # mouseControl=hlview.hlview() # mouseControl.start() # This is basically the drive mode with the ability to look up and down # A versio...
true
7c2d11fe2532e20aa713697c2cc7e9d5d7293126
eriksjolund/cg
/tests/cli/test_cli_status_cases.py
UTF-8
1,920
2.59375
3
[]
no_license
"""This script tests the cli methods to add families to status-db""" from cg.cli.status import cases from cg.store import Store def test_lists_sample_in_unreceived_samples(cli_runner, base_context, base_store: Store, helpers): """Test to that cases displays family in database""" # GIVEN a database with a fa...
true
66f6540a4e65644bb050c83729659adcc10ab47b
buyaoyongroot/1yancc
/api/v1/conn_sqlite.py
UTF-8
865
2.65625
3
[ "Apache-2.0" ]
permissive
import sqlite3 class conn_sqlite(): def __init__(self,dbpath='data.db'): self.conn = sqlite3.connect(dbpath) self.conn.row_factory = sqlite3.Row self.cur = self.conn.cursor() def close(self): self.cur.close self.conn.close def exec(self,sql): self.cur.execu...
true