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
54e8c7bb46c8cd344b10edfee8d49b28ed696479
pratyush-02/spoj-solution
/ud.py
UTF-8
174
2.9375
3
[]
no_license
import sys def main(): while(1): a=raw_input() b=a.split(' ') p=int(b[0]) q=int(b[1]) if p==0 and q==0: return print pow(p,q) if __name__=='__main__': main()
true
51fb5c59cb14091b947e8d820ce7097a6993d57b
mayerja1/personal_miniprojects
/dfa/dfa.py
UTF-8
1,417
3.453125
3
[]
no_license
class DFA: def __init__(self, Q, alphabet, transition_func, q0, F): self.Q = Q self.alphabet = alphabet self.transition_func = transition_func self.q0 = q0 self.F = F def process_word(self, w): cur_state = self.q0 path = [cur_state] for c in w: ...
true
1bcc594b556faa71cde2b525e7df9a4bcd878461
HOZH/leetCode
/leetCodePython/645.set-mismatch.py
UTF-8
385
2.640625
3
[]
no_license
# # @lc app=leetcode id=645 lang=python3 # # [645] Set Mismatch # class Solution: def findErrorNums(self, nums: List[int]) -> List[int]: current_set = set() dup = -1 for i in nums: if i in current_set: dup = i current_set.add(i) return...
true
3410080f3b54b42adc2f6aa77f26e51b878c13cf
andreferreira-me/udacity-intro-to-computer-science
/lesson-02-how-to-repeat.py
UTF-8
5,647
4.25
4
[]
no_license
# Define a procedure, square, that takes one number # as its input, and returns the square of that # number (result of multiplying # the number by itself). # To help you out, the code for sum(a,b) is below. def sum(a,b): c = a + b return c def square(a): return a * a # To test your procedure, uncomment t...
true
64934348654cf79f39fefbde09d926c528e2aeed
wfields1/MIS3545
/Classes/session1.py
UTF-8
152
3.578125
4
[]
no_license
a = ((42*60)+42) print(a) print('The total number of seconds in 42 minutes and 42 seconds is', (a)) b = (10/1.61) print(b) time = (a/60) print(time)
true
569cd30ddabdd31ec6318c9231ccbe4ecc0ca872
humanphysiologylab/pypoptim_old
/src/pypoptim/timer.py
UTF-8
714
3.265625
3
[]
no_license
import time class Timer: def __init__(self): self.times = dict() self.total = None def start(self, name) -> None: self.times[name] = -time.time() def end(self, name) -> None: self.times[name] += time.time() def report(self, sort=False) -> str: total = sum(se...
true
7e2c905a65ca6834ad71c5dbdd0282a21aad3d08
aliaxandra/cs50-project-finance
/application.py
UTF-8
11,236
2.53125
3
[]
no_license
import os import time import re from cs50 import SQL from flask import Flask, flash, jsonify, redirect, render_template, request, session from flask_session import Session from tempfile import mkdtemp from werkzeug.exceptions import default_exceptions, HTTPException, InternalServerError from werkzeug.security import c...
true
477deb368a9e60d574d811e030ad686d064e313c
Nayre98/ACTIVIDAD3_UNIDAD1
/Fourier2.py
UTF-8
3,270
2.890625
3
[]
no_license
from Ipython.display import Image import numpy as np from scipy import integrate import matplotlib.pyplot as plt import scipy as sp import sympy as sym #%matplotlib inline image(filename= 'assets/seriesfourier.jpg') n = sym.symbol('n') t = sym.symbol('t') tmin = 0 tmax=2*np.pi t.tmax-tmin w = 2*np.pi/T # ft es una ...
true
843ffc2b68403819e6dee67d8088703e326d4e84
PWDAVENPORTJENKINS/GMM
/GMM.py
UTF-8
4,915
2.921875
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Mon May 20 12:45:18 2019 P. W. Davenport-Jenkins Charlie Reynolds is a gimp University of Manchester MSc Econometrics N.B. Python 3.5+ is required """ from numba import jit import scipy.stats as stats import scipy.optimize as optimize import numpy as np NO_PMC = 10 # An m ve...
true
ecb7da31e0c0bfda23b61beef3cba408ce55b1ee
wzy-hb/python
/1.py
UTF-8
62
2.859375
3
[]
no_license
#! /usr/bin/env python3 i=1 while i>0: print(i) i+=1
true
8e16825ce62ec895694bacea35fcfde3c0aa3188
SylvainGervais/DA-Projet-3
/labyrinth.py
UTF-8
2,099
3.625
4
[]
no_license
import json import random import config class Labyrinth: def __init__(self, map): """initialyze labyrinth from file""" self.load(map) def load(self, mapFile): """load a json file in Labyrinth object""" try: with open(mapFile, "r") as f: self.map = ...
true
e97f5bb4b16ef6ebee515dac13e2476ffa173574
evogchem211/AntipyreticSynergyGrphRegres
/Ecoli_AcetaminophenvBenzocaine.py
UTF-8
1,764
3.109375
3
[]
no_license
#!/usr/bin/env python # coding: utf-8 # In[6]: import numpy as np import matplotlib.pyplot as plt from sklearn.linear_model import LinearRegression # In[7]: yesBEN =[] yesACE = [] for i in range(5): yesBEN.append(0.025) for i in range(5): yesBEN.append(0.05) for i in range(5): yesBEN.append(0.1) fo...
true
dcee100df2ce620dc51ecd0dfd012a38b7c73b38
Anaph/Image_Segmentation
/utilities/CV_image_markup.py
UTF-8
5,156
2.734375
3
[]
no_license
import cv2 import numpy as np from motion_detector.detector import MotionDetector import pandas as pd import sys, getopt # Masking function by rectangles def mask(img,polygons): mask = np.zeros_like(img) for color, polygon in polygons: cv2.fillPoly(mask, np.array([polygon], dtype=np.int64), color=col...
true
af427f237f036321b1418deea50c746a8f544266
Manoj-Angane/Data-Analysis-for-FPL
/P1_P2.py
UTF-8
783
2.5625
3
[]
no_license
import pandas as pd import os import csv os.chdir('D:/Python/Data_Analysis/venv/History') a=pd.read_json('result_p2.json',orient='columns',typ = 'series') dict_=dict() if os.path.isfile('list.txt'): os.remove('list.txt') for y in a.keys(): try: x=pd.DataFrame.from_dict(a[y], orient='columns', ...
true
1d541f43402f0d6e2511994e0d23c9f6855f7933
vietvudanh/Actual-Sector-Count
/temp.py
UTF-8
985
2.609375
3
[]
no_license
import pandas as pd DF1 = pd.DataFrame([['FLT01', 0, 00, 10, 'T01'], ['FLT01', 0, 15, 25, 'T02'], ['FLT02', 0, 30, 40, 'S01'], ['FLT02', 0, 45, 55, 'S02'], ['FLT03', 0, 60, 70, 'A01'], ['FLT03', 0, 75, 85, 'A02']], ...
true
dcc66dc1b6e442256ff6794cb9cbee18fdb38026
DanielFranquiz/raspberypi4-smarthome
/display.py
UTF-8
1,358
2.765625
3
[]
no_license
#libraries import time import proximity import Adafruit_GPIO.SPI as SPI import Adafruit_SSD1306 from PIL import Image from PIL import ImageDraw from PIL import ImageFont import subprocess RST = 0 disp = Adafruit_SSD1306.SSD1306_128_64(rst=RST) disp.begin() #Initialize the library disp.clear() #clear display d...
true
90b9170cebc009c07c74efc5a614e57f5fd5060a
trongphuongpro/TimeAssistant
/audio.py
UTF-8
391
2.59375
3
[]
no_license
from gtts import gTTS from io import BytesIO import pygame import pygame.mixer as audio audio.init() def say(text, language='en'): fp = BytesIO() tts = gTTS(text, lang=language) tts.write_to_fp(fp) fp.seek(0) audio.music.load(fp) audio.music.play() while audio.music.get_busy(): pygame.time.Clock().tick(1...
true
af6027dbdc91a64d833ae5ede5e1a090007710dc
Thousandhack/fastapi_blog
/app/models/user.py
UTF-8
1,425
2.515625
3
[]
no_license
from peewee import Model, CharField, UUIDField, DateTimeField, IntegerField from passlib.context import CryptContext from app.db.database import database from uuid import uuid4 import datetime pwd_context = CryptContext(schemes=["bcrypt"], deprecated="auto") class User(Model): """ 用户信息表: """ uuid = U...
true
a1c2bff3bf8c02a1f6acb740b064b1d60af0231a
sanket789/1D-Spin-Lattices
/examples/XXZ_edge_driven.py
UTF-8
11,727
2.890625
3
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- """ A demonstration of simulating open system dynamics by sampling over randomized pure state trajectories. This simulates the dynamics of an edge-driven XXZ chain, which has an analytic solution for lam = 1.0, eps = 2.0. See: T. Prosen, Phys. Rev. Lett. 107, 137201 (2011)...
true
06558a573c8297d25b58add67808390737d11068
ridhimainukurti/Classwork
/minilab/sriya.py
UTF-8
1,542
4
4
[]
no_license
class Factorial: """Initializer of class takes series parameter and returns Class Objectg""" def __init__(self, series): """Built in validation and exception""" if series < 0: raise ValueError("Factorial doesn't exist for negative numbers!") self._series = series self...
true
b0f8bf41d73e510e4a63a0333b2f02ef6eace566
Wendlereis/machine-learning-py
/images-aula-2/intro-cv.py
UTF-8
998
3.09375
3
[]
no_license
import cv2 import matplotlib.pyplot as plt img = cv2.imread('pizza.jpg') plt.imshow(img[:,:,::-1]) plt.xticks([]), plt.yticks([]) plt.show() # Mostra o valor [B, G, R] img[0, 0, 0] # Converte para preto e branco imgGray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) plt.imshow(imgGray, cmap='gray') plt.show() # Cria nova ...
true
761717476a6d3ebdf1dd14a5134381064cd0af78
webclinic017/TDXPystock
/TradeDay.py
UTF-8
5,488
2.671875
3
[]
no_license
import tushare as ts import json,datetime import pandas as pd import pymysql from dboprater import DB as db configfile='./config/mysqlconfig.json' class tradeday: def __init__(self): self.pro = ts.pro_api(db.get_config()['tushare']) #将交易日入库,1年执行一次即可 def gettradeday(self): tradedaylist=[] ...
true
974d6add84ab479027b1f74046f8ce9cc0b11f6f
Dkmister/MathSearch
/open_csv.py
UTF-8
267
3.03125
3
[]
no_license
import pandas as pd # Funcao que abre arquivo CSV e retorna lista com nome e link def open_csv_and_return_data(csv_file): df = pd.read_csv(csv_file) video_name = df.Videotitle_link video_link = df.Videotitle_link_link return [video_name,video_link]
true
ab0217180b001cb1bafd8cd8d05166d2044782d4
andela/ah-backend-stark
/authors/apps/profiles/serializers.py
UTF-8
1,170
2.515625
3
[ "BSD-3-Clause" ]
permissive
"""profile app serializer file""" from rest_framework import serializers from .models import Profile, Following class ProfileSerializer(serializers.ModelSerializer): """profile app serializer class""" username = serializers.CharField(source='user.username') bio = serializers.CharField(allow_blank=True, r...
true
6ea8e943280372e8e17d33967781974e07e28a79
KevinCastroP/holbertonschool-interview
/0x03-minimum_operations/0-minoperations.py
UTF-8
664
3.9375
4
[]
no_license
#!/usr/bin/python3 """ Minimum Operations """ def minOperations(n): """ In a text file, there is a single character H. Your text editor can execute only two operations in this file: Copy All and Paste. Given a number n, write a method that calculates the fewest number of operations needed toresul...
true
3b17071e57b9c526e21bcec9bc1709a2bb94d919
RnLe/AP1920-AJRM
/PeP Workshop/exercises-toolbox-5/8-all/354_Gedaempfte_und_erzwungene_Schwingungen/loesung.py
UTF-8
1,499
2.75
3
[]
no_license
import numpy as np import matplotlib.pyplot as plt L, C, R = np.genfromtxt('geraetedaten.txt', unpack=True) L *= 1e-3 C *= 1e-9 nu, arg, Z = np.genfromtxt('impedanz.txt', unpack=True) nu *= 1e3 omega = 2 * np.pi * nu arg = np.deg2rad(arg) x = np.linspace(150e3, 350e3, 1000) Z_theor = np.sqrt(R**2 + (L *...
true
3e0cc7e4a224cd25e2a855d2f86bb5abf8b5f694
mandrewcito/signalrcore
/signalrcore/messages/ping_message.py
UTF-8
403
2.9375
3
[ "MIT" ]
permissive
from .base_message import BaseMessage """ A `Ping` message is a JSON object with the following properties: * `type` - A `Number` with the literal value `6`, indicating that this message is a `Ping`. Example ```json { "type": 6 } ``` """ class PingMessage(BaseMessage): def __init__( ...
true
c00cf5dd8bd4cb14bb7f48fcaa9a58c776f7b3a7
FatNFuri0us/module_in-python
/111_120_moduly_wbudowane.py
UTF-8
1,532
3.34375
3
[]
no_license
# -*- coding: utf-8 -*- # %% 111 import random random.seed(32) techs = ['python', 'java', 'php', 'c++', 'c#', 'javascript'] print(random.sample(population=techs, k=3)) # %% 112 import random random.seed(32) techs = ['python', 'java', 'php', 'c++', 'c#', 'javascript'] random.shuffle(techs) pri...
true
6c54e6e575efc5b5a5b3c97a574a8aebf64a4838
lmj1994/fibonacci
/_fibonacci.py
UTF-8
541
3.71875
4
[]
no_license
def fibonacci(n): return _fibonacci_(n) def _fibonacci_(n): result = 0 if n == 0: result = 1 elif n == 1: result = 1 else: result = _fibonacci_(n - 1) + _fibonacci_(n - 2) return result # N = int(input('please input the N = ')) # print(' the #%d fibonacci number is : ...
true
e4eafb1ab624b2e3fa38c832df5767f2b8145eab
ariesduanmu/ctf_challenges
/others/compress/bitmap_compress.py
UTF-8
916
3.171875
3
[]
no_license
# -*- coding: utf-8 -*- from dumps import binary_dump def compress(data): c = "0" l = 0 d = [] for i in range(len(data)): b = data[i] if b == c: l += 1 else: c = b d += [l] l = 1 if i == len(data) - 1: d += [l] ...
true
1ecc43a4f80022f35586ac5b7ef8ab037074ef18
Eventhisone/RacquetScraper
/test/scrape.py
UTF-8
1,712
3.140625
3
[]
no_license
from bs4 import BeautifulSoup import os def scrape(patternFile, outputFile, manufacturer): """Scrape Racquet specs from patternfile and save them in outputFile""" racquetDataFile = open(outputFile, "w") patternHTML = open(patternFile, 'r') soup = BeautifulSoup(patternHTML, 'html.parser') dat...
true
c74dd7d09af64eb104afc58ec7c6ccd561c9d858
AdamZhouSE/pythonHomework
/Code/CodeRecords/2677/60764/246643.py
UTF-8
235
2.953125
3
[]
no_license
T=int(input()) for t in range(T): n=int(input()) nums=list(map(int,input().split())) pairs=0 for i in range(n-1): for j in range(i+1,n): if nums[i]==nums[j]: pairs+=1 print(pairs)
true
aa63a41d95152c9b2cd3a1d10216478061ee11e6
jesseherwig/UAV_Research
/venv/target_detection_no_flight.py
UTF-8
2,499
2.640625
3
[]
no_license
import cv2 import numpy as np camera_width = 640 camera_height = 480 def find_target(): target_found = False arucoDict = cv2.aruco.Dictionary_get(cv2.aruco.DICT_4X4_250) arucoParams = cv2.aruco.DetectorParameters_create() cap = cv2.VideoCapture(2) print('Start Search') lastFound = 0 while ...
true
847aba1d9f7e6a30f9b755f42af773142c1b5c25
bromjiri/Presto
/crawler/fixer/twitter_fix_new.py
UTF-8
2,423
2.75
3
[ "MIT" ]
permissive
# fix newlines import settings import os def fix_file(year, month, day, subject): output_file_path = settings.DOWNLOADS_TWITTER_FINAL + "/" + subject + "/twitter-" + subject + "-" + year + "-" + month + "-" + day + "-fix.csv" dir = os.path.dirname(os.path.realpath(output_file_path)) os.makedirs(dir, exist...
true
836f3e11ee5352d1c7f512a97009731483422e23
enigma972/Cryptographic-Algorithms
/Python/DES/DES_rosser.py
UTF-8
9,425
3.03125
3
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- ''' Classe permettant le chiffrement selon l'algo. DES @author: mathieu.rosser ''' class DES(): def __init__(self, message, cle): # entrées self.message = DES.versBinaire(message, 64) self.K = DES.versBinaire(cle, 64) ...
true
12d99ba6afc59245dd9bb373137cdd8d8df00118
Aasthaengg/IBMdataset
/Python_codes/p02796/s118059754.py
UTF-8
1,178
3.484375
3
[]
no_license
def resolve(): """ 典型的な区間スケジューリング問題 各スケジュールの終了時間が短いものから選択していけば, 選択するスケジュール数が最大になる. 今回は腕の可動範囲上限の小さいものから選択していく. """ import sys readline = sys.stdin.readline N = int(readline()) XL = [list(map(int, readline().split())) for _ in [0] * N] # 腕の可動範囲の(上限, 下限)のリスト生成 t = [(x...
true
5508d0cc2eb30ac3f79848928766131a5110c7c9
viethien/misc
/song.py
UTF-8
2,354
3.75
4
[]
no_license
#!/usr/bin/python3 #Author: Justin Reid #CSC 110 section: 1b #Homework 1 08/24/2016 #Objective: Print the vereses from "There was an old woman who swallowed a fly"#Without using print statements in the main function and eleminating as many #redundancies as possible. def main(): swallowed_a_fly() i_dont_know_why()...
true
416810278fddf55eda301a85b5c16c377c52e626
marwanatef2/Data-Structures-Project
/Grappph/Graphhhh.py
UTF-8
1,067
2.84375
3
[]
no_license
import networkx as nx import matplotlib.pyplot as plt from itertools import zip_longest FileName1 = "undirected.txt" # insert filename which contains nodes & edges FileName2 = "centralityOutput.txt" # insert filename which contain centrality G = nx.read_edgelist(FileName1, create_using=nx.Graph(), nodetype=int) #d = ...
true
61960ae1820c7aea0dbcfcabbf106b4e186837e1
ajcestrada02/genQ
/NewScratch.py
UTF-8
5,201
2.671875
3
[]
no_license
#Importing packages for generate from nltk import * from nltk.tokenize import RegexpTokenizer, MWETokenizer from stop_words import get_stop_words from nltk.stem.porter import PorterStemmer from gensim import corpora, models import gensim from pdfminer.pdfinterp import PDFResourceManager, PDFPageInterpreter#process_pdf ...
true
115c7a5d8e8a714d7f2c7e6cb585847e72a80102
Manas-nighrunkar/PPL_ASSGNS-PROJECT
/assignment1/4.py
UTF-8
546
3.625
4
[]
no_license
import random as r while(1): print("Start game[1/0]") i = int(input()) if(i == 0): break elif(i == 1): print("enter the range") x = int(input()) num = r.randint(1,x) print("you have 5 chance to guess") for k in range(1, 6): j = int(input()) if(j != num and k == 5): print('you lose... number wa...
true
9c6cbc0224488427353d9cf15a54a6de4daf5a08
matheuspolachini/streamable-python
/streamable/cli.py
UTF-8
2,752
2.875
3
[ "MIT" ]
permissive
#!/usr/bin/env python3 """ streamable - command line utility for interacting with streamable.com """ import sys import os.path import argparse import pyperclip from getpass import getpass if sys.version_info >= (3, 8): from importlib import metadata else: import importlib_metadata as metadata from streamabl...
true
140435eb109ef78eda659516e33b4f7c7bed4d5d
erikhansen816/Unit-3
/dotsDemo.py
UTF-8
222
2.671875
3
[]
no_license
#Erik Hansen #10/5/2017 #dotsDemo.py from ggame import * red = Color(0xFF0000,1) dot = CircleAsset(20,LineStyle(1,red),red) for j in range(10): for i in range(20): Sprite(dot,(20 + 50*i, 20 + 50*j)) App().run()
true
102868dd3074d7ca08305c950a0d6151e892047a
k-kondo-s/eight-queen
/engine/simple_engine.py
UTF-8
991
3.28125
3
[]
no_license
from models.model import Board, Engine from utils.util import validate from typing import List from itertools import permutations class SimpleEngine(Engine): def __init__(self, n: int, take_one_solution: bool = True) -> None: self.n: int = n self.results: List[Board] = [] self.take_one_sol...
true
a5520c8b7e7183db233af26620421755b65e0fca
yizhe-ang/vi-lab
/src/models/vaes/mvae.py
UTF-8
6,260
2.609375
3
[ "MIT" ]
permissive
from typing import List, Optional import torch import torch.nn as nn from nflows.distributions import Distribution from nflows.utils import torchutils class MultimodalVAE(nn.Module): def __init__( self, prior: Distribution, approximate_posterior: Distribution, likelihoods: List[Di...
true
c1e59396a162e9b6df278ba6bd7d5a32ebf72305
jtanadi/robofontScripts
/copySidebearings/z-Archive/z-Simple scripts/o_rightSB.py
UTF-8
181
2.515625
3
[]
no_license
f = CurrentFont() gList = [] for gName in f.selection: gList.append (f[gName]) for g in gList: g.rightMargin = f["o"].rightMargin g.mark = (.75, .25, 0, 1)
true
0f04914ae21d7a1ab65168999a86c70d08774e67
chernovsergey/rosalind
/StepicCourse/FrequentWordsWithMismatches.py
UTF-8
1,882
2.90625
3
[]
no_license
__author__ = 'Sergey' import itertools import sys import string def extractData(fname): Names, Strands = [], [] summary_strand = str("") f = open(fname, 'r') for line in f.read().split('\n'): if line.startswith('>'): Names.append(line.replace('>', '')) summar...
true
4e6a824d5a3aec0c75e26cf3cfe752d7f8b3ada0
Faguiloc/Lab2-Seguridad-Informatica
/cifrador.py
UTF-8
1,751
3.28125
3
[]
no_license
import hashlib def lectura(): f= open("mensajedeentrada.txt","r") mensaje=f.read() mensaje = cifrado(mensaje) escritura(mensaje) def rot_n(texto, n): from string import ascii_lowercase as lc, ascii_uppercase as uc conversion = str.maketrans(lc + uc, lc[n:] + lc[:n] + uc[n:] + uc[:n])...
true
019c5ece24f5f12478d66fdaf44ff537ca9948d1
chemistry-scripts/cluster-scripts
/cluster-scripts/computations_setup.py
UTF-8
16,942
2.6875
3
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Helper functions to set up theoretical chemistry computations on computing clusters. Last Update 2020-03-17 by Emmanuel Nicolas email emmanuel.nicolas -at- cea.fr Requires Python3 to be installed. """ import os import shlex import logging import re class Computati...
true
c18366e632d668f1ee6e80bf232b10999fe77ae7
Faethreck/Personal-Projects
/Random small projects/wea del vicho.py
UTF-8
317
3.296875
3
[]
no_license
def filtrar(original, eliminar): lista = [] for i in original: if i not in eliminar: if i in lista: pass elif i not in lista: lista += [i] return lista original = input() eliminar = print(filtrar(original, eliminar))
true
c9eb84bcfc93ab1502dcd5045af2e2ae631a5d85
eclee25/age-spatial-correlation-networks
/scripts/python/graphml_seasonweek_age.py
UTF-8
2,368
2.546875
3
[]
no_license
#!/usr/bin/python ############################################## ###Python template ###Author: Elizabeth Lee ###Date: 10/2/14 ###Function: Export networks as graphml format for import into gephi. Node attributes lat and lng should be included. ###Import data: ###Command Line: python graphml_seasonweek_age.py ######...
true
8fccb3b660b3cce95bc20f8a4e19cf264f6fc01f
bunchesofdonald/django-echo
/echo/tests/test_request.py
UTF-8
2,018
2.53125
3
[ "MIT" ]
permissive
from echo.request import EchoRequest from echo.tests import BaseEchoTestCase class TestEchoRequest(BaseEchoTestCase): def test_launch_request_type(self): """EchoRequest should know when it's received a launch request""" expected = EchoRequest.LAUNCH_REQUEST http_request = self._generate_la...
true
b4df22e1f40c0330d51937370667886a62d0f4f5
vertexangle/advent-of-code-2019
/2019_16_p2.py
UTF-8
431
2.890625
3
[ "MIT" ]
permissive
from aoc import read_file, timer @timer def solve(): input = read_file("16")[0] offset = int(input[:7]) elements = [int(num) for _ in range(10000) for num in input][offset:] for _ in range(100): for i in range(-2, -len(elements)-1, -1): elements[i] = (elements[i] + element...
true
dbd0e58737007870d8a8b9907b368acf63691cb3
DerThorsten/liquidfun
/liquidfun/Box2D/pybox2d/testbed/examples/old/rope.py
UTF-8
3,814
2.515625
3
[ "Zlib" ]
permissive
#!/usr/bin/env python # -*- coding: utf-8 -*- # # C++ version Copyright (c) 2006-2007 Erin Catto http://www.box2d.org # Python version by Ken Lauer / sirkne at gmail dot com # # This software is provided 'as-is', without any express or implied # warranty. In no event will the authors be held liable for any damages # a...
true
cf211d4044f142875da3f2a0e35c03f94ae75110
Ygritte0/blog
/function/exercise/7.py
UTF-8
761
4.53125
5
[]
no_license
#-*-coding:utf-8-*- # 计算大小写字母的个数 def string_test(s): d = {"UPPER _CASE":0, "LOWER_CASE":0} # 用字典,键值对的形式分别定义大小写字母的个数,大写:个数;小写:个数 for c in s: # 遍历s中的每一个字母, if c.isupper(): # 如果该字母是大写的 d["UPPER _CASE"] += 1 #大写字母的个数加一 elif c.islower():# 如果该字母是小写的 d["LOWER_CASE"] += 1 # ...
true
0773cb01efa9707b04c34ca31df27bc5893ed3d2
pottumuusi/nothing
/devtools/scripts_of_svg.py
UTF-8
740
2.984375
3
[ "MIT" ]
permissive
#!/usr/bin/env python3 import sys import xml.etree.ElementTree as ET from svg.selectors import * import itertools def usage(): print("Usage: ./scripts_of_svg.py <svg-file-name>") def scripts_of_rects(svg_root, prefix): return [title.text.split()[0] for rect in svg_rects(svg_root) if...
true
2fbe1454023505d7c9f4bcf5ba46fb10aa0e84d9
BOTKooper/spring-2021-labs
/neuron/solves/3/task2.py
UTF-8
639
3.921875
4
[]
no_license
""" Task 2 Multiply first Z elements of arithmetic progression with given a(1), t (diff) and Z (amount of elements) """ # DEFAULTS FOR VARIANT 13 DEF_A1 = 7 DEF_T = 2 DEF_Z = 4 def solve(a1, t, z): mul = a1 element = a1 for i in range(1, z): element += t mul *= element return mul fl...
true
4a091a7ab000fd55c9f31ec1490f850ea540fd1d
ninaprabhu/bargaining-distortion
/dukeL22.py
UTF-8
5,958
3.40625
3
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sun Oct 22 21:51:43 2017 @author: Nina """ import itertools import numpy as np import math def all_same(items): return all(x == items[0] for x in items) #if all points are the same def dist(p0, p1): return (p0[0] - p1[0])**2 + (p0[1] - p1[1])**2...
true
3b83640dd3dadbaeb9849a2ab57e8625c015a8a1
vaibhavg12/Problem-Solving-in-Data-Structures-Algorithms-using-Python3
/Algorithms/2 Queue/ConvertNumber.py
UTF-8
556
3.109375
3
[]
no_license
import sys from collections import deque def convertXY(src, dst): que = deque([]) visited = {} que.append((src, 0)) while len(que) != 0: node = que.popleft() value = node[0] steps = node[1] if value == dst: return steps if value < dst and (value*2) no...
true
0e1eae072f0db9ad4a38a850fafa758770e4b71e
john-hawkins/Bayesian_Neural_Networks
/analysis/summarise_features.py
UTF-8
1,265
3.046875
3
[]
no_license
import numpy as np import pandas as pd df = pd.read_csv('sets/Train_set_24_hour_full.csv', sep=" ") colnames = df.columns records = len(df) print("\\begin{table}[h!]") print(" \\begin{center}") print(" \\caption{Feature Summary}") print(" \\label{tab:table1}") print(" \\begin{tabular}{l|l|r|r|r|r} ") prin...
true
c7c72555fc2a2c63099a9ad91815c8d48ddc9bc3
NavonLab/power-check
/text.py
UTF-8
889
2.609375
3
[ "MIT" ]
permissive
import gammu from phonebook import phonebook #configure gammu state_machine = gammu.StateMachine() state_machine.ReadConfig() state_machine.Init() #send message to all numbers in phonebook when the power goes out def power_out(): out_message = { 'Text': 'URGENT: Power outage in SPL has been recorded.', ...
true
3118489ed3b7edadf85cc98624f8461be9a9dbf8
arpitkapadia/leetcode
/StringPalindrome.py
UTF-8
1,134
3.4375
3
[]
no_license
class Solution: def isPalindrome(self, s): """ :type s: str :rtype: bool """ # print(s) s = "".join(s.split('\n')) s = "".join(s.split(' ')) if (not len(s)): return True index1 = 0 index2 = len(s) - 1 while (s[inde...
true
ca0c83d7139ca68a1c7942d1808fa1d299f0d81d
emirfine/emirfine.github.io
/Algorithm/practice11.py
UTF-8
385
3.03125
3
[]
no_license
def solution(n): answer = 0 # O(n^2) # O(n) for num1 in range(1, n+1): if n % num1 != 0: continue num2 = n//num1 (num1, num2) answer += 1 # for num2 in range(n//num1, 0, -1): # if num1 * num2 == n: # ...
true
7f459e9ff096cc851b4b6cd4224f413a2649087d
divyajyotiarch/VI-SEM
/ESIOT CODES/B3/B3.py
UTF-8
185
3.25
3
[]
no_license
import serial ser = serial.Serial('/dev/ttyUSB0', 9600, timeout=0.5) while True: ser.write('Hello User \r\n') incoming = ser.readline().strip() print 'Received Data : ' + incoming
true
d80d16ba15216c0201dc4d9223194b808ccb162b
ziyang1996/Machine-Learning
/project/CS-ML/project/program/train.py
UTF-8
4,985
2.671875
3
[]
no_license
from numpy import * import matplotlib.pyplot as plt from sklearn.model_selection import train_test_split from sklearn.model_selection import KFold from sklearn.externals import joblib from sklearn import svm from sklearn.neural_network import MLPClassifier from sklearn.neighbors import KNeighborsClassifier from sklea...
true
32a6ce46d53c593c21cf866114904d1981288389
razzledazze/Python-Turtle---10x10-Screen
/Pixel Screen.py
UTF-8
1,853
3.953125
4
[]
no_license
from turtle import Turtle import csv colours = ['blue','red','yellow','green','orange','purple'] turtles = [] names = [] def MakeScreen(): for row in range(10): print("Setting up Column:"+str(row+1)) for column in range(10): name = str(row)+str(column) #makes a unique name...
true
b8bd49330111cd4dcfb16f5020620c4593eb8fef
notclu/ctf
/plaid_2014/pwnables/kappa-275/ex_kappa.py
UTF-8
4,454
2.71875
3
[]
no_license
import re import sys import struct sys.path.append('../../../tools') import ctf_socket HOST = 'arch' PORT = 8888 def get_menu(cs): cs.recv_until('artwork', dump=False) def catch(cs, poke_type=None, slot=2, name=None): while True: cs.send('1\n') data = cs.recv_until('(Run|artwork)') ...
true
1d2397558a5c1a4c17c014baeddc319864379e8d
lhserafim/python-100-days-of-code-monorepo
/day-48/selenium-webdriver/cookie_game.py
UTF-8
3,754
3.46875
3
[]
no_license
# # 1. Go to the game website and familiarise yourself with how it works: # # http://orteil.dashnet.org/experiments/cookie/ (classic version) # # 2. Create a bot using Selenium and Python to click on the cookie as fast as possible. # # # 3. Every 5 seconds, check the right-hand pane to see which upgrades are affordable...
true
904cb94aa934f07806d6de16d580ff5952af5d26
itsolutionscorp/AutoStyle-Clustering
/all_data/exercism_data/python/rna-transcription/f6bcd9f0e04946cda6d4db095acf4a23.py
UTF-8
299
3.1875
3
[]
no_license
def to_rna(dna_strand): rna_strand = '' for dna_nuc in dna_strand: if dna_nuc == 'G': rna_strand += 'C' elif dna_nuc == 'C': rna_strand += 'G' elif dna_nuc == 'T': rna_strand += 'A' elif dna_nuc == 'A': rna_strand += 'U' else: rna_strand += '' return rna_strand
true
124b4bdd514b82b7e4aa1b16ab8a1a01f4071173
LoydAndrew/Automation
/__init__.py
UTF-8
362
3.859375
4
[]
no_license
class Car(object): wheels=4 def __init__(self, name,type): self.type = type self.name = name def info(self): print("Type of car is a %s %s " % (self.type, self.name)) car1 = Car('bmw','cedan') car1.info() print (car1.wheels) car2 = Car('mers','jeep') car2.info() car1.wheels = ...
true
ca0d5e4f6f13dfa590909fd2e1e5ee57ae38b26e
Amirreza-dar/Assignemnt_1SSD
/Task3.py
UTF-8
1,849
2.578125
3
[]
no_license
# Task3 import time from inspect import signature import numpy as np import inspect class decorator3: def __init__(self,fun): self.fun= fun decorator3.fun1 = fun decorator3.source = inspect.getsource(fun) self.arguments= [] decorator3.count= 0 self.exe_time = 0 def __call__(self,*ar...
true
4d72be99399a117cee15aec26a55c7f25eb6b2b6
rwzhao/working-open-data-2014
/notebooks/Day_11_B_Setting_Up_for_PfDA.py
UTF-8
5,967
3.125
3
[ "Apache-2.0" ]
permissive
# -*- coding: utf-8 -*- # <nbformat>3.0</nbformat> # <markdowncell> # **Chapter 2, 3 of PDA** # <codecell> %pylab --no-import-all inline # <codecell> import matplotlib.pyplot as plt import numpy as np from pylab import figure, show from pandas import DataFrame, Series import pandas as pd # <headingcell level=1...
true
511e1a3e0ec28610dd18624bf62424c750861aa6
screamff/Hello-Python
/udp_tcp/network/ch2udplocal.py
UTF-8
504
2.984375
3
[]
no_license
import socket,sys s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) host = raw_input("Input the host:") textport = raw_input("Input the port number or protocol name:") try: port = int(textport) except ValueError: port = socket.getservbyname(textport, 'udp') s.connect((host, port)) data = raw_input('Ente...
true
a4a4392e4eef4bc6cb0724a4340cda8d7d60c780
Divyangana-12/hacktoberfest2021
/divi.py
UTF-8
93
3.921875
4
[ "Apache-2.0" ]
permissive
name=input("Enter the name : ") def greet(name): print("Good day, "+ name ) greet(name)
true
be91e61d61317f6ec76c1deb79edafd33eea4bd8
nfredrik/pyjunk
/the_sun/nordpol_houry.py
UTF-8
2,263
2.953125
3
[]
no_license
from BeautifulSoup import BeautifulSoup import urllib2 import datetime import json import os JSONFILE = 'data.json' def median(mylist): sorts = sorted(mylist) length = len(sorts) if not length % 2: return (sorts[length / 2] + sorts[length / 2 - 1]) / 2.0 return sorts[length / 2] ...
true
ed6983c074abc296e23ac9fc60e1bedda7a1c115
tylermcbrien/Betalab
/Week 2 Work.py
UTF-8
404
3.484375
3
[]
no_license
"Question 6" import numpy as np np.set_printoptions x=np.zeros((3,3)) print(x) "Question 8" from scipy.stats import skewtest stats.skewtest ([1,2,3,4,5,6]) "Question 11" import scipy as sp ret=sp.array([2,3,4]) "Arithemtic Mean" sp.mean(ret) "Geometric Mean" pow(sp.prod(ret+1),1./len(ret))-1 "Quest...
true
cc09f8bf325afc4ef5aac41a4dec9d3159044529
Carameldropz/Reddit-Topic-Extractor
/topic_extractor/analyzer.py
UTF-8
7,470
3.015625
3
[]
no_license
# @author Evelina Arthursson # # Outside sources used: # www.monlp.com/2012/01/20/extracting-noun-phrases-from-parsed-trees/ # http://daringfireball.net/2010/07/improved_regex_for_matching_urls # import nltk import common_words, reddit_interface, utility from nltk.corpus import stopwords from nltk.tokenize import Reg...
true
3c3e63c19f790c86c6fed1981f51575c194c019c
codykallen/tax-distributor
/investmentmodel.py
UTF-8
22,954
2.625
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Mon Nov 5 09:57:52 2018 Calculates and saves the changes in investment for each asset type and year. """ """ Section 1: Investment incentives """ startyear = 2018 # Note: startyear prevents retroactive responses to the TCJA's tax cuts. cpolicy_base = pd.read_csv('policy_corp_...
true
d61630fde8c7a90eff3a329da67edaf3d5d9e831
21han/two_sigma_news_sentiments
/sentiment_feature_generator.py
UTF-8
10,871
2.828125
3
[]
no_license
import pandas as pd import numpy as np from datetime import datetime import sys from functools import reduce from collections import Counter # when debug mode is on, we only take a sub-sample of total data debug_mode = True # when we first load this in notebook, turn reload on. afterwards, turn it off no need to reloa...
true
9b096a835f306fc8d49ae971b1b7c12cd4dbe897
htamagnus/Python
/Sorteando-Ordem-Na-Lista/index.py
UTF-8
313
4
4
[ "MIT" ]
permissive
#Programa que lê as quatro opções e mostre a ordem sorteada. n1 = str(input('Primeira opção: ')) n2 = str(input('Segunda opção: ')) n3 = str(input('Terceira opção: ')) n4 = str(input('Quarto opção: ')) lista = [n1, n2, n3, n4] random.shuffle(lista) print('A ordem de apresentação será') print(lista)
true
74783df0938cf602c4edb5f2f6b10f80e8c813f6
Demondul/python_algos
/car.py
UTF-8
822
3.921875
4
[]
no_license
class Car: def __init__(self,price,speed,fuel,mileage,tax=0.12): self.price = price self.speed = speed self.fuel = fuel self.mileage = mileage self.tax = tax if(self.price>10000): self.tax=0.15 self.display_all() def display...
true
8d5ba59b4835f724a707b877966de21d0b178bb1
himkt/problems.2019
/atcoder/mujin/2017/c.py
UTF-8
1,102
3.421875
3
[]
no_license
def proc(s, s_old): arg = -1 for i in range(len(s)-1): if s[i] == s[i+1]: arg = i break if arg == -1 or len(s) < 2: """ ti=ti+1 であるような最小の i を選ぶ。 そのような i が存在しない場合、処理を終える。 """ return s if s[arg] == 'z': """ ti が z...
true
ef35e9d06f13e7a7b5b92937463c0e2dd122c3e0
ck-fantasy-hockey/CKFantasyHockey
/playerstats.py
UTF-8
2,013
3.09375
3
[]
no_license
import requests # NHL Stats API # Pulls list of player ids from each team def pull_roster(): roster_list = [] count = 0 # Iterates through all teams for i in range(1,2): response = requests.get('https://statsapi.web.nhl.com/api/v1/teams/' + str(i) + "/roster") roster = response.json() ...
true
993338283554bdcd9b85a29f74da2ec695bb7458
ramyamango123/test
/python/python/src/python_problems/Interview_imp_programs/barnesNobleEx.py
UTF-8
4,195
2.6875
3
[]
no_license
from selenium import selenium import unittest, time, re class barnesNobleEx(unittest.TestCase): selenium = None def setUp(self): self.verificationErrors = [] self.selenium = selenium("localhost", 4444, "*chrome", "http://books.barnesandnoble.com") self.selenium.star...
true
ddc6f2c642c6aeec5a8db3c1d8144b2167055038
Lucasnobrepro/Deep-Learning-DL
/06-Classificacao_CIFAR-10/01_CNN_CIFAR-10.py
UTF-8
2,744
2.71875
3
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed May 27 11:00:33 2020 @author: lucas """ # Bibliotecas import matplotlib.pyplot as plt from keras.datasets import cifar10 from keras.models import Sequential from keras.layers import Dense, Flatten, Dropout from keras.utils import np_utils from keras.la...
true
1fd892d32d69bd8b1969fd8243c8a6576564b11a
CmdrTaen/ED-Journal-to-Excel
/edtslib/distance.py
UTF-8
6,932
2.578125
3
[]
no_license
#!/usr/bin/env python from __future__ import print_function import argparse import math import sys from . import calc from . import env from . import pgnames from . import util app_name = "distance" log = util.get_logger(app_name) class Application(object): def __init__(self, arg, hosted, state = {}): ap_p...
true
5751b13a14f0e962e9981e9363925bb926384425
AlbertQueiroz/Python-MIPS-Assembler
/functions.py
UTF-8
846
2.78125
3
[]
no_license
from registersBank import reg import dataMemory import labels #FORMAT FUNCTIONS def breakline(s): s = s.split(',') s = ('').join(s) s = s.split() return s def printReg (): print('================Registers==================') for items in reg: print(items, ' = ', reg[items]) print('================Register...
true
00f51581fe94534222e14ec6a05412f250c60229
Koxinga314/snakeware
/snakewm/apps/system/fps/fps.py
UTF-8
1,399
2.734375
3
[ "MIT" ]
permissive
# FPS counter for Snakeware import pygame import pygame_gui import time, statistics MAXSAMP = 300 class SnakeFPS(pygame_gui.elements.UIWindow): def __init__(self, pos, manager): super().__init__( pygame.Rect(pos, (370, 100)), manager=manager, window_display_title="fp...
true
74bc06919320556702f66fbde67b5095baee23f5
Jennifer-Vo/Blocky-Game
/example_tests.py
UTF-8
34,739
3.109375
3
[]
no_license
"""CSC148 Assignment 2 === CSC148 Winter 2020 === Department of Computer Science, University of Toronto This code is provided solely for the personal and private use of students taking the CSC148 course at the University of Toronto. Copying for purposes other than this use is expressly prohibited. All forms ...
true
6c2df580459517b7ec8c3b0ef56305de81c3ea9c
gvin10/SpotOn-Puppy-Adoption-Tests
/test_adoptions.py
UTF-8
7,430
2.6875
3
[]
no_license
from selenium import webdriver from selenium.webdriver.support.ui import Select from random import randint import random def test_brooke_adoption(): driver = webdriver.Chrome(executable_path="/Users/gregoriovincent/Downloads/chromedriver") driver.get("http://puppies.herokuapp.com/") # Step 1 Select Brooke ...
true
5b361128b93842f137f8dc0b5a3f63ce89644ae3
ahmadrezash/Codeforces
/337A.py
UTF-8
189
3.046875
3
[]
no_license
tmp = input() tmp = tmp.split() n, m = int(tmp[0]), int(tmp[1]) a = input() a = a.split() a = [int(i) for i in a] a.sort() a = [(a[i+n-1]-a[i]) for i in range(len(a)-n+1)] print(min(a))
true
2ddafb0e91c5c3de288138468678eacb5730ef4d
SchiefLab/G001
/typing/Bio/PDB/AbstractPropertyMap.pyi
UTF-8
2,626
3.265625
3
[ "BSD-2-Clause" ]
permissive
""" This type stub file was generated by pyright. """ """Class that maps (chain_id, residue_id) to a residue property.""" class AbstractPropertyMap: """Define base class, map holder of residue properties.""" def __init__(self, property_dict, property_keys, property_list) -> None: """Initialize the clas...
true
7ea486f317b2fab65e48c6fecf55df13fff0819d
Zaliann/practice
/практика 2/hello.py
UTF-8
177
4.40625
4
[]
no_license
name = input("Введите Ваше имя: ") # Программа запрашивает имя print("Hello, " + name + "!") # Происходит вывод имени
true
05070391859a142e5a9c3772d7a9836f088723fe
mohanalearncoding/Leetcodepython
/sqrt.py
UTF-8
384
3.015625
3
[]
no_license
def mySqrt( x): half=x//2 while True: if half*half==x: return half else: half=half//2 if half*half<=x: break while True: sqr=half*half if sqr>x: half=half-1 break else: ...
true
3837583d9c7cf4f330f3a251254b114a535f44db
andrey1908/ivb_nkbvs_selected_joined_tune
/split_json.py
UTF-8
1,370
2.65625
3
[]
no_license
import json import numpy as np def get_annotations(images, annotations): new_annotations = list() images_ids = set() for image in images: images_ids.add(image['id']) ann_id = 1 for annotation in annotations: if annotation['image_id'] in images_ids: annotation['id'] = an...
true
8f0f9f5554be504b563876d17bd04290485607fb
shivankagrawal10/Interesting-Problems
/GoogleFoobar_3/P1/foobar3_1.py
UTF-8
6,321
3.8125
4
[]
no_license
""" The Grandest Staircase Of Them All ================================== With her LAMBCHOP doomsday device finished, Commander Lambda is preparing for her debut on the galactic stage - but in order to make a grand entrance, she needs a grand staircase! As her personal assistant, you've been tasked with figuring out h...
true
1e6fdb838dba2fdf54ad2791ba22061d3ea67807
kb0rg/hb_skills02
/test.py
UTF-8
472
3.65625
4
[]
no_license
def count_unique(string1): word_count_dict= {} words_list = string1.split() print words_list for word in words_list: word_count_dict[word] = word_count_dict.get(word, 0) + 1 # if word not in word_count_dict.keys(): # word_count_dict[word] = 1 # else: # wor...
true
82e867ece236992ccd93eb8dcebf624968ceaad2
lipemascarenhas/IPND_Udacity
/Projeto_web/Projeto_final/enterteniment_center.py
UTF-8
1,316
3
3
[]
no_license
import fresh_tomatoes import media toy_story = media.Movie("Toy Story", "A story of boy and his toys that come to life", "https://upload.wikimedia.org/wikipedia/pt/d/dc/Movie_poster_toy_story.jpg", "https://www.youtube.com/watch?v=KYz2wyBy3kc") avatar = media.Movie("Avatar", "A marine on a alien planet", "https://...
true
e0f086e1bfd6fd05af2026009ff9d990397c74d4
robinjia/adaptive-pairwise
/src/image_embedder.py
UTF-8
14,357
2.515625
3
[ "MIT" ]
permissive
"""ImageEmbedder model code. Portions adapted from https://github.com/macaodha/inat_comp_2018/blob/master/train_inat.py and https://github.com/macaodha/inat_comp_2018/blob/master/inat2018_loader.py """ from datetime import datetime from PIL import Image import json import logging import math import numpy as np import ...
true
0472e37770721d7752baaa96c04494b05154e33a
Firefly007-2018/scripts
/HaploManager/transfer_merge.py
UTF-8
7,546
2.640625
3
[]
no_license
#!/usr/bin/python3 -u import os import sys import re import pathlib import argparse import sqlite3 as sql from collections import defaultdict, namedtuple from operator import itemgetter Haplotype = namedtuple('Haplotype', 'name start end strand trail') class Part(): def __init__(self, oldname, oldstart, oldend, ...
true
681dcfccc0473388de7ba27789af79c4376a51fa
daniel-pawelko-ics20/ICS3U-Unit2-02-Python
/area_and_perimeter.py
UTF-8
554
4.46875
4
[]
no_license
#!/usr/bin/env python3 # Created by: Daniel Pawelko # Created on: Oct 2021 # This program calculates the area and perimeter of a rectangle # with dimensions 5cm x 3cm def main(): # this function calculates the area and perimeter # input length = int(input("Enter the length (mm): ")) width = int(i...
true