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
8b9984f6321ea3cef9bb56e6907fc1ae7e0003ce
flask-django-independent-study/week-3-varsity
/app.py
UTF-8
2,208
2.53125
3
[]
no_license
"""Import libraries.""" from flask import Flask, render_template # TODO: import WTForms # TODO: import needed fields from WTForms # TODO: import needed validators from WTForms # TODO: import Flask SQLAlchemy # TODO: import Flask SocketIO # TODO: import Flask Uploads app = Flask(__name__) # TODO: create a SECRET_...
true
2c319115006c19cbbc22aba40f4b7b862444ab0a
AdamZhouSE/pythonHomework
/Code/CodeRecords/2805/60724/272076.py
UTF-8
218
2.859375
3
[]
no_license
n=int(input()) nums=input().split() nums=[int(i) for i in nums] result = 0 start = 0 for i in range(len(nums)): if i and nums[i-1] >= nums[i]: start = i result = max(result, i - start + 1) print(result)
true
b6e3d555061c145b7f53b407bdfcfe447fd03e97
nerkulec/AI
/lista1/obrazki.py
UTF-8
4,353
2.9375
3
[]
no_license
import numpy as np explore = 0.05 maxloops = 1000 def longest_sequence(l): longest = 0 streak = 0 for i in range(len(l)): if l[i] == 1: streak += 1 else: if streak>longest: longest = streak streak = 0 if streak>longest: longes...
true
ca79bb3e4907d98498db74d595a67facaa057955
izoubi/learn-math-with-Knowla
/LMath/Interface_LMath_with_Knowla/MainInterface.py
UTF-8
3,136
3.125
3
[]
no_license
from tkinter import * from tkinter import ttk from Interface_LMath_with_Knowla.UseAppInterface import UseAppInterface __author__ = 'Ismail Zobui' class MainInterface(Frame): def __init__(self, master): # the class attributes. Frame.__init__(self, master) # the class instance has an at...
true
6a7c56d23ad7e496cb630580385a41c845da7727
yingshaoxo/ML
/15.PaddleGAN/PaddleGAN/ppgan/models/dc_gan_model.py
UTF-8
4,451
2.734375
3
[ "MIT", "Apache-2.0", "Python-2.0", "LicenseRef-scancode-generic-cla" ]
permissive
# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserve. # # 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 appl...
true
56cacc30a52c66aeaccbcd179c1466368bcb256c
zhangshengping/SimpleGUI2Pygame
/Code/Shooter/utilities_1/level_loader.py
UTF-8
2,066
3.390625
3
[]
no_license
import re __ = tuple('1' * 120) DEMO_LEVEL = tuple([int(x) for x in __]) # Classes class LevelLoader: '''Loads level info.''' def __init__(self, filename): self.filename = filename self.num_levels = 1 def open_file(self): '''Tries to open the file. Reports file missing and runs wi...
true
8cb703a8a4acff4ff25d855e9f3427bf0ecc93cd
jasonsbrooks/pennapps-winter-15
/decode2.py
UTF-8
6,405
2.515625
3
[]
no_license
import scipy.io.wavfile import scipy.fftpack as fft import matplotlib.pyplot as plt import heapq import numpy as np from scipy.signal import argrelextrema import hermes from scipy import signal import urllib2 def getWav(filename): newfile= filename.split('/')[-1] wavfile = urllib2.urlopen(filename) output = open(ne...
true
a203497b6360de9c6d899650ff85f33c5322a213
missbelinda/Modul-1-Purwadhika
/Notes/soal1023.py
UTF-8
1,367
3.421875
3
[]
no_license
''' #SOAL 1 19 tahun lalu, umur anak setengah tahun lebih muda dari seperempat umur ibu umur anak sekarang 19 tahun lebih tua dari sepertujuh umur ibu umur ibu? Trial rumus 6 tahun lalu, umur anak setengah tahun lebih muda dari seperempat umur ibu umur anak sekarang lebih tua 9 tahun dari seperdelapan umur ibu ''' ras...
true
a4be157921fc49b0f4cc4a8340670de6a3bb2acb
OCHIENGDAVIS/pols-with-datastructures
/tests/test_utils.py
UTF-8
1,650
2.578125
3
[]
no_license
"""A module for testing utility and helper functions""" from tests.base_testcase import BaseTest from app.api.v1.models .party_models import Party, parties from app.api.v1.models .office_models import Office, offices from app.api.v1.utils import check_json, ValidateUserInput class Utils(BaseTest): def test_creat...
true
3fec757aa7a18ae044b12e1d93c473f0112b22ae
TingliangZhang/python3-tutorial
/ex23.py
UTF-8
748
3.265625
3
[]
no_license
#languages.txt needed! (https://learnpythonthehardway.org/python3/languages.txt) # $ python ex23.py utf-8 strict # $ python ex23.py big5 strict # $ python ex23.py big5 replace import sys script, encoding, error =sys.argv def main(lauguage_file, encoding, errors): line = lauguage_file.readline() if line: ...
true
c29fef1c2a99caa7ed45e9b1cd774f148ea3f306
CBehan121/GameOfLife
/SimplePrint_GameOfLife.py
UTF-8
1,153
3.015625
3
[]
no_license
import sys from random import randint import time global endme endme = 0 def main(): x, y = 50, 50 matrix = [[randint(0,1)] * x for _ in range (y + 1)] printer(matrix) secondGen(matrix, x, y) def secondGen(matrix, x, y): time.sleep(0.1) print(chr(27) + "[2J") global endme endme = endme + 1 future = [[0] * x ...
true
d4f562a18bcbdcf682b3d818515906fa9d516504
ignaciocassi/PyPractica
/Ej3PrácticaW3s.py
UTF-8
592
4.46875
4
[]
no_license
""" Write a Python program to sort a list of tuples using Lambda. Original list of tuples: [('English', 88), ('Science', 90), ('Maths', 97), ('Social sciences', 82)] Sorting the List of Tuples: [('Social sciences', 82), ('English', 88), ('Science', 90), ('Maths', 97)]""" def crearListaTuplas(): lista=[] materi...
true
751960b3c5c180fbc5f7b74d6c573c2d927f7200
techkids-c4e/c4e5
/Khánh Trần/Session(2)/Assignment(4).py
UTF-8
353
4.03125
4
[]
no_license
##a program that calculate and print out the total number of B bacteria after a period of time b1 = int(input('Pls enter the initial B bacteria number: ')) t = float(input(' & the time is: ')) if t > 1 : b2 = int(b1*(t//2)) print('After',t,'minues we would have',b2,'bacterias') else: print('After',t,'minues...
true
fc61a9e83804f1a56e6ff24c30c781a6a4b57efd
Callmekrishna/Board-Practicals
/solutions/2.py
UTF-8
1,384
4.25
4
[]
no_license
filename = input('Enter the name of text file : ') print('''\nMENU DRIVEN PROGRAM a. Count and display the number of upper case and lower case characters in the file. Display whether the file contains more number of upper case or lower case characters and by how much. b. Create a new file which contains all ...
true
96913dee024613703b0776e0656e46e54ca21a1a
countermeasure/suave
/suave/box.py
UTF-8
3,269
3.234375
3
[ "MIT" ]
permissive
import curses import subprocess from datetime import ( datetime, timedelta, ) from grid import Grid class Box(object): """ Manages the drawing of boxes. """ def __init__(self, screen, rows, columns, rows_offset=0, columns_offset=0, command=None, interval=None): # Se...
true
9ed715702b80beb5f77ea991bf08b57a0ab1558b
404akhan/proj3-math
/code/test13.py
UTF-8
359
2.828125
3
[]
no_license
from helpers import * cells = pickle.load(open('data/cells.p', 'rb')) print cells print cells.shape print 'mean filled %f' % np.mean(cells) x = np.sum(cells, axis=0) print x.shape cells2 = cells[:, x > 10] print cells2.shape sys.exit() x = np.sum(cells, axis=0) y = np.sum(cells, axis=1) x.sort() y.sort() prin...
true
e20375d0c328dd9b05642f578f1987ffcff0bd74
zo-bar/rosalind
/src/com/zobar/rosalind/PRSM.py
UTF-8
2,091
2.609375
3
[]
no_license
'''0 Created on Oct 3, 2013 @author: Zoya ''' from PRTM import amino_acid_mass from time import gmtime, strftime def get_multiplicity(set1, set2): multiset = [] for val1 in set1: for val2 in set2: multiset.append(round(round(float(val1), 5) - round(float(val2), 5), 5)) mul...
true
0c9b52ac97b2fbdf3f5a0321f7cf36646986f4ab
hector81/Aprendiendo_Python
/Integer/DevolverDigitos.py
UTF-8
391
4.15625
4
[]
no_license
def introducirNumero(): while True: try: x = int(input("Por favor ingrese un número par: ")) return x break except ValueError: print("Oops! No era válido. Intente nuevamente...") numero = introducirNumero() numeroDigitos = len(str(num...
true
b011ec0d8e084e28b1580071688a103f558a6963
Mudalue/HNGi7-First-Task
/scripts/yusufB.py
UTF-8
242
2.8125
3
[]
no_license
#!usr/bin/env python3 fname = "Yusuf Braimoh" HNGi7_ID = "HNG-05068" language = "Python" email = "braimohyusuf@gmail.com" print("Hello World, this is {0} with HNGi7 ID {1} and email {2} using {3} for stage 2 task.".format(fname,HNGi7_ID,email,language))
true
a9e4a0680cd8edc2e070e591fa657eaf67e99938
bsharvey/NBA_Player_Team_Analysis
/NBA on DraftKings/DK Flask/models.py
UTF-8
562
2.84375
3
[]
no_license
# from app import db # # class Predictions(db.Model): # # __tablename__ = "players" # # id = db.Column(db.Integer, primary_key=True) # Player = db.Column(db.String, nullable=False) # Points = db.Column(db.Float, nullable=False) # Salary = db.Column(db.Integer, nullable=False) # # def ...
true
0a600d756c9f0f4cbcaa576996212b56364f9cac
BeckmaR/b3-r7-r4nd7
/test.py
UTF-8
4,281
3.5
4
[ "MIT" ]
permissive
import unittest import graph class NodeTest(unittest.TestCase): def test_init(self): node = graph.Node("label") self.assertEqual(node.label, "label") def test_neighbor(self): node1 = graph.Node("1") node2 = graph.Node("2") node1.add_neighbor(node2, 5.3) self.as...
true
c80b264d83096073a4da7c8da156f0c025babb95
somnathbanerjee2020/PythonCode
/fileOperations.py
UTF-8
106
2.8125
3
[]
no_license
myfile=open('fifa18.csv') k=myfile.readlines() print(k) myfile.seek(0) w=myfile.read() print(f"w is {w}")
true
1ef6d46a1ba787c8ac8341c2ceca9cfb75749f69
Mopip77/sync
/run.py
UTF-8
1,356
2.578125
3
[]
no_license
import sys import os from src.backup.backup import BackUpUtil if __name__ == "__main__": buu = BackUpUtil() # 不加会报 TERM environment variable not set # os.system("export TERM=linux && clear") args = sys.argv if len(args) == 1: buu.display() print("use `backupThem -h` to show more c...
true
a6d25eba9ef5b7e3adc895384e36480b48142818
ahastudio/CodingLife
/20170723/python/test_bubble_sorter.py
UTF-8
1,039
3.96875
4
[]
no_license
import pytest class BubbleSorter: @staticmethod def sort(array): operations = 0 if type(array) is not list: return None, 0 if len(array) <= 1: return array, 0 for next_to_last in range(len(array) - 2, -1, -1): for index in range(next_to_last ...
true
d89e0c06bdeebf4fc64b072d76b5754355274fe7
Dython-sky/AID1908
/study/1905/month01/code/Stage2/day11/ftp_client.py
UTF-8
3,085
3.453125
3
[ "MIT" ]
permissive
""" ftp 文件服务,客户端 """ from socket import * import sys import time # 服务端地址 ADDRESS = ('127.0.0.1',8888) # 客户端文件处理类 class FTPClient(): """ 客户端处理,查看,上传,下载,退出 """ def __init__(self,sockfd): self.sockfd = sockfd # 获取文件库中文件列表 def do_list(self): self.sockfd.send(b'L') # 发送请求 # 等...
true
0af5581ba8fa4539dd1f34e00550bbf4c87ad73a
pnael/Python
/formattedStrings.py
UTF-8
190
3.171875
3
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- if __name__=="__main__": fistname = 'Philippe' lastname = 'Naël' msg = f'{fistname} {lastname} learns coding' print(msg)
true
f2dbd582934fe8bacaad10d1f77980d834a96e15
ankitboghra/competitive-solutions
/Equal Stacks.py
UTF-8
699
3.1875
3
[]
no_license
#!/bin/python3 import sys n1,n2,n3 = input().strip().split(' ') n1,n2,n3 = [int(n1),int(n2),int(n3)] h1 = [int(h1_temp) for h1_temp in input().strip().split(' ')] h2 = [int(h2_temp) for h2_temp in input().strip().split(' ')] h3 = [int(h3_temp) for h3_temp in input().strip().split(' ')] h1.reverse() h2.reverse() h3....
true
177873843af73887e419f72d7c05b1ca03c14556
krishnakartik1/differentiatingDogs
/labsGreyhounds.py
UTF-8
231
2.640625
3
[]
no_license
import numpy as np import matplotlib.pyplot as plt greyhounds=500 labs=500 greyHeight=28+4*np.random.randn(greyhounds) labHeight=24+4*np.random.randn(labs) plt.hist([greyHeight,labHeight],stacked=True,color=['b','g']) plt.show()
true
8239162a3d96cbd680eecdc8feb2e821a3d9d190
shivamvats/autoencoder
/main.py
UTF-8
8,393
2.546875
3
[]
no_license
import numpy as np import gensim import pickle import cPickle from autoencoder import Autoencoder, get_w2v_model, train_w2v_model from utils import one_hot, de_one_hot from text_preprocessing import get_word_to_index_dic, get_index_to_word_dic, load_data, tokenize_and_pad_sentences, get_train_val_test_data, preprocess...
true
27071ec552a76954bf811984b51533e57108f86c
telegab5736/CTI110
/P4T2_BugCollector_BrianTelega.py
UTF-8
333
3.34375
3
[]
no_license
#tracker for bugs collected in a 5 day span #6JULY2020 #CTI-110 P4T2- Bug Collector #Brian Telega #Accumulator total = 0 #Number of bugs collect for 5 days for day in range(1,6): print('Enter bugs collected ',day) bugs = int(input()) total = total + bugs #Dispay total bugs print('You collected a total of...
true
5868bd375c90acb0094c0c1e423d78ed26186f87
amanpuranik/ds-algos
/ds-algos/tree.py
UTF-8
1,846
4.3125
4
[]
no_license
#this class is meant for building the attributes of the tree class TreeNode: #initalise various attributes of the tree def __init__(self,data): self.data = data self.children = [] self.parent = None #add child node def add_child(self,child): child.parent = self #the pa...
true
e411eb20fc8b165c5a3e3bd21989ab7f2176d048
fnpy/fn.py
/fn/stream.py
UTF-8
2,445
3.078125
3
[ "Apache-2.0" ]
permissive
from itertools import chain from sys import version_info from .iters import map, range if version_info[0] == 2: from sys import maxint else: from sys import maxsize as maxint class Stream(object): __slots__ = ("_last", "_collection", "_origin") class _StreamIterator(object): __slots__ = (...
true
8fbc457a7321f82b1a14479a9d028a784b30938b
danielsummer044/EDUCATION
/average.py
UTF-8
558
3.6875
4
[]
no_license
mas = [-1, 6, 8, 2, 4, 3, 9, 0, 5, 1] # mas = [1,2,3] summ = 0 for i in range (0, len(mas)): summ = summ + mas[i] print("Sum of elements in array: ") print(summ) n = len(mas) print("Amount of elements: ") print(n) avg = summ / n print("Average of array: ") print(avg) # find closest to avg ...
true
a661ab7b74ef719ed1add4e665b077615dfd1520
IanLee1521/jedi
/test/completion/basic.py
UTF-8
4,892
2.921875
3
[ "MIT" ]
permissive
# ----------------- # cursor position # ----------------- #? 0 int int() #? 3 int int() #? 4 str int(str) # ----------------- # should not complete # ----------------- #? [] . #? [] str.. #? [] a(0):. # ----------------- # if/else/elif # ----------------- if (random.choice([0, 1])): 1 elif(random.choice([0, 1])...
true
f967324948d62b040b6bf26ea010e84d898639c9
mylons/biopy
/biopy/vcfutil/vcf.py
UTF-8
1,338
3.015625
3
[]
no_license
__author__ = 'mikelyons' class VCF(object): def __init__(self, vcfLine): self._tokens = vcfLine.split() self._chrom = self._tokens[0] self._pos = self._tokens[1] self._id = self._tokens[2] self._ref = self._tokens[3] self._alt = self._tokens[4] self._qual = ...
true
5c8a4489c5684c99c7525d2e88e93dd4285b795f
thepwagner/flotilla
/src/flotilla/agent/systemd.py
UTF-8
4,844
2.578125
3
[ "MIT" ]
permissive
import logging import os from flotilla.model import UNIT_PREFIX logger = logging.getLogger('flotilla') SYSTEMD_DEPS = ('Before', 'After', 'BindsTo', 'Wants', 'Requires') class SystemdUnits(object): def __init__(self, manager, unit_dir='/etc/systemd/system', env_dir='/etc/flotilla'): sel...
true
56b65e05752acb35efa9b21bf8f991edfd6e0c78
zhengsizuo/leetcode-zhs
/动态规划/股票问题/122-买卖股票最佳时机ii.py
UTF-8
517
3.4375
3
[]
no_license
class Solution: def maxProfit(self, prices: List[int]) -> int: # 0表示不持有,1表示持有 dp_i_0 = 0 dp_i_1 = -float('inf') for i in range(len(prices)): temp = dp_i_0 dp_i_0 = max(temp, dp_i_1 + prices[i]) # 今天不持有,可能是昨天就不持有,或者今天卖了 dp_i_1 = max(dp_i_1, temp - ...
true
00a6b9561c1a3bf280491ac102b1cad47ffcb2e7
swordwielder/python3
/codinggame/convertipaddressmod.py
UTF-8
125
3.09375
3
[]
no_license
w=input() a=0 b='' for i in w: a+=ord(i) j=2 c=a while j<6: b+=str(c%256)+'.' c=(a%256)*j j+=1 print(b[:-1])
true
11f0e85f253b87a9c87729372924fa52742ee51a
OguzcanKarakoc/Project2-Olympic-Games
/games/zeilen/BackgroundLayer.py
UTF-8
2,173
3.703125
4
[]
no_license
import pygame import games.zeilen.Globals as globals import games.zeilen.Resources as resources tiles = list() #Background class #The background class is basicly the water tile. Several instances of this are created and used to fill the screen with water. class Background(pygame.sprite.Sprite): scroll_speed = 1 ...
true
45de42b16ed77fad1f95d674a82fa51524535fa9
AdaCore/langkit
/testsuite/tests/properties/new_node/test.py
UTF-8
1,856
2.875
3
[ "NCSA", "LLVM-exception", "Apache-2.0" ]
permissive
""" Check node synthetization and a basic use of it in the Python API. """ from langkit.dsl import ASTNode, Field, T, synthetic from langkit.expressions import If, New, No, Self, langkit_property, lazy_field from utils import build_and_run class FooNode(ASTNode): pass class Literal(FooNode): token_node = ...
true
e33bcf2b256eed1376b36567772a8d4d00959db5
R0bk/advent-of-code-py
/2016/py/5.py
UTF-8
261
2.796875
3
[ "MIT" ]
permissive
import hashlib inp = open('../input/5.txt', 'r').read() print(''.join([hashlib.md5((inp + str(x)).encode()).hexdigest()[5] for x in range(10000000) if (hashlib.md5((inp + str(x)). encode()).hexdigest()[:5] == '00000')])[:8])
true
143bdc922549b5a4e339bba2a67635c8fe86c5ae
algoitssm/algorithm_taeyeon
/Baekjoon/1992_분할정복_쿼드트리.py
UTF-8
1,341
3.25
3
[]
no_license
import sys sys.stdin = open("input.txt") # 2630 이랑 비슷하게 품 def partition(video): global result ltop = [] rtop = [] lbottom = [] rbottom = [] if color_solve(video): if video[0][0] == '1': result.append(1) else: result.append(0) else: #네가지 방향으로 분리 필요 ...
true
925df986e7b92ebcb7069f4b9a5b6145acaf5c1f
daniel-reich/ubiquitous-fiesta
/dBqLSk6qvudNdZrSx_19.py
UTF-8
145
2.859375
3
[]
no_license
def is_boiling(temp): return int(temp.replace("C","")) >= 100 if "C" in temp else int(temp.replace("F","")) >= 212 if "F" in temp else False
true
b880879eb894fb8ecff6906bc409405855c1e72b
stevexxs/pythia
/pythia/core/streams/rates_analytics.py
UTF-8
1,822
3.109375
3
[]
no_license
from functools import reduce from math import sqrt ANALYSIS_STR_HEADER = " EXCHANGE | MEAN | SD | MEDIAN | MIN | MAX | DIF \n" \ "-------------------------------------------------------------------------\n" ANALYSIS_CSV_HEADER = "EXCHANGE,MEAN,SD,MEDIAN,MIN,MAX,DIF\n" cl...
true
4359aef393830d69436ca162bc9f969cf1b68ab3
rademacher-p/stats-learn
/src/stats_learn/results.py
UTF-8
31,646
2.640625
3
[ "MIT" ]
permissive
"""Assessment tools for learning and prediction performance.""" import inspect # from warnings import warn import logging import math import pickle import sys from contextlib import contextmanager from itertools import product from pathlib import Path from typing import Collection, Union import matplotlib.pyplot as ...
true
bcc9e160f85d2930361778398c605c13f970c3a5
gabriellaec/desoft-analise-exercicios
/backup/user_104/ch11_2019_06_06_14_53_51_672151.py
UTF-8
143
2.859375
3
[]
no_license
def celsius_para_fahrenheit(temperatura_celsius): temperatura_fahrenheit = (temperatura_celsius*(9/5))+32 return temperatura_fahrenheit
true
d9546aeab930b32aa543a6206f081480b466f6fc
avichai/euler_project
/euler_21.py
UTF-8
2,128
4.0625
4
[]
no_license
# Amicable numbers # Let d(n) be defined as the sum of proper divisors of n (numbers less than n which divide evenly into n). # If d(a) = b and d(b) = a, where a ≠ b, then a and b are an amicable pair and each of a and b are # called amicable numbers. # # For example, the proper divisors of 220 are 1, 2, 4, 5, 10, 1...
true
55e66cd34ffe4a939390affcc9fffc4203a3cb34
GengYuIsland/AcademicRecommendation_dlut
/AcademicRecommendation_Spider/Spider_data.py
UTF-8
6,521
2.546875
3
[]
no_license
import requests from lxml import etree import json class SpiderData(object): def __init__(self, path_name, path_term, num): # 大连理工大学机构知识库 self.url = 'http://dlutir.dlut.edu.cn/SearchResult/FilterPage' # 模拟成浏览器去访问网站,解决requests请求反爬问题 self.headers_name = { 'user-agent': ...
true
dfff2f0548caadcc50a3c87f12d23c34c9c52cbd
jerluc/envy
/envy/commands.py
UTF-8
2,031
2.625
3
[ "Apache-2.0" ]
permissive
# -*- coding: utf-8 -*- from __future__ import print_function from envy.env import Environment, ConfigurationException import envy.logger as log import click import os import subprocess import sys def create(basedir, recreate): env = Environment(basedir) if recreate: confirmation = click.style('Are y...
true
f538728eab376f4066b5613d7bfcbd326a5c6886
plgstalter/cplusplus
/notebooks/code/cython/pi_computer/benchmark.py
UTF-8
564
2.71875
3
[]
no_license
import time import pimodule_base as pb import pimodule1 as pb1 import pimodule2 as pb2 import pimodule3 as pb3 def performance(f, args, repeat=10): start = time.perf_counter() for _ in range(repeat): f(*args) stop = time.perf_counter() print(f"{f.__module__}::{f.__name__} mean time ({repeat}...
true
7c706ec33585786cd58a768811ee639f427eb953
vineetred/malwareDetection
/Legacy/scraping.py
UTF-8
505
2.734375
3
[]
no_license
import requests import time from googlesearch import search headers={'User-Agent': 'Mozilla/5.0'} i = 0 for url in search("filetype:doc doc", stop=None): try: res = requests.get(url, headers=headers) path = str(i) + '.doc' file = open(path, 'wb') for chunk in res.iter_content(1000...
true
8af18348b1591c9e4e58e5976ec72a96456be10f
rizban114406/Covid-19-Data-Analysis
/Analysis Code/World-Cases_Summary_Proportion_Today.py
UTF-8
1,423
2.953125
3
[]
no_license
import pandas as pd import numpy as np import matplotlib.pyplot as plt import matplotlib.ticker as mticker import matplotlib.dates as mdates from matplotlib import style def func(pct, allvals): absolute = int(pct/100.*np.sum(allvals)) return "{:.1f}%\n({:d})".format(pct, absolute) print(plt.style.available) s...
true
b59f41dd97f967e54a14ba9dff895113bc223eac
BhagyashreeKarale/list
/iteratingtwolists.py
UTF-8
694
4.21875
4
[]
no_license
# Iterating two lists # How to iterate on two lists together? # Let's say aapke paas do lists jo same length ki hai. # Aap unn do lists pe ek saath kaise iterate karoge? students = ['Rishabh', 'Madhurima', 'Rahul', 'Abhishek', 'Faizal', 'Muskaan'] marks = [10, 20, 56, 45, 36, 20] print (len(students)) print (len(mar...
true
08387261c2384c114a2c27a0182d54cdacc9816d
nall3n/pyCar
/carTest_V3.py
UTF-8
6,027
3.15625
3
[]
no_license
#!venv\Scripts\python.exe # -*- coding: utf-8 -*- import pygame from math import radians, cos, sin from pygame.locals import ( RLEACCEL, K_UP, K_DOWN, K_LEFT, K_RIGHT, K_ESCAPE, K_SPACE, KEYDOWN, KEYUP, QUIT, ) SCREEN_WIDTH = 1500 SCREEN_HEIGHT = 800 BLACK = (0,0,0) WHITE = (...
true
3b874790d022a057d80d84ad3eae4985cbf6ec66
junsoofeb/data-structure-implementation
/python_version/queue.py
UTF-8
1,334
3.96875
4
[]
no_license
class Queue(object): def __init__(self): self.items = [] def isEmpty(self): return not bool(self.items) def enqueue(self, item): self.items.insert(0, item) def dequeue(self): value = self.items.pop() if value is not None: ...
true
95887d23a4169a8a6be58387a644a808c618e3b6
Fierralin/python
/input0.py
UTF-8
62
3.15625
3
[]
no_license
a = input("input: ") print(a) b = input("input: ") print(b)
true
4eda79bb206e3da4ffbcf0e346d4d0634e2fd0da
nishanbose/datamanipulation
/week2/lab/si601_w15_lab2_nishan.py
UTF-8
6,947
3.640625
4
[]
no_license
#!/usr/bin/python -tt # -*- coding: utf-8 -*- # Written by Dr. Yuhang Wang for Lab 2 of UMSI SI 601 Winter 2015 class # A few lines of code are taken from Google's Python Class # http://code.google.com/edu/languages/google-python-class/ # Fill in the code for the functions below. main() is already set up # to call th...
true
25eba4034fada4abc1e090fb2d0a2d1df621dc8e
zabi-salehi/Coding-Problems
/Easy/Week 2/Problem Remove Target Value/remove_target_value.py
UTF-8
277
3.5625
4
[]
no_license
''' Week 2 - Problem Remove Target Value @author: André Gilbert, andre.gilbert.77110@gmail.com Given an array and a value, remove all instances of that value in-place and return the new length. ''' # input = [3,2,2,3], value = 3 # output = 2 array = [12, 1, 23, 12, 4, 2, 1, 23, 4, 4, 5, 2, 7] value = 4
true
ecf0e67322507d20cfdbee83109b01e5bb793387
correac/SIDM-fitting-profiles
/data/L006N188_SigmaConstant01/plot_halos/plotter.py
UTF-8
2,243
2.640625
3
[]
no_license
import numpy as np from pylab import * #from scipy.optimize import fsolve #from scipy.interpolate import interp1d def read_data(file): data = np.loadtxt(file) # Remove potential zeros before we begin nozero = data[:, 1] > 0 data = data[nozero, :] min_rho = np.log10(data[:, 1]) >= 3. data = data...
true
c2e76a0ed815fe2a2764018c5a9198379466e3f0
liuzhipeng17/python-common
/python基础/网络编程/套接字/udp_socket/简单udp/udp_server.py
UTF-8
510
2.78125
3
[]
no_license
# -*- coding: utf-8 -*- import socket socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) server_addr = ('127.0.0.1', 8080) socket.bind(server_addr) while True: # 通信循环 data, client_addr = socket.recvfrom(1024) print("接收到: %s" % data.decode('utf-8')) print("客户端地址: %s" % str(client_addr)) msg = i...
true
12554b8add9c0a88aaa921141be54283e0a21e69
ody1205/Daily-Coding
/Leetcode/top_100_liked_problems/6.py
UTF-8
1,219
3.875
4
[]
no_license
''' 6. ZigZag Conversion The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility) P A H N A P L S I I G Y I R And then read line by line: "PAHNAPLSIIGYIR" Write the code that will take a strin...
true
c8113bc200d33c1edb2a25cfdc99f43d643731f5
pranavkanade/persi-py
/Hackerrank/src/find-angle-mbc.py
UTF-8
223
3.34375
3
[]
no_license
import math if __name__ == "__main__": ab = int(input()) bc = int(input()) angle = math.degrees(math.atan(ab/bc)) print("%d\u00b0" % round(angle)) # round function is important. Also there is this math.ceil
true
49a9dcc3ada798991840f362fed5eceaadf4d0de
stronger-jian/learn_python3
/python/ten/t8.py
UTF-8
225
3.09375
3
[]
no_license
import re a= 'life is short, i use python,i love python' r=re.search('life(.*)python(.*)python',a) # r=re.findall('life(.*)python',a) print(r.group(0,1,2)) # print(r.group(1)) # print(r.group(2)) # print(r) print(r.groups())
true
07e4d8ecafa3e7479f6e42b7ec4a9364b11788da
cmmccolgan/rockpaperscissors
/rpsgame.py
UTF-8
3,640
4.40625
4
[]
no_license
''' Play Rock Paper Scissors against the computer This project was built as a final project to the Spring 2016 Intro to Python. This project is extremely basic so that I could implement the following components of the course: ''' import random #How the computer chooses '''Convert Computers Guess to a Score ~~~~~~~~...
true
e32a33250d88f3f66eb778f6df705a66cc100f83
Pearson-Advance/rocket-chat-extension
/rocketc/api_rocket_chat.py
UTF-8
7,287
2.953125
3
[]
no_license
""" This file contains the class with the necessary methods to use rocketchat """ import hashlib import json import logging import requests from rocketchat_API.rocketchat import RocketChat LOG = logging.getLogger(__name__) def handle_response(method, response, **kwargs): if response.status_code == 200: ...
true
e6f782431476fa9a9f9bb485cb5776cf96efaae7
cgmark101/pk2.py
/pk2Entry.py
UTF-8
596
2.609375
3
[ "MIT" ]
permissive
class pk2Entry(object): """description of class""" def __init__(self, unpacked): self.type = unpacked[0] self.name = unpacked[1] self.fixName() self.accessTime = unpacked[2] self.createTime = unpacked[3] self.modifyTime = unpacked[4] self.position = unpack...
true
28e1b9a2a82084442148e66e22313ff19a9977f6
wmm0165/mianshiti
/bishi/demo1.py
UTF-8
222
3.359375
3
[]
no_license
# -*- coding: utf-8 -*- # @Time : 2020/7/23 16:20 # @Author : wangmengmeng # 1.计算字符串最后一个单词的长度,单词以空格隔开。 # 输入:hello world 输出:5 a=input().split() print(len(a[-1]))
true
b88f7c7475448dc2b952ceb24564e2290566bd7b
camelCasedAdi/Python-Programming-Tutorials
/tutorial18.py
UTF-8
167
3.765625
4
[ "MIT" ]
permissive
# .find() and .count() password = input('Password: ') if password.find('p') == 4: print('You have a good password') else: print('You have a wrong password')
true
633a210b45c90a0dc3178718ff629859ed8d85ac
felipeheld/python
/queue.py
UTF-8
840
3.375
3
[]
no_license
#!/usr/bin/env python3 from nodes import SLLNode class Queue: def __init__(self): self.head = None self.tail = None self.size = 0 def enqueue(self, data): node = SLLNode(data) if self.head is None: self.head = self.tail = node else: sel...
true
efc616908f7a22b5010496c0e20adb39c259ba42
wypstudy/LeetCode-Python
/Algorithms/21.py
UTF-8
1,174
3.765625
4
[ "Apache-2.0" ]
permissive
# Definition for singly-linked list. class ListNode: def __init__(self, x): self.val = x self.next = None class Solution: def mergeTwoLists(self, l1, l2): """ :type l1: ListNode :type l2: ListNode :rtype: ListNode """ head = ListNode(-1) ...
true
44b9ae61f22682928daa5ee9c8f99bcf04f7f23f
ashish-5209/SortingAlgo
/mergeSort.py
UTF-8
1,850
4.5
4
[]
no_license
# MergeSort(arr[], l, r) # If r > l # 1. Find the middle point to divide the array into two halves: # middle m = (l+r)/2 # 2. Call mergeSort for first half: # Call mergeSort(arr, l, m) # 3. Call mergeSort for second half: # Call mergeSort(arr, m+1, r) # 4...
true
e04a5f49e701f7d7cfcd5e4e9b881af5579bbcd4
Sanket-Drake/Python-Learning
/time.py
UTF-8
160
3.15625
3
[]
no_license
import time from time import sleep def loop(): timestamp = int(time.time()) #Getting epoch time stamp print timestamp sleep(5) while True: loop()
true
68f27649582f74f407dd646ed16024097de834ff
hoanhan101/algorithms-playground
/python_practices/is_BST.py
UTF-8
2,551
4.6875
5
[ "MIT" ]
permissive
""" Is This a Binary Search Tree? (Python) Write a function that takes a binary tree and returns true if it is a binary search tree, and false if not. In our test code, we're going to use the following examples: head1 = 0 / \ 1 2 /\ /\ 3 4 5 6 head1 is NOT a binary search tree. head2 = 3...
true
c56484871ae052fd0113ffbcd6a6d6234d1eb290
kdjlyy/hw-for-AI
/exp1/foldmerge.py
UTF-8
2,742
2.96875
3
[ "MIT" ]
permissive
# -- kdjlyy 11/5/2020-- # # -------- Usage -------- # # - Step1: 建立一个dataset文件夹, 绝对路径替换第12行的datasetPath,合并后的训练集、验证集的图片、标签都在该目录下。 # - Step2: 将训练集目录的绝对路径替换第11行的filePath,运行第一次,生成了训练集的标签,并将训练集的图片和标签copy到创建的dataset文件夹。 # - Step3: 将验证集目录的绝对路径替换第11行的filePath,运行第二次,同上。 import os import shutil # filePath = r'C:\Users\kdjlyy\D...
true
bc1a953c085c40e2cfa58295f458191bb94c36af
marcosaraujo2020/ifpi-ads-algoritmos2020
/Lista_Prof_Fabio/Algoritmos_Exercicio-05-VETORES_MATRIZES/fb_ex5_q02.py
UTF-8
700
3.921875
4
[]
no_license
def main(): valor = int(input('Quantos valores deseja na lista? ')) vetor = [] i = 0 while i < valor: vetor.append(int(input('Informe um numero para a lista: '))) i += 1 analisar = verificar_elementos(vetor) print('=='*20) print(f'Lista de números >> {vetor}') if analisa...
true
7d7dc519d66bd7b8a15b7569a77eebb6bb354e87
MerosCrypto/Meros
/e2e/Vectors/Generation/Consensus/TwoHundredFour.py
UTF-8
1,785
2.515625
3
[ "MIT", "CC0-1.0" ]
permissive
#READ THIS BEFORE MAKING ALTERATIONS! #This has a single Block and a List of Blocks. #That said, the test acts as if it's a single chain (1 block + 1 block). #This format cannot be relied on to behave as it presents itself. from typing import List from hashlib import blake2b import json from e2e.Libs.BLS import Priva...
true
2ca59521faff73965a625cbd587ba06b16e78098
cec272/perfect_shot_backboard
/code/Final_Product/Python/system_iterator.py
UTF-8
2,586
2.59375
3
[]
no_license
# Harrison Hidalgo # ECE 5725 - Final Project # import iteration_variables as I_V import numpy as np import transformations from path_tracker import * import Geometric_Variables as GV def system_iterator(e_b,r_B0,r_GB0,h,x_ball_init,front,up,W_of_backboard,H_of_backboard,T_of_backboard,r_of_ball,center_hoop): # Cycl...
true
7bae56adf6259762a9f431677f552a3b11d3da88
YongGyunKwon/CBNU_machinelearning_lecture_example
/1to8/DBSCAN 군집화.py
UTF-8
414
2.8125
3
[]
no_license
from sklearn.datasets import make_moons from sklearn.cluster import DBSCAN import numpy as np from matplotlib import pyplot as plt X,Y = make_moons(n_samples=1000, noise=0.05) plt.title('Half moons') plt.scatter(X[:,0], X[:,1]) plt.show() dbs = DBSCAN(eps=0.1) Z = dbs.fit_predict(X) colormap = np.array(['r', 'b']...
true
f29eaa02517c096d6dbe3e5df8c6115710567577
FredrikM97/Sentiment-Analysis-of-Nordic-Languages
/MachineLearning.py
UTF-8
4,444
2.640625
3
[ "MIT" ]
permissive
''' Model creation for sentiment prediction of reviews ''' from __future__ import print_function print('Importing packages...') from sklearn.model_selection import train_test_split import pandas as pd from zipfile import ZipFile from gensim.models import KeyedVectors import os import sys stderr = sys.stder...
true
77a74530ef3bfa305132bc5d46a42406801b5ccd
lucassilva-2003/Cursoemvideo_Python_100exs
/ex036.py
UTF-8
594
4.0625
4
[]
no_license
# Aprovação de emprestimo cas = float(input('Qual o valor da casa? ')) sal = float(input('Qual sua renda mensal? ')) an = float(input('Em quantos anos você irá parcelar? ')) am = an * 12 par = cas / am s = sal * 0.30 print('Para pagar uma casa de {}R$ em {} anos, são necessárias parcelas mensais de {:.2f}R$'.for...
true
42432774804dea5b064e1fce161792f651f30753
DNeosphere/holbertonschool-higher_level_programming
/0x0B-python-input_output/2-read_lines.py
UTF-8
367
3.640625
4
[]
no_license
#!/usr/bin/python3 """ REad n lines """ def read_lines(filename="", nb_lines=0): """ read n lines, or the whole text """ count = 0 with open(filename, encoding='utf-8') as a_file: if nb_lines <= 0: print(a_file.read(), end='') else: for a_line in range(nb_lines): ...
true
d50b042e3949e0a05f90a34008127d43d26092c1
AndreMessi/learning-basic-python
/if elif else.py
UTF-8
449
3.734375
4
[]
no_license
nilai = 50 if nilai == 75: print("nilai anda",nilai) if nilai is 60: print("nilai anda",nilai) if nilai is not 60: print("nilai anda bukan: 60") nilai1 = 50 if 80 <= nilai1 <= 100: print("nilai anda A") elif 70 <= nilai1 < 80: print("nilai anda B") elif 60 <= nilai1 < 70: print("nilai anda...
true
254207991f8404b7b324ed5304d499e40e697c40
DataSenseAnalytics/OpenHCDP
/library/dsalib/module.py
UTF-8
1,699
2.515625
3
[]
no_license
from smv import SmvModule, SmvSqlModule from dsalib.provider import DsaModuleProvider class DsaPySparkModule(SmvModule, DsaModuleProvider): """Wraps SmvModule Provider fqn: mod.module.pyspark """ @classmethod def help_markdown(cls): return """#### PySpark Module Take multiple input d...
true
3dc54204d8a2e25f04aa0affdd45bb38f54714f8
michaelbeneamatobruno/BYU_BIO165_Introduction-to-Bioinformatics
/final.py
UTF-8
2,411
3.15625
3
[]
no_license
import re import sys #use a sys.argv for our output file, our genefile(called CORDfile here), and our outfile(where we'll be writing to) output = open(sys.argv[1], 'r') CORDfile = open(sys.argv[2], 'r') outfile = open(sys.argv[3], 'w') #make a bunch of lists for all the information we're going to have, we probably ...
true
72cfa7a7d802b229614ec9747852116f2596c0f5
lvhengani/sentinel2_data_download
/src/sen2cor_wrapper.py
UTF-8
4,215
2.53125
3
[]
no_license
#!/usr/bin/python import os import subprocess import logging import shutil import argparse import re import config import zipfile import json from datetime import date """ This script was generated for running in a docker container. Author: L M Vhengani Date: 2019-06-26 Purpose: Automatic processing of sen2cor version...
true
e6473a81df99e2f6c180b04f9712a81553c84a42
Tyler-Fitchett/Tyler-Fitchett.github.io
/RollingSim.py
UTF-8
6,900
3.140625
3
[]
no_license
import sys import time import random import pyodbc as pyodbc conn = pyodbc.connect( "Driver={ODBC Driver 17 for SQL Server};" "Server=DESKTOP-PUFFRBI;" "Database=Leaderboard;" "Trusted_Connection=yes;" ) def read(conn): print("Leaderboard format, Name, Wins, Losses, Ties") curs...
true
9b5a72fc20c02daeb74f0bdfe73b3aea8193b6b9
ceo1207/image-segmentation-keras
/visualizeDataset.py
UTF-8
2,318
2.859375
3
[]
no_license
import glob import numpy as np import cv2 import matplotlib.pyplot as plt import random import argparse import os def imageSegmentationGenerator(images_path, segs_path, n_classes): assert images_path[-1] == '/' assert segs_path[-1] == '/' images = sorted( glob.glob( images_path + ...
true
381636816fac39a3aa39d6603e7f719895c90b71
patelhrid/pythonminiprojects
/new exercise 4.py
UTF-8
160
3.921875
4
[]
no_license
num = int(input("Enter an integer: ")) a = range(1, num) list = [] for element in a: if (num%element) == 0: list.append(element) print(list)
true
821172a949fad32d82735f45b29a1e09f90588df
joporci/Biopython-1
/Exercises/Strings_in_depth/q11.py
UTF-8
721
4.4375
4
[]
no_license
#This program reads in the name, price, and quantity of an item, and stores it in a list of tuples, repeating until a blank product name is entered. It should then print out each item in a nicely formatted manner, using string interpolations. name = raw_input('Enter name of item: ') price = float(raw_input('Enter pric...
true
ec1fe7a93d3b42545707413d03a1ef3f58ea3afb
oleitao/reddit-detective
/reddit_detective/relationships.py
UTF-8
7,889
2.828125
3
[ "MIT" ]
permissive
from typing import Union from itertools import chain from reddit_detective.data_models import Relationships from reddit_detective.data_models import Comment, Submission, Subreddit, Redditor from praw.models import MoreComments def _link_nodes(first_id, second_id, rel_type, props_str): """ Using ids of two no...
true
e0979f0db2472bcbacb7a274dfa10702f4c45d6f
PeacefulAlien/Python_Version_Control_Exercise
/linear_search_ascending_number_list.py
UTF-8
1,071
4.46875
4
[]
no_license
#this is a special version of linear search #on a ascending number list #it takes in two arguments: item and number list #return the result if item is in the number list import random def linear_search_ascending_number_list(my_item, my_list): index_01 = 0 result = False stop = False while index_01 ...
true
c39440eac5cab04d55763e58a29749cfa247eb3a
workready/pythonbasic
/sources/t03/t03ej27.py
UTF-8
76
3.109375
3
[ "MIT" ]
permissive
ii = 0 while ii < 5: print(ii) ii += 1 if ii == 3: break
true
1632cd631e0826665a87b361a9b4bd435bba9782
Valrobotik/Outil-de-simulation-de-l-vitement-d-obstacle-m-thode-des-champs-de-potentiels-
/simultrajec_alpha.py
UTF-8
24,266
3.25
3
[]
no_license
### Outil de simulation de trajectoire ## VALROBOTIK - 2018 ## Importation des modules utilisés import tkinter as tk from tkinter import messagebox import time import numpy as np import matplotlib.pyplot as plt import math #################### #### Simulation #### #################### def zeros(n): # ...
true
c32b3fdd70765e65b070ed186684fb25f8618f3c
thomaskeck/senpai
/tests/test_senpai.py
UTF-8
1,720
2.703125
3
[]
no_license
#! /usr/bin/env python3 from senpai import senpai from senpai import commitment import unittest class TestCommunication(unittest.TestCase): def test_communication(self): alice = senpai.Alice() bob = senpai.Bob(alice.rsa.get_public_key()) for answer_alice in [True, False]: fo...
true
a14f1c6ffcdb7bcec15985d026e3d4d9d58b655c
henriquelino/pyrelay
/Data/StatData.py
UTF-8
1,845
2.640625
3
[ "MIT" ]
permissive
from Constants.StatTypes import * import Data.CompressedInt as CompressedInt types = StatTypes() class StatData: def __init__(self, statType=0, statValue=0, strStatValue="", secondaryValue=0): self.statType = statType self.statValue = statValue self.strStatValue = strStatValue ...
true
f8e207d6875825ed23c8981b87c24c40c50ab888
Shiv2157k/leet_code
/expedia/set_matrix_zeros.py
UTF-8
1,835
3.671875
4
[]
no_license
from typing import List class Matrix: def set_to_zero(self, grid: List[List[int]]) -> int: """ Approach: Space Optimization Time Complexity: O(M * N) Space Complexity: O(1) :param grid: :return: """ is_col = False rows, cols = len(grid), le...
true
c2e2d7598e850b9adb3f2b4f75cd45afed6cfb1c
doc22940/amp-github-apps
/project-metrics/metrics_service/metrics/release_granularity.py
UTF-8
2,181
2.75
3
[ "LicenseRef-scancode-generic-cla", "Apache-2.0" ]
permissive
"""Release Granularity metric.""" import logging import sqlalchemy from typing import Text, Dict from database import db from database import models from metrics import base class ReleaseGranularityMetric(base.Metric): """A metric tracking the average number of commits between releases.""" UNIT = 'commits/rele...
true
dcdaf27733b8d0c2a192e294568a1a7ff521bcea
JyotiKumar-Poddar/flask-app-1
/app.py
UTF-8
4,050
2.65625
3
[]
no_license
import null as null from flask import Flask, jsonify, abort, request from flask_cors import CORS app = Flask(__name__) cors = CORS(app) data = [ { "id": 1, "employee_name": "Tiger Nixon", "employee_salary": "320800", "employee_age": "61", "profile_image": "" }, { ...
true
2c48ea3c09044c42b3bccf874adb568a1c9dacd9
karlandren/NLP
/lab5/RandomIndexing/random_indexing.py
UTF-8
8,473
3.015625
3
[]
no_license
import os import argparse import time import string import numpy as np from halo import Halo from sklearn.neighbors import NearestNeighbors class RandomIndexing(object): def __init__(self, filenames, dimension=2000, non_zero=100, non_zero_values=[-1, 1], left_window_size=3, right_window_size=3): ...
true
6c3cace1a80968f0d4b790c9139a2fc2c0cf3fe1
NoahBamberger/Differential-Drive-Path-Planning
/trajectory.py
UTF-8
21,923
3.28125
3
[]
no_license
<<<<<<< HEAD # -*- coding: utf-8 -*- """ Created on Sat Apr 18 14:05:15 2020 @author: Noah Bamberger This program will generate a wheel velocity trajectory for a differential or "tank" drive robot from a cubic spline path from the path file in this library. It does this by iterating over a list of velocities indexed ...
true