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
89ea39a62bcca651109466ebf4866bb23750372f
kaviraj333/python
/h50.py
UTF-8
95
3.0625
3
[]
no_license
amu,abi=list(map(int,raw_input().split())) x=0 while(amu>=abi): amu-=abi x+=1 print(x)
true
f7480d073d483915477aac92aba71370041ebd9f
JohnZeroOne/Small_Python3_Projects
/Python3_Small_Projects/magic_8_ball.py
UTF-8
1,527
3.4375
3
[]
no_license
# DEV NOTES # 15m # # store reponses in separate text file # add GUI # add error correction on user input # # random answers import random # delay import time # starting message print("Welcome to magic 8 ball") print("I will answer your questions") # play flag playing = True # play the game unti...
true
bbb823cf9d931785f61291d8d6895fc7819a8c88
Agmat/MAMessagerie
/api/demo.py
UTF-8
7,296
2.671875
3
[]
no_license
''' Realtor Inbox demo app ====================== See README.md for installation and usage examples. ''' import argparse import json import os import random from datetime import datetime, timedelta from flask import Flask, jsonify, request, render_template, send_from_directory app = Flask(__name__) PAGE_SIZE = ...
true
4f21d4fb7def312ade959aa7cfe9abe5cd31f09d
drastorguev/twittersentimentanalysis
/twittertosql.py
UTF-8
1,207
2.671875
3
[]
no_license
import tweepy from crds import * from textblob import TextBlob import time from prettytable import PrettyTable from datetime import datetime import sqlite3 conn = sqlite3.connect('twitterprofiles.db') c = conn.cursor() targettwitterprofile = 'anytwitterusername' c.execute('CREATE TABLE '+targettwitterprofile+' (dbtw...
true
a7f4bd52546f45c7e574329e6c5a63182edcf04a
shwina/mixlayer
/mixlayer/poisson/poisson.py
UTF-8
2,796
3.015625
3
[]
no_license
import numpy as np from scipy.sparse import coo_matrix import scipy.linalg as linalg import scipy.sparse.linalg as splinalg class PoissonSolver(object): """ Solve the Poisson equation d^2/dx^2(u) + d^2/dy^(u) = rhs on a [N, N] grid, with periodic boundary conditions in x, and zero boundar...
true
fce08e453d7bc07e9273043f57479aca807d59f7
CGao-STEM/ptychoSampling
/ptychoSampling/utils/generateCrystalCell3D.py
UTF-8
3,214
2.8125
3
[]
no_license
# Author - Saugat Kandel # coding: utf-8 import numpy as np import scipy from scipy import spatial def generateRandomPhase(img, mult): x, y, z = np.meshgrid(np.arange(img.shape[0]), np.arange(img.shape[1]), np.arange(img.shape[2])) normmax = lambda a: (a -...
true
d456bd5c8b36651431a852194dcfb26e755389e5
nghiemho/defect-classification
/defect-classification.py
UTF-8
1,942
2.765625
3
[]
no_license
import keras import io import base64 from PIL import Image from keras import backend as K from keras.models import Sequential from keras.models import load_model from keras.preprocessing.image import img_to_array from flask import Flask from flask import request from flask import jsonify import numpy as np ...
true
5c32f21494aaef86e6fd3fbc9fd52e649fd616f1
DavidLSmyth/FinalYearProjectCode
/testing/SeleniumTestUploadSuccess.py
UTF-8
2,992
2.609375
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Sat Jan 7 23:33:06 2017 @author: user15 """ from selenium import webdriver import unittest from selenium.webdriver.common.keys import Keys from selenium.webdriver.remote.errorhandler import NoSuchElementException from selenium.common.exceptions import NoSuchElementException fro...
true
ff58367b0e9b6ebef585d813b66374b4da164cc1
kwseow/Intro_python_public_Aug2019
/Day1/datatype_02.py
UTF-8
119
3.46875
3
[]
no_license
s = "hello" t = "world" print (s + " " + t) # hello world s = "123" print(s * 4) # 123123123123 print(s + 4) # error!
true
88fd83f34c8b5b6faee74e247b69e48f49be1711
audreyemmely/data-structure
/estruturas/stack.py
UTF-8
3,517
4.0625
4
[ "MIT" ]
permissive
#importando a biblioteca pandas, responsável pela leitura do arquivo csv import pandas as pd #lendo o arquivo csv e armazenando na variável 'data' data = pd.read_csv('https://raw.githubusercontent.com/audreyemmely/estrutura-de-dados/main/dados/USvideos.csv', encoding = "UTF-8") #a classe Elemento é utilizada na função...
true
3787e2aca87558aec41fafc7b8b5e3eb3de568d0
hambuol/unit_11
/breakout.py
UTF-8
5,377
3.265625
3
[]
no_license
# written by oliver hamburger # program is a game of breakout # last modified 12/5/16 # import's nedded moduels and classes import pygame,sys from pygame.locals import * import brick import paddle import ball def main(): pygame.init() # Constants that will be used in the program APPLICATION_WIDTH = 400 ...
true
3fcfb15cb99a84cc075569fbf268b512f5414e61
YashKhant2412/Machine-Learning-Python
/LinearRegression/Multiple_linear_regression_self.py
UTF-8
903
2.6875
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Tue Sep 8 09:28:16 2020 @author: Yash """ import numpy as np import pandas as pd import matplotlib.pyplot as plt #load data dataset = pd.read_csv("50_Startups.csv") X= dataset.iloc[:,:-1].values y = dataset.iloc[:,4].values from sklearn.preprocessing impor...
true
05879330c7e2bc61e446b7718950bdaa3f467f53
YiXingReal/Summer-Learning
/语法基础完(7.20).py
UTF-8
5,997
3.953125
4
[]
no_license
# 输出 #repr() 或 str() 函数 \将输出的值转成字符串 \str() 函数返回一个用户易读的表达形式。 \repr() 产生一个解释器易读的表达形式。 # repr() 函数可以转义字符串中的特殊字符 hello = 'hello, world\n' hellos = repr(hello) print(hellos)#输出为'hello, world\n' 而不是'hello, world' # repr() 的参数可以是 Pyth...
true
e98c626d36eb748b5b831ef53cd7e4eeb5e34354
shashank3110/Master_Thesis_BA_DeepVis
/data_preprocessing/tfrecords_conversion/convert_to_tfrecord.py
UTF-8
8,951
2.875
3
[]
no_license
''' Read NIFTI files and convert to .tfrecords split into train and test sets. Multiple scans of a given subject are either in the train or test and not scattered across ''' import tensorflow as tf import numpy as np import read_nii import os import random import pandas as pd from collections import ...
true
da5d4bb0bc85ae6b1cf18c7e62f442a811f0f67a
Shinji94/python_programming_coursework
/slides/week6/Week 6/exercises_1_2.py
UTF-8
299
3.75
4
[]
no_license
num = int(input("Please input a number:(Should be greater than 1)")) square_num = int(num ** 0.5) for i in range(2, (square_num+1)): if (num % i) == 0: print('%d is NOT prime.' % num) print("%d = %d * %d" % (num, i, num / i)) break else: print("%d is prime." % num)
true
9177a152d5fe474f181788eea31a18c6ad7588d4
Aboghazala/AwesomeTkinter
/awesometkinter/bidirender.py
UTF-8
19,133
2.796875
3
[ "MIT" ]
permissive
""" AwesomeTkinter, a new tkinter widgets design using custom styles and images :copyright: (c) 2020-2021 by Mahmoud Elshahat. module description: handle arabic text to be shown properly in tkinter widgets it works on linux, and windows. """ import os import platform import tkinter as tk...
true
d11cceb2213574296dd5bc1c7cec02c49eeba28c
Anneos81/Bootcamp
/Python/Python Exercises part 1/ex1.1.py
UTF-8
57
2.828125
3
[]
no_license
for i in range(1,10): print(int(9-i)*"0" + i*str(i))
true
f707a51fcb69d46ccee3628cffe07b9d02aa0a45
bedekelly/pluralizer
/tests.py
UTF-8
3,284
3.3125
3
[ "MIT" ]
permissive
import unittest from mock import patch from lambda_utils import BadRequest from pluralizer import pluralize, maybe_pluralize, pluralize_handler class TestPluralizer(unittest.TestCase): """Test the functionality of the `pluralizer` file.""" def test_pluralize(self): """ The `pluralize` funct...
true
9a150c0cc3ef42e604b78d74b59ddd110bcaad5f
maggie199x/expert-dollop
/Barrier.py
UTF-8
1,935
2.984375
3
[]
no_license
#!/usr/local/Cellar/python3 import json import logging import settings #from util import console_color from GameObject import GameObject log = logging.getLogger(__name__) file_handler = logging.FileHandler('_logs/Barrier.log') log.addHandler(file_handler) #TODO: Make a base react so that each object is not require...
true
341b416402d4c3211c8de22982cd98356b1df627
Onebigbera/basic_python_v1
/Daily_Practice/test/arg_kwargs.py
UTF-8
4,605
4.5625
5
[]
no_license
""" *args 和 **kwargs 用法详解 * 允许接收0个或者任意多个参数 *args : Python中的可变参数,表示任意多个无名参数,类型为tuple; **kwargs : Python中的可变参数,表示关键字参数,类型为字典。 ** 关键字参数允许你传入0个或者任意个含有参数名的参数,这些关键字在函数内部会自动组装成为一个字典。 传参方式为: key = value 形式 如 :a = 1 使用原则一 : 使用时需将*args放在**kwargs之前,否则会有“SyntaxError: non-keyword arg after key...
true
f34d2c70aea11dfb75123dbc93c45cfd2dfe1d5f
lincolen/Python-Crash-Course
/7 input and while/seating.py
UTF-8
195
2.890625
3
[]
no_license
party_size = input("nannmei sama desu ka: " ) party_size=int(party_size) if party_size<=8 and party_size>0: print("te-buru ni goannai shimasu") elif party_size>8: print("shosho omachikudasai")
true
c4a58a4a3895367964d74a1572997ec2d32db717
aki-nasu/competition
/abc_py/abc130/b.py
UTF-8
262
3.046875
3
[]
no_license
# 2019/12/5 15[m] 1WA # 負の整数があった場合のことが抜けていたためと推測する。 n,x = map(int,input().split()) l = list(map(int,input().split())) ans = 1 d = 0 for i in range(n): d = d + l[i] if(d<=x): ans+=1 print(ans)
true
004fec06451c657a6fa5190ff511e5b3b8bf6a35
ctralie/MIRAndImageTopology
/TzanetakisBeatSync/getBeats.py
UTF-8
2,247
2.59375
3
[ "Apache-2.0" ]
permissive
#Programmer: Chris Tralie #Purpose: To use the EchoNest api to get the beats for the Tzanetakis genre dataset import requests import json import numpy as np import scipy.io as sio import os #Change this to match a location where the Tzanetakis dataset has been mirrored BASEURL = 'http://people.duke.edu/~cjt16/genres/'...
true
00b4b609b959b10080c1ac0c7554e2f6552153e4
mathurk29/session-6-assignment-mathurk29
/Part2.py
UTF-8
2,567
3.46875
3
[]
no_license
#1 fibonacci = [0,1,1] while True: next = fibonacci[-1] + fibonacci[-2] if next<10000: fibonacci.append(next) else: break print(f'Fibonacci serires till 10000 is: {fibonacci}') check_Fibonaci = lambda x: x in fibonacci check_Fibonaci(610) check_Fibonaci(611) #2.1 list_a = [1,2,3,4,5...
true
7a4314c123212822e6bf253914947676d6bc4cf3
elleneb93/hello-world
/cfg/hello.py
UTF-8
581
4.03125
4
[]
no_license
#https://darrenvong.github.io/shefcodefirst-python/ print("hello world") print("Bob" * 3) #print('bob') print("hello".upper()) #upper case print('goodbye'.lower()) #lower case print("the lord of the rings".title()) #capitalise 1st letter of world print(2+2) print(8*9) print(5/2) print(5//2)#integer division print(5%2)...
true
142787ee98962eb066e14f073d4156e73f53e814
rosemarycheung/trivia_game
/main.py
UTF-8
703
3.5
4
[]
no_license
from clint.textui.colored import red, green, yellow, cyan, magenta import json def main(): """ Runs the trivia game """ score = 0 with open ("trivia_questions.json") as f: questions = json.load(f) name = input(yellow("What is your name?\n")) print(magenta("Hello {}".forma...
true
d95466443fef9d3cd764ee875cc83fcbaffb57c4
Thomascript/Questoes---URI---Python
/1064.py
UTF-8
256
3.515625
4
[ "MIT" ]
permissive
i = 0 soma = 0 cout = 0 while(i < 6): numero = float(input()) if(numero > 0): cout = cout + 1 soma = soma + numero i = i + 1 media = soma / cout print("{} valores positivos".format(cout)) print("{0:.1f}".format(media))
true
eddc291f0b8e7fe5a3174754447ccd8501952a38
laurelkeys/kaleidoscopy
/src/kal_ast.py
UTF-8
4,509
3.09375
3
[]
no_license
from __future__ import annotations from typing import List, Tuple, Optional from kal_bin_ops import DEFAULT_PRECEDENCE class Node: """ Base class for all AST nodes. """ def __str__(self): return ( f"{self.__class__.__name__}(" + ", ".join([f"{k}={v}" for k, v in self.__dict_...
true
c1997ef9e682fb86d4b87a13b272be987a41c5a9
newpencil77/busanIT
/python/basic.py
UTF-8
10,260
4.0625
4
[]
no_license
#-*- coding: utf-8 -*- ''' x= 1 y= 2 z= 3 print(x) print(y) print(z) # 예제3 x = 4 y = 3.14 z = "561" print(type(x), type(y), type(z)) #예제 x = -10 if x*2 > x: print('크다.') else: print('작거나 같다') #if문 name = '리스' if name == '앨리스': print('반가워요 ' + name) print('종료') #if else문 name = '밥' if name == ...
true
96a77ad7c6511773775e053e1ce8d1d1291ccafe
val-labs/pkcrypt
/pkcrypt/test.py
UTF-8
541
2.640625
3
[ "Unlicense" ]
permissive
#!/usr/bin/env python from pkcrypt import * def test(): xsk = keys.gen_private_key(curve.P256) ssk = sk2str(xsk) sk = str2sk(ssk) xvk = keys.get_public_key(sk, curve.P256) svk = vk2str( xvk ) vk = str2vk(svk) msg = "a message to sign via ECDSA" # some message rs = ecdsa.sign(msg,...
true
cb6a03197456ef86eb7c2cf7c64e499f9c89cd26
arthurtomas/Codes_git
/desafio040.py
UTF-8
588
3.859375
4
[]
no_license
n1 = float(input('Digite sua primeira nota: ')) n2 = float(input('Digite sua segunda nota: ')) media = (n1 + n2) / 2 if n1 > 10 or n1 < 0 or n2 > 10 or n2 < 0: print('Você digitou notas inválidas.') elif media < 5: print('Sua média é \033[1;31m{:.1f}\033[m, você está \033[1;31mreprovado!\033[m'.format(media)) e...
true
99173f327946c882096d361e4bfc3a162da3b438
MichelleLochner/astronomaly
/astronomaly/scripts/CRTS_example.py
UTF-8
4,858
2.671875
3
[ "BSD-3-Clause" ]
permissive
# An example for the CRTS data from astronomaly.data_management import light_curve_reader from astronomaly.feature_extraction import feets_features from astronomaly.postprocessing import scaling from astronomaly.anomaly_detection import isolation_forest, human_loop_learning from astronomaly.visualisation import tsne_pl...
true
377b65a103cd291f7a7c4bf7d765ec2b372ed8cf
Vir2S/trading-bot
/robotrade/robot.py
UTF-8
12,907
2.609375
3
[]
no_license
import json import time as time_true import pprint import pathlib import pandas as pd from td.client import TDClient from td.utils import milliseconds_since_epoch from datetime import datetime from datetime import time from datetime import timezone from datetime import timedelta from typing import List from typing i...
true
2e806573e17e57ec228940c8673c15d0f0cfaa7d
saherahwal/travelagency
/ota/ota/dealsManager.py
UTF-8
9,467
2.703125
3
[]
no_license
# # Manager class for deals # NOTE: Deals Finder used from Booking.com Affiliate - # https://admin.booking.com/pc/product_dealfinder.html?ses=fc44c0a3345ad8b8fdca0af519b1fa58&partner_id=544106&product_type=dfl2 # import random class SpecialDeal(object): def __init__(self, header, subheader, ins_script): ...
true
b973c4b05ccd031aa8817da16c363af52db04fee
AlexGDema/Py7
/coding-201-advanced-parsers/metaparser_schema.py
UTF-8
7,733
2.765625
3
[ "Apache-2.0" ]
permissive
''' Metaparser ---------- Metaparser pyats module provides a structure unification among different parsing contexts. It provides a unified structure that will be followed by different device connections (Ex: 'cli', 'yang', 'xml). It addresses the common automation problems such as: -----------------...
true
134d1b162f2debf031dcef5180f82b30a9d397b8
varun-gokhale/PW_II_EN16CS301283_SENTIMENT-ANALYSIS-OF-CUSTOMER-REVIEWS-USING-NATURAL-LANGUAGE-PROCESSING
/data files/lda_hotel.py
UTF-8
3,637
2.953125
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Mon Apr 27 11:55:24 2020 @author: VAISHNAVI """ # -*- coding: utf-8 -*- """ Created on Sun Apr 26 18:00:00 2020 @author: VAISHNAVI """ import pandas as pd import numpy as np import nltk from nltk.corpus import wordnet import string from nltk import pos_tag from nltk.corpus imp...
true
747ef57b0bdd8f79ada4f14f07d5f52b6e1e3d54
csaluigm/qlearning
/run.py
UTF-8
4,007
2.5625
3
[]
no_license
import pickle import time import numpy as np import argparse import re from envs import TradingEnv from agent import DQNAgent from utils import get_data, get_scaler, maybe_make_dir import matplotlib.pyplot as plt import pandas as pd from plotly.subplots import make_subplots import plotly.graph_objects as go if __nam...
true
fee23fa20d3f9a98418aff6bb70b2e2f1c90e8c0
nguyenmauthanh/pythonptit
/sapxeptheotichchuso.py
UTF-8
89
3.328125
3
[]
no_license
t = int(input()) while t > 0: s = str(input()) print(int("a")) t-=1
true
69fb9a4656ed2465f3f19b779b6d6318b958fe9a
iago-costa/Per-odo-6-facul
/SISTEMAS-DISTRIBUIDOS/atividades/trabalhofinal1/resolucao/srv3/c3.py
UTF-8
7,958
2.796875
3
[]
no_license
# https://cryptography.io/en/latest/hazmat/primitives/asymmetric/rsa/ import sys # importando tudo da biblioteca sockets from socket import * #scripts extras para data from datetime import datetime # definindo nome do servidor para conectar serverName = '225.0.0.3' # definindo porta para comunicação udp serverPor...
true
d539a1183de12489a6238f12c3c48e0c58cdfad6
shadmansakib018/Python-Codes
/linkedlist.py
UTF-8
2,811
3.546875
4
[]
no_license
class node: def __init__(self, data=None, next=None): self.data = data self.next = next def __str__(self): return str(self.data) class LinkedList: def __init__(self): self.head = None def createlist(self, ll): self.head = node(ll[0]) curr = self.head for i in range(1,len(ll)): ...
true
7ca05e7e838922f4d39773d9591b820fee34303d
glenwilson/variant_analysis
/indels-maxmin/get_conserved_windows.py
UTF-8
2,274
2.75
3
[ "MIT" ]
permissive
#!/usr/bin/python import csv import sys #load the variant vcf files inputlist = sys.argv[1:] #load the nblrr csv nblrr = open('nblrr-noscaffold-windows.csv', 'r') nblrrcsv = csv.reader(nblrr, delimiter='\t', quotechar=None, doublequote=False) winlist = [row for row in nblrrcsv] #file to write conserved regions to ...
true
f6bd62521cb9de3b12274070ff530acf3f7a4d4d
handaeho/Project_GTA5_Auto_Drive
/mine/train_sample.py
UTF-8
3,888
2.609375
3
[]
no_license
import numpy as np import random FILE_NUM = 10 # npy 파일 갯수 LR = 1e-3 EPOCHS = 30 # MODEL_NAME = 'inception_v3' # PREV_MODEL = 'inception' # LOAD_MODEL = True # model = googlenet(WIDTH, HEIGHT, LR, output=9) # if LOAD_MODEL: # model.load(PREV_MODEL) # print('We have loaded a previous model!!!!') start = 1 f...
true
8edacb08e32201bf0853e421093efe2a2d7d3a4c
O1sInfo/chatroom
/client/client.py
UTF-8
2,646
2.890625
3
[]
no_license
#!/usr/bin/env python3 import socket import threading import argparse import sys from library import * class Client(object): """ Class object that stores peer information """ def __init__(self, sip="127.0.0.1", sport=50000): """ Connect to server """ self.s = socket.so...
true
08153013a373bfb2f4dc69981eaefc56472f9b97
webclinic017/fa-absa-py3
/Extensions/FrontCache/FPythonCode/FC_DATA_SELECTION.py
UTF-8
2,861
2.65625
3
[]
no_license
'''---------------------------------------------------------------------------------------------------------- MODULE : FC_DATA_SELECTION PROJECT : FX onto Front Arena PURPOSE : This module will contain the data based on any data selection method implem...
true
5a806aebb627525764665acccdfdc27657c3dbbd
cna274/Gender-Classification-Based-on-Heights-and-Weights-information
/My_Sample_Code_1.py
UTF-8
6,900
3.4375
3
[]
no_license
# coding: utf-8 # In[ ]: import numpy as np import pandas as pd # In[ ]: '''Use this class to pre process the humungous ugly data to machine learning algorithm understandable matrix form and meaningfull. Output will be of form n_samples,n_features plus the labels. Following things can be done using this class. A...
true
60a5b1f46c3e79ba7b47ca39078b48c573a84595
K1ngcuber/AdventOfCode2020
/door8/door8_part2.py
UTF-8
998
2.890625
3
[]
no_license
instructions = [] history = [] acc = 0 pc = 0 last_pcs = [] change = True run = True with open("door8_input.txt","r") as f: instructions = list(f.readlines()) def parse_instruction(instruction): global pc global acc global last_pcs global change instr,arg = instruction.split(" ") if inst...
true
b7356911914869f69b474ecad1c9f57ea6a85fdf
saroja-parida/mycode
/find_file_recursion.py
UTF-8
492
3.234375
3
[]
no_license
#Write all the files with extensions mentioned #Write them in a dictionary import os file_extn=["pdf","txt","rtf"] new_dict={x: [] for x in file_extn} for dirpath,dirname,file in os.walk("/Users/sarojakumar.parida/Documents/Personal/Dipti/Capgimini"): for fname in file: f_extn=fname.split(".")[-1] ...
true
0512b42d9a655db57dd469006cde3cba882ea628
mattbellis/3pcf
/examples/sum_GPU_voxels.py
UTF-8
1,289
2.53125
3
[]
no_license
#import matplotlib #import matplotlib.pylab as plt import numpy as np import sys ################################################################################ # Open the input file ################################################################################ infilenames = sys.argv[1:] ngals = None nbins = None ...
true
6e416c9308c04adbdcdc604b13a3fdaa12874b83
multavici/DSR-Bird-Song
/birdsong/data_preparation/db_creation/add_recordings_extra_data.py
UTF-8
2,573
3.078125
3
[]
no_license
''' This script uses as input text files with json strings that contain the scraped info from the Xeno-Canto webpages for each recording. It cleans the data and saves the useful data in the sqlite database ''' import os import json import pandas as pd import sqlite3 if 'HOSTNAME' in os.environ: # script runs on ...
true
36cda4d6c6586ee4379fd7f43534434a3d849c7e
StarPolyge/HKUST-COMP5421-Computer-Vision
/assignment3/hw1_code_data/code/visual_recog.py
UTF-8
5,803
2.625
3
[ "MIT" ]
permissive
import numpy as np import threading import queue import imageio import os,time import math import visual_words import multiprocessing import skimage def get_feature_mp(args): image_path, label, dictionary, SPM_layer_num = args feature = get_image_feature(image_path, dictionary, SPM_layer_num, dictionary....
true
e9f5c6148d2c48942f24c8a0a72f016eaf8df2c7
shivam207/iceberg_challenge
/convnet.py
UTF-8
4,483
2.578125
3
[]
no_license
'''Trains a simple convnet on the MNIST dataset. Gets to 99.25% test accuracy after 12 epochs (there is still a lot of margin for parameter tuning). 16 seconds per epoch on a GRID K520 GPU. ''' from __future__ import print_function import keras from keras.models import Sequential from keras.layers import Dense, Dropout...
true
51716106d57af3790192ab3bfc25756ed43453e6
gv1010/Algorithms-and-Data-Structures-Leetcode-
/Trees/PathSum3.py
UTF-8
1,333
3.578125
4
[]
no_license
class Node: def __init__(self, val = None): self.val = val self.left = None self.right = None class Tree: def __init__(self, root): self.root = Node(root) def PathSum(self, root, target): if root is None: return None node = root q = [[node,[node.val]]] count = 0 if node.val == target: ...
true
a1c1a6bcde2c1cf99979e752c26cd798a191a03a
mileshill/HackerRank
/Challenges/easy_sum.py
UTF-8
295
3
3
[]
no_license
from sys import stdin from math import modf r = stdin.readline for line in range( int( r() ) ): n, m = map(float ,r().strip().split()) frac_part, int_part = modf(n/m) if n < m: out = n *(n+1) / 2 else: k = (m-1)*m / 2 out = int( (k*int_part + k*frac_part)) print(int( out ))
true
ec5ab6a7985e4e4471e9f0ef8feadd4432c8be31
cjlaserna/emailspammer
/jtbleaveon.py
UTF-8
2,184
2.578125
3
[]
no_license
# import imapclient #mail access import os import smtplib import email import random from dotenv import load_dotenv import time import tkinter from timeloop import Timeloop from datetime import timedelta BASEDIR = os.path.abspath(os.path.dirname(__file__)) # get path to this file dir load_dotenv(os.path.j...
true
1307f48b69b2f232eba7b7f336b1206789a15849
283938162/MachineLearningAndDeepLearning
/DBScan/DBScan.py
UTF-8
2,489
3.171875
3
[]
no_license
# DBSCAN是sciki−kearn提供的密度聚类算法模型,其原型为: # class sklearn.cluster.DBSCAN(eps=0.5,min_samples=5,metric='euclidean',algorithm='auto',leaf_size=30,p=None,random_state=None) # 导包 from sklearn import cluster from sklearn.metrics import adjusted_rand_score import numpy as np import matplotlib.pyplot as plt from sklearn.dataset...
true
59b6f71f65f32582753a71cce17ede797e391491
hd-code/pattern-learning-xai-ls
/src/gui/header.py
UTF-8
2,427
3.375
3
[]
no_license
"""The header area of the main window before the table.""" import PySimpleGUI as sg from gui.base import Layout, expand, font_bold, font_heading, font_small from gui.popup import popup import event as ev def header() -> Layout: ev.register(_key_info, _handle_info) return [ [ expand(), ...
true
03c43f318f898783093b31e8bdad6fea583925b2
funasshi/DCGAN
/train.py
UTF-8
4,601
2.703125
3
[]
no_license
import torch from torch import nn, optim import torchvision import torchvision.transforms as transforms from model import Generator, Discriminator import matplotlib.pyplot as plt # ---------------------------------------------------------------------------------------------- # データセットの定義 (訓練データの正規化、ラベルのone-hot-vec化) t...
true
03c2babe391028dabdd7f3cc24091c3f1ae27a22
kellyjonbrazil/jc
/jc/parsers/airport.py
UTF-8
3,537
2.96875
3
[ "MIT" ]
permissive
"""jc - JSON Convert `airport -I` command output parser The `airport` program can be found at `/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport`. Usage (cli): $ airport -I | jc --airport or $ jc airport -I Usage (module): import jc result = jc.parse('airpo...
true
808a12f059a6ed1ac9c1e28a915a9957386c5c5c
milarin/Python_memo
/t.py
UTF-8
1,889
3.8125
4
[]
no_license
# chara = 'word' # for c, i in enumerate(chara): # print(f'{c}買い目 {i}') # nums = [2, 4, 6, 8] # for i in nums: # if i % 2 == 1: # break # else: # print('奇数の値を含めてください') # n = 0 # while n < 3: # print(n) # n += 1 # else: # print('しゅうりょう') # def has_book(items): # for item in ...
true
12145505a5427b82308eb8e5f3d7731941dbdae3
maoxx241/code
/Find_the_Town_Judge/Find_the_Town_Judge.py
UTF-8
774
2.71875
3
[]
no_license
class Solution: def findJudge(self, N: int, trust: List[List[int]]) -> int: # if not trust and N>1: # return -1 # dic={} # s=(1+N)*N//2 # for i in trust: # if i[0] not in dic: # dic[i[0]]=[i[1]] # s-=i[0] # ...
true
c99ff35bb928ad30dbbe9eb15009febf24aa8126
anamariagds/primeiroscodigos
/repetições/conceitoaluno.py
UTF-8
465
3.671875
4
[]
no_license
def conceito(n): if n>= 8.5: print("A") elif n >=7.0: print("B") elif n >=5.0: print("C") elif n >=4: print("D") elif n>=0: print("E") def main(): nota = float(input("Informe a nota do Aluno: ")) while (nota < 0) or (nota >10): print("Nota...
true
e3b9f25c71e09fb4caf65686c26c38c6e519a470
Anturion/Signal-sensor-acquisition-with-python-and-IDE-of-Cypress
/Pulso.py
UTF-8
16,743
2.9375
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Thu Sep 26 08:47:39 2019 @author: Alejandro """ #Se importan las librerias necesarias import numpy as np import scipy.signal as signal import pandas as pd import matplotlib.pyplot as plt import prueba3 as pb #Función como parte de los filtros a aplicar def fkernel(m, f, w): ...
true
6933abb97f88464fb67d4ed1a348fda6110fc8b9
talestsp/kaggle-talking-data
/preproc/group_app.py
UTF-8
1,625
2.546875
3
[]
no_license
import pandas as pd from os import chdir import gc working_dir = "/home/tales/development/kaggle-talking-data/" chdir(working_dir) dtypes = {'label_id': int, 'category': str, "event_id": str, "device_id": str, "app_id": str, "is_installed": str, "is_active": str, "gender": str ,"age": int, "group": str, "group": str...
true
b39e9f40cb1f067973d9dc01bf42475d51b38480
IrfanZM/sat_cc_euler
/4.py
UTF-8
559
4.1875
4
[]
no_license
# A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 × 99. # Find the largest palindrome made from the product of two 3-digit numbers. n = 1001 palindrome_check = False for n in range(998001,10000,-1): n_string = str(n) if n_string =...
true
db0b49ebd6465c695e7b4836b8009e647fe20be7
bhberthold1/webcamLineFollow
/demo1.py
UTF-8
2,814
2.734375
3
[]
no_license
#!/usr/bin/python from Raspi_MotorHAT import Raspi_MotorHAT, Raspi_DCMotor import time import atexit # create a default object, no changes to I2C address or frequency mh = Raspi_MotorHAT(addr=0x6f) lroffset = 0 # recommended for auto-disabling motors on shutdown! def turnOffMotors(): mh.getMotor(1).run(Raspi_Mo...
true
b399268a6b94abed503152f267a63093a6195c49
abdulla-m/Python
/integer.py
UTF-8
600
3.890625
4
[]
no_license
import math def calculate_formaula(a,b,c,d): first=1 second=1 for i in range(0,b): first = a*first for i in range(0,d): second = c*second print(first) print(second) return first + second if __name__ == "__main__": a = int(input("Enter A:")) b = int(input("Ente...
true
9156490efcac261a91ea05b7b7474d5ab1995876
monmonmon/ctf
/2020/kosenxm4sctf/first_asm/a.py
UTF-8
186
2.796875
3
[]
no_license
#!/usr/bin/env python key = ";,Z,.(7TWT2$jAU2#YLZ!QE^,(D h;H\t".encode() answer = "CAn_U_Re4d_A55emBly?L3t's_tRY_it".encode() for i in range(len(key)): c = key[i] ^ answer[i] print(chr(c), end='') print()
true
03168aa0dfa44ce3e47c4f27d5c58189978a0eaa
BlenderCN-Org/NMSDK
/nms_imp/classes/GcEncounterComponentData.py
UTF-8
718
2.546875
3
[]
no_license
# GcEncounterComponentData struct from .Struct import Struct STRUCTNAME = 'GcEncounterComponentData' class GcEncounterComponentData(Struct): def __init__(self, **kwargs): super(GcEncounterComponentData, self).__init__() """ Contents of the struct """ self.data['EncounterType'] = kwargs.g...
true
5f5801ead6b58025ca23492c207612f8c5c178c0
tmoshole/python_projects
/my_python_projects/submission_002-toy-robot-3/robot.py
UTF-8
15,888
3.71875
4
[]
no_license
# list of valid command names valid_commands = ['off', 'help', 'forward', 'back', 'right', 'left', 'sprint','replay',\ 'reverse','replay silent','replay reversed','replay reversed silent'] # variables tracking position and direction position_x = 0 position_y = 0 directions = ['forward', 'right', 'back', 'left','sprin...
true
cfe8c2c9d4409fb58f20aa2841a589595a2b1a76
huggingface/tokenizers
/bindings/python/py_src/tokenizers/implementations/base_tokenizer.py
UTF-8
13,943
2.78125
3
[ "Apache-2.0" ]
permissive
from typing import Dict, List, Optional, Tuple, Union from tokenizers import AddedToken, EncodeInput, Encoding, InputSequence, Tokenizer from tokenizers.decoders import Decoder from tokenizers.models import Model from tokenizers.normalizers import Normalizer from tokenizers.pre_tokenizers import PreTokenizer from toke...
true
a9a5a032e5d1e05259b833f110feb3c26f5840b9
christianbuda/ADM-HW1
/scripts_Problem_2.py
UTF-8
3,508
3.640625
4
[]
no_license
#Birthday Cake Candles import math import os import random import re import sys # # Complete the 'birthdayCakeCandles' function below. # # The function is expected to return an INTEGER. # The function accepts INTEGER_ARRAY candles as parameter. # def birthdayCakeCandles(candles): max=candles[0] ...
true
72cfec7c3c57d0dba4fa7c10f25466feef1f3a38
kimshgood/DRAMsim3
/scripts/trace_gen.py
UTF-8
5,279
2.765625
3
[ "MIT" ]
permissive
#!/usr/bin/env python3 import argparse import os import random class Generator(): """ Format agnostic address stream generator """ def __init__(self, stream_type, interarrival, ratio, gb): # convert to 0 ~ 1 for easier random generation self._interval = interarrival self._rat...
true
65e004124b26f47d313031b3fd3102c23fd14bdd
NicolasThou/DoublePendulum
/actor_critic_discrete.py
UTF-8
4,688
3.28125
3
[]
no_license
import torch import torch.nn as nn from torch import optim import numpy as np import utils from domain import Domain class ActorCriticDiscrete: """ Class implementation of Actor-Critic policy search technique with discrete action space """ def __init__(self, action_space): # action_space ...
true
c264a7735745e0fe834f8eaa43cc101b56c91897
wdamon/tenants_talk
/report/helper.py
UTF-8
489
2.765625
3
[ "MIT" ]
permissive
import geocoder def address_to_latlng(address, return_address = False): g = geocoder.google() try: #TODO: not really replace, geocode should use unicode strings address = address.encode('ascii', 'replace') place, latlng = g.geocode(address) except Exception as e: raise Valid...
true
581cf8ca2639c8f6ef38a9ae5a4257a547220ebd
LexTerm/LexTermServer
/term/models.py
UTF-8
1,632
2.625
3
[]
no_license
import uuid from django.db import models class SubjectField(models.Model): """ The SubjectField model represents various domains. """ name = models.CharField(max_length=100) class Meta: verbose_name_plural = "Subject Fields" def get_lexemes(self): from lex.models import Lexe...
true
4617ecb81719bc3066c5158c05904b57838fbe57
Satyam5878/Machine_Learning
/Machine Learning/Examples/Projects/CensusData/Script/PipeLine.py
UTF-8
6,813
2.8125
3
[]
no_license
import pandas as pd import numpy as np import os import seaborn as sns import matplotlib.pyplot as plt from sklearn.preprocessing import LabelEncoder from sklearn.preprocessing import Imputer from sklearn.pipeline import Pipeline from sklearn.linear_model import LogisticRegression from sklearn.metrics import classific...
true
9bc8b2e6470004a6e599d3e1f18b97d8b861d0d5
mouyleng2508/PycharmProjects
/week03:ex/50_bin_to_oct.py
UTF-8
336
3.609375
4
[]
no_license
def bin_to_oct(binary): binary = str(binary) for x in binary: if int(x) in bin: print(end='') else: return "This is not binary number" exit() decimal = int(binary, 2) octal = oct(decimal)[2:].upper() return octal.lower() bin = [0, 1] print(bin_to...
true
7e7a4563bd3512b0b13bc1d87b50fa47fffe3a3e
cohimame/tokenizerHSE
/CorporaExtractor.py
UTF-8
3,377
3.0625
3
[]
no_license
from xml.etree import ElementTree as ET from xml.sax.saxutils import escape TRAIN_CORP_SOURCE = "first500.xml" TRAIN_CORP = "train.xml" TEST_CORP_SOURCE = "other700.xml" TEST_CORP = "test.xml" PARAGRAPH = "_paragraph_" wrap = lambda tag, text: "<{0}>{1}</{0}>".format(tag,text) parag_wrap = lambda parag: "\n...
true
2dbae096696705d82bcdfe388551a41ce40bf35b
Z18Aplha/2DSpaceSimulation
/newCarFree2D.py
UTF-8
9,670
2.625
3
[]
no_license
from Path import Path from math import sqrt, cos, sin, atan from Point import Point from Polynomial import Polynomial from newPathPlanner import PathPlanner from Controller import Controller import numpy as np from Event import Event import math as m import Lib as lib class CarFree2D: def __init__(self, id: int, ...
true
c4a39858f70d99911a62c91050689c6e807ed982
TomekTrzeciak/improver
/lib/improver/cli/wind_direction.py
UTF-8
5,222
2.578125
3
[ "BSD-3-Clause", "LicenseRef-scancode-proprietary-license" ]
permissive
#!/usr/bin/env python # -*- coding: utf-8 -*- # ----------------------------------------------------------------------------- # (C) British Crown Copyright 2017-2019 Met Office. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the ...
true
e02b5e031c001bbaaba10242ba4c0084fffbb7be
sho-portfolio/machine-learning-logistic-regression
/keras-multiclass-classifier/_train.py
UTF-8
8,553
2.546875
3
[]
no_license
import _helper as helper import numpy as np # linear algebra import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv) from keras.models import Sequential from keras.layers import Dense, Dropout, Activation from keras.layers import Embedding from keras.layers import Conv1D, GlobalMaxPooling1D from keras.pr...
true
2d25d8bce58983be4ae1b80a530dbbb0cd53d134
lnsongxf/OGcourse_F17
/Students/Fiona/PS6/utils.py
UTF-8
5,999
2.5625
3
[]
no_license
import numpy as np import scipy.optimize as opt import matplotlib.pyplot as plt from matplotlib.ticker import MultipleLocator import os ''' Stiching functions for U(c) and g(b) ''' def MU_c_stitch(cvec, sigma): epsilon = 1e-4 c_cnstr = cvec < epsilon muc = cvec ** (-sigma) # print (f"c...
true
25ea75dfdd378fbb6c9af6c131d6ee9088b0925d
circularring1059/python-exercise
/0011/0011.py
UTF-8
648
3.578125
4
[]
no_license
def get_filtered_words(): result = [] with open("filtered_words.txt", encoding='UTF-8') as f: for line in f.readlines(): result.append(line.strip()) return result def judge_filtered_word(word, filtered_words: list): if filtered_words and filtered_words.count(word) > 0: ret...
true
5a22b819603fb0ce43d56d4d2a2e62bc605d08ee
fagan2888/suspect
/batch/result_to_csv.py
UTF-8
982
2.71875
3
[ "Apache-2.0" ]
permissive
import argparse import boto3 import json import pandas as pd s3 = boto3.client('s3') def list_objects(bucket, prefix): paginator = s3.get_paginator('list_objects') for page in paginator.paginate(Bucket=bucket, Prefix=prefix): for problem in page['Contents']: yield problem['Key'] def re...
true
492ec7c789e7f36eca8cf8d2324e7666a32f843c
jking-roar/python-fun
/odds/beerOdds.py
UTF-8
2,136
3.828125
4
[]
no_license
# what are the odds of two people choosing four distinct numbers out of # 103 numbers, and their two selections having an overlap of two numbers? from random import sample numBeers = 10 numPeople = 2 selectNum = 4 overlap = 2 monte_carlo_total_attempts = 10000 print("there are {0} beers!".format(numBeers)) print("the...
true
ab9ed4908c4426d5d1370600de6c5dce05bb9b98
LeBronPrince/Adaptive_Affinity_Fields
/seg_models/models/deeplab.py
UTF-8
5,864
2.546875
3
[ "MIT" ]
permissive
import tensorflow as tf from network.common.resnet_v1 import resnet_v1_101 import network.common.layers as nn def _deeplab_builder(x, name, cnn_fn, num_classes, is_training, use_global_status, ...
true
efd813b8c0391e4f23c9751d8f7ef0e4a8f0adf6
salarim/Expected-k-center
/main.py
UTF-8
7,330
2.984375
3
[]
no_license
import numpy as np import pandas as pd import itertools import matplotlib.pyplot as plt import time class Grid: def __init__(self, name, min_x, max_x, min_y, max_y, last_x, last_y): self.min_x = min_x self.max_x = max_x self.min_y = min_y self.max_y = max_y self.last_x = la...
true
b985de92114262998a81c17cb1a6b7fda73c8a42
Sukunyuan/cp1404practicals
/prac_06/guitar_test.py
UTF-8
529
3.796875
4
[]
no_license
from prac_06.guitar import Guitar def main(): gibson = Guitar("Gibson L-5 CES", 1922, 16035.40) another = Guitar("Another Guitar", 2013, 1000.55) print("{} get_age() - Expected 98. Got {}".format(gibson.name, gibson.get_age())) print("{} get_age() - Expected 7. Got {}".format(another.name, another.ge...
true
2c836c2d859949bf5143c910f28783741e09e87d
fattmerchantorg/fattmerchant_python_client
/fattmerchant/controllers/transactions.py
UTF-8
2,886
2.9375
3
[ "MIT" ]
permissive
import json import logging from fattmerchant.exceptions import InvalidRequestDataException from fattmerchant.models import Transaction logger = logging.getLogger(__name__) class TransactionsController(object): """ Class interface with transactions within the Fattmerchant API """ def __init__(self, r...
true
ced6c23f56862ee581a34c33adb3a69f9c11534b
johannalichtman/learnpythonthehardway-old
/ex16_read.py
UTF-8
140
2.578125
3
[]
no_license
from sys import argv script, filename = argv target = open(filename, 'r') # 'r' parameter is for read print target.read() target.close()
true
ef0052b05d283355025f3e6a1aa3769d892d37aa
t-bltg/swig-examples
/python/enum/runme.py
UTF-8
818
3.234375
3
[]
no_license
# file: runme.py import example # ----- Object creation ----- # Print out the value of some enums print("*** color ***") print(" RED =", example.RED) print(" BLUE =", example.BLUE) print(" GREEN =", example.GREEN) print("\n*** Foo::speed ***") print(" Foo_IMPULSE =", example.Foo.IMPULSE) print("...
true
e3db4f8a023169cb0399356d16cb88dc21fc1cce
eunhwany/KaggleDA
/HousePrice_EH/20170930_house_price/_170930_ Preprocessing_code.py
UTF-8
3,120
2.765625
3
[]
no_license
import numpy as np import pandas as pd import matplotlib.pyplot as plt from sklearn import preprocessing train_path = "D:/python_kaggle/train.csv" test_path = "D:/python_kaggle/test.csv" output_path = "D:/python_kaggle/output.csv" ## train preprocessing raw_train_data = pd.read_csv(train_path) raw_test_data = pd.read...
true
d211d4ad582f7dedd8e8584dab76545318b75091
slobberchops/sordid-tools
/wsgi/src/sordid/wsgi.py
UTF-8
5,793
2.5625
3
[ "Apache-2.0" ]
permissive
#!/usr/bin/env python # # Copyright 2011 Rafe Kaplan # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law o...
true
452d730c5dc185a5fcdb7097ab130fbb04864634
larispardo/pacman_test
/DecisionTree.py
UTF-8
1,391
3.046875
3
[]
no_license
from enum import Enum class NodeState(Enum): READY = 1 VISITING = 2 SUCCESS = 3 FAILED = 4 RUNNING = 5 class Node: def __init__(self, action): self.state = NodeState.READY self.action = action def execute(self, state): self.state = NodeState.RUNN...
true
23abeb16da12aa3f3c2f5b8e12a382f9dcd4c9b2
jonaubf/LibraryOrder
/order.py
UTF-8
2,622
3.0625
3
[ "Apache-2.0" ]
permissive
#!/usr/bin/env python # -*- coding: utf-8 -*- import zipfile import os from lxml import etree def get_the_book(start_dir): """ at first we have to take the book from directory, than we have to get some info from it and than to put it to the right place. So get_the_book recursevly gets each book from d...
true
21235b62cc178fa758a3488f930320cb5e0d1cf3
mrmattkennedy/bayesian-classifiers
/naive_bayes.py
UTF-8
8,017
3.109375
3
[]
no_license
import pdb import math import time import random import threading import collections from nltk.stem.snowball import SnowballStemmer class naive_bayes(): def __init__(self, verbose=True): self.verbose = verbose self.stop_words = [word.rstrip('\n') for word in open('data/stopwords.data', 'r')] ...
true
4ab9262de9f2095bb42d194ba59a3cf1b2d4a038
snuderl/Project-euler
/problem17.py
UTF-8
861
3.53125
4
[]
no_license
words = ["one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten", "eleven", "twelve", "thirteen", "fourteen", "fifteen", "sixteen", "seventeen", "eighteen", "nineteen"] words10 = ["ten", "twenty", "thirty", "forty", "fifty", "sixty", "seventy", "eighty", "ninety"] words = { (i+1): x for (i, x) i...
true
b7ca1bb6fd33698d3f877db1c7827511bd96b4a4
BohanHsu/developer
/nlp/assign4/python/thinking.py
UTF-8
684
2.625
3
[]
no_license
def deltafunc(s,u,t,v): if delta[s][u][t][v] is None: # then put this vector into stack deltaStack.push([s,u,t,v]) while len(deltaStack) != 0: q = deltaStack.peek() if setDelta(q) = True: deltaStack.pop() def setDelta(s,u,t,v): sb = deltaSbAb()[0] ab = ...
true
6177ceb8549f291ed2f8f96449f68c5de7d8bc8b
GodThyane/epidemic-simulation
/main.py
UTF-8
16,260
3
3
[]
no_license
import numpy as np import matplotlib.pyplot as plt from matplotlib import animation import math from matplotlib.animation import PillowWriter import random from scipy.stats import norm import base64 from io import BytesIO # Clase particula, recibe las probabilidades de contagio, el tiempo de simulación, tiempo que du...
true
b8c2a7a6a30f2c568873300c26e0bb9038b0e6b7
astrzalk/COS-511-Project
/models/adaboost_mh.py
UTF-8
9,826
3.40625
3
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import numpy as np class AdaBoostMH: """ A class that implements three versions of multiclass adaboost. run_schapire: Implements the version of adaboost_mh as originally proposed in "Improved Boosting Algorithms Using Con...
true