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
e6c47074ba04aaae99e3d93222f3cc92082552ba
JhonattanReales21/Proyect_DS4A_Team30
/data_fetch/get_views.py
UTF-8
1,153
3.09375
3
[]
no_license
import pandas as pd from sqlalchemy import create_engine from os import environ from data_fetch.unpivoting import sub_pivots DB_URI = environ['URI'] ENGINE = create_engine(DB_URI) def get_view_by_name(view_name): """ This function is intended to fetch a whole (materialized) view/table data into a pd.Dataframe...
true
4c978651f066fbca425cc6ff6cced9afaebfabe8
venkatram64/index_search
/tf_idf/my_tf_idf.py
UTF-8
2,559
3.484375
3
[]
no_license
import pandas as pd import math #https://www.youtube.com/watch?v=hXNbFNCgPfY #https://www.youtube.com/watch?v=Jh1kuqm4rMc&list=PLlWzRW5RWfEX-HeTjCDWTRCOhISKrPAep ''' tf(w) = Number of times the word appears in a document/Total number of words in a document idf(w) = log(Total Number of documents/Number of documents th...
true
c5b44c29c1be111f5559e12a3b97ffb1bbfc81ac
sun70/DjangoShppoingCart
/AjaxDemoApp/views.py
UTF-8
1,001
2.5625
3
[]
no_license
from django.core.serializers import json from django.http import JsonResponse from django.shortcuts import render # Create your views here. from django.views.decorators.csrf import ensure_csrf_cookie @ensure_csrf_cookie def index(request): item_count=0 if request.is_ajax(): data = {"item_count":item...
true
62193dfd467e5752d5492c4ee25b4d716e5d8af4
jagraves21/Geometric-Graphs
/python/generators.py
UTF-8
2,088
3.265625
3
[]
no_license
import numpy from sklearn.neighbors import BallTree import networkx import itertools def generate_points(count): from math import pi radius = numpy.random.uniform(size=count) theta = numpy.random.uniform(size=count) * 2 * pi xx = numpy.sqrt(radius) * numpy.cos(theta) yy = numpy.sqrt(radius) * numpy.sin(theta)...
true
8c2770aba9c2a6d34d2be19ce89e9846fa875721
didadida262/Big-Data
/爬虫系列/beautifulsoup/index1.py
UTF-8
281
2.953125
3
[]
no_license
from bs4 import BeautifulSoup import requests r = requests.get("http://python123.io/ws/demo.html") demo = r.text soup = BeautifulSoup(demo,"html.parser") print(soup.prettify()) leng = len(soup.body.contents) print(leng) for child in soup.body.contents: print(child)
true
6da30bd1ad6355da4bf64c9ab260834223e91f9a
JohnRhaenys/escola_de_ferias
/DIA_01/introducao_python/exercicios/exercicio030.py
UTF-8
194
3.328125
3
[]
no_license
""" EXERCÍCIO 030: Par ou Ímpar? Crie um programa que leia um número inteiro e mostre na tela se ele é PAR ou ÍMPAR. """ def main(): pass if __name__ == '__main__': main()
true
4f36e5818d5370b16d330048b9011f6ef2d97ccf
UberHowley/spoc-file-processing
/kmeansSPOC.py
UTF-8
7,019
2.796875
3
[]
no_license
__author__ = 'IH' __project__ = 'spoc-file-processing' # supporting lib for kmeans clustering # Original by: Nitin Borwankar (Open Data Science Training) # https://github.com/nborwankar/LearnDataScience/blob/master/notebooks/kmeans.py import numpy as np from sklearn.cluster import KMeans from scipy.cluster.vq import ...
true
51a43e53a9b55ae2054f8e9222677b38fee5ef43
zdzjiuge/TestCode
/PytestTest/cases/ttttttt.py
UTF-8
834
2.96875
3
[]
no_license
# import pytest # users = [ # {"name":"jack","password":"Iloverose"}, # {"name":"rose","password":"Ilovejack"}, # {"name":"tom","password":"password123"}, # {"name":"mike","password":"password"}, # {"name":"james","password":"AGoodPasswordWordShouldBeLongEnough"} # ] # class TestUserPasswordWithParam(objec...
true
52828aa24097653d9d6526efa5dd2192810f9aa7
Dchi000/16
/python/guessTheNumber.py
UTF-8
538
4.03125
4
[]
no_license
import random secretNumber=random.randint(1,20) print('i am thinking of a number between 1 and 20.') for guessessTaken in range(1,7): print('take a guess.') guess=int(input()) if guess<secretNumber: print('your guess is too low.') elif guess>secretNumber: print('your guess is to...
true
dfbce06da6e708bb0b3e235e0182eed323e03c5b
TrialAndErrror/TnE_Assistant
/src/Assistant.py
UTF-8
5,164
2.9375
3
[ "MIT" ]
permissive
import logging from src.Settings import WIKI_SETTINGS, SEARCH_SETTINGS, ASSISTANT_SETTINGS, PLAY_SETTINGS, OPEN_SETTINGS from src.Actions.Open import open_page_or_file from src.Actions.Play import play_youtube_video_for from src.Actions.Search import search_web_for from src.Actions.Wiki import open_wiki_results_for f...
true
c12f7d118380808856f1ef2833bed2deb0a7acec
contractorwolf/GDriveUpload
/upload.py
UTF-8
2,850
2.71875
3
[]
no_license
#!/usr/bin/python # -*- coding: utf-8 -*- import sys import httplib2 import pprint import logging from apiclient.discovery import build from apiclient.http import MediaFileUpload from oauth2client.client import OAuth2WebServerFlow from oauth2client.file import Storage logging.basicConfig() # Copy your credentials f...
true
6600977bd3a995799e5f4be0bfb0b24198153d88
anmiaru/beauty
/face.py
UTF-8
4,225
2.8125
3
[]
no_license
import dlib import cv2 import numpy as np import math predictor_path = "D:\\shape_predictor_68_face_landmarks.dat" # 使用dlib自带的frontal_face_detector作为我们的特征提取器 detector = dlib.get_frontal_face_detector() predictor = dlib.shape_predictor(predictor_path) def landmark_dec_dlib_fun(img_src): img_gray = cv2.cvtColor(...
true
14a67278f61278e010748b3368076ae5ad34fa3b
jougemai/python
/find.py
UTF-8
1,403
3.140625
3
[]
no_license
#coding=utf-8 str1='who is you father,is this your father?' class fun_sub: def __init__(self): self.string=None self.target=None self.num=None self.new=None def sub1(self): __sub1_m1=-1 __sub1_m2=0 __sub1_m3='' __sub1_m4=() if self.string.find(self.target)>0 : __sub1_m4=self.strin...
true
7d53f005c5d0e342a56e28134560e5cc53f8c554
adeelbhatti88/LeetCode-Practice
/BinarySearchTree Practice.py
UTF-8
2,034
3.953125
4
[]
no_license
class Node: def init (self, data=None): self.data = data self.left = None self.right = None class BST: def __init__(self): self.root = None def insert(self, data): #inserting data into tree #first checking if the root is empty if it is, we insert the data i...
true
7447fb6aa6ce7f04a8fe7071a481f70a2018f134
Vera-Alejandro/Reinforcement-Learning
/DeepQNetwork.py
UTF-8
4,659
2.640625
3
[]
no_license
import numpy as np import torch from Gridworld import Gridworld import random from matplotlib import pyplot as plt from collections import deque import copy l1 = 64 l2 = 150 l3 = 100 l4 = 4 model = torch.nn.Sequential( torch.nn.Linear(l1, l2), torch.nn.ReLU(), torch.nn.Linear(l2, l3), torch.nn.ReLU()...
true
aeb417dcd9ee74be0db9e8f3ffa1572cdf91c155
Planet-Nine/cs207project
/pype/lexer.py
UTF-8
1,669
2.953125
3
[ "MIT" ]
permissive
import ply.lex reserved = { # pattern : token-name 'input' : 'INPUT', 'output' : 'OUTPUT', 'import' : 'IMPORT', } tokens = [ 'LPAREN','RPAREN', # Individual parentheses 'LBRACE','RBRACE', # Individual braces 'OP_ADD','OP_SUB','OP_MUL','OP_DIV', # the four basic arithmetic symbols 'STRING', # Anything e...
true
639f92109a039159b788b07d125ec09f00225136
ADI-Labs/calendar
/tests/test_api.py
UTF-8
1,385
2.609375
3
[]
no_license
import json from urllib.parse import urlencode def assert_json_equal(response, query): assert response.status_code == 200 rdata = json.loads(response.data.decode()) data = [d.to_json() for d in query.all()] # "data" is only key in rdata assert "data" in rdata and len(rdata) == 1 # check equa...
true
a0312b16d0ab0a0e6b32f3e679ee710812cd918a
nmeyersohn/newstrition
/fetchParserConfig/csvToParserConfig.py
UTF-8
1,611
2.953125
3
[]
no_license
#!/usr/bin/env python """ Converts parser config csv file to parserConfig.js script. """ import csv import re import json CSV_FILE = 'parserConfig.csv' def main(): with open(CSV_FILE, 'rb') as csvfile: reader = csv.reader(csvfile) headers = reader.next() cat_start_idx = headers.index('Ca...
true
0bbb18a72130d4ee4eafe540bfaa1e3251b12159
waikato-datamining/wai-common
/src/wai/common/file/arff/_save.py
UTF-8
403
3.1875
3
[ "MIT" ]
permissive
from ._ARFFFile import ARFFFile def save(arff: ARFFFile, filename: str, encoding: str = 'utf-8'): """ Saves the given ARFF file to disk. :param arff: The ARFF file to save. :param filename: The filename to save the file under. :param encoding: The string encoding to use. """ ...
true
f5de800e66d2a2bc9eb2f24955b1878e88c6cbff
BlueWay-KU/Study
/DeepLearning/Python/Chapter 3/Ch03-01-06-sigmoid.py
UTF-8
69
2.6875
3
[ "MIT" ]
permissive
import numpy as np t = np.array([1.0, 2.0, 3.0]) 1.0 + t 1.0 / t
true
65b13fe1ea2a8ae12cb01466a65fb561074acd75
jasonliu1990/scraper
/data_gov/package/data_gov.py
UTF-8
5,516
2.890625
3
[]
no_license
import os import pandas as pd import numpy as np import requests from zipfile import ZipFile import shutil import time import datetime def download_corp_tax(url: str, corp_tax_path: str) -> str: file = requests.get(url) filename = corp_tax_path with open(filename,'wb') as f: f.write(file.conte...
true
3d02f3a418d344cec6357d8488dd876d90c0fc51
ArnoutAllaert/Informatica5
/Toets/Verkeersdrukte.py
UTF-8
578
3.25
3
[]
no_license
#input dv = float(input('verkeersdichtheid van het vrachtvervoer op het eerste rijvak: ')) vv = float(input('snelheid van het vrachtverkeer op het eerste rijvak: ')) da = float(input('verkeersdichtheid van het personenvervoer op het tweede rijvak: ')) va = float(input('snelheid van de personenwagens op het tweede rijva...
true
4f086537ae09ddee048f39cd67ea76771d123dad
nocLyt/machine_learning
/NTU/PA1/p15.py
UTF-8
1,131
3.0625
3
[]
no_license
from numpy import * from random import * raw_data = map(lambda x : map(float,x.split()),open('p15_train.dat').readlines()) data = array(raw_data) dim = len(data[0])-1 X = data[: , 0:dim] X=append(X,[ [1] for i in range(len(data)) ],axis=1) # adding a extra dimension Y = data[: , dim] def sign(x): if x<=0: ...
true
58945626b61c0a34fd7cc4dfee87ab8e5a1ef9ce
MichaelRol/EulerProject
/Problems 11-20/12-TriangleNumbers.py
UTF-8
280
3.203125
3
[]
no_license
x = 1 triangle = 0 while True: numOfFactors = 0 triangle = triangle + x for factor in range(1, int(triangle ** 0.5) + 1): if triangle % factor == 0: numOfFactors += 2 if numOfFactors > 500: print(triangle) break x = x + 1
true
948a15e07694b91578399e2e5d49096eaad13b4b
chun37/python-learn
/1-6.py
UTF-8
499
3.890625
4
[]
no_license
### if文の基本 # if文は比較によって処理の分岐を行える # 例 number = 10 if number == 10: print("numberは10です") else: print("numberは10ではありません") # if文の書き方 ''' if 比較の式: 比較の式がTrueの時の処理 else: 比較の式がFalseの時の処理 ''' # のような感じで書く # 処理を書く時はスペースを4つ前に入れてから処理を書く # 例のnumber変数の数字を変えて実行してみよう
true
c966eaf0a094eca8ee870ef23d793018ece9fd21
tiangeluo/Learning-to-Group
/core/utils/metric_logger.py
UTF-8
3,926
2.9375
3
[ "Apache-2.0" ]
permissive
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. # Modified by Jiayuan Gu from __future__ import division from collections import defaultdict from collections import deque import numpy as np import torch class AverageMeter(object): """Track a series of values and provide access to smoothed...
true
e01ceaf6b85e5d46c4647d814b05dda5c011578c
108806/MAC_changer_win
/MAC_changer_win.py
UTF-8
5,990
2.578125
3
[]
no_license
import os print(os.getcwd()) import re import subprocess import sys if sys.platform != 'win32': print('This platform is not supported nor targeted in this version') sys.exit(1) import winreg from functools import lru_cache # 12 HEX vals per MAC addr: desired_macs = ['DEADBEEFBABE', '000108806000'] mac_addresses ...
true
ab2d5c54963e3a7a2a7fd1eb5100d4f030672148
geramolinest/FlaskTest
/bluePrints/address/addressAPI.py
UTF-8
6,738
3.078125
3
[]
no_license
import requests as r from .geoTableI import TableInfo,DataTableInfo from geopy import distance #I created this class for make all operations about the problem, for better order of my project class ResponseAddress: #Constants for the HTTP requests using the requests library from python and the Yandex Geocoder API ...
true
8b79cb3113f53f10b891b45ae5457ea977f6bd4d
karthikeyansa/python-web-scrape
/basic scrape.py
UTF-8
399
3.09375
3
[]
no_license
from bs4 import BeautifulSoup import requests #basic web scraping with open('simple.html') as html: soup = BeautifulSoup(html,'lxml') #view source code print(soup.prettify()) #search for tag match= soup.title.text print(match) #(or) match = soup.find('div',class_='body') print(match) #grab text match = soup.find(...
true
66f855aa6768d05a2f43bddcd692c3690b1d036e
gratzel/NanoKontrol_SelectedTrack
/settings.py
UTF-8
11,135
3.359375
3
[ "BSD-2-Clause-Views", "BSD-2-Clause", "LicenseRef-scancode-unknown-license-reference" ]
permissive
from .MIDI import * # import MIDI status codes """ settings which MIDI-notes and CCs trigger which functionality """ # debug_mode: whether the log-function should output to logfile debug_mode = True """ "<setting>": Note (<MIDI note#> [, <MIDI channel>]) "<setting>": CC (<MIDI CC#> [, <mapping mode> [, <MIDI chan...
true
7722bc5b791f79990072ae40c346a0f0f9ebab44
Zumbalamambo/tf_face
/train_utils.py
UTF-8
7,579
2.546875
3
[]
no_license
from __future__ import absolute_import from __future__ import division from __future__ import print_function import tensorflow as tf import numpy as np import os def get_learning_rate_from_file(filename, epoch): learning_rate = 0.1 with open(filename, 'r') as fp: for line in fp: par = lin...
true
020263847f9267755e716ad1ca6b179aa74bb899
srivamsi/pyQt_fromJustinfx
/PyQt4_UI_Development_for_Maya/project_files/Chapter04/app_template.py
UTF-8
469
2.828125
3
[ "MIT" ]
permissive
#!/usr/bin/env python """ Chapter04 - App Template A common structure for the entry-point into a new PyQt4 application """ from PyQt4 import QtCore, QtGui class Window(QtGui.QDialog): def __init__(self, *args, **kwargs): super(Window, self).__init__(*args, **kwargs) # custom code here self.resize(800,6...
true
c9a5f7132b4bfdbdf2fc971745a175a54835afc7
baeseonghyeon/python_study
/JumpToPython/DataType/Number.py
UTF-8
451
3.78125
4
[]
no_license
# 정수(Integer) a = 123 a = -178 a = 0 # 실수(Floating-point, 소수점이 포함된 숫자) a = 1.2 a = -3.45 ## 컴퓨터식 지수 표현 방식 a = 4.24E10 a = 4.24e10 a = 4.24e-10 # 8진수와 16진수 ## 8진수(Octal) a = 0o177 a = 0O177 ## 16진수(Hexadecimal) a = 0x8ff b = 0x8ABC # 사칙연산 a = 3 b = 4 a + b a - b a * b a / b ## **연산자(x의 y제곱) a ** b ## 나머지 연산자 7...
true
c005cffdcdc9d6bd0bd052775320fdea3add2e54
GeeksIncorporated/playground
/230.kth-smallest-element-in-a-bst.py
UTF-8
2,002
3.40625
3
[]
no_license
# # @lc app=leetcode id=230 lang=python # # [230] Kth Smallest Element in a BST # # @lc code=start # Definition for a binary tree node. # class TreeNode(object): # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = right import sys import j...
true
079073d5f37f19741496b6c0f62805806ac5b1d6
dalexach/holbertonschool-machine_learning
/supervised_learning/0x0D-RNNs/7-bi_output.py
UTF-8
3,335
3.5625
4
[]
no_license
#!/usr/bin/env python3 """ Class BidirectionalCell """ import numpy as np # Function def softmax(x): """ Function to compute softmax values for each sets of scores in x """ return np.exp(x) / np.sum(np.exp(x), axis=1, keepdims=True) class BidirectionalCell(): """ Class BidirectionalCell tha...
true
da12cd283812bac04ea2212dab0896c1c743e859
ibnumaulana215/Tugas-UAS
/Tugas UAS/Codingan/perhitungan.py
UTF-8
1,682
3.578125
4
[]
no_license
from texttable import Texttable def kalkulator(): jawab = "y" while (jawab == "y"): print ("\n\t\nkalkulator") print ("1. Penjumlahan") print ("2. perkalian") print ("3. pengurangan") print ("4. pembagian") pilihan =input("\npilih perhitungan : ")...
true
2663903d096a8cf7d94096b95ad84023966f7fb5
wangzhuoranivy/COMP598-A3
/src/hw3/tests/pony_test.py
UTF-8
3,034
3.015625
3
[]
no_license
import unittest import pandas as pd from pony_functions import * import os.path as osp class PonyTestCase(unittest.TestCase): script_dir = osp.dirname(__file__) d = {'title': ['Episode A','Episode A','Episode A','Episode B','Episode B','Episode B','Episode B','Episode B'],'writer': ['LF','LF','LF','LF','LF','LF'...
true
79e01a683157dd3e5ff0fe639aba446b5f7f4e1a
toldrew/Python
/Chekio/Restricted sum.py
UTF-8
189
2.625
3
[]
no_license
def checkio(data): def su(lst): nonlocal s s += lst[0] if len(lst) > 1: su (lst[1:]) s = 0 su(data) return s print(checkio([1, 2, 3]))
true
dd3ed18caea58fe655cb565f4b9d42c7d4edd0ef
krishna-NIT/Algo-Tree
/Code/Python/TrimorphicNumber.py
UTF-8
958
4.5625
5
[ "LicenseRef-scancode-free-unknown", "MIT" ]
permissive
''' - In this program we have to tell whether a given number is trimorphic or not. - A trimorphic number is a number whose cube's last digit is equal to the last digit of the number itself. - For Ex: If number=10 cube=1000 Since last digit to 1000 and 10 both are 0. ...
true
6a79b22b65ed47b2779a92e00a81ca1eefcc379e
rjnmhrjn/powerscript
/unzip.py
UTF-8
181
2.515625
3
[]
no_license
import zipfile zip_ref = zipfile.ZipFile("C:\\Users\\rmaharjan\\Desktop\\Dev\\Filename.zip", "r") zip_ref.extractall("C:\\Users\\rmaharjan\\Desktop\\Dev\\Filename") zip_ref.close()
true
4b1b8a801fd5b94715d8cad366d1b5a279716486
JefferyFu1998/Gjun-Lesson-1
/lesson2_list.py
UTF-8
324
3.46875
3
[]
no_license
#!usr/bin/python3.5 marxes=['groucho','chico','harpo']; print(len(marxes)); a=[1,2,3]; print(a); b=a; print(b) a[0]='surprise'; print(b); #1. copy() #2. use trasform list() #3. use slice[:] a=[1,2,3]; b=a.copy(); c=list(a); d=a[:]; b[0]='b'; c[0]='c'; d[0]='d'; print('a:',a) print('b:',b) print('c:',c) print('d:',...
true
befd462d4991300318db20d26d5ac48bc40fab92
sparkcyf/SUSTech_EE326_Digital_image_Processing
/lab5/submit/gaussian_11812418.py
UTF-8
2,832
2.640625
3
[ "MIT" ]
permissive
import time import numpy as np from PIL import Image import lab5_lib def gaussian_pass_11812418(input_img, sigma): # Reading of the image into numpy array: img = Image.open(input_img) # FFT transform for img arr input_image_origin = np.asarray(img) input_image = np.asarray(img) input_image = ...
true
891eacc2fe1b35c708b6588f9ea03b21737c4c4e
YingheSun/RecommendationLab
/E1_UserBased.py
UTF-8
7,754
2.671875
3
[]
no_license
import json import math from operator import itemgetter import DataLoad import multiprocessing import time from prettytable import PrettyTable Analys_dic = {} table = PrettyTable(['N#','K#','precision','recall','F1','popularity','coverage']) def UserSimilarity_IIF(train): print 'UserSimilarity_IIF:' +str(time.tim...
true
a292e06095696ac6a23a10d6d7880fb6b3ca8339
PranavSalunke/ImagePixelator
/pixelator.py
UTF-8
8,454
3.171875
3
[]
no_license
from PIL import Image, ImageFilter, ImageStat, ImageDraw import numpy as np def showColorSample(color): Image.new(mode="RGB", size=(100, 100), color=color).show() def createStripes(): image = Image.new(mode="RGB", size=(180, 350), color=(0, 0, 0, 255)) for w in range(image.width): if w % 20 >= 5...
true
1057fbb97501c60b81ca47bc1e252836633b4973
Shedaim/Gpy_NB-IoT
/sensors/button.py
UTF-8
175
2.734375
3
[]
no_license
from machine import Pin class Button: def __init__(self, pin, controls: []): self.pin = Pin(pin, mode=Pin.IN, pull=Pin.PULL_UP) self.controls = controls
true
508c48a53780e7f1a232c5bb7a07c60b96253fd4
MLforHealth/S2SD
/parameters.py
UTF-8
17,246
2.578125
3
[ "MIT" ]
permissive
import argparse, os ####################################### def basic_training_parameters(parser): ##### Dataset-related Parameters parser.add_argument('--dataset', default='cub200', type=str, help='Dataset to use. Currently supported: cub200, cars196, online_products.') parser.add_argume...
true
9ddf6d89f90f5a0e23e3cb15c16f0eaa1a445754
stephen-a2z/Understand-Python
/understand-iterator.py
UTF-8
3,742
3.453125
3
[]
no_license
# -*- coding: utf-8 -*- """ ------------------------------------------------- File Name: understand-iterator Description: Author : stephen date: 2019/6/3 ------------------------------------------------- Change Activity: 2019/6/3: ------------------------------------...
true
300be74c703811f77655a115e56e5db3b3382290
ddelago/CubeSolver
/GUI/main.py
UTF-8
1,788
2.765625
3
[]
no_license
# Delago, Daniel # 100-106-0927 # 2018-01-18 #---------------------------------------------------------------------- # This code was originally created by Prof. Farhad Kamangar. # It has been somewhat modified and updated by Brian A. Dalio for use # in CSE 4303 / CSE 5365 in the 2018 Spring semester. #------...
true
12cd5df2c051f412cbfa44128b19f0e97dc58f86
simopt-admin/simopt
/simopt/models/rmitd.py
UTF-8
13,817
3.09375
3
[ "MIT" ]
permissive
""" Summary ------- Simulate a multi-stage revenue management system with inter-temporal dependence. A detailed description of the model/problem can be found `here <https://simopt.readthedocs.io/en/latest/rmitd.html>`_. """ import numpy as np from ..base import Model, Problem class RMITD(Model): """ A model...
true
0f228e76987ff7b52cc1ad42907ccc472adc7411
reference-project/minishop
/hipposhop/utils/date_util.py
UTF-8
4,689
3.171875
3
[]
no_license
# -*- coding: utf-8 -*- import time import pytz from datetime import datetime,timedelta ''' now = datetime.datetime.now() #本周第一天和最后一天 this_week_start = now - timedelta(days=now.weekday()) this_week_end = now + timedelta(days=6-now.weekday()) #上周第一天和最后一天 last_week_start = now - timedelta(days=now.weekday()+7) la...
true
7e5cecbf0ba92f80c8a360bcd14a254f47f63c6c
Matthew-Barrett/grade_calculator
/grade_calculator_91030766.py
UTF-8
793
3.734375
4
[]
no_license
print ("Welcome!, please enter the project score out of 72, and the exam score out of 112 in the spaces provided") x = int(input("project_score:")) y = int(input("exam_score:")) project_percentage = x/72*100 exam_percentage = y/112*100 overall_average = x/100*60+y/100*40 print ("percentage score for project:"...
true
528c83348a37df2c97d70a341ad3c1ba51d5eb2e
XuXingyu-98/Algorithms-in-Python
/Binary Trees/Branch Sums.py
UTF-8
538
3.25
3
[]
no_license
class BinaryTree: def __init__(self, value): self.value = value self.left = None self.right = None def branchSums(root): sums = [] calculateHelper(root, 0, sums) return sums def calculateHelper(node, current, sums): if node is None: return newCurrent = current ...
true
ab040219f72cc02b1d01b70e9d1c40f9754bb59c
Lin-SiYu/kline-fill
/lib/tools.py
UTF-8
2,032
3.265625
3
[]
no_license
import datetime import re def kline_granularity(period): ''' kline 粒度转换 :param period: str - e.g. 1min ,1hour :return: 单位转换为秒制 2mon = 2*2592000 ''' period_num = int(re.findall(r'\d+', period)[0]) period_unit = re.findall(r'\D+', period)[0] units = ['min', 'hour', 'day', 'week', 'mon', ...
true
f5d9f3eea596991a4b7f88be327aa60499102fda
SpentlessInc/spentless-server
/server/app/utils/errors.py
UTF-8
875
2.875
3
[ "MIT" ]
permissive
"""This module provides custom errors.""" class BaseError(Exception): """Class that represents base error.""" def __init__(self, message=None): """Initialize base custom error.""" super().__init__() self.message = message def __str__(self): """Return message for str metho...
true
15b9ea22ecb6b413f9d32f97ed42ca9d4635dc84
capitalch/python
/ThinkStats2/code/chap13soln.py
UTF-8
2,943
2.8125
3
[ "GPL-3.0-only", "Apache-2.0" ]
permissive
"""This file contains code for use with "Think Stats", by Allen B. Downey, available from greenteapress.com Copyright 2014 Allen B. Downey License: GNU GPLv3 http://www.gnu.org/licenses/gpl.html """ from __future__ import print_function import pandas import numpy as np import thinkplot import thinkstats2 import sur...
true
ca0bb45dbab808bc7f2f504d60f8d05f0f73c3e9
somous-jhzhao/openmm-validation
/tests/test_mcmc.py
UTF-8
15,871
2.625
3
[]
no_license
#!/usr/local/bin/env python #============================================================================================= # MODULE DOCSTRING #============================================================================================= """ Test the MCMC facility. DESCRIPTION TODO COPYRIGHT AND LICENSE @author J...
true
37e0b766cfb8f80dc2635683ca7d96d7782af7c4
cbogithub/bas-remote-python
/bas_remote/client.py
UTF-8
4,141
2.515625
3
[ "MIT" ]
permissive
import asyncio from inspect import getfullargspec from random import randint from typing import Callable, Dict, Optional from .services import EngineService, SocketService from .errors import AuthenticationError from .callback import ClientCallback from .options import Options __all__ = ['BasRemoteClient'] class ...
true
bfd341e83c52ccf0a998b4ccd4c8441248296657
markrizko/IoTea
/run.py
UTF-8
1,532
2.828125
3
[]
no_license
import time import RPi.GPIO as GPIO from datetime import datetime from pythonping import ping import pytz # initialize time zone tz_LA = pytz.timezone('America/Los_Angeles') # initialize GPIO GPIO.setmode(GPIO.BCM) GPIO.setup(17, GPIO.OUT) # starts off HIGH = open circuit GPIO.output(17, GPIO.HIGH) ...
true
7a360399e67656a3bcbb10fa0bfc79076eb3eabc
anipimpale94/Exercism
/python/prime-factors/prime_factors.py
UTF-8
521
3.453125
3
[]
no_license
import math def prime_factors(natural_number): n = natural_number primeFactor = [] if natural_number < 2: return primeFactor else: while n%2 == 0: n=n/2 primeFactor.append(2) for index in range(3, int(math.sqrt(natural_number))+1): wh...
true
bc42b2b9a9f3925f7caedffacbd03afd89575d3f
NelsonShaw/Nelson-Shaw-Assignment-2-MapReduce
/sequential-map-reduce/Sequential_MapReduce.py
UTF-8
3,341
3.875
4
[]
no_license
# Import all of the necessary tools for the application. # Please import any of these libraries if there are not immediately available to # you. from functools import * from collections import * from sklearn.feature_extraction.stop_words import ENGLISH_STOP_WORDS import re import pandas as pd import time # This functi...
true
38da2f4c739eaf47785e21d6991a46d6be86c6f2
btw1027/USB_CAM
/Examples/Python2/Sequencer.py
UTF-8
34,407
2.65625
3
[]
no_license
# coding=utf-8 # ============================================================================= # Copyright (c) 2001-2018 FLIR Systems, Inc. All Rights Reserved. # # This software is the confidential and proprietary information of FLIR # Integrated Imaging Solutions, Inc. ("Confidential Information"). You # shall not di...
true
46fff9067209b0dcd11774a8fcedec263ecec830
ajagannath/PMPS_ML
/HW4/main.py
UTF-8
7,200
3.09375
3
[]
no_license
""" Main function module """ #!/usr/bin/env python3 __author__ = "Abhijith Jagannath" __email__ = "jabhi@uw.edu" import sys import time import math import numpy as np import matplotlib.pyplot as plt from dtree import DTree from dataset import Dataset from bagging import BagClassifier from BV import biasVariance from ...
true
ece799534917fd66a0e326a7c5b93072bcc2bf19
wanguikui/pythonbasics
/task3.py
UTF-8
108
3.140625
3
[]
no_license
def draw_numbers(numbers): x =numbers (5,10,15,20,25) new_list=numbers[0],numbers[-1] print(new_list)
true
34cfb994677b3f64b0a7b2f6e34e2992c366e48f
BEGEMOT9I/NN
/index.py
UTF-8
3,043
3.09375
3
[]
no_license
# -*- coding: utf-8 -*- from mnist import MNIST import numpy as np ### Функция активации (rectified linear unit) ### def ReLU(x): return np.maximum(x, 0) ### Функция предсказания числа на картинке (Сумматор) ### def PredictImage(img, w): resp = list(range(0, 10)) for i in range(0,10): r = w[i] * img r ...
true
5b62a6bcc69e72da40b925cc104905b8b1389399
Kiran-24/python-assignment
/python_partA_171041001/area_of_triangle.py
UTF-8
686
4.125
4
[]
no_license
'''implement a python code to find the area of a triangle.''' from math import sqrt def area(a,b,c): ''' to find the area of triangle''' #inequality theorem if a+b>c and b+c>a and c+a>b: #semi-perimeter of triangle s = (a+b+c)/2 #Heron's formula to find area of trinagle area_of_triangle = sqrt(s*(s...
true
b5daf40ac17c1c6f900e40b9ddb804642e53cd5d
HatsuneMikuV/PythonLearning
/39.py
UTF-8
1,090
3.765625
4
[ "Apache-2.0" ]
permissive
# -*- coding: utf-8 -*- """ ------------------------------------------------- File Name: 39 Description : ^_^ !!! Author : anglemiku Eamil : anglemiku.v@gmail.com date: 2019/12/18 ------------------------------------------------- Change Activity: 2019/12/18: ...
true
f5e3a5f2d1addbcd7a80210d0936584eb3cef7eb
himingway/IC_Lab
/Image/Point/Threshold/pre_data/create_data.py
UTF-8
1,889
2.546875
3
[]
no_license
from PIL import Image import os, json, sys from ctypes import * FileFormat = ['.jpg', '.bmp'] Conf = json.load(open('./images/conf.json', 'r'))['conf'] def name_format(root, name, ex, conf): return '%s-%s-%s-%s' % (name, conf['mode'], conf['th1'], conf['th2']) def conf_format(im, conf): mode = conf['mode'] th1 = ...
true
a886911617ac62144f33b63d976ce4269c4cd0ad
klpz/causality_in_cry
/utils.py
UTF-8
1,167
2.984375
3
[]
no_license
import matplotlib.pyplot as plt def refactor_series(data, name): diff = [] for index in data.index.tolist(): if index == 0: diff.append(0) continue diff.append(data[name].loc[index] - data[name].loc[index - 1]) data['diff'] = diff diff = [] for index in data...
true
821a521b11caf891306f67cc8f5f6b6d2e157385
rex-mcall/compSci_tic-tac-toe
/tic-tac-toe.py
UTF-8
9,476
2.96875
3
[]
no_license
import sqlite3 import random import os originalBoard = [[1,2,3], [4,5,6], [7,8,9]] tttBoard = [[1,2,3], [4,5,6], [7,8,9]] con = sqlite3.connect('winloss.db') cur = con.cursor() playName = "" playName2 = "" playMode = 0 # creates a new database if it doesn't already exist files = os.listdir('.') dbExists = False for...
true
044c060a9086bc5ac72565bc8e85f186bba670fa
mpracek/Graffiti-conjecture-194
/Pomembno/zapisna.py
WINDOWS-1250
10,658
3.15625
3
[ "MIT" ]
permissive
#115 120 #V tej datoteki bo zapisan celoten genetski algoritem, ki bo izvedel na program. Zapisan je v jeziku Sage. #elimo dokazati, da obstaja graf G, za katerega ne velja, da zadoa neenakosti #neodvistnostno tevilo(G) =< 1 + povprena lokalna neodvistnost(G) #in nima Hamiltonove poti. import random import operator i...
true
77f62b3bd1a42dd5d4489dd8b094351c02daa9bb
Dadsh/SpotifyPlaylistGraph
/test.py
UTF-8
641
2.71875
3
[ "MIT" ]
permissive
import numpy as np import matplotlib.pyplot as plt N = 10 data = np.random.random((N, 4)) labels = ['point{0}'.format(i) for i in range(N)] plt.subplots_adjust(bottom = 0.1) plt.scatter( data[:, 0], data[:, 1], marker='o', c=data[:, 2], s=data[:, 3] * 1500, cmap=plt.get_cmap('Spectral')) for label, x, y in z...
true
33fbe038daa97f3240ee3b03608ea539ec4de82e
marrossa/mialacena
/products/models.py
UTF-8
914
2.65625
3
[]
no_license
import datetime from django.db import models # Model: Product # Description: To store all the products you buy in the # supermarket and that you want to track. class Product(models.Model): name = models.CharField('Nombre', max_length=150) exp_date = models.DateField('Fecha de caducidad') description = mod...
true
d8816414d072065036328f8d37718ece4029a997
cwconroy/MA666
/class-09-13-2018.py
UTF-8
1,635
3.21875
3
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Sep 13 12:49:06 2018 @author: chrisconroy """ import numpy as np # import numpy package for calculations import matplotlib.pyplot as plt vector1 = np.array(np.linspace(0,10,11)) vector2 = np.array(np.linspace(0,10,11)) vector3 = np.array(np.linspace(...
true
2914089c28086235d0caee3268f831573d5d4fa4
Longneko/demo_food_app
/backend/Ingredient.py
UTF-8
8,176
3.03125
3
[]
no_license
from collections import namedtuple from backend.DBEntry import DBEntry, to_db_obj_name from backend.Allergy import Allergy from backend.IngredientCategory import IngredientCategory class Ingredient(DBEntry): """An ingredient that can be used a recipe""" table_main = "ingredients" associations = [ ...
true
78d49ef559e70fcefa0ddf9c4bb99c4f149651e4
Doraemonzzz/COMS-W4705-Natural-Language-Processing
/Homework/Homework 2/Q5.py
UTF-8
4,598
2.609375
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Sun Apr 19 21:38:20 2020 @author: qinzhen """ import json #### Part 1 计算MLE #计数 def Generate_count(File): Count_xyy = {} Count_xy = {} Count_x = {} Count_y = {} with open(File) as f: for i in f.readlines(): #分隔数据 data = i.stri...
true
985162e8d85e87ed1b3d3b7b4345c9866f108f42
DevAlone/restycorn
/restycorn/base_resource.py
UTF-8
2,005
2.96875
3
[]
no_license
import abc class BaseResource: time_cached = False time_cache_seconds = 10 time_cache_size = 16 @abc.abstractmethod async def list(self) -> list: """ It is called when client send GET request with url like this http://example.com/comments/ Returns all items :retur...
true
d9a69d2873de435de7dc91baeeb26202030cec08
yanzj/Pima-Prediction
/KNN.py
UTF-8
2,886
2.765625
3
[]
no_license
from sklearn.preprocessing import normalize import numpy as np import read_data import math import csv import time train_data, validation_data, test_data = read_data.read_data() train_data_sample = np.array(train_data[:][:-1]) y_train_sample = [train_data[i][-1] for i in range(len(train_data_sample))] validation_data...
true
de75029987f5f5fc824d9310d6da69a7dedad7e4
thehawkgriffith/Frozen-Lake-Agent
/frozen_lake_ai.py
UTF-8
4,625
3.34375
3
[]
no_license
import numpy as np class Lake(): def __init__(self, width, height, start): self.width = width self.height = height self.i = start[0] self.j = start[1] def set(self, rewards, actions): # rewards should be a dict of: (i, j): r (row, col): reward # actions sho...
true
59dc0d2b393336895c1ad2c17cafa63f383671dd
Vichagserp/cimworks
/erpnext/accounts/search_criteria/lease_agreement_list/lease_agreement_list.py
UTF-8
267
2.6875
3
[]
no_license
data =[ ['Agreement No.','Data','100px',''], ['Lessee Name','Data','300px',''], ['Amount','Currency','120px',''] ] for d in data: colnames.append(d[0]) coltypes.append(d[1]) colwidths.append(d[2]) coloptions.append(d[3]) col_idx[d[0]] = len(colnames)-1
true
44611295d3b201ddbf509ee7677ea1ae8c7dfa4e
SatelliteCat/rest_bot-for-telegram
/main.py
UTF-8
2,866
2.609375
3
[]
no_license
import os import telebot from datetime import datetime token = "507470053:AAGjEdZI0J2M55Mr7nUQVrqc7496ZuMDGM0" bot = telebot.TeleBot(token) print("Bot started!") def log(message, answer): print("\n=============") print(datetime.now()) print("Message from {0} {1} (id={2}) \nText: {3}".format(message.from_...
true
5a7788f9b47d54d4e7739e5318fe31a48eafcf77
reni04/IF1311-10219003
/queue.py
UTF-8
284
3.765625
4
[]
no_license
#implementasi queue tanpa deque antrian2 = [1,2,3] print('data sekarang', antrian2) #tambah / add / enqueue antrian2.append(4) print('data sekarang', antrian2) #kurang / delete / dequeue out = antrian2.pop(0) print('data keluar', out) print('data sekarang', antrian2)
true
63b349f8a4b47d3168d185346bf5dc483dde8649
CharanSaineni/MyFirstGit
/python.py
UTF-8
99
3.125
3
[]
no_license
import sys n = int(sys.argv[1]) def firstn(n): for i in range (0,2 * n): print(i) firstn(n)
true
c705c2ee39a5cb208617b8c34f717691b87d96c0
HanSeokhyeon/Algorithm
/20201217/the_farthest_node.py
UTF-8
458
2.625
3
[]
no_license
def solution(n, edge): graph = {i + 1: [] for i in range(n)} for e1, e2 in edge: graph[e1].append(e2) graph[e2].append(e1) q = [1] visit = {1} nxt_q = [] while q: answer = len(nxt_q) nxt_q = [] for p in q: for nxt_p in graph[p]: ...
true
b2e1ef7d2c7fcfd73e222129407101f1bda4e5aa
jgc92/algebra_lineal_numerica_2018A
/Assignment_1/ex3.py
UTF-8
147
3.21875
3
[]
no_license
# Machine epsilon eps = 1.0 new_eps = eps while eps != new_eps + 1.0: new_eps = new_eps/2 print("Machine Epsilon = " + str(new_eps))
true
24cf540f412b270e64c48fcc0cef3a49a9ad0405
SaadMJR492/ProffCess-App
/env/Lib/site-packages/paywix/paytm_checksum.py
UTF-8
3,584
2.875
3
[]
no_license
import base64 import string import random import hashlib import sys from Crypto.Cipher import AES class PaytmChecksum(): def __init__(self): self.iv = '@@@@&&&&####$$$$' self.BLOCK_SIZE = 16 if (sys.version_info > (3, 0)): self.__pad__ = lambda s: bytes( s + (se...
true
3cd8183c21b5d9d6cb4462af38c2a8962620cf16
JuanpiRossi/metegolBotTelegram
/src/ranking.py
UTF-8
2,801
2.578125
3
[]
no_license
# -*- coding: utf-8; -*- from src.utils import exception_handler, group_validator from src import mongoConnection as mongo import config import uuid import os import imgkit @group_validator @exception_handler def ranking(bot, update): send_ranking(bot, update.message.chat_id, config.get("MAIN_DB"), config.get("PL...
true
229209f77645816b30cb07e93342d16058535a59
dr-dos-ok/Code_Jam_Webscraper
/solutions_python/Problem_135/841.py
UTF-8
1,852
3.109375
3
[]
no_license
#!/usr/bin/python3 ########## # Sample Input #Input # 3 # 2 # 1 2 3 4 # 5 6 7 8 # 9 10 11 12 # 13 14 15 16 # 3 # 1 2 5 4 # 3 11 6 15 # 9 10 7 12 # 13 14 8 16 # 2 # 1 2 3 4 # 5 6 7 8 # 9 10 11 12 # 13 14 15 16 # 2 # 1 2 3 4 # 5 6 7 8 # 9 10 11 12 # 13 14 15 16 # 2 # 1 2 3 4 # 5 6 7 8 # 9 10 11 12 # 13 14 15 16 # 3 # ...
true
cc200aab619b5368feab52fcde3b0de70a6b8a20
devcodus/Flask_Fundamentals
/Ninja_Gold/server.py
UTF-8
974
2.59375
3
[]
no_license
from flask import Flask, render_template, session, redirect, request import random app = Flask(__name__) app.secret_key = 'shhhh' @app.route('/') def index(): session['gold'] = 0 return render_template('index.html') @app.route('/process_money', methods=['POST']) def process_money(): if request.form['bui...
true
da5a58356f9be97fc7f40836d8516355e8e44e85
GreyGnome/KivyDnD
/examples/example_base_classes.py
UTF-8
6,672
2.578125
3
[ "Apache-2.0" ]
permissive
# Copyright 2017, 2018 Michael Schwager # Copyright 2016, 2015, 2014, 2013, 2012 Pavel Kostelnik # 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/lic...
true
e05ce6f05d82bfaf5d62d015a9caf11761474ede
wsharp07/covidmi
/covidmi/app/data_parser.py
UTF-8
860
2.8125
3
[]
no_license
class DataParser: def is_valid(self, county): if (county == 'Other*'): return False if (county == 'MDOC*'): return False if (county == 'FCI**'): return False if (county == 'Out of State'): return False if (county == 'Unknown'):...
true
1683eeebe5218f46c0f585c0bf557154ad162827
parfa30/ETC-Code
/sample_sncosmo.py
UTF-8
2,412
2.640625
3
[]
no_license
# Using sncosmo import sys, re, os import numpy as np import astropy import sncosmo # Pick cosmology from astropy.cosmology import WMAP9 as cosmo #from astropy.cosmology import FlatLambdaCDM #cosmo = FlatLambdaCDM(H0=69.6, Om0=0.286) from astropy import units as u import astropy.constants as const import matplotlib...
true
8e760751d86837bac6641386b9e104489046b8b6
ellenyli/sims
/astar.py
UTF-8
3,256
3.546875
4
[]
no_license
import math import heapq from scipy.spatial import distance as dst import time_path # priority queue class using heapq library class PriorityQueue: def __init__(self): self.elements = [] def empty(self): return len(self.elements) == 0 def put(self, item, priority): heapq.h...
true
fd4f80f99a9e7dd7e4b71cbd957ac8267e2e3b93
a05031113/cs50
/pset6/cash/cash.py
UTF-8
566
4.1875
4
[]
no_license
""" Cash CS50 Problem Set 6 Calculates minimum coins required to pay the change owed """ from cs50 import get_float # Prompts for change owed while True: money = get_float("Change owed: ") if money > 0: break # Converts money into pennies pennies = round(money * 100) # Calculate coins coins = 0 whi...
true
4686bf0cdc0136a8db4f6b6196e012fb934ca887
prithvisingh18/Check-ip-for-tor
/tor_ip.py
UTF-8
848
3.390625
3
[]
no_license
import requests def get_tor_ip_list(): data = requests.get('https://check.torproject.org/exit-addresses') data_req = data.text.split() exit_ip_addresses = [] for x in data_req: if(x == "ExitAddress"): index = data_req.index(x) exit_ip_addresses.append(data_req[index+1...
true
f93dcfa0ea1964f3d73436bf349ca5acb073faf2
L1aoXingyu/dog-breed-identification-Gluon
/data_utils.py
UTF-8
1,235
2.640625
3
[]
no_license
import mxnet as mx import numpy as np from mxnet import gluon as gl from mxnet import nd import json import os class DogDataSet(gl.data.Dataset): def __init__(self, label_file, img_path, transform): self._img_path = img_path self._transform = transform with open(label_file, 'r') as f: ...
true
c68c091cecb38074d99b868f98174e1f0f8af621
cldaly/CS50-Final-Project-rileysCandles
/app.py
UTF-8
26,285
2.578125
3
[]
no_license
import os import sqlite3 from flask import Flask, flash, redirect, render_template, request, session from flask_session import Session from tempfile import mkdtemp from werkzeug.exceptions import default_exceptions from werkzeug.security import check_password_hash, generate_password_hash from helpers import apology, ...
true
c740565436ee454309f3b164d617ebffa190cae9
nkthiebaut/bnboost
/app/utils.py
UTF-8
5,761
3.0625
3
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Created on Wed Jan 20 10:12:33 2016 @author: Nicolas Thiebaut @email: nkthiebaut@gmail.com @company: Quantmetry """ import numpy as np import pandas as pd import argparse def find_categorical(df, threshold=5): """ Find categorical columns in dataframe Param...
true
8b06cb374dd8aa6aeb74004b0062cb733cd2a603
elint/Advent-of-Code-2019
/Day 01 - The Tyranny of the Rocket Equation/fuel_calculator_part1.py
UTF-8
267
3.4375
3
[]
no_license
import math # sum all fuel values totalFuel = 0 # module fuel value is floor(moduleMass/3)-2 with open('input') as fp: line = fp.readline() while line: totalFuel += math.floor(int(line) / 3) - 2 line = fp.readline() print(totalFuel) fp.close
true
2e63af6e3461e36c1cd758b7664d8d73513b3f43
xyXiangYu/Education
/Optimization_for_Data_Science/Project/q1112.py
UTF-8
6,389
2.984375
3
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sat Jan 19 22:44:59 2019 @author: xiang """ import pandas as pd df = pd.read_csv('winequality-red.csv', delimiter=';') df.tail() # In[572]: df['quality'].unique() # Now let's extract `X` and `y` # In[573]: data = df.values X = data[:, :-1] y = d...
true
9a87f5bfb3626bd40f5c0ae10fc6329ee1749e43
j2kun/fkl-SDM16
/plots/plot-margins.py
UTF-8
1,311
3.234375
3
[]
no_license
import pickle import matplotlib.pyplot as plt ''' Plot the margins for general class and protected class so we can figure out what kind of relabeling is the right kind. ''' def plot(margins, protectedIndex, protectedClass): marginList = list(margins.values()) protectedMargins = [v for (x, v) in margins.items()...
true