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
52e5c3f5386e06eaf1fa7962b7a37e35473afafb
akjalbani/Test_Python
/Misc/DictionaryExamples/dictionary_foneBook.py
UTF-8
173
3.53125
4
[]
no_license
phonebook = {} line = input('Name and number: ') while line: name, number = line.split() phonebook[name] = number line = input('Name and number: ') print(phonebook)
true
5483cab3f76af9a84bfb44a5117e87790d525735
WiillyWonka/Intervals
/Lab3/src/main.py
UTF-8
1,686
2.8125
3
[]
no_license
import numpy as np from matplotlib import cm from matplotlib.pyplot import figure, savefig, show from mpl_toolkits.mplot3d import Axes3D from tolsolvty import tolsolvty def Tol(x, infA, supA, infb, supb): Ac = 0.5 * (infA + supA) Ar = 0.5 * (supA - infA) bc = 0.5 * (infb + supb) br = 0.5 * (supb - infb...
true
ffb8c25b59dd29d260d22d5ab7380172938014fd
eneskoksal41/python
/hw1.py
UTF-8
389
3.703125
4
[]
no_license
def topla(a,b): return a+b print ("hello world") isim = "Ahmet" print(isim) fiyat = 3 fiyat += fiyat*0.2 print(fiyat) liste = [3,5,6] print(liste[1:-2]) tup = (22,174, 74.5 ,"ahmet") dic = {"ahmet":21,"mehmet":23} for i in liste: if i == 5: print("adasdasd") elif i == 6: print("altı") ...
true
dc3264bfaff57099a897b96d19befe3fd63f5792
palani19/thilopy
/temp.py
UTF-8
169
3.65625
4
[]
no_license
while True: a=(input("Enter some character")) if(a=="r"): import random r=random.randint(25,30) print("Banglore temperature is ",r) else: print("Bye") break
true
749c7c2cd765b929cdc083c96e8fede78ccd6a1b
Okikijoshua/PythonProjects
/body_mass_index.py
UTF-8
532
4.09375
4
[]
no_license
#Welcome to the BMI calculator print("Welcome to the BMI calculator") print("Please enter your weight in kilograms and your height in metres") weight=float(input("Please enter your weight:")) height=float(input("Please enter your height:")) bmi=weight/(height*height) bmi=round(bmi,1) #Display the BMI print("your bmi is...
true
be04eb73cb4e2cf45efe01ca8a1cd58b6ad0b09e
gopinathsah24/xander
/STARTUP SUCCESS PREDICTOR APP/web_app/ag_predictor_api.py
UTF-8
3,535
3.375
3
[]
no_license
""" Note this file contains _NO_ flask functionality. Instead it makes a file that takes the input dictionary Flask gives us, and returns the desired result. This allows us to test if our modeling is working, without having to worry about whether Flask is working. A short check is run at the bottom of the file. """ i...
true
bb182d5a0b4036886d070978d95c5e584f25b747
DougBrunson/tournament
/database.py
UTF-8
834
3.359375
3
[]
no_license
import psycopg2 def connect(): """Connect to the PostgreSQL database. Returns a database connection. Args: None Returns: DB: connection oject conn: cursor object """ try: DB = psycopg2.connect('dbname=tournament') conn = DB.cursor() return DB, conn ...
true
30a33eeac91e9c8d2695201092512f0d2c2591cc
Pedro312/world_map_dictionary
/world map.py
UTF-8
2,562
3.21875
3
[]
no_license
#### #World Map Project # #Author: Pedro #### import sys world_map = { 'mentr':{ 'NAME': 'Mall Entrance', 'DESCRIPTION': ' You are in the front mall entrance. Behind you are the \ mall front doors, but they are nailed shut.', 'PATHS':{ 'west':'food', 'east':'elev', ...
true
5aac1a3f15adea5f2a8994368a30e541919882b0
Orasund/flotilla-gameboy
/flotilla_wrapper/matrix.py
UTF-8
530
2.859375
3
[]
no_license
import flotilla class MyMatrix: def __init__(self, matrix): self.matrix = matrix def display_image(self, image): for x in range(0,8): for y in range(0,8): self.matrix.set_pixel(x, y, image[y][x]) self.matrix.update() def get_matrix(dock): matrix = ...
true
b103b553683a4dd1e50de0f2f184f9c4afa56c52
jvdtoorn/techmanpy
/techmanpy/packets/cperr_packet.py
UTF-8
1,551
2.671875
3
[ "MIT" ]
permissive
#!/usr/bin/env python from .stateless_packet import * from ..exceptions import * class CPERR_code: SUCCESS=0x00 PACKET_ERR=0x01 CHECKSUM_ERR=0x02 HEADER_ERR=0x03 DATA_ERR=0x04 NO_LISTEN=0xF1 @staticmethod def description(value): if value == CPERR_code.SUCCESS: return 'Success' if...
true
572515587ad91c9d73de24bcbc116a2d26a9d0a2
fenriz07/flask-hippooks
/lib/python2.7/site-packages/fixture/loadable/django_loadable.py
UTF-8
11,148
2.703125
3
[]
no_license
"""Components for loading and unloading data using `Django's ORM <http://www.djangoproject.com>`_. See :ref:`Using Fixture With Django <using-fixture-with-django>` for a complete example. """ from fixture.loadable import DBLoadableFixture from fixture.util import any __all__ = ('DjangoMedium', 'DjangoFixture', 'Djan...
true
450525c521bd8ce0a6a7d78f562951ba363a80f8
dylandoamaral/kattis-problems
/1-difficulty/0021-Pet/main.py
UTF-8
263
3.015625
3
[]
no_license
#! /usr/bin/python3 import sys best = 0 result = 0 for i in range(1, 6): data = sys.stdin.readline().strip().split() total = 0 for j in data: total += int(j) if total > result: best = i result = total print(best, result)
true
ef755f46d8b8c7b4b717a7bbf800e537125daf94
ameenhashir/my_python_codes
/Python OOP/Project-OOPs/inheritence.py
UTF-8
647
3.96875
4
[]
no_license
class Polygon: __width = None __height = None def set_values(self,width,height): self.__width = width self.__height = height def get_width(self): return self.__width def get_height(self): return self.__height class Rectangle(Polygon): def area(self): ...
true
8c1e0402ed748ded4d61b1b9b836d294a3a5aeb3
ThomasRad/SQLite-Formatting-output-
/database.py
UTF-8
541
3.875
4
[]
no_license
# Import package. import sqlite3 # Connect to the database. conn = sqlite3.connect('customer.db') # Create a cursor. c = conn.cursor() # Query the Database. c.execute("SELECT * FROM customers") #Lets get all entries names = c.fetchall() # Format the data to look good when printed. print("Name...
true
4756126f2a99b3e76d91406a3a99c1df899f4248
ShanChathusanda93/python_file_handling
/fileHandling/srcReader.py
UTF-8
704
2.84375
3
[]
no_license
import re # for windows # with open("C:\\xampp\\htdocs\\research\\frontend\\front.php", "r") as file: # orig = file.read() # text = orig.replace('\n', '') # stringLength = len(text) # for ubuntu # did not work well like windows. Please reconsider with open("/home/shan/php_codes/simple_php_projec...
true
5724088ff2b51559270ef0e06c83b191edb9435e
DanielSank/theory
/Circuits/AvailablePower/diagrams.py
UTF-8
1,417
2.609375
3
[]
no_license
import schemdraw from schemdraw import Segment, SegmentCircle import schemdraw.elements as elm def figure_1(): with schemdraw.Drawing() as d: source = d.add(NoiseSource().label('$V_s$', 'left')) d.add(elm.Resistor().at(source.output).label('$R_s$').up()) d.add(elm.Coax().right().label('$Z_0...
true
d96a81c7ea0bb3659bfea01a191db318a2e74890
tzm41/STMProcessor
/Processor/processor.py
UTF-8
4,431
2.796875
3
[]
no_license
#!/usr/bin/env python3 import os.path import csv from Processor import mfn __author__ = 'Colin Tan' __version__ = '1.6' # generate file path base on current python script path def gen_path(rel_path, abs_path=None): if abs_path is not None: return abs_path else: base_path = os.path.dirname(__...
true
ebfb31100d38cac432c6607a41f6d8d707363e14
KrithikNaralasetty/CodeForces
/Codes/OneDJapanCrossword.py
UTF-8
333
3.484375
3
[]
no_license
#721A in codeforces n = int(input()) groups = 0 count = 0 lengths =[] crossword = input() for i in range(0,n): if crossword[i]=="B": count+=1 else: if count>0: lengths.append(count) groups+=1 count = 0 if count>0: groups+=1 lengths.append(count) print(groups) for i in lengths: print...
true
0b8044ad61e0e7effc2e0bf152ab41b30a6785a5
edagotti689/PYTHON-11-LAMBDA
/7_iterator.py
UTF-8
1,424
4.65625
5
[]
no_license
''' 1. using iterators we can get sequence of values based on demand using next() function. ''' l = [1,2,3,4,5] for i in l: print(i) # iter_obj = iter(l) # print(next(iter_obj)) # print(next(iter_obj)) # for i in iter_obj: # print(' For loop ', i) ''' StopIteration ''' ''' # Comp...
true
0e28bf2ba9a953c2af6aea5b8b7191967eac711a
Retrodolivo/DAC-ad5543
/DAC_ad5543.py
UTF-8
1,048
3.0625
3
[]
no_license
################################ ## GUI Module is controlling DAC ad5543 ################################ import tkinter as tk import spidev #_______________DEFINES_________________ MAX_CODE = 2**16 VREF = 10.0 def reverse_bits(byte): byte = ((byte & 0xF0) >> 4) | ((byte & 0x0F) << 4) byte = ((byte & 0xCC)...
true
2935f3cc3b0720d577edbd17379e89372b14598f
JackeyWang777/sgd-gmm
/utils/Parameter_Controller.py
UTF-8
2,940
2.671875
3
[]
no_license
''' Created on 16.01.2020 @author: Benedikt ''' import matplotlib.pyplot as plt from matplotlib.widgets import Slider from matplotlib.widgets import Button from matplotlib.widgets import RadioButtons from matplotlib.widgets import CheckButtons import fuckit ''' # TODO: (re)move for future hacks def _update(variable,...
true
a1413f88fededcbdd3e231c50ace50966e745b8d
Nellyth/Aeidl
/AppAeidl/choices.py
UTF-8
318
2.5625
3
[]
no_license
from modelchoices import Choices class GenderChoices(Choices): Female = ('F', 'Femenino') Male = ('M', 'Masculino') class StatusChoices(Choices): rejected = ('rejected', 'Rejected') pending = ('pending', 'Pending') Analyzing = ('analyzing', 'Analyzing') analyzed = ('analyzed', 'Analyzed')
true
cbe859dc67f6e4a900a7e7faa42804e61527ed13
ptavaresh/python_snippets
/training/movies_dict.py
UTF-8
4,112
4.03125
4
[]
no_license
""" READ THIS FIRST: Description: Implement the logic in the following functions to complete a simple program that tracks the number of views for different movies: - get_all_movies - get_movie_views - get_top_n_movies - save_movie_view """ movies = [ {'title':'Toy story','views':10}, {'title':'...
true
cd32365f908d0a629b2a89d2203ed85cf1724a79
ekimekim/MCProxy
/plugins/menu_test.py
UTF-8
1,103
2.984375
3
[]
no_license
"""A quick module to test the menu system""" import player_cmd as cmd import menus from helpers import tell def on_start(): cmd.register('/menu-test', lambda msg, user: start_menu(user)) def on_packet(packet, user, to_server): return packet def start_menu(user): try: menus.display(user, *ROOT_MENU) except ...
true
b7665a6ddac200727c7c6f9fd41bc84994aeebc9
u101022119/NTHU10220PHYS290000
/student/101022110/catalan.py
UTF-8
169
3.171875
3
[]
no_license
def catalan(n): if n==0: return 1 else: return int((4*n-2)/(n+1.0)*catalan(n-1)) i=0 while catalan(i)<1000000000: print catalan(i) i+=1
true
8a457f1f0701aa4af0ee81a5d371383340040eb8
Kew-Forest/Class-work
/chapter12/wordtools.py
UTF-8
1,509
3.328125
3
[ "MIT" ]
permissive
from unit_tester import test def cleanword(word): return ''.join(e for e in word if e.isalnum()) test(cleanword("what?") == "what!") test(cleanword("'now!'") == "now") test(cleanword("?+='w-o-r-d!,@$()'") == "word") # # test(has_dashdash("distance--but")) # test(not has_dashdash("several")) # test(has_dashdash...
true
011bbb1f8345dfa3f6a943db2dc8458699d67756
banjocat/codeeval_solutions
/5/main.py
UTF-8
1,207
3.265625
3
[]
no_license
import sys import exceptions def main(): with open(sys.argv[1]) as f: for line in f: solve(line.strip()) def find_first_sequence(numbers): """ loop through each number: 2nd loop starting at -1 of current: if not match continue: if matches: ...
true
d035b82957c9ad703710a6ee85402d3ec37438a1
o-Ian/Practice-Python
/Tests/Aula_7a.py
UTF-8
435
4.34375
4
[ "MIT" ]
permissive
n1 = int(input('Digite um valor: ')) n2 = int(input('Digite outro valor: ')) print('A soma é: {}!' .format(n1+n2)) print('A subtração entre {} e {} é {}!' .format(n1, n2, n1-n2)) print('A multiplicação desses valores é {}!' .format(n1 * n2)) print('A divisão entre {} e {} é {:.3}' .format(n1, n2, n1/n2)) print('A divis...
true
b9bcf79c60d21938310f3ac709283dafeb21a1b7
tdd75/stock-market
/crawl_data.py
UTF-8
349
2.828125
3
[]
no_license
import yfinance as yf tickers = [] with open('input.txt', 'r') as f: for line in f.readlines(): tickers.append(line.strip()) for i, ticker in enumerate(tickers): ticker_company = yf.Ticker(ticker) df = ticker_company.history(period='max', interval='1d') if df.shape[0] > 0: df.to_csv('d...
true
0e082f0a564df574dd8d3f7901153a344afed839
HediaTnani/ibd
/driven/expression_profile_old.py
UTF-8
18,374
2.671875
3
[]
no_license
# -*- coding: utf8 -*- # Copyright 2015 Novo Nordisk Foundation Center for Biosustainability, DTU. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # http://www.apache.org/licenses/LICENSE-2....
true
3306e8a25afea4786b0e3dd84d929b8931f7f049
ziceweek/DMHomeworkCA
/nltk/test2.py
UTF-8
390
2.578125
3
[]
no_license
__author__ = 'zice' # encoding=utf-8 import matplotlib.pyplot as plt import numpy fig = plt.figure() ax = fig.add_subplot(1, 1, 1) ax.plot([1, 200, 330, 154, 995]) ticks = ax.set_xticks([0, 250, 500, 750, 1000]) labels = ax.set_xticklabels(['one', 'two', 'three', 'four', 'five'], rotation=30, fontsize='small') ax.set_...
true
b30b3ad10bcdba1431145227df8d50a8133fcdd8
JaynaBhatt/Python-Program-Week1
/listfindSmallNum.py
UTF-8
68
3.453125
3
[]
no_license
list1 = [44,3,23,66,100] print("Smallest number is = ", min(list1))
true
6e984fdf0e5de6aea8eca6d546c6cd1350228b22
Vani-start/python-learning
/list.py
UTF-8
1,805
4.25
4
[]
no_license
#sequence of elements enclosed in [ ], it can be any datatypes(strings,numbers,tuples etc etc #lists are mutable #its like a string,index starts with 0 #declaring an empty list, list1=[] print(list1) #which returns type print(type(list)) list2=["VANI",32,32.5,-1] str1="list2 elements" print(str1) print(list2) pr...
true
5950e93e4a9e1a0c987ef2db7650f0c309136085
baymaxtech/Sample
/01PythonSample/01Request/request.py
UTF-8
852
2.59375
3
[]
no_license
import requests response = requests.get('http://www.junpin168.cn') # Get the request from a normal page print response.status_code # >> 200 | 404 print response.encoding # >> ISO-8859-1 print response.content # >> <!DOCTYPE html PUBLIC "... print response.headers # >> {'content-length': '4152', 'conten...
true
72dbca7a814ecb9d4f9ea02abe4365e80ded0d64
DiR081/CodiPy-Prof
/ejercicios/actividad_palabra_mas_repetida.py
UTF-8
3,965
3.75
4
[]
no_license
""" Actividad - Link https://codigofacilito.com/articulos/ejercicios_conceptos_basicos_python Mostrar en pantalla la palabra que más se repita junto con la cantidad de veces que lo hace del capituló número uno de Frankenstein http://umich.edu/~umfandsf/other/ebooks/frank10.txt ""...
true
c72dc806338548ff1319a100b01fce682229a0c2
MeetLuck/works
/pygame/BeginningGameDevelopmentwithPythonandPygame/ants.py
UTF-8
4,085
3.1875
3
[]
no_license
GRID_SIZE = (160, 120) GRID_SQUARE_SIZE = (4, 4) ant_image_filename = "ant.png" ITERATIONS = 10 import pygame from pygame.locals import * class AntGrid(object): def __init__(self, width, height): self.width = width self.height = height self.clear() def clear(...
true
106cbbe484ca3a63e109cf91e8cda7d15f4620f2
stevewardle/fab
/Experimental/BenchmarkHashes/hashbench.py
UTF-8
1,377
2.546875
3
[ "LicenseRef-scancode-proprietary-license", "BSD-3-Clause" ]
permissive
#!/usr/bin/env python3 ############################################################################## # (c) Crown copyright Met Office. All rights reserved. # For further details please refer to the file COPYRIGHT # which you should have received as part of this distribution ############################################...
true
b5c6feab4d444ac9f232d037964103c13f6600c7
roganovich/PythonGUI
/cgi-bin/index.py
UTF-8
454
2.84375
3
[]
no_license
import cgi, html request = cgi.FieldStorage() value = html.escape(request.getvalue("text", "")) print("Content-type: text/html; charset=utf-8") print() html = '''<!DOCTYPE html> <html> <body> <h1>My First Heading</h1> <p>My first paragraph.</p> ''' html += ''' <form method="POST"> <input type="text" name="text" valu...
true
d98321f81033f1f75ce3e734256c5ea1a42dfa65
webster-hunter/tastetester
/ShortTerm_TasteTracker.py
UTF-8
1,937
2.921875
3
[]
no_license
import csv import sys import spotipy import spotipy.util as util from datetime import date # GOAL 1 (COMPLETED: 9/10/20): PUT DAILY SHORT TERM TRACK AND ARTIST DATA INTO CSV FILES ON SINGLE LINE # GOAL 2 (UPDATED: 9/10/20): AUTOMATE RUNNING OF SCRIPT # append row of data def append_row(filename, row): ...
true
dcaf46a9bec38e0e5bf5d334c25f9b6ee58ecb24
Akankshaaaa/OpencvPythonTutorial
/chp_3.py
UTF-8
411
3.15625
3
[]
no_license
import cv2 import numpy as np img = cv2.imread("Resources/baby_dory.jpeg") # check dimensions of an image print(img.shape) # outputs (328, 309, 3) # resize image imgResize = cv2.resize(img, (500, 450)) # crop image imgCropped = img[0:250, 170:300] # here height comes first then width cv2.imshow("Image", img) cv2....
true
19672af298513648b78d5a06c7c86595b84ddd42
mixelburg/Sockets-PinkFloyd
/serverFunctions.py
UTF-8
6,353
3.703125
4
[]
no_license
def quitter(): return "quit" def get_album_list(data): """ takes all keys of 'data' dictionary and returns them (returns names of albums) :param data: source :return: string that represents album list """ albums_list = "Album list: \n" for album_name in data: albums_list +=...
true
8243d361a7f6501522b520989ea80352ed4b4738
Robotics-DAI-FMFI-UK/smely-zajko-ros
/jetson-camera/scripts/metrics.py
UTF-8
666
2.765625
3
[]
no_license
import keras.backend as K def mean_iou(y_true, y_pred): y_pred = K.cast(K.greater(y_pred, .5), dtype='float32') inter = K.sum(K.sum(K.squeeze(y_true * y_pred, axis=3), axis=2), axis=1) union = K.sum(K.sum(K.squeeze(y_true + y_pred, axis=3), axis=2), axis=1) - inter return K.mean((inter + K.epsilon()) ...
true
52f6a8536ecc332ff8c060129e17ad60665eee7c
peterhogan/fluent-python
/test_functions.py
UTF-8
1,378
3.484375
3
[]
no_license
from functions import * import pytest class TestClass(): def test_one(self): x = 'this' assert 'h' in x def test_two(self): x = 'hello' assert type(x) is str def test_succ(): assert succ(0) == 1 def test_factorial(): assert factorial(5) == 120 def test_factorial_0():...
true
b737749dc325df40f32bb66b48c39f34c3542cb3
thomas76943/BenchmarkingUtility
/BenchmarkingUtility/bin/Debug/CPUAlgorithms/PythonTest.py
UTF-8
575
2.71875
3
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- import numpy as np from timeit import default_timer as timer from pyculib import rand as curand def VectorAdd(a,b,c): for i in xrange(a.size): c[i] = a[i] + b[i] def main(): start = timer() for x in range(1): N=32000000 A=np.ones(N,...
true
aa60c468b61fb70f17d90f5abcacf8a190d56f0d
JulietaCaro/Programacion-I
/Trabajo Practico 2/Ejercicio 12.py
UTF-8
499
4.625
5
[]
no_license
#12. Utilizar la técnica de listas por comprensión para construir una lista con todos los #números impares comprendidos entre 100 y 200. #FUNCIONES def numerosImpares (): 'Crea una lista donde guarda los numeros impares entre 100 y 200' lista = list(range(100,201)) listaImpares = [num for num in lis...
true
2e79fd16cfd4497880ef5a94a68ea7fd7812ace8
RushanNanayakkara/Javis-Voice-Recognition
/speechRecog.py
UTF-8
937
2.8125
3
[]
no_license
import speech_recognition as sr import pyttsx3 __sampleRate = 48000 __chunkSize = 2048 r = sr.Recognizer() engine = pyttsx3.init() def main(): while 1: with sr.Microphone(sample_rate=__sampleRate,chunk_size=__chunkSize) as src: print("Speek anything") r.adjust_for_ambient_noise(s...
true
ff5da41ea277027e0f3cc086dff5010896ce62c8
tamanyan/coding-problems
/leetcode/083_remove_deplicates_from_sorted_list.py
UTF-8
1,344
3.125
3
[]
no_license
import string from typing import List # Definition for singly-linked list. class ListNode: def __init__(self, x): self.val = x self.next = None class Solution: def deleteDuplicates(self, head: ListNode) -> ListNode: fake = ListNode(0) fake.next = head prev = fake ...
true
32ea8a41e62715ad1a3334cec2d8e3267877df6e
Swarnava77/Indian-and-Non-Indian-Classification-along-with-skin-tone-detection
/pexels.py
UTF-8
959
2.75
3
[]
no_license
from pexels_api import API import requests import os PEXELS_API_KEY = '563492ad6f9170000100000137fec6ab873648a2a212313816e85ae1' keyword = input("Enter your keyword") SAVE_FOLDER=keyword def main(): if not os.path.exists(SAVE_FOLDER): os.mkdir(SAVE_FOLDER) download_images() def dow...
true
3607751cad74e7cdcd16c708ef970f0ebfebaff8
Andrewlearning/Leetcoding
/leetcode/Stack/单调栈(monotonic stack)/42. 接雨水I(单调栈).py
UTF-8
2,617
3.625
4
[]
no_license
class Solution(object): def trap(self, height): """ :type height: List[int] :rtype: int """ # stack只有碰到比stack[-1]小的,才会保留 # 碰到比stack[-1]大的,说明都有可能会构成一个凹槽 stack = [] res = 0 for i in range(len(height)): # 当栈不为空 # 且当前元素高度 >...
true
3802c15295d12f955598fb930ed2f07988d39b6c
marianfx/python-labs
/Lab5/_9_sysinfo.py
UTF-8
1,027
3.140625
3
[ "MIT" ]
permissive
import sys import os def check_version(): vi = sys.version_info.major if vi == 2: print("===Python 2===") else: print("Running under Py3") def get_user_name(): profile = os.getlogin() print("User name: " + profile) def get_script_path(): script_path = os.path.abspath(sys.ar...
true
b944035582f0cba4c16bcbbc72834860e91b722f
jbachlombardo/med-center-simulations
/7_base_case_queueing_timemodel_looped_multistep_terminal.py
UTF-8
31,896
2.578125
3
[]
no_license
import numpy as np import pandas as pd from scipy import stats # ===== FUNCTIONS ===== def generate_service_time_type_condition(data, n_new_service_times = 1, skew = 0.05, n_samples = 1000) : """Get randomized service time based on type of condition To be used only if step in model is Exam by provider""" ...
true
702c3eef70b79284a6bd2dc5bf9f0d30d4ce714a
leetest2000/PY
/Meraki_switch.py
UTF-8
3,533
2.71875
3
[]
no_license
import requests import json import csv import meraki from datetime import datetime # Get the current timestamp timestamp = datetime.now().strftime('%y%m%d') def write_org_data_to_csv(data, filename): """ Write organization data to CSV file """ csv_header = ['id', 'organizationId', 'name', 'productType...
true
f043a13c9810597a50abe704314e6a90cfe9c6d9
huhudaya/leetcode-
/LeetCode/633. 平方数之和.py
UTF-8
820
3.703125
4
[]
no_license
''' 给定一个非负整数 c ,你要判断是否存在两个整数 a 和 b,使得 a2 + b2 = c 示例1: 输入: 5 输出: True 解释: 1 * 1 + 2 * 2 = 5 示例2: 输入: 3 输出: False ''' # java ''' public class Solution { public boolean judgeSquareSum(int c) { for (long a = 0; a * a <= c; a++) { double b = Math.sqrt(c - a * a); if (b == (int) b) ...
true
585d11cb736dd30f422b8e264d02bcc6182e8d8a
lostcalpolydude/checkers
/checkers/hashutils.py
UTF-8
810
2.78125
3
[]
no_license
import base64 def long_to_base64(value): rval = '' value = long(value) while value > 0: rval += chr(value & 255) value = value >> 8 return base64.urlsafe_b64encode(rval) def base64_to_long(str): rval = 0 str = base64.urlsafe_b64decode(str) for i in range(0,len(str)): rval |= (o...
true
9490756150872f591cc2f66fa31e6cae05118fad
Nandhini-proj/Pelago_assignment
/Extract_Reddit_S3/Reddit_s3/helper_functions.py
UTF-8
1,905
2.546875
3
[]
no_license
# helper_functions.py import pandas as pd from datetime import time,datetime,date from io import BytesIO,TextIOWrapper from sys import stdout import json import logging import sys import boto3 import gzip formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s') logger = logging.getLogger(_...
true
02ab7087d7b55f639dd7d0773fbc22195b29c236
llfwer/python
/图像处理/模版匹配.py
UTF-8
6,546
2.796875
3
[]
no_license
import time import cv2 import numpy as np from matplotlib import pyplot as plt def template_match(): img = cv2.imread("data/whole.png", 0) img2 = img.copy() template = cv2.imread("data/sub.png", 0) w, h = template.shape[::-1] # 6 中匹配效果对比算法 methods = ['cv2.TM_CCOEFF', 'cv2.TM_CCOEFF_NORMED', '...
true
23ddb0b012070607d43107159ee009388017d78e
ckclark/leetcode
/py/license-key-formatting.py
UTF-8
283
2.59375
3
[ "Apache-2.0" ]
permissive
class Solution(object): def licenseKeyFormatting(self, S, K): """ :type S: str :type K: int :rtype: str """ S = S.replace('-', '').upper() return '-'.join(S[max(0, i):i + K] for i in xrange(-((K - len(S)) % K), len(S), K))
true
520e8d91c0a9c2764efa55d9be857796d11b88a8
kumarjitpathakbangalore/backup
/Text analysis/Redw_python_preprocessing.py
UTF-8
1,076
2.59375
3
[]
no_license
from collections import defaultdict import csv d = defaultdict(list) #open the log file for preprocessing f_input = open("C:/Users/Public/Documents/Edw_logs_800Mb/alert_edw01t1.log.old.20170703","r") i = 0 key = '' #for Redw log files prepare the documents as per delimiters for line in f_input: i = i + 1 ...
true
dec191fc6ff264c98409cebfc75458dadd07604c
JCuomo/Cube-3DWorld-NLP
/main test/class_3Danimation.py
UTF-8
2,737
2.703125
3
[]
no_license
#!/usr/bin/env python # coding: utf-8 import numpy as np import matplotlib.pyplot as plt import mpl_toolkits.mplot3d.axes3d as p3 import matplotlib.animation as animation import matplotlib.colors as mpcolors class Animation3D(): def __init__(self): #self.fig = plt.figure() self.color_list = lis...
true
a0bc7b9af696e8ef700fd7344a0b18809584c280
kenmgrimm/led_fretboard
/led_midi_since.py
UTF-8
19,525
3.125
3
[]
no_license
import time from neopixel import * # LED strip configuration: LED_COUNT = 100 # Number of LED pixels. LED_PIN = 18 # GPIO pin connected to the pixels (must support PWM!). LED_FREQ_HZ = 800000 # LED signal frequency in hertz (usually 800khz) LED_DMA = 5 # DMA channel to use for ...
true
bbec4e37dbb82d7c1943b8b831d10eeb84ebce50
pangchuan99/older_version_selenium
/时间/s.py
UTF-8
853
3.5
4
[]
no_license
# 引入time模块 import time import datetime ticks = time.time() print ("当前时间戳为:{}".format(ticks)) #获取当前时间 localtime = time.localtime(time.time()) print ("本地时间为 {}:".format(localtime)) # 格式化成2016-03-20 11:45:39形式 #%Y Y是年的意思 #%m M是月的意思 #%d D是日的意思 #%H H是小时的意思 #%M M是分钟的意思 #%s S是秒的意思 a1="2020-05-08 16:36:44" #...
true
5a27e3c0cefe9f3a76f970f57169cc929939a651
daniel-ob/pytest-selenium-framework
/testdata/testdata.py
UTF-8
582
3.203125
3
[]
no_license
import csv class DataCollector: def __init__(self, file): self.file = file def get_test_data(self): try: test_data = [] with open(self.file, 'r') as csv_file: reader = csv.reader(csv_file) # skips first row of file (header) ...
true
5282c7939f32037c5ff13d99f3e5d9355da220e0
openforcefield/openforcefield-forcebalance
/analysis_scripts/find_related_angle.py
UTF-8
558
2.6875
3
[]
no_license
# coding: utf-8 import sys import json data = json.load(open('smirnoff_parameter_assignments.json')) mset = [] a = sys.argv[1] for m, terms in data.items(): for t in terms: if t['id'] == a: mset.append([m, t]) print(f'Angles matching {a}') for m, t in mset: print(m, t) print('T...
true
afb3877b8db53521d84c93f481e47a79f9ca440d
wenyenwei/mlnlp
/sentiment.py
UTF-8
1,074
2.921875
3
[]
no_license
import pandas as pd import numpy as np from sklearn.feature_extraction.text import TfidfTransformer, TfidfVectorizer, CountVectorizer from sklearn.model_selection import train_test_split from sklearn.linear_model import LogisticRegression from sklearn import preprocessing from sklearn.ensemble import RandomForestClassi...
true
0b0ba7b395bc981d287743b024da3cb7eb4c7dfc
owenluu0321/me
/week2/exercise1.py
UTF-8
1,441
4.71875
5
[]
no_license
""" Commenting skills: TODO: above every line of code comment what you THINK the line below does. TODO: execute that line and write what actually happened next to it. See example for first print statement """ import platform # I think this will print "hello! Let's get started" by calling the print function. print("h...
true
5fc40a8ddf56f38efa085dff154a2cb33b72aa71
cloud2010/dl-models
/multi-label/sk-mutli-label.py
UTF-8
3,572
2.921875
3
[]
no_license
# -*- coding: utf-8 -*- """ A implementation of scikit-learn based module for multi-label classification. Date: 2019-10-05 """ # import os import time from argparse import ArgumentParser, ArgumentDefaultsHelpFormatter __author__ = 'Min' if __name__ == "__main__": start_time = time.time() parser = ArgumentPar...
true
34c74c9bdb5b4d239d9ce35a853d4265255ec2e4
coder123n/countyDemographicsLab2
/countyDemographics.py
UTF-8
2,085
2.765625
3
[]
no_license
from flask import Flask, request, Markup, render_template, flash, Markup import os import json app = Flask(__name__) def get_state_options(counties): listofstates=[] option="" for data in counties: if data["State"] not in listofstates: listofstates.append(data["State"]) ...
true
7244dcc07a05133cb8f2bef2d322257c69e8c04e
fahadahammed/Tech0-ToDo
/ToDo/Model/_m_Todo.py
UTF-8
5,239
2.734375
3
[]
no_license
import os, json, sys, datetime, time from ToDo.Library.TimeCalculator import TimeCalculator from ToDo.Library.JsonDatabaseLibrary import JsonDatabaseLibrary import uuid class _m_ToDo: def __init__(self, username): self.dtnow = str(datetime.datetime.now()) self.username = username def all_todo...
true
4487eded01dc9ec5b228fbe72e9545c18eaa04b0
dayes/curso_Python
/SOLUCIONES/SOLUCIONES/intermedio II/1.listas/prueba.exe/ordenados.py
UTF-8
222
3.296875
3
[]
no_license
L=[1,2,4,5,6,7,7,7,-8] orden = True for i in range(0,len(L)-1): if L[i] > L[i+1]: orden = False; if orden: print ("Esta ordenado") else: print ("NO ordenado")
true
dc568bd6e3e25b9683da49bc5aa26fffe8243dcd
piaoapiao/imageToText
/image.py
UTF-8
395
2.875
3
[]
no_license
# -*-encoding:utf-8-*- import pytesseract from PIL import Image def main(): image = Image.open("123.png") #image.show() #打开图片1.jpg text = pytesseract.image_to_string(image,lang='chi_sim') #使用简体中文解析图片 #print(text) with open("output.txt", "w") as f: #将识别出来的文字存到本地 print(text) f.write(str(text)) if __name__ ==...
true
47d45edd3575aea82cf398cf0a9c4a9adb54608b
HYBB-rash/python-data-ana
/tmp/ch3_numpy.py
UTF-8
10,789
3.75
4
[]
no_license
#!/usr/bin/env python # -*- encoding: utf-8 -*- ''' @File : numpy.py @Time : 2021/06/25 09:41:43 @Author : hyong @Version : 1.0 @Contact : hyong_cs@outlook.com ''' # here put the import lib # %% import numpy as np # * 创建一个列表 data_1 = [1, 2, 3, 4] # * 数组化 ndarray_1 = np.array(data_1) type(ndarray_...
true
89bc3abb9a8ee2ccff5e567d7f92d51bef4f67ad
thekevinscott/AudioData
/AudioData/transforms.py
UTF-8
1,673
2.625
3
[ "MIT" ]
permissive
from __future__ import print_function from .utils import get_files_from_dir import random import math from pydub.effects import compress_dynamic_range def randF(min, max, divisor = 1000): r = random.randint(int(min * divisor), int(max * divisor)) return r / divisor # TRANSFORMS def changeGain(sound, max_amo...
true
fe1ede7937baa3553d535dfb849c86ebfee9860a
AmineIzanami/DataScience-stuff
/keras_try_2.py
UTF-8
3,233
2.875
3
[]
no_license
import numpy as np import matplotlib.pyplot as plt # fix random seed for reproducibility from sklearn.metrics import mean_squared_error from sklearn.preprocessing import MinMaxScaler np.random.seed(7) # Import import pandas as pd import preprocessing as pr data_site_hourly = pd.read_csv(r"data_site/data_148599000000...
true
4e20029728f9604e0b0cfb6ce86580be95b99c72
psavery/hexrdgui
/hexrd/ui/color_map_editor.py
UTF-8
3,889
2.671875
3
[ "BSD-3-Clause" ]
permissive
import copy from matplotlib import cm import matplotlib.colors import numpy as np import hexrd.ui.constants from hexrd.ui.hexrd_config import HexrdConfig from hexrd.ui.ui_loader import UiLoader class ColorMapEditor: def __init__(self, image_tab_widget, parent=None): self.image_tab_widget = image_tab_w...
true
9d9e1c742d4b874618c64a8a1043b03a9098cd21
pratibashan/Day4_Assignments
/prime_number.py
UTF-8
367
4.21875
4
[]
no_license
user_number = int(input("Enter the Number : ")) if user_number > 2: for i in range(2, user_number): if (user_number % i == 0): print(f" Number {user_number} is not a prime number") break else: print(f" Number {user_number} is a prime number") else: print(f"...
true
24b4ed6cdc33f9b3e1f9658aeb4673551477a520
brew/ckanext-scheming
/ckanext/scheming/converters.py
UTF-8
726
2.734375
3
[]
no_license
def convert_from_extras_group(key, data, errors, context): '''Converts values from extras, tailored for groups.''' def remove_from_extras(data, key): to_remove = [] for data_key, data_value in data.iteritems(): if (data_key[0] == 'extras' and data_key[1] == key)...
true
d9866e0f96534bb6a20cc1b9ca0b9399a0629e57
yylhyyw/Python_Crash_Course_Exercise
/Chapter7/7-2_Restautant_Seating.py
UTF-8
412
4.40625
4
[]
no_license
# Write a program that asks the user how many people # are in their dinner group. If the answer is more than eight, # print a message saying they’ll have to wait for a table. # Otherwise, report that their table is ready. number = input("how many people are in the dinner group?") number = int(number) if(number > 8...
true
c42485668fe8a6f88d6ce7175065b8d2baa4c00c
benjaminkaplanphd/traveling-salesperson
/traveling_salesperson/plot.py
UTF-8
1,052
3.578125
4
[ "MIT" ]
permissive
""" Module for plotting the result of the algorithm """ import os from typing import List import matplotlib.pyplot as plt from traveling_salesperson import City def plot_path(filename: str, path: List[str], cities: List[City], total_distance: int) -> None: """Construct and save a plot of the path connecting all...
true
778a59ff2acf53089e4c5c3ecbbb4e5efbe84908
abiraja2004/DocumentSummarization-2
/dataReader.py
UTF-8
5,137
2.921875
3
[]
no_license
import csv import numpy as np import os from html.parser import HTMLParser import urllib3 from bs4 import BeautifulSoup from News_Query.FrequencySummarizer import FrequencySummarizer class HeadingParser(HTMLParser): inHeading = False isHeadline = False targetText = "" inputText = "" def handle_st...
true
3fbe872947e74dedc73eddde7934aef459992936
xXxDevBR/Python-Exercicios
/exec36.py
UTF-8
887
3.65625
4
[]
no_license
# Pegar informações casa = float(input("Digite o valor da casa: R$")) salario = float(input("Digite o seu salário: R$")) anos = int(input("Digite quantos anos você pretende pagar: ")) # calculos meses = anos * 12 prestacao = casa / meses ex = salario * 0.3 # condições if prestacao > ex: print("Valor da Casa: R${}"...
true
979273b8a0b966277290eaafdd3f09285160ab6b
SamirBoulil/open-assembly
/open_assembly/data_loader/import_deputies.py
UTF-8
6,015
2.8125
3
[]
no_license
# coding: utf-8 import os import json import time from datetime import datetime from django.core.exceptions import ObjectDoesNotExist from slugify import slugify from open_assembly.models import Deputy from open_assembly.models import Mandate from open_assembly.models import Circonscription def import_deputies(filep...
true
f8a09eb8490836ffea055eb6bc3670d364509413
Ezi4Zy/leetcode
/1405.最长快乐字符串.py
UTF-8
720
3.046875
3
[]
no_license
# # @lc app=leetcode.cn id=1405 lang=python # # [1405] 最长快乐字符串 # # @lc code=start class Solution(object): def longestDiverseString(self, a, b, c): """ :type a: int :type b: int :type c: int :rtype: str """ d = {'a': a, 'b': b, 'c': c} ret = "" ...
true
ed417b7980dc4d18513884b71ab9e27698f950c6
teohyikhaw/Minesweeper_game
/blockclass.py
UTF-8
3,718
3.125
3
[]
no_license
class testblock: def __init__(self,x,y,dataset): self.x=x self.y=y self.dataset=dataset def get_testcases(self): testcase_filtered=self.field_selector() removal=[] for i in range(len(testcase_filtered)): y1 = testcase_filtered[i][0] x1 = t...
true
c299f9c5ae7bbb33cea07de0d8eaa67580e41dce
lotaku/board-game
/v1.1/client/gwElements/player_old.py
UTF-8
11,405
3.03125
3
[]
no_license
#!/usr/bin/env python # encoding: utf-8 """ 玩家模块 """ import send_packet from player_manager import playerManager #import gwdata import team from team_manager import teamManager #import menu class Player: def __init__(self): self.name="" self.team="" self.teamName="" self.iscaption=...
true
ca6f84aaee2e13794e7c968084da8b35ec02ae30
o-alavi/Fibonacci_Sequence
/fib_3.py
UTF-8
358
3.84375
4
[]
no_license
# ============================================== # ================== METHOD 3 ================== from functools import lru_cache @lru_cache(maxsize=1000) def fib_3(n): if n == 1 or n == 2: return 1 else: val = fib_3(n - 1) + fib_3(n - 2) return val for n in range(1, 35...
true
4c7c0b7b8d13c5b49d5e86c49b9ecf0db40eccef
BarnaTB/AndelaPalindrome
/palindrome.py
UTF-8
1,113
4.4375
4
[]
no_license
def palindrome(): """ Function checks whether or not the user input would be the same when spelt backwards. """ palindromes = [] while True: the_word = raw_input("Please enter a word: ") word = the_word.lower() word = word.replace(' ', '') if word == 'quit': ...
true
1c43ad16d115a41acca090e0fda48c1fe3758dc6
andysharma1997/ai
/experiments/speech-to-text/BenchmarkDeepspeech.py
UTF-8
8,799
2.8125
3
[]
no_license
#!/usr/bin/env python # coding: utf-8 # Here we are going to benchmark [mozilla's deepspeech](https://github.com/mozilla/DeepSpeech). The release claims that deepspeech works on American English achieving an 8.22% word error rate on the LibriSpeech clean test corpus. # Now, since we happen to have ~ 50 hours of americ...
true
c575abe3e4cb0e1bf817e356784c6f5fc9b4a709
jgjimmy/ssmg
/max_posterior.py
UTF-8
5,528
2.734375
3
[]
no_license
""" Functions for computing maximum a-posterior probability estimates of natural parameters given the observed data. --- This code fits a State-space Model of Time-varying multi-graph Ising model. It is based on previous work on State-space Model of Time-varying Neural Interactions previously developed (Shimazaki et ...
true
18f1ca2769f884867821daf2ffeb2c172998798c
jimchenhub/Smart-Car
/source/implementation/avoiding/doXML.py
UTF-8
2,331
2.5625
3
[]
no_license
# -*- coding: utf-8 -*- import numpy as np from xml.dom import minidom from xml.etree import ElementTree as ET def createXML( path, ret_val, mtx1_val, dist1_val, mtx2_val, dist2_val, R_val, T_val, E_val, F_val): doc=minidom.Document() root = doc.createElement('root') ret = doc.createElement('ret') ret....
true
8047d3e9e5f7ae45d77bba0f0503d2a619385398
UnitedHolmes/ECE-8803-Probabilistic-Graphical-Models-for-Machine-Learning-
/house_votes_data.py
UTF-8
1,350
2.59375
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Tue Apr 10 13:32:03 2018 @author: yzhu94 """ import numpy as np file = open("house-votes-84.data","r") lines = file.readlines() #votes_democrats = np.zeros([len(lines),16]) #votes_republican = np.zeros([len(lines),16]) # For matrix votes, first column is party # 0 for republican...
true
c51999ae7a9145b0b58c711c01f5de33195b0d6e
NicoleeeTian/CS111
/PS1/ps1pr5.py
UTF-8
704
3.765625
4
[]
no_license
# ps1pr5.py - Problem Set 1, Problem 5 # # Functions with numeric inputs # def last_first(values): """return a list contains the first and last values from the original one """ last = values[-1] first = values[0] return [last, first] def every_other(values): """return a list only contains the ...
true
94f2789eb38fdc5968173f1a534f3b7324fce47c
noonv/dodorobot
/dodo_scrapping.py
UTF-8
7,287
2.578125
3
[]
no_license
#!/usr/bin/python3 # -*- coding: utf-8 -*- ''' get data from Dodopizza site ''' __author__ = 'noonv' import requests from requests import Session import bs4 import os import sys import pandas as pd base_url = 'https://dodopizza.ru' headers = { 'user-agent': 'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/...
true
d09117046afb5842fad4f895387d0f5b598ee841
leboralli/biopython_rep
/gc_count_fasta.py
UTF-8
511
2.609375
3
[]
no_license
from Bio import SeqIO def count_gc(seq): total = seq.count('G') + seq.count('C') return (100*total)/len(seq) dict = {} with open('rosalind_gc.txt', 'rU') as handle: record_dict = SeqIO.to_dict(SeqIO.parse(handle, 'fasta')) for i in record_dict: print(record_dict[i].id) print(count_gc(...
true
d48d9d3e2e2176de7b8e0db277e0ba14b67f5bcc
ninedotnine/library
/spinner.py
UTF-8
622
2.8125
3
[]
no_license
#!/usr/bin/python3 from tass import * def draw(): page.clear() page.line((x, y),(column,row)) page.fill('#') page.paint() if not sleep(): quit() if __name__=='__main__': Width_=80; Height_=32 init('Spinner',width=Width_, height=Height_) x = 39; y = 19 page = screen() w...
true
19ab1ed86ce84e3a07fb65dbe5f3ab6bfcbdec8b
aniltrue/MLProject
/RNNLayers/GRU.py
UTF-8
4,181
2.75
3
[]
no_license
from RNNLayers.RNNBuilder import RNNCellBuilder, AbstractRNNBuilder, AbstractBiRNNBuilder def gru_cell(units: int, kernel_activation: str = "tanh", recurrent_activation: str = "hard_sigmoid", kernel_initializer: str = "glorot_uniform", recurrent_initializer: str = "...
true
7acaba5114459b712706f4f78d6a042904a0bd93
thestics/py_drop_box
/app.py
UTF-8
4,533
2.609375
3
[]
no_license
#!/usr/bin/env python3 # -*-encoding: utf-8-*- # Author: Danil Kovalenko import os from functools import partial from request import Request from response import Response from util import render_template as _render_template from defaults import TEMPLATE_ENV class App: template_env = TEMPLATE_ENV request_cl...
true
c6a1c3d8bb448fc2799fc5bdf365c884d41aac30
spirit1234/location
/python_work/作业/12-4动手试一试/test_key.py
UTF-8
1,614
3.5
4
[]
no_license
# -*- coding:utf-8 -*- import pygame import sys def test_key(): """ 按键 : 创建一个程序, 显示一个空屏幕。 在事件循环中, 每当检测到pygame.KEYDOWN 事件时都打印属性event.key 。 运行这个程序, 并按各种键, 看看 Pygame如何响应。""" pygame.init() size = (1000, 600) bg_color = (255, 255, 255) text_color = (0, 0, 0) screen = pygame.display.set_mode(siz...
true
c7cdbe3703fefea51ef3d4b070b467eab8e67e68
liberty-askew/MainProjects
/MonteCarlo/hist_scatter.py
UTF-8
1,701
3.40625
3
[]
no_license
def hist_scatter(x,y): import numpy as np import matplotlib.pyplot as plt from matplotlib.ticker import NullFormatter nullfmt = NullFormatter() # no labels # definitions for the axes left, width = 0.1, 0.65 bottom, height = 0.1, 0.65 bottom_h = left_h = left + width + 0.0...
true
ed2d1fefd693c55b5d5dc093d5722ec7fb23c0f8
avelikev/Exercises
/introduction_to_python/functions/2_max_value/Solution/solution.py
UTF-8
301
3.3125
3
[]
no_license
# Code your solution here def value(a,b,c): if a>b and a>c: max_value=a elif b>a and b>c: max_value=b elif c>a and c>b: max_value=c else: max_value=None return max_value a=int(input()) b=int(input()) c=int(input()) result=value(a,b,c) print(result)
true
fbf25ddb7cb80fc955efa58afe41d76bc2427b83
austinmw/Grokking-Deep-Learning
/xor_mnist_nns/tf_xor_detailed.py
UTF-8
5,225
2.765625
3
[]
no_license
""" Still vanilla TensorFlow, but a more complex example including single 3-node hidden layer with sigmoid activation In addition: - more sophisticated weight initialization - layer function - batch support (although not needed or really used for XOR) - tensorboard logging - saving best checkpoint - continuing trainin...
true