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
2999beeb285486fef8753039fa5772ebfd9e0062
davidrios/mandel-exps
/m2.py
UTF-8
890
3.015625
3
[]
no_license
import sys def run(size, max_iteration, canvas, out=sys.stdout): x_center = -1.39965 y_center = 0.0 out.write("P5\n%d %d\n255\n" % (size, size)) for j in xrange(size): for i in xrange(size): x = x_center + canvas * float(i - size / 2) / size y = y_center + canvas * flo...
true
6cc490cf735d0f23bfa70b51d32a549b4b43526b
zyw400/NimbusML-1
/src/python/nimbusml/examples/FastLinearRegressor.py
UTF-8
1,481
2.65625
3
[ "MIT" ]
permissive
############################################################################### # FastLinearRegressor from nimbusml import Pipeline, FileDataStream from nimbusml.datasets import get_dataset from nimbusml.feature_extraction.categorical import OneHotVectorizer from nimbusml.linear_model import FastLinearRegressor # data...
true
bf15fa255167429afc6418d22f226eb58a033bc3
dhruvkhanna98/Leetcode-Solutions
/ValidPerfectSquare.py
UTF-8
477
3.8125
4
[]
no_license
class Solution: def isPerfectSquare(self, num: int) -> bool: # Base case if num == 0 or num == 1: return True start = 0 end = num while start <= end: mid = (start + end) // 2 if mid*mid > num: ...
true
c2b85416ca79a6f4dcb1a33c203f90aef3d4a976
952079739/Vision
/utils/video_frame.py
UTF-8
603
2.640625
3
[]
no_license
import cv2, shutil def capture(video, output): vc = cv2.VideoCapture(video) c = 0 timeF = 1000 if vc.isOpened(): rval, frame = vc.read() else: rval = False shutil.copy("static/img/pure.jpg", output) timeF = 1000 while rval: rval, frame = vc...
true
6d3b5e9b2bf21b2ee5680d9a64cfc48127376e04
brettviren/ersatz
/tests/test_pipe.py
UTF-8
1,038
2.640625
3
[]
no_license
import simpy import random from ersatz.net import Pipe, Message from ersatz import units def producer(env, pipe, ident, delay=0): count = 0 while True: yield env.timeout(delay) tx = yield pipe.send() msg = Message("producer","consumer",units.GB, count=count, time=...
true
5c1dd05aa99cf1a0a2191a27938c6df2e32090f4
michaelJwilson/LBGCMB
/dropouts/madau/madau.py
UTF-8
4,514
2.890625
3
[]
no_license
import numpy as np def lephare_madau(rwl, z): ''' Input: Rest wavelength, redshift. Output: Return the madau extragalactic extinction (by neutral hydrogen) curve shipped with Le Phare. ''' from scipy import interpolate if z > 8.0: raise ValueError("Le Phare ...
true
628d72d68b8030efb092157bccbf813b9a7ce902
WuyangLI/CarND-Behavioral-Cloning-P3
/data_processing.py
UTF-8
1,947
2.96875
3
[]
no_license
import numpy as np from PIL import Image import csv IMG_DIR = './IMG/' def flip_img(img_dir, org_name, org_image, org_angle, rows): flipped_img_name = img_dir + 'FLIP_' + org_name flipped_img = org_image.transpose(Image.FLIP_LEFT_RIGHT) flipped_img.save(flipped_img_name, 'jpeg') rows.append([flippe...
true
e237393d1bc65215de532bbe937ccb3fd8e2c25e
shoaibur/Tutorials
/LeetCode/Trees/max_depth_binary_tree.py
UTF-8
337
3.28125
3
[]
no_license
class Node: def __init__(self, data): self.data = data self.left = None self.right = None def max_depth_binary_tree(tree): if not tree: return 0 left_depth = max_depth_binary_tree(tree.left) right_depth = max_depth_binary_tree(tree.right) return max(left_depth, right...
true
a3b3c2dd48afbacb918c6acb6ed138bbd34a22a8
paresh1804/Python-DataAnalytics
/visualize.py
UTF-8
245
2.859375
3
[]
no_license
import matplotlib.pyplot as plt from datetime import datetime fig,ax=plt.subplots() print(fig) print(ax) # x=[1,2,3,4,5] # y=[2,4,6,8,10] # y2=[1,2,3,4,5] # ax.bar(x,y2) # plt.show() ts=int(1613692800.0) print(datetime.utcfromtimestamp(ts))
true
8a6cb5091b959ba80c33f2157562cd0133bdf68f
whisper0077/programming-contests
/codeforces/div3/693/B.py
UTF-8
270
2.71875
3
[]
no_license
for t in range(int(input())): n = int(input()) *a, = map(int, input().split()) ans = "No" if n % 2 == 0: if sum(a) % 2 == 0: ans = "Yes" else: if a.count(1) >= 2 and sum(a) % 2 == 0: ans = "Yes" print(ans)
true
3733e9c845de7a24f97dbf690d2ea25cb72cb645
RaviRaaja/Automatic-Attendance-using-Raspberry-Pi-3B
/csv2tsv.py
UTF-8
373
2.9375
3
[]
no_license
# here is example of running python script in bash import sys import csv tabin = csv.reader(sys.stdin, dialect=csv.excel_tab) commaout = csv.writer(sys.stdout, dialect=csv.excel) for row in tabin: commaout.writerow(row) Here is a simple wrapper Bash script to run the conversion in batch: for file in *.tsv do...
true
7ec752d32ab31de6c806421f889e171c6d450b58
JeffersonLab/hps-java
/steering-files/src/main/scripts/test_steering_files.py
UTF-8
2,567
2.734375
3
[]
no_license
#!/usr/bin/env python """ This script performs a dry run test on all the steering files in this module. """ # imports import re, fnmatch, os, sys, subprocess from sets import Set # the jar that will be run which can optionally be set as the command line argument jar = "~/.m2/repository/org/hps/hps-distribution/${pr...
true
62d991f43c2de338cf82add0492759e845dda882
indiff/mysqladmin-tools
/ansible/sites/mysql-toolkits/script/mysql_function_test.py
UTF-8
1,819
2.65625
3
[]
no_license
import pymysql.cursors import time import sys def get_connection(): return pymysql.connect(host='192.168.1.210', user='admin', password='aaaaaa', db='db_dba', charset='utf8mb4', c...
true
9fac38119c115d5a23c7206b917a45e714b9ce82
EvilSpeedcore/alien_invasion
/alien_invasion/code/ship.py
UTF-8
3,196
3.515625
4
[]
no_license
import pygame class Ship(): """Class, which represents playable character in game - ship.""" def __init__(self, ai_settings, screen): """Initialize ship. Args: :param ai_settings: Instance of Settings class. :param screen: Display Surface. """ ...
true
0a2aea242018a840a33a19093f8bda34ddd52ff9
Color4/knowledge-database
/PMKB/python code/PKMB_web_scrape.py
UTF-8
1,710
2.703125
3
[]
no_license
import urllib from lxml import html import requests import csv import urllib.request as ur base_link = 'https://pmkb.weill.cornell.edu/therapies/' n_pages=416 filename = "PMKBcitations.csv" # opening the file with w+ mode truncates the file f = open(filename, "w+") f.close() #numbers 142,190,191,192,213,248 dont exist...
true
76e37d1545419f513525f5553e38907884364f65
asket888/python_screenshot_comparison_tool
/run.py
UTF-8
945
2.671875
3
[]
no_license
import sys from app.screenshot_comparator import compare_screenshots from app.webdriver import Driver class Run(Driver): def __init__(self, env): super().__init__(env=env) def run(self): try: app_code = self.env["app_code"] reference_screenshot_name = app_code + "_re...
true
3e77305606233d311ca674c0fd4f89c6d687acf8
AnkurAjitVarma/huffmandict
/Example.py
UTF-8
437
2.9375
3
[]
no_license
from EntropyCoding import huffmandict symbols = ['A0', 'A1', 'A2', 'A3', 'A4', 'A5', 'A6', 'A7'] probabilities = [0.25, 0.2, 0.15, 0.12, 0.1, 0.08, 0.05, 0.05] dictionary, avg_len = huffmandict(symbols, probabilities) print('%-10s\t%-10s\t%-10s'%('Symbols','Probabilities','Codewords')) for n, i in enumerate(dictionary)...
true
dbb0eedefe73bcfb74598c0aac383fb84c2a83ec
nss-day-cohort-33/keahua-arboretum-kaholo-dancers
/actions/release_animal.py
UTF-8
7,325
3.53125
4
[]
no_license
from animals import * def release_animal(arboretum): # animal = None print("1. River Dolphin") print("2. Happy-Face Spider") print("3. Pueo") print("4. Ulae") print("5. Gold Dust Day Gecko") print("6. Nene Goose") print("7. Kikakapu") print("8. Ope'ape'a") print("9. Main Menu")...
true
8e867b8db7fadf40911695a95683c9b4cd0ee313
VargasM/Sistemas_Inteligentes
/data_analysis.py
UTF-8
5,487
3.0625
3
[]
no_license
import pandas as pd import seaborn as sns import matplotlib.pyplot as plt import numpy as np from utils import * ''' Function load data This function is used to load the dataset, we are using different sources, in this function we concat this datasets into one Parameters: None Return Data: DataSet ''' de...
true
f12926c8d69d7442b5954ec3e644147236db0aa3
DaniDiazTech/Platzi-Basic-Python-course
/palindrome.py
UTF-8
290
4.0625
4
[ "MIT" ]
permissive
def palindrome(string): string = string.lower().replace(' ', '') return string == string[::-1] def main(): is_palindrome = palindrome(input('Your string: ')) print("Yep it's palindrome" if is_palindrome else "No it's not palindrome") if __name__ == '__main__': main()
true
94d641b0211d3aed31665dde422f954bdabc4f76
yiseo-lab/youtube-api
/getDataYoutube-v.0.5.py
UTF-8
9,579
2.84375
3
[]
no_license
# -*- coding: utf-8 -*- # Sample Python code for youtube.videos.list # See instructions for running these code samples locally: # https://developers.google.com/explorer-help/guides/code_samples#python import os import csv import googleapiclient.discovery DEVELOPER_KEY = "AIzaSyBIUVW5T4snLgw0A87q-XOlRqHdPfW...
true
c9d0963f898cf099db3f1f53586a5c39bbfac8db
tectronics/dicom-sr-qi
/inquiries/syngo_stats.py
UTF-8
2,982
2.59375
3
[ "BSD-2-Clause" ]
permissive
from srqi.core import inquiry from srqi.core import Parse_Syngo, my_utils from datetime import date import matplotlib.pyplot as plt from scipy.stats import anderson import math def get_count_fig(date_bins, sprocs, sprocs_with_fluoro): fig = plt.figure() counts, bin_edges, _ = plt.hist([p.dos_start...
true
383b66b0b9023631638fad3454839a3327f91bab
rulinqi/data_ming_py3
/data_lect_examples/nltk_6.py
UTF-8
6,511
3.578125
4
[]
no_license
# -*- encoding: utf-8 -*- import nltk from nltk.corpus import brown # 需要下载brown语料库 引用布朗大学的语料库 import jieba from nltk.stem import WordNetLemmatizer from nltk.corpus import stopwords from nltk.classify import NaiveBayesClassifier from nltk import FreqDist from nltk.text import TextCollection def run_main(): print...
true
11c44c713cd2c41cf6560c0e6c867dc627bd54ff
adolfoDT/FrameworkSciencetest
/tools/notifications.py
UTF-8
2,243
2.703125
3
[]
no_license
import boto3 def send_email(companies_names): print("enter") companies_names = " ,".join([company for company in companies_names]) SENDER = "FrameworkScienceTest <diaz.taracenaAWS@gmail.com>" AWS_REGION = "us-east-2" SUBJECT = "WARNING!" CHARSET = "UTF-8" emails = ["diaz.taracenaAWS...
true
14d53023a7b7454a36d802d6cad231c46fc6c32f
yashviradia/project_lpthw
/lpthw/ex38.1.py
UTF-8
378
3.625
4
[]
no_license
print("""Here's the list of countries sharing the border with the Germany including Germany.""") land = ['Deutschland', 'Daenmark', 'Der Schweiz', 'Oesterrich', 'Niederlaender', 'Belgium', 'Luxemburg', 'Polen', 'Czech Republik'] print(land) print(land[0:5:2]) print(land[0:7:3]) print(land[0:8:8]) print...
true
573c325d024db56abca0499aa36cf883d0f8415c
ddomb/web_ssh_terminals
/runners.py
UTF-8
4,822
2.84375
3
[]
no_license
import json import logging from logging import getLogger, DEBUG from pexpect import spawn, pxssh, EOF from pexpect import TIMEOUT as READING_TIMEOUT_EXCEPTION class RemoteRunner(object): """Represents a generic runner that holds an interactive process. Runner is a process that has a job and can be interacti...
true
fe9053514aa5d3a4eba7a75690d196633c861657
pgreisen/pythonscripts
/develop/cluster/backup/kmeans.py
UTF-8
581
2.921875
3
[]
no_license
from pylab import plot,show from numpy import vstack,array from numpy.random import rand from scipy.cluster.vq import kmeans,vq # data generation data = vstack((rand(150,2) + array([.5,.5]),rand(150,2))) print data # computing K-Means with K = 2 (2 clusters) centroids,_ = kmeans(data,2) # assign each sample to a clu...
true
053cab180b5c53304568dc29e99e4609b7d9d7a3
liudonghua123/pyqt5-calculator
/calculator1.py
UTF-8
1,884
2.953125
3
[ "MIT" ]
permissive
#coding: utf-8 import sys from PyQt5.QtWidgets import QWidget, QGridLayout, QLineEdit, QPushButton, QApplication class Calculator(QWidget): def __init__(self): super().__init__() self.initUI() def initUI(self): # 使用grid布局显示界面 grid = QGridLayout() self.setLayout(grid) ...
true
9ff75749281cb650126675c04562baedae58e59f
dr-dos-ok/Code_Jam_Webscraper
/solutions_python/Problem_135/3003.py
UTF-8
714
3.296875
3
[]
no_license
import sys def rline(f=str): return f(sys.stdin.readline()) def sline(f=str): return [ f(elem) for elem in rline().split(' ') ] def test(row1, row2): inter = row1 & row2 if len(inter) == 0: return 'Volunteer cheated!' if len(inter) > 1: return 'Bad magician!' for elem in inter...
true
774ad39046d9bb3308bfed7f89ddb8701df43f25
jmeyn/grades
/pyGrades.py
UTF-8
7,948
3.671875
4
[]
no_license
""" Python version of the Grades program """ import pickle from datetime import datetime from difflib import get_close_matches from os import system class Grade: def __init__(self, name, score, maxScore, date, late=False): self.name = name self.score = score self.maxScore = maxScore ...
true
f66126e074a3df04104989124d2ba774623b1ce8
HackerDom/ructf-2019
/checkers/index/zip_utils.py
UTF-8
994
2.796875
3
[]
no_license
import random from io import BytesIO from typing import Tuple from zipfile import ZipFile from utils.randomizer import Randomizer def create_zip() -> Tuple[str, str, bytes]: b = BytesIO() filename = f'{Randomizer.word()}.zip' file_in_zip = Randomizer.word() with ZipFile(b, 'w') as z: z.filena...
true
6d5d7377079f154d599e482e467e0e97f4fc2e79
omersl/mysolves
/fibonacci.py
UTF-8
62
2.984375
3
[]
no_license
a,b = (0,1) while b <= 4000000: a,b = b, a+b print(b)
true
a6236b7ffcc07e3ee6c5c4fd8f75ede61ffde8c8
Messhias/python-codes
/7.1.py
UTF-8
109
3.359375
3
[]
no_license
car = input("What kind of car you want rent?\n") print("\nLet me see if I can find a " + car + " for you.")
true
c19d61cb80c39f207fe026f52e008ff963c16b9b
921kiyo/codefirst-flask
/simple_app/cat.py
UTF-8
219
2.828125
3
[]
no_license
# Source: https://www.asciiart.eu/animals/cats def print_cute_cat(): print " /\_/\ ___" print " = o_o =_______ \ \ " print " __^ __( \.__) ) " print "(@)<_____>__(_____)____/"
true
473dea5bbea5695e6e54ae776b6c91a10bc65288
FiodorGrecu/Exercises
/introduction_to_python/classes/3_inheritance/Solution/.model_solution.py
UTF-8
572
4.03125
4
[]
no_license
class Person(object): # Constructor def __init__(self, name): self.name = name # To get name def getName(self): return self.name # To check if this person is employee def isEmployee(self): return False def __str__(self): return 'Pers...
true
a69319dedaca5e11fc40da5651ea99f5e78e09c7
cesar0205/hidden_markov_models
/hmmd_classifier.py
UTF-8
3,691
3.546875
4
[]
no_license
import tensorflow as tf import numpy as np from nltk import word_tokenize, pos_tag from sklearn.utils import shuffle from hmmd_tf import HMMD #Example of how to use generative models such as hidden markov models for classification def get_data(): # Because the vocabulary will be too large compared to the relativ...
true
cb029b7871e6fddddabc81e23148504730af8c82
PolyglotSymposium/pyfreeverse
/freeverse/freeverse.py
UTF-8
4,168
2.703125
3
[ "MIT" ]
permissive
from .expectations import ActualValue from .test import Step class Result: def __init__(self, description, error, children=None): self.__description = description self.__message = error self.__children = children def description(self): return self.__description def passed(...
true
c8da8bb40376b3e7ac7b4a332bfb817709dacdc3
MaertHaekkinen/neural-nets-2020
/create_train_and_validation.py
UTF-8
4,233
3.265625
3
[]
no_license
import random import os def get_folder_names_dict(path, difficulty): """ Returns: dict: dictionary, where keys are NON test folder names and values represent the number of image sequences given folder contains dict: dictionary, where keys are TEST folder names and values represent the number...
true
26602e629c7d0e424bf64730a469cc4a923e7bd8
Hopw06/Python
/Python_Deep_Dive/Part 2/4.IterablesAndIterators/7.SortingIterables.py
UTF-8
1,139
3.640625
4
[]
no_license
import random class RandomInts: def __init__(self, length, *, seed=0, lower=0, upper=10): self.length = length self.seed = seed self.lower = lower self.upper = upper def __len__(self): return self.length def __iter__(self): return self....
true
82e55697fbd6eb3dd1720b1cb9bd0d7d41e300a5
msarch/py
/py ref/pyglet/swiftless-ogl-tutotials.zip Folder/18_push and pop.py
UTF-8
2,264
3.34375
3
[]
no_license
#!/usr/bin/env python """ Lesson: How to Pop and Push Matrices with the OpenGL API Original Source for this lesson: http://www.swiftless.com/tutorials/opengl/pop_and_push_matrices.html Notes: none Dependencies: python: hrrp://www.python.org Pyglet: http://www.pyglet.org Converted to pyglet i...
true
82dcc3d01780c0dc8d782e8d14a9688a8f53f2a6
HannahMather/Project
/DPPE.py
UTF-8
897
2.859375
3
[]
no_license
import numpy as np V = np.zeros((4, 6)) # top to bottom rows are C, S, M, F V[0][0] = 50 V[1][0] = 50 V[3][0] = 50 theta = 0.05 alpha = 0.1 gamma = 0.9 r = np.array([[-10], [-5], [-4], [-3]]) crash = np.array([[0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0] , [0, 0, 0, 0.3, 0, 0], [0, 0, 0, 0.5, 0.3, 0...
true
4de58601460d7ea1e5590131574bdc92c8952b54
Ahnseungwan/Phython_practice
/2021.01/1.13/1.13 람다.py
UTF-8
728
4.28125
4
[]
no_license
# def call_10_times(func): # for i in range(10): # func() # def print_hello(): # print("안녕하세요") # call_10_times(print_hello) # map , filter # def power(item): # return item * item # def under_3(item): # return item < 3 # list_input_a = [1, 2, 3, 4, 5] # output_a = map(power, list_input_a) #...
true
38c46db7fe2972de52aa63e2cca656d8d4bbc768
DaHuO/Supergraph
/codes/CodeJamCrawler/16_0_1/ocozalp/sheep.py
UTF-8
575
3.375
3
[]
no_license
def solve(n): visited = set() digits = set() number = n while True: if number in visited: return 'INSOMNIA' number2 = number while number2 > 0: digits.add(number2 % 10) number2 /= 10 if len(digits) == 10: return str(number...
true
f1f65fb1cdeff7768a6a26d52db7d5e84b132918
Gulnaz-Tabassum/hacktoberfest2021
/Python/sorting_Algorithms.py
UTF-8
3,852
4.15625
4
[ "CC0-1.0" ]
permissive
#Insertion sort,Merge sort and quicksort def insertion_sort(array): # Loop from the second element of the array until # the last element for i in range(1, len(array)): # This is the element we want to position in its # correct place key_item = array[i] # Initialize the vari...
true
61c11727ec9dd97ee5bc5eec6dea512349bbb961
mattott/Project-Euler
/problem05.py
UTF-8
937
3.84375
4
[]
no_license
"""2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder. What is the smallest positive number that is evenly divisible by all of the numbers from 1 to 20?""" class DivisibleRange: def __init__(self, r): self.r = r def findSmallest(self): ...
true
11dceaffe7f42727c70ca112f07ff179c9622245
bunyodazimov/python-vazifalar
/10_if_else.py
UTF-8
942
3.453125
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Sat Jun 19 10:24:53 2021 @author: NITRO """ #1-amaliyot cars=['toyota','huyundai','mazda','gm','kia'] for car in cars: if car=='gm': print(car.upper()) else: print(car.title()) #2-amaliyot for car in cars: if car !='gm': print...
true
455318ac209c340b1fd18234d337b61febc7b448
OMEGA-Y/CodingTest-sol
/solution/2447(별 찍기 - 10).py
UTF-8
1,000
3.640625
4
[ "Apache-2.0" ]
permissive
import sys sys.setrecursionlimit(10**6) input = sys.stdin.readline def isSame(x,y,N): if N==3: arr[x+1][y+1] = " " return for i in range(x,x+N,N//3): for j in range(y,y+N,N//3): if i == x+N//3 and j == y+N//3: for m in range(i,i+N//3): f...
true
301560efa6c549ca1453ff3bed0ed5b31a6e6adf
Lei9999/Python
/Work/files_operation1.py
UTF-8
437
3.25
3
[]
no_license
# -*- coding: utf-8 -*- """输入一个文件名,将"OK"写入该文件中并保存在当前目录下""" inputFileName = input('请输入文件名:') # helloFile = open(input1, 'w') with open(inputFileName, 'w') as target: target.write('OK') # 将“OK”写入文件中 # file_dir = r'C:\Users\Lei\Desktop\192.168.0.1_20210107_20:37:32.txt' # with open(file_dir, mode='w', encoding='ut...
true
2f52a36f6f8b2f00d4282c68ddab9f93c337719e
zanoni/python_proway
/exemplos/19-09-24exemp.py
UTF-8
93
3.703125
4
[]
no_license
num = 0 while num < 10: num += 1 print(num) for i in range(0, 10): print(i + 1)
true
aa9426a61b8473bd4fd1c1ad6dba73af6e8c2a6a
cs1951a-s20-brown/cs1951a-s20-brown.github.io
/projects/project_analysis/No Name/cleaning.py
UTF-8
2,819
2.53125
3
[]
no_license
import requests import sqlite3 import urllib import os, glob import pandas as pd degree_dict = {11: 'farming agri', 13: 'environmental work', 14: 'architecture', 15: 'ethnic civ studies', 19: 'communications', 20: 'Communication technologies', 21: 'Computer science', 22: 'COSMETOLOGY SERVICES AND CULINA...
true
99eedcaa712cd8ba32a2cf2faa823f3f0311b3d2
haliphax/ncfacbot
/ncfacbot/raid.py
UTF-8
11,688
2.546875
3
[ "MIT" ]
permissive
"Raid scheduling/announcing command" # stdlib import asyncio as aio from datetime import datetime, timedelta, timezone from functools import partial import math import time # 3rd party from discord import Embed from discord.colour import Colour from discord.ext.commands import check, Cog, command from sqlitedict impor...
true
d9970c1b09b018b30559ee47d0232dba0cd31b02
jamesonquinn/java2python
/j2py/rename.py
UTF-8
822
2.53125
3
[]
no_license
#!/usr/bin/env python #-*- coding:utf-8 -*- from aterm import * import sys """ rename ids, class -> __class__ etc ... """ DEBUG = False def rename_ids(ast): """ """ ren = { # "String" : AString("String") } for tn in ast.findall("TypeName"): if tn[0][0] in ren.keys...
true
1b21fb81a3e00420f41eefd0ce71f59c229162d3
mathi98/madhu
/factor.py
UTF-8
61
3.15625
3
[]
no_license
k=int(input()) a=1 for i in range(1,k+1): a=a*i print(a)
true
98e912c719b0349ce7046174ff7bdb74523a789e
ZhaoXiaopeng1979/shiyanlou
/Code/shiyanlou/shiyanlou/spiders/github.py
UTF-8
1,841
2.671875
3
[]
no_license
# -*- coding: utf-8 -*- import scrapy from shiyanlou.items import GithubItem import re class GithubSpider(scrapy.Spider): name = 'github' #allowed_domains = ['github.com'] @property def start_urls(self): url_tmpl = 'https://github.com/shiyanlou?page={}&tab=repositories' return (url_tmp...
true
5294edc2e9a920370a3170ed19c1c7580614b37e
romulopro/thinkInPython
/Cap9/Exercise9-7.py
UTF-8
839
3.421875
3
[]
no_license
''' Created on 8 de mai de 2018 @author: Romulo ''' def three_consecutive_pairs(word): flag = 0 numOfConsecutivePairs = 0 #print(len(word)) for x in range(0,(len(word)-1)): #print(word[x], x) if(word[x] == word[x+1] and flag == 0): flag = 1 numOfConsecutivePairs ...
true
10b48648a1f3d5f6daf519ecb1521fc1d6e2bffd
Mathieu-WHAAAT/DK-labyrinthe
/dklabyrinthe.py
UTF-8
3,027
3.140625
3
[]
no_license
""" Jeu Donkey Kong Labyrinthe Jeu dans lequel on doit déplacer DK jusqu'aux bananes à travers un labyrinthe. Script Python Fichiers : dklabyrinthe.py, classes.py, constantes.py, n1, n2 + images """ import pygame, sys from pygame.locals import * from constantes import * from classes import * from foncti...
true
b73e157d02fba22fc2bf938441f91910e66b4f40
JingkaiTang/github-play
/world/fact/woman/different_point/same_time/long_case.py
UTF-8
240
2.609375
3
[]
no_license
#! /usr/bin/env python def time_and_small_hand(str_arg): next_government(str_arg) print('hand_and_small_year') def next_government(str_arg): print(str_arg) if __name__ == '__main__': time_and_small_hand('young_problem')
true
350d47d58583d862b6fda48292b60a483408640c
garytryan/dp
/python3/lecture6/lecture6_part1.py
UTF-8
503
4
4
[]
no_license
# Problem: # Climbing Stairs (k steps, space optimized) # You are climbing a stair case. It takes n steps to reach to the top. # Each time you can climb 1..k steps. # In how many distinct ways can you climb to the top? # Time complexity: O(nk) # Space complexity: O(k) def climbStairsKSteps(n: int, k: int) -> in...
true
24753eb48125cf447ab53cacb0e4759f91b485d2
SamuelCezario97/Python3-COURSERA
/imprime_retangulos_vazado.py
UTF-8
1,030
3.46875
3
[]
no_license
largura = int(input("digite a largura: ")) altura = int(input("digite a altura: ")) while largura > 0: if altura == 1: print("#" * largura,end="\n") largura = 0 else: if altura == 2: print("#" * largura,end="\n") print("#" * largura,end="\n") ...
true
c490dce1feff53bbfd5f79614268081605f63443
nan-san/Django-CRUD-003
/boards/tests.py
UTF-8
1,568
2.53125
3
[]
no_license
from django.urls import reverse, resolve from django.test import TestCase from .views import home, board_topics from .models import Board # Create your tests here. class HomeTests(TestCase): def setUp(self): self.board = Board.objects.create(name='Django', description='Django board.') url = reverse...
true
87bb1873b36b3335ad97bae28737befaab1e0c15
martineza96/recipe-reccomender
/rec_up.py
UTF-8
6,275
2.515625
3
[]
no_license
from flask import Flask, render_template, request, redirect, url_for import pandas as pd import numpy as np from sklearn.preprocessing import StandardScaler from sklearn.metrics.pairwise import cosine_similarity import random import ast import nltk import re app = Flask(__name__) app.debug = True sent_tokenizer = ...
true
86c63c5649df4d5b97c6a423837c216053ec3e79
Kawser-nerd/CLCDSA
/Source Codes/AtCoder/abc096/A/4927631.py
UTF-8
80
2.75
3
[]
no_license
l = [int(i) for i in input().split()] print(l[0] if l[0] <= l[1] else l[0] - 1)
true
c9ca283793ad69ecd91185a10c21a242c71ae272
iamsethsamuel/AI
/NLP/index.py
UTF-8
536
2.90625
3
[]
no_license
import tensorflow as tf from tensorflow import keras from tensorflow.keras.preprocessing.text import Tokenizer from tensorflow.keras.preprocessing.sequence import pad_sequences sentences = [ "I love you","I love my dog", "I love me" ] tokenizer = Tokenizer(num_words=100,oov_token="<OOV>") tokenizer....
true
054d141e2eeb248507cb8114b219b5e2fc09f519
xhwupup/xhw_project
/2_Add Two Numbers.py
UTF-8
1,462
3.546875
4
[]
no_license
# 时间:20190427 # Example: # Input: (2 -> 4 -> 3) + (5 -> 6 -> 4) # Output: 7 -> 0 -> 8 # Explanation: 342 + 465 = 80 # 难度:Medium(0.5) class Solution: def addTwoNumbers(self, l1: ListNode, l2: ListNode) -> ListNode: if l1 is None: return l2 if l2 is None: return l1 tmp...
true
109144d061052452f197960b09ab06106fb60f5a
daisein/Coursera-PY4E-UMICHIGAN
/regex1.py
UTF-8
496
3.90625
4
[]
no_license
# The basic outline of this problem is to read the file, look for integers using the re.findall(), looking for a regular expression of '[0-9]+' and then converting the extracted strings to integers and summing up the integers. numbers = list() import re fh = open('regex_sum_316177.txt') for line in fh: line = lin...
true
1684a20431e119453f150a46a3cb7dc715e4591f
stefanmanderson/python_project
/guessing_number_unlimited.py
UTF-8
253
3.90625
4
[]
no_license
import random n = random.randint(1, 6) print("CAN YOU GUESS MY NUMBER? (1-5)") a = input("Enter your guess: ") while a != n: if int(a) == n: print("Correct guess!") break; print('Try again!') a = input("Enter your guess: ")
true
216b1c069b2352d1712fd379ce68fca304f273bf
VT-Zhang/PYTHON_Platform_Works
/Python/Python_OOP/cards.py
UTF-8
201
3.3125
3
[]
no_license
class Card(object): def __init__(self, suit, val): self.suit = suit self.val = val def show(self): print "{} of {}".format(self.value, self.suit) class Deck(object):
true
06994de74394d0605842017fc223e3f2c1519606
freemast/Shortener
/Shortener/links/tests.py
UTF-8
1,577
2.703125
3
[]
no_license
from django.test import TestCase, Client from django.contrib.auth.models import User from links.models import Links, Tags class MyTest(TestCase): def setUp(self): self.client = Client() tag = Tags(title='Первый') tag.save() user = User(username='admin', password='admin') ...
true
904192118c12a08cd1f44c0e4b8925ae3355373c
pskirank/Beach_Sum
/Solved_kata_two_sum.py
UTF-8
239
3.328125
3
[]
no_license
#https://www.codewars.com/kata/two-sum/train/python def two_sum(nums, t): for i, x in enumerate(nums): for j, y in enumerate(nums): if i != j and x + y == t: return [i, j] print(two_sum([2,2,3], 4))
true
81367666b3cba3ca8479e335511a593e161fb365
s9gf4ult/track-deal
/src/combo_select_control.py
UTF-8
5,210
3.171875
3
[]
no_license
#!/bin/env python # -*- coding: utf-8 -*- from common_methods import find_in_list, find_in_model from hide_control import value_returner_control import gtk class combo_select_control(value_returner_control): """ \brief control for selecting value by representing string Uses combobox to display string and...
true
04b97ed9ba016b94f15ea9a04765c538725aca71
pgorczak/org-utils
/orgfile.py
UTF-8
3,247
3.28125
3
[]
no_license
import codecs import collections import datetime import re def str_to_datetime(s): """ Org date-time-stamp to datetime object. """ match = re.match(r'\[(.*)\ .*\ (\d\d:\d\d)\]', s) if match: date, time = match.groups() return datetime.datetime.strptime(date + time, '%Y-%m-%d%H:%M') def d...
true
a65f88d34aff4f64c98fc844033aa641556c39e8
sjsu-cmpe-272-spring-2019/mongodb_utils
/import.py
UTF-8
706
2.59375
3
[]
no_license
import sys import pandas as pd import pymongo import json from tqdm import tqdm if __name__ == "__main__": argv = sys.argv if len(argv) < 3: print("Usage: python import.py mongodb_uri filename collection") exit(-1) mongodb_uri = argv[1] filename = argv[2] collection = argv[3] ...
true
34955da2a99a00c0a4a6ab896302d2a10be32916
thepankj/Data-Structures-and-Algorithms
/Online Judges/Hackerrank/Easy/Any or All.py
UTF-8
241
2.859375
3
[]
no_license
#!/usr/bin/env python # coding: utf-8 # In[37]: N = int(input()) inp = list(map(int, input().split())) chk_pos = all([i > 0 for i in inp]) chk_pal = any([str(i) == str(i)[::-1] for i in inp]) ans = all([chk_pos and chk_pal]) print(ans)
true
d832a3735dec78f7533c476b1216e2f23841a79a
ivansdj68/regex-presentation
/4-2metacharacters.py
UTF-8
421
3.796875
4
[]
no_license
import re # The string must match "Ivan" from start to finish pattern = r"^Ivan$" if re.match(pattern, "Ivan"): print("Match w/o accent") else: print("No match for w/o accent") if re.match(pattern, "Iván"): print("Match w/ accent") else: print("No match for w/ accent") if re.match(pat...
true
1d20d02f1125f973f11e0a707049b7b18837472e
NishanthMHegde/MachineLearning
/GridSearch/GridSearch.py
UTF-8
5,510
3.578125
4
[]
no_license
""" Grid search is also a part of model seelction. Grid search is used to find out the optimal hyperparamters for a particular model that we have selected and have deemed fit to use. We first select the appropriate model with required accuracy using the Kfold cross-validation method. Once we have the model nailed down,...
true
af96cba6000e19820b2a0302986f9f2499a12c27
edmilsonchaves/python_code
/calculo_fatorial.py
UTF-8
911
3.90625
4
[]
no_license
# --------------------------------------------------------------------- # # Name: "Cálculo de fatorial" # Version: "1.0.0" # Description: "Realiza o cálculo fatorial" # Author: edmilsonchaves # Language: pt-br # --------------------------------------------------------------------- # from math import factorial while Tr...
true
cd0fad464bd0bb1693108a976f5147ef6ec7688d
danielhefnerjr/Personal-Projects
/interview/Cracking the Coding Interview/chapter 4/4.8/python/4.8.py
UTF-8
2,538
3.578125
4
[]
no_license
from itertools import zip_longest class BinaryTree: def __init__(self,data=None,left=None,right=None): self.data = data self.left = left self.right = right def insert(self,data): if self.data: if data < self.data: if self.left: ...
true
d98d1d8c918ccde556861c5027685f819adf0226
JoynalFrametOlimpo/python
/charaterstring.py
UTF-8
1,125
4.40625
4
[]
no_license
# print string message = "'This is an example of string'" print (message) # newline message= "First line. \nSecond Line\nThird Line " print (message) # many lines message = ("""\ this is an example of message that contains many lines """) print (message) # concatenate message = "new" + "line" print (message) messag...
true
51b57d1b3deb07a900c0e2b24d4e7a8e0590df3d
myUniWorks/learning-pandas-numpy
/learning-pandas/index.py
UTF-8
612
3.78125
4
[]
no_license
# Series import numpy as np import pandas as pd s1 = pd.Series(np.arange(4)) # print(s1) """ 左がindex(key)、右がvalue 0 0 1 1 2 2 3 3 dtype: int64 """ s2 = pd.Series([1, 2, 3, 4, 5], index=["a", "b", "c", "d", "e"]) # print(s2) """ a 1 b 2 c 3 d 4 e 5 dtype: int64 """ # print(list(s2)) """ リ...
true
39a446885cd7cc92f76d3e88668e16af086aa00c
ValeriaAraque/Algortimos2021
/Parcial 1/codigo_punto4.py
UTF-8
2,427
3.46875
3
[]
no_license
def contarPalabrasV1(parrafo): dictPalabrasOcurrencias = {} listaPalabras = parrafo.split() for palabra in listaPalabras: dictPalabrasOcurrencias[palabra] = listaPalabras.count(palabra) return dictPalabrasOcurrencias def contarPalabrasV2(parrafo): dictPalabrasOcurrencias = {} listaPala...
true
e9afc9944b4db52baf1c9e399e170567ed8be326
prashunchitkr/basic-python-training
/Day5/functions_1.py
UTF-8
867
4.09375
4
[]
no_license
list_to_buy = [] # defining each functions for adding and removing every fruits def add_orange(): orange = 'orange' if orange not in list_to_buy: list_to_buy.append(orange) print('{} added to list'.format(orange)) else: print('{} already in list'.format(orange)) def add_wat...
true
2ebf99069a0ee86124d6741c2fe2fc202a13bc5e
clarkfitzg/junkyard
/graphs.py
UTF-8
356
2.671875
3
[ "LicenseRef-scancode-warranty-disclaimer" ]
no_license
import matplotlib.pyplot as plt import networkx as nx class PlotGraph(nx.Graph): def __repr__(self): return "Hey dude." def matrix(self): return nx.to_scipy_sparse_matrix(self) g = nx.random_lobster(10, 0.3, 0.2) def attach_eigen(g): g.eigen = "TODO: compute these" attach_eigen(g) ...
true
e43fcab744b80f7ad1985d5b3b188a2cb77838a9
AngelDCruz/CursoPython
/basico/string_metodos.py
UTF-8
2,191
4.40625
4
[]
no_license
saludo = "Hola mundo" pensamiento = "La vida es bella" # convierte a minuscula saludoMinusculas = saludo.lower() print(saludoMinusculas) # convierte a mayusculas saludoMayusculas = saludo.upper() print(saludoMayusculas) # capitaliza la primer letra de cadena a mayuscula saludoCapitaliza = saludo.capitalize() print(...
true
b91c09bcda1d861adc8955b5b365f81a140de39f
cornellius-gp/gpytorch
/gpytorch/priors/utils.py
UTF-8
518
2.78125
3
[ "MIT", "Python-2.0" ]
permissive
#!/usr/bin/env python3 def _bufferize_attributes(module, attributes): attr_clones = {attr: getattr(module, attr).clone() for attr in attributes} for attr, value in attr_clones.items(): delattr(module, attr) module.register_buffer(attr, value) def _del_attributes(module, attributes, raise_on_...
true
8a32dcf7b2692309bd854ef7742a514f16967949
mohinisalunke/python
/day1/ex15.py
UTF-8
443
3.421875
3
[]
no_license
from sys import argv # imports the argv from sys module. script, filename = argv #defining no. of arguments.(script is default and filename is userdefine input.) txt = open(filename) print("Here's your file %r:" % filename) file_content = txt.read() print(file_content) #----------------------------------------- pr...
true
bed8aa8b5fd4312f4a35191f27d1b0ee1c9aa59b
BalgopalPatro/qual-id
/test/categories/test_animal.py
UTF-8
377
2.515625
3
[ "MIT" ]
permissive
import unittest from qual_id.categories.animal import Animal from test.utils.category_helper import CategoryHelper class TestAnimal(unittest.TestCase): def setUp(self): self.animal = Animal() def test__get_values__is_valid(self): self.assertTrue(CategoryHelper.get_values_is_valid(self.animal)) if __nam...
true
dd946e308bcf8e5d4a4f4cce694c0ebdd13b995a
FASLADODO/Lecture-Multicampus
/인공지능-자연어처리(NLP)-기반-기업-데이터-분석/조성현 강사님/01. ML/ML 실습/20200619/ML-KMeans-stock.py
UTF-8
2,201
3.0625
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Fri Jun 19 14:21:12 2020 @author: sir95 """ # module import import pandas as pd import numpy as np from sklearn.cluster import KMeans import matplotlib.pyplot as plt # load data stock = pd.read_csv('C:/Users/sir95/Desktop/LECTURE/인공지능-자연어처리(NLP)-기반-기업-데이터-분석/조성현...
true
d3ed02d0779d063f10754cb6d6bb821451c4ef12
rizend/pyspacelib
/ft.py
UTF-8
2,447
2.8125
3
[]
no_license
import socket devices = [] deviceMap = {} class ftdevice: def __init__(self, name, host, port=1337, width=45, height=35): self.name = name self.host = host self.port = port self.width = width self.height = height devices.append(self) deviceMap[name] = self ...
true
caf392f56f7a83706324e6c85abdbcb35645e1f1
joseph-palmer/TheMulQuaBio
/content/_build/jupyter_execute/notebooks/Appendix-NLLS-Python.py
UTF-8
17,203
3.859375
4
[ "MIT" ]
permissive
#!/usr/bin/env python # coding: utf-8 # # Model fitting in Python # ## Introduction # # Python offers a wide range of tools for fitting mathematical models to data. Here we will look at using Python to fit non-linear models to data using Least Squares (NLLS). # # You may want to have a look at [this Chapter](./20...
true
c558523de8f969941c41b2dfc3f1d516695b4879
pb866/reflectance-fitting
/Python/tTest.py
UTF-8
1,399
3.0625
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Fri Aug 31 12:00:20 2018 @author: rstur_000 """ import numpy as np # import matplotlib.pyplot as plt noise=[0.712705059, 1.037487891, 0.292159257, -0.71952627, -1.187286216] m=15 b=3 x=np.linspace(1,5,5) y=noise+m*x+b p, cov = np.polyfit(x,y,1,full=False, cov=Tr...
true
025162e90a5417f8e89a4cef95ce1075e2f01f38
negati-ve/piton3
/piton/commands/list.py
UTF-8
1,918
2.8125
3
[ "MIT" ]
permissive
import os from ..utils.command import BaseCommand from ..utils import python_modules, package_json class Node(): # Use fields: metadata, children def __init__(self, metadata = None): self.metadata = metadata self.children = [] def build_tree_level(self, installed_package_metadatas): if self.metadata: for d...
true
a29d745d796444af2c1098c37f9f1f2e9cf43d88
linhx13/leetcode-code
/code/1268-search-suggestions-system.py
UTF-8
502
2.890625
3
[]
no_license
from typing import List import collections class Solution: def suggestedProducts( self, products: List[str], searchWord: str ) -> List[List[str]]: m = collections.defaultdict(list) for p in products: for i in range(1, len(p) + 1): m[p[:i]].append(p) ...
true
9f486b472d6500a88062d7fcbc3bab7558cb4686
kavin-lee/AI
/DS/day02/04_sub.py
UTF-8
344
2.796875
3
[]
no_license
#!/usr/bin/python3 # !coding=utf-8 ''' 矩阵式子图 ''' import numpy as np import matplotlib.pyplot as mp mp.figure('Subplot', facecolor='lightgray') for i in range(1, 10): mp.subplot(3, 3, i) mp.text( 0.5, 0.5, i, size=36, ha='center', va='center' ) mp.xticks([]) mp.yticks([]) mp.tight_layou...
true
43c5de70f4bf81039a5daf876b56e890051f057f
fastso/learning-python
/atcoder/contest/solved/abc032_a.py
UTF-8
150
3.078125
3
[]
no_license
import fractions a = int(input()) b = int(input()) n = int(input()) c = a * b // fractions.gcd(a, b) i = 1 while c * i < n: i += 1 print(c*i)
true
ae09fd719f1d7832db78313ec6375e76d6d66d53
bioinformagic/monica
/libs/bammer.py
UTF-8
1,842
2.8125
3
[]
permissive
from src.piper_pan import shell_runner def hit_counter(barcodes): """ :param barcodes: a dict {barcode:list of the paths of bam files} :return: a dict {barcodes:{genome:#hits,..., unmapped:#hits}} """ counts = dict() for k in barcodes.keys(): paths = barcodes[k] genomes = d...
true
ec97b2a3f724a5dbf413fb0377f3f2a85ca4d664
wimurad/BigData-John-Abott-College
/Customize Turtle.py
UTF-8
459
3.703125
4
[]
no_license
import turtle def draw_square(): window = turtle.Screen() window.bgcolor ("grey") abcd = turtle. Turtle() abcd.forward(200) abcd.right(90) abcd.forward(200) abcd.right(90) abcd.forward(200) abcd.right(90) abcd.forward(200) abcd.right(90) turtle.color ("blac...
true
2f617e430d70d3e326b5d795eadcc790cdc09ef4
JacobStephen9999/BFS-2
/employeeImportnace.py
UTF-8
2,312
3.25
3
[]
no_license
# Time Complexity : O(N) where N is number of ID here it is V+E #Space Complexity : (O(H)) where H is height of Tree Numer of subordintes """ # Definition for Employee. class Employee(object): def __init__(self, id, importance, subordinates): ################# :type id: int :type importance: in...
true
c809d8138d40073c6d681cd518cc9b2f5560831f
rahdirs11/CodeForces
/python/arena.py
UTF-8
309
2.984375
3
[]
no_license
for _ in range(int(input())): # print('=' * 20) n = int(input()) levels = [int(x) for x in input().split()] leastLevel = min(levels) leastLevelCount = levels.count(leastLevel) if leastLevelCount == n: print(0) else: print(n - leastLevelCount) # print('=' * 20)
true
fa6912aab463ff297c6a0e72cb50e71c5967abdb
Fu-Qingchen/manim
/manim-master/finish_projects/NewYear2020.py
UTF-8
15,827
2.9375
3
[ "MIT" ]
permissive
''' > File Name : NewYear2020 ''' from manimlib.imports import * from from_3b1b.active.diffyq.part4.long_fourier_scenes import FourierSeriesExampleWithRectForZoom from from_3b1b.active.diffyq.part4.long_fourier_scenes import ZoomedInFourierSeriesExample from from_3b1b.active.diffyq.part2.fourier_series import...
true
ae02b06d31a4fc979bda5be5263aac47df1f9cca
pedrocambui/exercicios_e_desafios
/python/cursoemvideo/ex045.py
UTF-8
951
3.8125
4
[]
no_license
from random import randint print('''Suas opções: [ 0 ] PEDRA [ 1 ] PAPEL [ 2 ] TESOURA''') gamer = int(input('Qual a sua jogada? ')) npc = randint(0, 2) itens = ('PEDRA', 'PAPEL', 'TESOURA') print('-=-'*9) print(f'O computador escolheu {itens[npc]}') print(f'O jogador escolheu {itens[gamer]}') print('-=-'*9) if npc ==...
true