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
cfb931dc49735e543524b714604ca984abced806
ccevan/leetcode
/0002_addTwoNumbers.py
UTF-8
597
3.359375
3
[ "MIT" ]
permissive
class ListNode: def __init__(self, x): self.val = x self.next = None class Solution: def addTwoNumbers(self, l1, l2): if not l1 and not l2: return elif not (l1 and l2): return l1 or l2 else: if l1.val + l2.val < 10: l3...
true
e4cf8ee82310b0e72764131bed8fc583af2d86a4
tegardp/100-projects-100-days
/Day 3/project3.py
UTF-8
630
3.671875
4
[]
no_license
countTrue = 0 countLove = 0 name1 = input('name1 = ') name2 = input('name2 = ') concatName = name1.lower() + name2.lower() for i in concatName: if i == 't' or i == 'r' or i == 'u' or i == 'e' and countTrue < 10: countTrue += 1 if i == 'l' or i == 'o' or i == 'v' or i == 'e' and countLove < 10: ...
true
b9eb289785fda8a5a33dab7bdb8bdb895da97062
mayadm/pyro-calc
/client.py
UTF-8
328
2.78125
3
[]
no_license
#!/usr/bin/python import Pyro.core haus = Pyro.core.getProxyForURI("PYROLOC://localhost:7766/jambu") print "Masukan angka pertama :" nguk = raw_input() print "Masukan angka kedua :" ngik = raw_input() print "Masukan operasi [ + - / * ]:" opt = raw_input() hasil = haus.jus(nguk,ngik,opt) print "Hasilnya adalah "+int(ha...
true
3d5510d728cc1895978a88518192cc1fc51d124c
gablank/UNIK4690
/detect.py
UTF-8
3,999
2.53125
3
[]
no_license
#!/usr/bin/python3 import playground_detection import ball_detection import numpy as np import cv2 from os import walk def detection_method(img): S = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) avg = np.average(S) ret, S = cv2.threshold(S, 2*avg, 255, cv2.THRESH_BINARY) cv2.imshow("S", S) cv2.waitKey(0)...
true
f495329ce8390f9ffea2fb48984d1f4fafd44127
hmehta/acdsc
/acdsc/parser.py
UTF-8
1,530
2.703125
3
[]
no_license
#!/usr/bin/python3 import configparser class ACParser(configparser.ConfigParser): optionxform = str def prefix_sections(self, prefix): def startswith_prefix(value): return value.startswith('{}_'.format(prefix)) return sorted(filter(startswith_prefix, self.sections()), ...
true
d433eacfda456ae14e6f66d03c2c2a0ee84d058d
sbussmann/insight-bikeshare
/Code/bostonstationdata.py
UTF-8
2,112
2.59375
3
[]
no_license
import pandas as pd #import numpy as np import densitymetric #import matplotlib.mlab as mlab import matplotlib.pyplot as plt """ User Defined Parameters """ # scale radius by which to weight complementary zip codes zipscale = 0.5 # scale radius by which to weight complementary hubway stations stationscale = 1.0 # ...
true
432d3b26fee6536f0176f1d7426ac60c46883be7
wxnacy/study
/python/leetcode/test.py
UTF-8
624
2.6875
3
[]
no_license
#!/usr/bin/env python # -*- coding:utf-8 -*- # Author: wxnacy(wxnacy@gmail.com) # Description: # import datetime import time # utc = datetime.datetime.utcnow() # da = datetime.datetime.strftime(utc, '%Y-%m-%d 00:00:00') # mt = time.mktime(time.strptime(da, '%Y-%m-%d %H:%M:%S')) # print(da) # print(mt) # print(d...
true
13ffb2b854ecc2d3e779d71b1a2ae1a6dbd18de4
Likelion-Algorithm/AlgoStudy
/티어 별 문제/실버2/섬의 개수/주현.py
UTF-8
1,190
3.03125
3
[]
no_license
from collections import deque w, h =map(int,input().split()) answer = [] controll = [[0,1],[0,-1],[1,0],[-1,0],[1,1],[1,-1],[-1,1],[-1,-1]] while w!=0 and h !=0: graph = [] queue = deque([]) for i in range(h): graph.append(list(map(int,input().split()))) land = 0 for x in range(h): ...
true
9b97749464e632b495000cbe78739efecd2c5367
jautero/fuckspores
/google-app-engine/markdown/extensions/__init__.py
UTF-8
3,432
3.09375
3
[]
no_license
from markdown.md_logging import message from logging import DEBUG, INFO, WARN, ERROR, CRITICAL """ Extensions ----------------------------------------------------------------------------- """ class Extension: """ Base class for extensions to subclass. """ def __init__(self, configs = {}): """Create an...
true
6698cf962ecbf0de53a869857ee3c13253f04742
mare7811/Signals-and-Systems-II
/hw13p3.py
UTF-8
1,523
3.3125
3
[]
no_license
# -*- coding: utf-8 -*- """ Miguel Mares ECE 450 HW 13 Problem 9.3.1 """ import numpy as np import matplotlib.pyplot as plt import scipy dt = 0.01 NN = 1000 k = np.arange(0,NN*dt,dt) x = .5*np.sin(2*np.pi*.1*k) + np.sin(2*np.pi*k) + .5*np.sin(2*np.pi*10*k) plt.figure() plt.plot(k,x,'k') p...
true
6449c3787b4c383fb0075ef1b5a2f0e1c754b340
YujunXie/Tools
/tsne.py
UTF-8
1,091
2.953125
3
[]
no_license
import numpy as np import matplotlib.pyplot as plt from sklearn.manifold import TSNE import mpl_toolkits.mplot3d.axes3d as p3 def tsne(): colors = ['k','r','yellow','b','c','m','chocolate','pink','lawngreen','indigo','aliceblue','burlywood','dimgray','sienna' 'gold'] X = np.load('X.npy') ...
true
aded31bd2e7293bb1ba3464507b6df6d21e24718
roybotx/sneakergogogo
/ins_api.py
UTF-8
1,576
2.65625
3
[]
no_license
import time import selenium.webdriver as webdriver from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC from selenium.webdriver.common.by import By url = 'https://www.instagram.com/explore/tags/sneakers/' driver = webdriver.Chrome() driver.get(url) i...
true
e75be275ed91dd040023034f9b1c3d85061a54e1
fengchuiguo1994/little_tools
/bed2bedgraph.py
UTF-8
2,851
2.5625
3
[]
no_license
import pysam import sys # python bed2bedgraph.py test.size test.bed.gz 8 4 test.bedgraph ### Operating common files ### import gzip def readFile(infile): """ infile: input file return: file handle """ if infile.endswith((".gz","gzip")): fin = gzip.open(infile,'rt') else: fin = ...
true
f1a148067362f7c9c2db947fb2fbcb875e93d559
chiragnagpal/College-Work
/Second_Year/210242_Data_Structures_Problem_solving/Sorting/radix sort/radixsort.py
UTF-8
879
3.25
3
[]
no_license
def main(): buck=[] a=[] g=input("enter length of array") for i in range(g): a.append(input("Enter next No.")) print "you have entered the following nos" print a large=0; for i in range(g): if a[i]>large: large=a[i] print "largest no is ",large num=0 ...
true
7228907db3023bbd3a0374a3a00f93f81f8a8992
mwrightE38/svenzva_ros
/svenzva_simulation/src/trajectory_publisher.py
UTF-8
1,970
2.703125
3
[ "BSD-3-Clause" ]
permissive
#!/usr/bin/env python """ This file gives a demonstration of sending a waypoint trajectory programatically. The trajectory action server can be invoked in two separate ways- 1) Through an actionlib client 2) Through publishing to a topic Both methods are exemplified here. """ import rospy import actionlib from traje...
true
fc371d1aedc5b7503682d5a47aef36944c4edc59
mehzabeen000/list
/average.py
UTF-8
341
3.796875
4
[]
no_license
#we have to print the average of marks in given list marks=[[10,20,30,40],[10,20,30,40],[10,20,30,40]] counter=0 sum=0 while counter<len(marks): j=0 count=0 while j<len(marks[counter]): sum+=marks[counter][j] count+=1 j+=1 counter+=1 print(sum) print((sum//count), ...
true
67bfca900584d5beecf886dd53c5a2e46433fe2b
Ahsanul-kabir/Python-Learning-Codes
/Mosh_33_Exception 2.py
UTF-8
207
3.25
3
[]
no_license
try: list = [20,0,30] result = list[0] / list[1] print(result) print("Done") except (ZeroDivisionError , IndexError): print("You have enter wrong input") finally: print("Successful")
true
12241ee8b8c333617201a3207a9600732b38a9f1
aditya-srikanth/ML-Assignments
/Assignment_2/get_bayes_data.py
UTF-8
1,595
2.953125
3
[]
no_license
import hardcoded_params import os import pickle import numpy as np def get_bayes_data(): print('Searching for the data') data = [] if not os.path.isfile(hardcoded_params.PATH_TO_PICKLE_BAYES): with open(hardcoded_params.PATH_BAYES_DATASET,'r') as file_handle: for line in file_handle: line = line.strip() ...
true
11a821efafa7ad2238377837523c5079d1c9ede8
dstada/HackerRank.com
/Permuting Two Arrays - Greedy - Algorythms.py
UTF-8
671
3.515625
4
[]
no_license
def twoArrays(k, A, B): A.sort() B = sorted(B , reverse=True) new_list = list(zip(A, B)) for item in new_list: if sum(item) < k: return "NO" return "YES" if __name__ == '__main__': q = int(input()) for q_itr in range(q): nk = input().split() n = int(nk...
true
41309208f90d5cfcc8884fda23648ff4e406b6e4
Elektro33rus/graphs
/MainFunctions.py
UTF-8
12,925
2.703125
3
[]
no_license
import multiprocessing from PyQt5.QtCore import QThread, pyqtSignal import networkx as nx import random from matplotlib import pyplot as plt def SaveGraph(graph, size, pos, path): if False: nx.draw(graph, node_size=size*100, with_labels=True, pos=pos, node_shape='o', font_size=size/5, font_color='red') ...
true
2ac83120cf63579c28a381ddb6ba838ba97798e5
stephenpdrey/uiAutoTestHmtt05
/page/page_app_article.py
UTF-8
806
2.671875
3
[]
no_license
from base.app_base import AppBase import page from tools.get_logger import GetLogger log = GetLogger.get_logger() class PageAppArticle(AppBase): # 1. 查找频道 def page_click_channle(self, click_text): # 调用从右向左滑动方法 self.app_base_right_wipe_left(page.app_channel_area, click_text) # 2. 查找文章 de...
true
d58bf663a696b16e35b1409eeb146466029c8398
Tofuzhu/Python
/excecise/test9-6.py
UTF-8
1,297
3.515625
4
[]
no_license
class Restaurant(): def __init__(self,restaurant_name,cuisine_type,number_served=0): self.name=restaurant_name self.cuisine=cuisine_type self.number_served=number_served def describe_restaurant(self): print("This is a restaurant named "+self.name+".") print("It's "+self....
true
571ae330b006ecbc156a8635c276e56b221e9839
dmlc/gluon-cv
/gluoncv/nn/sampler.py
UTF-8
16,048
2.8125
3
[ "Apache-2.0" ]
permissive
# pylint: disable=arguments-differ, unused-argument """Samplers for positive/negative/ignore sample selections. This module is used to select samples during training. Based on different strategies, we would like to choose different number of samples as positive, negative or ignore(don't care). The purpose is to allevia...
true
cc877c5153b26b5197b78daf0432c1bb0a0e87ed
cocacolabai/ExDark-dataset-to-COCO-format
/file_merged.py
UTF-8
1,022
2.9375
3
[]
no_license
import os import shutil source_path = os.path.abspath(r'/home/shu-usv002/baiyunfer_file/Yolo-to-COCO-format-converter-master/Yolo-to-COCO-format-converter-master/ExDark/ExDark_Annno') # 源文件夹 target_path = os.path.abspath(r'/home/shu-usv002/baiyunfer_file/Yolo-to-COCO-format-converter-master/Yolo-to-COCO-format-conver...
true
6df6ceab0bc886115d285ae2256d0a17700e9c66
inyukwo1/CS224n-pytorch
/assignment3/model.py
UTF-8
913
2.578125
3
[]
no_license
import numpy as np import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self): super(Model, self).__init__() def take_loss(self, labels, preds): raise NotImplementedError def forward(self, *input): raise NotImplementedError d...
true
5b9ea102a226f9b50a1fe1febc65e54a6b065f7f
kms70847/Advent-of-Code-2019
/03/main.py
UTF-8
922
3.21875
3
[]
no_license
import re def manhattan(a,b=0): return int(abs(a.real-b.real) + abs(a.imag-b.imag)) def get_points(directions): p = 0 result = [p] for segment in directions.split(","): dirname = segment[0] dist = int(segment[1:]) delta = 1j ** ("RDLU".index(dirname)) for _ in range(dis...
true
a0cedf5151c0a1745e7dbd65b119d1e8a3ee81f6
0xch25/Human-Facial-Emotion-recognition-with-pulse-detection-using-CNN
/application/lib/emotions.py
UTF-8
2,095
2.6875
3
[]
no_license
from keras.preprocessing.image import img_to_array import cv2 from keras.models import load_model import numpy as np import os class Emotions(object): def __init__(self): # model paths self.emotion_model_path = os.path.dirname(os.path.abspath(__file__)) \ + '/../../training/...
true
0e369d4b1985992d8edf9f7d4fb7a532f1ae813c
MMourtada/code_questions_and_answers
/Array/image_rotation.py
UTF-8
958
3.8125
4
[]
no_license
class Solution: def rotate(self, matrix): """ :type matrix: List[List[int]] :rtype: void Do not return anything, modify matrix in-place instead. """ #Input is a list of lists representing rows of an nXn matrix #Output is the 90-degree clockwise rotation of th...
true
ec138dfa7c0fc8625479588378d31ccc513c8417
terrencetjr24/CompSoc
/compSoc/pyLearn/test/test6.py
UTF-8
148
2.609375
3
[]
no_license
#BEST from sys import argv #one, two, three = argv print(argv) #print("argument 1:", one) #print("argyment 2", two) #print("argument 3:", three)
true
b81511a6967c5b2d5930222692856cc8f7cb7d19
nisckis/tuenti10
/07/7.py
UTF-8
794
3.046875
3
[]
no_license
import codecs m = {} # Letter mapping m["."] = "E" m["y"] = "T" m["d"] = "H" m["r"] = "O" m["u"] = "F" m["a"] = "A" m["b"] = "N" m["e"] = "D" m["c"] = "I" m["p"] = "R" m["k"] = "V" m["n"] = "L" m["x"] = "B" m["o"] = "S" m["m"] = "M" m["f"] = "Y" m["l"] = "P" m["j"] = "C" m["t"] = "K" m[","] = "W" m["i"] = "G" m["g"] =...
true
4db7e7d81388ad69624c4805ac19bbfd14576917
eduardojdiniz/recurrent-whisperer
/Hyperparameters.py
UTF-8
20,983
3.0625
3
[ "Apache-2.0" ]
permissive
''' Hyperparameters.py Version 1.0 Written using Python 2.7.12 @ Matt Golub, August 2018. Please direct correspondence to mgolub@stanford.edu. ''' from __future__ import absolute_import from __future__ import division from __future__ import print_function import argparse import pdb from copy import copy, deepcopy imp...
true
78a9d2bab229c84a011f8eb41c23008318e9f450
andrewdollard/datacruncher
/node_file_scan.py
UTF-8
659
2.953125
3
[]
no_license
from node import Node class NodeFileScan(Node): def __init__(self, filename): super().__init__() self.file = None self.filename = filename self.reset() def next(self): row = self.file.readline() if row == '': return None row = row.strip().spl...
true
18f7b172c3beae9c71fb0462362d9e7625d0edb7
gurudarshan266/Perfuse
/Client/hash_utils.py
UTF-8
182
2.84375
3
[]
no_license
#!/usr/bin/python import hashlib def compute_hash(s): o = hashlib.sha1(s) return o.hexdigest() if __name__ == '__main__': s = "GuruDarshan" print compute_hash(s)
true
671d4d0d62f8605d9d2275b5a8fc614e31f088a9
gabriellasaro/arquead-py
/arquead/__main__.py
UTF-8
675
2.796875
3
[ "MIT" ]
permissive
import sys from arquead.info import Info from arquead.arquea import Arquea info = Info() print(info.get_release() + "\n") if len(sys.argv) >= 2: if sys.argv[1] == 'version': print(info.get_release()) elif sys.argv[1] == 'help': info.help() elif sys.argv[1] == 'compatible': info.sho...
true
6e028c950689a9bc49d189e9e12c038248fec030
ruwi/heart_activity_analizer
/plotter.py
UTF-8
6,552
2.8125
3
[]
no_license
#!/usr/bin/python2 #-*- coding: utf-8 -*- # # Author: Wiktor Wolak # import sys import argparse from itertools import tee import numpy as np import pylab as plt import base_parser import validator def get_data_by_time(data, T_min, T_max): """ Return data raws with time is between T_min, T_max """ ...
true
d110f6be3a1c97ab39c66990c8d5b04edbd6ab89
AshtonIzmev/dataghobot
/dataghobot/models/SklearnOpt.py
UTF-8
2,290
2.671875
3
[]
no_license
from sklearn.ensemble import RandomForestClassifier, ExtraTreesClassifier from sklearn.pipeline import Pipeline from sklearn.preprocessing import StandardScaler from sklearn.linear_model import LogisticRegression from GenericOpt import GenericOpt as Gopt class SklearnOpt(Gopt): @staticmethod def build_model(...
true
d401c9254359fe5204b98bbb30f8fcd3be5eea9d
hyoHhh/test
/day10/requestsss/request_all.py
UTF-8
1,703
2.59375
3
[]
no_license
# -*- coding: utf-8 -*- import requests response=requests.get("http://www.baidu.com") print(response.text) #网页文本 print(response.status_code)#状态 print(response.headers)#请求头 print(response.cookies) #cookie print(response.content) # 网页内容 print(response.url) #链接 print(response.history) #链接 print(response.is_redirect)...
true
aa2a872b351986a37e07817e56fb1acaba528d3d
siwangapple01/Python005-01
/week05/redisCoutner.py
UTF-8
395
2.5625
3
[]
no_license
import redis import os from datetime import datetime client = redis.Redis(host=os.getenv("NASIP"), port=6379, decode_responses=True) client.flushdb() def counter(video_id: int): client.incr(video_id) return client.get(video_id) def main(): print(counter(1001)) print(counter(1002)) print(counte...
true
aa03d98f31c57111db87630aa88c96badd99f31d
shawngong/Euler_Project
/Eulerproject14.py
UTF-8
515
3.625
4
[]
no_license
#Project Euler Problem 14 #Shawn Gong def collatz(n): count = 1 while n > 1: count += 1 if n % 2 == 0: n = n/2 else: n = 3*n + 1 return count def max(): greatest = 1 for i in xrange(1000000): length = collatz(i) if length > greatest:...
true
261c395f832b445f24ee21f1d65be8a46be96617
zhaofeng-shu33/pyBHC
/example/iris_clustering.py
UTF-8
1,699
2.734375
3
[ "BSD-3-Clause" ]
permissive
'''example program to cluster iris data using hbc pyBHC library not support python 3 currently use python 2.7 to run this example script have patience to wait for the results ''' import numpy as np from sklearn import datasets from pyBHC import bhc from pyBHC.dists import NormalInverseWishart from scipy.cluste...
true
39f7edc6b7082db8c628bd40b3997a3dd0fa0df1
maayanalbert/104oncrack
/sketches/in-progress/emoji-gun/emoji-lib-generator/imgDownloader.py
UTF-8
694
2.703125
3
[]
no_license
from selenium import webdriver # import requests from bs4 import BeautifulSoup import time from os import getcwd link = "https://emojipedia.org/apple/" driver = webdriver.PhantomJS(getcwd() + "/phantomjs") driver.get(link) lastHeight = driver.execute_script("return document.body.scrollHeight") pause = 0.5 while Tru...
true
0c8755c85970423a6330afde7db43b2e36b961cd
castodius/adventofcode
/2020/13/hard.py
UTF-8
325
2.953125
3
[]
no_license
raw_input() data = raw_input().strip().split(',') data = [int(element) if element != 'x' else element for element in data] curr = data[0] multiplier = curr for shift, value in enumerate(data[1:],1): if value == 'x': continue while (curr + shift) % value != 0: curr += multiplier multiplier*=value print ...
true
46cc77f6103b6a154005ddc49ffb9cf7505a0612
jakebruemmer/gcr-calculator
/gcr_calculator.py
UTF-8
946
3
3
[]
no_license
import requests from bs4 import BeautifulSoup class GCRCalculator: def __init__(self): self.GCR_CALCULATOR_URL = "http://www.gcmap.com/dist?P=%s&DU=%s&DM=&SG=&SU=%s" self.__values = { 'SU': ['mph', 'kph'], 'DU': ['mi', 'km'] } def calculate_distance(self, orig,...
true
b60b6909064d7e81b75a7b7dc9f079bb35c8de1d
tlatimer/partCart
/pcCLI2.py
UTF-8
8,238
2.640625
3
[]
no_license
import pcDB2 from tabulate import tabulate import settings as s from termcolor import colored import os os.system('color') def printYLW(text): print(colored(text, 'yellow')) def prompt(text): return input('{:>20}?'.format(text)).strip().upper() def printAligned(left, right): print('{:>20}:{}'.format(...
true
43d611102e691218650bdaedf8475fc1d62df7b9
ericf149/Practice_Projects
/Madelung_const.py
UTF-8
569
3.40625
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Sat Feb 13 15:50:08 2021 @author: Eric """ from math import sqrt def oddOrEven(i,j,k): total = i + k + j if total % 2 == 0: return 0 if total % 2 != 0: return 1 L=200 V=0 for i in range(-L,L): for j in range(-L,L): for k in range(-L,L): if i...
true
b2b06bc102795b3878d1600d5f87d882ef12c26e
Oukanina/tron-api-python
/tronapi/base/validation.py
UTF-8
1,553
2.96875
3
[ "MIT" ]
permissive
# -------------------------------------------------------------------------------------------- # Copyright (c) iEXBase. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # ----------------------------------------------------------------------------------...
true
94f9f64cb8be6944471864e05d32b54d9d5d8232
pldorini/python-exercises
/desafios/desafio 78.py
UTF-8
639
3.890625
4
[]
no_license
numero = [] ma = me = 0 for c in range(0, 5): numero.append(int(input(f'Digite um valor para a posição {c}: '))) if c == 0: ma = me = numero[c] else: if numero[c] > ma: ma = numero[c] elif numero[c] < me: me = numero[c] print('=-'*25) print(f'Voce digitou os v...
true
01772db62cc340dc1a7f6e19ccf8835d24ffec8f
stevelittlefish/easyforms
/easyforms/validate.py
UTF-8
2,215
3.296875
3
[ "Apache-2.0" ]
permissive
""" This contains validation functions. Each of these functions takes the form value as a parameter, and returns either an error message, or None if the value passes validation """ import logging import datetime from littlefish import validation __author__ = 'Stephen Brown (Little Fish Solutions LTD)' log = loggin...
true
4652c5cf5104eca42e0695e99c88f186cfacc1d4
jokwuobi/Portfolio-Optimization---Math441TermProject
/Python Files/parse_stock_list.py
UTF-8
2,298
2.59375
3
[]
no_license
import csv import sys import pickle import argparse import datetime import pandas as pd import pandas_datareader.data as web import pandas_datareader._utils as web_util STOREFILENAME = 'stockdb.h5' store = pd.HDFStore(STOREFILENAME, 'a') beginning = datetime.datetime(1890, 1, 1) list_of_symbols = [] def parse_list(fil...
true
fa44aa920ca64a3462ea352e87190d5082ac695f
Warriorchief/CodeChallenges
/wordpuzzle.py
UTF-8
2,505
3.421875
3
[]
no_license
def wordBoggle(board, words): outs=[] for word in words: if doesWordAppear(board,word): outs.append(word) outs=sorted(outs) print('the outs from the words',words,'are',outs) return outs def doesWordAppear(board,word): if word=='AXAL': return True paths=[(i,j) for i in range(len(board)) fo...
true
0f7b65c0364f83108776f68375b56c1c0ec0642a
minhvo-dev/Project-Euler-Solutions
/src/0055.py
UTF-8
748
3.796875
4
[]
no_license
# How many Lychrel numbers are there below ten-thousand? MAX_ITER = 50 def is_palindrome(n: int): s = str(n) return s == s[::-1] def get_reverse_number(n: int): s = str(n) return int(s[::-1]) def no_math_solution(maxN: int): global MAX_ITER countLychrelNumber = 0 num = 1 while(num < ...
true
1868ca765dcc7879933460515dcdc8c2b106ab41
chenna-g/AlienVsShipgame
/button.py
UTF-8
928
2.90625
3
[]
no_license
import pygame.font class Button: def __init__(self, screen, ai_settings, msg): self.screen=screen self.screen_rect=screen.get_rect() self.width, self.height= 200, 50 self.button_color=(0, 255, 0) self.text_color=(255, 255, 255) self.font=pygame.font.SysFont(None,48) ...
true
c3ef4ba2e239f46ed154d87880ddfa20c3817bf5
koichiHik/prob_robotics
/stats/box_muller.py
UTF-8
2,132
3.21875
3
[]
no_license
import matplotlib.pyplot as plt import numpy as np import random import math class BoxMuller(): @staticmethod def sample_norm_dist(avg=0.0, sigma=1.0): x1 = random.random() x2 = random.random() y1 = math.sqrt(-2*math.log(x1)) * math.cos(2 * math.pi * x2) y2 = math.sqrt(-2*math.log(x1)) * math.sin...
true
36618c4789fbca9787a7f7e044f815c93e077794
8589/codes
/python/leetcode/array/3_Longest_Substring_Without_Repeating_Characters.py
UTF-8
1,660
3.046875
3
[]
no_license
class Solution(object): def lengthOfLongestSubstring(self, s): """ :type s: str :rtype: int """ if len(s) < 1: return 0 longest_set = s[0] start_i, max_l = 0, 1 s += s[-1] for i, c in enumerate(s[1:]): if c in longest_set: ...
true
25a5a2182440ef65a5c1ac213b599bd2b0708f64
ErikaAlcantara/gauss_elimination_method
/src/interface.py
UTF-8
2,338
2.859375
3
[]
no_license
import streamlit as st import time import numpy as np import pandas as pd from streamlit.server.server import Server from gauss_p_pivoting import Gauss_partial_pivoting st.title("Método da Eliminação de Gauss com Pivoteamento") st.write("#") st.header("Sistema") st.write("#") col1, col2, col3,col4,col5, col6 = st....
true
3d10ae10ee67eb29d0308fe14612a83c1e4a22c0
kirilman/nir
/model.py
UTF-8
2,122
2.515625
3
[]
no_license
from sequence_generator import Sequence import numpy as np import matplotlib.pyplot as plt from pomegranate import * import warnings import time s = Sequence(round(np.random.uniform(20,67)),['a','c','b','d','e','f','g'],type='period') s = Sequence(250,['a','b','c','f'],type='period') sequence = np.array(s.sequence)....
true
b0760549817a93e6e0057d0da26407e26ded101a
amelialin/tuple-mudder
/Problems/frequent_words.py
UTF-8
2,050
4.28125
4
[]
no_license
# Find the three most frequently occurring words in an article. # Computational complexity of O(n), couldn't see anything here that would do # anything other than scale linearly with the length of the string. class InputError(Exception): pass def frequent_words(string): """Takes input as a string, returns set...
true
5d9b485d3d16175fea4c7cfffd6ff1c243affde5
abinashsinha330/DeepPhotAstro
/gru_emb_sd_mp/plain_rnn_train.py
UTF-8
7,852
2.6875
3
[]
no_license
""" Python package to train plain GRU-based RNN model for light curve classification """ import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv) import numpy as np import random import copy import math from keras.layers import * from keras.models import Model, load_model from keras.callbacks import Ea...
true
052ebf218f6f616937abeade7ae6f504384d5c68
AlexandreL1984/Py4e
/DictUpdateMethod.py
UTF-8
919
3.34375
3
[]
no_license
#DictionaryUpdateMethod model1 = { "first": "Kenzia", "last": "Fourati", "hair": "brown", "eyes": "blue"} model2 = { "first": "Kendall", "last": "Jenner", "hair": "brown", "eyes": "brown"} model3 = { "first": "Hayley", "last": "Atwell", "hair": "blonde", "eyes": "blue"...
true
f1c1bc0466f546e329981eacf09fdddaa4f56eda
jorgekast18/Practica-1-OpenGl
/3D/esfera.py
UTF-8
3,032
3.40625
3
[]
no_license
from OpenGL.GL import * from OpenGL.GLUT import * from OpenGL.GLU import * from random import random # ==================================================================== # FUNCIONES # # # ==================================================================== # DATOS # Nombre : Jorge A. Castanio, Seb...
true
740db7761e00397de541c007147aa7bf53aeef3c
GayatriDPatil/PythonWeek1
/Week1/List/RemoveDuplicates.py
UTF-8
182
3.28125
3
[]
no_license
mylist = ["a","b","c","d","a","a"] mylist = list(dict.fromkeys(mylist)) print(mylist) #copy list thislist = ["Gayu","Digu","divya","Yash"] copylist = thislist.copy() print(copylist)
true
2c21c4b669840bd1833c34fbb5f3d0771256e5d0
pesi1874/unit-test
/test.py
UTF-8
1,036
3.453125
3
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # import os # import time # # for i in range(2): # print('**********%d***********' % i) # pid = os.fork() # # print(pid) # if pid == 0: # # We are in the child process. # print("%d (child) just was created by %d." % (os.getpid(), os.getppi...
true
4b0044c8884213be3983581fdc14945fed856861
Jeevanantham13/programizprograms
/swappingvariables.py
UTF-8
296
3.96875
4
[]
no_license
#swapping the varaibles a = int(input("enter the value of a:")) b = int(input("enter the value of b:")) temp = int(input ("enter the temporary variable:")) print("the values of a and b are:",a,b) temp = a a = b b = temp print("the swapped varaibles of a and b are:",a,b)
true
5336734be27af55d602e15e8de964cc98ba542d3
JeremyCurmi/ds-mpg
/feature_joiner.py
UTF-8
2,860
2.765625
3
[]
no_license
import pandas as pd from sklearn.pipeline import FeatureUnion from sklearn.compose import ColumnTransformer from df_transformer import DfTransformer class FeatureUnioner(DfTransformer): """ Joins all dataframes coming from multiple transformers into one dataframe """ def __init__(self, transform...
true
7c996e932038902e90a088026a9322ac63485873
pelanmar1/ant-colony-optimization
/ants.py
UTF-8
6,986
2.765625
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Tue Oct 16 13:30:57 2018 @author: PLANZAGOM """ import random import numpy as np import plot_graph import matplotlib.pyplot as plt class AntColony: def __init__(self, graph, phero_mat, alpha, beta, rho): self.graph = graph self.phero_mat = phe...
true
392a076c09533957ee657eafb6e8eea800045a3e
oldmalebird/webscraping
/爬取斗图网图片.py
UTF-8
1,175
2.65625
3
[]
no_license
import requests from bs4 import BeautifulSoup import os import urllib BASE_PAGE_URL = 'http://www.doutula.com/photo/list/?page=' PAGE_URL_LIST = [] #页面url for i in range(1, 3): url = BASE_PAGE_URL + str(i) PAGE_URL_LIST.append(url) print(PAGE_URL_LIST) def download_img(url): split_list = url.split('/')...
true
7fa6fa90fbaf7ebffd095f5868c1d2585b0f949f
shijie-wu/crosslingual-nlp
/scripts/ace_align_util.py
UTF-8
1,589
3.15625
3
[ "MIT" ]
permissive
# Read word alignments in Pharoah format. # Inputs: # # 1. Tokenized src-tgt separated by ' ||| ' # Qld corruption reforms not enough : Greens ||| qld الاصلاحات الفساد ليست كافية : الخ # # 2. Word alignments in the Pharaoh format: # 1-2 0-0 3-3 5-5 6-6 4-4 2-1 # # Output: a list of "Alignment" objects. The ith item of...
true
802929a26f343550c6e7096983597b0bee2d1c74
gechevarria/trazak
/trazak_scan/devices_user_passwords.py
UTF-8
1,471
2.625
3
[]
no_license
import csv import database_access_trazak def process_file_with_users_passwords(): rownum = 0 product = "" vendor = "" device_type = "" user_password = "" protocol = "" with open('/home/trazak/Software/ICSecurity/scadapass.csv', 'rb') as csvfile: csvReader = csv.reader(csvfile) ...
true
ab759b90704fe04bbd4a3cb824ed4c1c880770e1
hyang012/leetcode-algorithms-questions
/055. Jump Game/Jump_Game.py
UTF-8
1,476
3.71875
4
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Leetcode 55. Jump Game Given an array of non-negative integers, you are initially positioned at the first index of the array. Each element in the array represents your maximum jump length at that position. Determine if you are able to reach the last index. """ def ...
true
b288a9c885e4e0ba68b8d8a6e592c7cd20752595
ElenaZhelezova/EpamPython2019
/10-Design_Patterns/5-Abstract_Factory/abstract_factory.py
UTF-8
2,541
3.609375
4
[]
no_license
""" Представьте, что вы пишите программу по формированию и выдачи комплексных обедов для сети столовых, которая стала расширяться и теперь предлагает комплексные обеды для вегетарианцев, детей и любителей китайской кухни. С помощью паттерна "Абстрактная фабрика" вам необходимо реализовать выдачу комплексного обеда, со...
true
2801f367361d34de2393c4e6a0c30995e24fcdb2
lordwarlock/kaggle_AI
/irmodule/FileProcess.py
UTF-8
5,936
2.546875
3
[]
no_license
#encoding:utf8 import xml.etree.ElementTree as et from itertools import takewhile, chain from bs4 import BeautifulSoup,BeautifulStoneSoup import urllib2 import re import glob import codecs import os import wikipedia from urllib2 import urlopen from wiki2plain import Wiki2Plain def wiki_parser(raw): wiki2plain = W...
true
9dbf64d854960f991988a923066d136331ae201c
nobeans/deep-learning-from-scratch
/ch04/numerical_diff.py
UTF-8
487
3.84375
4
[]
no_license
import numpy as np import matplotlib.pylab as plt def numerical_diff(f, x): h = 1e-4 # 0.0001 return (f(x+h) - f(x-h)) / (2*h) def function_1(x): return 0.01*x**2 + 0.1*x def gradient_function_1(x): return 0.02*x + 0.1 x = np.arange(0.0, 20.0, 0.1) y = function_1(x) print(numerical_diff(function_1,...
true
4c4fed3413cc04d2a377b79f355ef465f8508089
ahmedaliyahia86/mahratech-python-basics
/Mahartech20.py
UTF-8
1,088
4.375
4
[]
no_license
# -*- coding: utf-8 -*- """ Created on Sun Apr 19 15:52:23 2020 @author: ahmedali """ # Python Collections: 1- Tuples # 1- Tuples : Defining a Tuple # * Defined by Parentheses () # * Items Separated By Commas ( 1, ) # * Contain any type of object t=() print(type(t)) tup = (1, 'C', 3, 'Num') print...
true
ae93bbb1999fcecc448f26458f123ed81f447bb8
irina-nalivayko/Pyspark
/Task 4/Commerce.py
UTF-8
2,060
2.953125
3
[]
no_license
from pyspark.sql import SparkSession from pyspark.sql import Row from pyspark.sql.window import Window from pyspark.sql.functions import dense_rank def load_data (): global df_p global df_oi df_p = spark.read.load("sources/product.csv",format="csv", sep=";", inferSchema="true", header="true") df_o...
true
68072fce324f7ea63b558103a6c2888f7f27e869
yxurrbzallkd/luckylab
/tic-tac-toe/btree.py
UTF-8
402
3.578125
4
[]
no_license
class BinaryTree: def __init__(self, root): self.root = root self.left_child = None self.right_child = None def insert_left(self, new_node): if self.left_child is None: self.left_child = BinaryTree(new_node) def insert_right(self, new_node): i...
true
13262075751994b97999419f30a2d4342999424b
jw787/traffic-sign-recogize
/Classes_make_anno.py
UTF-8
2,117
2.875
3
[]
no_license
#! /usr/bin/env python # coding=utf-8 import os import pandas as pd from PIL import Image class Classes_anno(): def __init__(self, root): self.root = root def make_anno(self): PHASE = ['train', 'test'] KIND = [str(i).zfill(5) for i in range(62)] DATA_INFO = {'train':{'path': [...
true
a7cfaf6e4cc6625e466f0b04e59cafb67a7e9404
green-fox-academy/nandormatyas
/week-03/day-02/write_multiple_lines.py
UTF-8
301
3.671875
4
[]
no_license
def multiline_writer(path, word, number): try: fopen = open(path, 'w') fopen.write((word + "\n") * number) except: print('unable to write file') path = input('file? ') word = input('Word? ') number = int(input('Lines? ')) multiline_writer(path, word, number)
true
2735174a467fd6945800ab54814d8a5b61196ab9
daniel-reich/ubiquitous-fiesta
/vaufKtjX3gKoq9PeS_8.py
UTF-8
224
2.671875
3
[]
no_license
def ohms_law(v, r, i): l = [i for i in (v,r,i)] if l.count(None) == 1: if i == None: return round(v/r,2) elif r == None: return v/i elif v == None: return r*i else: return "Invalid"
true
dc554e7ecca24d3cb42e948c2b64b5fedf514347
gabriellaec/desoft-analise-exercicios
/backup/user_067/ch1_2020_03_26_23_26_19_749921.py
UTF-8
154
3.1875
3
[]
no_license
def calcula_valor_devido(emprestimo, meses, taxa): if meses > 0: devido = float(emprestimo)*(1 + taxa^float(meses)) return devido
true
963a1ca91ad18d10f2f8b8181bde0630563c4c40
yaminikanthch/Python-Work
/oops/random_print
UTF-8
119
2.84375
3
[]
no_license
#!/usr/bin/python from random import randint map = [] for x in range(0,2): map.append(randint(0, 2)) print map,
true
f7b6ddf4ac491727d4bd88b7443c0a2cc4703f01
Sunil5990/demopygit
/PrimeNumber.py
UTF-8
184
3.984375
4
[]
no_license
Num = int(input("Enter a number: ")) for i in range(2,Num//2): if Num % i == 0: print(Num, " is not a prime number") break else: print(Num," is a prime number")
true
8fa3f8030f3eb3482bbfe383a0dc94d471117b13
yinjiayang/spiders
/yichewang/yichewang/spiders/yiche.py
UTF-8
1,495
2.515625
3
[]
no_license
# -*- coding: utf-8 -*- import scrapy from scrapy.linkextractors import LinkExtractor from scrapy.spiders import CrawlSpider, Rule from yichewang.items import YichewangItem class YicheSpider(CrawlSpider): name = 'yiche' allowed_domains = ['bitauto.com'] start_urls = ['http://car.bitauto.com/xuanyi/koubei/'...
true
3d24045413d15ab49637217da558370c0846b4c4
johnfial/pokemon
/pokemon/management/commands/load_pokemon.py
UTF-8
1,391
2.8125
3
[]
no_license
import json from django.core.management.base import BaseCommand from ...models import Pokemon, Type class Command(BaseCommand): def handle(self, *args, **options): # Clear existing Pokemon and Types # Pokemon.objects.all().delete() # Type.objects.all().delete() # Open P...
true
f73593fad88da17626cb6d7e96c6edf4073415a1
andreystashev/python_base
/lesson_005/my_burger.py
UTF-8
342
2.859375
3
[]
no_license
def bread(): print('кладем булочку') def cutlet(): print('Добавим котлету') def cucumber(): print('Добавим огурчик') def tomato(): print('Добавим помидор') def mayo(): print('Добавим майонез') def cheese(): print('Добавим сыр')
true
8e4a617b96c02ca3aa8355d69c04cbefb2e169b1
aevens/pytorch_conv_lib
/utils/mnist_downloader.py
UTF-8
2,032
2.671875
3
[]
no_license
import sys import requests import numpy as np np.random.seed(42) import pandas as pd import os import idx2numpy import gzip import torch torch.manual_seed(42) def mnist_downloader(): train_features = "http://fashion-mnist.s3-website.eu-central-1.amazonaws.com/train-images-idx3-ubyte.gz" train_labels = "http:...
true
354f8ee2dffdcf0c3a151fa645c4d5094e896923
polymorphm/inst-checker
/lib_inst_checker_2015_03_29/get_useragent_func.py
UTF-8
1,642
2.765625
3
[]
no_license
# -*- mode: python; coding: utf-8 -*- assert str is not bytes from urllib import parse as url_parse from urllib import request as url_request import json import random USERAGENT_LIST_URL = 'https://getuseragent.blogspot.com/2014/03/getuseragent.html' REQUEST_TIMEOUT = 60.0 REQUEST_READ_LIMIT = 10000000 def get_user...
true
0d4bf8146f9a3849937dc1dd06d76fd1e90312da
xchk138/StereoSiamNet
/analyze_training.py
UTF-8
433
2.5625
3
[ "MIT" ]
permissive
import numpy as np import matplotlib.pyplot as plt if __name__ == '__main__': fp = open('train.log', 'rt') assert fp lines = fp.read() lines = lines.split('\n') lines = list(filter(lambda x: len(x)==37, lines)) loss_ = [float(lines[i][-8:]) for i in range(len(lines))] loss_ = np...
true
35c7c6fb5176113009e95e471a0f5cab36c89725
taejin0527/Algorithm
/BOJ/14226_이모티콘.py
UTF-8
1,056
3.328125
3
[]
no_license
from collections import deque def bfs(screen, clip): queue = deque() visited[screen][clip] = 0 queue.append((screen, clip)) while queue: ts, tc = queue.popleft() # 1 화면에 있는 이모티콘을 모두 복사해서 클립보드에 저장한다. if ts < MAX and visited[ts][ts] == -1: visited[ts][ts] = visited[...
true
308c3fe9493bc79700e87dd5a10e68005a1fef22
joakaw/PythonAGH
/Python1/python1_ex14.py
UTF-8
1,114
3.296875
3
[]
no_license
import random import numpy def matrix_det(matrix): matrix = numpy.array(matrix) matrix_size = get_matrix_size(matrix) if matrix_size == 2: return min_matrix_det(matrix) else: det = 0 for i in range(matrix_size): det = det + (pow(-1, i+2)*matrix[i][0]*matrix_det(get_...
true
294f2e377284406d214fce72c14de65a5722c972
DongusJr/Verkefni_HR_2019_Haust
/Lokapróf/isbn.py
UTF-8
1,333
4.40625
4
[]
no_license
ISBN = "X-XXX-XXXXX-X" # The format of the ISBN, X represents digits and - are simply "-" def check_if_valid(user_input): ''' Function that checks if the user number is a valid ISBN depending on how the constants ISBN is returns True if the user number has the right format returns False if the us...
true
7bb8cef0a03fd337ad49815a6e5ad8abdef382ac
NGL91/datastructure_algorithm
/third_max_number.py
UTF-8
1,350
3.578125
4
[]
no_license
''' Given a non-empty array of integers, return the third maximum number in this array. If it does not exist, return the maximum number. The time complexity must be in O(n). Example 1: Input: [3, 2, 1] Output: 1 Explanation: The third maximum is 1. Example 2: Input: [1, 2] Output: 2 Explanation: The third maximum ...
true
690561ab77156398ed7aba5fad3eddc162420cd9
amaurirg/Tarefas-Macantes
/argparse/argparse_internet.py
UTF-8
605
3.59375
4
[]
no_license
import argparse # Use nargs to specify how many arguments an option should take. ap = argparse.ArgumentParser() ap.add_argument('-a', nargs=2) ap.add_argument('-b', nargs=3) ap.add_argument('-c', nargs=1) # An illustration of how access the arguments. opts = ap.parse_args('-a A1 A2 -b B1 B2 B3 -c C1'.split()) print(...
true
a4232d9ab888eef9bf761309ab4972f03ecc1637
cargillj/CTS_Realtime_Adapter
/parserMatt.py
UTF-8
332
2.625
3
[]
no_license
import urllib2 stops = ['1', '2', '3', '4', '5', '6', '7'] response = urllib2.urlopen('http://www.corvallis-bus.appspot.com/arrivals?stops={stopID}').format(iterator) apiresponse = response.read() timesarray = apiresponse.split("Expected") savefile = open("savefile.txt", "w") savefile.write(timesarray[4]) print len(...
true
9d5143178ad54e7edff2aa1da46389850ae1d680
JayIvhen/StudyRepoPython2014
/home_work/lesson6/MaxSubst.py
UTF-8
1,397
3.359375
3
[ "Unlicense" ]
permissive
#!usr/bin/python """Max substring""" # MaxSubst.py # Home_work l6 UNEEX.ru # Find MaxSubstring with unic letters __author__ = "JayIvhen" class blanck_string(Exception): def __repr__(self): return "String is empty" def u_input(): while True: try: str = raw_input() ...
true
2930cbde9d757e610a9065ae080a5307d0450dc1
Zarro1008/groupLearning-Python-100-Days
/Day01-15/pratice_code/R_Day_09.py
UTF-8
5,746
4.21875
4
[ "MIT" ]
permissive
''' 用 @property 封裝,用 getter 和 setter 取得資料和修改資料 ''' from abc import ABCMeta, abstractmethod from time import time, localtime, sleep from math import sqrt class Person(object): def __init__(self, name, age): self._name = name self._age = age # getter 的作法 @property def name(self): ...
true
7d36c607b43d23e6250c4148051585ca87bcdc8b
opler/gsvCreater
/GSVCreator.py
UTF-8
825
3.140625
3
[]
no_license
import zipfile import os import errno def createDirectory(path): try: os.makedirs(path) return True except OSError as exc: if exc.errno == errno.EEXIST and os.path.isdir(path): pass else: raise return False if __name__ == '__main__':...
true
715d418763557c616e971ff626b6c7d8bfe520ea
hipala/where-is-my-stuff
/stuff list.py
UTF-8
1,896
3.015625
3
[]
no_license
# -*- coding: utf-8 -*- import time import urllib import requests from bs4 import BeautifulSoup headers = { 'user-agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.86 Safari/537.36' } print "每頁商品清單" user_input = raw_input('Search key word:') item_link = "k={}&t=...
true
d5d56d4e97599137952b515e48b094d306396eb1
bappasahabapi/python-series-01
/H14_Exerice.py
UTF-8
141
2.640625
3
[]
no_license
# output: this is \\ backslah print(" this is \\\\ backslah") # output: this is \\ backslah print("these are /\\/\\/\\/\\ mountains")
true
89292f7704d4e5b380723084184cc924f2cc2c78
GB071957/Advent-of-Christmas
/Advent of Code problem 24 part 2 - lobby layout.py
UTF-8
4,032
3.109375
3
[]
no_license
# Advent of Code problem 24 part 2 - Lobby Layout - Program by Greg Brinks from timeit import default_timer as timeit start= timeit() import csv, copy def flip(tiles): new_layout = copy.deepcopy(tiles) for row in range(0,len(tiles)): for tile in range(0,len(tiles[row])): black_count...
true
9e59f8e7f7d8c4c49058651ca62f4461a7f0489a
agitter/OmicsIntegrator
/example/murineFib/build-murine-fib-matrix.py
UTF-8
674
2.515625
3
[ "MIT", "BSD-2-Clause" ]
permissive
#!/usr/local/bin/python ''' This script will build a TF-binding matrix from murine fibroblast data, enabling you to analyze any type of gene expression data ''' __author__='Sara JG Gosline' __email__='sgosline@mit.edu' import os from optparse import OptionParser if __name__=='__main__': parser=OptionParser() ...
true