blob_id stringlengths 40 40 | language stringclasses 1
value | repo_name stringlengths 5 133 | path stringlengths 2 333 | src_encoding stringclasses 30
values | length_bytes int64 18 5.47M | score float64 2.52 5.81 | int_score int64 3 5 | detected_licenses listlengths 0 67 | license_type stringclasses 2
values | text stringlengths 12 5.47M | download_success bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|
a265fa9fd39d7e2927ee0298e051f12a840d9b54 | Python | galvarez6/datamining | /assignment1/understanding python /checker.py | UTF-8 | 2,792 | 3.703125 | 4 | [] | no_license | import pandas as pd
import numpy as np
from sklearn.neighbors import NearestNeighbors
# Create a dataframe from csv
df = pd.read_csv('practice.txt', delimiter='\t')
myData = df.values
def minMaxVec(vec1,vec2):
#for jaccard
minimums=[]
maximums=[]
for i in range(0, len(vec1)):
minimums.append(m... | true |
99a1d49e425ee486d3bd893841efc2732d935925 | Python | Ursinus-IDS301-S2020/Week10Class | /NearestNeighbors2D_Naive.py | UTF-8 | 1,123 | 3.859375 | 4 | [
"Apache-2.0"
] | permissive | """
The purpose of this file is to demonstrate how one might write
naive code to do k-nearest neighbors by manually computing the
distances from a point to a collection of points and then using
argsort to find the indices of the closest points in the collection
"""
import matplotlib.pyplot as plt
import numpy as np
... | true |
9268c7c294a7c6e19210662d9ac256e49242e202 | Python | HelloImKevo/PyAi-SelfDrivingCar | /src/app_logging.py | UTF-8 | 1,474 | 2.953125 | 3 | [] | no_license | """
Logger object
=============
Different logging levels are available: debug, info, warning, error and critical.
"""
import logging
_level_to_tag_map = {
logging.CRITICAL: 'E',
logging.ERROR: 'E',
logging.WARNING: 'W',
logging.INFO: 'I',
logging.DEBUG: 'D',
logging.NOTSET: 'V',
}
class Co... | true |
902d87fe72769b0a52a76704ba4e94e71973ec2f | Python | ZF-1000/Python_Algos | /Урок 2. Практическое задание/task_3/task_3_1.py | UTF-8 | 1,285 | 4.15625 | 4 | [] | no_license | """
3. Сформировать из введенного числа обратное по порядку входящих в него
цифр и вывести на экран. Например, если введено число 3486,
то надо вывести число 6843.
Подсказка:
Используйте арифм операции для формирования числа, обратного введенному
Пример:
Введите число: 123
Перевернутое число: 321
ЗДЕСЬ ДОЛЖНА БЫТЬ Р... | true |
166cd9cd8ec24cf28414672e56d4559e2d6779c9 | Python | multipitch/prog1 | /squareroot.py | UTF-8 | 6,968 | 3.921875 | 4 | [] | no_license | # squareroot.py
#
# contains two functions that iterate over the following function:
# x_k = (1/2) * [ x_(k-1) + a / x_(k-1) ]
# the first function, fsqrt, uses floating point arithmetic
# the second function, dsqrt, uses specified-precision decimal arithmetic
#
# additionally, results using the above functions ar... | true |
1929ba02461b965e22b433a59d73c9e78cea459a | Python | ArasBozk/Shortest-Common-Superstring | /experiment_run_time.py | UTF-8 | 8,596 | 2.9375 | 3 | [] | no_license | import time
import random
import math
from matplotlib import pyplot as plt
from tabulate import tabulate
run_size=100
def standardDeviation(results):
sum = 0
mean = 0
standard_deviation = 0
for i in range(len(results)):
sum += results[i]
mean = sum / len(results)
for j in range(len(res... | true |
1178dcf8efa461fe724fd06b894c8024fc8993f0 | Python | scotta42/MachineLearningFinal | /Emotion-detection/src/writeto_file.py | UTF-8 | 2,060 | 3.265625 | 3 | [
"MIT"
] | permissive | import csv
import numpy as np
# {0: "Angry", 1: "Disgusted", 2: "Fearful", 3: "Happy", 4: "Neutral", 5: "Sad", 6: "Surprised"}
emoteCounter = [0, 0, 0, 0, 0, 0, 0]
emoteLTG = []
emotion_data = ""
emoteNames = ["Angry", "Disgusted", "Fearful", "Happy", "Neutral", "Sad", "Surprised"]
def writeto_file(emotio... | true |
02b4f8a9b4a4eaf1033d16fee93d87b231ca6f97 | Python | WPKENAN/Junior_homework | /pr/perceptron.py | UTF-8 | 2,856 | 2.796875 | 3 | [] | no_license | #coding:utf8
from numpy import *
from matplotlib.pyplot import *
from matplotlib.animation import *
import sys
datapath="perceptrondata.txt"
data=genfromtxt(datapath,delimiter=' ');
#print min(data[1,:]),max(data[1,:])
#符号函数
def sign(v):
if v>0:
return 1;
else:
return -1;
def training(train_d... | true |
676bfbfd315ae885de6f144b90c7b50a7e3b8f8a | Python | 896385665/crabby | /day03/02-sel_form.py | UTF-8 | 1,981 | 2.640625 | 3 | [] | no_license | from flask import Flask, render_template, request, flash
from flask_wtf import FlaskForm
from wtforms import StringField, PasswordField, SubmitField
from wtforms.validators import DataRequired, EqualTo
app = Flask(__name__)
app.secret_key = 'bvdhkbdvskhbvdsh' # 这个值随意输入
'''
/根节点是普通表单、 demo1是WTF表单,使用两种表单提交,验证其过程。
'''
... | true |
fb81b3e016fa55268ae786478fe30168e543792e | Python | Irene-GM/02_Tick_Dynamics | /predictions_NL/plot_sites_prediction_year_gdal.py | UTF-8 | 1,002 | 2.65625 | 3 | [] | no_license | import gdal
import datetime
import numpy as np
import matplotlib.pyplot as plt
def generate_dates(year):
basedate = datetime.datetime(year, 1, 1)
for x in range(0, 365):
increment = basedate + datetime.timedelta(days=x)
yield(increment)
def format_ints(m, d):
if m<10:
mo = str(m).... | true |
d2abcff5bda672c7a96065aa5f6a67573e478539 | Python | miloczek/Projekty-II-UWR | /MIA/kefa_and_park/case_of.py | UTF-8 | 212 | 3.28125 | 3 | [] | no_license | n = int(input())
string = list(input())
pointer1 = pointer2 = 0
for char in string:
if char == '0':
pointer1 += 1
else:
pointer2 += 1
result = min(pointer1, pointer2)
print(n - (2*result)) | true |
f9ba7c8114d679318662905181634f8e0690b47b | Python | BenTheNetizen/StockTools | /stockscraper/models.py | UTF-8 | 1,160 | 2.75 | 3 | [] | no_license | from django.db import models
# Create your models here.
from django.urls import reverse
import uuid #Required for unique book instances
#Counter model is used to numerate the entries in the table returned in the StockScraper tool
class Counter:
count = 0
def increment(self):
self.count += 1
r... | true |
baffd303172949c03be1717fce93cd7f7f08fb05 | Python | studybar-ykx/python | /画蛇.py | UTF-8 | 495 | 3.84375 | 4 | [] | no_license | import turtle
def drawSnake(rad, angle, len, neckrad):
for i in range(len):
turtle.circle(rad, angle)
turtle.circle(-rad, angle)
turtle.circle(rad,angle/2)
turtle.fd(rad)
turtle.circle(neckrad+2, 180)
turtle.fd(rad*2/3)
def main():
turtle.setup(1300, 800, 0, 0)
pythonsize =... | true |
8e7ce6cb7b1bc07fde63d87922ec905b607bad91 | Python | twrdyyy/make-it-from-scratch | /machine_learning/batch_sampling/batch_sampling.py | UTF-8 | 685 | 3.421875 | 3 | [
"MIT"
] | permissive | import numpy as np
from typing import Generator, List
# python generator that yields samples of given dataset e.g.
# dataset = np.zeros((100, 10))
# for batch in sampling(dataset):
# print(len(batch))
#
# 32
# 32
# 32
# 4
def sampling(dataset: List, batch_size: int = 32) -> Generator:
assert type(dataset) == ... | true |
9868a770bd319ca21e2249165b558d1230760ffe | Python | DanP01/cp1404_practicals | /prac_02/files.py | UTF-8 | 496 | 4.25 | 4 | [] | no_license |
# 1:
user_name = 'name.txt'
name_file = open(user_name, 'w')
enter_name = input("Please enter name: ")
print(" Your name is: {} ".format(enter_name), file = name_file)
name_file.close()
# 2:
read_name_file = open('name.txt', 'r')
file_to_read = read_name_file.read().strip()
read_name_file.close()
print(file_to_read... | true |
c1a3b1f8b0da606a1e662f1e164f2ee7bc9c2405 | Python | weiting1608/Leetcode | /3 longest substring without repeating characters.py | UTF-8 | 2,392 | 3.796875 | 4 | [] | no_license | class Solution():
def lengthOfLongestSubstring(self, s: str) -> int:
# """
# Brute Force:
# 1. enumerate all substring of strings;
# 2. check whether the substring is not repeating;
# 3. return the longest non-repeating substring
# Time Complexity: O(n^3):
# ... | true |
ce17a065d82997b5efa6a3bad159a76b59f053d3 | Python | nuke7/python | /web_request/web_req.py | UTF-8 | 187 | 2.84375 | 3 | [] | no_license | import requests
url = 'https://my-json-server.typicode.com/typicode/demo/comments'
x = requests.get(url)
print(x.json())
my_object = x.json()
for o in my_object:
print(o["id"])
| true |
3d08281c7373a87cb97f18f39f0595aebbd54fba | Python | AdamArena/LUNA | /Status.py | UTF-8 | 1,701 | 3.5 | 4 | [] | no_license | import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BOARD)
class Status:
import time
def strobe(self):
for _ in range(5):
lst = ['s', 'c', 'r']
for i in range(3):
self.update_status(lst[i])
time.sleep(0.2)
... | true |
52dc68d84b80c33c9a396be673d1551ddf080578 | Python | gtmanfred/Euler | /e003.py | UTF-8 | 605 | 3.171875 | 3 | [] | no_license | from script.maths import isprime2
from script.sieve import sieve
def e003(num=600851475143):
p = sieve(round(num**.5))
for i in p[::-1]:
if num%i:continue
else:return i
def Euler_3(num=600851475143):
primes = []
i=2
while i <= num:
if num%i ==0 and isprime2(i):
n... | true |
7510c93759bfcd7a5bef3e28667550b7d557a7b1 | Python | newrain7803/24Solver | /batch03_kelompok45.py | UTF-8 | 430 | 2.515625 | 3 | [] | no_license | from backend import *
import sys
import re
inFile = sys.argv[1]
outFile = sys.argv[2]
sol = []
with open(inFile,'r+') as i:
lines = i.readline()
array = [int(s) for s in lines.split() if s.isdigit()]
Solve(array,sol)
lines = str(array[0]) + str(sol[0]) + str(array[1]) + str(sol[1]) + str(array[2]) + str(sol[2])... | true |
1db45f50c38a565a6d07a24276d31d4d804e9f1f | Python | Innokutman/py-learn | /alphabeticShift.py | UTF-8 | 383 | 3.09375 | 3 | [] | no_license | # https://app.codesignal.com/arcade/intro/level-6/PWLT8GBrv9xXy4Dui
def alphabeticShift(i):
i=list(i)
for x in range(len(i)):
if i[x] == 'z':
i[x] = 'a'
continue
i[x] = chr(ord(i[x])+1)
return "".join(i)
# from string import ascii_lowercase as a
# def alphabe... | true |
7667d719bf8b6f9f801f8e4dc3e719e8ba860154 | Python | Wojtbart/Python_2020 | /Zestaw4/4_7.py | UTF-8 | 562 | 4.1875 | 4 | [] | no_license | # 4.7
def flatten(sequence):
flattenList = []
for item in sequence:
# jezeli nie jest lista ani krotka to dodaje jako elemnty do listy, w przeciwnym wypadku dodawaj wywołania rekurencyjne
if not isinstance(item, (list, tuple)):
flattenList.append(item)
else:
flatt... | true |
c0d201354d396bf28d777f51daf4e3fd82e98eec | Python | QitaoXu/Lintcode | /Alog/class4/exercises/queue.py | UTF-8 | 635 | 4.15625 | 4 | [] | no_license | class MyQueue:
# 队列初始化
def __init__(self):
self.elements = [] # 用list存储队列元素
self.pointer = 0 # 队头位置
# 获取队列中元素个数
def size(self):
return len(self.elements) - self.pointer
# 判断队列是否为空
def empty(self):
return self.size() == 0
# 在队尾添加一个元素
def add(self... | true |
e52becf0600584b5fa3f718166f6fd122c044541 | Python | GoKarolis/RealEstateFinder | /get_user_input.py | UTF-8 | 543 | 2.921875 | 3 | [] | no_license | import tkinter as tk
from tkinter import simpledialog
root = tk.Tk()
root.withdraw()
def get_prices():
min_price = simpledialog.askstring(title="Price", prompt="What's minimum price?")
max_price = simpledialog.askstring(title="Price", prompt="What's maximum price?")
return min_price, max_pric... | true |
3d58c58f31a73d77109ecf8b7f7af9d5158f2b07 | Python | campbead/LoZscraper | /scraper/scrapeLOZ.py | UTF-8 | 27,729 | 2.546875 | 3 | [
"MIT"
] | permissive | from PIL import Image
import pytesseract
import argparse
import cv2
import os
import imutils
import numpy as np
import sqlite3 as lite
import sys
import time
import math
import csv
def get_other_info(time,video):
"""Returns a list containing full hearts, total hearts, rubies, keys
and bombs.
Keyword... | true |
53f3f67a358e59eaf7cef239ff96c12f94280ec4 | Python | rahulsharma20/algorithms | /arestringcharactersunique.py | UTF-8 | 686 | 4.34375 | 4 | [] | no_license | # Determine if a string has all unique characters
def isUnique(string):
hashMap = {}
for char in string:
if char in hashMap:
return False
else:
hashMap[char] = True
return True
if __name__ == "__main__":
stringWithDupes = 'somerandomstrigwithduplicates'
un... | true |
12548e3b8e0a2d8c216bae1595999e0317ea39c3 | Python | rrwt/daily-coding-challenge | /daily_problems/n_queen_problem.py | UTF-8 | 1,728 | 4 | 4 | [
"MIT"
] | permissive | """
You have an N by N board. Write a function that returns the number of possible
arrangements of the board where N queens can be placed on the board without
threatening each other, i.e. no two queens share the same row, column, or diagonal.
"""
def is_legal_move(x: int, y: int, dim: int, board: list) -> bool:
"... | true |
98c48fc1418fd4caf77cd25a0ce58aa10008c2c8 | Python | michelleweii/Leetcode | /16_剑指offer二刷/剑指 Offer 51-数组中的逆序对.py | UTF-8 | 2,273 | 3.328125 | 3 | [] | no_license | """
hard 归并排序进阶
2021-07-21
https://leetcode-cn.com/problems/shu-zu-zhong-de-ni-xu-dui-lcof/solution/jian-zhi-offer-51-shu-zu-zhong-de-ni-xu-pvn2h/
"""
# https://leetcode-cn.com/problems/shu-zu-zhong-de-ni-xu-dui-lcof/solution/jian-zhi-offerdi-51ti-ti-jie-gui-bing-pa-7m88/
class Solution:
def reversePairs(self, nums... | true |
f4fa1ab0e01b92b19f61f57f264c0462f85e10a8 | Python | chrislyon/my-robot-motor-class | /first.py | UTF-8 | 4,356 | 2.796875 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: latin-1 -*-
import sys, traceback
import time
import datetime
#import pyfirmata
import pyfirmata_fake as pyfirmata
# Démarrer la connection avec Arduino UNO
# USB: /dev/ttyUSB0 ou /dev/ttyACM0
# UART: /dev/ttyAMA0
import pdb
def log(msg):
a = datetime.datetime.now()
pri... | true |
6200c87fc1c42d2c7e02fe85ea90345a8dd80ee8 | Python | ivankreso/stereo-vision | /scripts/crop_images.py | UTF-8 | 1,418 | 2.5625 | 3 | [
"BSD-3-Clause"
] | permissive | #!/usr/bin/python
# Note: python3 script
import os, sys, re
if len(sys.argv) != 3:
print("Usage:\n\t\t" + sys.argv[0] + " src_dir/ dst_dir/\n")
sys.exit(1)
# create output dir
if not os.path.exists(sys.argv[2]):
os.makedirs(sys.argv[2])
# get file list of input dir
imglst = os.listdir(sys.argv[1])
# filte... | true |
335d7b0c4ff3450515b37068c029f6a05377e343 | Python | LXZbackend/Base_python | /feiji/pygameDemo.py | UTF-8 | 750 | 3.546875 | 4 | [] | no_license | #coding=utf-8
#导入pygame库
import pygame
#向sys模块借一个exit函数用来退出程序
from sys import exit
#初始化pygame,为使用硬件做准备
pygame.init()
#创建了一个窗口,窗口大小和背景图片大小一样
screen = pygame.display.set_mode((600, 170), 0, 32)
#设置窗口标题
pygame.display.set_caption("Hello, World!")
#加载并转换图像
background = pygame.image.load('bg.jpg').convert()
#游戏主循... | true |
a011ad5d0b14e6ab0a9ff8f41cad110a92adee3b | Python | Bomullsdotten/Euler | /Even_fibonacci/test.py | UTF-8 | 752 | 3.375 | 3 | [] | no_license | from __future__ import absolute_import
import unittest
class MyTestCase(unittest.TestCase):
def test_fibonacci_returns_fibonacci_number_x(self):
from Even_fibonacci.fibonacci import fibonacci
ten_first_fib = [1,1,2,3,5,8,13,21,34,55]
result = fibonacci(1)
self.assertEqual(result, t... | true |
8c17e2e29969e6e296c18763044eae40f64b4577 | Python | xtompok/uvod-do-prg | /koch/koch.py | UTF-8 | 815 | 3.046875 | 3 | [
"MIT"
] | permissive | from turtle import pendown,penup,goto,exitonclick
from math import sqrt
def koch(startx,starty,endx,endy,d):
if d == 0:
return
dirx = endx-startx
diry = endy-starty
pointA = (startx + dirx/3,starty + diry/3)
pointB = (startx + 2*dirx/3,starty + 2*diry/3)
baseC = (startx + dirx/2, star... | true |
b7a696a39a6f82f70ee23ee80b26d6a87714fe21 | Python | serubirikenny/Shoppinlist2db | /r.py | UTF-8 | 6,627 | 2.546875 | 3 | [] | no_license | from flask import Flask, render_template, url_for, request, redirect, jsonify
from forms import LoginForm, SignUpForm, NewListForm,NewItemForm
from flask_sqlalchemy import SQLAlchemy
from flask_login import LoginManager, UserMixin, login_user, logout_user, current_user, login_required
#####################... | true |
245998ddb1601f7a9001c10a59dd55fdb0bfc15e | Python | jaeseok4104/AI_IoT_makerthon | /RPi Timer/volunm.py | UTF-8 | 485 | 3.28125 | 3 | [] | no_license | import tkinter
window=tkinter.Tk()
window.title("YUN DAE HEE")
window.geometry("640x400+100+100")
window.resizable(False, False)
frame=tkinter.Frame(window)
scrollbar=tkinter.Scrollbar(frame)
scrollbar.pack(side="right", fill="y")
listbox=tkinter.Listbox(frame, yscrollcommand = scrollbar.set)
for line ... | true |
7a185806cc944ff566d362260de8db5d4b89754b | Python | marcussev/football-score-prediction | /tests/regression/regression_adv.py | UTF-8 | 1,278 | 2.75 | 3 | [] | no_license | from data.datasets import StatsDatasetRegression
from models.linear_regression import LinearRegression
from trainer.regression_trainer import RegressionTrainer
import visualizer
import pandas as pd
import torch
# ---------------------------------------------------------------------------------------------
# This file ... | true |
2b37b3d1e53a2a62ef989f17d191b834744e32db | Python | balassit/improved-potato | /examples/salesforce/test.py | UTF-8 | 158 | 3.109375 | 3 | [] | no_license | alist = [0, 1, 0, 0]
blist = [0, 0, 1, 0]
# b[1] = 1
# res = [0, 1, 1, 0]
for i, (a, b) in enumerate(zip(alist, blist)):
blist[i] = a or b
print(blist)
| true |
daeb8496907754132fa619a20000340ac2d01149 | Python | c-hurt/utility-functions | /collections/chain_iter.py | UTF-8 | 156 | 3.484375 | 3 | [] | no_license | from itertools import *
def yielding_iter():
for a in range(0,10):
yield [a]
for a in chain.from_iterable(yielding_iter()):
print(f'{a} ') | true |
758163d59d71e2c76137e99b416727cbe55550dc | Python | quique0194/UmayuxBase | /umayux_base/position.py | UTF-8 | 4,373 | 3.25 | 3 | [] | no_license | from math import sqrt
from flag_positions import flag_positions
from mymath import dist, angle_to
def closer_point(target_point, list_of_points):
list_of_points.sort(key=lambda x: dist(x, target_point))
return list_of_points[0]
def mean_points(list_of_points):
ret = [0,0]
for point in list_of_point... | true |
f66c55ad2c2edd82f5d8c4e6381d990d74fb4d3d | Python | joel-reujoe/AlgosAndPrograms | /Arrays/Arrays2.py | UTF-8 | 588 | 4.03125 | 4 | [] | no_license | ## Find max and min element in Array with min comparison
def getMinMax(A):
max = 0
min = 0
if len(A)==1: #if there is only one element in the Array
return A[0], A[0]
if A[0] > A[1]:
max = A[0]
min = A[1]
else:
max = A[1]
min = A[0]
for i i... | true |
dd8aa62185e5b8ed893e85cc875f6231ee392b84 | Python | ParadoxZW/fancy-and-tricky | /py_snippets/dud print/example.py | UTF-8 | 766 | 2.71875 | 3 | [] | no_license | import multiprocessing as mp
import os
import time
def main(rank, a):
if rank != 0:
__print = lambda *args, **kwargs: ...
__builtins__['print'] = __print
else:
ori_print = __builtins__['print']
__print = lambda *args, **kwargs: ori_print(*args, **kwargs, flush=True)
__builtins__['print'] = __pri... | true |
f0c0a9c2f1365d30dc0bd77746076ef8a8c9194d | Python | TILE-repository/TILE-repository.github.io | /docs/nifties/2022/files/generate_test_report_all.py | UTF-8 | 11,984 | 3.171875 | 3 | [
"CC-BY-3.0",
"CC-BY-4.0"
] | permissive | import json
import xlwt
from xlwt import Workbook
from lark import Lark
from lark import Transformer
def get_failed_testcases(filename):
"""
Expects filename to be a file that contains the output of a !pytest run.
Returns the list of testcases that have failed.
Throws FileNotFoundError exception if fi... | true |
d53002cb6ff14245b7544b89f0f0e1a1730a7960 | Python | cosmoglint/strings_with_turtle | /6_dot_flower.py | UTF-8 | 1,003 | 3.5625 | 4 | [] | no_license | # flower made with dots of increasing sizes
import turtle
import math
ts = turtle.getscreen()
ts.colormode(255)
t = turtle.Turtle()
t.speed(0)
sides = 30
turn_angle = 360/sides
in_radius = 60 #initial radius of first circle
def slen_rad(radius):
side_len = radius * 2 * (math.sin(math.radians(180)/sides))
... | true |
a25d67fbd5efa0aa5726f11bee1e11686ba1ee03 | Python | maggieyam/LeetCode | /matrix.py | UTF-8 | 804 | 3.21875 | 3 | [] | no_license | def rotate(self, matrix: List[List[int]]) -> None:
"""
Do not return anything, modify matrix in-place instead.
"""
size = len(matrix)
offset = 0
innerSize = size
while innerSize > 1:
for i in range(innerSize - 1):
row = off... | true |
9af6065e97d9b881863d0b3cce7d8cae529838e7 | Python | benjaminthedev/FreeCodeCamp-Python-for-Everybody | /10-build-your-own-functions.py | UTF-8 | 166 | 3.21875 | 3 | [] | no_license | # What will the following Python program print out?:
def fred():
print("Zap")
def jane():
print("ABC")
jane()
fred()
jane()
# Answer
# ABC
# Zap
# ABC
| true |
6e63df8e3c42dd58e9393598f71cae2b316588a5 | Python | perezperret/euler | /problem002_test.py | UTF-8 | 349 | 3.34375 | 3 | [] | no_license | import unittest
import problem002
class TestStringMethods(unittest.TestCase):
def test_fibs_up_to_25(self):
self.assertEqual(problem002.fib(25), [0, 1, 1, 2, 3, 5, 8, 13, 21])
def test_sum_evens(self):
self.assertEqual(problem002.sumEvens([0, 1, 1, 2, 3, 5, 8, 13, 21]), 10)
if __name__ == '__... | true |
09e2fe98d52afa3d1dfc90755328c2614cbf0900 | Python | seonukim/Study | /ML/m35_outliers.py | UTF-8 | 620 | 3.5625 | 4 | [] | no_license | import numpy as np
def outliers(data_out):
quartile_1, quartile_3 = np.percentile(data_out, [25, 75])
print("1사분위 : ", quartile_1)
print("3사분위 : ", quartile_3)
iqr = quartile_3 - quartile_1
lower_bound = quartile_1 - (iqr * 1.5)
upper_bound = quartile_3 + (iqr * 1.5)
return np.where((data_o... | true |
19451ab05d912d8ff9d2426742689561f6292302 | Python | m4rdukkkkk/web_monitor | /A50_myStock.py | UTF-8 | 4,006 | 2.515625 | 3 | [] | no_license |
# ! -*- coding:utf-8 -*-
# 2019.1.23 模型重新梳理,两次PL汇率换算,加上了手数的因素
import time
import re
import pymysql
import requests
from selenium import webdriver
# 还是要用PhantomJS
import datetime
import string
from math import floor
total_Cash = 30000 # 是人民币
FX_price = 6.95
index_Cash_dollar = (0.3*total_Cash)/FX_price # index的... | true |
33d969063a49e3989f2e96e5af6af3c1e299d77b | Python | Ordoptimus/Coding | /Problems/HRML1.py | UTF-8 | 236 | 2.859375 | 3 | [] | no_license | a = []
a = [int(x) for x in input().split()]
b = [int(y) for y in input().split()]
#a = list(map(int, a)) (also learning)
#b = list(map(int, b))
a.sort()
b.sort()
res=list(product(a, b))
res = [str(a) for a in res]
print(' '.join(res)) | true |
17b4ba086773ba4e938b3c11a59c315da5219ff3 | Python | Ch4pster/chappy-chaps | /misc experimental.py | UTF-8 | 389 | 3.8125 | 4 | [] | no_license | def factorial(x):
total = 1
while x>0:
total *= x
x-=1
return total
"""def anti_vowel(argument):
text = str(argument)
text.lower
for x in text:
if x == "a" or x == "e" or x == "i" or x == "o" or x == "u": ###if vowels = aeiou, how do you iterate through that?####
... | true |
b49a5b317244c52294a6c241ec126c5d3d0de41e | Python | kirill-kovalev/VK-feed-bot | /bot/UserList.py | UTF-8 | 2,035 | 2.859375 | 3 | [] | no_license |
import json
from User import *
class UserList:
class UserExists(Exception):
def __init__(self): return ;
class UserNotExists(Exception):
def __init__(self): return;
userList:[User] = []
def add(self,chat_id:int , token:str ):
for user in self.userList:
if user.c... | true |
70ae8b05de9d96f9e89252649d0d0d47eb3ec66a | Python | glfAdd/note | /python/004_并发/learn_multiprocessing.py | UTF-8 | 2,436 | 3.078125 | 3 | [] | no_license | import multiprocessing
import os
import time
import logging
""" ============================ multiprocessing
当前进程
multiprocessing.current_process()
设置调试的日志
默认情况下,日志记录级别设置为NOTSET不生成任何消息
multiprocessing.log_to_stderr(logging.DEBUG) 设置调试的日志
"""
""" ============================ Process
用来创建子进程
def __init__(self, group... | true |
8a42b40ec569f48a0aa132573694cb4722ed0d03 | Python | brook-hc/py-study | /004-类/031-多继承.py | UTF-8 | 582 | 3.671875 | 4 | [] | no_license |
class a():
def demo(self):
print('this is a\'s demo method')
def test(self):
print('this is a\'s test method')
class b():
def demo(self):
print('this is b\'s demo method')
def test(self):
print('this is b\'s test method')
class c(b,a): # b在a前面,所以优先搜索b。
pass
d=... | true |
11f50e52f2f34b1fe07e396d78c7d6e6709e4a86 | Python | shamoldas/pythonBasic | /DataScience/pandas/Concatenation.py | UTF-8 | 921 | 3.625 | 4 | [] | no_license | # importing pandas module
import pandas as pd
# Define a dictionary containing employee data
data1 = {'Name':['Jai', 'Princi', 'Gaurav', 'Anuj'],
'Age':[27, 24, 22, 32],
'Address':['Nagpur', 'Kanpur', 'Allahabad', 'Kannuaj'],
'Qualification':['Msc', 'MA', 'MCA', 'Phd']}
# De... | true |
71337899114e2a0a884ca948dcec2c2b7154bdc9 | Python | ao-song/dd2424-project | /ultils.py | UTF-8 | 1,785 | 2.96875 | 3 | [] | no_license | import numpy as np
from sklearn.neighbors import NearestNeighbors
def getQ(pixels):
colors = np.zeros((22, 22))
for p in pixels:
a, b = p
colors[get_index(a), get_index(b)] = 1
return np.count_nonzero(colors)
def get_index(num):
return (num + 110) / 10
def get_space():
# Cifar... | true |
c8da1cb35f570a289c05b591baa87b479e92cb0a | Python | angelusualle/algorithms | /advanced_algs/kruskals/min_span_tree_kruskal.py | UTF-8 | 584 | 2.9375 | 3 | [
"Apache-2.0"
] | permissive | # O(ElogE)
def min_span_tree_kruskal(graph):
min_tree = []
edges= []
visited = set()
for k in graph:
for i, pair in enumerate(graph[k]):
edge = sorted([k,pair[0]])
if str(edge) not in visited:
edges.append((pair[1], edge[0], edge[1]))
visited.add(st... | true |
995f49ceaf9d8be5b19ef52efe582220e8d957c7 | Python | skang29/GANs | /Parallel_GAN_structure/sndcgan_zgp/ops/layers/linears.py | UTF-8 | 1,209 | 2.578125 | 3 | [
"Apache-2.0"
] | permissive | """"
Layers / linear layers under tensorflow environment.
Supports NCCL multi-gpu environment.
To activate the environment, use code below in your
main.py.
>> os.environ['nccl_multigpu_env'] = 'true'
"""
__version__ = "1.0.0"
import os
import tensorflow as tf
from ..normalizations import spectral_norm
NCCL... | true |
3dd8a73f2209ce4987210ec2ea27a5c4ac184576 | Python | emirelesg/Self-Driving-Vehicle | /src/processor.py | UTF-8 | 5,843 | 3 | 3 | [
"MIT"
] | permissive | #!/usr/bin/python3
# -*- coding: utf-8 -*-
import numpy as np
import cv2
from line import Line
class ImageProcessor():
"""
Implements the computer vision algorithms for detecting lanes in an image.
"""
def __init__(self, frameDimensions, frameRate):
# Define camera dimensions.
se... | true |
e92f66f20776176925bec09777d1ea06c1dfe3e3 | Python | kiote/ebook | /api.py | UTF-8 | 8,757 | 2.671875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import re
import hashlib
from urllib import urlencode
class Books():
books = [
{
'Фантастика':
[
{
'id': 2,
'name': 'Понедельник начинается в субботу',
'author': ... | true |
36f0f22798763cd59a7b981dabd4984529bb5a1d | Python | flsilves/meetme | /tests.py | UTF-8 | 4,814 | 2.53125 | 3 | [
"MIT"
] | permissive | import unittest
from flask import json
import app
from models import *
users_url = 'http://localhost:5000/users'
recordings_url = 'http://localhost:5000/recordings'
json_header = {'Content-type': 'application/json'}
class BasicTestCase(unittest.TestCase):
def setUp(self):
self.app = app.create_app()
... | true |
66be5538b2ff77d8798cf097cecbed64b3a54253 | Python | TheFutureJholler/TheFutureJholler.github.io | /module 13- GUI Programming with Tkinter/tkinter_canvas.py | UTF-8 | 1,044 | 3.4375 | 3 | [] | no_license |
# -*- coding: utf-8 -*-
"""
Created on Fri Jan 12 16:57:26 2018
@author: zeba
"""
"""
The Canvas is a rectangular area intended for drawing pictures or other complex layouts.
You can place graphics, text, widgets, or frames on a Canvas.
arc . Creates an arc item.
"""
#import tkinter as tk
#root=tk.Tk()
#
#c = ... | true |
566c364c34f56910768f90e93dc3e396a35989b2 | Python | AkiraMisawa/sicp_in_python | /chap1/c1_36.py | UTF-8 | 583 | 3.5 | 4 | [] | no_license | from math import log
def tolerance():
return 0.00001
def fixed_point(f,first_guess):
def close_enough(v1,v2):
return abs(v1-v2)<tolerance()
def try_(guess):
next_=f(guess)
print(next_)
if close_enough(guess,next_):
return next_
else:
return ... | true |
938a4d2320a95819497437124aae9dec066e5c1c | Python | snehavaddi/DataStructures-Algorithms | /STACK_implemt_2_stacks_in_1_array.py | UTF-8 | 896 | 3.859375 | 4 | [] | no_license | class stack:
def __init__(self,n):
self.size = n
self.arr = [None] * n
self.top1 = -1
self.top2 = self.size
def push1(self,data):
if self.top1 < self.top2:
self.top1 = self.top1 + 1
self.arr[self.top1] = data
def push2(self,data):
... | true |
080a48762fef024ec6cc3bc35e9a32f7d404a42d | Python | gouravsb17/LJMU_Exoplanets | /code/exploratoryDataAnalysis.py | UTF-8 | 6,961 | 2.640625 | 3 | [] | no_license | # Importing the required libraries
import pandas as pd
import lightkurve as lk
import matplotlib.pyplot as plt
import os, shutil
import numpy as np
from scipy.stats import skew
from scipy.stats import kurtosis
from tqdm import tqdm
import warnings
import seaborn as sns
os.chdir('..')
tqdm.pandas(desc="Progress: ")
war... | true |
86d139f4e6b655950b281d2cbce6f78a47e99ca9 | Python | hoon4233/Algo-study | /2020_winter/2020_01_13/2146_JH.py | UTF-8 | 2,325 | 2.8125 | 3 | [] | no_license | from collections import deque
N = int(input())
mat = [ list(map(int,input().split())) for _ in range(N) ]
result = 300
numbering = 1
def seperate(ori_x, ori_y):
global N, mat, numbering
numbering += 1
# print("first, ",ori_x, ori_y, numbering)
dx, dy = [1,-1,0,0], [0,0,1,-1]
visit = [ [False for _... | true |
5b491d7531d016448829fdfbdea93bd86078b231 | Python | vkuznet/WMCore | /test/python/WMCore_t/Database_t/DBFormatter_t.py | UTF-8 | 2,852 | 2.78125 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
_DBFormatterTest_
Unit tests for the DBFormatter class
"""
from __future__ import print_function
import threading
import unittest
from builtins import str
from WMCore.Database.DBFormatter import DBFormatter
from WMQuality.TestInit import TestInit
class DBFormatte... | true |
1c29ad58198dbf3c0562d48c633eb57779c411c4 | Python | cnk/django_test_examples | /example/tests/test_html_form.py | UTF-8 | 1,691 | 2.78125 | 3 | [] | no_license | from django.test import TestCase, Client
from ..models import Color
class ExampleTestsWithDjangoClient(TestCase):
def setUp(self):
for color in ['blue', 'green', 'yellow', 'orange', 'red']:
c = Color(name=color)
c.full_clean()
c.save()
def test_request_without_for... | true |
3c5a5ee744662c36b5197c230fb9329ac3b397ef | Python | zhijazi3/Scrapper | /webScrapper.py | UTF-8 | 1,483 | 3.171875 | 3 | [] | no_license | from bs4 import BeautifulSoup
import requests
import pdb
class WebScrapper:
def __init__(self):
self.start_url = "https://coinmarketcap.com/"
self.cryptos = []
self.counter = 1
def scrape(self):
self.url = self.start_url
while True:
# If no... | true |
25c903b3b88aa55cdda5875a7afe85181932e2c7 | Python | xiaoniudonghe2015/strings2xls | /xml2xls/xls2xml.py | UTF-8 | 4,153 | 2.9375 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
from distutils.log import Log
from optparse import OptionParser
import xlrd
import os
import time
def open_excel(path):
try:
data = xlrd.open_workbook(path, encoding_override="utf-8")
return data
except Exception as ex:
return ex
def... | true |
a4015e3986a892590a823be976d20e3d9786c32b | Python | martofeld/algoritmos1-ejercicios | /Guia 2/ejercicio3.py | UTF-8 | 259 | 3.21875 | 3 | [] | no_license | import "./ejercicio2"
def show_conversion_table():
print("|---------------------|")
print("| farenhait | celcius |")
for f in range(0, 120, 10):
celcius = ejercicio2.farenhait_to_celcius(f)
print("|", f, "|", celcius)
print("|---------------------|") | true |
37b8a619974052f07ecd165575dee6174ea41fd1 | Python | NicolaRonzoni/Multivariate-Time-series-clustering | /30min data&code/clustering | UTF-8 | 2,678 | 2.90625 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Apr 13 09:49:32 2021
@author: nicolaronzoni
"""
#library
import scipy
import pandas as pd
import sklearn
import numpy as np
pip install tslearn
import tslearn
#import the dataset
df = pd.read_csv ('/Users/nicolaronzoni/Downloads/I35W_NB 30min 20... | true |
1b3734fe9d2e64c72d5bdfb97d7cb012f93138f6 | Python | JLtheking/cpy5python | /HCI_PrelimP1_2013/Additional Materials/1.2.py | UTF-8 | 683 | 4.125 | 4 | [] | no_license | def bitshift(string):
shiftedbit = string[0]
newstring = ""
for i in range(1,8): #shifts all bits forward by 1, except the eighth bit
newstring += string[i]
newstring += shiftedbit
return newstring
inputAccepted = False
while not inputAccepted:
string = input("Input bits to shift: ")
#validate input
if stri... | true |
34ed55c076b32d2a6b649118193d24e94515061f | Python | Kanevskiyoleksandr/DZ8 | /Main menu.py | UTF-8 | 441 | 2.640625 | 3 | [] | no_license | from tkinter import *
root = Tk()
root.geometry('580x300+100+100')
mainmenu = Menu(root)
root.config(menu=mainmenu)
mainmenu.add_command(label='Создать запись')
mainmenu.add_command(label='Найти запись')
mainmenu.add_command(label='Редактировать запись')
mainmenu.add_command(label='Удалить запись')
mainmenu.add_comman... | true |
20eae44645e7bb1d10b164388d154b7d15749fdc | Python | zenna/asl | /asl/run.py | UTF-8 | 1,968 | 3.109375 | 3 | [] | no_license | "Get reference loss"
import asl
def isidle(runstate):
return runstate['mode'] == "idle"
def empty_runstate():
return {'observes' : {},
'mode' : 'idle'}
def set_mode(runstate, mode):
runstate['mode'] = mode
def mode(runstate):
return runstate['mode']
def set_idle(runstate):
set_mode(runstate... | true |
ba294aa48d6c4dae2772a51140ac362fb0dca042 | Python | rui233/leetcode-python | /Array and String/121-Best time to Buy and Sell Stock.py | UTF-8 | 264 | 3.359375 | 3 | [] | no_license | class Solution(object):
def maxProfit(self,prices):
"""
:param prices:
:return:
"""
max_profit,min_price =0,float("inf")
for price in prices:
min_price = min(min_price,price)
max_profit = max(max_profit,price - min_price)
return max_profit
| true |
3309069e99ee70902cac596cd267a069c97039ad | Python | leobarrientos/wiitruck | /src/morse.py | UTF-8 | 2,449 | 3.0625 | 3 | [] | no_license | import cwiid, time
import RPi.GPIO as GPIO
button_delay = 0.1
print 'Please press buttons 1 + 2 on your Wiimote now ...'
time.sleep(1)
# This code attempts to connect to your Wiimote and if it fails the program quits
try:
wii=cwiid.Wiimote()
#turn on led to show connected
wii.led = 1
except RuntimeError... | true |
57f5eeafc542339921fcd04edbeabcea8f20a51c | Python | OathKeeper723/data_report | /information_extraction/qichacha.py | UTF-8 | 1,999 | 2.734375 | 3 | [] | no_license | # coding=utf-8
# 此程序输出来源于企查查的信息,包括:身份信息,股东信息,变更记录信息
# 以json格式输出
import docx
import re
import yaml
import os
from word_manipulation import docx_enhanced
current_path = os.path.dirname(os.path.realpath(__file__))
f = open(current_path+"\\qichacha_config.yml", encoding="utf-8")
config = yaml.load(f, Loader=yaml.FullLo... | true |
e95a63d1c83071a13f08b1fd01fa4ed83be10625 | Python | Narvaliton/Learning | /Python/OpenClassrooms/methode_str.py | UTF-8 | 2,019 | 4.28125 | 4 | [] | no_license | from random import randrange
import os
"""Les méthodes de la classe str"""
nom = "Colin"
prenom = "Maxime"
age = "22"
#Utilisation de la fonction upper qui permet de passer une chaine de caractère en majuscule ( != lower() )
print("Tu t'appeles " + prenom + " " + nom.upper() + " et tu as " + age + " ans.")
... | true |
4251c6d476027402bd1019cbf8965c21e61adbd3 | Python | nalapati/sdc-behavioral-cloning | /models.py | UTF-8 | 9,270 | 2.671875 | 3 | [] | no_license | """Model definitions, construction, testing, validation, training.
NOTE: We used parts of this code as a framework for the Udacity
SDC Challenge 2, https://github.com/emef/sdc, however for this
project I experimented with 3D convolutional networks.
"""
import logging
import os
import time
# Adds functiona... | true |
1f021ba4c879256feea64ba8a6a897fbfa42d872 | Python | Gedevan-Aleksizde/datar | /datar/forcats/lvl_addrm.py | UTF-8 | 3,823 | 2.921875 | 3 | [
"MIT"
] | permissive | """Provides functions to add or remove levels"""
from typing import Any, Iterable, List
from pandas import Categorical
from pipda import register_verb
from pipda.utils import CallingEnvs
from ..base import levels, union, table, intersect, setdiff
from ..core.contexts import Context
from ..core.types import ForcatsReg... | true |
db2064382dcd88c124b1ec09226493cb2e525e1a | Python | JanHendrikDolling/configvalidator | /test/test_timezone.py | UTF-8 | 1,141 | 2.671875 | 3 | [
"Apache-2.0"
] | permissive | # -*- coding: utf-8 -*-
"""
:copyright: (c) 2015 by Jan-Hendrik Dolling.
:license: Apache 2.0, see LICENSE for more details.
"""
try:
import unittest2 as unittest
except ImportError:
import unittest
from configvalidator.tools.timezone import TZ
import datetime
class MyTestCase(unittest.TestCase):
def te... | true |
8b1210e6ec5f242bb968b8855fc6ba3803ba0a24 | Python | hope7th/FluencyPython | /1703011417encode.py | UTF-8 | 153 | 2.609375 | 3 | [] | no_license | # -*- coding:utf-8 -*-
if __name__ == '__main__':
for codec in ['latin_1','utf_8','utf_16']:
print(codec,'El Niño'.encode(codec),sep='\t')
| true |
dcc4f4e6f994a3687487919d92d9c57034bbd5c1 | Python | Nicolezjy/Recommend_system | /Recommendation_Item.py | UTF-8 | 4,068 | 2.90625 | 3 | [] | no_license | # coding: utf-8
#item based CF
from __future__ import division
import numpy as np
import scipy as sp
class Item_based_CF:
def __init__(self, X):
self.X = X #评分表
self.mu = np.mean(self.X[:,2]) #average rating
self.ItemsForUser={} #用户打过分的所有Item
self.UsersForItem={} ... | true |
e14e6c581ecf719d2bdbd801d121c53568a84601 | Python | ITT-wh/NeuralNetwork | /NerualNetwork/neural_network/week2/lr_utils.py | UTF-8 | 2,091 | 2.828125 | 3 | [
"MIT"
] | permissive | import numpy as np
import h5py
import matplotlib.pyplot as plot
# 加载数据
def load_dataset():
train_dataset = h5py.File('../../datasets/train_catvnoncat.h5', "r")
# 可以通过train_dataset.keys()查看键值的集合; [:]: 表示除当前维度以外的所有
train_set_x_orig = np.array(train_dataset["train_set_x"][:])
# print(train_set_x_orig... | true |
eeb00931ba248bbd9bf559f1d9b00182afbb0667 | Python | FraugDib/algorithms | /money_change.py | UTF-8 | 4,602 | 3.71875 | 4 | [] | no_license | import time
def find_change(results, current_decomposition, n, denominations):
"""Find changes
Arguments
results -- accumulate result in an array. Each item is also an array
current_decomposition -- decomposition of n in denominations
n -- numbe... | true |
4be2e384e8ccaf17a94d4dc157c85a9c0dca7e85 | Python | matk86/pymatgen | /pymatgen/core/bonds.py | UTF-8 | 4,070 | 2.90625 | 3 | [
"MIT"
] | permissive | # coding: utf-8
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
from __future__ import division, unicode_literals
import os
import json
import collections
import warnings
from pymatgen.core.periodic_table import get_el_sp
"""
This class implements definitions for various ... | true |
b701803736e2929be8efa648812df9b2d80498c9 | Python | xzc5858/caigou | /plug.py | UTF-8 | 884 | 2.875 | 3 | [] | no_license | import requests
from bs4 import BeautifulSoup
def request_post(url, data):
try:
response = requests.post(url, data)
if response.status_code == 200:
return response
except requests.RequestException:
return None
def request_get(url):
try:
response = requests.get... | true |
e164fab8ecd973f8126201010db55041988ade9b | Python | debasishdebs/parameterTesting | /Git/balanceClasses/algoScores.py | UTF-8 | 13,311 | 3.046875 | 3 | [] | no_license | __author__ = 'Debasish'
import csv
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from ggplot import *
from sklearn.metrics import *
import sys
f = open('output.txt', 'w')
sys.stdout = f
''' Todo : Form pairs. (Error & e_5), (error & e_10), (error & e_15) and so on. Total 6 pairs will be form... | true |
e0626d75da0973592edecbcb51f5c96331d96cdd | Python | guillaume-guerdoux/tournee_infirmiers | /tournee_infirmiers/patient/models.py | UTF-8 | 239 | 2.59375 | 3 | [] | no_license | from django.db import models
from user.models import Person
class Patient(Person):
information = models.CharField(max_length=255)
def __str__(self):
return ("{0} ".format(self.first_name) + "{0}".format(self.last_name))
| true |
6429ab4ee1c0f939e1f32e345a34d46df89212eb | Python | trungnq2/build-tool-script | /result.py | UTF-8 | 809 | 2.84375 | 3 | [] | no_license | import os
import json
def createTxtFromJSON():
file = open("app_data.txt", "w")
with open("app_data.json") as app_data:
json_ = json.load(app_data)
apps = json_['apps']
# sortlist = sorted(apps, key=lambda k: k['appid'])
for app in apps:
file.write("App: %s \n"%app['appid'])
file.writ... | true |
9afe68618b90cba4799b3541cb732d5043bfd895 | Python | cbbing/wealth_spider | /CollectiveIntelligence/generatefeedvector.py | UTF-8 | 2,009 | 2.953125 | 3 | [] | no_license | #coding=utf8
import sys
reload(sys)
sys.setdefaultencoding('utf8')
__author__ = 'cbb'
import feedparser
import re
import jieba
def get_word_counts(url):
"""
返回一个RSS订阅源的标题和包含单词计数情况的字典
:param url:
:return:
"""
#解析订阅源
d = feedparser.parse(url)
wc = {}
#循环遍历所有的文章条目
for e in d.e... | true |
7535bb5f0f69326b6f8de3c7ca14f0ab3e2eaf48 | Python | thuuyen98/ML | /Gradient_descent.py | UTF-8 | 2,021 | 3.171875 | 3 | [] | no_license | from sklearn.model_selection import train_test_split
import numpy as np
import pandas as pd
dataset= pd.read_csv("/Users/macos/Downloads/filted_train.csv")
dataset =dataset.fillna(dataset.mean())
dataset= dataset.replace('male', 0)
dataset= dataset.replace('female', 1)
features= dataset.iloc[:,1:].values
labels= datas... | true |
ad489844ea60ee6e9d4adc5a8a60580d9dab1362 | Python | apulps/LeetCode | /tests.py | UTF-8 | 28,707 | 3.09375 | 3 | [] | no_license | import unittest
from array_problems.remove_duplicates import remove_duplicates, remove_duplicates_2
from easy_problems.two_sum import two_sum, two_sum_2
from easy_problems.reverse_integer import reverse_integer
from easy_problems.running_sum import running_sum, running_sum_2, running_sum_3
from easy_problems.kids_with... | true |
a106ff3bd084218337129542f596344b29b292b9 | Python | jpagani1984/Projects | /hello_flask/Understanding_routing.py | UTF-8 | 1,068 | 3.015625 | 3 | [] | no_license | from flask import Flask
app = Flask(__name__)
print(__name__)
@app.route('/dojo')
def Dojo():
return 'Dojo'
@app.route('/say/flask')
... | true |
c3f702bd8a29294316257b50a4c1d4a71e74706f | Python | BadrYoubiIdrissi/solvepuzzle | /puzzle.py | UTF-8 | 2,150 | 3.09375 | 3 | [] | no_license | import os
import numpy as np
import utils
import matplotlib.pyplot as plt
import matplotlib.image as image
from PIL import Image
from config import SAVE_FOLDER, HEIGHT, WIDTH, N_ROW, N_COL, HEIGHT_BLOCK, WIDTH_BLOCK
class Puzzle:
'''
A class that defines a puzzle.
It defines two kinds of images:
... | true |
98198d78ecd24735cd6a53f5a66d09ac84f90385 | Python | youngung/MK | /mk/materials/func_hard_char.py | UTF-8 | 1,008 | 2.921875 | 3 | [] | no_license | # ### characterize hardening functions
import numpy as np
from scipy.optimize import curve_fit
def wrapper(func,*args):
"""
Hardening function wrapper
Arguments
---------
func
*args
Returns
-------
func(x,*args) that is a function of only strain (x).
"""
def f_hard_char(x)... | true |
6806bf3b66f3cdfc337230db45b469e77d4d7178 | Python | cashgithubs/mypro | /py_tools/qiubai_pyqt/qb0.2/qb_ui2.pyw | UTF-8 | 3,943 | 2.65625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Module implementing MainWindow.
"""
from PyQt4.QtGui import *
from PyQt4.QtCore import *
import requests
import threading
from bs4 import BeautifulSoup
import datetime
from Ui_qb_ui2 import Ui_MainWindow
event = threading.Event()
class MainWindow(QMainWindow, Ui_MainWindow):
"""
... | true |
3685c365effacfc7e64c01fd837923c46d5e4ef7 | Python | florinpapa/muzee_romania | /app.py | UTF-8 | 8,890 | 2.625 | 3 | [] | no_license | import os
from flask import Flask, request, redirect
from flask import render_template
from re import sub, search
from os import listdir
from os.path import isfile, join
import pickle
import csv
UPLOAD_FOLDER = './static/images'
ALLOWED_EXTENSIONS = set(['png', 'jpg', 'jpeg', 'gif'])
app = Flask(__name__, static_ur... | true |
3cdebaa208cc02a488d23276b0b2ea8a2e8d8b15 | Python | lavenblue/LSSA | /data/generate_input.py | UTF-8 | 4,602 | 2.765625 | 3 | [] | no_license | import numpy as np
import pandas as pd
import copy
import pickle
class data_generation():
def __init__(self, type):
print('init------------')
self.data_type = type
self.dataset = self.data_type + '/'+self.data_type + '_dataset.csv'
self.train_users = []
self.t... | true |
29abc544d8d847160baafd57e939a4d26d225c72 | Python | Zylanx/alex-bot | /setup.py | UTF-8 | 845 | 2.546875 | 3 | [
"MIT"
] | permissive | # creates databases in mongodb
import sys
def leave(str):
print(str)
exit(1)
try:
assert sys.version_info[0] == 3 and sys.version_info[1] > 5
except AssertionError:
leave("you need to have python 3.6 or later.")
try:
import config
import psycopg2
except ImportError(config):
leave("you n... | true |