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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
fdb997e636d218a108cd68e7ec35c3d2e1b7b21f | Python | uxhamzah/Go-green-projects | /ML-api/main.py | UTF-8 | 1,969 | 2.6875 | 3 | [] | no_license | import os
from flask import Flask, jsonify, request
from tensorflow.keras.preprocessing import image
from tensorflow.keras.models import load_model
import tensorflow_hub as tfhub
import numpy as np
from flask_cors import CORS
labels = {0: "cardboard", 1: "glass", 2: "metal", 3: "paper", 4: "plastic", 5: "trash"}
# P... | true |
4458de27173f3a847909fcc39091cb15beef696c | Python | josiah-wolf-oberholtzer/aurora | /aurora/utils/mathutils/round_x_to_nearest_multiple_of_y.py | UTF-8 | 242 | 2.84375 | 3 | [] | no_license | from abjad import Duration
def round_x_to_nearest_multiple_of_y(x, y):
fx = float(x)
fy = float(y)
div, mod = divmod(fx, fy)
if (mod / fy) < 0.5:
return int(div) * y
else:
return int((div + 1)) * y
| true |
bf931ac055e8489e3320e6c85f8730d69c9ccd60 | Python | leandrotune/Python | /pacote_download/PythonExercicios/ex041.py | UTF-8 | 347 | 3.4375 | 3 | [
"MIT"
] | permissive | from datetime import date
ano = int(input('Ano de nascimento: '))
atual = date.today().year
idade = atual - ano
if idade <= 9:
print('MIRIM')
elif idade > 9 and idade <= 14:
print('INFANTIL')
elif idade > 14 and idade <= 19:
print('JUNIOR')
elif idade > 19 and idade <= 20:
print('SENIOR')
elif idade > 2... | true |
99c81b6991406269cec2eaa785eadc3a14868fc8 | Python | wuziwei1994/project_learn | /api/task/Task_006/putInfoToDict.py | UTF-8 | 657 | 2.84375 | 3 | [] | no_license | import pprint
def putInfoToDict(fileName):
fileName1 = open(fileName,'r').readlines()
stu = []
stu_map = {}
for i in fileName1:
stu.append(i.replace(' ','').replace('\t','').replace("'",'').replace(';','').replace('\n',''))
for one in stu:
if one == '':
break
name... | true |
47dc42f342d634d7e8e7e7fe56a700cd45b86550 | Python | kimsehwan96/studying_python | /M_level/lambda/lambda_example_1.py | UTF-8 | 466 | 3.53125 | 4 | [] | no_license | if __name__ == "__main__":
testArr1 = [1,2,3,4,5,6,7,8,9,10]
testArr2 = [2,4,6,8,10,12,14,16,18,20]
outArr1 = list(map(lambda x: 'OK' if x % 2 == 0 else x, testArr1))
print('Lambda Example1 : ', outArr1)
outArr2 = list(map(lambda x: 'First' if x == 1 else 'Second' if x == 2 else x * x, testArr1))... | true |
ea87ef83be509a553cd76da4129ba215950d1dd9 | Python | rizveeredwan/DownloadTube | /DownloadTube.py | UTF-8 | 6,270 | 2.921875 | 3 | [] | no_license | #importing the module
from pytube import YouTube
import moviepy.editor as mp
import time # time module
import string
import os
from math import ceil
class YouTubeDownloader:
def __init__(self):
pass
def ClearName(self, name):
new_name = ""
for i in range(0,len(name)):
if(nam... | true |
d6e0c27da75b20ad88641adc2ec8a3e5e9b280e8 | Python | BenMatase/MrLoveBot | /LikedMsg.py | UTF-8 | 763 | 3 | 3 | [] | no_license | MSG_LIM = 40
class LikedMsg:
def __init__(self, message):
self.message = message
self.likers = []
def __str__(self):
return "{} [{}]: \"{}\"".format(
self.message.from_user.username,
str(len(self.likers)),
self.limit_length(self.message.text, MSG_LIM... | true |
568caeb26ba17338a2cce71cbed3b1de0b3087a1 | Python | UserChen666/linear-program-solver | /lp/lp_solver.py | UTF-8 | 15,539 | 3.1875 | 3 | [] | no_license | from sys import float_info, stdin
from re import split
from math import isclose, trunc
####################################################################
# CONSTANTS
####################################################################
COMPARISON_EPSILON = 0.0000001 # Delta for comparing floats
CSI = 1 ... | true |
d058b6ca7cbb2c7031aa0e4f98532f4f54d69175 | Python | PM-LiuGang/myself | /Desktop/myself/Project/python_project_highlights/9/imageRename.py | UTF-8 | 11,860 | 2.53125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import os
import os.path
from PyQt5 import QtCore, QtWidgets
from PyQt5.QtWidgets import QMainWindow,QFileDialog,QMessageBox
import imageMark # 导入模块
class Ui_RenameWindow(QMainWindow):
# 构造方法
def __init__(self):
super(Ui_RenameWindow, self).__init__()
self.setWindowFl... | true |
b295833ab56c80654f01f8ba5bde281d20fc0c93 | Python | tcrensink/tsar | /tsar/doctypes/doctype.py | UTF-8 | 4,201 | 2.84375 | 3 | [
"MIT"
] | permissive | from abc import ABC, abstractmethod
import collections.abc
# required fields for all DocTypes; used by app/framework. Uses pandas/numpy dtypes.
BASE_SCHEMA = {
"document_id": object,
"document_name": object,
"document_type": type,
"primary_doc": bool,
"content": object,
"links": object,
}
ELA... | true |
28411f7cf580a0dd9b4c6bb4aeb73ce22372cdd5 | Python | andrewminai24/Triplebyte | /PythonQuestions/sum.py | UTF-8 | 42 | 3.125 | 3 | [] | no_license | x = sum([x*x for x in [1,2,3]])
print(x)
| true |
98f763bd336731f8fa0bd853d06c059dd88d8ca7 | Python | septhiono/redesigned-meme | /Day 2 Tip Calculator.py | UTF-8 | 316 | 4.03125 | 4 | [
"MIT"
] | permissive | print('Welcome to the tip calculator')
bill = float(input('What was the total bill? $'))
tip= float(input('What percentage tip would you like to give? '))
people = float(input("How many people split the bill? "))
pay= bill*(1+tip/100)/people
pay=float(pay)
print("Each person should pay: $",round(pay,2))
| true |
c79a32fa1f01658c4bc554e1e21c4a7e7b4a602a | Python | BIAOXYZ/variousCodes | /_CodeTopics/LeetCode/1001-1200/001185/WA--001185.py | UTF-8 | 1,083 | 3.5625 | 4 | [] | no_license | class Solution:
def dayOfTheWeek(self, day: int, month: int, year: int) -> str:
# "1971.1.1" 是周五
# 这题算简单有点过了吧?。。。
dic = {0:"Sunday", 1:"Monday", 2:"Tuesday", 3:"Wednesday", 4:"Thursday", 5:"Friday", 6:"Saturday"}
totalDays = 0
totalDays += 365 * (year - 1971)
... | true |
1af113a41c856f9ac55ef26a4e6ab8b33e7f63ef | Python | PatrykSkowron/simple_algorithms | /sorting/test/quicksort/quicksort.py | UTF-8 | 976 | 3.4375 | 3 | [] | no_license | from QuickSort import *
import unittest
from random import *
class TestQuickSort(unittest.TestCase):
def _testing(self,A):
Bt,B = log_time(sorted,A)
At,A = log_time(QuickSort,A)
self.assertEqual(A,B)
print("OK!\nlength: %d \nAlgorithm time: %.5f seconds. \nBuilt in time: %.5f seconds." % (len(A),At,Bt))
... | true |
b6ed9442ad555bf1fc4ffc7d1d66eeea7725a60c | Python | AnitaGhandehari/Artificial_Intelligence | /Decoding_Text_Using_Genetic_Algorithm/code.py | UTF-8 | 12,000 | 2.875 | 3 | [] | no_license | import re
import string
import self as self
from nltk.corpus import stopwords
import random
from timeit import default_timer as timer
def process_global_text():
global_text = open("global_text.txt", "r")
set(stopwords.words('english'))
new_stop_words = stopwords.words('english') + ['I', 'An',... | true |
b8c764aaa155bb8437728188aacedbe965a6d7d5 | Python | sanchuanmo/CodeProjects | /PCRbot/demo2.py | UTF-8 | 856 | 2.734375 | 3 | [] | no_license | from boss import Boss as Boss
from player import Player
# import re
#
# roleNormal = r'^(\w+)\s+(\d+)$'
# roleUnnormal = r'^(\w)@(\w)\s+(\d)$'
#
# m = re.match(roleNormal,"完成 12341234324")
#
# print(m)
#
# m = re.match(r'^(\d{3})-(\d{3,8})$', '010-12345')
#
# print(m)
import datetime
import threading... | true |
e9d71db534fdc069f99de1c0b3e1c59fd63b869a | Python | cheeordie1/Article-Filterer | /nlp/highlightNew.py | UTF-8 | 1,543 | 3.484375 | 3 | [] | no_license | from sklearn.neighbors import NearestNeighbors
import numpy as np
# Splits the new document into relevant sections
def getSections(doc):
return doc.split("\n")
"""
hasCloseNeighbors(data,knowledge,dist,threshold)
params:
data: representation of potentially new block of information
knowledge: a model of what we ... | true |
a99e96673089633f9b134376b6e0a6a97360aaf4 | Python | nash1588/BasketballCourtTagger | /ManualCourtEdgesTaggerGUI.py | UTF-8 | 15,786 | 2.59375 | 3 | [] | no_license | import pickle
import re
import cv2
import numpy as np
from matplotlib import pyplot as plt
import argparse
import os, time, random
import tkinter as tk
from tkinter import messagebox
from PIL import ImageTk, Image
GAME_IMG_RATIO = 0.45
COURT_IMG_RATIO = 0.4
COLORS = [(0, 0, 255), (28, 255, 111), (25... | true |
9391a9c86020320be85b4bed1014ad7306c66dca | Python | ashjambhulkar/objectoriented | /LeetCodePremium/344.reverse-string.py | UTF-8 | 371 | 2.703125 | 3 | [] | no_license | #
# @lc app=leetcode id=344 lang=python3
#
# [344] Reverse String
#
# @lc code=start
class Solution:
def reverseString(self, s: List[str]) -> None:
def helper(s,l=0, r = len(s)-1 ):
if l >= r:
return
s[l], s[r] = s[r], s[l]
helper(s, l+1, r-1)
he... | true |
f6bdd115927aa025bfae95378eaa4ac4a83ea688 | Python | surkjin/kosmo41_surkjin | /Python/01.Basic/03-02-function2.py | UTF-8 | 183 | 3.171875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Thu Dec 6 15:15:05 2018
@author: kosmo30
"""
def hello(name):
print("Hello!", name)
hello("홍길동")
hello("전우치")
hello(1234567) | true |
ec2fed450be61f5bd4d1ee45fd04391f05e66590 | Python | chrislooong/projecteuler | /12.py | UTF-8 | 686 | 3.6875 | 4 | [] | no_license | # Strategy: get next triangle number, find the number of factors by parsing the numbers until its square root`
import math
triangle_number = 1
triangle_incrementer = 1
while True:
to_be_divided = triangle_number
num_factors = 0
potential_factor = 1
while potential_factor <= math.sqrt(triangle_number):
... | true |
46bf08f396a91e7867e39ef2a3666f7646f46507 | Python | vtrd2/transfer_video_style_programs | /get_webcam_images.py | UTF-8 | 629 | 2.578125 | 3 | [] | no_license | import cv2
from settings import Settings
settings = Settings()
video = cv2.VideoCapture(settings.num_camera)
def inverts_red_and_blue(ndarray):
for num_line, line in enumerate(ndarray):
for num_pixel, pixel in enumerate(line):
ndarray[num_line][num_pixel] = list(reversed(pixel))
... | true |
3094ec9465d17c25fcd01b3e124a0cc4a1f66c50 | Python | ladyrick/tss | /screen.py | UTF-8 | 1,242 | 3.15625 | 3 | [] | no_license | import curses
import os
import tss
class Screen():
def __init__(self):
cols, rows = os.get_terminal_size()
self.rows = rows
self.cols = cols
def __enter__(self):
self.__screen = curses.initscr()
curses.noecho()
curses.cbreak()
curses.curs_set(False)
... | true |
a71bee045675b06eae222fd3bb8ee873bbe250b8 | Python | caiqinxiong/python | /day02/homeWork/HighLevel/《sunmorg同学》第2章·day02-数据类型[第1次]/02_homework.py | UTF-8 | 3,368 | 4 | 4 | [] | no_license | '''
1. 用户先给自己的账户充钱:比如先充3000元。
2. 页面显示 序号 + 商品名称 + 商品价格,如:
1 电脑 1999
2 鼠标 10
…
n 购物车结算
3. 用户输入选择的商品序号,然后打印商品名称及商品价格,并将此商品,添加到购物车,用户还可继续添加商品。
4. 如果用户输入的商品序号有误,则提示输入有误,并重新输入。
5. 用户输入n为购物车结算,依次显示用户购物车里面的商品,数量及单价,若充值的钱数不足,则让用户删除某商品,直至可以购买,若充值的钱数充足,则可以直接购买。... | true |
45f53104e37c13ff9ae66b635d73a60675e2b6a0 | Python | Markauto/PythonConwayGameOfLife | /Cell.py | UTF-8 | 560 | 3.4375 | 3 | [] | no_license | import pygame
class Cell:
alive = False
colour = (0, 0, 0)
rectWidth = 1
rectangle = pygame.rect.Rect(0, 0, 0, 0)
def hover(self):
self.colour = (255, 0, 0)
def clear_hover(self):
self.colour = (0, 0, 0)
def clicked(self):
self.alive = True
def alt_click(sel... | true |
4f8e686211d2c71b089825b5eb1ad6bf631c2b2e | Python | Aasthaengg/IBMdataset | /Python_codes/p03243/s816125600.py | UTF-8 | 224 | 3.1875 | 3 | [] | no_license | def main():
n = input()
if n[0] == '0':
print('111')
elif n[0] < n[1] or n[0] < n[2]:
print((int(n[0]) + 1) * 111)
else:
print(int(n[0]) * 111)
if __name__ == '__main__':
main()
| true |
008c3c2446ae9b473372fbeb74992d2989b7f173 | Python | davidangel/datapup | /test/models/stats_test.py | UTF-8 | 1,177 | 2.828125 | 3 | [] | no_license | import unittest
import analytics
import pandas as pd
class StatsTest(unittest.TestCase):
def setUp(self):
self.app = analytics.create_app('test')
def test_get_summary(self):
summary = analytics.models.stats.get_summary(['sportdog'])
self.assertIn('week', summary['sportdog'])
s... | true |
97deb14cc7bec0223984c5af252e78dd2b2063da | Python | sh4nnu/cp_practice | /practice problems/foobar_3_1.py | UTF-8 | 709 | 3.046875 | 3 | [] | no_license | def XORrow(begin, size):
head = 0
tail = 0
n=size
if(size == 0):
return 0
elif (size ==1):
return begin
elif (size == 2):
return begin ^ begin+1
else:
if(begin&1):
head = begin
size-=1
if(size&1):
tail = begin + n-1 ... | true |
088701c74d141f607855a9919bfe9b03b9b3a34c | Python | ahmedloona/alpha | /appacademy-online-enumerable-exercises-c9c21b3ea398/lib/enumerables2.py | UTF-8 | 4,445 | 3.8125 | 4 | [] | no_license | #require 'byebug'
# EASY
# Define a method that returns the sum of all the elements in its argument (an
# array of numbers).
def array_sum(arr):
result = 0
for num in arr:
result += num
return result
# Define a method that returns a boolean indicating whether substring is a
# substring of each s... | true |
ca96101d17052d21450b70446fc96ea0f305790d | Python | noveljava/study_leetcode | /completed/77_combinations.py | UTF-8 | 468 | 2.953125 | 3 | [] | no_license | from typing import List
class Solution:
def combine(self, n: int, k: int) -> List[List[int]]:
result: List = []
def backtracking(k, start, stack_result):
for j in range(start, n+1):
if k != 1:
backtracking(k-1, j+1, stack_result+[j])
... | true |
e81990778282d3271a763b7e7140e86104c1bb9d | Python | Jyotirm0y/kattis | /vaccineefficacy.py | UTF-8 | 648 | 3.03125 | 3 | [] | no_license | n = int(input())
control = []
strains = []
for _ in range(3):
strains.append([])
for _ in range(n):
s = input()
control.append(s[0] == 'Y')
strains[0].append(s[1] == 'Y')
strains[1].append(s[2] == 'Y')
strains[2].append(s[3] == 'Y')
vaccinated = sum(control)
unvaccinated = n - vaccinated
for v i... | true |
397fd7c3ddc7d4070f097d730a762164813c7aa0 | Python | ij251/grad_NOCI | /test/h3/90/plotting.py | UTF-8 | 925 | 3.015625 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
def plot_derivatives():
analytic = np.loadtxt("analytic_derivatives.txt")
numerical = np.loadtxt("numerical_derivatives.txt")
x_analytic = analytic[:,0]
x_numerical = numerical[:,0]
e1_analytic = analytic[:,1]
e1_numerical = numerical[:,1]
... | true |
2d0af9c2ed1e9ec10ae55fda15916f63ffe93e31 | Python | Ktoh20/CS550 | /charts.py | UTF-8 | 484 | 3.03125 | 3 | [] | no_license | import random
import matplotlib.pyplot as plt
results = []
for j in range(1000):
total = 0
for i in range(10):
flip = random.randint(0,1)
total += flip
results.append(total)
display = [0 for i in range(11)]
for i in range(len(results)):
display[results[i]]+=1
x_axis = [x for x in range(11)]
data2 = [y for y ... | true |
22dc6d03822ab9f21dbfe0b72936f44a9d5ddfa8 | Python | Gabriel-T-Harris/md2cf | /md2cf/confluence_renderer.py | UTF-8 | 2,532 | 2.859375 | 3 | [
"MIT"
] | permissive | import mistune
class ConfluenceTag(object):
def __init__(self, name, text='', attrib=None, namespace='ac', cdata=False):
self.name = name
self.text = text
self.namespace = namespace
if attrib is None:
attrib = {}
self.attrib = attrib
self.children = []
... | true |
5b8301ab9d3ea7bb9e3a60d685485ef46416e780 | Python | phil65/PrettyQt | /prettyqt/positioning/geocircle.py | UTF-8 | 1,087 | 2.921875 | 3 | [
"MIT"
] | permissive | from __future__ import annotations
from prettyqt import positioning
from prettyqt.qt import QtPositioning
from prettyqt.utils import get_repr
class GeoCircle(positioning.GeoShapeMixin, QtPositioning.QGeoCircle):
def __init__(
self,
center_or_other: None
| (
QtPositioning.QGeoS... | true |
55227a68f9b3870f0538d08d8d55c91809715eb1 | Python | haohaokankan/AlphaZero_Gobang | /TreeNode.py | UTF-8 | 3,206 | 3.46875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import numpy as np
'''
Node of MCTS Searching Tree
'''
class TreeNode(object):
def __init__(self, parent, prior_p):
self._parent = parent # parent node
self._children = {} # child nodes,a map from action to TreeNode
self._n_visits = 0 # visit count
self._Q =... | true |
195837a2f865c03f5edc0ade7bd2790edd45a1e7 | Python | ChocolatePadmanaban/Learning_python | /Day5/part7.py | UTF-8 | 345 | 3.53125 | 4 | [] | no_license | # Reding number of lines in a file an application of Else block in try catch
import sys
for arg in sys.argv[1:]:
try:
f=open(arg,'r')
except IOError:
print("Cannot open the file: ", arg)
else:
print(arg, "has", len(f.readlines()), 'lines')
f.close()
# Execute python part7.... | true |
1ec9d90ca6c5e0a4bbbc8c818bc2b04a560e2e61 | Python | JACflip55/final_computervision | /code/moustache.py | UTF-8 | 5,425 | 2.609375 | 3 | [] | no_license | import cv2
import math
import numpy
import Tkinter
import tkFileDialog
def draw(src, overlay, face_y, face_x):
height, width = overlay.shape[:2]
dst = src.copy()
d_height, d_width = dst.shape[:2]
#print "[",width,",",height,"]"
for y in range (0, height):
for x in range (0, width):
dest_x = translate(x,w... | true |
2228a9313823bfdce8adc3c57fad3e621897cb67 | Python | caseyjlaw/vlass | /scripts/VLASS_model.py | UTF-8 | 8,416 | 2.578125 | 3 | [
"BSD-3-Clause"
] | permissive | import argparse
import numpy as np
try:
import scipy.optimize as opt
except:
print('scipy not available. Will not run fit to estimate survey time.')
parser = argparse.ArgumentParser(description='Parameters for VLASS design calculator')
parser.add_argument('--fov', type=float, help='S-band primary beam ... | true |
4e783e96ebbec3cc6b72c35c4847b67966059421 | Python | antosojan98/python_2016 | /comment1.py | UTF-8 | 136 | 3.609375 | 4 | [] | no_license | # This program displays a person's
# name and address.
print('Kate Austen')
print('123 Full Circle Drive')
print('Asheville, NC 28899')
| true |
741391deeebd7979c9bc190deba0e204c0202eeb | Python | lightmen/leetcode | /python/tree/binary-tree-maximum-path-sum.py | UTF-8 | 614 | 3.203125 | 3 | [] | no_license | # Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution(object):
def max_sum(self,root):
if not root:
return (0,-sys.maxint)
left = self.max_sum(root.left)
... | true |
14aec6acf8441add03413c05f316b8eac8a98844 | Python | ArnoldoRicardo/test-python | /vectores.py | UTF-8 | 668 | 3.984375 | 4 | [] | no_license | #!/usr/bin/python
import math
def fr():
print "introduce la fuerza x"
fx= float(raw_input("> "))
print "introduce la fuerza y"
fy= float(raw_input("> "))
fr= str(math.sqrt(fx**2+fy**2))
print "la fuerza resultante es " + fr
raw_input ("> ")
angulo(fx,fy)
def angulo(fx,fy):
a = fy/f... | true |
f801628545621bd972cc104e42edf0f76e4b6e31 | Python | nmoya/coding-practice | /Algorithms/smallest100.py | UTF-8 | 519 | 3.53125 | 4 | [] | no_license | import heapq
def smallest_10_inefficient(array):
h = []
for value in array:
heapq.heappush(h, value)
output = []
for i in range(10):
output.append(heapq.heappop(h))
return output
def smallest_numbers(array, numbers):
h = array[::]
heapq.heapify(h)
output = []
for i in range(numbers):
output.append(he... | true |
a928fd33cb314868d2128fd2d4f62cd8ff844882 | Python | hibukki/whitecoins | /abe_client/abe_client.py | UTF-8 | 26,540 | 2.828125 | 3 | [] | no_license | import logging
import psycopg2
import json
import os
import base58
import time
import csv
class PostgreSQLInterface(object):
def __init__(self, db_name, username, password, host=None, port=None):
self._con = None
self.db_name = db_name
self.host = host
self.port = port
self... | true |
a824413e8094433399b4b1633e562dd1021d167a | Python | YixuanZheng/Aerosol_Inequality_2019 | /modules/SOM_Table1.Summarize_GDP_impacts_different_damage_functions.py | UTF-8 | 6,405 | 2.5625 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
'''
This code calculates aerosol-induced GDP changes based on different damage functions
and summaries results shown in Table S1:
Global economic impacts of aerosol-induced cooling derived from various forms of damage functions.
by Yixuan Zheng (yxzheng@carnegiescience.edu)
'''
im... | true |
0472d9609808fd374cdaf024935ffc7c22584d1b | Python | CoachEd/advent-of-code | /2015/day09/part1.py | UTF-8 | 1,200 | 3 | 3 | [] | no_license | import sys
import time
import itertools
start_secs = time.time()
print()
d=dict()
d['AlphaCentauri'] = 0
d['Snowdin'] = 1
d['Tambi'] = 2
d['Faerun'] = 3
d['Norrath'] = 4
d['Straylight'] = 5
d['Tristram'] = 6
d['Arbre'] = 7
cities = ['AlphaCentauri','Snowdin','Tambi','Faerun','Norrath','Straylight','Tristram','Arbre... | true |
9611c5f485c357222e866ddaf3420c8770be9cf9 | Python | madpad/pythonPractice | /collatz.py | UTF-8 | 287 | 3.3125 | 3 | [] | no_license | import sys
#
def collatz(number):
if number%2 ==0:
print(number//2)
elif number%2==1:
print(3*number + 1)
while True:
print('enter any number')
number=int(input())
collatz(number)
print(collatz(number))
if collatz(number)==1:
sys.ext()
elif collatz(number)!=1:
continue
| true |
ee6dc2cdbaf43d5129984ebb08b0da4c5a66b1ad | Python | msn322/Python | /Day1/appMaths.py | UTF-8 | 333 | 3.125 | 3 | [] | no_license | given_list = [ 4, 5, 8, 0]
def max_num(num1, num2, num3):
if num1 >= num2 and num1 >= num3:
print("We reached this far")
return num1
elif num2 >= num1 and num2 >= num3:
print("Num2 is a Major")
return num2
else:
print("Num3 is a score")
return num3
print(max... | true |
2f9d9411bf86d6a3cac89e5bf3317e7b5c88a343 | Python | bbengfort/confire | /tests/test_paths.py | UTF-8 | 10,669 | 2.53125 | 3 | [
"MIT"
] | permissive | # tests.test_paths
# Testing the paths descriptor
#
# Author: Benjamin Bengfort <benjamin@bengfort.com>
# Created: Thu Jun 11 08:09:40 2015 -0400
#
# Copyright (C) 2014 Bengfort.com
# For license information, see LICENSE.txt
#
# ID: test_paths.py [] benjamin@bengfort.com $
"""
Testing the paths descriptor
"""
####... | true |
563c8962767a34c90f91c8c73f66e54512a313eb | Python | urbandataanalytics/SwissKnife | /SwissKnife/gcloud/GCloudStorage.py | UTF-8 | 15,919 | 2.859375 | 3 | [
"MIT"
] | permissive | import os
import logging
import backoff as backoff
import google.cloud.storage as gcloud
from google.cloud.exceptions import GoogleCloudError
from google.cloud.storage.blob import Blob
from SwissKnife.info.BucketPath import split_bucket
from SwissKnife.info import BUCKET_NAME, BUCKET_PATH_PREFIX
MAX_TIME_RETRYING =... | true |
ff90cb07c3b681c5efe13acabb5ca7e2ce57b4e3 | Python | robintw/pandas-FSDR | /FSDR.py | UTF-8 | 6,313 | 3.796875 | 4 | [] | no_license | import pandas as pd
try:
from IPython.display import Markdown
except ImportError:
Markdown = lambda x: x
def FSDR(df, main_col, other_col, rel_thresh=30, abs_thresh=None,
return_text=True, markdown=True, value_suffix="",
comparison_text_larger='larger', comparison_text_smaller='smaller',
... | true |
9af8e209c81c657eb917badb30cbbc5f58edaae8 | Python | ChoHyoungSeo/Algorithm_prac | /python/boj/2012.py | UTF-8 | 904 | 3.046875 | 3 | [] | no_license | tot = int(input())
tar_list = []
std_list = [x+1 for x in range(tot)]
cnt = 0
for i in range(tot):
tar_list.append(int(input()))
tar_list.sort()
for i in range(tot):
# cnt += abs(sorted(tar_list)[i] - std_list[i])
cnt += abs(tar_list[i] - std_list[i])
print(cnt)
# #python으로 시간초과,,pypy로 정답
# n = int(inpu... | true |
dc2b0cb2e981a916e77b6397b9cd49f46d1a9714 | Python | gqjuly/hipython | /helloword/2020_7_days/demo/5_1循环for.py | UTF-8 | 967 | 4.15625 | 4 | [] | no_license | #for
# for 主要是用来遍历/循环 序列或者集合、字典
# a = ['apple', 'orange', 'banana', 'grape']
#
# for x in a:
# print(x)
#
#for 和else else很少用
# a = [['apple', 'orange', 'banana', 'grape'], (1, 2, 3)]
#
# for x in a:
# for y in x:
# print(y, end=' ')
# else:
# print('fruit is gone')
#break
# a = [1, 2, 3]
# for ... | true |
1b998a6e74f9911000a65dd3754750c4cc30047b | Python | quarter26/Python-100-Days | /Day01-15/myAnswer/day6/gcd_lcm.py | UTF-8 | 152 | 3.40625 | 3 | [] | no_license | def gcd(x, y):
while x != y:
if y > x:
x, y = y, x
x = x - y
return x
def lcm(x, y):
return x * y // gcd(x, y)
| true |
5c3f99706ec2d60bddf0731b9faf4f29cf3af15d | Python | rafaelsaidbc/Exercicios_python | /ex048.py | UTF-8 | 373 | 4.0625 | 4 | [] | no_license | '''Faça um programa que calcule a soma entre todos os números ímpares que são múltiplos de três e que se
se encontram no intervalo de 1 até 500'''
soma = 0
for variavel in range(1, 500 + 1, 2):
if variavel % 3 == 0:
soma += variavel
print('A soma dos números ímpares e múltiplos de 3 que existem entre 1 e 50... | true |
211a2e913e7c90a54983677bbf11fe8abaab0773 | Python | paulosmolski/exercism | /python/run-length-encoding/run_length_encoding.py | UTF-8 | 829 | 3.28125 | 3 | [] | no_license | def decode(string):
if not string:
return ""
prevchar = ""
out = ""
count = 1
for x in string:
if x.isdigit() and not prevchar.isdigit():
count = int(x)
elif x.isdigit() and prevchar.isdigit():
count = int(str(count) + x)
else:
out ... | true |
77fdf2ba443e986b36c13a0a07c75fd18bb9ccb6 | Python | okuno-c/AIBASIC | /homework1_1.py | UTF-8 | 1,446 | 4.03125 | 4 | [] | no_license | #1
# name = input("Enter your name :")
# age = input("Enter your age :")
# intro = "My name is "+name+". I'm "+age+" years old."
# print(intro)
#2
# weight = float(input("Input your weight(kg)"))
# height = float(input("Input your height(m)"))
# bmi = weight/(height*height)
# print(bmi)
#3
# student_list=["ichiro"... | true |
ea39f4df03c02621dd1b41148f24cdd362a33c0e | Python | leonardorock/StarClassifier | /OtherAlgorithms/knn.py | UTF-8 | 754 | 3.15625 | 3 | [] | no_license | import pandas as pd
from sklearn.neighbors import KNeighborsClassifier
from sklearn.model_selection import train_test_split
dataset = pd.read_csv("input/stars.csv", na_values=' ')
print(dataset)
X = dataset[["L","R", "A_M"]].copy()
T = dataset[["Type"]].copy()
X_train, X_test, y_train, y_test = train_test_split(X, ... | true |
6c92aeafca1e6df0f836cb8414f8c526c69516d8 | Python | juil-nano-introtoprogramming/project03 | /break_time.py | UTF-8 | 459 | 3.53125 | 4 | [] | no_license | """Opens a Youtube video in a web browser every 2 hours."""
import time
import webbrowser
total_breaks = 3
break_time = 60 * 60 * 2 #2 hours
music = ["https://youtu.be/s4EmxvQSpfA?t=1m50s",
"https://youtu.be/OD3F7J2PeYU?t=10s",
"https://youtu.be/YQHsXMglC9A?t=2m20s"]
print "You are starting at " + ti... | true |
185feff1b4e37ddf5ee4ed5bc5094d54d82ed244 | Python | MelancholyMing/TF_learning | /NG_course/anomaly_detection_and_recommendation/anomaly_detection.py | UTF-8 | 3,013 | 2.8125 | 3 | [] | no_license | # 异常检测
import matplotlib.pyplot as plt
import seaborn as sns
sns.set(context='notebook', style="white", palette=sns.color_palette("RdBu"))
import numpy as np
import pandas as pd
import scipy.io as sio
from scipy import stats
from sklearn.model_selection import train_test_split
from sklearn.metrics import f1_score, c... | true |
a50d28f01bace1d353e0654d865277af8af4fdfb | Python | friend0/tower | /logs/logparser.py | UTF-8 | 2,096 | 2.765625 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"ISC"
] | permissive | __author__ = 'Kevin-Patxi'
import matplotlib.pyplot as plt
with open("octrl.log",'r') as f:
loc_x = []
loc_y = []
loc_z = []
loc_yaw =[]
loc_pitch =[]
loc_roll =[]
roll= []
pitch = []
yaw = []
thrust = []
in_out_toggle = 0
i=0
for line in f:
if "DEBUG" in... | true |
471cbbec73bc44b16972d1ab646833e9dc122d14 | Python | kuythu/PythonTest1 | /helloworld.py | UTF-8 | 173 | 2.921875 | 3 | [] | no_license | from tkinter import *
root=Tk()
mylabel = Label(root,text="I am a label widget")
mybutton = Button(root,text="I am a button")
mylabel.pack()
mybutton.pack()
root.mainloop() | true |
9a47ae3f1c3ab02f85a57706b69b44dfc34959f1 | Python | RegaipKURT/Machine-Learning-Python | /b-20-Apriori.py | UTF-8 | 721 | 3.015625 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Mar 15 04:18:20 2018
@author: regkr
"""
# 1. kutuphaneler
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
veriler = pd.read_csv("sepet.csv", header=None)
t = []
for i in range(0,7501):
t.append([str(veriler.val... | true |
27914a8aa41e32c2232fd83ca9f0dff7a687453f | Python | Mayur-Debu/Datastructures | /Linked List/Intermediate/Exercise_20.py | UTF-8 | 2,155 | 4.28125 | 4 | [] | no_license | """
Function for deletion from a linked list.
"""
class Node:
def __init__(self, data):
self.data = data
self.next = None
class CircularLinkedList:
def __init__(self):
self.head = Node(None)
self.tail = Node(None)
self.head.next = self.tail
self.tail.next = se... | true |
ad3e930592a062fa16cb3802e589bbe7ef0e68cc | Python | youhusky/Facebook_Prepare | /Wepay and OfferUp/645. Set Mismatch.py | UTF-8 | 1,104 | 3.5625 | 4 | [
"MIT"
] | permissive | # The set S originally contains numbers from 1 to n. But unfortunately, due to the data error, one of the numbers in the set got duplicated to another number in the set, which results in repetition of one number and loss of another number.
# Given an array nums representing the data status of this set after the error.... | true |
d8f2309df914fac990f45d13fd2ba2b8335b11d7 | Python | PMiskew/codingbat_solutions_python | /warmup2/string_match.py | UTF-8 | 834 | 4.09375 | 4 | [] | no_license | '''
Given 2 strings, a and b, return the number of the positions where they contain the same length 2 substring. So "xxcaazz" and "xxbaaz" yields 3, since the "xx", "aa", and "az" substrings appear in the same place in both strings.
string_match('xxcaazz', 'xxbaaz') → 3
string_match('abc', 'abc') → 2
string_match(... | true |
34182e16749db766833c0f6ce1e3f63376ccd1da | Python | rakshith67/practice-python | /file/io/binary.py | UTF-8 | 848 | 2.890625 | 3 | [] | no_license | with open("binary", 'bw') as binary_file:
binary_file.write(bytes(range(17)))
with open("binary", 'br') as bin_file:
for b in bin_file:
print(b)
a = 65534
b = 65535
c = 65536
x = 2998302
with open("binary2", 'bw') as binary_file2:
binary_file2.write(a.to_bytes(2, "big"))
binary_file2.write(b.... | true |
5f0aac9b9b7a387a07d09047ccd94661e83a7f35 | Python | Brikshya41/python_assignment_dec1 | /radius_of_circle.py | UTF-8 | 208 | 4.0625 | 4 | [] | no_license | def calculatearea(radius = 0):
return (22/7)*radius*radius
radius = float(input("Enter the radius of a circle "))
print("Area of circle with radius {0} is {1:.3f} ".format(radius,calculatearea(radius))) | true |
20efd654a510de3103d6346c01003c36f7eda8a4 | Python | kaustubh-seachange/PySyft | /packages/syft/tests/syft/core/tensor/adp/phi_tensor_test.py | UTF-8 | 10,513 | 2.59375 | 3 | [
"LicenseRef-scancode-warranty-disclaimer",
"Apache-2.0",
"Python-2.0"
] | permissive | # stdlib
# stdlib
from typing import Dict
# third party
import numpy as np
import pytest
# syft absolute
import syft as sy
from syft.core.adp.data_subject import DataSubject
from syft.core.tensor.autodp.phi_tensor import PhiTensor as PT
from syft.core.tensor.tensor import Tensor
@pytest.fixture
def ishan() -> DataS... | true |
f51da9f67ab158a3ade2a93f4b8f32af077a98ac | Python | fanhuafeng/PaddlePaddle-CRNN | /utils/decoder.py | UTF-8 | 1,994 | 3.453125 | 3 | [
"Apache-2.0"
] | permissive |
import Levenshtein as Lev
from itertools import groupby
import paddle
def ctc_greedy_decoder(probs_seq, vocabulary, blank=0):
"""CTC贪婪(最佳路径)解码器。
由最可能的令牌组成的路径被进一步后处理
删除连续的重复和所有的空白。
:param probs_seq: 每个词汇表上概率的二维列表字符。
每个元素都是浮点概率列表为一个字符。
:type probs_seq: list
:param vocabula... | true |
e9fedc6eacaf908131669a1e2edbe3307f612d52 | Python | TopChef/TopChef | /topchef/models/errors/job_with_uuid_not_found_error.py | UTF-8 | 826 | 3 | 3 | [] | no_license | """
Contains an exception thrown if a job with a particular ID is not found
"""
from ..interfaces import APIError
from uuid import UUID
class JobWithUUIDNotFound(APIError):
"""
Thrown if a job with a given UUID is not found
"""
def __init__(self, offending_id: UUID):
self._job_id = offending_i... | true |
f7d0758c1327d5fa6adb14287336cdf656d842dd | Python | TheArvinLim/UoA_PIC | /PotentialSolver.py | UTF-8 | 5,837 | 3.046875 | 3 | [] | no_license | import numpy as np
import scipy.sparse
import scipy.sparse.linalg
from BoundaryClasses import FieldBoundaryCondition
class PotentialSolver:
"""Solves the potentials at grid points given charge densities and boundary conditions. Uses the discretized
Poisson equation (Laplacian(potential) = - (charge density) ... | true |
ac7af8bea9220141f501e5c0176a713a37d79ffd | Python | aarizag/FunctionalProgramming | /Amuse-Bouche/double_and_sum.py | UTF-8 | 7,649 | 3.25 | 3 | [] | no_license |
from functools import reduce
from typing import List, Tuple
#
# Iterate through the indices
#
def doubleAndSum_1a(xs: List[int]) -> int:
"""
indexed loop
local variables: i, acc.
"""
(acc, i) = (0, 0)
while i < len(xs):
(acc, i) = (acc + (i%2 + 1) * xs[i], i+1)
retur... | true |
b9079cf1a2c3ff2a03ef43146caf26a104192108 | Python | fuwizeye/battling-knights | /knight.py | UTF-8 | 1,090 | 3.328125 | 3 | [] | no_license | from dataclasses import dataclass
from operator import attrgetter
from position import Position as Pos
from items import Item
# Status of the knight
knight_status = ('LIVE', 'DEAD', 'DROWNED')
@dataclass
class Knight:
color: str
name: str
position: Pos
status: str = knight_status[0]
attack_scor... | true |
128a22e7cfad338abc8b4d9627fa4fef2974fa12 | Python | radhikam/DSIP | /logtransform.py | UTF-8 | 348 | 2.59375 | 3 | [] | no_license | from pylab import *
aa = imread('Images/BnWFlower.jpg')
a = double(aa)
row,col = a.shape
c = a
for x in range(1,row,1):
for y in range(1,col,1):
c[x,y]=a.item(x,y)*((1)^(x+y))
b = abs(fft2(c))
b_log=log(1+b)
#plotting
figure(1)
subplot(2,2,1)
gray()
imshow(aa)
subplot(2,2,2)
gray()
imshow(b)
subplot(2,2,3)
... | true |
0cb5abecfa257378dc165246ef338a3ec91a111b | Python | hekunlie/astrophy-research | /DeCaLs/Fourier_Quad/correlation/correlation_exposure_wise/jack_test.py | UTF-8 | 1,042 | 2.609375 | 3 | [] | no_license | import h5py
from sys import argv
import numpy
def jack_label_check(labels):
n = int(len(labels)/2)
print("Labels: ", labels)
np_labels = numpy.zeros((n,3))
pl_all = []
pl = []
for i in range(n):
tag = int(2*i)
lb = [labels[tag], labels[tag+1]]
np_labels[i,:2] = labels[ta... | true |
b5bd4b7196eedb248e277999b184e6dbbb4f2509 | Python | BackEndTea/Learning | /Algorithms/heap/heap.py | UTF-8 | 1,556 | 3.265625 | 3 | [
"MIT"
] | permissive | from heapq import heappush, heappop
def main():
heaps(readfile())
def heaps(arr):
max_heap = [] # lowest numbers
min_heap = [] # highest numbers
for i in arr:
# initial case
if(len(max_heap) == 0):
heappush(max_heap, i * -1)
count_out(max_heap, min_heap)
... | true |
8edd1018533560d3e822bd0e9f2fbadf7b281a27 | Python | Kaushek-31/COVID-19-Detection | /trainimg_csv.py | UTF-8 | 2,244 | 2.546875 | 3 | [] | no_license | import numpy as np
from pandas import read_csv
import os
import csv
import cv2
import matplotlib.pyplot as plt
#Useful function
def createFileList(myDir, format='.ppm'):
fileList = []
print(myDir)
for root, dirs, files in os.walk(myDir, topdown=False):
for name in files:
if... | true |
6ca3e5f125572d8a319c0a9a40b60fe37ea75a78 | Python | waweraty/Reto-Cemex-Flask-App | /RegresorClass.py | UTF-8 | 681 | 3.140625 | 3 | [] | no_license | import numpy as np
class Regresor:
def __init__(self, regresor):
self.regressor = regresor
def calculaOptimo(self, datos_entrada):
datos = np.array(datos_entrada)
datos = datos.reshape(1, -1)
datos_salida = self.regressor.predict(datos)
return datos_sali... | true |
218af899d68404c080dbf1bc0ae3f599bc112c75 | Python | hoshizorahikari/hello | /iqiyi-you-get.py | UTF-8 | 3,152 | 2.625 | 3 | [] | no_license | import os
import requests
from bs4 import BeautifulSoup as BS
import re
import time
class iQiYi():
# use you-get
def __init__(self, url):
self.url = url
self.headers = {'User-Agent':
'Mozilla/5.0 (xyzdows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0... | true |
4dc6ef1ec60471a7f87f23535a47de5e2eb3afcc | Python | maximussJS/news | /models/comments.py | UTF-8 | 1,090 | 2.578125 | 3 | [] | no_license | from datetime import datetime
from sqlalchemy import Column, DateTime, Integer, String, create_engine
from sqlalchemy.ext.declarative import declarative_base
from config import SQLALCHEMY_DATABASE_URI
engine = create_engine(SQLALCHEMY_DATABASE_URI, echo=True)
base = declarative_base()
class Comment(base):
__tab... | true |
908ce51aa6a5af35583d5eaab90d415ba5216e39 | Python | felixlangschied/lncOrtho | /lib/cmsearch_parser.py | UTF-8 | 3,733 | 3.171875 | 3 | [
"MIT"
] | permissive | # cmsearch_parser: Parse the output of cmsearch while eliminating
# duplicates and filtering entries according to the
# defined cutoff.
# Arguments:
# cms: path to cmsearch output
# cmc: cutoff to decide which candidate hits should be included for the
# reverse BLAST search
# lc: ... | true |
bd4564eba56dbea6f2feb805d270ab6ccca7dafc | Python | DizzyProtos/URLcounter | /urlcounter/models.py | UTF-8 | 453 | 2.578125 | 3 | [] | no_license | from typing import Union
from django.db import models
class url_model(models.Model):
id = models.BigAutoField(primary_key=True)
url = models.URLField()
counted_json = models.JSONField()
@staticmethod
def get_existing_id(url_str) -> Union[int, None]:
try:
existing_model = url_m... | true |
6f2124fd368a7a0565b0a71c2d18548e7f94963d | Python | PudgyElderGod/Herd-Immunity-Simulation | /person.py | UTF-8 | 1,492 | 3.15625 | 3 | [] | no_license | import random
random.seed(42)
#random seed sets a random number so that it always stays the same, comment
#this out to test float values. Thx stack overflow for the clearification
from virus import Virus
class Person(object):
''' Person objects will populate the simulation. '''
def __init__(self, _id, is_v... | true |
0e9e0fefa1d488b156e9baa8e0abf1de6c1a32cb | Python | LemurPwned/interesting-code | /evolution.py | UTF-8 | 3,249 | 3.5625 | 4 | [] | no_license | import string
import random
'''
Cool note on the matter of speed and evolution of this algorithms. Let's see
that if we set the mutation_rate a lil'bit high i.e. like 0.2 (20%) we will get
quite close solutions very quickly, however, we won't or we are unlikely to get
any realistic results that converge. In oth... | true |
df33b273e396238bff63f5eea76f020b8633d7fb | Python | manasbedmutha98/Codechef | /ABREPEAT.py | UTF-8 | 304 | 2.890625 | 3 | [] | no_license | T = input()
for i0 in xrange(T):
[n,k] = map(int,raw_input().split())
s=raw_input()
s*=k
i=0
c=0
while i<(n*k)-1:
h=s.index("a",i+1)
j=h
while j<n*k-1:
m=s.index("b",j+1)
c+=1
j=m
i=h
print c
| true |
354cd8ef454e4832210d8f46a6c1934c477bd9f5 | Python | jwlhs104/DS_PA5_Subset | /DS_PA5/programming_hw5.py | UTF-8 | 2,943 | 3.875 | 4 | [] | no_license | ############################################
# 107-1 Data Structure and Programming
# Programming Assignment #5
# Instructor: Pei-Yuan Wu
############################################
import sys
import pdb
# **********************************
# * TODO *
# *******************************... | true |
117a6aeacda1bf592a099776cda3946239a9e26b | Python | Nihilnia/June1-June9 | /fourthHour.py | UTF-8 | 1,225 | 3.734375 | 4 | [] | no_license | """ 9- Modules """
# There is four ways to import modules
# 1- Importing all module
import math
#or
from math import *
# 2- Importing spesific 'things' from a module
from math import pow
# 3- Importing a module as a new name
import math as daftPunk
# 4- Importion spesific 'things' as a new nam... | true |
c491b8671bd2c45a427dbf9ab6b50587c6cedc64 | Python | bhishanpdl/Programming | /Python/interesting/sum_last_four.py | UTF-8 | 66 | 3.046875 | 3 | [
"MIT"
] | permissive | a = '123456'
mysum = sum( [int(i) for i in a[-4:]])
print(mysum)
| true |
2d1470488b9124610d9b26bc3475214ef3600cd1 | Python | mickelsonm/learn-luigi | /foo2bar-workflow-demo.py | UTF-8 | 1,139 | 2.78125 | 3 | [
"MIT"
] | permissive | #
# This was a demo taken from https://github.com/samuell/sciluigi and its
# associated links
#
# Intended for learning purposes only.
#
import sciluigi as sl
class MyWorkflow(sl.WorkflowTask):
# overrides workflow method
def workflow(self):
# init tasks
foowriter = self.new_task('foowriter', ... | true |
ca01f845cc6d26ee653bc0b849f590f26cf2e021 | Python | dommarinello/nlpfinalthesis | /app.py | UTF-8 | 8,864 | 3.09375 | 3 | [] | no_license | import streamlit as st
import pandas as pd
from io import StringIO
import nltk
nltk.download('punkt')
nltk.download('stopwords')
import re, pprint, string
from nltk import word_tokenize, sent_tokenize
from nltk.util import ngrams
from nltk.corpus import stopwords
#remove those which contain only articles, preposition... | true |
1b601f0eebe1b70a85138ebc89168b6ef167dfcc | Python | sean-gall-41/spectrum_visualizer | /audio_visualizer.py | UTF-8 | 6,232 | 2.546875 | 3 | [] | no_license | import sys
import os.path
import pyaudio
import wave
import numpy as np
from pyqtgraph.Qt import QtGui, QtCore
import pyqtgraph as pg
from scipy.fftpack import fft
from scipy.fftpack import fftfreq
import argparse
from argparse import RawTextHelpFormatter
import math
import struct
def generate_sin_wave_file(freq=440.... | true |
ab1fb338362c7b9bf36c244d9123d384fac510ec | Python | miquelramirez/polytope | /tests/plot_test.py | UTF-8 | 613 | 2.96875 | 3 | [
"BSD-2-Clause",
"BSD-3-Clause"
] | permissive | #!/usr/bin/env python
"""Tests for plotting."""
import matplotlib.patches
import polytope as pc
from polytope import plot
class Axes(object):
"""Mock class."""
def add_patch(self, x):
pass
def test_plot_transition_arrow():
p0 = pc.box2poly([[0.0, 1.0], [0.0, 2.0]])
p1 = pc.box2poly([[0.1, ... | true |
071857c84bfaaa10bbe00773e569743a4a1c7cea | Python | MohamadHaziq/100-days-of-python | /day_31-40/day_34/ui.py | UTF-8 | 2,335 | 3.453125 | 3 | [] | no_license | from tkinter import *
from quiz_brain import QuizBrain
THEME_COLOR = "#375362"
class QuizInterface:
def __init__(self, quiz_brain: QuizBrain):
self.quiz = quiz_brain
self.window = Tk()
self.window.title('Quizzler')
self.window.config(padx = 20, pady = 20, bg = THEME_COLOR)
... | true |
5287eee6cba18c5fbba42fbb532944e5da3473d8 | Python | edublancas/sklearn-evaluation | /src/sklearn_evaluation/plot/calibration.py | UTF-8 | 6,975 | 3.03125 | 3 | [
"MIT"
] | permissive | """
Calibration curve
NOTE: this is largely based in the scikit-plot implementation. License below.
MIT License
Copyright (c) [2018] [Reiichiro Nakano]
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the So... | true |
4fa1df8c24c67ad8a36d1dd14536d5c4a476a33f | Python | vic7z/python-programs | /python/Basics/evenorodd.py | UTF-8 | 139 | 3.703125 | 4 | [] | no_license | a=int(input("enter a number"))
if a%2==0:
print("{} is a even number".format(a))
else:
print("{} is not an even numbre".format(a)) | true |
2d9baa92edeca946e689e51142e61ca886d5fe50 | Python | JingboYang/SimpleAudioRecognition | /MicroblazePlotTools/fft_signal_gen.py | UTF-8 | 1,417 | 3.0625 | 3 | [] | no_license | from __future__ import division
import matplotlib.pyplot as plt
import numpy as np
import math
import pprint as pp
NUM_INPUT = 512 # Number of input points
INPUT_OFFSET = 8000 # "offset" from start of a "cycle"
FREQUENCY = 16000 # sampling rate
# magnitude for 1Kx2pi, 2Kx2pi, 3Kx2pi ...... | true |
8ffd1e6a450d5c5bf62bf6deeba533864b1108a6 | Python | arivvid27/Personal-Calendar-Reminder-System | /main.py | UTF-8 | 2,367 | 3.5 | 4 | [] | no_license | from replit import db
import datetime
from time import sleep
user_secure_name = input('WHAT IS YOUR REPL.IT USERNAME? > ')
sleep(2)
if user_secure_name in db:
print(f'Hi, {user_secure_name}!')
while True:
now = datetime.datetime.now()
print ("Current date and time is ")
print (now.strftime("%Y-%m-%d %H:%M:%... | true |
9f4c034bcd89df343dd87450ca24c15c6e9f96c4 | Python | ibadkureshi/tnk-locationallocation | /pmedian/functions/p_median/data.py | UTF-8 | 702 | 3.1875 | 3 | [
"MIT"
] | permissive | import pandas
class Error(Exception):
pass
def file_read(path):
with open(path) as f:
contents = f.readlines()
return contents
def create_df(data):
df = pandas.DataFrame(data)
return df
def parse_csv(contents, separator=","):
contents = [c.replace("\n", "") for c in contents]
... | true |
59f201e3561ff1cab37b396883a05b8af6428a2f | Python | superyoung9208/flask_learn | /watchlist/models.py | UTF-8 | 932 | 2.890625 | 3 | [] | no_license | from flask_login import UserMixin
from werkzeug.security import generate_password_hash, check_password_hash
from watchlist import db
class User(UserMixin, db.Model):
"""用户模型"""
id = db.Column(db.INTEGER, primary_key=True)
name = db.Column(db.String(32)) # 名字
password_hash = db.Column(db.String(128))
... | true |