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
3c8af7a1d93d5e9db764821963af6c4179f66067
vishal9565/speed_reading
/utils/file_operations.py
UTF-8
413
2.53125
3
[]
no_license
""" I/O operations ========================== Module implements the io function like checking the file whether that exists or not and various other kind of file operation """ import json import logging import os __author__ = "vishalkumar9565@gmail.com" LOGGER = logging.getLogger(__name__) def load_json(file_path):...
true
e41d708b0e36a33d26b8e531979721d84abc84f4
Abled-Taha/Spammer
/Scripts/MainWindow.py
UTF-8
7,525
2.640625
3
[]
no_license
import sys import threading from PyQt5 import QtWidgets from PyQt5.QtWidgets import * import spammer as sp App = QApplication(sys.argv) MainWindow = QtWidgets.QMainWindow() MainWindow.setGeometry(100, 50, 500, 250) MainWindow.setWindowTitle("Spammer") # Variales MainWindowShowRun = 0 FirstSection = 0 SecondSection = ...
true
34fc55ad2822c6117911b30e5e68f7d1d0c43053
Schalk1996/Robotics
/Wall.py
UTF-8
3,386
3.015625
3
[]
no_license
from gpiozero import PWMOutputDevice from time import sleep import time import RPi.GPIO as GPIO GPIO.setmode(GPIO.BCM) # Using BCM pin config #/////// Define Motort drivers /////// PWM_FORWARD_LEFT_PIN = 26 PWM_FORWARD_RIGHT_PIN = 13 PWM_REVERSE_LEFT_PIN = 19 PWM_REVERSE_RIGHT_PIN = 6 #////// Define pins for ultras...
true
7ecb1308c9b63adc5c718b84cededa023d3fd95a
glusooner/oop
/main.py
UTF-8
826
3.5
4
[]
no_license
'oop fun begins here' class User: def log(self): print('i am a customer') class Teacher(User): def log(self): print('i am a teacher') class Customer(User): def __init__(self,name,membership_type): self.name = name self.membership_type = membership_type def __st...
true
98765e676b37c78113cb41edf210531a6423ff2c
zhaopeiyang/PythonLearning
/python_180906_返回函数(闭包).py
UTF-8
1,674
4.53125
5
[]
no_license
# 高阶函数除了可以接受函数作为参数外,还可以把函数作为结果值返回。 def lazy_sum(*args): def sum(): s = 0 for n in args: s += n return s return sum f = lazy_sum(1, 3, 5, 7, 9) print(f) # <function lazy_sum.<locals>.sum at 0x1039072f0> print(f()) # 25 # ## 返回闭包时牢记一点:返回函数不要引用任何循环变量,或者后续会发生变化的变量。 # def count(): l = [] for i in range(...
true
64ad40b548b1ce261356875ace861b2268968e6f
ningxu2020/python201
/myrandgenerator.py
UTF-8
250
3.703125
4
[]
no_license
def my_random_generator(iterable): import random my_iterable = list(iterable) random.shuffle(my_iterable) while len(my_iterable) > 0: yield my_iterable.pop() mri = my_random_generator('hello') for item in mri: print(item)
true
a41dc10e3e9a4c294bdc72fac3afe161ea449506
lorandcheng/led-games
/client/parsersM.py
UTF-8
403
3.046875
3
[]
no_license
def parseMessage(msg): message = str(msg.payload, "utf-8") parsedMessage = [] if message[0] == "[": message = message[2:len(message)-2] for entry in message.split("), ("): entry = entry[1:len(entry)-1] parsedMessage.append(tuple(entry.split("', '"))) else: ...
true
39a6a5103f410fdf56200c34ba12b92d6df03195
micaelwidell/kindle-highlights-to-evernote
/kindle-highlights-to-evernote.py
UTF-8
5,501
2.65625
3
[ "MIT" ]
permissive
import re from datetime import datetime import codecs try: # for Python2 from Tkinter import * import tkMessageBox except ImportError: # for Python3 from tkinter import * from tkinter import messagebox as tkMessageBox class EvernoteFile(): notes = [] def add_book_quote(self, title, author,...
true
96a522e12db114f9a17603da4f0e7df9233e4e48
alanpengz/UVLC_image_serial
/lib/fountain_lib.py
UTF-8
16,341
2.875
3
[]
no_license
# _*_ coding=utf-8 _*_ from __future__ import print_function from math import ceil, log import sys, os import random import json import bitarray import numpy as np from time import sleep import logging # from matplotlib import pyplot as plt # plt.ion() LIB_PATH = os.path.dirname(__file__) DOC_PATH = os.path.join(LIB_...
true
caf11957f8924e26ec773627ce8a7b3cbf85cb27
sandhoefner/sandhoefner.github.io
/6034/lab6/training.py
UTF-8
8,174
3.046875
3
[ "MIT" ]
permissive
#!/usr/bin/env python2 # MIT 6.034 Lab 6: Neural Nets # This file originally written by Joel Gustafson and Kenny Friedman from sys import argv from random import random, shuffle from matplotlib import pyplot import numpy from lab6 import * def multi_accuracy(desired_outputs, actual_outputs): pairs = [] actua...
true
dc9d50800e260ed652189f26fd95d0104b1f3e2a
johnnychhsu/leetcode
/654_maximum_binary_tree/solution.py
UTF-8
1,065
3.46875
3
[]
no_license
# Definition for a binary tree node. # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution: def constructMaximumBinaryTree(self, nums: List[int]) -> TreeNode: def build(root, left_array, right_array): root = T...
true
e157311882043d2c2ba2d02c33c1bcccee53c665
xiaojianliu/two-method
/method1.py
UTF-8
2,132
2.921875
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Sat Nov 3 21:19:50 2018 @author: xiaojian """ from math import radians, cos, sin, atan, sqrt import numpy as np from matplotlib.path import Path from scipy import interpolate from datetime import datetime, timedelta import matplotlib.pyplot as plt from matplotlib.p...
true
2dd225b176371cb12de40fc91d4d0db1bfc2ebb1
richsurgenor/project-needle
/archived/scikit_thresholding.py
UTF-8
835
2.84375
3
[]
no_license
import matplotlib.pyplot as plt from skimage import data from skimage.filters import threshold_otsu from skimage.color import rgb2gray import os #image = data.camera() filename = "fake_images/Screen Shot 2019-08-22 at 11.06.38 AM.png" from skimage import io moon = io.imread(filename) image = rgb2gray(moon) thresh = t...
true
213269b2e77036bb9be847bfb857b0dfb32f56e9
Trajanson/Image-Mirror
/app/__init__.py
UTF-8
1,436
2.625
3
[]
no_license
from flask import Flask, render_template, request, make_response,\ redirect, url_for, flash, send_file from StringIO import StringIO from werkzeug import secure_filename ALLOWED_EXTENSIONS = set(['txt', 'pdf', 'png', 'jpg', 'jpeg', 'gif']) app = Flask(__name__) app.secret_key = 'A0Zr98j/3yX R~XHH!jm...
true
9ebf7f2bad6dc02d1c1c7f9b0b0e19fc4e56ce2d
suhassrivats/Data-Structures-And-Algorithms-Implementation
/Problems/Leetcode/457_CircularArrayLoop.py
UTF-8
1,644
3.8125
4
[]
no_license
class Solution: def circularArrayLoop(self, nums: List[int]) -> bool: """ Time Complexity: The above algorithm will have a time complexity of O(N^2) where ‘N’ is the number of elements in the array. This complexity is due to the fact that we are iterating all elements of ...
true
55540d2c67ef815b9c2d38d66b484f21b9f19750
BhawyaNavkunj/Project106
/correlation.py
UTF-8
790
3.21875
3
[]
no_license
import numpy as np import plotly.express as px import csv def get_data_source(data_path): days_present = [] marks_in_percent = [] with open(data_path) as file: reader = csv.DictReader(file) for row in reader: days_present.append(float(row["Days Present"])) ...
true
bf8058cc376f3ae370bef427a3884aeba8e773a8
Tony-Jason/Python-Assignment
/Day 2/Filter.py
UTF-8
1,550
2.9375
3
[]
no_license
data = [ {"id": "111", "name": "phone", "cost": 10000, "brand": "onePlus", "rating": "5", "discount": "20", "category": "electronics"}, {"id": "222", "name": "shirt", "cost": 2000, "brand": "Tommy", "rating": "5", "discount": "15", "category": "clothing"}, {"id": "333", "name": "shirt", "cost": 15...
true
e4c5a29cce7764253dd3ee9f70e656ec249ac014
Dharian/pythonProject
/Ejercicios/Palabra/Ejercicio2.py
UTF-8
129
3.8125
4
[ "MIT" ]
permissive
nombre= str(input("Cual es tu nombre?")) edad=int(input("Cual es tu edad?")) print("Tu nombre es: ", nombre, "y tu edad: ", edad)
true
ca0d01e9f51e2311e249bfcf383ea5e8dd29c0ac
parv3213/Python-Archived
/class 12 lab file/MINE/class3.py
UTF-8
814
3.015625
3
[]
no_license
class photo: def __init__(self): self.pno=0 self.category="" self.exhibit="" def fixexhibit(self): if self.category=="x": self.exhibit=="y" elif self.category=="P": self.exhibit=="M" elif self.category=="o": self.exhi...
true
29f497c172268eb482072b7e0a201d9bbee9a727
ronenomer96/HaeuplerProject
/tmp/tests/linearPRNG.py
UTF-8
1,014
3.046875
3
[]
no_license
""" Input seed- starting seed (X0) desiredLength- length of the desired output """ import numpy as np import math import datetime import random m=np.int((2**31)-1) a=np.int(48271) def linearPRNG(seed,desiredLength): newString=seed listOfStrings=[newString[start:start+32] for start in range(0,len(newString),3...
true
dbbb64ac7e690802f4a54502596a1c2cbd03911d
VKrokhmal/-yea
/exercises/09_functions/task_9_3a.py
UTF-8
1,842
3.359375
3
[]
no_license
# -*- coding: utf-8 -*- """ Задание 9.3a Сделать копию функции get_int_vlan_map из задания 9.3. Дополнить функцию: добавить поддержку конфигурации, когда настройка access-порта выглядит так: interface FastEthernet0/20 switchport mode access duplex auto То есть, порт находится в VLAN 1 В таком сл...
true
a2f9d2b5c9b7570f7422493f4161e3b866e16bd0
gjbex/training-material
/Python/Mixin/driver.py
UTF-8
141
3.03125
3
[ "CC-BY-4.0" ]
permissive
#!/usr/bin/env python import Circle if __name__ == '__main__': c = Circle.Circle(2.0, 3.0, 1.5, 'red') print(c.color) print(c)
true
c7d0c2673944fd895f70d81cb56b0ac93cda2435
DazzleTan/Turle
/lesson60_2.py
UTF-8
202
3.765625
4
[]
no_license
''' 使用circle()方法绘制小圆,外面均匀分布3个大圆 ''' import turtle as t t.hideturtle() for i in range(0,3): t.circle(10, 120) t.lt(180) t.circle(40) t.lt(180) t.done()
true
d0abba959beefcebc2486a1dff92a1b4f2c727c0
xJINC/cpy5python
/practical03/q8_convert_milliseconds.py
UTF-8
453
3.953125
4
[]
no_license
# Filename: q8_convert_milliseconds.py # Author: Jason Hong # Created: 20130222 # Modified: 20120222 # Description: Program to display an n by n matrix def convert_ms(n): seconds = n // 100 minutes = seconds // 60 hours = minutes // 60 seconds = seconds - minutes * 60 minutes = minutes - hours * ...
true
846a637f5b0dfdbdf7e595d6ea2dfca61a28b256
rahulr56/TextAnalytics-kNN-Boosting
/src/opticalRecogniser.py
UTF-8
2,762
2.9375
3
[]
no_license
print "Setting up system" print "Importing libraries" import subprocess import pandas as pd from datetime import datetime as dt import sklearn.neural_network as sknn from sklearn.utils.validation import column_or_1d from sklearn.neighbors import KNeighborsClassifier as knc #seed=int(str(dt.now()).translate(None,":-. "...
true
fadaee4b1a61c347ac5041bca99fd6d76dda2c34
andygaspar/Natalia
/old/Model/model.py
UTF-8
4,550
2.515625
3
[]
no_license
import pandas as pd import numpy as np import xpress as xp from itertools import combinations xp.controls.outputlog = 0 class Area: def __init__(self, name, index, df): self.name = name self.index = index self.capacity = dict(zip(df.period, df.capacity)) self.demand = dict(zip(df....
true
ba3b3801fec1519010e30aebd5a6ff2898f033d6
CDownPace/Django-mysql
/six_objext_queryset/front/views.py
UTF-8
1,499
2.515625
3
[]
no_license
from django.shortcuts import render from django.http import HttpResponse from .models import Book,Author,BookOrder from django.db.models.manager import Manager from django.db.models.query import QuerySet from django.db.models import Q,F,Count from django.db import connection # 用于取反操作 from django.db.models.query import...
true
9f73f135dbb7bf08f6e67e78897cb462954b7e58
NidhalTormane/GMC
/Lets test your python skills !!!/2nd question.py
UTF-8
248
3.65625
4
[]
no_license
f=1 x=input() x=int(x) while x<0: print ("Type again your3 positive integer") x=input() x=int(x) if x > 1 : i = x while i!=1 : f = f * i i = i - 1 print("the factorial of " + str(x) + " is " + str(f))
true
2adffd4cac63e8dd763aa6141e2a988285d380e5
gpaOliveira/cryptography
/Vigenere/constants.py
UTF-8
360
2.546875
3
[ "MIT" ]
permissive
LETTERS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' #taken from https://en.wikipedia.org/wiki/Letter_frequency FREQUENCY_IN_ENGLISH = [0.008167,0.001492,0.002782,0.004253,0.012702,0.002228,0.002015,0.006094,0.006966,0.000153,0.000772,0.004025,0.002406,0.006749,0.007507,0.001929,0.000095,0.005987,0.006327,0.009056,0.002758,0.00097...
true
4e84605f7bb0f9f01d4592f513f92599b64e06f8
sky-s/actuator-disc
/actuator_disc.py
UTF-8
2,799
3.265625
3
[ "BSD-2-Clause" ]
permissive
"""Actuator disc momentum theory functions. Notes: area is the effective area of the actuator disc. disc_efficiency, induced_power/shaft_power, is the efficiency of shaft power adding momentum to the flow in the useful (i.e. axial) direction, which captures losses from effects such as swirl and viscosity. Default dis...
true
dbb80159b98b3c82c4b3244c9ac1d286158a7b82
CamilArmijo/syllabus
/Tareas/Tarea0/23/T0.py
UTF-8
4,840
3.09375
3
[]
no_license
print("Bienvenido a DCConecta2") respuesta=0 lista_usuarios_registrados=[] lista_usuarios=[] lista_contactos=[] respuesta_chat=0 lista_mensajes=[] ################################ archivo_nombres=open("../T0/usuarios.csv", "r") lineas = archivo_nombres.readlines() for linea in lineas: lista_usuarios.append(line...
true
37913714a5dfdd627f9b3ba516b4e52c6ec01789
ryuo07/C4TB
/session10/exercises/create_pair_from_unit.py
UTF-8
226
3.09375
3
[]
no_license
person = { "name" : "latina", "description" : "cute", "species" : "demon", "hair color" : "white", } print(person) a = input("enter new key:") b = input("enter new value:") person[a] = b print(person)
true
8a94f9dbd3a1d48ccd0c09e36ee4f8ef23fb6411
dneumann20/NLPproject
/sourcecode/Gui/implementation.py
UTF-8
5,920
2.53125
3
[]
no_license
from googleapiclient.discovery import build #import nltk #import numpy as np import pandas as pd import time import re from googlesearch import search from nltk.stem import WordNetLemmatizer from nltk.corpus import stopwords from nltk.corpus import wordnet import flask #import os #import webbrowser #from flask impor...
true
36419a86961963948612be252e554f77fae01544
cccntu/my-line-bot
/grpc-transformer/client.py
UTF-8
741
3.078125
3
[]
no_license
import os import grpc import info_pb2 import info_pb2_grpc class Host(): def __init__(self, address, name=''): self.name = name self.channel = grpc.insecure_channel(address) self.TextGenerationServiceStub = info_pb2_grpc.TextGenerationServiceStub(self.channel) def generate_text(self, t...
true
76f9b20a7f30397ce4a3b0eb5dab93856dc85382
gabriellaec/desoft-analise-exercicios
/backup/user_068/ch3_2020_03_09_13_14_30_381012.py
UTF-8
144
2.625
3
[]
no_license
from math import e, sqrt, pi def calcula_gaussiana (x, mi, sigma): y= (1/ (sigma * sqrt(2*pi)))* e**(-0.5*(((x-mi)/sigma))**2) return y
true
2c13795d382072b2ee8234803a17997e42603853
enixdark/microservice-demo
/simple/python/service-auth/app/models/auth.py
UTF-8
1,748
2.671875
3
[]
no_license
from app import db from werkzeug.security import (generate_password_hash, check_password_hash) from flask_validator import (ValidateString, ValidateEmail, ValidateBoolean) from .base import CRUDMixin class Auth(CRUDMixin, db.Model): __tablename__ = 'auths' id = db.Column(db.String,primary_key=True) email =...
true
97cb6b0bb6c600d21c2dac787babddf14278a721
Blacky001/banter
/banter/Core/client.py
UTF-8
556
2.703125
3
[]
no_license
# Client program from socket import * from chat_client import * # Set the socket parameters host = "192.168.1.7" #remote host port = 21567 buf = 1024 addr = (host,port) host1 = "192.168.1.9" #localhost port1 = 57877 addr1=(host1,port1) # Create socket UDPSock = socket(AF_INET,SOCK_DGRAM) UDPSock.bind(addr1) def_msg ...
true
c288357f57d7b1c97ce625c0cc44bca202bb2b29
Miguel-Ramirez14212339/movie
/src/movie/validators.py
UTF-8
397
2.890625
3
[]
no_license
from django.core.exceptions import ValidationError #n = ('1', '2', '3', '4', '5', '6', '7', '8', '9', '0') def Validate_studio(value): if value[0].isupper(): return value else: raise ValidationError("Must huve upper case letter") #for x in n: #if x in value: #raise Val...
true
58d0f634a3f01f97fcd5a3a6f0e1525e8aedf3de
smartgang/DataCollection
/riceQuant/riceContractDataTransfer.py
UTF-8
14,074
2.53125
3
[]
no_license
# -*- coding: utf-8 -*- import time import pandas as pd from datetime import datetime import os # 时间格式转换 def getEndutc(ricedf): # print ricedf['Unnamed: 0'] # 有些的时间列没有index 的列名,要使用'Unnamed: 0' return int(time.mktime(time.strptime(ricedf['Unnamed: 0'], '%Y-%m-%d %H:%M:%S'))) def getEndutcfor1d(ricedf): ...
true
fa6819a0b3927dbc5c4bd6814e6a3354e9257139
Ahmedabied/vigenere.py
/vigcip.py
UTF-8
1,235
2.921875
3
[]
no_license
from sys import argv;import string #chars=string.ascii_letters+string.digits try: chars="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" def gtkey(key, plaintxt, keyd="", counter=0): while len(keyd) != len(plaintxt): if counter == len(key): counter = 0 if plaintxt[len(keyd)] == " ": key...
true
595ddb4e2d265a8515c9134bbacabbcca66987c6
Incogniter/incognito
/pickling.py
UTF-8
1,774
2.9375
3
[]
no_license
import pickle imelda = ('More Mayhem', 'IMelda May', '2011', ((1, 'Pulling the Rug'), (2, 'Psycho'), (3, 'Mayhem'), (4, 'Kentish Town Waltz'))) with open("imelda.pickle", 'wb') as pickle_file: pickle.dump(imelda, pickle_file) with open("im...
true
7bf55667aed8fd3dffff071a56e92eea6dd3059e
abhishekBhartiProjects/pythonProjects
/project3_colorful_creation.py
UTF-8
1,319
3.484375
3
[]
no_license
from turtle import * import random # define functions def getRandomColor(): randomColor = '#' + random.choice('0123456789ABCDEF') + random.choice('0123456789ABCDEF') + random.choice( '0123456789ABCDEF') + random.choice('0123456789ABCDEF') + random.choice('0123456789ABCDEF') + random.choice( '012345...
true
42b385768a54e825586b2e9777fa48cf53fb1205
amalshehu/exercism-python
/pythagorean-triplet/pythagorean_triplet.py
UTF-8
1,046
3.703125
4
[ "MIT" ]
permissive
# File: pythagorean_triplet.py # Purpose: A Pythagorean triplet program # Programmer: Amal Shehu # Course: Exercism # Date: Thursday 29 September 2016, 04:30 PM from math import sqrt from fractions import gcd def triplets_in_range(min_value, max_value): triple = set() for a in range(m...
true
0ca008b7a7b5c60856c5f18511df5fb6d2722158
mrToad1986/Python
/lesson 6.3.py
UTF-8
655
4.125
4
[]
no_license
class Worker: def __init__(self, name, surname, position, wage, bonus): self.name = name self.surname = surname self.position = position self._income = {'wage': wage, 'bonus': bonus} class Position(Worker): def get_full_name(self): return f'Имя: {self.name}\nФ...
true
c82894e3759993aa4a27371f5e2e4597f0c76d6c
copycatone/scrapy_lianjia
/scrapytest/makefile.py
UTF-8
1,921
2.953125
3
[]
no_license
#!/usr/bin/env python # coding=utf-8 import xlsxwriter import json # 获取所有数据 dataFile = open("xiaoquchengjiao.txt") data_list = [] for line in dataFile: data_list.append(line) # 获取小区名称列表 xiaoquNameList=[] for data_json in data_list: data = json.loads(data_json) xiaoquName =data['fangchanmincheng'].encode("ut...
true
ece566cd695e2cc65bcd64e3e348930dd83df22a
pombredanne/backhub
/backhub.py
UTF-8
2,594
2.640625
3
[ "LicenseRef-scancode-warranty-disclaimer" ]
no_license
#!/usr/bin/env python3 #-*- coding: utf-8 -*- import argparse import base64 import json import getpass import logging import os import pprint import subprocess import urllib.error import urllib.request # http://developer.github.com/v3/repos/ API_URL = 'https://api.github.com/user/repos?type=%s' def clone(user, passw...
true
2b9ab28e9990a87063cb1bfbc21bb577640bb361
JinKim1221/Python-Game
/pygame_basic/3_main_sprite.py
UTF-8
1,275
3.75
4
[]
no_license
import pygame pygame.init() # neccessary initialization # screen setting screen_width = 480 screen_height = 640 screen = pygame.display.set_mode((screen_width, screen_height)) # background setting background = pygame.image.load("C:/Users/Jin/Desktop/Python_game/pygame_basic/background.png") # character setting char...
true
dafaa51f8b99be26a13d30fab6457fde335dab72
levihernandez/KennelAPI
/KennelApi/__main__.py
UTF-8
1,384
2.765625
3
[ "Apache-2.0" ]
permissive
''' Author: Julian Levi Hernandez ''' import argparse from os import path, listdir, getcwd import kennel as kn class Datadog: def __init__(self): return None ''' Name: getArgs Syntax: python3 KennelApi -c get_dashboard Required endpoint command must have a conf/get_dashboard.conf file. ...
true
18e03ab22b632982ac0c471b8532603e9a219665
vovasemenchuk/sv
/lab6/semenchuk6.py
UTF-8
150
3.28125
3
[]
no_license
sp = [int(x) for x in input('Числа через пробіл: ').split()] for x in range(sp.count(0)): sp.remove(0) sp.append(0) print(sp)
true
c02e42837c0e4e87aa508af327982a24af419f6b
RyanKJ/ScheduleHours
/schedulingcalendar/business_logic/time_logic.py
UTF-8
8,944
2.90625
3
[]
no_license
import json import bisect import calendar import pytz from datetime import date, datetime, timedelta, time from operator import itemgetter from django.utils import timezone from django.contrib.auth.models import User from ..models import (Schedule, Department, DepartmentMembership, MonthlyRevenue, ...
true
57a19b39232fa783cc62fbfa0d6e786a48b56c44
mboker/MLND_Capstone
/code/extraction_and_preprocess/split_and_tokenize_headline_strings.py
UTF-8
2,279
3.296875
3
[]
no_license
import pandas as pd from nltk import word_tokenize from nltk.corpus import stopwords #make sure to run #nltk.download() punc_tokens = {'.': '||period||', ',': '||comma||', '"': '||quotation||', ';': '||semicolon||', '!': '||exclamation||', '?':...
true
ddfea4a3eb08252d9e2aafdea732da8d7966b749
mogubess/python_test
/nyumon/5chapter/556pprint.py
UTF-8
219
2.9375
3
[]
no_license
''' pprint ''' import pprint from collections import OrderedDict quotes2 = OrderedDict([ ('Moe','A wise quy ], huh?'), ('Larry','Qw!'), ('Curly','Nyuk nyuk!'), ]) print(quotes2) pprint.pprint(quotes2)
true
77fe6c8491b6511a22ebc48eda2d9e45b8bf1963
JetBrains/intellij-community
/python/testData/inspections/DictCreationWithDoubleStars.py
UTF-8
184
2.578125
3
[ "Apache-2.0" ]
permissive
first_dict = {'a': 1} <caret><weak_warning descr="This dictionary creation could be rewritten as a dictionary literal">second_dict = {**first_dict}</weak_warning> second_dict['b'] = 2
true
73106f1eba8911af0e325907494a92522f25b70f
fabioHernandezRu/Escuela_data_science
/nivel-basico/Introduccion-pensamiento-computacional/excepciones.py
UTF-8
491
3.890625
4
[]
no_license
""" defensive programming - errores de semantica se pueden crear excepciones propias try, except, finally no deben manejarse de manera silenciosa - no solo imprimir y ya para aventar tu propia exepción utiliza el keyword raise """ def divide_elementos_de_lista(lista,divisor): try: return [ i / divisor for ...
true
102e7cb9f13d3dab23826532b00a0f33cbcd31ee
galib96/Coding-Practice-Python
/Leetcode/reverse_integer.py
UTF-8
386
3.5625
4
[ "CC0-1.0" ]
permissive
def reverse(x: int): """ takes in integer and output it's reverse """ result = 0 if x < 0: x = x*(-1) a = -1 else: a = 1 while x > 0: carry = x%10 result = result*10+carry x = x//10 result = result*a if result < -2**31 or result > (2**3...
true
23f900dddf1cb646469cc1bd105840942f1a3c54
kuzmin91/habrproxy-akt
/habrproxy.py
UTF-8
3,158
2.609375
3
[]
no_license
import re import requests from bs4 import BeautifulSoup from flask import Request, Response HABRA_HOST = 'https://habr.com/' REQUEST_HEADERS_EXCLUDE = ['host', ] RESPONSE_HEADERS_EXCLUDE = [ 'content-encoding', 'content-length', 'transfer-encoding', 'connection', ] NON_TEXT_HTML_TAGS = ['style', 'script', '[docum...
true
bceea89d6334d9786d053c16b5c43e3dad32f074
sjt-moon/Machine-Learning-Repository
/NaiveBayesClassifier.py
UTF-8
3,768
3.15625
3
[]
no_license
import numpy as np from collections import defaultdict from math import exp class NaiveBayesClassifier: def __init__(self, voc, labels): # i-th row is a vocabulary length parameter for class i self.voc = voc self.labels = labels self.k = len(labels) self.paras = np...
true
aad091992484971b4abdae987643107c3b501e90
JunAishima/facility-info
/facility_info/routers/instruments.py
UTF-8
1,101
2.6875
3
[ "BSD-3-Clause" ]
permissive
from fastapi import APIRouter, HTTPException instruments = {'1':{'port':'2ID', 'nickname':'SIX', 'instrument_id':1, 'emergency_contact':1, 'beamline_staff':[2,3,4], 'beamline phone numbers':[1602]}, '2':{'port':'3ID', 'nickname':'HXN', 'instrument_id':2, 'emergency_contact':2, 'beamline_staff':[1,3,4], ...
true
e2e1a0a56c5faf72a47eb106a3cb592dfb3518f7
MrOlafo/Python_class_code
/Array2.py
UTF-8
588
3.71875
4
[]
no_license
#Modifying inner array's data with the index: l=[2,"Tres",True,["Uno",10]] l[1]=4 l2=l[1] print(l2) #Slicing: Copy some informartion from an Array towards another one [begginingIdex:QuantityOfCopyElements]: l3=l[0:3] l7=l[1:2] print(l3) #Copy some information from an Array towards another one by skipping some informat...
true
a679f0750a66b08ee654b3e8bdfa987e8ca1fb3f
tmillenaar/thesis
/ISMoLD.py
UTF-8
23,256
2.578125
3
[]
no_license
## Program ISMoLD (Imperfect Sorting Model of Linear Diffusion) ## Designed and created by Timo Millenaar (tmillenaar@gmail.com) import math import os import matplotlib.pyplot as plt import numpy as np from time import time as currentTime from os import listdir from decimal import Decimal from functions_for_ISMoLD im...
true
33f3265b61176118cc4de256fc8d5f83a02f37c2
flyteorg/flytesnacks
/examples/type_system/type_system/enums.py
UTF-8
1,774
3.796875
4
[ "Apache-2.0" ]
permissive
# %% [markdown] # # Using Enum types # # ```{eval-rst} # .. tags:: Basic # ``` # # Sometimes you may want to restrict the set of inputs / outputs to a finite set of acceptable values. This is commonly # achieved using Enum types in programming languages. # # Since version 0.15.0, Flyte supports Enum Types with string v...
true
3691d763db6e70d20b0f4d56e0fed0101536c29f
lucasqiu/NovelMarks
/Classes/Manager/manager.py
UTF-8
2,839
3.171875
3
[]
no_license
import sys sys.path.append('../../Lib/') import node from graphics import * class Manager: def __init__(self, scenario, save_filename="scenario_save.json"): """Creates a new manager object based off the given scenario representation Keyword Args: scenario -- dict representing all informat...
true
bc06485c00f57a20327d980e6addb2c7cd5a78e4
lyz21/MachineLearning
/Convid19/dateUtil.py
UTF-8
1,258
3.140625
3
[]
no_license
# encoding=utf-8 """ @Time : 2020/4/2 17:01 @Author : LiuYanZhe @File : dateUtil.py @Software: PyCharm @Description: 关于日期的工具类 """ import pandas as np m31 = [1, 3, 5, 7, 8, 10, 12] m30 = [4, 6, 9, 11] # 获取日期 def getDateList(day_num, year='2020', start_month=1, start_day=1, con_str='_'): month, day = start_month...
true
2a0ba2d4d5911353b566f4778e605bf640583d39
Ale9806/Colorimetro
/Python/ImageSpaceConvertor.py
UTF-8
2,907
2.8125
3
[]
no_license
import numpy as np def Regularize(RGB): return RGB/255 def RGB2HSV(RGB): R,G,B = RGB Max = np.max(RGB) Min = np.min(RGB) V = Max Delta = Max - Min S = Delta/Max if Delta == 0: H=0 return np.array([H,S,V]) else: if Max == R and Min == B: H = 1/6*...
true
bf9fcad59f1a9f2c646123c37eb90275bda44fc3
lidongze6/leetcode-
/739. 每日温度.py
UTF-8
442
3.609375
4
[]
no_license
def dailyTemperatures(T): # 单调栈 stack = [] l = len(T) day = [0] * l for n, i in enumerate(range(l - 1, -1, -1)): while stack and stack[-1][0] <= T[i]: stack.pop() if stack and stack[-1][0] > T[i]: day[l - n - 1] = stack[-1][1] + n - l stack.append([T[i...
true
7ee99f1eb6a10e6a69e2a8add783534ea68e7c60
bputrah/open-telemetry-kit
/open_telemetry_kit/klv_common.py
UTF-8
960
2.6875
3
[ "BSD-3-Clause" ]
permissive
from io import BytesIO from typing import Tuple def lerp(x: int, x0: int, x1: int, y0: float, y1: float): t = (x - x0) / (x1 - x0) return (1-t) * y0 + t * y1 def bytes_to_int(byte, issigned=False): return int.from_bytes(byte, byteorder="big", signed=issigned) def bytes_to_float(byte, src: Tuple[int, int], dest...
true
ff6277ef1bfc00c1cb1258f06a968fdfc535f806
yi-ye-zhi-qiu/liamlab
/data_science_in_python/0605/Notes and Homework/notes.py
UTF-8
1,169
3.953125
4
[]
no_license
''' Notes for Liam's Lab June 5, 2021 Code used to run things in the "June 5, 2021 Notes.pdf" file ''' array = [1, -10, 2, 3, 4] def BubbleSort(array): for i in range(len(array)): for j in range(len(array)-i-1): if array [j] > array [j+1]: array [j], array [j+1] = array ...
true
8a0e04af4a6a0f39fd05a8652fc52ec414eac421
asdrubalivan/dolartodaybot
/src/dolartodayservice.py
UTF-8
422
2.921875
3
[]
no_license
import requests class DolarTodayService(object): """Docstring for DolarTodayService. """ def __init__(self,url): if not isinstance(url,str): raise ValueError("Only Strings allowed") self.url = url def getJSON(self): """Returns JSON data from Dolar Today :return...
true
d70220f7e621cc64e913d3154c8ab4f87fb2e8f2
jameslao/Algorithmic-Pearls
/0-1-Knapsack/knapsack_bnb_pq.py
UTF-8
1,554
3.3125
3
[ "MIT" ]
permissive
# 0-1 Knapsack Branch and Bound with Heapq # By James Lao. from heapq import * import time import sys def knapsack(vw, limit): def bound(v, w, j): if j >= len(vw) or w > limit: return -1 else: while j < len(vw) and w + vw[j][1] <= limit: v, w, j = v + vw[j]...
true
f6a13cd9d6a6d7e442b5a18498ade233399e807c
platinum78/porterble
/scripts/controls/controllers.py
UTF-8
2,222
2.890625
3
[]
no_license
#!/usr/bin/python """ ******************************************************************************** * Filename : Kinematic Controller * Author : Susung Park * Description : Kinematics controller for autonomous vehicle. * Version : On development... ***********************************************...
true
401e01eea19d38cf2ebda81f2701682eb0cd4a15
kenwoov/PlayLeetCode
/Algorithms/Easy/1018. Binary Prefix Divisible By 5/answer.py
UTF-8
350
3.0625
3
[ "Apache-2.0" ]
permissive
from typing import List class Solution: def prefixesDivBy5(self, A: List[int]) -> List[bool]: l = [] a = 0 for n in A: a = a * 2 + n l.append(a % 5 == 0) return l if __name__ == "__main__": s = Solution() result = s.prefixesDivBy5([1, 1, 0, 0, 0, 1...
true
e06b1a41f1dce49e3606eef06bbcce30576a9b59
jingshao69/py4fun
/nkdup.py
UTF-8
613
3.15625
3
[]
no_license
#!/usr/bin/env python3 import math import argparse def factorial(n): result=1 for i in range(1, n+1): result *= i return result def prob_dup_nk(n, k): total_choice = math.pow(n, k) non_dupl_choice = math.factorial(n) / math.factorial(n-k) #print non_dupl_choice, total_choice prob...
true
b23465cbdd587451b1df425134093097a0917fd8
Aakancha/Python-Workshop
/Jan19/Assignment/List/Q7.py
UTF-8
118
3.453125
3
[]
no_license
list1 = [1, 2, 3, 4] i = 0 for each in list1: list1[i] = 'emp' + str(each) i += 1 print(f"New list: {list1}")
true
7c4c47d7f580edcabef02b12e8296d47569803ac
zashin-AI/project
/GAN/Vanilla Gan/vanilla_gan_model.py
UTF-8
12,029
2.84375
3
[]
no_license
import numpy as np from tensorflow.keras.layers import Dense, LeakyReLU, Dropout, Input from tensorflow.keras.models import Sequential, Model from tensorflow.keras.optimizers import Adam from tensorflow.keras.initializers import RandomNormal import numpy as np import matplotlib.pyplot as plt from datetime import dateti...
true
1955bb523d0aa3664ef8133d03c82220bc957b62
sourabhraghav2/autonomous_driving
/code/vehicle.py
UTF-8
13,126
2.78125
3
[]
no_license
import numpy as np from code.calculation import rotate_cord, find_cordinate_at import pygame from bresenham import bresenham class Vehicle: def __init__(self,screen,transformer,width,front_loc,back_loc,move_distance,direction_list,padding_size=4,radar_range=8): self.front_loc=front_loc self.back_lo...
true
80b2b2f054615ea3d14d165fff75bcd452c8d4f8
Davidnln13/WORK-PostGradSystem
/PostgradSystem-master/py/database_manager.py
UTF-8
2,709
2.640625
3
[]
no_license
import time import traceback from mysql.connector.pooling import MySQLConnectionPool from mysql.connector import errorcode class DatabaseManager: def __init__(self): print("DatabaseManager: __init__") self.createConnectionPool() def createConnectionPool(self): dbconfig = { "user": "root", "password":"x...
true
5abd57273b83a4cc581d37b65644114f39f4dceb
vaibhavid210/SmartMediaPlayer
/Read_Save_data.py
UTF-8
787
2.5625
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Sun Dec 9 18:17:39 2018 @author: vishw """ import numpy as np import pandas as pd df = pd.read_csv('fer2013.csv') label = df.emotion image_data = df.pixels label = np.array(label) image_data = np.array(image_data) #image_data = image_data.astype('flo...
true
5fb2f485e87a2d5dce45f9f52db71c9444ab49b7
houdeanie/c1531-Burger-site
/src/order.py
UTF-8
1,439
3.40625
3
[]
no_license
from src.item import Item from src.item import OrderException #class to represent a customer order class Order: def __init__(self): self._id = -1 self._status = "ordering" self._items = [] #list of strings + MainOrderItem self._net_price = 0 #function to add items to the order. item is type String or Mai...
true
ff8f1e9d30dc059ddf480bfb76212d458cb3d3e0
Cccmm002/my_leetcode
/681-next-closest-time/next-closest-time.py
UTF-8
1,873
3.6875
4
[]
no_license
# -*- coding:utf-8 -*- # Given a time represented in the format "HH:MM", form the next closest time by reusing the current digits. There is no limit on how many times a digit can be reused. # # You may assume the given input string is always valid. For example, "01:34", "12:09" are all valid. "1:34", "12:9" are all ...
true
e4f8de4f5bfabfec511e53cf870f4def76980c0e
AdamZhouSE/pythonHomework
/Code/CodeRecords/2358/60762/258057.py
UTF-8
281
3.25
3
[]
no_license
#!/usr/bin/python # -*- coding: UTF-8 -*- a=int(input()) for i in range (0,a): b =input().split(" ") n=int(b[0]) k=int(b[1]) list=[int(x) for x in input().split(" ")] list.sort(reverse=True) for j in range (0,k): print(list[j],end=" ") print()
true
b0a059b0794b06c667c06a0f36c7874bc37f1f17
cmajorsolo/transformer_lstm_arima_btc
/inference.py
UTF-8
1,953
2.8125
3
[]
no_license
import json import numpy as np import pandas as pd import logging seq_len = 240 def get_test_data(test): test_data = pd.read_csv(test) test_data = test_data.values X_test, y_test = [], [] for i in range(seq_len, len(test_data)): X_test.append(test_data[i-seq_len:i]) y_test.append(test_d...
true
30ee64b8a2c0d6e6a2664c245d44047519c83c6a
rohannr/Project-Euler
/src/pe16.py
UTF-8
118
3.015625
3
[]
no_license
import os num = 2**1000 sum = 0 while (num > 0): dig = num%10 num = num/10 sum = sum + dig print sum
true
3e22bc961d6d0bf8cfe9b03a979b9106e43df873
lucasrafael98/FastGeo
/src/fastgeo/preprocess/file_conversion.py
UTF-8
4,199
2.859375
3
[ "MIT" ]
permissive
""" Handles file conversion for various formats. """ from csv import reader as csvreader, writer as csvwriter from xml.dom import minidom import os def sqlLineString(lst): """ Receives a list [lon,lat], returning a LineString in SQL text format. """ arrayString = "LINESTRING(" for el in lst: ...
true
2261e4a7e690b3c779612977d0389a05558c7673
Sid2697/MIT-6.00.1x
/Week1/Problem1.py
UTF-8
173
3.625
4
[ "MIT" ]
permissive
a=input('Enter a srting: ') i=0 for letters in a: if letters=='a' or letters=='e' or letters=='i' or letters=='o' or letters=='u': i+=1 print("Number of vowels:",i)
true
70db7b7e6b48b2467fd14bfa4336ca7330ebdaca
caltrideraar/Ch.04_Conditionals
/4.3_Quiz_Master.py
UTF-8
2,576
3.9375
4
[]
no_license
''' QUIZ MASTER PROJECT ------------------- The criteria for the project are on the website. Make sure you test this quiz with two of your student colleagues before you run it by your instructor. ''' number_correct = 0 print("Hello! Thank you for taking my quiz.") #Question 1# ans1 = input("Which goes first? Milk...
true
79eed56e270d35f87fcd1bb6d7cabae0dea02e18
kagehina919/dsa
/python/hashing/pairSum.py
UTF-8
197
3.203125
3
[]
no_license
a = [1,2,3,4,5] b = [2,3,4,5,6] n = len(a) m = len(b) k = 4 count = 0 dict = {} for i in range(0, n): dict[a[i]] = 1 for i in range(0, m): if k-b[i] in dict: print(k-b[i], b[i])
true
84b6d887b366f7c45ec92df126a2a6d86e7f8bfa
WagnerTerry/Cadastro-de-Cliente---Tkinter
/estiloWidget.py
UTF-8
282
3.203125
3
[]
no_license
from tkinter import * from estiloWidgets.entryPlaceHolder import * from estiloWidgets.gradienteFrame import * root = Tk() gradiente = GradientFrame(root, "blue", "lightblue") gradiente.pack() holder = EntPlaceHold(root, "Digite seu nome") holder.place(x=10, y=10) root.mainloop()
true
f23d1f6f1fd8f5c16b0ea7d5f881855fbbe6b55b
kajaal-01/Tailgating-detector
/main.py
UTF-8
5,132
2.5625
3
[]
no_license
import numpy import argparse import imutils import time import cv2 import os from stream import TestStream from imutils import rotate from imutils.video import FPS # Parse arguments from command line parameters. ap = argparse.ArgumentParser() ap.add_argument("-y", "--yolo", type=str, default="yolo", help="base path to...
true
6099f3961ea372309cd865406c8df9d786a74d93
mohmmadaslam/chocopy_compiler_code_generation
/src/test/data/pa3/AdditionalTestCase/insert_sort.py
UTF-8
608
3.8125
4
[ "BSD-2-Clause" ]
permissive
# Function to do insertion sort def insertionSort(arr:[int]): i:int = 1 j:int = 0 key:int = 0 # Traverse through 1 to len(arr) while (i<len(arr)): key = arr[i] # Move elements of arr[0..i-1], that are # greater than key, to one position ahead # of their current pos...
true
3925c7b59294a71ea49cdb23fa2ce3ef337eeeae
michaelycy/py-cat-helper
/helpers/excel.py
UTF-8
1,781
3.328125
3
[]
no_license
# -*- coding: UTF-8 -*- # ! /usr/bin/python3 import openpyxl class Excel(object): def __init__(self, filepath): # 1.打开 Excel 表格并获取表格名称 self.workbook = openpyxl.load_workbook(filepath) self.sheet_names = self.workbook.sheetnames # 设置工作表缓存 self._sheet_cache = {} def get...
true
e780f35849455fa4aa4fd8683044a37d610acf52
SidStraw/leet-codes
/2021-08/2021-08-07 (day20)/White/first_unique_char.py
UTF-8
404
3.203125
3
[]
no_license
class Solution: def firstUniqChar(self, s: str) -> int: temp = {} seen = [] for inx, val in enumerate(s): if val in temp: del(temp[val]) seen.append(val) else: temp[val] = inx for tinx, tval in enumerate(temp): ...
true
c6619525448bacbe2c50cbdaf418a754e80eb268
tagonata/daily_programming
/daily_programming/200226_37.py
UTF-8
1,402
4.125
4
[]
no_license
class Node(object): def __init__(self, data): self.data = data self.left = None self.right = None class BinarySearchTree(object): def __init__(self): self.root = None def insert(self, data): self.root = self._insert_data(self.root, data) def _insert_data(self,...
true
95038884a9f9ba458d2a80f3255c836a217bb08d
XiSmartElf/CloudInn
/Site/DataAccessLayer/PostsDataAccessLayer.py
UTF-8
1,408
2.5625
3
[]
no_license
import json from S3DataRepository import S3DataRepository from Site.DataModels.Post import Post class PostsDataAccessLayer: bucket_name = "cloudinn" posts_folder = "posts" def __init__(self): self.postsDal = S3DataRepository() def getPosts(self, postIds = None): json_dict = {} ...
true
53d6b55278d98440d140e61eb271ced53682b759
satyenrajpal/Complex-YOLO
/train.py
UTF-8
5,286
2.703125
3
[ "MIT" ]
permissive
""" Entry point for the main training, on 6000 images, batch size of 12, and 1000 epochs. """ import torch import torch.nn as nn import torch.optim as optim import torch.utils.data as data import numpy as np import logging from logger import Logger import datetime import os import argparse from model import Com...
true
9c47538b15a410891e374a20a3702b4df73bd654
10102006/Python
/Object oriented programming/Pr_OOPS_BookLibrary.py
UTF-8
6,011
3.359375
3
[]
no_license
''' # Summary In this we have to create a Library using class : Tasks: *Class => in the constructor we define a library() with: 1. publisher name 2. library name 1. Add book function => take two param : 1. Library name => (it will check if the library name is taken or not) 2. Book na...
true
9b436aad58e0616d5d861c80a1f5418f2216b63f
tme5/PythonCodes
/Daily Coding Problem/PyScripts/Program_0013.py
UTF-8
831
3.9375
4
[]
no_license
''' This problem was asked by Amazon. Given an integer k and a string s, find the length of the longest substring that contains at most k distinct characters. For example, given s = "abcba" and k = 2, the longest substring with k distinct characters is "bcb". Created on 25-Jun-2019 @author: Lenovo ''' def longest_sub...
true
7d62dd32c6c2f14b5b5218aeabc1563250122071
jingxiao00/leetcodepython
/001.two_sum.py
UTF-8
1,041
3.59375
4
[]
no_license
''' Created on Sep 3, 2018 @author: wangbo 1. 暴力方法。 2. hash table用空间换时间。 ''' class Solution(object): def twoSum(self, nums, target): """ hash table用空间换时间。2遍pass :type nums: List[int] :type target: int :rtype: List[int] Time: Space: """ a = ...
true
bc7cdf4392351f599f979cf7cde0ee9f69d8bba4
cuteluo1983/study
/Python Network Programming Cookbook/Chapter 6/search_business_addr.py
UTF-8
385
3.015625
3
[]
no_license
# -*- coding: utf-8 -*- # 使用谷歌地图 API 搜索公司地址 from pygeocoder import Geocoder def search_business(business_name): results = Geocoder.geocode(business_name) for result in results: print result if __name__ == '__main__': business_name = "Argos Ltd, London" print "Searching %s" % business_...
true
a345cdd52bb7c5bf33696b4d834b0c7fe42408aa
Anap123/python-repo
/roteiro7/CaraOuCoroa.py
UTF-8
285
2.9375
3
[]
no_license
def calcMoedas(nn): if (nn == 1): return ['C', 'K'] else: moedas = ['C', 'K'] return [m + i for m in moedas for i in calcMoedas(nn - 1)] n, d = input().split() print(len([x for x in calcMoedas(int(n)) if (abs(x.count("C") - x.count("K"))) == int(d)]))
true
0991584d48a80ebadf78b45a53c8576a282727dc
seventeenseven/developpers_practices
/flask_exo/data.py
UTF-8
295
2.71875
3
[]
no_license
import json data = { 'Quarts': [ 'up', 'charm', 'strange' ], 'Leitons': [ 'hyh', 'hbub', 'hubu' ], 'Truc': "doub" } with open('data.json', 'w') as f: json.dump(data, f) with open('data.json', 'r') as f: loaded_data = json.load(f) print(loaded_data)
true