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
3f44cb3a9ed759d4fa03690d8e5423f0a9de2342
dsspasov/HackBulgaria
/week0/1-Python-simple-problems-set/problem14.py
UTF-8
209
3.40625
3
[]
no_license
#problem14.py def number_to_list(n): new_list = [] while n!=0: new_list.append(n%10) n = n//10 return new_list[::-1] def main(): x = number_to_list(123023) print (x) if __name__ == '__main__': main()
true
1eb2c1d50d1ac7777f3cb56c767c466a3e48f1e9
SamLau95/nbinteract
/nbinteract/plotting.py
UTF-8
24,057
2.875
3
[ "BSD-3-Clause" ]
permissive
""" Plot functions for nbinteract. To test code without having to restart kernel, use: ``` import bqplot as bq import nbinteract as nbi import toolz.curried as tz from importlib import reload reload(nbi.plotting) ``` """ import numpy as np import bqplot as bq import collections import ipywidgets as widgets import i...
true
ed9b95a918f9165af537d347ae2f6ff45a4f8864
wjdwls0630/2018-1-Web-Python-KHU
/Week5 - Exam1/Exam1(월,수 1시 수업)/Exam1(4).py
UTF-8
279
3.375
3
[]
no_license
a=float(input("First Number : ")) b=float(input("Second Number : ")) def sum(a,b): return a+b def sub(a,b) : return a-b def mul(a,b) : return a*b def div(a,b) : return a/b def intdiv(a,b) : return a//b def rem(a,b) : return a%b if type(mul(a,b))=="float"
true
fec7658a8465495a34c1a6fc3088906946816971
dylanrandle/am207-hw
/hw7/mnist.py
UTF-8
21,180
3.15625
3
[]
no_license
""" Harvard IACS AM 207 Homework 7 Michael S. Emanuel Mon Oct 22 22:01:33 2018 """ import numpy as np import matplotlib.pyplot as plt ## Standard boilerplate to import torch and torch related modules import torch import torchvision.datasets as datasets import torchvision.transforms as transforms from torch.autograd i...
true
6d32b861a499c97c577b8afa299974175586c990
potomatoo/TIL
/Baekjoon/boj_17135_캐슬 디펜스.py
UTF-8
1,412
2.78125
3
[]
no_license
from itertools import combinations from copy import deepcopy def move_enemy(): after_move = [] for ey, ex in enemies: if (ey, ex) in after_attack: continue if ey+1 == N-1: continue after_move.append((ey+1, ex)) return after_move def attak(attacker): kill...
true
d0973939029e5e94ec58773b18fd1c77270e4bfd
akohli96/437_Project
/app.py
UTF-8
2,984
2.546875
3
[]
no_license
#!flask/bin/python import tweepy from flask import Flask,render_template,request import sys from textblob import TextBlob from credentials import secret import pygal from pygal.style import DarkSolarizedStyle from flask_bootstrap import Bootstrap dist={} app = Flask(__name__) @app.route('/') def index(): return r...
true
cdf5cd285571bb14e56ddbd035ba9fe564848f5f
deepakbairagi/Python3Challenges
/a.py
UTF-8
422
3.578125
4
[]
no_license
#!/usr/bin/python3 chars=0 lines=0 words=0 ab=open("a.txt","r") while True: f=ab.read(1) if f: if f=='\n': lines=lines+1 words=words+1 elif f==" ": words=words+1 chars=chars+1 else: print("file end") break print("Number of words in the string:") print(words) print("Number of lin...
true
1e1585ad3dbd1169c6a8b074b0cc5e69cc44a2ec
kaushiksivaprasad/SliceDB
/slicedbms/query.py
UTF-8
591
3.03125
3
[]
no_license
class SliceQuery: def __init__(self,columns,condition): if(all(isinstance(a, basestring) for a in columns) and isinstance(condition, SliceCondition)): self.columns = columns self.condition = condition else: raise Exception("Invalid parameters..") ...
true
fe798afa18a0762ca8536e7dde0b563a4d3ea2ae
wisemap-ufmg/OLD_MOCHA
/Classifier.py
UTF-8
2,449
2.6875
3
[]
no_license
import subprocess import warnings import numpy as np import scipy.stats as st import sys class Classifier: # Create models from data def best_fit_distribution(self, data, bins=200, ax=None): """Model data by finding best fit distribution to data""" # Get histogram of original data y, ...
true
30db8dcbfacd5b230326ebc8d71b4e0ad1e81f41
all1m-algorithm-study/2021-1-Algorithm-Study
/week2/Group3/boj2217_inthebar2.py
UTF-8
205
3.1875
3
[]
no_license
N = int(input()) ropes = [] for _ in range(N): ropes.append(int(input())) ropes = sorted(ropes) max_weight = 0 for i in range(N): max_weight = max(max_weight, ropes[i] * (N - i)) print(max_weight)
true
52a9d6a44c5cab6b71ac78e8bd37d1a31e360c3d
pspencil/cpy5python
/lab_assessment_1.2.py
UTF-8
724
3.1875
3
[]
no_license
#mysterycarplate.py import re def checksum(s): mapping=['A', 'Y', 'U', 'S', 'P', 'L', 'J', 'G', 'D', 'B', 'Z', 'X', 'T', 'R', 'M', 'K', 'H', 'E', 'C'] if not s[2].isdigit(): s=s[1:] if len(s)<7: s=s[:2]+'0'+s[2:] weights=[14, 2, 12, 2, 11, 1] sums=0 for i in range(0,6): n=0 if s[i].isdigit(): n=int(s[...
true
2739109bec2cd5a7b18ab07317be79a2bd021089
ZhangShaozuo/Machine_Learning_HMM
/part3.py
UTF-8
12,280
3.140625
3
[]
no_license
from os.path import dirname import numpy as np from numpy.core.defchararray import count, index from numpy.core.fromnumeric import argmax # from numpy.core.numeric import load import pandas as pd import os from tqdm import tqdm import pickle import sys def load_data(filepath, tag=True): dirpath = os.getcwd() # A...
true
9855b27a022dc3ddca12fc61e4fbe6e397be2b59
Yasmin-Core/Python
/Mundo_1(Python)/tipos_primitivos/aula6_(TiposPrimitivos).py
UTF-8
323
4.03125
4
[]
no_license
#### Float (numeros com pontos) n=float(input('digite um numero')) print(n) ### STR (só repete os caracteres) n= str(input('digite um valor')) print(n) ### Bool (valores lógicos (verdadeiro ou falso)) n= bool(input( 'digite um valor')) print(n) #ou n= input('digite algo') print(n.isnumeric ()) #existe vários "is"
true
8c627e45279ea2c622865ffd529e4c184dbe4394
alexkryu4kov/autism
/database/db.py
UTF-8
548
2.609375
3
[]
no_license
from sqlalchemy import create_engine from sqlalchemy.orm import sessionmaker from sqlalchemy.ext.declarative import declarative_base class Database: def __init__(self, db='postgresql://autist:pass@localhost:5432/postgres'): self.engine = create_engine(db, convert_unicode=True) @staticmethod def d...
true
5822b12532ea5857c8f36256cb2d9f82af694e9c
m2dan/toolkit
/main.py
UTF-8
1,061
2.796875
3
[]
no_license
import tkinter as tk import input_new as bb import search_engine as se import gpa_calculator as avg def press_button_one(): se.window_one() def press_button_two(): avg.window_two() def press_button_three(): bb.window_three() def press_button_four(): xxxxxxxxxxxxxxxx ...
true
a1af063d4bde951ccb6307a98be31a59c79a5124
Michelyp/Cyber-Academy
/sockets/check_ports_socket.py
UTF-8
766
3.1875
3
[]
no_license
import socket import sys def checkPortSocket(ip, portlist): try: for port in portlist: sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) # indica el tiempo de intento de conexión en segundos sock.settimeout(5) # establece una conexión con los parámetr...
true
83ca524315f4f579bb8f05a22eadf6d275b2e84b
jamesw98/dnd-bot
/spellbook_builder.py
UTF-8
9,226
2.859375
3
[]
no_license
import firebase_admin import discord from firebase_admin import credentials from firebase_admin import db from embed_builder import build_spellbook_embed from messages import build_spellbook_help_message # error messages ERROR_INVALID_COMMAND = "Sorry, that spellbook command doesn't exist!\nType `!dnd sb help` to vi...
true
27b01a15463f8ca3ad191d704701e6a89a23929e
ThomasGaller/TravelersProblem_Spielerei
/main.py
UTF-8
4,451
3.515625
4
[]
no_license
# importing Matplotlib and Numpy Packages import math import random as rndm import sys from timeit import default_timer as timer import matplotlib.pyplot as plt import numpy as np if len(sys.argv) != 3: max_coord = int(input("Max X/Y Value: ")) max_num_of_points = pow(max_coord + 1, 2) # if pow(max_coord ...
true
8d14bb8440232775342600e3bfb118ec3fc85b07
kcuric/surveillance-system
/client/modules/Recorder.py
UTF-8
940
2.859375
3
[]
no_license
import cv2 class Recorder(object): def __init__(self, camera_num): ''' Uses opencv to capture from camera with id 'camera_num'. Arguments: camera_num(int) id of the camera you want to capture with ''' self.video = cv2.VideoCapture(camera_num) self.video.set(...
true
32e941501fc5826bcb525c16dcfb8ca70a27cdff
davidmcnabnz/cryptoxlib-aio
/tests/e2e/CryptoXLibTest.py
UTF-8
3,395
2.703125
3
[ "MIT" ]
permissive
import logging import sys import asyncio from typing import Any, List import aiounittest from cryptoxlib.version_conversions import async_run LOG = logging.getLogger("cryptoxlib") class CryptoXLibWsSuccessException(Exception): pass class WsMessageCounterCallback(object): message_counts = {} def __in...
true
5db22802caf1f43358016003c5cc84df8617ce9b
Chi-Chu319/SmartTurnstile
/smart_NFC_turnstile/Admin/test/LoadingTkinter.py
UTF-8
1,213
3.5625
4
[]
no_license
# import tkinter as tk # from time import sleep # def task(): # # The window will stay open until this function call ends. # sleep(2) # Replace this with the code you want to run # root.destroy() # root = tk.Tk() # root.title("Example") # label = tk.Label(root, text="Waiting for task to finish.") # label...
true
9e2f7d2e7b49eea62f304c9d62310e6589ed6b66
BiteFoo/ebook
/python/python运用/黑帽子/BHP-Code/BHP-Code/Chapter5/joomla_killer.py
UTF-8
7,509
2.828125
3
[]
no_license
#-*-coding:utf-8-*- ''' 以下一段HTML最后4行可以看到 input 的type为 hidden,我们无法获得,但是通过 javascript 可以获得 而我们的Python这个脚本不在本域,无法获取这些值,而这些值又是随机的,可以唯一定位一个 session 所以我们不需要管这些,只需要在post出去的时候修改 username 和 passwd 就可以了 <form action="/administrator/index.php" method="post" id="form-login" class="form-inline"> <input name="username" tabindex="1...
true
e01f72f2ba2f0729641bc6397c0ba7507b3e47e1
maki-nage/rxsci
/rxsci/error/map.py
UTF-8
1,820
3.0625
3
[ "MIT" ]
permissive
import rxsci as rs def map(mapper): """maps errors emitted on a Mux Observable and route the result on the item path. The source must be a MuxObservable. .. marble:: :alt: map -+-----------------| +-1--X--2--3--X--4| [ map(0) ] ---1--0--2--3--0--4| ...
true
b2f860064f3c38adff551f95fdf5b893988a3e21
NatanaelEmilioC/bolsa_pred
/Meu_Scrapy/Meu_Scrapy/spiders/BrazilianTimes.py
UTF-8
1,557
2.640625
3
[]
no_license
# -*- coding: utf-8 -*- import scrapy import numpy as np import datetime import json class BraziliantimesSpider(scrapy.Spider): #import ipdb; ipdb.set_trace() name = 'BrazilianTimes' allowed_domains = ['braziliantimes.com'] start_urls = ['https://www.braziliantimes.com/noticias/economia'] cus...
true
a4b950d9f11a9ce37604b4ac39a03c17218c790e
spearfish/python-crash-course
/example/08.1.0_define_function.py
UTF-8
207
3
3
[]
no_license
#!/usr/bin/env python3 def greet_user() : ''' This is the doc string or documentation string, which will be displayed when using help(function_name) ''' print('hello, there') greet_user()
true
bbc4ee4d852762436709c6afc4f18a2e6f29a539
R-Varun/OsuMapper
/GA/utils.py
UTF-8
669
3.171875
3
[]
no_license
import numpy as np import random MAX_WIDTH = 640 MAX_HEIGHT = 480 MULTIPLIERS = [.25, .5, 1, 2] class GA_Note: def __init__(self, x, y, isNote): self.x = x self.y = y self.isNote = isNote def __repr__(self): return "GANOTE: {}, {}, {}".format(str(self.x), str(self.y), str(self.isNote)) def random_enc...
true
398105b7ee002557fca3a224010be2b21a0c6eec
swan11jf/CUED-Flood-Warning-Project
/Task2C.py
UTF-8
486
2.765625
3
[ "MIT" ]
permissive
from floodsystem.stationdata import build_station_list,update_water_levels from floodsystem.flood import stations_highest_rel_level def run(): stations = build_station_list() update_water_levels(stations) high_risk_stations = stations_highest_rel_level(stations, 10) for station in high_risk_stations: ...
true
f3a417345711e8ba58c556cb753cf09ebd7dfa78
chetanmhwr1111/Pythn-basics
/b_operns_numpyarray_plot.py
UTF-8
2,594
4
4
[]
no_license
#array with 5 pts from 0 to 2pi t=linspace(0,2*pi,5) ## range & indexing behaves in same way #gives list of no. from 'start' (by default its 0)value and doesn't give stop value t=range(start, stop, step length) #p[initial no. index: final no. index obtained+1 :step length(by default 1)] p[0::2] ...
true
dada211b57c38ed67d321684342b01bc93ed5a50
joebeachjoebeach/microbe-log-microblog
/models.py
UTF-8
1,235
2.703125
3
[]
no_license
from flask_sqlalchemy import SQLAlchemy import bcrypt db = SQLAlchemy() class User(db.Model): """User account""" __tablename__ = 'users' id = db.Column(db.Integer, primary_key=True) email = db.Column(db.String(64), nullable=True, unique=True) username = db.Column(db.String(64), nullable=True, un...
true
25065869b2d55cae9fb4f313b11ac68d62876fac
ChrisJohn85/Mad-Libs-
/Mad libs.py
UTF-8
222
3.6875
4
[]
no_license
colour = input("Enter a colour: ") PluralNoun = input("Enter a plural noun: ") Celebrity = input("Enter a celebrity: ") print("Roses are " + colour) print(PluralNoun + " are blue") print("I love " + Celebrity)
true
de09258bef34b5f9c80880f4e9ce2ffaf4b1cb70
RealMithrandir/Code-Examples
/News Website Summarizer/NewsSummary.py
UTF-8
236
2.53125
3
[]
no_license
import newspaper news_paper = newspaper.build(u'http://counterpunch.com') for article in news_paper.articles: article.download() article.parse() article.nlp() print(">" + article.title + "\n" + article.summary + "\n")
true
181da56855ec3ac77564f691845e2a8578de44fc
mdreammao/QuantitativeAnalysisPythonVersion
/QuantitativeAnalysisPythonVersion/Utility/TradeUtility.py
UTF-8
2,515
2.9375
3
[]
no_license
######################################################################## class TradeUtility(object): """盘口交易的辅助函数""" #---------------------------------------------------------------------- @classmethod def buyByTickShotData(self,tick,targetPosition,priceDeviation): #tick数据包括['S1','S2','S3','S4...
true
bec94da1330a71fded8454e08935289032d9a3a2
keinronald/http-server-python
/http_server.py
UTF-8
3,004
3.359375
3
[]
no_license
#!/usr/bin/env python3 """ solution for the task04 - code a HTTP server to exit the running Program just press enter note for me: curl http://localhost:17300 """ import http.server import threading import random from multiprocessing import Pool import urllib.request PROCESS_AMOUNT = 7 class Handler(http.server.B...
true
6d00b47d1d222a8566a3921d47f80420f735e445
MonikaTworek/Inzynierka
/BlackJack/blackjack/strategy/idealna.py
UTF-8
3,990
3.28125
3
[]
no_license
# Znajac układ całej talii wyliczana jest idealna rozgrywka, w której gracz wygrywa najwiecej rozgrywek. import copy from blackjack.game.table import Table class Idealna: def __init__(self, table: Table): self.table = table self.maxMoney = 0 self.stos = [] def play(self): pas...
true
725f0b4cd618ec76a56a80007c33a616ac4253d2
Awright919/Data-Programming-1
/Lab6/Lab6-1.py
UTF-8
115
3.671875
4
[]
no_license
userInput = str(input("Enter something: ")) changedInput = userInput[::-1] for i in changedInput: print(i)
true
97218af5d741d74da7ffe560e1afe8f892309e93
podnebesnoe/podnebom
/pandas_sql.py
UTF-8
5,792
3.21875
3
[]
no_license
import pandas as pd # http://bharatreddy.github.io/2015/01/15/sql-pandas1/ # Movie table: mID | title | year | director # Rating table: rID | mID | stars | ratingDate # Reviewer table: rID | name df_movie = pd.DataFrame() df_rating = pd.DataFrame() df_reviewer = pd.DataFrame() ### part 1 # Find the titles of all ...
true
d41e3665b181f0e73b11bdd0566a97392085a240
Procrat/typy
/typy/__init__.py
UTF-8
805
2.640625
3
[ "MIT" ]
permissive
#!/usr/bin/env python """A static type checker for Python""" from typy import checker from typy.exceptions import CheckError, NotYetSupported import argparse import logging def main(): parser = argparse.ArgumentParser(description=__doc__) parser.add_argument('-v', '--verbose', action='store_true') parse...
true
794a5f466c647f3a9d2e505770738e7f34b34d79
bsuverzabaek/Code-Chef-Exercises
/Beginner/leadGame/leadGame.py3
UTF-8
611
3.125
3
[]
no_license
while (1): N = int(input()) if (N<=0 or N>10000): print("N must be 1 <= N <= 10000"); else: break p1 = [] p2 = [] max = 0 sum1 = 0 sum2 = 0 for i in range(0,N): while (1): p1_i,p2_i = map(int,input().split()) if (p1_i<=0 or p1_i>1000): print("p1["+str(i)+"] must be 1 <= p1[i] <= 1000") elif (p2_i<...
true
9e015a5df17fc371956c9869d0f842b84e905c6b
whyjay17/data_science_study
/file_io/csv_example.py
UTF-8
1,883
3.78125
4
[]
no_license
# -*- coding: utf-8 -*- """ Created on Fri Dec 22 18:10:21 2017 @author: YJ """ # plotting tools import matplotlib as mpl import matplotlib.pyplot as plt import csv path = 'data/grades.csv' """ Will be reading file at 'path' and construct x and y vals that will be plotting. Each line in csv : year and grades Needs...
true
1184c47b4d46855a1b114a80c8de5921c1f07d3d
renyuntao/Puzzle
/countOfTriplets/countOfTriplets.py
UTF-8
357
3.5625
4
[]
no_license
#!/usr/bin/env python def countOfTriplets(sortedList,lenght,sum_): ans = 0 for i in range(length-2): j = i + 1 k = length - 1 while j < k: if sortedList[i] + sortedList[j] + sortedList[k] >= sum_: k -= 1 else: ans += (k - j) j += 1 return ans arr = [5,1,3,4,7] arr.sort() length = len(arr) p...
true
d4baa690d827a4a3951dc6b9d7e41f5cb4b5d795
ssw02238/algorithm-study
/3048_개미/3048.py
UTF-8
796
2.8125
3
[]
no_license
import sys sys.stdin = open('input.txt') N1, N2 = map(int, input().split()) group1 = list(input()) group2 = list(input()) T = int(input()) time = 0 result = [] # 0번 direction for i in range(N1-1, -1, -1): result.append([group1[i],0]) # 1번 direction for i in range(N2): result.append([group2[i], 1]) # [['C',...
true
6d91aedc7872a4d3e1afa3ac28c4063bb9920538
joeoakes/PSUABFA16IST411
/joesExamples/xbee2.py
UTF-8
642
2.75
3
[]
no_license
# xbee uses serial port communication to broadcast # pty device is a pseudo-teletype # tty is a real teletype serial port # to show your pty $ ps -ef | grep pts # Create Virtual Serial Port # sudo apt-get install socat # Terminal 1 # socat -d -d pty,raw,echo=0 pty,raw,echo=0 # Terminal 2 # cat < /dev/pts/2 # Terminal ...
true
5fba8a7776f940c96e71cdcbb207a7a446cdc028
rheehot/Algorithm-Study-6
/[백준]1110 더하기 사이클/python.py
UTF-8
226
3.171875
3
[]
no_license
value = input().zfill(2) origin = value count = 0 while True: temp = int(value[0])+int(value[1]) value = value[1]+str(temp).zfill(2)[1] count +=1 if value == origin: break print(count)
true
347c36677a835103aec7e0b65a697177d6c02e61
hugepeak/cabinair
/data_pub/3d_animation.py
UTF-8
2,560
2.9375
3
[]
no_license
import numpy as np import matplotlib.pyplot as plt import mpl_toolkits.mplot3d.axes3d as p3 import matplotlib.animation as animation input_file = open("output.txt","r") line = input_file.readline().split() x_size = line[0] y_size = line[1] z_size = line[2] times = [] car_dict = {} car_first_time = {} car_last_time ...
true
4f03582585d271dbc892818c1d89bbd27bbb87df
kasimsharif/insuranceservice
/application/src/controller/insurance_policy_access.py
UTF-8
3,209
2.59375
3
[]
no_license
from application.src.common.exceptions.custom_error import CustomError from application.src.dao.inmemory_insurance_policy import InMemoryInsurancePolicy, InsurancePolicy from application.src.utils.date_time import timestamp_to_datetime, date_to_utc, get_datetime_now def get_insurance_policy_json(insurance_obj): r...
true
bcf73ad9ecfb5000b24b8be9f644b14f8cf1eee7
CS-6381/FinalProject
/Messaging Systems & Message Queues/Redis/scripts/MessageSize/old/publisher.py
UTF-8
1,005
2.65625
3
[ "BSD-3-Clause" ]
permissive
#!/usr/bin/python3 import sys from redisapi.redisclients import RedisPublisher MESSAGE_DIR="/home/vagrant/FinalProject/DesignOfExperiments/messages/" MESSAGE_SUFFIX = ".txt" messages = [ 'tiny', "small", "medium", "large", "xlarge" ] print("Make sure that your subscriber is already running a...
true
ef56410d2d961c6bb2de7093aedb8b507c9094ad
HarderThenHarder/AnimalForest
/AntState.py
UTF-8
3,651
2.96875
3
[]
no_license
from State import State from random import randint from Vector2 import Vector2 class AntStateExploring(State): def __init__(self, ant): State.__init__(self, "exploring") self.ant = ant self.WIDTH_HEIGHT = self.ant.world.WIDTH_HEIGHT def random_destination(self): w, h = self.WI...
true
8c415f1db4ce6f7a23369f7a4497805202a329eb
wabrishi/student
/rishi_raj/SEARCH.py
UTF-8
3,939
2.59375
3
[ "MIT" ]
permissive
from tkinter import * import tkinter as tk import mysql.connector from tkinter import messagebox from tkcalendar import DateEntry from tkinter import ttk top=Tk() top.title('SEARCH') top.geometry('1000x550+200+50') #===============================================database conectivity============================...
true
819d25d72e41c2d06c0b4d6497e65efeb731c5f8
awesome-security/openc2-davaya
/devel/jaen/test_codec.py
UTF-8
24,065
2.578125
3
[]
no_license
import unittest import binascii from codec.codec import Codec from codec.jaen import jaen_check jaen = { # JAEN schema for datatypes used in Basic Types tests "meta": {"module": "unittests-BasicTypes"}, "types": [ ["t_bool", "Boolean", [], ""], ["t_int", "Integer", [], ""], ...
true
4a7051121defa87bd6e4d519cfe021b04d6cded3
Ronaknowal/LHD
/Day 6/Reminder app/main.py
UTF-8
2,051
3.609375
4
[]
no_license
# Importing all the necessary modules from tkinter import * # Adding and Deleting items functions def add_item(entry: Entry, listbox: Listbox): new_task = entry.get() listbox.insert(END, new_task) with open('tasks.txt', 'a') as tasks_list_file: tasks_list_file.write(f'\n{new_task}') def delete_...
true
bde72909147878a265eb00e8c38c1f4175ee09ab
sam-karis/quiz_application
/quiz_app.py
UTF-8
2,926
3.546875
4
[]
no_license
import sys import json import time import os print ("\n WELCOME TO QUIZ APPLICATION \n") print "This application offer various quizzes on different topics you can check down for more information on how to proceed." """ The function prompt the user to choose what he/ she would like the application to do with the app...
true
7b2a9241ff60b0481b4229aea4d0df9e0a230aa7
Sh4yy/P2PVOIP
/Client/puncher.py
UTF-8
729
2.78125
3
[]
no_license
import socket import struct import util class UDPPunch: def __init__(self, addr): """ initialize the puncher :param addr: server's address (IP, PORT) tuple """ self.server_addr = addr self.addresses = dict() def get_addr(self, socket): """ get a...
true
bc26b22e5714d97c62588d627e9c552c4d871b43
n1kk0/katas
/python/test/test_permutations.py
UTF-8
454
2.90625
3
[]
no_license
import unittest from src.permutations import permutations class TestRemoveSmallest(unittest.TestCase): def test_permutations(self): self.assertEqual(sorted(permutations('a')), ['a']) self.assertEqual(sorted(permutations('ab')), ['ab', 'ba']) self.assertEqual( sorted(permutati...
true
f34f0c2430a2d0965c3c3a959efe24a8a927b198
aiemag/python
/fs/get_file_list.py
UTF-8
1,042
3.046875
3
[]
no_license
#!/usr/bin/python3 import os, glob # getting file list def get_file_list(path): return glob.glob(path) def filter_file_list(path, exp, dir_filter): def is_dir(fo): return True if os.path.isdir(fo) else False flist = glob.glob(os.path.join(path, exp)) if dir_filter is None: retur...
true
aff9380aeea47aa1a57fd541637b0a6fe0a45ef7
stosik/coding-challenges
/leet-code/first-recurring-character.py
UTF-8
253
3.15625
3
[]
no_license
def solution(s): hash_table = {} for item in s: if item in hash_table: hash_table[item] += 1 else: hash_table[item] = 1 for item in s: if hash_table[item] > 1: return item return -1 print(solution("leetcode"))
true
9e16b622bd5654a0d077e9632dac680b714336e6
veritastry/Python
/socket/高并发环节/chat/客户端.py
UTF-8
4,393
2.59375
3
[]
no_license
# import socket # # sk=socket.socket() # sk.connect(('127.1.1.1',8080)) # while True: # msg=input('输入:') # sk.send(msg.encode('utf-8')) # print('已经发送') # data=sk.recv(1024) # print(data.decode('utf-8')) # import socket # # sk=socket.socket() # sk.connect(('127.1.1.1',808...
true
e3414672b055e58e4a92b3baac1adf99967c2afb
PriscylaSantos/estudosPython
/TutorialPoint/05 - Numbers/1 - Mathematical Functions/11 - pow()_method.py
UTF-8
341
4.09375
4
[]
no_license
#!/usr/bin/python3 #The value of x**y # import math # math.pow(x,y) import math # This will import math module a = 10 b = 2 c = math.pow(a,b) print(c) print ("math.pow(100, 2) : ", math.pow(100, 2)) print ("math.pow(100, -2) : ", math.pow(100, -2)) print ("math.pow(2, 4) : ", math.pow(2, 4)) print ("math.pow(3, 0) ...
true
d0d54e32a1d13d3ba1ccaeaf115a94b3e7be4074
isheldon/bbxclient
/lomotimeclient.py
UTF-8
2,057
2.640625
3
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- import wxversion wxversion.select("2.8") import wx, os, requests from webkit_gtk import WKHtmlWindow as HtmlWindow class HtmlPanel(wx.Panel): def __init__(self, parent): wx.Panel.__init__(self, parent) self.html = HtmlWindow(self, size=(1910, 1080)) ...
true
540b2edf61917f1740c89c01eb9f73b388dba2fa
2e0byo/extract-chant
/line_splitter.py
UTF-8
3,574
3
3
[ "MIT" ]
permissive
# based on code from # https://stackoverflow.com/questions/34981144/split-text-lines-in-scanned-document import cv2 import numpy as np white_bleed = (.5, .5) # percentage of white to add to selection (above,below) min_white = 20 # minimum length of white pixels def read_image(fname): """Read image and return i...
true
76ce5a49099d807444de70ea692e29bf449ab6d9
deinoo/python
/flyNerd/zad8_03.py
UTF-8
675
4.8125
5
[]
no_license
# Create a simple guessing game. The computer randomizes a value between 1-30. # Ask the user to guess the number. # The program asks the user to enter the number until the player guesses. # Player should receive information whether provided number is too big or too small. import random x = random.randint(0,30) prin...
true
920ac1061d14d1fef231a84226cc49f34d02eb55
Aasthaengg/IBMdataset
/Python_codes/p03038/s716572798.py
UTF-8
338
2.703125
3
[]
no_license
n, m =map(int,input().split()) A = list(map(int,input().split())) BC = [tuple(map(int,input().split()))for i in range(m)] A.sort() BC.sort(key= lambda x : -x[1]) i = 0 for b, c in BC: for _ in range(b): if c <= A[i] : break A[i] = c i += 1 if i >= n: break else:continue b...
true
802dc7481f1ad6ae4d3ff479ebf0c6501766b91c
joecummings/epi
/ch6/6dot5.py
UTF-8
352
3.4375
3
[]
no_license
def delete_duplicates(sorted_arr: list) -> list: if len(sorted_arr) == 0: return 0 curr = 1 for i in range(1, len(sorted_arr)-1): if sorted_arr[curr - 1] != sorted_arr[i]: curr += 1 sorted_arr[curr] = sorted_arr[i] return curr assert delete_duplicate...
true
223f39ac0fe93d4057937b078bdc7d49cc7bbbed
Jean-carje/CodeWars-Practice
/python/6_kyu/Unique_In_Order.py
UTF-8
467
3.59375
4
[]
no_license
# kata: # https://www.codewars.com/kata/54e6533c92449cc251001667/train/python # -------------------------------------------------- # Solution: def unique_in_order(iterable): res = [] if iterable: res.append(iterable[0]) for i in iterable: if res[-1] != i: res.append(...
true
a661935a5551280b56c0681a24318b48e2bf2bda
sandysuehe/LintCode-Learning
/Algorithms/StringProcess/first-unique-character-in-a-string.py
UTF-8
757
3.4375
3
[]
no_license
def firstUniqChar(s): #!/usr/bin/env python #-*- coding: utf-8 -*- # Author: (sandysuehe@gmail.com) ######################################################################### # Created Time: 2018-08-22 13:11:51 # File Name: first-unique-character-in-a-string.py # Description: 第一个只出现一次的字符 # LintCode: https://www.lintcode...
true
b2bfd87b40e7706e44e268ff307499595e1f0cde
zemengzhoushang/Breakeven_volatility
/SABR.py
UTF-8
3,207
3.0625
3
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Feb 18 14:33:26 2020 @author: air """ import numpy as np from scipy.optimize import curve_fit def SABR_market_vol(K,f,t_exp,alpha,beta,nu,rho): '''Given a list of strike prices and SABR parameters, returns what the SABR model predicts the ma...
true
e3b6abe9e4db6bbd06dda2ab69d98bf5dcb4d1c0
incerto-crypto/solitude
/solitude/_commandline/color_util.py
UTF-8
1,656
2.609375
3
[ "BSD-3-Clause" ]
permissive
# Copyright (c) 2019, Solitude Developers # # This source code is licensed under the BSD-3-Clause license found in the # COPYING file in the root directory of this source tree import colorama from colorama import Style, Fore, Back from solitude._internal.oi_common_objects import ColorText COLOR_MAP = { "black": ...
true
e97804ba4aaae645534ba2451cd46449ffe6f6a5
baby313/dnn
/net/network.py
UTF-8
517
2.734375
3
[]
no_license
from common import config class Network(): def __init__(self): self.layers = [] def add(self, layer, prev=None): self.layers.append(layer) if prev != None: layer.connected(prev) def forward(self): for l in self.layers[:-1]: l.forward() def backward(self): for l in self.layers[:0:-1]: ...
true
7eb8a39775a87e8a038ef7238bdb665940416f9c
tmu-nlp/100knock2020
/kiyuna/chapter01/knock06.py
UTF-8
1,430
3.34375
3
[]
no_license
r"""knock06.py 06. 集合 “paraparaparadise”と”paragraph”に含まれる文字bi-gramの集合を, それぞれ, XとYとして求め,XとYの和集合,積集合,差集合を求めよ. さらに,’se’というbi-gramがXおよびYに含まれるかどうかを調べよ. [URL] https://nlp100.github.io/ja/ch01.html#06-集合 [Ref] - set - https://docs.python.org/ja/3/library/stdtypes.html#set [Usage] python knock06.py """ import os import ...
true
6ecfb976d8731ebbbf2166e036703923afb17f02
daniel-reich/ubiquitous-fiesta
/jdJ5HYuhmrr89nhkB_24.py
UTF-8
39
2.578125
3
[]
no_license
def adds_n(n): return lambda x:x+n
true
979cd19b287bb4d467b52f14b7b73c3dbbd0ce9f
Faribairany/Homogenous-multilayer-Network-Graph-
/cosine.py
UTF-8
1,305
3.375
3
[]
no_license
import string from sklearn.metrics.pairwise import cosine_similarity from sklearn.feature_extraction.text import CountVectorizer from nltk.corpus import stopwords #for calculating the cosine similarity of two vectors where both the vectors are string def cosine_similarity_string_value(vec1,vec2,thresho...
true
40fa6a3408e7ff35925f536564028ccac98f0a03
Azerrroth/dbgaokao-2019
/test3.py
UTF-8
948
2.578125
3
[]
no_license
from PyQt5 import QtCore, QtGui, QtWidgets, QtSql import sys #连接到数据库 def connectDB(HostName,DbName, UserName, PassWord ): db = QtSql.QSqlDatabase.addDatabase('QMYSQL') db.setHostName(HostName) db.setDatabaseName(DbName) db.setUserName(UserName) db.setPassword(PassWord) db.setPort(3306) # 端口号 ...
true
7270ca97ab6afe7fad5619e575a2b6b54fc9c091
priyareena/helo
/sumnumber.py
UTF-8
89
3.140625
3
[]
no_license
s=int(input('enter the number:')) p=int(input('enter the 2 number:')) sum=s+p print(sum)
true
3c9e780cbbe2b1fb55397ff189ec933469f2311e
Messhias/python-codes
/4.13.py
UTF-8
266
3.203125
3
[]
no_license
buffet_lists = ("camarão","frango","risoto") print("Restaurants lists") for buffet_lists in buffet_lists: print(buffet_lists) buffet_lists = ("Prato novo","guisado","lol") print("\n New restaurants lists") for buffet_lists in buffet_lists: print(buffet_lists)
true
a2d6a271658da7daa6ec64474723ad624541d310
h-yaroslav/pysnippets
/ip_range2cidr.py
UTF-8
620
2.96875
3
[]
no_license
def ip_range2cidr(start, end): """ Convert an ip range to a cidr. """ stack = [] while True: h = 1 p = 0 x = start^end while x: x >>= 1 h <<= 1 p += 1 if end - start + 1 == h: yield (start, 32 - p) i...
true
0ffc3b83434b6588593eef05d1e13fba867c7044
benoit-girard/birdsong
/architecture/components/esn.py
UTF-8
5,671
2.59375
3
[]
no_license
from __future__ import print_function import numpy as np from scipy.sparse import lil_matrix from scipy.special import expit class ESN: def __init__(self, reservoir_size=100, inputs=2, outputs=1, generate_time_sequence=False, inp...
true
c7eeac55b914f5597801436fc6ac7a6ac50013ee
MeganStalker/Advanced_Practical_Chemistry_Year_3_2021
/Week_2/MSD.py
UTF-8
5,698
2.921875
3
[ "MIT" ]
permissive
import numpy as np import matplotlib.pyplot as plt import os as os from scipy import stats from scipy.constants import codata def read_history(file, atom): ''' ReadHistory - Read a DL_POLY HISTORY file Parameters ---------- file : HISTORY filename : String atom : At...
true
2c2ce9573a7382338f7b73fde271c3c6c0e9c9d5
sergiotrivino/Calculo_salario-
/calculoSalario.py
UTF-8
736
3.984375
4
[]
no_license
# A un trabajador le pagan según sus horas trabajadas por una tarifa de pago por hora. # Si la cantidad de horas trabajadas es mayor 40 horas. # La tarifa se incrementa en un 50% para las # horas extras. Calcular el salario del trabajador dadas las horas trabajadas y # la tarifa ingresadas por el usuario. def calcu...
true
ef0d30c23d85854430f9ec4aae3ec00074fe7f6f
LouisYZK/recruitKG
/recommend/trans_pkl.py
UTF-8
1,655
2.59375
3
[ "MIT" ]
permissive
import json import pickle from collections import defaultdict def initialize(): """prepare the position info and vector. """ with open('entityVector_100_0.001.pkl', 'rb') as fp: entity_vec = pickle.load(fp) with open('relationVector_100_0.001.pkl', 'rb') as fp: relation_vec =pickle.load...
true
44719f933a7b5384c278b8582b865d3dccba46e4
tegamax/ProjectCode
/Common_Questions/TextBookQuestions/PythonCrashCourse/Chapter_8/8_12.py
UTF-8
684
4.40625
4
[ "MIT" ]
permissive
''' 8-12. Sandwiches: Write a function that accepts a list of items a person wants on a sandwich. The function should have one parameter that collects as many items as the function call provides, and it should print a summary of the sandwich that’s being ordered. Call the function three times, using a different number ...
true
c8d48a8a4ea51dd48c7c05fb9986fee345d95f70
bcody/doaj
/doajtest/unit/test_snapshot.py
UTF-8
1,884
2.53125
3
[ "Apache-2.0" ]
permissive
from doajtest.helpers import DoajTestCase from portality import models import time class TestSnapshot(DoajTestCase): def setUp(self): super(TestSnapshot, self).setUp() def tearDown(self): super(TestSnapshot, self).tearDown() def test_01_snapshot(self): # make ourselves an exa...
true
23f693fbd4efd719c31543b0b53862ba3a842a2a
Dev-SumitPatil/SumitPatil
/Python/Problem-8/robot_and_charger.py
UTF-8
336
3.34375
3
[]
no_license
import math n=int(input()) robot_move=[] x=0 y=0 for robot in range(n): direction,magnitude=input().split() if direction=='UP': y=y+int(magnitude) if direction=='DOWN': y=y-int(magnitude) if direction=='RIGHT': x=x+int(magnitude) if direction=='LEFT': x=x-int(magnitude) print(round(math.sqrt(x...
true
c94bd3fe43ff485c158792b9187986978999fc46
nicholasplachance/python_text_rpg
/text-rpg.py
UTF-8
8,662
2.984375
3
[]
no_license
import cmd import textwrap import sys import os import time import random ### global variables ### SCREEN_WIDTH = 100 ### player setup ### class player: def __init__(self): self.name = '' self.role = '' self.hp = 0 self.mana = 0 self.inventory = [] self.location =...
true
7fa84f0587a093e86fe14be60c4ca68afc8e78e1
raulhernandez1991/Codewars-HackerRank-LeetCode-CoderBite-freeCodeCamp
/Codewars/Python/7 kyu/III/Alternate case.py
UTF-8
273
3.71875
4
[]
no_license
def alternateCase(s): resp = '' for c in s: c = c.lower() if c.isupper() else c.upper() resp+=c return resp def alternateCase_up(s): return s.swapcase() print(alternateCase('ABC')) print(alternateCase('AbC')) print(alternateCase_up('AbC'))
true
4b22f6d7d3475b7b786107829244c02e92be74fe
shuvava/python_algorithms
/ProbabilisticDataStructures/membership/quitienting-filter/test_main.py
UTF-8
2,700
2.578125
3
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- import unittest from random import Random from main import QuotientFilter from mock_hash_fn import hash_fn, mock class TestQuotientFilter(unittest.TestCase): def setUp(self): pass def test_init(self): b = QuotientFilter(3, 10, hash_fn) sel...
true
de7acb5b1496b195d43f435a66ab3dd06fb350b6
johnpaulkiser/cbTrades
/cbTrades/selector.py
UTF-8
2,184
2.9375
3
[]
no_license
''' class used to wrap AuthenticatedClient sets currency and buy/sell spreds and price of orders ''' import cbpro import time from testclient import TestClient from auth import Account class Selector: def __init__(self, profit, bdi, pair, trade_amount): #profit, bdi == float # change TestClient to cbpro...
true
e601aaa155b236330733adacf4ede310c962a350
waynewu6250/My-Sample-Projects
/4.CV/cellspectra/model/attention.py
UTF-8
5,014
2.546875
3
[]
no_license
from time import time import numpy as np import keras.backend as K from keras.engine.topology import Layer, InputSpec from keras.layers import Input, Conv1D, MaxPool1D, Flatten, UpSampling1D, BatchNormalization, LSTM, RepeatVector, Lambda, Dense, Activation, Reshape from keras.models import Model, load_model from skle...
true
4fca73fb72d1b1dd0c52975a6a4ee0cb1e1b6f3e
cshall13/shooter_game
/player.py
UTF-8
485
3.5625
4
[]
no_license
# Include pygame again, because this is a different file import pygame class Player(object): # Classes have 2 parts... # 1. Attr # 2. Methods # Init attr with __init__ def __init__(self, screen): self.image = pygame.image.load('./images/Hero.png') # resize the image... self.image = pygame.transform.scale(se...
true
3e8f03c543e588e4c6168d1e8a0b9ec833ecf03b
jimpei8989/MLF_18Fall
/HW4/Coursera/Prob20.py
UTF-8
820
2.625
3
[]
no_license
import numpy as np import matplotlib.pyplot as plt def readData(filename): data = np.loadtxt(filename) r, c = data.shape X = np.concatenate((np.ones((r, 1)), data[:, : -1]), axis = 1) Y = data[:, -1:] return X, Y def GradientEin(w, X, Y): theta = Theta(-Y * np.dot(X, w)) return -1 * (Y * X...
true
a938de30e7d11be3ec33f06e9329885add3fab90
VincentMatthys/Sub-pixel-Imaging
/project/srcs/img_tools.py
UTF-8
1,198
3.078125
3
[]
no_license
import numpy as np from numpy.fft import fft2, ifft2 def per_smooth_decomposition(u): """ Periodic plus Smooth Image Decomposition Adapted from matlab implementation of Lionel Moisan available here http://www.mi.parisdescartes.fr/~moisan/p+s ---------------------------------------------------------...
true
2a06788841f413dfd43bc76b3961090c5ad560df
queengorga/shiny-computing-machine
/tuples.py
UTF-8
56
2.859375
3
[]
no_license
t = ("Hola!", 2, 5.7, "Marhaba", "Bonjour") print(t[-1])
true
f0f2afbc3b81873c787142bc945ebb6e5aacf7ba
nicoledjy/deml-lab
/assignment2/task4.py
UTF-8
889
2.59375
3
[]
no_license
from sklearn.datasets import make_regression from components.mapreduce import MapReduceEngine from components.linear_regression import f_m, f_r, result_key from utils import to_partitions import numpy as np # Generate an artifical regression problem X, y = make_regression(n_samples=100, n_features=5, random_state=42) ...
true
23ed971e726ee897d0c94eb08845f6cb7a322705
ki4yvc/spims
/api/submitform.py
UTF-8
541
2.625
3
[]
no_license
#!/usr/bin/python3 import api import json reqData = api.getRequestData() body = json.loads(reqData["body"]) api.printHeaders(None, "json", True) response = {"success": None, "message": None} # Do validation and all that jazz # The rest assumes everything worked response["success"] = True action = body["action"] verb...
true
d99b67e7d904e3b6ac4481f19aab1d5550d041de
turbana/imus
/imus/twisted_email_hack.py
UTF-8
1,910
2.640625
3
[]
no_license
""" Ugh. When we send email notifications it's near the end of the crawler's life-cycle after all scraping and processing has occurred. Because scrapy uses twisted the mail handler creates a Defered to send the mail. Somehow the twisted reactor (main loop) closes down before all the mail Defered's have processed, caus...
true
6928c549f22c1340e6232a4bf3356371c3b23b94
Nirvanabc/seminar
/hw_4_hyperparam_log_reg.py
UTF-8
4,119
2.65625
3
[]
no_license
import pandas as pd from hyperopt import hp, fmin, pyll, tpe from sklearn.metrics import f1_score from hw_4_log_reg import * from sklearn.metrics import roc_auc_score from sklearn.model_selection import cross_val_score import hw_4_preprocessing_log_reg as preprocessing from hw_4_header_log_reg import * ### evaluating...
true
4c251f926fc7b722c51aa4a58029030ca49aa8e2
DavorPenzar/tablic
/io_igrac.py
UTF-8
14,392
3.09375
3
[]
no_license
# -*- coding: utf-8 -*- """ Implementacija klase IOIgrac za stdin/stdout igraca igre tablic. """ import copy import math import six from skupovi import partitivniSkup, unijeDisjunktnih from karta import Karta from engine import Tablic from pohlepni_igrac import PohlepniIgrac if six.PY3: unicode = str class IO...
true
6f4b8483dc1f04f23117d57cd73223cd77728f6c
predigame/predigame
/predigame/Actor.py
UTF-8
12,460
2.578125
3
[ "Apache-2.0" ]
permissive
import sys, random, math, pygame from time import time from .Sprite import Sprite from .constants import * from .Globals import Globals from .utils import at, get, is_wall, get_animation from .Inventory import * from functools import partial # actor class for four directional movement class Actor(Sprite): MAX_WEAL...
true
a8c9a9a80cbd6ffb7b207aaadc4ea3fbc295ce0f
m2tkl/PySniT
/src/pysnit/pysnitlib/vscode.py
UTF-8
1,349
2.953125
3
[ "MIT" ]
permissive
import os import json def get_vscode_snippet_dirpath() -> str: """Get a path of vscode snippet directory. :return vscode_snippet_dir: a path of vscode snippet directory """ homedir = os.environ['HOME'] vscode_snippet_dir = homedir + '/Library/Application Support/Code/User/snippets/' return vsc...
true
c2ef8fcd60f1f8f4c5c7a470a5530ae7ff70d910
pandeymahendra/python_snippets
/Corey_Scafer/OOP_Concepts/1_Classes.py
UTF-8
1,728
4.1875
4
[]
no_license
# Python OOP Concepts class Employee(): raise_amount = 1.02 # Class Variable num_of_emps = 0 def __init__(self, first, last, pay): self.first = first self.last = last self.pay = pay self.email = first + '.' + last + '@' + 'example.com' Employee.num_of_emps += 1...
true
582f5e7ac9da97c4d470a308f657fee01386dc5f
wolfog/leetcode_learning
/stack/lawful_brackets.py
UTF-8
1,331
3.90625
4
[]
no_license
''' @Author: rudy @Date: 2020-06-01 17:24:52 @LastEditTime: 2020-06-02 09:27:32 @Description: 给定一个只包括 '(',')','{','}','[',']' 的字符串,判断字符串是否有效。 有效字符串需满足: 1. 左括号必须用相同类型的右括号闭合。 2. 左括号必须以正确的顺序闭合。 注意空字符串可被认为是有效字符串。 @viewpoint: :使用栈实现,如果遇见小,中,大括号的结尾括号,就判断栈顶是否是对应的开始括号。如果是则出栈,否则直接结束。 ''' class Lawful_...
true
160ac6acb9c88d29547f58bf40dae556d250fe13
anonymous2101/PGMExplainer
/PGM_Graph/view_explanation.py
UTF-8
6,531
2.78125
3
[]
no_license
import argparse import numpy as np import pandas as pd import matplotlib matplotlib.use('agg') import matplotlib.pyplot as plt def arg_parse(): parser = argparse.ArgumentParser(description="PGM Explainer arguments.") parser.add_argument( "--index", dest="index", type=int, help="Index of explanation...
true